@lmvz-ds/components 0.20.0 → 0.22.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.
Files changed (107) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/assets/icons/close-sm.svg +3 -0
  3. package/cjs/{component-Csg9MtNK.js → component-C7cavwmZ.js} +3 -0
  4. package/cjs/{index-C2yDXRqP.js → index-lW-SEvL7.js} +67 -3
  5. package/cjs/lmvz-action.cjs.entry.js +2 -2
  6. package/cjs/{lmvz-button.cjs.entry.js → lmvz-button_2.cjs.entry.js} +139 -14
  7. package/cjs/lmvz-card.cjs.entry.js +2 -2
  8. package/cjs/lmvz-checkbox.cjs.entry.js +3 -3
  9. package/cjs/lmvz-chip.cjs.entry.js +4 -4
  10. package/cjs/lmvz-components.cjs.js +2 -2
  11. package/cjs/lmvz-header_2.cjs.entry.js +3 -3
  12. package/cjs/lmvz-input.cjs.entry.js +4 -4
  13. package/cjs/lmvz-menuitem.cjs.entry.js +3 -3
  14. package/cjs/lmvz-modal.cjs.entry.js +349 -0
  15. package/cjs/lmvz-select.cjs.entry.js +4 -4
  16. package/cjs/lmvz-toggle.cjs.entry.js +96 -0
  17. package/cjs/loader.cjs.js +2 -2
  18. package/cjs/{reactive-controller-host-BA4ZhjKA.js → reactive-controller-host-DnSTWHCF.js} +1 -1
  19. package/collection/assets/icons/close-sm.svg +3 -0
  20. package/collection/collection-manifest.json +2 -0
  21. package/collection/components/lmvz-button/lmvz-button.js +98 -10
  22. package/collection/components/lmvz-chip/lmvz-chip.js +2 -2
  23. package/collection/components/lmvz-modal/lmvz-modal.css +120 -0
  24. package/collection/components/lmvz-modal/lmvz-modal.js +448 -0
  25. package/collection/components/lmvz-select/lmvz-select.js +1 -1
  26. package/collection/components/lmvz-toggle/lmvz-toggle.css +118 -0
  27. package/collection/components/lmvz-toggle/lmvz-toggle.js +358 -0
  28. package/collection/integration/header-integration/header-integration.js +1 -1
  29. package/components/index.d.ts +4 -0
  30. package/components/index.d.ts.bak +4 -0
  31. package/components/index.js +1 -1
  32. package/components/lmvz-action.js +1 -1
  33. package/components/lmvz-button.js +1 -1
  34. package/components/lmvz-card.js +1 -1
  35. package/components/lmvz-checkbox.js +1 -1
  36. package/components/lmvz-chip.js +1 -1
  37. package/components/lmvz-header.js +1 -1
  38. package/components/lmvz-icon.js +1 -1
  39. package/components/lmvz-input.js +1 -1
  40. package/components/lmvz-menuitem.js +1 -1
  41. package/components/lmvz-modal.d.ts +11 -0
  42. package/components/lmvz-modal.d.ts.bak +11 -0
  43. package/components/lmvz-modal.js +1 -0
  44. package/components/lmvz-select.js +1 -1
  45. package/components/lmvz-toggle.d.ts +11 -0
  46. package/components/lmvz-toggle.d.ts.bak +11 -0
  47. package/components/lmvz-toggle.js +1 -0
  48. package/components/p-Boj0PCdB.js +1 -0
  49. package/components/p-CK8cAKcB.js +1 -0
  50. package/components/p-Cc6dOWwS.js +1 -0
  51. package/components/{p-BuFx0tTm.js → p-DBc1BzQb.js} +1 -1
  52. package/components/p-DOTK1OW3.js +1 -0
  53. package/esm/{component-DIrAQ4IB.js → component-DOTK1OW3.js} +3 -0
  54. package/esm/{index-saW7O-EW.js → index-Aa_425iY.js} +67 -3
  55. package/esm/lmvz-action.entry.js +2 -2
  56. package/esm/{lmvz-button.entry.js → lmvz-button_2.entry.js} +139 -15
  57. package/esm/lmvz-card.entry.js +2 -2
  58. package/esm/lmvz-checkbox.entry.js +3 -3
  59. package/esm/lmvz-chip.entry.js +4 -4
  60. package/esm/lmvz-components.js +3 -3
  61. package/esm/lmvz-header_2.entry.js +3 -3
  62. package/esm/lmvz-input.entry.js +4 -4
  63. package/esm/lmvz-menuitem.entry.js +3 -3
  64. package/esm/lmvz-modal.entry.js +347 -0
  65. package/esm/lmvz-select.entry.js +4 -4
  66. package/esm/lmvz-toggle.entry.js +94 -0
  67. package/esm/loader.js +3 -3
  68. package/esm/{reactive-controller-host-DHcPpJW7.js → reactive-controller-host-lF2kXM1x.js} +1 -1
  69. package/hydrate/index.js +559 -24
  70. package/hydrate/index.mjs +559 -24
  71. package/lmvz-components/lmvz-components.esm.js +1 -1
  72. package/lmvz-components/p-08a08b63.entry.js +1 -0
  73. package/lmvz-components/p-1b181e90.entry.js +1 -0
  74. package/lmvz-components/p-23fb2476.entry.js +1 -0
  75. package/lmvz-components/p-3846ba08.entry.js +1 -0
  76. package/lmvz-components/p-6bb145e4.entry.js +1 -0
  77. package/lmvz-components/{p-2f83d7a2.entry.js → p-7a310b1e.entry.js} +1 -1
  78. package/lmvz-components/p-Aa_425iY.js +2 -0
  79. package/lmvz-components/{p-GdMr6Qlp.js → p-DCTzMRMQ.js} +1 -1
  80. package/lmvz-components/p-DOTK1OW3.js +1 -0
  81. package/lmvz-components/p-b7940687.entry.js +1 -0
  82. package/lmvz-components/p-d984e118.entry.js +1 -0
  83. package/lmvz-components/p-db8306a5.entry.js +1 -0
  84. package/lmvz-components/p-ea335543.entry.js +1 -0
  85. package/lmvz-components/p-f8ea0eb2.entry.js +1 -0
  86. package/manifest.json +599 -5
  87. package/package.json +9 -1
  88. package/types/api/index.d.ts +6 -0
  89. package/types/components/lmvz-button/lmvz-button.d.ts +4 -0
  90. package/types/components/lmvz-modal/lmvz-modal.d.ts +58 -0
  91. package/types/components/lmvz-toggle/lmvz-toggle.d.ts +31 -0
  92. package/types/components.d.ts +196 -0
  93. package/cjs/lmvz-icon.cjs.entry.js +0 -100
  94. package/components/p-C_bScbrd.js +0 -1
  95. package/components/p-DIrAQ4IB.js +0 -1
  96. package/esm/lmvz-icon.entry.js +0 -98
  97. package/lmvz-components/p-0f7a4236.entry.js +0 -1
  98. package/lmvz-components/p-32171f4f.entry.js +0 -1
  99. package/lmvz-components/p-400b2318.entry.js +0 -1
  100. package/lmvz-components/p-43e295ba.entry.js +0 -1
  101. package/lmvz-components/p-851969bd.entry.js +0 -1
  102. package/lmvz-components/p-9f9d845d.entry.js +0 -1
  103. package/lmvz-components/p-DIrAQ4IB.js +0 -1
  104. package/lmvz-components/p-a12f95da.entry.js +0 -1
  105. package/lmvz-components/p-ab4437dc.entry.js +0 -1
  106. package/lmvz-components/p-d0a0e206.entry.js +0 -1
  107. package/lmvz-components/p-saW7O-EW.js +0 -2
