meticulous-ui 2.6.2 → 2.7.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/components/Dropdown/Dropdown.js +56 -54
- package/components/Glass/Glass.js +4 -4
- package/components/Input/Checkbox/Checkbox.js +23 -22
- package/components/Input/Checkbox/styles.js +1 -1
- package/components/Input/FileUploader/FileUploader.js +22 -21
- package/components/Input/Radio/Radio.js +10 -10
- package/components/Input/RadioGroup/RadioGroup.js +19 -17
- package/components/Loader/Loader.js +12 -12
- package/components/MenuItem/MenuItem.js +10 -8
- package/components/OtpInput/OtpInput.js +16 -15
- package/components/Pagination/Pagination.js +17 -14
- package/components/Selectbox/Selectbox.js +48 -46
- package/components/Shimmer/Shimmer.js +3 -3
- package/components/Shimmer/styles.js +3 -3
- package/components/Spinner/Spinner.js +14 -13
- package/components/Timer/Timer.js +35 -34
- package/components/Toast/Toast.js +18 -18
- package/components/Typography/Headings/H1.js +5 -5
- package/components/Typography/Headings/H2.js +5 -5
- package/components/Typography/Headings/H3.js +5 -5
- package/components/Typography/Headings/H4.js +5 -5
- package/components/Typography/Headings/H5.js +5 -5
- package/components/Typography/Headings/H6.js +5 -5
- package/components/VideoPlayer/VideoPlayer.js +11 -11
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { OTPWrapper as
|
|
4
|
-
import { renderNums as
|
|
5
|
-
const
|
|
6
|
-
const [a, D] =
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useRef as y, useEffect as I } from "react";
|
|
3
|
+
import { OTPWrapper as P } from "./styles.js";
|
|
4
|
+
import { renderNums as b } from "./helpers.js";
|
|
5
|
+
const B = ({ length: r = 6, value: p = "", onChange: u, onComplete: e, ...O }) => {
|
|
6
|
+
const [a, D] = E(Array(r).fill("")), d = y([]), w = y(a), o = y(!1), f = (s) => {
|
|
7
7
|
var t;
|
|
8
8
|
o.current = !0, (t = d.current[s]) == null || t.focus();
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
I(() => {
|
|
11
11
|
if (!p) return;
|
|
12
12
|
const s = String(p).replace(/\D/g, "").slice(0, r), t = s.split("");
|
|
13
13
|
for (; t.length < r; ) t.push("");
|
|
@@ -17,11 +17,11 @@ const T = ({ length: r = 6, value: p = "", onChange: u, onComplete: e }) => {
|
|
|
17
17
|
w.current = s, D(s);
|
|
18
18
|
const t = s.join("");
|
|
19
19
|
u == null || u(t), t.length === r && (e == null || e(t));
|
|
20
|
-
},
|
|
20
|
+
}, k = (s, t) => {
|
|
21
21
|
s = s.replace(/\D/g, "").slice(-1);
|
|
22
22
|
const c = [...a];
|
|
23
23
|
c[t] = s, l(c), s && t < r - 1 && f(t + 1);
|
|
24
|
-
},
|
|
24
|
+
}, m = (s, t) => {
|
|
25
25
|
const c = a.findIndex((n) => n === ""), i = c === -1 ? r - 1 : c;
|
|
26
26
|
if (s.key === "Backspace") {
|
|
27
27
|
if (s.preventDefault(), a[t]) {
|
|
@@ -30,7 +30,7 @@ const T = ({ length: r = 6, value: p = "", onChange: u, onComplete: e }) => {
|
|
|
30
30
|
}
|
|
31
31
|
t > 0 && f(t - 1);
|
|
32
32
|
} else s.key === "ArrowLeft" && t > 0 ? (s.preventDefault(), f(t - 1)) : s.key === "ArrowRight" ? (s.preventDefault(), t + 1 <= i && f(t + 1)) : s.key === "Tab" && (s.preventDefault(), s.shiftKey ? t > 0 && f(t - 1) : f(i));
|
|
33
|
-
},
|
|
33
|
+
}, R = (s) => {
|
|
34
34
|
if (o.current) {
|
|
35
35
|
o.current = !1;
|
|
36
36
|
return;
|
|
@@ -38,22 +38,23 @@ const T = ({ length: r = 6, value: p = "", onChange: u, onComplete: e }) => {
|
|
|
38
38
|
const t = w.current.findIndex((i) => i === ""), c = t === -1 ? r - 1 : t;
|
|
39
39
|
s !== c && f(c);
|
|
40
40
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
41
|
+
return /* @__PURE__ */ A(
|
|
42
|
+
P,
|
|
43
43
|
{
|
|
44
44
|
style: { display: "flex", gap: "10px", justifyContent: "center" },
|
|
45
45
|
onPaste: (s) => {
|
|
46
46
|
const t = s.clipboardData.getData("text").replace(/\D/g, "");
|
|
47
47
|
if (!t) return;
|
|
48
48
|
const c = Array(r).fill("");
|
|
49
|
-
t.slice(0, r).split("").forEach((n,
|
|
49
|
+
t.slice(0, r).split("").forEach((n, j) => c[j] = n), l(c);
|
|
50
50
|
const i = Math.min(t.length - 1, r - 1);
|
|
51
51
|
f(i);
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
...O,
|
|
54
|
+
children: a.map(b({ inputsRef: d, handleChange: k, handleKeyDown: m, handleFocus: R }))
|
|
54
55
|
}
|
|
55
56
|
);
|
|
56
57
|
};
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
B as default
|
|
59
60
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { jsxs as l, jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as E, useEffect as K } from "react";
|
|
3
3
|
import { PrevArrow as M, renderPageNum as d, NextArrow as R, renderThreeDots as $ } from "./helpers.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { ICON_SIZE_MAPPING as
|
|
4
|
+
import a from "../../colors/index.js";
|
|
5
|
+
import j from "../../colors/teal.js";
|
|
6
|
+
import { ICON_SIZE_MAPPING as G, MEDIUM as L, SIZE_REM_MAPPING as P } from "./constants.js";
|
|
7
7
|
import { AllPages as u, MiddleLayer as v } from "./styles.js";
|
|
8
|
-
const
|
|
8
|
+
const B = ({
|
|
9
9
|
pageNumber: r,
|
|
10
|
-
setPageNumber:
|
|
10
|
+
setPageNumber: S,
|
|
11
11
|
totalPages: n,
|
|
12
|
-
theme:
|
|
13
|
-
size: o =
|
|
14
|
-
isDisabled: D = !1
|
|
12
|
+
theme: _ = "lime",
|
|
13
|
+
size: o = L,
|
|
14
|
+
isDisabled: D = !1,
|
|
15
|
+
...x
|
|
15
16
|
}) => {
|
|
16
|
-
const s =
|
|
17
|
-
|
|
17
|
+
const s = E(null), h = E(!1);
|
|
18
|
+
K(() => {
|
|
18
19
|
var i, w;
|
|
19
20
|
h.current && (h.current = !1, (w = (i = s.current) == null ? void 0 : i.querySelector('[aria-current="page"]')) == null || w.focus());
|
|
20
21
|
}, [r]);
|
|
21
22
|
const c = (i) => {
|
|
22
|
-
i !== r &&
|
|
23
|
+
i !== r && S(i);
|
|
23
24
|
}, A = () => {
|
|
24
25
|
r > 1 && c(r - 1);
|
|
25
26
|
}, m = () => {
|
|
26
27
|
r < n && c(r + 1);
|
|
27
28
|
}, y = (i) => {
|
|
28
29
|
["ArrowLeft", "ArrowUp"].includes(i.code) && (h.current = !0, A()), ["ArrowRight", "ArrowDown"].includes(i.code) && (h.current = !0, m());
|
|
29
|
-
}, e =
|
|
30
|
+
}, e = a[_] ?? j, I = P[o], t = G[o];
|
|
30
31
|
return n <= 7 ? /* @__PURE__ */ l(
|
|
31
32
|
u,
|
|
32
33
|
{
|
|
@@ -34,6 +35,7 @@ const k = ({
|
|
|
34
35
|
onKeyDown: y,
|
|
35
36
|
"aria-label": "Pagination",
|
|
36
37
|
$isDisabled: D,
|
|
38
|
+
...x,
|
|
37
39
|
children: [
|
|
38
40
|
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage: A }),
|
|
39
41
|
/* @__PURE__ */ f(v, { size: `${n * I}rem`, children: Array.from({ length: n }, (i, w) => w + 1).map(
|
|
@@ -49,6 +51,7 @@ const k = ({
|
|
|
49
51
|
onKeyDown: y,
|
|
50
52
|
"aria-label": "Pagination",
|
|
51
53
|
$isDisabled: D,
|
|
54
|
+
...x,
|
|
52
55
|
children: [
|
|
53
56
|
/* @__PURE__ */ f(M, { iconSize: t, shades: e, setPrevPage: A }),
|
|
54
57
|
/* @__PURE__ */ l(v, { size: `${9 * I}rem`, children: [
|
|
@@ -87,5 +90,5 @@ const k = ({
|
|
|
87
90
|
);
|
|
88
91
|
};
|
|
89
92
|
export {
|
|
90
|
-
|
|
93
|
+
B as default
|
|
91
94
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as $, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useState as C, useId as T, useRef as v, useMemo as
|
|
2
|
+
import { useState as C, useId as T, useRef as v, useMemo as ce, useEffect as I, useLayoutEffect as le, useCallback as ae } from "react";
|
|
3
3
|
import O from "../../colors/grey.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import ue from "../../colors/index.js";
|
|
5
|
+
import de from "../../colors/blue.js";
|
|
6
|
+
import pe from "../Input/Checkbox/Checkbox.js";
|
|
7
7
|
import U from "../Spinner/Spinner.js";
|
|
8
|
-
import { SelectBoxWrapper as
|
|
9
|
-
const
|
|
8
|
+
import { SelectBoxWrapper as fe, Box as me, PWrapper as he, ChevronDownWrapper as be, OptionWrapper as ge, SearchContainer as xe, SearchIcon as we, SearchInput as $e, OptionsList as Ce, LoadMoreSentinel as Ie, SpinnerWrapper as ke, CheckboxItem as Se } from "./styles.js";
|
|
9
|
+
const ye = (o) => {
|
|
10
10
|
if (typeof o != "string") return o;
|
|
11
11
|
if (o.endsWith("px")) return parseFloat(o);
|
|
12
12
|
if (o.endsWith("rem")) {
|
|
@@ -14,7 +14,7 @@ const Se = (o) => {
|
|
|
14
14
|
return E * c;
|
|
15
15
|
}
|
|
16
16
|
return parseFloat(o);
|
|
17
|
-
},
|
|
17
|
+
}, Ae = ({
|
|
18
18
|
options: o,
|
|
19
19
|
onChange: E,
|
|
20
20
|
value: c = [],
|
|
@@ -29,12 +29,13 @@ const Se = (o) => {
|
|
|
29
29
|
onLoadMore: l,
|
|
30
30
|
hasMore: b = !1,
|
|
31
31
|
isLoadingMore: a = !1,
|
|
32
|
-
loaderColor: W
|
|
32
|
+
loaderColor: W,
|
|
33
|
+
...G
|
|
33
34
|
}) => {
|
|
34
|
-
const [r, g] = C(!1), [
|
|
35
|
+
const [r, g] = C(!1), [J, A] = C(!1), [X, Y] = 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), Z = () => !m && !k && g((e) => !e), B = (e) => {
|
|
35
36
|
const t = c.includes(e) ? c.filter((n) => n !== e) : [...c, e];
|
|
36
37
|
E(t);
|
|
37
|
-
}, d =
|
|
38
|
+
}, d = ce(() => {
|
|
38
39
|
if (!h || !S.trim()) return o;
|
|
39
40
|
const e = S.toLowerCase();
|
|
40
41
|
return o.filter(({ label: t }) => t.toLowerCase().includes(e));
|
|
@@ -57,29 +58,29 @@ const Se = (o) => {
|
|
|
57
58
|
u.current && !u.current.contains(t.target) && g(!1);
|
|
58
59
|
};
|
|
59
60
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
60
|
-
}, []),
|
|
61
|
+
}, []), le(() => {
|
|
61
62
|
if (r && w.current && u.current) {
|
|
62
|
-
const e = u.current.getBoundingClientRect(), t = window.innerHeight, n =
|
|
63
|
-
|
|
63
|
+
const e = u.current.getBoundingClientRect(), t = window.innerHeight, n = ye(F), p = t - e.bottom;
|
|
64
|
+
Y(
|
|
64
65
|
p < n + 8 && e.top > p ? "top" : "bottom"
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
}, [r, F]);
|
|
68
|
-
const
|
|
69
|
+
const _ = (e) => {
|
|
69
70
|
let t = e + 1;
|
|
70
71
|
for (; t < d.length; ) {
|
|
71
72
|
if (!d[t].disabled) return t;
|
|
72
73
|
t++;
|
|
73
74
|
}
|
|
74
75
|
return e;
|
|
75
|
-
},
|
|
76
|
+
}, L = (e) => {
|
|
76
77
|
let t = e - 1;
|
|
77
78
|
for (; t >= 0; ) {
|
|
78
79
|
if (!d[t].disabled) return t;
|
|
79
80
|
t--;
|
|
80
81
|
}
|
|
81
82
|
return e;
|
|
82
|
-
}, j =
|
|
83
|
+
}, j = ae(() => {
|
|
83
84
|
b && !a && l && l();
|
|
84
85
|
}, [b, a, l]);
|
|
85
86
|
I(() => {
|
|
@@ -93,7 +94,7 @@ const Se = (o) => {
|
|
|
93
94
|
);
|
|
94
95
|
return t.observe(e), () => t.disconnect();
|
|
95
96
|
}, [j, l, b, a]);
|
|
96
|
-
const
|
|
97
|
+
const M = (e) => {
|
|
97
98
|
if (!(m || k)) {
|
|
98
99
|
if (!r) {
|
|
99
100
|
(e.key === " " || e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), g(!0));
|
|
@@ -102,12 +103,12 @@ const Se = (o) => {
|
|
|
102
103
|
switch (e.key) {
|
|
103
104
|
case "ArrowDown": {
|
|
104
105
|
e.preventDefault();
|
|
105
|
-
const n =
|
|
106
|
+
const n = _(s);
|
|
106
107
|
n === s && b && !a && (l == null || l()), x(n);
|
|
107
108
|
break;
|
|
108
109
|
}
|
|
109
110
|
case "ArrowUp": {
|
|
110
|
-
e.preventDefault(), x(
|
|
111
|
+
e.preventDefault(), x(L(s));
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
114
|
case "Enter":
|
|
@@ -122,14 +123,14 @@ const Se = (o) => {
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
}, {
|
|
125
|
-
m50:
|
|
126
|
-
m100:
|
|
126
|
+
m50: ee,
|
|
127
|
+
m100: te,
|
|
127
128
|
m500: K,
|
|
128
|
-
m800:
|
|
129
|
-
} =
|
|
129
|
+
m800: re
|
|
130
|
+
} = ue[N] ?? de, ne = (e, t) => () => !e && x(t), Q = (e) => `${y}-opt-${e}`, oe = c.length === 0 ? q : `${c.length} selected`, ie = ({ value: e, label: t, disabled: n }, p) => {
|
|
130
131
|
const D = c.includes(e);
|
|
131
132
|
return /* @__PURE__ */ i(
|
|
132
|
-
|
|
133
|
+
Se,
|
|
133
134
|
{
|
|
134
135
|
id: Q(p),
|
|
135
136
|
role: "option",
|
|
@@ -138,20 +139,20 @@ const Se = (o) => {
|
|
|
138
139
|
$width: `calc(${f} + 1rem)`,
|
|
139
140
|
$isHighlighted: p === s,
|
|
140
141
|
$isDisabled: n,
|
|
141
|
-
$hoverColor:
|
|
142
|
-
$activeColor:
|
|
142
|
+
$hoverColor: ee,
|
|
143
|
+
$activeColor: te,
|
|
143
144
|
onClick: () => B(e),
|
|
144
|
-
onMouseEnter:
|
|
145
|
+
onMouseEnter: ne(n, p),
|
|
145
146
|
title: t,
|
|
146
|
-
children: /* @__PURE__ */ i("div", { onClick: (
|
|
147
|
-
|
|
147
|
+
children: /* @__PURE__ */ i("div", { onClick: (se) => se.stopPropagation(), children: /* @__PURE__ */ i(
|
|
148
|
+
pe,
|
|
148
149
|
{
|
|
149
150
|
value: D,
|
|
150
151
|
onChange: () => B(e),
|
|
151
152
|
label: t,
|
|
152
153
|
disabled: n,
|
|
153
154
|
innerShade: K,
|
|
154
|
-
outerShade:
|
|
155
|
+
outerShade: re,
|
|
155
156
|
tabIndex: -1
|
|
156
157
|
}
|
|
157
158
|
) })
|
|
@@ -160,29 +161,30 @@ const Se = (o) => {
|
|
|
160
161
|
);
|
|
161
162
|
};
|
|
162
163
|
return /* @__PURE__ */ $(
|
|
163
|
-
|
|
164
|
+
fe,
|
|
164
165
|
{
|
|
165
166
|
ref: u,
|
|
166
167
|
$width: f,
|
|
167
168
|
$isDisabled: m,
|
|
168
169
|
$isLoading: k,
|
|
169
|
-
onKeyDown:
|
|
170
|
+
onKeyDown: M,
|
|
170
171
|
onBlur: (e) => {
|
|
171
172
|
var t;
|
|
172
173
|
(t = u.current) != null && t.contains(e.relatedTarget) || (A(!1), g(!1));
|
|
173
174
|
},
|
|
174
175
|
onFocus: () => A(!0),
|
|
176
|
+
...G,
|
|
175
177
|
children: [
|
|
176
178
|
/* @__PURE__ */ $(
|
|
177
|
-
|
|
179
|
+
me,
|
|
178
180
|
{
|
|
179
181
|
id: H,
|
|
180
182
|
role: "button",
|
|
181
183
|
$width: f,
|
|
182
|
-
onClick:
|
|
184
|
+
onClick: Z,
|
|
183
185
|
$isOpen: r,
|
|
184
186
|
$border: K,
|
|
185
|
-
$isFocused:
|
|
187
|
+
$isFocused: J && !r,
|
|
186
188
|
tabIndex: m ? -1 : 0,
|
|
187
189
|
"aria-haspopup": "listbox",
|
|
188
190
|
"aria-expanded": r,
|
|
@@ -190,16 +192,16 @@ const Se = (o) => {
|
|
|
190
192
|
"aria-disabled": m || void 0,
|
|
191
193
|
"aria-activedescendant": s !== -1 ? Q(s) : void 0,
|
|
192
194
|
children: [
|
|
193
|
-
/* @__PURE__ */ i(
|
|
194
|
-
/* @__PURE__ */ i(
|
|
195
|
+
/* @__PURE__ */ i(he, { $width: f, color: c.length > 0 ? O.m700 : O.m500, size: "1.2rem", children: oe }),
|
|
196
|
+
/* @__PURE__ */ i(be, { color: O.m500, size: 22, $isOpen: r, "aria-hidden": !0 })
|
|
195
197
|
]
|
|
196
198
|
}
|
|
197
199
|
),
|
|
198
|
-
/* @__PURE__ */ $(
|
|
199
|
-
h && /* @__PURE__ */ $(
|
|
200
|
-
/* @__PURE__ */ i(
|
|
200
|
+
/* @__PURE__ */ $(ge, { $isOpen: r, $width: f, $height: F, $top: X === "top", children: [
|
|
201
|
+
h && /* @__PURE__ */ $(xe, { onClick: (e) => e.stopPropagation(), children: [
|
|
202
|
+
/* @__PURE__ */ i(we, { size: 20, color: O.m600, "aria-hidden": !0 }),
|
|
201
203
|
/* @__PURE__ */ i(
|
|
202
|
-
|
|
204
|
+
$e,
|
|
203
205
|
{
|
|
204
206
|
ref: z,
|
|
205
207
|
value: S,
|
|
@@ -215,7 +217,7 @@ const Se = (o) => {
|
|
|
215
217
|
)
|
|
216
218
|
] }),
|
|
217
219
|
/* @__PURE__ */ $(
|
|
218
|
-
|
|
220
|
+
Ce,
|
|
219
221
|
{
|
|
220
222
|
ref: w,
|
|
221
223
|
role: "listbox",
|
|
@@ -224,17 +226,17 @@ const Se = (o) => {
|
|
|
224
226
|
"aria-multiselectable": !0,
|
|
225
227
|
"aria-labelledby": H,
|
|
226
228
|
children: [
|
|
227
|
-
d.map(
|
|
228
|
-
l && /* @__PURE__ */ i(
|
|
229
|
+
d.map(ie),
|
|
230
|
+
l && /* @__PURE__ */ i(Ie, { ref: V, children: a && /* @__PURE__ */ i(U, { size: "small", color: W }) })
|
|
229
231
|
]
|
|
230
232
|
}
|
|
231
233
|
)
|
|
232
234
|
] }),
|
|
233
|
-
k && /* @__PURE__ */ i(
|
|
235
|
+
k && /* @__PURE__ */ i(ke, { children: /* @__PURE__ */ i(U, { size: "small", color: W }) })
|
|
234
236
|
]
|
|
235
237
|
}
|
|
236
238
|
);
|
|
237
239
|
};
|
|
238
240
|
export {
|
|
239
|
-
|
|
241
|
+
Ae as default
|
|
240
242
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ShimmerWrapper as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ShimmerWrapper as u } from "./styles.js";
|
|
3
3
|
const e = (r) => {
|
|
4
4
|
if (r != null)
|
|
5
5
|
return typeof r == "number" ? `${r}rem` : r;
|
|
6
|
-
}, p = ({ width: r = "100%", height: t = "100%",
|
|
6
|
+
}, p = ({ width: r = "100%", height: t = "100%", borderRadius: o = "0.4rem", label: i = "Loading...", ...m }) => /* @__PURE__ */ n(u, { role: "status", "aria-label": i, $width: e(r), $height: e(t), $borderRadius: e(o), ...m });
|
|
7
7
|
export {
|
|
8
8
|
p as default
|
|
9
9
|
};
|
|
@@ -7,9 +7,9 @@ const i = o`
|
|
|
7
7
|
position: relative;
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
background-color: ${e.m300};
|
|
10
|
-
border-radius:
|
|
11
|
-
width: ${({ width: r }) => r};
|
|
12
|
-
height: ${({ height: r }) => r};
|
|
10
|
+
border-radius: ${({ $borderRadius: r }) => r};
|
|
11
|
+
width: ${({ $width: r }) => r};
|
|
12
|
+
height: ${({ $height: r }) => r};
|
|
13
13
|
|
|
14
14
|
&:after {
|
|
15
15
|
content: '';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { SpinnerSVG as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
2
|
+
import { SpinnerSVG as s, SpinnerCircle as a } from "./styles.js";
|
|
3
|
+
import h from "../../colors/index.js";
|
|
4
|
+
import d from "../../colors/green.js";
|
|
5
|
+
import p from "../../colors/white.js";
|
|
6
|
+
import c from "../../colors/grey.js";
|
|
7
|
+
const g = {
|
|
8
8
|
small: { strokeWidth: 6, $length: "1rem" },
|
|
9
9
|
medium: { strokeWidth: 5, $length: "2rem" },
|
|
10
10
|
large: { strokeWidth: 5, $length: "3rem" }
|
|
11
|
-
},
|
|
11
|
+
}, $ = ({ color: e = "green", size: o = "medium", ...n }) => {
|
|
12
12
|
var t;
|
|
13
|
-
const { strokeWidth:
|
|
13
|
+
const { strokeWidth: m, $length: r } = g[o], l = [p, c.m600].includes(e) ? e : (t = h[e] ?? d) == null ? void 0 : t.m500;
|
|
14
14
|
return /* @__PURE__ */ i(
|
|
15
|
-
|
|
15
|
+
s,
|
|
16
16
|
{
|
|
17
17
|
viewBox: "0 0 50 50",
|
|
18
18
|
width: r,
|
|
@@ -20,15 +20,16 @@ const c = {
|
|
|
20
20
|
role: "status",
|
|
21
21
|
"aria-label": "Loading",
|
|
22
22
|
"aria-live": "polite",
|
|
23
|
+
...n,
|
|
23
24
|
children: /* @__PURE__ */ i(
|
|
24
|
-
|
|
25
|
+
a,
|
|
25
26
|
{
|
|
26
27
|
cx: "25",
|
|
27
28
|
cy: "25",
|
|
28
29
|
r: "20",
|
|
29
30
|
fill: "none",
|
|
30
|
-
stroke:
|
|
31
|
-
strokeWidth:
|
|
31
|
+
stroke: l,
|
|
32
|
+
strokeWidth: m,
|
|
32
33
|
strokeLinecap: "round"
|
|
33
34
|
}
|
|
34
35
|
)
|
|
@@ -36,5 +37,5 @@ const c = {
|
|
|
36
37
|
);
|
|
37
38
|
};
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
$ as default
|
|
40
41
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
2
|
-
import { useState as n, useRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { useState as n, useRef as se, useEffect as F } from "react";
|
|
3
|
+
import oe from "../Glass/Glass.js";
|
|
4
|
+
import le from "./components/TimerRing/TimerRing.js";
|
|
5
5
|
import u from "../../colors/white.js";
|
|
6
|
-
import { Wrapper as
|
|
6
|
+
import { Wrapper as ce, Dimmer as de, Time as N, TimeTxt as E, HourHand as ue, MinuteHand as me, SecondHand as he, AllDots as pe, Dots as ge, AlarmRing as fe, BulletRing as Se, Bullet as be, LeftActions as Te, ActionBtn as m, MediaStopFilledWrapper as we, MediaPauseFilledWrapper as Ae, MediaPlayFilledWrapper as $e, RightActions as Re, AddWrapper as Pe } from "./styles.js";
|
|
7
7
|
const l = () => {
|
|
8
|
-
},
|
|
8
|
+
}, De = (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
|
+
}, je = ({
|
|
16
16
|
color: h = "green",
|
|
17
17
|
showTime: H = !0,
|
|
18
18
|
showTimeWithSec: p = !0,
|
|
@@ -23,66 +23,67 @@ const l = () => {
|
|
|
23
23
|
onTimerComplete: U = l,
|
|
24
24
|
onTimerRemove: O = l,
|
|
25
25
|
onTimerPause: G = l,
|
|
26
|
-
onTimerPlay: K = l
|
|
26
|
+
onTimerPlay: K = l,
|
|
27
|
+
..._
|
|
27
28
|
}) => {
|
|
28
|
-
const [f,
|
|
29
|
+
const [f, q] = n(/* @__PURE__ */ new Date()), [s, S] = n(0), [d, b] = n(!1), [T, J] = n(De(a)), [Q, w] = n(0), [A, $] = n(!1), k = se(d);
|
|
29
30
|
F(() => {
|
|
30
31
|
k.current = d;
|
|
31
32
|
}, [d]);
|
|
32
|
-
const
|
|
33
|
+
const X = () => {
|
|
33
34
|
S(r), w(r % 60 * 6), b(!1), c();
|
|
34
|
-
}, X = () => {
|
|
35
|
-
$(!0), O();
|
|
36
35
|
}, Y = () => {
|
|
37
|
-
|
|
36
|
+
$(!0), O();
|
|
38
37
|
}, V = () => {
|
|
39
|
-
|
|
38
|
+
S(0), w(0), $(!1);
|
|
40
39
|
}, Z = () => {
|
|
40
|
+
b(!0), G();
|
|
41
|
+
}, ee = () => {
|
|
41
42
|
b(!1), K();
|
|
42
43
|
};
|
|
43
44
|
F(() => {
|
|
44
45
|
const L = setInterval(() => {
|
|
45
46
|
const o = /* @__PURE__ */ new Date();
|
|
46
|
-
|
|
47
|
-
const
|
|
47
|
+
q(o), J((t) => {
|
|
48
|
+
const te = o.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1].split(" ")[0], [re, W, j] = te.split(":").map(Number), ie = j * 6, ne = W * 6 + j * 0.1, ae = re % 12 * 30 + W * 0.5, D = (v, x) => {
|
|
48
49
|
const z = v % 360;
|
|
49
50
|
return v - z + x + (x < z ? 360 : 0);
|
|
50
51
|
};
|
|
51
52
|
return {
|
|
52
|
-
second: D(t.second,
|
|
53
|
-
minute: D(t.minute,
|
|
54
|
-
hour: D(t.hour,
|
|
53
|
+
second: D(t.second, ie),
|
|
54
|
+
minute: D(t.minute, ne),
|
|
55
|
+
hour: D(t.hour, ae)
|
|
55
56
|
};
|
|
56
57
|
}), k.current || (S((t) => (t - 1 === 0 && (U(), $(!0)), t - 1)), w((t) => t - 6));
|
|
57
58
|
}, 1e3);
|
|
58
59
|
return () => clearInterval(L);
|
|
59
60
|
}, []);
|
|
60
61
|
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
|
-
return /* @__PURE__ */ i(
|
|
62
|
-
/* @__PURE__ */ e(
|
|
62
|
+
return /* @__PURE__ */ i(ce, { $color: h, role: "region", "aria-label": "Clock", ..._, children: [
|
|
63
|
+
/* @__PURE__ */ e(oe, { borderRadius: "1.2rem", "aria-hidden": "true" }),
|
|
63
64
|
H && /* @__PURE__ */ i(B, { children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
65
|
+
/* @__PURE__ */ e(de, { "aria-hidden": "true" }),
|
|
65
66
|
g ? /* @__PURE__ */ i(N, { as: "time", dateTime: f.toISOString(), "aria-label": C, children: [
|
|
66
67
|
/* @__PURE__ */ e(E, { "aria-hidden": "true", children: p ? I : y }),
|
|
67
68
|
/* @__PURE__ */ e(E, { "aria-hidden": "true", children: M })
|
|
68
69
|
] }) : /* @__PURE__ */ i(N, { as: "time", dateTime: f.toISOString(), "aria-label": C, children: [
|
|
69
|
-
/* @__PURE__ */ e(
|
|
70
|
-
/* @__PURE__ */ e(
|
|
71
|
-
/* @__PURE__ */ e(
|
|
70
|
+
/* @__PURE__ */ e(ue, { $rotate: T.hour, "aria-hidden": "true" }),
|
|
71
|
+
/* @__PURE__ */ e(me, { $rotate: T.minute, "aria-hidden": "true" }),
|
|
72
|
+
/* @__PURE__ */ e(he, { $rotate: T.second, "aria-hidden": "true" })
|
|
72
73
|
] })
|
|
73
74
|
] }),
|
|
74
|
-
/* @__PURE__ */ e(
|
|
75
|
+
/* @__PURE__ */ e(pe, { "aria-hidden": "true", children: [...Array(60)].map((L, o) => /* @__PURE__ */ e(ge, { style: { rotate: `${o * 6}deg` } }, o)) }),
|
|
75
76
|
(!P || A) && /* @__PURE__ */ i(B, { children: [
|
|
76
77
|
/* @__PURE__ */ e(
|
|
77
|
-
|
|
78
|
+
fe,
|
|
78
79
|
{
|
|
79
80
|
$dismissing: A,
|
|
80
|
-
onAnimationEnd:
|
|
81
|
+
onAnimationEnd: V,
|
|
81
82
|
"aria-hidden": "true",
|
|
82
|
-
children: /* @__PURE__ */ e(
|
|
83
|
+
children: /* @__PURE__ */ e(le, { progress: s >= 60 ? 1 : s % 60 / 60 })
|
|
83
84
|
}
|
|
84
85
|
),
|
|
85
|
-
/* @__PURE__ */ e(
|
|
86
|
+
/* @__PURE__ */ e(Se, { $angle: Q, $dismissing: A, "aria-hidden": "true", children: /* @__PURE__ */ e(be, {}) }),
|
|
86
87
|
/* @__PURE__ */ e(
|
|
87
88
|
"span",
|
|
88
89
|
{
|
|
@@ -100,13 +101,13 @@ const l = () => {
|
|
|
100
101
|
}
|
|
101
102
|
)
|
|
102
103
|
] }),
|
|
103
|
-
/* @__PURE__ */ i(
|
|
104
|
-
/* @__PURE__ */ e(m, { onClick:
|
|
105
|
-
P || !d ? /* @__PURE__ */ e(m, { onClick:
|
|
104
|
+
/* @__PURE__ */ i(Te, { $noActions: P, children: [
|
|
105
|
+
/* @__PURE__ */ e(m, { onClick: Y, "aria-label": "Stop timer", children: /* @__PURE__ */ e(we, { color: u, size: 14, "aria-hidden": "true" }) }),
|
|
106
|
+
P || !d ? /* @__PURE__ */ e(m, { onClick: Z, "aria-label": "Pause timer", children: /* @__PURE__ */ e(Ae, { color: u, size: 14, "aria-hidden": "true" }) }) : /* @__PURE__ */ e(m, { onClick: ee, "aria-label": "Resume timer", children: /* @__PURE__ */ e($e, { color: u, size: 14, "aria-hidden": "true" }) })
|
|
106
107
|
] }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
108
|
+
/* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(m, { onClick: X, "aria-label": `Start ${r} second timer`, children: /* @__PURE__ */ e(Pe, { color: u, size: 20, "aria-hidden": "true" }) }) })
|
|
108
109
|
] });
|
|
109
110
|
};
|
|
110
111
|
export {
|
|
111
|
-
|
|
112
|
+
je as default
|
|
112
113
|
};
|