@overdoser/react-toolkit 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +47 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.js +20 -0
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.js +25 -0
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +92 -95
- package/components/Alert/Alert.module.js +18 -0
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.js +23 -0
- package/components/Badge/Badge.js +16 -38
- package/components/Badge/Badge.module.js +17 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.js +25 -0
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.js +35 -0
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.js +32 -0
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +46 -41
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.js +32 -0
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.js +23 -0
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.js +28 -0
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.js +17 -0
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.js +10 -0
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.js +66 -0
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.js +29 -0
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +12 -10
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.js +12 -0
- package/components/EmptyState/EmptyState.js +58 -55
- package/components/EmptyState/EmptyState.module.js +14 -0
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +32 -35
- package/components/Form/Form.module.js +16 -0
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.js +26 -0
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +25 -22
- package/components/Kbd/Kbd.module.js +10 -0
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.js +23 -0
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.js +10 -0
- package/components/List/List.js +22 -46
- package/components/List/List.module.js +12 -0
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.js +40 -0
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.js +18 -0
- package/components/PageHeader/PageHeader.js +78 -72
- package/components/PageHeader/PageHeader.module.js +23 -0
- package/components/Pagination/Pagination.js +63 -84
- package/components/Pagination/Pagination.module.js +13 -0
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.js +12 -0
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +57 -90
- package/components/ProgressBar/ProgressBar.module.js +29 -0
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.js +3 -0
- package/components/SegmentedControl/SegmentedControl.js +94 -130
- package/components/SegmentedControl/SegmentedControl.module.js +21 -0
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.js +15 -0
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.js +12 -0
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.js +31 -0
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.js +14 -0
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.js +42 -0
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.js +18 -0
- package/components/Table/Table.d.ts +41 -16
- package/components/Table/Table.js +383 -442
- package/components/Table/Table.module.js +42 -0
- package/components/Table/index.d.ts +1 -1
- package/components/Table/useTableSort.d.ts +1 -1
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.js +28 -0
- package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
- package/components/ThemeToggle/ThemeToggle.js +122 -97
- package/components/ThemeToggle/ThemeToggle.module.js +13 -0
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.js +29 -0
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.js +31 -0
- package/components/Timeline/Timeline.module.js +76 -0
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +245 -178
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.js +98 -0
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.js +29 -0
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.js +37 -0
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +35 -57
- package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.js +17 -0
- package/components/Typography/Typography.js +11 -36
- package/components/Typography/Typography.module.js +30 -0
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.js +10 -0
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.js +14 -0
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.js +15 -0
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.js +14 -0
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.js +9 -0
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.js +8 -0
- package/components/inputs/Select/Select.js +555 -682
- package/components/inputs/Select/Select.module.js +38 -0
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.js +9 -0
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.js +14 -0
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -91
- package/hooks/usePortalPosition.js +25 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.d.ts +2 -2
- package/hooks/useTheme.js +28 -25
- package/index.css +2 -1
- package/index.d.ts +1 -1
- package/index.js +97 -215
- package/index.layered.css +2 -3
- package/llms.txt +9 -6
- package/manifest.json +66 -10
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.d.ts +2 -0
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
- package/components/Accordion/Accordion.module.scss.js +0 -36
- package/components/ActionButton/ActionButton.module.scss.js +0 -47
- package/components/Alert/Alert.module.scss.js +0 -33
- package/components/Avatar/Avatar.module.scss.js +0 -43
- package/components/Badge/Badge.module.scss.js +0 -31
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
- package/components/Button/Button.module.scss.js +0 -47
- package/components/Card/Card.module.scss.js +0 -60
- package/components/Chart/Chart.module.scss.js +0 -61
- package/components/Chip/Chip.module.scss.js +0 -59
- package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
- package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
- package/components/Divider/Divider.module.scss.js +0 -31
- package/components/Draggable/Draggable.module.scss.js +0 -17
- package/components/Drawer/Drawer.module.scss.js +0 -119
- package/components/Dropdown/Dropdown.module.scss.js +0 -53
- package/components/Dropzone/Dropzone.module.scss.js +0 -21
- package/components/EmptyState/EmptyState.module.scss.js +0 -25
- package/components/Form/Form.module.scss.js +0 -29
- package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
- package/components/Kbd/Kbd.module.scss.js +0 -17
- package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
- package/components/Link/Link.module.scss.js +0 -16
- package/components/List/List.module.scss.js +0 -21
- package/components/Loader/Loader.module.scss.js +0 -70
- package/components/Modal/Modal.module.scss.js +0 -33
- package/components/PageHeader/PageHeader.module.scss.js +0 -43
- package/components/Pagination/Pagination.module.scss.js +0 -23
- package/components/Popover/Popover.module.scss.js +0 -21
- package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
- package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
- package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
- package/components/Skeleton/Skeleton.module.scss.js +0 -25
- package/components/Spinner/Spinner.module.scss.js +0 -20
- package/components/SplitButton/SplitButton.module.scss.js +0 -57
- package/components/SplitPane/SplitPane.module.scss.js +0 -25
- package/components/StatCard/StatCard.module.scss.js +0 -72
- package/components/StatusDot/StatusDot.module.scss.js +0 -32
- package/components/Table/Table.module.scss.js +0 -81
- package/components/Tabs/Tabs.module.scss.js +0 -53
- package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
- package/components/Timeline/GanttTimeline.module.scss.js +0 -55
- package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
- package/components/Timeline/Timeline.module.scss.js +0 -141
- package/components/Timeline/TraceTimeline.module.scss.js +0 -189
- package/components/Timer/Timer.module.scss.js +0 -55
- package/components/Toast/Toast.module.scss.js +0 -62
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
- package/components/Tooltip/Tooltip.module.scss.js +0 -30
- package/components/Typography/Typography.module.scss.js +0 -53
- package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
- package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
- package/components/inputs/Input/Input.module.scss.js +0 -27
- package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
- package/components/inputs/Radio/Radio.module.scss.js +0 -15
- package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
- package/components/inputs/Select/Select.module.scss.js +0 -73
- package/components/inputs/Slider/Slider.module.scss.js +0 -15
- package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
|
@@ -1,50 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
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
|
-
ref: c,
|
|
39
|
-
"aria-hidden": "true",
|
|
40
|
-
className: a(t.line, t[e], h, i?.root, p),
|
|
41
|
-
style: x,
|
|
42
|
-
...f
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
w.displayName = "Skeleton";
|
|
48
|
-
export {
|
|
49
|
-
w as Skeleton
|
|
50
|
-
};
|
|
1
|
+
import e from "./Skeleton.module.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
6
|
+
var i = (e) => typeof e == "number" ? `${e}px` : e, a = t(({ variant: t = "text", width: a, height: o, animation: s = "pulse", lines: c = 1, classes: l, className: u, style: d, ...f }, p) => {
|
|
7
|
+
let m = s === "wave" ? e.wave : s === "none" ? void 0 : e.pulse;
|
|
8
|
+
if (t === "text" && c > 1) return /* @__PURE__ */ r("div", {
|
|
9
|
+
ref: p,
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
className: n(e.stack, l?.root, u),
|
|
12
|
+
style: d,
|
|
13
|
+
...f,
|
|
14
|
+
children: Array.from({ length: c }).map((t, s) => /* @__PURE__ */ r("span", {
|
|
15
|
+
className: n(e.line, e.text, m, l?.line),
|
|
16
|
+
style: {
|
|
17
|
+
width: s === c - 1 ? "60%" : i(a) ?? "100%",
|
|
18
|
+
height: i(o)
|
|
19
|
+
}
|
|
20
|
+
}, s))
|
|
21
|
+
});
|
|
22
|
+
let h = {
|
|
23
|
+
width: i(a),
|
|
24
|
+
height: i(o),
|
|
25
|
+
...d
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ r("div", {
|
|
28
|
+
ref: p,
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: n(e.line, e[t], m, l?.root, u),
|
|
31
|
+
style: h,
|
|
32
|
+
...f
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
a.displayName = "Skeleton";
|
|
36
|
+
export { a as Skeleton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/components/Skeleton/Skeleton.module.scss
|
|
2
|
+
var e = "crk-line-8roAA", t = "crk-stack-8QHed", n = "crk-text-4oj9n", r = "crk-circle-o-WgD", i = "crk-rect-8lO4C", a = "crk-pulse-dX0ir", o = "crk-crk-skeleton-pulse-ZXPJJ", s = "crk-wave-S82D6", c = "crk-crk-skeleton-wave-rDp6Z", l = {
|
|
3
|
+
line: e,
|
|
4
|
+
stack: t,
|
|
5
|
+
text: n,
|
|
6
|
+
circle: r,
|
|
7
|
+
rect: i,
|
|
8
|
+
pulse: a,
|
|
9
|
+
"crk-skeleton-pulse": "crk-crk-skeleton-pulse-ZXPJJ",
|
|
10
|
+
crkSkeletonPulse: o,
|
|
11
|
+
wave: s,
|
|
12
|
+
"crk-skeleton-wave": "crk-crk-skeleton-wave-rDp6Z",
|
|
13
|
+
crkSkeletonWave: c
|
|
14
|
+
};
|
|
15
|
+
export { r as circle, o as crkSkeletonPulse, c as crkSkeletonWave, l as default, e as line, a as pulse, i as rect, t as stack, n as text, s as wave };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import r from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
1
|
+
import e from "./Spinner.module.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Spinner/Spinner.tsx
|
|
6
|
+
var a = t(({ size: t = "md", color: a, label: o = "Loading", classes: s, className: c, style: l, ...u }, d) => /* @__PURE__ */ i("span", {
|
|
7
|
+
ref: d,
|
|
8
|
+
role: "status",
|
|
9
|
+
"aria-live": "polite",
|
|
10
|
+
className: n(e.root, e[t], s?.root, c),
|
|
11
|
+
style: a ? {
|
|
12
|
+
...l,
|
|
13
|
+
color: a
|
|
14
|
+
} : l,
|
|
15
|
+
...u,
|
|
16
|
+
children: [/* @__PURE__ */ r("span", {
|
|
17
|
+
className: n(e.circle, s?.circle),
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}), o ? /* @__PURE__ */ r("span", {
|
|
20
|
+
className: n(e.label, s?.label),
|
|
21
|
+
children: o
|
|
22
|
+
}) : null]
|
|
23
|
+
}));
|
|
24
|
+
a.displayName = "Spinner";
|
|
25
|
+
export { a as Spinner };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/components/Spinner/Spinner.module.scss
|
|
2
|
+
var e = "crk-root-wia8E", t = "crk-circle-8olrz", n = "crk-crk-spinner-rotate-vrMQr", r = "crk-sm-q2vog", i = "crk-md-kcEfs", a = "crk-lg-8yfDn", o = "crk-label-ahktK", s = {
|
|
3
|
+
root: e,
|
|
4
|
+
circle: t,
|
|
5
|
+
"crk-spinner-rotate": "crk-crk-spinner-rotate-vrMQr",
|
|
6
|
+
crkSpinnerRotate: n,
|
|
7
|
+
sm: r,
|
|
8
|
+
md: i,
|
|
9
|
+
lg: a,
|
|
10
|
+
label: o
|
|
11
|
+
};
|
|
12
|
+
export { t as circle, n as crkSpinnerRotate, s as default, o as label, a as lg, i as md, e as root, r as sm };
|
|
@@ -1,196 +1,149 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import i from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
-
n && t.toggleOpen,
|
|
151
|
-
T,
|
|
152
|
-
s?.toggle
|
|
153
|
-
),
|
|
154
|
-
disabled: O,
|
|
155
|
-
onClick: K,
|
|
156
|
-
"aria-haspopup": "menu",
|
|
157
|
-
"aria-expanded": n,
|
|
158
|
-
"aria-controls": n ? M : void 0,
|
|
159
|
-
"aria-label": G,
|
|
160
|
-
children: /* @__PURE__ */ r(
|
|
161
|
-
"svg",
|
|
162
|
-
{
|
|
163
|
-
className: i(t.chevron, n && t.chevronOpen, s?.chevron),
|
|
164
|
-
viewBox: "0 0 10 6",
|
|
165
|
-
"aria-hidden": "true",
|
|
166
|
-
children: /* @__PURE__ */ r("path", { d: "M1 1l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
] }),
|
|
172
|
-
a && !y && A(),
|
|
173
|
-
a && y && n && typeof document < "u" && ee(
|
|
174
|
-
A({
|
|
175
|
-
position: "fixed",
|
|
176
|
-
top: d.top,
|
|
177
|
-
left: v === "right" ? void 0 : d.left,
|
|
178
|
-
// clientWidth, not innerWidth: `right` on a fixed element is
|
|
179
|
-
// measured from the viewport edge inside the scrollbar, while
|
|
180
|
-
// innerWidth includes it — the menu would shift left by the
|
|
181
|
-
// scrollbar width whenever the page scrolls.
|
|
182
|
-
right: v === "right" ? document.documentElement.clientWidth - (d.left + d.width) : void 0,
|
|
183
|
-
width: d.width,
|
|
184
|
-
zIndex: "var(--crk-z-floating)"
|
|
185
|
-
}),
|
|
186
|
-
document.body
|
|
187
|
-
)
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
oe.displayName = "SplitButton";
|
|
194
|
-
export {
|
|
195
|
-
oe as SplitButton
|
|
196
|
-
};
|
|
1
|
+
import e from "./SplitButton.module.js";
|
|
2
|
+
import t from "../Button/Button.module.js";
|
|
3
|
+
import { EscapeLayerProvider as n, useEscapeLayer as r } from "../../hooks/useEscapeLayer.js";
|
|
4
|
+
import { usePortalPosition as i } from "../../hooks/usePortalPosition.js";
|
|
5
|
+
import { forwardRef as a, useCallback as o, useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
6
|
+
import d from "clsx";
|
|
7
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal as m } from "react-dom";
|
|
9
|
+
// src/components/SplitButton/SplitButton.tsx
|
|
10
|
+
var h = a(({ actions: a, 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] = u(!1), j = l(null), M = l(null), N = l(null), P = c();
|
|
12
|
+
s(() => {
|
|
13
|
+
k && M.current && M.current.querySelector("[role=\"menuitem\"]:not([disabled])")?.focus();
|
|
14
|
+
}, [k]);
|
|
15
|
+
let F = o(() => {
|
|
16
|
+
A(!1), E?.(), N.current?.focus();
|
|
17
|
+
}, [E]), I = o(() => {
|
|
18
|
+
A((e) => {
|
|
19
|
+
let t = !e;
|
|
20
|
+
return t ? T?.() : E?.(), t;
|
|
21
|
+
});
|
|
22
|
+
}, [T, E]);
|
|
23
|
+
s(() => {
|
|
24
|
+
if (!k) return;
|
|
25
|
+
let e = (e) => {
|
|
26
|
+
let t = e.target;
|
|
27
|
+
j.current?.contains(t) || M.current?.contains(t) || F();
|
|
28
|
+
};
|
|
29
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
30
|
+
}, [k, F]);
|
|
31
|
+
let L = r(F, k), R = i(j, k && y);
|
|
32
|
+
if (a.length === 0) return null;
|
|
33
|
+
let [z, ...B] = a, V = B.length > 0, H = _ || z.disabled, U = d(t.root, t[h], t[g]), W = h === "secondary" ? e.overlapOutline : h === "ghost" ? e.dividerSubtle : e.dividerOnFill, G = d(U, e.main, V && e.mainAttached, V && k && e.mainOpen, D?.main), K = (e) => x !== void 0 && (typeof e == "string" || typeof e == "number") ? String(e) : void 0, q = /* @__PURE__ */ p("span", {
|
|
34
|
+
className: e.mainContent,
|
|
35
|
+
children: [/* @__PURE__ */ f("span", {
|
|
36
|
+
className: e.mainLabel,
|
|
37
|
+
children: z.label
|
|
38
|
+
}), V && /* @__PURE__ */ f("span", {
|
|
39
|
+
className: e.sizer,
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: a.map((t, n) => /* @__PURE__ */ f("span", {
|
|
42
|
+
className: e.sizerItem,
|
|
43
|
+
children: t.label
|
|
44
|
+
}, n))
|
|
45
|
+
})]
|
|
46
|
+
}), J = z.href && !H ? /* @__PURE__ */ f("a", {
|
|
47
|
+
id: w,
|
|
48
|
+
className: G,
|
|
49
|
+
href: z.href,
|
|
50
|
+
target: z.target,
|
|
51
|
+
rel: z.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
52
|
+
title: K(z.label),
|
|
53
|
+
onClick: z.onClick,
|
|
54
|
+
children: q
|
|
55
|
+
}) : /* @__PURE__ */ f("button", {
|
|
56
|
+
id: w,
|
|
57
|
+
type: "button",
|
|
58
|
+
className: G,
|
|
59
|
+
disabled: H,
|
|
60
|
+
title: K(z.label),
|
|
61
|
+
onClick: z.onClick,
|
|
62
|
+
children: q
|
|
63
|
+
}), Y = B.map((t, n) => {
|
|
64
|
+
let r = d(e.item, t.disabled && e.itemDisabled, t.danger && e.itemDanger, D?.item), i = (e) => {
|
|
65
|
+
t.onClick?.(e), F();
|
|
66
|
+
};
|
|
67
|
+
return t.href && !t.disabled ? /* @__PURE__ */ f("a", {
|
|
68
|
+
role: "menuitem",
|
|
69
|
+
className: r,
|
|
70
|
+
href: t.href,
|
|
71
|
+
target: t.target,
|
|
72
|
+
rel: t.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
73
|
+
title: K(t.label),
|
|
74
|
+
onClick: i,
|
|
75
|
+
children: t.label
|
|
76
|
+
}, n) : /* @__PURE__ */ f("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
role: "menuitem",
|
|
79
|
+
className: r,
|
|
80
|
+
disabled: t.disabled,
|
|
81
|
+
title: K(t.label),
|
|
82
|
+
onClick: i,
|
|
83
|
+
children: t.label
|
|
84
|
+
}, n);
|
|
85
|
+
}), X = {
|
|
86
|
+
sm: e.menuSm,
|
|
87
|
+
md: e.menuMd,
|
|
88
|
+
lg: e.menuLg
|
|
89
|
+
}[g], Z = (t) => /* @__PURE__ */ f("div", {
|
|
90
|
+
ref: M,
|
|
91
|
+
id: P,
|
|
92
|
+
className: d(e.menu, X, k && e.menuOpen, v === "left" ? e.alignLeft : e.alignRight, D?.menu),
|
|
93
|
+
style: t,
|
|
94
|
+
role: "menu",
|
|
95
|
+
children: /* @__PURE__ */ f(n, {
|
|
96
|
+
value: L,
|
|
97
|
+
children: Y
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ p("div", {
|
|
101
|
+
ref: O,
|
|
102
|
+
className: d(e.root, D?.root, S),
|
|
103
|
+
style: x === void 0 ? C : {
|
|
104
|
+
maxWidth: x,
|
|
105
|
+
...C
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ p("div", {
|
|
109
|
+
ref: j,
|
|
110
|
+
className: d(e.group, D?.group),
|
|
111
|
+
children: [J, V && /* @__PURE__ */ f("button", {
|
|
112
|
+
ref: N,
|
|
113
|
+
type: "button",
|
|
114
|
+
className: d(U, t.iconOnly, e.toggle, k && e.toggleOpen, W, D?.toggle),
|
|
115
|
+
disabled: _,
|
|
116
|
+
onClick: I,
|
|
117
|
+
"aria-haspopup": "menu",
|
|
118
|
+
"aria-expanded": k,
|
|
119
|
+
"aria-controls": k ? P : void 0,
|
|
120
|
+
"aria-label": b,
|
|
121
|
+
children: /* @__PURE__ */ f("svg", {
|
|
122
|
+
className: d(e.chevron, k && e.chevronOpen, D?.chevron),
|
|
123
|
+
viewBox: "0 0 10 6",
|
|
124
|
+
"aria-hidden": "true",
|
|
125
|
+
children: /* @__PURE__ */ f("path", {
|
|
126
|
+
d: "M1 1l4 4 4-4",
|
|
127
|
+
fill: "none",
|
|
128
|
+
stroke: "currentColor",
|
|
129
|
+
strokeWidth: "1.5",
|
|
130
|
+
strokeLinecap: "round",
|
|
131
|
+
strokeLinejoin: "round"
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
})]
|
|
135
|
+
}),
|
|
136
|
+
V && !y && Z(),
|
|
137
|
+
V && y && k && typeof document < "u" && m(Z({
|
|
138
|
+
position: "fixed",
|
|
139
|
+
top: R.top,
|
|
140
|
+
left: v === "right" ? void 0 : R.left,
|
|
141
|
+
right: v === "right" ? document.documentElement.clientWidth - (R.left + R.width) : void 0,
|
|
142
|
+
width: R.width,
|
|
143
|
+
zIndex: "var(--crk-z-floating)"
|
|
144
|
+
}), document.body)
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
h.displayName = "SplitButton";
|
|
149
|
+
export { h as SplitButton };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/components/SplitButton/SplitButton.module.scss
|
|
2
|
+
var e = "crk-root-WQNOC", t = "crk-group-vpjIZ", n = "crk-main-rC6D1", r = "crk-mainContent-ztmsF", i = "crk-mainLabel-nGrtw", a = "crk-sizer-PLveG", o = "crk-sizerItem-dwWwd", s = "crk-mainAttached-AhE-l", c = "crk-toggle-yVTi-", l = "crk-mainOpen-7hEXl", u = "crk-toggleOpen-56O29", d = "crk-dividerOnFill-HLKeu", f = "crk-dividerSubtle-g-TfH", p = "crk-overlapOutline-yWbkD", m = "crk-chevron-4zed5", h = "crk-chevronOpen-7vOPn", g = "crk-menu-2ijiM", _ = "crk-menuOpen-hANn0", v = "crk-menuEnter-xjAuj", y = "crk-menuSm-WBQSi", b = "crk-menuMd-xjRTT", x = "crk-menuLg-rXDWh", S = "crk-alignLeft-aXK9A", C = "crk-alignRight-ANsBn", w = "crk-item-rolo0", T = "crk-itemDisabled-A7T-8", E = "crk-itemDanger-g19Qe", D = {
|
|
3
|
+
root: e,
|
|
4
|
+
group: t,
|
|
5
|
+
main: n,
|
|
6
|
+
mainContent: r,
|
|
7
|
+
mainLabel: i,
|
|
8
|
+
sizer: a,
|
|
9
|
+
sizerItem: o,
|
|
10
|
+
mainAttached: s,
|
|
11
|
+
toggle: c,
|
|
12
|
+
mainOpen: l,
|
|
13
|
+
toggleOpen: u,
|
|
14
|
+
dividerOnFill: d,
|
|
15
|
+
dividerSubtle: f,
|
|
16
|
+
overlapOutline: p,
|
|
17
|
+
chevron: m,
|
|
18
|
+
chevronOpen: h,
|
|
19
|
+
menu: g,
|
|
20
|
+
menuOpen: _,
|
|
21
|
+
menuEnter: v,
|
|
22
|
+
menuSm: y,
|
|
23
|
+
menuMd: b,
|
|
24
|
+
menuLg: x,
|
|
25
|
+
alignLeft: S,
|
|
26
|
+
alignRight: C,
|
|
27
|
+
item: w,
|
|
28
|
+
itemDisabled: T,
|
|
29
|
+
itemDanger: E
|
|
30
|
+
};
|
|
31
|
+
export { S as alignLeft, C as alignRight, m as chevron, h as chevronOpen, D as default, d as dividerOnFill, f as dividerSubtle, t as group, w as item, E as itemDanger, T as itemDisabled, n as main, s as mainAttached, r as mainContent, i as mainLabel, l as mainOpen, g as menu, v as menuEnter, x as menuLg, b as menuMd, _ as menuOpen, y as menuSm, p as overlapOutline, e as root, a as sizer, o as sizerItem, c as toggle, u as toggleOpen };
|