@devalok/shilp-sutra 0.34.0 → 0.34.1

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 (172) hide show
  1. package/dist/_chunks/badge-group.js +306 -246
  2. package/dist/_chunks/chat.js +513 -0
  3. package/dist/_chunks/date-picker.js +748 -0
  4. package/dist/_chunks/document-preview.js +109 -90
  5. package/dist/_chunks/file-preview.js +492 -504
  6. package/dist/_chunks/framer.js +5564 -5613
  7. package/dist/_chunks/image-preview.js +127 -88
  8. package/dist/_chunks/keybinding.js +12 -14
  9. package/dist/_chunks/link-context.js +19 -16
  10. package/dist/_chunks/mention-suggestion.js +353 -350
  11. package/dist/_chunks/motion-provider.js +26 -20
  12. package/dist/_chunks/popover.js +127 -0
  13. package/dist/_chunks/primitives.js +7584 -6425
  14. package/dist/_chunks/rich-chat-input.js +2070 -0
  15. package/dist/_chunks/rolldown-runtime.js +21 -0
  16. package/dist/_chunks/shared.js +126 -0
  17. package/dist/_chunks/sonner.js +605 -734
  18. package/dist/_chunks/stat-row.js +418 -440
  19. package/dist/_chunks/tiptap.js +15850 -19964
  20. package/dist/_chunks/tree-view.js +231 -290
  21. package/dist/_chunks/use-calendar.js +161 -208
  22. package/dist/_chunks/vendor-client.js +314 -2199
  23. package/dist/_chunks/vendor-utils.js +1721 -2978
  24. package/dist/ai/ai-command-provider.js +23 -17
  25. package/dist/ai/block-renderer.js +68 -51
  26. package/dist/ai/blocks/index.js +2 -12
  27. package/dist/ai/command-bar.js +470 -519
  28. package/dist/ai/conversation.js +241 -227
  29. package/dist/ai/index.js +181 -167
  30. package/dist/ai/types.js +0 -1
  31. package/dist/composed/activity-feed.js +232 -202
  32. package/dist/composed/avatar-group.js +164 -222
  33. package/dist/composed/bulk-action-bar.js +174 -165
  34. package/dist/composed/command-palette.js +290 -308
  35. package/dist/composed/confirm-dialog.js +28 -48
  36. package/dist/composed/content-card.js +69 -108
  37. package/dist/composed/date-picker/index.js +3 -13
  38. package/dist/composed/deadline-indicator.js +68 -74
  39. package/dist/composed/emoji-picker.js +83 -110
  40. package/dist/composed/empty-state.js +64 -103
  41. package/dist/composed/error-boundary.js +129 -127
  42. package/dist/composed/file-preview.js +2 -12
  43. package/dist/composed/filter-bar.js +98 -130
  44. package/dist/composed/form-section.js +61 -45
  45. package/dist/composed/global-loading.js +34 -47
  46. package/dist/composed/index.js +34 -92
  47. package/dist/composed/inline-edit.js +92 -107
  48. package/dist/composed/lib/string-utils.js +8 -8
  49. package/dist/composed/loading-skeleton.js +103 -171
  50. package/dist/composed/markdown-viewer.js +187 -139
  51. package/dist/composed/master-detail.js +147 -156
  52. package/dist/composed/member-picker.js +46 -49
  53. package/dist/composed/multi-select-popover.js +181 -179
  54. package/dist/composed/page-header.js +54 -76
  55. package/dist/composed/page-skeletons.js +143 -127
  56. package/dist/composed/priority-indicator.js +105 -111
  57. package/dist/composed/responsive-overlay.js +36 -41
  58. package/dist/composed/rich-chat-input.js +2 -1860
  59. package/dist/composed/rich-text-editor.js +561 -424
  60. package/dist/composed/schedule-view.js +134 -185
  61. package/dist/composed/simple-tooltip.js +21 -21
  62. package/dist/composed/status-badge.js +133 -137
  63. package/dist/hooks/index.js +7 -12
  64. package/dist/hooks/use-color-mode.js +28 -25
  65. package/dist/hooks/use-mobile.js +13 -13
  66. package/dist/hooks/use-toast.js +2 -4
  67. package/dist/hooks/use-touch-device.js +9 -11
  68. package/dist/hooks/use-viewport-height.js +14 -14
  69. package/dist/motion/index.js +3 -11
  70. package/dist/motion/primitives-index.js +226 -186
  71. package/dist/shell/app-command-palette.js +203 -234
  72. package/dist/shell/bottom-navbar.js +150 -190
  73. package/dist/shell/command-registry.js +13 -14
  74. package/dist/shell/index.js +10 -20
  75. package/dist/shell/link-context.js +2 -5
  76. package/dist/shell/notification-center.js +238 -259
  77. package/dist/shell/notification-preferences.js +241 -184
  78. package/dist/shell/sidebar.js +251 -281
  79. package/dist/shell/top-bar.js +203 -237
  80. package/dist/tailwind/index.cjs +426 -442
  81. package/dist/tailwind/index.js +2 -4
  82. package/dist/tailwind/preset.js +443 -459
  83. package/dist/ui/accordion.js +52 -60
  84. package/dist/ui/alert-dialog.js +111 -156
  85. package/dist/ui/alert.js +177 -99
  86. package/dist/ui/aspect-ratio.js +13 -16
  87. package/dist/ui/autocomplete.js +112 -148
  88. package/dist/ui/avatar.js +196 -169
  89. package/dist/ui/badge-group.js +2 -7
  90. package/dist/ui/badge-indicator.js +42 -51
  91. package/dist/ui/badge.js +2 -15
  92. package/dist/ui/banner.js +76 -68
  93. package/dist/ui/breadcrumb.js +65 -84
  94. package/dist/ui/button-group.js +109 -102
  95. package/dist/ui/button-processing.js +69 -73
  96. package/dist/ui/button.js +393 -279
  97. package/dist/ui/card.js +151 -157
  98. package/dist/ui/charts/index.js +1002 -1319
  99. package/dist/ui/chat/index.js +2 -11
  100. package/dist/ui/checkbox.js +77 -100
  101. package/dist/ui/code.js +18 -32
  102. package/dist/ui/collapsible.js +21 -29
  103. package/dist/ui/color-input.js +453 -372
  104. package/dist/ui/color-swatch.js +60 -90
  105. package/dist/ui/combobox.js +244 -293
  106. package/dist/ui/container.js +18 -24
  107. package/dist/ui/context-menu.js +154 -203
  108. package/dist/ui/data-table-body.js +116 -213
  109. package/dist/ui/data-table-bulk-actions.js +43 -59
  110. package/dist/ui/data-table-card.js +84 -71
  111. package/dist/ui/data-table-context.js +39 -42
  112. package/dist/ui/data-table-header.js +98 -139
  113. package/dist/ui/data-table-pagination.js +69 -82
  114. package/dist/ui/data-table-toolbar.js +104 -130
  115. package/dist/ui/data-table.js +278 -354
  116. package/dist/ui/devalok-grain.js +77 -66
  117. package/dist/ui/dialog.js +122 -151
  118. package/dist/ui/dropdown-menu.js +152 -203
  119. package/dist/ui/file-upload.js +242 -266
  120. package/dist/ui/form.js +60 -56
  121. package/dist/ui/hover-card.js +54 -54
  122. package/dist/ui/icon-button.js +21 -26
  123. package/dist/ui/icon-context.js +17 -17
  124. package/dist/ui/icon-group.js +22 -29
  125. package/dist/ui/icon.js +201 -121
  126. package/dist/ui/index.js +74 -350
  127. package/dist/ui/input-otp.js +44 -48
  128. package/dist/ui/input.js +92 -169
  129. package/dist/ui/label.js +17 -22
  130. package/dist/ui/lib/date-utils.js +14 -11
  131. package/dist/ui/lib/motion.js +77 -36
  132. package/dist/ui/lib/utils.js +39 -16
  133. package/dist/ui/link.js +13 -24
  134. package/dist/ui/menubar.js +132 -210
  135. package/dist/ui/navigation-menu.js +163 -193
  136. package/dist/ui/number-input.js +72 -95
  137. package/dist/ui/pagination.js +122 -159
  138. package/dist/ui/popover.js +2 -131
  139. package/dist/ui/progress-ring.js +133 -143
  140. package/dist/ui/progress.js +51 -95
  141. package/dist/ui/radio.js +41 -50
  142. package/dist/ui/search-input.js +51 -53
  143. package/dist/ui/segmented-control.js +93 -114
  144. package/dist/ui/select.js +131 -157
  145. package/dist/ui/separator.js +15 -25
  146. package/dist/ui/sheet.js +135 -163
  147. package/dist/ui/sidebar.js +357 -600
  148. package/dist/ui/skeleton.js +179 -231
  149. package/dist/ui/slider.js +24 -34
  150. package/dist/ui/spinner.js +226 -205
  151. package/dist/ui/split-button.js +227 -276
  152. package/dist/ui/stack.js +56 -70
  153. package/dist/ui/stat-card.js +259 -251
  154. package/dist/ui/status-dot.js +67 -63
  155. package/dist/ui/stepper.js +119 -168
  156. package/dist/ui/switch.js +51 -54
  157. package/dist/ui/table.js +57 -90
  158. package/dist/ui/tabs.js +139 -156
  159. package/dist/ui/text.js +52 -59
  160. package/dist/ui/textarea.js +40 -57
  161. package/dist/ui/toast-types.js +0 -1
  162. package/dist/ui/toast.js +554 -536
  163. package/dist/ui/toaster.js +23 -33
  164. package/dist/ui/toggle-group.js +37 -41
  165. package/dist/ui/toggle.js +36 -40
  166. package/dist/ui/tooltip.js +80 -65
  167. package/dist/ui/tree-view/index.js +2 -6
  168. package/dist/ui/visually-hidden.js +12 -10
  169. package/llms-full.txt +1 -1
  170. package/package.json +1 -1
  171. package/dist/_chunks/date-time-picker.js +0 -851
  172. package/dist/_chunks/typing-indicator.js +0 -565
