react-geosuggest
Advanced tools
Comparing version 2.6.0 to 2.7.0
@@ -0,1 +1,9 @@ | ||
## 2.7.0 (2017-12-11) | ||
#### Features | ||
* **SuggestItem:** Adds hook to get list of suggests on when list changes ([169951d](https://github.com/ubilabs/react-geosuggest/commit/169951d13d7a4100571c1c80820e0aaa3b56444f)) | ||
## 2.6.0 (2017-11-10) | ||
@@ -2,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Geosuggest=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var a="function"==typeof require&&require;if(!u&&a)return a(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n||e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){!function(){"use strict";function e(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var s=typeof o;if("string"===s||"number"===s)t.push(o);else if(Array.isArray(o))t.push(e.apply(null,o));else if("object"===s)for(var i in o)n.call(o,i)&&o[i]&&t.push(i)}}return t.join(" ")}var n={}.hasOwnProperty;void 0!==t&&t.exports?t.exports=e:window.classNames=e}()},{}],2:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],3:[function(e,t,n){(function(e){"use strict";var n=function(e){};"production"!==e.env.NODE_ENV&&(n=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),t.exports=function(e,t,r,o,s,i,u,a){if(n(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,o,s,i,u,a],f=0;(l=new Error(t.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}}).call(this,e("_process"))},{_process:7}],4:[function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}var o=Object.prototype.hasOwnProperty;t.exports=function(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(var i=0;i<n.length;i++)if(!o.call(t,n[i])||!r(e[n[i]],t[n[i]]))return!1;return!0}},{}],5:[function(e,t,n){(function(n){"use strict";var r=e("./emptyFunction");if("production"!==n.env.NODE_ENV){var o=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,s="Warning: "+e.replace(/%s/g,function(){return n[o++]});try{throw new Error(s)}catch(e){}};r=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];o.apply(void 0,[t].concat(r))}}}t.exports=r}).call(this,e("_process"))},{"./emptyFunction":2,_process:7}],6:[function(e,t,n){(function(e){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||r(e)&&b.call(e)==a}function s(e){if("number"==typeof e)return e;if(o(e))return u;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=f.test(e);return r||p.test(e)?g(e.slice(2),r?2:8):c.test(e)?u:+e}var i="Expected a function",u=NaN,a="[object Symbol]",l=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,p=/^0o[0-7]+$/i,g=parseInt,d="object"==typeof e&&e&&e.Object===Object&&e,h="object"==typeof self&&self&&self.Object===Object&&self,y=d||h||Function("return this")(),b=Object.prototype.toString,v=Math.max,m=Math.min,w=function(){return y.Date.now()};t.exports=function(e,t,r){function o(t){var n=g,r=d;return g=d=void 0,O=t,y=e.apply(r,n)}function u(e){return O=e,b=setTimeout(c,t),j?o(e):y}function a(e){var n=t-(e-S);return _?m(n,h-(e-O)):n}function l(e){var n=e-S;return void 0===S||n>=t||n<0||_&&e-O>=h}function c(){var e=w();if(l(e))return f(e);b=setTimeout(c,a(e))}function f(e){return b=void 0,T&&g?o(e):(g=d=void 0,y)}function p(){var e=w(),n=l(e);if(g=arguments,d=this,S=e,n){if(void 0===b)return u(S);if(_)return b=setTimeout(c,t),o(S)}return void 0===b&&(b=setTimeout(c,t)),y}var g,d,h,y,b,S,O=0,j=!1,_=!1,T=!0;if("function"!=typeof e)throw new TypeError(i);return t=s(t)||0,n(r)&&(j=!!r.leading,h=(_="maxWait"in r)?v(s(r.maxWait)||0,t):h,T="trailing"in r?!!r.trailing:T),p.cancel=function(){void 0!==b&&clearTimeout(b),O=0,g=S=d=b=void 0},p.flush=function(){return void 0===b?y:f(w())},p}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function u(){y&&d&&(y=!1,d.length?h=d.concat(h):b=-1,h.length&&a())}function a(){if(!y){var e=s(u);y=!0;for(var t=h.length;t;){for(d=h,h=[];++b<t;)d&&d[b].run();b=-1,t=h.length}d=null,y=!1,i(e)}}function l(e,t){this.fun=e,this.array=t}function c(){}var f,p,g=t.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var d,h=[],y=!1,b=-1;g.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new l(e,t)),1!==h.length||y||s(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},g.title="browser",g.browser=!0,g.env={},g.argv=[],g.version="",g.versions={},g.on=c,g.addListener=c,g.once=c,g.off=c,g.removeListener=c,g.removeAllListeners=c,g.emit=c,g.binding=function(e){throw new Error("process.binding is not supported")},g.cwd=function(){return"/"},g.chdir=function(e){throw new Error("process.chdir is not supported")},g.umask=function(){return 0}},{}],8:[function(e,t,n){(function(n){"use strict";if("production"!==n.env.NODE_ENV)var r=e("fbjs/lib/invariant"),o=e("fbjs/lib/warning"),s=e("./lib/ReactPropTypesSecret"),i={};t.exports=function(e,t,u,a,l){if("production"!==n.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var f;try{r("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",a||"React class",u,c,typeof e[c]),f=e[c](t,c,a,u,null,s)}catch(e){f=e}if(o(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",u,c,typeof f),f instanceof Error&&!(f.message in i)){i[f.message]=!0;var p=l?l():"";o(!1,"Failed %s type: %s%s",u,f.message,null!=p?p:"")}}}}).call(this,e("_process"))},{"./lib/ReactPropTypesSecret":12,_process:7,"fbjs/lib/invariant":3,"fbjs/lib/warning":5}],9:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),s=e("./lib/ReactPropTypesSecret");t.exports=function(){function e(e,t,n,r,i,u){u!==s&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":2,"fbjs/lib/invariant":3}],10:[function(e,t,n){(function(n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),s=e("fbjs/lib/warning"),i=e("object-assign"),u=e("./lib/ReactPropTypesSecret"),a=e("./checkPropTypes");t.exports=function(e,t){function l(e){var t=e&&(w&&e[w]||e[S]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function f(e){this.message=e,this.stack=""}function p(e){function r(r,l,c,p,g,d,h){if(p=p||O,d=d||c,h!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==n.env.NODE_ENV&&"undefined"!=typeof console){var y=p+":"+c;!i[y]&&a<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,p),i[y]=!0,a++)}return null==l[c]?r?new f(null===l[c]?"The "+g+" `"+d+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+g+" `"+d+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(l,c,p,g,d)}if("production"!==n.env.NODE_ENV)var i={},a=0;var l=r.bind(null,!1);return l.isRequired=r.bind(null,!0),l}function g(e){return p(function(t,n,r,o,s,i){var u=t[n];return y(u)!==e?new f("Invalid "+o+" `"+s+"` of type `"+b(u)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var n=l(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!d(r.value))return!1}else for(;!(r=o.next()).done;){var s=r.value;if(s&&!d(s[1]))return!1}return!0;default:return!1}}function h(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":h(t,e)?"symbol":t}function b(e){if(void 0===e||null===e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function v(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function m(e){return e.constructor&&e.constructor.name?e.constructor.name:O}var w="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",O="<<anonymous>>",j={array:g("array"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:p(r.thatReturnsNull),arrayOf:function(e){return p(function(t,n,r,o,s){if("function"!=typeof e)return new f("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new f("Invalid "+o+" `"+s+"` of type `"+y(i)+"` supplied to `"+r+"`, expected an array.");for(var a=0;a<i.length;a++){var l=e(i,a,r,o,s+"["+a+"]",u);if(l instanceof Error)return l}return null})},element:p(function(t,n,r,o,s){var i=t[n];return e(i)?null:new f("Invalid "+o+" `"+s+"` of type `"+y(i)+"` supplied to `"+r+"`, expected a single ReactElement.")}),instanceOf:function(e){return p(function(t,n,r,o,s){if(!(t[n]instanceof e)){var i=e.name||O;return new f("Invalid "+o+" `"+s+"` of type `"+m(t[n])+"` supplied to `"+r+"`, expected instance of `"+i+"`.")}return null})},node:p(function(e,t,n,r,o){return d(e[t])?null:new f("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return p(function(t,n,r,o,s){if("function"!=typeof e)return new f("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],a=y(i);if("object"!==a)return new f("Invalid "+o+" `"+s+"` of type `"+a+"` supplied to `"+r+"`, expected an object.");for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,s+"."+l,u);if(c instanceof Error)return c}return null})},oneOf:function(e){return Array.isArray(e)?p(function(t,n,r,o,s){for(var i=t[n],u=0;u<e.length;u++)if(c(i,e[u]))return null;return new f("Invalid "+o+" `"+s+"` of value `"+i+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}):("production"!==n.env.NODE_ENV&&s(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==n.env.NODE_ENV&&s(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return s(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",v(o),t),r.thatReturnsNull}return p(function(t,n,r,o,s){for(var i=0;i<e.length;i++)if(null==(0,e[i])(t,n,r,o,s,u))return null;return new f("Invalid "+o+" `"+s+"` supplied to `"+r+"`.")})},shape:function(e){return p(function(t,n,r,o,s){var i=t[n],a=y(i);if("object"!==a)return new f("Invalid "+o+" `"+s+"` of type `"+a+"` supplied to `"+r+"`, expected `object`.");for(var l in e){var c=e[l];if(c){var p=c(i,l,r,o,s+"."+l,u);if(p)return p}}return null})},exact:function(e){return p(function(t,n,r,o,s){var a=t[n],l=y(a);if("object"!==l)return new f("Invalid "+o+" `"+s+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");var c=i({},t[n],e);for(var p in c){var g=e[p];if(!g)return new f("Invalid "+o+" `"+s+"` key `"+p+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var d=g(a,p,r,o,s+"."+p,u);if(d)return d}return null})}};return f.prototype=Error.prototype,j.checkPropTypes=a,j.PropTypes=j,j}}).call(this,e("_process"))},{"./checkPropTypes":8,"./lib/ReactPropTypesSecret":12,_process:7,"fbjs/lib/emptyFunction":2,"fbjs/lib/invariant":3,"fbjs/lib/warning":5,"object-assign":13}],11:[function(e,t,n){(function(n){if("production"!==n.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=e("./factoryWithTypeCheckers")(function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},!0)}else t.exports=e("./factoryWithThrowingShims")()}).call(this,e("_process"))},{"./factoryWithThrowingShims":9,"./factoryWithTypeCheckers":10,_process:7}],12:[function(e,t,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}],13:[function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,a=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var c in n)s.call(n,c)&&(a[c]=n[c]);if(o){u=o(n);for(var f=0;f<u.length;f++)i.call(n,u[f])&&(a[u[f]]=n[u[f]])}}return a}},{}],14:[function(e,t,n){"use strict";var r=e("fbjs/lib/shallowEqual");t.exports=function(e,t,n){return!r(e.props,t)||!r(e.state,n)}},{"fbjs/lib/shallowEqual":4}],15:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=r(window.React),p=r(e("classnames")),g=r(e("lodash.debounce")),d=r(e("./defaults")),h=r(e("./prop-types")),y=r(e("./filter-input-attributes")),b=r(e("./input")),v=r(e("./suggest-list")),m=function(e){function t(e){o(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onInputChange=function(e){e||n.props.onSuggestSelect(),n.setState({userInput:e},n.onAfterInputChange)},n.onAfterInputChange=function(){n.showSuggests(),n.props.onChange(n.state.userInput)},n.onInputFocus=function(){n.props.onFocus(),n.showSuggests()},n.onInputBlur=function(){n.state.ignoreBlur||n.hideSuggests()},n.onNext=function(){return n.activateSuggest("next")},n.onPrev=function(){return n.activateSuggest("prev")},n.onSelect=function(){return n.selectSuggest(n.state.activeSuggest)},n.onSuggestMouseDown=function(){return n.setState({ignoreBlur:!0})},n.onSuggestMouseOut=function(){return n.setState({ignoreBlur:!1})},n.onSuggestNoResults=function(){n.props.onSuggestNoResults(n.state.userInput)},n.hideSuggests=function(){n.props.onBlur(n.state.userInput),n.timer=setTimeout(function(){n.setState({isSuggestsHidden:!0,activeSuggest:null})},100)},n.selectSuggest=function(e){if(e||(e={label:n.state.userInput}),n.setState({isSuggestsHidden:!0,userInput:"object"!==l(e.label)?e.label:e.description}),e.location)return n.setState({ignoreBlur:!1}),void n.props.onSuggestSelect(e);n.geocodeSuggest(e)},n.state={isSuggestsHidden:!0,isLoading:!1,userInput:e.initialValue,activeSuggest:null,suggests:[]},n.onInputChange=n.onInputChange.bind(n),n.onAfterInputChange=n.onAfterInputChange.bind(n),e.queryDelay&&(n.onAfterInputChange=(0,g.default)(n.onAfterInputChange,e.queryDelay)),n}return i(t,f.default.Component),c(t,[{key:"componentWillReceiveProps",value:function(e){this.props.initialValue!==e.initialValue&&this.setState({userInput:e.initialValue})}},{key:"componentWillMount",value:function(){if("undefined"!=typeof window){var e=this.props.googleMaps||window.google&&window.google.maps||this.googleMaps;e?(this.googleMaps=e,this.autocompleteService=new e.places.AutocompleteService,this.geocoder=new e.Geocoder):console}}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timer)}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"update",value:function(e){this.setState({userInput:e}),this.props.onChange(e)}},{key:"clear",value:function(){this.setState({userInput:""},this.hideSuggests)}},{key:"searchSuggests",value:function(){var e=this;if(this.state.userInput){var t={input:this.state.userInput};this.state.userInput.length<this.props.minLength||(["location","radius","bounds","types"].forEach(function(n){e.props[n]&&(t[n]=e.props[n])}),this.props.country&&(t.componentRestrictions={country:this.props.country}),this.setState({isLoading:!0},function(){e.autocompleteService.getPlacePredictions(t,function(t){e.setState({isLoading:!1}),e.updateSuggests(t||[],function(){e.props.autoActivateFirstSuggest&&!e.state.activeSuggest&&e.activateSuggest("next")})})}))}else this.updateSuggests()}},{key:"updateSuggests",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1],r=[],o=this.state.userInput,s=new RegExp(u(o),"gim"),i=this.props.skipSuggest,a=this.props.maxFixtures,l=0,c=null;this.props.fixtures.forEach(function(e){l>=a||!i(e)&&e.label.match(s)&&(l++,e.placeId=e.label,e.isFixture=!0,e.matchedSubstrings={offset:e.label.indexOf(o),length:o.length},r.push(e))}),t.forEach(function(t){i(t)||r.push({description:t.description,label:e.props.getSuggestLabel(t),placeId:t.place_id,isFixture:!1,matchedSubstrings:t.matched_substrings[0]})}),c=this.updateActiveSuggest(r),this.setState({suggests:r,activeSuggest:c},n)}},{key:"updateActiveSuggest",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.state.activeSuggest;if(t){var n=e.filter(function(e){return t.placeId===e.placeId&&t.isFixture===e.isFixture})[0];t=n||null}return t}},{key:"showSuggests",value:function(){this.searchSuggests(),this.setState({isSuggestsHidden:!1})}},{key:"activateSuggest",value:function(e){if(this.state.isSuggestsHidden)this.showSuggests();else{var t=this.state.suggests.length-1,n="next"===e,r=null,o=0,s=0;for(s;s<=t;s++)this.state.suggests[s]===this.state.activeSuggest&&(o=n?s+1:s-1);this.state.activeSuggest||(o=n?0:t),o>=0&&o<=t&&(r=this.state.suggests[o]),this.props.onActivateSuggest(r),this.setState({activeSuggest:r})}}},{key:"geocodeSuggest",value:function(e){var t=this,n=null;n=e.placeId&&!e.isFixture?{placeId:e.placeId}:{address:e.label,location:this.props.location,bounds:this.props.bounds,componentRestrictions:this.props.country?{country:this.props.country}:null},this.geocoder.geocode(n,function(n,r){if(r===t.googleMaps.GeocoderStatus.OK){var o=n[0],s=o.geometry.location;e.gmaps=o,e.location={lat:s.lat(),lng:s.lng()}}t.props.onSuggestSelect(e)})}},{key:"render",value:function(){var e=this,t=(0,y.default)(this.props),n=(0,p.default)("geosuggest",this.props.className,{"geosuggest--loading":this.state.isLoading}),r=this.props.label&&t.id,o=f.default.createElement(b.default,a({className:this.props.inputClassName,ref:function(t){return e.input=t},value:this.state.userInput,ignoreEnter:!this.state.isSuggestsHidden,ignoreTab:this.props.ignoreTab,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},t)),s=f.default.createElement(v.default,{isHidden:this.state.isSuggestsHidden,style:this.props.style.suggests,suggestItemStyle:this.props.style.suggestItem,userInput:this.state.userInput,isHighlightMatch: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,minLength:this.props.minLength});return f.default.createElement("div",{className:n},f.default.createElement("div",{className:"geosuggest__input-wrapper"},r&&f.default.createElement("label",{className:"geosuggest__label",htmlFor:t.id},this.props.label),o),f.default.createElement("div",{className:"geosuggest__suggests-wrapper"},s))}}]),t}();m.propTypes=h.default,m.defaultProps=d.default,n.default=m},{"./defaults":16,"./filter-input-attributes":17,"./input":18,"./prop-types":19,"./suggest-list":21,classnames:1,"lodash.debounce":6}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={fixtures:[],maxFixtures:10,initialValue:"",placeholder:"Search places",disabled:!1,className:"",inputClassName:"",location:null,radius:null,bounds:null,country:null,types:null,queryDelay:250,googleMaps:null,highlightMatch:!0,onActivateSuggest:function(){},onSuggestSelect:function(){},onSuggestNoResults:function(){},onFocus:function(){},onBlur:function(){},onChange:function(){},skipSuggest:function(){},getSuggestLabel:function(e){return e.description},renderSuggestItem:null,autoActivateFirstSuggest:!1,style:{input:{},suggests:{},suggestItem:{}},ignoreTab:!1,minLength:1}},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){var t={};return r.forEach(function(n){e[n]&&(t[n]=e[n])}),t};var r=["autoCapitalize","autoComplete","autoCorrect","autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","height","id","inputMode","maxLength","name","onClick","onContextMenu","onCopy","onCut","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPaste","pattern","placeholder","readOnly","required","size","spellCheck","tabIndex","title","aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription","aria-activedescendant","aria-autocomplete","aria-multiline","aria-placeholder","aria-readonly","aria-required"]},{}],18:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("react-addons-shallow-compare")),f=r(e("classnames")),p=r(e("./filter-input-attributes")),g=function(e){function t(){var e,n,r,i;o(this,t);for(var u=arguments.length,a=Array(u),l=0;l<u;l++)a[l]=arguments[l];return n=r=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onChange=function(){r.props.onChange(r.input.value)},r.onFocus=function(){r.props.onFocus()},r.onBlur=function(){r.props.onBlur()},r.onKeyPress=function(e){r.props.onKeyPress(e)},r.onInputKeyDown=function(e){switch(r.props.onKeyDown&&r.props.onKeyDown(e),e.which){case 40:e.shiftKey||(e.preventDefault(),r.props.onNext());break;case 38:e.shiftKey||(e.preventDefault(),r.props.onPrev());break;case 13:r.props.ignoreEnter&&e.preventDefault(),r.props.onSelect();break;case 9:r.props.ignoreTab||r.props.onSelect();break;case 27:r.props.onEscape()}},i=n,s(r,i)}return i(t,l.default.Component),a(t,[{key:"shouldComponentUpdate",value:function(e,t){return(0,c.default)(this,e,t)}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"render",value:function(){var e=this,t=(0,p.default)(this.props),n=(0,f.default)("geosuggest__input",this.props.className);return l.default.createElement("input",u({className:n,ref:function(t){return e.input=t},type:"text"},t,{value:this.props.value,style:this.props.style,onKeyDown:this.onInputKeyDown,onChange:this.onChange,onKeyPress:this.onKeyPress,onFocus:this.onFocus,onBlur:this.onBlur}))}}]),t}();g.defaultProps={className:"",value:"",ignoreTab:!1,onKeyDown:function(){},onKeyPress:function(){},autoComplete:"off"},n.default=g},{"./filter-input-attributes":17,classnames:1,"react-addons-shallow-compare":14}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(e("prop-types"));n.default={fixtures:r.default.array,maxFixtures:r.default.number,initialValue:r.default.string,placeholder:r.default.string,disabled:r.default.bool,className:r.default.string,inputClassName:r.default.string,suggestsClassName:r.default.string,suggestsHiddenClassName:r.default.string,suggestItemClassName:r.default.string,suggestItemActiveClassName:r.default.string,location:r.default.object,radius:r.default.oneOfType([r.default.string,r.default.number]),bounds:r.default.object,country:r.default.oneOfType([r.default.string,r.default.array]),types:r.default.array,queryDelay:r.default.number,googleMaps:r.default.object,highlightMatch:r.default.bool,onSuggestSelect:r.default.func,onFocus:r.default.func,onBlur:r.default.func,onChange:r.default.func,onKeyPress:r.default.func,skipSuggest:r.default.func,getSuggestLabel:r.default.func,renderSuggestItem:r.default.func,autoActivateFirstSuggest:r.default.bool,style:r.default.shape({input:r.default.object,suggests:r.default.object,suggestItem:r.default.object}),ignoreTab:r.default.bool,label:r.default.string,autoComplete:r.default.string,minLength:r.default.number}},{"prop-types":11}],20:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("classnames")),f=function(e){function t(){var e,n,r,o;s(this,t);for(var u=arguments.length,a=Array(u),l=0;l<u;l++)a[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onClick=function(e){e.preventDefault(),r.props.onSelect(r.props.suggest)},o=n,i(r,o)}return u(t,l.default.Component),a(t,[{key:"makeBold",value:function(e,t){return l.default.createElement("b",{className:"geosuggest__item__matched-text",key:t},e)}},{key:"formatMatchedText",value:function(e,t){if(!e||!t.matchedSubstrings)return t.label;var n=t.matchedSubstrings.offset,r=n+t.matchedSubstrings.length,o=this.makeBold(t.label.substring(n,r),t.label),s="",i="";return n>0&&(s=t.label.slice(0,n)),r<t.label.length&&(i=t.label.slice(r)),l.default.createElement("span",null,s,o,i)}},{key:"componentWillReceiveProps",value:function(e){e.isActive&&!this.props.isActive&&this.scrollIfNeeded()}},{key:"scrollIfNeeded",value:function(){var e=this.ref,t=e.parentElement,n=e.offsetTop-t.offsetTop<t.scrollTop,r=e.offsetTop-t.offsetTop+e.clientHeight>t.scrollTop+t.clientHeight;(n||r)&&(t.scrollTop=e.offsetTop-t.offsetTop-t.clientHeight/2+e.clientHeight/2)}},{key:"render",value:function(){var e=this,t=this.props.suggest,n=(0,c.default)("geosuggest__item",this.props.className,this.props.suggestItemClassName,{"geosuggest__item--active":this.props.isActive},o({},this.props.activeClassname,this.props.activeClassname?this.props.isActive:null)),r=t.label;return this.props.renderSuggestItem?r=this.props.renderSuggestItem(t):this.props.isHighlightMatch&&(r=this.formatMatchedText(this.props.userInput,t)),l.default.createElement("li",{className:n,ref:function(t){return e.ref=t},style:this.props.style,onMouseDown:this.props.onMouseDown,onMouseOut:this.props.onMouseOut,onClick:this.onClick},r)}}]),t}();n.default=f,f.defaultProps={isActive:!1,className:"",suggest:{}}},{classnames:1}],21:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("react-addons-shallow-compare")),f=r(e("classnames")),p=r(e("./suggest-item")),g=function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,l.default.Component),a(t,[{key:"shouldComponentUpdate",value:function(e,t){return(0,c.default)(this,e,t)}},{key:"isHidden",value:function(){return this.props.isHidden||0===this.props.suggests.length}},{key:"componentWillReceiveProps",value:function(e){e.suggests!==this.props.suggests&&0===e.suggests.length&&this.props.onSuggestNoResults()}},{key:"render",value:function(){var e=this,t=(0,f.default)("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},o({},this.props.hiddenClassName,this.props.hiddenClassName?this.isHidden():null));return l.default.createElement("ul",{className:t,style:this.props.style},this.props.suggests.map(function(t){var n=e.props.activeSuggest&&t.placeId===e.props.activeSuggest.placeId,r=t.key||t.placeId;return l.default.createElement(p.default,{key:r,className:t.className,userInput:e.props.userInput,isHighlightMatch:e.props.isHighlightMatch,suggest:t,style:e.props.suggestItemStyle,suggestItemClassName:e.props.suggestItemClassName,isActive:n,activeClassname:e.props.suggestItemActiveClassName,onMouseDown:e.props.onSuggestMouseDown,onMouseOut:e.props.onSuggestMouseOut,onSelect:e.props.onSuggestSelect,renderSuggestItem:e.props.renderSuggestItem})}))}}]),t}();n.default=g,g.defaultProps={isHidden:!0,suggests:[]}},{"./suggest-item":20,classnames:1,"react-addons-shallow-compare":14}]},{},[15])(15)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Geosuggest=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var a="function"==typeof require&&require;if(!u&&a)return a(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n||e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){!function(){"use strict";function e(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var s=typeof o;if("string"===s||"number"===s)t.push(o);else if(Array.isArray(o))t.push(e.apply(null,o));else if("object"===s)for(var i in o)n.call(o,i)&&o[i]&&t.push(i)}}return t.join(" ")}var n={}.hasOwnProperty;void 0!==t&&t.exports?t.exports=e:window.classNames=e}()},{}],2:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],3:[function(e,t,n){(function(e){"use strict";var n=function(e){};"production"!==e.env.NODE_ENV&&(n=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),t.exports=function(e,t,r,o,s,i,u,a){if(n(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,o,s,i,u,a],p=0;(l=new Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}}).call(this,e("_process"))},{_process:7}],4:[function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}var o=Object.prototype.hasOwnProperty;t.exports=function(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(var i=0;i<n.length;i++)if(!o.call(t,n[i])||!r(e[n[i]],t[n[i]]))return!1;return!0}},{}],5:[function(e,t,n){(function(n){"use strict";var r=e("./emptyFunction");if("production"!==n.env.NODE_ENV){var o=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,s="Warning: "+e.replace(/%s/g,function(){return n[o++]});try{throw new Error(s)}catch(e){}};r=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];o.apply(void 0,[t].concat(r))}}}t.exports=r}).call(this,e("_process"))},{"./emptyFunction":2,_process:7}],6:[function(e,t,n){(function(e){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||r(e)&&b.call(e)==a}function s(e){if("number"==typeof e)return e;if(o(e))return u;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var r=p.test(e);return r||f.test(e)?g(e.slice(2),r?2:8):c.test(e)?u:+e}var i="Expected a function",u=NaN,a="[object Symbol]",l=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,f=/^0o[0-7]+$/i,g=parseInt,d="object"==typeof e&&e&&e.Object===Object&&e,h="object"==typeof self&&self&&self.Object===Object&&self,y=d||h||Function("return this")(),b=Object.prototype.toString,v=Math.max,m=Math.min,S=function(){return y.Date.now()};t.exports=function(e,t,r){function o(t){var n=g,r=d;return g=d=void 0,O=t,y=e.apply(r,n)}function u(e){return O=e,b=setTimeout(c,t),j?o(e):y}function a(e){var n=t-(e-w);return _?m(n,h-(e-O)):n}function l(e){var n=e-w;return void 0===w||n>=t||n<0||_&&e-O>=h}function c(){var e=S();if(l(e))return p(e);b=setTimeout(c,a(e))}function p(e){return b=void 0,T&&g?o(e):(g=d=void 0,y)}function f(){var e=S(),n=l(e);if(g=arguments,d=this,w=e,n){if(void 0===b)return u(w);if(_)return b=setTimeout(c,t),o(w)}return void 0===b&&(b=setTimeout(c,t)),y}var g,d,h,y,b,w,O=0,j=!1,_=!1,T=!0;if("function"!=typeof e)throw new TypeError(i);return t=s(t)||0,n(r)&&(j=!!r.leading,h=(_="maxWait"in r)?v(s(r.maxWait)||0,t):h,T="trailing"in r?!!r.trailing:T),f.cancel=function(){void 0!==b&&clearTimeout(b),O=0,g=w=d=b=void 0},f.flush=function(){return void 0===b?y:p(S())},f}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(p===setTimeout)return setTimeout(e,0);if((p===r||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===o||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function u(){y&&d&&(y=!1,d.length?h=d.concat(h):b=-1,h.length&&a())}function a(){if(!y){var e=s(u);y=!0;for(var t=h.length;t;){for(d=h,h=[];++b<t;)d&&d[b].run();b=-1,t=h.length}d=null,y=!1,i(e)}}function l(e,t){this.fun=e,this.array=t}function c(){}var p,f,g=t.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:r}catch(e){p=r}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(e){f=o}}();var d,h=[],y=!1,b=-1;g.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new l(e,t)),1!==h.length||y||s(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},g.title="browser",g.browser=!0,g.env={},g.argv=[],g.version="",g.versions={},g.on=c,g.addListener=c,g.once=c,g.off=c,g.removeListener=c,g.removeAllListeners=c,g.emit=c,g.binding=function(e){throw new Error("process.binding is not supported")},g.cwd=function(){return"/"},g.chdir=function(e){throw new Error("process.chdir is not supported")},g.umask=function(){return 0}},{}],8:[function(e,t,n){(function(n){"use strict";if("production"!==n.env.NODE_ENV)var r=e("fbjs/lib/invariant"),o=e("fbjs/lib/warning"),s=e("./lib/ReactPropTypesSecret"),i={};t.exports=function(e,t,u,a,l){if("production"!==n.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var p;try{r("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",a||"React class",u,c,typeof e[c]),p=e[c](t,c,a,u,null,s)}catch(e){p=e}if(o(!p||p instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",u,c,typeof p),p instanceof Error&&!(p.message in i)){i[p.message]=!0;var f=l?l():"";o(!1,"Failed %s type: %s%s",u,p.message,null!=f?f:"")}}}}).call(this,e("_process"))},{"./lib/ReactPropTypesSecret":12,_process:7,"fbjs/lib/invariant":3,"fbjs/lib/warning":5}],9:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),s=e("./lib/ReactPropTypesSecret");t.exports=function(){function e(e,t,n,r,i,u){u!==s&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":2,"fbjs/lib/invariant":3}],10:[function(e,t,n){(function(n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),s=e("fbjs/lib/warning"),i=e("object-assign"),u=e("./lib/ReactPropTypesSecret"),a=e("./checkPropTypes");t.exports=function(e,t){function l(e){var t=e&&(S&&e[S]||e[w]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function p(e){this.message=e,this.stack=""}function f(e){function r(r,l,c,f,g,d,h){if(f=f||O,d=d||c,h!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==n.env.NODE_ENV&&"undefined"!=typeof console){var y=f+":"+c;!i[y]&&a<3&&(s(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),i[y]=!0,a++)}return null==l[c]?r?new p(null===l[c]?"The "+g+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+g+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(l,c,f,g,d)}if("production"!==n.env.NODE_ENV)var i={},a=0;var l=r.bind(null,!1);return l.isRequired=r.bind(null,!0),l}function g(e){return f(function(t,n,r,o,s,i){var u=t[n];return y(u)!==e?new p("Invalid "+o+" `"+s+"` of type `"+b(u)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var n=l(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!d(r.value))return!1}else for(;!(r=o.next()).done;){var s=r.value;if(s&&!d(s[1]))return!1}return!0;default:return!1}}function h(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":h(t,e)?"symbol":t}function b(e){if(void 0===e||null===e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function v(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function m(e){return e.constructor&&e.constructor.name?e.constructor.name:O}var S="function"==typeof Symbol&&Symbol.iterator,w="@@iterator",O="<<anonymous>>",j={array:g("array"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:f(r.thatReturnsNull),arrayOf:function(e){return f(function(t,n,r,o,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new p("Invalid "+o+" `"+s+"` of type `"+y(i)+"` supplied to `"+r+"`, expected an array.");for(var a=0;a<i.length;a++){var l=e(i,a,r,o,s+"["+a+"]",u);if(l instanceof Error)return l}return null})},element:f(function(t,n,r,o,s){var i=t[n];return e(i)?null:new p("Invalid "+o+" `"+s+"` of type `"+y(i)+"` supplied to `"+r+"`, expected a single ReactElement.")}),instanceOf:function(e){return f(function(t,n,r,o,s){if(!(t[n]instanceof e)){var i=e.name||O;return new p("Invalid "+o+" `"+s+"` of type `"+m(t[n])+"` supplied to `"+r+"`, expected instance of `"+i+"`.")}return null})},node:f(function(e,t,n,r,o){return d(e[t])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return f(function(t,n,r,o,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],a=y(i);if("object"!==a)return new p("Invalid "+o+" `"+s+"` of type `"+a+"` supplied to `"+r+"`, expected an object.");for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,s+"."+l,u);if(c instanceof Error)return c}return null})},oneOf:function(e){return Array.isArray(e)?f(function(t,n,r,o,s){for(var i=t[n],u=0;u<e.length;u++)if(c(i,e[u]))return null;return new p("Invalid "+o+" `"+s+"` of value `"+i+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}):("production"!==n.env.NODE_ENV&&s(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==n.env.NODE_ENV&&s(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return s(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",v(o),t),r.thatReturnsNull}return f(function(t,n,r,o,s){for(var i=0;i<e.length;i++)if(null==(0,e[i])(t,n,r,o,s,u))return null;return new p("Invalid "+o+" `"+s+"` supplied to `"+r+"`.")})},shape:function(e){return f(function(t,n,r,o,s){var i=t[n],a=y(i);if("object"!==a)return new p("Invalid "+o+" `"+s+"` of type `"+a+"` supplied to `"+r+"`, expected `object`.");for(var l in e){var c=e[l];if(c){var f=c(i,l,r,o,s+"."+l,u);if(f)return f}}return null})},exact:function(e){return f(function(t,n,r,o,s){var a=t[n],l=y(a);if("object"!==l)return new p("Invalid "+o+" `"+s+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");var c=i({},t[n],e);for(var f in c){var g=e[f];if(!g)return new p("Invalid "+o+" `"+s+"` key `"+f+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var d=g(a,f,r,o,s+"."+f,u);if(d)return d}return null})}};return p.prototype=Error.prototype,j.checkPropTypes=a,j.PropTypes=j,j}}).call(this,e("_process"))},{"./checkPropTypes":8,"./lib/ReactPropTypesSecret":12,_process:7,"fbjs/lib/emptyFunction":2,"fbjs/lib/invariant":3,"fbjs/lib/warning":5,"object-assign":13}],11:[function(e,t,n){(function(n){if("production"!==n.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=e("./factoryWithTypeCheckers")(function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},!0)}else t.exports=e("./factoryWithThrowingShims")()}).call(this,e("_process"))},{"./factoryWithThrowingShims":9,"./factoryWithTypeCheckers":10,_process:7}],12:[function(e,t,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}],13:[function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,a=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var c in n)s.call(n,c)&&(a[c]=n[c]);if(o){u=o(n);for(var p=0;p<u.length;p++)i.call(n,u[p])&&(a[u[p]]=n[u[p]])}}return a}},{}],14:[function(e,t,n){"use strict";var r=e("fbjs/lib/shallowEqual");t.exports=function(e,t,n){return!r(e.props,t)||!r(e.state,n)}},{"fbjs/lib/shallowEqual":4}],15:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=r(window.React),f=r(e("classnames")),g=r(e("lodash.debounce")),d=r(e("./defaults")),h=r(e("./prop-types")),y=r(e("./filter-input-attributes")),b=r(e("./input")),v=r(e("./suggest-list")),m=function(e){function t(e){o(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.onInputChange=function(e){e||n.props.onSuggestSelect(),n.setState({userInput:e},n.onAfterInputChange)},n.onAfterInputChange=function(){n.showSuggests(),n.props.onChange(n.state.userInput)},n.onInputFocus=function(){n.props.onFocus(),n.showSuggests()},n.onInputBlur=function(){n.state.ignoreBlur||n.hideSuggests()},n.onNext=function(){return n.activateSuggest("next")},n.onPrev=function(){return n.activateSuggest("prev")},n.onSelect=function(){return n.selectSuggest(n.state.activeSuggest)},n.onSuggestMouseDown=function(){return n.setState({ignoreBlur:!0})},n.onSuggestMouseOut=function(){return n.setState({ignoreBlur:!1})},n.onSuggestNoResults=function(){n.props.onSuggestNoResults(n.state.userInput)},n.hideSuggests=function(){n.props.onBlur(n.state.userInput),n.timer=setTimeout(function(){n.setState({isSuggestsHidden:!0,activeSuggest:null})},100)},n.selectSuggest=function(e){if(e||(e={label:n.state.userInput}),n.setState({isSuggestsHidden:!0,userInput:"object"!==l(e.label)?e.label:e.description}),e.location)return n.setState({ignoreBlur:!1}),void n.props.onSuggestSelect(e);n.geocodeSuggest(e)},n.state={isSuggestsHidden:!0,isLoading:!1,userInput:e.initialValue,activeSuggest:null,suggests:[]},n.onInputChange=n.onInputChange.bind(n),n.onAfterInputChange=n.onAfterInputChange.bind(n),e.queryDelay&&(n.onAfterInputChange=(0,g.default)(n.onAfterInputChange,e.queryDelay)),n}return i(t,p.default.Component),c(t,[{key:"componentWillReceiveProps",value:function(e){this.props.initialValue!==e.initialValue&&this.setState({userInput:e.initialValue})}},{key:"componentWillMount",value:function(){if("undefined"!=typeof window){var e=this.props.googleMaps||window.google&&window.google.maps||this.googleMaps;e?(this.googleMaps=e,this.autocompleteService=new e.places.AutocompleteService,this.geocoder=new e.Geocoder):console}}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timer)}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"update",value:function(e){this.setState({userInput:e}),this.props.onChange(e)}},{key:"clear",value:function(){this.setState({userInput:""},this.hideSuggests)}},{key:"searchSuggests",value:function(){var e=this;if(this.state.userInput){var t={input:this.state.userInput};this.state.userInput.length<this.props.minLength||(["location","radius","bounds","types"].forEach(function(n){e.props[n]&&(t[n]=e.props[n])}),this.props.country&&(t.componentRestrictions={country:this.props.country}),this.setState({isLoading:!0},function(){e.autocompleteService.getPlacePredictions(t,function(t){e.setState({isLoading:!1}),e.updateSuggests(t||[],function(){e.props.autoActivateFirstSuggest&&!e.state.activeSuggest&&e.activateSuggest("next")})})}))}else this.updateSuggests()}},{key:"updateSuggests",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1],r=[],o=this.state.userInput,s=new RegExp(u(o),"gim"),i=this.props.skipSuggest,a=this.props.maxFixtures,l=0,c=null;this.props.fixtures.forEach(function(e){l>=a||!i(e)&&e.label.match(s)&&(l++,e.placeId=e.label,e.isFixture=!0,e.matchedSubstrings={offset:e.label.indexOf(o),length:o.length},r.push(e))}),t.forEach(function(t){i(t)||r.push({description:t.description,label:e.props.getSuggestLabel(t),placeId:t.place_id,isFixture:!1,matchedSubstrings:t.matched_substrings[0]})}),c=this.updateActiveSuggest(r),this.props.onUpdateSuggests(r,c),this.setState({suggests:r,activeSuggest:c},n)}},{key:"updateActiveSuggest",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.state.activeSuggest;if(t){var n=e.filter(function(e){return t.placeId===e.placeId&&t.isFixture===e.isFixture})[0];t=n||null}return t}},{key:"showSuggests",value:function(){this.searchSuggests(),this.setState({isSuggestsHidden:!1})}},{key:"activateSuggest",value:function(e){if(this.state.isSuggestsHidden)this.showSuggests();else{var t=this.state.suggests.length-1,n="next"===e,r=null,o=0,s=0;for(s;s<=t;s++)this.state.suggests[s]===this.state.activeSuggest&&(o=n?s+1:s-1);this.state.activeSuggest||(o=n?0:t),o>=0&&o<=t&&(r=this.state.suggests[o]),this.props.onActivateSuggest(r),this.setState({activeSuggest:r})}}},{key:"geocodeSuggest",value:function(e){var t=this,n=null;n=e.placeId&&!e.isFixture?{placeId:e.placeId}:{address:e.label,location:this.props.location,bounds:this.props.bounds,componentRestrictions:this.props.country?{country:this.props.country}:null},this.geocoder.geocode(n,function(n,r){if(r===t.googleMaps.GeocoderStatus.OK){var o=n[0],s=o.geometry.location;e.gmaps=o,e.location={lat:s.lat(),lng:s.lng()}}t.props.onSuggestSelect(e)})}},{key:"render",value:function(){var e=this,t=(0,y.default)(this.props),n=(0,f.default)("geosuggest",this.props.className,{"geosuggest--loading":this.state.isLoading}),r=this.props.label&&t.id,o=p.default.createElement(b.default,a({className:this.props.inputClassName,ref:function(t){return e.input=t},value:this.state.userInput,ignoreEnter:!this.state.isSuggestsHidden,ignoreTab:this.props.ignoreTab,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},t)),s=p.default.createElement(v.default,{isHidden:this.state.isSuggestsHidden,style:this.props.style.suggests,suggestItemStyle:this.props.style.suggestItem,userInput:this.state.userInput,isHighlightMatch: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,minLength:this.props.minLength});return p.default.createElement("div",{className:n},p.default.createElement("div",{className:"geosuggest__input-wrapper"},r&&p.default.createElement("label",{className:"geosuggest__label",htmlFor:t.id},this.props.label),o),p.default.createElement("div",{className:"geosuggest__suggests-wrapper"},s))}}]),t}();m.propTypes=h.default,m.defaultProps=d.default,n.default=m},{"./defaults":16,"./filter-input-attributes":17,"./input":18,"./prop-types":19,"./suggest-list":21,classnames:1,"lodash.debounce":6}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={fixtures:[],maxFixtures:10,initialValue:"",placeholder:"Search places",disabled:!1,className:"",inputClassName:"",location:null,radius:null,bounds:null,country:null,types:null,queryDelay:250,googleMaps:null,highlightMatch:!0,onActivateSuggest:function(){},onSuggestSelect:function(){},onSuggestNoResults:function(){},onUpdateSuggests:function(){},onFocus:function(){},onBlur:function(){},onChange:function(){},skipSuggest:function(){},getSuggestLabel:function(e){return e.description},renderSuggestItem:null,autoActivateFirstSuggest:!1,style:{input:{},suggests:{},suggestItem:{}},ignoreTab:!1,minLength:1}},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){var t={};return r.forEach(function(n){e[n]&&(t[n]=e[n])}),t};var r=["autoCapitalize","autoComplete","autoCorrect","autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","height","id","inputMode","maxLength","name","onClick","onContextMenu","onCopy","onCut","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onPaste","pattern","placeholder","readOnly","required","size","spellCheck","tabIndex","title","aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription","aria-activedescendant","aria-autocomplete","aria-multiline","aria-placeholder","aria-readonly","aria-required"]},{}],18:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("react-addons-shallow-compare")),p=r(e("classnames")),f=r(e("./filter-input-attributes")),g=function(e){function t(){var e,n,r,i;o(this,t);for(var u=arguments.length,a=Array(u),l=0;l<u;l++)a[l]=arguments[l];return n=r=s(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onChange=function(){r.props.onChange(r.input.value)},r.onFocus=function(){r.props.onFocus()},r.onBlur=function(){r.props.onBlur()},r.onKeyPress=function(e){r.props.onKeyPress(e)},r.onInputKeyDown=function(e){switch(r.props.onKeyDown&&r.props.onKeyDown(e),e.which){case 40:e.shiftKey||(e.preventDefault(),r.props.onNext());break;case 38:e.shiftKey||(e.preventDefault(),r.props.onPrev());break;case 13:r.props.ignoreEnter&&e.preventDefault(),r.props.onSelect();break;case 9:r.props.ignoreTab||r.props.onSelect();break;case 27:r.props.onEscape()}},i=n,s(r,i)}return i(t,l.default.Component),a(t,[{key:"shouldComponentUpdate",value:function(e,t){return(0,c.default)(this,e,t)}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"render",value:function(){var e=this,t=(0,f.default)(this.props),n=(0,p.default)("geosuggest__input",this.props.className);return l.default.createElement("input",u({className:n,ref:function(t){return e.input=t},type:"text"},t,{value:this.props.value,style:this.props.style,onKeyDown:this.onInputKeyDown,onChange:this.onChange,onKeyPress:this.onKeyPress,onFocus:this.onFocus,onBlur:this.onBlur}))}}]),t}();g.defaultProps={className:"",value:"",ignoreTab:!1,onKeyDown:function(){},onKeyPress:function(){},autoComplete:"off"},n.default=g},{"./filter-input-attributes":17,classnames:1,"react-addons-shallow-compare":14}],19:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(e("prop-types"));n.default={fixtures:r.default.array,maxFixtures:r.default.number,initialValue:r.default.string,placeholder:r.default.string,disabled:r.default.bool,className:r.default.string,inputClassName:r.default.string,suggestsClassName:r.default.string,suggestsHiddenClassName:r.default.string,suggestItemClassName:r.default.string,suggestItemActiveClassName:r.default.string,location:r.default.object,radius:r.default.oneOfType([r.default.string,r.default.number]),bounds:r.default.object,country:r.default.oneOfType([r.default.string,r.default.array]),types:r.default.array,queryDelay:r.default.number,googleMaps:r.default.object,highlightMatch:r.default.bool,onSuggestSelect:r.default.func,onFocus:r.default.func,onBlur:r.default.func,onChange:r.default.func,onKeyPress:r.default.func,onUpdateSuggests:r.default.func,skipSuggest:r.default.func,getSuggestLabel:r.default.func,renderSuggestItem:r.default.func,autoActivateFirstSuggest:r.default.bool,style:r.default.shape({input:r.default.object,suggests:r.default.object,suggestItem:r.default.object}),ignoreTab:r.default.bool,label:r.default.string,autoComplete:r.default.string,minLength:r.default.number}},{"prop-types":11}],20:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("classnames")),p=function(e){function t(){var e,n,r,o;s(this,t);for(var u=arguments.length,a=Array(u),l=0;l<u;l++)a[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.onClick=function(e){e.preventDefault(),r.props.onSelect(r.props.suggest)},o=n,i(r,o)}return u(t,l.default.Component),a(t,[{key:"makeBold",value:function(e,t){return l.default.createElement("b",{className:"geosuggest__item__matched-text",key:t},e)}},{key:"formatMatchedText",value:function(e,t){if(!e||!t.matchedSubstrings)return t.label;var n=t.matchedSubstrings.offset,r=n+t.matchedSubstrings.length,o=this.makeBold(t.label.substring(n,r),t.label),s="",i="";return n>0&&(s=t.label.slice(0,n)),r<t.label.length&&(i=t.label.slice(r)),l.default.createElement("span",null,s,o,i)}},{key:"componentWillReceiveProps",value:function(e){e.isActive&&!this.props.isActive&&this.scrollIfNeeded()}},{key:"scrollIfNeeded",value:function(){var e=this.ref,t=e.parentElement,n=e.offsetTop-t.offsetTop<t.scrollTop,r=e.offsetTop-t.offsetTop+e.clientHeight>t.scrollTop+t.clientHeight;(n||r)&&(t.scrollTop=e.offsetTop-t.offsetTop-t.clientHeight/2+e.clientHeight/2)}},{key:"render",value:function(){var e=this,t=this.props.suggest,n=(0,c.default)("geosuggest__item",this.props.className,this.props.suggestItemClassName,{"geosuggest__item--active":this.props.isActive},o({},this.props.activeClassname,this.props.activeClassname?this.props.isActive:null)),r=t.label;return this.props.renderSuggestItem?r=this.props.renderSuggestItem(t):this.props.isHighlightMatch&&(r=this.formatMatchedText(this.props.userInput,t)),l.default.createElement("li",{className:n,ref:function(t){return e.ref=t},style:this.props.style,onMouseDown:this.props.onMouseDown,onMouseOut:this.props.onMouseOut,onClick:this.onClick},r)}}]),t}();n.default=p,p.defaultProps={isActive:!1,className:"",suggest:{}}},{classnames:1}],21:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=r(window.React),c=r(e("react-addons-shallow-compare")),p=r(e("classnames")),f=r(e("./suggest-item")),g=function(e){function t(){return s(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,l.default.Component),a(t,[{key:"shouldComponentUpdate",value:function(e,t){return(0,c.default)(this,e,t)}},{key:"isHidden",value:function(){return this.props.isHidden||0===this.props.suggests.length}},{key:"componentWillReceiveProps",value:function(e){e.suggests!==this.props.suggests&&0===e.suggests.length&&this.props.onSuggestNoResults()}},{key:"render",value:function(){var e=this,t=(0,p.default)("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},o({},this.props.hiddenClassName,this.props.hiddenClassName?this.isHidden():null));return l.default.createElement("ul",{className:t,style:this.props.style},this.props.suggests.map(function(t){var n=e.props.activeSuggest&&t.placeId===e.props.activeSuggest.placeId,r=t.key||t.placeId;return l.default.createElement(f.default,{key:r,className:t.className,userInput:e.props.userInput,isHighlightMatch:e.props.isHighlightMatch,suggest:t,style:e.props.suggestItemStyle,suggestItemClassName:e.props.suggestItemClassName,isActive:n,activeClassname:e.props.suggestItemActiveClassName,onMouseDown:e.props.onSuggestMouseDown,onMouseOut:e.props.onSuggestMouseOut,onSelect:e.props.onSuggestSelect,renderSuggestItem:e.props.renderSuggestItem})}))}}]),t}();n.default=g,g.defaultProps={isHidden:!0,suggests:[]}},{"./suggest-item":20,classnames:1,"react-addons-shallow-compare":14}]},{},[15])(15)}); |
@@ -29,2 +29,3 @@ 'use strict'; | ||
onSuggestNoResults: function onSuggestNoResults() {}, | ||
onUpdateSuggests: function onUpdateSuggests() {}, | ||
onFocus: function onFocus() {}, | ||
@@ -31,0 +32,0 @@ onBlur: function onBlur() {}, |
@@ -388,2 +388,4 @@ 'use strict'; | ||
activeSuggest = this.updateActiveSuggest(suggests); | ||
this.props.onUpdateSuggests(suggests, activeSuggest); | ||
this.setState({ suggests: suggests, activeSuggest: activeSuggest }, callback); | ||
@@ -390,0 +392,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict'; | ||
/** | ||
* Default values | ||
* Prop Types | ||
*/ | ||
@@ -42,2 +42,3 @@ exports.default = { | ||
onKeyPress: _propTypes2.default.func, | ||
onUpdateSuggests: _propTypes2.default.func, | ||
skipSuggest: _propTypes2.default.func, | ||
@@ -44,0 +45,0 @@ getSuggestLabel: _propTypes2.default.func, |
{ | ||
"name": "react-geosuggest", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "A React autosuggest for the Google Maps Places API.", | ||
@@ -5,0 +5,0 @@ "main": "module/Geosuggest.js", |
@@ -217,2 +217,8 @@ # React Geosuggest [![Build Status](https://travis-ci.org/ubilabs/react-geosuggest.svg?branch=master)](https://travis-ci.org/ubilabs/react-geosuggest) | ||
#### 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. | ||
#### onActivateSuggest | ||
@@ -219,0 +225,0 @@ Type: `Function` |
@@ -572,2 +572,21 @@ import React from 'react'; // eslint-disable-line no-unused-vars | ||
describe('with onUpdateSuggests', () => { | ||
const props = { | ||
onUpdateSuggests: sinon.spy() | ||
}; | ||
beforeEach(() => render(props)); | ||
it('should call onUpdateSuggests when input onChange is triggered', () => { // eslint-disable-line max-len | ||
const geoSuggestInput = TestUtils.findRenderedDOMComponentWithClass(component, 'geosuggest__input'); // eslint-disable-line | ||
geoSuggestInput.value = 'New York City'; | ||
TestUtils.Simulate.change(geoSuggestInput); | ||
setImmediate(() => { | ||
expect(props.onUpdateSuggests.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions, max-len | ||
done(); // eslint-disable-line | ||
}); | ||
}); | ||
}); | ||
describe('with renderSuggestItem with custom fixture attributes', () => { | ||
@@ -574,0 +593,0 @@ const fixtures = [ |
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 not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349994
5257
406