@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.
- package/dist/shared/{chunk-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
- package/dist/shared/chunk-1dx23qnr.js +232 -0
- package/dist/shared/chunk-1hm0mbke.js +258 -0
- package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
- package/dist/shared/chunk-3jack97k.js +509 -0
- package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
- package/dist/shared/chunk-4z006v1j.js +467 -0
- package/dist/shared/{chunk-b25npqer.js → chunk-585ysr70.js} +1 -1
- package/dist/shared/chunk-5964gmv0.js +416 -0
- package/dist/shared/chunk-75pegjs7.js +26 -0
- package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
- package/dist/shared/chunk-7wem1bhb.js +252 -0
- package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
- package/dist/shared/chunk-8t0nm721.js +152 -0
- package/dist/shared/chunk-94twh4s4.js +28 -0
- package/dist/shared/chunk-98y1sw9y.js +398 -0
- package/dist/shared/chunk-9eedsnnk.js +164 -0
- package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
- package/dist/shared/{chunk-4894pmy6.js → chunk-9ydd4pn3.js} +6 -1
- package/dist/shared/chunk-aa3w85hn.js +321 -0
- package/dist/shared/chunk-axpbdpgx.js +177 -0
- package/dist/shared/chunk-b4zzg457.js +410 -0
- package/dist/shared/chunk-bc2qqkhr.js +194 -0
- package/dist/shared/chunk-brk0drrk.js +202 -0
- package/dist/shared/chunk-czv0kqj4.js +107 -0
- package/dist/shared/chunk-d83ag07h.js +189 -0
- package/dist/shared/{chunk-3kwh27dv.js → chunk-de18ashk.js} +0 -1
- package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
- package/dist/shared/chunk-e6660g7e.js +179 -0
- package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
- package/dist/shared/chunk-ev367pq3.js +102 -0
- package/dist/shared/chunk-fjykbv0v.js +214 -0
- package/dist/shared/chunk-ghkw5bjq.js +55 -0
- package/dist/shared/chunk-gqb1n1hj.js +60 -0
- package/dist/shared/chunk-hfjtkytb.js +310 -0
- package/dist/shared/chunk-hpvjfj0j.js +31 -0
- package/dist/shared/chunk-hxmxvp56.js +67 -0
- package/dist/shared/chunk-j9m2f0rd.js +162 -0
- package/dist/shared/chunk-jpyjk616.js +52 -0
- package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
- package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
- package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
- package/dist/shared/chunk-metxdt5x.js +28 -0
- package/dist/shared/chunk-mhn2aazf.js +353 -0
- package/dist/shared/chunk-mtx2cfbx.js +175 -0
- package/dist/shared/chunk-nsmvdxgp.js +213 -0
- package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
- package/dist/shared/chunk-pzknpa1y.js +327 -0
- package/dist/shared/chunk-q1ff3xp3.js +95 -0
- package/dist/shared/chunk-q7xbcj9q.js +7 -0
- package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
- package/dist/shared/chunk-qrm43tr3.js +357 -0
- package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
- package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
- package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
- package/dist/shared/chunk-r3ngaa64.js +418 -0
- package/dist/shared/chunk-r3pffzss.js +13 -0
- package/dist/shared/chunk-rrt62bp0.js +353 -0
- package/dist/shared/chunk-s24gkmna.js +131 -0
- package/dist/shared/chunk-s62e7jf4.js +30 -0
- package/dist/shared/chunk-spng4yb9.js +73 -0
- package/dist/shared/chunk-v0b5pkcq.js +30 -0
- package/dist/shared/chunk-v11kd39k.js +162 -0
- package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
- package/dist/shared/chunk-vkscwzpr.js +294 -0
- package/dist/shared/chunk-vv187snj.js +112 -0
- package/dist/shared/chunk-wqsek87j.js +311 -0
- package/dist/shared/chunk-wtkxz2te.js +157 -0
- package/dist/shared/chunk-y1hpsqzy.js +185 -0
- package/dist/shared/chunk-yfzddvxc.js +71 -0
- package/dist/src/accordion/accordion-composed.d.ts +30 -0
- package/dist/src/accordion/accordion-composed.js +6 -0
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.d.ts +26 -0
- package/dist/src/alert/alert-composed.js +6 -0
- package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
- package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
- package/dist/src/avatar/avatar-composed.d.ts +33 -0
- package/dist/src/avatar/avatar-composed.js +6 -0
- package/dist/src/badge/badge-composed.d.ts +33 -0
- package/dist/src/badge/badge-composed.js +6 -0
- package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
- package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
- package/dist/src/button/button-composed.d.ts +34 -0
- package/dist/src/button/button-composed.js +6 -0
- package/dist/src/calendar/calendar-composed.d.ts +42 -0
- package/dist/src/calendar/calendar-composed.js +6 -0
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.d.ts +34 -0
- package/dist/src/card/card-composed.js +6 -0
- package/dist/src/carousel/carousel-composed.d.ts +32 -0
- package/dist/src/carousel/carousel-composed.js +6 -0
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
- package/dist/src/checkbox/checkbox-composed.js +6 -0
- package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
- package/dist/src/collapsible/collapsible-composed.js +6 -0
- package/dist/src/combobox/combobox-composed.d.ts +30 -0
- package/dist/src/combobox/combobox-composed.js +6 -0
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.d.ts +67 -0
- package/dist/src/command/command-composed.js +6 -0
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.d.ts +38 -0
- package/dist/src/composed/with-styles.js +6 -0
- package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
- package/dist/src/context-menu/context-menu-composed.js +6 -0
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
- package/dist/src/date-picker/date-picker-composed.js +6 -0
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.d.ts +36 -0
- package/dist/src/dialog/dialog-composed.js +6 -0
- package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
- package/dist/src/dialog/dialog-stack-parts.js +18 -0
- package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
- package/dist/src/empty-state/empty-state-composed.js +6 -0
- package/dist/src/form-group/form-group-composed.d.ts +24 -0
- package/dist/src/form-group/form-group-composed.js +6 -0
- package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
- package/dist/src/hover-card/hover-card-composed.js +6 -0
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/index.d.ts +1312 -812
- package/dist/src/index.js +79 -6566
- package/dist/src/input/input-composed.d.ts +35 -0
- package/dist/src/input/input-composed.js +6 -0
- package/dist/src/label/label-composed.d.ts +32 -0
- package/dist/src/label/label-composed.js +6 -0
- package/dist/src/list/list-composed.d.ts +34 -0
- package/dist/src/list/list-composed.js +6 -0
- package/dist/src/menu/menu-composed.d.ts +51 -0
- package/dist/src/menu/menu-composed.js +6 -0
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.d.ts +56 -0
- package/dist/src/menubar/menubar-composed.js +6 -0
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
- package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.d.ts +30 -0
- package/dist/src/pagination/pagination-composed.js +6 -0
- package/dist/src/popover/popover-composed.d.ts +36 -0
- package/dist/src/popover/popover-composed.js +6 -0
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.d.ts +17 -0
- package/dist/src/progress/progress-composed.js +6 -0
- package/dist/src/radio/radio-composed.d.ts +24 -0
- package/dist/src/radio/radio-composed.js +6 -0
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
- package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
- package/dist/src/scroll-area/scroll-area-composed.js +6 -0
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.d.ts +53 -0
- package/dist/src/select/select-composed.js +6 -0
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.d.ts +32 -0
- package/dist/src/separator/separator-composed.js +6 -0
- package/dist/src/sheet/sheet-composed.d.ts +34 -0
- package/dist/src/sheet/sheet-composed.js +6 -0
- package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
- package/dist/src/skeleton/skeleton-composed.js +6 -0
- package/dist/src/slider/slider-composed.d.ts +22 -0
- package/dist/src/slider/slider-composed.js +6 -0
- package/dist/src/switch/switch-composed.d.ts +17 -0
- package/dist/src/switch/switch-composed.js +6 -0
- package/dist/src/table/table-composed.d.ts +34 -0
- package/dist/src/table/table-composed.js +6 -0
- package/dist/src/tabs/tabs-composed.d.ts +33 -0
- package/dist/src/tabs/tabs-composed.js +6 -0
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.d.ts +35 -0
- package/dist/src/textarea/textarea-composed.js +6 -0
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.d.ts +16 -0
- package/dist/src/toggle/toggle-composed.js +6 -0
- package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
- package/dist/src/toggle-group/toggle-group-composed.js +6 -0
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
- package/dist/src/tooltip/tooltip-composed.js +6 -0
- package/dist/src/tooltip/tooltip.js +1 -1
- package/dist/src/utils.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-56reyd5r.js +0 -64
- package/dist/shared/chunk-mgr904ap.js +0 -370
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
isKey
|
|
7
|
+
} from "./chunk-7867pr13.js";
|
|
8
|
+
import {
|
|
9
|
+
uniqueId
|
|
10
|
+
} from "./chunk-8y1jf6xr.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 };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-a6wp8c32.js";
|
|
4
4
|
import {
|
|
5
5
|
createFloatingPosition
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-vef3sepw.js";
|
|
7
7
|
import {
|
|
8
8
|
Keys,
|
|
9
9
|
handleListNavigation,
|
|
@@ -81,7 +81,7 @@ function MenuRoot(options = {}) {
|
|
|
81
81
|
for (let i = 0;i < items.length; i++) {
|
|
82
82
|
items[i]?.setAttribute("tabindex", i === index ? "0" : "-1");
|
|
83
83
|
}
|
|
84
|
-
}, createItem = function(value, label
|
|
84
|
+
}, createItem = function(value, label) {
|
|
85
85
|
const item = (() => {
|
|
86
86
|
const __el2 = __element("div");
|
|
87
87
|
__el2.setAttribute("role", "menuitem");
|
|
@@ -101,7 +101,6 @@ function MenuRoot(options = {}) {
|
|
|
101
101
|
return __el2;
|
|
102
102
|
})();
|
|
103
103
|
items.push(item);
|
|
104
|
-
(parent ?? content).appendChild(item);
|
|
105
104
|
return item;
|
|
106
105
|
}, Item = function(value, label) {
|
|
107
106
|
return createItem(value, label);
|
|
@@ -116,21 +115,19 @@ function MenuRoot(options = {}) {
|
|
|
116
115
|
}
|
|
117
116
|
return __el3;
|
|
118
117
|
})();
|
|
119
|
-
content.appendChild(el);
|
|
120
118
|
return {
|
|
121
119
|
el,
|
|
122
|
-
Item: (value, itemLabel) => createItem(value, itemLabel
|
|
120
|
+
Item: (value, itemLabel) => createItem(value, itemLabel)
|
|
123
121
|
};
|
|
124
122
|
}, Separator = function() {
|
|
125
|
-
|
|
123
|
+
return (() => {
|
|
126
124
|
const __el4 = __element("hr");
|
|
125
|
+
__el4.setAttribute("data-v-id", "MenuRoot");
|
|
127
126
|
__el4.setAttribute("role", "separator");
|
|
128
127
|
return __el4;
|
|
129
128
|
})();
|
|
130
|
-
content.appendChild(hr);
|
|
131
|
-
return hr;
|
|
132
129
|
}, Label = function(text) {
|
|
133
|
-
|
|
130
|
+
return (() => {
|
|
134
131
|
const __el5 = __element("div");
|
|
135
132
|
__el5.setAttribute("role", "none");
|
|
136
133
|
__enterChildren(__el5);
|
|
@@ -138,8 +135,6 @@ function MenuRoot(options = {}) {
|
|
|
138
135
|
__exitChildren();
|
|
139
136
|
return __el5;
|
|
140
137
|
})();
|
|
141
|
-
content.appendChild(el);
|
|
142
|
-
return el;
|
|
143
138
|
};
|
|
144
139
|
const { onSelect, onOpenChange, positioning, ...attrs } = options;
|
|
145
140
|
const ids = linkedIds("menu");
|