@uh-design-system/component-library 0.4.2 → 0.5.1
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/component-library.cjs.js +2 -2
- package/dist/cjs/ds-accordion_3.cjs.entry.js +11 -11
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +15 -16
- package/dist/cjs/ds-checkbox.cjs.entry.js +42 -35
- package/dist/cjs/ds-input-validity.cjs.entry.js +4 -6
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -5
- package/dist/cjs/ds-link.cjs.entry.js +5 -5
- package/dist/cjs/ds-text-input.cjs.entry.js +52 -24
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/{index-b2bddcf4.js → index-bf84b124.js} +16 -0
- package/dist/cjs/index.cjs.js +8 -0
- package/dist/cjs/{linkUtils-e911e899.js → linkUtils-695da37c.js} +0 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/store-9bd20f3c.js +207 -0
- package/dist/cjs/{utils-c9113835.js → utils-2ba5e075.js} +10 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/00-foundations/icons/icons.stories.js +1 -0
- package/dist/collection/components/00-foundations/types.js +1 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +6 -0
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +68 -56
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +27 -67
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +5 -8
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +6 -6
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +6 -6
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +6 -0
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +73 -27
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +82 -13
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +6 -7
- package/dist/collection/components/01-base-components/ds-text-input/utils.js +1 -10
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/store.js +13 -0
- package/dist/collection/utils/link/linkUtils.js +0 -9
- package/dist/collection/utils/utils.js +9 -0
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- 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-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-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/{index-50783b0c.js → index-434995e1.js} +2 -2
- package/dist/component-library/index.esm.js +1 -0
- package/dist/component-library/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -1
- package/dist/component-library/store-b8d17c10.js +1 -0
- package/dist/component-library/utils-5daa5bc0.js +1 -0
- package/dist/components/ds-accordion.js +6 -6
- package/dist/components/ds-button2.js +2 -2
- package/dist/components/ds-checkbox-group.js +21 -23
- package/dist/components/ds-checkbox2.js +44 -37
- package/dist/components/ds-icon2.js +11 -2
- package/dist/components/ds-input-validity2.js +4 -6
- package/dist/components/ds-link-with-arrow.js +5 -5
- package/dist/components/ds-link.js +5 -5
- package/dist/components/ds-text-input.js +58 -29
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +15 -1
- package/dist/components/linkUtils.js +1 -10
- package/dist/components/store.js +204 -0
- package/dist/esm/component-library.js +3 -3
- package/dist/esm/ds-accordion_3.entry.js +11 -11
- package/dist/esm/ds-checkbox-group.entry.js +15 -16
- package/dist/esm/ds-checkbox.entry.js +42 -35
- package/dist/esm/ds-input-validity.entry.js +4 -6
- package/dist/esm/ds-link-with-arrow.entry.js +5 -5
- package/dist/esm/ds-link.entry.js +5 -5
- package/dist/esm/ds-text-input.entry.js +52 -24
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/{index-50783b0c.js → index-434995e1.js} +15 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -10
- package/dist/esm/loader.js +3 -3
- package/dist/esm/store-b8d17c10.js +204 -0
- package/dist/esm/{utils-b5843ae1.js → utils-5daa5bc0.js} +10 -1
- package/dist/types/components/00-foundations/types.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +14 -14
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +14 -16
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +17 -8
- package/dist/types/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +1 -1
- package/dist/types/components.d.ts +42 -28
- package/dist/types/index.d.ts +1 -0
- package/dist/types/store.d.ts +10 -0
- package/dist/types/utils/link/linkUtils.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +3 -2
- package/dist/component-library/utils-b5843ae1.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
1
|
+
import { r as registerInstance, a as getElement, h } from './index-434995e1.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
|
+
import { i as isValidation } from './store-b8d17c10.js';
|
|
3
4
|
|
|
4
5
|
const dsInputValidityCss = ":root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.ds-input-validity{display:flex;align-items:center;margin-top:var(--ds-spacing-2xSmall);gap:var(--ds-spacing-2xSmall)}.ds-input-validity--error{color:var(--ds-textColor-danger)}.ds-input-validity--success{color:var(--ds-textColor-success)}.ds-input-validity ds-icon{display:block;height:1.5rem}.ds-input-validity small{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)}";
|
|
5
6
|
const DsInputValidityStyle0 = dsInputValidityCss;
|
|
@@ -11,7 +12,7 @@ const DsInputValidity = class {
|
|
|
11
12
|
get el() { return getElement(this); }
|
|
12
13
|
text;
|
|
13
14
|
type = 'error';
|
|
14
|
-
validityRole
|
|
15
|
+
validityRole;
|
|
15
16
|
identifier;
|
|
16
17
|
componentDidLoad() {
|
|
17
18
|
this.identifier = this.el.getAttribute('id');
|
|
@@ -23,10 +24,7 @@ const DsInputValidity = class {
|
|
|
23
24
|
'ds-input-validity--success': this.type === 'success',
|
|
24
25
|
});
|
|
25
26
|
const icon = this.type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return (h(Fragment, null, this.text && (h("div", { class: classes, role: this.validityRole }, h("ds-icon", { name: icon }), h("small", { id: this.identifier }, this.text)))));
|
|
27
|
+
return (h("div", { key: '2eca152eca6e7b4d7e894ff8aaf50a6d03c3e44f', role: isValidation('client') ? this.validityRole : undefined }, this.text && (h("div", { key: '73e4cd1b3af6a84b9c7cbca813c166bc10e9dd26', class: classes }, h("ds-icon", { key: '4eaad4001e758837f9e8b1aae48292a1c5a1a08f', name: icon }), h("small", { key: '3ee5d39785454b9aab9ae6012f3ad940c1f18df0', id: this.identifier }, this.text)))));
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
30
|
DsInputValidity.style = DsInputValidityStyle0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
1
|
+
import { r as registerInstance, a as getElement, h } from './index-434995e1.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
3
|
import { i as inheritAriaAttributes } from './attributes-7d09be1b.js';
|
|
4
|
-
import { o as opensInNewTab, v as visuallyHiddenAssistiveText
|
|
5
|
-
import { i as idGenerator } from './utils-
|
|
4
|
+
import { o as opensInNewTab, v as visuallyHiddenAssistiveText } from './linkUtils-3d1b28cf.js';
|
|
5
|
+
import { g as getAriaLabel, i as idGenerator } from './utils-5daa5bc0.js';
|
|
6
6
|
|
|
7
7
|
const dsLinkWithArrowCss = ":root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}:host{display:inline-block}.ds-link-with-arrow{display:inline-flex;align-items:center;color:var(--ds-textColor-link);letter-spacing:var(--ds-letterSpacing-wide);font-weight:var(--ds-fontWeight-semibold);font-size:var(--ds-fontSize-16);text-decoration-line:none}.ds-link-with-arrow:focus-visible{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}@media (min-width: 30rem){.ds-link-with-arrow{font-size:var(--ds-fontSize-18)}}.ds-link-with-arrow__icon{display:inline-flex;width:2em;height:2em;line-height:0;align-items:center;justify-content:center;color:var(--ds-textColor-white);background-color:var(--ds-bgColor-primary)}.ds-link-with-arrow__icon--start{margin-right:var(--ds-spacing-xSmall)}.ds-link-with-arrow__icon--end{margin-left:var(--ds-spacing-xSmall)}:hover slot>.ds-link-with-arrow__icon{outline:10px solid;background-color:var(--ds-bgColor-primary-hover)}:active slot>.ds-link-with-arrow__icon{background-color:var(--ds-bgColor-primary-active)}.ds-link-with-arrow:hover,.ds-link-with-arrow:active{text-decoration-line:underline;text-decoration-style:solid;text-decoration-skip-ink:auto;text-decoration-thickness:7%;text-underline-offset:12%;text-underline-position:from-font}.ds-link-with-arrow:hover{color:var(--ds-textColor-link-hover)}.ds-link-with-arrow:active,.ds-link-with-arrow:focus-visible{color:var(--ds-textColor-link-active)}";
|
|
8
8
|
const DsLinkWithArrowStyle0 = dsLinkWithArrowCss;
|
|
@@ -22,7 +22,7 @@ const DsLinkWithArrow = class {
|
|
|
22
22
|
href;
|
|
23
23
|
target;
|
|
24
24
|
language;
|
|
25
|
-
|
|
25
|
+
ariaLabel;
|
|
26
26
|
componentWillLoad() {
|
|
27
27
|
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
|
|
28
28
|
if (opensInNewTab(this.target)) {
|
|
@@ -36,7 +36,7 @@ const DsLinkWithArrow = class {
|
|
|
36
36
|
'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
|
|
37
37
|
'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
|
|
38
38
|
});
|
|
39
|
-
return (h("a", { key: '
|
|
39
|
+
return (h("a", { key: 'bce4a90f9cc5113ab3d5b300d791d2299e22b7ad', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: '96ba4a33114443aab36d1301cf65c56437b9a85b', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: '86d8029de69c1ecb3002a97f5bc0cdbf899b7f91', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: '7c2dafaee60253b1f5c22819b1afec83d106234b', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: 'a9fb3e2ddee16cce7c6b8fc0fba0b11970567276', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'f93f37d0d10d7a2d51980ff8feb76915cc4823b2', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
DsLinkWithArrow.style = DsLinkWithArrowStyle0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
1
|
+
import { r as registerInstance, a as getElement, h } from './index-434995e1.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
3
|
import { i as inheritAriaAttributes } from './attributes-7d09be1b.js';
|
|
4
|
-
import { o as opensInNewTab, v as visuallyHiddenAssistiveText
|
|
5
|
-
import { i as idGenerator } from './utils-
|
|
4
|
+
import { o as opensInNewTab, v as visuallyHiddenAssistiveText } from './linkUtils-3d1b28cf.js';
|
|
5
|
+
import { g as getAriaLabel, i as idGenerator } from './utils-5daa5bc0.js';
|
|
6
6
|
|
|
7
7
|
const dsLinkCss = ":root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}:host{display:inline-block}.ds-link{display:inline-flex;align-items:center;color:var(--ds-textColor-link);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);text-decoration-line:underline;text-decoration-style:solid;text-decoration-skip-ink:auto;text-decoration-thickness:7%;text-underline-offset:12%;text-underline-position:from-font}.ds-link:focus-visible{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-link--semibold{font-weight:var(--ds-fontWeight-semibold)}.ds-link--bold{font-weight:var(--ds-fontWeight-bold)}.ds-link--2xLarge{font-size:var(--ds-fontSize-22)}.ds-link--xLarge{font-size:var(--ds-fontSize-20)}.ds-link--large{font-size:var(--ds-fontSize-18)}.ds-link--medium{font-size:var(--ds-fontSize-16)}.ds-link--small{font-size:var(--ds-fontSize-14)}.ds-link--xSmall{font-size:var(--ds-fontSize-12)}.ds-link__icon{height:1em;width:1em}.ds-link__icon--start-inline{margin-right:var(--ds-spacing-3xSmall)}.ds-link__icon--start-standalone{margin-right:var(--ds-spacing-2xSmall)}.ds-link__icon--end-inline{margin-left:var(--ds-spacing-3xSmall)}.ds-link__icon--end-standalone{margin-left:var(--ds-spacing-2xSmall)}.ds-link:hover,.ds-link:active{text-decoration-thickness:13%;text-underline-offset:12%}.ds-link:hover{color:var(--ds-textColor-link-hover)}.ds-link:active{color:var(--ds-textColor-link-active)}.ds-link:visited{color:var(--ds-textColor-link-visited)}.ds-link--standalone{color:var(--ds-textColor-link);text-decoration-line:none}.ds-link--standalone:hover,.ds-link--standalone:active{text-decoration-line:underline}.ds-link--standalone:hover{color:var(--ds-textColor-link-hover)}.ds-link--standalone:active{color:var(--ds-textColor-link-active)}.ds-link--standalone:focus-visible{color:var(--ds-textColor-link)}.ds-link--standalone:visited{color:var(--ds-textColor-link)}";
|
|
8
8
|
const DsLinkStyle0 = dsLinkCss;
|
|
@@ -28,7 +28,7 @@ const DsLink = class {
|
|
|
28
28
|
target;
|
|
29
29
|
download;
|
|
30
30
|
language;
|
|
31
|
-
|
|
31
|
+
ariaLabel;
|
|
32
32
|
componentWillLoad() {
|
|
33
33
|
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
|
|
34
34
|
if (opensInNewTab(this.target)) {
|
|
@@ -45,7 +45,7 @@ const DsLink = class {
|
|
|
45
45
|
[`ds-link__icon--start-${this.variant}`]: this.iconPosition === 'start',
|
|
46
46
|
[`ds-link__icon--end-${this.variant}`]: this.iconPosition === 'end',
|
|
47
47
|
});
|
|
48
|
-
return (h("a", { key: '
|
|
48
|
+
return (h("a", { key: 'f8e36a029709033379e53cc1c409bc9c0069820e', href: this.href, class: classes, rel: this.rel, target: this.target, download: this.download, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: '88f90209b6557942dd956585b5f77632aa647c8e', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '87169acfb32913d10d27b35a9c6f714385979aa7', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), this.text, h("slot", { key: 'b38677240eb8bd7c1200c8dc08876ba75e7b3e81', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'c3088e302a43b4cbc5601a9adff54a3dc27a59dc', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '25ac189fd216148a05fddfc6e384cfbde59e0e22', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
DsLink.style = DsLinkStyle0;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, F as Fragment } from './index-434995e1.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
|
-
import { i as idGenerator } from './utils-b5843ae1.js';
|
|
4
3
|
import { g as getRequiredText, a as getOptionalText } from './controlUtils-9ca4087b.js';
|
|
4
|
+
import { i as isValidation } from './store-b8d17c10.js';
|
|
5
|
+
import { g as getAriaLabel, i as idGenerator } from './utils-5daa5bc0.js';
|
|
5
6
|
|
|
6
|
-
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{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-textColor-default)}.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-textColor-secondary)}.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-borderColor-default);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-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-input--container.sc-ds-text-input:focus-within{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-input--container.invalid.sc-ds-text-input{background-color:var(--ds-bgColor-danger);border-color:var(--ds-borderColor-danger)}.ds-input--container.invalid.sc-ds-text-input:hover:not(.ds-input--container.invalid:focus-within){background-color:var(--ds-bgColor-danger-hover);border-color:var(--ds-borderColor-danger)}.ds-input--container.invalid.active.sc-ds-text-input{background-color:var(--ds-bgColor-danger-active);border-color:var(--ds-borderColor-danger)}.ds-input--container.valid.sc-ds-text-input{background-color:var(--ds-bgColor-success);border-color:var(--ds-borderColor-success)}.ds-input--container.valid.sc-ds-text-input:hover:not(.ds-input--container.valid:focus-within){background-color:var(--ds-bgColor-success-hover);border-color:var(--ds-borderColor-success)}.ds-input--container.valid.active.sc-ds-text-input{background-color:var(--ds-bgColor-success-active);border-color:var(--ds-borderColor-success)}.ds-input--container.readonly.sc-ds-text-input,.ds-input--container.disabled.sc-ds-text-input{background-color:var(--ds-bgColor-disabled-onLight);border-color:var(--ds-borderColor-disabled-onLight)}.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:readonly){border-color:var(--ds-borderColor-default)}.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-borderColor-default);background-color:var(--ds-bgColor-white-active)}.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-borderColor-default);background-color:var(--ds-bgColor-white-hover)}.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-borderColor-primary)}.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-bgColor-transparent-onLight-hover)}.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-textColor-default);border:none;padding-block:var(--ds-spacing-4xSmall)}.ds-input--container.sc-ds-text-input>input.sc-ds-text-input:disabled{color:var(--ds-textColor-disabled-onLight)}.ds-input--container.sc-ds-text-input>input.sc-ds-text-input:disabled::placeholder{color:var(--ds-textColor-disabled-onLight)}.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-textColor-secondary)}.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{-moz-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{-webkit-appearance:none;margin:0}.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(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:has(ds-button.suffix){padding-inline-end:unset}.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-textColor-default)}.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}.error-text--container.sc-ds-text-input,.success-text--container.sc-ds-text-input{display:flex;align-items:center;margin-top:var(--ds-spacing-2xSmall);gap:var(--ds-spacing-2xSmall)}.error-text--container.sc-ds-text-input ds-icon.sc-ds-text-input,.success-text--container.sc-ds-text-input ds-icon.sc-ds-text-input{display:block;height:1.5rem}.error-text--container.sc-ds-text-input small.sc-ds-text-input,.success-text--container.sc-ds-text-input small.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)}.error-text--container.sc-ds-text-input{color:var(--ds-textColor-danger)}.success-text--container.sc-ds-text-input{color:var(--ds-textColor-success)}";
|
|
7
|
+
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}.no-style-leak.sc-ds-text-input *.sc-ds-text-input,.sc-ds-text-input-h *.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-textColor-default)}.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-textColor-secondary)}.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-borderColor-default);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-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-input--container.sc-ds-text-input:focus-within{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-input--container.invalid.sc-ds-text-input{background-color:var(--ds-bgColor-danger);border-color:var(--ds-borderColor-danger)}.ds-input--container.invalid.sc-ds-text-input:hover:not(.ds-input--container.invalid:focus-within){background-color:var(--ds-bgColor-danger-hover);border-color:var(--ds-borderColor-danger)}.ds-input--container.invalid.active.sc-ds-text-input{background-color:var(--ds-bgColor-danger-active);border-color:var(--ds-borderColor-danger)}.ds-input--container.valid.sc-ds-text-input{background-color:var(--ds-bgColor-success);border-color:var(--ds-borderColor-success)}.ds-input--container.valid.sc-ds-text-input:hover:not(.ds-input--container.valid:focus-within){background-color:var(--ds-bgColor-success-hover);border-color:var(--ds-borderColor-success)}.ds-input--container.valid.active.sc-ds-text-input{background-color:var(--ds-bgColor-success-active);border-color:var(--ds-borderColor-success)}.ds-input--container.readonly.sc-ds-text-input,.ds-input--container.disabled.sc-ds-text-input{background-color:var(--ds-bgColor-disabled-onLight);border-color:var(--ds-borderColor-disabled-onLight)}.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:readonly){border-color:var(--ds-borderColor-default)}.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-borderColor-default);background-color:var(--ds-bgColor-white-active)}.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-borderColor-default);background-color:var(--ds-bgColor-white-hover)}.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-borderColor-primary)}.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-bgColor-transparent-onLight-hover)}.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-textColor-default);border:none;padding-block:var(--ds-spacing-4xSmall)}.ds-input--container.sc-ds-text-input>input.sc-ds-text-input:disabled{color:var(--ds-textColor-disabled-onLight)}.ds-input--container.sc-ds-text-input>input.sc-ds-text-input:disabled::placeholder{color:var(--ds-textColor-disabled-onLight)}.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-textColor-secondary)}.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{-moz-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{-webkit-appearance:none;margin:0}.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(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:has(ds-button.suffix){padding-inline-end:unset}.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-textColor-default)}.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}.error-text--container.sc-ds-text-input,.success-text--container.sc-ds-text-input{display:flex;align-items:center;margin-top:var(--ds-spacing-2xSmall);gap:var(--ds-spacing-2xSmall)}.error-text--container.sc-ds-text-input ds-icon.sc-ds-text-input,.success-text--container.sc-ds-text-input ds-icon.sc-ds-text-input{display:block;height:1.5rem}.error-text--container.sc-ds-text-input small.sc-ds-text-input,.success-text--container.sc-ds-text-input small.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)}.error-text--container.sc-ds-text-input{color:var(--ds-textColor-danger)}.success-text--container.sc-ds-text-input{color:var(--ds-textColor-success)}";
|
|
7
8
|
const DsTextInputStyle0 = dsTextInputCss;
|
|
8
9
|
|
|
9
10
|
const INPUT_TYPE_ICONS_MAP = {
|
|
@@ -14,26 +15,32 @@ const INPUT_TYPE_ACTION_BUTTON_ICON_MAP = {
|
|
|
14
15
|
password: ({ passwordInputVisible }) => (passwordInputVisible ? 'visibility_off_fill' : 'visibility_fill'),
|
|
15
16
|
};
|
|
16
17
|
const inputIdGenerator = idGenerator('ds-input');
|
|
17
|
-
const assistiveTextIdGenerator = idGenerator('ds-assistive-text');
|
|
18
|
-
const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
|
|
19
|
-
const successTextIdGenerator = idGenerator('success-text');
|
|
20
|
-
const errorTextIdGenerator = idGenerator('error-text');
|
|
21
18
|
const DsTextInput = class {
|
|
22
19
|
constructor(hostRef) {
|
|
23
20
|
registerInstance(this, hostRef);
|
|
21
|
+
this.clear = createEvent(this, "clear", 7);
|
|
22
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
23
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
27
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
suffixButtonElement;
|
|
26
31
|
inputElement;
|
|
27
|
-
assistiveTextId
|
|
28
|
-
visuallyHiddenAssistiveTextId
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
assistiveTextId;
|
|
33
|
+
visuallyHiddenAssistiveTextId;
|
|
34
|
+
errorTextId;
|
|
35
|
+
successTextId;
|
|
31
36
|
hasPrefixSlot = false;
|
|
32
37
|
hasSuffixSlot = false;
|
|
33
38
|
get el() { return getElement(this); }
|
|
39
|
+
internals;
|
|
40
|
+
clear;
|
|
34
41
|
label;
|
|
35
42
|
placeholder;
|
|
36
|
-
|
|
43
|
+
identifier = inputIdGenerator.next().value;
|
|
37
44
|
name;
|
|
38
45
|
disabled;
|
|
39
46
|
optional;
|
|
@@ -62,6 +69,14 @@ const DsTextInput = class {
|
|
|
62
69
|
clearButtonVisible = false;
|
|
63
70
|
passwordInputVisible = false;
|
|
64
71
|
inputActive = false;
|
|
72
|
+
validationMessage;
|
|
73
|
+
setIds = () => {
|
|
74
|
+
this.assistiveTextId = `${this.identifier}-assistive-text`;
|
|
75
|
+
this.visuallyHiddenAssistiveTextId = `${this.identifier}-visually-hidden-assistive-text`;
|
|
76
|
+
this.errorTextId = `${this.identifier}-error-text`;
|
|
77
|
+
this.successTextId = `${this.identifier}-success-text`;
|
|
78
|
+
};
|
|
79
|
+
getValidationMessage = () => this.errorText || this.internals?.validationMessage || this.inputElement?.validationMessage;
|
|
65
80
|
async togglePasswordVisibility() {
|
|
66
81
|
return (this.passwordInputVisible = !this.passwordInputVisible);
|
|
67
82
|
}
|
|
@@ -69,6 +84,7 @@ const DsTextInput = class {
|
|
|
69
84
|
this.inputElement.value = '';
|
|
70
85
|
this.inputElement.focus();
|
|
71
86
|
this.clearButtonVisible = false;
|
|
87
|
+
this.clear.emit({ id: this.identifier });
|
|
72
88
|
}
|
|
73
89
|
getLabelText = () => {
|
|
74
90
|
if (this.required) {
|
|
@@ -80,9 +96,27 @@ const DsTextInput = class {
|
|
|
80
96
|
return this.label;
|
|
81
97
|
};
|
|
82
98
|
componentWillLoad() {
|
|
99
|
+
this.setIds();
|
|
83
100
|
this.hasPrefixSlot = !!this.el.querySelector('[slot="prefix"]');
|
|
84
101
|
this.hasSuffixSlot = !!this.el.querySelector('[slot="suffix"]');
|
|
102
|
+
if (isValidation('server') || this.errorText) {
|
|
103
|
+
this.validationMessage = this.getValidationMessage();
|
|
104
|
+
}
|
|
85
105
|
}
|
|
106
|
+
handleInput = (e) => {
|
|
107
|
+
const target = e.target;
|
|
108
|
+
this.clearButtonVisible = !!target.value;
|
|
109
|
+
this.internals?.setFormValue(target.value);
|
|
110
|
+
if (isValidation('client') && this.validationMessage) {
|
|
111
|
+
this.validationMessage = this.getValidationMessage();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
handleBlur = () => {
|
|
115
|
+
this.hasFocus = false;
|
|
116
|
+
if (isValidation('client')) {
|
|
117
|
+
this.validationMessage = this.getValidationMessage();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
86
120
|
onActionButtonClicked = (e) => {
|
|
87
121
|
e.stopPropagation();
|
|
88
122
|
switch (this.type) {
|
|
@@ -94,13 +128,6 @@ const DsTextInput = class {
|
|
|
94
128
|
return;
|
|
95
129
|
}
|
|
96
130
|
};
|
|
97
|
-
renderValidityMessage(type) {
|
|
98
|
-
const textId = type === 'success' ? this.successTextId : this.errorTextId;
|
|
99
|
-
const text = type === 'success' ? this.successText : this.errorText;
|
|
100
|
-
const icon = type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
101
|
-
const className = type + '-text';
|
|
102
|
-
return (h("slot", { name: className }, text && (h("div", { class: `${className}--container` }, h("ds-icon", { name: icon }), h("small", { id: textId, class: className }, text)))));
|
|
103
|
-
}
|
|
104
131
|
renderPrefixContent() {
|
|
105
132
|
if (this.hasPrefixSlot) {
|
|
106
133
|
return h("slot", { name: "prefix" });
|
|
@@ -135,19 +162,20 @@ const DsTextInput = class {
|
|
|
135
162
|
}
|
|
136
163
|
render() {
|
|
137
164
|
const inputType = this.type === 'password' && this.passwordInputVisible ? 'text' : this.type;
|
|
138
|
-
return (h(Fragment, { key: '
|
|
165
|
+
return (h(Fragment, { key: 'efb783f742bb82b01fd6807a628eb693666a819b' }, h("div", { key: 'dde260b136af4b68de1fa15928529f5e57f54c3a', class: "ds-input--label-container" }, h("slot", { key: 'e7ba428a8b8202c9b3e4d9a9c6d4257b0b48d83a', name: "label" }, h("label", { key: '1f28c5fd53249068de50c6d0ea0aa88ccf65a1ec', htmlFor: this.identifier }, this.getLabelText())), h("slot", { key: 'e3c1ea925cfc7f9599ee651da0aeaab98fa806bb', name: "help-text" }, h("small", { key: '671ab99029e2775d964feb012beb8a20912be5e3', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '8eb744be9b95ddceb1dd5bed0274d29a26e7ec1d', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: 'b7fa7067a52d176b810eb88777423adf50dfd8b9', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input--container', {
|
|
139
166
|
disabled: this.disabled,
|
|
140
167
|
readonly: this.readonly,
|
|
141
168
|
valid: !!this.successText,
|
|
142
169
|
invalid: !!this.errorText,
|
|
143
170
|
focus: this.hasFocus,
|
|
144
171
|
active: !!this.inputActive,
|
|
145
|
-
}) }, this.renderPrefixContent(), h("input", { key: '
|
|
172
|
+
}) }, this.renderPrefixContent(), h("input", { key: 'f619722a0c088fbd99d851b4cc49a220538da0ae', ref: e => (this.inputElement = e), id: this.identifier, name: this.name, "aria-label": getAriaLabel(this.label, this.ariaLabel), "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
|
|
146
173
|
classNames(this.assistiveTextId, this.visuallyHiddenAssistiveTextId, {
|
|
147
|
-
[this.
|
|
148
|
-
[this.
|
|
149
|
-
}), disabled: this.disabled, required: this.required, readonly: this.readonly, value: this.value, type: inputType, min: this.min, max: this.max, maxlength: this.maxlength, pattern: this.pattern, placeholder: this.placeholder, autocomplete: this.autocomplete, onInput:
|
|
174
|
+
[this.errorTextId]: Boolean(this.validationMessage),
|
|
175
|
+
[this.successTextId]: Boolean(this.successText),
|
|
176
|
+
}), "aria-invalid": Boolean(this.validationMessage) ? 'true' : 'false', disabled: this.disabled, required: this.required, readonly: this.readonly, value: this.value, type: inputType, min: this.min, max: this.max, maxlength: this.maxlength, pattern: this.pattern, placeholder: this.placeholder, autocomplete: this.autocomplete, onInput: this.handleInput, onFocus: () => (this.hasFocus = true), onBlur: this.handleBlur }), this.renderSuffixContent()), h("slot", { key: 'b70c638ad0de13e0bfa1c2f0ec366e748ab8e4e2', name: "input-validity" }, h("ds-input-validity", { key: '7c1da6ba8d42add8de43f4926c24c8a64bbe32e2', id: this.errorTextId, text: this.validationMessage, type: "error", role: "alert" }), h("ds-input-validity", { key: '46258021c17e3461ea4a0c2ae720fb44305550c5', id: this.successTextId, text: this.successText, type: "success", role: "status" }))));
|
|
150
177
|
}
|
|
178
|
+
static get formAssociated() { return true; }
|
|
151
179
|
};
|
|
152
180
|
DsTextInput.style = DsTextInputStyle0;
|
|
153
181
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-
|
|
1
|
+
import { r as registerInstance, h } from './index-434995e1.js';
|
|
2
2
|
|
|
3
3
|
const dsVisuallyHiddenCss = ":host{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}";
|
|
4
4
|
const DsVisuallyHiddenStyle0 = dsVisuallyHiddenCss;
|
|
@@ -8,7 +8,7 @@ const DsVisuallyHidden = class {
|
|
|
8
8
|
registerInstance(this, hostRef);
|
|
9
9
|
}
|
|
10
10
|
render() {
|
|
11
|
-
return (h("slot", { key: '
|
|
11
|
+
return (h("slot", { key: '083eaed9210a85360479b367769c8904a6089f64' }));
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
DsVisuallyHidden.style = DsVisuallyHiddenStyle0;
|
|
@@ -1314,8 +1314,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
1316
1316
|
};
|
|
1317
|
+
var renderingRef = null;
|
|
1317
1318
|
var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1318
1319
|
try {
|
|
1320
|
+
renderingRef = instance;
|
|
1319
1321
|
instance = instance.render() ;
|
|
1320
1322
|
{
|
|
1321
1323
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
@@ -1333,8 +1335,10 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
1333
1335
|
} catch (e) {
|
|
1334
1336
|
consoleError(e, hostRef.$hostElement$);
|
|
1335
1337
|
}
|
|
1338
|
+
renderingRef = null;
|
|
1336
1339
|
return null;
|
|
1337
1340
|
};
|
|
1341
|
+
var getRenderingRef = () => renderingRef;
|
|
1338
1342
|
var postUpdateComponent = (hostRef) => {
|
|
1339
1343
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1340
1344
|
const elm = hostRef.$hostElement$;
|
|
@@ -1373,6 +1377,16 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1373
1377
|
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1374
1378
|
}
|
|
1375
1379
|
};
|
|
1380
|
+
var forceUpdate = (ref) => {
|
|
1381
|
+
{
|
|
1382
|
+
const hostRef = getHostRef(ref);
|
|
1383
|
+
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1384
|
+
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1385
|
+
scheduleUpdate(hostRef, false);
|
|
1386
|
+
}
|
|
1387
|
+
return isConnected;
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1376
1390
|
var appDidLoad = (who) => {
|
|
1377
1391
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
1378
1392
|
};
|
|
@@ -1920,4 +1934,4 @@ var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
1920
1934
|
// src/runtime/nonce.ts
|
|
1921
1935
|
var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
1922
1936
|
|
|
1923
|
-
export { Fragment as F, bootstrapLazy as b, createEvent as c,
|
|
1937
|
+
export { Fragment as F, getElement as a, bootstrapLazy as b, createEvent as c, forceUpdate as f, getRenderingRef as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { c as configure } from './store-b8d17c10.js';
|
|
2
|
+
import './index-434995e1.js';
|
|
@@ -9,14 +9,5 @@ const visuallyHiddenAssistiveText = (lang) => {
|
|
|
9
9
|
return 'Opens in a new tab';
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
const getAriaLabel = (text, ariaLabel) => {
|
|
13
|
-
if (!ariaLabel) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
if (ariaLabel.startsWith(text)) {
|
|
17
|
-
return ariaLabel;
|
|
18
|
-
}
|
|
19
|
-
return [text, ariaLabel].join(' ');
|
|
20
|
-
};
|
|
21
12
|
|
|
22
|
-
export {
|
|
13
|
+
export { opensInNewTab as o, visuallyHiddenAssistiveText as v };
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { b as bootstrapLazy } from './index-434995e1.js';
|
|
2
|
+
export { s as setNonce } from './index-434995e1.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["ds-accordion_3",[[1,"ds-accordion",{"variant":[1],"borderAligned":[4,"border-aligned"],"openByDefault":[4,"open-by-default"],"accordionId":[1,"accordion-id"],"headingLevel":[2,"heading-level"],"useCloseButton":[4,"use-close-button"],"closeButtonLabel":[1,"close-button-label"],"hideTopBorder":[4,"hide-top-border"],"isExpanded":[32]},null,{"isExpanded":["watchHandler"]}],[6,"ds-button",{"value":[1],"variant":[1],"colour":[1],"size":[1],"fontWeight":[1,"font-weight"],"icon":[1],"iconPosition":[1,"icon-position"],"type":[1],"disabled":[4],"fullWidth":[4,"full-width"],"ariaDisabled":[1,"aria-disabled"]}],[1,"ds-icon",{"name":[1],"colour":[1],"size":[1],"dsTitle":[1,"title"],"role":[1],"hidden":[4],"message":[32]}]]],["ds-
|
|
8
|
+
return bootstrapLazy([["ds-accordion_3",[[1,"ds-accordion",{"variant":[1],"borderAligned":[4,"border-aligned"],"openByDefault":[4,"open-by-default"],"accordionId":[1,"accordion-id"],"headingLevel":[2,"heading-level"],"useCloseButton":[4,"use-close-button"],"closeButtonLabel":[1,"close-button-label"],"hideTopBorder":[4,"hide-top-border"],"isExpanded":[32]},null,{"isExpanded":["watchHandler"]}],[6,"ds-button",{"value":[1],"variant":[1],"colour":[1],"size":[1],"fontWeight":[1,"font-weight"],"icon":[1],"iconPosition":[1,"icon-position"],"type":[1],"disabled":[4],"fullWidth":[4,"full-width"],"ariaDisabled":[1,"aria-disabled"]}],[1,"ds-icon",{"name":[1],"colour":[1],"size":[1],"dsTitle":[1,"title"],"role":[1],"hidden":[4],"message":[32]}]]],["ds-input-validity",[[0,"ds-input-validity",{"text":[1],"type":[1],"validityRole":[1,"role"],"identifier":[32]}]]],["ds-text-input",[[70,"ds-text-input",{"label":[1],"placeholder":[1],"identifier":[1,"id"],"name":[1],"disabled":[4],"optional":[4],"required":[4],"readonly":[4],"value":[1],"min":[2],"max":[2],"maxlength":[2],"pattern":[1],"autocomplete":[1],"optionalText":[1,"optional-text"],"errorText":[1,"error-text"],"successText":[1,"success-text"],"assistiveText":[1,"assistive-text"],"actionButtonAriaLabel":[1,"action-button-aria-label"],"hiddenAssistiveText":[1,"hidden-assistive-text"],"prefixText":[1,"prefix-text"],"suffixText":[1,"suffix-text"],"icon":[1],"type":[1],"ariaLabel":[1,"aria-label"],"ariaLabelledBy":[1,"aria-labelledby"],"ariaDescribedby":[1,"aria-describedby"],"hasFocus":[32],"clearButtonVisible":[32],"passwordInputVisible":[32],"inputActive":[32],"validationMessage":[32],"togglePasswordVisibility":[64],"clearInput":[64]}]]],["ds-checkbox",[[65,"ds-checkbox",{"identifier":[1,"id"],"checked":[1028],"legend":[1],"assistiveText":[1,"assistive-text"],"text":[1],"indeterminate":[4],"disabled":[4],"errorText":[1,"error-text"],"errorsDisabled":[4,"data-errors-disabled"],"required":[4],"optional":[4],"optionalText":[1,"optional-text"],"ariaLabel":[1,"aria-label"],"value":[32],"validationMessage":[32]}]]],["ds-checkbox-group",[[1,"ds-checkbox-group",{"legend":[1],"assistiveText":[1,"assistive-text"],"direction":[1],"errorText":[1,"error-text"],"text":[1],"checked":[4],"disabled":[4],"childElementsCount":[32],"checkedChildElementCount":[32],"isIndeterminate":[32],"indeterminateChildCheckboxCount":[32],"setChecked":[64]},[[0,"dsCheckboxGroupIndeterminateChildChange","listenIndeterminateChildChange"],[0,"dsCheckboxInput","listenCheckboxChange"],[0,"dsCheckboxGroupChange","listenCheckboxGroupChange"]],{"disabled":["watchCheckboxDisabledChange"],"checked":["watchCheckedChange"],"isIndeterminate":["watchIndeterminateChange"],"checkedChildElementCount":["watchCheckedChildElementCountChange"]}]]],["ds-visually-hidden",[[1,"ds-visually-hidden"]]],["ds-link",[[1,"ds-link",{"text":[1],"size":[1],"variant":[1],"weight":[1],"icon":[1025],"iconPosition":[1025,"icon-position"],"iconTitle":[1,"icon-title"],"iconHidden":[4,"icon-hidden"],"href":[1],"target":[1],"download":[4],"language":[1,"lang"],"ariaLabel":[1,"aria-label"]}]]],["ds-link-with-arrow",[[1,"ds-link-with-arrow",{"text":[1],"iconPosition":[1,"icon-position"],"href":[1],"target":[1],"language":[1,"lang"],"ariaLabel":[1,"aria-label"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { g as getRenderingRef, f as forceUpdate } from './index-434995e1.js';
|
|
2
|
+
|
|
3
|
+
const appendToMap = (map, propName, value) => {
|
|
4
|
+
const items = map.get(propName);
|
|
5
|
+
if (!items) {
|
|
6
|
+
map.set(propName, [value]);
|
|
7
|
+
}
|
|
8
|
+
else if (!items.includes(value)) {
|
|
9
|
+
items.push(value);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const debounce = (fn, ms) => {
|
|
13
|
+
let timeoutId;
|
|
14
|
+
return (...args) => {
|
|
15
|
+
if (timeoutId) {
|
|
16
|
+
clearTimeout(timeoutId);
|
|
17
|
+
}
|
|
18
|
+
timeoutId = setTimeout(() => {
|
|
19
|
+
timeoutId = 0;
|
|
20
|
+
fn(...args);
|
|
21
|
+
}, ms);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Check if a possible element isConnected.
|
|
27
|
+
* The property might not be there, so we check for it.
|
|
28
|
+
*
|
|
29
|
+
* We want it to return true if isConnected is not a property,
|
|
30
|
+
* otherwise we would remove these elements and would not update.
|
|
31
|
+
*
|
|
32
|
+
* Better leak in Edge than to be useless.
|
|
33
|
+
*/
|
|
34
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
35
|
+
const cleanupElements = debounce((map) => {
|
|
36
|
+
for (let key of map.keys()) {
|
|
37
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
38
|
+
}
|
|
39
|
+
}, 2_000);
|
|
40
|
+
const stencilSubscription = () => {
|
|
41
|
+
if (typeof getRenderingRef !== 'function') {
|
|
42
|
+
// If we are not in a stencil project, we do nothing.
|
|
43
|
+
// This function is not really exported by @stencil/core.
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
const elmsToUpdate = new Map();
|
|
47
|
+
return {
|
|
48
|
+
dispose: () => elmsToUpdate.clear(),
|
|
49
|
+
get: (propName) => {
|
|
50
|
+
const elm = getRenderingRef();
|
|
51
|
+
if (elm) {
|
|
52
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
set: (propName) => {
|
|
56
|
+
const elements = elmsToUpdate.get(propName);
|
|
57
|
+
if (elements) {
|
|
58
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
59
|
+
}
|
|
60
|
+
cleanupElements(elmsToUpdate);
|
|
61
|
+
},
|
|
62
|
+
reset: () => {
|
|
63
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
64
|
+
cleanupElements(elmsToUpdate);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
70
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
71
|
+
const unwrappedState = unwrap(defaultState);
|
|
72
|
+
let states = new Map(Object.entries(unwrappedState ?? {}));
|
|
73
|
+
const handlers = {
|
|
74
|
+
dispose: [],
|
|
75
|
+
get: [],
|
|
76
|
+
set: [],
|
|
77
|
+
reset: [],
|
|
78
|
+
};
|
|
79
|
+
const reset = () => {
|
|
80
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
81
|
+
// otherwise, the state won't be properly reset
|
|
82
|
+
states = new Map(Object.entries(unwrap(defaultState) ?? {}));
|
|
83
|
+
handlers.reset.forEach((cb) => cb());
|
|
84
|
+
};
|
|
85
|
+
const dispose = () => {
|
|
86
|
+
// Call first dispose as resetting the state would
|
|
87
|
+
// cause less updates ;)
|
|
88
|
+
handlers.dispose.forEach((cb) => cb());
|
|
89
|
+
reset();
|
|
90
|
+
};
|
|
91
|
+
const get = (propName) => {
|
|
92
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
93
|
+
return states.get(propName);
|
|
94
|
+
};
|
|
95
|
+
const set = (propName, value) => {
|
|
96
|
+
const oldValue = states.get(propName);
|
|
97
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
98
|
+
states.set(propName, value);
|
|
99
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const state = (typeof Proxy === 'undefined'
|
|
103
|
+
? {}
|
|
104
|
+
: new Proxy(unwrappedState, {
|
|
105
|
+
get(_, propName) {
|
|
106
|
+
return get(propName);
|
|
107
|
+
},
|
|
108
|
+
ownKeys(_) {
|
|
109
|
+
return Array.from(states.keys());
|
|
110
|
+
},
|
|
111
|
+
getOwnPropertyDescriptor() {
|
|
112
|
+
return {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
configurable: true,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
has(_, propName) {
|
|
118
|
+
return states.has(propName);
|
|
119
|
+
},
|
|
120
|
+
set(_, propName, value) {
|
|
121
|
+
set(propName, value);
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
124
|
+
}));
|
|
125
|
+
const on = (eventName, callback) => {
|
|
126
|
+
handlers[eventName].push(callback);
|
|
127
|
+
return () => {
|
|
128
|
+
removeFromArray(handlers[eventName], callback);
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
const onChange = (propName, cb) => {
|
|
132
|
+
const unSet = on('set', (key, newValue) => {
|
|
133
|
+
if (key === propName) {
|
|
134
|
+
cb(newValue);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
138
|
+
// Otherwise we might not be sending the right reset value.
|
|
139
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
140
|
+
return () => {
|
|
141
|
+
unSet();
|
|
142
|
+
unReset();
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const use = (...subscriptions) => {
|
|
146
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
147
|
+
if (subscription.set) {
|
|
148
|
+
unsubs.push(on('set', subscription.set));
|
|
149
|
+
}
|
|
150
|
+
if (subscription.get) {
|
|
151
|
+
unsubs.push(on('get', subscription.get));
|
|
152
|
+
}
|
|
153
|
+
if (subscription.reset) {
|
|
154
|
+
unsubs.push(on('reset', subscription.reset));
|
|
155
|
+
}
|
|
156
|
+
if (subscription.dispose) {
|
|
157
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
158
|
+
}
|
|
159
|
+
return unsubs;
|
|
160
|
+
}, []);
|
|
161
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
162
|
+
};
|
|
163
|
+
const forceUpdate = (key) => {
|
|
164
|
+
const oldValue = states.get(key);
|
|
165
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
state,
|
|
169
|
+
get,
|
|
170
|
+
set,
|
|
171
|
+
on,
|
|
172
|
+
onChange,
|
|
173
|
+
use,
|
|
174
|
+
dispose,
|
|
175
|
+
reset,
|
|
176
|
+
forceUpdate,
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const removeFromArray = (array, item) => {
|
|
180
|
+
const index = array.indexOf(item);
|
|
181
|
+
if (index >= 0) {
|
|
182
|
+
array[index] = array[array.length - 1];
|
|
183
|
+
array.length--;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
188
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
189
|
+
map.use(stencilSubscription());
|
|
190
|
+
return map;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const initialState = {
|
|
194
|
+
validation: 'client',
|
|
195
|
+
};
|
|
196
|
+
const { state, set } = createStore({
|
|
197
|
+
...initialState,
|
|
198
|
+
});
|
|
199
|
+
const isValidation = (validation) => state.validation === validation;
|
|
200
|
+
const configure = ({ validation }) => {
|
|
201
|
+
set('validation', validation || initialState.validation);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export { configure as c, isValidation as i };
|
|
@@ -11,5 +11,14 @@ function* idGenerator(id) {
|
|
|
11
11
|
yield `${id}-${currentId++}`;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
const getAriaLabel = (text, ariaLabel) => {
|
|
15
|
+
if (!ariaLabel) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (ariaLabel.startsWith(text)) {
|
|
19
|
+
return ariaLabel;
|
|
20
|
+
}
|
|
21
|
+
return [text, ariaLabel].join(' ');
|
|
22
|
+
};
|
|
14
23
|
|
|
15
|
-
export { idGenerator as i, remToPx as r };
|
|
24
|
+
export { getAriaLabel as g, idGenerator as i, remToPx as r };
|