@vertz/ui-primitives 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/shared/{chunk-bew4bjgf.js → chunk-07yzsaaw.js} +5 -5
  2. package/dist/shared/{chunk-yr9yzpvq.js → chunk-279bzynx.js} +83 -58
  3. package/dist/shared/{chunk-sqs8kyb2.js → chunk-27xs9apd.js} +5 -5
  4. package/dist/shared/{chunk-dpsgb1xw.js → chunk-2db2dnp3.js} +6 -2
  5. package/dist/shared/{chunk-8ak7vdk1.js → chunk-2k8gxzdf.js} +5 -5
  6. package/dist/shared/{chunk-t1vkvsz2.js → chunk-3rp73gkd.js} +5 -5
  7. package/dist/shared/{chunk-7ffg0caj.js → chunk-4rf1m34c.js} +8 -6
  8. package/dist/shared/{chunk-gkddsbmh.js → chunk-56reyd5r.js} +22 -31
  9. package/dist/shared/{chunk-jctqs9m4.js → chunk-7867pr13.js} +36 -12
  10. package/dist/shared/{chunk-n9nwx58j.js → chunk-7bxsf80c.js} +4 -4
  11. package/dist/shared/{chunk-7krvqrwq.js → chunk-8qtexw5s.js} +36 -14
  12. package/dist/shared/{chunk-m1ptgp1s.js → chunk-9ezgd78r.js} +7 -7
  13. package/dist/shared/{chunk-kg27s15c.js → chunk-ajpj10z0.js} +5 -5
  14. package/dist/shared/{chunk-tfyg0qrp.js → chunk-c46v0fsw.js} +6 -6
  15. package/dist/shared/{chunk-96d9nr7y.js → chunk-dhyr0s9n.js} +1 -1
  16. package/dist/shared/{chunk-avxcmmk6.js → chunk-e4mm5e59.js} +7 -7
  17. package/dist/shared/{chunk-gt0wth9h.js → chunk-fqa5bwn1.js} +3 -3
  18. package/dist/shared/{chunk-x0we8gcy.js → chunk-g8hnc95b.js} +5 -5
  19. package/dist/shared/chunk-j2tdpxgc.js +185 -0
  20. package/dist/shared/{chunk-x2hz98qn.js → chunk-jda3v59q.js} +2 -2
  21. package/dist/shared/{chunk-18y8gfk0.js → chunk-k8nabsxm.js} +115 -93
  22. package/dist/shared/{chunk-j4cm8avr.js → chunk-kcnq15je.js} +5 -5
  23. package/dist/shared/{chunk-4da5zksy.js → chunk-mqs4qq0b.js} +2 -2
  24. package/dist/shared/{chunk-9hj9p7s2.js → chunk-myq79qew.js} +37 -31
  25. package/dist/shared/{chunk-ppcv3ehd.js → chunk-pg2yjn8f.js} +15 -12
  26. package/dist/shared/{chunk-hr9hx58m.js → chunk-rb53v045.js} +4 -4
  27. package/dist/shared/{chunk-ttsyf6ma.js → chunk-s6a2yph8.js} +5 -5
  28. package/dist/shared/{chunk-vvjyx7fe.js → chunk-vevfhpc9.js} +1 -1
  29. package/dist/shared/{chunk-4085nbdq.js → chunk-vhx3sqw6.js} +5 -5
  30. package/dist/shared/{chunk-34yfm2b0.js → chunk-w318par6.js} +106 -84
  31. package/dist/shared/chunk-w9dag6ce.js +237 -0
  32. package/dist/shared/{chunk-g9qvd20g.js → chunk-wcdq7bew.js} +3 -3
  33. package/dist/shared/{chunk-rnjm61t0.js → chunk-z0gwkzgp.js} +3 -3
  34. package/dist/shared/{chunk-jz0s6srh.js → chunk-z850et33.js} +1 -1
  35. package/dist/shared/{chunk-7kpsyjd7.js → chunk-zyfc6cx3.js} +4 -4
  36. package/dist/src/accordion/accordion.d.ts +2 -0
  37. package/dist/src/accordion/accordion.js +1 -5
  38. package/dist/src/alert-dialog/alert-dialog.d.ts +7 -7
  39. package/dist/src/alert-dialog/alert-dialog.js +1 -4
  40. package/dist/src/badge/badge.d.ts +2 -0
  41. package/dist/src/badge/badge.js +1 -3
  42. package/dist/src/button/button.d.ts +2 -0
  43. package/dist/src/button/button.js +1 -3
  44. package/dist/src/calendar/calendar.d.ts +9 -6
  45. package/dist/src/calendar/calendar.js +1 -2
  46. package/dist/src/carousel/carousel.d.ts +2 -0
  47. package/dist/src/carousel/carousel.js +1 -4
  48. package/dist/src/checkbox/checkbox.d.ts +2 -0
  49. package/dist/src/checkbox/checkbox.js +1 -4
  50. package/dist/src/collapsible/collapsible.d.ts +2 -0
  51. package/dist/src/collapsible/collapsible.js +1 -4
  52. package/dist/src/combobox/combobox.d.ts +2 -0
  53. package/dist/src/combobox/combobox.js +1 -5
  54. package/dist/src/command/command.d.ts +2 -0
  55. package/dist/src/command/command.js +1 -5
  56. package/dist/src/context-menu/context-menu.d.ts +2 -0
  57. package/dist/src/context-menu/context-menu.js +1 -7
  58. package/dist/src/date-picker/date-picker.d.ts +6 -6
  59. package/dist/src/date-picker/date-picker.js +1 -10
  60. package/dist/src/dialog/dialog.d.ts +3 -0
  61. package/dist/src/dialog/dialog.js +1 -6
  62. package/dist/src/dropdown-menu/dropdown-menu.d.ts +3 -0
  63. package/dist/src/dropdown-menu/dropdown-menu.js +1 -8
  64. package/dist/src/hover-card/hover-card.d.ts +2 -0
  65. package/dist/src/hover-card/hover-card.js +1 -6
  66. package/dist/src/index.d.ts +906 -34
  67. package/dist/src/index.js +5183 -39
  68. package/dist/src/menu/menu.d.ts +3 -0
  69. package/dist/src/menu/menu.js +1 -7
  70. package/dist/src/menubar/menubar.d.ts +2 -0
  71. package/dist/src/menubar/menubar.js +1 -8
  72. package/dist/src/navigation-menu/navigation-menu.d.ts +7 -5
  73. package/dist/src/navigation-menu/navigation-menu.js +1 -6
  74. package/dist/src/popover/popover.d.ts +2 -0
  75. package/dist/src/popover/popover.js +1 -8
  76. package/dist/src/progress/progress.d.ts +4 -2
  77. package/dist/src/progress/progress.js +1 -4
  78. package/dist/src/radio/radio.d.ts +9 -3
  79. package/dist/src/radio/radio.js +1 -6
  80. package/dist/src/resizable-panel/resizable-panel.d.ts +2 -0
  81. package/dist/src/resizable-panel/resizable-panel.js +1 -4
  82. package/dist/src/scroll-area/scroll-area.d.ts +2 -0
  83. package/dist/src/scroll-area/scroll-area.js +1 -2
  84. package/dist/src/select/select.d.ts +2 -0
  85. package/dist/src/select/select.js +1 -7
  86. package/dist/src/sheet/sheet.js +1 -5
  87. package/dist/src/slider/slider.d.ts +2 -0
  88. package/dist/src/slider/slider.js +1 -5
  89. package/dist/src/switch/switch.d.ts +2 -0
  90. package/dist/src/switch/switch.js +1 -4
  91. package/dist/src/tabs/tabs.d.ts +7 -4
  92. package/dist/src/tabs/tabs.js +1 -6
  93. package/dist/src/toast/toast.d.ts +2 -0
  94. package/dist/src/toast/toast.js +1 -4
  95. package/dist/src/toggle/toggle.d.ts +2 -0
  96. package/dist/src/toggle/toggle.js +1 -4
  97. package/dist/src/toggle-group/toggle-group.d.ts +2 -0
  98. package/dist/src/toggle-group/toggle-group.js +1 -5
  99. package/dist/src/tooltip/tooltip.d.ts +3 -1
  100. package/dist/src/tooltip/tooltip.js +1 -6
  101. package/dist/src/utils.d.ts +62 -2
  102. package/dist/src/utils.js +50 -3
  103. package/package.json +4 -6
  104. package/dist/shared/chunk-8nk0ya7a.js +0 -163
  105. package/dist/shared/chunk-8tvzqry6.js +0 -218
