@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,213 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
createFloatingPosition,
|
|
6
|
+
resolveLayoutElement
|
|
7
|
+
} from "./chunk-vef3sepw.js";
|
|
8
|
+
import {
|
|
9
|
+
uniqueId
|
|
10
|
+
} from "./chunk-8y1jf6xr.js";
|
|
11
|
+
|
|
12
|
+
// src/hover-card/hover-card-composed.tsx
|
|
13
|
+
import { computed, signal } from "@vertz/ui";
|
|
14
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
15
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
16
|
+
var HoverCardContext = createContext(undefined, "@vertz/ui-primitives::HoverCardContext");
|
|
17
|
+
function useHoverCardContext(componentName) {
|
|
18
|
+
const ctx = useContext(HoverCardContext);
|
|
19
|
+
if (!ctx) {
|
|
20
|
+
throw new Error(`<HoverCard.${componentName}> must be used inside <HoverCard>. ` + "Ensure it is a direct or nested child of the HoverCard root component.");
|
|
21
|
+
}
|
|
22
|
+
return ctx;
|
|
23
|
+
}
|
|
24
|
+
function HoverCardTrigger(__props) {
|
|
25
|
+
const __mfDepth = __pushMountFrame();
|
|
26
|
+
try {
|
|
27
|
+
const ctx = useHoverCardContext("Trigger");
|
|
28
|
+
const childNodes = computed(() => Array.isArray(__props.children) ? __props.children : [__props.children]);
|
|
29
|
+
const childEl = computed(() => childNodes.value.find((c) => c instanceof HTMLElement));
|
|
30
|
+
if (childEl.value) {
|
|
31
|
+
childEl.value.setAttribute("aria-haspopup", "dialog");
|
|
32
|
+
childEl.value.setAttribute("aria-expanded", ctx.isOpen() ? "true" : "false");
|
|
33
|
+
childEl.value.addEventListener("focus", () => ctx.showImmediate());
|
|
34
|
+
childEl.value.addEventListener("blur", () => ctx.hide());
|
|
35
|
+
}
|
|
36
|
+
const __mfResult0 = (() => {
|
|
37
|
+
const __el0 = __element("span");
|
|
38
|
+
ctx.triggerRef.current = __el0;
|
|
39
|
+
{
|
|
40
|
+
const __v = { display: "contents" };
|
|
41
|
+
if (__v != null && __v !== false)
|
|
42
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
43
|
+
}
|
|
44
|
+
__el0.setAttribute("data-hovercard-trigger", "");
|
|
45
|
+
__on(__el0, "mouseenter", () => ctx.show());
|
|
46
|
+
__on(__el0, "mouseleave", () => ctx.hide());
|
|
47
|
+
__on(__el0, "focusin", () => ctx.showImmediate());
|
|
48
|
+
__on(__el0, "focusout", () => ctx.hide());
|
|
49
|
+
__enterChildren(__el0);
|
|
50
|
+
__append(__el0, __child(() => __props.children));
|
|
51
|
+
__exitChildren();
|
|
52
|
+
return __el0;
|
|
53
|
+
})();
|
|
54
|
+
__flushMountFrame();
|
|
55
|
+
return __mfResult0;
|
|
56
|
+
} catch (__mfErr) {
|
|
57
|
+
__discardMountFrame(__mfDepth);
|
|
58
|
+
throw __mfErr;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function HoverCardContent(__props) {
|
|
62
|
+
const __mfDepth = __pushMountFrame();
|
|
63
|
+
try {
|
|
64
|
+
const ctx = useHoverCardContext("Content");
|
|
65
|
+
const isOpen = ctx.isOpen();
|
|
66
|
+
const __mfResult0 = (() => {
|
|
67
|
+
const __el0 = __element("div");
|
|
68
|
+
ctx.contentRef.current = __el0;
|
|
69
|
+
__el0.setAttribute("role", "dialog");
|
|
70
|
+
{
|
|
71
|
+
const __v = ctx.contentId;
|
|
72
|
+
if (__v != null && __v !== false)
|
|
73
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
74
|
+
}
|
|
75
|
+
__el0.setAttribute("data-hovercard-content", "");
|
|
76
|
+
{
|
|
77
|
+
const __v = isOpen ? "false" : "true";
|
|
78
|
+
if (__v != null && __v !== false)
|
|
79
|
+
__el0.setAttribute("aria-hidden", __v === true ? "" : __v);
|
|
80
|
+
}
|
|
81
|
+
{
|
|
82
|
+
const __v = isOpen ? "open" : "closed";
|
|
83
|
+
if (__v != null && __v !== false)
|
|
84
|
+
__el0.setAttribute("data-state", __v === true ? "" : __v);
|
|
85
|
+
}
|
|
86
|
+
{
|
|
87
|
+
const __v = { display: isOpen ? "" : "none" };
|
|
88
|
+
if (__v != null && __v !== false)
|
|
89
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
90
|
+
}
|
|
91
|
+
__attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
|
|
92
|
+
__on(__el0, "mouseenter", () => ctx.cancelCloseTimer());
|
|
93
|
+
__on(__el0, "mouseleave", () => ctx.hide());
|
|
94
|
+
__on(__el0, "focusin", () => ctx.cancelCloseTimer());
|
|
95
|
+
__on(__el0, "focusout", () => ctx.hide());
|
|
96
|
+
__enterChildren(__el0);
|
|
97
|
+
__append(__el0, __child(() => __props.children));
|
|
98
|
+
__exitChildren();
|
|
99
|
+
return __el0;
|
|
100
|
+
})();
|
|
101
|
+
__flushMountFrame();
|
|
102
|
+
return __mfResult0;
|
|
103
|
+
} catch (__mfErr) {
|
|
104
|
+
__discardMountFrame(__mfDepth);
|
|
105
|
+
throw __mfErr;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function ComposedHoverCardRoot(__props) {
|
|
109
|
+
const __mfDepth = __pushMountFrame();
|
|
110
|
+
try {
|
|
111
|
+
let cancelTimers = function() {
|
|
112
|
+
if (timers.open) {
|
|
113
|
+
clearTimeout(timers.open);
|
|
114
|
+
timers.open = null;
|
|
115
|
+
}
|
|
116
|
+
if (timers.close) {
|
|
117
|
+
clearTimeout(timers.close);
|
|
118
|
+
timers.close = null;
|
|
119
|
+
}
|
|
120
|
+
}, cancelCloseTimer = function() {
|
|
121
|
+
if (timers.close) {
|
|
122
|
+
clearTimeout(timers.close);
|
|
123
|
+
timers.close = null;
|
|
124
|
+
}
|
|
125
|
+
}, applyFloating = function() {
|
|
126
|
+
const triggerSpan = triggerRef.current;
|
|
127
|
+
const contentEl = contentRef.current;
|
|
128
|
+
if (!triggerSpan || !contentEl)
|
|
129
|
+
return;
|
|
130
|
+
const triggerEl = resolveLayoutElement(triggerSpan);
|
|
131
|
+
contentEl.style.position = "fixed";
|
|
132
|
+
const floatingOpts = __props.positioning ?? { placement: "bottom", offset: 4 };
|
|
133
|
+
const result = createFloatingPosition(triggerEl, contentEl, floatingOpts);
|
|
134
|
+
timers.floatingCleanup = result.cleanup;
|
|
135
|
+
}, cleanupFloating = function() {
|
|
136
|
+
timers.floatingCleanup?.();
|
|
137
|
+
timers.floatingCleanup = null;
|
|
138
|
+
}, show = function() {
|
|
139
|
+
cancelTimers();
|
|
140
|
+
if (isOpen.value)
|
|
141
|
+
return;
|
|
142
|
+
timers.open = setTimeout(() => {
|
|
143
|
+
timers.open = null;
|
|
144
|
+
isOpen.value = true;
|
|
145
|
+
applyFloating();
|
|
146
|
+
__props.onOpenChange?.(true);
|
|
147
|
+
}, __props.openDelay ?? 700);
|
|
148
|
+
}, showImmediate = function() {
|
|
149
|
+
cancelTimers();
|
|
150
|
+
isOpen.value = true;
|
|
151
|
+
applyFloating();
|
|
152
|
+
__props.onOpenChange?.(true);
|
|
153
|
+
}, hide = function() {
|
|
154
|
+
cancelTimers();
|
|
155
|
+
if (!isOpen.value)
|
|
156
|
+
return;
|
|
157
|
+
timers.close = setTimeout(() => {
|
|
158
|
+
timers.close = null;
|
|
159
|
+
isOpen.value = false;
|
|
160
|
+
cleanupFloating();
|
|
161
|
+
__props.onOpenChange?.(false);
|
|
162
|
+
}, __props.closeDelay ?? 300);
|
|
163
|
+
}, hideImmediate = function() {
|
|
164
|
+
cancelTimers();
|
|
165
|
+
isOpen.value = false;
|
|
166
|
+
cleanupFloating();
|
|
167
|
+
__props.onOpenChange?.(false);
|
|
168
|
+
};
|
|
169
|
+
const contentId = uniqueId("hovercard");
|
|
170
|
+
const triggerRef = ref();
|
|
171
|
+
const contentRef = ref();
|
|
172
|
+
const isOpen = signal(false, "isOpen");
|
|
173
|
+
const timers = { open: null, close: null, floatingCleanup: null };
|
|
174
|
+
const ctx = {
|
|
175
|
+
isOpen: () => isOpen.value,
|
|
176
|
+
contentId,
|
|
177
|
+
triggerRef,
|
|
178
|
+
contentRef,
|
|
179
|
+
classes: __props.classes,
|
|
180
|
+
show,
|
|
181
|
+
hide,
|
|
182
|
+
showImmediate,
|
|
183
|
+
hideImmediate,
|
|
184
|
+
cancelCloseTimer
|
|
185
|
+
};
|
|
186
|
+
const __mfResult0 = HoverCardContext.Provider({ get value() {
|
|
187
|
+
return ctx;
|
|
188
|
+
}, children: () => (() => {
|
|
189
|
+
const __el0 = __element("span");
|
|
190
|
+
{
|
|
191
|
+
const __v = { display: "contents" };
|
|
192
|
+
if (__v != null && __v !== false)
|
|
193
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
194
|
+
}
|
|
195
|
+
__el0.setAttribute("data-hovercard-root", "");
|
|
196
|
+
__enterChildren(__el0);
|
|
197
|
+
__append(__el0, __child(() => __props.children));
|
|
198
|
+
__exitChildren();
|
|
199
|
+
return __el0;
|
|
200
|
+
})() });
|
|
201
|
+
__flushMountFrame();
|
|
202
|
+
return __mfResult0;
|
|
203
|
+
} catch (__mfErr) {
|
|
204
|
+
__discardMountFrame(__mfDepth);
|
|
205
|
+
throw __mfErr;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
var ComposedHoverCard = Object.assign(ComposedHoverCardRoot, {
|
|
209
|
+
Trigger: HoverCardTrigger,
|
|
210
|
+
Content: HoverCardContent
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export { ComposedHoverCard };
|
|
@@ -21,98 +21,150 @@ import {
|
|
|
21
21
|
} from "./chunk-2db2dnp3.js";
|
|
22
22
|
|
|
23
23
|
// src/navigation-menu/navigation-menu.tsx
|
|
24
|
-
import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
|
|
24
|
+
import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
25
25
|
import { signal } from "@vertz/ui";
|
|
26
26
|
function NavMenuList(triggers, orientation) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const __mfDepth = __pushMountFrame();
|
|
28
|
+
try {
|
|
29
|
+
const __mfResult0 = (() => {
|
|
30
|
+
const __el0 = __element("div");
|
|
31
|
+
__on(__el0, "keydown", (event) => {
|
|
32
|
+
if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.Home, Keys.End)) {
|
|
33
|
+
handleListNavigation(event, triggers, {
|
|
34
|
+
orientation: orientation === "horizontal" ? "horizontal" : "vertical"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return __el0;
|
|
39
|
+
})();
|
|
40
|
+
__flushMountFrame();
|
|
41
|
+
return __mfResult0;
|
|
42
|
+
} catch (__mfErr) {
|
|
43
|
+
__discardMountFrame(__mfDepth);
|
|
44
|
+
throw __mfErr;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
function NavMenuViewport() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
const __mfDepth = __pushMountFrame();
|
|
49
|
+
try {
|
|
50
|
+
const __mfResult0 = (() => {
|
|
51
|
+
const __el0 = __element("div");
|
|
52
|
+
return __el0;
|
|
53
|
+
})();
|
|
54
|
+
__flushMountFrame();
|
|
55
|
+
return __mfResult0;
|
|
56
|
+
} catch (__mfErr) {
|
|
57
|
+
__discardMountFrame(__mfDepth);
|
|
58
|
+
throw __mfErr;
|
|
59
|
+
}
|
|
44
60
|
}
|
|
45
61
|
function NavMenuNav(list, viewport) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
const __mfDepth = __pushMountFrame();
|
|
63
|
+
try {
|
|
64
|
+
const __mfResult0 = (() => {
|
|
65
|
+
const __el0 = __element("nav");
|
|
66
|
+
__enterChildren(__el0);
|
|
67
|
+
__insert(__el0, list);
|
|
68
|
+
__insert(__el0, viewport);
|
|
69
|
+
__exitChildren();
|
|
70
|
+
return __el0;
|
|
71
|
+
})();
|
|
72
|
+
__flushMountFrame();
|
|
73
|
+
return __mfResult0;
|
|
74
|
+
} catch (__mfErr) {
|
|
75
|
+
__discardMountFrame(__mfDepth);
|
|
76
|
+
throw __mfErr;
|
|
77
|
+
}
|
|
54
78
|
}
|
|
55
79
|
function NavMenuItemTrigger(triggerId, contentId, value, label, onClick, onMouseenter, onMouseleave, onKeydown) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
const __mfDepth = __pushMountFrame();
|
|
81
|
+
try {
|
|
82
|
+
const __mfResult0 = (() => {
|
|
83
|
+
const __el0 = __element("button");
|
|
84
|
+
__el0.setAttribute("type", "button");
|
|
85
|
+
{
|
|
86
|
+
const __v = triggerId;
|
|
87
|
+
if (__v != null && __v !== false)
|
|
88
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
const __v = contentId;
|
|
92
|
+
if (__v != null && __v !== false)
|
|
93
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
94
|
+
}
|
|
95
|
+
{
|
|
96
|
+
const __v = value;
|
|
97
|
+
if (__v != null && __v !== false)
|
|
98
|
+
__el0.setAttribute("data-value", __v === true ? "" : __v);
|
|
99
|
+
}
|
|
100
|
+
__el0.setAttribute("aria-expanded", "false");
|
|
101
|
+
__el0.setAttribute("data-state", "closed");
|
|
102
|
+
__on(__el0, "click", onClick);
|
|
103
|
+
__on(__el0, "mouseenter", onMouseenter);
|
|
104
|
+
__on(__el0, "mouseleave", onMouseleave);
|
|
105
|
+
__on(__el0, "keydown", onKeydown);
|
|
106
|
+
__enterChildren(__el0);
|
|
107
|
+
__insert(__el0, label ?? value);
|
|
108
|
+
__exitChildren();
|
|
109
|
+
return __el0;
|
|
110
|
+
})();
|
|
111
|
+
__flushMountFrame();
|
|
112
|
+
return __mfResult0;
|
|
113
|
+
} catch (__mfErr) {
|
|
114
|
+
__discardMountFrame(__mfDepth);
|
|
115
|
+
throw __mfErr;
|
|
116
|
+
}
|
|
85
117
|
}
|
|
86
118
|
function NavMenuItemContent(contentId, onMouseenter, onMouseleave, onKeydown) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
const __mfDepth = __pushMountFrame();
|
|
120
|
+
try {
|
|
121
|
+
const __mfResult0 = (() => {
|
|
122
|
+
const __el0 = __element("div");
|
|
123
|
+
{
|
|
124
|
+
const __v = contentId;
|
|
125
|
+
if (__v != null && __v !== false)
|
|
126
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
127
|
+
}
|
|
128
|
+
__el0.setAttribute("aria-hidden", "true");
|
|
129
|
+
__el0.setAttribute("data-state", "closed");
|
|
130
|
+
{
|
|
131
|
+
const __v = { display: "none" };
|
|
132
|
+
if (__v != null && __v !== false)
|
|
133
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
134
|
+
}
|
|
135
|
+
__on(__el0, "mouseenter", onMouseenter);
|
|
136
|
+
__on(__el0, "mouseleave", onMouseleave);
|
|
137
|
+
__on(__el0, "keydown", onKeydown);
|
|
138
|
+
return __el0;
|
|
139
|
+
})();
|
|
140
|
+
__flushMountFrame();
|
|
141
|
+
return __mfResult0;
|
|
142
|
+
} catch (__mfErr) {
|
|
143
|
+
__discardMountFrame(__mfDepth);
|
|
144
|
+
throw __mfErr;
|
|
145
|
+
}
|
|
102
146
|
}
|
|
103
147
|
function NavMenuLink(href, label) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
148
|
+
const __mfDepth = __pushMountFrame();
|
|
149
|
+
try {
|
|
150
|
+
const __mfResult0 = (() => {
|
|
151
|
+
const __el0 = __element("a");
|
|
152
|
+
{
|
|
153
|
+
const __v = href;
|
|
154
|
+
if (__v != null && __v !== false)
|
|
155
|
+
__el0.setAttribute("href", __v === true ? "" : __v);
|
|
156
|
+
}
|
|
157
|
+
__enterChildren(__el0);
|
|
158
|
+
__insert(__el0, label);
|
|
159
|
+
__exitChildren();
|
|
160
|
+
return __el0;
|
|
161
|
+
})();
|
|
162
|
+
__flushMountFrame();
|
|
163
|
+
return __mfResult0;
|
|
164
|
+
} catch (__mfErr) {
|
|
165
|
+
__discardMountFrame(__mfDepth);
|
|
166
|
+
throw __mfErr;
|
|
167
|
+
}
|
|
116
168
|
}
|
|
117
169
|
function NavigationMenuRoot(options = {}) {
|
|
118
170
|
const { orientation = "horizontal", delayOpen = 200, delayClose = 300, ...attrs } = options;
|
|
@@ -218,14 +270,10 @@ function NavigationMenuRoot(options = {}) {
|
|
|
218
270
|
triggers.push(trigger);
|
|
219
271
|
setRovingTabindex(triggers, 0);
|
|
220
272
|
items.set(value, { trigger, content: contentEl });
|
|
221
|
-
list.appendChild(trigger);
|
|
222
|
-
viewport.appendChild(contentEl);
|
|
223
273
|
return { trigger, content: contentEl };
|
|
224
274
|
}
|
|
225
275
|
function Link(href, label) {
|
|
226
|
-
|
|
227
|
-
list.appendChild(a);
|
|
228
|
-
return a;
|
|
276
|
+
return NavMenuLink(href, label);
|
|
229
277
|
}
|
|
230
278
|
applyAttrs(root, attrs);
|
|
231
279
|
return { root, list, viewport, state, Item, Link };
|