@overdoser/react-toolkit 0.21.0 → 0.22.1
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 -0
- package/CHANGELOG.md +35 -0
- package/components/Accordion/Accordion.js +48 -48
- package/components/ActionButton/ActionButton.js +23 -23
- package/components/ActionButton/CopyButton.js +5 -5
- package/components/Alert/Alert.js +13 -13
- package/components/Avatar/Avatar.js +12 -12
- package/components/Badge/Badge.js +6 -6
- package/components/Breadcrumbs/Breadcrumbs.js +15 -15
- package/components/Button/Button.js +14 -14
- package/components/Card/Card.js +26 -26
- package/components/Chart/AreaChart.js +103 -103
- package/components/Chart/Axis.js +7 -7
- package/components/Chart/BarChart.js +62 -62
- package/components/Chart/ChartContainer.js +11 -11
- package/components/Chart/ChartLegend.js +7 -7
- package/components/Chart/ChartTooltip.js +13 -13
- package/components/Chart/LineChart.js +88 -88
- package/components/Chart/PieChart.js +25 -25
- package/components/Chart/RadarChart.js +42 -42
- package/components/Chart/Sparkline.js +11 -11
- package/components/Chart/TradingChart.js +126 -126
- package/components/Chart/trading/period.js +3 -3
- package/components/Chip/Chip.js +24 -24
- package/components/CodeBlock/CodeBlock.js +31 -31
- package/components/CommandPalette/CommandPalette.js +166 -166
- package/components/ConfirmDialog/ConfirmDialog.js +60 -60
- package/components/Divider/Divider.js +10 -10
- package/components/Draggable/Draggable.js +29 -29
- package/components/Drawer/Drawer.js +53 -53
- package/components/Dropdown/Dropdown.js +66 -66
- package/components/Dropdown/DropdownItem.js +13 -13
- package/components/Dropdown/DropdownLabel.js +5 -5
- package/components/Dropdown/DropdownSeparator.js +5 -5
- package/components/Dropzone/Dropzone.js +15 -15
- package/components/EmptyState/EmptyState.js +11 -11
- package/components/Form/Form.js +17 -17
- package/components/Form/FormField.js +21 -21
- package/components/Form/FormRow.js +3 -3
- package/components/ImageViewer/ImageViewer.js +118 -118
- package/components/Kbd/Kbd.js +11 -11
- package/components/KeyValueList/KeyValueList.js +32 -32
- package/components/Link/Link.js +7 -7
- package/components/List/List.js +7 -7
- package/components/Loader/Loader.js +39 -39
- package/components/Modal/Modal.js +48 -48
- package/components/PageHeader/PageHeader.js +18 -18
- package/components/Pagination/Pagination.js +23 -23
- package/components/Popover/Popover.js +25 -25
- package/components/ProgressBar/ProgressBar.js +17 -17
- package/components/RelativeTime/RelativeTime.js +10 -10
- package/components/SegmentedControl/SegmentedControl.js +38 -38
- package/components/Skeleton/Skeleton.js +10 -10
- package/components/Spinner/Spinner.js +7 -7
- package/components/SplitButton/SplitButton.js +63 -63
- package/components/SplitPane/SplitPane.js +50 -50
- package/components/StatCard/StatCard.js +32 -32
- package/components/StatusDot/StatusDot.js +7 -7
- package/components/Table/Table.js +174 -174
- package/components/Tabs/Tabs.js +47 -47
- package/components/ThemeToggle/ThemeToggle.js +31 -31
- package/components/Timeline/GanttTimeline.js +213 -213
- package/components/Timeline/HistoryTimeline.js +306 -306
- package/components/Timeline/TimelineShared.js +103 -103
- package/components/Timeline/TraceEventDetails.js +103 -103
- package/components/Timeline/TraceTimeline.js +546 -546
- package/components/Timeline/historyLayout.js +2 -2
- package/components/Timer/Timer.js +39 -39
- package/components/Toast/Toast.js +59 -59
- package/components/ToggleIconButton/ToggleIconButton.js +9 -9
- package/components/Tooltip/Tooltip.js +16 -16
- package/components/Typography/Typography.js +5 -5
- package/components/inputs/Checkbox/Checkbox.js +11 -11
- package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
- package/components/inputs/DatePicker/CalendarPanel.js +113 -113
- package/components/inputs/DatePicker/DatePicker.js +39 -39
- package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
- package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
- package/components/inputs/DateTimePicker/TimeField.js +34 -34
- package/components/inputs/Input/Input.js +13 -13
- package/components/inputs/NumberInput/NumberInput.js +16 -16
- package/components/inputs/Radio/Radio.js +17 -17
- package/components/inputs/SearchInput/SearchInput.js +25 -25
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +485 -344
- package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
- package/components/inputs/Slider/Slider.js +21 -21
- package/components/inputs/Switch/Switch.js +4 -4
- package/components/inputs/Textarea/Textarea.js +8 -8
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +6 -3
- package/hooks/useResizable.js +1 -1
- package/hooks/useTheme.js +7 -7
- package/index.css +1 -1
- package/index.js +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +25 -4
- package/manifest.json +33 -4
- package/package.json +1 -1
- /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
- /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
- /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
- /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
- /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
- /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
- /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
- /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
- /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
- /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
- /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
- /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
- /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
- /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
- /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
- /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
- /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
- /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
- /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
- /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
- /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
- /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
- /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
- /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
- /package/components/List/{List.module.js → List.module.scss.js} +0 -0
- /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
- /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
- /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
- /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
- /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
- /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
- /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
- /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
- /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
- /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
- /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
- /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
- /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
- /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
- /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
- /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
- /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
- /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
- /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
- /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
- /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
- /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
- /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
- /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
- /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
- /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
- /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
- /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
- /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
- /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
- /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import p from "
|
|
1
|
+
import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
2
|
+
import l from "clsx";
|
|
3
|
+
import { Modal as u } from "../Modal/Modal.js";
|
|
4
|
+
import { Button as d } from "../Button/Button.js";
|
|
5
|
+
import { Input as f } from "../inputs/Input/Input.js";
|
|
6
|
+
import p from "./ConfirmDialog.module.scss.js";
|
|
7
7
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
8
|
// src/components/ConfirmDialog/ConfirmDialog.tsx
|
|
9
9
|
var g = /* @__PURE__ */ m("svg", {
|
|
@@ -15,27 +15,27 @@ var g = /* @__PURE__ */ m("svg", {
|
|
|
15
15
|
d: "M8.26 3.1c.77-1.33 2.71-1.33 3.48 0l5.58 9.67c.77 1.33-.19 3-1.74 3H4.42c-1.55 0-2.51-1.67-1.74-3L8.26 3.1zM10 7a1 1 0 011 1v3a1 1 0 11-2 0V8a1 1 0 011-1zm0 7a1 1 0 100-2 1 1 0 000 2z",
|
|
16
16
|
clipRule: "evenodd"
|
|
17
17
|
})
|
|
18
|
-
}), _ = (e) => String(e?.message ?? e), v =
|
|
19
|
-
let [P, F] =
|
|
20
|
-
|
|
18
|
+
}), _ = (e) => String(e?.message ?? e), v = t(({ open: e, onConfirm: t, onCancel: r, title: v = "Are you sure?", description: y, children: b, confirmLabel: x = "Confirm", cancelLabel: S = "Cancel", danger: C = !1, requireText: w, icon: T, autoFocus: E, closeOnBackdrop: D = !0, errorMessage: O = _, "aria-label": k, classes: A, className: j, style: M }, N) => {
|
|
19
|
+
let [P, F] = c(!1), [I, L] = c(void 0), [R, z] = c(""), B = s(null), V = s(null), H = s(null), U = s(!0), W = a();
|
|
20
|
+
i(() => (U.current = !0, () => {
|
|
21
21
|
U.current = !1;
|
|
22
|
-
}), []),
|
|
23
|
-
|
|
24
|
-
}, [
|
|
22
|
+
}), []), i(() => {
|
|
23
|
+
e || (F(!1), L(void 0), z(""));
|
|
24
|
+
}, [e]);
|
|
25
25
|
let G = E ?? (C ? "cancel" : "confirm");
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
i(() => {
|
|
27
|
+
e && (w ? H.current : G === "cancel" ? V.current : B.current)?.focus();
|
|
28
28
|
}, [
|
|
29
|
-
|
|
29
|
+
e,
|
|
30
30
|
G,
|
|
31
31
|
w
|
|
32
32
|
]);
|
|
33
|
-
let K = w === void 0 || R === w, q = K && !P, J =
|
|
33
|
+
let K = w === void 0 || R === w, q = K && !P, J = n(async () => {
|
|
34
34
|
if (!q) return;
|
|
35
35
|
L(void 0);
|
|
36
36
|
let e;
|
|
37
37
|
try {
|
|
38
|
-
e =
|
|
38
|
+
e = t();
|
|
39
39
|
} catch (e) {
|
|
40
40
|
L(e);
|
|
41
41
|
return;
|
|
@@ -50,57 +50,57 @@ var g = /* @__PURE__ */ m("svg", {
|
|
|
50
50
|
U.current && F(!1);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}, [q,
|
|
54
|
-
P ||
|
|
55
|
-
}, [P,
|
|
53
|
+
}, [q, t]), Y = n(() => {
|
|
54
|
+
P || r();
|
|
55
|
+
}, [P, r]), X = T === !1 ? null : T === void 0 ? C ? g : null : T, Z = o(() => ({
|
|
56
56
|
modal: A?.modal,
|
|
57
57
|
header: A?.header,
|
|
58
58
|
body: A?.body,
|
|
59
59
|
footer: A?.footer
|
|
60
60
|
}), [A]);
|
|
61
|
-
return /* @__PURE__ */ h(
|
|
61
|
+
return /* @__PURE__ */ h(u, {
|
|
62
62
|
ref: N,
|
|
63
|
-
open:
|
|
63
|
+
open: e,
|
|
64
64
|
onClose: Y,
|
|
65
65
|
size: "sm",
|
|
66
66
|
closeOnBackdrop: D && !P,
|
|
67
67
|
closeOnEscape: !P,
|
|
68
68
|
classes: Z,
|
|
69
|
-
className: p
|
|
69
|
+
className: l(p.root, C && p.danger, j),
|
|
70
70
|
style: M,
|
|
71
71
|
"aria-label": typeof v == "string" ? v : v ? void 0 : k,
|
|
72
72
|
children: [
|
|
73
|
-
v ? /* @__PURE__ */ m(
|
|
73
|
+
v ? /* @__PURE__ */ m(u.Header, {
|
|
74
74
|
onClose: P ? void 0 : Y,
|
|
75
75
|
children: /* @__PURE__ */ h("span", {
|
|
76
|
-
className:
|
|
76
|
+
className: p.titleRow,
|
|
77
77
|
children: [X && /* @__PURE__ */ m("span", {
|
|
78
|
-
className: p
|
|
78
|
+
className: l(p.icon, A?.icon),
|
|
79
79
|
"aria-hidden": "true",
|
|
80
80
|
children: X
|
|
81
81
|
}), /* @__PURE__ */ m("span", {
|
|
82
|
-
className:
|
|
82
|
+
className: p.title,
|
|
83
83
|
children: v
|
|
84
84
|
})]
|
|
85
85
|
})
|
|
86
86
|
}) : null,
|
|
87
|
-
/* @__PURE__ */ h(
|
|
87
|
+
/* @__PURE__ */ h(u.Body, { children: [
|
|
88
88
|
y && /* @__PURE__ */ m("div", {
|
|
89
|
-
className: p
|
|
89
|
+
className: l(p.description, A?.description),
|
|
90
90
|
children: y
|
|
91
91
|
}),
|
|
92
92
|
b,
|
|
93
93
|
w !== void 0 && /* @__PURE__ */ h("div", {
|
|
94
|
-
className: p
|
|
94
|
+
className: l(p.input, A?.input),
|
|
95
95
|
children: [/* @__PURE__ */ h("label", {
|
|
96
96
|
htmlFor: W,
|
|
97
|
-
className:
|
|
97
|
+
className: p.inputLabel,
|
|
98
98
|
children: [
|
|
99
99
|
"Type ",
|
|
100
100
|
/* @__PURE__ */ m("b", { children: w }),
|
|
101
101
|
" to confirm"
|
|
102
102
|
]
|
|
103
|
-
}), /* @__PURE__ */ m(
|
|
103
|
+
}), /* @__PURE__ */ m(f, {
|
|
104
104
|
ref: H,
|
|
105
105
|
id: W,
|
|
106
106
|
value: R,
|
|
@@ -116,37 +116,37 @@ var g = /* @__PURE__ */ m("svg", {
|
|
|
116
116
|
}),
|
|
117
117
|
I !== void 0 && /* @__PURE__ */ m("div", {
|
|
118
118
|
role: "alert",
|
|
119
|
-
className: p
|
|
119
|
+
className: l(p.error, A?.error),
|
|
120
120
|
children: O(I)
|
|
121
121
|
})
|
|
122
122
|
] }),
|
|
123
|
-
/* @__PURE__ */ h(
|
|
123
|
+
/* @__PURE__ */ h(u.Footer, { children: [/* @__PURE__ */ m(d, {
|
|
124
124
|
ref: V,
|
|
125
125
|
variant: "ghost",
|
|
126
126
|
onClick: Y,
|
|
127
127
|
disabled: P,
|
|
128
|
-
className: p
|
|
128
|
+
className: l(p.cancel, A?.cancel),
|
|
129
129
|
children: S
|
|
130
|
-
}), /* @__PURE__ */ m(
|
|
130
|
+
}), /* @__PURE__ */ m(d, {
|
|
131
131
|
ref: B,
|
|
132
132
|
variant: C ? "danger" : "primary",
|
|
133
133
|
onClick: () => void J(),
|
|
134
134
|
loading: P,
|
|
135
135
|
disabled: !K,
|
|
136
|
-
className: p
|
|
136
|
+
className: l(p.confirm, A?.confirm),
|
|
137
137
|
children: x
|
|
138
138
|
})] })
|
|
139
139
|
]
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
v.displayName = "ConfirmDialog";
|
|
143
|
-
var y =
|
|
143
|
+
var y = e(null), b = 0;
|
|
144
144
|
function x({ children: e, defaults: t }) {
|
|
145
|
-
let [
|
|
146
|
-
|
|
147
|
-
let
|
|
148
|
-
|
|
149
|
-
let
|
|
145
|
+
let [r, i] = c(null), a = s(null);
|
|
146
|
+
a.current = r;
|
|
147
|
+
let o = n((e = {}) => new Promise((n) => {
|
|
148
|
+
a.current?.resolve(!1);
|
|
149
|
+
let r = {
|
|
150
150
|
id: ++b,
|
|
151
151
|
options: {
|
|
152
152
|
...t,
|
|
@@ -154,32 +154,32 @@ function x({ children: e, defaults: t }) {
|
|
|
154
154
|
},
|
|
155
155
|
resolve: n
|
|
156
156
|
};
|
|
157
|
-
|
|
158
|
-
}), [t]),
|
|
159
|
-
|
|
160
|
-
}, []),
|
|
161
|
-
let e =
|
|
157
|
+
a.current = r, i(r);
|
|
158
|
+
}), [t]), l = n((e, t) => {
|
|
159
|
+
a.current === e && (a.current = null, i(null), e.resolve(t));
|
|
160
|
+
}, []), u = n(async () => {
|
|
161
|
+
let e = a.current;
|
|
162
162
|
if (!e) return;
|
|
163
163
|
let t = e.options.onConfirm?.();
|
|
164
|
-
t && typeof t.then == "function" && await t,
|
|
165
|
-
}, [
|
|
166
|
-
let e =
|
|
167
|
-
e &&
|
|
168
|
-
}, [
|
|
164
|
+
t && typeof t.then == "function" && await t, l(e, !0);
|
|
165
|
+
}, [l]), d = n(() => {
|
|
166
|
+
let e = a.current;
|
|
167
|
+
e && l(e, !1);
|
|
168
|
+
}, [l]), { body: f, onConfirm: p, ...g } = r?.options ?? {};
|
|
169
169
|
return /* @__PURE__ */ h(y.Provider, {
|
|
170
|
-
value:
|
|
170
|
+
value: o,
|
|
171
171
|
children: [e, /* @__PURE__ */ m(v, {
|
|
172
172
|
...g,
|
|
173
|
-
open:
|
|
174
|
-
onConfirm:
|
|
175
|
-
onCancel:
|
|
176
|
-
children:
|
|
177
|
-
},
|
|
173
|
+
open: r !== null,
|
|
174
|
+
onConfirm: u,
|
|
175
|
+
onCancel: d,
|
|
176
|
+
children: f
|
|
177
|
+
}, r?.id ?? "idle")]
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
x.displayName = "ConfirmProvider";
|
|
181
181
|
function S() {
|
|
182
|
-
let e =
|
|
182
|
+
let e = r(y);
|
|
183
183
|
if (!e) throw Error("useConfirm() must be used inside a <ConfirmProvider>.");
|
|
184
184
|
return e;
|
|
185
185
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import n from "./Divider.module.scss.js";
|
|
4
4
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
// src/components/Divider/Divider.tsx
|
|
6
|
-
var o =
|
|
7
|
-
let p = s != null &&
|
|
6
|
+
var o = e(({ orientation: e = "horizontal", variant: o = "solid", label: s, labelPosition: c = "center", classes: l, className: u, ...d }, f) => {
|
|
7
|
+
let p = s != null && e === "horizontal";
|
|
8
8
|
return /* @__PURE__ */ i("div", {
|
|
9
9
|
ref: f,
|
|
10
10
|
role: "separator",
|
|
11
|
-
"aria-orientation":
|
|
12
|
-
className: n
|
|
11
|
+
"aria-orientation": e,
|
|
12
|
+
className: t(n.root, n[e], n[o], p && n.withLabel, p && n[`label_${c}`], l?.root, u),
|
|
13
13
|
...d,
|
|
14
14
|
children: p ? /* @__PURE__ */ a(r, { children: [
|
|
15
|
-
/* @__PURE__ */ i("span", { className: n
|
|
15
|
+
/* @__PURE__ */ i("span", { className: t(n.line, l?.line) }),
|
|
16
16
|
/* @__PURE__ */ i("span", {
|
|
17
|
-
className: n
|
|
17
|
+
className: t(n.label, l?.label),
|
|
18
18
|
children: s
|
|
19
19
|
}),
|
|
20
|
-
/* @__PURE__ */ i("span", { className: n
|
|
20
|
+
/* @__PURE__ */ i("span", { className: t(n.line, l?.line) })
|
|
21
21
|
] }) : null
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import c from "
|
|
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
4
|
import { jsx as l } from "react/jsx-runtime";
|
|
5
5
|
// src/components/Draggable/Draggable.tsx
|
|
6
|
-
var u =
|
|
7
|
-
let C =
|
|
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
8
|
x: 0,
|
|
9
9
|
y: 0
|
|
10
|
-
}), D = w ?
|
|
10
|
+
}), D = w ? r : T, O = a(D);
|
|
11
11
|
O.current = D;
|
|
12
|
-
let [k, A] =
|
|
12
|
+
let [k, A] = o(!1), j = a(null), M = a(0), [N, P] = o(!1), F = n(() => (M.current += 1, P(!0), () => {
|
|
13
13
|
--M.current, M.current === 0 && P(!1);
|
|
14
|
-
}), []), I =
|
|
14
|
+
}), []), I = n((e) => {
|
|
15
15
|
C.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
16
|
-
}, [S]), L =
|
|
16
|
+
}, [S]), L = n((e) => {
|
|
17
17
|
let t = C.current?.getBoundingClientRect();
|
|
18
18
|
return t ? {
|
|
19
19
|
left: t.left - e.x,
|
|
@@ -26,7 +26,7 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
26
26
|
width: 0,
|
|
27
27
|
height: 0
|
|
28
28
|
};
|
|
29
|
-
}, []), R =
|
|
29
|
+
}, []), R = n((e, t, n) => {
|
|
30
30
|
if (f === "none" || typeof window > "u") return {
|
|
31
31
|
x: e,
|
|
32
32
|
y: t
|
|
@@ -41,9 +41,9 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
41
41
|
x: Math.min(Math.max(e, Math.min(i, a)), Math.max(i, a)),
|
|
42
42
|
y: Math.min(Math.max(t, Math.min(o, s)), Math.max(o, s))
|
|
43
43
|
};
|
|
44
|
-
}, [f]), z =
|
|
44
|
+
}, [f]), z = n((e) => {
|
|
45
45
|
O.current = e, w || E(e), g?.(e);
|
|
46
|
-
}, [w, g]), B =
|
|
46
|
+
}, [w, g]), B = n((e) => {
|
|
47
47
|
if (m || e.button > 0) return;
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
let t = O.current;
|
|
@@ -58,7 +58,7 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
58
58
|
L,
|
|
59
59
|
h
|
|
60
60
|
]);
|
|
61
|
-
|
|
61
|
+
i(() => {
|
|
62
62
|
if (!k) return;
|
|
63
63
|
let e = (e) => {
|
|
64
64
|
let t = j.current;
|
|
@@ -77,7 +77,7 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
77
77
|
R,
|
|
78
78
|
z,
|
|
79
79
|
_
|
|
80
|
-
]),
|
|
80
|
+
]), i(() => {
|
|
81
81
|
if (f === "none" || typeof window > "u") return;
|
|
82
82
|
let e = () => {
|
|
83
83
|
if (j.current) return;
|
|
@@ -95,7 +95,7 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
95
95
|
]);
|
|
96
96
|
let V = {
|
|
97
97
|
startPointerDrag: B,
|
|
98
|
-
onHandleKeyDown:
|
|
98
|
+
onHandleKeyDown: n((e) => {
|
|
99
99
|
if (m) return;
|
|
100
100
|
let t = {
|
|
101
101
|
ArrowLeft: [-p, 0],
|
|
@@ -128,29 +128,29 @@ var u = t(null), d = n(({ children: t, defaultPosition: n, position: i, axis: d
|
|
|
128
128
|
value: V,
|
|
129
129
|
children: /* @__PURE__ */ l("div", {
|
|
130
130
|
ref: I,
|
|
131
|
-
className: c
|
|
131
|
+
className: s(c.root, !N && !m && c.surfaceDraggable, k && c.dragging, v?.root, y),
|
|
132
132
|
style: U,
|
|
133
133
|
onPointerDown: N ? void 0 : B,
|
|
134
134
|
...x,
|
|
135
|
-
children:
|
|
135
|
+
children: e
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
d.displayName = "Draggable";
|
|
140
|
-
function f({ children:
|
|
141
|
-
let
|
|
142
|
-
if (!
|
|
143
|
-
return
|
|
144
|
-
className: c
|
|
145
|
-
style:
|
|
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
146
|
role: "button",
|
|
147
147
|
"aria-label": "Drag handle",
|
|
148
|
-
"aria-disabled":
|
|
149
|
-
tabIndex:
|
|
150
|
-
onPointerDown:
|
|
151
|
-
onKeyDown:
|
|
152
|
-
...
|
|
153
|
-
children:
|
|
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
154
|
});
|
|
155
155
|
}
|
|
156
156
|
f.displayName = "Draggable.Handle";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import d from "
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
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
8
|
// src/components/Drawer/Drawer.tsx
|
|
9
|
-
var h =
|
|
9
|
+
var h = e({
|
|
10
10
|
classes: {},
|
|
11
11
|
titleId: ""
|
|
12
|
-
}), g = ({ children: e, className: t, style:
|
|
13
|
-
let { classes: a, titleId:
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
className:
|
|
16
|
-
style:
|
|
17
|
-
children: [/* @__PURE__ */
|
|
18
|
-
id:
|
|
19
|
-
className:
|
|
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
20
|
children: e
|
|
21
|
-
}), i && /* @__PURE__ */
|
|
21
|
+
}), i && /* @__PURE__ */ p("button", {
|
|
22
22
|
type: "button",
|
|
23
|
-
className:
|
|
23
|
+
className: c(f.closeButton, a.closeButton),
|
|
24
24
|
onClick: i,
|
|
25
25
|
"aria-label": "Close",
|
|
26
26
|
children: "×"
|
|
@@ -28,74 +28,74 @@ var h = i({
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
g.displayName = "Drawer.Header";
|
|
31
|
-
var _ = ({ children: e, className: t, style:
|
|
32
|
-
let { classes: i } =
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
className:
|
|
35
|
-
style:
|
|
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
36
|
children: e
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
_.displayName = "Drawer.Body";
|
|
40
|
-
var v = ({ children: e, className: t, style:
|
|
41
|
-
let { classes: i } =
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
className:
|
|
44
|
-
style:
|
|
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
45
|
children: e
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
v.displayName = "Drawer.Footer";
|
|
49
|
-
var y = 340, b =
|
|
50
|
-
let D =
|
|
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
51
|
D.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
|
|
52
|
-
}, k =
|
|
53
|
-
|
|
54
|
-
|
|
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
55
|
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
]),
|
|
60
|
-
if (
|
|
56
|
+
e,
|
|
57
|
+
n,
|
|
58
|
+
m
|
|
59
|
+
]), r(() => {
|
|
60
|
+
if (e || !M) return;
|
|
61
61
|
F(!0);
|
|
62
|
-
let
|
|
63
|
-
return () => clearTimeout(
|
|
64
|
-
}, [
|
|
65
|
-
let B =
|
|
66
|
-
v &&
|
|
67
|
-
},
|
|
68
|
-
|
|
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
69
|
if (!M) return;
|
|
70
70
|
let e = document.body.style.overflow;
|
|
71
71
|
return document.body.style.overflow = "hidden", () => {
|
|
72
72
|
document.body.style.overflow = e;
|
|
73
73
|
};
|
|
74
74
|
}, [M]);
|
|
75
|
-
let V =
|
|
76
|
-
return M ?
|
|
77
|
-
className:
|
|
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
78
|
onMouseDown: (e) => {
|
|
79
79
|
V.current = e.target === e.currentTarget;
|
|
80
80
|
},
|
|
81
81
|
onMouseUp: (e) => {
|
|
82
|
-
_ && V.current && e.target === e.currentTarget &&
|
|
82
|
+
_ && V.current && e.target === e.currentTarget && t(), V.current = !1;
|
|
83
83
|
},
|
|
84
84
|
role: "presentation",
|
|
85
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ p("div", {
|
|
86
86
|
ref: O,
|
|
87
|
-
className:
|
|
87
|
+
className: c(f.drawer, f[`side_${I}`], f[`size_${R}`], f[`${P ? "slideOut" : "slideIn"}_${I}`], b?.drawer, x),
|
|
88
88
|
style: S,
|
|
89
89
|
role: "dialog",
|
|
90
90
|
"aria-modal": j ? "true" : void 0,
|
|
91
91
|
"aria-label": w,
|
|
92
92
|
"aria-labelledby": w ? void 0 : A,
|
|
93
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ p(h.Provider, {
|
|
94
94
|
value: {
|
|
95
95
|
classes: b ?? {},
|
|
96
96
|
titleId: A
|
|
97
97
|
},
|
|
98
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ p(u, {
|
|
99
99
|
value: B,
|
|
100
100
|
children: C
|
|
101
101
|
})
|