@uh-design-system/component-library 0.4.0 → 0.4.2
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 +3 -3
- package/dist/cjs/controlUtils-041de0fd.js +7 -0
- package/dist/cjs/ds-accordion_3.cjs.entry.js +27 -20
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +156 -0
- package/dist/cjs/ds-checkbox.cjs.entry.js +153 -0
- package/dist/cjs/ds-input-validity.cjs.entry.js +38 -0
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +8 -7
- package/dist/cjs/ds-link.cjs.entry.js +11 -8
- package/dist/cjs/ds-text-input.cjs.entry.js +30 -6
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/{index-bfa0f441.js → index-b2bddcf4.js} +326 -125
- package/dist/cjs/{linkUtils-695da37c.js → linkUtils-e911e899.js} +10 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/utils-c9113835.js +18 -0
- package/dist/collection/accessibility/accessibility.stories.js +10 -0
- package/dist/collection/accessibility/stories/ariaLabel.stories.js +19 -0
- package/dist/collection/accessibility/stories/ariaLabelledBy.stories.js +49 -0
- package/dist/collection/accessibility/stories/naming.stories.js +39 -0
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/00-foundations/icons/categories/information.js +4 -0
- package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +133 -48
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +1 -1
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +9 -9
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +2 -2
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +53 -12
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +88 -55
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +144 -0
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +429 -0
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +115 -0
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +37 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +38 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +445 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +89 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +47 -0
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
- package/dist/collection/components/01-base-components/ds-icon/{ds-icon.stories.js → stories/ds-icon.stories.js} +12 -2
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +31 -0
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +114 -0
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +17 -0
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +21 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +19 -139
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +68 -8
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +6 -2
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +2 -2
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +15 -4
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +1 -139
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +25 -5
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.js → ds-link-with-arrow.examples.stories.js} +26 -3
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.js → ds-link-with-arrow.stories.js} +5 -4
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +8 -11
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +30 -5
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +29 -7
- package/dist/collection/components/01-base-components/ds-text-input/utils.js +0 -6
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/utils/controls/controlUtils.js +2 -0
- package/dist/collection/utils/link/linkUtils.js +9 -0
- package/dist/collection/utils/typography/typographyUtils.js +39 -0
- package/dist/collection/utils/utils.js +24 -6
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/controlUtils-9ca4087b.js +1 -0
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- package/dist/component-library/ds-checkbox-group.entry.js +1 -0
- package/dist/component-library/ds-checkbox.entry.js +1 -0
- package/dist/component-library/ds-input-validity.entry.js +1 -0
- 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 +2 -0
- package/dist/component-library/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +1 -1
- package/dist/component-library/utils-b5843ae1.js +1 -0
- package/dist/components/attributes.js +1 -80
- package/dist/components/controlUtils.js +4 -0
- package/dist/components/ds-accordion.js +8 -8
- package/dist/components/ds-button2.js +4 -3
- package/dist/components/ds-checkbox-group.d.ts +11 -0
- package/dist/components/ds-checkbox-group.js +206 -0
- package/dist/components/ds-checkbox.d.ts +11 -0
- package/dist/components/ds-checkbox.js +6 -0
- package/dist/components/ds-checkbox2.js +185 -0
- package/dist/components/ds-icon2.js +24 -4
- package/dist/components/ds-input-validity.d.ts +11 -0
- package/dist/components/ds-input-validity.js +6 -0
- package/dist/components/ds-input-validity2.js +59 -0
- package/dist/components/ds-link-with-arrow.js +10 -8
- package/dist/components/ds-link.js +15 -9
- package/dist/components/ds-text-input.js +30 -7
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index2.js +298 -130
- package/dist/components/index3.js +80 -0
- package/dist/components/linkUtils.js +10 -1
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/controlUtils-9ca4087b.js +4 -0
- package/dist/esm/ds-accordion_3.entry.js +25 -18
- package/dist/esm/ds-checkbox-group.entry.js +152 -0
- package/dist/esm/ds-checkbox.entry.js +149 -0
- package/dist/esm/ds-input-validity.entry.js +34 -0
- package/dist/esm/ds-link-with-arrow.entry.js +8 -7
- package/dist/esm/ds-link.entry.js +11 -8
- package/dist/esm/ds-text-input.entry.js +30 -6
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/{index-42701395.js → index-50783b0c.js} +326 -126
- package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +10 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/utils-b5843ae1.js +15 -0
- package/dist/types/accessibility/accessibility.stories.d.ts +3 -0
- package/dist/types/accessibility/stories/ariaLabel.stories.d.ts +5 -0
- package/dist/types/accessibility/stories/ariaLabelledBy.stories.d.ts +4 -0
- package/dist/types/accessibility/stories/naming.stories.d.ts +4 -0
- package/dist/types/components/00-foundations/typography/stories/typography.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +4 -1
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +49 -0
- package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.d.ts +13 -0
- package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +56 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-icon/{ds-icon.stories.d.ts → stories/ds-icon.stories.d.ts} +2 -1
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +12 -0
- package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +4 -1
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +5 -0
- package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +0 -1
- package/dist/types/components.d.ts +142 -2
- package/dist/types/utils/controls/controlUtils.d.ts +2 -0
- package/dist/types/utils/link/linkUtils.d.ts +1 -0
- package/dist/types/utils/typography/typographyUtils.d.ts +5 -0
- package/dist/types/utils/utils.d.ts +10 -3
- package/package.json +19 -18
- package/dist/cjs/utils-8b73aa91.js +0 -10
- package/dist/collection/components/00-foundations/typography/typography.stories.js +0 -68
- package/dist/component-library/index-42701395.js +0 -2
- package/dist/component-library/utils-cca2a41a.js +0 -1
- package/dist/components/utils.js +0 -8
- package/dist/esm/utils-cca2a41a.js +0 -8
- package/dist/types/components/00-foundations/typography/typography.stories.d.ts +0 -7
- /package/dist/cjs/{attributes-f7831329.js → attributes-5f5b58be.js} +0 -0
- /package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.js → ds-link-with-arrow.features.stories.js} +0 -0
- /package/dist/collection/utils/{attributes.js → attributes/attributes.js} +0 -0
- /package/dist/component-library/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
- /package/dist/esm/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.d.ts → ds-link-with-arrow.examples.stories.d.ts} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.d.ts → ds-link-with-arrow.features.stories.d.ts} +0 -0
- /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.d.ts → ds-link-with-arrow.stories.d.ts} +0 -0
- /package/dist/types/utils/{attributes.d.ts → attributes/attributes.d.ts} +0 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './index2.js';
|
|
2
|
+
import { c as classNames } from './index3.js';
|
|
3
|
+
import { i as inheritAriaAttributes } from './attributes.js';
|
|
4
|
+
import { i as idGenerator, d as defineCustomElement$3 } from './ds-icon2.js';
|
|
5
|
+
import { d as defineCustomElement$4 } from './ds-checkbox2.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './ds-input-validity2.js';
|
|
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-textColor-secondary);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
|
+
const DsCheckboxGroupStyle0 = dsCheckboxGroupCss;
|
|
10
|
+
|
|
11
|
+
const fieldsetIdGenerator = idGenerator('ds-checkbox-group');
|
|
12
|
+
const DsCheckboxGroup$1 = proxyCustomElement(class DsCheckboxGroup extends H {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
this.dsCheckboxGroupChange = createEvent(this, "dsCheckboxGroupChange", 7);
|
|
18
|
+
this.dsCheckboxGroupIndeterminateChildChange = createEvent(this, "dsCheckboxGroupIndeterminateChildChange", 7);
|
|
19
|
+
}
|
|
20
|
+
fieldsetId = fieldsetIdGenerator.next().value;
|
|
21
|
+
checkboxId = `${this.fieldsetId}-checkbox`;
|
|
22
|
+
errorTextId = `${this.fieldsetId}-error`;
|
|
23
|
+
assistiveTextId = `${this.fieldsetId}-assistive-text`;
|
|
24
|
+
nestedId = `${this.fieldsetId}-nested`;
|
|
25
|
+
inheritedAttributes = {};
|
|
26
|
+
get el() { return this; }
|
|
27
|
+
dsCheckboxGroupChange;
|
|
28
|
+
dsCheckboxGroupIndeterminateChildChange;
|
|
29
|
+
legend;
|
|
30
|
+
assistiveText;
|
|
31
|
+
direction = 'vertical';
|
|
32
|
+
errorText = '';
|
|
33
|
+
text = '';
|
|
34
|
+
checked = false;
|
|
35
|
+
checkedChildElementCount = 0;
|
|
36
|
+
disabled = false;
|
|
37
|
+
parentCheckedCount = 0;
|
|
38
|
+
childElementsCount = 0;
|
|
39
|
+
isIndeterminate = false;
|
|
40
|
+
indeterminateChildCheckboxCount = 0;
|
|
41
|
+
elementIs = (localName) => (element) => element.localName === localName;
|
|
42
|
+
elementIsCheckbox = this.elementIs('ds-checkbox');
|
|
43
|
+
elementIsCheckboxGroup = this.elementIs('ds-checkbox-group');
|
|
44
|
+
getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.errorText) && this.errorTextId].filter(Boolean).join(' ');
|
|
45
|
+
getChildElements = () => {
|
|
46
|
+
const slot = this.el.shadowRoot.querySelector('slot');
|
|
47
|
+
return (slot?.assignedElements() || []);
|
|
48
|
+
};
|
|
49
|
+
getChildCheckboxElements = () => {
|
|
50
|
+
return this.getChildElements().filter(this.elementIsCheckbox);
|
|
51
|
+
};
|
|
52
|
+
updateChildElements = (updateFn) => {
|
|
53
|
+
this.getChildElements().forEach(updateFn);
|
|
54
|
+
};
|
|
55
|
+
updateChildCheckboxes = (updateFn) => {
|
|
56
|
+
this.getChildCheckboxElements().forEach(updateFn);
|
|
57
|
+
};
|
|
58
|
+
updateChildElementsChecked = (checked) => {
|
|
59
|
+
this.checkedChildElementCount = checked ? this.childElementsCount : 0;
|
|
60
|
+
this.updateChildElements((element) => {
|
|
61
|
+
element.checked = checked;
|
|
62
|
+
if (this.elementIsCheckboxGroup(element)) {
|
|
63
|
+
(async () => {
|
|
64
|
+
await element.setChecked(checked);
|
|
65
|
+
})();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
async setChecked(newValue) {
|
|
70
|
+
this.updateChildElementsChecked(newValue);
|
|
71
|
+
}
|
|
72
|
+
handleCheckboxDisabledChange(newValue) {
|
|
73
|
+
this.updateChildElements((element) => {
|
|
74
|
+
element.disabled = newValue;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
handleCheckedChange(newValue) {
|
|
78
|
+
this.updateChildElementsChecked(newValue);
|
|
79
|
+
}
|
|
80
|
+
handleIndeterminateChange(newValue) {
|
|
81
|
+
this.dsCheckboxGroupIndeterminateChildChange.emit({ id: this.fieldsetId, indeterminate: newValue });
|
|
82
|
+
}
|
|
83
|
+
handleIndeterminateChildChange(event) {
|
|
84
|
+
this.indeterminateChildCheckboxCount = event.detail.indeterminate ? this.indeterminateChildCheckboxCount + 1 : this.indeterminateChildCheckboxCount - 1;
|
|
85
|
+
}
|
|
86
|
+
handleCheckedChildElementCountChange(newValue, oldValue) {
|
|
87
|
+
this.isIndeterminate =
|
|
88
|
+
this.checkedChildElementCount !== this.childElementsCount && this.checkedChildElementCount < this.childElementsCount && this.checkedChildElementCount > 0;
|
|
89
|
+
if (newValue === this.childElementsCount && newValue > oldValue) {
|
|
90
|
+
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: true });
|
|
91
|
+
}
|
|
92
|
+
else if (oldValue === this.childElementsCount && newValue < oldValue) {
|
|
93
|
+
this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: false });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
updateCheckedChildElementCount = (event) => {
|
|
97
|
+
if (event.detail.checked) {
|
|
98
|
+
this.checkedChildElementCount = this.checkedChildElementCount === this.childElementsCount ? this.checkedChildElementCount : this.checkedChildElementCount + 1;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.checkedChildElementCount = this.checkedChildElementCount === 0 ? 0 : this.checkedChildElementCount - 1;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
handleCheckboxChange(event) {
|
|
105
|
+
if (event.detail.id === this.checkboxId) {
|
|
106
|
+
this.updateChildElementsChecked(event.detail.checked);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (this.getChildCheckboxElements().includes(event.target)) {
|
|
110
|
+
this.updateCheckedChildElementCount(event);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleCheckboxGroupChange(event) {
|
|
114
|
+
if (this.getChildElements().includes(event.target)) {
|
|
115
|
+
this.updateCheckedChildElementCount(event);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
setChildElementCount = () => {
|
|
119
|
+
this.childElementsCount = this.getChildElements().length;
|
|
120
|
+
};
|
|
121
|
+
componentWillLoad() {
|
|
122
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-labelledby']);
|
|
123
|
+
}
|
|
124
|
+
componentDidLoad() {
|
|
125
|
+
this.setChildElementCount();
|
|
126
|
+
this.updateChildCheckboxes(element => {
|
|
127
|
+
element.setAttribute('data-errors-disabled', 'true');
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
componentDidUpdate() {
|
|
131
|
+
this.setChildElementCount();
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
const classes = classNames('ds-checkbox-group', {
|
|
135
|
+
'ds-checkbox-group--horizontal': this.direction === 'horizontal',
|
|
136
|
+
});
|
|
137
|
+
const legendClasses = classNames('ds-checkbox-group__legend');
|
|
138
|
+
const assistiveTextClasses = classNames('ds-checkbox-group__assistive-text');
|
|
139
|
+
const errorClasses = classNames('ds-checkbox-group__error', {
|
|
140
|
+
'ds-checkbox-group__error--visible': Boolean(this.errorText),
|
|
141
|
+
});
|
|
142
|
+
const nestedClasses = classNames('ds-checkbox-group', 'ds-checkbox-group--inset');
|
|
143
|
+
const checkboxesClasses = classNames('ds-checkbox-group__checkboxes');
|
|
144
|
+
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
145
|
+
return (h("fieldset", { key: '2080f4f193fe5bb3a6702287cebcf5d7dcc4a9b7', id: this.fieldsetId, class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, this.legend && h("legend", { key: '15754cea90c38ad46ff41196b0de108f10f007a9', class: legendClasses }, this.legend), this.assistiveText && (h("small", { key: '7dde97170e62d0668a52b3a21256be65e04ae811', class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.text ? (h(Fragment, null, h("ds-checkbox", { 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: 'b2e23012afd2f5439c89d5683f8b3776cf438ce5', class: errorClasses }, h("ds-input-validity", { key: 'cfb43cc67a907b7685d55f1ffdd86eb3f73f1bd0', id: this.errorTextId, text: this.errorText, type: "error" }))));
|
|
146
|
+
}
|
|
147
|
+
static get watchers() { return {
|
|
148
|
+
"disabled": ["handleCheckboxDisabledChange"],
|
|
149
|
+
"checked": ["handleCheckedChange"],
|
|
150
|
+
"isIndeterminate": ["handleIndeterminateChange"],
|
|
151
|
+
"checkedChildElementCount": ["handleCheckedChildElementCountChange"]
|
|
152
|
+
}; }
|
|
153
|
+
static get style() { return DsCheckboxGroupStyle0; }
|
|
154
|
+
}, [1, "ds-checkbox-group", {
|
|
155
|
+
"legend": [1],
|
|
156
|
+
"assistiveText": [1, "assistive-text"],
|
|
157
|
+
"direction": [1],
|
|
158
|
+
"errorText": [1, "error-text"],
|
|
159
|
+
"text": [1],
|
|
160
|
+
"checked": [1028],
|
|
161
|
+
"checkedChildElementCount": [1026, "checked-child-element-count"],
|
|
162
|
+
"disabled": [4],
|
|
163
|
+
"parentCheckedCount": [2, "parent-checked-count"],
|
|
164
|
+
"childElementsCount": [32],
|
|
165
|
+
"isIndeterminate": [32],
|
|
166
|
+
"indeterminateChildCheckboxCount": [32],
|
|
167
|
+
"setChecked": [64]
|
|
168
|
+
}, [[0, "dsCheckboxGroupIndeterminateChildChange", "handleIndeterminateChildChange"], [0, "dsCheckboxChange", "handleCheckboxChange"], [0, "dsCheckboxGroupChange", "handleCheckboxGroupChange"]], {
|
|
169
|
+
"disabled": ["handleCheckboxDisabledChange"],
|
|
170
|
+
"checked": ["handleCheckedChange"],
|
|
171
|
+
"isIndeterminate": ["handleIndeterminateChange"],
|
|
172
|
+
"checkedChildElementCount": ["handleCheckedChildElementCountChange"]
|
|
173
|
+
}]);
|
|
174
|
+
function defineCustomElement$1() {
|
|
175
|
+
if (typeof customElements === "undefined") {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const components = ["ds-checkbox-group", "ds-checkbox", "ds-icon", "ds-input-validity"];
|
|
179
|
+
components.forEach(tagName => { switch (tagName) {
|
|
180
|
+
case "ds-checkbox-group":
|
|
181
|
+
if (!customElements.get(tagName)) {
|
|
182
|
+
customElements.define(tagName, DsCheckboxGroup$1);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case "ds-checkbox":
|
|
186
|
+
if (!customElements.get(tagName)) {
|
|
187
|
+
defineCustomElement$4();
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
case "ds-icon":
|
|
191
|
+
if (!customElements.get(tagName)) {
|
|
192
|
+
defineCustomElement$3();
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case "ds-input-validity":
|
|
196
|
+
if (!customElements.get(tagName)) {
|
|
197
|
+
defineCustomElement$2();
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
} });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const DsCheckboxGroup = DsCheckboxGroup$1;
|
|
204
|
+
const defineCustomElement = defineCustomElement$1;
|
|
205
|
+
|
|
206
|
+
export { DsCheckboxGroup, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface DsCheckbox extends Components.DsCheckbox, HTMLElement {}
|
|
4
|
+
export const DsCheckbox: {
|
|
5
|
+
prototype: DsCheckbox;
|
|
6
|
+
new (): DsCheckbox;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './index2.js';
|
|
2
|
+
import { c as classNames } from './index3.js';
|
|
3
|
+
import { i as inheritAriaAttributes } from './attributes.js';
|
|
4
|
+
import { i as idGenerator, d as defineCustomElement$2 } from './ds-icon2.js';
|
|
5
|
+
import { g as getRequiredText, a as getOptionalText } from './controlUtils.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './ds-input-validity2.js';
|
|
7
|
+
|
|
8
|
+
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-textColor-secondary);line-height:var(--ds-lineHeight-large)}.ds-checkbox{display:inline-flex;align-self:flex-start;align-items:center;flex-direction:row;flex-wrap:nowrap;text-wrap:nowrap;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-textColor-disabled-onLight)}.ds-checkbox__span--optional{color:var(--ds-textColor-secondary);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-bgColor-white);margin:0;display:grid;place-content:center;height:24px;width:24px;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-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}.ds-checkbox__input:hover,.ds-checkbox__input:active{border-color:var(--ds-borderColor-default)}.ds-checkbox__input:hover{background-color:var(--ds-bgColor-white-hover)}.ds-checkbox__input:active{background-color:var(--ds-bgColor-white-active)}.ds-checkbox__input:disabled{background-color:var(--ds-bgColor-disabled-onLight);border-color:var(--ds-borderColor-disabled-onLight)}@media (forced-colors: active){.ds-checkbox__input:disabled{border-color:GrayText}}.ds-checkbox__input:checked,.ds-checkbox__input:indeterminate{background-color:var(--ds-bgColor-primary);border-color:var(--ds-borderColor-transparent)}.ds-checkbox__input:checked:hover,.ds-checkbox__input:indeterminate:hover{background-color:var(--ds-bgColor-primary-hover)}.ds-checkbox__input:checked:active,.ds-checkbox__input:indeterminate:active{background-color:var(--ds-bgColor-primary-active)}.ds-checkbox__input:checked:disabled,.ds-checkbox__input:indeterminate:disabled{background-color:var(--ds-bgColor-disabled-onLight)}.ds-checkbox__input:user-invalid,.ds-checkbox__input--invalid,.ds-checkbox__input--invalid:checked,.ds-checkbox__input--invalid:indeterminate{border-color:var(--ds-borderColor-danger)}.ds-checkbox__input:disabled{cursor:not-allowed;color:var(--ds-textColor-disabled-onLight)}.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)}";
|
|
9
|
+
const DsCheckboxStyle0 = dsCheckboxCss;
|
|
10
|
+
|
|
11
|
+
const checkboxIdGenerator = idGenerator('ds-checkbox');
|
|
12
|
+
const DsCheckbox = proxyCustomElement(class DsCheckbox extends H {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
this.dsCheckboxChange = createEvent(this, "dsCheckboxChange", 7);
|
|
18
|
+
this.dsCheckboxError = createEvent(this, "dsCheckboxError", 7);
|
|
19
|
+
this.internals = this.attachInternals();
|
|
20
|
+
}
|
|
21
|
+
labelId;
|
|
22
|
+
errorTextId;
|
|
23
|
+
assistiveTextId;
|
|
24
|
+
inheritedAttributes = {};
|
|
25
|
+
initialChecked;
|
|
26
|
+
inputElem;
|
|
27
|
+
get el() { return this; }
|
|
28
|
+
internals;
|
|
29
|
+
dsCheckboxChange;
|
|
30
|
+
dsCheckboxError;
|
|
31
|
+
checkboxId;
|
|
32
|
+
checked = false;
|
|
33
|
+
legend;
|
|
34
|
+
assistiveText;
|
|
35
|
+
text;
|
|
36
|
+
indeterminate = false;
|
|
37
|
+
disabled = false;
|
|
38
|
+
errorText = '';
|
|
39
|
+
errorsDisabled = false;
|
|
40
|
+
required = false;
|
|
41
|
+
optional = false;
|
|
42
|
+
optionalText;
|
|
43
|
+
ariaLabel;
|
|
44
|
+
value = this.checked.toString();
|
|
45
|
+
validationMessage;
|
|
46
|
+
setIds = () => {
|
|
47
|
+
this.checkboxId = this.checkboxId || checkboxIdGenerator.next().value;
|
|
48
|
+
this.labelId = `${this.checkboxId}-label`;
|
|
49
|
+
this.errorTextId = `${this.checkboxId}-error`;
|
|
50
|
+
this.assistiveTextId = `${this.checkboxId}-assistive-text`;
|
|
51
|
+
};
|
|
52
|
+
getErrorText = () => (!this.errorsDisabled ? this.errorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
|
|
53
|
+
getLegendText = () => {
|
|
54
|
+
if (this.required) {
|
|
55
|
+
return getRequiredText(this.legend);
|
|
56
|
+
}
|
|
57
|
+
if (this.optional) {
|
|
58
|
+
return getOptionalText(this.legend, this.optionalText);
|
|
59
|
+
}
|
|
60
|
+
return this.legend;
|
|
61
|
+
};
|
|
62
|
+
getCheckboxText = () => {
|
|
63
|
+
if (this.legend) {
|
|
64
|
+
return this.text;
|
|
65
|
+
}
|
|
66
|
+
if (this.required) {
|
|
67
|
+
return getRequiredText(this.text);
|
|
68
|
+
}
|
|
69
|
+
if (this.optional) {
|
|
70
|
+
return getOptionalText(this.text, this.optionalText);
|
|
71
|
+
}
|
|
72
|
+
return this.text;
|
|
73
|
+
};
|
|
74
|
+
getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getErrorText()) && this.errorTextId].filter(Boolean).join(' ');
|
|
75
|
+
restoreInitialState = () => {
|
|
76
|
+
this.checked = this.initialChecked;
|
|
77
|
+
this.value = this.checked.toString();
|
|
78
|
+
this.internals?.setValidity({});
|
|
79
|
+
this.internals?.setFormValue(this.value);
|
|
80
|
+
};
|
|
81
|
+
setInitialState = () => {
|
|
82
|
+
this.initialChecked = this.checked;
|
|
83
|
+
this.value = this.checked.toString();
|
|
84
|
+
this.internals?.setFormValue(this.value);
|
|
85
|
+
};
|
|
86
|
+
emitCheckboxError = () => {
|
|
87
|
+
this.dsCheckboxError.emit(this.getErrorText());
|
|
88
|
+
};
|
|
89
|
+
formResetCallback() {
|
|
90
|
+
this.restoreInitialState();
|
|
91
|
+
}
|
|
92
|
+
componentWillLoad() {
|
|
93
|
+
this.setInitialState();
|
|
94
|
+
this.setIds();
|
|
95
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden']);
|
|
96
|
+
}
|
|
97
|
+
componentDidLoad() {
|
|
98
|
+
this.ariaLabel = this.el.getAttribute('aria-label');
|
|
99
|
+
this.el.removeAttribute('aria-label');
|
|
100
|
+
}
|
|
101
|
+
componentDidUpdate() {
|
|
102
|
+
this.emitCheckboxError();
|
|
103
|
+
}
|
|
104
|
+
handleChange = () => {
|
|
105
|
+
this.checked = !this.checked;
|
|
106
|
+
this.value = this.checked.toString();
|
|
107
|
+
this.internals?.setFormValue(this.value);
|
|
108
|
+
this.dsCheckboxChange.emit({ id: this.checkboxId, checked: this.checked });
|
|
109
|
+
};
|
|
110
|
+
handleKeyUp = (event) => {
|
|
111
|
+
if (event.key === 'Enter') {
|
|
112
|
+
this.handleChange();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
renderCheckbox() {
|
|
116
|
+
const classes = classNames('ds-checkbox', {
|
|
117
|
+
'ds-checkbox--disabled': this.disabled,
|
|
118
|
+
'ds-checkbox--no-margin': Boolean(!this.text),
|
|
119
|
+
});
|
|
120
|
+
const inputClasses = classNames('ds-checkbox__input', {
|
|
121
|
+
'ds-checkbox__input--invalid': Boolean(this.errorText),
|
|
122
|
+
});
|
|
123
|
+
const errorText = this.getErrorText();
|
|
124
|
+
const errorClasses = classNames('ds-checkbox-error', {
|
|
125
|
+
'ds-checkbox-error--visible': Boolean(errorText),
|
|
126
|
+
});
|
|
127
|
+
const ariaDescribedBy = this.getAriaDescribedBy();
|
|
128
|
+
return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onChange: this.handleChange, onKeyUp: this.handleKeyUp, value: this.value, disabled: this.disabled, required: this.required, id: this.checkboxId, "aria-describedby": ariaDescribedBy, "aria-label": this.ariaLabel, ...this.inheritedAttributes }), this.getCheckboxText())), !this.errorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.errorTextId, text: errorText, type: "error" })))));
|
|
129
|
+
}
|
|
130
|
+
renderFieldset() {
|
|
131
|
+
const fieldsetClasses = classNames('ds-checkbox-fieldset');
|
|
132
|
+
const legendClasses = classNames('ds-checkbox-fieldset__legend');
|
|
133
|
+
const assistiveTextClasses = classNames('ds-checkbox-fieldset__assistive-text');
|
|
134
|
+
return (h("fieldset", { class: fieldsetClasses }, h("legend", { class: legendClasses }, this.getLegendText()), this.assistiveText && (h("small", { class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.renderCheckbox()));
|
|
135
|
+
}
|
|
136
|
+
render() {
|
|
137
|
+
if (this.legend) {
|
|
138
|
+
return this.renderFieldset();
|
|
139
|
+
}
|
|
140
|
+
return this.renderCheckbox();
|
|
141
|
+
}
|
|
142
|
+
static get formAssociated() { return true; }
|
|
143
|
+
static get style() { return DsCheckboxStyle0; }
|
|
144
|
+
}, [65, "ds-checkbox", {
|
|
145
|
+
"checkboxId": [1025, "id"],
|
|
146
|
+
"checked": [1028],
|
|
147
|
+
"legend": [1],
|
|
148
|
+
"assistiveText": [1, "assistive-text"],
|
|
149
|
+
"text": [1],
|
|
150
|
+
"indeterminate": [4],
|
|
151
|
+
"disabled": [4],
|
|
152
|
+
"errorText": [1, "error-text"],
|
|
153
|
+
"errorsDisabled": [4, "data-errors-disabled"],
|
|
154
|
+
"required": [4],
|
|
155
|
+
"optional": [4],
|
|
156
|
+
"optionalText": [1, "optional-text"],
|
|
157
|
+
"ariaLabel": [32],
|
|
158
|
+
"value": [32],
|
|
159
|
+
"validationMessage": [32]
|
|
160
|
+
}]);
|
|
161
|
+
function defineCustomElement() {
|
|
162
|
+
if (typeof customElements === "undefined") {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const components = ["ds-checkbox", "ds-icon", "ds-input-validity"];
|
|
166
|
+
components.forEach(tagName => { switch (tagName) {
|
|
167
|
+
case "ds-checkbox":
|
|
168
|
+
if (!customElements.get(tagName)) {
|
|
169
|
+
customElements.define(tagName, DsCheckbox);
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case "ds-icon":
|
|
173
|
+
if (!customElements.get(tagName)) {
|
|
174
|
+
defineCustomElement$2();
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
case "ds-input-validity":
|
|
178
|
+
if (!customElements.get(tagName)) {
|
|
179
|
+
defineCustomElement$1();
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
} });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { DsCheckbox as D, defineCustomElement as d };
|
|
@@ -380,6 +380,16 @@ const TableIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48
|
|
|
380
380
|
|
|
381
381
|
const TableFillIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M450-328H95v233h355v-233Zm60 0v233h356v-233H510Zm-60-60v-234H95v234h355Zm60 0h356v-234H510v234ZM95-682h771v-184H95v184Z"/></svg>`;
|
|
382
382
|
|
|
383
|
+
const DSCheckSmall = `<svg width="16" height="13" viewBox="0 0 16 13" xmlns="http://www.w3.org/2000/svg">
|
|
384
|
+
<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" />
|
|
385
|
+
</svg>
|
|
386
|
+
`;
|
|
387
|
+
|
|
388
|
+
const DSCheckIndeterminateSmall = `<svg width="14" height="4" viewBox="0 0 14 4" xmlns="http://www.w3.org/2000/svg">
|
|
389
|
+
<rect width="13.3333" height="3" transform="matrix(1 0 0 -1 0.333313 3.5)" />
|
|
390
|
+
</svg>
|
|
391
|
+
`;
|
|
392
|
+
|
|
383
393
|
const category$6 = 'Information';
|
|
384
394
|
const icons$7 = [
|
|
385
395
|
{ name: 'calendar_month', component: CalendarMonthIcon, category: category$6 },
|
|
@@ -432,6 +442,8 @@ const icons$7 = [
|
|
|
432
442
|
{ name: 'pie_chart_fill', component: PieChartFillIcon, category: category$6 },
|
|
433
443
|
{ name: 'table', component: TableIcon, category: category$6 },
|
|
434
444
|
{ name: 'table_fill', component: TableFillIcon, category: category$6 },
|
|
445
|
+
{ name: 'ds_check_small', component: DSCheckSmall, category: category$6 },
|
|
446
|
+
{ name: 'ds_check_indeterminate_small', component: DSCheckIndeterminateSmall, category: category$6 },
|
|
435
447
|
];
|
|
436
448
|
|
|
437
449
|
const HomeIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M229-189h124v-258h254v258h124v-377L480-754 229-565.67V-189Zm-94 94v-518l345-259 346 259v518H524v-269h-88v269H135Zm345-377Z"/></svg>`;
|
|
@@ -865,10 +877,18 @@ const icons = [
|
|
|
865
877
|
...icons$1,
|
|
866
878
|
];
|
|
867
879
|
|
|
868
|
-
|
|
880
|
+
const formatAs = (value, suffix) => value.endsWith(suffix) ? value : `${value}${suffix}`;
|
|
881
|
+
const formatAsPx = (value) => formatAs(value, 'px');
|
|
882
|
+
const remToPx = (remString) => {
|
|
869
883
|
const rootFontSize = 16;
|
|
870
884
|
const rem = parseFloat(remString);
|
|
871
|
-
return `${rem * rootFontSize}
|
|
885
|
+
return formatAsPx(`${rem * rootFontSize}`);
|
|
886
|
+
};
|
|
887
|
+
function* idGenerator(id) {
|
|
888
|
+
let currentId = 1;
|
|
889
|
+
while (true) {
|
|
890
|
+
yield `${id}-${currentId++}`;
|
|
891
|
+
}
|
|
872
892
|
}
|
|
873
893
|
|
|
874
894
|
const dsIconCss = ":host{display:flex}.ds-icon--container{display:flex}";
|
|
@@ -926,7 +946,7 @@ const DsIcon = proxyCustomElement(class DsIcon extends H {
|
|
|
926
946
|
}
|
|
927
947
|
}
|
|
928
948
|
render() {
|
|
929
|
-
return (h(Fragment, { key: '
|
|
949
|
+
return (h(Fragment, { key: '3f68a522cda5ce59a62a8afa72c0c3305b0fb6e0' }, h("span", { key: 'cb6c204588d641e847c78bab7860e859d96dd300', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
|
|
930
950
|
}
|
|
931
951
|
static get style() { return DsIconStyle0; }
|
|
932
952
|
}, [1, "ds-icon", {
|
|
@@ -952,4 +972,4 @@ function defineCustomElement() {
|
|
|
952
972
|
} });
|
|
953
973
|
}
|
|
954
974
|
|
|
955
|
-
export { DsIcon as D, defineCustomElement as d };
|
|
975
|
+
export { DsIcon as D, defineCustomElement as d, idGenerator as i };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface DsInputValidity extends Components.DsInputValidity, HTMLElement {}
|
|
4
|
+
export const DsInputValidity: {
|
|
5
|
+
prototype: DsInputValidity;
|
|
6
|
+
new (): DsInputValidity;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h, F as Fragment } from './index2.js';
|
|
2
|
+
import { c as classNames } from './index3.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './ds-icon2.js';
|
|
4
|
+
|
|
5
|
+
const dsInputValidityCss = ":root{--ds-breakpoint-xSmall:20rem;--ds-breakpoint-small:30rem;--ds-breakpoint-medium:60rem;--ds-breakpoint-large:75rem;--ds-breakpoint-xLarge:90rem}.ds-input-validity{display:flex;align-items:center;margin-top:var(--ds-spacing-2xSmall);gap:var(--ds-spacing-2xSmall)}.ds-input-validity--error{color:var(--ds-textColor-danger)}.ds-input-validity--success{color:var(--ds-textColor-success)}.ds-input-validity ds-icon{display:block;height:1.5rem}.ds-input-validity small{font-family:var(--ds-fontFamily-body);font-size:var(--ds-fontSize-16);font-weight:var(--ds-fontWeight-regular);letter-spacing:var(--ds-letterSpacing-wide);line-height:var(--ds-lineHeight-large)}";
|
|
6
|
+
const DsInputValidityStyle0 = dsInputValidityCss;
|
|
7
|
+
|
|
8
|
+
const DsInputValidity = proxyCustomElement(class DsInputValidity extends H {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
}
|
|
13
|
+
get el() { return this; }
|
|
14
|
+
text;
|
|
15
|
+
type = 'error';
|
|
16
|
+
validityRole = 'status';
|
|
17
|
+
identifier;
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
this.identifier = this.el.getAttribute('id');
|
|
20
|
+
this.el.removeAttribute('id');
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const classes = classNames('ds-input-validity', {
|
|
24
|
+
'ds-input-validity--error': this.type === 'error',
|
|
25
|
+
'ds-input-validity--success': this.type === 'success',
|
|
26
|
+
});
|
|
27
|
+
const icon = this.type === 'success' ? 'check_circle_fill' : 'warning_fill';
|
|
28
|
+
if (!this.text) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return (h(Fragment, null, this.text && (h("div", { class: classes, role: this.validityRole }, h("ds-icon", { name: icon }), h("small", { id: this.identifier }, this.text)))));
|
|
32
|
+
}
|
|
33
|
+
static get style() { return DsInputValidityStyle0; }
|
|
34
|
+
}, [0, "ds-input-validity", {
|
|
35
|
+
"text": [1],
|
|
36
|
+
"type": [1],
|
|
37
|
+
"validityRole": [1, "role"],
|
|
38
|
+
"identifier": [32]
|
|
39
|
+
}]);
|
|
40
|
+
function defineCustomElement() {
|
|
41
|
+
if (typeof customElements === "undefined") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const components = ["ds-input-validity", "ds-icon"];
|
|
45
|
+
components.forEach(tagName => { switch (tagName) {
|
|
46
|
+
case "ds-input-validity":
|
|
47
|
+
if (!customElements.get(tagName)) {
|
|
48
|
+
customElements.define(tagName, DsInputValidity);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case "ds-icon":
|
|
52
|
+
if (!customElements.get(tagName)) {
|
|
53
|
+
defineCustomElement$1();
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
} });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { DsInputValidity as D, defineCustomElement as d };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './index2.js';
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
4
|
-
import { o as opensInNewTab, v as visuallyHiddenAssistiveText } from './linkUtils.js';
|
|
5
|
-
import { d as defineCustomElement$3 } from './ds-icon2.js';
|
|
2
|
+
import { c as classNames } from './index3.js';
|
|
3
|
+
import { i as inheritAriaAttributes } from './attributes.js';
|
|
4
|
+
import { o as opensInNewTab, v as visuallyHiddenAssistiveText, g as getAriaLabel } from './linkUtils.js';
|
|
5
|
+
import { 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}:
|
|
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-textColor-link);letter-spacing:var(--ds-letterSpacing-wide);font-weight:var(--ds-fontWeight-semibold);font-size:var(--ds-fontSize-16);text-decoration-line:none}.ds-link-with-arrow:focus-visible{box-shadow:0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);outline-color:var(--ds-borderColor-black);outline-offset:var(--ds-borderWidth-thin);outline-style:solid;outline-width:var(--ds-borderWidth-thin)}@media (min-width: 30rem){.ds-link-with-arrow{font-size:var(--ds-fontSize-18)}}.ds-link-with-arrow__icon{display:inline-flex;width:2em;height:2em;line-height:0;align-items:center;justify-content:center;color:var(--ds-textColor-white);background-color:var(--ds-bgColor-primary)}.ds-link-with-arrow__icon--start{margin-right:var(--ds-spacing-xSmall)}.ds-link-with-arrow__icon--end{margin-left:var(--ds-spacing-xSmall)}:hover slot>.ds-link-with-arrow__icon{outline:10px solid;background-color:var(--ds-bgColor-primary-hover)}:active slot>.ds-link-with-arrow__icon{background-color:var(--ds-bgColor-primary-active)}.ds-link-with-arrow:hover,.ds-link-with-arrow:active{text-decoration-line:underline;text-decoration-style:solid;text-decoration-skip-ink:auto;text-decoration-thickness:7%;text-underline-offset:12%;text-underline-position:from-font}.ds-link-with-arrow:hover{color:var(--ds-textColor-link-hover)}.ds-link-with-arrow:active,.ds-link-with-arrow:focus-visible{color:var(--ds-textColor-link-active)}";
|
|
9
9
|
const DsLinkWithArrowStyle0 = dsLinkWithArrowCss;
|
|
10
10
|
|
|
11
11
|
const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
|
|
@@ -25,8 +25,9 @@ const DsLinkWithArrow$1 = proxyCustomElement(class DsLinkWithArrow extends H {
|
|
|
25
25
|
href;
|
|
26
26
|
target;
|
|
27
27
|
language;
|
|
28
|
+
linkAriaLabel;
|
|
28
29
|
componentWillLoad() {
|
|
29
|
-
this.inheritedAttributes = inheritAriaAttributes(this.el);
|
|
30
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
|
|
30
31
|
if (opensInNewTab(this.target)) {
|
|
31
32
|
this.icon = 'arrow_outward';
|
|
32
33
|
this.rel = 'noopener noreferrer';
|
|
@@ -38,7 +39,7 @@ const DsLinkWithArrow$1 = proxyCustomElement(class DsLinkWithArrow extends H {
|
|
|
38
39
|
'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
|
|
39
40
|
'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
|
|
40
41
|
});
|
|
41
|
-
return (h("a", { key: '
|
|
42
|
+
return (h("a", { key: '5f43cc989011db22bd8f547957c76289e7bbbf45', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.linkAriaLabel), ...this.inheritedAttributes }, h("slot", { key: '26615467438d0ae98a8138165cf5152796f2ab00', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: 'f34a2d05ed9c991e98aaa89f547bde0c1b677115', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: 'be1ccadeaca632961ed3d44d1d94a26bf35d2963', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: '7bccce249754d661d9faeddbad2f9c4d8c207cfb', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '4e864244ee939591f435715889e2f9a240f86d36', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
|
|
42
43
|
}
|
|
43
44
|
static get style() { return DsLinkWithArrowStyle0; }
|
|
44
45
|
}, [1, "ds-link-with-arrow", {
|
|
@@ -46,7 +47,8 @@ const DsLinkWithArrow$1 = proxyCustomElement(class DsLinkWithArrow extends H {
|
|
|
46
47
|
"iconPosition": [1, "icon-position"],
|
|
47
48
|
"href": [1],
|
|
48
49
|
"target": [1],
|
|
49
|
-
"language": [1, "lang"]
|
|
50
|
+
"language": [1, "lang"],
|
|
51
|
+
"linkAriaLabel": [1, "aria-label"]
|
|
50
52
|
}]);
|
|
51
53
|
function defineCustomElement$1() {
|
|
52
54
|
if (typeof customElements === "undefined") {
|