@overdoser/react-toolkit 0.20.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 (273) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +14 -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 +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.js +42 -0
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.js +28 -0
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.js +13 -0
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.js +29 -0
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.js +31 -0
  134. package/components/Timeline/Timeline.module.js +76 -0
  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 +245 -178
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.js +98 -0
  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.js +29 -0
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.js +37 -0
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +35 -57
  153. package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.js +17 -0
  157. package/components/Typography/Typography.js +11 -36
  158. package/components/Typography/Typography.module.js +30 -0
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.js +10 -0
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
  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.js +23 -0
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.js +14 -0
  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.js +20 -0
  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.js +15 -0
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.js +14 -0
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.js +9 -0
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.js +8 -0
  183. package/components/inputs/Select/Select.js +555 -682
  184. package/components/inputs/Select/Select.module.js +38 -0
  185. package/components/inputs/Slider/Slider.js +97 -128
  186. package/components/inputs/Slider/Slider.module.js +9 -0
  187. package/components/inputs/Switch/Switch.js +11 -8
  188. package/components/inputs/Textarea/Textarea.js +42 -58
  189. package/components/inputs/Textarea/Textarea.module.js +14 -0
  190. package/hooks/useClickOutside.js +17 -14
  191. package/hooks/useDebouncedValue.js +13 -14
  192. package/hooks/useElementSize.js +27 -22
  193. package/hooks/useEscapeLayer.js +28 -29
  194. package/hooks/useFocusTrap.js +27 -38
  195. package/hooks/useKeyboard.js +76 -64
  196. package/hooks/useMediaQuery.js +10 -15
  197. package/hooks/useNow.js +28 -33
  198. package/hooks/usePersistedState.js +98 -94
  199. package/hooks/usePortalPosition.js +25 -19
  200. package/hooks/useResizable.js +106 -104
  201. package/hooks/useTheme.js +28 -23
  202. package/index.css +2 -1
  203. package/index.js +97 -215
  204. package/index.layered.css +2 -3
  205. package/llms.txt +3 -0
  206. package/manifest.json +8 -0
  207. package/package.json +1 -1
  208. package/utils/formatBytes.js +29 -13
  209. package/utils/themeScript.js +6 -8
  210. package/utils/timeAgo.js +59 -32
  211. package/components/Accordion/Accordion.module.scss.js +0 -36
  212. package/components/ActionButton/ActionButton.module.scss.js +0 -47
  213. package/components/Alert/Alert.module.scss.js +0 -33
  214. package/components/Avatar/Avatar.module.scss.js +0 -43
  215. package/components/Badge/Badge.module.scss.js +0 -31
  216. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
  217. package/components/Button/Button.module.scss.js +0 -47
  218. package/components/Card/Card.module.scss.js +0 -60
  219. package/components/Chart/Chart.module.scss.js +0 -61
  220. package/components/Chip/Chip.module.scss.js +0 -59
  221. package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
  222. package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
  223. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
  224. package/components/Divider/Divider.module.scss.js +0 -31
  225. package/components/Draggable/Draggable.module.scss.js +0 -17
  226. package/components/Drawer/Drawer.module.scss.js +0 -119
  227. package/components/Dropdown/Dropdown.module.scss.js +0 -53
  228. package/components/Dropzone/Dropzone.module.scss.js +0 -21
  229. package/components/EmptyState/EmptyState.module.scss.js +0 -25
  230. package/components/Form/Form.module.scss.js +0 -29
  231. package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
  232. package/components/Kbd/Kbd.module.scss.js +0 -17
  233. package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
  234. package/components/Link/Link.module.scss.js +0 -16
  235. package/components/List/List.module.scss.js +0 -21
  236. package/components/Loader/Loader.module.scss.js +0 -70
  237. package/components/Modal/Modal.module.scss.js +0 -33
  238. package/components/PageHeader/PageHeader.module.scss.js +0 -43
  239. package/components/Pagination/Pagination.module.scss.js +0 -23
  240. package/components/Popover/Popover.module.scss.js +0 -21
  241. package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
  242. package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
  243. package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
  244. package/components/Skeleton/Skeleton.module.scss.js +0 -25
  245. package/components/Spinner/Spinner.module.scss.js +0 -20
  246. package/components/SplitButton/SplitButton.module.scss.js +0 -57
  247. package/components/SplitPane/SplitPane.module.scss.js +0 -25
  248. package/components/StatCard/StatCard.module.scss.js +0 -72
  249. package/components/StatusDot/StatusDot.module.scss.js +0 -32
  250. package/components/Table/Table.module.scss.js +0 -81
  251. package/components/Tabs/Tabs.module.scss.js +0 -53
  252. package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
  253. package/components/Timeline/GanttTimeline.module.scss.js +0 -55
  254. package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
  255. package/components/Timeline/Timeline.module.scss.js +0 -141
  256. package/components/Timeline/TraceTimeline.module.scss.js +0 -189
  257. package/components/Timer/Timer.module.scss.js +0 -55
  258. package/components/Toast/Toast.module.scss.js +0 -62
  259. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
  260. package/components/Tooltip/Tooltip.module.scss.js +0 -30
  261. package/components/Typography/Typography.module.scss.js +0 -53
  262. package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
  263. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
  264. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
  265. package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
  266. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
  267. package/components/inputs/Input/Input.module.scss.js +0 -27
  268. package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
  269. package/components/inputs/Radio/Radio.module.scss.js +0 -15
  270. package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
  271. package/components/inputs/Select/Select.module.scss.js +0 -73
  272. package/components/inputs/Slider/Slider.module.scss.js +0 -15
  273. package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
