prometeo-design-system 4.3.1 → 4.3.3

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