@vertz/ui-primitives 0.2.41 → 0.2.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/shared/chunk-06m8prfg.js +52 -0
  2. package/dist/shared/chunk-0n9jj8xr.js +24 -0
  3. package/dist/shared/chunk-1ben27xq.js +317 -0
  4. package/dist/shared/chunk-1j2mj0sa.js +45 -0
  5. package/dist/shared/chunk-250hj18f.js +243 -0
  6. package/dist/shared/chunk-2h4m9c71.js +38 -0
  7. package/dist/shared/chunk-2sbx20hv.js +128 -0
  8. package/dist/shared/chunk-2ye674gr.js +70 -0
  9. package/dist/shared/chunk-34d8385y.js +15 -0
  10. package/dist/shared/chunk-4d7bm8h0.js +113 -0
  11. package/dist/shared/chunk-4zjgxr7x.js +157 -0
  12. package/dist/shared/chunk-5c150wvr.js +140 -0
  13. package/dist/shared/chunk-5gycdypd.js +58 -0
  14. package/dist/shared/chunk-6mm7fhp8.js +105 -0
  15. package/dist/shared/chunk-6zmnqvh6.js +109 -0
  16. package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
  17. package/dist/shared/chunk-7pbff2hg.js +118 -0
  18. package/dist/shared/chunk-7zpjshwz.js +194 -0
  19. package/dist/shared/chunk-993ff51d.js +155 -0
  20. package/dist/shared/chunk-9pdt5aw7.js +24 -0
  21. package/dist/shared/chunk-a71m4xkv.js +106 -0
  22. package/dist/shared/chunk-aj8m39pk.js +127 -0
  23. package/dist/shared/chunk-ajawpc05.js +305 -0
  24. package/dist/shared/chunk-b7mzwqhj.js +125 -0
  25. package/dist/shared/chunk-bb887de4.js +200 -0
  26. package/dist/shared/chunk-bfsmbrxc.js +111 -0
  27. package/dist/shared/chunk-c2f63m5n.js +56 -0
  28. package/dist/shared/chunk-c5r3s5km.js +263 -0
  29. package/dist/shared/chunk-caba5bhd.js +427 -0
  30. package/dist/shared/chunk-crym07yc.js +264 -0
  31. package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
  32. package/dist/shared/chunk-d6rtejz3.js +128 -0
  33. package/dist/shared/chunk-dvaf0bmq.js +140 -0
  34. package/dist/shared/chunk-dwkv9ya6.js +22 -0
  35. package/dist/shared/chunk-e0ckxrjg.js +41 -0
  36. package/dist/shared/chunk-ennxcymj.js +225 -0
  37. package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
  38. package/dist/shared/chunk-f0v1gs5e.js +52 -0
  39. package/dist/shared/chunk-f86rsf84.js +231 -0
  40. package/dist/shared/{chunk-3sahbk4d.js → chunk-fdse46x5.js} +6 -1
  41. package/dist/shared/chunk-gj4hrssn.js +135 -0
  42. package/dist/shared/chunk-gyvq4gk9.js +24 -0
  43. package/dist/shared/chunk-hbnps9sq.js +229 -0
  44. package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
  45. package/dist/shared/chunk-hgnkd4he.js +256 -0
  46. package/dist/shared/chunk-hpcyffm7.js +185 -0
  47. package/dist/shared/chunk-hpmvwx0h.js +99 -0
  48. package/dist/shared/chunk-hz0e504p.js +69 -0
  49. package/dist/shared/chunk-hzk4wfq9.js +43 -0
  50. package/dist/shared/chunk-j7znzkpa.js +48 -0
  51. package/dist/shared/chunk-j9kxgrnn.js +167 -0
  52. package/dist/shared/chunk-jetwnv0w.js +130 -0
  53. package/dist/shared/chunk-jjdg26c1.js +155 -0
  54. package/dist/shared/chunk-k0m4yh86.js +123 -0
  55. package/dist/shared/chunk-k43q9cjr.js +82 -0
  56. package/dist/shared/chunk-k9k8tbr5.js +119 -0
  57. package/dist/shared/chunk-meaj7br1.js +232 -0
  58. package/dist/shared/chunk-mgj0n08k.js +34 -0
  59. package/dist/shared/chunk-mjz4rp6c.js +46 -0
  60. package/dist/shared/chunk-n4rr5gme.js +239 -0
  61. package/dist/shared/chunk-nk55etpp.js +65 -0
  62. package/dist/shared/chunk-nkh1ks3k.js +264 -0
  63. package/dist/shared/chunk-pgvpvbpe.js +26 -0
  64. package/dist/shared/chunk-pma8gnv7.js +178 -0
  65. package/dist/shared/chunk-q7xv6xze.js +131 -0
  66. package/dist/shared/chunk-qey801nq.js +22 -0
  67. package/dist/shared/chunk-s6b4c3tj.js +58 -0
  68. package/dist/shared/chunk-sq27a4h0.js +36 -0
  69. package/dist/shared/chunk-taa5pj15.js +103 -0
  70. package/dist/shared/chunk-tc5rpvyx.js +127 -0
  71. package/dist/shared/chunk-tescm0b3.js +192 -0
  72. package/dist/shared/chunk-tkftdwnq.js +71 -0
  73. package/dist/shared/chunk-tqhnjcfp.js +116 -0
  74. package/dist/shared/chunk-vfknb5ht.js +183 -0
  75. package/dist/shared/chunk-vsc369w3.js +185 -0
  76. package/dist/shared/chunk-whq9s8v5.js +301 -0
  77. package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
  78. package/dist/shared/chunk-yzbmkx4r.js +155 -0
  79. package/dist/shared/chunk-zaen0ajc.js +347 -0
  80. package/dist/src/accordion/accordion-composed.js +1 -1
  81. package/dist/src/accordion/accordion.js +1 -1
  82. package/dist/src/alert/alert-composed.js +1 -1
  83. package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
  84. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  85. package/dist/src/avatar/avatar-composed.js +1 -1
  86. package/dist/src/badge/badge-composed.js +1 -1
  87. package/dist/src/badge/badge.js +1 -1
  88. package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
  89. package/dist/src/button/button-composed.js +1 -1
  90. package/dist/src/button/button.js +1 -1
  91. package/dist/src/calendar/calendar-composed.js +1 -1
  92. package/dist/src/calendar/calendar.js +1 -1
  93. package/dist/src/card/card-composed.js +1 -1
  94. package/dist/src/carousel/carousel-composed.js +1 -1
  95. package/dist/src/carousel/carousel.js +1 -1
  96. package/dist/src/checkbox/checkbox-composed.js +1 -1
  97. package/dist/src/checkbox/checkbox.js +1 -1
  98. package/dist/src/collapsible/collapsible-composed.js +1 -1
  99. package/dist/src/collapsible/collapsible.js +1 -1
  100. package/dist/src/combobox/combobox-composed.js +1 -1
  101. package/dist/src/combobox/combobox.js +1 -1
  102. package/dist/src/command/command-composed.js +1 -1
  103. package/dist/src/command/command.js +1 -1
  104. package/dist/src/composed/with-styles.js +1 -1
  105. package/dist/src/context-menu/context-menu-composed.js +1 -1
  106. package/dist/src/context-menu/context-menu.js +1 -1
  107. package/dist/src/date-picker/date-picker-composed.js +1 -1
  108. package/dist/src/date-picker/date-picker.js +1 -1
  109. package/dist/src/dialog/dialog-composed.js +1 -1
  110. package/dist/src/dialog/dialog-stack-parts.js +1 -1
  111. package/dist/src/dialog/dialog.js +1 -1
  112. package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
  113. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  114. package/dist/src/empty-state/empty-state-composed.js +1 -1
  115. package/dist/src/form-group/form-group-composed.js +1 -1
  116. package/dist/src/hover-card/hover-card-composed.js +1 -1
  117. package/dist/src/hover-card/hover-card.js +1 -1
  118. package/dist/src/input/input-composed.js +1 -1
  119. package/dist/src/label/label-composed.js +1 -1
  120. package/dist/src/list/list-composed.js +1 -1
  121. package/dist/src/menu/menu-composed.js +1 -1
  122. package/dist/src/menu/menu.js +1 -1
  123. package/dist/src/menubar/menubar-composed.js +1 -1
  124. package/dist/src/menubar/menubar.js +1 -1
  125. package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
  126. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  127. package/dist/src/pagination/pagination-composed.js +1 -1
  128. package/dist/src/popover/popover-composed.js +1 -1
  129. package/dist/src/popover/popover.js +1 -1
  130. package/dist/src/progress/progress-composed.js +1 -1
  131. package/dist/src/progress/progress.js +1 -1
  132. package/dist/src/radio/radio-composed.js +1 -1
  133. package/dist/src/radio/radio.js +1 -1
  134. package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
  135. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  136. package/dist/src/scroll-area/scroll-area-composed.js +1 -1
  137. package/dist/src/scroll-area/scroll-area.js +1 -1
  138. package/dist/src/select/select-composed.js +1 -1
  139. package/dist/src/select/select.js +1 -1
  140. package/dist/src/separator/separator-composed.js +1 -1
  141. package/dist/src/sheet/sheet-composed.js +1 -1
  142. package/dist/src/sheet/sheet.js +1 -1
  143. package/dist/src/skeleton/skeleton-composed.js +1 -1
  144. package/dist/src/slider/slider-composed.js +1 -1
  145. package/dist/src/slider/slider.js +1 -1
  146. package/dist/src/switch/switch-composed.js +1 -1
  147. package/dist/src/switch/switch.js +1 -1
  148. package/dist/src/table/table-composed.js +1 -1
  149. package/dist/src/tabs/tabs-composed.js +1 -1
  150. package/dist/src/tabs/tabs.js +1 -1
  151. package/dist/src/textarea/textarea-composed.js +1 -1
  152. package/dist/src/toast/toast.js +1 -1
  153. package/dist/src/toggle/toggle-composed.js +1 -1
  154. package/dist/src/toggle/toggle.js +1 -1
  155. package/dist/src/toggle-group/toggle-group-composed.js +1 -1
  156. package/dist/src/toggle-group/toggle-group.js +1 -1
  157. package/dist/src/tooltip/tooltip-composed.js +1 -1
  158. package/dist/src/tooltip/tooltip.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/shared/chunk-144kbnmx.js +0 -95
  161. package/dist/shared/chunk-1ewxfgsa.js +0 -167
  162. package/dist/shared/chunk-1hm0mbke.js +0 -258
  163. package/dist/shared/chunk-22rt6ws9.js +0 -69
  164. package/dist/shared/chunk-2ssqz188.js +0 -162
  165. package/dist/shared/chunk-33he7ay9.js +0 -218
  166. package/dist/shared/chunk-3jack97k.js +0 -509
  167. package/dist/shared/chunk-75pegjs7.js +0 -26
  168. package/dist/shared/chunk-862x7dja.js +0 -398
  169. package/dist/shared/chunk-8pk1pn5h.js +0 -215
  170. package/dist/shared/chunk-8t0nm721.js +0 -152
  171. package/dist/shared/chunk-94twh4s4.js +0 -28
  172. package/dist/shared/chunk-9yb26c0w.js +0 -232
  173. package/dist/shared/chunk-a82r2pnq.js +0 -67
  174. package/dist/shared/chunk-axpbdpgx.js +0 -177
  175. package/dist/shared/chunk-b3j6mym6.js +0 -203
  176. package/dist/shared/chunk-b4zzg457.js +0 -410
  177. package/dist/shared/chunk-b9qxfcsy.js +0 -60
  178. package/dist/shared/chunk-bc2qqkhr.js +0 -194
  179. package/dist/shared/chunk-bv12nkdm.js +0 -149
  180. package/dist/shared/chunk-bvxc1ww4.js +0 -164
  181. package/dist/shared/chunk-czv0kqj4.js +0 -107
  182. package/dist/shared/chunk-d83ag07h.js +0 -189
  183. package/dist/shared/chunk-de18ashk.js +0 -134
  184. package/dist/shared/chunk-dvk4h36t.js +0 -140
  185. package/dist/shared/chunk-dxvnerw2.js +0 -353
  186. package/dist/shared/chunk-e399pzdq.js +0 -241
  187. package/dist/shared/chunk-e4qha9as.js +0 -180
  188. package/dist/shared/chunk-eb2d9v6k.js +0 -68
  189. package/dist/shared/chunk-ect26sp5.js +0 -353
  190. package/dist/shared/chunk-ev367pq3.js +0 -102
  191. package/dist/shared/chunk-fjykbv0v.js +0 -214
  192. package/dist/shared/chunk-gdddk6nh.js +0 -96
  193. package/dist/shared/chunk-ghkw5bjq.js +0 -55
  194. package/dist/shared/chunk-hfjtkytb.js +0 -310
  195. package/dist/shared/chunk-hpvjfj0j.js +0 -31
  196. package/dist/shared/chunk-jpyjk616.js +0 -52
  197. package/dist/shared/chunk-k6d53tne.js +0 -206
  198. package/dist/shared/chunk-knzg86am.js +0 -168
  199. package/dist/shared/chunk-ktbf6xrt.js +0 -179
  200. package/dist/shared/chunk-m8y2p66x.js +0 -252
  201. package/dist/shared/chunk-metxdt5x.js +0 -28
  202. package/dist/shared/chunk-mgae1d93.js +0 -157
  203. package/dist/shared/chunk-mtx2cfbx.js +0 -175
  204. package/dist/shared/chunk-n436p5cb.js +0 -260
  205. package/dist/shared/chunk-nj420k31.js +0 -54
  206. package/dist/shared/chunk-nsmvdxgp.js +0 -213
  207. package/dist/shared/chunk-pcms04vq.js +0 -162
  208. package/dist/shared/chunk-pqskzq8t.js +0 -79
  209. package/dist/shared/chunk-pwr60kyd.js +0 -321
  210. package/dist/shared/chunk-pzknpa1y.js +0 -327
  211. package/dist/shared/chunk-q77y3rg4.js +0 -189
  212. package/dist/shared/chunk-qhnany7w.js +0 -179
  213. package/dist/shared/chunk-rdr0rtpr.js +0 -131
  214. package/dist/shared/chunk-rj52ty6r.js +0 -147
  215. package/dist/shared/chunk-rnqc7735.js +0 -125
  216. package/dist/shared/chunk-rtk30950.js +0 -202
  217. package/dist/shared/chunk-s0xgd8vg.js +0 -266
  218. package/dist/shared/chunk-s415735j.js +0 -357
  219. package/dist/shared/chunk-s62e7jf4.js +0 -30
  220. package/dist/shared/chunk-snd8e6r8.js +0 -418
  221. package/dist/shared/chunk-spng4yb9.js +0 -73
  222. package/dist/shared/chunk-t887wwjc.js +0 -168
  223. package/dist/shared/chunk-tn0m98j8.js +0 -42
  224. package/dist/shared/chunk-v0b5pkcq.js +0 -30
  225. package/dist/shared/chunk-v5tj7veh.js +0 -284
  226. package/dist/shared/chunk-vkscwzpr.js +0 -294
  227. package/dist/shared/chunk-vv187snj.js +0 -112
  228. package/dist/shared/chunk-xv4wd0kf.js +0 -293
  229. package/dist/shared/chunk-y1hpsqzy.js +0 -185
  230. package/dist/shared/chunk-yfzddvxc.js +0 -71
  231. package/dist/shared/chunk-yzgzx2dh.js +0 -311
  232. package/dist/shared/chunk-z5j7ztf2.js +0 -467
