@vertz/ui-primitives 0.2.41 → 0.2.43
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-06m8prfg.js +52 -0
- package/dist/shared/chunk-0n9jj8xr.js +24 -0
- package/dist/shared/chunk-1ben27xq.js +317 -0
- package/dist/shared/chunk-1j2mj0sa.js +45 -0
- package/dist/shared/chunk-250hj18f.js +243 -0
- package/dist/shared/chunk-2h4m9c71.js +38 -0
- package/dist/shared/chunk-2sbx20hv.js +128 -0
- package/dist/shared/chunk-2ye674gr.js +70 -0
- package/dist/shared/chunk-34d8385y.js +15 -0
- package/dist/shared/chunk-4d7bm8h0.js +113 -0
- package/dist/shared/chunk-4zjgxr7x.js +157 -0
- package/dist/shared/chunk-5c150wvr.js +140 -0
- package/dist/shared/chunk-5gycdypd.js +58 -0
- package/dist/shared/chunk-6mm7fhp8.js +105 -0
- package/dist/shared/chunk-6zmnqvh6.js +109 -0
- package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
- package/dist/shared/chunk-7pbff2hg.js +118 -0
- package/dist/shared/chunk-7zpjshwz.js +194 -0
- package/dist/shared/chunk-993ff51d.js +155 -0
- package/dist/shared/chunk-9pdt5aw7.js +24 -0
- package/dist/shared/chunk-a71m4xkv.js +106 -0
- package/dist/shared/chunk-aj8m39pk.js +127 -0
- package/dist/shared/chunk-ajawpc05.js +305 -0
- package/dist/shared/chunk-b7mzwqhj.js +125 -0
- package/dist/shared/chunk-bb887de4.js +200 -0
- package/dist/shared/chunk-bfsmbrxc.js +111 -0
- package/dist/shared/chunk-c2f63m5n.js +56 -0
- package/dist/shared/chunk-c5r3s5km.js +263 -0
- package/dist/shared/chunk-caba5bhd.js +427 -0
- package/dist/shared/chunk-crym07yc.js +264 -0
- package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
- package/dist/shared/chunk-d6rtejz3.js +128 -0
- package/dist/shared/chunk-dvaf0bmq.js +140 -0
- package/dist/shared/chunk-dwkv9ya6.js +22 -0
- package/dist/shared/chunk-e0ckxrjg.js +41 -0
- package/dist/shared/chunk-ennxcymj.js +225 -0
- package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
- package/dist/shared/chunk-f0v1gs5e.js +52 -0
- package/dist/shared/chunk-f86rsf84.js +231 -0
- package/dist/shared/{chunk-3sahbk4d.js → chunk-fdse46x5.js} +6 -1
- package/dist/shared/chunk-gj4hrssn.js +135 -0
- package/dist/shared/chunk-gyvq4gk9.js +24 -0
- package/dist/shared/chunk-hbnps9sq.js +229 -0
- package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
- package/dist/shared/chunk-hgnkd4he.js +256 -0
- package/dist/shared/chunk-hpcyffm7.js +185 -0
- package/dist/shared/chunk-hpmvwx0h.js +99 -0
- package/dist/shared/chunk-hz0e504p.js +69 -0
- package/dist/shared/chunk-hzk4wfq9.js +43 -0
- package/dist/shared/chunk-j7znzkpa.js +48 -0
- package/dist/shared/chunk-j9kxgrnn.js +167 -0
- package/dist/shared/chunk-jetwnv0w.js +130 -0
- package/dist/shared/chunk-jjdg26c1.js +155 -0
- package/dist/shared/chunk-k0m4yh86.js +123 -0
- package/dist/shared/chunk-k43q9cjr.js +82 -0
- package/dist/shared/chunk-k9k8tbr5.js +119 -0
- package/dist/shared/chunk-meaj7br1.js +232 -0
- package/dist/shared/chunk-mgj0n08k.js +34 -0
- package/dist/shared/chunk-mjz4rp6c.js +46 -0
- package/dist/shared/chunk-n4rr5gme.js +239 -0
- package/dist/shared/chunk-nk55etpp.js +65 -0
- package/dist/shared/chunk-nkh1ks3k.js +264 -0
- package/dist/shared/chunk-pgvpvbpe.js +26 -0
- package/dist/shared/chunk-pma8gnv7.js +178 -0
- package/dist/shared/chunk-q7xv6xze.js +131 -0
- package/dist/shared/chunk-qey801nq.js +22 -0
- package/dist/shared/chunk-s6b4c3tj.js +58 -0
- package/dist/shared/chunk-sq27a4h0.js +36 -0
- package/dist/shared/chunk-taa5pj15.js +103 -0
- package/dist/shared/chunk-tc5rpvyx.js +127 -0
- package/dist/shared/chunk-tescm0b3.js +192 -0
- package/dist/shared/chunk-tkftdwnq.js +71 -0
- package/dist/shared/chunk-tqhnjcfp.js +116 -0
- package/dist/shared/chunk-vfknb5ht.js +183 -0
- package/dist/shared/chunk-vsc369w3.js +185 -0
- package/dist/shared/chunk-whq9s8v5.js +301 -0
- package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
- package/dist/shared/chunk-yzbmkx4r.js +155 -0
- package/dist/shared/chunk-zaen0ajc.js +347 -0
- package/dist/src/accordion/accordion-composed.js +1 -1
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/avatar/avatar-composed.js +1 -1
- package/dist/src/badge/badge-composed.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
- package/dist/src/button/button-composed.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar-composed.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.js +1 -1
- package/dist/src/carousel/carousel-composed.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible-composed.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox-composed.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.js +1 -1
- package/dist/src/context-menu/context-menu-composed.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.js +1 -1
- package/dist/src/dialog/dialog-stack-parts.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.js +1 -1
- package/dist/src/form-group/form-group-composed.js +1 -1
- package/dist/src/hover-card/hover-card-composed.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/input/input-composed.js +1 -1
- package/dist/src/label/label-composed.js +1 -1
- package/dist/src/list/list-composed.js +1 -1
- package/dist/src/menu/menu-composed.js +1 -1
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.js +1 -1
- package/dist/src/popover/popover-composed.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio-composed.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.js +1 -1
- package/dist/src/sheet/sheet-composed.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/skeleton/skeleton-composed.js +1 -1
- package/dist/src/slider/slider-composed.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch-composed.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/table/table-composed.js +1 -1
- package/dist/src/tabs/tabs-composed.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.js +1 -1
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group-composed.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-144kbnmx.js +0 -95
- package/dist/shared/chunk-1ewxfgsa.js +0 -167
- package/dist/shared/chunk-1hm0mbke.js +0 -258
- package/dist/shared/chunk-22rt6ws9.js +0 -69
- package/dist/shared/chunk-2ssqz188.js +0 -162
- package/dist/shared/chunk-33he7ay9.js +0 -218
- package/dist/shared/chunk-3jack97k.js +0 -509
- package/dist/shared/chunk-75pegjs7.js +0 -26
- package/dist/shared/chunk-862x7dja.js +0 -398
- package/dist/shared/chunk-8pk1pn5h.js +0 -215
- package/dist/shared/chunk-8t0nm721.js +0 -152
- package/dist/shared/chunk-94twh4s4.js +0 -28
- package/dist/shared/chunk-9yb26c0w.js +0 -232
- package/dist/shared/chunk-a82r2pnq.js +0 -67
- package/dist/shared/chunk-axpbdpgx.js +0 -177
- package/dist/shared/chunk-b3j6mym6.js +0 -203
- package/dist/shared/chunk-b4zzg457.js +0 -410
- package/dist/shared/chunk-b9qxfcsy.js +0 -60
- package/dist/shared/chunk-bc2qqkhr.js +0 -194
- package/dist/shared/chunk-bv12nkdm.js +0 -149
- package/dist/shared/chunk-bvxc1ww4.js +0 -164
- package/dist/shared/chunk-czv0kqj4.js +0 -107
- package/dist/shared/chunk-d83ag07h.js +0 -189
- package/dist/shared/chunk-de18ashk.js +0 -134
- package/dist/shared/chunk-dvk4h36t.js +0 -140
- package/dist/shared/chunk-dxvnerw2.js +0 -353
- package/dist/shared/chunk-e399pzdq.js +0 -241
- package/dist/shared/chunk-e4qha9as.js +0 -180
- package/dist/shared/chunk-eb2d9v6k.js +0 -68
- package/dist/shared/chunk-ect26sp5.js +0 -353
- package/dist/shared/chunk-ev367pq3.js +0 -102
- package/dist/shared/chunk-fjykbv0v.js +0 -214
- package/dist/shared/chunk-gdddk6nh.js +0 -96
- package/dist/shared/chunk-ghkw5bjq.js +0 -55
- package/dist/shared/chunk-hfjtkytb.js +0 -310
- package/dist/shared/chunk-hpvjfj0j.js +0 -31
- package/dist/shared/chunk-jpyjk616.js +0 -52
- package/dist/shared/chunk-k6d53tne.js +0 -206
- package/dist/shared/chunk-knzg86am.js +0 -168
- package/dist/shared/chunk-ktbf6xrt.js +0 -179
- package/dist/shared/chunk-m8y2p66x.js +0 -252
- package/dist/shared/chunk-metxdt5x.js +0 -28
- package/dist/shared/chunk-mgae1d93.js +0 -157
- package/dist/shared/chunk-mtx2cfbx.js +0 -175
- package/dist/shared/chunk-n436p5cb.js +0 -260
- package/dist/shared/chunk-nj420k31.js +0 -54
- package/dist/shared/chunk-nsmvdxgp.js +0 -213
- package/dist/shared/chunk-pcms04vq.js +0 -162
- package/dist/shared/chunk-pqskzq8t.js +0 -79
- package/dist/shared/chunk-pwr60kyd.js +0 -321
- package/dist/shared/chunk-pzknpa1y.js +0 -327
- package/dist/shared/chunk-q77y3rg4.js +0 -189
- package/dist/shared/chunk-qhnany7w.js +0 -179
- package/dist/shared/chunk-rdr0rtpr.js +0 -131
- package/dist/shared/chunk-rj52ty6r.js +0 -147
- package/dist/shared/chunk-rnqc7735.js +0 -125
- package/dist/shared/chunk-rtk30950.js +0 -202
- package/dist/shared/chunk-s0xgd8vg.js +0 -266
- package/dist/shared/chunk-s415735j.js +0 -357
- package/dist/shared/chunk-s62e7jf4.js +0 -30
- package/dist/shared/chunk-snd8e6r8.js +0 -418
- package/dist/shared/chunk-spng4yb9.js +0 -73
- package/dist/shared/chunk-t887wwjc.js +0 -168
- package/dist/shared/chunk-tn0m98j8.js +0 -42
- package/dist/shared/chunk-v0b5pkcq.js +0 -30
- package/dist/shared/chunk-v5tj7veh.js +0 -284
- package/dist/shared/chunk-vkscwzpr.js +0 -294
- package/dist/shared/chunk-vv187snj.js +0 -112
- package/dist/shared/chunk-xv4wd0kf.js +0 -293
- package/dist/shared/chunk-y1hpsqzy.js +0 -185
- package/dist/shared/chunk-yfzddvxc.js +0 -71
- package/dist/shared/chunk-yzgzx2dh.js +0 -311
- package/dist/shared/chunk-z5j7ztf2.js +0 -467
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createDismiss
|
|
3
|
-
} from "./chunk-a6wp8c32.js";
|
|
4
|
-
import {
|
|
5
|
-
cn
|
|
6
|
-
} from "./chunk-q7xbcj9q.js";
|
|
7
|
-
import {
|
|
8
|
-
createFloatingPosition
|
|
9
|
-
} from "./chunk-vef3sepw.js";
|
|
10
|
-
import {
|
|
11
|
-
linkedIds,
|
|
12
|
-
uniqueId
|
|
13
|
-
} from "./chunk-8y1jf6xr.js";
|
|
14
|
-
import {
|
|
15
|
-
Keys,
|
|
16
|
-
isKey
|
|
17
|
-
} from "./chunk-7867pr13.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 };
|