welcome-ui 0.0.0-dev.1762114810912 → 0.0.0-dev.1763386521897

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 CHANGED
@@ -1,78 +1,80 @@
1
1
  "use client";
2
- import { jsx as k, Fragment as re } from "react/jsx-runtime";
2
+ import { jsxs as N, jsx as y, Fragment as B } from "react/jsx-runtime";
3
3
  import * as f from "react";
4
- import { useRef as U, useCallback as _, useEffect as I, useState as se, forwardRef as W, cloneElement as oe } from "react";
5
- import { c as P } from "./index-PAaZGbyz.js";
6
- import { Alert as Y } from "./Alert.js";
7
- import { Button as ie } from "./Button.js";
8
- import { f as ne } from "./forwardRefWithAs-8eP3ZN15.js";
9
- let le = { data: "" }, ce = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || le, de = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, pe = /\/\*[^]*?\*\/| +/g, H = /\n+/g, x = (e, t) => {
10
- let a = "", s = "", i = "";
4
+ import { useRef as Y, useCallback as z, useEffect as S, useState as de, forwardRef as Z, cloneElement as pe } from "react";
5
+ import { c as L } from "./index-PAaZGbyz.js";
6
+ import { Button as K } from "./Button.js";
7
+ import { CloseButton as Q } from "./CloseButton.js";
8
+ import { Icon as V } from "./Icon.js";
9
+ import { Text as P } from "./Text.js";
10
+ import { f as J } from "./forwardRefWithAs-8eP3ZN15.js";
11
+ let me = { data: "" }, ue = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || me, fe = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, ge = /\/\*[^]*?\*\/| +/g, W = /\n+/g, w = (e, t) => {
12
+ let r = "", s = "", i = "";
11
13
  for (let o in e) {
12
- let r = e[o];
13
- o[0] == "@" ? o[1] == "i" ? a = o + " " + r + ";" : s += o[1] == "f" ? x(r, o) : o + "{" + x(r, o[1] == "k" ? "" : t) + "}" : typeof r == "object" ? s += x(r, t ? t.replace(/([^,])+/g, (n) => o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, n) : n ? n + " " + l : l)) : o) : r != null && (o = /^--/.test(o) ? o : o.replace(/[A-Z]/g, "-$&").toLowerCase(), i += x.p ? x.p(o, r) : o + ":" + r + ";");
14
+ let a = e[o];
15
+ o[0] == "@" ? o[1] == "i" ? r = o + " " + a + ";" : s += o[1] == "f" ? w(a, o) : o + "{" + w(a, o[1] == "k" ? "" : t) + "}" : typeof a == "object" ? s += w(a, t ? t.replace(/([^,])+/g, (n) => o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, n) : n ? n + " " + l : l)) : o) : a != null && (o = /^--/.test(o) ? o : o.replace(/[A-Z]/g, "-$&").toLowerCase(), i += w.p ? w.p(o, a) : o + ":" + a + ";");
14
16
  }
