Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-geosuggest

Package Overview
Dependencies
Maintainers
3
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-geosuggest - npm Package Compare versions

Comparing version 2.13.1 to 2.14.0

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## 2.14.0 (2020-07-27)
#### Bug Fixes
* geocode in selectSuggest when nothing selected (#470) ([ada1de9f](https://github.com/ubilabs/react-geosuggest/commit/ada1de9fb6c3549639149cc6c627cfdaac1ebe4f))
#### Features
* add option for search input type (#471) ([58264de2](https://github.com/ubilabs/react-geosuggest/commit/58264de27f11316c0abc7aa927bb3f9be709ea89), closes [#441](https://github.com/ubilabs/react-geosuggest/issues/441))
### 2.13.1 (2020-06-19)

@@ -2,0 +15,0 @@

10

dist/react-geosuggest.js

@@ -499,3 +499,4 @@ var Geosuggest = (function (React) {

skipSuggest: function () { return false; },
style: {}
style: {},
inputType: 'text'
};

@@ -683,3 +684,3 @@

shouldRenderLabel && (React.createElement("label", { className: "geosuggest__label", htmlFor: this.props.id }, this.props.label)),
React.createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
React.createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), ref: function (i) { return (_this.input = i); }, type: this.props.inputType }, 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
? this.props.activeSuggest.placeId

@@ -699,2 +700,3 @@ : // eslint-disable-next-line no-undefined

listId: '',
inputType: 'text',
onBlur: function () { },

@@ -1240,3 +1242,3 @@ onChange: function () { },

var suggest = suggestToSelect || {
isFixture: false,
isFixture: true,
label: this.state.userInput,

@@ -1336,3 +1338,3 @@ placeId: this.state.userInput

});
var input = (React.createElement(Input, __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, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var input = (React.createElement(Input, __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, inputType: this.props.inputType, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var suggestionsList = (React.createElement(default_1$1, { 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, listId: this.listId }));

@@ -1339,0 +1341,0 @@ return (React.createElement("div", { className: classes, id: this.props.id },

2

dist/react-geosuggest.min.js

@@ -1,1 +0,1 @@

var Geosuggest=function(u){"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 s in e)e.hasOwnProperty(s)&&(t[s]=e[s])})(t,e)};function n(t,e){function s(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}var c=function(){return(c=Object.assign||function(t){for(var e,s=1,o=arguments.length;s<o;s++)for(var n in e=arguments[s])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var e,i=(function(t){!function(){var r={}.hasOwnProperty;function u(){for(var t=[],e=0;e<arguments.length;e++){var s=arguments[e];if(s){var o=typeof s;if("string"==o||"number"==o)t.push(s);else if(Array.isArray(s)&&s.length){var n=u.apply(null,s);n&&t.push(n)}else if("object"==o)for(var i in s)r.call(s,i)&&s[i]&&t.push(i)}}return t.join(" ")}t.exports?(u.default=u,t.exports=u):window.classNames=u}()}(e={exports:{}},e.exports),e.exports),r=NaN,p="[object Symbol]",a=/^\s+|\s+$/g,g=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^0o[0-7]+$/i,d=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,f="object"==typeof self&&self&&self.Object===Object&&self,S=s||f||Function("return this")(),m=Object.prototype.toString,v=Math.max,y=Math.min,b=function(){return S.Date.now()};function I(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function w(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&m.call(t)==p}(t))return r;if(I(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=I(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var s=l.test(t);return s||h.test(t)?d(t.slice(2),s?2:8):g.test(t)?r:+t}var C=function(o,s,t){var n,i,r,u,p,a,g=0,l=!1,c=!1,e=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function h(t){var e=n,s=i;return n=i=void 0,g=t,u=o.apply(s,e)}function d(t){var e=t-a;return void 0===a||s<=e||e<0||c&&r<=t-g}function f(){var t=b();if(d(t))return S(t);p=setTimeout(f,function(t){var e=s-(t-a);return c?y(e,r-(t-g)):e}(t))}function S(t){return p=void 0,e&&n?h(t):(n=i=void 0,u)}function m(){var t=b(),e=d(t);if(n=arguments,i=this,a=t,e){if(void 0===p)return function(t){return g=t,p=setTimeout(f,s),l?h(t):u}(a);if(c)return p=setTimeout(f,s),h(a)}return void 0===p&&(p=setTimeout(f,s)),u}return s=w(s)||0,I(t)&&(l=!!t.leading,r=(c="maxWait"in t)?v(w(t.maxWait)||0,s):r,e="trailing"in t?!!t.trailing:e),m.cancel=function(){void 0!==p&&clearTimeout(p),n=a=i=p=void(g=0)},m.flush=function(){return void 0===p?u:S(b())},m},N={autoActivateFirstSuggest:!1,disabled:!1,fixtures:[],getSuggestLabel:function(t){return t.description},highlightMatch:!0,ignoreEnter:!1,ignoreTab:!1,initialValue:"",maxFixtures:10,minLength:1,onKeyDown:function(){},onKeyPress:function(){},placeholder:"Search places",queryDelay:250,skipSuggest:function(){return!1},style:{}},x=["autoCapitalize","autoComplete","autoCorrect","autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","height","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"];function M(s){var o={};return Object.keys(s).forEach(function(t){var e=t.startsWith("data-");(x.includes(t)||e)&&(o[t]=s[t])}),o}var D=function(s){function t(t){var e=s.call(this,t)||this;return e.input=null,e.onChange=e.onChange.bind(e),e.onInputKeyDown=e.onInputKeyDown.bind(e),e}return n(t,s),t.prototype.onChange=function(){this.input&&this.props.onChange(this.input.value)},t.prototype.onInputKeyDown=function(t){switch(this.props.onKeyDown&&this.props.onKeyDown(t),t.which){case 40:t.shiftKey||(t.preventDefault(),this.props.onNext());break;case 38:t.shiftKey||(t.preventDefault(),this.props.onPrev());break;case 13:this.props.doNotSubmitOnEnter&&t.preventDefault(),this.props.ignoreEnter||this.props.onSelect();break;case 9:this.props.ignoreTab||this.props.onSelect();break;case 27:this.props.onEscape()}},t.prototype.focus=function(){this.input&&this.input.focus()},t.prototype.blur=function(){this.input&&this.input.blur()},t.prototype.render=function(){var e=this,t=M(this.props),s=i("geosuggest__input",this.props.className),o=this.props.label&&this.props.id;return t.tabIndex||(t.tabIndex=0),u.createElement(u.Fragment,null,o&&u.createElement("label",{className:"geosuggest__label",htmlFor:this.props.id},this.props.label),u.createElement("input",c({className:s,id:"geosuggest__input"+(this.props.id?"--"+this.props.id:""),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.props.onKeyPress,onFocus:this.props.onFocus,onBlur:this.props.onBlur,role:"combobox","aria-expanded":!this.props.isSuggestsHidden,"aria-activedescendant":this.props.activeSuggest?this.props.activeSuggest.placeId:void 0,"aria-owns":this.props.listId})))},t.defaultProps={activeSuggest:null,autoComplete:"nope",className:"",isSuggestsHidden:!0,listId:"",onBlur:function(){},onChange:function(){},onEscape:function(){},onFocus:function(){},onKeyDown:function(){},onKeyPress:function(){},onNext:function(){},onPrev:function(){},onSelect:function(){},value:""},t}(u.PureComponent),T=function(s){function t(t){var e=s.call(this,t)||this;return e.ref=null,e.onClick=e.onClick.bind(e),e}return n(t,s),t.prototype.makeBold=function(t,e){return u.createElement("b",{className:"geosuggest__item__matched-text",key:e},t)},t.prototype.formatMatchedText=function(t,e){if(!t||!e.matchedSubstrings)return e.label;var s=e.matchedSubstrings.offset,o=s+e.matchedSubstrings.length,n=this.makeBold(e.label.substring(s,o),e.label),i="",r="";return 0<s&&(i=e.label.slice(0,s)),o<e.label.length&&(r=e.label.slice(o)),u.createElement("span",null,i,n,r)},t.prototype.componentDidUpdate=function(t){!t.isActive&&this.props.isActive&&this.scrollIfNeeded()},t.prototype.scrollIfNeeded=function(){var t=this.ref,e=t&&t.parentElement;if(t&&e){var s=t.offsetTop-e.offsetTop<e.scrollTop,o=t.offsetTop-e.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;(s||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,s=this.props.suggest,o=i("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=s.label;return this.props.renderSuggestItem?n=this.props.renderSuggestItem(s,this.props.userInput):this.props.isHighlightMatch&&(n=this.formatMatchedText(this.props.userInput,s)),u.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,role:"option","aria-selected":this.props.isActive,id:s.placeId},n)},t}(u.PureComponent),O=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.componentDidUpdate=function(t){t.suggests!==this.props.suggests&&0===this.props.suggests.length&&this.props.onSuggestNoResults()},e.prototype.render=function(){var t,s=this,e=i("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},((t={})[this.props.hiddenClassName||""]=this.props.hiddenClassName?this.isHidden():null,t));return u.createElement("ul",{className:e,style:this.props.style,role:"listbox",id:this.props.listId},this.props.suggests.map(function(t){var e=s.props.activeSuggest&&t.placeId===s.props.activeSuggest.placeId||!1;return u.createElement(T,{key:t.placeId,className:t.className||"",userInput:s.props.userInput,isHighlightMatch:s.props.isHighlightMatch,suggest:t,style:s.props.suggestItemStyle,suggestItemClassName:s.props.suggestItemClassName,isActive:e,activeClassName:s.props.suggestItemActiveClassName,onMouseDown:s.props.onSuggestMouseDown,onMouseOut:s.props.onSuggestMouseOut,onSelect:s.props.onSuggestSelect,renderSuggestItem:s.props.renderSuggestItem})}))},e}(u.PureComponent);return function(s){function t(t){var e=s.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),e.listId="geosuggest__list"+(t.id?"--"+t.id:""),t.queryDelay&&(e.onAfterInputChange=C(e.onAfterInputChange,t.queryDelay)),e}return n(t,s),t.prototype.componentDidUpdate=function(t){t.initialValue!==this.props.initialValue&&this.setState({userInput:this.props.initialValue||""}),JSON.stringify(t.fixtures)!==JSON.stringify(this.props.fixtures)&&this.searchSuggests()},t.prototype.componentDidMount=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},s=this.state.userInput.length;if(this.props.minLength&&s<this.props.minLength)this.updateSuggests();else{var o=this.props,n=o.location,i=o.radius,r=o.bounds,u=o.types,p=o.country;n&&(t.location=n),i&&(t.radius=Number(this.props.radius)),r&&(t.bounds=r),u&&(t.types=u),p&&(t.componentRestrictions={country:p}),this.setState({isLoading:!0},function(){e.autocompleteService?e.autocompleteService.getPlacePredictions(t,function(t){e.setState({isLoading:!1}),e.updateSuggests(t||[],function(){e.props.autoActivateFirstSuggest&&!e.state.activeSuggest&&e.activateSuggest("next")})}):e.setState({isLoading:!1})})}}else this.updateSuggests()},t.prototype.updateSuggests=function(t,e){var s=this;void 0===t&&(t=[]),void 0===e&&(e=function(){});var o,n=[],i=this.state.userInput,r=this.props,u=r.skipSuggest,p=r.maxFixtures,a=r.fixtures,g=new RegExp(function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(i),"gim"),l=0;a&&a.forEach(function(t){p&&p<=l||u&&!u(t)&&t.label.match(g)&&(l++,n.push(c(c({},t),{isFixture:!0,matchedSubstrings:{length:i.length,offset:t.label.indexOf(i)},placeId:t.placeId||t.label})))}),t.forEach(function(t){u&&!u(t)&&n.push({description:t.description,isFixture:!1,label:s.props.getSuggestLabel?s.props.getSuggestLabel(t):"",matchedSubstrings:t.matched_substrings[0],placeId:t.place_id})}),o=this.updateActiveSuggest(n),this.props.onUpdateSuggests&&this.props.onUpdateSuggests(n,o),this.setState({suggests:n,activeSuggest:o},e)},t.prototype.updateActiveSuggest=function(t){void 0===t&&(t=[]);var e=this.state.activeSuggest;if(e){var s=t.filter(function(t){return e&&e.placeId===t.placeId&&e.isFixture===t.isFixture})[0];e=s||null}return e},t.prototype.showSuggests=function(){this.searchSuggests(),this.setState({isSuggestsHidden:!1})},t.prototype.hideSuggests=function(){var t=this;this.props.onBlur&&this.props.onBlur(this.state.userInput),this.timer=window.setTimeout(function(){t.setState({activeSuggest:null,isSuggestsHidden:!0})},100)},t.prototype.activateSuggest=function(t){if(this.state.isSuggestsHidden)this.showSuggests();else{for(var e=this.state.suggests.length-1,s="next"===t,o=null,n=0,i=0;i<=e;i++)this.state.suggests[i]===this.state.activeSuggest&&(n=s?i+1:i-1);this.state.activeSuggest||(n=s?0:e),0<=n&&n<=e&&(o=this.state.suggests[n]),this.props.onActivateSuggest&&this.props.onActivateSuggest(o),this.setState({activeSuggest:o})}},t.prototype.selectSuggest=function(t){var e=t||{isFixture:!1,label:this.state.userInput,placeId:this.state.userInput};if(!t&&this.props.autoActivateFirstSuggest&&0<this.state.suggests.length&&(e=this.state.suggests[0]),this.setState({isSuggestsHidden:!0,userInput:"object"!=typeof e.label?e.label:e.description||""}),e.location)return this.setState({ignoreBlur:!1}),void(this.props.onSuggestSelect&&this.props.onSuggestSelect(e));this.geocodeSuggest(e)},t.prototype.geocodeSuggest=function(i){var r=this;if(this.geocoder)if(i.placeId&&!i.isFixture&&this.placesService){var t={placeId:i.placeId,sessionToken:this.sessionToken};this.props.placeDetailFields&&(t.fields=this.props.placeDetailFields,t.fields.unshift("geometry")),this.placesService.getDetails(t,function(t,e){if(e===r.googleMaps.places.PlacesServiceStatus.OK){var s=t,o=s.geometry&&s.geometry.location,n=c(c({},i),{gmaps:s,location:{lat:o.lat(),lng:o.lng()}});r.sessionToken=new google.maps.places.AutocompleteSessionToken,r.props.onSuggestSelect&&r.props.onSuggestSelect(n)}})}else{t={address:i.label,bounds:this.props.bounds,componentRestrictions:this.props.country?{country:this.props.country}:void 0,location:this.props.location};this.geocoder.geocode(t,function(t,e){if(e===r.googleMaps.GeocoderStatus.OK){var s=t[0],o=s.geometry&&s.geometry.location,n=c(c({},i),{gmaps:s,location:{lat:o.lat(),lng:o.lng()}});r.props.onSuggestSelect&&r.props.onSuggestSelect(n)}})}},t.prototype.render=function(){var e=this,t=M(this.props),s=i("geosuggest",this.props.className,{"geosuggest--loading":this.state.isLoading}),o=u.createElement(D,c({className:this.props.inputClassName,ref:function(t){return e.input=t},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,isSuggestsHidden:this.state.isSuggestsHidden,activeSuggest:this.state.activeSuggest,label:this.props.label,id:this.props.id,listId:this.listId},t)),n=u.createElement(O,{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,listId:this.listId});return u.createElement("div",{className:s,id:this.props.id},u.createElement("div",{className:"geosuggest__input-wrapper"},o),u.createElement("div",{className:"geosuggest__suggests-wrapper"},n))},t.defaultProps=N,t}(u.Component)}(React);
var Geosuggest=function(u){"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 s in e)e.hasOwnProperty(s)&&(t[s]=e[s])})(t,e)};function n(t,e){function s(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}var c=function(){return(c=Object.assign||function(t){for(var e,s=1,o=arguments.length;s<o;s++)for(var n in e=arguments[s])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var e,i=(function(t){!function(){var r={}.hasOwnProperty;function u(){for(var t=[],e=0;e<arguments.length;e++){var s=arguments[e];if(s){var o=typeof s;if("string"==o||"number"==o)t.push(s);else if(Array.isArray(s)&&s.length){var n=u.apply(null,s);n&&t.push(n)}else if("object"==o)for(var i in s)r.call(s,i)&&s[i]&&t.push(i)}}return t.join(" ")}t.exports?(u.default=u,t.exports=u):window.classNames=u}()}(e={exports:{}},e.exports),e.exports),r=NaN,p="[object Symbol]",a=/^\s+|\s+$/g,g=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^0o[0-7]+$/i,d=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,f="object"==typeof self&&self&&self.Object===Object&&self,S=s||f||Function("return this")(),m=Object.prototype.toString,v=Math.max,y=Math.min,b=function(){return S.Date.now()};function I(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function w(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&m.call(t)==p}(t))return r;if(I(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=I(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var s=l.test(t);return s||h.test(t)?d(t.slice(2),s?2:8):g.test(t)?r:+t}var C=function(o,s,t){var n,i,r,u,p,a,g=0,l=!1,c=!1,e=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function h(t){var e=n,s=i;return n=i=void 0,g=t,u=o.apply(s,e)}function d(t){var e=t-a;return void 0===a||s<=e||e<0||c&&r<=t-g}function f(){var t=b();if(d(t))return S(t);p=setTimeout(f,function(t){var e=s-(t-a);return c?y(e,r-(t-g)):e}(t))}function S(t){return p=void 0,e&&n?h(t):(n=i=void 0,u)}function m(){var t=b(),e=d(t);if(n=arguments,i=this,a=t,e){if(void 0===p)return function(t){return g=t,p=setTimeout(f,s),l?h(t):u}(a);if(c)return p=setTimeout(f,s),h(a)}return void 0===p&&(p=setTimeout(f,s)),u}return s=w(s)||0,I(t)&&(l=!!t.leading,r=(c="maxWait"in t)?v(w(t.maxWait)||0,s):r,e="trailing"in t?!!t.trailing:e),m.cancel=function(){void 0!==p&&clearTimeout(p),n=a=i=p=void(g=0)},m.flush=function(){return void 0===p?u:S(b())},m},N={autoActivateFirstSuggest:!1,disabled:!1,fixtures:[],getSuggestLabel:function(t){return t.description},highlightMatch:!0,ignoreEnter:!1,ignoreTab:!1,initialValue:"",maxFixtures:10,minLength:1,onKeyDown:function(){},onKeyPress:function(){},placeholder:"Search places",queryDelay:250,skipSuggest:function(){return!1},style:{},inputType:"text"},x=["autoCapitalize","autoComplete","autoCorrect","autoFocus","disabled","form","formAction","formEncType","formMethod","formNoValidate","formTarget","height","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"];function M(s){var o={};return Object.keys(s).forEach(function(t){var e=t.startsWith("data-");(x.includes(t)||e)&&(o[t]=s[t])}),o}var T=function(s){function t(t){var e=s.call(this,t)||this;return e.input=null,e.onChange=e.onChange.bind(e),e.onInputKeyDown=e.onInputKeyDown.bind(e),e}return n(t,s),t.prototype.onChange=function(){this.input&&this.props.onChange(this.input.value)},t.prototype.onInputKeyDown=function(t){switch(this.props.onKeyDown&&this.props.onKeyDown(t),t.which){case 40:t.shiftKey||(t.preventDefault(),this.props.onNext());break;case 38:t.shiftKey||(t.preventDefault(),this.props.onPrev());break;case 13:this.props.doNotSubmitOnEnter&&t.preventDefault(),this.props.ignoreEnter||this.props.onSelect();break;case 9:this.props.ignoreTab||this.props.onSelect();break;case 27:this.props.onEscape()}},t.prototype.focus=function(){this.input&&this.input.focus()},t.prototype.blur=function(){this.input&&this.input.blur()},t.prototype.render=function(){var e=this,t=M(this.props),s=i("geosuggest__input",this.props.className),o=this.props.label&&this.props.id;return t.tabIndex||(t.tabIndex=0),u.createElement(u.Fragment,null,o&&u.createElement("label",{className:"geosuggest__label",htmlFor:this.props.id},this.props.label),u.createElement("input",c({className:s,id:"geosuggest__input"+(this.props.id?"--"+this.props.id:""),ref:function(t){return e.input=t},type:this.props.inputType},t,{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,role:"combobox","aria-expanded":!this.props.isSuggestsHidden,"aria-activedescendant":this.props.activeSuggest?this.props.activeSuggest.placeId:void 0,"aria-owns":this.props.listId})))},t.defaultProps={activeSuggest:null,autoComplete:"nope",className:"",isSuggestsHidden:!0,listId:"",inputType:"text",onBlur:function(){},onChange:function(){},onEscape:function(){},onFocus:function(){},onKeyDown:function(){},onKeyPress:function(){},onNext:function(){},onPrev:function(){},onSelect:function(){},value:""},t}(u.PureComponent),D=function(s){function t(t){var e=s.call(this,t)||this;return e.ref=null,e.onClick=e.onClick.bind(e),e}return n(t,s),t.prototype.makeBold=function(t,e){return u.createElement("b",{className:"geosuggest__item__matched-text",key:e},t)},t.prototype.formatMatchedText=function(t,e){if(!t||!e.matchedSubstrings)return e.label;var s=e.matchedSubstrings.offset,o=s+e.matchedSubstrings.length,n=this.makeBold(e.label.substring(s,o),e.label),i="",r="";return 0<s&&(i=e.label.slice(0,s)),o<e.label.length&&(r=e.label.slice(o)),u.createElement("span",null,i,n,r)},t.prototype.componentDidUpdate=function(t){!t.isActive&&this.props.isActive&&this.scrollIfNeeded()},t.prototype.scrollIfNeeded=function(){var t=this.ref,e=t&&t.parentElement;if(t&&e){var s=t.offsetTop-e.offsetTop<e.scrollTop,o=t.offsetTop-e.offsetTop+t.clientHeight>e.scrollTop+e.clientHeight;(s||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,s=this.props.suggest,o=i("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=s.label;return this.props.renderSuggestItem?n=this.props.renderSuggestItem(s,this.props.userInput):this.props.isHighlightMatch&&(n=this.formatMatchedText(this.props.userInput,s)),u.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,role:"option","aria-selected":this.props.isActive,id:s.placeId},n)},t}(u.PureComponent),O=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.componentDidUpdate=function(t){t.suggests!==this.props.suggests&&0===this.props.suggests.length&&this.props.onSuggestNoResults()},e.prototype.render=function(){var t,s=this,e=i("geosuggest__suggests",this.props.suggestsClassName,{"geosuggest__suggests--hidden":this.isHidden()},((t={})[this.props.hiddenClassName||""]=this.props.hiddenClassName?this.isHidden():null,t));return u.createElement("ul",{className:e,style:this.props.style,role:"listbox",id:this.props.listId},this.props.suggests.map(function(t){var e=s.props.activeSuggest&&t.placeId===s.props.activeSuggest.placeId||!1;return u.createElement(D,{key:t.placeId,className:t.className||"",userInput:s.props.userInput,isHighlightMatch:s.props.isHighlightMatch,suggest:t,style:s.props.suggestItemStyle,suggestItemClassName:s.props.suggestItemClassName,isActive:e,activeClassName:s.props.suggestItemActiveClassName,onMouseDown:s.props.onSuggestMouseDown,onMouseOut:s.props.onSuggestMouseOut,onSelect:s.props.onSuggestSelect,renderSuggestItem:s.props.renderSuggestItem})}))},e}(u.PureComponent);return function(s){function t(t){var e=s.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),e.listId="geosuggest__list"+(t.id?"--"+t.id:""),t.queryDelay&&(e.onAfterInputChange=C(e.onAfterInputChange,t.queryDelay)),e}return n(t,s),t.prototype.componentDidUpdate=function(t){t.initialValue!==this.props.initialValue&&this.setState({userInput:this.props.initialValue||""}),JSON.stringify(t.fixtures)!==JSON.stringify(this.props.fixtures)&&this.searchSuggests()},t.prototype.componentDidMount=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},s=this.state.userInput.length;if(this.props.minLength&&s<this.props.minLength)this.updateSuggests();else{var o=this.props,n=o.location,i=o.radius,r=o.bounds,u=o.types,p=o.country;n&&(t.location=n),i&&(t.radius=Number(this.props.radius)),r&&(t.bounds=r),u&&(t.types=u),p&&(t.componentRestrictions={country:p}),this.setState({isLoading:!0},function(){e.autocompleteService?e.autocompleteService.getPlacePredictions(t,function(t){e.setState({isLoading:!1}),e.updateSuggests(t||[],function(){e.props.autoActivateFirstSuggest&&!e.state.activeSuggest&&e.activateSuggest("next")})}):e.setState({isLoading:!1})})}}else this.updateSuggests()},t.prototype.updateSuggests=function(t,e){var s=this;void 0===t&&(t=[]),void 0===e&&(e=function(){});var o,n=[],i=this.state.userInput,r=this.props,u=r.skipSuggest,p=r.maxFixtures,a=r.fixtures,g=new RegExp(function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(i),"gim"),l=0;a&&a.forEach(function(t){p&&p<=l||u&&!u(t)&&t.label.match(g)&&(l++,n.push(c(c({},t),{isFixture:!0,matchedSubstrings:{length:i.length,offset:t.label.indexOf(i)},placeId:t.placeId||t.label})))}),t.forEach(function(t){u&&!u(t)&&n.push({description:t.description,isFixture:!1,label:s.props.getSuggestLabel?s.props.getSuggestLabel(t):"",matchedSubstrings:t.matched_substrings[0],placeId:t.place_id})}),o=this.updateActiveSuggest(n),this.props.onUpdateSuggests&&this.props.onUpdateSuggests(n,o),this.setState({suggests:n,activeSuggest:o},e)},t.prototype.updateActiveSuggest=function(t){void 0===t&&(t=[]);var e=this.state.activeSuggest;if(e){var s=t.filter(function(t){return e&&e.placeId===t.placeId&&e.isFixture===t.isFixture})[0];e=s||null}return e},t.prototype.showSuggests=function(){this.searchSuggests(),this.setState({isSuggestsHidden:!1})},t.prototype.hideSuggests=function(){var t=this;this.props.onBlur&&this.props.onBlur(this.state.userInput),this.timer=window.setTimeout(function(){t.setState({activeSuggest:null,isSuggestsHidden:!0})},100)},t.prototype.activateSuggest=function(t){if(this.state.isSuggestsHidden)this.showSuggests();else{for(var e=this.state.suggests.length-1,s="next"===t,o=null,n=0,i=0;i<=e;i++)this.state.suggests[i]===this.state.activeSuggest&&(n=s?i+1:i-1);this.state.activeSuggest||(n=s?0:e),0<=n&&n<=e&&(o=this.state.suggests[n]),this.props.onActivateSuggest&&this.props.onActivateSuggest(o),this.setState({activeSuggest:o})}},t.prototype.selectSuggest=function(t){var e=t||{isFixture:!0,label:this.state.userInput,placeId:this.state.userInput};if(!t&&this.props.autoActivateFirstSuggest&&0<this.state.suggests.length&&(e=this.state.suggests[0]),this.setState({isSuggestsHidden:!0,userInput:"object"!=typeof e.label?e.label:e.description||""}),e.location)return this.setState({ignoreBlur:!1}),void(this.props.onSuggestSelect&&this.props.onSuggestSelect(e));this.geocodeSuggest(e)},t.prototype.geocodeSuggest=function(i){var r=this;if(this.geocoder)if(i.placeId&&!i.isFixture&&this.placesService){var t={placeId:i.placeId,sessionToken:this.sessionToken};this.props.placeDetailFields&&(t.fields=this.props.placeDetailFields,t.fields.unshift("geometry")),this.placesService.getDetails(t,function(t,e){if(e===r.googleMaps.places.PlacesServiceStatus.OK){var s=t,o=s.geometry&&s.geometry.location,n=c(c({},i),{gmaps:s,location:{lat:o.lat(),lng:o.lng()}});r.sessionToken=new google.maps.places.AutocompleteSessionToken,r.props.onSuggestSelect&&r.props.onSuggestSelect(n)}})}else{t={address:i.label,bounds:this.props.bounds,componentRestrictions:this.props.country?{country:this.props.country}:void 0,location:this.props.location};this.geocoder.geocode(t,function(t,e){if(e===r.googleMaps.GeocoderStatus.OK){var s=t[0],o=s.geometry&&s.geometry.location,n=c(c({},i),{gmaps:s,location:{lat:o.lat(),lng:o.lng()}});r.props.onSuggestSelect&&r.props.onSuggestSelect(n)}})}},t.prototype.render=function(){var e=this,t=M(this.props),s=i("geosuggest",this.props.className,{"geosuggest--loading":this.state.isLoading}),o=u.createElement(T,c({className:this.props.inputClassName,ref:function(t){return e.input=t},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,inputType:this.props.inputType,onNext:this.onNext,onPrev:this.onPrev,onSelect:this.onSelect,onEscape:this.hideSuggests,isSuggestsHidden:this.state.isSuggestsHidden,activeSuggest:this.state.activeSuggest,label:this.props.label,id:this.props.id,listId:this.listId},t)),n=u.createElement(O,{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,listId:this.listId});return u.createElement("div",{className:s,id:this.props.id},u.createElement("div",{className:"geosuggest__input-wrapper"},o),u.createElement("div",{className:"geosuggest__suggests-wrapper"},n))},t.defaultProps=N,t}(u.Component)}(React);