@@ -0,0 +1,135 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/carousel/carousel-composed.tsx
6
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
7
+ import { createContext, useContext } from "@vertz/ui";
8
+ var CarouselContext = createContext(undefined, "@vertz/ui-primitives::CarouselContext");
9
+ function CarouselSlide({ children, className: cls, class: classProp }) {
10
+ const ctx = useContext(CarouselContext);
11
+ if (!ctx) {
12
+ throw new Error("<Carousel.Slide> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
13
+ }
14
+ const index = ctx.registerSlide();
15
+ return jsxDEV_7x81h0kn("div", {
16
+ role: "group",
17
+ "aria-roledescription": "slide",
18
+ "data-carousel-slide": "",
19
+ "aria-hidden": String(index !== ctx.currentIndex),
20
+ "aria-label": `Slide ${index + 1} of ${ctx.getSlideCount()}`,
21
+ "data-state": index === ctx.currentIndex ? "active" : "inactive",
22
+ class: cn(ctx.classes?.slide, cls ?? classProp),
23
+ children
24
+ }, undefined, false, undefined, this);
25
+ }
26
+ function CarouselPrevious({ children }) {
27
+ const ctx = useContext(CarouselContext);
28
+ if (!ctx) {
29
+ throw new Error("<Carousel.Previous> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
30
+ }
31
+ return jsxDEV_7x81h0kn("button", {
32
+ type: "button",
33
+ "aria-label": "Previous slide",
34
+ "data-carousel-prev": "",
35
+ disabled: !ctx.loop && ctx.currentIndex <= 0,
36
+ class: cn(ctx.classes?.prevButton),
37
+ children: children ?? "‹"
38
+ }, undefined, false, undefined, this);
39
+ }
40
+ function CarouselNext({ children }) {
41
+ const ctx = useContext(CarouselContext);
42
+ if (!ctx) {
43
+ throw new Error("<Carousel.Next> must be used inside <Carousel>. " + "Ensure it is a direct or nested child of the Carousel root component.");
44
+ }
45
+ return jsxDEV_7x81h0kn("button", {
46
+ type: "button",
47
+ "aria-label": "Next slide",
48
+ "data-carousel-next": "",
49
+ disabled: !ctx.loop && ctx.currentIndex >= ctx.getSlideCount() - 1,
50
+ class: cn(ctx.classes?.nextButton),
51
+ children: children ?? "›"
52
+ }, undefined, false, undefined, this);
53
+ }
54
+ function ComposedCarouselRoot({
55
+ children,
56
+ classes,
57
+ orientation = "horizontal",
58
+ loop = false,
59
+ defaultIndex = 0,
60
+ onSlideChange
61
+ }) {
62
+ let currentIndex = defaultIndex;
63
+ const _reg = { nextIdx: 0 };
64
+ let slideCount = 0;
65
+ function registerSlide() {
66
+ const idx = _reg.nextIdx++;
67
+ slideCount = _reg.nextIdx;
68
+ return idx;
69
+ }
70
+ function goTo(index) {
71
+ const count = _reg.nextIdx;
72
+ if (count === 0)
73
+ return;
74
+ let next = index;
75
+ if (loop) {
76
+ next = (index % count + count) % count;
77
+ } else {
78
+ next = Math.max(0, Math.min(count - 1, index));
79
+ }
80
+ if (next === currentIndex)
81
+ return;
82
+ currentIndex = next;
83
+ onSlideChange?.(next);
84
+ }
85
+ function handleClick(e) {
86
+ const target = e.target;
87
+ if (target.closest("[data-carousel-prev]"))
88
+ goTo(currentIndex - 1);
89
+ if (target.closest("[data-carousel-next]"))
90
+ goTo(currentIndex + 1);
91
+ }
92
+ function handleKeydown(e) {
93
+ const prevKey = orientation === "horizontal" ? "ArrowLeft" : "ArrowUp";
94
+ const nextKey = orientation === "horizontal" ? "ArrowRight" : "ArrowDown";
95
+ if (e.key === prevKey) {
96
+ e.preventDefault();
97
+ goTo(currentIndex - 1);
98
+ }
99
+ if (e.key === nextKey) {
100
+ e.preventDefault();
101
+ goTo(currentIndex + 1);
102
+ }
103
+ }
104
+ const ctx = {
105
+ registerSlide,
106
+ currentIndex,
107
+ getSlideCount: () => slideCount,
108
+ loop,
109
+ classes
110
+ };
111
+ return jsxDEV_7x81h0kn(CarouselContext.Provider, {
112
+ value: ctx,
113
+ children: jsxDEV_7x81h0kn("div", {
114
+ role: "region",
115
+ "aria-roledescription": "carousel",
116
+ "data-carousel-root": "",
117
+ "data-orientation": orientation,
118
+ class: cn(classes?.root),
119
+ onClick: handleClick,
120
+ onKeydown: handleKeydown,
121
+ children: jsxDEV_7x81h0kn("div", {
122
+ "data-carousel-viewport": "",
123
+ class: cn(classes?.viewport),
124
+ children
125
+ }, undefined, false, undefined, this)
126
+ }, undefined, false, undefined, this)
127
+ }, undefined, false, undefined, this);
128
+ }
129
+ var ComposedCarousel = Object.assign(ComposedCarouselRoot, {
130
+ Slide: CarouselSlide,
131
+ Previous: CarouselPrevious,
132
+ Next: CarouselNext
133
+ });
134
+
135
+ export { ComposedCarousel };
@@ -0,0 +1,24 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/textarea/textarea-composed.tsx
6
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
7
+ function ComposedTextareaRoot({
8
+ classes,
9
+ className,
10
+ class: classProp,
11
+ value,
12
+ ...props
13
+ }) {
14
+ const el = jsxDEV_7x81h0kn("textarea", {
15
+ class: cn(classes?.base, className ?? classProp),
16
+ ...props
17
+ }, undefined, false, undefined, this);
18
+ if (value !== undefined)
19
+ el.value = value;
20
+ return el;
21
+ }
22
+ var ComposedTextarea = ComposedTextareaRoot;
23
+
24
+ export { ComposedTextarea };
@@ -0,0 +1,229 @@
1
+ import {
2
+ createDismiss
3
+ } from "./chunk-a6wp8c32.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-q7xbcj9q.js";
7
+ import {
8
+ createFloatingPosition,
9
+ virtualElement
10
+ } from "./chunk-vef3sepw.js";
11
+ import {
12
+ linkedIds
13
+ } from "./chunk-8y1jf6xr.js";
14
+ import {
15
+ Keys,
16
+ handleListNavigation,
17
+ isKey
18
+ } from "./chunk-7867pr13.js";
19
+
20
+ // src/context-menu/context-menu-composed.tsx
21
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
22
+ import { createContext, onMount, ref, useContext } from "@vertz/ui";
23
+ var ContextMenuContext = createContext(undefined, "@vertz/ui-primitives::ContextMenuContext");
24
+ function useContextMenuContext(componentName) {
25
+ const ctx = useContext(ContextMenuContext);
26
+ if (!ctx) {
27
+ throw new Error(`<ContextMenu.${componentName}> must be used inside <ContextMenu>. ` + "Ensure it is a direct or nested child of the ContextMenu root component.");
28
+ }
29
+ return ctx;
30
+ }
31
+ function ContextMenuTrigger({ children }) {
32
+ const ctx = useContextMenuContext("Trigger");
33
+ const el = jsxDEV_7x81h0kn("div", {
34
+ style: { display: "contents" },
35
+ "data-part": "trigger",
36
+ "data-contextmenu-trigger": "",
37
+ children
38
+ }, undefined, false, undefined, this);
39
+ onMount(() => {
40
+ const triggerEl = el;
41
+ function handleContextMenu(e) {
42
+ e.preventDefault();
43
+ ctx.open(e.clientX, e.clientY);
44
+ }
45
+ triggerEl.addEventListener("contextmenu", handleContextMenu);
46
+ return () => triggerEl.removeEventListener("contextmenu", handleContextMenu);
47
+ });
48
+ return el;
49
+ }
50
+ function ContextMenuContent({ children, className: cls, class: classProp }) {
51
+ const ctx = useContextMenuContext("Content");
52
+ const instanceIndex = ctx._contentCount.value++;
53
+ if (instanceIndex > 0) {
54
+ console.warn("Duplicate <ContextMenu.Content> detected – only the first is used");
55
+ }
56
+ const el = jsxDEV_7x81h0kn("div", {
57
+ ref: ctx.contentRef,
58
+ role: "menu",
59
+ tabindex: "-1",
60
+ id: ctx.contentId,
61
+ "data-contextmenu-content": "",
62
+ "aria-hidden": "true",
63
+ "data-state": "closed",
64
+ style: { display: "none" },
65
+ class: cn(ctx.classes?.content, cls ?? classProp),
66
+ onKeydown: (event) => {
67
+ if (isKey(event, Keys.Escape, Keys.Tab)) {
68
+ event.preventDefault();
69
+ ctx.close();
70
+ return;
71
+ }
72
+ const el2 = event.currentTarget ?? event.target;
73
+ const items = [...el2.querySelectorAll('[role="menuitem"]')];
74
+ const focusedIdx = items.indexOf(document.activeElement);
75
+ if (isKey(event, Keys.Enter, Keys.Space)) {
76
+ event.preventDefault();
77
+ const active = items[focusedIdx];
78
+ if (active) {
79
+ const val = active.getAttribute("data-value");
80
+ if (val !== null) {
81
+ ctx.onSelect?.(val);
82
+ ctx.close();
83
+ }
84
+ }
85
+ return;
86
+ }
87
+ handleListNavigation(event, items, { orientation: "vertical" });
88
+ },
89
+ children
90
+ }, undefined, false, undefined, this);
91
+ return el;
92
+ }
93
+ function ContextMenuItem({ value, children, className: cls, class: classProp }) {
94
+ const ctx = useContextMenuContext("Item");
95
+ return jsxDEV_7x81h0kn("div", {
96
+ role: "menuitem",
97
+ "data-value": value,
98
+ tabindex: "-1",
99
+ class: cn(ctx.classes?.item, cls ?? classProp),
100
+ onClick: () => {
101
+ ctx.onSelect?.(value);
102
+ ctx.close();
103
+ },
104
+ children
105
+ }, undefined, false, undefined, this);
106
+ }
107
+ function ContextMenuGroup({ label, children, className: cls, class: classProp }) {
108
+ const ctx = useContextMenuContext("Group");
109
+ return jsxDEV_7x81h0kn("div", {
110
+ role: "group",
111
+ "aria-label": label,
112
+ class: cn(ctx.classes?.group, cls ?? classProp),
113
+ children
114
+ }, undefined, false, undefined, this);
115
+ }
116
+ function ContextMenuLabel({ children, className: cls, class: classProp }) {
117
+ const { classes } = useContextMenuContext("Label");
118
+ return jsxDEV_7x81h0kn("div", {
119
+ role: "none",
120
+ class: cn(classes?.label, cls ?? classProp),
121
+ children
122
+ }, undefined, false, undefined, this);
123
+ }
124
+ function ContextMenuSeparator({ className: cls, class: classProp }) {
125
+ const { classes } = useContextMenuContext("Separator");
126
+ return jsxDEV_7x81h0kn("hr", {
127
+ role: "separator",
128
+ class: cn(classes?.separator, cls ?? classProp)
129
+ }, undefined, false, undefined, this);
130
+ }
131
+ function updateContentDOM(el, isOpen) {
132
+ el.setAttribute("data-state", isOpen ? "open" : "closed");
133
+ el.setAttribute("aria-hidden", isOpen ? "false" : "true");
134
+ el.style.display = isOpen ? "" : "none";
135
+ }
136
+ function ComposedContextMenuRoot({
137
+ children,
138
+ classes,
139
+ onSelect,
140
+ onOpenChange,
141
+ positioning
142
+ }) {
143
+ const ids = linkedIds("ctxmenu");
144
+ const contentRef = ref();
145
+ let isOpen = false;
146
+ const state = { activeIndex: -1, floatingCleanup: null, dismissCleanup: null };
147
+ function getContentEl() {
148
+ return contentRef.current ?? null;
149
+ }
150
+ function getItems() {
151
+ const content = getContentEl();
152
+ if (!content)
153
+ return [];
154
+ return [...content.querySelectorAll('[role="menuitem"]')];
155
+ }
156
+ function updateActiveItem(items, index) {
157
+ items.forEach((item, i) => {
158
+ item.setAttribute("tabindex", i === index ? "0" : "-1");
159
+ });
160
+ }
161
+ function open(x, y) {
162
+ isOpen = true;
163
+ state.activeIndex = -1;
164
+ onOpenChange?.(true);
165
+ const contentEl = getContentEl();
166
+ if (contentEl) {
167
+ updateContentDOM(contentEl, true);
168
+ }
169
+ queueMicrotask(() => {
170
+ const el = contentEl ?? getContentEl();
171
+ if (!el)
172
+ return;
173
+ const effectivePositioning = {
174
+ ...positioning ?? {},
175
+ placement: positioning?.placement ?? "bottom-start"
176
+ };
177
+ const result = createFloatingPosition(virtualElement(x, y), el, effectivePositioning);
178
+ state.floatingCleanup = result.cleanup;
179
+ state.dismissCleanup = createDismiss({
180
+ onDismiss: close,
181
+ insideElements: [el],
182
+ escapeKey: false
183
+ });
184
+ const items = getItems();
185
+ updateActiveItem(items, -1);
186
+ el.focus();
187
+ });
188
+ }
189
+ function close() {
190
+ isOpen = false;
191
+ state.floatingCleanup?.();
192
+ state.floatingCleanup = null;
193
+ state.dismissCleanup?.();
194
+ state.dismissCleanup = null;
195
+ onOpenChange?.(false);
196
+ const contentEl = getContentEl();
197
+ if (contentEl) {
198
+ updateContentDOM(contentEl, false);
199
+ }
200
+ }
201
+ const ctx = {
202
+ isOpen,
203
+ contentId: ids.contentId,
204
+ contentRef,
205
+ classes,
206
+ onSelect,
207
+ open,
208
+ close,
209
+ _contentCount: { value: 0 }
210
+ };
211
+ return jsxDEV_7x81h0kn(ContextMenuContext.Provider, {
212
+ value: ctx,
213
+ children: jsxDEV_7x81h0kn("span", {
214
+ style: { display: "contents" },
215
+ "data-contextmenu-root": ids.contentId,
216
+ children
217
+ }, undefined, false, undefined, this)
218
+ }, undefined, false, undefined, this);
219
+ }
220
+ var ComposedContextMenu = Object.assign(ComposedContextMenuRoot, {
221
+ Trigger: ContextMenuTrigger,
222
+ Content: ContextMenuContent,
223
+ Item: ContextMenuItem,
224
+ Group: ContextMenuGroup,
225
+ Label: ContextMenuLabel,
226
+ Separator: ContextMenuSeparator
227
+ });
228
+
229
+ export { ComposedContextMenu };
@@ -21,150 +21,61 @@ import {
21
21
  } from "./chunk-2db2dnp3.js";
22
22
 
23
23
  // src/navigation-menu/navigation-menu.tsx
24
- import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
24
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
25
25
  import { signal } from "@vertz/ui";
26
26
  function NavMenuList(triggers, orientation) {
27
- const __mfDepth = __pushMountFrame();
28
- try {
29
- const __mfResult0 = (() => {
30
- const __el0 = __element("div");
31
- __on(__el0, "keydown", (event) => {
32
- if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.Home, Keys.End)) {
33
- handleListNavigation(event, triggers, {
34
- orientation: orientation === "horizontal" ? "horizontal" : "vertical"
35
- });
36
- }
37
- });
38
- return __el0;
39
- })();
40
- __flushMountFrame();
41
- return __mfResult0;
42
- } catch (__mfErr) {
43
- __discardMountFrame(__mfDepth);
44
- throw __mfErr;
45
- }
27
+ return jsxDEV_7x81h0kn("div", {
28
+ onKeydown: (event) => {
29
+ if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.Home, Keys.End)) {
30
+ handleListNavigation(event, triggers, {
31
+ orientation: orientation === "horizontal" ? "horizontal" : "vertical"
32
+ });
33
+ }
34
+ }
35
+ }, undefined, false, undefined, this);
46
36
  }
