import { ReactElement, ReactNode, RefObject } from 'react'; import { DataHandlers } from '../../dataProvider/DataContext'; import { Tooltip, TooltipProps } from '../../tooltip/Tooltip'; import { ModularOptionListProps, ModularOptionListData, Option, OptionInProps, GroupInProps, ModularOptionListMetaData, TextKey as ModularOptionListTextKey, TextsWithNumberedVariations as ModularOptionListTextsWithNumberedVariations, ModularOptionListCustomTheme, KnownElementType as ModularOptionListKnownElementType, SupportedLanguage } from '../modularOptionList/types'; export type SearchResult = Pick; export type SearchFunction = (searchValue: string, selectedOptions: Option[], data: ModularOptionListData) => Promise; export type { Option, OptionInProps, Group, GroupInProps, ScreenReaderNotification } from '../modularOptionList/types'; export type SearchProps

| undefined> = { children?: P | P[]; clearable?: boolean; disabled?: boolean; groups?: Array | ModularOptionListData['groups']; icon?: ReactNode; id?: string; invalid?: boolean; onBlur?: () => void; onClose?: (selectedOptions: Option[], clickedOption: undefined, data: ModularOptionListData) => Partial> | void; onChange?: (selectedOptions: Option[], clickedOption: Option, data: ModularOptionListData) => Partial> | void; onFocus?: () => void; onSearch?: SearchFunction; open?: boolean; options?: (OptionInProps | string)[]; required?: boolean; texts?: Partial | TextProvider; theme?: SearchCustomTheme; tooltip?: ReactElement; value?: string | string[] | Option[] | OptionInProps[]; virtualize?: boolean; visibleOptions?: number; placeholder?: string; }; export type SearchData = ModularOptionListData & Required> & { initialOpenValue?: boolean; onSearch?: SearchFunction; onClose?: SearchProps['onClose']; placeholder?: string; }; export type SearchMetaData = Pick & ModularOptionListMetaData & { refs: ModularOptionListMetaData['refs'] & { searchInput: RefObject void; }>; listContainer: RefObject; searchContainer: RefObject; container: RefObject; }; elementIds: ModularOptionListMetaData['elementIds'] & { searchInput: string; label: string; searchInputLabel: string; container: string; searchContainer: string; clearButton: string; assistiveText: string; historyInfo: string; }; textProvider: TextProvider; search: string; isSearching: boolean; hasSearchError: boolean; hasSearchInput: boolean; cancelCurrentSearch: (() => void) | undefined; focusTarget: Extract | undefined; themes?: Record; tooltip?: ReactElement; }; export type SearchDataHandlers = DataHandlers; export type KnownElementType = ModularOptionListKnownElementType | keyof SearchMetaData['elementIds']; export type TextKey = ModularOptionListTextKey | 'clearButtonAriaLabel_multiple' | 'clearButtonAriaLabel_one' | 'placeholder' | 'searchClearButtonAriaLabel' | 'searchedWithoutResultsInfo' | 'searchErrorText' | 'searchErrorTitle' | 'searching' | 'searchLabel' | 'searchPlaceholder' | 'searchButtonAriaLabel' | 'searchWithAnotherTerm' | 'searchResults_multiple' | 'searchResults_one' | 'historyInfo' | 'historyLabel' | 'selectedOptionAnnouncement'; export type TextsWithNumberedVariations = ModularOptionListTextsWithNumberedVariations | 'clearButtonAriaLabel' | 'searchResults' | 'selectedOptionAnnouncement'; export type TextInterpolationKeys = 'selectionCount' | 'value' | 'numberIndicator' | 'label'; export type TextInterpolationContent = Record; export type TextProvider = (key: TextKey, contents: TextInterpolationContent) => string; export type Texts = Record & { language?: SupportedLanguage; }; export type ThemeTarget = 'root' | 'checkbox' | 'textInput' | 'clearButton'; export type SearchCustomTheme = ModularOptionListCustomTheme & { '--search-background-default'?: string; '--search-background-disabled'?: string; '--search-border-color-default'?: string; '--search-border-color-hover'?: string; '--search-border-color-hover-invalid'?: string; '--search-border-color-focus'?: string; '--search-border-color-invalid'?: string; '--search-color-default'?: string; '--search-color-disabled'?: string; '--search-icon-color'?: string; '--placeholder-color'?: string; '--clear-button-background-color'?: string; '--clear-button-background-color-focus'?: string; '--clear-button-background-color-hover'?: string; '--clear-button-background-color-active'?: string; '--clear-button-background-color-disabled'?: string; '--clear-button-border-color'?: string; '--clear-button-border-color-focus'?: string; '--clear-button-border-color-hover'?: string; '--clear-button-border-color-active'?: string; '--clear-button-border-color-disabled'?: string; '--clear-button-color'?: string; '--clear-button-color-hover'?: string; '--clear-button-color-focus'?: string; '--clear-button-color-active'?: string; '--clear-button-color-disabled'?: string; '--clear-button-outline-color-focus'?: string; '--text-input-background-default'?: string; '--text-input-border-color-default'?: string; '--text-input-border-color-hover'?: string; '--text-input-border-color-focus'?: string; '--text-input-color-default'?: string; '--text-color-focus-outline'?: string; '--text-input-placeholder-color'?: string; '--text-label-color-default'?: string; };