@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
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createFloatingPosition,
6
6
  virtualElement
7
- } from "./chunk-0mcr52hc.js";
7
+ } from "./chunk-vef3sepw.js";
8
8
  import {
9
9
  Keys,
10
10
  handleListNavigation,
@@ -72,7 +72,7 @@ function ContextMenuRoot(options = {}) {
72
72
  } else {
73
73
  document.removeEventListener("mousedown", handleClickOutside);
74
74
  }
75
- }, createItem = function(value, label, parent) {
75
+ }, createItem = function(value, label) {
76
76
  const item = (() => {
77
77
  const __el2 = __element("div");
78
78
  __el2.setAttribute("role", "menuitem");
@@ -92,7 +92,6 @@ function ContextMenuRoot(options = {}) {
92
92
  return __el2;
93
93
  })();
94
94
  items.push(item);
95
- (parent ?? content).appendChild(item);
96
95
  return item;
97
96
  }, Item = function(value, label) {
98
97
  return createItem(value, label);
@@ -107,21 +106,19 @@ function ContextMenuRoot(options = {}) {
107
106
  }
108
107
  return __el3;
109
108
  })();
110
- content.appendChild(el);
111
109
  return {
112
110
  el,
113
- Item: (value, itemLabel) => createItem(value, itemLabel, el)
111
+ Item: (value, itemLabel) => createItem(value, itemLabel)
114
112
  };
