downshift 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/downshift.cjs.js +22 -5
- package/dist/downshift.esm.js +22 -5
- package/dist/downshift.native.cjs.js +17 -2
- package/dist/downshift.umd.js +142 -48
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/preact/dist/downshift.cjs.js +22 -5
- package/preact/dist/downshift.esm.js +22 -5
- package/preact/dist/downshift.umd.js +142 -48
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(e.Downshift={},e.preact)}(this,function(e,t){"use strict";var n="default"in t?t.default:t;function o(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}function r(){return(r=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}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u(e,t){return e(t={exports:{}},t.exports),t.exports}var l=u(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,o=n?Symbol.for("react.element"):60103,r=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,d=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,c=n?Symbol.for("react.placeholder"):60113;function h(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case d:case i:case u:case s:return e;default:switch(e=e&&e.$$typeof){case a:case p:case l:return e;default:return t}}case r:return t}}}t.typeOf=h,t.AsyncMode=d,t.ContextConsumer=a,t.ContextProvider=l,t.Element=o,t.ForwardRef=p,t.Fragment=i,t.Profiler=u,t.Portal=r,t.StrictMode=s,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===u||e===s||e===c||"object"==typeof e&&null!==e&&("function"==typeof e.then||e.$$typeof===l||e.$$typeof===a||e.$$typeof===p)},t.isAsyncMode=function(e){return h(e)===d},t.isContextConsumer=function(e){return h(e)===a},t.isContextProvider=function(e){return h(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return h(e)===p},t.isFragment=function(e){return h(e)===i},t.isProfiler=function(e){return h(e)===u},t.isPortal=function(e){return h(e)===r},t.isStrictMode=function(e){return h(e)===s}});s(l);l.typeOf,l.AsyncMode,l.ContextConsumer,l.ContextProvider,l.Element,l.ForwardRef,l.Fragment,l.Profiler,l.Portal,l.StrictMode,l.isValidElementType,l.isAsyncMode,l.isContextConsumer,l.isContextProvider,l.isElement,l.isForwardRef,l.isFragment,l.isProfiler,l.isPortal,l.isStrictMode;var a=u(function(e,t){});s(a);a.typeOf,a.AsyncMode,a.ContextConsumer,a.ContextProvider,a.Element,a.ForwardRef,a.Fragment,a.Profiler,a.Portal,a.StrictMode,a.isValidElementType,a.isAsyncMode,a.isContextConsumer,a.isContextProvider,a.isElement,a.isForwardRef,a.isFragment,a.isProfiler,a.isPortal,a.isStrictMode,u(function(e){e.exports=l}).isForwardRef;var d="undefined"==typeof document?null:document.getElementById("a11y-status-message"),p=[];function c(e){var t=p[p.length-1]===e;p=t?p.concat([e]):[e];for(var n=function(){if(d)return d;return(d=document.createElement("div")).setAttribute("id","a11y-status-message"),d.setAttribute("role","status"),d.setAttribute("aria-live","assertive"),d.setAttribute("aria-relevant","additions text"),Object.assign(d.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(d),d}();n.lastChild;)n.removeChild(n.firstChild);p.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===p.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}var h=0,f=2,g=3,m=4,v=5,I=6,y=7,S=8,w=9,b=10,C=11,x=12,P=Object.freeze({unknown:h,mouseUp:1,itemMouseEnter:f,keyDownArrowUp:g,keyDownArrowDown:m,keyDownEscape:v,keyDownEnter:I,clickItem:y,blurInput:S,changeInput:w,keyDownSpaceButton:b,clickButton:C,blurButton:x,controlledPropUpdatedSelectedItem:13,touchStart:14});function M(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function O(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function E(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return O(n.overflowY,t)||O(n.overflowX,t)}return!1}function H(e,t,n,o,r,i,s,u){return i<e&&s>t||i>e&&s<t?0:i<=e&&u<=n||s>=t&&u>=n?i-e-o:s>t&&u<n||i<e&&u>n?s-t+r:0}var D=function(e,t){var n=t.scrollMode,o=t.block,r=t.inline,i=t.boundary,s=t.skipOverflowHiddenElements,u="function"==typeof i?i:function(e){return e!==i};if(!M(e))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,a=[],d=e;M(d)&&u(d);){if((d=d.parentNode)===l){a.push(d);break}d===document.body&&E(d)&&!E(document.documentElement)||E(d,s)&&a.push(d)}for(var p=window.visualViewport?visualViewport.width:innerWidth,c=window.visualViewport?visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),m=g.height,v=g.width,I=g.top,y=g.right,S=g.bottom,w=g.left,b="start"===o||"nearest"===o?I:"end"===o?S:I+m/2,C="center"===r?w+v/2:"end"===r?y:w,x=[],P=0;P<a.length;P++){var O=a[P],D=O.getBoundingClientRect(),A=D.height,R=D.width,T=D.top,k=D.right,_=D.bottom,V=D.left;if("if-needed"===n&&I>=0&&w>=0&&S<=c&&y<=p&&I>=T&&S<=_&&w>=V&&y<=k)return x;var K=getComputedStyle(O),B=parseInt(K.borderLeftWidth,10),j=parseInt(K.borderTopWidth,10),F=parseInt(K.borderRightWidth,10),L=parseInt(K.borderBottomWidth,10),N=0,U=0,W="offsetWidth"in O?O.offsetWidth-O.clientWidth-B-F:0,$="offsetHeight"in O?O.offsetHeight-O.clientHeight-j-L:0;if(l===O)N="start"===o?b:"end"===o?b-c:"nearest"===o?H(f,f+c,c,j,L,f+b,f+b+m,m):b-c/2,U="start"===r?C:"center"===r?C-p/2:"end"===r?C-p:H(h,h+p,p,B,F,h+C,h+C+v,v),N=Math.max(0,N+f),U=Math.max(0,U+h);else{N="start"===o?b-T-j:"end"===o?b-_+L+$:"nearest"===o?H(T,_,A,j,L+$,b,b+m,m):b-(T+A/2)+$/2,U="start"===r?C-V-B:"center"===r?C-(V+R/2)+W/2:"end"===r?C-k+F+W:H(V,k,R,B,F+W,C,C+v,v);var X=O.scrollLeft,Y=O.scrollTop;b+=Y-(N=Math.max(0,Math.min(Y+N,O.scrollHeight-A+$))),C+=X-(U=Math.max(0,Math.min(X+U,O.scrollWidth-R+W)))}x.push({el:O,top:N,left:U})}return x},A=0;function R(e){return"function"==typeof e?e:T}function T(){}function k(e,t){return e===t||e.contains&&e.contains(t)}function _(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault})}}function V(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var K=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return K.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function j(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}var F=function(e){var t,s;function u(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+String(A++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var o=setTimeout(function(){n.timeoutIds=n.timeoutIds.filter(function(e){return e!==o}),e()},t);n.timeoutIds.push(o)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(r({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,o){t=B(t),n.internalSetState(r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),o)},n.selectItemAtIndex=function(e,t,o){var r=n.items[e];null!=r&&n.selectItem(r,t,o)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var o,i,s={},u="function"==typeof e;return!u&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,r({},n.getStateAndHelpers(),e)),n.setState(function(t){t=n.getState(t);var l=u?e(t):e;l=n.props.stateReducer(t,l),o=l.hasOwnProperty("selectedItem");var a={},d={};return o&&l.selectedItem!==t.selectedItem&&(i=l.selectedItem),l.type=l.type||h,Object.keys(l).forEach(function(e){t[e]!==l[e]&&(s[e]=l[e]),"type"!==e&&(d[e]=l[e],n.isControlledProp(e)||(a[e]=l[e]))}),u&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,r({},n.getStateAndHelpers(),l)),a},function(){R(t)(),Object.keys(s).length>1&&n.props.onStateChange(s,n.getStateAndHelpers()),o&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==i&&n.props.onChange(i,n.getStateAndHelpers()),n.props.onUserAction(s,n.getStateAndHelpers())})},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,l=void 0===u?"ref":u,a=o(s,["refKey"]),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;n.getRootProps.called=!0,n.getRootProps.refKey=l,n.getRootProps.suppressRefError=p;var c=n.getState().isOpen;return r(((i={})[l]=n.rootRef,i.role="combobox",i["aria-expanded"]=c,i["aria-haspopup"]="listbox",i["aria-owns"]=c?n.menuId:null,i["aria-labelledby"]=n.labelId,i),a)},n.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:m})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:g})},Enter:function(e){var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;if(n&&null!=o){e.preventDefault();var r=this.items[o],i=this.getItemNodeFromIndex(o);if(null==r||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:I})}},Escape:function(e){e.preventDefault(),this.reset({type:v})}},n.buttonKeyDownHandlers=r({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:b})}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick,s=(t.onPress,t.onKeyDown),u=t.onKeyUp,l=t.onBlur,a=o(t,["onClick","onPress","onKeyDown","onKeyUp","onBlur"]),d=n.getState().isOpen,p={onClick:_(i,n.button_handleClick),onKeyDown:_(s,n.button_handleKeyDown),onKeyUp:_(u,n.button_handleKeyUp),onBlur:_(l,n.button_handleBlur)};return r({type:"button",role:"button","aria-label":d?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:p,a)},n.button_handleKeyUp=function(e){e.preventDefault()},n.button_handleKeyDown=function(e){var t=j(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(i(i(n)),e)},n.button_handleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout(function(){return n.toggleMenu({type:C})})},n.button_handleBlur=function(e){var t=e.target;n.internalSetTimeout(function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:x})})},n.getLabelProps=function(e){return r({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,s=t.onBlur,u=t.onChange,l=t.onInput,a=(t.onChangeText,o(t,["onKeyDown","onBlur","onChange","onInput","onChangeText"])),d={};var p,c=n.getState(),h=c.inputValue,f=c.isOpen,g=c.highlightedIndex;a.disabled||((p={}).onInput=_(u,l,n.input_handleChange),p.onKeyDown=_(i,n.input_handleKeyDown),p.onBlur=_(s,n.input_handleBlur),d=p);return r({"aria-autocomplete":"list","aria-activedescendant":f&&"number"==typeof g&&g>=0?n.getItemId(g):null,"aria-controls":f?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:h,id:n.inputId},d,a)},n.input_handleKeyDown=function(e){var t=j(e);t&&n.keyDownHandlers[t]&&n.keyDownHandlers[t].call(i(i(n)),e)},n.input_handleChange=function(e){n.internalSetState({type:w,isOpen:!0,inputValue:e.target.value})},n.input_handleTextChange=function(e){n.internalSetState({type:w,isOpen:!0,inputValue:e})},n.input_handleBlur=function(){n.internalSetTimeout(function(){var e=n.props.environment.document&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:S})})},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,l=void 0===u?"ref":u,a=s.ref,d=o(s,["refKey","ref"]),p=(void 0===t?{}:t).suppressRefError,c=void 0!==p&&p;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=c,r(((i={})[l]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];t.forEach(function(e){e&&e.apply(void 0,n)})}}(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?null:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,s=i.onMouseMove,u=i.onMouseDown,l=i.onClick,a=(i.onPress,i.index),d=i.item,p=void 0===d?void 0:d,c=o(i,["onMouseMove","onMouseDown","onClick","onPress","index","item"]);void 0===a?(n.items.push(p),a=n.items.indexOf(p)):n.items[a]=p;var h=l,g=((t={onMouseMove:_(s,function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:f}),n.avoidScrolling=!0,n.internalSetTimeout(function(){return n.avoidScrolling=!1},250))}),onMouseDown:_(u,function(e){e.preventDefault()})}).onClick=_(h,function(){n.selectItemAtIndex(a,{type:y})}),t),m=c.disabled?{onMouseDown:g.onMouseDown}:g;return r({id:n.getItemId(a),role:"option","aria-selected":n.getState().selectedItem===p},m,c)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState(function(t){var o=t.selectedItem;return r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(o)},e)},t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState(function(t){return r({isOpen:!t.isOpen},e)},function(){n.getState().isOpen&&n.setHighlightedIndex(void 0,e),R(t)()})},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=function(e,t){var n;function o(){n&&clearTimeout(n)}function r(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];o(),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}return r.cancel=o,r}(function(){var e=n.getState(),t=n.items[e.highlightedIndex],o=n.getItemCount(),i=n.props.getA11yStatusMessage(r({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:o,highlightedItem:t},e));n.previousResultCount=o,c(i)},200);var s=n.props,u=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,a=void 0===l?u:l,d=s.defaultIsOpen,p=s.initialIsOpen,P=void 0===p?d:p,M=s.initialInputValue,O=void 0===M?"":M,E=s.initialSelectedItem,H=void 0===E?null:E,D=n.getState({highlightedIndex:a,isOpen:P,inputValue:O,selectedItem:H});return null!=D.selectedItem&&void 0===n.props.initialInputValue&&(D.inputValue=n.props.itemToString(D.selectedItem)),n.state=D,n}s=e,(t=u).prototype=Object.create(s.prototype),t.prototype.constructor=t,t.__proto__=s;var l=u.prototype;return l.internalClearTimeouts=function(){this.timeoutIds.forEach(function(e){clearTimeout(e)}),this.timeoutIds=[]},l.getState=function(e){var t=this;return void 0===e&&(e=this.state),Object.keys(e).reduce(function(n,o){return n[o]=t.isControlledProp(o)?t.props[o]:e[o],n},{})},l.isControlledProp=function(e){return void 0!==this.props[e]},l.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},l.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},l.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._rootNode)},l.moveHighlightedIndex=function(e,t){var n=this;this.getState().isOpen?this.changeHighlightedIndex(e,t):this.openMenu(function(){var e,o=t.type,i=n.getItemCount();i&&o&&(o===m&&(e=0),o===g&&(e=i-1)),n.setHighlightedIndex(e,r({},t))})},l.changeHighlightedIndex=function(e,t){var n=this.getItemCount()-1;if(!(n<0)){var o=this.getState().highlightedIndex;null===o&&(o=e>0?-1:n+1);var r=o+e;r<0?r=n:r>n&&(r=0),this.setHighlightedIndex(r,t)}},l.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen,i=this.props.itemToString,s=this.id,u=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,d=this.getMenuProps,p=this.getInputProps,c=this.getItemProps,h=this.openMenu,f=this.closeMenu,g=this.toggleMenu,m=this.selectItem,v=this.selectItemAtIndex,I=this.selectHighlightedItem,y=this.setHighlightedIndex,S=this.clearSelection,w=this.clearItems;return{getRootProps:u,getToggleButtonProps:l,getLabelProps:a,getMenuProps:d,getInputProps:p,getItemProps:c,reset:this.reset,openMenu:h,closeMenu:f,toggleMenu:g,selectItem:m,selectItemAtIndex:v,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:S,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:s,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}},l.componentDidMount=function(){var e=this,t=function(t,n){void 0===n&&(n=!0);var o=e.props.environment.document;return[e._rootNode,e._menuNode].some(function(e){return e&&(k(e,t)||n&&k(e,o.activeElement))})},n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1,!t(n.target)&&e.getState().isOpen&&e.reset({type:1},function(){return e.props.onOuterClick(e.getStateAndHelpers())})},r=function(n){!t(n.target,!1)&&e.getState().isOpen&&e.reset({type:14},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",n),this.props.environment.addEventListener("mouseup",o),this.props.environment.addEventListener("touchstart",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),e.props.environment.removeEventListener("mousedown",n),e.props.environment.removeEventListener("mouseup",o),e.props.environment.removeEventListener("touchstart",r)}},l.componentDidUpdate=function(e,t){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:13,inputValue:this.props.itemToString(this.props.selectedItem)});var n=void 0===this.props.highlightedIndex?this.state:this.props,o=void 0===e.highlightedIndex?t:e;n.highlightedIndex===o.highlightedIndex||this.avoidScrolling||this.scrollHighlightedItemIntoView(),this.updateStatus()},l.componentWillUnmount=function(){this.cleanup()},l.render=function(){var e=V(this.props.children,T);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=V(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.nodeName}(t)?n.cloneElement(t,this.getRootProps(function(e){return e.attributes}(t))):void 0:null},u}(t.Component);F.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,r=e.resultCount,i=e.previousResultCount,s=e.itemToString;return t?r?n&&r===i?s(n):r+" "+(1===r?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?s(o):""},itemToString:function(e){return null==e?"":String(e)},onStateChange:T,onInputValueChange:T,onUserAction:T,onChange:T,onSelect:T,onOuterClick:T,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:function(e,t){null!==e&&D(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach(function(e){var t=e.el,n=e.top,o=e.left;t.scrollTop=n,t.scrollLeft=o})}},F.stateChangeTypes=P,e.default=F,e.resetIdCounter=function(){A=0},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(e.Downshift={},e.preact)}(this,function(e,t){"use strict";var n="default"in t?t.default:t;function o(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}function r(){return(r=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}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u(e,t){return e(t={exports:{}},t.exports),t.exports}var l=u(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&Symbol.for,o=n?Symbol.for("react.element"):60103,r=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,d=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,c=n?Symbol.for("react.forward_ref"):60112,h=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case d:case p:case i:case u:case s:return e;default:switch(e=e&&e.$$typeof){case a:case c:case l:return e;default:return t}}case r:return t}}}function v(e){return m(e)===p}t.typeOf=m,t.AsyncMode=d,t.ConcurrentMode=p,t.ContextConsumer=a,t.ContextProvider=l,t.Element=o,t.ForwardRef=c,t.Fragment=i,t.Profiler=u,t.Portal=r,t.StrictMode=s,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===p||e===u||e===s||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===f||e.$$typeof===l||e.$$typeof===a||e.$$typeof===c)},t.isAsyncMode=function(e){return v(e)||m(e)===d},t.isConcurrentMode=v,t.isContextConsumer=function(e){return m(e)===a},t.isContextProvider=function(e){return m(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return m(e)===c},t.isFragment=function(e){return m(e)===i},t.isProfiler=function(e){return m(e)===u},t.isPortal=function(e){return m(e)===r},t.isStrictMode=function(e){return m(e)===s}});s(l);l.typeOf,l.AsyncMode,l.ConcurrentMode,l.ContextConsumer,l.ContextProvider,l.Element,l.ForwardRef,l.Fragment,l.Profiler,l.Portal,l.StrictMode,l.isValidElementType,l.isAsyncMode,l.isConcurrentMode,l.isContextConsumer,l.isContextProvider,l.isElement,l.isForwardRef,l.isFragment,l.isProfiler,l.isPortal,l.isStrictMode;var a=u(function(e,t){});s(a);a.typeOf,a.AsyncMode,a.ConcurrentMode,a.ContextConsumer,a.ContextProvider,a.Element,a.ForwardRef,a.Fragment,a.Profiler,a.Portal,a.StrictMode,a.isValidElementType,a.isAsyncMode,a.isConcurrentMode,a.isContextConsumer,a.isContextProvider,a.isElement,a.isForwardRef,a.isFragment,a.isProfiler,a.isPortal,a.isStrictMode,u(function(e){e.exports=l}).isForwardRef;var d="undefined"==typeof document?null:document.getElementById("a11y-status-message"),p=[];function c(e){var t=p[p.length-1]===e;p=t?p.concat([e]):[e];for(var n=function(){if(d)return d;return(d=document.createElement("div")).setAttribute("id","a11y-status-message"),d.setAttribute("role","status"),d.setAttribute("aria-live","assertive"),d.setAttribute("aria-relevant","additions text"),Object.assign(d.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(d),d}();n.lastChild;)n.removeChild(n.firstChild);p.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===p.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}var h=0,f=2,g=3,m=4,v=5,I=6,y=7,S=8,w=9,b=10,C=11,x=12,M=Object.freeze({unknown:h,mouseUp:1,itemMouseEnter:f,keyDownArrowUp:g,keyDownArrowDown:m,keyDownEscape:v,keyDownEnter:I,clickItem:y,blurInput:S,changeInput:w,keyDownSpaceButton:b,clickButton:C,blurButton:x,controlledPropUpdatedSelectedItem:13,touchEnd:14});function P(e){return null!=e&&"object"==typeof e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function O(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)}return!1}function H(e,t,n,o,r,i,s,u){return i<e&&s>t||i>e&&s<t?0:i<=e&&u<=n||s>=t&&u>=n?i-e-o:s>t&&u<n||i<e&&u>n?s-t+r:0}var D=function(e,t){var n=t.scrollMode,o=t.block,r=t.inline,i=t.boundary,s=t.skipOverflowHiddenElements,u="function"==typeof i?i:function(e){return e!==i};if(!P(e))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,a=[],d=e;P(d)&&u(d);){if((d=d.parentNode)===l){a.push(d);break}d===document.body&&O(d)&&!O(document.documentElement)||O(d,s)&&a.push(d)}for(var p=window.visualViewport?visualViewport.width:innerWidth,c=window.visualViewport?visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),m=g.height,v=g.width,I=g.top,y=g.right,S=g.bottom,w=g.left,b="start"===o||"nearest"===o?I:"end"===o?S:I+m/2,C="center"===r?w+v/2:"end"===r?y:w,x=[],M=0;M<a.length;M++){var E=a[M],D=E.getBoundingClientRect(),A=D.height,R=D.width,T=D.top,_=D.right,k=D.bottom,V=D.left;if("if-needed"===n&&I>=0&&w>=0&&S<=c&&y<=p&&I>=T&&S<=k&&w>=V&&y<=_)return x;var K=getComputedStyle(E),B=parseInt(K.borderLeftWidth,10),j=parseInt(K.borderTopWidth,10),F=parseInt(K.borderRightWidth,10),L=parseInt(K.borderBottomWidth,10),$=0,N=0,U="offsetWidth"in E?E.offsetWidth-E.clientWidth-B-F:0,W="offsetHeight"in E?E.offsetHeight-E.clientHeight-j-L:0;if(l===E)$="start"===o?b:"end"===o?b-c:"nearest"===o?H(f,f+c,c,j,L,f+b,f+b+m,m):b-c/2,N="start"===r?C:"center"===r?C-p/2:"end"===r?C-p:H(h,h+p,p,B,F,h+C,h+C+v,v),$=Math.max(0,$+f),N=Math.max(0,N+h);else{$="start"===o?b-T-j:"end"===o?b-k+L+W:"nearest"===o?H(T,k,A,j,L+W,b,b+m,m):b-(T+A/2)+W/2,N="start"===r?C-V-B:"center"===r?C-(V+R/2)+U/2:"end"===r?C-_+F+U:H(V,_,R,B,F+U,C,C+v,v);var X=E.scrollLeft,Y=E.scrollTop;b+=Y-($=Math.max(0,Math.min(Y+$,E.scrollHeight-A+W))),C+=X-(N=Math.max(0,Math.min(X+N,E.scrollWidth-R+U)))}x.push({el:E,top:$,left:N})}return x},A=0;function R(e){return"function"==typeof e?e:T}function T(){}function _(e,t){return e===t||e.contains&&e.contains(t)}function k(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault})}}function V(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var K=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return K.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function j(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}var F=function(e){var t,s;function u(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+String(A++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var o=setTimeout(function(){n.timeoutIds=n.timeoutIds.filter(function(e){return e!==o}),e()},t);n.timeoutIds.push(o)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(r({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,o){t=B(t),n.internalSetState(r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),o)},n.selectItemAtIndex=function(e,t,o){var r=n.items[e];null!=r&&n.selectItem(r,t,o)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var o,i,s={},u="function"==typeof e;return!u&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,r({},n.getStateAndHelpers(),e)),n.setState(function(t){t=n.getState(t);var l=u?e(t):e;l=n.props.stateReducer(t,l),o=l.hasOwnProperty("selectedItem");var a={},d={};return o&&l.selectedItem!==t.selectedItem&&(i=l.selectedItem),l.type=l.type||h,Object.keys(l).forEach(function(e){t[e]!==l[e]&&(s[e]=l[e]),"type"!==e&&(d[e]=l[e],n.isControlledProp(e)||(a[e]=l[e]))}),u&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,r({},n.getStateAndHelpers(),l)),a},function(){R(t)(),Object.keys(s).length>1&&n.props.onStateChange(s,n.getStateAndHelpers()),o&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==i&&n.props.onChange(i,n.getStateAndHelpers()),n.props.onUserAction(s,n.getStateAndHelpers())})},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,l=void 0===u?"ref":u,a=o(s,["refKey"]),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;n.getRootProps.called=!0,n.getRootProps.refKey=l,n.getRootProps.suppressRefError=p;var c=n.getState().isOpen;return r(((i={})[l]=n.rootRef,i.role="combobox",i["aria-expanded"]=c,i["aria-haspopup"]="listbox",i["aria-owns"]=c?n.menuId:null,i["aria-labelledby"]=n.labelId,i),a)},n.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:m})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:g})},Enter:function(e){var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;if(n&&null!=o){e.preventDefault();var r=this.items[o],i=this.getItemNodeFromIndex(o);if(null==r||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:I})}},Escape:function(e){e.preventDefault(),this.reset({type:v})}},n.buttonKeyDownHandlers=r({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:b})}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick,s=(t.onPress,t.onKeyDown),u=t.onKeyUp,l=t.onBlur,a=o(t,["onClick","onPress","onKeyDown","onKeyUp","onBlur"]),d=n.getState().isOpen,p={onClick:k(i,n.button_handleClick),onKeyDown:k(s,n.button_handleKeyDown),onKeyUp:k(u,n.button_handleKeyUp),onBlur:k(l,n.button_handleBlur)};return r({type:"button",role:"button","aria-label":d?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:p,a)},n.button_handleKeyUp=function(e){e.preventDefault()},n.button_handleKeyDown=function(e){var t=j(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(i(i(n)),e)},n.button_handleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout(function(){return n.toggleMenu({type:C})})},n.button_handleBlur=function(e){var t=e.target;n.internalSetTimeout(function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:x})})},n.getLabelProps=function(e){return r({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,s=t.onBlur,u=t.onChange,l=t.onInput,a=(t.onChangeText,o(t,["onKeyDown","onBlur","onChange","onInput","onChangeText"])),d={};var p,c=n.getState(),h=c.inputValue,f=c.isOpen,g=c.highlightedIndex;a.disabled||((p={}).onInput=k(u,l,n.input_handleChange),p.onKeyDown=k(i,n.input_handleKeyDown),p.onBlur=k(s,n.input_handleBlur),d=p);return r({"aria-autocomplete":"list","aria-activedescendant":f&&"number"==typeof g&&g>=0?n.getItemId(g):null,"aria-controls":f?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:h,id:n.inputId},d,a)},n.input_handleKeyDown=function(e){var t=j(e);t&&n.keyDownHandlers[t]&&n.keyDownHandlers[t].call(i(i(n)),e)},n.input_handleChange=function(e){n.internalSetState({type:w,isOpen:!0,inputValue:e.target.value})},n.input_handleTextChange=function(e){n.internalSetState({type:w,isOpen:!0,inputValue:e})},n.input_handleBlur=function(){n.internalSetTimeout(function(){var e=n.props.environment.document&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:S})})},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,s=void 0===e?{}:e,u=s.refKey,l=void 0===u?"ref":u,a=s.ref,d=o(s,["refKey","ref"]),p=(void 0===t?{}:t).suppressRefError,c=void 0!==p&&p;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=c,r(((i={})[l]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];t.forEach(function(e){e&&e.apply(void 0,n)})}}(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?null:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,s=i.onMouseMove,u=i.onMouseDown,l=i.onClick,a=(i.onPress,i.index),d=i.item,p=void 0===d?void 0:d,c=o(i,["onMouseMove","onMouseDown","onClick","onPress","index","item"]);void 0===a?(n.items.push(p),a=n.items.indexOf(p)):n.items[a]=p;var h=l,g=((t={onMouseMove:k(s,function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:f}),n.avoidScrolling=!0,n.internalSetTimeout(function(){return n.avoidScrolling=!1},250))}),onMouseDown:k(u,function(e){e.preventDefault()})}).onClick=k(h,function(){n.selectItemAtIndex(a,{type:y})}),t),m=c.disabled?{onMouseDown:g.onMouseDown}:g;return r({id:n.getItemId(a),role:"option","aria-selected":n.getState().selectedItem===p},m,c)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState(function(t){var o=t.selectedItem;return r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(o)},e)},t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState(function(t){return r({isOpen:!t.isOpen},e)},function(){n.getState().isOpen&&n.setHighlightedIndex(void 0,e),R(t)()})},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=function(e,t){var n;function o(){n&&clearTimeout(n)}function r(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];o(),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}return r.cancel=o,r}(function(){var e=n.getState(),t=n.items[e.highlightedIndex],o=n.getItemCount(),i=n.props.getA11yStatusMessage(r({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:o,highlightedItem:t},e));n.previousResultCount=o,c(i)},200);var s=n.props,u=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,a=void 0===l?u:l,d=s.defaultIsOpen,p=s.initialIsOpen,M=void 0===p?d:p,P=s.initialInputValue,E=void 0===P?"":P,O=s.initialSelectedItem,H=void 0===O?null:O,D=n.getState({highlightedIndex:a,isOpen:M,inputValue:E,selectedItem:H});return null!=D.selectedItem&&void 0===n.props.initialInputValue&&(D.inputValue=n.props.itemToString(D.selectedItem)),n.state=D,n}s=e,(t=u).prototype=Object.create(s.prototype),t.prototype.constructor=t,t.__proto__=s;var l=u.prototype;return l.internalClearTimeouts=function(){this.timeoutIds.forEach(function(e){clearTimeout(e)}),this.timeoutIds=[]},l.getState=function(e){var t=this;return void 0===e&&(e=this.state),Object.keys(e).reduce(function(n,o){return n[o]=t.isControlledProp(o)?t.props[o]:e[o],n},{})},l.isControlledProp=function(e){return void 0!==this.props[e]},l.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},l.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},l.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._rootNode)},l.moveHighlightedIndex=function(e,t){var n=this;this.getState().isOpen?this.changeHighlightedIndex(e,t):this.openMenu(function(){var e,o=t.type,i=n.getItemCount();i&&o&&(o===m&&(e=0),o===g&&(e=i-1)),n.setHighlightedIndex(e,r({},t))})},l.changeHighlightedIndex=function(e,t){var n=this.getItemCount()-1;if(!(n<0)){var o=this.getState().highlightedIndex;null===o&&(o=e>0?-1:n+1);var r=o+e;r<0?r=n:r>n&&(r=0),this.setHighlightedIndex(r,t)}},l.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen,i=this.props.itemToString,s=this.id,u=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,d=this.getMenuProps,p=this.getInputProps,c=this.getItemProps,h=this.openMenu,f=this.closeMenu,g=this.toggleMenu,m=this.selectItem,v=this.selectItemAtIndex,I=this.selectHighlightedItem,y=this.setHighlightedIndex,S=this.clearSelection,w=this.clearItems;return{getRootProps:u,getToggleButtonProps:l,getLabelProps:a,getMenuProps:d,getInputProps:p,getItemProps:c,reset:this.reset,openMenu:h,closeMenu:f,toggleMenu:g,selectItem:m,selectItemAtIndex:v,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:S,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:s,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}},l.componentDidMount=function(){var e=this,t=function(t,n){void 0===n&&(n=!0);var o=e.props.environment.document;return[e._rootNode,e._menuNode].some(function(e){return e&&(_(e,t)||n&&_(e,o.activeElement))})},n=function(){e.isMouseDown=!0},o=function(n){e.isMouseDown=!1,!t(n.target)&&e.getState().isOpen&&e.reset({type:1},function(){return e.props.onOuterClick(e.getStateAndHelpers())})},r=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},s=function(n){var o=t(n.target,!1);e.isTouchMove||o||!e.getState().isOpen||e.reset({type:14},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",n),this.props.environment.addEventListener("mouseup",o),this.props.environment.addEventListener("touchstart",r),this.props.environment.addEventListener("touchmove",i),this.props.environment.addEventListener("touchend",s),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),e.props.environment.removeEventListener("mousedown",n),e.props.environment.removeEventListener("mouseup",o),e.props.environment.removeEventListener("touchstart",r),e.props.environment.removeEventListener("touchmove",i),e.props.environment.removeEventListener("touchend",s)}},l.componentDidUpdate=function(e,t){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:13,inputValue:this.props.itemToString(this.props.selectedItem)});var n=void 0===this.props.highlightedIndex?this.state:this.props,o=void 0===e.highlightedIndex?t:e;n.highlightedIndex===o.highlightedIndex||this.avoidScrolling||this.scrollHighlightedItemIntoView(),this.updateStatus()},l.componentWillUnmount=function(){this.cleanup()},l.render=function(){var e=V(this.props.children,T);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=V(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.nodeName}(t)?n.cloneElement(t,this.getRootProps(function(e){return e.attributes}(t))):void 0:null},u}(t.Component);F.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,r=e.resultCount,i=e.previousResultCount,s=e.itemToString;return t?r?n&&r===i?s(n):r+" "+(1===r?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?s(o):""},itemToString:function(e){return null==e?"":String(e)},onStateChange:T,onInputValueChange:T,onUserAction:T,onChange:T,onSelect:T,onOuterClick:T,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:function(e,t){null!==e&&D(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach(function(e){var t=e.el,n=e.top,o=e.left;t.scrollTop=n,t.scrollLeft=o})}},F.stateChangeTypes=M,e.default=F,e.resetIdCounter=function(){A=0},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=downshift.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downshift.umd.min.js","sources":["../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../src/set-a11y-status.js","../../src/stateChangeTypes.js","../../node_modules/compute-scroll-into-view/es/index.js","../../src/utils.js","../../src/downshift.js","../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"],"sourcesContent":["export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","/** @license React v16.5.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';Object.defineProperty(exports,\"__esModule\",{value:!0});\nvar b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.forward_ref\"):60112,n=b?Symbol.for(\"react.placeholder\"):60113;\nfunction q(a){if(\"object\"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}exports.typeOf=q;exports.AsyncMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;exports.StrictMode=f;\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===l||a===g||a===f||a===n||\"object\"===typeof a&&null!==a&&(\"function\"===typeof a.then||a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return q(a)===l};exports.isContextConsumer=function(a){return q(a)===k};exports.isContextProvider=function(a){return q(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};\nexports.isForwardRef=function(a){return q(a)===m};exports.isFragment=function(a){return q(a)===e};exports.isProfiler=function(a){return q(a)===g};exports.isPortal=function(a){return q(a)===d};exports.isStrictMode=function(a){return q(a)===f};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","// istanbul ignore next\nlet statusDiv =\n typeof document === 'undefined'\n ? null\n : document.getElementById('a11y-status-message')\n\nlet statuses = []\n\n/**\n * @param {String} status the status message\n */\nfunction setStatus(status) {\n const isSameAsLast = statuses[statuses.length - 1] === status\n if (isSameAsLast) {\n statuses = [...statuses, status]\n } else {\n statuses = [status]\n }\n const div = getStatusDiv()\n\n // Remove previous children\n while (div.lastChild) {\n div.removeChild(div.firstChild)\n }\n\n statuses.filter(Boolean).forEach((statusItem, index) => {\n div.appendChild(getStatusChildDiv(statusItem, index))\n })\n}\n\n/**\n * @param {String} status the status message\n * @param {Number} index the index\n * @return {HTMLElement} the child node\n */\nfunction getStatusChildDiv(status, index) {\n const display = index === statuses.length - 1 ? 'block' : 'none'\n\n const childDiv = document.createElement('div')\n childDiv.style.display = display\n childDiv.textContent = status\n\n return childDiv\n}\n\n/**\n * Get the status node or create it if it does not already exist\n * @return {HTMLElement} the status node\n */\nfunction getStatusDiv() {\n if (statusDiv) {\n return statusDiv\n }\n statusDiv = document.createElement('div')\n statusDiv.setAttribute('id', 'a11y-status-message')\n statusDiv.setAttribute('role', 'status')\n statusDiv.setAttribute('aria-live', 'assertive')\n statusDiv.setAttribute('aria-relevant', 'additions text')\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n })\n document.body.appendChild(statusDiv)\n return statusDiv\n}\n\nexport default setStatus\n","import productionEnum from './productionEnum.macro'\n\nexport const unknown = productionEnum('__autocomplete_unknown__')\nexport const mouseUp = productionEnum('__autocomplete_mouseup__')\nexport const itemMouseEnter = productionEnum('__autocomplete_item_mouseenter__')\nexport const keyDownArrowUp = productionEnum(\n '__autocomplete_keydown_arrow_up__',\n)\nexport const keyDownArrowDown = productionEnum(\n '__autocomplete_keydown_arrow_down__',\n)\nexport const keyDownEscape = productionEnum('__autocomplete_keydown_escape__')\nexport const keyDownEnter = productionEnum('__autocomplete_keydown_enter__')\nexport const clickItem = productionEnum('__autocomplete_click_item__')\nexport const blurInput = productionEnum('__autocomplete_blur_input__')\nexport const changeInput = productionEnum('__autocomplete_change_input__')\nexport const keyDownSpaceButton = productionEnum(\n '__autocomplete_keydown_space_button__',\n)\nexport const clickButton = productionEnum('__autocomplete_click_button__')\nexport const blurButton = productionEnum('__autocomplete_blur_button__')\nexport const controlledPropUpdatedSelectedItem = productionEnum(\n '__autocomplete_controlled_prop_updated_selected_item__',\n)\nexport const touchStart = productionEnum('__autocomplete_touchstart__')\n","function isElement(el) {\n return el != null && typeof el === 'object' && el.nodeType === 1;\n}\n\nfunction canOverflow(overflow, skipOverflowHiddenElements) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false;\n }\n\n return overflow !== 'visible' && overflow !== 'clip';\n}\n\nfunction isScrollable(el, skipOverflowHiddenElements) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n var style = getComputedStyle(el, null);\n return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements);\n }\n\n return false;\n}\n\nfunction alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {\n if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {\n return 0;\n }\n\n if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;\n }\n\n if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;\n }\n\n return 0;\n}\n\nexport default (function (target, options) {\n var scrollMode = options.scrollMode,\n block = options.block,\n inline = options.inline,\n boundary = options.boundary,\n skipOverflowHiddenElements = options.skipOverflowHiddenElements;\n var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {\n return node !== boundary;\n };\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target');\n }\n\n var scrollingElement = document.scrollingElement || document.documentElement;\n var frames = [];\n var cursor = target;\n\n while (isElement(cursor) && checkBoundary(cursor)) {\n cursor = cursor.parentNode;\n\n if (cursor === scrollingElement) {\n frames.push(cursor);\n break;\n }\n\n if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {\n continue;\n }\n\n if (isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor);\n }\n }\n\n var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;\n var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;\n var viewportX = window.scrollX || pageXOffset;\n var viewportY = window.scrollY || pageYOffset;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetHeight = _target$getBoundingCl.height,\n targetWidth = _target$getBoundingCl.width,\n targetTop = _target$getBoundingCl.top,\n targetRight = _target$getBoundingCl.right,\n targetBottom = _target$getBoundingCl.bottom,\n targetLeft = _target$getBoundingCl.left;\n\n var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;\n var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;\n var computations = [];\n\n for (var index = 0; index < frames.length; index++) {\n var frame = frames[index];\n\n var _frame$getBoundingCli = frame.getBoundingClientRect(),\n _height = _frame$getBoundingCli.height,\n _width = _frame$getBoundingCli.width,\n _top = _frame$getBoundingCli.top,\n right = _frame$getBoundingCli.right,\n bottom = _frame$getBoundingCli.bottom,\n _left = _frame$getBoundingCli.left;\n\n if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= _top && targetBottom <= bottom && targetLeft >= _left && targetRight <= right) {\n return computations;\n }\n\n var frameStyle = getComputedStyle(frame);\n var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);\n var borderTop = parseInt(frameStyle.borderTopWidth, 10);\n var borderRight = parseInt(frameStyle.borderRightWidth, 10);\n var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);\n var blockScroll = 0;\n var inlineScroll = 0;\n var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;\n var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;\n\n if (scrollingElement === frame) {\n if (block === 'start') {\n blockScroll = targetBlock;\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - viewportHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline;\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth;\n } else {\n inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);\n }\n\n blockScroll = Math.max(0, blockScroll + viewportY);\n inlineScroll = Math.max(0, inlineScroll + viewportX);\n } else {\n if (block === 'start') {\n blockScroll = targetBlock - _top - borderTop;\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(_top, bottom, _height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - (_top + _height / 2) + scrollbarHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - _left - borderLeft;\n } else if (inline === 'center') {\n inlineScroll = targetInline - (_left + _width / 2) + scrollbarWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth;\n } else {\n inlineScroll = alignNearest(_left, right, _width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);\n }\n\n var scrollLeft = frame.scrollLeft,\n scrollTop = frame.scrollTop;\n blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - _height + scrollbarHeight));\n inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - _width + scrollbarWidth));\n targetBlock += scrollTop - blockScroll;\n targetInline += scrollLeft - inlineScroll;\n }\n\n computations.push({\n el: frame,\n top: blockScroll,\n left: inlineScroll\n });\n }\n\n return computations;\n});","import computeScrollIntoView from 'compute-scroll-into-view'\nimport {isPreact} from './is.macro'\n\nlet idCounter = 0\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop\n}\n\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} rootNode the root element of the component\n */\nfunction scrollIntoView(node, rootNode) {\n if (node === null) {\n return\n }\n\n const actions = computeScrollIntoView(node, {\n boundary: rootNode,\n block: 'nearest',\n scrollMode: 'if-needed',\n })\n actions.forEach(({el, top, left}) => {\n el.scrollTop = top\n el.scrollLeft = left\n })\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child) {\n return parent === child || (parent.contains && parent.contains(child))\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n let timeoutId\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n\n function wrapper(...args) {\n cancel()\n timeoutId = setTimeout(() => {\n timeoutId = null\n fn(...args)\n }, time)\n }\n\n wrapper.cancel = cancel\n\n return wrapper\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers(...fns) {\n return (event, ...args) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args)\n }\n return (\n event.preventDownshiftDefault ||\n (event.hasOwnProperty('nativeEvent') &&\n event.nativeEvent.preventDownshiftDefault)\n )\n })\n}\n\n/**\n * This return a function that will call all the given functions with\n * the arguments with which it's called. It does a null-check before\n * attempting to call the functions and can take any number of functions.\n * @param {...Function} fns the functions to call\n * @return {Function} the function that calls all the functions\n */\nfunction callAll(...fns) {\n return (...args) => {\n fns.forEach(fn => {\n if (fn) {\n fn(...args)\n }\n })\n }\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n return String(idCounter++)\n}\n\n/**\n * This is only used in tests\n * @param {Number} num the number to set the idCounter to\n */\nfunction setIdCounter(num) {\n idCounter = num\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n idCounter = 0\n}\n\n/**\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage({\n isOpen,\n highlightedItem,\n selectedItem,\n resultCount,\n previousResultCount,\n itemToString,\n}) {\n if (!isOpen) {\n if (selectedItem) {\n return itemToString(selectedItem)\n } else {\n return ''\n }\n }\n const resultCountChanged = resultCount !== previousResultCount\n if (!resultCount) {\n return 'No results.'\n } else if (!highlightedItem || resultCountChanged) {\n return `${resultCount} ${\n resultCount === 1 ? 'result is' : 'results are'\n } available, use up and down arrow keys to navigate.`\n }\n return itemToString(highlightedItem)\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg\n if (!arg && defaultValue) {\n return defaultValue\n } else {\n return arg\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n /* istanbul ignore if */\n if (isPreact) {\n // then this is preact\n return typeof element.nodeName === 'string'\n }\n\n // then we assume this is react\n return typeof element.type === 'string'\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n // props for react, attributes for preact\n\n /* istanbul ignore if */\n if (isPreact) {\n return element.attributes\n }\n\n return element.props\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(`The property \"${propName}\" is required in \"${fnName}\"`)\n}\n\nconst stateKeys = [\n 'highlightedIndex',\n 'inputValue',\n 'isOpen',\n 'selectedItem',\n 'type',\n]\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state = {}) {\n const result = {}\n stateKeys.forEach(k => {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k]\n }\n })\n return result\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n const {key, keyCode} = event\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return `Arrow${key}`\n }\n return key\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]'\n}\n\nexport {\n cbToCb,\n callAllEventHandlers,\n callAll,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n getElementProps,\n isOrContainsNode,\n noop,\n requiredProp,\n setIdCounter,\n resetIdCounter,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n}\n","/* eslint camelcase:0 */\n\nimport React, {Component} from 'react'\nimport PropTypes from 'prop-types'\nimport {isForwardRef} from 'react-is'\nimport {isPreact, isReactNative} from './is.macro'\nimport setA11yStatus from './set-a11y-status'\nimport * as stateChangeTypes from './stateChangeTypes'\nimport {\n cbToCb,\n callAll,\n callAllEventHandlers,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n isOrContainsNode,\n getElementProps,\n noop,\n requiredProp,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n} from './utils'\n\nclass Downshift extends Component {\n static propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n /* eslint-enable react/no-unused-prop-types */\n }\n\n static defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage,\n itemToString: i => {\n if (i == null) {\n return ''\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n isPlainObject(i) &&\n !i.hasOwnProperty('toString')\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.',\n 'The object that was passed:',\n i,\n )\n }\n return String(i)\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: (prevItem, item) => prevItem !== item,\n environment:\n typeof window === 'undefined' /* istanbul ignore next (ssr) */\n ? {}\n : window,\n stateReducer: (state, stateToSet) => stateToSet,\n suppressRefError: false,\n scrollIntoView,\n }\n\n static stateChangeTypes = stateChangeTypes\n\n constructor(props) {\n super(props)\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n const {\n defaultHighlightedIndex,\n initialHighlightedIndex: highlightedIndex = defaultHighlightedIndex,\n defaultIsOpen,\n initialIsOpen: isOpen = defaultIsOpen,\n initialInputValue: inputValue = '',\n initialSelectedItem: selectedItem = null,\n } = this.props\n const state = this.getState({\n highlightedIndex,\n isOpen,\n inputValue,\n selectedItem,\n })\n if (\n state.selectedItem != null &&\n this.props.initialInputValue === undefined\n ) {\n state.inputValue = this.props.itemToString(state.selectedItem)\n }\n this.state = state\n }\n\n id = this.props.id || `downshift-${generateId()}`\n menuId = this.props.menuId || `${this.id}-menu`\n labelId = this.props.labelId || `${this.id}-label`\n inputId = this.props.inputId || `${this.id}-input`\n getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`)\n\n input = null\n items = []\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n itemCount = null\n previousResultCount = 0\n\n timeoutIds = []\n\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n internalSetTimeout = (fn, time) => {\n const id = setTimeout(() => {\n this.timeoutIds = this.timeoutIds.filter(i => i !== id)\n fn()\n }, time)\n\n this.timeoutIds.push(id)\n }\n\n /**\n * Clear all running timeouts\n */\n internalClearTimeouts() {\n this.timeoutIds.forEach(id => {\n clearTimeout(id)\n })\n\n this.timeoutIds = []\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */\n getState(stateToMerge = this.state) {\n return Object.keys(stateToMerge).reduce((state, key) => {\n state[key] = this.isControlledProp(key)\n ? this.props[key]\n : stateToMerge[key]\n return state\n }, {})\n }\n\n /**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\n isControlledProp(key) {\n return this.props[key] !== undefined\n }\n\n getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n let itemCount = this.items.length\n if (this.itemCount != null) {\n itemCount = this.itemCount\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount\n }\n return itemCount\n }\n\n setItemCount = count => {\n this.itemCount = count\n }\n\n unsetItemCount = () => {\n this.itemCount = null\n }\n\n getItemNodeFromIndex(index) {\n return this.props.environment.document.getElementById(this.getItemId(index))\n }\n\n setHighlightedIndex = (\n highlightedIndex = this.props.defaultHighlightedIndex,\n otherStateToSet = {},\n ) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState({highlightedIndex, ...otherStateToSet})\n }\n\n scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n const node = this.getItemNodeFromIndex(this.getState().highlightedIndex)\n this.props.scrollIntoView(node, this._rootNode)\n }\n }\n\n moveHighlightedIndex(amount, otherStateToSet) {\n if (this.getState().isOpen) {\n this.changeHighlightedIndex(amount, otherStateToSet)\n } else {\n this.openMenu(() => {\n const {type} = otherStateToSet\n const itemCount = this.getItemCount()\n let newHighlightedIndex\n // if there are items in the menu and event type is present.\n if (itemCount && type) {\n // on Arrow Down we highlight first option.\n if (type === stateChangeTypes.keyDownArrowDown) {\n newHighlightedIndex = 0\n }\n // on Arrow Up we highlight last option\n if (type === stateChangeTypes.keyDownArrowUp) {\n newHighlightedIndex = itemCount - 1\n }\n }\n this.setHighlightedIndex(newHighlightedIndex, {...otherStateToSet})\n })\n }\n }\n\n changeHighlightedIndex(moveAmount, otherStateToSet) {\n const itemsLastIndex = this.getItemCount() - 1\n if (itemsLastIndex < 0) {\n return\n }\n const {highlightedIndex} = this.getState()\n let baseIndex = highlightedIndex\n if (baseIndex === null) {\n baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1\n }\n let newIndex = baseIndex + moveAmount\n if (newIndex < 0) {\n newIndex = itemsLastIndex\n } else if (newIndex > itemsLastIndex) {\n newIndex = 0\n }\n this.setHighlightedIndex(newIndex, otherStateToSet)\n }\n\n clearSelection = cb => {\n this.internalSetState(\n {\n selectedItem: null,\n inputValue: '',\n highlightedIndex: this.props.defaultHighlightedIndex,\n isOpen: this.props.defaultIsOpen,\n },\n cb,\n )\n }\n\n selectItem = (item, otherStateToSet, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n {\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: this.props.itemToString(item),\n ...otherStateToSet,\n },\n cb,\n )\n }\n\n selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {\n const item = this.items[itemIndex]\n if (item == null) {\n return\n }\n this.selectItem(item, otherStateToSet, cb)\n }\n\n selectHighlightedItem = (otherStateToSet, cb) => {\n return this.selectItemAtIndex(\n this.getState().highlightedIndex,\n otherStateToSet,\n cb,\n )\n }\n\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n internalSetState = (stateToSet, cb) => {\n let isItemSelected, onChangeArg\n\n const onStateChangeArg = {}\n const isStateToSetFunction = typeof stateToSet === 'function'\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/paypal/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n this.props.onInputValueChange(stateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...stateToSet,\n })\n }\n return this.setState(\n state => {\n state = this.getState(state)\n let newStateToSet = isStateToSetFunction\n ? stateToSet(state)\n : stateToSet\n\n // Your own function that could modify the state that will be set.\n newStateToSet = this.props.stateReducer(state, newStateToSet)\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem')\n // this keeps track of the object we want to call with setState\n const nextState = {}\n // this is just used to tell whether the state changed\n const nextFullState = {}\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (\n isItemSelected &&\n newStateToSet.selectedItem !== state.selectedItem\n ) {\n onChangeArg = newStateToSet.selectedItem\n }\n newStateToSet.type = newStateToSet.type || stateChangeTypes.unknown\n\n Object.keys(newStateToSet).forEach(key => {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key]\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return\n }\n nextFullState[key] = newStateToSet[key]\n // if it's coming from props, then we don't care to set it internally\n if (!this.isControlledProp(key)) {\n nextState[key] = newStateToSet[key]\n }\n })\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (\n isStateToSetFunction &&\n newStateToSet.hasOwnProperty('inputValue')\n ) {\n this.props.onInputValueChange(newStateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...newStateToSet,\n })\n }\n\n return nextState\n },\n () => {\n // call the provided callback if it's a function\n cbToCb(cb)()\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1\n if (hasMoreStateThanType) {\n this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers())\n }\n\n if (isItemSelected) {\n this.props.onSelect(\n stateToSet.selectedItem,\n this.getStateAndHelpers(),\n )\n }\n\n if (onChangeArg !== undefined) {\n this.props.onChange(onChangeArg, this.getStateAndHelpers())\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers())\n },\n )\n }\n\n getStateAndHelpers() {\n const {highlightedIndex, inputValue, selectedItem, isOpen} = this.getState()\n const {itemToString} = this.props\n const {id} = this\n const {\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n reset,\n setItemCount,\n unsetItemCount,\n internalSetState: setState,\n } = this\n return {\n // prop getters\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n\n // actions\n reset,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n setItemCount,\n unsetItemCount,\n setState,\n\n // props\n itemToString,\n\n // derived\n id,\n\n // state\n highlightedIndex,\n inputValue,\n isOpen,\n selectedItem,\n }\n }\n\n //////////////////////////// ROOT\n\n rootRef = node => (this._rootNode = node)\n\n getRootProps = (\n {refKey = 'ref', ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n this.getRootProps.called = true\n this.getRootProps.refKey = refKey\n this.getRootProps.suppressRefError = suppressRefError\n const {isOpen} = this.getState()\n return {\n [refKey]: this.rootRef,\n role: 'combobox',\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'listbox',\n 'aria-owns': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n ...rest,\n }\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n\n keyDownHandlers = {\n ArrowDown(event) {\n event.preventDefault()\n const amount = event.shiftKey ? 5 : 1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n },\n\n ArrowUp(event) {\n event.preventDefault()\n const amount = event.shiftKey ? -5 : -1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n },\n\n Enter(event) {\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen && highlightedIndex != null) {\n event.preventDefault()\n const item = this.items[highlightedIndex]\n const itemNode = this.getItemNodeFromIndex(highlightedIndex)\n if (item == null || (itemNode && itemNode.hasAttribute('disabled'))) {\n return\n }\n this.selectHighlightedItem({\n type: stateChangeTypes.keyDownEnter,\n })\n }\n },\n\n Escape(event) {\n event.preventDefault()\n this.reset({type: stateChangeTypes.keyDownEscape})\n },\n }\n\n //////////////////////////// BUTTON\n\n buttonKeyDownHandlers = {\n ...this.keyDownHandlers,\n\n ' '(event) {\n event.preventDefault()\n this.toggleMenu({type: stateChangeTypes.keyDownSpaceButton})\n },\n }\n\n getToggleButtonProps = ({\n onClick,\n onPress,\n onKeyDown,\n onKeyUp,\n onBlur,\n ...rest\n } = {}) => {\n const {isOpen} = this.getState()\n const enabledEventHandlers = isReactNative\n ? /* istanbul ignore next (react-native) */\n {\n onPress: callAllEventHandlers(onPress, this.button_handleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, this.button_handleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, this.button_handleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, this.button_handleKeyUp),\n onBlur: callAllEventHandlers(onBlur, this.button_handleBlur),\n }\n const eventHandlers = rest.disabled ? {} : enabledEventHandlers\n return {\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true,\n ...eventHandlers,\n ...rest,\n }\n }\n\n button_handleKeyUp = event => {\n // Prevent click event from emitting in Firefox\n event.preventDefault()\n }\n\n button_handleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (this.buttonKeyDownHandlers[key]) {\n this.buttonKeyDownHandlers[key].call(this, event)\n }\n }\n\n button_handleClick = event => {\n event.preventDefault()\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (\n !isReactNative &&\n this.props.environment.document.activeElement ===\n this.props.environment.document.body\n ) {\n event.target.focus()\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n this.toggleMenu({type: stateChangeTypes.clickButton})\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n this.internalSetTimeout(() =>\n this.toggleMenu({type: stateChangeTypes.clickButton}),\n )\n }\n }\n\n button_handleBlur = event => {\n const blurTarget = event.target // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n this.internalSetTimeout(() => {\n if (\n !this.isMouseDown &&\n (this.props.environment.document.activeElement == null ||\n this.props.environment.document.activeElement.id !== this.inputId) &&\n this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n this.reset({type: stateChangeTypes.blurButton})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n\n /////////////////////////////// LABEL\n\n getLabelProps = props => {\n return {htmlFor: this.inputId, id: this.labelId, ...props}\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n\n /////////////////////////////// INPUT\n\n getInputProps = ({\n onKeyDown,\n onBlur,\n onChange,\n onInput,\n onChangeText,\n ...rest\n } = {}) => {\n let onChangeKey\n let eventHandlers = {}\n\n /* istanbul ignore next (preact) */\n if (isPreact) {\n onChangeKey = 'onInput'\n } else {\n onChangeKey = 'onChange'\n }\n const {inputValue, isOpen, highlightedIndex} = this.getState()\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n this.input_handleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, this.input_handleKeyDown),\n onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers = {\n onChange: callAllEventHandlers(\n onChange,\n onInput,\n this.input_handleChange,\n ),\n onChangeText: callAllEventHandlers(\n onChangeText,\n onInput,\n this.input_handleTextChange,\n ),\n onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),\n }\n }\n\n return {\n 'aria-autocomplete': 'list',\n 'aria-activedescendant':\n isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0\n ? this.getItemId(highlightedIndex)\n : null,\n 'aria-controls': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: this.inputId,\n ...eventHandlers,\n ...rest,\n }\n }\n\n input_handleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && this.keyDownHandlers[key]) {\n this.keyDownHandlers[key].call(this, event)\n }\n }\n\n input_handleChange = event => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n })\n }\n\n input_handleTextChange /* istanbul ignore next (react-native) */ = text => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: text,\n })\n }\n\n input_handleBlur = () => {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n this.internalSetTimeout(() => {\n const downshiftButtonIsActive =\n this.props.environment.document &&\n this.props.environment.document.activeElement.dataset.toggle &&\n (this._rootNode &&\n this._rootNode.contains(\n this.props.environment.document.activeElement,\n ))\n if (!this.isMouseDown && !downshiftButtonIsActive) {\n this.reset({type: stateChangeTypes.blurInput})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n\n /////////////////////////////// MENU\n\n menuRef = node => {\n this._menuNode = node\n }\n\n getMenuProps = (\n {refKey = 'ref', ref, ...props} = {},\n {suppressRefError = false} = {},\n ) => {\n this.getMenuProps.called = true\n this.getMenuProps.refKey = refKey\n this.getMenuProps.suppressRefError = suppressRefError\n\n return {\n [refKey]: callAll(ref, this.menuRef),\n role: 'listbox',\n 'aria-labelledby': props && props['aria-label'] ? null : this.labelId,\n id: this.menuId,\n ...props,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n\n /////////////////////////////// ITEM\n getItemProps = ({\n onMouseMove,\n onMouseDown,\n onClick,\n onPress,\n index,\n item = process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ undefined\n : requiredProp('getItemProps', 'item'),\n ...rest\n } = {}) => {\n if (index === undefined) {\n this.items.push(item)\n index = this.items.indexOf(item)\n } else {\n this.items[index] = item\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n if (index === this.getState().highlightedIndex) {\n return\n }\n this.setHighlightedIndex(index, {\n type: stateChangeTypes.itemMouseEnter,\n })\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n this.avoidScrolling = true\n this.internalSetTimeout(() => (this.avoidScrolling = false), 250)\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, event => {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault()\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n this.selectItemAtIndex(index, {\n type: stateChangeTypes.clickItem,\n })\n }),\n }\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n const eventHandlers = rest.disabled\n ? {onMouseDown: enabledEventHandlers.onMouseDown}\n : enabledEventHandlers\n\n return {\n id: this.getItemId(index),\n role: 'option',\n 'aria-selected': this.getState().selectedItem === item,\n ...eventHandlers,\n ...rest,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n\n clearItems = () => {\n this.items = []\n }\n\n reset = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({selectedItem}) => ({\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n inputValue: this.props.itemToString(selectedItem),\n ...otherStateToSet,\n }),\n cb,\n )\n }\n\n toggleMenu = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({isOpen}) => {\n return {isOpen: !isOpen, ...otherStateToSet}\n },\n () => {\n const {isOpen} = this.getState()\n if (isOpen) {\n // highlight default index\n this.setHighlightedIndex(undefined, otherStateToSet)\n }\n cbToCb(cb)()\n },\n )\n }\n\n openMenu = cb => {\n this.internalSetState({isOpen: true}, cb)\n }\n\n closeMenu = cb => {\n this.internalSetState({isOpen: false}, cb)\n }\n\n updateStatus = debounce(() => {\n const state = this.getState()\n const item = this.items[state.highlightedIndex]\n const resultCount = this.getItemCount()\n const status = this.props.getA11yStatusMessage({\n itemToString: this.props.itemToString,\n previousResultCount: this.previousResultCount,\n resultCount,\n highlightedItem: item,\n ...state,\n })\n this.previousResultCount = resultCount\n\n setA11yStatus(status)\n }, 200)\n\n componentDidMount() {\n /* istanbul ignore if (react-native) */\n if (\n process.env.NODE_ENV !== 'production' &&\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n this.cleanup = () => {\n this.internalClearTimeouts()\n }\n } else {\n const targetWithinDownshift = (target, checkActiveElement = true) => {\n const {document} = this.props.environment\n return [this._rootNode, this._menuNode].some(\n contextNode =>\n contextNode &&\n (isOrContainsNode(contextNode, target) ||\n (checkActiveElement &&\n isOrContainsNode(contextNode, document.activeElement))),\n )\n }\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n const onMouseDown = () => {\n this.isMouseDown = true\n }\n const onMouseUp = event => {\n this.isMouseDown = false\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n const contextWithinDownshift = targetWithinDownshift(event.target)\n if (!contextWithinDownshift && this.getState().isOpen) {\n this.reset({type: stateChangeTypes.mouseUp}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n const onTouchStart = event => {\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n false,\n )\n if (!contextWithinDownshift && this.getState().isOpen) {\n this.reset({type: stateChangeTypes.touchStart}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n\n this.props.environment.addEventListener('mousedown', onMouseDown)\n this.props.environment.addEventListener('mouseup', onMouseUp)\n this.props.environment.addEventListener('touchstart', onTouchStart)\n\n this.cleanup = () => {\n this.internalClearTimeouts()\n this.updateStatus.cancel()\n this.props.environment.removeEventListener('mousedown', onMouseDown)\n this.props.environment.removeEventListener('mouseup', onMouseUp)\n this.props.environment.removeEventListener('touchstart', onTouchStart)\n }\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(prevProps, this.props)\n /* istanbul ignore if (react-native) */\n if (\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n }\n\n if (\n this.isControlledProp('selectedItem') &&\n this.props.selectedItemChanged(\n prevProps.selectedItem,\n this.props.selectedItem,\n )\n ) {\n this.internalSetState({\n type: stateChangeTypes.controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem),\n })\n }\n\n const current =\n this.props.highlightedIndex === undefined ? this.state : this.props\n const prev =\n prevProps.highlightedIndex === undefined ? prevState : prevProps\n\n if (\n current.highlightedIndex !== prev.highlightedIndex &&\n !this.avoidScrolling\n ) {\n this.scrollHighlightedItemIntoView()\n }\n\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n this.updateStatus()\n }\n }\n\n componentWillUnmount() {\n this.cleanup() // avoids memory leak\n }\n\n render() {\n const children = unwrapArray(this.props.children, noop)\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems()\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false\n this.getRootProps.refKey = undefined\n this.getRootProps.suppressRefError = undefined\n // we do something similar for getMenuProps\n this.getMenuProps.called = false\n this.getMenuProps.refKey = undefined\n this.getMenuProps.suppressRefError = undefined\n // we do something similar for getLabelProps\n this.getLabelProps.called = false\n // and something similar for getInputProps\n this.getInputProps.called = false\n const element = unwrapArray(children(this.getStateAndHelpers()))\n if (!element) {\n return null\n }\n\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (\n process.env.NODE_ENV !== 'production' &&\n !this.getRootProps.suppressRefError &&\n !this.props.suppressRefError\n ) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps)\n }\n return element\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return React.cloneElement(\n element,\n this.getRootProps(getElementProps(element)),\n )\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error(\n 'downshift: If you return a non-DOM element, you must use apply the getRootProps function',\n )\n }\n\n /* istanbul ignore next */\n return undefined\n }\n}\n\nexport default Downshift\n\nfunction validateGetMenuPropsCalledCorrectly(node, {refKey}) {\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from getMenuProps was not applied correctly on your menu element.`,\n )\n }\n}\n\nfunction validateGetRootPropsCalledCorrectly(element, {refKey}) {\n const refKeySpecified = refKey !== 'ref'\n const isComposite = !isDOMElement(element)\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error(\n 'downshift: You returned a non-DOM element. You must specify a refKey in getRootProps',\n )\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"${refKey}\"`,\n )\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You must apply the ref prop \"${refKey}\" from getRootProps onto your root element.`,\n )\n }\n}\n\nfunction validateControlledUnchanged(prevProps, nextProps) {\n const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/paypal/downshift#control-props`\n ;['selectedItem', 'isOpen', 'inputValue', 'highlightedIndex'].forEach(\n propKey => {\n if (\n prevProps[propKey] !== undefined &&\n nextProps[propKey] === undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the controlled prop \"${propKey}\" to be uncontrolled. ${warningDescription}`,\n )\n } else if (\n prevProps[propKey] === undefined &&\n nextProps[propKey] !== undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the uncontrolled prop \"${propKey}\" to be controlled. ${warningDescription}`,\n )\n }\n },\n )\n}\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}"],"names":["_objectWithoutPropertiesLoose","source","excluded","key","i","target","sourceKeys","Object","keys","length","indexOf","_extends","assign","arguments","prototype","hasOwnProperty","call","apply","this","_assertThisInitialized","self","ReferenceError","defineProperty","exports","value","b","Symbol","for","c","d","e","f","g","h","k","l","m","n","q","a","p","$$typeof","type","then","module","require$$0","statusDiv","document","getElementById","statuses","setStatus","status","isSameAsLast","div","createElement","setAttribute","style","border","clip","height","margin","overflow","padding","position","width","body","appendChild","getStatusDiv","lastChild","removeChild","firstChild","filter","Boolean","forEach","statusItem","index","display","childDiv","textContent","getStatusChildDiv","unknown","itemMouseEnter","keyDownArrowUp","keyDownArrowDown","keyDownEscape","keyDownEnter","clickItem","blurInput","changeInput","keyDownSpaceButton","clickButton","blurButton","isElement","el","nodeType","canOverflow","skipOverflowHiddenElements","isScrollable","clientHeight","scrollHeight","clientWidth","scrollWidth","getComputedStyle","overflowY","overflowX","alignNearest","scrollingEdgeStart","scrollingEdgeEnd","scrollingSize","scrollingBorderStart","scrollingBorderEnd","elementEdgeStart","elementEdgeEnd","elementSize","options","scrollMode","block","inline","boundary","checkBoundary","node","TypeError","scrollingElement","documentElement","frames","cursor","parentNode","push","viewportWidth","window","visualViewport","innerWidth","viewportHeight","innerHeight","viewportX","scrollX","pageXOffset","viewportY","scrollY","pageYOffset","_target$getBoundingCl","getBoundingClientRect","targetHeight","targetWidth","targetTop","top","targetRight","right","targetBottom","bottom","targetLeft","left","targetBlock","targetInline","computations","frame","_frame$getBoundingCli","_height","_width","_top","_left","frameStyle","borderLeft","parseInt","borderLeftWidth","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","blockScroll","inlineScroll","scrollbarWidth","offsetWidth","scrollbarHeight","offsetHeight","Math","max","scrollLeft","scrollTop","min","idCounter","cbToCb","cb","noop","isOrContainsNode","parent","child","contains","callAllEventHandlers","fns","event","args","some","fn","preventDownshiftDefault","nativeEvent","unwrapArray","arg","defaultValue","Array","isArray","stateKeys","pickState","state","result","normalizeArrowKey","keyCode","Downshift","subClass","superClass","props","_Component","id","_this","String","menuId","labelId","inputId","getItemId","input","items","itemCount","previousResultCount","timeoutIds","internalSetTimeout","time","setTimeout","setItemCount","count","unsetItemCount","setHighlightedIndex","highlightedIndex","otherStateToSet","defaultHighlightedIndex","internalSetState","clearSelection","selectedItem","inputValue","isOpen","defaultIsOpen","selectItem","item","itemToString","selectItemAtIndex","itemIndex","selectHighlightedItem","getState","stateToSet","isItemSelected","onChangeArg","onStateChangeArg","isStateToSetFunction","onInputValueChange","getStateAndHelpers","setState","newStateToSet","stateReducer","nextState","nextFullState","stateChangeTypes","isControlledProp","onStateChange","onSelect","undefined","onChange","onUserAction","rootRef","_rootNode","getRootProps","refKey","rest","suppressRefError","called","role","keyDownHandlers","ArrowDown","preventDefault","amount","shiftKey","moveHighlightedIndex","ArrowUp","Enter","itemNode","getItemNodeFromIndex","hasAttribute","Escape","reset","buttonKeyDownHandlers","toggleMenu","getToggleButtonProps","onClick","onKeyDown","onPress","onKeyUp","onBlur","enabledEventHandlers","button_handleClick","button_handleKeyDown","button_handleKeyUp","button_handleBlur","disabled","environment","activeElement","focus","blurTarget","isMouseDown","getLabelProps","htmlFor","getInputProps","onInput","onChangeText","eventHandlers","input_handleChange","input_handleKeyDown","input_handleBlur","autoComplete","input_handleTextChange","text","downshiftButtonIsActive","dataset","toggle","menuRef","_menuNode","getMenuProps","ref","callAll","getItemProps","onMouseMove","onMouseDown","customClickHandler","avoidScrolling","clearItems","openMenu","closeMenu","updateStatus","timeoutId","cancel","clearTimeout","wrapper","debounce","resultCount","getItemCount","getA11yStatusMessage","highlightedItem","setA11yStatus","initialHighlightedIndex","initialIsOpen","initialInputValue","initialSelectedItem","create","constructor","__proto__","internalClearTimeouts","stateToMerge","reduce","_this2","scrollHighlightedItemIntoView","scrollIntoView","changeHighlightedIndex","newHighlightedIndex","_this3","moveAmount","itemsLastIndex","baseIndex","newIndex","componentDidMount","targetWithinDownshift","checkActiveElement","_this4","contextNode","onMouseUp","onOuterClick","onTouchStart","addEventListener","cleanup","removeEventListener","componentDidUpdate","prevProps","prevState","selectedItemChanged","current","prev","componentWillUnmount","render","children","element","nodeName","isDOMElement","React","cloneElement","attributes","getElementProps","Component","defaultProps","prevItem","rootNode","computeScrollIntoView"],"mappings":"kQAAe,SAASA,EAA8BC,EAAQC,GAC5D,GAAc,MAAVD,EAAgB,MAAO,GAC3B,IAEIE,EAAKC,EAFLC,EAAS,GACTC,EAAaC,OAAOC,KAAKP,GAG7B,IAAKG,EAAI,EAAGA,EAAIE,EAAWG,OAAQL,IACjCD,EAAMG,EAAWF,GACbF,EAASQ,QAAQP,IAAQ,IAC7BE,EAAOF,GAAOF,EAAOE,IAGvB,OAAOE,WCZeM,IAetB,OAdAA,EAAWJ,OAAOK,QAAU,SAAUP,GACpC,IAAK,IAAID,EAAI,EAAGA,EAAIS,UAAUJ,OAAQL,IAAK,CACzC,IAAIH,EAASY,UAAUT,GAEvB,IAAK,IAAID,KAAOF,EACVM,OAAOO,UAAUC,eAAeC,KAAKf,EAAQE,KAC/CE,EAAOF,GAAOF,EAAOE,IAK3B,OAAOE,IAGOY,MAAMC,KAAML,WCff,SAASM,EAAuBC,GAC7C,QAAa,IAATA,EACF,MAAM,IAAIC,eAAe,6DAG3B,OAAOD,yLCIIb,OAAOe,eAAeC,EAAQ,aAAa,CAACC,OAAM,IAC/D,IAAIC,EAAE,mBAAoBC,QAAQA,OAAOC,IAAIC,EAAEH,EAAEC,OAAOC,IAAI,iBAAiB,MAAME,EAAEJ,EAAEC,OAAOC,IAAI,gBAAgB,MAAMG,EAAEL,EAAEC,OAAOC,IAAI,kBAAkB,MAAMI,EAAEN,EAAEC,OAAOC,IAAI,qBAAqB,MAAMK,EAAEP,EAAEC,OAAOC,IAAI,kBAAkB,MAAMM,EAAER,EAAEC,OAAOC,IAAI,k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,IAAhBA,EAAoB,YAAc,qEAH7B,cARHxG,EACKM,EAAaN,GAEb,IC/ETM,aAAc,SAAAhP,UACH,MAALA,EACK,GAcFoN,OAAOpN,IAEhBmQ,cAAe9E,EACfqE,mBAAoBrE,EACpBkF,aAAclF,EACdiF,SAAUjF,EACV+E,SAAU/E,EACV4L,aAAc5L,EACdoM,oBAAqB,SAACe,EAAUzJ,UAASyJ,IAAazJ,GACtD4D,YACoB,oBAAX9K,OACH,GACAA,OACNiI,aAAc,SAACrD,EAAO4C,UAAeA,GACrCwB,kBAAkB,EAClBsF,eDpFJ,SAAwB/O,EAAMqR,GACf,OAATrR,GAIYsR,EAAsBtR,EAAM,CAC1CF,SAAUuR,EACVzR,MAAO,UACPD,WAAY,cAEN1C,QAAQ,gBAAEoB,IAAAA,GAAIoD,IAAAA,IAAKM,IAAAA,KACzB1D,EAAGuF,UAAYnC,EACfpD,EAAGsF,WAAa5B,MCTd0D,EAoFGoD,iBAAmBA,+BDyB5B,WACE/E,EAAY"}
|
|
1
|
+
{"version":3,"file":"downshift.umd.min.js","sources":["../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../src/set-a11y-status.js","../../src/stateChangeTypes.js","../../node_modules/compute-scroll-into-view/es/index.js","../../src/utils.js","../../src/downshift.js","../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"],"sourcesContent":["export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","/** @license React v16.6.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';Object.defineProperty(exports,\"__esModule\",{value:!0});\nvar b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,r=b?Symbol.for(\"react.memo\"):\n60115,t=b?Symbol.for(\"react.lazy\"):60116;function u(a){if(\"object\"===typeof a&&null!==a){var q=a.$$typeof;switch(q){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return q}}case d:return q}}}function v(a){return u(a)===m}exports.typeOf=u;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;\nexports.Profiler=g;exports.Portal=d;exports.StrictMode=f;exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||u(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return u(a)===k};exports.isContextProvider=function(a){return u(a)===h};\nexports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return u(a)===n};exports.isFragment=function(a){return u(a)===e};exports.isProfiler=function(a){return u(a)===g};exports.isPortal=function(a){return u(a)===d};exports.isStrictMode=function(a){return u(a)===f};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","// istanbul ignore next\nlet statusDiv =\n typeof document === 'undefined'\n ? null\n : document.getElementById('a11y-status-message')\n\nlet statuses = []\n\n/**\n * @param {String} status the status message\n */\nfunction setStatus(status) {\n const isSameAsLast = statuses[statuses.length - 1] === status\n if (isSameAsLast) {\n statuses = [...statuses, status]\n } else {\n statuses = [status]\n }\n const div = getStatusDiv()\n\n // Remove previous children\n while (div.lastChild) {\n div.removeChild(div.firstChild)\n }\n\n statuses.filter(Boolean).forEach((statusItem, index) => {\n div.appendChild(getStatusChildDiv(statusItem, index))\n })\n}\n\n/**\n * @param {String} status the status message\n * @param {Number} index the index\n * @return {HTMLElement} the child node\n */\nfunction getStatusChildDiv(status, index) {\n const display = index === statuses.length - 1 ? 'block' : 'none'\n\n const childDiv = document.createElement('div')\n childDiv.style.display = display\n childDiv.textContent = status\n\n return childDiv\n}\n\n/**\n * Get the status node or create it if it does not already exist\n * @return {HTMLElement} the status node\n */\nfunction getStatusDiv() {\n if (statusDiv) {\n return statusDiv\n }\n statusDiv = document.createElement('div')\n statusDiv.setAttribute('id', 'a11y-status-message')\n statusDiv.setAttribute('role', 'status')\n statusDiv.setAttribute('aria-live', 'assertive')\n statusDiv.setAttribute('aria-relevant', 'additions text')\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n })\n document.body.appendChild(statusDiv)\n return statusDiv\n}\n\nexport default setStatus\n","import productionEnum from './productionEnum.macro'\n\nexport const unknown = productionEnum('__autocomplete_unknown__')\nexport const mouseUp = productionEnum('__autocomplete_mouseup__')\nexport const itemMouseEnter = productionEnum('__autocomplete_item_mouseenter__')\nexport const keyDownArrowUp = productionEnum(\n '__autocomplete_keydown_arrow_up__',\n)\nexport const keyDownArrowDown = productionEnum(\n '__autocomplete_keydown_arrow_down__',\n)\nexport const keyDownEscape = productionEnum('__autocomplete_keydown_escape__')\nexport const keyDownEnter = productionEnum('__autocomplete_keydown_enter__')\nexport const clickItem = productionEnum('__autocomplete_click_item__')\nexport const blurInput = productionEnum('__autocomplete_blur_input__')\nexport const changeInput = productionEnum('__autocomplete_change_input__')\nexport const keyDownSpaceButton = productionEnum(\n '__autocomplete_keydown_space_button__',\n)\nexport const clickButton = productionEnum('__autocomplete_click_button__')\nexport const blurButton = productionEnum('__autocomplete_blur_button__')\nexport const controlledPropUpdatedSelectedItem = productionEnum(\n '__autocomplete_controlled_prop_updated_selected_item__',\n)\nexport const touchEnd = productionEnum('__autocomplete_touchend__')\n","function isElement(el) {\n return el != null && typeof el === 'object' && el.nodeType === 1;\n}\n\nfunction canOverflow(overflow, skipOverflowHiddenElements) {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false;\n }\n\n return overflow !== 'visible' && overflow !== 'clip';\n}\n\nfunction isScrollable(el, skipOverflowHiddenElements) {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n var style = getComputedStyle(el, null);\n return canOverflow(style.overflowY, skipOverflowHiddenElements) || canOverflow(style.overflowX, skipOverflowHiddenElements);\n }\n\n return false;\n}\n\nfunction alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {\n if (elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd || elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd) {\n return 0;\n }\n\n if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;\n }\n\n if (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize || elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;\n }\n\n return 0;\n}\n\nexport default (function (target, options) {\n var scrollMode = options.scrollMode,\n block = options.block,\n inline = options.inline,\n boundary = options.boundary,\n skipOverflowHiddenElements = options.skipOverflowHiddenElements;\n var checkBoundary = typeof boundary === 'function' ? boundary : function (node) {\n return node !== boundary;\n };\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target');\n }\n\n var scrollingElement = document.scrollingElement || document.documentElement;\n var frames = [];\n var cursor = target;\n\n while (isElement(cursor) && checkBoundary(cursor)) {\n cursor = cursor.parentNode;\n\n if (cursor === scrollingElement) {\n frames.push(cursor);\n break;\n }\n\n if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) {\n continue;\n }\n\n if (isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor);\n }\n }\n\n var viewportWidth = window.visualViewport ? visualViewport.width : innerWidth;\n var viewportHeight = window.visualViewport ? visualViewport.height : innerHeight;\n var viewportX = window.scrollX || pageXOffset;\n var viewportY = window.scrollY || pageYOffset;\n\n var _target$getBoundingCl = target.getBoundingClientRect(),\n targetHeight = _target$getBoundingCl.height,\n targetWidth = _target$getBoundingCl.width,\n targetTop = _target$getBoundingCl.top,\n targetRight = _target$getBoundingCl.right,\n targetBottom = _target$getBoundingCl.bottom,\n targetLeft = _target$getBoundingCl.left;\n\n var targetBlock = block === 'start' || block === 'nearest' ? targetTop : block === 'end' ? targetBottom : targetTop + targetHeight / 2;\n var targetInline = inline === 'center' ? targetLeft + targetWidth / 2 : inline === 'end' ? targetRight : targetLeft;\n var computations = [];\n\n for (var index = 0; index < frames.length; index++) {\n var frame = frames[index];\n\n var _frame$getBoundingCli = frame.getBoundingClientRect(),\n _height = _frame$getBoundingCli.height,\n _width = _frame$getBoundingCli.width,\n _top = _frame$getBoundingCli.top,\n right = _frame$getBoundingCli.right,\n bottom = _frame$getBoundingCli.bottom,\n _left = _frame$getBoundingCli.left;\n\n if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= _top && targetBottom <= bottom && targetLeft >= _left && targetRight <= right) {\n return computations;\n }\n\n var frameStyle = getComputedStyle(frame);\n var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);\n var borderTop = parseInt(frameStyle.borderTopWidth, 10);\n var borderRight = parseInt(frameStyle.borderRightWidth, 10);\n var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);\n var blockScroll = 0;\n var inlineScroll = 0;\n var scrollbarWidth = 'offsetWidth' in frame ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight : 0;\n var scrollbarHeight = 'offsetHeight' in frame ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom : 0;\n\n if (scrollingElement === frame) {\n if (block === 'start') {\n blockScroll = targetBlock;\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - viewportHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline;\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth;\n } else {\n inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);\n }\n\n blockScroll = Math.max(0, blockScroll + viewportY);\n inlineScroll = Math.max(0, inlineScroll + viewportX);\n } else {\n if (block === 'start') {\n blockScroll = targetBlock - _top - borderTop;\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;\n } else if (block === 'nearest') {\n blockScroll = alignNearest(_top, bottom, _height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);\n } else {\n blockScroll = targetBlock - (_top + _height / 2) + scrollbarHeight / 2;\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - _left - borderLeft;\n } else if (inline === 'center') {\n inlineScroll = targetInline - (_left + _width / 2) + scrollbarWidth / 2;\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth;\n } else {\n inlineScroll = alignNearest(_left, right, _width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);\n }\n\n var scrollLeft = frame.scrollLeft,\n scrollTop = frame.scrollTop;\n blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - _height + scrollbarHeight));\n inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - _width + scrollbarWidth));\n targetBlock += scrollTop - blockScroll;\n targetInline += scrollLeft - inlineScroll;\n }\n\n computations.push({\n el: frame,\n top: blockScroll,\n left: inlineScroll\n });\n }\n\n return computations;\n});","import computeScrollIntoView from 'compute-scroll-into-view'\nimport {isPreact} from './is.macro'\n\nlet idCounter = 0\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop\n}\n\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} rootNode the root element of the component\n */\nfunction scrollIntoView(node, rootNode) {\n if (node === null) {\n return\n }\n\n const actions = computeScrollIntoView(node, {\n boundary: rootNode,\n block: 'nearest',\n scrollMode: 'if-needed',\n })\n actions.forEach(({el, top, left}) => {\n el.scrollTop = top\n el.scrollLeft = left\n })\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child) {\n return parent === child || (parent.contains && parent.contains(child))\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n let timeoutId\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n\n function wrapper(...args) {\n cancel()\n timeoutId = setTimeout(() => {\n timeoutId = null\n fn(...args)\n }, time)\n }\n\n wrapper.cancel = cancel\n\n return wrapper\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers(...fns) {\n return (event, ...args) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args)\n }\n return (\n event.preventDownshiftDefault ||\n (event.hasOwnProperty('nativeEvent') &&\n event.nativeEvent.preventDownshiftDefault)\n )\n })\n}\n\n/**\n * This return a function that will call all the given functions with\n * the arguments with which it's called. It does a null-check before\n * attempting to call the functions and can take any number of functions.\n * @param {...Function} fns the functions to call\n * @return {Function} the function that calls all the functions\n */\nfunction callAll(...fns) {\n return (...args) => {\n fns.forEach(fn => {\n if (fn) {\n fn(...args)\n }\n })\n }\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n return String(idCounter++)\n}\n\n/**\n * This is only used in tests\n * @param {Number} num the number to set the idCounter to\n */\nfunction setIdCounter(num) {\n idCounter = num\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n idCounter = 0\n}\n\n/**\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage({\n isOpen,\n highlightedItem,\n selectedItem,\n resultCount,\n previousResultCount,\n itemToString,\n}) {\n if (!isOpen) {\n if (selectedItem) {\n return itemToString(selectedItem)\n } else {\n return ''\n }\n }\n const resultCountChanged = resultCount !== previousResultCount\n if (!resultCount) {\n return 'No results.'\n } else if (!highlightedItem || resultCountChanged) {\n return `${resultCount} ${\n resultCount === 1 ? 'result is' : 'results are'\n } available, use up and down arrow keys to navigate.`\n }\n return itemToString(highlightedItem)\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg\n if (!arg && defaultValue) {\n return defaultValue\n } else {\n return arg\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n /* istanbul ignore if */\n if (isPreact) {\n // then this is preact\n return typeof element.nodeName === 'string'\n }\n\n // then we assume this is react\n return typeof element.type === 'string'\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n // props for react, attributes for preact\n\n /* istanbul ignore if */\n if (isPreact) {\n return element.attributes\n }\n\n return element.props\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(`The property \"${propName}\" is required in \"${fnName}\"`)\n}\n\nconst stateKeys = [\n 'highlightedIndex',\n 'inputValue',\n 'isOpen',\n 'selectedItem',\n 'type',\n]\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state = {}) {\n const result = {}\n stateKeys.forEach(k => {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k]\n }\n })\n return result\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n const {key, keyCode} = event\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return `Arrow${key}`\n }\n return key\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]'\n}\n\nexport {\n cbToCb,\n callAllEventHandlers,\n callAll,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n getElementProps,\n isOrContainsNode,\n noop,\n requiredProp,\n setIdCounter,\n resetIdCounter,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n}\n","/* eslint camelcase:0 */\n\nimport React, {Component} from 'react'\nimport PropTypes from 'prop-types'\nimport {isForwardRef} from 'react-is'\nimport {isPreact, isReactNative} from './is.macro'\nimport setA11yStatus from './set-a11y-status'\nimport * as stateChangeTypes from './stateChangeTypes'\nimport {\n cbToCb,\n callAll,\n callAllEventHandlers,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n isOrContainsNode,\n getElementProps,\n noop,\n requiredProp,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n} from './utils'\n\nclass Downshift extends Component {\n static propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n /* eslint-enable react/no-unused-prop-types */\n }\n\n static defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage,\n itemToString: i => {\n if (i == null) {\n return ''\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n isPlainObject(i) &&\n !i.hasOwnProperty('toString')\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.',\n 'The object that was passed:',\n i,\n )\n }\n return String(i)\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: (prevItem, item) => prevItem !== item,\n environment:\n typeof window === 'undefined' /* istanbul ignore next (ssr) */\n ? {}\n : window,\n stateReducer: (state, stateToSet) => stateToSet,\n suppressRefError: false,\n scrollIntoView,\n }\n\n static stateChangeTypes = stateChangeTypes\n\n constructor(props) {\n super(props)\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n const {\n defaultHighlightedIndex,\n initialHighlightedIndex: highlightedIndex = defaultHighlightedIndex,\n defaultIsOpen,\n initialIsOpen: isOpen = defaultIsOpen,\n initialInputValue: inputValue = '',\n initialSelectedItem: selectedItem = null,\n } = this.props\n const state = this.getState({\n highlightedIndex,\n isOpen,\n inputValue,\n selectedItem,\n })\n if (\n state.selectedItem != null &&\n this.props.initialInputValue === undefined\n ) {\n state.inputValue = this.props.itemToString(state.selectedItem)\n }\n this.state = state\n }\n\n id = this.props.id || `downshift-${generateId()}`\n menuId = this.props.menuId || `${this.id}-menu`\n labelId = this.props.labelId || `${this.id}-label`\n inputId = this.props.inputId || `${this.id}-input`\n getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`)\n\n input = null\n items = []\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n itemCount = null\n previousResultCount = 0\n\n timeoutIds = []\n\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n internalSetTimeout = (fn, time) => {\n const id = setTimeout(() => {\n this.timeoutIds = this.timeoutIds.filter(i => i !== id)\n fn()\n }, time)\n\n this.timeoutIds.push(id)\n }\n\n /**\n * Clear all running timeouts\n */\n internalClearTimeouts() {\n this.timeoutIds.forEach(id => {\n clearTimeout(id)\n })\n\n this.timeoutIds = []\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */\n getState(stateToMerge = this.state) {\n return Object.keys(stateToMerge).reduce((state, key) => {\n state[key] = this.isControlledProp(key)\n ? this.props[key]\n : stateToMerge[key]\n return state\n }, {})\n }\n\n /**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\n isControlledProp(key) {\n return this.props[key] !== undefined\n }\n\n getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n let itemCount = this.items.length\n if (this.itemCount != null) {\n itemCount = this.itemCount\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount\n }\n return itemCount\n }\n\n setItemCount = count => {\n this.itemCount = count\n }\n\n unsetItemCount = () => {\n this.itemCount = null\n }\n\n getItemNodeFromIndex(index) {\n return this.props.environment.document.getElementById(this.getItemId(index))\n }\n\n setHighlightedIndex = (\n highlightedIndex = this.props.defaultHighlightedIndex,\n otherStateToSet = {},\n ) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState({highlightedIndex, ...otherStateToSet})\n }\n\n scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n const node = this.getItemNodeFromIndex(this.getState().highlightedIndex)\n this.props.scrollIntoView(node, this._rootNode)\n }\n }\n\n moveHighlightedIndex(amount, otherStateToSet) {\n if (this.getState().isOpen) {\n this.changeHighlightedIndex(amount, otherStateToSet)\n } else {\n this.openMenu(() => {\n const {type} = otherStateToSet\n const itemCount = this.getItemCount()\n let newHighlightedIndex\n // if there are items in the menu and event type is present.\n if (itemCount && type) {\n // on Arrow Down we highlight first option.\n if (type === stateChangeTypes.keyDownArrowDown) {\n newHighlightedIndex = 0\n }\n // on Arrow Up we highlight last option\n if (type === stateChangeTypes.keyDownArrowUp) {\n newHighlightedIndex = itemCount - 1\n }\n }\n this.setHighlightedIndex(newHighlightedIndex, {...otherStateToSet})\n })\n }\n }\n\n changeHighlightedIndex(moveAmount, otherStateToSet) {\n const itemsLastIndex = this.getItemCount() - 1\n if (itemsLastIndex < 0) {\n return\n }\n const {highlightedIndex} = this.getState()\n let baseIndex = highlightedIndex\n if (baseIndex === null) {\n baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1\n }\n let newIndex = baseIndex + moveAmount\n if (newIndex < 0) {\n newIndex = itemsLastIndex\n } else if (newIndex > itemsLastIndex) {\n newIndex = 0\n }\n this.setHighlightedIndex(newIndex, otherStateToSet)\n }\n\n clearSelection = cb => {\n this.internalSetState(\n {\n selectedItem: null,\n inputValue: '',\n highlightedIndex: this.props.defaultHighlightedIndex,\n isOpen: this.props.defaultIsOpen,\n },\n cb,\n )\n }\n\n selectItem = (item, otherStateToSet, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n {\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: this.props.itemToString(item),\n ...otherStateToSet,\n },\n cb,\n )\n }\n\n selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {\n const item = this.items[itemIndex]\n if (item == null) {\n return\n }\n this.selectItem(item, otherStateToSet, cb)\n }\n\n selectHighlightedItem = (otherStateToSet, cb) => {\n return this.selectItemAtIndex(\n this.getState().highlightedIndex,\n otherStateToSet,\n cb,\n )\n }\n\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n internalSetState = (stateToSet, cb) => {\n let isItemSelected, onChangeArg\n\n const onStateChangeArg = {}\n const isStateToSetFunction = typeof stateToSet === 'function'\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/paypal/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n this.props.onInputValueChange(stateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...stateToSet,\n })\n }\n return this.setState(\n state => {\n state = this.getState(state)\n let newStateToSet = isStateToSetFunction\n ? stateToSet(state)\n : stateToSet\n\n // Your own function that could modify the state that will be set.\n newStateToSet = this.props.stateReducer(state, newStateToSet)\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem')\n // this keeps track of the object we want to call with setState\n const nextState = {}\n // this is just used to tell whether the state changed\n const nextFullState = {}\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (\n isItemSelected &&\n newStateToSet.selectedItem !== state.selectedItem\n ) {\n onChangeArg = newStateToSet.selectedItem\n }\n newStateToSet.type = newStateToSet.type || stateChangeTypes.unknown\n\n Object.keys(newStateToSet).forEach(key => {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key]\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return\n }\n nextFullState[key] = newStateToSet[key]\n // if it's coming from props, then we don't care to set it internally\n if (!this.isControlledProp(key)) {\n nextState[key] = newStateToSet[key]\n }\n })\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (\n isStateToSetFunction &&\n newStateToSet.hasOwnProperty('inputValue')\n ) {\n this.props.onInputValueChange(newStateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...newStateToSet,\n })\n }\n\n return nextState\n },\n () => {\n // call the provided callback if it's a function\n cbToCb(cb)()\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1\n if (hasMoreStateThanType) {\n this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers())\n }\n\n if (isItemSelected) {\n this.props.onSelect(\n stateToSet.selectedItem,\n this.getStateAndHelpers(),\n )\n }\n\n if (onChangeArg !== undefined) {\n this.props.onChange(onChangeArg, this.getStateAndHelpers())\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers())\n },\n )\n }\n\n getStateAndHelpers() {\n const {highlightedIndex, inputValue, selectedItem, isOpen} = this.getState()\n const {itemToString} = this.props\n const {id} = this\n const {\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n reset,\n setItemCount,\n unsetItemCount,\n internalSetState: setState,\n } = this\n return {\n // prop getters\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n\n // actions\n reset,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n setItemCount,\n unsetItemCount,\n setState,\n\n // props\n itemToString,\n\n // derived\n id,\n\n // state\n highlightedIndex,\n inputValue,\n isOpen,\n selectedItem,\n }\n }\n\n //////////////////////////// ROOT\n\n rootRef = node => (this._rootNode = node)\n\n getRootProps = (\n {refKey = 'ref', ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n this.getRootProps.called = true\n this.getRootProps.refKey = refKey\n this.getRootProps.suppressRefError = suppressRefError\n const {isOpen} = this.getState()\n return {\n [refKey]: this.rootRef,\n role: 'combobox',\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'listbox',\n 'aria-owns': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n ...rest,\n }\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n\n keyDownHandlers = {\n ArrowDown(event) {\n event.preventDefault()\n const amount = event.shiftKey ? 5 : 1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n },\n\n ArrowUp(event) {\n event.preventDefault()\n const amount = event.shiftKey ? -5 : -1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n },\n\n Enter(event) {\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen && highlightedIndex != null) {\n event.preventDefault()\n const item = this.items[highlightedIndex]\n const itemNode = this.getItemNodeFromIndex(highlightedIndex)\n if (item == null || (itemNode && itemNode.hasAttribute('disabled'))) {\n return\n }\n this.selectHighlightedItem({\n type: stateChangeTypes.keyDownEnter,\n })\n }\n },\n\n Escape(event) {\n event.preventDefault()\n this.reset({type: stateChangeTypes.keyDownEscape})\n },\n }\n\n //////////////////////////// BUTTON\n\n buttonKeyDownHandlers = {\n ...this.keyDownHandlers,\n\n ' '(event) {\n event.preventDefault()\n this.toggleMenu({type: stateChangeTypes.keyDownSpaceButton})\n },\n }\n\n getToggleButtonProps = ({\n onClick,\n onPress,\n onKeyDown,\n onKeyUp,\n onBlur,\n ...rest\n } = {}) => {\n const {isOpen} = this.getState()\n const enabledEventHandlers = isReactNative\n ? /* istanbul ignore next (react-native) */\n {\n onPress: callAllEventHandlers(onPress, this.button_handleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, this.button_handleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, this.button_handleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, this.button_handleKeyUp),\n onBlur: callAllEventHandlers(onBlur, this.button_handleBlur),\n }\n const eventHandlers = rest.disabled ? {} : enabledEventHandlers\n return {\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true,\n ...eventHandlers,\n ...rest,\n }\n }\n\n button_handleKeyUp = event => {\n // Prevent click event from emitting in Firefox\n event.preventDefault()\n }\n\n button_handleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (this.buttonKeyDownHandlers[key]) {\n this.buttonKeyDownHandlers[key].call(this, event)\n }\n }\n\n button_handleClick = event => {\n event.preventDefault()\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (\n !isReactNative &&\n this.props.environment.document.activeElement ===\n this.props.environment.document.body\n ) {\n event.target.focus()\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n this.toggleMenu({type: stateChangeTypes.clickButton})\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n this.internalSetTimeout(() =>\n this.toggleMenu({type: stateChangeTypes.clickButton}),\n )\n }\n }\n\n button_handleBlur = event => {\n const blurTarget = event.target // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n this.internalSetTimeout(() => {\n if (\n !this.isMouseDown &&\n (this.props.environment.document.activeElement == null ||\n this.props.environment.document.activeElement.id !== this.inputId) &&\n this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n this.reset({type: stateChangeTypes.blurButton})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n\n /////////////////////////////// LABEL\n\n getLabelProps = props => {\n return {htmlFor: this.inputId, id: this.labelId, ...props}\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n\n /////////////////////////////// INPUT\n\n getInputProps = ({\n onKeyDown,\n onBlur,\n onChange,\n onInput,\n onChangeText,\n ...rest\n } = {}) => {\n let onChangeKey\n let eventHandlers = {}\n\n /* istanbul ignore next (preact) */\n if (isPreact) {\n onChangeKey = 'onInput'\n } else {\n onChangeKey = 'onChange'\n }\n const {inputValue, isOpen, highlightedIndex} = this.getState()\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n this.input_handleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, this.input_handleKeyDown),\n onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers = {\n onChange: callAllEventHandlers(\n onChange,\n onInput,\n this.input_handleChange,\n ),\n onChangeText: callAllEventHandlers(\n onChangeText,\n onInput,\n this.input_handleTextChange,\n ),\n onBlur: callAllEventHandlers(onBlur, this.input_handleBlur),\n }\n }\n\n return {\n 'aria-autocomplete': 'list',\n 'aria-activedescendant':\n isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0\n ? this.getItemId(highlightedIndex)\n : null,\n 'aria-controls': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: this.inputId,\n ...eventHandlers,\n ...rest,\n }\n }\n\n input_handleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && this.keyDownHandlers[key]) {\n this.keyDownHandlers[key].call(this, event)\n }\n }\n\n input_handleChange = event => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n })\n }\n\n input_handleTextChange /* istanbul ignore next (react-native) */ = text => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: text,\n })\n }\n\n input_handleBlur = () => {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n this.internalSetTimeout(() => {\n const downshiftButtonIsActive =\n this.props.environment.document &&\n this.props.environment.document.activeElement.dataset.toggle &&\n (this._rootNode &&\n this._rootNode.contains(\n this.props.environment.document.activeElement,\n ))\n if (!this.isMouseDown && !downshiftButtonIsActive) {\n this.reset({type: stateChangeTypes.blurInput})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n\n /////////////////////////////// MENU\n\n menuRef = node => {\n this._menuNode = node\n }\n\n getMenuProps = (\n {refKey = 'ref', ref, ...props} = {},\n {suppressRefError = false} = {},\n ) => {\n this.getMenuProps.called = true\n this.getMenuProps.refKey = refKey\n this.getMenuProps.suppressRefError = suppressRefError\n\n return {\n [refKey]: callAll(ref, this.menuRef),\n role: 'listbox',\n 'aria-labelledby': props && props['aria-label'] ? null : this.labelId,\n id: this.menuId,\n ...props,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n\n /////////////////////////////// ITEM\n getItemProps = ({\n onMouseMove,\n onMouseDown,\n onClick,\n onPress,\n index,\n item = process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ undefined\n : requiredProp('getItemProps', 'item'),\n ...rest\n } = {}) => {\n if (index === undefined) {\n this.items.push(item)\n index = this.items.indexOf(item)\n } else {\n this.items[index] = item\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n if (index === this.getState().highlightedIndex) {\n return\n }\n this.setHighlightedIndex(index, {\n type: stateChangeTypes.itemMouseEnter,\n })\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n this.avoidScrolling = true\n this.internalSetTimeout(() => (this.avoidScrolling = false), 250)\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, event => {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault()\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n this.selectItemAtIndex(index, {\n type: stateChangeTypes.clickItem,\n })\n }),\n }\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n const eventHandlers = rest.disabled\n ? {onMouseDown: enabledEventHandlers.onMouseDown}\n : enabledEventHandlers\n\n return {\n id: this.getItemId(index),\n role: 'option',\n 'aria-selected': this.getState().selectedItem === item,\n ...eventHandlers,\n ...rest,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n\n clearItems = () => {\n this.items = []\n }\n\n reset = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({selectedItem}) => ({\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n inputValue: this.props.itemToString(selectedItem),\n ...otherStateToSet,\n }),\n cb,\n )\n }\n\n toggleMenu = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({isOpen}) => {\n return {isOpen: !isOpen, ...otherStateToSet}\n },\n () => {\n const {isOpen} = this.getState()\n if (isOpen) {\n // highlight default index\n this.setHighlightedIndex(undefined, otherStateToSet)\n }\n cbToCb(cb)()\n },\n )\n }\n\n openMenu = cb => {\n this.internalSetState({isOpen: true}, cb)\n }\n\n closeMenu = cb => {\n this.internalSetState({isOpen: false}, cb)\n }\n\n updateStatus = debounce(() => {\n const state = this.getState()\n const item = this.items[state.highlightedIndex]\n const resultCount = this.getItemCount()\n const status = this.props.getA11yStatusMessage({\n itemToString: this.props.itemToString,\n previousResultCount: this.previousResultCount,\n resultCount,\n highlightedItem: item,\n ...state,\n })\n this.previousResultCount = resultCount\n\n setA11yStatus(status)\n }, 200)\n\n componentDidMount() {\n /* istanbul ignore if (react-native) */\n if (\n process.env.NODE_ENV !== 'production' &&\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n this.cleanup = () => {\n this.internalClearTimeouts()\n }\n } else {\n const targetWithinDownshift = (target, checkActiveElement = true) => {\n const {document} = this.props.environment\n return [this._rootNode, this._menuNode].some(\n contextNode =>\n contextNode &&\n (isOrContainsNode(contextNode, target) ||\n (checkActiveElement &&\n isOrContainsNode(contextNode, document.activeElement))),\n )\n }\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n const onMouseDown = () => {\n this.isMouseDown = true\n }\n const onMouseUp = event => {\n this.isMouseDown = false\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n const contextWithinDownshift = targetWithinDownshift(event.target)\n if (!contextWithinDownshift && this.getState().isOpen) {\n this.reset({type: stateChangeTypes.mouseUp}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n const onTouchStart = () => {\n this.isTouchMove = false\n }\n\n const onTouchMove = () => {\n this.isTouchMove = true\n }\n\n const onTouchEnd = event => {\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n false,\n )\n if (\n !this.isTouchMove &&\n !contextWithinDownshift &&\n this.getState().isOpen\n ) {\n this.reset({type: stateChangeTypes.touchEnd}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n\n this.props.environment.addEventListener('mousedown', onMouseDown)\n this.props.environment.addEventListener('mouseup', onMouseUp)\n this.props.environment.addEventListener('touchstart', onTouchStart)\n this.props.environment.addEventListener('touchmove', onTouchMove)\n this.props.environment.addEventListener('touchend', onTouchEnd)\n\n this.cleanup = () => {\n this.internalClearTimeouts()\n this.updateStatus.cancel()\n this.props.environment.removeEventListener('mousedown', onMouseDown)\n this.props.environment.removeEventListener('mouseup', onMouseUp)\n this.props.environment.removeEventListener('touchstart', onTouchStart)\n this.props.environment.removeEventListener('touchmove', onTouchMove)\n this.props.environment.removeEventListener('touchend', onTouchEnd)\n }\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(prevProps, this.props)\n /* istanbul ignore if (react-native) */\n if (\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n }\n\n if (\n this.isControlledProp('selectedItem') &&\n this.props.selectedItemChanged(\n prevProps.selectedItem,\n this.props.selectedItem,\n )\n ) {\n this.internalSetState({\n type: stateChangeTypes.controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem),\n })\n }\n\n const current =\n this.props.highlightedIndex === undefined ? this.state : this.props\n const prev =\n prevProps.highlightedIndex === undefined ? prevState : prevProps\n\n if (\n current.highlightedIndex !== prev.highlightedIndex &&\n !this.avoidScrolling\n ) {\n this.scrollHighlightedItemIntoView()\n }\n\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n this.updateStatus()\n }\n }\n\n componentWillUnmount() {\n this.cleanup() // avoids memory leak\n }\n\n render() {\n const children = unwrapArray(this.props.children, noop)\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems()\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false\n this.getRootProps.refKey = undefined\n this.getRootProps.suppressRefError = undefined\n // we do something similar for getMenuProps\n this.getMenuProps.called = false\n this.getMenuProps.refKey = undefined\n this.getMenuProps.suppressRefError = undefined\n // we do something similar for getLabelProps\n this.getLabelProps.called = false\n // and something similar for getInputProps\n this.getInputProps.called = false\n const element = unwrapArray(children(this.getStateAndHelpers()))\n if (!element) {\n return null\n }\n\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (\n process.env.NODE_ENV !== 'production' &&\n !this.getRootProps.suppressRefError &&\n !this.props.suppressRefError\n ) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps)\n }\n return element\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return React.cloneElement(\n element,\n this.getRootProps(getElementProps(element)),\n )\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error(\n 'downshift: If you return a non-DOM element, you must use apply the getRootProps function',\n )\n }\n\n /* istanbul ignore next */\n return undefined\n }\n}\n\nexport default Downshift\n\nfunction validateGetMenuPropsCalledCorrectly(node, {refKey}) {\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from getMenuProps was not applied correctly on your menu element.`,\n )\n }\n}\n\nfunction validateGetRootPropsCalledCorrectly(element, {refKey}) {\n const refKeySpecified = refKey !== 'ref'\n const isComposite = !isDOMElement(element)\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error(\n 'downshift: You returned a non-DOM element. You must specify a refKey in getRootProps',\n )\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"${refKey}\"`,\n )\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You must apply the ref prop \"${refKey}\" from getRootProps onto your root element.`,\n )\n }\n}\n\nfunction validateControlledUnchanged(prevProps, nextProps) {\n const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/paypal/downshift#control-props`\n ;['selectedItem', 'isOpen', 'inputValue', 'highlightedIndex'].forEach(\n propKey => {\n if (\n prevProps[propKey] !== undefined &&\n nextProps[propKey] === undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the controlled prop \"${propKey}\" to be uncontrolled. ${warningDescription}`,\n )\n } else if (\n prevProps[propKey] === undefined &&\n nextProps[propKey] !== undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the uncontrolled prop \"${propKey}\" to be controlled. ${warningDescription}`,\n )\n }\n },\n )\n}\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}"],"names":["_objectWithoutPropertiesLoose","source","excluded","key","i","target","sourceKeys","Object","keys","length","indexOf","_extends","assign","arguments","prototype","hasOwnProperty","call","apply","this","_assertThisInitialized","self","ReferenceError","defineProperty","exports","value","b","Symbol","for","c","d","e","f","g","h","k","l","m","n","p","r","t","u","a","q","$$typeof","type","v","module","require$$0","statusDiv","document","getElementById","statuses","setStatus","status","isSameAsLast","div","createElement","setAttribute","style","border","clip","height","margin","overflow","padding","position","width","body","appendChild","getStatusDiv","lastChild","removeChild","firstChild","filter","Boolean","forEach","statusItem","index","display","childDiv","textContent","getStatusChildDiv","unknown","itemMouseEnter","keyDownArrowUp","keyDownArrowDown","keyDownEscape","keyDownEnter","clickItem","blurInput","changeInput","keyDownSpaceButton","clickButton","blurButton","isElement","el","nodeType","canOverflow","skipOverflowHiddenElements","isScrollable","clientHeight","scrollHeight","clientWidth","scrollWidth","getComputedStyle","overflowY","overflowX","alignNearest","scrollingEdgeStart","scrollingEdgeEnd","scrollingSize","scrollingBorderStart","scrollingBorderEnd","elementEdgeStart","elementEdgeEnd","elementSize","options","scrollMode","block","inline","boundary","checkBoundary","node","TypeError","scrollingElement","documentElement","frames","cursor","parentNode","push","viewportWidth","window","visualViewport","innerWidth","viewportHeight","innerHeight","viewportX","scrollX","pageXOffset","viewportY","scrollY","pageYOffset","_target$getBoundingCl","getBoundingClientRect","targetHeight","targetWidth","targetTop","top","targetRight","right","targetBottom","bottom","targetLeft","left","targetBlock","targetInline","computations","frame","_frame$getBoundingCli","_height","_width","_top","_left","frameStyle","borderLeft","parseInt","borderLeftWidth","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","blockScroll","inlineScroll","scrollbarWidth","offsetWidth","scrollbarHeight","offsetHeight","Math","max","scrollLeft","scrollTop","min","idCounter","cbToCb","cb","noop","isOrContainsNode","parent","child","contains","callAllEventHandlers","fns","event","args","some","fn","preventDownshiftDefault","nativeEvent","unwrapArray","arg","defaultValue","Array","isArray","stateKeys","pickState","state","result","normalizeArrowKey","keyCode","Downshift","subClass","superClass","props","_Component","id","_this","String","menuId","labelId","inputId","getItemId","input","items","itemCount","previousResultCount","timeoutIds","internalSetTimeout","time","setTimeout","setItemCount","count","unsetItemCount","setHighlightedIndex","highlightedIndex","otherStateToSet","defaultHighlightedIndex","internalSetState","clearSelection","selectedItem","inputValue","isOpen","defaultIsOpen","selectItem","item","itemToString","selectItemAtIndex","itemIndex","selectHighlightedItem","getState","stateToSet","isItemSelected","onChangeArg","onStateChangeArg","isStateToSetFunction","onInputValueChange","getStateAndHelpers","setState","newStateToSet","stateReducer","nextState","nextFullState","stateChangeTypes","isControlledProp","onStateChange","onSelect","undefined","onChange","onUserAction","rootRef","_rootNode","getRootProps","refKey","rest","suppressRefError","called","role","keyDownHandlers","ArrowDown","preventDefault","amount","shiftKey","moveHighlightedIndex","ArrowUp","Enter","itemNode","getItemNodeFromIndex","hasAttribute","Escape","reset","buttonKeyDownHandlers","toggleMenu","getToggleButtonProps","onClick","onKeyDown","onPress","onKeyUp","onBlur","enabledEventHandlers","button_handleClick","button_handleKeyDown","button_handleKeyUp","button_handleBlur","disabled","environment","activeElement","focus","blurTarget","isMouseDown","getLabelProps","htmlFor","getInputProps","onInput","onChangeText","eventHandlers","input_handleChange","input_handleKeyDown","input_handleBlur","autoComplete","input_handleTextChange","text","downshiftButtonIsActive","dataset","toggle","menuRef","_menuNode","getMenuProps","ref","callAll","getItemProps","onMouseMove","onMouseDown","customClickHandler","avoidScrolling","clearItems","openMenu","closeMenu","updateStatus","timeoutId","cancel","clearTimeout","wrapper","debounce","resultCount","getItemCount","getA11yStatusMessage","highlightedItem","setA11yStatus","initialHighlightedIndex","initialIsOpen","initialInputValue","initialSelectedItem","create","constructor","__proto__","internalClearTimeouts","stateToMerge","reduce","_this2","scrollHighlightedItemIntoView","scrollIntoView","changeHighlightedIndex","newHighlightedIndex","_this3","moveAmount","itemsLastIndex","baseIndex","newIndex","componentDidMount","targetWithinDownshift","checkActiveElement","_this4","contextNode","onMouseUp","onOuterClick","onTouchStart","isTouchMove","onTouchMove","onTouchEnd","contextWithinDownshift","addEventListener","cleanup","removeEventListener","componentDidUpdate","prevProps","prevState","selectedItemChanged","current","prev","componentWillUnmount","render","children","element","nodeName","isDOMElement","React","cloneElement","attributes","getElementProps","Component","defaultProps","prevItem","rootNode","computeScrollIntoView"],"mappings":"kQAAe,SAASA,EAA8BC,EAAQC,GAC5D,GAAc,MAAVD,EAAgB,MAAO,GAC3B,IAEIE,EAAKC,EAFLC,EAAS,GACTC,EAAaC,OAAOC,KAAKP,GAG7B,IAAKG,EAAI,EA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