import { type HTMLAttributes, type ReactNode } from 'react';
import { type VariantProps } from 'class-variance-authority';
declare const launcherVariants: (props?: ({
size?: "sm" | "md" | "lg" | null | undefined;
density?: "default" | "compact" | null | undefined;
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
export interface SearchBarResultItem {
id: string;
/** Display label. */
label: string;
/** Optional icon rendered on inline-start (aria-hidden). */
icon?: ReactNode;
/** Optional right-aligned meta text (tag, count, section label). */
meta?: string;
/** Optional href — the list renders anchors when present. */
href?: string;
}
export interface SearchBarResultGroup {
/** Heading displayed above the items (aria-hidden="true" — visual only). */
heading?: string;
items: SearchBarResultItem[];
}
type SharedProps = {
size?: 'sm' | 'md' | 'lg';
density?: 'default' | 'compact';
/** `true` wraps in when this is the page's primary search. */
topLevel?: boolean;
placeholder?: string;
/** Platform-aware shortcut pill — default `true` (hidden below `md` breakpoint). */
shortcutHint?: boolean;
className?: string;
/**
* Consumer-supplied instance id, surfaced as `data-component-id` so an
* agent / UI bridge can address this instance.
*/
id?: string;
/**
* Called when an external driver (agent adapter) asks the host to apply
* a saved search by id. The host is responsible for resolving the saved
* search and feeding the resulting query back through `value` /
* `onQueryChange`. No-op when not provided.
*/
onApplySavedSearch?: (id: string) => void;
};
/**
* Imperative handle for agent-readiness + programmatic control. Replaces
* the previously-forwarded `HTMLDivElement` ref. Consumers who needed the
* DOM element for layout queries should wrap the SearchBar in their own
* div with a ref attached.
*/
export interface SearchBarHandle {
getQuery: () => string;
setQuery: (query: string) => void;
clear: () => void;
submit: () => void;
focus: () => void;
applySavedSearch: (id: string) => void;
}
type LauncherProps = SharedProps & {
mode?: 'launcher';
/** Called on click / Enter / global Cmd/Ctrl+K. */
onOpenCommandPalette: () => void;
value?: never;
defaultValue?: never;
onQueryChange?: never;
results?: never;
onSelect?: never;
debounceMs?: never;
};
type InlineProps = SharedProps & {
mode: 'inline';
value?: string;
defaultValue?: string;
onQueryChange?: (query: string) => void;
/** Groups of results rendered in the popover. */
results?: SearchBarResultGroup[];
onSelect?: (item: SearchBarResultItem) => void;
debounceMs?: number;
onOpenCommandPalette?: never;
};
export type SearchBarProps = (LauncherProps | InlineProps) & Omit, 'role' | 'onChange' | 'onSelect' | 'children' | 'defaultValue' | 'results'> & VariantProps;
export declare function filterSearchResults(query: string, groups: SearchBarResultGroup[]): SearchBarResultGroup[];
export declare const SearchBar: import("react").ForwardRefExoticComponent>;
export {};
//# sourceMappingURL=search-bar.d.ts.map