From 5cda30bb0aa6efa37a3937cf0b50c9a3ed3af38f Mon Sep 17 00:00:00 2001 From: Robert Katzki Date: Fri, 19 Oct 2018 16:15:22 +0200 Subject: [PATCH] chore(release): version 2.9.0 --- CHANGELOG.md | 12 +++ dist/react-geosuggest.js | 202 +++++++++++++++++++++-------------- dist/react-geosuggest.min.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 139 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 504f37e8..ce24b5e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.9.0 (2018-10-19) + + +#### Bug Fixes + +* **geosuggest:** + * adapt solution to typescript ([68c8817a](https://github.com/ubilabs/react-geosuggest/commit/68c8817ad64524fcde73d8f64e52ee8e9d566f21)) + * merge new changes to the repo ([86067701](https://github.com/ubilabs/react-geosuggest/commit/8606770163f14048881049edcd78404ca0e06d47)) + * changed Geocoder to PlacesService ([36668554](https://github.com/ubilabs/react-geosuggest/commit/3666855443d5c92628993630cb678e343ae002c5)) + * add Places API sessionToken support (issue #394) ([3738916e](https://github.com/ubilabs/react-geosuggest/commit/3738916e71eb2379c06cc50db49801d6a30f9b6f)) + + ## 2.8.0 (2018-06-21) diff --git a/dist/react-geosuggest.js b/dist/react-geosuggest.js index 8aeb9d59..49bb6327 100644 --- a/dist/react-geosuggest.js +++ b/dist/react-geosuggest.js @@ -1857,6 +1857,11 @@ var Geosuggest = (function () { } }); + var React = /*#__PURE__*/Object.freeze({ + default: react, + __moduleExports: react + }); + var classnames = createCommonjsModule(function (module) { /*! Copyright (c) 2017 Jed Watson. @@ -2285,26 +2290,27 @@ var Geosuggest = (function () { var lodash_debounce = debounce; /* istanbul ignore next */ + /* tslint:disable:no-empty */ /** * Default values */ var defaults = { + autoActivateFirstSuggest: false, + disabled: false, fixtures: [], - maxFixtures: 10, + getSuggestLabel: function (suggest) { return suggest.description; }, + highlightMatch: true, + ignoreEnter: false, + ignoreTab: false, initialValue: '', + maxFixtures: 10, + minLength: 1, + onKeyDown: function () { }, + onKeyPress: function () { }, placeholder: 'Search places', - disabled: false, queryDelay: 250, - highlightMatch: true, - getSuggestLabel: function (suggest) { return suggest.description; }, skipSuggest: function () { return false; }, - onKeyDown: function () { }, - onKeyPress: function () { }, - style: {}, - autoActivateFirstSuggest: false, - ignoreTab: false, - ignoreEnter: false, - minLength: 1 + style: {} }; /** @@ -2399,6 +2405,7 @@ var Geosuggest = (function () { */ function default_1(props) { var _this = _super.call(this, props) || this; + /* tslint:enable:no-empty */ /** * The reference to the input element */ @@ -2479,28 +2486,30 @@ var Geosuggest = (function () { */ default_1.prototype.render = function () { var _this = this; - var attributes = filterInputAttributes(this.props), classes = classnames('geosuggest__input', this.props.className); - return (react.createElement("input", __assign({ className: classes, ref: function (i) { return (_this.input = i); }, type: "text" }, attributes, { value: this.props.value, style: this.props.style, onKeyDown: this.onInputKeyDown, onChange: this.onChange, onKeyPress: this.props.onKeyPress, onFocus: this.props.onFocus, onBlur: this.props.onBlur }))); + var attributes = filterInputAttributes(this.props); + var classes = classnames('geosuggest__input', this.props.className); + return (undefined("input", __assign({ className: classes, ref: function (i) { return (_this.input = i); }, type: "text" }, attributes, { value: this.props.value, style: this.props.style, onKeyDown: this.onInputKeyDown, onChange: this.onChange, onKeyPress: this.props.onKeyPress, onFocus: this.props.onFocus, onBlur: this.props.onBlur }))); }; + /* tslint:disable:no-empty */ /** * Default values for the properties */ default_1.defaultProps = { - value: '', - className: '', autoComplete: 'nope', + className: '', + onBlur: function () { }, onChange: function () { }, - onSelect: function () { }, + onEscape: function () { }, + onFocus: function () { }, onKeyDown: function () { }, onKeyPress: function () { }, onNext: function () { }, onPrev: function () { }, - onEscape: function () { }, - onFocus: function () { }, - onBlur: function () { } + onSelect: function () { }, + value: '' }; return default_1; - }(react.PureComponent)); + }(undefined)); /** * A single Geosuggest item in the list @@ -2523,7 +2532,7 @@ var Geosuggest = (function () { * Makes a text bold */ default_1.prototype.makeBold = function (element, key) { - return (react.createElement("b", { className: "geosuggest__item__matched-text", key: key }, element)); + return (undefined("b", { className: "geosuggest__item__matched-text", key: key }, element)); }; /** * Replace matched text with the same in bold @@ -2544,7 +2553,7 @@ var Geosuggest = (function () { if (end < suggest.label.length) { post = suggest.label.slice(end); } - return (react.createElement("span", null, + return (undefined("span", null, pre, boldPart, post)); @@ -2591,7 +2600,8 @@ var Geosuggest = (function () { default_1.prototype.render = function () { var _this = this; var _a; - var suggest = this.props.suggest, classes = classnames('geosuggest__item', this.props.className, this.props.suggestItemClassName, { 'geosuggest__item--active': this.props.isActive }, (_a = {}, + var suggest = this.props.suggest; + var classes = classnames('geosuggest__item', this.props.className, this.props.suggestItemClassName, { 'geosuggest__item--active': this.props.isActive }, (_a = {}, _a[this.props.activeClassName || ''] = this.props.activeClassName ? this.props.isActive : null, @@ -2603,10 +2613,10 @@ var Geosuggest = (function () { else if (this.props.isHighlightMatch) { content = this.formatMatchedText(this.props.userInput, suggest); } - return (react.createElement("li", { className: classes, ref: function (li) { return (_this.ref = li); }, style: this.props.style, onMouseDown: this.props.onMouseDown, onMouseOut: this.props.onMouseOut, onClick: this.onClick }, content)); + return (undefined("li", { className: classes, ref: function (li) { return (_this.ref = li); }, style: this.props.style, onMouseDown: this.props.onMouseDown, onMouseOut: this.props.onMouseOut, onClick: this.onClick }, content)); }; return default_1; - }(react.PureComponent)); + }(undefined)); /** * The list with suggestions. @@ -2644,14 +2654,14 @@ var Geosuggest = (function () { ? this.isHidden() : null, _a)); - return (react.createElement("ul", { className: classes, style: this.props.style }, this.props.suggests.map(function (suggest) { + return (undefined("ul", { className: classes, style: this.props.style }, this.props.suggests.map(function (suggest) { var isActive = _this.props.activeSuggest && suggest.placeId === _this.props.activeSuggest.placeId || false; - return (react.createElement(default_1$1, { key: suggest.placeId, className: suggest.className || '', userInput: _this.props.userInput, isHighlightMatch: _this.props.isHighlightMatch, suggest: suggest, style: _this.props.suggestItemStyle, suggestItemClassName: _this.props.suggestItemClassName, isActive: isActive, activeClassName: _this.props.suggestItemActiveClassName, onMouseDown: _this.props.onSuggestMouseDown, onMouseOut: _this.props.onSuggestMouseOut, onSelect: _this.props.onSuggestSelect, renderSuggestItem: _this.props.renderSuggestItem })); + return (undefined(default_1$1, { key: suggest.placeId, className: suggest.className || '', userInput: _this.props.userInput, isHighlightMatch: _this.props.isHighlightMatch, suggest: suggest, style: _this.props.suggestItemStyle, suggestItemClassName: _this.props.suggestItemClassName, isActive: isActive, activeClassName: _this.props.suggestItemActiveClassName, onMouseDown: _this.props.onSuggestMouseDown, onMouseOut: _this.props.onSuggestMouseOut, onSelect: _this.props.onSuggestSelect, renderSuggestItem: _this.props.renderSuggestItem })); }))); }; return default_1; - }(react.PureComponent)); + }(undefined)); /* global window */ // Escapes special characters in user input for regex @@ -2676,6 +2686,14 @@ var Geosuggest = (function () { * The autocomple service to get suggests */ _this.autocompleteService = null; + /** + * The places service to get place details + */ + _this.placesService = null; + /** + * The sessionToken service to use session based monetization + */ + _this.sessionToken = undefined; /** * The geocoder to get geocoded results */ @@ -2685,12 +2703,12 @@ var Geosuggest = (function () { */ _this.input = null; _this.state = { - isSuggestsHidden: true, - isLoading: false, - ignoreBlur: false, - userInput: props.initialValue || '', activeSuggest: null, - suggests: [] + ignoreBlur: false, + isLoading: false, + isSuggestsHidden: true, + suggests: [], + userInput: props.initialValue || '' }; _this.onInputChange = _this.onInputChange.bind(_this); _this.onAfterInputChange = _this.onAfterInputChange.bind(_this); @@ -2733,14 +2751,15 @@ var Geosuggest = (function () { /* istanbul ignore next */ if (!googleMaps) { if (console) { - console.error( - // eslint-disable-line no-console - 'Google map api was not found in the page.'); + // tslint:disable-next-line:no-console + console.error('Google maps API was not found in the page.'); } return; } this.googleMaps = googleMaps; this.autocompleteService = new googleMaps.places.AutocompleteService(); + this.placesService = new googleMaps.places.PlacesService(document.createElement('div')); + this.sessionToken = new googleMaps.places.AutocompleteSessionToken(); this.geocoder = new googleMaps.Geocoder(); }; /** @@ -2847,7 +2866,8 @@ var Geosuggest = (function () { return; } var options = { - input: this.state.userInput + input: this.state.userInput, + sessionToken: this.sessionToken }; var inputLength = this.state.userInput.length; var isShorterThanMinLength = this.props.minLength && inputLength < this.props.minLength; @@ -2855,6 +2875,7 @@ var Geosuggest = (function () { return; } var _a = this.props, location = _a.location, radius = _a.radius, bounds = _a.bounds, types = _a.types, country = _a.country; + /* tslint:disable:curly */ if (location) options.location = location; if (radius) @@ -2865,6 +2886,7 @@ var Geosuggest = (function () { options.types = types; if (country) options.componentRestrictions = { country: country }; + /* tslint:enable:curly */ this.setState({ isLoading: true }, function () { if (!_this.autocompleteService) { _this.setState({ isLoading: false }); @@ -2885,10 +2907,14 @@ var Geosuggest = (function () { /** * Update the suggests */ - default_1$$1.prototype.updateSuggests = function (suggestsGoogle, callback) { + default_1$$1.prototype.updateSuggests = function (suggestsGoogle, + // tslint:disable-next-line:no-empty + callback) { var _this = this; if (suggestsGoogle === void 0) { suggestsGoogle = []; } - if (callback === void 0) { callback = function () { }; } + if (callback === void 0) { + // tslint:disable-next-line:no-empty + callback = function () { }; } var suggests = []; var userInput = this.state.userInput; var _a = this.props, skipSuggest = _a.skipSuggest, maxFixtures = _a.maxFixtures, fixtures = _a.fixtures; @@ -2903,15 +2929,15 @@ var Geosuggest = (function () { if ((skipSuggest && !skipSuggest(fixture)) && fixture.label.match(regex)) { fixturesSearched++; suggests.push({ + className: fixture.className, + isFixture: true, label: fixture.label, location: fixture.location, - placeId: fixture.label, - isFixture: true, matchedSubstrings: { - offset: fixture.label.indexOf(userInput), - length: userInput.length + length: userInput.length, + offset: fixture.label.indexOf(userInput) }, - className: fixture.className + placeId: fixture.label }); } }); @@ -2920,10 +2946,10 @@ var Geosuggest = (function () { if (skipSuggest && !skipSuggest(suggest)) { suggests.push({ description: suggest.description, - label: _this.props.getSuggestLabel ? _this.props.getSuggestLabel(suggest) : '', - placeId: suggest.place_id, isFixture: false, - matchedSubstrings: suggest.matched_substrings[0] + label: _this.props.getSuggestLabel ? _this.props.getSuggestLabel(suggest) : '', + matchedSubstrings: suggest.matched_substrings[0], + placeId: suggest.place_id }); } }); @@ -2935,7 +2961,7 @@ var Geosuggest = (function () { }; /** * Return the new activeSuggest object after suggests have been updated - **/ + */ default_1$$1.prototype.updateActiveSuggest = function (suggests) { if (suggests === void 0) { suggests = []; } var activeSuggest = this.state.activeSuggest; @@ -2964,8 +2990,8 @@ var Geosuggest = (function () { } this.timer = window.setTimeout(function () { _this.setState({ - isSuggestsHidden: true, - activeSuggest: null + activeSuggest: null, + isSuggestsHidden: true }); }, 100); }; @@ -3003,9 +3029,9 @@ var Geosuggest = (function () { */ default_1$$1.prototype.selectSuggest = function (suggestToSelect) { var suggest = suggestToSelect || { + isFixture: false, label: this.state.userInput, - placeId: this.state.userInput, - isFixture: false + placeId: this.state.userInput }; this.setState({ isSuggestsHidden: true, @@ -3028,54 +3054,74 @@ var Geosuggest = (function () { if (!this.geocoder) { return; } - var options = {}; - if (suggestToGeocode.placeId && !suggestToGeocode.isFixture) { - options.placeId = suggestToGeocode.placeId; + if (suggestToGeocode.placeId && !suggestToGeocode.isFixture && this.placesService) { + var options = { + placeId: suggestToGeocode.placeId, + sessionToken: this.sessionToken + }; + this.placesService.getDetails(options, function (results, status) { + if (status === _this.googleMaps.places.PlacesServiceStatus.OK) { + var gmaps = results; + var location_1 = gmaps.geometry.location; + var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: { + lat: location_1.lat(), + lng: location_1.lng() + } }); + _this.sessionToken = new google.maps.places.AutocompleteSessionToken(); + if (_this.props.onSuggestSelect) { + _this.props.onSuggestSelect(suggest); + } + } + }); } else { - options = { + var options = { address: suggestToGeocode.label, - location: this.props.location, bounds: this.props.bounds, componentRestrictions: this.props.country ? { country: this.props.country } - : undefined + : undefined, + location: this.props.location }; - } - this.geocoder.geocode(options, function (results, status) { - if (status === _this.googleMaps.GeocoderStatus.OK) { - var gmaps = results[0]; - var location_1 = gmaps.geometry.location; - var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: { - lat: location_1.lat(), - lng: location_1.lng() - } }); - if (_this.props.onSuggestSelect) { - _this.props.onSuggestSelect(suggest); + this.geocoder.geocode(options, function (results, status) { + if (status === _this.googleMaps.GeocoderStatus.OK) { + var gmaps = results[0]; + var location_2 = gmaps.geometry.location; + var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: { + lat: location_2.lat(), + lng: location_2.lng() + } }); + if (_this.props.onSuggestSelect) { + _this.props.onSuggestSelect(suggest); + } } - } - }); + }); + } }; /** * Render the view */ default_1$$1.prototype.render = function () { var _this = this; - var attributes = filterInputAttributes(this.props), classes = classnames('geosuggest', this.props.className, { + var attributes = filterInputAttributes(this.props); + var classes = classnames('geosuggest', this.props.className, { 'geosuggest--loading': this.state.isLoading - }), shouldRenderLabel = this.props.label && attributes.id, input = (react.createElement(default_1, __assign({ className: this.props.inputClassName, ref: function (i) { return (_this.input = i); }, value: this.state.userInput, doNotSubmitOnEnter: !this.state.isSuggestsHidden, ignoreTab: this.props.ignoreTab, ignoreEnter: this.props.ignoreEnter, style: this.props.style && this.props.style.input, onChange: this.onInputChange, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onKeyDown: this.props.onKeyDown, onKeyPress: this.props.onKeyPress, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests }, attributes))), suggestionsList = (react.createElement(default_1$2, { isHidden: this.state.isSuggestsHidden, style: this.props.style && this.props.style.suggests, suggestItemStyle: this.props.style && this.props.style.suggestItem, userInput: this.state.userInput, isHighlightMatch: Boolean(this.props.highlightMatch), suggestsClassName: this.props.suggestsClassName, suggestItemClassName: this.props.suggestItemClassName, suggests: this.state.suggests, hiddenClassName: this.props.suggestsHiddenClassName, suggestItemActiveClassName: this.props.suggestItemActiveClassName, activeSuggest: this.state.activeSuggest, onSuggestNoResults: this.onSuggestNoResults, onSuggestMouseDown: this.onSuggestMouseDown, onSuggestMouseOut: this.onSuggestMouseOut, onSuggestSelect: this.selectSuggest, renderSuggestItem: this.props.renderSuggestItem })); - return (react.createElement("div", { className: classes }, - react.createElement("div", { className: "geosuggest__input-wrapper" }, - shouldRenderLabel && (react.createElement("label", { className: "geosuggest__label", htmlFor: attributes.id }, this.props.label)), + }); + var shouldRenderLabel = this.props.label && attributes.id; + var input = (undefined(default_1, __assign({ className: this.props.inputClassName, ref: function (i) { return (_this.input = i); }, value: this.state.userInput, doNotSubmitOnEnter: !this.state.isSuggestsHidden, ignoreTab: this.props.ignoreTab, ignoreEnter: this.props.ignoreEnter, style: this.props.style && this.props.style.input, onChange: this.onInputChange, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onKeyDown: this.props.onKeyDown, onKeyPress: this.props.onKeyPress, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests }, attributes))); + var suggestionsList = (undefined(default_1$2, { isHidden: this.state.isSuggestsHidden, style: this.props.style && this.props.style.suggests, suggestItemStyle: this.props.style && this.props.style.suggestItem, userInput: this.state.userInput, isHighlightMatch: Boolean(this.props.highlightMatch), suggestsClassName: this.props.suggestsClassName, suggestItemClassName: this.props.suggestItemClassName, suggests: this.state.suggests, hiddenClassName: this.props.suggestsHiddenClassName, suggestItemActiveClassName: this.props.suggestItemActiveClassName, activeSuggest: this.state.activeSuggest, onSuggestNoResults: this.onSuggestNoResults, onSuggestMouseDown: this.onSuggestMouseDown, onSuggestMouseOut: this.onSuggestMouseOut, onSuggestSelect: this.selectSuggest, renderSuggestItem: this.props.renderSuggestItem })); + return (undefined("div", { className: classes }, + undefined("div", { className: "geosuggest__input-wrapper" }, + shouldRenderLabel && (undefined("label", { className: "geosuggest__label", htmlFor: attributes.id }, this.props.label)), input), - react.createElement("div", { className: "geosuggest__suggests-wrapper" }, suggestionsList))); + undefined("div", { className: "geosuggest__suggests-wrapper" }, suggestionsList))); }; /** * Default values for the properties */ default_1$$1.defaultProps = defaults; return default_1$$1; - }(react.Component)); + }(undefined)); return default_1$3; diff --git a/dist/react-geosuggest.min.js b/dist/react-geosuggest.min.js index 342ad0a7..29da9d35 100644 --- a/dist/react-geosuggest.min.js +++ b/dist/react-geosuggest.min.js @@ -1 +1 @@ -var Geosuggest=function(){"use strict";var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return(u=Object.assign||function(t){for(var e,n=1,o=arguments.length;ne.scrollTop+e.clientHeight;(n||o)&&(e.scrollTop=t.offsetTop-e.offsetTop-e.clientHeight/2+t.clientHeight/2)}},t.prototype.onClick=function(t){t.preventDefault(),this.props.onSelect(this.props.suggest)},t.prototype.render=function(){var t,e=this,n=this.props.suggest,o=z("geosuggest__item",this.props.className,this.props.suggestItemClassName,{"geosuggest__item--active":this.props.isActive},((t={})[this.props.activeClassName||""]=this.props.activeClassName?this.props.isActive:null,t)),s=n.label;return this.props.renderSuggestItem?s=this.props.renderSuggestItem(n,this.props.userInput):this.props.isHighlightMatch&&(s=this.formatMatchedText(this.props.userInput,n)),G.createElement("li",{className:o,ref:function(t){return e.ref=t},style:this.props.style,onMouseDown:this.props.onMouseDown,onMouseOut:this.props.onMouseOut,onClick:this.onClick},s)},t}(G.PureComponent),mt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.isHidden=function(){return this.props.isHidden||0===this.props.suggests.length},e.prototype.componentWillReceiveProps=function(t){t.suggests!==this.props.suggests&&0===t.suggests.length&&this.props.onSuggestNoResults()},e.prototype.render=function(){var t,n=this,e=z("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},((t={})[this.props.hiddenClassName||""]=this.props.hiddenClassName?this.isHidden():null,t));return G.createElement("ul",{className:e,style:this.props.style},this.props.suggests.map(function(t){var e=n.props.activeSuggest&&t.placeId===n.props.activeSuggest.placeId||!1;return G.createElement(yt,{key:t.placeId,className:t.className||"",userInput:n.props.userInput,isHighlightMatch:n.props.isHighlightMatch,suggest:t,style:n.props.suggestItemStyle,suggestItemClassName:n.props.suggestItemClassName,isActive:e,activeClassName:n.props.suggestItemActiveClassName,onMouseDown:n.props.onSuggestMouseDown,onMouseOut:n.props.onSuggestMouseOut,onSelect:n.props.onSuggestSelect,renderSuggestItem:n.props.renderSuggestItem})}))},e}(G.PureComponent);return function(n){function t(t){var e=n.call(this,t)||this;return e.googleMaps=null,e.autocompleteService=null,e.geocoder=null,e.input=null,e.state={isSuggestsHidden:!0,isLoading:!1,ignoreBlur:!1,userInput:t.initialValue||"",activeSuggest:null,suggests:[]},e.onInputChange=e.onInputChange.bind(e),e.onAfterInputChange=e.onAfterInputChange.bind(e),e.onInputFocus=e.onInputFocus.bind(e),e.onInputBlur=e.onInputBlur.bind(e),e.onNext=e.onNext.bind(e),e.onPrev=e.onPrev.bind(e),e.onSelect=e.onSelect.bind(e),e.onSuggestMouseDown=e.onSuggestMouseDown.bind(e),e.onSuggestMouseOut=e.onSuggestMouseOut.bind(e),e.onSuggestNoResults=e.onSuggestNoResults.bind(e),e.hideSuggests=e.hideSuggests.bind(e),e.selectSuggest=e.selectSuggest.bind(e),t.queryDelay&&(e.onAfterInputChange=ct(e.onAfterInputChange,t.queryDelay)),e}return s(t,n),t.prototype.componentWillReceiveProps=function(t){this.props.initialValue!==t.initialValue&&this.setState({userInput:t.initialValue||""})},t.prototype.componentWillMount=function(){if("undefined"!=typeof window){var t=this.props.googleMaps||window.google&&window.google.maps||this.googleMaps;t?(this.googleMaps=t,this.autocompleteService=new t.places.AutocompleteService,this.geocoder=new t.Geocoder):console&&console.error("Google map api was not found in the page.")}},t.prototype.componentWillUnmount=function(){clearTimeout(this.timer)},t.prototype.onInputChange=function(t){t||this.props.onSuggestSelect&&this.props.onSuggestSelect(),this.setState({userInput:t},this.onAfterInputChange)},t.prototype.onAfterInputChange=function(){this.showSuggests(),this.props.onChange&&this.props.onChange(this.state.userInput)},t.prototype.onInputFocus=function(){this.props.onFocus&&this.props.onFocus(),this.showSuggests()},t.prototype.onInputBlur=function(){this.state.ignoreBlur||this.hideSuggests()},t.prototype.onNext=function(){this.activateSuggest("next")},t.prototype.onPrev=function(){this.activateSuggest("prev")},t.prototype.onSelect=function(){this.selectSuggest(this.state.activeSuggest)},t.prototype.onSuggestMouseDown=function(){this.setState({ignoreBlur:!0})},t.prototype.onSuggestMouseOut=function(){this.setState({ignoreBlur:!1})},t.prototype.onSuggestNoResults=function(){this.props.onSuggestNoResults&&this.props.onSuggestNoResults(this.state.userInput)},t.prototype.focus=function(){this.input&&this.input.focus()},t.prototype.blur=function(){this.input&&this.input.blur()},t.prototype.update=function(t){this.setState({userInput:t}),this.props.onChange&&this.props.onChange(t)},t.prototype.clear=function(){this.setState({userInput:""},this.hideSuggests)},t.prototype.searchSuggests=function(){var e=this;if(this.state.userInput){var t={input:this.state.userInput},n=this.state.userInput.length;if(!(this.props.minLength&&ne.scrollTop+e.clientHeight;(o||s)&&(e.scrollTop=t.offsetTop-e.offsetTop-e.clientHeight/2+t.clientHeight/2)}},t.prototype.onClick=function(t){t.preventDefault(),this.props.onSelect(this.props.suggest)},t.prototype.render=function(){var t,e=this,o=this.props.suggest,s=G("geosuggest__item",this.props.className,this.props.suggestItemClassName,{"geosuggest__item--active":this.props.isActive},((t={})[this.props.activeClassName||""]=this.props.activeClassName?this.props.isActive:null,t)),n=o.label;return this.props.renderSuggestItem?n=this.props.renderSuggestItem(o,this.props.userInput):this.props.isHighlightMatch&&(n=this.formatMatchedText(this.props.userInput,o)),(void 0)("li",{className:s,ref:function(t){return e.ref=t},style:this.props.style,onMouseDown:this.props.onMouseDown,onMouseOut:this.props.onMouseOut,onClick:this.onClick},n)},t}(void 0),yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.isHidden=function(){return this.props.isHidden||0===this.props.suggests.length},e.prototype.componentWillReceiveProps=function(t){t.suggests!==this.props.suggests&&0===t.suggests.length&&this.props.onSuggestNoResults()},e.prototype.render=function(){var t,o=this;return(void 0)("ul",{className:G("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},((t={})[this.props.hiddenClassName||""]=this.props.hiddenClassName?this.isHidden():null,t)),style:this.props.style},this.props.suggests.map(function(t){var e=o.props.activeSuggest&&t.placeId===o.props.activeSuggest.placeId||!1;return(void 0)(dt,{key:t.placeId,className:t.className||"",userInput:o.props.userInput,isHighlightMatch:o.props.isHighlightMatch,suggest:t,style:o.props.suggestItemStyle,suggestItemClassName:o.props.suggestItemClassName,isActive:e,activeClassName:o.props.suggestItemActiveClassName,onMouseDown:o.props.onSuggestMouseDown,onMouseOut:o.props.onSuggestMouseOut,onSelect:o.props.onSuggestSelect,renderSuggestItem:o.props.renderSuggestItem})}))},e}(void 0);return function(o){function t(t){var e=o.call(this,t)||this;return e.googleMaps=null,e.autocompleteService=null,e.placesService=null,e.sessionToken=void 0,e.geocoder=null,e.input=null,e.state={activeSuggest:null,ignoreBlur:!1,isLoading:!1,isSuggestsHidden:!0,suggests:[],userInput:t.initialValue||""},e.onInputChange=e.onInputChange.bind(e),e.onAfterInputChange=e.onAfterInputChange.bind(e),e.onInputFocus=e.onInputFocus.bind(e),e.onInputBlur=e.onInputBlur.bind(e),e.onNext=e.onNext.bind(e),e.onPrev=e.onPrev.bind(e),e.onSelect=e.onSelect.bind(e),e.onSuggestMouseDown=e.onSuggestMouseDown.bind(e),e.onSuggestMouseOut=e.onSuggestMouseOut.bind(e),e.onSuggestNoResults=e.onSuggestNoResults.bind(e),e.hideSuggests=e.hideSuggests.bind(e),e.selectSuggest=e.selectSuggest.bind(e),t.queryDelay&&(e.onAfterInputChange=lt(e.onAfterInputChange,t.queryDelay)),e}return n(t,o),t.prototype.componentWillReceiveProps=function(t){this.props.initialValue!==t.initialValue&&this.setState({userInput:t.initialValue||""})},t.prototype.componentWillMount=function(){if("undefined"!=typeof window){var t=this.props.googleMaps||window.google&&window.google.maps||this.googleMaps;t?(this.googleMaps=t,this.autocompleteService=new t.places.AutocompleteService,this.placesService=new t.places.PlacesService(document.createElement("div")),this.sessionToken=new t.places.AutocompleteSessionToken,this.geocoder=new t.Geocoder):console&&console.error("Google maps API was not found in the page.")}},t.prototype.componentWillUnmount=function(){clearTimeout(this.timer)},t.prototype.onInputChange=function(t){t||this.props.onSuggestSelect&&this.props.onSuggestSelect(),this.setState({userInput:t},this.onAfterInputChange)},t.prototype.onAfterInputChange=function(){this.showSuggests(),this.props.onChange&&this.props.onChange(this.state.userInput)},t.prototype.onInputFocus=function(){this.props.onFocus&&this.props.onFocus(),this.showSuggests()},t.prototype.onInputBlur=function(){this.state.ignoreBlur||this.hideSuggests()},t.prototype.onNext=function(){this.activateSuggest("next")},t.prototype.onPrev=function(){this.activateSuggest("prev")},t.prototype.onSelect=function(){this.selectSuggest(this.state.activeSuggest)},t.prototype.onSuggestMouseDown=function(){this.setState({ignoreBlur:!0})},t.prototype.onSuggestMouseOut=function(){this.setState({ignoreBlur:!1})},t.prototype.onSuggestNoResults=function(){this.props.onSuggestNoResults&&this.props.onSuggestNoResults(this.state.userInput)},t.prototype.focus=function(){this.input&&this.input.focus()},t.prototype.blur=function(){this.input&&this.input.blur()},t.prototype.update=function(t){this.setState({userInput:t}),this.props.onChange&&this.props.onChange(t)},t.prototype.clear=function(){this.setState({userInput:""},this.hideSuggests)},t.prototype.searchSuggests=function(){var e=this;if(this.state.userInput){var t={input:this.state.userInput,sessionToken:this.sessionToken},o=this.state.userInput.length;if(!(this.props.minLength&&o