@ngrok/mantle 0.82.1 → 0.83.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.
- package/dist/accordion.d.ts +7 -7
- package/dist/agent.json +3 -1
- package/dist/{alert-BWwNPOMI.d.ts → alert-B1HXfkYn.d.ts} +9 -7
- package/dist/{alert-vwFd7qdp.js → alert-BuG2qS5l.js} +1 -1
- package/dist/alert-center.d.ts +3 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +18 -18
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +2 -2
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +67 -19
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +319 -0
- package/dist/avatar.js +1 -0
- package/dist/bar-chart.d.ts +73 -20
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +50 -17
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +3 -3
- package/dist/{button-C-gMbPso.d.ts → button-BIf69CSV.d.ts} +2 -2
- package/dist/button-BLDjW1u9.js +1 -0
- package/dist/{button-IlxHhjPK.js → button-CCkGqE1t.js} +1 -1
- package/dist/{button-C7vAl6lS.d.ts → button-DJ7AAgII.d.ts} +4 -6
- package/dist/{button-DARFK2KJ.d.ts → button-PoIujPMX.d.ts} +2 -2
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +15 -15
- package/dist/{chart-1cVjAcj8.d.ts → chart-0zcFJh4n.d.ts} +75 -22
- package/dist/chart-DBxT9BNl.js +2 -0
- package/dist/{choice-BNRQXszu.d.ts → choice-CVdQrs-m.d.ts} +118 -6
- package/dist/choice.d.ts +1 -1
- package/dist/{code-block-C9uaM9-V.js → code-block-CIE0F2fu.js} +1 -1
- package/dist/{code-block-B6OlZrSI.d.ts → code-block-CZWPrV4k.d.ts} +3 -3
- package/dist/code-block.d.ts +10 -7
- package/dist/code-block.js +2 -2
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/combobox.d.ts +8 -9
- package/dist/command.d.ts +668 -106
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +6 -6
- package/dist/data-table.js +1 -1
- package/dist/dialog-32Hq6w6P.js +1 -0
- package/dist/dialog-B6h1BCDL.d.ts +895 -0
- package/dist/dialog.d.ts +2 -805
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BcALUQMp.d.ts +1 -0
- package/dist/{dropdown-menu-D6pMAY7I.d.ts → dropdown-menu-DZOfj6HB.d.ts} +1 -1
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/field.d.ts +5 -5
- package/dist/field.js +1 -1
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +16 -17
- package/dist/hooks.js +1 -1
- package/dist/icons-DEVx1oP9.js +1 -0
- package/dist/icons.d.ts +7 -6
- package/dist/icons.js +1 -1
- package/dist/{in-view-DDEGUKDR.d.ts → in-view-gxyc9Q1_.d.ts} +1 -1
- package/dist/{input-BuYDU6CF.d.ts → input-DpnC3Xgj.d.ts} +2 -2
- package/dist/input.d.ts +1 -1
- package/dist/kbd.d.ts +1 -1
- package/dist/line-chart.d.ts +60 -13
- package/dist/line-chart.js +1 -1
- package/dist/list-CwL23L_B.js +1 -0
- package/dist/list.d.ts +2 -2
- package/dist/list.js +1 -1
- package/dist/llms.txt +3 -1
- package/dist/mantle-dark-high-contrast.css +30 -17
- package/dist/mantle-dark.css +48 -13
- package/dist/mantle-light-high-contrast.css +33 -15
- package/dist/mantle.css +436 -26
- package/dist/media-object.d.ts +5 -1
- package/dist/multi-select.d.ts +7 -7
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +4 -4
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/progress.d.ts +4 -4
- package/dist/qr-code.d.ts +2 -2
- package/dist/sandbar.d.ts +471 -0
- package/dist/sandbar.js +1 -0
- package/dist/sandboxed-on-click.d.ts +4 -6
- package/dist/scatter-plot.d.ts +69 -24
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-0z7HVS6r.d.ts → select-DVHmgih8.d.ts} +13 -7
- package/dist/select-LK9NX-vV.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +4 -4
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-B5UmkVRL.d.ts → separator-CNDs98Dv.d.ts} +2 -2
- package/dist/separator.d.ts +1 -1
- package/dist/{sheet-BxvTfPLM.js → sheet-BOSknSN9.js} +1 -1
- package/dist/sheet.d.ts +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +347 -366
- package/dist/sidebar.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/split-button.d.ts +12 -12
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +2 -1
- package/dist/{table-CGxJwtbL.js → table-C_Nm_RSV.js} +1 -1
- package/dist/{table-CZBYEmyK.d.ts → table-D51ZtV4U.d.ts} +18 -8
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +8 -13
- package/dist/tabs.js +1 -1
- package/dist/{theme-FbfjYiD3.d.ts → theme-6OxNhf6l.d.ts} +6 -6
- package/dist/theme-CVfq037P.js +1 -0
- package/dist/theme-switcher.d.ts +3 -3
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +86 -23
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +9 -9
- package/dist/toast.js +1 -1
- package/dist/{tooltip-mrpLz4DZ.d.ts → tooltip-DuXGxIse.d.ts} +6 -4
- package/dist/tooltip.d.ts +1 -1
- package/dist/use-breakpoint-Dqu12Szq.js +1 -0
- package/dist/use-callback-ref-IYti9y7x.js +1 -0
- package/dist/use-is-apple-platform-Cxwrb86L.js +1 -0
- package/dist/use-matches-media-query-Bd_GhhVd.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +5 -3
- package/dist/button-DvHMWAPl.js +0 -1
- package/dist/chart-B3pAvmkk.js +0 -2
- package/dist/dialog-DozL6n-F.js +0 -1
- package/dist/dropdown-menu-BbbQuae2.d.ts +0 -1
- package/dist/icons-Bb_zF2OV.js +0 -1
- package/dist/list-CJABVHwi.js +0 -1
- package/dist/platform-BVD3gpKD.js +0 -1
- package/dist/select-BReznXaw.js +0 -1
- package/dist/theme-BorfgnNh.js +0 -1
- package/dist/use-breakpoint-Wd7_5-Mu.js +0 -1
- package/dist/use-matches-media-query-CMSxHR9n.js +0 -1
package/dist/command.d.ts
CHANGED
|
@@ -1,19 +1,153 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
2
|
+
import { t as Dialog } from "./dialog-B6h1BCDL.js";
|
|
3
|
+
import { t as Slot } from "./slot-DdgxmuI5.js";
|
|
4
|
+
import { ComponentProps, ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
|
|
3
5
|
import { Command as Command$1, useCommandState } from "cmdk";
|
|
6
|
+
//#region src/components/command/search-trigger.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The props for `Command.SearchTrigger`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://mantle.ngrok.com/components/navigation/command#commandsearchtrigger
|
|
11
|
+
*/
|
|
12
|
+
type CommandSearchTriggerProps = Omit<ComponentProps<typeof Slot>, "children"> & {
|
|
13
|
+
/**
|
|
14
|
+
* The control that opens the palette — the row or button a user sees.
|
|
15
|
+
*
|
|
16
|
+
* A single element, required: this part renders no DOM of its own and
|
|
17
|
+
* clones what it is given, so text renders nothing to click and no children
|
|
18
|
+
* renders no trigger at all. In a sidebar this is a
|
|
19
|
+
* [`Sidebar.SearchTrigger`](https://mantle.ngrok.com/components/navigation/sidebar#sidebarsearchtrigger);
|
|
20
|
+
* anywhere else it is whatever your design calls for.
|
|
21
|
+
*/
|
|
22
|
+
children: ReactElement;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Makes any control behave like a search field that opens the command palette.
|
|
26
|
+
* It renders no DOM of its own — it clones its child and gives it the wiring,
|
|
27
|
+
* so **presentation belongs entirely to the child** and this part never has an
|
|
28
|
+
* opinion about how the trigger looks or how it behaves in a collapsed sidebar
|
|
29
|
+
* rail.
|
|
30
|
+
*
|
|
31
|
+
* The child stays a `<button>`, not a text field, even when it looks like one:
|
|
32
|
+
* it opens a modal palette, so a screen reader hears "has popup dialog,
|
|
33
|
+
* collapsed" while a sighted user sees a field. A real `<input>` with results
|
|
34
|
+
* in a popover is a combobox, and
|
|
35
|
+
* [Combobox](https://mantle.ngrok.com/components/forms/combobox) is the
|
|
36
|
+
* component for that intent.
|
|
37
|
+
*
|
|
38
|
+
* Because a search-shaped control invites typing, the wiring makes typing work:
|
|
39
|
+
* a printable keystroke or a paste while the trigger has focus opens the
|
|
40
|
+
* palette with that text already in `Command.Input`, so no character is lost
|
|
41
|
+
* between the trigger and the field. `Enter`, `Space`, and a click open it
|
|
42
|
+
* empty. See
|
|
43
|
+
* [`searchActionFromKeyDown`](https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown)
|
|
44
|
+
* for the exact policy, including IME composition.
|
|
45
|
+
*
|
|
46
|
+
* What it contributes to the child:
|
|
47
|
+
*
|
|
48
|
+
* - `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls`, and focus
|
|
49
|
+
* restoration on close, from the `Dialog.Trigger` it composes.
|
|
50
|
+
* - `data-state="open" | "closed"`, stamped from the palette's own state so it
|
|
51
|
+
* survives being wrapped in another cloning trigger — a `Sidebar.Tooltip`
|
|
52
|
+
* passes its own `data-state` down, and Radix's prop merge would otherwise
|
|
53
|
+
* let it win.
|
|
54
|
+
* - `aria-keyshortcuts`, so the `⌘K` binding is announced rather than only
|
|
55
|
+
* drawn — present only when `Command.DialogRoot` owns the shortcut, so it can
|
|
56
|
+
* never advertise a binding that is not bound. Pass your own value to
|
|
57
|
+
* announce a chord you bound yourself.
|
|
58
|
+
* - `onKeyDown` and `onPaste`, composed with the child's own handlers.
|
|
59
|
+
* - `data-slot="command-search-trigger"`, joined ahead of the child's own slot.
|
|
60
|
+
*
|
|
61
|
+
* Every other prop it receives passes through to the child, so composing it
|
|
62
|
+
* inside another cloning trigger works: `Sidebar.Tooltip` → `Command.SearchTrigger`
|
|
63
|
+
* → `Sidebar.SearchTrigger` routes the tooltip's handlers all the way down.
|
|
64
|
+
*
|
|
65
|
+
* It adds no accessible name: the child's visible label is the name, so the two
|
|
66
|
+
* cannot drift apart. A visible `⌘K` hint belongs to the child and should be
|
|
67
|
+
* `aria-hidden` there, since `aria-keyshortcuts` already announces the chord —
|
|
68
|
+
* `Sidebar.SearchTrigger`'s `shortcut` prop does that for you.
|
|
69
|
+
*
|
|
70
|
+
* @see https://mantle.ngrok.com/components/navigation/command#commandsearchtrigger
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <Command.DialogRoot>
|
|
75
|
+
* <Command.SearchTrigger>
|
|
76
|
+
* <button type="button">
|
|
77
|
+
* <MagnifyingGlassIcon />
|
|
78
|
+
* <span>Search…</span>
|
|
79
|
+
* </button>
|
|
80
|
+
* </Command.SearchTrigger>
|
|
81
|
+
* <Command.DialogContent>
|
|
82
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
83
|
+
* <Command.List>
|
|
84
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
85
|
+
* <Command.Group heading="Suggestions">
|
|
86
|
+
* <Command.Item>
|
|
87
|
+
* <span>Calendar</span>
|
|
88
|
+
* </Command.Item>
|
|
89
|
+
* </Command.Group>
|
|
90
|
+
* <Command.Separator />
|
|
91
|
+
* <Command.Group heading="Settings">
|
|
92
|
+
* <Command.Item>
|
|
93
|
+
* <span>Profile</span>
|
|
94
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
95
|
+
* </Command.Item>
|
|
96
|
+
* </Command.Group>
|
|
97
|
+
* </Command.List>
|
|
98
|
+
* </Command.DialogContent>
|
|
99
|
+
* </Command.DialogRoot>
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* In a sidebar, where `Sidebar.SearchTrigger` owns the row's appearance in both
|
|
104
|
+
* panel states — including its hover-revealed shortcut hint — and
|
|
105
|
+
* `Sidebar.Tooltip` labels it in the collapsed rail:
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Sidebar.Body>
|
|
108
|
+
* <Command.DialogRoot>
|
|
109
|
+
* <Sidebar.Tooltip label="Search">
|
|
110
|
+
* <Command.SearchTrigger>
|
|
111
|
+
* <Sidebar.SearchTrigger
|
|
112
|
+
* shortcut={
|
|
113
|
+
* <>
|
|
114
|
+
* <MetaKey />
|
|
115
|
+
* <Kbd>K</Kbd>
|
|
116
|
+
* </>
|
|
117
|
+
* }
|
|
118
|
+
* >
|
|
119
|
+
* <MagnifyingGlassIcon />
|
|
120
|
+
* <span className="min-w-0 flex-1 truncate">Search</span>
|
|
121
|
+
* </Sidebar.SearchTrigger>
|
|
122
|
+
* </Command.SearchTrigger>
|
|
123
|
+
* </Sidebar.Tooltip>
|
|
124
|
+
* <Command.DialogContent>
|
|
125
|
+
* <Command.Input placeholder="Search endpoints, agents, and settings..." />
|
|
126
|
+
* <Command.List>
|
|
127
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
128
|
+
* </Command.List>
|
|
129
|
+
* </Command.DialogContent>
|
|
130
|
+
* </Command.DialogRoot>
|
|
131
|
+
* </Sidebar.Body>
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare const CommandSearchTrigger: ({ "aria-keyshortcuts": ariaKeyshortcuts, children, "data-slot": dataSlot, onKeyDown, onPaste, ...props }: CommandSearchTriggerProps) => import("react").JSX.Element;
|
|
135
|
+
//#endregion
|
|
4
136
|
//#region src/components/command/command.d.ts
|
|
5
137
|
type CommandRootProps = ComponentProps<typeof Command$1>;
|
|
6
138
|
/**
|
|
7
|
-
* The
|
|
139
|
+
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
140
|
+
* filtering and the active item for every part below it — `Command.DialogContent`
|
|
141
|
+
* renders one itself, so a modal palette does not add it.
|
|
8
142
|
*
|
|
9
143
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
10
144
|
*
|
|
11
145
|
* @example
|
|
12
146
|
* ```tsx
|
|
13
|
-
* <Command.DialogRoot
|
|
14
|
-
* <Command.
|
|
15
|
-
* <
|
|
16
|
-
* </Command.
|
|
147
|
+
* <Command.DialogRoot>
|
|
148
|
+
* <Command.SearchTrigger>
|
|
149
|
+
* <button type="button">Search…</button>
|
|
150
|
+
* </Command.SearchTrigger>
|
|
17
151
|
* <Command.DialogContent>
|
|
18
152
|
* <Command.Input placeholder="Type a command or search..." />
|
|
19
153
|
* <Command.List>
|
|
@@ -36,6 +170,112 @@ type CommandRootProps = ComponentProps<typeof Command$1>;
|
|
|
36
170
|
* ```
|
|
37
171
|
*/
|
|
38
172
|
declare const CommandRoot: ({ className, ...props }: CommandRootProps) => import("react").JSX.Element;
|
|
173
|
+
/**
|
|
174
|
+
* The props for `Command.DialogRoot`. `Dialog.Root`'s props — so `modal` still
|
|
175
|
+
* reaches the underlying dialog — with the open state and the keyboard shortcut
|
|
176
|
+
* redeclared here, because this part owns them.
|
|
177
|
+
*
|
|
178
|
+
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
179
|
+
*/
|
|
180
|
+
type CommandDialogRootProps = Omit<ComponentProps<typeof Dialog.Root>, "children" | "defaultOpen" | "onOpenChange" | "open"> & {
|
|
181
|
+
/**
|
|
182
|
+
* The palette's parts — a `Command.DialogContent`, and any trigger or
|
|
183
|
+
* consumer of `useCommandDialog()`. `DialogRoot` renders no DOM of its own.
|
|
184
|
+
*/
|
|
185
|
+
children?: ReactNode;
|
|
186
|
+
/**
|
|
187
|
+
* The initial open state for the uncontrolled case.
|
|
188
|
+
*
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
defaultOpen?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Bind `⌘K` (macOS) / `Ctrl+K` (Windows/Linux) to toggle the palette. The
|
|
194
|
+
* shortcut requires exactly the platform modifier + `k`, resolved per host —
|
|
195
|
+
* the two never substitute for each other, so macOS's native `Ctrl+K` ("kill
|
|
196
|
+
* to end of line") is left alone. `Shift`/`Alt` combinations pass through.
|
|
197
|
+
*
|
|
198
|
+
* It lives here rather than on `Command.SearchTrigger` because the trigger
|
|
199
|
+
* may be unmounted while the shortcut must still work — a sidebar rendered
|
|
200
|
+
* as a mobile sheet unmounts its whole tree when the sheet is closed.
|
|
201
|
+
*
|
|
202
|
+
* The shortcut is ignored while focus is in a rich-text or code editor
|
|
203
|
+
* (`contenteditable`, or a `<textarea>`, which is what Monaco attaches to),
|
|
204
|
+
* where `⌘K` is already bound to "insert link" or a chord prefix. It
|
|
205
|
+
* deliberately still fires from a plain `<input>`, including the palette's
|
|
206
|
+
* own `Command.Input` — so the chord closes what it opened.
|
|
207
|
+
*
|
|
208
|
+
* Exactly one root per window owns the shortcut: the first mounted root that
|
|
209
|
+
* wants it. Additional roots queue and take over when the owner unmounts, so
|
|
210
|
+
* a second palette never opens alongside the first.
|
|
211
|
+
*
|
|
212
|
+
* Set `false` to bind the chord yourself with `useCommandDialog()`.
|
|
213
|
+
* `Command.SearchTrigger` then adds no `aria-keyshortcuts` of its own — pass
|
|
214
|
+
* one to announce the chord you bound — and `useCommandDialog().keyboardShortcut`
|
|
215
|
+
* reports the same flag. The *visible* hint always belongs to the trigger's
|
|
216
|
+
* child, so gating that on the flag is the child's job.
|
|
217
|
+
*
|
|
218
|
+
* @default true
|
|
219
|
+
*/
|
|
220
|
+
keyboardShortcut?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Called with the next open state whenever it changes.
|
|
223
|
+
*/
|
|
224
|
+
onOpenChange?: (open: boolean) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Controlled open state. Pair with `onOpenChange`.
|
|
227
|
+
*/
|
|
228
|
+
open?: boolean;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* The state owner for a command palette. Renders no DOM of its own — it owns
|
|
232
|
+
* the open state, the query text, and the `⌘K` shortcut, and carries them to
|
|
233
|
+
* every part below through `useCommandDialog()`.
|
|
234
|
+
*
|
|
235
|
+
* Owning the query is what makes typing into `Command.SearchTrigger` work: the
|
|
236
|
+
* seed and the open state land in one state update, so `Command.Input` mounts
|
|
237
|
+
* with the character already in it and no keystroke races the dialog's mount.
|
|
238
|
+
*
|
|
239
|
+
* **Opening always starts from a known query** — the seed, or empty. That
|
|
240
|
+
* happens at open time rather than by clearing on close, because
|
|
241
|
+
* `Dialog.Content` animates out and clearing on close would swap the visible
|
|
242
|
+
* list mid-animation. So dismissing and reopening never resurrects the previous
|
|
243
|
+
* search.
|
|
244
|
+
*
|
|
245
|
+
* Pass `open`/`onOpenChange` to control the open state; the query stays
|
|
246
|
+
* internal either way. To own the query too, pass `value`/`onValueChange` to
|
|
247
|
+
* `Command.Input` — see that part for the trade-off.
|
|
248
|
+
*
|
|
249
|
+
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```tsx
|
|
253
|
+
* <Command.DialogRoot>
|
|
254
|
+
* <Command.SearchTrigger>
|
|
255
|
+
* <button type="button">Search…</button>
|
|
256
|
+
* </Command.SearchTrigger>
|
|
257
|
+
* <Command.DialogContent>
|
|
258
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
259
|
+
* <Command.List>
|
|
260
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
261
|
+
* <Command.Group heading="Suggestions">
|
|
262
|
+
* <Command.Item>
|
|
263
|
+
* <span>Calendar</span>
|
|
264
|
+
* </Command.Item>
|
|
265
|
+
* </Command.Group>
|
|
266
|
+
* <Command.Separator />
|
|
267
|
+
* <Command.Group heading="Settings">
|
|
268
|
+
* <Command.Item>
|
|
269
|
+
* <span>Profile</span>
|
|
270
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
271
|
+
* </Command.Item>
|
|
272
|
+
* </Command.Group>
|
|
273
|
+
* </Command.List>
|
|
274
|
+
* </Command.DialogContent>
|
|
275
|
+
* </Command.DialogRoot>
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
declare const CommandDialogRoot: ({ children, defaultOpen, keyboardShortcut, onOpenChange, open: openProp, ...props }: CommandDialogRootProps) => import("react").JSX.Element;
|
|
39
279
|
/**
|
|
40
280
|
* The props for the CommandDialog.Content component.
|
|
41
281
|
*
|
|
@@ -89,10 +329,10 @@ type CommandDialogContentProps = {
|
|
|
89
329
|
*
|
|
90
330
|
* @example
|
|
91
331
|
* ```tsx
|
|
92
|
-
* <Command.DialogRoot
|
|
93
|
-
* <Command.
|
|
94
|
-
* <
|
|
95
|
-
* </Command.
|
|
332
|
+
* <Command.DialogRoot>
|
|
333
|
+
* <Command.SearchTrigger>
|
|
334
|
+
* <button type="button">Search…</button>
|
|
335
|
+
* </Command.SearchTrigger>
|
|
96
336
|
* <Command.DialogContent>
|
|
97
337
|
* <Command.Input placeholder="Type a command or search..." />
|
|
98
338
|
* <Command.List>
|
|
@@ -116,16 +356,37 @@ type CommandDialogContentProps = {
|
|
|
116
356
|
*/
|
|
117
357
|
declare const CommandDialogContent: ({ children, className, description, filter, shouldFilter, showCloseButton, title }: CommandDialogContentProps) => import("react").JSX.Element;
|
|
118
358
|
/**
|
|
119
|
-
* The
|
|
359
|
+
* The palette's query field.
|
|
360
|
+
*
|
|
361
|
+
* Inside a `Command.DialogRoot` the palette owns the query by default, which is
|
|
362
|
+
* what lets `Command.SearchTrigger` open with a seeded value and what
|
|
363
|
+
* `useCommandDialog().query` reads. Under a bare `Command.Root` (an inline
|
|
364
|
+
* palette, no dialog) it stays uncontrolled and cmdk owns the text.
|
|
365
|
+
*
|
|
366
|
+
* Passing `value` takes the query over completely: your value wins, this stops
|
|
367
|
+
* reporting to `useCommandDialog()`, and **seeding becomes yours to apply** —
|
|
368
|
+
* read `useCommandDialog().query` and mirror it, or drop
|
|
369
|
+
* `Command.SearchTrigger` for a plain `Command.DialogTrigger`. Prefer leaving
|
|
370
|
+
* it uncontrolled and reading the query from the hook.
|
|
371
|
+
*
|
|
372
|
+
* `className`, `ref`, and rest props land on the parts they belong to: `ref` on
|
|
373
|
+
* the wrapper, everything else on the `<input>`.
|
|
374
|
+
*
|
|
375
|
+
* **Data attributes:**
|
|
376
|
+
*
|
|
377
|
+
* | Data Attribute | Value | Description |
|
|
378
|
+
* | --- | --- | --- |
|
|
379
|
+
* | `data-slot` | `"command-input-wrapper"` | The row holding the magnifier and the field. |
|
|
380
|
+
* | `data-slot` | `"command-input"` | The `<input>` itself, joined after any `data-slot` you forward. Load-bearing beyond styling: `Command.DialogContent` finds the field by this slot when the palette opens, to place the caret after a seeded query instead of over it, so this part of the chain is never replaced. |
|
|
120
381
|
*
|
|
121
382
|
* @see https://mantle.ngrok.com/components/navigation/command#commandinput
|
|
122
383
|
*
|
|
123
384
|
* @example
|
|
124
385
|
* ```tsx
|
|
125
|
-
* <Command.DialogRoot
|
|
126
|
-
* <Command.
|
|
127
|
-
* <
|
|
128
|
-
* </Command.
|
|
386
|
+
* <Command.DialogRoot>
|
|
387
|
+
* <Command.SearchTrigger>
|
|
388
|
+
* <button type="button">Search…</button>
|
|
389
|
+
* </Command.SearchTrigger>
|
|
129
390
|
* <Command.DialogContent>
|
|
130
391
|
* <Command.Input placeholder="Type a command or search..." />
|
|
131
392
|
* <Command.List>
|
|
@@ -147,20 +408,20 @@ declare const CommandDialogContent: ({ children, className, description, filter,
|
|
|
147
408
|
* </Command.DialogRoot>
|
|
148
409
|
* ```
|
|
149
410
|
*/
|
|
150
|
-
declare const CommandInput: ({ className, ref, ...props }: ComponentPropsWithoutRef<typeof Command$1.Input> & {
|
|
411
|
+
declare const CommandInput: ({ className, "data-slot": dataSlot, onValueChange, ref, value, ...props }: ComponentPropsWithoutRef<typeof Command$1.Input> & WithDataSlot & {
|
|
151
412
|
ref?: Ref<HTMLDivElement>;
|
|
152
413
|
}) => import("react").JSX.Element;
|
|
153
414
|
/**
|
|
154
|
-
* The
|
|
415
|
+
* The scrolling container for the palette's groups and items.
|
|
155
416
|
*
|
|
156
417
|
* @see https://mantle.ngrok.com/components/navigation/command#commandlist
|
|
157
418
|
*
|
|
158
419
|
* @example
|
|
159
420
|
* ```tsx
|
|
160
|
-
* <Command.DialogRoot
|
|
161
|
-
* <Command.
|
|
162
|
-
* <
|
|
163
|
-
* </Command.
|
|
421
|
+
* <Command.DialogRoot>
|
|
422
|
+
* <Command.SearchTrigger>
|
|
423
|
+
* <button type="button">Search…</button>
|
|
424
|
+
* </Command.SearchTrigger>
|
|
164
425
|
* <Command.DialogContent>
|
|
165
426
|
* <Command.Input placeholder="Type a command or search..." />
|
|
166
427
|
* <Command.List>
|
|
@@ -184,16 +445,16 @@ declare const CommandInput: ({ className, ref, ...props }: ComponentPropsWithout
|
|
|
184
445
|
*/
|
|
185
446
|
declare const CommandList: ({ className, ...props }: ComponentProps<typeof Command$1.List>) => import("react").JSX.Element;
|
|
186
447
|
/**
|
|
187
|
-
* The empty
|
|
448
|
+
* The empty-state message; it renders only when no item matches the query.
|
|
188
449
|
*
|
|
189
450
|
* @see https://mantle.ngrok.com/components/navigation/command#commandempty
|
|
190
451
|
*
|
|
191
452
|
* @example
|
|
192
453
|
* ```tsx
|
|
193
|
-
* <Command.DialogRoot
|
|
194
|
-
* <Command.
|
|
195
|
-
* <
|
|
196
|
-
* </Command.
|
|
454
|
+
* <Command.DialogRoot>
|
|
455
|
+
* <Command.SearchTrigger>
|
|
456
|
+
* <button type="button">Search…</button>
|
|
457
|
+
* </Command.SearchTrigger>
|
|
197
458
|
* <Command.DialogContent>
|
|
198
459
|
* <Command.Input placeholder="Type a command or search..." />
|
|
199
460
|
* <Command.List>
|
|
@@ -217,16 +478,16 @@ declare const CommandList: ({ className, ...props }: ComponentProps<typeof Comma
|
|
|
217
478
|
*/
|
|
218
479
|
declare const CommandEmpty: ({ className, ...props }: ComponentProps<typeof Command$1.Empty>) => import("react").JSX.Element;
|
|
219
480
|
/**
|
|
220
|
-
*
|
|
481
|
+
* A labeled section of items; the `heading` prop names it.
|
|
221
482
|
*
|
|
222
483
|
* @see https://mantle.ngrok.com/components/navigation/command#commandgroup
|
|
223
484
|
*
|
|
224
485
|
* @example
|
|
225
486
|
* ```tsx
|
|
226
|
-
* <Command.DialogRoot
|
|
227
|
-
* <Command.
|
|
228
|
-
* <
|
|
229
|
-
* </Command.
|
|
487
|
+
* <Command.DialogRoot>
|
|
488
|
+
* <Command.SearchTrigger>
|
|
489
|
+
* <button type="button">Search…</button>
|
|
490
|
+
* </Command.SearchTrigger>
|
|
230
491
|
* <Command.DialogContent>
|
|
231
492
|
* <Command.Input placeholder="Type a command or search..." />
|
|
232
493
|
* <Command.List>
|
|
@@ -250,16 +511,16 @@ declare const CommandEmpty: ({ className, ...props }: ComponentProps<typeof Comm
|
|
|
250
511
|
*/
|
|
251
512
|
declare const CommandGroup: ({ className, ...props }: ComponentProps<typeof Command$1.Group>) => import("react").JSX.Element;
|
|
252
513
|
/**
|
|
253
|
-
*
|
|
514
|
+
* A horizontal rule between two groups of items.
|
|
254
515
|
*
|
|
255
516
|
* @see https://mantle.ngrok.com/components/navigation/command#commandseparator
|
|
256
517
|
*
|
|
257
518
|
* @example
|
|
258
519
|
* ```tsx
|
|
259
|
-
* <Command.DialogRoot
|
|
260
|
-
* <Command.
|
|
261
|
-
* <
|
|
262
|
-
* </Command.
|
|
520
|
+
* <Command.DialogRoot>
|
|
521
|
+
* <Command.SearchTrigger>
|
|
522
|
+
* <button type="button">Search…</button>
|
|
523
|
+
* </Command.SearchTrigger>
|
|
263
524
|
* <Command.DialogContent>
|
|
264
525
|
* <Command.Input placeholder="Type a command or search..." />
|
|
265
526
|
* <Command.List>
|
|
@@ -283,16 +544,16 @@ declare const CommandGroup: ({ className, ...props }: ComponentProps<typeof Comm
|
|
|
283
544
|
*/
|
|
284
545
|
declare const CommandSeparator: ({ className, ...props }: ComponentProps<typeof Command$1.Separator>) => import("react").JSX.Element;
|
|
285
546
|
/**
|
|
286
|
-
*
|
|
547
|
+
* One selectable row in the palette's list.
|
|
287
548
|
*
|
|
288
549
|
* @see https://mantle.ngrok.com/components/navigation/command#commanditem
|
|
289
550
|
*
|
|
290
551
|
* @example
|
|
291
552
|
* ```tsx
|
|
292
|
-
* <Command.DialogRoot
|
|
293
|
-
* <Command.
|
|
294
|
-
* <
|
|
295
|
-
* </Command.
|
|
553
|
+
* <Command.DialogRoot>
|
|
554
|
+
* <Command.SearchTrigger>
|
|
555
|
+
* <button type="button">Search…</button>
|
|
556
|
+
* </Command.SearchTrigger>
|
|
296
557
|
* <Command.DialogContent>
|
|
297
558
|
* <Command.Input placeholder="Type a command or search..." />
|
|
298
559
|
* <Command.List>
|
|
@@ -316,16 +577,16 @@ declare const CommandSeparator: ({ className, ...props }: ComponentProps<typeof
|
|
|
316
577
|
*/
|
|
317
578
|
declare const CommandItem: ({ className, ...props }: ComponentProps<typeof Command$1.Item>) => import("react").JSX.Element;
|
|
318
579
|
/**
|
|
319
|
-
* The
|
|
580
|
+
* The keyboard hint for a `Command.Item`, aligned to the end of the row.
|
|
320
581
|
*
|
|
321
582
|
* @see https://mantle.ngrok.com/components/navigation/command#commandshortcut
|
|
322
583
|
*
|
|
323
584
|
* @example
|
|
324
585
|
* ```tsx
|
|
325
|
-
* <Command.DialogRoot
|
|
326
|
-
* <Command.
|
|
327
|
-
* <
|
|
328
|
-
* </Command.
|
|
586
|
+
* <Command.DialogRoot>
|
|
587
|
+
* <Command.SearchTrigger>
|
|
588
|
+
* <button type="button">Search…</button>
|
|
589
|
+
* </Command.SearchTrigger>
|
|
329
590
|
* <Command.DialogContent>
|
|
330
591
|
* <Command.Input placeholder="Type a command or search..." />
|
|
331
592
|
* <Command.List>
|
|
@@ -349,7 +610,16 @@ declare const CommandItem: ({ className, ...props }: ComponentProps<typeof Comma
|
|
|
349
610
|
*/
|
|
350
611
|
declare const CommandShortcut: ({ className, ...props }: ComponentProps<"span">) => import("react").JSX.Element;
|
|
351
612
|
/**
|
|
352
|
-
*
|
|
613
|
+
* A command palette: a modal search field over a filtered, keyboard-navigable
|
|
614
|
+
* list of items. `Command.SearchTrigger` is the field-shaped button that opens
|
|
615
|
+
* it, `Command.DialogRoot` owns the open state, the query, and the `⌘K`
|
|
616
|
+
* shortcut, and `Command.DialogTrigger` is the escape hatch for a trigger of
|
|
617
|
+
* your own.
|
|
618
|
+
*
|
|
619
|
+
* Use `Command.Root` instead of `Command.DialogRoot` for an inline palette that
|
|
620
|
+
* is always visible. For a text field that filters options in place rather than
|
|
621
|
+
* opening a modal, the component is
|
|
622
|
+
* [Combobox](https://mantle.ngrok.com/components/forms/combobox).
|
|
353
623
|
*
|
|
354
624
|
* @see https://mantle.ngrok.com/components/navigation/command
|
|
355
625
|
*
|
|
@@ -357,6 +627,7 @@ declare const CommandShortcut: ({ className, ...props }: ComponentProps<"span">)
|
|
|
357
627
|
* Composition:
|
|
358
628
|
* ```
|
|
359
629
|
* Command.DialogRoot
|
|
630
|
+
* ├── Command.SearchTrigger
|
|
360
631
|
* ├── Command.DialogTrigger
|
|
361
632
|
* └── Command.DialogContent
|
|
362
633
|
* ├── Command.Input
|
|
@@ -370,10 +641,10 @@ declare const CommandShortcut: ({ className, ...props }: ComponentProps<"span">)
|
|
|
370
641
|
*
|
|
371
642
|
* @example
|
|
372
643
|
* ```tsx
|
|
373
|
-
* <Command.DialogRoot
|
|
374
|
-
* <Command.
|
|
375
|
-
* <
|
|
376
|
-
* </Command.
|
|
644
|
+
* <Command.DialogRoot>
|
|
645
|
+
* <Command.SearchTrigger>
|
|
646
|
+
* <button type="button">Search…</button>
|
|
647
|
+
* </Command.SearchTrigger>
|
|
377
648
|
* <Command.DialogContent>
|
|
378
649
|
* <Command.Input placeholder="Type a command or search..." />
|
|
379
650
|
* <Command.List>
|
|
@@ -397,16 +668,18 @@ declare const CommandShortcut: ({ className, ...props }: ComponentProps<"span">)
|
|
|
397
668
|
*/
|
|
398
669
|
declare const Command: {
|
|
399
670
|
/**
|
|
400
|
-
* The
|
|
671
|
+
* The inline palette, wrapping `Command.Input` and `Command.List`. It owns the
|
|
672
|
+
* filtering and the active item for every part below it — `Command.DialogContent`
|
|
673
|
+
* renders one itself, so a modal palette does not add it.
|
|
401
674
|
*
|
|
402
675
|
* @see https://mantle.ngrok.com/components/navigation/command#commandroot
|
|
403
676
|
*
|
|
404
677
|
* @example
|
|
405
678
|
* ```tsx
|
|
406
|
-
* <Command.DialogRoot
|
|
407
|
-
* <Command.
|
|
408
|
-
* <
|
|
409
|
-
* </Command.
|
|
679
|
+
* <Command.DialogRoot>
|
|
680
|
+
* <Command.SearchTrigger>
|
|
681
|
+
* <button type="button">Search…</button>
|
|
682
|
+
* </Command.SearchTrigger>
|
|
410
683
|
* <Command.DialogContent>
|
|
411
684
|
* <Command.Input placeholder="Type a command or search..." />
|
|
412
685
|
* <Command.List>
|
|
@@ -430,16 +703,51 @@ declare const Command: {
|
|
|
430
703
|
*/
|
|
431
704
|
readonly Root: typeof CommandRoot;
|
|
432
705
|
/**
|
|
433
|
-
* The
|
|
706
|
+
* The state owner for the Command dialog. Owns the open state, the query
|
|
707
|
+
* text, and the `⌘K` shortcut, and renders no DOM of its own.
|
|
434
708
|
*
|
|
435
709
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogroot
|
|
436
710
|
*
|
|
437
711
|
* @example
|
|
438
712
|
* ```tsx
|
|
439
|
-
* <Command.DialogRoot
|
|
440
|
-
* <Command.
|
|
441
|
-
* <
|
|
442
|
-
* </Command.
|
|
713
|
+
* <Command.DialogRoot>
|
|
714
|
+
* <Command.SearchTrigger>
|
|
715
|
+
* <button type="button">Search…</button>
|
|
716
|
+
* </Command.SearchTrigger>
|
|
717
|
+
* <Command.DialogContent>
|
|
718
|
+
* <Command.Input placeholder="Type a command or search..." />
|
|
719
|
+
* <Command.List>
|
|
720
|
+
* <Command.Empty>No results found.</Command.Empty>
|
|
721
|
+
* <Command.Group heading="Suggestions">
|
|
722
|
+
* <Command.Item>
|
|
723
|
+
* <span>Calendar</span>
|
|
724
|
+
* </Command.Item>
|
|
725
|
+
* </Command.Group>
|
|
726
|
+
* <Command.Separator />
|
|
727
|
+
* <Command.Group heading="Settings">
|
|
728
|
+
* <Command.Item>
|
|
729
|
+
* <span>Profile</span>
|
|
730
|
+
* <Command.Shortcut>⌘,</Command.Shortcut>
|
|
731
|
+
* </Command.Item>
|
|
732
|
+
* </Command.Group>
|
|
733
|
+
* </Command.List>
|
|
734
|
+
* </Command.DialogContent>
|
|
735
|
+
* </Command.DialogRoot>
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
738
|
+
readonly DialogRoot: typeof CommandDialogRoot;
|
|
739
|
+
/**
|
|
740
|
+
* A button shaped like an `Input` that opens the palette, with the `⌘K` hint
|
|
741
|
+
* and keystroke/paste forwarding.
|
|
742
|
+
*
|
|
743
|
+
* @see https://mantle.ngrok.com/components/navigation/command#commandsearchtrigger
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* ```tsx
|
|
747
|
+
* <Command.DialogRoot>
|
|
748
|
+
* <Command.SearchTrigger>
|
|
749
|
+
* <button type="button">Search…</button>
|
|
750
|
+
* </Command.SearchTrigger>
|
|
443
751
|
* <Command.DialogContent>
|
|
444
752
|
* <Command.Input placeholder="Type a command or search..." />
|
|
445
753
|
* <Command.List>
|
|
@@ -461,15 +769,22 @@ declare const Command: {
|
|
|
461
769
|
* </Command.DialogRoot>
|
|
462
770
|
* ```
|
|
463
771
|
*/
|
|
464
|
-
readonly
|
|
772
|
+
readonly SearchTrigger: typeof CommandSearchTrigger;
|
|
465
773
|
/**
|
|
466
|
-
* A button that opens the Command dialog when clicked
|
|
774
|
+
* A bare button that opens the Command dialog when clicked — the escape hatch
|
|
775
|
+
* for a trigger that should not look like a search field. Wrap your own
|
|
776
|
+
* element with `asChild`.
|
|
777
|
+
*
|
|
778
|
+
* It carries none of `Command.SearchTrigger`'s behavior: no `⌘K` hint, no
|
|
779
|
+
* `aria-keyshortcuts`, and typing or pasting into it does nothing. Rebuild
|
|
780
|
+
* that with `useCommandDialog()` and `searchActionFromKeyDown` /
|
|
781
|
+
* `searchActionFromPaste` if you need it.
|
|
467
782
|
*
|
|
468
783
|
* @see https://mantle.ngrok.com/components/navigation/command#commanddialogtrigger
|
|
469
784
|
*
|
|
470
785
|
* @example
|
|
471
786
|
* ```tsx
|
|
472
|
-
* <Command.DialogRoot
|
|
787
|
+
* <Command.DialogRoot>
|
|
473
788
|
* <Command.DialogTrigger asChild>
|
|
474
789
|
* <Button type="button" appearance="outlined" intent="neutral">Open Command Palette</Button>
|
|
475
790
|
* </Command.DialogTrigger>
|
|
@@ -502,10 +817,10 @@ declare const Command: {
|
|
|
502
817
|
*
|
|
503
818
|
* @example
|
|
504
819
|
* ```tsx
|
|
505
|
-
* <Command.DialogRoot
|
|
506
|
-
* <Command.
|
|
507
|
-
* <
|
|
508
|
-
* </Command.
|
|
820
|
+
* <Command.DialogRoot>
|
|
821
|
+
* <Command.SearchTrigger>
|
|
822
|
+
* <button type="button">Search…</button>
|
|
823
|
+
* </Command.SearchTrigger>
|
|
509
824
|
* <Command.DialogContent>
|
|
510
825
|
* <Command.Input placeholder="Type a command or search..." />
|
|
511
826
|
* <Command.List>
|
|
@@ -529,16 +844,16 @@ declare const Command: {
|
|
|
529
844
|
*/
|
|
530
845
|
readonly DialogContent: typeof CommandDialogContent;
|
|
531
846
|
/**
|
|
532
|
-
* The
|
|
847
|
+
* The palette's query field.
|
|
533
848
|
*
|
|
534
849
|
* @see https://mantle.ngrok.com/components/navigation/command#commandinput
|
|
535
850
|
*
|
|
536
851
|
* @example
|
|
537
852
|
* ```tsx
|
|
538
|
-
* <Command.DialogRoot
|
|
539
|
-
* <Command.
|
|
540
|
-
* <
|
|
541
|
-
* </Command.
|
|
853
|
+
* <Command.DialogRoot>
|
|
854
|
+
* <Command.SearchTrigger>
|
|
855
|
+
* <button type="button">Search…</button>
|
|
856
|
+
* </Command.SearchTrigger>
|
|
542
857
|
* <Command.DialogContent>
|
|
543
858
|
* <Command.Input placeholder="Type a command or search..." />
|
|
544
859
|
* <Command.List>
|
|
@@ -562,16 +877,16 @@ declare const Command: {
|
|
|
562
877
|
*/
|
|
563
878
|
readonly Input: typeof CommandInput;
|
|
564
879
|
/**
|
|
565
|
-
* The
|
|
880
|
+
* The scrolling container for the palette's groups and items.
|
|
566
881
|
*
|
|
567
882
|
* @see https://mantle.ngrok.com/components/navigation/command#commandlist
|
|
568
883
|
*
|
|
569
884
|
* @example
|
|
570
885
|
* ```tsx
|
|
571
|
-
* <Command.DialogRoot
|
|
572
|
-
* <Command.
|
|
573
|
-
* <
|
|
574
|
-
* </Command.
|
|
886
|
+
* <Command.DialogRoot>
|
|
887
|
+
* <Command.SearchTrigger>
|
|
888
|
+
* <button type="button">Search…</button>
|
|
889
|
+
* </Command.SearchTrigger>
|
|
575
890
|
* <Command.DialogContent>
|
|
576
891
|
* <Command.Input placeholder="Type a command or search..." />
|
|
577
892
|
* <Command.List>
|
|
@@ -595,16 +910,16 @@ declare const Command: {
|
|
|
595
910
|
*/
|
|
596
911
|
readonly List: typeof CommandList;
|
|
597
912
|
/**
|
|
598
|
-
* The empty
|
|
913
|
+
* The empty-state message; it renders only when no item matches the query.
|
|
599
914
|
*
|
|
600
915
|
* @see https://mantle.ngrok.com/components/navigation/command#commandempty
|
|
601
916
|
*
|
|
602
917
|
* @example
|
|
603
918
|
* ```tsx
|
|
604
|
-
* <Command.DialogRoot
|
|
605
|
-
* <Command.
|
|
606
|
-
* <
|
|
607
|
-
* </Command.
|
|
919
|
+
* <Command.DialogRoot>
|
|
920
|
+
* <Command.SearchTrigger>
|
|
921
|
+
* <button type="button">Search…</button>
|
|
922
|
+
* </Command.SearchTrigger>
|
|
608
923
|
* <Command.DialogContent>
|
|
609
924
|
* <Command.Input placeholder="Type a command or search..." />
|
|
610
925
|
* <Command.List>
|
|
@@ -628,16 +943,16 @@ declare const Command: {
|
|
|
628
943
|
*/
|
|
629
944
|
readonly Empty: typeof CommandEmpty;
|
|
630
945
|
/**
|
|
631
|
-
*
|
|
946
|
+
* A labeled section of items; the `heading` prop names it.
|
|
632
947
|
*
|
|
633
948
|
* @see https://mantle.ngrok.com/components/navigation/command#commandgroup
|
|
634
949
|
*
|
|
635
950
|
* @example
|
|
636
951
|
* ```tsx
|
|
637
|
-
* <Command.DialogRoot
|
|
638
|
-
* <Command.
|
|
639
|
-
* <
|
|
640
|
-
* </Command.
|
|
952
|
+
* <Command.DialogRoot>
|
|
953
|
+
* <Command.SearchTrigger>
|
|
954
|
+
* <button type="button">Search…</button>
|
|
955
|
+
* </Command.SearchTrigger>
|
|
641
956
|
* <Command.DialogContent>
|
|
642
957
|
* <Command.Input placeholder="Type a command or search..." />
|
|
643
958
|
* <Command.List>
|
|
@@ -661,16 +976,16 @@ declare const Command: {
|
|
|
661
976
|
*/
|
|
662
977
|
readonly Group: typeof CommandGroup;
|
|
663
978
|
/**
|
|
664
|
-
*
|
|
979
|
+
* One selectable row in the palette's list.
|
|
665
980
|
*
|
|
666
981
|
* @see https://mantle.ngrok.com/components/navigation/command#commanditem
|
|
667
982
|
*
|
|
668
983
|
* @example
|
|
669
984
|
* ```tsx
|
|
670
|
-
* <Command.DialogRoot
|
|
671
|
-
* <Command.
|
|
672
|
-
* <
|
|
673
|
-
* </Command.
|
|
985
|
+
* <Command.DialogRoot>
|
|
986
|
+
* <Command.SearchTrigger>
|
|
987
|
+
* <button type="button">Search…</button>
|
|
988
|
+
* </Command.SearchTrigger>
|
|
674
989
|
* <Command.DialogContent>
|
|
675
990
|
* <Command.Input placeholder="Type a command or search..." />
|
|
676
991
|
* <Command.List>
|
|
@@ -694,16 +1009,16 @@ declare const Command: {
|
|
|
694
1009
|
*/
|
|
695
1010
|
readonly Item: typeof CommandItem;
|
|
696
1011
|
/**
|
|
697
|
-
* The
|
|
1012
|
+
* The keyboard hint for a `Command.Item`, aligned to the end of the row.
|
|
698
1013
|
*
|
|
699
1014
|
* @see https://mantle.ngrok.com/components/navigation/command#commandshortcut
|
|
700
1015
|
*
|
|
701
1016
|
* @example
|
|
702
1017
|
* ```tsx
|
|
703
|
-
* <Command.DialogRoot
|
|
704
|
-
* <Command.
|
|
705
|
-
* <
|
|
706
|
-
* </Command.
|
|
1018
|
+
* <Command.DialogRoot>
|
|
1019
|
+
* <Command.SearchTrigger>
|
|
1020
|
+
* <button type="button">Search…</button>
|
|
1021
|
+
* </Command.SearchTrigger>
|
|
707
1022
|
* <Command.DialogContent>
|
|
708
1023
|
* <Command.Input placeholder="Type a command or search..." />
|
|
709
1024
|
* <Command.List>
|
|
@@ -727,16 +1042,16 @@ declare const Command: {
|
|
|
727
1042
|
*/
|
|
728
1043
|
readonly Shortcut: typeof CommandShortcut;
|
|
729
1044
|
/**
|
|
730
|
-
*
|
|
1045
|
+
* A horizontal rule between two groups of items.
|
|
731
1046
|
*
|
|
732
1047
|
* @see https://mantle.ngrok.com/components/navigation/command#commandseparator
|
|
733
1048
|
*
|
|
734
1049
|
* @example
|
|
735
1050
|
* ```tsx
|
|
736
|
-
* <Command.DialogRoot
|
|
737
|
-
* <Command.
|
|
738
|
-
* <
|
|
739
|
-
* </Command.
|
|
1051
|
+
* <Command.DialogRoot>
|
|
1052
|
+
* <Command.SearchTrigger>
|
|
1053
|
+
* <button type="button">Search…</button>
|
|
1054
|
+
* </Command.SearchTrigger>
|
|
740
1055
|
* <Command.DialogContent>
|
|
741
1056
|
* <Command.Input placeholder="Type a command or search..." />
|
|
742
1057
|
* <Command.List>
|
|
@@ -761,13 +1076,106 @@ declare const Command: {
|
|
|
761
1076
|
readonly Separator: typeof CommandSeparator;
|
|
762
1077
|
};
|
|
763
1078
|
//#endregion
|
|
1079
|
+
//#region src/components/command/dialog-context.d.ts
|
|
1080
|
+
/**
|
|
1081
|
+
* The state and actions every part under a `Command.DialogRoot` shares,
|
|
1082
|
+
* returned by {@link useCommandDialog}. Use it to open the palette from
|
|
1083
|
+
* anywhere in the app, to build a custom search trigger, or to read the query
|
|
1084
|
+
* a `shouldFilter={false}` palette needs to do its own matching.
|
|
1085
|
+
*
|
|
1086
|
+
* @see https://mantle.ngrok.com/components/navigation/command#usecommanddialog
|
|
1087
|
+
*
|
|
1088
|
+
* @example
|
|
1089
|
+
* ```tsx
|
|
1090
|
+
* function EmptyStateSearchLink() {
|
|
1091
|
+
* const { openWithQuery } = useCommandDialog();
|
|
1092
|
+
* return (
|
|
1093
|
+
* <button type="button" onClick={() => openWithQuery("endpoints")}>
|
|
1094
|
+
* Search endpoints
|
|
1095
|
+
* </button>
|
|
1096
|
+
* );
|
|
1097
|
+
* }
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
type CommandDialogState = {
|
|
1101
|
+
/**
|
|
1102
|
+
* Whether the palette is open. Mirrored as `data-state="open" | "closed"` on
|
|
1103
|
+
* `Command.SearchTrigger` and paired with its `aria-expanded`.
|
|
1104
|
+
*/
|
|
1105
|
+
open: boolean;
|
|
1106
|
+
/**
|
|
1107
|
+
* Set the open state. **Opening through this resets the query to empty** —
|
|
1108
|
+
* use {@link CommandDialogState.openWithQuery} to open with text in the
|
|
1109
|
+
* field. Calls `onOpenChange` and, when uncontrolled, updates the internal
|
|
1110
|
+
* state.
|
|
1111
|
+
*/
|
|
1112
|
+
setOpen: (open: boolean) => void;
|
|
1113
|
+
/**
|
|
1114
|
+
* Open the palette with `query` already in `Command.Input`, or with an empty
|
|
1115
|
+
* query when called with no argument. This is what `Command.SearchTrigger`
|
|
1116
|
+
* calls when a keystroke or paste reaches it.
|
|
1117
|
+
*/
|
|
1118
|
+
openWithQuery: (query?: string) => void;
|
|
1119
|
+
/**
|
|
1120
|
+
* Toggle the palette. Opening resets the query to empty, closing leaves it
|
|
1121
|
+
* alone (the content animates out, so clearing it mid-animation would swap
|
|
1122
|
+
* the visible list). This is what the `⌘K` shortcut calls.
|
|
1123
|
+
*/
|
|
1124
|
+
toggle: () => void;
|
|
1125
|
+
/**
|
|
1126
|
+
* The current text of `Command.Input`. Read it to drive your own filtering
|
|
1127
|
+
* or a server-side search when the palette runs with `shouldFilter={false}`.
|
|
1128
|
+
*
|
|
1129
|
+
* Only meaningful while `Command.Input` is uncontrolled — passing it a
|
|
1130
|
+
* `value` takes ownership of the query, and this stops tracking the field.
|
|
1131
|
+
*/
|
|
1132
|
+
query: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Set the query without touching the open state. `Command.Input` calls this
|
|
1135
|
+
* as the user types.
|
|
1136
|
+
*/
|
|
1137
|
+
setQuery: (query: string) => void;
|
|
1138
|
+
/**
|
|
1139
|
+
* Whether this root owns the `⌘K` / `Ctrl+K` shortcut. `Command.SearchTrigger`
|
|
1140
|
+
* reads it to decide whether to stamp `aria-keyshortcuts`; read it yourself
|
|
1141
|
+
* in the trigger's child to gate its *visible* hint, so neither can advertise
|
|
1142
|
+
* a binding that is not there.
|
|
1143
|
+
*/
|
|
1144
|
+
keyboardShortcut: boolean;
|
|
1145
|
+
};
|
|
1146
|
+
/**
|
|
1147
|
+
* Read the nearest `Command.DialogRoot` state. Throws when called outside one
|
|
1148
|
+
* so misuse fails loudly rather than rendering a trigger that opens nothing.
|
|
1149
|
+
*
|
|
1150
|
+
* Reach for it to open the palette from somewhere other than its trigger — a
|
|
1151
|
+
* sidebar row, an empty state, a "no results, search everything" link — or to
|
|
1152
|
+
* build a custom trigger, pairing it with
|
|
1153
|
+
* [`searchActionFromKeyDown`](https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown)
|
|
1154
|
+
* so typing into your trigger behaves like typing into `Command.SearchTrigger`.
|
|
1155
|
+
*
|
|
1156
|
+
* @see https://mantle.ngrok.com/components/navigation/command#usecommanddialog
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```tsx
|
|
1160
|
+
* function SearchEverythingItem({ query }: { query: string }) {
|
|
1161
|
+
* const { openWithQuery } = useCommandDialog();
|
|
1162
|
+
* return (
|
|
1163
|
+
* <Command.Item onSelect={() => openWithQuery(query)}>
|
|
1164
|
+
* Search everything for “{query}”
|
|
1165
|
+
* </Command.Item>
|
|
1166
|
+
* );
|
|
1167
|
+
* }
|
|
1168
|
+
* ```
|
|
1169
|
+
*/
|
|
1170
|
+
declare function useCommandDialog(): CommandDialogState;
|
|
1171
|
+
//#endregion
|
|
764
1172
|
//#region src/components/command/meta-key.d.ts
|
|
765
1173
|
type Props = Omit<ComponentProps<"kbd">, "children">;
|
|
766
1174
|
/**
|
|
767
1175
|
* Renders the platform-appropriate meta key kbd (⌘ or ⌃).
|
|
768
1176
|
*
|
|
769
1177
|
* - Initializes to `"⌃"` to avoid SSR mismatch.
|
|
770
|
-
* - Updates on mount
|
|
1178
|
+
* - Updates on mount, once {@link useIsApplePlatform} has resolved the host.
|
|
771
1179
|
*
|
|
772
1180
|
* @see https://mantle.ngrok.com/components/navigation/command#metakey
|
|
773
1181
|
*
|
|
@@ -780,4 +1188,158 @@ type Props = Omit<ComponentProps<"kbd">, "children">;
|
|
|
780
1188
|
*/
|
|
781
1189
|
declare function MetaKey({ className, ...props }: Props): import("react").JSX.Element;
|
|
782
1190
|
//#endregion
|
|
783
|
-
|
|
1191
|
+
//#region src/components/command/search-action.d.ts
|
|
1192
|
+
/**
|
|
1193
|
+
* What a keystroke or paste on a search trigger should do to the command
|
|
1194
|
+
* palette. A search trigger looks like a text field but is a `<button>` — it
|
|
1195
|
+
* has no editable value — so every input event it receives has to be
|
|
1196
|
+
* classified before it can mean anything.
|
|
1197
|
+
*
|
|
1198
|
+
* Three outcomes, because "type into the trigger" has three honest answers:
|
|
1199
|
+
*
|
|
1200
|
+
* - `"seed"` — the event carried text. Open the palette with `query` already
|
|
1201
|
+
* in `Command.Input`.
|
|
1202
|
+
* - `"open"` — the event was text *intent* that cannot be replayed (an IME
|
|
1203
|
+
* composition belongs to the element that started it). Open the palette with
|
|
1204
|
+
* an empty query so the next keystroke has a real text field to land in.
|
|
1205
|
+
* - `"ignore"` — the event was navigation, a modifier chord, or the button's
|
|
1206
|
+
* own activation keys. Leave the palette alone.
|
|
1207
|
+
*
|
|
1208
|
+
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
1209
|
+
*
|
|
1210
|
+
* @example
|
|
1211
|
+
* ```tsx
|
|
1212
|
+
* const { openWithQuery } = useCommandDialog();
|
|
1213
|
+
*
|
|
1214
|
+
* const applyAction = (action: SearchAction) => {
|
|
1215
|
+
* switch (action.type) {
|
|
1216
|
+
* case "seed":
|
|
1217
|
+
* openWithQuery(action.query);
|
|
1218
|
+
* break;
|
|
1219
|
+
* case "open":
|
|
1220
|
+
* openWithQuery();
|
|
1221
|
+
* break;
|
|
1222
|
+
* case "ignore":
|
|
1223
|
+
* break;
|
|
1224
|
+
* }
|
|
1225
|
+
* };
|
|
1226
|
+
* ```
|
|
1227
|
+
*/
|
|
1228
|
+
type SearchAction = {
|
|
1229
|
+
type: "seed";
|
|
1230
|
+
/**
|
|
1231
|
+
* The text to open the palette with. A single character for a keystroke,
|
|
1232
|
+
* the pasted text (collapsed to one line) for a paste.
|
|
1233
|
+
*/
|
|
1234
|
+
query: string;
|
|
1235
|
+
} | {
|
|
1236
|
+
type: "open";
|
|
1237
|
+
} | {
|
|
1238
|
+
type: "ignore";
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* The properties {@link searchActionFromKeyDown} reads. Satisfied by a native
|
|
1242
|
+
* `KeyboardEvent` — pass `event.nativeEvent` from a React handler, since
|
|
1243
|
+
* React's synthetic keyboard event does not carry `isComposing`.
|
|
1244
|
+
*/
|
|
1245
|
+
type SearchKeyDownEvent = {
|
|
1246
|
+
altKey: boolean;
|
|
1247
|
+
ctrlKey: boolean;
|
|
1248
|
+
isComposing: boolean;
|
|
1249
|
+
key: string;
|
|
1250
|
+
/**
|
|
1251
|
+
* Optional so a hand-built test event can omit it.
|
|
1252
|
+
*
|
|
1253
|
+
* Why a deprecated property: `229` is the only reliable marker for the
|
|
1254
|
+
* keydown that *starts* an IME composition, where `isComposing` is still
|
|
1255
|
+
* `false` and `key` varies by engine. There is no non-deprecated
|
|
1256
|
+
* replacement — cmdk reads it for the same reason.
|
|
1257
|
+
*/
|
|
1258
|
+
keyCode?: number;
|
|
1259
|
+
metaKey: boolean;
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* The properties {@link searchActionFromPaste} reads. Satisfied by both a
|
|
1263
|
+
* native `ClipboardEvent` and React's synthetic one.
|
|
1264
|
+
*/
|
|
1265
|
+
type SearchPasteEvent = {
|
|
1266
|
+
clipboardData: Pick<DataTransfer, "getData"> | null;
|
|
1267
|
+
};
|
|
1268
|
+
/**
|
|
1269
|
+
* Classifies a `keydown` on a search trigger. Pure, so the whole policy is
|
|
1270
|
+
* testable without a DOM: see the {@link SearchAction} cases for what each
|
|
1271
|
+
* outcome means.
|
|
1272
|
+
*
|
|
1273
|
+
* The policy, and why:
|
|
1274
|
+
*
|
|
1275
|
+
* - **IME composition → `"open"`.** A composition session is bound to the
|
|
1276
|
+
* element that started it and cannot be forwarded, so seeding is impossible;
|
|
1277
|
+
* opening empty at least lands the user in a real text field instead of
|
|
1278
|
+
* swallowing the keystroke. This is the case the blog's original trigger got
|
|
1279
|
+
* wrong — it silently did nothing for CJK input. Engines that route dead keys
|
|
1280
|
+
* through the IME path report them the same way (Chrome on macOS sends
|
|
1281
|
+
* `key: "Dead"` with `keyCode: 229` for `⌥e`), so those open empty too rather
|
|
1282
|
+
* than falling through to the named-key case below.
|
|
1283
|
+
* - **Any of `⌘` / `Ctrl` / `Alt` held → `"ignore"`.** Those are shortcuts, not
|
|
1284
|
+
* text: the palette's own `⌘K`, `⌘V` (the paste path handles it), and the
|
|
1285
|
+
* browser/OS accelerators. `Alt` is excluded even though macOS `⌥` produces
|
|
1286
|
+
* real characters, because seeding one means calling `preventDefault()` on
|
|
1287
|
+
* Windows `Alt` accelerators (`Alt+D`, `Alt+Home`) — the worse trade.
|
|
1288
|
+
* `Shift` is not a modifier here; it is already reflected in `key`.
|
|
1289
|
+
* - **`Enter` / `Space` → `"ignore"`.** The button's own activation keys.
|
|
1290
|
+
* - **A single code point → `"seed"`.** Counted by spreading rather than
|
|
1291
|
+
* `.length`, so astral characters (emoji, less common CJK) count as one
|
|
1292
|
+
* instead of two and are not dropped. Every named key (`"Tab"`,
|
|
1293
|
+
* `"ArrowDown"`, `"Dead"`, `"Unidentified"`) is longer and falls through —
|
|
1294
|
+
* except when the engine also flags it as IME processing, which the case
|
|
1295
|
+
* above claims first.
|
|
1296
|
+
*
|
|
1297
|
+
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfromkeydown
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
* ```tsx
|
|
1301
|
+
* <button
|
|
1302
|
+
* type="button"
|
|
1303
|
+
* onKeyDown={(event) => {
|
|
1304
|
+
* const action = searchActionFromKeyDown(event.nativeEvent);
|
|
1305
|
+
* if (action.type === "seed") {
|
|
1306
|
+
* event.preventDefault();
|
|
1307
|
+
* openWithQuery(action.query);
|
|
1308
|
+
* } else if (action.type === "open") {
|
|
1309
|
+
* openWithQuery();
|
|
1310
|
+
* }
|
|
1311
|
+
* }}
|
|
1312
|
+
* >
|
|
1313
|
+
* Search…
|
|
1314
|
+
* </button>
|
|
1315
|
+
* ```
|
|
1316
|
+
*/
|
|
1317
|
+
declare function searchActionFromKeyDown(event: SearchKeyDownEvent): SearchAction;
|
|
1318
|
+
/**
|
|
1319
|
+
* Classifies a `paste` on a search trigger. A paste is unambiguous search
|
|
1320
|
+
* intent — the user pasted into a control that looks like a text field — so it
|
|
1321
|
+
* always opens the palette, and seeds it whenever the clipboard holds text.
|
|
1322
|
+
* Never returns `"ignore"`.
|
|
1323
|
+
*
|
|
1324
|
+
* The text is collapsed to a single space-separated line because the palette's
|
|
1325
|
+
* query is a one-line field: pasting a multi-line selection should search for
|
|
1326
|
+
* its words, not embed newlines that no item can match.
|
|
1327
|
+
*
|
|
1328
|
+
* @see https://mantle.ngrok.com/components/navigation/command#searchactionfrompaste
|
|
1329
|
+
*
|
|
1330
|
+
* @example
|
|
1331
|
+
* ```tsx
|
|
1332
|
+
* <button
|
|
1333
|
+
* type="button"
|
|
1334
|
+
* onPaste={(event) => {
|
|
1335
|
+
* const action = searchActionFromPaste(event.nativeEvent);
|
|
1336
|
+
* openWithQuery(action.type === "seed" ? action.query : undefined);
|
|
1337
|
+
* }}
|
|
1338
|
+
* >
|
|
1339
|
+
* Search…
|
|
1340
|
+
* </button>
|
|
1341
|
+
* ```
|
|
1342
|
+
*/
|
|
1343
|
+
declare function searchActionFromPaste(event: SearchPasteEvent): SearchAction;
|
|
1344
|
+
//#endregion
|
|
1345
|
+
export { Command, type CommandDialogRootProps, type CommandDialogState, type CommandSearchTriggerProps, MetaKey, type SearchAction, type SearchKeyDownEvent, type SearchPasteEvent, searchActionFromKeyDown, searchActionFromPaste, useCommandDialog, useCommandState };
|