prometeo-design-system 4.7.7 → 4.7.9
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/PyrionLayout.es.js +281 -280
- package/dist/Scrollable.es.js +310 -272
- package/dist/components/PyrionNavigationDrawer/PLFooter.d.ts +1 -1
- package/dist/components/PyrionNavigationDrawer/PLSystemSessions.d.ts +3 -1
- package/dist/components/PyrionNavigationDrawer/PLayoutBase.d.ts +1 -1
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +2 -1
- package/dist/components/Scrollable/Scrollable.d.ts +1 -0
- package/package.json +1 -1
package/dist/Scrollable.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as b } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { u as Rt } from "./useDevice-vwn4GLwK.js";
|
|
3
|
-
import { g as
|
|
4
|
-
import { c as
|
|
5
|
-
import { c as
|
|
6
|
-
import
|
|
7
|
-
import { CrevronLeft as
|
|
8
|
-
const
|
|
3
|
+
import { g as G, r as w } from "./useLabelBackground-D5SzHhl_.js";
|
|
4
|
+
import { c as L } from "./cn-B6yFEsav.js";
|
|
5
|
+
import { c as Z } from "./index-BOQuZ0gG.js";
|
|
6
|
+
import Tt, { useRef as f, useState as Ot, useCallback as C, useImperativeHandle as Wt, useLayoutEffect as qt, useEffect as Vt } from "react";
|
|
7
|
+
import { CrevronLeft as xt } from "./Icons/CrevronLeft.es.js";
|
|
8
|
+
const St = Z(
|
|
9
9
|
"",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
@@ -16,7 +16,7 @@ const wt = X(
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
),
|
|
19
|
+
), Q = Z("", {
|
|
20
20
|
variants: {
|
|
21
21
|
position: {
|
|
22
22
|
top: "",
|
|
@@ -34,12 +34,12 @@ const wt = X(
|
|
|
34
34
|
{ type: "icon", position: "bottom", className: "rotate-270 bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2" },
|
|
35
35
|
{ type: "icon", position: "left", className: "top-1/2 -translate-y-1/2 -translate-x-1/2" },
|
|
36
36
|
{ type: "icon", position: "right", className: "rotate-180 right-0 top-1/2 -translate-y-1/2 translate-x-1/2" },
|
|
37
|
-
{ type: "shadow", position: "top", className: "top-0 left-0 w-full h-
|
|
38
|
-
{ type: "shadow", position: "bottom", className: "bottom-0 left-0 w-full h-
|
|
37
|
+
{ type: "shadow", position: "top", className: "top-0 left-0 w-full h-10" },
|
|
38
|
+
{ type: "shadow", position: "bottom", className: "bottom-0 left-0 w-full h-10 rotate-180" },
|
|
39
39
|
{ type: "shadow", position: "left", className: "left-0 top-0 h-full w-5" },
|
|
40
40
|
{ type: "shadow", position: "right", className: "right-0 top-0 h-full w-5 rotate-180" }
|
|
41
41
|
]
|
|
42
|
-
}),
|
|
42
|
+
}), Ft = Z("", {
|
|
43
43
|
variants: {
|
|
44
44
|
hide: {
|
|
45
45
|
true: " prometeo-scrollbar-none",
|
|
@@ -50,48 +50,53 @@ const wt = X(
|
|
|
50
50
|
medium: ""
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
const { defaultBehavior: A = "scroll-on-click" } =
|
|
55
|
-
top: { show: !0, type: "shadow", behavior: A },
|
|
56
|
-
bottom: { show: !0, type: "shadow", behavior: A },
|
|
57
|
-
left: { show: !0, type: "icon", behavior: A },
|
|
58
|
-
right: { show: !0, type: "icon", behavior: A }
|
|
59
|
-
},
|
|
53
|
+
}), Zt = (tt) => {
|
|
54
|
+
const { defaultBehavior: A = "scroll-on-click" } = tt, Lt = Rt(), B = {
|
|
55
|
+
top: { show: !0, type: "shadow", behavior: A, hoverDelay: 300 },
|
|
56
|
+
bottom: { show: !0, type: "shadow", behavior: A, hoverDelay: 300 },
|
|
57
|
+
left: { show: !0, type: "icon", behavior: A, hoverDelay: 300 },
|
|
58
|
+
right: { show: !0, type: "icon", behavior: A, hoverDelay: 300 }
|
|
59
|
+
}, et = {
|
|
60
60
|
hide: !1,
|
|
61
61
|
size: "medium"
|
|
62
62
|
}, {
|
|
63
|
-
debugMode:
|
|
64
|
-
className:
|
|
65
|
-
axis:
|
|
66
|
-
children:
|
|
67
|
-
indicators:
|
|
68
|
-
scrollbarProps: Et =
|
|
69
|
-
disableMouseScroll:
|
|
63
|
+
debugMode: Mt = !1,
|
|
64
|
+
className: rt,
|
|
65
|
+
axis: y = "both",
|
|
66
|
+
children: Nt,
|
|
67
|
+
indicators: R,
|
|
68
|
+
scrollbarProps: Et = et,
|
|
69
|
+
disableMouseScroll: ot = !1,
|
|
70
70
|
persistScroll: j = !1,
|
|
71
71
|
controls: It,
|
|
72
|
-
scrollTopButton:
|
|
73
|
-
scrollMetadata:
|
|
74
|
-
} =
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
scrollTopButton: M,
|
|
73
|
+
scrollMetadata: O
|
|
74
|
+
} = tt, a = f({}), l = f(null), h = f(null), E = f(null), u = f(null), d = f(5), i = f({}), H = f(null), g = f(!1), st = f(!1), W = f(null), P = f(null), [$t, Dt] = Ot(!1), I = {
|
|
75
|
+
top: { ...B.top, ...R?.top },
|
|
76
|
+
bottom: { ...B.bottom, ...R?.bottom },
|
|
77
|
+
left: { ...B.left, ...R?.left },
|
|
78
|
+
right: { ...B.right, ...R?.right }
|
|
79
|
+
}, nt = { ...et, ...Et }, z = f([]), lt = f(/* @__PURE__ */ new Map()), ct = f({ scrollTop: 0, scrollLeft: 0 }), _ = (t) => {
|
|
80
|
+
if (!l.current) return 0;
|
|
81
|
+
const { scrollTop: e, scrollLeft: o, scrollHeight: r, clientHeight: n, scrollWidth: s, clientWidth: c } = l.current;
|
|
77
82
|
switch (t) {
|
|
78
83
|
case "top":
|
|
79
|
-
return Math.max(0,
|
|
84
|
+
return Math.max(0, e);
|
|
80
85
|
case "bottom":
|
|
81
|
-
return Math.max(0,
|
|
86
|
+
return Math.max(0, r - (e + n));
|
|
82
87
|
case "left":
|
|
83
|
-
return Math.max(0,
|
|
88
|
+
return Math.max(0, o);
|
|
84
89
|
case "right":
|
|
85
|
-
return Math.max(0,
|
|
90
|
+
return Math.max(0, s - (o + c));
|
|
86
91
|
default:
|
|
87
92
|
return 0;
|
|
88
93
|
}
|
|
89
|
-
},
|
|
90
|
-
if (!t || !
|
|
91
|
-
const { clientHeight:
|
|
94
|
+
}, at = C((t) => {
|
|
95
|
+
if (!t || !l.current) return 0;
|
|
96
|
+
const { clientHeight: e, scrollHeight: o } = l.current;
|
|
92
97
|
if (t.includes("%")) {
|
|
93
|
-
const
|
|
94
|
-
return
|
|
98
|
+
const r = parseFloat(t.replace("%", "")), n = Math.max(0, o - e);
|
|
99
|
+
return r / 100 * n;
|
|
95
100
|
} else {
|
|
96
101
|
if (t.includes("px"))
|
|
97
102
|
return parseFloat(t.replace("px", ""));
|
|
@@ -99,342 +104,375 @@ const wt = X(
|
|
|
99
104
|
return parseFloat(t.replace("vh", "")) / 100 * window.innerHeight;
|
|
100
105
|
}
|
|
101
106
|
return 0;
|
|
102
|
-
}, []),
|
|
103
|
-
if (!
|
|
104
|
-
const { scrollTop: t } =
|
|
105
|
-
|
|
106
|
-
}, [
|
|
107
|
-
if (!
|
|
108
|
-
const { scrollTop: t, scrollLeft:
|
|
109
|
-
return { x: m > 0 ?
|
|
110
|
-
}, []),
|
|
111
|
-
const
|
|
112
|
-
let
|
|
113
|
-
return t.scrollTop >
|
|
114
|
-
}, []),
|
|
115
|
-
if (!
|
|
116
|
-
const { scrollTop:
|
|
117
|
-
percentage:
|
|
107
|
+
}, []), it = C(() => {
|
|
108
|
+
if (!l.current || !M) return;
|
|
109
|
+
const { scrollTop: t } = l.current, e = at(M.target || "40vh");
|
|
110
|
+
Dt(t >= e);
|
|
111
|
+
}, [M, at]), ut = C(() => {
|
|
112
|
+
if (!l.current) return { x: 0, y: 0 };
|
|
113
|
+
const { scrollTop: t, scrollLeft: e, scrollHeight: o, scrollWidth: r, clientHeight: n, clientWidth: s } = l.current, c = Math.max(0, o - n), m = Math.max(0, r - s), T = c > 0 ? t / c * 100 : 0;
|
|
114
|
+
return { x: m > 0 ? e / m * 100 : 0, y: T };
|
|
115
|
+
}, []), ft = C((t) => {
|
|
116
|
+
const e = ct.current;
|
|
117
|
+
let o = null;
|
|
118
|
+
return t.scrollTop > e.scrollTop ? o = "down" : t.scrollTop < e.scrollTop ? o = "up" : t.scrollLeft > e.scrollLeft ? o = "right" : t.scrollLeft < e.scrollLeft && (o = "left"), ct.current = t, o;
|
|
119
|
+
}, []), ht = C((t) => {
|
|
120
|
+
if (!l.current) return;
|
|
121
|
+
const { scrollTop: e, scrollLeft: o, scrollHeight: r, scrollWidth: n, clientHeight: s, clientWidth: c } = l.current, m = ft(t), { x: T, y: x } = ut(), S = {
|
|
122
|
+
percentage: x,
|
|
118
123
|
direction: m,
|
|
119
|
-
scrollTop:
|
|
120
|
-
scrollLeft:
|
|
121
|
-
scrollHeight:
|
|
122
|
-
scrollWidth:
|
|
123
|
-
clientHeight:
|
|
124
|
-
clientWidth:
|
|
125
|
-
metadata:
|
|
126
|
-
},
|
|
124
|
+
scrollTop: e,
|
|
125
|
+
scrollLeft: o,
|
|
126
|
+
scrollHeight: r,
|
|
127
|
+
scrollWidth: n,
|
|
128
|
+
clientHeight: s,
|
|
129
|
+
clientWidth: c,
|
|
130
|
+
metadata: O
|
|
131
|
+
}, X = {
|
|
127
132
|
percentage: T,
|
|
128
133
|
direction: m,
|
|
129
|
-
scrollTop:
|
|
130
|
-
scrollLeft:
|
|
131
|
-
scrollHeight:
|
|
132
|
-
scrollWidth:
|
|
133
|
-
clientHeight:
|
|
134
|
-
clientWidth:
|
|
135
|
-
metadata:
|
|
134
|
+
scrollTop: e,
|
|
135
|
+
scrollLeft: o,
|
|
136
|
+
scrollHeight: r,
|
|
137
|
+
scrollWidth: n,
|
|
138
|
+
clientHeight: s,
|
|
139
|
+
clientWidth: c,
|
|
140
|
+
metadata: O
|
|
136
141
|
};
|
|
137
142
|
z.current.forEach((p) => {
|
|
138
|
-
const { config:
|
|
139
|
-
if (!
|
|
140
|
-
(
|
|
143
|
+
const { config: v, triggered: V } = p;
|
|
144
|
+
if (!v) {
|
|
145
|
+
(y === "y" || y === "both") && p.callback(S), (y === "x" || y === "both") && p.callback(X);
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
145
|
-
const
|
|
148
|
+
const Y = (v.direction === "y" || v.direction === "both") && (y === "y" || y === "both"), wt = (v.direction === "x" || v.direction === "both") && (y === "x" || y === "both");
|
|
149
|
+
if (!Y && !wt) return;
|
|
150
|
+
const $ = (Y ? S : X).percentage, D = v.target * 100;
|
|
146
151
|
let k = !1;
|
|
147
|
-
if (
|
|
148
|
-
k = !
|
|
149
|
-
else if (
|
|
150
|
-
k =
|
|
151
|
-
else if (
|
|
152
|
-
const
|
|
153
|
-
k = p.triggered !==
|
|
152
|
+
if (v.trip === "forth")
|
|
153
|
+
k = !V && $ >= D, k && (p.triggered = !0), V && $ < D && (p.triggered = !1);
|
|
154
|
+
else if (v.trip === "back")
|
|
155
|
+
k = V && $ < D, k && (p.triggered = !1), !V && $ >= D && (p.triggered = !0);
|
|
156
|
+
else if (v.trip === "round-trip") {
|
|
157
|
+
const F = $ >= D;
|
|
158
|
+
k = p.triggered !== F;
|
|
154
159
|
}
|
|
155
160
|
if (k) {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
161
|
+
const F = `${z.current.indexOf(p)}-${v?.target || 0}-${v?.direction || "y"}`, U = Date.now(), Bt = lt.current.get(F) || 0;
|
|
162
|
+
if (U - Bt < 500)
|
|
158
163
|
return;
|
|
159
|
-
|
|
164
|
+
v.trip === "round-trip" && (p.triggered = $ >= D, p.lastDirection = m || void 0), lt.current.set(F, U), p.lastTriggerTime = U, Y ? p.callback(S) : wt && p.callback(X);
|
|
160
165
|
}
|
|
161
166
|
});
|
|
162
|
-
}, [
|
|
163
|
-
const
|
|
167
|
+
}, [y, ft, ut, O]), dt = C((t, e) => {
|
|
168
|
+
const o = {
|
|
164
169
|
callback: t,
|
|
165
|
-
config:
|
|
170
|
+
config: e,
|
|
166
171
|
triggered: !1,
|
|
167
172
|
lastDirection: void 0
|
|
168
173
|
};
|
|
169
|
-
return z.current.push(
|
|
170
|
-
const
|
|
171
|
-
|
|
174
|
+
return z.current.push(o), () => {
|
|
175
|
+
const r = z.current.indexOf(o);
|
|
176
|
+
r > -1 && z.current.splice(r, 1);
|
|
172
177
|
};
|
|
173
178
|
}, []);
|
|
174
|
-
|
|
175
|
-
subscribeToScrollTarget:
|
|
176
|
-
}), [
|
|
177
|
-
const
|
|
178
|
-
if (!
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
top: { top:
|
|
183
|
-
bottom: { top:
|
|
184
|
-
left: { top: 0, left:
|
|
185
|
-
right: { top: 0, left:
|
|
179
|
+
Wt(It, () => ({
|
|
180
|
+
subscribeToScrollTarget: dt
|
|
181
|
+
}), [dt]);
|
|
182
|
+
const q = (t, e = 100, o = !0) => {
|
|
183
|
+
if (!l.current) return;
|
|
184
|
+
const r = _(t), n = Math.min(Math.abs(e), r);
|
|
185
|
+
if (n === 0) return;
|
|
186
|
+
const s = t === "top" || t === "left" ? -n : n, c = {
|
|
187
|
+
top: { top: s, left: 0 },
|
|
188
|
+
bottom: { top: s, left: 0 },
|
|
189
|
+
left: { top: 0, left: s },
|
|
190
|
+
right: { top: 0, left: s }
|
|
186
191
|
};
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
if (!
|
|
190
|
-
const
|
|
191
|
-
top: { top: 0, left:
|
|
192
|
-
bottom: { top:
|
|
193
|
-
left: { top:
|
|
194
|
-
right: { top:
|
|
192
|
+
l.current.scrollBy({ ...c[t], behavior: o ? "smooth" : "auto" });
|
|
193
|
+
}, kt = (t) => {
|
|
194
|
+
if (!l.current) return;
|
|
195
|
+
const e = l.current, o = {
|
|
196
|
+
top: { top: 0, left: e.scrollLeft },
|
|
197
|
+
bottom: { top: e.scrollHeight, left: e.scrollLeft },
|
|
198
|
+
left: { top: e.scrollTop, left: 0 },
|
|
199
|
+
right: { top: e.scrollTop, left: e.scrollWidth }
|
|
195
200
|
};
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
if (
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
} else if (
|
|
206
|
-
const o =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
201
|
+
e.scrollTo({ ...o[t], behavior: "smooth" });
|
|
202
|
+
}, Ct = () => {
|
|
203
|
+
l.current && l.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
204
|
+
}, jt = (t, e) => {
|
|
205
|
+
const o = a.current[t];
|
|
206
|
+
if (o) {
|
|
207
|
+
if (o.style.cursor = "pointer", e === "icon") {
|
|
208
|
+
const r = o.querySelector("svg");
|
|
209
|
+
r && (r.style.transition = "all 0.3s ease-in-out", r.style.transform = "scale(1.3)", r.style.backgroundColor = "rgba(255, 255, 255, 0.2)", r.style.borderRadius = "100%");
|
|
210
|
+
} else if (e === "shadow") {
|
|
211
|
+
const r = o.querySelector(".shadow-base"), n = o.querySelector(".shadow-hover"), s = G(l.current);
|
|
212
|
+
if (n && (n.style.opacity = "0"), r)
|
|
213
|
+
if (r.style.transition = "all 0.3s ease-in-out", t === "top" || t === "bottom")
|
|
214
|
+
r.style.height = "110px", r.style.zIndex = "100", r.style.background = `linear-gradient(to bottom, ${s} 5%, ${w(s, -2)} 10%, ${w(s, -5, 30)} 70%, transparent)`, r.style.animation = "scrollToEndPulse 3.5s ease-out", setTimeout(() => {
|
|
215
|
+
r && (r.style.animation = "");
|
|
216
|
+
}, 3500);
|
|
217
|
+
else {
|
|
218
|
+
r.style.width = "40px";
|
|
219
|
+
const c = t === "left" ? "to right" : "to left";
|
|
220
|
+
r.style.background = `linear-gradient(${c}, ${s} 5%, ${w(s, -2)} 10%, ${w(s, -5, 30)} 70%, transparent)`, r.style.animation = "scrollToEndPulseVertical 1.5s ease-out", setTimeout(() => {
|
|
221
|
+
r && (r.style.animation = "");
|
|
222
|
+
}, 1500);
|
|
223
|
+
}
|
|
212
224
|
}
|
|
213
225
|
}
|
|
214
|
-
},
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
}, N = (t, e) => {
|
|
227
|
+
const o = a.current[t];
|
|
228
|
+
if (!o) return;
|
|
229
|
+
o.style.cursor = "";
|
|
230
|
+
const r = o.querySelector("svg");
|
|
231
|
+
r && (r.style.transform = "", r.style.backgroundColor = "", r.style.borderRadius = "");
|
|
232
|
+
const n = o.querySelector(".shadow-base");
|
|
233
|
+
if (n && (n.style.height = "", n.style.width = "", e === "shadow")) {
|
|
234
|
+
const s = G(l.current), c = t === "left" || t === "right" ? "to right" : "to bottom";
|
|
235
|
+
n.style.background = `linear-gradient(${c}, ${s} 5%, ${w(s, 0)} 10%, ${w(s, -2, 30)} 70%, transparent)`;
|
|
236
|
+
}
|
|
237
|
+
}, Ht = (t, e) => {
|
|
238
|
+
if (e !== "shadow" || i.current[t]) return;
|
|
239
|
+
const o = a.current[t];
|
|
240
|
+
if (!o) return;
|
|
241
|
+
const r = o.querySelector(".shadow-hover");
|
|
242
|
+
r && (r.style.opacity = "1");
|
|
243
|
+
}, Pt = (t, e) => {
|
|
244
|
+
if (e !== "shadow" || i.current[t]) return;
|
|
245
|
+
const o = a.current[t];
|
|
246
|
+
if (!o) return;
|
|
247
|
+
const r = o.querySelector(".shadow-hover");
|
|
248
|
+
r && (r.style.opacity = "0");
|
|
249
|
+
}, pt = (t, e, o) => {
|
|
250
|
+
if (e === "scroll-on-click" && g.current) {
|
|
224
251
|
g.current = !1;
|
|
225
252
|
return;
|
|
226
253
|
}
|
|
227
|
-
if (
|
|
228
|
-
|
|
254
|
+
if (i.current[t]) {
|
|
255
|
+
u.current && (clearTimeout(u.current), u.current = null), h.current && (clearInterval(h.current), h.current = null), N(t, o), i.current[t] = !1, kt(t);
|
|
229
256
|
return;
|
|
230
257
|
}
|
|
231
|
-
if (
|
|
232
|
-
if (!
|
|
233
|
-
const { clientHeight:
|
|
234
|
-
|
|
258
|
+
if (e === "scroll-on-click") {
|
|
259
|
+
if (!l.current) return;
|
|
260
|
+
const { clientHeight: r, clientWidth: n } = l.current, s = t === "top" || t === "bottom" ? r * 0.8 : n * 0.8;
|
|
261
|
+
q(t, s);
|
|
235
262
|
}
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
let
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
|
|
263
|
+
}, gt = (t, e) => {
|
|
264
|
+
u.current && (clearTimeout(u.current), u.current = null), g.current = !0, d.current = 3;
|
|
265
|
+
let o = 0;
|
|
266
|
+
H.current = t, i.current[t] = !1, q(t, d.current, !1), h.current = setInterval(() => {
|
|
267
|
+
o += 16;
|
|
268
|
+
const r = o / 1e3;
|
|
269
|
+
if (_(t) === 0) {
|
|
270
|
+
J(t, !1, e);
|
|
244
271
|
return;
|
|
245
272
|
}
|
|
246
|
-
if (
|
|
247
|
-
|
|
273
|
+
if (r >= 2 && !i.current[t] && (i.current[t] = !0, jt(t, e)), r <= 2)
|
|
274
|
+
d.current = 5 + r * 0.4;
|
|
248
275
|
else {
|
|
249
|
-
const
|
|
250
|
-
|
|
276
|
+
const s = r - 2;
|
|
277
|
+
d.current += Math.pow(s, 1.1) * 2;
|
|
251
278
|
}
|
|
252
|
-
|
|
279
|
+
d.current = Math.min(d.current, 100), q(t, d.current, !1);
|
|
253
280
|
}, 16);
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
258
|
-
let
|
|
259
|
-
const s =
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
clearInterval(
|
|
264
|
-
|
|
265
|
-
}, 1e3)) : (
|
|
281
|
+
}, J = (t, e = !1, o) => {
|
|
282
|
+
E.current && (clearTimeout(E.current), E.current = null);
|
|
283
|
+
const r = t || H.current;
|
|
284
|
+
if (!e && r && h.current) {
|
|
285
|
+
let n = 0;
|
|
286
|
+
const s = d.current, c = 800, m = setInterval(() => {
|
|
287
|
+
n += 16;
|
|
288
|
+
const T = n / c, x = 1 - Math.pow(1 - T, 3);
|
|
289
|
+
if (d.current = s * (1 - x), _(r) === 0 || d.current <= 0.5) {
|
|
290
|
+
clearInterval(m), h.current && (clearInterval(h.current), h.current = null), d.current = 5, r ? i.current[r] ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
291
|
+
N(r, o), i.current[r] = !1, g.current = !1;
|
|
292
|
+
}, 1e3)) : (N(r, o), i.current[r] = !1, g.current = !1) : g.current = !1, H.current = null;
|
|
266
293
|
return;
|
|
267
294
|
}
|
|
268
|
-
|
|
295
|
+
q(r, d.current, !1);
|
|
269
296
|
}, 16);
|
|
270
|
-
|
|
271
|
-
clearInterval(
|
|
272
|
-
|
|
273
|
-
}, 1e3)) : (
|
|
274
|
-
},
|
|
297
|
+
E.current = setTimeout(() => {
|
|
298
|
+
clearInterval(m), h.current && (clearInterval(h.current), h.current = null), d.current = 5, r ? i.current[r] ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
299
|
+
N(r, o), i.current[r] = !1, g.current = !1;
|
|
300
|
+
}, 1e3)) : (N(r, o), i.current[r] = !1, g.current = !1) : g.current = !1, H.current = null;
|
|
301
|
+
}, c);
|
|
275
302
|
} else
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}, 1e3)) : (
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
303
|
+
h.current && (clearInterval(h.current), h.current = null), d.current = 5, r ? i.current[r] ? (u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
304
|
+
N(r, o), i.current[r] = !1, g.current = !1;
|
|
305
|
+
}, 1e3)) : (N(r, o), i.current[r] = !1, g.current = !1) : g.current = !1, H.current = null;
|
|
306
|
+
}, mt = (t, e, o) => {
|
|
307
|
+
if (!Lt && (Ht(t, o), e === "scroll-on-hover")) {
|
|
308
|
+
const r = I[t]?.hoverDelay ?? 800;
|
|
309
|
+
E.current = setTimeout(() => {
|
|
310
|
+
gt(t, o);
|
|
311
|
+
}, r);
|
|
312
|
+
}
|
|
313
|
+
}, vt = (t, e, o) => {
|
|
314
|
+
Pt(t, o), e === "scroll-on-hover" && J(t, !0, o);
|
|
315
|
+
}, bt = (t, e, o) => {
|
|
316
|
+
e === "scroll-on-click" && (g.current = !1, E.current = setTimeout(() => {
|
|
317
|
+
gt(t, o);
|
|
288
318
|
}, 200));
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
if (!
|
|
293
|
-
const t =
|
|
294
|
-
|
|
319
|
+
}, yt = (t, e, o) => {
|
|
320
|
+
e === "scroll-on-click" && J(t, !1, o);
|
|
321
|
+
}, K = () => {
|
|
322
|
+
if (!l.current) return;
|
|
323
|
+
const t = l.current, { scrollTop: e, scrollLeft: o, scrollHeight: r, scrollWidth: n, clientHeight: s, clientWidth: c } = t, m = e <= 10, T = e + s >= r - 10, x = o <= 10, S = o + c >= n - 10;
|
|
324
|
+
a.current.top?.classList.toggle("opacity-0", m), a.current.top?.classList.toggle("pointer-events-none", m), a.current.top?.classList.toggle("pointer-events-auto", !m), a.current.bottom?.classList.toggle("opacity-0", T), a.current.bottom?.classList.toggle("pointer-events-none", T), a.current.bottom?.classList.toggle("pointer-events-auto", !T), a.current.left?.classList.toggle("opacity-0", x), a.current.left?.classList.toggle("pointer-events-none", x), a.current.left?.classList.toggle("pointer-events-auto", !x), a.current.right?.classList.toggle("opacity-0", S), a.current.right?.classList.toggle("pointer-events-none", S), a.current.right?.classList.toggle("pointer-events-auto", !S);
|
|
295
325
|
};
|
|
296
|
-
|
|
297
|
-
if (!
|
|
298
|
-
const t =
|
|
326
|
+
qt(() => {
|
|
327
|
+
if (!l.current) return;
|
|
328
|
+
const t = l.current;
|
|
299
329
|
if (j) {
|
|
300
|
-
|
|
330
|
+
W.current = typeof j == "string" ? `scrollable-${j}` : `scrollable-${Math.random().toString(36).substr(2, 9)}`;
|
|
301
331
|
try {
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
const { scrollTop:
|
|
305
|
-
t.scrollTop =
|
|
332
|
+
const r = sessionStorage.getItem(W.current);
|
|
333
|
+
if (r) {
|
|
334
|
+
const { scrollTop: n, scrollLeft: s } = JSON.parse(r);
|
|
335
|
+
t.scrollTop = n, t.scrollLeft = s;
|
|
306
336
|
}
|
|
307
337
|
} catch {
|
|
308
338
|
}
|
|
309
339
|
}
|
|
310
|
-
|
|
311
|
-
Object.values(
|
|
312
|
-
|
|
340
|
+
K(), st.current || (st.current = !0, requestAnimationFrame(() => {
|
|
341
|
+
Object.values(a.current).forEach((r) => {
|
|
342
|
+
r?.classList.add("transition-all", "duration-300");
|
|
313
343
|
}), setTimeout(() => {
|
|
314
|
-
|
|
344
|
+
K();
|
|
315
345
|
}, 0);
|
|
316
346
|
}));
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
320
|
-
scrollTop:
|
|
321
|
-
scrollLeft:
|
|
347
|
+
const e = () => {
|
|
348
|
+
if (K(), it(), l.current) {
|
|
349
|
+
const r = {
|
|
350
|
+
scrollTop: l.current.scrollTop,
|
|
351
|
+
scrollLeft: l.current.scrollLeft
|
|
322
352
|
};
|
|
323
|
-
|
|
353
|
+
ht(r);
|
|
324
354
|
}
|
|
325
|
-
j &&
|
|
355
|
+
j && W.current && (P.current && clearTimeout(P.current), P.current = setTimeout(() => {
|
|
326
356
|
try {
|
|
327
|
-
const
|
|
357
|
+
const r = {
|
|
328
358
|
scrollTop: t.scrollTop,
|
|
329
359
|
scrollLeft: t.scrollLeft
|
|
330
360
|
};
|
|
331
|
-
sessionStorage.setItem(
|
|
361
|
+
sessionStorage.setItem(W.current, JSON.stringify(r));
|
|
332
362
|
} catch {
|
|
333
363
|
}
|
|
334
364
|
}, 150));
|
|
335
365
|
};
|
|
336
|
-
t.addEventListener("scroll",
|
|
337
|
-
const
|
|
338
|
-
|
|
366
|
+
t.addEventListener("scroll", e);
|
|
367
|
+
const o = (r) => {
|
|
368
|
+
ot && r.preventDefault();
|
|
339
369
|
};
|
|
340
|
-
return t.addEventListener("wheel",
|
|
341
|
-
t.removeEventListener("scroll",
|
|
370
|
+
return t.addEventListener("wheel", o, { passive: !1 }), () => {
|
|
371
|
+
t.removeEventListener("scroll", e), t.removeEventListener("wheel", o), P.current && clearTimeout(P.current);
|
|
342
372
|
};
|
|
343
|
-
}, [
|
|
344
|
-
if (!
|
|
345
|
-
let t =
|
|
346
|
-
Object.entries(
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
373
|
+
}, [ot, j, O, it, ht]), Vt(() => {
|
|
374
|
+
if (!l.current) return;
|
|
375
|
+
let t = G(l.current);
|
|
376
|
+
Object.entries(I).forEach(([e, o]) => {
|
|
377
|
+
if (o?.show && o.type === "shadow") {
|
|
378
|
+
const r = a.current[e], n = r?.querySelector(".shadow-base"), s = r?.querySelector(".shadow-hover");
|
|
379
|
+
if (n) {
|
|
380
|
+
n.dataset.bgColor = t;
|
|
381
|
+
const c = e === "left" || e === "right" ? "to right" : "to bottom";
|
|
382
|
+
n.style.background = `linear-gradient(${c}, ${t} 2%, ${w(t, -2, 55)} 50%, ${w(t, -1, 30)} 80%, transparent)`;
|
|
383
|
+
}
|
|
349
384
|
if (s) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
s.style.background = `linear-gradient(${l}, ${t} 5%, ${q(t, 0)} 10%, ${q(t, -2, 30)} 70%, transparent)`;
|
|
385
|
+
const c = e === "left" || e === "right" ? "to right" : "to bottom";
|
|
386
|
+
s.style.height += "60px", s.style.background = `linear-gradient(${c}, ${t} 2%, ${w(t, 10, 20)} 20%, ${w(t, 6, 10)} 70%, transparent)`;
|
|
353
387
|
}
|
|
354
388
|
}
|
|
355
389
|
});
|
|
356
|
-
}, [
|
|
357
|
-
const
|
|
358
|
-
return /* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
390
|
+
}, [I]);
|
|
391
|
+
const zt = Tt.Children.toArray(Nt), At = Object.values(I).some((t) => t?.show && t?.type === "icon");
|
|
392
|
+
return /* @__PURE__ */ b.jsxs("div", { className: L("relative p-0", rt, St({ axis: y }), "scrolleable", At ? "overflow-visible" : "overflow-hidden!"), children: [
|
|
393
|
+
/* @__PURE__ */ b.jsx(
|
|
360
394
|
"div",
|
|
361
395
|
{
|
|
362
|
-
ref:
|
|
363
|
-
className:
|
|
364
|
-
|
|
365
|
-
|
|
396
|
+
ref: l,
|
|
397
|
+
className: L(
|
|
398
|
+
Mt && "border border-red-900 border-dashed",
|
|
399
|
+
rt,
|
|
366
400
|
"py-2 relative w-full h-full min-h-full",
|
|
367
|
-
|
|
368
|
-
|
|
401
|
+
St({ axis: y }),
|
|
402
|
+
Ft({ hide: nt?.hide, size: nt?.size }),
|
|
369
403
|
""
|
|
370
404
|
),
|
|
371
|
-
children:
|
|
405
|
+
children: zt?.map((t) => Tt.cloneElement(t, { className: L(t?.props?.className, "shrink-0! pointer-events-auto") }))
|
|
372
406
|
}
|
|
373
407
|
),
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
if (!
|
|
376
|
-
const
|
|
377
|
-
return /* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ b.jsx("div", { className: "h-full w-full z-10 absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit]", children: Object.entries(I).map(([t, e]) => {
|
|
409
|
+
if (!e?.show || e.type !== "shadow") return null;
|
|
410
|
+
const o = t;
|
|
411
|
+
return /* @__PURE__ */ b.jsxs(
|
|
378
412
|
"span",
|
|
379
413
|
{
|
|
380
|
-
ref: (
|
|
381
|
-
|
|
414
|
+
ref: (r) => {
|
|
415
|
+
a.current[t] = r;
|
|
382
416
|
},
|
|
383
|
-
className:
|
|
384
|
-
"
|
|
417
|
+
className: L(
|
|
418
|
+
e.behavior === "scroll-on-click" ? "cursor-pointer" : "cursor-default",
|
|
419
|
+
"ease-in-out z-100",
|
|
385
420
|
"opacity-0 pointer-events-none"
|
|
386
421
|
),
|
|
387
|
-
onClick: () =>
|
|
388
|
-
onMouseEnter: () =>
|
|
389
|
-
onMouseLeave: () =>
|
|
390
|
-
onMouseDown: () =>
|
|
391
|
-
onMouseUp: () =>
|
|
392
|
-
children:
|
|
422
|
+
onClick: () => pt(o, e.behavior, e.type),
|
|
423
|
+
onMouseEnter: () => mt(o, e.behavior, e.type),
|
|
424
|
+
onMouseLeave: () => vt(o, e.behavior, e.type),
|
|
425
|
+
onMouseDown: () => bt(o, e.behavior, e.type),
|
|
426
|
+
onMouseUp: () => yt(o, e.behavior, e.type),
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ b.jsx("span", { className: L(Q({ position: o, type: "shadow" }), "shadow-base", e.className) }),
|
|
429
|
+
/* @__PURE__ */ b.jsx("span", { className: L(Q({ position: o, type: "shadow" }), "shadow-hover opacity-0 transition-opacity duration-300", e.className) })
|
|
430
|
+
]
|
|
393
431
|
},
|
|
394
432
|
t
|
|
395
433
|
);
|
|
396
434
|
}) }),
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
if (!
|
|
399
|
-
const
|
|
400
|
-
return /* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ b.jsx("div", { className: "h-full w-full z-20 absolute inset-0 pointer-events-none", children: Object.entries(I).map(([t, e]) => {
|
|
436
|
+
if (!e?.show || e.type !== "icon") return null;
|
|
437
|
+
const o = t;
|
|
438
|
+
return /* @__PURE__ */ b.jsx(
|
|
401
439
|
"span",
|
|
402
440
|
{
|
|
403
|
-
ref: (
|
|
404
|
-
|
|
441
|
+
ref: (r) => {
|
|
442
|
+
a.current[t] = r;
|
|
405
443
|
},
|
|
406
444
|
className: "pointer-events-auto cursor-default transition-all duration-300 opacity-0",
|
|
407
|
-
onClick: () =>
|
|
408
|
-
onMouseEnter: () =>
|
|
409
|
-
onMouseLeave: () =>
|
|
410
|
-
onMouseDown: () =>
|
|
411
|
-
onMouseUp: () =>
|
|
412
|
-
children: /* @__PURE__ */
|
|
445
|
+
onClick: () => pt(o, e.behavior, e.type),
|
|
446
|
+
onMouseEnter: () => mt(o, e.behavior, e.type),
|
|
447
|
+
onMouseLeave: () => vt(o, e.behavior, e.type),
|
|
448
|
+
onMouseDown: () => bt(o, e.behavior, e.type),
|
|
449
|
+
onMouseUp: () => yt(o, e.behavior, e.type),
|
|
450
|
+
children: /* @__PURE__ */ b.jsx(xt, { size: 20, className: L(Q({ position: o, type: "icon" }), e.className) })
|
|
413
451
|
},
|
|
414
452
|
t
|
|
415
453
|
);
|
|
416
454
|
}) }),
|
|
417
|
-
|
|
455
|
+
M && /* @__PURE__ */ b.jsx(
|
|
418
456
|
"button",
|
|
419
457
|
{
|
|
420
|
-
onClick:
|
|
421
|
-
className:
|
|
458
|
+
onClick: Ct,
|
|
459
|
+
className: L(
|
|
422
460
|
"absolute bottom-6 right-6 z-50 p-3 rounded-full shadow-lg transition-all duration-300 hover:scale-110 pointer-events-auto cursor-pointer",
|
|
423
461
|
"bg-primary-default-default hover:bg-primary-default-hover text-white",
|
|
424
462
|
// Transiciones de aparición/desaparición
|
|
425
463
|
"transform translate-y-0 opacity-70",
|
|
426
|
-
|
|
427
|
-
|
|
464
|
+
!$t && "translate-y-4 opacity-0 pointer-events-none",
|
|
465
|
+
M.className
|
|
428
466
|
),
|
|
429
467
|
"aria-label": "Scroll to top",
|
|
430
468
|
style: {
|
|
431
469
|
transition: "all 0.3s ease-in-out"
|
|
432
470
|
},
|
|
433
|
-
children:
|
|
471
|
+
children: M.icon ? /* @__PURE__ */ b.jsx(M.icon, { size: 20, className: "text-white" }) : /* @__PURE__ */ b.jsx(xt, { size: 20, className: "text-white rotate-90" })
|
|
434
472
|
}
|
|
435
473
|
)
|
|
436
474
|
] });
|
|
437
475
|
};
|
|
438
476
|
export {
|
|
439
|
-
|
|
477
|
+
Zt as Scrollable
|
|
440
478
|
};
|