47
37
  function NavMenuViewport() {
48
- const __mfDepth = __pushMountFrame();
49
- try {
50
- const __mfResult0 = (() => {
51
- const __el0 = __element("div");
52
- return __el0;
53
- })();
54
- __flushMountFrame();
55
- return __mfResult0;
56
- } catch (__mfErr) {
57
- __discardMountFrame(__mfDepth);
58
- throw __mfErr;
59
- }
38
+ return jsxDEV_7x81h0kn("div", {}, undefined, false, undefined, this);
60
39
  }
61
40
  function NavMenuNav(list, viewport) {
62
- const __mfDepth = __pushMountFrame();
63
- try {
64
- const __mfResult0 = (() => {
65
- const __el0 = __element("nav");
66
- __enterChildren(__el0);
67
- __insert(__el0, list);
68
- __insert(__el0, viewport);
69
- __exitChildren();
70
- return __el0;
71
- })();
72
- __flushMountFrame();
73
- return __mfResult0;
74
- } catch (__mfErr) {
75
- __discardMountFrame(__mfDepth);
76
- throw __mfErr;
77
- }
41
+ return jsxDEV_7x81h0kn("nav", {
42
+ children: [
43
+ list,
44
+ viewport
45
+ ]
46
+ }, undefined, true, undefined, this);
78
47
  }
