@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,165 +1,158 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
-
onKeyDown: o.onHandleKeyDown,
|
|
156
|
-
...a,
|
|
157
|
-
children: R
|
|
158
|
-
}
|
|
159
|
-
);
|
|
1
|
+
import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
2
|
+
import s from "clsx";
|
|
3
|
+
import c from "./Draggable.module.scss.js";
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Draggable/Draggable.tsx
|
|
6
|
+
var u = e(null), d = t(({ children: e, defaultPosition: t, position: r, axis: d = "both", bounds: f = "viewport", keyboardStep: p = 10, disabled: m = !1, onDragStart: h, onDrag: g, onDragEnd: _, classes: v, className: y, style: b, ...x }, S) => {
|
|
7
|
+
let C = a(null), w = r !== void 0, [T, E] = o(t ?? {
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0
|
|
10
|
+
}), D = w ? r : T, O = a(D);
|
|
11
|
+
O.current = D;
|
|
12
|
+
let [k, A] = o(!1), j = a(null), M = a(0), [N, P] = o(!1), F = n(() => (M.current += 1, P(!0), () => {
|
|
13
|
+
--M.current, M.current === 0 && P(!1);
|
|
14
|
+
}), []), I = n((e) => {
|
|
15
|
+
C.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
16
|
+
}, [S]), L = n((e) => {
|
|
17
|
+
let t = C.current?.getBoundingClientRect();
|
|
18
|
+
return t ? {
|
|
19
|
+
left: t.left - e.x,
|
|
20
|
+
top: t.top - e.y,
|
|
21
|
+
width: t.width,
|
|
22
|
+
height: t.height
|
|
23
|
+
} : {
|
|
24
|
+
left: 0,
|
|
25
|
+
top: 0,
|
|
26
|
+
width: 0,
|
|
27
|
+
height: 0
|
|
28
|
+
};
|
|
29
|
+
}, []), R = n((e, t, n) => {
|
|
30
|
+
if (f === "none" || typeof window > "u") return {
|
|
31
|
+
x: e,
|
|
32
|
+
y: t
|
|
33
|
+
};
|
|
34
|
+
let r = f === "parent" && C.current?.parentElement ? C.current.parentElement.getBoundingClientRect() : {
|
|
35
|
+
left: 0,
|
|
36
|
+
top: 0,
|
|
37
|
+
right: window.innerWidth,
|
|
38
|
+
bottom: window.innerHeight
|
|
39
|
+
}, i = r.left - n.left, a = r.right - n.width - n.left, o = r.top - n.top, s = r.bottom - n.height - n.top;
|
|
40
|
+
return {
|
|
41
|
+
x: Math.min(Math.max(e, Math.min(i, a)), Math.max(i, a)),
|
|
42
|
+
y: Math.min(Math.max(t, Math.min(o, s)), Math.max(o, s))
|
|
43
|
+
};
|
|
44
|
+
}, [f]), z = n((e) => {
|
|
45
|
+
O.current = e, w || E(e), g?.(e);
|
|
46
|
+
}, [w, g]), B = n((e) => {
|
|
47
|
+
if (m || e.button > 0) return;
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
let t = O.current;
|
|
50
|
+
j.current = {
|
|
51
|
+
startX: e.clientX,
|
|
52
|
+
startY: e.clientY,
|
|
53
|
+
origin: t,
|
|
54
|
+
base: L(t)
|
|
55
|
+
}, A(!0), h?.(t);
|
|
56
|
+
}, [
|
|
57
|
+
m,
|
|
58
|
+
L,
|
|
59
|
+
h
|
|
60
|
+
]);
|
|
61
|
+
i(() => {
|
|
62
|
+
if (!k) return;
|
|
63
|
+
let e = (e) => {
|
|
64
|
+
let t = j.current;
|
|
65
|
+
if (!t) return;
|
|
66
|
+
let n = d === "y" ? t.origin.x : t.origin.x + (e.clientX - t.startX), r = d === "x" ? t.origin.y : t.origin.y + (e.clientY - t.startY);
|
|
67
|
+
z(R(n, r, t.base));
|
|
68
|
+
}, t = () => {
|
|
69
|
+
A(!1), j.current = null, _?.(O.current);
|
|
70
|
+
};
|
|
71
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
|
|
72
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
|
|
73
|
+
};
|
|
74
|
+
}, [
|
|
75
|
+
k,
|
|
76
|
+
d,
|
|
77
|
+
R,
|
|
78
|
+
z,
|
|
79
|
+
_
|
|
80
|
+
]), i(() => {
|
|
81
|
+
if (f === "none" || typeof window > "u") return;
|
|
82
|
+
let e = () => {
|
|
83
|
+
if (j.current) return;
|
|
84
|
+
let e = O.current, t = R(e.x, e.y, L(e));
|
|
85
|
+
(t.x !== e.x || t.y !== e.y) && z(t);
|
|
86
|
+
}, t = C.current, n = typeof ResizeObserver > "u" ? null : new ResizeObserver(e);
|
|
87
|
+
return t && (n?.observe(t), f === "parent" && t.parentElement && n?.observe(t.parentElement)), window.addEventListener("resize", e), () => {
|
|
88
|
+
n?.disconnect(), window.removeEventListener("resize", e);
|
|
89
|
+
};
|
|
90
|
+
}, [
|
|
91
|
+
f,
|
|
92
|
+
R,
|
|
93
|
+
z,
|
|
94
|
+
L
|
|
95
|
+
]);
|
|
96
|
+
let V = {
|
|
97
|
+
startPointerDrag: B,
|
|
98
|
+
onHandleKeyDown: n((e) => {
|
|
99
|
+
if (m) return;
|
|
100
|
+
let t = {
|
|
101
|
+
ArrowLeft: [-p, 0],
|
|
102
|
+
ArrowRight: [p, 0],
|
|
103
|
+
ArrowUp: [0, -p],
|
|
104
|
+
ArrowDown: [0, p]
|
|
105
|
+
}[e.key];
|
|
106
|
+
if (!t || d === "x" && t[1] !== 0 || d === "y" && t[0] !== 0) return;
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
let n = O.current, r = R(n.x + t[0], n.y + t[1], L(n));
|
|
109
|
+
z(r), _?.(r);
|
|
110
|
+
}, [
|
|
111
|
+
d,
|
|
112
|
+
R,
|
|
113
|
+
z,
|
|
114
|
+
m,
|
|
115
|
+
L,
|
|
116
|
+
p,
|
|
117
|
+
_
|
|
118
|
+
]),
|
|
119
|
+
registerHandle: F,
|
|
120
|
+
handleClassName: v?.handle,
|
|
121
|
+
disabled: m,
|
|
122
|
+
dragging: k
|
|
123
|
+
}, H = `translate(${D.x}px, ${D.y}px)`, U = {
|
|
124
|
+
...b,
|
|
125
|
+
transform: b?.transform ? `${H} ${b.transform}` : H
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
128
|
+
value: V,
|
|
129
|
+
children: /* @__PURE__ */ l("div", {
|
|
130
|
+
ref: I,
|
|
131
|
+
className: s(c.root, !N && !m && c.surfaceDraggable, k && c.dragging, v?.root, y),
|
|
132
|
+
style: U,
|
|
133
|
+
onPointerDown: N ? void 0 : B,
|
|
134
|
+
...x,
|
|
135
|
+
children: e
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
d.displayName = "Draggable";
|
|
140
|
+
function f({ children: e, className: t, style: n, ...a }) {
|
|
141
|
+
let o = r(u);
|
|
142
|
+
if (!o) throw Error("Draggable.Handle must be rendered inside a <Draggable>.");
|
|
143
|
+
return i(() => o.registerHandle(), [o.registerHandle]), /* @__PURE__ */ l("div", {
|
|
144
|
+
className: s(c.handle, o.disabled && c.handleDisabled, o.dragging && c.handleDragging, o.handleClassName, t),
|
|
145
|
+
style: n,
|
|
146
|
+
role: "button",
|
|
147
|
+
"aria-label": "Drag handle",
|
|
148
|
+
"aria-disabled": o.disabled || void 0,
|
|
149
|
+
tabIndex: o.disabled ? -1 : 0,
|
|
150
|
+
onPointerDown: o.startPointerDrag,
|
|
151
|
+
onKeyDown: o.onHandleKeyDown,
|
|
152
|
+
...a,
|
|
153
|
+
children: e
|
|
154
|
+
});
|
|
160
155
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
export {
|
|
164
|
-
ct as Draggable
|
|
165
|
-
};
|
|
156
|
+
f.displayName = "Draggable.Handle";
|
|
157
|
+
var p = Object.assign(d, { Handle: f });
|
|
158
|
+
export { p as Draggable };
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
l as default,
|
|
11
|
-
n as dragging,
|
|
12
|
-
r as handle,
|
|
13
|
-
d as handleDisabled,
|
|
14
|
-
e as handleDragging,
|
|
15
|
-
a as root,
|
|
16
|
-
g as surfaceDraggable
|
|
1
|
+
// src/components/Draggable/Draggable.module.scss
|
|
2
|
+
var e = "crk-root-5Kdf2", t = "crk-surfaceDraggable-mIpX8", n = "crk-dragging-XtMt7", r = "crk-handle-r4nFh", i = "crk-handleDragging-FRObk", a = "crk-handleDisabled-8t94h", o = {
|
|
3
|
+
root: e,
|
|
4
|
+
surfaceDraggable: t,
|
|
5
|
+
dragging: n,
|
|
6
|
+
handle: r,
|
|
7
|
+
handleDragging: i,
|
|
8
|
+
handleDisabled: a
|
|
17
9
|
};
|
|
10
|
+
export { o as default, n as dragging, r as handle, a as handleDisabled, i as handleDragging, e as root, t as surfaceDraggable };
|
|
@@ -1,129 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import l from "
|
|
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 { createContext as e, forwardRef as t, useContext as n, useEffect as r, useId as i, useRef as a, useState as o } from "react";
|
|
2
|
+
import { createPortal as s } from "react-dom";
|
|
3
|
+
import c from "clsx";
|
|
4
|
+
import { useFocusTrap as l } from "../../hooks/useFocusTrap.js";
|
|
5
|
+
import { EscapeLayerProvider as u, useEscapeLayer as d } from "../../hooks/useEscapeLayer.js";
|
|
6
|
+
import f from "./Drawer.module.scss.js";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
// src/components/Drawer/Drawer.tsx
|
|
9
|
+
var h = e({
|
|
10
|
+
classes: {},
|
|
11
|
+
titleId: ""
|
|
12
|
+
}), g = ({ children: e, className: t, style: r, onClose: i }) => {
|
|
13
|
+
let { classes: a, titleId: o } = n(h);
|
|
14
|
+
return /* @__PURE__ */ m("div", {
|
|
15
|
+
className: c(f.header, i && f.headerWithClose, a.header, t),
|
|
16
|
+
style: r,
|
|
17
|
+
children: [/* @__PURE__ */ p("div", {
|
|
18
|
+
id: o,
|
|
19
|
+
className: c(f.headerTitle, a.headerTitle),
|
|
20
|
+
children: e
|
|
21
|
+
}), i && /* @__PURE__ */ p("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
className: c(f.closeButton, a.closeButton),
|
|
24
|
+
onClick: i,
|
|
25
|
+
"aria-label": "Close",
|
|
26
|
+
children: "×"
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
g.displayName = "Drawer.Header";
|
|
31
|
+
var _ = ({ children: e, className: t, style: r }) => {
|
|
32
|
+
let { classes: i } = n(h);
|
|
33
|
+
return /* @__PURE__ */ p("div", {
|
|
34
|
+
className: c(f.body, i.body, t),
|
|
35
|
+
style: r,
|
|
36
|
+
children: e
|
|
37
|
+
});
|
|
35
38
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
open: e,
|
|
45
|
-
onClose: s,
|
|
46
|
-
side: a = "right",
|
|
47
|
-
size: o = "md",
|
|
48
|
-
variant: i = "temporary",
|
|
49
|
-
closeOnBackdrop: p = !0,
|
|
50
|
-
closeOnEscape: C = !0,
|
|
51
|
-
classes: y,
|
|
52
|
-
className: _,
|
|
53
|
-
style: $,
|
|
54
|
-
children: A,
|
|
55
|
-
"aria-label": N,
|
|
56
|
-
"aria-labelledby": E
|
|
57
|
-
}, n) => {
|
|
58
|
-
const B = S(null), F = (r) => {
|
|
59
|
-
B.current = r, typeof n == "function" ? n(r) : n && (n.current = r);
|
|
60
|
-
}, O = G(), T = E ?? `${O}-title`, v = i === "temporary", [d, g] = u(e), [k, D] = u(!1), [I, H] = u(a), [P, j] = u(o);
|
|
61
|
-
h(() => {
|
|
62
|
-
e && (g(!0), D(!1), H(a), j(o));
|
|
63
|
-
}, [e, a, o]), h(() => {
|
|
64
|
-
if (e || !d) return;
|
|
65
|
-
D(!0);
|
|
66
|
-
const r = setTimeout(() => g(!1), Y);
|
|
67
|
-
return () => clearTimeout(r);
|
|
68
|
-
}, [e, d]), Q(B, d && e && v);
|
|
69
|
-
const L = V(() => {
|
|
70
|
-
C && s();
|
|
71
|
-
}, e);
|
|
72
|
-
h(() => {
|
|
73
|
-
if (!d) return;
|
|
74
|
-
const r = document.body.style.overflow;
|
|
75
|
-
return document.body.style.overflow = "hidden", () => {
|
|
76
|
-
document.body.style.overflow = r;
|
|
77
|
-
};
|
|
78
|
-
}, [d]);
|
|
79
|
-
const b = S(!1), U = (r) => {
|
|
80
|
-
b.current = r.target === r.currentTarget;
|
|
81
|
-
}, W = (r) => {
|
|
82
|
-
p && b.current && r.target === r.currentTarget && s(), b.current = !1;
|
|
83
|
-
};
|
|
84
|
-
return d ? K(
|
|
85
|
-
/* @__PURE__ */ c(
|
|
86
|
-
"div",
|
|
87
|
-
{
|
|
88
|
-
className: l(
|
|
89
|
-
t.backdrop,
|
|
90
|
-
k && t.backdropClosing,
|
|
91
|
-
!v && t.backdropBare,
|
|
92
|
-
y?.backdrop
|
|
93
|
-
),
|
|
94
|
-
onMouseDown: U,
|
|
95
|
-
onMouseUp: W,
|
|
96
|
-
role: "presentation",
|
|
97
|
-
children: /* @__PURE__ */ c(
|
|
98
|
-
"div",
|
|
99
|
-
{
|
|
100
|
-
ref: F,
|
|
101
|
-
className: l(
|
|
102
|
-
t.drawer,
|
|
103
|
-
t[`side_${I}`],
|
|
104
|
-
t[`size_${P}`],
|
|
105
|
-
t[`${k ? "slideOut" : "slideIn"}_${I}`],
|
|
106
|
-
y?.drawer,
|
|
107
|
-
_
|
|
108
|
-
),
|
|
109
|
-
style: $,
|
|
110
|
-
role: "dialog",
|
|
111
|
-
"aria-modal": v ? "true" : void 0,
|
|
112
|
-
"aria-label": N,
|
|
113
|
-
"aria-labelledby": N ? void 0 : T,
|
|
114
|
-
children: /* @__PURE__ */ c(m.Provider, { value: { classes: y ?? {}, titleId: T }, children: /* @__PURE__ */ c(X, { value: L, children: A }) })
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
document.body
|
|
120
|
-
) : null;
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
f.displayName = "Drawer";
|
|
124
|
-
f.Header = x;
|
|
125
|
-
f.Body = R;
|
|
126
|
-
f.Footer = M;
|
|
127
|
-
export {
|
|
128
|
-
f as Drawer
|
|
39
|
+
_.displayName = "Drawer.Body";
|
|
40
|
+
var v = ({ children: e, className: t, style: r }) => {
|
|
41
|
+
let { classes: i } = n(h);
|
|
42
|
+
return /* @__PURE__ */ p("div", {
|
|
43
|
+
className: c(f.footer, i.footer, t),
|
|
44
|
+
style: r,
|
|
45
|
+
children: e
|
|
46
|
+
});
|
|
129
47
|
};
|
|
48
|
+
v.displayName = "Drawer.Footer";
|
|
49
|
+
var y = 340, b = t(({ open: e, onClose: t, side: n = "right", size: m = "md", variant: g = "temporary", closeOnBackdrop: _ = !0, closeOnEscape: v = !0, classes: b, className: x, style: S, children: C, "aria-label": w, "aria-labelledby": T }, E) => {
|
|
50
|
+
let D = a(null), O = (e) => {
|
|
51
|
+
D.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
|
|
52
|
+
}, k = i(), A = T ?? `${k}-title`, j = g === "temporary", [M, N] = o(e), [P, F] = o(!1), [I, L] = o(n), [R, z] = o(m);
|
|
53
|
+
r(() => {
|
|
54
|
+
e && (N(!0), F(!1), L(n), z(m));
|
|
55
|
+
}, [
|
|
56
|
+
e,
|
|
57
|
+
n,
|
|
58
|
+
m
|
|
59
|
+
]), r(() => {
|
|
60
|
+
if (e || !M) return;
|
|
61
|
+
F(!0);
|
|
62
|
+
let t = setTimeout(() => N(!1), y);
|
|
63
|
+
return () => clearTimeout(t);
|
|
64
|
+
}, [e, M]), l(D, M && e && j);
|
|
65
|
+
let B = d(() => {
|
|
66
|
+
v && t();
|
|
67
|
+
}, e);
|
|
68
|
+
r(() => {
|
|
69
|
+
if (!M) return;
|
|
70
|
+
let e = document.body.style.overflow;
|
|
71
|
+
return document.body.style.overflow = "hidden", () => {
|
|
72
|
+
document.body.style.overflow = e;
|
|
73
|
+
};
|
|
74
|
+
}, [M]);
|
|
75
|
+
let V = a(!1);
|
|
76
|
+
return M ? s(/* @__PURE__ */ p("div", {
|
|
77
|
+
className: c(f.backdrop, P && f.backdropClosing, !j && f.backdropBare, b?.backdrop),
|
|
78
|
+
onMouseDown: (e) => {
|
|
79
|
+
V.current = e.target === e.currentTarget;
|
|
80
|
+
},
|
|
81
|
+
onMouseUp: (e) => {
|
|
82
|
+
_ && V.current && e.target === e.currentTarget && t(), V.current = !1;
|
|
83
|
+
},
|
|
84
|
+
role: "presentation",
|
|
85
|
+
children: /* @__PURE__ */ p("div", {
|
|
86
|
+
ref: O,
|
|
87
|
+
className: c(f.drawer, f[`side_${I}`], f[`size_${R}`], f[`${P ? "slideOut" : "slideIn"}_${I}`], b?.drawer, x),
|
|
88
|
+
style: S,
|
|
89
|
+
role: "dialog",
|
|
90
|
+
"aria-modal": j ? "true" : void 0,
|
|
91
|
+
"aria-label": w,
|
|
92
|
+
"aria-labelledby": w ? void 0 : A,
|
|
93
|
+
children: /* @__PURE__ */ p(h.Provider, {
|
|
94
|
+
value: {
|
|
95
|
+
classes: b ?? {},
|
|
96
|
+
titleId: A
|
|
97
|
+
},
|
|
98
|
+
children: /* @__PURE__ */ p(u, {
|
|
99
|
+
value: B,
|
|
100
|
+
children: C
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
}), document.body) : null;
|
|
105
|
+
});
|
|
106
|
+
b.displayName = "Drawer", b.Header = g, b.Body = _, b.Footer = v;
|
|
107
|
+
export { b as Drawer };
|