@lmvz-ds/components 0.21.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.
- package/CHANGELOG.md +6 -0
- package/assets/icons/close-sm.svg +3 -0
- package/cjs/{component-Csg9MtNK.js → component-C7cavwmZ.js} +3 -0
- package/cjs/{index-C2yDXRqP.js → index-lW-SEvL7.js} +67 -3
- package/cjs/lmvz-action.cjs.entry.js +2 -2
- package/cjs/{lmvz-button.cjs.entry.js → lmvz-button_2.cjs.entry.js} +139 -14
- package/cjs/lmvz-card.cjs.entry.js +2 -2
- package/cjs/lmvz-checkbox.cjs.entry.js +3 -3
- package/cjs/lmvz-chip.cjs.entry.js +4 -4
- package/cjs/lmvz-components.cjs.js +2 -2
- package/cjs/lmvz-header_2.cjs.entry.js +3 -3
- package/cjs/lmvz-input.cjs.entry.js +4 -4
- package/cjs/lmvz-menuitem.cjs.entry.js +3 -3
- package/cjs/lmvz-modal.cjs.entry.js +349 -0
- package/cjs/lmvz-select.cjs.entry.js +4 -4
- package/cjs/lmvz-toggle.cjs.entry.js +5 -5
- package/cjs/loader.cjs.js +2 -2
- package/cjs/{reactive-controller-host-BA4ZhjKA.js → reactive-controller-host-DnSTWHCF.js} +1 -1
- package/collection/assets/icons/close-sm.svg +3 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-button/lmvz-button.js +98 -10
- package/collection/components/lmvz-chip/lmvz-chip.js +2 -2
- package/collection/components/lmvz-modal/lmvz-modal.css +120 -0
- package/collection/components/lmvz-modal/lmvz-modal.js +448 -0
- package/collection/components/lmvz-select/lmvz-select.js +1 -1
- package/collection/components/lmvz-toggle/lmvz-toggle.js +1 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-action.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.d.ts +11 -0
- package/components/lmvz-modal.d.ts.bak +11 -0
- package/components/lmvz-modal.js +1 -0
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-toggle.js +1 -1
- package/components/p-Boj0PCdB.js +1 -0
- package/components/p-CK8cAKcB.js +1 -0
- package/components/p-Cc6dOWwS.js +1 -0
- package/components/{p-BuFx0tTm.js → p-DBc1BzQb.js} +1 -1
- package/components/p-DOTK1OW3.js +1 -0
- package/esm/{component-DIrAQ4IB.js → component-DOTK1OW3.js} +3 -0
- package/esm/{index-saW7O-EW.js → index-Aa_425iY.js} +67 -3
- package/esm/lmvz-action.entry.js +2 -2
- package/esm/{lmvz-button.entry.js → lmvz-button_2.entry.js} +139 -15
- package/esm/lmvz-card.entry.js +2 -2
- package/esm/lmvz-checkbox.entry.js +3 -3
- package/esm/lmvz-chip.entry.js +4 -4
- package/esm/lmvz-components.js +3 -3
- package/esm/lmvz-header_2.entry.js +3 -3
- package/esm/lmvz-input.entry.js +4 -4
- package/esm/lmvz-menuitem.entry.js +3 -3
- package/esm/lmvz-modal.entry.js +347 -0
- package/esm/lmvz-select.entry.js +4 -4
- package/esm/lmvz-toggle.entry.js +5 -5
- package/esm/loader.js +3 -3
- package/esm/{reactive-controller-host-DHcPpJW7.js → reactive-controller-host-lF2kXM1x.js} +1 -1
- package/hydrate/index.js +451 -26
- package/hydrate/index.mjs +451 -26
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/p-08a08b63.entry.js +1 -0
- package/lmvz-components/p-1b181e90.entry.js +1 -0
- package/lmvz-components/p-23fb2476.entry.js +1 -0
- package/lmvz-components/p-3846ba08.entry.js +1 -0
- package/lmvz-components/p-6bb145e4.entry.js +1 -0
- package/lmvz-components/{p-2f83d7a2.entry.js → p-7a310b1e.entry.js} +1 -1
- package/lmvz-components/p-Aa_425iY.js +2 -0
- package/lmvz-components/{p-GdMr6Qlp.js → p-DCTzMRMQ.js} +1 -1
- package/lmvz-components/p-DOTK1OW3.js +1 -0
- package/lmvz-components/p-b7940687.entry.js +1 -0
- package/lmvz-components/p-d984e118.entry.js +1 -0
- package/lmvz-components/p-db8306a5.entry.js +1 -0
- package/lmvz-components/p-ea335543.entry.js +1 -0
- package/lmvz-components/p-f8ea0eb2.entry.js +1 -0
- package/manifest.json +252 -5
- package/package.json +5 -1
- package/types/api/index.d.ts +6 -0
- package/types/components/lmvz-button/lmvz-button.d.ts +4 -0
- package/types/components/lmvz-modal/lmvz-modal.d.ts +58 -0
- package/types/components.d.ts +77 -0
- package/cjs/lmvz-icon.cjs.entry.js +0 -100
- package/components/p-C_bScbrd.js +0 -1
- package/components/p-DIrAQ4IB.js +0 -1
- package/esm/lmvz-icon.entry.js +0 -98
- package/lmvz-components/p-0f7a4236.entry.js +0 -1
- package/lmvz-components/p-32171f4f.entry.js +0 -1
- package/lmvz-components/p-400b2318.entry.js +0 -1
- package/lmvz-components/p-43e295ba.entry.js +0 -1
- package/lmvz-components/p-851969bd.entry.js +0 -1
- package/lmvz-components/p-9f9d845d.entry.js +0 -1
- package/lmvz-components/p-DIrAQ4IB.js +0 -1
- package/lmvz-components/p-a12f95da.entry.js +0 -1
- package/lmvz-components/p-ab4437dc.entry.js +0 -1
- package/lmvz-components/p-c3b7890d.entry.js +0 -1
- package/lmvz-components/p-d0a0e206.entry.js +0 -1
- package/lmvz-components/p-saW7O-EW.js +0 -2
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-lW-SEvL7.js');
|
|
4
|
+
var svg = require('./svg-BMBduILB.js');
|
|
5
|
+
var reactiveControllerHost = require('./reactive-controller-host-DnSTWHCF.js');
|
|
6
|
+
var component = require('./component-C7cavwmZ.js');
|
|
7
|
+
var ariaLoader = require('./aria-loader-Cec1zR2g.js');
|
|
8
|
+
require('./logger-DsM6xg6V.js');
|
|
9
|
+
|
|
10
|
+
const closeSmSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYgNkwxMiAxMk0xMiAxMkwxOCAxOE0xMiAxMkw2IDE4TTEyIDEyTDE4IDYiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==';
|
|
11
|
+
|
|
12
|
+
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; } `;
|
|
13
|
+
|
|
14
|
+
const closeIconSvg = svg.toValidSvgStringWithFallback(closeSmSvg);
|
|
15
|
+
let modalIdCounter = 0;
|
|
16
|
+
const LmvzModal = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
17
|
+
get el() { return index.getElement(this); }
|
|
18
|
+
inheritedAriaAttributes = {};
|
|
19
|
+
dialogEl;
|
|
20
|
+
dialogStateObserver;
|
|
21
|
+
actionsStateObserver;
|
|
22
|
+
headerSlot;
|
|
23
|
+
actionsSlot;
|
|
24
|
+
closeButtonEl;
|
|
25
|
+
previouslyFocusedElement = null;
|
|
26
|
+
wrappedDialogShowModal;
|
|
27
|
+
lastActionValidationMessage;
|
|
28
|
+
pendingCloseReturnValue;
|
|
29
|
+
dialogTitleId = `lmvz-modal-title-${modalIdCounter++}`;
|
|
30
|
+
hasActions = false;
|
|
31
|
+
hasHeader = false;
|
|
32
|
+
open = false;
|
|
33
|
+
closeLabel = 'Schliessen';
|
|
34
|
+
dialogClose;
|
|
35
|
+
dialogCancel;
|
|
36
|
+
get dialog() {
|
|
37
|
+
return this.dialogEl;
|
|
38
|
+
}
|
|
39
|
+
get validationEl() {
|
|
40
|
+
return this.dialogEl ?? this.el;
|
|
41
|
+
}
|
|
42
|
+
get validationSlot() {
|
|
43
|
+
return this.actionsSlot;
|
|
44
|
+
}
|
|
45
|
+
constructor(hostRef) {
|
|
46
|
+
super();
|
|
47
|
+
index.registerInstance(this, hostRef);
|
|
48
|
+
this.dialogClose = index.createEvent(this, "close", 6);
|
|
49
|
+
this.dialogCancel = index.createEvent(this, "cancel", 1);
|
|
50
|
+
this.addController(new reactiveControllerHost.AriaValidationController(this, { validationTiming: 'slot' }));
|
|
51
|
+
}
|
|
52
|
+
handleFormDialogSubmit(event) {
|
|
53
|
+
const form = event.target;
|
|
54
|
+
const submitter = event.submitter;
|
|
55
|
+
const isDialogForm = form.method === 'dialog' || submitter?.getAttribute('formmethod') === 'dialog';
|
|
56
|
+
if (!isDialogForm)
|
|
57
|
+
return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
this.dialogEl?.close(submitter?.value ?? '');
|
|
60
|
+
}
|
|
61
|
+
connectedCallback() {
|
|
62
|
+
this.inheritedAriaAttributes = component.inheritAriaAttributes(this.el, ['role']);
|
|
63
|
+
Object.defineProperty(this.el, 'dialog', {
|
|
64
|
+
configurable: true,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: () => {
|
|
67
|
+
this.ensureDialogShowModalCapture();
|
|
68
|
+
return this.dialogEl;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
super.connectedCallback();
|
|
72
|
+
}
|
|
73
|
+
componentDidLoad() {
|
|
74
|
+
this.handleHeaderSlotChange();
|
|
75
|
+
this.handleActionsSlotChange();
|
|
76
|
+
this.observeDialogState();
|
|
77
|
+
this.syncDialogVisibility();
|
|
78
|
+
super.componentDidLoad();
|
|
79
|
+
}
|
|
80
|
+
disconnectedCallback() {
|
|
81
|
+
this.actionsStateObserver?.disconnect();
|
|
82
|
+
this.dialogStateObserver?.disconnect();
|
|
83
|
+
super.disconnectedCallback();
|
|
84
|
+
}
|
|
85
|
+
componentDidRender() {
|
|
86
|
+
if (this.open) {
|
|
87
|
+
this.focusPrimaryAction();
|
|
88
|
+
}
|
|
89
|
+
super.componentDidRender();
|
|
90
|
+
}
|
|
91
|
+
handleOpenChange() {
|
|
92
|
+
this.syncDialogVisibility();
|
|
93
|
+
}
|
|
94
|
+
get dialogAccessibilityAttributes() {
|
|
95
|
+
const attributes = { ...this.inheritedAriaAttributes };
|
|
96
|
+
delete attributes['aria-label'];
|
|
97
|
+
delete attributes['aria-labelledby'];
|
|
98
|
+
if (this.hasHeader) {
|
|
99
|
+
attributes['aria-labelledby'] = this.dialogTitleId;
|
|
100
|
+
return attributes;
|
|
101
|
+
}
|
|
102
|
+
const inheritedLabelledBy = this.inheritedAriaAttributes['aria-labelledby'];
|
|
103
|
+
if (typeof inheritedLabelledBy === 'string') {
|
|
104
|
+
attributes['aria-labelledby'] = inheritedLabelledBy;
|
|
105
|
+
return attributes;
|
|
106
|
+
}
|
|
107
|
+
const inheritedLabel = this.inheritedAriaAttributes['aria-label'];
|
|
108
|
+
if (typeof inheritedLabel === 'string') {
|
|
109
|
+
attributes['aria-label'] = inheritedLabel;
|
|
110
|
+
}
|
|
111
|
+
return attributes;
|
|
112
|
+
}
|
|
113
|
+
get actionButtons() {
|
|
114
|
+
return (this.actionsSlot?.assignedElements({ flatten: true }) ?? []).filter((element) => {
|
|
115
|
+
return this.isVisibleActionButton(element);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
get enabledActionButtons() {
|
|
119
|
+
return this.actionButtons.filter((element) => {
|
|
120
|
+
return !this.isDisabledActionButton(element);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
get assignedActionElements() {
|
|
124
|
+
return this.actionsSlot?.assignedElements({ flatten: true }) ?? [];
|
|
125
|
+
}
|
|
126
|
+
isDisabledActionButton(element) {
|
|
127
|
+
return element.hasAttribute('disabled') || element.disabled === true;
|
|
128
|
+
}
|
|
129
|
+
getActionVariant(element) {
|
|
130
|
+
const variant = element.getAttribute('variant') ?? element.variant;
|
|
131
|
+
return variant === 'primary' || variant === 'secondary' || variant === 'tertiary' ? variant : 'secondary';
|
|
132
|
+
}
|
|
133
|
+
getActionValidationResult() {
|
|
134
|
+
if (!this.actionButtons.length) {
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
const primaryActions = this.actionButtons.filter((element) => this.getActionVariant(element) === 'primary');
|
|
138
|
+
const secondaryActions = this.actionButtons.filter((element) => this.getActionVariant(element) === 'secondary');
|
|
139
|
+
const issues = [
|
|
140
|
+
primaryActions.length !== 1 ? `${primaryActions.length} primary action${primaryActions.length === 1 ? '' : 's'}` : undefined,
|
|
141
|
+
secondaryActions.length > 1 ? `${secondaryActions.length} secondary actions` : undefined,
|
|
142
|
+
].filter((issue) => Boolean(issue));
|
|
143
|
+
return {
|
|
144
|
+
errorMessage: issues.length
|
|
145
|
+
? `LmvzModal actions slot must contain exactly one primary action, at most one secondary action, and optional tertiary actions. Received ${issues.join(' and ')}.`
|
|
146
|
+
: undefined,
|
|
147
|
+
primaryAction: primaryActions[0],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
hasAssignedContent(slot) {
|
|
151
|
+
return Boolean(slot?.assignedNodes({ flatten: true }).some((node) => {
|
|
152
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
153
|
+
return Boolean(node.textContent?.trim());
|
|
154
|
+
}
|
|
155
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
observeDialogState() {
|
|
159
|
+
if (!this.dialogEl || typeof MutationObserver === 'undefined')
|
|
160
|
+
return;
|
|
161
|
+
this.dialogStateObserver?.disconnect();
|
|
162
|
+
this.dialogStateObserver = new MutationObserver(() => {
|
|
163
|
+
if (!this.dialogEl || this.dialogEl.open === this.open)
|
|
164
|
+
return;
|
|
165
|
+
if (this.dialogEl.open) {
|
|
166
|
+
this.open = true;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.open = false;
|
|
170
|
+
});
|
|
171
|
+
this.dialogStateObserver.observe(this.dialogEl, {
|
|
172
|
+
attributes: true,
|
|
173
|
+
attributeFilter: ['open'],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
isVisibleActionButton(element) {
|
|
177
|
+
return element.tagName === 'LMVZ-BUTTON' && !element.hasAttribute('hidden');
|
|
178
|
+
}
|
|
179
|
+
capturePreviouslyFocusedElement() {
|
|
180
|
+
const dialog = this.dialogEl;
|
|
181
|
+
const activeElement = component.getDeepActiveElement(document);
|
|
182
|
+
if (!dialog || !activeElement || dialog.contains(activeElement))
|
|
183
|
+
return;
|
|
184
|
+
this.previouslyFocusedElement = activeElement;
|
|
185
|
+
}
|
|
186
|
+
ensureDialogShowModalCapture() {
|
|
187
|
+
const dialog = this.dialogEl;
|
|
188
|
+
if (!dialog || typeof dialog.showModal !== 'function')
|
|
189
|
+
return;
|
|
190
|
+
const showModal = dialog.showModal;
|
|
191
|
+
if (showModal === this.wrappedDialogShowModal)
|
|
192
|
+
return;
|
|
193
|
+
const wrappedShowModal = () => {
|
|
194
|
+
this.capturePreviouslyFocusedElement();
|
|
195
|
+
return showModal.call(dialog);
|
|
196
|
+
};
|
|
197
|
+
Object.defineProperty(dialog, 'showModal', {
|
|
198
|
+
configurable: true,
|
|
199
|
+
value: wrappedShowModal,
|
|
200
|
+
});
|
|
201
|
+
this.wrappedDialogShowModal = wrappedShowModal;
|
|
202
|
+
}
|
|
203
|
+
syncDialogVisibility() {
|
|
204
|
+
const dialog = this.dialogEl;
|
|
205
|
+
if (!dialog)
|
|
206
|
+
return;
|
|
207
|
+
if (this.open) {
|
|
208
|
+
if (!dialog.open) {
|
|
209
|
+
this.capturePreviouslyFocusedElement();
|
|
210
|
+
if (typeof dialog.showModal === 'function') {
|
|
211
|
+
dialog.showModal();
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
dialog.setAttribute('open', '');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
this.focusPrimaryAction();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (!dialog.open)
|
|
221
|
+
return;
|
|
222
|
+
if (typeof dialog.close === 'function') {
|
|
223
|
+
dialog.close();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
dialog.removeAttribute('open');
|
|
227
|
+
this.handleDialogClose();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
focusPrimaryAction() {
|
|
231
|
+
const primaryAction = this.enabledActionButtons.find((element) => {
|
|
232
|
+
return this.getActionVariant(element) === 'primary';
|
|
233
|
+
}) ?? this.enabledActionButtons[0];
|
|
234
|
+
const focusTarget = primaryAction ?? this.closeButtonEl;
|
|
235
|
+
if (!focusTarget || typeof window === 'undefined')
|
|
236
|
+
return;
|
|
237
|
+
window.requestAnimationFrame(() => {
|
|
238
|
+
if (this.open) {
|
|
239
|
+
focusTarget.focus();
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
restoreFocus() {
|
|
244
|
+
if (!this.previouslyFocusedElement?.isConnected)
|
|
245
|
+
return;
|
|
246
|
+
this.previouslyFocusedElement.focus();
|
|
247
|
+
this.previouslyFocusedElement = null;
|
|
248
|
+
}
|
|
249
|
+
handleCloseButtonClick = () => {
|
|
250
|
+
if (!this.dialogEl)
|
|
251
|
+
return;
|
|
252
|
+
const dialogWithRequestClose = this.dialogEl;
|
|
253
|
+
if (typeof dialogWithRequestClose.requestClose === 'function') {
|
|
254
|
+
this.pendingCloseReturnValue = 'close';
|
|
255
|
+
dialogWithRequestClose.requestClose('close');
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (typeof this.dialogEl.close === 'function') {
|
|
259
|
+
this.dialogEl.close('close');
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.handleDialogClose();
|
|
263
|
+
};
|
|
264
|
+
handleDialogCancel = (event) => {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
const emitted = this.dialogCancel.emit();
|
|
267
|
+
if (emitted.defaultPrevented) {
|
|
268
|
+
this.pendingCloseReturnValue = undefined;
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const returnValue = this.pendingCloseReturnValue;
|
|
272
|
+
this.pendingCloseReturnValue = undefined;
|
|
273
|
+
this.dialogEl?.close(returnValue);
|
|
274
|
+
};
|
|
275
|
+
handleDialogClose = () => {
|
|
276
|
+
console.log('Dialog close handler called');
|
|
277
|
+
if (this.open) {
|
|
278
|
+
this.open = false;
|
|
279
|
+
}
|
|
280
|
+
this.restoreFocus();
|
|
281
|
+
this.dialogClose.emit();
|
|
282
|
+
};
|
|
283
|
+
handleHeaderSlotChange = () => {
|
|
284
|
+
this.hasHeader = this.hasAssignedContent(this.headerSlot);
|
|
285
|
+
};
|
|
286
|
+
observeActionState() {
|
|
287
|
+
if (typeof MutationObserver === 'undefined')
|
|
288
|
+
return;
|
|
289
|
+
this.actionsStateObserver?.disconnect();
|
|
290
|
+
if (!this.assignedActionElements.length)
|
|
291
|
+
return;
|
|
292
|
+
this.actionsStateObserver = new MutationObserver(() => {
|
|
293
|
+
this.syncActionsState();
|
|
294
|
+
});
|
|
295
|
+
this.assignedActionElements.forEach((element) => {
|
|
296
|
+
this.actionsStateObserver?.observe(element, {
|
|
297
|
+
attributes: true,
|
|
298
|
+
attributeFilter: ['disabled', 'hidden', 'variant'],
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
syncActionsState() {
|
|
303
|
+
const assignedElements = this.assignedActionElements;
|
|
304
|
+
assignedElements.forEach((element) => {
|
|
305
|
+
const isAllowedAction = ['LMVZ-BUTTON', 'BUTTON'].includes(element.tagName.toUpperCase());
|
|
306
|
+
if (isAllowedAction)
|
|
307
|
+
return;
|
|
308
|
+
if (!element.hasAttribute('hidden')) {
|
|
309
|
+
element.setAttribute('hidden', '');
|
|
310
|
+
}
|
|
311
|
+
if (element.getAttribute('aria-hidden') !== 'true') {
|
|
312
|
+
element.setAttribute('aria-hidden', 'true');
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
this.hasActions = assignedElements.some((element) => this.isVisibleActionButton(element));
|
|
316
|
+
this.checkActions();
|
|
317
|
+
if (this.open) {
|
|
318
|
+
this.focusPrimaryAction();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
handleActionsSlotChange = () => {
|
|
322
|
+
this.syncActionsState();
|
|
323
|
+
this.observeActionState();
|
|
324
|
+
};
|
|
325
|
+
checkActions() {
|
|
326
|
+
if (!ariaLoader.isAriaValidationEnabled())
|
|
327
|
+
return;
|
|
328
|
+
const { errorMessage } = this.getActionValidationResult();
|
|
329
|
+
if (!errorMessage) {
|
|
330
|
+
this.lastActionValidationMessage = undefined;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (this.lastActionValidationMessage === errorMessage)
|
|
334
|
+
return;
|
|
335
|
+
console.error(errorMessage);
|
|
336
|
+
this.lastActionValidationMessage = errorMessage;
|
|
337
|
+
}
|
|
338
|
+
render() {
|
|
339
|
+
return (index.h(index.Host, { key: 'f319dcb33aaa6426e568fba1bfb6c8c3927432cb' }, index.h("dialog", { key: '1c5b1659b243a2af19ec5b41d19a2096b522671c', ref: (element) => (this.dialogEl = element), onCancel: this.handleDialogCancel, onClose: this.handleDialogClose, ...this.dialogAccessibilityAttributes }, index.h("div", { key: '2d0260f11a75e28688a14b0263df0d00f8ba54b9', class: "modal-shell" }, index.h("header", { key: 'd96739e3b0a7f2c04e46585ddf4e431c91a698ce', class: { header: true, 'has-title': this.hasHeader } }, index.h("div", { key: 'f5202ac26195a3571e3767e0d3683c2bc960c2ec', class: "title", id: this.dialogTitleId, hidden: !this.hasHeader }, index.h("slot", { key: '2568ee3465bc070e353e647c58735a34005907d7', name: "header", ref: (element) => (this.headerSlot = element), onSlotchange: this.handleHeaderSlotChange })), index.h("lmvz-button", { key: '7978e838dc84ce83ee674aa111523b260d1861da', ref: (element) => (this.closeButtonEl = element), type: "button", class: "close-button", "aria-label": this.closeLabel, onClick: this.handleCloseButtonClick, variant: "tertiary" }, index.h("lmvz-icon", { key: '9f235507acbf2ee42747bfc44302fcae47d9ba0e', icon: closeIconSvg }))), index.h("div", { key: '7eeab9b2f0fd5d41c0218380436e2f092481813a', class: "body" }, index.h("slot", { key: '8904e87fa438caf2b7f34c4025ff688d94f4dea2' })), index.h("footer", { key: '0610abd150de228da893092e9f38721087144564', class: "actions", hidden: !this.hasActions }, index.h("slot", { key: '0f5457cb2544602a3b980f90e7297ed700d62fee', name: "actions", ref: (element) => (this.actionsSlot = element), onSlotchange: this.handleActionsSlotChange }))))));
|
|
340
|
+
}
|
|
341
|
+
static get watchers() { return {
|
|
342
|
+
"open": [{
|
|
343
|
+
"handleOpenChange": 0
|
|
344
|
+
}]
|
|
345
|
+
}; }
|
|
346
|
+
};
|
|
347
|
+
LmvzModal.style = lmvzModalCss();
|
|
348
|
+
|
|
349
|
+
exports.lmvz_modal = LmvzModal;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var reactiveControllerHost = require('./reactive-controller-host-
|
|
3
|
+
var index = require('./index-lW-SEvL7.js');
|
|
4
|
+
var reactiveControllerHost = require('./reactive-controller-host-DnSTWHCF.js');
|
|
5
5
|
require('./aria-loader-Cec1zR2g.js');
|
|
6
6
|
|
|
7
7
|
const chevronDownSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwLjMzMzQgOC42NjY2M0wxMi4wMDAxIDE3TDMuNjY2NzUgOC42NjY2MyIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=';
|
|
@@ -19,7 +19,7 @@ const LmvzSelect = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
19
19
|
constructor(hostRef) {
|
|
20
20
|
super();
|
|
21
21
|
index.registerInstance(this, hostRef);
|
|
22
|
-
this.lmvzChange = index.createEvent(this, "lmvzChange");
|
|
22
|
+
this.lmvzChange = index.createEvent(this, "lmvzChange", 7);
|
|
23
23
|
this.addController(new reactiveControllerHost.AriaValidationController(this));
|
|
24
24
|
}
|
|
25
25
|
lmvzChange;
|
|
@@ -58,7 +58,7 @@ const LmvzSelect = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
58
58
|
render() {
|
|
59
59
|
const hasValue = this.hasValue;
|
|
60
60
|
const shouldShowLabel = hasValue;
|
|
61
|
-
return (index.h(index.Host, { key: '
|
|
61
|
+
return (index.h(index.Host, { key: '4a78608686bd771615d1bd6f5c5df243b813f0a3' }, index.h("div", { key: 'fc526485d7c1718c0044a8076151954fb0db680d', class: "select-wrapper" }, index.h("label", { key: '16c68d944b626f06b36c458daa351b05f0d6de92', htmlFor: this.selectId, class: shouldShowLabel ? 'floating-label' : 'assistive-label' }, this.label, this.required && shouldShowLabel && index.h("span", { key: '06ea7ab990b1119c726d39620cda2f2f53d6342a', "aria-hidden": "true" }, " *")), index.h("div", { key: '46e77a996cd17db6e882fdc0f5ac65fb90f71df5', "aria-hidden": "true" }, index.h("span", { key: '6b1e9f849e7e876f704816de6f55128e3d462587' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && index.h("span", { key: 'd90c6b965c594a45f6699aaca3bc85de38bf5584', "aria-hidden": "true" }, " *")), index.h("span", { key: 'd91ce778422521a0b414aceb7161a871023730d9' }, index.h("img", { key: '3e405cebf0c02d91448c9db412837f4af554c4b2', src: chevronDownSvg, alt: "" }))), index.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 && index.h("option", { key: '7125eccebfb3541522d0461adcf1e203514d8af6', value: "", disabled: true, selected: true, hidden: true }), index.h("slot", { key: '80f7edf9e20b19ec8041d23b84752f2cd7c1a72e' }))), this.helperText && index.h("div", { key: '49cdd7ce54b5bc9031db2ef9826891d6a4f666b1', role: "status" }, this.helperText)));
|
|
62
62
|
}
|
|
63
63
|
static get watchers() { return {
|
|
64
64
|
"value": [{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var reactiveControllerHost = require('./reactive-controller-host-
|
|
5
|
-
var component = require('./component-
|
|
3
|
+
var index = require('./index-lW-SEvL7.js');
|
|
4
|
+
var reactiveControllerHost = require('./reactive-controller-host-DnSTWHCF.js');
|
|
5
|
+
var component = require('./component-C7cavwmZ.js');
|
|
6
6
|
require('./aria-loader-Cec1zR2g.js');
|
|
7
7
|
|
|
8
8
|
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; }`;
|
|
@@ -27,7 +27,7 @@ const LmvzToggle = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
27
27
|
constructor(hostRef) {
|
|
28
28
|
super();
|
|
29
29
|
index.registerInstance(this, hostRef);
|
|
30
|
-
this.lmvzChange = index.createEvent(this, "lmvzChange");
|
|
30
|
+
this.lmvzChange = index.createEvent(this, "lmvzChange", 7);
|
|
31
31
|
if (hostRef.$hostElement$["s-ei"]) {
|
|
32
32
|
this.internals = hostRef.$hostElement$["s-ei"];
|
|
33
33
|
}
|
|
@@ -79,7 +79,7 @@ const LmvzToggle = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
79
79
|
this.lmvzChange.emit(newChecked);
|
|
80
80
|
};
|
|
81
81
|
render() {
|
|
82
|
-
return (index.h(index.Host, { key: '
|
|
82
|
+
return (index.h(index.Host, { key: '49a543437a842709b6a3bfb00c828a40b227bb57' }, index.h("span", { key: '746292d49c58656336037f7b07a9aaee9dbc6ed1', class: "track" }, index.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 }), index.h("span", { key: 'e5742029679333fcd66a25aeb3f8826dbb3a8956', class: "thumb", "aria-hidden": "true" })), index.h("label", { key: '4cb92eb975b8c337162986011497afdeb188ed4f', htmlFor: this.toggleId }, this.label)));
|
|
83
83
|
}
|
|
84
84
|
static get formAssociated() { return true; }
|
|
85
85
|
static get watchers() { return {
|
package/cjs/loader.cjs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-lW-SEvL7.js');
|
|
4
4
|
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
5
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["lmvz-
|
|
9
|
+
return index.bootstrapLazy([["lmvz-modal.cjs",[[769,"lmvz-modal",{"open":[1540],"closeLabel":[1,"close-label"],"hasActions":[32],"hasHeader":[32]},[[0,"submit","handleFormDialogSubmit"]],{"open":[{"handleOpenChange":0}]}]]],["lmvz-header_2.cjs",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action.cjs",[[257,"lmvz-action"]]],["lmvz-card.cjs",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox.cjs",[[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.cjs",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-input.cjs",[[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.cjs",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select.cjs",[[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.cjs",[[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.cjs",[[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);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"components/lmvz-icon/lmvz-icon.js",
|
|
10
10
|
"components/lmvz-input/lmvz-input.js",
|
|
11
11
|
"components/lmvz-menuitem/lmvz-menuitem.js",
|
|
12
|
+
"components/lmvz-modal/lmvz-modal.js",
|
|
12
13
|
"components/lmvz-select/lmvz-select.js",
|
|
13
14
|
"components/lmvz-toggle/lmvz-toggle.js",
|
|
14
15
|
"integration/header-integration/header-integration.js"
|
|
@@ -19,6 +19,9 @@ export class LmvzButton extends ReactiveControllerHost {
|
|
|
19
19
|
disabled = false;
|
|
20
20
|
type = 'button';
|
|
21
21
|
form;
|
|
22
|
+
formMethod;
|
|
23
|
+
name;
|
|
24
|
+
value;
|
|
22
25
|
constructor() {
|
|
23
26
|
super();
|
|
24
27
|
this.addController(new AriaValidationController(this));
|
|
@@ -31,18 +34,46 @@ export class LmvzButton extends ReactiveControllerHost {
|
|
|
31
34
|
this.inheritedAttributes = inheritAriaAttributes(this.el);
|
|
32
35
|
super.connectedCallback();
|
|
33
36
|
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
this.formButtonEl?.remove();
|
|
39
|
+
this.formButtonEl = null;
|
|
40
|
+
this.formEl = null;
|
|
41
|
+
super.disconnectedCallback();
|
|
42
|
+
}
|
|
34
43
|
renderHiddenButton() {
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
if (this.type !== 'submit') {
|
|
45
|
+
this.formButtonEl?.remove();
|
|
46
|
+
this.formButtonEl = null;
|
|
47
|
+
this.formEl = null;
|
|
37
48
|
return;
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
}
|
|
50
|
+
const formEl = findFormByRef(this.form, this.el);
|
|
51
|
+
if (!formEl) {
|
|
52
|
+
this.formButtonEl?.remove();
|
|
53
|
+
this.formButtonEl = null;
|
|
54
|
+
this.formEl = null;
|
|
40
55
|
return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
}
|
|
57
|
+
this.formEl = formEl;
|
|
58
|
+
const formButtonEl = this.formButtonEl ?? document.createElement('button');
|
|
59
|
+
formButtonEl.type = 'submit';
|
|
60
|
+
formButtonEl.style.display = 'none';
|
|
61
|
+
formButtonEl.disabled = this.disabled;
|
|
62
|
+
formButtonEl.name = this.name ?? '';
|
|
63
|
+
formButtonEl.value = this.value ?? '';
|
|
64
|
+
if (this.formMethod) {
|
|
65
|
+
formButtonEl.setAttribute('formmethod', this.formMethod);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
formButtonEl.removeAttribute('formmethod');
|
|
69
|
+
}
|
|
70
|
+
if (this.formButtonEl !== formButtonEl) {
|
|
71
|
+
this.formButtonEl = formButtonEl;
|
|
72
|
+
}
|
|
73
|
+
if (formButtonEl.parentElement !== formEl) {
|
|
74
|
+
formButtonEl.remove();
|
|
75
|
+
formEl.appendChild(formButtonEl);
|
|
76
|
+
}
|
|
46
77
|
}
|
|
47
78
|
submitForm(ev) {
|
|
48
79
|
if (this.formEl && this.formButtonEl) {
|
|
@@ -57,7 +88,7 @@ export class LmvzButton extends ReactiveControllerHost {
|
|
|
57
88
|
};
|
|
58
89
|
render() {
|
|
59
90
|
this.renderHiddenButton();
|
|
60
|
-
return (h(Host, { key: '
|
|
91
|
+
return (h(Host, { key: '6c44aa8a4b40927313461b5139e88066b855dca6', "aria-disabled": this.disabled ? 'true' : null }, h("button", { key: '3696f0ad46a03fe9573571b46a56772def87bf53', ref: (e) => (this.validationEl = e), disabled: this.disabled, type: this.type, class: classNames(this.variant, { [this.scale ?? '']: !!this.scale, disabled: this.disabled }), ...this.inheritedAttributes }, h("slot", { key: '3ecce9c6ae978b72b14a807d93248a4566a13f4b' }))));
|
|
61
92
|
}
|
|
62
93
|
static get is() { return "lmvz-button"; }
|
|
63
94
|
static get encapsulation() { return "shadow"; }
|
|
@@ -225,6 +256,63 @@ export class LmvzButton extends ReactiveControllerHost {
|
|
|
225
256
|
"setter": false,
|
|
226
257
|
"reflect": false,
|
|
227
258
|
"attribute": "form"
|
|
259
|
+
},
|
|
260
|
+
"formMethod": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"mutable": false,
|
|
263
|
+
"complexType": {
|
|
264
|
+
"original": "'dialog' | 'get' | 'post'",
|
|
265
|
+
"resolved": "\"dialog\" | \"get\" | \"post\" | undefined",
|
|
266
|
+
"references": {}
|
|
267
|
+
},
|
|
268
|
+
"required": false,
|
|
269
|
+
"optional": true,
|
|
270
|
+
"docs": {
|
|
271
|
+
"tags": [],
|
|
272
|
+
"text": "Native formmethod value forwarded to the hidden native submit button.\nUse `dialog` to support native dialog close/confirm flows from `lmvz-button`."
|
|
273
|
+
},
|
|
274
|
+
"getter": false,
|
|
275
|
+
"setter": false,
|
|
276
|
+
"reflect": false,
|
|
277
|
+
"attribute": "form-method"
|
|
278
|
+
},
|
|
279
|
+
"name": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"mutable": false,
|
|
282
|
+
"complexType": {
|
|
283
|
+
"original": "string",
|
|
284
|
+
"resolved": "string | undefined",
|
|
285
|
+
"references": {}
|
|
286
|
+
},
|
|
287
|
+
"required": false,
|
|
288
|
+
"optional": true,
|
|
289
|
+
"docs": {
|
|
290
|
+
"tags": [],
|
|
291
|
+
"text": "Native button name forwarded to the hidden native submit button."
|
|
292
|
+
},
|
|
293
|
+
"getter": false,
|
|
294
|
+
"setter": false,
|
|
295
|
+
"reflect": false,
|
|
296
|
+
"attribute": "name"
|
|
297
|
+
},
|
|
298
|
+
"value": {
|
|
299
|
+
"type": "string",
|
|
300
|
+
"mutable": false,
|
|
301
|
+
"complexType": {
|
|
302
|
+
"original": "string",
|
|
303
|
+
"resolved": "string | undefined",
|
|
304
|
+
"references": {}
|
|
305
|
+
},
|
|
306
|
+
"required": false,
|
|
307
|
+
"optional": true,
|
|
308
|
+
"docs": {
|
|
309
|
+
"tags": [],
|
|
310
|
+
"text": "Native button value forwarded to the hidden native submit button.\nFor `formmethod=\"dialog\"` flows this becomes the dialog `returnValue`."
|
|
311
|
+
},
|
|
312
|
+
"getter": false,
|
|
313
|
+
"setter": false,
|
|
314
|
+
"reflect": false,
|
|
315
|
+
"attribute": "value"
|
|
228
316
|
}
|
|
229
317
|
};
|
|
230
318
|
}
|
|
@@ -40,7 +40,7 @@ export class LmvzChip extends ReactiveControllerHost {
|
|
|
40
40
|
this.checkContent();
|
|
41
41
|
}
|
|
42
42
|
checkContent = debounce(() => {
|
|
43
|
-
if (!isAriaValidationEnabled)
|
|
43
|
+
if (!isAriaValidationEnabled())
|
|
44
44
|
return;
|
|
45
45
|
const elements = [...(this.beforeSlot?.assignedElements() ?? []), ...(this.defaultSlot?.assignedElements() ?? []), ...(this.afterSlot?.assignedElements() ?? [])];
|
|
46
46
|
if (!elements.length) {
|
|
@@ -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: '14ee006aff40f125aef2e9a461e68e25c6ed27d6', type: this.type, size: this.size }, h("slot", { key: '3222c7f40b833f344aa233c13e2644d6e928bf4c', name: "before-text", ref: (el) => (this.beforeSlot = el), onSlotchange: () => this.checkContent() }), h("span", { key: '4d1c9fa87ccda9387b945444e9ac6a50703a19e5', class: "content-overflow-wrapper" }, h("slot", { key: '42866115b8a6c50e86663ed8934504240ee0e6fa', ref: (el) => (this.defaultSlot = el), onSlotchange: () => this.checkContent() })), h("slot", { key: '890afa73be440ee7e7620a024744be08fee57b83', 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"; }
|