79
48
  function NavMenuItemTrigger(triggerId, contentId, value, label, onClick, onMouseenter, onMouseleave, onKeydown) {
80
- const __mfDepth = __pushMountFrame();
81
- try {
82
- const __mfResult0 = (() => {
83
- const __el0 = __element("button");
84
- __el0.setAttribute("type", "button");
85
- {
86
- const __v = triggerId;
87
- if (__v != null && __v !== false)
88
- __el0.setAttribute("id", __v === true ? "" : __v);
89
- }
90
- {
91
- const __v = contentId;
92
- if (__v != null && __v !== false)
93
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
94
- }
95
- {
96
- const __v = value;
97
- if (__v != null && __v !== false)
98
- __el0.setAttribute("data-value", __v === true ? "" : __v);
99
- }
100
- __el0.setAttribute("aria-expanded", "false");
101
- __el0.setAttribute("data-state", "closed");
102
- __on(__el0, "click", onClick);
103
- __on(__el0, "mouseenter", onMouseenter);
104
- __on(__el0, "mouseleave", onMouseleave);
105
- __on(__el0, "keydown", onKeydown);
106
- __enterChildren(__el0);
107
- __insert(__el0, label ?? value);
108
- __exitChildren();
109
- return __el0;
110
- })();
111
- __flushMountFrame();
112
- return __mfResult0;
113
- } catch (__mfErr) {
114
- __discardMountFrame(__mfDepth);
115
- throw __mfErr;
116
- }
49
+ return jsxDEV_7x81h0kn("button", {
50
+ type: "button",
51
+ id: triggerId,
52
+ "aria-controls": contentId,
53
+ "data-value": value,
54
+ "aria-expanded": "false",
55
+ "data-state": "closed",
56
+ onClick,
57
+ onMouseenter,
58
+ onMouseleave,
59
+ onKeydown,
60
+ children: label ?? value
61
+ }, undefined, false, undefined, this);
117
62
  }
