@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.
Files changed (161) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +27 -0
  3. package/components/Accordion/Accordion.js +48 -48
  4. package/components/ActionButton/ActionButton.js +23 -23
  5. package/components/ActionButton/CopyButton.js +5 -5
  6. package/components/Alert/Alert.js +13 -13
  7. package/components/Avatar/Avatar.js +12 -12
  8. package/components/Badge/Badge.js +6 -6
  9. package/components/Breadcrumbs/Breadcrumbs.js +15 -15
  10. package/components/Button/Button.js +14 -14
  11. package/components/Card/Card.js +26 -26
  12. package/components/Chart/AreaChart.js +103 -103
  13. package/components/Chart/Axis.js +7 -7
  14. package/components/Chart/BarChart.js +62 -62
  15. package/components/Chart/ChartContainer.js +11 -11
  16. package/components/Chart/ChartLegend.js +7 -7
  17. package/components/Chart/ChartTooltip.js +13 -13
  18. package/components/Chart/LineChart.js +88 -88
  19. package/components/Chart/PieChart.js +25 -25
  20. package/components/Chart/RadarChart.js +42 -42
  21. package/components/Chart/Sparkline.js +11 -11
  22. package/components/Chart/TradingChart.js +126 -126
  23. package/components/Chart/trading/period.js +3 -3
  24. package/components/Chip/Chip.js +24 -24
  25. package/components/CodeBlock/CodeBlock.js +31 -31
  26. package/components/CommandPalette/CommandPalette.js +166 -166
  27. package/components/ConfirmDialog/ConfirmDialog.js +60 -60
  28. package/components/Divider/Divider.js +10 -10
  29. package/components/Draggable/Draggable.js +29 -29
  30. package/components/Drawer/Drawer.js +53 -53
  31. package/components/Dropdown/Dropdown.js +66 -66
  32. package/components/Dropdown/DropdownItem.js +13 -13
  33. package/components/Dropdown/DropdownLabel.js +5 -5
  34. package/components/Dropdown/DropdownSeparator.js +5 -5
  35. package/components/Dropzone/Dropzone.js +15 -15
  36. package/components/EmptyState/EmptyState.js +11 -11
  37. package/components/Form/Form.js +17 -17
  38. package/components/Form/FormField.js +21 -21
  39. package/components/Form/FormRow.js +3 -3
  40. package/components/ImageViewer/ImageViewer.js +118 -118
  41. package/components/Kbd/Kbd.js +11 -11
  42. package/components/KeyValueList/KeyValueList.js +32 -32
  43. package/components/Link/Link.js +7 -7
  44. package/components/List/List.js +7 -7
  45. package/components/Loader/Loader.js +39 -39
  46. package/components/Modal/Modal.js +48 -48
  47. package/components/PageHeader/PageHeader.js +18 -18
  48. package/components/Pagination/Pagination.js +23 -23
  49. package/components/Popover/Popover.js +25 -25
  50. package/components/ProgressBar/ProgressBar.js +17 -17
  51. package/components/RelativeTime/RelativeTime.js +10 -10
  52. package/components/SegmentedControl/SegmentedControl.js +38 -38
  53. package/components/Skeleton/Skeleton.js +10 -10
  54. package/components/Spinner/Spinner.js +7 -7
  55. package/components/SplitButton/SplitButton.js +63 -63
  56. package/components/SplitPane/SplitPane.js +50 -50
  57. package/components/StatCard/StatCard.js +32 -32
  58. package/components/StatusDot/StatusDot.js +7 -7
  59. package/components/Table/Table.js +174 -174
  60. package/components/Tabs/Tabs.js +47 -47
  61. package/components/ThemeToggle/ThemeToggle.js +31 -31
  62. package/components/Timeline/GanttTimeline.js +213 -213
  63. package/components/Timeline/HistoryTimeline.js +306 -306
  64. package/components/Timeline/TimelineShared.js +103 -103
  65. package/components/Timeline/TraceEventDetails.js +103 -103
  66. package/components/Timeline/TraceTimeline.js +546 -546
  67. package/components/Timeline/historyLayout.js +2 -2
  68. package/components/Timer/Timer.js +39 -39
  69. package/components/Toast/Toast.js +59 -59
  70. package/components/ToggleIconButton/ToggleIconButton.js +9 -9
  71. package/components/Tooltip/Tooltip.js +16 -16
  72. package/components/Typography/Typography.js +5 -5
  73. package/components/inputs/Checkbox/Checkbox.js +11 -11
  74. package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
  75. package/components/inputs/DatePicker/CalendarPanel.js +113 -113
  76. package/components/inputs/DatePicker/DatePicker.js +39 -39
  77. package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
  78. package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
  79. package/components/inputs/DateTimePicker/TimeField.js +34 -34
  80. package/components/inputs/Input/Input.js +13 -13
  81. package/components/inputs/NumberInput/NumberInput.js +16 -16
  82. package/components/inputs/Radio/Radio.js +17 -17
  83. package/components/inputs/SearchInput/SearchInput.js +25 -25
  84. package/components/inputs/Select/Select.d.ts +55 -3
  85. package/components/inputs/Select/Select.js +485 -344
  86. package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
  87. package/components/inputs/Slider/Slider.js +21 -21
  88. package/components/inputs/Switch/Switch.js +4 -4
  89. package/components/inputs/Textarea/Textarea.js +8 -8
  90. package/hooks/usePortalPosition.d.ts +2 -1
  91. package/hooks/usePortalPosition.js +6 -3
  92. package/hooks/useResizable.js +1 -1
  93. package/hooks/useTheme.js +7 -7
  94. package/index.css +1 -1
  95. package/index.js +1 -1
  96. package/index.layered.css +1 -1
  97. package/llms.txt +25 -4
  98. package/manifest.json +33 -4
  99. package/package.json +1 -1
  100. /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
  101. /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
  102. /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
  103. /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
  104. /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
  105. /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
  106. /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
  107. /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
  108. /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
  109. /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
  110. /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
  111. /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
  112. /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
  113. /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
  114. /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
  115. /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
  116. /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
  117. /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
  118. /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
  119. /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
  120. /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
  121. /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
  122. /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
  123. /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
  124. /package/components/List/{List.module.js → List.module.scss.js} +0 -0
  125. /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
  126. /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
  127. /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
  128. /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
  129. /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
  130. /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
  131. /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
  132. /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
  133. /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
  134. /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
  135. /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
  136. /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
  137. /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
  138. /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
  139. /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
  140. /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
  141. /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
  142. /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
  143. /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
  144. /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
  145. /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
  146. /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
  147. /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
  148. /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
  149. /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
  150. /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
  151. /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
  152. /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
  153. /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
  154. /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
  155. /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
  156. /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
  157. /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
  158. /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
  159. /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
  160. /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
  161. /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
