@vertz/ui-primitives 0.2.21 → 0.2.23

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 (97) hide show
  1. package/dist/shared/{chunk-q8dm19a5.js → chunk-2db2dnp3.js} +0 -1
  2. package/dist/shared/chunk-3h1mxp95.js +148 -0
  3. package/dist/shared/chunk-3kwh27dv.js +135 -0
  4. package/dist/shared/chunk-4894pmy6.js +184 -0
  5. package/dist/shared/{chunk-v9qddmh9.js → chunk-56reyd5r.js} +20 -29
  6. package/dist/shared/chunk-67sn29eh.js +125 -0
  7. package/dist/shared/chunk-7cb3z0s8.js +287 -0
  8. package/dist/shared/chunk-8c01c8mb.js +217 -0
  9. package/dist/shared/chunk-99tk72t3.js +69 -0
  10. package/dist/shared/chunk-9gfp3ffv.js +204 -0
  11. package/dist/shared/chunk-b25npqer.js +149 -0
  12. package/dist/shared/chunk-cgb2j94g.js +141 -0
  13. package/dist/shared/chunk-e1jcf22s.js +79 -0
  14. package/dist/shared/chunk-e3h0ddmx.js +168 -0
  15. package/dist/shared/chunk-f2vx4tpw.js +168 -0
  16. package/dist/shared/chunk-h3v10x04.js +271 -0
  17. package/dist/shared/chunk-hdvdfd1c.js +96 -0
  18. package/dist/shared/{chunk-zf0rhm9e.js → chunk-j902w020.js} +1 -1
  19. package/dist/shared/chunk-jdygp28a.js +260 -0
  20. package/dist/shared/chunk-jqre4qtw.js +180 -0
  21. package/dist/shared/{chunk-pvy0tcd7.js → chunk-mgr904ap.js} +75 -35
  22. package/dist/shared/chunk-mr1tb0dp.js +167 -0
  23. package/dist/shared/chunk-nj420k31.js +54 -0
  24. package/dist/shared/chunk-p0x7hgv6.js +181 -0
  25. package/dist/shared/{chunk-gzgyfhz6.js → chunk-pn6shbcs.js} +134 -82
  26. package/dist/shared/chunk-pzx0vpq1.js +223 -0
  27. package/dist/shared/chunk-tn0m98j8.js +42 -0
  28. package/dist/shared/{chunk-g67tnd19.js → chunk-ttb2tt03.js} +49 -29
  29. package/dist/shared/{chunk-vvjyx7fe.js → chunk-vevfhpc9.js} +1 -1
  30. package/dist/shared/chunk-vy874zxe.js +68 -0
  31. package/dist/shared/chunk-ww7k2azn.js +297 -0
  32. package/dist/shared/{chunk-f501vw7e.js → chunk-xa1b96mb.js} +2 -2
  33. package/dist/shared/chunk-xs6gp369.js +245 -0
  34. package/dist/shared/chunk-y4mmmayp.js +206 -0
  35. package/dist/src/accordion/accordion.js +1 -1
  36. package/dist/src/alert-dialog/alert-dialog.js +1 -1
  37. package/dist/src/badge/badge.js +1 -1
  38. package/dist/src/button/button.js +1 -1
  39. package/dist/src/calendar/calendar.js +1 -1
  40. package/dist/src/carousel/carousel.js +1 -1
  41. package/dist/src/checkbox/checkbox.js +1 -1
  42. package/dist/src/collapsible/collapsible.js +1 -1
  43. package/dist/src/combobox/combobox.js +1 -1
  44. package/dist/src/command/command.js +1 -1
  45. package/dist/src/context-menu/context-menu.js +1 -1
  46. package/dist/src/date-picker/date-picker.js +1 -1
  47. package/dist/src/dialog/dialog.js +1 -1
  48. package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
  49. package/dist/src/hover-card/hover-card.js +1 -1
  50. package/dist/src/index.d.ts +281 -106
  51. package/dist/src/index.js +5779 -4266
  52. package/dist/src/menu/menu.js +1 -1
  53. package/dist/src/menubar/menubar.js +1 -1
  54. package/dist/src/navigation-menu/navigation-menu.js +1 -1
  55. package/dist/src/popover/popover.js +1 -1
  56. package/dist/src/progress/progress.js +1 -1
  57. package/dist/src/radio/radio.js +1 -1
  58. package/dist/src/resizable-panel/resizable-panel.js +1 -1
  59. package/dist/src/scroll-area/scroll-area.js +1 -1
  60. package/dist/src/select/select.js +1 -1
  61. package/dist/src/sheet/sheet.js +1 -1
  62. package/dist/src/slider/slider.js +1 -1
  63. package/dist/src/switch/switch.js +1 -1
  64. package/dist/src/tabs/tabs.js +1 -1
  65. package/dist/src/toast/toast.js +1 -1
  66. package/dist/src/toggle/toggle.js +1 -1
  67. package/dist/src/toggle-group/toggle-group.js +1 -1
  68. package/dist/src/tooltip/tooltip.js +1 -1
  69. package/dist/src/utils.d.ts +1 -1
  70. package/dist/src/utils.js +3 -3
  71. package/package.json +3 -3
  72. package/dist/shared/chunk-0gn67thm.js +0 -88
  73. package/dist/shared/chunk-1dzcjmfq.js +0 -46
  74. package/dist/shared/chunk-1hv9yd28.js +0 -178
  75. package/dist/shared/chunk-2d05qxdw.js +0 -282
  76. package/dist/shared/chunk-4jnweh3m.js +0 -165
  77. package/dist/shared/chunk-90hmpm0w.js +0 -34
  78. package/dist/shared/chunk-ac86qw7a.js +0 -71
  79. package/dist/shared/chunk-b02fkvts.js +0 -128
  80. package/dist/shared/chunk-bsx59bv9.js +0 -61
  81. package/dist/shared/chunk-cm2akzrm.js +0 -161
  82. package/dist/shared/chunk-cvms20w3.js +0 -132
  83. package/dist/shared/chunk-d8n8mggh.js +0 -239
  84. package/dist/shared/chunk-er9625ar.js +0 -204
  85. package/dist/shared/chunk-ewxzhtej.js +0 -117
  86. package/dist/shared/chunk-ey4485fh.js +0 -196
  87. package/dist/shared/chunk-gbxbkmte.js +0 -175
  88. package/dist/shared/chunk-je7tqf67.js +0 -133
  89. package/dist/shared/chunk-kr5qg80z.js +0 -288
  90. package/dist/shared/chunk-kytkmdpc.js +0 -199
  91. package/dist/shared/chunk-q2q20y9a.js +0 -60
  92. package/dist/shared/chunk-q9fgfgh9.js +0 -267
  93. package/dist/shared/chunk-qfk1ycfw.js +0 -142
  94. package/dist/shared/chunk-te4pdqnh.js +0 -219
  95. package/dist/shared/chunk-vm37m55w.js +0 -175
  96. package/dist/shared/chunk-y5vdb6br.js +0 -151
  97. package/dist/shared/chunk-ztvj60xp.js +0 -185
