@placekit/autocomplete-js
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -1,2 +0,2 @@ | ||
/*! @placekit/autocomplete-js v1.4.2 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
/*! @placekit/autocomplete-js v1.5.0 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-js#readme */ | ||
import type { PKOptions, PKResult } from '@placekit/client-js'; | ||
@@ -36,2 +36,3 @@ | ||
clear(): PKAClient; | ||
setValue(value?: string | null, notify?: boolean): PKAClient; | ||
destroy(): void; | ||
@@ -38,0 +39,0 @@ } |
{ | ||
"name": "@placekit/autocomplete-js", | ||
"version": "1.4.2", | ||
"version": "1.5.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.4.1/dist/placekit-autocomplete.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.4.1"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.4.2/dist/placekit-autocomplete.min.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/@placekit/autocomplete-js@1.4.2"></script> | ||
``` | ||
@@ -121,2 +121,3 @@ | ||
- [`pka.clear()`](#pkaclear) | ||
- [`pka.setValue()`](#pkasetvalue) | ||
- [`pka.destroy()`](#pkadestroy) | ||
@@ -406,2 +407,18 @@ | ||
### `pka.setValue()` | ||
Manually set the input value. Useful for third-party wrappers like React. | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| `value` | `string | null` (optional) | New input value, operation ignored if `undefined` or `null`. | | ||
| `notify` | `boolean` (optional) | Pass `true` to dispatch `change` and `input` events and update state (default `false`). | | ||
```js | ||
pka.setValue('new value'); | ||
pka.setValue('new value', true); // dispatch `change` and `input` event | ||
``` | ||
**NOTE**: `state.empty` will automatically be updated based on the input value if `notify: true`. `state.dirty` and `state.freeForm` remain unchanged until the user focuses the input. | ||
### `pka.destroy()` | ||
@@ -408,0 +425,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
277693
6903
470