@@ -0,0 +1,347 @@
1
+ import { g as getElement, r as registerInstance, c as createEvent, h, H as Host } from './index-Aa_425iY.js';
2
+ import { t as toValidSvgStringWithFallback } from './svg-B2YoIRuh.js';
3
+ import { R as ReactiveControllerHost, A as AriaValidationController } from './reactive-controller-host-lF2kXM1x.js';
4
+ import { i as inheritAriaAttributes, g as getDeepActiveElement } from './component-DOTK1OW3.js';
5
+ import { i as isAriaValidationEnabled } from './aria-loader-BVolm0lC.js';
6
+ import './logger-CGmJG63p.js';
7
+
8
+ const closeSmSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYgNkwxMiAxMk0xMiAxMkwxOCAxOE0xMiAxMkw2IDE4TTEyIDEyTDE4IDYiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==';
9
+
10
+ const lmvzModalCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } } :host { display: contents; color: var(--lmvz-semantic-color-on-surface-primary, #000000); --lmvz-modal-shell-padding: var(--lmvz-dimension-16-24, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)); --lmvz-modal-shell-gap: var(--lmvz-dimension-16-24, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)); --lmvz-modal-actions-gap: var(--lmvz-dimension-8-12, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-modal-viewport-padding: var(--lmvz-dimension-16-24, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)); --lmvz-modal-shell-max-width: 40rem; } dialog { border: none; padding: 0; background: transparent; color: var(--lmvz-semantic-color-on-surface-primary, #000000); } dialog::backdrop { background: rgba(0, 0, 0, 0.19); background: rgb(from var(--lmvz-semantic-color-int-primary, #000000) r g b / 0.19); } .modal-shell { display: flex; flex-direction: column; gap: var(--lmvz-modal-shell-gap); inline-size: min(calc(100vw - (2 * var(--lmvz-modal-viewport-padding))), var(--lmvz-modal-shell-max-width)); max-inline-size: 100%; padding: var(--lmvz-modal-shell-padding); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); background: var(--lmvz-semantic-color-surface-primary, #ffffff); overflow: auto; } .header { display: flex; align-items: flex-start; justify-content: flex-end; gap: var(--lmvz-modal-shell-gap); } .title { min-inline-size: 0; font: var(--lmvz-typography-heading-lg, 500 clamp(1.25rem, 1.19rem + 0.26vw, 1.5rem) / 1.4 Router); } .has-title .title { flex: 1 1 auto; } .body { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--lmvz-modal-actions-gap); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .close-button { display: inline-flex; flex: none; } ::slotted([slot='actions'][hidden]) { display: none; } `;
11
+
12
+ const closeIconSvg = toValidSvgStringWithFallback(closeSmSvg);
13
+ let modalIdCounter = 0;
14
+ const LmvzModal = class extends ReactiveControllerHost {
15
+ get el() { return getElement(this); }
16
+ inheritedAriaAttributes = {};
17
+ dialogEl;
18
+ dialogStateObserver;
19
+ actionsStateObserver;
20
+ headerSlot;
21
+ actionsSlot;
22
+ closeButtonEl;
23
+ previouslyFocusedElement = null;
24
+ wrappedDialogShowModal;
25
+ lastActionValidationMessage;
26
+ pendingCloseReturnValue;
27
+ dialogTitleId = `lmvz-modal-title-${modalIdCounter++}`;
28
+ hasActions = false;
29
+ hasHeader = false;
30
+ open = false;
31
+ closeLabel = 'Schliessen';
32
+ dialogClose;
33
+ dialogCancel;
34
+ get dialog() {
35
+ return this.dialogEl;
36
+ }
37
+ get validationEl() {
38
+ return this.dialogEl ?? this.el;
39
+ }
40
+ get validationSlot() {
41
+ return this.actionsSlot;
42
+ }
43
+ constructor(hostRef) {
44
+ super();
45
+ registerInstance(this, hostRef);
46
+ this.dialogClose = createEvent(this, "close", 6);
47
+ this.dialogCancel = createEvent(this, "cancel", 1);
48
+ this.addController(new AriaValidationController(this, { validationTiming: 'slot' }));
49
+ }
50
+ handleFormDialogSubmit(event) {
51
+ const form = event.target;
52
+ const submitter = event.submitter;
53
+ const isDialogForm = form.method === 'dialog' || submitter?.getAttribute('formmethod') === 'dialog';
54
+ if (!isDialogForm)
55
+ return;
56
+ event.preventDefault();
57
+ this.dialogEl?.close(submitter?.value ?? '');
58
+ }
59
+ connectedCallback() {
60
+ this.inheritedAriaAttributes = inheritAriaAttributes(this.el, ['role']);
61
+ Object.defineProperty(this.el, 'dialog', {
62
+ configurable: true,
63
+ enumerable: true,
64
+ get: () => {
65
+ this.ensureDialogShowModalCapture();
66
+ return this.dialogEl;
67
+ },
68
+ });
69
+ super.connectedCallback();
70
+ }
71
+ componentDidLoad() {
72
+ this.handleHeaderSlotChange();
73
+ this.handleActionsSlotChange();
74
+ this.observeDialogState();
75
+ this.syncDialogVisibility();
76
+ super.componentDidLoad();
77
+ }
78
+ disconnectedCallback() {
79
+ this.actionsStateObserver?.disconnect();
80
+ this.dialogStateObserver?.disconnect();
81
+ super.disconnectedCallback();
82
+ }
83
+ componentDidRender() {
84
+ if (this.open) {
85
+ this.focusPrimaryAction();
86
+ }
87
+ super.componentDidRender();
88
+ }
89
+ handleOpenChange() {
90
+ this.syncDialogVisibility();
91
+ }
92
+ get dialogAccessibilityAttributes() {
93
+ const attributes = { ...this.inheritedAriaAttributes };
94
+ delete attributes['aria-label'];
95
+ delete attributes['aria-labelledby'];
96
+ if (this.hasHeader) {
97
+ attributes['aria-labelledby'] = this.dialogTitleId;
98
+ return attributes;
99
+ }
100
+ const inheritedLabelledBy = this.inheritedAriaAttributes['aria-labelledby'];
101
+ if (typeof inheritedLabelledBy === 'string') {
102
+ attributes['aria-labelledby'] = inheritedLabelledBy;
103
+ return attributes;
104
+ }
105
+ const inheritedLabel = this.inheritedAriaAttributes['aria-label'];
106
+ if (typeof inheritedLabel === 'string') {
107
+ attributes['aria-label'] = inheritedLabel;
108
+ }
109
+ return attributes;
110
+ }
111
+ get actionButtons() {
112
+ return (this.actionsSlot?.assignedElements({ flatten: true }) ?? []).filter((element) => {
113
+ return this.isVisibleActionButton(element);
114
+ });
115
+ }
116
+ get enabledActionButtons() {
117
+ return this.actionButtons.filter((element) => {
118
+ return !this.isDisabledActionButton(element);
119
+ });
120
+ }
121
+ get assignedActionElements() {
122
+ return this.actionsSlot?.assignedElements({ flatten: true }) ?? [];
123
+ }
124
+ isDisabledActionButton(element) {
125
+ return element.hasAttribute('disabled') || element.disabled === true;
126
+ }
127
+ getActionVariant(element) {
128
+ const variant = element.getAttribute('variant') ?? element.variant;
129
+ return variant === 'primary' || variant === 'secondary' || variant === 'tertiary' ? variant : 'secondary';
130
+ }
131
+ getActionValidationResult() {
132
+ if (!this.actionButtons.length) {
133
+ return {};
134
+ }
135
+ const primaryActions = this.actionButtons.filter((element) => this.getActionVariant(element) === 'primary');
136
+ const secondaryActions = this.actionButtons.filter((element) => this.getActionVariant(element) === 'secondary');
137
+ const issues = [
138
+ primaryActions.length !== 1 ? `${primaryActions.length} primary action${primaryActions.length === 1 ? '' : 's'}` : undefined,
139
+ secondaryActions.length > 1 ? `${secondaryActions.length} secondary actions` : undefined,
140
+ ].filter((issue) => Boolean(issue));
141
+ return {
142
+ errorMessage: issues.length
143
+ ? `LmvzModal actions slot must contain exactly one primary action, at most one secondary action, and optional tertiary actions. Received ${issues.join(' and ')}.`
144
+ : undefined,
145
+ primaryAction: primaryActions[0],
146
+ };
147
+ }
148
+ hasAssignedContent(slot) {
149
+ return Boolean(slot?.assignedNodes({ flatten: true }).some((node) => {
150
+ if (node.nodeType === Node.TEXT_NODE) {
151
+ return Boolean(node.textContent?.trim());
152
+ }
153
+ return node.nodeType === Node.ELEMENT_NODE;
154
+ }));
155
+ }
156
+ observeDialogState() {
157
+ if (!this.dialogEl || typeof MutationObserver === 'undefined')
158
+ return;
159
+ this.dialogStateObserver?.disconnect();
160
+ this.dialogStateObserver = new MutationObserver(() => {
161
+ if (!this.dialogEl || this.dialogEl.open === this.open)
162
+ return;
163
+ if (this.dialogEl.open) {
164
+ this.open = true;
165
+ return;
166
+ }
167
+ this.open = false;
168
+ });
169
+ this.dialogStateObserver.observe(this.dialogEl, {
170
+ attributes: true,
171
+ attributeFilter: ['open'],
172
+ });
173
+ }
174
+ isVisibleActionButton(element) {
175
+ return element.tagName === 'LMVZ-BUTTON' && !element.hasAttribute('hidden');
176
+ }
177
+ capturePreviouslyFocusedElement() {
178
+ const dialog = this.dialogEl;
179
+ const activeElement = getDeepActiveElement(document);
180
+ if (!dialog || !activeElement || dialog.contains(activeElement))
181
+ return;
182
+ this.previouslyFocusedElement = activeElement;
183
+ }
184
+ ensureDialogShowModalCapture() {
185
+ const dialog = this.dialogEl;
186
+ if (!dialog || typeof dialog.showModal !== 'function')
187
+ return;
188
+ const showModal = dialog.showModal;
189
+ if (showModal === this.wrappedDialogShowModal)
190
+ return;
191
+ const wrappedShowModal = () => {
192
+ this.capturePreviouslyFocusedElement();
193
+ return showModal.call(dialog);
194
+ };
195
+ Object.defineProperty(dialog, 'showModal', {
196
+ configurable: true,
197
+ value: wrappedShowModal,
198
+ });
199
+ this.wrappedDialogShowModal = wrappedShowModal;
200
+ }
201
+ syncDialogVisibility() {
202
+ const dialog = this.dialogEl;
203
+ if (!dialog)
204
+ return;
205
+ if (this.open) {
206
+ if (!dialog.open) {
207
+ this.capturePreviouslyFocusedElement();
208
+ if (typeof dialog.showModal === 'function') {
209
+ dialog.showModal();
210
+ }
211
+ else {
212
+ dialog.setAttribute('open', '');
213
+ }
214
+ }
215
+ this.focusPrimaryAction();
216
+ return;
217
+ }
218
+ if (!dialog.open)
219
+ return;
220
+ if (typeof dialog.close === 'function') {
221
+ dialog.close();
222
+ }
223
+ else {
224
+ dialog.removeAttribute('open');
225
+ this.handleDialogClose();
226
+ }
227
+ }
228
+ focusPrimaryAction() {
229
+ const primaryAction = this.enabledActionButtons.find((element) => {
230
+ return this.getActionVariant(element) === 'primary';
231
+ }) ?? this.enabledActionButtons[0];
232
+ const focusTarget = primaryAction ?? this.closeButtonEl;
233
+ if (!focusTarget || typeof window === 'undefined')
234
+ return;
235
+ window.requestAnimationFrame(() => {
236
+ if (this.open) {
237
+ focusTarget.focus();
238
+ }
239
+ });
240
+ }
241
+ restoreFocus() {
242
+ if (!this.previouslyFocusedElement?.isConnected)
243
+ return;
244
+ this.previouslyFocusedElement.focus();
245
+ this.previouslyFocusedElement = null;
246
+ }
247
+ handleCloseButtonClick = () => {
248
+ if (!this.dialogEl)
249
+ return;
250
+ const dialogWithRequestClose = this.dialogEl;
251
+ if (typeof dialogWithRequestClose.requestClose === 'function') {
252
+ this.pendingCloseReturnValue = 'close';
253
+ dialogWithRequestClose.requestClose('close');
254
+ return;
255
+ }
256
+ if (typeof this.dialogEl.close === 'function') {
257
+ this.dialogEl.close('close');
258
+ return;
259
+ }
260
+ this.handleDialogClose();
261
+ };
262
+ handleDialogCancel = (event) => {
263
+ event.preventDefault();
264
+ const emitted = this.dialogCancel.emit();
265
+ if (emitted.defaultPrevented) {
266
+ this.pendingCloseReturnValue = undefined;
267
+ return;
268
+ }
269
+ const returnValue = this.pendingCloseReturnValue;
270
+ this.pendingCloseReturnValue = undefined;
271
+ this.dialogEl?.close(returnValue);
272
+ };
273
+ handleDialogClose = () => {
274
+ console.log('Dialog close handler called');
275
+ if (this.open) {
276
+ this.open = false;
277
+ }
278
+ this.restoreFocus();
279
+ this.dialogClose.emit();
280
+ };
281
+ handleHeaderSlotChange = () => {
282
+ this.hasHeader = this.hasAssignedContent(this.headerSlot);
283
+ };
284
+ observeActionState() {
285
+ if (typeof MutationObserver === 'undefined')
286
+ return;
287
+ this.actionsStateObserver?.disconnect();
288
+ if (!this.assignedActionElements.length)
289
+ return;
290
+ this.actionsStateObserver = new MutationObserver(() => {
291
+ this.syncActionsState();
292
+ });
293
+ this.assignedActionElements.forEach((element) => {
294
+ this.actionsStateObserver?.observe(element, {
295
+ attributes: true,
296
+ attributeFilter: ['disabled', 'hidden', 'variant'],
297
+ });
298
+ });
299
+ }
300
+ syncActionsState() {
301
+ const assignedElements = this.assignedActionElements;
302
+ assignedElements.forEach((element) => {
303
+ const isAllowedAction = ['LMVZ-BUTTON', 'BUTTON'].includes(element.tagName.toUpperCase());
304
+ if (isAllowedAction)
305
+ return;
306
+ if (!element.hasAttribute('hidden')) {
307
+ element.setAttribute('hidden', '');
308
+ }
309
+ if (element.getAttribute('aria-hidden') !== 'true') {
310
+ element.setAttribute('aria-hidden', 'true');
311
+ }
312
+ });
313
+ this.hasActions = assignedElements.some((element) => this.isVisibleActionButton(element));
314
+ this.checkActions();
315
+ if (this.open) {
316
+ this.focusPrimaryAction();
317
+ }
318
+ }
319
+ handleActionsSlotChange = () => {
320
+ this.syncActionsState();
321
+ this.observeActionState();
322
+ };
323
+ checkActions() {
324
+ if (!isAriaValidationEnabled())
325
+ return;
326
+ const { errorMessage } = this.getActionValidationResult();
327
+ if (!errorMessage) {
328
+ this.lastActionValidationMessage = undefined;
329
+ return;
330
+ }
331
+ if (this.lastActionValidationMessage === errorMessage)
332
+ return;
333
+ console.error(errorMessage);
334
+ this.lastActionValidationMessage = errorMessage;
335
+ }
336
+ render() {
337
+ return (h(Host, { key: 'f319dcb33aaa6426e568fba1bfb6c8c3927432cb' }, h("dialog", { key: '1c5b1659b243a2af19ec5b41d19a2096b522671c', ref: (element) => (this.dialogEl = element), onCancel: this.handleDialogCancel, onClose: this.handleDialogClose, ...this.dialogAccessibilityAttributes }, h("div", { key: '2d0260f11a75e28688a14b0263df0d00f8ba54b9', class: "modal-shell" }, h("header", { key: 'd96739e3b0a7f2c04e46585ddf4e431c91a698ce', class: { header: true, 'has-title': this.hasHeader } }, h("div", { key: 'f5202ac26195a3571e3767e0d3683c2bc960c2ec', class: "title", id: this.dialogTitleId, hidden: !this.hasHeader }, h("slot", { key: '2568ee3465bc070e353e647c58735a34005907d7', name: "header", ref: (element) => (this.headerSlot = element), onSlotchange: this.handleHeaderSlotChange })), h("lmvz-button", { key: '7978e838dc84ce83ee674aa111523b260d1861da', ref: (element) => (this.closeButtonEl = element), type: "button", class: "close-button", "aria-label": this.closeLabel, onClick: this.handleCloseButtonClick, variant: "tertiary" }, h("lmvz-icon", { key: '9f235507acbf2ee42747bfc44302fcae47d9ba0e', icon: closeIconSvg }))), h("div", { key: '7eeab9b2f0fd5d41c0218380436e2f092481813a', class: "body" }, h("slot", { key: '8904e87fa438caf2b7f34c4025ff688d94f4dea2' })), h("footer", { key: '0610abd150de228da893092e9f38721087144564', class: "actions", hidden: !this.hasActions }, h("slot", { key: '0f5457cb2544602a3b980f90e7297ed700d62fee', name: "actions", ref: (element) => (this.actionsSlot = element), onSlotchange: this.handleActionsSlotChange }))))));
338
+ }
339
+ static get watchers() { return {
340
+ "open": [{
341
+ "handleOpenChange": 0
342
+ }]
343
+ }; }
344
+ };
345
+ LmvzModal.style = lmvzModalCss();
346
+
347
+ export { LmvzModal as lmvz_modal };
@@ -1,5 +1,5 @@
1
- import { g as getElement, r as registerInstance, c as createEvent, h, H as Host } from './index-saW7O-EW.js';
2
- import { R as ReactiveControllerHost, A as AriaValidationController } from './reactive-controller-host-DHcPpJW7.js';
1
+ import { g as getElement, r as registerInstance, c as createEvent, h, H as Host } from './index-Aa_425iY.js';
2
+ import { R as ReactiveControllerHost, A as AriaValidationController } from './reactive-controller-host-lF2kXM1x.js';
3
3
  import './aria-loader-BVolm0lC.js';
4
4
 
5
5
  const chevronDownSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwLjMzMzQgOC42NjY2M0wxMi4wMDAxIDE3TDMuNjY2NzUgOC42NjY2MyIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
@@ -17,7 +17,7 @@ const LmvzSelect = class extends ReactiveControllerHost {
17
17
  constructor(hostRef) {
18
18
  super();
19
19
  registerInstance(this, hostRef);
20
- this.lmvzChange = createEvent(this, "lmvzChange");
20
+ this.lmvzChange = createEvent(this, "lmvzChange", 7);
21
21
  this.addController(new AriaValidationController(this));
22
22
  }
23
23
  lmvzChange;
@@ -56,7 +56,7 @@ const LmvzSelect = class extends ReactiveControllerHost {
56
56
  render() {
57
57
  const hasValue = this.hasValue;
58
58
  const shouldShowLabel = hasValue;
59
- 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)));
59
+ return (h(Host, { key: '4a78608686bd771615d1bd6f5c5df243b813f0a3' }, h("div", { key: 'fc526485d7c1718c0044a8076151954fb0db680d', class: "select-wrapper" }, h("label", { key: '16c68d944b626f06b36c458daa351b05f0d6de92', htmlFor: this.selectId, class: shouldShowLabel ? 'floating-label' : 'assistive-label' }, this.label, this.required && shouldShowLabel && h("span", { key: '06ea7ab990b1119c726d39620cda2f2f53d6342a', "aria-hidden": "true" }, " *")), h("div", { key: '46e77a996cd17db6e882fdc0f5ac65fb90f71df5', "aria-hidden": "true" }, h("span", { key: '6b1e9f849e7e876f704816de6f55128e3d462587' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && h("span", { key: 'd90c6b965c594a45f6699aaca3bc85de38bf5584', "aria-hidden": "true" }, " *")), h("span", { key: 'd91ce778422521a0b414aceb7161a871023730d9' }, h("img", { key: '3e405cebf0c02d91448c9db412837f4af554c4b2', src: chevronDownSvg, alt: "" }))), h("select", { key: 'b443a08e1436f75af572e102e8d43a9c3d031810', 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: '7125eccebfb3541522d0461adcf1e203514d8af6', value: "", disabled: true, selected: true, hidden: true }), h("slot", { key: '80f7edf9e20b19ec8041d23b84752f2cd7c1a72e' }))), this.helperText && h("div", { key: '49cdd7ce54b5bc9031db2ef9826891d6a4f666b1', role: "status" }, this.helperText)));
60
60
  }
61
61
  static get watchers() { return {
62
62
  "value": [{
@@ -0,0 +1,94 @@
1
+ import { g as getElement, r as registerInstance, c as createEvent, h, H as Host } from './index-Aa_425iY.js';
2
+ import { R as ReactiveControllerHost, A as AriaValidationController } from './reactive-controller-host-lF2kXM1x.js';
3
+ import { c as componentOnReady } from './component-DOTK1OW3.js';
4
+ import './aria-loader-BVolm0lC.js';
5
+
6
+ const lmvzToggleCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-toggle-h { display: inline-flex; align-items: center; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-block: var(--lmvz-dimension-2-8, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-4-10, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); cursor: pointer; background-color: transparent; user-select: none; } .sc-lmvz-toggle-h:not([disabled]):hover { background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } [checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f1f9fe); } [disabled][checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f1f9fe); } [disabled].sc-lmvz-toggle-h { cursor: not-allowed; opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; } .track.sc-lmvz-toggle { position: relative; flex-shrink: 0; width: var(--lmvz-global-s32, 32px); height: var(--lmvz-global-s20, 20px); border-radius: var(--lmvz-semantic-border-radius-round, 999px); background-color: var(--lmvz-semantic-color-surface-input-primary, #ffffff); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); } .sc-lmvz-toggle-h:not([disabled]):hover .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } [checked].sc-lmvz-toggle-h .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } input.sc-lmvz-toggle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: inherit; } .sc-lmvz-toggle-h:focus-within { outline: 2px solid var(--lmvz-semantic-color-border-active, #0f8acc); outline-offset: 2px; } .thumb.sc-lmvz-toggle { position: absolute; width: var(--lmvz-global-s13, 13px); height: var(--lmvz-global-s13, 13px); border-radius: 50%; background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); top: 50%; transform: translateY(-50%); left: var(--lmvz-global-s4, 4px); transition: left 0.2s ease, background-color 0.2s ease; pointer-events: none; } [checked].sc-lmvz-toggle-h .thumb.sc-lmvz-toggle { left: calc(var(--lmvz-global-s4, 4px) + var(--lmvz-global-s11, 11px)); background-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); } label.sc-lmvz-toggle { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); color: var(--lmvz-semantic-color-on-surface-primary, #000000); cursor: pointer; }`;
7
+
8
+ let toggleIdCounter = 0;
9
+ const LmvzToggle = class extends ReactiveControllerHost {
10
+ get el() { return getElement(this); }
11
+ get validationEl() {
12
+ return this.el;
13
+ }
14
+ internals;
15
+ nativeInputElement;
16
+ toggleId = `lmvz-toggle-${toggleIdCounter++}`;
17
+ lmvzChange;
18
+ label;
19
+ checked = false;
20
+ disabled = false;
21
+ required = false;
22
+ name;
23
+ value = 'on';
24
+ form;
25
+ constructor(hostRef) {
26
+ super();
27
+ registerInstance(this, hostRef);
28
+ this.lmvzChange = createEvent(this, "lmvzChange", 7);
29
+ if (hostRef.$hostElement$["s-ei"]) {
30
+ this.internals = hostRef.$hostElement$["s-ei"];
31
+ }
32
+ else {
33
+ this.internals = hostRef.$hostElement$.attachInternals();
34
+ hostRef.$hostElement$["s-ei"] = this.internals;
35
+ }
36
+ this.addController(new AriaValidationController(this));
37
+ }
38
+ formAssociatedCallback(_form) {
39
+ this.internals.setFormValue?.(this.checked ? this.value : null);
40
+ }
41
+ formResetCallback() {
42
+ this.checked = false;
43
+ }
44
+ formStateRestoreCallback(state) {
45
+ this.checked = state === this.value;
46
+ this.internals.setFormValue?.(this.checked ? this.value : null);
47
+ }
48
+ handleCheckedChange(checked) {
49
+ this.internals.setFormValue?.(checked ? this.value : null);
50
+ }
51
+ handleDisabledChange(disabled) {
52
+ if (disabled && this.nativeInputElement) {
53
+ this.nativeInputElement.blur();
54
+ }
55
+ }
56
+ async focusToggle() {
57
+ this.nativeInputElement?.focus();
58
+ }
59
+ async blurToggle() {
60
+ this.nativeInputElement?.blur();
61
+ }
62
+ async checkValidity() {
63
+ return this.nativeInputElement?.checkValidity?.() ?? false;
64
+ }
65
+ async reportValidity() {
66
+ return this.nativeInputElement?.reportValidity?.() ?? false;
67
+ }
68
+ async getInputElement() {
69
+ if (!this.nativeInputElement) {
70
+ await new Promise((resolve) => componentOnReady(this.el, resolve));
71
+ }
72
+ return Promise.resolve(this.nativeInputElement);
73
+ }
74
+ handleChange = (event) => {
75
+ const newChecked = event.target.checked;
76
+ this.checked = newChecked;
77
+ this.lmvzChange.emit(newChecked);
78
+ };
79
+ render() {
80
+ return (h(Host, { key: '49a543437a842709b6a3bfb00c828a40b227bb57' }, h("span", { key: '746292d49c58656336037f7b07a9aaee9dbc6ed1', class: "track" }, h("input", { key: 'ae329571344b05d9af814fdc1cc792e1c600d807', 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: 'e5742029679333fcd66a25aeb3f8826dbb3a8956', class: "thumb", "aria-hidden": "true" })), h("label", { key: '4cb92eb975b8c337162986011497afdeb188ed4f', htmlFor: this.toggleId }, this.label)));
81
+ }
82
+ static get formAssociated() { return true; }
83
+ static get watchers() { return {
84
+ "checked": [{
85
+ "handleCheckedChange": 0
86
+ }],
87
+ "disabled": [{
88
+ "handleDisabledChange": 0
89
+ }]
90
+ }; }
91
+ };
92
+ LmvzToggle.style = lmvzToggleCss();
93
+
94
+ export { LmvzToggle as lmvz_toggle };
package/esm/loader.js CHANGED
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-saW7O-EW.js';
2
- export { s as setNonce } from './index-saW7O-EW.js';
1
+ import { b as bootstrapLazy } from './index-Aa_425iY.js';
2
+ export { s as setNonce } from './index-Aa_425iY.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["lmvz-header_2",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action",[[257,"lmvz-action"]]],["lmvz-button",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1]}]]],["lmvz-card",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-icon",[[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]],["lmvz-input",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]]], options);
8
+ return bootstrapLazy([["lmvz-modal",[[769,"lmvz-modal",{"open":[1540],"closeLabel":[1,"close-label"],"hasActions":[32],"hasHeader":[32]},[[0,"submit","handleFormDialogSubmit"]],{"open":[{"handleOpenChange":0}]}]]],["lmvz-header_2",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action",[[257,"lmvz-action"]]],["lmvz-card",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-input",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]],["lmvz-toggle",[[578,"lmvz-toggle",{"label":[1],"checked":[1540],"disabled":[516],"required":[516],"name":[1],"value":[1],"form":[1],"focusToggle":[64],"blurToggle":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"checked":[{"handleCheckedChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-button_2",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1],"formMethod":[1,"form-method"],"name":[1],"value":[1]}],[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,5 +1,5 @@
1
1
  import { i as isAriaValidationEnabled, u as useVerboseLogging, A as ARIA_VALIDATION_RUNTIME_CHANGED_EVENT, q as queueValidation } from './aria-loader-BVolm0lC.js';
2
- import { B as Build } from './index-saW7O-EW.js';
2
+ import { B as Build } from './index-Aa_425iY.js';
3
3
 
4
4
  class AriaValidationController {
5
5
  host;