Skip to content

Commit 43d673e

Browse files
committed
chore(release): 1.3.0
1 parent 22d7923 commit 43d673e

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "geosuggest",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"description": "A React autosuggest for the Google Maps Places API.",
55
"main": "dist/geosuggest.min.js",
66
"homepage": "https://github.com/ubilabs/react-geosuggest",

dist/react-geosuggest.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Geosuggest=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
22
(function (global){
3+
/* global google */
4+
35
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null),
4-
GeosuggestItem = require('./GeosuggestItem.jsx');
6+
GeosuggestItem = require('./GeosuggestItem.jsx'); // eslint-disable-line
57

68
var Geosuggest = React.createClass({displayName: "Geosuggest",
79
/**
@@ -14,7 +16,8 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
1416
placeholder: 'Search places',
1517
onSuggestSelect: function() {},
1618
location: null,
17-
radius: 0
19+
radius: 0,
20+
googleMaps: google && google.maps
1821
};
1922
},
2023

@@ -28,8 +31,9 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
2831
userInput: '',
2932
activeSuggest: null,
3033
suggests: [],
31-
geocoder: new google.maps.Geocoder(),
32-
autocompleteService: new google.maps.places.AutocompleteService()
34+
geocoder: new this.props.googleMaps.Geocoder(),
35+
autocompleteService: new this.props.googleMaps.places
36+
.AutocompleteService()
3337
};
3438
},
3539

@@ -51,7 +55,7 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
5155

5256
this.state.autocompleteService.getPlacePredictions({
5357
input: userInput,
54-
location: this.props.location || new google.maps.LatLng(0, 0),
58+
location: this.props.location || new this.props.googleMaps.LatLng(0, 0),
5559
radius: this.props.radius
5660
}, function(suggestsGoogle) {
5761
this.updateSuggests(suggestsGoogle);
@@ -68,41 +72,38 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
6872
}
6973

7074
var suggests = [],
71-
regex = new RegExp(this.state.userInput, 'gim'),
72-
suggestItems;
75+
regex = new RegExp(this.state.userInput, 'gim');
7376

7477
this.props.fixtures.forEach(function(suggest) {
7578
if (suggest.label.match(regex)) {
7679
suggest.placeId = suggest.label;
7780
suggests.push(suggest);
7881
}
79-
}.bind(this));
82+
});
8083

8184
suggestsGoogle.forEach(function(suggest) {
8285
suggests.push({
8386
label: suggest.description,
8487
placeId: suggest.place_id
8588
});
86-
}.bind(this));
89+
});
8790

8891
this.setState({suggests: suggests});
8992
},
9093

9194
/**
9295
* When the input gets focused
93-
* @param {Event} event The focus event
9496
*/
95-
showSuggests: function(event) {
97+
showSuggests: function() {
9698
this.updateSuggests();
9799

98100
this.setState({isSuggestsHidden: false});
99101
},
100102

101103
/**
102104
* When the input loses focused
103-
* @param {Event} event The focus event
104105
*/
105-
hideSuggests: function(event) {
106+
hideSuggests: function() {
106107
setTimeout(function() {
107108
this.setState({isSuggestsHidden: true});
108109
}.bind(this), 100);
@@ -131,6 +132,8 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
131132
case 27: // ESC
132133
this.hideSuggests();
133134
break;
135+
default:
136+
break;
134137
}
135138
},
136139

@@ -140,7 +143,7 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
140143
*/
141144
activateSuggest: function(direction) {
142145
var suggestsCount = this.state.suggests.length - 1,
143-
next = direction === ('next'),
146+
next = direction === 'next',
144147
newActiveSuggest = null,
145148
newIndex = 0,
146149
i = 0;
@@ -194,7 +197,7 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
194197
this.state.geocoder.geocode(
195198
{address: suggest.label},
196199
function(results, status) {
197-
if (status !== google.maps.GeocoderStatus.OK) {
200+
if (status !== this.props.googleMaps.GeocoderStatus.OK) {
198201
return;
199202
}
200203

@@ -214,9 +217,10 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
214217

215218
/**
216219
* Render the view
220+
* @return {Function} The React element to render
217221
*/
218222
render: function() {
219-
return (
223+
return (// eslint-disable-line no-extra-parens
220224
React.createElement("div", {className: "geosuggest", onClick: this.onClick},
221225
React.createElement("input", {
222226
className: "geosuggest__input",
@@ -241,10 +245,10 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
241245
*/
242246
getSuggestItems: function() {
243247
return this.state.suggests.map(function(suggest) {
244-
var isActive = (this.state.activeSuggest &&
245-
suggest.placeId === this.state.activeSuggest.placeId);
248+
var isActive = this.state.activeSuggest &&
249+
suggest.placeId === this.state.activeSuggest.placeId;
246250

247-
return (
251+
return (// eslint-disable-line no-extra-parens
248252
React.createElement(GeosuggestItem, {
249253
key: suggest.placeId,
250254
suggest: suggest,
@@ -259,7 +263,7 @@ var Geosuggest = React.createClass({displayName: "Geosuggest",
259263
* @return {String} The classes
260264
*/
261265
getSuggestsClasses: function() {
262-
var classes = 'geosuggest__suggests'
266+
var classes = 'geosuggest__suggests';
263267

264268
classes += this.state.isSuggestsHidden ?
265269
' geosuggest__suggests--hidden' : '';
@@ -302,9 +306,10 @@ var GeosuggestItem = React.createClass({displayName: "GeosuggestItem",
302306

303307
/**
304308
* Render the view
309+
* @return {Function} The React element to render
305310
*/
306311
render: function() {
307-
return (
312+
return (// eslint-disable-line no-extra-parens
308313
React.createElement("li", {className: this.getSuggestClasses(),
309314
onClick: this.onClick},
310315
this.props.suggest.label

dist/react-geosuggest.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-geosuggest",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"description": "A React autosuggest for the Google Maps Places API.",
55
"main": "dist/react-geosuggest.js",
66
"author": "Robert Katzki <[email protected]>",

0 commit comments

Comments
 (0)