@wrdagency/blockout 0.0.19 → 0.1.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/dist/2NBKRL7C-BAzCMGOw.js +85 -0
- package/dist/2RSXSRCN-qt84MtKs.js +61 -0
- package/dist/4CMBR7SL-BAGv8IL2.js +308 -0
- package/dist/5JTVDSTH-CG1NL6Fw.js +174 -0
- package/dist/5VQZOHHZ-CscZGerP.js +59 -0
- package/dist/6VRAQV3D-2rb_aClP.js +201 -0
- package/dist/7PRQYBBV-91wrWGjk.js +17 -0
- package/dist/ArrowRight.es-xyNbtVOa.js +60 -0
- package/dist/DG5U6ZEL-CVj-Czp2.js +17 -0
- package/dist/F5MUBM3I-87B2_4WK.js +54 -0
- package/dist/LMDWO4NN--KEvZePp.js +610 -0
- package/dist/MTZPJQMC-DyCWBG18.js +14 -0
- package/dist/P7GR5CS5-BoOYUfSQ.js +19 -0
- package/dist/PFRGBC2K-BEg8ahbY.js +303 -0
- package/dist/RS7LB2H4-D0fWv5qu.js +15 -0
- package/dist/RZ4GPYOB-13-5LlEb.js +37 -0
- package/dist/S43UC3DV-Dn8EFLaT.js +22 -0
- package/dist/Square.es-KJLdY11q.js +72 -0
- package/dist/T7VMP3TM-DeRMoW8g.js +77 -0
- package/dist/TP7N7UIH-BHb1rEeb.js +34 -0
- package/dist/UQQRIHDV-Bu8e1bYU.js +69 -0
- package/dist/UYGDZTLQ-DcCmv5SE.js +12 -0
- package/dist/VIIRIBF3-D5DmZNtI.js +26 -0
- package/dist/WMYDSCNQ-Dy1O-Kdl.js +2405 -0
- package/dist/WYCIER3C-DRn904Gy.js +175 -0
- package/dist/YV4JVR4I-kvospPUa.js +351 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/button.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -0
- package/dist/assets/index15.css +1 -0
- package/dist/assets/index16.css +1 -0
- package/dist/assets/index17.css +1 -0
- package/dist/assets/index18.css +1 -0
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/assets/style2.css +1 -0
- package/dist/assets/style3.css +1 -0
- package/dist/assets/style4.css +1 -0
- package/dist/assets/styles.css +1 -1
- package/dist/components/block-editor/editor.d.ts +5 -0
- package/dist/components/block-editor/editor.js +6 -0
- package/dist/components/block-editor/index.d.ts +1 -0
- package/dist/components/block-editor/index.js +4 -0
- package/dist/components/breadcrumbs/index.js +87 -31
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +5 -5
- package/dist/components/button/icon.d.ts +1 -2
- package/dist/components/button/icon.js +10 -3
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/controls/base-control/affix.js +7 -7
- package/dist/components/controls/base-control/index.js +11 -11
- package/dist/components/controls/base-popover-control/index.d.ts +9 -0
- package/dist/components/controls/base-popover-control/index.js +47 -0
- package/dist/components/controls/checkbox-control/index.d.ts +8 -0
- package/dist/components/controls/checkbox-control/index.js +57 -0
- package/dist/components/controls/choice-control/choice.js +13 -11
- package/dist/components/controls/choice-control/index.js +1 -1
- package/dist/components/controls/index.d.ts +4 -1
- package/dist/components/controls/index.js +25 -16
- package/dist/components/controls/number-control/index.js +29 -27
- package/dist/components/controls/password-control/index.js +1 -1
- package/dist/components/controls/recurrence-control/index.d.ts +8 -0
- package/dist/components/controls/recurrence-control/index.js +208 -0
- package/dist/components/controls/select-control/component.d.ts +12 -0
- package/dist/components/controls/select-control/component.js +1879 -0
- package/dist/components/controls/select-control/index.d.ts +2 -12
- package/dist/components/controls/select-control/index.js +5 -1860
- package/dist/components/controls/select-control/options.d.ts +7 -0
- package/dist/components/controls/select-control/options.js +9 -0
- package/dist/components/controls/textarea-control/index.js +1 -1
- package/dist/components/controls/toggle-control/index.js +11 -9
- package/dist/components/controls/toggle-group-control/index.d.ts +19 -0
- package/dist/components/controls/toggle-group-control/index.js +50 -0
- package/dist/components/data-table/column.js +1 -1
- package/dist/components/data-table/header.js +120 -171
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/filesystem/file.d.ts +7 -0
- package/dist/components/filesystem/file.js +44 -0
- package/dist/components/filesystem/folder.d.ts +6 -0
- package/dist/components/filesystem/folder.js +160 -0
- package/dist/components/filesystem/icon.d.ts +7 -0
- package/dist/components/filesystem/icon.js +908 -0
- package/dist/components/filesystem/index.js +14 -0
- package/dist/components/filesystem/list.d.ts +4 -0
- package/dist/components/filesystem/list.js +18 -0
- package/dist/components/filesystem/root.d.ts +3 -0
- package/dist/components/filesystem/root.js +7 -0
- package/dist/components/form/components/index.js +12 -12
- package/dist/components/form/components/pagination.js +23 -16
- package/dist/components/form/components/progress.d.ts +3 -2
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +48 -31
- package/dist/components/menu/index.js +24 -23
- package/dist/components/menu/item.js +1 -1
- package/dist/components/menu/items/action.js +1 -1
- package/dist/components/menu/items/spacer.js +14 -42
- package/dist/components/menu/items/submenu.js +2 -2
- package/dist/components/menu/items/toggle.js +25 -91
- package/dist/components/progress/index.d.ts +5 -3
- package/dist/components/progress/index.js +44 -27
- package/dist/components/tabs/index.js +12 -0
- package/dist/components/tabs/list.d.ts +7 -0
- package/dist/components/tabs/list.js +42 -0
- package/dist/components/tabs/panel.d.ts +8 -0
- package/dist/components/tabs/panel.js +132 -0
- package/dist/components/tabs/root.d.ts +9 -0
- package/dist/components/tabs/root.js +173 -0
- package/dist/components/tabs/tab.d.ts +7 -0
- package/dist/components/tabs/tab.js +81 -0
- package/dist/components/toolbar/index.js +27 -0
- package/dist/components/toolbar/root.d.ts +6 -0
- package/dist/components/toolbar/root.js +6 -0
- package/dist/composite-provider-DNftbE5U.js +10 -0
- package/dist/hooks/state.d.ts +4 -0
- package/dist/hooks/state.js +7 -0
- package/dist/hooks/theme.js +7 -38
- package/dist/index-1AjPIqTN.js +73 -0
- package/dist/index-Cgx3BqdJ.js +388 -0
- package/dist/index.js +61 -40
- package/dist/{item-D9r2-3fk.js → item-B1ugJ7YQ.js} +240 -234
- package/dist/options-Cfoqhxw2.js +96 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/resizable/index.js +1 -1
- package/dist/primitives/scroll-area/index.d.ts +7 -0
- package/dist/primitives/scroll-area/index.js +777 -0
- package/dist/primitives/truncate/index.d.ts +7 -0
- package/dist/primitives/truncate/index.js +46 -0
- package/dist/primitives/visually-hidden/index.d.ts +2 -2
- package/dist/primitives/visually-hidden/index.js +13 -3
- package/dist/root-CaKPdqzv.js +73 -0
- package/dist/types/date.d.ts +39 -0
- package/dist/types/date.js +1778 -0
- package/dist/types/options.d.ts +8 -6
- package/dist/utils/components.d.ts +5 -0
- package/dist/utils/components.js +14 -0
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/date.js +15 -0
- package/dist/utils/string.d.ts +4 -0
- package/dist/utils/string.js +18 -0
- package/package.json +4 -2
- package/dist/2NBKRL7C-D-Q0qGRV.js +0 -81
- package/dist/P7GR5CS5-qyeuZVEs.js +0 -640
- package/dist/T7VMP3TM-BxgFbvdx.js +0 -2106
- package/dist/UQQRIHDV-BGs025hb.js +0 -1046
- package/dist/VIIRIBF3-D9clDhln.js +0 -21
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/components/markdown/formats.d.ts +0 -11
- package/dist/components/markdown/formats.js +0 -318
- package/dist/components/markdown/index.d.ts +0 -7
- package/dist/components/markdown/index.js +0 -25845
- package/dist/components/markdown/types/format.d.ts +0 -27
- package/dist/components/markdown/types/format.js +0 -4
- package/dist/floating-ui.dom-9sqP7IwC.js +0 -1512
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
import { jsx as m, jsxs as J, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
+
import { cn as he } from "../../utils/css.js";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import "../../index-Cgx3BqdJ.js";
|
|
5
|
+
import '../../assets/style3.css';/* empty css */
|
|
6
|
+
function j(e, t) {
|
|
7
|
+
if (typeof e == "function")
|
|
8
|
+
return e(t);
|
|
9
|
+
e != null && (e.current = t);
|
|
10
|
+
}
|
|
11
|
+
function K(...e) {
|
|
12
|
+
return (t) => {
|
|
13
|
+
let r = !1;
|
|
14
|
+
const n = e.map((o) => {
|
|
15
|
+
const i = j(o, t);
|
|
16
|
+
return !r && typeof i == "function" && (r = !0), i;
|
|
17
|
+
});
|
|
18
|
+
if (r)
|
|
19
|
+
return () => {
|
|
20
|
+
for (let o = 0; o < n.length; o++) {
|
|
21
|
+
const i = n[o];
|
|
22
|
+
typeof i == "function" ? i() : j(e[o], null);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function A(...e) {
|
|
28
|
+
return l.useCallback(K(...e), e);
|
|
29
|
+
}
|
|
30
|
+
// @__NO_SIDE_EFFECTS__
|
|
31
|
+
function me(e) {
|
|
32
|
+
const t = /* @__PURE__ */ pe(e), r = l.forwardRef((n, o) => {
|
|
33
|
+
const { children: i, ...s } = n, c = l.Children.toArray(i), a = c.find(be);
|
|
34
|
+
if (a) {
|
|
35
|
+
const u = a.props.children, d = c.map((h) => h === a ? l.Children.count(u) > 1 ? l.Children.only(null) : l.isValidElement(u) ? u.props.children : null : h);
|
|
36
|
+
return /* @__PURE__ */ m(t, { ...s, ref: o, children: l.isValidElement(u) ? l.cloneElement(u, void 0, d) : null });
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ m(t, { ...s, ref: o, children: i });
|
|
39
|
+
});
|
|
40
|
+
return r.displayName = `${e}.Slot`, r;
|
|
41
|
+
}
|
|
42
|
+
// @__NO_SIDE_EFFECTS__
|
|
43
|
+
function pe(e) {
|
|
44
|
+
const t = l.forwardRef((r, n) => {
|
|
45
|
+
const { children: o, ...i } = r;
|
|
46
|
+
if (l.isValidElement(o)) {
|
|
47
|
+
const s = we(o), c = ve(i, o.props);
|
|
48
|
+
return o.type !== l.Fragment && (c.ref = n ? K(n, s) : s), l.cloneElement(o, c);
|
|
49
|
+
}
|
|
50
|
+
return l.Children.count(o) > 1 ? l.Children.only(null) : null;
|
|
51
|
+
});
|
|
52
|
+
return t.displayName = `${e}.SlotClone`, t;
|
|
53
|
+
}
|
|
54
|
+
var Se = Symbol("radix.slottable");
|
|
55
|
+
function be(e) {
|
|
56
|
+
return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Se;
|
|
57
|
+
}
|
|
58
|
+
function ve(e, t) {
|
|
59
|
+
const r = { ...t };
|
|
60
|
+
for (const n in t) {
|
|
61
|
+
const o = e[n], i = t[n];
|
|
62
|
+
/^on[A-Z]/.test(n) ? o && i ? r[n] = (...c) => {
|
|
63
|
+
const a = i(...c);
|
|
64
|
+
return o(...c), a;
|
|
65
|
+
} : o && (r[n] = o) : n === "style" ? r[n] = { ...o, ...i } : n === "className" && (r[n] = [o, i].filter(Boolean).join(" "));
|
|
66
|
+
}
|
|
67
|
+
return { ...e, ...r };
|
|
68
|
+
}
|
|
69
|
+
function we(e) {
|
|
70
|
+
var n, o;
|
|
71
|
+
let t = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, r = t && "isReactWarning" in t && t.isReactWarning;
|
|
72
|
+
return r ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
|
|
73
|
+
}
|
|
74
|
+
var ge = [
|
|
75
|
+
"a",
|
|
76
|
+
"button",
|
|
77
|
+
"div",
|
|
78
|
+
"form",
|
|
79
|
+
"h2",
|
|
80
|
+
"h3",
|
|
81
|
+
"img",
|
|
82
|
+
"input",
|
|
83
|
+
"label",
|
|
84
|
+
"li",
|
|
85
|
+
"nav",
|
|
86
|
+
"ol",
|
|
87
|
+
"p",
|
|
88
|
+
"select",
|
|
89
|
+
"span",
|
|
90
|
+
"svg",
|
|
91
|
+
"ul"
|
|
92
|
+
], N = ge.reduce((e, t) => {
|
|
93
|
+
const r = /* @__PURE__ */ me(`Primitive.${t}`), n = l.forwardRef((o, i) => {
|
|
94
|
+
const { asChild: s, ...c } = o, a = s ? r : t;
|
|
95
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(a, { ...c, ref: i });
|
|
96
|
+
});
|
|
97
|
+
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
98
|
+
}, {}), Y = globalThis != null && globalThis.document ? l.useLayoutEffect : () => {
|
|
99
|
+
};
|
|
100
|
+
function Ce(e, t) {
|
|
101
|
+
return l.useReducer((r, n) => t[r][n] ?? r, e);
|
|
102
|
+
}
|
|
103
|
+
var L = (e) => {
|
|
104
|
+
const { present: t, children: r } = e, n = Pe(t), o = typeof r == "function" ? r({ present: n.isPresent }) : l.Children.only(r), i = A(n.ref, Re(o));
|
|
105
|
+
return typeof r == "function" || n.isPresent ? l.cloneElement(o, { ref: i }) : null;
|
|
106
|
+
};
|
|
107
|
+
L.displayName = "Presence";
|
|
108
|
+
function Pe(e) {
|
|
109
|
+
const [t, r] = l.useState(), n = l.useRef(null), o = l.useRef(e), i = l.useRef("none"), s = e ? "mounted" : "unmounted", [c, a] = Ce(s, {
|
|
110
|
+
mounted: {
|
|
111
|
+
UNMOUNT: "unmounted",
|
|
112
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
113
|
+
},
|
|
114
|
+
unmountSuspended: {
|
|
115
|
+
MOUNT: "mounted",
|
|
116
|
+
ANIMATION_END: "unmounted"
|
|
117
|
+
},
|
|
118
|
+
unmounted: {
|
|
119
|
+
MOUNT: "mounted"
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return l.useEffect(() => {
|
|
123
|
+
const u = U(n.current);
|
|
124
|
+
i.current = c === "mounted" ? u : "none";
|
|
125
|
+
}, [c]), Y(() => {
|
|
126
|
+
const u = n.current, d = o.current;
|
|
127
|
+
if (d !== e) {
|
|
128
|
+
const f = i.current, p = U(u);
|
|
129
|
+
e ? a("MOUNT") : p === "none" || (u == null ? void 0 : u.display) === "none" ? a("UNMOUNT") : a(d && f !== p ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
|
|
130
|
+
}
|
|
131
|
+
}, [e, a]), Y(() => {
|
|
132
|
+
if (t) {
|
|
133
|
+
let u;
|
|
134
|
+
const d = t.ownerDocument.defaultView ?? window, h = (p) => {
|
|
135
|
+
const v = U(n.current).includes(p.animationName);
|
|
136
|
+
if (p.target === t && v && (a("ANIMATION_END"), !o.current)) {
|
|
137
|
+
const R = t.style.animationFillMode;
|
|
138
|
+
t.style.animationFillMode = "forwards", u = d.setTimeout(() => {
|
|
139
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = R);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}, f = (p) => {
|
|
143
|
+
p.target === t && (i.current = U(n.current));
|
|
144
|
+
};
|
|
145
|
+
return t.addEventListener("animationstart", f), t.addEventListener("animationcancel", h), t.addEventListener("animationend", h), () => {
|
|
146
|
+
d.clearTimeout(u), t.removeEventListener("animationstart", f), t.removeEventListener("animationcancel", h), t.removeEventListener("animationend", h);
|
|
147
|
+
};
|
|
148
|
+
} else
|
|
149
|
+
a("ANIMATION_END");
|
|
150
|
+
}, [t, a]), {
|
|
151
|
+
isPresent: ["mounted", "unmountSuspended"].includes(c),
|
|
152
|
+
ref: l.useCallback((u) => {
|
|
153
|
+
n.current = u ? getComputedStyle(u) : null, r(u);
|
|
154
|
+
}, [])
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function U(e) {
|
|
158
|
+
return (e == null ? void 0 : e.animationName) || "none";
|
|
159
|
+
}
|
|
160
|
+
function Re(e) {
|
|
161
|
+
var n, o;
|
|
162
|
+
let t = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, r = t && "isReactWarning" in t && t.isReactWarning;
|
|
163
|
+
return r ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
|
|
164
|
+
}
|
|
165
|
+
function ye(e, t = []) {
|
|
166
|
+
let r = [];
|
|
167
|
+
function n(i, s) {
|
|
168
|
+
const c = l.createContext(s), a = r.length;
|
|
169
|
+
r = [...r, s];
|
|
170
|
+
const u = (h) => {
|
|
171
|
+
var C;
|
|
172
|
+
const { scope: f, children: p, ...S } = h, v = ((C = f == null ? void 0 : f[e]) == null ? void 0 : C[a]) || c, R = l.useMemo(() => S, Object.values(S));
|
|
173
|
+
return /* @__PURE__ */ m(v.Provider, { value: R, children: p });
|
|
174
|
+
};
|
|
175
|
+
u.displayName = i + "Provider";
|
|
176
|
+
function d(h, f) {
|
|
177
|
+
var v;
|
|
178
|
+
const p = ((v = f == null ? void 0 : f[e]) == null ? void 0 : v[a]) || c, S = l.useContext(p);
|
|
179
|
+
if (S) return S;
|
|
180
|
+
if (s !== void 0) return s;
|
|
181
|
+
throw new Error(`\`${h}\` must be used within \`${i}\``);
|
|
182
|
+
}
|
|
183
|
+
return [u, d];
|
|
184
|
+
}
|
|
185
|
+
const o = () => {
|
|
186
|
+
const i = r.map((s) => l.createContext(s));
|
|
187
|
+
return function(c) {
|
|
188
|
+
const a = (c == null ? void 0 : c[e]) || i;
|
|
189
|
+
return l.useMemo(
|
|
190
|
+
() => ({ [`__scope${e}`]: { ...c, [e]: a } }),
|
|
191
|
+
[c, a]
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
return o.scopeName = e, [n, Ee(o, ...t)];
|
|
196
|
+
}
|
|
197
|
+
function Ee(...e) {
|
|
198
|
+
const t = e[0];
|
|
199
|
+
if (e.length === 1) return t;
|
|
200
|
+
const r = () => {
|
|
201
|
+
const n = e.map((o) => ({
|
|
202
|
+
useScope: o(),
|
|
203
|
+
scopeName: o.scopeName
|
|
204
|
+
}));
|
|
205
|
+
return function(i) {
|
|
206
|
+
const s = n.reduce((c, { useScope: a, scopeName: u }) => {
|
|
207
|
+
const h = a(i)[`__scope${u}`];
|
|
208
|
+
return { ...c, ...h };
|
|
209
|
+
}, {});
|
|
210
|
+
return l.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
return r.scopeName = t.scopeName, r;
|
|
214
|
+
}
|
|
215
|
+
function y(e) {
|
|
216
|
+
const t = l.useRef(e);
|
|
217
|
+
return l.useEffect(() => {
|
|
218
|
+
t.current = e;
|
|
219
|
+
}), l.useMemo(() => (...r) => {
|
|
220
|
+
var n;
|
|
221
|
+
return (n = t.current) == null ? void 0 : n.call(t, ...r);
|
|
222
|
+
}, []);
|
|
223
|
+
}
|
|
224
|
+
var Ae = l.createContext(void 0);
|
|
225
|
+
function Te(e) {
|
|
226
|
+
const t = l.useContext(Ae);
|
|
227
|
+
return e || t || "ltr";
|
|
228
|
+
}
|
|
229
|
+
function xe(e, [t, r]) {
|
|
230
|
+
return Math.min(r, Math.max(t, e));
|
|
231
|
+
}
|
|
232
|
+
function E(e, t, { checkForDefaultPrevented: r = !0 } = {}) {
|
|
233
|
+
return function(o) {
|
|
234
|
+
if (e == null || e(o), r === !1 || !o.defaultPrevented)
|
|
235
|
+
return t == null ? void 0 : t(o);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function _e(e, t) {
|
|
239
|
+
return l.useReducer((r, n) => t[r][n] ?? r, e);
|
|
240
|
+
}
|
|
241
|
+
var B = "ScrollArea", [Q, qe] = ye(B), [Ne, w] = Q(B), ee = l.forwardRef(
|
|
242
|
+
(e, t) => {
|
|
243
|
+
const {
|
|
244
|
+
__scopeScrollArea: r,
|
|
245
|
+
type: n = "hover",
|
|
246
|
+
dir: o,
|
|
247
|
+
scrollHideDelay: i = 600,
|
|
248
|
+
...s
|
|
249
|
+
} = e, [c, a] = l.useState(null), [u, d] = l.useState(null), [h, f] = l.useState(null), [p, S] = l.useState(null), [v, R] = l.useState(null), [C, D] = l.useState(0), [X, O] = l.useState(0), [M, _] = l.useState(!1), [W, I] = l.useState(!1), b = A(t, (T) => a(T)), g = Te(o);
|
|
250
|
+
return /* @__PURE__ */ m(
|
|
251
|
+
Ne,
|
|
252
|
+
{
|
|
253
|
+
scope: r,
|
|
254
|
+
type: n,
|
|
255
|
+
dir: g,
|
|
256
|
+
scrollHideDelay: i,
|
|
257
|
+
scrollArea: c,
|
|
258
|
+
viewport: u,
|
|
259
|
+
onViewportChange: d,
|
|
260
|
+
content: h,
|
|
261
|
+
onContentChange: f,
|
|
262
|
+
scrollbarX: p,
|
|
263
|
+
onScrollbarXChange: S,
|
|
264
|
+
scrollbarXEnabled: M,
|
|
265
|
+
onScrollbarXEnabledChange: _,
|
|
266
|
+
scrollbarY: v,
|
|
267
|
+
onScrollbarYChange: R,
|
|
268
|
+
scrollbarYEnabled: W,
|
|
269
|
+
onScrollbarYEnabledChange: I,
|
|
270
|
+
onCornerWidthChange: D,
|
|
271
|
+
onCornerHeightChange: O,
|
|
272
|
+
children: /* @__PURE__ */ m(
|
|
273
|
+
N.div,
|
|
274
|
+
{
|
|
275
|
+
dir: g,
|
|
276
|
+
...s,
|
|
277
|
+
ref: b,
|
|
278
|
+
style: {
|
|
279
|
+
position: "relative",
|
|
280
|
+
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
281
|
+
"--radix-scroll-area-corner-width": C + "px",
|
|
282
|
+
"--radix-scroll-area-corner-height": X + "px",
|
|
283
|
+
...e.style
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
ee.displayName = B;
|
|
292
|
+
var te = "ScrollAreaViewport", re = l.forwardRef(
|
|
293
|
+
(e, t) => {
|
|
294
|
+
const { __scopeScrollArea: r, children: n, nonce: o, ...i } = e, s = w(te, r), c = l.useRef(null), a = A(t, c, s.onViewportChange);
|
|
295
|
+
return /* @__PURE__ */ J(fe, { children: [
|
|
296
|
+
/* @__PURE__ */ m(
|
|
297
|
+
"style",
|
|
298
|
+
{
|
|
299
|
+
dangerouslySetInnerHTML: {
|
|
300
|
+
__html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
|
|
301
|
+
},
|
|
302
|
+
nonce: o
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ m(
|
|
306
|
+
N.div,
|
|
307
|
+
{
|
|
308
|
+
"data-radix-scroll-area-viewport": "",
|
|
309
|
+
...i,
|
|
310
|
+
ref: a,
|
|
311
|
+
style: {
|
|
312
|
+
/**
|
|
313
|
+
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
314
|
+
* if this component is used and `visible` will behave like `auto` in that case
|
|
315
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
|
|
316
|
+
*
|
|
317
|
+
* We don't handle `auto` because the intention is for the native implementation
|
|
318
|
+
* to be hidden if using this component. We just want to ensure the node is scrollable
|
|
319
|
+
* so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
|
|
320
|
+
* the browser from having to work out whether to render native scrollbars or not,
|
|
321
|
+
* we tell it to with the intention of hiding them in CSS.
|
|
322
|
+
*/
|
|
323
|
+
overflowX: s.scrollbarXEnabled ? "scroll" : "hidden",
|
|
324
|
+
overflowY: s.scrollbarYEnabled ? "scroll" : "hidden",
|
|
325
|
+
...e.style
|
|
326
|
+
},
|
|
327
|
+
children: /* @__PURE__ */ m("div", { ref: s.onContentChange, style: { minWidth: "100%", display: "table" }, children: n })
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
] });
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
re.displayName = te;
|
|
334
|
+
var P = "ScrollAreaScrollbar", oe = l.forwardRef(
|
|
335
|
+
(e, t) => {
|
|
336
|
+
const { forceMount: r, ...n } = e, o = w(P, e.__scopeScrollArea), { onScrollbarXEnabledChange: i, onScrollbarYEnabledChange: s } = o, c = e.orientation === "horizontal";
|
|
337
|
+
return l.useEffect(() => (c ? i(!0) : s(!0), () => {
|
|
338
|
+
c ? i(!1) : s(!1);
|
|
339
|
+
}), [c, i, s]), o.type === "hover" ? /* @__PURE__ */ m(Le, { ...n, ref: t, forceMount: r }) : o.type === "scroll" ? /* @__PURE__ */ m(De, { ...n, ref: t, forceMount: r }) : o.type === "auto" ? /* @__PURE__ */ m(ne, { ...n, ref: t, forceMount: r }) : o.type === "always" ? /* @__PURE__ */ m($, { ...n, ref: t }) : null;
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
oe.displayName = P;
|
|
343
|
+
var Le = l.forwardRef((e, t) => {
|
|
344
|
+
const { forceMount: r, ...n } = e, o = w(P, e.__scopeScrollArea), [i, s] = l.useState(!1);
|
|
345
|
+
return l.useEffect(() => {
|
|
346
|
+
const c = o.scrollArea;
|
|
347
|
+
let a = 0;
|
|
348
|
+
if (c) {
|
|
349
|
+
const u = () => {
|
|
350
|
+
window.clearTimeout(a), s(!0);
|
|
351
|
+
}, d = () => {
|
|
352
|
+
a = window.setTimeout(() => s(!1), o.scrollHideDelay);
|
|
353
|
+
};
|
|
354
|
+
return c.addEventListener("pointerenter", u), c.addEventListener("pointerleave", d), () => {
|
|
355
|
+
window.clearTimeout(a), c.removeEventListener("pointerenter", u), c.removeEventListener("pointerleave", d);
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ m(L, { present: r || i, children: /* @__PURE__ */ m(
|
|
359
|
+
ne,
|
|
360
|
+
{
|
|
361
|
+
"data-state": i ? "visible" : "hidden",
|
|
362
|
+
...n,
|
|
363
|
+
ref: t
|
|
364
|
+
}
|
|
365
|
+
) });
|
|
366
|
+
}), De = l.forwardRef((e, t) => {
|
|
367
|
+
const { forceMount: r, ...n } = e, o = w(P, e.__scopeScrollArea), i = e.orientation === "horizontal", s = F(() => a("SCROLL_END"), 100), [c, a] = _e("hidden", {
|
|
368
|
+
hidden: {
|
|
369
|
+
SCROLL: "scrolling"
|
|
370
|
+
},
|
|
371
|
+
scrolling: {
|
|
372
|
+
SCROLL_END: "idle",
|
|
373
|
+
POINTER_ENTER: "interacting"
|
|
374
|
+
},
|
|
375
|
+
interacting: {
|
|
376
|
+
SCROLL: "interacting",
|
|
377
|
+
POINTER_LEAVE: "idle"
|
|
378
|
+
},
|
|
379
|
+
idle: {
|
|
380
|
+
HIDE: "hidden",
|
|
381
|
+
SCROLL: "scrolling",
|
|
382
|
+
POINTER_ENTER: "interacting"
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
return l.useEffect(() => {
|
|
386
|
+
if (c === "idle") {
|
|
387
|
+
const u = window.setTimeout(() => a("HIDE"), o.scrollHideDelay);
|
|
388
|
+
return () => window.clearTimeout(u);
|
|
389
|
+
}
|
|
390
|
+
}, [c, o.scrollHideDelay, a]), l.useEffect(() => {
|
|
391
|
+
const u = o.viewport, d = i ? "scrollLeft" : "scrollTop";
|
|
392
|
+
if (u) {
|
|
393
|
+
let h = u[d];
|
|
394
|
+
const f = () => {
|
|
395
|
+
const p = u[d];
|
|
396
|
+
h !== p && (a("SCROLL"), s()), h = p;
|
|
397
|
+
};
|
|
398
|
+
return u.addEventListener("scroll", f), () => u.removeEventListener("scroll", f);
|
|
399
|
+
}
|
|
400
|
+
}, [o.viewport, i, a, s]), /* @__PURE__ */ m(L, { present: r || c !== "hidden", children: /* @__PURE__ */ m(
|
|
401
|
+
$,
|
|
402
|
+
{
|
|
403
|
+
"data-state": c === "hidden" ? "hidden" : "visible",
|
|
404
|
+
...n,
|
|
405
|
+
ref: t,
|
|
406
|
+
onPointerEnter: E(e.onPointerEnter, () => a("POINTER_ENTER")),
|
|
407
|
+
onPointerLeave: E(e.onPointerLeave, () => a("POINTER_LEAVE"))
|
|
408
|
+
}
|
|
409
|
+
) });
|
|
410
|
+
}), ne = l.forwardRef((e, t) => {
|
|
411
|
+
const r = w(P, e.__scopeScrollArea), { forceMount: n, ...o } = e, [i, s] = l.useState(!1), c = e.orientation === "horizontal", a = F(() => {
|
|
412
|
+
if (r.viewport) {
|
|
413
|
+
const u = r.viewport.offsetWidth < r.viewport.scrollWidth, d = r.viewport.offsetHeight < r.viewport.scrollHeight;
|
|
414
|
+
s(c ? u : d);
|
|
415
|
+
}
|
|
416
|
+
}, 10);
|
|
417
|
+
return x(r.viewport, a), x(r.content, a), /* @__PURE__ */ m(L, { present: n || i, children: /* @__PURE__ */ m(
|
|
418
|
+
$,
|
|
419
|
+
{
|
|
420
|
+
"data-state": i ? "visible" : "hidden",
|
|
421
|
+
...o,
|
|
422
|
+
ref: t
|
|
423
|
+
}
|
|
424
|
+
) });
|
|
425
|
+
}), $ = l.forwardRef((e, t) => {
|
|
426
|
+
const { orientation: r = "vertical", ...n } = e, o = w(P, e.__scopeScrollArea), i = l.useRef(null), s = l.useRef(0), [c, a] = l.useState({
|
|
427
|
+
content: 0,
|
|
428
|
+
viewport: 0,
|
|
429
|
+
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
430
|
+
}), u = ae(c.viewport, c.content), d = {
|
|
431
|
+
...n,
|
|
432
|
+
sizes: c,
|
|
433
|
+
onSizesChange: a,
|
|
434
|
+
hasThumb: u > 0 && u < 1,
|
|
435
|
+
onThumbChange: (f) => i.current = f,
|
|
436
|
+
onThumbPointerUp: () => s.current = 0,
|
|
437
|
+
onThumbPointerDown: (f) => s.current = f
|
|
438
|
+
};
|
|
439
|
+
function h(f, p) {
|
|
440
|
+
return ze(f, s.current, c, p);
|
|
441
|
+
}
|
|
442
|
+
return r === "horizontal" ? /* @__PURE__ */ m(
|
|
443
|
+
Oe,
|
|
444
|
+
{
|
|
445
|
+
...d,
|
|
446
|
+
ref: t,
|
|
447
|
+
onThumbPositionChange: () => {
|
|
448
|
+
if (o.viewport && i.current) {
|
|
449
|
+
const f = o.viewport.scrollLeft, p = q(f, c, o.dir);
|
|
450
|
+
i.current.style.transform = `translate3d(${p}px, 0, 0)`;
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
onWheelScroll: (f) => {
|
|
454
|
+
o.viewport && (o.viewport.scrollLeft = f);
|
|
455
|
+
},
|
|
456
|
+
onDragScroll: (f) => {
|
|
457
|
+
o.viewport && (o.viewport.scrollLeft = h(f, o.dir));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
) : r === "vertical" ? /* @__PURE__ */ m(
|
|
461
|
+
Me,
|
|
462
|
+
{
|
|
463
|
+
...d,
|
|
464
|
+
ref: t,
|
|
465
|
+
onThumbPositionChange: () => {
|
|
466
|
+
if (o.viewport && i.current) {
|
|
467
|
+
const f = o.viewport.scrollTop, p = q(f, c);
|
|
468
|
+
i.current.style.transform = `translate3d(0, ${p}px, 0)`;
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
onWheelScroll: (f) => {
|
|
472
|
+
o.viewport && (o.viewport.scrollTop = f);
|
|
473
|
+
},
|
|
474
|
+
onDragScroll: (f) => {
|
|
475
|
+
o.viewport && (o.viewport.scrollTop = h(f));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
) : null;
|
|
479
|
+
}), Oe = l.forwardRef((e, t) => {
|
|
480
|
+
const { sizes: r, onSizesChange: n, ...o } = e, i = w(P, e.__scopeScrollArea), [s, c] = l.useState(), a = l.useRef(null), u = A(t, a, i.onScrollbarXChange);
|
|
481
|
+
return l.useEffect(() => {
|
|
482
|
+
a.current && c(getComputedStyle(a.current));
|
|
483
|
+
}, [a]), /* @__PURE__ */ m(
|
|
484
|
+
ie,
|
|
485
|
+
{
|
|
486
|
+
"data-orientation": "horizontal",
|
|
487
|
+
...o,
|
|
488
|
+
ref: u,
|
|
489
|
+
sizes: r,
|
|
490
|
+
style: {
|
|
491
|
+
bottom: 0,
|
|
492
|
+
left: i.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
493
|
+
right: i.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
494
|
+
"--radix-scroll-area-thumb-width": V(r) + "px",
|
|
495
|
+
...e.style
|
|
496
|
+
},
|
|
497
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.x),
|
|
498
|
+
onDragScroll: (d) => e.onDragScroll(d.x),
|
|
499
|
+
onWheelScroll: (d, h) => {
|
|
500
|
+
if (i.viewport) {
|
|
501
|
+
const f = i.viewport.scrollLeft + d.deltaX;
|
|
502
|
+
e.onWheelScroll(f), de(f, h) && d.preventDefault();
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
onResize: () => {
|
|
506
|
+
a.current && i.viewport && s && n({
|
|
507
|
+
content: i.viewport.scrollWidth,
|
|
508
|
+
viewport: i.viewport.offsetWidth,
|
|
509
|
+
scrollbar: {
|
|
510
|
+
size: a.current.clientWidth,
|
|
511
|
+
paddingStart: H(s.paddingLeft),
|
|
512
|
+
paddingEnd: H(s.paddingRight)
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
}), Me = l.forwardRef((e, t) => {
|
|
519
|
+
const { sizes: r, onSizesChange: n, ...o } = e, i = w(P, e.__scopeScrollArea), [s, c] = l.useState(), a = l.useRef(null), u = A(t, a, i.onScrollbarYChange);
|
|
520
|
+
return l.useEffect(() => {
|
|
521
|
+
a.current && c(getComputedStyle(a.current));
|
|
522
|
+
}, [a]), /* @__PURE__ */ m(
|
|
523
|
+
ie,
|
|
524
|
+
{
|
|
525
|
+
"data-orientation": "vertical",
|
|
526
|
+
...o,
|
|
527
|
+
ref: u,
|
|
528
|
+
sizes: r,
|
|
529
|
+
style: {
|
|
530
|
+
top: 0,
|
|
531
|
+
right: i.dir === "ltr" ? 0 : void 0,
|
|
532
|
+
left: i.dir === "rtl" ? 0 : void 0,
|
|
533
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
534
|
+
"--radix-scroll-area-thumb-height": V(r) + "px",
|
|
535
|
+
...e.style
|
|
536
|
+
},
|
|
537
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.y),
|
|
538
|
+
onDragScroll: (d) => e.onDragScroll(d.y),
|
|
539
|
+
onWheelScroll: (d, h) => {
|
|
540
|
+
if (i.viewport) {
|
|
541
|
+
const f = i.viewport.scrollTop + d.deltaY;
|
|
542
|
+
e.onWheelScroll(f), de(f, h) && d.preventDefault();
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
onResize: () => {
|
|
546
|
+
a.current && i.viewport && s && n({
|
|
547
|
+
content: i.viewport.scrollHeight,
|
|
548
|
+
viewport: i.viewport.offsetHeight,
|
|
549
|
+
scrollbar: {
|
|
550
|
+
size: a.current.clientHeight,
|
|
551
|
+
paddingStart: H(s.paddingTop),
|
|
552
|
+
paddingEnd: H(s.paddingBottom)
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
}), [We, le] = Q(P), ie = l.forwardRef((e, t) => {
|
|
559
|
+
const {
|
|
560
|
+
__scopeScrollArea: r,
|
|
561
|
+
sizes: n,
|
|
562
|
+
hasThumb: o,
|
|
563
|
+
onThumbChange: i,
|
|
564
|
+
onThumbPointerUp: s,
|
|
565
|
+
onThumbPointerDown: c,
|
|
566
|
+
onThumbPositionChange: a,
|
|
567
|
+
onDragScroll: u,
|
|
568
|
+
onWheelScroll: d,
|
|
569
|
+
onResize: h,
|
|
570
|
+
...f
|
|
571
|
+
} = e, p = w(P, r), [S, v] = l.useState(null), R = A(t, (b) => v(b)), C = l.useRef(null), D = l.useRef(""), X = p.viewport, O = n.content - n.viewport, M = y(d), _ = y(a), W = F(h, 10);
|
|
572
|
+
function I(b) {
|
|
573
|
+
if (C.current) {
|
|
574
|
+
const g = b.clientX - C.current.left, T = b.clientY - C.current.top;
|
|
575
|
+
u({ x: g, y: T });
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return l.useEffect(() => {
|
|
579
|
+
const b = (g) => {
|
|
580
|
+
const T = g.target;
|
|
581
|
+
(S == null ? void 0 : S.contains(T)) && M(g, O);
|
|
582
|
+
};
|
|
583
|
+
return document.addEventListener("wheel", b, { passive: !1 }), () => document.removeEventListener("wheel", b, { passive: !1 });
|
|
584
|
+
}, [X, S, O, M]), l.useEffect(_, [n, _]), x(S, W), x(p.content, W), /* @__PURE__ */ m(
|
|
585
|
+
We,
|
|
586
|
+
{
|
|
587
|
+
scope: r,
|
|
588
|
+
scrollbar: S,
|
|
589
|
+
hasThumb: o,
|
|
590
|
+
onThumbChange: y(i),
|
|
591
|
+
onThumbPointerUp: y(s),
|
|
592
|
+
onThumbPositionChange: _,
|
|
593
|
+
onThumbPointerDown: y(c),
|
|
594
|
+
children: /* @__PURE__ */ m(
|
|
595
|
+
N.div,
|
|
596
|
+
{
|
|
597
|
+
...f,
|
|
598
|
+
ref: R,
|
|
599
|
+
style: { position: "absolute", ...f.style },
|
|
600
|
+
onPointerDown: E(e.onPointerDown, (b) => {
|
|
601
|
+
b.button === 0 && (b.target.setPointerCapture(b.pointerId), C.current = S.getBoundingClientRect(), D.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", p.viewport && (p.viewport.style.scrollBehavior = "auto"), I(b));
|
|
602
|
+
}),
|
|
603
|
+
onPointerMove: E(e.onPointerMove, I),
|
|
604
|
+
onPointerUp: E(e.onPointerUp, (b) => {
|
|
605
|
+
const g = b.target;
|
|
606
|
+
g.hasPointerCapture(b.pointerId) && g.releasePointerCapture(b.pointerId), document.body.style.webkitUserSelect = D.current, p.viewport && (p.viewport.style.scrollBehavior = ""), C.current = null;
|
|
607
|
+
})
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
}
|
|
611
|
+
);
|
|
612
|
+
}), z = "ScrollAreaThumb", ce = l.forwardRef(
|
|
613
|
+
(e, t) => {
|
|
614
|
+
const { forceMount: r, ...n } = e, o = le(z, e.__scopeScrollArea);
|
|
615
|
+
return /* @__PURE__ */ m(L, { present: r || o.hasThumb, children: /* @__PURE__ */ m(Ie, { ref: t, ...n }) });
|
|
616
|
+
}
|
|
617
|
+
), Ie = l.forwardRef(
|
|
618
|
+
(e, t) => {
|
|
619
|
+
const { __scopeScrollArea: r, style: n, ...o } = e, i = w(z, r), s = le(z, r), { onThumbPositionChange: c } = s, a = A(
|
|
620
|
+
t,
|
|
621
|
+
(h) => s.onThumbChange(h)
|
|
622
|
+
), u = l.useRef(void 0), d = F(() => {
|
|
623
|
+
u.current && (u.current(), u.current = void 0);
|
|
624
|
+
}, 100);
|
|
625
|
+
return l.useEffect(() => {
|
|
626
|
+
const h = i.viewport;
|
|
627
|
+
if (h) {
|
|
628
|
+
const f = () => {
|
|
629
|
+
if (d(), !u.current) {
|
|
630
|
+
const p = He(h, c);
|
|
631
|
+
u.current = p, c();
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
return c(), h.addEventListener("scroll", f), () => h.removeEventListener("scroll", f);
|
|
635
|
+
}
|
|
636
|
+
}, [i.viewport, d, c]), /* @__PURE__ */ m(
|
|
637
|
+
N.div,
|
|
638
|
+
{
|
|
639
|
+
"data-state": s.hasThumb ? "visible" : "hidden",
|
|
640
|
+
...o,
|
|
641
|
+
ref: a,
|
|
642
|
+
style: {
|
|
643
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
644
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
645
|
+
...n
|
|
646
|
+
},
|
|
647
|
+
onPointerDownCapture: E(e.onPointerDownCapture, (h) => {
|
|
648
|
+
const p = h.target.getBoundingClientRect(), S = h.clientX - p.left, v = h.clientY - p.top;
|
|
649
|
+
s.onThumbPointerDown({ x: S, y: v });
|
|
650
|
+
}),
|
|
651
|
+
onPointerUp: E(e.onPointerUp, s.onThumbPointerUp)
|
|
652
|
+
}
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
ce.displayName = z;
|
|
657
|
+
var k = "ScrollAreaCorner", se = l.forwardRef(
|
|
658
|
+
(e, t) => {
|
|
659
|
+
const r = w(k, e.__scopeScrollArea), n = !!(r.scrollbarX && r.scrollbarY);
|
|
660
|
+
return r.type !== "scroll" && n ? /* @__PURE__ */ m(Ue, { ...e, ref: t }) : null;
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
se.displayName = k;
|
|
664
|
+
var Ue = l.forwardRef((e, t) => {
|
|
665
|
+
const { __scopeScrollArea: r, ...n } = e, o = w(k, r), [i, s] = l.useState(0), [c, a] = l.useState(0), u = !!(i && c);
|
|
666
|
+
return x(o.scrollbarX, () => {
|
|
667
|
+
var h;
|
|
668
|
+
const d = ((h = o.scrollbarX) == null ? void 0 : h.offsetHeight) || 0;
|
|
669
|
+
o.onCornerHeightChange(d), a(d);
|
|
670
|
+
}), x(o.scrollbarY, () => {
|
|
671
|
+
var h;
|
|
672
|
+
const d = ((h = o.scrollbarY) == null ? void 0 : h.offsetWidth) || 0;
|
|
673
|
+
o.onCornerWidthChange(d), s(d);
|
|
674
|
+
}), u ? /* @__PURE__ */ m(
|
|
675
|
+
N.div,
|
|
676
|
+
{
|
|
677
|
+
...n,
|
|
678
|
+
ref: t,
|
|
679
|
+
style: {
|
|
680
|
+
width: i,
|
|
681
|
+
height: c,
|
|
682
|
+
position: "absolute",
|
|
683
|
+
right: o.dir === "ltr" ? 0 : void 0,
|
|
684
|
+
left: o.dir === "rtl" ? 0 : void 0,
|
|
685
|
+
bottom: 0,
|
|
686
|
+
...e.style
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
) : null;
|
|
690
|
+
});
|
|
691
|
+
function H(e) {
|
|
692
|
+
return e ? parseInt(e, 10) : 0;
|
|
693
|
+
}
|
|
694
|
+
function ae(e, t) {
|
|
695
|
+
const r = e / t;
|
|
696
|
+
return isNaN(r) ? 0 : r;
|
|
697
|
+
}
|
|
698
|
+
function V(e) {
|
|
699
|
+
const t = ae(e.viewport, e.content), r = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, n = (e.scrollbar.size - r) * t;
|
|
700
|
+
return Math.max(n, 18);
|
|
701
|
+
}
|
|
702
|
+
function ze(e, t, r, n = "ltr") {
|
|
703
|
+
const o = V(r), i = o / 2, s = t || i, c = o - s, a = r.scrollbar.paddingStart + s, u = r.scrollbar.size - r.scrollbar.paddingEnd - c, d = r.content - r.viewport, h = n === "ltr" ? [0, d] : [d * -1, 0];
|
|
704
|
+
return ue([a, u], h)(e);
|
|
705
|
+
}
|
|
706
|
+
function q(e, t, r = "ltr") {
|
|
707
|
+
const n = V(t), o = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, i = t.scrollbar.size - o, s = t.content - t.viewport, c = i - n, a = r === "ltr" ? [0, s] : [s * -1, 0], u = xe(e, a);
|
|
708
|
+
return ue([0, s], [0, c])(u);
|
|
709
|
+
}
|
|
710
|
+
function ue(e, t) {
|
|
711
|
+
return (r) => {
|
|
712
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
713
|
+
const n = (t[1] - t[0]) / (e[1] - e[0]);
|
|
714
|
+
return t[0] + n * (r - e[0]);
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
function de(e, t) {
|
|
718
|
+
return e > 0 && e < t;
|
|
719
|
+
}
|
|
720
|
+
var He = (e, t = () => {
|
|
721
|
+
}) => {
|
|
722
|
+
let r = { left: e.scrollLeft, top: e.scrollTop }, n = 0;
|
|
723
|
+
return function o() {
|
|
724
|
+
const i = { left: e.scrollLeft, top: e.scrollTop }, s = r.left !== i.left, c = r.top !== i.top;
|
|
725
|
+
(s || c) && t(), r = i, n = window.requestAnimationFrame(o);
|
|
726
|
+
}(), () => window.cancelAnimationFrame(n);
|
|
727
|
+
};
|
|
728
|
+
function F(e, t) {
|
|
729
|
+
const r = y(e), n = l.useRef(0);
|
|
730
|
+
return l.useEffect(() => () => window.clearTimeout(n.current), []), l.useCallback(() => {
|
|
731
|
+
window.clearTimeout(n.current), n.current = window.setTimeout(r, t);
|
|
732
|
+
}, [r, t]);
|
|
733
|
+
}
|
|
734
|
+
function x(e, t) {
|
|
735
|
+
const r = y(t);
|
|
736
|
+
Y(() => {
|
|
737
|
+
let n = 0;
|
|
738
|
+
if (e) {
|
|
739
|
+
const o = new ResizeObserver(() => {
|
|
740
|
+
cancelAnimationFrame(n), n = window.requestAnimationFrame(r);
|
|
741
|
+
});
|
|
742
|
+
return o.observe(e), () => {
|
|
743
|
+
window.cancelAnimationFrame(n), o.unobserve(e);
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
}, [e, r]);
|
|
747
|
+
}
|
|
748
|
+
var Ve = ee, Fe = re, Z = oe, G = ce, Xe = se;
|
|
749
|
+
const Ze = ({
|
|
750
|
+
as: e,
|
|
751
|
+
axis: t = "both",
|
|
752
|
+
children: r,
|
|
753
|
+
className: n,
|
|
754
|
+
...o
|
|
755
|
+
}) => /* @__PURE__ */ m(Ve, { asChild: !0, children: /* @__PURE__ */ J(e || "div", { className: he("primitive-scroll-area", n), ...o, children: [
|
|
756
|
+
/* @__PURE__ */ m(Fe, { className: "primitive-scroll-area__viewport", children: r }),
|
|
757
|
+
t !== "y" && /* @__PURE__ */ m(
|
|
758
|
+
Z,
|
|
759
|
+
{
|
|
760
|
+
className: "primitive-scroll-area__bar primitive-scroll-area__bar--x",
|
|
761
|
+
orientation: "horizontal",
|
|
762
|
+
children: /* @__PURE__ */ m(G, { className: "primitive-scroll-area__thumb" })
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
t !== "x" && /* @__PURE__ */ m(
|
|
766
|
+
Z,
|
|
767
|
+
{
|
|
768
|
+
className: "primitive-scroll-area__bar primitive-scroll-area__bar--y",
|
|
769
|
+
orientation: "vertical",
|
|
770
|
+
children: /* @__PURE__ */ m(G, { className: "primitive-scroll-area__thumb" })
|
|
771
|
+
}
|
|
772
|
+
),
|
|
773
|
+
t === "both" && /* @__PURE__ */ m(Xe, { className: "primitive-scroll-area__corner" })
|
|
774
|
+
] }) });
|
|
775
|
+
export {
|
|
776
|
+
Ze as ScrollArea
|
|
777
|
+
};
|