@albi_scando/as-design-system-lib 1.5.2 → 1.6.1
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/dist/as-design-system-lib.es.js +365 -197
- package/dist/as-design-system-lib.umd.js +11 -11
- package/dist/types/constants/custom-messages.const.d.ts +6 -0
- package/dist/types/main.d.ts +10 -9
- package/dist/types/web-components/buttons/base-button/component.d.ts +18 -2
- package/dist/types/web-components/buttons/base-button/main.d.ts +2 -2
- package/dist/types/web-components/buttons/confirm-button/main.d.ts +1 -1
- package/dist/types/web-components/buttons/next-button/component.d.ts +2 -0
- package/dist/types/web-components/buttons/next-button/main.d.ts +1 -1
- package/dist/types/web-components/buttons/previous-button/component.d.ts +2 -0
- package/dist/types/web-components/buttons/previous-button/main.d.ts +1 -1
- package/dist/types/web-components/buttons/undo-button/main.d.ts +2 -2
- package/dist/types/web-components/dialogs/base-dialog/main.d.ts +2 -2
- package/dist/types/web-components/dialogs/confirmation-dialog/component.d.ts +32 -3
- package/dist/types/web-components/dialogs/confirmation-dialog/custom-messages.const.d.ts +6 -0
- package/dist/types/web-components/dialogs/confirmation-dialog/main.d.ts +3 -2
- package/dist/types/web-components/dialogs/header-body-footer-dialog/main.d.ts +2 -2
- package/dist/types/web-components/menus/bar-menu/component.d.ts +8 -1
- package/dist/types/web-components/menus/bar-menu/main.d.ts +1 -1
- package/package.json +14 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const ct = "as-design-system-lib";
|
|
2
|
+
class bt {
|
|
3
3
|
/**
|
|
4
4
|
* Creates an instance of WebComponentsRegistry.
|
|
5
5
|
* Registers all custom elements provided in the map of components.
|
|
@@ -19,8 +19,8 @@ class J {
|
|
|
19
19
|
* @returns {void}
|
|
20
20
|
*/
|
|
21
21
|
registerAllComponents(t) {
|
|
22
|
-
Array.from(t.entries()).forEach(([e,
|
|
23
|
-
this.registerComponent(e,
|
|
22
|
+
Array.from(t.entries()).forEach(([e, s]) => {
|
|
23
|
+
this.registerComponent(e, s);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -36,10 +36,12 @@ class J {
|
|
|
36
36
|
customElements.get(t) === void 0 ? (customElements.define(t, e), console.log(`Registered Web Component: ${t}`)) : console.warn(`Web Component "${t}" is already registered.`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const x = {
|
|
40
|
+
CONFIRMATION_DIALOG_CONFIRM: "confirmation-dialog-confirm"
|
|
41
|
+
}, $ = "base-button", n = "", v = {
|
|
40
42
|
SHOW_MODAL: "show-modal",
|
|
41
43
|
CLOSE: "close"
|
|
42
|
-
},
|
|
44
|
+
}, H = {
|
|
43
45
|
CUSTOM_CROSSHAIR: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
44
46
|
<!-- White border (underneath) -->
|
|
45
47
|
<line x1="16" y1="2" x2="16" y2="30" stroke="white" stroke-width="5"/>
|
|
@@ -50,20 +52,20 @@ const Q = "base-button", r = "", c = {
|
|
|
50
52
|
<line x1="2" y1="16" x2="30" y2="16" stroke="black" stroke-width="2"/>
|
|
51
53
|
</svg>`
|
|
52
54
|
};
|
|
53
|
-
`${btoa(
|
|
54
|
-
const
|
|
55
|
+
`${btoa(H.CUSTOM_CROSSHAIR)}`;
|
|
56
|
+
const _ = {
|
|
55
57
|
ANY: "any",
|
|
56
58
|
NONE: "none"
|
|
57
|
-
},
|
|
59
|
+
}, w = {
|
|
58
60
|
KEY_DOWN: "keydown"
|
|
59
|
-
},
|
|
61
|
+
}, p = {
|
|
60
62
|
CLICK: "click"
|
|
61
|
-
},
|
|
63
|
+
}, P = `<button part="button">
|
|
62
64
|
<slot></slot>
|
|
63
65
|
</button>
|
|
64
|
-
`,
|
|
65
|
-
|
|
66
|
-
class
|
|
66
|
+
`, V = ":where(button,input[type=button],input[type=submit],input[type=reset]),:where(input[type=file])::file-selector-button{cursor:pointer;-webkit-user-select:none;user-select:none;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);font-family:var(--font-family-base);letter-spacing:var(--letter-spacing-normal);line-height:var(--line-height-normal);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);display:inline-flex;justify-content:center;align-items:center;text-align:center;gap:var(--gap-sm);background:var(--color-bg-secondary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-primary);border-radius:var(--border-radius-lg);transition:all var(--transition-base)}:where(button,input[type=button],input[type=submit],input[type=reset])>.material-symbols-outlined{font-size:var(--font-size-xl);font-family:Material Symbols Outlined;line-height:1}:where(button,input[type=button],input[type=submit],input[type=reset])[disabled]{opacity:.3;cursor:not-allowed}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):hover),:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):active){background:var(--color-hover-bg-secondary);border-color:var(--color-hover-border-secondary)}:where(input[type=file]){inline-size:100%;max-inline-size:max-content;background-color:var(--color-bg-secondary)}", L = new CSSStyleSheet();
|
|
67
|
+
L.replaceSync(V);
|
|
68
|
+
class i extends HTMLElement {
|
|
67
69
|
/**
|
|
68
70
|
* @see HTMLButtonElement.autofocus
|
|
69
71
|
*/
|
|
@@ -101,73 +103,73 @@ class s extends HTMLElement {
|
|
|
101
103
|
* @ignore
|
|
102
104
|
*/
|
|
103
105
|
constructor() {
|
|
104
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(
|
|
106
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(L);
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
107
109
|
* Specifies which attributes should be observed for changes.
|
|
108
110
|
*/
|
|
109
111
|
static get observedAttributes() {
|
|
110
112
|
return [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
i.autofocusAttribute,
|
|
114
|
+
i.commandAttribute,
|
|
115
|
+
i.commandforAttribute,
|
|
116
|
+
i.disabledAttribute,
|
|
117
|
+
i.nameAttribute,
|
|
118
|
+
i.titleAttribute,
|
|
119
|
+
i.typeAttribute,
|
|
120
|
+
i.valueAttribute
|
|
119
121
|
];
|
|
120
122
|
}
|
|
121
123
|
get buttonElement() {
|
|
122
124
|
return this.shadowRoot?.querySelector("button");
|
|
123
125
|
}
|
|
124
126
|
get autofocus() {
|
|
125
|
-
return this.hasAttribute(
|
|
127
|
+
return this.hasAttribute(i.autofocusAttribute);
|
|
126
128
|
}
|
|
127
129
|
set autofocus(t) {
|
|
128
|
-
t ? this.setAttribute(
|
|
130
|
+
t ? this.setAttribute(i.autofocusAttribute, n) : this.removeAttribute(i.autofocusAttribute);
|
|
129
131
|
}
|
|
130
132
|
get command() {
|
|
131
|
-
return this.getAttribute(
|
|
133
|
+
return this.getAttribute(i.commandAttribute) ?? n;
|
|
132
134
|
}
|
|
133
135
|
set command(t) {
|
|
134
|
-
this.setAttribute(
|
|
136
|
+
this.setAttribute(i.commandAttribute, t);
|
|
135
137
|
}
|
|
136
138
|
get commandfor() {
|
|
137
|
-
return this.getAttribute(
|
|
139
|
+
return this.getAttribute(i.commandforAttribute) ?? n;
|
|
138
140
|
}
|
|
139
141
|
set commandfor(t) {
|
|
140
|
-
t !==
|
|
142
|
+
t !== n ? this.setAttribute(i.commandforAttribute, t) : this.removeAttribute(i.commandforAttribute);
|
|
141
143
|
}
|
|
142
144
|
get disabled() {
|
|
143
|
-
return this.hasAttribute(
|
|
145
|
+
return this.hasAttribute(i.disabledAttribute);
|
|
144
146
|
}
|
|
145
147
|
set disabled(t) {
|
|
146
|
-
t ? this.setAttribute(
|
|
148
|
+
t ? this.setAttribute(i.disabledAttribute, n) : this.removeAttribute(i.disabledAttribute);
|
|
147
149
|
}
|
|
148
150
|
get name() {
|
|
149
|
-
return this.getAttribute(
|
|
151
|
+
return this.getAttribute(i.nameAttribute) ?? n;
|
|
150
152
|
}
|
|
151
153
|
set name(t) {
|
|
152
|
-
t !==
|
|
154
|
+
t !== n ? this.setAttribute(i.nameAttribute, t) : this.removeAttribute(i.nameAttribute);
|
|
153
155
|
}
|
|
154
156
|
get headline() {
|
|
155
|
-
return this.getAttribute(
|
|
157
|
+
return this.getAttribute(i.titleAttribute) ?? n;
|
|
156
158
|
}
|
|
157
159
|
set headline(t) {
|
|
158
|
-
t !==
|
|
160
|
+
t !== n ? this.setAttribute(i.titleAttribute, t) : this.removeAttribute(i.titleAttribute);
|
|
159
161
|
}
|
|
160
162
|
get type() {
|
|
161
|
-
return this.getAttribute(
|
|
163
|
+
return this.getAttribute(i.typeAttribute) ?? "button";
|
|
162
164
|
}
|
|
163
165
|
set type(t) {
|
|
164
|
-
t !==
|
|
166
|
+
t !== n ? this.setAttribute(i.typeAttribute, t) : this.removeAttribute(i.typeAttribute);
|
|
165
167
|
}
|
|
166
168
|
get value() {
|
|
167
|
-
return this.getAttribute(
|
|
169
|
+
return this.getAttribute(i.valueAttribute) ?? "button";
|
|
168
170
|
}
|
|
169
171
|
set value(t) {
|
|
170
|
-
t !==
|
|
172
|
+
t !== n ? this.setAttribute(i.valueAttribute, t) : this.removeAttribute(i.valueAttribute);
|
|
171
173
|
}
|
|
172
174
|
/**
|
|
173
175
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -194,15 +196,15 @@ class s extends HTMLElement {
|
|
|
194
196
|
* @param newValue - The new value (or null if removed)
|
|
195
197
|
* @returns {void}
|
|
196
198
|
*/
|
|
197
|
-
attributeChangedCallback(t, e,
|
|
198
|
-
|
|
199
|
+
attributeChangedCallback(t, e, s) {
|
|
200
|
+
s !== e && this._syncAttribute(t);
|
|
199
201
|
}
|
|
200
202
|
/**
|
|
201
203
|
* Renders the component's HTML structure.
|
|
202
204
|
* Syncs host attributes to the internal button element.
|
|
203
205
|
*/
|
|
204
206
|
_render() {
|
|
205
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
207
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = P, this._syncAttributes());
|
|
206
208
|
}
|
|
207
209
|
/**
|
|
208
210
|
* Adds event listeners to the component.
|
|
@@ -210,7 +212,7 @@ class s extends HTMLElement {
|
|
|
210
212
|
* @returns {void}
|
|
211
213
|
*/
|
|
212
214
|
_addEventListeners() {
|
|
213
|
-
this.addEventListener(
|
|
215
|
+
this.buttonElement.addEventListener(p.CLICK, this._handleClick);
|
|
214
216
|
}
|
|
215
217
|
/**
|
|
216
218
|
* Removes event listeners from the component.
|
|
@@ -218,7 +220,7 @@ class s extends HTMLElement {
|
|
|
218
220
|
* @returns {void}
|
|
219
221
|
*/
|
|
220
222
|
_removeEventListeners() {
|
|
221
|
-
this.
|
|
223
|
+
this.buttonElement.addEventListener(p.CLICK, this._handleClick);
|
|
222
224
|
}
|
|
223
225
|
/**
|
|
224
226
|
* Handles the internal button click event and executes the configured command.
|
|
@@ -228,8 +230,8 @@ class s extends HTMLElement {
|
|
|
228
230
|
*
|
|
229
231
|
* Behavior:
|
|
230
232
|
* - If either `command` or `commandfor` is missing, no action is performed.
|
|
231
|
-
* - The target element is resolved via `document.getElementById()`
|
|
232
|
-
*
|
|
233
|
+
* - The target element is resolved via `document.getElementById()` first,
|
|
234
|
+
* then searches through shadow DOM boundaries if not found.
|
|
233
235
|
* - If the target exists and supports the requested method, the command is executed.
|
|
234
236
|
*
|
|
235
237
|
* This enables declarative command wiring between components, similar in spirit
|
|
@@ -243,21 +245,80 @@ class s extends HTMLElement {
|
|
|
243
245
|
* @returns {void}
|
|
244
246
|
*/
|
|
245
247
|
_handleClick = () => {
|
|
246
|
-
if (this.command ===
|
|
248
|
+
if (this.command === n || this.commandfor === n)
|
|
247
249
|
return;
|
|
248
|
-
|
|
249
|
-
if (t === null)
|
|
250
|
+
let t = document.getElementById(this.commandfor);
|
|
251
|
+
if (t ??= this._findElementInShadowDOM(this.commandfor), t === null)
|
|
250
252
|
return;
|
|
251
253
|
const e = t;
|
|
252
254
|
switch (this.command) {
|
|
253
|
-
case
|
|
255
|
+
case v.SHOW_MODAL:
|
|
254
256
|
e.showModal?.();
|
|
255
257
|
break;
|
|
256
|
-
case
|
|
258
|
+
case v.CLOSE:
|
|
257
259
|
e.close?.();
|
|
258
260
|
break;
|
|
259
261
|
}
|
|
260
262
|
};
|
|
263
|
+
/**
|
|
264
|
+
* Find an element by ID by traversing through shadow DOM boundaries.
|
|
265
|
+
* Searches recursively through shadow roots and traverses up through hosts.
|
|
266
|
+
*
|
|
267
|
+
* @param id - The element ID to search for
|
|
268
|
+
* @returns The element if found, null otherwise
|
|
269
|
+
*/
|
|
270
|
+
_findElementInShadowDOM(t) {
|
|
271
|
+
const s = `#${CSS.escape(t)}`;
|
|
272
|
+
let r = this.querySelector(s);
|
|
273
|
+
if (r !== null || (r = this._searchInShadowRootsOfChildren(this, s), r !== null))
|
|
274
|
+
return r;
|
|
275
|
+
let a = this.parentElement;
|
|
276
|
+
for (; a !== null; ) {
|
|
277
|
+
if (r = a.querySelector(s), r !== null || (r = this._searchInShadowRootsOfChildren(a, s), r !== null))
|
|
278
|
+
return r;
|
|
279
|
+
const l = a.parentElement;
|
|
280
|
+
if (l !== null)
|
|
281
|
+
a = l;
|
|
282
|
+
else {
|
|
283
|
+
const o = a.getRootNode();
|
|
284
|
+
if (o instanceof ShadowRoot && o.host !== null)
|
|
285
|
+
a = o.host;
|
|
286
|
+
else
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Recursively search within shadow roots of all child elements
|
|
294
|
+
*
|
|
295
|
+
* @param element - The element whose children to search
|
|
296
|
+
* @param selector - The CSS selector to find
|
|
297
|
+
* @returns The element if found, null otherwise
|
|
298
|
+
*/
|
|
299
|
+
_searchInShadowRootsOfChildren(t, e) {
|
|
300
|
+
const s = t.children;
|
|
301
|
+
for (const r of s) {
|
|
302
|
+
if (r.shadowRoot !== null) {
|
|
303
|
+
const l = r.shadowRoot.querySelector(e);
|
|
304
|
+
if (l !== null)
|
|
305
|
+
return l;
|
|
306
|
+
const o = this._searchInShadowRootsOfChildren(
|
|
307
|
+
r.shadowRoot,
|
|
308
|
+
e
|
|
309
|
+
);
|
|
310
|
+
if (o !== null)
|
|
311
|
+
return o;
|
|
312
|
+
}
|
|
313
|
+
const a = this._searchInShadowRootsOfChildren(
|
|
314
|
+
r,
|
|
315
|
+
e
|
|
316
|
+
);
|
|
317
|
+
if (a !== null)
|
|
318
|
+
return a;
|
|
319
|
+
}
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
261
322
|
/**
|
|
262
323
|
* Syncs a single attribute from host to button element.
|
|
263
324
|
*
|
|
@@ -266,7 +327,7 @@ class s extends HTMLElement {
|
|
|
266
327
|
*/
|
|
267
328
|
_syncAttribute(t) {
|
|
268
329
|
const e = this.buttonElement;
|
|
269
|
-
this.hasAttribute(t) ? e.setAttribute(t, this.getAttribute(t) ??
|
|
330
|
+
this.hasAttribute(t) ? e.setAttribute(t, this.getAttribute(t) ?? n) : e.removeAttribute(t);
|
|
270
331
|
}
|
|
271
332
|
/**
|
|
272
333
|
* Syncs all observed attributes from host to button element.
|
|
@@ -275,30 +336,34 @@ class s extends HTMLElement {
|
|
|
275
336
|
* @returns {void}
|
|
276
337
|
*/
|
|
277
338
|
_syncAttributes() {
|
|
278
|
-
|
|
339
|
+
i.observedAttributes.forEach((t) => {
|
|
279
340
|
this._syncAttribute(t);
|
|
280
341
|
});
|
|
281
342
|
}
|
|
282
343
|
}
|
|
283
|
-
const
|
|
344
|
+
const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
345
|
+
__proto__: null,
|
|
346
|
+
BaseButtonComponent: i,
|
|
347
|
+
selector: $
|
|
348
|
+
}, Symbol.toStringTag, { value: "Module" })), j = `<button title="Undo" part="button">
|
|
284
349
|
<span class="material-symbols-outlined">undo</span>
|
|
285
350
|
<span>Undo</span>
|
|
286
351
|
</button>
|
|
287
|
-
`,
|
|
288
|
-
|
|
289
|
-
class
|
|
352
|
+
`, z = "button[part=button]{background:var(--color-warning);font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{filter:brightness(1.2)}", E = new CSSStyleSheet();
|
|
353
|
+
E.replaceSync(z);
|
|
354
|
+
class q extends i {
|
|
290
355
|
/**
|
|
291
356
|
* @constructor
|
|
292
357
|
* @ignore
|
|
293
358
|
*/
|
|
294
359
|
constructor() {
|
|
295
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
360
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(E), this.command = v.CLOSE, this.title = "Undo";
|
|
296
361
|
}
|
|
297
362
|
/**
|
|
298
363
|
* Specifies which attributes should be observed for changes.
|
|
299
364
|
*/
|
|
300
365
|
static get observedAttributes() {
|
|
301
|
-
return
|
|
366
|
+
return i.observedAttributes;
|
|
302
367
|
}
|
|
303
368
|
/**
|
|
304
369
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -310,7 +375,7 @@ class tt extends s {
|
|
|
310
375
|
* Renders the component's HTML structure.
|
|
311
376
|
*/
|
|
312
377
|
_render() {
|
|
313
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
378
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = j, this._syncAttributes());
|
|
314
379
|
}
|
|
315
380
|
/**
|
|
316
381
|
* It finds the closest parent dialog and
|
|
@@ -325,25 +390,29 @@ class tt extends s {
|
|
|
325
390
|
e !== null && (this.commandfor = e.id);
|
|
326
391
|
}
|
|
327
392
|
}
|
|
328
|
-
const
|
|
393
|
+
const W = "undo-button", vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
394
|
+
__proto__: null,
|
|
395
|
+
UndoButtonComponent: q,
|
|
396
|
+
selector: W
|
|
397
|
+
}, Symbol.toStringTag, { value: "Module" })), F = `<button title="Confirm" part="button">
|
|
329
398
|
<span class="material-symbols-outlined">check</span>
|
|
330
399
|
<span>Confirm</span>
|
|
331
400
|
</button>
|
|
332
|
-
`,
|
|
333
|
-
|
|
334
|
-
class
|
|
401
|
+
`, K = "button[part=button]{background:var(--color-success);font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{filter:brightness(1.2)}", k = new CSSStyleSheet();
|
|
402
|
+
k.replaceSync(K);
|
|
403
|
+
class D extends i {
|
|
335
404
|
/**
|
|
336
405
|
* @constructor
|
|
337
406
|
* @ignore
|
|
338
407
|
*/
|
|
339
408
|
constructor() {
|
|
340
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
409
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(k), this.command = v.CLOSE, this.title = "Confirm";
|
|
341
410
|
}
|
|
342
411
|
/**
|
|
343
412
|
* Specifies which attributes should be observed for changes.
|
|
344
413
|
*/
|
|
345
414
|
static get observedAttributes() {
|
|
346
|
-
return
|
|
415
|
+
return i.observedAttributes;
|
|
347
416
|
}
|
|
348
417
|
/**
|
|
349
418
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -355,7 +424,7 @@ class et extends s {
|
|
|
355
424
|
* Renders the component's HTML structure.
|
|
356
425
|
*/
|
|
357
426
|
_render() {
|
|
358
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
427
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = F, this._syncAttributes());
|
|
359
428
|
}
|
|
360
429
|
/**
|
|
361
430
|
* It finds the closest parent dialog and
|
|
@@ -370,24 +439,30 @@ class et extends s {
|
|
|
370
439
|
e !== null && (this.commandfor = e.id);
|
|
371
440
|
}
|
|
372
441
|
}
|
|
373
|
-
const
|
|
442
|
+
const A = "confirm-button", pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
443
|
+
__proto__: null,
|
|
444
|
+
ConfirmButtonComponent: D,
|
|
445
|
+
selector: A
|
|
446
|
+
}, Symbol.toStringTag, { value: "Module" })), B = `<button part="button">
|
|
374
447
|
<span class="material-symbols-outlined">chevron_left</span>
|
|
375
448
|
</button>
|
|
376
|
-
`,
|
|
377
|
-
|
|
378
|
-
class
|
|
449
|
+
`, U = "button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}", I = new CSSStyleSheet();
|
|
450
|
+
I.replaceSync(U);
|
|
451
|
+
class g extends i {
|
|
452
|
+
static _disabledAttribute = "disabled";
|
|
453
|
+
static _titleAttribute = "title";
|
|
379
454
|
/**
|
|
380
455
|
* @constructor
|
|
381
456
|
* @ignore
|
|
382
457
|
*/
|
|
383
458
|
constructor() {
|
|
384
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
459
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(I), this.command = v.CLOSE;
|
|
385
460
|
}
|
|
386
461
|
/**
|
|
387
462
|
* Specifies which attributes should be observed for changes.
|
|
388
463
|
*/
|
|
389
464
|
static get observedAttributes() {
|
|
390
|
-
return
|
|
465
|
+
return i.observedAttributes;
|
|
391
466
|
}
|
|
392
467
|
/**
|
|
393
468
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -399,14 +474,14 @@ class it extends s {
|
|
|
399
474
|
* Lifecycle hook invoked whenever an observed attribute changes.
|
|
400
475
|
* Updates the title visibility based on disabled state.
|
|
401
476
|
*/
|
|
402
|
-
attributeChangedCallback(t, e,
|
|
403
|
-
super.attributeChangedCallback(t, e,
|
|
477
|
+
attributeChangedCallback(t, e, s) {
|
|
478
|
+
super.attributeChangedCallback(t, e, s), t === g._disabledAttribute && this._updateTitle();
|
|
404
479
|
}
|
|
405
480
|
/**
|
|
406
481
|
* Renders the component's HTML structure.
|
|
407
482
|
*/
|
|
408
483
|
_render() {
|
|
409
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
484
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = B, this._syncAttributes());
|
|
410
485
|
}
|
|
411
486
|
/**
|
|
412
487
|
* Updates the title attribute based on disabled state.
|
|
@@ -416,27 +491,33 @@ class it extends s {
|
|
|
416
491
|
const t = this.shadowRoot?.querySelector(
|
|
417
492
|
"button"
|
|
418
493
|
);
|
|
419
|
-
this.disabled ? t.removeAttribute(
|
|
494
|
+
t !== null && (this.disabled ? t.removeAttribute(g._titleAttribute) : t.setAttribute(g._titleAttribute, "Previous"));
|
|
420
495
|
}
|
|
421
496
|
}
|
|
422
|
-
const
|
|
497
|
+
const Y = "previous-button", yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
498
|
+
__proto__: null,
|
|
499
|
+
PreviousButtonComponent: g,
|
|
500
|
+
selector: Y
|
|
501
|
+
}, Symbol.toStringTag, { value: "Module" })), G = `<button part="button">
|
|
423
502
|
<span class="material-symbols-outlined">chevron_right</span>
|
|
424
503
|
</button>
|
|
425
|
-
`,
|
|
426
|
-
|
|
427
|
-
class
|
|
504
|
+
`, X = "button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}", O = new CSSStyleSheet();
|
|
505
|
+
O.replaceSync(X);
|
|
506
|
+
class m extends i {
|
|
507
|
+
static _disabledAttribute = "disabled";
|
|
508
|
+
static _titleAttribute = "title";
|
|
428
509
|
/**
|
|
429
510
|
* @constructor
|
|
430
511
|
* @ignore
|
|
431
512
|
*/
|
|
432
513
|
constructor() {
|
|
433
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
514
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(O), this.command = v.CLOSE;
|
|
434
515
|
}
|
|
435
516
|
/**
|
|
436
517
|
* Specifies which attributes should be observed for changes.
|
|
437
518
|
*/
|
|
438
519
|
static get observedAttributes() {
|
|
439
|
-
return
|
|
520
|
+
return i.observedAttributes;
|
|
440
521
|
}
|
|
441
522
|
/**
|
|
442
523
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -448,14 +529,14 @@ class nt extends s {
|
|
|
448
529
|
* Lifecycle hook invoked whenever an observed attribute changes.
|
|
449
530
|
* Updates the title visibility based on disabled state.
|
|
450
531
|
*/
|
|
451
|
-
attributeChangedCallback(t, e,
|
|
452
|
-
super.attributeChangedCallback(t, e,
|
|
532
|
+
attributeChangedCallback(t, e, s) {
|
|
533
|
+
super.attributeChangedCallback(t, e, s), t === m._disabledAttribute && this._updateTitle();
|
|
453
534
|
}
|
|
454
535
|
/**
|
|
455
536
|
* Renders the component's HTML structure.
|
|
456
537
|
*/
|
|
457
538
|
_render() {
|
|
458
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
539
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = G, this._syncAttributes());
|
|
459
540
|
}
|
|
460
541
|
/**
|
|
461
542
|
* Updates the title attribute based on disabled state.
|
|
@@ -465,15 +546,19 @@ class nt extends s {
|
|
|
465
546
|
const t = this.shadowRoot?.querySelector(
|
|
466
547
|
"button"
|
|
467
548
|
);
|
|
468
|
-
this.disabled ? t.removeAttribute(
|
|
549
|
+
t !== null && (this.disabled ? t.removeAttribute(m._titleAttribute) : t.setAttribute(m._titleAttribute, "Next"));
|
|
469
550
|
}
|
|
470
551
|
}
|
|
471
|
-
const
|
|
552
|
+
const J = "next-button", gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
553
|
+
__proto__: null,
|
|
554
|
+
NextButtonComponent: m,
|
|
555
|
+
selector: J
|
|
556
|
+
}, Symbol.toStringTag, { value: "Module" })), Q = `<dialog part="dialog">
|
|
472
557
|
<slot></slot>
|
|
473
558
|
</dialog>
|
|
474
|
-
`,
|
|
475
|
-
|
|
476
|
-
class
|
|
559
|
+
`, Z = "dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);max-width:90vw;max-height:90vh;font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:var(--window-backdrop);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}", R = new CSSStyleSheet();
|
|
560
|
+
R.replaceSync(Z);
|
|
561
|
+
class b extends HTMLElement {
|
|
477
562
|
/**
|
|
478
563
|
* @see HTMLDialogElement.closedBy
|
|
479
564
|
*/
|
|
@@ -482,31 +567,31 @@ class d extends HTMLElement {
|
|
|
482
567
|
* Defines how the dialog can be closed.
|
|
483
568
|
* @see DialogClosedBy
|
|
484
569
|
*/
|
|
485
|
-
_closedBy =
|
|
570
|
+
_closedBy = _.ANY;
|
|
486
571
|
/**
|
|
487
572
|
* @constructor
|
|
488
573
|
* @ignore
|
|
489
574
|
*/
|
|
490
575
|
constructor() {
|
|
491
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(
|
|
576
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(R);
|
|
492
577
|
}
|
|
493
578
|
/**
|
|
494
579
|
* Specifies which attributes should be observed for changes.
|
|
495
580
|
*/
|
|
496
581
|
static get observedAttributes() {
|
|
497
|
-
return [
|
|
582
|
+
return [b.closedByAttribute];
|
|
498
583
|
}
|
|
499
584
|
get dialogElement() {
|
|
500
585
|
return this.shadowRoot?.querySelector("dialog");
|
|
501
586
|
}
|
|
502
587
|
get command() {
|
|
503
|
-
return this.getAttribute(
|
|
588
|
+
return this.getAttribute(b.closedByAttribute) ?? _.ANY;
|
|
504
589
|
}
|
|
505
590
|
get closedBy() {
|
|
506
591
|
return this._closedBy;
|
|
507
592
|
}
|
|
508
593
|
set closedBy(t) {
|
|
509
|
-
this._closedBy = t, this.setAttribute(
|
|
594
|
+
this._closedBy = t, this.setAttribute(b.closedByAttribute, t);
|
|
510
595
|
}
|
|
511
596
|
/**
|
|
512
597
|
* Lifecycle
|
|
@@ -534,9 +619,9 @@ class d extends HTMLElement {
|
|
|
534
619
|
* @param newValue - The new value (or null if removed)
|
|
535
620
|
* @returns {void}
|
|
536
621
|
*/
|
|
537
|
-
attributeChangedCallback(t, e,
|
|
538
|
-
const
|
|
539
|
-
|
|
622
|
+
attributeChangedCallback(t, e, s) {
|
|
623
|
+
const r = this.dialogElement;
|
|
624
|
+
r != null && s !== e && this._syncAttribute(t);
|
|
540
625
|
}
|
|
541
626
|
/**
|
|
542
627
|
* Adds event listeners to the component.
|
|
@@ -558,7 +643,7 @@ class d extends HTMLElement {
|
|
|
558
643
|
* @returns {void}
|
|
559
644
|
*/
|
|
560
645
|
_render() {
|
|
561
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
646
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = Q, this._syncAttributes());
|
|
562
647
|
}
|
|
563
648
|
/**
|
|
564
649
|
* Syncs a single attribute from host to dialog element.
|
|
@@ -568,7 +653,7 @@ class d extends HTMLElement {
|
|
|
568
653
|
*/
|
|
569
654
|
_syncAttribute(t) {
|
|
570
655
|
const e = this.dialogElement;
|
|
571
|
-
e != null && (this.hasAttribute(t) === !0 ? e.setAttribute(t, this.getAttribute(t) ??
|
|
656
|
+
e != null && (this.hasAttribute(t) === !0 ? e.setAttribute(t, this.getAttribute(t) ?? n) : e.removeAttribute(t));
|
|
572
657
|
}
|
|
573
658
|
/**
|
|
574
659
|
* Syncs all observed attributes from host to dialog element.
|
|
@@ -577,7 +662,7 @@ class d extends HTMLElement {
|
|
|
577
662
|
* @returns {void}
|
|
578
663
|
*/
|
|
579
664
|
_syncAttributes() {
|
|
580
|
-
|
|
665
|
+
b.observedAttributes.forEach((t) => {
|
|
581
666
|
this._syncAttribute(t);
|
|
582
667
|
});
|
|
583
668
|
}
|
|
@@ -603,7 +688,11 @@ class d extends HTMLElement {
|
|
|
603
688
|
}, 300);
|
|
604
689
|
}
|
|
605
690
|
}
|
|
606
|
-
const
|
|
691
|
+
const tt = "base-dialog", mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
692
|
+
__proto__: null,
|
|
693
|
+
BaseDialogComponent: b,
|
|
694
|
+
selector: tt
|
|
695
|
+
}, Symbol.toStringTag, { value: "Module" })), et = `<dialog part="dialog">
|
|
607
696
|
<header part="header">
|
|
608
697
|
<h2></h2>
|
|
609
698
|
</header>
|
|
@@ -615,7 +704,7 @@ const lt = "confirmation-dialog", Y = `<dialog part="dialog">
|
|
|
615
704
|
<undo-button></undo-button>
|
|
616
705
|
</footer>
|
|
617
706
|
</dialog>
|
|
618
|
-
`,
|
|
707
|
+
`, it = "dialog header[part=header] h2{margin:0;padding:0}dialog div[part=body] p{margin:0;padding:0}dialog footer[part=footer]{display:flex;gap:var(--gap-md);justify-content:flex-end}", st = `<dialog part="dialog">
|
|
619
708
|
<header part="header">
|
|
620
709
|
<slot name="header"></slot>
|
|
621
710
|
</header>
|
|
@@ -626,22 +715,22 @@ const lt = "confirmation-dialog", Y = `<dialog part="dialog">
|
|
|
626
715
|
<slot name="footer"></slot>
|
|
627
716
|
</footer>
|
|
628
717
|
</dialog>
|
|
629
|
-
`,
|
|
630
|
-
|
|
631
|
-
class
|
|
718
|
+
`, rt = "dialog header[part=header]{border-bottom:var(--border-width-1) solid var(--color-neutral-600);padding-bottom:var(--spacing-4)}dialog header[part=header]:empty{display:none}dialog div[part=body]{padding:var(--spacing-4) 0}dialog div[part=body]:empty{display:none}dialog footer[part=footer]{border-top:var(--border-width-1) solid var(--color-neutral-600);padding-top:var(--spacing-4)}dialog footer[part=footer]:empty{display:none}", M = new CSSStyleSheet();
|
|
719
|
+
M.replaceSync(rt);
|
|
720
|
+
class S extends b {
|
|
632
721
|
/**
|
|
633
722
|
* @constructor
|
|
634
723
|
* @ignore
|
|
635
724
|
*/
|
|
636
725
|
constructor() {
|
|
637
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
726
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(M);
|
|
638
727
|
}
|
|
639
728
|
/**
|
|
640
729
|
* Specifies which attributes should be observed for changes.
|
|
641
730
|
* Uses parent's attributes since we're extending the base dialog.
|
|
642
731
|
*/
|
|
643
732
|
static get observedAttributes() {
|
|
644
|
-
return
|
|
733
|
+
return b.observedAttributes;
|
|
645
734
|
}
|
|
646
735
|
/**
|
|
647
736
|
* Renders the component's HTML structure.
|
|
@@ -650,20 +739,24 @@ class A extends d {
|
|
|
650
739
|
* @returns {void}
|
|
651
740
|
*/
|
|
652
741
|
_render() {
|
|
653
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
742
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = st, this._syncAttributes());
|
|
654
743
|
}
|
|
655
744
|
}
|
|
656
|
-
const
|
|
657
|
-
|
|
658
|
-
class
|
|
745
|
+
const N = new CSSStyleSheet();
|
|
746
|
+
N.replaceSync(it);
|
|
747
|
+
class d extends S {
|
|
748
|
+
/**
|
|
749
|
+
* The title of the confirmation dialog.
|
|
750
|
+
*/
|
|
751
|
+
_headline = n;
|
|
659
752
|
/**
|
|
660
753
|
* The text content of the confirmation dialog.
|
|
661
754
|
*/
|
|
662
|
-
_text =
|
|
755
|
+
_text = n;
|
|
663
756
|
/**
|
|
664
|
-
* The
|
|
757
|
+
* The value associated with the confirmation action, emitted in the confirm event.
|
|
665
758
|
*/
|
|
666
|
-
|
|
759
|
+
_value;
|
|
667
760
|
/**
|
|
668
761
|
* The name of the attribute that holds the dialog's text content.
|
|
669
762
|
*/
|
|
@@ -672,11 +765,15 @@ class a extends A {
|
|
|
672
765
|
* The name of the attribute that holds the dialog's title.
|
|
673
766
|
*/
|
|
674
767
|
static headlineAttribute = "headline";
|
|
768
|
+
/**
|
|
769
|
+
* The name of the attribute that holds the dialog's value to be emitted on confirmation.
|
|
770
|
+
*/
|
|
771
|
+
static valueAttribute = "value";
|
|
675
772
|
/**
|
|
676
773
|
* @constructor
|
|
677
774
|
*/
|
|
678
775
|
constructor() {
|
|
679
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
776
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(N);
|
|
680
777
|
}
|
|
681
778
|
/**
|
|
682
779
|
* Specifies which attributes should be observed for changes.
|
|
@@ -684,22 +781,29 @@ class a extends A {
|
|
|
684
781
|
*/
|
|
685
782
|
static get observedAttributes() {
|
|
686
783
|
return [
|
|
687
|
-
...
|
|
688
|
-
|
|
689
|
-
|
|
784
|
+
...S.observedAttributes,
|
|
785
|
+
d.textAttribute,
|
|
786
|
+
d.headlineAttribute,
|
|
787
|
+
d.valueAttribute
|
|
690
788
|
];
|
|
691
789
|
}
|
|
692
790
|
get headline() {
|
|
693
791
|
return this._headline;
|
|
694
792
|
}
|
|
695
793
|
set headline(t) {
|
|
696
|
-
this._headline = t, this.setAttribute(
|
|
794
|
+
this._headline = t, this.setAttribute(d.headlineAttribute, t);
|
|
697
795
|
}
|
|
698
796
|
get text() {
|
|
699
797
|
return this._text;
|
|
700
798
|
}
|
|
701
799
|
set text(t) {
|
|
702
|
-
this._text = t, this.setAttribute(
|
|
800
|
+
this._text = t, this.setAttribute(d.textAttribute, t);
|
|
801
|
+
}
|
|
802
|
+
get value() {
|
|
803
|
+
return this._value;
|
|
804
|
+
}
|
|
805
|
+
set value(t) {
|
|
806
|
+
this._value = t;
|
|
703
807
|
}
|
|
704
808
|
/**
|
|
705
809
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -707,7 +811,7 @@ class a extends A {
|
|
|
707
811
|
* @returns {void}
|
|
708
812
|
*/
|
|
709
813
|
connectedCallback() {
|
|
710
|
-
this._render(), this._addEventListeners(), this.closedBy =
|
|
814
|
+
this._render(), this._addEventListeners(), this.closedBy = _.NONE;
|
|
711
815
|
}
|
|
712
816
|
/**
|
|
713
817
|
* Renders the component's HTML structure.
|
|
@@ -716,7 +820,7 @@ class a extends A {
|
|
|
716
820
|
* @returns {void}
|
|
717
821
|
*/
|
|
718
822
|
_render() {
|
|
719
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
823
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = et, this._syncAttributes());
|
|
720
824
|
}
|
|
721
825
|
/**
|
|
722
826
|
* Syncs a single attribute from host to the DOM elements.
|
|
@@ -725,20 +829,24 @@ class a extends A {
|
|
|
725
829
|
* @returns {void}
|
|
726
830
|
*/
|
|
727
831
|
_syncAttribute(t) {
|
|
728
|
-
if (
|
|
832
|
+
if (d.observedAttributes.includes(t))
|
|
729
833
|
switch (t) {
|
|
730
|
-
case
|
|
731
|
-
this._headline = this.getAttribute(t) ??
|
|
834
|
+
case d.headlineAttribute: {
|
|
835
|
+
this._headline = this.getAttribute(t) ?? n;
|
|
732
836
|
const e = this.shadowRoot?.querySelector("h2");
|
|
733
837
|
e != null && (e.textContent = this._headline);
|
|
734
838
|
break;
|
|
735
839
|
}
|
|
736
|
-
case
|
|
737
|
-
this._text = this.getAttribute(t) ??
|
|
840
|
+
case d.textAttribute: {
|
|
841
|
+
this._text = this.getAttribute(t) ?? n;
|
|
738
842
|
const e = this.shadowRoot?.querySelector("p");
|
|
739
843
|
e != null && (e.textContent = this._text);
|
|
740
844
|
break;
|
|
741
845
|
}
|
|
846
|
+
case d.valueAttribute: {
|
|
847
|
+
this._value = this.getAttribute(t);
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
742
850
|
default:
|
|
743
851
|
super._syncAttribute(t);
|
|
744
852
|
}
|
|
@@ -752,12 +860,62 @@ class a extends A {
|
|
|
752
860
|
* @returns {void}
|
|
753
861
|
*/
|
|
754
862
|
_syncAttributes() {
|
|
755
|
-
super._syncAttributes(),
|
|
863
|
+
super._syncAttributes(), d.observedAttributes.forEach((t) => {
|
|
756
864
|
this._syncAttribute(t);
|
|
757
865
|
});
|
|
758
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Adds event listeners.
|
|
869
|
+
*
|
|
870
|
+
* @returns {void}
|
|
871
|
+
*/
|
|
872
|
+
_addEventListeners() {
|
|
873
|
+
super._addEventListeners(), this.shadowRoot?.querySelector(
|
|
874
|
+
A
|
|
875
|
+
)?.addEventListener(p.CLICK, this._handleConfirm);
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Removes event listeners.
|
|
879
|
+
*
|
|
880
|
+
* @returns {void}
|
|
881
|
+
*/
|
|
882
|
+
_removeEventListeners() {
|
|
883
|
+
super._removeEventListeners(), this.shadowRoot?.querySelector(
|
|
884
|
+
A
|
|
885
|
+
)?.removeEventListener(p.CLICK, this._handleConfirm);
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Handles the confirm button click event.
|
|
889
|
+
* Dispatches a custom event with the confirmation value.
|
|
890
|
+
*
|
|
891
|
+
* @returns {void}
|
|
892
|
+
*/
|
|
893
|
+
_handleConfirm = () => {
|
|
894
|
+
const t = new CustomEvent(
|
|
895
|
+
x.CONFIRMATION_DIALOG_CONFIRM,
|
|
896
|
+
{
|
|
897
|
+
bubbles: !0,
|
|
898
|
+
composed: !0,
|
|
899
|
+
detail: {
|
|
900
|
+
value: this._value
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
this.dispatchEvent(t);
|
|
905
|
+
};
|
|
759
906
|
}
|
|
760
|
-
const
|
|
907
|
+
const nt = "confirmation-dialog", ot = {
|
|
908
|
+
CONFIRMATION_DIALOG_CONFIRM: x.CONFIRMATION_DIALOG_CONFIRM
|
|
909
|
+
}, ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
910
|
+
__proto__: null,
|
|
911
|
+
COMPONENT_CUSTOM_MESSAGES: ot,
|
|
912
|
+
ConfirmationDialogComponent: d,
|
|
913
|
+
selector: nt
|
|
914
|
+
}, Symbol.toStringTag, { value: "Module" })), at = "header-body-footer-dialog", _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
915
|
+
__proto__: null,
|
|
916
|
+
HeaderBodyFooterDialogComponent: S,
|
|
917
|
+
selector: at
|
|
918
|
+
}, Symbol.toStringTag, { value: "Module" })), lt = `<div class="bar-menu-container">
|
|
761
919
|
<previous-button class="nav-prev" part="nav-prev-button"></previous-button>
|
|
762
920
|
|
|
763
921
|
<div class="buttons-wrapper" part="buttons-wrapper">
|
|
@@ -766,13 +924,15 @@ const dt = "header-body-footer-dialog", j = `<div class="bar-menu-container">
|
|
|
766
924
|
|
|
767
925
|
<next-button class="nav-next" part="nav-next-button"></next-button>
|
|
768
926
|
</div>
|
|
769
|
-
`,
|
|
770
|
-
|
|
771
|
-
class
|
|
927
|
+
`, ut = ":host{display:block;width:100%}.bar-menu-container{display:flex;align-items:center;justify-content:space-between;height:100%;gap:var(--gap-sm);padding:var(--spacing-1);background:var(--color-bg-primary);border-radius:var(--border-radius-full);border:var(--border-width-2) solid var(--color-border-secondary);box-shadow:var(--shadow-sm);margin:0 auto}.bar-menu-container .nav-prev,.bar-menu-container .nav-next{flex-shrink:0;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s ease-in-out,visibility .2s ease-in-out}.bar-menu-container .nav-prev.visible,.bar-menu-container .nav-next.visible{opacity:1;visibility:visible;pointer-events:auto}.bar-menu-container .nav-prev::part(button),.bar-menu-container .nav-next::part(button){background-color:transparent;box-shadow:none}.bar-menu-container .buttons-wrapper{display:grid;grid-template-columns:repeat(var(--bar-menu-visible-count, 3),1fr);grid-auto-rows:max-content;align-items:center;justify-items:center;gap:var(--gap-sm);overflow:hidden;position:relative;width:auto}::slotted(*){display:none;flex-shrink:0;will-change:opacity,transform;contain:layout style paint;opacity:0;transform:scale(.8)}::slotted(.animating){transition:opacity .4s cubic-bezier(.34,1.56,.64,1),transform .4s cubic-bezier(.34,1.56,.64,1)}::slotted(.visible-button){display:inline-flex!important;pointer-events:auto;opacity:1;transform:scale(1)}", C = new CSSStyleSheet();
|
|
928
|
+
C.replaceSync(ut);
|
|
929
|
+
class c extends HTMLElement {
|
|
772
930
|
static _visibleCountAttribute = "visible-count";
|
|
931
|
+
static _cyclicalNavigationAttribute = "cyclical-navigation";
|
|
773
932
|
_currentIndex = 0;
|
|
774
933
|
_visibleCount = 3;
|
|
775
|
-
|
|
934
|
+
_cyclicalNavigation = !1;
|
|
935
|
+
_MIN_VISIBLE = 1;
|
|
776
936
|
_MAX_VISIBLE = 5;
|
|
777
937
|
_slotElement = null;
|
|
778
938
|
_navPrevButton = null;
|
|
@@ -784,17 +944,20 @@ class v extends HTMLElement {
|
|
|
784
944
|
* @constructor
|
|
785
945
|
*/
|
|
786
946
|
constructor() {
|
|
787
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(
|
|
947
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(C);
|
|
788
948
|
}
|
|
789
949
|
/**
|
|
790
950
|
* Specifies which attributes should be observed for changes.
|
|
791
951
|
*/
|
|
792
952
|
static get observedAttributes() {
|
|
793
|
-
return [
|
|
953
|
+
return [
|
|
954
|
+
c._visibleCountAttribute,
|
|
955
|
+
c._cyclicalNavigationAttribute
|
|
956
|
+
];
|
|
794
957
|
}
|
|
795
958
|
get visibleButtons() {
|
|
796
|
-
const t = this.getAttribute(
|
|
797
|
-
if (t !== null && t !==
|
|
959
|
+
const t = this.getAttribute(c._visibleCountAttribute);
|
|
960
|
+
if (t !== null && t !== n) {
|
|
798
961
|
const e = parseInt(t, 10);
|
|
799
962
|
return Math.max(this._MIN_VISIBLE, Math.min(this._MAX_VISIBLE, e));
|
|
800
963
|
}
|
|
@@ -805,7 +968,16 @@ class v extends HTMLElement {
|
|
|
805
968
|
this._MIN_VISIBLE,
|
|
806
969
|
Math.min(this._MAX_VISIBLE, t)
|
|
807
970
|
);
|
|
808
|
-
this.setAttribute(
|
|
971
|
+
this.setAttribute(c._visibleCountAttribute, String(e));
|
|
972
|
+
}
|
|
973
|
+
get cyclicalNavigation() {
|
|
974
|
+
return this.hasAttribute(c._cyclicalNavigationAttribute);
|
|
975
|
+
}
|
|
976
|
+
set cyclicalNavigation(t) {
|
|
977
|
+
t ? this.setAttribute(
|
|
978
|
+
c._cyclicalNavigationAttribute,
|
|
979
|
+
n
|
|
980
|
+
) : this.removeAttribute(c._cyclicalNavigationAttribute);
|
|
809
981
|
}
|
|
810
982
|
/**
|
|
811
983
|
* Lifecycle hook: component inserted into DOM
|
|
@@ -822,17 +994,17 @@ class v extends HTMLElement {
|
|
|
822
994
|
/**
|
|
823
995
|
* Lifecycle hook: observed attribute changed
|
|
824
996
|
*/
|
|
825
|
-
attributeChangedCallback(t, e,
|
|
826
|
-
t ===
|
|
997
|
+
attributeChangedCallback(t, e, s) {
|
|
998
|
+
t === c._visibleCountAttribute ? (this._visibleCount = this.visibleButtons, this._buttonsWrapper !== null && this._buttonsWrapper.style.setProperty(
|
|
827
999
|
"--bar-menu-visible-count",
|
|
828
1000
|
String(this.visibleButtons)
|
|
829
|
-
), this._updateButtonVisibility());
|
|
1001
|
+
), this._updateButtonVisibility()) : t === c._cyclicalNavigationAttribute && (this._cyclicalNavigation = this.cyclicalNavigation, this._updateButtonVisibility());
|
|
830
1002
|
}
|
|
831
1003
|
/**
|
|
832
1004
|
* Render the component's Shadow DOM structure
|
|
833
1005
|
*/
|
|
834
1006
|
_render() {
|
|
835
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
1007
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = lt);
|
|
836
1008
|
}
|
|
837
1009
|
/**
|
|
838
1010
|
* Cache Shadow DOM elements for performance
|
|
@@ -841,9 +1013,9 @@ class v extends HTMLElement {
|
|
|
841
1013
|
this._slotElement = this.shadowRoot?.querySelector("slot") ?? null, this._navPrevButton = this.shadowRoot?.querySelector(".nav-prev") ?? null, this._navNextButton = this.shadowRoot?.querySelector(".nav-next") ?? null, this._buttonsWrapper = this.shadowRoot?.querySelector(".buttons-wrapper") ?? null, this._buttonsWrapper !== null && this._buttonsWrapper.style.setProperty(
|
|
842
1014
|
"--bar-menu-visible-count",
|
|
843
1015
|
String(this.visibleButtons)
|
|
844
|
-
), this._navPrevButton !== null && (this._navPrevButton.setAttribute("aria-label", "Previous"), this._navPrevButton.addEventListener(
|
|
1016
|
+
), this._navPrevButton !== null && (this._navPrevButton.setAttribute("aria-label", "Previous"), this._navPrevButton.addEventListener(p.CLICK, () => {
|
|
845
1017
|
this._scrollPrevious();
|
|
846
|
-
})), this._navNextButton !== null && (this._navNextButton.setAttribute("aria-label", "Next"), this._navNextButton.addEventListener(
|
|
1018
|
+
})), this._navNextButton !== null && (this._navNextButton.setAttribute("aria-label", "Next"), this._navNextButton.addEventListener(p.CLICK, () => {
|
|
847
1019
|
this._scrollNext();
|
|
848
1020
|
}));
|
|
849
1021
|
}
|
|
@@ -870,13 +1042,13 @@ class v extends HTMLElement {
|
|
|
870
1042
|
_setupKeyboardListener() {
|
|
871
1043
|
this._keyDownListener = (t) => {
|
|
872
1044
|
t.key === "ArrowLeft" ? (t.preventDefault(), this._scrollPrevious()) : t.key === "ArrowRight" && (t.preventDefault(), this._scrollNext());
|
|
873
|
-
}, this.addEventListener(
|
|
1045
|
+
}, this.addEventListener(w.KEY_DOWN, this._keyDownListener);
|
|
874
1046
|
}
|
|
875
1047
|
/**
|
|
876
1048
|
* Remove keyboard listener
|
|
877
1049
|
*/
|
|
878
1050
|
_removeKeyboardListener() {
|
|
879
|
-
this._keyDownListener !== null && this.removeEventListener(
|
|
1051
|
+
this._keyDownListener !== null && this.removeEventListener(w.KEY_DOWN, this._keyDownListener);
|
|
880
1052
|
}
|
|
881
1053
|
/**
|
|
882
1054
|
* Get all slotted button elements
|
|
@@ -888,59 +1060,59 @@ class v extends HTMLElement {
|
|
|
888
1060
|
* Update button visibility by showing/hiding rows with fade
|
|
889
1061
|
*/
|
|
890
1062
|
_updateButtonVisibility(t) {
|
|
891
|
-
const e = this._getSlottedButtons(),
|
|
892
|
-
e.forEach((
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
}), t !== void 0 ? (e[0]?.offsetHeight, e.forEach((
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
|
|
1063
|
+
const e = this._getSlottedButtons(), s = e.length, r = this.visibleButtons, a = this._currentIndex, l = Math.min(a + r, s);
|
|
1064
|
+
e.forEach((o, u) => {
|
|
1065
|
+
const y = u >= a && u < l, h = o;
|
|
1066
|
+
y || (o.classList.remove("visible-button"), o.classList.remove("animating"), h.style.display = "none");
|
|
1067
|
+
}), t !== void 0 ? (e[0]?.offsetHeight, e.forEach((o, u) => {
|
|
1068
|
+
if (u >= a && u < l) {
|
|
1069
|
+
const h = o;
|
|
1070
|
+
h.style.display = "inline-flex", o.classList.add("animating");
|
|
1071
|
+
const T = u % this.visibleButtons * 50;
|
|
1072
|
+
h.style.transitionDelay = `${T}ms`;
|
|
901
1073
|
}
|
|
902
|
-
}), e[0]?.offsetHeight, e.forEach((
|
|
903
|
-
|
|
1074
|
+
}), e[0]?.offsetHeight, e.forEach((o, u) => {
|
|
1075
|
+
u >= a && u < l && o.classList.add("visible-button");
|
|
904
1076
|
}), setTimeout(() => {
|
|
905
|
-
e.forEach((
|
|
906
|
-
|
|
1077
|
+
e.forEach((o) => {
|
|
1078
|
+
o.classList.remove("animating"), o.style.transitionDelay = n;
|
|
907
1079
|
});
|
|
908
|
-
}, 400)) : e.forEach((
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
}), this._updateNavigationButtons(
|
|
1080
|
+
}, 400)) : e.forEach((o, u) => {
|
|
1081
|
+
const y = u >= a && u < l, h = o;
|
|
1082
|
+
y && (h.style.display = "inline-flex", o.classList.add("visible-button"));
|
|
1083
|
+
}), this._updateNavigationButtons(s, r);
|
|
912
1084
|
}
|
|
913
1085
|
/**
|
|
914
1086
|
* Update navigation buttons visibility and disabled state
|
|
915
1087
|
*/
|
|
916
1088
|
_updateNavigationButtons(t, e) {
|
|
917
|
-
const
|
|
918
|
-
this._navPrevButton !== null && (
|
|
1089
|
+
const s = t > e, r = this._currentIndex + e < t, a = this._currentIndex === 0, l = !r;
|
|
1090
|
+
this._navPrevButton !== null && (s ? (this._navPrevButton.classList.add("visible"), this._navPrevButton.disabled = !this._cyclicalNavigation && a) : this._navPrevButton.classList.remove("visible")), this._navNextButton !== null && (s ? (this._navNextButton.classList.add("visible"), this._navNextButton.disabled = !this._cyclicalNavigation && l) : this._navNextButton.classList.remove("visible"));
|
|
919
1091
|
}
|
|
920
1092
|
/**
|
|
921
1093
|
* Navigate to previous page (scrolls by visibleCount buttons)
|
|
1094
|
+
* In cyclical mode, wraps to the end when at the beginning.
|
|
922
1095
|
*/
|
|
923
1096
|
_scrollPrevious() {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
this._currentIndex - this.visibleButtons
|
|
927
|
-
), this._updateButtonVisibility("previous"));
|
|
1097
|
+
const t = this._getSlottedButtons().length, e = this.visibleButtons;
|
|
1098
|
+
this._currentIndex > 0 ? (this._currentIndex = Math.max(0, this._currentIndex - e), this._updateButtonVisibility("previous")) : this._cyclicalNavigation && t > e && (this._currentIndex = Math.max(0, t - e), this._updateButtonVisibility("previous"));
|
|
928
1099
|
}
|
|
929
1100
|
/**
|
|
930
1101
|
* Navigate to next page (scrolls by visibleCount buttons)
|
|
1102
|
+
* In cyclical mode, wraps to the beginning when at the end.
|
|
931
1103
|
*/
|
|
932
1104
|
_scrollNext() {
|
|
933
|
-
const t = this._getSlottedButtons().length, e = this.visibleButtons,
|
|
934
|
-
|
|
1105
|
+
const t = this._getSlottedButtons().length, e = this.visibleButtons, s = this._currentIndex + e;
|
|
1106
|
+
s < t ? (this._currentIndex = s, this._updateButtonVisibility("next")) : this._cyclicalNavigation && t > e && (this._currentIndex = 0, this._updateButtonVisibility("next"));
|
|
935
1107
|
}
|
|
936
1108
|
/**
|
|
937
1109
|
* Public API: scroll to specific button by index
|
|
938
1110
|
*/
|
|
939
1111
|
scrollToButton(t) {
|
|
940
|
-
const e = this._getSlottedButtons().length,
|
|
1112
|
+
const e = this._getSlottedButtons().length, s = this.visibleButtons;
|
|
941
1113
|
t >= 0 && t < e && (this._currentIndex = Math.max(
|
|
942
1114
|
0,
|
|
943
|
-
Math.min(t, e -
|
|
1115
|
+
Math.min(t, e - s)
|
|
944
1116
|
), this._updateButtonVisibility());
|
|
945
1117
|
}
|
|
946
1118
|
/**
|
|
@@ -964,26 +1136,22 @@ class v extends HTMLElement {
|
|
|
964
1136
|
return this._currentIndex;
|
|
965
1137
|
}
|
|
966
1138
|
}
|
|
967
|
-
const
|
|
1139
|
+
const dt = "bar-menu", At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1140
|
+
__proto__: null,
|
|
1141
|
+
BarMenuComponent: c,
|
|
1142
|
+
selector: dt
|
|
1143
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
968
1144
|
export {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
Q as baseButtonWebComponentSelector,
|
|
982
|
-
at as baseDialogWebComponentSelector,
|
|
983
|
-
st as confirmButtonWebComponentSelector,
|
|
984
|
-
lt as confirmationDialogWebComponentSelector,
|
|
985
|
-
dt as headerBodyFooterDialogWebComponentSelector,
|
|
986
|
-
ot as nextButtonWebComponentSelector,
|
|
987
|
-
rt as previousButtonWebComponentSelector,
|
|
988
|
-
Z as undoButtonWebComponentSelector
|
|
1145
|
+
ct as APPLICATION_NAME,
|
|
1146
|
+
At as BarMenu,
|
|
1147
|
+
ht as BaseButton,
|
|
1148
|
+
mt as BaseDialog,
|
|
1149
|
+
x as CUSTOM_MESSAGES,
|
|
1150
|
+
pt as ConfirmButton,
|
|
1151
|
+
ft as ConfirmationDialog,
|
|
1152
|
+
_t as HeaderBodyFooterDialog,
|
|
1153
|
+
gt as NextButton,
|
|
1154
|
+
yt as PreviousButton,
|
|
1155
|
+
vt as UndoButton,
|
|
1156
|
+
bt as WebComponentsRegistry
|
|
989
1157
|
};
|