import type { FunctionComponent, KeyboardEventHandler } from 'react'; import type { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types'; import type { FormControlProps } from '../FormControl'; import type { MenuItemProps } from '../Menu'; import type { LinkProps } from '../Link'; export type SearchResult = Pick; export type RecentSearch = Pick; export type SearchFilter = { /** A list of user selectable scopes to filter search with. */ filters: string[]; /** The default filter for uncontrolled use. */ defaultFilters?: string[]; currentFilters?: never; } | { /** A list of user selectable scopes to filter search with. */ filters: string[]; defaultFilters?: never; /** The current filter for controlled use. */ currentFilters?: string[]; } | { filters?: never; defaultFilters?: never; currentFilters?: never; }; export type SearchInputProps = NoChildrenProp & BaseProps & { placeholder?: FormControlProps['placeholder']; /** * Creates a controlled input and sets the value. Requires an onChange handler to update value. * value + onChange is the recommended method per React team. */ value?: FormControlProps['value']; /** Called when the SearchInput value changes. */ onSearchChange?: (value: string) => void; /** * Called when the SearchButton is clicked or when the Enter key is pressed while SearchInput is in focus. * NOTE: this does not trigger an actual form submit event. It simply represents an explicit action by the user to search as opposed to onSearchChange. */ onSearchSubmit?: (value: string) => void; /** Called when user changes scope filter. */ onFiltersChange?: (value: string[]) => void; /** Called when user presses a key. */ onKeyDown?: KeyboardEventHandler; /** A list of matching results presented in the input's dropdown menu. */ searchResults?: SearchResult[]; /** A list of recent searches presented in the input's dropdown menu. */ recentSearches?: RecentSearch[]; /** Places the menu into an indeterminate loading state. */ loading?: boolean; /** Prop passed to the advanced search page link. */ advancedSearchLink?: OmitStrict; /** Aria label for search input, used by screen readers. */ searchInputAriaLabel?: string; /** * Boolean for determining for whether the search results will render in a popover. * @default true */ resultsPopover?: boolean; } & SearchFilter; declare const SearchInput: FunctionComponent; export default SearchInput; //# sourceMappingURL=SearchInput.d.ts.map