@albi_scando/as-design-system-lib 1.0.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/README.md +2 -0
  2. package/dist/as-design-system-lib.es.js +671 -2
  3. package/dist/as-design-system-lib.umd.js +46 -1
  4. package/dist/types/constants/application.constant.d.ts +1 -1
  5. package/dist/types/main.d.ts +7 -0
  6. package/dist/types/web-components/buttons/base-button/component.d.ts +137 -0
  7. package/dist/types/web-components/buttons/base-button/main.d.ts +2 -0
  8. package/dist/types/web-components/buttons/base-button/selector.d.ts +4 -0
  9. package/dist/types/web-components/buttons/confirm-button/component.d.ts +31 -0
  10. package/dist/types/web-components/buttons/confirm-button/main.d.ts +2 -0
  11. package/dist/types/web-components/buttons/confirm-button/selector.d.ts +4 -0
  12. package/dist/types/web-components/buttons/undo-button/component.d.ts +27 -0
  13. package/dist/types/web-components/buttons/undo-button/main.d.ts +2 -0
  14. package/dist/types/web-components/buttons/undo-button/selector.d.ts +4 -0
  15. package/dist/types/web-components/dialogs/base-dialog/component.d.ts +92 -0
  16. package/dist/types/web-components/dialogs/base-dialog/main.d.ts +2 -0
  17. package/dist/types/web-components/dialogs/base-dialog/selector.d.ts +4 -0
  18. package/dist/types/web-components/dialogs/confirmation-dialog/component.d.ts +65 -0
  19. package/dist/types/web-components/dialogs/confirmation-dialog/main.d.ts +2 -0
  20. package/dist/types/web-components/dialogs/confirmation-dialog/selector.d.ts +4 -0
  21. package/dist/types/web-components/dialogs/header-body-footer-dialog/component.d.ts +25 -0
  22. package/dist/types/web-components/dialogs/header-body-footer-dialog/main.d.ts +2 -0
  23. package/dist/types/web-components/dialogs/header-body-footer-dialog/selector.d.ts +4 -0
  24. package/dist/types/web-components/registry.d.ts +41 -0
  25. package/package.json +53 -32
package/README.md CHANGED
@@ -7,6 +7,8 @@ All components are strongly typed, ensuring type-safety and better developer exp
7
7
 
8
8
  ## Table of Contents
9
9
 
10
+ - [Storybook](documentation/pages/STORYBOOK.md)
10
11
  - [License](documentation/pages/LICENSE.md)
12
+ - [Installation](documentation/pages/INSTALLATION.md)
11
13
  - [Contributing](documentation/pages/CONTRIBUTING.md)
12
14
  - [Changelog](CHANGELOG.md)
