@placekit/autocomplete-js
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -1,2 +0,2 @@ | ||
/*! @placekit/autocomplete-js v1.2.2 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
/*! @placekit/autocomplete-js v1.3.0 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
import type { PKOptions, PKResult } from '@placekit/client-js'; | ||
@@ -60,3 +60,4 @@ | ||
flip?: boolean; | ||
countryAutoFill?: boolean; | ||
className?: string; | ||
}; |
{ | ||
"name": "@placekit/autocomplete-js", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"author": "PlaceKit <support@placekit.io>", | ||
@@ -5,0 +5,0 @@ "description": "PlaceKit Autocomplete JavaScript library", |
@@ -49,4 +49,4 @@ <h1 align="center"> | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.2.1/dist/placekit-autocomplete.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.2.1"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.2.2/dist/placekit-autocomplete.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.2.2"></script> | ||
``` | ||
@@ -166,8 +166,9 @@ | ||
| `flip` | AutoComplete | `boolean` | `false` | Flip position top when overflowing. | | ||
| [`countryAutoFill`](#countryautofill-option) | Autocomplete | `boolean?` | `false` | Autofill current country by IP when `types: ['country']`. | | ||
| `className` | AutoComplete | `string` | `undefined` | Additional suggestions panel CSS class(es). | | ||
| `maxResults` | JS client | `integer` | `5` | Number of results per page. | | ||
| `language` | `string?` | `undefined` | Preferred language for the results<sup>[(1)](#ft1)</sup>, [two-letter ISO](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code. Supported languages are `en` and `fr`. Defaults to the country's language. | | ||
| `language` | JS client | `string?` | `undefined` | Preferred language for the results<sup>[(1)](#ft1)</sup>, [two-letter ISO](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code. Supported languages are `en` and `fr`. Defaults to the country's language. | | ||
| `types` | JS client | `string[]?` | `undefined` | Type of results to show. Array of accepted values: `street`, `city`, `country`, `airport`, `bus`, `train`, `townhall`, `tourism`. Prepend `-` to omit a type like `['-bus']`. Unset to return all. | | ||
| [`countries`](#%EF%B8%8F-countries-option-is-required) | `string[]?` | `undefined` | Countries to search in, or fallback to if `countryByIP` is `true`. Array of [two-letter ISO](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes<sup>[(1)](#ft1)</sup>. | | ||
| [`countryByIP`](#countryByIP-option) | `boolean?` | `undefined` | Use IP to find user's country (turned off). | | ||
| [`countries`](#%EF%B8%8F-countries-option-is-required) | JS client | `string[]?` | `undefined` | Countries to search in, or fallback to if `countryByIP` is `true`. Array of [two-letter ISO](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes<sup>[(1)](#ft1)</sup>. | | ||
| [`countryByIP`](#countryByIP-option) | JS client | `boolean?` | `undefined` | Use IP to find user's country (turned off). | | ||
| `coordinates` | JS client | `string?` | `undefined` | Coordinates to search around. Automatically set when calling [`pka.requestGeolocation()`](#pkarequestGeolocation). | | ||
@@ -197,2 +198,19 @@ | ||
#### `countryAutoFill` option | ||
When making a country-only autocomplete field, this option enhances the experience by automatically filling the input detected with the user's IP. | ||
It works only when `types` option is set **only** with the `conutry` value: | ||
```js | ||
const pka = placekitAutocomplete('<your-api-key>', { | ||
target: '#placekit', | ||
types: ['country'], | ||
countryAutoFill: true, | ||
}); | ||
``` | ||
⚠️ **It makes an automatic call to the PlaceKit API and therefore counts as billable usage.** | ||
See our [country field example](./example/autocomplete-js-country). | ||
### `pka.configure()` | ||
@@ -199,0 +217,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
273064
6781
454