@forte-ui/react 1.0.0-alpha.1
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/README.md +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { useRender as a } from "@base-ui/react/use-render";
|
|
6
|
+
import './styles/Resizable.css';var o = {
|
|
7
|
+
root: "_root_12kuy_47",
|
|
8
|
+
panel: "_panel_12kuy_124",
|
|
9
|
+
handle: "_handle_12kuy_155",
|
|
10
|
+
grip: "_grip_12kuy_288",
|
|
11
|
+
gripDots: "_gripDots_12kuy_326",
|
|
12
|
+
dragOverlay: "_dragOverlay_12kuy_359"
|
|
13
|
+
}, s = 1e-4, c = typeof document < "u" ? t.useLayoutEffect : t.useEffect;
|
|
14
|
+
function l(e, t, n) {
|
|
15
|
+
return Math.min(Math.max(e, t), n);
|
|
16
|
+
}
|
|
17
|
+
function u(e, t, n) {
|
|
18
|
+
if (e == null) return n;
|
|
19
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : n;
|
|
20
|
+
let r = Number.parseFloat(e);
|
|
21
|
+
return Number.isFinite(r) ? e.trim().endsWith("px") ? t > 0 ? r / t * 100 : n : r : n;
|
|
22
|
+
}
|
|
23
|
+
function d(e) {
|
|
24
|
+
return typeof e == "number" ? e : typeof e == "string" && !e.trim().endsWith("px") ? Number.parseFloat(e) : NaN;
|
|
25
|
+
}
|
|
26
|
+
var f = {
|
|
27
|
+
min: 0,
|
|
28
|
+
max: 100,
|
|
29
|
+
collapsible: !1,
|
|
30
|
+
collapsed: 0,
|
|
31
|
+
threshold: .5
|
|
32
|
+
};
|
|
33
|
+
function p(e, t) {
|
|
34
|
+
return e[t] ?? 0;
|
|
35
|
+
}
|
|
36
|
+
function m(e, t) {
|
|
37
|
+
return e[t] ?? f;
|
|
38
|
+
}
|
|
39
|
+
function h(e, t) {
|
|
40
|
+
return e.collapsible && t <= e.collapsed + s ? e.collapsed : e.min;
|
|
41
|
+
}
|
|
42
|
+
function g(e, t, n) {
|
|
43
|
+
let r = m(t, n);
|
|
44
|
+
if (!r.collapsible) return 0;
|
|
45
|
+
let i = p(e, n);
|
|
46
|
+
if (i >= r.min - s || i <= r.collapsed + s) return 0;
|
|
47
|
+
let a = i <= r.collapsed + (r.min - r.collapsed) * r.threshold ? r.collapsed : r.min;
|
|
48
|
+
return e[n] = a, i - a;
|
|
49
|
+
}
|
|
50
|
+
function _(e, t, n, r, i = !0) {
|
|
51
|
+
if (!Number.isFinite(r) || Math.abs(r) < s || n < 0 || n + 1 >= e.length) return e;
|
|
52
|
+
let a = e.slice(), o = r > 0, c = o ? n : n + 1, l = [];
|
|
53
|
+
if (o) for (let e = n + 1; e < a.length; e++) l.push(e);
|
|
54
|
+
else for (let e = n; e >= 0; e--) l.push(e);
|
|
55
|
+
let u = Math.abs(r), d = 0;
|
|
56
|
+
for (let e = 0; e < l.length && u > s; e++) {
|
|
57
|
+
let n = l[e] ?? 0, r = m(t, n), i = e === 0 && r.collapsible ? r.collapsed : r.min, o = Math.min(Math.max(0, p(a, n) - i), u);
|
|
58
|
+
a[n] = p(a, n) - o, u -= o, d += o;
|
|
59
|
+
}
|
|
60
|
+
i && l.length > 0 && (d += g(a, t, l[0] ?? 0));
|
|
61
|
+
let f = m(t, c), h = Math.min(d, Math.max(0, f.max - p(a, c)));
|
|
62
|
+
a[c] = p(a, c) + h;
|
|
63
|
+
let _ = d - h;
|
|
64
|
+
if (i && f.collapsible) {
|
|
65
|
+
let e = p(a, c);
|
|
66
|
+
if (e > f.collapsed + s && e < f.min - s) {
|
|
67
|
+
let t = e <= f.collapsed + (f.min - f.collapsed) * f.threshold ? f.collapsed : f.min, n = t - e;
|
|
68
|
+
n <= _ + s ? (a[c] = t, _ -= n) : (_ += e - f.collapsed, a[c] = f.collapsed);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (let n = l.length - 1; n >= 0 && _ > s; n--) {
|
|
72
|
+
let r = l[n] ?? 0, i = Math.max(0, Math.min(p(e, r), m(t, r).max) - p(a, r)), o = Math.min(i, _);
|
|
73
|
+
a[r] = p(a, r) + o, _ -= o;
|
|
74
|
+
}
|
|
75
|
+
return a;
|
|
76
|
+
}
|
|
77
|
+
function v(e, t) {
|
|
78
|
+
if (e.length === 0) return e;
|
|
79
|
+
let n = e.slice();
|
|
80
|
+
for (let e = 0; e < n.length; e++) {
|
|
81
|
+
let r = m(t, e), i = h(r, p(n, e));
|
|
82
|
+
n[e] = l(p(n, e), Math.min(i, r.max), r.max);
|
|
83
|
+
}
|
|
84
|
+
for (let e = 0; e < 2; e++) {
|
|
85
|
+
let e = 100 - n.reduce((e, t) => e + t, 0);
|
|
86
|
+
if (Math.abs(e) < s) break;
|
|
87
|
+
let r = n.map((n, r) => {
|
|
88
|
+
let i = m(t, r);
|
|
89
|
+
return e > 0 ? i.collapsible && n <= i.collapsed + s ? 0 : Math.max(0, i.max - n) : Math.max(0, n - h(i, n));
|
|
90
|
+
}), i = r.reduce((e, t) => e + t, 0);
|
|
91
|
+
if (i < s) break;
|
|
92
|
+
for (let t = 0; t < n.length; t++) n[t] = p(n, t) + e * (p(r, t) / i);
|
|
93
|
+
}
|
|
94
|
+
let r = n.reduce((e, t) => e + t, 0);
|
|
95
|
+
if (r > s && Math.abs(r - 100) > s) for (let e = 0; e < n.length; e++) n[e] = p(n, e) / r * 100;
|
|
96
|
+
return n;
|
|
97
|
+
}
|
|
98
|
+
function y(e, t) {
|
|
99
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
100
|
+
}
|
|
101
|
+
var b = t.createContext(null);
|
|
102
|
+
function x(e) {
|
|
103
|
+
let n = t.useContext(b);
|
|
104
|
+
if (!n) throw Error(`forte-ui: <Resizable.${e}> must be rendered inside <Resizable.Group>.`);
|
|
105
|
+
return n;
|
|
106
|
+
}
|
|
107
|
+
var S = t.forwardRef(function({ orientation: f = "horizontal", step: h = 5, largeStep: g = 20, autoSaveId: x, storage: S, onLayout: w, render: ee, className: te, children: T, ...E }, D) {
|
|
108
|
+
let O = t.useRef(null), ne = t.useRef(null);
|
|
109
|
+
ne.current === null && (ne.current = /* @__PURE__ */ new Map());
|
|
110
|
+
let k = ne.current, [, A] = t.useState(0), [j, M] = t.useState([]), [N, P] = t.useState({}), [F, re] = t.useState(null), [I, L] = t.useState(0), R = t.useCallback(() => {
|
|
111
|
+
A((e) => e + 1);
|
|
112
|
+
}, []), z = t.useCallback((e) => (k.set(e.id, e), R(), () => {
|
|
113
|
+
k.delete(e.id), R();
|
|
114
|
+
}), [k, R]);
|
|
115
|
+
c(() => {
|
|
116
|
+
if (F) return;
|
|
117
|
+
let e = [...k.values()].filter((e) => e.element != null).sort((e, t) => e.element.compareDocumentPosition(t.element) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1).map((e) => e.id);
|
|
118
|
+
M((t) => y(t, e) ? t : e);
|
|
119
|
+
});
|
|
120
|
+
let B = t.useMemo(() => j.filter((e) => k.get(e)?.kind === "panel"), [j, k]), V = t.useCallback(() => {
|
|
121
|
+
let e = O.current;
|
|
122
|
+
if (!e) return 0;
|
|
123
|
+
let t = e.getBoundingClientRect();
|
|
124
|
+
return f === "horizontal" ? t.width : t.height;
|
|
125
|
+
}, [f]);
|
|
126
|
+
c(() => {
|
|
127
|
+
let e = O.current;
|
|
128
|
+
if (!e || typeof ResizeObserver > "u") {
|
|
129
|
+
L(V());
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
let t = new ResizeObserver(() => L(V()));
|
|
133
|
+
return t.observe(e), L(V()), () => t.disconnect();
|
|
134
|
+
}, [V]);
|
|
135
|
+
let H = t.useCallback((e, t) => e.map((e) => {
|
|
136
|
+
let n = k.get(e)?.config?.current, r = l(u(n?.minSize, t, 0), 0, 100), i = l(u(n?.collapsedSize, t, 0), 0, r);
|
|
137
|
+
return {
|
|
138
|
+
min: r,
|
|
139
|
+
max: l(u(n?.maxSize, t, 100), r, 100),
|
|
140
|
+
collapsible: n?.collapsible ?? !1,
|
|
141
|
+
collapsed: i,
|
|
142
|
+
threshold: l(n?.collapseThreshold ?? .5, 0, 1)
|
|
143
|
+
};
|
|
144
|
+
}), []), U = t.useCallback((e, t, n) => {
|
|
145
|
+
let r = {}, i = [], a = 0;
|
|
146
|
+
for (let o of e) {
|
|
147
|
+
let e = k.get(o)?.config?.current, s = t[o] ?? u(e?.defaultSize, n, NaN);
|
|
148
|
+
Number.isFinite(s) ? (r[o] = s, a += s) : i.push(o);
|
|
149
|
+
}
|
|
150
|
+
if (i.length > 0) {
|
|
151
|
+
let e = Math.max(0, (100 - a) / i.length);
|
|
152
|
+
for (let t of i) r[t] = e;
|
|
153
|
+
}
|
|
154
|
+
let o = e.reduce((e, t) => e + (r[t] ?? 0), 0);
|
|
155
|
+
if (o > s && Math.abs(o - 100) > s) for (let t of e) r[t] = (r[t] ?? 0) / o * 100;
|
|
156
|
+
return r;
|
|
157
|
+
}, [k]), W = t.useCallback((e, t) => {
|
|
158
|
+
P((n) => {
|
|
159
|
+
if (e.every((e, r) => Math.abs((n[e] ?? NaN) - p(t, r)) < s)) return n;
|
|
160
|
+
let r = {};
|
|
161
|
+
return e.forEach((e, n) => {
|
|
162
|
+
r[e] = p(t, n);
|
|
163
|
+
}), r;
|
|
164
|
+
});
|
|
165
|
+
}, []);
|
|
166
|
+
c(() => {
|
|
167
|
+
P((e) => {
|
|
168
|
+
let t = U(B, e, I);
|
|
169
|
+
return Object.keys(e).length !== B.length || B.some((n) => Math.abs((e[n] ?? NaN) - (t[n] ?? 0)) > s) ? t : e;
|
|
170
|
+
});
|
|
171
|
+
}, [B, U]);
|
|
172
|
+
let G = t.useMemo(() => {
|
|
173
|
+
if (S) return S;
|
|
174
|
+
if (typeof window > "u") return null;
|
|
175
|
+
try {
|
|
176
|
+
return window.localStorage;
|
|
177
|
+
} catch {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}, [S]), ie = t.useRef(!1);
|
|
181
|
+
c(() => {
|
|
182
|
+
if (!(!x || !G || ie.current || B.length === 0)) {
|
|
183
|
+
ie.current = !0;
|
|
184
|
+
try {
|
|
185
|
+
let e = G.getItem(`forte-resizable:${x}`);
|
|
186
|
+
if (!e) return;
|
|
187
|
+
let t = JSON.parse(e);
|
|
188
|
+
if (!Array.isArray(t) || t.length !== B.length || !t.every((e) => typeof e == "number" && Number.isFinite(e))) return;
|
|
189
|
+
W(B, t);
|
|
190
|
+
} catch {}
|
|
191
|
+
}
|
|
192
|
+
}, [
|
|
193
|
+
x,
|
|
194
|
+
G,
|
|
195
|
+
B,
|
|
196
|
+
W
|
|
197
|
+
]), t.useEffect(() => {
|
|
198
|
+
if (!(!x || !G || !ie.current || B.length === 0) && !B.some((e) => !Number.isFinite(N[e]))) try {
|
|
199
|
+
G.setItem(`forte-resizable:${x}`, JSON.stringify(B.map((e) => Number((N[e] ?? 0).toFixed(4)))));
|
|
200
|
+
} catch {}
|
|
201
|
+
}, [
|
|
202
|
+
x,
|
|
203
|
+
G,
|
|
204
|
+
B,
|
|
205
|
+
N
|
|
206
|
+
]);
|
|
207
|
+
let K = t.useMemo(() => H(B, I), [
|
|
208
|
+
H,
|
|
209
|
+
B,
|
|
210
|
+
I
|
|
211
|
+
]), q = B.length > 0 && B.every((e) => Number.isFinite(N[e])), J = t.useMemo(() => {
|
|
212
|
+
if (!q) {
|
|
213
|
+
let e = {};
|
|
214
|
+
for (let t of B) {
|
|
215
|
+
let n = N[t];
|
|
216
|
+
Number.isFinite(n) && (e[t] = n);
|
|
217
|
+
}
|
|
218
|
+
return e;
|
|
219
|
+
}
|
|
220
|
+
let e = v(B.map((e) => N[e] ?? 0), K), t = {};
|
|
221
|
+
return B.forEach((n, r) => {
|
|
222
|
+
t[n] = p(e, r);
|
|
223
|
+
}), t;
|
|
224
|
+
}, [
|
|
225
|
+
B,
|
|
226
|
+
N,
|
|
227
|
+
K,
|
|
228
|
+
q
|
|
229
|
+
]), Y = t.useMemo(() => {
|
|
230
|
+
let e = /* @__PURE__ */ new Set();
|
|
231
|
+
return B.forEach((t, n) => {
|
|
232
|
+
let r = m(K, n), i = J[t];
|
|
233
|
+
r.collapsible && Number.isFinite(i) && i <= r.collapsed + s && e.add(t);
|
|
234
|
+
}), e;
|
|
235
|
+
}, [
|
|
236
|
+
B,
|
|
237
|
+
J,
|
|
238
|
+
K
|
|
239
|
+
]), ae = t.useRef(w);
|
|
240
|
+
ae.current = w, t.useEffect(() => {
|
|
241
|
+
B.length !== 0 && (B.some((e) => !Number.isFinite(J[e])) || ae.current?.(B.map((e) => J[e] ?? 0)));
|
|
242
|
+
}, [B, J]);
|
|
243
|
+
let X = t.useCallback((e) => {
|
|
244
|
+
let t = j.indexOf(e);
|
|
245
|
+
if (t < 0) return -1;
|
|
246
|
+
let n = -1;
|
|
247
|
+
for (let e = 0; e < t; e++) {
|
|
248
|
+
let t = j[e];
|
|
249
|
+
t != null && k.get(t)?.kind === "panel" && (n += 1);
|
|
250
|
+
}
|
|
251
|
+
return n;
|
|
252
|
+
}, [j]), Z = t.useCallback(() => B.map((e) => J[e] ?? 0), [B, J]), oe = t.useRef({}), Q = t.useCallback((e, t, n) => {
|
|
253
|
+
let r = X(e);
|
|
254
|
+
if (r < 0) return;
|
|
255
|
+
let i = _(t, K, r, n);
|
|
256
|
+
B.forEach((e, n) => {
|
|
257
|
+
let r = m(K, n);
|
|
258
|
+
if (!r.collapsible) return;
|
|
259
|
+
let a = p(t, n) > r.collapsed + s, o = p(i, n) <= r.collapsed + s;
|
|
260
|
+
a && o && (oe.current[e] = p(t, n));
|
|
261
|
+
}), W(B, i);
|
|
262
|
+
}, [
|
|
263
|
+
X,
|
|
264
|
+
B,
|
|
265
|
+
K,
|
|
266
|
+
W
|
|
267
|
+
]), se = t.useCallback((e, t) => {
|
|
268
|
+
Q(e, Z(), t);
|
|
269
|
+
}, [Q, Z]), ce = t.useCallback((e, t) => {
|
|
270
|
+
Q(e, Z(), t === "max" ? 100 : -100);
|
|
271
|
+
}, [Q, Z]), le = t.useCallback((e, t) => {
|
|
272
|
+
if (e < 0 || B.length < 2) return;
|
|
273
|
+
let n = Z(), r = t - p(n, e), i = e < B.length - 1 ? _(n, K, e, r, !1) : _(n, K, e - 1, -r, !1);
|
|
274
|
+
W(B, i);
|
|
275
|
+
}, [
|
|
276
|
+
B,
|
|
277
|
+
K,
|
|
278
|
+
Z,
|
|
279
|
+
W
|
|
280
|
+
]), ue = t.useCallback((e, t) => {
|
|
281
|
+
let n = B.indexOf(e);
|
|
282
|
+
if (n < 0) return;
|
|
283
|
+
let r = m(K, n);
|
|
284
|
+
if (!r.collapsible) return;
|
|
285
|
+
let i = J[e] ?? 0;
|
|
286
|
+
if (i <= r.collapsed + s !== t) if (t) oe.current[e] = i, le(n, r.collapsed);
|
|
287
|
+
else {
|
|
288
|
+
let t = oe.current[e], i = u(k.get(e)?.config?.current.defaultSize, I, NaN), a = Number.isFinite(i) ? i : Math.max(r.min, 100 / B.length), o = l(t != null && Number.isFinite(t) ? t : a, r.min, r.max);
|
|
289
|
+
le(n, o);
|
|
290
|
+
}
|
|
291
|
+
}, [
|
|
292
|
+
B,
|
|
293
|
+
J,
|
|
294
|
+
K,
|
|
295
|
+
le,
|
|
296
|
+
k,
|
|
297
|
+
I
|
|
298
|
+
]), de = t.useCallback((e) => {
|
|
299
|
+
let t = X(e);
|
|
300
|
+
if (t < 0) return;
|
|
301
|
+
let n = K[t]?.collapsible ? t : K[t + 1]?.collapsible ? t + 1 : -1, r = n < 0 ? void 0 : B[n];
|
|
302
|
+
r != null && ue(r, !Y.has(r));
|
|
303
|
+
}, [
|
|
304
|
+
X,
|
|
305
|
+
B,
|
|
306
|
+
K,
|
|
307
|
+
Y,
|
|
308
|
+
ue
|
|
309
|
+
]), fe = t.useCallback(() => {
|
|
310
|
+
oe.current = {}, P(U(B, {}, I));
|
|
311
|
+
}, [
|
|
312
|
+
B,
|
|
313
|
+
I,
|
|
314
|
+
U
|
|
315
|
+
]), pe = t.useCallback((e) => {
|
|
316
|
+
let t = X(e);
|
|
317
|
+
return t < 0 ? {} : {
|
|
318
|
+
before: B[t],
|
|
319
|
+
after: B[t + 1]
|
|
320
|
+
};
|
|
321
|
+
}, [X, B]), me = t.useCallback((e) => {
|
|
322
|
+
let t = B.indexOf(e);
|
|
323
|
+
if (!(t < 0)) return m(K, t);
|
|
324
|
+
}, [B, K]), [$, he] = t.useState(!1);
|
|
325
|
+
t.useEffect(() => {
|
|
326
|
+
q && !$ && he(!0);
|
|
327
|
+
}, [q, $]), c(() => {
|
|
328
|
+
!q && $ && he(!1);
|
|
329
|
+
}, [q, $]), c(() => {
|
|
330
|
+
O.current?.toggleAttribute("data-ready", $ && q);
|
|
331
|
+
});
|
|
332
|
+
let ge = t.useMemo(() => {
|
|
333
|
+
if ($) return;
|
|
334
|
+
let e = 0, n = 0, r = 0;
|
|
335
|
+
if (t.Children.forEach(T, (i) => {
|
|
336
|
+
if (!t.isValidElement(i) || i.type !== C) return;
|
|
337
|
+
e += 1;
|
|
338
|
+
let a = d(i.props.defaultSize);
|
|
339
|
+
Number.isFinite(a) && (n += 1, r += a);
|
|
340
|
+
}), !(e === 0 || e === n)) return Math.max(0, (100 - r) / (e - n));
|
|
341
|
+
}, [T, $]), _e = t.useMemo(() => ({
|
|
342
|
+
orientation: f,
|
|
343
|
+
panelIds: B,
|
|
344
|
+
initialShare: ge,
|
|
345
|
+
sizes: J,
|
|
346
|
+
collapsedIds: Y,
|
|
347
|
+
draggingId: F,
|
|
348
|
+
register: z,
|
|
349
|
+
invalidate: R,
|
|
350
|
+
neighbours: pe,
|
|
351
|
+
constraintsOf: me,
|
|
352
|
+
measure: V,
|
|
353
|
+
drag: Q,
|
|
354
|
+
setDragging: re,
|
|
355
|
+
nudge: se,
|
|
356
|
+
extreme: ce,
|
|
357
|
+
toggleCollapse: de,
|
|
358
|
+
setPanelCollapsed: ue,
|
|
359
|
+
resetLayout: fe,
|
|
360
|
+
step: h,
|
|
361
|
+
largeStep: g
|
|
362
|
+
}), [
|
|
363
|
+
f,
|
|
364
|
+
B,
|
|
365
|
+
ge,
|
|
366
|
+
J,
|
|
367
|
+
Y,
|
|
368
|
+
F,
|
|
369
|
+
z,
|
|
370
|
+
R,
|
|
371
|
+
pe,
|
|
372
|
+
me,
|
|
373
|
+
V,
|
|
374
|
+
Q,
|
|
375
|
+
se,
|
|
376
|
+
ce,
|
|
377
|
+
de,
|
|
378
|
+
ue,
|
|
379
|
+
fe,
|
|
380
|
+
h,
|
|
381
|
+
g
|
|
382
|
+
]), ve = t.useCallback((e) => {
|
|
383
|
+
O.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
|
|
384
|
+
}, [D]);
|
|
385
|
+
return /* @__PURE__ */ r(b.Provider, {
|
|
386
|
+
value: _e,
|
|
387
|
+
children: a({
|
|
388
|
+
render: ee,
|
|
389
|
+
ref: ve,
|
|
390
|
+
defaultTagName: "div",
|
|
391
|
+
props: {
|
|
392
|
+
className: e(o.root, te),
|
|
393
|
+
"data-forte": "resizable",
|
|
394
|
+
"data-orientation": f,
|
|
395
|
+
"data-resizing": F ? "" : void 0,
|
|
396
|
+
"data-ready": $ && q ? "" : void 0,
|
|
397
|
+
...E,
|
|
398
|
+
children: /* @__PURE__ */ i(n, { children: [T, F ? /* @__PURE__ */ r("div", {
|
|
399
|
+
className: o.dragOverlay,
|
|
400
|
+
"data-forte": "resizable-drag-overlay",
|
|
401
|
+
"data-orientation": f,
|
|
402
|
+
"aria-hidden": "true"
|
|
403
|
+
}) : null] })
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
});
|
|
407
|
+
}), C = t.forwardRef(function({ defaultSize: n, minSize: r, maxSize: i, collapsible: l = !1, collapsedSize: u = 0, collapseThreshold: f = .5, collapsed: p, onCollapsedChange: m, render: h, className: g, style: _, ...v }, y) {
|
|
408
|
+
let b = x("Panel"), { register: S, invalidate: C, sizes: w, collapsedIds: ee, constraintsOf: te, setPanelCollapsed: T } = b, E = t.useId(), D = t.useRef({
|
|
409
|
+
defaultSize: n,
|
|
410
|
+
minSize: r,
|
|
411
|
+
maxSize: i,
|
|
412
|
+
collapsible: l,
|
|
413
|
+
collapsedSize: u,
|
|
414
|
+
collapseThreshold: f
|
|
415
|
+
});
|
|
416
|
+
D.current = {
|
|
417
|
+
defaultSize: n,
|
|
418
|
+
minSize: r,
|
|
419
|
+
maxSize: i,
|
|
420
|
+
collapsible: l,
|
|
421
|
+
collapsedSize: u,
|
|
422
|
+
collapseThreshold: f
|
|
423
|
+
};
|
|
424
|
+
let O = t.useRef({
|
|
425
|
+
id: E,
|
|
426
|
+
kind: "panel",
|
|
427
|
+
element: null,
|
|
428
|
+
config: D
|
|
429
|
+
});
|
|
430
|
+
c(() => S(O.current), [S]);
|
|
431
|
+
let ne = t.useCallback((e) => {
|
|
432
|
+
O.current.element = e, typeof y == "function" ? y(e) : y && (y.current = e);
|
|
433
|
+
}, [y]);
|
|
434
|
+
c(() => {
|
|
435
|
+
C();
|
|
436
|
+
}, [
|
|
437
|
+
C,
|
|
438
|
+
n,
|
|
439
|
+
r,
|
|
440
|
+
i,
|
|
441
|
+
l,
|
|
442
|
+
u,
|
|
443
|
+
f
|
|
444
|
+
]);
|
|
445
|
+
let k = ee.has(E), A = t.useRef(m);
|
|
446
|
+
A.current = m;
|
|
447
|
+
let j = t.useRef(k), M = t.useRef(!1), [, N] = t.useReducer((e) => e + 1, 0);
|
|
448
|
+
c(() => {
|
|
449
|
+
if (j.current !== k) {
|
|
450
|
+
let e = M.current;
|
|
451
|
+
if (M.current = !1, j.current = k, !e) {
|
|
452
|
+
A.current?.(k), N();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
p !== void 0 && p !== k && (M.current = !0, T(E, p));
|
|
457
|
+
}, [
|
|
458
|
+
k,
|
|
459
|
+
p,
|
|
460
|
+
E,
|
|
461
|
+
T
|
|
462
|
+
]);
|
|
463
|
+
let P = w[E], F = te(E)?.collapsed ?? 0, re = k && F < s;
|
|
464
|
+
c(() => {
|
|
465
|
+
let e = O.current.element;
|
|
466
|
+
e && (e.inert = re);
|
|
467
|
+
}, [re]);
|
|
468
|
+
let I = d(n);
|
|
469
|
+
return a({
|
|
470
|
+
render: h,
|
|
471
|
+
ref: ne,
|
|
472
|
+
defaultTagName: "div",
|
|
473
|
+
props: {
|
|
474
|
+
id: E,
|
|
475
|
+
className: e(o.panel, g),
|
|
476
|
+
"data-forte": "resizable-panel",
|
|
477
|
+
"data-orientation": b.orientation,
|
|
478
|
+
"data-collapsed": k ? "" : void 0,
|
|
479
|
+
style: {
|
|
480
|
+
flexGrow: P ?? (Number.isFinite(I) ? I : b.initialShare ?? 1),
|
|
481
|
+
..._
|
|
482
|
+
},
|
|
483
|
+
...v
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}), w = t.forwardRef(function({ grip: n = !1, disabled: i = !1, resetOnDoubleClick: a = !0, className: s, onPointerDown: l, onPointerMove: u, onPointerUp: d, onKeyDown: f, onBlur: p, onDoubleClick: m, ...h }, g) {
|
|
487
|
+
let _ = x("Handle"), { orientation: v, sizes: y, collapsedIds: b, draggingId: S, register: C, neighbours: w, constraintsOf: ee, measure: te, drag: T, setDragging: E, nudge: D, extreme: O, toggleCollapse: ne, resetLayout: k, step: A, largeStep: j } = _, M = t.useId(), N = t.useRef({
|
|
488
|
+
id: M,
|
|
489
|
+
kind: "handle",
|
|
490
|
+
element: null,
|
|
491
|
+
config: null
|
|
492
|
+
});
|
|
493
|
+
c(() => C(N.current), [C]);
|
|
494
|
+
let P = t.useCallback((e) => {
|
|
495
|
+
N.current.element = e, typeof g == "function" ? g(e) : g && (g.current = e);
|
|
496
|
+
}, [g]), F = t.useRef(null), re = S === M, I = t.useRef({
|
|
497
|
+
frame: 0,
|
|
498
|
+
coordinate: 0
|
|
499
|
+
}), L = t.useRef(T);
|
|
500
|
+
L.current = T;
|
|
501
|
+
let [R, z] = t.useState(!1), { before: B, after: V } = w(M), H = B ? ee(B) : void 0, U = B == null ? void 0 : Math.round(y[B] ?? 0), W = Math.round(H?.collapsible ? H.collapsed : H?.min ?? 0), G = Math.round(H?.max ?? 100), ie = (e) => {
|
|
502
|
+
if (l?.(e), e.defaultPrevented || i || e.button !== 0) return;
|
|
503
|
+
let t = te();
|
|
504
|
+
if (t <= 0) return;
|
|
505
|
+
let n = e.currentTarget, r = v === "horizontal" && typeof window < "u" && window.getComputedStyle(n).direction === "rtl";
|
|
506
|
+
F.current = {
|
|
507
|
+
pointerId: e.pointerId,
|
|
508
|
+
origin: v === "horizontal" ? e.clientX : e.clientY,
|
|
509
|
+
sign: r ? -1 : 1,
|
|
510
|
+
groupPx: t,
|
|
511
|
+
snapshot: _.panelIds.map((e) => y[e] ?? 0)
|
|
512
|
+
}, e.preventDefault(), z(!0), n.focus({ preventScroll: !0 }), E(M);
|
|
513
|
+
try {
|
|
514
|
+
n.setPointerCapture(e.pointerId);
|
|
515
|
+
} catch {}
|
|
516
|
+
}, K = t.useCallback(() => {
|
|
517
|
+
let e = F.current;
|
|
518
|
+
if (!e) return;
|
|
519
|
+
let t = (I.current.coordinate - e.origin) * e.sign * 100 / e.groupPx;
|
|
520
|
+
L.current(M, e.snapshot, t);
|
|
521
|
+
}, [M]), q = (e) => {
|
|
522
|
+
u?.(e);
|
|
523
|
+
let t = F.current;
|
|
524
|
+
!t || t.pointerId !== e.pointerId || (I.current.coordinate = v === "horizontal" ? e.clientX : e.clientY, I.current.frame === 0 && (I.current.frame = requestAnimationFrame(() => {
|
|
525
|
+
I.current.frame = 0, K();
|
|
526
|
+
})));
|
|
527
|
+
}, J = (e) => {
|
|
528
|
+
let t = F.current;
|
|
529
|
+
!t || t.pointerId !== e.pointerId || (I.current.frame !== 0 && (cancelAnimationFrame(I.current.frame), I.current.frame = 0, K()), F.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), E(null));
|
|
530
|
+
};
|
|
531
|
+
t.useEffect(() => () => {
|
|
532
|
+
I.current.frame !== 0 && cancelAnimationFrame(I.current.frame);
|
|
533
|
+
}, []);
|
|
534
|
+
let Y = (e) => {
|
|
535
|
+
if (f?.(e), R && z(!1), e.defaultPrevented || i) return;
|
|
536
|
+
let t = v === "horizontal", n = t ? "ArrowLeft" : "ArrowUp", r = t ? "ArrowRight" : "ArrowDown", a = t && typeof window < "u" && window.getComputedStyle(e.currentTarget).direction === "rtl" ? -1 : 1;
|
|
537
|
+
switch (e.key) {
|
|
538
|
+
case n:
|
|
539
|
+
D(M, -A * a);
|
|
540
|
+
break;
|
|
541
|
+
case r:
|
|
542
|
+
D(M, A * a);
|
|
543
|
+
break;
|
|
544
|
+
case "PageUp":
|
|
545
|
+
D(M, -j * a);
|
|
546
|
+
break;
|
|
547
|
+
case "PageDown":
|
|
548
|
+
D(M, j * a);
|
|
549
|
+
break;
|
|
550
|
+
case "Home":
|
|
551
|
+
O(M, "min");
|
|
552
|
+
break;
|
|
553
|
+
case "End":
|
|
554
|
+
O(M, "max");
|
|
555
|
+
break;
|
|
556
|
+
case "Enter":
|
|
557
|
+
ne(M);
|
|
558
|
+
break;
|
|
559
|
+
case "F6": return;
|
|
560
|
+
default: return;
|
|
561
|
+
}
|
|
562
|
+
e.preventDefault();
|
|
563
|
+
}, ae = (e) => {
|
|
564
|
+
m?.(e), !(e.defaultPrevented || i || !a) && k();
|
|
565
|
+
}, X = B != null && b.has(B) || V != null && b.has(V);
|
|
566
|
+
return /* @__PURE__ */ r("div", {
|
|
567
|
+
ref: P,
|
|
568
|
+
role: "separator",
|
|
569
|
+
"aria-orientation": v === "horizontal" ? "vertical" : "horizontal",
|
|
570
|
+
"aria-valuenow": U,
|
|
571
|
+
"aria-valuemin": W,
|
|
572
|
+
"aria-valuemax": G,
|
|
573
|
+
"aria-controls": B,
|
|
574
|
+
"aria-disabled": i || void 0,
|
|
575
|
+
"aria-label": "Resize panels",
|
|
576
|
+
tabIndex: i ? void 0 : 0,
|
|
577
|
+
className: e(o.handle, "forte-focus-ring", "forte-target", s),
|
|
578
|
+
"data-pointer-focus": R ? "" : void 0,
|
|
579
|
+
"data-forte": "resizable-handle",
|
|
580
|
+
"data-orientation": v,
|
|
581
|
+
"data-dragging": re ? "" : void 0,
|
|
582
|
+
"data-disabled": i ? "" : void 0,
|
|
583
|
+
"data-collapsed": X ? "" : void 0,
|
|
584
|
+
...h,
|
|
585
|
+
onPointerDown: ie,
|
|
586
|
+
onPointerMove: q,
|
|
587
|
+
onPointerUp: (e) => {
|
|
588
|
+
d?.(e), J(e);
|
|
589
|
+
},
|
|
590
|
+
onPointerCancel: J,
|
|
591
|
+
onKeyDown: Y,
|
|
592
|
+
onBlur: (e) => {
|
|
593
|
+
p?.(e), z(!1);
|
|
594
|
+
},
|
|
595
|
+
onDoubleClick: ae,
|
|
596
|
+
children: n ? /* @__PURE__ */ r("span", {
|
|
597
|
+
className: o.grip,
|
|
598
|
+
"data-forte": "resizable-grip",
|
|
599
|
+
"aria-hidden": "true",
|
|
600
|
+
children: /* @__PURE__ */ r("span", { className: o.gripDots })
|
|
601
|
+
}) : null
|
|
602
|
+
});
|
|
603
|
+
}), ee = {
|
|
604
|
+
Group: S,
|
|
605
|
+
Panel: C,
|
|
606
|
+
Handle: w
|
|
607
|
+
};
|
|
608
|
+
//#endregion
|
|
609
|
+
export { C as i, S as n, w as r, ee as t };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./clsx-By2n9mTe.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { ScrollArea as r } from "@base-ui/react/scroll-area";
|
|
6
|
+
import './styles/ScrollArea.css';var i = {
|
|
7
|
+
root: "_root_6s1zb_46",
|
|
8
|
+
viewport: "_viewport_6s1zb_109",
|
|
9
|
+
content: "_content_6s1zb_40",
|
|
10
|
+
scrollbar: "_scrollbar_6s1zb_270",
|
|
11
|
+
thumb: "_thumb_6s1zb_331",
|
|
12
|
+
corner: "_corner_6s1zb_361"
|
|
13
|
+
}, a = t.createContext({
|
|
14
|
+
fade: !0,
|
|
15
|
+
scrollbarVisibility: "auto"
|
|
16
|
+
}), o = {
|
|
17
|
+
Root: t.forwardRef(function({ fade: o = !0, scrollbarVisibility: s = "auto", className: c, children: l, ...u }, d) {
|
|
18
|
+
let f = t.useMemo(() => ({
|
|
19
|
+
fade: o,
|
|
20
|
+
scrollbarVisibility: s
|
|
21
|
+
}), [o, s]);
|
|
22
|
+
return /* @__PURE__ */ n(a.Provider, {
|
|
23
|
+
value: f,
|
|
24
|
+
children: /* @__PURE__ */ n(r.Root, {
|
|
25
|
+
ref: d,
|
|
26
|
+
className: e(i.root, c),
|
|
27
|
+
"data-forte": "scroll-area",
|
|
28
|
+
...u,
|
|
29
|
+
children: l
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}),
|
|
33
|
+
Viewport: t.forwardRef(function({ className: o, children: s, ...c }, l) {
|
|
34
|
+
let { fade: u } = t.useContext(a);
|
|
35
|
+
return /* @__PURE__ */ n(r.Viewport, {
|
|
36
|
+
ref: l,
|
|
37
|
+
className: e(i.viewport, o),
|
|
38
|
+
"data-forte": "scroll-area-viewport",
|
|
39
|
+
"data-fade": u ? "" : void 0,
|
|
40
|
+
...c,
|
|
41
|
+
children: s
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
Content: t.forwardRef(function({ className: t, children: a, ...o }, s) {
|
|
45
|
+
return /* @__PURE__ */ n(r.Content, {
|
|
46
|
+
ref: s,
|
|
47
|
+
className: e(i.content, t),
|
|
48
|
+
"data-forte": "scroll-area-content",
|
|
49
|
+
...o,
|
|
50
|
+
children: a
|
|
51
|
+
});
|
|
52
|
+
}),
|
|
53
|
+
Scrollbar: t.forwardRef(function({ orientation: o = "vertical", className: s, children: c, ...l }, u) {
|
|
54
|
+
let { scrollbarVisibility: d } = t.useContext(a);
|
|
55
|
+
return /* @__PURE__ */ n(r.Scrollbar, {
|
|
56
|
+
ref: u,
|
|
57
|
+
className: e(i.scrollbar, s),
|
|
58
|
+
"data-forte": "scroll-area-scrollbar",
|
|
59
|
+
orientation: o,
|
|
60
|
+
"data-visibility": d,
|
|
61
|
+
...l,
|
|
62
|
+
children: c
|
|
63
|
+
});
|
|
64
|
+
}),
|
|
65
|
+
Thumb: t.forwardRef(function({ className: t, ...a }, o) {
|
|
66
|
+
return /* @__PURE__ */ n(r.Thumb, {
|
|
67
|
+
ref: o,
|
|
68
|
+
className: e(i.thumb, t),
|
|
69
|
+
"data-forte": "scroll-area-thumb",
|
|
70
|
+
...a
|
|
71
|
+
});
|
|
72
|
+
}),
|
|
73
|
+
Corner: t.forwardRef(function({ className: t, ...a }, o) {
|
|
74
|
+
return /* @__PURE__ */ n(r.Corner, {
|
|
75
|
+
ref: o,
|
|
76
|
+
className: e(i.corner, t),
|
|
77
|
+
"data-forte": "scroll-area-corner",
|
|
78
|
+
...a
|
|
79
|
+
});
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { o as t };
|