@@ -67,3 +67,4 @@ import { createElement, Fragment, PureComponent, Component } from 'react';

skipSuggest: function () { return false; },
style: {}
style: {},
inputType: 'text'
};

@@ -251,3 +252,3 @@

shouldRenderLabel && (createElement("label", { className: "geosuggest__label", htmlFor: this.props.id }, this.props.label)),
createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), ref: function (i) { return (_this.input = i); }, type: this.props.inputType }, 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
? this.props.activeSuggest.placeId

@@ -267,2 +268,3 @@ : // eslint-disable-next-line no-undefined

listId: '',
inputType: 'text',
onBlur: function () { },

@@ -808,3 +810,3 @@ onChange: function () { },

var suggest = suggestToSelect || {
isFixture: false,
isFixture: true,
label: this.state.userInput,

@@ -904,3 +906,3 @@ placeId: this.state.userInput

});
var input = (createElement(Input, __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, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var input = (createElement(Input, __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, inputType: this.props.inputType, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var suggestionsList = (createElement(default_1$1, { 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, listId: this.listId }));

@@ -907,0 +909,0 @@ return (createElement("div", { className: classes, id: this.props.id },

@@ -72,3 +72,4 @@ (function (global, factory) {

skipSuggest: function () { return false; },
style: {}
style: {},
inputType: 'text'
};

@@ -256,3 +257,3 @@

shouldRenderLabel && (React.createElement("label", { className: "geosuggest__label", htmlFor: this.props.id }, this.props.label)),
React.createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
React.createElement("input", __assign({ className: classes, id: "geosuggest__input" + (this.props.id ? "--" + this.props.id : ''), ref: function (i) { return (_this.input = i); }, type: this.props.inputType }, 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, role: "combobox", "aria-expanded": !this.props.isSuggestsHidden, "aria-activedescendant": this.props.activeSuggest
? this.props.activeSuggest.placeId

@@ -272,2 +273,3 @@ : // eslint-disable-next-line no-undefined

listId: '',
inputType: 'text',
onBlur: function () { },

@@ -813,3 +815,3 @@ onChange: function () { },

var suggest = suggestToSelect || {
isFixture: false,
isFixture: true,
label: this.state.userInput,

@@ -909,3 +911,3 @@ placeId: this.state.userInput

});
var input = (React.createElement(Input, __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, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var input = (React.createElement(Input, __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, inputType: this.props.inputType, onNext: this.onNext, onPrev: this.onPrev, onSelect: this.onSelect, onEscape: this.hideSuggests, isSuggestsHidden: this.state.isSuggestsHidden, activeSuggest: this.state.activeSuggest, label: this.props.label, id: this.props.id, listId: this.listId }, attributes)));
var suggestionsList = (React.createElement(default_1$1, { 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, listId: this.listId }));

@@ -912,0 +914,0 @@ return (React.createElement("div", { className: classes, id: this.props.id },

{
"name": "react-geosuggest",
"version": "2.13.1",
"version": "2.14.0",
"description": "A React autosuggest for the Google Maps Places API.",

@@ -5,0 +5,0 @@ "main": "module/Geosuggest.umd.js",

@@ -316,2 +316,8 @@ # React Geosuggest [![Build Status](https://travis-ci.org/ubilabs/react-geosuggest.svg?branch=master)](https://travis-ci.org/ubilabs/react-geosuggest)

#### inputType
Type: `String`,
Default: `text`
The value for the `type` attribute on the html input element. Can be either `text` or `search`.
#### Others

@@ -318,0 +324,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc