@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.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +47 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.js +20 -0
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.js +25 -0
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +92 -95
- package/components/Alert/Alert.module.js +18 -0
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.js +23 -0
- package/components/Badge/Badge.js +16 -38
- package/components/Badge/Badge.module.js +17 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.js +25 -0
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.js +35 -0
- 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.js +32 -0
- 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 +46 -41
- 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.js +32 -0
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.js +23 -0
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.js +28 -0
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.js +17 -0
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.js +10 -0
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.js +66 -0
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.js +29 -0
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +12 -10
- 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.js +12 -0
- package/components/EmptyState/EmptyState.js +58 -55
- package/components/EmptyState/EmptyState.module.js +14 -0
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +32 -35
- package/components/Form/Form.module.js +16 -0
- 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.js +26 -0
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +25 -22
- package/components/Kbd/Kbd.module.js +10 -0
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.js +23 -0
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.js +10 -0
- package/components/List/List.js +22 -46
- package/components/List/List.module.js +12 -0
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.js +40 -0
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.js +18 -0
- package/components/PageHeader/PageHeader.js +78 -72
- package/components/PageHeader/PageHeader.module.js +23 -0
- package/components/Pagination/Pagination.js +63 -84
- package/components/Pagination/Pagination.module.js +13 -0
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.js +12 -0
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +57 -90
- package/components/ProgressBar/ProgressBar.module.js +29 -0
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.js +3 -0
- package/components/SegmentedControl/SegmentedControl.js +94 -130
- package/components/SegmentedControl/SegmentedControl.module.js +21 -0
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.js +15 -0
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.js +12 -0
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.js +31 -0
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.js +14 -0
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.js +42 -0
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.js +18 -0
- package/components/Table/Table.d.ts +41 -16
- package/components/Table/Table.js +383 -442
- package/components/Table/Table.module.js +42 -0
- package/components/Table/index.d.ts +1 -1
- package/components/Table/useTableSort.d.ts +1 -1
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.js +28 -0
- package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
- package/components/ThemeToggle/ThemeToggle.js +122 -97
- package/components/ThemeToggle/ThemeToggle.module.js +13 -0
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.js +29 -0
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.js +31 -0
- package/components/Timeline/Timeline.module.js +76 -0
- 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 +245 -178
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.js +98 -0
- 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.js +29 -0
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.js +37 -0
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +35 -57
- package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.js +17 -0
- package/components/Typography/Typography.js +11 -36
- package/components/Typography/Typography.module.js +30 -0
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.js +10 -0
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.js +14 -0
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
- 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.js +15 -0
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.js +14 -0
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.js +9 -0
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.js +8 -0
- package/components/inputs/Select/Select.js +555 -682
- package/components/inputs/Select/Select.module.js +38 -0
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.js +9 -0
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.js +14 -0
- 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 -91
- package/hooks/usePortalPosition.js +25 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.d.ts +2 -2
- package/hooks/useTheme.js +28 -25
- package/index.css +2 -1
- package/index.d.ts +1 -1
- package/index.js +97 -215
- package/index.layered.css +2 -3
- package/llms.txt +9 -6
- package/manifest.json +66 -10
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.d.ts +2 -0
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
- package/components/Accordion/Accordion.module.scss.js +0 -36
- package/components/ActionButton/ActionButton.module.scss.js +0 -47
- package/components/Alert/Alert.module.scss.js +0 -33
- package/components/Avatar/Avatar.module.scss.js +0 -43
- package/components/Badge/Badge.module.scss.js +0 -31
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
- package/components/Button/Button.module.scss.js +0 -47
- package/components/Card/Card.module.scss.js +0 -60
- package/components/Chart/Chart.module.scss.js +0 -61
- package/components/Chip/Chip.module.scss.js +0 -59
- package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
- package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
- package/components/Divider/Divider.module.scss.js +0 -31
- package/components/Draggable/Draggable.module.scss.js +0 -17
- package/components/Drawer/Drawer.module.scss.js +0 -119
- package/components/Dropdown/Dropdown.module.scss.js +0 -53
- package/components/Dropzone/Dropzone.module.scss.js +0 -21
- package/components/EmptyState/EmptyState.module.scss.js +0 -25
- package/components/Form/Form.module.scss.js +0 -29
- package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
- package/components/Kbd/Kbd.module.scss.js +0 -17
- package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
- package/components/Link/Link.module.scss.js +0 -16
- package/components/List/List.module.scss.js +0 -21
- package/components/Loader/Loader.module.scss.js +0 -70
- package/components/Modal/Modal.module.scss.js +0 -33
- package/components/PageHeader/PageHeader.module.scss.js +0 -43
- package/components/Pagination/Pagination.module.scss.js +0 -23
- package/components/Popover/Popover.module.scss.js +0 -21
- package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
- package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
- package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
- package/components/Skeleton/Skeleton.module.scss.js +0 -25
- package/components/Spinner/Spinner.module.scss.js +0 -20
- package/components/SplitButton/SplitButton.module.scss.js +0 -57
- package/components/SplitPane/SplitPane.module.scss.js +0 -25
- package/components/StatCard/StatCard.module.scss.js +0 -72
- package/components/StatusDot/StatusDot.module.scss.js +0 -32
- package/components/Table/Table.module.scss.js +0 -81
- package/components/Tabs/Tabs.module.scss.js +0 -53
- package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
- package/components/Timeline/GanttTimeline.module.scss.js +0 -55
- package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
- package/components/Timeline/Timeline.module.scss.js +0 -141
- package/components/Timeline/TraceTimeline.module.scss.js +0 -189
- package/components/Timer/Timer.module.scss.js +0 -55
- package/components/Toast/Toast.module.scss.js +0 -62
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
- package/components/Tooltip/Tooltip.module.scss.js +0 -30
- package/components/Typography/Typography.module.scss.js +0 -53
- package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
- package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
- package/components/inputs/Input/Input.module.scss.js +0 -27
- package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
- package/components/inputs/Radio/Radio.module.scss.js +0 -15
- package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
- package/components/inputs/Select/Select.module.scss.js +0 -73
- package/components/inputs/Slider/Slider.module.scss.js +0 -15
- package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
|
@@ -1,218 +1,169 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import u from "
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { ChartContainer as e } from "./ChartContainer.js";
|
|
2
|
+
import { ChartLegend as t } from "./ChartLegend.js";
|
|
3
|
+
import { ChartTooltip as n } from "./ChartTooltip.js";
|
|
4
|
+
import { extent as r, niceTicks as i } from "./scales.js";
|
|
5
|
+
import a from "./Chart.module.js";
|
|
6
|
+
import { useMemo as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import l from "clsx";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
// src/components/Chart/RadarChart.tsx
|
|
10
|
+
function p(e, t, n, r) {
|
|
11
|
+
let i = (r - 90) * Math.PI / 180;
|
|
12
|
+
return {
|
|
13
|
+
x: e + n * Math.cos(i),
|
|
14
|
+
y: t + n * Math.sin(i)
|
|
15
|
+
};
|
|
12
16
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
function m(e, t, n, r) {
|
|
18
|
+
return r.map((r) => {
|
|
19
|
+
let i = p(e, t, n, r);
|
|
20
|
+
return `${i.x},${i.y}`;
|
|
21
|
+
}).join(" ");
|
|
18
22
|
}
|
|
19
|
-
function
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return R(i, l, Z, L[x]);
|
|
165
|
-
}), a = s.map((r) => `${r.x},${r.y}`).join(" ");
|
|
166
|
-
return /* @__PURE__ */ _("g", { className: h(u.series, c?.series), children: [
|
|
167
|
-
/* @__PURE__ */ o(
|
|
168
|
-
"polygon",
|
|
169
|
-
{
|
|
170
|
-
points: a,
|
|
171
|
-
fill: t.color,
|
|
172
|
-
fillOpacity: G,
|
|
173
|
-
stroke: t.color,
|
|
174
|
-
strokeWidth: H,
|
|
175
|
-
strokeLinejoin: "round",
|
|
176
|
-
strokeLinecap: "round"
|
|
177
|
-
}
|
|
178
|
-
),
|
|
179
|
-
E && s.map((r, x) => /* @__PURE__ */ o(
|
|
180
|
-
"circle",
|
|
181
|
-
{
|
|
182
|
-
className: h(u.point, c?.point),
|
|
183
|
-
cx: r.x,
|
|
184
|
-
cy: r.y,
|
|
185
|
-
r: $ === x ? 5 : 3.5,
|
|
186
|
-
fill: t.color
|
|
187
|
-
},
|
|
188
|
-
`${n}-${x}`
|
|
189
|
-
))
|
|
190
|
-
] }, n);
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ o(
|
|
193
|
-
"rect",
|
|
194
|
-
{
|
|
195
|
-
className: u.interactionLayer,
|
|
196
|
-
x: 0,
|
|
197
|
-
y: 0,
|
|
198
|
-
width: d,
|
|
199
|
-
height: p,
|
|
200
|
-
onMouseMove: (n) => {
|
|
201
|
-
const t = n.currentTarget.getBoundingClientRect(), s = n.clientX - t.left - i, a = n.clientY - t.top - l;
|
|
202
|
-
if (s === 0 && a === 0) return;
|
|
203
|
-
let r = Math.atan2(a, s) * 180 / Math.PI + 90;
|
|
204
|
-
r < 0 && (r += 360), r >= 360 && (r -= 360);
|
|
205
|
-
const x = 360 / e.length, y = Math.round(r / x) % e.length;
|
|
206
|
-
W(y);
|
|
207
|
-
},
|
|
208
|
-
onMouseLeave: () => W(null)
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
] });
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
);
|
|
23
|
+
function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, gridType: b = "polygon", showGrid: x = !0, showRadialLines: S = !0, showAxisLabels: C = !0, showRadiusAxis: w = !1, levels: T = 5, showPoints: E = !0, fillOpacity: D = .4, strokeWidth: O = 2, renderAxisLabel: k, axisFormat: A, valueFormat: j, renderTooltip: M, showLegend: N = !0, showTooltip: P = !0, emptyMessage: F = "No data", className: I, style: L, classes: R }) {
|
|
24
|
+
let [z, B] = c(null), V = s(null), H = o(() => Object.keys(_), [_]), U = o(() => h.map((e, t) => t / h.length * 360), [h]), W = o(() => {
|
|
25
|
+
let e = [];
|
|
26
|
+
for (let t of H) for (let n of h) {
|
|
27
|
+
let r = n[t];
|
|
28
|
+
typeof r == "number" && e.push(r);
|
|
29
|
+
}
|
|
30
|
+
let [, t] = r(e);
|
|
31
|
+
return Math.max(1, t);
|
|
32
|
+
}, [h, H]), G = o(() => i(0, W, T).filter((e) => e > 0), [W, T]), K = G[G.length - 1] ?? W;
|
|
33
|
+
return h.length === 0 ? /* @__PURE__ */ d("div", {
|
|
34
|
+
ref: V,
|
|
35
|
+
className: l(a.root, R?.root, I),
|
|
36
|
+
style: L,
|
|
37
|
+
children: /* @__PURE__ */ d("div", {
|
|
38
|
+
className: a.canvas,
|
|
39
|
+
style: { height: y ?? 240 },
|
|
40
|
+
children: /* @__PURE__ */ d("div", {
|
|
41
|
+
className: a.empty,
|
|
42
|
+
children: F
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
}) : /* @__PURE__ */ d(e, {
|
|
46
|
+
ref: V,
|
|
47
|
+
aspectRatio: v,
|
|
48
|
+
height: y,
|
|
49
|
+
className: I,
|
|
50
|
+
style: L,
|
|
51
|
+
classes: R,
|
|
52
|
+
legend: N ? /* @__PURE__ */ d(t, {
|
|
53
|
+
config: _,
|
|
54
|
+
classes: R
|
|
55
|
+
}) : void 0,
|
|
56
|
+
overlay: P && z !== null ? /* @__PURE__ */ d(n, {
|
|
57
|
+
row: h[z],
|
|
58
|
+
x: (V.current?.getBoundingClientRect().width ?? 0) / 2,
|
|
59
|
+
y: 16,
|
|
60
|
+
containerWidth: V.current?.getBoundingClientRect().width ?? 0,
|
|
61
|
+
config: _,
|
|
62
|
+
render: M ? () => M(h[z]) : void 0,
|
|
63
|
+
valueFormat: j,
|
|
64
|
+
titleKey: g,
|
|
65
|
+
classes: R
|
|
66
|
+
}) : null,
|
|
67
|
+
children: ({ width: e, height: t }) => {
|
|
68
|
+
let n = C ? 32 : 8, r = e / 2, i = t / 2, o = Math.max(0, Math.min(e, t) / 2 - n), s = (e) => Math.max(0, e) / K * o;
|
|
69
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
70
|
+
x && G.map((e) => {
|
|
71
|
+
let t = s(e);
|
|
72
|
+
return b === "circle" ? /* @__PURE__ */ d("circle", {
|
|
73
|
+
className: l(a.gridLine, R?.grid),
|
|
74
|
+
cx: r,
|
|
75
|
+
cy: i,
|
|
76
|
+
r: t,
|
|
77
|
+
fill: "none"
|
|
78
|
+
}, `ring-${e}`) : /* @__PURE__ */ d("polygon", {
|
|
79
|
+
className: l(a.gridLine, R?.grid),
|
|
80
|
+
points: m(r, i, t, U),
|
|
81
|
+
fill: "none"
|
|
82
|
+
}, `ring-${e}`);
|
|
83
|
+
}),
|
|
84
|
+
S && U.map((e, t) => {
|
|
85
|
+
let n = p(r, i, o, e);
|
|
86
|
+
return /* @__PURE__ */ d("line", {
|
|
87
|
+
className: l(a.gridLine, R?.grid),
|
|
88
|
+
x1: r,
|
|
89
|
+
y1: i,
|
|
90
|
+
x2: n.x,
|
|
91
|
+
y2: n.y
|
|
92
|
+
}, `spoke-${t}`);
|
|
93
|
+
}),
|
|
94
|
+
w && G.map((e) => {
|
|
95
|
+
let t = s(e);
|
|
96
|
+
return /* @__PURE__ */ d("text", {
|
|
97
|
+
className: l(a.axisLabel, R?.axisLabel),
|
|
98
|
+
x: r + 4,
|
|
99
|
+
y: i - t,
|
|
100
|
+
textAnchor: "start",
|
|
101
|
+
dominantBaseline: "middle",
|
|
102
|
+
children: j ? j(e) : e
|
|
103
|
+
}, `raxis-${e}`);
|
|
104
|
+
}),
|
|
105
|
+
C && h.map((e, t) => {
|
|
106
|
+
let n = U[t], s = p(r, i, o + 14, n), c = s.x < r - 1 ? "end" : s.x > r + 1 ? "start" : "middle";
|
|
107
|
+
if (k) return /* @__PURE__ */ d("g", { children: k({
|
|
108
|
+
row: e,
|
|
109
|
+
index: t,
|
|
110
|
+
angle: n,
|
|
111
|
+
x: s.x,
|
|
112
|
+
y: s.y,
|
|
113
|
+
textAnchor: c
|
|
114
|
+
}) }, `label-${t}`);
|
|
115
|
+
let u = String(e[g]), f = A ? A(u) : u;
|
|
116
|
+
return /* @__PURE__ */ d("text", {
|
|
117
|
+
className: l(a.axisLabel, R?.axisLabel),
|
|
118
|
+
x: s.x,
|
|
119
|
+
y: s.y,
|
|
120
|
+
textAnchor: c,
|
|
121
|
+
dominantBaseline: "middle",
|
|
122
|
+
children: f
|
|
123
|
+
}, `label-${t}`);
|
|
124
|
+
}),
|
|
125
|
+
H.map((e) => {
|
|
126
|
+
let t = _[e], n = h.map((t, n) => {
|
|
127
|
+
let a = t[e], o = s(typeof a == "number" ? a : 0);
|
|
128
|
+
return p(r, i, o, U[n]);
|
|
129
|
+
}), o = n.map((e) => `${e.x},${e.y}`).join(" ");
|
|
130
|
+
return /* @__PURE__ */ f("g", {
|
|
131
|
+
className: l(a.series, R?.series),
|
|
132
|
+
children: [/* @__PURE__ */ d("polygon", {
|
|
133
|
+
points: o,
|
|
134
|
+
fill: t.color,
|
|
135
|
+
fillOpacity: D,
|
|
136
|
+
stroke: t.color,
|
|
137
|
+
strokeWidth: O,
|
|
138
|
+
strokeLinejoin: "round",
|
|
139
|
+
strokeLinecap: "round"
|
|
140
|
+
}), E && n.map((n, r) => /* @__PURE__ */ d("circle", {
|
|
141
|
+
className: l(a.point, R?.point),
|
|
142
|
+
cx: n.x,
|
|
143
|
+
cy: n.y,
|
|
144
|
+
r: z === r ? 5 : 3.5,
|
|
145
|
+
fill: t.color
|
|
146
|
+
}, `${e}-${r}`))]
|
|
147
|
+
}, e);
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ d("rect", {
|
|
150
|
+
className: a.interactionLayer,
|
|
151
|
+
x: 0,
|
|
152
|
+
y: 0,
|
|
153
|
+
width: e,
|
|
154
|
+
height: t,
|
|
155
|
+
onMouseMove: (e) => {
|
|
156
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left - r, a = e.clientY - t.top - i;
|
|
157
|
+
if (n === 0 && a === 0) return;
|
|
158
|
+
let o = Math.atan2(a, n) * 180 / Math.PI + 90;
|
|
159
|
+
o < 0 && (o += 360), o >= 360 && (o -= 360);
|
|
160
|
+
let s = 360 / h.length, c = Math.round(o / s) % h.length;
|
|
161
|
+
B(c);
|
|
162
|
+
},
|
|
163
|
+
onMouseLeave: () => B(null)
|
|
164
|
+
})
|
|
165
|
+
] });
|
|
166
|
+
}
|
|
167
|
+
});
|
|
215
168
|
}
|
|
216
|
-
export {
|
|
217
|
-
yn as RadarChart
|
|
218
|
-
};
|
|
169
|
+
export { h as RadarChart };
|
|
@@ -1,69 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { extent as e, linearScale as t } from "./scales.js";
|
|
2
|
+
import n from "./Chart.module.js";
|
|
3
|
+
import { forwardRef as r, useMemo as i } from "react";
|
|
4
|
+
import a from "clsx";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Chart/Sparkline.tsx
|
|
7
|
+
function c(e, t) {
|
|
8
|
+
if (e.length === 0) return "";
|
|
9
|
+
if (e.length === 1 || t === "linear") return e.map((e, t) => `${t === 0 ? "M" : "L"} ${e.x} ${e.y}`).join(" ");
|
|
10
|
+
let n = `M ${e[0].x} ${e[0].y}`;
|
|
11
|
+
for (let t = 0; t < e.length - 1; t++) {
|
|
12
|
+
let r = e[t - 1] ?? e[t], i = e[t], a = e[t + 1], o = e[t + 2] ?? a, s = i.x + (a.x - r.x) / 6, c = i.y + (a.y - r.y) / 6, l = a.x - (o.x - i.x) / 6, u = a.y - (o.y - i.y) / 6;
|
|
13
|
+
n += ` C ${s} ${c}, ${l} ${u}, ${a.x} ${a.y}`;
|
|
14
|
+
}
|
|
15
|
+
return n;
|
|
16
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
|
-
}
|
|
17
|
+
var l = r(({ data: r, width: l = 80, height: u = 24, color: d = "var(--crk-chart-1)", strokeWidth: f = 1.5, curve: p = "monotone", fill: m = !1, showLastPoint: h = !1, "aria-label": g, className: _, style: v }, y) => {
|
|
18
|
+
let { line: b, area: x, last: S } = i(() => {
|
|
19
|
+
if (r.length === 0) return {
|
|
20
|
+
line: "",
|
|
21
|
+
area: "",
|
|
22
|
+
last: null
|
|
23
|
+
};
|
|
24
|
+
let n = f, i = Math.max(1, l - n * 2), a = Math.max(1, u - n * 2), [o, s] = e(r), d = t([0, Math.max(1, r.length - 1)], [n, n + i]), h = t([o, s], [n + a, n]), g = r.map((e, t) => ({
|
|
25
|
+
x: d(t),
|
|
26
|
+
y: h(e)
|
|
27
|
+
})), _ = c(g, p);
|
|
28
|
+
return {
|
|
29
|
+
line: _,
|
|
30
|
+
area: m ? `${_} L ${g[g.length - 1].x} ${n + a} L ${g[0].x} ${n + a} Z` : "",
|
|
31
|
+
last: g[g.length - 1]
|
|
32
|
+
};
|
|
33
|
+
}, [
|
|
34
|
+
r,
|
|
35
|
+
l,
|
|
36
|
+
u,
|
|
37
|
+
f,
|
|
38
|
+
p,
|
|
39
|
+
m
|
|
40
|
+
]);
|
|
41
|
+
return /* @__PURE__ */ s("svg", {
|
|
42
|
+
ref: y,
|
|
43
|
+
className: a(n.sparkline, _),
|
|
44
|
+
style: v,
|
|
45
|
+
width: l,
|
|
46
|
+
height: u,
|
|
47
|
+
viewBox: `0 0 ${l} ${u}`,
|
|
48
|
+
role: "img",
|
|
49
|
+
"aria-label": g,
|
|
50
|
+
children: [
|
|
51
|
+
m && x && /* @__PURE__ */ o("path", {
|
|
52
|
+
d: x,
|
|
53
|
+
fill: d,
|
|
54
|
+
opacity: .18
|
|
55
|
+
}),
|
|
56
|
+
b && /* @__PURE__ */ o("path", {
|
|
57
|
+
d: b,
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: d,
|
|
60
|
+
strokeWidth: f,
|
|
61
|
+
strokeLinejoin: "round",
|
|
62
|
+
strokeLinecap: "round"
|
|
63
|
+
}),
|
|
64
|
+
h && S && /* @__PURE__ */ o("circle", {
|
|
65
|
+
cx: S.x,
|
|
66
|
+
cy: S.y,
|
|
67
|
+
r: f + 1,
|
|
68
|
+
fill: d
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
l.displayName = "Sparkline";
|
|
74
|
+
export { l as Sparkline };
|
|
@@ -107,7 +107,7 @@ export interface TradingChartProps {
|
|
|
107
107
|
* ]}
|
|
108
108
|
* />
|
|
109
109
|
*/
|
|
110
|
-
export declare function TradingChart({ datafeed, symbol, resolution, period, seriesType, indicators, precision, initialLookback, height, upColor, downColor, lineColor, timezone, defaultTimezone, onTimezoneChange, showConfigPanel, priceBadgeColorByDirection, priceBadgeShowTime, priceBadgeTimeFormat, onCrosshair, onVisibleRangeChange, className, style, }: TradingChartProps): import("react
|
|
110
|
+
export declare function TradingChart({ datafeed, symbol, resolution, period, seriesType, indicators, precision, initialLookback, height, upColor, downColor, lineColor, timezone, defaultTimezone, onTimezoneChange, showConfigPanel, priceBadgeColorByDirection, priceBadgeShowTime, priceBadgeTimeFormat, onCrosshair, onVisibleRangeChange, className, style, }: TradingChartProps): import("react").JSX.Element;
|
|
111
111
|
/**
|
|
112
112
|
* Full crosshair date/time label with a timezone tag.
|
|
113
113
|
* Format: `YYYY-MM-DD HH:MM:SS <tz>` — `<tz>` is `+HH:MM` for local,
|