@vertz/ui-primitives 0.2.38 → 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 (233) 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-fdse46x5.js +21 -0
  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-r3pffzss.js +0 -13
  214. package/dist/shared/chunk-rdr0rtpr.js +0 -131
  215. package/dist/shared/chunk-rj52ty6r.js +0 -147
  216. package/dist/shared/chunk-rnqc7735.js +0 -125
  217. package/dist/shared/chunk-rtk30950.js +0 -202
  218. package/dist/shared/chunk-s0xgd8vg.js +0 -266
  219. package/dist/shared/chunk-s415735j.js +0 -357
  220. package/dist/shared/chunk-s62e7jf4.js +0 -30
  221. package/dist/shared/chunk-snd8e6r8.js +0 -418
  222. package/dist/shared/chunk-spng4yb9.js +0 -73
  223. package/dist/shared/chunk-t887wwjc.js +0 -168
  224. package/dist/shared/chunk-tn0m98j8.js +0 -42
  225. package/dist/shared/chunk-v0b5pkcq.js +0 -30
  226. package/dist/shared/chunk-v5tj7veh.js +0 -284
  227. package/dist/shared/chunk-vkscwzpr.js +0 -294
  228. package/dist/shared/chunk-vv187snj.js +0 -112
  229. package/dist/shared/chunk-xv4wd0kf.js +0 -293
  230. package/dist/shared/chunk-y1hpsqzy.js +0 -185
  231. package/dist/shared/chunk-yfzddvxc.js +0 -71
  232. package/dist/shared/chunk-yzgzx2dh.js +0 -311
  233. package/dist/shared/chunk-z5j7ztf2.js +0 -467
