@uh-design-system/component-library 0.5.2 → 0.5.3
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/{controlUtils-041de0fd.js → controlUtils-8bf55ef0.js} +1 -1
- package/dist/cjs/{ds-accordion_3.cjs.entry.js → ds-accordion_5.cjs.entry.js} +115 -20
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +37 -27
- package/dist/cjs/ds-checkbox.cjs.entry.js +28 -25
- package/dist/cjs/ds-input-validity.cjs.entry.js +4 -4
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +3 -3
- package/dist/cjs/ds-link.cjs.entry.js +3 -3
- package/dist/cjs/ds-radio-button-group.cjs.entry.js +111 -0
- package/dist/cjs/ds-radio-button.cjs.entry.js +150 -0
- package/dist/cjs/ds-text-input.cjs.entry.js +8 -7
- package/dist/cjs/{index-bf84b124.js → index-947af833.js} +36 -4
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{store-9bd20f3c.js → store-e8e87298.js} +1 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +12 -12
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +11 -13
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +98 -87
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +89 -4
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +66 -0
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +3 -0
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +28 -21
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +26 -45
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +52 -26
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +74 -18
- 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.css +2 -2
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +1 -1
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +12 -12
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +1 -1
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +10 -10
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +1 -1
- package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.css +116 -0
- package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.js +468 -0
- package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.js +70 -0
- package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.js +36 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.css +31 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.js +287 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.js +51 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.js +58 -0
- package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.js +59 -0
- package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.css +309 -0
- package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.js +221 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.js +122 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.js +107 -0
- package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.stories.js +59 -0
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +38 -38
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +4 -3
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/utils/button/buttonUtils.js +14 -0
- package/dist/collection/utils/colours/colourTypes.js +3 -3
- package/dist/collection/utils/colours/colourUtils.js +5 -3
- package/dist/collection/utils/controls/controlUtils.js +1 -1
- package/dist/collection/utils/spinner/spinnerUtils.js +20 -0
- package/dist/collection/utils/tests/testUtils.js +1 -0
- package/dist/collection/utils/typography/typographyUtils.js +3 -3
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/controlUtils-c2ba44bd.js +1 -0
- package/dist/component-library/ds-accordion_5.entry.js +1 -0
- package/dist/component-library/ds-checkbox-group.entry.js +1 -1
- package/dist/component-library/ds-checkbox.entry.js +1 -1
- package/dist/component-library/ds-input-validity.entry.js +1 -1
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-radio-button-group.entry.js +1 -0
- package/dist/component-library/ds-radio-button.entry.js +1 -0
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/index-84fd0ee9.js +2 -0
- package/dist/component-library/index.esm.js +1 -1
- package/dist/component-library/{store-b8d17c10.js → store-73a56075.js} +1 -1
- package/dist/components/controlUtils.js +1 -1
- package/dist/components/ds-accordion.js +28 -18
- package/dist/components/ds-button2.js +48 -7
- package/dist/components/ds-checkbox-group.js +38 -27
- package/dist/components/ds-checkbox2.js +28 -24
- package/dist/components/ds-icon2.js +1 -1
- package/dist/components/ds-input-validity2.js +2 -2
- package/dist/components/ds-link-with-arrow.js +2 -2
- package/dist/components/ds-link.js +2 -2
- package/dist/components/ds-radio-button-group.d.ts +11 -0
- package/dist/components/ds-radio-button-group.js +147 -0
- package/dist/components/ds-radio-button.d.ts +11 -0
- package/dist/components/ds-radio-button.js +196 -0
- package/dist/components/ds-spinner.d.ts +11 -0
- package/dist/components/ds-spinner.js +6 -0
- package/dist/components/ds-spinner2.js +90 -0
- package/dist/components/ds-text-input.js +17 -10
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index2.js +36 -5
- package/dist/esm/component-library.js +3 -3
- package/dist/esm/controlUtils-c2ba44bd.js +4 -0
- package/dist/esm/{ds-accordion_3.entry.js → ds-accordion_5.entry.js} +114 -21
- package/dist/esm/ds-checkbox-group.entry.js +37 -27
- package/dist/esm/ds-checkbox.entry.js +28 -25
- package/dist/esm/ds-input-validity.entry.js +4 -4
- package/dist/esm/ds-link-with-arrow.entry.js +3 -3
- package/dist/esm/ds-link.entry.js +3 -3
- package/dist/esm/ds-radio-button-group.entry.js +107 -0
- package/dist/esm/ds-radio-button.entry.js +146 -0
- package/dist/esm/ds-text-input.entry.js +8 -7
- package/dist/esm/{index-434995e1.js → index-84fd0ee9.js} +36 -5
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{store-b8d17c10.js → store-73a56075.js} +1 -1
- package/dist/styles/helpers.css +7 -0
- package/dist/styles/helpers.css.map +1 -0
- package/dist/styles/mixins/_breakpoints.scss +14 -0
- package/dist/styles/mixins/_focus.scss +28 -0
- package/dist/styles/mixins/_wrapper.scss +5 -0
- package/dist/styles/mixins/imports-default/_imports.scss +2 -0
- package/dist/styles/mixins/tokens/_breakpoints.scss +13 -0
- package/dist/styles/mixins/tokens/_semantic-colours.scss +75 -0
- package/dist/styles/mixins.scss +10 -0
- package/dist/styles/variables.css +168 -0
- package/dist/styles/variables.css.map +1 -0
- package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +5 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +6 -10
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +5 -4
- package/dist/types/components/01-base-components/ds-radio-button/ds-radio-button.d.ts +44 -0
- package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.d.ts +15 -0
- package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/ds-radio-button-group.d.ts +24 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.d.ts +6 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.d.ts +10 -0
- package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/ds-spinner.d.ts +17 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-spinner/stories/ds-spinner.stories.d.ts +7 -0
- package/dist/types/components.d.ts +133 -18
- package/dist/types/utils/button/buttonUtils.d.ts +1 -0
- package/dist/types/utils/colours/colourTypes.d.ts +3 -3
- package/dist/types/utils/spinner/spinnerUtils.d.ts +1 -0
- package/dist/types/utils/tests/testUtils.d.ts +1 -0
- package/package.json +15 -15
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +0 -20
- package/dist/component-library/controlUtils-9ca4087b.js +0 -1
- package/dist/component-library/ds-accordion_3.entry.js +0 -1
- package/dist/component-library/ds-visually-hidden.entry.js +0 -1
- package/dist/component-library/index-434995e1.js +0 -2
- package/dist/esm/controlUtils-9ca4087b.js +0 -4
- package/dist/esm/ds-visually-hidden.entry.js +0 -16
|
@@ -5,7 +5,7 @@ import { i as idGenerator, d as defineCustomElement$3 } from './ds-icon2.js';
|
|
|
5
5
|
import { d as defineCustomElement$4 } from './ds-checkbox2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './ds-input-validity2.js';
|
|
7
7
|
|
|
8
|
-
const dsCheckboxGroupCss = ".ds-checkbox-group{display:inline-flex;flex-direction:column;border:none;padding:0;margin:0}.ds-checkbox-group__legend{padding-inline:0;font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}.ds-checkbox-group__assistive-text{font-size:var(--ds-fontSize-14);color:var(--ds-
|
|
8
|
+
const dsCheckboxGroupCss = ".ds-checkbox-group{display:inline-flex;flex-direction:column;border:none;padding:0;margin:0}.ds-checkbox-group__legend{padding-inline:0;font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}.ds-checkbox-group__assistive-text{font-size:var(--ds-fontSize-14);color:var(--ds-palette-black-70);line-height:var(--ds-lineHeight-large);margin-bottom:var(--ds-spacing-2xSmall)}.ds-checkbox-group__error{display:flex}.ds-checkbox-group__error--visible{padding-top:var(--ds-spacing-3xSmall)}.ds-checkbox-group>.ds-checkbox-group__checkboxes{display:inline-flex;flex-direction:column}.ds-checkbox-group--inset{margin-left:var(--ds-spacing-large)}.ds-checkbox-group--horizontal>.ds-checkbox-group__checkboxes{flex-direction:row;gap:var(--ds-spacing-small);flex-wrap:wrap}";
|
|
9
9
|
const DsCheckboxGroupStyle0 = dsCheckboxGroupCss;
|
|
10
10
|
|
|
11
11
|
const fieldsetIdGenerator = idGenerator('ds-checkbox-group');
|
|
@@ -16,7 +16,9 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
16
16
|
this.__attachShadow();
|
|
17
17
|
this.dsCheckboxGroupChange = createEvent(this, "dsCheckboxGroupChange", 7);
|
|
18
18
|
this.dsCheckboxGroupIndeterminateChildChange = createEvent(this, "dsCheckboxGroupIndeterminateChildChange", 7);
|
|
19
|
+
this.dsCheckboxGroupInvalidStateChange = createEvent(this, "dsCheckboxGroupInvalidStateChange", 7);
|
|
19
20
|
}
|
|
21
|
+
checkboxElem;
|
|
20
22
|
fieldsetId = fieldsetIdGenerator.next().value;
|
|
21
23
|
checkboxId = `${this.fieldsetId}-checkbox`;
|
|
22
24
|
errorTextId = `${this.fieldsetId}-error`;
|
|
@@ -26,6 +28,7 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
26
28
|
get el() { return this; }
|
|
27
29
|
dsCheckboxGroupChange;
|
|
28
30
|
dsCheckboxGroupIndeterminateChildChange;
|
|
31
|
+
dsCheckboxGroupInvalidStateChange;
|
|
29
32
|
legend;
|
|
30
33
|
assistiveText;
|
|
31
34
|
direction = 'vertical';
|
|
@@ -33,7 +36,7 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
33
36
|
text = '';
|
|
34
37
|
checked = false;
|
|
35
38
|
disabled = false;
|
|
36
|
-
childElementsCount =
|
|
39
|
+
childElementsCount = 1;
|
|
37
40
|
checkedChildElementCount = 0;
|
|
38
41
|
isIndeterminate = false;
|
|
39
42
|
indeterminateChildCheckboxCount = 0;
|
|
@@ -79,55 +82,61 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
79
82
|
watchIndeterminateChange(newValue) {
|
|
80
83
|
this.dsCheckboxGroupIndeterminateChildChange.emit({ id: this.fieldsetId, indeterminate: newValue });
|
|
81
84
|
}
|
|
85
|
+
errorTextObserver(errorText) {
|
|
86
|
+
this.dsCheckboxGroupInvalidStateChange.emit(!!errorText);
|
|
87
|
+
}
|
|
82
88
|
listenIndeterminateChildChange(event) {
|
|
83
89
|
this.indeterminateChildCheckboxCount = event.detail.indeterminate ? this.indeterminateChildCheckboxCount + 1 : this.indeterminateChildCheckboxCount - 1;
|
|
84
90
|
}
|
|
85
|
-
watchCheckedChildElementCountChange(
|
|
86
|
-
this.isIndeterminate =
|
|
87
|
-
this.checkedChildElementCount !== this.childElementsCount && this.checkedChildElementCount < this.childElementsCount && this.checkedChildElementCount > 0;
|
|
88
|
-
if (newValue === this.childElementsCount && newValue > oldValue) {
|
|
89
|
-
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: true });
|
|
90
|
-
}
|
|
91
|
-
else if (oldValue === this.childElementsCount && newValue < oldValue) {
|
|
92
|
-
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: false });
|
|
93
|
-
}
|
|
91
|
+
watchCheckedChildElementCountChange() {
|
|
92
|
+
this.isIndeterminate = this.checkedChildElementCount > 0 && this.checkedChildElementCount < this.childElementsCount;
|
|
94
93
|
}
|
|
95
|
-
updateCheckedChildElementCount = (
|
|
96
|
-
if (
|
|
97
|
-
this.checkedChildElementCount =
|
|
94
|
+
updateCheckedChildElementCount = (checked) => {
|
|
95
|
+
if (checked) {
|
|
96
|
+
this.checkedChildElementCount = Math.min(this.childElementsCount, this.checkedChildElementCount + 1);
|
|
98
97
|
}
|
|
99
98
|
else {
|
|
100
|
-
this.checkedChildElementCount =
|
|
99
|
+
this.checkedChildElementCount = Math.max(0, this.checkedChildElementCount - 1);
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
102
|
listenCheckboxChange(event) {
|
|
104
|
-
if (event.
|
|
105
|
-
this.updateChildElementsChecked(
|
|
103
|
+
if (event.target === this.el) {
|
|
104
|
+
this.updateChildElementsChecked(this.checkboxElem.checked);
|
|
105
|
+
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: this.checkboxElem.checked });
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const target = event.target;
|
|
109
|
+
if (this.getChildCheckboxElements().includes(target)) {
|
|
110
|
+
const previousCheckedChildElementCount = this.checkedChildElementCount;
|
|
111
|
+
this.updateCheckedChildElementCount(target.checked);
|
|
112
|
+
if (this.checkedChildElementCount === this.childElementsCount && this.checkedChildElementCount > previousCheckedChildElementCount) {
|
|
113
|
+
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: true });
|
|
114
|
+
}
|
|
115
|
+
else if (previousCheckedChildElementCount === this.childElementsCount && this.checkedChildElementCount < previousCheckedChildElementCount) {
|
|
116
|
+
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: false });
|
|
117
|
+
}
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
listenCheckboxGroupChange(event) {
|
|
113
121
|
if (this.getChildElements().includes(event.target)) {
|
|
114
|
-
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
this.updateCheckedChildElementCount(event.detail.checked);
|
|
115
124
|
}
|
|
116
125
|
}
|
|
117
|
-
setChildElementCount = () => {
|
|
118
|
-
this.childElementsCount = this.getChildElements().length;
|
|
119
|
-
};
|
|
120
126
|
componentWillLoad() {
|
|
121
127
|
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-labelledby']);
|
|
122
128
|
}
|
|
123
129
|
componentDidLoad() {
|
|
124
|
-
this.
|
|
130
|
+
this.childElementsCount = this.getChildElements().length;
|
|
125
131
|
this.updateChildCheckboxes(element => {
|
|
126
132
|
element.setAttribute('data-errors-disabled', 'true');
|
|
127
133
|
});
|
|
128
134
|
}
|
|
129
135
|
componentDidUpdate() {
|
|
130
|
-
this.
|
|
136
|
+
const childElementCount = this.getChildElements().length;
|
|
137
|
+
if (this.childElementsCount !== childElementCount) {
|
|
138
|
+
this.childElementsCount = childElementCount;
|
|
139
|
+
}
|
|
131
140
|
}
|
|
132
141
|
render() {
|
|
133
142
|
const classes = classNames('ds-checkbox-group', {
|
|
@@ -141,12 +150,13 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
141
150
|
const nestedClasses = classNames('ds-checkbox-group', 'ds-checkbox-group--inset');
|
|
142
151
|
const checkboxesClasses = classNames('ds-checkbox-group__checkboxes');
|
|
143
152
|
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
144
|
-
return (h("fieldset", { key: '
|
|
153
|
+
return (h("fieldset", { key: '25b932a80cf1b2c7467ef5ea012661992cb88853', id: this.fieldsetId, class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, this.legend && h("legend", { key: 'e96b23987622f5df0144a9499122f7afba552648', class: legendClasses }, this.legend), this.assistiveText && (h("small", { key: 'ae3fb6f287dd518ad911391054f6ed4de7e8ea6f', class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.text ? (h(Fragment, null, h("ds-checkbox", { ref: checkboxElem => (this.checkboxElem = checkboxElem), id: this.checkboxId, text: this.text, checked: this.checkedChildElementCount === this.childElementsCount, disabled: this.disabled, indeterminate: this.indeterminateChildCheckboxCount > 0 || this.isIndeterminate }), h("fieldset", { id: this.nestedId, "aria-labelledby": this.checkboxId, class: nestedClasses }, h("slot", null)))) : (h("div", { class: checkboxesClasses }, h("slot", null))), h("div", { key: 'd2719bdb242a526af73e628d2ce7bca234c94961', class: errorClasses }, h("ds-input-validity", { key: 'a31a78918c1894bd8f68207c3ea3f9df984bd52b', id: this.errorTextId, text: this.errorText, type: "error" }))));
|
|
145
154
|
}
|
|
146
155
|
static get watchers() { return {
|
|
147
156
|
"disabled": ["watchCheckboxDisabledChange"],
|
|
148
157
|
"checked": ["watchCheckedChange"],
|
|
149
158
|
"isIndeterminate": ["watchIndeterminateChange"],
|
|
159
|
+
"errorText": ["errorTextObserver"],
|
|
150
160
|
"checkedChildElementCount": ["watchCheckedChildElementCountChange"]
|
|
151
161
|
}; }
|
|
152
162
|
static get style() { return DsCheckboxGroupStyle0; }
|
|
@@ -163,10 +173,11 @@ const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
|
163
173
|
"isIndeterminate": [32],
|
|
164
174
|
"indeterminateChildCheckboxCount": [32],
|
|
165
175
|
"setChecked": [64]
|
|
166
|
-
}, [[0, "dsCheckboxGroupIndeterminateChildChange", "listenIndeterminateChildChange"], [0, "
|
|
176
|
+
}, [[0, "dsCheckboxGroupIndeterminateChildChange", "listenIndeterminateChildChange"], [0, "input", "listenCheckboxChange"], [0, "dsCheckboxGroupChange", "listenCheckboxGroupChange"]], {
|
|
167
177
|
"disabled": ["watchCheckboxDisabledChange"],
|
|
168
178
|
"checked": ["watchCheckedChange"],
|
|
169
179
|
"isIndeterminate": ["watchIndeterminateChange"],
|
|
180
|
+
"errorText": ["errorTextObserver"],
|
|
170
181
|
"checkedChildElementCount": ["watchCheckedChildElementCountChange"]
|
|
171
182
|
}]);
|
|
172
183
|
function defineCustomElement$1() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H,
|
|
1
|
+
import { p as proxyCustomElement, H, h, F as Fragment } from './index2.js';
|
|
2
2
|
import { c as classNames } from './index3.js';
|
|
3
3
|
import { i as inheritAriaAttributes, b as inheritAttributes } from './attributes.js';
|
|
4
4
|
import { g as getRequiredText, a as getOptionalText } from './controlUtils.js';
|
|
@@ -6,7 +6,7 @@ import { i as isValidation } from './store.js';
|
|
|
6
6
|
import { g as getAriaLabel, i as idGenerator, d as defineCustomElement$2 } from './ds-icon2.js';
|
|
7
7
|
import { d as defineCustomElement$1 } from './ds-input-validity2.js';
|
|
8
8
|
|
|
9
|
-
const dsCheckboxCss = ".ds-checkbox-fieldset{display:inline-flex;flex-direction:column;border:none;padding:0;margin:0;gap:var(--ds-spacing-3xSmall)}.ds-checkbox-fieldset__legend{padding-inline:0;font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}.ds-checkbox-fieldset__assistive-text{display:inline;font-size:var(--ds-fontSize-14);color:var(--ds-
|
|
9
|
+
const dsCheckboxCss = ":root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.ds-checkbox-fieldset{display:inline-flex;flex-direction:column;border:none;padding:0;margin:0;gap:var(--ds-spacing-3xSmall)}.ds-checkbox-fieldset__legend{padding-inline:0;font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}.ds-checkbox-fieldset__assistive-text{display:inline;font-size:var(--ds-fontSize-14);color:var(--ds-palette-black-70);line-height:var(--ds-lineHeight-large)}.ds-checkbox{display:inline-flex;align-self:flex-start;align-items:flex-start;flex-direction:row;flex-wrap:nowrap;text-wrap:wrap;word-wrap:break-word;white-space:normal;position:relative;cursor:pointer;user-select:none;width:auto;padding:var(--ds-spacing-xSmall)}.ds-checkbox--no-margin .ds-checkbox__input{margin-right:0}.ds-checkbox--disabled{color:var(--ds-palette-black-40)}.ds-checkbox__span--optional{color:var(--ds-palette-black-70);font-size:var(--ds-fontSize-14)}.ds-checkbox:has(.ds-checkbox__input:disabled){cursor:not-allowed}.ds-checkbox__input{cursor:pointer;-webkit-appearance:none;appearance:none;background-color:var(--ds-palette-white);margin:0;display:grid;place-content:center;height:24px;width:24px;flex-shrink:0;margin-right:var(--ds-spacing-xSmall);border-width:var(--ds-borderWidth-thin);border-style:solid;border-color:var(--ds-palette-black-50);}.ds-checkbox__input:focus-visible{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-palette-white);outline-color:var(--ds-palette-black-95);outline-offset:calc(var(--ds-borderWidth-thin) * 1);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-checkbox__input:hover,.ds-checkbox__input:active{border-color:var(--ds-palette-black-50)}.ds-checkbox__input:hover{background-color:var(--ds-palette-black-10)}.ds-checkbox__input:active{background-color:var(--ds-palette-black-20)}.ds-checkbox__input:disabled{background-color:var(--ds-overlay-black-10);border-color:var(--ds-overlay-black-15)}@media (forced-colors: active){.ds-checkbox__input:disabled{border-color:GrayText}}.ds-checkbox__input:checked,.ds-checkbox__input:indeterminate{background-color:var(--ds-palette-mainBlue-70);border-color:var(--ds-overlay-black-00)}.ds-checkbox__input:checked:hover,.ds-checkbox__input:indeterminate:hover{background-color:var(--ds-palette-mainBlue-80)}.ds-checkbox__input:checked:active,.ds-checkbox__input:indeterminate:active{background-color:var(--ds-palette-mainBlue-90)}.ds-checkbox__input:checked:disabled,.ds-checkbox__input:indeterminate:disabled{background-color:var(--ds-overlay-black-10)}.ds-checkbox__input:user-invalid,.ds-checkbox__input--invalid,.ds-checkbox__input--invalid:checked,.ds-checkbox__input--invalid:indeterminate{border-color:var(--ds-palette-red-50)}.ds-checkbox__input:disabled{cursor:not-allowed;color:var(--ds-palette-black-40)}.ds-checkbox__input::before{content:\"\";display:block;height:1em;width:1em;background-size:contain;background-repeat:no-repeat;background-position:center}.ds-checkbox__input:checked::before{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg width='16' height='13' viewBox='0 0 16 13' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M5.99997 7.87871L13.606 0.272705L15.7273 2.39403L5.99997 12.1214L0.272644 6.39402L2.39396 4.27271L5.99997 7.87871Z' fill='%23ffffff' /></svg>\")}.ds-checkbox__input:checked:disabled::before{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg width='16' height='13' viewBox='0 0 16 13' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M5.99997 7.87871L13.606 0.272705L15.7273 2.39403L5.99997 12.1214L0.272644 6.39402L2.39396 4.27271L5.99997 7.87871Z' fill='%23999999' /></svg>\")}.ds-checkbox__input:indeterminate::before{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg width='14' height='4' viewBox='0 0 14 4' xmlns='http://www.w3.org/2000/svg'><rect width='13.3333' height='3' transform='matrix(1 0 0 -1 0.333313 3.5)' fill='%23ffffff' /></svg>\")}.ds-checkbox__input:indeterminate:disabled::before{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg width='14' height='4' viewBox='0 0 14 4' xmlns='http://www.w3.org/2000/svg'><rect width='13.3333' height='3' transform='matrix(1 0 0 -1 0.333313 3.5)' fill='%23999999' /></svg>\")}.ds-checkbox-error{display:flex}.ds-checkbox-error--visible{padding-top:var(--ds-spacing-3xSmall);padding-left:var(--ds-spacing-xSmall)}";
|
|
10
10
|
const DsCheckboxStyle0 = dsCheckboxCss;
|
|
11
11
|
|
|
12
12
|
const checkboxIdGenerator = idGenerator('ds-checkbox');
|
|
@@ -15,19 +15,17 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
15
15
|
super();
|
|
16
16
|
this.__registerHost();
|
|
17
17
|
this.__attachShadow();
|
|
18
|
-
this.dsCheckboxInput = createEvent(this, "dsCheckboxInput", 7);
|
|
19
18
|
this.internals = this.attachInternals();
|
|
20
19
|
}
|
|
20
|
+
checkboxGroup = null;
|
|
21
21
|
inputElem;
|
|
22
22
|
labelId;
|
|
23
23
|
inputValidityId;
|
|
24
24
|
assistiveTextId;
|
|
25
25
|
inheritedAttributes = {};
|
|
26
|
-
initialChecked;
|
|
27
26
|
labelClicked = false;
|
|
28
27
|
get el() { return this; }
|
|
29
28
|
internals;
|
|
30
|
-
dsCheckboxInput;
|
|
31
29
|
identifier = checkboxIdGenerator.next().value;
|
|
32
30
|
checked = false;
|
|
33
31
|
legend;
|
|
@@ -41,7 +39,8 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
41
39
|
optional = false;
|
|
42
40
|
optionalText;
|
|
43
41
|
ariaLabel;
|
|
44
|
-
|
|
42
|
+
invalid = !!this.errorText;
|
|
43
|
+
initialChecked = this.checked;
|
|
45
44
|
validationMessage;
|
|
46
45
|
setIds = () => {
|
|
47
46
|
this.labelId = `${this.identifier}-label`;
|
|
@@ -71,22 +70,28 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
71
70
|
return this.text;
|
|
72
71
|
};
|
|
73
72
|
getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getValidationMessage()) && this.inputValidityId].filter(Boolean).join(' ');
|
|
74
|
-
|
|
73
|
+
formResetCallback() {
|
|
75
74
|
this.checked = this.initialChecked;
|
|
76
|
-
this.value = this.checked.toString();
|
|
77
75
|
this.internals?.setValidity({});
|
|
78
|
-
this.internals?.setFormValue(this.
|
|
79
|
-
};
|
|
80
|
-
setInitialState = () => {
|
|
81
|
-
this.initialChecked = this.checked;
|
|
82
|
-
this.value = this.checked.toString();
|
|
83
|
-
this.internals?.setFormValue(this.value);
|
|
84
|
-
};
|
|
85
|
-
formResetCallback() {
|
|
86
|
-
this.restoreInitialState();
|
|
76
|
+
this.internals?.setFormValue(this.checked.toString());
|
|
87
77
|
}
|
|
78
|
+
connectedCallback() {
|
|
79
|
+
this.checkboxGroup = this.el.closest('ds-checkbox-group');
|
|
80
|
+
if (this.checkboxGroup) {
|
|
81
|
+
this.invalid = !!this.checkboxGroup.errorText;
|
|
82
|
+
this.checkboxGroup.addEventListener('dsCheckboxGroupInvalidStateChange', this.updateInvalidState);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
disconnectedCallback() {
|
|
86
|
+
if (this.checkboxGroup) {
|
|
87
|
+
this.checkboxGroup.removeEventListener('dsCheckboxGroupInvalidStateChange', this.updateInvalidState);
|
|
88
|
+
}
|
|
89
|
+
this.checkboxGroup = null;
|
|
90
|
+
}
|
|
91
|
+
updateInvalidState = (e) => {
|
|
92
|
+
this.invalid = e.detail;
|
|
93
|
+
};
|
|
88
94
|
componentWillLoad() {
|
|
89
|
-
this.setInitialState();
|
|
90
95
|
this.setIds();
|
|
91
96
|
this.inheritedAttributes = {
|
|
92
97
|
...inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden', 'aria-invalid']),
|
|
@@ -99,9 +104,7 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
99
104
|
handleInput = (e) => {
|
|
100
105
|
const target = e.target;
|
|
101
106
|
this.checked = target.checked;
|
|
102
|
-
this.
|
|
103
|
-
this.internals?.setFormValue(this.value);
|
|
104
|
-
this.dsCheckboxInput.emit({ id: this.identifier, checked: target.checked });
|
|
107
|
+
this.internals?.setFormValue(target.checked.toString());
|
|
105
108
|
if (isValidation('client') && this.validationMessage) {
|
|
106
109
|
this.validationMessage = this.getValidationMessage();
|
|
107
110
|
}
|
|
@@ -129,13 +132,13 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
129
132
|
'ds-checkbox--no-margin': Boolean(!this.text),
|
|
130
133
|
});
|
|
131
134
|
const inputClasses = classNames('ds-checkbox__input', {
|
|
132
|
-
'ds-checkbox__input--invalid': Boolean(this.errorText),
|
|
135
|
+
'ds-checkbox__input--invalid': Boolean(this.errorText) || this.invalid,
|
|
133
136
|
});
|
|
134
137
|
const errorClasses = classNames('ds-checkbox-error', {
|
|
135
138
|
'ds-checkbox-error--visible': Boolean(this.validationMessage),
|
|
136
139
|
});
|
|
137
140
|
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
138
|
-
return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onInput: this.handleInput, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, value: this.
|
|
141
|
+
return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onInput: this.handleInput, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, value: this.checked.toString(), disabled: this.disabled, required: this.required, id: this.identifier, "aria-describedby": ariaDescribedBy, "aria-label": getAriaLabel(this.getCheckboxText(), this.ariaLabel), "aria-invalid": this.errorText ? true : undefined, ...this.inheritedAttributes }), this.getCheckboxText())), !this.errorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.inputValidityId, text: this.validationMessage, type: "error", role: "alert" })))));
|
|
139
142
|
}
|
|
140
143
|
renderFieldset() {
|
|
141
144
|
const fieldsetClasses = classNames('ds-checkbox-fieldset');
|
|
@@ -165,7 +168,8 @@ const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
|
165
168
|
"optional": [4],
|
|
166
169
|
"optionalText": [1, "optional-text"],
|
|
167
170
|
"ariaLabel": [1, "aria-label"],
|
|
168
|
-
"
|
|
171
|
+
"invalid": [32],
|
|
172
|
+
"initialChecked": [32],
|
|
169
173
|
"validationMessage": [32]
|
|
170
174
|
}]);
|
|
171
175
|
function defineCustomElement() {
|
|
@@ -958,7 +958,7 @@ const DsIcon = proxyCustomElement(class DsIcon extends H {
|
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
960
|
render() {
|
|
961
|
-
return (h(Fragment, { key: '
|
|
961
|
+
return (h(Fragment, { key: '71d2466d7ab9bdac086b7e4723bdbcae85f46179' }, h("span", { key: 'b19955f6f321b89dfce0d7843dcc41d3db92b29f', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
|
|
962
962
|
}
|
|
963
963
|
static get style() { return DsIconStyle0; }
|
|
964
964
|
}, [1, "ds-icon", {
|
|
@@ -3,7 +3,7 @@ import { c as classNames } from './index3.js';
|
|
|
3
3
|
import { i as isValidation } from './store.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './ds-icon2.js';
|
|
5
5
|
|
|
6
|
-
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-
|
|
6
|
+
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-palette-red-70)}.ds-input-validity--success{color:var(--ds-palette-green-70)}.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)}";
|
|
7
7
|
const DsInputValidityStyle0 = dsInputValidityCss;
|
|
8
8
|
|
|
9
9
|
const DsInputValidity = proxyCustomElement(class DsInputValidity extends H {
|
|
@@ -26,7 +26,7 @@ const DsInputValidity = proxyCustomElement(class DsInputValidity extends H {
|
|
|
26
26
|
'ds-input-validity--success': this.type === 'success',
|
|
27
27
|
});
|
|
28
28
|
const icon = this.type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
29
|
-
return (h("div", { key: '
|
|
29
|
+
return (h("div", { key: 'b76f90369546a44b88ff02ec08182ebf2299c0e9', role: isValidation('client') ? this.validityRole : undefined }, this.text && (h("div", { key: '575d68fff500bac58612514a3c4efebdb62dffdb', class: classes }, h("ds-icon", { key: '707c95678fdf517f83bc5126a1fcea0d9f8eb5cb', name: icon }), h("small", { key: '39e098386b1ed37c9d797513d626bb50e2e50034', id: this.identifier }, this.text)))));
|
|
30
30
|
}
|
|
31
31
|
static get style() { return DsInputValidityStyle0; }
|
|
32
32
|
}, [0, "ds-input-validity", {
|
|
@@ -5,7 +5,7 @@ import { o as opensInNewTab, v as visuallyHiddenAssistiveText } from './linkUtil
|
|
|
5
5
|
import { g as getAriaLabel, i as idGenerator, d as defineCustomElement$3 } from './ds-icon2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './ds-visually-hidden2.js';
|
|
7
7
|
|
|
8
|
-
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-
|
|
8
|
+
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-palette-mainBlue-70);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-palette-white);outline-color:var(--ds-palette-black-95);outline-offset:calc(var(--ds-borderWidth-thin) * 1);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-palette-white);background-color:var(--ds-palette-mainBlue-70)}.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-palette-mainBlue-80)}:active slot>.ds-link-with-arrow__icon{background-color:var(--ds-palette-mainBlue-90)}.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-palette-mainBlue-80)}.ds-link-with-arrow:active,.ds-link-with-arrow:focus-visible{color:var(--ds-palette-mainBlue-90)}";
|
|
9
9
|
const DsLinkWithArrowStyle0 = dsLinkWithArrowCss;
|
|
10
10
|
|
|
11
11
|
const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
|
|
@@ -39,7 +39,7 @@ const DsLinkWithArrow$1 = proxyCustomElement(class DsLinkWithArrow extends H {
|
|
|
39
39
|
'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
|
|
40
40
|
'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
|
|
41
41
|
});
|
|
42
|
-
return (h("a", { key: '
|
|
42
|
+
return (h("a", { key: '07c30d407ab9399a29f3949bc4f9ea1139f9fa97', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: 'bebb1091f27d49871da79235aed5772bd1059f3d', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: 'c7bfbfdc9953138b510b5e37830cdd1f7837bae6', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: 'f4a8369cf54fb4d9f8aeea193c7aa52c14a59e2b', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: '430e7a77fe1bfa7af5f49873f1aff7371437d345', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '3e0b84c6648fa683320e602df7f83776f9698d74', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
|
|
43
43
|
}
|
|
44
44
|
static get style() { return DsLinkWithArrowStyle0; }
|
|
45
45
|
}, [1, "ds-link-with-arrow", {
|
|
@@ -5,7 +5,7 @@ import { o as opensInNewTab, v as visuallyHiddenAssistiveText } from './linkUtil
|
|
|
5
5
|
import { g as getAriaLabel, i as idGenerator, d as defineCustomElement$3 } from './ds-icon2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './ds-visually-hidden2.js';
|
|
7
7
|
|
|
8
|
-
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-
|
|
8
|
+
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-palette-mainBlue-70);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-palette-white);outline-color:var(--ds-palette-black-95);outline-offset:calc(var(--ds-borderWidth-thin) * 1);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-palette-mainBlue-80)}.ds-link:active{color:var(--ds-palette-mainBlue-90)}.ds-link:visited{color:#551a8b}.ds-link--standalone{color:var(--ds-palette-mainBlue-70);text-decoration-line:none}.ds-link--standalone:hover,.ds-link--standalone:active{text-decoration-line:underline}.ds-link--standalone:hover{color:var(--ds-palette-mainBlue-80)}.ds-link--standalone:active{color:var(--ds-palette-mainBlue-90)}.ds-link--standalone:focus-visible{color:var(--ds-palette-mainBlue-70)}.ds-link--standalone:visited{color:var(--ds-palette-mainBlue-70)}";
|
|
9
9
|
const DsLinkStyle0 = dsLinkCss;
|
|
10
10
|
|
|
11
11
|
const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
|
|
@@ -48,7 +48,7 @@ const DsLink$1 = proxyCustomElement(class DsLink extends H {
|
|
|
48
48
|
[`ds-link__icon--start-${this.variant}`]: this.iconPosition === 'start',
|
|
49
49
|
[`ds-link__icon--end-${this.variant}`]: this.iconPosition === 'end',
|
|
50
50
|
});
|
|
51
|
-
return (h("a", { key: '
|
|
51
|
+
return (h("a", { key: 'e8db9e6a903263d717a386e2fd61a2f279c4de1d', 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: '9def43becc24ab8f836ced9eb1f33de903fcfa40', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '301bbcf7464dca9e0e44cd9b74ccc77e67cbfac9', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), this.text, h("slot", { key: 'f6f3b7824f5bb028375f40e2e5743989a56f187d', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: '3af94f1f8e4f1199e260929001b99ee56f780dff', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'f91801450c834793bf05a40f011b86f500422eee', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
|
|
52
52
|
}
|
|
53
53
|
static get style() { return DsLinkStyle0; }
|
|
54
54
|
}, [1, "ds-link", {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface DsRadioButtonGroup extends Components.DsRadioButtonGroup, HTMLElement {}
|
|
4
|
+
export const DsRadioButtonGroup: {
|
|
5
|
+
prototype: DsRadioButtonGroup;
|
|
6
|
+
new (): DsRadioButtonGroup;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, d as createEvent, h, e as Host } from './index2.js';
|
|
2
|
+
import { c as classNames } from './index3.js';
|
|
3
|
+
import { i as idGenerator, d as defineCustomElement$3 } from './ds-icon2.js';
|
|
4
|
+
import { i as inheritAriaAttributes } from './attributes.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './ds-input-validity2.js';
|
|
6
|
+
|
|
7
|
+
const dsRadioButtonGroupCss = ".ds-radio-button-group{display:inline-flex;flex-direction:column;border:none;padding:0;margin:0}.ds-radio-button-group__radio-buttons-slot{display:inline-flex;flex-direction:column}.ds-radio-button-group__radio-buttons-slot--horizontal{flex-direction:row;gap:var(--ds-spacing-small);flex-wrap:wrap}.ds-radio-button-group__legend{padding-inline:0;color:var(--ds-palette-black-95);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-semibold);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large);margin-bottom:var(--ds-spacing-3xSmall)}.ds-radio-button-group__assistive-text{font-size:var(--ds-fontSize-14);color:var(--ds-palette-black-70);line-height:var(--ds-lineHeight-large);margin-bottom:var(--ds-spacing-2xSmall)}";
|
|
8
|
+
const DsRadioButtonGroupStyle0 = dsRadioButtonGroupCss;
|
|
9
|
+
|
|
10
|
+
const radioButtonGroupIdGenerator = idGenerator('ds-radio-button-group');
|
|
11
|
+
const DsRadioButtonGroup$1 = proxyCustomElement(class DsRadioButtonGroup extends H {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.__attachShadow();
|
|
16
|
+
this.dsRadioGroupValueChange = createEvent(this, "dsRadioGroupValueChange", 7);
|
|
17
|
+
this.dsRadioGroupInvalidStateChange = createEvent(this, "dsRadioGroupInvalidStateChange", 7);
|
|
18
|
+
}
|
|
19
|
+
fieldsetId = radioButtonGroupIdGenerator.next().value;
|
|
20
|
+
errorTextId = `${this.fieldsetId}-error`;
|
|
21
|
+
assistiveTextId = `${this.fieldsetId}-assistive-text`;
|
|
22
|
+
inheritedAttributes = {};
|
|
23
|
+
get el() { return this; }
|
|
24
|
+
legend;
|
|
25
|
+
assistiveText;
|
|
26
|
+
initialValue;
|
|
27
|
+
direction = 'vertical';
|
|
28
|
+
errorText = '';
|
|
29
|
+
value;
|
|
30
|
+
dsRadioGroupValueChange;
|
|
31
|
+
dsRadioGroupInvalidStateChange;
|
|
32
|
+
getRadios = () => {
|
|
33
|
+
return Array.from(this.el.querySelectorAll('ds-radio-button')).filter(e => !e.disabled);
|
|
34
|
+
};
|
|
35
|
+
updateFocusableRadioButton = () => {
|
|
36
|
+
const radios = this.getRadios();
|
|
37
|
+
if (!radios.length) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let focusableBtn = null;
|
|
41
|
+
for (const radio of radios) {
|
|
42
|
+
const isFocusable = radio.value === this.value;
|
|
43
|
+
radio.setFocusable(isFocusable);
|
|
44
|
+
if (isFocusable) {
|
|
45
|
+
focusableBtn = radio;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!focusableBtn) {
|
|
49
|
+
radios[0].setFocusable(true);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
componentWillLoad() {
|
|
53
|
+
this.value = this.initialValue;
|
|
54
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-labelledby']);
|
|
55
|
+
this.updateFocusableRadioButton();
|
|
56
|
+
}
|
|
57
|
+
async getValue() {
|
|
58
|
+
return this.value;
|
|
59
|
+
}
|
|
60
|
+
errorTextObserver(errorText) {
|
|
61
|
+
this.dsRadioGroupInvalidStateChange.emit(!!errorText);
|
|
62
|
+
}
|
|
63
|
+
onInputChange(e) {
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
const targetElem = e.target;
|
|
66
|
+
this.value = targetElem.value;
|
|
67
|
+
this.dsRadioGroupValueChange.emit(this.value);
|
|
68
|
+
this.updateFocusableRadioButton();
|
|
69
|
+
}
|
|
70
|
+
onKeyDown(e) {
|
|
71
|
+
if (!['ArrowUp', 'ArrowLeft', 'ArrowDown', 'ArrowRight'].includes(e.key)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (e.target && !this.el.contains(e.target)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const radios = this.getRadios();
|
|
78
|
+
if (e.target && !radios.includes(e.target)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
const currentIndex = radios.findIndex(r => r === e.target);
|
|
83
|
+
let nextIndex;
|
|
84
|
+
if (['ArrowUp', 'ArrowLeft'].includes(e.key)) {
|
|
85
|
+
nextIndex = currentIndex === 0 ? radios.length - 1 : currentIndex - 1;
|
|
86
|
+
}
|
|
87
|
+
if (['ArrowDown', 'ArrowRight'].includes(e.key)) {
|
|
88
|
+
nextIndex = (currentIndex + 1) % radios.length;
|
|
89
|
+
}
|
|
90
|
+
const nextElem = radios[nextIndex];
|
|
91
|
+
nextElem.setFocus();
|
|
92
|
+
nextElem.setChecked();
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
const classes = classNames('ds-radio-button-group');
|
|
96
|
+
const legendClasses = classNames('ds-radio-button-group__legend');
|
|
97
|
+
const assistiveTextClasses = classNames('ds-radio-button-group__assistive-text');
|
|
98
|
+
const radioButtonsSlotClasses = classNames('ds-radio-button-group__radio-buttons-slot', {
|
|
99
|
+
'ds-radio-button-group__radio-buttons-slot--horizontal': this.direction === 'horizontal',
|
|
100
|
+
});
|
|
101
|
+
const errorClasses = classNames('ds-radio-button-group__error');
|
|
102
|
+
const ariaDescribedBy = [!!this.errorText && this.errorTextId, !!this.assistiveText && this.assistiveTextId].filter(Boolean).join(' ');
|
|
103
|
+
return (h(Host, { key: 'c29b30786a96a50976486eb107c707b973c06633', "data-invalid": !!this.errorText || undefined }, h("fieldset", { key: '90692a539c75bb81ae692b7209bd757c5d8b6b59', class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, h("legend", { key: '1d4f2819f0fa4ca020297cddccc87f684fc03461', class: legendClasses }, h("slot", { key: 'd9edb199de4975dd876bf68fa834f7d1b841bad2', name: "legend" }, this.legend)), h("slot", { key: 'e48f2924efd4e0f47fedb8c30df34735aa6bc2df', name: "assistiveText" }, this.assistiveText && (h("small", { key: 'ebbb68a63acce035872ce7ef22d2821941ea3ccc', class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText))), h("div", { key: 'a146cbf465a9fe97e5380db66d0baecaa46797e1', class: radioButtonsSlotClasses }, h("slot", { key: 'd7623edbff9870335ae62451bad2b245e394d4d0', onSlotchange: this.updateFocusableRadioButton })), h("div", { key: '85381c3f1b7f28d5508cf866884f0f5df2e2413a', class: errorClasses }, h("ds-input-validity", { key: 'ebf9f79454c11f490261959e1bdb5433744f39a3', id: this.errorTextId, text: this.errorText, type: "error" })))));
|
|
104
|
+
}
|
|
105
|
+
static get watchers() { return {
|
|
106
|
+
"errorText": ["errorTextObserver"]
|
|
107
|
+
}; }
|
|
108
|
+
static get style() { return DsRadioButtonGroupStyle0; }
|
|
109
|
+
}, [1, "ds-radio-button-group", {
|
|
110
|
+
"legend": [1],
|
|
111
|
+
"assistiveText": [1, "assistive-text"],
|
|
112
|
+
"initialValue": [1, "value"],
|
|
113
|
+
"direction": [1],
|
|
114
|
+
"errorText": [1, "error-text"],
|
|
115
|
+
"value": [32],
|
|
116
|
+
"getValue": [64]
|
|
117
|
+
}, [[0, "dsRadioButtonChecked", "onInputChange"], [4, "keydown", "onKeyDown"]], {
|
|
118
|
+
"errorText": ["errorTextObserver"]
|
|
119
|
+
}]);
|
|
120
|
+
function defineCustomElement$1() {
|
|
121
|
+
if (typeof customElements === "undefined") {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const components = ["ds-radio-button-group", "ds-icon", "ds-input-validity"];
|
|
125
|
+
components.forEach(tagName => { switch (tagName) {
|
|
126
|
+
case "ds-radio-button-group":
|
|
127
|
+
if (!customElements.get(tagName)) {
|
|
128
|
+
customElements.define(tagName, DsRadioButtonGroup$1);
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
case "ds-icon":
|
|
132
|
+
if (!customElements.get(tagName)) {
|
|
133
|
+
defineCustomElement$3();
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "ds-input-validity":
|
|
137
|
+
if (!customElements.get(tagName)) {
|
|
138
|
+
defineCustomElement$2();
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
} });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const DsRadioButtonGroup = DsRadioButtonGroup$1;
|
|
145
|
+
const defineCustomElement = defineCustomElement$1;
|
|
146
|
+
|
|
147
|
+
export { DsRadioButtonGroup, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface DsRadioButton extends Components.DsRadioButton, HTMLElement {}
|
|
4
|
+
export const DsRadioButton: {
|
|
5
|
+
prototype: DsRadioButton;
|
|
6
|
+
new (): DsRadioButton;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|