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.
@@ -1,11 +1,11 @@
1
- import { j as y } from "./jsx-runtime-GkKLlHH4.js";
1
+ import { j as b } from "./jsx-runtime-GkKLlHH4.js";
2
2
  import { u as Rt } from "./useDevice-vwn4GLwK.js";
3
- import { g as vt, r as q } from "./useLabelBackground-D5SzHhl_.js";
4
- import { c as M } from "./cn-B6yFEsav.js";
5
- import { c as X } from "./index-BOQuZ0gG.js";
6
- import yt, { useRef as i, useState as Bt, useCallback as C, useImperativeHandle as $t, useLayoutEffect as Ot, useEffect as Wt } from "react";
7
- import { CrevronLeft as Tt } from "./Icons/CrevronLeft.es.js";
8
- const wt = X(
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
- ), xt = X("", {
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-14" },
38
- { type: "shadow", position: "bottom", className: "bottom-0 left-0 w-full h-14 rotate-180" },
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
- }), Vt = X("", {
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
- }), Gt = (Y) => {
54
- const { defaultBehavior: A = "scroll-on-click" } = Y, St = Rt(), G = {
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
- }, Q = {
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: Lt = !1,
64
- className: Z,
65
- axis: v = "both",
66
- children: Mt,
67
- indicators: Nt = G,
68
- scrollbarProps: Et = Q,
69
- disableMouseScroll: tt = !1,
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: w,
73
- scrollMetadata: R
74
- } = Y, c = i({}), n = i(null), u = i(null), N = i(null), a = i(null), f = i(5), d = i({}), D = i(null), g = i(!1), et = i(!1), B = i(null), P = i(null), [kt, Ct] = Bt(!1), H = { ...G, ...Nt }, rt = { ...Q, ...Et }, z = i([]), ot = i(/* @__PURE__ */ new Map()), nt = i({ scrollTop: 0, scrollLeft: 0 }), F = (t) => {
75
- if (!n.current) return 0;
76
- const { scrollTop: r, scrollLeft: e, scrollHeight: o, clientHeight: s, scrollWidth: l, clientWidth: h } = n.current;
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, r);
84
+ return Math.max(0, e);
80
85
  case "bottom":
81
- return Math.max(0, o - (r + s));
86
+ return Math.max(0, r - (e + n));
82
87
  case "left":
83
- return Math.max(0, e);
88
+ return Math.max(0, o);
84
89
  case "right":
85
- return Math.max(0, l - (e + h));
90
+ return Math.max(0, s - (o + c));
86
91
  default:
87
92
  return 0;
88
93
  }
