@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,201 +1,312 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
-
}
|
|
1
|
+
import e from "./ImageViewer.module.js";
|
|
2
|
+
import { useFocusTrap as t } from "../../hooks/useFocusTrap.js";
|
|
3
|
+
import { EscapeLayerProvider as n, useEscapeLayer as r } from "../../hooks/useEscapeLayer.js";
|
|
4
|
+
import { useKeyboard as i } from "../../hooks/useKeyboard.js";
|
|
5
|
+
import { Spinner as a } from "../Spinner/Spinner.js";
|
|
6
|
+
import { useZoomPan as o } from "./useZoomPan.js";
|
|
7
|
+
import { forwardRef as s, useCallback as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import p from "clsx";
|
|
9
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal as ee } from "react-dom";
|
|
11
|
+
// src/components/ImageViewer/ImageViewer.tsx
|
|
12
|
+
var te = {
|
|
13
|
+
viewer: "Image viewer",
|
|
14
|
+
close: "Close",
|
|
15
|
+
previous: "Previous image",
|
|
16
|
+
next: "Next image",
|
|
17
|
+
zoomIn: "Zoom in",
|
|
18
|
+
zoomOut: "Zoom out",
|
|
19
|
+
reset: "Reset zoom",
|
|
20
|
+
fit: "Fit to screen",
|
|
21
|
+
download: "Download",
|
|
22
|
+
loading: "Loading image"
|
|
23
|
+
}, ne = 60, _ = () => /* @__PURE__ */ h("svg", {
|
|
24
|
+
viewBox: "0 0 20 20",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "2",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: /* @__PURE__ */ h("path", { d: "M5 5l10 10M15 5L5 15" })
|
|
31
|
+
}), v = ({ dir: e }) => /* @__PURE__ */ h("svg", {
|
|
32
|
+
viewBox: "0 0 20 20",
|
|
33
|
+
fill: "none",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
strokeWidth: "2",
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: e === "left" ? /* @__PURE__ */ h("path", { d: "M12.5 4.5L7 10l5.5 5.5" }) : /* @__PURE__ */ h("path", { d: "M7.5 4.5L13 10l-5.5 5.5" })
|
|
40
|
+
}), y = () => /* @__PURE__ */ h("svg", {
|
|
41
|
+
viewBox: "0 0 20 20",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth: "1.8",
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round",
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
children: /* @__PURE__ */ h("path", { d: "M10 3v10m0 0l-4-4m4 4l4-4M4 16h12" })
|
|
49
|
+
}), b = () => /* @__PURE__ */ h("svg", {
|
|
50
|
+
viewBox: "0 0 20 20",
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: "1.8",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
children: /* @__PURE__ */ h("path", { d: "M4 10a6 6 0 1 1 1.8 4.3M4 15v-4h4" })
|
|
58
|
+
}), x = () => /* @__PURE__ */ h("svg", {
|
|
59
|
+
viewBox: "0 0 20 20",
|
|
60
|
+
fill: "none",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
strokeWidth: "1.8",
|
|
63
|
+
strokeLinecap: "round",
|
|
64
|
+
strokeLinejoin: "round",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: /* @__PURE__ */ h("path", { d: "M3 8V3h5M12 3h5v5M17 12v5h-5M8 17H3v-5" })
|
|
67
|
+
}), S = s(({ open: s, onClose: S, items: C, index: w, defaultIndex: T = 0, onIndexChange: E, loop: D = !0, showCounter: re = !0, showThumbnails: ie = !1, showZoomControls: ae = !0, showDownload: oe, renderSlide: O, closeOnBackdrop: se = !0, zoom: ce, labels: le, classes: k, className: ue, style: de }, A) => {
|
|
68
|
+
let j = {
|
|
69
|
+
...te,
|
|
70
|
+
...le
|
|
71
|
+
}, M = C.length, N = w !== void 0, [P, F] = f(T), I = M === 0 ? 0 : Math.min(Math.max(0, N ? w : P), M - 1), L = C[I], R = d(null), z = (e) => {
|
|
72
|
+
R.current = e, typeof A == "function" ? A(e) : A && (A.current = e);
|
|
73
|
+
}, B = o(ce), { reset: V, scale: H, isPanning: fe } = B, U = c((e) => {
|
|
74
|
+
if (M === 0) return;
|
|
75
|
+
let t = e;
|
|
76
|
+
t = D ? (e % M + M) % M : Math.min(Math.max(0, e), M - 1), t !== I && (N || F(t), E?.(t));
|
|
77
|
+
}, [
|
|
78
|
+
M,
|
|
79
|
+
D,
|
|
80
|
+
I,
|
|
81
|
+
N,
|
|
82
|
+
E
|
|
83
|
+
]), W = D ? M > 1 : I > 0, G = D ? M > 1 : I < M - 1, K = c(() => W && U(I - 1), [
|
|
84
|
+
W,
|
|
85
|
+
U,
|
|
86
|
+
I
|
|
87
|
+
]), q = c(() => G && U(I + 1), [
|
|
88
|
+
G,
|
|
89
|
+
U,
|
|
90
|
+
I
|
|
91
|
+
]), [J, Y] = f(!1);
|
|
92
|
+
l(() => {
|
|
93
|
+
Y(!1), V();
|
|
94
|
+
}, [
|
|
95
|
+
I,
|
|
96
|
+
L?.src,
|
|
97
|
+
V
|
|
98
|
+
]), l(() => {
|
|
99
|
+
if (!s || M < 2 || typeof Image > "u") return;
|
|
100
|
+
let e = [C[(I + 1) % M], C[(I - 1 + M) % M]];
|
|
101
|
+
for (let t of e) {
|
|
102
|
+
if (!t) continue;
|
|
103
|
+
let e = new Image();
|
|
104
|
+
e.src = t.src;
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
s,
|
|
108
|
+
I,
|
|
109
|
+
C,
|
|
110
|
+
M
|
|
111
|
+
]), t(R, s);
|
|
112
|
+
let pe = r(() => S(), s);
|
|
113
|
+
l(() => {
|
|
114
|
+
if (!s) return;
|
|
115
|
+
let e = document.body.style.overflow;
|
|
116
|
+
return document.body.style.overflow = "hidden", () => {
|
|
117
|
+
document.body.style.overflow = e;
|
|
118
|
+
};
|
|
119
|
+
}, [s]), i({
|
|
120
|
+
ArrowLeft: K,
|
|
121
|
+
ArrowRight: q,
|
|
122
|
+
"+": B.zoomIn,
|
|
123
|
+
"=": B.zoomIn,
|
|
124
|
+
"-": B.zoomOut,
|
|
125
|
+
0: B.reset
|
|
126
|
+
}, {
|
|
127
|
+
active: s,
|
|
128
|
+
ignoreEditable: !0
|
|
129
|
+
});
|
|
130
|
+
let X = d(null), Z = d(!1), me = (e) => {
|
|
131
|
+
X.current = {
|
|
132
|
+
x: e.clientX ?? 0,
|
|
133
|
+
y: e.clientY ?? 0
|
|
134
|
+
}, Z.current = !1, B.stageProps.onPointerDown(e);
|
|
135
|
+
}, Q = (e) => {
|
|
136
|
+
B.stageProps.onPointerUp(e);
|
|
137
|
+
let t = X.current;
|
|
138
|
+
if (X.current = null, !t) return;
|
|
139
|
+
let n = (e.clientX ?? 0) - t.x, r = (e.clientY ?? 0) - t.y;
|
|
140
|
+
Math.hypot(n, r) >= 5 && (Z.current = !0), H === 1 && Math.abs(n) > ne && Math.abs(n) > Math.abs(r) && (n < 0 ? q() : K());
|
|
141
|
+
}, he = (e) => {
|
|
142
|
+
let t = Z.current;
|
|
143
|
+
Z.current = !1, se && !t && e.target === e.currentTarget && S();
|
|
144
|
+
}, ge = u();
|
|
145
|
+
if (!s || M === 0 || !L) return null;
|
|
146
|
+
let _e = oe ?? !!L.download, ve = typeof L.download == "string" ? L.download : L.src, $ = O ? O(L, {
|
|
147
|
+
index: I,
|
|
148
|
+
active: !0
|
|
149
|
+
}) : null, ye = `${Math.round(H * 100)}%`;
|
|
150
|
+
return ee(/* @__PURE__ */ h("div", {
|
|
151
|
+
ref: z,
|
|
152
|
+
className: p(e.root, k?.root, ue),
|
|
153
|
+
style: de,
|
|
154
|
+
role: "dialog",
|
|
155
|
+
"aria-modal": "true",
|
|
156
|
+
"aria-label": L.alt || j.viewer,
|
|
157
|
+
"data-index": I,
|
|
158
|
+
children: /* @__PURE__ */ g(n, {
|
|
159
|
+
value: pe,
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ h("div", {
|
|
162
|
+
className: p(e.backdrop, k?.backdrop),
|
|
163
|
+
"aria-hidden": "true"
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ g("div", {
|
|
166
|
+
className: p(e.toolbar, k?.toolbar),
|
|
167
|
+
children: [
|
|
168
|
+
re && M > 1 && /* @__PURE__ */ g("span", {
|
|
169
|
+
className: p(e.counter, k?.counter),
|
|
170
|
+
"aria-live": "polite",
|
|
171
|
+
children: [
|
|
172
|
+
I + 1,
|
|
173
|
+
" / ",
|
|
174
|
+
M
|
|
175
|
+
]
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ h("span", { className: e.spacer }),
|
|
178
|
+
ae && /* @__PURE__ */ g("div", {
|
|
179
|
+
className: p(e.zoomControls, k?.zoomControls),
|
|
180
|
+
role: "group",
|
|
181
|
+
"aria-label": "Zoom",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ h("button", {
|
|
184
|
+
type: "button",
|
|
185
|
+
className: e.control,
|
|
186
|
+
onClick: B.zoomOut,
|
|
187
|
+
"aria-label": j.zoomOut,
|
|
188
|
+
children: "−"
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ h("span", {
|
|
191
|
+
className: e.zoomValue,
|
|
192
|
+
"data-testid": "zoom-value",
|
|
193
|
+
children: ye
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ h("button", {
|
|
196
|
+
type: "button",
|
|
197
|
+
className: e.control,
|
|
198
|
+
onClick: B.zoomIn,
|
|
199
|
+
"aria-label": j.zoomIn,
|
|
200
|
+
children: "+"
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ h("button", {
|
|
203
|
+
type: "button",
|
|
204
|
+
className: e.control,
|
|
205
|
+
onClick: B.reset,
|
|
206
|
+
"aria-label": j.reset,
|
|
207
|
+
children: /* @__PURE__ */ h(b, {})
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ h("button", {
|
|
210
|
+
type: "button",
|
|
211
|
+
className: e.control,
|
|
212
|
+
onClick: B.fit,
|
|
213
|
+
"aria-label": j.fit,
|
|
214
|
+
children: /* @__PURE__ */ h(x, {})
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
}),
|
|
218
|
+
_e && /* @__PURE__ */ h("a", {
|
|
219
|
+
className: e.control,
|
|
220
|
+
href: ve,
|
|
221
|
+
download: !0,
|
|
222
|
+
"aria-label": j.download,
|
|
223
|
+
target: "_blank",
|
|
224
|
+
rel: "noreferrer",
|
|
225
|
+
children: /* @__PURE__ */ h(y, {})
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ h("button", {
|
|
228
|
+
type: "button",
|
|
229
|
+
className: e.control,
|
|
230
|
+
onClick: S,
|
|
231
|
+
"aria-label": j.close,
|
|
232
|
+
children: /* @__PURE__ */ h(_, {})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ g("div", {
|
|
237
|
+
className: e.body,
|
|
238
|
+
children: [
|
|
239
|
+
M > 1 && W && /* @__PURE__ */ h("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
className: p(e.nav, e.navPrev, k?.nav, k?.navPrev),
|
|
242
|
+
onClick: K,
|
|
243
|
+
"aria-label": j.previous,
|
|
244
|
+
children: /* @__PURE__ */ h(v, { dir: "left" })
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ h("div", {
|
|
247
|
+
className: p(e.stage, fe && e.panning, k?.stage),
|
|
248
|
+
...B.stageProps,
|
|
249
|
+
onPointerDown: me,
|
|
250
|
+
onPointerUp: Q,
|
|
251
|
+
onClick: he,
|
|
252
|
+
style: B.stageProps.style,
|
|
253
|
+
"data-testid": "image-viewer-stage",
|
|
254
|
+
children: $ ? /* @__PURE__ */ h("div", {
|
|
255
|
+
ref: B.contentRef,
|
|
256
|
+
className: p(e.image, k?.image),
|
|
257
|
+
style: B.contentStyle,
|
|
258
|
+
children: $
|
|
259
|
+
}) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("img", {
|
|
260
|
+
ref: B.contentRef,
|
|
261
|
+
className: p(e.image, !J && e.imageLoading, k?.image),
|
|
262
|
+
style: B.contentStyle,
|
|
263
|
+
src: L.src,
|
|
264
|
+
alt: L.alt ?? "",
|
|
265
|
+
draggable: !1,
|
|
266
|
+
onLoad: () => Y(!0),
|
|
267
|
+
onError: () => Y(!0)
|
|
268
|
+
}, L.src), !J && /* @__PURE__ */ h("span", {
|
|
269
|
+
className: e.spinner,
|
|
270
|
+
children: /* @__PURE__ */ h(a, {
|
|
271
|
+
size: "lg",
|
|
272
|
+
label: j.loading
|
|
273
|
+
})
|
|
274
|
+
})] })
|
|
275
|
+
}),
|
|
276
|
+
M > 1 && G && /* @__PURE__ */ h("button", {
|
|
277
|
+
type: "button",
|
|
278
|
+
className: p(e.nav, e.navNext, k?.nav, k?.navNext),
|
|
279
|
+
onClick: q,
|
|
280
|
+
"aria-label": j.next,
|
|
281
|
+
children: /* @__PURE__ */ h(v, { dir: "right" })
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
}),
|
|
285
|
+
L.caption && /* @__PURE__ */ h("div", {
|
|
286
|
+
id: ge,
|
|
287
|
+
className: p(e.caption, k?.caption),
|
|
288
|
+
children: L.caption
|
|
289
|
+
}),
|
|
290
|
+
ie && M > 1 && /* @__PURE__ */ h("div", {
|
|
291
|
+
className: p(e.thumbnails, k?.thumbnails),
|
|
292
|
+
role: "list",
|
|
293
|
+
children: C.map((t, n) => /* @__PURE__ */ h("button", {
|
|
294
|
+
type: "button",
|
|
295
|
+
role: "listitem",
|
|
296
|
+
className: p(e.thumbnail, n === I && e.thumbnailActive, k?.thumbnail, n === I && k?.thumbnailActive),
|
|
297
|
+
onClick: () => U(n),
|
|
298
|
+
"aria-label": t.alt || `${n + 1}`,
|
|
299
|
+
"aria-current": n === I ? "true" : void 0,
|
|
300
|
+
children: /* @__PURE__ */ h("img", {
|
|
301
|
+
src: t.thumbnail ?? t.src,
|
|
302
|
+
alt: "",
|
|
303
|
+
draggable: !1
|
|
304
|
+
})
|
|
305
|
+
}, `${t.src}-${n}`))
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
}), document.body);
|
|
310
|
+
});
|
|
311
|
+
S.displayName = "ImageViewer";
|
|
312
|
+
export { S as ImageViewer };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/components/ImageViewer/ImageViewer.module.scss
|
|
2
|
+
var e = "crk-root-ONPec", t = "crk-viewerIn-LGN1N", n = "crk-backdrop-zT-Q5", r = "crk-toolbar-AnTEv", i = "crk-spacer-w02Ek", a = "crk-counter-VTMp2", o = "crk-zoomControls-7H0yp", s = "crk-zoomValue-SJmdu", c = "crk-control-PyHnZ", l = "crk-body-OJK4N", u = "crk-stage-e0AOa", d = "crk-image-m6tek", f = "crk-panning-KHk5X", p = "crk-imageLoading-jrFiP", m = "crk-spinner-eg9--", h = "crk-nav-Bejfo", g = "crk-navPrev-GAvIZ", _ = "crk-navNext-Ly2YK", v = "crk-caption-25w3Q", y = "crk-thumbnails-JZb4b", b = "crk-thumbnail-hzBpT", x = "crk-thumbnailActive-Pfwmf", S = {
|
|
3
|
+
root: e,
|
|
4
|
+
viewerIn: t,
|
|
5
|
+
backdrop: n,
|
|
6
|
+
toolbar: r,
|
|
7
|
+
spacer: i,
|
|
8
|
+
counter: a,
|
|
9
|
+
zoomControls: o,
|
|
10
|
+
zoomValue: s,
|
|
11
|
+
control: c,
|
|
12
|
+
body: l,
|
|
13
|
+
stage: u,
|
|
14
|
+
image: d,
|
|
15
|
+
panning: f,
|
|
16
|
+
imageLoading: p,
|
|
17
|
+
spinner: m,
|
|
18
|
+
nav: h,
|
|
19
|
+
navPrev: g,
|
|
20
|
+
navNext: _,
|
|
21
|
+
caption: v,
|
|
22
|
+
thumbnails: y,
|
|
23
|
+
thumbnail: b,
|
|
24
|
+
thumbnailActive: x
|
|
25
|
+
};
|
|
26
|
+
export { n as backdrop, l as body, v as caption, c as control, a as counter, S as default, d as image, p as imageLoading, h as nav, _ as navNext, g as navPrev, f as panning, e as root, i as spacer, m as spinner, u as stage, b as thumbnail, x as thumbnailActive, y as thumbnails, r as toolbar, t as viewerIn, o as zoomControls, s as zoomValue };
|