@orioncactuscorp/ui 1.9.2 → 1.11.0
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 +119 -54
- package/dist/components/Accordion/Accordion.css +1 -1
- package/dist/components/Accordion/Accordion.js +169 -177
- package/dist/components/ActionArea/ActionAreaLayout.js +20 -24
- package/dist/components/Cell/Cell.css +1 -1
- package/dist/components/Cell/Cell.js +57 -58
- package/dist/components/CheckMark/CheckMark.css +1 -1
- package/dist/components/Checkbox/Checkbox.css +1 -1
- package/dist/components/Checkbox/Checkbox.js +50 -51
- package/dist/components/Menu/Menu.css +1 -1
- package/dist/components/Menu/Menu.module.scss.js +20 -22
- package/dist/components/Modal/Modal.css +1 -1
- package/dist/components/Modal/Modal.js +585 -575
- package/dist/components/Modal/bottomSheetGeometry.js +46 -33
- package/dist/components/Modal/modalScrollArbitration.js +71 -49
- package/dist/components/Modal/snapPoints.js +42 -38
- package/dist/components/Modal/useModalContentBlockTransition.js +49 -44
- package/dist/components/Modal/useModalDrag.js +937 -854
- package/dist/components/Radio/Radio.css +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +197 -200
- package/dist/components/Select/Select.js +31 -34
- package/dist/components/Switch/Switch.css +1 -1
- package/dist/components/Tabs/Tabs.css +1 -0
- package/dist/components/Tabs/Tabs.js +208 -0
- package/dist/components/Tabs/Tabs.module.scss.js +27 -0
- package/dist/components/Tabs.d.ts +6 -0
- package/dist/components/Tabs.js +8 -0
- package/dist/components/TextArea/TextArea.js +57 -58
- package/dist/components/TextInput/TextInput.js +30 -33
- package/dist/components/Tooltip/Tooltip.css +1 -1
- package/dist/foundations/color.theme.dark.css +1 -1
- package/dist/foundations/color.theme.light.css +1 -1
- package/dist/foundations/focus.css +1 -0
- package/dist/foundations/reset.css +1 -1
- package/dist/foundations.css +4 -3
- package/dist/index.js +69 -64
- package/dist/react/motion.js +31 -35
- package/dist/reset.css +1 -1
- package/dist/styles.css +14 -12
- package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts.map +1 -1
- package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -1
- package/dist/ui/src/components/CheckMark/types.d.ts +10 -0
- package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
- package/dist/ui/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/ui/src/components/Checkbox/types.d.ts +16 -0
- package/dist/ui/src/components/Checkbox/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts +1 -1
- package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts +13 -0
- package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/snapPoints.d.ts +3 -1
- package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/types.d.ts +8 -0
- package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalContentBlockTransition.d.ts.map +1 -1
- package/dist/ui/src/components/Modal/useModalDrag.d.ts +27 -10
- package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
- package/dist/ui/src/components/Radio/types.d.ts +16 -0
- package/dist/ui/src/components/Radio/types.d.ts.map +1 -1
- package/dist/ui/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/ui/src/components/Select/Select.d.ts.map +1 -1
- package/dist/ui/src/components/Switch/types.d.ts +10 -0
- package/dist/ui/src/components/Switch/types.d.ts.map +1 -1
- package/dist/ui/src/components/Tabs/Tabs.d.ts +7 -0
- package/dist/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/ui/src/components/Tabs/index.d.ts +3 -0
- package/dist/ui/src/components/Tabs/index.d.ts.map +1 -0
- package/dist/ui/src/components/Tabs/types.d.ts +26 -0
- package/dist/ui/src/components/Tabs/types.d.ts.map +1 -0
- package/dist/ui/src/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/ui/src/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/ui/src/index.d.ts +2 -0
- package/dist/ui/src/index.d.ts.map +1 -1
- package/dist/ui/src/react/motion/index.d.ts.map +1 -1
- package/dist/ui/src/utils/mergeRefs.d.ts +13 -0
- package/dist/ui/src/utils/mergeRefs.d.ts.map +1 -0
- package/dist/utils/mergeRefs.js +24 -0
- package/dist/vscode/oc-ui-vars.css +13 -0
- package/docs/editor-setup.md +42 -0
- package/docs/motion.md +665 -0
- package/docs/responsive-foundation-profile.md +230 -0
- package/docs/scss-helpers.md +189 -0
- package/docs/selector-contract.md +260 -0
- package/docs/spring.md +382 -0
- package/docs/stability.md +62 -0
- package/docs/tokens.md +559 -0
- package/package.json +9 -4
- package/src/scss/foundations/color-theme.test.ts +14 -0
- package/src/scss/foundations/color.theme.dark.scss +1 -0
- package/src/scss/foundations/color.theme.light.scss +1 -0
- package/src/scss/foundations/focus.scss +4 -0
- package/src/scss/foundations/focus.test.ts +48 -0
- package/src/scss/foundations/reset.scss +9 -4
- package/src/scss/foundations/reset.test.ts +32 -0
- package/src/scss/index.scss +2 -0
- package/src/scss/mixins/_focus.scss +11 -0
- package/src/scss/mixins/_focus.test.ts +58 -0
|
@@ -1,84 +1,80 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
2
|
+
import { jsx as g, jsxs as At } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as f, useSyncExternalStore as vt, useState as X, useMemo as st, useCallback as u, useEffect as it, useLayoutEffect as bt, useContext as Nt } from "react";
|
|
4
|
+
import Et from "../Interaction/Interaction.js";
|
|
5
|
+
import { mergeRefs as yt } from "../../utils/mergeRefs.js";
|
|
6
|
+
import { ScrollAreaContext as St } from "./contexts.js";
|
|
7
|
+
import v from "./ScrollArea.module.scss.js";
|
|
7
8
|
import { useScrollAreaGeometryStabilizer as Ot } from "./useScrollAreaGeometryStabilizer.js";
|
|
8
9
|
const lt = "oc-scroll-area-container-style", at = "oc-scroll-area-root-style";
|
|
9
10
|
let F = 0, q = 0;
|
|
10
|
-
function
|
|
11
|
+
function Rt() {
|
|
11
12
|
return () => {
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
function $t() {
|
|
15
16
|
return !0;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function Tt() {
|
|
18
19
|
return !1;
|
|
19
20
|
}
|
|
20
21
|
function Vt() {
|
|
21
22
|
return typeof window < "u" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
22
23
|
}
|
|
23
|
-
function C(
|
|
24
|
-
return
|
|
24
|
+
function C(w) {
|
|
25
|
+
return w.preventDefault(), !1;
|
|
25
26
|
}
|
|
26
|
-
function Ut(
|
|
27
|
+
function Ut(w, n) {
|
|
27
28
|
let E = !1;
|
|
28
29
|
return () => {
|
|
29
|
-
E || (
|
|
30
|
+
E || (w(), E = !0, window.setTimeout(() => {
|
|
30
31
|
E = !1;
|
|
31
|
-
},
|
|
32
|
+
}, n));
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
35
|
+
function T(w, n) {
|
|
36
|
+
w && (w.dataset.state = n, w.dataset.ocState = n);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function Qt({
|
|
41
|
-
as: m,
|
|
42
|
-
root: e = !1,
|
|
38
|
+
function Zt({
|
|
39
|
+
as: w,
|
|
40
|
+
root: n = !1,
|
|
43
41
|
children: E,
|
|
44
42
|
className: L = "",
|
|
45
43
|
ref: k,
|
|
46
44
|
"data-oc-component": A = "scroll-area",
|
|
47
45
|
...N
|
|
48
46
|
}) {
|
|
49
|
-
const M =
|
|
50
|
-
|
|
47
|
+
const M = w ?? "div", P = f(null), b = vt(
|
|
48
|
+
Rt,
|
|
51
49
|
$t,
|
|
52
|
-
|
|
53
|
-
), y =
|
|
54
|
-
|
|
50
|
+
Tt
|
|
51
|
+
), y = vt(
|
|
52
|
+
Rt,
|
|
55
53
|
Vt,
|
|
56
|
-
|
|
57
|
-
), [o,
|
|
58
|
-
(
|
|
59
|
-
P.current = t, yt(k, t);
|
|
60
|
-
},
|
|
54
|
+
Tt
|
|
55
|
+
), [o, Ht] = X(null), [J, Wt] = X(!1), [K, Ct] = X(!1), B = f(null), m = f(null), s = f(null), D = f(null), p = f(null), d = f(null), [O, Lt] = X(null), [$, Mt] = X(null), x = f(!1), Y = f(!1), Q = f(0), Z = f(0), H = f(null), S = f(null), V = f(null), U = f(null), ut = st(
|
|
56
|
+
() => yt(P, k),
|
|
61
57
|
[k]
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
}, []),
|
|
65
|
-
|
|
66
|
-
}, []),
|
|
67
|
-
|
|
68
|
-
}, []),
|
|
69
|
-
() => ({ isRoot:
|
|
70
|
-
[
|
|
58
|
+
), dt = u((t) => {
|
|
59
|
+
Ht(t);
|
|
60
|
+
}, []), Pt = u((t) => {
|
|
61
|
+
m.current = t, Lt(t);
|
|
62
|
+
}, []), Bt = u((t) => {
|
|
63
|
+
p.current = t, Mt(t);
|
|
64
|
+
}, []), Dt = st(
|
|
65
|
+
() => ({ isRoot: n, setContainerRef: dt }),
|
|
66
|
+
[n, dt]
|
|
71
67
|
);
|
|
72
68
|
it(() => {
|
|
73
|
-
if (!(!
|
|
74
|
-
if (F += 1,
|
|
69
|
+
if (!(!b || y || typeof document > "u")) {
|
|
70
|
+
if (F += 1, n && (q += 1), !document.getElementById(lt)) {
|
|
75
71
|
const t = document.createElement("style");
|
|
76
72
|
t.id = lt, t.textContent = `
|
|
77
73
|
[data-oc-scroll-container]::-webkit-scrollbar { display: none; }
|
|
78
74
|
[data-oc-scroll-container] { scrollbar-width: none; }
|
|
79
75
|
`, document.head.appendChild(t);
|
|
80
76
|
}
|
|
81
|
-
if (
|
|
77
|
+
if (n && !document.getElementById(at)) {
|
|
82
78
|
const t = document.createElement("style");
|
|
83
79
|
t.id = at, t.textContent = `
|
|
84
80
|
::-webkit-scrollbar { display: none; }
|
|
@@ -86,204 +82,204 @@ function Qt({
|
|
|
86
82
|
`, document.head.appendChild(t);
|
|
87
83
|
}
|
|
88
84
|
return () => {
|
|
89
|
-
F = Math.max(0, F - 1),
|
|
85
|
+
F = Math.max(0, F - 1), n && (q = Math.max(
|
|
90
86
|
0,
|
|
91
87
|
q - 1
|
|
92
88
|
)), q === 0 && document.getElementById(at)?.remove(), F === 0 && document.getElementById(lt)?.remove();
|
|
93
89
|
};
|
|
94
90
|
}
|
|
95
|
-
}, [
|
|
96
|
-
if (!
|
|
91
|
+
}, [b, n, y]), it(() => {
|
|
92
|
+
if (!b || !n || typeof document > "u")
|
|
97
93
|
return;
|
|
98
94
|
const t = document.body.style.overflow;
|
|
99
95
|
document.body.style.overflow = "hidden";
|
|
100
|
-
const
|
|
96
|
+
const e = window.setTimeout(() => {
|
|
101
97
|
document.body.style.overflow = t;
|
|
102
98
|
}, 1);
|
|
103
99
|
return () => {
|
|
104
100
|
document.body.style.overflow = "hidden", window.setTimeout(() => {
|
|
105
101
|
document.body.style.overflow = t;
|
|
106
|
-
}, 1), window.clearTimeout(
|
|
102
|
+
}, 1), window.clearTimeout(e);
|
|
107
103
|
};
|
|
108
|
-
}, [
|
|
109
|
-
const
|
|
104
|
+
}, [b, n]);
|
|
105
|
+
const ht = u(() => {
|
|
110
106
|
const t = o;
|
|
111
107
|
if (t) {
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
|
|
108
|
+
if (m.current) {
|
|
109
|
+
const e = m.current.getBoundingClientRect().height, r = n ? window.innerHeight : t.clientHeight, c = t.scrollHeight, i = c <= r ? e : r / c * e;
|
|
110
|
+
m.current.style.setProperty(
|
|
115
111
|
"--oc-scroll-area-thumb-height",
|
|
116
112
|
`${i}px`
|
|
117
113
|
);
|
|
118
114
|
}
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
115
|
+
if (p.current) {
|
|
116
|
+
const e = p.current.getBoundingClientRect().width, r = n ? window.innerWidth : t.clientWidth, c = t.scrollWidth, i = c <= r ? e : r / c * e;
|
|
117
|
+
p.current.style.setProperty(
|
|
122
118
|
"--oc-scroll-area-thumb-width",
|
|
123
119
|
`${i}px`
|
|
124
120
|
);
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
|
-
}, [o,
|
|
123
|
+
}, [o, n]), R = u(() => {
|
|
128
124
|
const t = o;
|
|
129
125
|
if (t) {
|
|
130
|
-
if (
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
126
|
+
if (m.current && s.current)
|
|
127
|
+
if (n) {
|
|
128
|
+
const e = window.scrollY || document.documentElement.scrollTop, r = window.innerHeight, c = document.documentElement.scrollHeight;
|
|
133
129
|
if (c > r) {
|
|
134
|
-
const i =
|
|
135
|
-
let l =
|
|
136
|
-
|
|
130
|
+
const i = m.current.getBoundingClientRect().height - s.current.clientHeight, a = c - r;
|
|
131
|
+
let l = e, h = 0;
|
|
132
|
+
e > a ? (h = e - a, l = a) : e < 0 && (h = e, l = 0);
|
|
137
133
|
const ot = l / a * i + h;
|
|
138
|
-
|
|
134
|
+
s.current.style.transform = `translateY(${ot}px)`;
|
|
139
135
|
}
|
|
140
136
|
} else {
|
|
141
|
-
const { scrollTop:
|
|
137
|
+
const { scrollTop: e, clientHeight: r, scrollHeight: c } = t;
|
|
142
138
|
if (c > r) {
|
|
143
|
-
const i =
|
|
144
|
-
|
|
139
|
+
const i = m.current.getBoundingClientRect().height - s.current.clientHeight, a = e / (c - r) * i;
|
|
140
|
+
s.current.style.transform = `translateY(${a}px)`;
|
|
145
141
|
}
|
|
146
142
|
}
|
|
147
|
-
if (
|
|
148
|
-
const
|
|
143
|
+
if (p.current && d.current) {
|
|
144
|
+
const e = n ? window.scrollX || document.documentElement.scrollLeft : t.scrollLeft, r = n ? window.innerWidth : t.clientWidth, c = n ? document.documentElement.scrollWidth : t.scrollWidth;
|
|
149
145
|
if (c > r) {
|
|
150
|
-
const i =
|
|
146
|
+
const i = p.current.getBoundingClientRect().width - d.current.clientWidth, a = e / (c - r) * i;
|
|
151
147
|
d.current.style.transform = `translateX(${a}px)`;
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
|
-
}, [o,
|
|
151
|
+
}, [o, n]), mt = u(() => {
|
|
156
152
|
T(B.current, "active"), T(D.current, "active"), H.current !== null && window.clearTimeout(H.current), H.current = window.setTimeout(() => {
|
|
157
153
|
T(B.current, "hidden"), T(D.current, "hidden"), H.current = null;
|
|
158
154
|
}, 1e3);
|
|
159
|
-
}, []), tt =
|
|
160
|
-
R(),
|
|
161
|
-
}, [
|
|
155
|
+
}, []), tt = u(() => {
|
|
156
|
+
R(), mt();
|
|
157
|
+
}, [mt, R]), ft = u(() => {
|
|
162
158
|
const t = o;
|
|
163
159
|
if (!t) return;
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
}, [o,
|
|
160
|
+
const e = n ? window.innerHeight : t.clientHeight, r = n ? window.innerWidth : t.clientWidth;
|
|
161
|
+
Wt(t.scrollHeight > e), Ct(t.scrollWidth > r);
|
|
162
|
+
}, [o, n]), xt = u(() => {
|
|
167
163
|
const t = o;
|
|
168
164
|
if (!t) return "";
|
|
169
|
-
const
|
|
165
|
+
const e = m.current?.getBoundingClientRect().height ?? 0, r = p.current?.getBoundingClientRect().width ?? 0;
|
|
170
166
|
return [
|
|
171
167
|
t.clientWidth,
|
|
172
168
|
t.clientHeight,
|
|
173
169
|
t.scrollWidth,
|
|
174
170
|
t.scrollHeight,
|
|
175
|
-
|
|
171
|
+
e,
|
|
176
172
|
r
|
|
177
173
|
].join(":");
|
|
178
|
-
}, [o]),
|
|
179
|
-
|
|
180
|
-
}, [
|
|
181
|
-
enabled:
|
|
182
|
-
getGeometrySignature:
|
|
183
|
-
updateGeometry:
|
|
184
|
-
}),
|
|
185
|
-
if (t.preventDefault(), t.stopPropagation(), !
|
|
186
|
-
x.current = !0,
|
|
187
|
-
const
|
|
188
|
-
Q.current = t.clientY -
|
|
189
|
-
},
|
|
190
|
-
if (t.preventDefault(), t.stopPropagation(), !
|
|
174
|
+
}, [o]), Yt = u(() => {
|
|
175
|
+
ft(), ht(), R();
|
|
176
|
+
}, [ft, ht, R]), { cancelGeometryUpdate: _, scheduleGeometryUpdate: W } = Ot({
|
|
177
|
+
enabled: b && !!o && !y,
|
|
178
|
+
getGeometrySignature: xt,
|
|
179
|
+
updateGeometry: Yt
|
|
180
|
+
}), It = (t) => {
|
|
181
|
+
if (t.preventDefault(), t.stopPropagation(), !m.current || !s.current || !o) return;
|
|
182
|
+
x.current = !0, s.current.dataset.state = "dragging", s.current.dataset.ocState = "dragging";
|
|
183
|
+
const e = n ? window.scrollY / (document.documentElement.scrollHeight - window.innerHeight) : o.scrollTop / (o.scrollHeight - o.clientHeight), r = m.current.getBoundingClientRect().height - s.current.clientHeight;
|
|
184
|
+
Q.current = t.clientY - e * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
|
|
185
|
+
}, zt = (t) => {
|
|
186
|
+
if (t.preventDefault(), t.stopPropagation(), !p.current || !d.current || !o) return;
|
|
191
187
|
Y.current = !0, d.current.dataset.state = "dragging", d.current.dataset.ocState = "dragging";
|
|
192
|
-
const
|
|
193
|
-
Z.current = t.clientX -
|
|
194
|
-
}, et =
|
|
195
|
-
(t,
|
|
196
|
-
const c = t === "vertical" ?
|
|
188
|
+
const e = n ? window.scrollX / (document.documentElement.scrollWidth - window.innerWidth) : o.scrollLeft / (o.scrollWidth - o.clientWidth), r = p.current.getBoundingClientRect().width - d.current.clientWidth;
|
|
189
|
+
Z.current = t.clientX - e * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
|
|
190
|
+
}, et = u(
|
|
191
|
+
(t, e, r) => {
|
|
192
|
+
const c = t === "vertical" ? m.current : p.current, i = t === "vertical" ? s.current : d.current;
|
|
197
193
|
if (!c || !i) return;
|
|
198
194
|
const a = t === "vertical" ? window.innerHeight : window.innerWidth, l = t === "vertical" ? document.documentElement.scrollHeight : document.documentElement.scrollWidth, h = t === "vertical" ? c.getBoundingClientRect().height : c.getBoundingClientRect().width, ot = t === "vertical" ? i.clientHeight : i.clientWidth, ct = h - ot;
|
|
199
195
|
if (ct <= 0) return;
|
|
200
|
-
const
|
|
196
|
+
const wt = Math.max(
|
|
201
197
|
0,
|
|
202
|
-
Math.min(
|
|
198
|
+
Math.min(e - r.current, ct)
|
|
203
199
|
) / ct;
|
|
204
|
-
t === "vertical" ? document.documentElement.scrollTop =
|
|
200
|
+
t === "vertical" ? document.documentElement.scrollTop = wt * (l - a) : document.documentElement.scrollLeft = wt * (l - a);
|
|
205
201
|
},
|
|
206
202
|
[]
|
|
207
|
-
), nt =
|
|
203
|
+
), nt = u(
|
|
208
204
|
(t) => {
|
|
209
205
|
if (!o) return;
|
|
210
|
-
let
|
|
211
|
-
if (
|
|
206
|
+
let e = !1;
|
|
207
|
+
if (n) {
|
|
212
208
|
const r = document.documentElement.style.scrollBehavior;
|
|
213
|
-
document.documentElement.style.scrollBehavior = "auto", x.current && (t.preventDefault(), t.stopPropagation(), et("vertical", t.clientY, Q),
|
|
209
|
+
document.documentElement.style.scrollBehavior = "auto", x.current && (t.preventDefault(), t.stopPropagation(), et("vertical", t.clientY, Q), e = !0), Y.current && (t.preventDefault(), t.stopPropagation(), et("horizontal", t.clientX, Z), e = !0), document.documentElement.style.scrollBehavior = r;
|
|
214
210
|
} else {
|
|
215
|
-
if (x.current &&
|
|
211
|
+
if (x.current && m.current && s.current) {
|
|
216
212
|
t.preventDefault(), t.stopPropagation();
|
|
217
|
-
const r =
|
|
213
|
+
const r = m.current.getBoundingClientRect().height - s.current.clientHeight;
|
|
218
214
|
if (r > 0) {
|
|
219
215
|
const i = Math.max(
|
|
220
216
|
0,
|
|
221
217
|
Math.min(t.clientY - Q.current, r)
|
|
222
218
|
) / r * (o.scrollHeight - o.clientHeight);
|
|
223
|
-
o.scrollTo({ top: i, behavior: "auto" }),
|
|
219
|
+
o.scrollTo({ top: i, behavior: "auto" }), e = !0;
|
|
224
220
|
}
|
|
225
221
|
}
|
|
226
|
-
if (Y.current &&
|
|
222
|
+
if (Y.current && p.current && d.current) {
|
|
227
223
|
t.preventDefault(), t.stopPropagation();
|
|
228
|
-
const r =
|
|
224
|
+
const r = p.current.getBoundingClientRect().width - d.current.clientWidth;
|
|
229
225
|
if (r > 0) {
|
|
230
226
|
const i = Math.max(
|
|
231
227
|
0,
|
|
232
228
|
Math.min(t.clientX - Z.current, r)
|
|
233
229
|
) / r * (o.scrollWidth - o.clientWidth);
|
|
234
|
-
o.scrollTo({ left: i, behavior: "auto" }),
|
|
230
|
+
o.scrollTo({ left: i, behavior: "auto" }), e = !0;
|
|
235
231
|
}
|
|
236
232
|
}
|
|
237
233
|
}
|
|
238
|
-
|
|
234
|
+
e && R();
|
|
239
235
|
},
|
|
240
|
-
[o,
|
|
241
|
-
), rt =
|
|
242
|
-
x.current = !1, Y.current = !1,
|
|
243
|
-
}, []),
|
|
236
|
+
[o, n, et, R]
|
|
237
|
+
), rt = u(() => {
|
|
238
|
+
x.current = !1, Y.current = !1, s.current && (s.current.dataset.state = "hidden", s.current.dataset.ocState = "hidden"), d.current && (d.current.dataset.state = "hidden", d.current.dataset.ocState = "hidden"), document.removeEventListener("selectstart", C), document.removeEventListener("dragstart", C);
|
|
239
|
+
}, []), pt = (t) => {
|
|
244
240
|
t.preventDefault();
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
247
|
-
|
|
241
|
+
const e = t.currentTarget.dataset.ocOrientation ?? t.currentTarget.dataset.orientation;
|
|
242
|
+
if (n) {
|
|
243
|
+
e === "horizontal" ? window.scrollBy({
|
|
248
244
|
left: t.deltaY || t.deltaX,
|
|
249
245
|
behavior: "auto"
|
|
250
246
|
}) : window.scrollBy({ top: t.deltaY, behavior: "auto" });
|
|
251
247
|
return;
|
|
252
248
|
}
|
|
253
|
-
o && (
|
|
249
|
+
o && (e === "horizontal" ? o.scrollTo({
|
|
254
250
|
left: o.scrollLeft + (t.deltaY || t.deltaX),
|
|
255
251
|
behavior: "auto"
|
|
256
252
|
}) : o.scrollTo({
|
|
257
253
|
top: o.scrollTop + t.deltaY,
|
|
258
254
|
behavior: "auto"
|
|
259
255
|
}));
|
|
260
|
-
}, G =
|
|
256
|
+
}, G = u(() => {
|
|
261
257
|
S.current !== null && (window.clearTimeout(S.current), S.current = null);
|
|
262
|
-
}, []),
|
|
258
|
+
}, []), gt = u(() => {
|
|
263
259
|
G(), S.current = window.setTimeout(() => {
|
|
264
|
-
T(
|
|
260
|
+
T(m.current, "hidden"), T(p.current, "hidden"), S.current = null;
|
|
265
261
|
}, 200);
|
|
266
|
-
}, [G]), j =
|
|
262
|
+
}, [G]), j = u(
|
|
267
263
|
(t) => {
|
|
268
|
-
t ? (T(
|
|
264
|
+
t ? (T(m.current, "active"), T(p.current, "active"), G()) : !x.current && !Y.current && gt();
|
|
269
265
|
},
|
|
270
|
-
[G,
|
|
271
|
-
), I =
|
|
266
|
+
[G, gt]
|
|
267
|
+
), I = u(() => {
|
|
272
268
|
V.current !== null && (window.clearInterval(V.current), V.current = null);
|
|
273
|
-
}, []), z =
|
|
269
|
+
}, []), z = u(() => {
|
|
274
270
|
U.current !== null && (window.clearInterval(U.current), U.current = null);
|
|
275
|
-
}, []),
|
|
276
|
-
if (t.target !== t.currentTarget || !o || !
|
|
271
|
+
}, []), Xt = (t) => {
|
|
272
|
+
if (t.target !== t.currentTarget || !o || !s.current)
|
|
277
273
|
return;
|
|
278
|
-
const
|
|
274
|
+
const e = t.clientY, r = s.current.getBoundingClientRect(), c = e < r.top ? "up" : e > r.bottom ? "down" : null;
|
|
279
275
|
if (!c) return;
|
|
280
|
-
const i =
|
|
281
|
-
const l =
|
|
282
|
-
if (l &&
|
|
276
|
+
const i = n ? window.innerHeight : o.clientHeight, a = () => {
|
|
277
|
+
const l = s.current?.getBoundingClientRect();
|
|
278
|
+
if (l && e >= l.top && e <= l.bottom) {
|
|
283
279
|
I();
|
|
284
280
|
return;
|
|
285
281
|
}
|
|
286
|
-
if (
|
|
282
|
+
if (n) {
|
|
287
283
|
const h = window.scrollY || document.documentElement.scrollTop;
|
|
288
284
|
window.scrollTo({
|
|
289
285
|
top: c === "up" ? h - i : h + i,
|
|
@@ -299,18 +295,18 @@ function Qt({
|
|
|
299
295
|
R();
|
|
300
296
|
};
|
|
301
297
|
a(), V.current = window.setInterval(a, 300);
|
|
302
|
-
},
|
|
298
|
+
}, kt = (t) => {
|
|
303
299
|
if (t.target !== t.currentTarget || !o || !d.current)
|
|
304
300
|
return;
|
|
305
|
-
const
|
|
301
|
+
const e = t.clientX, r = d.current.getBoundingClientRect(), c = e < r.left ? "left" : e > r.right ? "right" : null;
|
|
306
302
|
if (!c) return;
|
|
307
|
-
const i =
|
|
303
|
+
const i = n ? window.innerWidth : o.clientWidth, a = () => {
|
|
308
304
|
const l = d.current?.getBoundingClientRect();
|
|
309
|
-
if (l &&
|
|
305
|
+
if (l && e >= l.left && e <= l.right) {
|
|
310
306
|
z();
|
|
311
307
|
return;
|
|
312
308
|
}
|
|
313
|
-
if (
|
|
309
|
+
if (n) {
|
|
314
310
|
const h = window.scrollX || document.documentElement.scrollLeft;
|
|
315
311
|
window.scrollTo({
|
|
316
312
|
left: c === "left" ? h - i : h + i,
|
|
@@ -327,10 +323,10 @@ function Qt({
|
|
|
327
323
|
};
|
|
328
324
|
a(), U.current = window.setInterval(a, 300);
|
|
329
325
|
};
|
|
330
|
-
return
|
|
326
|
+
return bt(() => {
|
|
331
327
|
const t = o;
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
328
|
+
if (!b || !t || y) return;
|
|
329
|
+
const e = window.requestAnimationFrame(W), r = n ? window : t;
|
|
334
330
|
r.addEventListener("scroll", tt, {
|
|
335
331
|
passive: !0
|
|
336
332
|
});
|
|
@@ -349,27 +345,27 @@ function Qt({
|
|
|
349
345
|
});
|
|
350
346
|
const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
|
|
351
347
|
return l && (l.observe(t), P.current && l.observe(P.current), t.firstElementChild instanceof HTMLElement && l.observe(t.firstElementChild), B.current && l.observe(B.current), O && l.observe(O), D.current && l.observe(D.current), $ && l.observe($)), () => {
|
|
352
|
-
r.removeEventListener("scroll", tt), window.removeEventListener("resize", c), document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", rt), window.cancelAnimationFrame(
|
|
348
|
+
r.removeEventListener("scroll", tt), window.removeEventListener("resize", c), document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", rt), window.cancelAnimationFrame(e), _(), a.disconnect(), l?.disconnect();
|
|
353
349
|
};
|
|
354
350
|
}, [
|
|
355
351
|
_,
|
|
356
352
|
o,
|
|
357
353
|
W,
|
|
358
|
-
|
|
354
|
+
b,
|
|
359
355
|
tt,
|
|
360
356
|
nt,
|
|
361
357
|
rt,
|
|
362
|
-
|
|
358
|
+
n,
|
|
363
359
|
K,
|
|
364
360
|
J,
|
|
365
361
|
$,
|
|
366
362
|
y,
|
|
367
363
|
O
|
|
368
|
-
]),
|
|
364
|
+
]), bt(() => {
|
|
369
365
|
W();
|
|
370
366
|
}, [
|
|
371
367
|
o,
|
|
372
|
-
|
|
368
|
+
b,
|
|
373
369
|
K,
|
|
374
370
|
J,
|
|
375
371
|
$,
|
|
@@ -381,72 +377,72 @@ function Qt({
|
|
|
381
377
|
H.current !== null && window.clearTimeout(H.current), S.current !== null && window.clearTimeout(S.current), I(), z(), _();
|
|
382
378
|
},
|
|
383
379
|
[_, z, I]
|
|
384
|
-
), !
|
|
380
|
+
), !b || y ? /* @__PURE__ */ g(
|
|
385
381
|
M,
|
|
386
382
|
{
|
|
387
|
-
ref:
|
|
388
|
-
className: `${
|
|
383
|
+
ref: ut,
|
|
384
|
+
className: `${v.scrollArea} ${L}`.trim(),
|
|
389
385
|
...N,
|
|
390
386
|
"data-oc-component": A,
|
|
391
|
-
"data-root":
|
|
392
|
-
"data-oc-scroll-root":
|
|
387
|
+
"data-root": n ? "" : void 0,
|
|
388
|
+
"data-oc-scroll-root": n ? "true" : void 0,
|
|
393
389
|
"data-scroll": "",
|
|
394
390
|
"data-oc-scroll": "",
|
|
395
|
-
"data-scroll-label":
|
|
396
|
-
"data-oc-scroll-label":
|
|
391
|
+
"data-scroll-label": n ? "root" : void 0,
|
|
392
|
+
"data-oc-scroll-label": n ? "root" : void 0,
|
|
397
393
|
children: E
|
|
398
394
|
}
|
|
399
|
-
) : /* @__PURE__ */
|
|
395
|
+
) : /* @__PURE__ */ g(St.Provider, { value: Dt, children: /* @__PURE__ */ At(
|
|
400
396
|
M,
|
|
401
397
|
{
|
|
402
|
-
ref:
|
|
403
|
-
className: `${
|
|
398
|
+
ref: ut,
|
|
399
|
+
className: `${v.scrollArea} ${L}`.trim(),
|
|
404
400
|
...N,
|
|
405
401
|
"data-oc-component": A,
|
|
406
|
-
"data-root":
|
|
407
|
-
"data-oc-scroll-root":
|
|
402
|
+
"data-root": n ? "" : void 0,
|
|
403
|
+
"data-oc-scroll-root": n ? "true" : void 0,
|
|
408
404
|
"data-scroll": "",
|
|
409
405
|
"data-oc-scroll": "",
|
|
410
|
-
"data-scroll-label":
|
|
411
|
-
"data-oc-scroll-label":
|
|
406
|
+
"data-scroll-label": n ? "root" : void 0,
|
|
407
|
+
"data-oc-scroll-label": n ? "root" : void 0,
|
|
412
408
|
children: [
|
|
413
409
|
E,
|
|
414
|
-
J ? /* @__PURE__ */
|
|
410
|
+
J ? /* @__PURE__ */ g(
|
|
415
411
|
"div",
|
|
416
412
|
{
|
|
417
413
|
ref: B,
|
|
418
|
-
className:
|
|
414
|
+
className: v.scrollbar,
|
|
419
415
|
"data-oc-part": "scrollbar-vertical",
|
|
420
416
|
"data-orientation": "vertical",
|
|
421
417
|
"data-oc-orientation": "vertical",
|
|
422
418
|
"data-state": "hidden",
|
|
423
419
|
"data-oc-state": "hidden",
|
|
424
|
-
onWheel:
|
|
425
|
-
children: /* @__PURE__ */
|
|
420
|
+
onWheel: pt,
|
|
421
|
+
children: /* @__PURE__ */ g(
|
|
426
422
|
"div",
|
|
427
423
|
{
|
|
428
|
-
ref:
|
|
429
|
-
className:
|
|
424
|
+
ref: Pt,
|
|
425
|
+
className: v.wrapper,
|
|
430
426
|
"data-oc-part": "scrollbar-track",
|
|
431
427
|
"data-state": "hidden",
|
|
432
428
|
"data-oc-state": "hidden",
|
|
433
429
|
role: "presentation",
|
|
434
|
-
onMouseDown:
|
|
430
|
+
onMouseDown: Xt,
|
|
435
431
|
onMouseEnter: () => j(!0),
|
|
436
432
|
onMouseLeave: () => {
|
|
437
433
|
I(), j(!1);
|
|
438
434
|
},
|
|
439
435
|
onMouseUp: I,
|
|
440
|
-
children: /* @__PURE__ */
|
|
436
|
+
children: /* @__PURE__ */ g(
|
|
441
437
|
"div",
|
|
442
438
|
{
|
|
443
|
-
ref:
|
|
444
|
-
className:
|
|
439
|
+
ref: s,
|
|
440
|
+
className: v.thumb,
|
|
445
441
|
"data-oc-part": "thumb",
|
|
446
442
|
"data-state": "hidden",
|
|
447
443
|
"data-oc-state": "hidden",
|
|
448
444
|
role: "presentation",
|
|
449
|
-
onMouseDown:
|
|
445
|
+
onMouseDown: It,
|
|
450
446
|
onPointerDownCapture: (t) => {
|
|
451
447
|
t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
|
|
452
448
|
},
|
|
@@ -456,12 +452,12 @@ function Qt({
|
|
|
456
452
|
onPointerUpCapture: (t) => {
|
|
457
453
|
t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
|
|
458
454
|
},
|
|
459
|
-
children: /* @__PURE__ */
|
|
455
|
+
children: /* @__PURE__ */ g(
|
|
460
456
|
"div",
|
|
461
457
|
{
|
|
462
|
-
className:
|
|
458
|
+
className: v.background,
|
|
463
459
|
"data-oc-part": "thumb-background",
|
|
464
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ g(Et, { variant: "light", self: !0 })
|
|
465
461
|
}
|
|
466
462
|
)
|
|
467
463
|
}
|
|
@@ -470,42 +466,42 @@ function Qt({
|
|
|
470
466
|
)
|
|
471
467
|
}
|
|
472
468
|
) : null,
|
|
473
|
-
K ? /* @__PURE__ */
|
|
469
|
+
K ? /* @__PURE__ */ g(
|
|
474
470
|
"div",
|
|
475
471
|
{
|
|
476
472
|
ref: D,
|
|
477
|
-
className:
|
|
473
|
+
className: v.scrollbar,
|
|
478
474
|
"data-oc-part": "scrollbar-horizontal",
|
|
479
475
|
"data-orientation": "horizontal",
|
|
480
476
|
"data-oc-orientation": "horizontal",
|
|
481
477
|
"data-state": "hidden",
|
|
482
478
|
"data-oc-state": "hidden",
|
|
483
|
-
onWheel:
|
|
484
|
-
children: /* @__PURE__ */
|
|
479
|
+
onWheel: pt,
|
|
480
|
+
children: /* @__PURE__ */ g(
|
|
485
481
|
"div",
|
|
486
482
|
{
|
|
487
|
-
ref:
|
|
488
|
-
className:
|
|
483
|
+
ref: Bt,
|
|
484
|
+
className: v.wrapper,
|
|
489
485
|
"data-oc-part": "scrollbar-track",
|
|
490
486
|
"data-state": "hidden",
|
|
491
487
|
"data-oc-state": "hidden",
|
|
492
488
|
role: "presentation",
|
|
493
|
-
onMouseDown:
|
|
489
|
+
onMouseDown: kt,
|
|
494
490
|
onMouseEnter: () => j(!0),
|
|
495
491
|
onMouseLeave: () => {
|
|
496
492
|
z(), j(!1);
|
|
497
493
|
},
|
|
498
494
|
onMouseUp: z,
|
|
499
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ g(
|
|
500
496
|
"div",
|
|
501
497
|
{
|
|
502
498
|
ref: d,
|
|
503
|
-
className:
|
|
499
|
+
className: v.thumb,
|
|
504
500
|
"data-oc-part": "thumb",
|
|
505
501
|
"data-state": "hidden",
|
|
506
502
|
"data-oc-state": "hidden",
|
|
507
503
|
role: "presentation",
|
|
508
|
-
onMouseDown:
|
|
504
|
+
onMouseDown: zt,
|
|
509
505
|
onPointerDownCapture: (t) => {
|
|
510
506
|
t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
|
|
511
507
|
},
|
|
@@ -515,12 +511,12 @@ function Qt({
|
|
|
515
511
|
onPointerUpCapture: (t) => {
|
|
516
512
|
t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
|
|
517
513
|
},
|
|
518
|
-
children: /* @__PURE__ */
|
|
514
|
+
children: /* @__PURE__ */ g(
|
|
519
515
|
"div",
|
|
520
516
|
{
|
|
521
|
-
className:
|
|
517
|
+
className: v.background,
|
|
522
518
|
"data-oc-part": "thumb-background",
|
|
523
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ g(Et, { variant: "light", self: !0 })
|
|
524
520
|
}
|
|
525
521
|
)
|
|
526
522
|
}
|
|
@@ -533,36 +529,37 @@ function Qt({
|
|
|
533
529
|
}
|
|
534
530
|
) });
|
|
535
531
|
}
|
|
536
|
-
function
|
|
537
|
-
as:
|
|
538
|
-
children:
|
|
532
|
+
function te({
|
|
533
|
+
as: w,
|
|
534
|
+
children: n,
|
|
539
535
|
className: E = "",
|
|
540
536
|
ref: L,
|
|
541
537
|
"data-oc-component": k = "scroll-area-container",
|
|
542
538
|
...A
|
|
543
539
|
}) {
|
|
544
|
-
const N =
|
|
545
|
-
(
|
|
546
|
-
M?.setContainerRef
|
|
547
|
-
|
|
540
|
+
const N = w ?? "div", M = Nt(St), P = st(
|
|
541
|
+
() => yt(
|
|
542
|
+
M?.setContainerRef,
|
|
543
|
+
L
|
|
544
|
+
),
|
|
548
545
|
[M, L]
|
|
549
546
|
);
|
|
550
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ g(
|
|
551
548
|
N,
|
|
552
549
|
{
|
|
553
550
|
ref: P,
|
|
554
|
-
className: `${
|
|
551
|
+
className: `${v.container} ${E}`.trim(),
|
|
555
552
|
...A,
|
|
556
553
|
"data-oc-part": "scroll-area-container",
|
|
557
554
|
"data-oc-component": k,
|
|
558
555
|
"data-scroll-container": "",
|
|
559
556
|
"data-oc-scroll-container": "",
|
|
560
|
-
children:
|
|
557
|
+
children: n
|
|
561
558
|
}
|
|
562
559
|
);
|
|
563
560
|
}
|
|
564
561
|
export {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
562
|
+
Zt as ScrollArea,
|
|
563
|
+
te as ScrollAreaContainer,
|
|
564
|
+
Zt as default
|
|
568
565
|
};
|