118
63
  function NavMenuItemContent(contentId, onMouseenter, onMouseleave, onKeydown) {
119
- const __mfDepth = __pushMountFrame();
120
- try {
121
- const __mfResult0 = (() => {
122
- const __el0 = __element("div");
123
- {
124
- const __v = contentId;
125
- if (__v != null && __v !== false)
126
- __el0.setAttribute("id", __v === true ? "" : __v);
127
- }
128
- __el0.setAttribute("aria-hidden", "true");
129
- __el0.setAttribute("data-state", "closed");
130
- {
131
- const __v = { display: "none" };
132
- if (__v != null && __v !== false)
133
- __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
134
- }
135
- __on(__el0, "mouseenter", onMouseenter);
136
- __on(__el0, "mouseleave", onMouseleave);
137
- __on(__el0, "keydown", onKeydown);
138
- return __el0;
139
- })();
140
- __flushMountFrame();
141
- return __mfResult0;
142
- } catch (__mfErr) {
143
- __discardMountFrame(__mfDepth);
144
- throw __mfErr;
145
- }
64
+ return jsxDEV_7x81h0kn("div", {
65
+ id: contentId,
66
+ "aria-hidden": "true",
67
+ "data-state": "closed",
68
+ style: { display: "none" },
69
+ onMouseenter,
70
+ onMouseleave,
71
+ onKeydown
72
+ }, undefined, false, undefined, this);
146
73
  }
147
74
  function NavMenuLink(href, label) {
148
- const __mfDepth = __pushMountFrame();
149
- try {
150
- const __mfResult0 = (() => {
151
- const __el0 = __element("a");
152
- {
153
- const __v = href;
154
- if (__v != null && __v !== false)
155
- __el0.setAttribute("href", __v === true ? "" : __v);
156
- }
157
- __enterChildren(__el0);
158
- __insert(__el0, label);
159
- __exitChildren();
160
- return __el0;
161
- })();
162
- __flushMountFrame();
163
- return __mfResult0;
164
- } catch (__mfErr) {
165
- __discardMountFrame(__mfDepth);
166
- throw __mfErr;
167
- }
75
+ return jsxDEV_7x81h0kn("a", {
76
+ href,
77
+ children: label
78
+ }, undefined, false, undefined, this);
168
79
  }
169
80
  function NavigationMenuRoot(options = {}) {
170
81
  const { orientation = "horizontal", delayOpen = 200, delayClose = 300, ...attrs } = options;