@@ -1,15 +1,15 @@
1
- import e from "./CommandPalette.module.js";
2
- import { useFocusTrap as t } from "../../hooks/useFocusTrap.js";
3
- import { EscapeLayerProvider as n, useEscapeLayer as r } from "../../hooks/useEscapeLayer.js";
4
- import { useKeyboard as i } from "../../hooks/useKeyboard.js";
5
- import { Kbd as a } from "../Kbd/Kbd.js";
6
- import { Spinner as o } from "../Spinner/Spinner.js";
7
- import { forwardRef as s, useCallback as c, useEffect as l, useId as ee, useMemo as u, useRef as d, useState as f } from "react";
8
- import p from "clsx";
9
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
10
- import { createPortal as te } from "react-dom";
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 _(e, t) {
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 v(e, t) {
27
- let n = _(e, t);
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 y(e, t) {
35
+ function _(e, t) {
36
36
  if (!t.trim()) return 1;
37
37
  let n = !1;
38
- typeof e.label == "string" && (n = v(e.label, t));
38
+ typeof e.label == "string" && (n = g(e.label, t));
39
39
  for (let r of e.keywords ?? []) {
40
- let e = v(r, t);
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 ne(e, t, n, r) {
45
+ function ie(e, t, n, r) {
46
46
  if (!n || typeof e != "string" || !t.trim()) return e;
47
- let i = _(e, t);
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__ */ h("mark", {
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 b(e = !1) {
62
- let [t, n] = f(e), r = c(() => n((e) => !e), []);
63
- return u(() => ({
64
- open: t,
65
- setOpen: n,
66
- toggle: r,
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: t,
69
- onOpenChange: n
68
+ open: n,
69
+ onOpenChange: r
70
70
  }
71
- }), [t, r]);
71
+ }), [n, a]);
72
72
  }
73
- var x = s(({ open: s, onOpenChange: _, items: v, onSelect: b, closeOnSelect: x = !0, query: S, defaultQuery: re = "", onQueryChange: C, filter: w = y, loading: T = !1, loadingMessage: ie = "Searching…", emptyMessage: ae = "No results", placeholder: oe = "Type a command or search…", hotkey: E = "mod+k", recentIds: D, recentLabel: O = "Recent", maxResults: k = 50, groupOrder: A, footer: j, escapeClearsQuery: se = !1, highlightMatches: ce = !0, renderItem: M, "aria-label": le = "Command palette", classes: N, className: ue, style: de }, P) => {
74
- let F = ee(), I = d(null), L = d(null), fe = d(null), pe = (e) => {
75
- I.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
76
- }, [me, he] = f(re), R = S ?? me, z = c((e) => {
77
- S === void 0 && he(e), C?.(e);
78
- }, [S, C]), [B, V] = f([]), H = B.length ? B[B.length - 1].children ?? [] : v, [U, W] = f(0);
79
- l(() => {
80
- s && (V([]), W(0));
81
- }, [s]);
82
- let { sections: ge, flat: G } = u(() => {
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
- w && (r = w(e, R)), r !== !1 && t.push({
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
- }), w && e && t.sort((e, t) => t.score - e.score);
90
+ }), S && e && t.sort((e, t) => t.score - e.score);
91
91
  let n = t.map((e) => e.item), r = [];
92
- if (!e && D?.length && B.length === 0) {
93
- for (let e of D) {
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 = k, a = (e) => {
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: O,
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 = [...(A ?? []).filter((e) => s.has(e)), ...[...s.keys()].filter((e) => !A?.includes(e))];
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
- w,
132
+ S,
133
+ T,
134
+ E,
133
135
  D,
134
136
  O,
135
- k,
136
- A,
137
137
  B.length
138
138
  ]);
139
- l(() => {
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]), l(() => {
143
- (L.current?.querySelector(`[data-index="${U}"]`))?.scrollIntoView?.({ block: "nearest" });
142
+ }, [G]), n(() => {
143
+ (I.current?.querySelector(`[data-index="${U}"]`))?.scrollIntoView?.({ block: "nearest" });
144
144
  }, [U]);
145
- let K = c((e, t = !0) => {
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 = c((e) => {
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 = c((e) => {
156
- e.disabled || (e.children?.length ? (V((t) => [...t, e]), z(""), W(0)) : (e.onSelect?.(), b?.(e), x && _(!1)));
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
- b,
159
- x,
160
- _,
158
+ v,
159
+ y,
160
+ h,
161
161
  z
162
- ]), Y = c((e) => {
162
+ ]), Y = t((e) => {
163
163
  V((t) => t.slice(0, e)), W(0);
164
- }, []), _e = u(() => E ? { [E]: () => _(!s) } : {}, [
165
- E,
166
- s,
167
- _
164
+ }, []), _e = i(() => w ? { [w]: () => h(!e) } : {}, [
165
+ w,
166
+ e,
167
+ h
168
168
  ]);
169
- i(_e, { active: E !== !1 }), t(I, s);
170
- let ve = r(() => {
171
- se && R ? z("") : _(!1);
172
- }, s);
173
- l(() => {
174
- if (!s) return;
175
- let e = document.body.style.overflow;
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 = e;
177
+ document.body.style.overflow = t;
178
178
  };
179
- }, [s]);
180
- let X = d(!1), ye = (e) => {
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 && _(!1), X.current = !1;
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 (T) return;
205
+ if (C) return;
206
206
  let t = G[U];
207
207
  if (!t) return;
208
208
  if (e.preventDefault(), t.href) {
209
- (L.current?.querySelector(`[data-index="${U}"]`))?.click();
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 (!s) return null;
219
- let Z = `${F}-list`, Q = (e) => `${F}-opt-${e}`, Se = G[U], Ce = /* @__PURE__ */ g(m, { children: [
220
- /* @__PURE__ */ g("span", { children: [
221
- /* @__PURE__ */ h(a, {
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__ */ h(a, {
225
+ /* @__PURE__ */ p(u, {
226
226
  size: "sm",
227
227
  children: "↓"
228
228
  }),
229
229
  " navigate"
230
230
  ] }),
231
- /* @__PURE__ */ g("span", { children: [/* @__PURE__ */ h(a, {
231
+ /* @__PURE__ */ m("span", { children: [/* @__PURE__ */ p(u, {
232
232
  size: "sm",
233
233
  children: "↵"
234
234
  }), " select"] }),
235
- /* @__PURE__ */ g("span", { children: [/* @__PURE__ */ h(a, {
235
+ /* @__PURE__ */ m("span", { children: [/* @__PURE__ */ p(u, {
236
236
  size: "sm",
237
237
  children: "esc"
238
238
  }), " close"] })
239
239
  ] }), $ = -1;
240
- return te(/* @__PURE__ */ h("div", {
241
- className: p(e.backdrop, N?.backdrop),
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__ */ h("div", {
246
- ref: pe,
247
- className: p(e.panel, N?.panel, ue),
248
- style: de,
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": le,
252
- children: /* @__PURE__ */ g(n, {
251
+ "aria-label": ue,
252
+ children: /* @__PURE__ */ m(te, {
253
253
  value: ve,
254
254
  children: [
255
- /* @__PURE__ */ g("div", {
256
- className: p(e.header, N?.header),
255
+ /* @__PURE__ */ m("div", {
256
+ className: c(l.header, M?.header),
257
257
  children: [
258
- B.map((t, n) => /* @__PURE__ */ h("button", {
258
+ B.map((e, t) => /* @__PURE__ */ p("button", {
259
259
  type: "button",
260
- className: p(e.breadcrumb, N?.breadcrumb),
261
- onClick: () => Y(n + 1 === B.length ? n : n + 1),
262
- "aria-label": typeof t.label == "string" ? `Back to ${t.label}` : void 0,
263
- children: t.label
264
- }, t.id)),
265
- /* @__PURE__ */ h("input", {
266
- ref: fe,
267
- className: p(e.input, N?.input),
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: oe,
276
+ placeholder: ce,
277
277
  value: R,
278
278
  onChange: (e) => z(e.target.value),
279
279
  onKeyDown: xe
280
280
  }),
281
- T && /* @__PURE__ */ h(o, {
281
+ C && /* @__PURE__ */ p(d, {
282
282
  size: "sm",
283
283
  label: "Searching",
284
- className: e.headerSpinner
284
+ className: l.headerSpinner
285
285
  })
286
286
  ]
287
287
  }),
288
- /* @__PURE__ */ g("div", {
289
- ref: L,
288
+ /* @__PURE__ */ m("div", {
289
+ ref: I,
290
290
  id: Z,
291
291
  role: "listbox",
292
- className: p(e.list, N?.list),
292
+ className: c(l.list, M?.list),
293
293
  children: [
294
- T && /* @__PURE__ */ g("div", {
295
- className: p(e.message, e.loading, N?.loading),
294
+ C && /* @__PURE__ */ m("div", {
295
+ className: c(l.message, l.loading, M?.loading),
296
296
  role: "status",
297
297
  children: [
298
- /* @__PURE__ */ h(o, {
298
+ /* @__PURE__ */ p(d, {
299
299
  size: "sm",
300
300
  label: ""
301
301
  }),
302
302
  " ",
303
- ie
303
+ oe
304
304
  ]
305
305
  }),
306
- !T && G.length === 0 && /* @__PURE__ */ h("div", {
307
- className: p(e.message, e.empty, N?.empty),
306
+ !C && G.length === 0 && /* @__PURE__ */ p("div", {
307
+ className: c(l.message, l.empty, M?.empty),
308
308
  role: "status",
309
- children: ae
309
+ children: se
310
310
  }),
311
- !T && ge.map((t) => {
312
- let n = `${F}-group-${t.key.replace(/\s+/g, "-")}`;
313
- return /* @__PURE__ */ g("div", {
314
- role: t.label === null ? void 0 : "group",
315
- "aria-labelledby": t.label === null ? void 0 : n,
316
- className: p(e.group, N?.group),
317
- children: [t.label !== null && /* @__PURE__ */ h("div", {
318
- id: n,
319
- className: p(e.groupLabel, N?.groupLabel),
320
- children: t.label
321
- }), t.items.map((t) => {
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 n = $, r = n === U, i = t.href ? "a" : "div", o = M ? M(t, {
324
- active: r,
323
+ let t = $, n = t === U, r = e.href ? "a" : "div", i = j ? j(e, {
324
+ active: n,
325
325
  query: R
326
- }) : /* @__PURE__ */ g(m, { children: [
327
- t.icon && /* @__PURE__ */ h("span", {
328
- className: p(e.itemIcon, N?.itemIcon),
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: t.icon
330
+ children: e.icon
331
331
  }),
332
- /* @__PURE__ */ g("span", {
333
- className: e.itemText,
334
- children: [/* @__PURE__ */ h("span", {
335
- className: p(e.itemLabel, N?.itemLabel),
336
- children: ne(t.label, R, ce, p(e.match, N?.match))
337
- }), t.description && /* @__PURE__ */ h("span", {
338
- className: p(e.itemDescription, N?.itemDescription),
339
- children: t.description
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
- t.children?.length ? /* @__PURE__ */ h("span", {
343
- className: e.itemChevron,
342
+ e.children?.length ? /* @__PURE__ */ p("span", {
343
+ className: l.itemChevron,
344
344
  "aria-hidden": "true",
345
345
  children: "›"
346
346
  }) : null,
347
- t.shortcut && /* @__PURE__ */ h("span", {
348
- className: p(e.itemShortcut, N?.itemShortcut),
347
+ e.shortcut && /* @__PURE__ */ p("span", {
348
+ className: c(l.itemShortcut, M?.itemShortcut),
349
349
  "aria-hidden": "true",
350
- children: Array.isArray(t.shortcut) ? /* @__PURE__ */ h(a, {
350
+ children: Array.isArray(e.shortcut) ? /* @__PURE__ */ p(u, {
351
351
  size: "sm",
352
- keys: t.shortcut
353
- }) : /* @__PURE__ */ h(a, {
352
+ keys: e.shortcut
353
+ }) : /* @__PURE__ */ p(u, {
354
354
  size: "sm",
355
- children: t.shortcut
355
+ children: e.shortcut
356
356
  })
357
357
  })
358
358
  ] });
359
- return /* @__PURE__ */ h(i, {
360
- id: Q(n),
361
- "data-index": n,
359
+ return /* @__PURE__ */ p(r, {
360
+ id: Q(t),
361
+ "data-index": t,
362
362
  role: "option",
363
- "aria-selected": r,
364
- "aria-disabled": t.disabled || void 0,
365
- href: t.href,
363
+ "aria-selected": n,
364
+ "aria-disabled": e.disabled || void 0,
365
+ href: e.href,
366
366
  tabIndex: -1,
367
- className: p(e.item, r && e.itemActive, t.disabled && e.itemDisabled, N?.item, r && N?.itemActive),
367
+ className: c(l.item, n && l.itemActive, e.disabled && l.itemDisabled, M?.item, n && M?.itemActive),
368
368
  onMouseMove: () => {
369
- !t.disabled && U !== n && W(n);
369
+ !e.disabled && U !== t && W(t);
370
370
  },
371
371
  onMouseDown: (e) => e.preventDefault(),
372
- onClick: (e) => {
373
- t.disabled ? e.preventDefault() : t.href ? (t.onSelect?.(), b?.(t), x && _(!1)) : J(t);
372
+ onClick: (t) => {
373
+ e.disabled ? t.preventDefault() : e.href ? (e.onSelect?.(), v?.(e), y && h(!1)) : J(e);
374
374
  },
375
- children: o
376
- }, t.id);
375
+ children: i
376
+ }, e.id);
377
377
  })]
378
- }, t.key);
378
+ }, e.key);
379
379
  })
380
380
  ]
381
381
  }),
382
- j !== null && /* @__PURE__ */ h("div", {
383
- className: p(e.footer, N?.footer),
384
- children: j === void 0 ? Ce : j
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
- x.displayName = "CommandPalette";
392
- export { x as CommandPalette, y as defaultFilter, _ as matchIndices, b as useCommandPalette };
391
+ y.displayName = "CommandPalette";
392
+ export { y as CommandPalette, _ as defaultFilter, h as matchIndices, v as useCommandPalette };