meticulous-ui 2.5.6 → 2.6.0
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 +32 -19
- package/components/Button/Button.js +32 -33
- package/components/Dropdown/Dropdown.js +32 -33
- package/components/Input/Checkbox/Checkbox.js +38 -39
- package/components/Input/Checkbox/helpers.js +21 -22
- package/components/Input/FileUploader/FileUploader.js +18 -19
- package/components/Input/Input/Input.js +37 -37
- package/components/Input/Input/helpers.js +26 -27
- package/components/Input/Radio/Radio.js +15 -16
- package/components/Input/Textarea/Textarea.js +38 -38
- package/components/Input/Textarea/helpers.js +20 -21
- package/components/Loader/Loader.js +10 -11
- package/components/Loader/helpers.js +21 -22
- package/components/PageLoader/PageLoader.js +10 -11
- package/components/Pagination/Pagination.js +50 -52
- package/components/Selectbox/Selectbox.js +30 -31
- package/components/Shimmer/Shimmer.js +7 -18
- package/components/Shimmer/styles.js +29 -0
- package/components/Spinner/Spinner.js +14 -15
- package/components/Timer/Timer.js +19 -19
- package/components/Toast/Toast.js +26 -34
- package/components/Typography/P/P.js +3 -7
- package/package.json +9 -4
- package/utils/hasEqualProps.js +6 -4
|
@@ -1,93 +1,91 @@
|
|
|
1
1
|
import { jsxs as l, jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as x, useEffect as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import j from "
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { AllPages as $, MiddleLayer as u } from "./styles.js";
|
|
10
|
-
const H = ({
|
|
2
|
+
import { useRef as x, useEffect as _ } from "react";
|
|
3
|
+
import { PrevArrow as M, renderPageNum as d, NextArrow as R, renderThreeDots as $ } from "./helpers.js";
|
|
4
|
+
import K from "../../colors/index.js";
|
|
5
|
+
import a from "../../colors/teal.js";
|
|
6
|
+
import { ICON_SIZE_MAPPING as j, MEDIUM as G, SIZE_REM_MAPPING as L } from "./constants.js";
|
|
7
|
+
import { AllPages as u, MiddleLayer as v } from "./styles.js";
|
|
8
|
+
const k = ({
|
|
11
9
|
pageNumber: r,
|
|
12
10
|
setPageNumber: E,
|
|
13
11
|
totalPages: n,
|
|
14
12
|
theme: S = "lime",
|
|
15
|
-
size:
|
|
16
|
-
isDisabled:
|
|
13
|
+
size: o = G,
|
|
14
|
+
isDisabled: D = !1
|
|
17
15
|
}) => {
|
|
18
|
-
const s = x(null),
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
16
|
+
const s = x(null), h = x(!1);
|
|
17
|
+
_(() => {
|
|
18
|
+
var i, w;
|
|
19
|
+
h.current && (h.current = !1, (w = (i = s.current) == null ? void 0 : i.querySelector('[aria-current="page"]')) == null || w.focus());
|
|
22
20
|
}, [r]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
r > 1 &&
|
|
27
|
-
},
|
|
28
|
-
r < n &&
|
|
29
|
-
},
|
|
30
|
-
["ArrowLeft", "ArrowUp"].includes(
|
|
31
|
-
}, e =
|
|
21
|
+
const c = (i) => {
|
|
22
|
+
i !== r && E(i);
|
|
23
|
+
}, A = () => {
|
|
24
|
+
r > 1 && c(r - 1);
|
|
25
|
+
}, m = () => {
|
|
26
|
+
r < n && c(r + 1);
|
|
27
|
+
}, y = (i) => {
|
|
28
|
+
["ArrowLeft", "ArrowUp"].includes(i.code) && (h.current = !0, A()), ["ArrowRight", "ArrowDown"].includes(i.code) && (h.current = !0, m());
|
|
29
|
+
}, e = K[S] ?? a, I = L[o], t = j[o];
|
|
32
30
|
return n <= 7 ? /* @__PURE__ */ l(
|
|
33
|
-
|
|
31
|
+
u,
|
|
34
32
|
{
|
|
35
33
|
ref: s,
|
|
36
|
-
onKeyDown:
|
|
34
|
+
onKeyDown: y,
|
|
37
35
|
"aria-label": "Pagination",
|
|
38
|
-
$isDisabled:
|
|
36
|
+
$isDisabled: D,
|
|
39
37
|
children: [
|
|
40
|
-
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage:
|
|
41
|
-
/* @__PURE__ */ f(
|
|
42
|
-
d({ size:
|
|
38
|
+
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage: A }),
|
|
39
|
+
/* @__PURE__ */ f(v, { size: `${n * I}rem`, children: Array.from({ length: n }, (i, w) => w + 1).map(
|
|
40
|
+
d({ size: o, selected: r, shades: e, changePage: c })
|
|
43
41
|
) }),
|
|
44
|
-
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage:
|
|
42
|
+
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage: m })
|
|
45
43
|
]
|
|
46
44
|
}
|
|
47
45
|
) : n < 10 || r < 4 || r > n - 3 && r <= n ? /* @__PURE__ */ l(
|
|
48
|
-
|
|
46
|
+
u,
|
|
49
47
|
{
|
|
50
48
|
ref: s,
|
|
51
|
-
onKeyDown:
|
|
49
|
+
onKeyDown: y,
|
|
52
50
|
"aria-label": "Pagination",
|
|
53
|
-
$isDisabled:
|
|
51
|
+
$isDisabled: D,
|
|
54
52
|
children: [
|
|
55
|
-
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage:
|
|
56
|
-
/* @__PURE__ */ l(
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage: A }),
|
|
54
|
+
/* @__PURE__ */ l(v, { size: `${9 * I}rem`, children: [
|
|
55
|
+
[1, 2, 3, 4].map(d({ size: o, selected: r, shades: e, changePage: c })),
|
|
56
|
+
$(),
|
|
59
57
|
[n - 3, n - 2, n - 1, n].map(
|
|
60
|
-
d({ size:
|
|
58
|
+
d({ size: o, selected: r, shades: e, changePage: c })
|
|
61
59
|
)
|
|
62
60
|
] }),
|
|
63
|
-
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage:
|
|
61
|
+
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage: m })
|
|
64
62
|
]
|
|
65
63
|
}
|
|
66
64
|
) : /* @__PURE__ */ l(
|
|
67
|
-
|
|
65
|
+
u,
|
|
68
66
|
{
|
|
69
67
|
ref: s,
|
|
70
|
-
onKeyDown:
|
|
68
|
+
onKeyDown: y,
|
|
71
69
|
"aria-label": "Pagination",
|
|
72
|
-
$isDisabled:
|
|
70
|
+
$isDisabled: D,
|
|
73
71
|
children: [
|
|
74
|
-
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage:
|
|
75
|
-
/* @__PURE__ */ l(
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage: A }),
|
|
73
|
+
/* @__PURE__ */ l(v, { size: `${9 * I}rem`, children: [
|
|
74
|
+
[1, 2].map(d({ size: o, selected: r, shades: e, changePage: c })),
|
|
75
|
+
$(),
|
|
78
76
|
[r - 1, r, r + 1].map(
|
|
79
|
-
d({ size:
|
|
77
|
+
d({ size: o, selected: r, shades: e, changePage: c })
|
|
80
78
|
),
|
|
81
|
-
|
|
79
|
+
$(),
|
|
82
80
|
[n - 1, n].map(
|
|
83
|
-
d({ size:
|
|
81
|
+
d({ size: o, selected: r, shades: e, changePage: c })
|
|
84
82
|
)
|
|
85
83
|
] }),
|
|
86
|
-
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage:
|
|
84
|
+
/* @__PURE__ */ f(R, { iconSize: t, shades: e, setNextPage: m })
|
|
87
85
|
]
|
|
88
86
|
}
|
|
89
87
|
);
|
|
90
88
|
};
|
|
91
89
|
export {
|
|
92
|
-
|
|
90
|
+
k as default
|
|
93
91
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsxs as $, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as C, useId as T, useRef as v, useMemo as se, useEffect as I, useLayoutEffect as ce, useCallback as le } from "react";
|
|
3
|
-
import ae from "lodash-es/get";
|
|
4
3
|
import O from "../../colors/grey.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import ae from "../../colors/index.js";
|
|
5
|
+
import ue from "../../colors/blue.js";
|
|
6
|
+
import de from "../Input/Checkbox/Checkbox.js";
|
|
8
7
|
import U from "../Spinner/Spinner.js";
|
|
9
|
-
import { SelectBoxWrapper as
|
|
10
|
-
const
|
|
8
|
+
import { SelectBoxWrapper as pe, Box as fe, PWrapper as me, ChevronDownWrapper as he, OptionWrapper as be, SearchContainer as ge, SearchIcon as xe, SearchInput as we, OptionsList as $e, LoadMoreSentinel as Ce, SpinnerWrapper as Ie, CheckboxItem as ke } from "./styles.js";
|
|
9
|
+
const Se = (o) => {
|
|
11
10
|
if (typeof o != "string") return o;
|
|
12
11
|
if (o.endsWith("px")) return parseFloat(o);
|
|
13
12
|
if (o.endsWith("rem")) {
|
|
@@ -15,7 +14,7 @@ const ye = (o) => {
|
|
|
15
14
|
return E * c;
|
|
16
15
|
}
|
|
17
16
|
return parseFloat(o);
|
|
18
|
-
},
|
|
17
|
+
}, We = ({
|
|
19
18
|
options: o,
|
|
20
19
|
onChange: E,
|
|
21
20
|
value: c = [],
|
|
@@ -32,7 +31,7 @@ const ye = (o) => {
|
|
|
32
31
|
isLoadingMore: a = !1,
|
|
33
32
|
loaderColor: W
|
|
34
33
|
}) => {
|
|
35
|
-
const [r, g] = C(!1), [
|
|
34
|
+
const [r, g] = C(!1), [G, A] = C(!1), [J, X] = C("bottom"), [S, P] = C(""), [s, x] = C(-1), y = T(), H = T(), u = v(null), w = v(null), z = v(null), V = v(null), Y = () => !m && !k && g((e) => !e), B = (e) => {
|
|
36
35
|
const t = c.includes(e) ? c.filter((n) => n !== e) : [...c, e];
|
|
37
36
|
E(t);
|
|
38
37
|
}, d = se(() => {
|
|
@@ -60,20 +59,20 @@ const ye = (o) => {
|
|
|
60
59
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
61
60
|
}, []), ce(() => {
|
|
62
61
|
if (r && w.current && u.current) {
|
|
63
|
-
const e = u.current.getBoundingClientRect(), t = window.innerHeight, n =
|
|
64
|
-
|
|
62
|
+
const e = u.current.getBoundingClientRect(), t = window.innerHeight, n = Se(F), p = t - e.bottom;
|
|
63
|
+
X(
|
|
65
64
|
p < n + 8 && e.top > p ? "top" : "bottom"
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
}, [r, F]);
|
|
69
|
-
const
|
|
68
|
+
const Z = (e) => {
|
|
70
69
|
let t = e + 1;
|
|
71
70
|
for (; t < d.length; ) {
|
|
72
71
|
if (!d[t].disabled) return t;
|
|
73
72
|
t++;
|
|
74
73
|
}
|
|
75
74
|
return e;
|
|
76
|
-
},
|
|
75
|
+
}, _ = (e) => {
|
|
77
76
|
let t = e - 1;
|
|
78
77
|
for (; t >= 0; ) {
|
|
79
78
|
if (!d[t].disabled) return t;
|
|
@@ -103,12 +102,12 @@ const ye = (o) => {
|
|
|
103
102
|
switch (e.key) {
|
|
104
103
|
case "ArrowDown": {
|
|
105
104
|
e.preventDefault();
|
|
106
|
-
const n =
|
|
105
|
+
const n = Z(s);
|
|
107
106
|
n === s && b && !a && (l == null || l()), x(n);
|
|
108
107
|
break;
|
|
109
108
|
}
|
|
110
109
|
case "ArrowUp": {
|
|
111
|
-
e.preventDefault(), x(
|
|
110
|
+
e.preventDefault(), x(_(s));
|
|
112
111
|
break;
|
|
113
112
|
}
|
|
114
113
|
case "Enter":
|
|
@@ -127,10 +126,10 @@ const ye = (o) => {
|
|
|
127
126
|
m100: ee,
|
|
128
127
|
m500: K,
|
|
129
128
|
m800: te
|
|
130
|
-
} = ae
|
|
129
|
+
} = ae[N] ?? ue, re = (e, t) => () => !e && x(t), Q = (e) => `${y}-opt-${e}`, ne = c.length === 0 ? q : `${c.length} selected`, oe = ({ value: e, label: t, disabled: n }, p) => {
|
|
131
130
|
const D = c.includes(e);
|
|
132
131
|
return /* @__PURE__ */ i(
|
|
133
|
-
|
|
132
|
+
ke,
|
|
134
133
|
{
|
|
135
134
|
id: Q(p),
|
|
136
135
|
role: "option",
|
|
@@ -145,7 +144,7 @@ const ye = (o) => {
|
|
|
145
144
|
onMouseEnter: re(n, p),
|
|
146
145
|
title: t,
|
|
147
146
|
children: /* @__PURE__ */ i("div", { onClick: (ie) => ie.stopPropagation(), children: /* @__PURE__ */ i(
|
|
148
|
-
|
|
147
|
+
de,
|
|
149
148
|
{
|
|
150
149
|
value: D,
|
|
151
150
|
onChange: () => B(e),
|
|
@@ -161,7 +160,7 @@ const ye = (o) => {
|
|
|
161
160
|
);
|
|
162
161
|
};
|
|
163
162
|
return /* @__PURE__ */ $(
|
|
164
|
-
|
|
163
|
+
pe,
|
|
165
164
|
{
|
|
166
165
|
ref: u,
|
|
167
166
|
$width: f,
|
|
@@ -175,15 +174,15 @@ const ye = (o) => {
|
|
|
175
174
|
onFocus: () => A(!0),
|
|
176
175
|
children: [
|
|
177
176
|
/* @__PURE__ */ $(
|
|
178
|
-
|
|
177
|
+
fe,
|
|
179
178
|
{
|
|
180
179
|
id: H,
|
|
181
180
|
role: "button",
|
|
182
181
|
$width: f,
|
|
183
|
-
onClick:
|
|
182
|
+
onClick: Y,
|
|
184
183
|
$isOpen: r,
|
|
185
184
|
$border: K,
|
|
186
|
-
$isFocused:
|
|
185
|
+
$isFocused: G && !r,
|
|
187
186
|
tabIndex: m ? -1 : 0,
|
|
188
187
|
"aria-haspopup": "listbox",
|
|
189
188
|
"aria-expanded": r,
|
|
@@ -191,16 +190,16 @@ const ye = (o) => {
|
|
|
191
190
|
"aria-disabled": m || void 0,
|
|
192
191
|
"aria-activedescendant": s !== -1 ? Q(s) : void 0,
|
|
193
192
|
children: [
|
|
194
|
-
/* @__PURE__ */ i(
|
|
195
|
-
/* @__PURE__ */ i(
|
|
193
|
+
/* @__PURE__ */ i(me, { $width: f, color: c.length > 0 ? O.m700 : O.m500, size: "1.2rem", children: ne }),
|
|
194
|
+
/* @__PURE__ */ i(he, { color: O.m500, size: 22, $isOpen: r, "aria-hidden": !0 })
|
|
196
195
|
]
|
|
197
196
|
}
|
|
198
197
|
),
|
|
199
|
-
/* @__PURE__ */ $(
|
|
200
|
-
h && /* @__PURE__ */ $(
|
|
201
|
-
/* @__PURE__ */ i(
|
|
198
|
+
/* @__PURE__ */ $(be, { $isOpen: r, $width: f, $height: F, $top: J === "top", children: [
|
|
199
|
+
h && /* @__PURE__ */ $(ge, { onClick: (e) => e.stopPropagation(), children: [
|
|
200
|
+
/* @__PURE__ */ i(xe, { size: 20, color: O.m600, "aria-hidden": !0 }),
|
|
202
201
|
/* @__PURE__ */ i(
|
|
203
|
-
|
|
202
|
+
we,
|
|
204
203
|
{
|
|
205
204
|
ref: z,
|
|
206
205
|
value: S,
|
|
@@ -216,7 +215,7 @@ const ye = (o) => {
|
|
|
216
215
|
)
|
|
217
216
|
] }),
|
|
218
217
|
/* @__PURE__ */ $(
|
|
219
|
-
|
|
218
|
+
$e,
|
|
220
219
|
{
|
|
221
220
|
ref: w,
|
|
222
221
|
role: "listbox",
|
|
@@ -226,16 +225,16 @@ const ye = (o) => {
|
|
|
226
225
|
"aria-labelledby": H,
|
|
227
226
|
children: [
|
|
228
227
|
d.map(oe),
|
|
229
|
-
l && /* @__PURE__ */ i(
|
|
228
|
+
l && /* @__PURE__ */ i(Ce, { ref: V, children: a && /* @__PURE__ */ i(U, { size: "small", color: W }) })
|
|
230
229
|
]
|
|
231
230
|
}
|
|
232
231
|
)
|
|
233
232
|
] }),
|
|
234
|
-
k && /* @__PURE__ */ i(
|
|
233
|
+
k && /* @__PURE__ */ i(Ie, { children: /* @__PURE__ */ i(U, { size: "small", color: W }) })
|
|
235
234
|
]
|
|
236
235
|
}
|
|
237
236
|
);
|
|
238
237
|
};
|
|
239
238
|
export {
|
|
240
|
-
|
|
239
|
+
We as default
|
|
241
240
|
};
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
return typeof
|
|
6
|
-
},
|
|
7
|
-
"div",
|
|
8
|
-
{
|
|
9
|
-
className: "shimmer",
|
|
10
|
-
role: "status",
|
|
11
|
-
"aria-label": i,
|
|
12
|
-
style: {
|
|
13
|
-
width: r(e),
|
|
14
|
-
height: r(t)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
);
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { ShimmerWrapper as m } from "./styles.js";
|
|
3
|
+
const e = (r) => {
|
|
4
|
+
if (r != null)
|
|
5
|
+
return typeof r == "number" ? `${r}rem` : r;
|
|
6
|
+
}, p = ({ width: r = "100%", height: t = "100%", label: o = "Loading..." }) => /* @__PURE__ */ i(m, { role: "status", "aria-label": o, width: e(r), height: e(t) });
|
|
18
7
|
export {
|
|
19
|
-
|
|
8
|
+
p as default
|
|
20
9
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import t, { keyframes as o } from "styled-components";
|
|
2
|
+
import e from "../../colors/grey.js";
|
|
3
|
+
const i = o`
|
|
4
|
+
from { transform: translateX(-100%); }
|
|
5
|
+
to { transform: translateX(100%); }
|
|
6
|
+
`, m = t.div`
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
background-color: ${e.m300};
|
|
10
|
+
border-radius: 0.4rem;
|
|
11
|
+
width: ${({ width: r }) => r};
|
|
12
|
+
height: ${({ height: r }) => r};
|
|
13
|
+
|
|
14
|
+
&:after {
|
|
15
|
+
content: '';
|
|
16
|
+
position: absolute;
|
|
17
|
+
inset: 0;
|
|
18
|
+
background: linear-gradient(
|
|
19
|
+
120deg,
|
|
20
|
+
rgba(245, 245, 245, 0) 30%,
|
|
21
|
+
${e.m100} 50%,
|
|
22
|
+
rgba(245, 245, 245, 0) 70%
|
|
23
|
+
);
|
|
24
|
+
animation: ${i} 1.8s infinite;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
export {
|
|
28
|
+
m as ShimmerWrapper
|
|
29
|
+
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import l from "
|
|
3
|
-
import
|
|
4
|
-
import h from "../../colors/
|
|
5
|
-
import p from "../../colors/green.js";
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { SpinnerSVG as l, SpinnerCircle as s } from "./styles.js";
|
|
3
|
+
import a from "../../colors/index.js";
|
|
4
|
+
import h from "../../colors/green.js";
|
|
6
5
|
import d from "../../colors/white.js";
|
|
7
|
-
import
|
|
6
|
+
import p from "../../colors/grey.js";
|
|
8
7
|
const c = {
|
|
9
8
|
small: { strokeWidth: 6, $length: "1rem" },
|
|
10
9
|
medium: { strokeWidth: 5, $length: "2rem" },
|
|
11
10
|
large: { strokeWidth: 5, $length: "3rem" }
|
|
12
|
-
},
|
|
11
|
+
}, W = ({ color: e = "green", size: o = "medium" }) => {
|
|
13
12
|
var t;
|
|
14
|
-
const { strokeWidth:
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
13
|
+
const { strokeWidth: n, $length: r } = c[o], m = [d, p.m600].includes(e) ? e : (t = a[e] ?? h) == null ? void 0 : t.m500;
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
l,
|
|
17
16
|
{
|
|
18
17
|
viewBox: "0 0 50 50",
|
|
19
18
|
width: r,
|
|
@@ -21,15 +20,15 @@ const c = {
|
|
|
21
20
|
role: "status",
|
|
22
21
|
"aria-label": "Loading",
|
|
23
22
|
"aria-live": "polite",
|
|
24
|
-
children: /* @__PURE__ */
|
|
25
|
-
|
|
23
|
+
children: /* @__PURE__ */ i(
|
|
24
|
+
s,
|
|
26
25
|
{
|
|
27
26
|
cx: "25",
|
|
28
27
|
cy: "25",
|
|
29
28
|
r: "20",
|
|
30
29
|
fill: "none",
|
|
31
|
-
stroke:
|
|
32
|
-
strokeWidth:
|
|
30
|
+
stroke: m,
|
|
31
|
+
strokeWidth: n,
|
|
33
32
|
strokeLinecap: "round"
|
|
34
33
|
}
|
|
35
34
|
)
|
|
@@ -37,5 +36,5 @@ const c = {
|
|
|
37
36
|
);
|
|
38
37
|
};
|
|
39
38
|
export {
|
|
40
|
-
|
|
39
|
+
W as default
|
|
41
40
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
2
2
|
import { useState as n, useRef as ae, useEffect as F } from "react";
|
|
3
|
-
import
|
|
4
|
-
import oe from "
|
|
5
|
-
import se from "./components/TimerRing/TimerRing.js";
|
|
3
|
+
import se from "../Glass/Glass.js";
|
|
4
|
+
import oe from "./components/TimerRing/TimerRing.js";
|
|
6
5
|
import u from "../../colors/white.js";
|
|
7
6
|
import { Wrapper as le, Dimmer as ce, Time as N, TimeTxt as E, HourHand as de, MinuteHand as ue, SecondHand as me, AllDots as he, Dots as pe, AlarmRing as ge, BulletRing as fe, Bullet as Se, LeftActions as be, ActionBtn as m, MediaStopFilledWrapper as Te, MediaPauseFilledWrapper as we, MediaPlayFilledWrapper as Ae, RightActions as $e, AddWrapper as Re } from "./styles.js";
|
|
8
|
-
const
|
|
7
|
+
const l = () => {
|
|
8
|
+
}, Pe = (h) => () => {
|
|
9
9
|
const a = (/* @__PURE__ */ new Date()).toLocaleString("en-Us", { hour12: !0, timeZone: h }).split(", ")[1].split(" ")[0], [g, r, c] = a.split(":").map(Number);
|
|
10
10
|
return {
|
|
11
11
|
second: c * 6,
|
|
12
12
|
minute: r * 6 + c * 0.1,
|
|
13
13
|
hour: g % 12 * 30 + r * 0.5
|
|
14
14
|
};
|
|
15
|
-
},
|
|
15
|
+
}, We = ({
|
|
16
16
|
color: h = "green",
|
|
17
17
|
showTime: H = !0,
|
|
18
18
|
showTimeWithSec: p = !0,
|
|
@@ -22,10 +22,10 @@ const Pe = (h) => () => {
|
|
|
22
22
|
onTimerAdd: c = l,
|
|
23
23
|
onTimerComplete: U = l,
|
|
24
24
|
onTimerRemove: O = l,
|
|
25
|
-
onTimerPause:
|
|
26
|
-
onTimerPlay:
|
|
25
|
+
onTimerPause: G = l,
|
|
26
|
+
onTimerPlay: K = l
|
|
27
27
|
}) => {
|
|
28
|
-
const [f,
|
|
28
|
+
const [f, _] = n(/* @__PURE__ */ new Date()), [s, S] = n(0), [d, b] = n(!1), [T, q] = n(Pe(a)), [J, w] = n(0), [A, $] = n(!1), k = ae(d);
|
|
29
29
|
F(() => {
|
|
30
30
|
k.current = d;
|
|
31
31
|
}, [d]);
|
|
@@ -36,15 +36,15 @@ const Pe = (h) => () => {
|
|
|
36
36
|
}, Y = () => {
|
|
37
37
|
S(0), w(0), $(!1);
|
|
38
38
|
}, V = () => {
|
|
39
|
-
b(!0),
|
|
39
|
+
b(!0), G();
|
|
40
40
|
}, Z = () => {
|
|
41
|
-
b(!1),
|
|
41
|
+
b(!1), K();
|
|
42
42
|
};
|
|
43
43
|
F(() => {
|
|
44
44
|
const L = setInterval(() => {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const ee =
|
|
45
|
+
const o = /* @__PURE__ */ new Date();
|
|
46
|
+
_(o), q((t) => {
|
|
47
|
+
const ee = o.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1].split(" ")[0], [te, W, j] = ee.split(":").map(Number), re = j * 6, ie = W * 6 + j * 0.1, ne = te % 12 * 30 + W * 0.5, D = (v, x) => {
|
|
48
48
|
const z = v % 360;
|
|
49
49
|
return v - z + x + (x < z ? 360 : 0);
|
|
50
50
|
};
|
|
@@ -57,9 +57,9 @@ const Pe = (h) => () => {
|
|
|
57
57
|
}, 1e3);
|
|
58
58
|
return () => clearInterval(L);
|
|
59
59
|
}, []);
|
|
60
|
-
const R = f.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1], I = R.split(" ")[0], M = R.split(" ")[1], y = R.split(":").slice(0, 2).join(":"), P = !(Number.isInteger(
|
|
60
|
+
const R = f.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1], I = R.split(" ")[0], M = R.split(" ")[1], y = R.split(":").slice(0, 2).join(":"), P = !(Number.isInteger(s) && s > 0), C = `${p ? I : y} ${M}`;
|
|
61
61
|
return /* @__PURE__ */ i(le, { $color: h, role: "region", "aria-label": "Clock", children: [
|
|
62
|
-
/* @__PURE__ */ e(
|
|
62
|
+
/* @__PURE__ */ e(se, { borderRadius: "1.2rem", "aria-hidden": "true" }),
|
|
63
63
|
H && /* @__PURE__ */ i(B, { children: [
|
|
64
64
|
/* @__PURE__ */ e(ce, { "aria-hidden": "true" }),
|
|
65
65
|
g ? /* @__PURE__ */ i(N, { as: "time", dateTime: f.toISOString(), "aria-label": C, children: [
|
|
@@ -71,7 +71,7 @@ const Pe = (h) => () => {
|
|
|
71
71
|
/* @__PURE__ */ e(me, { $rotate: T.second, "aria-hidden": "true" })
|
|
72
72
|
] })
|
|
73
73
|
] }),
|
|
74
|
-
/* @__PURE__ */ e(he, { "aria-hidden": "true", children: [...Array(60)].map((L,
|
|
74
|
+
/* @__PURE__ */ e(he, { "aria-hidden": "true", children: [...Array(60)].map((L, o) => /* @__PURE__ */ e(pe, { style: { rotate: `${o * 6}deg` } }, o)) }),
|
|
75
75
|
(!P || A) && /* @__PURE__ */ i(B, { children: [
|
|
76
76
|
/* @__PURE__ */ e(
|
|
77
77
|
ge,
|
|
@@ -79,7 +79,7 @@ const Pe = (h) => () => {
|
|
|
79
79
|
$dismissing: A,
|
|
80
80
|
onAnimationEnd: Y,
|
|
81
81
|
"aria-hidden": "true",
|
|
82
|
-
children: /* @__PURE__ */ e(
|
|
82
|
+
children: /* @__PURE__ */ e(oe, { progress: s >= 60 ? 1 : s % 60 / 60 })
|
|
83
83
|
}
|
|
84
84
|
),
|
|
85
85
|
/* @__PURE__ */ e(fe, { $angle: J, $dismissing: A, "aria-hidden": "true", children: /* @__PURE__ */ e(Se, {}) }),
|
|
@@ -88,7 +88,7 @@ const Pe = (h) => () => {
|
|
|
88
88
|
{
|
|
89
89
|
role: "timer",
|
|
90
90
|
"aria-live": "polite",
|
|
91
|
-
"aria-label": `${
|
|
91
|
+
"aria-label": `${s} seconds remaining`,
|
|
92
92
|
style: {
|
|
93
93
|
position: "absolute",
|
|
94
94
|
width: 1,
|
|
@@ -108,5 +108,5 @@ const Pe = (h) => () => {
|
|
|
108
108
|
] });
|
|
109
109
|
};
|
|
110
110
|
export {
|
|
111
|
-
|
|
111
|
+
We as default
|
|
112
112
|
};
|
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import C from "
|
|
4
|
-
import S from "
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const s = (o, e, r) => () => {
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as u } from "react";
|
|
3
|
+
import { Logo as C } from "./helpers.js";
|
|
4
|
+
import S from "../../colors/grey.js";
|
|
5
|
+
import { COLOR_MAP as $, INFO as F, INFO_COLORS as L } from "./constants.js";
|
|
6
|
+
import { ToastWrapper as N, Message as j, Title as w, Subtitle as x, CloseWrapper as I } from "./styles.js";
|
|
7
|
+
const M = () => {
|
|
8
|
+
}, m = (o, e, t) => () => {
|
|
10
9
|
o(!0), setTimeout(() => {
|
|
11
|
-
e(!1),
|
|
10
|
+
e(!1), t();
|
|
12
11
|
}, 500);
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
subtitle: a
|
|
20
|
-
}) => {
|
|
21
|
-
const [l, m] = n(e), [d, f] = n(!1);
|
|
22
|
-
p(() => {
|
|
23
|
-
m(e);
|
|
24
|
-
}, [e]), p(() => {
|
|
25
|
-
const h = setTimeout(s(f, m, i), r * 1e3 - 500);
|
|
12
|
+
}, P = ({ type: o = F, visible: e = !0, duration: t = 5, onExpire: a = M, title: l, subtitle: i }) => {
|
|
13
|
+
const [d, s] = f(e), [p, c] = f(!1);
|
|
14
|
+
u(() => {
|
|
15
|
+
s(e);
|
|
16
|
+
}, [e]), u(() => {
|
|
17
|
+
const g = setTimeout(m(c, s, a), t * 1e3 - 500);
|
|
26
18
|
return () => {
|
|
27
|
-
clearTimeout(
|
|
19
|
+
clearTimeout(g);
|
|
28
20
|
};
|
|
29
|
-
}, [
|
|
30
|
-
const { main: O, side: T, bg:
|
|
31
|
-
if (
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
21
|
+
}, [t, m]);
|
|
22
|
+
const { main: O, side: T, bg: h } = $[o] ?? L;
|
|
23
|
+
if (d)
|
|
24
|
+
return /* @__PURE__ */ n(N, { $bg: h, className: `${p ? "fade-out" : "fade-in"}`, children: [
|
|
25
|
+
/* @__PURE__ */ r(C, { type: o, $main: O, $side: T }),
|
|
26
|
+
/* @__PURE__ */ n(j, { children: [
|
|
27
|
+
/* @__PURE__ */ r(w, { children: l }),
|
|
28
|
+
i && /* @__PURE__ */ r(x, { children: i })
|
|
37
29
|
] }),
|
|
38
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ r(I, { size: 20, color: S.m600, onClick: m(c, s, a) })
|
|
39
31
|
] });
|
|
40
32
|
};
|
|
41
33
|
export {
|
|
42
|
-
|
|
34
|
+
P as default
|
|
43
35
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { PWrapper as
|
|
3
|
-
|
|
4
|
-
const f = (o) => {
|
|
5
|
-
const { color: r, size: e, children: i } = o || {};
|
|
6
|
-
return /* @__PURE__ */ t(c, { $color: r, $size: e, ...m(o, ["color", "size", "children"]), children: i });
|
|
7
|
-
};
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { PWrapper as m } from "./styles.js";
|
|
3
|
+
const f = ({ color: r, size: o, children: t, ...e }) => /* @__PURE__ */ p(m, { $color: r, $size: o, ...e, children: t });
|
|
8
4
|
export {
|
|
9
5
|
f as default
|
|
10
6
|
};
|