meticulous-ui 3.0.5 → 3.0.7
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/README.md +21 -20
- package/components/Button/Button.js +17 -16
- package/components/Image/Image.js +10 -9
- package/components/Input/FileUploader/FileUploader.js +31 -33
- package/components/OtpInput/OtpInput.js +36 -44
- package/components/OtpInput/helpers.js +15 -13
- package/components/OtpInput/styles.js +1 -1
- package/components/Toast/Toast.js +31 -31
- package/components/Toast/helpers.js +13 -13
- package/components/Toast/styles.js +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,26 +58,27 @@ import blue from 'meticulous-ui/colors/blue';
|
|
|
58
58
|
|
|
59
59
|
## 📦 Components
|
|
60
60
|
|
|
61
|
-
| Component
|
|
62
|
-
|
|
|
63
|
-
| `Pagination`
|
|
64
|
-
| `Toast`
|
|
65
|
-
| `Timer`
|
|
66
|
-
| `OtpInput`
|
|
67
|
-
| `VideoPlayer`
|
|
68
|
-
| `Image`
|
|
69
|
-
| `Input`
|
|
70
|
-
| `Checkbox`
|
|
71
|
-
| `RadioGroup`
|
|
72
|
-
| `FileUploader`
|
|
73
|
-
| `Textarea`
|
|
74
|
-
| `Dropdown`
|
|
75
|
-
| `SelectBox`
|
|
76
|
-
| `Spinner`
|
|
77
|
-
| `Loader`
|
|
78
|
-
| `PageLoader`
|
|
79
|
-
| `Button`
|
|
80
|
-
| `Shimmer`
|
|
61
|
+
| Component | Description |
|
|
62
|
+
| --------------- | ---------------------------------------------------------------- |
|
|
63
|
+
| `Pagination` | Fully responsive pagination component |
|
|
64
|
+
| `Toast` | Push 4 types of notifications on screen |
|
|
65
|
+
| `Timer` | Renders analog / digital clock with alarm |
|
|
66
|
+
| `OtpInput` | Gives inputs to enter and edit OTP |
|
|
67
|
+
| `VideoPlayer` | Renders video with keyboard shortcuts |
|
|
68
|
+
| `Image` | Renders image with shimmer, lower resolution |
|
|
69
|
+
| `Input` | Renders input box to let user enter input |
|
|
70
|
+
| `Checkbox` | Renders checkbox to let user give boolean value |
|
|
71
|
+
| `RadioGroup` | Renders radio options in a group to let user select |
|
|
72
|
+
| `FileUploader` | Renders a button type input from where user can upload |
|
|
73
|
+
| `Textarea` | Renders textarea box to let user enter description |
|
|
74
|
+
| `Dropdown` | Renders dropdown to select from options |
|
|
75
|
+
| `SelectBox` | Renders selectbox to select multiple values from options |
|
|
76
|
+
| `Spinner` | Renders a spinner to show the loading state |
|
|
77
|
+
| `Loader` | Renders a loader with dots to show the loading state |
|
|
78
|
+
| `PageLoader` | Renders a loader with line at the top of page |
|
|
79
|
+
| `Button` | Renders a button to click & take an action |
|
|
80
|
+
| `Shimmer` | Animated skeleton loading placeholder |
|
|
81
|
+
| `RootComponent` | This is the required wrapper for any app that uses meticulous-ui |
|
|
81
82
|
|
|
82
83
|
## 📦 Icon Components
|
|
83
84
|
|
|
@@ -2,7 +2,7 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as x } from "react";
|
|
3
3
|
import D from "../Spinner/Spinner.js";
|
|
4
4
|
import I from "../../colors/index.js";
|
|
5
|
-
import
|
|
5
|
+
import u from "../../colors/blue.js";
|
|
6
6
|
import { ButtonWrapper as R, SpinnerWrapper as B, Content as E, ButtonContainer as L } from "./styles.js";
|
|
7
7
|
import S from "../Ripple/Ripple.js";
|
|
8
8
|
import k from "../../colors/white.js";
|
|
@@ -11,41 +11,42 @@ import { MEDIUM as K, SIZE as M } from "./constants.js";
|
|
|
11
11
|
const P = ({ theme: t, children: i }) => /* @__PURE__ */ o(S, { rippleColor: t.m100, children: i }), Q = (t) => {
|
|
12
12
|
const {
|
|
13
13
|
children: i,
|
|
14
|
-
theme: n =
|
|
15
|
-
size:
|
|
14
|
+
theme: n = u,
|
|
15
|
+
size: C = K,
|
|
16
16
|
width: s,
|
|
17
17
|
leftIcon: W,
|
|
18
18
|
rightIcon: j,
|
|
19
|
-
isLoading:
|
|
19
|
+
isLoading: r,
|
|
20
20
|
textColor: d,
|
|
21
21
|
onKeyDown: l,
|
|
22
22
|
...w
|
|
23
|
-
} = t || {}, m = x(0), $ = (
|
|
24
|
-
if (
|
|
23
|
+
} = t || {}, m = x(0), $ = (e) => {
|
|
24
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
25
25
|
const f = Date.now();
|
|
26
26
|
if (f - m.current < 500) {
|
|
27
|
-
|
|
27
|
+
e.preventDefault(), e.stopPropagation();
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
m.current = f;
|
|
31
31
|
}
|
|
32
|
-
l == null || l(
|
|
33
|
-
}, { m400: g, m500: b, m600: y } = I[n] ??
|
|
32
|
+
l == null || l(e);
|
|
33
|
+
}, { m400: g, m500: b, m600: y } = I[n] ?? u, { height: c, width: p, font: v } = M[C] || {}, h = ["white", "yellow"].includes(n) ? z.m600 : k, a = /* @__PURE__ */ o(
|
|
34
34
|
R,
|
|
35
35
|
{
|
|
36
|
+
type: "button",
|
|
36
37
|
...w,
|
|
37
38
|
onKeyDown: $,
|
|
38
39
|
$hoverColor: b,
|
|
39
40
|
$activeColor: y,
|
|
40
41
|
$selectedColor: g,
|
|
41
42
|
$height: c,
|
|
42
|
-
$width: s ||
|
|
43
|
+
$width: s || p,
|
|
43
44
|
disabled: t.disabled,
|
|
44
|
-
$isLoading:
|
|
45
|
-
children:
|
|
45
|
+
$isLoading: r,
|
|
46
|
+
children: r ? /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(D, { size: "small", color: d || h }) }) : /* @__PURE__ */ o(
|
|
46
47
|
E,
|
|
47
48
|
{
|
|
48
|
-
$textColor: d ||
|
|
49
|
+
$textColor: d || h,
|
|
49
50
|
$font: v,
|
|
50
51
|
children: i
|
|
51
52
|
}
|
|
@@ -56,10 +57,10 @@ const P = ({ theme: t, children: i }) => /* @__PURE__ */ o(S, { rippleColor: t.m
|
|
|
56
57
|
L,
|
|
57
58
|
{
|
|
58
59
|
$height: c,
|
|
59
|
-
$width: s ||
|
|
60
|
+
$width: s || p,
|
|
60
61
|
disabled: t.disabled,
|
|
61
|
-
$isLoading:
|
|
62
|
-
children:
|
|
62
|
+
$isLoading: r,
|
|
63
|
+
children: r ? a : /* @__PURE__ */ o(P, { theme: n, children: a })
|
|
63
64
|
}
|
|
64
65
|
);
|
|
65
66
|
};
|
|
@@ -7,24 +7,24 @@ const o = (e) => {
|
|
|
7
7
|
return typeof e == "number" ? `${e}rem` : e;
|
|
8
8
|
}, k = ({
|
|
9
9
|
src: e,
|
|
10
|
-
alt:
|
|
10
|
+
alt: n = "",
|
|
11
11
|
width: c = "100%",
|
|
12
12
|
height: f = "100%",
|
|
13
13
|
borderRadius: r = "0.4rem",
|
|
14
14
|
loadLow: m = !1,
|
|
15
|
-
lowSrc:
|
|
16
|
-
...
|
|
15
|
+
lowSrc: i,
|
|
16
|
+
...l
|
|
17
17
|
}) => {
|
|
18
|
-
const [
|
|
18
|
+
const [u, h] = a(!1), [d, $] = a(!1), [s, L] = a(!1), p = () => h(!0), g = () => $(!0), w = () => L(!0), I = m ? u : d;
|
|
19
19
|
return /* @__PURE__ */ x(S, { $width: o(c), $height: o(f), $borderRadius: o(r), children: [
|
|
20
20
|
!s && /* @__PURE__ */ t(j, { $loaded: I, children: /* @__PURE__ */ t(y, { borderRadius: r }) }),
|
|
21
|
-
m &&
|
|
21
|
+
m && i && !s && /* @__PURE__ */ t(
|
|
22
22
|
E,
|
|
23
23
|
{
|
|
24
|
-
src:
|
|
24
|
+
src: i,
|
|
25
25
|
alt: "",
|
|
26
26
|
"aria-hidden": "true",
|
|
27
|
-
$lowLoaded:
|
|
27
|
+
$lowLoaded: u,
|
|
28
28
|
$loaded: d,
|
|
29
29
|
$borderRadius: o(r),
|
|
30
30
|
onLoad: p
|
|
@@ -34,12 +34,13 @@ const o = (e) => {
|
|
|
34
34
|
R,
|
|
35
35
|
{
|
|
36
36
|
src: e,
|
|
37
|
-
alt:
|
|
37
|
+
alt: n,
|
|
38
|
+
"aria-hidden": n === "" ? "true" : void 0,
|
|
38
39
|
$loaded: d,
|
|
39
40
|
$borderRadius: o(r),
|
|
40
41
|
onLoad: g,
|
|
41
42
|
onError: w,
|
|
42
|
-
...
|
|
43
|
+
...l
|
|
43
44
|
}
|
|
44
45
|
)
|
|
45
46
|
] });
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
1
|
+
import { jsx as o, jsxs as U } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as C } from "react";
|
|
3
|
-
import { UploadBtnContainer as j, Wrapper as M, HiddenInput as W, PWrapper as
|
|
4
|
-
import
|
|
3
|
+
import { UploadBtnContainer as j, Wrapper as M, HiddenInput as W, PWrapper as B } from "./styles.js";
|
|
4
|
+
import F from "../../../colors/white.js";
|
|
5
5
|
import x from "../../../colors/blue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { SIZE as
|
|
11
|
-
const
|
|
12
|
-
label:
|
|
6
|
+
import H from "../../../colors/grey.js";
|
|
7
|
+
import P from "../../Icons/Link/Link.js";
|
|
8
|
+
import Z from "../../../colors/index.js";
|
|
9
|
+
import q from "../../Ripple/Ripple.js";
|
|
10
|
+
import { SIZE as A, MEDIUM as G } from "./constants.js";
|
|
11
|
+
const J = ({ theme: t, children: l }) => /* @__PURE__ */ o(q, { rippleColor: t.m100, children: l }), oo = ({
|
|
12
|
+
label: t,
|
|
13
13
|
labelColor: l,
|
|
14
14
|
theme: p = x,
|
|
15
|
-
size: D =
|
|
15
|
+
size: D = G,
|
|
16
16
|
width: s,
|
|
17
|
-
isLoading:
|
|
17
|
+
isLoading: e,
|
|
18
18
|
disabled: r,
|
|
19
|
-
prefixIcon: c =
|
|
19
|
+
prefixIcon: c = P,
|
|
20
20
|
suffixIcon: m,
|
|
21
21
|
type: I = "file",
|
|
22
22
|
accept: R,
|
|
@@ -24,37 +24,35 @@ const G = ({ theme: e, children: l }) => /* @__PURE__ */ o(Z, { rippleColor: e.m
|
|
|
24
24
|
onChange: z,
|
|
25
25
|
...K
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
27
|
+
const h = C(null), { m400: g, m500: v, m600: E } = Z[p] ?? x, { height: u, width: $, font: n } = A[D] || {}, f = l || ["white", "yellow"].includes(p) ? H.m600 : F, a = C(0), d = /* @__PURE__ */ U(
|
|
28
28
|
M,
|
|
29
29
|
{
|
|
30
|
-
$selectedColor:
|
|
31
|
-
$hoverColor:
|
|
32
|
-
$height:
|
|
33
|
-
$width: s ||
|
|
34
|
-
$activeColor:
|
|
30
|
+
$selectedColor: g,
|
|
31
|
+
$hoverColor: v,
|
|
32
|
+
$height: u,
|
|
33
|
+
$width: s || $,
|
|
34
|
+
$activeColor: E,
|
|
35
35
|
disabled: r,
|
|
36
|
-
$isLoading:
|
|
37
|
-
role: "button",
|
|
36
|
+
$isLoading: e,
|
|
38
37
|
tabIndex: 0,
|
|
39
38
|
"aria-disabled": r,
|
|
40
|
-
"aria-busy": t,
|
|
41
39
|
onKeyDown: (i) => {
|
|
42
|
-
var
|
|
40
|
+
var w;
|
|
43
41
|
if (i.key === "Enter" || i.key === " ") {
|
|
44
42
|
i.preventDefault();
|
|
45
43
|
const y = Date.now();
|
|
46
|
-
if (y -
|
|
44
|
+
if (y - a.current < 500) {
|
|
47
45
|
i.stopPropagation();
|
|
48
46
|
return;
|
|
49
47
|
}
|
|
50
|
-
|
|
48
|
+
a.current = y, !r && !e && ((w = h.current) == null || w.click());
|
|
51
49
|
}
|
|
52
50
|
},
|
|
53
51
|
children: [
|
|
54
52
|
/* @__PURE__ */ o(
|
|
55
53
|
W,
|
|
56
54
|
{
|
|
57
|
-
ref:
|
|
55
|
+
ref: h,
|
|
58
56
|
type: I,
|
|
59
57
|
accept: R,
|
|
60
58
|
multiple: k,
|
|
@@ -65,15 +63,15 @@ const G = ({ theme: e, children: l }) => /* @__PURE__ */ o(Z, { rippleColor: e.m
|
|
|
65
63
|
),
|
|
66
64
|
c && /* @__PURE__ */ o(c, { color: f, size: n + 19 }),
|
|
67
65
|
/* @__PURE__ */ o(
|
|
68
|
-
|
|
66
|
+
B,
|
|
69
67
|
{
|
|
70
68
|
color: f,
|
|
71
69
|
size: `${n}rem`,
|
|
72
70
|
$prefixIcon: !!c,
|
|
73
71
|
$suffixIcon: !!m,
|
|
74
72
|
$iconSize: n + 19,
|
|
75
|
-
title:
|
|
76
|
-
children:
|
|
73
|
+
title: t,
|
|
74
|
+
children: t
|
|
77
75
|
}
|
|
78
76
|
),
|
|
79
77
|
m && /* @__PURE__ */ o(m, { color: f, size: n + 19 })
|
|
@@ -83,12 +81,12 @@ const G = ({ theme: e, children: l }) => /* @__PURE__ */ o(Z, { rippleColor: e.m
|
|
|
83
81
|
return /* @__PURE__ */ o(
|
|
84
82
|
j,
|
|
85
83
|
{
|
|
86
|
-
$height:
|
|
87
|
-
$width: s ||
|
|
84
|
+
$height: u,
|
|
85
|
+
$width: s || $,
|
|
88
86
|
disabled: r,
|
|
89
|
-
$isLoading:
|
|
87
|
+
$isLoading: e,
|
|
90
88
|
...K,
|
|
91
|
-
children:
|
|
89
|
+
children: e || r ? d : /* @__PURE__ */ o(J, { theme: p, children: d })
|
|
92
90
|
}
|
|
93
91
|
);
|
|
94
92
|
};
|
|
@@ -1,59 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { OTPWrapper as
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I, useRef as y, useEffect as P } from "react";
|
|
3
|
+
import { OTPWrapper as j } from "./styles.js";
|
|
4
4
|
import { renderNums as b } from "./helpers.js";
|
|
5
|
-
const B = ({ length:
|
|
6
|
-
const [a, D] =
|
|
5
|
+
const B = ({ length: s = 6, value: p = "", onChange: n, onComplete: e, ...O }) => {
|
|
6
|
+
const [a, D] = I(Array(s).fill("")), d = y([]), w = y(a), o = y(!1), f = (r) => {
|
|
7
7
|
var t;
|
|
8
|
-
o.current = !0, (t = d.current[
|
|
8
|
+
o.current = !0, (t = d.current[r]) == null || t.focus();
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
P(() => {
|
|
11
11
|
if (!p) return;
|
|
12
|
-
const
|
|
13
|
-
for (; t.length <
|
|
14
|
-
D(t),
|
|
15
|
-
}, [p,
|
|
16
|
-
const l = (
|
|
17
|
-
w.current =
|
|
18
|
-
const t =
|
|
19
|
-
|
|
20
|
-
}, k = (
|
|
21
|
-
|
|
12
|
+
const r = String(p).replace(/\D/g, "").slice(0, s), t = r.split("");
|
|
13
|
+
for (; t.length < s; ) t.push("");
|
|
14
|
+
D(t), r.length === s && (e == null || e(r));
|
|
15
|
+
}, [p, s, e]);
|
|
16
|
+
const l = (r) => {
|
|
17
|
+
w.current = r, D(r);
|
|
18
|
+
const t = r.join("");
|
|
19
|
+
n == null || n(t), t.length === s && (e == null || e(t));
|
|
20
|
+
}, k = (r, t) => {
|
|
21
|
+
r = r.replace(/\D/g, "").slice(-1);
|
|
22
22
|
const c = [...a];
|
|
23
|
-
c[t] =
|
|
24
|
-
}, m = (
|
|
25
|
-
const c = a.findIndex((
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
|
|
23
|
+
c[t] = r, l(c), r && t < s - 1 && f(t + 1);
|
|
24
|
+
}, m = (r, t) => {
|
|
25
|
+
const c = a.findIndex((u) => u === ""), i = c === -1 ? s - 1 : c;
|
|
26
|
+
if (r.key === "Backspace") {
|
|
27
|
+
if (r.preventDefault(), a[t]) {
|
|
28
|
+
const u = [...a];
|
|
29
|
+
u[t] = "", l(u);
|
|
30
30
|
}
|
|
31
31
|
t > 0 && f(t - 1);
|
|
32
|
-
} else
|
|
33
|
-
}, R = (
|
|
32
|
+
} else r.key === "ArrowLeft" && t > 0 ? (r.preventDefault(), f(t - 1)) : r.key === "ArrowRight" ? (r.preventDefault(), t + 1 <= i && f(t + 1)) : r.key === "Tab" && (r.preventDefault(), r.shiftKey ? t > 0 && f(t - 1) : f(i));
|
|
33
|
+
}, R = (r) => {
|
|
34
34
|
if (o.current) {
|
|
35
35
|
o.current = !1;
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
const t = w.current.findIndex((i) => i === ""), c = t === -1 ?
|
|
39
|
-
|
|
38
|
+
const t = w.current.findIndex((i) => i === ""), c = t === -1 ? s - 1 : t;
|
|
39
|
+
r !== c && f(c);
|
|
40
40
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
t.slice(0, r).split("").forEach((n, j) => c[j] = n), l(c);
|
|
50
|
-
const i = Math.min(t.length - 1, r - 1);
|
|
51
|
-
f(i);
|
|
52
|
-
},
|
|
53
|
-
...O,
|
|
54
|
-
children: a.map(b({ inputsRef: d, handleChange: k, handleKeyDown: m, handleFocus: R }))
|
|
55
|
-
}
|
|
56
|
-
);
|
|
41
|
+
return /* @__PURE__ */ E(j, { onPaste: (r) => {
|
|
42
|
+
const t = r.clipboardData.getData("text").replace(/\D/g, "");
|
|
43
|
+
if (!t) return;
|
|
44
|
+
const c = Array(s).fill("");
|
|
45
|
+
t.slice(0, s).split("").forEach((u, A) => c[A] = u), l(c);
|
|
46
|
+
const i = Math.min(t.length - 1, s - 1);
|
|
47
|
+
f(i);
|
|
48
|
+
}, ...O, children: a.map(b({ inputsRef: d, handleChange: k, handleKeyDown: m, handleFocus: R, length: s })) });
|
|
57
49
|
};
|
|
58
50
|
export {
|
|
59
51
|
B as default
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { Input as
|
|
3
|
-
const
|
|
2
|
+
import { Input as s } from "./styles.js";
|
|
3
|
+
const g = (o, t) => (n) => {
|
|
4
4
|
o(n.target.value, t);
|
|
5
|
-
},
|
|
6
|
-
|
|
5
|
+
}, l = (o, t) => (n) => o(n, t), p = ({ inputsRef: o, handleChange: t, handleKeyDown: n, handleFocus: a, digit: u, index: e, length: r }) => /* @__PURE__ */ m(
|
|
6
|
+
s,
|
|
7
7
|
{
|
|
8
8
|
ref: (c) => o.current[e] = c,
|
|
9
9
|
maxLength: 1,
|
|
10
10
|
inputMode: "numeric",
|
|
11
11
|
autoComplete: "one-time-code",
|
|
12
|
+
"aria-label": `Digit ${e + 1} of ${r}`,
|
|
12
13
|
value: u,
|
|
13
|
-
onChange:
|
|
14
|
-
onKeyDown:
|
|
15
|
-
onFocus: () =>
|
|
14
|
+
onChange: g(t, e),
|
|
15
|
+
onKeyDown: l(n, e),
|
|
16
|
+
onFocus: () => a(e)
|
|
16
17
|
},
|
|
17
18
|
`key-${e}`
|
|
18
|
-
), y = ({ inputsRef: o, handleChange: t, handleKeyDown: n, handleFocus:
|
|
19
|
-
|
|
19
|
+
), y = ({ inputsRef: o, handleChange: t, handleKeyDown: n, handleFocus: a, length: u }) => (e, r) => /* @__PURE__ */ m(
|
|
20
|
+
p,
|
|
20
21
|
{
|
|
21
22
|
inputsRef: o,
|
|
22
23
|
handleChange: t,
|
|
23
24
|
handleKeyDown: n,
|
|
24
|
-
handleFocus:
|
|
25
|
-
digit:
|
|
26
|
-
index:
|
|
25
|
+
handleFocus: a,
|
|
26
|
+
digit: e,
|
|
27
|
+
index: r,
|
|
28
|
+
length: u
|
|
27
29
|
},
|
|
28
|
-
`otp-num-${
|
|
30
|
+
`otp-num-${r}`
|
|
29
31
|
);
|
|
30
32
|
export {
|
|
31
33
|
y as renderNums
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useRef as h, useEffect as R, createElement as N } from "react";
|
|
3
3
|
import { createPortal as b } from "react-dom";
|
|
4
4
|
import { Logo as j } from "./helpers.js";
|
|
5
5
|
import k from "../../colors/grey.js";
|
|
6
|
-
import { COLOR_MAP as y, INFO as A, INFO_COLORS as B, ERROR as
|
|
6
|
+
import { COLOR_MAP as y, INFO as A, INFO_COLORS as B, ERROR as v } from "./constants.js";
|
|
7
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
|
|
8
|
+
const x = () => {
|
|
9
9
|
}, ee = ({ toasts: e, ...r }) => {
|
|
10
|
-
const [o, s] =
|
|
10
|
+
const [o, s] = l(e);
|
|
11
11
|
R(() => {
|
|
12
12
|
s(e);
|
|
13
13
|
}, [e]);
|
|
14
|
-
const
|
|
14
|
+
const u = ({ type: a, id: m, title: d, subtitle: n, duration: f, onExpire: c = x }, C) => /* @__PURE__ */ N(J, { type: a, title: d, subtitle: n, duration: f, key: m, onExpire: c });
|
|
15
15
|
return b(
|
|
16
|
-
/* @__PURE__ */ t(H, { ...r, children: [...o].reverse().map(
|
|
16
|
+
/* @__PURE__ */ t(H, { ...r, children: [...o].reverse().map(u) }),
|
|
17
17
|
document.body
|
|
18
18
|
);
|
|
19
|
-
},
|
|
19
|
+
}, w = (e, r, o) => () => {
|
|
20
20
|
e(!0), setTimeout(() => {
|
|
21
21
|
r(!1), o();
|
|
22
22
|
}, 500);
|
|
@@ -24,49 +24,49 @@ const w = () => {
|
|
|
24
24
|
type: e = A,
|
|
25
25
|
visible: r = !0,
|
|
26
26
|
duration: o = 5,
|
|
27
|
-
onExpire: s =
|
|
28
|
-
title:
|
|
27
|
+
onExpire: s = x,
|
|
28
|
+
title: u,
|
|
29
29
|
subtitle: a,
|
|
30
|
-
...
|
|
30
|
+
...m
|
|
31
31
|
}) => {
|
|
32
|
-
const [
|
|
33
|
-
|
|
32
|
+
const [d, n] = l(r), [f, c] = l(!1), [C, O] = l(!1), T = h(null), p = h((o - 0.5) * 1e3), g = h(null), $ = (F) => {
|
|
33
|
+
g.current = Date.now(), T.current = setTimeout(w(c, n, s), F);
|
|
34
34
|
};
|
|
35
35
|
R(() => {
|
|
36
36
|
n(r);
|
|
37
|
-
}, [r]), R(() => (
|
|
37
|
+
}, [r]), R(() => ($(p.current), () => clearTimeout(T.current)), []);
|
|
38
38
|
const L = () => {
|
|
39
|
-
clearTimeout(T.current), p.current -= Date.now() -
|
|
39
|
+
clearTimeout(T.current), p.current -= Date.now() - g.current, O(!0);
|
|
40
40
|
}, E = () => {
|
|
41
|
-
|
|
42
|
-
}, { main:
|
|
43
|
-
if (
|
|
44
|
-
return /* @__PURE__ */
|
|
41
|
+
O(!1), $(p.current);
|
|
42
|
+
}, { main: M, side: P, bg: S } = y[e] ?? B;
|
|
43
|
+
if (d)
|
|
44
|
+
return /* @__PURE__ */ i(
|
|
45
45
|
D,
|
|
46
46
|
{
|
|
47
47
|
$bg: S,
|
|
48
|
-
role: e ===
|
|
49
|
-
"aria-live": e ===
|
|
48
|
+
role: e === v ? "alert" : "status",
|
|
49
|
+
"aria-live": e === v ? "assertive" : "polite",
|
|
50
50
|
"aria-atomic": "true",
|
|
51
|
-
className: `${
|
|
51
|
+
className: `${f ? "fade-out" : "fade-in"}`,
|
|
52
52
|
onMouseEnter: L,
|
|
53
53
|
onMouseLeave: E,
|
|
54
|
-
...
|
|
54
|
+
...m,
|
|
55
55
|
children: [
|
|
56
|
-
/* @__PURE__ */ t(j, { type: e, $main:
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */ t(W, { children:
|
|
56
|
+
/* @__PURE__ */ t(j, { type: e, $main: M, $side: P }),
|
|
57
|
+
/* @__PURE__ */ i(I, { children: [
|
|
58
|
+
/* @__PURE__ */ t(W, { children: u }),
|
|
59
59
|
a && /* @__PURE__ */ t(_, { children: a })
|
|
60
60
|
] }),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ i(z, { children: [
|
|
62
|
+
/* @__PURE__ */ i(
|
|
63
63
|
q,
|
|
64
64
|
{
|
|
65
65
|
"aria-hidden": "true",
|
|
66
66
|
viewBox: "0 0 28 28",
|
|
67
67
|
$duration: o,
|
|
68
|
-
$color:
|
|
69
|
-
$paused:
|
|
68
|
+
$color: M,
|
|
69
|
+
$paused: C,
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" }),
|
|
72
72
|
/* @__PURE__ */ t("circle", { cx: "14", cy: "14", r: "12" })
|
|
@@ -79,7 +79,7 @@ const w = () => {
|
|
|
79
79
|
"aria-label": "Close notification",
|
|
80
80
|
size: 13,
|
|
81
81
|
color: k.m600,
|
|
82
|
-
onClick:
|
|
82
|
+
onClick: w(c, n, s)
|
|
83
83
|
}
|
|
84
84
|
)
|
|
85
85
|
] })
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { WARNING as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { WARNING as n, ERROR as t, SUCCESS as s } from "./constants.js";
|
|
3
|
+
import g from "../Icons/Close/Close.js";
|
|
4
4
|
import l from "../Icons/Check/Check.js";
|
|
5
5
|
import u from "../Icons/Info/Info.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Outer as
|
|
9
|
-
const L = (r, o) => r === t ? /* @__PURE__ */ i(
|
|
10
|
-
const m = L(r, o);
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */ i(
|
|
13
|
-
|
|
14
|
-
/* @__PURE__ */ i(I, { size: R(r), children: m })
|
|
6
|
+
import C from "../Icons/WarningTriangleFilled/WarningTriangleFilled.js";
|
|
7
|
+
import d from "../../colors/white.js";
|
|
8
|
+
import { Outer as h, OuterChild as z, LogoContainer as a, Icon as I } from "./styles.js";
|
|
9
|
+
const L = (r, o) => r === t ? /* @__PURE__ */ i(g, { size: 16, color: o }) : r === s ? /* @__PURE__ */ i(l, { size: 18, color: o }) : r === n ? /* @__PURE__ */ i(C, { size: 28, color: d }) : /* @__PURE__ */ i(u, { size: 22, color: o }), R = (r) => r === t ? 1.6 : r === s ? 1.76 : r === n ? 2.8 : 2.08, k = ({ type: r, $main: o, $side: f }) => {
|
|
10
|
+
const m = L(r, o), e = r === n;
|
|
11
|
+
return /* @__PURE__ */ c(h, { "aria-hidden": "true", $side: f, children: [
|
|
12
|
+
/* @__PURE__ */ i(z, { $main: o }),
|
|
13
|
+
!e && /* @__PURE__ */ i(a, { $main: o, type: r }),
|
|
14
|
+
/* @__PURE__ */ i(I, { size: R(r), $isWarning: e, children: m })
|
|
15
15
|
] });
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
k as Logo
|
|
19
19
|
};
|
|
@@ -89,9 +89,9 @@ const a = r`
|
|
|
89
89
|
width: 4.8rem;
|
|
90
90
|
height: 4.8rem;
|
|
91
91
|
}
|
|
92
|
-
`,
|
|
92
|
+
`, $ = t.div`
|
|
93
93
|
position: absolute;
|
|
94
|
-
top: 50
|
|
94
|
+
top: ${({ $isWarning: e }) => e ? "49%" : "50%"};
|
|
95
95
|
left: 50%;
|
|
96
96
|
transform: translate(-50%, -50%);
|
|
97
97
|
width: ${({ size: e }) => e}rem;
|
|
@@ -103,10 +103,13 @@ const a = r`
|
|
|
103
103
|
@media screen and (max-width: 768px) {
|
|
104
104
|
top: 42.8%;
|
|
105
105
|
left: 42.8%;
|
|
106
|
-
transform: translate(
|
|
106
|
+
transform: translate(
|
|
107
|
+
${({ $isWarning: e }) => e ? "-45.8%" : "-42.8%"},
|
|
108
|
+
${({ $isWarning: e }) => e ? "-50.8%" : "-42.8%"}
|
|
109
|
+
);
|
|
107
110
|
scale: 0.75;
|
|
108
111
|
}
|
|
109
|
-
`,
|
|
112
|
+
`, y = t.div`
|
|
110
113
|
position: absolute;
|
|
111
114
|
top: 50%;
|
|
112
115
|
left: 50%;
|
|
@@ -179,11 +182,11 @@ const a = r`
|
|
|
179
182
|
export {
|
|
180
183
|
v as CloseButtonContainer,
|
|
181
184
|
C as CloseWrapper,
|
|
182
|
-
|
|
185
|
+
$ as Icon,
|
|
183
186
|
x as LogoContainer,
|
|
184
187
|
z as Message,
|
|
185
188
|
b as Outer,
|
|
186
|
-
|
|
189
|
+
y as OuterChild,
|
|
187
190
|
k as ProgressRing,
|
|
188
191
|
I as Subtitle,
|
|
189
192
|
R as Title,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
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",
|