@wrdagency/blockout 0.1.0 → 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-7XoDiJp9.js → 2NBKRL7C-BAzCMGOw.js} +2 -2
- package/dist/{4CMBR7SL-BHIN8rB4.js → 4CMBR7SL-BAGv8IL2.js} +1 -1
- package/dist/{6VRAQV3D-Clhw_nNS.js → 6VRAQV3D-2rb_aClP.js} +1 -1
- package/dist/WMYDSCNQ-Dy1O-Kdl.js +2405 -0
- package/dist/{WYCIER3C-8jmp2F15.js → WYCIER3C-DRn904Gy.js} +2 -2
- package/dist/{YV4JVR4I-LkUIiJWj.js → YV4JVR4I-kvospPUa.js} +1 -1
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/components/breadcrumbs/index.js +2 -2
- package/dist/components/controls/base-popover-control/index.js +2 -2
- package/dist/components/controls/password-control/index.js +1 -1
- package/dist/components/controls/recurrence-control/index.js +1 -1
- package/dist/components/controls/select-control/component.js +6 -6
- package/dist/components/data-table/column.js +1 -1
- package/dist/components/filesystem/file.js +1 -1
- package/dist/components/filesystem/folder.js +2 -2
- package/dist/components/filesystem/root.js +1 -1
- package/dist/components/form/components/progress.d.ts +3 -2
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +16 -18
- package/dist/components/menu/index.js +3 -3
- package/dist/components/menu/item.js +1 -1
- package/dist/components/menu/items/action.js +1 -1
- package/dist/components/menu/items/submenu.js +2 -2
- package/dist/components/menu/items/toggle.js +1 -1
- package/dist/components/progress/index.d.ts +5 -3
- package/dist/components/progress/index.js +44 -27
- package/dist/components/tabs/panel.js +2 -2
- package/dist/components/tabs/root.js +2 -2
- package/dist/components/tabs/tab.js +2 -2
- package/dist/components/toolbar/index.js +2 -2
- package/dist/components/toolbar/root.js +1 -1
- package/dist/{composite-provider-DxKEAxsZ.js → composite-provider-DNftbE5U.js} +1 -1
- package/dist/{index-BI5rPXbu.js → index-Cgx3BqdJ.js} +11 -14
- package/dist/index.js +31 -33
- package/dist/{item-BrZqCoM7.js → item-B1ugJ7YQ.js} +5 -5
- package/dist/primitives/scroll-area/index.js +522 -290
- package/dist/{root-CdR32nP9.js → root-CaKPdqzv.js} +2 -2
- package/dist/types/date.js +433 -404
- package/package.json +1 -2
- package/dist/WMYDSCNQ-DECXdiUT.js +0 -1346
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/assets/index19.css +0 -1
- package/dist/components/markdown/editor/component.d.ts +0 -7
- package/dist/components/markdown/editor/component.js +0 -25583
- package/dist/components/markdown/editor/index.d.ts +0 -1
- package/dist/components/markdown/editor/index.js +0 -4
- package/dist/components/markdown/formats.d.ts +0 -11
- package/dist/components/markdown/formats.js +0 -320
- package/dist/components/markdown/index.js +0 -8
- package/dist/components/markdown/prose.d.ts +0 -3
- package/dist/components/markdown/prose.js +0 -15
- package/dist/components/markdown/types/format.d.ts +0 -27
- package/dist/components/markdown/types/format.js +0 -4
- package/dist/floating-ui.dom-BqewRPVB.js +0 -1124
- package/dist/index-B5y9bioP.js +0 -258
- package/dist/tslib.es6-DN7pKd6F.js +0 -44
|
@@ -1,53 +1,285 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
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
5
|
import '../../assets/style3.css';/* empty css */
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
function j(e, t) {
|
|
7
|
+
if (typeof e == "function")
|
|
8
|
+
return e(t);
|
|
9
|
+
e != null && (e.current = t);
|
|
8
10
|
}
|
|
9
|
-
|
|
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(
|
|
10
242
|
(e, t) => {
|
|
11
243
|
const {
|
|
12
244
|
__scopeScrollArea: r,
|
|
13
|
-
type:
|
|
245
|
+
type: n = "hover",
|
|
14
246
|
dir: o,
|
|
15
|
-
scrollHideDelay:
|
|
16
|
-
...
|
|
17
|
-
} = e, [
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
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,
|
|
20
252
|
{
|
|
21
253
|
scope: r,
|
|
22
|
-
type:
|
|
23
|
-
dir:
|
|
24
|
-
scrollHideDelay:
|
|
25
|
-
scrollArea:
|
|
26
|
-
viewport:
|
|
254
|
+
type: n,
|
|
255
|
+
dir: g,
|
|
256
|
+
scrollHideDelay: i,
|
|
257
|
+
scrollArea: c,
|
|
258
|
+
viewport: u,
|
|
27
259
|
onViewportChange: d,
|
|
28
|
-
content:
|
|
29
|
-
onContentChange:
|
|
30
|
-
scrollbarX:
|
|
31
|
-
onScrollbarXChange:
|
|
32
|
-
scrollbarXEnabled:
|
|
260
|
+
content: h,
|
|
261
|
+
onContentChange: f,
|
|
262
|
+
scrollbarX: p,
|
|
263
|
+
onScrollbarXChange: S,
|
|
264
|
+
scrollbarXEnabled: M,
|
|
33
265
|
onScrollbarXEnabledChange: _,
|
|
34
|
-
scrollbarY:
|
|
35
|
-
onScrollbarYChange:
|
|
266
|
+
scrollbarY: v,
|
|
267
|
+
onScrollbarYChange: R,
|
|
36
268
|
scrollbarYEnabled: W,
|
|
37
|
-
onScrollbarYEnabledChange:
|
|
38
|
-
onCornerWidthChange:
|
|
39
|
-
onCornerHeightChange:
|
|
40
|
-
children: /* @__PURE__ */
|
|
41
|
-
|
|
269
|
+
onScrollbarYEnabledChange: I,
|
|
270
|
+
onCornerWidthChange: D,
|
|
271
|
+
onCornerHeightChange: O,
|
|
272
|
+
children: /* @__PURE__ */ m(
|
|
273
|
+
N.div,
|
|
42
274
|
{
|
|
43
|
-
dir:
|
|
44
|
-
...
|
|
45
|
-
ref:
|
|
275
|
+
dir: g,
|
|
276
|
+
...s,
|
|
277
|
+
ref: b,
|
|
46
278
|
style: {
|
|
47
279
|
position: "relative",
|
|
48
280
|
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
49
|
-
"--radix-scroll-area-corner-width":
|
|
50
|
-
"--radix-scroll-area-corner-height":
|
|
281
|
+
"--radix-scroll-area-corner-width": C + "px",
|
|
282
|
+
"--radix-scroll-area-corner-height": X + "px",
|
|
51
283
|
...e.style
|
|
52
284
|
}
|
|
53
285
|
}
|
|
@@ -56,12 +288,12 @@ var V = "ScrollArea", [G, We] = ue(V), [me, p] = G(V), J = c.forwardRef(
|
|
|
56
288
|
);
|
|
57
289
|
}
|
|
58
290
|
);
|
|
59
|
-
|
|
60
|
-
var
|
|
291
|
+
ee.displayName = B;
|
|
292
|
+
var te = "ScrollAreaViewport", re = l.forwardRef(
|
|
61
293
|
(e, t) => {
|
|
62
|
-
const { __scopeScrollArea: r, children:
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
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(
|
|
65
297
|
"style",
|
|
66
298
|
{
|
|
67
299
|
dangerouslySetInnerHTML: {
|
|
@@ -70,12 +302,12 @@ var K = "ScrollAreaViewport", Q = c.forwardRef(
|
|
|
70
302
|
nonce: o
|
|
71
303
|
}
|
|
72
304
|
),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
305
|
+
/* @__PURE__ */ m(
|
|
306
|
+
N.div,
|
|
75
307
|
{
|
|
76
308
|
"data-radix-scroll-area-viewport": "",
|
|
77
|
-
...
|
|
78
|
-
ref:
|
|
309
|
+
...i,
|
|
310
|
+
ref: a,
|
|
79
311
|
style: {
|
|
80
312
|
/**
|
|
81
313
|
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
@@ -88,51 +320,51 @@ var K = "ScrollAreaViewport", Q = c.forwardRef(
|
|
|
88
320
|
* the browser from having to work out whether to render native scrollbars or not,
|
|
89
321
|
* we tell it to with the intention of hiding them in CSS.
|
|
90
322
|
*/
|
|
91
|
-
overflowX:
|
|
92
|
-
overflowY:
|
|
323
|
+
overflowX: s.scrollbarXEnabled ? "scroll" : "hidden",
|
|
324
|
+
overflowY: s.scrollbarYEnabled ? "scroll" : "hidden",
|
|
93
325
|
...e.style
|
|
94
326
|
},
|
|
95
|
-
children: /* @__PURE__ */
|
|
327
|
+
children: /* @__PURE__ */ m("div", { ref: s.onContentChange, style: { minWidth: "100%", display: "table" }, children: n })
|
|
96
328
|
}
|
|
97
329
|
)
|
|
98
330
|
] });
|
|
99
331
|
}
|
|
100
332
|
);
|
|
101
|
-
|
|
102
|
-
var
|
|
333
|
+
re.displayName = te;
|
|
334
|
+
var P = "ScrollAreaScrollbar", oe = l.forwardRef(
|
|
103
335
|
(e, t) => {
|
|
104
|
-
const { forceMount: r, ...
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
}), [
|
|
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;
|
|
108
340
|
}
|
|
109
341
|
);
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
const { forceMount: r, ...
|
|
113
|
-
return
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
window.clearTimeout(
|
|
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);
|
|
119
351
|
}, d = () => {
|
|
120
|
-
|
|
352
|
+
a = window.setTimeout(() => s(!1), o.scrollHideDelay);
|
|
121
353
|
};
|
|
122
|
-
return
|
|
123
|
-
window.clearTimeout(
|
|
354
|
+
return c.addEventListener("pointerenter", u), c.addEventListener("pointerleave", d), () => {
|
|
355
|
+
window.clearTimeout(a), c.removeEventListener("pointerenter", u), c.removeEventListener("pointerleave", d);
|
|
124
356
|
};
|
|
125
357
|
}
|
|
126
|
-
}, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */
|
|
127
|
-
|
|
358
|
+
}, [o.scrollArea, o.scrollHideDelay]), /* @__PURE__ */ m(L, { present: r || i, children: /* @__PURE__ */ m(
|
|
359
|
+
ne,
|
|
128
360
|
{
|
|
129
|
-
"data-state":
|
|
130
|
-
...
|
|
361
|
+
"data-state": i ? "visible" : "hidden",
|
|
362
|
+
...n,
|
|
131
363
|
ref: t
|
|
132
364
|
}
|
|
133
365
|
) });
|
|
134
|
-
}),
|
|
135
|
-
const { forceMount: r, ...
|
|
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", {
|
|
136
368
|
hidden: {
|
|
137
369
|
SCROLL: "scrolling"
|
|
138
370
|
},
|
|
@@ -150,303 +382,303 @@ var Se = c.forwardRef((e, t) => {
|
|
|
150
382
|
POINTER_ENTER: "interacting"
|
|
151
383
|
}
|
|
152
384
|
});
|
|
153
|
-
return
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
return () => window.clearTimeout(
|
|
385
|
+
return l.useEffect(() => {
|
|
386
|
+
if (c === "idle") {
|
|
387
|
+
const u = window.setTimeout(() => a("HIDE"), o.scrollHideDelay);
|
|
388
|
+
return () => window.clearTimeout(u);
|
|
157
389
|
}
|
|
158
|
-
}, [
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
let
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
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;
|
|
165
397
|
};
|
|
166
|
-
return
|
|
398
|
+
return u.addEventListener("scroll", f), () => u.removeEventListener("scroll", f);
|
|
167
399
|
}
|
|
168
|
-
}, [o.viewport,
|
|
169
|
-
|
|
400
|
+
}, [o.viewport, i, a, s]), /* @__PURE__ */ m(L, { present: r || c !== "hidden", children: /* @__PURE__ */ m(
|
|
401
|
+
$,
|
|
170
402
|
{
|
|
171
|
-
"data-state":
|
|
172
|
-
...
|
|
403
|
+
"data-state": c === "hidden" ? "hidden" : "visible",
|
|
404
|
+
...n,
|
|
173
405
|
ref: t,
|
|
174
|
-
onPointerEnter:
|
|
175
|
-
onPointerLeave:
|
|
406
|
+
onPointerEnter: E(e.onPointerEnter, () => a("POINTER_ENTER")),
|
|
407
|
+
onPointerLeave: E(e.onPointerLeave, () => a("POINTER_LEAVE"))
|
|
176
408
|
}
|
|
177
409
|
) });
|
|
178
|
-
}),
|
|
179
|
-
const r =
|
|
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(() => {
|
|
180
412
|
if (r.viewport) {
|
|
181
|
-
const
|
|
182
|
-
|
|
413
|
+
const u = r.viewport.offsetWidth < r.viewport.scrollWidth, d = r.viewport.offsetHeight < r.viewport.scrollHeight;
|
|
414
|
+
s(c ? u : d);
|
|
183
415
|
}
|
|
184
416
|
}, 10);
|
|
185
|
-
return
|
|
186
|
-
|
|
417
|
+
return x(r.viewport, a), x(r.content, a), /* @__PURE__ */ m(L, { present: n || i, children: /* @__PURE__ */ m(
|
|
418
|
+
$,
|
|
187
419
|
{
|
|
188
|
-
"data-state":
|
|
420
|
+
"data-state": i ? "visible" : "hidden",
|
|
189
421
|
...o,
|
|
190
422
|
ref: t
|
|
191
423
|
}
|
|
192
424
|
) });
|
|
193
|
-
}),
|
|
194
|
-
const { orientation: r = "vertical", ...
|
|
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({
|
|
195
427
|
content: 0,
|
|
196
428
|
viewport: 0,
|
|
197
429
|
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
198
|
-
}),
|
|
199
|
-
...
|
|
200
|
-
sizes:
|
|
201
|
-
onSizesChange:
|
|
202
|
-
hasThumb:
|
|
203
|
-
onThumbChange: (
|
|
204
|
-
onThumbPointerUp: () =>
|
|
205
|
-
onThumbPointerDown: (
|
|
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
|
|
206
438
|
};
|
|
207
|
-
function
|
|
208
|
-
return
|
|
439
|
+
function h(f, p) {
|
|
440
|
+
return ze(f, s.current, c, p);
|
|
209
441
|
}
|
|
210
|
-
return r === "horizontal" ? /* @__PURE__ */
|
|
211
|
-
|
|
442
|
+
return r === "horizontal" ? /* @__PURE__ */ m(
|
|
443
|
+
Oe,
|
|
212
444
|
{
|
|
213
445
|
...d,
|
|
214
446
|
ref: t,
|
|
215
447
|
onThumbPositionChange: () => {
|
|
216
|
-
if (o.viewport &&
|
|
217
|
-
const
|
|
218
|
-
|
|
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)`;
|
|
219
451
|
}
|
|
220
452
|
},
|
|
221
|
-
onWheelScroll: (
|
|
222
|
-
o.viewport && (o.viewport.scrollLeft =
|
|
453
|
+
onWheelScroll: (f) => {
|
|
454
|
+
o.viewport && (o.viewport.scrollLeft = f);
|
|
223
455
|
},
|
|
224
|
-
onDragScroll: (
|
|
225
|
-
o.viewport && (o.viewport.scrollLeft =
|
|
456
|
+
onDragScroll: (f) => {
|
|
457
|
+
o.viewport && (o.viewport.scrollLeft = h(f, o.dir));
|
|
226
458
|
}
|
|
227
459
|
}
|
|
228
|
-
) : r === "vertical" ? /* @__PURE__ */
|
|
229
|
-
|
|
460
|
+
) : r === "vertical" ? /* @__PURE__ */ m(
|
|
461
|
+
Me,
|
|
230
462
|
{
|
|
231
463
|
...d,
|
|
232
464
|
ref: t,
|
|
233
465
|
onThumbPositionChange: () => {
|
|
234
|
-
if (o.viewport &&
|
|
235
|
-
const
|
|
236
|
-
|
|
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)`;
|
|
237
469
|
}
|
|
238
470
|
},
|
|
239
|
-
onWheelScroll: (
|
|
240
|
-
o.viewport && (o.viewport.scrollTop =
|
|
471
|
+
onWheelScroll: (f) => {
|
|
472
|
+
o.viewport && (o.viewport.scrollTop = f);
|
|
241
473
|
},
|
|
242
|
-
onDragScroll: (
|
|
243
|
-
o.viewport && (o.viewport.scrollTop =
|
|
474
|
+
onDragScroll: (f) => {
|
|
475
|
+
o.viewport && (o.viewport.scrollTop = h(f));
|
|
244
476
|
}
|
|
245
477
|
}
|
|
246
478
|
) : null;
|
|
247
|
-
}),
|
|
248
|
-
const { sizes: r, onSizesChange:
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
}, [
|
|
252
|
-
|
|
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,
|
|
253
485
|
{
|
|
254
486
|
"data-orientation": "horizontal",
|
|
255
487
|
...o,
|
|
256
|
-
ref:
|
|
488
|
+
ref: u,
|
|
257
489
|
sizes: r,
|
|
258
490
|
style: {
|
|
259
491
|
bottom: 0,
|
|
260
|
-
left:
|
|
261
|
-
right:
|
|
262
|
-
"--radix-scroll-area-thumb-width":
|
|
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",
|
|
263
495
|
...e.style
|
|
264
496
|
},
|
|
265
497
|
onThumbPointerDown: (d) => e.onThumbPointerDown(d.x),
|
|
266
498
|
onDragScroll: (d) => e.onDragScroll(d.x),
|
|
267
|
-
onWheelScroll: (d,
|
|
268
|
-
if (
|
|
269
|
-
const
|
|
270
|
-
e.onWheelScroll(
|
|
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();
|
|
271
503
|
}
|
|
272
504
|
},
|
|
273
505
|
onResize: () => {
|
|
274
|
-
|
|
275
|
-
content:
|
|
276
|
-
viewport:
|
|
506
|
+
a.current && i.viewport && s && n({
|
|
507
|
+
content: i.viewport.scrollWidth,
|
|
508
|
+
viewport: i.viewport.offsetWidth,
|
|
277
509
|
scrollbar: {
|
|
278
|
-
size:
|
|
279
|
-
paddingStart:
|
|
280
|
-
paddingEnd:
|
|
510
|
+
size: a.current.clientWidth,
|
|
511
|
+
paddingStart: H(s.paddingLeft),
|
|
512
|
+
paddingEnd: H(s.paddingRight)
|
|
281
513
|
}
|
|
282
514
|
});
|
|
283
515
|
}
|
|
284
516
|
}
|
|
285
517
|
);
|
|
286
|
-
}),
|
|
287
|
-
const { sizes: r, onSizesChange:
|
|
288
|
-
return
|
|
289
|
-
|
|
290
|
-
}, [
|
|
291
|
-
|
|
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,
|
|
292
524
|
{
|
|
293
525
|
"data-orientation": "vertical",
|
|
294
526
|
...o,
|
|
295
|
-
ref:
|
|
527
|
+
ref: u,
|
|
296
528
|
sizes: r,
|
|
297
529
|
style: {
|
|
298
530
|
top: 0,
|
|
299
|
-
right:
|
|
300
|
-
left:
|
|
531
|
+
right: i.dir === "ltr" ? 0 : void 0,
|
|
532
|
+
left: i.dir === "rtl" ? 0 : void 0,
|
|
301
533
|
bottom: "var(--radix-scroll-area-corner-height)",
|
|
302
|
-
"--radix-scroll-area-thumb-height":
|
|
534
|
+
"--radix-scroll-area-thumb-height": V(r) + "px",
|
|
303
535
|
...e.style
|
|
304
536
|
},
|
|
305
537
|
onThumbPointerDown: (d) => e.onThumbPointerDown(d.y),
|
|
306
538
|
onDragScroll: (d) => e.onDragScroll(d.y),
|
|
307
|
-
onWheelScroll: (d,
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
e.onWheelScroll(
|
|
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();
|
|
311
543
|
}
|
|
312
544
|
},
|
|
313
545
|
onResize: () => {
|
|
314
|
-
|
|
315
|
-
content:
|
|
316
|
-
viewport:
|
|
546
|
+
a.current && i.viewport && s && n({
|
|
547
|
+
content: i.viewport.scrollHeight,
|
|
548
|
+
viewport: i.viewport.offsetHeight,
|
|
317
549
|
scrollbar: {
|
|
318
|
-
size:
|
|
319
|
-
paddingStart:
|
|
320
|
-
paddingEnd:
|
|
550
|
+
size: a.current.clientHeight,
|
|
551
|
+
paddingStart: H(s.paddingTop),
|
|
552
|
+
paddingEnd: H(s.paddingBottom)
|
|
321
553
|
}
|
|
322
554
|
});
|
|
323
555
|
}
|
|
324
556
|
}
|
|
325
557
|
);
|
|
326
|
-
}), [
|
|
558
|
+
}), [We, le] = Q(P), ie = l.forwardRef((e, t) => {
|
|
327
559
|
const {
|
|
328
560
|
__scopeScrollArea: r,
|
|
329
|
-
sizes:
|
|
561
|
+
sizes: n,
|
|
330
562
|
hasThumb: o,
|
|
331
|
-
onThumbChange:
|
|
332
|
-
onThumbPointerUp:
|
|
333
|
-
onThumbPointerDown:
|
|
334
|
-
onThumbPositionChange:
|
|
335
|
-
onDragScroll:
|
|
563
|
+
onThumbChange: i,
|
|
564
|
+
onThumbPointerUp: s,
|
|
565
|
+
onThumbPointerDown: c,
|
|
566
|
+
onThumbPositionChange: a,
|
|
567
|
+
onDragScroll: u,
|
|
336
568
|
onWheelScroll: d,
|
|
337
|
-
onResize:
|
|
338
|
-
...
|
|
339
|
-
} = e,
|
|
340
|
-
function
|
|
341
|
-
if (
|
|
342
|
-
const
|
|
343
|
-
|
|
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 });
|
|
344
576
|
}
|
|
345
577
|
}
|
|
346
|
-
return
|
|
347
|
-
const
|
|
348
|
-
const
|
|
349
|
-
(
|
|
578
|
+
return l.useEffect(() => {
|
|
579
|
+
const b = (g) => {
|
|
580
|
+
const T = g.target;
|
|
581
|
+
(S == null ? void 0 : S.contains(T)) && M(g, O);
|
|
350
582
|
};
|
|
351
|
-
return document.addEventListener("wheel",
|
|
352
|
-
}, [
|
|
353
|
-
|
|
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,
|
|
354
586
|
{
|
|
355
587
|
scope: r,
|
|
356
|
-
scrollbar:
|
|
588
|
+
scrollbar: S,
|
|
357
589
|
hasThumb: o,
|
|
358
|
-
onThumbChange:
|
|
359
|
-
onThumbPointerUp:
|
|
590
|
+
onThumbChange: y(i),
|
|
591
|
+
onThumbPointerUp: y(s),
|
|
360
592
|
onThumbPositionChange: _,
|
|
361
|
-
onThumbPointerDown:
|
|
362
|
-
children: /* @__PURE__ */
|
|
363
|
-
|
|
593
|
+
onThumbPointerDown: y(c),
|
|
594
|
+
children: /* @__PURE__ */ m(
|
|
595
|
+
N.div,
|
|
364
596
|
{
|
|
365
|
-
...
|
|
366
|
-
ref:
|
|
367
|
-
style: { position: "absolute", ...
|
|
368
|
-
onPointerDown:
|
|
369
|
-
|
|
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));
|
|
370
602
|
}),
|
|
371
|
-
onPointerMove:
|
|
372
|
-
onPointerUp:
|
|
373
|
-
const
|
|
374
|
-
|
|
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;
|
|
375
607
|
})
|
|
376
608
|
}
|
|
377
609
|
)
|
|
378
610
|
}
|
|
379
611
|
);
|
|
380
|
-
}), z = "ScrollAreaThumb",
|
|
612
|
+
}), z = "ScrollAreaThumb", ce = l.forwardRef(
|
|
381
613
|
(e, t) => {
|
|
382
|
-
const { forceMount: r, ...
|
|
383
|
-
return /* @__PURE__ */
|
|
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 }) });
|
|
384
616
|
}
|
|
385
|
-
),
|
|
617
|
+
), Ie = l.forwardRef(
|
|
386
618
|
(e, t) => {
|
|
387
|
-
const { __scopeScrollArea: r, style:
|
|
619
|
+
const { __scopeScrollArea: r, style: n, ...o } = e, i = w(z, r), s = le(z, r), { onThumbPositionChange: c } = s, a = A(
|
|
388
620
|
t,
|
|
389
|
-
(
|
|
390
|
-
),
|
|
391
|
-
|
|
621
|
+
(h) => s.onThumbChange(h)
|
|
622
|
+
), u = l.useRef(void 0), d = F(() => {
|
|
623
|
+
u.current && (u.current(), u.current = void 0);
|
|
392
624
|
}, 100);
|
|
393
|
-
return
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
396
|
-
const
|
|
397
|
-
if (d(), !
|
|
398
|
-
const
|
|
399
|
-
|
|
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();
|
|
400
632
|
}
|
|
401
633
|
};
|
|
402
|
-
return
|
|
634
|
+
return c(), h.addEventListener("scroll", f), () => h.removeEventListener("scroll", f);
|
|
403
635
|
}
|
|
404
|
-
}, [
|
|
405
|
-
|
|
636
|
+
}, [i.viewport, d, c]), /* @__PURE__ */ m(
|
|
637
|
+
N.div,
|
|
406
638
|
{
|
|
407
|
-
"data-state":
|
|
639
|
+
"data-state": s.hasThumb ? "visible" : "hidden",
|
|
408
640
|
...o,
|
|
409
|
-
ref:
|
|
641
|
+
ref: a,
|
|
410
642
|
style: {
|
|
411
643
|
width: "var(--radix-scroll-area-thumb-width)",
|
|
412
644
|
height: "var(--radix-scroll-area-thumb-height)",
|
|
413
|
-
...
|
|
645
|
+
...n
|
|
414
646
|
},
|
|
415
|
-
onPointerDownCapture:
|
|
416
|
-
const
|
|
417
|
-
|
|
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 });
|
|
418
650
|
}),
|
|
419
|
-
onPointerUp:
|
|
651
|
+
onPointerUp: E(e.onPointerUp, s.onThumbPointerUp)
|
|
420
652
|
}
|
|
421
653
|
);
|
|
422
654
|
}
|
|
423
655
|
);
|
|
424
|
-
|
|
425
|
-
var
|
|
656
|
+
ce.displayName = z;
|
|
657
|
+
var k = "ScrollAreaCorner", se = l.forwardRef(
|
|
426
658
|
(e, t) => {
|
|
427
|
-
const r =
|
|
428
|
-
return r.type !== "scroll" &&
|
|
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;
|
|
429
661
|
}
|
|
430
662
|
);
|
|
431
|
-
|
|
432
|
-
var
|
|
433
|
-
const { __scopeScrollArea: r, ...
|
|
434
|
-
return
|
|
435
|
-
var
|
|
436
|
-
const d = ((
|
|
437
|
-
o.onCornerHeightChange(d),
|
|
438
|
-
}),
|
|
439
|
-
var
|
|
440
|
-
const d = ((
|
|
441
|
-
o.onCornerWidthChange(d),
|
|
442
|
-
}),
|
|
443
|
-
|
|
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,
|
|
444
676
|
{
|
|
445
|
-
...
|
|
677
|
+
...n,
|
|
446
678
|
ref: t,
|
|
447
679
|
style: {
|
|
448
|
-
width:
|
|
449
|
-
height:
|
|
680
|
+
width: i,
|
|
681
|
+
height: c,
|
|
450
682
|
position: "absolute",
|
|
451
683
|
right: o.dir === "ltr" ? 0 : void 0,
|
|
452
684
|
left: o.dir === "rtl" ? 0 : void 0,
|
|
@@ -456,90 +688,90 @@ var Ce = c.forwardRef((e, t) => {
|
|
|
456
688
|
}
|
|
457
689
|
) : null;
|
|
458
690
|
});
|
|
459
|
-
function
|
|
691
|
+
function H(e) {
|
|
460
692
|
return e ? parseInt(e, 10) : 0;
|
|
461
693
|
}
|
|
462
|
-
function
|
|
694
|
+
function ae(e, t) {
|
|
463
695
|
const r = e / t;
|
|
464
696
|
return isNaN(r) ? 0 : r;
|
|
465
697
|
}
|
|
466
|
-
function
|
|
467
|
-
const t =
|
|
468
|
-
return Math.max(
|
|
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);
|
|
469
701
|
}
|
|
470
|
-
function
|
|
471
|
-
const o =
|
|
472
|
-
return
|
|
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);
|
|
473
705
|
}
|
|
474
|
-
function
|
|
475
|
-
const
|
|
476
|
-
return
|
|
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);
|
|
477
709
|
}
|
|
478
|
-
function
|
|
710
|
+
function ue(e, t) {
|
|
479
711
|
return (r) => {
|
|
480
712
|
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
481
|
-
const
|
|
482
|
-
return t[0] +
|
|
713
|
+
const n = (t[1] - t[0]) / (e[1] - e[0]);
|
|
714
|
+
return t[0] + n * (r - e[0]);
|
|
483
715
|
};
|
|
484
716
|
}
|
|
485
|
-
function
|
|
717
|
+
function de(e, t) {
|
|
486
718
|
return e > 0 && e < t;
|
|
487
719
|
}
|
|
488
|
-
var
|
|
720
|
+
var He = (e, t = () => {
|
|
489
721
|
}) => {
|
|
490
|
-
let r = { left: e.scrollLeft, top: e.scrollTop },
|
|
722
|
+
let r = { left: e.scrollLeft, top: e.scrollTop }, n = 0;
|
|
491
723
|
return function o() {
|
|
492
|
-
const
|
|
493
|
-
(
|
|
494
|
-
}(), () => window.cancelAnimationFrame(
|
|
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);
|
|
495
727
|
};
|
|
496
|
-
function
|
|
497
|
-
const r =
|
|
498
|
-
return
|
|
499
|
-
window.clearTimeout(
|
|
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);
|
|
500
732
|
}, [r, t]);
|
|
501
733
|
}
|
|
502
|
-
function
|
|
503
|
-
const r =
|
|
504
|
-
|
|
505
|
-
let
|
|
734
|
+
function x(e, t) {
|
|
735
|
+
const r = y(t);
|
|
736
|
+
Y(() => {
|
|
737
|
+
let n = 0;
|
|
506
738
|
if (e) {
|
|
507
739
|
const o = new ResizeObserver(() => {
|
|
508
|
-
cancelAnimationFrame(
|
|
740
|
+
cancelAnimationFrame(n), n = window.requestAnimationFrame(r);
|
|
509
741
|
});
|
|
510
742
|
return o.observe(e), () => {
|
|
511
|
-
window.cancelAnimationFrame(
|
|
743
|
+
window.cancelAnimationFrame(n), o.unobserve(e);
|
|
512
744
|
};
|
|
513
745
|
}
|
|
514
746
|
}, [e, r]);
|
|
515
747
|
}
|
|
516
|
-
var
|
|
517
|
-
const
|
|
748
|
+
var Ve = ee, Fe = re, Z = oe, G = ce, Xe = se;
|
|
749
|
+
const Ze = ({
|
|
518
750
|
as: e,
|
|
519
751
|
axis: t = "both",
|
|
520
752
|
children: r,
|
|
521
|
-
className:
|
|
753
|
+
className: n,
|
|
522
754
|
...o
|
|
523
|
-
}) => /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
t !== "y" && /* @__PURE__ */
|
|
526
|
-
|
|
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,
|
|
527
759
|
{
|
|
528
760
|
className: "primitive-scroll-area__bar primitive-scroll-area__bar--x",
|
|
529
761
|
orientation: "horizontal",
|
|
530
|
-
children: /* @__PURE__ */
|
|
762
|
+
children: /* @__PURE__ */ m(G, { className: "primitive-scroll-area__thumb" })
|
|
531
763
|
}
|
|
532
764
|
),
|
|
533
|
-
t !== "x" && /* @__PURE__ */
|
|
534
|
-
|
|
765
|
+
t !== "x" && /* @__PURE__ */ m(
|
|
766
|
+
Z,
|
|
535
767
|
{
|
|
536
768
|
className: "primitive-scroll-area__bar primitive-scroll-area__bar--y",
|
|
537
769
|
orientation: "vertical",
|
|
538
|
-
children: /* @__PURE__ */
|
|
770
|
+
children: /* @__PURE__ */ m(G, { className: "primitive-scroll-area__thumb" })
|
|
539
771
|
}
|
|
540
772
|
),
|
|
541
|
-
t === "both" && /* @__PURE__ */
|
|
773
|
+
t === "both" && /* @__PURE__ */ m(Xe, { className: "primitive-scroll-area__corner" })
|
|
542
774
|
] }) });
|
|
543
775
|
export {
|
|
544
|
-
|
|
776
|
+
Ze as ScrollArea
|
|
545
777
|
};
|