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