prometeo-design-system 4.8.0 → 4.8.1

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.
@@ -3,9 +3,9 @@ import { u as Rt } from "./useDevice-vwn4GLwK.js";
3
3
  import { g as G, r as w } from "./useLabelBackground-D5SzHhl_.js";
4
4
  import { c as L } from "./cn-B6yFEsav.js";
5
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(
6
+ import xt, { useRef as f, useState as Ot, useCallback as C, useImperativeHandle as Wt, useLayoutEffect as qt, useEffect as Vt } from "react";
7
+ import { CrevronLeft as St } from "./Icons/CrevronLeft.es.js";
8
+ const Lt = Z(
9
9
  "",
10
10
  {
11
11
  variants: {
@@ -51,32 +51,32 @@ const St = Z(
51
51
  }
52
52
  }
53
53
  }), Zt = (tt) => {
54
- const { defaultBehavior: A = "scroll-on-click" } = tt, Lt = Rt(), B = {
54
+ const { defaultBehavior: A = "scroll-on-click" } = tt, Mt = Rt(), B = {
55
55
  top: { show: !0, type: "shadow", behavior: A, hoverDelay: 300 },
56
56
  bottom: { show: !0, type: "shadow", behavior: A, hoverDelay: 300 },
57
57
  left: { show: !0, type: "icon", behavior: A, hoverDelay: 300 },
58
58
  right: { show: !0, type: "icon", behavior: A, hoverDelay: 300 }
59
59
  }, et = {
60
60
  hide: !1,
61
- size: "medium"
61
+ size: "small"
62
62
  }, {
63
- debugMode: Mt = !1,
63
+ debugMode: Nt = !1,
64
64
  className: rt,
65
65
  axis: y = "both",
66
- children: Nt,
66
+ children: ot,
67
67
  indicators: R,
68
68
  scrollbarProps: Et = et,
69
- disableMouseScroll: ot = !1,
69
+ disableMouseScroll: st = !1,
70
70
  persistScroll: j = !1,
71
71
  controls: It,
72
72
  scrollTopButton: M,
73
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 = {
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), nt = f(!1), W = f(null), P = f(null), [$t, Dt] = Ot(!1), I = {
75
75
  top: { ...B.top, ...R?.top },
76
76
  bottom: { ...B.bottom, ...R?.bottom },
77
77
  left: { ...B.left, ...R?.left },
78
78
  right: { ...B.right, ...R?.right }
79
- }, nt = { ...et, ...Et }, z = f([]), lt = f(/* @__PURE__ */ new Map()), ct = f({ scrollTop: 0, scrollLeft: 0 }), _ = (t) => {
79
+ }, lt = { ...et, ...Et }, z = f([]), ct = f(/* @__PURE__ */ new Map()), at = f({ scrollTop: 0, scrollLeft: 0 }), _ = (t) => {
80
80
  if (!l.current) return 0;
81
81
  const { scrollTop: e, scrollLeft: o, scrollHeight: r, clientHeight: n, scrollWidth: s, clientWidth: c } = l.current;
82
82
  switch (t) {
@@ -91,7 +91,7 @@ const St = Z(
91
91
  default:
92
92
  return 0;
93
93
  }
94
- }, at = C((t) => {
94
+ }, it = C((t) => {
95
95
  if (!t || !l.current) return 0;
96
96
  const { clientHeight: e, scrollHeight: o } = l.current;
97
97
  if (t.includes("%")) {
@@ -104,21 +104,21 @@ const St = Z(
104
104
  return parseFloat(t.replace("vh", "")) / 100 * window.innerHeight;
105
105
  }
106
106
  return 0;
107
- }, []), it = C(() => {
107
+ }, []), ut = C(() => {
108
108
  if (!l.current || !M) return;
109
- const { scrollTop: t } = l.current, e = at(M.target || "40vh");
109
+ const { scrollTop: t } = l.current, e = it(M.target || "40vh");
110
110
  Dt(t >= e);
111
- }, [M, at]), ut = C(() => {
111
+ }, [M, it]), ft = C(() => {
112
112
  if (!l.current) return { x: 0, y: 0 };
113
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
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
115
  }, []), ht = C((t) => {
116
+ const e = at.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"), at.current = t, o;
119
+ }, []), dt = C((t) => {
120
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 = {
121
+ const { scrollTop: e, scrollLeft: o, scrollHeight: r, scrollWidth: n, clientHeight: s, clientWidth: c } = l.current, m = ht(t), { x: T, y: x } = ft(), S = {
122
122
  percentage: x,
123
123
  direction: m,
124
124
  scrollTop: e,
@@ -145,8 +145,8 @@ const St = Z(
145
145
  (y === "y" || y === "both") && p.callback(S), (y === "x" || y === "both") && p.callback(X);
146
146
  return;
147
147
  }
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;
148
+ const Y = (v.direction === "y" || v.direction === "both") && (y === "y" || y === "both"), Tt = (v.direction === "x" || v.direction === "both") && (y === "x" || y === "both");
149
+ if (!Y && !Tt) return;
150
150
  const $ = (Y ? S : X).percentage, D = v.target * 100;
151
151
  let k = !1;
152
152
  if (v.trip === "forth")
@@ -158,13 +158,13 @@ const St = Z(
158
158
  k = p.triggered !== F;
159
159
  }
160
160
  if (k) {
161
- const F = `${z.current.indexOf(p)}-${v?.target || 0}-${v?.direction || "y"}`, U = Date.now(), Bt = lt.current.get(F) || 0;
161
+ const F = `${z.current.indexOf(p)}-${v?.target || 0}-${v?.direction || "y"}`, U = Date.now(), Bt = ct.current.get(F) || 0;
162
162
  if (U - Bt < 500)
163
163
  return;
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);
164
+ v.trip === "round-trip" && (p.triggered = $ >= D, p.lastDirection = m || void 0), ct.current.set(F, U), p.lastTriggerTime = U, Y ? p.callback(S) : Tt && p.callback(X);
165
165
  }
166
166
  });
167
- }, [y, ft, ut, O]), dt = C((t, e) => {
167
+ }, [y, ht, ft, O]), pt = C((t, e) => {
168
168
  const o = {
169
169
  callback: t,
170
170
  config: e,
@@ -177,8 +177,8 @@ const St = Z(
177
177
  };
178
178
  }, []);
179
179
  Wt(It, () => ({
180
- subscribeToScrollTarget: dt
181
- }), [dt]);
180
+ subscribeToScrollTarget: pt
181
+ }), [pt]);
182
182
  const q = (t, e = 100, o = !0) => {
183
183
  if (!l.current) return;
184
184
  const r = _(t), n = Math.min(Math.abs(e), r);
@@ -246,7 +246,7 @@ const St = Z(
246
246
  if (!o) return;
247
247
  const r = o.querySelector(".shadow-hover");
248
248
  r && (r.style.opacity = "0");
249
- }, pt = (t, e, o) => {
249
+ }, gt = (t, e, o) => {
250
250
  if (e === "scroll-on-click" && g.current) {
251
251
  g.current = !1;
252
252
  return;
@@ -260,7 +260,7 @@ const St = Z(
260
260
  const { clientHeight: r, clientWidth: n } = l.current, s = t === "top" || t === "bottom" ? r * 0.8 : n * 0.8;
261
261
  q(t, s);
262
262
  }
263
- }, gt = (t, e) => {
263
+ }, mt = (t, e) => {
264
264
  u.current && (clearTimeout(u.current), u.current = null), g.current = !0, d.current = 3;
265
265
  let o = 0;
266
266
  H.current = t, i.current[t] = !1, q(t, d.current, !1), h.current = setInterval(() => {
@@ -303,20 +303,20 @@ const St = Z(
303
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
304
  N(r, o), i.current[r] = !1, g.current = !1;
305
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")) {
306
+ }, vt = (t, e, o) => {
307
+ if (!Mt && (Ht(t, o), e === "scroll-on-hover")) {
308
308
  const r = I[t]?.hoverDelay ?? 800;
309
309
  E.current = setTimeout(() => {
310
- gt(t, o);
310
+ mt(t, o);
311
311
  }, r);
312
312
  }
313
- }, vt = (t, e, o) => {
314
- Pt(t, o), e === "scroll-on-hover" && J(t, !0, o);
315
313
  }, bt = (t, e, o) => {
314
+ Pt(t, o), e === "scroll-on-hover" && J(t, !0, o);
315
+ }, yt = (t, e, o) => {
316
316
  e === "scroll-on-click" && (g.current = !1, E.current = setTimeout(() => {
317
- gt(t, o);
317
+ mt(t, o);
318
318
  }, 200));
319
- }, yt = (t, e, o) => {
319
+ }, wt = (t, e, o) => {
320
320
  e === "scroll-on-click" && J(t, !1, o);
321
321
  }, K = () => {
322
322
  if (!l.current) return;
@@ -337,7 +337,7 @@ const St = Z(
337
337
  } catch {
338
338
  }
339
339
  }
340
- K(), st.current || (st.current = !0, requestAnimationFrame(() => {
340
+ K(), nt.current || (nt.current = !0, requestAnimationFrame(() => {
341
341
  Object.values(a.current).forEach((r) => {
342
342
  r?.classList.add("transition-all", "duration-300");
343
343
  }), setTimeout(() => {
@@ -345,12 +345,12 @@ const St = Z(
345
345
  }, 0);
346
346
  }));
347
347
  const e = () => {
348
- if (K(), it(), l.current) {
348
+ if (K(), ut(), l.current) {
349
349
  const r = {
350
350
  scrollTop: l.current.scrollTop,
351
351
  scrollLeft: l.current.scrollLeft
352
352
  };
353
- ht(r);
353
+ dt(r);
354
354
  }
355
355
  j && W.current && (P.current && clearTimeout(P.current), P.current = setTimeout(() => {
356
356
  try {
@@ -365,12 +365,12 @@ const St = Z(
365
365
  };
366
366
  t.addEventListener("scroll", e);
367
367
  const o = (r) => {
368
- ot && r.preventDefault();
368
+ st && r.preventDefault();
369
369
  };
370
370
  return t.addEventListener("wheel", o, { passive: !1 }), () => {
371
371
  t.removeEventListener("scroll", e), t.removeEventListener("wheel", o), P.current && clearTimeout(P.current);
372
372
  };
373
- }, [ot, j, O, it, ht]), Vt(() => {
373
+ }, [st, j, O, ut, dt, ot]), Vt(() => {
374
374
  if (!l.current) return;
375
375
  let t = G(l.current);
376
376
  Object.entries(I).forEach(([e, o]) => {
@@ -388,21 +388,21 @@ const St = Z(
388
388
  }
389
389
  });
390
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: [
391
+ const zt = xt.Children.toArray(ot), At = Object.values(I).some((t) => t?.show && t?.type === "icon");
392
+ return /* @__PURE__ */ b.jsxs("div", { className: L("relative p-0", rt, Lt({ axis: y }), "scrolleable", At ? "overflow-visible" : "overflow-hidden!"), children: [
393
393
  /* @__PURE__ */ b.jsx(
394
394
  "div",
395
395
  {
396
396
  ref: l,
397
397
  className: L(
398
- Mt && "border border-red-900 border-dashed",
398
+ Nt && "border border-red-900 border-dashed",
399
399
  rt,
400
400
  "py-2 relative w-full h-full min-h-full",
401
- St({ axis: y }),
402
- Ft({ hide: nt?.hide, size: nt?.size }),
401
+ Lt({ axis: y }),
402
+ Ft({ hide: lt?.hide, size: lt?.size }),
403
403
  ""
404
404
  ),
405
- children: zt?.map((t) => Tt.cloneElement(t, { className: L(t?.props?.className, "shrink-0! pointer-events-auto") }))
405
+ children: zt?.map((t) => xt.cloneElement(t, { className: L(t?.props?.className, "shrink-0! pointer-events-auto") }))
406
406
  }
407
407
  ),
408
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]) => {
@@ -419,11 +419,11 @@ const St = Z(
419
419
  "ease-in-out z-100",
420
420
  "opacity-0 pointer-events-none"
421
421
  ),
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),
422
+ onClick: () => gt(o, e.behavior, e.type),
423
+ onMouseEnter: () => vt(o, e.behavior, e.type),
424
+ onMouseLeave: () => bt(o, e.behavior, e.type),
425
+ onMouseDown: () => yt(o, e.behavior, e.type),
426
+ onMouseUp: () => wt(o, e.behavior, e.type),
427
427
  children: [
428
428
  /* @__PURE__ */ b.jsx("span", { className: L(Q({ position: o, type: "shadow" }), "shadow-base", e.className) }),
429
429
  /* @__PURE__ */ b.jsx("span", { className: L(Q({ position: o, type: "shadow" }), "shadow-hover opacity-0 transition-opacity duration-300", e.className) })
@@ -442,12 +442,12 @@ const St = Z(
442
442
  a.current[t] = r;
443
443
  },
444
444
  className: "pointer-events-auto cursor-default transition-all duration-300 opacity-0",
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) })
445
+ onClick: () => gt(o, e.behavior, e.type),
446
+ onMouseEnter: () => vt(o, e.behavior, e.type),
447
+ onMouseLeave: () => bt(o, e.behavior, e.type),
448
+ onMouseDown: () => yt(o, e.behavior, e.type),
449
+ onMouseUp: () => wt(o, e.behavior, e.type),
450
+ children: /* @__PURE__ */ b.jsx(St, { size: 20, className: L(Q({ position: o, type: "icon" }), e.className) })
451
451
  },
452
452
  t
453
453
  );
@@ -468,7 +468,7 @@ const St = Z(
468
468
  style: {
469
469
  transition: "all 0.3s ease-in-out"
470
470
  },
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" })
471
+ children: M.icon ? /* @__PURE__ */ b.jsx(M.icon, { size: 20, className: "text-white" }) : /* @__PURE__ */ b.jsx(St, { size: 20, className: "text-white rotate-90" })
472
472
  }
473
473
  )
474
474
  ] });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "4.8.0",
4
+ "version": "4.8.1",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",