@vertz/ui-primitives 0.2.38 → 0.2.42
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-fdse46x5.js +21 -0
- 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-r3pffzss.js +0 -13
- 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,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
focusFirst,
|
|
3
|
+
saveFocus,
|
|
4
|
+
trapFocus
|
|
5
|
+
} from "./chunk-e2v1c9ex.js";
|
|
6
|
+
import {
|
|
7
|
+
linkedIds
|
|
8
|
+
} from "./chunk-8y1jf6xr.js";
|
|
9
|
+
import {
|
|
10
|
+
Keys,
|
|
11
|
+
isKey
|
|
12
|
+
} from "./chunk-7867pr13.js";
|
|
13
|
+
import {
|
|
14
|
+
setDataState,
|
|
15
|
+
setExpanded,
|
|
16
|
+
setHidden,
|
|
17
|
+
setHiddenAnimated
|
|
18
|
+
} from "./chunk-vevfhpc9.js";
|
|
19
|
+
|
|
20
|
+
// src/sheet/sheet.tsx
|
|
21
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
22
|
+
import { signal } from "@vertz/ui";
|
|
23
|
+
function SheetRoot(options = {}) {
|
|
24
|
+
const { side = "right", defaultOpen = false, onOpenChange } = options;
|
|
25
|
+
const ids = linkedIds("sheet");
|
|
26
|
+
const state = { open: signal(defaultOpen) };
|
|
27
|
+
let restoreFocus = null;
|
|
28
|
+
let removeTrap = null;
|
|
29
|
+
function show() {
|
|
30
|
+
state.open.value = true;
|
|
31
|
+
setExpanded(trigger, true);
|
|
32
|
+
setHidden(overlay, false);
|
|
33
|
+
setHidden(content, false);
|
|
34
|
+
setDataState(trigger, "open");
|
|
35
|
+
setDataState(overlay, "open");
|
|
36
|
+
setDataState(content, "open");
|
|
37
|
+
restoreFocus = saveFocus();
|
|
38
|
+
removeTrap = trapFocus(content);
|
|
39
|
+
queueMicrotask(() => focusFirst(content));
|
|
40
|
+
onOpenChange?.(true);
|
|
41
|
+
}
|
|
42
|
+
function hide() {
|
|
43
|
+
state.open.value = false;
|
|
44
|
+
setExpanded(trigger, false);
|
|
45
|
+
setDataState(trigger, "closed");
|
|
46
|
+
setDataState(overlay, "closed");
|
|
47
|
+
setDataState(content, "closed");
|
|
48
|
+
setHiddenAnimated(overlay, true);
|
|
49
|
+
setHiddenAnimated(content, true);
|
|
50
|
+
removeTrap?.();
|
|
51
|
+
removeTrap = null;
|
|
52
|
+
restoreFocus?.();
|
|
53
|
+
restoreFocus = null;
|
|
54
|
+
onOpenChange?.(false);
|
|
55
|
+
}
|
|
56
|
+
const SWIPE_THRESHOLD = 50;
|
|
57
|
+
let startX = 0;
|
|
58
|
+
let startY = 0;
|
|
59
|
+
function handlePointerDown(e) {
|
|
60
|
+
startX = e.clientX;
|
|
61
|
+
startY = e.clientY;
|
|
62
|
+
}
|
|
63
|
+
function handlePointerUp(e) {
|
|
64
|
+
if (!state.open.peek())
|
|
65
|
+
return;
|
|
66
|
+
const deltaX = e.clientX - startX;
|
|
67
|
+
const deltaY = e.clientY - startY;
|
|
68
|
+
const shouldDismiss = side === "right" && deltaX >= SWIPE_THRESHOLD || side === "left" && deltaX <= -SWIPE_THRESHOLD || side === "bottom" && deltaY >= SWIPE_THRESHOLD || side === "top" && deltaY <= -SWIPE_THRESHOLD;
|
|
69
|
+
if (shouldDismiss) {
|
|
70
|
+
hide();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const trigger = jsxDEV_7x81h0kn("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
id: ids.triggerId,
|
|
76
|
+
"aria-controls": ids.contentId,
|
|
77
|
+
"aria-expanded": defaultOpen ? "true" : "false",
|
|
78
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
79
|
+
onClick: () => {
|
|
80
|
+
state.open.peek() ? hide() : show();
|
|
81
|
+
}
|
|
82
|
+
}, undefined, false, undefined, this);
|
|
83
|
+
const overlay = jsxDEV_7x81h0kn("div", {
|
|
84
|
+
"data-sheet-overlay": "",
|
|
85
|
+
"aria-hidden": defaultOpen ? "false" : "true",
|
|
86
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
87
|
+
style: { display: defaultOpen ? "" : "none" },
|
|
88
|
+
onClick: () => hide()
|
|
89
|
+
}, undefined, false, undefined, this);
|
|
90
|
+
const content = jsxDEV_7x81h0kn("div", {
|
|
91
|
+
role: "dialog",
|
|
92
|
+
"aria-modal": "true",
|
|
93
|
+
id: ids.contentId,
|
|
94
|
+
"data-side": side,
|
|
95
|
+
"aria-hidden": defaultOpen ? "false" : "true",
|
|
96
|
+
"data-state": defaultOpen ? "open" : "closed",
|
|
97
|
+
style: { display: defaultOpen ? "" : "none" },
|
|
98
|
+
onKeydown: (event) => {
|
|
99
|
+
if (isKey(event, Keys.Escape)) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
hide();
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
onPointerdown: handlePointerDown,
|
|
106
|
+
onPointerup: handlePointerUp
|
|
107
|
+
}, undefined, false, undefined, this);
|
|
108
|
+
const close = jsxDEV_7x81h0kn("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
"aria-label": "Close",
|
|
111
|
+
onClick: () => hide()
|
|
112
|
+
}, undefined, false, undefined, this);
|
|
113
|
+
return { trigger, overlay, content, close, state, show, hide };
|
|
114
|
+
}
|
|
115
|
+
var Sheet = {
|
|
116
|
+
Root: SheetRoot
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export { Sheet };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDismiss
|
|
3
|
+
} from "./chunk-a6wp8c32.js";
|
|
4
|
+
import {
|
|
5
|
+
createFloatingPosition
|
|
6
|
+
} from "./chunk-vef3sepw.js";
|
|
7
|
+
import {
|
|
8
|
+
linkedIds
|
|
9
|
+
} from "./chunk-8y1jf6xr.js";
|
|
10
|
+
import {
|
|
11
|
+
Keys,
|
|
12
|
+
handleListNavigation,
|
|
13
|
+
isKey
|
|
14
|
+
} from "./chunk-7867pr13.js";
|
|
15
|
+
import {
|
|
16
|
+
setDataState,
|
|
17
|
+
setExpanded,
|
|
18
|
+
setHidden,
|
|
19
|
+
setHiddenAnimated,
|
|
20
|
+
setSelected
|
|
21
|
+
} from "./chunk-vevfhpc9.js";
|
|
22
|
+
import {
|
|
23
|
+
applyAttrs
|
|
24
|
+
} from "./chunk-2db2dnp3.js";
|
|
25
|
+
|
|
26
|
+
// src/select/select.tsx
|
|
27
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
28
|
+
import { signal } from "@vertz/ui";
|
|
29
|
+
function SelectRoot(options = {}) {
|
|
30
|
+
const { defaultValue = "", placeholder = "", onValueChange, positioning, ...attrs } = options;
|
|
31
|
+
const ids = linkedIds("select");
|
|
32
|
+
const state = {
|
|
33
|
+
open: signal(false),
|
|
34
|
+
value: signal(defaultValue),
|
|
35
|
+
activeIndex: signal(-1)
|
|
36
|
+
};
|
|
37
|
+
const items = [];
|
|
38
|
+
let floatingCleanup = null;
|
|
39
|
+
let dismissCleanup = null;
|
|
40
|
+
function updateActiveItem(index) {
|
|
41
|
+
for (let i = 0;i < items.length; i++) {
|
|
42
|
+
items[i]?.setAttribute("tabindex", i === index ? "0" : "-1");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function selectItem(value) {
|
|
46
|
+
state.value.value = value;
|
|
47
|
+
for (const item of items) {
|
|
48
|
+
const isActive = item.getAttribute("data-value") === value;
|
|
49
|
+
setSelected(item, isActive);
|
|
50
|
+
setDataState(item, isActive ? "active" : "inactive");
|
|
51
|
+
if (isActive) {
|
|
52
|
+
triggerText.textContent = item.textContent ?? value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
onValueChange?.(value);
|
|
56
|
+
close();
|
|
57
|
+
}
|
|
58
|
+
function open() {
|
|
59
|
+
state.open.value = true;
|
|
60
|
+
setExpanded(trigger, true);
|
|
61
|
+
setHidden(content, false);
|
|
62
|
+
setDataState(trigger, "open");
|
|
63
|
+
setDataState(content, "open");
|
|
64
|
+
if (positioning) {
|
|
65
|
+
const result = createFloatingPosition(trigger, content, positioning);
|
|
66
|
+
floatingCleanup = result.cleanup;
|
|
67
|
+
dismissCleanup = createDismiss({
|
|
68
|
+
onDismiss: close,
|
|
69
|
+
insideElements: [trigger, content],
|
|
70
|
+
escapeKey: false
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
const rect = trigger.getBoundingClientRect();
|
|
74
|
+
const side = window.innerHeight - rect.bottom >= rect.top ? "bottom" : "top";
|
|
75
|
+
content.setAttribute("data-side", side);
|
|
76
|
+
}
|
|
77
|
+
const selectedIdx = items.findIndex((item) => item.getAttribute("data-value") === state.value.peek());
|
|
78
|
+
if (selectedIdx >= 0) {
|
|
79
|
+
state.activeIndex.value = selectedIdx;
|
|
80
|
+
updateActiveItem(selectedIdx);
|
|
81
|
+
items[selectedIdx]?.focus();
|
|
82
|
+
} else {
|
|
83
|
+
state.activeIndex.value = -1;
|
|
84
|
+
updateActiveItem(-1);
|
|
85
|
+
content.focus();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function close() {
|
|
89
|
+
state.open.value = false;
|
|
90
|
+
setExpanded(trigger, false);
|
|
91
|
+
setDataState(trigger, "closed");
|
|
92
|
+
setDataState(content, "closed");
|
|
93
|
+
setHiddenAnimated(content, true);
|
|
94
|
+
floatingCleanup?.();
|
|
95
|
+
floatingCleanup = null;
|
|
96
|
+
dismissCleanup?.();
|
|
97
|
+
dismissCleanup = null;
|
|
98
|
+
trigger.focus();
|
|
99
|
+
}
|
|
100
|
+
const triggerText = jsxDEV_7x81h0kn("span", {
|
|
101
|
+
"data-part": "value",
|
|
102
|
+
children: defaultValue || placeholder
|
|
103
|
+
}, undefined, false, undefined, this);
|
|
104
|
+
const trigger = jsxDEV_7x81h0kn("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
role: "combobox",
|
|
107
|
+
id: ids.triggerId,
|
|
108
|
+
"aria-controls": ids.contentId,
|
|
109
|
+
"aria-haspopup": "listbox",
|
|
110
|
+
"aria-expanded": "false",
|
|
111
|
+
"data-state": "closed",
|
|
112
|
+
onClick: () => {
|
|
113
|
+
if (state.open.peek()) {
|
|
114
|
+
close();
|
|
115
|
+
} else {
|
|
116
|
+
open();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
onKeydown: (event) => {
|
|
120
|
+
if (isKey(event, Keys.ArrowDown, Keys.ArrowUp, Keys.Enter, Keys.Space)) {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
if (!state.open.peek()) {
|
|
123
|
+
open();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
children: triggerText
|
|
128
|
+
}, undefined, false, undefined, this);
|
|
129
|
+
const content = jsxDEV_7x81h0kn("div", {
|
|
130
|
+
role: "listbox",
|
|
131
|
+
tabindex: "-1",
|
|
132
|
+
id: ids.contentId,
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
"data-state": "closed",
|
|
135
|
+
style: { display: "none" },
|
|
136
|
+
onKeydown: (event) => {
|
|
137
|
+
if (isKey(event, Keys.Escape)) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
close();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (isKey(event, Keys.Enter, Keys.Space)) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
const active = items[state.activeIndex.peek()];
|
|
145
|
+
if (active) {
|
|
146
|
+
const val = active.getAttribute("data-value");
|
|
147
|
+
if (val !== null)
|
|
148
|
+
selectItem(val);
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (state.activeIndex.peek() === -1) {
|
|
153
|
+
if (isKey(event, Keys.ArrowDown)) {
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
state.activeIndex.value = 0;
|
|
156
|
+
updateActiveItem(0);
|
|
157
|
+
items[0]?.focus();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (isKey(event, Keys.ArrowUp)) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
const last = items.length - 1;
|
|
163
|
+
state.activeIndex.value = last;
|
|
164
|
+
updateActiveItem(last);
|
|
165
|
+
items[last]?.focus();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const result = handleListNavigation(event, items, { orientation: "vertical" });
|
|
170
|
+
if (result) {
|
|
171
|
+
const idx = items.indexOf(result);
|
|
172
|
+
if (idx >= 0) {
|
|
173
|
+
state.activeIndex.value = idx;
|
|
174
|
+
updateActiveItem(idx);
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
179
|
+
const char = event.key.toLowerCase();
|
|
180
|
+
const match = items.find((item) => item.textContent?.toLowerCase().startsWith(char));
|
|
181
|
+
if (match) {
|
|
182
|
+
const idx = items.indexOf(match);
|
|
183
|
+
state.activeIndex.value = idx;
|
|
184
|
+
updateActiveItem(idx);
|
|
185
|
+
match.focus();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, undefined, false, undefined, this);
|
|
190
|
+
function createItem(value, label) {
|
|
191
|
+
const isSelectedItem = value === defaultValue;
|
|
192
|
+
const item = jsxDEV_7x81h0kn("div", {
|
|
193
|
+
role: "option",
|
|
194
|
+
"data-value": value,
|
|
195
|
+
tabindex: "-1",
|
|
196
|
+
"aria-selected": isSelectedItem ? "true" : "false",
|
|
197
|
+
"data-state": isSelectedItem ? "active" : "inactive",
|
|
198
|
+
onClick: () => selectItem(value),
|
|
199
|
+
children: label ?? value
|
|
200
|
+
}, undefined, false, undefined, this);
|
|
201
|
+
if (isSelectedItem) {
|
|
202
|
+
triggerText.textContent = item.textContent ?? value;
|
|
203
|
+
}
|
|
204
|
+
items.push(item);
|
|
205
|
+
return item;
|
|
206
|
+
}
|
|
207
|
+
function Item(value, label) {
|
|
208
|
+
return createItem(value, label);
|
|
209
|
+
}
|
|
210
|
+
function Group(label) {
|
|
211
|
+
const el = jsxDEV_7x81h0kn("div", {
|
|
212
|
+
role: "group",
|
|
213
|
+
"aria-label": label
|
|
214
|
+
}, undefined, false, undefined, this);
|
|
215
|
+
return {
|
|
216
|
+
el,
|
|
217
|
+
Item: (value, itemLabel) => createItem(value, itemLabel)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function Separator() {
|
|
221
|
+
return jsxDEV_7x81h0kn("hr", {
|
|
222
|
+
role: "separator"
|
|
223
|
+
}, undefined, false, undefined, this);
|
|
224
|
+
}
|
|
225
|
+
applyAttrs(trigger, attrs);
|
|
226
|
+
return { trigger, content, state, Item, Group, Separator };
|
|
227
|
+
}
|
|
228
|
+
var Select = {
|
|
229
|
+
Root: SelectRoot
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export { Select };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/form-group/form-group-composed.tsx
|
|
6
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
7
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
8
|
+
var FormGroupContext = createContext(undefined, "@vertz/ui-primitives::FormGroupContext");
|
|
9
|
+
function FormError({ children, className, class: classProp }) {
|
|
10
|
+
const ctx = useContext(FormGroupContext);
|
|
11
|
+
return jsxDEV_7x81h0kn("span", {
|
|
12
|
+
class: cn(ctx?.classes?.error, className ?? classProp),
|
|
13
|
+
children
|
|
14
|
+
}, undefined, false, undefined, this);
|
|
15
|
+
}
|
|
16
|
+
function ComposedFormGroupRoot({
|
|
17
|
+
children,
|
|
18
|
+
classes,
|
|
19
|
+
className,
|
|
20
|
+
class: classProp
|
|
21
|
+
}) {
|
|
22
|
+
return jsxDEV_7x81h0kn(FormGroupContext.Provider, {
|
|
23
|
+
value: { classes },
|
|
24
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
25
|
+
class: cn(classes?.base, className ?? classProp),
|
|
26
|
+
children
|
|
27
|
+
}, undefined, false, undefined, this)
|
|
28
|
+
}, undefined, false, undefined, this);
|
|
29
|
+
}
|
|
30
|
+
var ComposedFormGroup = Object.assign(ComposedFormGroupRoot, {
|
|
31
|
+
FormError
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export { ComposedFormGroup };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
uniqueId
|
|
3
|
+
} from "./chunk-8y1jf6xr.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
isKey
|
|
7
|
+
} from "./chunk-7867pr13.js";
|
|
8
|
+
import {
|
|
9
|
+
applyAttrs
|
|
10
|
+
} from "./chunk-2db2dnp3.js";
|
|
11
|
+
|
|
12
|
+
// src/switch/switch.tsx
|
|
13
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
14
|
+
function SwitchRoot(options = {}) {
|
|
15
|
+
const { defaultChecked = false, disabled = false, onCheckedChange, ...attrs } = options;
|
|
16
|
+
let checked = defaultChecked;
|
|
17
|
+
function toggle() {
|
|
18
|
+
if (disabled)
|
|
19
|
+
return;
|
|
20
|
+
checked = !checked;
|
|
21
|
+
onCheckedChange?.(checked);
|
|
22
|
+
}
|
|
23
|
+
const el = jsxDEV_7x81h0kn("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
role: "switch",
|
|
26
|
+
id: uniqueId("switch"),
|
|
27
|
+
"aria-checked": checked ? "true" : "false",
|
|
28
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
29
|
+
disabled,
|
|
30
|
+
"aria-disabled": disabled ? "true" : undefined,
|
|
31
|
+
onClick: toggle,
|
|
32
|
+
onKeydown: (e) => {
|
|
33
|
+
if (isKey(e, Keys.Space)) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
toggle();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, undefined, false, undefined, this);
|
|
39
|
+
applyAttrs(el, attrs);
|
|
40
|
+
return el;
|
|
41
|
+
}
|
|
42
|
+
var Switch = {
|
|
43
|
+
Root: SwitchRoot
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { Switch };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-q7xbcj9q.js";
|
|
4
|
+
|
|
5
|
+
// src/resizable-panel/resizable-panel-composed.tsx
|
|
6
|
+
import { jsxDEV as jsxDEV_7x81h0kn } from "@vertz/ui/jsx-dev-runtime";
|
|
7
|
+
import { createContext, useContext } from "@vertz/ui";
|
|
8
|
+
var _groupCounter = { value: 0 };
|
|
9
|
+
var ResizablePanelContext = createContext(undefined, "@vertz/ui-primitives::ResizablePanelContext");
|
|
10
|
+
function ResizablePanelPanel({
|
|
11
|
+
children,
|
|
12
|
+
className: cls,
|
|
13
|
+
class: classProp,
|
|
14
|
+
defaultSize,
|
|
15
|
+
minSize,
|
|
16
|
+
maxSize
|
|
17
|
+
}) {
|
|
18
|
+
const ctx = useContext(ResizablePanelContext);
|
|
19
|
+
if (!ctx) {
|
|
20
|
+
throw new Error("<ResizablePanel.Panel> must be used inside <ResizablePanel>. " + "Ensure it is a direct or nested child of the ResizablePanel root component.");
|
|
21
|
+
}
|
|
22
|
+
const index = ctx.registerPanel({ defaultSize, minSize, maxSize });
|
|
23
|
+
return jsxDEV_7x81h0kn("div", {
|
|
24
|
+
"data-part": "panel",
|
|
25
|
+
"data-group": ctx.groupId,
|
|
26
|
+
style: { flex: `${ctx.getSizeForPanel(index)} 1 0`, minWidth: 0, minHeight: 0 },
|
|
27
|
+
class: cn(ctx.classes?.panel, cls ?? classProp),
|
|
28
|
+
children
|
|
29
|
+
}, undefined, false, undefined, this);
|
|
30
|
+
}
|
|
31
|
+
function ResizablePanelHandle({ className: cls, class: classProp }) {
|
|
32
|
+
const ctx = useContext(ResizablePanelContext);
|
|
33
|
+
if (!ctx) {
|
|
34
|
+
throw new Error("<ResizablePanel.Handle> must be used inside <ResizablePanel>. " + "Ensure it is a direct or nested child of the ResizablePanel root component.");
|
|
35
|
+
}
|
|
36
|
+
const handleIndex = ctx.registerHandle();
|
|
37
|
+
return jsxDEV_7x81h0kn("div", {
|
|
38
|
+
role: "separator",
|
|
39
|
+
tabindex: "0",
|
|
40
|
+
style: { flexShrink: 0 },
|
|
41
|
+
"data-group": ctx.groupId,
|
|
42
|
+
"data-handle-index": String(handleIndex),
|
|
43
|
+
"data-orientation": ctx.orientation,
|
|
44
|
+
"data-state": "idle",
|
|
45
|
+
"aria-valuenow": String(ctx.getAriaForHandle(handleIndex).valuenow),
|
|
46
|
+
"aria-valuemin": String(ctx.getAriaForHandle(handleIndex).valuemin),
|
|
47
|
+
"aria-valuemax": String(ctx.getAriaForHandle(handleIndex).valuemax),
|
|
48
|
+
class: cn(ctx.classes?.handle, cls ?? classProp)
|
|
49
|
+
}, undefined, false, undefined, this);
|
|
50
|
+
}
|
|
51
|
+
function ComposedResizablePanelRoot({
|
|
52
|
+
children,
|
|
53
|
+
classes,
|
|
54
|
+
orientation = "horizontal",
|
|
55
|
+
onResize
|
|
56
|
+
}) {
|
|
57
|
+
const groupId = String(_groupCounter.value++);
|
|
58
|
+
const _reg = {
|
|
59
|
+
nextPanelIdx: 0,
|
|
60
|
+
nextHandleIdx: 0,
|
|
61
|
+
panelConfigs: []
|
|
62
|
+
};
|
|
63
|
+
let sizes = [];
|
|
64
|
+
function recomputeSizes() {
|
|
65
|
+
const configs = _reg.panelConfigs;
|
|
66
|
+
const panelCount = configs.length;
|
|
67
|
+
if (panelCount === 0)
|
|
68
|
+
return;
|
|
69
|
+
const newSizes = new Array(panelCount).fill(0);
|
|
70
|
+
const explicitIndices = new Set;
|
|
71
|
+
for (let i = 0;i < panelCount; i++) {
|
|
72
|
+
const config = configs[i];
|
|
73
|
+
if (config && config.defaultSize != null) {
|
|
74
|
+
newSizes[i] = config.defaultSize;
|
|
75
|
+
explicitIndices.add(i);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (explicitIndices.size === 0) {
|
|
79
|
+
const equal = 100 / panelCount;
|
|
80
|
+
for (let i = 0;i < panelCount; i++)
|
|
81
|
+
newSizes[i] = equal;
|
|
82
|
+
} else {
|
|
83
|
+
const used = [...explicitIndices].reduce((sum, i) => sum + (newSizes[i] ?? 0), 0);
|
|
84
|
+
const unsetCount = panelCount - explicitIndices.size;
|
|
85
|
+
const each = unsetCount > 0 ? (100 - used) / unsetCount : 0;
|
|
86
|
+
for (let i = 0;i < newSizes.length; i++) {
|
|
87
|
+
if (!explicitIndices.has(i))
|
|
88
|
+
newSizes[i] = each;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
sizes = newSizes;
|
|
92
|
+
}
|
|
93
|
+
function registerPanel(opts) {
|
|
94
|
+
const idx = _reg.nextPanelIdx++;
|
|
95
|
+
_reg.panelConfigs.push({
|
|
96
|
+
defaultSize: opts.defaultSize,
|
|
97
|
+
minSize: opts.minSize ?? 0,
|
|
98
|
+
maxSize: opts.maxSize ?? 100
|
|
99
|
+
});
|
|
100
|
+
recomputeSizes();
|
|
101
|
+
return idx;
|
|
102
|
+
}
|
|
103
|
+
function registerHandle() {
|
|
104
|
+
return _reg.nextHandleIdx++;
|
|
105
|
+
}
|
|
106
|
+
function getSizeForPanel(index) {
|
|
107
|
+
return sizes[index] ?? 0;
|
|
108
|
+
}
|
|
109
|
+
function getAriaForHandle(handleIndex) {
|
|
110
|
+
const config = _reg.panelConfigs[handleIndex];
|
|
111
|
+
return {
|
|
112
|
+
valuenow: Math.round(sizes[handleIndex] ?? 0),
|
|
113
|
+
valuemin: Math.round(config?.minSize ?? 0),
|
|
114
|
+
valuemax: Math.round(config?.maxSize ?? 100)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function updateSizes(newSizes) {
|
|
118
|
+
sizes = [...newSizes];
|
|
119
|
+
onResize?.(newSizes);
|
|
120
|
+
}
|
|
121
|
+
function handleKeydown(e) {
|
|
122
|
+
const ke = e;
|
|
123
|
+
const target = ke.target;
|
|
124
|
+
if (target.getAttribute("role") !== "separator")
|
|
125
|
+
return;
|
|
126
|
+
if (target.dataset.group !== groupId)
|
|
127
|
+
return;
|
|
128
|
+
const handleIndex = Number(target.dataset.handleIndex ?? -1);
|
|
129
|
+
if (handleIndex < 0)
|
|
130
|
+
return;
|
|
131
|
+
const leftIdx = handleIndex;
|
|
132
|
+
const rightIdx = handleIndex + 1;
|
|
133
|
+
const leftConfig = _reg.panelConfigs[leftIdx];
|
|
134
|
+
const rightConfig = _reg.panelConfigs[rightIdx];
|
|
135
|
+
if (!leftConfig || !rightConfig)
|
|
136
|
+
return;
|
|
137
|
+
const leftStart = sizes[leftIdx] ?? 0;
|
|
138
|
+
const rightStart = sizes[rightIdx] ?? 0;
|
|
139
|
+
const STEP = 5;
|
|
140
|
+
const growKey = orientation === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
141
|
+
const shrinkKey = orientation === "horizontal" ? "ArrowLeft" : "ArrowUp";
|
|
142
|
+
let newLeft = leftStart;
|
|
143
|
+
let newRight = rightStart;
|
|
144
|
+
if (ke.key === growKey) {
|
|
145
|
+
ke.preventDefault();
|
|
146
|
+
const delta = Math.min(STEP, rightStart - rightConfig.minSize, leftConfig.maxSize - leftStart);
|
|
147
|
+
newLeft += delta;
|
|
148
|
+
newRight -= delta;
|
|
149
|
+
} else if (ke.key === shrinkKey) {
|
|
150
|
+
ke.preventDefault();
|
|
151
|
+
const delta = Math.min(STEP, leftStart - leftConfig.minSize, rightConfig.maxSize - rightStart);
|
|
152
|
+
newLeft -= delta;
|
|
153
|
+
newRight += delta;
|
|
154
|
+
} else if (ke.key === "Home") {
|
|
155
|
+
ke.preventDefault();
|
|
156
|
+
const delta = leftStart - leftConfig.minSize;
|
|
157
|
+
newLeft -= delta;
|
|
158
|
+
newRight += delta;
|
|
159
|
+
} else if (ke.key === "End") {
|
|
160
|
+
ke.preventDefault();
|
|
161
|
+
const delta = rightStart - rightConfig.minSize;
|
|
162
|
+
newLeft += delta;
|
|
163
|
+
newRight -= delta;
|
|
164
|
+
} else {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const newSizes = sizes.slice();
|
|
168
|
+
newSizes[leftIdx] = newLeft;
|
|
169
|
+
newSizes[rightIdx] = newRight;
|
|
170
|
+
updateSizes(newSizes);
|
|
171
|
+
}
|
|
172
|
+
function handlePointerdown(e) {
|
|
173
|
+
const pe = e;
|
|
174
|
+
const target = pe.target;
|
|
175
|
+
if (target.getAttribute("role") !== "separator")
|
|
176
|
+
return;
|
|
177
|
+
if (target.dataset.group !== groupId)
|
|
178
|
+
return;
|
|
179
|
+
pe.preventDefault();
|
|
180
|
+
target.setPointerCapture(pe.pointerId);
|
|
181
|
+
target.setAttribute("data-state", "dragging");
|
|
182
|
+
const handleIndex = Number(target.dataset.handleIndex ?? -1);
|
|
183
|
+
const rootEl = pe.currentTarget;
|
|
184
|
+
const startPos = orientation === "horizontal" ? pe.clientX : pe.clientY;
|
|
185
|
+
const rootSize = orientation === "horizontal" ? rootEl.offsetWidth : rootEl.offsetHeight;
|
|
186
|
+
const startSizes = sizes.slice();
|
|
187
|
+
function onMove(ev) {
|
|
188
|
+
const currentPos = orientation === "horizontal" ? ev.clientX : ev.clientY;
|
|
189
|
+
const delta = (currentPos - startPos) / rootSize * 100;
|
|
190
|
+
const moveSizes = startSizes.slice();
|
|
191
|
+
const leftIdx = handleIndex;
|
|
192
|
+
const rightIdx = handleIndex + 1;
|
|
193
|
+
const leftConfig = _reg.panelConfigs[leftIdx];
|
|
194
|
+
const rightConfig = _reg.panelConfigs[rightIdx];
|
|
195
|
+
if (!leftConfig || !rightConfig)
|
|
196
|
+
return;
|
|
197
|
+
const rawLeft = Math.max(leftConfig.minSize, Math.min(leftConfig.maxSize, (startSizes[leftIdx] ?? 0) + delta));
|
|
198
|
+
const rawRight = Math.max(rightConfig.minSize, Math.min(rightConfig.maxSize, (startSizes[rightIdx] ?? 0) - delta));
|
|
199
|
+
moveSizes[leftIdx] = rawLeft;
|
|
200
|
+
moveSizes[rightIdx] = rawRight;
|
|
201
|
+
updateSizes(moveSizes);
|
|
202
|
+
}
|
|
203
|
+
function onUp(ev) {
|
|
204
|
+
target.releasePointerCapture(ev.pointerId);
|
|
205
|
+
target.setAttribute("data-state", "idle");
|
|
206
|
+
target.removeEventListener("pointermove", onMove);
|
|
207
|
+
target.removeEventListener("pointerup", onUp);
|
|
208
|
+
}
|
|
209
|
+
target.addEventListener("pointermove", onMove);
|
|
210
|
+
target.addEventListener("pointerup", onUp);
|
|
211
|
+
}
|
|
212
|
+
const ctx = {
|
|
213
|
+
groupId,
|
|
214
|
+
orientation,
|
|
215
|
+
classes,
|
|
216
|
+
registerPanel,
|
|
217
|
+
registerHandle,
|
|
218
|
+
getSizeForPanel,
|
|
219
|
+
getAriaForHandle
|
|
220
|
+
};
|
|
221
|
+
return jsxDEV_7x81h0kn(ResizablePanelContext.Provider, {
|
|
222
|
+
value: ctx,
|
|
223
|
+
children: jsxDEV_7x81h0kn("div", {
|
|
224
|
+
style: { display: "flex", flexDirection: orientation === "horizontal" ? "row" : "column" },
|
|
225
|
+
"data-orientation": orientation,
|
|
226
|
+
"data-panel-count": sizes.length,
|
|
227
|
+
class: classes?.root,
|
|
228
|
+
onKeydown: handleKeydown,
|
|
229
|
+
onPointerdown: handlePointerdown,
|
|
230
|
+
children
|
|
231
|
+
}, undefined, false, undefined, this)
|
|
232
|
+
}, undefined, false, undefined, this);
|
|
233
|
+
}
|
|
234
|
+
var ComposedResizablePanel = Object.assign(ComposedResizablePanelRoot, {
|
|
235
|
+
Panel: ResizablePanelPanel,
|
|
236
|
+
Handle: ResizablePanelHandle
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export { ComposedResizablePanel };
|