@vertz/ui-primitives 0.2.38 → 0.2.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/shared/chunk-06m8prfg.js +52 -0
  2. package/dist/shared/chunk-0n9jj8xr.js +24 -0
  3. package/dist/shared/chunk-1ben27xq.js +317 -0
  4. package/dist/shared/chunk-1j2mj0sa.js +45 -0
  5. package/dist/shared/chunk-250hj18f.js +243 -0
  6. package/dist/shared/chunk-2h4m9c71.js +38 -0
  7. package/dist/shared/chunk-2sbx20hv.js +128 -0
  8. package/dist/shared/chunk-2ye674gr.js +70 -0
  9. package/dist/shared/chunk-34d8385y.js +15 -0
  10. package/dist/shared/chunk-4d7bm8h0.js +113 -0
  11. package/dist/shared/chunk-4zjgxr7x.js +157 -0
  12. package/dist/shared/chunk-5c150wvr.js +140 -0
  13. package/dist/shared/chunk-5gycdypd.js +58 -0
  14. package/dist/shared/chunk-6mm7fhp8.js +105 -0
  15. package/dist/shared/chunk-6zmnqvh6.js +109 -0
  16. package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
  17. package/dist/shared/chunk-7pbff2hg.js +118 -0
  18. package/dist/shared/chunk-7zpjshwz.js +194 -0
  19. package/dist/shared/chunk-993ff51d.js +155 -0
  20. package/dist/shared/chunk-9pdt5aw7.js +24 -0
  21. package/dist/shared/chunk-a71m4xkv.js +106 -0
  22. package/dist/shared/chunk-aj8m39pk.js +127 -0
  23. package/dist/shared/chunk-ajawpc05.js +305 -0
  24. package/dist/shared/chunk-b7mzwqhj.js +125 -0
  25. package/dist/shared/chunk-bb887de4.js +200 -0
  26. package/dist/shared/chunk-bfsmbrxc.js +111 -0
  27. package/dist/shared/chunk-c2f63m5n.js +56 -0
  28. package/dist/shared/chunk-c5r3s5km.js +263 -0
  29. package/dist/shared/chunk-caba5bhd.js +427 -0
  30. package/dist/shared/chunk-crym07yc.js +264 -0
  31. package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
  32. package/dist/shared/chunk-d6rtejz3.js +128 -0
  33. package/dist/shared/chunk-dvaf0bmq.js +140 -0
  34. package/dist/shared/chunk-dwkv9ya6.js +22 -0
  35. package/dist/shared/chunk-e0ckxrjg.js +41 -0
  36. package/dist/shared/chunk-ennxcymj.js +225 -0
  37. package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
  38. package/dist/shared/chunk-f0v1gs5e.js +52 -0
  39. package/dist/shared/chunk-f86rsf84.js +231 -0
  40. package/dist/shared/chunk-fdse46x5.js +21 -0
  41. package/dist/shared/chunk-gj4hrssn.js +135 -0
  42. package/dist/shared/chunk-gyvq4gk9.js +24 -0
  43. package/dist/shared/chunk-hbnps9sq.js +229 -0
  44. package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
  45. package/dist/shared/chunk-hgnkd4he.js +256 -0
  46. package/dist/shared/chunk-hpcyffm7.js +185 -0
  47. package/dist/shared/chunk-hpmvwx0h.js +99 -0
  48. package/dist/shared/chunk-hz0e504p.js +69 -0
  49. package/dist/shared/chunk-hzk4wfq9.js +43 -0
  50. package/dist/shared/chunk-j7znzkpa.js +48 -0
  51. package/dist/shared/chunk-j9kxgrnn.js +167 -0
  52. package/dist/shared/chunk-jetwnv0w.js +130 -0
  53. package/dist/shared/chunk-jjdg26c1.js +155 -0
  54. package/dist/shared/chunk-k0m4yh86.js +123 -0
  55. package/dist/shared/chunk-k43q9cjr.js +82 -0
  56. package/dist/shared/chunk-k9k8tbr5.js +119 -0
  57. package/dist/shared/chunk-meaj7br1.js +232 -0
  58. package/dist/shared/chunk-mgj0n08k.js +34 -0
  59. package/dist/shared/chunk-mjz4rp6c.js +46 -0
  60. package/dist/shared/chunk-n4rr5gme.js +239 -0
  61. package/dist/shared/chunk-nk55etpp.js +65 -0
  62. package/dist/shared/chunk-nkh1ks3k.js +264 -0
  63. package/dist/shared/chunk-pgvpvbpe.js +26 -0
  64. package/dist/shared/chunk-pma8gnv7.js +178 -0
  65. package/dist/shared/chunk-q7xv6xze.js +131 -0
  66. package/dist/shared/chunk-qey801nq.js +22 -0
  67. package/dist/shared/chunk-s6b4c3tj.js +58 -0
  68. package/dist/shared/chunk-sq27a4h0.js +36 -0
  69. package/dist/shared/chunk-taa5pj15.js +103 -0
  70. package/dist/shared/chunk-tc5rpvyx.js +127 -0
  71. package/dist/shared/chunk-tescm0b3.js +192 -0
  72. package/dist/shared/chunk-tkftdwnq.js +71 -0
  73. package/dist/shared/chunk-tqhnjcfp.js +116 -0
  74. package/dist/shared/chunk-vfknb5ht.js +183 -0
  75. package/dist/shared/chunk-vsc369w3.js +185 -0
  76. package/dist/shared/chunk-whq9s8v5.js +301 -0
  77. package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
  78. package/dist/shared/chunk-yzbmkx4r.js +155 -0
  79. package/dist/shared/chunk-zaen0ajc.js +347 -0
  80. package/dist/src/accordion/accordion-composed.js +1 -1
  81. package/dist/src/accordion/accordion.js +1 -1
  82. package/dist/src/alert/alert-composed.js +1 -1
  83. package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
  84. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  85. package/dist/src/avatar/avatar-composed.js +1 -1
  86. package/dist/src/badge/badge-composed.js +1 -1
  87. package/dist/src/badge/badge.js +1 -1
  88. package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
  89. package/dist/src/button/button-composed.js +1 -1
  90. package/dist/src/button/button.js +1 -1
  91. package/dist/src/calendar/calendar-composed.js +1 -1
  92. package/dist/src/calendar/calendar.js +1 -1
  93. package/dist/src/card/card-composed.js +1 -1
  94. package/dist/src/carousel/carousel-composed.js +1 -1
  95. package/dist/src/carousel/carousel.js +1 -1
  96. package/dist/src/checkbox/checkbox-composed.js +1 -1
  97. package/dist/src/checkbox/checkbox.js +1 -1
  98. package/dist/src/collapsible/collapsible-composed.js +1 -1
  99. package/dist/src/collapsible/collapsible.js +1 -1
  100. package/dist/src/combobox/combobox-composed.js +1 -1
  101. package/dist/src/combobox/combobox.js +1 -1
  102. package/dist/src/command/command-composed.js +1 -1
  103. package/dist/src/command/command.js +1 -1
  104. package/dist/src/composed/with-styles.js +1 -1
  105. package/dist/src/context-menu/context-menu-composed.js +1 -1
  106. package/dist/src/context-menu/context-menu.js +1 -1
  107. package/dist/src/date-picker/date-picker-composed.js +1 -1
  108. package/dist/src/date-picker/date-picker.js +1 -1
  109. package/dist/src/dialog/dialog-composed.js +1 -1
  110. package/dist/src/dialog/dialog-stack-parts.js +1 -1
  111. package/dist/src/dialog/dialog.js +1 -1
  112. package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
  113. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  114. package/dist/src/empty-state/empty-state-composed.js +1 -1
  115. package/dist/src/form-group/form-group-composed.js +1 -1
  116. package/dist/src/hover-card/hover-card-composed.js +1 -1
  117. package/dist/src/hover-card/hover-card.js +1 -1
  118. package/dist/src/input/input-composed.js +1 -1
  119. package/dist/src/label/label-composed.js +1 -1
  120. package/dist/src/list/list-composed.js +1 -1
  121. package/dist/src/menu/menu-composed.js +1 -1
  122. package/dist/src/menu/menu.js +1 -1
  123. package/dist/src/menubar/menubar-composed.js +1 -1
  124. package/dist/src/menubar/menubar.js +1 -1
  125. package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
  126. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  127. package/dist/src/pagination/pagination-composed.js +1 -1
  128. package/dist/src/popover/popover-composed.js +1 -1
  129. package/dist/src/popover/popover.js +1 -1
  130. package/dist/src/progress/progress-composed.js +1 -1
  131. package/dist/src/progress/progress.js +1 -1
  132. package/dist/src/radio/radio-composed.js +1 -1
  133. package/dist/src/radio/radio.js +1 -1
  134. package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
  135. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  136. package/dist/src/scroll-area/scroll-area-composed.js +1 -1
  137. package/dist/src/scroll-area/scroll-area.js +1 -1
  138. package/dist/src/select/select-composed.js +1 -1
  139. package/dist/src/select/select.js +1 -1
  140. package/dist/src/separator/separator-composed.js +1 -1
  141. package/dist/src/sheet/sheet-composed.js +1 -1
  142. package/dist/src/sheet/sheet.js +1 -1
  143. package/dist/src/skeleton/skeleton-composed.js +1 -1
  144. package/dist/src/slider/slider-composed.js +1 -1
  145. package/dist/src/slider/slider.js +1 -1
  146. package/dist/src/switch/switch-composed.js +1 -1
  147. package/dist/src/switch/switch.js +1 -1
  148. package/dist/src/table/table-composed.js +1 -1
  149. package/dist/src/tabs/tabs-composed.js +1 -1
  150. package/dist/src/tabs/tabs.js +1 -1
  151. package/dist/src/textarea/textarea-composed.js +1 -1
  152. package/dist/src/toast/toast.js +1 -1
  153. package/dist/src/toggle/toggle-composed.js +1 -1
  154. package/dist/src/toggle/toggle.js +1 -1
  155. package/dist/src/toggle-group/toggle-group-composed.js +1 -1
  156. package/dist/src/toggle-group/toggle-group.js +1 -1
  157. package/dist/src/tooltip/tooltip-composed.js +1 -1
  158. package/dist/src/tooltip/tooltip.js +1 -1
  159. package/package.json +3 -3
  160. package/dist/shared/chunk-144kbnmx.js +0 -95
  161. package/dist/shared/chunk-1ewxfgsa.js +0 -167
  162. package/dist/shared/chunk-1hm0mbke.js +0 -258
  163. package/dist/shared/chunk-22rt6ws9.js +0 -69
  164. package/dist/shared/chunk-2ssqz188.js +0 -162
  165. package/dist/shared/chunk-33he7ay9.js +0 -218
  166. package/dist/shared/chunk-3jack97k.js +0 -509
  167. package/dist/shared/chunk-75pegjs7.js +0 -26
  168. package/dist/shared/chunk-862x7dja.js +0 -398
  169. package/dist/shared/chunk-8pk1pn5h.js +0 -215
  170. package/dist/shared/chunk-8t0nm721.js +0 -152
  171. package/dist/shared/chunk-94twh4s4.js +0 -28
  172. package/dist/shared/chunk-9yb26c0w.js +0 -232
  173. package/dist/shared/chunk-a82r2pnq.js +0 -67
  174. package/dist/shared/chunk-axpbdpgx.js +0 -177
  175. package/dist/shared/chunk-b3j6mym6.js +0 -203
  176. package/dist/shared/chunk-b4zzg457.js +0 -410
  177. package/dist/shared/chunk-b9qxfcsy.js +0 -60
  178. package/dist/shared/chunk-bc2qqkhr.js +0 -194
  179. package/dist/shared/chunk-bv12nkdm.js +0 -149
  180. package/dist/shared/chunk-bvxc1ww4.js +0 -164
  181. package/dist/shared/chunk-czv0kqj4.js +0 -107
  182. package/dist/shared/chunk-d83ag07h.js +0 -189
  183. package/dist/shared/chunk-de18ashk.js +0 -134
  184. package/dist/shared/chunk-dvk4h36t.js +0 -140
  185. package/dist/shared/chunk-dxvnerw2.js +0 -353
  186. package/dist/shared/chunk-e399pzdq.js +0 -241
  187. package/dist/shared/chunk-e4qha9as.js +0 -180
  188. package/dist/shared/chunk-eb2d9v6k.js +0 -68
  189. package/dist/shared/chunk-ect26sp5.js +0 -353
  190. package/dist/shared/chunk-ev367pq3.js +0 -102
  191. package/dist/shared/chunk-fjykbv0v.js +0 -214
  192. package/dist/shared/chunk-gdddk6nh.js +0 -96
  193. package/dist/shared/chunk-ghkw5bjq.js +0 -55
  194. package/dist/shared/chunk-hfjtkytb.js +0 -310
  195. package/dist/shared/chunk-hpvjfj0j.js +0 -31
  196. package/dist/shared/chunk-jpyjk616.js +0 -52
  197. package/dist/shared/chunk-k6d53tne.js +0 -206
  198. package/dist/shared/chunk-knzg86am.js +0 -168
  199. package/dist/shared/chunk-ktbf6xrt.js +0 -179
  200. package/dist/shared/chunk-m8y2p66x.js +0 -252
  201. package/dist/shared/chunk-metxdt5x.js +0 -28
  202. package/dist/shared/chunk-mgae1d93.js +0 -157
  203. package/dist/shared/chunk-mtx2cfbx.js +0 -175
  204. package/dist/shared/chunk-n436p5cb.js +0 -260
  205. package/dist/shared/chunk-nj420k31.js +0 -54
  206. package/dist/shared/chunk-nsmvdxgp.js +0 -213
  207. package/dist/shared/chunk-pcms04vq.js +0 -162
  208. package/dist/shared/chunk-pqskzq8t.js +0 -79
  209. package/dist/shared/chunk-pwr60kyd.js +0 -321
  210. package/dist/shared/chunk-pzknpa1y.js +0 -327
  211. package/dist/shared/chunk-q77y3rg4.js +0 -189
  212. package/dist/shared/chunk-qhnany7w.js +0 -179
  213. package/dist/shared/chunk-r3pffzss.js +0 -13
  214. package/dist/shared/chunk-rdr0rtpr.js +0 -131
  215. package/dist/shared/chunk-rj52ty6r.js +0 -147
  216. package/dist/shared/chunk-rnqc7735.js +0 -125
  217. package/dist/shared/chunk-rtk30950.js +0 -202
  218. package/dist/shared/chunk-s0xgd8vg.js +0 -266
  219. package/dist/shared/chunk-s415735j.js +0 -357
  220. package/dist/shared/chunk-s62e7jf4.js +0 -30
  221. package/dist/shared/chunk-snd8e6r8.js +0 -418
  222. package/dist/shared/chunk-spng4yb9.js +0 -73
  223. package/dist/shared/chunk-t887wwjc.js +0 -168
  224. package/dist/shared/chunk-tn0m98j8.js +0 -42
  225. package/dist/shared/chunk-v0b5pkcq.js +0 -30
  226. package/dist/shared/chunk-v5tj7veh.js +0 -284
  227. package/dist/shared/chunk-vkscwzpr.js +0 -294
  228. package/dist/shared/chunk-vv187snj.js +0 -112
  229. package/dist/shared/chunk-xv4wd0kf.js +0 -293
  230. package/dist/shared/chunk-y1hpsqzy.js +0 -185
  231. package/dist/shared/chunk-yfzddvxc.js +0 -71
  232. package/dist/shared/chunk-yzgzx2dh.js +0 -311
  233. package/dist/shared/chunk-z5j7ztf2.js +0 -467