@@ -0,0 +1,167 @@
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/hover-card/hover-card-composed.tsx
13
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
14
+ import { createContext, ref, useContext } from "@vertz/ui";
15
+ var HoverCardContext = createContext(undefined, "@vertz/ui-primitives::HoverCardContext");
16
+ function useHoverCardContext(componentName) {
17
+ const ctx = useContext(HoverCardContext);
18
+ if (!ctx) {
19
+ throw new Error(`<HoverCard.${componentName}> must be used inside <HoverCard>. ` + "Ensure it is a direct or nested child of the HoverCard root component.");
20
+ }
21
+ return ctx;
22
+ }
23
+ function HoverCardTrigger({ children }) {
24
+ const ctx = useHoverCardContext("Trigger");
25
+ const childNodes = Array.isArray(children) ? children : [children];
26
+ const childEl = childNodes.find((c) => c instanceof HTMLElement);
27
+ if (childEl) {
28
+ childEl.setAttribute("aria-haspopup", "dialog");
29
+ childEl.setAttribute("aria-expanded", ctx.isOpen() ? "true" : "false");
30
+ childEl.addEventListener("focus", () => ctx.showImmediate());
31
+ childEl.addEventListener("blur", () => ctx.hide());
32
+ }
33
+ return jsxDEV_7x81h0kn("span", {
34
+ ref: ctx.triggerRef,
35
+ style: { display: "contents" },
36
+ "data-hovercard-trigger": "",
37
+ onMouseenter: () => ctx.show(),
38
+ onMouseleave: () => ctx.hide(),
39
+ onFocusin: () => ctx.showImmediate(),
40
+ onFocusout: () => ctx.hide(),
41
+ children
42
+ }, undefined, false, undefined, this);
43
+ }
44
+ function HoverCardContent({ children, className: cls, class: classProp }) {
45
+ const ctx = useHoverCardContext("Content");
46
+ const isOpen = ctx.isOpen();
47
+ return jsxDEV_7x81h0kn("div", {
48
+ ref: ctx.contentRef,
49
+ role: "dialog",
50
+ id: ctx.contentId,
51
+ "data-hovercard-content": "",
52
+ "aria-hidden": isOpen ? "false" : "true",
53
+ "data-state": isOpen ? "open" : "closed",
54
+ style: { display: isOpen ? "" : "none" },
55
+ class: cn(ctx.classes?.content, cls ?? classProp),
56
+ onMouseenter: () => ctx.cancelCloseTimer(),
57
+ onMouseleave: () => ctx.hide(),
58
+ onFocusin: () => ctx.cancelCloseTimer(),
59
+ onFocusout: () => ctx.hide(),
60
+ children
61
+ }, undefined, false, undefined, this);
62
+ }
63
+ function ComposedHoverCardRoot({
64
+ children,
65
+ classes,
66
+ openDelay = 700,
67
+ closeDelay = 300,
68
+ onOpenChange,
69
+ positioning
70
+ }) {
71
+ const contentId = uniqueId("hovercard");
72
+ const triggerRef = ref();
73
+ const contentRef = ref();
74
+ let isOpen = false;
75
+ const timers = { open: null, close: null, floatingCleanup: null };
76
+ function cancelTimers() {
77
+ if (timers.open) {
78
+ clearTimeout(timers.open);
79
+ timers.open = null;
80
+ }
81
+ if (timers.close) {
82
+ clearTimeout(timers.close);
83
+ timers.close = null;
84
+ }
85
+ }
86
+ function cancelCloseTimer() {
87
+ if (timers.close) {
88
+ clearTimeout(timers.close);
89
+ timers.close = null;
90
+ }
91
+ }
92
+ function applyFloating() {
93
+ const triggerSpan = triggerRef.current;
94
+ const contentEl = contentRef.current;
95
+ if (!triggerSpan || !contentEl)
96
+ return;
97
+ const triggerEl = resolveLayoutElement(triggerSpan);
98
+ contentEl.style.position = "fixed";
99
+ const floatingOpts = positioning ?? { placement: "bottom", offset: 4 };
100
+ const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
101
+ timers.floatingCleanup = result.cleanup;
102
+ }
103
+ function cleanupFloating() {
104
+ timers.floatingCleanup?.();
105
+ timers.floatingCleanup = null;
106
+ }
107
+ function show() {
108
+ cancelTimers();
109
+ if (isOpen)
110
+ return;
111
+ timers.open = setTimeout(() => {
112
+ timers.open = null;
113
+ isOpen = true;
114
+ applyFloating();
115
+ onOpenChange?.(true);
116
+ }, openDelay);
117
+ }
118
+ function showImmediate() {
119
+ cancelTimers();
120
+ isOpen = true;
121
+ applyFloating();
122
+ onOpenChange?.(true);
123
+ }
124
+ function hide() {
125
+ cancelTimers();
126
+ if (!isOpen)
127
+ return;
128
+ timers.close = setTimeout(() => {
129
+ timers.close = null;
130
+ isOpen = false;
131
+ cleanupFloating();
132
+ onOpenChange?.(false);
133
+ }, closeDelay);
134
+ }
135
+ function hideImmediate() {
136
+ cancelTimers();
137
+ isOpen = false;
138
+ cleanupFloating();
139
+ onOpenChange?.(false);
140
+ }
141
+ const ctx = {
142
+ isOpen: () => isOpen,
143
+ contentId,
144
+ triggerRef,
145
+ contentRef,
146
+ classes,
147
+ show,
148
+ hide,
149
+ showImmediate,
150
+ hideImmediate,
151
+ cancelCloseTimer
152
+ };
153
+ return jsxDEV_7x81h0kn(HoverCardContext.Provider, {
154
+ value: ctx,
155
+ children: jsxDEV_7x81h0kn("span", {
156
+ style: { display: "contents" },
157
+ "data-hovercard-root": "",
158
+ children
159
+ }, undefined, false, undefined, this)
160
+ }, undefined, false, undefined, this);
161
+ }
162
+ var ComposedHoverCard = Object.assign(ComposedHoverCardRoot, {
163
+ Trigger: HoverCardTrigger,
164
+ Content: HoverCardContent
165
+ });
166
+
167
+ export { ComposedHoverCard };
@@ -0,0 +1,130 @@
1
+ import {
2
+ saveFocus,
3
+ trapFocus
4
+ } from "./chunk-e2v1c9ex.js";
5
+ import {
6
+ linkedIds
7
+ } from "./chunk-8y1jf6xr.js";
8
+ import {
9
+ setDataState,
10
+ setExpanded,
11
+ setHidden,
12
+ setHiddenAnimated
13
+ } from "./chunk-vevfhpc9.js";
14
+
15
+ // src/alert-dialog/alert-dialog.tsx
16
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
17
+ import { signal } from "@vertz/ui";
18
+ function AlertDialogTriggerEl(triggerId, contentId, defaultOpen, onClick) {
19
+ return jsxDEV_7x81h0kn("button", {
20
+ type: "button",
21
+ id: triggerId,
22
+ "aria-controls": contentId,
23
+ "aria-expanded": defaultOpen ? "true" : "false",
24
+ "data-state": defaultOpen ? "open" : "closed",
25
+ onClick
26
+ }, undefined, false, undefined, this);
27
+ }
28
+ function AlertDialogOverlayEl(defaultOpen) {
29
+ return jsxDEV_7x81h0kn("div", {
30
+ "data-alertdialog-overlay": "",
31
+ "aria-hidden": defaultOpen ? "false" : "true",
32
+ "data-state": defaultOpen ? "open" : "closed",
33
+ style: { display: defaultOpen ? "" : "none" }
34
+ }, undefined, false, undefined, this);
35
+ }
36
+ function AlertDialogContentEl(contentId, titleId, descriptionId, defaultOpen) {
37
+ return jsxDEV_7x81h0kn("div", {
38
+ role: "alertdialog",
39
+ id: contentId,
40
+ "aria-modal": "true",
41
+ "aria-labelledby": titleId,
42
+ "aria-describedby": descriptionId,
43
+ "aria-hidden": defaultOpen ? "false" : "true",
44
+ "data-state": defaultOpen ? "open" : "closed",
45
+ style: { display: defaultOpen ? "" : "none" }
46
+ }, undefined, false, undefined, this);
47
+ }
48
+ function AlertDialogTitleEl(titleId) {
49
+ return jsxDEV_7x81h0kn("h2", {
50
+ id: titleId
51
+ }, undefined, false, undefined, this);
52
+ }
53
+ function AlertDialogDescriptionEl(descriptionId) {
54
+ return jsxDEV_7x81h0kn("p", {
55
+ id: descriptionId
56
+ }, undefined, false, undefined, this);
57
+ }
58
+ function AlertDialogCancelBtn(onClick) {
59
+ return jsxDEV_7x81h0kn("button", {
60
+ type: "button",
61
+ onClick
62
+ }, undefined, false, undefined, this);
63
+ }
64
+ function AlertDialogActionBtn(onClick) {
65
+ return jsxDEV_7x81h0kn("button", {
66
+ type: "button",
67
+ onClick
68
+ }, undefined, false, undefined, this);
69
+ }
70
+ function AlertDialogRoot(options = {}) {
71
+ const { defaultOpen = false, onOpenChange, onAction } = options;
72
+ const ids = linkedIds("alertdialog");
73
+ const titleId = `${ids.contentId}-title`;
74
+ const descriptionId = `${ids.contentId}-description`;
75
+ const state = { open: signal(defaultOpen) };
76
+ let restoreFocus = null;
77
+ let removeTrap = null;
78
+ function show() {
79
+ if (state.open.peek())
80
+ return;
81
+ state.open.value = true;
82
+ setExpanded(trigger, true);
83
+ setHidden(overlay, false);
84
+ setHidden(content, false);
85
+ setDataState(trigger, "open");
86
+ setDataState(overlay, "open");
87
+ setDataState(content, "open");
88
+ restoreFocus = saveFocus();
89
+ removeTrap = trapFocus(content);
90
+ queueMicrotask(() => cancel.focus());
91
+ onOpenChange?.(true);
92
+ }
93
+ function hide() {
94
+ if (!state.open.peek())
95
+ return;
96
+ state.open.value = false;
97
+ setExpanded(trigger, false);
98
+ setDataState(trigger, "closed");
99
+ setDataState(overlay, "closed");
100
+ setDataState(content, "closed");
101
+ setHiddenAnimated(overlay, true);
102
+ setHiddenAnimated(content, true);
103
+ removeTrap?.();
104
+ removeTrap = null;
105
+ restoreFocus?.();
106
+ restoreFocus = null;
107
+ onOpenChange?.(false);
108
+ }
109
+ const trigger = AlertDialogTriggerEl(ids.triggerId, ids.contentId, defaultOpen, show);
110
+ const overlay = AlertDialogOverlayEl(defaultOpen);
111
+ const content = AlertDialogContentEl(ids.contentId, titleId, descriptionId, defaultOpen);
112
+ const title = AlertDialogTitleEl(titleId);
113
+ const description = AlertDialogDescriptionEl(descriptionId);
114
+ const cancel = AlertDialogCancelBtn(() => hide());
115
+ const action = AlertDialogActionBtn(() => {
116
+ onAction?.();
117
+ hide();
118
+ });
119
+ if (defaultOpen) {
120
+ restoreFocus = saveFocus();
121
+ removeTrap = trapFocus(content);
122
+ queueMicrotask(() => cancel.focus());
123
+ }
124
+ return { trigger, overlay, content, title, description, cancel, action, state, show, hide };
125
+ }
126
+ var AlertDialog = {
127
+ Root: AlertDialogRoot
128
+ };
129
+
130
+ export { AlertDialog };
@@ -0,0 +1,155 @@
1
+ import {
2
+ createDismiss
3
+ } from "./chunk-a6wp8c32.js";
4
+ import {
5
+ cn
6
+ } from "./chunk-q7xbcj9q.js";
7
+ import {
8
+ createFloatingPosition
9
+ } from "./chunk-vef3sepw.js";
10
+ import {
11
+ linkedIds
12
+ } from "./chunk-8y1jf6xr.js";
13
+
14
+ // src/popover/popover-composed.tsx
15
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
16
+ import { createContext, ref, useContext } from "@vertz/ui";
17
+ var PopoverContext = createContext(undefined, "@vertz/ui-primitives::PopoverContext");
18
+ function usePopoverContext(componentName) {
19
+ const ctx = useContext(PopoverContext);
20
+ if (!ctx) {
21
+ throw new Error(`<Popover.${componentName}> must be used inside <Popover>. ` + "Ensure it is a direct or nested child of the Popover root component.");
22
+ }
23
+ return ctx;
24
+ }
25
+ function PopoverTrigger({ children }) {
26
+ const ctx = usePopoverContext("Trigger");
27
+ return jsxDEV_7x81h0kn("span", {
28
+ style: { display: "contents" },
29
+ "data-popover-trigger": "",
30
+ "aria-haspopup": "dialog",
31
+ "aria-controls": ctx.contentId,
32
+ "aria-expanded": "false",
33
+ "data-state": "closed",
34
+ onClick: () => {
35
+ ctx.toggle();
36
+ const nowOpen = ctx.isOpen();
37
+ const el = document.querySelector(`[data-popover-trigger][aria-controls="${ctx.contentId}"]`);
38
+ if (el) {
39
+ el.setAttribute("aria-expanded", nowOpen ? "true" : "false");
40
+ el.setAttribute("data-state", nowOpen ? "open" : "closed");
41
+ }
42
+ },
43
+ children
44
+ }, undefined, false, undefined, this);
45
+ }
46
+ function PopoverContent({ children, className: cls, class: classProp }) {
47
+ const ctx = usePopoverContext("Content");
48
+ const instanceIndex = ctx._contentCount.value++;
49
+ if (instanceIndex > 0) {
50
+ console.warn("Duplicate <Popover.Content> detected – only the first is used");
51
+ }
52
+ return jsxDEV_7x81h0kn("div", {
53
+ ref: ctx.contentRef,
54
+ role: "dialog",
55
+ id: ctx.contentId,
56
+ "data-popover-content": "",
57
+ "aria-hidden": "true",
58
+ "data-state": "closed",
59
+ style: { display: "none" },
60
+ class: cn(ctx.classes?.content, cls ?? classProp),
61
+ children
62
+ }, undefined, false, undefined, this);
63
+ }
64
+ function ComposedPopoverRoot({
65
+ children,
66
+ classes,
67
+ onOpenChange,
68
+ positioning
69
+ }) {
70
+ const ids = linkedIds("popover");
71
+ const contentRef = ref();
72
+ let isOpen = false;
73
+ const cleanup = {
74
+ floating: null,
75
+ dismiss: null
76
+ };
77
+ function getElements() {
78
+ const content = contentRef.current ?? null;
79
+ let trigger = content ? content.parentElement?.querySelector("[data-popover-trigger]") : null;
80
+ while (trigger && getComputedStyle(trigger).display === "contents") {
81
+ trigger = trigger.firstElementChild;
82
+ }
83
+ return { trigger, content };
84
+ }
85
+ function syncContentAttrs(nowOpen) {
86
+ const content = contentRef.current;
87
+ if (!content)
88
+ return;
89
+ content.setAttribute("data-state", nowOpen ? "open" : "closed");
90
+ content.setAttribute("aria-hidden", nowOpen ? "false" : "true");
91
+ content.style.display = nowOpen ? "" : "none";
92
+ }
93
+ function open() {
94
+ isOpen = true;
95
+ syncContentAttrs(true);
96
+ const { trigger, content } = getElements();
97
+ if (trigger && content) {
98
+ content.style.position = "fixed";
99
+ const floatingOpts = positioning ?? {};
100
+ const result = createFloatingPosition(trigger, content, floatingOpts);
101
+ cleanup.floating = result.cleanup;
102
+ cleanup.dismiss = createDismiss({
103
+ onDismiss: close,
104
+ insideElements: [trigger, content],
105
+ escapeKey: true
106
+ });
107
+ }
108
+ onOpenChange?.(true);
109
+ }
110
+ function close() {
111
+ isOpen = false;
112
+ syncContentAttrs(false);
113
+ const content = contentRef.current;
114
+ if (content) {
115
+ content.style.position = "";
116
+ content.style.left = "";
117
+ content.style.top = "";
118
+ }
119
+ cleanup.floating?.();
120
+ cleanup.floating = null;
121
+ cleanup.dismiss?.();
122
+ cleanup.dismiss = null;
123
+ onOpenChange?.(false);
124
+ }
125
+ function toggle() {
126
+ if (isOpen)
127
+ close();
128
+ else
129
+ open();
130
+ }
131
+ const ctx = {
132
+ isOpen: () => isOpen,
133
+ contentId: ids.contentId,
134
+ contentRef,
135
+ classes,
136
+ open,
137
+ close,
138
+ toggle,
139
+ _contentCount: { value: 0 }
140
+ };
141
+ return jsxDEV_7x81h0kn(PopoverContext.Provider, {
142
+ value: ctx,
143
+ children: jsxDEV_7x81h0kn("span", {
144
+ style: { display: "contents" },
145
+ "data-popover-root": "",
146
+ children
147
+ }, undefined, false, undefined, this)
148
+ }, undefined, false, undefined, this);
149
+ }
150
+ var ComposedPopover = Object.assign(ComposedPopoverRoot, {
151
+ Trigger: PopoverTrigger,
152
+ Content: PopoverContent
153
+ });
154
+
155
+ export { ComposedPopover };
@@ -0,0 +1,123 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ uniqueId
6
+ } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ Keys,
9
+ isKey
10
+ } from "./chunk-7867pr13.js";
11
+
12
+ // src/radio/radio-composed.tsx
13
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
14
+ import { createContext, useContext } from "@vertz/ui";
15
+ var RadioGroupContext = createContext(undefined, "@vertz/ui-primitives::RadioGroupContext");
16
+ function RadioGroupItem({ value, disabled, children }) {
17
+ const ctx = useContext(RadioGroupContext);
18
+ if (!ctx) {
19
+ throw new Error("<RadioGroup.Item> must be used inside <RadioGroup>. " + "Ensure it is a direct or nested child of the RadioGroup root component.");
20
+ }
21
+ const isDisabled = disabled ?? false;
22
+ const isChecked = ctx.isSelected(value);
23
+ return jsxDEV_7x81h0kn("div", {
24
+ style: { display: "flex", alignItems: "center", gap: "0.5rem", cursor: "pointer" },
25
+ "data-radiogroup-item": "",
26
+ onClick: () => {
27
+ if (!isDisabled)
28
+ ctx.select(value);
29
+ },
30
+ children: [
31
+ jsxDEV_7x81h0kn("div", {
32
+ role: "radio",
33
+ "data-value": value,
34
+ "aria-checked": isChecked ? "true" : "false",
35
+ "data-state": isChecked ? "checked" : "unchecked",
36
+ tabindex: isChecked ? "0" : "-1",
37
+ "aria-disabled": isDisabled ? "true" : undefined,
38
+ class: cn(ctx.classes?.item),
39
+ style: { pointerEvents: isDisabled ? "none" : undefined, position: "relative" },
40
+ children: jsxDEV_7x81h0kn("span", {
41
+ "data-part": "indicator",
42
+ "data-state": isChecked ? "checked" : "unchecked",
43
+ class: cn(ctx.classes?.indicator),
44
+ children: jsxDEV_7x81h0kn("span", {
45
+ "data-part": "indicator-icon",
46
+ class: cn(ctx.classes?.indicatorIcon)
47
+ }, undefined, false, undefined, this)
48
+ }, undefined, false, undefined, this)
49
+ }, undefined, false, undefined, this),
50
+ children && jsxDEV_7x81h0kn("span", {
51
+ children
52
+ }, undefined, false, undefined, this)
53
+ ]
54
+ }, undefined, true, undefined, this);
55
+ }
56
+ function ComposedRadioGroupRoot({
57
+ children,
58
+ classes,
59
+ defaultValue = "",
60
+ onValueChange
61
+ }) {
62
+ let selectedValue = defaultValue;
63
+ function select(value) {
64
+ selectedValue = value;
65
+ onValueChange?.(value);
66
+ }
67
+ const ctx = {
68
+ isSelected: (value) => selectedValue === value,
69
+ classes,
70
+ select
71
+ };
72
+ return jsxDEV_7x81h0kn(RadioGroupContext.Provider, {
73
+ value: ctx,
74
+ children: jsxDEV_7x81h0kn("div", {
75
+ role: "radiogroup",
76
+ id: uniqueId("radiogroup"),
77
+ class: cn(classes?.root),
78
+ "data-radiogroup-root": "",
79
+ onKeydown: (event) => {
80
+ const root = event.currentTarget;
81
+ const items = [...root.querySelectorAll('[role="radio"]')];
82
+ const currentIdx = items.indexOf(document.activeElement);
83
+ if (currentIdx < 0)
84
+ return;
85
+ const len = items.length;
86
+ let nextIdx = -1;
87
+ if (isKey(event, Keys.ArrowDown, Keys.ArrowRight)) {
88
+ event.preventDefault();
89
+ nextIdx = (currentIdx + 1) % len;
90
+ } else if (isKey(event, Keys.ArrowUp, Keys.ArrowLeft)) {
91
+ event.preventDefault();
92
+ nextIdx = (currentIdx - 1 + len) % len;
93
+ } else if (isKey(event, Keys.Home)) {
94
+ event.preventDefault();
95
+ nextIdx = 0;
96
+ } else if (isKey(event, Keys.End)) {
97
+ event.preventDefault();
98
+ nextIdx = len - 1;
99
+ }
100
+ if (nextIdx < 0)
101
+ return;
102
+ const direction = isKey(event, Keys.End, Keys.ArrowUp, Keys.ArrowLeft) ? -1 : 1;
103
+ const startIdx = nextIdx;
104
+ while (items[nextIdx]?.getAttribute("aria-disabled") === "true") {
105
+ nextIdx = (nextIdx + direction + len) % len;
106
+ if (nextIdx === startIdx)
107
+ return;
108
+ }
109
+ const nextValue = items[nextIdx]?.getAttribute("data-value");
110
+ if (nextValue != null) {
111
+ select(nextValue);
112
+ items[nextIdx]?.focus();
113
+ }
114
+ },
115
+ children
116
+ }, undefined, false, undefined, this)
117
+ }, undefined, false, undefined, this);
118
+ }
119
+ var ComposedRadioGroup = Object.assign(ComposedRadioGroupRoot, {
120
+ Item: RadioGroupItem
121
+ });
122
+
123
+ export { ComposedRadioGroup };
@@ -0,0 +1,82 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/table/table-composed.tsx
6
+ import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
7
+ import { createContext, useContext } from "@vertz/ui";
8
+ var TableContext = createContext(undefined, "@vertz/ui-primitives::TableContext");
9
+ function TableHeader({ children, className, class: classProp }) {
10
+ const ctx = useContext(TableContext);
11
+ return jsxDEV_7x81h0kn("thead", {
12
+ class: cn(ctx?.classes?.header, className ?? classProp),
13
+ children
14
+ }, undefined, false, undefined, this);
15
+ }
16
+ function TableBody({ children, className, class: classProp }) {
17
+ const ctx = useContext(TableContext);
18
+ return jsxDEV_7x81h0kn("tbody", {
19
+ class: cn(ctx?.classes?.body, className ?? classProp),
20
+ children
21
+ }, undefined, false, undefined, this);
22
+ }
23
+ function TableRow({ children, className, class: classProp }) {
24
+ const ctx = useContext(TableContext);
25
+ return jsxDEV_7x81h0kn("tr", {
26
+ class: cn(ctx?.classes?.row, className ?? classProp),
27
+ children
28
+ }, undefined, false, undefined, this);
29
+ }
30
+ function TableHead({ children, className, class: classProp }) {
31
+ const ctx = useContext(TableContext);
32
+ return jsxDEV_7x81h0kn("th", {
33
+ scope: "col",
34
+ class: cn(ctx?.classes?.head, className ?? classProp),
35
+ children
36
+ }, undefined, false, undefined, this);
37
+ }
38
+ function TableCell({ children, className, class: classProp }) {
39
+ const ctx = useContext(TableContext);
40
+ return jsxDEV_7x81h0kn("td", {
41
+ class: cn(ctx?.classes?.cell, className ?? classProp),
42
+ children
43
+ }, undefined, false, undefined, this);
44
+ }
45
+ function TableCaption({ children, className, class: classProp }) {
46
+ const ctx = useContext(TableContext);
47
+ return jsxDEV_7x81h0kn("caption", {
48
+ class: cn(ctx?.classes?.caption, className ?? classProp),
49
+ children
50
+ }, undefined, false, undefined, this);
51
+ }
52
+ function TableFooter({ children, className, class: classProp }) {
53
+ const ctx = useContext(TableContext);
54
+ return jsxDEV_7x81h0kn("tfoot", {
55
+ class: cn(ctx?.classes?.footer, className ?? classProp),
56
+ children
57
+ }, undefined, false, undefined, this);
58
+ }
59
+ function ComposedTableRoot({ children, classes, className, class: classProp }) {
60
+ return jsxDEV_7x81h0kn(TableContext.Provider, {
61
+ value: { classes },
62
+ children: jsxDEV_7x81h0kn("div", {
63
+ style: { position: "relative", width: "100%", overflowX: "auto" },
64
+ children: jsxDEV_7x81h0kn("table", {
65
+ style: { borderCollapse: "collapse" },
66
+ class: cn(classes?.root, className ?? classProp),
67
+ children
68
+ }, undefined, false, undefined, this)
69
+ }, undefined, false, undefined, this)
70
+ }, undefined, false, undefined, this);
71
+ }
72
+ var ComposedTable = Object.assign(ComposedTableRoot, {
73
+ Header: TableHeader,
74
+ Body: TableBody,
75
+ Row: TableRow,
76
+ Head: TableHead,
77
+ Cell: TableCell,
78
+ Caption: TableCaption,
79
+ Footer: TableFooter
80
+ });
81
+
82
+ export { ComposedTable };