meticulous-ui 3.5.1 → 3.5.2
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/components/Toast/Toast.js +47 -45
- package/components/Toast/styles.js +3 -3
- package/package.json +1 -1
|
@@ -1,72 +1,74 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useRef as R, useEffect as C, createElement as N } from "react";
|
|
3
3
|
import { createPortal as b } from "react-dom";
|
|
4
4
|
import { Logo as j } from "./helpers.js";
|
|
5
|
-
import
|
|
6
|
-
import { COLOR_MAP as
|
|
7
|
-
import { ToastWrapper as
|
|
5
|
+
import y from "../../colors/grey.js";
|
|
6
|
+
import { COLOR_MAP as A, INFO as B, INFO_COLORS as D, ERROR as M } from "./constants.js";
|
|
7
|
+
import { ToastWrapper as I, Message as W, Title as _, Subtitle as z, CloseButtonContainer as q, ProgressRing as G, CloseWrapper as H, ToastsContainer as J } from "./styles.js";
|
|
8
8
|
const x = () => {
|
|
9
|
-
},
|
|
10
|
-
const [o,
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
}, re = ({ toasts: e, ...r }) => {
|
|
10
|
+
const [o, n] = i(e);
|
|
11
|
+
C(() => {
|
|
12
|
+
n(e);
|
|
13
13
|
}, [e]);
|
|
14
|
-
const
|
|
14
|
+
const l = ({ type: u, id: a, title: m, subtitle: d, duration: s, onExpire: f = x }, T) => /* @__PURE__ */ N(K, { type: u, title: m, subtitle: d, duration: s, key: a, onExpire: f });
|
|
15
15
|
return b(
|
|
16
|
-
/* @__PURE__ */ t(
|
|
16
|
+
/* @__PURE__ */ t(J, { ...r, children: [...o].reverse().map(l) }),
|
|
17
17
|
document.body
|
|
18
18
|
);
|
|
19
|
-
},
|
|
19
|
+
}, v = (e, r, o) => () => {
|
|
20
20
|
e(!0), setTimeout(() => {
|
|
21
21
|
r(!1), o();
|
|
22
22
|
}, 500);
|
|
23
|
-
},
|
|
24
|
-
type: e =
|
|
23
|
+
}, K = ({
|
|
24
|
+
type: e = B,
|
|
25
25
|
visible: r = !0,
|
|
26
26
|
duration: o = 5,
|
|
27
|
-
onExpire:
|
|
27
|
+
onExpire: n = x,
|
|
28
|
+
hasClockwiseRotation: l = !1,
|
|
28
29
|
title: u,
|
|
29
30
|
subtitle: a,
|
|
30
31
|
...m
|
|
31
32
|
}) => {
|
|
32
|
-
const [d,
|
|
33
|
-
g.current = Date.now(),
|
|
33
|
+
const [d, s] = i(r), [f, T] = i(!1), [L, O] = i(!1), h = R(null), p = R((o - 0.5) * 1e3), g = R(null), $ = (F) => {
|
|
34
|
+
g.current = Date.now(), h.current = setTimeout(v(T, s, n), F);
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [r]),
|
|
38
|
-
const
|
|
39
|
-
clearTimeout(
|
|
40
|
-
},
|
|
36
|
+
C(() => {
|
|
37
|
+
s(r);
|
|
38
|
+
}, [r]), C(() => ($(p.current), () => clearTimeout(h.current)), []);
|
|
39
|
+
const E = () => {
|
|
40
|
+
clearTimeout(h.current), p.current -= Date.now() - g.current, O(!0);
|
|
41
|
+
}, P = () => {
|
|
41
42
|
O(!1), $(p.current);
|
|
42
|
-
}, { main:
|
|
43
|
+
}, { main: w, side: S, bg: k } = A[e] ?? D;
|
|
43
44
|
if (d)
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
45
|
+
return /* @__PURE__ */ c(
|
|
46
|
+
I,
|
|
46
47
|
{
|
|
47
|
-
$bg:
|
|
48
|
-
role: e ===
|
|
49
|
-
"aria-live": e ===
|
|
48
|
+
$bg: k,
|
|
49
|
+
role: e === M ? "alert" : "status",
|
|
50
|
+
"aria-live": e === M ? "assertive" : "polite",
|
|
50
51
|
"aria-atomic": "true",
|
|
51
52
|
className: `${f ? "fade-out" : "fade-in"}`,
|
|
52
|
-
onMouseEnter:
|
|
53
|
-
onMouseLeave:
|
|
53
|
+
onMouseEnter: E,
|
|
54
|
+
onMouseLeave: P,
|
|
54
55
|
...m,
|
|
55
56
|
children: [
|
|
56
|
-
/* @__PURE__ */ t(j, { type: e, $main:
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */ t(
|
|
59
|
-
a && /* @__PURE__ */ t(
|
|
57
|
+
/* @__PURE__ */ t(j, { type: e, $main: w, $side: S }),
|
|
58
|
+
/* @__PURE__ */ c(W, { children: [
|
|
59
|
+
/* @__PURE__ */ t(_, { children: u }),
|
|
60
|
+
a && /* @__PURE__ */ t(z, { children: a })
|
|
60
61
|
] }),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
62
|
+
/* @__PURE__ */ c(q, { children: [
|
|
63
|
+
/* @__PURE__ */ c(
|
|
64
|
+
G,
|
|
64
65
|
{
|
|
65
66
|
"aria-hidden": "true",
|
|
66
67
|
viewBox: "0 0 28 28",
|
|
67
68
|
$duration: o,
|
|
68
|
-
$color:
|
|
69
|
-
$paused:
|
|
69
|
+
$color: w,
|
|
70
|
+
$paused: L,
|
|
71
|
+
$hasClockwiseRotation: l,
|
|
70
72
|
children: [
|
|
71
73
|
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" }),
|
|
72
74
|
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" })
|
|
@@ -74,12 +76,12 @@ const x = () => {
|
|
|
74
76
|
}
|
|
75
77
|
),
|
|
76
78
|
/* @__PURE__ */ t(
|
|
77
|
-
|
|
79
|
+
H,
|
|
78
80
|
{
|
|
79
81
|
"aria-label": "Close notification",
|
|
80
82
|
size: 13,
|
|
81
|
-
color:
|
|
82
|
-
onClick:
|
|
83
|
+
color: y.m600,
|
|
84
|
+
onClick: v(T, s, n)
|
|
83
85
|
}
|
|
84
86
|
)
|
|
85
87
|
] })
|
|
@@ -88,6 +90,6 @@ const x = () => {
|
|
|
88
90
|
);
|
|
89
91
|
};
|
|
90
92
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
re as ToastContainer,
|
|
94
|
+
K as default
|
|
93
95
|
};
|
|
@@ -182,7 +182,7 @@ const s = r`
|
|
|
182
182
|
`, k = t.svg`
|
|
183
183
|
position: absolute;
|
|
184
184
|
inset: 0;
|
|
185
|
-
transform: rotate(-90deg);
|
|
185
|
+
transform: ${({ $hasClockwiseRotation: e }) => e ? "rotate(-90deg)" : "rotate(90deg) scaleX(-1)"};
|
|
186
186
|
pointer-events: none;
|
|
187
187
|
|
|
188
188
|
circle {
|
|
@@ -235,7 +235,7 @@ const s = r`
|
|
|
235
235
|
max-width: 18rem;
|
|
236
236
|
width: auto;
|
|
237
237
|
}
|
|
238
|
-
`,
|
|
238
|
+
`, X = t.div`
|
|
239
239
|
font-weight: 400;
|
|
240
240
|
font-size: 1.6rem;
|
|
241
241
|
color: ${a.m700};
|
|
@@ -257,7 +257,7 @@ export {
|
|
|
257
257
|
b as Outer,
|
|
258
258
|
y as OuterChild,
|
|
259
259
|
k as ProgressRing,
|
|
260
|
-
|
|
260
|
+
X as Subtitle,
|
|
261
261
|
z as Title,
|
|
262
262
|
g as ToastWrapper,
|
|
263
263
|
w as ToastsContainer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"types": "./index.d.ts",
|