@overdoser/react-toolkit 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
r as chip,
|
|
18
|
-
n as chipCheck,
|
|
19
|
-
s as chipCheckVisible,
|
|
20
|
-
k as chipChecked,
|
|
21
|
-
p as chipPill,
|
|
22
|
-
o as chipRounded,
|
|
23
|
-
l as chipSelected,
|
|
24
|
-
t as chipSquare,
|
|
25
|
-
e as chipsGroup,
|
|
26
|
-
u as default,
|
|
27
|
-
d as error,
|
|
28
|
-
c as group,
|
|
29
|
-
h as horizontal,
|
|
30
|
-
i as vertical
|
|
1
|
+
// src/components/inputs/Checkbox/CheckboxGroup.module.scss
|
|
2
|
+
var e = "crk-group-3jaV7", t = "crk-vertical--i2tD", n = "crk-horizontal-4qzrj", r = "crk-chipsGroup-jyDEd", i = "crk-chip-NYeqm", a = "crk-chipPill-DfnpS", o = "crk-chipRounded-oi-hI", s = "crk-chipSquare-ZcbQB", c = "crk-chipCheck-4nqaQ", l = "crk-chipCheckVisible-nGulJ", u = "crk-chipChecked-4h2bc", d = "crk-chipSelected-qbOpf", f = "crk-error-phPRL", p = {
|
|
3
|
+
group: e,
|
|
4
|
+
vertical: t,
|
|
5
|
+
horizontal: n,
|
|
6
|
+
chipsGroup: r,
|
|
7
|
+
chip: i,
|
|
8
|
+
chipPill: a,
|
|
9
|
+
chipRounded: o,
|
|
10
|
+
chipSquare: s,
|
|
11
|
+
chipCheck: c,
|
|
12
|
+
chipCheckVisible: l,
|
|
13
|
+
chipChecked: u,
|
|
14
|
+
chipSelected: d,
|
|
15
|
+
error: f
|
|
31
16
|
};
|
|
17
|
+
export { i as chip, c as chipCheck, l as chipCheckVisible, u as chipChecked, a as chipPill, o as chipRounded, d as chipSelected, s as chipSquare, r as chipsGroup, p as default, f as error, e as group, n as horizontal, t as vertical };
|
|
@@ -37,4 +37,4 @@ export interface CalendarPanelProps {
|
|
|
37
37
|
* `Date`s, so a parent that renders another time zone passes wall-clock
|
|
38
38
|
* proxies.
|
|
39
39
|
*/
|
|
40
|
-
export declare function CalendarPanel({ viewDate, focusedDate, selected, today, minDay, maxDay, locale, weekStartsOn, isDisabledDay, onSelect, onViewDateChange, onFocusedDateChange, onEscape, classes, }: CalendarPanelProps): import("react
|
|
40
|
+
export declare function CalendarPanel({ viewDate, focusedDate, selected, today, minDay, maxDay, locale, weekStartsOn, isDisabledDay, onSelect, onViewDateChange, onFocusedDateChange, onEscape, classes, }: CalendarPanelProps): import("react").JSX.Element;
|
|
@@ -1,287 +1,264 @@
|
|
|
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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
n && r.dayToday,
|
|
264
|
-
a && r.daySelected,
|
|
265
|
-
t && u?.dayOutside,
|
|
266
|
-
n && u?.dayToday,
|
|
267
|
-
a && u?.daySelected,
|
|
268
|
-
u?.day
|
|
269
|
-
),
|
|
270
|
-
"aria-selected": a,
|
|
271
|
-
"aria-disabled": A || void 0,
|
|
272
|
-
"aria-current": n ? "date" : void 0,
|
|
273
|
-
"aria-label": ae.format(e),
|
|
274
|
-
onClick: () => P(e),
|
|
275
|
-
children: e.getDate()
|
|
276
|
-
},
|
|
277
|
-
x(e)
|
|
278
|
-
);
|
|
279
|
-
})
|
|
280
|
-
}
|
|
281
|
-
)
|
|
282
|
-
] })
|
|
283
|
-
] });
|
|
1
|
+
import { useEffect as e, useMemo as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./CalendarPanel.module.scss.js";
|
|
4
|
+
import { addDays as o, addMonths as s, buildCalendarDays as c, isSameDay as l, isSameMonth as u, startOfMonth as d, toISODate as f, weekdayLabels as p } from "./dateUtils.js";
|
|
5
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
6
|
+
// src/components/inputs/DatePicker/CalendarPanel.tsx
|
|
7
|
+
var _ = 100, ee = 3, v = 4;
|
|
8
|
+
function y({ viewDate: y, focusedDate: b, selected: x, today: S, minDay: C, maxDay: w, locale: T, weekStartsOn: E, isDisabledDay: D, onSelect: te, onViewDateChange: O, onFocusedDateChange: k, onEscape: A, classes: j }) {
|
|
9
|
+
let M = n(null), N = n(null), [P, F] = r("day"), [I, L] = r(0), R = y.getFullYear(), z = y.getMonth(), B = t(() => new Intl.DateTimeFormat(T, {
|
|
10
|
+
month: "long",
|
|
11
|
+
year: "numeric"
|
|
12
|
+
}).format(y), [T, y]), V = t(() => new Intl.DateTimeFormat(T, { month: "long" }).format(y), [T, y]), H = t(() => new Intl.DateTimeFormat(T, { year: "numeric" }).format(y), [T, y]), U = t(() => {
|
|
13
|
+
let e = new Intl.DateTimeFormat(T, { month: "short" }), t = new Intl.DateTimeFormat(T, { month: "long" });
|
|
14
|
+
return Array.from({ length: 12 }, (n, r) => {
|
|
15
|
+
let i = new Date(2023, r, 1);
|
|
16
|
+
return {
|
|
17
|
+
short: e.format(i),
|
|
18
|
+
long: t.format(i)
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}, [T]), W = t(() => {
|
|
22
|
+
let e = C ? C.getFullYear() : R - _, t = w ? w.getFullYear() : R + _;
|
|
23
|
+
return e = Math.min(e, R), t = Math.max(t, R), Array.from({ length: t - e + 1 }, (t, n) => e + n);
|
|
24
|
+
}, [
|
|
25
|
+
C,
|
|
26
|
+
w,
|
|
27
|
+
R
|
|
28
|
+
]), ne = t(() => p(T, E), [T, E]), re = t(() => c(y, E), [y, E]), ie = t(() => new Intl.DateTimeFormat(T, { dateStyle: "full" }), [T]), G = (e) => {
|
|
29
|
+
let t = new Date(R, e, 1), n = new Date(R, e + 1, 0);
|
|
30
|
+
return !!w && t > w || !!C && n < C;
|
|
31
|
+
}, K = (e) => !!w && new Date(e, 0, 1) > w || !!C && new Date(e, 11, 31) < C;
|
|
32
|
+
e(() => {
|
|
33
|
+
if (P === "day") {
|
|
34
|
+
M.current?.querySelector(`[data-date="${f(b)}"]`)?.focus();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let e = N.current, t = e?.querySelector("[data-active]");
|
|
38
|
+
e && t && (e.scrollTop = t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2, t.focus());
|
|
39
|
+
}, [
|
|
40
|
+
P,
|
|
41
|
+
b,
|
|
42
|
+
I
|
|
43
|
+
]);
|
|
44
|
+
let ae = (e) => {
|
|
45
|
+
k(e), u(e, y) || O(d(e));
|
|
46
|
+
}, q = (e) => {
|
|
47
|
+
D(e) || te(e);
|
|
48
|
+
}, J = (e) => {
|
|
49
|
+
P === e ? F("day") : (L(e === "month" ? z : W.indexOf(R)), F(e));
|
|
50
|
+
}, Y = (e, t) => {
|
|
51
|
+
let n = new Date(e, t + 1, 0).getDate(), r = new Date(e, t, Math.min(b.getDate(), n));
|
|
52
|
+
k(r), O(d(r)), F("day");
|
|
53
|
+
}, oe = (e) => {
|
|
54
|
+
let t = null;
|
|
55
|
+
switch (e.key) {
|
|
56
|
+
case "ArrowLeft":
|
|
57
|
+
t = o(b, -1);
|
|
58
|
+
break;
|
|
59
|
+
case "ArrowRight":
|
|
60
|
+
t = o(b, 1);
|
|
61
|
+
break;
|
|
62
|
+
case "ArrowUp":
|
|
63
|
+
t = o(b, -7);
|
|
64
|
+
break;
|
|
65
|
+
case "ArrowDown":
|
|
66
|
+
t = o(b, 7);
|
|
67
|
+
break;
|
|
68
|
+
case "Home":
|
|
69
|
+
t = o(b, -((b.getDay() - E + 7) % 7));
|
|
70
|
+
break;
|
|
71
|
+
case "End":
|
|
72
|
+
t = o(b, 6 - (b.getDay() - E + 7) % 7);
|
|
73
|
+
break;
|
|
74
|
+
case "PageUp":
|
|
75
|
+
t = s(b, -1);
|
|
76
|
+
break;
|
|
77
|
+
case "PageDown":
|
|
78
|
+
t = s(b, 1);
|
|
79
|
+
break;
|
|
80
|
+
case "Enter":
|
|
81
|
+
case " ":
|
|
82
|
+
e.preventDefault(), q(b);
|
|
83
|
+
return;
|
|
84
|
+
case "Escape":
|
|
85
|
+
e.preventDefault(), A();
|
|
86
|
+
return;
|
|
87
|
+
default: return;
|
|
88
|
+
}
|
|
89
|
+
e.preventDefault(), ae(t);
|
|
90
|
+
}, X = (e, t, n) => {
|
|
91
|
+
let r = I;
|
|
92
|
+
switch (e.key) {
|
|
93
|
+
case "ArrowLeft":
|
|
94
|
+
r = I - 1;
|
|
95
|
+
break;
|
|
96
|
+
case "ArrowRight":
|
|
97
|
+
r = I + 1;
|
|
98
|
+
break;
|
|
99
|
+
case "ArrowUp":
|
|
100
|
+
r = I - n;
|
|
101
|
+
break;
|
|
102
|
+
case "ArrowDown":
|
|
103
|
+
r = I + n;
|
|
104
|
+
break;
|
|
105
|
+
case "Home":
|
|
106
|
+
r = 0;
|
|
107
|
+
break;
|
|
108
|
+
case "End":
|
|
109
|
+
r = t - 1;
|
|
110
|
+
break;
|
|
111
|
+
case "Enter":
|
|
112
|
+
case " ":
|
|
113
|
+
e.preventDefault(), P === "month" ? G(I) || Y(R, I) : K(W[I]) || Y(W[I], z);
|
|
114
|
+
return;
|
|
115
|
+
case "Escape":
|
|
116
|
+
e.preventDefault(), F("day");
|
|
117
|
+
return;
|
|
118
|
+
default: return;
|
|
119
|
+
}
|
|
120
|
+
e.preventDefault(), L(Math.max(0, Math.min(t - 1, r)));
|
|
121
|
+
}, Z = P === "year", Q = P === "day" ? "month" : "year", $ = (e) => O(P === "day" ? s(y, e) : new Date(R + e, z, 1));
|
|
122
|
+
return /* @__PURE__ */ g(m, { children: [
|
|
123
|
+
/* @__PURE__ */ g("div", {
|
|
124
|
+
className: i(a.header, j?.header),
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ h("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
className: i(a.nav, Z && a.navHidden, j?.nav),
|
|
129
|
+
onClick: () => $(-1),
|
|
130
|
+
"aria-label": `Previous ${Q}`,
|
|
131
|
+
"aria-hidden": Z || void 0,
|
|
132
|
+
tabIndex: Z ? -1 : void 0,
|
|
133
|
+
children: /* @__PURE__ */ h("svg", {
|
|
134
|
+
viewBox: "0 0 12 12",
|
|
135
|
+
fill: "none",
|
|
136
|
+
stroke: "currentColor",
|
|
137
|
+
strokeWidth: "1.5",
|
|
138
|
+
strokeLinecap: "round",
|
|
139
|
+
strokeLinejoin: "round",
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
children: /* @__PURE__ */ h("path", { d: "M7 2L3 6l4 4" })
|
|
142
|
+
})
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ g("div", {
|
|
145
|
+
className: a.title,
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ h("button", {
|
|
148
|
+
type: "button",
|
|
149
|
+
className: a.titleButton,
|
|
150
|
+
"aria-label": "Choose month",
|
|
151
|
+
"aria-expanded": P === "month",
|
|
152
|
+
onClick: () => J("month"),
|
|
153
|
+
children: V
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ h("button", {
|
|
156
|
+
type: "button",
|
|
157
|
+
className: a.titleButton,
|
|
158
|
+
"aria-label": "Choose year",
|
|
159
|
+
"aria-expanded": P === "year",
|
|
160
|
+
onClick: () => J("year"),
|
|
161
|
+
children: H
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ h("span", {
|
|
164
|
+
className: a.srOnly,
|
|
165
|
+
"aria-live": "polite",
|
|
166
|
+
children: B
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ h("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
className: i(a.nav, Z && a.navHidden, j?.nav),
|
|
173
|
+
onClick: () => $(1),
|
|
174
|
+
"aria-label": `Next ${Q}`,
|
|
175
|
+
"aria-hidden": Z || void 0,
|
|
176
|
+
tabIndex: Z ? -1 : void 0,
|
|
177
|
+
children: /* @__PURE__ */ h("svg", {
|
|
178
|
+
viewBox: "0 0 12 12",
|
|
179
|
+
fill: "none",
|
|
180
|
+
stroke: "currentColor",
|
|
181
|
+
strokeWidth: "1.5",
|
|
182
|
+
strokeLinecap: "round",
|
|
183
|
+
strokeLinejoin: "round",
|
|
184
|
+
"aria-hidden": "true",
|
|
185
|
+
children: /* @__PURE__ */ h("path", { d: "M5 2l4 4-4 4" })
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
P === "month" && /* @__PURE__ */ h("div", {
|
|
191
|
+
ref: N,
|
|
192
|
+
role: "listbox",
|
|
193
|
+
"aria-label": "Month",
|
|
194
|
+
className: i(a.options, a.months),
|
|
195
|
+
onKeyDown: (e) => X(e, 12, ee),
|
|
196
|
+
children: U.map((e, t) => {
|
|
197
|
+
let n = G(t), r = t === z;
|
|
198
|
+
return /* @__PURE__ */ h("button", {
|
|
199
|
+
type: "button",
|
|
200
|
+
role: "option",
|
|
201
|
+
"aria-selected": r,
|
|
202
|
+
"aria-disabled": n || void 0,
|
|
203
|
+
"aria-label": e.long,
|
|
204
|
+
tabIndex: t === I ? 0 : -1,
|
|
205
|
+
"data-active": t === I || void 0,
|
|
206
|
+
className: i(a.option, r && a.optionSelected),
|
|
207
|
+
onClick: () => !n && Y(R, t),
|
|
208
|
+
children: e.short
|
|
209
|
+
}, t);
|
|
210
|
+
})
|
|
211
|
+
}),
|
|
212
|
+
P === "year" && /* @__PURE__ */ h("div", {
|
|
213
|
+
ref: N,
|
|
214
|
+
role: "listbox",
|
|
215
|
+
"aria-label": "Year",
|
|
216
|
+
className: i(a.options, a.years),
|
|
217
|
+
onKeyDown: (e) => X(e, W.length, v),
|
|
218
|
+
children: W.map((e, t) => {
|
|
219
|
+
let n = K(e), r = e === R;
|
|
220
|
+
return /* @__PURE__ */ h("button", {
|
|
221
|
+
type: "button",
|
|
222
|
+
role: "option",
|
|
223
|
+
"aria-selected": r,
|
|
224
|
+
"aria-disabled": n || void 0,
|
|
225
|
+
tabIndex: t === I ? 0 : -1,
|
|
226
|
+
"data-active": t === I || void 0,
|
|
227
|
+
className: i(a.option, r && a.optionSelected),
|
|
228
|
+
onClick: () => !n && Y(e, z),
|
|
229
|
+
children: e
|
|
230
|
+
}, e);
|
|
231
|
+
})
|
|
232
|
+
}),
|
|
233
|
+
P === "day" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
234
|
+
className: a.weekdays,
|
|
235
|
+
"aria-hidden": "true",
|
|
236
|
+
children: ne.map((e, t) => /* @__PURE__ */ h("span", {
|
|
237
|
+
className: a.weekday,
|
|
238
|
+
children: e
|
|
239
|
+
}, t))
|
|
240
|
+
}), /* @__PURE__ */ h("div", {
|
|
241
|
+
ref: M,
|
|
242
|
+
role: "grid",
|
|
243
|
+
className: i(a.grid, j?.grid),
|
|
244
|
+
onKeyDown: oe,
|
|
245
|
+
children: re.map((e) => {
|
|
246
|
+
let t = !u(e, y), n = l(e, x), r = l(e, S), o = D(e), s = l(e, b);
|
|
247
|
+
return /* @__PURE__ */ h("button", {
|
|
248
|
+
type: "button",
|
|
249
|
+
role: "gridcell",
|
|
250
|
+
"data-date": f(e),
|
|
251
|
+
tabIndex: s ? 0 : -1,
|
|
252
|
+
className: i(a.day, t && a.dayOutside, r && a.dayToday, n && a.daySelected, t && j?.dayOutside, r && j?.dayToday, n && j?.daySelected, j?.day),
|
|
253
|
+
"aria-selected": n,
|
|
254
|
+
"aria-disabled": o || void 0,
|
|
255
|
+
"aria-current": r ? "date" : void 0,
|
|
256
|
+
"aria-label": ie.format(e),
|
|
257
|
+
onClick: () => q(e),
|
|
258
|
+
children: e.getDate()
|
|
259
|
+
}, f(e));
|
|
260
|
+
})
|
|
261
|
+
})] })
|
|
262
|
+
] });
|
|
284
263
|
}
|
|
285
|
-
export {
|
|
286
|
-
ve as CalendarPanel
|
|
287
|
-
};
|
|
264
|
+
export { y as CalendarPanel };
|