@uh-design-system/component-library 0.4.2 → 0.5.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/component-library.cjs.js +2 -2
- package/dist/cjs/ds-accordion_3.cjs.entry.js +10 -10
- 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 +51 -23
- 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/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.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.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 +1 -1
- 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 +57 -28
- 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 +10 -10
- 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 +51 -23
- 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
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-bf84b124.js');
|
|
6
6
|
const index$1 = require('./index-5b0b9d4c.js');
|
|
7
|
-
const utils = require('./utils-c9113835.js');
|
|
8
7
|
const controlUtils = require('./controlUtils-041de0fd.js');
|
|
8
|
+
const store = require('./store-9bd20f3c.js');
|
|
9
|
+
const utils = require('./utils-2ba5e075.js');
|
|
9
10
|
|
|
10
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}.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)}";
|
|
11
12
|
const DsTextInputStyle0 = dsTextInputCss;
|
|
@@ -18,26 +19,32 @@ const INPUT_TYPE_ACTION_BUTTON_ICON_MAP = {
|
|
|
18
19
|
password: ({ passwordInputVisible }) => (passwordInputVisible ? 'visibility_off_fill' : 'visibility_fill'),
|
|
19
20
|
};
|
|
20
21
|
const inputIdGenerator = utils.idGenerator('ds-input');
|
|
21
|
-
const assistiveTextIdGenerator = utils.idGenerator('ds-assistive-text');
|
|
22
|
-
const visuallyHiddenAssistiveTextIdGenerator = utils.idGenerator('visually-hidden-assistive-text');
|
|
23
|
-
const successTextIdGenerator = utils.idGenerator('success-text');
|
|
24
|
-
const errorTextIdGenerator = utils.idGenerator('error-text');
|
|
25
22
|
const DsTextInput = class {
|
|
26
23
|
constructor(hostRef) {
|
|
27
24
|
index.registerInstance(this, hostRef);
|
|
25
|
+
this.clear = index.createEvent(this, "clear", 7);
|
|
26
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
27
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
31
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
suffixButtonElement;
|
|
30
35
|
inputElement;
|
|
31
|
-
assistiveTextId
|
|
32
|
-
visuallyHiddenAssistiveTextId
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
assistiveTextId;
|
|
37
|
+
visuallyHiddenAssistiveTextId;
|
|
38
|
+
errorTextId;
|
|
39
|
+
successTextId;
|
|
35
40
|
hasPrefixSlot = false;
|
|
36
41
|
hasSuffixSlot = false;
|
|
37
42
|
get el() { return index.getElement(this); }
|
|
43
|
+
internals;
|
|
44
|
+
clear;
|
|
38
45
|
label;
|
|
39
46
|
placeholder;
|
|
40
|
-
|
|
47
|
+
identifier = inputIdGenerator.next().value;
|
|
41
48
|
name;
|
|
42
49
|
disabled;
|
|
43
50
|
optional;
|
|
@@ -66,6 +73,14 @@ const DsTextInput = class {
|
|
|
66
73
|
clearButtonVisible = false;
|
|
67
74
|
passwordInputVisible = false;
|
|
68
75
|
inputActive = false;
|
|
76
|
+
validationMessage;
|
|
77
|
+
setIds = () => {
|
|
78
|
+
this.assistiveTextId = `${this.identifier}-assistive-text`;
|
|
79
|
+
this.visuallyHiddenAssistiveTextId = `${this.identifier}-visually-hidden-assistive-text`;
|
|
80
|
+
this.errorTextId = `${this.identifier}-error-text`;
|
|
81
|
+
this.successTextId = `${this.identifier}-success-text`;
|
|
82
|
+
};
|
|
83
|
+
getValidationMessage = () => this.errorText || this.internals?.validationMessage || this.inputElement?.validationMessage;
|
|
69
84
|
async togglePasswordVisibility() {
|
|
70
85
|
return (this.passwordInputVisible = !this.passwordInputVisible);
|
|
71
86
|
}
|
|
@@ -73,6 +88,7 @@ const DsTextInput = class {
|
|
|
73
88
|
this.inputElement.value = '';
|
|
74
89
|
this.inputElement.focus();
|
|
75
90
|
this.clearButtonVisible = false;
|
|
91
|
+
this.clear.emit({ id: this.identifier });
|
|
76
92
|
}
|
|
77
93
|
getLabelText = () => {
|
|
78
94
|
if (this.required) {
|
|
@@ -84,9 +100,27 @@ const DsTextInput = class {
|
|
|
84
100
|
return this.label;
|
|
85
101
|
};
|
|
86
102
|
componentWillLoad() {
|
|
103
|
+
this.setIds();
|
|
87
104
|
this.hasPrefixSlot = !!this.el.querySelector('[slot="prefix"]');
|
|
88
105
|
this.hasSuffixSlot = !!this.el.querySelector('[slot="suffix"]');
|
|
106
|
+
if (store.isValidation('server') || this.errorText) {
|
|
107
|
+
this.validationMessage = this.getValidationMessage();
|
|
108
|
+
}
|
|
89
109
|
}
|
|
110
|
+
handleInput = (e) => {
|
|
111
|
+
const target = e.target;
|
|
112
|
+
this.clearButtonVisible = !!target.value;
|
|
113
|
+
this.internals?.setFormValue(target.value);
|
|
114
|
+
if (store.isValidation('client') && this.validationMessage) {
|
|
115
|
+
this.validationMessage = this.getValidationMessage();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
handleBlur = () => {
|
|
119
|
+
this.hasFocus = false;
|
|
120
|
+
if (store.isValidation('client')) {
|
|
121
|
+
this.validationMessage = this.getValidationMessage();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
90
124
|
onActionButtonClicked = (e) => {
|
|
91
125
|
e.stopPropagation();
|
|
92
126
|
switch (this.type) {
|
|
@@ -98,13 +132,6 @@ const DsTextInput = class {
|
|
|
98
132
|
return;
|
|
99
133
|
}
|
|
100
134
|
};
|
|
101
|
-
renderValidityMessage(type) {
|
|
102
|
-
const textId = type === 'success' ? this.successTextId : this.errorTextId;
|
|
103
|
-
const text = type === 'success' ? this.successText : this.errorText;
|
|
104
|
-
const icon = type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
105
|
-
const className = type + '-text';
|
|
106
|
-
return (index.h("slot", { name: className }, text && (index.h("div", { class: `${className}--container` }, index.h("ds-icon", { name: icon }), index.h("small", { id: textId, class: className }, text)))));
|
|
107
|
-
}
|
|
108
135
|
renderPrefixContent() {
|
|
109
136
|
if (this.hasPrefixSlot) {
|
|
110
137
|
return index.h("slot", { name: "prefix" });
|
|
@@ -139,19 +166,20 @@ const DsTextInput = class {
|
|
|
139
166
|
}
|
|
140
167
|
render() {
|
|
141
168
|
const inputType = this.type === 'password' && this.passwordInputVisible ? 'text' : this.type;
|
|
142
|
-
return (index.h(index.Fragment, { key: '
|
|
169
|
+
return (index.h(index.Fragment, { key: 'efb783f742bb82b01fd6807a628eb693666a819b' }, index.h("div", { key: 'dde260b136af4b68de1fa15928529f5e57f54c3a', class: "ds-input--label-container" }, index.h("slot", { key: 'e7ba428a8b8202c9b3e4d9a9c6d4257b0b48d83a', name: "label" }, index.h("label", { key: '1f28c5fd53249068de50c6d0ea0aa88ccf65a1ec', htmlFor: this.identifier }, this.getLabelText())), index.h("slot", { key: 'e3c1ea925cfc7f9599ee651da0aeaab98fa806bb', name: "help-text" }, index.h("small", { key: '671ab99029e2775d964feb012beb8a20912be5e3', id: this.assistiveTextId }, this.assistiveText), index.h("ds-visually-hidden", { key: '8eb744be9b95ddceb1dd5bed0274d29a26e7ec1d', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), index.h("div", { key: 'b7fa7067a52d176b810eb88777423adf50dfd8b9', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: index$1.classNames('ds-input--container', {
|
|
143
170
|
disabled: this.disabled,
|
|
144
171
|
readonly: this.readonly,
|
|
145
172
|
valid: !!this.successText,
|
|
146
173
|
invalid: !!this.errorText,
|
|
147
174
|
focus: this.hasFocus,
|
|
148
175
|
active: !!this.inputActive,
|
|
149
|
-
}) }, this.renderPrefixContent(), index.h("input", { key: '
|
|
176
|
+
}) }, this.renderPrefixContent(), index.h("input", { key: 'f619722a0c088fbd99d851b4cc49a220538da0ae', ref: e => (this.inputElement = e), id: this.identifier, name: this.name, "aria-label": utils.getAriaLabel(this.label, this.ariaLabel), "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
|
|
150
177
|
index$1.classNames(this.assistiveTextId, this.visuallyHiddenAssistiveTextId, {
|
|
151
|
-
[this.
|
|
152
|
-
[this.
|
|
153
|
-
}), 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:
|
|
178
|
+
[this.errorTextId]: Boolean(this.validationMessage),
|
|
179
|
+
[this.successTextId]: Boolean(this.successText),
|
|
180
|
+
}), "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()), index.h("slot", { key: 'b70c638ad0de13e0bfa1c2f0ec366e748ab8e4e2', name: "input-validity" }, index.h("ds-input-validity", { key: '7c1da6ba8d42add8de43f4926c24c8a64bbe32e2', id: this.errorTextId, text: this.validationMessage, type: "error", role: "alert" }), index.h("ds-input-validity", { key: '46258021c17e3461ea4a0c2ae720fb44305550c5', id: this.successTextId, text: this.successText, type: "success", role: "status" }))));
|
|
154
181
|
}
|
|
182
|
+
static get formAssociated() { return true; }
|
|
155
183
|
};
|
|
156
184
|
DsTextInput.style = DsTextInputStyle0;
|
|
157
185
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-bf84b124.js');
|
|
6
6
|
|
|
7
7
|
const dsVisuallyHiddenCss = ":host{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}";
|
|
8
8
|
const DsVisuallyHiddenStyle0 = dsVisuallyHiddenCss;
|
|
@@ -12,7 +12,7 @@ const DsVisuallyHidden = class {
|
|
|
12
12
|
index.registerInstance(this, hostRef);
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (index.h("slot", { key: '
|
|
15
|
+
return (index.h("slot", { key: '083eaed9210a85360479b367769c8904a6089f64' }));
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
DsVisuallyHidden.style = DsVisuallyHiddenStyle0;
|
|
@@ -1336,8 +1336,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
1338
|
};
|
|
1339
|
+
var renderingRef = null;
|
|
1339
1340
|
var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
1340
1341
|
try {
|
|
1342
|
+
renderingRef = instance;
|
|
1341
1343
|
instance = instance.render() ;
|
|
1342
1344
|
{
|
|
1343
1345
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
@@ -1355,8 +1357,10 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
1355
1357
|
} catch (e) {
|
|
1356
1358
|
consoleError(e, hostRef.$hostElement$);
|
|
1357
1359
|
}
|
|
1360
|
+
renderingRef = null;
|
|
1358
1361
|
return null;
|
|
1359
1362
|
};
|
|
1363
|
+
var getRenderingRef = () => renderingRef;
|
|
1360
1364
|
var postUpdateComponent = (hostRef) => {
|
|
1361
1365
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1362
1366
|
const elm = hostRef.$hostElement$;
|
|
@@ -1395,6 +1399,16 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1395
1399
|
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1396
1400
|
}
|
|
1397
1401
|
};
|
|
1402
|
+
var forceUpdate = (ref) => {
|
|
1403
|
+
{
|
|
1404
|
+
const hostRef = getHostRef(ref);
|
|
1405
|
+
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1406
|
+
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1407
|
+
scheduleUpdate(hostRef, false);
|
|
1408
|
+
}
|
|
1409
|
+
return isConnected;
|
|
1410
|
+
}
|
|
1411
|
+
};
|
|
1398
1412
|
var appDidLoad = (who) => {
|
|
1399
1413
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
1400
1414
|
};
|
|
@@ -1945,7 +1959,9 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
|
1945
1959
|
exports.Fragment = Fragment;
|
|
1946
1960
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1947
1961
|
exports.createEvent = createEvent;
|
|
1962
|
+
exports.forceUpdate = forceUpdate;
|
|
1948
1963
|
exports.getElement = getElement;
|
|
1964
|
+
exports.getRenderingRef = getRenderingRef;
|
|
1949
1965
|
exports.h = h;
|
|
1950
1966
|
exports.promiseResolve = promiseResolve;
|
|
1951
1967
|
exports.registerInstance = registerInstance;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -11,16 +11,6 @@ const visuallyHiddenAssistiveText = (lang) => {
|
|
|
11
11
|
return 'Opens in a new tab';
|
|
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
|
-
};
|
|
23
14
|
|
|
24
|
-
exports.getAriaLabel = getAriaLabel;
|
|
25
15
|
exports.opensInNewTab = opensInNewTab;
|
|
26
16
|
exports.visuallyHiddenAssistiveText = visuallyHiddenAssistiveText;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-bf84b124.js');
|
|
6
6
|
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
7
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["ds-accordion_3.cjs",[[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-
|
|
11
|
+
return index.bootstrapLazy([["ds-accordion_3.cjs",[[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.cjs",[[0,"ds-input-validity",{"text":[1],"type":[1],"validityRole":[1,"role"],"identifier":[32]}]]],["ds-text-input.cjs",[[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.cjs",[[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.cjs",[[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.cjs",[[1,"ds-visually-hidden"]]],["ds-link.cjs",[[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.cjs",[[1,"ds-link-with-arrow",{"text":[1],"iconPosition":[1,"icon-position"],"href":[1],"target":[1],"language":[1,"lang"],"ariaLabel":[1,"aria-label"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-bf84b124.js');
|
|
4
|
+
|
|
5
|
+
const appendToMap = (map, propName, value) => {
|
|
6
|
+
const items = map.get(propName);
|
|
7
|
+
if (!items) {
|
|
8
|
+
map.set(propName, [value]);
|
|
9
|
+
}
|
|
10
|
+
else if (!items.includes(value)) {
|
|
11
|
+
items.push(value);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const debounce = (fn, ms) => {
|
|
15
|
+
let timeoutId;
|
|
16
|
+
return (...args) => {
|
|
17
|
+
if (timeoutId) {
|
|
18
|
+
clearTimeout(timeoutId);
|
|
19
|
+
}
|
|
20
|
+
timeoutId = setTimeout(() => {
|
|
21
|
+
timeoutId = 0;
|
|
22
|
+
fn(...args);
|
|
23
|
+
}, ms);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if a possible element isConnected.
|
|
29
|
+
* The property might not be there, so we check for it.
|
|
30
|
+
*
|
|
31
|
+
* We want it to return true if isConnected is not a property,
|
|
32
|
+
* otherwise we would remove these elements and would not update.
|
|
33
|
+
*
|
|
34
|
+
* Better leak in Edge than to be useless.
|
|
35
|
+
*/
|
|
36
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
37
|
+
const cleanupElements = debounce((map) => {
|
|
38
|
+
for (let key of map.keys()) {
|
|
39
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
40
|
+
}
|
|
41
|
+
}, 2_000);
|
|
42
|
+
const stencilSubscription = () => {
|
|
43
|
+
if (typeof index.getRenderingRef !== 'function') {
|
|
44
|
+
// If we are not in a stencil project, we do nothing.
|
|
45
|
+
// This function is not really exported by @stencil/core.
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
const elmsToUpdate = new Map();
|
|
49
|
+
return {
|
|
50
|
+
dispose: () => elmsToUpdate.clear(),
|
|
51
|
+
get: (propName) => {
|
|
52
|
+
const elm = index.getRenderingRef();
|
|
53
|
+
if (elm) {
|
|
54
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
set: (propName) => {
|
|
58
|
+
const elements = elmsToUpdate.get(propName);
|
|
59
|
+
if (elements) {
|
|
60
|
+
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
|
61
|
+
}
|
|
62
|
+
cleanupElements(elmsToUpdate);
|
|
63
|
+
},
|
|
64
|
+
reset: () => {
|
|
65
|
+
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
|
66
|
+
cleanupElements(elmsToUpdate);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
72
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
73
|
+
const unwrappedState = unwrap(defaultState);
|
|
74
|
+
let states = new Map(Object.entries(unwrappedState ?? {}));
|
|
75
|
+
const handlers = {
|
|
76
|
+
dispose: [],
|
|
77
|
+
get: [],
|
|
78
|
+
set: [],
|
|
79
|
+
reset: [],
|
|
80
|
+
};
|
|
81
|
+
const reset = () => {
|
|
82
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
83
|
+
// otherwise, the state won't be properly reset
|
|
84
|
+
states = new Map(Object.entries(unwrap(defaultState) ?? {}));
|
|
85
|
+
handlers.reset.forEach((cb) => cb());
|
|
86
|
+
};
|
|
87
|
+
const dispose = () => {
|
|
88
|
+
// Call first dispose as resetting the state would
|
|
89
|
+
// cause less updates ;)
|
|
90
|
+
handlers.dispose.forEach((cb) => cb());
|
|
91
|
+
reset();
|
|
92
|
+
};
|
|
93
|
+
const get = (propName) => {
|
|
94
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
95
|
+
return states.get(propName);
|
|
96
|
+
};
|
|
97
|
+
const set = (propName, value) => {
|
|
98
|
+
const oldValue = states.get(propName);
|
|
99
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
100
|
+
states.set(propName, value);
|
|
101
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const state = (typeof Proxy === 'undefined'
|
|
105
|
+
? {}
|
|
106
|
+
: new Proxy(unwrappedState, {
|
|
107
|
+
get(_, propName) {
|
|
108
|
+
return get(propName);
|
|
109
|
+
},
|
|
110
|
+
ownKeys(_) {
|
|
111
|
+
return Array.from(states.keys());
|
|
112
|
+
},
|
|
113
|
+
getOwnPropertyDescriptor() {
|
|
114
|
+
return {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
has(_, propName) {
|
|
120
|
+
return states.has(propName);
|
|
121
|
+
},
|
|
122
|
+
set(_, propName, value) {
|
|
123
|
+
set(propName, value);
|
|
124
|
+
return true;
|
|
125
|
+
},
|
|
126
|
+
}));
|
|
127
|
+
const on = (eventName, callback) => {
|
|
128
|
+
handlers[eventName].push(callback);
|
|
129
|
+
return () => {
|
|
130
|
+
removeFromArray(handlers[eventName], callback);
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const onChange = (propName, cb) => {
|
|
134
|
+
const unSet = on('set', (key, newValue) => {
|
|
135
|
+
if (key === propName) {
|
|
136
|
+
cb(newValue);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
140
|
+
// Otherwise we might not be sending the right reset value.
|
|
141
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
142
|
+
return () => {
|
|
143
|
+
unSet();
|
|
144
|
+
unReset();
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const use = (...subscriptions) => {
|
|
148
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
149
|
+
if (subscription.set) {
|
|
150
|
+
unsubs.push(on('set', subscription.set));
|
|
151
|
+
}
|
|
152
|
+
if (subscription.get) {
|
|
153
|
+
unsubs.push(on('get', subscription.get));
|
|
154
|
+
}
|
|
155
|
+
if (subscription.reset) {
|
|
156
|
+
unsubs.push(on('reset', subscription.reset));
|
|
157
|
+
}
|
|
158
|
+
if (subscription.dispose) {
|
|
159
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
160
|
+
}
|
|
161
|
+
return unsubs;
|
|
162
|
+
}, []);
|
|
163
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
164
|
+
};
|
|
165
|
+
const forceUpdate = (key) => {
|
|
166
|
+
const oldValue = states.get(key);
|
|
167
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
state,
|
|
171
|
+
get,
|
|
172
|
+
set,
|
|
173
|
+
on,
|
|
174
|
+
onChange,
|
|
175
|
+
use,
|
|
176
|
+
dispose,
|
|
177
|
+
reset,
|
|
178
|
+
forceUpdate,
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
const removeFromArray = (array, item) => {
|
|
182
|
+
const index = array.indexOf(item);
|
|
183
|
+
if (index >= 0) {
|
|
184
|
+
array[index] = array[array.length - 1];
|
|
185
|
+
array.length--;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
190
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
191
|
+
map.use(stencilSubscription());
|
|
192
|
+
return map;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const initialState = {
|
|
196
|
+
validation: 'client',
|
|
197
|
+
};
|
|
198
|
+
const { state, set } = createStore({
|
|
199
|
+
...initialState,
|
|
200
|
+
});
|
|
201
|
+
const isValidation = (validation) => state.validation === validation;
|
|
202
|
+
const configure = ({ validation }) => {
|
|
203
|
+
set('validation', validation || initialState.validation);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
exports.configure = configure;
|
|
207
|
+
exports.isValidation = isValidation;
|
|
@@ -13,6 +13,16 @@ function* idGenerator(id) {
|
|
|
13
13
|
yield `${id}-${currentId++}`;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
const getAriaLabel = (text, ariaLabel) => {
|
|
17
|
+
if (!ariaLabel) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
if (ariaLabel.startsWith(text)) {
|
|
21
|
+
return ariaLabel;
|
|
22
|
+
}
|
|
23
|
+
return [text, ariaLabel].join(' ');
|
|
24
|
+
};
|
|
16
25
|
|
|
26
|
+
exports.getAriaLabel = getAriaLabel;
|
|
17
27
|
exports.idGenerator = idGenerator;
|
|
18
28
|
exports.remToPx = remToPx;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"entries": [
|
|
3
3
|
"components/01-base-components/ds-checkbox/ds-checkbox.js",
|
|
4
4
|
"components/01-base-components/ds-checkbox-group/ds-checkbox-group.js",
|
|
5
|
+
"components/01-base-components/ds-text-input/ds-text-input.js",
|
|
5
6
|
"components/01-base-components/ds-accordion/ds-accordion.js",
|
|
6
7
|
"components/01-base-components/ds-button/ds-button.js",
|
|
7
8
|
"components/01-base-components/ds-icon/ds-icon.js",
|
|
8
9
|
"components/01-base-components/ds-input-validity/ds-input-validity.js",
|
|
9
10
|
"components/01-base-components/ds-link/ds-link.js",
|
|
10
11
|
"components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js",
|
|
11
|
-
"components/01-base-components/ds-text-input/ds-text-input.js",
|
|
12
12
|
"components/01-base-components/ds-visually-hidden/ds-visually-hidden.js"
|
|
13
13
|
],
|
|
14
14
|
"compiler": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -43,18 +43,18 @@ export class DsAccordion {
|
|
|
43
43
|
render() {
|
|
44
44
|
const iconSize = this.variant === 'compact' ? '1.5rem' : '2rem';
|
|
45
45
|
const buttonSize = this.variant === 'compact' ? 'small' : 'medium';
|
|
46
|
-
return (h("div", { key: '
|
|
46
|
+
return (h("div", { key: 'aeaa883c8500bda65c480ccea434cbeadc53ce69', class: classNames('ds-accordion', `ds-accordion--${this.variant}`, {
|
|
47
47
|
'ds-accordion--border-aligned': this.borderAligned
|
|
48
|
-
}), role: "presentation" }, h("div", { key: '
|
|
48
|
+
}), role: "presentation" }, h("div", { key: 'a7947fd7784084bcec3a02f2219fa2494366d590', class: "ds-accordion__item" }, h("div", { key: '20532a2d3f109e38341d496ffee0d2d02cfb26f4', role: "heading", "aria-level": this.headingLevel, class: "ds-accordion__title" }, h("button", { key: '40513d75b15c4701498b83c9a6afbcd7a322c73c', class: classNames('ds-accordion__open-button', `ds-accordion--${this.variant}`, {
|
|
49
49
|
'ds-accordion--border-aligned': this.borderAligned,
|
|
50
50
|
'ds-accordion--hide-top-border': this.hideTopBorder
|
|
51
|
-
}), onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-expanded": this.isExpanded ? 'true' : 'false', "aria-controls": `${this.accordionId}-panel`, id: this.accordionId, ref: (el) => this.headerButtonRef = el }, h("span", { key: '
|
|
51
|
+
}), onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-expanded": this.isExpanded ? 'true' : 'false', "aria-controls": `${this.accordionId}-panel`, id: this.accordionId, ref: (el) => this.headerButtonRef = el }, h("span", { key: '883d1cbf50b3cfb0beacd62570a1077aa8bd7a04', class: "ds-accordion__icon", "aria-hidden": "true" }, this.isExpanded ?
|
|
52
52
|
h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_up" })
|
|
53
|
-
: h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_down" })), h("slot", { key: '
|
|
53
|
+
: h("ds-icon", { size: iconSize, hidden: true, name: "keyboard_arrow_down" })), h("slot", { key: 'a8ddede4cec5ab873fb69ab9963e7f143613fe0f', name: "header" }))), h("div", { key: '76cf35006795136597efd9c424237ac1c48bbc74', id: `${this.accordionId}-panel`, role: "region", "aria-labelledby": this.accordionId, class: classNames('ds-accordion__panel', `ds-accordion__panel--${this.variant}`, {
|
|
54
54
|
'ds-accordion__panel--border-aligned': this.borderAligned,
|
|
55
55
|
'ds-accordion__panel--expanded': this.isExpanded
|
|
56
|
-
}), hidden: !this.isExpanded }, h("div", { key: '
|
|
57
|
-
h("ds-button", { key: '
|
|
56
|
+
}), hidden: !this.isExpanded }, h("div", { key: '6236db88bc5735ec4e5618a63e303d997335e1be', class: "ds-accordion__content" }, h("slot", { key: '4d206253394878b4fba531cea6870aaaa3e63821', name: "content" })), this.useCloseButton &&
|
|
57
|
+
h("ds-button", { key: 'e5c0f76a802e6046f2872509a4944b72aa376bf1', "aria-labelledby": `${this.accordionId}-close-button ${this.accordionId}`, id: `${this.accordionId}-close-button`, class: classNames('ds-accordion__close-button', `ds-accordion--${this.variant}`, {
|
|
58
58
|
'ds-accordion--border-aligned': this.borderAligned
|
|
59
59
|
}), fontWeight: 'semiBold', variant: 'supplementary', colour: 'black', icon: 'keyboard_arrow_up', iconPosition: 'start', onClick: this.handleClick, onKeyDown: this.handleKeyDown, value: this.closeButtonLabel, size: buttonSize, type: 'button' })))));
|
|
60
60
|
}
|
|
@@ -65,7 +65,7 @@ export class DsButton {
|
|
|
65
65
|
});
|
|
66
66
|
const iconSize = this.size === 'small' ? '1rem' : undefined;
|
|
67
67
|
const isDisabled = this.disabled || this.ariaDisabled === 'true';
|
|
68
|
-
return (h("button", { key: '
|
|
68
|
+
return (h("button", { key: '50633fbf3df7aeb84c2631dd7b8eb7a1f83cbc29', ref: el => (this.buttonEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, class: classes, style: { fontWeight: this.fontWeight }, type: this.type, "aria-disabled": isDisabled ? 'true' : 'false', ...this.inheritedAttributes }, h("slot", { key: 'aea86ce3195d3fa5344dfbf2048bc4db7882286b', name: "prefix" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '38b833cbc1585a7cf0918dec9b2b2a0f62cc6fe2', name: this.icon, size: iconSize })), this.value && h("span", { key: '430bd3e7e54558706bcd8b2cc9fda5d0cc04667c', class: "button-value" }, this.value), h("slot", { key: '9c3d1b19e8c96afb9a6bc380fcd0dd04d9ed411e', name: "suffix" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'dcb2076975dd8648db795c3629cc12c79d4e7d70', name: this.icon, size: iconSize }))));
|
|
69
69
|
}
|
|
70
70
|
static get is() { return "ds-button"; }
|
|
71
71
|
static get encapsulation() { return "scoped"; }
|