@avento-space/ts-ui 1.2.1 → 1.2.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.
@@ -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-ICB6OBEZ.js';
2
2
  import { signal, effect } from './chunk-Q5RCPPCF.js';
3
3
 
4
4
  // src/components/button.wc.ts
@@ -1811,6 +1811,13 @@ var UPopper = class extends UElement {
1811
1811
  }
1812
1812
  };
1813
1813
 
1814
+ // src/core/utils.ts
1815
+ function parseBooleanAttribute(value, fallback = false) {
1816
+ if (value == null) return fallback;
1817
+ const normalized = value.trim().toLowerCase();
1818
+ return normalized === "" || normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on";
1819
+ }
1820
+
1814
1821
  // src/components/dialog-root.wc.ts
1815
1822
  var UDialogRoot = class extends UElement {
1816
1823
  constructor() {
@@ -1820,6 +1827,7 @@ var UDialogRoot = class extends UElement {
1820
1827
  this._overlay = null;
1821
1828
  this._dismissable = null;
1822
1829
  this._focusTrap = null;
1830
+ this._synced = false;
1823
1831
  this._root.innerHTML = `<style>${dialogStyles}</style><div part="dialog-root"><slot></slot></div>`;
1824
1832
  }
1825
1833
  static get observedAttributes() {
@@ -1857,15 +1865,18 @@ var UDialogRoot = class extends UElement {
1857
1865
  attributeChangedCallback(name, oldVal, newVal) {
1858
1866
  if (oldVal === newVal) return;
1859
1867
  if (name === "open") {
1860
- this._open = newVal !== null;
1868
+ this._open = parseBooleanAttribute(newVal, false);
1861
1869
  this._updateOpenState();
1862
1870
  }
1863
- if (name === "modal") this._modal = newVal !== null;
1871
+ if (name === "modal") this._modal = parseBooleanAttribute(newVal, true);
1864
1872
  }
1865
1873
  _sync() {
1866
1874
  this.setAttribute("role", "dialog");
1867
1875
  this.setAttribute("aria-modal", String(this._modal));
1868
- this._updateOpenState();
1876
+ if (!this._synced) {
1877
+ this._synced = true;
1878
+ this._updateOpenState();
1879
+ }
1869
1880
  }
1870
1881
  _updateOpenState() {
1871
1882
  if (this._open) {
@@ -1894,6 +1905,8 @@ var UDialogRoot = class extends UElement {
1894
1905
  _removeOverlay() {
1895
1906
  if (this._overlay) {
1896
1907
  this._overlay.hide();
1908
+ this._overlay.remove();
1909
+ this._overlay = null;
1897
1910
  }
1898
1911
  }
1899
1912
  _injectDismissable() {
@@ -1901,8 +1914,10 @@ var UDialogRoot = class extends UElement {
1901
1914
  this._dismissable = new UDismissableLayer();
1902
1915
  this._dismissable.style.display = "contents";
1903
1916
  this._root.appendChild(this._dismissable);
1904
- this._dismissable.addEventListener("u-dismiss", () => {
1905
- if (this._modal) return;
1917
+ this._dismissable.addEventListener("u-dismiss", (e) => {
1918
+ const reason = e.detail?.reason;
1919
+ const isOutsideClick = reason === "pointer-down-outside" || reason === "outside-click";
1920
+ if (this._modal && isOutsideClick) return;
1906
1921
  this.closeDialog();
1907
1922
  });
1908
1923
  }
@@ -2794,10 +2809,16 @@ var UTabs = class extends UElement {
2794
2809
  super();
2795
2810
  this._value = "";
2796
2811
  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>`;
2812
+ this._variant = "underline";
2813
+ this._fullWidth = false;
2814
+ this._triggers = [];
2815
+ 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>`;
2816
+ this._tablistEl = this._root.querySelector('[part="tablist"]');
2817
+ this._panelsContainer = this._root.querySelector('[part="tabpanels"]');
2818
+ this._indicatorEl = this._tablistEl.querySelector(".tab-indicator");
2798
2819
  }
2799
2820
  static get observedAttributes() {
2800
- return ["value", "orientation"];
2821
+ return ["value", "orientation", "variant", "full-width"];
2801
2822
  }
2802
2823
  get value() {
2803
2824
  return this._value;
@@ -2805,35 +2826,89 @@ var UTabs = class extends UElement {
2805
2826
  set value(val) {
2806
2827
  this.setAttribute("value", val);
2807
2828
  }
2829
+ get variant() {
2830
+ return this._variant;
2831
+ }
2832
+ set variant(val) {
2833
+ this.setAttribute("variant", val);
2834
+ }
2835
+ get fullWidth() {
2836
+ return this._fullWidth;
2837
+ }
2838
+ set fullWidth(val) {
2839
+ if (val) this.setAttribute("full-width", "");
2840
+ else this.removeAttribute("full-width");
2841
+ }
2808
2842
  connectedCallback() {
2809
2843
  super.connectedCallback();
2810
2844
  this._sync();
2811
2845
  }
2812
2846
  attributeChangedCallback(name, oldVal, newVal) {
2813
2847
  if (oldVal === newVal) return;
2814
- if (name === "value") this._value = newVal ?? "";
2815
- else if (name === "orientation") this._orientation = newVal ?? "horizontal";
2848
+ switch (name) {
2849
+ case "value":
2850
+ this._value = newVal ?? "";
2851
+ break;
2852
+ case "orientation":
2853
+ this._orientation = newVal ?? "horizontal";
2854
+ break;
2855
+ case "variant":
2856
+ this._variant = newVal ?? "underline";
2857
+ break;
2858
+ case "full-width":
2859
+ this._fullWidth = newVal !== null;
2860
+ break;
2861
+ }
2816
2862
  this._sync();
2817
2863
  }
2818
2864
  _sync() {
2819
- const tablist = this._root.querySelector('[part="tablist"]');
2820
- tablist.setAttribute("aria-orientation", this._orientation);
2865
+ this._tablistEl.setAttribute("aria-orientation", this._orientation);
2866
+ this._tablistEl.className = `tablist tablist-${this._variant}`;
2867
+ if (this._fullWidth) this._tablistEl.classList.add("tablist-full");
2821
2868
  const tabs = this.querySelectorAll('[slot="tab"]');
2822
2869
  const panels = this.querySelectorAll('[slot="panel"]');
2823
- tablist.innerHTML = "";
2870
+ if (!this._value && tabs.length > 0) {
2871
+ this._value = tabs[0].getAttribute("data-value") || "0";
2872
+ }
2873
+ this._triggers = [];
2874
+ let triggerHtml = "";
2875
+ if (this._indicatorEl) {
2876
+ triggerHtml = '<div class="tab-indicator"></div>';
2877
+ }
2878
+ this._tablistEl.innerHTML = triggerHtml;
2879
+ this._indicatorEl = this._tablistEl.querySelector(".tab-indicator");
2824
2880
  tabs.forEach((tab, i) => {
2825
2881
  const key = tab.getAttribute("data-value") || String(i);
2882
+ const disabled = tab.hasAttribute("disabled");
2826
2883
  const btn = document.createElement("button");
2827
2884
  btn.className = "tab-trigger";
2828
2885
  btn.setAttribute("role", "tab");
2829
2886
  btn.setAttribute("aria-selected", String(key === this._value));
2830
2887
  btn.setAttribute("data-value", key);
2831
- btn.textContent = tab.textContent;
2888
+ btn.disabled = disabled;
2832
2889
  if (key === this._value) btn.classList.add("active");
2833
- tablist.appendChild(btn);
2890
+ const iconSlot = tab.querySelector('[slot="icon"]');
2891
+ if (iconSlot) {
2892
+ const iconSpan = document.createElement("span");
2893
+ iconSpan.className = "tab-trigger-icon";
2894
+ iconSpan.appendChild(iconSlot.cloneNode(true));
2895
+ btn.appendChild(iconSpan);
2896
+ } else {
2897
+ const svgs = tab.querySelectorAll("svg");
2898
+ if (svgs.length > 0) {
2899
+ const iconSpan = document.createElement("span");
2900
+ iconSpan.className = "tab-trigger-icon";
2901
+ iconSpan.appendChild(svgs[0].cloneNode(true));
2902
+ btn.appendChild(iconSpan);
2903
+ }
2904
+ }
2905
+ const labelSpan = document.createElement("span");
2906
+ labelSpan.textContent = tab.textContent;
2907
+ btn.appendChild(labelSpan);
2908
+ this._tablistEl.appendChild(btn);
2909
+ this._triggers.push(btn);
2834
2910
  });
2835
- const panelsContainer = this._root.querySelector('[part="tabpanels"]');
2836
- panelsContainer.innerHTML = "";
2911
+ this._panelsContainer.innerHTML = "";
2837
2912
  panels.forEach((panel, i) => {
2838
2913
  const key = panel.getAttribute("data-value") || String(i);
2839
2914
  const div = document.createElement("div");
@@ -2845,14 +2920,25 @@ var UTabs = class extends UElement {
2845
2920
  div.setAttribute("hidden", "");
2846
2921
  }
2847
2922
  div.appendChild(panel.cloneNode(true));
2848
- panelsContainer.appendChild(div);
2923
+ this._panelsContainer.appendChild(div);
2849
2924
  });
2925
+ this._updateIndicator();
2926
+ }
2927
+ _updateIndicator() {
2928
+ if (this._variant !== "underline" || !this._indicatorEl) return;
2929
+ const active = this._tablistEl.querySelector(".tab-trigger.active");
2930
+ if (active) {
2931
+ this._indicatorEl.style.left = `${active.offsetLeft}px`;
2932
+ this._indicatorEl.style.width = `${active.offsetWidth}px`;
2933
+ } else {
2934
+ this._indicatorEl.style.left = "0";
2935
+ this._indicatorEl.style.width = "0";
2936
+ }
2850
2937
  }
2851
2938
  _mount() {
2852
- const tablist = this._root.querySelector('[part="tablist"]');
2853
- tablist.addEventListener("click", (e) => {
2939
+ this._tablistEl.addEventListener("click", (e) => {
2854
2940
  const btn = e.target.closest(".tab-trigger");
2855
- if (!btn) return;
2941
+ if (!btn || btn.disabled) return;
2856
2942
  const val = btn.getAttribute("data-value") || "";
2857
2943
  this._value = val;
2858
2944
  this.setAttribute("value", val);
@@ -2865,21 +2951,36 @@ var UTabs = class extends UElement {
2865
2951
  })
2866
2952
  );
2867
2953
  });
2868
- tablist.addEventListener("keydown", (e) => {
2954
+ this._tablistEl.addEventListener("keydown", (e) => {
2869
2955
  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);
2956
+ const enabled = this._triggers.filter((t) => !t.disabled);
2957
+ if (enabled.length === 0) return;
2958
+ const current = this._tablistEl.querySelector(".tab-trigger.active");
2959
+ const idx = enabled.indexOf(current);
2873
2960
  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;
2961
+ switch (ke.key) {
2962
+ case "ArrowRight":
2963
+ case "ArrowDown":
2964
+ ke.preventDefault();
2965
+ nextIdx = (idx + 1) % enabled.length;
2966
+ break;
2967
+ case "ArrowLeft":
2968
+ case "ArrowUp":
2969
+ ke.preventDefault();
2970
+ nextIdx = (idx - 1 + enabled.length) % enabled.length;
2971
+ break;
2972
+ case "Home":
2973
+ ke.preventDefault();
2974
+ nextIdx = 0;
2975
+ break;
2976
+ case "End":
2977
+ ke.preventDefault();
2978
+ nextIdx = enabled.length - 1;
2979
+ break;
2878
2980
  }
2879
2981
  if (nextIdx >= 0) {
2880
- e.preventDefault();
2881
- triggers[nextIdx].click();
2882
- triggers[nextIdx].focus();
2982
+ enabled[nextIdx].click();
2983
+ enabled[nextIdx].focus();
2883
2984
  }
2884
2985
  });
2885
2986
  }
@@ -3376,10 +3477,12 @@ function unlockScroll() {
3376
3477
  }
3377
3478
 
3378
3479
  // src/components/modal.wc.ts
3480
+ 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
3481
  var UModal = class extends UElement {
3380
3482
  constructor() {
3381
3483
  super();
3382
3484
  this._open = false;
3485
+ this._title = "";
3383
3486
  this._size = "md";
3384
3487
  this._closeOnEscape = true;
3385
3488
  this._closeOnOverlay = true;
@@ -3390,8 +3493,8 @@ var UModal = class extends UElement {
3390
3493
  <div part="modal" class="modal" role="dialog" aria-modal="true" hidden>
3391
3494
  <div part="modal-wrapper" class="modal-wrapper modal-md">
3392
3495
  <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>
3496
+ <div part="title" class="modal-title"><slot name="header">${this._title}</slot></div>
3497
+ <button part="close-btn" class="modal-close" aria-label="Close">${CLOSE_SVG}</button>
3395
3498
  </div>
3396
3499
  <div part="content" class="modal-content">
3397
3500
  <slot></slot>
@@ -3403,7 +3506,7 @@ var UModal = class extends UElement {
3403
3506
  </div>`;
3404
3507
  }
3405
3508
  static get observedAttributes() {
3406
- return ["open", "size", "close-on-escape", "close-on-overlay"];
3509
+ return ["open", "size", "title", "close-on-escape", "close-on-overlay"];
3407
3510
  }
3408
3511
  get open() {
3409
3512
  return this._open;
@@ -3413,6 +3516,12 @@ var UModal = class extends UElement {
3413
3516
  if (val) this.setAttribute("open", "");
3414
3517
  else this.removeAttribute("open");
3415
3518
  }
3519
+ get title() {
3520
+ return this._title;
3521
+ }
3522
+ set title(val) {
3523
+ this.setAttribute("title", val);
3524
+ }
3416
3525
  openModal() {
3417
3526
  this.open = true;
3418
3527
  }
@@ -3428,42 +3537,60 @@ var UModal = class extends UElement {
3428
3537
  if (oldVal === newVal) return;
3429
3538
  switch (name) {
3430
3539
  case "open":
3431
- this._open = newVal !== null;
3540
+ this._open = parseBooleanAttribute(newVal, false);
3432
3541
  this._updateOpenState();
3433
3542
  break;
3434
3543
  case "size":
3435
3544
  this._size = newVal ?? "md";
3545
+ this._updateSize();
3546
+ break;
3547
+ case "title":
3548
+ this._title = newVal ?? "";
3549
+ this._updateTitle();
3436
3550
  break;
3437
3551
  case "close-on-escape":
3438
- this._closeOnEscape = newVal !== null;
3552
+ this._closeOnEscape = parseBooleanAttribute(newVal, true);
3439
3553
  break;
3440
3554
  case "close-on-overlay":
3441
- this._closeOnOverlay = newVal !== null;
3555
+ this._closeOnOverlay = parseBooleanAttribute(newVal, true);
3442
3556
  break;
3443
3557
  }
3444
3558
  }
3445
3559
  _sync() {
3446
3560
  this._updateOpenState();
3561
+ this._updateSize();
3562
+ this._updateTitle();
3563
+ }
3564
+ _updateTitle() {
3565
+ const headerSlot = this._root.querySelector('slot[name="header"]');
3566
+ if (!headerSlot) return;
3567
+ const assigned = headerSlot.assignedNodes({ flatten: true });
3568
+ if (assigned.length === 0 && this._title) {
3569
+ headerSlot.textContent = this._title;
3570
+ } else {
3571
+ headerSlot.textContent = "";
3572
+ }
3573
+ }
3574
+ _updateSize() {
3575
+ const wrapper = this._root.querySelector('[part="modal-wrapper"]');
3576
+ const isMobile = window.innerWidth < 640;
3577
+ if (isMobile) {
3578
+ wrapper.className = "modal-wrapper modal-mobile";
3579
+ wrapper.style.maxWidth = `${Math.min(window.innerWidth - 32, 800)}px`;
3580
+ } else {
3581
+ wrapper.className = `modal-wrapper modal-${this._size}`;
3582
+ wrapper.style.maxWidth = "";
3583
+ }
3447
3584
  }
3448
3585
  _updateOpenState() {
3449
3586
  const backdrop = this._root.querySelector('[part="backdrop"]');
3450
3587
  const modal = this._root.querySelector('[part="modal"]');
3451
- const wrapper = this._root.querySelector('[part="modal-wrapper"]');
3452
3588
  if (this._open) {
3453
3589
  this._previousActive = document.activeElement;
3454
3590
  backdrop.removeAttribute("hidden");
3455
3591
  modal.removeAttribute("hidden");
3456
3592
  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
- }
3593
+ this._updateSize();
3467
3594
  this._focusFirst();
3468
3595
  } else {
3469
3596
  backdrop.setAttribute("hidden", "");
@@ -3482,6 +3609,12 @@ var UModal = class extends UElement {
3482
3609
  const focusable = this._root.querySelectorAll(
3483
3610
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
3484
3611
  );
3612
+ for (const el of focusable) {
3613
+ if (el.offsetParent !== null) {
3614
+ el.focus();
3615
+ return;
3616
+ }
3617
+ }
3485
3618
  if (focusable.length > 0) {
3486
3619
  focusable[0].focus();
3487
3620
  }
@@ -3504,7 +3637,7 @@ var UModal = class extends UElement {
3504
3637
  if (this._closeOnOverlay) this.closeModal();
3505
3638
  });
3506
3639
  window.addEventListener("resize", () => {
3507
- if (this._open) this._updateOpenState();
3640
+ if (this._open) this._updateSize();
3508
3641
  });
3509
3642
  }
3510
3643
  _trapTab(e) {
@@ -3517,8 +3650,10 @@ var UModal = class extends UElement {
3517
3650
  e.preventDefault();
3518
3651
  return;
3519
3652
  }
3520
- const first = focusable[0];
3521
- const last = focusable[focusable.length - 1];
3653
+ const visible = focusable.filter((el) => el.offsetParent !== null);
3654
+ const list = visible.length > 0 ? visible : focusable;
3655
+ const first = list[0];
3656
+ const last = list[list.length - 1];
3522
3657
  if (e.shiftKey && document.activeElement === first) {
3523
3658
  e.preventDefault();
3524
3659
  last.focus();
@@ -3589,7 +3724,7 @@ var UDrawer = class extends UElement {
3589
3724
  if (oldVal === newVal) return;
3590
3725
  switch (name) {
3591
3726
  case "open":
3592
- this._open = newVal !== null;
3727
+ this._open = parseBooleanAttribute(newVal, false);
3593
3728
  this._updateOpenState();
3594
3729
  break;
3595
3730
  case "side":
@@ -3600,10 +3735,10 @@ var UDrawer = class extends UElement {
3600
3735
  this._size = newVal ?? "300px";
3601
3736
  break;
3602
3737
  case "close-on-escape":
3603
- this._closeOnEscape = newVal !== null;
3738
+ this._closeOnEscape = parseBooleanAttribute(newVal, true);
3604
3739
  break;
3605
3740
  case "close-on-overlay":
3606
- this._closeOnOverlay = newVal !== null;
3741
+ this._closeOnOverlay = parseBooleanAttribute(newVal, true);
3607
3742
  break;
3608
3743
  }
3609
3744
  }
@@ -5640,6 +5775,167 @@ var UForm = class extends UElement {
5640
5775
  }
5641
5776
  };
5642
5777
 
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
5778
+ // src/components/badge.wc.ts
5779
+ var UBadge = class extends UElement {
5780
+ constructor() {
5781
+ super();
5782
+ this._variant = "default";
5783
+ this._size = "md";
5784
+ this._dot = false;
5785
+ this._pill = true;
5786
+ this._root.innerHTML = `<style>${badgeStyles}</style><span part="badge" class="badge badge-default badge-md badge-pill"><slot></slot></span>`;
5787
+ }
5788
+ static get observedAttributes() {
5789
+ return ["variant", "size", "dot", "pill"];
5790
+ }
5791
+ get variant() {
5792
+ return this._variant;
5793
+ }
5794
+ set variant(val) {
5795
+ this.setAttribute("variant", val);
5796
+ }
5797
+ get size() {
5798
+ return this._size;
5799
+ }
5800
+ set size(val) {
5801
+ this.setAttribute("size", val);
5802
+ }
5803
+ get dot() {
5804
+ return this._dot;
5805
+ }
5806
+ set dot(val) {
5807
+ if (val) this.setAttribute("dot", "");
5808
+ else this.removeAttribute("dot");
5809
+ }
5810
+ get pill() {
5811
+ return this._pill;
5812
+ }
5813
+ set pill(val) {
5814
+ if (!val) this.removeAttribute("pill");
5815
+ else this.setAttribute("pill", "");
5816
+ }
5817
+ connectedCallback() {
5818
+ super.connectedCallback();
5819
+ this._sync();
5820
+ }
5821
+ attributeChangedCallback(name, oldVal, newVal) {
5822
+ if (oldVal === newVal) return;
5823
+ switch (name) {
5824
+ case "variant":
5825
+ this._variant = newVal ?? "default";
5826
+ break;
5827
+ case "size":
5828
+ this._size = newVal ?? "md";
5829
+ break;
5830
+ case "dot":
5831
+ this._dot = newVal !== null;
5832
+ break;
5833
+ case "pill":
5834
+ this._pill = newVal !== null;
5835
+ break;
5836
+ }
5837
+ this._sync();
5838
+ }
5839
+ _sync() {
5840
+ const el = this._root.querySelector('[part="badge"]');
5841
+ el.className = `badge badge-${this._variant} badge-${this._size}`;
5842
+ if (this._dot) {
5843
+ el.classList.add("badge-dot");
5844
+ } else if (this._pill) {
5845
+ el.classList.add("badge-pill");
5846
+ } else {
5847
+ el.classList.add("badge-square");
5848
+ }
5849
+ }
5850
+ _mount() {
5851
+ }
5852
+ };
5853
+
5854
+ // src/components/card.wc.ts
5855
+ var UCard = class extends UElement {
5856
+ constructor() {
5857
+ super();
5858
+ this._variant = "default";
5859
+ this._padding = "md";
5860
+ this._hoverable = false;
5861
+ this._root.innerHTML = `<style>${cardStyles}</style>
5862
+ <div part="card" class="card card-default card-padding-md">
5863
+ <div part="image" class="card-image card-image-top">
5864
+ <slot name="image"></slot>
5865
+ </div>
5866
+ <div part="header">
5867
+ <slot name="header"></slot>
5868
+ </div>
5869
+ <div part="content">
5870
+ <slot></slot>
5871
+ </div>
5872
+ <div part="footer">
5873
+ <slot name="footer"></slot>
5874
+ </div>
5875
+ </div>`;
5876
+ }
5877
+ static get observedAttributes() {
5878
+ return ["variant", "padding", "hoverable"];
5879
+ }
5880
+ get variant() {
5881
+ return this._variant;
5882
+ }
5883
+ set variant(val) {
5884
+ this.setAttribute("variant", val);
5885
+ }
5886
+ get padding() {
5887
+ return this._padding;
5888
+ }
5889
+ set padding(val) {
5890
+ this.setAttribute("padding", val);
5891
+ }
5892
+ get hoverable() {
5893
+ return this._hoverable;
5894
+ }
5895
+ set hoverable(val) {
5896
+ if (val) this.setAttribute("hoverable", "");
5897
+ else this.removeAttribute("hoverable");
5898
+ }
5899
+ connectedCallback() {
5900
+ super.connectedCallback();
5901
+ this._sync();
5902
+ }
5903
+ attributeChangedCallback(name, oldVal, newVal) {
5904
+ if (oldVal === newVal) return;
5905
+ switch (name) {
5906
+ case "variant":
5907
+ this._variant = newVal ?? "default";
5908
+ break;
5909
+ case "padding":
5910
+ this._padding = newVal ?? "md";
5911
+ break;
5912
+ case "hoverable":
5913
+ this._hoverable = newVal !== null;
5914
+ break;
5915
+ }
5916
+ this._sync();
5917
+ }
5918
+ _sync() {
5919
+ const el = this._root.querySelector('[part="card"]');
5920
+ el.className = `card card-${this._variant} card-padding-${this._padding}`;
5921
+ if (this._hoverable) el.classList.add("card-hoverable");
5922
+ const imageSlot = this._root.querySelector('slot[name="image"]');
5923
+ if (imageSlot) {
5924
+ const assigned = imageSlot.assignedNodes({ flatten: true });
5925
+ const imageEl = assigned.length > 0 ? imageSlot.parentElement : null;
5926
+ if (imageEl) {
5927
+ imageEl.classList.toggle("card-image-top", assigned.length > 0);
5928
+ }
5929
+ }
5930
+ }
5931
+ _mount() {
5932
+ const imageSlot = this._root.querySelector('slot[name="image"]');
5933
+ if (imageSlot) {
5934
+ imageSlot.addEventListener("slotchange", () => this._sync());
5935
+ }
5936
+ }
5937
+ };
5938
+
5939
+ 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 };
5940
+ //# sourceMappingURL=chunk-RQZ7KDYP.js.map
5941
+ //# sourceMappingURL=chunk-RQZ7KDYP.js.map