@overdoser/react-toolkit 0.21.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 +1 -0
- package/CHANGELOG.md +27 -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,15 +1,15 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useId as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
2
|
+
import { createPortal as s } from "react-dom";
|
|
3
|
+
import c from "clsx";
|
|
4
|
+
import l from "./CommandPalette.module.scss.js";
|
|
5
|
+
import { useFocusTrap as ee } from "../../hooks/useFocusTrap.js";
|
|
6
|
+
import { EscapeLayerProvider as te, useEscapeLayer as ne } from "../../hooks/useEscapeLayer.js";
|
|
7
|
+
import { useKeyboard as re } from "../../hooks/useKeyboard.js";
|
|
8
|
+
import { Kbd as u } from "../Kbd/Kbd.js";
|
|
9
|
+
import { Spinner as d } from "../Spinner/Spinner.js";
|
|
10
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
11
|
// src/components/CommandPalette/CommandPalette.tsx
|
|
12
|
-
function
|
|
12
|
+
function h(e, t) {
|
|
13
13
|
let n = t.trim().toLowerCase();
|
|
14
14
|
if (!n) return [];
|
|
15
15
|
let r = e.toLowerCase(), i = r.indexOf(n);
|
|
@@ -23,8 +23,8 @@ function _(e, t) {
|
|
|
23
23
|
}
|
|
24
24
|
return a;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
let n =
|
|
26
|
+
function g(e, t) {
|
|
27
|
+
let n = h(e, t);
|
|
28
28
|
if (n === null) return !1;
|
|
29
29
|
if (n.length === 0) return 1;
|
|
30
30
|
let r = e.toLowerCase(), i = t.trim().toLowerCase(), a = n[0];
|
|
@@ -32,22 +32,22 @@ function v(e, t) {
|
|
|
32
32
|
let o = n[n.length - 1] - n[0] - (n.length - 1);
|
|
33
33
|
return Math.max(1, 50 - o - a);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function _(e, t) {
|
|
36
36
|
if (!t.trim()) return 1;
|
|
37
37
|
let n = !1;
|
|
38
|
-
typeof e.label == "string" && (n =
|
|
38
|
+
typeof e.label == "string" && (n = g(e.label, t));
|
|
39
39
|
for (let r of e.keywords ?? []) {
|
|
40
|
-
let e =
|
|
40
|
+
let e = g(r, t);
|
|
41
41
|
e !== !1 && (n = Math.max(n === !1 ? 0 : n, e - 10));
|
|
42
42
|
}
|
|
43
43
|
return n;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function ie(e, t, n, r) {
|
|
46
46
|
if (!n || typeof e != "string" || !t.trim()) return e;
|
|
47
|
-
let i =
|
|
47
|
+
let i = h(e, t);
|
|
48
48
|
if (!i || i.length === 0) return e;
|
|
49
49
|
let a = new Set(i), o = [], s = "", c = !1, l = () => {
|
|
50
|
-
s &&= (o.push(c ? /* @__PURE__ */
|
|
50
|
+
s &&= (o.push(c ? /* @__PURE__ */ p("mark", {
|
|
51
51
|
className: r,
|
|
52
52
|
children: s
|
|
53
53
|
}, o.length) : s), "");
|
|
@@ -58,52 +58,52 @@ function ne(e, t, n, r) {
|
|
|
58
58
|
}
|
|
59
59
|
return l(), o;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
let [
|
|
63
|
-
return
|
|
64
|
-
open:
|
|
65
|
-
setOpen:
|
|
66
|
-
toggle:
|
|
61
|
+
function v(e = !1) {
|
|
62
|
+
let [n, r] = o(e), a = t(() => r((e) => !e), []);
|
|
63
|
+
return i(() => ({
|
|
64
|
+
open: n,
|
|
65
|
+
setOpen: r,
|
|
66
|
+
toggle: a,
|
|
67
67
|
paletteProps: {
|
|
68
|
-
open:
|
|
69
|
-
onOpenChange:
|
|
68
|
+
open: n,
|
|
69
|
+
onOpenChange: r
|
|
70
70
|
}
|
|
71
|
-
}), [
|
|
71
|
+
}), [n, a]);
|
|
72
72
|
}
|
|
73
|
-
var
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
let { sections: ge, flat: G } =
|
|
73
|
+
var y = e(({ open: e, onOpenChange: h, items: g, onSelect: v, closeOnSelect: y = !0, query: b, defaultQuery: ae = "", onQueryChange: x, filter: S = _, loading: C = !1, loadingMessage: oe = "Searching…", emptyMessage: se = "No results", placeholder: ce = "Type a command or search…", hotkey: w = "mod+k", recentIds: T, recentLabel: E = "Recent", maxResults: D = 50, groupOrder: O, footer: k, escapeClearsQuery: A = !1, highlightMatches: le = !0, renderItem: j, "aria-label": ue = "Command palette", classes: M, className: de, style: fe }, N) => {
|
|
74
|
+
let P = r(), F = a(null), I = a(null), pe = a(null), me = (e) => {
|
|
75
|
+
F.current = e, typeof N == "function" ? N(e) : N && (N.current = e);
|
|
76
|
+
}, [he, L] = o(ae), R = b ?? he, z = t((e) => {
|
|
77
|
+
b === void 0 && L(e), x?.(e);
|
|
78
|
+
}, [b, x]), [B, V] = o([]), H = B.length ? B[B.length - 1].children ?? [] : g, [U, W] = o(0);
|
|
79
|
+
n(() => {
|
|
80
|
+
e && (V([]), W(0));
|
|
81
|
+
}, [e]);
|
|
82
|
+
let { sections: ge, flat: G } = i(() => {
|
|
83
83
|
let e = R.trim(), t = [];
|
|
84
84
|
H.forEach((e, n) => {
|
|
85
85
|
let r = !0;
|
|
86
|
-
|
|
86
|
+
S && (r = S(e, R)), r !== !1 && t.push({
|
|
87
87
|
item: e,
|
|
88
88
|
score: (r === !0 ? 1 : r) * 1e6 - n
|
|
89
89
|
});
|
|
90
|
-
}),
|
|
90
|
+
}), S && e && t.sort((e, t) => t.score - e.score);
|
|
91
91
|
let n = t.map((e) => e.item), r = [];
|
|
92
|
-
if (!e &&
|
|
93
|
-
for (let e of
|
|
92
|
+
if (!e && T?.length && B.length === 0) {
|
|
93
|
+
for (let e of T) {
|
|
94
94
|
let t = n.find((t) => t.id === e);
|
|
95
95
|
t && r.push(t);
|
|
96
96
|
}
|
|
97
97
|
let e = new Set(r.map((e) => e.id));
|
|
98
98
|
n = n.filter((t) => !e.has(t.id));
|
|
99
99
|
}
|
|
100
|
-
let i =
|
|
100
|
+
let i = D, a = (e) => {
|
|
101
101
|
let t = e.slice(0, Math.max(0, i));
|
|
102
102
|
return i -= t.length, t;
|
|
103
103
|
}, o = [];
|
|
104
104
|
r.length && o.push({
|
|
105
105
|
key: "__recent",
|
|
106
|
-
label:
|
|
106
|
+
label: E,
|
|
107
107
|
items: a(r)
|
|
108
108
|
});
|
|
109
109
|
let s = /* @__PURE__ */ new Map(), c = [];
|
|
@@ -113,7 +113,7 @@ var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x =
|
|
|
113
113
|
label: null,
|
|
114
114
|
items: a(c)
|
|
115
115
|
});
|
|
116
|
-
let l = [...(
|
|
116
|
+
let l = [...(O ?? []).filter((e) => s.has(e)), ...[...s.keys()].filter((e) => !O?.includes(e))];
|
|
117
117
|
for (let e of l) {
|
|
118
118
|
let t = a(s.get(e));
|
|
119
119
|
t.length && o.push({
|
|
@@ -129,58 +129,58 @@ var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x =
|
|
|
129
129
|
}, [
|
|
130
130
|
H,
|
|
131
131
|
R,
|
|
132
|
-
|
|
132
|
+
S,
|
|
133
|
+
T,
|
|
134
|
+
E,
|
|
133
135
|
D,
|
|
134
136
|
O,
|
|
135
|
-
k,
|
|
136
|
-
A,
|
|
137
137
|
B.length
|
|
138
138
|
]);
|
|
139
|
-
|
|
139
|
+
n(() => {
|
|
140
140
|
let e = G.findIndex((e) => !e.disabled);
|
|
141
141
|
W((t) => G[t] && !G[t].disabled ? t : e < 0 ? 0 : e);
|
|
142
|
-
}, [G]),
|
|
143
|
-
(
|
|
142
|
+
}, [G]), n(() => {
|
|
143
|
+
(I.current?.querySelector(`[data-index="${U}"]`))?.scrollIntoView?.({ block: "nearest" });
|
|
144
144
|
}, [U]);
|
|
145
|
-
let K =
|
|
145
|
+
let K = t((e, t = !0) => {
|
|
146
146
|
if (!G.length) return;
|
|
147
147
|
let n = U;
|
|
148
148
|
for (let r = 0; r < G.length && (n += e, n = t ? (n + G.length) % G.length : Math.max(0, Math.min(G.length - 1, n)), G[n].disabled); r++);
|
|
149
149
|
W(n);
|
|
150
|
-
}, [G, U]), q =
|
|
150
|
+
}, [G, U]), q = t((e) => {
|
|
151
151
|
if (!G.length) return;
|
|
152
152
|
let t = Math.max(0, Math.min(G.length - 1, e)), n = e >= U ? -1 : 1;
|
|
153
153
|
for (; G[t]?.disabled;) if (t += n, t < 0 || t >= G.length) return;
|
|
154
154
|
W(t);
|
|
155
|
-
}, [G, U]), J =
|
|
156
|
-
e.disabled || (e.children?.length ? (V((t) => [...t, e]), z(""), W(0)) : (e.onSelect?.(),
|
|
155
|
+
}, [G, U]), J = t((e) => {
|
|
156
|
+
e.disabled || (e.children?.length ? (V((t) => [...t, e]), z(""), W(0)) : (e.onSelect?.(), v?.(e), y && h(!1)));
|
|
157
157
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
v,
|
|
159
|
+
y,
|
|
160
|
+
h,
|
|
161
161
|
z
|
|
162
|
-
]), Y =
|
|
162
|
+
]), Y = t((e) => {
|
|
163
163
|
V((t) => t.slice(0, e)), W(0);
|
|
164
|
-
}, []), _e =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
}, []), _e = i(() => w ? { [w]: () => h(!e) } : {}, [
|
|
165
|
+
w,
|
|
166
|
+
e,
|
|
167
|
+
h
|
|
168
168
|
]);
|
|
169
|
-
|
|
170
|
-
let ve =
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
if (!
|
|
175
|
-
let
|
|
169
|
+
re(_e, { active: w !== !1 }), ee(F, e);
|
|
170
|
+
let ve = ne(() => {
|
|
171
|
+
A && R ? z("") : h(!1);
|
|
172
|
+
}, e);
|
|
173
|
+
n(() => {
|
|
174
|
+
if (!e) return;
|
|
175
|
+
let t = document.body.style.overflow;
|
|
176
176
|
return document.body.style.overflow = "hidden", () => {
|
|
177
|
-
document.body.style.overflow =
|
|
177
|
+
document.body.style.overflow = t;
|
|
178
178
|
};
|
|
179
|
-
}, [
|
|
180
|
-
let X =
|
|
179
|
+
}, [e]);
|
|
180
|
+
let X = a(!1), ye = (e) => {
|
|
181
181
|
X.current = e.target === e.currentTarget;
|
|
182
182
|
}, be = (e) => {
|
|
183
|
-
X.current && e.target === e.currentTarget &&
|
|
183
|
+
X.current && e.target === e.currentTarget && h(!1), X.current = !1;
|
|
184
184
|
}, xe = (e) => {
|
|
185
185
|
switch (e.key) {
|
|
186
186
|
case "ArrowDown":
|
|
@@ -202,11 +202,11 @@ var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x =
|
|
|
202
202
|
e.preventDefault(), q(U - 10);
|
|
203
203
|
break;
|
|
204
204
|
case "Enter": {
|
|
205
|
-
if (
|
|
205
|
+
if (C) return;
|
|
206
206
|
let t = G[U];
|
|
207
207
|
if (!t) return;
|
|
208
208
|
if (e.preventDefault(), t.href) {
|
|
209
|
-
(
|
|
209
|
+
(I.current?.querySelector(`[data-index="${U}"]`))?.click();
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
J(t);
|
|
@@ -215,56 +215,56 @@ var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x =
|
|
|
215
215
|
case "Backspace": !R && B.length && (e.preventDefault(), Y(B.length - 1));
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
|
-
if (!
|
|
219
|
-
let Z = `${
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
218
|
+
if (!e) return null;
|
|
219
|
+
let Z = `${P}-list`, Q = (e) => `${P}-opt-${e}`, Se = G[U], Ce = /* @__PURE__ */ m(f, { children: [
|
|
220
|
+
/* @__PURE__ */ m("span", { children: [
|
|
221
|
+
/* @__PURE__ */ p(u, {
|
|
222
222
|
size: "sm",
|
|
223
223
|
children: "↑"
|
|
224
224
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ p(u, {
|
|
226
226
|
size: "sm",
|
|
227
227
|
children: "↓"
|
|
228
228
|
}),
|
|
229
229
|
" navigate"
|
|
230
230
|
] }),
|
|
231
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ m("span", { children: [/* @__PURE__ */ p(u, {
|
|
232
232
|
size: "sm",
|
|
233
233
|
children: "↵"
|
|
234
234
|
}), " select"] }),
|
|
235
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ m("span", { children: [/* @__PURE__ */ p(u, {
|
|
236
236
|
size: "sm",
|
|
237
237
|
children: "esc"
|
|
238
238
|
}), " close"] })
|
|
239
239
|
] }), $ = -1;
|
|
240
|
-
return
|
|
241
|
-
className:
|
|
240
|
+
return s(/* @__PURE__ */ p("div", {
|
|
241
|
+
className: c(l.backdrop, M?.backdrop),
|
|
242
242
|
onMouseDown: ye,
|
|
243
243
|
onMouseUp: be,
|
|
244
244
|
role: "presentation",
|
|
245
|
-
children: /* @__PURE__ */
|
|
246
|
-
ref:
|
|
247
|
-
className:
|
|
248
|
-
style:
|
|
245
|
+
children: /* @__PURE__ */ p("div", {
|
|
246
|
+
ref: me,
|
|
247
|
+
className: c(l.panel, M?.panel, de),
|
|
248
|
+
style: fe,
|
|
249
249
|
role: "dialog",
|
|
250
250
|
"aria-modal": "true",
|
|
251
|
-
"aria-label":
|
|
252
|
-
children: /* @__PURE__ */
|
|
251
|
+
"aria-label": ue,
|
|
252
|
+
children: /* @__PURE__ */ m(te, {
|
|
253
253
|
value: ve,
|
|
254
254
|
children: [
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
className:
|
|
255
|
+
/* @__PURE__ */ m("div", {
|
|
256
|
+
className: c(l.header, M?.header),
|
|
257
257
|
children: [
|
|
258
|
-
B.map((
|
|
258
|
+
B.map((e, t) => /* @__PURE__ */ p("button", {
|
|
259
259
|
type: "button",
|
|
260
|
-
className:
|
|
261
|
-
onClick: () => Y(
|
|
262
|
-
"aria-label": typeof
|
|
263
|
-
children:
|
|
264
|
-
},
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
ref:
|
|
267
|
-
className:
|
|
260
|
+
className: c(l.breadcrumb, M?.breadcrumb),
|
|
261
|
+
onClick: () => Y(t + 1 === B.length ? t : t + 1),
|
|
262
|
+
"aria-label": typeof e.label == "string" ? `Back to ${e.label}` : void 0,
|
|
263
|
+
children: e.label
|
|
264
|
+
}, e.id)),
|
|
265
|
+
/* @__PURE__ */ p("input", {
|
|
266
|
+
ref: pe,
|
|
267
|
+
className: c(l.input, M?.input),
|
|
268
268
|
type: "text",
|
|
269
269
|
role: "combobox",
|
|
270
270
|
"aria-expanded": "true",
|
|
@@ -273,120 +273,120 @@ var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x =
|
|
|
273
273
|
"aria-autocomplete": "list",
|
|
274
274
|
autoComplete: "off",
|
|
275
275
|
spellCheck: !1,
|
|
276
|
-
placeholder:
|
|
276
|
+
placeholder: ce,
|
|
277
277
|
value: R,
|
|
278
278
|
onChange: (e) => z(e.target.value),
|
|
279
279
|
onKeyDown: xe
|
|
280
280
|
}),
|
|
281
|
-
|
|
281
|
+
C && /* @__PURE__ */ p(d, {
|
|
282
282
|
size: "sm",
|
|
283
283
|
label: "Searching",
|
|
284
|
-
className:
|
|
284
|
+
className: l.headerSpinner
|
|
285
285
|
})
|
|
286
286
|
]
|
|
287
287
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
ref:
|
|
288
|
+
/* @__PURE__ */ m("div", {
|
|
289
|
+
ref: I,
|
|
290
290
|
id: Z,
|
|
291
291
|
role: "listbox",
|
|
292
|
-
className:
|
|
292
|
+
className: c(l.list, M?.list),
|
|
293
293
|
children: [
|
|
294
|
-
|
|
295
|
-
className:
|
|
294
|
+
C && /* @__PURE__ */ m("div", {
|
|
295
|
+
className: c(l.message, l.loading, M?.loading),
|
|
296
296
|
role: "status",
|
|
297
297
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ p(d, {
|
|
299
299
|
size: "sm",
|
|
300
300
|
label: ""
|
|
301
301
|
}),
|
|
302
302
|
" ",
|
|
303
|
-
|
|
303
|
+
oe
|
|
304
304
|
]
|
|
305
305
|
}),
|
|
306
|
-
!
|
|
307
|
-
className:
|
|
306
|
+
!C && G.length === 0 && /* @__PURE__ */ p("div", {
|
|
307
|
+
className: c(l.message, l.empty, M?.empty),
|
|
308
308
|
role: "status",
|
|
309
|
-
children:
|
|
309
|
+
children: se
|
|
310
310
|
}),
|
|
311
|
-
!
|
|
312
|
-
let
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
-
role:
|
|
315
|
-
"aria-labelledby":
|
|
316
|
-
className:
|
|
317
|
-
children: [
|
|
318
|
-
id:
|
|
319
|
-
className:
|
|
320
|
-
children:
|
|
321
|
-
}),
|
|
311
|
+
!C && ge.map((e) => {
|
|
312
|
+
let t = `${P}-group-${e.key.replace(/\s+/g, "-")}`;
|
|
313
|
+
return /* @__PURE__ */ m("div", {
|
|
314
|
+
role: e.label === null ? void 0 : "group",
|
|
315
|
+
"aria-labelledby": e.label === null ? void 0 : t,
|
|
316
|
+
className: c(l.group, M?.group),
|
|
317
|
+
children: [e.label !== null && /* @__PURE__ */ p("div", {
|
|
318
|
+
id: t,
|
|
319
|
+
className: c(l.groupLabel, M?.groupLabel),
|
|
320
|
+
children: e.label
|
|
321
|
+
}), e.items.map((e) => {
|
|
322
322
|
$ += 1;
|
|
323
|
-
let
|
|
324
|
-
active:
|
|
323
|
+
let t = $, n = t === U, r = e.href ? "a" : "div", i = j ? j(e, {
|
|
324
|
+
active: n,
|
|
325
325
|
query: R
|
|
326
|
-
}) : /* @__PURE__ */
|
|
327
|
-
|
|
328
|
-
className:
|
|
326
|
+
}) : /* @__PURE__ */ m(f, { children: [
|
|
327
|
+
e.icon && /* @__PURE__ */ p("span", {
|
|
328
|
+
className: c(l.itemIcon, M?.itemIcon),
|
|
329
329
|
"aria-hidden": "true",
|
|
330
|
-
children:
|
|
330
|
+
children: e.icon
|
|
331
331
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
className:
|
|
334
|
-
children: [/* @__PURE__ */
|
|
335
|
-
className:
|
|
336
|
-
children:
|
|
337
|
-
}),
|
|
338
|
-
className:
|
|
339
|
-
children:
|
|
332
|
+
/* @__PURE__ */ m("span", {
|
|
333
|
+
className: l.itemText,
|
|
334
|
+
children: [/* @__PURE__ */ p("span", {
|
|
335
|
+
className: c(l.itemLabel, M?.itemLabel),
|
|
336
|
+
children: ie(e.label, R, le, c(l.match, M?.match))
|
|
337
|
+
}), e.description && /* @__PURE__ */ p("span", {
|
|
338
|
+
className: c(l.itemDescription, M?.itemDescription),
|
|
339
|
+
children: e.description
|
|
340
340
|
})]
|
|
341
341
|
}),
|
|
342
|
-
|
|
343
|
-
className:
|
|
342
|
+
e.children?.length ? /* @__PURE__ */ p("span", {
|
|
343
|
+
className: l.itemChevron,
|
|
344
344
|
"aria-hidden": "true",
|
|
345
345
|
children: "›"
|
|
346
346
|
}) : null,
|
|
347
|
-
|
|
348
|
-
className:
|
|
347
|
+
e.shortcut && /* @__PURE__ */ p("span", {
|
|
348
|
+
className: c(l.itemShortcut, M?.itemShortcut),
|
|
349
349
|
"aria-hidden": "true",
|
|
350
|
-
children: Array.isArray(
|
|
350
|
+
children: Array.isArray(e.shortcut) ? /* @__PURE__ */ p(u, {
|
|
351
351
|
size: "sm",
|
|
352
|
-
keys:
|
|
353
|
-
}) : /* @__PURE__ */
|
|
352
|
+
keys: e.shortcut
|
|
353
|
+
}) : /* @__PURE__ */ p(u, {
|
|
354
354
|
size: "sm",
|
|
355
|
-
children:
|
|
355
|
+
children: e.shortcut
|
|
356
356
|
})
|
|
357
357
|
})
|
|
358
358
|
] });
|
|
359
|
-
return /* @__PURE__ */
|
|
360
|
-
id: Q(
|
|
361
|
-
"data-index":
|
|
359
|
+
return /* @__PURE__ */ p(r, {
|
|
360
|
+
id: Q(t),
|
|
361
|
+
"data-index": t,
|
|
362
362
|
role: "option",
|
|
363
|
-
"aria-selected":
|
|
364
|
-
"aria-disabled":
|
|
365
|
-
href:
|
|
363
|
+
"aria-selected": n,
|
|
364
|
+
"aria-disabled": e.disabled || void 0,
|
|
365
|
+
href: e.href,
|
|
366
366
|
tabIndex: -1,
|
|
367
|
-
className:
|
|
367
|
+
className: c(l.item, n && l.itemActive, e.disabled && l.itemDisabled, M?.item, n && M?.itemActive),
|
|
368
368
|
onMouseMove: () => {
|
|
369
|
-
!
|
|
369
|
+
!e.disabled && U !== t && W(t);
|
|
370
370
|
},
|
|
371
371
|
onMouseDown: (e) => e.preventDefault(),
|
|
372
|
-
onClick: (
|
|
373
|
-
|
|
372
|
+
onClick: (t) => {
|
|
373
|
+
e.disabled ? t.preventDefault() : e.href ? (e.onSelect?.(), v?.(e), y && h(!1)) : J(e);
|
|
374
374
|
},
|
|
375
|
-
children:
|
|
376
|
-
},
|
|
375
|
+
children: i
|
|
376
|
+
}, e.id);
|
|
377
377
|
})]
|
|
378
|
-
},
|
|
378
|
+
}, e.key);
|
|
379
379
|
})
|
|
380
380
|
]
|
|
381
381
|
}),
|
|
382
|
-
|
|
383
|
-
className:
|
|
384
|
-
children:
|
|
382
|
+
k !== null && /* @__PURE__ */ p("div", {
|
|
383
|
+
className: c(l.footer, M?.footer),
|
|
384
|
+
children: k === void 0 ? Ce : k
|
|
385
385
|
})
|
|
386
386
|
]
|
|
387
387
|
})
|
|
388
388
|
})
|
|
389
389
|
}), document.body);
|
|
390
390
|
});
|
|
391
|
-
|
|
392
|
-
export {
|
|
391
|
+
y.displayName = "CommandPalette";
|
|
392
|
+
export { y as CommandPalette, _ as defaultFilter, h as matchIndices, v as useCommandPalette };
|