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