@@ -1,312 +1,294 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as o } from "react/jsx-runtime";
3
- import * as r from "react";
4
- import { Dialog as ne, DialogPortal as oe, DialogOverlay as ie, DialogContentRaw as de, DialogTitle as ce, DialogDescription as le } from "../ui/dialog.js";
5
- import { IconSearch as fe, IconCornerDownLeft as K, IconArrowUp as ue, IconArrowDown as me } from "@tabler/icons-react";
6
- import { Icon as w } from "../ui/icon.js";
7
- import { cn as N } from "../ui/lib/utils.js";
8
- import { springs as P, tweens as q } from "../ui/lib/motion.js";
9
- import { VisuallyHidden as pe } from "../ui/visually-hidden.js";
10
- import { u as be } from "../_chunks/motion-provider.js";
11
- import { g as xe, a as ge, m as he } from "../_chunks/keybinding.js";
12
- import { m, A as ye } from "../_chunks/framer.js";
13
- function ve(n) {
14
- return n.filterValue ? n.filterValue : typeof n.label == "string" ? n.label : "";
2
+ import { a as e, c as t } from "../_chunks/framer.js";
3
+ import { springs as n, tweens as r } from "../ui/lib/motion.js";
4
+ import { cn as i } from "../ui/lib/utils.js";
5
+ import { Icon as a } from "../ui/icon.js";
6
+ import { Dialog as o, DialogContentRaw as s, DialogDescription as c, DialogOverlay as l, DialogPortal as u, DialogTitle as ee } from "../ui/dialog.js";
7
+ import { VisuallyHidden as d } from "../ui/visually-hidden.js";
8
+ import { n as f } from "../_chunks/motion-provider.js";
9
+ import { n as te, r as p, t as m } from "../_chunks/keybinding.js";
10
+ import * as h from "react";
11
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
+ import { IconArrowDown as v, IconArrowUp as y, IconCornerDownLeft as b, IconSearch as ne } from "@tabler/icons-react";
13
+ //#region src/composed/command-palette.tsx
14
+ function re(e) {
15
+ return e.filterValue ? e.filterValue : typeof e.label == "string" ? e.label : "";
15
16
  }
16
- function we(n) {
17
- return typeof n.description == "string" ? n.description : "";
17
+ function ie(e) {
18
+ return typeof e.description == "string" ? e.description : "";
18
19
  }
19
- function Ne(n) {
20
- return n.includes("+") ? n.split("+").map((p) => p.trim()).filter(Boolean) : n.split(/\s+/).filter(Boolean);
20
+ function ae(e) {
21
+ return e.includes("+") ? e.split("+").map((e) => e.trim()).filter(Boolean) : e.split(/\s+/).filter(Boolean);
21
22
  }
22
- const ke = r.forwardRef(
23
- function({
24
- groups: p = [],
25
- placeholder: O = "Search or jump to...",
26
- onSearch: B,
27
- emptyMessage: Q = "No results found.",
28
- emptyState: T,
29
- open: S,
30
- defaultOpen: U,
31
- onOpenChange: j,
32
- keybinding: b = "mod+k",
33
- maxHeight: C = "320px",
34
- footerHints: A,
35
- className: G,
36
- ...H
37
- }, J) {
38
- const D = S !== void 0, [W, X] = r.useState(U ?? !1), x = D ? S : W, R = r.useRef(x);
39
- R.current = x;
40
- const d = r.useCallback(
41
- (e) => {
42
- const s = typeof e == "function" ? e(R.current) : e;
43
- D || X(s), j?.(s);
44
- },
45
- [D, j]
46
- ), [g, z] = r.useState(""), [f, h] = r.useState(0), L = r.useRef(null), $ = r.useRef(null), I = r.useId(), V = `command-palette-listbox-${I}`, { reducedMotion: c } = be(), k = { duration: 0 }, Y = r.useMemo(() => xe(), []), u = r.useMemo(() => {
47
- if (!g.trim()) return p;
48
- const e = g.toLowerCase();
49
- return p.map((s) => ({
50
- ...s,
51
- items: s.items.filter(
52
- (a) => ve(a).toLowerCase().includes(e) || we(a).toLowerCase().includes(e)
53
- )
54
- })).filter((s) => s.items.length > 0);
55
- }, [p, g]), y = r.useMemo(
56
- () => u.flatMap((e) => e.items),
57
- [u]
58
- );
59
- r.useEffect(() => {
60
- if (b === !1) return;
61
- const e = Array.isArray(b) ? b : [b];
62
- function s(a) {
63
- for (const i of e)
64
- if (he(a, i)) {
65
- a.preventDefault(), d((l) => !l);
66
- return;
67
- }
68
- }
69
- return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
70
- }, [b, d]), r.useEffect(() => {
71
- x && (z(""), h(0), requestAnimationFrame(() => {
72
- L.current?.focus();
73
- }));
74
- }, [x]);
75
- const Z = (e) => {
76
- switch (e.key) {
77
- case "ArrowDown": {
78
- e.preventDefault(), h(
79
- (s) => s < y.length - 1 ? s + 1 : 0
80
- );
81
- break;
82
- }
83
- case "ArrowUp": {
84
- e.preventDefault(), h(
85
- (s) => s > 0 ? s - 1 : y.length - 1
86
- );
87
- break;
88
- }
89
- case "Enter": {
90
- e.preventDefault();
91
- const s = y[f];
92
- s && (s.onSelect(), d(!1));
93
- break;
94
- }
95
- case "Escape": {
96
- e.preventDefault(), d(!1);
97
- break;
98
- }
99
- }
100
- };
101
- r.useEffect(() => {
102
- $.current?.querySelector(
103
- `[data-command-index="${f}"]`
104
- )?.scrollIntoView({ block: "nearest" });
105
- }, [f]);
106
- const _ = (e) => {
107
- z(e), h(0), B?.(e);
108
- }, ee = r.useMemo(() => {
109
- const e = /* @__PURE__ */ new Map();
110
- let s = 0;
111
- for (const a of u)
112
- for (const i of a.items)
113
- e.set(i.id, s++);
114
- return e;
115
- }, [u]), te = c ? k : P.snappy, M = c ? k : q.fade, v = c ? { opacity: 1, scale: 1, y: 0 } : void 0, se = typeof C == "number" ? `${C}px` : C, F = A === !1 ? !1 : A ?? [
116
- { keys: "↑↓", label: "Navigate" },
117
- { keys: "↵", label: "Select" },
118
- { keys: "Esc", label: "Close" }
119
- ], ae = r.useCallback(
120
- (e) => {
121
- d(e);
122
- },
123
- [d]
124
- );
125
- return /* @__PURE__ */ t(ne, { open: x, onOpenChange: ae, children: /* @__PURE__ */ o(oe, { children: [
126
- /* @__PURE__ */ t(
127
- ie,
128
- {
129
- className: "fixed inset-0 z-overlay bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
130
- }
131
- ),
132
- /* @__PURE__ */ o(
133
- de,
134
- {
135
- ref: J,
136
- ...H,
137
- className: N(
138
- "fixed left-1/2 top-[20%] z-modal w-full max-w-[560px] -translate-x-1/2",
139
- "overflow-hidden rounded-ds-xl border border-surface-border-strong bg-surface-overlay shadow-overlay",
140
- "duration-moderate-02 data-[state=open]:animate-in data-[state=closed]:animate-out",
141
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
142
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
143
- "data-[state=closed]:slide-out-to-left-1/2 data-[state=open]:slide-in-from-left-1/2",
144
- "data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2",
145
- G
146
- ),
147
- onKeyDown: Z,
148
- children: [
149
- /* @__PURE__ */ o(pe, { children: [
150
- /* @__PURE__ */ t(ce, { children: "Command Palette" }),
151
- /* @__PURE__ */ t(le, { children: "Search or jump to pages, projects, tasks, and actions" })
152
- ] }),
153
- /* @__PURE__ */ o("div", { className: "flex items-center gap-ds-04 border-b border-surface-border-strong px-ds-05 py-ds-04", children: [
154
- /* @__PURE__ */ t(
155
- m.span,
156
- {
157
- initial: v ?? { opacity: 0, scale: 0.96 },
158
- animate: { opacity: 1, scale: 1 },
159
- transition: te,
160
- className: "inline-flex shrink-0",
161
- children: /* @__PURE__ */ t(w, { icon: fe, size: "sm", stroke: "light", className: "text-surface-fg-subtle" })
162
- }
163
- ),
164
- /* @__PURE__ */ t(
165
- "input",
166
- {
167
- ref: L,
168
- value: g,
169
- onChange: (e) => _(e.target.value),
170
- placeholder: O,
171
- role: "combobox",
172
- "aria-expanded": !0,
173
- "aria-controls": V,
174
- "aria-activedescendant": y[f] ? `command-item-${I}-${y[f].id}` : void 0,
175
- "aria-autocomplete": "list",
176
- className: N(
177
- "flex-1 bg-transparent text-ds-base text-surface-fg outline-hidden",
178
- "placeholder:text-surface-fg-subtle"
179
- ),
180
- autoComplete: "off",
181
- autoCorrect: "off",
182
- spellCheck: !1
183
- }
184
- ),
185
- /* @__PURE__ */ t("kbd", { className: "hidden shrink-0 select-none rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b py-ds-01 text-ds-sm font-medium text-surface-fg-subtle shadow-kbd sm:inline-flex", children: "Esc" })
186
- ] }),
187
- /* @__PURE__ */ o(
188
- "div",
189
- {
190
- ref: $,
191
- id: V,
192
- role: "listbox",
193
- "aria-label": "Command results",
194
- className: "overflow-y-auto px-ds-03 py-ds-03",
195
- style: { maxHeight: se },
196
- children: [
197
- u.length === 0 && /* @__PURE__ */ t(
198
- m.div,
199
- {
200
- initial: v ?? { opacity: 0 },
201
- animate: { opacity: 1 },
202
- transition: M,
203
- className: "flex items-center justify-center py-ds-07",
204
- children: T ?? /* @__PURE__ */ t("p", { className: "text-ds-md text-surface-fg-subtle", children: Q })
205
- }
206
- ),
207
- u.map((e, s) => /* @__PURE__ */ o(
208
- m.div,
209
- {
210
- initial: v ?? { opacity: 0 },
211
- animate: { opacity: 1 },
212
- transition: c ? k : { ...q.fade, delay: s * 0.06 },
213
- className: "mb-ds-02",
214
- children: [
215
- /* @__PURE__ */ t("div", { className: "px-ds-03 pb-ds-02 pt-ds-03", children: /* @__PURE__ */ t("span", { className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle", children: e.label }) }),
216
- e.items.map((a) => {
217
- const i = ee.get(a.id) ?? 0, l = i === f;
218
- return /* @__PURE__ */ o(
219
- m.button,
220
- {
221
- id: `command-item-${I}-${a.id}`,
222
- type: "button",
223
- role: "option",
224
- "aria-selected": l,
225
- "data-command-index": i,
226
- initial: v ?? { opacity: 0, y: 4 },
227
- animate: { opacity: 1, y: 0 },
228
- transition: c ? k : { ...P.snappy, delay: i * 0.03 },
229
- onClick: () => {
230
- a.onSelect(), d(!1);
231
- },
232
- onMouseEnter: () => h(i),
233
- className: N(
234
- "flex w-full items-center gap-ds-04 rounded-ds-lg px-ds-03 py-ds-03 text-left transition-[color,background-color] duration-fast-02 ease-productive-standard",
235
- l ? "bg-surface-raised-hover text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"
236
- ),
237
- children: [
238
- a.icon && /* @__PURE__ */ t(
239
- "span",
240
- {
241
- className: N(
242
- "[&>svg]:h-ico-sm [&>svg]:w-ico-sm shrink-0 transition-colors duration-fast-02 ease-productive-standard",
243
- l ? "text-accent-11" : "text-surface-fg-subtle"
244
- ),
245
- "aria-hidden": "true",
246
- children: a.icon
247
- }
248
- ),
249
- /* @__PURE__ */ o("div", { className: "flex flex-1 flex-col", children: [
250
- /* @__PURE__ */ t("span", { className: "text-ds-md", children: a.renderLabel ? a.renderLabel(g) : a.label }),
251
- a.description && /* @__PURE__ */ t("span", { className: "text-ds-sm text-surface-fg-subtle", children: a.description })
252
- ] }),
253
- a.shortcut && /* @__PURE__ */ t("span", { className: "flex shrink-0 items-center gap-ds-01", children: Ne(a.shortcut).map((E, re) => /* @__PURE__ */ t(
254
- "kbd",
255
- {
256
- className: N(
257
- "inline-flex min-w-[20px] items-center justify-center rounded border px-ds-02b py-ds-01 text-ds-xs font-medium shadow-kbd transition-colors duration-fast-02 ease-productive-standard",
258
- l ? "bg-accent-2 text-accent-11 border-accent-6" : "bg-surface-raised text-surface-fg-subtle border-surface-border-strong"
259
- ),
260
- children: E === "Ctrl" || E === "ctrl" ? ge(Y) : E
261
- },
262
- re
263
- )) }),
264
- /* @__PURE__ */ t(ye, { children: l && /* @__PURE__ */ t(
265
- m.span,
266
- {
267
- initial: c ? void 0 : { opacity: 0 },
268
- animate: { opacity: 1 },
269
- exit: c ? void 0 : { opacity: 0 },
270
- transition: M,
271
- className: "inline-flex shrink-0",
272
- children: /* @__PURE__ */ t(w, { icon: K, size: "sm", stroke: "light", className: "text-surface-fg-subtle" })
273
- }
274
- ) })
275
- ]
276
- },
277
- a.id
278
- );
279
- })
280
- ]
281
- },
282
- e.label
283
- ))
284
- ]
285
- }
286
- ),
287
- F !== !1 && /* @__PURE__ */ t(
288
- m.div,
289
- {
290
- initial: v ?? { opacity: 0 },
291
- animate: { opacity: 1 },
292
- transition: M,
293
- className: "flex items-center gap-ds-05 border-t border-surface-border-strong px-ds-05 py-ds-03",
294
- children: F.map((e, s) => /* @__PURE__ */ o("div", { className: "flex items-center gap-ds-02b", children: [
295
- e.keys === "↑↓" ? /* @__PURE__ */ o("div", { className: "flex items-center gap-ds-01", children: [
296
- /* @__PURE__ */ t("kbd", { className: "inline-flex h-ico-md w-ico-md items-center justify-center rounded border border-surface-border-strong bg-surface-raised shadow-kbd", children: /* @__PURE__ */ t(w, { icon: ue, size: "xs", className: "text-surface-fg-subtle" }) }),
297
- /* @__PURE__ */ t("kbd", { className: "inline-flex h-ico-md w-ico-md items-center justify-center rounded border border-surface-border-strong bg-surface-raised shadow-kbd", children: /* @__PURE__ */ t(w, { icon: me, size: "xs", className: "text-surface-fg-subtle" }) })
298
- ] }) : e.keys === "↵" ? /* @__PURE__ */ t("kbd", { className: "inline-flex h-[20px] items-center justify-center rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b shadow-kbd", children: /* @__PURE__ */ t(w, { icon: K, size: "xs", className: "text-surface-fg-subtle" }) }) : /* @__PURE__ */ t("kbd", { className: "inline-flex h-[20px] items-center justify-center rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b text-ds-xs font-medium text-surface-fg-subtle shadow-kbd", children: e.keys }),
299
- /* @__PURE__ */ t("span", { className: "text-ds-xs text-surface-fg-subtle", children: e.label })
300
- ] }, s))
301
- }
302
- )
303
- ]
304
- }
305
- )
306
- ] }) });
307
- }
308
- );
309
- ke.displayName = "CommandPalette";
310
- export {
311
- ke as CommandPalette
312
- };
23
+ var x = h.forwardRef(function({ groups: x = [], placeholder: oe = "Search or jump to...", onSearch: S, emptyMessage: C = "No results found.", emptyState: se, open: w, defaultOpen: T, onOpenChange: E, keybinding: D = "mod+k", maxHeight: O = "320px", footerHints: k, className: ce, ...A }, j) {
24
+ let M = w !== void 0, [N, P] = h.useState(T ?? !1), F = M ? w : N, I = h.useRef(F);
25
+ I.current = F;
26
+ let L = h.useCallback((e) => {
27
+ let t = typeof e == "function" ? e(I.current) : e;
28
+ M || P(t), E?.(t);
29
+ }, [M, E]), [R, z] = h.useState(""), [B, V] = h.useState(0), H = h.useRef(null), U = h.useRef(null), W = h.useId(), G = `command-palette-listbox-${W}`, { reducedMotion: K } = f(), q = { duration: 0 }, le = h.useMemo(() => m(), []), J = h.useMemo(() => {
30
+ if (!R.trim()) return x;
31
+ let e = R.toLowerCase();
32
+ return x.map((t) => ({
33
+ ...t,
34
+ items: t.items.filter((t) => re(t).toLowerCase().includes(e) || ie(t).toLowerCase().includes(e))
35
+ })).filter((e) => e.items.length > 0);
36
+ }, [x, R]), Y = h.useMemo(() => J.flatMap((e) => e.items), [J]);
37
+ h.useEffect(() => {
38
+ if (D === !1) return;
39
+ let e = Array.isArray(D) ? D : [D];
40
+ function t(t) {
41
+ for (let n of e) if (p(t, n)) {
42
+ t.preventDefault(), L((e) => !e);
43
+ return;
44
+ }
45
+ }
46
+ return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
47
+ }, [D, L]), h.useEffect(() => {
48
+ F && (z(""), V(0), requestAnimationFrame(() => {
49
+ H.current?.focus();
50
+ }));
51
+ }, [F]);
52
+ let ue = (e) => {
53
+ switch (e.key) {
54
+ case "ArrowDown":
55
+ e.preventDefault(), V((e) => e < Y.length - 1 ? e + 1 : 0);
56
+ break;
57
+ case "ArrowUp":
58
+ e.preventDefault(), V((e) => e > 0 ? e - 1 : Y.length - 1);
59
+ break;
60
+ case "Enter": {
61
+ e.preventDefault();
62
+ let t = Y[B];
63
+ t && (t.onSelect(), L(!1));
64
+ break;
65
+ }
66
+ case "Escape":
67
+ e.preventDefault(), L(!1);
68
+ break;
69
+ }
70
+ };
71
+ h.useEffect(() => {
72
+ (U.current?.querySelector(`[data-command-index="${B}"]`))?.scrollIntoView({ block: "nearest" });
73
+ }, [B]);
74
+ let de = (e) => {
75
+ z(e), V(0), S?.(e);
76
+ }, fe = h.useMemo(() => {
77
+ let e = /* @__PURE__ */ new Map(), t = 0;
78
+ for (let n of J) for (let r of n.items) e.set(r.id, t++);
79
+ return e;
80
+ }, [J]), X = K ? q : n.snappy, Z = K ? q : r.fade, Q = K ? {
81
+ opacity: 1,
82
+ scale: 1,
83
+ y: 0
84
+ } : void 0, pe = typeof O == "number" ? `${O}px` : O, $ = k === !1 ? !1 : k ?? [
85
+ {
86
+ keys: "↑↓",
87
+ label: "Navigate"
88
+ },
89
+ {
90
+ keys: "",
91
+ label: "Select"
92
+ },
93
+ {
94
+ keys: "Esc",
95
+ label: "Close"
96
+ }
97
+ ];
98
+ return /* @__PURE__ */ g(o, {
99
+ open: F,
100
+ onOpenChange: h.useCallback((e) => {
101
+ L(e);
102
+ }, [L]),
103
+ children: /* @__PURE__ */ _(u, { children: [/* @__PURE__ */ g(l, { className: "fixed inset-0 z-overlay bg-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }), /* @__PURE__ */ _(s, {
104
+ ref: j,
105
+ ...A,
106
+ className: i("fixed left-1/2 top-[20%] z-modal w-full max-w-[560px] -translate-x-1/2", "overflow-hidden rounded-ds-xl border border-surface-border-strong bg-surface-overlay shadow-overlay", "duration-moderate-02 data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[state=closed]:slide-out-to-left-1/2 data-[state=open]:slide-in-from-left-1/2", "data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2", ce),
107
+ onKeyDown: ue,
108
+ children: [
109
+ /* @__PURE__ */ _(d, { children: [/* @__PURE__ */ g(ee, { children: "Command Palette" }), /* @__PURE__ */ g(c, { children: "Search or jump to pages, projects, tasks, and actions" })] }),
110
+ /* @__PURE__ */ _("div", {
111
+ className: "flex items-center gap-ds-04 border-b border-surface-border-strong px-ds-05 py-ds-04",
112
+ children: [
113
+ /* @__PURE__ */ g(e.span, {
114
+ initial: Q ?? {
115
+ opacity: 0,
116
+ scale: .96
117
+ },
118
+ animate: {
119
+ opacity: 1,
120
+ scale: 1
121
+ },
122
+ transition: X,
123
+ className: "inline-flex shrink-0",
124
+ children: /* @__PURE__ */ g(a, {
125
+ icon: ne,
126
+ size: "sm",
127
+ stroke: "light",
128
+ className: "text-surface-fg-subtle"
129
+ })
130
+ }),
131
+ /* @__PURE__ */ g("input", {
132
+ ref: H,
133
+ value: R,
134
+ onChange: (e) => de(e.target.value),
135
+ placeholder: oe,
136
+ role: "combobox",
137
+ "aria-expanded": !0,
138
+ "aria-controls": G,
139
+ "aria-activedescendant": Y[B] ? `command-item-${W}-${Y[B].id}` : void 0,
140
+ "aria-autocomplete": "list",
141
+ className: i("flex-1 bg-transparent text-ds-base text-surface-fg outline-hidden", "placeholder:text-surface-fg-subtle"),
142
+ autoComplete: "off",
143
+ autoCorrect: "off",
144
+ spellCheck: !1
145
+ }),
146
+ /* @__PURE__ */ g("kbd", {
147
+ className: "hidden shrink-0 select-none rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b py-ds-01 text-ds-sm font-medium text-surface-fg-subtle shadow-kbd sm:inline-flex",
148
+ children: "Esc"
149
+ })
150
+ ]
151
+ }),
152
+ /* @__PURE__ */ _("div", {
153
+ ref: U,
154
+ id: G,
155
+ role: "listbox",
156
+ "aria-label": "Command results",
157
+ className: "overflow-y-auto px-ds-03 py-ds-03",
158
+ style: { maxHeight: pe },
159
+ children: [J.length === 0 && /* @__PURE__ */ g(e.div, {
160
+ initial: Q ?? { opacity: 0 },
161
+ animate: { opacity: 1 },
162
+ transition: Z,
163
+ className: "flex items-center justify-center py-ds-07",
164
+ children: se ?? /* @__PURE__ */ g("p", {
165
+ className: "text-ds-md text-surface-fg-subtle",
166
+ children: C
167
+ })
168
+ }), J.map((o, s) => /* @__PURE__ */ _(e.div, {
169
+ initial: Q ?? { opacity: 0 },
170
+ animate: { opacity: 1 },
171
+ transition: K ? q : {
172
+ ...r.fade,
173
+ delay: s * .06
174
+ },
175
+ className: "mb-ds-02",
176
+ children: [/* @__PURE__ */ g("div", {
177
+ className: "px-ds-03 pb-ds-02 pt-ds-03",
178
+ children: /* @__PURE__ */ g("span", {
179
+ className: "text-ds-xs font-semibold uppercase tracking-wider text-surface-fg-subtle",
180
+ children: o.label
181
+ })
182
+ }), o.items.map((r) => {
183
+ let o = fe.get(r.id) ?? 0, s = o === B;
184
+ return /* @__PURE__ */ _(e.button, {
185
+ id: `command-item-${W}-${r.id}`,
186
+ type: "button",
187
+ role: "option",
188
+ "aria-selected": s,
189
+ "data-command-index": o,
190
+ initial: Q ?? {
191
+ opacity: 0,
192
+ y: 4
193
+ },
194
+ animate: {
195
+ opacity: 1,
196
+ y: 0
197
+ },
198
+ transition: K ? q : {
199
+ ...n.snappy,
200
+ delay: o * .03
201
+ },
202
+ onClick: () => {
203
+ r.onSelect(), L(!1);
204
+ },
205
+ onMouseEnter: () => V(o),
206
+ className: i("flex w-full items-center gap-ds-04 rounded-ds-lg px-ds-03 py-ds-03 text-left transition-[color,background-color] duration-fast-02 ease-productive-standard", s ? "bg-surface-raised-hover text-surface-fg" : "text-surface-fg-muted hover:bg-surface-raised"),
207
+ children: [
208
+ r.icon && /* @__PURE__ */ g("span", {
209
+ className: i("[&>svg]:h-ico-sm [&>svg]:w-ico-sm shrink-0 transition-colors duration-fast-02 ease-productive-standard", s ? "text-accent-11" : "text-surface-fg-subtle"),
210
+ "aria-hidden": "true",
211
+ children: r.icon
212
+ }),
213
+ /* @__PURE__ */ _("div", {
214
+ className: "flex flex-1 flex-col",
215
+ children: [/* @__PURE__ */ g("span", {
216
+ className: "text-ds-md",
217
+ children: r.renderLabel ? r.renderLabel(R) : r.label
218
+ }), r.description && /* @__PURE__ */ g("span", {
219
+ className: "text-ds-sm text-surface-fg-subtle",
220
+ children: r.description
221
+ })]
222
+ }),
223
+ r.shortcut && /* @__PURE__ */ g("span", {
224
+ className: "flex shrink-0 items-center gap-ds-01",
225
+ children: ae(r.shortcut).map((e, t) => /* @__PURE__ */ g("kbd", {
226
+ className: i("inline-flex min-w-[20px] items-center justify-center rounded border px-ds-02b py-ds-01 text-ds-xs font-medium shadow-kbd transition-colors duration-fast-02 ease-productive-standard", s ? "bg-accent-2 text-accent-11 border-accent-6" : "bg-surface-raised text-surface-fg-subtle border-surface-border-strong"),
227
+ children: e === "Ctrl" || e === "ctrl" ? te(le) : e
228
+ }, t))
229
+ }),
230
+ /* @__PURE__ */ g(t, { children: s && /* @__PURE__ */ g(e.span, {
231
+ initial: K ? void 0 : { opacity: 0 },
232
+ animate: { opacity: 1 },
233
+ exit: K ? void 0 : { opacity: 0 },
234
+ transition: Z,
235
+ className: "inline-flex shrink-0",
236
+ children: /* @__PURE__ */ g(a, {
237
+ icon: b,
238
+ size: "sm",
239
+ stroke: "light",
240
+ className: "text-surface-fg-subtle"
241
+ })
242
+ }) })
243
+ ]
244
+ }, r.id);
245
+ })]
246
+ }, o.label))]
247
+ }),
248
+ $ !== !1 && /* @__PURE__ */ g(e.div, {
249
+ initial: Q ?? { opacity: 0 },
250
+ animate: { opacity: 1 },
251
+ transition: Z,
252
+ className: "flex items-center gap-ds-05 border-t border-surface-border-strong px-ds-05 py-ds-03",
253
+ children: $.map((e, t) => /* @__PURE__ */ _("div", {
254
+ className: "flex items-center gap-ds-02b",
255
+ children: [e.keys === "↑↓" ? /* @__PURE__ */ _("div", {
256
+ className: "flex items-center gap-ds-01",
257
+ children: [/* @__PURE__ */ g("kbd", {
258
+ className: "inline-flex h-ico-md w-ico-md items-center justify-center rounded border border-surface-border-strong bg-surface-raised shadow-kbd",
259
+ children: /* @__PURE__ */ g(a, {
260
+ icon: y,
261
+ size: "xs",
262
+ className: "text-surface-fg-subtle"
263
+ })
264
+ }), /* @__PURE__ */ g("kbd", {
265
+ className: "inline-flex h-ico-md w-ico-md items-center justify-center rounded border border-surface-border-strong bg-surface-raised shadow-kbd",
266
+ children: /* @__PURE__ */ g(a, {
267
+ icon: v,
268
+ size: "xs",
269
+ className: "text-surface-fg-subtle"
270
+ })
271
+ })]
272
+ }) : e.keys === "↵" ? /* @__PURE__ */ g("kbd", {
273
+ className: "inline-flex h-[20px] items-center justify-center rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b shadow-kbd",
274
+ children: /* @__PURE__ */ g(a, {
275
+ icon: b,
276
+ size: "xs",
277
+ className: "text-surface-fg-subtle"
278
+ })
279
+ }) : /* @__PURE__ */ g("kbd", {
280
+ className: "inline-flex h-[20px] items-center justify-center rounded-ds-md border border-surface-border-strong bg-surface-raised px-ds-02b text-ds-xs font-medium text-surface-fg-subtle shadow-kbd",
281
+ children: e.keys
282
+ }), /* @__PURE__ */ g("span", {
283
+ className: "text-ds-xs text-surface-fg-subtle",
284
+ children: e.label
285
+ })]
286
+ }, t))
287
+ })
288
+ ]
289
+ })] })
290
+ });
291
+ });
292
+ x.displayName = "CommandPalette";
293
+ //#endregion
294
+ export { x as CommandPalette };