import { Option, Options, PropsOf } from '@codeleap/types'; import { GetKeyboardAwarePropsOptions, StylesOf } from '../../types/utility'; import { Icon } from '../Icon'; import { FlatListProps } from '../List'; import { Text } from '../Text'; import { SearchInputProps } from '../SearchInput'; import { Touchable } from '../Touchable'; import { EmptyPlaceholderProps } from '../EmptyPlaceholder'; import { AppIcon, StyledProp } from '@codeleap/styles'; import { AutocompleteComposition } from './styles'; export type AutocompleteRenderFNProps = { style?: StylesOf; onPress: () => void; isSelected?: boolean; item: Option; touchableProps?: Partial>; textProps?: Partial>; iconProps?: Partial>; }; export type AutocompleteRenderFN = (props: AutocompleteRenderFNProps) => React.ReactElement; export type AutocompleteValue = Multi extends true ? T[] : T; /** * `value` and `onValueChange` are required (no uncontrolled mode); the component never owns * selection state internally. `loadOptions` receives the raw search string — debounce (800 ms) * is applied by the component, but rate-limiting beyond that is the caller's responsibility. */ export type ValueBoundAutocompleteProps = { options?: Options; defaultOptions?: Options; loadOptions?: (search: string) => Promise>; value: AutocompleteValue; renderItem?: AutocompleteRenderFN>; onValueChange: (value: AutocompleteValue) => void; filterItems?: (search: string, items: Options) => Options; onLoadOptionsError?: (error: any) => void; multiple?: Multi; getLabel?: (forOption: Multi extends true ? Options : Options[number]) => string; onItemPressed?: (item: Options[number]) => any; }; export type ReplaceAutocompleteProps = Omit> & ValueBoundAutocompleteProps; export type AutocompleteProps = Omit, 'renderItem' | 'style'> & ValueBoundAutocompleteProps & { placeholder?: string; label?: string; closeOnSelect?: boolean; style?: StyledProp; keyboardAware?: GetKeyboardAwarePropsOptions; multiple?: Multi; itemProps?: Partial, 'iconProps' | 'textProps' | 'touchableProps'>>; searchable?: boolean; limit?: number; selectedIcon?: AppIcon; loadOptionsOnMount?: boolean; loadOptionsOnOpen?: boolean; selectable?: boolean; searchInputProps?: Partial; debugName: string; searchComponent?: React.ComponentType; listPlaceholder?: Partial; listProps?: Partial, 'renderItem' | 'style'>>; loading: boolean | ((isLoading: boolean) => boolean); }; //# sourceMappingURL=types.d.ts.map