@overdoser/react-toolkit 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,73 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import a from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return /* @__PURE__ */ y("label", { className: n(a.root, o?.root, i), style: d, children: [
|
|
52
|
-
/* @__PURE__ */ t(
|
|
53
|
-
"input",
|
|
54
|
-
{
|
|
55
|
-
ref: b,
|
|
56
|
-
type: "radio",
|
|
57
|
-
className: n(a.input, N && a.error, o?.input),
|
|
58
|
-
name: x,
|
|
59
|
-
value: r,
|
|
60
|
-
checked: C,
|
|
61
|
-
onChange: g,
|
|
62
|
-
...u
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
l && /* @__PURE__ */ t("span", { className: n(a.label, o?.label), children: l })
|
|
66
|
-
] });
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
k.displayName = "Radio";
|
|
70
|
-
export {
|
|
71
|
-
k as Radio,
|
|
72
|
-
j as RadioGroup
|
|
73
|
-
};
|
|
1
|
+
import { createContext as e, forwardRef as t, useContext as n } from "react";
|
|
2
|
+
import r from "clsx";
|
|
3
|
+
import i from "./Radio.module.scss.js";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
// src/components/inputs/Radio/Radio.tsx
|
|
6
|
+
var s = e(null), c = t(({ name: e, value: t, onChange: n, className: o, style: c, children: l, id: u, "aria-label": d, "aria-labelledby": f, required: p, error: m = !1 }, h) => /* @__PURE__ */ a(s.Provider, {
|
|
7
|
+
value: {
|
|
8
|
+
name: e,
|
|
9
|
+
value: t,
|
|
10
|
+
onChange: n,
|
|
11
|
+
error: m
|
|
12
|
+
},
|
|
13
|
+
children: /* @__PURE__ */ a("div", {
|
|
14
|
+
ref: h,
|
|
15
|
+
id: u,
|
|
16
|
+
className: r(i.group, o),
|
|
17
|
+
style: c,
|
|
18
|
+
role: "radiogroup",
|
|
19
|
+
tabIndex: -1,
|
|
20
|
+
"aria-label": d,
|
|
21
|
+
"aria-labelledby": f,
|
|
22
|
+
"aria-required": p || void 0,
|
|
23
|
+
children: l
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
c.displayName = "RadioGroup";
|
|
27
|
+
var l = t(({ label: e, value: t, classes: c, className: l, style: u, onChange: d, checked: f, name: p, error: m = !1, ...h }, g) => {
|
|
28
|
+
let _ = n(s), v = _?.name ?? p, y = _ ? _.value === t : f, b = m || !!_?.error;
|
|
29
|
+
return /* @__PURE__ */ o("label", {
|
|
30
|
+
className: r(i.root, c?.root, l),
|
|
31
|
+
style: u,
|
|
32
|
+
children: [/* @__PURE__ */ a("input", {
|
|
33
|
+
ref: g,
|
|
34
|
+
type: "radio",
|
|
35
|
+
className: r(i.input, b && i.error, c?.input),
|
|
36
|
+
name: v,
|
|
37
|
+
value: t,
|
|
38
|
+
checked: y,
|
|
39
|
+
onChange: (e) => {
|
|
40
|
+
_?.onChange?.(t), d?.(e);
|
|
41
|
+
},
|
|
42
|
+
...h
|
|
43
|
+
}), e && /* @__PURE__ */ a("span", {
|
|
44
|
+
className: r(i.label, c?.label),
|
|
45
|
+
children: e
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
l.displayName = "Radio";
|
|
50
|
+
export { l as Radio, c as RadioGroup };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
n as default,
|
|
10
|
-
c as error,
|
|
11
|
-
r as group,
|
|
12
|
-
t as input,
|
|
13
|
-
e as label,
|
|
14
|
-
o as root
|
|
1
|
+
// src/components/inputs/Radio/Radio.module.scss
|
|
2
|
+
var e = "crk-group-NNwCD", t = "crk-root-7fGik", n = "crk-input-43PQW", r = "crk-error-Xb8Jc", i = "crk-label-aW30x", a = {
|
|
3
|
+
group: e,
|
|
4
|
+
root: t,
|
|
5
|
+
input: n,
|
|
6
|
+
error: r,
|
|
7
|
+
label: i
|
|
15
8
|
};
|
|
9
|
+
export { a as default, r as error, e as group, n as input, i as label, t as root };
|
|
@@ -1,116 +1,99 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import a from "clsx";
|
|
3
|
+
import o from "./SearchInput.module.scss.js";
|
|
4
|
+
import { Input as s } from "../Input/Input.js";
|
|
5
|
+
import { Spinner as c } from "../../Spinner/Spinner.js";
|
|
6
|
+
import { Kbd as l } from "../../Kbd/Kbd.js";
|
|
7
|
+
import { useDebouncedValue as u } from "../../../hooks/useDebouncedValue.js";
|
|
8
|
+
import { useKeyboard as d } from "../../../hooks/useKeyboard.js";
|
|
9
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
// src/components/inputs/SearchInput/SearchInput.tsx
|
|
11
|
+
var h = ({ className: e }) => /* @__PURE__ */ m("svg", {
|
|
12
|
+
className: e,
|
|
13
|
+
viewBox: "0 0 20 20",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeWidth: "1.8",
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
children: [/* @__PURE__ */ p("circle", {
|
|
19
|
+
cx: "8.5",
|
|
20
|
+
cy: "8.5",
|
|
21
|
+
r: "5.5"
|
|
22
|
+
}), /* @__PURE__ */ p("path", {
|
|
23
|
+
d: "M12.8 12.8L17 17",
|
|
24
|
+
strokeLinecap: "round"
|
|
25
|
+
})]
|
|
26
|
+
}), g = () => typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform ?? "");
|
|
27
|
+
function _(e) {
|
|
28
|
+
let t = g(), n = e.split("+").map((e) => e.trim()).filter(Boolean);
|
|
29
|
+
return e.endsWith("+") && n.push("+"), n.map((e) => {
|
|
30
|
+
let n = e.toLowerCase();
|
|
31
|
+
return n === "mod" ? t ? "⌘" : "Ctrl" : n === "meta" || n === "cmd" || n === "command" ? t ? "⌘" : "Win" : n === "ctrl" || n === "control" ? t ? "⌃" : "Ctrl" : n === "alt" || n === "option" ? t ? "⌥" : "Alt" : n === "shift" ? t ? "⇧" : "Shift" : n === "esc" || n === "escape" ? "Esc" : n === "space" ? "Space" : e.length === 1 ? e.toUpperCase() : e;
|
|
32
|
+
}).join(t ? "" : " ");
|
|
31
33
|
}
|
|
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
|
-
onFocus: (e) => {
|
|
99
|
-
I(!0), K?.(e);
|
|
100
|
-
},
|
|
101
|
-
onBlur: (e) => {
|
|
102
|
-
I(!1), M?.(e);
|
|
103
|
-
},
|
|
104
|
-
"aria-label": Q ? void 0 : L,
|
|
105
|
-
classes: l,
|
|
106
|
-
...f,
|
|
107
|
-
className: m(d.root, f.className)
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
oe.displayName = "SearchInput";
|
|
113
|
-
export {
|
|
114
|
-
oe as SearchInput,
|
|
115
|
-
ne as formatHotkey
|
|
116
|
-
};
|
|
34
|
+
var v = e(({ onValueChange: e, onSearch: g, debounce: v = 300, loading: y = !1, hotkey: b = !1, showHotkeyHint: x = !0, onEscape: S = "clear", searchLabel: C = "Search", classes: w, suffix: T, value: E, defaultValue: D, onChange: O, onClear: k, onKeyDown: A, onFocus: j, onBlur: M, ...N }, P) => {
|
|
35
|
+
let F = r(null), I = t((e) => {
|
|
36
|
+
F.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
|
|
37
|
+
}, [P]), [L, R] = i(() => D == null ? "" : String(D)), z = E != null, B = z ? String(E) : L, V = r(B), H = r(g);
|
|
38
|
+
H.current = g;
|
|
39
|
+
let U = t((e) => {
|
|
40
|
+
V.current !== e && (V.current = e, H.current?.(e));
|
|
41
|
+
}, []), W = u(B, v);
|
|
42
|
+
n(() => {
|
|
43
|
+
U(W);
|
|
44
|
+
}, [W, U]);
|
|
45
|
+
let [G, K] = i(!1), q = (t) => {
|
|
46
|
+
z || R(t.target.value), O?.(t), e?.(t.target.value);
|
|
47
|
+
}, J = () => {
|
|
48
|
+
U(""), k?.();
|
|
49
|
+
}, Y = () => {
|
|
50
|
+
let e = F.current;
|
|
51
|
+
e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), U(""));
|
|
52
|
+
}, X = (e) => {
|
|
53
|
+
A?.(e), e.defaultPrevented || (e.key === "Enter" ? (e.preventDefault(), U(e.currentTarget.value)) : e.key === "Escape" && S !== "none" && (S === "clear" && e.currentTarget.value.length > 0 ? (e.preventDefault(), Y()) : e.currentTarget.blur()));
|
|
54
|
+
}, Z = t(() => {
|
|
55
|
+
F.current?.focus(), F.current?.select();
|
|
56
|
+
}, []);
|
|
57
|
+
d(b ? { [b]: Z } : {}, {
|
|
58
|
+
active: !!b,
|
|
59
|
+
preventDefault: !0
|
|
60
|
+
});
|
|
61
|
+
let Q = !!b && x && B.length === 0 && !G, $ = y || Q || T ? /* @__PURE__ */ m(f, { children: [
|
|
62
|
+
y && /* @__PURE__ */ p(c, {
|
|
63
|
+
size: "sm",
|
|
64
|
+
label: "Searching",
|
|
65
|
+
className: a(o.spinner, w?.spinner)
|
|
66
|
+
}),
|
|
67
|
+
Q && /* @__PURE__ */ p(l, {
|
|
68
|
+
size: "sm",
|
|
69
|
+
className: a(o.hint, w?.hint),
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
children: _(b)
|
|
72
|
+
}),
|
|
73
|
+
T
|
|
74
|
+
] }) : void 0, ee = N["aria-label"] !== void 0 || N["aria-labelledby"] !== void 0;
|
|
75
|
+
return /* @__PURE__ */ p(s, {
|
|
76
|
+
ref: I,
|
|
77
|
+
type: "search",
|
|
78
|
+
clearable: !0,
|
|
79
|
+
prefix: /* @__PURE__ */ p(h, { className: a(o.icon, w?.icon) }),
|
|
80
|
+
suffix: $,
|
|
81
|
+
value: E,
|
|
82
|
+
defaultValue: D,
|
|
83
|
+
onChange: q,
|
|
84
|
+
onClear: J,
|
|
85
|
+
onKeyDown: X,
|
|
86
|
+
onFocus: (e) => {
|
|
87
|
+
K(!0), j?.(e);
|
|
88
|
+
},
|
|
89
|
+
onBlur: (e) => {
|
|
90
|
+
K(!1), M?.(e);
|
|
91
|
+
},
|
|
92
|
+
"aria-label": ee ? void 0 : C,
|
|
93
|
+
classes: w,
|
|
94
|
+
...N,
|
|
95
|
+
className: a(o.root, N.className)
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
v.displayName = "SearchInput";
|
|
99
|
+
export { v as SearchInput, _ as formatHotkey };
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
r as default,
|
|
9
|
-
c as hint,
|
|
10
|
-
o as icon,
|
|
11
|
-
n as root,
|
|
12
|
-
t as spinner
|
|
1
|
+
// src/components/inputs/SearchInput/SearchInput.module.scss
|
|
2
|
+
var e = "crk-root-J798f", t = "crk-icon-qlYVE", n = "crk-spinner-2Q0Ra", r = "crk-hint-V22-E", i = {
|
|
3
|
+
root: e,
|
|
4
|
+
icon: t,
|
|
5
|
+
spinner: n,
|
|
6
|
+
hint: r
|
|
13
7
|
};
|
|
8
|
+
export { i as default, r as hint, t as icon, e as root, n as spinner };
|
|
@@ -24,6 +24,14 @@ export interface SelectClasses {
|
|
|
24
24
|
match: string;
|
|
25
25
|
/** Non-option rows in the menu: "No results", "Loading…", the search prompt. */
|
|
26
26
|
message: string;
|
|
27
|
+
/** Checklist mode: the box at the start of every row. */
|
|
28
|
+
checkbox: string;
|
|
29
|
+
/** Checklist mode: the bar under the search box holding the select/deselect actions. */
|
|
30
|
+
menuHeader: string;
|
|
31
|
+
/** Checklist mode: the "Select all" and "Deselect all" buttons. */
|
|
32
|
+
menuAction: string;
|
|
33
|
+
/** The "+N more" chip shown when `maxVisibleChips` hides some chips. */
|
|
34
|
+
moreChip: string;
|
|
27
35
|
}
|
|
28
36
|
export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onChange' | 'value'> {
|
|
29
37
|
/** Toolkit size scale (independent of the native `size` HTML attribute). @default 'md' */
|
|
@@ -38,7 +46,7 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
|
|
|
38
46
|
classes?: Partial<SelectClasses>;
|
|
39
47
|
/** Replaces the native `<select>` with a filterable dropdown. @default false */
|
|
40
48
|
searchable?: boolean;
|
|
41
|
-
/** Placeholder for the search input (searchable
|
|
49
|
+
/** Placeholder for the search input (searchable and checklist modes). @default 'Search...' */
|
|
42
50
|
searchPlaceholder?: string;
|
|
43
51
|
/** Native + searchable mode change event (synthetic in searchable mode). */
|
|
44
52
|
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
@@ -50,12 +58,16 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
|
|
|
50
58
|
multiple?: boolean;
|
|
51
59
|
/** Multi-mode callback. */
|
|
52
60
|
onValuesChange?: (values: string[]) => void;
|
|
53
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Clear the search query after each toggle in multi mode.
|
|
63
|
+
* @default true, or false with `checklist`
|
|
64
|
+
*/
|
|
54
65
|
clearSearchOnSelect?: boolean;
|
|
55
66
|
/**
|
|
56
67
|
* Multi-mode only. When `true`, the menu closes after each add/remove (and
|
|
57
68
|
* after a `Create` row click) — the user has to reopen to pick another.
|
|
58
|
-
* Set to `false` for the "stay open until done" pattern.
|
|
69
|
+
* Set to `false` for the "stay open until done" pattern.
|
|
70
|
+
* @default true, or false with `checklist`
|
|
59
71
|
*/
|
|
60
72
|
closeOnSelect?: boolean;
|
|
61
73
|
/**
|
|
@@ -123,12 +135,51 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
|
|
|
123
135
|
* the menu. @default true
|
|
124
136
|
*/
|
|
125
137
|
portal?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Multi-mode only. Checklist picker for selecting many values while filtering.
|
|
140
|
+
*
|
|
141
|
+
* The search box moves into the menu and every row gets a checkbox.
|
|
142
|
+
* Chips show the plain `label`; a rich `content` is used only in the menu rows.
|
|
143
|
+
* Selected options stay listed when they don't match the query, in their `options` order.
|
|
144
|
+
* An option unchecked while filtered stays listed until the query changes, so rows never jump under the pointer.
|
|
145
|
+
* A header offers "Select all" (every matching option) and "Deselect all".
|
|
146
|
+
* The menu stays open while picking: `closeOnSelect` and `clearSearchOnSelect` default to `false`.
|
|
147
|
+
* A click outside, Escape or Tab closes it.
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
150
|
+
checklist?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Checklist mode: label of the header action that selects every matching option.
|
|
153
|
+
* @default query ? 'Select all matching' : 'Select all'
|
|
154
|
+
*/
|
|
155
|
+
selectAllLabel?: React.ReactNode;
|
|
156
|
+
/**
|
|
157
|
+
* Checklist mode: label of the header action that clears the selection.
|
|
158
|
+
* @default 'Deselect all'
|
|
159
|
+
*/
|
|
160
|
+
deselectAllLabel?: React.ReactNode;
|
|
161
|
+
/**
|
|
162
|
+
* Multi-mode only. Show at most this many chips in the control.
|
|
163
|
+
*
|
|
164
|
+
* The rest collapse into a "+N more" chip whose tooltip lists them.
|
|
165
|
+
* Unlimited when omitted.
|
|
166
|
+
*/
|
|
167
|
+
maxVisibleChips?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Multi-mode only. Text of the overflow chip shown by `maxVisibleChips`.
|
|
170
|
+
* @default (n) => `+${n} more`
|
|
171
|
+
*/
|
|
172
|
+
moreChipsLabel?: (hiddenCount: number) => React.ReactNode;
|
|
126
173
|
}
|
|
127
174
|
/**
|
|
128
175
|
* Three internal modes, picked automatically:
|
|
129
176
|
* - **Native** (default): wraps `<select>`. Use `onChange` or pass options as `children`.
|
|
130
177
|
* - **Searchable**: set `searchable`. Custom dropdown with text filter.
|
|
131
178
|
* - **Multi**: set `multiple`. Chip-based multi-select with text filter.
|
|
179
|
+
* Add `checklist` for the AWS-console style picker: search inside the menu,
|
|
180
|
+
* a checkbox per row, selected rows kept while filtering, and
|
|
181
|
+
* "Select all" / "Deselect all" actions.
|
|
182
|
+
* `maxVisibleChips` collapses long selections into a "+N more" chip.
|
|
132
183
|
*
|
|
133
184
|
* The searchable and multi modes filter `options` locally by default. Pass
|
|
134
185
|
* `onSearch` for **remote** search: the query (debounced by `searchDebounce`)
|
|
@@ -145,6 +196,7 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
|
|
|
145
196
|
* @example Native: <Select options={[{ value: 'a', label: 'A' }]} onValueChange={setValue} />
|
|
146
197
|
* @example Searchable: <Select searchable options={users} value={id} onValueChange={setId} />
|
|
147
198
|
* @example Multi: <Select multiple options={tags} value={selected} onValuesChange={setSelected} />
|
|
199
|
+
* @example Checklist: <Select multiple checklist maxVisibleChips={3} options={logGroups} value={groups} onValuesChange={setGroups} />
|
|
148
200
|
* @example Remote: <Select searchable options={results} loading={isFetching} onSearch={fetchUsers} value={id} onValueChange={setId} selectedLabels={{ [id]: name }} />
|
|
149
201
|
*/
|
|
150
202
|
export declare const Select: import('react').ForwardRefExoticComponent<Omit<SelectProps, "ref"> & import('react').RefAttributes<HTMLSelectElement>>;
|