@overdoser/react-toolkit 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +14 -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 +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.js +42 -0
- 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.js +122 -98
- 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 -94
- package/hooks/usePortalPosition.js +25 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +97 -215
- package/index.layered.css +2 -3
- package/llms.txt +3 -0
- package/manifest.json +8 -0
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- 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,318 +1,357 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
1
|
+
import e from "./Timeline.module.js";
|
|
2
|
+
import t from "./GanttTimeline.module.js";
|
|
3
|
+
import { TIMELINE_PALETTE_VARS as n, eventMatches as r, fmtDate as i, fmtDateTime as a, fmtDur as o, ticks as s, tint as ee } from "./timelineCore.js";
|
|
4
|
+
import { HighlightText as te, TimelineSummary as c, TimelineTooltip as l, TimelineZoomControls as u } from "./TimelineShared.js";
|
|
5
|
+
import { animateScrollTo as d, useContainerWidth as ne, useNowTicker as f, useTimelinePan as p, useWheelZoom as m, wheelZoomAllowed as h } from "./useTimeline.js";
|
|
6
|
+
import { forwardRef as g, useCallback as _, useEffect as re, useLayoutEffect as ie, useMemo as ae, useRef as v, useState as y } from "react";
|
|
7
|
+
import b from "clsx";
|
|
8
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
9
|
+
// src/components/Timeline/GanttTimeline.tsx
|
|
10
|
+
var w = 230, oe = 24, T = 400, se = 26, ce = g(function(g, ce) {
|
|
11
|
+
let { tasks: le, title: ue, meta: de, highlight: E, defaultHighlight: fe, onHighlightChange: pe, showSearch: me = !0, renderSearch: he, compactRows: ge = !1, showGridlines: _e = !0, showControls: ve = !0, wheelZoom: D = "ctrl", showSummary: O = !1, summaryPlacement: k = "left", summaryDefaultPosition: ye, maxHeight: be = "74vh", selectedTaskId: A, defaultSelectedTaskId: xe = null, onTaskSelect: Se, renderRowLabel: Ce, renderBar: j, renderTooltip: M, renderDetails: N, classes: P, className: we, style: Te } = g, F = v(null), [Ee, De] = y(null), [Oe, ke] = y(!0), [I, L] = y(null), [Ae, je] = y(xe), R = A === void 0 ? Ae : A, [z, Me] = y({
|
|
12
|
+
l: 0,
|
|
13
|
+
t: 0,
|
|
14
|
+
w: 0,
|
|
15
|
+
h: 0
|
|
16
|
+
}), Ne = v(O);
|
|
17
|
+
Ne.current = O;
|
|
18
|
+
let Pe = v(null), B = _(() => {
|
|
19
|
+
let e = F.current;
|
|
20
|
+
e && Me((t) => t.l === e.scrollLeft && t.t === e.scrollTop && t.w === e.clientWidth && t.h === e.clientHeight ? t : {
|
|
21
|
+
l: e.scrollLeft,
|
|
22
|
+
t: e.scrollTop,
|
|
23
|
+
w: e.clientWidth,
|
|
24
|
+
h: e.clientHeight
|
|
25
|
+
});
|
|
26
|
+
}, []), [V, Fe] = y({
|
|
27
|
+
l: 0,
|
|
28
|
+
w: 2e3
|
|
29
|
+
}), Ie = v(V);
|
|
30
|
+
Ie.current = V;
|
|
31
|
+
let Le = _(() => {
|
|
32
|
+
let e = F.current;
|
|
33
|
+
if (!e) return;
|
|
34
|
+
let t = Math.floor(e.scrollLeft / T) * T, n = (Math.ceil((e.clientWidth || 1600) / T) + 1) * T;
|
|
35
|
+
(t !== Ie.current.l || n !== Ie.current.w) && Fe({
|
|
36
|
+
l: t,
|
|
37
|
+
w: n
|
|
38
|
+
});
|
|
39
|
+
}, []), Re = _(() => {
|
|
40
|
+
Pe.current ??= requestAnimationFrame(() => {
|
|
41
|
+
Pe.current = null, Le(), Ne.current && B();
|
|
42
|
+
});
|
|
43
|
+
}, [B, Le]);
|
|
44
|
+
re(() => {
|
|
45
|
+
O && B();
|
|
46
|
+
});
|
|
47
|
+
let ze = le.some((e) => e.end == null), H = f(ze, 400), Be = ne(F), U = p(F), [Ve, He] = y(fe ?? ""), Ue = E === void 0 ? Ve : E, W = Ue.trim(), We = (e) => {
|
|
48
|
+
E === void 0 && He(e), pe?.(e);
|
|
49
|
+
}, Ge = he ? he({
|
|
50
|
+
value: Ue,
|
|
51
|
+
setValue: We
|
|
52
|
+
}) : me ? /* @__PURE__ */ S("input", {
|
|
53
|
+
className: b(e.searchInput, P?.search),
|
|
54
|
+
placeholder: "Highlight keyword in tasks…",
|
|
55
|
+
"aria-label": "Highlight keyword",
|
|
56
|
+
value: Ue,
|
|
57
|
+
onChange: (e) => We(e.target.value)
|
|
58
|
+
}) : null, G = ae(() => le.slice().sort((e, t) => e.start - t.start), [le]), K = G.length ? Math.min(...G.map((e) => e.start)) : H - 1, Ke = G.length ? Math.max(K + 1, ...G.map((e) => e.end == null ? H : e.end)) : H, qe = (Ke - K) * .03;
|
|
59
|
+
K -= qe, Ke += qe;
|
|
60
|
+
let Je = Ke - K, q = Math.max(240, Be - w - oe) / Je, J = Oe || !Ee ? q : Ee, Ye = v(q), Xe = v(J);
|
|
61
|
+
Ye.current = q, Xe.current = J;
|
|
62
|
+
let Y = v(null);
|
|
63
|
+
ie(() => {
|
|
64
|
+
Y.current != null && F.current && (F.current.scrollLeft = Y.current, Y.current = null), Le();
|
|
65
|
+
});
|
|
66
|
+
let Ze = _((e, t) => {
|
|
67
|
+
let n = F.current;
|
|
68
|
+
if (!n) return;
|
|
69
|
+
let r = Xe.current || 1e-4, i = Math.max(Ye.current ? Ye.current * .2 : 1e-9, Math.min(1, r * e)), a = (n.scrollLeft + t - w) / r;
|
|
70
|
+
Y.current = a * i + w - t, ke(!1), De(i);
|
|
71
|
+
}, []);
|
|
72
|
+
m(F, (e) => {
|
|
73
|
+
if (!h(D, e)) return;
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
let t = F.current;
|
|
76
|
+
t && Ze(Math.exp(-e.deltaY * .0018), e.clientX - t.getBoundingClientRect().left);
|
|
77
|
+
});
|
|
78
|
+
let X = (e) => {
|
|
79
|
+
A === void 0 && je(e ? e.id : null), Se?.(e);
|
|
80
|
+
}, Qe = (e) => {
|
|
81
|
+
let t = window.innerWidth || 1200, n = window.innerHeight || 800;
|
|
82
|
+
return {
|
|
83
|
+
x: e.clientX < t * .55 ? Math.max(12, t - 340) : 16,
|
|
84
|
+
y: Math.max(130, Math.min(e.clientY, n - 130))
|
|
85
|
+
};
|
|
86
|
+
}, Z = ge ? 42 : 54, Q = R == null ? null : G.find((e) => e.id === R) || null, $e = Math.ceil(w + Je * J + oe + 90), et = K + ($e - w) / J, tt = Math.max(K, K + (V.l - T - w) / J), nt = Math.min(et, K + (V.l + V.w + T - w) / J), rt = s(tt, nt, Math.max(1, (nt - tt) * J)).list.map((e) => ({
|
|
87
|
+
left: Math.round(w + (e.t - K) * J),
|
|
88
|
+
label: e.label
|
|
89
|
+
})), it = G.filter((e) => e.end == null).length, $ = O ? /* @__PURE__ */ S(c, {
|
|
90
|
+
heading: "Tasks",
|
|
91
|
+
className: P?.summary,
|
|
92
|
+
placement: k,
|
|
93
|
+
floatingDefaultPosition: ye,
|
|
94
|
+
bubbleGlyphColors: n.slice(0, 3),
|
|
95
|
+
items: G.map((e, t) => {
|
|
96
|
+
let r = e.end == null ? H : e.end, a = Math.round(w + (e.start - K) * J), o = Math.max(14, Math.round(Math.max(0, r - e.start) * J)), s = 34 + t * Z, ee = !z.w || a < z.l + z.w && a + o > z.l, te = !z.h || s < z.t + z.h && s + Z > z.t;
|
|
97
|
+
return {
|
|
98
|
+
id: e.id,
|
|
99
|
+
number: String(t + 1).padStart(2, "0"),
|
|
100
|
+
label: e.name,
|
|
101
|
+
color: n[t % n.length],
|
|
102
|
+
time: i(e.start),
|
|
103
|
+
inView: ee && te,
|
|
104
|
+
selected: R === e.id
|
|
105
|
+
};
|
|
106
|
+
}),
|
|
107
|
+
onPick: (e) => {
|
|
108
|
+
let t = G.findIndex((t) => t.id === e), n = F.current;
|
|
109
|
+
if (t < 0 || !n) return;
|
|
110
|
+
let r = G[t], i = r.end == null ? H : r.end, a = Math.round(w + (r.start - K) * J), o = Math.max(14, Math.round(Math.max(0, i - r.start) * J)), s = { left: Math.max(0, a + o / 2 - n.clientWidth / 2) };
|
|
111
|
+
n.clientHeight && (s.top = Math.max(0, 34 + t * Z + Z / 2 - n.clientHeight / 2)), d(n, s);
|
|
112
|
+
}
|
|
113
|
+
}) : null;
|
|
114
|
+
return /* @__PURE__ */ C("div", {
|
|
115
|
+
ref: ce,
|
|
116
|
+
className: b(e.root, P?.root, we),
|
|
117
|
+
style: Te,
|
|
118
|
+
children: [
|
|
119
|
+
(ve || Ge || ue != null || de != null) && /* @__PURE__ */ C("div", {
|
|
120
|
+
className: b(e.toolbar, P?.toolbar),
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ C("div", {
|
|
123
|
+
className: e.toolbarText,
|
|
124
|
+
children: [ue != null && /* @__PURE__ */ S("span", {
|
|
125
|
+
className: e.toolbarTitle,
|
|
126
|
+
children: ue
|
|
127
|
+
}), /* @__PURE__ */ S("span", {
|
|
128
|
+
className: e.toolbarMeta,
|
|
129
|
+
children: de ?? (G.length ? `${G.length} tasks · ${o(Je - 2 * qe)} · ${it} running` : "No tasks")
|
|
130
|
+
})]
|
|
131
|
+
}),
|
|
132
|
+
Ge,
|
|
133
|
+
ve && /* @__PURE__ */ S(u, {
|
|
134
|
+
zoomPct: `${Math.round(J / q * 100)}%`,
|
|
135
|
+
fitActive: Oe,
|
|
136
|
+
onZoomIn: () => Ze(1.5, Be / 2),
|
|
137
|
+
onZoomOut: () => Ze(1 / 1.5, Be / 2),
|
|
138
|
+
onFit: () => {
|
|
139
|
+
ke(!0), De(null);
|
|
140
|
+
},
|
|
141
|
+
hint: D === "none" ? "drag pans" : (D === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
k === "top" && $,
|
|
146
|
+
/* @__PURE__ */ C("div", {
|
|
147
|
+
className: e.layout,
|
|
148
|
+
children: [
|
|
149
|
+
k === "left" && $,
|
|
150
|
+
/* @__PURE__ */ C("div", {
|
|
151
|
+
className: e.main,
|
|
152
|
+
children: [/* @__PURE__ */ C("div", {
|
|
153
|
+
className: e.cardWrap,
|
|
154
|
+
children: [/* @__PURE__ */ S("div", {
|
|
155
|
+
className: b(e.card, P?.card),
|
|
156
|
+
children: /* @__PURE__ */ S("div", {
|
|
157
|
+
ref: F,
|
|
158
|
+
className: b(e.scroller, t.scroller, P?.scroller),
|
|
159
|
+
style: { maxHeight: be },
|
|
160
|
+
onPointerDown: U.onPointerDown,
|
|
161
|
+
onPointerMove: U.onPointerMove,
|
|
162
|
+
onPointerUp: U.onPointerUp,
|
|
163
|
+
onPointerLeave: U.onPointerUp,
|
|
164
|
+
onScroll: Re,
|
|
165
|
+
children: /* @__PURE__ */ C("div", {
|
|
166
|
+
className: t.inner,
|
|
167
|
+
style: { width: $e },
|
|
168
|
+
children: [
|
|
169
|
+
_e && rt.map((e, n) => /* @__PURE__ */ S("div", {
|
|
170
|
+
className: t.gridline,
|
|
171
|
+
style: { left: e.left }
|
|
172
|
+
}, n)),
|
|
173
|
+
ze && /* @__PURE__ */ S("div", {
|
|
174
|
+
className: t.nowLine,
|
|
175
|
+
style: { left: Math.round(w + (H - K) * J) }
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ S("div", {
|
|
178
|
+
className: b(t.axis, P?.axis),
|
|
179
|
+
children: rt.map((e, n) => /* @__PURE__ */ S("div", {
|
|
180
|
+
className: t.axisLabel,
|
|
181
|
+
style: { left: e.left },
|
|
182
|
+
children: e.label
|
|
183
|
+
}, n))
|
|
184
|
+
}),
|
|
185
|
+
G.map((s, c) => {
|
|
186
|
+
let l = s.end == null, u = l ? H : s.end, d = Math.max(0, u - s.start), ne = r(s, W), f = n[c % n.length], p = Math.round(w + (s.start - K) * J), m = Math.max(14, Math.round(d * J)), h = o(d) + (l ? " · running" : ""), g = m > 130, _ = {
|
|
187
|
+
index: c,
|
|
188
|
+
color: f,
|
|
189
|
+
running: l,
|
|
190
|
+
durationMs: d
|
|
191
|
+
};
|
|
192
|
+
return /* @__PURE__ */ C("div", {
|
|
193
|
+
className: b(t.row, P?.row),
|
|
194
|
+
style: {
|
|
195
|
+
height: Z,
|
|
196
|
+
opacity: W && !ne ? .3 : 1
|
|
197
|
+
},
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ S("div", {
|
|
200
|
+
className: b(t.rowLabel, P?.rowLabel),
|
|
201
|
+
children: Ce ? Ce(s, _) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("span", {
|
|
202
|
+
className: t.rowName,
|
|
203
|
+
children: /* @__PURE__ */ S(te, {
|
|
204
|
+
text: s.name,
|
|
205
|
+
query: W
|
|
206
|
+
})
|
|
207
|
+
}), /* @__PURE__ */ S("span", {
|
|
208
|
+
className: t.rowDates,
|
|
209
|
+
children: i(s.start) + (l ? " → now" : " → " + i(u))
|
|
210
|
+
})] })
|
|
211
|
+
}),
|
|
212
|
+
/* @__PURE__ */ S("div", {
|
|
213
|
+
className: b(t.bar, l && t.barRunning, P?.bar),
|
|
214
|
+
style: {
|
|
215
|
+
left: p,
|
|
216
|
+
top: Math.round((Z - se) / 2),
|
|
217
|
+
width: m,
|
|
218
|
+
borderColor: f,
|
|
219
|
+
background: l ? ee(f, 72) : f,
|
|
220
|
+
boxShadow: W && ne ? "0 0 0 3px var(--crk-timeline-hl-ring, #f3d98b)" : "none"
|
|
221
|
+
},
|
|
222
|
+
onClick: () => {
|
|
223
|
+
U.wasDragSuppressed() || (L(null), X(R === s.id ? null : s));
|
|
224
|
+
},
|
|
225
|
+
onMouseEnter: (e) => {
|
|
226
|
+
if (R === s.id) return;
|
|
227
|
+
let t = Qe(e);
|
|
228
|
+
L({
|
|
229
|
+
...t,
|
|
230
|
+
id: s.id,
|
|
231
|
+
title: s.name,
|
|
232
|
+
time: a(s.start) + (l ? "" : " → " + a(u)),
|
|
233
|
+
durLine: (l ? "running · " : "took ") + o(d) + (s.owner ? " · " + s.owner : ""),
|
|
234
|
+
detail: s.detail || ""
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
onMouseLeave: () => L(null),
|
|
238
|
+
children: j ? j(s, _) : /* @__PURE__ */ C(x, { children: [l && /* @__PURE__ */ S("span", { className: b(e.pulseDot, t.barDot) }), g && /* @__PURE__ */ S("span", {
|
|
239
|
+
className: t.barTextInside,
|
|
240
|
+
children: h
|
|
241
|
+
})] })
|
|
242
|
+
}),
|
|
243
|
+
!j && !g && /* @__PURE__ */ S("div", {
|
|
244
|
+
className: t.barTextOutside,
|
|
245
|
+
style: { left: p + m + 10 },
|
|
246
|
+
children: h
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
}, s.id);
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
}), k === "bubble" && $]
|
|
255
|
+
}), /* @__PURE__ */ S("div", {
|
|
256
|
+
className: b(e.footnote, P?.footnote),
|
|
257
|
+
children: "Click a bar to open details in the side panel · dashed bars are still running and keep growing"
|
|
258
|
+
})]
|
|
259
|
+
}),
|
|
260
|
+
Q && N && /* @__PURE__ */ S("aside", {
|
|
261
|
+
className: b(e.aside, t.drawer, P?.drawer),
|
|
262
|
+
children: N(Q, {
|
|
263
|
+
close: () => X(null),
|
|
264
|
+
running: Q.end == null
|
|
265
|
+
})
|
|
266
|
+
}),
|
|
267
|
+
Q && !N && /* @__PURE__ */ C("aside", {
|
|
268
|
+
className: b(e.aside, t.drawer, P?.drawer),
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ C("div", {
|
|
271
|
+
className: t.drawerHead,
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ S("span", {
|
|
274
|
+
className: t.drawerSwatch,
|
|
275
|
+
style: { background: n[G.indexOf(Q) % n.length] }
|
|
276
|
+
}),
|
|
277
|
+
/* @__PURE__ */ S("span", {
|
|
278
|
+
className: t.drawerOwner,
|
|
279
|
+
children: Q.owner || "—"
|
|
280
|
+
}),
|
|
281
|
+
/* @__PURE__ */ S("span", {
|
|
282
|
+
className: b(t.drawerState, Q.end == null && t.drawerStateRunning),
|
|
283
|
+
children: Q.end == null ? "running" : "done"
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ S("div", { className: t.drawerSpacer }),
|
|
286
|
+
/* @__PURE__ */ S("button", {
|
|
287
|
+
type: "button",
|
|
288
|
+
className: e.asideClose,
|
|
289
|
+
"aria-label": "Close details",
|
|
290
|
+
onClick: () => X(null),
|
|
291
|
+
children: "✕"
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ S("div", {
|
|
296
|
+
className: t.drawerName,
|
|
297
|
+
children: Q.name
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ S("div", {
|
|
300
|
+
className: t.drawerTiming,
|
|
301
|
+
children: a(Q.start) + " → " + (Q.end == null ? "now" : a(Q.end)) + " · " + o((Q.end == null ? H : Q.end) - Q.start)
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ S("div", {
|
|
304
|
+
className: t.drawerDetail,
|
|
305
|
+
children: Q.detail || "—"
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ S("div", {
|
|
308
|
+
className: e.asideSection,
|
|
309
|
+
children: "Raw event"
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ S("pre", {
|
|
312
|
+
className: e.asideRaw,
|
|
313
|
+
children: JSON.stringify(Q, null, 2)
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
317
|
+
(k === "right" || k === "floating") && $
|
|
318
|
+
]
|
|
319
|
+
}),
|
|
320
|
+
k === "bottom" && $,
|
|
321
|
+
I && (() => {
|
|
322
|
+
let t = G.find((e) => e.id === I.id), r = t && M ? M(t, {
|
|
323
|
+
index: G.indexOf(t),
|
|
324
|
+
color: n[G.indexOf(t) % n.length],
|
|
325
|
+
running: t.end == null,
|
|
326
|
+
durationMs: (t.end == null ? H : t.end) - t.start
|
|
327
|
+
}) : void 0;
|
|
328
|
+
return M && r == null ? null : /* @__PURE__ */ S(l, {
|
|
329
|
+
x: I.x,
|
|
330
|
+
y: I.y,
|
|
331
|
+
className: P?.tooltip,
|
|
332
|
+
children: r === void 0 ? /* @__PURE__ */ C(x, { children: [
|
|
333
|
+
/* @__PURE__ */ S("div", {
|
|
334
|
+
className: e.tooltipTitle,
|
|
335
|
+
children: I.title
|
|
336
|
+
}),
|
|
337
|
+
/* @__PURE__ */ S("div", {
|
|
338
|
+
className: b(e.tooltipLine, e.tooltipMono),
|
|
339
|
+
style: { marginTop: 4 },
|
|
340
|
+
children: I.time
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ S("div", {
|
|
343
|
+
className: e.tooltipLine,
|
|
344
|
+
children: I.durLine
|
|
345
|
+
}),
|
|
346
|
+
I.detail && /* @__PURE__ */ S("div", {
|
|
347
|
+
className: e.tooltipDim,
|
|
348
|
+
style: { marginTop: 5 },
|
|
349
|
+
children: I.detail
|
|
350
|
+
})
|
|
351
|
+
] }) : r
|
|
352
|
+
});
|
|
353
|
+
})()
|
|
354
|
+
]
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
export { ce as GanttTimeline };
|