@avento-space/ts-ui 1.2.1 → 1.2.3

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.
@@ -1,4 +1,4 @@
1
- import { UElement, buttonStyles, inputStyles, boxStyles, listStyles, textStyles, stackStyles, gridStyles, overlayStyles, fieldStyles, checkboxStyles, selectStyles, linkStyles, containerStyles, dialogStyles, tooltipStyles, textareaStyles, radioStyles, switchStyles, labelStyles, treeStyles, tableStyles, breadcrumbStyles, tabsStyles, visuallyHiddenStyles, presenceStyles, animateKeyframes, modalStyles, drawerStyles, popoverStyles, dropdownStyles, accordionStyles, comboboxStyles, calendarStyles, dataTableStyles, commandPaletteStyles, toastStyles, contextMenuStyles, sortableStyles, formStyles } from './chunk-PRZASPFU.js';
1
+ import { UElement, buttonStyles, inputStyles, boxStyles, listStyles, textStyles, stackStyles, gridStyles, overlayStyles, fieldStyles, checkboxStyles, selectStyles, linkStyles, containerStyles, dialogStyles, tooltipStyles, textareaStyles, radioStyles, switchStyles, labelStyles, treeStyles, tableStyles, breadcrumbStyles, tabsStyles, visuallyHiddenStyles, presenceStyles, animateKeyframes, modalStyles, drawerStyles, popoverStyles, dropdownStyles, accordionStyles, comboboxStyles, calendarStyles, dataTableStyles, commandPaletteStyles, toastStyles, contextMenuStyles, sortableStyles, formStyles, badgeStyles, cardStyles } from './chunk-2UKGVIH2.js';
2
2
  import { signal, effect } from './chunk-Q5RCPPCF.js';
3
3
 
4
4
  // src/components/button.wc.ts
@@ -12,7 +12,7 @@ var UButton = class extends UElement {
12
12
  this._root.innerHTML = `<style>${buttonStyles}</style><button part="button"><slot></slot></button>`;
13
13
  }
14
14
  static get observedAttributes() {
15
- return ["variant", "size", "disabled", "type"];
15
+ return ["variant", "size", "disabled", "type", "class"];
16
16
  }
