@vertz/ui-primitives 0.2.23 → 0.2.24

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 (188) hide show
  1. package/dist/shared/{chunk-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
  2. package/dist/shared/chunk-1hm0mbke.js +258 -0
  3. package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
  4. package/dist/shared/chunk-3jack97k.js +509 -0
  5. package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
  6. package/dist/shared/chunk-4gyg71bn.js +178 -0
  7. package/dist/shared/chunk-4z006v1j.js +467 -0
  8. package/dist/shared/{chunk-b25npqer.js → chunk-585ysr70.js} +1 -1
  9. package/dist/shared/chunk-75pegjs7.js +26 -0
  10. package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
  11. package/dist/shared/chunk-7wem1bhb.js +252 -0
  12. package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
  13. package/dist/shared/chunk-8t0nm721.js +152 -0
  14. package/dist/shared/chunk-94twh4s4.js +28 -0
  15. package/dist/shared/chunk-98y1sw9y.js +398 -0
  16. package/dist/shared/chunk-9eedsnnk.js +164 -0
  17. package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
  18. package/dist/shared/chunk-aa3w85hn.js +321 -0
  19. package/dist/shared/chunk-axpbdpgx.js +177 -0
  20. package/dist/shared/chunk-b4zzg457.js +410 -0
  21. package/dist/shared/chunk-brk0drrk.js +202 -0
  22. package/dist/shared/chunk-czv0kqj4.js +107 -0
  23. package/dist/shared/chunk-d83ag07h.js +189 -0
  24. package/dist/shared/{chunk-3kwh27dv.js → chunk-de18ashk.js} +0 -1
  25. package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
  26. package/dist/shared/chunk-e6660g7e.js +179 -0
  27. package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
  28. package/dist/shared/chunk-ev367pq3.js +102 -0
  29. package/dist/shared/{chunk-4894pmy6.js → chunk-f0wy7k56.js} +0 -1
  30. package/dist/shared/chunk-fjykbv0v.js +214 -0
  31. package/dist/shared/chunk-ghkw5bjq.js +55 -0
  32. package/dist/shared/chunk-gqb1n1hj.js +60 -0
  33. package/dist/shared/chunk-hfjtkytb.js +310 -0
  34. package/dist/shared/chunk-hpvjfj0j.js +31 -0
  35. package/dist/shared/chunk-hxmxvp56.js +67 -0
  36. package/dist/shared/chunk-j9m2f0rd.js +162 -0
  37. package/dist/shared/chunk-jpyjk616.js +52 -0
  38. package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
  39. package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
  40. package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
  41. package/dist/shared/chunk-kskxxc2q.js +228 -0
  42. package/dist/shared/chunk-metxdt5x.js +28 -0
  43. package/dist/shared/chunk-mhn2aazf.js +353 -0
  44. package/dist/shared/chunk-mtx2cfbx.js +175 -0
  45. package/dist/shared/chunk-nsmvdxgp.js +213 -0
  46. package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
  47. package/dist/shared/chunk-pzknpa1y.js +327 -0
  48. package/dist/shared/chunk-q1ff3xp3.js +95 -0
  49. package/dist/shared/chunk-q7xbcj9q.js +7 -0
  50. package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
  51. package/dist/shared/chunk-qrm43tr3.js +357 -0
  52. package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
  53. package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
  54. package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
  55. package/dist/shared/chunk-r3ngaa64.js +418 -0
  56. package/dist/shared/chunk-r3pffzss.js +13 -0
  57. package/dist/shared/chunk-rrt62bp0.js +353 -0
  58. package/dist/shared/chunk-s24gkmna.js +131 -0
  59. package/dist/shared/chunk-s62e7jf4.js +30 -0
  60. package/dist/shared/chunk-spng4yb9.js +73 -0
  61. package/dist/shared/chunk-v0b5pkcq.js +30 -0
  62. package/dist/shared/chunk-v11kd39k.js +162 -0
  63. package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
  64. package/dist/shared/chunk-vkscwzpr.js +294 -0
  65. package/dist/shared/chunk-vv187snj.js +112 -0
  66. package/dist/shared/chunk-wqsek87j.js +311 -0
  67. package/dist/shared/chunk-wtkxz2te.js +157 -0
  68. package/dist/shared/chunk-y1hpsqzy.js +185 -0
  69. package/dist/shared/chunk-yfzddvxc.js +71 -0
  70. package/dist/src/accordion/accordion-composed.d.ts +30 -0
  71. package/dist/src/accordion/accordion-composed.js +6 -0
  72. package/dist/src/accordion/accordion.js +1 -1
  73. package/dist/src/alert/alert-composed.d.ts +26 -0
  74. package/dist/src/alert/alert-composed.js +6 -0
  75. package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
  76. package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
  77. package/dist/src/avatar/avatar-composed.d.ts +33 -0
  78. package/dist/src/avatar/avatar-composed.js +6 -0
  79. package/dist/src/badge/badge-composed.d.ts +33 -0
  80. package/dist/src/badge/badge-composed.js +6 -0
  81. package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
  82. package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
  83. package/dist/src/button/button-composed.d.ts +34 -0
  84. package/dist/src/button/button-composed.js +6 -0
  85. package/dist/src/calendar/calendar-composed.d.ts +42 -0
  86. package/dist/src/calendar/calendar-composed.js +6 -0
  87. package/dist/src/calendar/calendar.js +1 -1
  88. package/dist/src/card/card-composed.d.ts +34 -0
  89. package/dist/src/card/card-composed.js +6 -0
  90. package/dist/src/carousel/carousel-composed.d.ts +32 -0
  91. package/dist/src/carousel/carousel-composed.js +6 -0
  92. package/dist/src/carousel/carousel.js +1 -1
  93. package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
  94. package/dist/src/checkbox/checkbox-composed.js +6 -0
  95. package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
  96. package/dist/src/collapsible/collapsible-composed.js +6 -0
  97. package/dist/src/combobox/combobox-composed.d.ts +30 -0
  98. package/dist/src/combobox/combobox-composed.js +6 -0
  99. package/dist/src/combobox/combobox.js +1 -1
  100. package/dist/src/command/command-composed.d.ts +67 -0
  101. package/dist/src/command/command-composed.js +6 -0
  102. package/dist/src/command/command.js +1 -1
  103. package/dist/src/composed/with-styles.d.ts +38 -0
  104. package/dist/src/composed/with-styles.js +6 -0
  105. package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
  106. package/dist/src/context-menu/context-menu-composed.js +6 -0
  107. package/dist/src/context-menu/context-menu.js +1 -1
  108. package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
  109. package/dist/src/date-picker/date-picker-composed.js +6 -0
  110. package/dist/src/date-picker/date-picker.js +1 -1
  111. package/dist/src/dialog/dialog-composed.d.ts +36 -0
  112. package/dist/src/dialog/dialog-composed.js +6 -0
  113. package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
  114. package/dist/src/dialog/dialog-stack-parts.js +18 -0
  115. package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
  116. package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
  117. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  118. package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
  119. package/dist/src/empty-state/empty-state-composed.js +6 -0
  120. package/dist/src/form-group/form-group-composed.d.ts +24 -0
  121. package/dist/src/form-group/form-group-composed.js +6 -0
  122. package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
  123. package/dist/src/hover-card/hover-card-composed.js +6 -0
  124. package/dist/src/hover-card/hover-card.js +1 -1
  125. package/dist/src/index.d.ts +1284 -817
  126. package/dist/src/index.js +78 -6566
  127. package/dist/src/input/input-composed.d.ts +35 -0
  128. package/dist/src/input/input-composed.js +6 -0
  129. package/dist/src/label/label-composed.d.ts +32 -0
  130. package/dist/src/label/label-composed.js +6 -0
  131. package/dist/src/menu/menu-composed.d.ts +51 -0
  132. package/dist/src/menu/menu-composed.js +6 -0
  133. package/dist/src/menu/menu.js +1 -1
  134. package/dist/src/menubar/menubar-composed.d.ts +56 -0
  135. package/dist/src/menubar/menubar-composed.js +6 -0
  136. package/dist/src/menubar/menubar.js +1 -1
  137. package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
  138. package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
  139. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  140. package/dist/src/pagination/pagination-composed.d.ts +30 -0
  141. package/dist/src/pagination/pagination-composed.js +6 -0
  142. package/dist/src/popover/popover-composed.d.ts +36 -0
  143. package/dist/src/popover/popover-composed.js +6 -0
  144. package/dist/src/popover/popover.js +1 -1
  145. package/dist/src/progress/progress-composed.d.ts +17 -0
  146. package/dist/src/progress/progress-composed.js +6 -0
  147. package/dist/src/radio/radio-composed.d.ts +24 -0
  148. package/dist/src/radio/radio-composed.js +6 -0
  149. package/dist/src/radio/radio.js +1 -1
  150. package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
  151. package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
  152. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  153. package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
  154. package/dist/src/scroll-area/scroll-area-composed.js +6 -0
  155. package/dist/src/scroll-area/scroll-area.js +1 -1
  156. package/dist/src/select/select-composed.d.ts +53 -0
  157. package/dist/src/select/select-composed.js +6 -0
  158. package/dist/src/select/select.js +1 -1
  159. package/dist/src/separator/separator-composed.d.ts +32 -0
  160. package/dist/src/separator/separator-composed.js +6 -0
  161. package/dist/src/sheet/sheet-composed.d.ts +34 -0
  162. package/dist/src/sheet/sheet-composed.js +6 -0
  163. package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
  164. package/dist/src/skeleton/skeleton-composed.js +6 -0
  165. package/dist/src/slider/slider-composed.d.ts +22 -0
  166. package/dist/src/slider/slider-composed.js +6 -0
  167. package/dist/src/switch/switch-composed.d.ts +17 -0
  168. package/dist/src/switch/switch-composed.js +6 -0
  169. package/dist/src/table/table-composed.d.ts +34 -0
  170. package/dist/src/table/table-composed.js +6 -0
  171. package/dist/src/tabs/tabs-composed.d.ts +33 -0
  172. package/dist/src/tabs/tabs-composed.js +6 -0
  173. package/dist/src/tabs/tabs.js +1 -1
  174. package/dist/src/textarea/textarea-composed.d.ts +35 -0
  175. package/dist/src/textarea/textarea-composed.js +6 -0
  176. package/dist/src/toast/toast.js +1 -1
  177. package/dist/src/toggle/toggle-composed.d.ts +16 -0
  178. package/dist/src/toggle/toggle-composed.js +6 -0
  179. package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
  180. package/dist/src/toggle-group/toggle-group-composed.js +6 -0
  181. package/dist/src/toggle-group/toggle-group.js +1 -1
  182. package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
  183. package/dist/src/tooltip/tooltip-composed.js +6 -0
  184. package/dist/src/tooltip/tooltip.js +1 -1
  185. package/dist/src/utils.js +1 -1
  186. package/package.json +3 -3
  187. package/dist/shared/chunk-56reyd5r.js +0 -64
  188. package/dist/shared/chunk-mgr904ap.js +0 -370
@@ -0,0 +1,311 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ Keys,
6
+ isKey
7
+ } from "./chunk-7867pr13.js";
8
+ import {
9
+ setHiddenAnimated
10
+ } from "./chunk-vevfhpc9.js";
11
+ import {
12
+ linkedIds
13
+ } from "./chunk-8y1jf6xr.js";
14
+
15
+ // src/combobox/combobox-composed.tsx
16
+ import { computed } from "@vertz/ui";
17
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
18
+ import { createContext, ref, useContext } from "@vertz/ui";
19
+ var ComboboxContext = createContext(undefined, "@vertz/ui-primitives::ComboboxContext");
20
+ function useComboboxContext(componentName) {
21
+ const ctx = useContext(ComboboxContext);
22
+ if (!ctx) {
23
+ throw new Error(`<Combobox.${componentName}> must be used inside <ComposedCombobox>. ` + "Ensure it is a direct or nested child of the ComposedCombobox root component.");
24
+ }
25
+ return ctx;
26
+ }
27
+ function ComboboxInput(__props) {
28
+ const __mfDepth = __pushMountFrame();
29
+ try {
30
+ const ctx = useComboboxContext("Input");
31
+ const __mfResult0 = (() => {
32
+ const __el0 = __element("input");
33
+ ctx.inputRef.current = __el0;
34
+ __el0.setAttribute("type", "text");
35
+ __el0.setAttribute("role", "combobox");
36
+ __el0.setAttribute("data-combobox-input", "");
37
+ __el0.setAttribute("aria-autocomplete", "list");
38
+ {
39
+ const __v = ctx.contentId;
40
+ if (__v != null && __v !== false)
41
+ __el0.setAttribute("aria-controls", __v === true ? "" : __v);
42
+ }
43
+ __el0.setAttribute("aria-haspopup", "listbox");
44
+ __el0.setAttribute("aria-expanded", "false");
45
+ {
46
+ const __v = ctx.selectedValue();
47
+ if (__v != null)
48
+ __el0.value = __v;
49
+ }
50
+ __attr(__el0, "class", () => cn(ctx.classes?.input, __props.className ?? __props.class));
51
+ __on(__el0, "input", () => {
52
+ const inputEl = ctx.inputRef.current;
53
+ if (!inputEl)
54
+ return;
55
+ if (!ctx.isOpen())
56
+ ctx.open();
57
+ });
58
+ __on(__el0, "focus", () => {
59
+ const inputEl = ctx.inputRef.current;
60
+ if (!inputEl)
61
+ return;
62
+ if (!ctx.isOpen() && inputEl.value.length > 0)
63
+ ctx.open();
64
+ });
65
+ __on(__el0, "keydown", (event) => {
66
+ if (isKey(event, Keys.Escape)) {
67
+ event.preventDefault();
68
+ ctx.close();
69
+ return;
70
+ }
71
+ if (isKey(event, Keys.ArrowDown)) {
72
+ event.preventDefault();
73
+ if (!ctx.isOpen()) {
74
+ ctx.open();
75
+ }
76
+ const contentEl = ctx.contentRef.current;
77
+ if (!contentEl)
78
+ return;
79
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
80
+ const next = Math.min(ctx.activeIndex() + 1, options.length - 1);
81
+ ctx.setActiveIndex(next);
82
+ ctx.updateActiveDescendant(next);
83
+ return;
84
+ }
85
+ if (isKey(event, Keys.ArrowUp)) {
86
+ event.preventDefault();
87
+ const prev = Math.max(ctx.activeIndex() - 1, 0);
88
+ ctx.setActiveIndex(prev);
89
+ ctx.updateActiveDescendant(prev);
90
+ return;
91
+ }
92
+ if (isKey(event, Keys.Enter)) {
93
+ event.preventDefault();
94
+ const idx = ctx.activeIndex();
95
+ const contentEl = ctx.contentRef.current;
96
+ if (!contentEl)
97
+ return;
98
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
99
+ if (idx >= 0 && idx < options.length) {
100
+ const val = options[idx]?.getAttribute("data-value");
101
+ if (val != null)
102
+ ctx.selectOption(val);
103
+ }
104
+ return;
105
+ }
106
+ });
107
+ return __el0;
108
+ })();
109
+ __flushMountFrame();
110
+ return __mfResult0;
111
+ } catch (__mfErr) {
112
+ __discardMountFrame(__mfDepth);
113
+ throw __mfErr;
114
+ }
115
+ }
116
+ function ComboboxContent(__props) {
117
+ const __mfDepth = __pushMountFrame();
118
+ try {
119
+ const ctx = useComboboxContext("Content");
120
+ const instanceIndex = ctx._contentCount.value++;
121
+ if (instanceIndex > 0) {
122
+ console.warn("Duplicate <Combobox.Content> detected – only the first is used");
123
+ }
124
+ const __mfResult0 = (() => {
125
+ const __el0 = __element("div");
126
+ ctx.contentRef.current = __el0;
127
+ __el0.setAttribute("role", "listbox");
128
+ {
129
+ const __v = ctx.contentId;
130
+ if (__v != null && __v !== false)
131
+ __el0.setAttribute("id", __v === true ? "" : __v);
132
+ }
133
+ __el0.setAttribute("data-combobox-content", "");
134
+ __el0.setAttribute("aria-hidden", "true");
135
+ __el0.setAttribute("data-state", "closed");
136
+ {
137
+ const __v = { display: "none" };
138
+ if (__v != null && __v !== false)
139
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
140
+ }
141
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
142
+ __enterChildren(__el0);
143
+ __append(__el0, __child(() => __props.children));
144
+ __exitChildren();
145
+ return __el0;
146
+ })();
147
+ __flushMountFrame();
148
+ return __mfResult0;
149
+ } catch (__mfErr) {
150
+ __discardMountFrame(__mfDepth);
151
+ throw __mfErr;
152
+ }
153
+ }
154
+ function ComboboxOption(__props) {
155
+ const __mfDepth = __pushMountFrame();
156
+ try {
157
+ const ctx = useComboboxContext("Option");
158
+ const isSelected = computed(() => ctx.selectedValue() === __props.value);
159
+ const optId = computed(() => `${ctx.contentId}-opt-${__props.value}`);
160
+ const __mfResult0 = (() => {
161
+ const __el0 = __element("div");
162
+ __el0.setAttribute("role", "option");
163
+ __attr(__el0, "id", () => optId.value);
164
+ __el0.setAttribute("data-combobox-option", "");
165
+ __attr(__el0, "data-value", () => __props.value);
166
+ __attr(__el0, "aria-selected", () => isSelected.value ? "true" : "false");
167
+ __attr(__el0, "data-state", () => isSelected.value ? "active" : "inactive");
168
+ __attr(__el0, "class", () => cn(ctx.classes?.option, __props.className ?? __props.class));
169
+ __on(__el0, "click", () => ctx.selectOption(__props.value));
170
+ __enterChildren(__el0);
171
+ __append(__el0, __child(() => __props.children ?? __props.value));
172
+ __exitChildren();
173
+ return __el0;
174
+ })();
175
+ __flushMountFrame();
176
+ return __mfResult0;
177
+ } catch (__mfErr) {
178
+ __discardMountFrame(__mfDepth);
179
+ throw __mfErr;
180
+ }
181
+ }
182
+ function ComposedComboboxRoot(__props) {
183
+ const __mfDepth = __pushMountFrame();
184
+ try {
185
+ let getInputEl = function() {
186
+ return inputRef.current ?? null;
187
+ }, getContentEl = function() {
188
+ return contentRef.current ?? null;
189
+ }, open = function() {
190
+ state.isOpen = true;
191
+ const inputEl = getInputEl();
192
+ const contentEl = getContentEl();
193
+ if (inputEl) {
194
+ inputEl.setAttribute("aria-expanded", "true");
195
+ }
196
+ if (contentEl) {
197
+ contentEl.setAttribute("data-state", "open");
198
+ contentEl.setAttribute("aria-hidden", "false");
199
+ contentEl.style.display = "";
200
+ }
201
+ }, close = function() {
202
+ state.isOpen = false;
203
+ state.activeIndex = -1;
204
+ const inputEl = getInputEl();
205
+ const contentEl = getContentEl();
206
+ if (inputEl) {
207
+ inputEl.setAttribute("aria-expanded", "false");
208
+ inputEl.removeAttribute("aria-activedescendant");
209
+ }
210
+ if (contentEl) {
211
+ contentEl.setAttribute("data-state", "closed");
212
+ setHiddenAnimated(contentEl, true);
213
+ }
214
+ }, selectOption = function(value) {
215
+ state.selectedValue = value;
216
+ const inputEl = getInputEl();
217
+ if (inputEl) {
218
+ inputEl.value = value;
219
+ }
220
+ const contentEl = getContentEl();
221
+ if (contentEl) {
222
+ const options = contentEl.querySelectorAll('[role="option"]');
223
+ for (const opt of options) {
224
+ const isActive = opt.getAttribute("data-value") === value;
225
+ opt.setAttribute("aria-selected", isActive ? "true" : "false");
226
+ opt.setAttribute("data-state", isActive ? "active" : "inactive");
227
+ }
228
+ }
229
+ __props.onValueChange?.(value);
230
+ close();
231
+ inputEl?.focus();
232
+ }, updateActiveDescendant = function(index) {
233
+ const inputEl = getInputEl();
234
+ const contentEl = getContentEl();
235
+ if (!inputEl || !contentEl)
236
+ return;
237
+ const options = [...contentEl.querySelectorAll('[role="option"]')];
238
+ const opt = options[index];
239
+ if (index >= 0 && opt) {
240
+ inputEl.setAttribute("aria-activedescendant", opt.id);
241
+ for (let i = 0;i < options.length; i++) {
242
+ const el = options[i];
243
+ if (el)
244
+ el.setAttribute("data-state", i === index ? "active" : "inactive");
245
+ }
246
+ } else {
247
+ inputEl.removeAttribute("aria-activedescendant");
248
+ }
249
+ };
250
+ const ids = linkedIds("combobox");
251
+ const inputRef = ref();
252
+ const contentRef = ref();
253
+ const state = {
254
+ isOpen: false,
255
+ selectedValue: __props.defaultValue ?? "",
256
+ activeIndex: -1
257
+ };
258
+ const ctx = {
259
+ isOpen: () => state.isOpen,
260
+ selectedValue: () => state.selectedValue,
261
+ contentId: ids.contentId,
262
+ inputRef,
263
+ contentRef,
264
+ classes: __props.classes,
265
+ open,
266
+ close,
267
+ selectOption,
268
+ activeIndex: () => state.activeIndex,
269
+ setActiveIndex: (index) => {
270
+ state.activeIndex = index;
271
+ },
272
+ updateActiveDescendant,
273
+ _contentCount: { value: 0 }
274
+ };
275
+ const origOpen = ctx.open;
276
+ ctx.open = () => {
277
+ origOpen();
278
+ const inputEl = getInputEl();
279
+ if (inputEl && __props.onInputChange) {
280
+ __props.onInputChange(inputEl.value);
281
+ }
282
+ };
283
+ const __mfResult0 = ComboboxContext.Provider({ get value() {
284
+ return ctx;
285
+ }, children: () => (() => {
286
+ const __el0 = __element("span");
287
+ {
288
+ const __v = { display: "contents" };
289
+ if (__v != null && __v !== false)
290
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
291
+ }
292
+ __el0.setAttribute("data-combobox-root", "");
293
+ __enterChildren(__el0);
294
+ __append(__el0, __child(() => __props.children));
295
+ __exitChildren();
296
+ return __el0;
297
+ })() });
298
+ __flushMountFrame();
299
+ return __mfResult0;
300
+ } catch (__mfErr) {
301
+ __discardMountFrame(__mfDepth);
302
+ throw __mfErr;
303
+ }
304
+ }
305
+ var ComposedCombobox = Object.assign(ComposedComboboxRoot, {
306
+ Input: ComboboxInput,
307
+ Content: ComboboxContent,
308
+ Option: ComboboxOption
309
+ });
310
+
311
+ export { ComposedCombobox };
@@ -0,0 +1,157 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ Keys,
6
+ isKey
7
+ } from "./chunk-7867pr13.js";
8
+ import {
9
+ setValueRange
10
+ } from "./chunk-vevfhpc9.js";
11
+ import {
12
+ uniqueId
13
+ } from "./chunk-8y1jf6xr.js";
14
+
15
+ // src/slider/slider-composed.tsx
16
+ import { computed, signal } from "@vertz/ui";
17
+ import { __append, __attr, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
18
+ import { ref } from "@vertz/ui";
19
+ function ComposedSliderRoot(__props) {
20
+ const __mfDepth = __pushMountFrame();
21
+ try {
22
+ let clamp = function(val) {
23
+ return Math.min(__props.max ?? 100, Math.max(__props.min ?? 0, val));
24
+ }, updatePosition = function(pct) {
25
+ const thumb = thumbRef.current;
26
+ const fill = fillRef.current;
27
+ if (thumb)
28
+ thumb.style.left = `${pct}%`;
29
+ if (fill)
30
+ fill.style.width = `${pct}%`;
31
+ }, setValue = function(val) {
32
+ if (__props.disabled ?? false)
33
+ return;
34
+ const clamped = clamp(val);
35
+ currentValue.value = clamped;
36
+ const thumb = thumbRef.current;
37
+ if (thumb)
38
+ setValueRange(thumb, clamped, __props.min ?? 0, __props.max ?? 100);
39
+ const pct = (clamped - (__props.min ?? 0)) / ((__props.max ?? 100) - (__props.min ?? 0)) * 100;
40
+ updatePosition(pct);
41
+ __props.onValueChange?.(clamped);
42
+ }, valueFromPointer = function(event) {
43
+ const track = trackRef.current;
44
+ if (!track)
45
+ return __props.min ?? 0;
46
+ const rect = track.getBoundingClientRect();
47
+ const pct = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
48
+ const raw = (__props.min ?? 0) + pct * ((__props.max ?? 100) - (__props.min ?? 0));
49
+ return Math.round(raw / (__props.step ?? 1)) * (__props.step ?? 1);
50
+ };
51
+ const currentValue = signal(__props.defaultValue ?? 0, "currentValue");
52
+ const thumbRef = ref();
53
+ const fillRef = ref();
54
+ const trackRef = ref();
55
+ const initialPct = computed(() => ((__props.defaultValue ?? 0) - (__props.min ?? 0)) / ((__props.max ?? 100) - (__props.min ?? 0)) * 100);
56
+ const __mfResult0 = (() => {
57
+ const __el0 = __element("div");
58
+ __el0.setAttribute("data-v-id", "ComposedSliderRoot");
59
+ {
60
+ const __v = uniqueId("slider");
61
+ if (__v != null && __v !== false)
62
+ __el0.setAttribute("id", __v === true ? "" : __v);
63
+ }
64
+ __attr(__el0, "data-state", () => __props.disabled ?? false ? "disabled" : "active");
65
+ __attr(__el0, "class", () => cn(__props.classes?.root));
66
+ __on(__el0, "pointerdown", (event) => {
67
+ if (__props.disabled ?? false)
68
+ return;
69
+ event.preventDefault();
70
+ setValue(valueFromPointer(event));
71
+ thumbRef.current?.focus();
72
+ function onMove(e) {
73
+ setValue(valueFromPointer(e));
74
+ }
75
+ function onUp() {
76
+ document.removeEventListener("pointermove", onMove);
77
+ document.removeEventListener("pointerup", onUp);
78
+ }
79
+ document.addEventListener("pointermove", onMove);
80
+ document.addEventListener("pointerup", onUp);
81
+ });
82
+ __enterChildren(__el0);
83
+ __append(__el0, (() => {
84
+ const __el1 = __element("div");
85
+ trackRef.current = __el1;
86
+ __el1.setAttribute("data-part", "track");
87
+ {
88
+ const __v = { position: "relative" };
89
+ if (__v != null && __v !== false)
90
+ __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
91
+ }
92
+ __attr(__el1, "class", () => cn(__props.classes?.track));
93
+ __enterChildren(__el1);
94
+ __append(__el1, (() => {
95
+ const __el2 = __element("div");
96
+ fillRef.current = __el2;
97
+ __el2.setAttribute("data-part", "fill");
98
+ __attr(__el2, "style", () => ({
99
+ position: "absolute",
100
+ height: "100%",
101
+ borderRadius: "inherit",
102
+ width: `${initialPct.value}%`
103
+ }));
104
+ __attr(__el2, "class", () => cn(__props.classes?.range));
105
+ return __el2;
106
+ })());
107
+ __append(__el1, (() => {
108
+ const __el3 = __element("div");
109
+ thumbRef.current = __el3;
110
+ __el3.setAttribute("role", "slider");
111
+ __attr(__el3, "tabindex", () => __props.disabled ?? false ? "-1" : "0");
112
+ __el3.setAttribute("data-part", "thumb");
113
+ __attr(__el3, "aria-valuenow", () => String(__props.defaultValue ?? 0));
114
+ __attr(__el3, "aria-valuemin", () => String(__props.min ?? 0));
115
+ __attr(__el3, "aria-valuemax", () => String(__props.max ?? 100));
116
+ __attr(__el3, "aria-disabled", () => __props.disabled ?? false ? "true" : undefined);
117
+ __attr(__el3, "style", () => ({
118
+ position: "absolute",
119
+ transform: "translate(-50%, -50%)",
120
+ left: `${initialPct.value}%`
121
+ }));
122
+ __attr(__el3, "class", () => cn(__props.classes?.thumb));
123
+ __on(__el3, "keydown", (event) => {
124
+ if (__props.disabled ?? false)
125
+ return;
126
+ if (isKey(event, Keys.ArrowRight, Keys.ArrowUp)) {
127
+ event.preventDefault();
128
+ setValue(currentValue.value + (__props.step ?? 1));
129
+ } else if (isKey(event, Keys.ArrowLeft, Keys.ArrowDown)) {
130
+ event.preventDefault();
131
+ setValue(currentValue.value - (__props.step ?? 1));
132
+ } else if (isKey(event, Keys.Home)) {
133
+ event.preventDefault();
134
+ setValue(__props.min ?? 0);
135
+ } else if (isKey(event, Keys.End)) {
136
+ event.preventDefault();
137
+ setValue(__props.max ?? 100);
138
+ }
139
+ });
140
+ return __el3;
141
+ })());
142
+ __exitChildren();
143
+ return __el1;
144
+ })());
145
+ __exitChildren();
146
+ return __el0;
147
+ })();
148
+ __flushMountFrame();
149
+ return __mfResult0;
150
+ } catch (__mfErr) {
151
+ __discardMountFrame(__mfDepth);
152
+ throw __mfErr;
153
+ }
154
+ }
155
+ var ComposedSlider = ComposedSliderRoot;
156
+
157
+ export { ComposedSlider };
@@ -0,0 +1,185 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ createFloatingPosition,
6
+ resolveLayoutElement
7
+ } from "./chunk-vef3sepw.js";
8
+ import {
9
+ uniqueId
10
+ } from "./chunk-8y1jf6xr.js";
11
+
12
+ // src/tooltip/tooltip-composed.tsx
13
+ import { computed, signal } from "@vertz/ui";
14
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
15
+ import { createContext, ref, useContext } from "@vertz/ui";
16
+ var TooltipContext = createContext(undefined, "@vertz/ui-primitives::TooltipContext");
17
+ function useTooltipContext(componentName) {
18
+ const ctx = useContext(TooltipContext);
19
+ if (!ctx) {
20
+ throw new Error(`<Tooltip.${componentName}> must be used inside <Tooltip>. ` + "Ensure it is a direct or nested child of the Tooltip root component.");
21
+ }
22
+ return ctx;
23
+ }
24
+ function TooltipTrigger(__props) {
25
+ const __mfDepth = __pushMountFrame();
26
+ try {
27
+ const ctx = useTooltipContext("Trigger");
28
+ const idx = ctx._triggerCount.value++;
29
+ if (idx > 0)
30
+ console.warn("Duplicate <Tooltip.Trigger> detected – only the first is used");
31
+ const childNodes = computed(() => Array.isArray(__props.children) ? __props.children : [__props.children]);
32
+ const childEl = computed(() => childNodes.value.find((c) => c instanceof HTMLElement));
33
+ if (childEl.value) {
34
+ childEl.value.setAttribute("aria-describedby", ctx.contentId);
35
+ }
36
+ const __mfResult0 = (() => {
37
+ const __el0 = __element("span");
38
+ {
39
+ const __v = { display: "contents" };
40
+ if (__v != null && __v !== false)
41
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
42
+ }
43
+ __el0.setAttribute("data-tooltip-trigger", "");
44
+ {
45
+ const __v = ctx.contentId;
46
+ if (__v != null && __v !== false)
47
+ __el0.setAttribute("aria-describedby", __v === true ? "" : __v);
48
+ }
49
+ __on(__el0, "mouseenter", () => ctx.show());
50
+ __on(__el0, "mouseleave", () => ctx.hide());
51
+ __on(__el0, "focus", () => ctx.show());
52
+ __on(__el0, "blur", () => ctx.hide());
53
+ __enterChildren(__el0);
54
+ __append(__el0, __child(() => __props.children));
55
+ __exitChildren();
56
+ return __el0;
57
+ })();
58
+ __flushMountFrame();
59
+ return __mfResult0;
60
+ } catch (__mfErr) {
61
+ __discardMountFrame(__mfDepth);
62
+ throw __mfErr;
63
+ }
64
+ }
65
+ function TooltipContent(__props) {
66
+ const __mfDepth = __pushMountFrame();
67
+ try {
68
+ const ctx = useTooltipContext("Content");
69
+ const idx = ctx._contentCount.value++;
70
+ if (idx > 0)
71
+ console.warn("Duplicate <Tooltip.Content> detected – only the first is used");
72
+ const isOpen = ctx.isOpen();
73
+ const __mfResult0 = (() => {
74
+ const __el0 = __element("div");
75
+ ctx.contentRef.current = __el0;
76
+ __el0.setAttribute("role", "tooltip");
77
+ {
78
+ const __v = ctx.contentId;
79
+ if (__v != null && __v !== false)
80
+ __el0.setAttribute("id", __v === true ? "" : __v);
81
+ }
82
+ __el0.setAttribute("data-tooltip-content", "");
83
+ {
84
+ const __v = isOpen ? "false" : "true";
85
+ if (__v != null && __v !== false)
86
+ __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
87
+ }
88
+ {
89
+ const __v = isOpen ? "open" : "closed";
90
+ if (__v != null && __v !== false)
91
+ __el0.setAttribute("data-state", __v === true ? "" : __v);
92
+ }
93
+ {
94
+ const __v = { display: isOpen ? "" : "none" };
95
+ if (__v != null && __v !== false)
96
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
97
+ }
98
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
99
+ __enterChildren(__el0);
100
+ __append(__el0, __child(() => __props.children));
101
+ __exitChildren();
102
+ return __el0;
103
+ })();
104
+ __flushMountFrame();
105
+ return __mfResult0;
106
+ } catch (__mfErr) {
107
+ __discardMountFrame(__mfDepth);
108
+ throw __mfErr;
109
+ }
110
+ }
111
+ function ComposedTooltipRoot(__props) {
112
+ const __mfDepth = __pushMountFrame();
113
+ try {
114
+ let applyPositioning = function() {
115
+ const content = contentRef.current;
116
+ const triggerSpan = content?.parentElement?.querySelector("[data-tooltip-trigger]");
117
+ if (!triggerSpan || !content)
118
+ return;
119
+ const trigger = resolveLayoutElement(triggerSpan);
120
+ content.style.position = "fixed";
121
+ const floatingOpts = __props.positioning ?? { placement: "top", offset: 4 };
122
+ const result = createFloatingPosition(trigger, content, floatingOpts);
123
+ state.floatingCleanup = result.cleanup;
124
+ }, show = function() {
125
+ if (state.showTimeout !== null)
126
+ return;
127
+ state.showTimeout = setTimeout(() => {
128
+ state.showTimeout = null;
129
+ isOpen.value = true;
130
+ applyPositioning();
131
+ }, __props.delay ?? 300);
132
+ }, hide = function() {
133
+ if (state.showTimeout !== null) {
134
+ clearTimeout(state.showTimeout);
135
+ state.showTimeout = null;
136
+ }
137
+ isOpen.value = false;
138
+ state.floatingCleanup?.();
139
+ state.floatingCleanup = null;
140
+ };
141
+ const contentId = uniqueId("tooltip");
142
+ const contentRef = ref();
143
+ const isOpen = signal(false, "isOpen");
144
+ const state = {
145
+ showTimeout: null,
146
+ floatingCleanup: null
147
+ };
148
+ const ctx = {
149
+ isOpen: () => isOpen.value,
150
+ contentId,
151
+ contentRef,
152
+ classes: __props.classes,
153
+ show,
154
+ hide,
155
+ _triggerCount: { value: 0 },
156
+ _contentCount: { value: 0 }
157
+ };
158
+ const __mfResult0 = TooltipContext.Provider({ get value() {
159
+ return ctx;
160
+ }, children: () => (() => {
161
+ const __el0 = __element("span");
162
+ {
163
+ const __v = { display: "contents" };
164
+ if (__v != null && __v !== false)
165
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
166
+ }
167
+ __el0.setAttribute("data-tooltip-root", "");
168
+ __enterChildren(__el0);
169
+ __append(__el0, __child(() => __props.children));
170
+ __exitChildren();
171
+ return __el0;
172
+ })() });
173
+ __flushMountFrame();
174
+ return __mfResult0;
175
+ } catch (__mfErr) {
176
+ __discardMountFrame(__mfDepth);
177
+ throw __mfErr;
178
+ }
179
+ }
180
+ var ComposedTooltip = Object.assign(ComposedTooltipRoot, {
181
+ Trigger: TooltipTrigger,
182
+ Content: TooltipContent
183
+ });
184
+
185
+ export { ComposedTooltip };