From 11fd926590a11b8da12ec32f6b6603cd3335c1e3 Mon Sep 17 00:00:00 2001 From: davidritter-dotcom Date: Wed, 29 Nov 2023 15:30:14 +0100 Subject: [PATCH 01/22] feat(documentation, styles): some small changes --- .../components/textarea/textarea.stories.ts | 30 +++++++++++++++++-- packages/styles/src/components/forms.scss | 7 ++++- .../src/variables/components/_forms.scss | 20 +++++++++---- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/packages/documentation/src/stories/components/textarea/textarea.stories.ts b/packages/documentation/src/stories/components/textarea/textarea.stories.ts index 367f243cc3..0984cc6fec 100644 --- a/packages/documentation/src/stories/components/textarea/textarea.stories.ts +++ b/packages/documentation/src/stories/components/textarea/textarea.stories.ts @@ -21,6 +21,7 @@ const meta: Meta = { hiddenLabel: false, value: undefined, size: 'null', + sizeWithFloatingLabel: 'null', rows: 4, hint: 'Hintus textus elare volare cantare hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.', disabled: false, @@ -93,13 +94,32 @@ const meta: Meta = { category: 'General', }, }, + sizeWithFloatingLabel: { + name: 'Size', + description: "Sets the size of the component's appearance.", + if: { + arg: 'floatingLabel', + truthy: true, + }, + control: { + type: 'select', + labels: { + 'form-control-sm': 'Small', + 'form-control-lg': 'Large', + }, + }, + options: ['form-control-sm', 'form-control-lg'], + table: { + category: 'General', + }, + }, rows: { name: 'Rows', description: 'Attribute to set the initial height, in lines of text, of the `textarea` element.', control: { - type: 'number', - min: 3, + type: 'range', + min: 2, max: 10, step: 1, }, @@ -156,6 +176,8 @@ function renderTextarea(args: Args, context: StoryContext) { const classes = mapClasses({ 'form-control': true, [args.size]: args.size && args.size !== 'null', + [args.sizeWithFloatingLabel]: + args.sizeWithFloatingLabel && args.sizeWithFloatingLabel !== 'null', [args.validation]: args.validation && args.validation !== 'null', }); const useAriaLabel = !args.floatingLabel && args.hiddenLabel; @@ -200,7 +222,9 @@ function renderTextarea(args: Args, context: StoryContext) { aria-label=${useAriaLabel ? args.label : nothing} aria-invalid=${VALIDATION_STATE_MAP[args.validation] ?? nothing} style=${args.resize ?? nothing} - >${args.textInside ?? nothing} + > +${args.textInside ?? nothing} `; if (args.floatingLabel) { return html` diff --git a/packages/styles/src/components/forms.scss b/packages/styles/src/components/forms.scss index 1e4528a07f..b69072815e 100644 --- a/packages/styles/src/components/forms.scss +++ b/packages/styles/src/components/forms.scss @@ -3,6 +3,7 @@ @use './../lic/bootstrap-license'; @use './../variables/components/forms'; +@use './../spacing'; @use './../mixins/utilities'; @use './../mixins/forms' as form-mixins; @@ -16,6 +17,10 @@ @include form-mixins.form-control-rg; } +.form-control-lg { + padding: spacing.$size-regular 0 spacing.$size-mini spacing.$size-regular; +} + select.form-control-rg:not([size]):not([multiple]) { height: forms.$input-height-rg; } @@ -55,7 +60,7 @@ select.form-control-rg:not([size]):not([multiple]) { // Fix Safari cutoff when change the initial position of the selector button. /* stylelint-disable-next-line */ - @supports (background: -webkit-named-image(i)) { + @supports (background: - webkit-named-image(i)) { &::file-selector-button { display: initial; position: initial; diff --git a/packages/styles/src/variables/components/_forms.scss b/packages/styles/src/variables/components/_forms.scss index 9218bfb071..260a5564bc 100644 --- a/packages/styles/src/variables/components/_forms.scss +++ b/packages/styles/src/variables/components/_forms.scss @@ -13,7 +13,7 @@ // Forms $form-label-margin-bottom: 0.5rem !default; -$form-label-color: rgba(var(--post-contrast-color-rgb), 0.8) !default; +$form-label-color: var(--post-contrast-color-rgb) !default; $input-padding-y: button.$input-btn-padding-y !default; $input-padding-x: button.$input-btn-padding-x !default; @@ -27,9 +27,10 @@ $input-padding-y-rg: button.$input-btn-padding-y-rg !default; $input-padding-x-rg: button.$input-btn-padding-x-rg !default; $input-line-height-rg: type.$line-height-copy !default; -$input-padding-y-lg: spacing.$size-small-large !default; +$input-padding-y-lg: spacing.$size-regular !default; $input-padding-x-lg: button.$input-btn-padding-x-lg !default; $input-line-height-lg: type.$line-height-copy !default; +$input-font-size-lg: type.$font-size-16 !default; $input-bg: color.$white !default; $input-disabled-bg: rgba(var(--post-contrast-color-inverted-rgb), 0.6) !default; @@ -74,7 +75,9 @@ $input-height-content-lg: type.$font-size-medium * $input-line-height-lg !defaul $input-height-inner-lg: $input-height-content-lg + ($input-padding-y-lg * 2) !default; // Design System $input-height-lg: calc(#{$input-height-inner-lg} + #{$input-height-border}) !default; -$input-transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !default; +$input-transition: + border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out !default; $form-text-color: var(--post-contrast-color); $form-text-font-size: type.$font-size-tiny; @@ -94,7 +97,9 @@ $form-range-thumb-width: 2rem !default; $form-range-thumb-height: $form-range-thumb-width !default; $form-range-thumb-bg: color.$white !default; $form-range-thumb-border: 2px solid color.$black !default; -$form-range-thumb-focus-box-shadow: 0 0 0 1px color.$black, 0 0 0 0.2rem rgba(color.$gray-80, 0.25) !default; +$form-range-thumb-focus-box-shadow: + 0 0 0 1px color.$black, + 0 0 0 0.2rem rgba(color.$gray-80, 0.25) !default; $form-range-thumb-focus-box-shadow-width: 0.2rem; // For focus box shadow issue in Edge $form-range-thumb-active-bg: color.$white !default; $form-range-thumb-disabled-bg: $form-range-thumb-bg !default; @@ -128,7 +133,10 @@ $form-floating-label-padding-t: calc( $form-floating-label-translate-x: $form-floating-padding-x * (1 - $form-floating-label-scale); $form-floating-label-transform: scale($form-floating-label-scale); $form-floating-transition: animation.$transition-base; -$form-floating-transition-in: $form-floating-transition, +$form-floating-transition-in: + $form-floating-transition, width 0ms list.nth(animation.$transition-base, 2); -$form-floating-transition-out: $form-floating-transition, width 0ms linear; +$form-floating-transition-out: + $form-floating-transition, + width 0ms linear; $form-floating-select-bg-size: 32px 32px; From 512a8696c642816a7acc9b3e4e5450d140d7844e Mon Sep 17 00:00:00 2001 From: davidritter-dotcom Date: Wed, 29 Nov 2023 16:57:13 +0100 Subject: [PATCH 02/22] feat(styles): padding ajustment form-control-lg --- packages/styles/src/components/forms.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/styles/src/components/forms.scss b/packages/styles/src/components/forms.scss index b69072815e..2e80140a9f 100644 --- a/packages/styles/src/components/forms.scss +++ b/packages/styles/src/components/forms.scss @@ -3,7 +3,7 @@ @use './../lic/bootstrap-license'; @use './../variables/components/forms'; -@use './../spacing'; +@use './../variables/spacing'; @use './../mixins/utilities'; @use './../mixins/forms' as form-mixins; @@ -18,7 +18,7 @@ } .form-control-lg { - padding: spacing.$size-regular 0 spacing.$size-mini spacing.$size-regular; + padding: spacing.$size-regular spacing.$size-large spacing.$size-mini spacing.$size-regular; } select.form-control-rg:not([size]):not([multiple]) { From a8472ebf2dee30b28f81f211a4f52d655b3a796c Mon Sep 17 00:00:00 2001 From: davidritter-dotcom Date: Tue, 13 Feb 2024 15:17:25 +0100 Subject: [PATCH 03/22] Revert "feat(styles): padding ajustment" This reverts commit 512a8696c642816a7acc9b3e4e5450d140d7844e. --- packages/styles/src/components/forms.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/styles/src/components/forms.scss b/packages/styles/src/components/forms.scss index 2e80140a9f..b69072815e 100644 --- a/packages/styles/src/components/forms.scss +++ b/packages/styles/src/components/forms.scss @@ -3,7 +3,7 @@ @use './../lic/bootstrap-license'; @use './../variables/components/forms'; -@use './../variables/spacing'; +@use './../spacing'; @use './../mixins/utilities'; @use './../mixins/forms' as form-mixins; @@ -18,7 +18,7 @@ } .form-control-lg { - padding: spacing.$size-regular spacing.$size-large spacing.$size-mini spacing.$size-regular; + padding: spacing.$size-regular 0 spacing.$size-mini spacing.$size-regular; } select.form-control-rg:not([size]):not([multiple]) { From 3f0d8aaa112a8884c5c91711f9da0651ca134868 Mon Sep 17 00:00:00 2001 From: davidritter-dotcom Date: Tue, 13 Feb 2024 15:20:00 +0100 Subject: [PATCH 04/22] Revert "feat(documentation, styles): some small changes" This reverts commit 11fd926590a11b8da12ec32f6b6603cd3335c1e3. --- .../components/textarea/textarea.stories.ts | 30 ++----------------- packages/styles/src/components/forms.scss | 7 +---- .../src/variables/components/_forms.scss | 20 ++++--------- 3 files changed, 10 insertions(+), 47 deletions(-) diff --git a/packages/documentation/src/stories/components/textarea/textarea.stories.ts b/packages/documentation/src/stories/components/textarea/textarea.stories.ts index 0984cc6fec..367f243cc3 100644 --- a/packages/documentation/src/stories/components/textarea/textarea.stories.ts +++ b/packages/documentation/src/stories/components/textarea/textarea.stories.ts @@ -21,7 +21,6 @@ const meta: Meta = { hiddenLabel: false, value: undefined, size: 'null', - sizeWithFloatingLabel: 'null', rows: 4, hint: 'Hintus textus elare volare cantare hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.', disabled: false, @@ -94,32 +93,13 @@ const meta: Meta = { category: 'General', }, }, - sizeWithFloatingLabel: { - name: 'Size', - description: "Sets the size of the component's appearance.", - if: { - arg: 'floatingLabel', - truthy: true, - }, - control: { - type: 'select', - labels: { - 'form-control-sm': 'Small', - 'form-control-lg': 'Large', - }, - }, - options: ['form-control-sm', 'form-control-lg'], - table: { - category: 'General', - }, - }, rows: { name: 'Rows', description: 'Attribute to set the initial height, in lines of text, of the `textarea` element.', control: { - type: 'range', - min: 2, + type: 'number', + min: 3, max: 10, step: 1, }, @@ -176,8 +156,6 @@ function renderTextarea(args: Args, context: StoryContext) { const classes = mapClasses({ 'form-control': true, [args.size]: args.size && args.size !== 'null', - [args.sizeWithFloatingLabel]: - args.sizeWithFloatingLabel && args.sizeWithFloatingLabel !== 'null', [args.validation]: args.validation && args.validation !== 'null', }); const useAriaLabel = !args.floatingLabel && args.hiddenLabel; @@ -222,9 +200,7 @@ function renderTextarea(args: Args, context: StoryContext) { aria-label=${useAriaLabel ? args.label : nothing} aria-invalid=${VALIDATION_STATE_MAP[args.validation] ?? nothing} style=${args.resize ?? nothing} - > -${args.textInside ?? nothing} + >${args.textInside ?? nothing} `; if (args.floatingLabel) { return html` diff --git a/packages/styles/src/components/forms.scss b/packages/styles/src/components/forms.scss index b69072815e..1e4528a07f 100644 --- a/packages/styles/src/components/forms.scss +++ b/packages/styles/src/components/forms.scss @@ -3,7 +3,6 @@ @use './../lic/bootstrap-license'; @use './../variables/components/forms'; -@use './../spacing'; @use './../mixins/utilities'; @use './../mixins/forms' as form-mixins; @@ -17,10 +16,6 @@ @include form-mixins.form-control-rg; } -.form-control-lg { - padding: spacing.$size-regular 0 spacing.$size-mini spacing.$size-regular; -} - select.form-control-rg:not([size]):not([multiple]) { height: forms.$input-height-rg; } @@ -60,7 +55,7 @@ select.form-control-rg:not([size]):not([multiple]) { // Fix Safari cutoff when change the initial position of the selector button. /* stylelint-disable-next-line */ - @supports (background: - webkit-named-image(i)) { + @supports (background: -webkit-named-image(i)) { &::file-selector-button { display: initial; position: initial; diff --git a/packages/styles/src/variables/components/_forms.scss b/packages/styles/src/variables/components/_forms.scss index 260a5564bc..9218bfb071 100644 --- a/packages/styles/src/variables/components/_forms.scss +++ b/packages/styles/src/variables/components/_forms.scss @@ -13,7 +13,7 @@ // Forms $form-label-margin-bottom: 0.5rem !default; -$form-label-color: var(--post-contrast-color-rgb) !default; +$form-label-color: rgba(var(--post-contrast-color-rgb), 0.8) !default; $input-padding-y: button.$input-btn-padding-y !default; $input-padding-x: button.$input-btn-padding-x !default; @@ -27,10 +27,9 @@ $input-padding-y-rg: button.$input-btn-padding-y-rg !default; $input-padding-x-rg: button.$input-btn-padding-x-rg !default; $input-line-height-rg: type.$line-height-copy !default; -$input-padding-y-lg: spacing.$size-regular !default; +$input-padding-y-lg: spacing.$size-small-large !default; $input-padding-x-lg: button.$input-btn-padding-x-lg !default; $input-line-height-lg: type.$line-height-copy !default; -$input-font-size-lg: type.$font-size-16 !default; $input-bg: color.$white !default; $input-disabled-bg: rgba(var(--post-contrast-color-inverted-rgb), 0.6) !default; @@ -75,9 +74,7 @@ $input-height-content-lg: type.$font-size-medium * $input-line-height-lg !defaul $input-height-inner-lg: $input-height-content-lg + ($input-padding-y-lg * 2) !default; // Design System $input-height-lg: calc(#{$input-height-inner-lg} + #{$input-height-border}) !default; -$input-transition: - border-color 0.15s ease-in-out, - box-shadow 0.15s ease-in-out !default; +$input-transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !default; $form-text-color: var(--post-contrast-color); $form-text-font-size: type.$font-size-tiny; @@ -97,9 +94,7 @@ $form-range-thumb-width: 2rem !default; $form-range-thumb-height: $form-range-thumb-width !default; $form-range-thumb-bg: color.$white !default; $form-range-thumb-border: 2px solid color.$black !default; -$form-range-thumb-focus-box-shadow: - 0 0 0 1px color.$black, - 0 0 0 0.2rem rgba(color.$gray-80, 0.25) !default; +$form-range-thumb-focus-box-shadow: 0 0 0 1px color.$black, 0 0 0 0.2rem rgba(color.$gray-80, 0.25) !default; $form-range-thumb-focus-box-shadow-width: 0.2rem; // For focus box shadow issue in Edge $form-range-thumb-active-bg: color.$white !default; $form-range-thumb-disabled-bg: $form-range-thumb-bg !default; @@ -133,10 +128,7 @@ $form-floating-label-padding-t: calc( $form-floating-label-translate-x: $form-floating-padding-x * (1 - $form-floating-label-scale); $form-floating-label-transform: scale($form-floating-label-scale); $form-floating-transition: animation.$transition-base; -$form-floating-transition-in: - $form-floating-transition, +$form-floating-transition-in: $form-floating-transition, width 0ms list.nth(animation.$transition-base, 2); -$form-floating-transition-out: - $form-floating-transition, - width 0ms linear; +$form-floating-transition-out: $form-floating-transition, width 0ms linear; $form-floating-select-bg-size: 32px 32px; From 1928f9d7571b780dcf69a68814f6e51ed203603e Mon Sep 17 00:00:00 2001 From: davidritter-dotcom Date: Wed, 14 Feb 2024 13:07:21 +0100 Subject: [PATCH 05/22] feat(docs): docs and story --- .../forms/textarea/textarea.docs.mdx | 12 +++--- .../forms/textarea/textarea.stories.ts | 37 +++++++++++++++---- .../styles/src/components/form-textarea.scss | 14 +++++++ .../src/variables/components/_forms.scss | 1 + 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/packages/documentation/src/stories/components/forms/textarea/textarea.docs.mdx b/packages/documentation/src/stories/components/forms/textarea/textarea.docs.mdx index aff25e957b..a20cca5312 100644 --- a/packages/documentation/src/stories/components/forms/textarea/textarea.docs.mdx +++ b/packages/documentation/src/stories/components/forms/textarea/textarea.docs.mdx @@ -34,7 +34,8 @@ But note that the `