import React from 'react'; import { type ShortcutKeyLabels } from './shortcut.js'; export interface CommandPaletteItem { /** Passed to `onAction`. Unique within the palette. */ id: string; /** What the row says — a verb first: "Create agent", "Go to Runs". */ label: string; /** A second line. Searchable. */ description?: string; /** * The heading this command is listed under. Sections appear in the order * their first command does; commands without one come first, unheaded. */ section?: string; /** Leading icon. Decorative — the label names the command. */ icon?: React.ReactNode; /** * The command's own shortcut, shown as a hint: `mod+shift+n`. Shown, NOT * bound — the palette does not listen for it. Bind it where the command * lives, or the hint promises a key that does nothing. */ shortcut?: string; /** Other words that should find it: "delete" for "Remove agent". */ keywords?: readonly string[]; /** Listed but not runnable, and skipped by the arrow keys. */ isDisabled?: boolean; } export interface CommandPaletteProps { /** Every command. Filtering happens here, against what is typed. */ commands: readonly CommandPaletteItem[]; /** * Runs the chosen command. Called AFTER the palette has closed and handed * focus back, so an action that moves focus — to a search field, into a * form — keeps it. */ onAction: (id: string) => void; isOpen?: boolean; defaultOpen?: boolean; onOpenChange?: (isOpen: boolean) => void; /** * The shortcut that opens it from anywhere on the page, and closes it again. * Defaults to `mod+k` — ⌘K on a Mac, Ctrl+K elsewhere. `null` turns it off, * for a page that opens the palette some other way. */ openShortcut?: string | null; /** Names the dialog and the search field. */ label?: string; placeholder?: string; /** Shown in place of the list when nothing matches. */ emptyLabel?: React.ReactNode; /** Every other string the palette renders, for translation. English by default. */ labels?: CommandPaletteLabels; className?: string; } export interface CommandPaletteLabels { /** * Announced as the query narrows the list — "3 commands". Receives the count * as a number so a translation can choose its plural form. */ results?: (count: number) => string; /** The footer hints, each after its key: "to move", "to run", "to close". */ move?: string; run?: string; close?: string; /** What the keys in the hints and beside each command are printed and read as. See Kbd's `keyLabels`. */ keys?: ShortcutKeyLabels; } /** * CommandPalette — every action in the product, one search away. * * ⌘K (Ctrl+K elsewhere) opens it from anywhere; typing filters; Enter runs. * Mount it once, near the root, and hand it every command the product has. * * WHY NOT A MODAL WITH A COMBOBOX IN IT * * A Combobox's list is a popover that opens and closes on its own rules, and * it SELECTS a value that stays selected. A palette's list is always open and * each row is RUN, once, and the palette goes away. The ARIA shape is the same * — a combobox driving a listbox through `aria-activedescendant` — so this * uses it, without the parts of Combobox that exist for choosing a value. * * NOT A NAVIGATION MENU * * Everything in the palette must also be reachable without it. It is a faster * route for people who know what they want, and a shortcut nobody told you * about is not a route at all. */ export declare function CommandPalette({ commands, onAction, isOpen, defaultOpen, onOpenChange, openShortcut, label, placeholder, emptyLabel, labels, className, }: CommandPaletteProps): React.JSX.Element | null; export declare namespace CommandPalette { var displayName: string; } //# sourceMappingURL=CommandPalette.d.ts.map