15
- return a + (t && i ? t + "{" + i + "}" : i) + s;
16
- }, b = {}, Z = (e) => {
17
+ return r + (t && i ? t + "{" + i + "}" : i) + s;
18
+ }, v = {}, X = (e) => {
17
19
  if (typeof e == "object") {
18
20
  let t = "";
19
- for (let a in e) t += a + Z(e[a]);
21
+ for (let r in e) t += r + X(e[r]);
20
22
  return t;
21
23
  }
22
24
  return e;
23
- }, ue = (e, t, a, s, i) => {
24
- let o = Z(e), r = b[o] || (b[o] = ((l) => {
25
- let d = 0, p = 11;
26
- for (; d < l.length; ) p = 101 * p + l.charCodeAt(d++) >>> 0;
27
- return "go" + p;
25
+ }, ye = (e, t, r, s, i) => {
26
+ let o = X(e), a = v[o] || (v[o] = ((l) => {
27
+ let c = 0, d = 11;
28
+ for (; c < l.length; ) d = 101 * d + l.charCodeAt(c++) >>> 0;
29
+ return "go" + d;
28
30
  })(o));
29
- if (!b[r]) {
30
- let l = o !== e ? e : ((d) => {
31
- let p, c, m = [{}];
32
- for (; p = de.exec(d.replace(pe, "")); ) p[4] ? m.shift() : p[3] ? (c = p[3].replace(H, " ").trim(), m.unshift(m[0][c] = m[0][c] || {})) : m[0][p[1]] = p[2].replace(H, " ").trim();
33
- return m[0];
31
+ if (!v[a]) {
32
+ let l = o !== e ? e : ((c) => {
33
+ let d, p, u = [{}];
34
+ for (; d = fe.exec(c.replace(ge, "")); ) d[4] ? u.shift() : d[3] ? (p = d[3].replace(W, " ").trim(), u.unshift(u[0][p] = u[0][p] || {})) : u[0][d[1]] = d[2].replace(W, " ").trim();
35
+ return u[0];
34
36
  })(e);
35
- b[r] = x(i ? { ["@keyframes " + r]: l } : l, a ? "" : "." + r);
37
+ v[a] = w(i ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
36
38
  }
37
- let n = a && b.g ? b.g : null;
38
- return a && (b.g = b[r]), ((l, d, p, c) => {
39
- c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = p ? l + d.data : d.data + l);
40
- })(b[r], t, s, n), r;
41
- }, me = (e, t, a) => e.reduce((s, i, o) => {
42
- let r = t[o];
43
- if (r && r.call) {
44
- let n = r(a), l = n && n.props && n.props.className || /^go/.test(n) && n;
45
- r = l ? "." + l : n && typeof n == "object" ? n.props ? "" : x(n, "") : n === !1 ? "" : n;
39
+ let n = r && v.g ? v.g : null;
40
+ return r && (v.g = v[a]), ((l, c, d, p) => {
41
+ p ? c.data = c.data.replace(p, l) : c.data.indexOf(l) === -1 && (c.data = d ? l + c.data : c.data + l);
42
+ })(v[a], t, s, n), a;
43
+ }, be = (e, t, r) => e.reduce((s, i, o) => {
44
+ let a = t[o];
45
+ if (a && a.call) {
46
+ let n = a(r), l = n && n.props && n.props.className || /^go/.test(n) && n;
47
+ a = l ? "." + l : n && typeof n == "object" ? n.props ? "" : w(n, "") : n === !1 ? "" : n;
46
48
  }
47
- return s + i + (r ?? "");
49
+ return s + i + (a ?? "");
48
50
  }, "");
49
- function O(e) {
50
- let t = this || {}, a = e.call ? e(t.p) : e;
51
- return ue(a.unshift ? a.raw ? me(a, [].slice.call(arguments, 1), t.p) : a.reduce((s, i) => Object.assign(s, i && i.call ? i(t.p) : i), {}) : a, ce(t.target), t.g, t.o, t.k);
51
+ function q(e) {
52
+ let t = this || {}, r = e.call ? e(t.p) : e;
53
+ return ye(r.unshift ? r.raw ? be(r, [].slice.call(arguments, 1), t.p) : r.reduce((s, i) => Object.assign(s, i && i.call ? i(t.p) : i), {}) : r, ue(t.target), t.g, t.o, t.k);
52
54
  }
53
- let q, S, T;
54
- O.bind({ g: 1 });
55
- let v = O.bind({ k: 1 });
56
- function fe(e, t, a, s) {
57
- x.p = t, q = e, S = a, T = s;
55
+ let ee, R, F;
56
+ q.bind({ g: 1 });
57
+ let x = q.bind({ k: 1 });
58
+ function he(e, t, r, s) {
59
+ w.p = t, ee = e, R = r, F = s;
58
60
  }
59
- function w(e, t) {
60
- let a = this || {};
61
+ function _(e, t) {
62
+ let r = this || {};
61
63
  return function() {
62
64
  let s = arguments;
63
- function i(o, r) {
65
+ function i(o, a) {
64
66
  let n = Object.assign({}, o), l = n.className || i.className;
65
- a.p = Object.assign({ theme: S && S() }, n), a.o = / *go\d+/.test(l), n.className = O.apply(a, s) + (l ? " " + l : "");
66
- let d = e;
67
- return e[0] && (d = n.as || e, delete n.as), T && d[0] && T(n), q(d, n);
67
+ r.p = Object.assign({ theme: R && R() }, n), r.o = / *go\d+/.test(l), n.className = q.apply(r, s) + (l ? " " + l : "");
68
+ let c = e;
69
+ return e[0] && (c = n.as || e, delete n.as), F && c[0] && F(n), ee(c, n);
68
70
  }
69
71
  return i;
70
72
  };
71
73
  }
72
- var ge = (e) => typeof e == "function", C = (e, t) => ge(e) ? e(t) : e, ye = /* @__PURE__ */ (() => {
74
+ var ve = (e) => typeof e == "function", D = (e, t) => ve(e) ? e(t) : e, xe = /* @__PURE__ */ (() => {
73
75
  let e = 0;
74
76
  return () => (++e).toString();
75
- })(), K = /* @__PURE__ */ (() => {
77
+ })(), te = /* @__PURE__ */ (() => {
76
78
  let e;
77
79
  return () => {
78
80
  if (e === void 0 && typeof window < "u") {
@@ -81,115 +83,115 @@ var ge = (e) => typeof e == "function", C = (e, t) => ge(e) ? e(t) : e, ye = /*
81
83
  }
82
84
  return e;
83
85
  };
84
- })(), he = 20, F = "default", Q = (e, t) => {
85
- let { toastLimit: a } = e.settings;
86
+ })(), we = 20, M = "default", re = (e, t) => {
87
+ let { toastLimit: r } = e.settings;
86
88
  switch (t.type) {
87
89
  case 0:
88
- return { ...e, toasts: [t.toast, ...e.toasts].slice(0, a) };
90
+ return { ...e, toasts: [t.toast, ...e.toasts].slice(0, r) };
89
91
  case 1:
90
- return { ...e, toasts: e.toasts.map((r) => r.id === t.toast.id ? { ...r, ...t.toast } : r) };
92
+ return { ...e, toasts: e.toasts.map((a) => a.id === t.toast.id ? { ...a, ...t.toast } : a) };
91
93
  case 2:
92
94
  let { toast: s } = t;
93
- return Q(e, { type: e.toasts.find((r) => r.id === s.id) ? 1 : 0, toast: s });
95
+ return re(e, { type: e.toasts.find((a) => a.id === s.id) ? 1 : 0, toast: s });
94
96
  case 3:
95
97
  let { toastId: i } = t;
96
- return { ...e, toasts: e.toasts.map((r) => r.id === i || i === void 0 ? { ...r, dismissed: !0, visible: !1 } : r) };
98
+ return { ...e, toasts: e.toasts.map((a) => a.id === i || i === void 0 ? { ...a, dismissed: !0, visible: !1 } : a) };
97
99
  case 4:
98
- return t.toastId === void 0 ? { ...e, toasts: [] } : { ...e, toasts: e.toasts.filter((r) => r.id !== t.toastId) };
100
+ return t.toastId === void 0 ? { ...e, toasts: [] } : { ...e, toasts: e.toasts.filter((a) => a.id !== t.toastId) };
99
101
  case 5:
100
102
  return { ...e, pausedAt: t.time };
101
103
  case 6:
102
104
  let o = t.time - (e.pausedAt || 0);
103
- return { ...e, pausedAt: void 0, toasts: e.toasts.map((r) => ({ ...r, pauseDuration: r.pauseDuration + o })) };
105
+ return { ...e, pausedAt: void 0, toasts: e.toasts.map((a) => ({ ...a, pauseDuration: a.pauseDuration + o })) };
104
106
  }
105
- }, j = [], V = { toasts: [], pausedAt: void 0, settings: { toastLimit: he } }, h = {}, J = (e, t = F) => {
106
- h[t] = Q(h[t] || V, e), j.forEach(([a, s]) => {
107
- a === t && s(h[t]);
107
+ }, C = [], ae = { toasts: [], pausedAt: void 0, settings: { toastLimit: we } }, h = {}, se = (e, t = M) => {
108
+ h[t] = re(h[t] || ae, e), C.forEach(([r, s]) => {
109
+ r === t && s(h[t]);
108
110
  });
109
- }, X = (e) => Object.keys(h).forEach((t) => J(e, t)), be = (e) => Object.keys(h).find((t) => h[t].toasts.some((a) => a.id === e)), D = (e = F) => (t) => {
110
- J(t, e);
111
- }, ve = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, xe = (e = {}, t = F) => {
112
- let [a, s] = se(h[t] || V), i = U(h[t]);
113
- I(() => (i.current !== h[t] && s(h[t]), j.push([t, s]), () => {
114
- let r = j.findIndex(([n]) => n === t);
115
- r > -1 && j.splice(r, 1);
111
+ }, oe = (e) => Object.keys(h).forEach((t) => se(e, t)), _e = (e) => Object.keys(h).find((t) => h[t].toasts.some((r) => r.id === e)), A = (e = M) => (t) => {
112
+ se(t, e);
113
+ }, je = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, ze = (e = {}, t = M) => {
114
+ let [r, s] = de(h[t] || ae), i = Y(h[t]);
115
+ S(() => (i.current !== h[t] && s(h[t]), C.push([t, s]), () => {
116
+ let a = C.findIndex(([n]) => n === t);
117
+ a > -1 && C.splice(a, 1);
116
118
  }), [t]);
117
- let o = a.toasts.map((r) => {
118
- var n, l, d;
119
- 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) || ve[r.type], style: { ...e.style, ...(d = e[r.type]) == null ? void 0 : d.style, ...r.style } };
119
+ let o = r.toasts.map((a) => {
120
+ var n, l, c;
121
+ return { ...e, ...e[a.type], ...a, removeDelay: a.removeDelay || ((n = e[a.type]) == null ? void 0 : n.removeDelay) || (e == null ? void 0 : e.removeDelay), duration: a.duration || ((l = e[a.type]) == null ? void 0 : l.duration) || (e == null ? void 0 : e.duration) || je[a.type], style: { ...e.style, ...(c = e[a.type]) == null ? void 0 : c.style, ...a.style } };
120
122
  });
121
- return { ...a, toasts: o };
122
- }, we = (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) || ye() }), $ = (e) => (t, a) => {
123
- let s = we(t, e, a);
124
- return D(s.toasterId || be(s.id))({ type: 2, toast: s }), s.id;
125
- }, u = (e, t) => $("blank")(e, t);
126
- u.error = $("error");
127
- u.success = $("success");
128
- u.loading = $("loading");
129
- u.custom = $("custom");
130
- u.dismiss = (e, t) => {
131
- let a = { type: 3, toastId: e };
132
- t ? D(t)(a) : X(a);
123
+ return { ...r, toasts: o };
124
+ }, Ne = (e, t = "blank", r) => ({ createdAt: Date.now(), visible: !0, dismissed: !1, type: t, ariaProps: { role: "status", "aria-live": "polite" }, message: e, pauseDuration: 0, ...r, id: (r == null ? void 0 : r.id) || xe() }), $ = (e) => (t, r) => {
125
+ let s = Ne(t, e, r);
126
+ return A(s.toasterId || _e(s.id))({ type: 2, toast: s }), s.id;
127
+ }, m = (e, t) => $("blank")(e, t);
128
+ m.error = $("error");
129
+ m.success = $("success");
130
+ m.loading = $("loading");
131
+ m.custom = $("custom");
132
+ m.dismiss = (e, t) => {
133
+ let r = { type: 3, toastId: e };
134
+ t ? A(t)(r) : oe(r);
133
135
  };
134
- u.dismissAll = (e) => u.dismiss(void 0, e);
135
- u.remove = (e, t) => {
136
- let a = { type: 4, toastId: e };
137
- t ? D(t)(a) : X(a);
136
+ m.dismissAll = (e) => m.dismiss(void 0, e);
137
+ m.remove = (e, t) => {
138
+ let r = { type: 4, toastId: e };
139
+ t ? A(t)(r) : oe(r);
138
140
  };
139
- u.removeAll = (e) => u.remove(void 0, e);
140
- u.promise = (e, t, a) => {
141
- let s = u.loading(t.loading, { ...a, ...a == null ? void 0 : a.loading });
141
+ m.removeAll = (e) => m.remove(void 0, e);
142
+ m.promise = (e, t, r) => {
143
+ let s = m.loading(t.loading, { ...r, ...r == null ? void 0 : r.loading });
142
144
  return typeof e == "function" && (e = e()), e.then((i) => {
143
- let o = t.success ? C(t.success, i) : void 0;
144
- return o ? u.success(o, { id: s, ...a, ...a == null ? void 0 : a.success }) : u.dismiss(s), i;
145
+ let o = t.success ? D(t.success, i) : void 0;
146
+ return o ? m.success(o, { id: s, ...r, ...r == null ? void 0 : r.success }) : m.dismiss(s), i;
145
147
  }).catch((i) => {
146
- let o = t.error ? C(t.error, i) : void 0;
147
- o ? u.error(o, { id: s, ...a, ...a == null ? void 0 : a.error }) : u.dismiss(s);
148
+ let o = t.error ? D(t.error, i) : void 0;
149
+ o ? m.error(o, { id: s, ...r, ...r == null ? void 0 : r.error }) : m.dismiss(s);
148
150
  }), e;
149
151
  };
150
- var ke = 1e3, _e = (e, t = "default") => {
151
- let { toasts: a, pausedAt: s } = xe(e, t), i = U(/* @__PURE__ */ new Map()).current, o = _((c, m = ke) => {
152
- if (i.has(c)) return;
152
+ var ke = 1e3, $e = (e, t = "default") => {
153
+ let { toasts: r, pausedAt: s } = ze(e, t), i = Y(/* @__PURE__ */ new Map()).current, o = z((p, u = ke) => {
154
+ if (i.has(p)) return;
153
155
  let g = setTimeout(() => {
154
- i.delete(c), r({ type: 4, toastId: c });
155
- }, m);
156
- i.set(c, g);
156
+ i.delete(p), a({ type: 4, toastId: p });
157
+ }, u);
158
+ i.set(p, g);
157
159
  }, []);
158
- I(() => {
160
+ S(() => {
159
161
  if (s) return;
160
- let c = Date.now(), m = a.map((g) => {
162
+ let p = Date.now(), u = r.map((g) => {
161
163
  if (g.duration === 1 / 0) return;
162
- let E = (g.duration || 0) + g.pauseDuration - (c - g.createdAt);
164
+ let E = (g.duration || 0) + g.pauseDuration - (p - g.createdAt);
163
165
  if (E < 0) {
164
- g.visible && u.dismiss(g.id);
166
+ g.visible && m.dismiss(g.id);
165
167
  return;
166
168
  }
167
- return setTimeout(() => u.dismiss(g.id, t), E);
169
+ return setTimeout(() => m.dismiss(g.id, t), E);
168
170
  });
169
171
  return () => {
170
- m.forEach((g) => g && clearTimeout(g));
172
+ u.forEach((g) => g && clearTimeout(g));
171
173
  };
172
- }, [a, s, t]);
173
- let r = _(D(t), [t]), n = _(() => {
174
- r({ type: 5, time: Date.now() });
175
- }, [r]), l = _((c, m) => {
176
- r({ type: 1, toast: { id: c, height: m } });
177
- }, [r]), d = _(() => {
178
- s && r({ type: 6, time: Date.now() });
179
- }, [s, r]), p = _((c, m) => {
180
- let { reverseOrder: g = !1, gutter: E = 8, defaultPosition: L } = m || {}, A = a.filter((y) => (y.position || L) === (c.position || L) && y.height), ae = A.findIndex((y) => y.id === c.id), M = A.filter((y, z) => z < ae && y.visible).length;
181
- return A.filter((y) => y.visible).slice(...g ? [M + 1] : [0, M]).reduce((y, z) => y + (z.height || 0) + E, 0);
182
- }, [a]);
183
- return I(() => {
184
- a.forEach((c) => {
185
- if (c.dismissed) o(c.id, c.removeDelay);
174
+ }, [r, s, t]);
175
+ let a = z(A(t), [t]), n = z(() => {
176
+ a({ type: 5, time: Date.now() });
177
+ }, [a]), l = z((p, u) => {
178
+ a({ type: 1, toast: { id: p, height: u } });
179
+ }, [a]), c = z(() => {
180
+ s && a({ type: 6, time: Date.now() });
181
+ }, [s, a]), d = z((p, u) => {
182
+ let { reverseOrder: g = !1, gutter: E = 8, defaultPosition: G } = u || {}, I = r.filter((b) => (b.position || G) === (p.position || G) && b.height), ce = I.findIndex((b) => b.id === p.id), U = I.filter((b, T) => T < ce && b.visible).length;
183
+ return I.filter((b) => b.visible).slice(...g ? [U + 1] : [0, U]).reduce((b, T) => b + (T.height || 0) + E, 0);
184
+ }, [r]);
185
+ return S(() => {
186
+ r.forEach((p) => {
187
+ if (p.dismissed) o(p.id, p.removeDelay);
186
188
  else {
187
- let m = i.get(c.id);
188
- m && (clearTimeout(m), i.delete(c.id));
189
+ let u = i.get(p.id);
190
+ u && (clearTimeout(u), i.delete(p.id));
189
191
  }
190
192
  });
191
- }, [a, o]), { toasts: a, handlers: { updateHeight: l, startPause: n, endPause: d, calculateOffset: p } };
192
- }, $e = v`
193
+ }, [r, o]), { toasts: r, handlers: { updateHeight: l, startPause: n, endPause: c, calculateOffset: d } };
194
+ }, Ee = x`
193
195
  from {
194
196
  transform: scale(0) rotate(45deg);
195
197
  opacity: 0;
@@ -197,7 +199,7 @@ from {
197
199
  to {
198
200
  transform: scale(1) rotate(45deg);
199
201
  opacity: 1;
200
- }`, Ee = v`
202
+ }`, Oe = x`
201
203
  from {
202
204
  transform: scale(0);
203
205
  opacity: 0;
@@ -205,7 +207,7 @@ from {
205
207
  to {
206
208
  transform: scale(1);
207
209
  opacity: 1;
208
- }`, Ne = v`
210
+ }`, Ce = x`
209
211
  from {
210
212
  transform: scale(0) rotate(90deg);
211
213
  opacity: 0;
@@ -213,7 +215,7 @@ from {
213
215
  to {
214
216
  transform: scale(1) rotate(90deg);
215
217
  opacity: 1;
216
- }`, je = w("div")`
218
+ }`, De = _("div")`
217
219
  width: 20px;
218
220
  opacity: 0;
219
221
  height: 20px;
@@ -222,14 +224,14 @@ to {
222
224
  position: relative;
223
225
  transform: rotate(45deg);
224
226
 
225
- animation: ${$e} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
227
+ animation: ${Ee} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
226
228
  forwards;
227
229
  animation-delay: 100ms;
228
230
 
229
231
  &:after,
230
232
  &:before {
231
233
  content: '';
232
- animation: ${Ee} 0.15s ease-out forwards;
234
+ animation: ${Oe} 0.15s ease-out forwards;
233
235
  animation-delay: 150ms;
234
236
  position: absolute;
235
237
  border-radius: 3px;
@@ -242,18 +244,18 @@ to {
242
244
  }
243
245
 
244
246
  &:before {
245
- animation: ${Ne} 0.15s ease-out forwards;
247
+ animation: ${Ce} 0.15s ease-out forwards;
246
248
  animation-delay: 180ms;
247
249
  transform: rotate(90deg);
248
250
  }
249
- `, Ce = v`
251
+ `, qe = x`
250
252
  from {
251
253
  transform: rotate(0deg);
252
254
  }
253
255
  to {
254
256
  transform: rotate(360deg);
255
257
  }
256
- `, Oe = w("div")`
258
+ `, Ae = _("div")`
257
259
  width: 12px;
258
260
  height: 12px;
259
261
  box-sizing: border-box;
@@ -261,8 +263,8 @@ to {
261
263
  border-radius: 100%;
262
264
  border-color: ${(e) => e.secondary || "#e0e0e0"};
263
265
  border-right-color: ${(e) => e.primary || "#616161"};
264
- animation: ${Ce} 1s linear infinite;
265
- `, De = v`
266
+ animation: ${qe} 1s linear infinite;
267
+ `, Ie = x`
266
268
  from {
267
269
  transform: scale(0) rotate(45deg);
268
270
  opacity: 0;
@@ -270,7 +272,7 @@ from {
270
272
  to {
271
273
  transform: scale(1) rotate(45deg);
272
274
  opacity: 1;
273
- }`, Ae = v`
275
+ }`, Te = x`
274
276
  0% {
275
277
  height: 0;
276
278
  width: 0;
@@ -284,7 +286,7 @@ to {
284
286
  100% {
285
287
  opacity: 1;
286
288
  height: 10px;
287
- }`, ze = w("div")`
289
+ }`, Se = _("div")`
288
290
  width: 20px;
289
291
  opacity: 0;
290
292
  height: 20px;
@@ -293,13 +295,13 @@ to {
293
295
  position: relative;
294
296
  transform: rotate(45deg);
295
297
 
296
- animation: ${De} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
298
+ animation: ${Ie} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
297
299
  forwards;
298
300
  animation-delay: 100ms;
299
301
  &:after {
300
302
  content: '';
301
303
  box-sizing: border-box;
302
- animation: ${Ae} 0.2s ease-out forwards;
304
+ animation: ${Te} 0.2s ease-out forwards;
303
305
  opacity: 0;
304
306
  animation-delay: 200ms;
305
307
  position: absolute;
@@ -311,16 +313,16 @@ to {
311
313
  height: 10px;
312
314
  width: 6px;
313
315
  }
314
- `, Ie = w("div")`
316
+ `, Pe = _("div")`
315
317
  position: absolute;
316
- `, Se = w("div")`
318
+ `, Re = _("div")`
317
319
  position: relative;
318
320
  display: flex;
319
321
  justify-content: center;
320
322
  align-items: center;
321
323
  min-width: 20px;
322
324
  min-height: 20px;
323
- `, Te = v`
325
+ `, Fe = x`
324
326
  from {
325
327
  transform: scale(0.6);
326
328
  opacity: 0.4;
@@ -328,23 +330,23 @@ from {
328
330
  to {
329
331
  transform: scale(1);
330
332
  opacity: 1;
331
- }`, Pe = w("div")`
333
+ }`, Le = _("div")`
332
334
  position: relative;
333
335
  transform: scale(0.6);
334
336
  opacity: 0.4;
335
337
  min-width: 20px;
336
- animation: ${Te} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
338
+ animation: ${Fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
337
339
  forwards;
338
- `, Fe = ({ toast: e }) => {
339
- let { icon: t, type: a, iconTheme: s } = e;
340
- return t !== void 0 ? typeof t == "string" ? f.createElement(Pe, null, t) : t : a === "blank" ? null : f.createElement(Se, null, f.createElement(Oe, { ...s }), a !== "loading" && f.createElement(Ie, null, a === "error" ? f.createElement(je, { ...s }) : f.createElement(ze, { ...s })));
341
- }, Re = (e) => `
340
+ `, Me = ({ toast: e }) => {
341
+ let { icon: t, type: r, iconTheme: s } = e;
342
+ return t !== void 0 ? typeof t == "string" ? f.createElement(Le, null, t) : t : r === "blank" ? null : f.createElement(Re, null, f.createElement(Ae, { ...s }), r !== "loading" && f.createElement(Pe, null, r === "error" ? f.createElement(De, { ...s }) : f.createElement(Se, { ...s })));
343
+ }, He = (e) => `
342
344
  0% {transform: translate3d(0,${e * -200}%,0) scale(.6); opacity:.5;}
343
345
  100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
344
- `, Le = (e) => `
346
+ `, Ge = (e) => `
345
347
  0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
346
348
  100% {transform: translate3d(0,${e * -150}%,-1px) scale(.6); opacity:0;}
347
- `, Me = "0%{opacity:0;} 100%{opacity:1;}", He = "0%{opacity:1;} 100%{opacity:0;}", Be = w("div")`
349
+ `, Ue = "0%{opacity:0;} 100%{opacity:1;}", We = "0%{opacity:1;} 100%{opacity:0;}", Be = _("div")`
348
350
  display: flex;
349
351
  align-items: center;
350
352
  background: #fff;
@@ -356,106 +358,168 @@ to {
356
358
  pointer-events: auto;
357
359
  padding: 8px 10px;
358
360
  border-radius: 8px;
359
- `, Ge = w("div")`
361
+ `, Ye = _("div")`
360
362
  display: flex;
361
363
  justify-content: center;
362
364
  margin: 4px 10px;
363
365
  color: inherit;
364
366
  flex: 1 1 auto;
365
367
  white-space: pre-line;
366
- `, Ue = (e, t) => {
367
- let a = e.includes("top") ? 1 : -1, [s, i] = K() ? [Me, He] : [Re(a), Le(a)];
368
- return { animation: t ? `${v(s)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${v(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
369
- }, We = f.memo(({ toast: e, position: t, style: a, children: s }) => {
370
- let i = e.height ? Ue(e.position || t || "top-center", e.visible) : { opacity: 0 }, o = f.createElement(Fe, { toast: e }), r = f.createElement(Ge, { ...e.ariaProps }, C(e.message, e));
371
- return f.createElement(Be, { className: e.className, style: { ...i, ...a, ...e.style } }, typeof s == "function" ? s({ icon: o, message: r }) : f.createElement(f.Fragment, null, o, r));
368
+ `, Ze = (e, t) => {
369
+ let r = e.includes("top") ? 1 : -1, [s, i] = te() ? [Ue, We] : [He(r), Ge(r)];
370
+ return { animation: t ? `${x(s)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${x(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
371
+ }, Ke = f.memo(({ toast: e, position: t, style: r, children: s }) => {
372
+ let i = e.height ? Ze(e.position || t || "top-center", e.visible) : { opacity: 0 }, o = f.createElement(Me, { toast: e }), a = f.createElement(Ye, { ...e.ariaProps }, D(e.message, e));
373
+ return f.createElement(Be, { className: e.className, style: { ...i, ...r, ...e.style } }, typeof s == "function" ? s({ icon: o, message: a }) : f.createElement(f.Fragment, null, o, a));
372
374
  });
373
- fe(f.createElement);
374
- var Ye = ({ id: e, className: t, style: a, onHeightUpdate: s, children: i }) => {
375
- let o = f.useCallback((r) => {
376
- if (r) {
375
+ he(f.createElement);
376
+ var Qe = ({ id: e, className: t, style: r, onHeightUpdate: s, children: i }) => {
377
+ let o = f.useCallback((a) => {
378
+ if (a) {
377
379
  let n = () => {
378
- let l = r.getBoundingClientRect().height;
380
+ let l = a.getBoundingClientRect().height;
379
381
  s(e, l);
380
382
  };
381
- n(), new MutationObserver(n).observe(r, { subtree: !0, childList: !0, characterData: !0 });
383
+ n(), new MutationObserver(n).observe(a, { subtree: !0, childList: !0, characterData: !0 });
382
384
  }
383
385
  }, [e, s]);
384
- return f.createElement("div", { ref: o, className: t, style: a }, i);
385
- }, Ze = (e, t) => {
386
- let a = e.includes("top"), s = a ? { top: 0 } : { bottom: 0 }, i = e.includes("center") ? { justifyContent: "center" } : e.includes("right") ? { justifyContent: "flex-end" } : {};
387
- return { left: 0, right: 0, display: "flex", position: "absolute", transition: K() ? void 0 : "all 230ms cubic-bezier(.21,1.02,.73,1)", transform: `translateY(${t * (a ? 1 : -1)}px)`, ...s, ...i };
388
- }, qe = O`
386
+ return f.createElement("div", { ref: o, className: t, style: r }, i);
387
+ }, Ve = (e, t) => {
388
+ let r = e.includes("top"), s = r ? { top: 0 } : { bottom: 0 }, i = e.includes("center") ? { justifyContent: "center" } : e.includes("right") ? { justifyContent: "flex-end" } : {};
389
+ return { left: 0, right: 0, display: "flex", position: "absolute", transition: te() ? void 0 : "all 230ms cubic-bezier(.21,1.02,.73,1)", transform: `translateY(${t * (r ? 1 : -1)}px)`, ...s, ...i };
390
+ }, Je = q`
389
391
  z-index: 9999;
390
392
  > * {
391
393
  pointer-events: auto;
392
394
  }
393
- `, N = 16, Ke = ({ reverseOrder: e, position: t = "top-center", toastOptions: a, gutter: s, children: i, toasterId: o, containerStyle: r, containerClassName: n }) => {
394
- let { toasts: l, handlers: d } = _e(a, o);
395
- return f.createElement("div", { "data-rht-toaster": o || "", style: { position: "fixed", zIndex: 9999, top: N, left: N, right: N, bottom: N, pointerEvents: "none", ...r }, className: n, onMouseEnter: d.startPause, onMouseLeave: d.endPause }, l.map((p) => {
396
- let c = p.position || t, m = d.calculateOffset(p, { reverseOrder: e, gutter: s, defaultPosition: t }), g = Ze(c, m);
397
- return f.createElement(Ye, { id: p.id, key: p.id, onHeightUpdate: d.updateHeight, className: p.visible ? qe : "", style: g }, p.type === "custom" ? C(p.message, p) : i ? i(p) : f.createElement(We, { toast: p, position: c }));
395
+ `, O = 16, Xe = ({ reverseOrder: e, position: t = "top-center", toastOptions: r, gutter: s, children: i, toasterId: o, containerStyle: a, containerClassName: n }) => {
396
+ let { toasts: l, handlers: c } = $e(r, o);
397
+ return f.createElement("div", { "data-rht-toaster": o || "", style: { position: "fixed", zIndex: 9999, top: O, left: O, right: O, bottom: O, pointerEvents: "none", ...a }, className: n, onMouseEnter: c.startPause, onMouseLeave: c.endPause }, l.map((d) => {
398
+ let p = d.position || t, u = c.calculateOffset(d, { reverseOrder: e, gutter: s, defaultPosition: t }), g = Ve(p, u);
399
+ return f.createElement(Qe, { id: d.id, key: d.id, onHeightUpdate: c.updateHeight, className: d.visible ? Je : "", style: g }, d.type === "custom" ? D(d.message, d) : i ? i(d) : f.createElement(Ke, { toast: d, position: p }));
398
400
  }));
399
401
  };
400
- const Qe = "_title_1trg0_2", Ve = "_growl_1trg0_12", Je = "_snackbar_1trg0_27", Xe = "_info_1trg0_48", et = "_success_1trg0_51", tt = "_warning_1trg0_54", at = "_danger_1trg0_57", R = {
401
- title: Qe,
402
- growl: Ve,
403
- snackbar: Je,
404
- "snackbar-separator": "_snackbar-separator_1trg0_43",
405
- info: Xe,
406
- success: et,
407
- warning: tt,
408
- danger: at
409
- }, B = P(R), ee = W(
410
- ({ children: e, className: t, hasCloseButton: a = !0, onClose: s, variant: i, ...o }, r) => /* @__PURE__ */ k(
411
- Y,
412
- {
413
- className: B("growl", t),
414
- handleClose: a ? s : void 0,
415
- ref: r,
416
- variant: i,
417
- ...o,
418
- children: /* @__PURE__ */ k("div", { className: B("pr-xl"), children: e })
419
- }
420
- )
421
- );
422
- ee.displayName = "Growl";
423
- const G = P(R), te = W(
424
- ({ children: e, className: t, cta: a, hasCloseButton: s = !0, onClose: i, variant: o, ...r }, n) => /* @__PURE__ */ k(
425
- Y,
426
- {
427
- className: G("snackbar", t),
428
- cta: a ? /* @__PURE__ */ k(re, { children: /* @__PURE__ */ k("div", { className: G("snackbar-separator", `${o}`, "pr-xl"), children: a }) }) : null,
429
- handleClose: s ? i : void 0,
430
- ref: n,
431
- variant: o,
432
- ...r,
433
- children: e
434
- }
435
- )
436
- ), rt = ne((e, t) => /* @__PURE__ */ k(ie, { ref: t, size: "sm", variant: "tertiary", ...e }));
437
- te.displayName = "Snackbar";
438
- const st = P(R), ot = ({ children: e, className: t, ...a }) => /* @__PURE__ */ k("p", { className: st("title", t), ...a, children: e }), ut = (e, t) => {
402
+ const et = "_root_q0jyz_2", tt = "_icon_q0jyz_17", rt = "_progress_q0jyz_40", at = "_snackbar_q0jyz_63", st = "_growl_q0jyz_71", ot = "_content_q0jyz_79", it = "_title_q0jyz_91", H = {
403
+ root: et,
404
+ icon: tt,
405
+ "variant-error": "_variant-error_q0jyz_24",
406
+ "variant-warning": "_variant-warning_q0jyz_28",
407
+ "variant-success": "_variant-success_q0jyz_32",
408
+ "variant-info": "_variant-info_q0jyz_36",
409
+ progress: rt,
410
+ "progress-bar": "_progress-bar_q0jyz_45",
411
+ "toast-progress": "_toast-progress_q0jyz_1",
412
+ "hide-progress-bar": "_hide-progress-bar_q0jyz_52",
413
+ snackbar: at,
414
+ growl: st,
415
+ content: ot,
416
+ "close-button": "_close-button_q0jyz_85",
417
+ title: it
418
+ }, j = L(H), ie = Z(
419
+ ({
420
+ children: e,
421
+ className: t,
422
+ cta: r,
423
+ duration: s,
424
+ hasCloseButton: i = !0,
425
+ onClose: o,
426
+ showProgressBar: a = !1,
427
+ title: n,
428
+ variant: l = "info",
429
+ ...c
430
+ }, d) => /* @__PURE__ */ N("div", { className: j("root", `variant-${l}`, t), ref: d, ...c, children: [
431
+ /* @__PURE__ */ N("div", { className: j("growl"), children: [
432
+ l ? /* @__PURE__ */ y(V, { className: j("icon"), name: le[l], size: "lg" }) : null,
433
+ /* @__PURE__ */ N("div", { className: j("content"), children: [
434
+ /* @__PURE__ */ N("span", { children: [
435
+ /* @__PURE__ */ y(P, { variant: "body-md-strong", children: n }),
436
+ /* @__PURE__ */ y(P, { variant: "body-md", children: e })
437
+ ] }),
438
+ r ? /* @__PURE__ */ y(B, { children: r }) : null
439
+ ] }),
440
+ i ? /* @__PURE__ */ y(Q, { className: j("close-button"), onClick: o, size: "sm" }) : null
441
+ ] }),
442
+ /* @__PURE__ */ y(
443
+ "div",
444
+ {
445
+ className: j(a && "progress"),
446
+ style: {
447
+ "--duration": i ? `${s}ms` : "5000ms"
448
+ },
449
+ children: /* @__PURE__ */ y("div", { className: j("progress-bar") })
450
+ }
451
+ )
452
+ ] })
453
+ ), nt = J((e, t) => /* @__PURE__ */ y(K, { ref: t, size: "md", variant: "secondary", ...e }));
454
+ ie.displayName = "Growl";
455
+ const k = L(H), ne = Z(
456
+ ({
457
+ children: e,
458
+ className: t,
459
+ cta: r,
460
+ duration: s,
461
+ hasCloseButton: i = !0,
462
+ hideProgressBar: o = !1,
463
+ onClose: a,
464
+ variant: n = "info",
465
+ ...l
466
+ }, c) => /* @__PURE__ */ N("div", { className: k("root", `variant-${n}`, t), ref: c, ...l, children: [
467
+ /* @__PURE__ */ N("div", { className: k("snackbar"), children: [
468
+ n ? /* @__PURE__ */ y(V, { className: k("icon"), name: le[n], size: "lg" }) : null,
469
+ /* @__PURE__ */ y(P, { variant: "body-md-strong", children: e }),
470
+ r ? /* @__PURE__ */ y(B, { children: r }) : null,
471
+ i ? /* @__PURE__ */ y(Q, { onClick: a, size: "sm" }) : null
472
+ ] }),
473
+ /* @__PURE__ */ y(
474
+ "div",
475
+ {
476
+ className: k("progress", o && "hide-progress-bar"),
477
+ style: {
478
+ "--duration": i ? `${s}ms` : "5000ms"
479
+ },
480
+ children: /* @__PURE__ */ y("div", { className: k("progress-bar") })
481
+ }
482
+ )
483
+ ] })
484
+ ), lt = J((e, t) => /* @__PURE__ */ y(K, { ref: t, size: "md", variant: "secondary", ...e }));
485
+ ne.displayName = "Snackbar";
486
+ const ct = L(H), le = {
487
+ error: "exclamation-octagon",
488
+ info: "info-circle",
489
+ success: "check-circle",
490
+ warning: "exclamation-triangle"
491
+ }, dt = {
492
+ error: 8e3,
493
+ info: 7e3,
494
+ success: 7e3,
495
+ warning: 8e3
496
+ }, pt = ({ children: e, className: t, ...r }) => /* @__PURE__ */ y("p", { className: ct("title", t), ...r, children: e }), xt = (e, t) => {
439
497
  const s = ("type" in e ? e.type.displayName || e.type.name : void 0) === "Growl" ? "top-right" : "bottom-center", i = () => {
440
- t.onClose && t.onClose(), u.dismiss(t.id);
441
- }, o = {
442
- duration: 7e3,
498
+ t.onClose && t.onClose(), m.dismiss(t.id);
499
+ }, o = e.props.variant || "info", a = {
500
+ duration: dt[o],
443
501
  position: s,
444
502
  style: {
445
503
  backgroundColor: "transparent",
446
504
  boxShadow: "none",
505
+ maxWidth: "100%",
447
506
  padding: 0
448
507
  },
449
508
  ...t
450
509
  };
451
- return u(oe(e, { onClose: i }), o);
452
- }, mt = Object.assign(Ke, {
453
- Growl: ee,
454
- Snackbar: te,
455
- SnackbarAction: rt,
456
- Title: ot
510
+ return m(
511
+ pe(e, { duration: a.duration, onClose: i }),
512
+ a
513
+ );
514
+ }, wt = Object.assign(Xe, {
515
+ Growl: ie,
516
+ GrowlAction: nt,
517
+ Snackbar: ne,
518
+ SnackbarAction: lt,
519
+ Title: pt
457
520
  });
458
521
  export {
459
- mt as Toast,
460
- ut as toast
522
+ le as ICON,
523
+ wt as Toast,
524
+ xt as toast
461
525
  };