@@ -1,4 +1,673 @@
1
- const s = "as-design-system-lib";
1
+ const z = "as-design-system-lib";
2
+ class C {
3
+ /**
4
+ * Creates an instance of WebComponentsRegistry.
5
+ * Registers all custom elements provided in the map of components.
6
+ *
7
+ * @param {Map<string, CustomElementConstructor>} customElements - A map of component selectors (string keys)
8
+ * and their corresponding custom element constructors. If no map is provided, an empty map is used.
9
+ */
10
+ constructor(t = /* @__PURE__ */ new Map()) {
11
+ this.registerAllComponents(t);
12
+ }
13
+ /**
14
+ * Registers all the components provided in the map.
15
+ * It iterates over the map entries and registers each component individually.
16
+ *
17
+ * @param {Map<string, CustomElementConstructor>} customElements - A map of component selectors (string keys)
18
+ * and their corresponding custom element constructors.
19
+ * @returns {void}
20
+ */
21
+ registerAllComponents(t) {
22
+ Array.from(t.entries()).forEach(([r, a]) => {
23
+ this.registerComponent(r, a);
24
+ });
25
+ }
26
+ /**
27
+ * Registers an individual custom component with the browser.
28
+ * If the component is not already registered, it defines the component and logs a message.
29
+ * If the component is already registered, a warning is logged.
30
+ *
31
+ * @param {string} selector - The selector (tag name) of the custom component to be registered.
32
+ * @param {CustomElementConstructor} component - The constructor of the custom component to be registered.
33
+ * @returns {void}
34
+ */
35
+ registerComponent(t, r) {
36
+ customElements.get(t) === void 0 ? (customElements.define(t, r), console.log(`Registered Web Component: ${t}`)) : console.warn(`Web Component "${t}" is already registered.`);
37
+ }
38
+ }
39
+ const O = "base-button", i = "", n = {
40
+ SHOW_MODAL: "show-modal",
41
+ CLOSE: "close"
42
+ }, v = {
43
+ CUSTOM_CROSSHAIR: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
44
+ <!-- White border (underneath) -->
45
+ <line x1="16" y1="2" x2="16" y2="30" stroke="white" stroke-width="5"/>
46
+ <line x1="2" y1="16" x2="30" y2="16" stroke="white" stroke-width="5"/>
47
+
48
+ <!-- Black crosshair lines (on top) -->
49
+ <line x1="16" y1="2" x2="16" y2="30" stroke="black" stroke-width="2"/>
50
+ <line x1="2" y1="16" x2="30" y2="16" stroke="black" stroke-width="2"/>
51
+ </svg>`
52
+ };
53
+ `${btoa(v.CUSTOM_CROSSHAIR)}`;
54
+ const d = {
55
+ ANY: "any",
56
+ NONE: "none"
57
+ }, b = {
58
+ CLICK: "click"
59
+ }, A = `<button part="button">
60
+ <slot></slot>
61
+ </button>
62
+ `, w = ":where(button,input[type=button],input[type=submit],input[type=reset]),:where(input[type=file])::file-selector-button{cursor:pointer;touch-action:manipulation;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);background:var(--color-primary);color:#fff;border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-lg);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);box-shadow:var(--shadow-md);transition:all var(--transition-base);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}:where(button,input[type=button],input[type=submit],input[type=reset])>:where(svg,[data-icon]){block-size:var(--font-size-md);inline-size:var(--font-size-md);stroke:var(--icon-color, currentColor);flex-shrink:0;fill:none;stroke-linecap:round;stroke-linejoin:round;transition:transform var(--transition-fast)}: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;font-weight:400;font-style:normal;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;fill:currentColor;stroke:none}:where(button,input):where(:not(:active)):focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:active):hover){background:var(--color-primary-light);box-shadow:var(--shadow-lg);transform:translateY(-1px)}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:active){background:var(--color-primary-dark);box-shadow:var(--shadow-md);transform:translateY(0)}:where(button,input[type=button],input[type=submit],input[type=reset])[disabled]{opacity:.6;box-shadow:var(--shadow-none);opacity:.3;cursor:not-allowed;box-shadow:var(--_shadow-1)}:where([type=reset]):focus-visible{outline-color:currentColor}:where(input[type=file]){inline-size:100%;max-inline-size:max-content;background-color:var(--color-bg-secondary)}:where(input[type=button]),:where(input[type=file])::file-selector-button{appearance:none}:where(input[type=file])::file-selector-button{margin-inline-end:var(--button-padding-inline-md)}", h = new CSSStyleSheet();
63
+ h.replaceSync(w);
64
+ class e extends HTMLElement {
65
+ /**
66
+ * @see HTMLButtonElement.autofocus
67
+ */
68
+ static autofocusAttribute = "autofocus";
69
+ /**
70
+ * @see HTMLButtonElement.command
71
+ */
72
+ static commandAttribute = "command";
73
+ /**
74
+ * @see HTMLButtonElement.commandfor
75
+ */
76
+ static commandforAttribute = "commandfor";
77
+ /**
78
+ * @see HTMLButtonElement.disabled
79
+ */
80
+ static disabledAttribute = "disabled";
81
+ /**
82
+ * @see HTMLButtonElement.name
83
+ */
84
+ static nameAttribute = "name";
85
+ /**
86
+ * @see HTMLButtonElement.headline
87
+ */
88
+ static titleAttribute = "title";
89
+ /**
90
+ * @see HTMLButtonElement.type
91
+ */
92
+ static typeAttribute = "type";
93
+ /**
94
+ * @see HTMLButtonElement.value
95
+ */
96
+ static valueAttribute = "value";
97
+ /**
98
+ * @constructor
99
+ * @ignore
100
+ */
101
+ constructor() {
102
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(h);
103
+ }
104
+ /**
105
+ * Specifies which attributes should be observed for changes.
106
+ */
107
+ static get observedAttributes() {
108
+ return [
109
+ e.autofocusAttribute,
110
+ e.commandAttribute,
111
+ e.commandforAttribute,
112
+ e.disabledAttribute,
113
+ e.nameAttribute,
114
+ e.titleAttribute,
115
+ e.typeAttribute,
116
+ e.valueAttribute
117
+ ];
118
+ }
119
+ get buttonElement() {
120
+ return this.shadowRoot?.querySelector("button");
121
+ }
122
+ get autofocus() {
123
+ return this.hasAttribute(e.autofocusAttribute);
124
+ }
125
+ set autofocus(t) {
126
+ t ? this.setAttribute(e.autofocusAttribute, i) : this.removeAttribute(e.autofocusAttribute);
127
+ }
128
+ get command() {
129
+ return this.getAttribute(e.commandAttribute) ?? i;
130
+ }
131
+ set command(t) {
132
+ this.setAttribute(e.commandAttribute, t);
133
+ }
134
+ get commandfor() {
135
+ return this.getAttribute(e.commandforAttribute) ?? i;
136
+ }
137
+ set commandfor(t) {
138
+ t !== i ? this.setAttribute(e.commandforAttribute, t) : this.removeAttribute(e.commandforAttribute);
139
+ }
140
+ get disabled() {
141
+ return this.hasAttribute(e.disabledAttribute);
142
+ }
143
+ set disabled(t) {
144
+ t ? this.setAttribute(e.disabledAttribute, i) : this.removeAttribute(e.disabledAttribute);
145
+ }
146
+ get name() {
147
+ return this.getAttribute(e.nameAttribute) ?? i;
148
+ }
149
+ set name(t) {
150
+ t !== i ? this.setAttribute(e.nameAttribute, t) : this.removeAttribute(e.nameAttribute);
151
+ }
152
+ get headline() {
153
+ return this.getAttribute(e.titleAttribute) ?? i;
154
+ }
155
+ set headline(t) {
156
+ t !== i ? this.setAttribute(e.titleAttribute, t) : this.removeAttribute(e.titleAttribute);
157
+ }
158
+ get type() {
159
+ return this.getAttribute(e.typeAttribute) ?? "button";
160
+ }
161
+ set type(t) {
162
+ t !== i ? this.setAttribute(e.typeAttribute, t) : this.removeAttribute(e.typeAttribute);
163
+ }
164
+ get value() {
165
+ return this.getAttribute(e.valueAttribute) ?? "button";
166
+ }
167
+ set value(t) {
168
+ t !== i ? this.setAttribute(e.valueAttribute, t) : this.removeAttribute(e.valueAttribute);
169
+ }
170
+ /**
171
+ * Lifecycle hook invoked when the component is inserted into the DOM.
172
+ *
173
+ * @returns {void}
174
+ */
175
+ connectedCallback() {
176
+ this._render(), this._addEventListeners();
177
+ }
178
+ /**
179
+ * Lifecycle hook invoked when the component is removed from the DOM.
180
+ * Cleans up side effects created during `connectedCallback`.
181
+ *
182
+ * @returns {void}
183
+ */
184
+ disconnectedCallback() {
185
+ this._removeEventListeners();
186
+ }
187
+ /**
188
+ * Lifecycle hook invoked whenever an observed attribute changes.
189
+ *
190
+ * @param name - The name of the attribute that changed
191
+ * @param oldValue - The previous value (or null if added)
192
+ * @param newValue - The new value (or null if removed)
193
+ * @returns {void}
194
+ */
195
+ attributeChangedCallback(t, r, a) {
196
+ a !== r && this._syncAttribute(t);
197
+ }
198
+ /**
199
+ * Renders the component's HTML structure.
200
+ * Syncs host attributes to the internal button element.
201
+ */
202
+ _render() {
203
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = A, this._syncAttributes());
204
+ }
205
+ /**
206
+ * Adds event listeners to the component.
207
+ *
208
+ * @returns {void}
209
+ */
210
+ _addEventListeners() {
211
+ this.addEventListener(b.CLICK, this._handleClick);
212
+ }
213
+ /**
214
+ * Removes event listeners from the component.
215
+ *
216
+ * @returns {void}
217
+ */
218
+ _removeEventListeners() {
219
+ this.removeEventListener(b.CLICK, this._handleClick);
220
+ }
221
+ /**
222
+ * Handles the internal button click event and executes the configured command.
223
+ *
224
+ * This method reads the `command` and `commandfor` attributes defined on the
225
+ * host element and performs the corresponding action on the target element.
226
+ *
227
+ * Behavior:
228
+ * - If either `command` or `commandfor` is missing, no action is performed.
229
+ * - The target element is resolved via `document.getElementById()`
230
+ * using the `commandfor` value.
231
+ * - If the target exists and supports the requested method, the command is executed.
232
+ *
233
+ * This enables declarative command wiring between components, similar in spirit
234
+ * to native HTML behavior, while keeping components loosely coupled.
235
+ *
236
+ * @remarks
237
+ * The target element is assumed to expose compatible public methods
238
+ * (e.g., `showModal()` or `close()`). Optional chaining is used to
239
+ * safely invoke them without throwing runtime errors.
240
+ *
241
+ * @returns {void}
242
+ */
243
+ _handleClick = () => {
244
+ if (this.command === i || this.commandfor === i)
245
+ return;
246
+ const t = document.getElementById(this.commandfor);
247
+ if (t === null)
248
+ return;
249
+ const r = t;
250
+ switch (this.command) {
251
+ case n.SHOW_MODAL:
252
+ r.showModal?.();
253
+ break;
254
+ case n.CLOSE:
255
+ r.close?.();
256
+ break;
257
+ }
258
+ };
259
+ /**
260
+ * Syncs a single attribute from host to button element.
261
+ *
262
+ * @param name - The attribute name to sync
263
+ * @returns {void}
264
+ */
265
+ _syncAttribute(t) {
266
+ const r = this.buttonElement;
267
+ this.hasAttribute(t) ? r.setAttribute(t, this.getAttribute(t) ?? i) : r.removeAttribute(t);
268
+ }
269
+ /**
270
+ * Syncs all observed attributes from host to button element.
271
+ * Called during initial render.
272
+ *
273
+ * @returns {void}
274
+ */
275
+ _syncAttributes() {
276
+ e.observedAttributes.forEach((t) => {
277
+ this._syncAttribute(t);
278
+ });
279
+ }
280
+ }
281
+ const T = "undo-button", x = `<button title="Undo" part="button">
282
+ <span class="material-symbols-outlined">undo</span>
283
+ <span>Undo</span>
284
+ </button>
285
+ `, S = ":host{display:inline-block}button[part=button]{background:var(--color-warning);color:#fff;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{background:linear-gradient(135deg,var(--color-warning),var(--color-warning));opacity:.9;box-shadow:var(--shadow-lg);transform:translateY(-2px)}button[part=button]:active{transform:translateY(0);box-shadow:var(--shadow-sm)}button[part=button]:focus-visible{outline:2px solid var(--color-warning);outline-offset:2px}button[part=button]:disabled{opacity:.5;cursor:not-allowed;transform:none}", p = new CSSStyleSheet();
286
+ p.replaceSync(S);
287
+ class I extends e {
288
+ /**
289
+ * @constructor
290
+ * @ignore
291
+ */
292
+ constructor() {
293
+ super(), this.shadowRoot?.adoptedStyleSheets.push(p), this.command = n.CLOSE, this.title = "Undo";
294
+ }
295
+ /**
296
+ * Specifies which attributes should be observed for changes.
297
+ */
298
+ static get observedAttributes() {
299
+ return e.observedAttributes;
300
+ }
301
+ /**
302
+ * Lifecycle hook invoked when the component is inserted into the DOM.
303
+ */
304
+ connectedCallback() {
305
+ this._render(), this._setCommandForAttribute(), this._addEventListeners();
306
+ }
307
+ /**
308
+ * Renders the component's HTML structure.
309
+ */
310
+ _render() {
311
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = x, this._syncAttributes());
312
+ }
313
+ /**
314
+ * It finds the closest parent dialog and
315
+ * sets the commandfor attribute to its ID.
316
+ *
317
+ * @returns {void}
318
+ */
319
+ _setCommandForAttribute() {
320
+ let t = this.getRootNode();
321
+ "host" in t && t.host !== null && t.host !== void 0 && (t = t.host);
322
+ const r = t instanceof Element ? t.closest("base-dialog") ?? t.closest("confirmation-dialog") : null;
323
+ r !== null && (this.commandfor = r.id);
324
+ }
325
+ }
326
+ const k = `<button title="Confirm" part="button">
327
+ <span class="material-symbols-outlined">check</span>
328
+ <span>Confirm</span>
329
+ </button>
330
+ `, E = ":host{display:inline-block}button[part=button]{background:var(--color-success);color:#fff;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{background:linear-gradient(135deg,var(--color-success),var(--color-success));opacity:.9;box-shadow:var(--shadow-lg);transform:translateY(-2px)}button[part=button]:active{transform:translateY(0);box-shadow:var(--shadow-sm)}button[part=button]:focus-visible{outline:2px solid var(--color-success);outline-offset:2px}button[part=button]:disabled{opacity:.5;cursor:not-allowed;transform:none}", g = new CSSStyleSheet();
331
+ g.replaceSync(E);
332
+ class Y extends e {
333
+ /**
334
+ * @constructor
335
+ * @ignore
336
+ */
337
+ constructor() {
338
+ super(), this.shadowRoot?.adoptedStyleSheets.push(g), this.command = n.CLOSE, this.title = "Confirm";
339
+ }
340
+ /**
341
+ * Specifies which attributes should be observed for changes.
342
+ */
343
+ static get observedAttributes() {
344
+ return e.observedAttributes;
345
+ }
346
+ /**
347
+ * Lifecycle hook invoked when the component is inserted into the DOM.
348
+ */
349
+ connectedCallback() {
350
+ this._render(), this._setCommandForAttribute(), this._addEventListeners();
351
+ }
352
+ /**
353
+ * Renders the component's HTML structure.
354
+ */
355
+ _render() {
356
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = k, this._syncAttributes());
357
+ }
358
+ /**
359
+ * It finds the closest parent dialog and
360
+ * sets the commandfor attribute to its ID.
361
+ *
362
+ * @returns {void}
363
+ */
364
+ _setCommandForAttribute() {
365
+ let t = this.getRootNode();
366
+ "host" in t && t.host !== null && t.host !== void 0 && (t = t.host);
367
+ const r = t instanceof Element ? t.closest("base-dialog") ?? t.closest("confirmation-dialog") : null;
368
+ r !== null && (this.commandfor = r.id);
369
+ }
370
+ }
371
+ const W = "confirm-button", N = "base-dialog", L = `<dialog part="dialog">
372
+ <slot></slot>
373
+ </dialog>
374
+ `, R = "dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-2xl);padding:var(--spacing-8);max-width:90vw;max-height:90vh;font-size:var(--font-size-md);font-family:var(--font-family-base);line-height:var(--line-height-normal);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:dialogSlideIn var(--transition-base) ease-out}dialog::backdrop{background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:backdropFadeIn var(--transition-base) ease-out}@keyframes dialogSlideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}", m = new CSSStyleSheet();
375
+ m.replaceSync(R);
376
+ class s extends HTMLElement {
377
+ /**
378
+ * @see HTMLDialogElement.closedBy
379
+ */
380
+ static closedByAttribute = "closedby";
381
+ /**
382
+ * Defines how the dialog can be closed.
383
+ * @see DialogClosedBy
384
+ */
385
+ _closedBy = d.ANY;
386
+ /**
387
+ * @constructor
388
+ * @ignore
389
+ */
390
+ constructor() {
391
+ super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(m);
392
+ }
393
+ /**
394
+ * Specifies which attributes should be observed for changes.
395
+ */
396
+ static get observedAttributes() {
397
+ return [s.closedByAttribute];
398
+ }
399
+ get dialogElement() {
400
+ return this.shadowRoot?.querySelector("dialog");
401
+ }
402
+ get command() {
403
+ return this.getAttribute(s.closedByAttribute) ?? d.ANY;
404
+ }
405
+ get closedBy() {
406
+ return this._closedBy;
407
+ }
408
+ set closedBy(t) {
409
+ this._closedBy = t, this.setAttribute(s.closedByAttribute, t);
410
+ }
411
+ /**
412
+ * Lifecycle
413
+ * hook invoked when the component is inserted into the DOM.
414
+ *
415
+ * @returns {void}
416
+ */
417
+ connectedCallback() {
418
+ this._render(), this._addEventListeners();
419
+ }
420
+ /**
421
+ * Lifecycle hook invoked when the component is removed from the DOM.
422
+ * Cleans up side effects created during `connectedCallback`.
423
+ *
424
+ * @returns {void}
425
+ */
426
+ disconnectedCallback() {
427
+ this._removeEventListeners();
428
+ }
429
+ /**
430
+ * Lifecycle hook invoked whenever an observed attribute changes.
431
+ *
432
+ * @param name - The name of the attribute that changed
433
+ * @param oldValue - The previous value (or null if added)
434
+ * @param newValue - The new value (or null if removed)
435
+ * @returns {void}
436
+ */
437
+ attributeChangedCallback(t, r, a) {
438
+ const c = this.dialogElement;
439
+ c != null && a !== r && this._syncAttribute(t);
440
+ }
441
+ /**
442
+ * Adds event listeners to the component.
443
+ *
444
+ * @returns {void}
445
+ */
446
+ _addEventListeners() {
447
+ }
448
+ /**
449
+ * Removes event listeners from the component.
450
+ *
451
+ * @returns {void}
452
+ */
453
+ _removeEventListeners() {
454
+ }
455
+ /**
456
+ * Renders the component's HTML structure.
457
+ *
458
+ * @returns {void}
459
+ */
460
+ _render() {
461
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = L, this._syncAttributes());
462
+ }
463
+ /**
464
+ * Syncs a single attribute from host to dialog element.
465
+ *
466
+ * @param name - The attribute name to sync
467
+ * @returns {void}
468
+ */
469
+ _syncAttribute(t) {
470
+ const r = this.dialogElement;
471
+ r != null && (this.hasAttribute(t) === !0 ? r.setAttribute(t, this.getAttribute(t) ?? i) : r.removeAttribute(t));
472
+ }
473
+ /**
474
+ * Syncs all observed attributes from host to dialog element.
475
+ * Called during initial render.
476
+ *
477
+ * @returns {void}
478
+ */
479
+ _syncAttributes() {
480
+ s.observedAttributes.forEach((t) => {
481
+ this._syncAttribute(t);
482
+ });
483
+ }
484
+ /**
485
+ * @see HTMLDialogElement.show
486
+ */
487
+ show() {
488
+ this.dialogElement.show();
489
+ }
490
+ /**
491
+ * @see HTMLDialogElement.showModal
492
+ */
493
+ showModal() {
494
+ this.dialogElement.showModal();
495
+ }
496
+ /**
497
+ * @see HTMLDialogElement.close
498
+ */
499
+ close(t) {
500
+ this.dialogElement.close(t);
501
+ }
502
+ }
503
+ const F = "confirmation-dialog", M = `<dialog part="dialog">
504
+ <header part="header">
505
+ <h2></h2>
506
+ </header>
507
+ <div part="body">
508
+ <p></p>
509
+ </div>
510
+ <footer part="footer">
511
+ <confirm-button></confirm-button>
512
+ <undo-button></undo-button>
513
+ </footer>
514
+ </dialog>
515
+ `, _ = "section.header{display:flex;flex-direction:column;gap:var(--gap-md);padding-bottom:var(--spacing-4);border-bottom:var(--border-width-1) solid var(--color-border-tertiary)}section.footer{display:flex;gap:var(--gap-md);justify-content:flex-end;padding-top:var(--spacing-6);border-top:var(--border-width-1) solid var(--color-border-tertiary)}h2{margin:0;font-size:var(--font-size-2xl);font-weight:var(--font-weight-bold);color:var(--color-text-primary);letter-spacing:var(--letter-spacing-normal);line-height:var(--line-height-tight)}p{margin:0;font-size:var(--font-size-md);color:var(--color-text-secondary);line-height:var(--line-height-relaxed);letter-spacing:var(--letter-spacing-normal)}", $ = `<dialog part="dialog">
516
+ <header part="header">
517
+ <slot name="header"></slot>
518
+ </header>
519
+ <div part="body">
520
+ <slot name="body"></slot>
521
+ </div>
522
+ <footer part="footer">
523
+ <slot name="footer"></slot>
524
+ </footer>
525
+ </dialog>
526
+ `, H = "dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-2xl);padding:0;max-width:90vw;max-height:90vh;font-size:var(--font-size-md);font-family:var(--font-family-base);line-height:var(--line-height-normal);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:dialogSlideIn var(--transition-base) ease-out}dialog[part=dialog] header[part=header],dialog[part=dialog] div[part=body],dialog[part=dialog] footer[part=footer]{padding:var(--spacing-8)}dialog[part=dialog] header[part=header]{border-bottom:var(--border-width-1) solid var(--color-border-tertiary);padding-bottom:var(--spacing-6)}dialog[part=dialog] footer[part=footer]{border-top:var(--border-width-1) solid var(--color-border-tertiary);padding-top:var(--spacing-6);display:flex;gap:var(--gap-lg);justify-content:flex-end}dialog::backdrop{background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:backdropFadeIn var(--transition-base) ease-out}@keyframes dialogSlideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}", f = new CSSStyleSheet();
527
+ f.replaceSync(H);
528
+ class u extends s {
529
+ /**
530
+ * @constructor
531
+ * @ignore
532
+ */
533
+ constructor() {
534
+ super(), this.shadowRoot?.adoptedStyleSheets.push(f);
535
+ }
536
+ /**
537
+ * Specifies which attributes should be observed for changes.
538
+ * Uses parent's attributes since we're extending the base dialog.
539
+ */
540
+ static get observedAttributes() {
541
+ return s.observedAttributes;
542
+ }
543
+ /**
544
+ * Renders the component's HTML structure.
545
+ * Overrides parent to provide the 3-section layout inside the dialog.
546
+ *
547
+ * @returns {void}
548
+ */
549
+ _render() {
550
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = $, this._syncAttributes());
551
+ }
552
+ }
553
+ const y = new CSSStyleSheet();
554
+ y.replaceSync(_);
555
+ class o extends u {
556
+ /**
557
+ * The text content of the confirmation dialog.
558
+ */
559
+ _text = i;
560
+ /**
561
+ * The title of the confirmation dialog.
562
+ */
563
+ _headline = i;
564
+ /**
565
+ * The name of the attribute that holds the dialog's text content.
566
+ */
567
+ static textAttribute = "text";
568
+ /**
569
+ * The name of the attribute that holds the dialog's title.
570
+ */
571
+ static headlineAttribute = "headline";
572
+ /**
573
+ * @constructor
574
+ */
575
+ constructor() {
576
+ super(), this.shadowRoot?.adoptedStyleSheets.push(y);
577
+ }
578
+ /**
579
+ * Specifies which attributes should be observed for changes.
580
+ * Adds text and title to parent's observed attributes.
581
+ */
582
+ static get observedAttributes() {
583
+ return [
584
+ ...u.observedAttributes,
585
+ o.textAttribute,
586
+ o.headlineAttribute
587
+ ];
588
+ }
589
+ get headline() {
590
+ return this._headline;
591
+ }
592
+ set headline(t) {
593
+ this._headline = t, this.setAttribute(o.headlineAttribute, t);
594
+ }
595
+ get text() {
596
+ return this._text;
597
+ }
598
+ set text(t) {
599
+ this._text = t, this.setAttribute(o.textAttribute, t);
600
+ }
601
+ /**
602
+ * Lifecycle hook invoked when the component is inserted into the DOM.
603
+ *
604
+ * @returns {void}
605
+ */
606
+ connectedCallback() {
607
+ this._render(), this._addEventListeners(), this.closedBy = d.NONE;
608
+ }
609
+ /**
610
+ * Renders the component's HTML structure.
611
+ * Overrides parent to provide the confirmation dialog specific layout.
612
+ *
613
+ * @returns {void}
614
+ */
615
+ _render() {
616
+ this.shadowRoot !== null && (this.shadowRoot.innerHTML = M, this._syncAttributes());
617
+ }
618
+ /**
619
+ * Syncs a single attribute from host to the DOM elements.
620
+ *
621
+ * @param name - The attribute name to sync
622
+ * @returns {void}
623
+ */
624
+ _syncAttribute(t) {
625
+ if (o.observedAttributes.includes(t))
626
+ switch (t) {
627
+ case o.headlineAttribute: {
628
+ this._headline = this.getAttribute(t) ?? i;
629
+ const r = this.shadowRoot?.querySelector("h2");
630
+ r != null && (r.textContent = this._headline);
631
+ break;
632
+ }
633
+ case o.textAttribute: {
634
+ this._text = this.getAttribute(t) ?? i;
635
+ const r = this.shadowRoot?.querySelector("p");
636
+ r != null && (r.textContent = this._text);
637
+ break;
638
+ }
639
+ default:
640
+ super._syncAttribute(t);
641
+ }
642
+ else
643
+ super._syncAttribute(t);
644
+ }
645
+ /**
646
+ * Syncs all observed attributes from host to DOM elements.
647
+ * Called during initial render.
648
+ *
649
+ * @returns {void}
650
+ */
651
+ _syncAttributes() {
652
+ super._syncAttributes(), o.observedAttributes.forEach((t) => {
653
+ this._syncAttribute(t);
654
+ });
655
+ }
656
+ }
657
+ const U = "header-body-footer-dialog";
2
658
  export {
3
- s as APPLICATION_NAME
659
+ z as APPLICATION_NAME,
660
+ e as BaseButtonComponent,
661
+ s as BaseDialogComponent,
662
+ Y as ConfirmButtonComponent,
663
+ o as ConfirmationDialogComponent,
664
+ u as HeaderBodyFooterDialogComponent,
665
+ I as UndoButtonComponent,
666
+ C as WebComponentsRegistry,
667
+ O as baseButtonWebComponentSelector,
668
+ N as baseDialogWebComponentSelector,
669
+ W as confirmButtonWebComponentSelector,
670
+ F as confirmationDialogWebComponentSelector,
671
+ U as headerBodyFooterDialogWebComponentSelector,
672
+ T as undoButtonWebComponentSelector
4
673
  };