prometeo-design-system 2.6.5 → 2.6.7

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,57 +1,100 @@
1
- import { j as s } from "./jsx-runtime-DKDX3adD.js";
2
- import { c as b } from "./cn-B6yFEsav.js";
3
- import { c as y, B as h } from "./Button-DsbEyjth.js";
4
- import { createPortal as g } from "react-dom";
5
- import { Icons as C } from "./Icons.es.js";
6
- import { forwardRef as k, useState as j, useRef as x, useEffect as v, useCallback as l, useImperativeHandle as D } from "react";
7
- const O = k((e, a) => {
8
- const [t, n] = j(e.defaultOpen || !1), o = x(e.onClose), {
9
- modal: c = !1,
10
- children: d,
11
- className: u,
12
- direction: f = "left",
13
- attachToParent: i = !1,
14
- closeOnOverlayClick: p = !1
15
- } = e;
16
- v(() => {
17
- o.current = e.onClose;
18
- }, [e.onClose]);
19
- const r = l(() => {
20
- n(!0);
21
- }, []), m = l(() => {
22
- n(!1), o.current?.();
1
+ import { j as l } from "./jsx-runtime-DKDX3adD.js";
2
+ import { c as h } from "./cn-B6yFEsav.js";
3
+ import { c as k, B as E } from "./Button-DsbEyjth.js";
4
+ import { createPortal as I } from "react-dom";
5
+ import { Icons as V } from "./Icons.es.js";
6
+ import { forwardRef as B, useRef as u, useState as N, useEffect as d, useCallback as f, useImperativeHandle as P } from "react";
7
+ const L = B((t, s) => {
8
+ const o = u(null), [e, a] = N(t.defaultOpen || !1), [r, y] = N(null), b = u(t.onClose), c = u(r), {
9
+ modal: i = !1,
10
+ children: m,
11
+ className: w,
12
+ direction: C = "left",
13
+ attachToParent: x = !1,
14
+ closeOnOverlayClick: n = !1,
15
+ hideCloseButton: T = !1
16
+ } = t, g = u(n), O = u(e);
17
+ c.current = r, d(() => {
18
+ O.current = e;
19
+ }, [e]), d(() => {
20
+ c.current = r;
21
+ }, [r]), d(() => {
22
+ g.current = n;
23
+ }, [n]);
24
+ const R = (p) => {
25
+ if (!o.current)
26
+ return;
27
+ const z = o.current;
28
+ z && !z.contains(p.target) && g.current && O.current && v();
29
+ };
30
+ d(() => {
31
+ if (!g.current || i || !e)
32
+ return;
33
+ const p = setTimeout(() => {
34
+ document.addEventListener("click", R);
35
+ }, 0);
36
+ return () => {
37
+ clearTimeout(p), document.removeEventListener("click", R);
38
+ };
39
+ }, [n, e, i]), d(() => {
40
+ b.current = t.onClose;
41
+ }, [t.onClose]);
42
+ const j = f((p) => {
43
+ y(p ?? null), a(!0);
44
+ }, []), v = f(() => {
45
+ a(!1), b.current?.(c.current), setTimeout(() => y(null), 300);
23
46
  }, []);
24
- D(a, () => ({
25
- open: r,
26
- close: m,
27
- isOpen: t
28
- }), [t, r, m]);
29
- const w = /* @__PURE__ */ s.jsx(
30
- z,
47
+ P(
48
+ s,
49
+ () => ({
50
+ open: j,
51
+ close: v,
52
+ isOpen: e,
53
+ getContext: () => c.current
54
+ }),
55
+ [e, j, v]
56
+ );
57
+ const D = /* @__PURE__ */ l.jsx(
58
+ Y,
31
59
  {
32
- isOpen: t,
33
- close: m,
34
- direction: f,
35
- modal: c,
36
- className: u,
37
- attachToParent: i,
38
- closeOnOverlayClick: p,
39
- children: d
60
+ context: r,
61
+ ref: o,
62
+ isOpen: e,
63
+ close: v,
64
+ direction: C,
65
+ modal: i,
66
+ className: w,
67
+ attachToParent: x,
68
+ closeOnOverlayClick: n,
69
+ hideCloseButton: T,
70
+ children: typeof m == "function" ? m(r) : m
40
71
  }
41
72
  );
42
- return i ? w : g(w, document.body);
73
+ return x ? D : I(D, document.body);
43
74
  });
44
- O.displayName = "DrawerDesktopV2";
45
- const z = ({ children: e, direction: a = "left", isOpen: t, close: n, modal: o = !1, className: c, attachToParent: d = !1, closeOnOverlayClick: u = !1 }) => {
46
- v(() => {
47
- if (t && o) {
48
- const r = window.scrollY;
49
- return document.body.style.position = "fixed", document.body.style.top = `-${r}px`, document.body.style.width = "100%", () => {
50
- document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, r);
75
+ L.displayName = "DrawerDesktopV2";
76
+ const Y = ({
77
+ ref: t,
78
+ children: s,
79
+ direction: o = "left",
80
+ isOpen: e,
81
+ close: a,
82
+ modal: r = !1,
83
+ className: y,
84
+ attachToParent: b = !1,
85
+ closeOnOverlayClick: c = !1,
86
+ hideCloseButton: i = !1,
87
+ context: m
88
+ }) => {
89
+ d(() => {
90
+ if (e && r) {
91
+ const n = window.scrollY;
92
+ return document.body.style.position = "fixed", document.body.style.top = `-${n}px`, document.body.style.width = "100%", () => {
93
+ document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, n);
51
94
  };
52
95
  }
53
- }, [t, o]);
54
- const f = y("border-neutral-strong-default", {
96
+ }, [e, r]);
97
+ const w = k("border-neutral-strong-default", {
55
98
  variants: {
56
99
  isOpen: {
57
100
  true: "desktop-drawer-visible",
@@ -62,14 +105,17 @@ const z = ({ children: e, direction: a = "left", isOpen: t, close: n, modal: o =
62
105
  right: "right-0 border-l-[1px] border-r-0"
63
106
  }
64
107
  }
65
- }), i = y("fixed inset-0 bg-black/60 z-[55] cursor-default", {
66
- variants: {
67
- isOpen: {
68
- true: "drawer-overlay-visible",
69
- false: "drawer-overlay-hidden"
108
+ }), C = k(
109
+ "fixed inset-0 bg-black/60 z-[55] cursor-default",
110
+ {
111
+ variants: {
112
+ isOpen: {
113
+ true: "drawer-overlay-visible",
114
+ false: "drawer-overlay-hidden"
115
+ }
70
116
  }
71
117
  }
72
- }), p = y("", {
118
+ ), x = k("", {
73
119
  variants: {
74
120
  direction: {
75
121
  left: "right-0",
@@ -77,66 +123,69 @@ const z = ({ children: e, direction: a = "left", isOpen: t, close: n, modal: o =
77
123
  }
78
124
  }
79
125
  });
80
- return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
81
- o && /* @__PURE__ */ s.jsx(
126
+ return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
127
+ r && /* @__PURE__ */ l.jsx(
82
128
  "div",
83
129
  {
84
- className: b(i({ isOpen: t })),
85
- onClick: (r) => {
86
- r.preventDefault(), r.stopPropagation(), u && n();
130
+ className: h(C({ isOpen: e })),
131
+ onClick: (n) => {
132
+ n.preventDefault(), n.stopPropagation(), c && a();
87
133
  },
88
134
  "aria-hidden": "true"
89
135
  }
90
136
  ),
91
- /* @__PURE__ */ s.jsxs(
137
+ /* @__PURE__ */ l.jsxs(
92
138
  "div",
93
139
  {
94
- className: b(
95
- "bg-neutral-strong-default p-4 pt-10 h-full top-0 z-60 w-max overflow-y-auto",
96
- d ? "absolute" : "fixed",
97
- f({ isOpen: t, direction: a }),
98
- c
140
+ ref: t,
141
+ className: h(
142
+ "bg-neutral-strong-default h-full top-0 z-60 w-max overflow-y-auto",
143
+ b ? "absolute" : "fixed",
144
+ w({ isOpen: e, direction: o }),
145
+ !i && "p-4 pt-10",
146
+ y
99
147
  ),
100
148
  role: "dialog",
101
- "aria-modal": o,
149
+ "aria-modal": r,
102
150
  children: [
103
- /* @__PURE__ */ s.jsx(
104
- h,
151
+ !i && /* @__PURE__ */ l.jsx(
152
+ E,
105
153
  {
106
- icon: /* @__PURE__ */ s.jsx(C.Close, { size: 24 }),
154
+ icon: /* @__PURE__ */ l.jsx(V.Close, { size: 24 }),
107
155
  animate: !1,
108
156
  type: "button",
109
157
  size: "small",
110
158
  variant: "text",
111
- onClick: n,
159
+ onClick: a,
112
160
  label: "",
113
161
  color: "secondary",
114
- className: b(
162
+ className: h(
115
163
  "absolute top-0 z-50",
116
- p({ direction: a })
164
+ x({ direction: o })
117
165
  ),
118
166
  "aria-label": "Close drawer"
119
167
  }
120
168
  ),
121
- e
169
+ typeof s == "function" ? s(m) : s
122
170
  ]
123
171
  }
124
172
  )
125
173
  ] });
126
- }, E = () => {
127
- const e = x(null), a = l(() => {
128
- e.current?.open();
129
- }, []), t = l(() => {
130
- e.current?.close();
131
- }, []);
174
+ }, G = () => {
175
+ const t = u(null), s = f((r) => {
176
+ t.current?.open(r);
177
+ }, []), o = f(() => {
178
+ t.current?.close();
179
+ }, []), e = f(() => t.current?.isOpen ?? !1, []), a = f(() => t.current?.getContext() ?? null, []);
132
180
  return {
133
- isOpen: l(() => e.current?.isOpen ?? !1, []),
134
- open: a,
135
- close: t,
136
- drawerRef: e
181
+ isOpen: e,
182
+ open: s,
183
+ close: o,
184
+ drawerRef: t,
185
+ getContext: a
137
186
  };
138
187
  };
139
188
  export {
140
- O as default,
141
- E as useDrawerDesktop
189
+ L as default,
190
+ G as useDrawerDesktop
142
191
  };
package/dist/Header.es.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { j as l } from "./jsx-runtime-DKDX3adD.js";
2
- import { c as s } from "./cn-B6yFEsav.js";
3
- import { motion as m } from "framer-motion";
4
- import { memo as n } from "react";
5
- const r = ({ title: e, subtitle: t, children: a, className: i }) => /* @__PURE__ */ l.jsx(
2
+ import { c as i } from "./cn-B6yFEsav.js";
3
+ import { motion as n } from "framer-motion";
4
+ import { memo as r } from "react";
5
+ const x = ({ title: e, subtitle: t, children: a, className: s, subtitleClassName: m }) => /* @__PURE__ */ l.jsx(
6
6
  "header",
7
7
  {
8
- className: s(
8
+ className: i(
9
9
  "h-16 flex items-center px-4 sm:h-20 md:h-24 md:px-6 lg:h-28 xl:h-32 2xl:h-36",
10
- i
10
+ s
11
11
  ),
12
12
  children: /* @__PURE__ */ l.jsxs(
13
- m.div,
13
+ n.div,
14
14
  {
15
15
  initial: { opacity: 0, y: -10 },
16
16
  animate: { opacity: 1, y: 0 },
@@ -18,7 +18,7 @@ const r = ({ title: e, subtitle: t, children: a, className: i }) => /* @__PURE__
18
18
  className: "flex justify-between items-center w-full",
19
19
  children: [
20
20
  /* @__PURE__ */ l.jsxs("div", { className: "flex flex-col leading-6", children: [
21
- t && /* @__PURE__ */ l.jsx("h3", { className: "text-xs font-semibold text-neutral-medium-default leading-1 sm:leading-2 prometeo-fonts-headline-large", children: t }),
21
+ t && /* @__PURE__ */ l.jsx("h3", { className: i("text-xs font-semibold text-neutral-medium-default leading-1 sm:leading-2 prometeo-fonts-headline-large ", m), children: t }),
22
22
  e && /* @__PURE__ */ l.jsx("h1", { className: "text-xl font-bold text-neutral-strong-default sm:text-2xl md:text-3xl xl:text-[32px] 2xl:text-[34px]", children: e })
23
23
  ] }),
24
24
  a && /* @__PURE__ */ l.jsx("div", { className: "flex gap-4", children: a })
@@ -26,7 +26,7 @@ const r = ({ title: e, subtitle: t, children: a, className: i }) => /* @__PURE__
26
26
  }
27
27
  )
28
28
  }
29
- ), o = n(r, (e, t) => e.title !== t.title || e.subtitle !== t.subtitle || e.className !== t.className ? !1 : e.children !== t.children ? !e.children && !t.children : !0);
29
+ ), u = r(x, (e, t) => e.title !== t.title || e.subtitle !== t.subtitle || e.className !== t.className ? !1 : e.children !== t.children ? !e.children && !t.children : !0);
30
30
  export {
31
- o as default
31
+ u as default
32
32
  };
@@ -118,7 +118,7 @@ function O({
118
118
  {
119
119
  ref: u,
120
120
  className: l(
121
- "absolute bg-primary-default-default rounded-lg border-[2px] hover:bg-primary-default-hover cursor-pointer grid place-content-center",
121
+ "absolute bg-primary-default-default rounded-lg border-2 hover:bg-primary-default-hover cursor-pointer grid place-content-center",
122
122
  H[i],
123
123
  z[i],
124
124
  o && "opacity-50 cursor-not-allowed"
@@ -1,27 +1,42 @@
1
1
  import { j as e } from "./jsx-runtime-DKDX3adD.js";
2
- import { c as x } from "./cn-B6yFEsav.js";
3
- import u from "react";
4
- const j = u.forwardRef(
5
- ({ className: r, endDate: n, label: l, ...d }, i) => {
6
- const t = new Date(n), s = /* @__PURE__ */ new Date(), o = 1440 * 60 * 1e3, m = Math.max(0, Math.ceil((t.getTime() - s.getTime()) / o)), a = s > t, c = l || `Faltan ${m} días`;
7
- return /* @__PURE__ */ e.jsxs("div", { ref: i, className: r, ...d, children: [
8
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center mb-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
9
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-neutral-medium-default", children: "Tiempo restante" }),
10
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-base text-neutral-default-default", children: c })
11
- ] }) }),
12
- /* @__PURE__ */ e.jsx("div", { className: "w-full border-neutral-strong-default border rounded-sm h-[14px]", children: /* @__PURE__ */ e.jsx(
2
+ import { c as j } from "./cn-B6yFEsav.js";
3
+ import v from "react";
4
+ const V = v.forwardRef(
5
+ ({
6
+ className: u,
7
+ startDate: h,
8
+ endDate: x,
9
+ label: o,
10
+ ...g
11
+ }, p) => {
12
+ const d = new Date(h), a = new Date(x), s = /* @__PURE__ */ new Date(), c = a.getTime() - d.getTime(), m = s.getTime() - d.getTime(), y = Math.min(100, Math.max(0, m / c * 100)), n = 1440 * 60 * 1e3, l = Math.max(0, Math.ceil((a.getTime() - s.getTime()) / n)), i = Math.floor((s.getTime() - a.getTime()) / n), f = Math.ceil(c / n), T = Math.min(f, Math.max(0, Math.floor(m / n))), r = s > a, w = l === 0 && !r, b = r && i === 0;
13
+ let t = o;
14
+ return o || (r ? i === 0 ? t = "Vence hoy" : i === 1 ? t = "Vencido hace 1 día" : t = `Vencido hace ${i} días` : l === 0 ? t = "Vence hoy" : l === 1 ? t = "Falta 1 día" : t = `Faltan ${l} días`), /* @__PURE__ */ e.jsxs("div", { ref: p, className: u, ...g, children: [
15
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-end mb-2 gap-4 px-2", children: [
16
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
17
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-neutral-medium-default", children: "Tiempo restante de resolución" }),
18
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-base text-neutral-default-default", children: t })
19
+ ] }),
20
+ /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-neutral-medium-default whitespace-nowrap", children: [
21
+ T,
22
+ " / ",
23
+ f,
24
+ " días"
25
+ ] })
26
+ ] }),
27
+ /* @__PURE__ */ e.jsx("div", { className: "w-full bg-neutral-800 dark:bg-neutral-900 border border-neutral-600 dark:border-neutral-700 rounded-sm h-4 overflow-hidden", children: /* @__PURE__ */ e.jsx(
13
28
  "div",
14
29
  {
15
- className: x(
16
- "h-[14px] rounded-sm transition-all duration-300",
17
- a ? "bg-red-500" : "bg-primary-default-default"
30
+ className: j(
31
+ "h-full transition-all duration-300",
32
+ w || b ? "bg-yellow-500" : r ? "bg-red-500" : "bg-primary-default-default"
18
33
  ),
19
- style: { width: `${a ? 100 : 0}%` }
34
+ style: { width: `${y}%` }
20
35
  }
21
36
  ) })
22
37
  ] });
23
38
  }
24
39
  );
25
40
  export {
26
- j as default
41
+ V as default
27
42
  };