@vertz/ui-primitives 0.2.23 → 0.2.25

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 (191) hide show
  1. package/dist/shared/{chunk-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
  2. package/dist/shared/chunk-1dx23qnr.js +232 -0
  3. package/dist/shared/chunk-1hm0mbke.js +258 -0
  4. package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
  5. package/dist/shared/chunk-3jack97k.js +509 -0
  6. package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
  7. package/dist/shared/chunk-4z006v1j.js +467 -0
  8. package/dist/shared/{chunk-b25npqer.js → chunk-585ysr70.js} +1 -1
  9. package/dist/shared/chunk-5964gmv0.js +416 -0
  10. package/dist/shared/chunk-75pegjs7.js +26 -0
  11. package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
  12. package/dist/shared/chunk-7wem1bhb.js +252 -0
  13. package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
  14. package/dist/shared/chunk-8t0nm721.js +152 -0
  15. package/dist/shared/chunk-94twh4s4.js +28 -0
  16. package/dist/shared/chunk-98y1sw9y.js +398 -0
  17. package/dist/shared/chunk-9eedsnnk.js +164 -0
  18. package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
  19. package/dist/shared/{chunk-4894pmy6.js → chunk-9ydd4pn3.js} +6 -1
  20. package/dist/shared/chunk-aa3w85hn.js +321 -0
  21. package/dist/shared/chunk-axpbdpgx.js +177 -0
  22. package/dist/shared/chunk-b4zzg457.js +410 -0
  23. package/dist/shared/chunk-bc2qqkhr.js +194 -0
  24. package/dist/shared/chunk-brk0drrk.js +202 -0
  25. package/dist/shared/chunk-czv0kqj4.js +107 -0
  26. package/dist/shared/chunk-d83ag07h.js +189 -0
  27. package/dist/shared/{chunk-3kwh27dv.js → chunk-de18ashk.js} +0 -1
  28. package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
  29. package/dist/shared/chunk-e6660g7e.js +179 -0
  30. package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
  31. package/dist/shared/chunk-ev367pq3.js +102 -0
  32. package/dist/shared/chunk-fjykbv0v.js +214 -0
  33. package/dist/shared/chunk-ghkw5bjq.js +55 -0
  34. package/dist/shared/chunk-gqb1n1hj.js +60 -0
  35. package/dist/shared/chunk-hfjtkytb.js +310 -0
  36. package/dist/shared/chunk-hpvjfj0j.js +31 -0
  37. package/dist/shared/chunk-hxmxvp56.js +67 -0
  38. package/dist/shared/chunk-j9m2f0rd.js +162 -0
  39. package/dist/shared/chunk-jpyjk616.js +52 -0
  40. package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
  41. package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
  42. package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
  43. package/dist/shared/chunk-metxdt5x.js +28 -0
  44. package/dist/shared/chunk-mhn2aazf.js +353 -0
  45. package/dist/shared/chunk-mtx2cfbx.js +175 -0
  46. package/dist/shared/chunk-nsmvdxgp.js +213 -0
  47. package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
  48. package/dist/shared/chunk-pzknpa1y.js +327 -0
  49. package/dist/shared/chunk-q1ff3xp3.js +95 -0
  50. package/dist/shared/chunk-q7xbcj9q.js +7 -0
  51. package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
  52. package/dist/shared/chunk-qrm43tr3.js +357 -0
  53. package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
  54. package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
  55. package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
  56. package/dist/shared/chunk-r3ngaa64.js +418 -0
  57. package/dist/shared/chunk-r3pffzss.js +13 -0
  58. package/dist/shared/chunk-rrt62bp0.js +353 -0
  59. package/dist/shared/chunk-s24gkmna.js +131 -0
  60. package/dist/shared/chunk-s62e7jf4.js +30 -0
  61. package/dist/shared/chunk-spng4yb9.js +73 -0
  62. package/dist/shared/chunk-v0b5pkcq.js +30 -0
  63. package/dist/shared/chunk-v11kd39k.js +162 -0
  64. package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
  65. package/dist/shared/chunk-vkscwzpr.js +294 -0
  66. package/dist/shared/chunk-vv187snj.js +112 -0
  67. package/dist/shared/chunk-wqsek87j.js +311 -0
  68. package/dist/shared/chunk-wtkxz2te.js +157 -0
  69. package/dist/shared/chunk-y1hpsqzy.js +185 -0
  70. package/dist/shared/chunk-yfzddvxc.js +71 -0
  71. package/dist/src/accordion/accordion-composed.d.ts +30 -0
  72. package/dist/src/accordion/accordion-composed.js +6 -0
  73. package/dist/src/accordion/accordion.js +1 -1
  74. package/dist/src/alert/alert-composed.d.ts +26 -0
  75. package/dist/src/alert/alert-composed.js +6 -0
  76. package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
  77. package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
  78. package/dist/src/avatar/avatar-composed.d.ts +33 -0
  79. package/dist/src/avatar/avatar-composed.js +6 -0
  80. package/dist/src/badge/badge-composed.d.ts +33 -0
  81. package/dist/src/badge/badge-composed.js +6 -0
  82. package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
  83. package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
  84. package/dist/src/button/button-composed.d.ts +34 -0
  85. package/dist/src/button/button-composed.js +6 -0
  86. package/dist/src/calendar/calendar-composed.d.ts +42 -0
  87. package/dist/src/calendar/calendar-composed.js +6 -0
  88. package/dist/src/calendar/calendar.js +1 -1
  89. package/dist/src/card/card-composed.d.ts +34 -0
  90. package/dist/src/card/card-composed.js +6 -0
  91. package/dist/src/carousel/carousel-composed.d.ts +32 -0
  92. package/dist/src/carousel/carousel-composed.js +6 -0
  93. package/dist/src/carousel/carousel.js +1 -1
  94. package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
  95. package/dist/src/checkbox/checkbox-composed.js +6 -0
  96. package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
  97. package/dist/src/collapsible/collapsible-composed.js +6 -0
  98. package/dist/src/combobox/combobox-composed.d.ts +30 -0
  99. package/dist/src/combobox/combobox-composed.js +6 -0
  100. package/dist/src/combobox/combobox.js +1 -1
  101. package/dist/src/command/command-composed.d.ts +67 -0
  102. package/dist/src/command/command-composed.js +6 -0
  103. package/dist/src/command/command.js +1 -1
  104. package/dist/src/composed/with-styles.d.ts +38 -0
  105. package/dist/src/composed/with-styles.js +6 -0
  106. package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
  107. package/dist/src/context-menu/context-menu-composed.js +6 -0
  108. package/dist/src/context-menu/context-menu.js +1 -1
  109. package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
  110. package/dist/src/date-picker/date-picker-composed.js +6 -0
  111. package/dist/src/date-picker/date-picker.js +1 -1
  112. package/dist/src/dialog/dialog-composed.d.ts +36 -0
  113. package/dist/src/dialog/dialog-composed.js +6 -0
  114. package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
  115. package/dist/src/dialog/dialog-stack-parts.js +18 -0
  116. package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
  117. package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
  118. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  119. package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
  120. package/dist/src/empty-state/empty-state-composed.js +6 -0
  121. package/dist/src/form-group/form-group-composed.d.ts +24 -0
  122. package/dist/src/form-group/form-group-composed.js +6 -0
  123. package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
  124. package/dist/src/hover-card/hover-card-composed.js +6 -0
  125. package/dist/src/hover-card/hover-card.js +1 -1
  126. package/dist/src/index.d.ts +1312 -812
  127. package/dist/src/index.js +79 -6566
  128. package/dist/src/input/input-composed.d.ts +35 -0
  129. package/dist/src/input/input-composed.js +6 -0
  130. package/dist/src/label/label-composed.d.ts +32 -0
  131. package/dist/src/label/label-composed.js +6 -0
  132. package/dist/src/list/list-composed.d.ts +34 -0
  133. package/dist/src/list/list-composed.js +6 -0
  134. package/dist/src/menu/menu-composed.d.ts +51 -0
  135. package/dist/src/menu/menu-composed.js +6 -0
  136. package/dist/src/menu/menu.js +1 -1
  137. package/dist/src/menubar/menubar-composed.d.ts +56 -0
  138. package/dist/src/menubar/menubar-composed.js +6 -0
  139. package/dist/src/menubar/menubar.js +1 -1
  140. package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
  141. package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
  142. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  143. package/dist/src/pagination/pagination-composed.d.ts +30 -0
  144. package/dist/src/pagination/pagination-composed.js +6 -0
  145. package/dist/src/popover/popover-composed.d.ts +36 -0
  146. package/dist/src/popover/popover-composed.js +6 -0
  147. package/dist/src/popover/popover.js +1 -1
  148. package/dist/src/progress/progress-composed.d.ts +17 -0
  149. package/dist/src/progress/progress-composed.js +6 -0
  150. package/dist/src/radio/radio-composed.d.ts +24 -0
  151. package/dist/src/radio/radio-composed.js +6 -0
  152. package/dist/src/radio/radio.js +1 -1
  153. package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
  154. package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
  155. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  156. package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
  157. package/dist/src/scroll-area/scroll-area-composed.js +6 -0
  158. package/dist/src/scroll-area/scroll-area.js +1 -1
  159. package/dist/src/select/select-composed.d.ts +53 -0
  160. package/dist/src/select/select-composed.js +6 -0
  161. package/dist/src/select/select.js +1 -1
  162. package/dist/src/separator/separator-composed.d.ts +32 -0
  163. package/dist/src/separator/separator-composed.js +6 -0
  164. package/dist/src/sheet/sheet-composed.d.ts +34 -0
  165. package/dist/src/sheet/sheet-composed.js +6 -0
  166. package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
  167. package/dist/src/skeleton/skeleton-composed.js +6 -0
  168. package/dist/src/slider/slider-composed.d.ts +22 -0
  169. package/dist/src/slider/slider-composed.js +6 -0
  170. package/dist/src/switch/switch-composed.d.ts +17 -0
  171. package/dist/src/switch/switch-composed.js +6 -0
  172. package/dist/src/table/table-composed.d.ts +34 -0
  173. package/dist/src/table/table-composed.js +6 -0
  174. package/dist/src/tabs/tabs-composed.d.ts +33 -0
  175. package/dist/src/tabs/tabs-composed.js +6 -0
  176. package/dist/src/tabs/tabs.js +1 -1
  177. package/dist/src/textarea/textarea-composed.d.ts +35 -0
  178. package/dist/src/textarea/textarea-composed.js +6 -0
  179. package/dist/src/toast/toast.js +1 -1
  180. package/dist/src/toggle/toggle-composed.d.ts +16 -0
  181. package/dist/src/toggle/toggle-composed.js +6 -0
  182. package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
  183. package/dist/src/toggle-group/toggle-group-composed.js +6 -0
  184. package/dist/src/toggle-group/toggle-group.js +1 -1
  185. package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
  186. package/dist/src/tooltip/tooltip-composed.js +6 -0
  187. package/dist/src/tooltip/tooltip.js +1 -1
  188. package/dist/src/utils.js +1 -1
  189. package/package.json +3 -3
  190. package/dist/shared/chunk-56reyd5r.js +0 -64
  191. package/dist/shared/chunk-mgr904ap.js +0 -370
@@ -0,0 +1,213 @@
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 { computed, signal } from "@vertz/ui";
14
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
15
+ import { createContext, ref, useContext } from "@vertz/ui";
16
+ var HoverCardContext = createContext(undefined, "@vertz/ui-primitives::HoverCardContext");
17
+ function useHoverCardContext(componentName) {
18
+ const ctx = useContext(HoverCardContext);
19
+ if (!ctx) {
20
+ throw new Error(`<HoverCard.${componentName}> must be used inside <HoverCard>. ` + "Ensure it is a direct or nested child of the HoverCard root component.");
21
+ }
22
+ return ctx;
23
+ }
24
+ function HoverCardTrigger(__props) {
25
+ const __mfDepth = __pushMountFrame();
26
+ try {
27
+ const ctx = useHoverCardContext("Trigger");
28
+ const childNodes = computed(() => Array.isArray(__props.children) ? __props.children : [__props.children]);
29
+ const childEl = computed(() => childNodes.value.find((c) => c instanceof HTMLElement));
30
+ if (childEl.value) {
31
+ childEl.value.setAttribute("aria-haspopup", "dialog");
32
+ childEl.value.setAttribute("aria-expanded", ctx.isOpen() ? "true" : "false");
33
+ childEl.value.addEventListener("focus", () => ctx.showImmediate());
34
+ childEl.value.addEventListener("blur", () => ctx.hide());
35
+ }
36
+ const __mfResult0 = (() => {
37
+ const __el0 = __element("span");
38
+ ctx.triggerRef.current = __el0;
39
+ {
40
+ const __v = { display: "contents" };
41
+ if (__v != null && __v !== false)
42
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
43
+ }
44
+ __el0.setAttribute("data-hovercard-trigger", "");
45
+ __on(__el0, "mouseenter", () => ctx.show());
46
+ __on(__el0, "mouseleave", () => ctx.hide());
47
+ __on(__el0, "focusin", () => ctx.showImmediate());
48
+ __on(__el0, "focusout", () => ctx.hide());
49
+ __enterChildren(__el0);
50
+ __append(__el0, __child(() => __props.children));
51
+ __exitChildren();
52
+ return __el0;
53
+ })();
54
+ __flushMountFrame();
55
+ return __mfResult0;
56
+ } catch (__mfErr) {
57
+ __discardMountFrame(__mfDepth);
58
+ throw __mfErr;
59
+ }
60
+ }
61
+ function HoverCardContent(__props) {
62
+ const __mfDepth = __pushMountFrame();
63
+ try {
64
+ const ctx = useHoverCardContext("Content");
65
+ const isOpen = ctx.isOpen();
66
+ const __mfResult0 = (() => {
67
+ const __el0 = __element("div");
68
+ ctx.contentRef.current = __el0;
69
+ __el0.setAttribute("role", "dialog");
70
+ {
71
+ const __v = ctx.contentId;
72
+ if (__v != null && __v !== false)
73
+ __el0.setAttribute("id", __v === true ? "" : __v);
74
+ }
75
+ __el0.setAttribute("data-hovercard-content", "");
76
+ {
77
+ const __v = isOpen ? "false" : "true";
78
+ if (__v != null && __v !== false)
79
+ __el0.setAttribute("aria-hidden", __v === true ? "" : __v);
80
+ }
81
+ {
82
+ const __v = isOpen ? "open" : "closed";
83
+ if (__v != null && __v !== false)
84
+ __el0.setAttribute("data-state", __v === true ? "" : __v);
85
+ }
86
+ {
87
+ const __v = { display: isOpen ? "" : "none" };
88
+ if (__v != null && __v !== false)
89
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
90
+ }
91
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
92
+ __on(__el0, "mouseenter", () => ctx.cancelCloseTimer());
93
+ __on(__el0, "mouseleave", () => ctx.hide());
94
+ __on(__el0, "focusin", () => ctx.cancelCloseTimer());
95
+ __on(__el0, "focusout", () => ctx.hide());
96
+ __enterChildren(__el0);
97
+ __append(__el0, __child(() => __props.children));
98
+ __exitChildren();
99
+ return __el0;
100
+ })();
101
+ __flushMountFrame();
102
+ return __mfResult0;
103
+ } catch (__mfErr) {
104
+ __discardMountFrame(__mfDepth);
105
+ throw __mfErr;
106
+ }
107
+ }
108
+ function ComposedHoverCardRoot(__props) {
109
+ const __mfDepth = __pushMountFrame();
110
+ try {
111
+ let cancelTimers = function() {
112
+ if (timers.open) {
113
+ clearTimeout(timers.open);
114
+ timers.open = null;
115
+ }
116
+ if (timers.close) {
117
+ clearTimeout(timers.close);
118
+ timers.close = null;
119
+ }
120
+ }, cancelCloseTimer = function() {
121
+ if (timers.close) {
122
+ clearTimeout(timers.close);
123
+ timers.close = null;
124
+ }
125
+ }, applyFloating = function() {
126
+ const triggerSpan = triggerRef.current;
127
+ const contentEl = contentRef.current;
128
+ if (!triggerSpan || !contentEl)
129
+ return;
130
+ const triggerEl = resolveLayoutElement(triggerSpan);
131
+ contentEl.style.position = "fixed";
132
+ const floatingOpts = __props.positioning ?? { placement: "bottom", offset: 4 };
133
+ const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
134
+ timers.floatingCleanup = result.cleanup;
135
+ }, cleanupFloating = function() {
136
+ timers.floatingCleanup?.();
137
+ timers.floatingCleanup = null;
138
+ }, show = function() {
139
+ cancelTimers();
140
+ if (isOpen.value)
141
+ return;
142
+ timers.open = setTimeout(() => {
143
+ timers.open = null;
144
+ isOpen.value = true;
145
+ applyFloating();
146
+ __props.onOpenChange?.(true);
147
+ }, __props.openDelay ?? 700);
148
+ }, showImmediate = function() {
149
+ cancelTimers();
150
+ isOpen.value = true;
151
+ applyFloating();
152
+ __props.onOpenChange?.(true);
153
+ }, hide = function() {
154
+ cancelTimers();
155
+ if (!isOpen.value)
156
+ return;
157
+ timers.close = setTimeout(() => {
158
+ timers.close = null;
159
+ isOpen.value = false;
160
+ cleanupFloating();
161
+ __props.onOpenChange?.(false);
162
+ }, __props.closeDelay ?? 300);
163
+ }, hideImmediate = function() {
164
+ cancelTimers();
165
+ isOpen.value = false;
166
+ cleanupFloating();
167
+ __props.onOpenChange?.(false);
168
+ };
169
+ const contentId = uniqueId("hovercard");
170
+ const triggerRef = ref();
171
+ const contentRef = ref();
172
+ const isOpen = signal(false, "isOpen");
173
+ const timers = { open: null, close: null, floatingCleanup: null };
174
+ const ctx = {
175
+ isOpen: () => isOpen.value,
176
+ contentId,
177
+ triggerRef,
178
+ contentRef,
179
+ classes: __props.classes,
180
+ show,
181
+ hide,
182
+ showImmediate,
183
+ hideImmediate,
184
+ cancelCloseTimer
185
+ };
186
+ const __mfResult0 = HoverCardContext.Provider({ get value() {
187
+ return ctx;
188
+ }, children: () => (() => {
189
+ const __el0 = __element("span");
190
+ {
191
+ const __v = { display: "contents" };
192
+ if (__v != null && __v !== false)
193
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
194
+ }
195
+ __el0.setAttribute("data-hovercard-root", "");
196
+ __enterChildren(__el0);
197
+ __append(__el0, __child(() => __props.children));
198
+ __exitChildren();
199
+ return __el0;
200
+ })() });
201
+ __flushMountFrame();
202
+ return __mfResult0;
203
+ } catch (__mfErr) {
204
+ __discardMountFrame(__mfDepth);
205
+ throw __mfErr;
206
+ }
207
+ }
208
+ var ComposedHoverCard = Object.assign(ComposedHoverCardRoot, {
209
+ Trigger: HoverCardTrigger,
210
+ Content: HoverCardContent
211
+ });
212
+
213
+ export { ComposedHoverCard };
@@ -270,14 +270,10 @@ function NavigationMenuRoot(options = {}) {
270
270
  triggers.push(trigger);
271
271
  setRovingTabindex(triggers, 0);
272
272
  items.set(value, { trigger, content: contentEl });
273
- list.appendChild(trigger);
274
- viewport.appendChild(contentEl);
275
273
  return { trigger, content: contentEl };
276
274
  }
277
275
  function Link(href, label) {
278
- const a = NavMenuLink(href, label);
279
- list.appendChild(a);
280
- return a;
276
+ return NavMenuLink(href, label);
281
277
  }
282
278
  applyAttrs(root, attrs);
283
279
  return { root, list, viewport, state, Item, Link };
@@ -0,0 +1,327 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ linkedIds
6
+ } from "./chunk-8y1jf6xr.js";
7
+
8
+ // src/dialog/dialog-composed.tsx
9
+ import { computed, signal } from "@vertz/ui";
10
+ import { __append, __attr, __child, __conditional, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
11
+ import { createContext, ref, useContext } from "@vertz/ui";
12
+ var DialogContext = createContext(undefined, "@vertz/ui-primitives::DialogContext");
13
+ function useDialogContext(componentName) {
14
+ const ctx = useContext(DialogContext);
15
+ if (!ctx) {
16
+ throw new Error(`<Dialog.${componentName}> must be used inside <Dialog>. ` + "Ensure it is a direct or nested child of the Dialog root component.");
17
+ }
18
+ return ctx;
19
+ }
20
+ function DialogTrigger(__props) {
21
+ const __mfDepth = __pushMountFrame();
22
+ try {
23
+ const ctx = useDialogContext("Trigger");
24
+ const __mfResult0 = (() => {
25
+ const __el0 = __element("span");
26
+ {
27
+ const __v = { display: "contents" };
28
+ if (__v != null && __v !== false)
29
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
30
+ }
31
+ __el0.setAttribute("data-dialog-trigger", "");
32
+ __el0.setAttribute("data-state", "closed");
33
+ __on(__el0, "click", () => ctx.toggle());
34
+ __enterChildren(__el0);
35
+ __append(__el0, __child(() => __props.children));
36
+ __exitChildren();
37
+ return __el0;
38
+ })();
39
+ __flushMountFrame();
40
+ return __mfResult0;
41
+ } catch (__mfErr) {
42
+ __discardMountFrame(__mfDepth);
43
+ throw __mfErr;
44
+ }
45
+ }
46
+ function DialogContent(__props) {
47
+ const __mfDepth = __pushMountFrame();
48
+ try {
49
+ const ctx = useDialogContext("Content");
50
+ const el = computed(() => (() => {
51
+ const __el0 = __element("dialog");
52
+ ctx.dialogRef.current = __el0;
53
+ {
54
+ const __v = ctx.contentId;
55
+ if (__v != null && __v !== false)
56
+ __el0.setAttribute("id", __v === true ? "" : __v);
57
+ }
58
+ __el0.setAttribute("role", "dialog");
59
+ {
60
+ const __v = ctx.titleId;
61
+ if (__v != null && __v !== false)
62
+ __el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
63
+ }
64
+ {
65
+ const __v = ctx.descriptionId;
66
+ if (__v != null && __v !== false)
67
+ __el0.setAttribute("aria-describedby", __v === true ? "" : __v);
68
+ }
69
+ __el0.setAttribute("data-state", "closed");
70
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
71
+ __on(__el0, "cancel", (e) => {
72
+ e.preventDefault();
73
+ ctx.close();
74
+ });
75
+ __on(__el0, "click", (e) => {
76
+ if (e.target === ctx.dialogRef.current)
77
+ ctx.close();
78
+ });
79
+ __enterChildren(__el0);
80
+ __append(__el0, __conditional(() => __props.showClose ?? true, () => (() => {
81
+ const __el1 = __element("button");
82
+ __el1.setAttribute("type", "button");
83
+ __el1.setAttribute("data-slot", "dialog-close");
84
+ {
85
+ const __v = cn(ctx.classes?.close);
86
+ if (__v != null && __v !== false)
87
+ __el1.setAttribute("class", __v === true ? "" : __v);
88
+ }
89
+ __el1.setAttribute("aria-label", "Close");
90
+ __on(__el1, "click", () => ctx.close());
91
+ __enterChildren(__el1);
92
+ __append(__el1, (() => {
93
+ const __el2 = __element("svg");
94
+ __el2.setAttribute("xmlns", "http://www.w3.org/2000/svg");
95
+ __el2.setAttribute("aria-hidden", "true");
96
+ __el2.setAttribute("focusable", "false");
97
+ __el2.setAttribute("width", "16");
98
+ __el2.setAttribute("height", "16");
99
+ __el2.setAttribute("viewBox", "0 0 24 24");
100
+ __el2.setAttribute("fill", "none");
101
+ __el2.setAttribute("stroke", "currentColor");
102
+ __el2.setAttribute("stroke-width", "2");
103
+ __el2.setAttribute("stroke-linecap", "round");
104
+ __el2.setAttribute("stroke-linejoin", "round");
105
+ __enterChildren(__el2);
106
+ __append(__el2, (() => {
107
+ const __el3 = __element("path");
108
+ __el3.setAttribute("d", "M18 6 6 18");
109
+ return __el3;
110
+ })());
111
+ __append(__el2, (() => {
112
+ const __el4 = __element("path");
113
+ __el4.setAttribute("d", "m6 6 12 12");
114
+ return __el4;
115
+ })());
116
+ __exitChildren();
117
+ return __el2;
118
+ })());
119
+ __exitChildren();
120
+ return __el1;
121
+ })(), () => null));
122
+ __append(__el0, __child(() => __props.children));
123
+ __exitChildren();
124
+ return __el0;
125
+ })());
126
+ const __mfResult0 = el.value;
127
+ __flushMountFrame();
128
+ return __mfResult0;
129
+ } catch (__mfErr) {
130
+ __discardMountFrame(__mfDepth);
131
+ throw __mfErr;
132
+ }
133
+ }
134
+ function DialogTitle(__props) {
135
+ const __mfDepth = __pushMountFrame();
136
+ try {
137
+ const ctx = useDialogContext("Title");
138
+ const __mfResult0 = (() => {
139
+ const __el0 = __element("h2");
140
+ {
141
+ const __v = ctx.titleId;
142
+ if (__v != null && __v !== false)
143
+ __el0.setAttribute("id", __v === true ? "" : __v);
144
+ }
145
+ __attr(__el0, "class", () => cn(ctx.classes?.title, __props.className ?? __props.class));
146
+ __enterChildren(__el0);
147
+ __append(__el0, __child(() => __props.children));
148
+ __exitChildren();
149
+ return __el0;
150
+ })();
151
+ __flushMountFrame();
152
+ return __mfResult0;
153
+ } catch (__mfErr) {
154
+ __discardMountFrame(__mfDepth);
155
+ throw __mfErr;
156
+ }
157
+ }
158
+ function DialogDescription(__props) {
159
+ const __mfDepth = __pushMountFrame();
160
+ try {
161
+ const ctx = useDialogContext("Description");
162
+ const __mfResult0 = (() => {
163
+ const __el0 = __element("p");
164
+ {
165
+ const __v = ctx.descriptionId;
166
+ if (__v != null && __v !== false)
167
+ __el0.setAttribute("id", __v === true ? "" : __v);
168
+ }
169
+ __attr(__el0, "class", () => cn(ctx.classes?.description, __props.className ?? __props.class));
170
+ __enterChildren(__el0);
171
+ __append(__el0, __child(() => __props.children));
172
+ __exitChildren();
173
+ return __el0;
174
+ })();
175
+ __flushMountFrame();
176
+ return __mfResult0;
177
+ } catch (__mfErr) {
178
+ __discardMountFrame(__mfDepth);
179
+ throw __mfErr;
180
+ }
181
+ }
182
+ function DialogHeader(__props) {
183
+ const __mfDepth = __pushMountFrame();
184
+ try {
185
+ const { classes } = useDialogContext("Header");
186
+ const __mfResult0 = (() => {
187
+ const __el0 = __element("div");
188
+ __attr(__el0, "class", () => cn(classes?.header, __props.className ?? __props.class));
189
+ __enterChildren(__el0);
190
+ __append(__el0, __child(() => __props.children));
191
+ __exitChildren();
192
+ return __el0;
193
+ })();
194
+ __flushMountFrame();
195
+ return __mfResult0;
196
+ } catch (__mfErr) {
197
+ __discardMountFrame(__mfDepth);
198
+ throw __mfErr;
199
+ }
200
+ }
201
+ function DialogFooter(__props) {
202
+ const __mfDepth = __pushMountFrame();
203
+ try {
204
+ const { classes } = useDialogContext("Footer");
205
+ const __mfResult0 = (() => {
206
+ const __el0 = __element("div");
207
+ __attr(__el0, "class", () => cn(classes?.footer, __props.className ?? __props.class));
208
+ __enterChildren(__el0);
209
+ __append(__el0, __child(() => __props.children));
210
+ __exitChildren();
211
+ return __el0;
212
+ })();
213
+ __flushMountFrame();
214
+ return __mfResult0;
215
+ } catch (__mfErr) {
216
+ __discardMountFrame(__mfDepth);
217
+ throw __mfErr;
218
+ }
219
+ }
220
+ function DialogClose(__props) {
221
+ const __mfDepth = __pushMountFrame();
222
+ try {
223
+ const ctx = useDialogContext("Close");
224
+ const __mfResult0 = (() => {
225
+ const __el0 = __element("button");
226
+ __el0.setAttribute("type", "button");
227
+ __el0.setAttribute("data-slot", "dialog-close");
228
+ __attr(__el0, "class", () => cn(ctx.classes?.close, __props.className ?? __props.class));
229
+ __attr(__el0, "aria-label", () => __props.children ? undefined : "Close");
230
+ __on(__el0, "click", () => ctx.close());
231
+ __enterChildren(__el0);
232
+ __append(__el0, __child(() => __props.children ?? "×"));
233
+ __exitChildren();
234
+ return __el0;
235
+ })();
236
+ __flushMountFrame();
237
+ return __mfResult0;
238
+ } catch (__mfErr) {
239
+ __discardMountFrame(__mfDepth);
240
+ throw __mfErr;
241
+ }
242
+ }
243
+ function ComposedDialogRoot(__props) {
244
+ const __mfDepth = __pushMountFrame();
245
+ try {
246
+ let showDialog = function() {
247
+ const el = dialogRef.current;
248
+ if (!el || el.open)
249
+ return;
250
+ el.setAttribute("data-state", "open");
251
+ el.showModal();
252
+ }, hideDialog = function() {
253
+ const el = dialogRef.current;
254
+ if (!el || !el.open)
255
+ return;
256
+ el.setAttribute("data-state", "closed");
257
+ el.offsetHeight;
258
+ const onEnd = () => {
259
+ el.removeEventListener("animationend", onEnd);
260
+ if (el.open)
261
+ el.close();
262
+ };
263
+ el.addEventListener("animationend", onEnd);
264
+ setTimeout(onEnd, 200);
265
+ }, open = function() {
266
+ isOpen.value = true;
267
+ showDialog();
268
+ __props.onOpenChange?.(true);
269
+ }, close = function() {
270
+ hideDialog();
271
+ isOpen.value = false;
272
+ __props.onOpenChange?.(false);
273
+ }, toggle = function() {
274
+ if (isOpen.value)
275
+ close();
276
+ else
277
+ open();
278
+ };
279
+ const ids = linkedIds("dialog");
280
+ const titleId = `${ids.contentId}-title`;
281
+ const descriptionId = `${ids.contentId}-description`;
282
+ const dialogRef = ref();
283
+ const isOpen = signal(false, "isOpen");
284
+ const ctx = {
285
+ isOpen,
286
+ titleId,
287
+ descriptionId,
288
+ contentId: ids.contentId,
289
+ dialogRef,
290
+ classes: __props.classes,
291
+ open,
292
+ close,
293
+ toggle
294
+ };
295
+ const __mfResult0 = DialogContext.Provider({ get value() {
296
+ return ctx;
297
+ }, children: () => (() => {
298
+ const __el0 = __element("span");
299
+ {
300
+ const __v = { display: "contents" };
301
+ if (__v != null && __v !== false)
302
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
303
+ }
304
+ __el0.setAttribute("data-dialog-root", "");
305
+ __enterChildren(__el0);
306
+ __append(__el0, __child(() => __props.children));
307
+ __exitChildren();
308
+ return __el0;
309
+ })() });
310
+ __flushMountFrame();
311
+ return __mfResult0;
312
+ } catch (__mfErr) {
313
+ __discardMountFrame(__mfDepth);
314
+ throw __mfErr;
315
+ }
316
+ }
317
+ var ComposedDialog = Object.assign(ComposedDialogRoot, {
318
+ Trigger: DialogTrigger,
319
+ Content: DialogContent,
320
+ Title: DialogTitle,
321
+ Description: DialogDescription,
322
+ Header: DialogHeader,
323
+ Footer: DialogFooter,
324
+ Close: DialogClose
325
+ });
326
+
327
+ export { ComposedDialog };
@@ -0,0 +1,95 @@
1
+ import {
2
+ setDataState
3
+ } from "./chunk-vevfhpc9.js";
4
+ import {
5
+ uniqueId
6
+ } from "./chunk-8y1jf6xr.js";
7
+ import {
8
+ applyAttrs
9
+ } from "./chunk-2db2dnp3.js";
10
+
11
+ // src/toast/toast.tsx
12
+ import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __pushMountFrame } from "@vertz/ui/internals";
13
+ import { signal } from "@vertz/ui";
14
+ function RegionElement(politeness) {
15
+ const __mfDepth = __pushMountFrame();
16
+ try {
17
+ const __mfResult0 = (() => {
18
+ const __el0 = __element("div");
19
+ __el0.setAttribute("role", "status");
20
+ {
21
+ const __v = politeness;
22
+ if (__v != null && __v !== false)
23
+ __el0.setAttribute("aria-live", __v === true ? "" : __v);
24
+ }
25
+ __el0.setAttribute("aria-atomic", "false");
26
+ __el0.setAttribute("data-state", "empty");
27
+ return __el0;
28
+ })();
29
+ __flushMountFrame();
30
+ return __mfResult0;
31
+ } catch (__mfErr) {
32
+ __discardMountFrame(__mfDepth);
33
+ throw __mfErr;
34
+ }
35
+ }
36
+ function MessageElement(id, content) {
37
+ const __mfDepth = __pushMountFrame();
38
+ try {
39
+ const __mfResult0 = (() => {
40
+ const __el0 = __element("div");
41
+ __el0.setAttribute("role", "status");
42
+ {
43
+ const __v = id;
44
+ if (__v != null && __v !== false)
45
+ __el0.setAttribute("data-toast-id", __v === true ? "" : __v);
46
+ }
47
+ __el0.setAttribute("data-state", "open");
48
+ __enterChildren(__el0);
49
+ __insert(__el0, content);
50
+ __exitChildren();
51
+ return __el0;
52
+ })();
53
+ __flushMountFrame();
54
+ return __mfResult0;
55
+ } catch (__mfErr) {
56
+ __discardMountFrame(__mfDepth);
57
+ throw __mfErr;
58
+ }
59
+ }
60
+ function ToastRoot(options = {}) {
61
+ const { duration = 5000, politeness = "polite", ...attrs } = options;
62
+ const state = { messages: signal([]) };
63
+ const region = RegionElement(politeness);
64
+ applyAttrs(region, attrs);
65
+ function announce(content) {
66
+ const id = uniqueId("toast");
67
+ const el = MessageElement(id, content);
68
+ const msg = { id, content, el };
69
+ state.messages.value = [...state.messages.peek(), msg];
70
+ region.appendChild(el);
71
+ setDataState(region, "active");
72
+ if (duration > 0) {
73
+ setTimeout(() => dismiss(id), duration);
74
+ }
75
+ return msg;
76
+ }
77
+ function dismiss(id) {
78
+ const messages = state.messages.peek().filter((m) => m.id !== id);
79
+ state.messages.value = messages;
80
+ const el = region.querySelector(`[data-toast-id="${id}"]`);
81
+ if (el) {
82
+ setDataState(el, "closed");
83
+ el.remove();
84
+ }
85
+ if (messages.length === 0) {
86
+ setDataState(region, "empty");
87
+ }
88
+ }
89
+ return { region, state, announce, dismiss };
90
+ }
91
+ var Toast = {
92
+ Root: ToastRoot
93
+ };
94
+
95
+ export { Toast };
@@ -0,0 +1,7 @@
1
+ // src/composed/cn.ts
2
+ function cn(...args) {
3
+ const result = args.filter(Boolean).join(" ");
4
+ return result || undefined;
5
+ }
6
+
7
+ export { cn };
@@ -53,7 +53,6 @@ function ResizablePanelRoot(options = {}) {
53
53
  }
54
54
  }
55
55
  updateSizes(sizes);
56
- root.appendChild(el);
57
56
  return el;
58
57
  }, Handle = function() {
59
58
  const handleIndex = handles.length;
@@ -144,7 +143,6 @@ function ResizablePanelRoot(options = {}) {
144
143
  return __el2;
145
144
  })();
146
145
  handles.push(handle);
147
- root.appendChild(handle);
148
146
  return handle;
149
147
  };
150
148
  const { orientation = "horizontal", onResize, ...attrs } = options;