@@ -4,19 +4,19 @@ import {
4
4
  import {
5
5
  Keys,
6
6
  isKey
7
- } from "./chunk-jctqs9m4.js";
7
+ } from "./chunk-7867pr13.js";
8
8
  import {
9
9
  setDataState,
10
10
  setExpanded,
11
11
  setHidden,
12
12
  setHiddenAnimated
13
- } from "./chunk-vvjyx7fe.js";
14
- import {
15
- applyAttrs
16
- } from "./chunk-dpsgb1xw.js";
13
+ } from "./chunk-vevfhpc9.js";
17
14
  import {
18
15
  uniqueId
19
16
  } from "./chunk-8y1jf6xr.js";
17
+ import {
18
+ applyAttrs
19
+ } from "./chunk-2db2dnp3.js";
20
20
 
21
21
  // src/hover-card/hover-card.tsx
22
22
  import { __element, __on } from "@vertz/ui/internals";
@@ -3,40 +3,24 @@ import {
3
3
  } from "./chunk-e2v1c9ex.js";
4
4
  import {
5
5
  handleListNavigation
6
- } from "./chunk-jctqs9m4.js";
6
+ } from "./chunk-7867pr13.js";
7
7
  import {
8
8
  setChecked,
9
- setDataState
10
- } from "./chunk-vvjyx7fe.js";
11
- import {
12
- applyAttrs
13
- } from "./chunk-dpsgb1xw.js";
9
+ setDataState,
10
+ setDisabled
11
+ } from "./chunk-vevfhpc9.js";
14
12
  import {
15
13
  uniqueId
16
14
  } from "./chunk-8y1jf6xr.js";
