@vertz/ui-primitives 0.2.41 → 0.2.43

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 (232) hide show
  1. package/dist/shared/chunk-06m8prfg.js +52 -0
  2. package/dist/shared/chunk-0n9jj8xr.js +24 -0
  3. package/dist/shared/chunk-1ben27xq.js +317 -0
  4. package/dist/shared/chunk-1j2mj0sa.js +45 -0
  5. package/dist/shared/chunk-250hj18f.js +243 -0
  6. package/dist/shared/chunk-2h4m9c71.js +38 -0
  7. package/dist/shared/chunk-2sbx20hv.js +128 -0
  8. package/dist/shared/chunk-2ye674gr.js +70 -0
  9. package/dist/shared/chunk-34d8385y.js +15 -0
  10. package/dist/shared/chunk-4d7bm8h0.js +113 -0
  11. package/dist/shared/chunk-4zjgxr7x.js +157 -0
  12. package/dist/shared/chunk-5c150wvr.js +140 -0
  13. package/dist/shared/chunk-5gycdypd.js +58 -0
  14. package/dist/shared/chunk-6mm7fhp8.js +105 -0
  15. package/dist/shared/chunk-6zmnqvh6.js +109 -0
  16. package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
  17. package/dist/shared/chunk-7pbff2hg.js +118 -0
  18. package/dist/shared/chunk-7zpjshwz.js +194 -0
  19. package/dist/shared/chunk-993ff51d.js +155 -0
  20. package/dist/shared/chunk-9pdt5aw7.js +24 -0
  21. package/dist/shared/chunk-a71m4xkv.js +106 -0
  22. package/dist/shared/chunk-aj8m39pk.js +127 -0
  23. package/dist/shared/chunk-ajawpc05.js +305 -0
  24. package/dist/shared/chunk-b7mzwqhj.js +125 -0
  25. package/dist/shared/chunk-bb887de4.js +200 -0
  26. package/dist/shared/chunk-bfsmbrxc.js +111 -0
  27. package/dist/shared/chunk-c2f63m5n.js +56 -0
  28. package/dist/shared/chunk-c5r3s5km.js +263 -0
  29. package/dist/shared/chunk-caba5bhd.js +427 -0
  30. package/dist/shared/chunk-crym07yc.js +264 -0
  31. package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
  32. package/dist/shared/chunk-d6rtejz3.js +128 -0
  33. package/dist/shared/chunk-dvaf0bmq.js +140 -0
  34. package/dist/shared/chunk-dwkv9ya6.js +22 -0
  35. package/dist/shared/chunk-e0ckxrjg.js +41 -0
  36. package/dist/shared/chunk-ennxcymj.js +225 -0
  37. package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
  38. package/dist/shared/chunk-f0v1gs5e.js +52 -0
  39. package/dist/shared/chunk-f86rsf84.js +231 -0
  40. package/dist/shared/{chunk-3sahbk4d.js → chunk-fdse46x5.js} +6 -1
  41. package/dist/shared/chunk-gj4hrssn.js +135 -0
  42. package/dist/shared/chunk-gyvq4gk9.js +24 -0
  43. package/dist/shared/chunk-hbnps9sq.js +229 -0
  44. package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
  45. package/dist/shared/chunk-hgnkd4he.js +256 -0
  46. package/dist/shared/chunk-hpcyffm7.js +185 -0
  47. package/dist/shared/chunk-hpmvwx0h.js +99 -0
  48. package/dist/shared/chunk-hz0e504p.js +69 -0
  49. package/dist/shared/chunk-hzk4wfq9.js +43 -0
  50. package/dist/shared/chunk-j7znzkpa.js +48 -0
  51. package/dist/shared/chunk-j9kxgrnn.js +167 -0
  52. package/dist/shared/chunk-jetwnv0w.js +130 -0
  53. package/dist/shared/chunk-jjdg26c1.js +155 -0
  54. package/dist/shared/chunk-k0m4yh86.js +123 -0
  55. package/dist/shared/chunk-k43q9cjr.js +82 -0
  56. package/dist/shared/chunk-k9k8tbr5.js +119 -0
  57. package/dist/shared/chunk-meaj7br1.js +232 -0
  58. package/dist/shared/chunk-mgj0n08k.js +34 -0
  59. package/dist/shared/chunk-mjz4rp6c.js +46 -0
  60. package/dist/shared/chunk-n4rr5gme.js +239 -0
  61. package/dist/shared/chunk-nk55etpp.js +65 -0
  62. package/dist/shared/chunk-nkh1ks3k.js +264 -0
  63. package/dist/shared/chunk-pgvpvbpe.js +26 -0
  64. package/dist/shared/chunk-pma8gnv7.js +178 -0
  65. package/dist/shared/chunk-q7xv6xze.js +131 -0
  66. package/dist/shared/chunk-qey801nq.js +22 -0
  67. package/dist/shared/chunk-s6b4c3tj.js +58 -0
  68. package/dist/shared/chunk-sq27a4h0.js +36 -0
  69. package/dist/shared/chunk-taa5pj15.js +103 -0
  70. package/dist/shared/chunk-tc5rpvyx.js +127 -0
  71. package/dist/shared/chunk-tescm0b3.js +192 -0
  72. package/dist/shared/chunk-tkftdwnq.js +71 -0
  73. package/dist/shared/chunk-tqhnjcfp.js +116 -0
  74. package/dist/shared/chunk-vfknb5ht.js +183 -0
  75. package/dist/shared/chunk-vsc369w3.js +185 -0
  76. package/dist/shared/chunk-whq9s8v5.js +301 -0
  77. package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
  78. package/dist/shared/chunk-yzbmkx4r.js +155 -0
  79. package/dist/shared/chunk-zaen0ajc.js +347 -0
  80. package/dist/src/accordion/accordion-composed.js +1 -1
  81. package/dist/src/accordion/accordion.js +1 -1
  82. package/dist/src/alert/alert-composed.js +1 -1
  83. package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
  84. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  85. package/dist/src/avatar/avatar-composed.js +1 -1
  86. package/dist/src/badge/badge-composed.js +1 -1
  87. package/dist/src/badge/badge.js +1 -1
  88. package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
  89. package/dist/src/button/button-composed.js +1 -1
  90. package/dist/src/button/button.js +1 -1
  91. package/dist/src/calendar/calendar-composed.js +1 -1
  92. package/dist/src/calendar/calendar.js +1 -1
  93. package/dist/src/card/card-composed.js +1 -1
  94. package/dist/src/carousel/carousel-composed.js +1 -1
  95. package/dist/src/carousel/carousel.js +1 -1
  96. package/dist/src/checkbox/checkbox-composed.js +1 -1
  97. package/dist/src/checkbox/checkbox.js +1 -1
  98. package/dist/src/collapsible/collapsible-composed.js +1 -1
  99. package/dist/src/collapsible/collapsible.js +1 -1
  100. package/dist/src/combobox/combobox-composed.js +1 -1
  101. package/dist/src/combobox/combobox.js +1 -1
  102. package/dist/src/command/command-composed.js +1 -1
  103. package/dist/src/command/command.js +1 -1
  104. package/dist/src/composed/with-styles.js +1 -1
  105. package/dist/src/context-menu/context-menu-composed.js +1 -1
  106. package/dist/src/context-menu/context-menu.js +1 -1
  107. package/dist/src/date-picker/date-picker-composed.js +1 -1
  108. package/dist/src/date-picker/date-picker.js +1 -1
  109. package/dist/src/dialog/dialog-composed.js +1 -1
  110. package/dist/src/dialog/dialog-stack-parts.js +1 -1
  111. package/dist/src/dialog/dialog.js +1 -1
  112. package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
  113. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  114. package/dist/src/empty-state/empty-state-composed.js +1 -1
  115. package/dist/src/form-group/form-group-composed.js +1 -1
  116. package/dist/src/hover-card/hover-card-composed.js +1 -1
  117. package/dist/src/hover-card/hover-card.js +1 -1
  118. package/dist/src/input/input-composed.js +1 -1
  119. package/dist/src/label/label-composed.js +1 -1
  120. package/dist/src/list/list-composed.js +1 -1
  121. package/dist/src/menu/menu-composed.js +1 -1
  122. package/dist/src/menu/menu.js +1 -1
  123. package/dist/src/menubar/menubar-composed.js +1 -1
  124. package/dist/src/menubar/menubar.js +1 -1
  125. package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
  126. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  127. package/dist/src/pagination/pagination-composed.js +1 -1
  128. package/dist/src/popover/popover-composed.js +1 -1
  129. package/dist/src/popover/popover.js +1 -1
  130. package/dist/src/progress/progress-composed.js +1 -1
  131. package/dist/src/progress/progress.js +1 -1
  132. package/dist/src/radio/radio-composed.js +1 -1
  133. package/dist/src/radio/radio.js +1 -1
  134. package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
  135. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  136. package/dist/src/scroll-area/scroll-area-composed.js +1 -1
  137. package/dist/src/scroll-area/scroll-area.js +1 -1
  138. package/dist/src/select/select-composed.js +1 -1
  139. package/dist/src/select/select.js +1 -1
  140. package/dist/src/separator/separator-composed.js +1 -1
  141. package/dist/src/sheet/sheet-composed.js +1 -1
  142. package/dist/src/sheet/sheet.js +1 -1
  143. package/dist/src/skeleton/skeleton-composed.js +1 -1
  144. package/dist/src/slider/slider-composed.js +1 -1
  145. package/dist/src/slider/slider.js +1 -1
  146. package/dist/src/switch/switch-composed.js +1 -1
  147. package/dist/src/switch/switch.js +1 -1
  148. package/dist/src/table/table-composed.js +1 -1
  149. package/dist/src/tabs/tabs-composed.js +1 -1
  150. package/dist/src/tabs/tabs.js +1 -1
  151. package/dist/src/textarea/textarea-composed.js +1 -1
  152. package/dist/src/toast/toast.js +1 -1
  153. package/dist/src/toggle/toggle-composed.js +1 -1
  154. package/dist/src/toggle/toggle.js +1 -1
  155. package/dist/src/toggle-group/toggle-group-composed.js +1 -1
  156. package/dist/src/toggle-group/toggle-group.js +1 -1
  157. package/dist/src/tooltip/tooltip-composed.js +1 -1
  158. package/dist/src/tooltip/tooltip.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/shared/chunk-144kbnmx.js +0 -95
  161. package/dist/shared/chunk-1ewxfgsa.js +0 -167
  162. package/dist/shared/chunk-1hm0mbke.js +0 -258
  163. package/dist/shared/chunk-22rt6ws9.js +0 -69
  164. package/dist/shared/chunk-2ssqz188.js +0 -162
  165. package/dist/shared/chunk-33he7ay9.js +0 -218
  166. package/dist/shared/chunk-3jack97k.js +0 -509
  167. package/dist/shared/chunk-75pegjs7.js +0 -26
  168. package/dist/shared/chunk-862x7dja.js +0 -398
  169. package/dist/shared/chunk-8pk1pn5h.js +0 -215
  170. package/dist/shared/chunk-8t0nm721.js +0 -152
  171. package/dist/shared/chunk-94twh4s4.js +0 -28
  172. package/dist/shared/chunk-9yb26c0w.js +0 -232
  173. package/dist/shared/chunk-a82r2pnq.js +0 -67
  174. package/dist/shared/chunk-axpbdpgx.js +0 -177
  175. package/dist/shared/chunk-b3j6mym6.js +0 -203
  176. package/dist/shared/chunk-b4zzg457.js +0 -410
  177. package/dist/shared/chunk-b9qxfcsy.js +0 -60
  178. package/dist/shared/chunk-bc2qqkhr.js +0 -194
  179. package/dist/shared/chunk-bv12nkdm.js +0 -149
  180. package/dist/shared/chunk-bvxc1ww4.js +0 -164
  181. package/dist/shared/chunk-czv0kqj4.js +0 -107
  182. package/dist/shared/chunk-d83ag07h.js +0 -189
  183. package/dist/shared/chunk-de18ashk.js +0 -134
  184. package/dist/shared/chunk-dvk4h36t.js +0 -140
  185. package/dist/shared/chunk-dxvnerw2.js +0 -353
  186. package/dist/shared/chunk-e399pzdq.js +0 -241
  187. package/dist/shared/chunk-e4qha9as.js +0 -180
  188. package/dist/shared/chunk-eb2d9v6k.js +0 -68
  189. package/dist/shared/chunk-ect26sp5.js +0 -353
  190. package/dist/shared/chunk-ev367pq3.js +0 -102
  191. package/dist/shared/chunk-fjykbv0v.js +0 -214
  192. package/dist/shared/chunk-gdddk6nh.js +0 -96
  193. package/dist/shared/chunk-ghkw5bjq.js +0 -55
  194. package/dist/shared/chunk-hfjtkytb.js +0 -310
  195. package/dist/shared/chunk-hpvjfj0j.js +0 -31
  196. package/dist/shared/chunk-jpyjk616.js +0 -52
  197. package/dist/shared/chunk-k6d53tne.js +0 -206
  198. package/dist/shared/chunk-knzg86am.js +0 -168
  199. package/dist/shared/chunk-ktbf6xrt.js +0 -179
  200. package/dist/shared/chunk-m8y2p66x.js +0 -252
  201. package/dist/shared/chunk-metxdt5x.js +0 -28
  202. package/dist/shared/chunk-mgae1d93.js +0 -157
  203. package/dist/shared/chunk-mtx2cfbx.js +0 -175
  204. package/dist/shared/chunk-n436p5cb.js +0 -260
  205. package/dist/shared/chunk-nj420k31.js +0 -54
  206. package/dist/shared/chunk-nsmvdxgp.js +0 -213
  207. package/dist/shared/chunk-pcms04vq.js +0 -162
  208. package/dist/shared/chunk-pqskzq8t.js +0 -79
  209. package/dist/shared/chunk-pwr60kyd.js +0 -321
  210. package/dist/shared/chunk-pzknpa1y.js +0 -327
  211. package/dist/shared/chunk-q77y3rg4.js +0 -189
  212. package/dist/shared/chunk-qhnany7w.js +0 -179
  213. package/dist/shared/chunk-rdr0rtpr.js +0 -131
  214. package/dist/shared/chunk-rj52ty6r.js +0 -147
  215. package/dist/shared/chunk-rnqc7735.js +0 -125
  216. package/dist/shared/chunk-rtk30950.js +0 -202
  217. package/dist/shared/chunk-s0xgd8vg.js +0 -266
  218. package/dist/shared/chunk-s415735j.js +0 -357
  219. package/dist/shared/chunk-s62e7jf4.js +0 -30
  220. package/dist/shared/chunk-snd8e6r8.js +0 -418
  221. package/dist/shared/chunk-spng4yb9.js +0 -73
  222. package/dist/shared/chunk-t887wwjc.js +0 -168
  223. package/dist/shared/chunk-tn0m98j8.js +0 -42
  224. package/dist/shared/chunk-v0b5pkcq.js +0 -30
  225. package/dist/shared/chunk-v5tj7veh.js +0 -284
  226. package/dist/shared/chunk-vkscwzpr.js +0 -294
  227. package/dist/shared/chunk-vv187snj.js +0 -112
  228. package/dist/shared/chunk-xv4wd0kf.js +0 -293
  229. package/dist/shared/chunk-y1hpsqzy.js +0 -185
  230. package/dist/shared/chunk-yfzddvxc.js +0 -71
  231. package/dist/shared/chunk-yzgzx2dh.js +0 -311
  232. package/dist/shared/chunk-z5j7ztf2.js +0 -467
