@overdoser/react-toolkit 0.19.0 → 0.21.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 (279) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +47 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.js +20 -0
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.js +25 -0
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +92 -95
  9. package/components/Alert/Alert.module.js +18 -0
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.js +23 -0
  12. package/components/Badge/Badge.js +16 -38
  13. package/components/Badge/Badge.module.js +17 -0
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.js +25 -0
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.js +35 -0
  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.js +32 -0
  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 +46 -41
  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.js +32 -0
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.js +23 -0
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.js +28 -0
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.js +17 -0
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.js +10 -0
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.js +66 -0
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.js +29 -0
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +12 -10
  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.js +12 -0
  71. package/components/EmptyState/EmptyState.js +58 -55
  72. package/components/EmptyState/EmptyState.module.js +14 -0
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +32 -35
  75. package/components/Form/Form.module.js +16 -0
  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.js +26 -0
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +25 -22
  85. package/components/Kbd/Kbd.module.js +10 -0
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.js +23 -0
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.js +10 -0
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.js +12 -0
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.js +40 -0
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.js +18 -0
  96. package/components/PageHeader/PageHeader.js +78 -72
  97. package/components/PageHeader/PageHeader.module.js +23 -0
  98. package/components/Pagination/Pagination.js +63 -84
  99. package/components/Pagination/Pagination.module.js +13 -0
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.js +12 -0
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +57 -90
  105. package/components/ProgressBar/ProgressBar.module.js +29 -0
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.js +3 -0
  108. package/components/SegmentedControl/SegmentedControl.js +94 -130
  109. package/components/SegmentedControl/SegmentedControl.module.js +21 -0
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.js +15 -0
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.js +12 -0
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.js +31 -0
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.js +14 -0
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.js +42 -0
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.js +18 -0
  122. package/components/Table/Table.d.ts +41 -16
  123. package/components/Table/Table.js +383 -442
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/index.d.ts +1 -1
  126. package/components/Table/useTableSort.d.ts +1 -1
  127. package/components/Table/useTableSort.js +51 -42
  128. package/components/Tabs/Tabs.js +109 -161
  129. package/components/Tabs/Tabs.module.js +28 -0
  130. package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
  131. package/components/ThemeToggle/ThemeToggle.js +122 -97
  132. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  133. package/components/Timeline/GanttTimeline.js +357 -318
  134. package/components/Timeline/GanttTimeline.module.js +29 -0
  135. package/components/Timeline/HistoryTimeline.js +486 -450
  136. package/components/Timeline/HistoryTimeline.module.js +31 -0
  137. package/components/Timeline/Timeline.module.js +76 -0
  138. package/components/Timeline/TimelineShared.d.ts +7 -7
  139. package/components/Timeline/TimelineShared.js +288 -279
  140. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  141. package/components/Timeline/TraceEventDetails.js +245 -178
  142. package/components/Timeline/TraceTimeline.js +823 -783
  143. package/components/Timeline/TraceTimeline.module.js +98 -0
  144. package/components/Timeline/historyLayout.js +336 -263
  145. package/components/Timeline/timelineCore.js +208 -183
  146. package/components/Timeline/traceEvent.js +59 -61
  147. package/components/Timeline/traceLayout.js +101 -90
  148. package/components/Timeline/useTimeline.js +76 -79
  149. package/components/Timer/Timer.js +190 -156
  150. package/components/Timer/Timer.module.js +29 -0
  151. package/components/Toast/Toast.d.ts +1 -1
  152. package/components/Toast/Toast.js +128 -128
  153. package/components/Toast/Toast.module.js +37 -0
  154. package/components/Toast/toastStore.js +58 -62
  155. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  156. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  157. package/components/Tooltip/Tooltip.d.ts +1 -1
  158. package/components/Tooltip/Tooltip.js +76 -85
  159. package/components/Tooltip/Tooltip.module.js +17 -0
  160. package/components/Typography/Typography.js +11 -36
  161. package/components/Typography/Typography.module.js +30 -0
  162. package/components/inputs/Checkbox/Checkbox.js +27 -51
  163. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  164. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  165. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  166. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  167. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  168. package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
  169. package/components/inputs/DatePicker/DatePicker.js +115 -142
  170. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  171. package/components/inputs/DatePicker/dateUtils.js +32 -41
  172. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  173. package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
  174. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  175. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  176. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  177. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  178. package/components/inputs/Input/Input.js +98 -109
  179. package/components/inputs/Input/Input.module.js +15 -0
  180. package/components/inputs/NumberInput/NumberInput.js +112 -132
  181. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  182. package/components/inputs/Radio/Radio.js +50 -73
  183. package/components/inputs/Radio/Radio.module.js +9 -0
  184. package/components/inputs/SearchInput/SearchInput.js +98 -115
  185. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  186. package/components/inputs/Select/Select.js +555 -682
  187. package/components/inputs/Select/Select.module.js +38 -0
  188. package/components/inputs/Slider/Slider.js +97 -128
  189. package/components/inputs/Slider/Slider.module.js +9 -0
  190. package/components/inputs/Switch/Switch.js +11 -8
  191. package/components/inputs/Textarea/Textarea.js +42 -58
  192. package/components/inputs/Textarea/Textarea.module.js +14 -0
  193. package/hooks/useClickOutside.js +17 -14
  194. package/hooks/useDebouncedValue.js +13 -14
  195. package/hooks/useElementSize.js +27 -22
  196. package/hooks/useEscapeLayer.js +28 -29
  197. package/hooks/useFocusTrap.js +27 -38
  198. package/hooks/useKeyboard.js +76 -64
  199. package/hooks/useMediaQuery.js +10 -15
  200. package/hooks/useNow.js +28 -33
  201. package/hooks/usePersistedState.js +98 -91
  202. package/hooks/usePortalPosition.js +25 -19
  203. package/hooks/useResizable.js +106 -104
  204. package/hooks/useTheme.d.ts +2 -2
  205. package/hooks/useTheme.js +28 -25
  206. package/index.css +2 -1
  207. package/index.d.ts +1 -1
  208. package/index.js +97 -215
  209. package/index.layered.css +2 -3
  210. package/llms.txt +9 -6
  211. package/manifest.json +66 -10
  212. package/package.json +1 -1
  213. package/utils/formatBytes.js +29 -13
  214. package/utils/themeScript.d.ts +2 -0
  215. package/utils/themeScript.js +6 -8
  216. package/utils/timeAgo.js +59 -32
  217. package/components/Accordion/Accordion.module.scss.js +0 -36
  218. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  219. package/components/Alert/Alert.module.scss.js +0 -33
  220. package/components/Avatar/Avatar.module.scss.js +0 -43
  221. package/components/Badge/Badge.module.scss.js +0 -31
  222. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  223. package/components/Button/Button.module.scss.js +0 -47
  224. package/components/Card/Card.module.scss.js +0 -60
  225. package/components/Chart/Chart.module.scss.js +0 -61
  226. package/components/Chip/Chip.module.scss.js +0 -59
  227. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  228. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  229. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  230. package/components/Divider/Divider.module.scss.js +0 -31
  231. package/components/Draggable/Draggable.module.scss.js +0 -17
  232. package/components/Drawer/Drawer.module.scss.js +0 -119
  233. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  234. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  235. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  236. package/components/Form/Form.module.scss.js +0 -29
  237. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  238. package/components/Kbd/Kbd.module.scss.js +0 -17
  239. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  240. package/components/Link/Link.module.scss.js +0 -16
  241. package/components/List/List.module.scss.js +0 -21
  242. package/components/Loader/Loader.module.scss.js +0 -70
  243. package/components/Modal/Modal.module.scss.js +0 -33
  244. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  245. package/components/Pagination/Pagination.module.scss.js +0 -23
  246. package/components/Popover/Popover.module.scss.js +0 -21
  247. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  248. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  249. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  250. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  251. package/components/Spinner/Spinner.module.scss.js +0 -20
  252. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  253. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  254. package/components/StatCard/StatCard.module.scss.js +0 -72
  255. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  256. package/components/Table/Table.module.scss.js +0 -81
  257. package/components/Tabs/Tabs.module.scss.js +0 -53
  258. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  259. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  260. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  261. package/components/Timeline/Timeline.module.scss.js +0 -141
  262. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  263. package/components/Timer/Timer.module.scss.js +0 -55
  264. package/components/Toast/Toast.module.scss.js +0 -62
  265. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  266. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  267. package/components/Typography/Typography.module.scss.js +0 -53
  268. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  269. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  270. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  271. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  272. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  273. package/components/inputs/Input/Input.module.scss.js +0 -27
  274. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  275. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  276. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  277. package/components/inputs/Select/Select.module.scss.js +0 -73
  278. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  279. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
