Socket
Socket
Sign inDemoInstall

react-autosuggest

Package Overview
Dependencies
10
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.4.1 to 9.4.2

2

dist/Autosuggest.js

@@ -657,5 +657,5 @@ 'use strict';

if (_this4.pressedSuggestion && !_this4.justSelectedSuggestion) {
_this4.pressedSuggestion = null;
_this4.input.focus();
}
_this4.pressedSuggestion = null;
};

@@ -662,0 +662,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.Autosuggest=t(require("React")):e.Autosuggest=t(e.React)}(this,function(e){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1).default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(2),c=o(l),g=n(3),d=(o(g),n(8)),f=o(d),h=n(9),p=o(h),m=n(18),v=function(){return!0},y=function(e){return e.trim().length>0},S=function(e){var t=e.containerProps,n=e.children;return c.default.createElement("div",t,n)},I=function(e){function t(e){var n=e.alwaysRenderSuggestions;i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return b.call(o),o.state={isFocused:!1,isCollapsed:!n,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null},o.justPressedUpDown=!1,o.justMouseEntered=!1,o.pressedSuggestion=null,o}return u(t,e),a(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("mouseup",this.onDocumentMouseUp),this.input=this.autowhatever.input,this.suggestionsContainer=this.autowhatever.itemsContainer}},{key:"componentWillReceiveProps",value:function(e){(0,f.default)(e.suggestions,this.props.suggestions)?e.highlightFirstSuggestion&&e.suggestions.length>0&&this.justPressedUpDown===!1&&this.justMouseEntered===!1&&this.highlightFirstSuggestion():this.willRenderSuggestions(e)?this.state.isCollapsed&&!this.justSelectedSuggestion&&this.revealSuggestions():this.resetHighlightedSuggestion()}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.suggestions,i=n.onSuggestionHighlighted,r=n.highlightFirstSuggestion;if(!(0,f.default)(o,e.suggestions)&&o.length>0&&r)return void this.highlightFirstSuggestion();if(i){var u=this.getHighlightedSuggestion(),s=t.highlightedSuggestion;u!=s&&i({suggestion:u})}}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("mouseup",this.onDocumentMouseUp)}},{key:"updateHighlightedSuggestion",value:function(e,t,n){var o=this;this.setState(function(i){var r=i.valueBeforeUpDown;return null===t?r=null:null===r&&"undefined"!=typeof n&&(r=n),{highlightedSectionIndex:e,highlightedSuggestionIndex:t,highlightedSuggestion:null===t?null:o.getSuggestion(e,t),valueBeforeUpDown:r}})}},{key:"resetHighlightedSuggestion",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setState(function(t){var n=t.valueBeforeUpDown;return{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:e?null:n}})}},{key:"revealSuggestions",value:function(){this.setState({isCollapsed:!1})}},{key:"closeSuggestions",value:function(){this.setState({highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!0})}},{key:"getSuggestion",value:function(e,t){var n=this.props,o=n.suggestions,i=n.multiSection,r=n.getSectionSuggestions;return i?r(o[e])[t]:o[t]}},{key:"getHighlightedSuggestion",value:function(){var e=this.state,t=e.highlightedSectionIndex,n=e.highlightedSuggestionIndex;return null===n?null:this.getSuggestion(t,n)}},{key:"getSuggestionValueByIndex",value:function(e,t){var n=this.props.getSuggestionValue;return n(this.getSuggestion(e,t))}},{key:"getSuggestionIndices",value:function(e){var t=e.getAttribute("data-section-index"),n=e.getAttribute("data-suggestion-index");return{sectionIndex:"string"==typeof t?parseInt(t,10):null,suggestionIndex:parseInt(n,10)}}},{key:"findSuggestionElement",value:function(e){var t=e;do{if(null!==t.getAttribute("data-suggestion-index"))return t;t=t.parentNode}while(null!==t);throw console.error("Clicked element:",e),new Error("Couldn't find suggestion element")}},{key:"maybeCallOnChange",value:function(e,t,n){var o=this.props.inputProps,i=o.value,r=o.onChange;t!==i&&r(e,{newValue:t,method:n})}},{key:"willRenderSuggestions",value:function(e){var t=e.suggestions,n=e.inputProps,o=e.shouldRenderSuggestions,i=n.value;return t.length>0&&o(i)}},{key:"getQuery",value:function(){var e=this.props.inputProps,t=e.value,n=this.state.valueBeforeUpDown;return(null===n?t:n).trim()}},{key:"render",value:function(){var e=this,t=this.props,n=t.suggestions,o=t.renderInputComponent,i=t.onSuggestionsFetchRequested,r=t.renderSuggestion,u=t.inputProps,a=t.multiSection,l=t.renderSectionTitle,g=t.id,d=t.getSectionSuggestions,f=t.theme,h=t.getSuggestionValue,y=t.alwaysRenderSuggestions,S=t.highlightFirstSuggestion,I=this.state,b=I.isFocused,w=I.isCollapsed,x=I.highlightedSectionIndex,_=I.highlightedSuggestionIndex,O=I.valueBeforeUpDown,C=y?v:this.props.shouldRenderSuggestions,j=u.value,P=u.onFocus,k=u.onKeyDown,R=this.willRenderSuggestions(this.props),T=y||b&&!w&&R,E=T?n:[],D=s({},u,{onFocus:function(t){if(!e.justSelectedSuggestion&&!e.justClickedOnSuggestionsContainer){var n=C(j);e.setState({isFocused:!0,isCollapsed:!n}),P&&P(t),n&&i({value:j,reason:"input-focused"})}},onBlur:function(t){return e.justClickedOnSuggestionsContainer?void e.input.focus():(e.blurEvent=t,void(e.justSelectedSuggestion||(e.onBlur(),e.onSuggestionsClearRequested())))},onChange:function(t){var n=t.target.value,o=C(n);e.maybeCallOnChange(t,n,"type"),e.setState(s({},S?{}:{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null},{valueBeforeUpDown:null,isCollapsed:!o})),o?i({value:n,reason:"input-changed"}):e.onSuggestionsClearRequested()},onKeyDown:function(t,o){var r=t.keyCode;switch(r){case 40:case 38:if(w)C(j)&&(i({value:j,reason:"suggestions-revealed"}),e.revealSuggestions());else if(n.length>0){var u=o.newHighlightedSectionIndex,s=o.newHighlightedItemIndex,a=void 0;a=null===s?null===O?j:O:e.getSuggestionValueByIndex(u,s),e.updateHighlightedSuggestion(u,s,j),e.maybeCallOnChange(t,a,40===r?"down":"up")}t.preventDefault(),e.justPressedUpDown=!0,setTimeout(function(){e.justPressedUpDown=!1});break;case 13:if(229===t.keyCode)break;var l=e.getHighlightedSuggestion();if(T&&!y&&e.closeSuggestions(),null!=l){var c=h(l);e.maybeCallOnChange(t,c,"enter"),e.onSuggestionSelected(t,{suggestion:l,suggestionValue:c,suggestionIndex:_,sectionIndex:x,method:"enter"}),e.justSelectedSuggestion=!0,setTimeout(function(){e.justSelectedSuggestion=!1})}break;case 27:T&&t.preventDefault();var g=T&&!y;if(null===O){if(!g){var d="";e.maybeCallOnChange(t,d,"escape"),C(d)?i({value:d,reason:"escape-pressed"}):e.onSuggestionsClearRequested()}}else e.maybeCallOnChange(t,O,"escape");g?(e.onSuggestionsClearRequested(),e.closeSuggestions()):e.resetHighlightedSuggestion()}k&&k(t)}}),M={query:this.getQuery()};return c.default.createElement(p.default,{multiSection:a,items:E,renderInputComponent:o,renderItemsContainer:this.renderSuggestionsContainer,renderItem:r,renderItemData:M,renderSectionTitle:l,getSectionItems:d,highlightedSectionIndex:x,highlightedItemIndex:_,inputProps:D,itemProps:this.itemProps,theme:(0,m.mapToAutowhateverTheme)(f),id:g,ref:this.storeAutowhateverRef})}}]),t}(l.Component);I.defaultProps={renderSuggestionsContainer:S,shouldRenderSuggestions:y,alwaysRenderSuggestions:!1,multiSection:!1,focusInputOnSuggestionClick:!0,highlightFirstSuggestion:!1,theme:m.defaultTheme,id:"1"};var b=function(){var e=this;this.onDocumentMouseDown=function(t){e.justClickedOnSuggestionsContainer=!1;for(var n=t.detail&&t.detail.target||t.target;null!==n&&n!==document;){if(null!==n.getAttribute("data-suggestion-index"))return;if(n===e.suggestionsContainer)return void(e.justClickedOnSuggestionsContainer=!0);n=n.parentNode}},this.storeAutowhateverRef=function(t){null!==t&&(e.autowhatever=t)},this.onSuggestionMouseEnter=function(t,n){var o=n.sectionIndex,i=n.itemIndex;e.updateHighlightedSuggestion(o,i),t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!0),e.justMouseEntered=!0,setTimeout(function(){e.justMouseEntered=!1})},this.highlightFirstSuggestion=function(){e.updateHighlightedSuggestion(e.props.multiSection?0:null,0)},this.onDocumentMouseUp=function(){e.pressedSuggestion&&!e.justSelectedSuggestion&&(e.pressedSuggestion=null,e.input.focus())},this.onSuggestionMouseDown=function(t){e.justSelectedSuggestion||(e.justSelectedSuggestion=!0,e.pressedSuggestion=t.target)},this.onSuggestionsClearRequested=function(){var t=e.props.onSuggestionsClearRequested;t&&t()},this.onSuggestionSelected=function(t,n){var o=e.props,i=o.alwaysRenderSuggestions,r=o.onSuggestionSelected,u=o.onSuggestionsFetchRequested;r&&r(t,n),i?u({value:n.suggestionValue,reason:"suggestion-selected"}):e.onSuggestionsClearRequested(),e.resetHighlightedSuggestion()},this.onSuggestionClick=function(t){var n=e.props,o=n.alwaysRenderSuggestions,i=n.focusInputOnSuggestionClick,r=e.getSuggestionIndices(e.findSuggestionElement(t.target)),u=r.sectionIndex,s=r.suggestionIndex,a=e.getSuggestion(u,s),l=e.props.getSuggestionValue(a);e.maybeCallOnChange(t,l,"click"),e.onSuggestionSelected(t,{suggestion:a,suggestionValue:l,suggestionIndex:s,sectionIndex:u,method:"click"}),o||e.closeSuggestions(),i===!0?e.input.focus():e.onBlur(),setTimeout(function(){e.justSelectedSuggestion=!1})},this.onBlur=function(){var t=e.props,n=t.inputProps,o=t.shouldRenderSuggestions,i=n.value,r=n.onBlur,u=e.getHighlightedSuggestion(),s=o(i);e.setState({isFocused:!1,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!s}),r&&r(e.blurEvent,{highlightedSuggestion:u})},this.onSuggestionMouseLeave=function(t){e.resetHighlightedSuggestion(!1),e.justSelectedSuggestion&&t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!1)},this.onSuggestionTouchStart=function(){e.justSelectedSuggestion=!0},this.onSuggestionTouchMove=function(){e.justSelectedSuggestion=!1,e.pressedSuggestion=null,e.input.focus()},this.itemProps=function(t){var n=t.sectionIndex,o=t.itemIndex;return{"data-section-index":n,"data-suggestion-index":o,onMouseEnter:e.onSuggestionMouseEnter,onMouseLeave:e.onSuggestionMouseLeave,onMouseDown:e.onSuggestionMouseDown,onTouchStart:e.onSuggestionTouchStart,onTouchMove:e.onSuggestionTouchMove,onClick:e.onSuggestionClick}},this.renderSuggestionsContainer=function(t){var n=t.containerProps,o=t.children,i=e.props.renderSuggestionsContainer;return i({containerProps:n,children:o,query:e.getQuery()})}};t.default=I,I.propTypes={}},function(t,n){t.exports=e},function(e,t,n){e.exports=n(4)()},function(e,t,n){"use strict";var o=n(5),i=n(6),r=n(7);e.exports=function(){function e(e,t,n,o,u,s){s!==r&&i(!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=o,n.PropTypes=n,n}},function(e,t){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o,r,u,s,a){if(i(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=[n,o,r,u,s,a],g=0;l=new Error(t.replace(/%s/g,function(){return c[g++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};e.exports=o},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t){e.exports=function(e,t){if(e===t)return!0;var n=e.length;if(t.length!==n)return!1;for(var o=0;o<n;o++)if(e[o]!==t[o])return!1;return!0}},function(e,t,n){"use strict";e.exports=n(10).default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),g=o(c),d=n(3),f=o(d),h=n(11),p=o(h),m=n(12),v=o(m),y=n(14),S=o(y),I=n(16),b=o(I),w={},x=function(e){return g.default.createElement("input",e)},_=function(e){var t=e.containerProps,n=e.children;return g.default.createElement("div",t,n)},O={container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"},C=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){if(null===t)return null;var o=n.props.id,i=null===e?"":"section-"+e;return"react-autowhatever-"+o+"-"+i+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,o=t.inputProps,i=t.highlightedSectionIndex,r=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var u="ArrowDown"===e.key?"next":"prev",s=n.sectionIterator[u]([i,r]),l=a(s,2),c=l[0],g=l[1];o.onKeyDown(e,{newHighlightedSectionIndex:c,newHighlightedItemIndex:g});break;default:o.onKeyDown(e,{highlightedSectionIndex:i,highlightedItemIndex:r})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map(function(t){return e.getSectionItems(t)}),this.sectionsLengths=this.sectionsItems.map(function(e){return e.length}),this.allSectionsAreEmpty=this.sectionsLengths.every(function(e){return 0===e}))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,p.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,v.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,o=n.id,i=n.items,r=n.renderItem,u=n.renderItemData,s=n.renderSectionTitle,a=n.highlightedSectionIndex,l=n.highlightedItemIndex,c=n.itemProps;return i.map(function(n,i){var d="react-autowhatever-"+o+"-",f=d+"section-"+i+"-",h=0===i;return g.default.createElement("div",t(f+"container","sectionContainer",h&&"sectionContainerFirst"),g.default.createElement(S.default,{section:n,renderSectionTitle:s,theme:t,sectionKeyPrefix:f}),g.default.createElement(b.default,{items:e.sectionsItems[i],itemProps:c,renderItem:r,renderItemData:u,sectionIndex:i,highlightedItemIndex:a===i?l:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:d,ref:e.storeItemsListReference}))})}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,o=n.id,i=n.renderItem,r=n.renderItemData,u=n.highlightedSectionIndex,s=n.highlightedItemIndex,a=n.itemProps;return g.default.createElement(b.default,{items:e,itemProps:a,renderItem:i,renderItemData:r,highlightedItemIndex:null===u?s:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+o+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,o=t.scrollTop;n<o?o=n:n+e.offsetHeight>o+t.offsetHeight&&(o=n+e.offsetHeight-t.offsetHeight),o!==t.scrollTop&&(t.scrollTop=o)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,o=t.multiSection,i=t.renderInputComponent,r=t.renderItemsContainer,u=t.highlightedSectionIndex,a=t.highlightedItemIndex,l=this.state.isInputFocused,c=o?this.renderSections():this.renderItems(),d=null!==c,f=this.getItemId(u,a),h="react-autowhatever-"+n,p=s({role:"combobox","aria-haspopup":"listbox","aria-owns":h,"aria-expanded":d},e("react-autowhatever-"+n+"-container","container",d&&"containerOpen")),m=i(s({type:"text",value:"",autoComplete:"off","aria-autocomplete":"list","aria-controls":h,"aria-activedescendant":f},e("react-autowhatever-"+n+"-input","input",d&&"inputOpen",l&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=r({containerProps:s({id:h,role:"listbox"},e("react-autowhatever-"+n+"-items-container","itemsContainer",d&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:c});return g.default.createElement("div",p,m,v)}}]),t}(c.Component);C.propTypes={id:f.default.string,multiSection:f.default.bool,renderInputComponent:f.default.func,renderItemsContainer:f.default.func,items:f.default.array.isRequired,renderItem:f.default.func,renderItemData:f.default.object,renderSectionTitle:f.default.func,getSectionItems:f.default.func,inputProps:f.default.object,itemProps:f.default.oneOfType([f.default.object,f.default.func]),highlightedSectionIndex:f.default.number,highlightedItemIndex:f.default.number,theme:f.default.oneOfType([f.default.object,f.default.array])},C.defaultProps={id:"1",multiSection:!1,renderInputComponent:x,renderItemsContainer:_,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:w,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:w,itemProps:w,highlightedSectionIndex:null,highlightedItemIndex:null,theme:O},t.default=C},function(e,t){"use strict";var n=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.exports=function(e){function t(e){for(null===e?e=0:e++;e<s.length&&0===s[e];)e++;return e===s.length?null:e}function o(e){for(null===e?e=s.length-1:e--;e>=0&&0===s[e];)e--;return e===-1?null:e}function i(e){var o=n(e,2),i=o[0],r=o[1];return a?null===r||r===s[i]-1?(i=t(i),null===i?[null,null]:[i,0]):[i,r+1]:0===s||r===s-1?[null,null]:null===r?[null,0]:[null,r+1]}function r(e){var t=n(e,2),i=t[0],r=t[1];return a?null===r||0===r?(i=o(i),null===i?[null,null]:[i,s[i]-1]):[i,r-1]:0===s||0===r?[null,null]:null===r?[null,s-1]:[null,r-1]}function u(e){return null===i(e)[1]}var s=e.data,a=e.multiSection;return{next:i,prev:r,isLast:u}}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n(13),s=o(u),a=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=r(t,2),o=n[0],u=n[1];return 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 l=n.map(function(e){return o[e]}).filter(a);return"string"==typeof l[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,i(l)):l.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(i(l)))}}},e.exports=t.default},function(e,t){"use strict";function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function o(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter(function(t){return i.call(e,t)})}var i=Object.prototype.propertyIsEnumerable;e.exports=Object.assign||function(e,t){for(var i,r,u=n(e),s=1;s<arguments.length;s++){i=arguments[s],r=o(Object(i));for(var a=0;a<r.length;a++)u[r[a]]=i[r[a]]}return u}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(2),l=o(a),c=n(3),g=o(c),d=n(15),f=o(d),h=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e){return(0,f.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,o=e.theme,i=e.sectionKeyPrefix,r=n(t);return r?l.default.createElement("div",o(i+"title","sectionTitle"),r):null}}]),t}(a.Component);h.propTypes={section:g.default.any.isRequired,renderSectionTitle:g.default.func.isRequired,theme:g.default.func.isRequired,sectionKeyPrefix:g.default.string.isRequired},t.default=h},function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e===t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!0;var u={},s=void 0,a=void 0;for(s=0,a=n.length;s<a;s++)u[n[s]]=!0;for(s=0,a=i.length;s<a;s++){var l=i[s],c=e[l],g=t[l];if(c!==g){if(!u[l]||null===c||null===g||"object"!==("undefined"==typeof c?"undefined":o(c))||"object"!==("undefined"==typeof g?"undefined":o(g)))return!0;var d=Object.keys(c),f=Object.keys(g);if(d.length!==f.length)return!0;for(var h=0,p=d.length;h<p;h++){var m=d[h];if(c[m]!==g[m])return!0}}}return!1}Object.defineProperty(t,"__esModule",{value:!0});var o="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};t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(2),c=o(l),g=n(3),d=o(g),f=n(17),h=o(f),p=n(15),m=o(p),v=function(e){function t(){var e,n,o,u;i(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=o=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),o.storeHighlightedItemReference=function(e){o.props.onHighlightedItemChange(null===e?null:e.item)},u=n,r(o,u)}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,m.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,o=t.itemProps,i=t.renderItem,r=t.renderItemData,u=t.sectionIndex,a=t.highlightedItemIndex,l=t.getItemId,g=t.theme,d=t.keyPrefix,f=null===u?d:d+"section-"+u+"-",p="function"==typeof o;return c.default.createElement("ul",s({role:"listbox"},g(f+"items-list","itemsList")),n.map(function(t,n){var d=0===n,m=n===a,v=f+"item-"+n,y=p?o({sectionIndex:u,itemIndex:n}):o,S=s({id:l(u,n),"aria-selected":m},g(v,"item",d&&"itemFirst",m&&"itemHighlighted"),y);return m&&(S.ref=e.storeHighlightedItemReference),c.default.createElement(h.default,s({},S,{sectionIndex:u,isHighlighted:m,itemIndex:n,item:t,renderItem:i,renderItemData:r}))}))}}]),t}(l.Component);v.propTypes={items:d.default.array.isRequired,itemProps:d.default.oneOfType([d.default.object,d.default.func]),renderItem:d.default.func.isRequired,renderItemData:d.default.object.isRequired,sectionIndex:d.default.number,highlightedItemIndex:d.default.number,onHighlightedItemChange:d.default.func.isRequired,getItemId:d.default.func.isRequired,theme:d.default.func.isRequired,keyPrefix:d.default.string.isRequired},v.defaultProps={sectionIndex:null},t.default=v},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 s(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(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),g=o(c),d=n(3),f=o(d),h=n(15),p=o(h),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=o=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),o.storeItemReference=function(e){null!==e&&(o.item=e)},o.onMouseEnter=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseEnter(e,{sectionIndex:n,itemIndex:i})},o.onMouseLeave=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseLeave(e,{sectionIndex:n,itemIndex:i})},o.onMouseDown=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseDown(e,{sectionIndex:n,itemIndex:i})},o.onClick=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onClick(e,{sectionIndex:n,itemIndex:i})},i=n,u(o,i)}return s(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){return(0,p.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,o=e.renderItem,r=e.renderItemData,u=i(e,["isHighlighted","item","renderItem","renderItemData"]);return delete u.sectionIndex,delete u.itemIndex,"function"==typeof u.onMouseEnter&&(u.onMouseEnter=this.onMouseEnter),
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.Autosuggest=t(require("React")):e.Autosuggest=t(e.React)}(this,function(e){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1).default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(2),c=o(l),g=n(3),d=(o(g),n(8)),f=o(d),h=n(9),p=o(h),m=n(18),v=function(){return!0},y=function(e){return e.trim().length>0},S=function(e){var t=e.containerProps,n=e.children;return c.default.createElement("div",t,n)},I=function(e){function t(e){var n=e.alwaysRenderSuggestions;i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return b.call(o),o.state={isFocused:!1,isCollapsed:!n,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null},o.justPressedUpDown=!1,o.justMouseEntered=!1,o.pressedSuggestion=null,o}return u(t,e),a(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("mouseup",this.onDocumentMouseUp),this.input=this.autowhatever.input,this.suggestionsContainer=this.autowhatever.itemsContainer}},{key:"componentWillReceiveProps",value:function(e){(0,f.default)(e.suggestions,this.props.suggestions)?e.highlightFirstSuggestion&&e.suggestions.length>0&&this.justPressedUpDown===!1&&this.justMouseEntered===!1&&this.highlightFirstSuggestion():this.willRenderSuggestions(e)?this.state.isCollapsed&&!this.justSelectedSuggestion&&this.revealSuggestions():this.resetHighlightedSuggestion()}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.suggestions,i=n.onSuggestionHighlighted,r=n.highlightFirstSuggestion;if(!(0,f.default)(o,e.suggestions)&&o.length>0&&r)return void this.highlightFirstSuggestion();if(i){var u=this.getHighlightedSuggestion(),s=t.highlightedSuggestion;u!=s&&i({suggestion:u})}}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.onDocumentMouseDown),document.removeEventListener("mouseup",this.onDocumentMouseUp)}},{key:"updateHighlightedSuggestion",value:function(e,t,n){var o=this;this.setState(function(i){var r=i.valueBeforeUpDown;return null===t?r=null:null===r&&"undefined"!=typeof n&&(r=n),{highlightedSectionIndex:e,highlightedSuggestionIndex:t,highlightedSuggestion:null===t?null:o.getSuggestion(e,t),valueBeforeUpDown:r}})}},{key:"resetHighlightedSuggestion",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setState(function(t){var n=t.valueBeforeUpDown;return{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:e?null:n}})}},{key:"revealSuggestions",value:function(){this.setState({isCollapsed:!1})}},{key:"closeSuggestions",value:function(){this.setState({highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!0})}},{key:"getSuggestion",value:function(e,t){var n=this.props,o=n.suggestions,i=n.multiSection,r=n.getSectionSuggestions;return i?r(o[e])[t]:o[t]}},{key:"getHighlightedSuggestion",value:function(){var e=this.state,t=e.highlightedSectionIndex,n=e.highlightedSuggestionIndex;return null===n?null:this.getSuggestion(t,n)}},{key:"getSuggestionValueByIndex",value:function(e,t){var n=this.props.getSuggestionValue;return n(this.getSuggestion(e,t))}},{key:"getSuggestionIndices",value:function(e){var t=e.getAttribute("data-section-index"),n=e.getAttribute("data-suggestion-index");return{sectionIndex:"string"==typeof t?parseInt(t,10):null,suggestionIndex:parseInt(n,10)}}},{key:"findSuggestionElement",value:function(e){var t=e;do{if(null!==t.getAttribute("data-suggestion-index"))return t;t=t.parentNode}while(null!==t);throw console.error("Clicked element:",e),new Error("Couldn't find suggestion element")}},{key:"maybeCallOnChange",value:function(e,t,n){var o=this.props.inputProps,i=o.value,r=o.onChange;t!==i&&r(e,{newValue:t,method:n})}},{key:"willRenderSuggestions",value:function(e){var t=e.suggestions,n=e.inputProps,o=e.shouldRenderSuggestions,i=n.value;return t.length>0&&o(i)}},{key:"getQuery",value:function(){var e=this.props.inputProps,t=e.value,n=this.state.valueBeforeUpDown;return(null===n?t:n).trim()}},{key:"render",value:function(){var e=this,t=this.props,n=t.suggestions,o=t.renderInputComponent,i=t.onSuggestionsFetchRequested,r=t.renderSuggestion,u=t.inputProps,a=t.multiSection,l=t.renderSectionTitle,g=t.id,d=t.getSectionSuggestions,f=t.theme,h=t.getSuggestionValue,y=t.alwaysRenderSuggestions,S=t.highlightFirstSuggestion,I=this.state,b=I.isFocused,w=I.isCollapsed,x=I.highlightedSectionIndex,_=I.highlightedSuggestionIndex,O=I.valueBeforeUpDown,C=y?v:this.props.shouldRenderSuggestions,j=u.value,P=u.onFocus,k=u.onKeyDown,R=this.willRenderSuggestions(this.props),T=y||b&&!w&&R,E=T?n:[],D=s({},u,{onFocus:function(t){if(!e.justSelectedSuggestion&&!e.justClickedOnSuggestionsContainer){var n=C(j);e.setState({isFocused:!0,isCollapsed:!n}),P&&P(t),n&&i({value:j,reason:"input-focused"})}},onBlur:function(t){return e.justClickedOnSuggestionsContainer?void e.input.focus():(e.blurEvent=t,void(e.justSelectedSuggestion||(e.onBlur(),e.onSuggestionsClearRequested())))},onChange:function(t){var n=t.target.value,o=C(n);e.maybeCallOnChange(t,n,"type"),e.setState(s({},S?{}:{highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null},{valueBeforeUpDown:null,isCollapsed:!o})),o?i({value:n,reason:"input-changed"}):e.onSuggestionsClearRequested()},onKeyDown:function(t,o){var r=t.keyCode;switch(r){case 40:case 38:if(w)C(j)&&(i({value:j,reason:"suggestions-revealed"}),e.revealSuggestions());else if(n.length>0){var u=o.newHighlightedSectionIndex,s=o.newHighlightedItemIndex,a=void 0;a=null===s?null===O?j:O:e.getSuggestionValueByIndex(u,s),e.updateHighlightedSuggestion(u,s,j),e.maybeCallOnChange(t,a,40===r?"down":"up")}t.preventDefault(),e.justPressedUpDown=!0,setTimeout(function(){e.justPressedUpDown=!1});break;case 13:if(229===t.keyCode)break;var l=e.getHighlightedSuggestion();if(T&&!y&&e.closeSuggestions(),null!=l){var c=h(l);e.maybeCallOnChange(t,c,"enter"),e.onSuggestionSelected(t,{suggestion:l,suggestionValue:c,suggestionIndex:_,sectionIndex:x,method:"enter"}),e.justSelectedSuggestion=!0,setTimeout(function(){e.justSelectedSuggestion=!1})}break;case 27:T&&t.preventDefault();var g=T&&!y;if(null===O){if(!g){var d="";e.maybeCallOnChange(t,d,"escape"),C(d)?i({value:d,reason:"escape-pressed"}):e.onSuggestionsClearRequested()}}else e.maybeCallOnChange(t,O,"escape");g?(e.onSuggestionsClearRequested(),e.closeSuggestions()):e.resetHighlightedSuggestion()}k&&k(t)}}),M={query:this.getQuery()};return c.default.createElement(p.default,{multiSection:a,items:E,renderInputComponent:o,renderItemsContainer:this.renderSuggestionsContainer,renderItem:r,renderItemData:M,renderSectionTitle:l,getSectionItems:d,highlightedSectionIndex:x,highlightedItemIndex:_,inputProps:D,itemProps:this.itemProps,theme:(0,m.mapToAutowhateverTheme)(f),id:g,ref:this.storeAutowhateverRef})}}]),t}(l.Component);I.defaultProps={renderSuggestionsContainer:S,shouldRenderSuggestions:y,alwaysRenderSuggestions:!1,multiSection:!1,focusInputOnSuggestionClick:!0,highlightFirstSuggestion:!1,theme:m.defaultTheme,id:"1"};var b=function(){var e=this;this.onDocumentMouseDown=function(t){e.justClickedOnSuggestionsContainer=!1;for(var n=t.detail&&t.detail.target||t.target;null!==n&&n!==document;){if(null!==n.getAttribute("data-suggestion-index"))return;if(n===e.suggestionsContainer)return void(e.justClickedOnSuggestionsContainer=!0);n=n.parentNode}},this.storeAutowhateverRef=function(t){null!==t&&(e.autowhatever=t)},this.onSuggestionMouseEnter=function(t,n){var o=n.sectionIndex,i=n.itemIndex;e.updateHighlightedSuggestion(o,i),t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!0),e.justMouseEntered=!0,setTimeout(function(){e.justMouseEntered=!1})},this.highlightFirstSuggestion=function(){e.updateHighlightedSuggestion(e.props.multiSection?0:null,0)},this.onDocumentMouseUp=function(){e.pressedSuggestion&&!e.justSelectedSuggestion&&e.input.focus(),e.pressedSuggestion=null},this.onSuggestionMouseDown=function(t){e.justSelectedSuggestion||(e.justSelectedSuggestion=!0,e.pressedSuggestion=t.target)},this.onSuggestionsClearRequested=function(){var t=e.props.onSuggestionsClearRequested;t&&t()},this.onSuggestionSelected=function(t,n){var o=e.props,i=o.alwaysRenderSuggestions,r=o.onSuggestionSelected,u=o.onSuggestionsFetchRequested;r&&r(t,n),i?u({value:n.suggestionValue,reason:"suggestion-selected"}):e.onSuggestionsClearRequested(),e.resetHighlightedSuggestion()},this.onSuggestionClick=function(t){var n=e.props,o=n.alwaysRenderSuggestions,i=n.focusInputOnSuggestionClick,r=e.getSuggestionIndices(e.findSuggestionElement(t.target)),u=r.sectionIndex,s=r.suggestionIndex,a=e.getSuggestion(u,s),l=e.props.getSuggestionValue(a);e.maybeCallOnChange(t,l,"click"),e.onSuggestionSelected(t,{suggestion:a,suggestionValue:l,suggestionIndex:s,sectionIndex:u,method:"click"}),o||e.closeSuggestions(),i===!0?e.input.focus():e.onBlur(),setTimeout(function(){e.justSelectedSuggestion=!1})},this.onBlur=function(){var t=e.props,n=t.inputProps,o=t.shouldRenderSuggestions,i=n.value,r=n.onBlur,u=e.getHighlightedSuggestion(),s=o(i);e.setState({isFocused:!1,highlightedSectionIndex:null,highlightedSuggestionIndex:null,highlightedSuggestion:null,valueBeforeUpDown:null,isCollapsed:!s}),r&&r(e.blurEvent,{highlightedSuggestion:u})},this.onSuggestionMouseLeave=function(t){e.resetHighlightedSuggestion(!1),e.justSelectedSuggestion&&t.target===e.pressedSuggestion&&(e.justSelectedSuggestion=!1)},this.onSuggestionTouchStart=function(){e.justSelectedSuggestion=!0},this.onSuggestionTouchMove=function(){e.justSelectedSuggestion=!1,e.pressedSuggestion=null,e.input.focus()},this.itemProps=function(t){var n=t.sectionIndex,o=t.itemIndex;return{"data-section-index":n,"data-suggestion-index":o,onMouseEnter:e.onSuggestionMouseEnter,onMouseLeave:e.onSuggestionMouseLeave,onMouseDown:e.onSuggestionMouseDown,onTouchStart:e.onSuggestionTouchStart,onTouchMove:e.onSuggestionTouchMove,onClick:e.onSuggestionClick}},this.renderSuggestionsContainer=function(t){var n=t.containerProps,o=t.children,i=e.props.renderSuggestionsContainer;return i({containerProps:n,children:o,query:e.getQuery()})}};t.default=I,I.propTypes={}},function(t,n){t.exports=e},function(e,t,n){e.exports=n(4)()},function(e,t,n){"use strict";var o=n(5),i=n(6),r=n(7);e.exports=function(){function e(e,t,n,o,u,s){s!==r&&i(!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=o,n.PropTypes=n,n}},function(e,t){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o,r,u,s,a){if(i(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=[n,o,r,u,s,a],g=0;l=new Error(t.replace(/%s/g,function(){return c[g++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};e.exports=o},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t){e.exports=function(e,t){if(e===t)return!0;var n=e.length;if(t.length!==n)return!1;for(var o=0;o<n;o++)if(e[o]!==t[o])return!1;return!0}},function(e,t,n){"use strict";e.exports=n(10).default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),g=o(c),d=n(3),f=o(d),h=n(11),p=o(h),m=n(12),v=o(m),y=n(14),S=o(y),I=n(16),b=o(I),w={},x=function(e){return g.default.createElement("input",e)},_=function(e){var t=e.containerProps,n=e.children;return g.default.createElement("div",t,n)},O={container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"},C=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){if(null===t)return null;var o=n.props.id,i=null===e?"":"section-"+e;return"react-autowhatever-"+o+"-"+i+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,o=t.inputProps,i=t.highlightedSectionIndex,r=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var u="ArrowDown"===e.key?"next":"prev",s=n.sectionIterator[u]([i,r]),l=a(s,2),c=l[0],g=l[1];o.onKeyDown(e,{newHighlightedSectionIndex:c,newHighlightedItemIndex:g});break;default:o.onKeyDown(e,{highlightedSectionIndex:i,highlightedItemIndex:r})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map(function(t){return e.getSectionItems(t)}),this.sectionsLengths=this.sectionsItems.map(function(e){return e.length}),this.allSectionsAreEmpty=this.sectionsLengths.every(function(e){return 0===e}))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,p.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,v.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,o=n.id,i=n.items,r=n.renderItem,u=n.renderItemData,s=n.renderSectionTitle,a=n.highlightedSectionIndex,l=n.highlightedItemIndex,c=n.itemProps;return i.map(function(n,i){var d="react-autowhatever-"+o+"-",f=d+"section-"+i+"-",h=0===i;return g.default.createElement("div",t(f+"container","sectionContainer",h&&"sectionContainerFirst"),g.default.createElement(S.default,{section:n,renderSectionTitle:s,theme:t,sectionKeyPrefix:f}),g.default.createElement(b.default,{items:e.sectionsItems[i],itemProps:c,renderItem:r,renderItemData:u,sectionIndex:i,highlightedItemIndex:a===i?l:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:d,ref:e.storeItemsListReference}))})}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,o=n.id,i=n.renderItem,r=n.renderItemData,u=n.highlightedSectionIndex,s=n.highlightedItemIndex,a=n.itemProps;return g.default.createElement(b.default,{items:e,itemProps:a,renderItem:i,renderItemData:r,highlightedItemIndex:null===u?s:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+o+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,o=t.scrollTop;n<o?o=n:n+e.offsetHeight>o+t.offsetHeight&&(o=n+e.offsetHeight-t.offsetHeight),o!==t.scrollTop&&(t.scrollTop=o)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,o=t.multiSection,i=t.renderInputComponent,r=t.renderItemsContainer,u=t.highlightedSectionIndex,a=t.highlightedItemIndex,l=this.state.isInputFocused,c=o?this.renderSections():this.renderItems(),d=null!==c,f=this.getItemId(u,a),h="react-autowhatever-"+n,p=s({role:"combobox","aria-haspopup":"listbox","aria-owns":h,"aria-expanded":d},e("react-autowhatever-"+n+"-container","container",d&&"containerOpen")),m=i(s({type:"text",value:"",autoComplete:"off","aria-autocomplete":"list","aria-controls":h,"aria-activedescendant":f},e("react-autowhatever-"+n+"-input","input",d&&"inputOpen",l&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=r({containerProps:s({id:h,role:"listbox"},e("react-autowhatever-"+n+"-items-container","itemsContainer",d&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:c});return g.default.createElement("div",p,m,v)}}]),t}(c.Component);C.propTypes={id:f.default.string,multiSection:f.default.bool,renderInputComponent:f.default.func,renderItemsContainer:f.default.func,items:f.default.array.isRequired,renderItem:f.default.func,renderItemData:f.default.object,renderSectionTitle:f.default.func,getSectionItems:f.default.func,inputProps:f.default.object,itemProps:f.default.oneOfType([f.default.object,f.default.func]),highlightedSectionIndex:f.default.number,highlightedItemIndex:f.default.number,theme:f.default.oneOfType([f.default.object,f.default.array])},C.defaultProps={id:"1",multiSection:!1,renderInputComponent:x,renderItemsContainer:_,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:w,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:w,itemProps:w,highlightedSectionIndex:null,highlightedItemIndex:null,theme:O},t.default=C},function(e,t){"use strict";var n=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.exports=function(e){function t(e){for(null===e?e=0:e++;e<s.length&&0===s[e];)e++;return e===s.length?null:e}function o(e){for(null===e?e=s.length-1:e--;e>=0&&0===s[e];)e--;return e===-1?null:e}function i(e){var o=n(e,2),i=o[0],r=o[1];return a?null===r||r===s[i]-1?(i=t(i),null===i?[null,null]:[i,0]):[i,r+1]:0===s||r===s-1?[null,null]:null===r?[null,0]:[null,r+1]}function r(e){var t=n(e,2),i=t[0],r=t[1];return a?null===r||0===r?(i=o(i),null===i?[null,null]:[i,s[i]-1]):[i,r-1]:0===s||0===r?[null,null]:null===r?[null,s-1]:[null,r-1]}function u(e){return null===i(e)[1]}var s=e.data,a=e.multiSection;return{next:i,prev:r,isLast:u}}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=[],o=!0,i=!1,r=void 0;try{for(var u,s=e[Symbol.iterator]();!(o=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&s.return&&s.return()}finally{if(i)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n(13),s=o(u),a=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=r(t,2),o=n[0],u=n[1];return 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 l=n.map(function(e){return o[e]}).filter(a);return"string"==typeof l[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,i(l)):l.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(i(l)))}}},e.exports=t.default},function(e,t){"use strict";function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function o(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter(function(t){return i.call(e,t)})}var i=Object.prototype.propertyIsEnumerable;e.exports=Object.assign||function(e,t){for(var i,r,u=n(e),s=1;s<arguments.length;s++){i=arguments[s],r=o(Object(i));for(var a=0;a<r.length;a++)u[r[a]]=i[r[a]]}return u}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(2),l=o(a),c=n(3),g=o(c),d=n(15),f=o(d),h=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e){return(0,f.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,o=e.theme,i=e.sectionKeyPrefix,r=n(t);return r?l.default.createElement("div",o(i+"title","sectionTitle"),r):null}}]),t}(a.Component);h.propTypes={section:g.default.any.isRequired,renderSectionTitle:g.default.func.isRequired,theme:g.default.func.isRequired,sectionKeyPrefix:g.default.string.isRequired},t.default=h},function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e===t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!0;var u={},s=void 0,a=void 0;for(s=0,a=n.length;s<a;s++)u[n[s]]=!0;for(s=0,a=i.length;s<a;s++){var l=i[s],c=e[l],g=t[l];if(c!==g){if(!u[l]||null===c||null===g||"object"!==("undefined"==typeof c?"undefined":o(c))||"object"!==("undefined"==typeof g?"undefined":o(g)))return!0;var d=Object.keys(c),f=Object.keys(g);if(d.length!==f.length)return!0;for(var h=0,p=d.length;h<p;h++){var m=d[h];if(c[m]!==g[m])return!0}}}return!1}Object.defineProperty(t,"__esModule",{value:!0});var o="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};t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(2),c=o(l),g=n(3),d=o(g),f=n(17),h=o(f),p=n(15),m=o(p),v=function(e){function t(){var e,n,o,u;i(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=o=r(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),o.storeHighlightedItemReference=function(e){o.props.onHighlightedItemChange(null===e?null:e.item)},u=n,r(o,u)}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,m.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,o=t.itemProps,i=t.renderItem,r=t.renderItemData,u=t.sectionIndex,a=t.highlightedItemIndex,l=t.getItemId,g=t.theme,d=t.keyPrefix,f=null===u?d:d+"section-"+u+"-",p="function"==typeof o;return c.default.createElement("ul",s({role:"listbox"},g(f+"items-list","itemsList")),n.map(function(t,n){var d=0===n,m=n===a,v=f+"item-"+n,y=p?o({sectionIndex:u,itemIndex:n}):o,S=s({id:l(u,n),"aria-selected":m},g(v,"item",d&&"itemFirst",m&&"itemHighlighted"),y);return m&&(S.ref=e.storeHighlightedItemReference),c.default.createElement(h.default,s({},S,{sectionIndex:u,isHighlighted:m,itemIndex:n,item:t,renderItem:i,renderItemData:r}))}))}}]),t}(l.Component);v.propTypes={items:d.default.array.isRequired,itemProps:d.default.oneOfType([d.default.object,d.default.func]),renderItem:d.default.func.isRequired,renderItemData:d.default.object.isRequired,sectionIndex:d.default.number,highlightedItemIndex:d.default.number,onHighlightedItemChange:d.default.func.isRequired,getItemId:d.default.func.isRequired,theme:d.default.func.isRequired,keyPrefix:d.default.string.isRequired},v.defaultProps={sectionIndex:null},t.default=v},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 s(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(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),g=o(c),d=n(3),f=o(d),h=n(15),p=o(h),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,a=Array(s),l=0;l<s;l++)a[l]=arguments[l];return n=o=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),o.storeItemReference=function(e){null!==e&&(o.item=e)},o.onMouseEnter=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseEnter(e,{sectionIndex:n,itemIndex:i})},o.onMouseLeave=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseLeave(e,{sectionIndex:n,itemIndex:i})},o.onMouseDown=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onMouseDown(e,{sectionIndex:n,itemIndex:i})},o.onClick=function(e){var t=o.props,n=t.sectionIndex,i=t.itemIndex;o.props.onClick(e,{sectionIndex:n,itemIndex:i})},i=n,u(o,i)}return s(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){return(0,p.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,o=e.renderItem,r=e.renderItemData,u=i(e,["isHighlighted","item","renderItem","renderItemData"]);return delete u.sectionIndex,delete u.itemIndex,"function"==typeof u.onMouseEnter&&(u.onMouseEnter=this.onMouseEnter),
"function"==typeof u.onMouseLeave&&(u.onMouseLeave=this.onMouseLeave),"function"==typeof u.onMouseDown&&(u.onMouseDown=this.onMouseDown),"function"==typeof u.onClick&&(u.onClick=this.onClick),g.default.createElement("li",a({role:"option"},u,{ref:this.storeItemReference}),o(n,a({isHighlighted:t},r)))}}]),t}(c.Component);m.propTypes={sectionIndex:f.default.number,isHighlighted:f.default.bool.isRequired,itemIndex:f.default.number.isRequired,item:f.default.any.isRequired,renderItem:f.default.func.isRequired,renderItemData:f.default.object.isRequired,onMouseEnter:f.default.func,onMouseLeave:f.default.func,onMouseDown:f.default.func,onClick:f.default.func},t.default=m},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.defaultTheme={container:"react-autosuggest__container",containerOpen:"react-autosuggest__container--open",input:"react-autosuggest__input",inputOpen:"react-autosuggest__input--open",inputFocused:"react-autosuggest__input--focused",suggestionsContainer:"react-autosuggest__suggestions-container",suggestionsContainerOpen:"react-autosuggest__suggestions-container--open",suggestionsList:"react-autosuggest__suggestions-list",suggestion:"react-autosuggest__suggestion",suggestionFirst:"react-autosuggest__suggestion--first",suggestionHighlighted:"react-autosuggest__suggestion--highlighted",sectionContainer:"react-autosuggest__section-container",sectionContainerFirst:"react-autosuggest__section-container--first",sectionTitle:"react-autosuggest__section-title"},t.mapToAutowhateverTheme=function(e){var t={};for(var n in e)switch(n){case"suggestionsContainer":t.itemsContainer=e[n];break;case"suggestionsContainerOpen":t.itemsContainerOpen=e[n];break;case"suggestion":t.item=e[n];break;case"suggestionFirst":t.itemFirst=e[n];break;case"suggestionHighlighted":t.itemHighlighted=e[n];break;case"suggestionsList":t.itemsList=e[n];break;default:t[n]=e[n]}return t}}])});
{
"name": "react-autosuggest",
"version": "9.4.1",
"version": "9.4.2",
"description": "WAI-ARIA compliant React autosuggest component",

@@ -81,30 +81,10 @@ "main": "dist/index.js",

},
"files": [
"dist"
],
"files": ["dist"],
"lint-staged": {
".*.js": [
"npm run prettier",
"git add"
],
"*.js": [
"npm run prettier",
"git add"
],
"demo/src/**/*.js": [
"npm run prettier",
"git add"
],
"demo/standalone/app.js": [
"npm run prettier",
"git add"
],
"src/**/*.js": [
"npm run prettier",
"git add"
],
"test/**/*.js": [
"npm run prettier",
"git add"
]
".*.js": ["npm run prettier", "git add"],
"*.js": ["npm run prettier", "git add"],
"demo/src/**/*.js": ["npm run prettier", "git add"],
"demo/standalone/app.js": ["npm run prettier", "git add"],
"src/**/*.js": ["npm run prettier", "git add"],
"test/**/*.js": ["npm run prettier", "git add"]
},

@@ -135,16 +115,6 @@ "keywords": [

"lines": 95,
"include": [
"src/*.js"
],
"exclude": [
"test/**/*.js"
],
"reporter": [
"lcov",
"text-summary"
],
"require": [
"babel-register",
"./test/setup.js"
],
"include": ["src/*.js"],
"exclude": ["test/**/*.js"],
"reporter": ["lcov", "text-summary"],
"require": ["babel-register", "./test/setup.js"],
"check-coverage": true

@@ -151,0 +121,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc