@vertz/ui-primitives 0.2.41 → 0.2.42

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
@@ -1,398 +0,0 @@
1
- import {
2
- createDismiss
3
- } from "./chunk-a6wp8c32.js";
4
- import {
5
- cn
6
- } from "./chunk-q7xbcj9q.js";
7
- import {
8
- createFloatingPosition
9
- } from "./chunk-vef3sepw.js";
10
- import {
11
- linkedIds
12
- } from "./chunk-8y1jf6xr.js";
13
- import {
14
- Keys,
15
- handleListNavigation,
16
- isKey
17
- } from "./chunk-7867pr13.js";
18
- import {
19
- setHiddenAnimated
20
- } from "./chunk-vevfhpc9.js";
21
-
22
- // src/select/select-composed.tsx
23
- import { computed, signal } from "@vertz/ui";
24
- import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
25
- import { createContext, onMount, ref, useContext } from "@vertz/ui";
26
- var SelectContext = createContext(undefined, "@vertz/ui-primitives::SelectContext");
27
- function useSelectContext(componentName) {
28
- const ctx = useContext(SelectContext);
29
- if (!ctx) {
30
- throw new Error(`<Select.${componentName}> must be used inside <Select>. ` + "Ensure it is a direct or nested child of the Select root component.");
31
- }
32
- return ctx;
33
- }
34
- function SelectTrigger(__props) {
35
- const __mfDepth = __pushMountFrame();
36
- try {
37
- const ctx = useSelectContext("Trigger");
38
- const displayText = computed(() => __props.children ?? (ctx.selectedValue() || ctx.placeholder || ""));
39
- const __mfResult0 = (() => {
40
- const __el0 = __element("button");
41
- __el0.setAttribute("type", "button");
42
- __el0.setAttribute("role", "combobox");
43
- __el0.setAttribute("data-select-trigger", "");
44
- {
45
- const __v = ctx.contentId;
46
- if (__v != null && __v !== false)
47
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
48
- }
49
- __el0.setAttribute("aria-haspopup", "listbox");
50
- __el0.setAttribute("aria-expanded", "false");
51
- __el0.setAttribute("data-state", "closed");
52
- __attr(__el0, "class", () => cn(ctx.classes?.trigger, __props.className ?? __props.class));
53
- __on(__el0, "click", () => ctx.toggle());
54
- __on(__el0, "keydown", (event) => {
55
- if (isKey(event, Keys.ArrowDown, Keys.ArrowUp, Keys.Enter, Keys.Space)) {
56
- event.preventDefault();
57
- if (!ctx.isOpen())
58
- ctx.open();
59
- }
60
- });
61
- __enterChildren(__el0);
62
- __append(__el0, (() => {
63
- const __el1 = __element("span");
64
- __el1.setAttribute("data-part", "text");
65
- {
66
- const __v = {
67
- flex: 1,
68
- textAlign: "start",
69
- overflow: "hidden",
70
- textOverflow: "ellipsis",
71
- whiteSpace: "nowrap"
72
- };
73
- if (__v != null && __v !== false)
74
- __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
75
- }
76
- __enterChildren(__el1);
77
- __append(__el1, __child(() => displayText.value));
78
- __exitChildren();
79
- return __el1;
80
- })());
81
- __append(__el0, (() => {
82
- const __el2 = __element("span");
83
- __el2.setAttribute("data-part", "chevron");
84
- __enterChildren(__el2);
85
- __append(__el2, (() => {
86
- const __el3 = __element("svg");
87
- __el3.setAttribute("xmlns", "http://www.w3.org/2000/svg");
88
- __el3.setAttribute("width", "16");
89
- __el3.setAttribute("height", "16");
90
- __el3.setAttribute("viewBox", "0 0 24 24");
91
- __el3.setAttribute("fill", "none");
92
- __el3.setAttribute("stroke", "currentColor");
93
- __el3.setAttribute("stroke-width", "2");
94
- __el3.setAttribute("stroke-linecap", "round");
95
- __el3.setAttribute("stroke-linejoin", "round");
96
- __el3.setAttribute("aria-hidden", "true");
97
- __enterChildren(__el3);
98
- __append(__el3, (() => {
99
- const __el4 = __element("path");
100
- __el4.setAttribute("d", "m6 9 6 6 6-6");
101
- return __el4;
102
- })());
103
- __exitChildren();
104
- return __el3;
105
- })());
106
- __exitChildren();
107
- return __el2;
108
- })());
109
- __exitChildren();
110
- return __el0;
111
- })();
112
- __flushMountFrame();
113
- return __mfResult0;
114
- } catch (__mfErr) {
115
- __discardMountFrame(__mfDepth);
116
- throw __mfErr;
117
- }
118
- }
119
- function SelectContent(__props) {
120
- const __mfDepth = __pushMountFrame();
121
- try {
122
- const ctx = useSelectContext("Content");
123
- const instanceIndex = ctx._contentCount.value++;
124
- if (instanceIndex > 0) {
125
- console.warn("Duplicate <Select.Content> detected – only the first is used");
126
- }
127
- onMount(() => {
128
- const el = ctx.contentRef.current;
129
- if (!el || el.__selectWired)
130
- return;
131
- el.__selectWired = true;
132
- el.addEventListener("keydown", (event) => {
133
- if (isKey(event, Keys.Escape)) {
134
- event.preventDefault();
135
- ctx.close();
136
- return;
137
- }
138
- const items = [...el.querySelectorAll('[role="option"]')];
139
- const focusedIdx = items.indexOf(document.activeElement);
140
- if (isKey(event, Keys.Enter, Keys.Space)) {
141
- event.preventDefault();
142
- const active = items[focusedIdx];
143
- if (active) {
144
- const val = active.getAttribute("data-value");
145
- if (val !== null)
146
- ctx.selectItem(val);
147
- }
148
- return;
149
- }
150
- const result = handleListNavigation(event, items, { orientation: "vertical" });
151
- if (result)
152
- return;
153
- if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
154
- const char = event.key.toLowerCase();
155
- const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
156
- if (match)
157
- match.focus();
158
- }
159
- });
160
- });
161
- const __mfResult0 = (() => {
162
- const __el0 = __element("div");
163
- ctx.contentRef.current = __el0;
164
- __el0.setAttribute("role", "listbox");
165
- __el0.setAttribute("tabindex", "-1");
166
- {
167
- const __v = ctx.contentId;
168
- if (__v != null && __v !== false)
169
- __el0.setAttribute("id", __v === true ? "" : __v);
170
- }
171
- __el0.setAttribute("data-select-content", "");
172
- __el0.setAttribute("aria-hidden", "true");
173
- __el0.setAttribute("data-state", "closed");
174
- {
175
- const __v = { display: "none" };
176
- if (__v != null && __v !== false)
177
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
178
- }
179
- __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
180
- __enterChildren(__el0);
181
- __append(__el0, __child(() => __props.children));
182
- __exitChildren();
183
- return __el0;
184
- })();
185
- __flushMountFrame();
186
- return __mfResult0;
187
- } catch (__mfErr) {
188
- __discardMountFrame(__mfDepth);
189
- throw __mfErr;
190
- }
191
- }
192
- function SelectItem(__props) {
193
- const __mfDepth = __pushMountFrame();
194
- try {
195
- const ctx = useSelectContext("Item");
196
- const isSelected = computed(() => ctx.selectedValue() === __props.value);
197
- const __mfResult0 = (() => {
198
- const __el0 = __element("div");
199
- __el0.setAttribute("role", "option");
200
- __attr(__el0, "data-value", () => __props.value);
201
- __el0.setAttribute("tabindex", "-1");
202
- __attr(__el0, "aria-selected", () => isSelected.value ? "true" : "false");
203
- __attr(__el0, "data-state", () => isSelected.value ? "active" : "inactive");
204
- __attr(__el0, "class", () => cn(ctx.classes?.item, __props.className ?? __props.class));
205
- __on(__el0, "click", () => ctx.selectItem(__props.value));
206
- __enterChildren(__el0);
207
- __append(__el0, __child(() => __props.children ?? __props.value));
208
- __append(__el0, (() => {
209
- const __el1 = __element("span");
210
- __el1.setAttribute("data-part", "indicator");
211
- __attr(__el1, "style", () => ({ display: isSelected.value ? "" : "none" }));
212
- {
213
- const __v = cn(ctx.classes?.itemIndicator);
214
- if (__v != null && __v !== false)
215
- __el1.setAttribute("class", __v === true ? "" : __v);
216
- }
217
- return __el1;
218
- })());
219
- __exitChildren();
220
- return __el0;
221
- })();
222
- __flushMountFrame();
223
- return __mfResult0;
224
- } catch (__mfErr) {
225
- __discardMountFrame(__mfDepth);
226
- throw __mfErr;
227
- }
228
- }
229
- function SelectGroup(__props) {
230
- const __mfDepth = __pushMountFrame();
231
- try {
232
- const ctx = useSelectContext("Group");
233
- const __mfResult0 = (() => {
234
- const __el0 = __element("div");
235
- __el0.setAttribute("role", "group");
236
- __attr(__el0, "aria-label", () => __props.label);
237
- __attr(__el0, "class", () => cn(ctx.classes?.group, __props.className ?? __props.class));
238
- __enterChildren(__el0);
239
- __append(__el0, (() => {
240
- const __el1 = __element("div");
241
- __el1.setAttribute("data-part", "group-label");
242
- __el1.setAttribute("role", "none");
243
- __attr(__el1, "class", () => cn(ctx.classes?.label));
244
- __enterChildren(__el1);
245
- __append(__el1, __child(() => __props.label));
246
- __exitChildren();
247
- return __el1;
248
- })());
249
- __append(__el0, __child(() => __props.children));
250
- __exitChildren();
251
- return __el0;
252
- })();
253
- __flushMountFrame();
254
- return __mfResult0;
255
- } catch (__mfErr) {
256
- __discardMountFrame(__mfDepth);
257
- throw __mfErr;
258
- }
259
- }
260
- function SelectSeparator(__props) {
261
- const __mfDepth = __pushMountFrame();
262
- try {
263
- const { classes } = useSelectContext("Separator");
264
- const __mfResult0 = (() => {
265
- const __el0 = __element("hr");
266
- __el0.setAttribute("role", "separator");
267
- __attr(__el0, "class", () => cn(classes?.separator, __props.className ?? __props.class));
268
- return __el0;
269
- })();
270
- __flushMountFrame();
271
- return __mfResult0;
272
- } catch (__mfErr) {
273
- __discardMountFrame(__mfDepth);
274
- throw __mfErr;
275
- }
276
- }
277
- function ComposedSelectRoot(__props) {
278
- const __mfDepth = __pushMountFrame();
279
- try {
280
- let getContentEl = function() {
281
- return contentRef.current ?? null;
282
- }, getTriggerEl = function() {
283
- const content = getContentEl();
284
- return content?.parentElement?.querySelector("[data-select-trigger]");
285
- }, syncTriggerAttrs = function(nowOpen) {
286
- const trigger = getTriggerEl();
287
- if (!trigger)
288
- return;
289
- trigger.setAttribute("aria-expanded", nowOpen ? "true" : "false");
290
- trigger.setAttribute("data-state", nowOpen ? "open" : "closed");
291
- }, showContent = function() {
292
- const content = getContentEl();
293
- if (!content)
294
- return;
295
- content.setAttribute("data-state", "open");
296
- content.setAttribute("aria-hidden", "false");
297
- content.style.display = "";
298
- }, hideContent = function() {
299
- const content = getContentEl();
300
- if (!content)
301
- return;
302
- content.setAttribute("data-state", "closed");
303
- setHiddenAnimated(content, true);
304
- }, open = function() {
305
- isOpen.value = true;
306
- syncTriggerAttrs(true);
307
- showContent();
308
- const contentEl = getContentEl();
309
- const triggerEl = getTriggerEl();
310
- if (!contentEl)
311
- return;
312
- contentEl.style.position = "fixed";
313
- if (triggerEl) {
314
- const floatingOpts = { matchReferenceWidth: true, ...__props.positioning };
315
- const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
316
- state.floatingCleanup = result.cleanup;
317
- }
318
- const insideElements = [contentEl, ...triggerEl ? [triggerEl] : []];
319
- state.dismissCleanup = createDismiss({
320
- onDismiss: close,
321
- insideElements
322
- });
323
- const items = [...contentEl.querySelectorAll('[role="option"]')];
324
- const selectedIdx = items.findIndex((el) => el.getAttribute("data-value") === selectedValue.value);
325
- if (selectedIdx >= 0) {
326
- items.forEach((el, i) => el.setAttribute("tabindex", i === selectedIdx ? "0" : "-1"));
327
- items[selectedIdx]?.focus();
328
- } else {
329
- contentEl.focus();
330
- }
331
- }, close = function() {
332
- isOpen.value = false;
333
- syncTriggerAttrs(false);
334
- hideContent();
335
- state.floatingCleanup?.();
336
- state.floatingCleanup = null;
337
- state.dismissCleanup?.();
338
- state.dismissCleanup = null;
339
- getTriggerEl()?.focus();
340
- }, toggle = function() {
341
- if (isOpen.value)
342
- close();
343
- else
344
- open();
345
- }, selectItem = function(value) {
346
- selectedValue.value = value;
347
- __props.onValueChange?.(value);
348
- close();
349
- };
350
- const ids = linkedIds("select");
351
- const contentRef = ref();
352
- const isOpen = signal(false, "isOpen");
353
- const selectedValue = signal(__props.defaultValue ?? "", "selectedValue");
354
- const state = { floatingCleanup: null, dismissCleanup: null };
355
- const ctx = {
356
- isOpen: () => isOpen.value,
357
- selectedValue: () => selectedValue.value,
358
- placeholder: __props.placeholder,
359
- contentId: ids.contentId,
360
- contentRef,
361
- classes: __props.classes,
362
- open,
363
- close,
364
- toggle,
365
- selectItem,
366
- _contentCount: { value: 0 }
367
- };
368
- const __mfResult0 = SelectContext.Provider({ get value() {
369
- return ctx;
370
- }, children: () => (() => {
371
- const __el0 = __element("span");
372
- {
373
- const __v = { display: "contents" };
374
- if (__v != null && __v !== false)
375
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
376
- }
377
- __el0.setAttribute("data-select-root", "");
378
- __enterChildren(__el0);
379
- __append(__el0, __child(() => __props.children));
380
- __exitChildren();
381
- return __el0;
382
- })() });
383
- __flushMountFrame();
384
- return __mfResult0;
385
- } catch (__mfErr) {
386
- __discardMountFrame(__mfDepth);
387
- throw __mfErr;
388
- }
389
- }
390
- var ComposedSelect = Object.assign(ComposedSelectRoot, {
391
- Trigger: SelectTrigger,
392
- Content: SelectContent,
393
- Item: SelectItem,
394
- Group: SelectGroup,
395
- Separator: SelectSeparator
396
- });
397
-
398
- export { ComposedSelect };
@@ -1,215 +0,0 @@
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 { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
21
- import { signal } from "@vertz/ui";
22
- function TabList(orientation, triggers, tabValues, selectTab) {
23
- const __mfDepth = __pushMountFrame();
24
- try {
25
- const __mfResult0 = (() => {
26
- const __el0 = __element("div");
27
- __el0.setAttribute("role", "tablist");
28
- {
29
- const __v = orientation === "vertical" ? "vertical" : undefined;
30
- if (__v != null && __v !== false)
31
- __el0.setAttribute("aria-orientation", __v === true ? "" : __v);
32
- }
33
- __on(__el0, "keydown", (event) => {
34
- const result = handleListNavigation(event, triggers, {
35
- orientation
36
- });
37
- if (result) {
38
- const idx = triggers.indexOf(result);
39
- if (idx >= 0) {
40
- const val = tabValues[idx];
41
- if (val !== undefined)
42
- selectTab(val);
43
- }
44
- }
45
- });
46
- return __el0;
47
- })();
48
- __flushMountFrame();
49
- return __mfResult0;
50
- } catch (__mfErr) {
51
- __discardMountFrame(__mfDepth);
52
- throw __mfErr;
53
- }
54
- }
55
- function TabTrigger(triggerId, panelId, value, label, isActive, selectTab) {
56
- const __mfDepth = __pushMountFrame();
57
- try {
58
- const __mfResult0 = (() => {
59
- const __el0 = __element("button");
60
- __el0.setAttribute("type", "button");
61
- __el0.setAttribute("role", "tab");
62
- {
63
- const __v = triggerId;
64
- if (__v != null && __v !== false)
65
- __el0.setAttribute("id", __v === true ? "" : __v);
66
- }
67
- {
68
- const __v = panelId;
69
- if (__v != null && __v !== false)
70
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
71
- }
72
- {
73
- const __v = value;
74
- if (__v != null && __v !== false)
75
- __el0.setAttribute("data-value", __v === true ? "" : __v);
76
- }
77
- {
78
- const __v = isActive ? "true" : "false";
79
- if (__v != null && __v !== false)
80
- __el0.setAttribute("aria-selected", __v === true ? "" : __v);
81
- }
82
- {
83
- const __v = isActive ? "active" : "inactive";
84
- if (__v != null && __v !== false)
85
- __el0.setAttribute("data-state", __v === true ? "" : __v);
86
- }
87
- __on(__el0, "click", () => {
88
- selectTab(value);
89
- });
90
- __enterChildren(__el0);
91
- __insert(__el0, label ?? value);
92
- __exitChildren();
93
- return __el0;
94
- })();
95
- __flushMountFrame();
96
- return __mfResult0;
97
- } catch (__mfErr) {
98
- __discardMountFrame(__mfDepth);
99
- throw __mfErr;
100
- }
101
- }
102
- function TabsContainer(list) {
103
- const __mfDepth = __pushMountFrame();
104
- try {
105
- const __mfResult0 = (() => {
106
- const __el0 = __element("div");
107
- __enterChildren(__el0);
108
- __insert(__el0, list);
109
- __exitChildren();
110
- return __el0;
111
- })();
112
- __flushMountFrame();
113
- return __mfResult0;
114
- } catch (__mfErr) {
115
- __discardMountFrame(__mfDepth);
116
- throw __mfErr;
117
- }
118
- }
119
- function TabPanel(panelId, triggerId, isActive) {
120
- const __mfDepth = __pushMountFrame();
121
- try {
122
- const __mfResult0 = (() => {
123
- const __el0 = __element("div");
124
- __el0.setAttribute("role", "tabpanel");
125
- {
126
- const __v = panelId;
127
- if (__v != null && __v !== false)
128
- __el0.setAttribute("id", __v === true ? "" : __v);
129
- }
130
- {
131
- const __v = triggerId;
132
- if (__v != null && __v !== false)
133
- __el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
134
- }
135
- __el0.setAttribute("tabindex", "0");
136
- {
137
- const __v = isActive ? "false" : "true";
138
- if (__v != null && __v !== false)
139
- __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
140
- }
141
- {
142
- const __v = isActive ? "active" : "inactive";
143
- if (__v != null && __v !== false)
144
- __el0.setAttribute("data-state", __v === true ? "" : __v);
145
- }
146
- {
147
- const __v = { display: isActive ? "" : "none" };
148
- if (__v != null && __v !== false)
149
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
150
- }
151
- return __el0;
152
- })();
153
- __flushMountFrame();
154
- return __mfResult0;
155
- } catch (__mfErr) {
156
- __discardMountFrame(__mfDepth);
157
- throw __mfErr;
158
- }
159
- }
160
- function TabsRoot(options = {}) {
161
- const { defaultValue = "", orientation = "horizontal", onValueChange, ...attrs } = options;
162
- const state = { value: signal(defaultValue) };
163
- const triggers = [];
164
- const panels = [];
165
- const tabValues = [];
166
- function selectTab(value) {
167
- state.value.value = value;
168
- for (let i = 0;i < tabValues.length; i++) {
169
- const isActive = tabValues[i] === value;
170
- const trig = triggers[i];
171
- const panel = panels[i];
172
- if (!trig || !panel)
173
- continue;
174
- setSelected(trig, isActive);
175
- setDataState(trig, isActive ? "active" : "inactive");
176
- trig.setAttribute("tabindex", isActive ? "0" : "-1");
177
- setHidden(panel, !isActive);
178
- setDataState(panel, isActive ? "active" : "inactive");
179
- }
180
- onValueChange?.(value);
181
- }
182
- const list = TabList(orientation, triggers, tabValues, selectTab);
183
- const root = TabsContainer(list);
184
- const cleanups = [];
185
- function Tab(value, label) {
186
- const baseId = uniqueId("tab");
187
- const triggerId = `${baseId}-trigger`;
188
- const panelId = `${baseId}-panel`;
189
- const isActive = value === state.value.peek();
190
- const trig = TabTrigger(triggerId, panelId, value, label, isActive, selectTab);
191
- const handleClick = () => {
192
- trig.focus();
193
- };
194
- trig.addEventListener("click", handleClick);
195
- cleanups.push(() => trig.removeEventListener("click", handleClick));
196
- const panel = TabPanel(panelId, triggerId, isActive);
197
- triggers.push(trig);
198
- panels.push(panel);
199
- tabValues.push(value);
200
- setRovingTabindex(triggers, triggers.findIndex((t) => tabValues[triggers.indexOf(t)] === state.value.peek()));
201
- return { trigger: trig, panel };
202
- }
203
- function destroy() {
204
- for (const cleanup of cleanups)
205
- cleanup();
206
- cleanups.length = 0;
207
- }
208
- applyAttrs(root, attrs);
209
- return { root, list, state, Tab, destroy };
210
- }
211
- var Tabs = {
212
- Root: TabsRoot
213
- };
214
-
215
- export { Tabs };