@lmvz-ds/components 0.19.0 → 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 +10 -0
- package/assets/icons/checkmark.svg +4 -0
- package/cjs/{aria-loader-CfFuAbJn.js → aria-loader-Cec1zR2g.js} +1 -1
- package/cjs/icons-BQASWgk-.js +80 -0
- package/cjs/{index--7IqZZqn.js → index-3g9Z9sfF.js} +765 -2854
- package/cjs/index.cjs.js +4 -3
- package/cjs/lmvz-button.cjs.entry.js +3 -3
- 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 +3 -3
- 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 +9 -7
- 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-Bi9eu2bV.js → reactive-controller-host-BA4ZhjKA.js} +1 -1
- package/cjs/{icons-Tg7ySOh-.js → svg-BMBduILB.js} +31 -85
- 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-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.js +1 -1
- package/collection/components/lmvz-header/lmvz-header.js +1 -1
- package/collection/components/lmvz-icon/lmvz-icon.js +5 -5
- package/collection/components/lmvz-input/lmvz-input.js +2 -2
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +1 -1
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/utils/icons/icons.js +2 -13
- package/collection/utils/icons/icons.unit.js +3 -15
- 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-DbeHBSOe.js → p-BuFx0tTm.js} +1 -1
- package/components/p-CGmJG63p.js +1 -0
- package/components/p-CcxjkCOx.js +1 -0
- package/esm/{aria-loader-CES8Ae1e.js → aria-loader-BVolm0lC.js} +1 -1
- package/esm/icons-CmuFKDRz.js +75 -0
- package/esm/{index-BvxaUA12.js → index-Dh_9sN0q.js} +389 -2478
- package/esm/index.js +4 -3
- package/esm/lmvz-button.entry.js +3 -3
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +111 -0
- package/esm/lmvz-chip.entry.js +3 -3
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-icon.entry.js +9 -7
- 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-0bL3pydp.js → logger-CGmJG63p.js} +2870 -765
- package/esm/{reactive-controller-host-J2thAxVH.js → reactive-controller-host-DHcPpJW7.js} +1 -1
- package/esm/{icons-Bj4dF1-I.js → svg-B2YoIRuh.js} +29 -80
- package/hydrate/index.js +2441 -165
- package/hydrate/index.mjs +2441 -165
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-ec96c6b6.entry.js → p-0f7a4236.entry.js} +1 -1
- package/lmvz-components/p-0s99QfRy.js +12 -0
- package/lmvz-components/p-2f83d7a2.entry.js +1 -0
- package/lmvz-components/{p-6e8acbd9.entry.js → p-32171f4f.entry.js} +1 -1
- package/lmvz-components/{p-9212bd23.entry.js → p-400b2318.entry.js} +1 -1
- package/lmvz-components/{p-9626e951.entry.js → p-851969bd.entry.js} +1 -1
- package/lmvz-components/p-9f9d845d.entry.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-BxHnZA0M.js → p-GdMr6Qlp.js} +1 -1
- package/lmvz-components/p-a12f95da.entry.js +1 -0
- package/lmvz-components/{p-e1b847d2.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-DYaffOLo.js → p-dhVSUYqd.js} +1 -1
- package/manifest.json +410 -1
- package/package.json +5 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +39 -0
- package/types/components.d.ts +151 -0
- package/types/utils/icons/icons.d.ts +0 -1
- package/components/p-DXOTa5VF.js +0 -12
- package/components/p-fiRXhuXK.js +0 -1
- package/lmvz-components/p-0bL3pydp.js +0 -1
- package/lmvz-components/p-40569208.entry.js +0 -1
- package/lmvz-components/p-49ab22bd.entry.js +0 -1
- package/lmvz-components/p-Bu4Z_PMf.js +0 -1
- package/lmvz-components/p-DHZwxmLb.js +0 -12
|
@@ -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
|
+
}
|
|
@@ -48,7 +48,7 @@ export class LmvzChip extends ReactiveControllerHost {
|
|
|
48
48
|
}
|
|
49
49
|
}, 500);
|
|
50
50
|
render() {
|
|
51
|
-
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() })));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "lmvz-chip"; }
|
|
54
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -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"; }
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseSvgString } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
2
2
|
import { Build, h, Host } from "@stencil/core";
|
|
3
|
-
import { Micro } from "effect";
|
|
4
3
|
import { AriaValidationController } from "../../utils/aria/aria-validation-controller";
|
|
5
4
|
import { resolveIconSvg } from "../../utils/icons/icons";
|
|
6
5
|
import { ReactiveControllerHost } from "../../utils/reactive-controller-host";
|
|
@@ -42,8 +41,9 @@ export class LmvzIcon extends ReactiveControllerHost {
|
|
|
42
41
|
if (!Build.isBrowser || !icon || !visible) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const maybeIcon = parseSvgString(icon);
|
|
45
|
+
if (maybeIcon) {
|
|
46
|
+
this.iconData = maybeIcon;
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
this.iconData = await resolveIconSvg({
|
|
@@ -57,7 +57,7 @@ export class LmvzIcon extends ReactiveControllerHost {
|
|
|
57
57
|
super.componentDidRender();
|
|
58
58
|
}
|
|
59
59
|
render() {
|
|
60
|
-
return h(Host, { key: '
|
|
60
|
+
return h(Host, { key: 'e76fe28500b3545b8917ecdad590da5bc04ed38f', role: "img", "aria-hidden": `${this.ariaHidden}`, innerHTML: this.iconData });
|
|
61
61
|
}
|
|
62
62
|
waitUntilVisible(callback, rootMargin = 50) {
|
|
63
63
|
if (!Build.isBrowser || typeof window === 'undefined' || !window.IntersectionObserver) {
|
|
@@ -150,9 +150,9 @@ export class LmvzInput extends ReactiveControllerHost {
|
|
|
150
150
|
render() {
|
|
151
151
|
const hasValue = Boolean(this.value);
|
|
152
152
|
const shouldFloatLabel = hasValue || Boolean(this.placeholder);
|
|
153
|
-
return (h("div", { key: '
|
|
153
|
+
return (h("div", { key: '3cbfee5fccbb5efe1bfb9c6622653e11d4896615', class: classNames('input-container', {
|
|
154
154
|
'interaction-filled': hasValue,
|
|
155
|
-
}) }, h("div", { key: '
|
|
155
|
+
}) }, h("div", { key: '2712b0d5eda0ca1d4da70f362047df07acf922a5', class: "input-wrapper" }, h("slot", { key: '992bc86de6b3bdd3cdbac1c000d38a338e6e4474', name: "before-input" }), h("div", { key: '35ace7d889667f5d09eea76dcba161f8711c9b1c', class: "label-input-group" }, h("label", { key: '28520dddf331d35ba75283673aa81e0046628907', htmlFor: this.inputId, class: classNames({ floating: shouldFloatLabel }) }, this.label, this.required && (h("span", { key: 'b91766b86b1bc68ce3dbb4b734ee4aa40fe0759b', class: "required-indicator", "aria-hidden": "true" }, ' ', "*"))), h("input", { key: 'ed7cd4b64091256df1c3b939c1e22d6082fe58b9', id: this.inputId, ref: (el) => (this.nativeInputElement = el), type: this.type, min: this.min, max: this.max, step: this.step, value: this.value, name: this.name, placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, required: this.required, form: this.form, autocomplete: this.autocomplete, inputmode: this.inputmode, autocorrect: this.autocorrect, autocapitalize: this.autocapitalize, spellcheck: this.spellcheck, autofocus: this.autofocus, minlength: this.minlength, maxlength: this.maxlength, pattern: this.pattern, "aria-invalid": this.error ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-describedby": this.describedBy, "aria-errormessage": this.errorId, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("slot", { key: '1e42c305b8e554fadd7c50fbbb54ea234c734b0a', name: "after-input" })), h("div", { key: '190a1a92971a717f3ef594615fbe4dd0c9a72493', id: this.helperId, role: "status" }, this.helperText || null), h("div", { key: '4d07b45a51d3733caf09a1bbc56ae6f51411ecbc', id: this.errorId, role: "alert" }, (this.showErrorMessage && this.errorMessage) || null)));
|
|
156
156
|
}
|
|
157
157
|
static get is() { return "lmvz-input"; }
|
|
158
158
|
static get encapsulation() { return "scoped"; }
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
z-index: 1;
|
|
63
63
|
}
|
|
64
64
|
:host([aria-expanded='true']) {
|
|
65
|
-
--lmvz-menuitem-background: var(--lmvz-semantic-color-status-
|
|
65
|
+
--lmvz-menuitem-background: var(--lmvz-semantic-color-status-active, #f1f9fe);
|
|
66
66
|
--lmvz-menuitem-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4);
|
|
67
67
|
}
|
|
@@ -21,7 +21,7 @@ export class LmvzMenuItem extends ReactiveControllerHost {
|
|
|
21
21
|
this.addController(new ElementActivationController(this));
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'a87116fba2d35c612e590c6b4e12c03b60d1ef0e' }, h("slot", { key: 'b302049db0b5818d4d7f90c043eb5c3caf48ca1b', ref: (e) => (this.validationSlot = e) })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "lmvz-menuitem"; }
|
|
27
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -50,7 +50,7 @@ export class LmvzSelect extends ReactiveControllerHost {
|
|
|
50
50
|
render() {
|
|
51
51
|
const hasValue = this.hasValue;
|
|
52
52
|
const shouldShowLabel = hasValue;
|
|
53
|
-
return (h(Host, { key: '
|
|
53
|
+
return (h(Host, { key: '1bdd53df4a33c5292cc072b0a9abc45fa01b237f' }, h("div", { key: 'e38d81e620d8c27cd34e1a7799c42d5640d4b0db', class: "select-wrapper" }, h("label", { key: '3995206b564c7e17ac273709577eb8dd7a3b0ff1', htmlFor: this.selectId, class: shouldShowLabel ? 'floating-label' : 'assistive-label' }, this.label, this.required && shouldShowLabel && h("span", { key: '7c04028f9ff3e0f365f76d10b0139dc6805f2af4', "aria-hidden": "true" }, " *")), h("div", { key: '7b428d22a32181fc13e837b6821ab163ac286453', "aria-hidden": "true" }, h("span", { key: '385ddb473337869777e835cc5b533f9a41c1fbe3' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && h("span", { key: 'c53036bd718b916b910225297b40df998729650c', "aria-hidden": "true" }, " *")), h("span", { key: '06db17fbe01d9fea9904aa04e72b6cbfc9d93652' }, h("img", { key: 'b4d46ada048e931aa71f2ace33c93ff9fc67e479', src: chevronDownSvg, alt: "" }))), h("select", { key: '841c86f1d340cd36475a7757e9cad5f33aeac710', id: this.selectId, ref: (el) => (this.nativeSelectEl = el), name: this.name, disabled: this.disabled, required: this.required, "aria-label": this.label, onChange: this.handleChange }, !hasValue && h("option", { key: '4bd193f7878da2077c9185cd093d61c62406a7b9', value: "", disabled: true, selected: true, hidden: true }), h("slot", { key: 'c14a15e022f08ad72a5ad9d29befe0db7c6f24db' }))), this.helperText && h("div", { key: '833eaa383f8a9722fd990fadcdff4a93aa0a79df', role: "status" }, this.helperText)));
|
|
54
54
|
}
|
|
55
55
|
static get is() { return "lmvz-select"; }
|
|
56
56
|
static get encapsulation() { return "scoped"; }
|
|
@@ -20,7 +20,7 @@ export class HeaderIntegration {
|
|
|
20
20
|
this.activeNav = navId;
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: '83ffaf59132a1890e428eda0d86ce42e200b3dd0' }, h("lmvz-header", { key: '43400e9ceaff3b4df1d4f9cf1019e07464222cbe', lmvzActiveNav: this.activeNav }, h("lmvz-menuitem", { key: '00f199bf22fe04763b94cb0a8915d77d6f42c073', slot: "nav-primary", id: "lehrmittel", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '32b5ac9a962b1c0f6d4eca27f50442088edcccf8', href: "#" }, "Lehrmittel")), h("lmvz-menuitem", { key: 'ddbd5ff9c0cb2c6eca762e8b259f3b6c9f54ad4e', slot: "nav-primary", id: "verwaltung", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '86ec5784b091c691759e516dc061bde41bf25d42', href: "#" }, "Verwaltung")), h("lmvz-menuitem", { key: '9af310fcad4eee7ae42025c0a0e562e2db762958', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '5d8e64e95b9d7187bff280bf7acb8b73e80de940', ...typedIconFromSet('lmvz', 'edit') }), "Deutsch 7"), h("lmvz-menuitem", { key: '42f40b68ee3b27323a3802ebabe4d6b61e742b92', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '2fd1777696e789a89a5775f41b8dd9e8946de0f6', ...typedIconFromSet('lmvz', 'edit') }), "Mathe 2"), h("lmvz-menuitem", { key: 'da08ce4e9d54f675c7da39ebd963b5830185e299', slot: "connect-nav-verwaltung" }, h("lmvz-icon", { key: '82e074c463ca9115fef3ffffc34646f9f91135d6', ...typedIconFromSet('lmvz', 'settings') }), "iwas mit Verwaltung"), h("lmvz-menuitem", { key: '0abaf7cb24e699e0a71c407dc02b671e588ff777', slot: "connect-nav-verwaltung", "aria-label": "Einstellungen" }, h("lmvz-icon", { key: '01146d2a899330f39538df782c14fad3ab440174', ...typedIconFromSet('lmvz', 'settings') })), h("lmvz-button", { key: '8654a845ae45439ea4be43357e0cc3dba38ad34d', slot: "actions", "aria-label": "Benutzerkonto" }, h("lmvz-icon", { key: '39754f979f8d7616afcad9ff87f94820e6ad166c', ...typedIconFromSet('lmvz', 'user'), size: "lg" })))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "header-integration"; }
|
|
26
26
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Micro } from "effect";
|
|
1
|
+
import { emptyDefaultSvg, toValidSvgStringWithFallback } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
3
2
|
import { getRegisteredIconProvider } from "./icons-registry";
|
|
4
|
-
export const emptyDefaultSvg = () => SVGFactory(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
|
|
5
|
-
async function toValidSvgStringWithFallback(value) {
|
|
6
|
-
try {
|
|
7
|
-
return await Micro.runPromise(createValidSVGString(value));
|
|
8
|
-
}
|
|
9
|
-
catch {
|
|
10
|
-
console.error('Invalid SVG string:', value);
|
|
11
|
-
return emptyDefaultSvg();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
3
|
export async function resolveIconSvg(options) {
|
|
15
4
|
const { icon, iconset } = options;
|
|
16
5
|
const iconSvg = await (async () => {
|
|
@@ -25,7 +14,7 @@ export async function resolveIconSvg(options) {
|
|
|
25
14
|
console.warn(`Icon "${icon}"${iconset ? ` from set "${iconset}"` : ''} not found in provider. Using default icon.`);
|
|
26
15
|
return;
|
|
27
16
|
}
|
|
28
|
-
const validated =
|
|
17
|
+
const validated = toValidSvgStringWithFallback(resolved.svg);
|
|
29
18
|
if (validated) {
|
|
30
19
|
return validated;
|
|
31
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SVGString } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
1
|
+
import { emptyDefaultSvg, SVGString } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
2
2
|
import { beforeAll, beforeEach, describe, expect, test, vi } from "@stencil/vitest";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveIconSvg } from "./icons";
|
|
4
4
|
import { registerIconProvider } from "./icons-registry";
|
|
5
5
|
const fetchMock = vi.fn();
|
|
6
6
|
describe('icon utils:', () => {
|
|
@@ -20,18 +20,6 @@ describe('icon utils:', () => {
|
|
|
20
20
|
fetchMock.mockReset();
|
|
21
21
|
vi.stubGlobal('fetch', fetchMock);
|
|
22
22
|
});
|
|
23
|
-
const validSvg = '<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg>';
|
|
24
|
-
const invalidSvg = '<div>not an svg</div>';
|
|
25
|
-
test('SVGString branding enforces valid SVG', () => {
|
|
26
|
-
expect(() => SVGString(validSvg)).not.toThrow();
|
|
27
|
-
expect(() => SVGString(invalidSvg)).toThrow();
|
|
28
|
-
expect(() => SVGString('')).toThrow();
|
|
29
|
-
expect(() => SVGString(123)).toThrow();
|
|
30
|
-
});
|
|
31
|
-
test('emptyDefaultSvg is a valid branded SVGString', () => {
|
|
32
|
-
expect(() => SVGString(emptyDefaultSvg())).not.toThrow();
|
|
33
|
-
expect(emptyDefaultSvg()).toContain('<svg');
|
|
34
|
-
});
|
|
35
23
|
test('resolveIconSvg fails loading "book" with no iconset/provider and falls back to default', async () => {
|
|
36
24
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
37
25
|
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
@@ -46,7 +34,7 @@ describe('icon utils:', () => {
|
|
|
46
34
|
registerIconProvider('test-set-success', {
|
|
47
35
|
resolve(name) {
|
|
48
36
|
if (name === 'test-icon') {
|
|
49
|
-
return { name, svg:
|
|
37
|
+
return { name, svg: emptyDefaultSvg() };
|
|
50
38
|
}
|
|
51
39
|
return undefined;
|
|
52
40
|
},
|
package/components/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { LmvzButton as LmvzButton } from '../../types/components/lmvz-button/lmv
|
|
|
5
5
|
export { defineCustomElement as defineCustomElementLmvzButton } from './lmvz-button';
|
|
6
6
|
export { LmvzCard as LmvzCard } from '../../types/components/lmvz-card/lmvz-card';
|
|
7
7
|
export { defineCustomElement as defineCustomElementLmvzCard } from './lmvz-card';
|
|
8
|
+
export { LmvzCheckbox as LmvzCheckbox } from '../../types/components/lmvz-checkbox/lmvz-checkbox';
|
|
9
|
+
export { defineCustomElement as defineCustomElementLmvzCheckbox } from './lmvz-checkbox';
|
|
8
10
|
export { LmvzChip as LmvzChip } from '../../types/components/lmvz-chip/lmvz-chip';
|
|
9
11
|
export { defineCustomElement as defineCustomElementLmvzChip } from './lmvz-chip';
|
|
10
12
|
export { LmvzHeader as LmvzHeader } from '../../types/components/lmvz-header/lmvz-header';
|
|
@@ -5,6 +5,8 @@ export { LmvzButton as LmvzButton } from '../../types/components/lmvz-button/lmv
|
|
|
5
5
|
export { defineCustomElement as defineCustomElementLmvzButton } from './lmvz-button';
|
|
6
6
|
export { LmvzCard as LmvzCard } from '../../types/components/lmvz-card/lmvz-card';
|
|
7
7
|
export { defineCustomElement as defineCustomElementLmvzCard } from './lmvz-card';
|
|
8
|
+
export { LmvzCheckbox as LmvzCheckbox } from '../../types/components/lmvz-checkbox/lmvz-checkbox';
|
|
9
|
+
export { defineCustomElement as defineCustomElementLmvzCheckbox } from './lmvz-checkbox';
|
|
8
10
|
export { LmvzChip as LmvzChip } from '../../types/components/lmvz-chip/lmvz-chip';
|
|
9
11
|
export { defineCustomElement as defineCustomElementLmvzChip } from './lmvz-chip';
|
|
10
12
|
export { LmvzHeader as LmvzHeader } from '../../types/components/lmvz-header/lmvz-header';
|