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