@vertz/ui-primitives 0.2.22 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/chunk-00fqgnq1.js +218 -0
- package/dist/shared/chunk-1hm0mbke.js +258 -0
- package/dist/shared/chunk-20kwns82.js +293 -0
- package/dist/shared/chunk-3jack97k.js +509 -0
- package/dist/shared/chunk-455p0jbk.js +241 -0
- package/dist/shared/chunk-4gyg71bn.js +178 -0
- package/dist/shared/chunk-4z006v1j.js +467 -0
- package/dist/shared/chunk-585ysr70.js +149 -0
- package/dist/shared/chunk-67sn29eh.js +125 -0
- package/dist/shared/chunk-75pegjs7.js +26 -0
- package/dist/shared/chunk-7a2nqmeh.js +167 -0
- package/dist/shared/chunk-7wem1bhb.js +252 -0
- package/dist/shared/chunk-8evj43jn.js +284 -0
- 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-99tk72t3.js +69 -0
- package/dist/shared/chunk-9eedsnnk.js +164 -0
- package/dist/shared/chunk-9hv3vc72.js +215 -0
- 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-brk0drrk.js +202 -0
- package/dist/shared/chunk-czv0kqj4.js +107 -0
- package/dist/shared/chunk-d83ag07h.js +189 -0
- package/dist/shared/chunk-de18ashk.js +134 -0
- package/dist/shared/chunk-dvk4h36t.js +140 -0
- package/dist/shared/chunk-e1jcf22s.js +79 -0
- package/dist/shared/chunk-e3h0ddmx.js +168 -0
- package/dist/shared/chunk-e6660g7e.js +179 -0
- package/dist/shared/chunk-eq4d9b0w.js +147 -0
- package/dist/shared/chunk-ev367pq3.js +102 -0
- package/dist/shared/chunk-f0wy7k56.js +183 -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-hdvdfd1c.js +96 -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-jdygp28a.js +260 -0
- package/dist/shared/chunk-jpyjk616.js +52 -0
- package/dist/shared/chunk-jqre4qtw.js +180 -0
- package/dist/shared/{chunk-myq79qew.js → chunk-jsa3byag.js} +48 -28
- package/dist/shared/chunk-jzy1bkdk.js +203 -0
- package/dist/shared/chunk-knzg86am.js +168 -0
- package/dist/shared/chunk-kskxxc2q.js +228 -0
- 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-nj420k31.js +54 -0
- package/dist/shared/chunk-nsmvdxgp.js +213 -0
- package/dist/shared/{chunk-w9dag6ce.js → chunk-pdzmg245.js} +133 -85
- 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-qhnany7w.js +179 -0
- package/dist/shared/chunk-qrm43tr3.js +357 -0
- package/dist/shared/{chunk-jda3v59q.js → chunk-qsp7sfhp.js} +2 -2
- package/dist/shared/{chunk-dhyr0s9n.js → chunk-qwqnjjg8.js} +1 -1
- package/dist/shared/chunk-r0rz7z03.js +266 -0
- 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-tn0m98j8.js +42 -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-vy874zxe.js +68 -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-y4mmmayp.js +206 -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/alert-dialog/alert-dialog.js +1 -1
- 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/badge/badge.js +1 -1
- 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/button/button.js +1 -1
- 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/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
- package/dist/src/collapsible/collapsible-composed.js +6 -0
- package/dist/src/collapsible/collapsible.js +1 -1
- 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/dialog/dialog.js +1 -1
- 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 +1284 -804
- package/dist/src/index.js +78 -5281
- 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/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/progress/progress.js +1 -1
- 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/sheet/sheet.js +1 -1
- 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/slider/slider.js +1 -1
- package/dist/src/switch/switch-composed.d.ts +17 -0
- package/dist/src/switch/switch-composed.js +6 -0
- package/dist/src/switch/switch.js +1 -1
- 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/toggle.js +1 -1
- 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-07yzsaaw.js +0 -165
- package/dist/shared/chunk-279bzynx.js +0 -132
- package/dist/shared/chunk-27xs9apd.js +0 -288
- package/dist/shared/chunk-2k8gxzdf.js +0 -151
- package/dist/shared/chunk-3rp73gkd.js +0 -175
- package/dist/shared/chunk-4rf1m34c.js +0 -267
- package/dist/shared/chunk-56reyd5r.js +0 -64
- package/dist/shared/chunk-7bxsf80c.js +0 -60
- package/dist/shared/chunk-8qtexw5s.js +0 -199
- package/dist/shared/chunk-9ezgd78r.js +0 -142
- package/dist/shared/chunk-ajpj10z0.js +0 -282
- package/dist/shared/chunk-c46v0fsw.js +0 -117
- package/dist/shared/chunk-e4mm5e59.js +0 -178
- package/dist/shared/chunk-fqa5bwn1.js +0 -128
- package/dist/shared/chunk-g8hnc95b.js +0 -219
- package/dist/shared/chunk-j2tdpxgc.js +0 -185
- package/dist/shared/chunk-k8nabsxm.js +0 -330
- package/dist/shared/chunk-kcnq15je.js +0 -175
- package/dist/shared/chunk-mqs4qq0b.js +0 -46
- package/dist/shared/chunk-pg2yjn8f.js +0 -88
- package/dist/shared/chunk-rb53v045.js +0 -71
- package/dist/shared/chunk-s6a2yph8.js +0 -239
- package/dist/shared/chunk-vhx3sqw6.js +0 -196
- package/dist/shared/chunk-w318par6.js +0 -204
- package/dist/shared/chunk-wcdq7bew.js +0 -133
- package/dist/shared/chunk-z0gwkzgp.js +0 -34
- package/dist/shared/chunk-z850et33.js +0 -161
- package/dist/shared/chunk-zyfc6cx3.js +0 -61
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/label/label-composed.tsx
|
|
6
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __pushMountFrame } from "@vertz/ui/internals";
|
|
7
|
+
function ComposedLabelRoot(__props) {
|
|
8
|
+
const __mfDepth = __pushMountFrame();
|
|
9
|
+
try {
|
|
10
|
+
const __mfResult0 = (() => {
|
|
11
|
+
const __el0 = __element("label");
|
|
12
|
+
__attr(__el0, "class", () => cn(__props.classes?.base, __props.className ?? __props.class));
|
|
13
|
+
__attr(__el0, "for", () => __props.for);
|
|
14
|
+
__enterChildren(__el0);
|
|
15
|
+
__append(__el0, __child(() => __props.children));
|
|
16
|
+
__exitChildren();
|
|
17
|
+
return __el0;
|
|
18
|
+
})();
|
|
19
|
+
__flushMountFrame();
|
|
20
|
+
return __mfResult0;
|
|
21
|
+
} catch (__mfErr) {
|
|
22
|
+
__discardMountFrame(__mfDepth);
|
|
23
|
+
throw __mfErr;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var ComposedLabel = ComposedLabelRoot;
|
|
27
|
+
|
|
28
|
+
export { ComposedLabel };
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
createDismiss
|
|
6
|
+
} from "./chunk-a6wp8c32.js";
|
|
7
|
+
import {
|
|
8
|
+
createFloatingPosition,
|
|
9
|
+
resolveLayoutElement
|
|
10
|
+
} from "./chunk-vef3sepw.js";
|
|
11
|
+
import {
|
|
12
|
+
Keys,
|
|
13
|
+
handleListNavigation,
|
|
14
|
+
isKey
|
|
15
|
+
} from "./chunk-7867pr13.js";
|
|
16
|
+
import {
|
|
17
|
+
linkedIds
|
|
18
|
+
} from "./chunk-8y1jf6xr.js";
|
|
19
|
+
|
|
20
|
+
// src/menu/menu-composed.tsx
|
|
21
|
+
import { signal } from "@vertz/ui";
|
|
22
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
23
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
24
|
+
var MenuContext = createContext(undefined, "@vertz/ui-primitives::MenuContext");
|
|
25
|
+
function useMenuContext(componentName) {
|
|
26
|
+
const ctx = useContext(MenuContext);
|
|
27
|
+
if (!ctx) {
|
|
28
|
+
throw new Error(`<Menu.${componentName}> must be used inside <Menu>. ` + "Ensure it is a direct or nested child of the Menu root component.");
|
|
29
|
+
}
|
|
30
|
+
return ctx;
|
|
31
|
+
}
|
|
32
|
+
function MenuTrigger(__props) {
|
|
33
|
+
const __mfDepth = __pushMountFrame();
|
|
34
|
+
try {
|
|
35
|
+
const ctx = useMenuContext("Trigger");
|
|
36
|
+
const __mfResult0 = (() => {
|
|
37
|
+
const __el0 = __element("span");
|
|
38
|
+
{
|
|
39
|
+
const __v = { display: "contents" };
|
|
40
|
+
if (__v != null && __v !== false)
|
|
41
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
42
|
+
}
|
|
43
|
+
__el0.setAttribute("data-menu-trigger", "");
|
|
44
|
+
__el0.setAttribute("aria-haspopup", "menu");
|
|
45
|
+
{
|
|
46
|
+
const __v = ctx.contentId;
|
|
47
|
+
if (__v != null && __v !== false)
|
|
48
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
49
|
+
}
|
|
50
|
+
__el0.setAttribute("aria-expanded", "false");
|
|
51
|
+
__el0.setAttribute("data-state", "closed");
|
|
52
|
+
__on(__el0, "click", () => ctx.toggle());
|
|
53
|
+
__on(__el0, "keydown", (event) => {
|
|
54
|
+
if (isKey(event, Keys.ArrowDown, Keys.Enter, Keys.Space)) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
if (!ctx.isOpen())
|
|
57
|
+
ctx.open(true);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
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 MenuContent(__props) {
|
|
73
|
+
const __mfDepth = __pushMountFrame();
|
|
74
|
+
try {
|
|
75
|
+
const ctx = useMenuContext("Content");
|
|
76
|
+
const instanceIndex = ctx._contentCount.value++;
|
|
77
|
+
if (instanceIndex > 0) {
|
|
78
|
+
console.warn("Duplicate <Menu.Content> detected – only the first is used");
|
|
79
|
+
}
|
|
80
|
+
const __mfResult0 = (() => {
|
|
81
|
+
const __el0 = __element("div");
|
|
82
|
+
ctx.contentRef.current = __el0;
|
|
83
|
+
__el0.setAttribute("role", "menu");
|
|
84
|
+
__el0.setAttribute("tabindex", "-1");
|
|
85
|
+
{
|
|
86
|
+
const __v = ctx.contentId;
|
|
87
|
+
if (__v != null && __v !== false)
|
|
88
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
89
|
+
}
|
|
90
|
+
__el0.setAttribute("data-menu-content", "");
|
|
91
|
+
__el0.setAttribute("aria-hidden", "true");
|
|
92
|
+
__el0.setAttribute("data-state", "closed");
|
|
93
|
+
{
|
|
94
|
+
const __v = { display: "none" };
|
|
95
|
+
if (__v != null && __v !== false)
|
|
96
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
97
|
+
}
|
|
98
|
+
__attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
|
|
99
|
+
__on(__el0, "keydown", (event) => {
|
|
100
|
+
if (isKey(event, Keys.Escape)) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
ctx.close();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const el = event.currentTarget ?? event.target;
|
|
106
|
+
const items = [...el.querySelectorAll('[role="menuitem"]')];
|
|
107
|
+
const focusedIdx = items.indexOf(document.activeElement);
|
|
108
|
+
if (isKey(event, Keys.Enter, Keys.Space)) {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
const active = items[focusedIdx];
|
|
111
|
+
if (active) {
|
|
112
|
+
const val = active.getAttribute("data-value");
|
|
113
|
+
if (val !== null) {
|
|
114
|
+
ctx.onSelect?.(val);
|
|
115
|
+
ctx.close();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
handleListNavigation(event, items, { orientation: "vertical" });
|
|
121
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
122
|
+
const char = event.key.toLowerCase();
|
|
123
|
+
const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
|
|
124
|
+
if (match)
|
|
125
|
+
match.focus();
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
__on(__el0, "click", (event) => {
|
|
129
|
+
const target = event.target.closest('[role="menuitem"]');
|
|
130
|
+
if (target)
|
|
131
|
+
ctx.close();
|
|
132
|
+
});
|
|
133
|
+
__enterChildren(__el0);
|
|
134
|
+
__append(__el0, __child(() => __props.children));
|
|
135
|
+
__exitChildren();
|
|
136
|
+
return __el0;
|
|
137
|
+
})();
|
|
138
|
+
__flushMountFrame();
|
|
139
|
+
return __mfResult0;
|
|
140
|
+
} catch (__mfErr) {
|
|
141
|
+
__discardMountFrame(__mfDepth);
|
|
142
|
+
throw __mfErr;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function MenuItem(__props) {
|
|
146
|
+
const __mfDepth = __pushMountFrame();
|
|
147
|
+
try {
|
|
148
|
+
const ctx = useMenuContext("Item");
|
|
149
|
+
const __mfResult0 = (() => {
|
|
150
|
+
const __el0 = __element("div");
|
|
151
|
+
__el0.setAttribute("role", "menuitem");
|
|
152
|
+
__attr(__el0, "data-value", () => __props.value);
|
|
153
|
+
__el0.setAttribute("tabindex", "-1");
|
|
154
|
+
__attr(__el0, "class", () => cn(ctx.classes?.item, __props.className ?? __props.class));
|
|
155
|
+
__on(__el0, "click", () => {
|
|
156
|
+
ctx.onSelect?.(__props.value);
|
|
157
|
+
ctx.close();
|
|
158
|
+
});
|
|
159
|
+
__enterChildren(__el0);
|
|
160
|
+
__append(__el0, __child(() => __props.children));
|
|
161
|
+
__exitChildren();
|
|
162
|
+
return __el0;
|
|
163
|
+
})();
|
|
164
|
+
__flushMountFrame();
|
|
165
|
+
return __mfResult0;
|
|
166
|
+
} catch (__mfErr) {
|
|
167
|
+
__discardMountFrame(__mfDepth);
|
|
168
|
+
throw __mfErr;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function MenuGroup(__props) {
|
|
172
|
+
const __mfDepth = __pushMountFrame();
|
|
173
|
+
try {
|
|
174
|
+
const ctx = useMenuContext("Group");
|
|
175
|
+
const __mfResult0 = (() => {
|
|
176
|
+
const __el0 = __element("div");
|
|
177
|
+
__el0.setAttribute("role", "group");
|
|
178
|
+
__attr(__el0, "aria-label", () => __props.label);
|
|
179
|
+
__attr(__el0, "class", () => cn(ctx.classes?.group, __props.className ?? __props.class));
|
|
180
|
+
__enterChildren(__el0);
|
|
181
|
+
__append(__el0, __child(() => __props.children));
|
|
182
|
+
__exitChildren();
|
|
183
|
+
return __el0;
|
|
184
|
+
})();
|
|
185
|
+
__flushMountFrame();
|
|
186
|
+
return __mfResult0;
|
|
187
|
+
} catch (__mfErr) {
|
|
188
|
+
__discardMountFrame(__mfDepth);
|
|
189
|
+
throw __mfErr;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function MenuLabel(__props) {
|
|
193
|
+
const __mfDepth = __pushMountFrame();
|
|
194
|
+
try {
|
|
195
|
+
const { classes } = useMenuContext("Label");
|
|
196
|
+
const __mfResult0 = (() => {
|
|
197
|
+
const __el0 = __element("div");
|
|
198
|
+
__el0.setAttribute("role", "none");
|
|
199
|
+
__attr(__el0, "class", () => cn(classes?.label, __props.className ?? __props.class));
|
|
200
|
+
__enterChildren(__el0);
|
|
201
|
+
__append(__el0, __child(() => __props.children));
|
|
202
|
+
__exitChildren();
|
|
203
|
+
return __el0;
|
|
204
|
+
})();
|
|
205
|
+
__flushMountFrame();
|
|
206
|
+
return __mfResult0;
|
|
207
|
+
} catch (__mfErr) {
|
|
208
|
+
__discardMountFrame(__mfDepth);
|
|
209
|
+
throw __mfErr;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function MenuSeparator(__props) {
|
|
213
|
+
const __mfDepth = __pushMountFrame();
|
|
214
|
+
try {
|
|
215
|
+
const { classes } = useMenuContext("Separator");
|
|
216
|
+
const __mfResult0 = (() => {
|
|
217
|
+
const __el0 = __element("hr");
|
|
218
|
+
__el0.setAttribute("role", "separator");
|
|
219
|
+
__attr(__el0, "class", () => cn(classes?.separator, __props.className ?? __props.class));
|
|
220
|
+
return __el0;
|
|
221
|
+
})();
|
|
222
|
+
__flushMountFrame();
|
|
223
|
+
return __mfResult0;
|
|
224
|
+
} catch (__mfErr) {
|
|
225
|
+
__discardMountFrame(__mfDepth);
|
|
226
|
+
throw __mfErr;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function ComposedMenuRoot(__props) {
|
|
230
|
+
const __mfDepth = __pushMountFrame();
|
|
231
|
+
try {
|
|
232
|
+
let getContentEl = function() {
|
|
233
|
+
return contentRef.current ?? null;
|
|
234
|
+
}, getItems = function() {
|
|
235
|
+
const content = getContentEl();
|
|
236
|
+
if (!content)
|
|
237
|
+
return [];
|
|
238
|
+
return [...content.querySelectorAll('[role="menuitem"]')];
|
|
239
|
+
}, getTriggerEl = function() {
|
|
240
|
+
const content = getContentEl();
|
|
241
|
+
const triggerSpan = content?.parentElement?.querySelector("[data-menu-trigger]");
|
|
242
|
+
if (!triggerSpan)
|
|
243
|
+
return null;
|
|
244
|
+
return resolveLayoutElement(triggerSpan);
|
|
245
|
+
}, updateActiveItem = function(items, index) {
|
|
246
|
+
items.forEach((item, i) => {
|
|
247
|
+
item.setAttribute("tabindex", i === index ? "0" : "-1");
|
|
248
|
+
});
|
|
249
|
+
}, syncContentAttrs = function() {
|
|
250
|
+
const contentEl = getContentEl();
|
|
251
|
+
if (!contentEl)
|
|
252
|
+
return;
|
|
253
|
+
const open2 = isOpen.value;
|
|
254
|
+
contentEl.style.display = open2 ? "" : "none";
|
|
255
|
+
contentEl.setAttribute("aria-hidden", open2 ? "false" : "true");
|
|
256
|
+
contentEl.setAttribute("data-state", open2 ? "open" : "closed");
|
|
257
|
+
const triggerEl = getTriggerEl();
|
|
258
|
+
if (triggerEl) {
|
|
259
|
+
triggerEl.setAttribute("aria-expanded", open2 ? "true" : "false");
|
|
260
|
+
triggerEl.setAttribute("data-state", open2 ? "open" : "closed");
|
|
261
|
+
}
|
|
262
|
+
}, open = function(activateFirst = false) {
|
|
263
|
+
isOpen.value = true;
|
|
264
|
+
state.activeIndex = -1;
|
|
265
|
+
syncContentAttrs();
|
|
266
|
+
__props.onOpenChange?.(true);
|
|
267
|
+
const contentEl = getContentEl();
|
|
268
|
+
const triggerEl = getTriggerEl();
|
|
269
|
+
if (!contentEl)
|
|
270
|
+
return;
|
|
271
|
+
{
|
|
272
|
+
const floatingOpts = __props.positioning ?? { placement: "bottom-start", offset: 4 };
|
|
273
|
+
const refEl = floatingOpts.referenceElement ?? triggerEl ?? contentEl;
|
|
274
|
+
contentEl.style.position = "fixed";
|
|
275
|
+
const result = createFloatingPosition(refEl, contentEl, floatingOpts);
|
|
276
|
+
state.floatingCleanup = result.cleanup;
|
|
277
|
+
state.dismissCleanup = createDismiss({
|
|
278
|
+
onDismiss: close,
|
|
279
|
+
insideElements: [refEl, contentEl, ...triggerEl ? [triggerEl] : []],
|
|
280
|
+
escapeKey: false
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const items = getItems();
|
|
284
|
+
if (activateFirst && items.length > 0) {
|
|
285
|
+
state.activeIndex = 0;
|
|
286
|
+
updateActiveItem(items, 0);
|
|
287
|
+
items[0]?.focus();
|
|
288
|
+
} else {
|
|
289
|
+
updateActiveItem(items, -1);
|
|
290
|
+
contentEl.focus();
|
|
291
|
+
}
|
|
292
|
+
}, close = function() {
|
|
293
|
+
isOpen.value = false;
|
|
294
|
+
syncContentAttrs();
|
|
295
|
+
state.floatingCleanup?.();
|
|
296
|
+
state.floatingCleanup = null;
|
|
297
|
+
state.dismissCleanup?.();
|
|
298
|
+
state.dismissCleanup = null;
|
|
299
|
+
__props.onOpenChange?.(false);
|
|
300
|
+
getTriggerEl()?.focus();
|
|
301
|
+
}, toggle = function() {
|
|
302
|
+
if (isOpen.value)
|
|
303
|
+
close();
|
|
304
|
+
else
|
|
305
|
+
open();
|
|
306
|
+
};
|
|
307
|
+
const ids = linkedIds("menu");
|
|
308
|
+
const contentRef = ref();
|
|
309
|
+
const isOpen = signal(false, "isOpen");
|
|
310
|
+
const state = { activeIndex: -1, floatingCleanup: null, dismissCleanup: null };
|
|
311
|
+
const ctx = {
|
|
312
|
+
isOpen: () => isOpen.value,
|
|
313
|
+
contentId: ids.contentId,
|
|
314
|
+
contentRef,
|
|
315
|
+
classes: __props.classes,
|
|
316
|
+
onSelect: __props.onSelect,
|
|
317
|
+
open,
|
|
318
|
+
close,
|
|
319
|
+
toggle,
|
|
320
|
+
_contentCount: { value: 0 }
|
|
321
|
+
};
|
|
322
|
+
const __mfResult0 = MenuContext.Provider({ get value() {
|
|
323
|
+
return ctx;
|
|
324
|
+
}, children: () => (() => {
|
|
325
|
+
const __el0 = __element("span");
|
|
326
|
+
{
|
|
327
|
+
const __v = { display: "contents" };
|
|
328
|
+
if (__v != null && __v !== false)
|
|
329
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
330
|
+
}
|
|
331
|
+
__el0.setAttribute("data-menu-root", "");
|
|
332
|
+
__enterChildren(__el0);
|
|
333
|
+
__append(__el0, __child(() => __props.children));
|
|
334
|
+
__exitChildren();
|
|
335
|
+
return __el0;
|
|
336
|
+
})() });
|
|
337
|
+
__flushMountFrame();
|
|
338
|
+
return __mfResult0;
|
|
339
|
+
} catch (__mfErr) {
|
|
340
|
+
__discardMountFrame(__mfDepth);
|
|
341
|
+
throw __mfErr;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
var ComposedMenu = Object.assign(ComposedMenuRoot, {
|
|
345
|
+
Trigger: MenuTrigger,
|
|
346
|
+
Content: MenuContent,
|
|
347
|
+
Item: MenuItem,
|
|
348
|
+
Group: MenuGroup,
|
|
349
|
+
Label: MenuLabel,
|
|
350
|
+
Separator: MenuSeparator
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
export { ComposedMenu };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/dialog/dialog-stack-parts.tsx
|
|
6
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
7
|
+
import { DialogHandleContext, DialogIdContext, useContext } from "@vertz/ui";
|
|
8
|
+
function useDialogId() {
|
|
9
|
+
const id = useContext(DialogIdContext);
|
|
10
|
+
if (!id) {
|
|
11
|
+
throw new Error("Dialog sub-component must be used inside a dialog opened via DialogStack");
|
|
12
|
+
}
|
|
13
|
+
return id;
|
|
14
|
+
}
|
|
15
|
+
function useDialogHandle() {
|
|
16
|
+
const handle = useContext(DialogHandleContext);
|
|
17
|
+
if (!handle) {
|
|
18
|
+
throw new Error("Dialog sub-component must be used inside a dialog opened via DialogStack");
|
|
19
|
+
}
|
|
20
|
+
return handle;
|
|
21
|
+
}
|
|
22
|
+
function StackDialogTitle(__props) {
|
|
23
|
+
const __mfDepth = __pushMountFrame();
|
|
24
|
+
try {
|
|
25
|
+
const dialogId = useDialogId();
|
|
26
|
+
const __mfResult0 = (() => {
|
|
27
|
+
const __el0 = __element("h2");
|
|
28
|
+
{
|
|
29
|
+
const __v = `${dialogId}-title`;
|
|
30
|
+
if (__v != null && __v !== false)
|
|
31
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
32
|
+
}
|
|
33
|
+
__el0.setAttribute("data-part", "title");
|
|
34
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
35
|
+
__enterChildren(__el0);
|
|
36
|
+
__append(__el0, __child(() => __props.children));
|
|
37
|
+
__exitChildren();
|
|
38
|
+
return __el0;
|
|
39
|
+
})();
|
|
40
|
+
__flushMountFrame();
|
|
41
|
+
return __mfResult0;
|
|
42
|
+
} catch (__mfErr) {
|
|
43
|
+
__discardMountFrame(__mfDepth);
|
|
44
|
+
throw __mfErr;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function StackDialogDescription(__props) {
|
|
48
|
+
const __mfDepth = __pushMountFrame();
|
|
49
|
+
try {
|
|
50
|
+
const dialogId = useDialogId();
|
|
51
|
+
const __mfResult0 = (() => {
|
|
52
|
+
const __el0 = __element("p");
|
|
53
|
+
{
|
|
54
|
+
const __v = `${dialogId}-desc`;
|
|
55
|
+
if (__v != null && __v !== false)
|
|
56
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
57
|
+
}
|
|
58
|
+
__el0.setAttribute("data-part", "description");
|
|
59
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
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 StackDialogHeader(__props) {
|
|
73
|
+
const __mfDepth = __pushMountFrame();
|
|
74
|
+
try {
|
|
75
|
+
const __mfResult0 = (() => {
|
|
76
|
+
const __el0 = __element("div");
|
|
77
|
+
__el0.setAttribute("data-part", "header");
|
|
78
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
79
|
+
__enterChildren(__el0);
|
|
80
|
+
__append(__el0, __child(() => __props.children));
|
|
81
|
+
__exitChildren();
|
|
82
|
+
return __el0;
|
|
83
|
+
})();
|
|
84
|
+
__flushMountFrame();
|
|
85
|
+
return __mfResult0;
|
|
86
|
+
} catch (__mfErr) {
|
|
87
|
+
__discardMountFrame(__mfDepth);
|
|
88
|
+
throw __mfErr;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function StackDialogFooter(__props) {
|
|
92
|
+
const __mfDepth = __pushMountFrame();
|
|
93
|
+
try {
|
|
94
|
+
const __mfResult0 = (() => {
|
|
95
|
+
const __el0 = __element("div");
|
|
96
|
+
__el0.setAttribute("data-part", "footer");
|
|
97
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
98
|
+
__enterChildren(__el0);
|
|
99
|
+
__append(__el0, __child(() => __props.children));
|
|
100
|
+
__exitChildren();
|
|
101
|
+
return __el0;
|
|
102
|
+
})();
|
|
103
|
+
__flushMountFrame();
|
|
104
|
+
return __mfResult0;
|
|
105
|
+
} catch (__mfErr) {
|
|
106
|
+
__discardMountFrame(__mfDepth);
|
|
107
|
+
throw __mfErr;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function StackDialogBody(__props) {
|
|
111
|
+
const __mfDepth = __pushMountFrame();
|
|
112
|
+
try {
|
|
113
|
+
const __mfResult0 = (() => {
|
|
114
|
+
const __el0 = __element("div");
|
|
115
|
+
__el0.setAttribute("data-part", "body");
|
|
116
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
117
|
+
__enterChildren(__el0);
|
|
118
|
+
__append(__el0, __child(() => __props.children));
|
|
119
|
+
__exitChildren();
|
|
120
|
+
return __el0;
|
|
121
|
+
})();
|
|
122
|
+
__flushMountFrame();
|
|
123
|
+
return __mfResult0;
|
|
124
|
+
} catch (__mfErr) {
|
|
125
|
+
__discardMountFrame(__mfDepth);
|
|
126
|
+
throw __mfErr;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function StackDialogCancel(__props) {
|
|
130
|
+
const __mfDepth = __pushMountFrame();
|
|
131
|
+
try {
|
|
132
|
+
const handle = useDialogHandle();
|
|
133
|
+
const __mfResult0 = (() => {
|
|
134
|
+
const __el0 = __element("button");
|
|
135
|
+
__el0.setAttribute("type", "button");
|
|
136
|
+
__el0.setAttribute("data-part", "cancel");
|
|
137
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
138
|
+
__on(__el0, "click", () => handle.close());
|
|
139
|
+
__enterChildren(__el0);
|
|
140
|
+
__append(__el0, __child(() => __props.children));
|
|
141
|
+
__exitChildren();
|
|
142
|
+
return __el0;
|
|
143
|
+
})();
|
|
144
|
+
__flushMountFrame();
|
|
145
|
+
return __mfResult0;
|
|
146
|
+
} catch (__mfErr) {
|
|
147
|
+
__discardMountFrame(__mfDepth);
|
|
148
|
+
throw __mfErr;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function StackDialogClose(__props) {
|
|
152
|
+
const __mfDepth = __pushMountFrame();
|
|
153
|
+
try {
|
|
154
|
+
const handle = useDialogHandle();
|
|
155
|
+
const __mfResult0 = (() => {
|
|
156
|
+
const __el0 = __element("button");
|
|
157
|
+
__el0.setAttribute("type", "button");
|
|
158
|
+
__el0.setAttribute("data-part", "close");
|
|
159
|
+
__attr(__el0, "aria-label", () => __props.children ? undefined : "Close");
|
|
160
|
+
__attr(__el0, "class", () => cn(__props.className ?? __props.class));
|
|
161
|
+
__on(__el0, "click", () => handle.close());
|
|
162
|
+
__enterChildren(__el0);
|
|
163
|
+
__append(__el0, __child(() => __props.children ?? "×"));
|
|
164
|
+
__exitChildren();
|
|
165
|
+
return __el0;
|
|
166
|
+
})();
|
|
167
|
+
__flushMountFrame();
|
|
168
|
+
return __mfResult0;
|
|
169
|
+
} catch (__mfErr) {
|
|
170
|
+
__discardMountFrame(__mfDepth);
|
|
171
|
+
throw __mfErr;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { StackDialogTitle, StackDialogDescription, StackDialogHeader, StackDialogFooter, StackDialogBody, StackDialogCancel, StackDialogClose };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleActivation
|
|
3
|
+
} from "./chunk-7867pr13.js";
|
|
4
|
+
import {
|
|
5
|
+
applyAttrs
|
|
6
|
+
} from "./chunk-2db2dnp3.js";
|
|
7
|
+
|
|
8
|
+
// src/button/button.tsx
|
|
9
|
+
import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
10
|
+
function ButtonRoot(options = {}) {
|
|
11
|
+
const __mfDepth = __pushMountFrame();
|
|
12
|
+
try {
|
|
13
|
+
const { disabled = false, onClick, ...attrs } = options;
|
|
14
|
+
const el = (() => {
|
|
15
|
+
const __el0 = __element("button");
|
|
16
|
+
__el0.setAttribute("type", "button");
|
|
17
|
+
{
|
|
18
|
+
const __v = disabled;
|
|
19
|
+
if (__v != null && __v !== false)
|
|
20
|
+
__el0.setAttribute("disabled", __v === true ? "" : __v);
|
|
21
|
+
}
|
|
22
|
+
{
|
|
23
|
+
const __v = disabled ? "true" : undefined;
|
|
24
|
+
if (__v != null && __v !== false)
|
|
25
|
+
__el0.setAttribute("aria-disabled", __v === true ? "" : __v);
|
|
26
|
+
}
|
|
27
|
+
__on(__el0, "click", () => {
|
|
28
|
+
if (disabled)
|
|
29
|
+
return;
|
|
30
|
+
onClick?.();
|
|
31
|
+
});
|
|
32
|
+
__on(__el0, "keydown", (event) => {
|
|
33
|
+
if (disabled)
|
|
34
|
+
return;
|
|
35
|
+
handleActivation(event, () => {
|
|
36
|
+
event.target.click();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return __el0;
|
|
40
|
+
})();
|
|
41
|
+
applyAttrs(el, attrs);
|
|
42
|
+
const __mfResult0 = el;
|
|
43
|
+
__flushMountFrame();
|
|
44
|
+
return __mfResult0;
|
|
45
|
+
} catch (__mfErr) {
|
|
46
|
+
__discardMountFrame(__mfDepth);
|
|
47
|
+
throw __mfErr;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var Button = {
|
|
51
|
+
Root: ButtonRoot
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { Button };
|