@vertz/ui-primitives 0.2.23 → 0.2.24

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 (188) hide show
  1. package/dist/shared/{chunk-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
  2. package/dist/shared/chunk-1hm0mbke.js +258 -0
  3. package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
  4. package/dist/shared/chunk-3jack97k.js +509 -0
  5. package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
  6. package/dist/shared/chunk-4gyg71bn.js +178 -0
  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-75pegjs7.js +26 -0
  10. package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
  11. package/dist/shared/chunk-7wem1bhb.js +252 -0
  12. package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
  13. package/dist/shared/chunk-8t0nm721.js +152 -0
  14. package/dist/shared/chunk-94twh4s4.js +28 -0
  15. package/dist/shared/chunk-98y1sw9y.js +398 -0
  16. package/dist/shared/chunk-9eedsnnk.js +164 -0
  17. package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
  18. package/dist/shared/chunk-aa3w85hn.js +321 -0
  19. package/dist/shared/chunk-axpbdpgx.js +177 -0
  20. package/dist/shared/chunk-b4zzg457.js +410 -0
  21. package/dist/shared/chunk-brk0drrk.js +202 -0
  22. package/dist/shared/chunk-czv0kqj4.js +107 -0
  23. package/dist/shared/chunk-d83ag07h.js +189 -0
  24. package/dist/shared/{chunk-3kwh27dv.js → chunk-de18ashk.js} +0 -1
  25. package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
  26. package/dist/shared/chunk-e6660g7e.js +179 -0
  27. package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
  28. package/dist/shared/chunk-ev367pq3.js +102 -0
  29. package/dist/shared/{chunk-4894pmy6.js → chunk-f0wy7k56.js} +0 -1
  30. package/dist/shared/chunk-fjykbv0v.js +214 -0
  31. package/dist/shared/chunk-ghkw5bjq.js +55 -0
  32. package/dist/shared/chunk-gqb1n1hj.js +60 -0
  33. package/dist/shared/chunk-hfjtkytb.js +310 -0
  34. package/dist/shared/chunk-hpvjfj0j.js +31 -0
  35. package/dist/shared/chunk-hxmxvp56.js +67 -0
  36. package/dist/shared/chunk-j9m2f0rd.js +162 -0
  37. package/dist/shared/chunk-jpyjk616.js +52 -0
  38. package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
  39. package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
  40. package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
  41. package/dist/shared/chunk-kskxxc2q.js +228 -0
  42. package/dist/shared/chunk-metxdt5x.js +28 -0
  43. package/dist/shared/chunk-mhn2aazf.js +353 -0
  44. package/dist/shared/chunk-mtx2cfbx.js +175 -0
  45. package/dist/shared/chunk-nsmvdxgp.js +213 -0
  46. package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
  47. package/dist/shared/chunk-pzknpa1y.js +327 -0
  48. package/dist/shared/chunk-q1ff3xp3.js +95 -0
  49. package/dist/shared/chunk-q7xbcj9q.js +7 -0
  50. package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
  51. package/dist/shared/chunk-qrm43tr3.js +357 -0
  52. package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
  53. package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
  54. package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
  55. package/dist/shared/chunk-r3ngaa64.js +418 -0
  56. package/dist/shared/chunk-r3pffzss.js +13 -0
  57. package/dist/shared/chunk-rrt62bp0.js +353 -0
  58. package/dist/shared/chunk-s24gkmna.js +131 -0
  59. package/dist/shared/chunk-s62e7jf4.js +30 -0
  60. package/dist/shared/chunk-spng4yb9.js +73 -0
  61. package/dist/shared/chunk-v0b5pkcq.js +30 -0
  62. package/dist/shared/chunk-v11kd39k.js +162 -0
  63. package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
  64. package/dist/shared/chunk-vkscwzpr.js +294 -0
  65. package/dist/shared/chunk-vv187snj.js +112 -0
  66. package/dist/shared/chunk-wqsek87j.js +311 -0
  67. package/dist/shared/chunk-wtkxz2te.js +157 -0
  68. package/dist/shared/chunk-y1hpsqzy.js +185 -0
  69. package/dist/shared/chunk-yfzddvxc.js +71 -0
  70. package/dist/src/accordion/accordion-composed.d.ts +30 -0
  71. package/dist/src/accordion/accordion-composed.js +6 -0
  72. package/dist/src/accordion/accordion.js +1 -1
  73. package/dist/src/alert/alert-composed.d.ts +26 -0
  74. package/dist/src/alert/alert-composed.js +6 -0
  75. package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
  76. package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
  77. package/dist/src/avatar/avatar-composed.d.ts +33 -0
  78. package/dist/src/avatar/avatar-composed.js +6 -0
  79. package/dist/src/badge/badge-composed.d.ts +33 -0
  80. package/dist/src/badge/badge-composed.js +6 -0
  81. package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
  82. package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
  83. package/dist/src/button/button-composed.d.ts +34 -0
  84. package/dist/src/button/button-composed.js +6 -0
  85. package/dist/src/calendar/calendar-composed.d.ts +42 -0
  86. package/dist/src/calendar/calendar-composed.js +6 -0
  87. package/dist/src/calendar/calendar.js +1 -1
  88. package/dist/src/card/card-composed.d.ts +34 -0
  89. package/dist/src/card/card-composed.js +6 -0
  90. package/dist/src/carousel/carousel-composed.d.ts +32 -0
  91. package/dist/src/carousel/carousel-composed.js +6 -0
  92. package/dist/src/carousel/carousel.js +1 -1
  93. package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
  94. package/dist/src/checkbox/checkbox-composed.js +6 -0
  95. package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
  96. package/dist/src/collapsible/collapsible-composed.js +6 -0
  97. package/dist/src/combobox/combobox-composed.d.ts +30 -0
  98. package/dist/src/combobox/combobox-composed.js +6 -0
  99. package/dist/src/combobox/combobox.js +1 -1
  100. package/dist/src/command/command-composed.d.ts +67 -0
  101. package/dist/src/command/command-composed.js +6 -0
  102. package/dist/src/command/command.js +1 -1
  103. package/dist/src/composed/with-styles.d.ts +38 -0
  104. package/dist/src/composed/with-styles.js +6 -0
  105. package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
  106. package/dist/src/context-menu/context-menu-composed.js +6 -0
  107. package/dist/src/context-menu/context-menu.js +1 -1
  108. package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
  109. package/dist/src/date-picker/date-picker-composed.js +6 -0
  110. package/dist/src/date-picker/date-picker.js +1 -1
  111. package/dist/src/dialog/dialog-composed.d.ts +36 -0
  112. package/dist/src/dialog/dialog-composed.js +6 -0
  113. package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
  114. package/dist/src/dialog/dialog-stack-parts.js +18 -0
  115. package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
  116. package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
  117. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  118. package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
  119. package/dist/src/empty-state/empty-state-composed.js +6 -0
  120. package/dist/src/form-group/form-group-composed.d.ts +24 -0
  121. package/dist/src/form-group/form-group-composed.js +6 -0
  122. package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
  123. package/dist/src/hover-card/hover-card-composed.js +6 -0
  124. package/dist/src/hover-card/hover-card.js +1 -1
  125. package/dist/src/index.d.ts +1284 -817
  126. package/dist/src/index.js +78 -6566
  127. package/dist/src/input/input-composed.d.ts +35 -0
  128. package/dist/src/input/input-composed.js +6 -0
  129. package/dist/src/label/label-composed.d.ts +32 -0
  130. package/dist/src/label/label-composed.js +6 -0
  131. package/dist/src/menu/menu-composed.d.ts +51 -0
  132. package/dist/src/menu/menu-composed.js +6 -0
  133. package/dist/src/menu/menu.js +1 -1
  134. package/dist/src/menubar/menubar-composed.d.ts +56 -0
  135. package/dist/src/menubar/menubar-composed.js +6 -0
  136. package/dist/src/menubar/menubar.js +1 -1
  137. package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
  138. package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
  139. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  140. package/dist/src/pagination/pagination-composed.d.ts +30 -0
  141. package/dist/src/pagination/pagination-composed.js +6 -0
  142. package/dist/src/popover/popover-composed.d.ts +36 -0
  143. package/dist/src/popover/popover-composed.js +6 -0
  144. package/dist/src/popover/popover.js +1 -1
  145. package/dist/src/progress/progress-composed.d.ts +17 -0
  146. package/dist/src/progress/progress-composed.js +6 -0
  147. package/dist/src/radio/radio-composed.d.ts +24 -0
  148. package/dist/src/radio/radio-composed.js +6 -0
  149. package/dist/src/radio/radio.js +1 -1
  150. package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
  151. package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
  152. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  153. package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
  154. package/dist/src/scroll-area/scroll-area-composed.js +6 -0
  155. package/dist/src/scroll-area/scroll-area.js +1 -1
  156. package/dist/src/select/select-composed.d.ts +53 -0
  157. package/dist/src/select/select-composed.js +6 -0
  158. package/dist/src/select/select.js +1 -1
  159. package/dist/src/separator/separator-composed.d.ts +32 -0
  160. package/dist/src/separator/separator-composed.js +6 -0
  161. package/dist/src/sheet/sheet-composed.d.ts +34 -0
  162. package/dist/src/sheet/sheet-composed.js +6 -0
  163. package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
  164. package/dist/src/skeleton/skeleton-composed.js +6 -0
  165. package/dist/src/slider/slider-composed.d.ts +22 -0
  166. package/dist/src/slider/slider-composed.js +6 -0
  167. package/dist/src/switch/switch-composed.d.ts +17 -0
  168. package/dist/src/switch/switch-composed.js +6 -0
  169. package/dist/src/table/table-composed.d.ts +34 -0
  170. package/dist/src/table/table-composed.js +6 -0
  171. package/dist/src/tabs/tabs-composed.d.ts +33 -0
  172. package/dist/src/tabs/tabs-composed.js +6 -0
  173. package/dist/src/tabs/tabs.js +1 -1
  174. package/dist/src/textarea/textarea-composed.d.ts +35 -0
  175. package/dist/src/textarea/textarea-composed.js +6 -0
  176. package/dist/src/toast/toast.js +1 -1
  177. package/dist/src/toggle/toggle-composed.d.ts +16 -0
  178. package/dist/src/toggle/toggle-composed.js +6 -0
  179. package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
  180. package/dist/src/toggle-group/toggle-group-composed.js +6 -0
  181. package/dist/src/toggle-group/toggle-group.js +1 -1
  182. package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
  183. package/dist/src/tooltip/tooltip-composed.js +6 -0
  184. package/dist/src/tooltip/tooltip.js +1 -1
  185. package/dist/src/utils.js +1 -1
  186. package/package.json +3 -3
  187. package/dist/shared/chunk-56reyd5r.js +0 -64
  188. package/dist/shared/chunk-mgr904ap.js +0 -370
@@ -0,0 +1,178 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/pagination/pagination-composed.tsx
6
+ import { computed } from "@vertz/ui";
7
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
8
+ function generatePaginationRange(current, total, siblings) {
9
+ const range = [];
10
+ const left = Math.max(2, current - siblings);
11
+ const right = Math.min(total - 1, current + siblings);
12
+ range.push(1);
13
+ if (left > 2) {
14
+ range.push("...");
15
+ }
16
+ for (let idx = left;idx <= right; idx++) {
17
+ if (idx !== 1 && idx !== total) {
18
+ range.push(idx);
19
+ }
20
+ }
21
+ if (right < total - 1) {
22
+ range.push("...");
23
+ }
24
+ if (total > 1) {
25
+ range.push(total);
26
+ }
27
+ return range;
28
+ }
29
+ function PageButton(__props) {
30
+ const __mfDepth = __pushMountFrame();
31
+ try {
32
+ if (__props.page === __props.currentPage) {
33
+ const __mfResult0 = (() => {
34
+ const __el0 = __element("button");
35
+ __el0.setAttribute("type", "button");
36
+ __attr(__el0, "class", () => cn(__props.classes?.linkActive));
37
+ __el0.setAttribute("aria-current", "page");
38
+ __enterChildren(__el0);
39
+ __append(__el0, __child(() => String(__props.page)));
40
+ __exitChildren();
41
+ return __el0;
42
+ })();
43
+ __flushMountFrame();
44
+ return __mfResult0;
45
+ }
46
+ const __mfResult1 = (() => {
47
+ const __el1 = __element("button");
48
+ __el1.setAttribute("type", "button");
49
+ __attr(__el1, "class", () => cn(__props.classes?.link));
50
+ __on(__el1, "click", () => __props.onPageChange(__props.page));
51
+ __enterChildren(__el1);
52
+ __append(__el1, __child(() => String(__props.page)));
53
+ __exitChildren();
54
+ return __el1;
55
+ })();
56
+ __flushMountFrame();
57
+ return __mfResult1;
58
+ } catch (__mfErr) {
59
+ __discardMountFrame(__mfDepth);
60
+ throw __mfErr;
61
+ }
62
+ }
63
+ function ComposedPaginationRoot(__props) {
64
+ const __mfDepth = __pushMountFrame();
65
+ try {
66
+ const range = computed(() => generatePaginationRange(__props.currentPage, __props.totalPages, __props.siblingCount ?? 1));
67
+ const pageItems = [];
68
+ for (const page of range.value) {
69
+ if (page === "...") {
70
+ pageItems.push((() => {
71
+ const __el0 = __element("li");
72
+ __attr(__el0, "class", () => cn(__props.classes?.item));
73
+ __enterChildren(__el0);
74
+ __append(__el0, (() => {
75
+ const __el1 = __element("span");
76
+ __el1.setAttribute("aria-hidden", "true");
77
+ __attr(__el1, "class", () => cn(__props.classes?.ellipsis));
78
+ __enterChildren(__el1);
79
+ __append(__el1, __child(() => __props.ellipsisContent ?? "..."));
80
+ __exitChildren();
81
+ return __el1;
82
+ })());
83
+ __exitChildren();
84
+ return __el0;
85
+ })());
86
+ } else {
87
+ pageItems.push((() => {
88
+ const __el2 = __element("li");
89
+ __attr(__el2, "class", () => cn(__props.classes?.item));
90
+ __enterChildren(__el2);
91
+ __append(__el2, PageButton({ get page() {
92
+ return page;
93
+ }, get currentPage() {
94
+ return __props.currentPage;
95
+ }, get onPageChange() {
96
+ return __props.onPageChange;
97
+ }, get classes() {
98
+ return __props.classes;
99
+ } }));
100
+ __exitChildren();
101
+ return __el2;
102
+ })());
103
+ }
104
+ }
105
+ const __mfResult0 = (() => {
106
+ const __el3 = __element("nav");
107
+ __el3.setAttribute("aria-label", "Pagination");
108
+ __attr(__el3, "class", () => cn(__props.classes?.nav, __props.className ?? __props.class));
109
+ __enterChildren(__el3);
110
+ __append(__el3, (() => {
111
+ const __el4 = __element("ul");
112
+ __attr(__el4, "class", () => cn(__props.classes?.list));
113
+ __enterChildren(__el4);
114
+ __append(__el4, (() => {
115
+ const __el5 = __element("li");
116
+ __attr(__el5, "class", () => cn(__props.classes?.item));
117
+ __enterChildren(__el5);
118
+ __append(__el5, (() => {
119
+ const __el6 = __element("button");
120
+ __el6.setAttribute("type", "button");
121
+ __attr(__el6, "class", () => cn(__props.classes?.navButton));
122
+ {
123
+ const __v = { paddingLeft: "0.375rem", paddingRight: "0.625rem" };
124
+ if (__v != null && __v !== false)
125
+ __el6.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
126
+ }
127
+ __el6.setAttribute("aria-label", "Previous page");
128
+ __attr(__el6, "disabled", () => __props.currentPage <= 1);
129
+ __on(__el6, "click", () => __props.onPageChange(__props.currentPage - 1));
130
+ __enterChildren(__el6);
131
+ __append(__el6, __child(() => __props.prevContent ?? "Previous"));
132
+ __exitChildren();
133
+ return __el6;
134
+ })());
135
+ __exitChildren();
136
+ return __el5;
137
+ })());
138
+ __insert(__el4, pageItems);
139
+ __append(__el4, (() => {
140
+ const __el7 = __element("li");
141
+ __attr(__el7, "class", () => cn(__props.classes?.item));
142
+ __enterChildren(__el7);
143
+ __append(__el7, (() => {
144
+ const __el8 = __element("button");
145
+ __el8.setAttribute("type", "button");
146
+ __attr(__el8, "class", () => cn(__props.classes?.navButton));
147
+ {
148
+ const __v = { paddingLeft: "0.625rem", paddingRight: "0.375rem" };
149
+ if (__v != null && __v !== false)
150
+ __el8.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
151
+ }
152
+ __el8.setAttribute("aria-label", "Next page");
153
+ __attr(__el8, "disabled", () => __props.currentPage >= __props.totalPages);
154
+ __on(__el8, "click", () => __props.onPageChange(__props.currentPage + 1));
155
+ __enterChildren(__el8);
156
+ __append(__el8, __child(() => __props.nextContent ?? "Next"));
157
+ __exitChildren();
158
+ return __el8;
159
+ })());
160
+ __exitChildren();
161
+ return __el7;
162
+ })());
163
+ __exitChildren();
164
+ return __el4;
165
+ })());
166
+ __exitChildren();
167
+ return __el3;
168
+ })();
169
+ __flushMountFrame();
170
+ return __mfResult0;
171
+ } catch (__mfErr) {
172
+ __discardMountFrame(__mfDepth);
173
+ throw __mfErr;
174
+ }
175
+ }
176
+ var ComposedPagination = ComposedPaginationRoot;
177
+
178
+ export { ComposedPagination };
@@ -0,0 +1,467 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+ import {
5
+ createDismiss
6
+ } from "./chunk-a6wp8c32.js";
7
+ import {
8
+ createFloatingPosition
9
+ } from "./chunk-vef3sepw.js";
10
+ import {
11
+ Keys,
12
+ isKey
13
+ } from "./chunk-7867pr13.js";
14
+ import {
15
+ linkedIds,
16
+ uniqueId
17
+ } from "./chunk-8y1jf6xr.js";
18
+
19
+ // src/menubar/menubar-composed.tsx
20
+ import { computed } from "@vertz/ui";
21
+ import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
22
+ import { createContext, onMount, ref, useContext } from "@vertz/ui";
23
+ var MenubarContext = createContext(undefined, "@vertz/ui-primitives::MenubarContext");
24
+ function useMenubarContext(componentName) {
25
+ const ctx = useContext(MenubarContext);
26
+ if (!ctx) {
27
+ throw new Error(`<Menubar.${componentName}> must be used inside <Menubar>. ` + "Ensure it is a direct or nested child of the Menubar root component.");
28
+ }
29
+ return ctx;
30
+ }
31
+ var MenuContext = createContext(undefined, "@vertz/ui-primitives::MenubarMenuContext");
32
+ function useMenuContext(componentName) {
33
+ const ctx = useContext(MenuContext);
34
+ if (!ctx) {
35
+ throw new Error(`<Menubar.${componentName}> must be used inside <Menubar.Menu>. ` + "Ensure it is a direct or nested child of a Menubar.Menu component.");
36
+ }
37
+ return ctx;
38
+ }
39
+ function MenubarMenu(__props) {
40
+ const __mfDepth = __pushMountFrame();
41
+ try {
42
+ const barCtx = useMenubarContext("Menu");
43
+ const ids = linkedIds("menubar-menu");
44
+ const menuCtx = {
45
+ menuValue: __props.value,
46
+ triggerId: ids.triggerId,
47
+ contentId: ids.contentId,
48
+ classes: barCtx.classes
49
+ };
50
+ const __mfResult0 = MenuContext.Provider({ get value() {
51
+ return menuCtx;
52
+ }, children: () => (() => {
53
+ const __el0 = __element("span");
54
+ {
55
+ const __v = { display: "contents" };
56
+ if (__v != null && __v !== false)
57
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
58
+ }
59
+ __el0.setAttribute("data-menubar-menu", "");
60
+ __enterChildren(__el0);
61
+ __append(__el0, __child(() => __props.children));
62
+ __exitChildren();
63
+ return __el0;
64
+ })() });
65
+ __flushMountFrame();
66
+ return __mfResult0;
67
+ } catch (__mfErr) {
68
+ __discardMountFrame(__mfDepth);
69
+ throw __mfErr;
70
+ }
71
+ }
72
+ function MenubarTrigger(__props) {
73
+ const __mfDepth = __pushMountFrame();
74
+ try {
75
+ const menuCtx = useMenuContext("Trigger");
76
+ const barCtx = useMenubarContext("Trigger");
77
+ const el = computed(() => (() => {
78
+ const __el0 = __element("button");
79
+ __el0.setAttribute("type", "button");
80
+ __el0.setAttribute("role", "menuitem");
81
+ {
82
+ const __v = menuCtx.triggerId;
83
+ if (__v != null && __v !== false)
84
+ __el0.setAttribute("id", __v === true ? "" : __v);
85
+ }
86
+ {
87
+ const __v = menuCtx.contentId;
88
+ if (__v != null && __v !== false)
89
+ __el0.setAttribute("aria-controls", __v === true ? "" : __v);
90
+ }
91
+ __el0.setAttribute("aria-haspopup", "menu");
92
+ __el0.setAttribute("data-menubar-trigger", "");
93
+ {
94
+ const __v = menuCtx.menuValue;
95
+ if (__v != null && __v !== false)
96
+ __el0.setAttribute("data-value", __v === true ? "" : __v);
97
+ }
98
+ __el0.setAttribute("aria-expanded", "false");
99
+ __el0.setAttribute("data-state", "closed");
100
+ __attr(__el0, "class", () => cn(menuCtx.classes?.trigger, __props.className ?? __props.class));
101
+ __enterChildren(__el0);
102
+ __append(__el0, __child(() => __props.children ?? menuCtx.menuValue));
103
+ __exitChildren();
104
+ return __el0;
105
+ })());
106
+ onMount(() => {
107
+ const btnEl = el.value;
108
+ function handleClick() {
109
+ if (barCtx.getActiveMenu() === menuCtx.menuValue) {
110
+ barCtx.closeAll();
111
+ } else {
112
+ barCtx.openMenu(menuCtx.menuValue);
113
+ }
114
+ }
115
+ function handleKeydown(event) {
116
+ if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
117
+ event.preventDefault();
118
+ barCtx.openMenu(menuCtx.menuValue);
119
+ }
120
+ }
121
+ btnEl.addEventListener("click", handleClick);
122
+ btnEl.addEventListener("keydown", handleKeydown);
123
+ return () => {
124
+ btnEl.removeEventListener("click", handleClick);
125
+ btnEl.removeEventListener("keydown", handleKeydown);
126
+ };
127
+ });
128
+ const __mfResult0 = el.value;
129
+ __flushMountFrame();
130
+ return __mfResult0;
131
+ } catch (__mfErr) {
132
+ __discardMountFrame(__mfDepth);
133
+ throw __mfErr;
134
+ }
135
+ }
136
+ function MenubarContent(__props) {
137
+ const __mfDepth = __pushMountFrame();
138
+ try {
139
+ const menuCtx = useMenuContext("Content");
140
+ const barCtx = useMenubarContext("Content");
141
+ const el = computed(() => (() => {
142
+ const __el0 = __element("div");
143
+ __el0.setAttribute("role", "menu");
144
+ {
145
+ const __v = menuCtx.contentId;
146
+ if (__v != null && __v !== false)
147
+ __el0.setAttribute("id", __v === true ? "" : __v);
148
+ }
149
+ __el0.setAttribute("data-menubar-content", "");
150
+ {
151
+ const __v = menuCtx.menuValue;
152
+ if (__v != null && __v !== false)
153
+ __el0.setAttribute("data-value", __v === true ? "" : __v);
154
+ }
155
+ __el0.setAttribute("aria-hidden", "true");
156
+ __el0.setAttribute("data-state", "closed");
157
+ {
158
+ const __v = { display: "none" };
159
+ if (__v != null && __v !== false)
160
+ __el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
161
+ }
162
+ __attr(__el0, "class", () => cn(menuCtx.classes?.content, __props.className ?? __props.class));
163
+ __enterChildren(__el0);
164
+ __append(__el0, __child(() => __props.children));
165
+ __exitChildren();
166
+ return __el0;
167
+ })());
168
+ onMount(() => {
169
+ const contentEl = el.value;
170
+ function handleKeydown(event) {
171
+ if (isKey(event, Keys.Escape)) {
172
+ event.preventDefault();
173
+ barCtx.closeAll();
174
+ const root = barCtx.rootRef.current;
175
+ if (root) {
176
+ const trigger = root.querySelector(`[data-menubar-trigger][data-value="${menuCtx.menuValue}"]`);
177
+ trigger?.focus();
178
+ }
179
+ return;
180
+ }
181
+ if (isKey(event, Keys.Enter, Keys.Space)) {
182
+ event.preventDefault();
183
+ const items = [...contentEl.querySelectorAll('[role="menuitem"]')];
184
+ const active = items.find((item) => item === document.activeElement);
185
+ if (active) {
186
+ const val = active.getAttribute("data-value");
187
+ if (val !== null) {
188
+ barCtx.getOnSelect()?.(val);
189
+ barCtx.closeAll();
190
+ }
191
+ }
192
+ return;
193
+ }
194
+ if (isKey(event, Keys.ArrowDown, Keys.ArrowUp)) {
195
+ event.preventDefault();
196
+ const items = [...contentEl.querySelectorAll('[role="menuitem"]')];
197
+ if (items.length === 0)
198
+ return;
199
+ const currentIdx = items.indexOf(document.activeElement);
200
+ const direction = isKey(event, Keys.ArrowDown) ? 1 : -1;
201
+ const nextIdx = ((currentIdx + direction) % items.length + items.length) % items.length;
202
+ items[nextIdx]?.focus();
203
+ return;
204
+ }
205
+ if (isKey(event, Keys.ArrowRight)) {
206
+ event.preventDefault();
207
+ event.stopPropagation();
208
+ barCtx.navigateMenu(1);
209
+ return;
210
+ }
211
+ if (isKey(event, Keys.ArrowLeft)) {
212
+ event.preventDefault();
213
+ event.stopPropagation();
214
+ barCtx.navigateMenu(-1);
215
+ return;
216
+ }
217
+ }
218
+ contentEl.addEventListener("keydown", handleKeydown);
219
+ return () => {
220
+ contentEl.removeEventListener("keydown", handleKeydown);
221
+ };
222
+ });
223
+ const __mfResult0 = el.value;
224
+ __flushMountFrame();
225
+ return __mfResult0;
226
+ } catch (__mfErr) {
227
+ __discardMountFrame(__mfDepth);
228
+ throw __mfErr;
229
+ }
230
+ }
231
+ function MenubarItem(__props) {
232
+ const __mfDepth = __pushMountFrame();
233
+ try {
234
+ const barCtx = useMenubarContext("Item");
235
+ const menuCtx = useMenuContext("Item");
236
+ const __mfResult0 = (() => {
237
+ const __el0 = __element("div");
238
+ __el0.setAttribute("role", "menuitem");
239
+ __el0.setAttribute("data-menubar-item", "");
240
+ __attr(__el0, "data-value", () => __props.value);
241
+ __el0.setAttribute("tabindex", "-1");
242
+ __attr(__el0, "class", () => cn(menuCtx.classes?.item, __props.className ?? __props.class));
243
+ __on(__el0, "click", () => {
244
+ barCtx.getOnSelect()?.(__props.value);
245
+ barCtx.closeAll();
246
+ });
247
+ __enterChildren(__el0);
248
+ __append(__el0, __child(() => __props.children));
249
+ __exitChildren();
250
+ return __el0;
251
+ })();
252
+ __flushMountFrame();
253
+ return __mfResult0;
254
+ } catch (__mfErr) {
255
+ __discardMountFrame(__mfDepth);
256
+ throw __mfErr;
257
+ }
258
+ }
259
+ function MenubarGroup(__props) {
260
+ const __mfDepth = __pushMountFrame();
261
+ try {
262
+ const menuCtx = useMenuContext("Group");
263
+ const __mfResult0 = (() => {
264
+ const __el0 = __element("div");
265
+ __el0.setAttribute("role", "group");
266
+ __attr(__el0, "aria-label", () => __props.label);
267
+ __attr(__el0, "class", () => cn(menuCtx.classes?.group, __props.className ?? __props.class));
268
+ __enterChildren(__el0);
269
+ __append(__el0, __child(() => __props.children));
270
+ __exitChildren();
271
+ return __el0;
272
+ })();
273
+ __flushMountFrame();
274
+ return __mfResult0;
275
+ } catch (__mfErr) {
276
+ __discardMountFrame(__mfDepth);
277
+ throw __mfErr;
278
+ }
279
+ }
280
+ function MenubarLabel(__props) {
281
+ const __mfDepth = __pushMountFrame();
282
+ try {
283
+ const { classes } = useMenuContext("Label");
284
+ const __mfResult0 = (() => {
285
+ const __el0 = __element("div");
286
+ __el0.setAttribute("role", "none");
287
+ __attr(__el0, "class", () => cn(classes?.label, __props.className ?? __props.class));
288
+ __enterChildren(__el0);
289
+ __append(__el0, __child(() => __props.children));
290
+ __exitChildren();
291
+ return __el0;
292
+ })();
293
+ __flushMountFrame();
294
+ return __mfResult0;
295
+ } catch (__mfErr) {
296
+ __discardMountFrame(__mfDepth);
297
+ throw __mfErr;
298
+ }
299
+ }
300
+ function MenubarSeparator(__props) {
301
+ const __mfDepth = __pushMountFrame();
302
+ try {
303
+ const { classes } = useMenuContext("Separator");
304
+ const __mfResult0 = (() => {
305
+ const __el0 = __element("hr");
306
+ __el0.setAttribute("role", "separator");
307
+ __attr(__el0, "class", () => cn(classes?.separator, __props.className ?? __props.class));
308
+ return __el0;
309
+ })();
310
+ __flushMountFrame();
311
+ return __mfResult0;
312
+ } catch (__mfErr) {
313
+ __discardMountFrame(__mfDepth);
314
+ throw __mfErr;
315
+ }
316
+ }
317
+ function ComposedMenubarRoot(__props) {
318
+ const __mfDepth = __pushMountFrame();
319
+ try {
320
+ let getRootEl = function() {
321
+ return rootRef.current ?? null;
322
+ }, getMenuItems = function(contentEl) {
323
+ return [...contentEl.querySelectorAll('[role="menuitem"]')];
324
+ }, getMenuValues = function() {
325
+ const root = getRootEl();
326
+ if (!root)
327
+ return [];
328
+ const triggers = root.querySelectorAll("[data-menubar-trigger]");
329
+ return [...triggers].map((t) => t.getAttribute("data-value"));
330
+ }, closeAll = function() {
331
+ const root = getRootEl();
332
+ if (!root)
333
+ return;
334
+ const triggers = root.querySelectorAll("[data-menubar-trigger]");
335
+ const contents = root.querySelectorAll("[data-menubar-content]");
336
+ for (const trigger of triggers) {
337
+ trigger.setAttribute("aria-expanded", "false");
338
+ trigger.setAttribute("data-state", "closed");
339
+ }
340
+ for (const content of contents) {
341
+ content.setAttribute("data-state", "closed");
342
+ content.setAttribute("aria-hidden", "true");
343
+ content.style.display = "none";
344
+ }
345
+ state.activeMenu = null;
346
+ state.floatingCleanup?.();
347
+ state.floatingCleanup = null;
348
+ state.dismissCleanup?.();
349
+ state.dismissCleanup = null;
350
+ }, openMenu = function(value) {
351
+ const root = getRootEl();
352
+ if (!root)
353
+ return;
354
+ const current = state.activeMenu;
355
+ if (current && current !== value) {
356
+ const prevTrigger = root.querySelector(`[data-menubar-trigger][data-value="${current}"]`);
357
+ const prevContent = root.querySelector(`[data-menubar-content][data-value="${current}"]`);
358
+ if (prevTrigger) {
359
+ prevTrigger.setAttribute("aria-expanded", "false");
360
+ prevTrigger.setAttribute("data-state", "closed");
361
+ }
362
+ if (prevContent) {
363
+ prevContent.setAttribute("data-state", "closed");
364
+ prevContent.setAttribute("aria-hidden", "true");
365
+ prevContent.style.display = "none";
366
+ }
367
+ state.floatingCleanup?.();
368
+ state.floatingCleanup = null;
369
+ }
370
+ const trigger = root.querySelector(`[data-menubar-trigger][data-value="${value}"]`);
371
+ const content = root.querySelector(`[data-menubar-content][data-value="${value}"]`);
372
+ if (!trigger || !content)
373
+ return;
374
+ state.activeMenu = value;
375
+ trigger.setAttribute("aria-expanded", "true");
376
+ trigger.setAttribute("data-state", "open");
377
+ content.setAttribute("aria-hidden", "false");
378
+ content.setAttribute("data-state", "open");
379
+ content.style.display = "";
380
+ {
381
+ const floatingOpts = __props.positioning ?? { placement: "bottom-start", offset: 4 };
382
+ content.style.position = "fixed";
383
+ const result = createFloatingPosition(trigger, content, floatingOpts);
384
+ state.floatingCleanup = result.cleanup;
385
+ if (!state.dismissCleanup) {
386
+ state.dismissCleanup = createDismiss({
387
+ onDismiss: closeAll,
388
+ insideElements: [root],
389
+ escapeKey: false
390
+ });
391
+ }
392
+ }
393
+ const items = getMenuItems(content);
394
+ const firstItem = items[0];
395
+ if (firstItem) {
396
+ firstItem.setAttribute("tabindex", "0");
397
+ firstItem.focus();
398
+ }
399
+ }, navigateMenu = function(direction) {
400
+ const values = getMenuValues();
401
+ if (values.length === 0)
402
+ return;
403
+ const currentIdx = state.activeMenu ? values.indexOf(state.activeMenu) : -1;
404
+ const nextIdx = ((currentIdx + direction) % values.length + values.length) % values.length;
405
+ const nextValue = values[nextIdx];
406
+ if (nextValue) {
407
+ openMenu(nextValue);
408
+ }
409
+ };
410
+ const rootId = uniqueId("menubar");
411
+ const rootRef = ref();
412
+ const state = { activeMenu: null, floatingCleanup: null, dismissCleanup: null };
413
+ const ctx = {
414
+ rootId,
415
+ rootRef,
416
+ classes: __props.classes,
417
+ getOnSelect: () => __props.onSelect,
418
+ getPositioning: () => __props.positioning,
419
+ getActiveMenu: () => state.activeMenu,
420
+ openMenu,
421
+ closeAll,
422
+ navigateMenu
423
+ };
424
+ const __mfResult0 = MenubarContext.Provider({ get value() {
425
+ return ctx;
426
+ }, children: () => (() => {
427
+ const __el0 = __element("div");
428
+ rootRef.current = __el0;
429
+ __el0.setAttribute("role", "menubar");
430
+ {
431
+ const __v = rootId;
432
+ if (__v != null && __v !== false)
433
+ __el0.setAttribute("id", __v === true ? "" : __v);
434
+ }
435
+ __attr(__el0, "class", () => cn(__props.classes?.root));
436
+ __on(__el0, "keydown", (event) => {
437
+ if (state.activeMenu && isKey(event, Keys.ArrowRight)) {
438
+ event.preventDefault();
439
+ navigateMenu(1);
440
+ } else if (state.activeMenu && isKey(event, Keys.ArrowLeft)) {
441
+ event.preventDefault();
442
+ navigateMenu(-1);
443
+ }
444
+ });
445
+ __enterChildren(__el0);
446
+ __append(__el0, __child(() => __props.children));
447
+ __exitChildren();
448
+ return __el0;
449
+ })() });
450
+ __flushMountFrame();
451
+ return __mfResult0;
452
+ } catch (__mfErr) {
453
+ __discardMountFrame(__mfDepth);
454
+ throw __mfErr;
455
+ }
456
+ }
457
+ var ComposedMenubar = Object.assign(ComposedMenubarRoot, {
458
+ Menu: MenubarMenu,
459
+ Trigger: MenubarTrigger,
460
+ Content: MenubarContent,
461
+ Item: MenubarItem,
462
+ Group: MenubarGroup,
463
+ Label: MenubarLabel,
464
+ Separator: MenubarSeparator
465
+ });
466
+
467
+ export { ComposedMenubar };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-e2v1c9ex.js";
8
8
  import {
9
9
  createFloatingPosition
10
- } from "./chunk-0mcr52hc.js";
10
+ } from "./chunk-vef3sepw.js";
11
11
  import {
12
12
  Keys,
13
13
  isKey
@@ -0,0 +1,26 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-q7xbcj9q.js";
4
+
5
+ // src/input/input-composed.tsx
6
+ import { __attr, __discardMountFrame, __element, __flushMountFrame, __pushMountFrame, __spread } from "@vertz/ui/internals";
7
+ function ComposedInputRoot(__props) {
8
+ const { classes: __$drop_0, className: __$drop_1, class: __$drop_2, ...props } = __props;
9
+ const __mfDepth = __pushMountFrame();
10
+ try {
11
+ const __mfResult0 = (() => {
12
+ const __el0 = __element("input");
13
+ __attr(__el0, "class", () => cn(__props.classes?.base, __props.className ?? __props.class));
14
+ __spread(__el0, props);
15
+ return __el0;
16
+ })();
17
+ __flushMountFrame();
18
+ return __mfResult0;
19
+ } catch (__mfErr) {
20
+ __discardMountFrame(__mfDepth);
21
+ throw __mfErr;
22
+ }
23
+ }
24
+ var ComposedInput = ComposedInputRoot;
25
+
26
+ export { ComposedInput };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createFloatingPosition
3
- } from "./chunk-0mcr52hc.js";
3
+ } from "./chunk-vef3sepw.js";
4
4
  import {
5
5
  Keys,
6
6
  isKey