@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,305 @@
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 { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
24
+ import { createContext, onMount, ref, useContext } from "@vertz/ui";
25
+ var SelectContext = createContext(undefined, "@vertz/ui-primitives::SelectContext");
26
+ function useSelectContext(componentName) {
27
+ const ctx = useContext(SelectContext);
28
+ if (!ctx) {
29
+ throw new Error(`<Select.${componentName}> must be used inside <Select>. ` + "Ensure it is a direct or nested child of the Select root component.");
30
+ }
31
+ return ctx;
32
+ }
33
+ function SelectTrigger({ children, className: cls, class: classProp }) {
34
+ const ctx = useSelectContext("Trigger");
35
+ const displayText = children ?? (ctx.selectedValue() || ctx.placeholder || "");
36
+ return jsxDEV_7x81h0kn("button", {
37
+ type: "button",
38
+ role: "combobox",
39
+ "data-select-trigger": "",
40
+ "aria-controls": ctx.contentId,
41
+ "aria-haspopup": "listbox",
42
+ "aria-expanded": "false",
43
+ "data-state": "closed",
44
+ class: cn(ctx.classes?.trigger, cls ?? classProp),
45
+ onClick: () => ctx.toggle(),
46
+ onKeydown: (event) => {
47
+ if (isKey(event, Keys.ArrowDown, Keys.ArrowUp, Keys.Enter, Keys.Space)) {
48
+ event.preventDefault();
49
+ if (!ctx.isOpen())
50
+ ctx.open();
51
+ }
52
+ },
53
+ children: [
54
+ jsxDEV_7x81h0kn("span", {
55
+ "data-part": "text",
56
+ style: {
57
+ flex: 1,
58
+ textAlign: "start",
59
+ overflow: "hidden",
60
+ textOverflow: "ellipsis",
61
+ whiteSpace: "nowrap"
62
+ },
63
+ children: displayText
64
+ }, undefined, false, undefined, this),
65
+ jsxDEV_7x81h0kn("span", {
66
+ "data-part": "chevron",
67
+ children: jsxDEV_7x81h0kn("svg", {
68
+ xmlns: "http://www.w3.org/2000/svg",
69
+ width: "16",
70
+ height: "16",
71
+ viewBox: "0 0 24 24",
72
+ fill: "none",
73
+ stroke: "currentColor",
74
+ "stroke-width": "2",
75
+ "stroke-linecap": "round",
76
+ "stroke-linejoin": "round",
77
+ "aria-hidden": "true",
78
+ children: jsxDEV_7x81h0kn("path", {
79
+ d: "m6 9 6 6 6-6"
80
+ }, undefined, false, undefined, this)
81
+ }, undefined, false, undefined, this)
82
+ }, undefined, false, undefined, this)
83
+ ]
84
+ }, undefined, true, undefined, this);
85
+ }
86
+ function SelectContent({ children, className: cls, class: classProp }) {
87
+ const ctx = useSelectContext("Content");
88
+ const instanceIndex = ctx._contentCount.value++;
89
+ if (instanceIndex > 0) {
90
+ console.warn("Duplicate <Select.Content> detected – only the first is used");
91
+ }
92
+ onMount(() => {
93
+ const el = ctx.contentRef.current;
94
+ if (!el || el.__selectWired)
95
+ return;
96
+ el.__selectWired = true;
97
+ el.addEventListener("keydown", (event) => {
98
+ if (isKey(event, Keys.Escape)) {
99
+ event.preventDefault();
100
+ ctx.close();
101
+ return;
102
+ }
103
+ const items = [...el.querySelectorAll('[role="option"]')];
104
+ const focusedIdx = items.indexOf(document.activeElement);
105
+ if (isKey(event, Keys.Enter, Keys.Space)) {
106
+ event.preventDefault();
107
+ const active = items[focusedIdx];
108
+ if (active) {
109
+ const val = active.getAttribute("data-value");
110
+ if (val !== null)
111
+ ctx.selectItem(val);
112
+ }
113
+ return;
114
+ }
115
+ const result = handleListNavigation(event, items, { orientation: "vertical" });
116
+ if (result)
117
+ return;
118
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
119
+ const char = event.key.toLowerCase();
120
+ const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
121
+ if (match)
122
+ match.focus();
123
+ }
124
+ });
125
+ });
126
+ return jsxDEV_7x81h0kn("div", {
127
+ ref: ctx.contentRef,
128
+ role: "listbox",
129
+ tabindex: "-1",
130
+ id: ctx.contentId,
131
+ "data-select-content": "",
132
+ "aria-hidden": "true",
133
+ "data-state": "closed",
134
+ style: { display: "none" },
135
+ class: cn(ctx.classes?.content, cls ?? classProp),
136
+ children
137
+ }, undefined, false, undefined, this);
138
+ }
139
+ function SelectItem({ value, children, className: cls, class: classProp }) {
140
+ const ctx = useSelectContext("Item");
141
+ const isSelected = ctx.selectedValue() === value;
142
+ return jsxDEV_7x81h0kn("div", {
143
+ role: "option",
144
+ "data-value": value,
145
+ tabindex: "-1",
146
+ "aria-selected": isSelected ? "true" : "false",
147
+ "data-state": isSelected ? "active" : "inactive",
148
+ class: cn(ctx.classes?.item, cls ?? classProp),
149
+ onClick: () => ctx.selectItem(value),
150
+ children: [
151
+ children ?? value,
152
+ jsxDEV_7x81h0kn("span", {
153
+ "data-part": "indicator",
154
+ style: { display: isSelected ? "" : "none" },
155
+ class: cn(ctx.classes?.itemIndicator)
156
+ }, undefined, false, undefined, this)
157
+ ]
158
+ }, undefined, true, undefined, this);
159
+ }
160
+ function SelectGroup({ label, children, className: cls, class: classProp }) {
161
+ const ctx = useSelectContext("Group");
162
+ return jsxDEV_7x81h0kn("div", {
163
+ role: "group",
164
+ "aria-label": label,
165
+ class: cn(ctx.classes?.group, cls ?? classProp),
166
+ children: [
167
+ jsxDEV_7x81h0kn("div", {
168
+ "data-part": "group-label",
169
+ role: "none",
170
+ class: cn(ctx.classes?.label),
171
+ children: label
172
+ }, undefined, false, undefined, this),
173
+ children
174
+ ]
175
+ }, undefined, true, undefined, this);
176
+ }
177
+ function SelectSeparator({ className: cls, class: classProp }) {
178
+ const { classes } = useSelectContext("Separator");
179
+ return jsxDEV_7x81h0kn("hr", {
180
+ role: "separator",
181
+ class: cn(classes?.separator, cls ?? classProp)
182
+ }, undefined, false, undefined, this);
183
+ }
184
+ function ComposedSelectRoot({
185
+ children,
186
+ classes,
187
+ defaultValue = "",
188
+ placeholder,
189
+ onValueChange,
190
+ positioning
191
+ }) {
192
+ const ids = linkedIds("select");
193
+ const contentRef = ref();
194
+ let isOpen = false;
195
+ let selectedValue = defaultValue;
196
+ const state = { floatingCleanup: null, dismissCleanup: null };
197
+ function getContentEl() {
198
+ return contentRef.current ?? null;
199
+ }
200
+ function getTriggerEl() {
201
+ const content = getContentEl();
202
+ return content?.parentElement?.querySelector("[data-select-trigger]");
203
+ }
204
+ function syncTriggerAttrs(nowOpen) {
205
+ const trigger = getTriggerEl();
206
+ if (!trigger)
207
+ return;
208
+ trigger.setAttribute("aria-expanded", nowOpen ? "true" : "false");
209
+ trigger.setAttribute("data-state", nowOpen ? "open" : "closed");
210
+ }
211
+ function showContent() {
212
+ const content = getContentEl();
213
+ if (!content)
214
+ return;
215
+ content.setAttribute("data-state", "open");
216
+ content.setAttribute("aria-hidden", "false");
217
+ content.style.display = "";
218
+ }
219
+ function hideContent() {
220
+ const content = getContentEl();
221
+ if (!content)
222
+ return;
223
+ content.setAttribute("data-state", "closed");
224
+ setHiddenAnimated(content, true);
225
+ }
226
+ function open() {
227
+ isOpen = true;
228
+ syncTriggerAttrs(true);
229
+ showContent();
230
+ const contentEl = getContentEl();
231
+ const triggerEl = getTriggerEl();
232
+ if (!contentEl)
233
+ return;
234
+ contentEl.style.position = "fixed";
235
+ if (triggerEl) {
236
+ const floatingOpts = { matchReferenceWidth: true, ...positioning };
237
+ const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
238
+ state.floatingCleanup = result.cleanup;
239
+ }
240
+ const insideElements = [contentEl, ...triggerEl ? [triggerEl] : []];
241
+ state.dismissCleanup = createDismiss({
242
+ onDismiss: close,
243
+ insideElements
244
+ });
245
+ const items = [...contentEl.querySelectorAll('[role="option"]')];
246
+ const selectedIdx = items.findIndex((el) => el.getAttribute("data-value") === selectedValue);
247
+ if (selectedIdx >= 0) {
248
+ items.forEach((el, i) => el.setAttribute("tabindex", i === selectedIdx ? "0" : "-1"));
249
+ items[selectedIdx]?.focus();
250
+ } else {
251
+ contentEl.focus();
252
+ }
253
+ }
254
+ function close() {
255
+ isOpen = false;
256
+ syncTriggerAttrs(false);
257
+ hideContent();
258
+ state.floatingCleanup?.();
259
+ state.floatingCleanup = null;
260
+ state.dismissCleanup?.();
261
+ state.dismissCleanup = null;
262
+ getTriggerEl()?.focus();
263
+ }
264
+ function toggle() {
265
+ if (isOpen)
266
+ close();
267
+ else
268
+ open();
269
+ }
270
+ function selectItem(value) {
271
+ selectedValue = value;
272
+ onValueChange?.(value);
273
+ close();
274
+ }
275
+ const ctx = {
276
+ isOpen: () => isOpen,
277
+ selectedValue: () => selectedValue,
278
+ placeholder,
279
+ contentId: ids.contentId,
280
+ contentRef,
281
+ classes,
282
+ open,
283
+ close,
284
+ toggle,
285
+ selectItem,
286
+ _contentCount: { value: 0 }
287
+ };
288
+ return jsxDEV_7x81h0kn(SelectContext.Provider, {
289
+ value: ctx,
290
+ children: jsxDEV_7x81h0kn("span", {
291
+ style: { display: "contents" },
292
+ "data-select-root": "",
293
+ children
294
+ }, undefined, false, undefined, this)
295
+ }, undefined, false, undefined, this);
296
+ }
297
+ var ComposedSelect = Object.assign(ComposedSelectRoot, {
298
+ Trigger: SelectTrigger,
299
+ Content: SelectContent,
300
+ Item: SelectItem,
301
+ Group: SelectGroup,
302
+ Separator: SelectSeparator
303
+ });
304
+
305
+ export { ComposedSelect };
@@ -0,0 +1,125 @@
1
+ import {
2
+ uniqueId
3
+ } from "./chunk-8y1jf6xr.js";
4
+ import {
5
+ Keys,
6
+ isKey
7
+ } from "./chunk-7867pr13.js";
8
+ import {
9
+ setDataState,
10
+ setValueRange
11
+ } from "./chunk-vevfhpc9.js";
12
+ import {
13
+ applyAttrs
14
+ } from "./chunk-2db2dnp3.js";
15
+
16
+ // src/slider/slider.tsx
17
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
18
+ import { signal } from "@vertz/ui";
19
+ function SliderRoot(options = {}) {
20
+ const {
21
+ defaultValue = 0,
22
+ min = 0,
23
+ max = 100,
24
+ step = 1,
25
+ disabled = false,
26
+ onValueChange,
27
+ ...attrs
28
+ } = options;
29
+ const state = {
30
+ value: signal(defaultValue),
31
+ disabled: signal(disabled)
32
+ };
33
+ function clamp(val) {
34
+ return Math.min(max, Math.max(min, val));
35
+ }
36
+ function updatePosition(pct2) {
37
+ thumb.style.left = `${pct2}%`;
38
+ fill.style.width = `${pct2}%`;
39
+ }
40
+ function setValue(val) {
41
+ if (state.disabled.peek())
42
+ return;
43
+ const clamped = clamp(val);
44
+ state.value.value = clamped;
45
+ setValueRange(thumb, clamped, min, max);
46
+ const pct2 = (clamped - min) / (max - min) * 100;
47
+ updatePosition(pct2);
48
+ setDataState(root, "active");
49
+ onValueChange?.(clamped);
50
+ }
51
+ function valueFromPointer(event) {
52
+ const rect = track.getBoundingClientRect();
53
+ const pct2 = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
54
+ const raw = min + pct2 * (max - min);
55
+ return Math.round(raw / step) * step;
56
+ }
57
+ const fill = jsxDEV_7x81h0kn("div", {
58
+ "data-part": "fill",
59
+ style: { position: "absolute", height: "100%", borderRadius: "inherit" }
60
+ }, undefined, false, undefined, this);
61
+ const thumb = jsxDEV_7x81h0kn("div", {
62
+ role: "slider",
63
+ tabindex: disabled ? "-1" : "0",
64
+ "data-part": "thumb",
65
+ "aria-disabled": disabled ? "true" : undefined,
66
+ style: { position: "absolute", transform: "translate(-50%, -50%)" },
67
+ onKeydown: (event) => {
68
+ if (state.disabled.peek())
69
+ return;
70
+ const current = state.value.peek();
71
+ if (isKey(event, Keys.ArrowRight, Keys.ArrowUp)) {
72
+ event.preventDefault();
73
+ setValue(current + step);
74
+ } else if (isKey(event, Keys.ArrowLeft, Keys.ArrowDown)) {
75
+ event.preventDefault();
76
+ setValue(current - step);
77
+ } else if (isKey(event, Keys.Home)) {
78
+ event.preventDefault();
79
+ setValue(min);
80
+ } else if (isKey(event, Keys.End)) {
81
+ event.preventDefault();
82
+ setValue(max);
83
+ }
84
+ }
85
+ }, undefined, false, undefined, this);
86
+ setValueRange(thumb, defaultValue, min, max);
87
+ const track = jsxDEV_7x81h0kn("div", {
88
+ "data-part": "track",
89
+ style: { position: "relative" },
90
+ children: [
91
+ fill,
92
+ thumb
93
+ ]
94
+ }, undefined, true, undefined, this);
95
+ const root = jsxDEV_7x81h0kn("div", {
96
+ id: uniqueId("slider"),
97
+ "data-state": disabled ? "disabled" : "active",
98
+ onPointerdown: (event) => {
99
+ if (state.disabled.peek())
100
+ return;
101
+ event.preventDefault();
102
+ setValue(valueFromPointer(event));
103
+ thumb.focus();
104
+ function onMove(e) {
105
+ setValue(valueFromPointer(e));
106
+ }
107
+ function onUp() {
108
+ document.removeEventListener("pointermove", onMove);
109
+ document.removeEventListener("pointerup", onUp);
110
+ }
111
+ document.addEventListener("pointermove", onMove);
112
+ document.addEventListener("pointerup", onUp);
113
+ },
114
+ children: track
115
+ }, undefined, false, undefined, this);
116
+ const pct = (defaultValue - min) / (max - min) * 100;
117
+ updatePosition(pct);
118
+ applyAttrs(root, attrs);
119
+ return { root, thumb, track, state };
120
+ }
121
+ var Slider = {
122
+ Root: SliderRoot
123
+ };
124
+
125
+ export { Slider };
@@ -0,0 +1,200 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ linkedIds
6
+ } from "./chunk-8y1jf6xr.js";
7
+
8
+ // src/dialog/dialog-composed.tsx
9
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
10
+ import { createContext, ref, useContext } from "@vertz/ui";
11
+ var DialogContext = createContext(undefined, "@vertz/ui-primitives::DialogContext");
12
+ function useDialogContext(componentName) {
13
+ const ctx = useContext(DialogContext);
14
+ if (!ctx) {
15
+ throw new Error(`<Dialog.${componentName}> must be used inside <Dialog>. ` + "Ensure it is a direct or nested child of the Dialog root component.");
16
+ }
17
+ return ctx;
18
+ }
19
+ function DialogTrigger({ children }) {
20
+ const ctx = useDialogContext("Trigger");
21
+ return jsxDEV_7x81h0kn("span", {
22
+ style: { display: "contents" },
23
+ "data-dialog-trigger": "",
24
+ "data-state": "closed",
25
+ onClick: () => ctx.toggle(),
26
+ children
27
+ }, undefined, false, undefined, this);
28
+ }
29
+ function DialogContent({
30
+ children,
31
+ className: cls,
32
+ class: classProp,
33
+ showClose = true
34
+ }) {
35
+ const ctx = useDialogContext("Content");
36
+ const el = jsxDEV_7x81h0kn("dialog", {
37
+ ref: ctx.dialogRef,
38
+ id: ctx.contentId,
39
+ role: "dialog",
40
+ "aria-labelledby": ctx.titleId,
41
+ "aria-describedby": ctx.descriptionId,
42
+ "data-state": "closed",
43
+ class: cn(ctx.classes?.content, cls ?? classProp),
44
+ onCancel: (e) => {
45
+ e.preventDefault();
46
+ ctx.close();
47
+ },
48
+ onClick: (e) => {
49
+ if (e.target === ctx.dialogRef.current)
50
+ ctx.close();
51
+ },
52
+ children: [
53
+ showClose && jsxDEV_7x81h0kn("button", {
54
+ type: "button",
55
+ "data-slot": "dialog-close",
56
+ class: cn(ctx.classes?.close),
57
+ "aria-label": "Close",
58
+ onClick: () => ctx.close(),
59
+ children: jsxDEV_7x81h0kn("svg", {
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ "aria-hidden": "true",
62
+ focusable: "false",
63
+ width: "16",
64
+ height: "16",
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ stroke: "currentColor",
68
+ "stroke-width": "2",
69
+ "stroke-linecap": "round",
70
+ "stroke-linejoin": "round",
71
+ children: [
72
+ jsxDEV_7x81h0kn("path", {
73
+ d: "M18 6 6 18"
74
+ }, undefined, false, undefined, this),
75
+ jsxDEV_7x81h0kn("path", {
76
+ d: "m6 6 12 12"
77
+ }, undefined, false, undefined, this)
78
+ ]
79
+ }, undefined, true, undefined, this)
80
+ }, undefined, false, undefined, this),
81
+ children
82
+ ]
83
+ }, undefined, true, undefined, this);
84
+ return el;
85
+ }
86
+ function DialogTitle({ children, className: cls, class: classProp }) {
87
+ const ctx = useDialogContext("Title");
88
+ return jsxDEV_7x81h0kn("h2", {
89
+ id: ctx.titleId,
90
+ class: cn(ctx.classes?.title, cls ?? classProp),
91
+ children
92
+ }, undefined, false, undefined, this);
93
+ }
94
+ function DialogDescription({ children, className: cls, class: classProp }) {
95
+ const ctx = useDialogContext("Description");
96
+ return jsxDEV_7x81h0kn("p", {
97
+ id: ctx.descriptionId,
98
+ class: cn(ctx.classes?.description, cls ?? classProp),
99
+ children
100
+ }, undefined, false, undefined, this);
101
+ }
102
+ function DialogHeader({ children, className: cls, class: classProp }) {
103
+ const { classes } = useDialogContext("Header");
104
+ return jsxDEV_7x81h0kn("div", {
105
+ class: cn(classes?.header, cls ?? classProp),
106
+ children
107
+ }, undefined, false, undefined, this);
108
+ }
109
+ function DialogFooter({ children, className: cls, class: classProp }) {
110
+ const { classes } = useDialogContext("Footer");
111
+ return jsxDEV_7x81h0kn("div", {
112
+ class: cn(classes?.footer, cls ?? classProp),
113
+ children
114
+ }, undefined, false, undefined, this);
115
+ }
116
+ function DialogClose({ children, className: cls, class: classProp }) {
117
+ const ctx = useDialogContext("Close");
118
+ return jsxDEV_7x81h0kn("button", {
119
+ type: "button",
120
+ "data-slot": "dialog-close",
121
+ class: cn(ctx.classes?.close, cls ?? classProp),
122
+ "aria-label": children ? undefined : "Close",
123
+ onClick: () => ctx.close(),
124
+ children: children ?? "×"
125
+ }, undefined, false, undefined, this);
126
+ }
127
+ function ComposedDialogRoot({ children, classes, onOpenChange }) {
128
+ const ids = linkedIds("dialog");
129
+ const titleId = `${ids.contentId}-title`;
130
+ const descriptionId = `${ids.contentId}-description`;
131
+ const dialogRef = ref();
132
+ let isOpen = false;
133
+ function showDialog() {
134
+ const el = dialogRef.current;
135
+ if (!el || el.open)
136
+ return;
137
+ el.setAttribute("data-state", "open");
138
+ el.showModal();
139
+ }
140
+ function hideDialog() {
141
+ const el = dialogRef.current;
142
+ if (!el || !el.open)
143
+ return;
144
+ el.setAttribute("data-state", "closed");
145
+ el.offsetHeight;
146
+ const onEnd = () => {
147
+ el.removeEventListener("animationend", onEnd);
148
+ if (el.open)
149
+ el.close();
150
+ };
151
+ el.addEventListener("animationend", onEnd);
152
+ setTimeout(onEnd, 200);
153
+ }
154
+ function open() {
155
+ isOpen = true;
156
+ showDialog();
157
+ onOpenChange?.(true);
158
+ }
159
+ function close() {
160
+ hideDialog();
161
+ isOpen = false;
162
+ onOpenChange?.(false);
163
+ }
164
+ function toggle() {
165
+ if (isOpen)
166
+ close();
167
+ else
168
+ open();
169
+ }
170
+ const ctx = {
171
+ isOpen,
172
+ titleId,
173
+ descriptionId,
174
+ contentId: ids.contentId,
175
+ dialogRef,
176
+ classes,
177
+ open,
178
+ close,
179
+ toggle
180
+ };
181
+ return jsxDEV_7x81h0kn(DialogContext.Provider, {
182
+ value: ctx,
183
+ children: jsxDEV_7x81h0kn("span", {
184
+ style: { display: "contents" },
185
+ "data-dialog-root": "",
186
+ children
187
+ }, undefined, false, undefined, this)
188
+ }, undefined, false, undefined, this);
189
+ }
190
+ var ComposedDialog = Object.assign(ComposedDialogRoot, {
191
+ Trigger: DialogTrigger,
192
+ Content: DialogContent,
193
+ Title: DialogTitle,
194
+ Description: DialogDescription,
195
+ Header: DialogHeader,
196
+ Footer: DialogFooter,
197
+ Close: DialogClose
198
+ });
199
+
200
+ export { ComposedDialog };