@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
@@ -0,0 +1,256 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ linkedIds
6
+ } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ Keys,
9
+ isKey
10
+ } from "./chunk-7867pr13.js";
11
+ import {
12
+ setHiddenAnimated
13
+ } from "./chunk-vevfhpc9.js";
14
+
15
+ // src/combobox/combobox-composed.tsx
16
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
17
+ import { createContext, ref, useContext } from "@vertz/ui";
18
+ var ComboboxContext = createContext(undefined, "@vertz/ui-primitives::ComboboxContext");
19
+ function useComboboxContext(componentName) {
20
+ const ctx = useContext(ComboboxContext);
21
+ if (!ctx) {
22
+ throw new Error(`<Combobox.${componentName}> must be used inside <ComposedCombobox>. ` + "Ensure it is a direct or nested child of the ComposedCombobox root component.");
23
+ }
24
+ return ctx;
25
+ }
26
+ function ComboboxInput({ className: cls, class: classProp }) {
27
+ const ctx = useComboboxContext("Input");
28
+ return jsxDEV_7x81h0kn("input", {
29
+ ref: ctx.inputRef,
30
+ type: "text",
31
+ role: "combobox",
32
+ "data-combobox-input": "",
33
+ "aria-autocomplete": "list",
34
+ "aria-controls": ctx.contentId,
35
+ "aria-haspopup": "listbox",
36
+ "aria-expanded": "false",
37
+ value: ctx.selectedValue(),
38
+ class: cn(ctx.classes?.input, cls ?? classProp),
39
+ onInput: () => {
40
+ const inputEl = ctx.inputRef.current;
41
+ if (!inputEl)
42
+ return;
43
+ if (!ctx.isOpen())
44
+ ctx.open();
45
+ },
46
+ onFocus: () => {
47
+ const inputEl = ctx.inputRef.current;
48
+ if (!inputEl)
49
+ return;
50
+ if (!ctx.isOpen() && inputEl.value.length > 0)
51
+ ctx.open();
52
+ },
53
+ onKeydown: (event) => {
54
+ if (isKey(event, Keys.Escape)) {
55
+ event.preventDefault();
56
+ ctx.close();
57
+ return;
58
+ }
59
+ if (isKey(event, Keys.ArrowDown)) {
60
+ event.preventDefault();
61
+ if (!ctx.isOpen()) {
62
+ ctx.open();
63
+ }
64
+ const contentEl = ctx.contentRef.current;
65
+ if (!contentEl)
66
+ return;
67
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
68
+ const next = Math.min(ctx.activeIndex() + 1, options.length - 1);
69
+ ctx.setActiveIndex(next);
70
+ ctx.updateActiveDescendant(next);
71
+ return;
72
+ }
73
+ if (isKey(event, Keys.ArrowUp)) {
74
+ event.preventDefault();
75
+ const prev = Math.max(ctx.activeIndex() - 1, 0);
76
+ ctx.setActiveIndex(prev);
77
+ ctx.updateActiveDescendant(prev);
78
+ return;
79
+ }
80
+ if (isKey(event, Keys.Enter)) {
81
+ event.preventDefault();
82
+ const idx = ctx.activeIndex();
83
+ const contentEl = ctx.contentRef.current;
84
+ if (!contentEl)
85
+ return;
86
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
87
+ if (idx >= 0 && idx < options.length) {
88
+ const val = options[idx]?.getAttribute("data-value");
89
+ if (val != null)
90
+ ctx.selectOption(val);
91
+ }
92
+ return;
93
+ }
94
+ }
95
+ }, undefined, false, undefined, this);
96
+ }
97
+ function ComboboxContent({ children, className: cls, class: classProp }) {
98
+ const ctx = useComboboxContext("Content");
99
+ const instanceIndex = ctx._contentCount.value++;
100
+ if (instanceIndex > 0) {
101
+ console.warn("Duplicate <Combobox.Content> detected – only the first is used");
102
+ }
103
+ return jsxDEV_7x81h0kn("div", {
104
+ ref: ctx.contentRef,
105
+ role: "listbox",
106
+ id: ctx.contentId,
107
+ "data-combobox-content": "",
108
+ "aria-hidden": "true",
109
+ "data-state": "closed",
110
+ style: { display: "none" },
111
+ class: cn(ctx.classes?.content, cls ?? classProp),
112
+ children
113
+ }, undefined, false, undefined, this);
114
+ }
115
+ function ComboboxOption({ value, children, className: cls, class: classProp }) {
116
+ const ctx = useComboboxContext("Option");
117
+ const isSelected = ctx.selectedValue() === value;
118
+ const optId = `${ctx.contentId}-opt-${value}`;
119
+ return jsxDEV_7x81h0kn("div", {
120
+ role: "option",
121
+ id: optId,
122
+ "data-combobox-option": "",
123
+ "data-value": value,
124
+ "aria-selected": isSelected ? "true" : "false",
125
+ "data-state": isSelected ? "active" : "inactive",
126
+ class: cn(ctx.classes?.option, cls ?? classProp),
127
+ onClick: () => ctx.selectOption(value),
128
+ children: children ?? value
129
+ }, undefined, false, undefined, this);
130
+ }
131
+ function ComposedComboboxRoot({
132
+ children,
133
+ classes,
134
+ defaultValue = "",
135
+ onValueChange,
136
+ onInputChange
137
+ }) {
138
+ const ids = linkedIds("combobox");
139
+ const inputRef = ref();
140
+ const contentRef = ref();
141
+ const state = {
142
+ isOpen: false,
143
+ selectedValue: defaultValue,
144
+ activeIndex: -1
145
+ };
146
+ function getInputEl() {
147
+ return inputRef.current ?? null;
148
+ }
149
+ function getContentEl() {
150
+ return contentRef.current ?? null;
151
+ }
152
+ function open() {
153
+ state.isOpen = true;
154
+ const inputEl = getInputEl();
155
+ const contentEl = getContentEl();
156
+ if (inputEl) {
157
+ inputEl.setAttribute("aria-expanded", "true");
158
+ }
159
+ if (contentEl) {
160
+ contentEl.setAttribute("data-state", "open");
161
+ contentEl.setAttribute("aria-hidden", "false");
162
+ contentEl.style.display = "";
163
+ }
164
+ }
165
+ function close() {
166
+ state.isOpen = false;
167
+ state.activeIndex = -1;
168
+ const inputEl = getInputEl();
169
+ const contentEl = getContentEl();
170
+ if (inputEl) {
171
+ inputEl.setAttribute("aria-expanded", "false");
172
+ inputEl.removeAttribute("aria-activedescendant");
173
+ }
174
+ if (contentEl) {
175
+ contentEl.setAttribute("data-state", "closed");
176
+ setHiddenAnimated(contentEl, true);
177
+ }
178
+ }
179
+ function selectOption(value) {
180
+ state.selectedValue = value;
181
+ const inputEl = getInputEl();
182
+ if (inputEl) {
183
+ inputEl.value = value;
184
+ }
185
+ const contentEl = getContentEl();
186
+ if (contentEl) {
187
+ const options = contentEl.querySelectorAll('[role="option"]');
188
+ for (const opt of options) {
189
+ const isActive = opt.getAttribute("data-value") === value;
190
+ opt.setAttribute("aria-selected", isActive ? "true" : "false");
191
+ opt.setAttribute("data-state", isActive ? "active" : "inactive");
192
+ }
193
+ }
194
+ onValueChange?.(value);
195
+ close();
196
+ inputEl?.focus();
197
+ }
198
+ function updateActiveDescendant(index) {
199
+ const inputEl = getInputEl();
200
+ const contentEl = getContentEl();
201
+ if (!inputEl || !contentEl)
202
+ return;
203
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
204
+ const opt = options[index];
205
+ if (index >= 0 && opt) {
206
+ inputEl.setAttribute("aria-activedescendant", opt.id);
207
+ for (let i = 0;i < options.length; i++) {
208
+ const el = options[i];
209
+ if (el)
210
+ el.setAttribute("data-state", i === index ? "active" : "inactive");
211
+ }
212
+ } else {
213
+ inputEl.removeAttribute("aria-activedescendant");
214
+ }
215
+ }
216
+ const ctx = {
217
+ isOpen: () => state.isOpen,
218
+ selectedValue: () => state.selectedValue,
219
+ contentId: ids.contentId,
220
+ inputRef,
221
+ contentRef,
222
+ classes,
223
+ open,
224
+ close,
225
+ selectOption,
226
+ activeIndex: () => state.activeIndex,
227
+ setActiveIndex: (index) => {
228
+ state.activeIndex = index;
229
+ },
230
+ updateActiveDescendant,
231
+ _contentCount: { value: 0 }
232
+ };
233
+ const origOpen = ctx.open;
234
+ ctx.open = () => {
235
+ origOpen();
236
+ const inputEl = getInputEl();
237
+ if (inputEl && onInputChange) {
238
+ onInputChange(inputEl.value);
239
+ }
240
+ };
241
+ return jsxDEV_7x81h0kn(ComboboxContext.Provider, {
242
+ value: ctx,
243
+ children: jsxDEV_7x81h0kn("span", {
244
+ style: { display: "contents" },
245
+ "data-combobox-root": "",
246
+ children
247
+ }, undefined, false, undefined, this)
248
+ }, undefined, false, undefined, this);
249
+ }
250
+ var ComposedCombobox = Object.assign(ComposedComboboxRoot, {
251
+ Input: ComboboxInput,
252
+ Content: ComboboxContent,
253
+ Option: ComboboxOption
254
+ });
255
+
256
+ export { ComposedCombobox };
@@ -0,0 +1,185 @@
1
+ import {
2
+ uniqueId
3
+ } from "./chunk-8y1jf6xr.js";
4
+ import {
5
+ Keys,
6
+ isKey
7
+ } from "./chunk-7867pr13.js";
8
+ import {
9
+ setHidden
10
+ } from "./chunk-vevfhpc9.js";
11
+ import {
12
+ applyAttrs
13
+ } from "./chunk-2db2dnp3.js";
14
+
15
+ // src/command/command.tsx
16
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
17
+ import { signal } from "@vertz/ui";
18
+ function CommandRoot(options = {}) {
19
+ const { filter: customFilter, onSelect, onInputChange, placeholder, ...attrs } = options;
20
+ const listId = uniqueId("command-list");
21
+ const state = {
22
+ inputValue: signal(""),
23
+ activeIndex: signal(0)
24
+ };
25
+ const allItems = [];
26
+ const groups = new Map;
27
+ const defaultFilter = (value, search) => {
28
+ return value.toLowerCase().includes(search.toLowerCase());
29
+ };
30
+ const filterFn = customFilter ?? defaultFilter;
31
+ function getVisibleItems() {
32
+ return allItems.filter((item) => item.getAttribute("aria-hidden") !== "true");
33
+ }
34
+ function updateActiveItem() {
35
+ const visible = getVisibleItems();
36
+ const activeIdx = state.activeIndex.peek();
37
+ for (const item of allItems) {
38
+ item.setAttribute("aria-selected", "false");
39
+ }
40
+ if (visible.length > 0 && activeIdx >= 0 && activeIdx < visible.length) {
41
+ visible[activeIdx]?.setAttribute("aria-selected", "true");
42
+ }
43
+ }
44
+ function runFilter() {
45
+ const search = state.inputValue.peek();
46
+ let visibleCount = 0;
47
+ for (const item of allItems) {
48
+ const value = item.getAttribute("data-value") ?? "";
49
+ const text = item.textContent ?? "";
50
+ const keywords = item.getAttribute("data-keywords") ?? "";
51
+ const searchable = `${value} ${text} ${keywords}`;
52
+ const matches = search === "" || filterFn(searchable, search);
53
+ setHidden(item, !matches);
54
+ if (matches)
55
+ visibleCount++;
56
+ }
57
+ for (const [groupEl, group] of groups) {
58
+ const hasVisible = group.items.some((item) => item.getAttribute("aria-hidden") !== "true");
59
+ setHidden(group.heading, !hasVisible);
60
+ if (!hasVisible) {
61
+ groupEl.style.display = "none";
62
+ } else {
63
+ groupEl.style.display = "";
64
+ }
65
+ }
66
+ setHidden(empty, visibleCount > 0);
67
+ state.activeIndex.value = 0;
68
+ updateActiveItem();
69
+ }
70
+ const input = jsxDEV_7x81h0kn("input", {
71
+ type: "text",
72
+ role: "combobox",
73
+ "aria-autocomplete": "list",
74
+ "aria-expanded": "true",
75
+ "aria-controls": listId,
76
+ placeholder,
77
+ onInput: () => {
78
+ state.inputValue.value = input.value;
79
+ onInputChange?.(input.value);
80
+ runFilter();
81
+ },
82
+ onKeydown: (event) => {
83
+ const visible = getVisibleItems();
84
+ if (isKey(event, Keys.ArrowDown)) {
85
+ event.preventDefault();
86
+ const next = Math.min(state.activeIndex.peek() + 1, visible.length - 1);
87
+ state.activeIndex.value = next;
88
+ updateActiveItem();
89
+ return;
90
+ }
91
+ if (isKey(event, Keys.ArrowUp)) {
92
+ event.preventDefault();
93
+ const prev = Math.max(state.activeIndex.peek() - 1, 0);
94
+ state.activeIndex.value = prev;
95
+ updateActiveItem();
96
+ return;
97
+ }
98
+ if (isKey(event, Keys.Enter)) {
99
+ event.preventDefault();
100
+ const active = visible[state.activeIndex.peek()];
101
+ if (active) {
102
+ const val = active.getAttribute("data-value");
103
+ if (val !== null) {
104
+ onSelect?.(val);
105
+ }
106
+ }
107
+ return;
108
+ }
109
+ if (isKey(event, Keys.Escape)) {
110
+ event.preventDefault();
111
+ input.value = "";
112
+ state.inputValue.value = "";
113
+ onInputChange?.("");
114
+ runFilter();
115
+ }
116
+ }
117
+ }, undefined, false, undefined, this);
118
+ const list = jsxDEV_7x81h0kn("div", {
119
+ role: "listbox",
120
+ id: listId
121
+ }, undefined, false, undefined, this);
122
+ const empty = jsxDEV_7x81h0kn("div", {
123
+ "aria-hidden": "true",
124
+ style: { display: "none" }
125
+ }, undefined, false, undefined, this);
126
+ const root = jsxDEV_7x81h0kn("div", {
127
+ children: [
128
+ input,
129
+ list,
130
+ empty
131
+ ]
132
+ }, undefined, true, undefined, this);
133
+ applyAttrs(root, attrs);
134
+ function createItem(value, label, keywords) {
135
+ const item = jsxDEV_7x81h0kn("div", {
136
+ role: "option",
137
+ "data-value": value,
138
+ "aria-selected": "false",
139
+ "data-keywords": keywords && keywords.length > 0 ? keywords.join(" ") : undefined,
140
+ onClick: () => {
141
+ onSelect?.(value);
142
+ },
143
+ children: label ?? value
144
+ }, undefined, false, undefined, this);
145
+ allItems.push(item);
146
+ updateActiveItem();
147
+ return item;
148
+ }
149
+ function Item(value, label, keywords) {
150
+ return createItem(value, label, keywords);
151
+ }
152
+ function Group(label) {
153
+ const headingId = uniqueId("command-group");
154
+ const heading = jsxDEV_7x81h0kn("div", {
155
+ id: headingId,
156
+ children: label
157
+ }, undefined, false, undefined, this);
158
+ const el = jsxDEV_7x81h0kn("div", {
159
+ role: "group",
160
+ "aria-labelledby": headingId,
161
+ children: heading
162
+ }, undefined, false, undefined, this);
163
+ const groupItems = [];
164
+ groups.set(el, { heading, items: groupItems });
165
+ return {
166
+ el,
167
+ Item: (value, itemLabel, keywords) => {
168
+ const item = createItem(value, itemLabel, keywords);
169
+ groupItems.push(item);
170
+ return item;
171
+ }
172
+ };
173
+ }
174
+ function Separator() {
175
+ return jsxDEV_7x81h0kn("hr", {
176
+ role: "separator"
177
+ }, undefined, false, undefined, this);
178
+ }
179
+ return { root, input, list, empty, state, Item, Group, Separator };
180
+ }
181
+ var Command = {
182
+ Root: CommandRoot
183
+ };
184
+
185
+ export { Command };
@@ -0,0 +1,99 @@
1
+ import {
2
+ setRovingTabindex
3
+ } from "./chunk-e2v1c9ex.js";
4
+ import {
5
+ Keys,
6
+ handleListNavigation,
7
+ isKey
8
+ } from "./chunk-7867pr13.js";
9
+ import {
10
+ setDataState,
11
+ setPressed
12
+ } from "./chunk-vevfhpc9.js";
13
+ import {
14
+ applyAttrs
15
+ } from "./chunk-2db2dnp3.js";
16
+
17
+ // src/toggle-group/toggle-group.tsx
18
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
19
+ import { signal } from "@vertz/ui";
20
+ function ToggleGroupRoot(options = {}) {
21
+ const {
22
+ type = "single",
23
+ defaultValue = [],
24
+ orientation = "horizontal",
25
+ disabled = false,
26
+ onValueChange,
27
+ ...attrs
28
+ } = options;
29
+ const state = {
30
+ value: signal([...defaultValue]),
31
+ disabled: signal(disabled)
32
+ };
33
+ const items = [];
34
+ function toggleValue(itemValue) {
35
+ if (state.disabled.peek())
36
+ return;
37
+ const current = [...state.value.peek()];
38
+ const idx = current.indexOf(itemValue);
39
+ if (type === "single") {
40
+ if (idx >= 0) {
41
+ current.length = 0;
42
+ } else {
43
+ current.length = 0;
44
+ current.push(itemValue);
45
+ }
46
+ } else {
47
+ if (idx >= 0) {
48
+ current.splice(idx, 1);
49
+ } else {
50
+ current.push(itemValue);
51
+ }
52
+ }
53
+ state.value.value = current;
54
+ onValueChange?.(current);
55
+ for (const item of items) {
56
+ const val = item.getAttribute("data-value") ?? "";
57
+ const isOn = current.includes(val);
58
+ setPressed(item, isOn);
59
+ setDataState(item, isOn ? "on" : "off");
60
+ }
61
+ }
62
+ const root = jsxDEV_7x81h0kn("div", {
63
+ role: "group",
64
+ "data-orientation": orientation,
65
+ onKeydown: (event) => {
66
+ if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.ArrowUp, Keys.ArrowDown, Keys.Home, Keys.End)) {
67
+ const result = handleListNavigation(event, items, { orientation });
68
+ if (result) {
69
+ const idx = items.indexOf(result);
70
+ if (idx >= 0) {
71
+ setRovingTabindex(items, idx);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }, undefined, false, undefined, this);
77
+ function Item(value) {
78
+ const isOn = state.value.peek().includes(value);
79
+ const item = jsxDEV_7x81h0kn("button", {
80
+ type: "button",
81
+ "data-value": value,
82
+ "aria-pressed": isOn ? "true" : "false",
83
+ "data-state": isOn ? "on" : "off",
84
+ disabled: state.disabled.peek(),
85
+ "aria-disabled": state.disabled.peek() ? "true" : undefined,
86
+ onClick: () => toggleValue(value)
87
+ }, undefined, false, undefined, this);
88
+ items.push(item);
89
+ setRovingTabindex(items, 0);
90
+ return item;
91
+ }
92
+ applyAttrs(root, attrs);
93
+ return { root, state, Item };
94
+ }
95
+ var ToggleGroup = {
96
+ Root: ToggleGroupRoot
97
+ };
98
+
99
+ export { ToggleGroup };
@@ -0,0 +1,69 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/card/card-composed.tsx
6
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
7
+ import { createContext, useContext } from "@vertz/ui";
8
+ var CardContext = createContext(undefined, "@vertz/ui-primitives::CardContext");
9
+ function CardHeader({ children, className, class: classProp }) {
10
+ const ctx = useContext(CardContext);
11
+ return jsxDEV_7x81h0kn("div", {
12
+ class: cn(ctx?.classes?.header, className ?? classProp),
13
+ children
14
+ }, undefined, false, undefined, this);
15
+ }
16
+ function CardTitle({ children, className, class: classProp }) {
17
+ const ctx = useContext(CardContext);
18
+ return jsxDEV_7x81h0kn("h3", {
19
+ class: cn(ctx?.classes?.title, className ?? classProp),
20
+ children
21
+ }, undefined, false, undefined, this);
22
+ }
23
+ function CardDescription({ children, className, class: classProp }) {
24
+ const ctx = useContext(CardContext);
25
+ return jsxDEV_7x81h0kn("p", {
26
+ class: cn(ctx?.classes?.description, className ?? classProp),
27
+ children
28
+ }, undefined, false, undefined, this);
29
+ }
30
+ function CardContent({ children, className, class: classProp }) {
31
+ const ctx = useContext(CardContext);
32
+ return jsxDEV_7x81h0kn("div", {
33
+ class: cn(ctx?.classes?.content, className ?? classProp),
34
+ children
35
+ }, undefined, false, undefined, this);
36
+ }
37
+ function CardFooter({ children, className, class: classProp }) {
38
+ const ctx = useContext(CardContext);
39
+ return jsxDEV_7x81h0kn("div", {
40
+ class: cn(ctx?.classes?.footer, className ?? classProp),
41
+ children
42
+ }, undefined, false, undefined, this);
43
+ }
44
+ function CardAction({ children, className, class: classProp }) {
45
+ const ctx = useContext(CardContext);
46
+ return jsxDEV_7x81h0kn("div", {
47
+ class: cn(ctx?.classes?.action, className ?? classProp),
48
+ children
49
+ }, undefined, false, undefined, this);
50
+ }
51
+ function ComposedCardRoot({ children, classes, className, class: classProp }) {
52
+ return jsxDEV_7x81h0kn(CardContext.Provider, {
53
+ value: { classes },
54
+ children: jsxDEV_7x81h0kn("div", {
55
+ class: cn(classes?.root, className ?? classProp),
56
+ children
57
+ }, undefined, false, undefined, this)
58
+ }, undefined, false, undefined, this);
59
+ }
60
+ var ComposedCard = Object.assign(ComposedCardRoot, {
61
+ Header: CardHeader,
62
+ Title: CardTitle,
63
+ Description: CardDescription,
64
+ Content: CardContent,
65
+ Footer: CardFooter,
66
+ Action: CardAction
67
+ });
68
+
69
+ export { ComposedCard };
@@ -0,0 +1,43 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/avatar/avatar-composed.tsx
6
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
7
+ import { createContext, useContext } from "@vertz/ui";
8
+ var AvatarContext = createContext(undefined, "@vertz/ui-primitives::AvatarContext");
9
+ function AvatarImage({ src, alt, className, class: classProp }) {
10
+ const ctx = useContext(AvatarContext);
11
+ return jsxDEV_7x81h0kn("img", {
12
+ src,
13
+ alt,
14
+ class: cn(ctx?.classes?.image, className ?? classProp)
15
+ }, undefined, false, undefined, this);
16
+ }
17
+ function AvatarFallback({ children, className, class: classProp }) {
18
+ const ctx = useContext(AvatarContext);
19
+ return jsxDEV_7x81h0kn("div", {
20
+ class: cn(ctx?.classes?.fallback, className ?? classProp),
21
+ children
22
+ }, undefined, false, undefined, this);
23
+ }
24
+ function ComposedAvatarRoot({
25
+ children,
26
+ classes,
27
+ className,
28
+ class: classProp
29
+ }) {
30
+ return jsxDEV_7x81h0kn(AvatarContext.Provider, {
31
+ value: { classes },
32
+ children: jsxDEV_7x81h0kn("div", {
33
+ class: cn(classes?.root, className ?? classProp),
34
+ children
35
+ }, undefined, false, undefined, this)
36
+ }, undefined, false, undefined, this);
37
+ }
38
+ var ComposedAvatar = Object.assign(ComposedAvatarRoot, {
39
+ Image: AvatarImage,
40
+ Fallback: AvatarFallback
41
+ });
42
+
43
+ export { ComposedAvatar };
@@ -0,0 +1,48 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ uniqueId
6
+ } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ Keys,
9
+ isKey
10
+ } from "./chunk-7867pr13.js";
11
+
12
+ // src/toggle/toggle-composed.tsx
13
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
14
+ function ComposedToggleRoot({
15
+ children,
16
+ classes,
17
+ defaultPressed = false,
18
+ disabled = false,
19
+ onPressedChange
20
+ }) {
21
+ let pressed = defaultPressed;
22
+ function toggle() {
23
+ if (disabled)
24
+ return;
25
+ pressed = !pressed;
26
+ onPressedChange?.(pressed);
27
+ }
28
+ return jsxDEV_7x81h0kn("button", {
29
+ type: "button",
30
+ id: uniqueId("toggle"),
31
+ "aria-pressed": pressed ? "true" : "false",
32
+ "data-state": pressed ? "on" : "off",
33
+ disabled,
34
+ "aria-disabled": disabled ? "true" : undefined,
35
+ class: cn(classes?.root),
36
+ onClick: toggle,
37
+ onKeydown: (e) => {
38
+ if (isKey(e, Keys.Space)) {
39
+ e.preventDefault();
40
+ toggle();
41
+ }
42
+ },
43
+ children
44
+ }, undefined, false, undefined, this);
45
+ }
46
+ var ComposedToggle = ComposedToggleRoot;
47
+
48
+ export { ComposedToggle };