diff --git a/packages/dnb-design-system-portal/src/pages/uilib/components/textarea/Examples.js b/packages/dnb-design-system-portal/src/pages/uilib/components/textarea/Examples.js index 35293c90d89..704c0227d80 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/components/textarea/Examples.js +++ b/packages/dnb-design-system-portal/src/pages/uilib/components/textarea/Examples.js @@ -36,27 +36,25 @@ class Example extends PureComponent { /> `} - + {/* @jsx */ ` - - @@ -561,7 +569,9 @@ textarea.dnb-textarea { padding: var(--textarea-padding-width); padding-top: calc( var(--textarea-padding-width) - var(--textarea-vertical-correction)); padding-bottom: var(--textarea-vertical-correction); - line-height: 1.5rem; } + line-height: 1.5rem; + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; } .dnb-textarea__textarea, .dnb-textarea__textarea textarea { margin: 0; } @@ -573,8 +583,24 @@ textarea.dnb-textarea { .dnb-textarea--has-content .dnb-textarea__textarea ~ .dnb-textarea__placeholder, .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not([readonly]) ~ .dnb-textarea__placeholder { opacity: 0.5; } - .dnb-textarea__form-status .dnb-form-status { + .dnb-textarea__wrapper[class*='__status'] .dnb-form-status { margin: 1rem 0 0 calc(1px - 1px - var(--textarea-padding-width)); } + .dnb-textarea--stretch .dnb-textarea { + flex: 1; } + .dnb-textarea--stretch .dnb-textarea, .dnb-textarea--stretch .dnb-textarea__shell, .dnb-textarea--stretch .dnb-textarea__textarea { + width: 100%; } + .dnb-textarea__wrapper { + display: inline-flex; + align-items: baseline; } + .dnb-textarea__wrapper.dnb-textarea--vertical { + display: inline-flex; + flex-direction: column; } + .dnb-textarea__wrapper.dnb-textarea--stretch { + display: flex; } + .dnb-textarea__wrapper[class*='__status'] { + align-items: flex-start; } + .dnb-textarea__wrapper[class*='__status'] > .dnb-form-label { + margin-top: 0.25rem; } textarea.dnb-textarea { display: inline-block; @@ -586,6 +612,8 @@ textarea.dnb-textarea { padding-top: calc( var(--textarea-padding-width) - var(--textarea-vertical-correction)); padding-bottom: var(--textarea-vertical-correction); line-height: 1.5rem; + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; border-radius: 0.5rem; /* IE11 fix */ } textarea.dnb-textarea, @@ -630,8 +658,6 @@ textarea.dnb-textarea { textarea.dnb-textarea { -ms-overflow-style: -ms-autohiding-scrollba; box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); } } - label + textarea.dnb-textarea[class*='__form-status'] { - vertical-align: baseline; } .dnb-form-row--vertical > .dnb-textarea { transform: translateY(2px); } diff --git a/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-error-textarea-style-1-355e0.snap.png b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-error-textarea-style-1-355e0.snap.png index f130a29f1e2..b3f700e05c4 100644 Binary files a/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-error-textarea-style-1-355e0.snap.png and b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-error-textarea-style-1-355e0.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss b/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss index f62e8d2b275..d4a7014a9a2 100644 --- a/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss +++ b/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss @@ -36,6 +36,7 @@ var(--color-sea-green-alt); @include textareaStyleCommon(); + @include numberFeature(lining-nums, lnum); } .dnb-textarea { @@ -84,9 +85,39 @@ opacity: 0.5; } - &__form-status .dnb-form-status { + &__wrapper[class*='__status'] .dnb-form-status { margin: 1rem 0 0 calc(1px - 1px - var(--textarea-padding-width)); } + + // make the input full width + &--stretch & { + flex: 1; + &, + &__shell, + &__textarea { + width: 100%; + } + } + + // Wrapper layout handling + &__wrapper { + display: inline-flex; + align-items: baseline; + } + &__wrapper#{&}--vertical { + display: inline-flex; + flex-direction: column; + } + &__wrapper#{&}--stretch { + display: flex; + } + &__wrapper[class*='__status'] { + align-items: flex-start; + > .dnb-form-label { + // vertical align the current font + margin-top: 0.25rem; + } + } } textarea.dnb-textarea { @@ -95,10 +126,6 @@ textarea.dnb-textarea { @include textareaStyle(); @include textareaTheme(); - - label + &[class*='__form-status'] { - vertical-align: baseline; - } } // enhance "FormRow" components styles diff --git a/packages/dnb-ui-lib/stories/components/Input.js b/packages/dnb-ui-lib/stories/components/Input.js index 92d5fa13135..696629542ce 100644 --- a/packages/dnb-ui-lib/stories/components/Input.js +++ b/packages/dnb-ui-lib/stories/components/Input.js @@ -32,7 +32,7 @@ export default [

I have still to be on the grid!

+ +