package/llms.txt CHANGED
@@ -1049,6 +1049,8 @@ Element: a `<div>` root (forwards ref); the track is `role="progressbar"` with `
1049
1049
  - `segments?: number` — when `> 1`, N discrete blocks filled from the left (`round(value / max * segments)`); wizard-step progress.
1050
1050
  - `showCurrent?: boolean` — default `false`. Segmented only: the block after the last filled one gets a mid shade → three states (done / current / remaining; `value` = steps completed).
1051
1051
  - `shape?: 'rounded' | 'square'` — default `'rounded'`. `'square'` removes every radius (flat survey/wizard strip).
1052
+ - `onSegmentClick?: (index: number, event: MouseEvent<HTMLButtonElement>) => void` — segmented only. Each block becomes a `<button type="button">` (hover tint, focus ring) and the callback receives its zero-based index → jump-to-step. The track becomes `role="group"` (keeps the `aria-label`) instead of `role="progressbar"`, since progressbar children are presentational; the current step (with `showCurrent`) gets `aria-current="step"`.
1053
+ - `segmentLabel?: (index: number, segments: number) => string` — accessible name per clickable segment. Default `` `Step ${index + 1} of ${segments}` ``.
1052
1054
  - `classes?: Partial<ProgressBarClasses>` where `ProgressBarClasses = { root, header, label, value, track, fill, segment, segmentFilled, segmentCurrent }`.
1053
1055
  CSS vars: `--crk-progress-fill`, `--crk-progress-track`, `--crk-progress-height`.
1054
1056
 
@@ -1057,6 +1059,7 @@ CSS vars: `--crk-progress-fill`, `--crk-progress-track`, `--crk-progress-height`
1057
1059
  <ProgressBar value={level} thresholds={[{ value: 0, variant: 'danger' }, { value: 20, variant: 'warning' }, { value: 50, variant: 'success' }]} />
1058
1060
  <ProgressBar value={2} max={5} segments={5} size="lg" />
1059
1061
  <ProgressBar value={2} max={4} segments={4} showCurrent shape="square" aria-label="Step 3 of 4" /> // done · current · remaining
1062
+ <ProgressBar value={done} max={4} segments={4} showCurrent onSegmentClick={(i) => goToStep(i)} /> // clickable steps
1060
1063
  <ProgressBar label="Working…" /> // indeterminate
1061
1064
  ```
1062
1065
 
package/manifest.json CHANGED
@@ -1713,6 +1713,14 @@
1713
1713
  "shape": {
1714
1714
  "type": "'rounded' | 'square'",
1715
1715
  "default": "rounded"
1716
+ },
1717
+ "onSegmentClick": {
1718
+ "type": "(index: number, event: MouseEvent<HTMLButtonElement>) => void",
1719
+ "notes": "Segmented only: each block becomes a button; callback gets the zero-based index. Track switches to role=group; current step gets aria-current=step."
1720
+ },
1721
+ "segmentLabel": {
1722
+ "type": "(index: number, segments: number) => string",
1723
+ "notes": "Accessible name per clickable segment. Default `Step ${index + 1} of ${segments}`."
1716
1724
  }
