@ubilabs/react-geosuggest
Advanced tools
Comparing version 2.15.1 to 2.16.0
@@ -0,1 +1,4 @@ | ||
## 2.16.0 (2023-08-08) | ||
### 2.15.1 (2023-08-07) | ||
@@ -2,0 +5,0 @@ |
{ | ||
"name": "@ubilabs/react-geosuggest", | ||
"version": "2.15.1", | ||
"version": "2.16.0", | ||
"description": "A React autosuggest for the Google Maps Places API.", | ||
"main": "module/Geosuggest.umd.js", | ||
"module": "module/Geosuggest.esm.js", | ||
"types": "module/Geosuggest.d.ts", | ||
"homepage": "https://github.com/ubilabs/react-geosuggest", | ||
@@ -47,2 +48,3 @@ "license": "MIT", | ||
"eslint-config-prettier": "^8.10.0", | ||
"eslint-plugin-codegen": "^0.17.0", | ||
"eslint-plugin-react": "^7.33.1", | ||
@@ -55,2 +57,4 @@ "gh-pages": "^5.0.0", | ||
"nodecat": "^2.0.0", | ||
"nodemon": "^3.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
@@ -61,2 +65,4 @@ "prettier": "^3.0.1", | ||
"rollup": "^3.27.1", | ||
"rollup-plugin-delete": "^2.0.0", | ||
"rollup-plugin-dts": "^5.3.1", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
@@ -74,3 +80,5 @@ "rollup-plugin-typescript2": "^0.35.0", | ||
"posttest": "nyc report --reporter=text --reporter=lcov --reporter=html", | ||
"start": "npm run server", | ||
"barrel": "eslint --fix src/index.ts && prettier --config ./.prettierrc.yml --write src/index.ts", | ||
"barrel:watch": "nodemon --delay 1 -e ts,tsx --watch src -x 'npm run barrel --silent || exit 1'", | ||
"start": "run-p barrel:watch server", | ||
"unit-test": "mocha --exit --require ts-node/register --require ./test/test_helper.ts \"test/**/*@(.ts|.tsx)\"", | ||
@@ -84,3 +92,3 @@ "server": "npm run prepare:example && npm run js:example && light-server -s example/dist -p 8000 -w 'src/*.tsx,src/*.ts,example/src/*.tsx,example/src/*.ts # npm run js:example' -w 'src/*.css,example/src/*.css # npm run css # reloadcss' -w 'example/src/*.html # npm run copy:assets # reload'", | ||
"js:prettier:fix": "prettier --config ./.prettierrc.yml --ignore-path ./.prettierignore --write \"**/**.{ts,tsx}\"", | ||
"build:module": "rimraf module && cross-env NODE_ENV=production rollup -c rollup.module.config.mjs && copyfiles -f src/geosuggest.css module/", | ||
"build:module": "rimraf module && npm run barrel && cross-env NODE_ENV=production rollup -c rollup.module.config.mjs && copyfiles -f src/geosuggest.css module/", | ||
"build:browser": "rimraf dist && rollup -c rollup.browser.config.mjs && cross-env NODE_ENV=production rollup -c rollup.browser.config.mjs", | ||
@@ -87,0 +95,0 @@ "build:example": "npm run prepare:example && cross-env NODE_ENV=production rollup -c rollup.example.config.mjs", |
@@ -5,3 +5,2 @@ # React Geosuggest | ||
## Demo | ||
@@ -11,3 +10,2 @@ | ||
## Installation | ||
@@ -18,4 +16,4 @@ | ||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
@@ -38,3 +36,3 @@ … | ||
```sh | ||
npm install react-geosuggest --save | ||
npm install @ubilabs/react-geosuggest --save | ||
``` | ||
@@ -49,5 +47,5 @@ | ||
```js | ||
import Geosuggest from 'react-geosuggest'; | ||
import Geosuggest from '@ubilabs/react-geosuggest'; | ||
<Geosuggest /> | ||
<Geosuggest />; | ||
``` | ||
@@ -58,5 +56,5 @@ | ||
```js | ||
var Geosuggest = require('react-geosuggest').default; | ||
var Geosuggest = require('@ubilabs/react-geosuggest').default; | ||
<Geosuggest /> | ||
<Geosuggest />; | ||
``` | ||
@@ -67,2 +65,3 @@ | ||
#### placeholder | ||
Type: `String` | ||
@@ -74,2 +73,3 @@ Default: `Search places` | ||
#### initialValue | ||
Type: `String` | ||
@@ -81,2 +81,3 @@ Default: `''` | ||
#### id | ||
Type: `String` | ||
@@ -88,2 +89,3 @@ Default: `''` | ||
#### className | ||
Type: `String` | ||
@@ -95,2 +97,3 @@ Default: `''` | ||
#### style | ||
Type: `Object` | ||
@@ -107,2 +110,3 @@ Default: `{ | ||
#### inputClassName | ||
Type: `String` | ||
@@ -114,2 +118,3 @@ Default: `''` | ||
#### disabled | ||
Type: `Boolean` | ||
@@ -121,2 +126,3 @@ Default: `false` | ||
#### location | ||
Type: [`google.maps.LatLng`](https://developers.google.com/maps/documentation/javascript/reference#LatLng) | ||
@@ -128,2 +134,3 @@ Default: `null` | ||
#### radius | ||
Type: `Number` | ||
@@ -135,2 +142,3 @@ Default: `0` | ||
#### bounds | ||
Type: [`LatLngBounds`](https://developers.google.com/maps/documentation/javascript/reference?csw=1#LatLngBounds) | ||
@@ -142,2 +150,3 @@ Default: `null` | ||
#### country | ||
Type: `String` or `Array` | ||
@@ -149,2 +158,3 @@ Default: `null` | ||
#### types | ||
Type: `Array` | ||
@@ -156,2 +166,3 @@ Default: `null` | ||
#### fixtures | ||
Type: `Array` | ||
@@ -165,2 +176,3 @@ Default: `[]` | ||
#### maxFixtures | ||
Type: `Number` | ||
@@ -172,2 +184,3 @@ Default: `10` | ||
#### placeDetailFields | ||
Type: `Array` | ||
@@ -179,2 +192,3 @@ Default: `null` | ||
#### googleMaps | ||
Type: `Object` | ||
@@ -186,2 +200,3 @@ Default: `google.maps` | ||
#### ignoreTab | ||
Type: `Boolean` | ||
@@ -193,2 +208,3 @@ Default: `false` | ||
#### ignoreEnter | ||
Type: `Boolean` | ||
@@ -200,2 +216,3 @@ Default: `false` | ||
#### queryDelay | ||
Type: `Number` | ||
@@ -208,2 +225,3 @@ Default: `250` | ||
#### minLength | ||
Type: `Number` | ||
@@ -215,2 +233,3 @@ Default: `1` | ||
#### highlightMatch | ||
Type: `Boolean` | ||
@@ -222,2 +241,3 @@ Default: `true` | ||
#### onFocus | ||
Type: `Function` | ||
@@ -229,2 +249,3 @@ Default: `function() {}` | ||
#### onBlur | ||
Type: `Function` | ||
@@ -236,2 +257,3 @@ Default: `function(value) {}` | ||
#### onChange | ||
Type: `Function` | ||
@@ -243,2 +265,3 @@ Default: `function(value) {}` | ||
#### onKeyDown | ||
Type: `Function` | ||
@@ -250,2 +273,3 @@ Default: `function(event) {}` | ||
#### onKeyPress | ||
Type: `Function` | ||
@@ -257,2 +281,3 @@ Default: `function(event) {}` | ||
#### onSuggestSelect | ||
Type: `Function` | ||
@@ -263,14 +288,16 @@ Default: `function(suggest) {}` | ||
* `label` – Type `String` – The label name | ||
* `placeId` – Type `String` – If it is a preset, equals the `label`. Else it is the Google Maps `placeID` | ||
* `location` – Type `Object` – The location containing `lat` and `lng` | ||
* `gmaps` – Type `Object` – *Optional!* The complete response when there was a Google Maps geocode necessary (e.g. no location provided for presets). [Check the Google Maps Reference](https://developers.google.com/maps/documentation/javascript/reference#GeocoderResult) for more information on it’s structure. | ||
- `label` – Type `String` – The label name | ||
- `placeId` – Type `String` – If it is a preset, equals the `label`. Else it is the Google Maps `placeID` | ||
- `location` – Type `Object` – The location containing `lat` and `lng` | ||
- `gmaps` – Type `Object` – *Optional!* The complete response when there was a Google Maps geocode necessary (e.g. no location provided for presets). [Check the Google Maps Reference](https://developers.google.com/maps/documentation/javascript/reference#GeocoderResult) for more information on it’s structure. | ||
#### onUpdateSuggests | ||
Type: `Function` | ||
Default: `function(suggests, activeSuggest) {}` | ||
Gets triggered when the suggest list changes. Arguments include the suggest list and the current activeSuggest. Useful if you want to render the list of suggests outside of react-geosuggest. | ||
Gets triggered when the suggest list changes. Arguments include the suggest list and the current activeSuggest. Useful if you want to render the list of suggests outside of @ubilabs/react-geosuggest. | ||
#### onActivateSuggest | ||
Type: `Function` | ||
@@ -281,6 +308,7 @@ Default: `function(suggest) {}` | ||
* `label` – Type `String` – The label name | ||
* `placeId` – Type `String` – If it is a preset, equals the `label`. Else it is the Google Maps `placeID` | ||
- `label` – Type `String` – The label name | ||
- `placeId` – Type `String` – If it is a preset, equals the `label`. Else it is the Google Maps `placeID` | ||
#### onSuggestNoResults | ||
Type: `Function` | ||
@@ -292,2 +320,3 @@ Default: `function(userInput) {}` | ||
#### getSuggestLabel | ||
Type: `Function` | ||
@@ -299,2 +328,3 @@ Default: `function(suggest) { return suggest.description; }` | ||
#### renderSuggestItem | ||
Type: `Function` | ||
@@ -306,2 +336,3 @@ Default: `null` | ||
#### skipSuggest | ||
Type: `Function` | ||
@@ -313,2 +344,3 @@ Default: `function(suggest) {}` | ||
#### autoActivateFirstSuggest | ||
Type: `Boolean` | ||
@@ -320,2 +352,3 @@ Default: `false` | ||
#### label | ||
Type: `String` | ||
@@ -327,2 +360,3 @@ Default: `null` | ||
#### suggestsClassName | ||
Type: `String` | ||
@@ -334,2 +368,3 @@ Default: `''` | ||
#### suggestsHiddenClassName | ||
Type: `String` | ||
@@ -341,2 +376,3 @@ Default: `null` | ||
#### suggestItemClassName | ||
Type: `String` | ||
@@ -348,2 +384,3 @@ Default: `''` | ||
#### suggestItemActiveClassName | ||
Type: `String`, | ||
@@ -355,2 +392,3 @@ Default: `null` | ||
#### autoComplete | ||
Type: `String`, | ||
@@ -362,2 +400,3 @@ Default: `off` | ||
#### inputType | ||
Type: `String`, | ||
@@ -375,19 +414,24 @@ Default: `text` | ||
### Exposed component functions | ||
### Exposed component functions | ||
These functions are accessible by setting "ref" on the component (see example below) | ||
#### focus() | ||
Call `focus` to focus on the element. The suggest list will be expanded with the current suggestions. | ||
#### blur() | ||
Call `blur` to blur (unfocus) the element. The suggest list will be closed. | ||
#### update(value) | ||
It is possible to update the value of the input contained within the GeoSuggest component by calling the `update` function with a new desired `value` of the type String. | ||
#### clear() | ||
It is also possible to clear the value of the input contained within the GeoSuggest component by calling the `clear` function. | ||
#### selectSuggest() | ||
Same effect as hitting `enter` (will geocode the text inside of the input). | ||
@@ -400,3 +444,3 @@ | ||
import ReactDOM from 'react-dom/client'; | ||
import Geosuggest from 'react-geosuggest'; | ||
import Geosuggest from '@ubilabs/react-geosuggest'; | ||
@@ -449,2 +493,3 @@ const App = () => { | ||
The `geosuggest__suggests--hidden` class is added to hide the suggestion list. You should copy the style below into your CSS file. | ||
```css | ||
@@ -457,5 +502,7 @@ .geosuggest__suggests--hidden { | ||
``` | ||
The above class is added whenever the suggestion list needs to be hidden. This occurs when the user selects an item from the list or when the user triggers the `blur` event on the input. | ||
Similarly, you need to have the class `geosuggest__item--active` similar to this: | ||
```css | ||
@@ -467,2 +514,3 @@ .geosuggest__item--active { | ||
``` | ||
to see what item is selected, f.ex. when using the arrow keys to navigate the suggestion list. | ||
@@ -469,0 +517,0 @@ |
Sorry, the diff of this file is not supported yet
204679
15
3782
475
44