meticulous-ui 3.0.2 → 3.0.3
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 +57 -43
- package/components/Toast/helpers.js +5 -5
- package/components/Toast/styles.js +42 -34
- package/package.json +1 -1
|
@@ -1,71 +1,85 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { Logo as
|
|
5
|
-
import
|
|
6
|
-
import { COLOR_MAP as
|
|
7
|
-
import { ToastWrapper as D, Message as I, Title as W, Subtitle as _, CloseButtonContainer as
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useRef as h, useEffect as R, createElement as N } from "react";
|
|
3
|
+
import { createPortal as b } from "react-dom";
|
|
4
|
+
import { Logo as j } from "./helpers.js";
|
|
5
|
+
import k from "../../colors/grey.js";
|
|
6
|
+
import { COLOR_MAP as y, INFO as A, INFO_COLORS as B, ERROR as M } from "./constants.js";
|
|
7
|
+
import { ToastWrapper as D, Message as I, Title as W, Subtitle as _, CloseButtonContainer as z, ProgressRing as q, CloseWrapper as G, ToastsContainer as H } from "./styles.js";
|
|
8
8
|
const w = () => {
|
|
9
|
-
},
|
|
10
|
-
const [o, s] =
|
|
11
|
-
|
|
9
|
+
}, ee = ({ toasts: e, ...r }) => {
|
|
10
|
+
const [o, s] = i(e);
|
|
11
|
+
R(() => {
|
|
12
12
|
s(e);
|
|
13
13
|
}, [e]);
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
/* @__PURE__ */ t(
|
|
14
|
+
const l = ({ type: a, id: u, title: m, subtitle: n, onExpire: d = w }, f) => /* @__PURE__ */ N(J, { type: a, title: m, subtitle: n, key: u, onExpire: d });
|
|
15
|
+
return b(
|
|
16
|
+
/* @__PURE__ */ t(H, { ...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
|
-
},
|
|
23
|
+
}, J = ({
|
|
24
24
|
type: e = A,
|
|
25
25
|
visible: r = !0,
|
|
26
26
|
duration: o = 5,
|
|
27
27
|
onExpire: s = w,
|
|
28
|
-
title:
|
|
29
|
-
subtitle:
|
|
30
|
-
...
|
|
28
|
+
title: l,
|
|
29
|
+
subtitle: a,
|
|
30
|
+
...u
|
|
31
31
|
}) => {
|
|
32
|
-
const [m, n] =
|
|
33
|
-
O.current = Date.now(),
|
|
32
|
+
const [m, n] = i(r), [d, f] = i(!1), [x, C] = i(!1), T = h(null), p = h((o - 0.5) * 1e3), O = h(null), g = (F) => {
|
|
33
|
+
O.current = Date.now(), T.current = setTimeout(v(f, n, s), F);
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
R(() => {
|
|
36
36
|
n(r);
|
|
37
|
-
}, [r]),
|
|
37
|
+
}, [r]), R(() => (g(p.current), () => clearTimeout(T.current)), []);
|
|
38
38
|
const L = () => {
|
|
39
|
-
clearTimeout(
|
|
40
|
-
},
|
|
41
|
-
C(!1),
|
|
42
|
-
}, { main: $, side: P, bg: S } =
|
|
39
|
+
clearTimeout(T.current), p.current -= Date.now() - O.current, C(!0);
|
|
40
|
+
}, E = () => {
|
|
41
|
+
C(!1), g(p.current);
|
|
42
|
+
}, { main: $, side: P, bg: S } = y[e] ?? B;
|
|
43
43
|
if (m)
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ c(
|
|
45
45
|
D,
|
|
46
46
|
{
|
|
47
47
|
$bg: S,
|
|
48
|
+
role: e === M ? "alert" : "status",
|
|
49
|
+
"aria-live": e === M ? "assertive" : "polite",
|
|
50
|
+
"aria-atomic": "true",
|
|
48
51
|
className: `${d ? "fade-out" : "fade-in"}`,
|
|
49
52
|
onMouseEnter: L,
|
|
50
|
-
onMouseLeave:
|
|
51
|
-
...
|
|
53
|
+
onMouseLeave: E,
|
|
54
|
+
...u,
|
|
52
55
|
children: [
|
|
53
|
-
/* @__PURE__ */ t(
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ t(W, { children:
|
|
56
|
-
|
|
56
|
+
/* @__PURE__ */ t(j, { type: e, $main: $, $side: P }),
|
|
57
|
+
/* @__PURE__ */ c(I, { children: [
|
|
58
|
+
/* @__PURE__ */ t(W, { children: l }),
|
|
59
|
+
a && /* @__PURE__ */ t(_, { children: a })
|
|
57
60
|
] }),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" }),
|
|
61
|
-
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" })
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ t(
|
|
61
|
+
/* @__PURE__ */ c(z, { children: [
|
|
62
|
+
/* @__PURE__ */ c(
|
|
64
63
|
q,
|
|
65
64
|
{
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
viewBox: "0 0 28 28",
|
|
67
|
+
$duration: o,
|
|
68
|
+
$color: $,
|
|
69
|
+
$paused: x,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" }),
|
|
72
|
+
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ t(
|
|
77
|
+
G,
|
|
78
|
+
{
|
|
79
|
+
"aria-label": "Close notification",
|
|
66
80
|
size: 13,
|
|
67
|
-
color:
|
|
68
|
-
onClick:
|
|
81
|
+
color: k.m600,
|
|
82
|
+
onClick: v(f, n, s)
|
|
69
83
|
}
|
|
70
84
|
)
|
|
71
85
|
] })
|
|
@@ -74,6 +88,6 @@ const w = () => {
|
|
|
74
88
|
);
|
|
75
89
|
};
|
|
76
90
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
ee as ToastContainer,
|
|
92
|
+
J as default
|
|
79
93
|
};
|
|
@@ -2,14 +2,14 @@ import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { ERROR as t, SUCCESS as i } from "./constants.js";
|
|
3
3
|
import f from "../Icons/Close/Close.js";
|
|
4
4
|
import m from "../Icons/Check/Check.js";
|
|
5
|
-
import
|
|
6
|
-
import { Outer as
|
|
7
|
-
const h = (o, r) => o === t ? /* @__PURE__ */ e(f, { size: 16, color: r }) : o === i ? /* @__PURE__ */ e(m, { size: 18, color: r }) : /* @__PURE__ */ e(
|
|
5
|
+
import u from "../Icons/Info/Info.js";
|
|
6
|
+
import { Outer as g, OuterChild as l, LogoContainer as C, Icon as d } from "./styles.js";
|
|
7
|
+
const h = (o, r) => o === t ? /* @__PURE__ */ e(f, { size: 16, color: r }) : o === i ? /* @__PURE__ */ e(m, { size: 18, color: r }) : /* @__PURE__ */ e(u, { size: 22, color: r }), z = (o) => o === t ? 1.6 : o === i ? 1.76 : 2.08, R = ({ type: o, $main: r, $side: n }) => {
|
|
8
8
|
const s = h(o, r);
|
|
9
|
-
return /* @__PURE__ */ c(
|
|
9
|
+
return /* @__PURE__ */ c(g, { "aria-hidden": "true", $side: n, children: [
|
|
10
10
|
/* @__PURE__ */ e(l, { $main: r }),
|
|
11
11
|
/* @__PURE__ */ e(C, { $main: r, type: o }),
|
|
12
|
-
/* @__PURE__ */ e(
|
|
12
|
+
/* @__PURE__ */ e(d, { size: z(o), children: s })
|
|
13
13
|
] });
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import t, { keyframes as
|
|
2
|
-
import
|
|
1
|
+
import t, { keyframes as o, css as i } from "styled-components";
|
|
2
|
+
import s from "../../colors/white.js";
|
|
3
3
|
import m from "../Icons/Close/Close.js";
|
|
4
4
|
import d from "../../colors/grey.js";
|
|
5
5
|
import { WARNING as n } from "./constants.js";
|
|
6
|
-
const l =
|
|
6
|
+
const l = o`
|
|
7
|
+
from { transform: scale(0); }
|
|
8
|
+
to { transform: scale(1); }
|
|
9
|
+
`, c = o`
|
|
10
|
+
from { transform: translate(-50%, -50%) scale(0); }
|
|
11
|
+
to { transform: translate(-50%, -50%) scale(1); }
|
|
12
|
+
`, h = o`
|
|
7
13
|
from {
|
|
8
14
|
opacity: 0;
|
|
9
15
|
transform: translateX(100%); /* Start off-screen to the right */
|
|
@@ -12,7 +18,7 @@ const l = a`
|
|
|
12
18
|
opacity: 1;
|
|
13
19
|
transform: translateX(0); /* Move to its final position */
|
|
14
20
|
}
|
|
15
|
-
`,
|
|
21
|
+
`, f = o`
|
|
16
22
|
from {
|
|
17
23
|
opacity: 1;
|
|
18
24
|
transform: translateX(0);
|
|
@@ -21,7 +27,7 @@ const l = a`
|
|
|
21
27
|
opacity: 0;
|
|
22
28
|
transform: translateX(100%); /* Move off-screen to the right */
|
|
23
29
|
}
|
|
24
|
-
`,
|
|
30
|
+
`, $ = t.div`
|
|
25
31
|
position: fixed;
|
|
26
32
|
top: 1.6rem;
|
|
27
33
|
right: 1.6rem;
|
|
@@ -30,7 +36,7 @@ const l = a`
|
|
|
30
36
|
display: flex;
|
|
31
37
|
flex-direction: column;
|
|
32
38
|
gap: 1.6rem;
|
|
33
|
-
`,
|
|
39
|
+
`, y = t.div`
|
|
34
40
|
display: flex;
|
|
35
41
|
align-items: center;
|
|
36
42
|
justify-content: space-between;
|
|
@@ -44,12 +50,12 @@ const l = a`
|
|
|
44
50
|
|
|
45
51
|
&.fade-in {
|
|
46
52
|
opacity: 1;
|
|
47
|
-
animation: ${
|
|
53
|
+
animation: ${h} 0.5s ease-out forwards; /* slide down + fade */
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
&.fade-out {
|
|
51
57
|
opacity: 0;
|
|
52
|
-
animation: ${
|
|
58
|
+
animation: ${f} 0.5s ease-in forwards; /* slide right */
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
@media screen and (max-width: 768px) {
|
|
@@ -58,21 +64,21 @@ const l = a`
|
|
|
58
64
|
border-radius: 0.96rem;
|
|
59
65
|
padding: 0.48rem 1.28rem;
|
|
60
66
|
}
|
|
61
|
-
`,
|
|
67
|
+
`, v = t.div`
|
|
62
68
|
position: absolute;
|
|
63
69
|
top: 50%;
|
|
64
70
|
left: 50%;
|
|
65
71
|
transform: translate(-50%, -50%);
|
|
66
|
-
background-color: ${
|
|
72
|
+
background-color: ${s};
|
|
67
73
|
|
|
68
|
-
${({ type: e, $main: r }) => e === n ?
|
|
74
|
+
${({ type: e, $main: r }) => e === n ? i`
|
|
69
75
|
top: 48%;
|
|
70
|
-
border-color: ${r} ${r} ${
|
|
76
|
+
border-color: ${r} ${r} ${s} ${r};
|
|
71
77
|
border-style: solid;
|
|
72
78
|
border-width: 0 1.44rem 2.24rem 1.44rem;
|
|
73
79
|
height: 0;
|
|
74
80
|
width: 0;
|
|
75
|
-
` :
|
|
81
|
+
` : i`
|
|
76
82
|
top: 50%;
|
|
77
83
|
width: 2.88rem;
|
|
78
84
|
height: 2.88rem;
|
|
@@ -80,32 +86,33 @@ const l = a`
|
|
|
80
86
|
`}
|
|
81
87
|
|
|
82
88
|
@media screen and (max-width: 768px) {
|
|
83
|
-
${({ type: e, $main: r }) => e === n ?
|
|
89
|
+
${({ type: e, $main: r }) => e === n ? i`
|
|
84
90
|
top: 48%;
|
|
85
|
-
border-color: ${r} ${r} ${
|
|
91
|
+
border-color: ${r} ${r} ${s} ${r};
|
|
86
92
|
border-style: solid;
|
|
87
93
|
border-width: 0 1.12rem 1.68rem 1.088rem;
|
|
88
94
|
height: 0;
|
|
89
95
|
width: 0;
|
|
90
|
-
` :
|
|
96
|
+
` : i`
|
|
91
97
|
top: 50%;
|
|
92
98
|
width: 2.16rem;
|
|
93
99
|
height: 2.16rem;
|
|
94
100
|
border-radius: 50%;
|
|
95
101
|
`}
|
|
96
102
|
}
|
|
97
|
-
`,
|
|
103
|
+
`, k = t.div`
|
|
98
104
|
position: relative;
|
|
99
105
|
width: 6.4rem;
|
|
100
106
|
height: 6.4rem;
|
|
101
107
|
border-radius: 50%;
|
|
102
108
|
background-color: ${({ $side: e }) => e};
|
|
109
|
+
animation: ${l} 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
|
|
103
110
|
|
|
104
111
|
@media screen and (max-width: 768px) {
|
|
105
112
|
width: 4.8rem;
|
|
106
113
|
height: 4.8rem;
|
|
107
114
|
}
|
|
108
|
-
`,
|
|
115
|
+
`, C = t.div`
|
|
109
116
|
position: absolute;
|
|
110
117
|
top: 50%;
|
|
111
118
|
left: 50%;
|
|
@@ -119,7 +126,7 @@ const l = a`
|
|
|
119
126
|
transform: translate(-42.8%, -42.8%);
|
|
120
127
|
scale: 0.75;
|
|
121
128
|
}
|
|
122
|
-
`,
|
|
129
|
+
`, R = t.div`
|
|
123
130
|
position: absolute;
|
|
124
131
|
top: 50%;
|
|
125
132
|
left: 50%;
|
|
@@ -128,15 +135,16 @@ const l = a`
|
|
|
128
135
|
height: 4.8rem;
|
|
129
136
|
border-radius: 50%;
|
|
130
137
|
background-color: ${({ $main: e }) => e};
|
|
138
|
+
animation: ${c} 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.65s both;
|
|
131
139
|
|
|
132
140
|
@media screen and (max-width: 768px) {
|
|
133
141
|
width: 3.6rem;
|
|
134
142
|
height: 3.6rem;
|
|
135
143
|
}
|
|
136
|
-
`,
|
|
137
|
-
from { stroke-dashoffset: ${
|
|
144
|
+
`, a = 75.4, p = o`
|
|
145
|
+
from { stroke-dashoffset: ${a}; }
|
|
138
146
|
to { stroke-dashoffset: 0; }
|
|
139
|
-
`,
|
|
147
|
+
`, z = t.div`
|
|
140
148
|
position: relative;
|
|
141
149
|
display: inline-flex;
|
|
142
150
|
align-items: center;
|
|
@@ -155,7 +163,7 @@ const l = a`
|
|
|
155
163
|
stroke: ${({ $color: e }) => e};
|
|
156
164
|
stroke-width: 2;
|
|
157
165
|
stroke-linecap: round;
|
|
158
|
-
stroke-dasharray: ${
|
|
166
|
+
stroke-dasharray: ${a};
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
circle:first-child {
|
|
@@ -164,11 +172,11 @@ const l = a`
|
|
|
164
172
|
}
|
|
165
173
|
|
|
166
174
|
circle:last-child {
|
|
167
|
-
stroke-dashoffset: ${
|
|
168
|
-
animation: ${
|
|
175
|
+
stroke-dashoffset: ${a};
|
|
176
|
+
animation: ${p} ${({ $duration: e }) => e - 0.5}s linear forwards;
|
|
169
177
|
animation-play-state: ${({ $paused: e }) => e ? "paused" : "running"};
|
|
170
178
|
}
|
|
171
|
-
`,
|
|
179
|
+
`, G = t(m)`
|
|
172
180
|
cursor: pointer;
|
|
173
181
|
`, M = t.div`
|
|
174
182
|
font-weight: 600;
|
|
@@ -189,16 +197,16 @@ const l = a`
|
|
|
189
197
|
color: ${d.m700};
|
|
190
198
|
`;
|
|
191
199
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
200
|
+
z as CloseButtonContainer,
|
|
201
|
+
G as CloseWrapper,
|
|
202
|
+
C as Icon,
|
|
203
|
+
v as LogoContainer,
|
|
196
204
|
N as Message,
|
|
197
|
-
|
|
198
|
-
|
|
205
|
+
k as Outer,
|
|
206
|
+
R as OuterChild,
|
|
199
207
|
I as ProgressRing,
|
|
200
208
|
X as Subtitle,
|
|
201
209
|
M as Title,
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
y as ToastWrapper,
|
|
211
|
+
$ as ToastsContainer
|
|
204
212
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"license": "MIT",
|
|
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
|
"main": "./index.js",
|