prometeo-design-system 4.3.5 → 4.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Toast.es.js CHANGED
@@ -1,37 +1,37 @@
1
1
  import { j as t } from "./jsx-runtime-GkKLlHH4.js";
2
- import { c as l } from "./cn-B6yFEsav.js";
3
- import P, { useRef as b, useEffect as I } from "react";
4
- import { toast as h } from "sonner";
5
- import { Info as w } from "./Icons/Info.es.js";
6
- import { Error as v } from "./Icons/Error.es.js";
7
- import { Cancel as y } from "./Icons/Cancel.es.js";
8
- import { CheckCircle as j } from "./Icons/CheckCircle.es.js";
9
- import C from "./Button.es.js";
10
- import { Close as E } from "./Icons/Close.es.js";
11
- const p = {
2
+ import { c as p } from "./cn-B6yFEsav.js";
3
+ import P, { useRef as C, useEffect as E } from "react";
4
+ import { toast as w } from "sonner";
5
+ import { Info as k } from "./Icons/Info.es.js";
6
+ import { Error as N } from "./Icons/Error.es.js";
7
+ import { Cancel as T } from "./Icons/Cancel.es.js";
8
+ import { CheckCircle as M } from "./Icons/CheckCircle.es.js";
9
+ import I from "./Button.es.js";
10
+ import { Close as R } from "./Icons/Close.es.js";
11
+ const y = {
12
12
  dark: {
13
13
  success: {
14
14
  container: "border-b-[2px] border-success-default-default",
15
15
  iconClass: "text-success-medium-default",
16
- icon: j,
16
+ icon: M,
17
17
  loading: "bg-success-default-default"
18
18
  },
19
19
  error: {
20
20
  container: "border-b-[2px] border-error-default-default",
21
21
  iconClass: "text-error-medium-default",
22
- icon: y,
22
+ icon: T,
23
23
  loading: "bg-error-default-default"
24
24
  },
25
25
  warning: {
26
26
  container: "border-b-[2px] border-warning-default-default",
27
27
  iconClass: "text-warning-medium-default",
28
- icon: v,
28
+ icon: N,
29
29
  loading: "bg-warning-default-default"
30
30
  },
31
31
  info: {
32
32
  container: " border-b-[2px] border-primary-default-default",
33
33
  iconClass: "text-primary-default-default",
34
- icon: w,
34
+ icon: k,
35
35
  loading: "bg-primary-default-default"
36
36
  }
37
37
  },
@@ -39,29 +39,29 @@ const p = {
39
39
  success: {
40
40
  container: "",
41
41
  iconClass: "text-success-default-pressed",
42
- icon: j,
42
+ icon: M,
43
43
  loading: "bg-success-default-pressed"
44
44
  },
45
45
  error: {
46
46
  container: "",
47
47
  iconClass: "text-error-medium-pressed",
48
- icon: y,
48
+ icon: T,
49
49
  loading: "bg-error-medium-pressed"
50
50
  },
51
51
  warning: {
52
52
  container: "",
53
53
  iconClass: "text-warning-medium-pressed",
54
- icon: v,
54
+ icon: N,
55
55
  loading: "bg-warning-medium-pressed"
56
56
  },
57
57
  info: {
58
58
  container: "",
59
59
  iconClass: "text-primary-default-pressed",
60
- icon: w,
60
+ icon: k,
61
61
  loading: "bg-primary-default-pressed"
62
62
  }
63
63
  }
64
- }, x = {
64
+ }, v = {
65
65
  dark: {
66
66
  container: "bg-neutral-default-default",
67
67
  title: "text-neutral-strong-default",
@@ -74,20 +74,20 @@ const p = {
74
74
  description: "text-neutral-medium-focused",
75
75
  shadow: "0px 0px 2px 0px rgba(0, 0, 0, 0.35),8px 8px 20px 0px rgba(0, 0, 0, 0.3),0px 0px 15px 0px rgba(0, 0, 0, 0.2),0px 0px 20px 0px rgba(21, 21, 21, 0.3) inset,6px 0px 100px 0px rgba(0, 0, 0, 0.05) inset"
76
76
  }
77
- }, T = (d) => {
78
- const { title: r, description: n, button: a, id: i, icon: s, variant: o = "info", colorMode: e = "dark", showClose: m = !1, loading: c = !1, loadingTimeout: g = 2500, finishLoader: u = !1 } = d;
77
+ }, j = (d) => {
78
+ const { title: n, description: l, button: s, id: c, icon: a, variant: o = "info", colorMode: e = "dark", showClose: m = !1, loading: u = !1, loadingTimeout: g = 2500, finishLoader: f = !1 } = d;
79
79
  return /* @__PURE__ */ t.jsxs(
80
80
  "div",
81
81
  {
82
82
  style: {
83
- boxShadow: x[e].shadow
83
+ boxShadow: v[e].shadow
84
84
  },
85
- className: l(
85
+ className: p(
86
86
  "flex p-3 pb-4 md:w-[485px] md:max-w-[485px] md:min-w-[485px] md:h-[68px] md:max-h-[68px] rounded-lg gap-2",
87
87
  "w-[345px] max-w-[345px] min-w-[345px] h-[68px] max-h-[68px] relative",
88
- x[e].container,
89
- p[e][o].container,
90
- c && "border-b-0"
88
+ v[e].container,
89
+ y[e][o].container,
90
+ u && "border-b-0"
91
91
  ),
92
92
  children: [
93
93
  /* @__PURE__ */ t.jsxs(
@@ -95,67 +95,67 @@ const p = {
95
95
  {
96
96
  className: "flex items-center justify-start gap-2 max-h-[38px] h-[38px] overflow-hidden flex-1 ",
97
97
  children: [
98
- /* @__PURE__ */ t.jsx("div", { className: "f", style: { color: "inherit" }, children: P.createElement(s || p[e][o].icon, { size: 24, className: p[e][o].iconClass }) }),
98
+ /* @__PURE__ */ t.jsx("div", { className: "f", style: { color: "inherit" }, children: P.createElement(a || y[e][o].icon, { size: 24, className: y[e][o].iconClass }) }),
99
99
  /* @__PURE__ */ t.jsxs("div", { className: "flex-1 flex flex-col gap-1", children: [
100
- /* @__PURE__ */ t.jsx("p", { className: l("select-none prometeo-fonts-label-medium md:prometeo-fonts-label-xlarge", x[e].title), children: r }),
101
- n && /* @__PURE__ */ t.jsx("p", { className: l("select-none prometeo-fonts-body-xsmall md:prometeo-fonts-body-small text-nowrap overflow-ellipsis ", x[e].description), children: n })
100
+ /* @__PURE__ */ t.jsx("p", { className: p("select-none prometeo-fonts-label-medium md:prometeo-fonts-label-xlarge", v[e].title), children: n }),
101
+ l && /* @__PURE__ */ t.jsx("p", { className: p("select-none prometeo-fonts-body-xsmall md:prometeo-fonts-body-small text-nowrap overflow-ellipsis ", v[e].description), children: l })
102
102
  ] })
103
103
  ]
104
104
  }
105
105
  ),
106
- c && /* @__PURE__ */ t.jsx(z, { color: o, timeOut: g, finished: u, colorMode: e }),
107
- a?.label && /* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
108
- C,
106
+ u && /* @__PURE__ */ t.jsx(L, { color: o, timeOut: g, finished: f, colorMode: e }),
107
+ s?.label && /* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
108
+ I,
109
109
  {
110
- label: a?.label,
110
+ label: s?.label,
111
111
  onClick: () => {
112
- a?.onClick(), h.dismiss(i);
112
+ s?.onClick(), w.dismiss(c);
113
113
  },
114
114
  size: "small",
115
115
  color: "secondary"
116
116
  }
117
117
  ) }),
118
118
  m && /* @__PURE__ */ t.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ t.jsx(
119
- C,
119
+ I,
120
120
  {
121
121
  onClick: () => {
122
- h.dismiss(i);
122
+ w.dismiss(c);
123
123
  },
124
124
  label: "",
125
125
  size: "small",
126
126
  color: "secondary",
127
- icon: /* @__PURE__ */ t.jsx(E, { className: l(e === "light" ? "text-neutral-medium-focused " : "") }),
127
+ icon: /* @__PURE__ */ t.jsx(R, { className: p(e === "light" ? "text-neutral-medium-focused " : "") }),
128
128
  variant: "text",
129
129
  animate: !1,
130
- className: l(e === "light" ? "hover:bg-neutral-default-hover-light focus:bg-inherit active:bg-neutral-weak-hover " : "")
130
+ className: p(e === "light" ? "hover:bg-neutral-default-hover-light focus:bg-inherit active:bg-neutral-weak-hover " : "")
131
131
  }
132
132
  ) })
133
133
  ]
134
134
  }
135
135
  );
136
- }, z = ({ className: d, color: r, timeOut: n, finished: a, colorMode: i }) => {
137
- const s = b(0), o = b(Date.now()), e = b(null);
138
- I(() => {
139
- if (a) {
140
- s.current = 1, e.current && (e.current.style.width = "100%");
136
+ }, L = ({ className: d, color: n, timeOut: l, finished: s, colorMode: c }) => {
137
+ const a = C(0), o = C(Date.now()), e = C(null);
138
+ E(() => {
139
+ if (s) {
140
+ a.current = 1, e.current && (e.current.style.width = "100%");
141
141
  return;
142
142
  }
143
- o.current = Date.now(), s.current = 0;
144
- const c = setInterval(() => {
145
- const g = Date.now() - o.current, u = Math.min(g / n, 1), N = u * 0.95, k = Math.sin(u * Math.PI * 2) * 0.15 + 0.05, M = Math.random() < k;
146
- let f;
147
- if (M)
148
- f = s.current;
143
+ o.current = Date.now(), a.current = 0;
144
+ const u = setInterval(() => {
145
+ const g = Date.now() - o.current, f = Math.min(g / l, 1), b = f * 0.95, h = Math.sin(f * Math.PI * 2) * 0.15 + 0.05, r = Math.random() < h;
146
+ let i;
147
+ if (r)
148
+ i = a.current;
149
149
  else {
150
- const R = (Math.random() - 0.5) * 0.25;
151
- f = Math.max(s.current, Math.min(0.95, N + R));
150
+ const x = (Math.random() - 0.5) * 0.25;
151
+ i = Math.max(a.current, Math.min(0.95, b + x));
152
152
  }
153
- s.current = f, e.current && (e.current.style.width = `${f * 100}%`), (u >= 1 || a) && clearInterval(c);
153
+ a.current = i, e.current && (e.current.style.width = `${i * 100}%`), (f >= 1 || s) && clearInterval(u);
154
154
  }, 50);
155
- return () => clearInterval(c);
156
- }, [n, a]);
157
- const m = p[i][r].loading;
158
- return /* @__PURE__ */ t.jsx("div", { className: l(
155
+ return () => clearInterval(u);
156
+ }, [l, s]);
157
+ const m = y[c][n].loading;
158
+ return /* @__PURE__ */ t.jsx("div", { className: p(
159
159
  "absolute bottom-0 translate-y-0 left-0 w-full h-2 overflow-hidden rounded-b-xl",
160
160
  'after:content-[""] after:w-[calc(100%-0px)] after:absolute after:bottom-0 after:left-1/2 after:bg-neutral-default-default after:h-2 after:-translate-x-1/2 after:-translate-y-[2px] after:rounded-b-full after:overflow-hidden',
161
161
  d
@@ -163,32 +163,108 @@ const p = {
163
163
  "div",
164
164
  {
165
165
  ref: e,
166
- className: l("h-full transition-all duration-300 ease-out", m),
166
+ className: p("h-full transition-all duration-300 ease-out", m),
167
167
  style: { width: "0%" }
168
168
  }
169
169
  ) });
170
170
  };
171
- function G(d, r) {
172
- const { duration: n = 2500, showClose: a = !1, colorMode: i = "dark", position: s } = r || {};
173
- return h.custom((o) => /* @__PURE__ */ t.jsx(
174
- T,
171
+ function F(d, n) {
172
+ const { duration: l = 2500, showClose: s = !1, colorMode: c = "dark", position: a } = n || {};
173
+ return w.custom((o) => /* @__PURE__ */ t.jsx(
174
+ j,
175
175
  {
176
176
  id: o,
177
- variant: r?.variant || "success",
177
+ variant: n?.variant || "success",
178
178
  title: d,
179
- description: r?.description,
180
- icon: r?.icon,
181
- button: r?.button,
182
- showClose: a,
183
- colorMode: i
179
+ description: n?.description,
180
+ icon: n?.icon,
181
+ button: n?.button,
182
+ showClose: s,
183
+ colorMode: c
184
184
  }
185
185
  ), {
186
- duration: n,
187
- position: s,
186
+ duration: l,
187
+ position: a,
188
188
  unstyled: !0
189
189
  });
190
190
  }
191
+ const G = (d, n = {}) => {
192
+ const {
193
+ loading: l,
194
+ success: s,
195
+ error: c,
196
+ colorMode: a = "dark",
197
+ position: o,
198
+ timeOut: e = 5e3
199
+ } = n, m = { title: "Cargando...", variant: "info", ...l }, u = { variant: "success", showClose: !0, ...s }, g = { variant: "error", showClose: !0, ...c };
200
+ let f, b = !1;
201
+ const h = (r) => {
202
+ w.custom((i) => /* @__PURE__ */ t.jsx(
203
+ j,
204
+ {
205
+ id: i,
206
+ ...r,
207
+ colorMode: a
208
+ }
209
+ ), {
210
+ id: f,
211
+ // Usar el mismo id para reemplazar
212
+ duration: r.duration || 1 / 0,
213
+ position: o,
214
+ unstyled: !0
215
+ });
216
+ };
217
+ return f = w.custom((r) => /* @__PURE__ */ t.jsx(
218
+ j,
219
+ {
220
+ id: r,
221
+ loadingTimeout: e,
222
+ loading: !0,
223
+ ...m,
224
+ colorMode: a
225
+ }
226
+ ), {
227
+ duration: 1 / 0,
228
+ position: o,
229
+ unstyled: !0
230
+ }), d.then((r) => {
231
+ if (b) return;
232
+ b = !0, console.log(r, "-----promise result", typeof r);
233
+ const i = u.title || (typeof r == "string" ? r : "Operación completada con éxito!"), x = { ...u, title: i };
234
+ return h({
235
+ ...m,
236
+ loadingTimeout: e,
237
+ loading: !0,
238
+ finishLoader: !0,
239
+ variant: "info",
240
+ duration: 1e3
241
+ }), setTimeout(() => {
242
+ h({
243
+ ...x,
244
+ duration: x.duration || 2500
245
+ });
246
+ }, 500), r;
247
+ }).catch((r) => {
248
+ if (b) return;
249
+ b = !0;
250
+ const i = g.title || (typeof r == "string" ? r : r.message || "Error!"), x = { ...g, title: i };
251
+ h({
252
+ ...m,
253
+ loadingTimeout: e,
254
+ loading: !0,
255
+ finishLoader: !0,
256
+ variant: "info",
257
+ duration: 1e3
258
+ }), setTimeout(() => {
259
+ h({
260
+ ...x,
261
+ duration: x.duration || 2500
262
+ });
263
+ }, 500);
264
+ }), d;
265
+ };
191
266
  export {
192
- T as default,
193
- G as toastpyrion
267
+ j as default,
268
+ G as toastPyrionPromise,
269
+ F as toastpyrion
194
270
  };
@@ -1,3 +1,3 @@
1
1
  export { default } from '../components/Toaster/Toaster';
2
2
  export type { PyrionToastProps } from '../components/Toaster/Toaster';
3
- export { toastpyrion } from '../components/Toaster/Toaster';
3
+ export { toastpyrion, toastPyrionPromise } from '../components/Toaster/Toaster';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "4.3.5",
4
+ "version": "4.3.6",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",