@vertz/ui-primitives 0.2.41 → 0.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/chunk-06m8prfg.js +52 -0
- package/dist/shared/chunk-0n9jj8xr.js +24 -0
- package/dist/shared/chunk-1ben27xq.js +317 -0
- package/dist/shared/chunk-1j2mj0sa.js +45 -0
- package/dist/shared/chunk-250hj18f.js +243 -0
- package/dist/shared/chunk-2h4m9c71.js +38 -0
- package/dist/shared/chunk-2sbx20hv.js +128 -0
- package/dist/shared/chunk-2ye674gr.js +70 -0
- package/dist/shared/chunk-34d8385y.js +15 -0
- package/dist/shared/chunk-4d7bm8h0.js +113 -0
- package/dist/shared/chunk-4zjgxr7x.js +157 -0
- package/dist/shared/chunk-5c150wvr.js +140 -0
- package/dist/shared/chunk-5gycdypd.js +58 -0
- package/dist/shared/chunk-6mm7fhp8.js +105 -0
- package/dist/shared/chunk-6zmnqvh6.js +109 -0
- package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
- package/dist/shared/chunk-7pbff2hg.js +118 -0
- package/dist/shared/chunk-7zpjshwz.js +194 -0
- package/dist/shared/chunk-993ff51d.js +155 -0
- package/dist/shared/chunk-9pdt5aw7.js +24 -0
- package/dist/shared/chunk-a71m4xkv.js +106 -0
- package/dist/shared/chunk-aj8m39pk.js +127 -0
- package/dist/shared/chunk-ajawpc05.js +305 -0
- package/dist/shared/chunk-b7mzwqhj.js +125 -0
- package/dist/shared/chunk-bb887de4.js +200 -0
- package/dist/shared/chunk-bfsmbrxc.js +111 -0
- package/dist/shared/chunk-c2f63m5n.js +56 -0
- package/dist/shared/chunk-c5r3s5km.js +263 -0
- package/dist/shared/chunk-caba5bhd.js +427 -0
- package/dist/shared/chunk-crym07yc.js +264 -0
- package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
- package/dist/shared/chunk-d6rtejz3.js +128 -0
- package/dist/shared/chunk-dvaf0bmq.js +140 -0
- package/dist/shared/chunk-dwkv9ya6.js +22 -0
- package/dist/shared/chunk-e0ckxrjg.js +41 -0
- package/dist/shared/chunk-ennxcymj.js +225 -0
- package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
- package/dist/shared/chunk-f0v1gs5e.js +52 -0
- package/dist/shared/chunk-f86rsf84.js +231 -0
- package/dist/shared/{chunk-3sahbk4d.js → chunk-fdse46x5.js} +6 -1
- package/dist/shared/chunk-gj4hrssn.js +135 -0
- package/dist/shared/chunk-gyvq4gk9.js +24 -0
- package/dist/shared/chunk-hbnps9sq.js +229 -0
- package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
- package/dist/shared/chunk-hgnkd4he.js +256 -0
- package/dist/shared/chunk-hpcyffm7.js +185 -0
- package/dist/shared/chunk-hpmvwx0h.js +99 -0
- package/dist/shared/chunk-hz0e504p.js +69 -0
- package/dist/shared/chunk-hzk4wfq9.js +43 -0
- package/dist/shared/chunk-j7znzkpa.js +48 -0
- package/dist/shared/chunk-j9kxgrnn.js +167 -0
- package/dist/shared/chunk-jetwnv0w.js +130 -0
- package/dist/shared/chunk-jjdg26c1.js +155 -0
- package/dist/shared/chunk-k0m4yh86.js +123 -0
- package/dist/shared/chunk-k43q9cjr.js +82 -0
- package/dist/shared/chunk-k9k8tbr5.js +119 -0
- package/dist/shared/chunk-meaj7br1.js +232 -0
- package/dist/shared/chunk-mgj0n08k.js +34 -0
- package/dist/shared/chunk-mjz4rp6c.js +46 -0
- package/dist/shared/chunk-n4rr5gme.js +239 -0
- package/dist/shared/chunk-nk55etpp.js +65 -0
- package/dist/shared/chunk-nkh1ks3k.js +264 -0
- package/dist/shared/chunk-pgvpvbpe.js +26 -0
- package/dist/shared/chunk-pma8gnv7.js +178 -0
- package/dist/shared/chunk-q7xv6xze.js +131 -0
- package/dist/shared/chunk-qey801nq.js +22 -0
- package/dist/shared/chunk-s6b4c3tj.js +58 -0
- package/dist/shared/chunk-sq27a4h0.js +36 -0
- package/dist/shared/chunk-taa5pj15.js +103 -0
- package/dist/shared/chunk-tc5rpvyx.js +127 -0
- package/dist/shared/chunk-tescm0b3.js +192 -0
- package/dist/shared/chunk-tkftdwnq.js +71 -0
- package/dist/shared/chunk-tqhnjcfp.js +116 -0
- package/dist/shared/chunk-vfknb5ht.js +183 -0
- package/dist/shared/chunk-vsc369w3.js +185 -0
- package/dist/shared/chunk-whq9s8v5.js +301 -0
- package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
- package/dist/shared/chunk-yzbmkx4r.js +155 -0
- package/dist/shared/chunk-zaen0ajc.js +347 -0
- package/dist/src/accordion/accordion-composed.js +1 -1
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/avatar/avatar-composed.js +1 -1
- package/dist/src/badge/badge-composed.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
- package/dist/src/button/button-composed.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar-composed.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.js +1 -1
- package/dist/src/carousel/carousel-composed.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible-composed.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox-composed.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.js +1 -1
- package/dist/src/context-menu/context-menu-composed.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.js +1 -1
- package/dist/src/dialog/dialog-stack-parts.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.js +1 -1
- package/dist/src/form-group/form-group-composed.js +1 -1
- package/dist/src/hover-card/hover-card-composed.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/input/input-composed.js +1 -1
- package/dist/src/label/label-composed.js +1 -1
- package/dist/src/list/list-composed.js +1 -1
- package/dist/src/menu/menu-composed.js +1 -1
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.js +1 -1
- package/dist/src/popover/popover-composed.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio-composed.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.js +1 -1
- package/dist/src/sheet/sheet-composed.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/skeleton/skeleton-composed.js +1 -1
- package/dist/src/slider/slider-composed.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch-composed.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/table/table-composed.js +1 -1
- package/dist/src/tabs/tabs-composed.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.js +1 -1
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group-composed.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-144kbnmx.js +0 -95
- package/dist/shared/chunk-1ewxfgsa.js +0 -167
- package/dist/shared/chunk-1hm0mbke.js +0 -258
- package/dist/shared/chunk-22rt6ws9.js +0 -69
- package/dist/shared/chunk-2ssqz188.js +0 -162
- package/dist/shared/chunk-33he7ay9.js +0 -218
- package/dist/shared/chunk-3jack97k.js +0 -509
- package/dist/shared/chunk-75pegjs7.js +0 -26
- package/dist/shared/chunk-862x7dja.js +0 -398
- package/dist/shared/chunk-8pk1pn5h.js +0 -215
- package/dist/shared/chunk-8t0nm721.js +0 -152
- package/dist/shared/chunk-94twh4s4.js +0 -28
- package/dist/shared/chunk-9yb26c0w.js +0 -232
- package/dist/shared/chunk-a82r2pnq.js +0 -67
- package/dist/shared/chunk-axpbdpgx.js +0 -177
- package/dist/shared/chunk-b3j6mym6.js +0 -203
- package/dist/shared/chunk-b4zzg457.js +0 -410
- package/dist/shared/chunk-b9qxfcsy.js +0 -60
- package/dist/shared/chunk-bc2qqkhr.js +0 -194
- package/dist/shared/chunk-bv12nkdm.js +0 -149
- package/dist/shared/chunk-bvxc1ww4.js +0 -164
- package/dist/shared/chunk-czv0kqj4.js +0 -107
- package/dist/shared/chunk-d83ag07h.js +0 -189
- package/dist/shared/chunk-de18ashk.js +0 -134
- package/dist/shared/chunk-dvk4h36t.js +0 -140
- package/dist/shared/chunk-dxvnerw2.js +0 -353
- package/dist/shared/chunk-e399pzdq.js +0 -241
- package/dist/shared/chunk-e4qha9as.js +0 -180
- package/dist/shared/chunk-eb2d9v6k.js +0 -68
- package/dist/shared/chunk-ect26sp5.js +0 -353
- package/dist/shared/chunk-ev367pq3.js +0 -102
- package/dist/shared/chunk-fjykbv0v.js +0 -214
- package/dist/shared/chunk-gdddk6nh.js +0 -96
- package/dist/shared/chunk-ghkw5bjq.js +0 -55
- package/dist/shared/chunk-hfjtkytb.js +0 -310
- package/dist/shared/chunk-hpvjfj0j.js +0 -31
- package/dist/shared/chunk-jpyjk616.js +0 -52
- package/dist/shared/chunk-k6d53tne.js +0 -206
- package/dist/shared/chunk-knzg86am.js +0 -168
- package/dist/shared/chunk-ktbf6xrt.js +0 -179
- package/dist/shared/chunk-m8y2p66x.js +0 -252
- package/dist/shared/chunk-metxdt5x.js +0 -28
- package/dist/shared/chunk-mgae1d93.js +0 -157
- package/dist/shared/chunk-mtx2cfbx.js +0 -175
- package/dist/shared/chunk-n436p5cb.js +0 -260
- package/dist/shared/chunk-nj420k31.js +0 -54
- package/dist/shared/chunk-nsmvdxgp.js +0 -213
- package/dist/shared/chunk-pcms04vq.js +0 -162
- package/dist/shared/chunk-pqskzq8t.js +0 -79
- package/dist/shared/chunk-pwr60kyd.js +0 -321
- package/dist/shared/chunk-pzknpa1y.js +0 -327
- package/dist/shared/chunk-q77y3rg4.js +0 -189
- package/dist/shared/chunk-qhnany7w.js +0 -179
- package/dist/shared/chunk-rdr0rtpr.js +0 -131
- package/dist/shared/chunk-rj52ty6r.js +0 -147
- package/dist/shared/chunk-rnqc7735.js +0 -125
- package/dist/shared/chunk-rtk30950.js +0 -202
- package/dist/shared/chunk-s0xgd8vg.js +0 -266
- package/dist/shared/chunk-s415735j.js +0 -357
- package/dist/shared/chunk-s62e7jf4.js +0 -30
- package/dist/shared/chunk-snd8e6r8.js +0 -418
- package/dist/shared/chunk-spng4yb9.js +0 -73
- package/dist/shared/chunk-t887wwjc.js +0 -168
- package/dist/shared/chunk-tn0m98j8.js +0 -42
- package/dist/shared/chunk-v0b5pkcq.js +0 -30
- package/dist/shared/chunk-v5tj7veh.js +0 -284
- package/dist/shared/chunk-vkscwzpr.js +0 -294
- package/dist/shared/chunk-vv187snj.js +0 -112
- package/dist/shared/chunk-xv4wd0kf.js +0 -293
- package/dist/shared/chunk-y1hpsqzy.js +0 -185
- package/dist/shared/chunk-yfzddvxc.js +0 -71
- package/dist/shared/chunk-yzgzx2dh.js +0 -311
- package/dist/shared/chunk-z5j7ztf2.js +0 -467
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
uniqueId
|
|
3
|
+
} from "./chunk-8y1jf6xr.js";
|
|
4
|
+
import {
|
|
5
|
+
setDataState
|
|
6
|
+
} from "./chunk-vevfhpc9.js";
|
|
7
|
+
import {
|
|
8
|
+
applyAttrs
|
|
9
|
+
} from "./chunk-2db2dnp3.js";
|
|
10
|
+
|
|
11
|
+
// src/progress/progress.tsx
|
|
12
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
13
|
+
import { ref, signal } from "@vertz/ui";
|
|
14
|
+
function dataStateFor(pct) {
|
|
15
|
+
if (pct >= 100)
|
|
16
|
+
return "complete";
|
|
17
|
+
if (pct > 0)
|
|
18
|
+
return "loading";
|
|
19
|
+
return "idle";
|
|
20
|
+
}
|
|
21
|
+
function ProgressBar(defaultValue, min, max, initialPct, indicatorRef) {
|
|
22
|
+
return jsxDEV_7x81h0kn("div", {
|
|
23
|
+
role: "progressbar",
|
|
24
|
+
id: uniqueId("progress"),
|
|
25
|
+
"aria-valuenow": String(defaultValue),
|
|
26
|
+
"aria-valuemin": String(min),
|
|
27
|
+
"aria-valuemax": String(max),
|
|
28
|
+
"data-state": dataStateFor(initialPct),
|
|
29
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
30
|
+
ref: indicatorRef,
|
|
31
|
+
"data-part": "indicator",
|
|
32
|
+
style: { width: `${initialPct}%` }
|
|
33
|
+
}, undefined, false, undefined, this)
|
|
34
|
+
}, undefined, false, undefined, this);
|
|
35
|
+
}
|
|
36
|
+
function ProgressRoot(options = {}) {
|
|
37
|
+
const { defaultValue = 0, min = 0, max = 100, ...attrs } = options;
|
|
38
|
+
const state = { value: signal(defaultValue) };
|
|
39
|
+
const indicatorRef = ref();
|
|
40
|
+
const initialPct = (defaultValue - min) / (max - min) * 100;
|
|
41
|
+
const root = ProgressBar(defaultValue, min, max, initialPct, indicatorRef);
|
|
42
|
+
const indicator = indicatorRef.current;
|
|
43
|
+
applyAttrs(root, attrs);
|
|
44
|
+
function setValue(val) {
|
|
45
|
+
const clamped = Math.min(max, Math.max(min, val));
|
|
46
|
+
state.value.value = clamped;
|
|
47
|
+
root.setAttribute("aria-valuenow", String(clamped));
|
|
48
|
+
const pct = (clamped - min) / (max - min) * 100;
|
|
49
|
+
indicator.style.width = `${pct}%`;
|
|
50
|
+
setDataState(root, dataStateFor(pct));
|
|
51
|
+
}
|
|
52
|
+
return { root, indicator, state, setValue };
|
|
53
|
+
}
|
|
54
|
+
var Progress = {
|
|
55
|
+
Root: ProgressRoot
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { Progress };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setRovingTabindex
|
|
3
|
+
} from "./chunk-e2v1c9ex.js";
|
|
4
|
+
import {
|
|
5
|
+
uniqueId
|
|
6
|
+
} from "./chunk-8y1jf6xr.js";
|
|
7
|
+
import {
|
|
8
|
+
handleListNavigation
|
|
9
|
+
} from "./chunk-7867pr13.js";
|
|
10
|
+
import {
|
|
11
|
+
setChecked,
|
|
12
|
+
setDataState,
|
|
13
|
+
setDisabled
|
|
14
|
+
} from "./chunk-vevfhpc9.js";
|
|
15
|
+
import {
|
|
16
|
+
applyAttrs
|
|
17
|
+
} from "./chunk-2db2dnp3.js";
|
|
18
|
+
|
|
19
|
+
// src/radio/radio.tsx
|
|
20
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
21
|
+
import { signal } from "@vertz/ui";
|
|
22
|
+
function RadioGroup(items, itemValues, selectItem) {
|
|
23
|
+
return jsxDEV_7x81h0kn("div", {
|
|
24
|
+
role: "radiogroup",
|
|
25
|
+
id: uniqueId("radiogroup"),
|
|
26
|
+
onKeydown: (event) => {
|
|
27
|
+
const result = handleListNavigation(event, items, { orientation: "vertical" });
|
|
28
|
+
if (result) {
|
|
29
|
+
const idx = items.indexOf(result);
|
|
30
|
+
if (idx >= 0) {
|
|
31
|
+
const val = itemValues[idx];
|
|
32
|
+
if (val !== undefined)
|
|
33
|
+
selectItem(val);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, undefined, false, undefined, this);
|
|
38
|
+
}
|
|
39
|
+
function RadioItem(value, label, isActive, disabled, selectItem) {
|
|
40
|
+
const el = jsxDEV_7x81h0kn("div", {
|
|
41
|
+
role: "radio",
|
|
42
|
+
id: uniqueId("radio"),
|
|
43
|
+
"data-value": value,
|
|
44
|
+
"aria-checked": isActive ? "true" : "false",
|
|
45
|
+
"data-state": isActive ? "checked" : "unchecked",
|
|
46
|
+
onClick: () => {
|
|
47
|
+
if (!disabled)
|
|
48
|
+
selectItem(value);
|
|
49
|
+
},
|
|
50
|
+
children: label ?? value
|
|
51
|
+
}, undefined, false, undefined, this);
|
|
52
|
+
if (disabled) {
|
|
53
|
+
setDisabled(el, true);
|
|
54
|
+
el.setAttribute("data-disabled", "");
|
|
55
|
+
}
|
|
56
|
+
return el;
|
|
57
|
+
}
|
|
58
|
+
function RadioRoot(options = {}) {
|
|
59
|
+
const { defaultValue = "", onValueChange, ...attrs } = options;
|
|
60
|
+
const state = { value: signal(defaultValue) };
|
|
61
|
+
const items = [];
|
|
62
|
+
const itemValues = [];
|
|
63
|
+
function selectItem(value) {
|
|
64
|
+
state.value.value = value;
|
|
65
|
+
for (let i = 0;i < items.length; i++) {
|
|
66
|
+
const item = items[i];
|
|
67
|
+
if (!item)
|
|
68
|
+
continue;
|
|
69
|
+
const isActive = itemValues[i] === value;
|
|
70
|
+
setChecked(item, isActive);
|
|
71
|
+
setDataState(item, isActive ? "checked" : "unchecked");
|
|
72
|
+
}
|
|
73
|
+
setRovingTabindex(items, itemValues.indexOf(value));
|
|
74
|
+
onValueChange?.(value);
|
|
75
|
+
}
|
|
76
|
+
const root = RadioGroup(items, itemValues, selectItem);
|
|
77
|
+
const cleanups = [];
|
|
78
|
+
function Item(value, label, itemOptions) {
|
|
79
|
+
const isActive = value === state.value.peek();
|
|
80
|
+
const disabled = itemOptions?.disabled ?? false;
|
|
81
|
+
const item = RadioItem(value, label, isActive, disabled, selectItem);
|
|
82
|
+
const handleClick = () => {
|
|
83
|
+
if (!disabled)
|
|
84
|
+
item.focus();
|
|
85
|
+
};
|
|
86
|
+
item.addEventListener("click", handleClick);
|
|
87
|
+
cleanups.push(() => item.removeEventListener("click", handleClick));
|
|
88
|
+
items.push(item);
|
|
89
|
+
itemValues.push(value);
|
|
90
|
+
setRovingTabindex(items, itemValues.indexOf(state.value.peek()));
|
|
91
|
+
return item;
|
|
92
|
+
}
|
|
93
|
+
function destroy() {
|
|
94
|
+
for (const cleanup of cleanups)
|
|
95
|
+
cleanup();
|
|
96
|
+
cleanups.length = 0;
|
|
97
|
+
}
|
|
98
|
+
applyAttrs(root, attrs);
|
|
99
|
+
return { root, state, Item, destroy };
|
|
100
|
+
}
|
|
101
|
+
var Radio = {
|
|
102
|
+
Root: RadioRoot
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { Radio };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
linkedIds
|
|
6
|
+
} from "./chunk-8y1jf6xr.js";
|
|
7
|
+
import {
|
|
8
|
+
setDataState,
|
|
9
|
+
setExpanded,
|
|
10
|
+
setHidden,
|
|
11
|
+
setHiddenAnimated
|
|
12
|
+
} from "./chunk-vevfhpc9.js";
|
|
13
|
+
|
|
14
|
+
// src/collapsible/collapsible-composed.tsx
|
|
15
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
16
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
17
|
+
var CollapsibleContext = createContext(undefined, "@vertz/ui-primitives::CollapsibleContext");
|
|
18
|
+
function useCollapsibleContext(componentName) {
|
|
19
|
+
const ctx = useContext(CollapsibleContext);
|
|
20
|
+
if (!ctx) {
|
|
21
|
+
throw new Error(`<Collapsible.${componentName}> must be used inside <Collapsible>. ` + "Ensure it is a direct or nested child of the Collapsible root component.");
|
|
22
|
+
}
|
|
23
|
+
return ctx;
|
|
24
|
+
}
|
|
25
|
+
function CollapsibleTrigger({ children, className: cls, class: classProp }) {
|
|
26
|
+
const ctx = useCollapsibleContext("Trigger");
|
|
27
|
+
return jsxDEV_7x81h0kn("button", {
|
|
28
|
+
ref: ctx.triggerRef,
|
|
29
|
+
type: "button",
|
|
30
|
+
id: ctx.ids.triggerId,
|
|
31
|
+
"aria-controls": ctx.ids.contentId,
|
|
32
|
+
"aria-expanded": ctx.defaultOpen ? "true" : "false",
|
|
33
|
+
"data-state": ctx.defaultOpen ? "open" : "closed",
|
|
34
|
+
disabled: ctx.disabled,
|
|
35
|
+
"aria-disabled": ctx.disabled ? "true" : undefined,
|
|
36
|
+
class: cn(ctx.classes?.trigger, cls ?? classProp),
|
|
37
|
+
onClick: ctx.toggle,
|
|
38
|
+
children
|
|
39
|
+
}, undefined, false, undefined, this);
|
|
40
|
+
}
|
|
41
|
+
function CollapsibleContent({ children, className: cls, class: classProp }) {
|
|
42
|
+
const ctx = useCollapsibleContext("Content");
|
|
43
|
+
return jsxDEV_7x81h0kn("div", {
|
|
44
|
+
ref: ctx.contentRef,
|
|
45
|
+
id: ctx.ids.contentId,
|
|
46
|
+
"data-part": "collapsible-content",
|
|
47
|
+
"aria-hidden": ctx.defaultOpen ? "false" : "true",
|
|
48
|
+
"data-state": ctx.defaultOpen ? "open" : "closed",
|
|
49
|
+
style: { display: ctx.defaultOpen ? "" : "none" },
|
|
50
|
+
class: cn(ctx.classes?.content, cls ?? classProp),
|
|
51
|
+
children
|
|
52
|
+
}, undefined, false, undefined, this);
|
|
53
|
+
}
|
|
54
|
+
function ComposedCollapsibleRoot({
|
|
55
|
+
children,
|
|
56
|
+
classes,
|
|
57
|
+
defaultOpen = false,
|
|
58
|
+
disabled = false,
|
|
59
|
+
onOpenChange
|
|
60
|
+
}) {
|
|
61
|
+
const ids = linkedIds("collapsible");
|
|
62
|
+
const triggerRef = ref();
|
|
63
|
+
const contentRef = ref();
|
|
64
|
+
let isOpen = defaultOpen;
|
|
65
|
+
function toggle() {
|
|
66
|
+
if (disabled)
|
|
67
|
+
return;
|
|
68
|
+
const contentEl = contentRef.current;
|
|
69
|
+
const triggerEl = triggerRef.current;
|
|
70
|
+
if (!contentEl || !triggerEl)
|
|
71
|
+
return;
|
|
72
|
+
isOpen = !isOpen;
|
|
73
|
+
if (isOpen) {
|
|
74
|
+
setHidden(contentEl, false);
|
|
75
|
+
}
|
|
76
|
+
const height = contentEl.scrollHeight;
|
|
77
|
+
contentEl.style.setProperty("--collapsible-content-height", `${height}px`);
|
|
78
|
+
setExpanded(triggerEl, isOpen);
|
|
79
|
+
setDataState(triggerEl, isOpen ? "open" : "closed");
|
|
80
|
+
setDataState(contentEl, isOpen ? "open" : "closed");
|
|
81
|
+
if (!isOpen) {
|
|
82
|
+
setHiddenAnimated(contentEl, true);
|
|
83
|
+
}
|
|
84
|
+
onOpenChange?.(isOpen);
|
|
85
|
+
}
|
|
86
|
+
const ctx = {
|
|
87
|
+
ids,
|
|
88
|
+
triggerRef,
|
|
89
|
+
contentRef,
|
|
90
|
+
classes,
|
|
91
|
+
disabled,
|
|
92
|
+
defaultOpen,
|
|
93
|
+
toggle
|
|
94
|
+
};
|
|
95
|
+
return jsxDEV_7x81h0kn("div", {
|
|
96
|
+
"data-part": "collapsible",
|
|
97
|
+
class: cn(classes?.root),
|
|
98
|
+
children: jsxDEV_7x81h0kn(CollapsibleContext.Provider, {
|
|
99
|
+
value: ctx,
|
|
100
|
+
children
|
|
101
|
+
}, undefined, false, undefined, this)
|
|
102
|
+
}, undefined, false, undefined, this);
|
|
103
|
+
}
|
|
104
|
+
var ComposedCollapsible = Object.assign(ComposedCollapsibleRoot, {
|
|
105
|
+
Trigger: CollapsibleTrigger,
|
|
106
|
+
Content: CollapsibleContent
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export { ComposedCollapsible };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
uniqueId
|
|
6
|
+
} from "./chunk-8y1jf6xr.js";
|
|
7
|
+
import {
|
|
8
|
+
handleListNavigation
|
|
9
|
+
} from "./chunk-7867pr13.js";
|
|
10
|
+
|
|
11
|
+
// src/tabs/tabs-composed.tsx
|
|
12
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
13
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
14
|
+
var TabsContext = createContext(undefined, "@vertz/ui-primitives::TabsContext");
|
|
15
|
+
function useTabsContext(componentName) {
|
|
16
|
+
const ctx = useContext(TabsContext);
|
|
17
|
+
if (!ctx) {
|
|
18
|
+
throw new Error(`<Tabs.${componentName}> must be used inside <Tabs>. ` + "Ensure it is a direct or nested child of the Tabs root component.");
|
|
19
|
+
}
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
function TabsList({ children, className: cls, class: classProp }) {
|
|
23
|
+
const ctx = useTabsContext("List");
|
|
24
|
+
return jsxDEV_7x81h0kn("div", {
|
|
25
|
+
role: "tablist",
|
|
26
|
+
"data-tabs-list": "",
|
|
27
|
+
"aria-orientation": ctx.orientation === "vertical" ? "vertical" : undefined,
|
|
28
|
+
class: cn(ctx.classes?.list, cls ?? classProp),
|
|
29
|
+
onKeydown: (event) => {
|
|
30
|
+
const list = event.currentTarget;
|
|
31
|
+
const triggers = [...list.querySelectorAll('[role="tab"]')];
|
|
32
|
+
const result = handleListNavigation(event, triggers, { orientation: ctx.orientation });
|
|
33
|
+
if (result) {
|
|
34
|
+
const value = result.getAttribute("data-value");
|
|
35
|
+
if (value)
|
|
36
|
+
ctx.select(value);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
children
|
|
40
|
+
}, undefined, false, undefined, this);
|
|
41
|
+
}
|
|
42
|
+
function TabsTrigger({ value, children, className: cls, class: classProp }) {
|
|
43
|
+
const ctx = useTabsContext("Trigger");
|
|
44
|
+
const isActive = ctx.activeValue === value;
|
|
45
|
+
return jsxDEV_7x81h0kn("button", {
|
|
46
|
+
type: "button",
|
|
47
|
+
role: "tab",
|
|
48
|
+
id: ctx.getTriggerIdFor(value),
|
|
49
|
+
"data-tabs-trigger": "",
|
|
50
|
+
"data-value": value,
|
|
51
|
+
"aria-controls": ctx.getPanelIdFor(value),
|
|
52
|
+
"aria-selected": isActive ? "true" : "false",
|
|
53
|
+
"data-state": isActive ? "active" : "inactive",
|
|
54
|
+
tabindex: isActive ? "0" : "-1",
|
|
55
|
+
class: cn(ctx.classes?.trigger, cls ?? classProp),
|
|
56
|
+
onClick: () => ctx.select(value),
|
|
57
|
+
children
|
|
58
|
+
}, undefined, false, undefined, this);
|
|
59
|
+
}
|
|
60
|
+
function TabsContent({ value, children, className: cls, class: classProp }) {
|
|
61
|
+
const ctx = useTabsContext("Content");
|
|
62
|
+
const isActive = ctx.activeValue === value;
|
|
63
|
+
return jsxDEV_7x81h0kn("div", {
|
|
64
|
+
role: "tabpanel",
|
|
65
|
+
id: ctx.getPanelIdFor(value),
|
|
66
|
+
"data-tabs-panel": "",
|
|
67
|
+
"data-value": value,
|
|
68
|
+
"aria-labelledby": ctx.getTriggerIdFor(value),
|
|
69
|
+
tabindex: "0",
|
|
70
|
+
"aria-hidden": isActive ? "false" : "true",
|
|
71
|
+
"data-state": isActive ? "active" : "inactive",
|
|
72
|
+
style: { display: isActive ? "" : "none" },
|
|
73
|
+
class: cn(ctx.classes?.panel, cls ?? classProp),
|
|
74
|
+
children
|
|
75
|
+
}, undefined, false, undefined, this);
|
|
76
|
+
}
|
|
77
|
+
function ComposedTabsRoot({
|
|
78
|
+
children,
|
|
79
|
+
classes,
|
|
80
|
+
defaultValue = "",
|
|
81
|
+
onValueChange,
|
|
82
|
+
orientation = "horizontal"
|
|
83
|
+
}) {
|
|
84
|
+
const baseId = uniqueId("tabs");
|
|
85
|
+
let activeValue = defaultValue;
|
|
86
|
+
function select(value) {
|
|
87
|
+
activeValue = value;
|
|
88
|
+
onValueChange?.(value);
|
|
89
|
+
}
|
|
90
|
+
function getTriggerIdFor(value) {
|
|
91
|
+
return `${baseId}-trigger-${value}`;
|
|
92
|
+
}
|
|
93
|
+
function getPanelIdFor(value) {
|
|
94
|
+
return `${baseId}-panel-${value}`;
|
|
95
|
+
}
|
|
96
|
+
const ctx = {
|
|
97
|
+
activeValue,
|
|
98
|
+
classes,
|
|
99
|
+
orientation,
|
|
100
|
+
select,
|
|
101
|
+
getTriggerIdFor,
|
|
102
|
+
getPanelIdFor
|
|
103
|
+
};
|
|
104
|
+
return jsxDEV_7x81h0kn(TabsContext.Provider, {
|
|
105
|
+
value: ctx,
|
|
106
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
107
|
+
"data-tabs-root": "",
|
|
108
|
+
children
|
|
109
|
+
}, undefined, false, undefined, this)
|
|
110
|
+
}, undefined, false, undefined, this);
|
|
111
|
+
}
|
|
112
|
+
var ComposedTabs = Object.assign(ComposedTabsRoot, {
|
|
113
|
+
List: TabsList,
|
|
114
|
+
Trigger: TabsTrigger,
|
|
115
|
+
Content: TabsContent
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export { ComposedTabs };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
import {
|
|
5
|
+
linkedIds
|
|
6
|
+
} from "./chunk-8y1jf6xr.js";
|
|
7
|
+
|
|
8
|
+
// src/alert-dialog/alert-dialog-composed.tsx
|
|
9
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
10
|
+
import { createContext, ref, useContext } from "@vertz/ui";
|
|
11
|
+
var AlertDialogContext = createContext(undefined, "@vertz/ui-primitives::AlertDialogContext");
|
|
12
|
+
function useAlertDialogContext(componentName) {
|
|
13
|
+
const ctx = useContext(AlertDialogContext);
|
|
14
|
+
if (!ctx) {
|
|
15
|
+
throw new Error(`<AlertDialog.${componentName}> must be used inside <AlertDialog>. ` + "Ensure it is a direct or nested child of the AlertDialog root component.");
|
|
16
|
+
}
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
19
|
+
function AlertDialogTrigger({ children }) {
|
|
20
|
+
const ctx = useAlertDialogContext("Trigger");
|
|
21
|
+
return jsxDEV_7x81h0kn("span", {
|
|
22
|
+
style: { display: "contents" },
|
|
23
|
+
"data-alertdialog-trigger": "",
|
|
24
|
+
"data-state": "closed",
|
|
25
|
+
onClick: () => {
|
|
26
|
+
if (!ctx.isOpen)
|
|
27
|
+
ctx.open();
|
|
28
|
+
},
|
|
29
|
+
children
|
|
30
|
+
}, undefined, false, undefined, this);
|
|
31
|
+
}
|
|
32
|
+
function AlertDialogContent({ children, className: cls, class: classProp }) {
|
|
33
|
+
const ctx = useAlertDialogContext("Content");
|
|
34
|
+
return jsxDEV_7x81h0kn("dialog", {
|
|
35
|
+
ref: ctx.dialogRef,
|
|
36
|
+
id: ctx.contentId,
|
|
37
|
+
role: "alertdialog",
|
|
38
|
+
"aria-labelledby": ctx.titleId,
|
|
39
|
+
"aria-describedby": ctx.descriptionId,
|
|
40
|
+
"data-state": "closed",
|
|
41
|
+
class: cn(ctx.classes?.content, cls ?? classProp),
|
|
42
|
+
onCancel: (e) => {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
},
|
|
45
|
+
children
|
|
46
|
+
}, undefined, false, undefined, this);
|
|
47
|
+
}
|
|
48
|
+
function AlertDialogTitle({ children, className: cls, class: classProp }) {
|
|
49
|
+
const ctx = useAlertDialogContext("Title");
|
|
50
|
+
return jsxDEV_7x81h0kn("h2", {
|
|
51
|
+
id: ctx.titleId,
|
|
52
|
+
"data-slot": "alertdialog-title",
|
|
53
|
+
class: cn(ctx.classes?.title, cls ?? classProp),
|
|
54
|
+
children
|
|
55
|
+
}, undefined, false, undefined, this);
|
|
56
|
+
}
|
|
57
|
+
function AlertDialogDescription({ children, className: cls, class: classProp }) {
|
|
58
|
+
const ctx = useAlertDialogContext("Description");
|
|
59
|
+
return jsxDEV_7x81h0kn("p", {
|
|
60
|
+
id: ctx.descriptionId,
|
|
61
|
+
"data-slot": "alertdialog-description",
|
|
62
|
+
class: cn(ctx.classes?.description, cls ?? classProp),
|
|
63
|
+
children
|
|
64
|
+
}, undefined, false, undefined, this);
|
|
65
|
+
}
|
|
66
|
+
function AlertDialogHeader({ children, className: cls, class: classProp }) {
|
|
67
|
+
const { classes } = useAlertDialogContext("Header");
|
|
68
|
+
return jsxDEV_7x81h0kn("div", {
|
|
69
|
+
class: cn(classes?.header, cls ?? classProp),
|
|
70
|
+
children
|
|
71
|
+
}, undefined, false, undefined, this);
|
|
72
|
+
}
|
|
73
|
+
function AlertDialogFooter({ children, className: cls, class: classProp }) {
|
|
74
|
+
const { classes } = useAlertDialogContext("Footer");
|
|
75
|
+
return jsxDEV_7x81h0kn("div", {
|
|
76
|
+
class: cn(classes?.footer, cls ?? classProp),
|
|
77
|
+
children
|
|
78
|
+
}, undefined, false, undefined, this);
|
|
79
|
+
}
|
|
80
|
+
function AlertDialogCancel({
|
|
81
|
+
children,
|
|
82
|
+
className: cls,
|
|
83
|
+
class: classProp,
|
|
84
|
+
onClick,
|
|
85
|
+
disabled
|
|
86
|
+
}) {
|
|
87
|
+
const ctx = useAlertDialogContext("Cancel");
|
|
88
|
+
return jsxDEV_7x81h0kn("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
"data-slot": "alertdialog-cancel",
|
|
91
|
+
class: cn(ctx.classes?.cancel, cls ?? classProp),
|
|
92
|
+
onClick: () => {
|
|
93
|
+
onClick?.();
|
|
94
|
+
ctx.close();
|
|
95
|
+
},
|
|
96
|
+
disabled,
|
|
97
|
+
children
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
}
|
|
100
|
+
function AlertDialogAction({
|
|
101
|
+
children,
|
|
102
|
+
className: cls,
|
|
103
|
+
class: classProp,
|
|
104
|
+
onClick,
|
|
105
|
+
disabled
|
|
106
|
+
}) {
|
|
107
|
+
const ctx = useAlertDialogContext("Action");
|
|
108
|
+
return jsxDEV_7x81h0kn("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
"data-slot": "alertdialog-action",
|
|
111
|
+
class: cn(ctx.classes?.action, cls ?? classProp),
|
|
112
|
+
onClick: () => {
|
|
113
|
+
onClick?.();
|
|
114
|
+
ctx.onAction?.();
|
|
115
|
+
ctx.close();
|
|
116
|
+
},
|
|
117
|
+
disabled,
|
|
118
|
+
children
|
|
119
|
+
}, undefined, false, undefined, this);
|
|
120
|
+
}
|
|
121
|
+
function ComposedAlertDialogRoot({
|
|
122
|
+
children,
|
|
123
|
+
classes,
|
|
124
|
+
onOpenChange,
|
|
125
|
+
onAction
|
|
126
|
+
}) {
|
|
127
|
+
const ids = linkedIds("alertdialog");
|
|
128
|
+
const titleId = `${ids.contentId}-title`;
|
|
129
|
+
const descriptionId = `${ids.contentId}-description`;
|
|
130
|
+
const dialogRef = ref();
|
|
131
|
+
let isOpen = false;
|
|
132
|
+
function showDialog() {
|
|
133
|
+
const el = dialogRef.current;
|
|
134
|
+
if (!el || el.open)
|
|
135
|
+
return;
|
|
136
|
+
el.setAttribute("data-state", "open");
|
|
137
|
+
el.showModal();
|
|
138
|
+
}
|
|
139
|
+
function hideDialog() {
|
|
140
|
+
const el = dialogRef.current;
|
|
141
|
+
if (!el || !el.open)
|
|
142
|
+
return;
|
|
143
|
+
el.setAttribute("data-state", "closed");
|
|
144
|
+
el.offsetHeight;
|
|
145
|
+
const onEnd = () => {
|
|
146
|
+
el.removeEventListener("animationend", onEnd);
|
|
147
|
+
if (el.open)
|
|
148
|
+
el.close();
|
|
149
|
+
};
|
|
150
|
+
el.addEventListener("animationend", onEnd);
|
|
151
|
+
setTimeout(onEnd, 200);
|
|
152
|
+
}
|
|
153
|
+
function open() {
|
|
154
|
+
isOpen = true;
|
|
155
|
+
showDialog();
|
|
156
|
+
onOpenChange?.(true);
|
|
157
|
+
}
|
|
158
|
+
function close() {
|
|
159
|
+
hideDialog();
|
|
160
|
+
isOpen = false;
|
|
161
|
+
onOpenChange?.(false);
|
|
162
|
+
}
|
|
163
|
+
const ctx = {
|
|
164
|
+
isOpen,
|
|
165
|
+
titleId,
|
|
166
|
+
descriptionId,
|
|
167
|
+
contentId: ids.contentId,
|
|
168
|
+
dialogRef,
|
|
169
|
+
classes,
|
|
170
|
+
onAction,
|
|
171
|
+
open,
|
|
172
|
+
close
|
|
173
|
+
};
|
|
174
|
+
return jsxDEV_7x81h0kn(AlertDialogContext.Provider, {
|
|
175
|
+
value: ctx,
|
|
176
|
+
children: jsxDEV_7x81h0kn("span", {
|
|
177
|
+
style: { display: "contents" },
|
|
178
|
+
"data-alertdialog-root": "",
|
|
179
|
+
children
|
|
180
|
+
}, undefined, false, undefined, this)
|
|
181
|
+
}, undefined, false, undefined, this);
|
|
182
|
+
}
|
|
183
|
+
var ComposedAlertDialog = Object.assign(ComposedAlertDialogRoot, {
|
|
184
|
+
Trigger: AlertDialogTrigger,
|
|
185
|
+
Content: AlertDialogContent,
|
|
186
|
+
Title: AlertDialogTitle,
|
|
187
|
+
Description: AlertDialogDescription,
|
|
188
|
+
Header: AlertDialogHeader,
|
|
189
|
+
Footer: AlertDialogFooter,
|
|
190
|
+
Cancel: AlertDialogCancel,
|
|
191
|
+
Action: AlertDialogAction
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export { ComposedAlertDialog };
|