@vertz/ui-primitives 0.2.23 → 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-pzx0vpq1.js → chunk-00fqgnq1.js} +6 -11
- package/dist/shared/chunk-1hm0mbke.js +258 -0
- package/dist/shared/{chunk-ww7k2azn.js → chunk-20kwns82.js} +5 -9
- package/dist/shared/chunk-3jack97k.js +509 -0
- package/dist/shared/{chunk-xs6gp369.js → chunk-455p0jbk.js} +3 -7
- package/dist/shared/chunk-4gyg71bn.js +178 -0
- package/dist/shared/chunk-4z006v1j.js +467 -0
- package/dist/shared/{chunk-b25npqer.js → chunk-585ysr70.js} +1 -1
- package/dist/shared/chunk-75pegjs7.js +26 -0
- package/dist/shared/{chunk-mr1tb0dp.js → chunk-7a2nqmeh.js} +1 -1
- package/dist/shared/chunk-7wem1bhb.js +252 -0
- package/dist/shared/{chunk-7cb3z0s8.js → chunk-8evj43jn.js} +5 -8
- package/dist/shared/chunk-8t0nm721.js +152 -0
- package/dist/shared/chunk-94twh4s4.js +28 -0
- package/dist/shared/chunk-98y1sw9y.js +398 -0
- package/dist/shared/chunk-9eedsnnk.js +164 -0
- package/dist/shared/{chunk-8c01c8mb.js → chunk-9hv3vc72.js} +0 -2
- package/dist/shared/chunk-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-3kwh27dv.js → chunk-de18ashk.js} +0 -1
- package/dist/shared/{chunk-cgb2j94g.js → chunk-dvk4h36t.js} +0 -1
- package/dist/shared/chunk-e6660g7e.js +179 -0
- package/dist/shared/{chunk-3h1mxp95.js → chunk-eq4d9b0w.js} +0 -1
- package/dist/shared/chunk-ev367pq3.js +102 -0
- package/dist/shared/{chunk-4894pmy6.js → chunk-f0wy7k56.js} +0 -1
- package/dist/shared/chunk-fjykbv0v.js +214 -0
- package/dist/shared/chunk-ghkw5bjq.js +55 -0
- package/dist/shared/chunk-gqb1n1hj.js +60 -0
- package/dist/shared/chunk-hfjtkytb.js +310 -0
- package/dist/shared/chunk-hpvjfj0j.js +31 -0
- package/dist/shared/chunk-hxmxvp56.js +67 -0
- package/dist/shared/chunk-j9m2f0rd.js +162 -0
- package/dist/shared/chunk-jpyjk616.js +52 -0
- package/dist/shared/{chunk-ttb2tt03.js → chunk-jsa3byag.js} +1 -1
- package/dist/shared/{chunk-9gfp3ffv.js → chunk-jzy1bkdk.js} +0 -1
- package/dist/shared/{chunk-f2vx4tpw.js → chunk-knzg86am.js} +5 -5
- package/dist/shared/chunk-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-nsmvdxgp.js +213 -0
- package/dist/shared/{chunk-pn6shbcs.js → chunk-pdzmg245.js} +1 -5
- package/dist/shared/chunk-pzknpa1y.js +327 -0
- package/dist/shared/chunk-q1ff3xp3.js +95 -0
- package/dist/shared/chunk-q7xbcj9q.js +7 -0
- package/dist/shared/{chunk-p0x7hgv6.js → chunk-qhnany7w.js} +0 -2
- package/dist/shared/chunk-qrm43tr3.js +357 -0
- package/dist/shared/{chunk-xa1b96mb.js → chunk-qsp7sfhp.js} +2 -2
- package/dist/shared/{chunk-j902w020.js → chunk-qwqnjjg8.js} +1 -1
- package/dist/shared/{chunk-h3v10x04.js → chunk-r0rz7z03.js} +6 -11
- package/dist/shared/chunk-r3ngaa64.js +418 -0
- package/dist/shared/chunk-r3pffzss.js +13 -0
- package/dist/shared/chunk-rrt62bp0.js +353 -0
- package/dist/shared/chunk-s24gkmna.js +131 -0
- package/dist/shared/chunk-s62e7jf4.js +30 -0
- package/dist/shared/chunk-spng4yb9.js +73 -0
- package/dist/shared/chunk-v0b5pkcq.js +30 -0
- package/dist/shared/chunk-v11kd39k.js +162 -0
- package/dist/shared/{chunk-0mcr52hc.js → chunk-vef3sepw.js} +17 -1
- package/dist/shared/chunk-vkscwzpr.js +294 -0
- package/dist/shared/chunk-vv187snj.js +112 -0
- package/dist/shared/chunk-wqsek87j.js +311 -0
- package/dist/shared/chunk-wtkxz2te.js +157 -0
- package/dist/shared/chunk-y1hpsqzy.js +185 -0
- package/dist/shared/chunk-yfzddvxc.js +71 -0
- package/dist/src/accordion/accordion-composed.d.ts +30 -0
- package/dist/src/accordion/accordion-composed.js +6 -0
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.d.ts +26 -0
- package/dist/src/alert/alert-composed.js +6 -0
- package/dist/src/alert-dialog/alert-dialog-composed.d.ts +40 -0
- package/dist/src/alert-dialog/alert-dialog-composed.js +6 -0
- package/dist/src/avatar/avatar-composed.d.ts +33 -0
- package/dist/src/avatar/avatar-composed.js +6 -0
- package/dist/src/badge/badge-composed.d.ts +33 -0
- package/dist/src/badge/badge-composed.js +6 -0
- package/dist/src/breadcrumb/breadcrumb-composed.d.ts +34 -0
- package/dist/src/breadcrumb/breadcrumb-composed.js +6 -0
- package/dist/src/button/button-composed.d.ts +34 -0
- package/dist/src/button/button-composed.js +6 -0
- package/dist/src/calendar/calendar-composed.d.ts +42 -0
- package/dist/src/calendar/calendar-composed.js +6 -0
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.d.ts +34 -0
- package/dist/src/card/card-composed.js +6 -0
- package/dist/src/carousel/carousel-composed.d.ts +32 -0
- package/dist/src/carousel/carousel-composed.js +6 -0
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.d.ts +18 -0
- package/dist/src/checkbox/checkbox-composed.js +6 -0
- package/dist/src/collapsible/collapsible-composed.d.ts +26 -0
- package/dist/src/collapsible/collapsible-composed.js +6 -0
- package/dist/src/combobox/combobox-composed.d.ts +30 -0
- package/dist/src/combobox/combobox-composed.js +6 -0
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.d.ts +67 -0
- package/dist/src/command/command-composed.js +6 -0
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.d.ts +38 -0
- package/dist/src/composed/with-styles.js +6 -0
- package/dist/src/context-menu/context-menu-composed.d.ts +51 -0
- package/dist/src/context-menu/context-menu-composed.js +6 -0
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.d.ts +77 -0
- package/dist/src/date-picker/date-picker-composed.js +6 -0
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.d.ts +36 -0
- package/dist/src/dialog/dialog-composed.js +6 -0
- package/dist/src/dialog/dialog-stack-parts.d.ts +16 -0
- package/dist/src/dialog/dialog-stack-parts.js +18 -0
- package/dist/src/dropdown-menu/dropdown-menu-composed.d.ts +51 -0
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +6 -0
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.d.ts +30 -0
- package/dist/src/empty-state/empty-state-composed.js +6 -0
- package/dist/src/form-group/form-group-composed.d.ts +24 -0
- package/dist/src/form-group/form-group-composed.js +6 -0
- package/dist/src/hover-card/hover-card-composed.d.ts +38 -0
- package/dist/src/hover-card/hover-card-composed.js +6 -0
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/index.d.ts +1284 -817
- package/dist/src/index.js +78 -6566
- package/dist/src/input/input-composed.d.ts +35 -0
- package/dist/src/input/input-composed.js +6 -0
- package/dist/src/label/label-composed.d.ts +32 -0
- package/dist/src/label/label-composed.js +6 -0
- package/dist/src/menu/menu-composed.d.ts +51 -0
- package/dist/src/menu/menu-composed.js +6 -0
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.d.ts +56 -0
- package/dist/src/menubar/menubar-composed.js +6 -0
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.d.ts +56 -0
- package/dist/src/navigation-menu/navigation-menu-composed.js +6 -0
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.d.ts +30 -0
- package/dist/src/pagination/pagination-composed.js +6 -0
- package/dist/src/popover/popover-composed.d.ts +36 -0
- package/dist/src/popover/popover-composed.js +6 -0
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.d.ts +17 -0
- package/dist/src/progress/progress-composed.js +6 -0
- package/dist/src/radio/radio-composed.d.ts +24 -0
- package/dist/src/radio/radio-composed.js +6 -0
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.d.ts +33 -0
- package/dist/src/resizable-panel/resizable-panel-composed.js +6 -0
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.d.ts +17 -0
- package/dist/src/scroll-area/scroll-area-composed.js +6 -0
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.d.ts +53 -0
- package/dist/src/select/select-composed.js +6 -0
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.d.ts +32 -0
- package/dist/src/separator/separator-composed.js +6 -0
- package/dist/src/sheet/sheet-composed.d.ts +34 -0
- package/dist/src/sheet/sheet-composed.js +6 -0
- package/dist/src/skeleton/skeleton-composed.d.ts +65 -0
- package/dist/src/skeleton/skeleton-composed.js +6 -0
- package/dist/src/slider/slider-composed.d.ts +22 -0
- package/dist/src/slider/slider-composed.js +6 -0
- package/dist/src/switch/switch-composed.d.ts +17 -0
- package/dist/src/switch/switch-composed.js +6 -0
- package/dist/src/table/table-composed.d.ts +34 -0
- package/dist/src/table/table-composed.js +6 -0
- package/dist/src/tabs/tabs-composed.d.ts +33 -0
- package/dist/src/tabs/tabs-composed.js +6 -0
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.d.ts +35 -0
- package/dist/src/textarea/textarea-composed.js +6 -0
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.d.ts +16 -0
- package/dist/src/toggle/toggle-composed.js +6 -0
- package/dist/src/toggle-group/toggle-group-composed.d.ts +24 -0
- package/dist/src/toggle-group/toggle-group-composed.js +6 -0
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.d.ts +36 -0
- package/dist/src/tooltip/tooltip-composed.js +6 -0
- package/dist/src/tooltip/tooltip.js +1 -1
- package/dist/src/utils.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-56reyd5r.js +0 -64
- package/dist/shared/chunk-mgr904ap.js +0 -370
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
handleListNavigation
|
|
6
|
+
} from "./chunk-7867pr13.js";
|
|
7
|
+
import {
|
|
8
|
+
uniqueId
|
|
9
|
+
} from "./chunk-8y1jf6xr.js";
|
|
10
|
+
|
|
11
|
+
// src/tabs/tabs-composed.tsx
|
|
12
|
+
import { computed, signal } from "@vertz/ui";
|
|
13
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
14
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
15
|
+
var TabsContext = createContext(undefined, "@vertz/ui-primitives::TabsContext");
|
|
16
|
+
function useTabsContext(componentName) {
|
|
17
|
+
const ctx = useContext(TabsContext);
|
|
18
|
+
if (!ctx) {
|
|
19
|
+
throw new Error(`<Tabs.${componentName}> must be used inside <Tabs>. ` + "Ensure it is a direct or nested child of the Tabs root component.");
|
|
20
|
+
}
|
|
21
|
+
return ctx;
|
|
22
|
+
}
|
|
23
|
+
function TabsList(__props) {
|
|
24
|
+
const __mfDepth = __pushMountFrame();
|
|
25
|
+
try {
|
|
26
|
+
const ctx = useTabsContext("List");
|
|
27
|
+
const __mfResult0 = (() => {
|
|
28
|
+
const __el0 = __element("div");
|
|
29
|
+
__el0.setAttribute("role", "tablist");
|
|
30
|
+
__el0.setAttribute("data-tabs-list", "");
|
|
31
|
+
{
|
|
32
|
+
const __v = ctx.orientation === "vertical" ? "vertical" : undefined;
|
|
33
|
+
if (__v != null && __v !== false)
|
|
34
|
+
__el0.setAttribute("aria-orientation", __v === true ? "" : __v);
|
|
35
|
+
}
|
|
36
|
+
__attr(__el0, "class", () => cn(ctx.classes?.list, __props.className ?? __props.class));
|
|
37
|
+
__on(__el0, "keydown", (event) => {
|
|
38
|
+
const list = event.currentTarget;
|
|
39
|
+
const triggers = [...list.querySelectorAll('[role="tab"]')];
|
|
40
|
+
const result = handleListNavigation(event, triggers, { orientation: ctx.orientation });
|
|
41
|
+
if (result) {
|
|
42
|
+
const value = result.getAttribute("data-value");
|
|
43
|
+
if (value)
|
|
44
|
+
ctx.select(value);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
__enterChildren(__el0);
|
|
48
|
+
__append(__el0, __child(() => __props.children));
|
|
49
|
+
__exitChildren();
|
|
50
|
+
return __el0;
|
|
51
|
+
})();
|
|
52
|
+
__flushMountFrame();
|
|
53
|
+
return __mfResult0;
|
|
54
|
+
} catch (__mfErr) {
|
|
55
|
+
__discardMountFrame(__mfDepth);
|
|
56
|
+
throw __mfErr;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function TabsTrigger(__props) {
|
|
60
|
+
const __mfDepth = __pushMountFrame();
|
|
61
|
+
try {
|
|
62
|
+
const ctx = useTabsContext("Trigger");
|
|
63
|
+
const isActive = computed(() => ctx.activeValue === __props.value);
|
|
64
|
+
const __mfResult0 = (() => {
|
|
65
|
+
const __el0 = __element("button");
|
|
66
|
+
__el0.setAttribute("type", "button");
|
|
67
|
+
__el0.setAttribute("role", "tab");
|
|
68
|
+
__attr(__el0, "id", () => ctx.getTriggerIdFor(__props.value));
|
|
69
|
+
__el0.setAttribute("data-tabs-trigger", "");
|
|
70
|
+
__attr(__el0, "data-value", () => __props.value);
|
|
71
|
+
__attr(__el0, "aria-controls", () => ctx.getPanelIdFor(__props.value));
|
|
72
|
+
__attr(__el0, "aria-selected", () => isActive.value ? "true" : "false");
|
|
73
|
+
__attr(__el0, "data-state", () => isActive.value ? "active" : "inactive");
|
|
74
|
+
__attr(__el0, "tabindex", () => isActive.value ? "0" : "-1");
|
|
75
|
+
__attr(__el0, "class", () => cn(ctx.classes?.trigger, __props.className ?? __props.class));
|
|
76
|
+
__on(__el0, "click", () => ctx.select(__props.value));
|
|
77
|
+
__enterChildren(__el0);
|
|
78
|
+
__append(__el0, __child(() => __props.children));
|
|
79
|
+
__exitChildren();
|
|
80
|
+
return __el0;
|
|
81
|
+
})();
|
|
82
|
+
__flushMountFrame();
|
|
83
|
+
return __mfResult0;
|
|
84
|
+
} catch (__mfErr) {
|
|
85
|
+
__discardMountFrame(__mfDepth);
|
|
86
|
+
throw __mfErr;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function TabsContent(__props) {
|
|
90
|
+
const __mfDepth = __pushMountFrame();
|
|
91
|
+
try {
|
|
92
|
+
const ctx = useTabsContext("Content");
|
|
93
|
+
const isActive = computed(() => ctx.activeValue === __props.value);
|
|
94
|
+
const __mfResult0 = (() => {
|
|
95
|
+
const __el0 = __element("div");
|
|
96
|
+
__el0.setAttribute("role", "tabpanel");
|
|
97
|
+
__attr(__el0, "id", () => ctx.getPanelIdFor(__props.value));
|
|
98
|
+
__el0.setAttribute("data-tabs-panel", "");
|
|
99
|
+
__attr(__el0, "data-value", () => __props.value);
|
|
100
|
+
__attr(__el0, "aria-labelledby", () => ctx.getTriggerIdFor(__props.value));
|
|
101
|
+
__el0.setAttribute("tabindex", "0");
|
|
102
|
+
__attr(__el0, "aria-hidden", () => isActive.value ? "false" : "true");
|
|
103
|
+
__attr(__el0, "data-state", () => isActive.value ? "active" : "inactive");
|
|
104
|
+
__attr(__el0, "style", () => ({ display: isActive.value ? "" : "none" }));
|
|
105
|
+
__attr(__el0, "class", () => cn(ctx.classes?.panel, __props.className ?? __props.class));
|
|
106
|
+
__enterChildren(__el0);
|
|
107
|
+
__append(__el0, __child(() => __props.children));
|
|
108
|
+
__exitChildren();
|
|
109
|
+
return __el0;
|
|
110
|
+
})();
|
|
111
|
+
__flushMountFrame();
|
|
112
|
+
return __mfResult0;
|
|
113
|
+
} catch (__mfErr) {
|
|
114
|
+
__discardMountFrame(__mfDepth);
|
|
115
|
+
throw __mfErr;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function ComposedTabsRoot(__props) {
|
|
119
|
+
const __mfDepth = __pushMountFrame();
|
|
120
|
+
try {
|
|
121
|
+
let select = function(value) {
|
|
122
|
+
activeValue.value = value;
|
|
123
|
+
__props.onValueChange?.(value);
|
|
124
|
+
}, getTriggerIdFor = function(value) {
|
|
125
|
+
return `${baseId}-trigger-${value}`;
|
|
126
|
+
}, getPanelIdFor = function(value) {
|
|
127
|
+
return `${baseId}-panel-${value}`;
|
|
128
|
+
};
|
|
129
|
+
const baseId = uniqueId("tabs");
|
|
130
|
+
const activeValue = signal(__props.defaultValue ?? "", "activeValue");
|
|
131
|
+
const ctx = {
|
|
132
|
+
activeValue,
|
|
133
|
+
classes: __props.classes,
|
|
134
|
+
orientation: __props.orientation ?? "horizontal",
|
|
135
|
+
select,
|
|
136
|
+
getTriggerIdFor,
|
|
137
|
+
getPanelIdFor
|
|
138
|
+
};
|
|
139
|
+
const __mfResult0 = TabsContext.Provider({ get value() {
|
|
140
|
+
return ctx;
|
|
141
|
+
}, children: () => (() => {
|
|
142
|
+
const __el0 = __element("div");
|
|
143
|
+
__el0.setAttribute("data-tabs-root", "");
|
|
144
|
+
__enterChildren(__el0);
|
|
145
|
+
__append(__el0, __child(() => __props.children));
|
|
146
|
+
__exitChildren();
|
|
147
|
+
return __el0;
|
|
148
|
+
})() });
|
|
149
|
+
__flushMountFrame();
|
|
150
|
+
return __mfResult0;
|
|
151
|
+
} catch (__mfErr) {
|
|
152
|
+
__discardMountFrame(__mfDepth);
|
|
153
|
+
throw __mfErr;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
var ComposedTabs = Object.assign(ComposedTabsRoot, {
|
|
157
|
+
List: TabsList,
|
|
158
|
+
Trigger: TabsTrigger,
|
|
159
|
+
Content: TabsContent
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export { ComposedTabs };
|
|
@@ -55,6 +55,22 @@ function createFloatingPosition(reference, floating, options = {}) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
function resolveLayoutElement(el) {
|
|
59
|
+
const style = globalThis.getComputedStyle?.(el);
|
|
60
|
+
if (style?.display !== "contents")
|
|
61
|
+
return el;
|
|
62
|
+
const queue = [...el.children];
|
|
63
|
+
while (queue.length > 0) {
|
|
64
|
+
const child = queue.shift();
|
|
65
|
+
if (!(child instanceof HTMLElement))
|
|
66
|
+
continue;
|
|
67
|
+
const childStyle = getComputedStyle(child);
|
|
68
|
+
if (childStyle.display !== "contents")
|
|
69
|
+
return child;
|
|
70
|
+
queue.push(...child.children);
|
|
71
|
+
}
|
|
72
|
+
return el;
|
|
73
|
+
}
|
|
58
74
|
function virtualElement(x, y) {
|
|
59
75
|
return {
|
|
60
76
|
getBoundingClientRect() {
|
|
@@ -75,4 +91,4 @@ function virtualElement(x, y) {
|
|
|
75
91
|
};
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
export { createFloatingPosition, virtualElement };
|
|
94
|
+
export { createFloatingPosition, resolveLayoutElement, virtualElement };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
linkedIds
|
|
6
|
+
} from "./chunk-8y1jf6xr.js";
|
|
7
|
+
|
|
8
|
+
// src/sheet/sheet-composed.tsx
|
|
9
|
+
import { computed, signal } from "@vertz/ui";
|
|
10
|
+
import { __append, __attr, __child, __conditional, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
11
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
12
|
+
var SheetContext = createContext(undefined, "@vertz/ui-primitives::SheetContext");
|
|
13
|
+
function useSheetContext(componentName) {
|
|
14
|
+
const ctx = useContext(SheetContext);
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
throw new Error(`<Sheet.${componentName}> must be used inside <Sheet>. ` + "Ensure it is a direct or nested child of the Sheet root component.");
|
|
17
|
+
}
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
function SheetTrigger(__props) {
|
|
21
|
+
const __mfDepth = __pushMountFrame();
|
|
22
|
+
try {
|
|
23
|
+
const ctx = useSheetContext("Trigger");
|
|
24
|
+
const __mfResult0 = (() => {
|
|
25
|
+
const __el0 = __element("span");
|
|
26
|
+
{
|
|
27
|
+
const __v = { display: "contents" };
|
|
28
|
+
if (__v != null && __v !== false)
|
|
29
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
30
|
+
}
|
|
31
|
+
__el0.setAttribute("data-sheet-trigger", "");
|
|
32
|
+
__el0.setAttribute("data-state", "closed");
|
|
33
|
+
__on(__el0, "click", () => ctx.toggle());
|
|
34
|
+
__enterChildren(__el0);
|
|
35
|
+
__append(__el0, __child(() => __props.children));
|
|
36
|
+
__exitChildren();
|
|
37
|
+
return __el0;
|
|
38
|
+
})();
|
|
39
|
+
__flushMountFrame();
|
|
40
|
+
return __mfResult0;
|
|
41
|
+
} catch (__mfErr) {
|
|
42
|
+
__discardMountFrame(__mfDepth);
|
|
43
|
+
throw __mfErr;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function SheetContent(__props) {
|
|
47
|
+
const __mfDepth = __pushMountFrame();
|
|
48
|
+
try {
|
|
49
|
+
const ctx = useSheetContext("Content");
|
|
50
|
+
const el = computed(() => (() => {
|
|
51
|
+
const __el0 = __element("dialog");
|
|
52
|
+
ctx.dialogRef.current = __el0;
|
|
53
|
+
{
|
|
54
|
+
const __v = ctx.contentId;
|
|
55
|
+
if (__v != null && __v !== false)
|
|
56
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
57
|
+
}
|
|
58
|
+
__el0.setAttribute("role", "dialog");
|
|
59
|
+
__el0.setAttribute("aria-modal", "true");
|
|
60
|
+
{
|
|
61
|
+
const __v = ctx.titleId;
|
|
62
|
+
if (__v != null && __v !== false)
|
|
63
|
+
__el0.setAttribute("aria-labelledby", __v === true ? "" : __v);
|
|
64
|
+
}
|
|
65
|
+
{
|
|
66
|
+
const __v = ctx.descriptionId;
|
|
67
|
+
if (__v != null && __v !== false)
|
|
68
|
+
__el0.setAttribute("aria-describedby", __v === true ? "" : __v);
|
|
69
|
+
}
|
|
70
|
+
{
|
|
71
|
+
const __v = ctx.side;
|
|
72
|
+
if (__v != null && __v !== false)
|
|
73
|
+
__el0.setAttribute("data-side", __v === true ? "" : __v);
|
|
74
|
+
}
|
|
75
|
+
__el0.setAttribute("data-state", "closed");
|
|
76
|
+
__attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
|
|
77
|
+
__on(__el0, "cancel", (e) => {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
ctx.close();
|
|
80
|
+
});
|
|
81
|
+
__on(__el0, "click", (e) => {
|
|
82
|
+
if (e.target === ctx.dialogRef.current)
|
|
83
|
+
ctx.close();
|
|
84
|
+
});
|
|
85
|
+
__enterChildren(__el0);
|
|
86
|
+
__append(__el0, __conditional(() => __props.showClose ?? true, () => (() => {
|
|
87
|
+
const __el1 = __element("button");
|
|
88
|
+
__el1.setAttribute("type", "button");
|
|
89
|
+
__el1.setAttribute("data-slot", "sheet-close");
|
|
90
|
+
{
|
|
91
|
+
const __v = cn(ctx.classes?.close);
|
|
92
|
+
if (__v != null && __v !== false)
|
|
93
|
+
__el1.setAttribute("class", __v === true ? "" : __v);
|
|
94
|
+
}
|
|
95
|
+
__el1.setAttribute("aria-label", "Close");
|
|
96
|
+
__on(__el1, "click", () => ctx.close());
|
|
97
|
+
__enterChildren(__el1);
|
|
98
|
+
__append(__el1, (() => {
|
|
99
|
+
const __el2 = __element("svg");
|
|
100
|
+
__el2.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
101
|
+
__el2.setAttribute("aria-hidden", "true");
|
|
102
|
+
__el2.setAttribute("focusable", "false");
|
|
103
|
+
__el2.setAttribute("width", "16");
|
|
104
|
+
__el2.setAttribute("height", "16");
|
|
105
|
+
__el2.setAttribute("viewBox", "0 0 24 24");
|
|
106
|
+
__el2.setAttribute("fill", "none");
|
|
107
|
+
__el2.setAttribute("stroke", "currentColor");
|
|
108
|
+
__el2.setAttribute("stroke-width", "2");
|
|
109
|
+
__el2.setAttribute("stroke-linecap", "round");
|
|
110
|
+
__el2.setAttribute("stroke-linejoin", "round");
|
|
111
|
+
__enterChildren(__el2);
|
|
112
|
+
__append(__el2, (() => {
|
|
113
|
+
const __el3 = __element("path");
|
|
114
|
+
__el3.setAttribute("d", "M18 6 6 18");
|
|
115
|
+
return __el3;
|
|
116
|
+
})());
|
|
117
|
+
__append(__el2, (() => {
|
|
118
|
+
const __el4 = __element("path");
|
|
119
|
+
__el4.setAttribute("d", "m6 6 12 12");
|
|
120
|
+
return __el4;
|
|
121
|
+
})());
|
|
122
|
+
__exitChildren();
|
|
123
|
+
return __el2;
|
|
124
|
+
})());
|
|
125
|
+
__exitChildren();
|
|
126
|
+
return __el1;
|
|
127
|
+
})(), () => null));
|
|
128
|
+
__append(__el0, __child(() => __props.children));
|
|
129
|
+
__exitChildren();
|
|
130
|
+
return __el0;
|
|
131
|
+
})());
|
|
132
|
+
const __mfResult0 = el.value;
|
|
133
|
+
__flushMountFrame();
|
|
134
|
+
return __mfResult0;
|
|
135
|
+
} catch (__mfErr) {
|
|
136
|
+
__discardMountFrame(__mfDepth);
|
|
137
|
+
throw __mfErr;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function SheetTitle(__props) {
|
|
141
|
+
const __mfDepth = __pushMountFrame();
|
|
142
|
+
try {
|
|
143
|
+
const ctx = useSheetContext("Title");
|
|
144
|
+
const __mfResult0 = (() => {
|
|
145
|
+
const __el0 = __element("h2");
|
|
146
|
+
{
|
|
147
|
+
const __v = ctx.titleId;
|
|
148
|
+
if (__v != null && __v !== false)
|
|
149
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
150
|
+
}
|
|
151
|
+
__attr(__el0, "class", () => cn(ctx.classes?.title, __props.className ?? __props.class));
|
|
152
|
+
__enterChildren(__el0);
|
|
153
|
+
__append(__el0, __child(() => __props.children));
|
|
154
|
+
__exitChildren();
|
|
155
|
+
return __el0;
|
|
156
|
+
})();
|
|
157
|
+
__flushMountFrame();
|
|
158
|
+
return __mfResult0;
|
|
159
|
+
} catch (__mfErr) {
|
|
160
|
+
__discardMountFrame(__mfDepth);
|
|
161
|
+
throw __mfErr;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function SheetDescription(__props) {
|
|
165
|
+
const __mfDepth = __pushMountFrame();
|
|
166
|
+
try {
|
|
167
|
+
const ctx = useSheetContext("Description");
|
|
168
|
+
const __mfResult0 = (() => {
|
|
169
|
+
const __el0 = __element("p");
|
|
170
|
+
{
|
|
171
|
+
const __v = ctx.descriptionId;
|
|
172
|
+
if (__v != null && __v !== false)
|
|
173
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
174
|
+
}
|
|
175
|
+
__attr(__el0, "class", () => cn(ctx.classes?.description, __props.className ?? __props.class));
|
|
176
|
+
__enterChildren(__el0);
|
|
177
|
+
__append(__el0, __child(() => __props.children));
|
|
178
|
+
__exitChildren();
|
|
179
|
+
return __el0;
|
|
180
|
+
})();
|
|
181
|
+
__flushMountFrame();
|
|
182
|
+
return __mfResult0;
|
|
183
|
+
} catch (__mfErr) {
|
|
184
|
+
__discardMountFrame(__mfDepth);
|
|
185
|
+
throw __mfErr;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function SheetClose(__props) {
|
|
189
|
+
const __mfDepth = __pushMountFrame();
|
|
190
|
+
try {
|
|
191
|
+
const ctx = useSheetContext("Close");
|
|
192
|
+
const __mfResult0 = (() => {
|
|
193
|
+
const __el0 = __element("button");
|
|
194
|
+
__el0.setAttribute("type", "button");
|
|
195
|
+
__el0.setAttribute("data-slot", "sheet-close");
|
|
196
|
+
__attr(__el0, "class", () => cn(ctx.classes?.close, __props.className ?? __props.class));
|
|
197
|
+
__attr(__el0, "aria-label", () => __props.children ? undefined : "Close");
|
|
198
|
+
__on(__el0, "click", () => ctx.close());
|
|
199
|
+
__enterChildren(__el0);
|
|
200
|
+
__append(__el0, __child(() => __props.children ?? "×"));
|
|
201
|
+
__exitChildren();
|
|
202
|
+
return __el0;
|
|
203
|
+
})();
|
|
204
|
+
__flushMountFrame();
|
|
205
|
+
return __mfResult0;
|
|
206
|
+
} catch (__mfErr) {
|
|
207
|
+
__discardMountFrame(__mfDepth);
|
|
208
|
+
throw __mfErr;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function ComposedSheetRoot(__props) {
|
|
212
|
+
const __mfDepth = __pushMountFrame();
|
|
213
|
+
try {
|
|
214
|
+
let showDialog = function() {
|
|
215
|
+
const el = dialogRef.current;
|
|
216
|
+
if (!el || el.open)
|
|
217
|
+
return;
|
|
218
|
+
el.setAttribute("data-state", "open");
|
|
219
|
+
el.showModal();
|
|
220
|
+
}, hideDialog = function() {
|
|
221
|
+
const el = dialogRef.current;
|
|
222
|
+
if (!el || !el.open)
|
|
223
|
+
return;
|
|
224
|
+
el.setAttribute("data-state", "closed");
|
|
225
|
+
el.offsetHeight;
|
|
226
|
+
const onEnd = () => {
|
|
227
|
+
el.removeEventListener("animationend", onEnd);
|
|
228
|
+
if (el.open)
|
|
229
|
+
el.close();
|
|
230
|
+
};
|
|
231
|
+
el.addEventListener("animationend", onEnd);
|
|
232
|
+
setTimeout(onEnd, 350);
|
|
233
|
+
}, open = function() {
|
|
234
|
+
isOpen.value = true;
|
|
235
|
+
showDialog();
|
|
236
|
+
__props.onOpenChange?.(true);
|
|
237
|
+
}, close = function() {
|
|
238
|
+
hideDialog();
|
|
239
|
+
isOpen.value = false;
|
|
240
|
+
__props.onOpenChange?.(false);
|
|
241
|
+
}, toggle = function() {
|
|
242
|
+
if (isOpen.value)
|
|
243
|
+
close();
|
|
244
|
+
else
|
|
245
|
+
open();
|
|
246
|
+
};
|
|
247
|
+
const ids = linkedIds("sheet");
|
|
248
|
+
const titleId = `${ids.contentId}-title`;
|
|
249
|
+
const descriptionId = `${ids.contentId}-description`;
|
|
250
|
+
const dialogRef = ref();
|
|
251
|
+
const isOpen = signal(false, "isOpen");
|
|
252
|
+
const ctx = {
|
|
253
|
+
isOpen,
|
|
254
|
+
titleId,
|
|
255
|
+
descriptionId,
|
|
256
|
+
contentId: ids.contentId,
|
|
257
|
+
dialogRef,
|
|
258
|
+
side: __props.side ?? "right",
|
|
259
|
+
classes: __props.classes,
|
|
260
|
+
open,
|
|
261
|
+
close,
|
|
262
|
+
toggle
|
|
263
|
+
};
|
|
264
|
+
const __mfResult0 = SheetContext.Provider({ get value() {
|
|
265
|
+
return ctx;
|
|
266
|
+
}, children: () => (() => {
|
|
267
|
+
const __el0 = __element("span");
|
|
268
|
+
{
|
|
269
|
+
const __v = { display: "contents" };
|
|
270
|
+
if (__v != null && __v !== false)
|
|
271
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
272
|
+
}
|
|
273
|
+
__el0.setAttribute("data-sheet-root", "");
|
|
274
|
+
__enterChildren(__el0);
|
|
275
|
+
__append(__el0, __child(() => __props.children));
|
|
276
|
+
__exitChildren();
|
|
277
|
+
return __el0;
|
|
278
|
+
})() });
|
|
279
|
+
__flushMountFrame();
|
|
280
|
+
return __mfResult0;
|
|
281
|
+
} catch (__mfErr) {
|
|
282
|
+
__discardMountFrame(__mfDepth);
|
|
283
|
+
throw __mfErr;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
var ComposedSheet = Object.assign(ComposedSheetRoot, {
|
|
287
|
+
Trigger: SheetTrigger,
|
|
288
|
+
Content: SheetContent,
|
|
289
|
+
Title: SheetTitle,
|
|
290
|
+
Description: SheetDescription,
|
|
291
|
+
Close: SheetClose
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export { ComposedSheet };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/empty-state/empty-state-composed.tsx
|
|
6
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __pushMountFrame } from "@vertz/ui/internals";
|
|
7
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
8
|
+
var EmptyStateContext = createContext(undefined, "@vertz/ui-primitives::EmptyStateContext");
|
|
9
|
+
function EmptyStateIcon(__props) {
|
|
10
|
+
const __mfDepth = __pushMountFrame();
|
|
11
|
+
try {
|
|
12
|
+
const ctx = useContext(EmptyStateContext);
|
|
13
|
+
const __mfResult0 = (() => {
|
|
14
|
+
const __el0 = __element("div");
|
|
15
|
+
__attr(__el0, "class", () => cn(ctx?.classes?.icon, __props.className ?? __props.class));
|
|
16
|
+
__enterChildren(__el0);
|
|
17
|
+
__append(__el0, __child(() => __props.children));
|
|
18
|
+
__exitChildren();
|
|
19
|
+
return __el0;
|
|
20
|
+
})();
|
|
21
|
+
__flushMountFrame();
|
|
22
|
+
return __mfResult0;
|
|
23
|
+
} catch (__mfErr) {
|
|
24
|
+
__discardMountFrame(__mfDepth);
|
|
25
|
+
throw __mfErr;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function EmptyStateTitle(__props) {
|
|
29
|
+
const __mfDepth = __pushMountFrame();
|
|
30
|
+
try {
|
|
31
|
+
const ctx = useContext(EmptyStateContext);
|
|
32
|
+
const __mfResult0 = (() => {
|
|
33
|
+
const __el0 = __element("h3");
|
|
34
|
+
__attr(__el0, "class", () => cn(ctx?.classes?.title, __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 EmptyStateDescription(__props) {
|
|
48
|
+
const __mfDepth = __pushMountFrame();
|
|
49
|
+
try {
|
|
50
|
+
const ctx = useContext(EmptyStateContext);
|
|
51
|
+
const __mfResult0 = (() => {
|
|
52
|
+
const __el0 = __element("p");
|
|
53
|
+
__attr(__el0, "class", () => cn(ctx?.classes?.description, __props.className ?? __props.class));
|
|
54
|
+
__enterChildren(__el0);
|
|
55
|
+
__append(__el0, __child(() => __props.children));
|
|
56
|
+
__exitChildren();
|
|
57
|
+
return __el0;
|
|
58
|
+
})();
|
|
59
|
+
__flushMountFrame();
|
|
60
|
+
return __mfResult0;
|
|
61
|
+
} catch (__mfErr) {
|
|
62
|
+
__discardMountFrame(__mfDepth);
|
|
63
|
+
throw __mfErr;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function EmptyStateAction(__props) {
|
|
67
|
+
const __mfDepth = __pushMountFrame();
|
|
68
|
+
try {
|
|
69
|
+
const ctx = useContext(EmptyStateContext);
|
|
70
|
+
const __mfResult0 = (() => {
|
|
71
|
+
const __el0 = __element("div");
|
|
72
|
+
__attr(__el0, "class", () => cn(ctx?.classes?.action, __props.className ?? __props.class));
|
|
73
|
+
__enterChildren(__el0);
|
|
74
|
+
__append(__el0, __child(() => __props.children));
|
|
75
|
+
__exitChildren();
|
|
76
|
+
return __el0;
|
|
77
|
+
})();
|
|
78
|
+
__flushMountFrame();
|
|
79
|
+
return __mfResult0;
|
|
80
|
+
} catch (__mfErr) {
|
|
81
|
+
__discardMountFrame(__mfDepth);
|
|
82
|
+
throw __mfErr;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function ComposedEmptyStateRoot(__props) {
|
|
86
|
+
const __mfDepth = __pushMountFrame();
|
|
87
|
+
try {
|
|
88
|
+
const __mfResult0 = EmptyStateContext.Provider({ get value() {
|
|
89
|
+
return { classes: __props.classes };
|
|
90
|
+
}, children: () => (() => {
|
|
91
|
+
const __el0 = __element("div");
|
|
92
|
+
__attr(__el0, "class", () => cn(__props.classes?.root, __props.className ?? __props.class));
|
|
93
|
+
__enterChildren(__el0);
|
|
94
|
+
__append(__el0, __child(() => __props.children));
|
|
95
|
+
__exitChildren();
|
|
96
|
+
return __el0;
|
|
97
|
+
})() });
|
|
98
|
+
__flushMountFrame();
|
|
99
|
+
return __mfResult0;
|
|
100
|
+
} catch (__mfErr) {
|
|
101
|
+
__discardMountFrame(__mfDepth);
|
|
102
|
+
throw __mfErr;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
var ComposedEmptyState = Object.assign(ComposedEmptyStateRoot, {
|
|
106
|
+
Icon: EmptyStateIcon,
|
|
107
|
+
Title: EmptyStateTitle,
|
|
108
|
+
Description: EmptyStateDescription,
|
|
109
|
+
Action: EmptyStateAction
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export { ComposedEmptyState };
|