89
- }, st = C((t) => {
90
- if (!t || !n.current) return 0;
91
- const { clientHeight: r, scrollHeight: e } = n.current;
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 o = parseFloat(t.replace("%", "")), s = Math.max(0, e - r);
94
- return o / 100 * s;
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
- }, []), lt = C(() => {
103
- if (!n.current || !w) return;
104
- const { scrollTop: t } = n.current, r = st(w.target || "40vh");
105
- Ct(t >= r);
106
- }, [w, st]), ct = C(() => {
107
- if (!n.current) return { x: 0, y: 0 };
108
- const { scrollTop: t, scrollLeft: r, scrollHeight: e, scrollWidth: o, clientHeight: s, clientWidth: l } = n.current, h = Math.max(0, e - s), m = Math.max(0, o - l), T = h > 0 ? t / h * 100 : 0;
109
- return { x: m > 0 ? r / m * 100 : 0, y: T };
110
- }, []), at = C((t) => {
111
- const r = nt.current;
112
- let e = null;
113
- 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"), nt.current = t, e;
114
- }, []), it = C((t) => {
115
- if (!n.current) return;
116
- const { scrollTop: r, scrollLeft: e, scrollHeight: o, scrollWidth: s, clientHeight: l, clientWidth: h } = n.current, m = at(t), { x: T, y: S } = ct(), L = {
117
- percentage: S,
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: r,
120
- scrollLeft: e,
121
- scrollHeight: o,
122
- scrollWidth: s,
123
- clientHeight: l,
124
- clientWidth: h,
125
- metadata: R
126
- }, J = {
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: r,
130
- scrollLeft: e,
131
- scrollHeight: o,
132
- scrollWidth: s,
133
- clientHeight: l,
134
- clientWidth: h,
135
- metadata: R
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: b, triggered: O } = p;
139
- if (!b) {
140
- (v === "y" || v === "both") && p.callback(L), (v === "x" || v === "both") && p.callback(J);
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 K = (b.direction === "y" || b.direction === "both") && (v === "y" || v === "both"), bt = (b.direction === "x" || b.direction === "both") && (v === "x" || v === "both");
144
- if (!K && !bt) return;
145
- const E = (K ? L : J).percentage, I = b.target * 100;
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 (b.trip === "forth")
148
- k = !O && E >= I, k && (p.triggered = !0), O && E < I && (p.triggered = !1);
149
- else if (b.trip === "back")
150
- k = O && E < I, k && (p.triggered = !1), !O && E >= I && (p.triggered = !0);
151
- else if (b.trip === "round-trip") {
152
- const W = E >= I;
153
- k = p.triggered !== W;
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 W = `${z.current.indexOf(p)}-${b?.target || 0}-${b?.direction || "y"}`, V = Date.now(), At = ot.current.get(W) || 0;
157
- if (V - At < 500)
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
- b.trip === "round-trip" && (p.triggered = E >= I, p.lastDirection = m || void 0), ot.current.set(W, V), p.lastTriggerTime = V, K ? p.callback(L) : bt && p.callback(J);
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
- }, [v, at, ct, R]), ut = C((t, r) => {
163
- const e = {
167
+ }, [y, ft, ut, O]), dt = C((t, e) => {
168
+ const o = {
164
169
  callback: t,
165
- config: r,
170
+ config: e,
166
171
  triggered: !1,
167
172
  lastDirection: void 0
168
173
  };
169
- return z.current.push(e), () => {
170
- const o = z.current.indexOf(e);
171
- o > -1 && z.current.splice(o, 1);
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
- $t(It, () => ({
175
- subscribeToScrollTarget: ut
176
- }), [ut]);
177
- const $ = (t, r = 100, e = !0) => {
178
- if (!n.current) return;
179
- const o = F(t), s = Math.min(Math.abs(r), o);
180
- if (s === 0) return;
181
- const l = t === "top" || t === "left" ? -s : s, h = {
182
- top: { top: l, left: 0 },
183
- bottom: { top: l, left: 0 },
184
- left: { top: 0, left: l },
185
- right: { top: 0, left: l }
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
- n.current.scrollBy({ ...h[t], behavior: e ? "smooth" : "auto" });
188
- }, jt = (t) => {
189
- if (!n.current) return;
190
- const r = n.current, e = {
191
- top: { top: 0, left: r.scrollLeft },
192
- bottom: { top: r.scrollHeight, left: r.scrollLeft },
193
- left: { top: r.scrollTop, left: 0 },
194
- right: { top: r.scrollTop, left: r.scrollWidth }
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
- r.scrollTo({ ...e[t], behavior: "smooth" });
197
- }, Dt = () => {
198
- n.current && n.current.scrollTo({ top: 0, behavior: "smooth" });
199
- }, Pt = (t, r) => {
200
- const e = c.current[t];
201
- if (e) {
202
- if (e.style.cursor = "pointer", r === "icon") {
203
- const o = e.querySelector("svg");
204
- 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%");
205
- } else if (r === "shadow") {
206
- const o = e.querySelector("span"), s = vt(n.current);
207
- o && (t === "top" || t === "bottom" ? (o.style.height = "110px", o.style.background = `linear-gradient(to bottom, ${s} 5%, ${q(s, -2)} 10%, ${q(s, -5, 30)} 70%, transparent)`, o.style.animation = "scrollToEndPulse 3.5s ease-out", setTimeout(() => {
208
- o.style.animation = "";
209
- }, 3500)) : (o.style.width = "40px", o.style.animation = "scrollToEndPulseVertical 1.5s ease-out", setTimeout(() => {
210
- o.style.animation = "";
211
- }, 1500)));
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
- }, x = (t) => {
215
- const r = c.current[t];
216
- if (!r) return;
217
- r.style.cursor = "";
218
- const e = r.querySelector("svg");
219
- e && (e.style.transform = "", e.style.backgroundColor = "", e.style.borderRadius = "");
220
- const o = r.querySelector("span");
221
- o && (o.style.height = "", o.style.width = "");
222
- }, ft = (t, r) => {
223
- if (r === "scroll-on-click" && g.current) {
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 (d.current[t]) {
228
- a.current && (clearTimeout(a.current), a.current = null), u.current && (clearInterval(u.current), u.current = null), x(t), d.current[t] = !1, jt(t);
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 (r === "scroll-on-click") {
232
- if (!n.current) return;
233
- const { clientHeight: e, clientWidth: o } = n.current, s = t === "top" || t === "bottom" ? e * 0.8 : o * 0.8;
234
- $(t, s);
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
- }, dt = (t, r) => {
237
- a.current && (clearTimeout(a.current), a.current = null), g.current = !0, f.current = 3;
238
- let e = 0;
239
- D.current = t, d.current[t] = !1, $(t, f.current, !1), u.current = setInterval(() => {
240
- e += 16;
241
- const o = e / 1e3;
242
- if (F(t) === 0) {
243
- U(t);
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 (o >= 2 && !d.current[t] && (d.current[t] = !0, Pt(t, r)), o <= 2)
247
- f.current = 5 + o * 0.4;
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 l = o - 2;
250
- f.current += Math.pow(l, 1.1) * 2;
276
+ const s = r - 2;
277
+ d.current += Math.pow(s, 1.1) * 2;
251
278
  }
252
- f.current = Math.min(f.current, 100), $(t, f.current, !1);
279
+ d.current = Math.min(d.current, 100), q(t, d.current, !1);
253
280
  }, 16);
254
- }, U = (t, r = !1) => {
255
- N.current && (clearTimeout(N.current), N.current = null);
256
- const e = t || D.current;
257
- if (!r && e && u.current) {
258
- let o = 0;
259
- const s = f.current, l = 800, h = setInterval(() => {
260
- o += 16;
261
- const m = o / l, T = 1 - Math.pow(1 - m, 3);
262
- if (f.current = s * (1 - T), F(e) === 0 || f.current <= 0.5) {
263
- clearInterval(h), u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
264
- x(e), d.current[e] = !1, g.current = !1;
265
- }, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
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
- $(e, f.current, !1);
295
+ q(r, d.current, !1);
269
296
  }, 16);
270
- N.current = setTimeout(() => {
271
- clearInterval(h), u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
272
- x(e), d.current[e] = !1, g.current = !1;
273
- }, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
274
- }, l);
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
- u.current && (clearInterval(u.current), u.current = null), f.current = 5, e ? d.current[e] ? (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
277
- x(e), d.current[e] = !1, g.current = !1;
278
- }, 1e3)) : (x(e), d.current[e] = !1, g.current = !1) : g.current = !1, D.current = null;
279
- }, ht = (t, r, e) => {
280
- St || r === "scroll-on-hover" && (N.current = setTimeout(() => {
281
- dt(t, e);
282
- }, 200));
283
- }, pt = (t, r) => {
284
- r === "scroll-on-hover" && U(t, !0);
285
- }, gt = (t, r, e) => {
286
- r === "scroll-on-click" && (g.current = !1, N.current = setTimeout(() => {
287
- dt(t, e);
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
- }, mt = (t, r) => {
290
- r === "scroll-on-click" && U(t, !1);
291
- }, _ = () => {
292
- if (!n.current) return;
293
- const t = n.current, { scrollTop: r, scrollLeft: e, scrollHeight: o, scrollWidth: s, clientHeight: l, clientWidth: h } = t, m = r <= 10, T = r + l >= o - 10, S = e <= 10, L = e + h >= s - 10;
294
- 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", S), c.current.left?.classList.toggle("pointer-events-none", S), c.current.left?.classList.toggle("pointer-events-auto", !S), c.current.right?.classList.toggle("opacity-0", L), c.current.right?.classList.toggle("pointer-events-none", L), c.current.right?.classList.toggle("pointer-events-auto", !L);
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
- Ot(() => {
297
- if (!n.current) return;
298
- const t = n.current;
326
+ qt(() => {
327
+ if (!l.current) return;
328
+ const t = l.current;
299
329
  if (j) {
300
- B.current = typeof j == "string" ? `scrollable-${j}` : `scrollable-${Math.random().toString(36).substr(2, 9)}`;
330
+ W.current = typeof j == "string" ? `scrollable-${j}` : `scrollable-${Math.random().toString(36).substr(2, 9)}`;
301
331
  try {
302
- const o = sessionStorage.getItem(B.current);
303
- if (o) {
304
- const { scrollTop: s, scrollLeft: l } = JSON.parse(o);
305
- t.scrollTop = s, t.scrollLeft = l;
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
- _(), et.current || (et.current = !0, requestAnimationFrame(() => {
311
- Object.values(c.current).forEach((o) => {
312
- o?.classList.add("transition-all", "duration-300");
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 r = () => {
318
- if (_(), lt(), n.current) {
319
- const o = {
320
- scrollTop: n.current.scrollTop,
321
- scrollLeft: n.current.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
- it(o);
353
+ ht(r);
324
354
  }
325
- j && B.current && (P.current && clearTimeout(P.current), P.current = setTimeout(() => {
355
+ j && W.current && (P.current && clearTimeout(P.current), P.current = setTimeout(() => {
326
356
  try {
327
- const o = {
357
+ const r = {
328
358
  scrollTop: t.scrollTop,
329
359
  scrollLeft: t.scrollLeft
330
360
  };
331
- sessionStorage.setItem(B.current, JSON.stringify(o));
361
+ sessionStorage.setItem(W.current, JSON.stringify(r));
332
362
  } catch {
333
363
  }
334
364
  }, 150));
335
365
  };
336
- t.addEventListener("scroll", r);
337
- const e = (o) => {
338
- tt && o.preventDefault();
366
+ t.addEventListener("scroll", e);
367
+ const o = (r) => {
368
+ ot && r.preventDefault();
339
369
  };
340
- return t.addEventListener("wheel", e, { passive: !1 }), () => {
341
- t.removeEventListener("scroll", r), t.removeEventListener("wheel", e), P.current && clearTimeout(P.current);
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
- }, [tt, j, R, lt, it]), Wt(() => {
344
- if (!n.current) return;
345
- let t = vt(n.current);
346
- Object.entries(H).forEach(([r, e]) => {
347
- if (e?.show && e.type === "shadow") {
348
- const s = c.current[r]?.querySelector("span");
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
- s.dataset.bgColor = t;
351
- const l = r === "left" || r === "right" ? "to right" : "to bottom";
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
- }, [H]);
357
- const Ht = yt.Children.toArray(Mt), zt = Object.values(H).some((t) => t?.show && t?.type === "icon");
358
- return /* @__PURE__ */ y.jsxs("div", { className: M("relative p-0", Z, wt({ axis: v }), "scrolleable", zt ? "overflow-visible" : "overflow-hidden!"), children: [
359
- /* @__PURE__ */ y.jsx(
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: n,
363
- className: M(
364
- Lt && "border border-red-900 border-dashed",
365
- Z,
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
- wt({ axis: v }),
368
- Vt({ hide: rt?.hide, size: rt?.size }),
401
+ St({ axis: y }),
402
+ Ft({ hide: nt?.hide, size: nt?.size }),
369
403
  ""
370
404
  ),
371
- children: Ht?.map((t) => yt.cloneElement(t, { className: M(t?.props?.className, "shrink-0! pointer-events-auto") }))
405
+ children: zt?.map((t) => Tt.cloneElement(t, { className: L(t?.props?.className, "shrink-0! pointer-events-auto") }))
372
406
  }
373
407
  ),
374
- /* @__PURE__ */ y.jsx("div", { className: "h-full w-full z-10 absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit]", children: Object.entries(H).map(([t, r]) => {
375
- if (!r?.show || r.type !== "shadow") return null;
376
- const e = t;
377
- return /* @__PURE__ */ y.jsx(
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: (o) => {
381
- c.current[t] = o;
414
+ ref: (r) => {
415
+ a.current[t] = r;
382
416
  },
383
- className: M(
384
- "cursor-default ease-in-out z-100",
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: () => ft(e, r.behavior),
388
- onMouseEnter: () => ht(e, r.behavior, r.type),
389
- onMouseLeave: () => pt(e, r.behavior),
390
- onMouseDown: () => gt(e, r.behavior, r.type),
391
- onMouseUp: () => mt(e, r.behavior),
392
- children: /* @__PURE__ */ y.jsx("span", { className: M(xt({ position: e, type: "shadow" }), r.className) })
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__ */ y.jsx("div", { className: "h-full w-full z-20 absolute inset-0 pointer-events-none", children: Object.entries(H).map(([t, r]) => {
398
- if (!r?.show || r.type !== "icon") return null;
399
- const e = t;
400
- return /* @__PURE__ */ y.jsx(
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: (o) => {
404
- c.current[t] = o;
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: () => ft(e, r.behavior),
408
- onMouseEnter: () => ht(e, r.behavior, r.type),
409
- onMouseLeave: () => pt(e, r.behavior),
410
- onMouseDown: () => gt(e, r.behavior, r.type),
411
- onMouseUp: () => mt(e, r.behavior),
412
- children: /* @__PURE__ */ y.jsx(Tt, { size: 20, className: M(xt({ position: e, type: "icon" }), r.className) })
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
- w && /* @__PURE__ */ y.jsx(
455
+ M && /* @__PURE__ */ b.jsx(
418
456
  "button",
419
457
  {
420
- onClick: Dt,
421
- className: M(
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
- !kt && "translate-y-4 opacity-0 pointer-events-none",
427
- w.className
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: w.icon ? /* @__PURE__ */ y.jsx(w.icon, { size: 20, className: "text-white" }) : /* @__PURE__ */ y.jsx(Tt, { size: 20, className: "text-white rotate-90" })
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
- Gt as Scrollable
477
+ Zt as Scrollable
440
478
  };