@@ -0,0 +1,297 @@
1
+ import {
2
+ createDismiss
3
+ } from "./chunk-a6wp8c32.js";
4
+ import {
5
+ setRovingTabindex
6
+ } from "./chunk-e2v1c9ex.js";
7
+ import {
8
+ createFloatingPosition
9
+ } from "./chunk-0mcr52hc.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
+ linkedIds
23
+ } from "./chunk-8y1jf6xr.js";
24
+ import {
25
+ applyAttrs
26
+ } from "./chunk-2db2dnp3.js";
27
+
28
+ // src/menubar/menubar.tsx
29
+ import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
30
+ import { signal } from "@vertz/ui";
31
+ function MenubarRoot(options = {}) {
32
+ const __mfDepth = __pushMountFrame();
33
+ try {
34
+ let handleClickOutside = function(event) {
35
+ const target = event.target;
36
+ if (!root.contains(target)) {
37
+ closeAll();
38
+ }
39
+ }, closeAll = function() {
40
+ for (const [, menu] of menus) {
41
+ setExpanded(menu.trigger, false);
42
+ setDataState(menu.trigger, "closed");
43
+ setDataState(menu.content, "closed");
44
+ setHiddenAnimated(menu.content, true);
45
+ }
46
+ state.activeMenu.value = null;
47
+ if (positioning) {
48
+ floatingCleanup?.();
49
+ floatingCleanup = null;
50
+ dismissCleanup?.();
51
+ dismissCleanup = null;
52
+ } else {
53
+ document.removeEventListener("mousedown", handleClickOutside);
54
+ }
55
+ }, openMenu = function(value) {
56
+ const current = state.activeMenu.peek();
57
+ if (current && current !== value) {
58
+ const prev = menus.get(current);
59
+ if (prev) {
60
+ setExpanded(prev.trigger, false);
61
+ setDataState(prev.trigger, "closed");
62
+ setDataState(prev.content, "closed");
63
+ setHiddenAnimated(prev.content, true);
64
+ }
65
+ if (positioning) {
66
+ floatingCleanup?.();
67
+ floatingCleanup = null;
68
+ }
69
+ }
70
+ const menu = menus.get(value);
71
+ if (!menu)
72
+ return;
73
+ state.activeMenu.value = value;
74
+ setExpanded(menu.trigger, true);
75
+ setHidden(menu.content, false);
76
+ setDataState(menu.trigger, "open");
77
+ setDataState(menu.content, "open");
78
+ if (positioning) {
79
+ const result = createFloatingPosition(menu.trigger, menu.content, positioning);
80
+ floatingCleanup = result.cleanup;
81
+ if (!dismissCleanup) {
82
+ dismissCleanup = createDismiss({
83
+ onDismiss: closeAll,
84
+ insideElements: [root],
85
+ escapeKey: false
86
+ });
87
+ }
88
+ } else {
89
+ document.addEventListener("mousedown", handleClickOutside);
90
+ }
91
+ const firstItem = menu.items[0];
92
+ if (firstItem) {
93
+ firstItem.setAttribute("tabindex", "0");
94
+ firstItem.focus();
95
+ }
96
+ }, Menu = function(value, label) {
97
+ const ids = linkedIds("menubar-menu");
98
+ const menuItems = [];
99
+ const trigger = (() => {
100
+ const __el1 = __element("button");
101
+ __el1.setAttribute("type", "button");
102
+ __el1.setAttribute("role", "menuitem");
103
+ {
104
+ const __v = ids.triggerId;
105
+ if (__v != null && __v !== false)
106
+ __el1.setAttribute("id", __v === true ? "" : __v);
107
+ }
108
+ {
109
+ const __v = ids.contentId;
110
+ if (__v != null && __v !== false)
111
+ __el1.setAttribute("aria-controls", __v === true ? "" : __v);
112
+ }
113
+ __el1.setAttribute("aria-haspopup", "menu");
114
+ {
115
+ const __v = value;
116
+ if (__v != null && __v !== false)
117
+ __el1.setAttribute("data-value", __v === true ? "" : __v);
118
+ }
119
+ __el1.setAttribute("aria-expanded", "false");
120
+ __el1.setAttribute("data-state", "closed");
121
+ __on(__el1, "click", () => {
122
+ if (state.activeMenu.peek() === value) {
123
+ closeAll();
124
+ } else {
125
+ openMenu(value);
126
+ }
127
+ });
128
+ __on(__el1, "keydown", (event) => {
129
+ if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
130
+ event.preventDefault();
131
+ openMenu(value);
132
+ }
133
+ });
134
+ __enterChildren(__el1);
135
+ __insert(__el1, label ?? value);
136
+ __exitChildren();
137
+ return __el1;
138
+ })();
139
+ setRovingTabindex(triggers.concat(trigger), triggers.length);
140
+ const content = (() => {
141
+ const __el2 = __element("div");
142
+ __el2.setAttribute("role", "menu");
143
+ {
144
+ const __v = ids.contentId;
145
+ if (__v != null && __v !== false)
146
+ __el2.setAttribute("id", __v === true ? "" : __v);
147
+ }
148
+ __el2.setAttribute("aria-hidden", "true");
149
+ __el2.setAttribute("data-state", "closed");
150
+ {
151
+ const __v = { display: "none" };
152
+ if (__v != null && __v !== false)
153
+ __el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
154
+ }
155
+ __on(__el2, "keydown", (event) => {
156
+ if (isKey(event, Keys.Escape)) {
157
+ event.preventDefault();
158
+ event.stopPropagation();
159
+ closeAll();
160
+ trigger.focus();
161
+ return;
162
+ }
163
+ if (isKey(event, Keys.Enter, Keys.Space)) {
164
+ event.preventDefault();
165
+ const active = document.activeElement;
166
+ const activeItem = menuItems.find((item) => item === active);
167
+ if (activeItem) {
168
+ const val = activeItem.getAttribute("data-value");
169
+ if (val !== null) {
170
+ onSelect?.(val);
171
+ closeAll();
172
+ trigger.focus();
173
+ }
174
+ }
175
+ return;
176
+ }
177
+ if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight)) {
178
+ event.preventDefault();
179
+ const triggerIdx = triggers.indexOf(trigger);
180
+ let nextIdx;
181
+ if (isKey(event, Keys.ArrowRight)) {
182
+ nextIdx = (triggerIdx + 1) % triggers.length;
183
+ } else {
184
+ nextIdx = (triggerIdx - 1 + triggers.length) % triggers.length;
185
+ }
186
+ const nextTrigger = triggers[nextIdx];
187
+ if (nextTrigger) {
188
+ nextTrigger.focus();
189
+ const nextValue = nextTrigger.getAttribute("data-value");
190
+ if (nextValue)
191
+ openMenu(nextValue);
192
+ }
193
+ return;
194
+ }
195
+ handleListNavigation(event, menuItems, { orientation: "vertical" });
196
+ });
197
+ return __el2;
198
+ })();
199
+ function createItem(val, itemLabel, parent) {
200
+ const item = (() => {
201
+ const __el3 = __element("div");
202
+ __el3.setAttribute("role", "menuitem");
203
+ {
204
+ const __v = val;
205
+ if (__v != null && __v !== false)
206
+ __el3.setAttribute("data-value", __v === true ? "" : __v);
207
+ }
208
+ __el3.setAttribute("tabindex", "-1");
209
+ __on(__el3, "click", () => {
210
+ onSelect?.(val);
211
+ closeAll();
212
+ trigger.focus();
213
+ });
214
+ __enterChildren(__el3);
215
+ __insert(__el3, itemLabel ?? val);
216
+ __exitChildren();
217
+ return __el3;
218
+ })();
219
+ menuItems.push(item);
220
+ (parent ?? content).appendChild(item);
221
+ return item;
222
+ }
223
+ function Item(val, itemLabel) {
224
+ return createItem(val, itemLabel);
225
+ }
226
+ function Group(groupLabel) {
227
+ const el = (() => {
228
+ const __el4 = __element("div");
229
+ __el4.setAttribute("role", "group");
230
+ {
231
+ const __v = groupLabel;
232
+ if (__v != null && __v !== false)
233
+ __el4.setAttribute("aria-label", __v === true ? "" : __v);
234
+ }
235
+ return __el4;
236
+ })();
237
+ content.appendChild(el);
238
+ return {
239
+ el,
240
+ Item: (val, l) => createItem(val, l, el)
241
+ };
242
+ }
243
+ function Separator() {
244
+ const hr = (() => {
245
+ const __el5 = __element("hr");
246
+ __el5.setAttribute("role", "separator");
247
+ return __el5;
248
+ })();
249
+ content.appendChild(hr);
250
+ return hr;
251
+ }
252
+ triggers.push(trigger);
253
+ setRovingTabindex(triggers, 0);
254
+ menus.set(value, { trigger, content, items: menuItems });
255
+ root.appendChild(trigger);
256
+ return { trigger, content, Item, Group, Separator };
257
+ };
258
+ const { onSelect, positioning, ...attrs } = options;
259
+ const state = { activeMenu: signal(null) };
260
+ const triggers = [];
261
+ const menus = new Map;
262
+ let floatingCleanup = null;
263
+ let dismissCleanup = null;
264
+ const root = (() => {
265
+ const __el0 = __element("div");
266
+ __el0.setAttribute("role", "menubar");
267
+ __on(__el0, "keydown", (event) => {
268
+ if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.Home, Keys.End)) {
269
+ const focused = document.activeElement;
270
+ const triggerIndex = triggers.indexOf(focused);
271
+ if (triggerIndex >= 0) {
272
+ const result = handleListNavigation(event, triggers, { orientation: "horizontal" });
273
+ if (result && state.activeMenu.peek()) {
274
+ const newTrigger = result;
275
+ const menuValue = newTrigger.getAttribute("data-value");
276
+ if (menuValue)
277
+ openMenu(menuValue);
278
+ }
279
+ }
280
+ }
281
+ });
282
+ return __el0;
283
+ })();
284
+ applyAttrs(root, attrs);
285
+ const __mfResult0 = { root, state, Menu };
286
+ __flushMountFrame();
287
+ return __mfResult0;
288
+ } catch (__mfErr) {
289
+ __discardMountFrame(__mfDepth);
290
+ throw __mfErr;
291
+ }
292
+ }
293
+ var Menubar = {
294
+ Root: MenubarRoot
295
+ };
296
+
297
+ export { Menubar };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Calendar
3
- } from "./chunk-pvy0tcd7.js";
3
+ } from "./chunk-mgr904ap.js";
4
4
  import {
5
5
  Popover
6
- } from "./chunk-qfk1ycfw.js";
6
+ } from "./chunk-b25npqer.js";
7
7
 