115
113
  }, Separator = function() {
116
- const hr = (() => {
114
+ return (() => {
117
115
  const __el4 = __element("hr");
116
+ __el4.setAttribute("data-v-id", "ContextMenuRoot");
118
117
  __el4.setAttribute("role", "separator");
119
118
  return __el4;
120
119
  })();
121
- content.appendChild(hr);
122
- return hr;
123
120
  }, Label = function(text) {
124
- const el = (() => {
121
+ return (() => {
125
122
  const __el5 = __element("div");
126
123
  __el5.setAttribute("role", "none");
127
124
  __enterChildren(__el5);
@@ -129,8 +126,6 @@ function ContextMenuRoot(options = {}) {
129
126
  __exitChildren();
130
127
  return __el5;
131
128
  })();
132
- content.appendChild(el);
133
- return el;
134
129
  };
135
130
  const { onSelect, positioning, ...attrs } = options;
136
131
  const state = {
@@ -0,0 +1,232 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ Keys,
6
+ handleListNavigation,
7
+ isKey
8
+ } from "./chunk-7867pr13.js";
9
+ import {
10
+ setDataState,
11
+ setExpanded,
12
+ setHidden,
13
+ setHiddenAnimated
14
+ } from "./chunk-vevfhpc9.js";
15
+ import {
16
+ uniqueId
17
+ } from "./chunk-8y1jf6xr.js";
18
+
19
+ // src/accordion/accordion-composed.tsx
20
+ import { computed, signal } from "@vertz/ui";
21
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
22
+ import { createContext, ref, useContext } from "@vertz/ui";
23
+ var AccordionContext = createContext(undefined, "@vertz/ui-primitives::AccordionContext");
24
+ var AccordionItemContext = createContext(undefined, "@vertz/ui-primitives::AccordionItemContext");
25
+ function useAccordionContext(componentName) {
26
+ const ctx = useContext(AccordionContext);
27
+ if (!ctx) {
28
+ throw new Error(`<Accordion.${componentName}> must be used inside <Accordion>. ` + "Ensure it is a direct or nested child of the Accordion root component.");
29
+ }
30
+ return ctx;
31
+ }
32
+ function AccordionItem(__props) {
33
+ const __mfDepth = __pushMountFrame();
34
+ try {
35
+ const ctx = useAccordionContext("Item");
36
+ const baseId = uniqueId("accordion");
37
+ const triggerId = `${baseId}-trigger`;
38
+ const contentId = `${baseId}-content`;
39
+ const contentRef = ref();
40
+ const triggerRef = ref();
41
+ const itemCtx = {
42
+ value: __props.value,
43
+ triggerId,
44
+ contentId,
45
+ contentRef,
46
+ triggerRef,
47
+ classes: ctx.classes,
48
+ isOpen: () => ctx.isOpen(__props.value),
49
+ toggle: () => {
50
+ const prevHeight = contentRef.current?.scrollHeight ?? 0;
51
+ ctx.toggle(__props.value);
52
+ const nowOpen = ctx.isOpen(__props.value);
53
+ const contentEl = contentRef.current;
54
+ if (contentEl) {
55
+ contentEl.removeAttribute("data-initial");
56
+ if (nowOpen) {
57
+ setHidden(contentEl, false);
58
+ const height = contentEl.scrollHeight;
59
+ contentEl.style.setProperty("--accordion-content-height", `${height}px`);
60
+ setDataState(contentEl, "open");
61
+ } else {
62
+ contentEl.style.display = "";
63
+ contentEl.setAttribute("aria-hidden", "false");
64
+ contentEl.setAttribute("data-state", "open");
65
+ contentEl.style.setProperty("--accordion-content-height", `${prevHeight}px`);
66
+ contentEl.offsetHeight;
67
+ setDataState(contentEl, "closed");
68
+ setHiddenAnimated(contentEl, true);
69
+ }
70
+ }
71
+ const triggerEl = triggerRef.current;
72
+ if (triggerEl) {
73
+ setExpanded(triggerEl, nowOpen);
74
+ setDataState(triggerEl, nowOpen ? "open" : "closed");
75
+ }
76
+ }
77
+ };
78
+ const __mfResult0 = AccordionItemContext.Provider({ get value() {
79
+ return itemCtx;
80
+ }, children: () => (() => {
81
+ const __el0 = __element("div");
82
+ __el0.setAttribute("data-accordion-item", "");
83
+ __attr(__el0, "data-value", () => __props.value);
84
+ {
85
+ const __v = cn(ctx.classes?.item);
86
+ if (__v != null && __v !== false)
87
+ __el0.setAttribute("class", __v === true ? "" : __v);
88
+ }
89
+ __enterChildren(__el0);
90
+ __append(__el0, __child(() => __props.children));
91
+ __exitChildren();
92
+ return __el0;
93
+ })() });
94
+ __flushMountFrame();
95
+ return __mfResult0;
96
+ } catch (__mfErr) {
97
+ __discardMountFrame(__mfDepth);
98
+ throw __mfErr;
99
+ }
100
+ }
101
+ function AccordionTrigger(__props) {
102
+ const __mfDepth = __pushMountFrame();
103
+ try {
104
+ const ctx = useContext(AccordionItemContext);
105
+ if (!ctx) {
106
+ throw new Error("<Accordion.Trigger> must be used inside <Accordion.Item>. " + "Ensure it is a direct or nested child of an Accordion Item component.");
107
+ }
108
+ const initiallyOpen = computed(() => ctx.isOpen());
109
+ const __mfResult0 = (() => {
110
+ const __el0 = __element("button");
111
+ ctx.triggerRef.current = __el0;
112
+ __el0.setAttribute("type", "button");
113
+ __attr(__el0, "id", () => ctx.triggerId);
114
+ __el0.setAttribute("data-accordion-trigger", "");
115
+ __attr(__el0, "aria-controls", () => ctx.contentId);
116
+ __attr(__el0, "data-value", () => ctx.value);
117
+ __attr(__el0, "aria-expanded", () => initiallyOpen.value ? "true" : "false");
118
+ __attr(__el0, "data-state", () => initiallyOpen.value ? "open" : "closed");
119
+ __attr(__el0, "class", () => cn(ctx.classes?.trigger, __props.className ?? __props.class));
120
+ __on(__el0, "click", () => ctx.toggle());
121
+ __enterChildren(__el0);
122
+ __append(__el0, __child(() => __props.children));
123
+ __exitChildren();
124
+ return __el0;
125
+ })();
126
+ __flushMountFrame();
127
+ return __mfResult0;
128
+ } catch (__mfErr) {
129
+ __discardMountFrame(__mfDepth);
130
+ throw __mfErr;
131
+ }
132
+ }
133
+ function AccordionContent(__props) {
134
+ const __mfDepth = __pushMountFrame();
135
+ try {
136
+ const ctx = useContext(AccordionItemContext);
137
+ if (!ctx) {
138
+ throw new Error("<Accordion.Content> must be used inside <Accordion.Item>. " + "Ensure it is a direct or nested child of an Accordion Item component.");
139
+ }
140
+ const el = computed(() => (() => {
141
+ const __el0 = __element("div");
142
+ ctx.contentRef.current = __el0;
143
+ __el0.setAttribute("role", "region");
144
+ __attr(__el0, "id", () => ctx.contentId);
145
+ __el0.setAttribute("data-accordion-content", "");
146
+ __attr(__el0, "aria-labelledby", () => ctx.triggerId);
147
+ __attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
148
+ __enterChildren(__el0);
149
+ __append(__el0, (() => {
150
+ const __el1 = __element("div");
151
+ __el1.setAttribute("data-part", "content-inner");
152
+ __enterChildren(__el1);
153
+ __append(__el1, __child(() => __props.children));
154
+ __exitChildren();
155
+ return __el1;
156
+ })());
157
+ __exitChildren();
158
+ return __el0;
159
+ })());
160
+ const isOpen = computed(() => ctx.isOpen());
161
+ el.value.setAttribute("aria-hidden", isOpen.value ? "false" : "true");
162
+ el.value.setAttribute("data-state", isOpen.value ? "open" : "closed");
163
+ if (isOpen.value) {
164
+ el.value.setAttribute("data-initial", "");
165
+ } else {
166
+ el.value.style.display = "none";
167
+ }
168
+ const __mfResult0 = el.value;
169
+ __flushMountFrame();
170
+ return __mfResult0;
171
+ } catch (__mfErr) {
172
+ __discardMountFrame(__mfDepth);
173
+ throw __mfErr;
174
+ }
175
+ }
176
+ function ComposedAccordionRoot(__props) {
177
+ const __mfDepth = __pushMountFrame();
178
+ try {
179
+ const multiple = computed(() => __props.type === "multiple");
180
+ const openValues = signal([...__props.defaultValue ?? []], "openValues");
181
+ const ctx = {
182
+ classes: __props.classes,
183
+ isOpen: (value) => openValues.value.includes(value),
184
+ toggle: (value) => {
185
+ const current = [...openValues.value];
186
+ const idx = current.indexOf(value);
187
+ if (idx >= 0) {
188
+ current.splice(idx, 1);
189
+ } else {
190
+ if (multiple.value) {
191
+ current.push(value);
192
+ } else {
193
+ current.length = 0;
194
+ current.push(value);
195
+ }
196
+ }
197
+ openValues.value = current;
198
+ __props.onValueChange?.(current);
199
+ }
200
+ };
201
+ const __mfResult0 = AccordionContext.Provider({ get value() {
202
+ return ctx;
203
+ }, children: () => (() => {
204
+ const __el0 = __element("div");
205
+ __el0.setAttribute("data-orientation", "vertical");
206
+ __el0.setAttribute("data-accordion-root", "");
207
+ __on(__el0, "keydown", (event) => {
208
+ if (isKey(event, Keys.ArrowUp, Keys.ArrowDown, Keys.Home, Keys.End)) {
209
+ const root = event.currentTarget;
210
+ const triggers = [...root.querySelectorAll("[data-accordion-trigger]")];
211
+ handleListNavigation(event, triggers, { orientation: "vertical" });
212
+ }
213
+ });
214
+ __enterChildren(__el0);
215
+ __append(__el0, __child(() => __props.children));
216
+ __exitChildren();
217
+ return __el0;
218
+ })() });
219
+ __flushMountFrame();
220
+ return __mfResult0;
221
+ } catch (__mfErr) {
222
+ __discardMountFrame(__mfDepth);
223
+ throw __mfErr;
224
+ }
225
+ }
226
+ var ComposedAccordion = Object.assign(ComposedAccordionRoot, {
227
+ Item: AccordionItem,
228
+ Trigger: AccordionTrigger,
229
+ Content: AccordionContent
230
+ });
231
+
232
+ export { ComposedAccordion };
@@ -0,0 +1,258 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/resizable-panel/resizable-panel-composed.tsx
6
+ import { computed, signal } from "@vertz/ui";
7
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
8
+ import { createContext, useContext } from "@vertz/ui";
9
+ var _groupCounter = { value: 0 };
10
+ var ResizablePanelContext = createContext(undefined, "@vertz/ui-primitives::ResizablePanelContext");
11
+ function ResizablePanelPanel(__props) {
12
+ const __mfDepth = __pushMountFrame();
13
+ try {
14
+ const ctx = useContext(ResizablePanelContext);
15
+ if (!ctx) {
16
+ throw new Error("<ResizablePanel.Panel> must be used inside <ResizablePanel>. " + "Ensure it is a direct or nested child of the ResizablePanel root component.");
17
+ }
18
+ const index = computed(() => ctx.registerPanel({ defaultSize: __props.defaultSize, minSize: __props.minSize, maxSize: __props.maxSize }));
19
+ const __mfResult0 = (() => {
20
+ const __el0 = __element("div");
21
+ __el0.setAttribute("data-part", "panel");
22
+ __attr(__el0, "data-group", () => ctx.groupId);
23
+ __attr(__el0, "style", () => ({ flex: `${ctx.getSizeForPanel(index.value)} 1 0`, minWidth: 0, minHeight: 0 }));
24
+ __attr(__el0, "class", () => cn(ctx.classes?.panel, __props.className ?? __props.class));
25
+ __enterChildren(__el0);
26
+ __append(__el0, __child(() => __props.children));
27
+ __exitChildren();
28
+ return __el0;
29
+ })();
30
+ __flushMountFrame();
31
+ return __mfResult0;
32
+ } catch (__mfErr) {
33
+ __discardMountFrame(__mfDepth);
34
+ throw __mfErr;
35
+ }
36
+ }
37
+ function ResizablePanelHandle(__props) {
38
+ const __mfDepth = __pushMountFrame();
39
+ try {
40
+ const ctx = useContext(ResizablePanelContext);
41
+ if (!ctx) {
42
+ throw new Error("<ResizablePanel.Handle> must be used inside <ResizablePanel>. " + "Ensure it is a direct or nested child of the ResizablePanel root component.");
43
+ }
44
+ const handleIndex = computed(() => ctx.registerHandle());
45
+ const __mfResult0 = (() => {
46
+ const __el0 = __element("div");
47
+ __el0.setAttribute("role", "separator");
48
+ __el0.setAttribute("tabindex", "0");
49
+ {
50
+ const __v = { flexShrink: 0 };
51
+ if (__v != null && __v !== false)
52
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
53
+ }
54
+ __attr(__el0, "data-group", () => ctx.groupId);
55
+ __attr(__el0, "data-handle-index", () => String(handleIndex.value));
56
+ __attr(__el0, "data-orientation", () => ctx.orientation);
57
+ __el0.setAttribute("data-state", "idle");
58
+ __attr(__el0, "aria-valuenow", () => String(ctx.getAriaForHandle(handleIndex.value).valuenow));
59
+ __attr(__el0, "aria-valuemin", () => String(ctx.getAriaForHandle(handleIndex.value).valuemin));
60
+ __attr(__el0, "aria-valuemax", () => String(ctx.getAriaForHandle(handleIndex.value).valuemax));
61
+ __attr(__el0, "class", () => cn(ctx.classes?.handle, __props.className ?? __props.class));
62
+ return __el0;
63
+ })();
64
+ __flushMountFrame();
65
+ return __mfResult0;
66
+ } catch (__mfErr) {
67
+ __discardMountFrame(__mfDepth);
68
+ throw __mfErr;
69
+ }
70
+ }
71
+ function ComposedResizablePanelRoot(__props) {
72
+ const __mfDepth = __pushMountFrame();
73
+ try {
74
+ let recomputeSizes = function() {
75
+ const configs = _reg.panelConfigs;
76
+ const panelCount = configs.length;
77
+ if (panelCount === 0)
78
+ return;
79
+ const newSizes = new Array(panelCount).fill(0);
80
+ const explicitIndices = new Set;
81
+ for (let i = 0;i < panelCount; i++) {
82
+ const config = configs[i];
83
+ if (config && config.defaultSize != null) {
84
+ newSizes[i] = config.defaultSize;
85
+ explicitIndices.add(i);
86
+ }
87
+ }
88
+ if (explicitIndices.size === 0) {
89
+ const equal = 100 / panelCount;
90
+ for (let i = 0;i < panelCount; i++)
91
+ newSizes[i] = equal;
92
+ } else {
93
+ const used = [...explicitIndices].reduce((sum, i) => sum + (newSizes[i] ?? 0), 0);
94
+ const unsetCount = panelCount - explicitIndices.size;
95
+ const each = unsetCount > 0 ? (100 - used) / unsetCount : 0;
96
+ for (let i = 0;i < newSizes.length; i++) {
97
+ if (!explicitIndices.has(i))
98
+ newSizes[i] = each;
99
+ }
100
+ }
101
+ sizes.value = newSizes;
102
+ }, registerPanel = function(opts) {
103
+ const idx = _reg.nextPanelIdx++;
104
+ _reg.panelConfigs.push({
105
+ defaultSize: opts.defaultSize,
106
+ minSize: opts.minSize ?? 0,
107
+ maxSize: opts.maxSize ?? 100
108
+ });
109
+ recomputeSizes();
110
+ return idx;
111
+ }, registerHandle = function() {
112
+ return _reg.nextHandleIdx++;
113
+ }, getSizeForPanel = function(index) {
114
+ return sizes.value[index] ?? 0;
115
+ }, getAriaForHandle = function(handleIndex) {
116
+ const config = _reg.panelConfigs[handleIndex];
117
+ return {
118
+ valuenow: Math.round(sizes.value[handleIndex] ?? 0),
119
+ valuemin: Math.round(config?.minSize ?? 0),
120
+ valuemax: Math.round(config?.maxSize ?? 100)
121
+ };
122
+ }, updateSizes = function(newSizes) {
123
+ sizes.value = [...newSizes];
124
+ __props.onResize?.(newSizes);
125
+ }, handleKeydown = function(e) {
126
+ const ke = e;
127
+ const target = ke.target;
128
+ if (target.getAttribute("role") !== "separator")
129
+ return;
130
+ if (target.dataset.group !== groupId)
131
+ return;
132
+ const handleIndex = Number(target.dataset.handleIndex ?? -1);
133
+ if (handleIndex < 0)
134
+ return;
135
+ const leftIdx = handleIndex;
136
+ const rightIdx = handleIndex + 1;
137
+ const leftConfig = _reg.panelConfigs[leftIdx];
138
+ const rightConfig = _reg.panelConfigs[rightIdx];
139
+ if (!leftConfig || !rightConfig)
140
+ return;
141
+ const leftStart = sizes.value[leftIdx] ?? 0;
142
+ const rightStart = sizes.value[rightIdx] ?? 0;
143
+ const STEP = 5;
144
+ const growKey = (__props.orientation ?? "horizontal") === "horizontal" ? "ArrowRight" : "ArrowDown";
145
+ const shrinkKey = (__props.orientation ?? "horizontal") === "horizontal" ? "ArrowLeft" : "ArrowUp";
146
+ let newLeft = leftStart;
147
+ let newRight = rightStart;
148
+ if (ke.key === growKey) {
149
+ ke.preventDefault();
150
+ const delta = Math.min(STEP, rightStart - rightConfig.minSize, leftConfig.maxSize - leftStart);
151
+ newLeft += delta;
152
+ newRight -= delta;
153
+ } else if (ke.key === shrinkKey) {
154
+ ke.preventDefault();
155
+ const delta = Math.min(STEP, leftStart - leftConfig.minSize, rightConfig.maxSize - rightStart);
156
+ newLeft -= delta;
157
+ newRight += delta;
158
+ } else if (ke.key === "Home") {
159
+ ke.preventDefault();
160
+ const delta = leftStart - leftConfig.minSize;
161
+ newLeft -= delta;
162
+ newRight += delta;
163
+ } else if (ke.key === "End") {
164
+ ke.preventDefault();
165
+ const delta = rightStart - rightConfig.minSize;
166
+ newLeft += delta;
167
+ newRight -= delta;
168
+ } else {
169
+ return;
170
+ }
171
+ const newSizes = sizes.value.slice();
172
+ newSizes[leftIdx] = newLeft;
173
+ newSizes[rightIdx] = newRight;
174
+ updateSizes(newSizes);
175
+ }, handlePointerdown = function(e) {
176
+ const pe = e;
177
+ const target = pe.target;
178
+ if (target.getAttribute("role") !== "separator")
179
+ return;
180
+ if (target.dataset.group !== groupId)
181
+ return;
182
+ pe.preventDefault();
183
+ target.setPointerCapture(pe.pointerId);
184
+ target.setAttribute("data-state", "dragging");
185
+ const handleIndex = Number(target.dataset.handleIndex ?? -1);
186
+ const rootEl = pe.currentTarget;
187
+ const startPos = (__props.orientation ?? "horizontal") === "horizontal" ? pe.clientX : pe.clientY;
188
+ const rootSize = (__props.orientation ?? "horizontal") === "horizontal" ? rootEl.offsetWidth : rootEl.offsetHeight;
189
+ const startSizes = sizes.value.slice();
190
+ function onMove(ev) {
191
+ const currentPos = (__props.orientation ?? "horizontal") === "horizontal" ? ev.clientX : ev.clientY;
192
+ const delta = (currentPos - startPos) / rootSize * 100;
193
+ const moveSizes = startSizes.slice();
194
+ const leftIdx = handleIndex;
195
+ const rightIdx = handleIndex + 1;
196
+ const leftConfig = _reg.panelConfigs[leftIdx];
197
+ const rightConfig = _reg.panelConfigs[rightIdx];
198
+ if (!leftConfig || !rightConfig)
199
+ return;
200
+ const rawLeft = Math.max(leftConfig.minSize, Math.min(leftConfig.maxSize, (startSizes[leftIdx] ?? 0) + delta));
201
+ const rawRight = Math.max(rightConfig.minSize, Math.min(rightConfig.maxSize, (startSizes[rightIdx] ?? 0) - delta));
202
+ moveSizes[leftIdx] = rawLeft;
203
+ moveSizes[rightIdx] = rawRight;
204
+ updateSizes(moveSizes);
205
+ }
206
+ function onUp(ev) {
207
+ target.releasePointerCapture(ev.pointerId);
208
+ target.setAttribute("data-state", "idle");
209
+ target.removeEventListener("pointermove", onMove);
210
+ target.removeEventListener("pointerup", onUp);
211
+ }
212
+ target.addEventListener("pointermove", onMove);
213
+ target.addEventListener("pointerup", onUp);
214
+ };
215
+ const groupId = String(_groupCounter.value++);
216
+ const _reg = {
217
+ nextPanelIdx: 0,
218
+ nextHandleIdx: 0,
219
+ panelConfigs: []
220
+ };
221
+ const sizes = signal([], "sizes");
222
+ const ctx = {
223
+ groupId,
224
+ orientation: __props.orientation ?? "horizontal",
225
+ classes: __props.classes,
226
+ registerPanel,
227
+ registerHandle,
228
+ getSizeForPanel,
229
+ getAriaForHandle
230
+ };
231
+ const __mfResult0 = ResizablePanelContext.Provider({ get value() {
232
+ return ctx;
233
+ }, children: () => (() => {
234
+ const __el0 = __element("div");
235
+ __attr(__el0, "style", () => ({ display: "flex", flexDirection: (__props.orientation ?? "horizontal") === "horizontal" ? "row" : "column" }));
236
+ __attr(__el0, "data-orientation", () => __props.orientation ?? "horizontal");
237
+ __attr(__el0, "data-panel-count", () => sizes.value.length);
238
+ __attr(__el0, "class", () => __props.classes?.root);
239
+ __on(__el0, "keydown", handleKeydown);
240
+ __on(__el0, "pointerdown", handlePointerdown);
241
+ __enterChildren(__el0);
242
+ __append(__el0, __child(() => __props.children));
243
+ __exitChildren();
244
+ return __el0;
245
+ })() });
246
+ __flushMountFrame();
247
+ return __mfResult0;
248
+ } catch (__mfErr) {
249
+ __discardMountFrame(__mfDepth);
250
+ throw __mfErr;
251
+ }
252
+ }
253
+ var ComposedResizablePanel = Object.assign(ComposedResizablePanelRoot, {
254
+ Panel: ResizablePanelPanel,
255
+ Handle: ResizablePanelHandle
256
+ });
257
+
258
+ export { ComposedResizablePanel };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-e2v1c9ex.js";
7
7
  import {
8
8
  createFloatingPosition
9
- } from "./chunk-0mcr52hc.js";
9
+ } from "./chunk-vef3sepw.js";
10
10
  import {
11
11
  Keys,
12
12
  handleListNavigation,
@@ -196,7 +196,7 @@ function MenubarRoot(options = {}) {
196
196
  });
197
197
  return __el2;
198
198
  })();
199
- function createItem(val, itemLabel, parent) {
199
+ function createItem(val, itemLabel) {
200
200
  const item = (() => {
201
201
  const __el3 = __element("div");
202
202
  __el3.setAttribute("role", "menuitem");
@@ -217,7 +217,6 @@ function MenubarRoot(options = {}) {
217
217
  return __el3;
218
218
  })();
219
219
  menuItems.push(item);
220
- (parent ?? content).appendChild(item);
221
220
  return item;
222
221
  }
223
222
  function Item(val, itemLabel) {
@@ -234,25 +233,22 @@ function MenubarRoot(options = {}) {
234
233
  }
235
234
  return __el4;
236
235
  })();
237
- content.appendChild(el);
238
236
  return {
239
237
  el,
240
- Item: (val, l) => createItem(val, l, el)
238
+ Item: (val, l) => createItem(val, l)
241
239
  };
242
240
  }
243
241
  function Separator() {
244
- const hr = (() => {
242
+ return (() => {
245
243
  const __el5 = __element("hr");
244
+ __el5.setAttribute("data-v-id", "MenubarRoot");
246
245
  __el5.setAttribute("role", "separator");
247
246
  return __el5;
248
247
  })();
249
- content.appendChild(hr);
250
- return hr;
251
248
  }
252
249
  triggers.push(trigger);
253
250
  setRovingTabindex(triggers, 0);
254
251
  menus.set(value, { trigger, content, items: menuItems });
255
- root.appendChild(trigger);
256
252
  return { trigger, content, Item, Group, Separator };
257
253
  };
258
254
  const { onSelect, positioning, ...attrs } = options;