@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,22 +1,22 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import s from "
|
|
1
|
+
import { forwardRef as e, useMemo as t } from "react";
|
|
2
|
+
import n from "clsx";
|
|
3
|
+
import r from "./RelativeTime.module.scss.js";
|
|
4
|
+
import { useNow as i } from "../../hooks/useNow.js";
|
|
5
|
+
import { refreshIntervalFor as a, timeAgo as o, toTimestamp as s } from "../../utils/timeAgo.js";
|
|
6
6
|
import { jsx as c } from "react/jsx-runtime";
|
|
7
7
|
// src/components/RelativeTime/RelativeTime.tsx
|
|
8
8
|
var l = {
|
|
9
9
|
dateStyle: "medium",
|
|
10
10
|
timeStyle: "short"
|
|
11
|
-
}, u =
|
|
12
|
-
let C =
|
|
11
|
+
}, u = e(({ value: e, format: u = "long", numeric: d = "auto", locale: f, live: p = !0, now: m, maxAge: h, absoluteFormat: g = l, title: _ = !0, fallback: v = "—", classes: y, className: b, ...x }, S) => {
|
|
12
|
+
let C = t(() => s(e), [e]), w = Number.isFinite(C), T = C - (m ?? Date.now()), E = a(T), D = i(E, p && m === void 0 && w), O = m ?? D;
|
|
13
13
|
if (!w) return /* @__PURE__ */ c("time", {
|
|
14
14
|
ref: S,
|
|
15
|
-
className:
|
|
15
|
+
className: n(r.root, y?.root, b),
|
|
16
16
|
...x,
|
|
17
17
|
children: v
|
|
18
18
|
});
|
|
19
|
-
let k = new Date(C).toISOString(), A = new Intl.DateTimeFormat(f, g).format(C), j =
|
|
19
|
+
let k = new Date(C).toISOString(), A = new Intl.DateTimeFormat(f, g).format(C), j = o(C, {
|
|
20
20
|
now: O,
|
|
21
21
|
locale: f,
|
|
22
22
|
format: u,
|
|
@@ -27,7 +27,7 @@ var l = {
|
|
|
27
27
|
ref: S,
|
|
28
28
|
dateTime: k,
|
|
29
29
|
title: _ === !1 ? void 0 : _ === !0 ? A : _,
|
|
30
|
-
className:
|
|
30
|
+
className: n(r.root, y?.root, b),
|
|
31
31
|
...x,
|
|
32
32
|
children: j ?? A
|
|
33
33
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import o from "
|
|
1
|
+
import { forwardRef as e, useCallback as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./SegmentedControl.module.scss.js";
|
|
4
|
+
import { Tooltip as o } from "../Tooltip/Tooltip.js";
|
|
5
5
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
7
|
-
function u({ options:
|
|
8
|
-
let T = u !== void 0, [E, D] =
|
|
7
|
+
function u({ options: e, value: u, defaultValue: d, onChange: f, size: p = "md", shape: m = "rounded", variant: h = "filled", fullWidth: g = !1, disabled: _ = !1, classes: v, className: y, style: b, id: x, "aria-label": S, "aria-labelledby": C }, w) {
|
|
8
|
+
let T = u !== void 0, [E, D] = r(d), O = T ? u : E, k = n(/* @__PURE__ */ new Map()), A = e.some((e) => e.href !== void 0), j = t((e) => {
|
|
9
9
|
T || D(e), e !== O && f?.(e);
|
|
10
10
|
}, [
|
|
11
11
|
T,
|
|
12
12
|
O,
|
|
13
13
|
f
|
|
14
|
-
]), M =
|
|
14
|
+
]), M = e.filter((e) => !(_ || e.disabled)), N = (e) => {
|
|
15
15
|
e && (j(e.value), k.current.get(e.value)?.focus());
|
|
16
16
|
}, P = (e, t) => {
|
|
17
17
|
if (M.length === 0) return;
|
|
@@ -38,58 +38,58 @@ function u({ options: n, value: u, defaultValue: d, onChange: f, size: p = "md",
|
|
|
38
38
|
"aria-label": S,
|
|
39
39
|
"aria-labelledby": C,
|
|
40
40
|
"aria-disabled": _ || void 0,
|
|
41
|
-
className:
|
|
41
|
+
className: i(a.root, a[p], a[m], a[h], g && a.fullWidth, _ && a.disabled, v?.root, y),
|
|
42
42
|
style: b,
|
|
43
|
-
children:
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
className:
|
|
43
|
+
children: e.map((e) => {
|
|
44
|
+
let t = e.value === O, n = _ || !!e.disabled, r = e.icon !== void 0 && e.label === void 0, u = typeof e.tooltip == "string" ? e.tooltip : void 0, d = e["aria-label"] ?? (r ? u : void 0), f = /* @__PURE__ */ l(s, { children: [
|
|
45
|
+
e.icon !== void 0 && /* @__PURE__ */ c("span", {
|
|
46
|
+
className: i(a.icon, v?.icon),
|
|
47
47
|
"aria-hidden": "true",
|
|
48
|
-
children:
|
|
48
|
+
children: e.icon
|
|
49
49
|
}),
|
|
50
|
-
|
|
51
|
-
className:
|
|
52
|
-
children:
|
|
50
|
+
e.label !== void 0 && /* @__PURE__ */ c("span", {
|
|
51
|
+
className: i(a.label, v?.label),
|
|
52
|
+
children: e.label
|
|
53
53
|
}),
|
|
54
|
-
|
|
55
|
-
className:
|
|
56
|
-
children:
|
|
54
|
+
e.count !== void 0 && /* @__PURE__ */ c("span", {
|
|
55
|
+
className: i(a.count, v?.count),
|
|
56
|
+
children: e.count
|
|
57
57
|
})
|
|
58
|
-
] }), p =
|
|
59
|
-
|
|
58
|
+
] }), p = i(a.item, t && a.itemSelected, r && a.iconOnly, v?.item, t && v?.itemSelected), m = (t) => {
|
|
59
|
+
t ? k.current.set(e.value, t) : k.current.delete(e.value);
|
|
60
60
|
}, h;
|
|
61
61
|
return h = A ? /* @__PURE__ */ c("a", {
|
|
62
62
|
ref: m,
|
|
63
|
-
href:
|
|
64
|
-
"aria-current":
|
|
65
|
-
"aria-disabled":
|
|
63
|
+
href: n ? void 0 : e.href,
|
|
64
|
+
"aria-current": t ? "page" : void 0,
|
|
65
|
+
"aria-disabled": n || void 0,
|
|
66
66
|
"aria-label": d,
|
|
67
|
-
tabIndex:
|
|
67
|
+
tabIndex: n ? -1 : e.value === F ? 0 : -1,
|
|
68
68
|
className: p,
|
|
69
|
-
onClick: (
|
|
70
|
-
|
|
69
|
+
onClick: (t) => {
|
|
70
|
+
n ? t.preventDefault() : j(e.value);
|
|
71
71
|
},
|
|
72
|
-
onKeyDown: (
|
|
72
|
+
onKeyDown: (t) => P(t, e),
|
|
73
73
|
children: f
|
|
74
|
-
},
|
|
74
|
+
}, e.value) : /* @__PURE__ */ c("button", {
|
|
75
75
|
ref: m,
|
|
76
76
|
type: "button",
|
|
77
77
|
role: "radio",
|
|
78
|
-
"aria-checked":
|
|
78
|
+
"aria-checked": t,
|
|
79
79
|
"aria-label": d,
|
|
80
|
-
disabled:
|
|
81
|
-
tabIndex:
|
|
80
|
+
disabled: n,
|
|
81
|
+
tabIndex: e.value === F ? 0 : -1,
|
|
82
82
|
className: p,
|
|
83
|
-
onClick: () => j(
|
|
84
|
-
onKeyDown: (
|
|
83
|
+
onClick: () => j(e.value),
|
|
84
|
+
onKeyDown: (t) => P(t, e),
|
|
85
85
|
children: f
|
|
86
|
-
},
|
|
87
|
-
content:
|
|
86
|
+
}, e.value), e.tooltip !== void 0 && e.tooltip !== null && e.tooltip !== "" ? /* @__PURE__ */ c(o, {
|
|
87
|
+
content: e.tooltip,
|
|
88
88
|
children: h
|
|
89
|
-
},
|
|
89
|
+
}, e.value) : h;
|
|
90
90
|
})
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
var d =
|
|
93
|
+
var d = e(u);
|
|
94
94
|
d.displayName = "SegmentedControl";
|
|
95
95
|
export { d as SegmentedControl };
|
|
@@ -1,18 +1,18 @@
|
|
|
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 "./Skeleton.module.scss.js";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
// src/components/Skeleton/Skeleton.tsx
|
|
6
|
-
var i = (e) => typeof e == "number" ? `${e}px` : e, a =
|
|
7
|
-
let m = s === "wave" ?
|
|
8
|
-
if (
|
|
6
|
+
var i = (e) => typeof e == "number" ? `${e}px` : e, a = e(({ variant: e = "text", width: a, height: o, animation: s = "pulse", lines: c = 1, classes: l, className: u, style: d, ...f }, p) => {
|
|
7
|
+
let m = s === "wave" ? n.wave : s === "none" ? void 0 : n.pulse;
|
|
8
|
+
if (e === "text" && c > 1) return /* @__PURE__ */ r("div", {
|
|
9
9
|
ref: p,
|
|
10
10
|
"aria-hidden": "true",
|
|
11
|
-
className: n
|
|
11
|
+
className: t(n.stack, l?.root, u),
|
|
12
12
|
style: d,
|
|
13
13
|
...f,
|
|
14
|
-
children: Array.from({ length: c }).map((
|
|
15
|
-
className: n
|
|
14
|
+
children: Array.from({ length: c }).map((e, s) => /* @__PURE__ */ r("span", {
|
|
15
|
+
className: t(n.line, n.text, m, l?.line),
|
|
16
16
|
style: {
|
|
17
17
|
width: s === c - 1 ? "60%" : i(a) ?? "100%",
|
|
18
18
|
height: i(o)
|
|
@@ -27,7 +27,7 @@ var i = (e) => typeof e == "number" ? `${e}px` : e, a = t(({ variant: t = "text"
|
|
|
27
27
|
return /* @__PURE__ */ r("div", {
|
|
28
28
|
ref: p,
|
|
29
29
|
"aria-hidden": "true",
|
|
30
|
-
className: n
|
|
30
|
+
className: t(n.line, n[e], m, l?.root, u),
|
|
31
31
|
style: h,
|
|
32
32
|
...f
|
|
33
33
|
});
|
|
@@ -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 "./Spinner.module.scss.js";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
// src/components/Spinner/Spinner.tsx
|
|
6
|
-
var a =
|
|
6
|
+
var a = e(({ size: e = "md", color: a, label: o = "Loading", classes: s, className: c, style: l, ...u }, d) => /* @__PURE__ */ i("span", {
|
|
7
7
|
ref: d,
|
|
8
8
|
role: "status",
|
|
9
9
|
"aria-live": "polite",
|
|
10
|
-
className: n
|
|
10
|
+
className: t(n.root, n[e], s?.root, c),
|
|
11
11
|
style: a ? {
|
|
12
12
|
...l,
|
|
13
13
|
color: a
|
|
14
14
|
} : l,
|
|
15
15
|
...u,
|
|
16
16
|
children: [/* @__PURE__ */ r("span", {
|
|
17
|
-
className: n
|
|
17
|
+
className: t(n.circle, s?.circle),
|
|
18
18
|
"aria-hidden": "true"
|
|
19
19
|
}), o ? /* @__PURE__ */ r("span", {
|
|
20
|
-
className: n
|
|
20
|
+
className: t(n.label, s?.label),
|
|
21
21
|
children: o
|
|
22
22
|
}) : null]
|
|
23
23
|
}));
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import d from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useId as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import { createPortal as o } from "react-dom";
|
|
3
|
+
import s from "clsx";
|
|
4
|
+
import c from "./SplitButton.module.scss.js";
|
|
5
|
+
import l from "../Button/Button.module.scss.js";
|
|
6
|
+
import { EscapeLayerProvider as u, useEscapeLayer as d } from "../../hooks/useEscapeLayer.js";
|
|
7
|
+
import { usePortalPosition as f } from "../../hooks/usePortalPosition.js";
|
|
8
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
9
|
// src/components/SplitButton/SplitButton.tsx
|
|
10
|
-
var h =
|
|
11
|
-
let [k, A] =
|
|
12
|
-
|
|
10
|
+
var h = e(({ actions: e, variant: h = "secondary", size: g = "md", disabled: _ = !1, align: v = "right", portal: y = !0, menuLabel: b = "More actions", maxWidth: x, className: S, style: C, id: w, onOpen: T, onClose: E, classes: D }, O) => {
|
|
11
|
+
let [k, A] = a(!1), j = i(null), M = i(null), N = i(null), P = r();
|
|
12
|
+
n(() => {
|
|
13
13
|
k && M.current && M.current.querySelector("[role=\"menuitem\"]:not([disabled])")?.focus();
|
|
14
14
|
}, [k]);
|
|
15
|
-
let F =
|
|
15
|
+
let F = t(() => {
|
|
16
16
|
A(!1), E?.(), N.current?.focus();
|
|
17
|
-
}, [E]), I =
|
|
17
|
+
}, [E]), I = t(() => {
|
|
18
18
|
A((e) => {
|
|
19
19
|
let t = !e;
|
|
20
20
|
return t ? T?.() : E?.(), t;
|
|
21
21
|
});
|
|
22
22
|
}, [T, E]);
|
|
23
|
-
|
|
23
|
+
n(() => {
|
|
24
24
|
if (!k) return;
|
|
25
25
|
let e = (e) => {
|
|
26
26
|
let t = e.target;
|
|
@@ -28,22 +28,22 @@ var h = a(({ actions: a, variant: h = "secondary", size: g = "md", disabled: _ =
|
|
|
28
28
|
};
|
|
29
29
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
30
30
|
}, [k, F]);
|
|
31
|
-
let L =
|
|
32
|
-
if (
|
|
33
|
-
let [z, ...B] =
|
|
34
|
-
className:
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
className:
|
|
31
|
+
let L = d(F, k), R = f(j, k && y);
|
|
32
|
+
if (e.length === 0) return null;
|
|
33
|
+
let [z, ...B] = e, V = B.length > 0, H = _ || z.disabled, U = s(l.root, l[h], l[g]), W = h === "secondary" ? c.overlapOutline : h === "ghost" ? c.dividerSubtle : c.dividerOnFill, G = s(U, c.main, V && c.mainAttached, V && k && c.mainOpen, D?.main), K = (e) => x !== void 0 && (typeof e == "string" || typeof e == "number") ? String(e) : void 0, q = /* @__PURE__ */ m("span", {
|
|
34
|
+
className: c.mainContent,
|
|
35
|
+
children: [/* @__PURE__ */ p("span", {
|
|
36
|
+
className: c.mainLabel,
|
|
37
37
|
children: z.label
|
|
38
|
-
}), V && /* @__PURE__ */
|
|
39
|
-
className:
|
|
38
|
+
}), V && /* @__PURE__ */ p("span", {
|
|
39
|
+
className: c.sizer,
|
|
40
40
|
"aria-hidden": "true",
|
|
41
|
-
children:
|
|
42
|
-
className:
|
|
43
|
-
children:
|
|
44
|
-
},
|
|
41
|
+
children: e.map((e, t) => /* @__PURE__ */ p("span", {
|
|
42
|
+
className: c.sizerItem,
|
|
43
|
+
children: e.label
|
|
44
|
+
}, t))
|
|
45
45
|
})]
|
|
46
|
-
}), J = z.href && !H ? /* @__PURE__ */
|
|
46
|
+
}), J = z.href && !H ? /* @__PURE__ */ p("a", {
|
|
47
47
|
id: w,
|
|
48
48
|
className: G,
|
|
49
49
|
href: z.href,
|
|
@@ -52,7 +52,7 @@ var h = a(({ actions: a, variant: h = "secondary", size: g = "md", disabled: _ =
|
|
|
52
52
|
title: K(z.label),
|
|
53
53
|
onClick: z.onClick,
|
|
54
54
|
children: q
|
|
55
|
-
}) : /* @__PURE__ */
|
|
55
|
+
}) : /* @__PURE__ */ p("button", {
|
|
56
56
|
id: w,
|
|
57
57
|
type: "button",
|
|
58
58
|
className: G,
|
|
@@ -60,69 +60,69 @@ var h = a(({ actions: a, variant: h = "secondary", size: g = "md", disabled: _ =
|
|
|
60
60
|
title: K(z.label),
|
|
61
61
|
onClick: z.onClick,
|
|
62
62
|
children: q
|
|
63
|
-
}), Y = B.map((
|
|
64
|
-
let
|
|
65
|
-
|
|
63
|
+
}), Y = B.map((e, t) => {
|
|
64
|
+
let n = s(c.item, e.disabled && c.itemDisabled, e.danger && c.itemDanger, D?.item), r = (t) => {
|
|
65
|
+
e.onClick?.(t), F();
|
|
66
66
|
};
|
|
67
|
-
return
|
|
67
|
+
return e.href && !e.disabled ? /* @__PURE__ */ p("a", {
|
|
68
68
|
role: "menuitem",
|
|
69
|
-
className:
|
|
70
|
-
href:
|
|
71
|
-
target:
|
|
72
|
-
rel:
|
|
73
|
-
title: K(
|
|
74
|
-
onClick:
|
|
75
|
-
children:
|
|
76
|
-
},
|
|
69
|
+
className: n,
|
|
70
|
+
href: e.href,
|
|
71
|
+
target: e.target,
|
|
72
|
+
rel: e.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
73
|
+
title: K(e.label),
|
|
74
|
+
onClick: r,
|
|
75
|
+
children: e.label
|
|
76
|
+
}, t) : /* @__PURE__ */ p("button", {
|
|
77
77
|
type: "button",
|
|
78
78
|
role: "menuitem",
|
|
79
|
-
className:
|
|
80
|
-
disabled:
|
|
81
|
-
title: K(
|
|
82
|
-
onClick:
|
|
83
|
-
children:
|
|
84
|
-
},
|
|
79
|
+
className: n,
|
|
80
|
+
disabled: e.disabled,
|
|
81
|
+
title: K(e.label),
|
|
82
|
+
onClick: r,
|
|
83
|
+
children: e.label
|
|
84
|
+
}, t);
|
|
85
85
|
}), X = {
|
|
86
|
-
sm:
|
|
87
|
-
md:
|
|
88
|
-
lg:
|
|
89
|
-
}[g], Z = (
|
|
86
|
+
sm: c.menuSm,
|
|
87
|
+
md: c.menuMd,
|
|
88
|
+
lg: c.menuLg
|
|
89
|
+
}[g], Z = (e) => /* @__PURE__ */ p("div", {
|
|
90
90
|
ref: M,
|
|
91
91
|
id: P,
|
|
92
|
-
className:
|
|
93
|
-
style:
|
|
92
|
+
className: s(c.menu, X, k && c.menuOpen, v === "left" ? c.alignLeft : c.alignRight, D?.menu),
|
|
93
|
+
style: e,
|
|
94
94
|
role: "menu",
|
|
95
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ p(u, {
|
|
96
96
|
value: L,
|
|
97
97
|
children: Y
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
|
-
return /* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ m("div", {
|
|
101
101
|
ref: O,
|
|
102
|
-
className:
|
|
102
|
+
className: s(c.root, D?.root, S),
|
|
103
103
|
style: x === void 0 ? C : {
|
|
104
104
|
maxWidth: x,
|
|
105
105
|
...C
|
|
106
106
|
},
|
|
107
107
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ m("div", {
|
|
109
109
|
ref: j,
|
|
110
|
-
className:
|
|
111
|
-
children: [J, V && /* @__PURE__ */
|
|
110
|
+
className: s(c.group, D?.group),
|
|
111
|
+
children: [J, V && /* @__PURE__ */ p("button", {
|
|
112
112
|
ref: N,
|
|
113
113
|
type: "button",
|
|
114
|
-
className:
|
|
114
|
+
className: s(U, l.iconOnly, c.toggle, k && c.toggleOpen, W, D?.toggle),
|
|
115
115
|
disabled: _,
|
|
116
116
|
onClick: I,
|
|
117
117
|
"aria-haspopup": "menu",
|
|
118
118
|
"aria-expanded": k,
|
|
119
119
|
"aria-controls": k ? P : void 0,
|
|
120
120
|
"aria-label": b,
|
|
121
|
-
children: /* @__PURE__ */
|
|
122
|
-
className:
|
|
121
|
+
children: /* @__PURE__ */ p("svg", {
|
|
122
|
+
className: s(c.chevron, k && c.chevronOpen, D?.chevron),
|
|
123
123
|
viewBox: "0 0 10 6",
|
|
124
124
|
"aria-hidden": "true",
|
|
125
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ p("path", {
|
|
126
126
|
d: "M1 1l4 4 4-4",
|
|
127
127
|
fill: "none",
|
|
128
128
|
stroke: "currentColor",
|
|
@@ -134,7 +134,7 @@ var h = a(({ actions: a, variant: h = "secondary", size: g = "md", disabled: _ =
|
|
|
134
134
|
})]
|
|
135
135
|
}),
|
|
136
136
|
V && !y && Z(),
|
|
137
|
-
V && y && k && typeof document < "u" &&
|
|
137
|
+
V && y && k && typeof document < "u" && o(Z({
|
|
138
138
|
position: "fixed",
|
|
139
139
|
top: R.top,
|
|
140
140
|
left: v === "right" ? void 0 : R.left,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle as r, useLayoutEffect as i, useMemo as ee, useRef as a, useState as o } from "react";
|
|
2
|
+
import s from "clsx";
|
|
3
|
+
import c from "./SplitPane.module.scss.js";
|
|
4
|
+
import { useResizable as l } from "../../hooks/useResizable.js";
|
|
5
|
+
import { usePersistedState as u } from "../../hooks/usePersistedState.js";
|
|
6
|
+
import { jsx as d, jsxs as te } from "react/jsx-runtime";
|
|
7
7
|
// src/components/SplitPane/SplitPane.tsx
|
|
8
|
-
function
|
|
8
|
+
function f(e, t) {
|
|
9
9
|
if (e === void 0) return {
|
|
10
10
|
px: null,
|
|
11
11
|
ratio: null
|
|
@@ -28,11 +28,11 @@ function u(e, t) {
|
|
|
28
28
|
ratio: null
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
var
|
|
32
|
-
let k =
|
|
33
|
-
|
|
34
|
-
let A =
|
|
35
|
-
|
|
31
|
+
var p = "__crk-splitpane-unpersisted__", m = e(({ children: e, direction: m = "horizontal", primary: h = "first", size: g, defaultSize: _ = "50%", onSizeChange: ne, minSize: v = 100, maxSize: y, minSecondarySize: b = 100, collapsible: x = !1, collapsed: S, defaultCollapsed: re = !1, onCollapsedChange: C, persistKey: w, handleSize: T = 6, handleLabel: ie = "Resize", disabled: E = !1, classes: D, className: O, style: ae, ...oe }, se) => {
|
|
32
|
+
let k = a(null);
|
|
33
|
+
r(se, () => k.current);
|
|
34
|
+
let A = m === "horizontal", [j, M] = o(0);
|
|
35
|
+
i(() => {
|
|
36
36
|
let e = k.current;
|
|
37
37
|
if (!e) return;
|
|
38
38
|
let t = () => {
|
|
@@ -43,93 +43,93 @@ var d = "__crk-splitpane-unpersisted__", f = r(({ children: r, direction: f = "h
|
|
|
43
43
|
let n = new ResizeObserver(t);
|
|
44
44
|
return n.observe(e), () => n.disconnect();
|
|
45
45
|
}, [A]);
|
|
46
|
-
let [N, P] =
|
|
47
|
-
|
|
46
|
+
let [N, P] = u(w ?? p, {}, { sync: !!w }), F = t((e) => {
|
|
47
|
+
w && P((t) => ({
|
|
48
48
|
...t,
|
|
49
49
|
...e
|
|
50
50
|
}));
|
|
51
|
-
}, [
|
|
52
|
-
|
|
51
|
+
}, [w, P]), I = ee(() => f(_, 0), [_]), [L, R] = o(() => w && N.px !== void 0 ? null : I.ratio), [z, B] = o(() => w && N.px !== void 0 ? N.px : I.px ?? 0);
|
|
52
|
+
i(() => {
|
|
53
53
|
L !== null && j > 0 && B(L * j);
|
|
54
54
|
}, [L, j]);
|
|
55
|
-
let V =
|
|
56
|
-
|
|
55
|
+
let V = g === void 0 ? null : f(g, j), H = V ? V.px ?? 0 : z, [U, W] = o(() => w && N.collapsed !== void 0 ? N.collapsed : re), G = x && (S ?? U), K = t((e) => {
|
|
56
|
+
S === void 0 && W(e), C?.(e), F({ collapsed: e });
|
|
57
57
|
}, [
|
|
58
|
-
x,
|
|
59
58
|
S,
|
|
59
|
+
C,
|
|
60
60
|
F
|
|
61
|
-
]), q =
|
|
62
|
-
v,
|
|
63
|
-
j,
|
|
64
|
-
_,
|
|
61
|
+
]), q = t(() => y === void 0 ? j > 0 ? Math.max(v, j - b - T) : 1e400 : y, [
|
|
65
62
|
y,
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
j,
|
|
64
|
+
v,
|
|
65
|
+
b,
|
|
66
|
+
T
|
|
67
|
+
]), J = j > 0 ? Math.min(Math.max(H, v), q()) : H, Y = a(J), X = l({
|
|
68
68
|
size: J,
|
|
69
69
|
defaultSize: I.px ?? (I.ratio !== null && j > 0 ? I.ratio * j : J),
|
|
70
|
-
min:
|
|
70
|
+
min: v,
|
|
71
71
|
max: q,
|
|
72
72
|
axis: A ? "x" : "y",
|
|
73
|
-
invert:
|
|
74
|
-
disabled:
|
|
73
|
+
invert: h === "second",
|
|
74
|
+
disabled: E,
|
|
75
75
|
onResizeStart: () => {
|
|
76
76
|
G && K(!1);
|
|
77
77
|
},
|
|
78
78
|
onResize: (e, t) => {
|
|
79
|
-
Y.current = t, V || (R(null), B(e)),
|
|
79
|
+
Y.current = t, V || (R(null), B(e)), ne?.(e);
|
|
80
80
|
},
|
|
81
81
|
onResizeEnd: (e) => {
|
|
82
|
-
|
|
82
|
+
x && Y.current < v / 2 ? (K(!0), Y.current = e) : F({ px: e });
|
|
83
83
|
}
|
|
84
|
-
}), ce =
|
|
85
|
-
|
|
84
|
+
}), ce = t(() => {
|
|
85
|
+
E || (x ? K(!G) : X.reset());
|
|
86
86
|
}, [
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
E,
|
|
88
|
+
x,
|
|
89
89
|
G,
|
|
90
90
|
K,
|
|
91
91
|
X
|
|
92
92
|
]);
|
|
93
|
-
|
|
93
|
+
n(() => {
|
|
94
94
|
V?.ratio !== null && V?.ratio !== void 0 && R(V.ratio);
|
|
95
95
|
}, [V?.ratio]);
|
|
96
96
|
let le = G ? 0 : V && V.px === null && V.ratio !== null ? `${V.ratio * 100}%` : !V && L !== null && j === 0 ? `${L * 100}%` : J, Z = {
|
|
97
97
|
[A ? "width" : "height"]: le,
|
|
98
98
|
flex: "0 0 auto"
|
|
99
|
-
}, ue =
|
|
100
|
-
className: c
|
|
99
|
+
}, ue = e[0], de = e[1], Q = h === "first", fe = /* @__PURE__ */ d("div", {
|
|
100
|
+
className: s(c.pane, Q ? c.primary : c.secondary, Q && G && c.collapsed, D?.pane, Q ? D?.primary : D?.secondary, Q && G && D?.collapsed),
|
|
101
101
|
style: Q ? Z : void 0,
|
|
102
102
|
"data-pane": Q ? "primary" : "secondary",
|
|
103
103
|
children: ue
|
|
104
|
-
}), pe = /* @__PURE__ */
|
|
105
|
-
className: c
|
|
104
|
+
}), pe = /* @__PURE__ */ d("div", {
|
|
105
|
+
className: s(c.pane, Q ? c.secondary : c.primary, !Q && G && c.collapsed, D?.pane, Q ? D?.secondary : D?.primary, !Q && G && D?.collapsed),
|
|
106
106
|
style: Q ? void 0 : Z,
|
|
107
107
|
"data-pane": Q ? "secondary" : "primary",
|
|
108
108
|
children: de
|
|
109
109
|
}), { onDoubleClick: me, ...$ } = X.handleProps;
|
|
110
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ te("div", {
|
|
111
111
|
ref: k,
|
|
112
|
-
className: c
|
|
112
|
+
className: s(c.root, A ? c.horizontal : c.vertical, D?.root, O),
|
|
113
113
|
style: {
|
|
114
|
-
...
|
|
115
|
-
"--crk-splitpane-handle-size": `${
|
|
114
|
+
...ae,
|
|
115
|
+
"--crk-splitpane-handle-size": `${T}px`
|
|
116
116
|
},
|
|
117
|
-
"data-direction":
|
|
117
|
+
"data-direction": m,
|
|
118
118
|
...oe,
|
|
119
119
|
children: [
|
|
120
120
|
fe,
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ d("div", {
|
|
122
122
|
...$,
|
|
123
123
|
onDoubleClick: ce,
|
|
124
|
-
"aria-label":
|
|
124
|
+
"aria-label": ie,
|
|
125
125
|
"aria-valuenow": G ? 0 : $["aria-valuenow"],
|
|
126
|
-
tabIndex:
|
|
127
|
-
className: c
|
|
126
|
+
tabIndex: E ? -1 : 0,
|
|
127
|
+
className: s(c.handle, X.isResizing && c.handleActive, E && c.handleDisabled, D?.handle, X.isResizing && D?.handleActive),
|
|
128
128
|
"data-collapsed": G || void 0
|
|
129
129
|
}),
|
|
130
130
|
pe
|
|
131
131
|
]
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
|
-
|
|
135
|
-
export {
|
|
134
|
+
m.displayName = "SplitPane";
|
|
135
|
+
export { m as SplitPane };
|