diff --git a/packages/dnb-design-system-portal/src/pages/uilib/components/input-masked/input-masked-properties.md b/packages/dnb-design-system-portal/src/pages/uilib/components/input-masked/input-masked-properties.md index 79a316ba1f8..1c42934a168 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/components/input-masked/input-masked-properties.md +++ b/packages/dnb-design-system-portal/src/pages/uilib/components/input-masked/input-masked-properties.md @@ -2,7 +2,7 @@ draft: true --- -For more details, se the [Input](/uilib/components/input) component. +For more details and **properties**, se the [Input](/uilib/components/input) component. | Properties | Description | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 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 7e872067d4c..9f5e7145ce4 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 @@ -116,6 +116,16 @@ class Example extends PureComponent { /> `} + + {/* @jsx */ ` + + + + `} + {/* @jsx */ ` { console.log('on_submit') }} diff --git a/packages/dnb-design-system-portal/src/pages/uilib/components/input/input-properties.md b/packages/dnb-design-system-portal/src/pages/uilib/components/input/input-properties.md index 2866940fda1..0524558bb22 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/components/input/input-properties.md +++ b/packages/dnb-design-system-portal/src/pages/uilib/components/input/input-properties.md @@ -7,6 +7,7 @@ draft: true | `value` | _(optional)_ the content value of the input. | | `align` | _(optional)_ defines the `text-align` of the input. Defaults to `left`. | | `label` | _(optional)_ prepends the Form Label component. If no ID is provided, a random ID is created. | +| `label_direction` | _(optional)_ use `label_direction="vertical"` to change the label layout direction. Defaults to `horizontal` | | `status` | _(optional)_ text with a status message. The style defaults to an error message. | | `status_state` | _(optional)_ defines the state of the status. Currently there are two statuses `[error, info]`. Defaults to `error`. | | `placeholder` | _(optional)_ the placeholder which shows up once the input value is empty | diff --git a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap index eb0491c1826..fa708318369 100644 --- a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap +++ b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap @@ -15,6 +15,7 @@ exports[`DatePicker component have to match snapshot 1`] = ` hide_navigation_buttons={false} id="date-picker-id" label={null} + label_direction={null} link={false} locale={ Object { @@ -69,598 +70,568 @@ exports[`DatePicker component have to match snapshot 1`] = ` sync={true} > - - - } - submit_button_icon="search" - submit_button_title={null} - submit_button_variant="secondary" - type="text" - value={null} > - + } + submit_button_icon="search" + submit_button_title={null} + submit_button_variant="secondary" + type="text" + value={null} > - - - - - - - / - - - - + + + + + + / + + - - - - / - - - - + + + + + + / + + - - - - – - - - - + + + + + + – + + - - - - / - - - - + + + + + + / + + - - - - / - - - - + + + + + + / + + - - - - - - - - + + + + + + + + + + + + - - - - - - + + className="dnb-date-picker__container" + > + + @@ -906,9 +916,9 @@ exports[`DatePicker scss have to match default theme snapshot 1`] = ` border: none; background-color: var(--color-white); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16); } - .dnb-date-picker:not(.dnb-date-picker--opened).dnb-date-picker__status--error .dnb-input__shell:not([data-input-state='focus']) + .dnb-date-picker__status--error .dnb-date-picker:not(.dnb-date-picker--opened) .dnb-input__shell:not([data-input-state='focus']) .dnb-date-picker__input, - .dnb-date-picker:not(.dnb-date-picker--opened).dnb-date-picker__status--error .dnb-input__shell:not([data-input-state='focus']) + .dnb-date-picker__status--error .dnb-date-picker:not(.dnb-date-picker--opened) .dnb-input__shell:not([data-input-state='focus']) .dnb-date-picker__input ~ .dnb-date-picker--separator { color: var(--color-cherry-red); } " @@ -1392,8 +1402,6 @@ a.dnb-button .dnb-button__text { .dnb-input { display: inline-flex; flex-direction: column; - align-items: flex-start; - vertical-align: middle; width: auto; font-size: var(--input-font-size); } .dnb-input__shell { @@ -1402,8 +1410,6 @@ a.dnb-button .dnb-button__text { align-items: center; overflow: hidden; border: var(--input-border-width) solid var(--color-sea-green-alt); } - label + .dnb-input[class*='__form-status'] { - vertical-align: baseline; } .dnb-input__input { border: none; outline: none; @@ -1422,7 +1428,9 @@ a.dnb-button .dnb-button__text { font-size: inherit; line-height: 1em; background-color: transparent; - transform: translateY(var(--input-border-width)); } + transform: translateY(var(--input-border-width)); + font-variant-numeric: lining-nums; + font-feature-settings: \\"lnum\\"; } .dnb-input__placeholder { pointer-events: none; position: absolute; @@ -1488,14 +1496,29 @@ a.dnb-button .dnb-button__text { .dnb-input__align--right .dnb-input__placeholder, .dnb-input__align--right .dnb-input__input { text-align: right; } - .dnb-input--stretch, - .dnb-input--stretch .dnb-input__shell { - width: 100%; } .dnb-input__shell[data-has-content='true'] .dnb-input__placeholder, .dnb-input__shell[data-has-content='true'][data-input-state='focus'] .dnb-input__placeholder { display: none; } .dnb-input > .dnb-form-status { margin-top: 0.5rem; } + .dnb-input--stretch .dnb-input { + flex: 1; } + .dnb-input--stretch .dnb-input__shell { + width: 100%; } + .dnb-input__wrapper { + display: inline-flex; + align-items: center; } + .dnb-input__wrapper.dnb-input--vertical { + align-items: flex-start; + flex-direction: column; } + .dnb-input__wrapper.dnb-input--vertical.dnb-input--stretch .dnb-input { + width: 100%; } + .dnb-input__wrapper.dnb-input--stretch { + display: flex; } + .dnb-input__wrapper[class*='__status'] { + align-items: flex-start; } + .dnb-input__wrapper[class*='__status'] > .dnb-form-label { + margin-top: 0.25rem; } .dnb-dropdown { font-family: var(--font-family-default); @@ -1742,5 +1765,19 @@ a.dnb-button .dnb-button__text { transform: scaleX(-1); } .dnb-date-picker .dnb-form-status { margin-top: 0.375rem; } + .dnb-date-picker__wrapper { + display: inline-flex; + align-items: center; } + .dnb-date-picker__wrapper.dnb-date-picker--vertical { + align-items: flex-start; + flex-direction: column; } + .dnb-date-picker__wrapper.dnb-date-picker--vertical.dnb-date-picker--stretch .dnb-input { + width: 100%; } + .dnb-date-picker__wrapper.dnb-date-picker--stretch { + display: flex; } + .dnb-date-picker__wrapper[class*='__status'] { + align-items: flex-start; } + .dnb-date-picker__wrapper[class*='__status'] > .dnb-form-label { + margin-top: 0.25rem; } " `; diff --git a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-calendar-1-9e9ea.snap.png b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-calendar-1-9e9ea.snap.png index f59d694a9b6..847f87151d6 100644 Binary files a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-calendar-1-9e9ea.snap.png and b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-calendar-1-9e9ea.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-1-6c5ae.snap.png b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-1-6c5ae.snap.png index e4d857c39bc..4fe2ee2f9b6 100644 Binary files a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-1-6c5ae.snap.png and b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-1-6c5ae.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-in-error-state-1-d76c4.snap.png b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-in-error-state-1-d76c4.snap.png index df1f5380875..6c5cb6b33bd 100644 Binary files a/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-in-error-state-1-d76c4.snap.png and b/packages/dnb-ui-lib/src/components/date-picker/__tests__/__snapshots__/date-picker-screenshot-test-js-date-picker-screenshot-have-to-match-the-date-picker-trigger-button-in-error-state-1-d76c4.snap.png differ diff --git a/packages/dnb-ui-lib/src/components/form-row/FormRow.js b/packages/dnb-ui-lib/src/components/form-row/FormRow.js index 49f1f6f78c5..620ea0daf8e 100644 --- a/packages/dnb-ui-lib/src/components/form-row/FormRow.js +++ b/packages/dnb-ui-lib/src/components/form-row/FormRow.js @@ -165,11 +165,20 @@ export default class FormRow extends PureComponent { const context = extend(this.context, { formRow: { + useId: () => { + if (this.isIsUsed) { + // make a new ID, as we used one + return `dnb-form-row-${Math.round(Math.random() * 999)}` // cause we need an id anyway + } + this.isIsUsed = true + return id + }, itsMeAgain: true, hasLabel: label, size, direction, vertical, + label_direction: vertical ? 'vertical' : direction, disabled } }) @@ -180,7 +189,7 @@ export default class FormRow extends PureComponent { {label && ( { diff --git a/packages/dnb-ui-lib/src/components/form-row/__tests__/__snapshots__/FormRow.test.js.snap b/packages/dnb-ui-lib/src/components/form-row/__tests__/__snapshots__/FormRow.test.js.snap index 209d0da3b62..4ab191d5275 100644 --- a/packages/dnb-ui-lib/src/components/form-row/__tests__/__snapshots__/FormRow.test.js.snap +++ b/packages/dnb-ui-lib/src/components/form-row/__tests__/__snapshots__/FormRow.test.js.snap @@ -6,7 +6,7 @@ exports[`FormRow component have to match snapshot 1`] = ` className="className" direction="horizontal" disabled="disabled" - id="id" + id="form-row" label="label" label_id="label_id" no_label="no_label" @@ -24,7 +24,7 @@ exports[`FormRow component have to match snapshot 1`] = ` className="dnb-form-row__label" direction={null} disabled={false} - for_id={null} + for_id="form-row" id="label_id-label" render_content={null} text="label" @@ -33,6 +33,7 @@ exports[`FormRow component have to match snapshot 1`] = ` >