import * as React from 'react'; import type { SxProps } from '../styled'; import type { CommandPaletteClasses } from './command-palette-classes'; export type CommandPaletteFilterFn = (value: string, search: string, keywords?: string[]) => number; export interface ICommandPaletteCommonProps { /** Analytics identifier rendered as `data-analytics-id` */ analyticsId?: string; /** Slot class overrides */ classes?: Partial; /** Style overrides */ sx?: SxProps; } export interface ICommandPaletteState { search: string; selectedValue: string; filtered: { count: number; items: Map; groups: Map; }; } export interface ICommandPaletteStore { subscribe(callback: () => void): () => void; snapshot(): ICommandPaletteState; setState(key: K, value: ICommandPaletteState[K], opts?: boolean): void; emit(): void; } export interface ICommandPaletteContextValue { value(id: string, value: string, keywords?: string[]): void; item(id: string, groupId?: string): () => void; group(id: string): () => void; filter: false | CommandPaletteFilterFn; label: string; listId: string; inputId: string; listInnerRef: React.RefObject; } export interface ICommandPaletteProps extends Omit, 'onSelect'>, ICommandPaletteCommonProps { /** Accessible label for the command palette */ label?: string; /** Controlled search value */ search?: string; /** Callback when search value changes */ onSearchChange?(search: string): void; /** Controlled selected value */ value?: string; /** Callback when selected item changes via keyboard navigation */ onValueChange?(value: string): void; /** Custom filter function. Return score 0 to hide, >0 to show. Set to false to disable filtering. */ filter?: false | CommandPaletteFilterFn; /** Whether built-in filtering is enabled */ shouldFilter?: boolean; /** Whether to loop keyboard navigation */ loop?: boolean; /** Callback when an item is selected via keyboard (Enter) */ onSelect?(value: string): void; children?: React.ReactNode; } export interface ICommandPaletteInputProps extends Omit, 'value' | 'type'>, ICommandPaletteCommonProps { /** Icon to show before the input */ icon?: React.ReactNode; /** Callback when value changes */ onValueChange?(search: string): void; } export interface ICommandPaletteListProps extends React.HTMLAttributes, ICommandPaletteCommonProps { children?: React.ReactNode; } export interface ICommandPaletteGroupProps extends React.HTMLAttributes, ICommandPaletteCommonProps { /** Heading text for the group */ heading?: React.ReactNode; /** Force render even when all items are filtered out */ forceMount?: boolean; /** Stable value used to identify the group in filtering state */ value?: string; children?: React.ReactNode; } export interface ICommandPaletteItemProps extends Omit, 'onSelect'>, ICommandPaletteCommonProps { /** Unique value for the item (auto-derived from textContent if not provided) */ value?: string; /** Additional keywords for filtering */ keywords?: string[]; /** Whether the item is disabled */ disabled?: boolean; /** Callback when the item is selected */ onSelect?(value: string): void; /** Force render even when filtered out */ forceMount?: boolean; /** Icon to display before the label */ icon?: React.ReactNode; /** Keyboard shortcut to display */ shortcut?: string | string[]; children?: React.ReactNode; } export interface ICommandPaletteTabsProps extends React.HTMLAttributes, ICommandPaletteCommonProps { children?: React.ReactNode; } export interface ICommandPaletteTabProps extends React.ButtonHTMLAttributes, ICommandPaletteCommonProps { /** Whether this tab is currently active */ active?: boolean; /** Callback when tab is clicked */ onSelect?(): void; children?: React.ReactNode; } export interface ICommandPaletteSeparatorProps extends React.HTMLAttributes, ICommandPaletteCommonProps { /** Render even when search is active */ alwaysRender?: boolean; } export interface ICommandPaletteEmptyProps extends React.HTMLAttributes, ICommandPaletteCommonProps { children?: React.ReactNode; } export interface ICommandPaletteLoadingProps extends React.HTMLAttributes, ICommandPaletteCommonProps { /** Progress percentage (0-100) */ progress?: number; children?: React.ReactNode; } export interface ICommandPaletteDialogProps extends ICommandPaletteProps { /** Whether the dialog is open */ open?: boolean; /** Callback when the dialog should close */ onOpenChange?(open: boolean): void; /** Props to pass to the dialog overlay */ overlayProps?: React.HTMLAttributes; /** Props to pass to the dialog content wrapper */ contentProps?: React.HTMLAttributes; } export interface ICommandPaletteFooterProps extends React.HTMLAttributes, ICommandPaletteCommonProps { children?: React.ReactNode; } export interface ICommandPaletteShortcutKeyProps extends React.HTMLAttributes, ICommandPaletteCommonProps { children?: React.ReactNode; }