0.0.6 • Published 5 years ago

@crpt/react-dadata v0.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

react-dadata

Collection of components for input any data using hints from dadata.ru service. Contains:

  • HintedEmailInput - hinted input for emails
  • HintedAddressInput - hinted input for address

Install

npm i --save @crpt/react-dadata

HintedEmailInput

Usage

import { HintedEmailInput } from "@crpt/react-dadata"; 
...
<HintedEmailInput
  apiKey={value}
  apiURL={value}
  defaultText="textInInputField"
/>
PropNameDescriptionExample
apiKey: stringApi key of hints service.
apiURL: stringIP address of hints service.
defaultText: stringText will showed in the input field
onUpdate: functionCalling with updated text.

Additional properties you can get from @crpt/react-select. values property is ignored

HintedAddressInput

Usage

import { HintedAddresslInput } from "@crpt/react-dadata"; 
...
<HintedAddressInput
  apiKey={value}
  apiURL={value}
  defaultText="textInInputField"
  querty="City, street"
/>
PropNameDescriptionExample
apiKey: stringApi key of hints service.
apiURL: stringIP address of hints service.
defaultText: stringText will showed in the input field
type: stringsee note1.
query: objectsee note2.
onUpdate: functionCalling with object: {type: {note1} value: 'smth', fias: 'smth'}

Note 1. Type can be one of:

  • ADDRESS_HINT_REQUESTER_POSTAL_CODE
  • ADDRESS_HINT_REQUESTER_REGION_CODE
  • ADDRESS_HINT_REQUESTER_AREA
  • ADDRESS_HINT_REQUESTER_CITY
  • ADDRESS_HINT_REQUESTER_SETTLEMENT
  • ADDRESS_HINT_REQUESTER_STREET
  • ADDRESS_HINT_REQUESTER_HOUSE
  • ADDRESS_HINT_REQUESTER_BLOCK
  • ADDRESS_HINT_REQUESTER_FULL

Note 2. Query object is:

PropNameType
fullAddressstring
postalCodestring
regionCodestring
areastring
citystring
settlementstring
streetstring
housestring
blockstring

Additional properties you can get from @crpt/react-select. values property is ignored