@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,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
isKey
|
|
7
|
+
} from "./chunk-7867pr13.js";
|
|
8
|
+
import {
|
|
9
|
+
uniqueId
|
|
10
|
+
} from "./chunk-8y1jf6xr.js";
|
|
11
|
+
|
|
12
|
+
// src/switch/switch-composed.tsx
|
|
13
|
+
import { signal } from "@vertz/ui";
|
|
14
|
+
import { __append, __attr, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
15
|
+
function ComposedSwitchRoot(__props) {
|
|
16
|
+
const __mfDepth = __pushMountFrame();
|
|
17
|
+
try {
|
|
18
|
+
let toggle = function() {
|
|
19
|
+
if (__props.disabled ?? false)
|
|
20
|
+
return;
|
|
21
|
+
checked.value = !checked.value;
|
|
22
|
+
__props.onCheckedChange?.(checked.value);
|
|
23
|
+
};
|
|
24
|
+
const checked = signal(__props.defaultChecked ?? false, "checked");
|
|
25
|
+
const __mfResult0 = (() => {
|
|
26
|
+
const __el0 = __element("button");
|
|
27
|
+
__el0.setAttribute("data-v-id", "ComposedSwitchRoot");
|
|
28
|
+
__el0.setAttribute("type", "button");
|
|
29
|
+
__el0.setAttribute("role", "switch");
|
|
30
|
+
{
|
|
31
|
+
const __v = uniqueId("switch");
|
|
32
|
+
if (__v != null && __v !== false)
|
|
33
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
34
|
+
}
|
|
35
|
+
__attr(__el0, "aria-checked", () => checked.value ? "true" : "false");
|
|
36
|
+
__attr(__el0, "data-state", () => checked.value ? "checked" : "unchecked");
|
|
37
|
+
__attr(__el0, "disabled", () => __props.disabled ?? false);
|
|
38
|
+
__attr(__el0, "aria-disabled", () => __props.disabled ?? false ? "true" : undefined);
|
|
39
|
+
__attr(__el0, "class", () => cn(__props.classes?.root));
|
|
40
|
+
__on(__el0, "click", toggle);
|
|
41
|
+
__on(__el0, "keydown", (e) => {
|
|
42
|
+
if (isKey(e, Keys.Space)) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
toggle();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
__enterChildren(__el0);
|
|
48
|
+
__append(__el0, (() => {
|
|
49
|
+
const __el1 = __element("span");
|
|
50
|
+
__el1.setAttribute("data-part", "thumb");
|
|
51
|
+
__attr(__el1, "data-state", () => checked.value ? "checked" : "unchecked");
|
|
52
|
+
__attr(__el1, "class", () => cn(__props.classes?.thumb));
|
|
53
|
+
return __el1;
|
|
54
|
+
})());
|
|
55
|
+
__exitChildren();
|
|
56
|
+
return __el0;
|
|
57
|
+
})();
|
|
58
|
+
__flushMountFrame();
|
|
59
|
+
return __mfResult0;
|
|
60
|
+
} catch (__mfErr) {
|
|
61
|
+
__discardMountFrame(__mfDepth);
|
|
62
|
+
throw __mfErr;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var ComposedSwitch = ComposedSwitchRoot;
|
|
66
|
+
|
|
67
|
+
export { ComposedSwitch };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
isKey
|
|
7
|
+
} from "./chunk-7867pr13.js";
|
|
8
|
+
import {
|
|
9
|
+
uniqueId
|
|
10
|
+
} from "./chunk-8y1jf6xr.js";
|
|
11
|
+
|
|
12
|
+
// src/radio/radio-composed.tsx
|
|
13
|
+
import { computed, signal } from "@vertz/ui";
|
|
14
|
+
import { __append, __attr, __child, __conditional, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
15
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
16
|
+
var RadioGroupContext = createContext(undefined, "@vertz/ui-primitives::RadioGroupContext");
|
|
17
|
+
function RadioGroupItem(__props) {
|
|
18
|
+
const __mfDepth = __pushMountFrame();
|
|
19
|
+
try {
|
|
20
|
+
const ctx = useContext(RadioGroupContext);
|
|
21
|
+
if (!ctx) {
|
|
22
|
+
throw new Error("<RadioGroup.Item> must be used inside <RadioGroup>. " + "Ensure it is a direct or nested child of the RadioGroup root component.");
|
|
23
|
+
}
|
|
24
|
+
const isDisabled = computed(() => __props.disabled ?? false);
|
|
25
|
+
const isChecked = computed(() => ctx.isSelected(__props.value));
|
|
26
|
+
const __mfResult0 = (() => {
|
|
27
|
+
const __el0 = __element("div");
|
|
28
|
+
{
|
|
29
|
+
const __v = { display: "flex", alignItems: "center", gap: "0.5rem", cursor: "pointer" };
|
|
30
|
+
if (__v != null && __v !== false)
|
|
31
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
32
|
+
}
|
|
33
|
+
__el0.setAttribute("data-radiogroup-item", "");
|
|
34
|
+
__on(__el0, "click", () => {
|
|
35
|
+
if (!isDisabled.value)
|
|
36
|
+
ctx.select(__props.value);
|
|
37
|
+
});
|
|
38
|
+
__enterChildren(__el0);
|
|
39
|
+
__append(__el0, (() => {
|
|
40
|
+
const __el1 = __element("div");
|
|
41
|
+
__el1.setAttribute("role", "radio");
|
|
42
|
+
__attr(__el1, "data-value", () => __props.value);
|
|
43
|
+
__attr(__el1, "aria-checked", () => isChecked.value ? "true" : "false");
|
|
44
|
+
__attr(__el1, "data-state", () => isChecked.value ? "checked" : "unchecked");
|
|
45
|
+
__attr(__el1, "tabindex", () => isChecked.value ? "0" : "-1");
|
|
46
|
+
__attr(__el1, "aria-disabled", () => isDisabled.value ? "true" : undefined);
|
|
47
|
+
__attr(__el1, "class", () => cn(ctx.classes?.item));
|
|
48
|
+
__attr(__el1, "style", () => ({ pointerEvents: isDisabled.value ? "none" : undefined, position: "relative" }));
|
|
49
|
+
__enterChildren(__el1);
|
|
50
|
+
__append(__el1, (() => {
|
|
51
|
+
const __el2 = __element("span");
|
|
52
|
+
__el2.setAttribute("data-part", "indicator");
|
|
53
|
+
__attr(__el2, "data-state", () => isChecked.value ? "checked" : "unchecked");
|
|
54
|
+
__attr(__el2, "class", () => cn(ctx.classes?.indicator));
|
|
55
|
+
__enterChildren(__el2);
|
|
56
|
+
__append(__el2, (() => {
|
|
57
|
+
const __el3 = __element("span");
|
|
58
|
+
__el3.setAttribute("data-part", "indicator-icon");
|
|
59
|
+
__attr(__el3, "class", () => cn(ctx.classes?.indicatorIcon));
|
|
60
|
+
return __el3;
|
|
61
|
+
})());
|
|
62
|
+
__exitChildren();
|
|
63
|
+
return __el2;
|
|
64
|
+
})());
|
|
65
|
+
__exitChildren();
|
|
66
|
+
return __el1;
|
|
67
|
+
})());
|
|
68
|
+
__append(__el0, __conditional(() => __props.children, () => (() => {
|
|
69
|
+
const __el4 = __element("span");
|
|
70
|
+
__enterChildren(__el4);
|
|
71
|
+
__append(__el4, __child(() => __props.children));
|
|
72
|
+
__exitChildren();
|
|
73
|
+
return __el4;
|
|
74
|
+
})(), () => null));
|
|
75
|
+
__exitChildren();
|
|
76
|
+
return __el0;
|
|
77
|
+
})();
|
|
78
|
+
__flushMountFrame();
|
|
79
|
+
return __mfResult0;
|
|
80
|
+
} catch (__mfErr) {
|
|
81
|
+
__discardMountFrame(__mfDepth);
|
|
82
|
+
throw __mfErr;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function ComposedRadioGroupRoot(__props) {
|
|
86
|
+
const __mfDepth = __pushMountFrame();
|
|
87
|
+
try {
|
|
88
|
+
let select = function(value) {
|
|
89
|
+
selectedValue.value = value;
|
|
90
|
+
__props.onValueChange?.(value);
|
|
91
|
+
};
|
|
92
|
+
const selectedValue = signal(__props.defaultValue ?? "", "selectedValue");
|
|
93
|
+
const ctx = {
|
|
94
|
+
isSelected: (value) => selectedValue.value === value,
|
|
95
|
+
classes: __props.classes,
|
|
96
|
+
select
|
|
97
|
+
};
|
|
98
|
+
const __mfResult0 = RadioGroupContext.Provider({ get value() {
|
|
99
|
+
return ctx;
|
|
100
|
+
}, children: () => (() => {
|
|
101
|
+
const __el0 = __element("div");
|
|
102
|
+
__el0.setAttribute("role", "radiogroup");
|
|
103
|
+
{
|
|
104
|
+
const __v = uniqueId("radiogroup");
|
|
105
|
+
if (__v != null && __v !== false)
|
|
106
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
107
|
+
}
|
|
108
|
+
__attr(__el0, "class", () => cn(__props.classes?.root));
|
|
109
|
+
__el0.setAttribute("data-radiogroup-root", "");
|
|
110
|
+
__on(__el0, "keydown", (event) => {
|
|
111
|
+
const root = event.currentTarget;
|
|
112
|
+
const items = [...root.querySelectorAll('[role="radio"]')];
|
|
113
|
+
const currentIdx = items.indexOf(document.activeElement);
|
|
114
|
+
if (currentIdx < 0)
|
|
115
|
+
return;
|
|
116
|
+
const len = items.length;
|
|
117
|
+
let nextIdx = -1;
|
|
118
|
+
if (isKey(event, Keys.ArrowDown, Keys.ArrowRight)) {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
nextIdx = (currentIdx + 1) % len;
|
|
121
|
+
} else if (isKey(event, Keys.ArrowUp, Keys.ArrowLeft)) {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
nextIdx = (currentIdx - 1 + len) % len;
|
|
124
|
+
} else if (isKey(event, Keys.Home)) {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
nextIdx = 0;
|
|
127
|
+
} else if (isKey(event, Keys.End)) {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
nextIdx = len - 1;
|
|
130
|
+
}
|
|
131
|
+
if (nextIdx < 0)
|
|
132
|
+
return;
|
|
133
|
+
const direction = isKey(event, Keys.End, Keys.ArrowUp, Keys.ArrowLeft) ? -1 : 1;
|
|
134
|
+
const startIdx = nextIdx;
|
|
135
|
+
while (items[nextIdx]?.getAttribute("aria-disabled") === "true") {
|
|
136
|
+
nextIdx = (nextIdx + direction + len) % len;
|
|
137
|
+
if (nextIdx === startIdx)
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const nextValue = items[nextIdx]?.getAttribute("data-value");
|
|
141
|
+
if (nextValue != null) {
|
|
142
|
+
select(nextValue);
|
|
143
|
+
items[nextIdx]?.focus();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
__enterChildren(__el0);
|
|
147
|
+
__append(__el0, __child(() => __props.children));
|
|
148
|
+
__exitChildren();
|
|
149
|
+
return __el0;
|
|
150
|
+
})() });
|
|
151
|
+
__flushMountFrame();
|
|
152
|
+
return __mfResult0;
|
|
153
|
+
} catch (__mfErr) {
|
|
154
|
+
__discardMountFrame(__mfDepth);
|
|
155
|
+
throw __mfErr;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
var ComposedRadioGroup = Object.assign(ComposedRadioGroupRoot, {
|
|
159
|
+
Item: RadioGroupItem
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export { ComposedRadioGroup };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/form-group/form-group-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 FormGroupContext = createContext(undefined, "@vertz/ui-primitives::FormGroupContext");
|
|
9
|
+
function FormError(__props) {
|
|
10
|
+
const __mfDepth = __pushMountFrame();
|
|
11
|
+
try {
|
|
12
|
+
const ctx = useContext(FormGroupContext);
|
|
13
|
+
const __mfResult0 = (() => {
|
|
14
|
+
const __el0 = __element("span");
|
|
15
|
+
__attr(__el0, "class", () => cn(ctx?.classes?.error, __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 ComposedFormGroupRoot(__props) {
|
|
29
|
+
const __mfDepth = __pushMountFrame();
|
|
30
|
+
try {
|
|
31
|
+
const __mfResult0 = FormGroupContext.Provider({ get value() {
|
|
32
|
+
return { classes: __props.classes };
|
|
33
|
+
}, children: () => (() => {
|
|
34
|
+
const __el0 = __element("div");
|
|
35
|
+
__attr(__el0, "class", () => cn(__props.classes?.base, __props.className ?? __props.class));
|
|
36
|
+
__enterChildren(__el0);
|
|
37
|
+
__append(__el0, __child(() => __props.children));
|
|
38
|
+
__exitChildren();
|
|
39
|
+
return __el0;
|
|
40
|
+
})() });
|
|
41
|
+
__flushMountFrame();
|
|
42
|
+
return __mfResult0;
|
|
43
|
+
} catch (__mfErr) {
|
|
44
|
+
__discardMountFrame(__mfDepth);
|
|
45
|
+
throw __mfErr;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var ComposedFormGroup = Object.assign(ComposedFormGroupRoot, {
|
|
49
|
+
FormError
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export { ComposedFormGroup };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-2db2dnp3.js";
|
|
4
4
|
|
|
5
5
|
// src/scroll-area/scroll-area.tsx
|
|
6
|
-
import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
6
|
+
import { __append, __conditional, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
7
7
|
import { signal } from "@vertz/ui";
|
|
8
8
|
function ScrollAreaRoot(options = {}) {
|
|
9
9
|
const __mfDepth = __pushMountFrame();
|
|
@@ -122,6 +122,8 @@ function ScrollAreaRoot(options = {}) {
|
|
|
122
122
|
const __el4 = __element("div");
|
|
123
123
|
return __el4;
|
|
124
124
|
})();
|
|
125
|
+
const showY = orientation === "vertical" || orientation === "both";
|
|
126
|
+
const showX = orientation === "horizontal" || orientation === "both";
|
|
125
127
|
const viewport = (() => {
|
|
126
128
|
const __el5 = __element("div");
|
|
127
129
|
{
|
|
@@ -145,13 +147,11 @@ function ScrollAreaRoot(options = {}) {
|
|
|
145
147
|
}
|
|
146
148
|
__enterChildren(__el6);
|
|
147
149
|
__insert(__el6, viewport);
|
|
150
|
+
__append(__el6, __conditional(() => showY, () => scrollbarY, () => null));
|
|
151
|
+
__append(__el6, __conditional(() => showX, () => scrollbarX, () => null));
|
|
148
152
|
__exitChildren();
|
|
149
153
|
return __el6;
|
|
150
154
|
})();
|
|
151
|
-
if (orientation === "vertical" || orientation === "both")
|
|
152
|
-
root.appendChild(scrollbarY);
|
|
153
|
-
if (orientation === "horizontal" || orientation === "both")
|
|
154
|
-
root.appendChild(scrollbarX);
|
|
155
155
|
applyAttrs(root, attrs);
|
|
156
156
|
const __mfResult0 = { root, viewport, content, scrollbarY, thumbY, scrollbarX, thumbX, state, update };
|
|
157
157
|
__flushMountFrame();
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
handleListNavigation,
|
|
7
|
+
isKey
|
|
8
|
+
} from "./chunk-7867pr13.js";
|
|
9
|
+
import {
|
|
10
|
+
setDataState,
|
|
11
|
+
setExpanded,
|
|
12
|
+
setHidden,
|
|
13
|
+
setHiddenAnimated
|
|
14
|
+
} from "./chunk-vevfhpc9.js";
|
|
15
|
+
import {
|
|
16
|
+
uniqueId
|
|
17
|
+
} from "./chunk-8y1jf6xr.js";
|
|
18
|
+
|
|
19
|
+
// src/accordion/accordion-composed.tsx
|
|
20
|
+
import { computed, signal } from "@vertz/ui";
|
|
21
|
+
import { __append, __attr, __child, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
22
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
23
|
+
var AccordionContext = createContext(undefined, "@vertz/ui-primitives::AccordionContext");
|
|
24
|
+
var AccordionItemContext = createContext(undefined, "@vertz/ui-primitives::AccordionItemContext");
|
|
25
|
+
function useAccordionContext(componentName) {
|
|
26
|
+
const ctx = useContext(AccordionContext);
|
|
27
|
+
if (!ctx) {
|
|
28
|
+
throw new Error(`<Accordion.${componentName}> must be used inside <Accordion>. ` + "Ensure it is a direct or nested child of the Accordion root component.");
|
|
29
|
+
}
|
|
30
|
+
return ctx;
|
|
31
|
+
}
|
|
32
|
+
function AccordionItem(__props) {
|
|
33
|
+
const __mfDepth = __pushMountFrame();
|
|
34
|
+
try {
|
|
35
|
+
const ctx = useAccordionContext("Item");
|
|
36
|
+
const baseId = uniqueId("accordion");
|
|
37
|
+
const triggerId = `${baseId}-trigger`;
|
|
38
|
+
const contentId = `${baseId}-content`;
|
|
39
|
+
const contentRef = ref();
|
|
40
|
+
const triggerRef = ref();
|
|
41
|
+
const itemCtx = {
|
|
42
|
+
value: __props.value,
|
|
43
|
+
triggerId,
|
|
44
|
+
contentId,
|
|
45
|
+
contentRef,
|
|
46
|
+
triggerRef,
|
|
47
|
+
classes: ctx.classes,
|
|
48
|
+
isOpen: () => ctx.isOpen(__props.value),
|
|
49
|
+
toggle: () => {
|
|
50
|
+
const prevHeight = contentRef.current?.scrollHeight ?? 0;
|
|
51
|
+
ctx.toggle(__props.value);
|
|
52
|
+
const nowOpen = ctx.isOpen(__props.value);
|
|
53
|
+
const contentEl = contentRef.current;
|
|
54
|
+
if (contentEl) {
|
|
55
|
+
if (nowOpen) {
|
|
56
|
+
setHidden(contentEl, false);
|
|
57
|
+
const height = contentEl.scrollHeight;
|
|
58
|
+
contentEl.style.setProperty("--accordion-content-height", `${height}px`);
|
|
59
|
+
setDataState(contentEl, "open");
|
|
60
|
+
} else {
|
|
61
|
+
contentEl.style.display = "";
|
|
62
|
+
contentEl.setAttribute("aria-hidden", "false");
|
|
63
|
+
contentEl.setAttribute("data-state", "open");
|
|
64
|
+
contentEl.style.setProperty("--accordion-content-height", `${prevHeight}px`);
|
|
65
|
+
contentEl.offsetHeight;
|
|
66
|
+
setDataState(contentEl, "closed");
|
|
67
|
+
setHiddenAnimated(contentEl, true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const triggerEl = triggerRef.current;
|
|
71
|
+
if (triggerEl) {
|
|
72
|
+
setExpanded(triggerEl, nowOpen);
|
|
73
|
+
setDataState(triggerEl, nowOpen ? "open" : "closed");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const __mfResult0 = AccordionItemContext.Provider({ get value() {
|
|
78
|
+
return itemCtx;
|
|
79
|
+
}, children: () => (() => {
|
|
80
|
+
const __el0 = __element("div");
|
|
81
|
+
__el0.setAttribute("data-accordion-item", "");
|
|
82
|
+
__attr(__el0, "data-value", () => __props.value);
|
|
83
|
+
{
|
|
84
|
+
const __v = cn(ctx.classes?.item);
|
|
85
|
+
if (__v != null && __v !== false)
|
|
86
|
+
__el0.setAttribute("class", __v === true ? "" : __v);
|
|
87
|
+
}
|
|
88
|
+
__enterChildren(__el0);
|
|
89
|
+
__append(__el0, __child(() => __props.children));
|
|
90
|
+
__exitChildren();
|
|
91
|
+
return __el0;
|
|
92
|
+
})() });
|
|
93
|
+
__flushMountFrame();
|
|
94
|
+
return __mfResult0;
|
|
95
|
+
} catch (__mfErr) {
|
|
96
|
+
__discardMountFrame(__mfDepth);
|
|
97
|
+
throw __mfErr;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function AccordionTrigger(__props) {
|
|
101
|
+
const __mfDepth = __pushMountFrame();
|
|
102
|
+
try {
|
|
103
|
+
const ctx = useContext(AccordionItemContext);
|
|
104
|
+
if (!ctx) {
|
|
105
|
+
throw new Error("<Accordion.Trigger> must be used inside <Accordion.Item>. " + "Ensure it is a direct or nested child of an Accordion Item component.");
|
|
106
|
+
}
|
|
107
|
+
const initiallyOpen = computed(() => ctx.isOpen());
|
|
108
|
+
const __mfResult0 = (() => {
|
|
109
|
+
const __el0 = __element("button");
|
|
110
|
+
ctx.triggerRef.current = __el0;
|
|
111
|
+
__el0.setAttribute("type", "button");
|
|
112
|
+
__attr(__el0, "id", () => ctx.triggerId);
|
|
113
|
+
__el0.setAttribute("data-accordion-trigger", "");
|
|
114
|
+
__attr(__el0, "aria-controls", () => ctx.contentId);
|
|
115
|
+
__attr(__el0, "data-value", () => ctx.value);
|
|
116
|
+
__attr(__el0, "aria-expanded", () => initiallyOpen.value ? "true" : "false");
|
|
117
|
+
__attr(__el0, "data-state", () => initiallyOpen.value ? "open" : "closed");
|
|
118
|
+
__attr(__el0, "class", () => cn(ctx.classes?.trigger, __props.className ?? __props.class));
|
|
119
|
+
__on(__el0, "click", () => ctx.toggle());
|
|
120
|
+
__enterChildren(__el0);
|
|
121
|
+
__append(__el0, __child(() => __props.children));
|
|
122
|
+
__exitChildren();
|
|
123
|
+
return __el0;
|
|
124
|
+
})();
|
|
125
|
+
__flushMountFrame();
|
|
126
|
+
return __mfResult0;
|
|
127
|
+
} catch (__mfErr) {
|
|
128
|
+
__discardMountFrame(__mfDepth);
|
|
129
|
+
throw __mfErr;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function AccordionContent(__props) {
|
|
133
|
+
const __mfDepth = __pushMountFrame();
|
|
134
|
+
try {
|
|
135
|
+
const ctx = useContext(AccordionItemContext);
|
|
136
|
+
if (!ctx) {
|
|
137
|
+
throw new Error("<Accordion.Content> must be used inside <Accordion.Item>. " + "Ensure it is a direct or nested child of an Accordion Item component.");
|
|
138
|
+
}
|
|
139
|
+
const el = computed(() => (() => {
|
|
140
|
+
const __el0 = __element("div");
|
|
141
|
+
ctx.contentRef.current = __el0;
|
|
142
|
+
__el0.setAttribute("role", "region");
|
|
143
|
+
__attr(__el0, "id", () => ctx.contentId);
|
|
144
|
+
__el0.setAttribute("data-accordion-content", "");
|
|
145
|
+
__attr(__el0, "aria-labelledby", () => ctx.triggerId);
|
|
146
|
+
__attr(__el0, "class", () => cn(ctx.classes?.content, __props.className ?? __props.class));
|
|
147
|
+
__enterChildren(__el0);
|
|
148
|
+
__append(__el0, (() => {
|
|
149
|
+
const __el1 = __element("div");
|
|
150
|
+
__el1.setAttribute("data-part", "content-inner");
|
|
151
|
+
__enterChildren(__el1);
|
|
152
|
+
__append(__el1, __child(() => __props.children));
|
|
153
|
+
__exitChildren();
|
|
154
|
+
return __el1;
|
|
155
|
+
})());
|
|
156
|
+
__exitChildren();
|
|
157
|
+
return __el0;
|
|
158
|
+
})());
|
|
159
|
+
const isOpen = computed(() => ctx.isOpen());
|
|
160
|
+
el.value.setAttribute("aria-hidden", isOpen.value ? "false" : "true");
|
|
161
|
+
el.value.setAttribute("data-state", isOpen.value ? "open" : "closed");
|
|
162
|
+
if (!isOpen.value)
|
|
163
|
+
el.value.style.display = "none";
|
|
164
|
+
const __mfResult0 = el.value;
|
|
165
|
+
__flushMountFrame();
|
|
166
|
+
return __mfResult0;
|
|
167
|
+
} catch (__mfErr) {
|
|
168
|
+
__discardMountFrame(__mfDepth);
|
|
169
|
+
throw __mfErr;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function ComposedAccordionRoot(__props) {
|
|
173
|
+
const __mfDepth = __pushMountFrame();
|
|
174
|
+
try {
|
|
175
|
+
const multiple = computed(() => __props.type === "multiple");
|
|
176
|
+
const openValues = signal([...__props.defaultValue ?? []], "openValues");
|
|
177
|
+
const ctx = {
|
|
178
|
+
classes: __props.classes,
|
|
179
|
+
isOpen: (value) => openValues.value.includes(value),
|
|
180
|
+
toggle: (value) => {
|
|
181
|
+
const current = [...openValues.value];
|
|
182
|
+
const idx = current.indexOf(value);
|
|
183
|
+
if (idx >= 0) {
|
|
184
|
+
current.splice(idx, 1);
|
|
185
|
+
} else {
|
|
186
|
+
if (multiple.value) {
|
|
187
|
+
current.push(value);
|
|
188
|
+
} else {
|
|
189
|
+
current.length = 0;
|
|
190
|
+
current.push(value);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
openValues.value = current;
|
|
194
|
+
__props.onValueChange?.(current);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const __mfResult0 = AccordionContext.Provider({ get value() {
|
|
198
|
+
return ctx;
|
|
199
|
+
}, children: () => (() => {
|
|
200
|
+
const __el0 = __element("div");
|
|
201
|
+
__el0.setAttribute("data-orientation", "vertical");
|
|
202
|
+
__el0.setAttribute("data-accordion-root", "");
|
|
203
|
+
__on(__el0, "keydown", (event) => {
|
|
204
|
+
if (isKey(event, Keys.ArrowUp, Keys.ArrowDown, Keys.Home, Keys.End)) {
|
|
205
|
+
const root = event.currentTarget;
|
|
206
|
+
const triggers = [...root.querySelectorAll("[data-accordion-trigger]")];
|
|
207
|
+
handleListNavigation(event, triggers, { orientation: "vertical" });
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
__enterChildren(__el0);
|
|
211
|
+
__append(__el0, __child(() => __props.children));
|
|
212
|
+
__exitChildren();
|
|
213
|
+
return __el0;
|
|
214
|
+
})() });
|
|
215
|
+
__flushMountFrame();
|
|
216
|
+
return __mfResult0;
|
|
217
|
+
} catch (__mfErr) {
|
|
218
|
+
__discardMountFrame(__mfDepth);
|
|
219
|
+
throw __mfErr;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
var ComposedAccordion = Object.assign(ComposedAccordionRoot, {
|
|
223
|
+
Item: AccordionItem,
|
|
224
|
+
Trigger: AccordionTrigger,
|
|
225
|
+
Content: AccordionContent
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export { ComposedAccordion };
|
|
@@ -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 };
|