import { type ElementType, type ReactElement, type ReactNode } from "react"; import type { NavTree } from "../../docs/types.js"; /** What {@link useDocsSearch} exposes to descendants: a function that opens the command palette. */ interface DocsSearchContextValue { /** Opens the ⌘K command palette. A no-op outside a {@link DocsSearchProvider}. */ open: () => void; } /** * Reads the docs search context: the `open` callback that raises the shared ⌘K command palette. * Any descendant of {@link DocsSearchProvider} (a `DocsNavbar` search button, your own button) can * call it. Outside a provider it returns a no-op `open`, so a stray button never throws. * * @returns the `{ open }` context value. */ export declare function useDocsSearch(): DocsSearchContextValue; /** * Props for {@link DocsSearchProvider}. */ export interface DocsSearchProviderProps { /** The navigation tree the palette fuzzy-searches (from `docs.getNavTree(lang)`). */ nav: NavTree; /** The render language, used to localize the built-in labels. */ lang?: string | undefined; /** Element used for the result links. Defaults to `"a"`; pass `next/link` for client-side nav. */ linkComponent?: ElementType; /** Placeholder / accessible label for the palette input. Defaults to the `lang` translation. */ searchPlaceholder?: string | undefined; /** Message shown when a query matches nothing. Defaults to the `lang` translation. */ searchEmptyLabel?: string | undefined; /** Optional override for how a page's `icon` name is rendered in a result. Defaults to the built-in set. */ renderIcon?: ((name: string | undefined) => ReactNode) | undefined; /** The docs app subtree. */ children: ReactNode; } /** * Owns the docs ⌘K command palette and shares one `open()` with the whole docs app via * {@link useDocsSearch}. Wrap your docs shell in it (above the navbar, tabs, sidebar, and content): * the global ⌘K / Ctrl-K shortcut and any search button ({@link import("./DocsNavbar.js").DocsNavbar}'s, * or your own) all raise the same palette, which fuzzy-searches every page (title, label, group, tab) * and renders exactly once here. * * A client component: it holds the open/query state, the keyboard shortcut, and the modal (a proper * dialog - it traps Tab, closes on Escape / backdrop, and returns focus to whatever opened it). It * receives the already-computed, serialisable `NavTree` from a server component. * * @param props - see {@link DocsSearchProviderProps}. * @returns the provider wrapping `children`, plus the palette when open. */ export declare function DocsSearchProvider({ nav, lang, linkComponent: Link, searchPlaceholder, searchEmptyLabel, renderIcon, children, }: DocsSearchProviderProps): ReactElement; export {};