@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,186 +1,156 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import c from "
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import e from "./Loader.module.js";
|
|
2
|
+
import { forwardRef as t, useEffect as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import o from "clsx";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as l } from "react-dom";
|
|
6
|
+
// src/components/Loader/Loader.tsx
|
|
7
|
+
var u = {
|
|
8
|
+
dots: 3,
|
|
9
|
+
pulse: 3,
|
|
10
|
+
spinner: 1,
|
|
11
|
+
grid: 9,
|
|
12
|
+
morph: 2
|
|
12
13
|
};
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
function d(e) {
|
|
15
|
+
let t = e.getBoundingClientRect(), n = Math.max(t.top, 0), r = Math.min(t.bottom, window.innerHeight);
|
|
16
|
+
for (let t = e.parentElement; t && t !== document.body; t = t.parentElement) {
|
|
17
|
+
let e = getComputedStyle(t).overflowY;
|
|
18
|
+
if (e === "visible" || e === "") continue;
|
|
19
|
+
let i = t.getBoundingClientRect();
|
|
20
|
+
n = Math.max(n, i.top), r = Math.min(r, i.bottom);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
top: n,
|
|
24
|
+
bottom: r
|
|
25
|
+
};
|
|
23
26
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
function f(e, t) {
|
|
28
|
+
r(() => {
|
|
29
|
+
let n = e.current;
|
|
30
|
+
if (!t || !n) return;
|
|
31
|
+
let r = 0, i = () => {
|
|
32
|
+
r = 0;
|
|
33
|
+
let e = n.getBoundingClientRect(), t = n.firstElementChild, { top: i, bottom: a } = d(n), o = 0;
|
|
34
|
+
if (a > i && e.height > 0) {
|
|
35
|
+
o = (i + a) / 2 - (e.top + e.bottom) / 2;
|
|
36
|
+
let n = Math.max(0, e.height / 2 - (t?.offsetHeight ?? 0) / 2 - 8);
|
|
37
|
+
o = Math.max(-n, Math.min(n, o));
|
|
38
|
+
}
|
|
39
|
+
n.style.setProperty("--_shift-y", `${Math.round(o)}px`);
|
|
40
|
+
}, a = () => {
|
|
41
|
+
r ||= requestAnimationFrame(i);
|
|
42
|
+
};
|
|
43
|
+
i(), window.addEventListener("scroll", a, {
|
|
44
|
+
capture: !0,
|
|
45
|
+
passive: !0
|
|
46
|
+
}), window.addEventListener("resize", a);
|
|
47
|
+
let o = new ResizeObserver(a);
|
|
48
|
+
return o.observe(n), () => {
|
|
49
|
+
r && cancelAnimationFrame(r), window.removeEventListener("scroll", a, { capture: !0 }), window.removeEventListener("resize", a), o.disconnect();
|
|
50
|
+
};
|
|
51
|
+
}, [e, t]);
|
|
48
52
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
function p(e, t) {
|
|
54
|
+
let [r, i] = a(e && t <= 0);
|
|
55
|
+
return n(() => {
|
|
56
|
+
if (!e) {
|
|
57
|
+
i(!1);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (t <= 0) {
|
|
61
|
+
i(!0);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let n = setTimeout(() => i(!0), t);
|
|
65
|
+
return () => clearTimeout(n);
|
|
66
|
+
}, [e, t]), e && r;
|
|
63
67
|
}
|
|
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
|
-
f && t.passThrough,
|
|
154
|
-
i?.overlay
|
|
155
|
-
),
|
|
156
|
-
children: C
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
T
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
) : a ? e === "fullscreen" ? T : e === "overlay" ? /* @__PURE__ */ m(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
ref: R,
|
|
166
|
-
className: c(t.root, t[o], t.overlay, B, i?.root, i?.overlay, w),
|
|
167
|
-
style: { ...y, ...x },
|
|
168
|
-
...E,
|
|
169
|
-
children: C
|
|
170
|
-
}
|
|
171
|
-
) : /* @__PURE__ */ m(
|
|
172
|
-
"div",
|
|
173
|
-
{
|
|
174
|
-
ref: R,
|
|
175
|
-
className: c(t.root, t[o], t.inline, i?.root, w),
|
|
176
|
-
style: { ...y, ...A ? { minHeight: A } : null, ...x },
|
|
177
|
-
...E,
|
|
178
|
-
children: C
|
|
179
|
-
}
|
|
180
|
-
) : null;
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
K.displayName = "Loader";
|
|
184
|
-
export {
|
|
185
|
-
K as Loader
|
|
186
|
-
};
|
|
68
|
+
var m = t(({ variant: t = "dots", size: a = "md", mode: d = "inline", loading: m = !0, children: h, delay: g = 0, backdrop: _ = "dim", interactive: v = !1, color: y, label: b = "Loading", showLabel: x = !1, minHeight: S, classes: C, className: w, style: T, ...E }, D) => {
|
|
69
|
+
let O = p(m, g), k = h != null, A = i(null), j = i(null), M = i(null), N = (e) => {
|
|
70
|
+
A.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
|
|
71
|
+
}, P = !k && d === "overlay" && O;
|
|
72
|
+
r(() => {
|
|
73
|
+
if (!P) return;
|
|
74
|
+
let e = A.current?.parentElement;
|
|
75
|
+
if (!e) return;
|
|
76
|
+
let t = e.getAttribute("aria-busy");
|
|
77
|
+
e.setAttribute("aria-busy", "true");
|
|
78
|
+
let n = getComputedStyle(e).position, r = n === "static" || n === "", i = e.style.position;
|
|
79
|
+
return r && (e.style.position = "relative"), () => {
|
|
80
|
+
r && (e.style.position = i), t === null ? e.removeAttribute("aria-busy") : e.setAttribute("aria-busy", t);
|
|
81
|
+
};
|
|
82
|
+
}, [P]), f(k ? M : A, O && d !== "fullscreen" && (k || d === "overlay")), n(() => {
|
|
83
|
+
j.current?.toggleAttribute("inert", O && !v);
|
|
84
|
+
}, [O, v]);
|
|
85
|
+
let F = y ? { "--crk-loader-color": y } : void 0, I = typeof S == "number" ? `${S}px` : S, L = /* @__PURE__ */ c("span", {
|
|
86
|
+
role: "status",
|
|
87
|
+
"aria-live": "polite",
|
|
88
|
+
className: o(e.indicator, C?.indicator),
|
|
89
|
+
children: [/* @__PURE__ */ s("span", {
|
|
90
|
+
className: o(e.glyph, e[t], C?.glyph),
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
children: Array.from({ length: u[t] }, (e, t) => /* @__PURE__ */ s("span", {}, t))
|
|
93
|
+
}), b ? /* @__PURE__ */ s("span", {
|
|
94
|
+
className: o(x ? e.label : e.srLabel, C?.label),
|
|
95
|
+
children: b
|
|
96
|
+
}) : null]
|
|
97
|
+
}), R = {
|
|
98
|
+
dim: e.backdropDim,
|
|
99
|
+
blur: e.backdropBlur,
|
|
100
|
+
none: void 0
|
|
101
|
+
}[_], z = O && d === "fullscreen" && typeof document < "u" ? l(/* @__PURE__ */ s("div", {
|
|
102
|
+
ref: k ? void 0 : N,
|
|
103
|
+
className: o(e.root, e[a], e.overlay, e.fullscreen, R, C?.overlay, !k && [C?.root, w]),
|
|
104
|
+
style: k ? F : {
|
|
105
|
+
...F,
|
|
106
|
+
...T
|
|
107
|
+
},
|
|
108
|
+
...k ? {} : E,
|
|
109
|
+
children: L
|
|
110
|
+
}), document.body) : null;
|
|
111
|
+
return k ? /* @__PURE__ */ c("div", {
|
|
112
|
+
ref: N,
|
|
113
|
+
className: o(e.root, e[a], e.wrap, O && e.wrapBusy, C?.root, w),
|
|
114
|
+
style: {
|
|
115
|
+
...F,
|
|
116
|
+
...O && I ? { minHeight: I } : null,
|
|
117
|
+
...T
|
|
118
|
+
},
|
|
119
|
+
"aria-busy": m || void 0,
|
|
120
|
+
...E,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ s("div", {
|
|
123
|
+
ref: j,
|
|
124
|
+
className: o(e.content, C?.content),
|
|
125
|
+
children: h
|
|
126
|
+
}),
|
|
127
|
+
O && d !== "fullscreen" && /* @__PURE__ */ s("div", {
|
|
128
|
+
ref: M,
|
|
129
|
+
className: o(e.overlay, R, v && e.passThrough, C?.overlay),
|
|
130
|
+
children: L
|
|
131
|
+
}),
|
|
132
|
+
z
|
|
133
|
+
]
|
|
134
|
+
}) : O ? d === "fullscreen" ? z : d === "overlay" ? /* @__PURE__ */ s("div", {
|
|
135
|
+
ref: N,
|
|
136
|
+
className: o(e.root, e[a], e.overlay, R, C?.root, C?.overlay, w),
|
|
137
|
+
style: {
|
|
138
|
+
...F,
|
|
139
|
+
...T
|
|
140
|
+
},
|
|
141
|
+
...E,
|
|
142
|
+
children: L
|
|
143
|
+
}) : /* @__PURE__ */ s("div", {
|
|
144
|
+
ref: N,
|
|
145
|
+
className: o(e.root, e[a], e.inline, C?.root, w),
|
|
146
|
+
style: {
|
|
147
|
+
...F,
|
|
148
|
+
...I ? { minHeight: I } : null,
|
|
149
|
+
...T
|
|
150
|
+
},
|
|
151
|
+
...E,
|
|
152
|
+
children: L
|
|
153
|
+
}) : null;
|
|
154
|
+
});
|
|
155
|
+
m.displayName = "Loader";
|
|
156
|
+
export { m as Loader };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/components/Loader/Loader.module.scss
|
|
2
|
+
var e = "crk-root-u1D7u", t = "crk-sm-M6Sb3", n = "crk-md-5c9sz", r = "crk-lg-PaoKK", i = "crk-inline-neVjU", a = "crk-wrap-BaBNd", o = "crk-wrapBusy-a4D7Z", s = "crk-content-bw8zV", c = "crk-overlay-B-AIp", l = "crk-crk-loader-enter-VxXmo", u = "crk-indicator-LqmYc", d = "crk-fullscreen-BXAhh", f = "crk-backdropDim-JqArB", p = "crk-backdropBlur-wV2vo", m = "crk-passThrough-NCa9b", h = "crk-glyph-L8nf5", g = "crk-label-yMjMY", _ = "crk-srLabel-PDGoC", v = "crk-dots-KfhUo", y = "crk-pulse-wPxve", b = "crk-crk-loader-dot-bounce-NtrLY", x = "crk-crk-loader-dot-pulse-AolCU", S = "crk-spinner-xG6h2", C = "crk-crk-loader-rotate-yVTPr", w = "crk-grid-5nFwV", T = "crk-crk-loader-cell-A7li4", E = "crk-morph-DAgji", D = "crk-crk-loader-morph-1hxzv", O = "crk-crk-loader-breathe-RCpGC", k = {
|
|
3
|
+
root: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
md: n,
|
|
6
|
+
lg: r,
|
|
7
|
+
inline: i,
|
|
8
|
+
wrap: a,
|
|
9
|
+
wrapBusy: o,
|
|
10
|
+
content: s,
|
|
11
|
+
overlay: c,
|
|
12
|
+
"crk-loader-enter": "crk-crk-loader-enter-VxXmo",
|
|
13
|
+
crkLoaderEnter: l,
|
|
14
|
+
indicator: u,
|
|
15
|
+
fullscreen: d,
|
|
16
|
+
backdropDim: f,
|
|
17
|
+
backdropBlur: p,
|
|
18
|
+
passThrough: m,
|
|
19
|
+
glyph: h,
|
|
20
|
+
label: g,
|
|
21
|
+
srLabel: _,
|
|
22
|
+
dots: v,
|
|
23
|
+
pulse: y,
|
|
24
|
+
"crk-loader-dot-bounce": "crk-crk-loader-dot-bounce-NtrLY",
|
|
25
|
+
crkLoaderDotBounce: b,
|
|
26
|
+
"crk-loader-dot-pulse": "crk-crk-loader-dot-pulse-AolCU",
|
|
27
|
+
crkLoaderDotPulse: x,
|
|
28
|
+
spinner: S,
|
|
29
|
+
"crk-loader-rotate": "crk-crk-loader-rotate-yVTPr",
|
|
30
|
+
crkLoaderRotate: C,
|
|
31
|
+
grid: w,
|
|
32
|
+
"crk-loader-cell": "crk-crk-loader-cell-A7li4",
|
|
33
|
+
crkLoaderCell: T,
|
|
34
|
+
morph: E,
|
|
35
|
+
"crk-loader-morph": "crk-crk-loader-morph-1hxzv",
|
|
36
|
+
crkLoaderMorph: D,
|
|
37
|
+
"crk-loader-breathe": "crk-crk-loader-breathe-RCpGC",
|
|
38
|
+
crkLoaderBreathe: O
|
|
39
|
+
};
|
|
40
|
+
export { p as backdropBlur, f as backdropDim, s as content, O as crkLoaderBreathe, T as crkLoaderCell, b as crkLoaderDotBounce, x as crkLoaderDotPulse, l as crkLoaderEnter, D as crkLoaderMorph, C as crkLoaderRotate, k as default, v as dots, d as fullscreen, h as glyph, w as grid, u as indicator, i as inline, g as label, r as lg, n as md, E as morph, c as overlay, m as passThrough, y as pulse, e as root, t as sm, S as spinner, _ as srLabel, a as wrap, o as wrapBusy };
|
|
@@ -1,108 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
1
|
+
import { useFocusTrap as e } from "../../hooks/useFocusTrap.js";
|
|
2
|
+
import { EscapeLayerProvider as t, useEscapeLayer as n } from "../../hooks/useEscapeLayer.js";
|
|
3
|
+
import r from "./Modal.module.js";
|
|
4
|
+
import { createContext as i, forwardRef as a, useContext as o, useEffect as s, useId as c, useRef as l } from "react";
|
|
5
|
+
import u from "clsx";
|
|
6
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as p } from "react-dom";
|
|
8
|
+
// src/components/Modal/Modal.tsx
|
|
9
|
+
var m = i({
|
|
10
|
+
classes: {},
|
|
11
|
+
titleId: ""
|
|
12
|
+
}), h = ({ children: e, className: t, style: n, onClose: i }) => {
|
|
13
|
+
let { classes: a, titleId: s } = o(m);
|
|
14
|
+
return /* @__PURE__ */ f("div", {
|
|
15
|
+
className: u(r.header, i && r.headerWithClose, a.header, t),
|
|
16
|
+
style: n,
|
|
17
|
+
children: [/* @__PURE__ */ d("div", {
|
|
18
|
+
id: s,
|
|
19
|
+
className: u(r.headerTitle, a.headerTitle),
|
|
20
|
+
children: e
|
|
21
|
+
}), i && /* @__PURE__ */ d("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
className: u(r.closeButton, a.closeButton),
|
|
24
|
+
onClick: i,
|
|
25
|
+
"aria-label": "Close",
|
|
26
|
+
children: "×"
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
h.displayName = "Modal.Header";
|
|
31
|
+
var g = ({ children: e, className: t, style: n }) => {
|
|
32
|
+
let { classes: i } = o(m);
|
|
33
|
+
return /* @__PURE__ */ d("div", {
|
|
34
|
+
className: u(r.body, i.body, t),
|
|
35
|
+
style: n,
|
|
36
|
+
children: e
|
|
37
|
+
});
|
|
35
38
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
open: e,
|
|
45
|
-
onClose: a,
|
|
46
|
-
closeOnBackdrop: l = !0,
|
|
47
|
-
closeOnEscape: r = !0,
|
|
48
|
-
size: c = "md",
|
|
49
|
-
classes: i,
|
|
50
|
-
className: w,
|
|
51
|
-
style: x,
|
|
52
|
-
children: k,
|
|
53
|
-
"aria-label": y,
|
|
54
|
-
"aria-labelledby": C
|
|
55
|
-
}, n) => {
|
|
56
|
-
const b = v(null), T = (o) => {
|
|
57
|
-
b.current = o, typeof n == "function" ? n(o) : n && (n.current = o);
|
|
58
|
-
}, g = P(), h = C ?? `${g}-title`;
|
|
59
|
-
O(b, e);
|
|
60
|
-
const I = U(() => {
|
|
61
|
-
r && a();
|
|
62
|
-
}, e);
|
|
63
|
-
j(() => {
|
|
64
|
-
if (!e) return;
|
|
65
|
-
const o = document.body.style.overflow;
|
|
66
|
-
return document.body.style.overflow = "hidden", () => {
|
|
67
|
-
document.body.style.overflow = o;
|
|
68
|
-
};
|
|
69
|
-
}, [e]);
|
|
70
|
-
const f = v(!1), F = (o) => {
|
|
71
|
-
f.current = o.target === o.currentTarget;
|
|
72
|
-
}, R = (o) => {
|
|
73
|
-
l && f.current && o.target === o.currentTarget && a(), f.current = !1;
|
|
74
|
-
};
|
|
75
|
-
return e ? L(
|
|
76
|
-
/* @__PURE__ */ s(
|
|
77
|
-
"div",
|
|
78
|
-
{
|
|
79
|
-
className: d(t.backdrop, i?.backdrop),
|
|
80
|
-
onMouseDown: F,
|
|
81
|
-
onMouseUp: R,
|
|
82
|
-
role: "presentation",
|
|
83
|
-
children: /* @__PURE__ */ s(
|
|
84
|
-
"div",
|
|
85
|
-
{
|
|
86
|
-
ref: T,
|
|
87
|
-
className: d(t.modal, t[c], i?.modal, w),
|
|
88
|
-
style: x,
|
|
89
|
-
role: "dialog",
|
|
90
|
-
"aria-modal": "true",
|
|
91
|
-
"aria-label": y,
|
|
92
|
-
"aria-labelledby": y ? void 0 : h,
|
|
93
|
-
children: /* @__PURE__ */ s(u.Provider, { value: { classes: i ?? {}, titleId: h }, children: /* @__PURE__ */ s(S, { value: I, children: k }) })
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
document.body
|
|
99
|
-
) : null;
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
m.displayName = "Modal";
|
|
103
|
-
m.Header = N;
|
|
104
|
-
m.Body = M;
|
|
105
|
-
m.Footer = B;
|
|
106
|
-
export {
|
|
107
|
-
m as Modal
|
|
39
|
+
g.displayName = "Modal.Body";
|
|
40
|
+
var _ = ({ children: e, className: t, style: n }) => {
|
|
41
|
+
let { classes: i } = o(m);
|
|
42
|
+
return /* @__PURE__ */ d("div", {
|
|
43
|
+
className: u(r.footer, i.footer, t),
|
|
44
|
+
style: n,
|
|
45
|
+
children: e
|
|
46
|
+
});
|
|
108
47
|
};
|
|
48
|
+
_.displayName = "Modal.Footer";
|
|
49
|
+
var v = a(({ open: i, onClose: a, closeOnBackdrop: o = !0, closeOnEscape: f = !0, size: h = "md", classes: g, className: _, style: v, children: y, "aria-label": b, "aria-labelledby": x }, S) => {
|
|
50
|
+
let C = l(null), w = (e) => {
|
|
51
|
+
C.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
52
|
+
}, T = c(), E = x ?? `${T}-title`;
|
|
53
|
+
e(C, i);
|
|
54
|
+
let D = n(() => {
|
|
55
|
+
f && a();
|
|
56
|
+
}, i);
|
|
57
|
+
s(() => {
|
|
58
|
+
if (!i) return;
|
|
59
|
+
let e = document.body.style.overflow;
|
|
60
|
+
return document.body.style.overflow = "hidden", () => {
|
|
61
|
+
document.body.style.overflow = e;
|
|
62
|
+
};
|
|
63
|
+
}, [i]);
|
|
64
|
+
let O = l(!1);
|
|
65
|
+
return i ? p(/* @__PURE__ */ d("div", {
|
|
66
|
+
className: u(r.backdrop, g?.backdrop),
|
|
67
|
+
onMouseDown: (e) => {
|
|
68
|
+
O.current = e.target === e.currentTarget;
|
|
69
|
+
},
|
|
70
|
+
onMouseUp: (e) => {
|
|
71
|
+
o && O.current && e.target === e.currentTarget && a(), O.current = !1;
|
|
72
|
+
},
|
|
73
|
+
role: "presentation",
|
|
74
|
+
children: /* @__PURE__ */ d("div", {
|
|
75
|
+
ref: w,
|
|
76
|
+
className: u(r.modal, r[h], g?.modal, _),
|
|
77
|
+
style: v,
|
|
78
|
+
role: "dialog",
|
|
79
|
+
"aria-modal": "true",
|
|
80
|
+
"aria-label": b,
|
|
81
|
+
"aria-labelledby": b ? void 0 : E,
|
|
82
|
+
children: /* @__PURE__ */ d(m.Provider, {
|
|
83
|
+
value: {
|
|
84
|
+
classes: g ?? {},
|
|
85
|
+
titleId: E
|
|
86
|
+
},
|
|
87
|
+
children: /* @__PURE__ */ d(t, {
|
|
88
|
+
value: D,
|
|
89
|
+
children: y
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
}), document.body) : null;
|
|
94
|
+
});
|
|
95
|
+
v.displayName = "Modal", v.Header = h, v.Body = g, v.Footer = _;
|
|
96
|
+
export { v as Modal };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/components/Modal/Modal.module.scss
|
|
2
|
+
var e = "crk-backdrop-jYpTA", t = "crk-backdropIn-x5Z-A", n = "crk-modal-yNG-7", r = "crk-modalIn-xFUwm", i = "crk-sm--xyY9", a = "crk-md-ETTfh", o = "crk-lg-5DBb7", s = "crk-fullscreen-b4jQ-", c = "crk-header-NS30G", l = "crk-headerTitle-tJ2Qv", u = "crk-headerWithClose-4davm", d = "crk-closeButton-JX-aq", f = "crk-body-3zIj9", p = "crk-footer-Oyz-R", m = {
|
|
3
|
+
backdrop: e,
|
|
4
|
+
backdropIn: t,
|
|
5
|
+
modal: n,
|
|
6
|
+
modalIn: r,
|
|
7
|
+
sm: i,
|
|
8
|
+
md: a,
|
|
9
|
+
lg: o,
|
|
10
|
+
fullscreen: s,
|
|
11
|
+
header: c,
|
|
12
|
+
headerTitle: l,
|
|
13
|
+
headerWithClose: u,
|
|
14
|
+
closeButton: d,
|
|
15
|
+
body: f,
|
|
16
|
+
footer: p
|
|
17
|
+
};
|
|
18
|
+
export { e as backdrop, t as backdropIn, f as body, d as closeButton, m as default, p as footer, s as fullscreen, c as header, l as headerTitle, u as headerWithClose, o as lg, a as md, n as modal, r as modalIn, i as sm };
|