meticulous-ui 2.8.2 → 2.8.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/Timer/Timer.js +92 -75
- package/components/Timer/styles.js +72 -55
- package/package.json +1 -1
|
@@ -1,113 +1,130 @@
|
|
|
1
|
-
import { jsxs as i, jsx as e, Fragment as
|
|
2
|
-
import { useState as n, useRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useRef as oe, useEffect as N } from "react";
|
|
3
|
+
import se from "../Glass/Glass.js";
|
|
4
4
|
import le from "./components/TimerRing/TimerRing.js";
|
|
5
|
-
import
|
|
6
|
-
import { Wrapper as
|
|
7
|
-
const
|
|
8
|
-
},
|
|
9
|
-
const a = (/* @__PURE__ */ new Date()).toLocaleString("en-Us", { hour12: !0, timeZone:
|
|
5
|
+
import m from "../../colors/white.js";
|
|
6
|
+
import { Wrapper as de, Dimmer as ce, DotsWrapper as ue, AllDots as me, Dots as he, Time as v, TimeTxt as E, HourHand as pe, MinuteHand as ge, SecondHand as be, AlarmRing as fe, BulletRing as Se, Bullet as Te, VisuallyHidden as Ae, LeftActions as $e, ActionBtn as h, MediaStopFilledWrapper as Re, MediaPauseFilledWrapper as De, MediaPlayFilledWrapper as Pe, RightActions as we, AddWrapper as ye } from "./styles.js";
|
|
7
|
+
const d = () => {
|
|
8
|
+
}, He = (p) => () => {
|
|
9
|
+
const a = (/* @__PURE__ */ new Date()).toLocaleString("en-Us", { hour12: !0, timeZone: p }).split(", ")[1].split(" ")[0], [b, r, c] = a.split(":").map(Number);
|
|
10
10
|
return {
|
|
11
11
|
second: c * 6,
|
|
12
12
|
minute: r * 6 + c * 0.1,
|
|
13
|
-
hour:
|
|
13
|
+
hour: b % 12 * 30 + r * 0.5
|
|
14
14
|
};
|
|
15
|
-
},
|
|
16
|
-
color:
|
|
17
|
-
showTime:
|
|
18
|
-
showTimeWithSec:
|
|
15
|
+
}, ze = ({
|
|
16
|
+
color: p = "green",
|
|
17
|
+
showTime: y = !0,
|
|
18
|
+
showTimeWithSec: g = !0,
|
|
19
19
|
timeZone: a = "Asia/Kolkata",
|
|
20
|
-
isDigital:
|
|
20
|
+
isDigital: b = !0,
|
|
21
21
|
timerSeconds: r = 0,
|
|
22
|
-
onTimerAdd: c =
|
|
23
|
-
onTimerComplete: U =
|
|
24
|
-
onTimerRemove: O =
|
|
25
|
-
onTimerPause: G =
|
|
26
|
-
onTimerPlay: K =
|
|
22
|
+
onTimerAdd: c = d,
|
|
23
|
+
onTimerComplete: U = d,
|
|
24
|
+
onTimerRemove: O = d,
|
|
25
|
+
onTimerPause: G = d,
|
|
26
|
+
onTimerPlay: K = d,
|
|
27
27
|
..._
|
|
28
28
|
}) => {
|
|
29
|
-
const [f, q] = n(/* @__PURE__ */ new Date()), [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
S(r),
|
|
29
|
+
const [f, q] = n(/* @__PURE__ */ new Date()), [o, S] = n(0), [u, T] = n(!1), [A, J] = n(He(a)), [Q, $] = n(0), [R, D] = n(!1), H = oe(u);
|
|
30
|
+
N(() => {
|
|
31
|
+
H.current = u;
|
|
32
|
+
}, [u]);
|
|
33
|
+
const V = () => {
|
|
34
|
+
S(r), $(r % 60 * 6), T(!1), c();
|
|
35
|
+
}, X = () => {
|
|
36
|
+
D(!0), O();
|
|
35
37
|
}, Y = () => {
|
|
36
|
-
$(
|
|
37
|
-
}, V = () => {
|
|
38
|
-
S(0), w(0), $(!1);
|
|
38
|
+
S(0), $(0), D(!1);
|
|
39
39
|
}, Z = () => {
|
|
40
|
-
|
|
40
|
+
T(!0), G();
|
|
41
41
|
}, ee = () => {
|
|
42
|
-
|
|
42
|
+
T(!1), K();
|
|
43
43
|
};
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
q(
|
|
48
|
-
const te =
|
|
49
|
-
const
|
|
50
|
-
return
|
|
44
|
+
N(() => {
|
|
45
|
+
const C = setInterval(() => {
|
|
46
|
+
const l = /* @__PURE__ */ new Date();
|
|
47
|
+
q(l), J((t) => {
|
|
48
|
+
const te = l.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1].split(" ")[0], [re, L, j] = te.split(":").map(Number), ie = j * 6, ne = L * 6 + j * 0.1, ae = re % 12 * 30 + L * 0.5, w = (x, z) => {
|
|
49
|
+
const B = x % 360;
|
|
50
|
+
return x - B + z + (z < B ? 360 : 0);
|
|
51
51
|
};
|
|
52
52
|
return {
|
|
53
|
-
second:
|
|
54
|
-
minute:
|
|
55
|
-
hour:
|
|
53
|
+
second: w(t.second, ie),
|
|
54
|
+
minute: w(t.minute, ne),
|
|
55
|
+
hour: w(t.hour, ae)
|
|
56
56
|
};
|
|
57
|
-
}),
|
|
57
|
+
}), H.current || (S((t) => (t - 1 === 0 && (U(), D(!0)), t - 1)), $((t) => t - 6));
|
|
58
58
|
}, 1e3);
|
|
59
|
-
return () => clearInterval(
|
|
59
|
+
return () => clearInterval(C);
|
|
60
60
|
}, []);
|
|
61
|
-
const
|
|
62
|
-
return /* @__PURE__ */ i(
|
|
63
|
-
/* @__PURE__ */ e(
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */ e(
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */ e(E, { "aria-hidden": "true", children:
|
|
68
|
-
/* @__PURE__ */ e(E, { "aria-hidden": "true", children:
|
|
69
|
-
] }) : /* @__PURE__ */ i(
|
|
70
|
-
/* @__PURE__ */ e(
|
|
71
|
-
/* @__PURE__ */ e(
|
|
72
|
-
/* @__PURE__ */ e(
|
|
61
|
+
const P = f.toLocaleString("en-Us", { hour12: !0, timeZone: a }).split(", ")[1], k = P.split(" ")[0], I = P.split(" ")[1], M = P.split(":").slice(0, 2).join(":"), s = !(Number.isInteger(o) && o > 0), W = `${g ? k : M} ${I}`;
|
|
62
|
+
return /* @__PURE__ */ i(de, { $color: p, role: "region", "aria-label": "Clock", ..._, children: [
|
|
63
|
+
/* @__PURE__ */ e(se, { borderRadius: "1.2rem", "aria-hidden": "true" }),
|
|
64
|
+
y && /* @__PURE__ */ i(F, { children: [
|
|
65
|
+
/* @__PURE__ */ e(ce, { "aria-hidden": "true", children: /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(me, { "aria-hidden": "true", children: [...Array(60)].map((C, l) => /* @__PURE__ */ e(he, { style: { rotate: `${l * 6}deg` } }, l)) }) }) }),
|
|
66
|
+
b ? /* @__PURE__ */ i(v, { as: "time", dateTime: f.toISOString(), "aria-label": W, children: [
|
|
67
|
+
/* @__PURE__ */ e(E, { "aria-hidden": "true", children: g ? k : M }),
|
|
68
|
+
/* @__PURE__ */ e(E, { "aria-hidden": "true", children: I })
|
|
69
|
+
] }) : /* @__PURE__ */ i(v, { as: "time", dateTime: f.toISOString(), "aria-label": W, children: [
|
|
70
|
+
/* @__PURE__ */ e(pe, { $rotate: A.hour, "aria-hidden": "true" }),
|
|
71
|
+
/* @__PURE__ */ e(ge, { $rotate: A.minute, "aria-hidden": "true" }),
|
|
72
|
+
/* @__PURE__ */ e(be, { $rotate: A.second, "aria-hidden": "true" })
|
|
73
73
|
] })
|
|
74
74
|
] }),
|
|
75
|
-
|
|
76
|
-
(!P || A) && /* @__PURE__ */ i(B, { children: [
|
|
75
|
+
(!s || R) && /* @__PURE__ */ i(F, { children: [
|
|
77
76
|
/* @__PURE__ */ e(
|
|
78
77
|
fe,
|
|
79
78
|
{
|
|
80
|
-
$dismissing:
|
|
81
|
-
onAnimationEnd:
|
|
79
|
+
$dismissing: R,
|
|
80
|
+
onAnimationEnd: Y,
|
|
82
81
|
"aria-hidden": "true",
|
|
83
|
-
children: /* @__PURE__ */ e(le, { progress:
|
|
82
|
+
children: /* @__PURE__ */ e(le, { progress: o >= 60 ? 1 : o % 60 / 60 })
|
|
84
83
|
}
|
|
85
84
|
),
|
|
86
|
-
/* @__PURE__ */ e(Se, { $angle: Q, $dismissing:
|
|
85
|
+
/* @__PURE__ */ e(Se, { $angle: Q, $dismissing: R, "aria-hidden": "true", children: /* @__PURE__ */ e(Te, {}) }),
|
|
87
86
|
/* @__PURE__ */ e(
|
|
88
|
-
|
|
87
|
+
Ae,
|
|
89
88
|
{
|
|
90
89
|
role: "timer",
|
|
91
90
|
"aria-live": "polite",
|
|
92
|
-
"aria-label": `${
|
|
93
|
-
style: {
|
|
94
|
-
position: "absolute",
|
|
95
|
-
width: 1,
|
|
96
|
-
height: 1,
|
|
97
|
-
overflow: "hidden",
|
|
98
|
-
clip: "rect(0 0 0 0)",
|
|
99
|
-
whiteSpace: "nowrap"
|
|
100
|
-
}
|
|
91
|
+
"aria-label": `${o} seconds remaining`
|
|
101
92
|
}
|
|
102
93
|
)
|
|
103
94
|
] }),
|
|
104
|
-
/* @__PURE__ */ i(
|
|
105
|
-
/* @__PURE__ */ e(
|
|
106
|
-
|
|
95
|
+
/* @__PURE__ */ i($e, { $noActions: s, role: "group", "aria-label": "Timer controls", children: [
|
|
96
|
+
/* @__PURE__ */ e(
|
|
97
|
+
h,
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
onClick: X,
|
|
101
|
+
"aria-label": "Stop timer",
|
|
102
|
+
"aria-disabled": s,
|
|
103
|
+
children: /* @__PURE__ */ e(Re, { color: m, size: 14, "aria-hidden": "true" })
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
s || !u ? /* @__PURE__ */ e(
|
|
107
|
+
h,
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: Z,
|
|
111
|
+
"aria-label": "Pause timer",
|
|
112
|
+
"aria-disabled": s,
|
|
113
|
+
children: /* @__PURE__ */ e(De, { color: m, size: 14, "aria-hidden": "true" })
|
|
114
|
+
}
|
|
115
|
+
) : /* @__PURE__ */ e(h, { type: "button", onClick: ee, "aria-label": "Resume timer", children: /* @__PURE__ */ e(Pe, { color: m, size: 14, "aria-hidden": "true" }) })
|
|
107
116
|
] }),
|
|
108
|
-
/* @__PURE__ */ e(
|
|
117
|
+
/* @__PURE__ */ e(we, { role: "group", "aria-label": "Start timer", children: /* @__PURE__ */ e(
|
|
118
|
+
h,
|
|
119
|
+
{
|
|
120
|
+
type: "button",
|
|
121
|
+
onClick: V,
|
|
122
|
+
"aria-label": `Start ${r} second timer`,
|
|
123
|
+
children: /* @__PURE__ */ e(ye, { color: m, size: 20, "aria-hidden": "true" })
|
|
124
|
+
}
|
|
125
|
+
) })
|
|
109
126
|
] });
|
|
110
127
|
};
|
|
111
128
|
export {
|
|
112
|
-
|
|
129
|
+
ze as default
|
|
113
130
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import t, { css as i, keyframes as
|
|
2
|
-
import
|
|
1
|
+
import t, { css as i, keyframes as s } from "styled-components";
|
|
2
|
+
import a from "../Icons/Add/Add.js";
|
|
3
3
|
import d from "../Icons/MediaStopFilled/MediaStopFilled.js";
|
|
4
4
|
import p from "../Icons/MediaPauseFilled/MediaPauseFilled.js";
|
|
5
5
|
import l from "../Icons/MediaPlayFilled/MediaPlayFilled.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import e from "../../colors/white.js";
|
|
7
|
+
import c from "../../colors/black.js";
|
|
8
|
+
import m from "../../colors/red.js";
|
|
9
9
|
import { COLOR_MAPPING as h } from "./constants.js";
|
|
10
|
-
const
|
|
10
|
+
const u = ({ $color: o }) => h[o], r = i`
|
|
11
11
|
position: absolute;
|
|
12
12
|
bottom: 50%;
|
|
13
13
|
transform-origin: bottom;
|
|
14
14
|
border-radius: 4px;
|
|
15
15
|
transition: rotate 0.3s ease-in-out;
|
|
16
16
|
rotate: ${({ $rotate: o }) => o}deg;
|
|
17
|
-
`,
|
|
17
|
+
`, A = t.div`
|
|
18
18
|
position: relative;
|
|
19
19
|
height: 20rem;
|
|
20
20
|
width: 20rem;
|
|
21
21
|
border-radius: 1.2rem;
|
|
22
|
-
background-color: ${
|
|
22
|
+
background-color: ${u};
|
|
23
23
|
`, M = t.div`
|
|
24
24
|
position: absolute;
|
|
25
25
|
left: 50%;
|
|
@@ -35,18 +35,18 @@ const g = ({ $color: o }) => h[o], e = i`
|
|
|
35
35
|
left: 50%;
|
|
36
36
|
top: 48%;
|
|
37
37
|
transform: translate(-50%, -50%);
|
|
38
|
-
`,
|
|
39
|
-
color: ${
|
|
38
|
+
`, H = t.div`
|
|
39
|
+
color: ${e};
|
|
40
40
|
font-size: 1.5rem;
|
|
41
41
|
font-weight: 600;
|
|
42
42
|
text-align: center;
|
|
43
43
|
opacity: 0.8;
|
|
44
|
-
`,
|
|
44
|
+
`, P = t.span`
|
|
45
45
|
position: absolute;
|
|
46
46
|
width: 2.4px;
|
|
47
47
|
height: 2.4px;
|
|
48
48
|
background: rgba(255, 255, 255, 0.4);
|
|
49
|
-
transform-origin:
|
|
49
|
+
transform-origin: 5.875rem;
|
|
50
50
|
border-radius: 2px;
|
|
51
51
|
|
|
52
52
|
&:nth-child(5n) {
|
|
@@ -60,37 +60,41 @@ const g = ({ $color: o }) => h[o], e = i`
|
|
|
60
60
|
height: 2px;
|
|
61
61
|
background: rgba(255, 255, 255);
|
|
62
62
|
}
|
|
63
|
-
`,
|
|
63
|
+
`, W = t.div`
|
|
64
|
+
position: relative;
|
|
65
|
+
height: 100%;
|
|
66
|
+
width: 100%;
|
|
67
|
+
`, D = t.div`
|
|
64
68
|
position: absolute;
|
|
65
|
-
left:
|
|
66
|
-
top: 44
|
|
69
|
+
left: 1.6%;
|
|
70
|
+
top: 44%;
|
|
67
71
|
transform: translate(-50%, -50%) rotate(6.7deg);
|
|
68
|
-
`,
|
|
69
|
-
${
|
|
72
|
+
`, S = t.div`
|
|
73
|
+
${r};
|
|
70
74
|
width: 6px;
|
|
71
75
|
height: 60px;
|
|
72
|
-
background: ${
|
|
73
|
-
`,
|
|
74
|
-
${
|
|
76
|
+
background: ${e};
|
|
77
|
+
`, R = t.div`
|
|
78
|
+
${r};
|
|
75
79
|
width: 4px;
|
|
76
80
|
height: 80px;
|
|
77
|
-
background: ${
|
|
78
|
-
`,
|
|
79
|
-
${
|
|
81
|
+
background: ${c.m200};
|
|
82
|
+
`, B = t.div`
|
|
83
|
+
${r};
|
|
80
84
|
width: 2px;
|
|
81
85
|
height: 90px;
|
|
82
|
-
background: ${
|
|
83
|
-
`, n =
|
|
86
|
+
background: ${m.m800};
|
|
87
|
+
`, n = s`
|
|
84
88
|
from { opacity: 1; transform: scale(1); }
|
|
85
89
|
to { opacity: 0; transform: scale(0.85); }
|
|
86
|
-
`,
|
|
90
|
+
`, C = t.div`
|
|
87
91
|
position: absolute;
|
|
88
92
|
left: 16%;
|
|
89
93
|
top: 14%;
|
|
90
94
|
${({ $dismissing: o }) => o && i`
|
|
91
95
|
animation: ${n} 0.4s ease-out forwards;
|
|
92
96
|
`}
|
|
93
|
-
`,
|
|
97
|
+
`, T = t.div`
|
|
94
98
|
position: absolute;
|
|
95
99
|
bottom: 6%;
|
|
96
100
|
left: 8%;
|
|
@@ -102,47 +106,58 @@ const g = ({ $color: o }) => h[o], e = i`
|
|
|
102
106
|
pointer-events: none;
|
|
103
107
|
opacity: 0.5;
|
|
104
108
|
`}
|
|
105
|
-
`,
|
|
109
|
+
`, L = t.div`
|
|
106
110
|
position: absolute;
|
|
107
111
|
bottom: 6%;
|
|
108
112
|
right: 8%;
|
|
109
113
|
border-radius: 0.4rem;
|
|
110
|
-
`,
|
|
114
|
+
`, N = t.button`
|
|
111
115
|
position: relative;
|
|
112
|
-
width: 100%;
|
|
113
|
-
height: 100%;
|
|
114
116
|
height: 2.4rem;
|
|
115
117
|
width: 2.4rem;
|
|
116
118
|
cursor: pointer;
|
|
117
119
|
background-color: rgba(0, 0, 0, 0.4);
|
|
118
120
|
border: none;
|
|
121
|
+
border-radius: 0.4rem;
|
|
119
122
|
padding: 0;
|
|
120
|
-
|
|
123
|
+
|
|
124
|
+
&:focus-visible {
|
|
125
|
+
outline: 2px solid ${e};
|
|
126
|
+
outline-offset: 2px;
|
|
127
|
+
}
|
|
128
|
+
`, O = t(a)`
|
|
121
129
|
position: absolute;
|
|
122
130
|
left: 50%;
|
|
123
131
|
top: 50%;
|
|
124
132
|
transform: translate(-50%, -50%);
|
|
125
|
-
`,
|
|
133
|
+
`, _ = t(d)`
|
|
126
134
|
position: absolute;
|
|
127
135
|
left: 50%;
|
|
128
136
|
top: 50%;
|
|
129
137
|
transform: translate(-50%, -50%);
|
|
130
|
-
`,
|
|
138
|
+
`, z = t(p)`
|
|
131
139
|
position: absolute;
|
|
132
140
|
left: 50%;
|
|
133
141
|
top: 50%;
|
|
134
142
|
transform: translate(-50%, -50%);
|
|
135
|
-
`,
|
|
143
|
+
`, G = t(l)`
|
|
136
144
|
position: absolute;
|
|
137
145
|
left: 50%;
|
|
138
146
|
top: 50%;
|
|
139
147
|
transform: translate(-50%, -50%);
|
|
140
|
-
`,
|
|
148
|
+
`, I = t.span`
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 1px;
|
|
151
|
+
height: 1px;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
clip-path: inset(50%);
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
`, V = t.div`
|
|
141
156
|
width: 9px;
|
|
142
157
|
height: 9px;
|
|
143
158
|
border-radius: 50%;
|
|
144
|
-
background-color: ${
|
|
145
|
-
`,
|
|
159
|
+
background-color: ${e};
|
|
160
|
+
`, j = t.div`
|
|
146
161
|
position: absolute;
|
|
147
162
|
left: 26%;
|
|
148
163
|
top: 24%;
|
|
@@ -156,23 +171,25 @@ const g = ({ $color: o }) => h[o], e = i`
|
|
|
156
171
|
`}
|
|
157
172
|
`;
|
|
158
173
|
export {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
174
|
+
N as ActionBtn,
|
|
175
|
+
O as AddWrapper,
|
|
176
|
+
C as AlarmRing,
|
|
177
|
+
D as AllDots,
|
|
178
|
+
V as Bullet,
|
|
179
|
+
j as BulletRing,
|
|
165
180
|
M as Dimmer,
|
|
166
|
-
|
|
167
|
-
W as
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
z as
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
P as Dots,
|
|
182
|
+
W as DotsWrapper,
|
|
183
|
+
S as HourHand,
|
|
184
|
+
T as LeftActions,
|
|
185
|
+
z as MediaPauseFilledWrapper,
|
|
186
|
+
G as MediaPlayFilledWrapper,
|
|
187
|
+
_ as MediaStopFilledWrapper,
|
|
188
|
+
R as MinuteHand,
|
|
189
|
+
L as RightActions,
|
|
190
|
+
B as SecondHand,
|
|
175
191
|
F as Time,
|
|
176
|
-
|
|
177
|
-
|
|
192
|
+
H as TimeTxt,
|
|
193
|
+
I as VisuallyHidden,
|
|
194
|
+
A as Wrapper
|
|
178
195
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.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",
|