@lmvz-ds/components 0.18.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +45 -100
- package/assets/icons/checkmark.svg +4 -0
- package/cjs/{aria-loader-CfFuAbJn.js → aria-loader-Cec1zR2g.js} +1 -1
- package/cjs/ds.constants-DSnxZ3ia.js +16 -0
- package/cjs/icons-BQASWgk-.js +80 -0
- package/cjs/{index--7IqZZqn.js → index-3g9Z9sfF.js} +765 -2854
- package/cjs/index.cjs.js +12 -12
- package/cjs/lmvz-button.cjs.entry.js +4 -4
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +113 -0
- package/cjs/lmvz-chip.cjs.entry.js +68 -4
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-header_2.cjs.entry.js +3 -3
- package/cjs/lmvz-icon.cjs.entry.js +10 -8
- package/cjs/lmvz-input.cjs.entry.js +4 -4
- package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
- package/cjs/lmvz-select.cjs.entry.js +3 -3
- package/cjs/loader.cjs.js +1 -1
- package/cjs/{logger-Bn2yoZGP.js → logger-DsM6xg6V.js} +3063 -833
- package/cjs/{reactive-controller-host-CtaVAiYJ.js → reactive-controller-host-BA4ZhjKA.js} +10 -10
- package/cjs/svg-BMBduILB.js +125 -0
- package/collection/api/ds.constants.js +2 -0
- package/collection/assets/icons/checkmark.svg +4 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-button/lmvz-button.css +1 -2
- package/collection/components/lmvz-button/lmvz-button.js +6 -3
- package/collection/components/lmvz-card/lmvz-card.css +1 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +207 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +424 -0
- package/collection/components/lmvz-chip/lmvz-chip.css +84 -1
- package/collection/components/lmvz-chip/lmvz-chip.js +110 -13
- package/collection/components/lmvz-header/lmvz-header.js +2 -2
- package/collection/components/lmvz-icon/lmvz-icon.css +11 -10
- package/collection/components/lmvz-icon/lmvz-icon.js +8 -7
- package/collection/components/lmvz-input/lmvz-input.js +4 -4
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +11 -5
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/index.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/utils/aria/aria-validation-controller.js +1 -0
- package/collection/utils/icons/icons.js +2 -13
- package/collection/utils/icons/icons.unit.js +3 -15
- package/collection/utils/reactive-controller-host.js +9 -9
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.d.ts +11 -0
- package/components/lmvz-checkbox.d.ts.bak +11 -0
- package/components/lmvz-checkbox.js +1 -0
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/p-0s99QfRy.js +12 -0
- package/components/{p-CBLAeife.js → p-BuFx0tTm.js} +1 -1
- package/components/p-CGmJG63p.js +1 -0
- package/components/p-CcxjkCOx.js +1 -0
- package/components/{p-DQEkWkMh.js → p-DIrAQ4IB.js} +1 -1
- package/esm/{aria-loader-BF_AYtbb.js → aria-loader-BVolm0lC.js} +1 -1
- package/esm/ds.constants-Bmi89ll1.js +9 -0
- package/esm/icons-CmuFKDRz.js +75 -0
- package/esm/{index-7Ru1khgk.js → index-Dh_9sN0q.js} +389 -2478
- package/esm/index.js +5 -11
- package/esm/lmvz-button.entry.js +4 -4
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +111 -0
- package/esm/lmvz-chip.entry.js +69 -5
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-icon.entry.js +10 -8
- package/esm/lmvz-input.entry.js +4 -4
- package/esm/lmvz-menuitem.entry.js +4 -4
- package/esm/lmvz-select.entry.js +3 -3
- package/esm/loader.js +1 -1
- package/esm/{logger-fiRXhuXK.js → logger-CGmJG63p.js} +2870 -765
- package/esm/{reactive-controller-host-sR2jJxNG.js → reactive-controller-host-DHcPpJW7.js} +10 -10
- package/esm/svg-B2YoIRuh.js +121 -0
- package/hydrate/index.js +2383 -42
- package/hydrate/index.mjs +2383 -42
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-5aa17cd2.entry.js → p-0f7a4236.entry.js} +1 -1
- package/lmvz-components/p-0s99QfRy.js +12 -0
- package/lmvz-components/{p-30b99f11.entry.js → p-2f83d7a2.entry.js} +1 -1
- package/lmvz-components/{p-6dbb3f13.entry.js → p-32171f4f.entry.js} +1 -1
- package/lmvz-components/{p-59383f3a.entry.js → p-400b2318.entry.js} +1 -1
- package/lmvz-components/p-851969bd.entry.js +1 -0
- package/lmvz-components/p-9f9d845d.entry.js +1 -0
- package/lmvz-components/p-Bmi89ll1.js +1 -0
- package/lmvz-components/p-CFsC37ww.js +1 -0
- package/lmvz-components/p-CGmJG63p.js +1 -0
- package/lmvz-components/p-CcxjkCOx.js +1 -0
- package/lmvz-components/{p-Bkfdgg0T.js → p-GdMr6Qlp.js} +1 -1
- package/lmvz-components/p-a12f95da.entry.js +1 -0
- package/lmvz-components/{p-84267405.entry.js → p-ab4437dc.entry.js} +1 -1
- package/lmvz-components/{p-7a6bec13.entry.js → p-d0a0e206.entry.js} +1 -1
- package/lmvz-components/{p-B3dnXEPG.js → p-dhVSUYqd.js} +1 -1
- package/manifest.json +544 -28
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +6 -1
- package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
- package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
- package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +39 -0
- package/types/components/lmvz-chip/lmvz-chip.d.ts +18 -3
- package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +0 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
- package/types/components/lmvz-select/lmvz-select.d.ts +0 -1
- package/types/components.d.ts +221 -12
- package/types/index.d.ts +1 -2
- package/types/utils/aria/aria-validation-controller.d.ts +1 -2
- package/types/utils/aria/element-activation-controller.d.ts +0 -1
- package/types/utils/aria/list-keyboard-controller.d.ts +0 -1
- package/types/utils/assets.d.ts +0 -1
- package/types/utils/component.d.ts +0 -1
- package/types/utils/environment.d.ts +0 -1
- package/types/utils/http.d.ts +0 -1
- package/types/utils/http.unit.d.ts +0 -1
- package/types/utils/icons/icons-registry.d.ts +0 -1
- package/types/utils/icons/icons.d.ts +0 -2
- package/types/utils/icons/icons.unit.d.ts +0 -1
- package/types/utils/icons/public.d.ts +0 -1
- package/types/utils/public.d.ts +0 -1
- package/types/utils/reactive-controller-host.d.ts +0 -1
- package/cjs/icons-swqMn6s2.js +0 -163
- package/components/p-DXOTa5VF.js +0 -12
- package/components/p-fiRXhuXK.js +0 -1
- package/esm/icons-Ca8oMiRa.js +0 -157
- package/lmvz-components/p-0a41cc24.entry.js +0 -1
- package/lmvz-components/p-5f150890.entry.js +0 -1
- package/lmvz-components/p-Bh2Epkwf.js +0 -1
- package/lmvz-components/p-DXOTa5VF.js +0 -12
- package/lmvz-components/p-fiRXhuXK.js +0 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { toValidSvgStringWithFallback } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
2
|
+
import { h, Host } from "@stencil/core";
|
|
3
|
+
import checkmark from "../../assets/icons/checkmark.svg";
|
|
4
|
+
import { AriaValidationController } from "../../utils/aria/aria-validation-controller";
|
|
5
|
+
import { ReactiveControllerHost } from "../../utils/reactive-controller-host";
|
|
6
|
+
const CHECKMARK_SVG = toValidSvgStringWithFallback(checkmark);
|
|
7
|
+
let checkboxIdCounter = 0;
|
|
8
|
+
export class LmvzCheckbox extends ReactiveControllerHost {
|
|
9
|
+
el;
|
|
10
|
+
get validationEl() {
|
|
11
|
+
return this.el;
|
|
12
|
+
}
|
|
13
|
+
internals;
|
|
14
|
+
nativeInput;
|
|
15
|
+
checkboxId = `lmvz-checkbox-${checkboxIdCounter++}`;
|
|
16
|
+
initialChecked = false;
|
|
17
|
+
get helperId() {
|
|
18
|
+
return this.helperText ? `${this.checkboxId}-helper` : undefined;
|
|
19
|
+
}
|
|
20
|
+
get errorId() {
|
|
21
|
+
return this.errorMessage ? `${this.checkboxId}-error` : undefined;
|
|
22
|
+
}
|
|
23
|
+
get ariaDescribedBy() {
|
|
24
|
+
const ids = [this.errorId, this.helperId].filter(Boolean);
|
|
25
|
+
return ids.length > 0 ? ids.join(' ') : undefined;
|
|
26
|
+
}
|
|
27
|
+
label;
|
|
28
|
+
checked = false;
|
|
29
|
+
value = 'on';
|
|
30
|
+
name;
|
|
31
|
+
disabled = false;
|
|
32
|
+
required = false;
|
|
33
|
+
error = false;
|
|
34
|
+
errorMessage;
|
|
35
|
+
helperText;
|
|
36
|
+
form;
|
|
37
|
+
autofocus = false;
|
|
38
|
+
checkedState = false;
|
|
39
|
+
handleCheckedChange(val) {
|
|
40
|
+
this.checkedState = val;
|
|
41
|
+
this.internals.setFormValue?.(val ? (this.value ?? 'on') : null);
|
|
42
|
+
}
|
|
43
|
+
lmvzChange;
|
|
44
|
+
async focusInput() {
|
|
45
|
+
this.nativeInput?.focus();
|
|
46
|
+
}
|
|
47
|
+
async checkValidity() {
|
|
48
|
+
return this.internals?.checkValidity() ?? true;
|
|
49
|
+
}
|
|
50
|
+
async reportValidity() {
|
|
51
|
+
return this.internals?.reportValidity() ?? true;
|
|
52
|
+
}
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
this.addController(new AriaValidationController(this, {
|
|
56
|
+
reValidateOnPropChanges: true,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
componentWillLoad() {
|
|
60
|
+
this.initialChecked = this.checked;
|
|
61
|
+
this.checkedState = this.checked;
|
|
62
|
+
this.internals.setFormValue?.(this.checked ? (this.value ?? 'on') : null);
|
|
63
|
+
super.componentWillLoad();
|
|
64
|
+
}
|
|
65
|
+
componentWillRender() {
|
|
66
|
+
if (this.error && !this.errorMessage) {
|
|
67
|
+
console.warn('lmvz-checkbox: error=true set without errorMessage — no visual-only error state is rendered. Provide errorMessage to communicate the error to users.');
|
|
68
|
+
}
|
|
69
|
+
super.componentWillRender();
|
|
70
|
+
}
|
|
71
|
+
formAssociatedCallback() {
|
|
72
|
+
this.internals.setFormValue?.(this.checked ? (this.value ?? 'on') : null);
|
|
73
|
+
}
|
|
74
|
+
formResetCallback() {
|
|
75
|
+
this.checked = this.initialChecked;
|
|
76
|
+
}
|
|
77
|
+
formStateRestoreCallback(state) {
|
|
78
|
+
this.checked = state === (this.value ?? 'on');
|
|
79
|
+
}
|
|
80
|
+
handleChange = (event) => {
|
|
81
|
+
const input = event.target;
|
|
82
|
+
this.checked = input.checked;
|
|
83
|
+
this.lmvzChange.emit(this.checked);
|
|
84
|
+
};
|
|
85
|
+
render() {
|
|
86
|
+
return (h(Host, { key: '6014c885305bc9824f7a6d4f0ba8c642125f3a5b' }, h("div", { key: 'cbc6de2b684acfb00b77a366e707d73de74a0b8a', class: "pill" }, h("input", { key: '5b442512b6cab2e60a1d62fd40e4c868b1bf87ac', type: "checkbox", id: this.checkboxId, checked: this.checkedState, disabled: this.disabled, required: this.required, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": this.ariaDescribedBy, "aria-errormessage": this.error && this.errorId ? this.errorId : undefined, ref: (el) => (this.nativeInput = el), onChange: this.handleChange, autoFocus: this.autofocus }), h("span", { key: '09c534b7c5642c620129ea05a4468bd584c56ce7', class: "box", "aria-hidden": "true" }, this.checkedState && h("span", { key: 'eaa49e1a60054f8efc62ade0446a4704f0bb46e9', class: "indicator", innerHTML: CHECKMARK_SVG })), h("span", { key: '8fb836d71cbb3d4eadaf67284f5bb52906549275', class: "content" }, h("label", { key: '8df862f11e9885158264908fdac6599f21ecba07', htmlFor: this.checkboxId }, this.label), this.helperText && (h("span", { key: '1e45e6177774e937311cddacd1a3d3379c9c6af5', class: "helper-text", id: this.helperId, role: "status" }, this.helperText)))), this.errorMessage && (h("span", { key: '83fc1f7cd6828973e52ef27604f12f94f41d7f4b', class: "error-text", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
87
|
+
}
|
|
88
|
+
static get is() { return "lmvz-checkbox"; }
|
|
89
|
+
static get encapsulation() { return "scoped"; }
|
|
90
|
+
static get formAssociated() { return true; }
|
|
91
|
+
static get originalStyleUrls() {
|
|
92
|
+
return {
|
|
93
|
+
"$": ["./lmvz-checkbox.css"]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
static get styleUrls() {
|
|
97
|
+
return {
|
|
98
|
+
"$": ["lmvz-checkbox.css"]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
static get properties() {
|
|
102
|
+
return {
|
|
103
|
+
"label": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "string",
|
|
108
|
+
"resolved": "string",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": true,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Label text for the checkbox. Required for accessibility."
|
|
116
|
+
},
|
|
117
|
+
"getter": false,
|
|
118
|
+
"setter": false,
|
|
119
|
+
"reflect": false,
|
|
120
|
+
"attribute": "label"
|
|
121
|
+
},
|
|
122
|
+
"checked": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"mutable": true,
|
|
125
|
+
"complexType": {
|
|
126
|
+
"original": "boolean",
|
|
127
|
+
"resolved": "boolean",
|
|
128
|
+
"references": {}
|
|
129
|
+
},
|
|
130
|
+
"required": false,
|
|
131
|
+
"optional": false,
|
|
132
|
+
"docs": {
|
|
133
|
+
"tags": [{
|
|
134
|
+
"name": "default",
|
|
135
|
+
"text": "false"
|
|
136
|
+
}],
|
|
137
|
+
"text": "Whether the checkbox is checked."
|
|
138
|
+
},
|
|
139
|
+
"getter": false,
|
|
140
|
+
"setter": false,
|
|
141
|
+
"reflect": true,
|
|
142
|
+
"attribute": "checked",
|
|
143
|
+
"defaultValue": "false"
|
|
144
|
+
},
|
|
145
|
+
"value": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [{
|
|
157
|
+
"name": "default",
|
|
158
|
+
"text": "'on'"
|
|
159
|
+
}],
|
|
160
|
+
"text": "Form submission value when checked."
|
|
161
|
+
},
|
|
162
|
+
"getter": false,
|
|
163
|
+
"setter": false,
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"attribute": "value",
|
|
166
|
+
"defaultValue": "'on'"
|
|
167
|
+
},
|
|
168
|
+
"name": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"mutable": false,
|
|
171
|
+
"complexType": {
|
|
172
|
+
"original": "string",
|
|
173
|
+
"resolved": "string | undefined",
|
|
174
|
+
"references": {}
|
|
175
|
+
},
|
|
176
|
+
"required": false,
|
|
177
|
+
"optional": true,
|
|
178
|
+
"docs": {
|
|
179
|
+
"tags": [],
|
|
180
|
+
"text": "Name attribute for form submission via ElementInternals."
|
|
181
|
+
},
|
|
182
|
+
"getter": false,
|
|
183
|
+
"setter": false,
|
|
184
|
+
"reflect": false,
|
|
185
|
+
"attribute": "name"
|
|
186
|
+
},
|
|
187
|
+
"disabled": {
|
|
188
|
+
"type": "boolean",
|
|
189
|
+
"mutable": false,
|
|
190
|
+
"complexType": {
|
|
191
|
+
"original": "boolean",
|
|
192
|
+
"resolved": "boolean",
|
|
193
|
+
"references": {}
|
|
194
|
+
},
|
|
195
|
+
"required": false,
|
|
196
|
+
"optional": false,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [{
|
|
199
|
+
"name": "default",
|
|
200
|
+
"text": "false"
|
|
201
|
+
}],
|
|
202
|
+
"text": "Whether the checkbox is disabled."
|
|
203
|
+
},
|
|
204
|
+
"getter": false,
|
|
205
|
+
"setter": false,
|
|
206
|
+
"reflect": true,
|
|
207
|
+
"attribute": "disabled",
|
|
208
|
+
"defaultValue": "false"
|
|
209
|
+
},
|
|
210
|
+
"required": {
|
|
211
|
+
"type": "boolean",
|
|
212
|
+
"mutable": false,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "boolean",
|
|
215
|
+
"resolved": "boolean",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": false,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [{
|
|
222
|
+
"name": "default",
|
|
223
|
+
"text": "false"
|
|
224
|
+
}],
|
|
225
|
+
"text": "Whether the checkbox is required."
|
|
226
|
+
},
|
|
227
|
+
"getter": false,
|
|
228
|
+
"setter": false,
|
|
229
|
+
"reflect": true,
|
|
230
|
+
"attribute": "required",
|
|
231
|
+
"defaultValue": "false"
|
|
232
|
+
},
|
|
233
|
+
"error": {
|
|
234
|
+
"type": "boolean",
|
|
235
|
+
"mutable": false,
|
|
236
|
+
"complexType": {
|
|
237
|
+
"original": "boolean",
|
|
238
|
+
"resolved": "boolean",
|
|
239
|
+
"references": {}
|
|
240
|
+
},
|
|
241
|
+
"required": false,
|
|
242
|
+
"optional": false,
|
|
243
|
+
"docs": {
|
|
244
|
+
"tags": [{
|
|
245
|
+
"name": "default",
|
|
246
|
+
"text": "false"
|
|
247
|
+
}],
|
|
248
|
+
"text": "Whether the checkbox is in an error state."
|
|
249
|
+
},
|
|
250
|
+
"getter": false,
|
|
251
|
+
"setter": false,
|
|
252
|
+
"reflect": true,
|
|
253
|
+
"attribute": "error",
|
|
254
|
+
"defaultValue": "false"
|
|
255
|
+
},
|
|
256
|
+
"errorMessage": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string | undefined",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": true,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Error message displayed when error is true. Required when error=true."
|
|
269
|
+
},
|
|
270
|
+
"getter": false,
|
|
271
|
+
"setter": false,
|
|
272
|
+
"reflect": false,
|
|
273
|
+
"attribute": "error-message"
|
|
274
|
+
},
|
|
275
|
+
"helperText": {
|
|
276
|
+
"type": "string",
|
|
277
|
+
"mutable": false,
|
|
278
|
+
"complexType": {
|
|
279
|
+
"original": "string",
|
|
280
|
+
"resolved": "string | undefined",
|
|
281
|
+
"references": {}
|
|
282
|
+
},
|
|
283
|
+
"required": false,
|
|
284
|
+
"optional": true,
|
|
285
|
+
"docs": {
|
|
286
|
+
"tags": [],
|
|
287
|
+
"text": "Helper / description text displayed below the label."
|
|
288
|
+
},
|
|
289
|
+
"getter": false,
|
|
290
|
+
"setter": false,
|
|
291
|
+
"reflect": false,
|
|
292
|
+
"attribute": "helper-text"
|
|
293
|
+
},
|
|
294
|
+
"form": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"mutable": false,
|
|
297
|
+
"complexType": {
|
|
298
|
+
"original": "string",
|
|
299
|
+
"resolved": "string | undefined",
|
|
300
|
+
"references": {}
|
|
301
|
+
},
|
|
302
|
+
"required": false,
|
|
303
|
+
"optional": true,
|
|
304
|
+
"docs": {
|
|
305
|
+
"tags": [],
|
|
306
|
+
"text": "Form id to associate with (for out-of-form usage)."
|
|
307
|
+
},
|
|
308
|
+
"getter": false,
|
|
309
|
+
"setter": false,
|
|
310
|
+
"reflect": false,
|
|
311
|
+
"attribute": "form"
|
|
312
|
+
},
|
|
313
|
+
"autofocus": {
|
|
314
|
+
"type": "boolean",
|
|
315
|
+
"mutable": false,
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "boolean",
|
|
318
|
+
"resolved": "boolean",
|
|
319
|
+
"references": {}
|
|
320
|
+
},
|
|
321
|
+
"required": false,
|
|
322
|
+
"optional": false,
|
|
323
|
+
"docs": {
|
|
324
|
+
"tags": [{
|
|
325
|
+
"name": "default",
|
|
326
|
+
"text": "false"
|
|
327
|
+
}],
|
|
328
|
+
"text": "Whether the checkbox should autofocus."
|
|
329
|
+
},
|
|
330
|
+
"getter": false,
|
|
331
|
+
"setter": false,
|
|
332
|
+
"reflect": false,
|
|
333
|
+
"attribute": "autofocus",
|
|
334
|
+
"defaultValue": "false"
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
static get states() {
|
|
339
|
+
return {
|
|
340
|
+
"checkedState": {}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
static get events() {
|
|
344
|
+
return [{
|
|
345
|
+
"method": "lmvzChange",
|
|
346
|
+
"name": "lmvzChange",
|
|
347
|
+
"bubbles": true,
|
|
348
|
+
"cancelable": true,
|
|
349
|
+
"composed": true,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Emitted whenever the checkbox checked state changes.\nEvent detail contains the new checked boolean value."
|
|
353
|
+
},
|
|
354
|
+
"complexType": {
|
|
355
|
+
"original": "boolean",
|
|
356
|
+
"resolved": "boolean",
|
|
357
|
+
"references": {}
|
|
358
|
+
}
|
|
359
|
+
}];
|
|
360
|
+
}
|
|
361
|
+
static get methods() {
|
|
362
|
+
return {
|
|
363
|
+
"focusInput": {
|
|
364
|
+
"complexType": {
|
|
365
|
+
"signature": "() => Promise<void>",
|
|
366
|
+
"parameters": [],
|
|
367
|
+
"references": {
|
|
368
|
+
"Promise": {
|
|
369
|
+
"location": "global",
|
|
370
|
+
"id": "global::Promise"
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
"return": "Promise<void>"
|
|
374
|
+
},
|
|
375
|
+
"docs": {
|
|
376
|
+
"text": "Sets focus on the native checkbox input.",
|
|
377
|
+
"tags": []
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"checkValidity": {
|
|
381
|
+
"complexType": {
|
|
382
|
+
"signature": "() => Promise<boolean>",
|
|
383
|
+
"parameters": [],
|
|
384
|
+
"references": {
|
|
385
|
+
"Promise": {
|
|
386
|
+
"location": "global",
|
|
387
|
+
"id": "global::Promise"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"return": "Promise<boolean>"
|
|
391
|
+
},
|
|
392
|
+
"docs": {
|
|
393
|
+
"text": "Returns whether the checkbox satisfies its validation constraints.",
|
|
394
|
+
"tags": []
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
"reportValidity": {
|
|
398
|
+
"complexType": {
|
|
399
|
+
"signature": "() => Promise<boolean>",
|
|
400
|
+
"parameters": [],
|
|
401
|
+
"references": {
|
|
402
|
+
"Promise": {
|
|
403
|
+
"location": "global",
|
|
404
|
+
"id": "global::Promise"
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
"return": "Promise<boolean>"
|
|
408
|
+
},
|
|
409
|
+
"docs": {
|
|
410
|
+
"text": "Reports validation errors to the user.",
|
|
411
|
+
"tags": []
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
static get elementRef() { return "el"; }
|
|
417
|
+
static get watchers() {
|
|
418
|
+
return [{
|
|
419
|
+
"propName": "checked",
|
|
420
|
+
"methodName": "handleCheckedChange"
|
|
421
|
+
}];
|
|
422
|
+
}
|
|
423
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
424
|
+
}
|
|
@@ -1,3 +1,86 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
|
|
2
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-neutral-subtle, #d4d4d4);
|
|
3
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-neutral, #fcfcfc);
|
|
4
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-neutral, #545454);
|
|
5
|
+
|
|
6
|
+
padding-block: var(--lmvz-dimension-4-6, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem));
|
|
7
|
+
padding-inline: var(--lmvz-dimension-8-10, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem));
|
|
8
|
+
border: 1px solid var(--lmvz-chip-border-color);
|
|
9
|
+
border-radius: var(--lmvz-semantic-border-radius-round, 999px);
|
|
10
|
+
font: var(--lmvz-typography-body-xs-strong, 500 clamp(0.69rem, 0.67rem + 0.06vw, 0.75rem) / 1.4
|
|
11
|
+
Router);
|
|
12
|
+
background-color: var(--lmvz-chip-background-color);
|
|
13
|
+
color: var(--lmvz-chip-foreground-color);
|
|
14
|
+
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
gap: var(--lmvz-dimension-4-6, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem));
|
|
19
|
+
|
|
20
|
+
/* enable truncated content */
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
|
|
26
|
+
> .content-overflow-wrapper {
|
|
27
|
+
min-width: 0;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([size='small']) {
|
|
35
|
+
padding-block: var(--lmvz-dimension-2-4, clamp(0.13rem, 0.09rem + 0.13vw, 0.25rem));
|
|
36
|
+
padding-inline: var(--lmvz-dimension-6-8, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem));
|
|
37
|
+
font: var(--lmvz-typography-body-2xs-strong, 500 clamp(0.63rem, 0.61rem + 0.06vw, 0.69rem) / 1.4
|
|
38
|
+
Router);
|
|
39
|
+
gap: var(--lmvz-dimension-2-4, clamp(0.13rem, 0.09rem + 0.13vw, 0.25rem));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
::slotted(*) {
|
|
43
|
+
/* non-inline contents are forbidden for chips */
|
|
44
|
+
/* TODO: validate using ARIA validation tooling, instead of overriding styles */
|
|
45
|
+
display: inline;
|
|
46
|
+
white-space: inherit;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
::slotted(lmvz-icon) {
|
|
50
|
+
--lmvz-component-color: var(--lmvz-chip-foreground-color);
|
|
51
|
+
--lmvz-component-size: var(--lmvz-dimension-12-14, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host([size='small']) ::slotted(lmvz-icon) {
|
|
55
|
+
--lmvz-component-size: var(--lmvz-dimension-10-12, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([type='active']) {
|
|
59
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-active-subtle, #c1e6fa);
|
|
60
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-active, #f1f9fe);
|
|
61
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([type='warning']) {
|
|
65
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-warning-subtle, #ffdf75);
|
|
66
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-warning, #fffbf0);
|
|
67
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-warning, #7a5e00);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([type='success']) {
|
|
71
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-success-subtle, #a5dad3);
|
|
72
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-success, #f1f9f8);
|
|
73
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-success, #37867c);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([type='error']) {
|
|
77
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-danger-subtle, #f7bfc2);
|
|
78
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-danger, #fdf1f2);
|
|
79
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-danger, #e52a31);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([type='neutral']) {
|
|
83
|
+
--lmvz-chip-border-color: var(--lmvz-semantic-color-status-on-neutral-subtle, #d4d4d4);
|
|
84
|
+
--lmvz-chip-background-color: var(--lmvz-semantic-color-status-neutral, #fcfcfc);
|
|
85
|
+
--lmvz-chip-foreground-color: var(--lmvz-semantic-color-status-on-neutral, #545454);
|
|
3
86
|
}
|
|
@@ -1,8 +1,54 @@
|
|
|
1
|
+
import { debounce } from "@lmvz-ds/lib-ts/stream/debounce.js";
|
|
1
2
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
import { chipSizes, chipTypes } from "../../api/ds.constants.js";
|
|
4
|
+
import { AriaValidationController, isAriaValidationEnabled } from "../../utils/aria/aria-validation-controller";
|
|
5
|
+
import { ReactiveControllerHost } from "../../utils/reactive-controller-host";
|
|
6
|
+
export class LmvzChip extends ReactiveControllerHost {
|
|
7
|
+
ariaValidationController = new AriaValidationController(this);
|
|
8
|
+
beforeSlot;
|
|
9
|
+
defaultSlot;
|
|
10
|
+
afterSlot;
|
|
11
|
+
el;
|
|
12
|
+
get validationEl() {
|
|
13
|
+
return this.el;
|
|
14
|
+
}
|
|
15
|
+
type = 'active';
|
|
16
|
+
size = 'default';
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.addController(this.ariaValidationController);
|
|
20
|
+
}
|
|
21
|
+
normalizeType(value) {
|
|
22
|
+
const normalizedType = chipTypes.includes(value) ? value : 'active';
|
|
23
|
+
if (normalizedType !== this.type) {
|
|
24
|
+
this.type = normalizedType;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
normalizeSize(value) {
|
|
28
|
+
const normalizedSize = chipSizes.includes(value) ? value : 'default';
|
|
29
|
+
if (normalizedSize !== this.size) {
|
|
30
|
+
this.size = normalizedSize;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
componentWillLoad() {
|
|
34
|
+
this.normalizeType(this.type);
|
|
35
|
+
this.normalizeSize(this.size);
|
|
36
|
+
super.componentWillLoad();
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.checkContent();
|
|
41
|
+
}
|
|
42
|
+
checkContent = debounce(() => {
|
|
43
|
+
if (!isAriaValidationEnabled)
|
|
44
|
+
return;
|
|
45
|
+
const elements = [...(this.beforeSlot?.assignedElements() ?? []), ...(this.defaultSlot?.assignedElements() ?? []), ...(this.afterSlot?.assignedElements() ?? [])];
|
|
46
|
+
if (!elements.length) {
|
|
47
|
+
console.warn('LmvzChip has no assigned content. Please add content to the default slot or the before-text/after-text slots.');
|
|
48
|
+
}
|
|
49
|
+
}, 500);
|
|
4
50
|
render() {
|
|
5
|
-
return h(Host, { key: '
|
|
51
|
+
return (h(Host, { key: 'c77e8ae55531eefb31dd37b41b4851746a78f077', type: this.type, size: this.size }, h("slot", { key: '3f4d0a8feb887080172d11facc01afbe730b2726', name: "before-text", ref: (el) => (this.beforeSlot = el), onSlotchange: () => this.checkContent() }), h("span", { key: '6ec135ebcb32f15fea342379ac2b1dfebbe76fa6', class: "content-overflow-wrapper" }, h("slot", { key: '053afb88e2d6702428aab195bfcec6aff6d9c55f', ref: (el) => (this.defaultSlot = el), onSlotchange: () => this.checkContent() })), h("slot", { key: 'ed51db073a512a32d12da59dee285708b83ae87b', name: "after-text", ref: (el) => (this.afterSlot = el), onSlotchange: () => this.checkContent() })));
|
|
6
52
|
}
|
|
7
53
|
static get is() { return "lmvz-chip"; }
|
|
8
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -18,25 +64,76 @@ export class LmvzChip {
|
|
|
18
64
|
}
|
|
19
65
|
static get properties() {
|
|
20
66
|
return {
|
|
21
|
-
"
|
|
67
|
+
"type": {
|
|
22
68
|
"type": "string",
|
|
23
|
-
"mutable":
|
|
69
|
+
"mutable": true,
|
|
24
70
|
"complexType": {
|
|
25
|
-
"original": "
|
|
26
|
-
"resolved": "
|
|
27
|
-
"references": {
|
|
71
|
+
"original": "Chip.Type",
|
|
72
|
+
"resolved": "\"active\" | \"error\" | \"neutral\" | \"success\" | \"warning\"",
|
|
73
|
+
"references": {
|
|
74
|
+
"Chip": {
|
|
75
|
+
"location": "import",
|
|
76
|
+
"path": "../../api/ds.constants.js",
|
|
77
|
+
"id": "src/api/ds.constants.ts::Chip",
|
|
78
|
+
"referenceLocation": "Chip"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
28
81
|
},
|
|
29
|
-
"required":
|
|
82
|
+
"required": false,
|
|
30
83
|
"optional": false,
|
|
31
84
|
"docs": {
|
|
32
|
-
"tags": [
|
|
33
|
-
|
|
85
|
+
"tags": [{
|
|
86
|
+
"name": "default",
|
|
87
|
+
"text": "'active'"
|
|
88
|
+
}],
|
|
89
|
+
"text": "Semantic variant of the chip.\nInvalid values are normalized to `active` at runtime."
|
|
34
90
|
},
|
|
35
91
|
"getter": false,
|
|
36
92
|
"setter": false,
|
|
37
|
-
"reflect":
|
|
38
|
-
"attribute": "
|
|
93
|
+
"reflect": true,
|
|
94
|
+
"attribute": "type",
|
|
95
|
+
"defaultValue": "'active'"
|
|
96
|
+
},
|
|
97
|
+
"size": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"mutable": true,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "Chip.Size",
|
|
102
|
+
"resolved": "\"default\" | \"small\"",
|
|
103
|
+
"references": {
|
|
104
|
+
"Chip": {
|
|
105
|
+
"location": "import",
|
|
106
|
+
"path": "../../api/ds.constants.js",
|
|
107
|
+
"id": "src/api/ds.constants.ts::Chip",
|
|
108
|
+
"referenceLocation": "Chip"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": false,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [{
|
|
116
|
+
"name": "default",
|
|
117
|
+
"text": "'default'"
|
|
118
|
+
}],
|
|
119
|
+
"text": "Size variant of the chip.\nInvalid values are normalized to `default` at runtime."
|
|
120
|
+
},
|
|
121
|
+
"getter": false,
|
|
122
|
+
"setter": false,
|
|
123
|
+
"reflect": true,
|
|
124
|
+
"attribute": "size",
|
|
125
|
+
"defaultValue": "'default'"
|
|
39
126
|
}
|
|
40
127
|
};
|
|
41
128
|
}
|
|
129
|
+
static get elementRef() { return "el"; }
|
|
130
|
+
static get watchers() {
|
|
131
|
+
return [{
|
|
132
|
+
"propName": "type",
|
|
133
|
+
"methodName": "normalizeType"
|
|
134
|
+
}, {
|
|
135
|
+
"propName": "size",
|
|
136
|
+
"methodName": "normalizeSize"
|
|
137
|
+
}];
|
|
138
|
+
}
|
|
42
139
|
}
|
|
@@ -84,7 +84,7 @@ export class LmvzHeader extends ReactiveControllerHost {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: '87ecb9948039ea2f4b998bf35865e5839708a65c', onFocus: this.delegateFocus.bind(this) }, h("div", { key: '4f1ae09b1a3e0a9c3eb12659b3952eef34cbd67b', class: "brand" }, h("slot", { key: '99c03f87f0b3462d9b44835ba34ee05c75373b22', name: "brand" }, h("img", { key: '1616ce8464c2e798a53bc7c879385e3882e4d32f', id: "fallback-logo-lmvz", src: logo, alt: "Lehrmittelverlag Z\u00FCrich" }))), h("nav", { key: 'ff7c56dbc9e80ba9a0757683069e1cba168abcb6', "aria-label": "Hauptnavigation" }, h("div", { key: 'a3bb67d788b936422992b066431c73098ff2aa11', role: "menubar", class: "primary-menubar" }, h("slot", { key: 'e85b93f943c6d97bd5a7fa6f75e4855785d09ec5', name: "nav-primary", ref: (el) => (this.primarySlot = el) }), h("div", { key: 'e9efcfc5d3a8cb991c255b32b205924dafb5aaf6', role: "menu", id: "nav-secondary", class: "secondary-menubar", hidden: !this.lmvzActiveNav, ref: (el) => (this.secondaryNav = el) }, h("slot", { key: '7314e6a72705d48b347fa30945b1d5513b87bfd3', name: this.secondarySlotName, ref: (el) => (this.secondarySlot = el) })))), h("div", { key: 'aee503cddbf8964833934e594caf5faa6e073a02', class: "actions" }, h("slot", { key: '5c1b15c0507ef24f67e37cd1652b4cc5ce4cc104', name: "actions" }))));
|
|
88
88
|
}
|
|
89
89
|
static get is() { return "lmvz-header"; }
|
|
90
90
|
static get encapsulation() { return "shadow"; }
|
|
@@ -132,7 +132,7 @@ export class LmvzHeader extends ReactiveControllerHost {
|
|
|
132
132
|
"optional": true,
|
|
133
133
|
"docs": {
|
|
134
134
|
"tags": [],
|
|
135
|
-
"text": ""
|
|
135
|
+
"text": "Id of the currently active primary navigation item.\nAlso determines which `connect-nav-*` secondary slot is shown."
|
|
136
136
|
},
|
|
137
137
|
"getter": false,
|
|
138
138
|
"setter": false,
|