@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,252 +1,273 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
import e from "./DateTimePicker.module.js";
|
|
2
|
+
import { getWallClock as t } from "./timeZoneUtils.js";
|
|
3
|
+
import { forwardRef as n, useCallback as r, useEffect as i, useImperativeHandle as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
4
|
+
import l from "clsx";
|
|
5
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
|
+
// src/components/inputs/DateTimePicker/DateTimeSegments.tsx
|
|
7
|
+
var p = /* @__PURE__ */ new Set([
|
|
8
|
+
"year",
|
|
9
|
+
"month",
|
|
10
|
+
"day",
|
|
11
|
+
"hour",
|
|
12
|
+
"minute",
|
|
13
|
+
"second",
|
|
14
|
+
"dayPeriod"
|
|
15
|
+
]), m = {
|
|
16
|
+
year: "YYYY",
|
|
17
|
+
month: "MM",
|
|
18
|
+
day: "DD",
|
|
19
|
+
hour: "HH",
|
|
20
|
+
minute: "mm",
|
|
21
|
+
second: "ss",
|
|
22
|
+
dayPeriod: "AM"
|
|
23
|
+
}, h = {
|
|
24
|
+
year: "Year",
|
|
25
|
+
month: "Month",
|
|
26
|
+
day: "Day",
|
|
27
|
+
hour: "Hour",
|
|
28
|
+
minute: "Minute",
|
|
29
|
+
second: "Second",
|
|
30
|
+
dayPeriod: "AM/PM"
|
|
31
|
+
}, g = (e, t) => new Date(e, t + 1, 0).getDate(), _ = (e, t, n) => {
|
|
32
|
+
let r = n - t + 1;
|
|
33
|
+
return ((e - t) % r + r) % r + t;
|
|
34
|
+
}, v = n(({ value: n, timeZone: v, locale: y, layout: b, hourCycle: x, showSeconds: S, onChange: C, onClear: w, onOpenRequest: T, onEscape: E, suffix: D, suffixTitle: O, suffixClassName: k, disabled: A = !1, classes: j, className: M, "aria-label": N, "aria-describedby": P, "aria-invalid": F }, I) => {
|
|
35
|
+
let L = s(null), [R, z] = c(0), [B, V] = c(""), H = s(!1), U = o(() => new Intl.DateTimeFormat(y, {
|
|
36
|
+
year: "numeric",
|
|
37
|
+
month: "2-digit",
|
|
38
|
+
day: "2-digit",
|
|
39
|
+
hour: "2-digit",
|
|
40
|
+
minute: "2-digit",
|
|
41
|
+
second: S ? "2-digit" : void 0,
|
|
42
|
+
hourCycle: x === 12 ? "h12" : "h23",
|
|
43
|
+
timeZone: v
|
|
44
|
+
}), [
|
|
45
|
+
y,
|
|
46
|
+
S,
|
|
47
|
+
x,
|
|
48
|
+
v
|
|
49
|
+
]), W = o(() => n ? t(n, v) : null, [n, v]), G = o(() => {
|
|
50
|
+
if (b === "locale") return U.formatToParts(n ?? new Date(2001, 11, 21, 15, 45, 30)).filter((e) => p.has(e.type) || e.type === "literal").map((e) => ({
|
|
51
|
+
type: e.type,
|
|
52
|
+
text: e.value
|
|
53
|
+
}));
|
|
54
|
+
let e = (e, t = 2) => String(e).padStart(t, "0"), t = W ?? {
|
|
55
|
+
year: 0,
|
|
56
|
+
month: 0,
|
|
57
|
+
day: 0,
|
|
58
|
+
hour: 0,
|
|
59
|
+
minute: 0,
|
|
60
|
+
second: 0
|
|
61
|
+
}, r = x === 12 ? t.hour % 12 || 12 : t.hour, i = [
|
|
62
|
+
{
|
|
63
|
+
type: "year",
|
|
64
|
+
text: e(t.year, 4)
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: "literal",
|
|
68
|
+
text: "-"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "month",
|
|
72
|
+
text: e(t.month + 1)
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "literal",
|
|
76
|
+
text: "-"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "day",
|
|
80
|
+
text: e(t.day)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: "literal",
|
|
84
|
+
text: " "
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: "hour",
|
|
88
|
+
text: e(r)
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "literal",
|
|
92
|
+
text: ":"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "minute",
|
|
96
|
+
text: e(t.minute)
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
return S && i.push({
|
|
100
|
+
type: "literal",
|
|
101
|
+
text: ":"
|
|
102
|
+
}, {
|
|
103
|
+
type: "second",
|
|
104
|
+
text: e(t.second)
|
|
105
|
+
}), x === 12 && i.push({
|
|
106
|
+
type: "literal",
|
|
107
|
+
text: " "
|
|
108
|
+
}, {
|
|
109
|
+
type: "dayPeriod",
|
|
110
|
+
text: t.hour >= 12 ? "PM" : "AM"
|
|
111
|
+
}), i;
|
|
112
|
+
}, [
|
|
113
|
+
b,
|
|
114
|
+
U,
|
|
115
|
+
n,
|
|
116
|
+
W,
|
|
117
|
+
x,
|
|
118
|
+
S
|
|
119
|
+
]), K = o(() => G.map((e, t) => e.type === "literal" ? -1 : t).filter((e) => e >= 0), [G]), q = r(() => W ? { ...W } : {
|
|
120
|
+
...t(/* @__PURE__ */ new Date(), v),
|
|
121
|
+
second: 0
|
|
122
|
+
}, [W, v]);
|
|
123
|
+
a(I, () => ({ focus: () => {
|
|
124
|
+
L.current?.querySelector("[role=\"spinbutton\"][tabindex=\"0\"]")?.focus();
|
|
125
|
+
} }), []), i(() => {
|
|
126
|
+
H.current && (H.current = !1, L.current?.querySelector(`[data-segment="${R}"]`)?.focus());
|
|
127
|
+
}, [R]);
|
|
128
|
+
let J = (e) => {
|
|
129
|
+
let t = K.indexOf(e), n = K[Math.max(0, Math.min(K.length - 1, t))];
|
|
130
|
+
V(""), H.current = !0, z(n);
|
|
131
|
+
}, Y = (e) => {
|
|
132
|
+
let t = K.indexOf(R), n = K[Math.max(0, Math.min(K.length - 1, t + e))];
|
|
133
|
+
n !== R && J(n);
|
|
134
|
+
}, X = (e, t, n) => {
|
|
135
|
+
switch (e) {
|
|
136
|
+
case "year":
|
|
137
|
+
t.year = Math.max(1, Math.min(9999, n));
|
|
138
|
+
break;
|
|
139
|
+
case "month":
|
|
140
|
+
t.month = _(n, 0, 11);
|
|
141
|
+
break;
|
|
142
|
+
case "day":
|
|
143
|
+
t.day = _(n, 1, g(t.year, t.month));
|
|
144
|
+
break;
|
|
145
|
+
case "hour":
|
|
146
|
+
t.hour = _(n, 0, 23);
|
|
147
|
+
break;
|
|
148
|
+
case "minute":
|
|
149
|
+
t.minute = _(n, 0, 59);
|
|
150
|
+
break;
|
|
151
|
+
case "second":
|
|
152
|
+
t.second = _(n, 0, 59);
|
|
153
|
+
break;
|
|
154
|
+
case "dayPeriod": t.hour = n >= 12 ? t.hour % 12 + 12 : t.hour % 12;
|
|
155
|
+
}
|
|
156
|
+
return t.day = Math.min(t.day, g(t.year, t.month)), t;
|
|
157
|
+
}, Z = (e, t) => {
|
|
158
|
+
switch (e) {
|
|
159
|
+
case "year": return t.year;
|
|
160
|
+
case "month": return t.month;
|
|
161
|
+
case "day": return t.day;
|
|
162
|
+
case "hour": return t.hour;
|
|
163
|
+
case "minute": return t.minute;
|
|
164
|
+
case "second": return t.second;
|
|
165
|
+
case "dayPeriod": return t.hour >= 12 ? 12 : 0;
|
|
166
|
+
}
|
|
167
|
+
}, Q = (e, t) => {
|
|
168
|
+
let n = q();
|
|
169
|
+
if (!W) {
|
|
170
|
+
C(n);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let r = e === "dayPeriod" ? n.hour >= 12 ? 0 : 12 : Z(e, n) + t;
|
|
174
|
+
C(X(e, n, r));
|
|
175
|
+
}, $ = (e, t) => {
|
|
176
|
+
let n = x === 12, r = {
|
|
177
|
+
year: 9999,
|
|
178
|
+
month: 12,
|
|
179
|
+
day: 31,
|
|
180
|
+
hour: n ? 12 : 23,
|
|
181
|
+
minute: 59,
|
|
182
|
+
second: 59,
|
|
183
|
+
dayPeriod: 0
|
|
184
|
+
}[e], i = e === "year" ? 4 : 2, a = B + t;
|
|
185
|
+
Number(a) > r && (a = t);
|
|
186
|
+
let o = Number(a), s = a.length === i || o * 10 > r, c = q();
|
|
187
|
+
if (e === "year") s && C(X(e, c, o));
|
|
188
|
+
else if (o > 0 || e === "hour" || e === "minute" || e === "second") {
|
|
189
|
+
let t = o;
|
|
190
|
+
e === "month" && (t = o - 1), e === "hour" && n && (t = o % 12 + (c.hour >= 12 ? 12 : 0)), C(X(e, c, t));
|
|
191
|
+
}
|
|
192
|
+
s ? (V(""), Y(1)) : V(a);
|
|
193
|
+
}, ee = (e, t) => {
|
|
194
|
+
if (!A) {
|
|
195
|
+
if (e.altKey && e.key === "ArrowDown") e.preventDefault(), T();
|
|
196
|
+
else {
|
|
197
|
+
switch (e.key) {
|
|
198
|
+
case "ArrowUp":
|
|
199
|
+
e.preventDefault(), V(""), Q(t, 1);
|
|
200
|
+
return;
|
|
201
|
+
case "ArrowDown":
|
|
202
|
+
e.preventDefault(), V(""), Q(t, -1);
|
|
203
|
+
return;
|
|
204
|
+
case "ArrowLeft":
|
|
205
|
+
e.preventDefault(), Y(-1);
|
|
206
|
+
return;
|
|
207
|
+
case "ArrowRight":
|
|
208
|
+
e.preventDefault(), Y(1);
|
|
209
|
+
return;
|
|
210
|
+
case "Home":
|
|
211
|
+
e.preventDefault(), J(K[0]);
|
|
212
|
+
return;
|
|
213
|
+
case "End":
|
|
214
|
+
e.preventDefault(), J(K[K.length - 1]);
|
|
215
|
+
return;
|
|
216
|
+
case "Backspace":
|
|
217
|
+
case "Delete":
|
|
218
|
+
e.preventDefault(), V(""), w();
|
|
219
|
+
return;
|
|
220
|
+
case "Escape":
|
|
221
|
+
E(e);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (t === "dayPeriod") {
|
|
225
|
+
let n = e.key.toLowerCase();
|
|
226
|
+
(n === "a" || n === "p") && (e.preventDefault(), C(X(t, q(), n === "p" ? 12 : 0)));
|
|
227
|
+
} else /^\d$/.test(e.key) && (e.preventDefault(), $(t, e.key));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
return /* @__PURE__ */ f("div", {
|
|
232
|
+
ref: L,
|
|
233
|
+
role: "group",
|
|
234
|
+
"aria-label": N,
|
|
235
|
+
"aria-describedby": P,
|
|
236
|
+
"aria-invalid": F || void 0,
|
|
237
|
+
"aria-disabled": A || void 0,
|
|
238
|
+
className: l(e.segments, j?.segments, M),
|
|
239
|
+
onMouseDown: (e) => {
|
|
240
|
+
A || e.target.closest("[role=\"spinbutton\"]") || (e.preventDefault(), L.current?.querySelector(`[data-segment="${R}"]`)?.focus());
|
|
241
|
+
},
|
|
242
|
+
children: [G.map((t, n) => {
|
|
243
|
+
if (t.type === "literal") return /* @__PURE__ */ d("span", {
|
|
244
|
+
className: e.literal,
|
|
245
|
+
"aria-hidden": "true",
|
|
246
|
+
children: t.text
|
|
247
|
+
}, n);
|
|
248
|
+
let r = t.type, i = n === R, a = i && B !== "", o = !W && !a, s = a ? B : o ? m[r] : t.text, c = W ? Z(r, W) + +(r === "month") : void 0;
|
|
249
|
+
return /* @__PURE__ */ d("span", {
|
|
250
|
+
role: "spinbutton",
|
|
251
|
+
tabIndex: A ? -1 : i ? 0 : -1,
|
|
252
|
+
"data-segment": n,
|
|
253
|
+
"aria-label": h[r],
|
|
254
|
+
"aria-valuenow": c,
|
|
255
|
+
"aria-valuetext": o ? "Empty" : r === "dayPeriod" ? t.text : void 0,
|
|
256
|
+
"aria-disabled": A || void 0,
|
|
257
|
+
className: l(e.segment, o && e.segmentEmpty, j?.segment),
|
|
258
|
+
onFocus: () => {
|
|
259
|
+
V(""), z(n);
|
|
260
|
+
},
|
|
261
|
+
onBlur: () => V(""),
|
|
262
|
+
onKeyDown: (e) => ee(e, r),
|
|
263
|
+
children: s
|
|
264
|
+
}, n);
|
|
265
|
+
}), D && /* @__PURE__ */ f(u, { children: [" ", /* @__PURE__ */ d("span", {
|
|
266
|
+
className: l(e.suffix, k),
|
|
267
|
+
title: O,
|
|
268
|
+
children: D
|
|
269
|
+
})] })]
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
v.displayName = "DateTimeSegments";
|
|
273
|
+
export { v as DateTimeSegments };
|
|
@@ -15,4 +15,4 @@ export interface TimeFieldProps extends TimeParts {
|
|
|
15
15
|
classes?: Partial<TimeFieldClasses>;
|
|
16
16
|
}
|
|
17
17
|
/** Internal hours / minutes (/ seconds) (/ AM-PM) columns used by `DateTimePicker`. */
|
|
18
|
-
export declare function TimeField({ hour, minute, second, onChange, hourCycle, showSeconds, minuteStep, disabled, classes, }: TimeFieldProps): import("react
|
|
18
|
+
export declare function TimeField({ hour, minute, second, onChange, hourCycle, showSeconds, minuteStep, disabled, classes, }: TimeFieldProps): import("react").JSX.Element;
|