@uh-design-system/component-library 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{utils-3412cbed.js → attributes-BMbXzbwU.js} +2 -28
- package/dist/cjs/component-library.cjs.js +7 -7
- package/dist/cjs/controlUtils-ofqiQxRF.js +42 -0
- package/dist/cjs/ds-accordion.cjs.entry.js +79 -0
- package/dist/cjs/ds-button.cjs.entry.js +107 -0
- package/dist/cjs/ds-card.cjs.entry.js +58 -0
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +109 -49
- package/dist/cjs/ds-checkbox.cjs.entry.js +88 -79
- package/dist/cjs/ds-icon.cjs.entry.js +943 -0
- package/dist/cjs/ds-input-validity.cjs.entry.js +14 -15
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +21 -20
- package/dist/cjs/ds-link.cjs.entry.js +34 -31
- package/dist/cjs/ds-radio-button-group.cjs.entry.js +153 -0
- package/dist/cjs/ds-radio-button.cjs.entry.js +151 -0
- package/dist/cjs/ds-spinner.cjs.entry.js +62 -0
- package/dist/cjs/ds-text-input.cjs.entry.js +90 -77
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +3 -6
- package/dist/cjs/index-Bp6Dd2i1.js +94 -0
- package/dist/cjs/{store-9bd20f3c.js → index-DwLFyR5p.js} +6 -2
- package/dist/cjs/{index-bf84b124.js → index-Mjp9Y-Sw.js} +701 -55
- package/dist/cjs/index.cjs.js +3 -5
- package/dist/cjs/{linkUtils-695da37c.js → linkUtils-onlbgKdI.js} +4 -2
- package/dist/cjs/loader.cjs.js +3 -5
- package/dist/cjs/utils-BjZTECpy.js +29 -0
- package/dist/collection/accessibility/stories/naming.stories.js +3 -3
- package/dist/collection/collection-manifest.json +78 -3
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +18 -17
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +91 -50
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +6 -6
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +14 -14
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +24 -66
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +124 -145
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +150 -65
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +121 -23
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +49 -42
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +16 -72
- package/dist/collection/components/01-base-components/ds-card/ds-card.css +127 -0
- package/dist/collection/components/01-base-components/ds-card/ds-card.js +303 -0
- package/dist/collection/components/01-base-components/ds-card/stories/ds-card.examples.stories.js +92 -0
- package/dist/collection/components/01-base-components/ds-card/stories/ds-card.features.stories.js +66 -0
- package/dist/collection/components/01-base-components/ds-card/stories/ds-card.stories.js +71 -0
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +46 -46
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +120 -111
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +20 -20
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +12 -25
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +2 -3
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +214 -63
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +215 -50
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +30 -28
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +36 -31
- package/dist/collection/components/01-base-components/ds-icon/stories/ds-icon.stories.js +10 -37
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +2 -2
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +60 -30
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +4 -4
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +4 -9
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +24 -14
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +74 -75
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +27 -27
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +38 -21
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +8 -67
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +10 -12
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +30 -52
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.examples.stories.js +4 -4
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.features.stories.js +6 -6
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -28
- package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.css +115 -0
- package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.js +449 -0
- package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.js +72 -0
- package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.js +22 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.css +30 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.js +360 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.js +42 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.js +71 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.js +60 -0
- package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.css +279 -0
- package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.js +221 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.js +120 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.js +107 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.stories.js +14 -0
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +85 -118
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +230 -155
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +26 -21
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.features.stories.js +40 -40
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +30 -56
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/store.js +7 -1
- package/dist/collection/utils/attributes/attributes.js +2 -2
- package/dist/collection/utils/button/buttonUtils.js +14 -0
- package/dist/collection/utils/colours/colourTypes.js +3 -3
- package/dist/collection/utils/colours/colourUtils.js +5 -3
- package/dist/collection/utils/controls/controlUtils.js +35 -1
- package/dist/collection/utils/link/linkUtils.js +3 -2
- package/dist/collection/utils/spinner/spinnerUtils.js +20 -0
- package/dist/collection/utils/tests/testUtils.js +1 -0
- package/dist/collection/utils/typography/typographyUtils.js +3 -3
- package/dist/collection/utils/utils.js +10 -9
- package/dist/component-library/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +1 -1
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/controlUtils-CNER0MvM.js +1 -0
- package/dist/component-library/ds-accordion.entry.js +1 -0
- package/dist/component-library/ds-button.entry.js +1 -0
- package/dist/component-library/ds-card.entry.js +1 -0
- package/dist/component-library/ds-checkbox-group.entry.js +1 -1
- package/dist/component-library/ds-checkbox.entry.js +1 -1
- package/dist/component-library/ds-icon.entry.js +1 -0
- package/dist/component-library/ds-input-validity.entry.js +1 -1
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-radio-button-group.entry.js +1 -0
- package/dist/component-library/ds-radio-button.entry.js +1 -0
- package/dist/component-library/ds-spinner.entry.js +1 -0
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/index-BfTCfPZ1.js +6 -0
- package/dist/component-library/index-Cm7V4EAn.js +2 -0
- package/dist/component-library/index-DuYjhvTn.js +1 -0
- package/dist/component-library/index.esm.js +1 -1
- package/dist/component-library/linkUtils-02nCfO0F.js +1 -0
- package/dist/component-library/utils-CqaqnfY4.js +1 -0
- package/dist/components/attributes.js +3 -3
- package/dist/components/controlUtils.js +35 -2
- package/dist/components/ds-accordion.js +58 -42
- package/dist/components/ds-button2.js +78 -39
- package/dist/components/ds-card.d.ts +11 -0
- package/dist/components/ds-card.js +91 -0
- package/dist/components/ds-checkbox-group.js +116 -56
- package/dist/components/ds-checkbox2.js +93 -80
- package/dist/components/ds-icon2.js +292 -292
- package/dist/components/ds-input-validity2.js +17 -14
- package/dist/components/ds-link-with-arrow.js +22 -22
- package/dist/components/ds-link.js +43 -40
- package/dist/components/ds-radio-button-group.d.ts +11 -0
- package/dist/components/ds-radio-button-group.js +185 -0
- package/dist/components/ds-radio-button.d.ts +11 -0
- package/dist/components/ds-radio-button.js +198 -0
- package/dist/components/ds-spinner.d.ts +11 -0
- package/dist/components/ds-spinner.js +6 -0
- package/dist/components/ds-spinner2.js +89 -0
- package/dist/components/ds-text-input.js +126 -104
- package/dist/components/ds-visually-hidden2.js +2 -3
- package/dist/components/index.js +208 -2
- package/dist/components/index2.js +713 -39
- package/dist/components/index3.js +69 -57
- package/dist/components/linkUtils.js +4 -2
- package/dist/docs.d.ts +443 -0
- package/dist/docs.json +4790 -0
- package/dist/esm/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +3 -26
- package/dist/esm/component-library.js +6 -5
- package/dist/esm/controlUtils-CNER0MvM.js +37 -0
- package/dist/esm/ds-accordion.entry.js +77 -0
- package/dist/esm/ds-button.entry.js +105 -0
- package/dist/esm/ds-card.entry.js +56 -0
- package/dist/esm/ds-checkbox-group.entry.js +108 -46
- package/dist/esm/ds-checkbox.entry.js +78 -67
- package/dist/esm/ds-icon.entry.js +941 -0
- package/dist/esm/ds-input-validity.entry.js +14 -13
- package/dist/esm/ds-link-with-arrow.entry.js +21 -18
- package/dist/esm/ds-link.entry.js +34 -29
- package/dist/esm/ds-radio-button-group.entry.js +151 -0
- package/dist/esm/ds-radio-button.entry.js +149 -0
- package/dist/esm/ds-spinner.entry.js +60 -0
- package/dist/esm/ds-text-input.entry.js +88 -73
- package/dist/esm/ds-visually-hidden.entry.js +3 -4
- package/dist/esm/index-BfTCfPZ1.js +92 -0
- package/dist/esm/{index-434995e1.js → index-Cm7V4EAn.js} +699 -34
- package/dist/{components/store.js → esm/index-DuYjhvTn.js} +6 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-02nCfO0F.js} +4 -2
- package/dist/esm/loader.js +4 -4
- package/dist/esm/utils-CqaqnfY4.js +25 -0
- package/dist/hydrate/index.d.ts +271 -0
- package/dist/hydrate/index.js +22280 -0
- package/dist/hydrate/index.mjs +22272 -0
- package/dist/hydrate/package.json +12 -0
- package/dist/styles/helpers.css +15 -0
- package/dist/styles/helpers.css.map +1 -0
- package/dist/styles/mixins/_breakpoints.scss +13 -0
- package/dist/styles/mixins/_focus.scss +26 -0
- package/dist/styles/mixins/_wrapper.scss +5 -0
- package/dist/styles/mixins/imports-default/_imports.scss +2 -0
- package/dist/styles/mixins/tokens/_breakpoints.scss +13 -0
- package/dist/styles/mixins/tokens/_semantic-colours.scss +75 -0
- package/dist/styles/mixins.scss +12 -0
- package/dist/styles/variables.css +176 -0
- package/dist/styles/variables.css.map +1 -0
- package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +11 -8
- package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +16 -11
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-card/ds-card.d.ts +20 -0
- package/dist/types/components/01-base-components/ds-card/stories/ds-card.examples.stories.d.ts +8 -0
- package/dist/types/components/01-base-components/ds-card/stories/ds-card.features.stories.d.ts +8 -0
- package/dist/types/components/01-base-components/ds-card/stories/ds-card.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +21 -22
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +21 -11
- package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +7 -5
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +5 -6
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +13 -14
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +5 -7
- package/dist/types/components/01-base-components/ds-radio-button/ds-radio-button.d.ts +44 -0
- package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.d.ts +15 -0
- package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/ds-radio-button-group.d.ts +34 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.d.ts +6 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/ds-spinner.d.ts +17 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +37 -32
- package/dist/types/components.d.ts +1287 -228
- package/dist/types/stencil-public-runtime.d.ts +22 -0
- package/dist/types/store.d.ts +6 -1
- package/dist/types/utils/attributes/attributes.d.ts +1 -1
- package/dist/types/utils/button/buttonUtils.d.ts +1 -0
- package/dist/types/utils/colours/colourTypes.d.ts +3 -3
- package/dist/types/utils/controls/controlUtils.d.ts +2 -0
- package/dist/types/utils/link/linkUtils.d.ts +1 -1
- package/dist/types/utils/spinner/spinnerUtils.d.ts +1 -0
- package/dist/types/utils/tests/testUtils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +2 -1
- package/package.json +40 -36
- package/dist/cjs/controlUtils-041de0fd.js +0 -7
- package/dist/cjs/ds-accordion_3.cjs.entry.js +0 -1095
- package/dist/cjs/index-5b0b9d4c.js +0 -82
- package/dist/component-library/controlUtils-9ca4087b.js +0 -1
- package/dist/component-library/ds-accordion_3.entry.js +0 -1
- package/dist/component-library/index-434995e1.js +0 -2
- package/dist/component-library/index-72ac5051.js +0 -6
- package/dist/component-library/linkUtils-3d1b28cf.js +0 -1
- package/dist/component-library/store-b8d17c10.js +0 -1
- package/dist/esm/controlUtils-9ca4087b.js +0 -4
- package/dist/esm/ds-accordion_3.entry.js +0 -1089
- package/dist/esm/index-72ac5051.js +0 -80
- package/dist/esm/store-b8d17c10.js +0 -204
- package/dist/loader/package.json +0 -11
- /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
- /package/dist/component-library/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
- /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H,
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './index2.js';
|
|
2
2
|
import { c as classNames } from './index3.js';
|
|
3
3
|
import { g as getRequiredText, a as getOptionalText } from './controlUtils.js';
|
|
4
|
-
import { i as isValidation } from './
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { i as isValidation } from './index.js';
|
|
5
|
+
import { i as idGenerator, d as defineCustomElement$5 } from './ds-icon2.js';
|
|
6
|
+
import { i as inheritAttributes } from './attributes.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './ds-button2.js';
|
|
8
|
+
import { d as defineCustomElement$4 } from './ds-input-validity2.js';
|
|
9
|
+
import { d as defineCustomElement$3 } from './ds-spinner2.js';
|
|
9
10
|
import { d as defineCustomElement$2 } from './ds-visually-hidden2.js';
|
|
10
11
|
|
|
11
|
-
const dsTextInputCss = ".sc-ds-text-input:root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.
|
|
12
|
-
const DsTextInputStyle0 = dsTextInputCss;
|
|
12
|
+
const dsTextInputCss = ".sc-ds-text-input:root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.sc-ds-text-input-h *.sc-ds-text-input,.ds-no-style-leak.sc-ds-text-input *.sc-ds-text-input{all:unset;box-sizing:border-box;display:block}.sc-ds-text-input-h{display:block;width:288px}@media (min-width: 75rem){.sc-ds-text-input-h{width:320px}}.ds-input__label-container.sc-ds-text-input{margin-block-end:var(--ds-spacing-2xSmall)}.ds-input__label-container.sc-ds-text-input label.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);color:var(--ds-palette-black-95)}.ds-input__label-container.sc-ds-text-input small.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-14);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);display:block;margin-block-start:var(--ds-spacing-3xSmall);color:var(--ds-palette-black-70)}.ds-input__container.sc-ds-text-input{box-sizing:border-box;width:100%;display:inline-flex;position:relative;align-items:center;border-width:var(--ds-borderWidth-thin);border-style:solid;border-color:var(--ds-palette-black-50);padding-inline:var(--ds-spacing-xSmall)}.ds-input__container.sc-ds-text-input:focus-visible{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-palette-white);outline:var(--ds-borderWidth-thin) solid var(--ds-palette-black-95);outline-offset:calc(var(--ds-borderWidth-thin) * 1)}.ds-input__container.sc-ds-text-input:focus-within{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-palette-white);outline:var(--ds-borderWidth-thin) solid var(--ds-palette-black-95);outline-offset:calc(var(--ds-borderWidth-thin) * 1)}.ds-input__container.invalid.sc-ds-text-input{background-color:var(--ds-palette-red-05);border-color:var(--ds-palette-red-50)}.ds-input__container.invalid.sc-ds-text-input:hover:not(.ds-input__container.invalid:focus-within){background-color:var(--ds-palette-red-10);border-color:var(--ds-palette-red-50)}.ds-input__container.invalid.active.sc-ds-text-input{background-color:var(--ds-palette-red-20);border-color:var(--ds-palette-red-50)}.ds-input__container.valid.sc-ds-text-input{background-color:var(--ds-palette-green-05);border-color:var(--ds-palette-green-50)}.ds-input__container.valid.sc-ds-text-input:hover:not(.ds-input__container.valid:focus-within){background-color:var(--ds-palette-green-10);border-color:var(--ds-palette-green-50)}.ds-input__container.valid.active.sc-ds-text-input{background-color:var(--ds-palette-green-20);border-color:var(--ds-palette-green-50)}.ds-input__container.readonly.sc-ds-text-input,.ds-input__container.disabled.sc-ds-text-input{background-color:var(--ds-overlay-black-10);border-color:var(--ds-overlay-black-15)}.ds-input__container.sc-ds-text-input:has(span.prefix,ds-icon.prefix).sc-ds-text-input{padding-inline-start:var(--ds-spacing-2xSmall)}.ds-input__container.sc-ds-text-input:has(ds-button.suffix){padding-inline-end:unset}.ds-input__container.sc-ds-text-input:has(input:active){outline:none}.ds-input__container.sc-ds-text-input:has(input:active):not:has(input:disabled,input.sc-ds-text-input:read-only){border-color:var(--ds-palette-black-50)}.ds-input__container.active.sc-ds-text-input:not(.ds-input__container.disabled,.ds-input__container.readonly.sc-ds-text-input,.ds-input__container.invalid.sc-ds-text-input,.ds-input__container.valid).sc-ds-text-input{border-color:var(--ds-palette-black-50);background-color:var(--ds-palette-black-20)}.ds-input__container.sc-ds-text-input:hover:not(.ds-input__container.disabled,.ds-input__container.readonly.sc-ds-text-input,.ds-input__container.active.sc-ds-text-input,.ds-input__container.invalid.sc-ds-text-input,.ds-input__container.valid.sc-ds-text-input,.ds-input__container.sc-ds-text-input:focus-within){border-color:var(--ds-palette-black-50);background-color:var(--ds-palette-black-10)}.ds-input__container.sc-ds-text-input:focus-within:not(.ds-input__container:focus-within.invalid,.ds-input__container.sc-ds-text-input:focus-within.valid,.ds-input__container.sc-ds-text-input:focus-within.readonly){border-color:var(--ds-palette-mainBlue-70)}.ds-input__container.sc-ds-text-input:focus-within *.sc-ds-text-input>ds-button.suffix.sc-ds-text-input>button.sc-ds-text-input:focus-visible{background-clip:padding-box;outline-offset:-5px;box-shadow:none;height:var(--ds-spacing-xLarge);background-color:var(--ds-overlay-black-10)}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);width:100%;box-sizing:border-box;background-color:unset;flex-grow:1;height:var(--ds-spacing-xLarge);line-height:var(--ds-fontSize-24);color:var(--ds-palette-black-95);border:none;padding-block:var(--ds-spacing-4xSmall)}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::placeholder{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);color:var(--ds-palette-black-70)}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input:disabled{color:var(--ds-palette-black-40)}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input:disabled::placeholder{color:var(--ds-palette-black-40)}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input:focus{outline:none;border:none}.ds-input__container.sc-ds-text-input>input[type=number].sc-ds-text-input{appearance:textfield}.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-decoration,.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-cancel-button,.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-results-button,.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-search-results-decoration,.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-inner-spin-button,.ds-input__container.sc-ds-text-input>input.sc-ds-text-input::-webkit-outer-spin-button{appearance:none;margin:0}.ds-input__container.sc-ds-text-input:has(span.prefix,ds-icon.prefix).sc-ds-text-input>input.sc-ds-text-input{padding-inline-start:var(--ds-spacing-2xSmall)}.ds-input__container.sc-ds-text-input span.prefix.sc-ds-text-input,.ds-input__container.sc-ds-text-input span.suffix.sc-ds-text-input{color:var(--ds-palette-black-70)}.ds-input__container.sc-ds-text-input ds-icon.prefix.sc-ds-text-input,.ds-input__container.sc-ds-text-input-s>[slot=prefix],.ds-input__container .sc-ds-text-input-s>[slot=prefix]{height:1.5rem;color:var(--ds-palette-black-95)}.ds-input__container.sc-ds-text-input ds-button.suffix.sc-ds-text-input{margin-top:calc(var(--ds-spacing-3xSmall) * -1);margin-right:calc(var(--ds-spacing-4xSmall) * -1);max-height:40px}";
|
|
13
13
|
|
|
14
14
|
const INPUT_TYPE_ICONS_MAP = {
|
|
15
15
|
search: 'search',
|
|
@@ -23,7 +23,9 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
25
25
|
this.__registerHost();
|
|
26
|
-
this.
|
|
26
|
+
this.dsChange = createEvent(this, "dsChange");
|
|
27
|
+
this.dsInput = createEvent(this, "dsInput");
|
|
28
|
+
this.dsClear = createEvent(this, "dsClear");
|
|
27
29
|
this.internals = this.attachInternals();
|
|
28
30
|
}
|
|
29
31
|
inheritedAttributes = {};
|
|
@@ -37,79 +39,86 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
37
39
|
hasSuffixSlot = false;
|
|
38
40
|
get el() { return this; }
|
|
39
41
|
internals;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
dsChange;
|
|
43
|
+
dsInput;
|
|
44
|
+
dsClear;
|
|
45
|
+
dsLabel;
|
|
46
|
+
dsPlaceholder;
|
|
47
|
+
dsId = inputIdGenerator.next().value;
|
|
48
|
+
dsName;
|
|
49
|
+
dsDisabled;
|
|
50
|
+
dsOptional;
|
|
51
|
+
dsRequired;
|
|
52
|
+
dsReadonly;
|
|
53
|
+
dsValue;
|
|
54
|
+
dsMin;
|
|
55
|
+
dsMax;
|
|
56
|
+
dsMaxLength;
|
|
57
|
+
dsPattern;
|
|
58
|
+
dsAutocomplete;
|
|
59
|
+
dsOptionalText;
|
|
60
|
+
dsErrorText;
|
|
61
|
+
dsSuccessText;
|
|
62
|
+
dsAssistiveText;
|
|
63
|
+
dsActionButtonAriaLabel;
|
|
64
|
+
dsHiddenAssistiveText;
|
|
65
|
+
dsPrefixText;
|
|
66
|
+
dsSuffixText;
|
|
67
|
+
dsIcon = '';
|
|
68
|
+
dsType = 'text';
|
|
69
|
+
dsAriaLabel;
|
|
70
|
+
dsAriaLabelledby;
|
|
71
|
+
dsAriaDescribedby;
|
|
68
72
|
hasFocus = false;
|
|
69
73
|
clearButtonVisible = false;
|
|
70
74
|
passwordInputVisible = false;
|
|
71
75
|
inputActive = false;
|
|
72
76
|
validationMessage;
|
|
73
77
|
setIds = () => {
|
|
74
|
-
this.assistiveTextId = `${this.
|
|
75
|
-
this.visuallyHiddenAssistiveTextId = `${this.
|
|
76
|
-
this.errorTextId = `${this.
|
|
77
|
-
this.successTextId = `${this.
|
|
78
|
+
this.assistiveTextId = `${this.dsId}-assistive-text`;
|
|
79
|
+
this.visuallyHiddenAssistiveTextId = `${this.dsId}-visually-hidden-assistive-text`;
|
|
80
|
+
this.errorTextId = `${this.dsId}-error-text`;
|
|
81
|
+
this.successTextId = `${this.dsId}-success-text`;
|
|
78
82
|
};
|
|
79
|
-
getValidationMessage = () => this.
|
|
83
|
+
getValidationMessage = () => this.dsErrorText || this.internals?.validationMessage || this.inputElement?.validationMessage;
|
|
80
84
|
async togglePasswordVisibility() {
|
|
81
85
|
return (this.passwordInputVisible = !this.passwordInputVisible);
|
|
82
86
|
}
|
|
83
|
-
async clearInput() {
|
|
84
|
-
this.
|
|
87
|
+
async clearInput(e) {
|
|
88
|
+
this.dsValue = '';
|
|
85
89
|
this.inputElement.focus();
|
|
86
90
|
this.clearButtonVisible = false;
|
|
87
|
-
this.
|
|
91
|
+
this.dsClear.emit({ event: e, value: this.dsValue });
|
|
92
|
+
}
|
|
93
|
+
valueObserver(value) {
|
|
94
|
+
this.dsChange.emit({ value });
|
|
88
95
|
}
|
|
89
96
|
getLabelText = () => {
|
|
90
|
-
if (this.
|
|
91
|
-
return getRequiredText(this.
|
|
97
|
+
if (this.dsRequired) {
|
|
98
|
+
return getRequiredText(this.dsLabel);
|
|
92
99
|
}
|
|
93
|
-
if (this.
|
|
94
|
-
return getOptionalText(this.
|
|
100
|
+
if (this.dsOptional) {
|
|
101
|
+
return getOptionalText(this.dsLabel, this.dsOptionalText);
|
|
95
102
|
}
|
|
96
|
-
return this.
|
|
103
|
+
return this.dsLabel;
|
|
97
104
|
};
|
|
98
105
|
componentWillLoad() {
|
|
99
106
|
this.inheritedAttributes = {
|
|
100
|
-
...inheritAttributes(this, this.el),
|
|
107
|
+
...inheritAttributes(this, this.el, ['id']),
|
|
101
108
|
};
|
|
102
109
|
this.setIds();
|
|
103
110
|
this.hasPrefixSlot = !!this.el.querySelector('[slot="prefix"]');
|
|
104
111
|
this.hasSuffixSlot = !!this.el.querySelector('[slot="suffix"]');
|
|
105
|
-
if (isValidation('server') || this.
|
|
112
|
+
if (isValidation('server') || this.dsErrorText) {
|
|
106
113
|
this.validationMessage = this.getValidationMessage();
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
handleInput = (e) => {
|
|
110
117
|
const target = e.target;
|
|
118
|
+
this.dsValue = target.value;
|
|
111
119
|
this.clearButtonVisible = !!target.value;
|
|
112
120
|
this.internals?.setFormValue(target.value);
|
|
121
|
+
this.dsInput.emit({ event: e, value: this.dsValue });
|
|
113
122
|
if (isValidation('client') && this.validationMessage) {
|
|
114
123
|
this.validationMessage = this.getValidationMessage();
|
|
115
124
|
}
|
|
@@ -122,11 +131,12 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
122
131
|
};
|
|
123
132
|
onActionButtonClicked = (e) => {
|
|
124
133
|
e.stopPropagation();
|
|
125
|
-
switch (this.
|
|
134
|
+
switch (this.dsType) {
|
|
126
135
|
case 'password':
|
|
127
136
|
return this.togglePasswordVisibility();
|
|
128
137
|
case 'search':
|
|
129
|
-
this.clearInput();
|
|
138
|
+
this.clearInput(e);
|
|
139
|
+
return;
|
|
130
140
|
default:
|
|
131
141
|
return;
|
|
132
142
|
}
|
|
@@ -135,12 +145,12 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
135
145
|
if (this.hasPrefixSlot) {
|
|
136
146
|
return h("slot", { name: "prefix" });
|
|
137
147
|
}
|
|
138
|
-
if (this.
|
|
139
|
-
return (h("slot", { name: "prefix" }, h("span", { class: "prefix" }, this.
|
|
148
|
+
if (this.dsPrefixText) {
|
|
149
|
+
return (h("slot", { name: "prefix" }, h("span", { class: "prefix" }, this.dsPrefixText)));
|
|
140
150
|
}
|
|
141
|
-
const prefixIcon = this.
|
|
151
|
+
const prefixIcon = this.dsIcon || INPUT_TYPE_ICONS_MAP[this.dsType];
|
|
142
152
|
if (prefixIcon) {
|
|
143
|
-
return (h("slot", { name: "prefix" }, h("ds-icon", { class: "prefix",
|
|
153
|
+
return (h("slot", { name: "prefix" }, h("ds-icon", { class: "prefix", dsName: prefixIcon })));
|
|
144
154
|
}
|
|
145
155
|
return null;
|
|
146
156
|
}
|
|
@@ -148,13 +158,13 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
148
158
|
if (this.hasSuffixSlot) {
|
|
149
159
|
return h("slot", { name: "suffix" });
|
|
150
160
|
}
|
|
151
|
-
if (this.
|
|
152
|
-
return (h("slot", { name: "suffix" }, h("span", { class: "suffix" }, this.
|
|
161
|
+
if (this.dsSuffixText) {
|
|
162
|
+
return (h("slot", { name: "suffix" }, h("span", { class: "suffix" }, this.dsSuffixText)));
|
|
153
163
|
}
|
|
154
|
-
const actionButtonIcon = INPUT_TYPE_ACTION_BUTTON_ICON_MAP[this.
|
|
155
|
-
const ariaPressed = this.
|
|
164
|
+
const actionButtonIcon = INPUT_TYPE_ACTION_BUTTON_ICON_MAP[this.dsType]?.(this) ?? '';
|
|
165
|
+
const ariaPressed = this.dsType === 'password' ? this.passwordInputVisible : undefined;
|
|
156
166
|
if (actionButtonIcon) {
|
|
157
|
-
return (h("slot", { name: "suffix" }, h("ds-button", { ref: e => (this.suffixButtonElement = e),
|
|
167
|
+
return (h("slot", { name: "suffix" }, h("ds-button", { ref: e => (this.suffixButtonElement = e), dsVariant: "supplementary", dsColour: "black", class: "suffix", dsDisabled: false, dsIcon: actionButtonIcon, onClick: this.onActionButtonClicked, "aria-pressed": ariaPressed, "aria-label": this.dsActionButtonAriaLabel })));
|
|
158
168
|
}
|
|
159
169
|
return null;
|
|
160
170
|
}
|
|
@@ -164,50 +174,55 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
164
174
|
this.inputElement.focus();
|
|
165
175
|
}
|
|
166
176
|
render() {
|
|
167
|
-
const inputType = this.
|
|
168
|
-
return (h(Fragment, { key: '
|
|
169
|
-
disabled: this.
|
|
170
|
-
readonly: this.
|
|
171
|
-
valid: !!this.
|
|
177
|
+
const inputType = this.dsType === 'password' && this.passwordInputVisible ? 'text' : this.dsType;
|
|
178
|
+
return (h(Fragment, { key: '015e667345613d819eb885bdfde2011eefc60577' }, h("div", { key: 'abc03d3418fb9c648bc4d8039a4602366b6125c8', class: "ds-input__label-container" }, h("slot", { key: '9b660821e35939092570b4f6f449caca22771dcb', name: "label" }, h("label", { key: '96efa9db67a1f51f3380f7a3c350a8da45df9e1e', htmlFor: this.dsId }, this.getLabelText())), h("slot", { key: 'a5cb893f2c69efb68b7557fe5d253b58e7930f4c', name: "assistiveText" }, h("small", { key: '341f60604eb3b795bcaf5d81306dc349d0093647', id: this.assistiveTextId }, this.dsAssistiveText), h("ds-visually-hidden", { key: '613244a6dd9bb180a82c4250514ab74392cbaee8', id: this.visuallyHiddenAssistiveTextId }, this.dsHiddenAssistiveText))), h("div", { key: 'e0fb89582c7651eb00ec0dce5f5c4d0648840237', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input__container', {
|
|
179
|
+
disabled: this.dsDisabled,
|
|
180
|
+
readonly: this.dsReadonly,
|
|
181
|
+
valid: !!this.dsSuccessText,
|
|
172
182
|
invalid: !!this.validationMessage,
|
|
173
183
|
focus: this.hasFocus,
|
|
174
184
|
active: !!this.inputActive,
|
|
175
|
-
}) }, this.renderPrefixContent(), h("input", { key: '
|
|
176
|
-
classNames(
|
|
177
|
-
[this.
|
|
178
|
-
[this.
|
|
179
|
-
|
|
185
|
+
}) }, this.renderPrefixContent(), h("input", { key: '5ad15cf4d756aae913e08bfd71338ea3d80c11b9', ref: e => (this.inputElement = e), id: this.dsId, name: this.dsName, "aria-label": this.dsAriaLabel, "aria-labelledby": this.dsAriaLabelledby, "aria-describedby": this.dsAriaDescribedby ||
|
|
186
|
+
classNames({
|
|
187
|
+
[this.assistiveTextId]: !!this.dsAssistiveText,
|
|
188
|
+
[this.visuallyHiddenAssistiveTextId]: !!this.dsHiddenAssistiveText,
|
|
189
|
+
[this.errorTextId]: !!this.validationMessage,
|
|
190
|
+
[this.successTextId]: !!this.dsSuccessText,
|
|
191
|
+
}), "aria-invalid": this.validationMessage ? 'true' : 'false', disabled: this.dsDisabled, required: this.dsRequired, readonly: this.dsReadonly, value: this.dsValue, type: inputType, min: this.dsMin, max: this.dsMax, maxlength: this.dsMaxLength, pattern: this.dsPattern, placeholder: this.dsPlaceholder, autocomplete: this.dsAutocomplete, onInput: this.handleInput, onFocus: () => (this.hasFocus = true), onBlur: this.handleBlur, ...this.inheritedAttributes }), this.renderSuffixContent()), h("slot", { key: '4e378385106dd578542a99303cd4217e7bf21694', name: "validity" }, h("ds-input-validity", { key: '367fab0f5d7446f99a028e881fa5c8ab8d9829e5', id: this.errorTextId, dsText: this.validationMessage, dsType: "error", dsValidityRole: "alert" }), h("ds-input-validity", { key: '8c35c70e4beb5ade4a5f8f6fb2a35d94be57cd98', id: this.successTextId, dsText: this.dsSuccessText, dsType: "success", dsValidityRole: "status" }))));
|
|
180
192
|
}
|
|
181
193
|
static get formAssociated() { return true; }
|
|
182
|
-
static get
|
|
194
|
+
static get watchers() { return {
|
|
195
|
+
"value": ["valueObserver"]
|
|
196
|
+
}; }
|
|
197
|
+
static get style() { return dsTextInputCss; }
|
|
183
198
|
}, [70, "ds-text-input", {
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
199
|
+
"dsLabel": [1, "ds-label"],
|
|
200
|
+
"dsPlaceholder": [1, "ds-placeholder"],
|
|
201
|
+
"dsId": [1, "ds-id"],
|
|
202
|
+
"dsName": [1, "ds-name"],
|
|
203
|
+
"dsDisabled": [4, "ds-disabled"],
|
|
204
|
+
"dsOptional": [4, "ds-optional"],
|
|
205
|
+
"dsRequired": [4, "ds-required"],
|
|
206
|
+
"dsReadonly": [4, "ds-readonly"],
|
|
207
|
+
"dsValue": [1, "ds-value"],
|
|
208
|
+
"dsMin": [2, "ds-min"],
|
|
209
|
+
"dsMax": [2, "ds-max"],
|
|
210
|
+
"dsMaxLength": [2, "ds-max-length"],
|
|
211
|
+
"dsPattern": [1, "ds-pattern"],
|
|
212
|
+
"dsAutocomplete": [1, "ds-autocomplete"],
|
|
213
|
+
"dsOptionalText": [1, "ds-optional-text"],
|
|
214
|
+
"dsErrorText": [1, "ds-error-text"],
|
|
215
|
+
"dsSuccessText": [1, "ds-success-text"],
|
|
216
|
+
"dsAssistiveText": [1, "ds-assistive-text"],
|
|
217
|
+
"dsActionButtonAriaLabel": [1, "ds-action-button-aria-label"],
|
|
218
|
+
"dsHiddenAssistiveText": [1, "ds-hidden-assistive-text"],
|
|
219
|
+
"dsPrefixText": [1, "ds-prefix-text"],
|
|
220
|
+
"dsSuffixText": [1, "ds-suffix-text"],
|
|
221
|
+
"dsIcon": [1, "ds-icon"],
|
|
222
|
+
"dsType": [1, "ds-type"],
|
|
223
|
+
"dsAriaLabel": [1, "ds-aria-label"],
|
|
224
|
+
"dsAriaLabelledby": [1, "ds-aria-labelledby"],
|
|
225
|
+
"dsAriaDescribedby": [1, "ds-aria-describedby"],
|
|
211
226
|
"hasFocus": [32],
|
|
212
227
|
"clearButtonVisible": [32],
|
|
213
228
|
"passwordInputVisible": [32],
|
|
@@ -215,12 +230,14 @@ const DsTextInput$1 = proxyCustomElement(class DsTextInput extends H {
|
|
|
215
230
|
"validationMessage": [32],
|
|
216
231
|
"togglePasswordVisibility": [64],
|
|
217
232
|
"clearInput": [64]
|
|
233
|
+
}, undefined, {
|
|
234
|
+
"value": ["valueObserver"]
|
|
218
235
|
}]);
|
|
219
236
|
function defineCustomElement$1() {
|
|
220
237
|
if (typeof customElements === "undefined") {
|
|
221
238
|
return;
|
|
222
239
|
}
|
|
223
|
-
const components = ["ds-text-input", "ds-button", "ds-icon", "ds-input-validity", "ds-visually-hidden"];
|
|
240
|
+
const components = ["ds-text-input", "ds-button", "ds-icon", "ds-input-validity", "ds-spinner", "ds-visually-hidden"];
|
|
224
241
|
components.forEach(tagName => { switch (tagName) {
|
|
225
242
|
case "ds-text-input":
|
|
226
243
|
if (!customElements.get(tagName)) {
|
|
@@ -229,15 +246,20 @@ function defineCustomElement$1() {
|
|
|
229
246
|
break;
|
|
230
247
|
case "ds-button":
|
|
231
248
|
if (!customElements.get(tagName)) {
|
|
232
|
-
defineCustomElement$
|
|
249
|
+
defineCustomElement$6();
|
|
233
250
|
}
|
|
234
251
|
break;
|
|
235
252
|
case "ds-icon":
|
|
236
253
|
if (!customElements.get(tagName)) {
|
|
237
|
-
defineCustomElement$
|
|
254
|
+
defineCustomElement$5();
|
|
238
255
|
}
|
|
239
256
|
break;
|
|
240
257
|
case "ds-input-validity":
|
|
258
|
+
if (!customElements.get(tagName)) {
|
|
259
|
+
defineCustomElement$4();
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
case "ds-spinner":
|
|
241
263
|
if (!customElements.get(tagName)) {
|
|
242
264
|
defineCustomElement$3();
|
|
243
265
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './index2.js';
|
|
2
2
|
|
|
3
3
|
const dsVisuallyHiddenCss = ".ds-visually-hidden{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}";
|
|
4
|
-
const DsVisuallyHiddenStyle0 = dsVisuallyHiddenCss;
|
|
5
4
|
|
|
6
5
|
const DsVisuallyHidden = proxyCustomElement(class DsVisuallyHidden extends H {
|
|
7
6
|
constructor() {
|
|
@@ -10,9 +9,9 @@ const DsVisuallyHidden = proxyCustomElement(class DsVisuallyHidden extends H {
|
|
|
10
9
|
this.__attachShadow();
|
|
11
10
|
}
|
|
12
11
|
render() {
|
|
13
|
-
return (h("div", { key: '
|
|
12
|
+
return (h("div", { key: 'faa791957259a5ef05d2417a7b316e4cdabd8291', class: "ds-visually-hidden" }, h("slot", { key: 'd7c192f15bf2d74700205ad29f3bb78d0f9cce80' })));
|
|
14
13
|
}
|
|
15
|
-
static get style() { return
|
|
14
|
+
static get style() { return dsVisuallyHiddenCss; }
|
|
16
15
|
}, [1, "ds-visually-hidden"]);
|
|
17
16
|
function defineCustomElement() {
|
|
18
17
|
if (typeof customElements === "undefined") {
|
package/dist/components/index.js
CHANGED
|
@@ -1,2 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
import { g as getRenderingRef, f as forceUpdate } from './index2.js';
|
|
2
|
+
export { b as getAssetPath, r as render, s as setAssetPath, d as setNonce, e as setPlatformOptions } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const appendToMap = (map, propName, value) => {
|
|
5
|
+
const items = map.get(propName);
|
|
6
|
+
if (!items) {
|
|
7
|
+
map.set(propName, [value]);
|
|
8
|
+
}
|
|
9
|
+
else if (!items.includes(value)) {
|
|
10
|
+
items.push(value);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const debounce = (fn, ms) => {
|
|
14
|
+
let timeoutId;
|
|
15
|
+
return (...args) => {
|
|
16
|
+
if (timeoutId) {
|
|
17
|
+
clearTimeout(timeoutId);
|
|
18
|
+
}
|
|
19
|
+
timeoutId = setTimeout(() => {
|
|
20
|
+
timeoutId = 0;
|
|
21
|
+
fn(...args);
|
|
22
|
+
}, ms);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check if a possible element isConnected.
|
|
28
|
+
* The property might not be there, so we check for it.
|
|
29
|
+
*
|
|
30
|
+
* We want it to return true if isConnected is not a property,
|
|
31
|
+
* otherwise we would remove these elements and would not update.
|
|
32
|
+
*
|
|
33
|
+
* Better leak in Edge than to be useless.
|
|
34
|
+
*/
|
|
35
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
36
|
+
const cleanupElements = debounce((map) => {
|
|
37
|
+
for (let key of map.keys()) {
|
|
38
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
39
|
+
}
|
|
40
|
+
}, 2_000);
|
|
41
|
+
const stencilSubscription = () => {
|
|
42
|
+
if (typeof getRenderingRef !== 'function') {
|
|
43
|
+
// If we are not in a stencil project, we do nothing.
|
|
44
|
+
// This function is not really exported by @stencil/core.
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
const elmsToUpdate = new Map();
|
|
48
|
+
return {
|
|
49
|
+
dispose: () => elmsToUpdate.clear(),
|
|
50
|
+
get: (propName) => {
|
|
51
|
+
const elm = getRenderingRef();
|
|
52
|
+
if (elm) {
|
|
53
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
set: (propName) => {
|
|
57
|
+
const elements = elmsToUpdate.get(propName);
|
|
58
|
+
if (elements) {
|
|
59
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
60
|
+
}
|
|
61
|
+
cleanupElements(elmsToUpdate);
|
|
62
|
+
},
|
|
63
|
+
reset: () => {
|
|
64
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
65
|
+
cleanupElements(elmsToUpdate);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
71
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
72
|
+
const unwrappedState = unwrap(defaultState);
|
|
73
|
+
let states = new Map(Object.entries(unwrappedState ?? {}));
|
|
74
|
+
const handlers = {
|
|
75
|
+
dispose: [],
|
|
76
|
+
get: [],
|
|
77
|
+
set: [],
|
|
78
|
+
reset: [],
|
|
79
|
+
};
|
|
80
|
+
const reset = () => {
|
|
81
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
82
|
+
// otherwise, the state won't be properly reset
|
|
83
|
+
states = new Map(Object.entries(unwrap(defaultState) ?? {}));
|
|
84
|
+
handlers.reset.forEach((cb) => cb());
|
|
85
|
+
};
|
|
86
|
+
const dispose = () => {
|
|
87
|
+
// Call first dispose as resetting the state would
|
|
88
|
+
// cause less updates ;)
|
|
89
|
+
handlers.dispose.forEach((cb) => cb());
|
|
90
|
+
reset();
|
|
91
|
+
};
|
|
92
|
+
const get = (propName) => {
|
|
93
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
94
|
+
return states.get(propName);
|
|
95
|
+
};
|
|
96
|
+
const set = (propName, value) => {
|
|
97
|
+
const oldValue = states.get(propName);
|
|
98
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
99
|
+
states.set(propName, value);
|
|
100
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const state = (typeof Proxy === 'undefined'
|
|
104
|
+
? {}
|
|
105
|
+
: new Proxy(unwrappedState, {
|
|
106
|
+
get(_, propName) {
|
|
107
|
+
return get(propName);
|
|
108
|
+
},
|
|
109
|
+
ownKeys(_) {
|
|
110
|
+
return Array.from(states.keys());
|
|
111
|
+
},
|
|
112
|
+
getOwnPropertyDescriptor() {
|
|
113
|
+
return {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
has(_, propName) {
|
|
119
|
+
return states.has(propName);
|
|
120
|
+
},
|
|
121
|
+
set(_, propName, value) {
|
|
122
|
+
set(propName, value);
|
|
123
|
+
return true;
|
|
124
|
+
},
|
|
125
|
+
}));
|
|
126
|
+
const on = (eventName, callback) => {
|
|
127
|
+
handlers[eventName].push(callback);
|
|
128
|
+
return () => {
|
|
129
|
+
removeFromArray(handlers[eventName], callback);
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
const onChange = (propName, cb) => {
|
|
133
|
+
const unSet = on('set', (key, newValue) => {
|
|
134
|
+
if (key === propName) {
|
|
135
|
+
cb(newValue);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
139
|
+
// Otherwise we might not be sending the right reset value.
|
|
140
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
141
|
+
return () => {
|
|
142
|
+
unSet();
|
|
143
|
+
unReset();
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const use = (...subscriptions) => {
|
|
147
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
148
|
+
if (subscription.set) {
|
|
149
|
+
unsubs.push(on('set', subscription.set));
|
|
150
|
+
}
|
|
151
|
+
if (subscription.get) {
|
|
152
|
+
unsubs.push(on('get', subscription.get));
|
|
153
|
+
}
|
|
154
|
+
if (subscription.reset) {
|
|
155
|
+
unsubs.push(on('reset', subscription.reset));
|
|
156
|
+
}
|
|
157
|
+
if (subscription.dispose) {
|
|
158
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
159
|
+
}
|
|
160
|
+
return unsubs;
|
|
161
|
+
}, []);
|
|
162
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
163
|
+
};
|
|
164
|
+
const forceUpdate = (key) => {
|
|
165
|
+
const oldValue = states.get(key);
|
|
166
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
state,
|
|
170
|
+
get,
|
|
171
|
+
set,
|
|
172
|
+
on,
|
|
173
|
+
onChange,
|
|
174
|
+
use,
|
|
175
|
+
dispose,
|
|
176
|
+
reset,
|
|
177
|
+
forceUpdate,
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
const removeFromArray = (array, item) => {
|
|
181
|
+
const index = array.indexOf(item);
|
|
182
|
+
if (index >= 0) {
|
|
183
|
+
array[index] = array[array.length - 1];
|
|
184
|
+
array.length--;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
189
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
190
|
+
map.use(stencilSubscription());
|
|
191
|
+
return map;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const initialState = {
|
|
195
|
+
validation: 'client',
|
|
196
|
+
language: 'en',
|
|
197
|
+
};
|
|
198
|
+
const { state, set } = createStore({
|
|
199
|
+
...initialState,
|
|
200
|
+
});
|
|
201
|
+
const isValidation = (validation) => state.validation === validation;
|
|
202
|
+
const getLanguage = () => state.language;
|
|
203
|
+
const configure = ({ validation, language }) => {
|
|
204
|
+
set('validation', validation || initialState.validation);
|
|
205
|
+
set('language', language || initialState.language);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export { configure, getLanguage as g, isValidation as i };
|