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