@lmvz-ds/components 0.24.0 → 0.26.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 +22 -0
- package/cjs/{ds.constants-DSnxZ3ia.js → ds.constants-8fh6ItAF.js} +1 -1
- package/cjs/{index-lW-SEvL7.js → index-BCFBLj0e.js} +1 -1
- package/cjs/index.cjs.js +196 -2
- package/cjs/lmvz-action.cjs.entry.js +1 -1
- package/cjs/lmvz-button-group.cjs.entry.js +183 -0
- package/cjs/lmvz-button_2.cjs.entry.js +198 -0
- package/cjs/lmvz-card.cjs.entry.js +2 -2
- package/cjs/lmvz-checkbox.cjs.entry.js +5 -5
- package/cjs/lmvz-chip.cjs.entry.js +4 -4
- package/cjs/lmvz-components.cjs.js +3 -3
- package/cjs/lmvz-header_2.cjs.entry.js +2 -2
- package/cjs/lmvz-input.cjs.entry.js +3 -3
- package/cjs/lmvz-menuitem.cjs.entry.js +3 -3
- package/cjs/lmvz-modal.cjs.entry.js +5 -5
- package/cjs/lmvz-radio.cjs.entry.js +334 -0
- package/cjs/lmvz-select.cjs.entry.js +4 -4
- package/cjs/lmvz-snackbar.cjs.entry.js +83 -0
- package/cjs/lmvz-toggle.cjs.entry.js +7 -5
- package/cjs/loader.cjs.js +2 -2
- package/cjs/{reactive-controller-host-BOFg4vL-.js → reactive-controller-host-DrtMkMd7.js} +1 -1
- package/collection/api/ds.constants.js +4 -1
- package/collection/collection-manifest.json +3 -1
- package/collection/components/lmvz-button/lmvz-button.css +8 -8
- package/collection/components/lmvz-button-group/lmvz-button-group.css +1 -1
- package/collection/components/lmvz-card/lmvz-card.css +11 -11
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +8 -11
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +2 -2
- package/collection/components/lmvz-chip/lmvz-chip.css +3 -3
- package/collection/components/lmvz-icon/lmvz-icon.js +1 -1
- package/collection/components/lmvz-input/lmvz-input.css +5 -9
- package/collection/components/lmvz-menuitem/lmvz-menuitem.css +3 -3
- package/collection/components/lmvz-modal/lmvz-modal.css +21 -15
- package/collection/components/lmvz-modal/lmvz-modal.js +2 -2
- package/collection/components/lmvz-radio/lmvz-radio.css +182 -0
- package/collection/components/lmvz-radio/lmvz-radio.js +487 -0
- package/collection/components/lmvz-select/lmvz-select.css +3 -3
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/components/lmvz-snackbar/lmvz-snackbar.css +101 -0
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +266 -0
- package/collection/components/lmvz-snackbar/public.js +1 -0
- package/collection/components/lmvz-snackbar/snackbar-controller.js +194 -0
- package/collection/components/lmvz-toggle/lmvz-toggle.css +4 -9
- package/collection/components/lmvz-toggle/lmvz-toggle.js +3 -3
- package/collection/index.js +1 -0
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/styles/fragments/_focus-within.css +13 -0
- package/collection/utils/radio/radio-group-controller.js +160 -0
- package/components/index.d.ts +4 -0
- package/components/index.d.ts.bak +4 -0
- package/components/index.js +1 -1
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button-group.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- 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-modal.js +1 -1
- package/components/lmvz-radio.d.ts +11 -0
- package/components/lmvz-radio.d.ts.bak +11 -0
- package/components/lmvz-radio.js +1 -0
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.d.ts +11 -0
- package/components/lmvz-snackbar.d.ts.bak +11 -0
- package/components/lmvz-snackbar.js +1 -0
- package/components/lmvz-toggle.js +1 -1
- package/components/{p-slgmfnHm.js → p-BOzeYzKk.js} +1 -1
- package/components/{p-Cg2XX_J-.js → p-DYa3zcGE.js} +1 -1
- package/components/{p-DOTK1OW3.js → p-JAKQdFhF.js} +1 -1
- package/components/{p-CcnyKhAw.js → p-WLZ7VWNX.js} +1 -1
- package/components/{p-CK8cAKcB.js → p-c7OzBK8f.js} +1 -1
- package/components/{p-DSvYtVoD.js → p-lsUdmjdw.js} +1 -1
- package/esm/{ds.constants-Bmi89ll1.js → ds.constants-BOOwq5dE.js} +1 -1
- package/esm/{index-Aa_425iY.js → index-CKYszC64.js} +1 -1
- package/esm/index.js +198 -1
- package/esm/lmvz-action.entry.js +1 -1
- package/esm/lmvz-button-group.entry.js +181 -0
- package/esm/lmvz-button_2.entry.js +195 -0
- package/esm/lmvz-card.entry.js +2 -2
- package/esm/lmvz-checkbox.entry.js +5 -5
- package/esm/lmvz-chip.entry.js +4 -4
- package/esm/lmvz-components.js +4 -4
- package/esm/lmvz-header_2.entry.js +2 -2
- package/esm/lmvz-input.entry.js +3 -3
- package/esm/lmvz-menuitem.entry.js +3 -3
- package/esm/lmvz-modal.entry.js +5 -5
- package/esm/lmvz-radio.entry.js +332 -0
- package/esm/lmvz-select.entry.js +4 -4
- package/esm/lmvz-snackbar.entry.js +81 -0
- package/esm/lmvz-toggle.entry.js +7 -5
- package/esm/loader.js +3 -3
- package/esm/{reactive-controller-host-CroMsXdS.js → reactive-controller-host-ZrGf1F2-.js} +1 -1
- package/hydrate/index.js +467 -19
- package/hydrate/index.mjs +467 -19
- package/lmvz-components/index.esm.js +1 -1
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-d1dacf7e.entry.js → p-01aeca60.entry.js} +1 -1
- package/lmvz-components/p-0a37e0f2.entry.js +1 -0
- package/lmvz-components/p-14c3d837.entry.js +1 -0
- package/lmvz-components/{p-4263c9b2.entry.js → p-24e63b0a.entry.js} +1 -1
- package/lmvz-components/p-25f045b2.entry.js +1 -0
- package/lmvz-components/{p-f6d1d9df.entry.js → p-3da301a6.entry.js} +1 -1
- package/lmvz-components/p-40228d48.entry.js +1 -0
- package/lmvz-components/p-4da9073a.entry.js +1 -0
- package/lmvz-components/p-6de9981f.entry.js +1 -0
- package/lmvz-components/{p-6f8cbc4f.entry.js → p-758078db.entry.js} +1 -1
- package/lmvz-components/{p-88adb9fa.entry.js → p-8dae99f1.entry.js} +1 -1
- package/lmvz-components/p-BOOwq5dE.js +1 -0
- package/lmvz-components/{p-BRl6zKXT.js → p-CwX1wKkM.js} +1 -1
- package/lmvz-components/{p-a7c3074a.entry.js → p-e1eaa7a2.entry.js} +1 -1
- package/lmvz-components/p-f5cece32.entry.js +1 -0
- package/lmvz-components/p-fe607f10.entry.js +1 -0
- package/manifest.json +892 -205
- package/package.json +9 -1
- package/types/api/ds.constants.d.ts +9 -1
- package/types/components/lmvz-radio/lmvz-radio.d.ts +42 -0
- package/types/components/lmvz-snackbar/lmvz-snackbar.d.ts +21 -0
- package/types/components/lmvz-snackbar/public.d.ts +2 -0
- package/types/components/lmvz-snackbar/snackbar-controller.d.ts +32 -0
- package/types/components.d.ts +237 -1
- package/types/index.d.ts +1 -0
- package/types/stencil-public-runtime.d.ts +1 -0
- package/types/utils/radio/radio-group-controller.d.ts +26 -0
- package/assets/icons/checkmark.svg +0 -4
- package/assets/icons/close-sm.svg +0 -3
- package/cjs/lmvz-button_3.cjs.entry.js +0 -375
- package/collection/assets/icons/checkmark.svg +0 -4
- package/collection/assets/icons/close-sm.svg +0 -3
- package/esm/lmvz-button_3.entry.js +0 -371
- package/lmvz-components/p-2824a56b.entry.js +0 -1
- package/lmvz-components/p-3846ba08.entry.js +0 -1
- package/lmvz-components/p-4f5c3c4a.entry.js +0 -1
- package/lmvz-components/p-Bmi89ll1.js +0 -1
- package/lmvz-components/p-b3b04d46.entry.js +0 -1
- package/lmvz-components/p-fefefc54.entry.js +0 -1
- /package/lmvz-components/{p-Aa_425iY.js → p-CKYszC64.js} +0 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import errorSvg from "@lmvz-ds/icons/assets/alert.svg";
|
|
3
|
+
import infoSvg from "@lmvz-ds/icons/assets/info.svg";
|
|
4
|
+
import warningSvg from "@lmvz-ds/icons/assets/warning.svg";
|
|
5
|
+
const STATUS_SVG = {
|
|
6
|
+
success: infoSvg,
|
|
7
|
+
warning: warningSvg,
|
|
8
|
+
error: errorSvg,
|
|
9
|
+
};
|
|
10
|
+
export class LmvzSnackbar {
|
|
11
|
+
el;
|
|
12
|
+
animationClass = '';
|
|
13
|
+
status = 'success';
|
|
14
|
+
onStatusChange() {
|
|
15
|
+
this.applyAriaLiveAttributes();
|
|
16
|
+
}
|
|
17
|
+
message = '';
|
|
18
|
+
duration;
|
|
19
|
+
priority = 'normal';
|
|
20
|
+
actionLabel;
|
|
21
|
+
lmvzClose;
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
if (typeof document !== 'undefined') {
|
|
24
|
+
this.applyAriaLiveAttributes();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async show() {
|
|
28
|
+
this.animationClass = '';
|
|
29
|
+
requestAnimationFrame(() => {
|
|
30
|
+
this.animationClass = 'entering';
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async hide() {
|
|
34
|
+
this.animationClass = 'leaving';
|
|
35
|
+
await new Promise((resolve) => {
|
|
36
|
+
const timeout = setTimeout(resolve, 300);
|
|
37
|
+
const onAnimationEnd = () => {
|
|
38
|
+
clearTimeout(timeout);
|
|
39
|
+
this.el.removeEventListener('animationend', onAnimationEnd);
|
|
40
|
+
resolve();
|
|
41
|
+
};
|
|
42
|
+
this.el.addEventListener('animationend', onAnimationEnd);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
applyAriaLiveAttributes() {
|
|
46
|
+
if (this.status === 'error') {
|
|
47
|
+
this.el.setAttribute('role', 'alert');
|
|
48
|
+
this.el.setAttribute('aria-live', 'assertive');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.el.setAttribute('role', 'status');
|
|
52
|
+
this.el.setAttribute('aria-live', 'polite');
|
|
53
|
+
}
|
|
54
|
+
this.el.setAttribute('aria-atomic', 'true');
|
|
55
|
+
}
|
|
56
|
+
handleActionClick = () => {
|
|
57
|
+
this.lmvzClose.emit({ reason: 'action' });
|
|
58
|
+
this.el.dispatchEvent(new CustomEvent('lmvzAction', { bubbles: false, composed: false }));
|
|
59
|
+
};
|
|
60
|
+
render() {
|
|
61
|
+
return (h(Host, { key: '3cf529e3a1971926546758d2e04c3860fde23961', class: this.animationClass }, h("lmvz-icon", { key: '3bc7fb142b19ca4f01c04d33759bcd52cd46c77e', icon: STATUS_SVG[this.status], size: "md", weight: "bold" }), h("span", { key: 'b2d00f1602baefa7f1025d927d66f8867e3e7ce5', class: "message" }, this.message), this.actionLabel && (h("lmvz-button", { key: '92966ab42ef1c5fca044adf5b60a02b54ddcd43a', variant: "tertiary", scale: "small", onLmvzActivation: this.handleActionClick }, this.actionLabel))));
|
|
62
|
+
}
|
|
63
|
+
static get is() { return "lmvz-snackbar"; }
|
|
64
|
+
static get encapsulation() { return "shadow"; }
|
|
65
|
+
static get originalStyleUrls() {
|
|
66
|
+
return {
|
|
67
|
+
"$": ["lmvz-snackbar.css"]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static get styleUrls() {
|
|
71
|
+
return {
|
|
72
|
+
"$": ["lmvz-snackbar.css"]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
static get properties() {
|
|
76
|
+
return {
|
|
77
|
+
"status": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"mutable": true,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "Snackbar.Status",
|
|
82
|
+
"resolved": "\"error\" | \"success\" | \"warning\"",
|
|
83
|
+
"references": {
|
|
84
|
+
"Snackbar": {
|
|
85
|
+
"location": "import",
|
|
86
|
+
"path": "../../api",
|
|
87
|
+
"id": "src/api/index.d.ts::Snackbar",
|
|
88
|
+
"referenceLocation": "Snackbar"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"getter": false,
|
|
99
|
+
"setter": false,
|
|
100
|
+
"reflect": true,
|
|
101
|
+
"attribute": "status",
|
|
102
|
+
"defaultValue": "'success'"
|
|
103
|
+
},
|
|
104
|
+
"message": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"mutable": true,
|
|
107
|
+
"complexType": {
|
|
108
|
+
"original": "string",
|
|
109
|
+
"resolved": "string",
|
|
110
|
+
"references": {}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": false,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": ""
|
|
117
|
+
},
|
|
118
|
+
"getter": false,
|
|
119
|
+
"setter": false,
|
|
120
|
+
"reflect": false,
|
|
121
|
+
"attribute": "message",
|
|
122
|
+
"defaultValue": "''"
|
|
123
|
+
},
|
|
124
|
+
"duration": {
|
|
125
|
+
"type": "number",
|
|
126
|
+
"mutable": true,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "number",
|
|
129
|
+
"resolved": "number | undefined",
|
|
130
|
+
"references": {}
|
|
131
|
+
},
|
|
132
|
+
"required": false,
|
|
133
|
+
"optional": true,
|
|
134
|
+
"docs": {
|
|
135
|
+
"tags": [],
|
|
136
|
+
"text": ""
|
|
137
|
+
},
|
|
138
|
+
"getter": false,
|
|
139
|
+
"setter": false,
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"attribute": "duration"
|
|
142
|
+
},
|
|
143
|
+
"priority": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"mutable": true,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "Snackbar.Priority",
|
|
148
|
+
"resolved": "\"high\" | \"low\" | \"normal\" | undefined",
|
|
149
|
+
"references": {
|
|
150
|
+
"Snackbar": {
|
|
151
|
+
"location": "import",
|
|
152
|
+
"path": "../../api",
|
|
153
|
+
"id": "src/api/index.d.ts::Snackbar",
|
|
154
|
+
"referenceLocation": "Snackbar"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"optional": true,
|
|
160
|
+
"docs": {
|
|
161
|
+
"tags": [],
|
|
162
|
+
"text": ""
|
|
163
|
+
},
|
|
164
|
+
"getter": false,
|
|
165
|
+
"setter": false,
|
|
166
|
+
"reflect": false,
|
|
167
|
+
"attribute": "priority",
|
|
168
|
+
"defaultValue": "'normal'"
|
|
169
|
+
},
|
|
170
|
+
"actionLabel": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"mutable": true,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "string",
|
|
175
|
+
"resolved": "string | undefined",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"optional": true,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": ""
|
|
183
|
+
},
|
|
184
|
+
"getter": false,
|
|
185
|
+
"setter": false,
|
|
186
|
+
"reflect": false,
|
|
187
|
+
"attribute": "action-label"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static get states() {
|
|
192
|
+
return {
|
|
193
|
+
"animationClass": {}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static get events() {
|
|
197
|
+
return [{
|
|
198
|
+
"method": "lmvzClose",
|
|
199
|
+
"name": "lmvzClose",
|
|
200
|
+
"bubbles": true,
|
|
201
|
+
"cancelable": false,
|
|
202
|
+
"composed": true,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": ""
|
|
206
|
+
},
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "{ reason: Snackbar.DismissReason }",
|
|
209
|
+
"resolved": "{ reason: \"timeout\" | \"manual\" | \"action\" | \"overridden\" | \"swallowed\"; }",
|
|
210
|
+
"references": {
|
|
211
|
+
"Snackbar": {
|
|
212
|
+
"location": "import",
|
|
213
|
+
"path": "../../api",
|
|
214
|
+
"id": "src/api/index.d.ts::Snackbar",
|
|
215
|
+
"referenceLocation": "Snackbar"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
static get methods() {
|
|
222
|
+
return {
|
|
223
|
+
"show": {
|
|
224
|
+
"complexType": {
|
|
225
|
+
"signature": "() => Promise<void>",
|
|
226
|
+
"parameters": [],
|
|
227
|
+
"references": {
|
|
228
|
+
"Promise": {
|
|
229
|
+
"location": "global",
|
|
230
|
+
"id": "global::Promise"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"return": "Promise<void>"
|
|
234
|
+
},
|
|
235
|
+
"docs": {
|
|
236
|
+
"text": "",
|
|
237
|
+
"tags": []
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"hide": {
|
|
241
|
+
"complexType": {
|
|
242
|
+
"signature": "() => Promise<void>",
|
|
243
|
+
"parameters": [],
|
|
244
|
+
"references": {
|
|
245
|
+
"Promise": {
|
|
246
|
+
"location": "global",
|
|
247
|
+
"id": "global::Promise"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"return": "Promise<void>"
|
|
251
|
+
},
|
|
252
|
+
"docs": {
|
|
253
|
+
"text": "",
|
|
254
|
+
"tags": []
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
static get elementRef() { return "el"; }
|
|
260
|
+
static get watchers() {
|
|
261
|
+
return [{
|
|
262
|
+
"propName": "status",
|
|
263
|
+
"methodName": "onStatusChange"
|
|
264
|
+
}];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SnackbarController } from './snackbar-controller';
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
const PRIORITY_MAP = {
|
|
2
|
+
low: 0,
|
|
3
|
+
normal: 1,
|
|
4
|
+
high: 2,
|
|
5
|
+
};
|
|
6
|
+
const STATUS_DURATION = {
|
|
7
|
+
success: 5000,
|
|
8
|
+
warning: 5000,
|
|
9
|
+
error: 8000,
|
|
10
|
+
};
|
|
11
|
+
let idCounter = 0;
|
|
12
|
+
function nextId() {
|
|
13
|
+
idCounter += 1;
|
|
14
|
+
return `snackbar-${idCounter}`;
|
|
15
|
+
}
|
|
16
|
+
function resolveHostElement() {
|
|
17
|
+
if (typeof document === 'undefined') {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const existing = document.querySelector('[data-snackbar-host]');
|
|
21
|
+
if (existing) {
|
|
22
|
+
return existing;
|
|
23
|
+
}
|
|
24
|
+
const el = document.createElement('lmvz-snackbar');
|
|
25
|
+
el.setAttribute('data-snackbar-host', '');
|
|
26
|
+
document.body.appendChild(el);
|
|
27
|
+
return el;
|
|
28
|
+
}
|
|
29
|
+
export class SnackbarController {
|
|
30
|
+
hostEl = undefined;
|
|
31
|
+
active = undefined;
|
|
32
|
+
getHost() {
|
|
33
|
+
if (this.hostEl !== undefined && !this.hostEl.isConnected) {
|
|
34
|
+
this.hostEl = undefined;
|
|
35
|
+
}
|
|
36
|
+
if (this.hostEl === undefined) {
|
|
37
|
+
this.hostEl = resolveHostElement();
|
|
38
|
+
}
|
|
39
|
+
return this.hostEl;
|
|
40
|
+
}
|
|
41
|
+
clearTimer(entry) {
|
|
42
|
+
if (entry.timerId !== undefined) {
|
|
43
|
+
clearTimeout(entry.timerId);
|
|
44
|
+
entry.timerId = undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
scheduleTimer(entry, delayMs) {
|
|
48
|
+
if (delayMs <= 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
entry.timerStartedAt = Date.now();
|
|
52
|
+
entry.timerId = setTimeout(() => {
|
|
53
|
+
if (this.active !== undefined && this.active.id === entry.id) {
|
|
54
|
+
this.dismissActive(entry, 'timeout');
|
|
55
|
+
}
|
|
56
|
+
}, delayMs);
|
|
57
|
+
}
|
|
58
|
+
dismissActive(entry, reason) {
|
|
59
|
+
this.clearTimer(entry);
|
|
60
|
+
const host = entry.hostEl;
|
|
61
|
+
host.removeEventListener('pointerenter', entry.onPointerEnter);
|
|
62
|
+
host.removeEventListener('pointerleave', entry.onPointerLeave);
|
|
63
|
+
host.removeEventListener('focusin', entry.onFocusIn);
|
|
64
|
+
host.removeEventListener('focusout', entry.onFocusOut);
|
|
65
|
+
if (entry.onActionListener) {
|
|
66
|
+
host.removeEventListener('lmvzAction', entry.onActionListener);
|
|
67
|
+
}
|
|
68
|
+
host.hide?.();
|
|
69
|
+
if (this.active?.id === entry.id) {
|
|
70
|
+
this.active = undefined;
|
|
71
|
+
}
|
|
72
|
+
if (reason !== 'action') {
|
|
73
|
+
host.dispatchEvent(new CustomEvent('lmvzClose', { detail: { reason }, bubbles: true, composed: true }));
|
|
74
|
+
}
|
|
75
|
+
entry.resolve({ reason });
|
|
76
|
+
}
|
|
77
|
+
pauseTimer(entry) {
|
|
78
|
+
entry.pauseCount += 1;
|
|
79
|
+
if (entry.pauseCount > 1 || entry.timerId === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const elapsed = entry.timerStartedAt !== undefined ? Date.now() - entry.timerStartedAt : 0;
|
|
83
|
+
entry.remaining = Math.max(0, entry.remaining - elapsed);
|
|
84
|
+
entry.timerStartedAt = undefined;
|
|
85
|
+
this.clearTimer(entry);
|
|
86
|
+
}
|
|
87
|
+
resumeTimer(entry) {
|
|
88
|
+
if (entry.pauseCount > 0) {
|
|
89
|
+
entry.pauseCount -= 1;
|
|
90
|
+
}
|
|
91
|
+
if (entry.pauseCount > 0) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (entry.remaining > 0) {
|
|
95
|
+
this.scheduleTimer(entry, entry.remaining);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
applyToHost(host, options) {
|
|
99
|
+
host.setAttribute('status', options.status ?? 'success');
|
|
100
|
+
if (options.actionLabel !== undefined) {
|
|
101
|
+
host.setAttribute('action-label', options.actionLabel);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
host.removeAttribute('action-label');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
open(options) {
|
|
108
|
+
const incomingPriority = PRIORITY_MAP[options.priority ?? 'normal'];
|
|
109
|
+
if (this.active !== undefined && incomingPriority < this.active.priority) {
|
|
110
|
+
let swallowResolve;
|
|
111
|
+
const closed = new Promise((resolve) => {
|
|
112
|
+
swallowResolve = resolve;
|
|
113
|
+
});
|
|
114
|
+
swallowResolve({ reason: 'swallowed' });
|
|
115
|
+
const id = nextId();
|
|
116
|
+
return {
|
|
117
|
+
id,
|
|
118
|
+
closed,
|
|
119
|
+
dismiss() {
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (this.active !== undefined) {
|
|
124
|
+
this.dismissActive(this.active, 'overridden');
|
|
125
|
+
}
|
|
126
|
+
const host = this.getHost();
|
|
127
|
+
if (host === undefined) {
|
|
128
|
+
const id = nextId();
|
|
129
|
+
let ssrResolve;
|
|
130
|
+
const closed = new Promise((resolve) => {
|
|
131
|
+
ssrResolve = resolve;
|
|
132
|
+
});
|
|
133
|
+
ssrResolve({ reason: 'swallowed' });
|
|
134
|
+
return { id, closed, dismiss() { } };
|
|
135
|
+
}
|
|
136
|
+
const id = nextId();
|
|
137
|
+
const status = options.status ?? 'success';
|
|
138
|
+
const durationMs = options.duration === 0 ? 0 : (options.duration ?? STATUS_DURATION[status]);
|
|
139
|
+
let entryResolve;
|
|
140
|
+
const closed = new Promise((resolve) => {
|
|
141
|
+
entryResolve = resolve;
|
|
142
|
+
});
|
|
143
|
+
const entry = {
|
|
144
|
+
id,
|
|
145
|
+
priority: incomingPriority,
|
|
146
|
+
resolve: entryResolve,
|
|
147
|
+
timerId: undefined,
|
|
148
|
+
remaining: durationMs,
|
|
149
|
+
timerStartedAt: undefined,
|
|
150
|
+
pauseCount: 0,
|
|
151
|
+
hostEl: host,
|
|
152
|
+
onPointerEnter: () => this.pauseTimer(entry),
|
|
153
|
+
onPointerLeave: () => this.resumeTimer(entry),
|
|
154
|
+
onFocusIn: () => this.pauseTimer(entry),
|
|
155
|
+
onFocusOut: () => this.resumeTimer(entry),
|
|
156
|
+
};
|
|
157
|
+
this.active = entry;
|
|
158
|
+
host.addEventListener('pointerenter', entry.onPointerEnter);
|
|
159
|
+
host.addEventListener('pointerleave', entry.onPointerLeave);
|
|
160
|
+
host.addEventListener('focusin', entry.onFocusIn);
|
|
161
|
+
host.addEventListener('focusout', entry.onFocusOut);
|
|
162
|
+
this.applyToHost(host, options);
|
|
163
|
+
const onAction = () => {
|
|
164
|
+
if (this.active !== undefined && this.active.id === id) {
|
|
165
|
+
options.onAction?.();
|
|
166
|
+
this.dismissActive(entry, 'action');
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
entry.onActionListener = onAction;
|
|
170
|
+
host.addEventListener('lmvzAction', onAction, { once: true });
|
|
171
|
+
host.show?.();
|
|
172
|
+
queueMicrotask(() => host.setAttribute('message', options.message));
|
|
173
|
+
if (durationMs > 0) {
|
|
174
|
+
this.scheduleTimer(entry, durationMs);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
id,
|
|
178
|
+
closed,
|
|
179
|
+
dismiss: () => {
|
|
180
|
+
if (this.active?.id === id) {
|
|
181
|
+
this.dismissActive(entry, 'manual');
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
dismiss(id) {
|
|
187
|
+
if (!this.active) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (!id || this.active.id === id) {
|
|
191
|
+
this.dismissActive(this.active, 'manual');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0);
|
|
55
55
|
}
|
|
56
56
|
:host([checked]) {
|
|
57
|
-
background-color: var(--lmvz-semantic-color-status-active, #
|
|
57
|
+
background-color: var(--lmvz-semantic-color-status-active, #f6fbfe);
|
|
58
58
|
}
|
|
59
59
|
:host([disabled][checked]) {
|
|
60
|
-
background-color: var(--lmvz-semantic-color-status-active, #
|
|
60
|
+
background-color: var(--lmvz-semantic-color-status-active, #f6fbfe);
|
|
61
61
|
}
|
|
62
62
|
:host([disabled]) {
|
|
63
63
|
cursor: not-allowed;
|
|
@@ -90,17 +90,12 @@ input {
|
|
|
90
90
|
margin: 0;
|
|
91
91
|
cursor: inherit;
|
|
92
92
|
}
|
|
93
|
-
:host(:focus-within) {
|
|
94
|
-
/* TODO[LDHCID-136]: no focus-visible token in DS */
|
|
95
|
-
outline: 2px solid var(--lmvz-semantic-color-border-active, #0f8acc);
|
|
96
|
-
outline-offset: 2px;
|
|
97
|
-
}
|
|
98
93
|
.thumb {
|
|
99
94
|
position: absolute;
|
|
100
95
|
width: var(--lmvz-global-s13, 13px);
|
|
101
96
|
height: var(--lmvz-global-s13, 13px);
|
|
102
97
|
border-radius: 50%;
|
|
103
|
-
background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #
|
|
98
|
+
background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454);
|
|
104
99
|
top: 50%;
|
|
105
100
|
transform: translateY(-50%);
|
|
106
101
|
left: var(--lmvz-global-s4, 4px);
|
|
@@ -115,7 +110,7 @@ input {
|
|
|
115
110
|
background-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4);
|
|
116
111
|
}
|
|
117
112
|
label {
|
|
118
|
-
font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.
|
|
113
|
+
font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5
|
|
119
114
|
Router);
|
|
120
115
|
color: var(--lmvz-semantic-color-on-surface-primary, #000000);
|
|
121
116
|
cursor: pointer;
|
|
@@ -65,19 +65,19 @@ export class LmvzToggle extends ReactiveControllerHost {
|
|
|
65
65
|
this.lmvzChange.emit(newChecked);
|
|
66
66
|
};
|
|
67
67
|
render() {
|
|
68
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: '202842250b2c22f64b608e4d5a517a045e50a54c' }, h("span", { key: '105869ad771c9146a6a31e767e51807bb7e0b565', class: "track" }, h("input", { key: '8113919f2c474b61a2745a000fd4995f81b58c1e', type: "checkbox", role: "switch", id: this.toggleId, checked: this.checked, disabled: this.disabled, required: this.required, name: this.name, value: this.value, form: this.form, ref: (el) => (this.nativeInputElement = el), onChange: this.handleChange }), h("span", { key: '9d7201d14abdb987b20f52f21a314434051c9f84', class: "thumb", "aria-hidden": "true" })), h("label", { key: '7291494dd6f440099e9cbd04b3cff03a338a0e93', htmlFor: this.toggleId }, this.label)));
|
|
69
69
|
}
|
|
70
70
|
static get is() { return "lmvz-toggle"; }
|
|
71
71
|
static get encapsulation() { return "scoped"; }
|
|
72
72
|
static get formAssociated() { return true; }
|
|
73
73
|
static get originalStyleUrls() {
|
|
74
74
|
return {
|
|
75
|
-
"$": ["./lmvz-toggle.css"]
|
|
75
|
+
"$": ["./lmvz-toggle.css", "../../styles/fragments/_focus-within.css"]
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
static get styleUrls() {
|
|
79
79
|
return {
|
|
80
|
-
"$": ["lmvz-toggle.css"]
|
|
80
|
+
"$": ["lmvz-toggle.css", "../../styles/fragments/_focus-within.css"]
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
static get properties() {
|
package/collection/index.js
CHANGED
|
@@ -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: 'c7ca0e05f67f09a13ac814b6003855c08fb1b1f0' }, h("lmvz-header", { key: '6f495333a582e0bdba065ea223e631ab22ad6648', lmvzActiveNav: this.activeNav }, h("lmvz-menuitem", { key: 'e4da0b537a42460290f8b0c833e93b311c93bd7e', slot: "nav-primary", id: "lehrmittel", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '232bcc2c0b5ea1131681e3bbad1e59c57e86f345', href: "#" }, "Lehrmittel")), h("lmvz-menuitem", { key: '5ffad2212873c2bed0b2cf9478bf9fb60c64c2d9', slot: "nav-primary", id: "verwaltung", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '12f600046c6f3f13c0724752b833bd9591e68ced', href: "#" }, "Verwaltung")), h("lmvz-menuitem", { key: '55c6ddec956960b57d4ddbdbde5b73c45bd3125b', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: 'cac4736814aae4dc3f8725f09c24ee5a4ba60be0', ...typedIconFromSet('lmvz', 'edit') }), "Deutsch 7"), h("lmvz-menuitem", { key: 'f62ef7953883cb4f989e43e1268f9fe9d3324a15', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '01ffb4c65e99644dff9fbeb0dc7af43bb0429d2b', ...typedIconFromSet('lmvz', 'edit') }), "Mathe 2"), h("lmvz-menuitem", { key: '1bf7ea0bb514eed4940ba5d0a739c6b56293c2c2', slot: "connect-nav-verwaltung" }, h("lmvz-icon", { key: '5ac636bc4a0939efdf3461b75908335c1e6910ed', ...typedIconFromSet('lmvz', 'settings') }), "iwas mit Verwaltung"), h("lmvz-menuitem", { key: '4ca67b477a656236b353e5333aa183db140beb7d', slot: "connect-nav-verwaltung", "aria-label": "Einstellungen" }, h("lmvz-icon", { key: '94641076d563ab7d970abeada484d7800906fe30', ...typedIconFromSet('lmvz', 'settings') })), h("lmvz-button", { key: '5f5116dae74e1563eaf06fab2fdb1de7061a22fd', slot: "actions", "aria-label": "Benutzerkonto" }, h("lmvz-icon", { key: '781e4b379ee2d4f5c6e940e167fd55310efbb65a', ...typedIconFromSet('lmvz', 'user'), size: "lg" })))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "header-integration"; }
|
|
26
26
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
:host(:focus-within) {
|
|
2
|
+
outline: var(--lmvz-ds-outline, 1px solid #0e7ab4);
|
|
3
|
+
outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem));
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* Forced Colors / Windows High Contrast */
|
|
7
|
+
|
|
8
|
+
@media (forced-colors: active) {
|
|
9
|
+
:host(:focus-within) {
|
|
10
|
+
outline-color: Highlight;
|
|
11
|
+
box-shadow: none;
|
|
12
|
+
}
|
|
13
|
+
}
|