15
+ import {
16
+ applyAttrs
17
+ } from "./chunk-2db2dnp3.js";
17
18
 
18
19
  // src/radio/radio.tsx
19
20
  import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
20
21
  import { signal } from "@vertz/ui";
21
- function RadioRoot(options = {}) {
22
- const { defaultValue = "", onValueChange, ...attrs } = options;
23
- const state = { value: signal(defaultValue) };
24
- const items = [];
25
- const itemValues = [];
26
- function selectItem(value) {
27
- state.value.value = value;
28
- for (let i = 0;i < items.length; i++) {
29
- const item = items[i];
30
- if (!item)
31
- continue;
32
- const isActive = itemValues[i] === value;
33
- setChecked(item, isActive);
34
- setDataState(item, isActive ? "checked" : "unchecked");
35
- }
36
- setRovingTabindex(items, itemValues.indexOf(value));
37
- onValueChange?.(value);
38
- }
39
- const root = (() => {
22
+ function RadioGroup(items, itemValues, selectItem) {
23
+ return (() => {
40
24
  const __el0 = __element("div");
41
25
  __el0.setAttribute("role", "radiogroup");
42
26
  {
@@ -57,48 +41,89 @@ function RadioRoot(options = {}) {
57
41
  });
58
42
  return __el0;
59
43
  })();
60
- function Item(value, label) {
61
- const isActive = value === state.value.peek();
62
- const item = (() => {
63
- const __el1 = __element("div");
64
- __el1.setAttribute("role", "radio");
65
- {
66
- const __v = uniqueId("radio");
67
- if (__v != null && __v !== false)
68
- __el1.setAttribute("id", __v === true ? "" : __v);
69
- }
70
- {
71
- const __v = value;
72
- if (__v != null && __v !== false)
73
- __el1.setAttribute("data-value", __v === true ? "" : __v);
74
- }
75
- {
76
- const __v = isActive ? "true" : "false";
77
- if (__v != null && __v !== false)
78
- __el1.setAttribute("aria-checked", __v === true ? "" : __v);
79
- }
80
- {
81
- const __v = isActive ? "checked" : "unchecked";
82
- if (__v != null && __v !== false)
83
- __el1.setAttribute("data-state", __v === true ? "" : __v);
84
- }
85
- __on(__el1, "click", () => {
44
+ }
45
+ function RadioItem(value, label, isActive, disabled, selectItem) {
46
+ const el = (() => {
47
+ const __el0 = __element("div");
48
+ __el0.setAttribute("role", "radio");
49
+ {
50
+ const __v = uniqueId("radio");
51
+ if (__v != null && __v !== false)
52
+ __el0.setAttribute("id", __v === true ? "" : __v);
53
+ }
54
+ {
55
+ const __v = value;
56
+ if (__v != null && __v !== false)
57
+ __el0.setAttribute("data-value", __v === true ? "" : __v);
58
+ }
59
+ {
60
+ const __v = isActive ? "true" : "false";
61
+ if (__v != null && __v !== false)
62
+ __el0.setAttribute("aria-checked", __v === true ? "" : __v);
63
+ }
64
+ {
65
+ const __v = isActive ? "checked" : "unchecked";
66
+ if (__v != null && __v !== false)
67
+ __el0.setAttribute("data-state", __v === true ? "" : __v);
68
+ }
69
+ __on(__el0, "click", () => {
70
+ if (!disabled)
86
71
  selectItem(value);
72
+ });
73
+ __enterChildren(__el0);
74
+ __insert(__el0, label ?? value);
75
+ __exitChildren();
76
+ return __el0;
77
+ })();
78
+ if (disabled) {
79
+ setDisabled(el, true);
80
+ el.setAttribute("data-disabled", "");
81
+ }
82
+ return el;
83
+ }
84
+ function RadioRoot(options = {}) {
85
+ const { defaultValue = "", onValueChange, ...attrs } = options;
86
+ const state = { value: signal(defaultValue) };
87
+ const items = [];
88
+ const itemValues = [];
89
+ function selectItem(value) {
90
+ state.value.value = value;
91
+ for (let i = 0;i < items.length; i++) {
92
+ const item = items[i];
93
+ if (!item)
94
+ continue;
95
+ const isActive = itemValues[i] === value;
96
+ setChecked(item, isActive);
97
+ setDataState(item, isActive ? "checked" : "unchecked");
98
+ }
99
+ setRovingTabindex(items, itemValues.indexOf(value));
100
+ onValueChange?.(value);
101
+ }
102
+ const root = RadioGroup(items, itemValues, selectItem);
103
+ const cleanups = [];
104
+ function Item(value, label, itemOptions) {
105
+ const isActive = value === state.value.peek();
106
+ const disabled = itemOptions?.disabled ?? false;
107
+ const item = RadioItem(value, label, isActive, disabled, selectItem);
108
+ const handleClick = () => {
109
+ if (!disabled)
87
110
  item.focus();
88
- });
89
- __enterChildren(__el1);
90
- __insert(__el1, label ?? value);
91
- __exitChildren();
92
- return __el1;
93
- })();
111
+ };
112
+ item.addEventListener("click", handleClick);
113
+ cleanups.push(() => item.removeEventListener("click", handleClick));
94
114
  items.push(item);
95
115
  itemValues.push(value);
96
116
  root.appendChild(item);
97
117
  setRovingTabindex(items, itemValues.indexOf(state.value.peek()));
98
118
  return item;
99
119
  }
120
+ function destroy() {
121
+ for (const cleanup of cleanups)
122
+ cleanup();
123
+ cleanups.length = 0;
124
+ }
100
125
  applyAttrs(root, attrs);
101
- return { root, state, Item };
126
+ return { root, state, Item, destroy };
102
127
  }
103
128
  var Radio = {
104
129
  Root: RadioRoot
@@ -11,19 +11,19 @@ import {
11
11
  Keys,
12
12
  handleListNavigation,
13
13
  isKey
14
- } from "./chunk-jctqs9m4.js";
14
+ } from "./chunk-7867pr13.js";
15
15
  import {
16
16
  setDataState,
17
17
  setExpanded,
18
18
  setHidden,
19
19
  setHiddenAnimated
20
- } from "./chunk-vvjyx7fe.js";
21
- import {
22
- applyAttrs
23
- } from "./chunk-dpsgb1xw.js";
20
+ } from "./chunk-vevfhpc9.js";
24
21
  import {
25
22
  linkedIds
26
23
  } from "./chunk-8y1jf6xr.js";
24
+ import {
25
+ applyAttrs
26
+ } from "./chunk-2db2dnp3.js";
27
27
 
28
28
  // src/menubar/menubar.tsx
29
29
  import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
@@ -1,11 +1,15 @@
1
1
  // src/utils/attrs.ts
2
2
  function applyAttrs(el, attrs) {
3
+ const resolvedClass = attrs.className ?? attrs.class;
3
4
  for (const [key, value] of Object.entries(attrs)) {
4
5
  if (value == null)
5
6
  continue;
6
- if (key === "class") {
7
+ if (key === "className" || key === "class") {
8
+ if (key === "class" && attrs.className != null)
9
+ continue;
7
10
  const existing = el.getAttribute("class");
8
- el.setAttribute("class", existing ? `${existing} ${String(value)}` : String(value));
11
+ const classValue = String(resolvedClass);
12
+ el.setAttribute("class", existing ? `${existing} ${classValue}` : classValue);
9
13
  } else if (key === "style") {
10
14
  const existing = el.getAttribute("style");
11
15
  el.setAttribute("style", existing ? `${existing}; ${String(value)}` : String(value));
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  Keys,
3
3
  isKey
4
- } from "./chunk-jctqs9m4.js";
4
+ } from "./chunk-7867pr13.js";
5
5
  import {
6
6
  setDataState,
7
7
  setValueRange
8
- } from "./chunk-vvjyx7fe.js";
9
- import {
10
- applyAttrs
11
- } from "./chunk-dpsgb1xw.js";
8
+ } from "./chunk-vevfhpc9.js";
12
9
  import {
13
10
  uniqueId
14
11
  } from "./chunk-8y1jf6xr.js";
12
+ import {
13
+ applyAttrs
14
+ } from "./chunk-2db2dnp3.js";
15
15
 
16
16
  // src/slider/slider.tsx
17
17
  import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
@@ -6,19 +6,19 @@ import {
6
6
  import {
7
7
  Keys,
8
8
  isKey
9
- } from "./chunk-jctqs9m4.js";
9
+ } from "./chunk-7867pr13.js";
10
10
  import {
11
11
  setDataState,
12
12
  setExpanded,
13
13
  setHidden,
14
14
  setHiddenAnimated
15
- } from "./chunk-vvjyx7fe.js";
15
+ } from "./chunk-vevfhpc9.js";
16
16
  import {
17
17
  linkedIds
18
18
  } from "./chunk-8y1jf6xr.js";
19
19
 
20
20
  // src/sheet/sheet.tsx
21
- import { __element, __on } from "@vertz/ui/internals";
21
+ import { __element, __on, __styleStr } from "@vertz/ui/internals";
22
22
  import { signal } from "@vertz/ui";
23
23
  function SheetRoot(options = {}) {
24
24
  const { side = "right", defaultOpen = false, onOpenChange } = options;
@@ -114,7 +114,7 @@ function SheetRoot(options = {}) {
114
114
  {
115
115
  const __v = defaultOpen ? "" : "display: none";
116
116
  if (__v != null && __v !== false)
117
- __el1.setAttribute("style", __v === true ? "" : __v);
117
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
118
118
  }
119
119
  __on(__el1, "click", () => hide());
120
120
  return __el1;
@@ -146,7 +146,7 @@ function SheetRoot(options = {}) {
146
146
  {
147
147
  const __v = defaultOpen ? "" : "display: none";
148
148
  if (__v != null && __v !== false)
149
- __el2.setAttribute("style", __v === true ? "" : __v);
149
+ __el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
150
150
  }
151
151
  __on(__el2, "keydown", (event) => {
152
152
  if (isKey(event, Keys.Escape)) {
@@ -8,25 +8,25 @@ import {
8
8
  Keys,
9
9
  handleListNavigation,
10
10
  isKey
11
- } from "./chunk-jctqs9m4.js";
11
+ } from "./chunk-7867pr13.js";
12
12
  import {
13
13
  setDataState,
14
14
  setExpanded,
15
15
  setHidden,
16
16
  setHiddenAnimated
17
- } from "./chunk-vvjyx7fe.js";
18
- import {
19
- applyAttrs
20
- } from "./chunk-dpsgb1xw.js";
17
+ } from "./chunk-vevfhpc9.js";
21
18
  import {
22
19
  linkedIds
23
20
  } from "./chunk-8y1jf6xr.js";
21
+ import {
22
+ applyAttrs
23
+ } from "./chunk-2db2dnp3.js";
24
24
 
25
25
  // src/menu/menu.tsx
26
26
  import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
27
27
  import { signal } from "@vertz/ui";
28
28
  function MenuRoot(options = {}) {
29
- const { onSelect, positioning, ...attrs } = options;
29
+ const { onSelect, onOpenChange, positioning, ...attrs } = options;
30
30
  const ids = linkedIds("menu");
31
31
  const state = {
32
32
  open: signal(false),
@@ -47,6 +47,7 @@ function MenuRoot(options = {}) {
47
47
  setHidden(content, false);
48
48
  setDataState(trigger, "open");
49
49
  setDataState(content, "open");
50
+ onOpenChange?.(true);
50
51
  if (positioning) {
51
52
  const ref = positioning.referenceElement ?? trigger;
52
53
  const result = createFloatingPosition(ref, content, positioning);
@@ -75,6 +76,7 @@ function MenuRoot(options = {}) {
75
76
  setDataState(trigger, "closed");
76
77
  setDataState(content, "closed");
77
78
  setHiddenAnimated(content, true);
79
+ onOpenChange?.(false);
78
80
  if (positioning) {
79
81
  floatingCleanup?.();
80
82
  floatingCleanup = null;
@@ -1,48 +1,39 @@
1
1
  import {
2
2
  setDataState
3
- } from "./chunk-vvjyx7fe.js";
4
- import {
5
- applyAttrs
6
- } from "./chunk-dpsgb1xw.js";
3
+ } from "./chunk-vevfhpc9.js";
7
4
  import {
8
5
  uniqueId
9
6
  } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ applyAttrs
9
+ } from "./chunk-2db2dnp3.js";
10
10
 
11
11
  // src/toast/toast.tsx
12
- import { __element, __enterChildren, __exitChildren, __insert } from "@vertz/ui/internals";
13
12
  import { signal } from "@vertz/ui";
13
+ function createRegionElement(politeness) {
14
+ const el = document.createElement("div");
15
+ el.setAttribute("role", "status");
16
+ el.setAttribute("aria-live", politeness);
17
+ el.setAttribute("aria-atomic", "false");
18
+ el.setAttribute("data-state", "empty");
19
+ return el;
20
+ }
21
+ function createMessageElement(id, content) {
22
+ const el = document.createElement("div");
23
+ el.setAttribute("role", "status");
24
+ el.setAttribute("data-toast-id", id);
25
+ el.setAttribute("data-state", "open");
26
+ el.textContent = content;
27
+ return el;
28
+ }
14
29
  function ToastRoot(options = {}) {
15
30
  const { duration = 5000, politeness = "polite", ...attrs } = options;
16
31
  const state = { messages: signal([]) };
17
- const region = (() => {
18
- const __el0 = __element("div");
19
- __el0.setAttribute("role", "status");
20
- {
21
- const __v = politeness;
22
- if (__v != null && __v !== false)
23
- __el0.setAttribute("aria-live", __v === true ? "" : __v);
24
- }
25
- __el0.setAttribute("aria-atomic", "false");
26
- __el0.setAttribute("data-state", "empty");
27
- return __el0;
28
- })();
32
+ const region = createRegionElement(politeness);
29
33
  applyAttrs(region, attrs);
30
34
  function announce(content) {
31
35
  const id = uniqueId("toast");
32
- const el = (() => {
33
- const __el1 = __element("div");
34
- __el1.setAttribute("role", "status");
35
- {
36
- const __v = id;
37
- if (__v != null && __v !== false)
38
- __el1.setAttribute("data-toast-id", __v === true ? "" : __v);
39
- }
40
- __el1.setAttribute("data-state", "open");
41
- __enterChildren(__el1);
42
- __insert(__el1, content);
43
- __exitChildren();
44
- return __el1;
45
- })();
36
+ const el = createMessageElement(id, content);
46
37
  const msg = { id, content, el };
47
38
  state.messages.value = [...state.messages.peek(), msg];
48
39
  region.appendChild(el);
@@ -24,24 +24,16 @@ function handleListNavigation(event, items, options = {}) {
24
24
  let nextIndex = -1;
25
25
  if (isKey(event, prevKey)) {
26
26
  event.preventDefault();
27
- if (currentIndex <= 0) {
28
- nextIndex = loop ? items.length - 1 : 0;
29
- } else {
30
- nextIndex = currentIndex - 1;
31
- }
27
+ nextIndex = findEnabled(items, currentIndex, -1, loop);
32
28
  } else if (isKey(event, nextKey)) {
33
29
  event.preventDefault();
34
- if (currentIndex >= items.length - 1) {
35
- nextIndex = loop ? 0 : items.length - 1;
36
- } else {
37
- nextIndex = currentIndex + 1;
38
- }
30
+ nextIndex = findEnabled(items, currentIndex, 1, loop);
39
31
  } else if (isKey(event, Keys.Home)) {
40
32
  event.preventDefault();
41
- nextIndex = 0;
33
+ nextIndex = findEnabledFrom(items, 0, 1);
42
34
  } else if (isKey(event, Keys.End)) {
43
35
  event.preventDefault();
44
- nextIndex = items.length - 1;
36
+ nextIndex = findEnabledFrom(items, items.length - 1, -1);
45
37
  }
46
38
  const target = items[nextIndex];
47
39
  if (target) {
@@ -50,6 +42,38 @@ function handleListNavigation(event, items, options = {}) {
50
42
  }
51
43
  return null;
52
44
  }
45
+ function isDisabled(el) {
46
+ return el.getAttribute("aria-disabled") === "true";
47
+ }
48
+ function findEnabled(items, current, direction, loop) {
49
+ const len = items.length;
50
+ let candidate = current;
51
+ for (let i = 0;i < len; i++) {
52
+ candidate += direction;
53
+ if (loop) {
54
+ candidate = (candidate % len + len) % len;
55
+ } else if (candidate < 0 || candidate >= len) {
56
+ return -1;
57
+ }
58
+ const el = items[candidate];
59
+ if (el && !isDisabled(el))
60
+ return candidate;
61
+ }
62
+ return -1;
63
+ }
64
+ function findEnabledFrom(items, start, direction) {
65
+ const len = items.length;
66
+ let candidate = start;
67
+ for (let i = 0;i < len; i++) {
68
+ if (candidate < 0 || candidate >= len)
69
+ return -1;
70
+ const el = items[candidate];
71
+ if (el && !isDisabled(el))
72
+ return candidate;
73
+ candidate += direction;
74
+ }
75
+ return -1;
76
+ }
53
77
  function handleActivation(event, handler) {
54
78
  if (isKey(event, Keys.Enter, Keys.Space)) {
55
79
  event.preventDefault();
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Keys,
3
3
  isKey
4
- } from "./chunk-jctqs9m4.js";
5
- import {
6
- applyAttrs
7
- } from "./chunk-dpsgb1xw.js";
4
+ } from "./chunk-7867pr13.js";
8
5
  import {
9
6
  uniqueId
10
7
  } from "./chunk-8y1jf6xr.js";
8
+ import {
9
+ applyAttrs
10
+ } from "./chunk-2db2dnp3.js";
11
11
 
12
12
  // src/toggle/toggle.tsx
13
13
  import { computed, signal } from "@vertz/ui";
@@ -6,28 +6,30 @@ import {
6
6
  import {
7
7
  Keys,
8
8
  isKey
9
- } from "./chunk-jctqs9m4.js";
9
+ } from "./chunk-7867pr13.js";
10
10
  import {
11
11
  setDataState,
12
+ setDescribedBy,
12
13
  setExpanded,
13
14
  setHidden,
14
15
  setHiddenAnimated,
15
16
  setLabelledBy
16
- } from "./chunk-vvjyx7fe.js";
17
- import {
18
- applyAttrs
19
- } from "./chunk-dpsgb1xw.js";
17
+ } from "./chunk-vevfhpc9.js";
20
18
  import {
21
19
  linkedIds
22
20
  } from "./chunk-8y1jf6xr.js";
21
+ import {
22
+ applyAttrs
23
+ } from "./chunk-2db2dnp3.js";
23
24
 
24
25
  // src/dialog/dialog.tsx
25
- import { __element, __on } from "@vertz/ui/internals";
26
+ import { __element, __on, __styleStr } from "@vertz/ui/internals";
26
27
  import { signal } from "@vertz/ui";
27
28
  function DialogRoot(options = {}) {
28
29
  const { modal = true, defaultOpen = false, onOpenChange, ...attrs } = options;
29
30
  const ids = linkedIds("dialog");
30
31
  const titleId = `${ids.contentId}-title`;
32
+ const descriptionId = `${ids.contentId}-description`;
31
33
  const state = { open: signal(defaultOpen) };
32
34
  let restoreFocus = null;
33
35
  let removeTrap = null;
@@ -108,7 +110,7 @@ function DialogRoot(options = {}) {
108
110
  {
109
111
  const __v = defaultOpen ? "" : "display: none";
110
112
  if (__v != null && __v !== false)
111
- __el1.setAttribute("style", __v === true ? "" : __v);
113
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
112
114
  }
113
115
  __on(__el1, "click", () => closeDialog());
114
116
  return __el1;
@@ -139,7 +141,7 @@ function DialogRoot(options = {}) {
139
141
  {
140
142
  const __v = defaultOpen ? "" : "display: none";
141
143
  if (__v != null && __v !== false)
142
- __el2.setAttribute("style", __v === true ? "" : __v);
144
+ __el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
143
145
  }
144
146
  __on(__el2, "keydown", (event) => {
145
147
  if (isKey(event, Keys.Escape)) {
@@ -151,6 +153,7 @@ function DialogRoot(options = {}) {
151
153
  return __el2;
152
154
  })();
153
155
  setLabelledBy(content, titleId);
156
+ setDescribedBy(content, descriptionId);
154
157
  const title = (() => {
155
158
  const __el3 = __element("h2");
156
159
  {
@@ -160,15 +163,34 @@ function DialogRoot(options = {}) {
160
163
  }
161
164
  return __el3;
162
165
  })();
163
- const close = (() => {
164
- const __el4 = __element("button");
165
- __el4.setAttribute("type", "button");
166
- __el4.setAttribute("aria-label", "Close");
167
- __on(__el4, "click", () => closeDialog());
166
+ const description = (() => {
167
+ const __el4 = __element("p");
168
+ {
169
+ const __v = descriptionId;
170
+ if (__v != null && __v !== false)
171
+ __el4.setAttribute("id", __v === true ? "" : __v);
172
+ }
168
173
  return __el4;
169
174
  })();
175
+ const close = (() => {
176
+ const __el5 = __element("button");
177
+ __el5.setAttribute("type", "button");
178
+ __el5.setAttribute("aria-label", "Close");
179
+ __on(__el5, "click", () => closeDialog());
180
+ return __el5;
181
+ })();
170
182
  applyAttrs(content, attrs);
171
- return { trigger, overlay, content, title, close, state, show: openDialog, hide: closeDialog };
183
+ return {
184
+ trigger,
185
+ overlay,
186
+ content,
187
+ title,
188
+ description,
189
+ close,
190
+ state,
191
+ show: openDialog,
192
+ hide: closeDialog
193
+ };
172
194
  }
173
195
  var Dialog = {
174
196
  Root: DialogRoot
@@ -11,22 +11,22 @@ import {
11
11
  import {
12
12
  Keys,
13
13
  isKey
14
- } from "./chunk-jctqs9m4.js";
14
+ } from "./chunk-7867pr13.js";
15
15
  import {
16
16
  setDataState,
17
17
  setExpanded,
18
18
  setHidden,
19
19
  setHiddenAnimated
20
- } from "./chunk-vvjyx7fe.js";
21
- import {
22
- applyAttrs
23
- } from "./chunk-dpsgb1xw.js";
20
+ } from "./chunk-vevfhpc9.js";
24
21
  import {
25
22
  linkedIds
26
23
  } from "./chunk-8y1jf6xr.js";
24
+ import {
25
+ applyAttrs
26
+ } from "./chunk-2db2dnp3.js";
27
27
 
28
28
  // src/popover/popover.tsx
29
- import { __element, __on } from "@vertz/ui/internals";
29
+ import { __element, __on, __styleStr } from "@vertz/ui/internals";
30
30
  import { signal } from "@vertz/ui";
31
31
  function PopoverRoot(options = {}) {
32
32
  const { defaultOpen = false, onOpenChange, positioning, ...attrs } = options;
@@ -122,7 +122,7 @@ function PopoverRoot(options = {}) {
122
122
  {
123
123
  const __v = defaultOpen ? "" : "display: none";
124
124
  if (__v != null && __v !== false)
125
- __el1.setAttribute("style", __v === true ? "" : __v);
125
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
126
126
  }
127
127
  __on(__el1, "keydown", (event) => {
128
128
  if (isKey(event, Keys.Escape)) {
@@ -8,20 +8,20 @@ import {
8
8
  Keys,
9
9
  handleListNavigation,
10
10
  isKey
11
- } from "./chunk-jctqs9m4.js";
11
+ } from "./chunk-7867pr13.js";
12
12
  import {
13
13
  setDataState,
14
14
  setExpanded,
15
15
  setHidden,
16
16
  setHiddenAnimated,
17
17
  setSelected
18
- } from "./chunk-vvjyx7fe.js";
19
- import {
20
- applyAttrs
21
- } from "./chunk-dpsgb1xw.js";
18
+ } from "./chunk-vevfhpc9.js";
22
19
  import {
23
20
  linkedIds
24
21
  } from "./chunk-8y1jf6xr.js";
22
+ import {
23
+ applyAttrs
24
+ } from "./chunk-2db2dnp3.js";
25
25
 
26
26
  // src/select/select.tsx
27
27
  import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";