@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,39 +1,32 @@
1
- function p(t) {
2
- if (t.length === 0) return [0, 1];
3
- let o = t[0], c = t[0];
4
- for (let r = 1; r < t.length; r++) {
5
- const e = t[r];
6
- e < o && (o = e), e > c && (c = e);
7
- }
8
- return [o, c];
1
+ // src/components/Chart/scales.ts
2
+ function e(e) {
3
+ if (e.length === 0) return [0, 1];
4
+ let t = e[0], n = e[0];
5
+ for (let r = 1; r < e.length; r++) {
6
+ let i = e[r];
7
+ i < t && (t = i), i > n && (n = i);
8
+ }
9
+ return [t, n];
9
10
  }
10
- function u(t, o) {
11
- const [c, r] = t, [e, a] = o, s = r - c || 1, n = a - e, f = (i) => e + (i - c) / s * n;
12
- return f.invert = (i) => c + (i - e) / n * s, f;
11
+ function t(e, t) {
12
+ let [n, r] = e, [i, a] = t, o = r - n || 1, s = a - i, c = (e) => i + (e - n) / o * s;
13
+ return c.invert = (e) => n + (e - i) / s * o, c;
13
14
  }
14
- function M(t, o, c = 0.2) {
15
- const [r, e] = o, s = (e - r) / Math.max(1, t.length), n = s * (1 - c), f = /* @__PURE__ */ new Map();
16
- for (let l = 0; l < t.length; l++) f.set(t[l], l);
17
- const i = (l) => {
18
- const h = f.get(l);
19
- return h === void 0 ? r : r + h * s + s / 2;
20
- };
21
- return i.bandWidth = () => n, i.step = () => s, i;
15
+ function n(e, t, n = .2) {
16
+ let [r, i] = t, a = (i - r) / Math.max(1, e.length), o = a * (1 - n), s = /* @__PURE__ */ new Map();
17
+ for (let t = 0; t < e.length; t++) s.set(e[t], t);
18
+ let c = (e) => {
19
+ let t = s.get(e);
20
+ return t === void 0 ? r : r + t * a + a / 2;
21
+ };
22
+ return c.bandWidth = () => o, c.step = () => a, c;
22
23
  }
23
- function d(t, o, c = 5) {
24
- if (t === o)
25
- return [t];
26
- const e = (o - t) / Math.max(1, c), a = Math.pow(10, Math.floor(Math.log10(e))), s = e / a;
27
- let n;
28
- s < 1.5 ? n = a : s < 3 ? n = 2 * a : s < 7 ? n = 5 * a : n = 10 * a;
29
- const f = Math.floor(t / n) * n, i = Math.ceil(o / n) * n, l = [];
30
- for (let h = f; h <= i + n / 2; h += n)
31
- l.push(Number(h.toFixed(10)));
32
- return l;
24
+ function r(e, t, n = 5) {
25
+ if (e === t) return [e];
26
+ let r = (t - e) / Math.max(1, n), i = 10 ** Math.floor(Math.log10(r)), a = r / i, o;
27
+ o = a < 1.5 ? i : a < 3 ? 2 * i : a < 7 ? 5 * i : 10 * i;
28
+ let s = Math.floor(e / o) * o, c = Math.ceil(t / o) * o, l = [];
29
+ for (let e = s; e <= c + o / 2; e += o) l.push(Number(e.toFixed(10)));
30
+ return l;
33
31
  }
34
- export {
35
- M as bandScale,
36
- p as extent,
37
- u as linearScale,
38
- d as niceTicks
39
- };
32
+ export { n as bandScale, e as extent, t as linearScale, r as niceTicks };
@@ -1,68 +1,67 @@
1
- function i(n, l) {
2
- const f = new Array(n.length).fill(null);
3
- if (l <= 0 || n.length < l) return f;
4
- let c = 0;
5
- for (let t = 0; t < l; t++) c += n[t].close;
6
- f[l - 1] = c / l;
7
- for (let t = l; t < n.length; t++)
8
- c += n[t].close - n[t - l].close, f[t] = c / l;
9
- return f;
1
+ // src/components/Chart/trading/indicators.ts
2
+ function e(e, t) {
3
+ let n = Array(e.length).fill(null);
4
+ if (t <= 0 || e.length < t) return n;
5
+ let r = 0;
6
+ for (let n = 0; n < t; n++) r += e[n].close;
7
+ n[t - 1] = r / t;
8
+ for (let i = t; i < e.length; i++) r += e[i].close - e[i - t].close, n[i] = r / t;
9
+ return n;
10
10
  }
11
- function A(n, l) {
12
- const f = new Array(n.length).fill(null);
13
- if (l <= 0 || n.length < l) return f;
14
- const c = 2 / (l + 1);
15
- let t = 0;
16
- for (let e = 0; e < l; e++) t += n[e].close;
17
- let u = t / l;
18
- f[l - 1] = u;
19
- for (let e = l; e < n.length; e++)
20
- u = n[e].close * c + u * (1 - c), f[e] = u;
21
- return f;
11
+ function t(e, t) {
12
+ let n = Array(e.length).fill(null);
13
+ if (t <= 0 || e.length < t) return n;
14
+ let r = 2 / (t + 1), i = 0;
15
+ for (let n = 0; n < t; n++) i += e[n].close;
16
+ let a = i / t;
17
+ n[t - 1] = a;
18
+ for (let i = t; i < e.length; i++) a = e[i].close * r + a * (1 - r), n[i] = a;
19
+ return n;
22
20
  }
23
- function v(n, l, f = 2) {
24
- const c = n.length, t = new Array(c).fill(null), u = new Array(c).fill(null), e = new Array(c).fill(null);
25
- if (l <= 0 || c < l) return { middle: t, upper: u, lower: e };
26
- for (let o = l - 1; o < c; o++) {
27
- let g = 0;
28
- for (let s = o - l + 1; s <= o; s++) g += n[s].close;
29
- const h = g / l;
30
- let m = 0;
31
- for (let s = o - l + 1; s <= o; s++) {
32
- const w = n[s].close - h;
33
- m += w * w;
34
- }
35
- m /= l;
36
- const r = Math.sqrt(m);
37
- t[o] = h, u[o] = h + f * r, e[o] = h - f * r;
38
- }
39
- return { middle: t, upper: u, lower: e };
21
+ function n(e, t, n = 2) {
22
+ let r = e.length, i = Array(r).fill(null), a = Array(r).fill(null), o = Array(r).fill(null);
23
+ if (t <= 0 || r < t) return {
24
+ middle: i,
25
+ upper: a,
26
+ lower: o
27
+ };
28
+ for (let s = t - 1; s < r; s++) {
29
+ let r = 0;
30
+ for (let n = s - t + 1; n <= s; n++) r += e[n].close;
31
+ let c = r / t, l = 0;
32
+ for (let n = s - t + 1; n <= s; n++) {
33
+ let t = e[n].close - c;
34
+ l += t * t;
35
+ }
36
+ l /= t;
37
+ let u = Math.sqrt(l);
38
+ i[s] = c, a[s] = c + n * u, o[s] = c - n * u;
39
+ }
40
+ return {
41
+ middle: i,
42
+ upper: a,
43
+ lower: o
44
+ };
40
45
  }
41
- function a(n, l = 14) {
42
- const f = new Array(n.length).fill(null);
43
- if (n.length <= l) return f;
44
- let c = 0, t = 0;
45
- for (let u = 1; u <= l; u++) {
46
- const e = n[u].close - n[u - 1].close;
47
- e >= 0 ? c += e : t -= e;
48
- }
49
- c /= l, t /= l, f[l] = y(c, t);
50
- for (let u = l + 1; u < n.length; u++) {
51
- const e = n[u].close - n[u - 1].close, o = e > 0 ? e : 0, g = e < 0 ? -e : 0;
52
- c = (c * (l - 1) + o) / l, t = (t * (l - 1) + g) / l, f[u] = y(c, t);
53
- }
54
- return f;
46
+ function r(e, t = 14) {
47
+ let n = Array(e.length).fill(null);
48
+ if (e.length <= t) return n;
49
+ let r = 0, a = 0;
50
+ for (let n = 1; n <= t; n++) {
51
+ let t = e[n].close - e[n - 1].close;
52
+ t >= 0 ? r += t : a -= t;
53
+ }
54
+ r /= t, a /= t, n[t] = i(r, a);
55
+ for (let o = t + 1; o < e.length; o++) {
56
+ let s = e[o].close - e[o - 1].close, c = s > 0 ? s : 0, l = s < 0 ? -s : 0;
57
+ r = (r * (t - 1) + c) / t, a = (a * (t - 1) + l) / t, n[o] = i(r, a);
58
+ }
59
+ return n;
55
60
  }
56
- function y(n, l) {
57
- return l === 0 ? 100 : 100 - 100 / (1 + n / l);
61
+ function i(e, t) {
62
+ return t === 0 ? 100 : 100 - 100 / (1 + e / t);
58
63
  }
59
- function j(n) {
60
- return n.map((l) => typeof l.volume == "number" ? l.volume : null);
64
+ function a(e) {
65
+ return e.map((e) => typeof e.volume == "number" ? e.volume : null);
61
66
  }
62
- export {
63
- v as bollinger,
64
- A as ema,
65
- a as rsi,
66
- i as sma,
67
- j as volume
68
- };
67
+ export { n as bollinger, t as ema, r as rsi, e as sma, a as volume };
@@ -1,71 +1,49 @@
1
- function u(e) {
2
- switch (e) {
3
- case "1D":
4
- return 86400;
5
- case "5D":
6
- return 5 * 86400;
7
- case "1M":
8
- return 30 * 86400;
9
- case "3M":
10
- return 90 * 86400;
11
- case "6M":
12
- return 180 * 86400;
13
- case "1Y":
14
- return 365 * 86400;
15
- case "5Y":
16
- return 5 * 365 * 86400;
17
- case "10Y":
18
- return 10 * 365 * 86400;
19
- case "20Y":
20
- return 20 * 365 * 86400;
21
- case "MAX":
22
- return 100 * 365 * 86400;
23
- }
24
- const r = /^(\d+)\s*([dDwWmMyYhH])$/.exec(e);
25
- if (r) {
26
- const n = Number(r[1]), t = r[2].toLowerCase();
27
- if (t === "h") return n * 3600;
28
- if (t === "d") return n * 86400;
29
- if (t === "w") return n * 7 * 86400;
30
- if (t === "m") return n * 30 * 86400;
31
- if (t === "y") return n * 365 * 86400;
32
- }
33
- return 30 * 86400;
1
+ // src/components/Chart/trading/period.ts
2
+ var e = 86400;
3
+ function t(t) {
4
+ switch (t) {
5
+ case "1D": return e;
6
+ case "5D": return 5 * e;
7
+ case "1M": return 30 * e;
8
+ case "3M": return 90 * e;
9
+ case "6M": return 180 * e;
10
+ case "1Y": return 365 * e;
11
+ case "5Y": return 1825 * e;
12
+ case "10Y": return 3650 * e;
13
+ case "20Y": return 7300 * e;
14
+ case "MAX": return 36500 * e;
15
+ }
16
+ let n = /^(\d+)\s*([dDwWmMyYhH])$/.exec(t);
17
+ if (n) {
18
+ let t = Number(n[1]), r = n[2].toLowerCase();
19
+ if (r === "h") return t * 3600;
20
+ if (r === "d") return t * e;
21
+ if (r === "w") return t * 7 * e;
22
+ if (r === "m") return t * 30 * e;
23
+ if (r === "y") return t * 365 * e;
24
+ }
25
+ return 30 * e;
34
26
  }
35
- function s(e) {
36
- switch (e) {
37
- case "1D":
38
- return "5";
39
- case "5D":
40
- return "15";
41
- case "1M":
42
- return "60";
43
- case "3M":
44
- return "240";
45
- case "6M":
46
- return "D";
47
- case "1Y":
48
- return "D";
49
- case "5Y":
50
- return "W";
51
- case "10Y":
52
- return "W";
53
- case "20Y":
54
- return "M";
55
- case "MAX":
56
- return "M";
57
- }
58
- const r = u(e);
59
- return r >= 3 * 365 * 86400 ? "W" : r >= 180 * 86400 ? "D" : r >= 60 * 86400 ? "240" : r >= 14 * 86400 ? "60" : r >= 3 * 86400 ? "15" : "5";
27
+ function n(n) {
28
+ switch (n) {
29
+ case "1D": return "5";
30
+ case "5D": return "15";
31
+ case "1M": return "60";
32
+ case "3M": return "240";
33
+ case "6M": return "D";
34
+ case "1Y": return "D";
35
+ case "5Y": return "W";
36
+ case "10Y": return "W";
37
+ case "20Y": return "M";
38
+ case "MAX": return "M";
39
+ }
40
+ let r = t(n);
41
+ return r >= 1095 * e ? "W" : r >= 180 * e ? "D" : r >= 60 * e ? "240" : r >= 14 * e ? "60" : r >= 3 * e ? "15" : "5";
60
42
  }
61
- function c(e) {
62
- if (e === "W" || e === "M") return "5Y";
63
- if (e === "D") return "1Y";
64
- const r = Number(e);
65
- return !Number.isFinite(r) || r >= 240 ? "3M" : r >= 60 ? "1M" : r >= 15 || r >= 5 ? "5D" : "1D";
43
+ function r(e) {
44
+ if (e === "W" || e === "M") return "5Y";
45
+ if (e === "D") return "1Y";
46
+ let t = Number(e);
47
+ return !Number.isFinite(t) || t >= 240 ? "3M" : t >= 60 ? "1M" : t >= 15 || t >= 5 ? "5D" : "1D";
66
48
  }
67
- export {
68
- u as periodToSeconds,
69
- c as suggestPeriodForResolution,
70
- s as suggestResolutionForPeriod
71
- };
49
+ export { t as periodToSeconds, r as suggestPeriodForResolution, n as suggestResolutionForPeriod };
@@ -1,23 +1,31 @@
1
- import { useState as g, useRef as w, useEffect as m } from "react";
2
- function b(o, c = { width: 600, height: 300 }) {
3
- const [f, a] = g(c), r = w(c);
4
- return m(() => {
5
- const h = o.current;
6
- if (!h || typeof ResizeObserver > "u") return;
7
- const u = (i, n) => {
8
- const t = Math.max(0, Math.round(i)), s = Math.max(0, Math.round(n));
9
- r.current.width === t && r.current.height === s || (r.current = { width: t, height: s }, a({ width: t, height: s }));
10
- }, e = h.getBoundingClientRect();
11
- (e.width > 0 || e.height > 0) && u(e.width, e.height);
12
- const d = new ResizeObserver((i) => {
13
- const n = i[0];
14
- if (!n) return;
15
- const t = n.contentRect;
16
- u(t.width, t.height);
17
- });
18
- return d.observe(h), () => d.disconnect();
19
- }, [o]), f;
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ // src/components/Chart/useChartDimensions.ts
3
+ function r(r, i = {
4
+ width: 600,
5
+ height: 300
6
+ }) {
7
+ let [a, o] = n(i), s = t(i);
8
+ return e(() => {
9
+ let e = r.current;
10
+ if (!e || typeof ResizeObserver > "u") return;
11
+ let t = (e, t) => {
12
+ let n = Math.max(0, Math.round(e)), r = Math.max(0, Math.round(t));
13
+ (s.current.width !== n || s.current.height !== r) && (s.current = {
14
+ width: n,
15
+ height: r
16
+ }, o({
17
+ width: n,
18
+ height: r
19
+ }));
20
+ }, n = e.getBoundingClientRect();
21
+ (n.width > 0 || n.height > 0) && t(n.width, n.height);
22
+ let i = new ResizeObserver((e) => {
23
+ let n = e[0];
24
+ if (!n) return;
25
+ let r = n.contentRect;
26
+ t(r.width, r.height);
27
+ });
28
+ return i.observe(e), () => i.disconnect();
29
+ }, [r]), a;
20
30
  }
21
- export {
22
- b as useChartDimensions
23
- };
31
+ export { r as useChartDimensions };
@@ -1,141 +1,98 @@
1
- import { jsxs as P, Fragment as j, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as S, useState as B, Children as E } from "react";
3
- import l from "clsx";
4
- import o from "./Chip.module.scss.js";
5
- const K = S(
6
- ({
7
- icon: w,
8
- avatar: a,
9
- onRemove: s,
10
- removeLabel: v = "Remove",
11
- selected: e,
12
- onSelectedChange: N,
13
- disabled: n = !1,
14
- color: k = "neutral",
15
- appearance: u = "soft",
16
- size: C = "md",
17
- shape: D = "pill",
18
- classes: d,
19
- className: f,
20
- children: h,
21
- onClick: c,
22
- onKeyDown: g,
23
- ...y
24
- }, m) => {
25
- const i = e !== void 0, p = i || !!c, b = (t) => {
26
- n || (i && N?.(!e), c?.(t));
27
- }, $ = (t) => {
28
- g?.(t), !t.defaultPrevented && s && !n && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), s());
29
- }, x = l(
30
- o.root,
31
- o[k],
32
- o[u],
33
- o[C],
34
- o[D],
35
- p && o.interactive,
36
- i && o.toggle,
37
- e && o.selected,
38
- n && o.disabled,
39
- d?.root,
40
- f
41
- ), I = typeof h == "string" ? h : void 0, L = /* @__PURE__ */ P(j, { children: [
42
- i && // Always rendered so it can transition; zero width when unselected,
43
- // and the padding shrinks to match when selected — constant chip width.
44
- /* @__PURE__ */ r("span", { className: l(o.check, e && o.checkVisible), "aria-hidden": "true" }),
45
- a !== void 0 && /* @__PURE__ */ r("span", { className: l(o.avatar, d?.avatar), children: a }),
46
- w !== void 0 && /* @__PURE__ */ r("span", { className: l(o.icon, d?.icon), "aria-hidden": "true", children: w }),
47
- /* @__PURE__ */ r("span", { className: l(o.label, d?.label), children: h }),
48
- s && /* @__PURE__ */ r(
49
- "button",
50
- {
51
- type: "button",
52
- className: l(o.remove, d?.remove),
53
- "aria-label": I ? `${v} ${I}` : v,
54
- disabled: n,
55
- tabIndex: -1,
56
- onClick: (t) => {
57
- t.stopPropagation(), n || s();
58
- },
59
- children: /* @__PURE__ */ r("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M6.3 5.3a1 1 0 0 0-1.4 1.4L8.6 10l-3.7 3.3a1 1 0 1 0 1.4 1.4L10 11.4l3.3 3.3a1 1 0 0 0 1.4-1.4L11.4 10l3.3-3.3a1 1 0 0 0-1.4-1.4L10 8.6 6.3 5.3z" }) })
60
- }
61
- )
62
- ] });
63
- return p && !s ? /* @__PURE__ */ r(
64
- "button",
65
- {
66
- ref: m,
67
- type: "button",
68
- className: x,
69
- "aria-pressed": i ? e : void 0,
70
- disabled: n,
71
- onClick: b,
72
- onKeyDown: $,
73
- ...y,
74
- children: L
75
- }
76
- ) : /* @__PURE__ */ r(
77
- "span",
78
- {
79
- ref: m,
80
- className: x,
81
- role: p ? "button" : void 0,
82
- "aria-pressed": i ? e : void 0,
83
- "aria-disabled": n || void 0,
84
- tabIndex: (p || s) && !n ? 0 : void 0,
85
- onClick: p ? b : void 0,
86
- onKeyDown: (t) => {
87
- $(t), !(t.defaultPrevented || !p) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), b(t));
88
- },
89
- ...y,
90
- children: L
91
- }
92
- );
93
- }
94
- );
95
- K.displayName = "Chip";
96
- const G = S(
97
- ({
98
- children: w,
99
- max: a,
100
- overflowLabel: s = (f) => `+${f}`,
101
- onOverflowClick: v,
102
- expandable: e = !1,
103
- collapseLabel: N = "Show less",
104
- gap: n = "sm",
105
- wrap: k = !0,
106
- classes: u,
107
- className: C,
108
- ...D
109
- }, d) => {
110
- const [f, h] = B(!1), c = E.toArray(w), g = a !== void 0 && a >= 0 && !f && c.length > a, y = g ? c.slice(0, a) : c, m = c.length - y.length, i = e || !!v, p = () => {
111
- e && h(!0), v?.();
112
- };
113
- return /* @__PURE__ */ P(
114
- "div",
115
- {
116
- ref: d,
117
- role: "group",
118
- className: l(o.group, o[`gap-${n}`], k ? o.wrap : o.nowrap, u?.root, C),
119
- ...D,
120
- children: [
121
- y,
122
- g && /* @__PURE__ */ r(
123
- K,
124
- {
125
- className: l(o.overflow, u?.overflow),
126
- onClick: i ? p : void 0,
127
- "aria-label": i ? `Show ${m} more` : void 0,
128
- children: s(m)
129
- }
130
- ),
131
- e && f && a !== void 0 && c.length > a && /* @__PURE__ */ r(K, { className: l(o.overflow, u?.overflow), onClick: () => h(!1), children: N })
132
- ]
133
- }
134
- );
135
- }
136
- );
137
- G.displayName = "ChipGroup";
138
- export {
139
- K as Chip,
140
- G as ChipGroup
141
- };
1
+ import e from "./Chip.module.js";
2
+ import { Children as t, forwardRef as n, useState as r } from "react";
3
+ import i from "clsx";
4
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ // src/components/Chip/Chip.tsx
6
+ var c = n(({ icon: t, avatar: n, onRemove: r, removeLabel: c = "Remove", selected: l, onSelectedChange: u, disabled: d = !1, color: f = "neutral", appearance: p = "soft", size: m = "md", shape: h = "pill", classes: g, className: _, children: v, onClick: y, onKeyDown: b, ...x }, S) => {
7
+ let C = l !== void 0, w = C || !!y, T = (e) => {
8
+ d || (C && u?.(!l), y?.(e));
9
+ }, E = (e) => {
10
+ b?.(e), e.defaultPrevented || r && !d && (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), r());
11
+ }, D = i(e.root, e[f], e[p], e[m], e[h], w && e.interactive, C && e.toggle, l && e.selected, d && e.disabled, g?.root, _), O = typeof v == "string" ? v : void 0, k = /* @__PURE__ */ s(a, { children: [
12
+ C && /* @__PURE__ */ o("span", {
13
+ className: i(e.check, l && e.checkVisible),
14
+ "aria-hidden": "true"
15
+ }),
16
+ n !== void 0 && /* @__PURE__ */ o("span", {
17
+ className: i(e.avatar, g?.avatar),
18
+ children: n
19
+ }),
20
+ t !== void 0 && /* @__PURE__ */ o("span", {
21
+ className: i(e.icon, g?.icon),
22
+ "aria-hidden": "true",
23
+ children: t
24
+ }),
25
+ /* @__PURE__ */ o("span", {
26
+ className: i(e.label, g?.label),
27
+ children: v
28
+ }),
29
+ r && /* @__PURE__ */ o("button", {
30
+ type: "button",
31
+ className: i(e.remove, g?.remove),
32
+ "aria-label": O ? `${c} ${O}` : c,
33
+ disabled: d,
34
+ tabIndex: -1,
35
+ onClick: (e) => {
36
+ e.stopPropagation(), d || r();
37
+ },
38
+ children: /* @__PURE__ */ o("svg", {
39
+ viewBox: "0 0 20 20",
40
+ fill: "currentColor",
41
+ "aria-hidden": "true",
42
+ children: /* @__PURE__ */ o("path", { d: "M6.3 5.3a1 1 0 0 0-1.4 1.4L8.6 10l-3.7 3.3a1 1 0 1 0 1.4 1.4L10 11.4l3.3 3.3a1 1 0 0 0 1.4-1.4L11.4 10l3.3-3.3a1 1 0 0 0-1.4-1.4L10 8.6 6.3 5.3z" })
43
+ })
44
+ })
45
+ ] });
46
+ return w && !r ? /* @__PURE__ */ o("button", {
47
+ ref: S,
48
+ type: "button",
49
+ className: D,
50
+ "aria-pressed": C ? l : void 0,
51
+ disabled: d,
52
+ onClick: T,
53
+ onKeyDown: E,
54
+ ...x,
55
+ children: k
56
+ }) : /* @__PURE__ */ o("span", {
57
+ ref: S,
58
+ className: D,
59
+ role: w ? "button" : void 0,
60
+ "aria-pressed": C ? l : void 0,
61
+ "aria-disabled": d || void 0,
62
+ tabIndex: (w || r) && !d ? 0 : void 0,
63
+ onClick: w ? T : void 0,
64
+ onKeyDown: (e) => {
65
+ E(e), !e.defaultPrevented && w && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), T(e));
66
+ },
67
+ ...x,
68
+ children: k
69
+ });
70
+ });
71
+ c.displayName = "Chip";
72
+ var l = n(({ children: n, max: a, overflowLabel: l = (e) => `+${e}`, onOverflowClick: u, expandable: d = !1, collapseLabel: f = "Show less", gap: p = "sm", wrap: m = !0, classes: h, className: g, ..._ }, v) => {
73
+ let [y, b] = r(!1), x = t.toArray(n), S = a !== void 0 && a >= 0 && !y && x.length > a, C = S ? x.slice(0, a) : x, w = x.length - C.length, T = d || !!u, E = () => {
74
+ d && b(!0), u?.();
75
+ };
76
+ return /* @__PURE__ */ s("div", {
77
+ ref: v,
78
+ role: "group",
79
+ className: i(e.group, e[`gap-${p}`], m ? e.wrap : e.nowrap, h?.root, g),
80
+ ..._,
81
+ children: [
82
+ C,
83
+ S && /* @__PURE__ */ o(c, {
84
+ className: i(e.overflow, h?.overflow),
85
+ onClick: T ? E : void 0,
86
+ "aria-label": T ? `Show ${w} more` : void 0,
87
+ children: l(w)
88
+ }),
89
+ d && y && a !== void 0 && x.length > a && /* @__PURE__ */ o(c, {
90
+ className: i(e.overflow, h?.overflow),
91
+ onClick: () => b(!1),
92
+ children: f
93
+ })
94
+ ]
95
+ });
96
+ });
97
+ l.displayName = "ChipGroup";
98
+ export { c as Chip, l as ChipGroup };