diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a07f4f4136..4853f6e1e2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## May, 27. 2019 + +- New component in the `dnb-ui-lib`: [Textarea](/uilib/components/textarea). Got also a wider corner radius by `16px (1rem)`. + +## May, 27. 2019 + +- New component in the `dnb-ui-lib`: [Checkbox](/uilib/components/checkbox) and [Radio](/uilib/components/radio) button + ## May, 19. 2019 - New component in the `dnb-ui-lib`: Circular [ProgressIndicator](/uilib/components/progress-indicator) bar (spinner with animation) diff --git a/packages/dnb-design-system-portal/src/pages/uilib/components.md b/packages/dnb-design-system-portal/src/pages/uilib/components.md index 3e36d64ab2d..dcc1c4f9f75 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/components.md +++ b/packages/dnb-design-system-portal/src/pages/uilib/components.md @@ -89,3 +89,7 @@ The `Switch` component (toggle) is a digital on/off switch. Toggle switches are ## [Tabs](/uilib/components/tabs) Tabs are a set of buttons which allow navigation between content that is related and on the same level of hierarchy. + +## [Textarea](/uilib/components/textarea) + +The `Textarea` component has to be used as a multi-line text input control with an unlimited number of characters possible. diff --git a/packages/dnb-design-system-portal/src/pages/uilib/components/input/Examples.js b/packages/dnb-design-system-portal/src/pages/uilib/components/input/Examples.js index 5037a7ecd1a..6ef382b0259 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/components/input/Examples.js +++ b/packages/dnb-design-system-portal/src/pages/uilib/components/input/Examples.js @@ -80,7 +80,7 @@ class Example extends PureComponent { /> `} - + {/* @jsx */ ` + + + + + + + + + + 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 new file mode 100644 index 00000000000..d38e5d6f903 --- /dev/null +++ b/packages/dnb-design-system-portal/src/pages/uilib/components/textarea/Examples.js @@ -0,0 +1,123 @@ +/** + * UI lib Component Example + * + */ + +import React, { PureComponent, Fragment } from 'react' +import ComponentBox from '../../../../shared/tags/ComponentBox' +import styled from '@emotion/styled' + +class Example extends PureComponent { + render() { + return ( + + + {/* @jsx */ ` + +`; + +exports[`Textarea scss have to match default theme snapshot 1`] = ` +"/* +* Textarea theme +* +*/ +/** + * This file is only used to make themes independent + * so that they can get imported individually, without the core styles + * + */ +/* + * Utilities + */ +:root { + --textarea-text-color: var(--color-sea-green); + --textarea-text-color--focus: var(--color-sea-green); + --textarea-text-color--changed: var(--color-emerald-green); + --textarea-text-color--disabled: var(--color-sea-green-alt-30); + --textarea-background-color: var(--color-white); + --textarea-background-color--focus: var(--color-white); + --textarea-background-color--changed: var(--color-white); + --textarea-background-color--disabled: var(--color-mint-green-12); } + +.dnb-textarea__textarea { + border-radius: 0.5rem; + /* IE11 fix */ } + .dnb-textarea__textarea, + .dnb-textarea--virgin .dnb-textarea__textarea, + .dnb-textarea--initial .dnb-textarea__textarea { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); } + .dnb-textarea--dirty .dnb-textarea__textarea { + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); } + .dnb-textarea--focus .dnb-textarea__textarea, .dnb-textarea__textarea:focus, .dnb-textarea__textarea:hover { + outline: none; } + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]), .dnb-textarea__textarea:focus:not([disabled]), .dnb-textarea__textarea:hover:not([disabled]) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); } + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not(.status--error), .dnb-textarea__textarea:focus:not([disabled]):not(.status--error), .dnb-textarea__textarea:hover:not([disabled]):not(.status--error) { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-emerald-green); + /* IE11 fix */ } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not(.status--error), .dnb-textarea__textarea:focus:not([disabled]):not(.status--error), .dnb-textarea__textarea:hover:not([disabled]):not(.status--error) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } + .dnb-textarea__textarea[disabled], + .dnb-textarea--disabled .dnb-textarea__textarea { + user-select: none; + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + box-shadow: 0 0 0 var(--textarea-padding-width) var(--color-mint-green-12), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt-30); } + .dnb-textarea__textarea[disabled]::-webkit-scrollbar, + .dnb-textarea--disabled .dnb-textarea__textarea::-webkit-scrollbar { + width: 0; } + .dnb-textarea__textarea.status--error, + .dnb-textarea__textarea .dnb-textarea__status--error { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + .dnb-textarea__textarea ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea__textarea { + -ms-overflow-style: -ms-autohiding-scrollba; + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); } } + +.dnb-textarea__placeholder { + color: var(--textarea-text-color); + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: var(--textarea-rows, 2); } + +.dnb-textarea__status--error:not(.dnb-textarea--focus) .dnb-textarea__textarea, .dnb-textarea__status--error:not(.dnb-textarea--focus) .dnb-textarea__textarea:hover { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + +.dnb-textarea--has-content .dnb-textarea__textarea ~ .dnb-textarea__placeholder, +.dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not([readonly]) ~ .dnb-textarea__placeholder { + display: none; } + +textarea.dnb-textarea { + border-radius: 0.5rem; + /* IE11 fix */ } + textarea.dnb-textarea, + .dnb-textarea--virgin textarea.dnb-textarea, + .dnb-textarea--initial textarea.dnb-textarea { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); } + .dnb-textarea--dirty textarea.dnb-textarea { + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); } + .dnb-textarea--focus textarea.dnb-textarea, textarea.dnb-textarea:focus, textarea.dnb-textarea:hover { + outline: none; } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]), textarea.dnb-textarea:focus:not([disabled]), textarea.dnb-textarea:hover:not([disabled]) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-emerald-green); + /* IE11 fix */ } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } + textarea.dnb-textarea[disabled], + .dnb-textarea--disabled textarea.dnb-textarea { + user-select: none; + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + box-shadow: 0 0 0 var(--textarea-padding-width) var(--color-mint-green-12), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt-30); } + textarea.dnb-textarea[disabled]::-webkit-scrollbar, + .dnb-textarea--disabled textarea.dnb-textarea::-webkit-scrollbar { + width: 0; } + textarea.dnb-textarea.status--error, + textarea.dnb-textarea .dnb-textarea__status--error { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + textarea.dnb-textarea ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + textarea.dnb-textarea { + -ms-overflow-style: -ms-autohiding-scrollba; + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); } } +" +`; + +exports[`Textarea scss have to match snapshot 1`] = ` +"/* +* DNB Textarea +* +*/ +/** + * This file is only used to make components independent + * so that they can get imported individually, without the core styles + * + */ +/* + * Utilities + */ +/* + * Scopes + * + */ +/* + * Document Reset + * + */ +/* +* DNB FormLabel +* +*/ +.dnb-form-label { + font-family: var(--font-family-default); + font-weight: var(--font-weight-default); + font-size: 1rem; + font-style: normal; + line-height: 1.5rem; + color: var(--color-black-80, #333); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; + /** + * 1. Remove repeating backgrounds in all browsers (opinionated). + * 2. Add border box sizing in all browsers (opinionated). + */ + /** + * 1. Add text decoration inheritance in all browsers (opinionated). + * 2. Add vertical alignment inheritance in all browsers (opinionated). + */ + margin: 0; + padding: 0; } + .dnb-form-label *, + .dnb-form-label ::before, + .dnb-form-label ::after { + background-repeat: no-repeat; + /* 1 */ + box-sizing: border-box; + /* 2 */ } + .dnb-form-label ::before, + .dnb-form-label ::after { + text-decoration: inherit; + /* 1 */ + vertical-align: inherit; + /* 2 */ } + +/* + * FormLabel component + * + */ +.dnb-form-label { + user-select: none; + margin-right: 1rem; + display: inline-block; + vertical-align: baseline; + cursor: pointer; + color: inherit; + width: auto; + white-space: nowrap; } + .dnb-form-label--vertical { + margin-right: 0; + margin-top: 0; } + .dnb-form-label[for]:not([disabled]):hover { + color: var(--color-sea-green); } + .dnb-form-label[disabled] { + cursor: not-allowed; } + +/* +* DNB FormStatus +* +*/ +.dnb-form-status { + font-family: var(--font-family-default); + font-weight: var(--font-weight-default); + font-size: 1rem; + font-style: normal; + line-height: 1.5rem; + color: var(--color-black-80, #333); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; + /** + * 1. Remove repeating backgrounds in all browsers (opinionated). + * 2. Add border box sizing in all browsers (opinionated). + */ + /** + * 1. Add text decoration inheritance in all browsers (opinionated). + * 2. Add vertical alignment inheritance in all browsers (opinionated). + */ + margin: 0; + padding: 0; } + .dnb-form-status *, + .dnb-form-status ::before, + .dnb-form-status ::after { + background-repeat: no-repeat; + /* 1 */ + box-sizing: border-box; + /* 2 */ } + .dnb-form-status ::before, + .dnb-form-status ::after { + text-decoration: inherit; + /* 1 */ + vertical-align: inherit; + /* 2 */ } + +/* + * FormStatus component + * + */ +.dnb-form-status { + width: auto; + display: flex; + justify-content: flex-start; + align-items: center; + min-height: var(--input-height); + border-radius: var(--input-border-radius); + line-height: 0.5rem; } + .dnb-form-status--text { + padding: calc(0.5rem / 2) 1rem; + cursor: text; + color: var(--color-emerald-green); + line-height: 1.5rem; } + .dnb-icon + .dnb-form-status--text { + padding-left: 0.5rem; } + .dnb-form-status > .dnb-icon { + display: flex; + justify-content: center; + align-items: center; + width: 1.5em; + height: 1.5em; + margin-left: 0.5rem; + color: inherit; + font-size: 1rem; + border-radius: 50%; + border: 1px solid; + border-color: currentColor; } + .dnb-form-status[hidden] { + display: none; } + .dnb-form-status--fade-in { + height: 0; + opacity: 0; + animation: fade-in 600ms ease-out 1 200ms forwards; } + +@keyframes fade-in { + from { + opacity: 0; + height: 0; } + to { + opacity: 1; + height: var(--input-height); } } + +.dnb-textarea { + font-family: var(--font-family-default); + font-weight: var(--font-weight-default); + font-size: 1rem; + font-style: normal; + line-height: 1.5rem; + color: var(--color-black-80, #333); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; + /** + * 1. Remove repeating backgrounds in all browsers (opinionated). + * 2. Add border box sizing in all browsers (opinionated). + */ + /** + * 1. Add text decoration inheritance in all browsers (opinionated). + * 2. Add vertical alignment inheritance in all browsers (opinionated). + */ + margin: 0; + padding: 0; } + .dnb-textarea *, + .dnb-textarea ::before, + .dnb-textarea ::after { + background-repeat: no-repeat; + /* 1 */ + box-sizing: border-box; + /* 2 */ } + .dnb-textarea ::before, + .dnb-textarea ::after { + text-decoration: inherit; + /* 1 */ + vertical-align: inherit; + /* 2 */ } + +/* +* Textarea component +* +*/ +/* +* Textarea theme +* +*/ +/** + * This file is only used to make themes independent + * so that they can get imported individually, without the core styles + * + */ +:root { + --textarea-text-color: var(--color-sea-green); + --textarea-text-color--focus: var(--color-sea-green); + --textarea-text-color--changed: var(--color-emerald-green); + --textarea-text-color--disabled: var(--color-sea-green-alt-30); + --textarea-background-color: var(--color-white); + --textarea-background-color--focus: var(--color-white); + --textarea-background-color--changed: var(--color-white); + --textarea-background-color--disabled: var(--color-mint-green-12); } + +.dnb-textarea__textarea { + border-radius: 0.5rem; + /* IE11 fix */ } + .dnb-textarea__textarea, + .dnb-textarea--virgin .dnb-textarea__textarea, + .dnb-textarea--initial .dnb-textarea__textarea { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); } + .dnb-textarea--dirty .dnb-textarea__textarea { + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); } + .dnb-textarea--focus .dnb-textarea__textarea, .dnb-textarea__textarea:focus, .dnb-textarea__textarea:hover { + outline: none; } + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]), .dnb-textarea__textarea:focus:not([disabled]), .dnb-textarea__textarea:hover:not([disabled]) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); } + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not(.status--error), .dnb-textarea__textarea:focus:not([disabled]):not(.status--error), .dnb-textarea__textarea:hover:not([disabled]):not(.status--error) { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-emerald-green); + /* IE11 fix */ } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not(.status--error), .dnb-textarea__textarea:focus:not([disabled]):not(.status--error), .dnb-textarea__textarea:hover:not([disabled]):not(.status--error) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } + .dnb-textarea__textarea[disabled], + .dnb-textarea--disabled .dnb-textarea__textarea { + user-select: none; + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + box-shadow: 0 0 0 var(--textarea-padding-width) var(--color-mint-green-12), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt-30); } + .dnb-textarea__textarea[disabled]::-webkit-scrollbar, + .dnb-textarea--disabled .dnb-textarea__textarea::-webkit-scrollbar { + width: 0; } + .dnb-textarea__textarea.status--error, + .dnb-textarea__textarea .dnb-textarea__status--error { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + .dnb-textarea__textarea ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea__textarea { + -ms-overflow-style: -ms-autohiding-scrollba; + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); } } + +.dnb-textarea__placeholder { + color: var(--textarea-text-color); + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: var(--textarea-rows, 2); } + +.dnb-textarea__status--error:not(.dnb-textarea--focus) .dnb-textarea__textarea, .dnb-textarea__status--error:not(.dnb-textarea--focus) .dnb-textarea__textarea:hover { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + +.dnb-textarea--has-content .dnb-textarea__textarea ~ .dnb-textarea__placeholder, +.dnb-textarea--focus .dnb-textarea__textarea:not([disabled]):not([readonly]) ~ .dnb-textarea__placeholder { + display: none; } + +textarea.dnb-textarea { + border-radius: 0.5rem; + /* IE11 fix */ } + textarea.dnb-textarea, + .dnb-textarea--virgin textarea.dnb-textarea, + .dnb-textarea--initial textarea.dnb-textarea { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); } + .dnb-textarea--dirty textarea.dnb-textarea { + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); } + .dnb-textarea--focus textarea.dnb-textarea, textarea.dnb-textarea:focus, textarea.dnb-textarea:hover { + outline: none; } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]), textarea.dnb-textarea:focus:not([disabled]), textarea.dnb-textarea:hover:not([disabled]) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-emerald-green); + /* IE11 fix */ } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } + textarea.dnb-textarea[disabled], + .dnb-textarea--disabled textarea.dnb-textarea { + user-select: none; + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + box-shadow: 0 0 0 var(--textarea-padding-width) var(--color-mint-green-12), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt-30); } + textarea.dnb-textarea[disabled]::-webkit-scrollbar, + .dnb-textarea--disabled textarea.dnb-textarea::-webkit-scrollbar { + width: 0; } + textarea.dnb-textarea.status--error, + textarea.dnb-textarea .dnb-textarea__status--error { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + textarea.dnb-textarea ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + textarea.dnb-textarea { + -ms-overflow-style: -ms-autohiding-scrollba; + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); } } + +:root { + --textarea-vertical-correction: 0.25rem; + --textarea-padding-width: 0.5rem; + --textarea-border-inner: 0 0 0 var(--textarea-padding-width) + var(--color-white); } + +.dnb-textarea { + display: inline-flex; + flex-direction: column; + margin: var(--textarea-padding-width); } + .dnb-textarea__shell { + display: inline-flex; + position: relative; } + .dnb-textarea__placeholder { + pointer-events: none; + position: absolute; + z-index: 1; + top: 0; + left: 0; + overflow: hidden; + width: 100%; + height: 100%; + 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; } + .dnb-textarea__textarea { + border: none; + border-radius: 1px; + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt); + 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; } + .dnb-textarea__placeholder, .dnb-textarea__textarea { + text-align: left; } + .dnb-textarea__align--right .dnb-textarea__textarea, + .dnb-textarea__align--right .dnb-textarea__placeholder { + text-align: right; } + .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 { + margin: 1rem 0 0 calc(1px - 1px - var(--textarea-padding-width)); } + +textarea.dnb-textarea { + display: inline-block; + margin: var(--textarea-padding-width); + border: none; + border-radius: 1px; + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt); + 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; + border-radius: 0.5rem; + /* IE11 fix */ } + textarea.dnb-textarea, + .dnb-textarea--virgin textarea.dnb-textarea, + .dnb-textarea--initial textarea.dnb-textarea { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); } + .dnb-textarea--dirty textarea.dnb-textarea { + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); } + .dnb-textarea--focus textarea.dnb-textarea, textarea.dnb-textarea:focus, textarea.dnb-textarea:hover { + outline: none; } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]), textarea.dnb-textarea:focus:not([disabled]), textarea.dnb-textarea:hover:not([disabled]) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); } + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-emerald-green); + /* IE11 fix */ } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dnb-textarea--focus textarea.dnb-textarea:not([disabled]):not(.status--error), textarea.dnb-textarea:focus:not([disabled]):not(.status--error), textarea.dnb-textarea:hover:not([disabled]):not(.status--error) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); } } + textarea.dnb-textarea[disabled], + .dnb-textarea--disabled textarea.dnb-textarea { + user-select: none; + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + box-shadow: 0 0 0 var(--textarea-padding-width) var(--color-mint-green-12), 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) var(--color-sea-green-alt-30); } + textarea.dnb-textarea[disabled]::-webkit-scrollbar, + .dnb-textarea--disabled textarea.dnb-textarea::-webkit-scrollbar { + width: 0; } + textarea.dnb-textarea.status--error, + textarea.dnb-textarea .dnb-textarea__status--error { + box-shadow: var(--textarea-border-inner), 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) var(--color-cherry-red); } + textarea.dnb-textarea ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; } + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + 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-group__position--vertical > .dnb-textarea { + transform: translateY(2px); } + +.dnb-form-group:not(.dnb-form-group__position--vertical) > .dnb-textarea, .dnb-form-group__position--hoizontal:not(.dnb-form-group__position--vertical) > .dnb-textarea { + transform: translateY(calc(1px - 1px - var(--textarea-vertical-correction))); + margin-top: 0; } +" +`; 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 new file mode 100644 index 00000000000..ef5b0ae2bcb Binary files /dev/null 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/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png new file mode 100644 index 00000000000..b1f4f2714ec Binary files /dev/null and b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-focus-textarea-style-1-9fcc3.snap.png b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-focus-textarea-style-1-9fcc3.snap.png new file mode 100644 index 00000000000..0fb98b9594c Binary files /dev/null and b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-focus-textarea-style-1-9fcc3.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-hover-textarea-style-1-b1419.snap.png b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-hover-textarea-style-1-b1419.snap.png new file mode 100644 index 00000000000..f025afa905d Binary files /dev/null and b/packages/dnb-ui-lib/src/components/textarea/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-hover-textarea-style-1-b1419.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/textarea/index.js b/packages/dnb-ui-lib/src/components/textarea/index.js new file mode 100644 index 00000000000..fe8d1af5a8b --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/index.js @@ -0,0 +1,6 @@ +/** + * Component Entry + * + */ + +export * from './Textarea' diff --git a/packages/dnb-ui-lib/src/components/textarea/style.js b/packages/dnb-ui-lib/src/components/textarea/style.js new file mode 100644 index 00000000000..065d27671e3 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style.js @@ -0,0 +1,6 @@ +/** + * Web Style Import + * + */ + +import './style/dnb-textarea.scss' diff --git a/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss b/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss new file mode 100644 index 00000000000..afaeff6e246 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style/_textarea.scss @@ -0,0 +1,120 @@ +/* +* Textarea component +* +*/ + +@import './themes/dnb-textarea-theme-ui.scss'; + +:root { + --textarea-vertical-correction: 0.25rem; // for chromium browsers + --textarea-padding-width: 0.5rem; + --textarea-border-inner: 0 0 0 var(--textarea-padding-width) + var(--color-white); +} + +@mixin textareaStyleCommon() { + 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; +} +@mixin textareaStyle() { + border: none; + border-radius: 1px; + + box-shadow: var(--textarea-border-inner), + 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) + var(--color-sea-green-alt); + + @include textareaStyleCommon(); +} + +.dnb-textarea { + display: inline-flex; + flex-direction: column; + + margin: var(--textarea-padding-width); + + &__shell { + display: inline-flex; + position: relative; + } + + &__placeholder { + pointer-events: none; + + position: absolute; + z-index: 1; + top: 0; + left: 0; + + overflow: hidden; + width: 100%; // to get overflow working properly + height: 100%; // to get overflow working properly + + @include textareaStyleCommon(); + } + + &__textarea { + @include textareaStyle(); + } + + &__placeholder, + &__textarea { + text-align: left; + } + + &__align--right &__textarea, + &__align--right &__placeholder { + text-align: right; + } + + // hide placeholder on focus + &--has-content &__textarea ~ &__placeholder, + &--focus &__textarea:not([disabled]):not([readonly]) ~ &__placeholder { + opacity: 0.5; + } + + &__form-status .dnb-form-status { + margin: 1rem 0 0 calc(1px - 1px - var(--textarea-padding-width)); + } +} + +textarea.dnb-textarea { + display: inline-block; + margin: var(--textarea-padding-width); + + @include textareaStyle(); + @include textareaTheme(); + + label + &[class*='__form-status'] { + vertical-align: baseline; + } +} + +.dnb-form-group { + // for vertical labeling + &__position--vertical { + // To fake, that we actuallyhave 8px between + > .dnb-textarea { + transform: translateY(2px); + } + } + + // for hoizontal labeling + &, + &__position--hoizontal { + // To fake, that the first line is aligned with the label + &:not(.dnb-form-group__position--vertical) { + > .dnb-textarea { + transform: translateY( + calc(1px - 1px - var(--textarea-vertical-correction)) + ); + margin-top: 0; + } + } + } +} diff --git a/packages/dnb-ui-lib/src/components/textarea/style/dnb-textarea.scss b/packages/dnb-ui-lib/src/components/textarea/style/dnb-textarea.scss new file mode 100644 index 00000000000..8082f9ba8f5 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style/dnb-textarea.scss @@ -0,0 +1,16 @@ +/* +* DNB Textarea +* +*/ + +@import '../../../style/components/imports.scss'; + +// import dependencies +@import '../../form-label/style/dnb-form-label.scss'; +@import '../../form-status/style/dnb-form-status.scss'; + +.dnb-textarea { + @include componentReset(); +} + +@import './_textarea.scss'; diff --git a/packages/dnb-ui-lib/src/components/textarea/style/index.js b/packages/dnb-ui-lib/src/components/textarea/style/index.js new file mode 100644 index 00000000000..ff29f520e0a --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style/index.js @@ -0,0 +1,6 @@ +/** + * Web Style Import + * + */ + +import './dnb-textarea.scss' diff --git a/packages/dnb-ui-lib/src/components/textarea/style/themes/dnb-textarea-theme-ui.scss b/packages/dnb-ui-lib/src/components/textarea/style/themes/dnb-textarea-theme-ui.scss new file mode 100644 index 00000000000..f39f5606ff4 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style/themes/dnb-textarea-theme-ui.scss @@ -0,0 +1,133 @@ +/* +* Textarea theme +* +*/ + +@import '../../../../style/themes/imports.scss'; + +:root { + --textarea-text-color: var(--color-sea-green); + --textarea-text-color--focus: var(--color-sea-green); + --textarea-text-color--changed: var(--color-emerald-green); + --textarea-text-color--disabled: var(--color-sea-green-alt-30); + --textarea-background-color: var(--color-white); + --textarea-background-color--focus: var(--color-white); + --textarea-background-color--changed: var(--color-white); + --textarea-background-color--disabled: var(--color-mint-green-12); +} + +@mixin textareaTheme() { + border-radius: 0.5rem; // will be actually 1rem/16px + + &, + .dnb-textarea--virgin &, + .dnb-textarea--initial & { + color: var(--textarea-text-color); + background-color: var(--textarea-background-color); + } + + // content changed + .dnb-textarea--dirty & { + // Background color of textarea when it has content + color: var(--textarea-text-color--changed); + background-color: var(--textarea-background-color--changed); + } + + // hover and focus + .dnb-textarea--focus &, + &:focus /* for the HTML element */, + &:hover { + outline: none; + &:not([disabled]):not(#{&}--disabled) { + color: var(--textarea-text-color--focus); + background-color: var(--textarea-background-color--focus); + &:not(.status--error) /* for the HTML element */ { + box-shadow: var(--textarea-border-inner), + 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) + var(--color-emerald-green); + + /* IE11 fix */ + @media screen and (-ms-high-contrast: active), + (-ms-high-contrast: none) { + box-shadow: 0 0 0 0.125rem var(--color-emerald-green); + } + } + } + } + + // disabled + &[disabled] /* for the HTML element */, + .dnb-textarea--disabled & { + user-select: none; + + color: var(--textarea-text-color--disabled); + background-color: var(--textarea-background-color--disabled); + + box-shadow: 0 0 0 var(--textarea-padding-width) + var(--color-mint-green-12), + 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) + var(--color-sea-green-alt-30); + + &::-webkit-scrollbar { + width: 0; + } + } + + // only fot the HTML element textarea + &.status--error /* for the HTML element */, + .dnb-textarea__status--error/* for the HTML element */ { + box-shadow: var(--textarea-border-inner), + 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) + var(--color-cherry-red); + } + + ::selection { + background-color: var(--color-mint-green); + color: var(--textarea-text-color--focus); + text-shadow: none; + } + + /* IE11 fix */ + @media screen and (-ms-high-contrast: active), + (-ms-high-contrast: none) { + -ms-overflow-style: -ms-autohiding-scrollba; + box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); + } +} + +.dnb-textarea { + &__textarea { + @include textareaTheme(); + } + + &__placeholder { + color: var(--textarea-text-color); + + // Required for line-clamp + display: -webkit-box; + -webkit-box-orient: vertical; + + // Limit the text block to two lines + -webkit-line-clamp: var(--textarea-rows, 2); + } + + // with status_state = "error" + &__status--error:not(#{&}--focus) &__textarea { + &, + &:not(#{&}--disabled):hover { + box-shadow: var(--textarea-border-inner), + 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) + var(--color-cherry-red); + } + } + + // hide placeholder on focus + &--has-content &__textarea ~ &__placeholder, + &--focus &__textarea:not([disabled]):not([readonly]) ~ &__placeholder { + display: none; + } +} + +textarea.dnb-textarea { + @include textareaTheme(); +} diff --git a/packages/dnb-ui-lib/src/components/textarea/style/themes/ui.js b/packages/dnb-ui-lib/src/components/textarea/style/themes/ui.js new file mode 100644 index 00000000000..f18017bc590 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/style/themes/ui.js @@ -0,0 +1,6 @@ +/** + * Imports the default theme + * + */ + +import './dnb-textarea-theme-ui.scss' diff --git a/packages/dnb-ui-lib/src/components/textarea/web-component.js b/packages/dnb-ui-lib/src/components/textarea/web-component.js new file mode 100644 index 00000000000..68737cc2ae4 --- /dev/null +++ b/packages/dnb-ui-lib/src/components/textarea/web-component.js @@ -0,0 +1,9 @@ +/** + * This file is used to enable Web Components + * + */ + +export * from './index' +import { enableWebComponents } from '../index' + +enableWebComponents() diff --git a/packages/dnb-ui-lib/src/elements/Textarea.js b/packages/dnb-ui-lib/src/elements/Textarea.js deleted file mode 100644 index a671a7af2ed..00000000000 --- a/packages/dnb-ui-lib/src/elements/Textarea.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * HTML Element - * - */ - -import React from 'react' -import E from './Element' - -const Textarea = p => -Textarea.tagName = 'dnb-textarea' -export default Textarea diff --git a/packages/dnb-ui-lib/src/elements/index.js b/packages/dnb-ui-lib/src/elements/index.js index 280c07bbc92..0a8540e65f2 100644 --- a/packages/dnb-ui-lib/src/elements/index.js +++ b/packages/dnb-ui-lib/src/elements/index.js @@ -28,7 +28,6 @@ import Ol from './Ol' import P from './P' import Section from './Section' import Table from './Table' -import Textarea from './Textarea' import Ul from './Ul' // define / export all the aviable components @@ -51,6 +50,5 @@ export { P, Section, Table, - Textarea, Ul } diff --git a/packages/dnb-ui-lib/src/elements/lib.js b/packages/dnb-ui-lib/src/elements/lib.js index 49ef63093d2..7375158e08e 100644 --- a/packages/dnb-ui-lib/src/elements/lib.js +++ b/packages/dnb-ui-lib/src/elements/lib.js @@ -28,7 +28,6 @@ import Ol from './Ol' import P from './P' import Section from './Section' import Table from './Table' -import Textarea from './Textarea' import Ul from './Ul' // define / export all the aviable components @@ -51,7 +50,6 @@ export { P, Section, Table, - Textarea, Ul } @@ -75,7 +73,6 @@ export const getElements = () => { P, Section, Table, - Textarea, Ul } } diff --git a/packages/dnb-ui-lib/src/index.js b/packages/dnb-ui-lib/src/index.js index 755cc68dd74..b54c09468d5 100644 --- a/packages/dnb-ui-lib/src/index.js +++ b/packages/dnb-ui-lib/src/index.js @@ -30,6 +30,7 @@ import Slider from './components/slider/Slider' import StepIndicator from './components/step-indicator/StepIndicator' import Switch from './components/switch/Switch' import Tabs from './components/tabs/Tabs' +import Textarea from './components/textarea/Textarea' import Anchor from './elements/Anchor' import Blockquote from './elements/Blockquote' import Code from './elements/Code' @@ -48,7 +49,6 @@ import Ol from './elements/Ol' import P from './elements/P' import Section from './elements/Section' import Table from './elements/Table' -import Textarea from './elements/Textarea' import Ul from './elements/Ul' // define / export all the aviable components @@ -73,6 +73,7 @@ export { StepIndicator, Switch, Tabs, + Textarea, Anchor, Blockquote, Code, @@ -91,7 +92,6 @@ export { P, Section, Table, - Textarea, Ul } diff --git a/packages/dnb-ui-lib/src/style/core/helper-classes.scss b/packages/dnb-ui-lib/src/style/core/helper-classes.scss index f937cd70980..dc1ce0bb3a5 100644 --- a/packages/dnb-ui-lib/src/style/core/helper-classes.scss +++ b/packages/dnb-ui-lib/src/style/core/helper-classes.scss @@ -111,11 +111,6 @@ margin: 0; margin-bottom: 0.5rem; } - - // To fake, that we actuallyhave 8px between - > textarea { - transform: translateY(2px); - } } // for hoizontal labeling @@ -126,16 +121,6 @@ margin: 0; margin-right: 1rem; } - - // To fake, that the first line is aligned with the label - &:not(.dnb-form-group__position--vertical) { - > textarea { - transform: translateY( - calc(1px - 1px - var(--textarea-vertical-correction)) - ); - margin-top: 0; - } - } } } .dnb-form-row { diff --git a/packages/dnb-ui-lib/src/style/dnb-ui-components.scss b/packages/dnb-ui-lib/src/style/dnb-ui-components.scss index 8e8c65e156e..d844de8a76e 100644 --- a/packages/dnb-ui-lib/src/style/dnb-ui-components.scss +++ b/packages/dnb-ui-lib/src/style/dnb-ui-components.scss @@ -24,3 +24,4 @@ @import '../components/step-indicator/style/_step-indicator.scss'; @import '../components/switch/style/_switch.scss'; @import '../components/tabs/style/_tabs.scss'; +@import '../components/textarea/style/_textarea.scss'; diff --git a/packages/dnb-ui-lib/src/style/elements/__tests__/Textarea.screenshot.test.js b/packages/dnb-ui-lib/src/style/elements/__tests__/Textarea.screenshot.test.js deleted file mode 100644 index 88abc9a8ac7..00000000000 --- a/packages/dnb-ui-lib/src/style/elements/__tests__/Textarea.screenshot.test.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Screenshot Test - * This file will not run on "test:staged" because we dont require any related files - */ - -import { - testPageScreenshot, - setupPageScreenshot -} from '../../../core/jest/jestSetupScreenshots' - -describe('Textarea screenshot', () => { - setupPageScreenshot({ url: '/uilib/elements/textarea' }) - it('have to match the "default" textarea style', async () => { - const screenshot = await testPageScreenshot({ - selector: '[data-dnb-test="textarea-default"]', - // Only for screenshot testing - make textarea having same width on linux chromium - styleSelector: '[data-dnb-test="textarea-default"] textarea', - style: { width: '14rem' } - }) - expect(screenshot).toMatchImageSnapshot() - }) - // we do not make a active state, due to the differences of font rendering -}) diff --git a/packages/dnb-ui-lib/src/style/elements/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png b/packages/dnb-ui-lib/src/style/elements/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png deleted file mode 100644 index ed715f89ff1..00000000000 Binary files a/packages/dnb-ui-lib/src/style/elements/__tests__/__snapshots__/textarea-screenshot-test-js-textarea-screenshot-have-to-match-the-default-textarea-style-1-2ef6c.snap.png and /dev/null differ diff --git a/packages/dnb-ui-lib/src/style/elements/textarea.scss b/packages/dnb-ui-lib/src/style/elements/textarea.scss deleted file mode 100644 index bb646bc474a..00000000000 --- a/packages/dnb-ui-lib/src/style/elements/textarea.scss +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Textarea - * - */ - -:root { - --textarea-vertical-correction: 0.25rem; // for chromium browsers - --textarea-padding-width: 0.5rem; - --textarea-border-inner: 0 0 0 var(--textarea-padding-width) - var(--color-white); -} - -@mixin textareaStyle() { - display: block; - - margin: var(--textarea-padding-width); - padding: var(--textarea-padding-width); - padding-top: calc( - var(--textarea-padding-width) - var(--textarea-vertical-correction) - ); - padding-bottom: var(--textarea-vertical-correction); - - border: none; - border-radius: 1px; - - line-height: 1.5rem; - - box-shadow: var(--textarea-border-inner), - 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) - var(--color-sea-green-alt); - - /* IE11 fix */ - @media screen and (-ms-high-contrast: active), - (-ms-high-contrast: none) { - -ms-overflow-style: -ms-autohiding-scrollba; - box-shadow: 0 0 0 0.0625rem var(--color-sea-green-alt); - } - - &.status--error, - .dnb-textarea__status--error { - box-shadow: var(--textarea-border-inner), - 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) - var(--color-cherry-red); - } - @include hover(true) { - &:not(.status--error) { - box-shadow: var(--textarea-border-inner), - 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) - var(--color-emerald-green); - - /* IE11 fix */ - @media screen and (-ms-high-contrast: active), - (-ms-high-contrast: none) { - box-shadow: 0 0 0 0.125rem var(--color-emerald-green); - } - } - } - &:focus { - outline: none; - box-shadow: var(--textarea-border-inner), - 0 0 0 calc(var(--textarea-padding-width) + 0.125rem) - var(--color-emerald-green); - - /* IE11 fix */ - @media screen and (-ms-high-contrast: active), - (-ms-high-contrast: none) { - box-shadow: 0 0 0 0.125rem var(--color-emerald-green); - } - } - &[disabled] { - user-select: none; - - color: var(--color-sea-green-alt-30); - background-color: var(--color-mint-green-12); - box-shadow: 0 0 0 var(--textarea-padding-width) - var(--color-mint-green-12), - 0 0 0 calc(var(--textarea-padding-width) + 0.0625rem) - var(--color-sea-green-alt-30); - - &::-webkit-scrollbar { - width: 0; - } - } -} -@mixin textareaTag() { - textarea { - @include textareaStyle(); - } -} - -.dnb-textarea { - @include textareaStyle(); -} diff --git a/packages/dnb-ui-lib/src/style/elements/ui-elements.scss b/packages/dnb-ui-lib/src/style/elements/ui-elements.scss index a8969bd0c94..8b09ef8a2a5 100644 --- a/packages/dnb-ui-lib/src/style/elements/ui-elements.scss +++ b/packages/dnb-ui-lib/src/style/elements/ui-elements.scss @@ -12,7 +12,7 @@ @import './lists.scss'; @import './table.scss'; @import './label.scss'; -@import './textarea.scss'; +// @import './textarea.scss'; // Moved over to be a part of components since v3.23.0 @import './form.scss'; @import './code.scss'; @import './image.scss'; diff --git a/packages/dnb-ui-lib/src/style/elements/ui-tags.scss b/packages/dnb-ui-lib/src/style/elements/ui-tags.scss index 5e401657fbb..8a4e7d6a115 100644 --- a/packages/dnb-ui-lib/src/style/elements/ui-tags.scss +++ b/packages/dnb-ui-lib/src/style/elements/ui-tags.scss @@ -26,7 +26,7 @@ // form @include formTag(); @include labelTag(); - @include textareaTag(); + // @include textareaTag(); // Deprecated sice v. 3.23.0 // additional @include codeTag(); diff --git a/packages/dnb-ui-lib/src/style/themes/theme-ui/dnb-theme-ui.scss b/packages/dnb-ui-lib/src/style/themes/theme-ui/dnb-theme-ui.scss index f9612176544..df0ac969df9 100644 --- a/packages/dnb-ui-lib/src/style/themes/theme-ui/dnb-theme-ui.scss +++ b/packages/dnb-ui-lib/src/style/themes/theme-ui/dnb-theme-ui.scss @@ -37,3 +37,4 @@ @import '../../../components/step-indicator/style/themes/dnb-step-indicator-theme-ui.scss'; @import '../../../components/switch/style/themes/dnb-switch-theme-ui.scss'; @import '../../../components/tabs/style/themes/dnb-tabs-theme-ui.scss'; +@import '../../../components/textarea/style/themes/dnb-textarea-theme-ui.scss'; diff --git a/packages/dnb-ui-lib/stories/components/Textarea.js b/packages/dnb-ui-lib/stories/components/Textarea.js new file mode 100644 index 00000000000..0282f197604 --- /dev/null +++ b/packages/dnb-ui-lib/stories/components/Textarea.js @@ -0,0 +1,87 @@ +/** + * dnb-ui-lib Component Story + * + */ + +import React /* , { useState, useEffect } */ from 'react' +import { Wrapper, Box } from '../helpers' +// import styled from '@emotion/styled' + +import { Textarea } from '../../src/components' + +export default [ + 'Textarea', + () => ( + + +