welcome-ui 0.0.0-dev.1763744022817 → 0.0.0-dev.1763745462389
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.js +132 -114
- package/package.json +1 -1
package/dist/Toast.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './Toast.css';
|
|
3
|
-
import { jsxs as
|
|
3
|
+
import { jsxs as k, jsx as y, Fragment as B } from "react/jsx-runtime";
|
|
4
4
|
import * as f from "react";
|
|
5
|
-
import { useRef as Y, useCallback as j, useEffect as
|
|
5
|
+
import { useRef as Y, useCallback as j, useEffect as S, useState as fe, forwardRef as Z, cloneElement as ge } from "react";
|
|
6
6
|
import { c as L } from "./index-PAaZGbyz.js";
|
|
7
7
|
import { Button as K } from "./Button.js";
|
|
8
8
|
import { CloseButton as Q } from "./CloseButton.js";
|
|
@@ -25,21 +25,21 @@ let ye = { data: "" }, be = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
25
25
|
return e;
|
|
26
26
|
}, xe = (e, t, a, s, i) => {
|
|
27
27
|
let o = X(e), r = v[o] || (v[o] = ((l) => {
|
|
28
|
-
let
|
|
29
|
-
for (;
|
|
28
|
+
let p = 0, c = 11;
|
|
29
|
+
for (; p < l.length; ) c = 101 * c + l.charCodeAt(p++) >>> 0;
|
|
30
30
|
return "go" + c;
|
|
31
31
|
})(o));
|
|
32
32
|
if (!v[r]) {
|
|
33
|
-
let l = o !== e ? e : ((
|
|
33
|
+
let l = o !== e ? e : ((p) => {
|
|
34
34
|
let c, d, u = [{}];
|
|
35
|
-
for (; c = he.exec(
|
|
35
|
+
for (; c = he.exec(p.replace(ve, "")); ) c[4] ? u.shift() : c[3] ? (d = c[3].replace(W, " ").trim(), u.unshift(u[0][d] = u[0][d] || {})) : u[0][c[1]] = c[2].replace(W, " ").trim();
|
|
36
36
|
return u[0];
|
|
37
37
|
})(e);
|
|
38
38
|
v[r] = w(i ? { ["@keyframes " + r]: l } : l, a ? "" : "." + r);
|
|
39
39
|
}
|
|
40
40
|
let n = a && v.g ? v.g : null;
|
|
41
|
-
return a && (v.g = v[r]), ((l,
|
|
42
|
-
d ?
|
|
41
|
+
return a && (v.g = v[r]), ((l, p, c, d) => {
|
|
42
|
+
d ? p.data = p.data.replace(d, l) : p.data.indexOf(l) === -1 && (p.data = c ? l + p.data : p.data + l);
|
|
43
43
|
})(v[r], t, s, n), r;
|
|
44
44
|
}, we = (e, t, a) => e.reduce((s, i, o) => {
|
|
45
45
|
let r = t[o];
|
|
@@ -66,8 +66,8 @@ function _(e, t) {
|
|
|
66
66
|
function i(o, r) {
|
|
67
67
|
let n = Object.assign({}, o), l = n.className || i.className;
|
|
68
68
|
a.p = Object.assign({ theme: R && R() }, n), a.o = / *go\d+/.test(l), n.className = A.apply(a, s) + (l ? " " + l : "");
|
|
69
|
-
let
|
|
70
|
-
return e[0] && (
|
|
69
|
+
let p = e;
|
|
70
|
+
return e[0] && (p = n.as || e, delete n.as), F && p[0] && F(n), ee(p, n);
|
|
71
71
|
}
|
|
72
72
|
return i;
|
|
73
73
|
};
|
|
@@ -84,7 +84,7 @@ var Ne = (e) => typeof e == "function", D = (e, t) => Ne(e) ? e(t) : e, je = /*
|
|
|
84
84
|
}
|
|
85
85
|
return e;
|
|
86
86
|
};
|
|
87
|
-
})(),
|
|
87
|
+
})(), ke = 20, M = "default", ae = (e, t) => {
|
|
88
88
|
let { toastLimit: a } = e.settings;
|
|
89
89
|
switch (t.type) {
|
|
90
90
|
case 0:
|
|
@@ -105,49 +105,49 @@ var Ne = (e) => typeof e == "function", D = (e, t) => Ne(e) ? e(t) : e, je = /*
|
|
|
105
105
|
let o = t.time - (e.pausedAt || 0);
|
|
106
106
|
return { ...e, pausedAt: void 0, toasts: e.toasts.map((r) => ({ ...r, pauseDuration: r.pauseDuration + o })) };
|
|
107
107
|
}
|
|
108
|
-
}, O = [], re = { toasts: [], pausedAt: void 0, settings: { toastLimit:
|
|
108
|
+
}, O = [], re = { toasts: [], pausedAt: void 0, settings: { toastLimit: ke } }, h = {}, se = (e, t = M) => {
|
|
109
109
|
h[t] = ae(h[t] || re, e), O.forEach(([a, s]) => {
|
|
110
110
|
a === t && s(h[t]);
|
|
111
111
|
});
|
|
112
|
-
}, oe = (e) => Object.keys(h).forEach((t) => se(e, t)),
|
|
112
|
+
}, oe = (e) => Object.keys(h).forEach((t) => se(e, t)), ze = (e) => Object.keys(h).find((t) => h[t].toasts.some((a) => a.id === e)), q = (e = M) => (t) => {
|
|
113
113
|
se(t, e);
|
|
114
114
|
}, $e = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, Ee = (e = {}, t = M) => {
|
|
115
115
|
let [a, s] = fe(h[t] || re), i = Y(h[t]);
|
|
116
|
-
|
|
116
|
+
S(() => (i.current !== h[t] && s(h[t]), O.push([t, s]), () => {
|
|
117
117
|
let r = O.findIndex(([n]) => n === t);
|
|
118
118
|
r > -1 && O.splice(r, 1);
|
|
119
119
|
}), [t]);
|
|
120
120
|
let o = a.toasts.map((r) => {
|
|
121
|
-
var n, l,
|
|
122
|
-
return { ...e, ...e[r.type], ...r, removeDelay: r.removeDelay || ((n = e[r.type]) == null ? void 0 : n.removeDelay) || (e == null ? void 0 : e.removeDelay), duration: r.duration || ((l = e[r.type]) == null ? void 0 : l.duration) || (e == null ? void 0 : e.duration) || $e[r.type], style: { ...e.style, ...(
|
|
121
|
+
var n, l, p;
|
|
122
|
+
return { ...e, ...e[r.type], ...r, removeDelay: r.removeDelay || ((n = e[r.type]) == null ? void 0 : n.removeDelay) || (e == null ? void 0 : e.removeDelay), duration: r.duration || ((l = e[r.type]) == null ? void 0 : l.duration) || (e == null ? void 0 : e.duration) || $e[r.type], style: { ...e.style, ...(p = e[r.type]) == null ? void 0 : p.style, ...r.style } };
|
|
123
123
|
});
|
|
124
124
|
return { ...a, toasts: o };
|
|
125
125
|
}, Te = (e, t = "blank", a) => ({ createdAt: Date.now(), visible: !0, dismissed: !1, type: t, ariaProps: { role: "status", "aria-live": "polite" }, message: e, pauseDuration: 0, ...a, id: (a == null ? void 0 : a.id) || je() }), $ = (e) => (t, a) => {
|
|
126
126
|
let s = Te(t, e, a);
|
|
127
|
-
return q(s.toasterId ||
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
return q(s.toasterId || ze(s.id))({ type: 2, toast: s }), s.id;
|
|
128
|
+
}, m = (e, t) => $("blank")(e, t);
|
|
129
|
+
m.error = $("error");
|
|
130
|
+
m.success = $("success");
|
|
131
|
+
m.loading = $("loading");
|
|
132
|
+
m.custom = $("custom");
|
|
133
|
+
m.dismiss = (e, t) => {
|
|
134
134
|
let a = { type: 3, toastId: e };
|
|
135
135
|
t ? q(t)(a) : oe(a);
|
|
136
136
|
};
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
m.dismissAll = (e) => m.dismiss(void 0, e);
|
|
138
|
+
m.remove = (e, t) => {
|
|
139
139
|
let a = { type: 4, toastId: e };
|
|
140
140
|
t ? q(t)(a) : oe(a);
|
|
141
141
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
let s =
|
|
142
|
+
m.removeAll = (e) => m.remove(void 0, e);
|
|
143
|
+
m.promise = (e, t, a) => {
|
|
144
|
+
let s = m.loading(t.loading, { ...a, ...a == null ? void 0 : a.loading });
|
|
145
145
|
return typeof e == "function" && (e = e()), e.then((i) => {
|
|
146
146
|
let o = t.success ? D(t.success, i) : void 0;
|
|
147
|
-
return o ?
|
|
147
|
+
return o ? m.success(o, { id: s, ...a, ...a == null ? void 0 : a.success }) : m.dismiss(s), i;
|
|
148
148
|
}).catch((i) => {
|
|
149
149
|
let o = t.error ? D(t.error, i) : void 0;
|
|
150
|
-
o ?
|
|
150
|
+
o ? m.error(o, { id: s, ...a, ...a == null ? void 0 : a.error }) : m.dismiss(s);
|
|
151
151
|
}), e;
|
|
152
152
|
};
|
|
153
153
|
var Oe = 1e3, De = (e, t = "default") => {
|
|
@@ -158,16 +158,16 @@ var Oe = 1e3, De = (e, t = "default") => {
|
|
|
158
158
|
}, u);
|
|
159
159
|
i.set(d, g);
|
|
160
160
|
}, []);
|
|
161
|
-
|
|
161
|
+
S(() => {
|
|
162
162
|
if (s) return;
|
|
163
163
|
let d = Date.now(), u = a.map((g) => {
|
|
164
164
|
if (g.duration === 1 / 0) return;
|
|
165
165
|
let E = (g.duration || 0) + g.pauseDuration - (d - g.createdAt);
|
|
166
166
|
if (E < 0) {
|
|
167
|
-
g.visible &&
|
|
167
|
+
g.visible && m.dismiss(g.id);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
return setTimeout(() =>
|
|
170
|
+
return setTimeout(() => m.dismiss(g.id, t), E);
|
|
171
171
|
});
|
|
172
172
|
return () => {
|
|
173
173
|
u.forEach((g) => g && clearTimeout(g));
|
|
@@ -177,13 +177,13 @@ var Oe = 1e3, De = (e, t = "default") => {
|
|
|
177
177
|
r({ type: 5, time: Date.now() });
|
|
178
178
|
}, [r]), l = j((d, u) => {
|
|
179
179
|
r({ type: 1, toast: { id: d, height: u } });
|
|
180
|
-
}, [r]),
|
|
180
|
+
}, [r]), p = j(() => {
|
|
181
181
|
s && r({ type: 6, time: Date.now() });
|
|
182
182
|
}, [s, r]), c = j((d, u) => {
|
|
183
|
-
let { reverseOrder: g = !1, gutter: E = 8, defaultPosition: G } = u || {}, I = a.filter((b) => (b.position || G) === (d.position || G) && b.height), ue = I.findIndex((b) => b.id === d.id), U = I.filter((b,
|
|
184
|
-
return I.filter((b) => b.visible).slice(...g ? [U + 1] : [0, U]).reduce((b,
|
|
183
|
+
let { reverseOrder: g = !1, gutter: E = 8, defaultPosition: G } = u || {}, I = a.filter((b) => (b.position || G) === (d.position || G) && b.height), ue = I.findIndex((b) => b.id === d.id), U = I.filter((b, P) => P < ue && b.visible).length;
|
|
184
|
+
return I.filter((b) => b.visible).slice(...g ? [U + 1] : [0, U]).reduce((b, P) => b + (P.height || 0) + E, 0);
|
|
185
185
|
}, [a]);
|
|
186
|
-
return
|
|
186
|
+
return S(() => {
|
|
187
187
|
a.forEach((d) => {
|
|
188
188
|
if (d.dismissed) o(d.id, d.removeDelay);
|
|
189
189
|
else {
|
|
@@ -191,7 +191,7 @@ var Oe = 1e3, De = (e, t = "default") => {
|
|
|
191
191
|
u && (clearTimeout(u), i.delete(d.id));
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
-
}, [a, o]), { toasts: a, handlers: { updateHeight: l, startPause: n, endPause:
|
|
194
|
+
}, [a, o]), { toasts: a, handlers: { updateHeight: l, startPause: n, endPause: p, calculateOffset: c } };
|
|
195
195
|
}, Ae = x`
|
|
196
196
|
from {
|
|
197
197
|
transform: scale(0) rotate(45deg);
|
|
@@ -216,7 +216,7 @@ from {
|
|
|
216
216
|
to {
|
|
217
217
|
transform: scale(1) rotate(90deg);
|
|
218
218
|
opacity: 1;
|
|
219
|
-
}`,
|
|
219
|
+
}`, Pe = _("div")`
|
|
220
220
|
width: 20px;
|
|
221
221
|
opacity: 0;
|
|
222
222
|
height: 20px;
|
|
@@ -249,7 +249,7 @@ to {
|
|
|
249
249
|
animation-delay: 180ms;
|
|
250
250
|
transform: rotate(90deg);
|
|
251
251
|
}
|
|
252
|
-
`,
|
|
252
|
+
`, Se = x`
|
|
253
253
|
from {
|
|
254
254
|
transform: rotate(0deg);
|
|
255
255
|
}
|
|
@@ -264,7 +264,7 @@ to {
|
|
|
264
264
|
border-radius: 100%;
|
|
265
265
|
border-color: ${(e) => e.secondary || "#e0e0e0"};
|
|
266
266
|
border-right-color: ${(e) => e.primary || "#616161"};
|
|
267
|
-
animation: ${
|
|
267
|
+
animation: ${Se} 1s linear infinite;
|
|
268
268
|
`, Re = x`
|
|
269
269
|
from {
|
|
270
270
|
transform: scale(0) rotate(45deg);
|
|
@@ -340,7 +340,7 @@ to {
|
|
|
340
340
|
forwards;
|
|
341
341
|
`, We = ({ toast: e }) => {
|
|
342
342
|
let { icon: t, type: a, iconTheme: s } = e;
|
|
343
|
-
return t !== void 0 ? typeof t == "string" ? f.createElement(Ue, null, t) : t : a === "blank" ? null : f.createElement(He, null, f.createElement(Ce, { ...s }), a !== "loading" && f.createElement(Me, null, a === "error" ? f.createElement(
|
|
343
|
+
return t !== void 0 ? typeof t == "string" ? f.createElement(Ue, null, t) : t : a === "blank" ? null : f.createElement(He, null, f.createElement(Ce, { ...s }), a !== "loading" && f.createElement(Me, null, a === "error" ? f.createElement(Pe, { ...s }) : f.createElement(Le, { ...s })));
|
|
344
344
|
}, Be = (e) => `
|
|
345
345
|
0% {transform: translate3d(0,${e * -200}%,0) scale(.6); opacity:.5;}
|
|
346
346
|
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
@@ -394,10 +394,10 @@ var et = ({ id: e, className: t, style: a, onHeightUpdate: s, children: i }) =>
|
|
|
394
394
|
pointer-events: auto;
|
|
395
395
|
}
|
|
396
396
|
`, T = 16, ie = ({ reverseOrder: e, position: t = "top-center", toastOptions: a, gutter: s, children: i, toasterId: o, containerStyle: r, containerClassName: n }) => {
|
|
397
|
-
let { toasts: l, handlers:
|
|
398
|
-
return f.createElement("div", { "data-rht-toaster": o || "", style: { position: "fixed", zIndex: 9999, top: T, left: T, right: T, bottom: T, pointerEvents: "none", ...r }, className: n, onMouseEnter:
|
|
399
|
-
let d = c.position || t, u =
|
|
400
|
-
return f.createElement(et, { id: c.id, key: c.id, onHeightUpdate:
|
|
397
|
+
let { toasts: l, handlers: p } = De(a, o);
|
|
398
|
+
return f.createElement("div", { "data-rht-toaster": o || "", style: { position: "fixed", zIndex: 9999, top: T, left: T, right: T, bottom: T, pointerEvents: "none", ...r }, className: n, onMouseEnter: p.startPause, onMouseLeave: p.endPause }, l.map((c) => {
|
|
399
|
+
let d = c.position || t, u = p.calculateOffset(c, { reverseOrder: e, gutter: s, defaultPosition: t }), g = tt(d, u);
|
|
400
|
+
return f.createElement(et, { id: c.id, key: c.id, onHeightUpdate: p.updateHeight, className: c.visible ? at : "", style: g }, c.type === "custom" ? D(c.message, c) : i ? i(c) : f.createElement(Xe, { toast: c, position: d }));
|
|
401
401
|
}));
|
|
402
402
|
};
|
|
403
403
|
const rt = "_root_q0jyz_2", st = "_icon_q0jyz_17", ot = "_progress_q0jyz_40", it = "_snackbar_q0jyz_63", nt = "_growl_q0jyz_71", lt = "_content_q0jyz_79", ct = "_title_q0jyz_91", H = {
|
|
@@ -427,44 +427,53 @@ const rt = "_root_q0jyz_2", st = "_icon_q0jyz_17", ot = "_progress_q0jyz_40", it
|
|
|
427
427
|
showProgressBar: r = !1,
|
|
428
428
|
title: n,
|
|
429
429
|
variant: l = "info",
|
|
430
|
-
...
|
|
431
|
-
}, c) => /* @__PURE__ */
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
...p
|
|
431
|
+
}, c) => /* @__PURE__ */ k(
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
className: N("root", `variant-${l}`, t),
|
|
435
|
+
onClick: (d) => d.stopPropagation(),
|
|
436
|
+
ref: c,
|
|
437
|
+
...p,
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ k("div", { className: N("growl"), children: [
|
|
440
|
+
l ? /* @__PURE__ */ y(V, { className: N("icon"), name: pe[l], size: "lg" }) : null,
|
|
441
|
+
/* @__PURE__ */ k("div", { className: N("content"), children: [
|
|
442
|
+
/* @__PURE__ */ k("span", { children: [
|
|
443
|
+
/* @__PURE__ */ y(C, { variant: "body-md-strong", children: n }),
|
|
444
|
+
/* @__PURE__ */ y(C, { variant: "body-md", children: e })
|
|
445
|
+
] }),
|
|
446
|
+
a ? /* @__PURE__ */ y(B, { children: a }) : null
|
|
447
|
+
] }),
|
|
448
|
+
i ? /* @__PURE__ */ y(
|
|
449
|
+
Q,
|
|
450
|
+
{
|
|
451
|
+
className: N("close-button"),
|
|
452
|
+
onClick: (d) => {
|
|
453
|
+
d.preventDefault(), d.stopPropagation(), o == null || o();
|
|
454
|
+
},
|
|
455
|
+
size: "sm"
|
|
456
|
+
}
|
|
457
|
+
) : null
|
|
438
458
|
] }),
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
/* @__PURE__ */ y(
|
|
453
|
-
"div",
|
|
454
|
-
{
|
|
455
|
-
className: N(r && "progress"),
|
|
456
|
-
style: {
|
|
457
|
-
"--duration": i ? `${s}ms` : "5000ms"
|
|
458
|
-
},
|
|
459
|
-
children: /* @__PURE__ */ y("div", { className: N("progress-bar") })
|
|
460
|
-
}
|
|
461
|
-
)
|
|
462
|
-
] })
|
|
459
|
+
/* @__PURE__ */ y(
|
|
460
|
+
"div",
|
|
461
|
+
{
|
|
462
|
+
className: N(r && "progress"),
|
|
463
|
+
style: {
|
|
464
|
+
"--duration": i ? `${s}ms` : "5000ms"
|
|
465
|
+
},
|
|
466
|
+
children: /* @__PURE__ */ y("div", { className: N("progress-bar") })
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
)
|
|
463
472
|
);
|
|
464
473
|
ne.displayName = "Toast.Growl";
|
|
465
474
|
const le = J((e, t) => /* @__PURE__ */ y(K, { ref: t, size: "md", variant: "secondary", ...e }));
|
|
466
475
|
le.displayName = "Toast.GrowlAction";
|
|
467
|
-
const
|
|
476
|
+
const z = L(H), ce = Z(
|
|
468
477
|
({
|
|
469
478
|
children: e,
|
|
470
479
|
className: t,
|
|
@@ -475,53 +484,62 @@ const k = L(H), ce = Z(
|
|
|
475
484
|
onClose: r,
|
|
476
485
|
variant: n = "info",
|
|
477
486
|
...l
|
|
478
|
-
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
},
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
487
|
+
}, p) => /* @__PURE__ */ k(
|
|
488
|
+
"div",
|
|
489
|
+
{
|
|
490
|
+
className: z("root", `variant-${n}`, t),
|
|
491
|
+
onClick: (c) => c.stopPropagation(),
|
|
492
|
+
ref: p,
|
|
493
|
+
...l,
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ k("div", { className: z("snackbar"), children: [
|
|
496
|
+
n ? /* @__PURE__ */ y(V, { className: z("icon"), name: pe[n], size: "lg" }) : null,
|
|
497
|
+
/* @__PURE__ */ y(C, { variant: "body-md-strong", children: e }),
|
|
498
|
+
a ? /* @__PURE__ */ y(B, { children: a }) : null,
|
|
499
|
+
i ? /* @__PURE__ */ y(
|
|
500
|
+
Q,
|
|
501
|
+
{
|
|
502
|
+
onClick: (c) => {
|
|
503
|
+
c.preventDefault(), c.stopPropagation(), r == null || r();
|
|
504
|
+
},
|
|
505
|
+
size: "sm"
|
|
506
|
+
}
|
|
507
|
+
) : null
|
|
508
|
+
] }),
|
|
509
|
+
/* @__PURE__ */ y(
|
|
510
|
+
"div",
|
|
511
|
+
{
|
|
512
|
+
className: z("progress", o && "hide-progress-bar"),
|
|
513
|
+
style: {
|
|
514
|
+
"--duration": i ? `${s}ms` : "5000ms"
|
|
515
|
+
},
|
|
516
|
+
children: /* @__PURE__ */ y("div", { className: z("progress-bar") })
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
)
|
|
504
522
|
);
|
|
505
523
|
ce.displayName = "Toast.Snackbar";
|
|
506
524
|
const de = J((e, t) => /* @__PURE__ */ y(K, { ref: t, size: "md", variant: "secondary", ...e }));
|
|
507
525
|
de.displayName = "Toast.SnackbarAction";
|
|
508
|
-
const dt = L(H),
|
|
526
|
+
const dt = L(H), pe = {
|
|
509
527
|
error: "exclamation-octagon",
|
|
510
528
|
info: "info-circle",
|
|
511
529
|
success: "check-circle",
|
|
512
530
|
warning: "exclamation-triangle"
|
|
513
|
-
},
|
|
531
|
+
}, pt = {
|
|
514
532
|
error: 8e3,
|
|
515
533
|
info: 7e3,
|
|
516
534
|
success: 7e3,
|
|
517
535
|
warning: 8e3
|
|
518
|
-
},
|
|
519
|
-
|
|
536
|
+
}, me = ({ children: e, className: t, ...a }) => /* @__PURE__ */ y("p", { className: dt("title", t), ...a, children: e });
|
|
537
|
+
me.displayName = "Toast.Title";
|
|
520
538
|
const xt = (e, t) => {
|
|
521
539
|
const s = ("type" in e ? e.type.displayName || e.type.name : void 0) === "Growl" ? "top-right" : "bottom-center", i = () => {
|
|
522
|
-
t != null && t.onClose && t.onClose(),
|
|
540
|
+
t != null && t.onClose && t.onClose(), m.dismiss(t == null ? void 0 : t.id);
|
|
523
541
|
}, o = e.props.variant || "info", r = {
|
|
524
|
-
duration:
|
|
542
|
+
duration: pt[o],
|
|
525
543
|
position: s,
|
|
526
544
|
style: {
|
|
527
545
|
backgroundColor: "transparent",
|
|
@@ -531,7 +549,7 @@ const xt = (e, t) => {
|
|
|
531
549
|
},
|
|
532
550
|
...t
|
|
533
551
|
};
|
|
534
|
-
return
|
|
552
|
+
return m(
|
|
535
553
|
ge(e, { duration: r.duration, onClose: i }),
|
|
536
554
|
r
|
|
537
555
|
);
|
|
@@ -542,10 +560,10 @@ const wt = Object.assign(ie, {
|
|
|
542
560
|
GrowlAction: le,
|
|
543
561
|
Snackbar: ce,
|
|
544
562
|
SnackbarAction: de,
|
|
545
|
-
Title:
|
|
563
|
+
Title: me
|
|
546
564
|
});
|
|
547
565
|
export {
|
|
548
|
-
|
|
566
|
+
pe as ICON,
|
|
549
567
|
wt as Toast,
|
|
550
568
|
xt as toast
|
|
551
569
|
};
|