welcome-ui 0.0.0-dev.1763740954427 → 0.0.0-dev.1763744022817

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
@@ -2,12 +2,12 @@
2
2
  import './Toast.css';
3
3
  import { jsxs as z, 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 C, useState as fe, forwardRef as Z, cloneElement as ge } from "react";
5
+ import { useRef as Y, useCallback as j, useEffect as P, 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";
9
9
  import { Icon as V } from "./Icon.js";
10
- import { Text as P } from "./Text.js";
10
+ import { Text as C } from "./Text.js";
11
11
  import { f as J } from "./forwardRefWithAs-8eP3ZN15.js";
12
12
  let ye = { data: "" }, be = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || ye, he = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, ve = /\/\*[^]*?\*\/| +/g, W = /\n+/g, w = (e, t) => {
13
13
  let a = "", s = "", i = "";
@@ -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 c = 0, d = 11;
29
- for (; c < l.length; ) d = 101 * d + l.charCodeAt(c++) >>> 0;
30
- return "go" + d;
28
+ let m = 0, c = 11;
29
+ for (; m < l.length; ) c = 101 * c + l.charCodeAt(m++) >>> 0;
30
+ return "go" + c;
31
31
  })(o));
32
32
  if (!v[r]) {
33
- let l = o !== e ? e : ((c) => {
34
- let d, m, p = [{}];
35
- for (; d = he.exec(c.replace(ve, "")); ) d[4] ? p.shift() : d[3] ? (m = d[3].replace(W, " ").trim(), p.unshift(p[0][m] = p[0][m] || {})) : p[0][d[1]] = d[2].replace(W, " ").trim();
36
- return p[0];
33
+ let l = o !== e ? e : ((m) => {
34
+ let c, d, u = [{}];
35
+ for (; c = he.exec(m.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
+ 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, c, d, m) => {
42
- m ? c.data = c.data.replace(m, l) : c.data.indexOf(l) === -1 && (c.data = d ? l + c.data : c.data + l);
41
+ return a && (v.g = v[r]), ((l, m, c, d) => {
42
+ d ? m.data = m.data.replace(d, l) : m.data.indexOf(l) === -1 && (m.data = c ? l + m.data : m.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 c = e;
70
- return e[0] && (c = n.as || e, delete n.as), F && c[0] && F(n), ee(c, n);
69
+ let m = e;
70
+ return e[0] && (m = n.as || e, delete n.as), F && m[0] && F(n), ee(m, n);
71
71
  }
72
72
  return i;
73
73
  };
@@ -113,85 +113,85 @@ var Ne = (e) => typeof e == "function", D = (e, t) => Ne(e) ? e(t) : e, je = /*
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
- C(() => (i.current !== h[t] && s(h[t]), O.push([t, s]), () => {
116
+ P(() => (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, c;
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, ...(c = e[r.type]) == null ? void 0 : c.style, ...r.style } };
121
+ var n, l, m;
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, ...(m = e[r.type]) == null ? void 0 : m.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
127
  return q(s.toasterId || ke(s.id))({ type: 2, toast: s }), s.id;
128
- }, u = (e, t) => $("blank")(e, t);
129
- u.error = $("error");
130
- u.success = $("success");
131
- u.loading = $("loading");
132
- u.custom = $("custom");
133
- u.dismiss = (e, t) => {
128
+ }, p = (e, t) => $("blank")(e, t);
129
+ p.error = $("error");
130
+ p.success = $("success");
131
+ p.loading = $("loading");
132
+ p.custom = $("custom");
133
+ p.dismiss = (e, t) => {
134
134
  let a = { type: 3, toastId: e };
135
135
  t ? q(t)(a) : oe(a);
136
136
  };
137
- u.dismissAll = (e) => u.dismiss(void 0, e);
138
- u.remove = (e, t) => {
137
+ p.dismissAll = (e) => p.dismiss(void 0, e);
138
+ p.remove = (e, t) => {
139
139
  let a = { type: 4, toastId: e };
140
140
  t ? q(t)(a) : oe(a);
141
141
  };
142
- u.removeAll = (e) => u.remove(void 0, e);
143
- u.promise = (e, t, a) => {
144
- let s = u.loading(t.loading, { ...a, ...a == null ? void 0 : a.loading });
142
+ p.removeAll = (e) => p.remove(void 0, e);
143
+ p.promise = (e, t, a) => {
144
+ let s = p.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 ? u.success(o, { id: s, ...a, ...a == null ? void 0 : a.success }) : u.dismiss(s), i;
147
+ return o ? p.success(o, { id: s, ...a, ...a == null ? void 0 : a.success }) : p.dismiss(s), i;
148
148
  }).catch((i) => {
149
149
  let o = t.error ? D(t.error, i) : void 0;
150
- o ? u.error(o, { id: s, ...a, ...a == null ? void 0 : a.error }) : u.dismiss(s);
150
+ o ? p.error(o, { id: s, ...a, ...a == null ? void 0 : a.error }) : p.dismiss(s);
151
151
  }), e;
152
152
  };
153
153
  var Oe = 1e3, De = (e, t = "default") => {
154
- let { toasts: a, pausedAt: s } = Ee(e, t), i = Y(/* @__PURE__ */ new Map()).current, o = j((m, p = Oe) => {
155
- if (i.has(m)) return;
154
+ let { toasts: a, pausedAt: s } = Ee(e, t), i = Y(/* @__PURE__ */ new Map()).current, o = j((d, u = Oe) => {
155
+ if (i.has(d)) return;
156
156
  let g = setTimeout(() => {
157
- i.delete(m), r({ type: 4, toastId: m });
158
- }, p);
159
- i.set(m, g);
157
+ i.delete(d), r({ type: 4, toastId: d });
158
+ }, u);
159
+ i.set(d, g);
160
160
  }, []);
161
- C(() => {
161
+ P(() => {
162
162
  if (s) return;
163
- let m = Date.now(), p = a.map((g) => {
163
+ let d = Date.now(), u = a.map((g) => {
164
164
  if (g.duration === 1 / 0) return;
165
- let E = (g.duration || 0) + g.pauseDuration - (m - g.createdAt);
165
+ let E = (g.duration || 0) + g.pauseDuration - (d - g.createdAt);
166
166
  if (E < 0) {
167
- g.visible && u.dismiss(g.id);
167
+ g.visible && p.dismiss(g.id);
168
168
  return;
169
169
  }
170
- return setTimeout(() => u.dismiss(g.id, t), E);
170
+ return setTimeout(() => p.dismiss(g.id, t), E);
171
171
  });
172
172
  return () => {
173
- p.forEach((g) => g && clearTimeout(g));
173
+ u.forEach((g) => g && clearTimeout(g));
174
174
  };
175
175
  }, [a, s, t]);
176
176
  let r = j(q(t), [t]), n = j(() => {
177
177
  r({ type: 5, time: Date.now() });
178
- }, [r]), l = j((m, p) => {
179
- r({ type: 1, toast: { id: m, height: p } });
180
- }, [r]), c = j(() => {
178
+ }, [r]), l = j((d, u) => {
179
+ r({ type: 1, toast: { id: d, height: u } });
180
+ }, [r]), m = j(() => {
181
181
  s && r({ type: 6, time: Date.now() });
182
- }, [s, r]), d = j((m, p) => {
183
- let { reverseOrder: g = !1, gutter: E = 8, defaultPosition: G } = p || {}, I = a.filter((b) => (b.position || G) === (m.position || G) && b.height), pe = I.findIndex((b) => b.id === m.id), U = I.filter((b, S) => S < pe && b.visible).length;
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, S) => S < ue && b.visible).length;
184
184
  return I.filter((b) => b.visible).slice(...g ? [U + 1] : [0, U]).reduce((b, S) => b + (S.height || 0) + E, 0);
185
185
  }, [a]);
186
- return C(() => {
187
- a.forEach((m) => {
188
- if (m.dismissed) o(m.id, m.removeDelay);
186
+ return P(() => {
187
+ a.forEach((d) => {
188
+ if (d.dismissed) o(d.id, d.removeDelay);
189
189
  else {
190
- let p = i.get(m.id);
191
- p && (clearTimeout(p), i.delete(m.id));
190
+ let u = i.get(d.id);
191
+ u && (clearTimeout(u), i.delete(d.id));
192
192
  }
193
193
  });
194
- }, [a, o]), { toasts: a, handlers: { updateHeight: l, startPause: n, endPause: c, calculateOffset: d } };
194
+ }, [a, o]), { toasts: a, handlers: { updateHeight: l, startPause: n, endPause: m, calculateOffset: c } };
195
195
  }, Ae = x`
196
196
  from {
197
197
  transform: scale(0) rotate(45deg);
@@ -249,14 +249,14 @@ to {
249
249
  animation-delay: 180ms;
250
250
  transform: rotate(90deg);
251
251
  }
252
- `, Ce = x`
252
+ `, Pe = x`
253
253
  from {
254
254
  transform: rotate(0deg);
255
255
  }
256
256
  to {
257
257
  transform: rotate(360deg);
258
258
  }
259
- `, Pe = _("div")`
259
+ `, Ce = _("div")`
260
260
  width: 12px;
261
261
  height: 12px;
262
262
  box-sizing: border-box;
@@ -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: ${Ce} 1s linear infinite;
267
+ animation: ${Pe} 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(Pe, { ...s }), a !== "loading" && f.createElement(Me, null, a === "error" ? f.createElement(Se, { ...s }) : f.createElement(Le, { ...s })));
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(Se, { ...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: c } = 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: c.startPause, onMouseLeave: c.endPause }, l.map((d) => {
399
- let m = d.position || t, p = c.calculateOffset(d, { reverseOrder: e, gutter: s, defaultPosition: t }), g = tt(m, p);
400
- return f.createElement(et, { id: d.id, key: d.id, onHeightUpdate: c.updateHeight, className: d.visible ? at : "", style: g }, d.type === "custom" ? D(d.message, d) : i ? i(d) : f.createElement(Xe, { toast: d, position: m }));
397
+ let { toasts: l, handlers: m } = 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: m.startPause, onMouseLeave: m.endPause }, l.map((c) => {
399
+ let d = c.position || t, u = m.calculateOffset(c, { reverseOrder: e, gutter: s, defaultPosition: t }), g = tt(d, u);
400
+ return f.createElement(et, { id: c.id, key: c.id, onHeightUpdate: m.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,14 +427,14 @@ 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
- ...c
431
- }, d) => /* @__PURE__ */ z("div", { className: N("root", `variant-${l}`, t), ref: d, ...c, children: [
430
+ ...m
431
+ }, c) => /* @__PURE__ */ z("div", { className: N("root", `variant-${l}`, t), ref: c, ...m, children: [
432
432
  /* @__PURE__ */ z("div", { className: N("growl"), children: [
433
433
  l ? /* @__PURE__ */ y(V, { className: N("icon"), name: me[l], size: "lg" }) : null,
434
434
  /* @__PURE__ */ z("div", { className: N("content"), children: [
435
435
  /* @__PURE__ */ z("span", { children: [
436
- /* @__PURE__ */ y(P, { variant: "body-md-strong", children: n }),
437
- /* @__PURE__ */ y(P, { variant: "body-md", children: e })
436
+ /* @__PURE__ */ y(C, { variant: "body-md-strong", children: n }),
437
+ /* @__PURE__ */ y(C, { variant: "body-md", children: e })
438
438
  ] }),
439
439
  a ? /* @__PURE__ */ y(B, { children: a }) : null
440
440
  ] }),
@@ -442,8 +442,8 @@ const rt = "_root_q0jyz_2", st = "_icon_q0jyz_17", ot = "_progress_q0jyz_40", it
442
442
  Q,
443
443
  {
444
444
  className: N("close-button"),
445
- onClick: (m) => {
446
- m.preventDefault(), o == null || o();
445
+ onClick: (d) => {
446
+ d.preventDefault(), d.stopPropagation(), o == null || o();
447
447
  },
448
448
  size: "sm"
449
449
  }
@@ -475,16 +475,16 @@ const k = L(H), ce = Z(
475
475
  onClose: r,
476
476
  variant: n = "info",
477
477
  ...l
478
- }, c) => /* @__PURE__ */ z("div", { className: k("root", `variant-${n}`, t), ref: c, ...l, children: [
478
+ }, m) => /* @__PURE__ */ z("div", { className: k("root", `variant-${n}`, t), ref: m, ...l, children: [
479
479
  /* @__PURE__ */ z("div", { className: k("snackbar"), children: [
480
480
  n ? /* @__PURE__ */ y(V, { className: k("icon"), name: me[n], size: "lg" }) : null,
481
- /* @__PURE__ */ y(P, { variant: "body-md-strong", children: e }),
481
+ /* @__PURE__ */ y(C, { variant: "body-md-strong", children: e }),
482
482
  a ? /* @__PURE__ */ y(B, { children: a }) : null,
483
483
  i ? /* @__PURE__ */ y(
484
484
  Q,
485
485
  {
486
- onClick: (d) => {
487
- d.preventDefault(), r == null || r();
486
+ onClick: (c) => {
487
+ c.preventDefault(), c.stopPropagation(), r == null || r();
488
488
  },
489
489
  size: "sm"
490
490
  }
@@ -515,11 +515,11 @@ const dt = L(H), me = {
515
515
  info: 7e3,
516
516
  success: 7e3,
517
517
  warning: 8e3
518
- }, ue = ({ children: e, className: t, ...a }) => /* @__PURE__ */ y("p", { className: dt("title", t), ...a, children: e });
519
- ue.displayName = "Toast.Title";
518
+ }, pe = ({ children: e, className: t, ...a }) => /* @__PURE__ */ y("p", { className: dt("title", t), ...a, children: e });
519
+ pe.displayName = "Toast.Title";
520
520
  const xt = (e, t) => {
521
521
  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(), u.dismiss(t == null ? void 0 : t.id);
522
+ t != null && t.onClose && t.onClose(), p.dismiss(t == null ? void 0 : t.id);
523
523
  }, o = e.props.variant || "info", r = {
524
524
  duration: mt[o],
525
525
  position: s,
@@ -531,7 +531,7 @@ const xt = (e, t) => {
531
531
  },
532
532
  ...t
533
533
  };
534
- return u(
534
+ return p(
535
535
  ge(e, { duration: r.duration, onClose: i }),
536
536
  r
537
537
  );
@@ -542,7 +542,7 @@ const wt = Object.assign(ie, {
542
542
  GrowlAction: le,
543
543
  Snackbar: ce,
544
544
  SnackbarAction: de,
545
- Title: ue
545
+ Title: pe
546
546
  });
547
547
  export {
548
548
  me as ICON,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "welcome-ui",
3
- "version": "0.0.0-dev.1763740954427",
3
+ "version": "0.0.0-dev.1763744022817",
4
4
  "description": "Customizable design system with react, typescript, tailwindcss and ariakit.",
5
5
  "files": [
6
6
  "dist"