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 +147 -71
- package/dist/exports/Toast.d.ts +1 -1
- package/package.json +1 -1
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
|
|
3
|
-
import P, { useRef as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { Info as
|
|
6
|
-
import { Error as
|
|
7
|
-
import { Cancel as
|
|
8
|
-
import { CheckCircle as
|
|
9
|
-
import
|
|
10
|
-
import { Close as
|
|
11
|
-
const
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
60
|
+
icon: k,
|
|
61
61
|
loading: "bg-primary-default-pressed"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
},
|
|
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
|
-
},
|
|
78
|
-
const { title:
|
|
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:
|
|
83
|
+
boxShadow: v[e].shadow
|
|
84
84
|
},
|
|
85
|
-
className:
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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(
|
|
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:
|
|
101
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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:
|
|
110
|
+
label: s?.label,
|
|
111
111
|
onClick: () => {
|
|
112
|
-
|
|
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
|
-
|
|
119
|
+
I,
|
|
120
120
|
{
|
|
121
121
|
onClick: () => {
|
|
122
|
-
|
|
122
|
+
w.dismiss(c);
|
|
123
123
|
},
|
|
124
124
|
label: "",
|
|
125
125
|
size: "small",
|
|
126
126
|
color: "secondary",
|
|
127
|
-
icon: /* @__PURE__ */ t.jsx(
|
|
127
|
+
icon: /* @__PURE__ */ t.jsx(R, { className: p(e === "light" ? "text-neutral-medium-focused " : "") }),
|
|
128
128
|
variant: "text",
|
|
129
129
|
animate: !1,
|
|
130
|
-
className:
|
|
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
|
-
},
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
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(),
|
|
144
|
-
const
|
|
145
|
-
const g = Date.now() - o.current,
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
148
|
-
|
|
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
|
|
151
|
-
|
|
150
|
+
const x = (Math.random() - 0.5) * 0.25;
|
|
151
|
+
i = Math.max(a.current, Math.min(0.95, b + x));
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
a.current = i, e.current && (e.current.style.width = `${i * 100}%`), (f >= 1 || s) && clearInterval(u);
|
|
154
154
|
}, 50);
|
|
155
|
-
return () => clearInterval(
|
|
156
|
-
}, [
|
|
157
|
-
const m =
|
|
158
|
-
return /* @__PURE__ */ t.jsx("div", { className:
|
|
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:
|
|
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
|
|
172
|
-
const { duration:
|
|
173
|
-
return
|
|
174
|
-
|
|
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:
|
|
177
|
+
variant: n?.variant || "success",
|
|
178
178
|
title: d,
|
|
179
|
-
description:
|
|
180
|
-
icon:
|
|
181
|
-
button:
|
|
182
|
-
showClose:
|
|
183
|
-
colorMode:
|
|
179
|
+
description: n?.description,
|
|
180
|
+
icon: n?.icon,
|
|
181
|
+
button: n?.button,
|
|
182
|
+
showClose: s,
|
|
183
|
+
colorMode: c
|
|
184
184
|
}
|
|
185
185
|
), {
|
|
186
|
-
duration:
|
|
187
|
-
position:
|
|
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
|
-
|
|
193
|
-
G as
|
|
267
|
+
j as default,
|
|
268
|
+
G as toastPyrionPromise,
|
|
269
|
+
F as toastpyrion
|
|
194
270
|
};
|
package/dist/exports/Toast.d.ts
CHANGED
|
@@ -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';
|