@placekit/autocomplete-react
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -1,2 +0,2 @@ | ||
/*! @placekit/autocomplete-react v1.5.1 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-react#readme */ | ||
/*! @placekit/autocomplete-react v1.6.0 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-react#readme */ | ||
'use strict'; | ||
@@ -185,2 +185,13 @@ | ||
}, [client, onClient]); | ||
// toggle geolocation | ||
const toggleGeolocation = React.useCallback(() => { | ||
if (client) { | ||
if (client.state.geolocation) { | ||
client.clearGeolocation(); | ||
} else { | ||
client.requestGeolocation(); | ||
} | ||
} | ||
}, [client]); | ||
return /*#__PURE__*/React.createElement("div", { | ||
@@ -190,7 +201,7 @@ className: ['pka-input', className].filter(c => c).join(' ') | ||
type: "button", | ||
className: ['pka-input-geolocation', state.geolocation ? 'pka-enabled' : ''].filter(c => c).join(' '), | ||
className: ['pka-input-geolocation', state.geolocation ? 'pka-enabled' : ''].join(' ').trim(), | ||
title: "Activate geolocation", | ||
role: "switch", | ||
"aria-checked": state.geolocation, | ||
onClick: client?.requestGeolocation, | ||
onClick: toggleGeolocation, | ||
disabled: inputProps.disabled | ||
@@ -197,0 +208,0 @@ }, /*#__PURE__*/React.createElement("span", { |
@@ -1,2 +0,2 @@ | ||
/*! @placekit/autocomplete-react v1.5.1 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-react#readme */ | ||
/*! @placekit/autocomplete-react v1.6.0 | © placekit.io | MIT license | https://github.com/placekit/autocomplete-react#readme */ | ||
import type { PKAClient, PKAHandlers, PKAOptions, PKAState } from '@placekit/autocomplete-js'; | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "@placekit/autocomplete-react", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"author": "PlaceKit <support@placekit.io>", | ||
@@ -43,5 +43,5 @@ "description": "PlaceKit Autocomplete React library", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-commonjs": "^25.0.1", | ||
"@rollup/plugin-commonjs": "^25.0.2", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"eslint": "^8.42.0", | ||
"eslint": "^8.43.0", | ||
"eslint-config-google": "^0.14.0", | ||
@@ -55,4 +55,4 @@ "eslint-plugin-react": "^7.32.2", | ||
"dependencies": { | ||
"@placekit/autocomplete-js": "^1.5.0", | ||
"@types/react": "^18.2.12", | ||
"@placekit/autocomplete-js": "^1.6.0", | ||
"@types/react": "^18.2.13", | ||
"prop-types": "^15.8.1" | ||
@@ -59,0 +59,0 @@ }, |
Sorry, the diff of this file is not supported yet
26962
530
Updated@types/react@^18.2.13