1717
1725
  }
1718
1726
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overdoser/react-toolkit",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "homepage": "https://react-toolkit.overdoser.org",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -1,14 +1,30 @@
1
- const u = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], g = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"];
2
- function f(t, B = {}) {
3
- const { decimals: c = 1, base: n = 1024, iec: a = !1, locale: m } = B;
4
- if (!Number.isFinite(t)) return "—";
5
- const e = n === 1024 && a ? g : u, r = t < 0 ? "-" : "";
6
- let s = Math.abs(t), i = 0;
7
- for (; s >= n && i < e.length - 1; )
8
- s /= n, i++;
9
- const o = i === 0 ? 0 : Math.max(0, c), l = s.toLocaleString(m, { minimumFractionDigits: o, maximumFractionDigits: o });
10
- return `${r}${l} ${e[i]}`;
1
+ // src/utils/formatBytes.ts
2
+ var e = [
3
+ "B",
4
+ "KB",
5
+ "MB",
6
+ "GB",
7
+ "TB",
8
+ "PB",
9
+ "EB"
10
+ ], t = [
11
+ "B",
12
+ "KiB",
13
+ "MiB",
14
+ "GiB",
15
+ "TiB",
16
+ "PiB",
17
+ "EiB"
18
+ ];
19
+ function n(n, r = {}) {
20
+ let { decimals: i = 1, base: a = 1024, iec: o = !1, locale: s } = r;
21
+ if (!Number.isFinite(n)) return "—";
22
+ let c = a === 1024 && o ? t : e, l = n < 0 ? "-" : "", u = Math.abs(n), d = 0;
23
+ for (; u >= a && d < c.length - 1;) u /= a, d++;
24
+ let f = d === 0 ? 0 : Math.max(0, i);
25
+ return `${l}${u.toLocaleString(s, {
26
+ minimumFractionDigits: f,
27
+ maximumFractionDigits: f
28
+ })} ${c[d]}`;
11
29
  }
12
- export {
13
- f as formatBytes
14
- };
30
+ export { n as formatBytes };
@@ -1,9 +1,7 @@
1
- function c(t = {}) {
2
- const e = JSON.stringify(t.storageKey ?? "crk-theme"), r = JSON.stringify(t.attribute ?? "data-theme"), a = JSON.stringify(t.defaultTheme ?? "system");
3
- return "(function(){var k=" + e + ",a=" + r + ",f=" + a + ',v=null;try{v=localStorage.getItem(k);if(v){try{v=JSON.parse(v)}catch(e){}}}catch(e){}try{document.documentElement.setAttribute(a,v==="dark"||v==="light"||v==="system"?v:f)}catch(e){}})();';
1
+ // src/utils/themeScript.ts
2
+ function e(e = {}) {
3
+ let t = JSON.stringify(e.storageKey ?? "crk-theme"), n = JSON.stringify(e.attribute ?? "data-theme"), r = JSON.stringify(e.defaultTheme ?? "system");
4
+ return "(function(){var k=" + t + ",a=" + n + ",f=" + r + ",v=null;try{v=localStorage.getItem(k);if(v){try{v=JSON.parse(v)}catch(e){}}}catch(e){}try{document.documentElement.setAttribute(a,v===\"dark\"||v===\"light\"||v===\"system\"?v:f)}catch(e){}})();";
4
5
  }
5
- const n = c();
6
- export {
7
- n as THEME_INIT_SCRIPT,
8
- c as getThemeInitScript
9
- };
6
+ var t = e();
7
+ export { t as THEME_INIT_SCRIPT, e as getThemeInitScript };
package/utils/timeAgo.js CHANGED
@@ -1,37 +1,64 @@
1
- const f = [
2
- { unit: "year", ms: 31536e6 },
3
- { unit: "month", ms: 2592e6 },
4
- { unit: "week", ms: 6048e5 },
5
- { unit: "day", ms: 864e5 },
6
- { unit: "hour", ms: 36e5 },
7
- { unit: "minute", ms: 6e4 },
8
- { unit: "second", ms: 1e3 }
1
+ // src/utils/timeAgo.ts
2
+ var e = [
3
+ {
4
+ unit: "year",
5
+ ms: 31536e6
6
+ },
7
+ {
8
+ unit: "month",
9
+ ms: 2592e6
10
+ },
11
+ {
12
+ unit: "week",
13
+ ms: 6048e5
14
+ },
15
+ {
16
+ unit: "day",
17
+ ms: 864e5
18
+ },
19
+ {
20
+ unit: "hour",
21
+ ms: 36e5
22
+ },
23
+ {
24
+ unit: "minute",
25
+ ms: 6e4
26
+ },
27
+ {
28
+ unit: "second",
29
+ ms: 1e3
30
+ }
9
31
  ];
10
- function l(t) {
11
- return t instanceof Date ? t.getTime() : typeof t == "number" ? t : new Date(t).getTime();
32
+ function t(e) {
33
+ return e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime();
12
34
  }
13
- function h(t) {
14
- const e = Math.abs(t);
15
- for (const n of f)
16
- if (e >= n.ms || n.unit === "second")
17
- return { unit: n.unit, value: Math.sign(t) * Math.round(e / n.ms) };
18
- return { unit: "second", value: 0 };
35
+ function n(t) {
36
+ let n = Math.abs(t);
37
+ for (let r of e) if (n >= r.ms || r.unit === "second") return {
38
+ unit: r.unit,
39
+ value: Math.sign(t) * Math.round(n / r.ms)
40
+ };
41
+ return {
42
+ unit: "second",
43
+ value: 0
44
+ };
19
45
  }
20
- function b(t) {
21
- const e = Math.abs(t);
22
- return e < 6e4 ? 1e3 : e < 36e5 ? 3e4 : 6e4;
46
+ function r(e) {
47
+ let t = Math.abs(e);
48
+ return t < 6e4 ? 1e3 : t < 36e5 ? 3e4 : 6e4;
23
49
  }
24
- function d(t, e = {}) {
25
- const { now: n = Date.now(), locale: r, format: i = "long", numeric: o = "auto", maxAge: u } = e, s = l(t);
26
- if (!Number.isFinite(s)) return null;
27
- const a = s - n;
28
- if (u !== void 0 && Math.abs(a) > u) return null;
29
- const { unit: m, value: c } = h(a);
30
- return m === "second" && Math.abs(c) < 5 && o === "auto" ? new Intl.RelativeTimeFormat(r, { style: i, numeric: "auto" }).format(0, "second") : new Intl.RelativeTimeFormat(r, { style: i, numeric: o }).format(c, m);
50
+ function i(e, r = {}) {
51
+ let { now: i = Date.now(), locale: a, format: o = "long", numeric: s = "auto", maxAge: c } = r, l = t(e);
52
+ if (!Number.isFinite(l)) return null;
53
+ let u = l - i;
54
+ if (c !== void 0 && Math.abs(u) > c) return null;
55
+ let { unit: d, value: f } = n(u);
56
+ return d === "second" && Math.abs(f) < 5 && s === "auto" ? new Intl.RelativeTimeFormat(a, {
57
+ style: o,
58
+ numeric: "auto"
59
+ }).format(0, "second") : new Intl.RelativeTimeFormat(a, {
60
+ style: o,
61
+ numeric: s
62
+ }).format(f, d);
31
63
  }
32
- export {
33
- b as refreshIntervalFor,
34
- h as relativeParts,
35
- d as timeAgo,
36
- l as toTimestamp
37
- };
64
+ export { r as refreshIntervalFor, n as relativeParts, i as timeAgo, t as toTimestamp };
@@ -1,36 +0,0 @@
1
- const t = "crk-root-cCog2", e = "crk-sm-xQI6G", r = "crk-item-YNNr-", n = "crk-bordered-PfF4R", c = "crk-separated-X-Y5o", o = "crk-itemDisabled-JQ4TD", s = "crk-header-AYOT5", i = "crk-trigger-sPQlj", a = "crk-iconStart-5fvpd", d = "crk-triggerLabel-FZx-J", k = "crk-icon-TdeJS", l = "crk-itemOpen-pU-Q4", g = "crk-content-RyBzl", m = "crk-contentClip-S5IS2", p = "crk-contentInner-gJF2F", b = {
2
- root: t,
3
- sm: e,
4
- default: "crk-default-D79k9",
5
- item: r,
6
- bordered: n,
7
- separated: c,
8
- itemDisabled: o,
9
- header: s,
10
- trigger: i,
11
- iconStart: a,
12
- triggerLabel: d,
13
- icon: k,
14
- itemOpen: l,
15
- content: g,
16
- contentClip: m,
17
- contentInner: p
18
- };
19
- export {
20
- n as bordered,
21
- g as content,
22
- m as contentClip,
23
- p as contentInner,
24
- b as default,
25
- s as header,
26
- k as icon,
27
- a as iconStart,
28
- r as item,
29
- o as itemDisabled,
30
- l as itemOpen,
31
- t as root,
32
- c as separated,
33
- e as sm,
34
- i as trigger,
35
- d as triggerLabel
36
- };
@@ -1,47 +0,0 @@
1
- const c = "crk-root--5DQa", o = "crk-primary-8sEXz", r = "crk-secondary-gchUR", n = "crk-danger-3Rwvr", l = "crk-ghost-NA6NO", e = "crk-sm-8Gx7n", s = "crk-md-1Aojo", t = "crk-lg-G-QeV", a = "crk-iconOnly-RXD7w", i = "crk-progressFill-fQBjO", k = "crk-progressFillActive-UUIFs", y = "crk-iconStack-cDz8K", b = "crk-iconLayer--8ZB0", g = "crk-iconSpin-P42Mx", p = "crk-crkActionSpin-hNXj5", S = "crk-labelStack-IdCBl", A = "crk-labelLayer-42FKW", d = "crk-labelAbove-GC0xj", m = "crk-labelBelow-ozPt1", h = "crk-layerVisible-zoVoM", F = "crk-crkActionShake-IQ6fK", v = {
2
- root: c,
3
- primary: o,
4
- secondary: r,
5
- danger: n,
6
- ghost: l,
7
- sm: e,
8
- md: s,
9
- lg: t,
10
- iconOnly: a,
11
- progressFill: i,
12
- progressFillActive: k,
13
- iconStack: y,
14
- iconLayer: b,
15
- iconSpin: g,
16
- crkActionSpin: p,
17
- labelStack: S,
18
- labelLayer: A,
19
- labelAbove: d,
20
- labelBelow: m,
21
- layerVisible: h,
22
- crkActionShake: F
23
- };
24
- export {
25
- F as crkActionShake,
26
- p as crkActionSpin,
27
- n as danger,
28
- v as default,
29
- l as ghost,
30
- b as iconLayer,
31
- a as iconOnly,
32
- g as iconSpin,
33
- y as iconStack,
34
- d as labelAbove,
35
- m as labelBelow,
36
- A as labelLayer,
37
- S as labelStack,
38
- h as layerVisible,
39
- t as lg,
40
- s as md,
41
- o as primary,
42
- i as progressFill,
43
- k as progressFillActive,
44
- c as root,
45
- r as secondary,
46
- e as sm
47
- };
@@ -1,33 +0,0 @@
1
- const c = "crk-root-KIhSk", n = "crk-info--J-F1", t = "crk-success-lftZT", s = "crk-warning-uOpos", o = "crk-danger-53-01", e = "crk-icon-RUu7X", r = "crk-content-9Fty2", a = "crk-text--Oyu2", i = "crk-action-a5XCP", k = "crk-banner-epaT8", g = "crk-sm-jB88A", l = "crk-title-QHuwO", u = "crk-message-Wd9FZ", m = "crk-close-yMuK-", d = {
2
- root: c,
3
- info: n,
4
- success: t,
5
- warning: s,
6
- danger: o,
7
- icon: e,
8
- content: r,
9
- text: a,
10
- action: i,
11
- banner: k,
12
- sm: g,
13
- title: l,
14
- message: u,
15
- close: m
16
- };
17
- export {
18
- i as action,
19
- k as banner,
20
- m as close,
21
- r as content,
22
- o as danger,
23
- d as default,
24
- e as icon,
25
- n as info,
26
- u as message,
27
- c as root,
28
- g as sm,
29
- t as success,
30
- a as text,
31
- l as title,
32
- s as warning
33
- };
@@ -1,43 +0,0 @@
1
- const s = "crk-root-1YbL5", t = "crk-xs-1SMBv", a = "crk-sm-8TB22", c = "crk-md-zeW0d", n = "crk-lg-MWKN-", o = "crk-xl-KCqIL", u = "crk-circle-nzLby", l = "crk-square-JrlyG", r = "crk-image-HFFlp", e = "crk-fallback-R4J-V", k = "crk-status-e4HnT", i = "crk-status_online-bny3b", y = "crk-status_online-bny3b", f = "crk-status_offline-xxp2c", _ = "crk-status_offline-xxp2c", b = "crk-status_away-coReU", x = "crk-status_away-coReU", m = "crk-status_busy-aOHjE", g = "crk-status_busy-aOHjE", w = {
2
- root: s,
3
- xs: t,
4
- sm: a,
5
- md: c,
6
- lg: n,
7
- xl: o,
8
- circle: u,
9
- square: l,
10
- image: r,
11
- fallback: e,
12
- status: k,
13
- status_online: i,
14
- statusOnline: y,
15
- status_offline: f,
16
- statusOffline: _,
17
- status_away: b,
18
- statusAway: x,
19
- status_busy: m,
20
- statusBusy: g
21
- };
22
- export {
23
- u as circle,
24
- w as default,
25
- e as fallback,
26
- r as image,
27
- n as lg,
28
- c as md,
29
- s as root,
30
- a as sm,
31
- l as square,
32
- k as status,
33
- x as statusAway,
34
- g as statusBusy,
35
- _ as statusOffline,
36
- y as statusOnline,
37
- b as status_away,
38
- m as status_busy,
39
- f as status_offline,
40
- i as status_online,
41
- o as xl,
42
- t as xs
43
- };
@@ -1,31 +0,0 @@
1
- const s = "crk-root-KSuIQ", c = "crk-sm--vFVn", o = "crk-md-zmWkB", n = "crk-lg-vhZlR", r = "crk-neutral-RdrgV", t = "crk-primary-wn6-R", e = "crk-success-DMnu3", k = "crk-warning-4IHkk", l = "crk-danger-nwbtA", a = "crk-soft-D7eFo", d = "crk-solid-OAgyP", i = "crk-outline-2IwcH", u = "crk-dot-KeAKh", g = {
2
- root: s,
3
- sm: c,
4
- md: o,
5
- lg: n,
6
- neutral: r,
7
- primary: t,
8
- success: e,
9
- warning: k,
10
- danger: l,
11
- soft: a,
12
- solid: d,
13
- outline: i,
14
- dot: u
15
- };
16
- export {
17
- l as danger,
18
- g as default,
19
- u as dot,
20
- n as lg,
21
- o as md,
22
- r as neutral,
23
- i as outline,
24
- t as primary,
25
- s as root,
26
- c as sm,
27
- a as soft,
28
- d as solid,
29
- e as success,
30
- k as warning
31
- };
@@ -1,17 +0,0 @@
1
- const t = "crk-root-stw2c", r = "crk-list-RGYQR", s = "crk-item-ECyrs", c = "crk-link-B1vub", o = "crk-current-ilnF5", n = "crk-separator-KChd-", e = {
2
- root: t,
3
- list: r,
4
- item: s,
5
- link: c,
6
- current: o,
7
- separator: n
8
- };
9
- export {
10
- o as current,
11
- e as default,
12
- s as item,
13
- c as link,
14
- r as list,
15
- t as root,
16
- n as separator
17
- };
@@ -1,47 +0,0 @@
1
- const o = "crk-root-8RX49", n = "crk-loading-QfItr", r = "crk-primary-st6yY", c = "crk-secondary-j-3rj", t = "crk-danger-Hxs5n", s = "crk-ghost-kQ0A8", d = "crk-sm-RXFPY", e = "crk-md-nDnOD", i = "crk-lg-qD-Qh", l = "crk-fullWidth-AHpSl", m = "crk-iconOnly-FNrSu", a = "crk-content-PpYVU", k = "crk-shimmer-8iQSU", g = "crk-loadingShimmer-BVvFw", h = "crk-shimmerSweep-uiZ01", S = "crk-dots-U8wss", p = "crk-loadingDots-eKv64", u = "crk-dot-Owuk1", y = "crk-dotBounce-FwdcC", w = "crk-loadingBorder-9ULFw", B = "crk-borderSpin-EJ2gW", D = {
2
- root: o,
3
- loading: n,
4
- primary: r,
5
- secondary: c,
6
- danger: t,
7
- ghost: s,
8
- sm: d,
9
- md: e,
10
- lg: i,
11
- fullWidth: l,
12
- iconOnly: m,
13
- content: a,
14
- shimmer: k,
15
- loadingShimmer: g,
16
- shimmerSweep: h,
17
- dots: S,
18
- loadingDots: p,
19
- dot: u,
20
- dotBounce: y,
21
- loadingBorder: w,
22
- borderSpin: B
23
- };
24
- export {
25
- B as borderSpin,
26
- a as content,
27
- t as danger,
28
- D as default,
29
- u as dot,
30
- y as dotBounce,
31
- S as dots,
32
- l as fullWidth,
33
- s as ghost,
34
- m as iconOnly,
35
- i as lg,
36
- n as loading,
37
- w as loadingBorder,
38
- p as loadingDots,
39
- g as loadingShimmer,
40
- e as md,
41
- r as primary,
42
- o as root,
43
- c as secondary,
44
- k as shimmer,
45
- h as shimmerSweep,
46
- d as sm
47
- };
@@ -1,60 +0,0 @@
1
- const e = "crk-root-rJfoz", t = "crk-outlined-SPAas", o = "crk-elevated-SpUsJ", d = "crk-filled-63Znw", r = "crk-padding-none-E-idy", n = "crk-padding-sm-wEesL", c = "crk-padding-md-PxKrw", i = "crk-padding-lg-HGAEB", a = "crk-interactive-rmnPM", s = "crk-selected-h8Mud", k = "crk-accented-y-KUi", l = "crk-header-j-c-9", f = "crk-headerDivider-VkECC", g = "crk-headerMain-caD6k", p = "crk-titleBlock-2Gsho", v = "crk-title-DzwNA", h = "crk-subtitle-RVMlO", w = "crk-actions-kVLYd", b = "crk-body-v78vB", m = "crk-footer-FjLbG", u = "crk-footer-start-D2qu0", B = "crk-footer-end-oKz5B", D = "crk-footer-between-zPeGc", E = "crk-footerDivider-jOmZZ", M = {
2
- root: e,
3
- outlined: t,
4
- elevated: o,
5
- filled: d,
6
- "padding-none": "crk-padding-none-E-idy",
7
- paddingNone: r,
8
- "padding-sm": "crk-padding-sm-wEesL",
9
- paddingSm: n,
10
- "padding-md": "crk-padding-md-PxKrw",
11
- paddingMd: c,
12
- "padding-lg": "crk-padding-lg-HGAEB",
13
- paddingLg: i,
14
- interactive: a,
15
- selected: s,
16
- accented: k,
17
- header: l,
18
- headerDivider: f,
19
- headerMain: g,
20
- titleBlock: p,
21
- title: v,
22
- subtitle: h,
23
- actions: w,
24
- body: b,
25
- footer: m,
26
- "footer-start": "crk-footer-start-D2qu0",
27
- footerStart: u,
28
- "footer-end": "crk-footer-end-oKz5B",
29
- footerEnd: B,
30
- "footer-between": "crk-footer-between-zPeGc",
31
- footerBetween: D,
32
- footerDivider: E
33
- };
34
- export {
35
- k as accented,
36
- w as actions,
37
- b as body,
38
- M as default,
39
- o as elevated,
40
- d as filled,
41
- m as footer,
42
- D as footerBetween,
43
- E as footerDivider,
44
- B as footerEnd,
45
- u as footerStart,
46
- l as header,
47
- f as headerDivider,
48
- g as headerMain,
49
- a as interactive,
50
- t as outlined,
51
- i as paddingLg,
52
- c as paddingMd,
53
- r as paddingNone,
54
- n as paddingSm,
55
- e as root,
56
- s as selected,
57
- h as subtitle,
58
- v as title,
59
- p as titleBlock
60
- };
@@ -1,61 +0,0 @@
1
- const t = "crk-root-uMSq0", e = "crk-canvas-zhFr0", o = "crk-svg-waPLB", c = "crk-gridLine-K2Gx9", n = "crk-axis-Zum8-", a = "crk-axisLabel-Ilv3u", r = "crk-cursorLine-iNHim", i = "crk-linePath-E4eYA", l = "crk-areaPath-ZwMc6", s = "crk-point-DTAoa", k = "crk-bar-9sYbq", d = "crk-barLabelInside-dlQh5", p = "crk-activeBar-FJhPJ", g = "crk-interactionLayer-dHNAG", L = "crk-legend-JL6YI", b = "crk-legendItem-rcdvO", w = "crk-legendSwatch-eJBsF", h = "crk-legendIcon-6gzcO", v = "crk-legendLabel-C-eu3", u = "crk-tooltip-m55-N", I = "crk-tooltipTitle-0EfoX", m = "crk-tooltipRows-MC0wM", P = "crk-tooltipRow-ZQomr", x = "crk-tooltipLabel-s4OKX", y = "crk-tooltipValue-iwj1s", R = "crk-empty-aa4vk", B = "crk-sparkline-3-eRc", H = "crk-tradingHeader-Pb9wS", S = {
2
- root: t,
3
- canvas: e,
4
- svg: o,
5
- gridLine: c,
6
- axis: n,
7
- axisLabel: a,
8
- cursorLine: r,
9
- linePath: i,
10
- areaPath: l,
11
- point: s,
12
- bar: k,
13
- barLabelInside: d,
14
- activeBar: p,
15
- interactionLayer: g,
16
- legend: L,
17
- legendItem: b,
18
- legendSwatch: w,
19
- legendIcon: h,
20
- legendLabel: v,
21
- tooltip: u,
22
- tooltipTitle: I,
23
- tooltipRows: m,
24
- tooltipRow: P,
25
- tooltipLabel: x,
26
- tooltipValue: y,
27
- empty: R,
28
- sparkline: B,
29
- tradingHeader: H
30
- };
31
- export {
32
- p as activeBar,
33
- l as areaPath,
34
- n as axis,
35
- a as axisLabel,
36
- k as bar,
37
- d as barLabelInside,
38
- e as canvas,
39
- r as cursorLine,
40
- S as default,
41
- R as empty,
42
- c as gridLine,
43
- g as interactionLayer,
44
- L as legend,
45
- h as legendIcon,
46
- b as legendItem,
47
- v as legendLabel,
48
- w as legendSwatch,
49
- i as linePath,
50
- s as point,
51
- t as root,
52
- B as sparkline,
53
- o as svg,
54
- u as tooltip,
55
- x as tooltipLabel,
56
- P as tooltipRow,
57
- m as tooltipRows,
58
- I as tooltipTitle,
59
- y as tooltipValue,
60
- H as tradingHeader
61
- };
@@ -1,59 +0,0 @@
1
- const c = "crk-root-zsoSy", r = "crk-sm-QbYLY", s = "crk-md--mV9a", e = "crk-pill-NsOem", o = "crk-rounded-Ps5zU", n = "crk-neutral-7ArkN", t = "crk-primary-rvetC", a = "crk-success-0GXdc", k = "crk-warning-NBLbz", i = "crk-danger-OJzar", d = "crk-soft-Pwn3N", l = "crk-outline-7MTzq", p = "crk-interactive-GksDo", m = "crk-selected-xbmxv", g = "crk-remove-GOhuV", u = "crk-disabled-0tD30", b = "crk-check-d6HS8", w = "crk-checkVisible-BkMxn", v = "crk-icon-Vxm-K", h = "crk-avatar-01FUB", V = "crk-label-VIt6F", x = "crk-group-EnqaM", y = "crk-gap-sm-WjiwB", z = "crk-gap-md-P9eUW", B = "crk-wrap-64-CR", M = "crk-nowrap-oTmY8", f = {
2
- root: c,
3
- sm: r,
4
- md: s,
5
- pill: e,
6
- rounded: o,
7
- neutral: n,
8
- primary: t,
9
- success: a,
10
- warning: k,
11
- danger: i,
12
- soft: d,
13
- outline: l,
14
- interactive: p,
15
- selected: m,
16
- remove: g,
17
- disabled: u,
18
- check: b,
19
- checkVisible: w,
20
- icon: v,
21
- avatar: h,
22
- label: V,
23
- group: x,
24
- "gap-sm": "crk-gap-sm-WjiwB",
25
- gapSm: y,
26
- "gap-md": "crk-gap-md-P9eUW",
27
- gapMd: z,
28
- wrap: B,
29
- nowrap: M
30
- };
31
- export {
32
- h as avatar,
33
- b as check,
34
- w as checkVisible,
35
- i as danger,
36
- f as default,
37
- u as disabled,
38
- z as gapMd,
39
- y as gapSm,
40
- x as group,
41
- v as icon,
42
- p as interactive,
43
- V as label,
44
- s as md,
45
- n as neutral,
46
- M as nowrap,
47
- l as outline,
48
- e as pill,
49
- t as primary,
50
- g as remove,
51
- c as root,
52
- o as rounded,
53
- m as selected,
54
- r as sm,
55
- d as soft,
56
- a as success,
57
- k as warning,
58
- B as wrap
59
- };