@@ -0,0 +1,155 @@
1
+ import {
2
+ linkedIds
3
+ } from "./chunk-8y1jf6xr.js";
4
+ import {
5
+ Keys,
6
+ isKey
7
+ } from "./chunk-7867pr13.js";
8
+ import {
9
+ setDataState,
10
+ setExpanded,
11
+ setHidden,
12
+ setHiddenAnimated,
13
+ setSelected
14
+ } from "./chunk-vevfhpc9.js";
15
+ import {
16
+ applyAttrs
17
+ } from "./chunk-2db2dnp3.js";
18
+
19
+ // src/combobox/combobox.tsx
20
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
21
+ import { signal } from "@vertz/ui";
22
+ function ComboboxRoot(options = {}) {
23
+ const { defaultValue = "", onValueChange, onInputChange, ...attrs } = options;
24
+ const ids = linkedIds("combobox");
25
+ const state = {
26
+ open: signal(false),
27
+ value: signal(defaultValue),
28
+ inputValue: signal(defaultValue),
29
+ activeIndex: signal(-1)
30
+ };
31
+ const optionElements = [];
32
+ function open() {
33
+ state.open.value = true;
34
+ setExpanded(input, true);
35
+ setHidden(listbox, false);
36
+ setDataState(listbox, "open");
37
+ }
38
+ function close() {
39
+ state.open.value = false;
40
+ state.activeIndex.value = -1;
41
+ setExpanded(input, false);
42
+ setDataState(listbox, "closed");
43
+ setHiddenAnimated(listbox, true);
44
+ updateActiveDescendant(-1);
45
+ }
46
+ function selectOption(value) {
47
+ state.value.value = value;
48
+ state.inputValue.value = value;
49
+ input.value = value;
50
+ for (const opt of optionElements) {
51
+ const isActive = opt.getAttribute("data-value") === value;
52
+ setSelected(opt, isActive);
53
+ setDataState(opt, isActive ? "active" : "inactive");
54
+ }
55
+ onValueChange?.(value);
56
+ close();
57
+ input.focus();
58
+ }
59
+ function updateActiveDescendant(index) {
60
+ const opt = optionElements[index];
61
+ if (index >= 0 && opt) {
62
+ input.setAttribute("aria-activedescendant", opt.id);
63
+ for (let i = 0;i < optionElements.length; i++) {
64
+ const el = optionElements[i];
65
+ if (el)
66
+ setDataState(el, i === index ? "active" : "inactive");
67
+ }
68
+ } else {
69
+ input.removeAttribute("aria-activedescendant");
70
+ }
71
+ }
72
+ const input = jsxDEV_7x81h0kn("input", {
73
+ type: "text",
74
+ role: "combobox",
75
+ "aria-autocomplete": "list",
76
+ "aria-controls": ids.contentId,
77
+ "aria-haspopup": "listbox",
78
+ id: ids.triggerId,
79
+ value: defaultValue,
80
+ "aria-expanded": "false",
81
+ onInput: () => {
82
+ state.inputValue.value = input.value;
83
+ onInputChange?.(input.value);
84
+ if (!state.open.peek())
85
+ open();
86
+ },
87
+ onFocus: () => {
88
+ if (!state.open.peek() && input.value.length > 0)
89
+ open();
90
+ },
91
+ onKeydown: (event) => {
92
+ if (isKey(event, Keys.Escape)) {
93
+ event.preventDefault();
94
+ close();
95
+ return;
96
+ }
97
+ if (isKey(event, Keys.ArrowDown)) {
98
+ event.preventDefault();
99
+ if (!state.open.peek()) {
100
+ open();
101
+ }
102
+ const next = Math.min(state.activeIndex.peek() + 1, optionElements.length - 1);
103
+ state.activeIndex.value = next;
104
+ updateActiveDescendant(next);
105
+ return;
106
+ }
107
+ if (isKey(event, Keys.ArrowUp)) {
108
+ event.preventDefault();
109
+ const prev = Math.max(state.activeIndex.peek() - 1, 0);
110
+ state.activeIndex.value = prev;
111
+ updateActiveDescendant(prev);
112
+ return;
113
+ }
114
+ if (isKey(event, Keys.Enter)) {
115
+ event.preventDefault();
116
+ const idx = state.activeIndex.peek();
117
+ if (idx >= 0 && idx < optionElements.length) {
118
+ const val = optionElements[idx]?.getAttribute("data-value");
119
+ if (val != null)
120
+ selectOption(val);
121
+ }
122
+ return;
123
+ }
124
+ }
125
+ }, undefined, false, undefined, this);
126
+ const listbox = jsxDEV_7x81h0kn("div", {
127
+ role: "listbox",
128
+ id: ids.contentId,
129
+ "aria-hidden": "true",
130
+ "data-state": "closed",
131
+ style: { display: "none" }
132
+ }, undefined, false, undefined, this);
133
+ function Option(value, label) {
134
+ const optId = `${ids.contentId}-opt-${optionElements.length}`;
135
+ const isSelectedOpt = value === defaultValue;
136
+ const opt = jsxDEV_7x81h0kn("div", {
137
+ role: "option",
138
+ id: optId,
139
+ "data-value": value,
140
+ "aria-selected": isSelectedOpt ? "true" : "false",
141
+ "data-state": isSelectedOpt ? "active" : "inactive",
142
+ onClick: () => selectOption(value),
143
+ children: label ?? value
144
+ }, undefined, false, undefined, this);
145
+ optionElements.push(opt);
146
+ return opt;
147
+ }
148
+ applyAttrs(input, attrs);
149
+ return { input, listbox, state, Option };
150
+ }
151
+ var Combobox = {
152
+ Root: ComboboxRoot
153
+ };
154
+
155
+ export { Combobox };
@@ -0,0 +1,24 @@
1
+ import {
2
+ uniqueId
3
+ } from "./chunk-8y1jf6xr.js";
4
+ import {
5
+ applyAttrs
6
+ } from "./chunk-2db2dnp3.js";
7
+
8
+ // src/badge/badge.tsx
9
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
10
+ function BadgeRoot(options = {}) {
11
+ const { variant = "default", ...attrs } = options;
12
+ const badge = jsxDEV_7x81h0kn("span", {
13
+ id: uniqueId("badge"),
14
+ "data-slot": "badge",
15
+ "data-variant": variant
16
+ }, undefined, false, undefined, this);
17
+ applyAttrs(badge, attrs);
18
+ return { badge };
19
+ }
20
+ var Badge = {
21
+ Root: BadgeRoot
22
+ };
23
+
24
+ export { Badge };
@@ -0,0 +1,106 @@
1
+ import {
2
+ createDismiss
3
+ } from "./chunk-a6wp8c32.js";
4
+ import {
5
+ createFloatingPosition
6
+ } from "./chunk-vef3sepw.js";
7
+ import {
8
+ focusFirst,
9
+ saveFocus
10
+ } from "./chunk-e2v1c9ex.js";
11
+ import {
12
+ linkedIds
13
+ } from "./chunk-8y1jf6xr.js";
14
+ import {
15
+ Keys,
16
+ isKey
17
+ } from "./chunk-7867pr13.js";
18
+ import {
19
+ setDataState,
20
+ setExpanded,
21
+ setHidden,
22
+ setHiddenAnimated
23
+ } from "./chunk-vevfhpc9.js";
24
+ import {
25
+ applyAttrs
26
+ } from "./chunk-2db2dnp3.js";
27
+
28
+ // src/popover/popover.tsx
29
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
30
+ import { signal } from "@vertz/ui";
31
+ function PopoverRoot(options = {}) {
32
+ const { defaultOpen = false, onOpenChange, positioning, ...attrs } = options;
33
+ const ids = linkedIds("popover");
34
+ const state = { open: signal(defaultOpen) };
35
+ let restoreFocus = null;
36
+ let floatingCleanup = null;
37
+ let dismissCleanup = null;
38
+ function open() {
39
+ state.open.value = true;
40
+ setExpanded(trigger, true);
41
+ setHidden(content, false);
42
+ setDataState(trigger, "open");
43
+ setDataState(content, "open");
44
+ restoreFocus = saveFocus();
45
+ queueMicrotask(() => focusFirst(content));
46
+ if (positioning) {
47
+ const result = createFloatingPosition(trigger, content, positioning);
48
+ floatingCleanup = result.cleanup;
49
+ dismissCleanup = createDismiss({
50
+ onDismiss: close,
51
+ insideElements: [trigger, content],
52
+ escapeKey: false
53
+ });
54
+ }
55
+ onOpenChange?.(true);
56
+ }
57
+ function close() {
58
+ state.open.value = false;
59
+ setExpanded(trigger, false);
60
+ setDataState(trigger, "closed");
61
+ setDataState(content, "closed");
62
+ setHiddenAnimated(content, true);
63
+ floatingCleanup?.();
64
+ floatingCleanup = null;
65
+ dismissCleanup?.();
66
+ dismissCleanup = null;
67
+ restoreFocus?.();
68
+ restoreFocus = null;
69
+ onOpenChange?.(false);
70
+ }
71
+ const trigger = jsxDEV_7x81h0kn("button", {
72
+ type: "button",
73
+ id: ids.triggerId,
74
+ "aria-controls": ids.contentId,
75
+ "aria-haspopup": "dialog",
76
+ "aria-expanded": defaultOpen ? "true" : "false",
77
+ "data-state": defaultOpen ? "open" : "closed",
78
+ onClick: () => {
79
+ if (state.open.peek()) {
80
+ close();
81
+ } else {
82
+ open();
83
+ }
84
+ }
85
+ }, undefined, false, undefined, this);
86
+ const content = jsxDEV_7x81h0kn("div", {
87
+ role: "dialog",
88
+ id: ids.contentId,
89
+ "aria-hidden": defaultOpen ? "false" : "true",
90
+ "data-state": defaultOpen ? "open" : "closed",
91
+ style: { display: defaultOpen ? "" : "none" },
92
+ onKeydown: (event) => {
93
+ if (isKey(event, Keys.Escape)) {
94
+ event.preventDefault();
95
+ close();
96
+ }
97
+ }
98
+ }, undefined, false, undefined, this);
99
+ applyAttrs(trigger, attrs);
100
+ return { trigger, content, state };
101
+ }
102
+ var Popover = {
103
+ Root: PopoverRoot
104
+ };
105
+
106
+ export { Popover };
@@ -0,0 +1,127 @@
1
+ import {
2
+ setRovingTabindex
3
+ } from "./chunk-e2v1c9ex.js";
4
+ import {
5
+ uniqueId
6
+ } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ handleListNavigation
9
+ } from "./chunk-7867pr13.js";
10
+ import {
11
+ setDataState,
12
+ setHidden,
13
+ setSelected
14
+ } from "./chunk-vevfhpc9.js";
15
+ import {
16
+ applyAttrs
17
+ } from "./chunk-2db2dnp3.js";
18
+
19
+ // src/tabs/tabs.tsx
20
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
21
+ import { signal } from "@vertz/ui";
22
+ function TabList(orientation, triggers, tabValues, selectTab) {
23
+ return jsxDEV_7x81h0kn("div", {
24
+ role: "tablist",
25
+ "aria-orientation": orientation === "vertical" ? "vertical" : undefined,
26
+ onKeydown: (event) => {
27
+ const result = handleListNavigation(event, triggers, {
28
+ orientation
29
+ });
30
+ if (result) {
31
+ const idx = triggers.indexOf(result);
32
+ if (idx >= 0) {
33
+ const val = tabValues[idx];
34
+ if (val !== undefined)
35
+ selectTab(val);
36
+ }
37
+ }
38
+ }
39
+ }, undefined, false, undefined, this);
40
+ }
41
+ function TabTrigger(triggerId, panelId, value, label, isActive, selectTab) {
42
+ return jsxDEV_7x81h0kn("button", {
43
+ type: "button",
44
+ role: "tab",
45
+ id: triggerId,
46
+ "aria-controls": panelId,
47
+ "data-value": value,
48
+ "aria-selected": isActive ? "true" : "false",
49
+ "data-state": isActive ? "active" : "inactive",
50
+ onClick: () => {
51
+ selectTab(value);
52
+ },
53
+ children: label ?? value
54
+ }, undefined, false, undefined, this);
55
+ }
56
+ function TabsContainer(list) {
57
+ return jsxDEV_7x81h0kn("div", {
58
+ children: list
59
+ }, undefined, false, undefined, this);
60
+ }
61
+ function TabPanel(panelId, triggerId, isActive) {
62
+ return jsxDEV_7x81h0kn("div", {
63
+ role: "tabpanel",
64
+ id: panelId,
65
+ "aria-labelledby": triggerId,
66
+ tabindex: "0",
67
+ "aria-hidden": isActive ? "false" : "true",
68
+ "data-state": isActive ? "active" : "inactive",
69
+ style: { display: isActive ? "" : "none" }
70
+ }, undefined, false, undefined, this);
71
+ }
72
+ function TabsRoot(options = {}) {
73
+ const { defaultValue = "", orientation = "horizontal", onValueChange, ...attrs } = options;
74
+ const state = { value: signal(defaultValue) };
75
+ const triggers = [];
76
+ const panels = [];
77
+ const tabValues = [];
78
+ function selectTab(value) {
79
+ state.value.value = value;
80
+ for (let i = 0;i < tabValues.length; i++) {
81
+ const isActive = tabValues[i] === value;
82
+ const trig = triggers[i];
83
+ const panel = panels[i];
84
+ if (!trig || !panel)
85
+ continue;
86
+ setSelected(trig, isActive);
87
+ setDataState(trig, isActive ? "active" : "inactive");
88
+ trig.setAttribute("tabindex", isActive ? "0" : "-1");
89
+ setHidden(panel, !isActive);
90
+ setDataState(panel, isActive ? "active" : "inactive");
91
+ }
92
+ onValueChange?.(value);
93
+ }
94
+ const list = TabList(orientation, triggers, tabValues, selectTab);
95
+ const root = TabsContainer(list);
96
+ const cleanups = [];
97
+ function Tab(value, label) {
98
+ const baseId = uniqueId("tab");
99
+ const triggerId = `${baseId}-trigger`;
100
+ const panelId = `${baseId}-panel`;
101
+ const isActive = value === state.value.peek();
102
+ const trig = TabTrigger(triggerId, panelId, value, label, isActive, selectTab);
103
+ const handleClick = () => {
104
+ trig.focus();
105
+ };
106
+ trig.addEventListener("click", handleClick);
107
+ cleanups.push(() => trig.removeEventListener("click", handleClick));
108
+ const panel = TabPanel(panelId, triggerId, isActive);
109
+ triggers.push(trig);
110
+ panels.push(panel);
111
+ tabValues.push(value);
112
+ setRovingTabindex(triggers, triggers.findIndex((t) => tabValues[triggers.indexOf(t)] === state.value.peek()));
113
+ return { trigger: trig, panel };
114
+ }
115
+ function destroy() {
116
+ for (const cleanup of cleanups)
117
+ cleanup();
118
+ cleanups.length = 0;
119
+ }
120
+ applyAttrs(root, attrs);
121
+ return { root, list, state, Tab, destroy };
122
+ }
123
+ var Tabs = {
124
+ Root: TabsRoot
125
+ };
126
+
127
+ export { Tabs };