@@ -1,171 +1,135 @@
1
- import { jsx as O, jsxs as ft } from "react/jsx-runtime";
2
- import { forwardRef as mt, useRef as T, useImperativeHandle as xt, useState as C, useLayoutEffect as U, useCallback as P, useMemo as vt, useEffect as ht } from "react";
3
- import _ from "clsx";
4
- import e from "./SplitPane.module.scss.js";
5
- import { useResizable as yt } from "../../hooks/useResizable.js";
6
- import { usePersistedState as Rt } from "../../hooks/usePersistedState.js";
7
- function V(s, p) {
8
- if (s === void 0) return { px: null, ratio: null };
9
- if (typeof s == "number") return { px: s, ratio: null };
10
- const c = s.trim();
11
- if (c.endsWith("%")) {
12
- const d = parseFloat(c) / 100;
13
- return { px: p > 0 ? d * p : null, ratio: Number.isFinite(d) ? d : null };
14
- }
15
- const f = parseFloat(c);
16
- return { px: Number.isFinite(f) ? f : null, ratio: null };
1
+ import e from "./SplitPane.module.js";
2
+ import { useResizable as t } from "../../hooks/useResizable.js";
3
+ import { usePersistedState as n } from "../../hooks/usePersistedState.js";
4
+ import { forwardRef as r, useCallback as i, useEffect as ee, useImperativeHandle as te, useLayoutEffect as a, useMemo as ne, useRef as o, useState as s } from "react";
5
+ import c from "clsx";
6
+ import { jsx as l, jsxs as re } from "react/jsx-runtime";
7
+ // src/components/SplitPane/SplitPane.tsx
8
+ function u(e, t) {
9
+ if (e === void 0) return {
10
+ px: null,
11
+ ratio: null
12
+ };
13
+ if (typeof e == "number") return {
14
+ px: e,
15
+ ratio: null
16
+ };
17
+ let n = e.trim();
18
+ if (n.endsWith("%")) {
19
+ let e = parseFloat(n) / 100;
20
+ return {
21
+ px: t > 0 ? e * t : null,
22
+ ratio: Number.isFinite(e) ? e : null
23
+ };
24
+ }
25
+ let r = parseFloat(n);
26
+ return {
27
+ px: Number.isFinite(r) ? r : null,
28
+ ratio: null
29
+ };
17
30
  }
18
- const wt = "__crk-splitpane-unpersisted__", zt = mt(
19
- ({
20
- children: s,
21
- direction: p = "horizontal",
22
- primary: c = "first",
23
- size: f,
24
- defaultSize: d = "50%",
25
- onSizeChange: X,
26
- minSize: m = 100,
27
- maxSize: g,
28
- minSecondarySize: A = 100,
29
- collapsible: z = !1,
30
- collapsed: k,
31
- defaultCollapsed: Z = !1,
32
- onCollapsedChange: D,
33
- persistKey: l,
34
- handleSize: F = 6,
35
- handleLabel: S = "Resize",
36
- disabled: x = !1,
37
- classes: o,
38
- className: K,
39
- style: tt,
40
- ...et
41
- }, nt) => {
42
- const I = T(null);
43
- xt(nt, () => I.current);
44
- const v = p === "horizontal", [i, rt] = C(0);
45
- U(() => {
46
- const t = I.current;
47
- if (!t) return;
48
- const u = () => {
49
- const G = t.getBoundingClientRect(), J = v ? G.width : G.height;
50
- rt((Q) => Q === J ? Q : J);
51
- };
52
- if (u(), typeof ResizeObserver > "u") return;
53
- const q = new ResizeObserver(u);
54
- return q.observe(t), () => q.disconnect();
55
- }, [v]);
56
- const [h, $] = Rt(l ?? wt, {}, { sync: !!l }), E = P(
57
- (t) => {
58
- l && $((u) => ({ ...u, ...t }));
59
- },
60
- [l, $]
61
- ), y = vt(() => V(d, 0), [d]), [R, j] = C(
62
- () => l && h.px !== void 0 ? null : y.ratio
63
- ), [ot, B] = C(
64
- () => l && h.px !== void 0 ? h.px : y.px ?? 0
65
- );
66
- U(() => {
67
- R !== null && i > 0 && B(R * i);
68
- }, [R, i]);
69
- const n = f !== void 0 ? V(f, i) : null, H = n ? n.px ?? 0 : ot, [it, at] = C(
70
- () => l && h.collapsed !== void 0 ? h.collapsed : Z
71
- ), a = z && (k ?? it), N = P(
72
- (t) => {
73
- k === void 0 && at(t), D?.(t), E({ collapsed: t });
74
- },
75
- [k, D, E]
76
- ), L = P(() => g !== void 0 ? g : i > 0 ? Math.max(m, i - A - F) : 1 / 0, [g, i, m, A, F]), b = i > 0 ? Math.min(Math.max(H, m), L()) : H, M = T(b), w = yt({
77
- size: b,
78
- defaultSize: y.px ?? (y.ratio !== null && i > 0 ? y.ratio * i : b),
79
- min: m,
80
- max: L,
81
- axis: v ? "x" : "y",
82
- invert: c === "second",
83
- disabled: x,
84
- onResizeStart: () => {
85
- a && N(!1);
86
- },
87
- onResize: (t, u) => {
88
- M.current = u, n || (j(null), B(t)), X?.(t);
89
- },
90
- onResizeEnd: (t) => {
91
- if (z && M.current < m / 2) {
92
- N(!0), M.current = t;
93
- return;
94
- }
95
- E({ px: t });
96
- }
97
- }), st = P(() => {
98
- x || (z ? N(!a) : w.reset());
99
- }, [x, z, a, N, w]);
100
- ht(() => {
101
- n?.ratio !== null && n?.ratio !== void 0 && j(n.ratio);
102
- }, [n?.ratio]);
103
- const lt = a ? 0 : n && n.px === null && n.ratio !== null ? `${n.ratio * 100}%` : !n && R !== null && i === 0 ? `${R * 100}%` : b, W = { [v ? "width" : "height"]: lt, flex: "0 0 auto" }, ct = s[0], dt = s[1], r = c === "first", ut = /* @__PURE__ */ O(
104
- "div",
105
- {
106
- className: _(
107
- e.pane,
108
- r ? e.primary : e.secondary,
109
- r && a && e.collapsed,
110
- o?.pane,
111
- r ? o?.primary : o?.secondary,
112
- r && a && o?.collapsed
113
- ),
114
- style: r ? W : void 0,
115
- "data-pane": r ? "primary" : "secondary",
116
- children: ct
117
- }
118
- ), pt = /* @__PURE__ */ O(
119
- "div",
120
- {
121
- className: _(
122
- e.pane,
123
- r ? e.secondary : e.primary,
124
- !r && a && e.collapsed,
125
- o?.pane,
126
- r ? o?.secondary : o?.primary,
127
- !r && a && o?.collapsed
128
- ),
129
- style: r ? void 0 : W,
130
- "data-pane": r ? "secondary" : "primary",
131
- children: dt
132
- }
133
- ), { onDoubleClick: bt, ...Y } = w.handleProps;
134
- return /* @__PURE__ */ ft(
135
- "div",
136
- {
137
- ref: I,
138
- className: _(e.root, v ? e.horizontal : e.vertical, o?.root, K),
139
- style: { ...tt, "--crk-splitpane-handle-size": `${F}px` },
140
- "data-direction": p,
141
- ...et,
142
- children: [
143
- ut,
144
- /* @__PURE__ */ O(
145
- "div",
146
- {
147
- ...Y,
148
- onDoubleClick: st,
149
- "aria-label": S,
150
- "aria-valuenow": a ? 0 : Y["aria-valuenow"],
151
- tabIndex: x ? -1 : 0,
152
- className: _(
153
- e.handle,
154
- w.isResizing && e.handleActive,
155
- x && e.handleDisabled,
156
- o?.handle,
157
- w.isResizing && o?.handleActive
158
- ),
159
- "data-collapsed": a || void 0
160
- }
161
- ),
162
- pt
163
- ]
164
- }
165
- );
166
- }
167
- );
168
- zt.displayName = "SplitPane";
169
- export {
170
- zt as SplitPane
171
- };
31
+ var d = "__crk-splitpane-unpersisted__", f = r(({ children: r, direction: f = "horizontal", primary: p = "first", size: m, defaultSize: h = "50%", onSizeChange: g, minSize: _ = 100, maxSize: v, minSecondarySize: y = 100, collapsible: b = !1, collapsed: x, defaultCollapsed: ie = !1, onCollapsedChange: S, persistKey: C, handleSize: w = 6, handleLabel: ae = "Resize", disabled: T = !1, classes: E, className: D, style: O, ...oe }, se) => {
32
+ let k = o(null);
33
+ te(se, () => k.current);
34
+ let A = f === "horizontal", [j, M] = s(0);
35
+ a(() => {
36
+ let e = k.current;
37
+ if (!e) return;
38
+ let t = () => {
39
+ let t = e.getBoundingClientRect(), n = A ? t.width : t.height;
40
+ M((e) => e === n ? e : n);
41
+ };
42
+ if (t(), typeof ResizeObserver > "u") return;
43
+ let n = new ResizeObserver(t);
44
+ return n.observe(e), () => n.disconnect();
45
+ }, [A]);
46
+ let [N, P] = n(C ?? d, {}, { sync: !!C }), F = i((e) => {
47
+ C && P((t) => ({
48
+ ...t,
49
+ ...e
50
+ }));
51
+ }, [C, P]), I = ne(() => u(h, 0), [h]), [L, R] = s(() => C && N.px !== void 0 ? null : I.ratio), [z, B] = s(() => C && N.px !== void 0 ? N.px : I.px ?? 0);
52
+ a(() => {
53
+ L !== null && j > 0 && B(L * j);
54
+ }, [L, j]);
55
+ let V = m === void 0 ? null : u(m, j), H = V ? V.px ?? 0 : z, [U, W] = s(() => C && N.collapsed !== void 0 ? N.collapsed : ie), G = b && (x ?? U), K = i((e) => {
56
+ x === void 0 && W(e), S?.(e), F({ collapsed: e });
57
+ }, [
58
+ x,
59
+ S,
60
+ F
61
+ ]), q = i(() => v === void 0 ? j > 0 ? Math.max(_, j - y - w) : Infinity : v, [
62
+ v,
63
+ j,
64
+ _,
65
+ y,
66
+ w
67
+ ]), J = j > 0 ? Math.min(Math.max(H, _), q()) : H, Y = o(J), X = t({
68
+ size: J,
69
+ defaultSize: I.px ?? (I.ratio !== null && j > 0 ? I.ratio * j : J),
70
+ min: _,
71
+ max: q,
72
+ axis: A ? "x" : "y",
73
+ invert: p === "second",
74
+ disabled: T,
75
+ onResizeStart: () => {
76
+ G && K(!1);
77
+ },
78
+ onResize: (e, t) => {
79
+ Y.current = t, V || (R(null), B(e)), g?.(e);
80
+ },
81
+ onResizeEnd: (e) => {
82
+ b && Y.current < _ / 2 ? (K(!0), Y.current = e) : F({ px: e });
83
+ }
84
+ }), ce = i(() => {
85
+ T || (b ? K(!G) : X.reset());
86
+ }, [
87
+ T,
88
+ b,
89
+ G,
90
+ K,
91
+ X
92
+ ]);
93
+ ee(() => {
94
+ V?.ratio !== null && V?.ratio !== void 0 && R(V.ratio);
95
+ }, [V?.ratio]);
96
+ let le = G ? 0 : V && V.px === null && V.ratio !== null ? `${V.ratio * 100}%` : !V && L !== null && j === 0 ? `${L * 100}%` : J, Z = {
97
+ [A ? "width" : "height"]: le,
98
+ flex: "0 0 auto"
99
+ }, ue = r[0], de = r[1], Q = p === "first", fe = /* @__PURE__ */ l("div", {
100
+ className: c(e.pane, Q ? e.primary : e.secondary, Q && G && e.collapsed, E?.pane, Q ? E?.primary : E?.secondary, Q && G && E?.collapsed),
101
+ style: Q ? Z : void 0,
102
+ "data-pane": Q ? "primary" : "secondary",
103
+ children: ue
104
+ }), pe = /* @__PURE__ */ l("div", {
105
+ className: c(e.pane, Q ? e.secondary : e.primary, !Q && G && e.collapsed, E?.pane, Q ? E?.secondary : E?.primary, !Q && G && E?.collapsed),
106
+ style: Q ? void 0 : Z,
107
+ "data-pane": Q ? "secondary" : "primary",
108
+ children: de
109
+ }), { onDoubleClick: me, ...$ } = X.handleProps;
110
+ return /* @__PURE__ */ re("div", {
111
+ ref: k,
112
+ className: c(e.root, A ? e.horizontal : e.vertical, E?.root, D),
113
+ style: {
114
+ ...O,
115
+ "--crk-splitpane-handle-size": `${w}px`
116
+ },
117
+ "data-direction": f,
118
+ ...oe,
119
+ children: [
120
+ fe,
121
+ /* @__PURE__ */ l("div", {
122
+ ...$,
123
+ onDoubleClick: ce,
124
+ "aria-label": ae,
125
+ "aria-valuenow": G ? 0 : $["aria-valuenow"],
126
+ tabIndex: T ? -1 : 0,
127
+ className: c(e.handle, X.isResizing && e.handleActive, T && e.handleDisabled, E?.handle, X.isResizing && E?.handleActive),
128
+ "data-collapsed": G || void 0
129
+ }),
130
+ pe
131
+ ]
132
+ });
133
+ });
134
+ f.displayName = "SplitPane";
135
+ export { f as SplitPane };
@@ -0,0 +1,14 @@
1
+ // src/components/SplitPane/SplitPane.module.scss
2
+ var e = "crk-root-4-LwZ", t = "crk-horizontal-zy9XG", n = "crk-vertical-K4r-5", r = "crk-pane-2kL-G", i = "crk-primary-uXbxW", a = "crk-secondary-Fq-4C", o = "crk-collapsed-DBz98", s = "crk-handle-dFfxM", c = "crk-handleActive-jc42L", l = "crk-handleDisabled-CEtI-", u = {
3
+ root: e,
4
+ horizontal: t,
5
+ vertical: n,
6
+ pane: r,
7
+ primary: i,
8
+ secondary: a,
9
+ collapsed: o,
10
+ handle: s,
11
+ handleActive: c,
12
+ handleDisabled: l
13
+ };
14
+ export { o as collapsed, u as default, s as handle, c as handleActive, l as handleDisabled, t as horizontal, r as pane, i as primary, e as root, a as secondary, n as vertical };
@@ -1,127 +1,134 @@
1
- import { jsxs as o, Fragment as x, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as j } from "react";
3
- import n from "clsx";
4
- import e from "./StatCard.module.scss.js";
5
- import { Skeleton as $ } from "../Skeleton/Skeleton.js";
6
- const M = (t) => `${new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(Math.abs(t))}%`;
7
- function O(t, i) {
8
- return t == null ? null : typeof t == "number" ? Number.isFinite(t) ? { text: i(t), trend: t > 0 ? "up" : t < 0 ? "down" : "flat" } : null : { text: t.value, trend: t.trend ?? "flat" };
1
+ import e from "./StatCard.module.js";
2
+ import { Skeleton as t } from "../Skeleton/Skeleton.js";
3
+ import { forwardRef as n } from "react";
4
+ import r from "clsx";
5
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ // src/components/StatCard/StatCard.tsx
7
+ var s = (e) => `${new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(Math.abs(e))}%`;
8
+ function c(e, t) {
9
+ return e == null ? null : typeof e == "number" ? Number.isFinite(e) ? {
10
+ text: t(e),
11
+ trend: e > 0 ? "up" : e < 0 ? "down" : "flat"
12
+ } : null : {
13
+ text: e.value,
14
+ trend: e.trend ?? "flat"
15
+ };
9
16
  }
10
- function P(t, i) {
11
- return i === "none" || t === "flat" ? "neutral" : t === "up" === (i !== "positive-down") ? "positive" : "negative";
17
+ function l(e, t) {
18
+ return t === "none" || e === "flat" ? "neutral" : e === "up" == (t !== "positive-down") ? "positive" : "negative";
12
19
  }
13
- const q = j(
14
- ({
15
- label: t,
16
- value: i,
17
- unit: l,
18
- delta: N,
19
- deltaFormat: g = M,
20
- trendColor: y = "auto",
21
- deltaLabel: c,
22
- icon: h,
23
- chart: s,
24
- footer: p,
25
- href: f,
26
- loading: u = !1,
27
- variant: R = "outlined",
28
- size: T = "md",
29
- accent: b,
30
- classes: a,
31
- className: z,
32
- style: B,
33
- onClick: w,
34
- onKeyDown: S,
35
- ...k
36
- }, D) => {
37
- const d = u ? null : O(N, g), C = d ? P(d.trend, y) : "neutral", v = !f && !!w, E = !!f || v, K = (m) => {
38
- S?.(m), !(!v || m.defaultPrevented) && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), m.currentTarget.click());
39
- }, F = n(
40
- e.root,
41
- e[R],
42
- e[`size-${T}`],
43
- E && e.interactive,
44
- b && e.accented,
45
- u && e.loading,
46
- a?.root,
47
- z
48
- ), G = { ...b ? { "--crk-stat-accent": b } : null, ...B }, I = /* @__PURE__ */ o(x, { children: [
49
- /* @__PURE__ */ o("div", { className: n(e.header, a?.header), children: [
50
- /* @__PURE__ */ r("span", { className: n(e.label, a?.label), children: t }),
51
- h && /* @__PURE__ */ r("span", { className: n(e.icon, a?.icon), "aria-hidden": "true", children: h })
52
- ] }),
53
- u ? /* @__PURE__ */ o("div", { className: e.skeletons, "aria-hidden": "true", children: [
54
- /* @__PURE__ */ r($, { variant: "text", width: "55%", height: "1.6em" }),
55
- /* @__PURE__ */ r($, { variant: "text", width: "35%", height: "0.9em" })
56
- ] }) : /* @__PURE__ */ o(x, { children: [
57
- /* @__PURE__ */ o("div", { className: n(e.value, a?.value), children: [
58
- i,
59
- l != null && /* @__PURE__ */ r("span", { className: n(e.unit, a?.unit), children: l })
60
- ] }),
61
- (d || c) && /* @__PURE__ */ o("div", { className: e.deltaRow, children: [
62
- d && /* @__PURE__ */ o("span", { className: n(e.delta, e[`tone-${C}`], a?.delta), children: [
63
- d.trend !== "flat" && /* @__PURE__ */ o(x, { children: [
64
- /* @__PURE__ */ r("span", { "aria-hidden": "true", className: e.arrow, children: d.trend === "up" ? "▲" : "▼" }),
65
- /* @__PURE__ */ r("span", { className: e.srOnly, children: d.trend })
66
- ] }),
67
- d.text
68
- ] }),
69
- c && /* @__PURE__ */ r("span", { className: n(e.deltaLabel, a?.deltaLabel), children: c })
70
- ] })
71
- ] }),
72
- s && /* @__PURE__ */ r("div", { className: n(e.chart, a?.chart), children: s }),
73
- p && /* @__PURE__ */ r("div", { className: n(e.footer, a?.footer), children: p })
74
- ] });
75
- return f ? /* @__PURE__ */ r(
76
- "a",
77
- {
78
- ref: D,
79
- href: f,
80
- className: F,
81
- style: G,
82
- "aria-busy": u || void 0,
83
- ...k,
84
- children: I
85
- }
86
- ) : /* @__PURE__ */ r(
87
- "div",
88
- {
89
- ref: D,
90
- className: F,
91
- style: G,
92
- role: v ? "button" : void 0,
93
- tabIndex: v ? 0 : void 0,
94
- onClick: w,
95
- onKeyDown: v || S ? K : void 0,
96
- "aria-busy": u || void 0,
97
- ...k,
98
- children: I
99
- }
100
- );
101
- }
102
- );
103
- q.displayName = "StatCard";
104
- const A = j(
105
- ({ columns: t = { sm: 1, md: 2, lg: 4 }, gap: i = "md", classes: l, className: N, style: g, children: y, ...c }, h) => {
106
- const s = typeof t == "number" ? { sm: t, md: t, lg: t } : { sm: t.sm ?? 1, md: t.md ?? 2, lg: t.lg ?? 4 }, p = {
107
- "--crk-stat-grid-columns-sm": String(s.sm),
108
- "--crk-stat-grid-columns-md": String(s.md),
109
- "--crk-stat-grid-columns-lg": String(s.lg)
110
- };
111
- return /* @__PURE__ */ r(
112
- "div",
113
- {
114
- ref: h,
115
- className: n(e.grid, e[`gap-${i}`], l?.root, N),
116
- style: { ...p, ...g },
117
- ...c,
118
- children: y
119
- }
120
- );
121
- }
122
- );
123
- A.displayName = "StatGrid";
124
- export {
125
- q as StatCard,
126
- A as StatGrid
127
- };
20
+ var u = n(({ label: n, value: u, unit: d, delta: f, deltaFormat: p = s, trendColor: m = "auto", deltaLabel: h, icon: g, chart: _, footer: v, href: y, loading: b = !1, variant: x = "outlined", size: S = "md", accent: C, classes: w, className: T, style: E, onClick: D, onKeyDown: O, ...k }, A) => {
21
+ let j = b ? null : c(f, p), M = j ? l(j.trend, m) : "neutral", N = !y && !!D, P = !!y || N, F = (e) => {
22
+ O?.(e), N && !e.defaultPrevented && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.click());
23
+ }, I = r(e.root, e[x], e[`size-${S}`], P && e.interactive, C && e.accented, b && e.loading, w?.root, T), L = {
24
+ ...C ? { "--crk-stat-accent": C } : null,
25
+ ...E
26
+ }, R = /* @__PURE__ */ o(i, { children: [
27
+ /* @__PURE__ */ o("div", {
28
+ className: r(e.header, w?.header),
29
+ children: [/* @__PURE__ */ a("span", {
30
+ className: r(e.label, w?.label),
31
+ children: n
32
+ }), g && /* @__PURE__ */ a("span", {
33
+ className: r(e.icon, w?.icon),
34
+ "aria-hidden": "true",
35
+ children: g
36
+ })]
37
+ }),
38
+ b ? /* @__PURE__ */ o("div", {
39
+ className: e.skeletons,
40
+ "aria-hidden": "true",
41
+ children: [/* @__PURE__ */ a(t, {
42
+ variant: "text",
43
+ width: "55%",
44
+ height: "1.6em"
45
+ }), /* @__PURE__ */ a(t, {
46
+ variant: "text",
47
+ width: "35%",
48
+ height: "0.9em"
49
+ })]
50
+ }) : /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("div", {
51
+ className: r(e.value, w?.value),
52
+ children: [u, d != null && /* @__PURE__ */ a("span", {
53
+ className: r(e.unit, w?.unit),
54
+ children: d
55
+ })]
56
+ }), (j || h) && /* @__PURE__ */ o("div", {
57
+ className: e.deltaRow,
58
+ children: [j && /* @__PURE__ */ o("span", {
59
+ className: r(e.delta, e[`tone-${M}`], w?.delta),
60
+ children: [j.trend !== "flat" && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("span", {
61
+ "aria-hidden": "true",
62
+ className: e.arrow,
63
+ children: j.trend === "up" ? "▲" : "▼"
64
+ }), /* @__PURE__ */ a("span", {
65
+ className: e.srOnly,
66
+ children: j.trend
67
+ })] }), j.text]
68
+ }), h && /* @__PURE__ */ a("span", {
69
+ className: r(e.deltaLabel, w?.deltaLabel),
70
+ children: h
71
+ })]
72
+ })] }),
73
+ _ && /* @__PURE__ */ a("div", {
74
+ className: r(e.chart, w?.chart),
75
+ children: _
76
+ }),
77
+ v && /* @__PURE__ */ a("div", {
78
+ className: r(e.footer, w?.footer),
79
+ children: v
80
+ })
81
+ ] });
82
+ return y ? /* @__PURE__ */ a("a", {
83
+ ref: A,
84
+ href: y,
85
+ className: I,
86
+ style: L,
87
+ "aria-busy": b || void 0,
88
+ ...k,
89
+ children: R
90
+ }) : /* @__PURE__ */ a("div", {
91
+ ref: A,
92
+ className: I,
93
+ style: L,
94
+ role: N ? "button" : void 0,
95
+ tabIndex: N ? 0 : void 0,
96
+ onClick: D,
97
+ onKeyDown: N || O ? F : void 0,
98
+ "aria-busy": b || void 0,
99
+ ...k,
100
+ children: R
101
+ });
102
+ });
103
+ u.displayName = "StatCard";
104
+ var d = n(({ columns: t = {
105
+ sm: 1,
106
+ md: 2,
107
+ lg: 4
108
+ }, gap: n = "md", classes: i, className: o, style: s, children: c, ...l }, u) => {
109
+ let d = typeof t == "number" ? {
110
+ sm: t,
111
+ md: t,
112
+ lg: t
113
+ } : {
114
+ sm: t.sm ?? 1,
115
+ md: t.md ?? 2,
116
+ lg: t.lg ?? 4
117
+ }, f = {
118
+ "--crk-stat-grid-columns-sm": String(d.sm),
119
+ "--crk-stat-grid-columns-md": String(d.md),
120
+ "--crk-stat-grid-columns-lg": String(d.lg)
121
+ };
122
+ return /* @__PURE__ */ a("div", {
123
+ ref: u,
124
+ className: r(e.grid, e[`gap-${n}`], i?.root, o),
125
+ style: {
126
+ ...f,
127
+ ...s
128
+ },
129
+ ...l,
130
+ children: c
131
+ });
132
+ });
133
+ d.displayName = "StatGrid";
134
+ export { u as StatCard, d as StatGrid };
@@ -0,0 +1,42 @@
1
+ // src/components/StatCard/StatCard.module.scss
2
+ var e = "crk-root-zKEt2", t = "crk-outlined-XHAHG", n = "crk-elevated-VHDgT", r = "crk-filled-w9awn", i = "crk-size-sm-dy5Z-", a = "crk-size-md-Q1vXC", o = "crk-size-lg-RHsB3", s = "crk-interactive-w53Nd", c = "crk-accented-aEY4-", l = "crk-header-ZLeFH", u = "crk-label-E4Rgi", d = "crk-icon-XvPJv", f = "crk-value-0r3GP", p = "crk-unit-00NPF", m = "crk-deltaRow-AaiEx", h = "crk-delta-xCWjx", g = "crk-arrow-OdpoI", _ = "crk-tone-positive-H-7co", v = "crk-tone-negative-kbhSv", y = "crk-tone-neutral-SAt38", b = "crk-deltaLabel-CzgUN", x = "crk-chart-GYQ0q", S = "crk-footer-K76y3", C = "crk-skeletons-uy-lT", w = "crk-srOnly-KSjm6", T = "crk-grid-bPuJo", E = "crk-gap-sm-60yMv", D = "crk-gap-md-peh45", O = "crk-gap-lg-7gGgN", k = {
3
+ root: e,
4
+ outlined: t,
5
+ elevated: n,
6
+ filled: r,
7
+ "size-sm": "crk-size-sm-dy5Z-",
8
+ sizeSm: i,
9
+ "size-md": "crk-size-md-Q1vXC",
10
+ sizeMd: a,
11
+ "size-lg": "crk-size-lg-RHsB3",
12
+ sizeLg: o,
13
+ interactive: s,
14
+ accented: c,
15
+ header: l,
16
+ label: u,
17
+ icon: d,
18
+ value: f,
19
+ unit: p,
20
+ deltaRow: m,
21
+ delta: h,
22
+ arrow: g,
23
+ "tone-positive": "crk-tone-positive-H-7co",
24
+ tonePositive: _,
25
+ "tone-negative": "crk-tone-negative-kbhSv",
26
+ toneNegative: v,
27
+ "tone-neutral": "crk-tone-neutral-SAt38",
28
+ toneNeutral: y,
29
+ deltaLabel: b,
30
+ chart: x,
31
+ footer: S,
32
+ skeletons: C,
33
+ srOnly: w,
34
+ grid: T,
35
+ "gap-sm": "crk-gap-sm-60yMv",
36
+ gapSm: E,
37
+ "gap-md": "crk-gap-md-peh45",
38
+ gapMd: D,
39
+ "gap-lg": "crk-gap-lg-7gGgN",
40
+ gapLg: O
41
+ };
42
+ export { c as accented, g as arrow, x as chart, k as default, h as delta, b as deltaLabel, m as deltaRow, n as elevated, r as filled, S as footer, O as gapLg, D as gapMd, E as gapSm, T as grid, l as header, d as icon, s as interactive, u as label, t as outlined, e as root, o as sizeLg, a as sizeMd, i as sizeSm, C as skeletons, w as srOnly, v as toneNegative, y as toneNeutral, _ as tonePositive, p as unit, f as value };