import { AppIcon, ICSS, StyledProp } from '@codeleap/styles' import { PlacesAutocompleteComposition } from './styles' import { TextInputProps } from '../TextInput' import { FlatListProps } from '../List' import { EmptyPlaceholderProps } from '../EmptyPlaceholder' import { ActivityIndicatorProps } from '../ActivityIndicator' import { PlaceAddress, PlaceLatLng } from '@codeleap/types' export type CustomData = { item?: Partial & Partial content?: React.ReactElement } export type PlaceItem = PlaceAddress & PlaceLatLng & { content?: React.ReactElement } export type PlaceRowProps = { item?: PlaceItem styles?: Record onPress?: PlacesAutocompleteProps['onPress'] } /** * The `data` prop must be driven externally — this component owns no Places API calls. * Wire `onValueChange` to your debounced Places autocomplete query and pass the results back * as `data`; the 250 ms internal debounce on `usePlacesAutocompleteUtils` adds a second layer * of protection against excessive API requests when `textInputProps.value` is not controlled. */ export type PlacesAutocompleteProps = { style?: StyledProp itemRow?: (props: any) => React.ReactElement textInputProps?: TextInputProps emptyPlaceholderProps?: EmptyPlaceholderProps listProps?: FlatListProps data: PlaceAddress[] | PlaceLatLng[] customData?: CustomData[] onPress?: (address: string, place: PlaceItem) => void onValueChange?: (address: string) => void showClearIcon?: boolean showEmptyPlaceholder?: boolean clearIcon?: AppIcon placeRowComponent?: React.ComponentType renderPlaceRow?: (props: PlaceRowProps) => React.ReactElement placeRow?: React.ReactElement debounce?: number activityIndicatorProps?: ActivityIndicatorProps persistResultsOnBlur?: boolean isLoading?: boolean }