meticulous-ui 3.0.1 → 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 +84 -46
- package/components/Toast/helpers.js +5 -5
- package/components/Toast/styles.js +79 -34
- package/package.json +1 -1
|
@@ -1,55 +1,93 @@
|
|
|
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
|
|
8
|
-
const
|
|
9
|
-
},
|
|
10
|
-
const [
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
const w = () => {
|
|
9
|
+
}, ee = ({ toasts: e, ...r }) => {
|
|
10
|
+
const [o, s] = i(e);
|
|
11
|
+
R(() => {
|
|
12
|
+
s(e);
|
|
13
13
|
}, [e]);
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
24
|
-
type: e =
|
|
25
|
-
visible:
|
|
26
|
-
duration:
|
|
27
|
-
onExpire:
|
|
28
|
-
title:
|
|
29
|
-
subtitle:
|
|
30
|
-
...
|
|
23
|
+
}, J = ({
|
|
24
|
+
type: e = A,
|
|
25
|
+
visible: r = !0,
|
|
26
|
+
duration: o = 5,
|
|
27
|
+
onExpire: s = w,
|
|
28
|
+
title: l,
|
|
29
|
+
subtitle: a,
|
|
30
|
+
...u
|
|
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] = 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
|
+
};
|
|
35
|
+
R(() => {
|
|
36
|
+
n(r);
|
|
37
|
+
}, [r]), R(() => (g(p.current), () => clearTimeout(T.current)), []);
|
|
38
|
+
const L = () => {
|
|
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
|
+
if (m)
|
|
44
|
+
return /* @__PURE__ */ c(
|
|
45
|
+
D,
|
|
46
|
+
{
|
|
47
|
+
$bg: S,
|
|
48
|
+
role: e === M ? "alert" : "status",
|
|
49
|
+
"aria-live": e === M ? "assertive" : "polite",
|
|
50
|
+
"aria-atomic": "true",
|
|
51
|
+
className: `${d ? "fade-out" : "fade-in"}`,
|
|
52
|
+
onMouseEnter: L,
|
|
53
|
+
onMouseLeave: E,
|
|
54
|
+
...u,
|
|
55
|
+
children: [
|
|
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 })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ c(z, { children: [
|
|
62
|
+
/* @__PURE__ */ c(
|
|
63
|
+
q,
|
|
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",
|
|
80
|
+
size: 13,
|
|
81
|
+
color: k.m600,
|
|
82
|
+
onClick: v(f, n, s)
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
51
89
|
};
|
|
52
90
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
91
|
+
ee as ToastContainer,
|
|
92
|
+
J as default
|
|
55
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import t, { keyframes as o, css as i } from "styled-components";
|
|
2
|
+
import s from "../../colors/white.js";
|
|
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 = 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 m = s`
|
|
|
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 m = s`
|
|
|
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 m = s`
|
|
|
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 m = s`
|
|
|
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 m = s`
|
|
|
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:
|
|
74
|
+
${({ type: e, $main: r }) => e === n ? i`
|
|
69
75
|
top: 48%;
|
|
70
|
-
border-color: ${
|
|
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 m = s`
|
|
|
80
86
|
`}
|
|
81
87
|
|
|
82
88
|
@media screen and (max-width: 768px) {
|
|
83
|
-
${({ type: e, $main:
|
|
89
|
+
${({ type: e, $main: r }) => e === n ? i`
|
|
84
90
|
top: 48%;
|
|
85
|
-
border-color: ${
|
|
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 m = s`
|
|
|
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,18 +135,54 @@ const m = s`
|
|
|
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
|
-
`,
|
|
144
|
+
`, a = 75.4, p = o`
|
|
145
|
+
from { stroke-dashoffset: ${a}; }
|
|
146
|
+
to { stroke-dashoffset: 0; }
|
|
147
|
+
`, z = t.div`
|
|
148
|
+
position: relative;
|
|
149
|
+
display: inline-flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
width: 2.8rem;
|
|
154
|
+
height: 2.8rem;
|
|
155
|
+
`, I = t.svg`
|
|
156
|
+
position: absolute;
|
|
157
|
+
inset: 0;
|
|
158
|
+
transform: rotate(-90deg);
|
|
159
|
+
pointer-events: none;
|
|
160
|
+
|
|
161
|
+
circle {
|
|
162
|
+
fill: none;
|
|
163
|
+
stroke: ${({ $color: e }) => e};
|
|
164
|
+
stroke-width: 2;
|
|
165
|
+
stroke-linecap: round;
|
|
166
|
+
stroke-dasharray: ${a};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
circle:first-child {
|
|
170
|
+
opacity: 0.15;
|
|
171
|
+
stroke-dashoffset: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
circle:last-child {
|
|
175
|
+
stroke-dashoffset: ${a};
|
|
176
|
+
animation: ${p} ${({ $duration: e }) => e - 0.5}s linear forwards;
|
|
177
|
+
animation-play-state: ${({ $paused: e }) => e ? "paused" : "running"};
|
|
178
|
+
}
|
|
179
|
+
`, G = t(m)`
|
|
137
180
|
cursor: pointer;
|
|
138
|
-
`,
|
|
181
|
+
`, M = t.div`
|
|
139
182
|
font-weight: 600;
|
|
140
183
|
font-size: 1.92rem;
|
|
141
184
|
color: ${d.m800};
|
|
142
|
-
`,
|
|
185
|
+
`, N = t.div`
|
|
143
186
|
display: flex;
|
|
144
187
|
flex-direction: column;
|
|
145
188
|
gap: 0.32rem;
|
|
@@ -148,20 +191,22 @@ const m = s`
|
|
|
148
191
|
@media screen and (max-width: 768px) {
|
|
149
192
|
width: 24rem;
|
|
150
193
|
}
|
|
151
|
-
`, X =
|
|
194
|
+
`, X = t.div`
|
|
152
195
|
font-weight: 400;
|
|
153
196
|
font-size: 1.6rem;
|
|
154
197
|
color: ${d.m700};
|
|
155
198
|
`;
|
|
156
199
|
export {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
200
|
+
z as CloseButtonContainer,
|
|
201
|
+
G as CloseWrapper,
|
|
202
|
+
C as Icon,
|
|
203
|
+
v as LogoContainer,
|
|
204
|
+
N as Message,
|
|
205
|
+
k as Outer,
|
|
206
|
+
R as OuterChild,
|
|
207
|
+
I as ProgressRing,
|
|
163
208
|
X as Subtitle,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
209
|
+
M as Title,
|
|
210
|
+
y as ToastWrapper,
|
|
211
|
+
$ as ToastsContainer
|
|
167
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",
|