17
17
  get variant() {
18
18
  return this._variant;
@@ -73,7 +73,7 @@ var UButton = class extends UElement {
73
73
  }
74
74
  _sync() {
75
75
  const btn = this._root.querySelector("button");
76
- btn.className = `btn btn-${this._variant} btn-${this._size}`;
76
+ btn.className = `btn btn-${this._variant} btn-${this._size} ${this.className}`.trim();
77
77
  btn.disabled = this._disabled;
78
78
  btn.type = this._buttonType;
79
79
  }
@@ -101,7 +101,7 @@ var UInput = class extends UElement {
101
101
  this._root.innerHTML = `<style>${inputStyles}</style><div class="input-wrapper"><input part="input" /></div>`;
102
102
  }
103
103
  static get observedAttributes() {
104
- return ["placeholder", "disabled", "readonly", "type", "name"];
104
+ return ["placeholder", "disabled", "readonly", "type", "name", "class"];
105
105
  }
106
106
  get value() {
107
107
  return this._root.querySelector("input")?.value ?? "";
@@ -175,6 +175,7 @@ var UInput = class extends UElement {
175
175
  _sync() {
176
176
  const input = this._root.querySelector("input");
177
177
  if (!input) return;
178
+ input.className = this.className;
178
179
  input.placeholder = this._placeholder;
179
180
  input.disabled = this._disabled;
180
181
  input.readOnly = this._readonly;
@@ -237,7 +238,7 @@ var UBox = class extends UElement {
237
238
  this._root.innerHTML = `<style>${boxStyles}</style><div part="box"><slot></slot></div>`;
238
239
  }
239
240
  static get observedAttributes() {
240
- return ["as"];
241
+ return ["as", "class"];
241
242
  }
242
243
  get as() {
243
244
  return this._as;
@@ -268,6 +269,7 @@ var UBox = class extends UElement {
268
269
  }
269
270
  const wrapper = document.createElement(this._as);
270
271
  wrapper.setAttribute("part", "box");
272
+ wrapper.className = `box ${this.className}`.trim();
271
273
  const newSlot = document.createElement("slot");
272
274
  wrapper.appendChild(newSlot);
273
275
  this._root.innerHTML = `<style>${boxStyles}</style>`;
@@ -277,6 +279,8 @@ var UBox = class extends UElement {
277
279
  const inner = this._root.querySelector('[part="box"]');
278
280
  if (!inner || inner.tagName.toLowerCase() !== this._as) {
279
281
  this._rebuild();
282
+ } else {
283
+ inner.className = `box ${this.className}`.trim();
280
284
  }
281
285
  }
282
286
  _mount() {
@@ -292,6 +296,9 @@ var UList = class extends UElement {
292
296
  this._emptyText = "";
293
297
  this._root.innerHTML = `<style>${listStyles}</style><ul part="list"><slot></slot></ul>`;
294
298
  }
299
+ static get observedAttributes() {
300
+ return ["class"];
301
+ }
295
302
  get items() {
296
303
  return this._items;
297
304
  }
@@ -333,6 +340,18 @@ var UList = class extends UElement {
333
340
  ul.appendChild(li);
334
341
  }
335
342
  }
343
+ connectedCallback() {
344
+ super.connectedCallback();
345
+ this._sync();
346
+ }
347
+ attributeChangedCallback(name, oldVal, newVal) {
348
+ if (oldVal === newVal) return;
349
+ if (name === "class") this._sync();
350
+ }
351
+ _sync() {
352
+ const ul = this._root.querySelector("ul");
353
+ ul.className = this.className;
354
+ }
336
355
  _mount() {
337
356
  }
338
357
  };
@@ -351,7 +370,7 @@ var UVirtualList = class extends UElement {
351
370
  </style><div class="viewport" part="viewport"></div>`;
352
371
  }
353
372
  static get observedAttributes() {
354
- return ["item-height", "container-height", "overscan"];
373
+ return ["item-height", "container-height", "overscan", "class"];
355
374
  }
356
375
  get items() {
357
376
  return this._items;
@@ -411,6 +430,7 @@ var UVirtualList = class extends UElement {
411
430
  const visibleCount = Math.ceil(this._containerHeight / this._itemHeight) + this._overscan * 2;
412
431
  const startIndex = Math.max(0, Math.floor(scrollTop / this._itemHeight) - this._overscan);
413
432
  const endIndex = Math.min(this._items.length, startIndex + visibleCount);
433
+ viewport.className = `viewport ${this.className}`.trim();
414
434
  viewport.style.height = `${totalHeight}px`;
415
435
  viewport.innerHTML = "";
416
436
  for (let i = startIndex; i < endIndex; i++) {
@@ -515,7 +535,7 @@ var UText = class extends UElement {
515
535
  this._root.innerHTML = `<style>${textStyles}</style><span part="text"><slot></slot></span>`;
516
536
  }
517
537
  static get observedAttributes() {
518
- return ["size", "weight", "color", "as", "align", "truncate"];
538
+ return ["size", "weight", "color", "as", "align", "truncate", "class"];
519
539
  }
520
540
  get size() {
521
541
  return this._size;
@@ -591,7 +611,7 @@ var UText = class extends UElement {
591
611
  _sync() {
592
612
  const el = this._root.querySelector('[part="text"]');
593
613
  if (!el) return;
594
- el.className = `text text-${this._size} text-${this._weight} text-${this._color} text-${this._align}`;
614
+ el.className = `text text-${this._size} text-${this._weight} text-${this._color} text-${this._align} ${this.className}`.trim();
595
615
  if (this._truncate) el.classList.add("text-truncate");
596
616
  }
597
617
  _mount() {
@@ -606,10 +626,11 @@ var UStack = class extends UElement {
606
626
  this._align = "stretch";
607
627
  this._justify = "start";
608
628
  this._wrap = false;
629
+ this._direction = "v";
609
630
  this._root.innerHTML = `<style>${stackStyles}</style><div part="stack" class="stack stack-v"><slot></slot></div>`;
610
631
  }
611
632
  static get observedAttributes() {
612
- return ["gap", "align", "justify", "wrap"];
633
+ return ["gap", "align", "justify", "wrap", "class"];
613
634
  }
614
635
  get gap() {
615
636
  return this._gap;
@@ -653,6 +674,7 @@ var UStack = class extends UElement {
653
674
  }
654
675
  _sync() {
655
676
  const el = this._root.querySelector('[part="stack"]');
677
+ el.className = `stack stack-${this._direction} ${this.className}`.trim();
656
678
  el.style.gap = `${this._gap}px`;
657
679
  el.style.alignItems = this._align === "stretch" ? "stretch" : `flex-${this._align === "start" ? "start" : this._align === "end" ? "end" : this._align}`;
658
680
  el.style.justifyContent = this._justify === "start" ? "flex-start" : this._justify === "end" ? "flex-end" : this._justify === "between" ? "space-between" : this._justify === "around" ? "space-around" : "flex-start";
@@ -665,9 +687,7 @@ var UStack = class extends UElement {
665
687
  var UHStack = class extends UStack {
666
688
  constructor() {
667
689
  super();
668
- const el = this._root.querySelector('[part="stack"]');
669
- el.classList.remove("stack-v");
670
- el.classList.add("stack-h");
690
+ this._direction = "h";
671
691
  }
672
692
  };
673
693
 
@@ -681,7 +701,7 @@ var UGrid = class extends UElement {
681
701
  this._root.innerHTML = `<style>${gridStyles}</style><div part="grid" class="grid"><slot></slot></div>`;
682
702
  }
683
703
  static get observedAttributes() {
684
- return ["columns", "gap", "align"];
704
+ return ["columns", "gap", "align", "class"];
685
705
  }
686
706
  get columns() {
687
707
  return this._columns;
@@ -716,6 +736,7 @@ var UGrid = class extends UElement {
716
736
  }
717
737
  _sync() {
718
738
  const el = this._root.querySelector('[part="grid"]');
739
+ el.className = `grid ${this.className}`.trim();
719
740
  el.style.gridTemplateColumns = `repeat(${this._columns}, 1fr)`;
720
741
  el.style.gap = `${this._gap}px`;
721
742
  el.style.alignItems = this._align === "stretch" ? "stretch" : `flex-${this._align}`;
@@ -750,7 +771,7 @@ var UPressable = class extends UElement {
750
771
  this._root.addEventListener("keyup", (e) => this._onKeyUp(e));
751
772
  }
752
773
  static get observedAttributes() {
753
- return ["disabled"];
774
+ return ["disabled", "class"];
754
775
  }
755
776
  get disabled() {
756
777
  return this._disabled;
@@ -773,9 +794,13 @@ var UPressable = class extends UElement {
773
794
  if (name === "disabled") {
774
795
  this._disabled = newVal !== null;
775
796
  this._sync();
797
+ } else if (name === "class") {
798
+ this._sync();
776
799
  }
777
800
  }
778
801
  _sync() {
802
+ const pressableEl = this._root.querySelector('[part="pressable"]');
803
+ pressableEl.className = `pressable ${this.className}`.trim();
779
804
  if (this._disabled) {
780
805
  this.setAttribute("aria-disabled", "true");
781
806
  } else {
@@ -968,7 +993,7 @@ var UOverlay = class extends UElement {
968
993
  this._root.innerHTML = `<style>${overlayStyles}</style><div part="overlay" class="overlay" hidden><slot></slot></div>`;
969
994
  }
970
995
  static get observedAttributes() {
971
- return ["visible", "opacity", "blur"];
996
+ return ["visible", "opacity", "blur", "class"];
972
997
  }
973
998
  get visible() {
974
999
  return this._visible;
@@ -1005,6 +1030,7 @@ var UOverlay = class extends UElement {
1005
1030
  }
1006
1031
  _sync() {
1007
1032
  const el = this._root.querySelector('[part="overlay"]');
1033
+ el.className = `overlay ${this.className}`.trim();
1008
1034
  if (this._visible) {
1009
1035
  el.removeAttribute("hidden");
1010
1036
  el.style.opacity = String(this._opacity);
@@ -1044,7 +1070,7 @@ var UField = class extends UElement {
1044
1070
  this._root.innerHTML = `<style>${fieldStyles}</style><div part="field" class="field"><label part="label" class="field-label"></label><div part="content" class="field-content"><slot></slot></div><div part="hint" class="field-hint"></div><div part="error" class="field-error" role="alert"></div></div>`;
1045
1071
  }
1046
1072
  static get observedAttributes() {
1047
- return ["label", "error", "hint", "required"];
1073
+ return ["label", "error", "hint", "required", "class"];
1048
1074
  }
1049
1075
  get label() {
1050
1076
  return this._label;
@@ -1095,6 +1121,8 @@ var UField = class extends UElement {
1095
1121
  this._sync();
1096
1122
  }
1097
1123
  _sync() {
1124
+ const fieldEl = this._root.querySelector('[part="field"]');
1125
+ fieldEl.className = `field ${this.className}`.trim();
1098
1126
  const labelEl = this._root.querySelector('[part="label"]');
1099
1127
  labelEl.textContent = this._label;
1100
1128
  if (this._required) labelEl.classList.add("field-label-required");
@@ -1120,7 +1148,7 @@ var UCheckbox = class extends UElement {
1120
1148
  this._root.innerHTML = `<style>${checkboxStyles}</style><label part="checkbox" class="checkbox"><input type="checkbox" part="input" /><span part="indicator" class="checkbox-indicator"><svg viewBox="0 0 12 12" width="12" height="12"><path d="M2.5 6L5 8.5L9.5 3.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span><span part="label-text" class="checkbox-label"><slot></slot></span></label>`;
1121
1149
  }
1122
1150
  static get observedAttributes() {
1123
- return ["checked", "disabled", "value"];
1151
+ return ["checked", "disabled", "value", "class"];
1124
1152
  }
1125
1153
  get checked() {
1126
1154
  return this._checked;
@@ -1171,6 +1199,8 @@ var UCheckbox = class extends UElement {
1171
1199
  const indicator = this._root.querySelector('[part="indicator"]');
1172
1200
  if (this._checked) indicator.classList.add("checked");
1173
1201
  else indicator.classList.remove("checked");
1202
+ const checkbox = this._root.querySelector('[part="checkbox"]');
1203
+ checkbox.className = `checkbox ${this.className}`.trim();
1174
1204
  }
1175
1205
  _mount() {
1176
1206
  const input = this._root.querySelector("input");
@@ -1201,7 +1231,7 @@ var USelect = class extends UElement {
1201
1231
  this._root.innerHTML = `<style>${selectStyles}</style><div part="select" class="select-wrapper"><select part="native-select" class="select"></select><span part="arrow" class="select-arrow"><svg viewBox="0 0 16 16" width="16" height="16"><path d="M4 6L8 10L12 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span></div>`;
1202
1232
  }
1203
1233
  static get observedAttributes() {
1204
- return ["placeholder", "disabled", "value"];
1234
+ return ["placeholder", "disabled", "value", "class"];
1205
1235
  }
1206
1236
  get value() {
1207
1237
  return this._value;
@@ -1274,6 +1304,8 @@ var USelect = class extends UElement {
1274
1304
  const select = this._root.querySelector("select");
1275
1305
  select.disabled = this._disabled;
1276
1306
  if (this._value) select.value = this._value;
1307
+ const selectEl = this._root.querySelector('[part="select"]');
1308
+ selectEl.className = `select-wrapper ${this.className}`.trim();
1277
1309
  }
1278
1310
  _mount() {
1279
1311
  const select = this._root.querySelector("select");
@@ -1306,7 +1338,7 @@ var ULink = class extends UElement {
1306
1338
  this._root.innerHTML = `<style>${linkStyles}</style><a part="link" class="link"><slot></slot></a>`;
1307
1339
  }
1308
1340
  static get observedAttributes() {
1309
- return ["href", "target", "rel", "disabled", "variant", "underline", "external", "download"];
1341
+ return ["href", "target", "rel", "disabled", "variant", "underline", "external", "download", "class"];
1310
1342
  }
1311
1343
  get href() {
1312
1344
  return this._href;
@@ -1395,7 +1427,7 @@ var ULink = class extends UElement {
1395
1427
  anchor.rel = this._rel || (anchor.target === "_blank" ? "noopener noreferrer" : "");
1396
1428
  if (this._download) anchor.setAttribute("download", this._download);
1397
1429
  else anchor.removeAttribute("download");
1398
- anchor.className = `link link-${this._variant} link-underline-${this._underline}`;
1430
+ anchor.className = `link link-${this._variant} link-underline-${this._underline} ${this.className}`.trim();
1399
1431
  if (this._disabled) {
1400
1432
  anchor.classList.add("link-disabled");
1401
1433
  anchor.setAttribute("aria-disabled", "true");
@@ -1424,7 +1456,7 @@ var USpacer = class extends UElement {
1424
1456
  this._root.innerHTML = `<div part="spacer" style="flex:1"></div>`;
1425
1457
  }
1426
1458
  static get observedAttributes() {
1427
- return ["size"];
1459
+ return ["size", "class"];
1428
1460
  }
1429
1461
  get size() {
1430
1462
  return this._size;
@@ -1440,11 +1472,12 @@ var USpacer = class extends UElement {
1440
1472
  if (oldVal === newVal) return;
1441
1473
  if (name === "size") {
1442
1474
  this._size = Number(newVal) || 0;
1443
- this._sync();
1444
1475
  }
1476
+ this._sync();
1445
1477
  }
1446
1478
  _sync() {
1447
1479
  const el = this._root.querySelector('[part="spacer"]');
1480
+ el.className = `spacer ${this.className}`.trim();
1448
1481
  if (this._size > 0) {
1449
1482
  el.style.flex = "none";
1450
1483
  el.style.width = `${this._size}px`;
@@ -1468,7 +1501,7 @@ var UContainer = class extends UElement {
1468
1501
  this._root.innerHTML = `<style>${containerStyles}</style><div part="container" class="container"><slot></slot></div>`;
1469
1502
  }
1470
1503
  static get observedAttributes() {
1471
- return ["max-width", "padding"];
1504
+ return ["max-width", "padding", "class"];
1472
1505
  }
1473
1506
  get maxWidth() {
1474
1507
  return this._maxWidth;
@@ -1488,6 +1521,7 @@ var UContainer = class extends UElement {
1488
1521
  }
1489
1522
  _sync() {
1490
1523
  const el = this._root.querySelector('[part="container"]');
1524
+ el.className = `container ${this.className}`.trim();
1491
1525
  el.style.maxWidth = this._maxWidth;
1492
1526
  el.style.padding = this._padding;
1493
1527
  }
@@ -1811,6 +1845,13 @@ var UPopper = class extends UElement {
1811
1845
  }
1812
1846
  };
1813
1847
 
1848
+ // src/core/utils.ts
1849
+ function parseBooleanAttribute(value, fallback = false) {
1850
+ if (value == null) return fallback;
1851
+ const normalized = value.trim().toLowerCase();
1852
+ return normalized === "" || normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on";
1853
+ }
1854
+
1814
1855
  // src/components/dialog-root.wc.ts
1815
1856
  var UDialogRoot = class extends UElement {
1816
1857
  constructor() {
@@ -1820,6 +1861,7 @@ var UDialogRoot = class extends UElement {
1820
1861
  this._overlay = null;
1821
1862
  this._dismissable = null;
1822
1863
  this._focusTrap = null;
1864
+ this._synced = false;
1823
1865
  this._root.innerHTML = `<style>${dialogStyles}</style><div part="dialog-root"><slot></slot></div>`;
1824
1866
  }
1825
1867
  static get observedAttributes() {
@@ -1857,15 +1899,18 @@ var UDialogRoot = class extends UElement {
1857
1899
  attributeChangedCallback(name, oldVal, newVal) {
1858
1900
  if (oldVal === newVal) return;
1859
1901
  if (name === "open") {
1860
- this._open = newVal !== null;
1902
+ this._open = parseBooleanAttribute(newVal, false);
1861
1903
  this._updateOpenState();
1862
1904
  }
1863
- if (name === "modal") this._modal = newVal !== null;
1905
+ if (name === "modal") this._modal = parseBooleanAttribute(newVal, true);
1864
1906
  }
1865
1907
  _sync() {
1866
1908
  this.setAttribute("role", "dialog");
1867
1909
  this.setAttribute("aria-modal", String(this._modal));
1868
- this._updateOpenState();
1910
+ if (!this._synced) {
1911
+ this._synced = true;
1912
+ this._updateOpenState();
1913
+ }
1869
1914
  }
1870
1915
  _updateOpenState() {
1871
1916
  if (this._open) {
@@ -1894,6 +1939,8 @@ var UDialogRoot = class extends UElement {
1894
1939
  _removeOverlay() {
1895
1940
  if (this._overlay) {
1896
1941
  this._overlay.hide();
1942
+ this._overlay.remove();
1943
+ this._overlay = null;
1897
1944
  }
1898
1945
  }
1899
1946
  _injectDismissable() {
@@ -1901,8 +1948,10 @@ var UDialogRoot = class extends UElement {
1901
1948
  this._dismissable = new UDismissableLayer();
1902
1949
  this._dismissable.style.display = "contents";
1903
1950
  this._root.appendChild(this._dismissable);
1904
- this._dismissable.addEventListener("u-dismiss", () => {
1905
- if (this._modal) return;
1951
+ this._dismissable.addEventListener("u-dismiss", (e) => {
1952
+ const reason = e.detail?.reason;
1953
+ const isOutsideClick = reason === "pointer-down-outside" || reason === "outside-click";
1954
+ if (this._modal && isOutsideClick) return;
1906
1955
  this.closeDialog();
1907
1956
  });
1908
1957
  }
@@ -1947,7 +1996,7 @@ var UTooltipRoot = class extends UElement {
1947
1996
  this._root.innerHTML = `<style>${tooltipStyles}</style><div part="trigger" class="tooltip-trigger" style="display:inline-flex"><slot></slot></div><div part="tooltip" class="tooltip" role="tooltip" hidden><div part="tooltip-content" class="tooltip-content"></div><div part="arrow" class="tooltip-arrow"></div></div>`;
1948
1997
  }
1949
1998
  static get observedAttributes() {
1950
- return ["content", "placement", "delay", "disabled"];
1999
+ return ["content", "placement", "delay", "disabled", "class"];
1951
2000
  }
1952
2001
  get content() {
1953
2002
  return this._content;
@@ -1990,6 +2039,8 @@ var UTooltipRoot = class extends UElement {
1990
2039
  this._sync();
1991
2040
  }
1992
2041
  _sync() {
2042
+ const triggerEl = this._root.querySelector('[part="trigger"]');
2043
+ triggerEl.className = `tooltip-trigger ${this.className}`.trim();
1993
2044
  const contentEl = this._root.querySelector('[part="tooltip-content"]');
1994
2045
  contentEl.textContent = this._content;
1995
2046
  }
@@ -2049,7 +2100,7 @@ var UTextarea = class extends UElement {
2049
2100
  this._root.innerHTML = `<style>${textareaStyles}</style><div class="textarea-wrapper"><textarea part="textarea"></textarea></div>`;
2050
2101
  }
2051
2102
  static get observedAttributes() {
2052
- return ["placeholder", "disabled", "readonly", "rows", "max-length", "name"];
2103
+ return ["placeholder", "disabled", "readonly", "rows", "max-length", "name", "class"];
2053
2104
  }
2054
2105
  get value() {
2055
2106
  return this._root.querySelector("textarea")?.value ?? "";
@@ -2115,6 +2166,8 @@ var UTextarea = class extends UElement {
2115
2166
  ta.rows = this._rows;
2116
2167
  if (this._maxLength > 0) ta.maxLength = this._maxLength;
2117
2168
  ta.name = this._name;
2169
+ const wrapper = this._root.querySelector(".textarea-wrapper");
2170
+ wrapper.className = `textarea-wrapper ${this.className}`.trim();
2118
2171
  }
2119
2172
  _mount() {
2120
2173
  const ta = this._root.querySelector("textarea");
@@ -2150,7 +2203,7 @@ var URadioGroup = class extends UElement {
2150
2203
  this._root.innerHTML = `<style>${radioStyles}</style><div part="group" class="radio-group" role="radiogroup"><slot></slot></div>`;
2151
2204
  }
2152
2205
  static get observedAttributes() {
2153
- return ["value", "name", "disabled", "orientation"];
2206
+ return ["value", "name", "disabled", "orientation", "class"];
2154
2207
  }
2155
2208
  get value() {
2156
2209
  return this._value;
@@ -2196,6 +2249,7 @@ var URadioGroup = class extends UElement {
2196
2249
  }
2197
2250
  _sync() {
2198
2251
  const group = this._root.querySelector('[part="group"]');
2252
+ group.className = `radio-group ${this.className}`.trim();
2199
2253
  group.style.flexDirection = this._orientation === "horizontal" ? "row" : "column";
2200
2254
  group.style.gap = this._orientation === "horizontal" ? "16px" : "8px";
2201
2255
  if (this._name) group.setAttribute("aria-labelledby", this._name);
@@ -2235,7 +2289,7 @@ var URadio = class extends UElement {
2235
2289
  this._root.innerHTML = `<style>${radioStyles}</style><label part="radio" class="radio"><input type="radio" part="input" /><span part="circle" class="radio-circle"></span><span part="label" class="radio-label"><slot></slot></span></label>`;
2236
2290
  }
2237
2291
  static get observedAttributes() {
2238
- return ["value", "disabled", "checked"];
2292
+ return ["value", "disabled", "checked", "class"];
2239
2293
  }
2240
2294
  get value() {
2241
2295
  return this._value;
@@ -2286,6 +2340,8 @@ var URadio = class extends UElement {
2286
2340
  const circle = this._root.querySelector('[part="circle"]');
2287
2341
  if (this._checked) circle.classList.add("checked");
2288
2342
  else circle.classList.remove("checked");
2343
+ const radio = this._root.querySelector('[part="radio"]');
2344
+ radio.className = `radio ${this.className}`.trim();
2289
2345
  }
2290
2346
  _mount() {
2291
2347
  const input = this._root.querySelector("input");
@@ -2314,7 +2370,7 @@ var USwitch = class extends UElement {
2314
2370
  this._root.innerHTML = `<style>${switchStyles}</style><label part="switch" class="switch"><input type="checkbox" part="input" role="switch" /><span part="track" class="switch-track"><span part="thumb" class="switch-thumb"></span></span></label>`;
2315
2371
  }
2316
2372
  static get observedAttributes() {
2317
- return ["checked", "disabled"];
2373
+ return ["checked", "disabled", "class"];
2318
2374
  }
2319
2375
  get checked() {
2320
2376
  return this._checked;
@@ -2355,6 +2411,8 @@ var USwitch = class extends UElement {
2355
2411
  const track = this._root.querySelector('[part="track"]');
2356
2412
  if (this._checked) track.classList.add("checked");
2357
2413
  else track.classList.remove("checked");
2414
+ const switchEl = this._root.querySelector('[part="switch"]');
2415
+ switchEl.className = `switch ${this.className}`.trim();
2358
2416
  }
2359
2417
  _mount() {
2360
2418
  const input = this._root.querySelector("input");
@@ -2381,7 +2439,7 @@ var ULabel = class extends UElement {
2381
2439
  this._root.innerHTML = `<style>${labelStyles}</style><label part="label" class="label"><slot></slot></label>`;
2382
2440
  }
2383
2441
  static get observedAttributes() {
2384
- return ["for", "required"];
2442
+ return ["for", "required", "class"];
2385
2443
  }
2386
2444
  get htmlFor() {
2387
2445
  return this._for;
@@ -2409,10 +2467,9 @@ var ULabel = class extends UElement {
2409
2467
  }
2410
2468
  _sync() {
2411
2469
  const label = this._root.querySelector("label");
2470
+ label.className = `label ${this._required ? "label-required" : ""} ${this.className}`.trim();
2412
2471
  if (this._for) label.setAttribute("for", this._for);
2413
2472
  else label.removeAttribute("for");
2414
- if (this._required) label.classList.add("label-required");
2415
- else label.classList.remove("label-required");
2416
2473
  }
2417
2474
  _mount() {
2418
2475
  }
@@ -2428,7 +2485,7 @@ var UCollection = class extends UElement {
2428
2485
  this._root.innerHTML = `<div part="collection" class="collection" role="listbox"><slot></slot></div>`;
2429
2486
  }
2430
2487
  static get observedAttributes() {
2431
- return ["selection"];
2488
+ return ["selection", "class"];
2432
2489
  }
2433
2490
  get items() {
2434
2491
  return this._items;
@@ -2474,12 +2531,18 @@ var UCollection = class extends UElement {
2474
2531
  }
2475
2532
  connectedCallback() {
2476
2533
  super.connectedCallback();
2534
+ this._sync();
2477
2535
  }
2478
2536
  attributeChangedCallback(name, oldVal, newVal) {
2479
2537
  if (oldVal === newVal) return;
2480
2538
  if (name === "selection") {
2481
2539
  this._selection = newVal ?? "none";
2482
2540
  }
2541
+ this._sync();
2542
+ }
2543
+ _sync() {
2544
+ const el = this._root.querySelector('[part="collection"]');
2545
+ el.className = `collection ${this.className}`.trim();
2483
2546
  }
2484
2547
  _updateItems() {
2485
2548
  const slot = this._root.querySelector("slot");
@@ -2524,7 +2587,15 @@ var UTree = class extends UElement {
2524
2587
  this._root.addEventListener("click", (e) => this._onClick(e));
2525
2588
  }
2526
2589
  static get observedAttributes() {
2527
- return [];
2590
+ return ["class"];
2591
+ }
2592
+ connectedCallback() {
2593
+ super.connectedCallback();
2594
+ this._sync();
2595
+ }
2596
+ attributeChangedCallback(name, oldVal, newVal) {
2597
+ if (oldVal === newVal) return;
2598
+ if (name === "class") this._sync();
2528
2599
  }
2529
2600
  get items() {
2530
2601
  return this._items;
@@ -2533,6 +2604,10 @@ var UTree = class extends UElement {
2533
2604
  this._items = val;
2534
2605
  this._render();
2535
2606
  }
2607
+ _sync() {
2608
+ const el = this._root.querySelector('[part="tree"]');
2609
+ el.className = `tree ${this.className}`.trim();
2610
+ }
2536
2611
  _render() {
2537
2612
  const container = this._root.querySelector('[part="tree"]');
2538
2613
  container.innerHTML = "";
@@ -2610,7 +2685,7 @@ var UTable = class extends UElement {
2610
2685
  this._root.innerHTML = `<style>${tableStyles}</style><div part="table-wrapper" class="table-wrapper"><table part="table" class="table"><thead part="thead"><tr part="header-row"></tr></thead><tbody part="tbody"></tbody></table></div>`;
2611
2686
  }
2612
2687
  static get observedAttributes() {
2613
- return ["sortable"];
2688
+ return ["sortable", "class"];
2614
2689
  }
2615
2690
  get columns() {
2616
2691
  return this._columns;
@@ -2628,10 +2703,16 @@ var UTable = class extends UElement {
2628
2703
  }
2629
2704
  connectedCallback() {
2630
2705
  super.connectedCallback();
2706
+ this._sync();
2631
2707
  }
2632
2708
  attributeChangedCallback(name, oldVal, newVal) {
2633
2709
  if (oldVal === newVal) return;
2634
2710
  if (name === "sortable") this._sortable = newVal !== null;
2711
+ else if (name === "class") this._sync();
2712
+ }
2713
+ _sync() {
2714
+ const el = this._root.querySelector('[part="table-wrapper"]');
2715
+ el.className = `table-wrapper ${this.className}`.trim();
2635
2716
  }
2636
2717
  _render() {
2637
2718
  this._renderHeader();
@@ -2731,7 +2812,7 @@ var UBreadcrumb = class extends UElement {
2731
2812
  this._root.innerHTML = `<style>${breadcrumbStyles}</style><nav part="breadcrumb" class="breadcrumb" aria-label="Breadcrumb"><ol part="list"></ol></nav>`;
2732
2813
  }
2733
2814
  static get observedAttributes() {
2734
- return ["separator"];
2815
+ return ["separator", "class"];
2735
2816
  }
2736
2817
  get items() {
2737
2818
  return this._items;
@@ -2748,14 +2829,21 @@ var UBreadcrumb = class extends UElement {
2748
2829
  }
2749
2830
  connectedCallback() {
2750
2831
  super.connectedCallback();
2832
+ this._sync();
2751
2833
  }
2752
2834
  attributeChangedCallback(name, oldVal, newVal) {
2753
2835
  if (oldVal === newVal) return;
2754
2836
  if (name === "separator") {
2755
2837
  this._separator = newVal ?? "/";
2756
2838
  this._render();
2839
+ } else if (name === "class") {
2840
+ this._sync();
2757
2841
  }
2758
2842
  }
2843
+ _sync() {
2844
+ const el = this._root.querySelector('[part="breadcrumb"]');
2845
+ el.className = `breadcrumb ${this.className}`.trim();
2846
+ }
2759
2847
  _render() {
2760
2848
  const list = this._root.querySelector("ol");
2761
2849
  list.innerHTML = "";
@@ -2794,10 +2882,16 @@ var UTabs = class extends UElement {
2794
2882
  super();
2795
2883
  this._value = "";
2796
2884
  this._orientation = "horizontal";
2797
- this._root.innerHTML = `<style>${tabsStyles}</style><div part="tabs" class="tabs"><div part="tablist" class="tablist" role="tablist"></div><div part="tabpanels" class="tabpanels"></div></div>`;
2885
+ this._variant = "underline";
2886
+ this._fullWidth = false;
2887
+ this._triggers = [];
2888
+ this._root.innerHTML = `<style>${tabsStyles}</style><div part="tabs" class="tabs"><div part="tablist" class="tablist tablist-underline" role="tablist"><div class="tab-indicator"></div></div><div part="tabpanels" class="tabpanels"></div></div>`;
2889
+ this._tablistEl = this._root.querySelector('[part="tablist"]');
2890
+ this._panelsContainer = this._root.querySelector('[part="tabpanels"]');
2891
+ this._indicatorEl = this._tablistEl.querySelector(".tab-indicator");
2798
2892
  }
2799
2893
  static get observedAttributes() {
2800
- return ["value", "orientation"];
2894
+ return ["value", "orientation", "variant", "full-width", "class"];
2801
2895
  }
2802
2896
  get value() {
2803
2897
  return this._value;
@@ -2805,35 +2899,89 @@ var UTabs = class extends UElement {
2805
2899
  set value(val) {
2806
2900
  this.setAttribute("value", val);
2807
2901
  }
2902
+ get variant() {
2903
+ return this._variant;
2904
+ }
2905
+ set variant(val) {
2906
+ this.setAttribute("variant", val);
2907
+ }
2908
+ get fullWidth() {
2909
+ return this._fullWidth;
2910
+ }
2911
+ set fullWidth(val) {
2912
+ if (val) this.setAttribute("full-width", "");
2913
+ else this.removeAttribute("full-width");
2914
+ }
2808
2915
  connectedCallback() {
2809
2916
  super.connectedCallback();
2810
2917
  this._sync();
2811
2918
  }
2812
2919
  attributeChangedCallback(name, oldVal, newVal) {
2813
2920
  if (oldVal === newVal) return;
2814
- if (name === "value") this._value = newVal ?? "";
2815
- else if (name === "orientation") this._orientation = newVal ?? "horizontal";
2921
+ switch (name) {
2922
+ case "value":
2923
+ this._value = newVal ?? "";
2924
+ break;
2925
+ case "orientation":
2926
+ this._orientation = newVal ?? "horizontal";
2927
+ break;
2928
+ case "variant":
2929
+ this._variant = newVal ?? "underline";
2930
+ break;
2931
+ case "full-width":
2932
+ this._fullWidth = newVal !== null;
2933
+ break;
2934
+ }
2816
2935
  this._sync();
2817
2936
  }
2818
2937
  _sync() {
2819
- const tablist = this._root.querySelector('[part="tablist"]');
2820
- tablist.setAttribute("aria-orientation", this._orientation);
2938
+ this._tablistEl.setAttribute("aria-orientation", this._orientation);
2939
+ this._tablistEl.className = `tablist tablist-${this._variant}`;
2940
+ if (this._fullWidth) this._tablistEl.classList.add("tablist-full");
2821
2941
  const tabs = this.querySelectorAll('[slot="tab"]');
2822
2942
  const panels = this.querySelectorAll('[slot="panel"]');
2823
- tablist.innerHTML = "";
2943
+ if (!this._value && tabs.length > 0) {
2944
+ this._value = tabs[0].getAttribute("data-value") || "0";
2945
+ }
2946
+ this._triggers = [];
2947
+ let triggerHtml = "";
2948
+ if (this._indicatorEl) {
2949
+ triggerHtml = '<div class="tab-indicator"></div>';
2950
+ }
2951
+ this._tablistEl.innerHTML = triggerHtml;
2952
+ this._indicatorEl = this._tablistEl.querySelector(".tab-indicator");
2824
2953
  tabs.forEach((tab, i) => {
2825
2954
  const key = tab.getAttribute("data-value") || String(i);
2955
+ const disabled = tab.hasAttribute("disabled");
2826
2956
  const btn = document.createElement("button");
2827
2957
  btn.className = "tab-trigger";
2828
2958
  btn.setAttribute("role", "tab");
2829
2959
  btn.setAttribute("aria-selected", String(key === this._value));
2830
2960
  btn.setAttribute("data-value", key);
2831
- btn.textContent = tab.textContent;
2961
+ btn.disabled = disabled;
2832
2962
  if (key === this._value) btn.classList.add("active");
2833
- tablist.appendChild(btn);
2963
+ const iconSlot = tab.querySelector('[slot="icon"]');
2964
+ if (iconSlot) {
2965
+ const iconSpan = document.createElement("span");
2966
+ iconSpan.className = "tab-trigger-icon";
2967
+ iconSpan.appendChild(iconSlot.cloneNode(true));
2968
+ btn.appendChild(iconSpan);
2969
+ } else {
2970
+ const svgs = tab.querySelectorAll("svg");
2971
+ if (svgs.length > 0) {
2972
+ const iconSpan = document.createElement("span");
2973
+ iconSpan.className = "tab-trigger-icon";
2974
+ iconSpan.appendChild(svgs[0].cloneNode(true));
2975
+ btn.appendChild(iconSpan);
2976
+ }
2977
+ }
2978
+ const labelSpan = document.createElement("span");
2979
+ labelSpan.textContent = tab.textContent;
2980
+ btn.appendChild(labelSpan);
2981
+ this._tablistEl.appendChild(btn);
2982
+ this._triggers.push(btn);
2834
2983
  });
2835
- const panelsContainer = this._root.querySelector('[part="tabpanels"]');
2836
- panelsContainer.innerHTML = "";
2984
+ this._panelsContainer.innerHTML = "";
2837
2985
  panels.forEach((panel, i) => {
2838
2986
  const key = panel.getAttribute("data-value") || String(i);
2839
2987
  const div = document.createElement("div");
@@ -2845,14 +2993,27 @@ var UTabs = class extends UElement {
2845
2993
  div.setAttribute("hidden", "");
2846
2994
  }
2847
2995
  div.appendChild(panel.cloneNode(true));
2848
- panelsContainer.appendChild(div);
2996
+ this._panelsContainer.appendChild(div);
2849
2997
  });
2998
+ this._updateIndicator();
2999
+ const tabsEl = this._root.querySelector('[part="tabs"]');
3000
+ tabsEl.className = `tabs ${this.className}`.trim();
3001
+ }
3002
+ _updateIndicator() {
3003
+ if (this._variant !== "underline" || !this._indicatorEl) return;
3004
+ const active = this._tablistEl.querySelector(".tab-trigger.active");
3005
+ if (active) {
3006
+ this._indicatorEl.style.left = `${active.offsetLeft}px`;
3007
+ this._indicatorEl.style.width = `${active.offsetWidth}px`;
3008
+ } else {
3009
+ this._indicatorEl.style.left = "0";
3010
+ this._indicatorEl.style.width = "0";
3011
+ }
2850
3012
  }
2851
3013
  _mount() {
2852
- const tablist = this._root.querySelector('[part="tablist"]');
2853
- tablist.addEventListener("click", (e) => {
3014
+ this._tablistEl.addEventListener("click", (e) => {
2854
3015
  const btn = e.target.closest(".tab-trigger");
2855
- if (!btn) return;
3016
+ if (!btn || btn.disabled) return;
2856
3017
  const val = btn.getAttribute("data-value") || "";
2857
3018
  this._value = val;
2858
3019
  this.setAttribute("value", val);
@@ -2865,21 +3026,36 @@ var UTabs = class extends UElement {
2865
3026
  })
2866
3027
  );
2867
3028
  });
2868
- tablist.addEventListener("keydown", (e) => {
3029
+ this._tablistEl.addEventListener("keydown", (e) => {
2869
3030
  const ke = e;
2870
- const triggers = Array.from(tablist.querySelectorAll(".tab-trigger"));
2871
- const current = tablist.querySelector(".tab-trigger.active");
2872
- const idx = triggers.indexOf(current);
3031
+ const enabled = this._triggers.filter((t) => !t.disabled);
3032
+ if (enabled.length === 0) return;
3033
+ const current = this._tablistEl.querySelector(".tab-trigger.active");
3034
+ const idx = enabled.indexOf(current);
2873
3035
  let nextIdx = -1;
2874
- if (ke.key === "ArrowRight" || ke.key === "ArrowDown") {
2875
- nextIdx = (idx + 1) % triggers.length;
2876
- } else if (ke.key === "ArrowLeft" || ke.key === "ArrowUp") {
2877
- nextIdx = (idx - 1 + triggers.length) % triggers.length;
3036
+ switch (ke.key) {
3037
+ case "ArrowRight":
3038
+ case "ArrowDown":
3039
+ ke.preventDefault();
3040
+ nextIdx = (idx + 1) % enabled.length;
3041
+ break;
3042
+ case "ArrowLeft":
3043
+ case "ArrowUp":
3044
+ ke.preventDefault();
3045
+ nextIdx = (idx - 1 + enabled.length) % enabled.length;
3046
+ break;
3047
+ case "Home":
3048
+ ke.preventDefault();
3049
+ nextIdx = 0;
3050
+ break;
3051
+ case "End":
3052
+ ke.preventDefault();
3053
+ nextIdx = enabled.length - 1;
3054
+ break;
2878
3055
  }
2879
3056
  if (nextIdx >= 0) {
2880
- e.preventDefault();
2881
- triggers[nextIdx].click();
2882
- triggers[nextIdx].focus();
3057
+ enabled[nextIdx].click();
3058
+ enabled[nextIdx].focus();
2883
3059
  }
2884
3060
  });
2885
3061
  }
@@ -2887,10 +3063,25 @@ var UTabs = class extends UElement {
2887
3063
 
2888
3064
  // src/components/visually-hidden.wc.ts
2889
3065
  var UVisuallyHidden = class extends UElement {
3066
+ static get observedAttributes() {
3067
+ return ["class"];
3068
+ }
2890
3069
  constructor() {
2891
3070
  super();
2892
3071
  this._root.innerHTML = `<style>${visuallyHiddenStyles}</style><span part="hidden" class="visually-hidden"><slot></slot></span>`;
2893
3072
  }
3073
+ connectedCallback() {
3074
+ super.connectedCallback();
3075
+ this._sync();
3076
+ }
3077
+ attributeChangedCallback(name, oldVal, newVal) {
3078
+ if (oldVal === newVal) return;
3079
+ if (name === "class") this._sync();
3080
+ }
3081
+ _sync() {
3082
+ const el = this._root.querySelector('[part="hidden"]');
3083
+ el.className = `visually-hidden ${this.className}`.trim();
3084
+ }
2894
3085
  _mount() {
2895
3086
  }
2896
3087
  };
@@ -2904,7 +3095,7 @@ var ULiveRegion = class extends UElement {
2904
3095
  this._root.innerHTML = `<div part="region" aria-live="polite" aria-atomic="false"><slot></slot></div>`;
2905
3096
  }
2906
3097
  static get observedAttributes() {
2907
- return ["politeness", "atomic"];
3098
+ return ["politeness", "atomic", "class"];
2908
3099
  }
2909
3100
  get politeness() {
2910
3101
  return this._politeness;
@@ -2927,10 +3118,12 @@ var ULiveRegion = class extends UElement {
2927
3118
  if (oldVal === newVal) return;
2928
3119
  if (name === "politeness") this._politeness = newVal ?? "polite";
2929
3120
  else if (name === "atomic") this._atomic = newVal !== null;
3121
+ else ;
2930
3122
  this._sync();
2931
3123
  }
2932
3124
  _sync() {
2933
3125
  const el = this._root.querySelector('[part="region"]');
3126
+ el.className = this.className;
2934
3127
  el.setAttribute("aria-live", this._politeness);
2935
3128
  el.setAttribute("aria-atomic", String(this._atomic));
2936
3129
  }
@@ -3077,7 +3270,7 @@ var UPresence = class extends UElement {
3077
3270
  this._root.innerHTML = `<style>${presenceStyles}</style><div part="presence" class="presence"><slot></slot></div>`;
3078
3271
  }
3079
3272
  static get observedAttributes() {
3080
- return ["present", "animation", "duration"];
3273
+ return ["present", "animation", "duration", "class"];
3081
3274
  }
3082
3275
  get present() {
3083
3276
  return this._present;
@@ -3095,6 +3288,7 @@ var UPresence = class extends UElement {
3095
3288
  }
3096
3289
  connectedCallback() {
3097
3290
  super.connectedCallback();
3291
+ this._sync();
3098
3292
  this._present = this.hasAttribute("present");
3099
3293
  this._mounted = true;
3100
3294
  if (this._present) {
@@ -3119,8 +3313,15 @@ var UPresence = class extends UElement {
3119
3313
  case "duration":
3120
3314
  this._duration = Number(newVal) || 200;
3121
3315
  break;
3316
+ case "class":
3317
+ this._sync();
3318
+ break;
3122
3319
  }
3123
3320
  }
3321
+ _sync() {
3322
+ const presenceEl = this._root.querySelector('[part="presence"]');
3323
+ presenceEl.className = `presence ${this.className}`.trim();
3324
+ }
3124
3325
  _enter() {
3125
3326
  const el = this._root.querySelector('[part="presence"]');
3126
3327
  this.style.display = "";
@@ -3376,10 +3577,12 @@ function unlockScroll() {
3376
3577
  }
3377
3578
 
3378
3579
  // src/components/modal.wc.ts
3580
+ var CLOSE_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>';
3379
3581
  var UModal = class extends UElement {
3380
3582
  constructor() {
3381
3583
  super();
3382
3584
  this._open = false;
3585
+ this._title = "";
3383
3586
  this._size = "md";
3384
3587
  this._closeOnEscape = true;
3385
3588
  this._closeOnOverlay = true;
@@ -3390,8 +3593,8 @@ var UModal = class extends UElement {
3390
3593
  <div part="modal" class="modal" role="dialog" aria-modal="true" hidden>
3391
3594
  <div part="modal-wrapper" class="modal-wrapper modal-md">
3392
3595
  <div part="header" class="modal-header">
3393
- <slot name="header"><span class="modal-title-default"></span></slot>
3394
- <button part="close-btn" class="modal-close" aria-label="Close">&times;</button>
3596
+ <div part="title" class="modal-title"><slot name="header">${this._title}</slot></div>
3597
+ <button part="close-btn" class="modal-close" aria-label="Close">${CLOSE_SVG}</button>
3395
3598
  </div>
3396
3599
  <div part="content" class="modal-content">
3397
3600
  <slot></slot>
@@ -3403,7 +3606,7 @@ var UModal = class extends UElement {
3403
3606
  </div>`;
3404
3607
  }
3405
3608
  static get observedAttributes() {
3406
- return ["open", "size", "close-on-escape", "close-on-overlay"];
3609
+ return ["open", "size", "title", "close-on-escape", "close-on-overlay", "class"];
3407
3610
  }
3408
3611
  get open() {
3409
3612
  return this._open;
@@ -3413,6 +3616,12 @@ var UModal = class extends UElement {
3413
3616
  if (val) this.setAttribute("open", "");
3414
3617
  else this.removeAttribute("open");
3415
3618
  }
3619
+ get title() {
3620
+ return this._title;
3621
+ }
3622
+ set title(val) {
3623
+ this.setAttribute("title", val);
3624
+ }
3416
3625
  openModal() {
3417
3626
  this.open = true;
3418
3627
  }
@@ -3428,42 +3637,65 @@ var UModal = class extends UElement {
3428
3637
  if (oldVal === newVal) return;
3429
3638
  switch (name) {
3430
3639
  case "open":
3431
- this._open = newVal !== null;
3640
+ this._open = parseBooleanAttribute(newVal, false);
3432
3641
  this._updateOpenState();
3433
3642
  break;
3434
3643
  case "size":
3435
3644
  this._size = newVal ?? "md";
3645
+ this._updateSize();
3646
+ break;
3647
+ case "title":
3648
+ this._title = newVal ?? "";
3649
+ this._updateTitle();
3436
3650
  break;
3437
3651
  case "close-on-escape":
3438
- this._closeOnEscape = newVal !== null;
3652
+ this._closeOnEscape = parseBooleanAttribute(newVal, true);
3439
3653
  break;
3440
3654
  case "close-on-overlay":
3441
- this._closeOnOverlay = newVal !== null;
3655
+ this._closeOnOverlay = parseBooleanAttribute(newVal, true);
3656
+ break;
3657
+ case "class":
3658
+ this._sync();
3442
3659
  break;
3443
3660
  }
3444
3661
  }
3445
3662
  _sync() {
3663
+ const modalEl = this._root.querySelector('[part="modal"]');
3664
+ modalEl.className = `modal ${this.className}`.trim();
3446
3665
  this._updateOpenState();
3666
+ this._updateSize();
3667
+ this._updateTitle();
3668
+ }
3669
+ _updateTitle() {
3670
+ const headerSlot = this._root.querySelector('slot[name="header"]');
3671
+ if (!headerSlot) return;
3672
+ const assigned = headerSlot.assignedNodes({ flatten: true });
3673
+ if (assigned.length === 0 && this._title) {
3674
+ headerSlot.textContent = this._title;
3675
+ } else {
3676
+ headerSlot.textContent = "";
3677
+ }
3678
+ }
3679
+ _updateSize() {
3680
+ const wrapper = this._root.querySelector('[part="modal-wrapper"]');
3681
+ const isMobile = window.innerWidth < 640;
3682
+ if (isMobile) {
3683
+ wrapper.className = "modal-wrapper modal-mobile";
3684
+ wrapper.style.maxWidth = `${Math.min(window.innerWidth - 32, 800)}px`;
3685
+ } else {
3686
+ wrapper.className = `modal-wrapper modal-${this._size}`;
3687
+ wrapper.style.maxWidth = "";
3688
+ }
3447
3689
  }
3448
3690
  _updateOpenState() {
3449
3691
  const backdrop = this._root.querySelector('[part="backdrop"]');
3450
3692
  const modal = this._root.querySelector('[part="modal"]');
3451
- const wrapper = this._root.querySelector('[part="modal-wrapper"]');
3452
3693
  if (this._open) {
3453
3694
  this._previousActive = document.activeElement;
3454
3695
  backdrop.removeAttribute("hidden");
3455
3696
  modal.removeAttribute("hidden");
3456
3697
  this._unlockScroll = lockScroll();
3457
- const isMobile = window.innerWidth < 640;
3458
- if (isMobile) {
3459
- wrapper.className = "modal-wrapper modal-mobile";
3460
- wrapper.style.maxWidth = `${window.innerWidth - 32}px`;
3461
- wrapper.style.maxHeight = `${window.innerHeight - 32}px`;
3462
- } else {
3463
- wrapper.className = `modal-wrapper modal-${this._size}`;
3464
- wrapper.style.maxWidth = "";
3465
- wrapper.style.maxHeight = "";
3466
- }
3698
+ this._updateSize();
3467
3699
  this._focusFirst();
3468
3700
  } else {
3469
3701
  backdrop.setAttribute("hidden", "");
@@ -3482,6 +3714,12 @@ var UModal = class extends UElement {
3482
3714
  const focusable = this._root.querySelectorAll(
3483
3715
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
3484
3716
  );
3717
+ for (const el of focusable) {
3718
+ if (el.offsetParent !== null) {
3719
+ el.focus();
3720
+ return;
3721
+ }
3722
+ }
3485
3723
  if (focusable.length > 0) {
3486
3724
  focusable[0].focus();
3487
3725
  }
@@ -3504,7 +3742,7 @@ var UModal = class extends UElement {
3504
3742
  if (this._closeOnOverlay) this.closeModal();
3505
3743
  });
3506
3744
  window.addEventListener("resize", () => {
3507
- if (this._open) this._updateOpenState();
3745
+ if (this._open) this._updateSize();
3508
3746
  });
3509
3747
  }
3510
3748
  _trapTab(e) {
@@ -3517,8 +3755,10 @@ var UModal = class extends UElement {
3517
3755
  e.preventDefault();
3518
3756
  return;
3519
3757
  }
3520
- const first = focusable[0];
3521
- const last = focusable[focusable.length - 1];
3758
+ const visible = focusable.filter((el) => el.offsetParent !== null);
3759
+ const list = visible.length > 0 ? visible : focusable;
3760
+ const first = list[0];
3761
+ const last = list[list.length - 1];
3522
3762
  if (e.shiftKey && document.activeElement === first) {
3523
3763
  e.preventDefault();
3524
3764
  last.focus();
@@ -3558,7 +3798,7 @@ var UDrawer = class extends UElement {
3558
3798
  </div>`;
3559
3799
  }
3560
3800
  static get observedAttributes() {
3561
- return ["open", "side", "size", "close-on-escape", "close-on-overlay"];
3801
+ return ["open", "side", "size", "close-on-escape", "close-on-overlay", "class"];
3562
3802
  }
3563
3803
  get open() {
3564
3804
  return this._open;
@@ -3589,7 +3829,7 @@ var UDrawer = class extends UElement {
3589
3829
  if (oldVal === newVal) return;
3590
3830
  switch (name) {
3591
3831
  case "open":
3592
- this._open = newVal !== null;
3832
+ this._open = parseBooleanAttribute(newVal, false);
3593
3833
  this._updateOpenState();
3594
3834
  break;
3595
3835
  case "side":
@@ -3600,16 +3840,16 @@ var UDrawer = class extends UElement {
3600
3840
  this._size = newVal ?? "300px";
3601
3841
  break;
3602
3842
  case "close-on-escape":
3603
- this._closeOnEscape = newVal !== null;
3843
+ this._closeOnEscape = parseBooleanAttribute(newVal, true);
3604
3844
  break;
3605
3845
  case "close-on-overlay":
3606
- this._closeOnOverlay = newVal !== null;
3846
+ this._closeOnOverlay = parseBooleanAttribute(newVal, true);
3607
3847
  break;
3608
3848
  }
3609
3849
  }
3610
3850
  _sync() {
3611
3851
  const drawer = this._root.querySelector('[part="drawer"]');
3612
- drawer.className = `drawer drawer-${this._side}`;
3852
+ drawer.className = `drawer drawer-${this._side} ${this.className}`.trim();
3613
3853
  const content = this._root.querySelector('[part="drawer-content"]');
3614
3854
  this._applyDrawerSize(content);
3615
3855
  this._updateOpenState();
@@ -3744,7 +3984,7 @@ var UPopover = class extends UElement {
3744
3984
  </div>`;
3745
3985
  }
3746
3986
  static get observedAttributes() {
3747
- return ["open", "placement", "offset", "close-on-escape", "close-on-outside-click"];
3987
+ return ["open", "placement", "offset", "close-on-escape", "close-on-outside-click", "class"];
3748
3988
  }
3749
3989
  get open() {
3750
3990
  return this._open;
@@ -3774,6 +4014,7 @@ var UPopover = class extends UElement {
3774
4014
  }
3775
4015
  connectedCallback() {
3776
4016
  super.connectedCallback();
4017
+ this._sync();
3777
4018
  }
3778
4019
  attributeChangedCallback(name, oldVal, newVal) {
3779
4020
  if (oldVal === newVal) return;
@@ -3794,8 +4035,15 @@ var UPopover = class extends UElement {
3794
4035
  case "close-on-outside-click":
3795
4036
  this._closeOnOutsideClick = newVal !== null;
3796
4037
  break;
4038
+ case "class":
4039
+ this._sync();
4040
+ break;
3797
4041
  }
3798
4042
  }
4043
+ _sync() {
4044
+ const popoverEl = this._root.querySelector('[part="popover"]');
4045
+ popoverEl.className = `popover ${this.className}`.trim();
4046
+ }
3799
4047
  _updateOpenState() {
3800
4048
  const popover = this._root.querySelector('[part="popover"]');
3801
4049
  if (this._open) {
@@ -3907,7 +4155,7 @@ var UDropdown = class extends UElement {
3907
4155
  this._triggerEl = this._root.querySelector('[part="trigger"]');
3908
4156
  }
3909
4157
  static get observedAttributes() {
3910
- return ["open", "placement", "value"];
4158
+ return ["open", "placement", "value", "class"];
3911
4159
  }
3912
4160
  get open() {
3913
4161
  return this._open;
@@ -3944,6 +4192,7 @@ var UDropdown = class extends UElement {
3944
4192
  }
3945
4193
  connectedCallback() {
3946
4194
  super.connectedCallback();
4195
+ this._sync();
3947
4196
  this._renderItems();
3948
4197
  }
3949
4198
  attributeChangedCallback(name, oldVal, newVal) {
@@ -3960,8 +4209,15 @@ var UDropdown = class extends UElement {
3960
4209
  this._value = newVal ?? "";
3961
4210
  this._updateSelected();
3962
4211
  break;
4212
+ case "class":
4213
+ this._sync();
4214
+ break;
3963
4215
  }
3964
4216
  }
4217
+ _sync() {
4218
+ const triggerEl = this._root.querySelector('[part="trigger"]');
4219
+ triggerEl.className = `dropdown-trigger ${this.className}`.trim();
4220
+ }
3965
4221
  _renderItems() {
3966
4222
  this._itemsContainer.innerHTML = "";
3967
4223
  this._itemElements = [];
@@ -4118,7 +4374,7 @@ var UAccordion = class extends UElement {
4118
4374
  this._root.innerHTML = `<style>${accordionStyles}</style><div part="accordion" class="accordion"><slot></slot></div>`;
4119
4375
  }
4120
4376
  static get observedAttributes() {
4121
- return ["collapsible", "multiple"];
4377
+ return ["collapsible", "multiple", "class"];
4122
4378
  }
4123
4379
  get value() {
4124
4380
  return Array.from(this._value);
@@ -4141,12 +4397,18 @@ var UAccordion = class extends UElement {
4141
4397
  }
4142
4398
  connectedCallback() {
4143
4399
  super.connectedCallback();
4400
+ this._sync();
4144
4401
  this._initItems();
4145
4402
  }
4146
4403
  attributeChangedCallback(name, oldVal, newVal) {
4147
4404
  if (oldVal === newVal) return;
4148
4405
  if (name === "collapsible") this._collapsible = newVal !== null;
4149
4406
  else if (name === "multiple") this._multiple = newVal !== null;
4407
+ else if (name === "class") this._sync();
4408
+ }
4409
+ _sync() {
4410
+ const accordionEl = this._root.querySelector('[part="accordion"]');
4411
+ accordionEl.className = `accordion ${this.className}`.trim();
4150
4412
  }
4151
4413
  _initItems() {
4152
4414
  const items = this.querySelectorAll(":scope > u-accordion-item");
@@ -4221,7 +4483,7 @@ var UAccordionItem = class extends UElement {
4221
4483
  </div>`;
4222
4484
  }
4223
4485
  static get observedAttributes() {
4224
- return ["value", "open"];
4486
+ return ["value", "open", "class"];
4225
4487
  }
4226
4488
  get value() {
4227
4489
  return this._value;
@@ -4239,12 +4501,18 @@ var UAccordionItem = class extends UElement {
4239
4501
  }
4240
4502
  connectedCallback() {
4241
4503
  super.connectedCallback();
4504
+ this._sync();
4242
4505
  if (this.hasAttribute("open")) this._open = true;
4243
4506
  }
4244
4507
  attributeChangedCallback(name, oldVal, newVal) {
4245
4508
  if (oldVal === newVal) return;
4246
4509
  if (name === "value") this._value = newVal ?? "";
4247
4510
  else if (name === "open") this._open = newVal !== null;
4511
+ else if (name === "class") this._sync();
4512
+ }
4513
+ _sync() {
4514
+ const itemEl = this._root.querySelector('[part="accordion-item"]');
4515
+ itemEl.className = `accordion-item ${this.className}`.trim();
4248
4516
  }
4249
4517
  _mount() {
4250
4518
  }
@@ -4279,7 +4547,7 @@ var UCombobox = class extends UElement {
4279
4547
  </div>`;
4280
4548
  }
4281
4549
  static get observedAttributes() {
4282
- return ["value", "placeholder", "disabled", "filterable"];
4550
+ return ["value", "placeholder", "disabled", "filterable", "class"];
4283
4551
  }
4284
4552
  get value() {
4285
4553
  return this._value;
@@ -4315,9 +4583,14 @@ var UCombobox = class extends UElement {
4315
4583
  case "filterable":
4316
4584
  this._filterable = newVal !== null;
4317
4585
  break;
4586
+ case "class":
4587
+ this._syncInput();
4588
+ break;
4318
4589
  }
4319
4590
  }
4320
4591
  _syncInput() {
4592
+ const combobox = this._root.querySelector('[part="combobox"]');
4593
+ combobox.className = `combobox ${this.className}`.trim();
4321
4594
  const input = this._root.querySelector("input");
4322
4595
  input.placeholder = this._placeholder;
4323
4596
  input.disabled = this._disabled;
@@ -4510,7 +4783,7 @@ var UCalendar = class extends UElement {
4510
4783
  </div>`;
4511
4784
  }
4512
4785
  static get observedAttributes() {
4513
- return ["value", "min", "max"];
4786
+ return ["value", "min", "max", "class"];
4514
4787
  }
4515
4788
  get value() {
4516
4789
  return this._value;
@@ -4520,6 +4793,7 @@ var UCalendar = class extends UElement {
4520
4793
  }
4521
4794
  connectedCallback() {
4522
4795
  super.connectedCallback();
4796
+ this._sync();
4523
4797
  if (this._value) {
4524
4798
  const d = new Date(this._value);
4525
4799
  if (!isNaN(d.getTime())) {
@@ -4535,8 +4809,16 @@ var UCalendar = class extends UElement {
4535
4809
  if (name === "value") this._value = newVal ?? "";
4536
4810
  else if (name === "min") this._min = newVal ?? "";
4537
4811
  else if (name === "max") this._max = newVal ?? "";
4812
+ else if (name === "class") {
4813
+ this._sync();
4814
+ return;
4815
+ }
4538
4816
  this._render();
4539
4817
  }
4818
+ _sync() {
4819
+ const el = this._root.querySelector('[part="calendar"]');
4820
+ el.className = `calendar ${this.className}`.trim();
4821
+ }
4540
4822
  _renderDayNames() {
4541
4823
  const container = this._root.querySelector('[part="day-names"]');
4542
4824
  container.innerHTML = DAYS.map((d) => `<span class="cal-day-name">${d}</span>`).join("");
@@ -4648,7 +4930,7 @@ var UDataTable = class extends UElement {
4648
4930
  </div>`;
4649
4931
  }
4650
4932
  static get observedAttributes() {
4651
- return ["page-size", "sortable", "selectable"];
4933
+ return ["page-size", "sortable", "selectable", "class"];
4652
4934
  }
4653
4935
  get columns() {
4654
4936
  return this._columns;
@@ -4672,14 +4954,20 @@ var UDataTable = class extends UElement {
4672
4954
  }
4673
4955
  connectedCallback() {
4674
4956
  super.connectedCallback();
4957
+ this._sync();
4675
4958
  }
4676
4959
  attributeChangedCallback(name, oldVal, newVal) {
4677
4960
  if (oldVal === newVal) return;
4678
4961
  if (name === "page-size") this._pageSize = Number(newVal) || 10;
4679
4962
  else if (name === "sortable") this._sortable = newVal !== null;
4680
4963
  else if (name === "selectable") this._selectable = newVal !== null;
4964
+ else if (name === "class") return;
4681
4965
  this._render();
4682
4966
  }
4967
+ _sync() {
4968
+ const el = this._root.querySelector('[part="data-table"]');
4969
+ el.className = `data-table ${this.className}`.trim();
4970
+ }
4683
4971
  _getProcessedData() {
4684
4972
  let data = [...this._rows];
4685
4973
  if (this._filterText) {
@@ -4897,7 +5185,7 @@ var UCommandPalette = class extends UElement {
4897
5185
  </div>`;
4898
5186
  }
4899
5187
  static get observedAttributes() {
4900
- return ["open", "placeholder", "shortcut"];
5188
+ return ["open", "placeholder", "shortcut", "class"];
4901
5189
  }
4902
5190
  get open() {
4903
5191
  return this._open;
@@ -4937,9 +5225,13 @@ var UCommandPalette = class extends UElement {
4937
5225
  } else if (name === "shortcut") {
4938
5226
  this._shortcut = newVal ?? "Ctrl+K";
4939
5227
  this._sync();
5228
+ } else if (name === "class") {
5229
+ this._sync();
4940
5230
  }
4941
5231
  }
4942
5232
  _sync() {
5233
+ const dialog = this._root.querySelector('[part="dialog"]');
5234
+ dialog.className = `cp-dialog ${this.className}`.trim();
4943
5235
  const hint = this._root.querySelector('[part="shortcut-hint"]');
4944
5236
  hint.textContent = this._shortcut;
4945
5237
  const input = this._root.querySelector('[part="search-input"]');
@@ -5146,7 +5438,7 @@ var UToast = class extends UElement {
5146
5438
  this._root.innerHTML = `<style>${toastStyles}</style><div part="container" class="toast-container toast-top-right"></div>`;
5147
5439
  }
5148
5440
  static get observedAttributes() {
5149
- return ["placement"];
5441
+ return ["placement", "class"];
5150
5442
  }
5151
5443
  get placement() {
5152
5444
  return this._placement;
@@ -5167,7 +5459,7 @@ var UToast = class extends UElement {
5167
5459
  }
5168
5460
  _updatePlacement() {
5169
5461
  const container = this._root.querySelector('[part="container"]');
5170
- container.className = `toast-container toast-${this._placement}`;
5462
+ container.className = `toast-container toast-${this._placement} ${this.className}`.trim();
5171
5463
  }
5172
5464
  show(opts) {
5173
5465
  const id = `toast-${++toastId}`;
@@ -5268,6 +5560,9 @@ var UContextMenu = class extends UElement {
5268
5560
  <div part="items" class="cm-items"></div>
5269
5561
  </div>`;
5270
5562
  }
5563
+ static get observedAttributes() {
5564
+ return ["class"];
5565
+ }
5271
5566
  get items() {
5272
5567
  return this._items;
5273
5568
  }
@@ -5279,6 +5574,11 @@ var UContextMenu = class extends UElement {
5279
5574
  super.connectedCallback();
5280
5575
  this._parseSlotItems();
5281
5576
  this._renderItems();
5577
+ this._sync();
5578
+ }
5579
+ attributeChangedCallback(name, oldVal, newVal) {
5580
+ if (oldVal === newVal) return;
5581
+ if (name === "class") this._sync();
5282
5582
  }
5283
5583
  _parseSlotItems() {
5284
5584
  const slotItems = this.querySelectorAll("u-context-menu-item");
@@ -5320,6 +5620,10 @@ var UContextMenu = class extends UElement {
5320
5620
  container.appendChild(btn);
5321
5621
  });
5322
5622
  }
5623
+ _sync() {
5624
+ const menu = this._root.querySelector('[part="menu"]');
5625
+ menu.className = `cm-menu ${this.className}`.trim();
5626
+ }
5323
5627
  _openMenu(x, y) {
5324
5628
  const menu = this._root.querySelector('[part="menu"]');
5325
5629
  const itemsContainer = this._root.querySelector('[part="items"]');
@@ -5518,7 +5822,11 @@ var USortable = class extends UElement {
5518
5822
  </div>`;
5519
5823
  }
5520
5824
  static get observedAttributes() {
5521
- return ["disabled"];
5825
+ return ["disabled", "class"];
5826
+ }
5827
+ attributeChangedCallback(name, oldVal, newVal) {
5828
+ if (oldVal === newVal) return;
5829
+ if (name === "class") this._sync();
5522
5830
  }
5523
5831
  get disabled() {
5524
5832
  return this._disabled;
@@ -5554,6 +5862,14 @@ var USortable = class extends UElement {
5554
5862
  }
5555
5863
  return null;
5556
5864
  }
5865
+ connectedCallback() {
5866
+ super.connectedCallback();
5867
+ this._sync();
5868
+ }
5869
+ _sync() {
5870
+ const el = this._root.querySelector('[part="sortable"]');
5871
+ el.className = `sortable ${this.className}`.trim();
5872
+ }
5557
5873
  _mount() {
5558
5874
  this.addEventListener("pointerdown", this._onPointerDown);
5559
5875
  }
@@ -5569,22 +5885,41 @@ var UForm = class extends UElement {
5569
5885
  <slot></slot>
5570
5886
  </form>`;
5571
5887
  }
5888
+ static get observedAttributes() {
5889
+ return ["class"];
5890
+ }
5891
+ attributeChangedCallback(name, oldVal, newVal) {
5892
+ if (oldVal === newVal) return;
5893
+ this._sync();
5894
+ }
5895
+ connectedCallback() {
5896
+ super.connectedCallback();
5897
+ this._sync();
5898
+ }
5572
5899
  get form() {
5573
5900
  return this._root.querySelector("form");
5574
5901
  }
5902
+ _sync() {
5903
+ const form = this._root.querySelector("form");
5904
+ if (!form) return;
5905
+ form.className = `form ${this.className}`.trim();
5906
+ }
5575
5907
  validate() {
5576
5908
  let valid = true;
5577
5909
  const errors = {};
5578
5910
  this._fields.clear();
5579
- const inputs = this.querySelectorAll("input, textarea, select, u-input, u-textarea, u-select, u-checkbox, u-radio-group");
5911
+ const inputs = this.querySelectorAll(
5912
+ "input, textarea, select, u-input, u-textarea, u-select, u-checkbox, u-radio-group"
5913
+ );
5580
5914
  inputs.forEach((el) => {
5581
5915
  const name = el.getAttribute("name") || "";
5582
5916
  if (!name) return;
5583
5917
  this._fields.set(name, el);
5584
- if ("checkValidity" in el && typeof el.checkValidity === "function") {
5585
- if (!el.checkValidity()) {
5918
+ const anyEl = el;
5919
+ if (typeof anyEl.checkValidity === "function") {
5920
+ if (!anyEl.checkValidity()) {
5586
5921
  valid = false;
5587
- errors[name] = el.validationMessage || "Invalid";
5922
+ errors[name] = anyEl.validationMessage || "Invalid";
5588
5923
  const field = el.closest("u-field");
5589
5924
  if (field) {
5590
5925
  field.setAttribute("error", errors[name]);
@@ -5605,14 +5940,20 @@ var UForm = class extends UElement {
5605
5940
  }
5606
5941
  getValues() {
5607
5942
  const values = {};
5608
- const inputs = this.querySelectorAll("input, textarea, select, u-input, u-textarea, u-select");
5943
+ const inputs = this.querySelectorAll(
5944
+ "input, textarea, select, u-input, u-textarea, u-select, u-checkbox, u-radio-group"
5945
+ );
5609
5946
  inputs.forEach((el) => {
5610
5947
  const name = el.getAttribute("name") || "";
5611
5948
  if (!name) return;
5612
- if ("checked" in el && el.type === "checkbox") {
5613
- values[name] = String(el.checked);
5614
- } else if ("value" in el) {
5615
- values[name] = String(el.value);
5949
+ const anyEl = el;
5950
+ const tag = el.tagName.toLowerCase();
5951
+ if (tag === "input" && anyEl.type === "checkbox") {
5952
+ values[name] = String(anyEl.checked);
5953
+ } else if (tag === "u-checkbox") {
5954
+ values[name] = String(anyEl.checked ?? false);
5955
+ } else if ("value" in anyEl) {
5956
+ values[name] = String(anyEl.value ?? "");
5616
5957
  }
5617
5958
  });
5618
5959
  return values;
@@ -5640,6 +5981,167 @@ var UForm = class extends UElement {
5640
5981
  }
5641
5982
  };
5642
5983
 
5643
- export { UAccordion, UAccordionItem, UAnimate, UBox, UBreadcrumb, UButton, UCalendar, UCheckbox, UCollection, UCombobox, UCommandPalette, UContainer, UContextMenu, UDataTable, UDialogRoot, UDismissableLayer, UDrawer, UDropdown, UField, UFocusManager, UFocusScope, UFocusTrap, UForm, UGrid, UHStack, UHoverable, UInput, UKeyboardNavigation, ULabel, ULink, UList, ULiveRegion, UModal, UOverlay, UPopover, UPopper, UPortal, UPresence, UPressable, URadio, URadioGroup, URouterView, USelect, USlot, USortable, USpacer, UStack, USwitch, UTable, UTabs, UText, UTextarea, UToast, UTooltipRoot, UTransition, UTree, UVirtualList, UVisuallyHidden, createControlledInput, setPortalRoot };
5644
- //# sourceMappingURL=chunk-NJAZMTMT.js.map
5645
- //# sourceMappingURL=chunk-NJAZMTMT.js.map
5984
+ // src/components/badge.wc.ts
5985
+ var UBadge = class extends UElement {
5986
+ constructor() {
5987
+ super();
5988
+ this._variant = "default";
5989
+ this._size = "md";
5990
+ this._dot = false;
5991
+ this._pill = true;
5992
+ this._root.innerHTML = `<style>${badgeStyles}</style><span part="badge" class="badge badge-default badge-md badge-pill"><slot></slot></span>`;
5993
+ }
5994
+ static get observedAttributes() {
5995
+ return ["variant", "size", "dot", "pill", "class"];
5996
+ }
5997
+ get variant() {
5998
+ return this._variant;
5999
+ }
6000
+ set variant(val) {
6001
+ this.setAttribute("variant", val);
6002
+ }
6003
+ get size() {
6004
+ return this._size;
6005
+ }
6006
+ set size(val) {
6007
+ this.setAttribute("size", val);
6008
+ }
6009
+ get dot() {
6010
+ return this._dot;
6011
+ }
6012
+ set dot(val) {
6013
+ if (val) this.setAttribute("dot", "");
6014
+ else this.removeAttribute("dot");
6015
+ }
6016
+ get pill() {
6017
+ return this._pill;
6018
+ }
6019
+ set pill(val) {
6020
+ if (!val) this.removeAttribute("pill");
6021
+ else this.setAttribute("pill", "");
6022
+ }
6023
+ connectedCallback() {
6024
+ super.connectedCallback();
6025
+ this._sync();
6026
+ }
6027
+ attributeChangedCallback(name, oldVal, newVal) {
6028
+ if (oldVal === newVal) return;
6029
+ switch (name) {
6030
+ case "variant":
6031
+ this._variant = newVal ?? "default";
6032
+ break;
6033
+ case "size":
6034
+ this._size = newVal ?? "md";
6035
+ break;
6036
+ case "dot":
6037
+ this._dot = newVal !== null;
6038
+ break;
6039
+ case "pill":
6040
+ this._pill = newVal !== null;
6041
+ break;
6042
+ }
6043
+ this._sync();
6044
+ }
6045
+ _sync() {
6046
+ const el = this._root.querySelector('[part="badge"]');
6047
+ el.className = `badge badge-${this._variant} badge-${this._size} ${this.className}`.trim();
6048
+ if (this._dot) {
6049
+ el.classList.add("badge-dot");
6050
+ } else if (this._pill) {
6051
+ el.classList.add("badge-pill");
6052
+ } else {
6053
+ el.classList.add("badge-square");
6054
+ }
6055
+ }
6056
+ _mount() {
6057
+ }
6058
+ };
6059
+
6060
+ // src/components/card.wc.ts
6061
+ var UCard = class extends UElement {
6062
+ constructor() {
6063
+ super();
6064
+ this._variant = "default";
6065
+ this._padding = "md";
6066
+ this._hoverable = false;
6067
+ this._root.innerHTML = `<style>${cardStyles}</style>
6068
+ <div part="card" class="card card-default card-padding-md">
6069
+ <div part="image" class="card-image card-image-top">
6070
+ <slot name="image"></slot>
6071
+ </div>
6072
+ <div part="header">
6073
+ <slot name="header"></slot>
6074
+ </div>
6075
+ <div part="content">
6076
+ <slot></slot>
6077
+ </div>
6078
+ <div part="footer">
6079
+ <slot name="footer"></slot>
6080
+ </div>
6081
+ </div>`;
6082
+ }
6083
+ static get observedAttributes() {
6084
+ return ["variant", "padding", "hoverable", "class"];
6085
+ }
6086
+ get variant() {
6087
+ return this._variant;
6088
+ }
6089
+ set variant(val) {
6090
+ this.setAttribute("variant", val);
6091
+ }
6092
+ get padding() {
6093
+ return this._padding;
6094
+ }
6095
+ set padding(val) {
6096
+ this.setAttribute("padding", val);
6097
+ }
6098
+ get hoverable() {
6099
+ return this._hoverable;
6100
+ }
6101
+ set hoverable(val) {
6102
+ if (val) this.setAttribute("hoverable", "");
6103
+ else this.removeAttribute("hoverable");
6104
+ }
6105
+ connectedCallback() {
6106
+ super.connectedCallback();
6107
+ this._sync();
6108
+ }
6109
+ attributeChangedCallback(name, oldVal, newVal) {
6110
+ if (oldVal === newVal) return;
6111
+ switch (name) {
6112
+ case "variant":
6113
+ this._variant = newVal ?? "default";
6114
+ break;
6115
+ case "padding":
6116
+ this._padding = newVal ?? "md";
6117
+ break;
6118
+ case "hoverable":
6119
+ this._hoverable = newVal !== null;
6120
+ break;
6121
+ }
6122
+ this._sync();
6123
+ }
6124
+ _sync() {
6125
+ const el = this._root.querySelector('[part="card"]');
6126
+ el.className = `card card-${this._variant} card-padding-${this._padding} ${this.className}`.trim();
6127
+ if (this._hoverable) el.classList.add("card-hoverable");
6128
+ const imageSlot = this._root.querySelector('slot[name="image"]');
6129
+ if (imageSlot) {
6130
+ const assigned = imageSlot.assignedNodes({ flatten: true });
6131
+ const imageEl = assigned.length > 0 ? imageSlot.parentElement : null;
6132
+ if (imageEl) {
6133
+ imageEl.classList.toggle("card-image-top", assigned.length > 0);
6134
+ }
6135
+ }
6136
+ }
6137
+ _mount() {
6138
+ const imageSlot = this._root.querySelector('slot[name="image"]');
6139
+ if (imageSlot) {
6140
+ imageSlot.addEventListener("slotchange", () => this._sync());
6141
+ }
6142
+ }
6143
+ };
6144
+
6145
+ export { UAccordion, UAccordionItem, UAnimate, UBadge, UBox, UBreadcrumb, UButton, UCalendar, UCard, UCheckbox, UCollection, UCombobox, UCommandPalette, UContainer, UContextMenu, UDataTable, UDialogRoot, UDismissableLayer, UDrawer, UDropdown, UField, UFocusManager, UFocusScope, UFocusTrap, UForm, UGrid, UHStack, UHoverable, UInput, UKeyboardNavigation, ULabel, ULink, UList, ULiveRegion, UModal, UOverlay, UPopover, UPopper, UPortal, UPresence, UPressable, URadio, URadioGroup, URouterView, USelect, USlot, USortable, USpacer, UStack, USwitch, UTable, UTabs, UText, UTextarea, UToast, UTooltipRoot, UTransition, UTree, UVirtualList, UVisuallyHidden, createControlledInput, setPortalRoot };
6146
+ //# sourceMappingURL=chunk-PIXJHFME.js.map
6147
+ //# sourceMappingURL=chunk-PIXJHFME.js.map