@@ -1,266 +0,0 @@
1
- import {
2
- createDismiss
3
- } from "./chunk-a6wp8c32.js";
4
- import {
5
- createFloatingPosition
6
- } from "./chunk-vef3sepw.js";
7
- import {
8
- linkedIds
9
- } from "./chunk-8y1jf6xr.js";
10
- import {
11
- Keys,
12
- handleListNavigation,
13
- isKey
14
- } from "./chunk-7867pr13.js";
15
- import {
16
- setDataState,
17
- setExpanded,
18
- setHidden,
19
- setHiddenAnimated
20
- } from "./chunk-vevfhpc9.js";
21
- import {
22
- applyAttrs
23
- } from "./chunk-2db2dnp3.js";
24
-
25
- // src/menu/menu.tsx
26
- import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
27
- import { signal } from "@vertz/ui";
28
- function MenuRoot(options = {}) {
29
- const __mfDepth = __pushMountFrame();
30
- try {
31
- let handleClickOutside = function(event) {
32
- const target = event.target;
33
- if (!trigger.contains(target) && !content.contains(target)) {
34
- close();
35
- }
36
- }, open = function(activateFirst = false) {
37
- state.open.value = true;
38
- setExpanded(trigger, true);
39
- setHidden(content, false);
40
- setDataState(trigger, "open");
41
- setDataState(content, "open");
42
- onOpenChange?.(true);
43
- if (positioning) {
44
- const ref = positioning.referenceElement ?? trigger;
45
- const result = createFloatingPosition(ref, content, positioning);
46
- floatingCleanup = result.cleanup;
47
- dismissCleanup = createDismiss({
48
- onDismiss: close,
49
- insideElements: [ref, trigger, content],
50
- escapeKey: false
51
- });
52
- } else {
53
- document.addEventListener("mousedown", handleClickOutside);
54
- }
55
- if (activateFirst && items.length > 0) {
56
- state.activeIndex.value = 0;
57
- updateActiveItem(0);
58
- items[0]?.focus();
59
- } else {
60
- state.activeIndex.value = -1;
61
- updateActiveItem(-1);
62
- content.focus();
63
- }
64
- }, close = function() {
65
- state.open.value = false;
66
- setExpanded(trigger, false);
67
- setDataState(trigger, "closed");
68
- setDataState(content, "closed");
69
- setHiddenAnimated(content, true);
70
- onOpenChange?.(false);
71
- if (positioning) {
72
- floatingCleanup?.();
73
- floatingCleanup = null;
74
- dismissCleanup?.();
75
- dismissCleanup = null;
76
- } else {
77
- document.removeEventListener("mousedown", handleClickOutside);
78
- }
79
- trigger.focus();
80
- }, updateActiveItem = function(index) {
81
- for (let i = 0;i < items.length; i++) {
82
- items[i]?.setAttribute("tabindex", i === index ? "0" : "-1");
83
- }
84
- }, createItem = function(value, label) {
85
- const item = (() => {
86
- const __el2 = __element("div");
87
- __el2.setAttribute("role", "menuitem");
88
- {
89
- const __v = value;
90
- if (__v != null && __v !== false)
91
- __el2.setAttribute("data-value", __v === true ? "" : __v);
92
- }
93
- __el2.setAttribute("tabindex", "-1");
94
- __on(__el2, "click", () => {
95
- onSelect?.(value);
96
- close();
97
- });
98
- __enterChildren(__el2);
99
- __insert(__el2, label ?? value);
100
- __exitChildren();
101
- return __el2;
102
- })();
103
- items.push(item);
104
- return item;
105
- }, Item = function(value, label) {
106
- return createItem(value, label);
107
- }, Group = function(label) {
108
- const el = (() => {
109
- const __el3 = __element("div");
110
- __el3.setAttribute("role", "group");
111
- {
112
- const __v = label;
113
- if (__v != null && __v !== false)
114
- __el3.setAttribute("aria-label", __v === true ? "" : __v);
115
- }
116
- return __el3;
117
- })();
118
- return {
119
- el,
120
- Item: (value, itemLabel) => createItem(value, itemLabel)
121
- };
122
- }, Separator = function() {
123
- return (() => {
124
- const __el4 = __element("hr");
125
- __el4.setAttribute("data-v-id", "MenuRoot");
126
- __el4.setAttribute("role", "separator");
127
- return __el4;
128
- })();
129
- }, Label = function(text) {
130
- return (() => {
131
- const __el5 = __element("div");
132
- __el5.setAttribute("role", "none");
133
- __enterChildren(__el5);
134
- __insert(__el5, text);
135
- __exitChildren();
136
- return __el5;
137
- })();
138
- };
139
- const { onSelect, onOpenChange, positioning, ...attrs } = options;
140
- const ids = linkedIds("menu");
141
- const state = {
142
- open: signal(false),
143
- activeIndex: signal(-1)
144
- };
145
- const items = [];
146
- let floatingCleanup = null;
147
- let dismissCleanup = null;
148
- const trigger = (() => {
149
- const __el0 = __element("button");
150
- __el0.setAttribute("type", "button");
151
- {
152
- const __v = ids.triggerId;
153
- if (__v != null && __v !== false)
154
- __el0.setAttribute("id", __v === true ? "" : __v);
155
- }
156
- {
157
- const __v = ids.contentId;
158
- if (__v != null && __v !== false)
159
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
160
- }
161
- __el0.setAttribute("aria-haspopup", "menu");
162
- __el0.setAttribute("aria-expanded", "false");
163
- __el0.setAttribute("data-state", "closed");
164
- __on(__el0, "click", () => {
165
- if (state.open.peek()) {
166
- close();
167
- } else {
168
- open();
169
- }
170
- });
171
- __on(__el0, "keydown", (event) => {
172
- if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
173
- event.preventDefault();
174
- if (!state.open.peek())
175
- open(true);
176
- }
177
- });
178
- return __el0;
179
- })();
180
- const content = (() => {
181
- const __el1 = __element("div");
182
- __el1.setAttribute("role", "menu");
183
- __el1.setAttribute("tabindex", "-1");
184
- {
185
- const __v = ids.contentId;
186
- if (__v != null && __v !== false)
187
- __el1.setAttribute("id", __v === true ? "" : __v);
188
- }
189
- __el1.setAttribute("aria-hidden", "true");
190
- __el1.setAttribute("data-state", "closed");
191
- {
192
- const __v = { display: "none" };
193
- if (__v != null && __v !== false)
194
- __el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
195
- }
196
- __on(__el1, "keydown", (event) => {
197
- if (isKey(event, Keys.Escape)) {
198
- event.preventDefault();
199
- close();
200
- return;
201
- }
202
- if (isKey(event, Keys.Enter, Keys.Space)) {
203
- event.preventDefault();
204
- const active = items[state.activeIndex.peek()];
205
- if (active) {
206
- const val = active.getAttribute("data-value");
207
- if (val !== null) {
208
- onSelect?.(val);
209
- close();
210
- }
211
- }
212
- return;
213
- }
214
- if (state.activeIndex.peek() === -1) {
215
- if (isKey(event, Keys.ArrowDown)) {
216
- event.preventDefault();
217
- state.activeIndex.value = 0;
218
- updateActiveItem(0);
219
- items[0]?.focus();
220
- return;
221
- }
222
- if (isKey(event, Keys.ArrowUp)) {
223
- event.preventDefault();
224
- const last = items.length - 1;
225
- state.activeIndex.value = last;
226
- updateActiveItem(last);
227
- items[last]?.focus();
228
- return;
229
- }
230
- }
231
- const result = handleListNavigation(event, items, { orientation: "vertical" });
232
- if (result) {
233
- const idx = items.indexOf(result);
234
- if (idx >= 0) {
235
- state.activeIndex.value = idx;
236
- updateActiveItem(idx);
237
- }
238
- return;
239
- }
240
- if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
241
- const char = event.key.toLowerCase();
242
- const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
243
- if (match) {
244
- const idx = items.indexOf(match);
245
- state.activeIndex.value = idx;
246
- updateActiveItem(idx);
247
- match.focus();
248
- }
249
- }
250
- });
251
- return __el1;
252
- })();
253
- applyAttrs(trigger, attrs);
254
- const __mfResult0 = { trigger, content, state, Item, Group, Separator, Label };
255
- __flushMountFrame();
256
- return __mfResult0;
257
- } catch (__mfErr) {
258
- __discardMountFrame(__mfDepth);
259
- throw __mfErr;
260
- }
261
- }
262
- var Menu = {
263
- Root: MenuRoot
264
- };
265
-
266
- export { Menu };
@@ -1,357 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-q7xbcj9q.js";
4
- import {
5
- uniqueId
6
- } from "./chunk-8y1jf6xr.js";
7
- import {
8
- Keys,
9
- isKey
10
- } from "./chunk-7867pr13.js";
11
-
12
- // src/command/command-composed.tsx
13
- import { computed } from "@vertz/ui";
14
- import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
15
- import { createContext, useContext } from "@vertz/ui";
16
- var CommandContext = createContext(undefined, "@vertz/ui-primitives::CommandContext");
17
- function useCommandContext(componentName) {
18
- const ctx = useContext(CommandContext);
19
- if (!ctx) {
20
- throw new Error(`<Command.${componentName}> must be used inside <Command>. ` + "Ensure it is a direct or nested child of the Command root component.");
21
- }
22
- return ctx;
23
- }
24
- function CommandInput(__props) {
25
- const __mfDepth = __pushMountFrame();
26
- try {
27
- const ctx = useCommandContext("Input");
28
- const __mfResult0 = (() => {
29
- const __el0 = __element("input");
30
- __el0.setAttribute("type", "text");
31
- __el0.setAttribute("role", "combobox");
32
- __el0.setAttribute("aria-autocomplete", "list");
33
- __el0.setAttribute("aria-expanded", "true");
34
- {
35
- const __v = ctx.listId;
36
- if (__v != null && __v !== false)
37
- __el0.setAttribute("aria-controls", __v === true ? "" : __v);
38
- }
39
- __el0.setAttribute("data-command-input", "");
40
- {
41
- const __v = ctx.placeholder;
42
- if (__v != null && __v !== false)
43
- __el0.setAttribute("placeholder", __v === true ? "" : __v);
44
- }
45
- __attr(__el0, "class", () => cn(ctx.classes?.input, __props.className ?? __props.class));
46
- __on(__el0, "input", (e) => {
47
- ctx.handleInput(e.target);
48
- });
49
- __on(__el0, "keydown", (e) => {
50
- ctx.handleKeydown(e, e.target);
51
- });
52
- return __el0;
53
- })();
54
- __flushMountFrame();
55
- return __mfResult0;
56
- } catch (__mfErr) {
57
- __discardMountFrame(__mfDepth);
58
- throw __mfErr;
59
- }
60
- }
61
- function CommandList(__props) {
62
- const __mfDepth = __pushMountFrame();
63
- try {
64
- const ctx = useCommandContext("List");
65
- const __mfResult0 = (() => {
66
- const __el0 = __element("div");
67
- __el0.setAttribute("role", "listbox");
68
- {
69
- const __v = ctx.listId;
70
- if (__v != null && __v !== false)
71
- __el0.setAttribute("id", __v === true ? "" : __v);
72
- }
73
- __attr(__el0, "class", () => cn(ctx.classes?.list, __props.className ?? __props.class));
74
- __enterChildren(__el0);
75
- __append(__el0, __child(() => __props.children));
76
- __exitChildren();
77
- return __el0;
78
- })();
79
- __flushMountFrame();
80
- return __mfResult0;
81
- } catch (__mfErr) {
82
- __discardMountFrame(__mfDepth);
83
- throw __mfErr;
84
- }
85
- }
86
- function CommandEmpty(__props) {
87
- const __mfDepth = __pushMountFrame();
88
- try {
89
- const ctx = useCommandContext("Empty");
90
- const __mfResult0 = (() => {
91
- const __el0 = __element("div");
92
- __el0.setAttribute("data-part", "command-empty");
93
- __el0.setAttribute("data-command-empty", "");
94
- __el0.setAttribute("aria-hidden", "true");
95
- __el0.setAttribute("style", "display: none");
96
- __attr(__el0, "class", () => cn(ctx.classes?.empty, __props.className ?? __props.class));
97
- __enterChildren(__el0);
98
- __append(__el0, __child(() => __props.children));
99
- __exitChildren();
100
- return __el0;
101
- })();
102
- __flushMountFrame();
103
- return __mfResult0;
104
- } catch (__mfErr) {
105
- __discardMountFrame(__mfDepth);
106
- throw __mfErr;
107
- }
108
- }
109
- function CommandItem(__props) {
110
- const __mfDepth = __pushMountFrame();
111
- try {
112
- const ctx = useCommandContext("Item");
113
- const isInitialActive = ctx.claimInitialActive();
114
- const __mfResult0 = (() => {
115
- const __el0 = __element("div");
116
- __el0.setAttribute("role", "option");
117
- __attr(__el0, "data-value", () => __props.value);
118
- {
119
- const __v = isInitialActive ? "true" : "false";
120
- if (__v != null && __v !== false)
121
- __el0.setAttribute("aria-selected", __v === true ? "" : __v);
122
- }
123
- __attr(__el0, "data-keywords", () => __props.keywords && __props.keywords.length > 0 ? __props.keywords.join(" ") : undefined);
124
- __attr(__el0, "class", () => cn(ctx.classes?.item, __props.className ?? __props.class));
125
- __on(__el0, "click", () => {
126
- ctx.getOnSelect()?.(__props.value);
127
- });
128
- __enterChildren(__el0);
129
- __append(__el0, __child(() => __props.children));
130
- __exitChildren();
131
- return __el0;
132
- })();
133
- __flushMountFrame();
134
- return __mfResult0;
135
- } catch (__mfErr) {
136
- __discardMountFrame(__mfDepth);
137
- throw __mfErr;
138
- }
139
- }
140
- function CommandGroup(__props) {
141
- const __mfDepth = __pushMountFrame();
142
- try {
143
- const ctx = useCommandContext("Group");
144
- const headingId = uniqueId("command-group");
145
- const __mfResult0 = (() => {
146
- const __el0 = __element("div");
147
- __el0.setAttribute("role", "group");
148
- {
149
- const __v = headingId;
150
- if (__v != null && __v !== false)
151
- __el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
152
- }
153
- __el0.setAttribute("data-command-group", "");
154
- __attr(__el0, "class", () => cn(ctx.classes?.group, __props.className ?? __props.class));
155
- __enterChildren(__el0);
156
- __append(__el0, (() => {
157
- const __el1 = __element("div");
158
- {
159
- const __v = headingId;
160
- if (__v != null && __v !== false)
161
- __el1.setAttribute("id", __v === true ? "" : __v);
162
- }
163
- __el1.setAttribute("data-command-group-heading", "");
164
- {
165
- const __v = cn(ctx.classes?.groupHeading);
166
- if (__v != null && __v !== false)
167
- __el1.setAttribute("class", __v === true ? "" : __v);
168
- }
169
- __enterChildren(__el1);
170
- __append(__el1, __child(() => __props.label));
171
- __exitChildren();
172
- return __el1;
173
- })());
174
- __append(__el0, __child(() => __props.children));
175
- __exitChildren();
176
- return __el0;
177
- })();
178
- __flushMountFrame();
179
- return __mfResult0;
180
- } catch (__mfErr) {
181
- __discardMountFrame(__mfDepth);
182
- throw __mfErr;
183
- }
184
- }
185
- function CommandSeparator(__props) {
186
- const __mfDepth = __pushMountFrame();
187
- try {
188
- const ctx = useCommandContext("Separator");
189
- const __mfResult0 = (() => {
190
- const __el0 = __element("hr");
191
- __el0.setAttribute("role", "separator");
192
- __attr(__el0, "class", () => cn(ctx.classes?.separator, __props.className ?? __props.class));
193
- return __el0;
194
- })();
195
- __flushMountFrame();
196
- return __mfResult0;
197
- } catch (__mfErr) {
198
- __discardMountFrame(__mfDepth);
199
- throw __mfErr;
200
- }
201
- }
202
- function ComposedCommandRoot(__props) {
203
- const __mfDepth = __pushMountFrame();
204
- try {
205
- let claimInitialActive = function() {
206
- if (state.initialClaimed)
207
- return false;
208
- state.initialClaimed = true;
209
- return true;
210
- }, findRoot = function(el) {
211
- let current = el;
212
- while (current) {
213
- if (current.id === rootId)
214
- return current;
215
- current = current.parentElement;
216
- }
217
- return null;
218
- }, getItemsFrom = function(root) {
219
- return [...root.querySelectorAll('[role="option"]')];
220
- }, getVisibleItemsFrom = function(root) {
221
- return getItemsFrom(root).filter((item) => item.getAttribute("aria-hidden") !== "true");
222
- }, updateActiveItemIn = function(root) {
223
- const allItems = getItemsFrom(root);
224
- const visible = getVisibleItemsFrom(root);
225
- for (const item of allItems) {
226
- item.setAttribute("aria-selected", "false");
227
- }
228
- if (visible.length > 0 && state.activeIndex >= 0 && state.activeIndex < visible.length) {
229
- visible[state.activeIndex]?.setAttribute("aria-selected", "true");
230
- }
231
- }, runFilterFrom = function(inputEl, root) {
232
- const search = inputEl.value ?? "";
233
- const allItems = getItemsFrom(root);
234
- let visibleCount = 0;
235
- for (const item of allItems) {
236
- const value = item.getAttribute("data-value") ?? "";
237
- const text = item.textContent ?? "";
238
- const keywords = item.getAttribute("data-keywords") ?? "";
239
- const searchable = `${value} ${text} ${keywords}`;
240
- const matches = search === "" || filterFn.value(searchable, search);
241
- item.setAttribute("aria-hidden", String(!matches));
242
- item.style.display = matches ? "" : "none";
243
- if (matches)
244
- visibleCount++;
245
- }
246
- const groups = root.querySelectorAll("[data-command-group]");
247
- for (const group of groups) {
248
- const groupItems = group.querySelectorAll('[role="option"]');
249
- const hasVisible = [...groupItems].some((item) => item.getAttribute("aria-hidden") !== "true");
250
- const heading = group.querySelector("[data-command-group-heading]");
251
- if (heading) {
252
- heading.setAttribute("aria-hidden", String(!hasVisible));
253
- heading.style.display = hasVisible ? "" : "none";
254
- }
255
- group.style.display = hasVisible ? "" : "none";
256
- }
257
- const emptyEl = root.querySelector("[data-command-empty]");
258
- if (emptyEl) {
259
- const hide = visibleCount > 0;
260
- emptyEl.setAttribute("aria-hidden", String(hide));
261
- emptyEl.style.display = hide ? "none" : "";
262
- }
263
- state.activeIndex = 0;
264
- updateActiveItemIn(root);
265
- }, handleInput = function(inputEl) {
266
- const root = findRoot(inputEl);
267
- if (!root)
268
- return;
269
- __props.onInputChange?.(inputEl.value);
270
- runFilterFrom(inputEl, root);
271
- }, handleKeydown = function(event, inputEl) {
272
- const root = findRoot(inputEl);
273
- if (!root)
274
- return;
275
- const visible = getVisibleItemsFrom(root);
276
- if (isKey(event, Keys.ArrowDown)) {
277
- event.preventDefault();
278
- const next = Math.min(state.activeIndex + 1, visible.length - 1);
279
- state.activeIndex = next;
280
- updateActiveItemIn(root);
281
- return;
282
- }
283
- if (isKey(event, Keys.ArrowUp)) {
284
- event.preventDefault();
285
- const prev = Math.max(state.activeIndex - 1, 0);
286
- state.activeIndex = prev;
287
- updateActiveItemIn(root);
288
- return;
289
- }
290
- if (isKey(event, Keys.Enter)) {
291
- event.preventDefault();
292
- const active = visible[state.activeIndex];
293
- if (active) {
294
- const val = active.getAttribute("data-value");
295
- if (val !== null) {
296
- __props.onSelect?.(val);
297
- }
298
- }
299
- return;
300
- }
301
- if (isKey(event, Keys.Escape)) {
302
- event.preventDefault();
303
- inputEl.value = "";
304
- __props.onInputChange?.("");
305
- runFilterFrom(inputEl, root);
306
- }
307
- };
308
- const rootId = uniqueId("command");
309
- const listId = uniqueId("command-list");
310
- const defaultFilter = (value, search) => value.toLowerCase().includes(search.toLowerCase());
311
- const filterFn = computed(() => __props.filter ?? defaultFilter);
312
- const state = {
313
- activeIndex: 0,
314
- initialClaimed: false
315
- };
316
- const ctx = {
317
- rootId,
318
- listId,
319
- classes: __props.classes,
320
- getOnSelect: () => __props.onSelect,
321
- placeholder: __props.placeholder,
322
- handleInput,
323
- handleKeydown,
324
- claimInitialActive
325
- };
326
- const __mfResult0 = CommandContext.Provider({ get value() {
327
- return ctx;
328
- }, children: () => (() => {
329
- const __el0 = __element("div");
330
- {
331
- const __v = rootId;
332
- if (__v != null && __v !== false)
333
- __el0.setAttribute("id", __v === true ? "" : __v);
334
- }
335
- __attr(__el0, "class", () => cn(__props.classes?.root));
336
- __enterChildren(__el0);
337
- __append(__el0, __child(() => __props.children));
338
- __exitChildren();
339
- return __el0;
340
- })() });
341
- __flushMountFrame();
342
- return __mfResult0;
343
- } catch (__mfErr) {
344
- __discardMountFrame(__mfDepth);
345
- throw __mfErr;
346
- }
347
- }
348
- var ComposedCommand = Object.assign(ComposedCommandRoot, {
349
- Input: CommandInput,
350
- List: CommandList,
351
- Empty: CommandEmpty,
352
- Item: CommandItem,
353
- Group: CommandGroup,
354
- Separator: CommandSeparator
355
- });
356
-
357
- export { ComposedCommand };
@@ -1,30 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-q7xbcj9q.js";
4
-
5
- // src/textarea/textarea-composed.tsx
6
- import { computed } from "@vertz/ui";
7
- import { __attr, __discardMountFrame, __element, __flushMountFrame, __pushMountFrame, __spread } from "@vertz/ui/internals";
8
- function ComposedTextareaRoot(__props) {
9
- const { classes: __$drop_0, className: __$drop_1, class: __$drop_2, value: __$drop_3, ...props } = __props;
10
- const __mfDepth = __pushMountFrame();
11
- try {
12
- const el = computed(() => (() => {
13
- const __el0 = __element("textarea");
14
- __attr(__el0, "class", () => cn(__props.classes?.base, __props.className ?? __props.class));
15
- __spread(__el0, props);
16
- return __el0;
17
- })());
18
- if (__props.value !== undefined)
19
- el.value.value = __props.value;
20
- const __mfResult0 = el.value;
21
- __flushMountFrame();
22
- return __mfResult0;
23
- } catch (__mfErr) {
24
- __discardMountFrame(__mfDepth);
25
- throw __mfErr;
26
- }
27
- }
28
- var ComposedTextarea = ComposedTextareaRoot;
29
-
30
- export { ComposedTextarea };