@overdoser/react-toolkit 0.20.0 → 0.22.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.
Files changed (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.scss.js +31 -60
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +45 -40
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,159 +1,193 @@
1
- import { jsx as f, jsxs as S } from "react/jsx-runtime";
2
- import { forwardRef as pe, useState as ce, useRef as p, useCallback as g, useEffect as H, useImperativeHandle as ye, Fragment as Me } from "react";
3
- import i from "clsx";
4
- import t from "./Timer.module.scss.js";
5
- const T = () => Date.now();
6
- function xe(n) {
7
- const l = Math.max(0, Math.floor(n)), u = Math.floor(l / 86400), d = Math.floor(l % 86400 / 3600), h = Math.floor(l % 3600 / 60), r = l % 60, e = (y) => String(y).padStart(2, "0");
8
- return u > 0 ? `${u}d ${e(d)}:${e(h)}:${e(r)}` : d > 0 ? `${d}:${e(h)}:${e(r)}` : `${e(h)}:${e(r)}`;
1
+ import { Fragment as e, forwardRef as t, useCallback as n, useEffect as r, useImperativeHandle as i, useRef as a, useState as o } from "react";
2
+ import s from "clsx";
3
+ import c from "./Timer.module.scss.js";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ // src/components/Timer/Timer.tsx
6
+ var d = () => Date.now();
7
+ function ee(e) {
8
+ let t = Math.max(0, Math.floor(e)), n = Math.floor(t / 86400), r = Math.floor(t % 86400 / 3600), i = Math.floor(t % 3600 / 60), a = t % 60, o = (e) => String(e).padStart(2, "0");
9
+ return n > 0 ? `${n}d ${o(r)}:${o(i)}:${o(a)}` : r > 0 ? `${r}:${o(i)}:${o(a)}` : `${o(i)}:${o(a)}`;
9
10
  }
10
- const Ne = ["days", "hours", "minutes", "seconds"], ve = { days: 86400, hours: 3600, minutes: 60, seconds: 1 }, be = { days: "d", hours: "h", minutes: "m", seconds: "s" }, Re = { days: "days", hours: "hours", minutes: "minutes", seconds: "seconds" };
11
- function Ie(n) {
12
- return n >= 86400 ? ["days", "hours", "minutes", "seconds"] : n >= 3600 ? ["hours", "minutes", "seconds"] : ["minutes", "seconds"];
11
+ var f = [
12
+ "days",
13
+ "hours",
14
+ "minutes",
15
+ "seconds"
16
+ ], p = {
17
+ days: 86400,
18
+ hours: 3600,
19
+ minutes: 60,
20
+ seconds: 1
21
+ }, m = {
22
+ days: "d",
23
+ hours: "h",
24
+ minutes: "m",
25
+ seconds: "s"
26
+ }, h = {
27
+ days: "days",
28
+ hours: "hours",
29
+ minutes: "minutes",
30
+ seconds: "seconds"
31
+ };
32
+ function te(e) {
33
+ return e >= 86400 ? [
34
+ "days",
35
+ "hours",
36
+ "minutes",
37
+ "seconds"
38
+ ] : e >= 3600 ? [
39
+ "hours",
40
+ "minutes",
41
+ "seconds"
42
+ ] : ["minutes", "seconds"];
13
43
  }
14
- function Se(n, l, u, d) {
15
- const h = Ne.filter((e) => l.includes(e));
16
- let r = Math.max(0, Math.floor(n));
17
- return h.map((e, y) => {
18
- const $ = ve[e], M = Math.floor(r / $);
19
- r %= $;
20
- const F = y === 0 ? String(M) : String(M).padStart(2, "0"), x = d?.[e];
21
- let b;
22
- return x !== void 0 ? b = typeof x == "function" ? x(M) : x : b = u === "long" ? Re[e] : be[e], { unit: e, value: M, text: F, label: b };
23
- });
44
+ function ne(e, t, n, r) {
45
+ let i = f.filter((e) => t.includes(e)), a = Math.max(0, Math.floor(e));
46
+ return i.map((e, t) => {
47
+ let i = p[e], o = Math.floor(a / i);
48
+ a %= i;
49
+ let s = t === 0 ? String(o) : String(o).padStart(2, "0"), c = r?.[e], l;
50
+ return l = c === void 0 ? n === "long" ? h[e] : m[e] : typeof c == "function" ? c(o) : c, {
51
+ unit: e,
52
+ value: o,
53
+ text: s,
54
+ label: l
55
+ };
56
+ });
24
57
  }
25
- const Te = pe(
26
- ({
27
- mode: n = "countdown",
28
- duration: l,
29
- to: u,
30
- value: d,
31
- autoStart: h = !0,
32
- running: r,
33
- interval: e = 1e3,
34
- variant: y = "digital",
35
- size: $ = "md",
36
- format: M = xe,
37
- units: F,
38
- unitFormat: x = "short",
39
- unitLabels: b,
40
- segmentVariant: ae = "boxed",
41
- renderSegment: G,
42
- segmentSeparator: W,
43
- label: q,
44
- labelPlacement: O = "bottom",
45
- onComplete: z,
46
- onTick: J,
47
- classes: o,
48
- className: ie,
49
- style: le,
50
- "aria-label": ue
51
- }, de) => {
52
- const c = d !== void 0, s = u !== void 0, K = s ? u instanceof Date ? u.getTime() : u : 0, V = (l ?? 0) * 1e3, [, Q] = ce(0), [w, D] = ce(!1), m = p(null), X = p(!1), k = p(0), R = p(!1), L = p(null), Y = p(z), Z = p(J);
53
- Y.current = z, Z.current = J;
54
- const P = g(
55
- () => k.current + (m.current != null ? T() - m.current : 0),
56
- []
57
- ), I = g(() => {
58
- if (c) return d;
59
- if (s) return Math.max(0, (K - T()) / 1e3);
60
- const a = P();
61
- return n === "countdown" ? Math.max(0, (V - a) / 1e3) : a / 1e3;
62
- }, [c, d, s, K, P, n, V]), N = g(() => {
63
- L.current && (clearInterval(L.current), L.current = null);
64
- }, []), U = g(() => {
65
- m.current != null && (k.current += T() - m.current, m.current = null), N(), D(!1);
66
- }, [N]), v = g(() => {
67
- c || (m.current == null && (m.current = T()), R.current = !1, D(!0));
68
- }, [c]), _ = g(() => U(), [U]), ee = g(() => {
69
- N(), m.current = null, k.current = 0, R.current = !1, D(!1), Q((a) => a + 1);
70
- }, [N]), te = g(() => {
71
- k.current = 0, R.current = !1, m.current = T(), D(!0);
72
- }, []);
73
- H(() => {
74
- X.current || (X.current = !0, h && r === void 0 && !c && !s && v());
75
- }, [h, r, c, s, v]), H(() => {
76
- if (c || !(s ? !0 : w)) return;
77
- const E = () => {
78
- const oe = I();
79
- Z.current?.(oe), Q((ge) => ge + 1), (n === "countdown" || s) && oe <= 0 && !R.current && (R.current = !0, Y.current?.(), s || U());
80
- };
81
- return L.current = setInterval(E, e), N;
82
- }, [w, s, c, e, n, I, U, N]), H(() => {
83
- r === void 0 || c || (r ? v() : _());
84
- }, [r, c, v, _]), ye(
85
- de,
86
- () => ({
87
- start: v,
88
- pause: _,
89
- reset: ee,
90
- restart: te,
91
- getTime: () => I(),
92
- get isRunning() {
93
- return w;
94
- }
95
- }),
96
- [v, _, ee, te, I, w]
97
- );
98
- const A = I(), j = n === "countdown" || s ? Math.ceil(A) : Math.floor(A), ne = M(j), C = s ? 0 : V / 1e3;
99
- let B = 0;
100
- C > 0 && (B = n === "countdown" ? A / C : Math.min(1, A / C)), B = Math.max(0, Math.min(1, B));
101
- const me = Math.max(j, l ?? 0), fe = F ?? Ie(me), he = Se(j, fe, x, b), re = O === "top" || O === "left", se = q != null && /* @__PURE__ */ f("span", { className: i(t.label, o?.label), children: q });
102
- return /* @__PURE__ */ S(
103
- "div",
104
- {
105
- className: i(
106
- t.root,
107
- t[$],
108
- t[`label_${O}`],
109
- o?.root,
110
- ie
111
- ),
112
- style: le,
113
- role: "timer",
114
- "aria-label": ue,
115
- "aria-live": "off",
116
- children: [
117
- re && se,
118
- y === "ring" ? /* @__PURE__ */ S("span", { className: t.ringWrap, children: [
119
- /* @__PURE__ */ S("svg", { viewBox: "0 0 100 100", className: t.ring, "aria-hidden": "true", children: [
120
- /* @__PURE__ */ f("circle", { className: i(t.ringTrack, o?.ringTrack), cx: "50", cy: "50", r: "44" }),
121
- /* @__PURE__ */ f(
122
- "circle",
123
- {
124
- className: i(t.ringProgress, o?.ringProgress),
125
- cx: "50",
126
- cy: "50",
127
- r: "44",
128
- style: { strokeDasharray: 2 * Math.PI * 44, strokeDashoffset: 2 * Math.PI * 44 * (1 - B) }
129
- }
130
- )
131
- ] }),
132
- /* @__PURE__ */ f("span", { className: i(t.display, t.ringDisplay, o?.display), children: ne })
133
- ] }) : y === "segments" ? /* @__PURE__ */ f("span", { className: i(t.segments, o?.segments), children: he.map((a, E) => /* @__PURE__ */ S(Me, { children: [
134
- E > 0 && W != null && /* @__PURE__ */ f("span", { className: t.segmentSep, "aria-hidden": "true", children: W }),
135
- G ? G(a, E) : /* @__PURE__ */ S(
136
- "span",
137
- {
138
- className: i(
139
- t.segment,
140
- ae === "boxed" ? t.segmentBoxed : t.segmentPlain,
141
- o?.segment
142
- ),
143
- children: [
144
- /* @__PURE__ */ f("span", { className: i(t.segmentValue, o?.segmentValue), children: a.text }),
145
- /* @__PURE__ */ f("span", { className: i(t.segmentLabel, o?.segmentLabel), children: a.label })
146
- ]
147
- }
148
- )
149
- ] }, a.unit)) }) : /* @__PURE__ */ f("span", { className: i(t.display, o?.display), children: ne }),
150
- !re && se
151
- ]
152
- }
153
- );
154
- }
155
- );
156
- Te.displayName = "Timer";
157
- export {
158
- Te as Timer
159
- };
58
+ var g = t(({ mode: t = "countdown", duration: f, to: p, value: m, autoStart: h = !0, running: g, interval: _ = 1e3, variant: v = "digital", size: re = "md", format: ie = ee, units: ae, unitFormat: oe = "short", unitLabels: se, segmentVariant: ce = "boxed", renderSegment: y, segmentSeparator: b, label: x, labelPlacement: S = "bottom", onComplete: C, onTick: w, classes: T, className: le, style: ue, "aria-label": de }, fe) => {
59
+ let E = m !== void 0, D = p !== void 0, O = D ? p instanceof Date ? p.getTime() : p : 0, k = (f ?? 0) * 1e3, [, A] = o(0), [j, M] = o(!1), N = a(null), P = a(!1), F = a(0), I = a(!1), L = a(null), R = a(C), z = a(w);
60
+ R.current = C, z.current = w;
61
+ let B = n(() => F.current + (N.current == null ? 0 : d() - N.current), []), V = n(() => {
62
+ if (E) return m;
63
+ if (D) return Math.max(0, (O - d()) / 1e3);
64
+ let e = B();
65
+ return t === "countdown" ? Math.max(0, (k - e) / 1e3) : e / 1e3;
66
+ }, [
67
+ E,
68
+ m,
69
+ D,
70
+ O,
71
+ B,
72
+ t,
73
+ k
74
+ ]), H = n(() => {
75
+ L.current &&= (clearInterval(L.current), null);
76
+ }, []), U = n(() => {
77
+ N.current != null && (F.current += d() - N.current, N.current = null), H(), M(!1);
78
+ }, [H]), W = n(() => {
79
+ E || (N.current ??= d(), I.current = !1, M(!0));
80
+ }, [E]), G = n(() => U(), [U]), K = n(() => {
81
+ H(), N.current = null, F.current = 0, I.current = !1, M(!1), A((e) => e + 1);
82
+ }, [H]), q = n(() => {
83
+ F.current = 0, I.current = !1, N.current = d(), M(!0);
84
+ }, []);
85
+ r(() => {
86
+ P.current || (P.current = !0, h && g === void 0 && !E && !D && W());
87
+ }, [
88
+ h,
89
+ g,
90
+ E,
91
+ D,
92
+ W
93
+ ]), r(() => E || !(D || j) ? void 0 : (L.current = setInterval(() => {
94
+ let e = V();
95
+ z.current?.(e), A((e) => e + 1), (t === "countdown" || D) && e <= 0 && !I.current && (I.current = !0, R.current?.(), D || U());
96
+ }, _), H), [
97
+ j,
98
+ D,
99
+ E,
100
+ _,
101
+ t,
102
+ V,
103
+ U,
104
+ H
105
+ ]), r(() => {
106
+ g === void 0 || E || (g ? W() : G());
107
+ }, [
108
+ g,
109
+ E,
110
+ W,
111
+ G
112
+ ]), i(fe, () => ({
113
+ start: W,
114
+ pause: G,
115
+ reset: K,
116
+ restart: q,
117
+ getTime: () => V(),
118
+ get isRunning() {
119
+ return j;
120
+ }
121
+ }), [
122
+ W,
123
+ G,
124
+ K,
125
+ q,
126
+ V,
127
+ j
128
+ ]);
129
+ let J = V(), Y = t === "countdown" || D ? Math.ceil(J) : Math.floor(J), X = ie(Y), Z = D ? 0 : k / 1e3, Q = 0;
130
+ Z > 0 && (Q = t === "countdown" ? J / Z : Math.min(1, J / Z)), Q = Math.max(0, Math.min(1, Q));
131
+ let pe = ne(Y, ae ?? te(Math.max(Y, f ?? 0)), oe, se), $ = S === "top" || S === "left", me = x != null && /* @__PURE__ */ l("span", {
132
+ className: s(c.label, T?.label),
133
+ children: x
134
+ });
135
+ return /* @__PURE__ */ u("div", {
136
+ className: s(c.root, c[re], c[`label_${S}`], T?.root, le),
137
+ style: ue,
138
+ role: "timer",
139
+ "aria-label": de,
140
+ "aria-live": "off",
141
+ children: [
142
+ $ && me,
143
+ v === "ring" ? /* @__PURE__ */ u("span", {
144
+ className: c.ringWrap,
145
+ children: [/* @__PURE__ */ u("svg", {
146
+ viewBox: "0 0 100 100",
147
+ className: c.ring,
148
+ "aria-hidden": "true",
149
+ children: [/* @__PURE__ */ l("circle", {
150
+ className: s(c.ringTrack, T?.ringTrack),
151
+ cx: "50",
152
+ cy: "50",
153
+ r: "44"
154
+ }), /* @__PURE__ */ l("circle", {
155
+ className: s(c.ringProgress, T?.ringProgress),
156
+ cx: "50",
157
+ cy: "50",
158
+ r: "44",
159
+ style: {
160
+ strokeDasharray: 2 * Math.PI * 44,
161
+ strokeDashoffset: 2 * Math.PI * 44 * (1 - Q)
162
+ }
163
+ })]
164
+ }), /* @__PURE__ */ l("span", {
165
+ className: s(c.display, c.ringDisplay, T?.display),
166
+ children: X
167
+ })]
168
+ }) : v === "segments" ? /* @__PURE__ */ l("span", {
169
+ className: s(c.segments, T?.segments),
170
+ children: pe.map((t, n) => /* @__PURE__ */ u(e, { children: [n > 0 && b != null && /* @__PURE__ */ l("span", {
171
+ className: c.segmentSep,
172
+ "aria-hidden": "true",
173
+ children: b
174
+ }), y ? y(t, n) : /* @__PURE__ */ u("span", {
175
+ className: s(c.segment, ce === "boxed" ? c.segmentBoxed : c.segmentPlain, T?.segment),
176
+ children: [/* @__PURE__ */ l("span", {
177
+ className: s(c.segmentValue, T?.segmentValue),
178
+ children: t.text
179
+ }), /* @__PURE__ */ l("span", {
180
+ className: s(c.segmentLabel, T?.segmentLabel),
181
+ children: t.label
182
+ })]
183
+ })] }, t.unit))
184
+ }) : /* @__PURE__ */ l("span", {
185
+ className: s(c.display, T?.display),
186
+ children: X
187
+ }),
188
+ !$ && me
189
+ ]
190
+ });
191
+ });
192
+ g.displayName = "Timer";
193
+ export { g as Timer };
@@ -1,55 +1,29 @@
1
- const e = "crk-root-ze-qA", l = "crk-label_top-f5ix1", t = "crk-label_top-f5ix1", s = "crk-label_bottom-vf4Tk", r = "crk-label_bottom-vf4Tk", n = "crk-label_left-Tsjlx", o = "crk-label_left-Tsjlx", c = "crk-label_right-l0T9l", a = "crk-label_right-l0T9l", g = "crk-sm-LpMEk", b = "crk-md-Of6tL", i = "crk-lg-KKqPc", k = "crk-display-09uul", m = "crk-label-F7Uuf", p = "crk-ringWrap-F71Yf", _ = "crk-ring-PqZbn", f = "crk-ringTrack-SaJmr", T = "crk-ringProgress-54wH1", d = "crk-ringDisplay-biAno", x = "crk-segments-U9rJE", h = "crk-segment-2RMKN", u = "crk-segmentBoxed-iVvX0", y = "crk-segmentValue-fsXMN", L = "crk-segmentLabel-kihRG", B = "crk-segmentSep-ZGeiV", P = {
2
- root: e,
3
- label_top: l,
4
- labelTop: t,
5
- label_bottom: s,
6
- labelBottom: r,
7
- label_left: n,
8
- labelLeft: o,
9
- label_right: c,
10
- labelRight: a,
11
- sm: g,
12
- md: b,
13
- lg: i,
14
- display: k,
15
- label: m,
16
- ringWrap: p,
17
- ring: _,
18
- ringTrack: f,
19
- ringProgress: T,
20
- ringDisplay: d,
21
- segments: x,
22
- segment: h,
23
- segmentBoxed: u,
24
- segmentValue: y,
25
- segmentLabel: L,
26
- segmentSep: B
27
- };
28
- export {
29
- P as default,
30
- k as display,
31
- m as label,
32
- r as labelBottom,
33
- o as labelLeft,
34
- a as labelRight,
35
- t as labelTop,
36
- s as label_bottom,
37
- n as label_left,
38
- c as label_right,
39
- l as label_top,
40
- i as lg,
41
- b as md,
42
- _ as ring,
43
- d as ringDisplay,
44
- T as ringProgress,
45
- f as ringTrack,
46
- p as ringWrap,
47
- e as root,
48
- h as segment,
49
- u as segmentBoxed,
50
- L as segmentLabel,
51
- B as segmentSep,
52
- y as segmentValue,
53
- x as segments,
54
- g as sm
1
+ // src/components/Timer/Timer.module.scss
2
+ var e = "crk-root-ze-qA", t = "crk-label_top-f5ix1", n = "crk-label_top-f5ix1", r = "crk-label_bottom-vf4Tk", i = "crk-label_bottom-vf4Tk", a = "crk-label_left-Tsjlx", o = "crk-label_left-Tsjlx", s = "crk-label_right-l0T9l", c = "crk-label_right-l0T9l", l = "crk-sm-LpMEk", u = "crk-md-Of6tL", d = "crk-lg-KKqPc", f = "crk-display-09uul", p = "crk-label-F7Uuf", m = "crk-ringWrap-F71Yf", h = "crk-ring-PqZbn", g = "crk-ringTrack-SaJmr", _ = "crk-ringProgress-54wH1", v = "crk-ringDisplay-biAno", y = "crk-segments-U9rJE", b = "crk-segment-2RMKN", x = "crk-segmentBoxed-iVvX0", S = "crk-segmentValue-fsXMN", C = "crk-segmentLabel-kihRG", w = "crk-segmentSep-ZGeiV", T = {
3
+ root: e,
4
+ label_top: t,
5
+ labelTop: n,
6
+ label_bottom: r,
7
+ labelBottom: i,
8
+ label_left: a,
9
+ labelLeft: o,
10
+ label_right: s,
11
+ labelRight: c,
12
+ sm: l,
13
+ md: u,
14
+ lg: d,
15
+ display: f,
16
+ label: p,
17
+ ringWrap: m,
18
+ ring: h,
19
+ ringTrack: g,
20
+ ringProgress: _,
21
+ ringDisplay: v,
22
+ segments: y,
23
+ segment: b,
24
+ segmentBoxed: x,
25
+ segmentValue: S,
26
+ segmentLabel: C,
27
+ segmentSep: w
55
28
  };
29
+ export { T as default, f as display, p as label, i as labelBottom, o as labelLeft, c as labelRight, n as labelTop, r as label_bottom, a as label_left, s as label_right, t as label_top, d as lg, u as md, h as ring, v as ringDisplay, _ as ringProgress, g as ringTrack, m as ringWrap, e as root, b as segment, x as segmentBoxed, C as segmentLabel, w as segmentSep, S as segmentValue, y as segments, l as sm };
@@ -79,4 +79,4 @@ export interface ToastProviderProps {
79
79
  * <App />
80
80
  * </ToastProvider>
81
81
  */
82
- export declare function ToastProvider({ children, position, duration, max, classes, }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
82
+ export declare function ToastProvider({ children, position, duration, max, classes, }: ToastProviderProps): import("react").JSX.Element;