@placekit/autocomplete-js
Advanced tools
Comparing version 1.0.0-alpha.9 to 1.0.0-alpha.10
@@ -1,2 +0,2 @@ | ||
/*! @placekit/autocomplete-js v1.0.0-alpha.9 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
/*! @placekit/autocomplete-js v1.0.0-alpha.10 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
import type { PKOptions, PKResult } from '@placekit/client-js'; | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "@placekit/autocomplete-js", | ||
"version": "1.0.0-alpha.9", | ||
"version": "1.0.0-alpha.10", | ||
"author": "PlaceKit <support@placekit.io>", | ||
@@ -16,3 +16,3 @@ "description": "PlaceKit Autocomplete JavaScript library", | ||
"types": "./dist/placekit-autocomplete.d.ts", | ||
"module": "./dist/placekit-autocomplete.esm.js", | ||
"module": "./dist/placekit-autocomplete.esm.mjs", | ||
"main": "./dist/placekit-autocomplete.cjs.js", | ||
@@ -24,3 +24,3 @@ "browser": "./dist/placekit-autocomplete.umd.js", | ||
"require": "./dist/placekit-autocomplete.cjs.js", | ||
"import": "./dist/placekit-autocomplete.esm.js" | ||
"import": "./dist/placekit-autocomplete.esm.mjs" | ||
}, | ||
@@ -44,7 +44,7 @@ "./dist/placekit-autocomplete.css": "./dist/placekit-autocomplete.css" | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.0", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"autoprefixer": "^10.4.13", | ||
"eslint": "^8.32.0", | ||
"eslint": "^8.33.0", | ||
"eslint-config-google": "^0.14.0", | ||
@@ -54,4 +54,4 @@ "npm-watch": "^0.11.0", | ||
"postcss-banner": "^4.0.1", | ||
"rimraf": "^4.0.7", | ||
"rollup": "^3.10.0", | ||
"rimraf": "^4.1.2", | ||
"rollup": "^3.15.0", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
@@ -62,5 +62,5 @@ "rollup-plugin-copy": "^3.4.0", | ||
"dependencies": { | ||
"@placekit/client-js": "^1.0.0-alpha.2", | ||
"@placekit/client-js": "^1.0.0-alpha.3", | ||
"@popperjs/core": "^2.11.6" | ||
} | ||
} |
@@ -6,3 +6,3 @@ <h1 align="center"> | ||
<p align="center"> | ||
<b>All-in-one autocomplete experience for your web apps</b> | ||
<b>All-in-one address autocomplete experience for your web apps</b> | ||
</p> | ||
@@ -22,3 +22,2 @@ | ||
<a href="#-customize">Customize</a> • | ||
<a href="https://placekit.io/developers">Documentation</a> • | ||
<a href="#%EF%B8%8F-license">License</a> | ||
@@ -50,3 +49,3 @@ </p> | ||
```html | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.0.0-alpha.6/dist/placekit-autocomplete.min.css" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.0.0-alpha.10/dist/placekit-autocomplete.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js"></script> | ||
@@ -61,3 +60,4 @@ ``` | ||
const pka = placekitAutocomplete('<your-api-key>', { | ||
inputSelector: '#placekit', | ||
target: '#placekit', | ||
countries: ['fr'], | ||
// other options... | ||
@@ -72,3 +72,3 @@ }); | ||
<script type="module"> | ||
import placekit from 'https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.0.0-alpha.6/dist/placekit-autocomplete.esm.js'; | ||
import placekit from 'https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.0.0-alpha.10/dist/placekit-autocomplete.esm.js'; | ||
const pka = placekitAutocomplete(/* ... */); | ||
@@ -98,4 +98,5 @@ // ... | ||
const pka = placekit('<your-api-key>', { | ||
const pka = placekitAutocomplete('<your-api-key>', { | ||
target: '#placekit', | ||
countries: ['fr'], | ||
// other options... | ||
@@ -133,3 +134,4 @@ }); | ||
const pka = placekitAutocomplete('<your-api-key>', { | ||
language: 'en', | ||
target: '#placekit', | ||
countries: ['fr'], | ||
maxResults: 10, | ||
@@ -172,5 +174,30 @@ }); | ||
| `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` | JS client | `string[]?` | `undefined` | Limit results to given countries. Array of two-letter ISO country codes. | | ||
| [`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 in the [supported list of countries](#supported-countries). | | ||
| [`countryByIP`](#countryByIP-option) | `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). | | ||
#### ⚠️ `countries` option is required | ||
The `countries` option is **required** at search time, but we like to keep it optional across all methods so developers remain free on when and how to define it: | ||
- either when instanciating with `placekit()`, | ||
- with `pk.configure()`, | ||
- or at search time with `pk.search()`. | ||
If `countries` is missing or invalid, you'll get a `422` error. | ||
#### Supported countries | ||
Supported countries are `be`, `ca`, `ch`, `de`, `es`, `fr`, `gb`, `it`, `nl`, `pt`, `us`. | ||
#### `countryByIP` option | ||
Set `countryByIP` to `true` when you don't know which country users will search addresses in. In that case, the option `countries` will be used as a fallback if the user's country is not supported: | ||
```js | ||
pka.configure({ | ||
countryByIP: true, // use user's country, based on their IP | ||
countries: ['fr', 'be'], // returning results from France and Belgium if user's country is not supported | ||
}); | ||
``` | ||
### `pka.configure()` | ||
@@ -177,0 +204,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 too big to display
257858
6404
414