UNPKG

react-loqate

Version:

This is a React implementation of the loqate APIs. It features an input, typing in which will result in a list of address options. Clicking an option will trigger your callback with that option.

105 lines (102 loc) 2.37 kB
import { ComponentType } from 'react'; interface Props { locale: string; apiKey: string; countries?: string[]; limit?: number; onSelect: (address: Address) => void; components?: Components; className?: string; classes?: { input?: string; list?: string; listItem?: string; }; inline?: boolean; debounce?: number; apiUrl?: string; bias?: boolean; origin?: string; disableBrowserAutocomplete?: boolean; } interface Components { Input?: ComponentType; List?: ComponentType; ListItem?: ComponentType<{ suggestion: Item; }>; } interface Address { AdminAreaCode: string; AdminAreaName: string; Barcode: string; Block: string; BuildingName: string; BuildingNumber: string; City: string; Company: string; CountryIso2: string; CountryIso3: string; CountryIsoNumber: number; CountryName: string; DataLevel: string; Department: string; District: string; DomesticId: string; Field1: string; Field2: string; Field3: string; Field4: string; Field5: string; Field6: string; Field7: string; Field8: string; Field9: string; Field10: string; Field11: string; Field12: string; Field13: string; Field14: string; Field15: string; Field16: string; Field17: string; Field18: string; Field19: string; Field20: string; Id: string; Label: string; Language: string; LanguageAlternatives: string; Line1: string; Line2: string; Line3: string; Line4: string; Line5: string; Neighbourhood: string; POBoxNumber: string; PostalCode: string; Province: string; ProvinceCode: string; ProvinceName: string; SecondaryStreet: string; SortingNumber1: string; SortingNumber2: string; Street: string; SubBuilding: string; Type: string; } interface Item { Id: string; Description: string; Type: 'Address' | 'Postcode' | 'Residential' | 'Street'; Text: string; Highlight: string; } interface LoqateErrorItem { Error: string; Description: string; Cause: string; Resolution: string; } declare function AddressSearch(props: Props): JSX.Element; export { type Address, type Item, type LoqateErrorItem, type Props, AddressSearch as default };