@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,155 @@
1
+ import {
2
+ Keys,
3
+ isKey
4
+ } from "./chunk-7867pr13.js";
5
+ import {
6
+ setDataState,
7
+ setValueRange
8
+ } from "./chunk-vevfhpc9.js";
9
+ import {
10
+ applyAttrs
11
+ } from "./chunk-2db2dnp3.js";
12
+
13
+ // src/resizable-panel/resizable-panel.tsx
14
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
15
+ import { signal } from "@vertz/ui";
16
+ function ResizablePanelRoot(options = {}) {
17
+ const { orientation = "horizontal", onResize, ...attrs } = options;
18
+ const state = { sizes: signal([]) };
19
+ const panels = [];
20
+ const handles = [];
21
+ function updateSizes(newSizes) {
22
+ state.sizes.value = [...newSizes];
23
+ for (let i = 0;i < panels.length; i++) {
24
+ const panel = panels[i];
25
+ if (!panel)
26
+ continue;
27
+ const size = newSizes[i] ?? 0;
28
+ panel.el.style.flex = `0 0 ${size}%`;
29
+ }
30
+ for (let i = 0;i < handles.length; i++) {
31
+ const handle = handles[i];
32
+ const leftPanel = panels[i];
33
+ if (handle && leftPanel) {
34
+ const size = newSizes[i] ?? 0;
35
+ setValueRange(handle, Math.round(size), Math.round(leftPanel.minSize), Math.round(leftPanel.maxSize));
36
+ }
37
+ }
38
+ onResize?.(newSizes);
39
+ }
40
+ const root = jsxDEV_7x81h0kn("div", {
41
+ style: { display: "flex", flexDirection: orientation === "horizontal" ? "row" : "column" },
42
+ "data-orientation": orientation
43
+ }, undefined, false, undefined, this);
44
+ function Panel(panelOptions = {}) {
45
+ const { defaultSize, minSize = 0, maxSize = 100 } = panelOptions;
46
+ const el = jsxDEV_7x81h0kn("div", {
47
+ "data-panel": ""
48
+ }, undefined, false, undefined, this);
49
+ panels.push({ el, minSize, maxSize });
50
+ const sizes = state.sizes.peek();
51
+ if (defaultSize != null) {
52
+ sizes.push(defaultSize);
53
+ } else {
54
+ const equalSize = 100 / panels.length;
55
+ sizes.length = 0;
56
+ for (let i = 0;i < panels.length; i++) {
57
+ sizes.push(equalSize);
58
+ }
59
+ }
60
+ updateSizes(sizes);
61
+ return el;
62
+ }
63
+ function Handle() {
64
+ const handleIndex = handles.length;
65
+ const handle = jsxDEV_7x81h0kn("div", {
66
+ role: "separator",
67
+ tabindex: "0",
68
+ "data-orientation": orientation,
69
+ "data-state": "idle",
70
+ onKeydown: (event) => {
71
+ const sizes = [...state.sizes.peek()];
72
+ const leftIdx = handleIndex;
73
+ const rightIdx = handleIndex + 1;
74
+ const leftPanel = panels[leftIdx];
75
+ const rightPanel = panels[rightIdx];
76
+ if (!leftPanel || !rightPanel)
77
+ return;
78
+ let leftSize = sizes[leftIdx] ?? 0;
79
+ let rightSize = sizes[rightIdx] ?? 0;
80
+ const STEP = 5;
81
+ const growKey = orientation === "horizontal" ? Keys.ArrowRight : Keys.ArrowDown;
82
+ const shrinkKey = orientation === "horizontal" ? Keys.ArrowLeft : Keys.ArrowUp;
83
+ if (isKey(event, growKey)) {
84
+ event.preventDefault();
85
+ const delta = Math.min(STEP, rightSize - rightPanel.minSize, leftPanel.maxSize - leftSize);
86
+ leftSize += delta;
87
+ rightSize -= delta;
88
+ } else if (isKey(event, shrinkKey)) {
89
+ event.preventDefault();
90
+ const delta = Math.min(STEP, leftSize - leftPanel.minSize, rightPanel.maxSize - rightSize);
91
+ leftSize -= delta;
92
+ rightSize += delta;
93
+ } else if (isKey(event, Keys.Home)) {
94
+ event.preventDefault();
95
+ const delta = leftSize - leftPanel.minSize;
96
+ leftSize -= delta;
97
+ rightSize += delta;
98
+ } else if (isKey(event, Keys.End)) {
99
+ event.preventDefault();
100
+ const delta = rightSize - rightPanel.minSize;
101
+ leftSize += delta;
102
+ rightSize -= delta;
103
+ } else {
104
+ return;
105
+ }
106
+ sizes[leftIdx] = leftSize;
107
+ sizes[rightIdx] = rightSize;
108
+ updateSizes(sizes);
109
+ },
110
+ onPointerdown: (event) => {
111
+ event.preventDefault();
112
+ handle.setPointerCapture(event.pointerId);
113
+ setDataState(handle, "dragging");
114
+ const startPos = orientation === "horizontal" ? event.clientX : event.clientY;
115
+ const rootSize = orientation === "horizontal" ? root.offsetWidth : root.offsetHeight;
116
+ const startSizes = [...state.sizes.peek()];
117
+ function onMove(e) {
118
+ const currentPos = orientation === "horizontal" ? e.clientX : e.clientY;
119
+ const delta = (currentPos - startPos) / rootSize * 100;
120
+ const sizes = [...startSizes];
121
+ const leftIdx = handleIndex;
122
+ const rightIdx = handleIndex + 1;
123
+ const leftPanel = panels[leftIdx];
124
+ const rightPanel = panels[rightIdx];
125
+ if (!leftPanel || !rightPanel)
126
+ return;
127
+ let newLeft = (startSizes[leftIdx] ?? 0) + delta;
128
+ let newRight = (startSizes[rightIdx] ?? 0) - delta;
129
+ newLeft = Math.max(leftPanel.minSize, Math.min(leftPanel.maxSize, newLeft));
130
+ newRight = Math.max(rightPanel.minSize, Math.min(rightPanel.maxSize, newRight));
131
+ sizes[leftIdx] = newLeft;
132
+ sizes[rightIdx] = newRight;
133
+ updateSizes(sizes);
134
+ }
135
+ function onUp(e) {
136
+ handle.releasePointerCapture(e.pointerId);
137
+ setDataState(handle, "idle");
138
+ handle.removeEventListener("pointermove", onMove);
139
+ handle.removeEventListener("pointerup", onUp);
140
+ }
141
+ handle.addEventListener("pointermove", onMove);
142
+ handle.addEventListener("pointerup", onUp);
143
+ }
144
+ }, undefined, false, undefined, this);
145
+ handles.push(handle);
146
+ return handle;
147
+ }
148
+ applyAttrs(root, attrs);
149
+ return { root, state, Panel, Handle };
150
+ }
151
+ var ResizablePanel = {
152
+ Root: ResizablePanelRoot
153
+ };
154
+
155
+ export { ResizablePanel };
@@ -0,0 +1,347 @@
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
+ uniqueId
13
+ } from "./chunk-8y1jf6xr.js";
14
+ import {
15
+ Keys,
16
+ isKey
17
+ } from "./chunk-7867pr13.js";
18
+
19
+ // src/menubar/menubar-composed.tsx
20
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
21
+ import { createContext, onMount, ref, useContext } from "@vertz/ui";
22
+ var MenubarContext = createContext(undefined, "@vertz/ui-primitives::MenubarContext");
23
+ function useMenubarContext(componentName) {
24
+ const ctx = useContext(MenubarContext);
25
+ if (!ctx) {
26
+ throw new Error(`<Menubar.${componentName}> must be used inside <Menubar>. ` + "Ensure it is a direct or nested child of the Menubar root component.");
27
+ }
28
+ return ctx;
29
+ }
30
+ var MenuContext = createContext(undefined, "@vertz/ui-primitives::MenubarMenuContext");
31
+ function useMenuContext(componentName) {
32
+ const ctx = useContext(MenuContext);
33
+ if (!ctx) {
34
+ throw new Error(`<Menubar.${componentName}> must be used inside <Menubar.Menu>. ` + "Ensure it is a direct or nested child of a Menubar.Menu component.");
35
+ }
36
+ return ctx;
37
+ }
38
+ function MenubarMenu({ value, children }) {
39
+ const barCtx = useMenubarContext("Menu");
40
+ const ids = linkedIds("menubar-menu");
41
+ const menuCtx = {
42
+ menuValue: value,
43
+ triggerId: ids.triggerId,
44
+ contentId: ids.contentId,
45
+ classes: barCtx.classes
46
+ };
47
+ return jsxDEV_7x81h0kn(MenuContext.Provider, {
48
+ value: menuCtx,
49
+ children: jsxDEV_7x81h0kn("span", {
50
+ style: { display: "contents" },
51
+ "data-menubar-menu": "",
52
+ children
53
+ }, undefined, false, undefined, this)
54
+ }, undefined, false, undefined, this);
55
+ }
56
+ function MenubarTrigger({ children, className: cls, class: classProp }) {
57
+ const menuCtx = useMenuContext("Trigger");
58
+ const barCtx = useMenubarContext("Trigger");
59
+ const el = jsxDEV_7x81h0kn("button", {
60
+ type: "button",
61
+ role: "menuitem",
62
+ id: menuCtx.triggerId,
63
+ "aria-controls": menuCtx.contentId,
64
+ "aria-haspopup": "menu",
65
+ "data-menubar-trigger": "",
66
+ "data-value": menuCtx.menuValue,
67
+ "aria-expanded": "false",
68
+ "data-state": "closed",
69
+ class: cn(menuCtx.classes?.trigger, cls ?? classProp),
70
+ children: children ?? menuCtx.menuValue
71
+ }, undefined, false, undefined, this);
72
+ onMount(() => {
73
+ const btnEl = el;
74
+ function handleClick() {
75
+ if (barCtx.getActiveMenu() === menuCtx.menuValue) {
76
+ barCtx.closeAll();
77
+ } else {
78
+ barCtx.openMenu(menuCtx.menuValue);
79
+ }
80
+ }
81
+ function handleKeydown(event) {
82
+ if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
83
+ event.preventDefault();
84
+ barCtx.openMenu(menuCtx.menuValue);
85
+ }
86
+ }
87
+ btnEl.addEventListener("click", handleClick);
88
+ btnEl.addEventListener("keydown", handleKeydown);
89
+ return () => {
90
+ btnEl.removeEventListener("click", handleClick);
91
+ btnEl.removeEventListener("keydown", handleKeydown);
92
+ };
93
+ });
94
+ return el;
95
+ }
96
+ function MenubarContent({ children, className: cls, class: classProp }) {
97
+ const menuCtx = useMenuContext("Content");
98
+ const barCtx = useMenubarContext("Content");
99
+ const el = jsxDEV_7x81h0kn("div", {
100
+ role: "menu",
101
+ id: menuCtx.contentId,
102
+ "data-menubar-content": "",
103
+ "data-value": menuCtx.menuValue,
104
+ "aria-hidden": "true",
105
+ "data-state": "closed",
106
+ style: { display: "none" },
107
+ class: cn(menuCtx.classes?.content, cls ?? classProp),
108
+ children
109
+ }, undefined, false, undefined, this);
110
+ onMount(() => {
111
+ const contentEl = el;
112
+ function handleKeydown(event) {
113
+ if (isKey(event, Keys.Escape)) {
114
+ event.preventDefault();
115
+ barCtx.closeAll();
116
+ const root = barCtx.rootRef.current;
117
+ if (root) {
118
+ const trigger = root.querySelector(`[data-menubar-trigger][data-value="${menuCtx.menuValue}"]`);
119
+ trigger?.focus();
120
+ }
121
+ return;
122
+ }
123
+ if (isKey(event, Keys.Enter, Keys.Space)) {
124
+ event.preventDefault();
125
+ const items = [...contentEl.querySelectorAll('[role="menuitem"]')];
126
+ const active = items.find((item) => item === document.activeElement);
127
+ if (active) {
128
+ const val = active.getAttribute("data-value");
129
+ if (val !== null) {
130
+ barCtx.getOnSelect()?.(val);
131
+ barCtx.closeAll();
132
+ }
133
+ }
134
+ return;
135
+ }
136
+ if (isKey(event, Keys.ArrowDown, Keys.ArrowUp)) {
137
+ event.preventDefault();
138
+ const items = [...contentEl.querySelectorAll('[role="menuitem"]')];
139
+ if (items.length === 0)
140
+ return;
141
+ const currentIdx = items.indexOf(document.activeElement);
142
+ const direction = isKey(event, Keys.ArrowDown) ? 1 : -1;
143
+ const nextIdx = ((currentIdx + direction) % items.length + items.length) % items.length;
144
+ items[nextIdx]?.focus();
145
+ return;
146
+ }
147
+ if (isKey(event, Keys.ArrowRight)) {
148
+ event.preventDefault();
149
+ event.stopPropagation();
150
+ barCtx.navigateMenu(1);
151
+ return;
152
+ }
153
+ if (isKey(event, Keys.ArrowLeft)) {
154
+ event.preventDefault();
155
+ event.stopPropagation();
156
+ barCtx.navigateMenu(-1);
157
+ return;
158
+ }
159
+ }
160
+ contentEl.addEventListener("keydown", handleKeydown);
161
+ return () => {
162
+ contentEl.removeEventListener("keydown", handleKeydown);
163
+ };
164
+ });
165
+ return el;
166
+ }
167
+ function MenubarItem({ value, children, className: cls, class: classProp }) {
168
+ const barCtx = useMenubarContext("Item");
169
+ const menuCtx = useMenuContext("Item");
170
+ return jsxDEV_7x81h0kn("div", {
171
+ role: "menuitem",
172
+ "data-menubar-item": "",
173
+ "data-value": value,
174
+ tabindex: "-1",
175
+ class: cn(menuCtx.classes?.item, cls ?? classProp),
176
+ onClick: () => {
177
+ barCtx.getOnSelect()?.(value);
178
+ barCtx.closeAll();
179
+ },
180
+ children
181
+ }, undefined, false, undefined, this);
182
+ }
183
+ function MenubarGroup({ label, children, className: cls, class: classProp }) {
184
+ const menuCtx = useMenuContext("Group");
185
+ return jsxDEV_7x81h0kn("div", {
186
+ role: "group",
187
+ "aria-label": label,
188
+ class: cn(menuCtx.classes?.group, cls ?? classProp),
189
+ children
190
+ }, undefined, false, undefined, this);
191
+ }
192
+ function MenubarLabel({ children, className: cls, class: classProp }) {
193
+ const { classes } = useMenuContext("Label");
194
+ return jsxDEV_7x81h0kn("div", {
195
+ role: "none",
196
+ class: cn(classes?.label, cls ?? classProp),
197
+ children
198
+ }, undefined, false, undefined, this);
199
+ }
200
+ function MenubarSeparator({ className: cls, class: classProp }) {
201
+ const { classes } = useMenuContext("Separator");
202
+ return jsxDEV_7x81h0kn("hr", {
203
+ role: "separator",
204
+ class: cn(classes?.separator, cls ?? classProp)
205
+ }, undefined, false, undefined, this);
206
+ }
207
+ function ComposedMenubarRoot({ children, classes, onSelect, positioning }) {
208
+ const rootId = uniqueId("menubar");
209
+ const rootRef = ref();
210
+ const state = { activeMenu: null, floatingCleanup: null, dismissCleanup: null };
211
+ function getRootEl() {
212
+ return rootRef.current ?? null;
213
+ }
214
+ function getMenuItems(contentEl) {
215
+ return [...contentEl.querySelectorAll('[role="menuitem"]')];
216
+ }
217
+ function getMenuValues() {
218
+ const root = getRootEl();
219
+ if (!root)
220
+ return [];
221
+ const triggers = root.querySelectorAll("[data-menubar-trigger]");
222
+ return [...triggers].map((t) => t.getAttribute("data-value"));
223
+ }
224
+ function closeAll() {
225
+ const root = getRootEl();
226
+ if (!root)
227
+ return;
228
+ const triggers = root.querySelectorAll("[data-menubar-trigger]");
229
+ const contents = root.querySelectorAll("[data-menubar-content]");
230
+ for (const trigger of triggers) {
231
+ trigger.setAttribute("aria-expanded", "false");
232
+ trigger.setAttribute("data-state", "closed");
233
+ }
234
+ for (const content of contents) {
235
+ content.setAttribute("data-state", "closed");
236
+ content.setAttribute("aria-hidden", "true");
237
+ content.style.display = "none";
238
+ }
239
+ state.activeMenu = null;
240
+ state.floatingCleanup?.();
241
+ state.floatingCleanup = null;
242
+ state.dismissCleanup?.();
243
+ state.dismissCleanup = null;
244
+ }
245
+ function openMenu(value) {
246
+ const root = getRootEl();
247
+ if (!root)
248
+ return;
249
+ const current = state.activeMenu;
250
+ if (current && current !== value) {
251
+ const prevTrigger = root.querySelector(`[data-menubar-trigger][data-value="${current}"]`);
252
+ const prevContent = root.querySelector(`[data-menubar-content][data-value="${current}"]`);
253
+ if (prevTrigger) {
254
+ prevTrigger.setAttribute("aria-expanded", "false");
255
+ prevTrigger.setAttribute("data-state", "closed");
256
+ }
257
+ if (prevContent) {
258
+ prevContent.setAttribute("data-state", "closed");
259
+ prevContent.setAttribute("aria-hidden", "true");
260
+ prevContent.style.display = "none";
261
+ }
262
+ state.floatingCleanup?.();
263
+ state.floatingCleanup = null;
264
+ }
265
+ const trigger = root.querySelector(`[data-menubar-trigger][data-value="${value}"]`);
266
+ const content = root.querySelector(`[data-menubar-content][data-value="${value}"]`);
267
+ if (!trigger || !content)
268
+ return;
269
+ state.activeMenu = value;
270
+ trigger.setAttribute("aria-expanded", "true");
271
+ trigger.setAttribute("data-state", "open");
272
+ content.setAttribute("aria-hidden", "false");
273
+ content.setAttribute("data-state", "open");
274
+ content.style.display = "";
275
+ {
276
+ const floatingOpts = positioning ?? { placement: "bottom-start", offset: 4 };
277
+ content.style.position = "fixed";
278
+ const result = createFloatingPosition(trigger, content, floatingOpts);
279
+ state.floatingCleanup = result.cleanup;
280
+ if (!state.dismissCleanup) {
281
+ state.dismissCleanup = createDismiss({
282
+ onDismiss: closeAll,
283
+ insideElements: [root],
284
+ escapeKey: false
285
+ });
286
+ }
287
+ }
288
+ const items = getMenuItems(content);
289
+ const firstItem = items[0];
290
+ if (firstItem) {
291
+ firstItem.setAttribute("tabindex", "0");
292
+ firstItem.focus();
293
+ }
294
+ }
295
+ function navigateMenu(direction) {
296
+ const values = getMenuValues();
297
+ if (values.length === 0)
298
+ return;
299
+ const currentIdx = state.activeMenu ? values.indexOf(state.activeMenu) : -1;
300
+ const nextIdx = ((currentIdx + direction) % values.length + values.length) % values.length;
301
+ const nextValue = values[nextIdx];
302
+ if (nextValue) {
303
+ openMenu(nextValue);
304
+ }
305
+ }
306
+ const ctx = {
307
+ rootId,
308
+ rootRef,
309
+ classes,
310
+ getOnSelect: () => onSelect,
311
+ getPositioning: () => positioning,
312
+ getActiveMenu: () => state.activeMenu,
313
+ openMenu,
314
+ closeAll,
315
+ navigateMenu
316
+ };
317
+ return jsxDEV_7x81h0kn(MenubarContext.Provider, {
318
+ value: ctx,
319
+ children: jsxDEV_7x81h0kn("div", {
320
+ ref: rootRef,
321
+ role: "menubar",
322
+ id: rootId,
323
+ class: cn(classes?.root),
324
+ onKeydown: (event) => {
325
+ if (state.activeMenu && isKey(event, Keys.ArrowRight)) {
326
+ event.preventDefault();
327
+ navigateMenu(1);
328
+ } else if (state.activeMenu && isKey(event, Keys.ArrowLeft)) {
329
+ event.preventDefault();
330
+ navigateMenu(-1);
331
+ }
332
+ },
333
+ children
334
+ }, undefined, false, undefined, this)
335
+ }, undefined, false, undefined, this);
336
+ }
337
+ var ComposedMenubar = Object.assign(ComposedMenubarRoot, {
338
+ Menu: MenubarMenu,
339
+ Trigger: MenubarTrigger,
340
+ Content: MenubarContent,
341
+ Item: MenubarItem,
342
+ Group: MenubarGroup,
343
+ Label: MenubarLabel,
344
+ Separator: MenubarSeparator
345
+ });
346
+
347
+ export { ComposedMenubar };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedAccordion
3
- } from "../../shared/chunk-9yb26c0w.js";
3
+ } from "../../shared/chunk-vfknb5ht.js";
4
4
  export {
5
5
  ComposedAccordion
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Accordion
3
- } from "../../shared/chunk-q77y3rg4.js";
3
+ } from "../../shared/chunk-tc5rpvyx.js";
4
4
  export {
5
5
  Accordion
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedAlert
3
- } from "../../shared/chunk-spng4yb9.js";
3
+ } from "../../shared/chunk-2h4m9c71.js";
4
4
  export {
5
5
  ComposedAlert
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedAlertDialog
3
- } from "../../shared/chunk-hfjtkytb.js";
3
+ } from "../../shared/chunk-7zpjshwz.js";
4
4
  export {
5
5
  ComposedAlertDialog
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AlertDialog
3
- } from "../../shared/chunk-n436p5cb.js";
3
+ } from "../../shared/chunk-jetwnv0w.js";
4
4
  export {
5
5
  AlertDialog
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedAvatar
3
- } from "../../shared/chunk-yfzddvxc.js";
3
+ } from "../../shared/chunk-hzk4wfq9.js";
4
4
  export {
5
5
  ComposedAvatar
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedBadge
3
- } from "../../shared/chunk-v0b5pkcq.js";
3
+ } from "../../shared/chunk-0n9jj8xr.js";
4
4
  export {
5
5
  ComposedBadge
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Badge
3
- } from "../../shared/chunk-tn0m98j8.js";
3
+ } from "../../shared/chunk-9pdt5aw7.js";
4
4
  export {
5
5
  Badge
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedBreadcrumb
3
- } from "../../shared/chunk-ev367pq3.js";
3
+ } from "../../shared/chunk-2ye674gr.js";
4
4
  export {
5
5
  ComposedBreadcrumb
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedButton
3
- } from "../../shared/chunk-hpvjfj0j.js";
3
+ } from "../../shared/chunk-pgvpvbpe.js";
4
4
  export {
5
5
  ComposedButton
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Button
3
- } from "../../shared/chunk-nj420k31.js";
3
+ } from "../../shared/chunk-sq27a4h0.js";
4
4
  export {
5
5
  Button
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedCalendar
3
- } from "../../shared/chunk-3jack97k.js";
3
+ } from "../../shared/chunk-caba5bhd.js";
4
4
  export {
5
5
  ComposedCalendar
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Calendar
3
- } from "../../shared/chunk-b4zzg457.js";
3
+ } from "../../shared/chunk-whq9s8v5.js";
4
4
  export {
5
5
  Calendar
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedCard
3
- } from "../../shared/chunk-8t0nm721.js";
3
+ } from "../../shared/chunk-hz0e504p.js";
4
4
  export {
5
5
  ComposedCard
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedCarousel
3
- } from "../../shared/chunk-axpbdpgx.js";
3
+ } from "../../shared/chunk-gj4hrssn.js";
4
4
  export {
5
5
  ComposedCarousel
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Carousel
3
- } from "../../shared/chunk-dvk4h36t.js";
3
+ } from "../../shared/chunk-tqhnjcfp.js";
4
4
  export {
5
5
  Carousel
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedCheckbox
3
- } from "../../shared/chunk-rdr0rtpr.js";
3
+ } from "../../shared/chunk-taa5pj15.js";
4
4
  export {
5
5
  ComposedCheckbox
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Checkbox
3
- } from "../../shared/chunk-pqskzq8t.js";
3
+ } from "../../shared/chunk-c2f63m5n.js";
4
4
  export {
5
5
  Checkbox
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ComposedCollapsible
3
- } from "../../shared/chunk-ktbf6xrt.js";
3
+ } from "../../shared/chunk-6zmnqvh6.js";
4
4
  export {
5
5
  ComposedCollapsible
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Collapsible
3
- } from "../../shared/chunk-rnqc7735.js";
3
+ } from "../../shared/chunk-tkftdwnq.js";
4
4
  export {
5
5
  Collapsible
6
6
  };