import type { TextMatchRange } from "@charcuterie/logic"; import type { ControlSize } from "@charcuterie/tokens"; import type { ReactNode } from "react"; import type { CommandPaletteItem } from "./commandPaletteSections.ts"; export type CommandPaletteOptionProps = { /** The DOM id `aria-activedescendant` points at. */ id: string; isActive: boolean; item: CommandPaletteItem; itemSize: ControlSize; /** A click on the row: the link has navigated (or will), so close and run `onSelect`. */ onChoose: () => void; /** The pointer moved over the row. */ onPoint: () => void; titleRanges: readonly TextMatchRange[]; }; /** * One row of the palette's listbox. * * **Focus never comes here.** The input keeps it, and the row the * arrows have reached is announced through the input's * `aria-activedescendant` — the APG combobox pattern `Combobox` uses * too. So the row is `tabIndex={-1}`, and a mouse press is prevented * from moving focus (`onMouseDown`), which keeps the caret in the * input while the click still lands. * * **An `href` item is a real ``.** It goes through * `UnstyledLink`, so an app's injected router link handles a plain * click, and middle-click, ctrl-click and "copy link address" all * work, because it is a link. Enter in the input clicks this same * element, so the keyboard and the mouse take one path. An item * without one is a `