@overdoser/react-toolkit 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
57
|
-
|
|
61
|
+
function i(e, t) {
|
|
62
|
+
return t === 0 ? 100 : 100 - 100 / (1 + e / t);
|
|
58
63
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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":
|
|
34
|
+
case "1Y": return "D";
|
|
35
|
+
case "5Y":
|
|
36
|
+
case "10Y": return "W";
|
|
37
|
+
case "20Y":
|
|
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
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 };
|
package/components/Chip/Chip.js
CHANGED
|
@@ -1,141 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import o from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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 { Children as e, forwardRef as t, useState as n } from "react";
|
|
2
|
+
import r from "clsx";
|
|
3
|
+
import i from "./Chip.module.scss.js";
|
|
4
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Chip/Chip.tsx
|
|
6
|
+
var c = t(({ icon: e, avatar: t, onRemove: n, 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 || n && !d && (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), n());
|
|
11
|
+
}, D = r(i.root, i[f], i[p], i[m], i[h], w && i.interactive, C && i.toggle, l && i.selected, d && i.disabled, g?.root, _), O = typeof v == "string" ? v : void 0, k = /* @__PURE__ */ s(a, { children: [
|
|
12
|
+
C && /* @__PURE__ */ o("span", {
|
|
13
|
+
className: r(i.check, l && i.checkVisible),
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
}),
|
|
16
|
+
t !== void 0 && /* @__PURE__ */ o("span", {
|
|
17
|
+
className: r(i.avatar, g?.avatar),
|
|
18
|
+
children: t
|
|
19
|
+
}),
|
|
20
|
+
e !== void 0 && /* @__PURE__ */ o("span", {
|
|
21
|
+
className: r(i.icon, g?.icon),
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: e
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ o("span", {
|
|
26
|
+
className: r(i.label, g?.label),
|
|
27
|
+
children: v
|
|
28
|
+
}),
|
|
29
|
+
n && /* @__PURE__ */ o("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
className: r(i.remove, g?.remove),
|
|
32
|
+
"aria-label": O ? `${c} ${O}` : c,
|
|
33
|
+
disabled: d,
|
|
34
|
+
tabIndex: -1,
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
e.stopPropagation(), d || n();
|
|
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 && !n ? /* @__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 || n) && !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 = t(({ children: t, 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] = n(!1), x = e.toArray(t), 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: r(i.group, i[`gap-${p}`], m ? i.wrap : i.nowrap, h?.root, g),
|
|
80
|
+
..._,
|
|
81
|
+
children: [
|
|
82
|
+
C,
|
|
83
|
+
S && /* @__PURE__ */ o(c, {
|
|
84
|
+
className: r(i.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: r(i.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 };
|