8
8
  // src/date-picker/date-picker.ts
9
9
  import { signal } from "@vertz/ui";
@@ -0,0 +1,245 @@
1
+ import {
2
+ Keys,
3
+ isKey
4
+ } from "./chunk-7867pr13.js";
5
+ import {
6
+ setHidden
7
+ } from "./chunk-vevfhpc9.js";
8
+ import {
9
+ uniqueId
10
+ } from "./chunk-8y1jf6xr.js";
11
+ import {
12
+ applyAttrs
13
+ } from "./chunk-2db2dnp3.js";
14
+
15
+ // src/command/command.tsx
16
+ import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
17
+ import { signal } from "@vertz/ui";
18
+ function CommandRoot(options = {}) {
19
+ const __mfDepth = __pushMountFrame();
20
+ try {
21
+ let getVisibleItems = function() {
22
+ return allItems.filter((item) => item.getAttribute("aria-hidden") !== "true");
23
+ }, updateActiveItem = function() {
24
+ const visible = getVisibleItems();
25
+ const activeIdx = state.activeIndex.peek();
26
+ for (const item of allItems) {
27
+ item.setAttribute("aria-selected", "false");
28
+ }
29
+ if (visible.length > 0 && activeIdx >= 0 && activeIdx < visible.length) {
30
+ visible[activeIdx]?.setAttribute("aria-selected", "true");
31
+ }
32
+ }, runFilter = function() {
33
+ const search = state.inputValue.peek();
34
+ let visibleCount = 0;
35
+ for (const item of allItems) {
36
+ const value = item.getAttribute("data-value") ?? "";
37
+ const text = item.textContent ?? "";
38
+ const keywords = item.getAttribute("data-keywords") ?? "";
39
+ const searchable = `${value} ${text} ${keywords}`;
40
+ const matches = search === "" || filterFn(searchable, search);
41
+ setHidden(item, !matches);
42
+ if (matches)
43
+ visibleCount++;
44
+ }
45
+ for (const [groupEl, group] of groups) {
46
+ const hasVisible = group.items.some((item) => item.getAttribute("aria-hidden") !== "true");
47
+ setHidden(group.heading, !hasVisible);
48
+ if (!hasVisible) {
49
+ groupEl.style.display = "none";
50
+ } else {
51
+ groupEl.style.display = "";
52
+ }
53
+ }
54
+ setHidden(empty, visibleCount > 0);
55
+ state.activeIndex.value = 0;
56
+ updateActiveItem();
57
+ }, createItem = function(value, label, keywords, parent) {
58
+ const item = (() => {
59
+ const __el4 = __element("div");
60
+ __el4.setAttribute("role", "option");
61
+ {
62
+ const __v = value;
63
+ if (__v != null && __v !== false)
64
+ __el4.setAttribute("data-value", __v === true ? "" : __v);
65
+ }
66
+ __el4.setAttribute("aria-selected", "false");
67
+ {
68
+ const __v = keywords && keywords.length > 0 ? keywords.join(" ") : undefined;
69
+ if (__v != null && __v !== false)
70
+ __el4.setAttribute("data-keywords", __v === true ? "" : __v);
71
+ }
72
+ __on(__el4, "click", () => {
73
+ onSelect?.(value);
74
+ });
75
+ __enterChildren(__el4);
76
+ __insert(__el4, label ?? value);
77
+ __exitChildren();
78
+ return __el4;
79
+ })();
80
+ allItems.push(item);
81
+ (parent ?? list).appendChild(item);
82
+ updateActiveItem();
83
+ return item;
84
+ }, Item = function(value, label, keywords) {
85
+ return createItem(value, label, keywords);
86
+ }, Group = function(label) {
87
+ const headingId = uniqueId("command-group");
88
+ const heading = (() => {
89
+ const __el5 = __element("div");
90
+ {
91
+ const __v = headingId;
92
+ if (__v != null && __v !== false)
93
+ __el5.setAttribute("id", __v === true ? "" : __v);
94
+ }
95
+ __enterChildren(__el5);
96
+ __insert(__el5, label);
97
+ __exitChildren();
98
+ return __el5;
99
+ })();
100
+ const el = (() => {
101
+ const __el6 = __element("div");
102
+ __el6.setAttribute("role", "group");
103
+ {
104
+ const __v = headingId;
105
+ if (__v != null && __v !== false)
106
+ __el6.setAttribute("aria-labelledby", __v === true ? "" : __v);
107
+ }
108
+ __enterChildren(__el6);
109
+ __insert(__el6, heading);
110
+ __exitChildren();
111
+ return __el6;
112
+ })();
113
+ const groupItems = [];
114
+ groups.set(el, { heading, items: groupItems });
115
+ list.appendChild(el);
116
+ return {
117
+ el,
118
+ Item: (value, itemLabel, keywords) => {
119
+ const item = createItem(value, itemLabel, keywords, el);
120
+ groupItems.push(item);
121
+ return item;
122
+ }
123
+ };
124
+ }, Separator = function() {
125
+ const hr = (() => {
126
+ const __el7 = __element("hr");
127
+ __el7.setAttribute("role", "separator");
128
+ return __el7;
129
+ })();
130
+ list.appendChild(hr);
131
+ return hr;
132
+ };
133
+ const { filter: customFilter, onSelect, onInputChange, placeholder, ...attrs } = options;
134
+ const listId = uniqueId("command-list");
135
+ const state = {
136
+ inputValue: signal(""),
137
+ activeIndex: signal(0)
138
+ };
139
+ const allItems = [];
140
+ const groups = new Map;
141
+ const defaultFilter = (value, search) => {
142
+ return value.toLowerCase().includes(search.toLowerCase());
143
+ };
144
+ const filterFn = customFilter ?? defaultFilter;
145
+ const input = (() => {
146
+ const __el0 = __element("input");
147
+ __el0.setAttribute("type", "text");
148
+ __el0.setAttribute("role", "combobox");
149
+ __el0.setAttribute("aria-autocomplete", "list");
150
+ __el0.setAttribute("aria-expanded", "true");
151
+ {
152
+ const __v = listId;
153
+ if (__v != null && __v !== false)
154
+ __el0.setAttribute("aria-controls", __v === true ? "" : __v);
155
+ }
156
+ {
157
+ const __v = placeholder;
158
+ if (__v != null && __v !== false)
159
+ __el0.setAttribute("placeholder", __v === true ? "" : __v);
160
+ }
161
+ __on(__el0, "input", () => {
162
+ state.inputValue.value = input.value;
163
+ onInputChange?.(input.value);
164
+ runFilter();
165
+ });
166
+ __on(__el0, "keydown", (event) => {
167
+ const visible = getVisibleItems();
168
+ if (isKey(event, Keys.ArrowDown)) {
169
+ event.preventDefault();
170
+ const next = Math.min(state.activeIndex.peek() + 1, visible.length - 1);
171
+ state.activeIndex.value = next;
172
+ updateActiveItem();
173
+ return;
174
+ }
175
+ if (isKey(event, Keys.ArrowUp)) {
176
+ event.preventDefault();
177
+ const prev = Math.max(state.activeIndex.peek() - 1, 0);
178
+ state.activeIndex.value = prev;
179
+ updateActiveItem();
180
+ return;
181
+ }
182
+ if (isKey(event, Keys.Enter)) {
183
+ event.preventDefault();
184
+ const active = visible[state.activeIndex.peek()];
185
+ if (active) {
186
+ const val = active.getAttribute("data-value");
187
+ if (val !== null) {
188
+ onSelect?.(val);
189
+ }
190
+ }
191
+ return;
192
+ }
193
+ if (isKey(event, Keys.Escape)) {
194
+ event.preventDefault();
195
+ input.value = "";
196
+ state.inputValue.value = "";
197
+ onInputChange?.("");
198
+ runFilter();
199
+ }
200
+ });
201
+ return __el0;
202
+ })();
203
+ const list = (() => {
204
+ const __el1 = __element("div");
205
+ __el1.setAttribute("role", "listbox");
206
+ {
207
+ const __v = listId;
208
+ if (__v != null && __v !== false)
209
+ __el1.setAttribute("id", __v === true ? "" : __v);
210
+ }
211
+ return __el1;
212
+ })();
213
+ const empty = (() => {
214
+ const __el2 = __element("div");
215
+ __el2.setAttribute("aria-hidden", "true");
216
+ {
217
+ const __v = { display: "none" };
218
+ if (__v != null && __v !== false)
219
+ __el2.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
220
+ }
221
+ return __el2;
222
+ })();
223
+ const root = (() => {
224
+ const __el3 = __element("div");
225
+ __enterChildren(__el3);
226
+ __insert(__el3, input);
227
+ __insert(__el3, list);
228
+ __insert(__el3, empty);
229
+ __exitChildren();
230
+ return __el3;
231
+ })();
232
+ applyAttrs(root, attrs);
233
+ const __mfResult0 = { root, input, list, empty, state, Item, Group, Separator };
234
+ __flushMountFrame();
235
+ return __mfResult0;
236
+ } catch (__mfErr) {
237
+ __discardMountFrame(__mfDepth);
238
+ throw __mfErr;
239
+ }
240
+ }
241
+ var Command = {
242
+ Root: CommandRoot
243
+ };
244
+
245
+ export { Command };