downshift
Advanced tools
Comparing version 1.21.0 to 1.21.1
@@ -784,2 +784,5 @@ 'use strict'; | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -935,9 +938,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -944,0 +949,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -779,2 +779,5 @@ import React, { Component } from 'react'; | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -930,9 +933,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -939,0 +944,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -785,2 +785,5 @@ (function (global, factory) { | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -936,9 +939,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -945,0 +950,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.Downshift=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e){var t=b[b.length-1]===e;b=t?[].concat(_(b),[e]):[e];for(var n=function(){if(w)return w;return(w=document.createElement("div")).setAttribute("id","a11y-status-message"),w.setAttribute("role","status"),w.setAttribute("aria-live","assertive"),w.setAttribute("aria-relevant","additions text"),Object.assign(w.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(w),w}();n.lastChild;)n.removeChild(n.firstChild);b.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===b.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}function o(e){return"function"==typeof e?e:r}function r(){}function i(e,t,n){return null!==t&&t!==n.parentNode?e(t)?t===document.body&&0===t.scrollTop?document.documentElement:t:i(e,t.parentNode,n):null}function u(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=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.defaultPrevented})}}function s(e){return e+"-"+S++}function l(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function a(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function p(e){return e.nodeName?"string"==typeof e.nodeName:"string"==typeof e.type}function d(e){return e.props||e.attributes}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return k.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var c="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var g=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},y=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},v=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},I=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},_=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},w="undefined"==typeof document?null:document.getElementById("a11y-status-message"),b=[],S=1,C=i.bind(null,function(e){return e.scrollHeight>e.clientHeight}),k=["highlightedIndex","inputValue","isOpen","selectedItem","type"],P=function(t){function n(){var e;g(this,n);for(var t=arguments.length,o=Array(t),r=0;r<t;r++)o[r]=arguments[r];var i=I(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(o)));O.call(i);var u=i.getState({highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen,inputValue:i.props.defaultInputValue,selectedItem:i.props.defaultSelectedItem});return u.selectedItem&&(u.inputValue=i.props.itemToString(u.selectedItem)),i.state=u,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,e.Component),f(n,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(n,o){return n[o]=e.isControlledProp(o)?e.props[o]:t[o],n},{})}},{key:"isControlledProp",value:function(e){return void 0!==this.props[e]}},{key:"getItemCount",value:function(){return void 0===this.props.itemCount?this.items.length:this.props.itemCount}},{key:"internalSetState",value:function(e,t){var r=this,i=void 0,u=void 0,s={},l="function"==typeof e;return!l&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,y({},this.getStateAndHelpers(),e)),this.setState(function(t){t=r.getState(t),e=l?e(t):e;var o={},a={};return(i=e.hasOwnProperty("selectedItem"))&&e.selectedItem!==t.selectedItem&&(u=e.selectedItem),e.type=e.type||n.stateChangeTypes.unknown,Object.keys(e).forEach(function(n){t[n]!==e[n]&&(s[n]=e[n]),"type"!==n&&(a[n]=e[n],r.isControlledProp(n)||(o[n]=e[n]))}),l&&e.hasOwnProperty("inputValue")&&r.props.onInputValueChange(e.inputValue,y({},r.getStateAndHelpers(),e)),o},function(){o(t)();Object.keys(s).length>1&&r.props.onStateChange(s,r.getStateAndHelpers()),i&&r.props.onSelect(e.selectedItem,r.getStateAndHelpers()),void 0!==u&&r.props.onChange(u,r.getStateAndHelpers()),r.props.onUserAction(s,r.getStateAndHelpers())})}},{key:"getStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,r=e.isOpen,i=this.props,u=i.id,s=i.itemToString,l=this.getRootProps,a=this.getButtonProps,p=this.getLabelProps,d=this.getInputProps,h=this.getItemProps,c=this.openMenu,g=this.closeMenu,f=this.toggleMenu,m=this.selectItem,y=this.selectItemAtIndex,v=this.selectHighlightedItem,I=this.setHighlightedIndex,_=this.clearSelection,w=this.clearItems;return{getRootProps:l,getButtonProps:a,getLabelProps:p,getInputProps:d,getItemProps:h,reset:this.reset,openMenu:c,closeMenu:g,toggleMenu:f,selectItem:m,selectItemAtIndex:y,selectHighlightedItem:v,setHighlightedIndex:I,clearSelection:_,clearItems:w,itemToString:s,id:u,highlightedIndex:t,inputValue:n,isOpen:r,selectedItem:o}}},{key:"getItemId",value:function(e){return this.props.id+"-item-"+e}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var t=function(){e.isMouseDown=!0},o=function(t){e.isMouseDown=!1,t.target!==e._rootNode&&e._rootNode.contains(t.target)||!e.getState().isOpen||e.reset({type:n.stateChangeTypes.mouseUp},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",t),this.props.environment.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,e.props.environment.removeEventListener("mousedown",t),e.props.environment.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(e){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:n.stateChangeTypes.controlledPropUpdatedSelectedItem,inputValue:this.props.itemToString(this.props.selectedItem)}),this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=a(this.props.render||this.props.children,r);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=a(e(this.getStateAndHelpers()));if(!t)return null;if(this.getRootProps.called)return this.getRootProps.suppressRefError||function(e,t){var n=t.refKey,o="ref"!==n,r=!p(e);if(r&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!r&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!d(e).hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}(t,this.getRootProps),t;if(p(t))return c.cloneElement(t,this.getRootProps(d(t)));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),n}();P.propTypes={children:t.func,render:t.func,defaultHighlightedIndex:t.number,defaultSelectedItem:t.any,defaultInputValue:t.string,defaultIsOpen:t.bool,getA11yStatusMessage:t.func,itemToString:t.func,onChange:t.func,onSelect:t.func,onStateChange:t.func,onInputValueChange:t.func,onUserAction:t.func,onClick:t.func,onOuterClick:t.func,selectedItemChanged:t.func,itemCount:t.number,id:t.string,environment:t.shape({addEventListener:t.func,removeEventListener:t.func,document:t.shape({getElementById:t.func})}),selectedItem:t.any,isOpen:t.bool,inputValue:t.string,highlightedIndex:t.number,breakingChanges:t.shape({resetInputOnSelection:t.bool})},P.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,r=e.resultCount,i=e.previousResultCount,u=e.itemToString;return t?r?n&&r===i?u(n):r+" "+(1===r?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?u(o):""},id:s("downshift"),itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){},onInputValueChange:function(){},onUserAction:function(){},onChange:function(){},onSelect:function(){},onOuterClick:function(){},selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,breakingChanges:{}},P.stateChangeTypes={unknown:"__autocomplete_unknown__",mouseUp:"__autocomplete_mouseup__",itemMouseEnter:"__autocomplete_item_mouseenter__",keyDownArrowUp:"__autocomplete_keydown_arrow_up__",keyDownArrowDown:"__autocomplete_keydown_arrow_down__",keyDownEscape:"__autocomplete_keydown_escape__",keyDownEnter:"__autocomplete_keydown_enter__",blurInput:"__autocomplete_blur_input__",changeInput:"__autocomplete_change_input__",keyDownSpaceButton:"__autocomplete_keydown_space_button__",clickButton:"__autocomplete_click_button__",controlledPropUpdatedSelectedItem:"__autocomplete_controlled_prop_updated_selected_item__"};var O=function(){var e=this;this.root_handleClick=u(this.props.onClick,this.root_handleClick),this.input=null,this.items=[],this.previousResultCount=0,this.getItemNodeFromIndex=function(t){return e.props.environment.document.getElementById(e.getItemId(t))},this.setHighlightedIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.props.defaultHighlightedIndex,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=h(n),e.internalSetState(y({highlightedIndex:t},n),function(){!function(e,t){var n=C(e,t);if(null!==n){var o=getComputedStyle(n),r=n.getBoundingClientRect(),i=parseInt(o.borderTopWidth,10),u=i+parseInt(o.borderBottomWidth,10),s=r.top+i,l=e.getBoundingClientRect();if(l.top<0)n.scrollTop+=l.top;else if(l.top>0&&r.top<0)r.bottom>0&&l.bottom+u>r.bottom&&(n.scrollTop+=l.bottom-r.bottom+u);else{var a=l.top+n.scrollTop-s;a<n.scrollTop?n.scrollTop=a:a+l.height+u>n.scrollTop+r.height&&(n.scrollTop=a+l.height-r.height+u)}}}(e.getItemNodeFromIndex(e.getState().highlightedIndex),e._rootNode)})},this.openAndHighlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,y({isOpen:!0},t))},this.highlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,t)},this.moveHighlightedIndex=function(t,n){e.getState().isOpen?e.changeHighlightedIndex(t,n):e.openAndHighlightDefaultIndex(n)},this.changeHighlightedIndex=function(t,n){var o=e.getItemCount()-1;if(!(o<0)){var r=e.getState().highlightedIndex;null===r&&(r=t>0?-1:o+1);var i=r+t;i<0?i=o:i>o&&(i=0),e.setHighlightedIndex(i,n)}},this.clearSelection=function(t){e.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var n=e._rootNode.querySelector("#"+e.inputId);n&&n.focus&&n.focus(),o(t)()})},this.selectItem=function(t,n,r){n=h(n),e.internalSetState(y({isOpen:!1,highlightedIndex:e.props.defaultHighlightedIndex,selectedItem:t,inputValue:e.isControlledProp("selectedItem")&&e.props.breakingChanges.resetInputOnSelection?e.props.defaultInputValue:e.props.itemToString(t)},n),o(r))},this.selectItemAtIndex=function(t,n,o){var r=e.items[t];null!=r&&e.selectItem(r,n,o)},this.selectHighlightedItem=function(t,n){return e.selectItemAtIndex(e.getState().highlightedIndex,t,n)},this.rootRef=function(t){return e._rootNode=t},this.getRootProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).suppressRefError,o=void 0!==n&&n,r=t.refKey,i=void 0===r?"ref":r,u=v(t,["refKey"]);return e.getRootProps.called=!0,e.getRootProps.refKey=i,e.getRootProps.suppressRefError=o,y(m({},i,e.rootRef),u)},this.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:P.stateChangeTypes.keyDownArrowDown})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:P.stateChangeTypes.keyDownArrowUp})},Enter:function(e){this.getState().isOpen&&(e.preventDefault(),this.selectHighlightedItem({type:P.stateChangeTypes.keyDownEnter}))},Escape:function(e){e.preventDefault(),this.reset({type:P.stateChangeTypes.keyDownEscape})}},this.buttonKeyDownHandlers=y({},this.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:P.stateChangeTypes.keyDownSpaceButton})}}),this.getButtonProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onClick,o=t.onKeyDown,r=v(t,["onClick","onKeyDown"]),i=e.getState().isOpen,s=r.disabled?{}:{onClick:u(n,e.button_handleClick),onKeyDown:u(o,e.button_handleKeyDown)};return y({role:"button","aria-label":i?"close menu":"open menu","aria-expanded":i,"aria-haspopup":!0},s,r)},this.button_handleKeyDown=function(t){e.buttonKeyDownHandlers[t.key]&&e.buttonKeyDownHandlers[t.key].call(e,t)},this.button_handleClick=function(t){t.preventDefault(),e.toggleMenu({type:P.stateChangeTypes.clickButton})},this.getLabelProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.getLabelProps.called=!0,e.getInputProps.called&&t.htmlFor&&t.htmlFor!==e.inputId)throw new Error('downshift: You provided the htmlFor of "'+t.htmlFor+'" for your label, but the id of your input is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return e.inputId=l(e.inputId,t.htmlFor,s("downshift-input")),y({},t,{htmlFor:e.inputId})},this.getInputProps=function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.onKeyDown,r=n.onBlur,i=n.onChange,a=n.onInput,p=v(n,["onKeyDown","onBlur","onChange","onInput"]);if(e.getInputProps.called=!0,e.getLabelProps.called&&p.id&&p.id!==e.inputId)throw new Error('downshift: You provided the id of "'+p.id+'" for your input, but the htmlFor of your label is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');e.inputId=l(e.inputId,p.id,s("downshift-input"));var d=Boolean(!1)?"onInput":"onChange",h=e.getState(),c=h.inputValue,g=h.isOpen,f=h.highlightedIndex,I=p.disabled?{}:(t={},m(t,d,u(i,a,e.input_handleChange)),m(t,"onKeyDown",u(o,e.input_handleKeyDown)),m(t,"onBlur",u(r,e.input_handleBlur)),t);return y({role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-activedescendant":"number"==typeof f&&f>=0?e.getItemId(f):null,autoComplete:"off",value:c},I,p,{id:e.inputId})},this.input_handleKeyDown=function(t){t.key&&e.keyDownHandlers[t.key]&&e.keyDownHandlers[t.key].call(e,t)},this.input_handleChange=function(t){e.internalSetState({type:P.stateChangeTypes.changeInput,isOpen:!0,inputValue:t.target.value})},this.input_handleBlur=function(){e.isMouseDown||e.reset({type:P.stateChangeTypes.blurInput})},this.getItemProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onMouseEnter,o=t.onClick,r=t.index,i=t.item,s=void 0===i?function(e,t){throw new Error('The property "'+t+'" is required in "'+e+'"')}("getItemProps","item"):i,l=v(t,["onMouseEnter","onClick","index","item"]);return void 0===r?(e.items.push(s),r=e.items.indexOf(s)):e.items[r]=s,y({id:e.getItemId(r),onMouseEnter:u(n,function(){e.setHighlightedIndex(r,{type:P.stateChangeTypes.itemMouseEnter})}),onClick:u(o,function(){e.selectItemAtIndex(r)})},l)},this.clearItems=function(){e.items=[]},this.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];t=h(t),e.internalSetState(function(n){var o=n.selectedItem;return y({isOpen:!1,highlightedIndex:null,inputValue:e.props.itemToString(o)},t)},o(n))},this.toggleMenu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];t=h(t),e.internalSetState(function(e){var n=e.isOpen;return y({isOpen:!n},t)},function(){e.getState().isOpen&&e.highlightDefaultIndex(),o(n)()})},this.openMenu=function(t){e.internalSetState({isOpen:!0},o(t))},this.closeMenu=function(t){e.internalSetState({isOpen:!1},o(t))},this.updateStatus=function(e,t){var n=void 0;return function(){for(var o=arguments.length,r=Array(o),i=0;i<o;i++)r[i]=arguments[i];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,r)},t)}}(function(){if(e._isMounted){var t=e.getState(),o=e.items[t.highlightedIndex]||{},r=e.getItemCount(),i=e.props.getA11yStatusMessage(y({itemToString:e.props.itemToString,previousResultCount:e.previousResultCount,resultCount:r,highlightedItem:o},t));e.previousResultCount=r,n(i)}},200)};return P.default=P,P}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):e.Downshift=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";function n(e){var t=b[b.length-1]===e;b=t?[].concat(w(b),[e]):[e];for(var n=function(){if(_)return _;return(_=document.createElement("div")).setAttribute("id","a11y-status-message"),_.setAttribute("role","status"),_.setAttribute("aria-live","assertive"),_.setAttribute("aria-relevant","additions text"),Object.assign(_.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(_),_}();n.lastChild;)n.removeChild(n.firstChild);b.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===b.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}function o(e){return"function"==typeof e?e:i}function i(){}function r(e,t,n){return null!==t&&t!==n.parentNode?e(t)?t===document.body&&0===t.scrollTop?document.documentElement:t:r(e,t.parentNode,n):null}function u(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function s(e){return e+"-"+S++}function l(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function a(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function p(e){return e.nodeName?"string"==typeof e.nodeName:"string"==typeof e.type}function d(e){return e.props||e.attributes}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return k.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var c="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var g=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),m=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},y=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},I=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},v=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},w=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_="undefined"==typeof document?null:document.getElementById("a11y-status-message"),b=[],S=1,C=r.bind(null,function(e){return e.scrollHeight>e.clientHeight}),k=["highlightedIndex","inputValue","isOpen","selectedItem","type"],P=function(t){function n(){var e;g(this,n);for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];var r=v(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(o)));x.call(r);var u=r.getState({highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen,inputValue:r.props.defaultInputValue,selectedItem:r.props.defaultSelectedItem});return u.selectedItem&&(u.inputValue=r.props.itemToString(u.selectedItem)),r.state=u,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,e.Component),f(n,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(n,o){return n[o]=e.isControlledProp(o)?e.props[o]:t[o],n},{})}},{key:"isControlledProp",value:function(e){return void 0!==this.props[e]}},{key:"getItemCount",value:function(){return void 0===this.props.itemCount?this.items.length:this.props.itemCount}},{key:"internalSetState",value:function(e,t){var i=this,r=void 0,u=void 0,s={},l="function"==typeof e;return!l&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,y({},this.getStateAndHelpers(),e)),this.setState(function(t){t=i.getState(t),e=l?e(t):e;var o={},a={};return(r=e.hasOwnProperty("selectedItem"))&&e.selectedItem!==t.selectedItem&&(u=e.selectedItem),e.type=e.type||n.stateChangeTypes.unknown,Object.keys(e).forEach(function(n){t[n]!==e[n]&&(s[n]=e[n]),"type"!==n&&(a[n]=e[n],i.isControlledProp(n)||(o[n]=e[n]))}),l&&e.hasOwnProperty("inputValue")&&i.props.onInputValueChange(e.inputValue,y({},i.getStateAndHelpers(),e)),o},function(){o(t)();Object.keys(s).length>1&&i.props.onStateChange(s,i.getStateAndHelpers()),r&&i.props.onSelect(e.selectedItem,i.getStateAndHelpers()),void 0!==u&&i.props.onChange(u,i.getStateAndHelpers()),i.props.onUserAction(s,i.getStateAndHelpers())})}},{key:"getStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen,r=this.props,u=r.id,s=r.itemToString,l=this.getRootProps,a=this.getButtonProps,p=this.getLabelProps,d=this.getInputProps,h=this.getItemProps,c=this.openMenu,g=this.closeMenu,f=this.toggleMenu,m=this.selectItem,y=this.selectItemAtIndex,I=this.selectHighlightedItem,v=this.setHighlightedIndex,w=this.clearSelection,_=this.clearItems;return{getRootProps:l,getButtonProps:a,getLabelProps:p,getInputProps:d,getItemProps:h,reset:this.reset,openMenu:c,closeMenu:g,toggleMenu:f,selectItem:m,selectItemAtIndex:y,selectHighlightedItem:I,setHighlightedIndex:v,clearSelection:w,clearItems:_,itemToString:s,id:u,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}}},{key:"getItemId",value:function(e){return this.props.id+"-item-"+e}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var t=function(){e.isMouseDown=!0},o=function(t){e.isMouseDown=!1,t.target!==e._rootNode&&e._rootNode.contains(t.target)||!e.getState().isOpen||e.reset({type:n.stateChangeTypes.mouseUp},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",t),this.props.environment.addEventListener("mouseup",o),this.cleanup=function(){e._isMounted=!1,e.props.environment.removeEventListener("mousedown",t),e.props.environment.removeEventListener("mouseup",o)}}},{key:"componentDidUpdate",value:function(e){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:n.stateChangeTypes.controlledPropUpdatedSelectedItem,inputValue:this.props.itemToString(this.props.selectedItem)}),this.isControlledProp("highlightedIndex")&&this.props.highlightedIndex!==e.highlightedIndex&&this.scrollHighlightedItemIntoView(),this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=a(this.props.render||this.props.children,i);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=a(e(this.getStateAndHelpers()));if(!t)return null;if(this.getRootProps.called)return this.getRootProps.suppressRefError||function(e,t){var n=t.refKey,o="ref"!==n,i=!p(e);if(i&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!i&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!d(e).hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}(t,this.getRootProps),t;if(p(t))return c.cloneElement(t,this.getRootProps(d(t)));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),n}();P.propTypes={children:t.func,render:t.func,defaultHighlightedIndex:t.number,defaultSelectedItem:t.any,defaultInputValue:t.string,defaultIsOpen:t.bool,getA11yStatusMessage:t.func,itemToString:t.func,onChange:t.func,onSelect:t.func,onStateChange:t.func,onInputValueChange:t.func,onUserAction:t.func,onClick:t.func,onOuterClick:t.func,selectedItemChanged:t.func,itemCount:t.number,id:t.string,environment:t.shape({addEventListener:t.func,removeEventListener:t.func,document:t.shape({getElementById:t.func})}),selectedItem:t.any,isOpen:t.bool,inputValue:t.string,highlightedIndex:t.number,breakingChanges:t.shape({resetInputOnSelection:t.bool})},P.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,i=e.resultCount,r=e.previousResultCount,u=e.itemToString;return t?i?n&&i===r?u(n):i+" "+(1===i?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?u(o):""},id:s("downshift"),itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){},onInputValueChange:function(){},onUserAction:function(){},onChange:function(){},onSelect:function(){},onOuterClick:function(){},selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,breakingChanges:{}},P.stateChangeTypes={unknown:"__autocomplete_unknown__",mouseUp:"__autocomplete_mouseup__",itemMouseEnter:"__autocomplete_item_mouseenter__",keyDownArrowUp:"__autocomplete_keydown_arrow_up__",keyDownArrowDown:"__autocomplete_keydown_arrow_down__",keyDownEscape:"__autocomplete_keydown_escape__",keyDownEnter:"__autocomplete_keydown_enter__",blurInput:"__autocomplete_blur_input__",changeInput:"__autocomplete_change_input__",keyDownSpaceButton:"__autocomplete_keydown_space_button__",clickButton:"__autocomplete_click_button__",controlledPropUpdatedSelectedItem:"__autocomplete_controlled_prop_updated_selected_item__"};var x=function(){var e=this;this.root_handleClick=u(this.props.onClick,this.root_handleClick),this.input=null,this.items=[],this.previousResultCount=0,this.getItemNodeFromIndex=function(t){return e.props.environment.document.getElementById(e.getItemId(t))},this.setHighlightedIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.props.defaultHighlightedIndex,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=h(n),e.internalSetState(y({highlightedIndex:t},n),e.scrollHighlightedItemIntoView)},this.scrollHighlightedItemIntoView=function(){!function(e,t){var n=C(e,t);if(null!==n){var o=getComputedStyle(n),i=n.getBoundingClientRect(),r=parseInt(o.borderTopWidth,10),u=r+parseInt(o.borderBottomWidth,10),s=i.top+r,l=e.getBoundingClientRect();if(l.top<0)n.scrollTop+=l.top;else if(l.top>0&&i.top<0)i.bottom>0&&l.bottom+u>i.bottom&&(n.scrollTop+=l.bottom-i.bottom+u);else{var a=l.top+n.scrollTop-s;a<n.scrollTop?n.scrollTop=a:a+l.height+u>n.scrollTop+i.height&&(n.scrollTop=a+l.height-i.height+u)}}}(e.getItemNodeFromIndex(e.getState().highlightedIndex),e._rootNode)},this.openAndHighlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,y({isOpen:!0},t))},this.highlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,t)},this.moveHighlightedIndex=function(t,n){e.getState().isOpen?e.changeHighlightedIndex(t,n):e.openAndHighlightDefaultIndex(n)},this.changeHighlightedIndex=function(t,n){var o=e.getItemCount()-1;if(!(o<0)){var i=e.getState().highlightedIndex;null===i&&(i=t>0?-1:o+1);var r=i+t;r<0?r=o:r>o&&(r=0),e.setHighlightedIndex(r,n)}},this.clearSelection=function(t){e.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var n=e._rootNode.querySelector("#"+e.inputId);n&&n.focus&&n.focus(),o(t)()})},this.selectItem=function(t,n,i){n=h(n),e.internalSetState(y({isOpen:!1,highlightedIndex:e.props.defaultHighlightedIndex,selectedItem:t,inputValue:e.isControlledProp("selectedItem")&&e.props.breakingChanges.resetInputOnSelection?e.props.defaultInputValue:e.props.itemToString(t)},n),o(i))},this.selectItemAtIndex=function(t,n,o){var i=e.items[t];null!=i&&e.selectItem(i,n,o)},this.selectHighlightedItem=function(t,n){return e.selectItemAtIndex(e.getState().highlightedIndex,t,n)},this.rootRef=function(t){return e._rootNode=t},this.getRootProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).suppressRefError,o=void 0!==n&&n,i=t.refKey,r=void 0===i?"ref":i,u=I(t,["refKey"]);return e.getRootProps.called=!0,e.getRootProps.refKey=r,e.getRootProps.suppressRefError=o,y(m({},r,e.rootRef),u)},this.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:P.stateChangeTypes.keyDownArrowDown})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:P.stateChangeTypes.keyDownArrowUp})},Enter:function(e){this.getState().isOpen&&(e.preventDefault(),this.selectHighlightedItem({type:P.stateChangeTypes.keyDownEnter}))},Escape:function(e){e.preventDefault(),this.reset({type:P.stateChangeTypes.keyDownEscape})}},this.buttonKeyDownHandlers=y({},this.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:P.stateChangeTypes.keyDownSpaceButton})}}),this.getButtonProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onClick,o=t.onKeyDown,i=I(t,["onClick","onKeyDown"]),r=e.getState().isOpen,s=i.disabled?{}:{onClick:u(n,e.button_handleClick),onKeyDown:u(o,e.button_handleKeyDown)};return y({role:"button","aria-label":r?"close menu":"open menu","aria-expanded":r,"aria-haspopup":!0},s,i)},this.button_handleKeyDown=function(t){e.buttonKeyDownHandlers[t.key]&&e.buttonKeyDownHandlers[t.key].call(e,t)},this.button_handleClick=function(t){t.preventDefault(),e.toggleMenu({type:P.stateChangeTypes.clickButton})},this.getLabelProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.getLabelProps.called=!0,e.getInputProps.called&&t.htmlFor&&t.htmlFor!==e.inputId)throw new Error('downshift: You provided the htmlFor of "'+t.htmlFor+'" for your label, but the id of your input is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return e.inputId=l(e.inputId,t.htmlFor,s("downshift-input")),y({},t,{htmlFor:e.inputId})},this.getInputProps=function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.onKeyDown,i=n.onBlur,r=n.onChange,a=n.onInput,p=I(n,["onKeyDown","onBlur","onChange","onInput"]);if(e.getInputProps.called=!0,e.getLabelProps.called&&p.id&&p.id!==e.inputId)throw new Error('downshift: You provided the id of "'+p.id+'" for your input, but the htmlFor of your label is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');e.inputId=l(e.inputId,p.id,s("downshift-input"));var d=Boolean(!1)?"onInput":"onChange",h=e.getState(),c=h.inputValue,g=h.isOpen,f=h.highlightedIndex,v=p.disabled?{}:(t={},m(t,d,u(r,a,e.input_handleChange)),m(t,"onKeyDown",u(o,e.input_handleKeyDown)),m(t,"onBlur",u(i,e.input_handleBlur)),t);return y({role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-activedescendant":"number"==typeof f&&f>=0?e.getItemId(f):null,autoComplete:"off",value:c},v,p,{id:e.inputId})},this.input_handleKeyDown=function(t){t.key&&e.keyDownHandlers[t.key]&&e.keyDownHandlers[t.key].call(e,t)},this.input_handleChange=function(t){e.internalSetState({type:P.stateChangeTypes.changeInput,isOpen:!0,inputValue:t.target.value})},this.input_handleBlur=function(){e.isMouseDown||e.reset({type:P.stateChangeTypes.blurInput})},this.getItemProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onMouseEnter,o=t.onClick,i=t.index,r=t.item,s=void 0===r?function(e,t){throw new Error('The property "'+t+'" is required in "'+e+'"')}("getItemProps","item"):r,l=I(t,["onMouseEnter","onClick","index","item"]);return void 0===i?(e.items.push(s),i=e.items.indexOf(s)):e.items[i]=s,y({id:e.getItemId(i),onMouseEnter:u(n,function(){e.setHighlightedIndex(i,{type:P.stateChangeTypes.itemMouseEnter})}),onClick:u(o,function(){e.selectItemAtIndex(i)})},l)},this.clearItems=function(){e.items=[]},this.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];t=h(t),e.internalSetState(function(n){var o=n.selectedItem;return y({isOpen:!1,highlightedIndex:null,inputValue:e.props.itemToString(o)},t)},o(n))},this.toggleMenu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];t=h(t),e.internalSetState(function(e){var n=e.isOpen;return y({isOpen:!n},t)},function(){e.getState().isOpen&&e.highlightDefaultIndex(),o(n)()})},this.openMenu=function(t){e.internalSetState({isOpen:!0},o(t))},this.closeMenu=function(t){e.internalSetState({isOpen:!1},o(t))},this.updateStatus=function(e,t){var n=void 0;return function(){for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}}(function(){if(e._isMounted){var t=e.getState(),o=e.items[t.highlightedIndex]||{},i=e.getItemCount(),r=e.props.getA11yStatusMessage(y({itemToString:e.props.itemToString,previousResultCount:e.previousResultCount,resultCount:i,highlightedItem:o},t));e.previousResultCount=i,n(r)}},200)};return P.default=P,P}); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
{ | ||
"name": "downshift", | ||
"version": "1.21.0", | ||
"version": "1.21.1", | ||
"description": "A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete components", | ||
@@ -58,3 +58,3 @@ "main": "dist/downshift.cjs.js", | ||
"jest-serializer-html": "^4.0.1", | ||
"kcd-scripts": "^0.30.2", | ||
"kcd-scripts": "^0.30.3", | ||
"preact": "^8.2.6", | ||
@@ -64,6 +64,6 @@ "preact-render-to-string": "^3.7.0", | ||
"prop-types": "^15.6.0", | ||
"react": "^16.1.1", | ||
"react-dom": "^16.1.1", | ||
"react-test-renderer": "^16.1.1", | ||
"typescript": "^2.6.1" | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"react-test-renderer": "^16.2.0", | ||
"typescript": "^2.6.2" | ||
}, | ||
@@ -70,0 +70,0 @@ "eslintConfig": { |
@@ -783,2 +783,5 @@ 'use strict'; | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -896,9 +899,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -905,0 +910,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -778,2 +778,5 @@ import React, { Component } from 'preact'; | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -891,9 +894,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -900,0 +905,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -784,2 +784,5 @@ (function (global, factory) { | ||
} | ||
if (this.isControlledProp('highlightedIndex') && this.props.highlightedIndex !== prevProps.highlightedIndex) { | ||
this.scrollHighlightedItemIntoView(); | ||
} | ||
this.updateStatus(); | ||
@@ -897,9 +900,11 @@ } | ||
otherStateToSet = pickState(otherStateToSet); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}); | ||
_this5.internalSetState(_extends({ highlightedIndex: highlightedIndex }, otherStateToSet), _this5.scrollHighlightedItemIntoView); | ||
}; | ||
this.scrollHighlightedItemIntoView = function () { | ||
var node = _this5.getItemNodeFromIndex(_this5.getState().highlightedIndex); | ||
var rootNode = _this5._rootNode; | ||
scrollIntoView(node, rootNode); | ||
}; | ||
this.openAndHighlightDefaultIndex = function () { | ||
@@ -906,0 +911,0 @@ var otherStateToSet = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):e.Downshift=t(e.preact)}(this,function(e){"use strict";function t(e){var t=w[w.length-1]===e;w=t?[].concat(I(w),[e]):[e];for(var n=function(){if(_)return _;return(_=document.createElement("div")).setAttribute("id","a11y-status-message"),_.setAttribute("role","status"),_.setAttribute("aria-live","assertive"),_.setAttribute("aria-relevant","additions text"),Object.assign(_.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(_),_}();n.lastChild;)n.removeChild(n.firstChild);w.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===w.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}function n(e){return"function"==typeof e?e:o}function o(){}function i(e,t,n){return null!==t&&t!==n.parentNode?e(t)?t===document.body&&0===t.scrollTop?document.documentElement:t:i(e,t.parentNode,n):null}function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function u(e){return e+"-"+b++}function s(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function l(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function a(e){return e.nodeName?"string"==typeof e.nodeName:"string"==typeof e.type}function p(e){return e.props||e.attributes}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return C.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var h="default"in e?e.default:e,c=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},g=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},m=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},y=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},v=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},I=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_="undefined"==typeof document?null:document.getElementById("a11y-status-message"),w=[],b=1,S=i.bind(null,function(e){return e.scrollHeight>e.clientHeight}),C=["highlightedIndex","inputValue","isOpen","selectedItem","type"],k=function(t){function i(){var e;c(this,i);for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var r=v(this,(e=i.__proto__||Object.getPrototypeOf(i)).call.apply(e,[this].concat(n)));P.call(r);var u=r.getState({highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen,inputValue:r.props.defaultInputValue,selectedItem:r.props.defaultSelectedItem});return u.selectedItem&&(u.inputValue=r.props.itemToString(u.selectedItem)),r.state=u,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,e.Component),g(i,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(n,o){return n[o]=e.isControlledProp(o)?e.props[o]:t[o],n},{})}},{key:"isControlledProp",value:function(e){return void 0!==this.props[e]}},{key:"getItemCount",value:function(){return void 0===this.props.itemCount?this.items.length:this.props.itemCount}},{key:"internalSetState",value:function(e,t){var o=this,r=void 0,u=void 0,s={},l="function"==typeof e;return!l&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,m({},this.getStateAndHelpers(),e)),this.setState(function(t){t=o.getState(t),e=l?e(t):e;var n={},a={};return(r=e.hasOwnProperty("selectedItem"))&&e.selectedItem!==t.selectedItem&&(u=e.selectedItem),e.type=e.type||i.stateChangeTypes.unknown,Object.keys(e).forEach(function(i){t[i]!==e[i]&&(s[i]=e[i]),"type"!==i&&(a[i]=e[i],o.isControlledProp(i)||(n[i]=e[i]))}),l&&e.hasOwnProperty("inputValue")&&o.props.onInputValueChange(e.inputValue,m({},o.getStateAndHelpers(),e)),n},function(){n(t)();Object.keys(s).length>1&&o.props.onStateChange(s,o.getStateAndHelpers()),r&&o.props.onSelect(e.selectedItem,o.getStateAndHelpers()),void 0!==u&&o.props.onChange(u,o.getStateAndHelpers()),o.props.onUserAction(s,o.getStateAndHelpers())})}},{key:"getStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen,r=this.props,u=r.id,s=r.itemToString,l=this.getRootProps,a=this.getButtonProps,p=this.getLabelProps,d=this.getInputProps,h=this.getItemProps,c=this.openMenu,g=this.closeMenu,f=this.toggleMenu,m=this.selectItem,y=this.selectItemAtIndex,v=this.selectHighlightedItem,I=this.setHighlightedIndex,_=this.clearSelection,w=this.clearItems;return{getRootProps:l,getButtonProps:a,getLabelProps:p,getInputProps:d,getItemProps:h,reset:this.reset,openMenu:c,closeMenu:g,toggleMenu:f,selectItem:m,selectItemAtIndex:y,selectHighlightedItem:v,setHighlightedIndex:I,clearSelection:_,clearItems:w,itemToString:s,id:u,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}}},{key:"getItemId",value:function(e){return this.props.id+"-item-"+e}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,t.target!==e._rootNode&&e._rootNode.contains(t.target)||!e.getState().isOpen||e.reset({type:i.stateChangeTypes.mouseUp},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",t),this.props.environment.addEventListener("mouseup",n),this.cleanup=function(){e._isMounted=!1,e.props.environment.removeEventListener("mousedown",t),e.props.environment.removeEventListener("mouseup",n)}}},{key:"componentDidUpdate",value:function(e){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:i.stateChangeTypes.controlledPropUpdatedSelectedItem,inputValue:this.props.itemToString(this.props.selectedItem)}),this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=l(this.props.render||this.props.children,o);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=l(e(this.getStateAndHelpers()));if(!t)return null;if(this.getRootProps.called)return this.getRootProps.suppressRefError||function(e,t){var n=t.refKey,o="ref"!==n,i=!a(e);if(i&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!i&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!p(e).hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}(t,this.getRootProps),t;if(a(t))return h.cloneElement(t,this.getRootProps(p(t)));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),i}();k.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,i=e.resultCount,r=e.previousResultCount,u=e.itemToString;return t?i?n&&i===r?u(n):i+" "+(1===i?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?u(o):""},id:u("downshift"),itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){},onInputValueChange:function(){},onUserAction:function(){},onChange:function(){},onSelect:function(){},onOuterClick:function(){},selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,breakingChanges:{}},k.stateChangeTypes={unknown:"__autocomplete_unknown__",mouseUp:"__autocomplete_mouseup__",itemMouseEnter:"__autocomplete_item_mouseenter__",keyDownArrowUp:"__autocomplete_keydown_arrow_up__",keyDownArrowDown:"__autocomplete_keydown_arrow_down__",keyDownEscape:"__autocomplete_keydown_escape__",keyDownEnter:"__autocomplete_keydown_enter__",blurInput:"__autocomplete_blur_input__",changeInput:"__autocomplete_change_input__",keyDownSpaceButton:"__autocomplete_keydown_space_button__",clickButton:"__autocomplete_click_button__",controlledPropUpdatedSelectedItem:"__autocomplete_controlled_prop_updated_selected_item__"};var P=function(){var e=this;this.root_handleClick=r(this.props.onClick,this.root_handleClick),this.input=null,this.items=[],this.previousResultCount=0,this.getItemNodeFromIndex=function(t){return e.props.environment.document.getElementById(e.getItemId(t))},this.setHighlightedIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.props.defaultHighlightedIndex,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=d(n),e.internalSetState(m({highlightedIndex:t},n),function(){!function(e,t){var n=S(e,t);if(null!==n){var o=getComputedStyle(n),i=n.getBoundingClientRect(),r=parseInt(o.borderTopWidth,10),u=r+parseInt(o.borderBottomWidth,10),s=i.top+r,l=e.getBoundingClientRect();if(l.top<0)n.scrollTop+=l.top;else if(l.top>0&&i.top<0)i.bottom>0&&l.bottom+u>i.bottom&&(n.scrollTop+=l.bottom-i.bottom+u);else{var a=l.top+n.scrollTop-s;a<n.scrollTop?n.scrollTop=a:a+l.height+u>n.scrollTop+i.height&&(n.scrollTop=a+l.height-i.height+u)}}}(e.getItemNodeFromIndex(e.getState().highlightedIndex),e._rootNode)})},this.openAndHighlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,m({isOpen:!0},t))},this.highlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,t)},this.moveHighlightedIndex=function(t,n){e.getState().isOpen?e.changeHighlightedIndex(t,n):e.openAndHighlightDefaultIndex(n)},this.changeHighlightedIndex=function(t,n){var o=e.getItemCount()-1;if(!(o<0)){var i=e.getState().highlightedIndex;null===i&&(i=t>0?-1:o+1);var r=i+t;r<0?r=o:r>o&&(r=0),e.setHighlightedIndex(r,n)}},this.clearSelection=function(t){e.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var o=e._rootNode.querySelector("#"+e.inputId);o&&o.focus&&o.focus(),n(t)()})},this.selectItem=function(t,o,i){o=d(o),e.internalSetState(m({isOpen:!1,highlightedIndex:e.props.defaultHighlightedIndex,selectedItem:t,inputValue:e.isControlledProp("selectedItem")&&e.props.breakingChanges.resetInputOnSelection?e.props.defaultInputValue:e.props.itemToString(t)},o),n(i))},this.selectItemAtIndex=function(t,n,o){var i=e.items[t];null!=i&&e.selectItem(i,n,o)},this.selectHighlightedItem=function(t,n){return e.selectItemAtIndex(e.getState().highlightedIndex,t,n)},this.rootRef=function(t){return e._rootNode=t},this.getRootProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).suppressRefError,o=void 0!==n&&n,i=t.refKey,r=void 0===i?"ref":i,u=y(t,["refKey"]);return e.getRootProps.called=!0,e.getRootProps.refKey=r,e.getRootProps.suppressRefError=o,m(f({},r,e.rootRef),u)},this.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:k.stateChangeTypes.keyDownArrowDown})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:k.stateChangeTypes.keyDownArrowUp})},Enter:function(e){this.getState().isOpen&&(e.preventDefault(),this.selectHighlightedItem({type:k.stateChangeTypes.keyDownEnter}))},Escape:function(e){e.preventDefault(),this.reset({type:k.stateChangeTypes.keyDownEscape})}},this.buttonKeyDownHandlers=m({},this.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:k.stateChangeTypes.keyDownSpaceButton})}}),this.getButtonProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onClick,o=t.onKeyDown,i=y(t,["onClick","onKeyDown"]),u=e.getState().isOpen,s=i.disabled?{}:{onClick:r(n,e.button_handleClick),onKeyDown:r(o,e.button_handleKeyDown)};return m({role:"button","aria-label":u?"close menu":"open menu","aria-expanded":u,"aria-haspopup":!0},s,i)},this.button_handleKeyDown=function(t){e.buttonKeyDownHandlers[t.key]&&e.buttonKeyDownHandlers[t.key].call(e,t)},this.button_handleClick=function(t){t.preventDefault(),e.toggleMenu({type:k.stateChangeTypes.clickButton})},this.getLabelProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.getLabelProps.called=!0,e.getInputProps.called&&t.htmlFor&&t.htmlFor!==e.inputId)throw new Error('downshift: You provided the htmlFor of "'+t.htmlFor+'" for your label, but the id of your input is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return e.inputId=s(e.inputId,t.htmlFor,u("downshift-input")),m({},t,{htmlFor:e.inputId})},this.getInputProps=function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.onKeyDown,i=n.onBlur,l=n.onChange,a=n.onInput,p=y(n,["onKeyDown","onBlur","onChange","onInput"]);if(e.getInputProps.called=!0,e.getLabelProps.called&&p.id&&p.id!==e.inputId)throw new Error('downshift: You provided the id of "'+p.id+'" for your input, but the htmlFor of your label is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');e.inputId=s(e.inputId,p.id,u("downshift-input"));var d=Boolean(!0)?"onInput":"onChange",h=e.getState(),c=h.inputValue,g=h.isOpen,v=h.highlightedIndex,I=p.disabled?{}:(t={},f(t,d,r(l,a,e.input_handleChange)),f(t,"onKeyDown",r(o,e.input_handleKeyDown)),f(t,"onBlur",r(i,e.input_handleBlur)),t);return m({role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-activedescendant":"number"==typeof v&&v>=0?e.getItemId(v):null,autoComplete:"off",value:c},I,p,{id:e.inputId})},this.input_handleKeyDown=function(t){t.key&&e.keyDownHandlers[t.key]&&e.keyDownHandlers[t.key].call(e,t)},this.input_handleChange=function(t){e.internalSetState({type:k.stateChangeTypes.changeInput,isOpen:!0,inputValue:t.target.value})},this.input_handleBlur=function(){e.isMouseDown||e.reset({type:k.stateChangeTypes.blurInput})},this.getItemProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onMouseEnter,o=t.onClick,i=t.index,u=t.item,s=void 0===u?function(e,t){throw new Error('The property "'+t+'" is required in "'+e+'"')}("getItemProps","item"):u,l=y(t,["onMouseEnter","onClick","index","item"]);return void 0===i?(e.items.push(s),i=e.items.indexOf(s)):e.items[i]=s,m({id:e.getItemId(i),onMouseEnter:r(n,function(){e.setHighlightedIndex(i,{type:k.stateChangeTypes.itemMouseEnter})}),onClick:r(o,function(){e.selectItemAtIndex(i)})},l)},this.clearItems=function(){e.items=[]},this.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];t=d(t),e.internalSetState(function(n){var o=n.selectedItem;return m({isOpen:!1,highlightedIndex:null,inputValue:e.props.itemToString(o)},t)},n(o))},this.toggleMenu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];t=d(t),e.internalSetState(function(e){var n=e.isOpen;return m({isOpen:!n},t)},function(){e.getState().isOpen&&e.highlightDefaultIndex(),n(o)()})},this.openMenu=function(t){e.internalSetState({isOpen:!0},n(t))},this.closeMenu=function(t){e.internalSetState({isOpen:!1},n(t))},this.updateStatus=function(e,t){var n=void 0;return function(){for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}}(function(){if(e._isMounted){var n=e.getState(),o=e.items[n.highlightedIndex]||{},i=e.getItemCount(),r=e.props.getA11yStatusMessage(m({itemToString:e.props.itemToString,previousResultCount:e.previousResultCount,resultCount:i,highlightedItem:o},n));e.previousResultCount=i,t(r)}},200)};return k.default=k,k}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):e.Downshift=t(e.preact)}(this,function(e){"use strict";function t(e){var t=w[w.length-1]===e;w=t?[].concat(v(w),[e]):[e];for(var n=function(){if(_)return _;return(_=document.createElement("div")).setAttribute("id","a11y-status-message"),_.setAttribute("role","status"),_.setAttribute("aria-live","assertive"),_.setAttribute("aria-relevant","additions text"),Object.assign(_.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),document.body.appendChild(_),_}();n.lastChild;)n.removeChild(n.firstChild);w.filter(Boolean).forEach(function(e,t){n.appendChild(function(e,t){var n=t===w.length-1?"block":"none",o=document.createElement("div");return o.style.display=n,o.textContent=e,o}(e,t))})}function n(e){return"function"==typeof e?e:o}function o(){}function i(e,t,n){return null!==t&&t!==n.parentNode?e(t)?t===document.body&&0===t.scrollTop?document.documentElement:t:i(e,t.parentNode,n):null}function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some(function(t){return t&&t.apply(void 0,[e].concat(o)),e.defaultPrevented})}}function u(e){return e+"-"+b++}function s(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.find(function(e){return void 0!==e})}function l(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}function a(e){return e.nodeName?"string"==typeof e.nodeName:"string"==typeof e.type}function p(e){return e.props||e.attributes}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return C.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}var h="default"in e?e.default:e,c=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},g=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},m=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},y=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},I=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},v=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_="undefined"==typeof document?null:document.getElementById("a11y-status-message"),w=[],b=1,S=i.bind(null,function(e){return e.scrollHeight>e.clientHeight}),C=["highlightedIndex","inputValue","isOpen","selectedItem","type"],k=function(t){function i(){var e;c(this,i);for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var r=I(this,(e=i.__proto__||Object.getPrototypeOf(i)).call.apply(e,[this].concat(n)));P.call(r);var u=r.getState({highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen,inputValue:r.props.defaultInputValue,selectedItem:r.props.defaultSelectedItem});return u.selectedItem&&(u.inputValue=r.props.itemToString(u.selectedItem)),r.state=u,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(i,e.Component),g(i,[{key:"getState",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return Object.keys(t).reduce(function(n,o){return n[o]=e.isControlledProp(o)?e.props[o]:t[o],n},{})}},{key:"isControlledProp",value:function(e){return void 0!==this.props[e]}},{key:"getItemCount",value:function(){return void 0===this.props.itemCount?this.items.length:this.props.itemCount}},{key:"internalSetState",value:function(e,t){var o=this,r=void 0,u=void 0,s={},l="function"==typeof e;return!l&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,m({},this.getStateAndHelpers(),e)),this.setState(function(t){t=o.getState(t),e=l?e(t):e;var n={},a={};return(r=e.hasOwnProperty("selectedItem"))&&e.selectedItem!==t.selectedItem&&(u=e.selectedItem),e.type=e.type||i.stateChangeTypes.unknown,Object.keys(e).forEach(function(i){t[i]!==e[i]&&(s[i]=e[i]),"type"!==i&&(a[i]=e[i],o.isControlledProp(i)||(n[i]=e[i]))}),l&&e.hasOwnProperty("inputValue")&&o.props.onInputValueChange(e.inputValue,m({},o.getStateAndHelpers(),e)),n},function(){n(t)();Object.keys(s).length>1&&o.props.onStateChange(s,o.getStateAndHelpers()),r&&o.props.onSelect(e.selectedItem,o.getStateAndHelpers()),void 0!==u&&o.props.onChange(u,o.getStateAndHelpers()),o.props.onUserAction(s,o.getStateAndHelpers())})}},{key:"getStateAndHelpers",value:function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=e.isOpen,r=this.props,u=r.id,s=r.itemToString,l=this.getRootProps,a=this.getButtonProps,p=this.getLabelProps,d=this.getInputProps,h=this.getItemProps,c=this.openMenu,g=this.closeMenu,f=this.toggleMenu,m=this.selectItem,y=this.selectItemAtIndex,I=this.selectHighlightedItem,v=this.setHighlightedIndex,_=this.clearSelection,w=this.clearItems;return{getRootProps:l,getButtonProps:a,getLabelProps:p,getInputProps:d,getItemProps:h,reset:this.reset,openMenu:c,closeMenu:g,toggleMenu:f,selectItem:m,selectItemAtIndex:y,selectHighlightedItem:I,setHighlightedIndex:v,clearSelection:_,clearItems:w,itemToString:s,id:u,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}}},{key:"getItemId",value:function(e){return this.props.id+"-item-"+e}},{key:"componentDidMount",value:function(){var e=this;this._isMounted=!0;var t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,t.target!==e._rootNode&&e._rootNode.contains(t.target)||!e.getState().isOpen||e.reset({type:i.stateChangeTypes.mouseUp},function(){return e.props.onOuterClick(e.getStateAndHelpers())})};this.props.environment.addEventListener("mousedown",t),this.props.environment.addEventListener("mouseup",n),this.cleanup=function(){e._isMounted=!1,e.props.environment.removeEventListener("mousedown",t),e.props.environment.removeEventListener("mouseup",n)}}},{key:"componentDidUpdate",value:function(e){this.isControlledProp("selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:i.stateChangeTypes.controlledPropUpdatedSelectedItem,inputValue:this.props.itemToString(this.props.selectedItem)}),this.isControlledProp("highlightedIndex")&&this.props.highlightedIndex!==e.highlightedIndex&&this.scrollHighlightedItemIntoView(),this.updateStatus()}},{key:"componentWillUnmount",value:function(){this.cleanup()}},{key:"render",value:function(){var e=l(this.props.render||this.props.children,o);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=l(e(this.getStateAndHelpers()));if(!t)return null;if(this.getRootProps.called)return this.getRootProps.suppressRefError||function(e,t){var n=t.refKey,o="ref"!==n,i=!a(e);if(i&&!o)throw new Error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps");if(!i&&o)throw new Error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"');if(!p(e).hasOwnProperty(n))throw new Error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}(t,this.getRootProps),t;if(a(t))return h.cloneElement(t,this.getRootProps(p(t)));throw new Error("downshift: If you return a non-DOM element, you must use apply the getRootProps function")}}]),i}();k.defaultProps={defaultHighlightedIndex:null,defaultSelectedItem:null,defaultInputValue:"",defaultIsOpen:!1,getA11yStatusMessage:function(e){var t=e.isOpen,n=e.highlightedItem,o=e.selectedItem,i=e.resultCount,r=e.previousResultCount,u=e.itemToString;return t?i?n&&i===r?u(n):i+" "+(1===i?"result is":"results are")+" available, use up and down arrow keys to navigate.":"No results.":o?u(o):""},id:u("downshift"),itemToString:function(e){return null==e?"":String(e)},onStateChange:function(){},onInputValueChange:function(){},onUserAction:function(){},onChange:function(){},onSelect:function(){},onOuterClick:function(){},selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,breakingChanges:{}},k.stateChangeTypes={unknown:"__autocomplete_unknown__",mouseUp:"__autocomplete_mouseup__",itemMouseEnter:"__autocomplete_item_mouseenter__",keyDownArrowUp:"__autocomplete_keydown_arrow_up__",keyDownArrowDown:"__autocomplete_keydown_arrow_down__",keyDownEscape:"__autocomplete_keydown_escape__",keyDownEnter:"__autocomplete_keydown_enter__",blurInput:"__autocomplete_blur_input__",changeInput:"__autocomplete_change_input__",keyDownSpaceButton:"__autocomplete_keydown_space_button__",clickButton:"__autocomplete_click_button__",controlledPropUpdatedSelectedItem:"__autocomplete_controlled_prop_updated_selected_item__"};var P=function(){var e=this;this.root_handleClick=r(this.props.onClick,this.root_handleClick),this.input=null,this.items=[],this.previousResultCount=0,this.getItemNodeFromIndex=function(t){return e.props.environment.document.getElementById(e.getItemId(t))},this.setHighlightedIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.props.defaultHighlightedIndex,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=d(n),e.internalSetState(m({highlightedIndex:t},n),e.scrollHighlightedItemIntoView)},this.scrollHighlightedItemIntoView=function(){!function(e,t){var n=S(e,t);if(null!==n){var o=getComputedStyle(n),i=n.getBoundingClientRect(),r=parseInt(o.borderTopWidth,10),u=r+parseInt(o.borderBottomWidth,10),s=i.top+r,l=e.getBoundingClientRect();if(l.top<0)n.scrollTop+=l.top;else if(l.top>0&&i.top<0)i.bottom>0&&l.bottom+u>i.bottom&&(n.scrollTop+=l.bottom-i.bottom+u);else{var a=l.top+n.scrollTop-s;a<n.scrollTop?n.scrollTop=a:a+l.height+u>n.scrollTop+i.height&&(n.scrollTop=a+l.height-i.height+u)}}}(e.getItemNodeFromIndex(e.getState().highlightedIndex),e._rootNode)},this.openAndHighlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,m({isOpen:!0},t))},this.highlightDefaultIndex=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setHighlightedIndex(void 0,t)},this.moveHighlightedIndex=function(t,n){e.getState().isOpen?e.changeHighlightedIndex(t,n):e.openAndHighlightDefaultIndex(n)},this.changeHighlightedIndex=function(t,n){var o=e.getItemCount()-1;if(!(o<0)){var i=e.getState().highlightedIndex;null===i&&(i=t>0?-1:o+1);var r=i+t;r<0?r=o:r>o&&(r=0),e.setHighlightedIndex(r,n)}},this.clearSelection=function(t){e.internalSetState({selectedItem:null,inputValue:"",isOpen:!1},function(){var o=e._rootNode.querySelector("#"+e.inputId);o&&o.focus&&o.focus(),n(t)()})},this.selectItem=function(t,o,i){o=d(o),e.internalSetState(m({isOpen:!1,highlightedIndex:e.props.defaultHighlightedIndex,selectedItem:t,inputValue:e.isControlledProp("selectedItem")&&e.props.breakingChanges.resetInputOnSelection?e.props.defaultInputValue:e.props.itemToString(t)},o),n(i))},this.selectItemAtIndex=function(t,n,o){var i=e.items[t];null!=i&&e.selectItem(i,n,o)},this.selectHighlightedItem=function(t,n){return e.selectItemAtIndex(e.getState().highlightedIndex,t,n)},this.rootRef=function(t){return e._rootNode=t},this.getRootProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).suppressRefError,o=void 0!==n&&n,i=t.refKey,r=void 0===i?"ref":i,u=y(t,["refKey"]);return e.getRootProps.called=!0,e.getRootProps.refKey=r,e.getRootProps.suppressRefError=o,m(f({},r,e.rootRef),u)},this.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:k.stateChangeTypes.keyDownArrowDown})},ArrowUp:function(e){e.preventDefault();var t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:k.stateChangeTypes.keyDownArrowUp})},Enter:function(e){this.getState().isOpen&&(e.preventDefault(),this.selectHighlightedItem({type:k.stateChangeTypes.keyDownEnter}))},Escape:function(e){e.preventDefault(),this.reset({type:k.stateChangeTypes.keyDownEscape})}},this.buttonKeyDownHandlers=m({},this.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:k.stateChangeTypes.keyDownSpaceButton})}}),this.getButtonProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onClick,o=t.onKeyDown,i=y(t,["onClick","onKeyDown"]),u=e.getState().isOpen,s=i.disabled?{}:{onClick:r(n,e.button_handleClick),onKeyDown:r(o,e.button_handleKeyDown)};return m({role:"button","aria-label":u?"close menu":"open menu","aria-expanded":u,"aria-haspopup":!0},s,i)},this.button_handleKeyDown=function(t){e.buttonKeyDownHandlers[t.key]&&e.buttonKeyDownHandlers[t.key].call(e,t)},this.button_handleClick=function(t){t.preventDefault(),e.toggleMenu({type:k.stateChangeTypes.clickButton})},this.getLabelProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.getLabelProps.called=!0,e.getInputProps.called&&t.htmlFor&&t.htmlFor!==e.inputId)throw new Error('downshift: You provided the htmlFor of "'+t.htmlFor+'" for your label, but the id of your input is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');return e.inputId=s(e.inputId,t.htmlFor,u("downshift-input")),m({},t,{htmlFor:e.inputId})},this.getInputProps=function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.onKeyDown,i=n.onBlur,l=n.onChange,a=n.onInput,p=y(n,["onKeyDown","onBlur","onChange","onInput"]);if(e.getInputProps.called=!0,e.getLabelProps.called&&p.id&&p.id!==e.inputId)throw new Error('downshift: You provided the id of "'+p.id+'" for your input, but the htmlFor of your label is "'+e.inputId+'". You must either remove the id from your input or set the htmlFor of the label equal to the input id.');e.inputId=s(e.inputId,p.id,u("downshift-input"));var d=Boolean(!0)?"onInput":"onChange",h=e.getState(),c=h.inputValue,g=h.isOpen,I=h.highlightedIndex,v=p.disabled?{}:(t={},f(t,d,r(l,a,e.input_handleChange)),f(t,"onKeyDown",r(o,e.input_handleKeyDown)),f(t,"onBlur",r(i,e.input_handleBlur)),t);return m({role:"combobox","aria-autocomplete":"list","aria-expanded":g,"aria-activedescendant":"number"==typeof I&&I>=0?e.getItemId(I):null,autoComplete:"off",value:c},v,p,{id:e.inputId})},this.input_handleKeyDown=function(t){t.key&&e.keyDownHandlers[t.key]&&e.keyDownHandlers[t.key].call(e,t)},this.input_handleChange=function(t){e.internalSetState({type:k.stateChangeTypes.changeInput,isOpen:!0,inputValue:t.target.value})},this.input_handleBlur=function(){e.isMouseDown||e.reset({type:k.stateChangeTypes.blurInput})},this.getItemProps=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onMouseEnter,o=t.onClick,i=t.index,u=t.item,s=void 0===u?function(e,t){throw new Error('The property "'+t+'" is required in "'+e+'"')}("getItemProps","item"):u,l=y(t,["onMouseEnter","onClick","index","item"]);return void 0===i?(e.items.push(s),i=e.items.indexOf(s)):e.items[i]=s,m({id:e.getItemId(i),onMouseEnter:r(n,function(){e.setHighlightedIndex(i,{type:k.stateChangeTypes.itemMouseEnter})}),onClick:r(o,function(){e.selectItemAtIndex(i)})},l)},this.clearItems=function(){e.items=[]},this.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];t=d(t),e.internalSetState(function(n){var o=n.selectedItem;return m({isOpen:!1,highlightedIndex:null,inputValue:e.props.itemToString(o)},t)},n(o))},this.toggleMenu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];t=d(t),e.internalSetState(function(e){var n=e.isOpen;return m({isOpen:!n},t)},function(){e.getState().isOpen&&e.highlightDefaultIndex(),n(o)()})},this.openMenu=function(t){e.internalSetState({isOpen:!0},n(t))},this.closeMenu=function(t){e.internalSetState({isOpen:!1},n(t))},this.updateStatus=function(e,t){var n=void 0;return function(){for(var o=arguments.length,i=Array(o),r=0;r<o;r++)i[r]=arguments[r];n&&clearTimeout(n),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}}(function(){if(e._isMounted){var n=e.getState(),o=e.items[n.highlightedIndex]||{},i=e.getItemCount(),r=e.props.getA11yStatusMessage(m({itemToString:e.props.itemToString,previousResultCount:e.previousResultCount,resultCount:i,highlightedItem:o},n));e.previousResultCount=i,t(r)}},200)};return k.default=k,k}); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
@@ -746,2 +746,3 @@ <h1 align="center"> | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore --> | ||
@@ -755,3 +756,4 @@ | [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[π»](https://github.com/paypal/downshift/commits?author=kentcdodds "Code") [π](https://github.com/paypal/downshift/commits?author=kentcdodds "Documentation") [π](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [β οΈ](https://github.com/paypal/downshift/commits?author=kentcdodds "Tests") | [<img src="https://avatars0.githubusercontent.com/u/100200?v=4" width="100px;"/><br /><sub><b>Ryan Florence</b></sub>](http://twitter.com/ryanflorence)<br />[π€](#ideas-ryanflorence "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/112170?v=4" width="100px;"/><br /><sub><b>Jared Forsyth</b></sub>](http://jaredforsyth.com)<br />[π€](#ideas-jaredly "Ideas, Planning, & Feedback") [π](https://github.com/paypal/downshift/commits?author=jaredly "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/8162598?v=4" width="100px;"/><br /><sub><b>Jack Moore</b></sub>](https://github.com/jtmthf)<br />[π‘](#example-jtmthf "Examples") | [<img src="https://avatars1.githubusercontent.com/u/2762082?v=4" width="100px;"/><br /><sub><b>Travis Arnold</b></sub>](http://travisrayarnold.com)<br />[π»](https://github.com/paypal/downshift/commits?author=souporserious "Code") [π](https://github.com/paypal/downshift/commits?author=souporserious "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/1045233?v=4" width="100px;"/><br /><sub><b>Marcy Sutton</b></sub>](http://marcysutton.com)<br />[π](https://github.com/paypal/downshift/issues?q=author%3Amarcysutton "Bug reports") [π€](#ideas-marcysutton "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/244704?v=4" width="100px;"/><br /><sub><b>Jeremy Gayed</b></sub>](http://www.jeremygayed.com)<br />[π‘](#example-tizmagik "Examples") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/3241922?v=4" width="100px;"/><br /><sub><b>usΝ‘anΜΈdfΝrienΝdsΝ </b></sub>](http://ronak.io/)<br />[π](https://github.com/paypal/downshift/issues?q=author%3Ausandfriends "Bug reports") [π»](https://github.com/paypal/downshift/commits?author=usandfriends "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=usandfriends "Tests") | [<img src="https://avatars0.githubusercontent.com/u/474248?v=4" width="100px;"/><br /><sub><b>Robin Drexler</b></sub>](https://www.robin-drexler.com/)<br />[π](https://github.com/paypal/downshift/issues?q=author%3Arobin-drexler "Bug reports") [π»](https://github.com/paypal/downshift/commits?author=robin-drexler "Code") | [<img src="https://avatars0.githubusercontent.com/u/7406639?v=4" width="100px;"/><br /><sub><b>Arturo Romero</b></sub>](http://arturoromero.info/)<br />[π‘](#example-arturoromeroslc "Examples") | [<img src="https://avatars1.githubusercontent.com/u/275483?v=4" width="100px;"/><br /><sub><b>yp</b></sub>](http://algolab.eu/pirola)<br />[π](https://github.com/paypal/downshift/issues?q=author%3Ayp "Bug reports") [π»](https://github.com/paypal/downshift/commits?author=yp "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=yp "Tests") | [<img src="https://avatars0.githubusercontent.com/u/3998604?v=4" width="100px;"/><br /><sub><b>Dave Garwacke</b></sub>](http://www.warbyparker.com)<br />[π](https://github.com/paypal/downshift/commits?author=ifyoumakeit "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/11758660?v=4" width="100px;"/><br /><sub><b>Ivan Pazhitnykh</b></sub>](http://linkedin.com/in/drapegnik)<br />[π»](https://github.com/paypal/downshift/commits?author=Drapegnik "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=Drapegnik "Tests") | [<img src="https://avatars0.githubusercontent.com/u/61776?v=4" width="100px;"/><br /><sub><b>Luis Merino</b></sub>](https://github.com/Rendez)<br />[π](https://github.com/paypal/downshift/commits?author=Rendez "Documentation") | | ||
| [<img src="https://avatars0.githubusercontent.com/u/8746094?v=4" width="100px;"/><br /><sub><b>Andrew Hansen</b></sub>](http://twitter.com/arahansen)<br />[π»](https://github.com/paypal/downshift/commits?author=arahansen "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=arahansen "Tests") | [<img src="https://avatars3.githubusercontent.com/u/20307225?v=4" width="100px;"/><br /><sub><b>John Whiles</b></sub>](http://www.johnwhiles.com)<br />[π»](https://github.com/paypal/downshift/commits?author=Jwhiles "Code") | [<img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;"/><br /><sub><b>Justin Hall</b></sub>](https://github.com/wKovacs64)<br />[π](#infra-wKovacs64 "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars2.githubusercontent.com/u/7641760?v=4" width="100px;"/><br /><sub><b>Pete NykΓ€nen</b></sub>](https://twitter.com/pete_tnt)<br />[π](#review-petetnt "Reviewed Pull Requests") | [<img src="https://avatars2.githubusercontent.com/u/4060187?v=4" width="100px;"/><br /><sub><b>Jared Palmer</b></sub>](http://jaredpalmer.com)<br />[π»](https://github.com/paypal/downshift/commits?author=jaredpalmer "Code") | [<img src="https://avatars3.githubusercontent.com/u/11477718?v=4" width="100px;"/><br /><sub><b>Philip Young</b></sub>](http://www.philipyoungg.com)<br />[π»](https://github.com/paypal/downshift/commits?author=philipyoungg "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=philipyoungg "Tests") [π€](#ideas-philipyoungg "Ideas, Planning, & Feedback") | | ||
| [<img src="https://avatars0.githubusercontent.com/u/8746094?v=4" width="100px;"/><br /><sub><b>Andrew Hansen</b></sub>](http://twitter.com/arahansen)<br />[π»](https://github.com/paypal/downshift/commits?author=arahansen "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=arahansen "Tests") [π€](#ideas-arahansen "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/20307225?v=4" width="100px;"/><br /><sub><b>John Whiles</b></sub>](http://www.johnwhiles.com)<br />[π»](https://github.com/paypal/downshift/commits?author=Jwhiles "Code") | [<img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;"/><br /><sub><b>Justin Hall</b></sub>](https://github.com/wKovacs64)<br />[π](#infra-wKovacs64 "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars2.githubusercontent.com/u/7641760?v=4" width="100px;"/><br /><sub><b>Pete NykΓ€nen</b></sub>](https://twitter.com/pete_tnt)<br />[π](#review-petetnt "Reviewed Pull Requests") | [<img src="https://avatars2.githubusercontent.com/u/4060187?v=4" width="100px;"/><br /><sub><b>Jared Palmer</b></sub>](http://jaredpalmer.com)<br />[π»](https://github.com/paypal/downshift/commits?author=jaredpalmer "Code") | [<img src="https://avatars3.githubusercontent.com/u/11477718?v=4" width="100px;"/><br /><sub><b>Philip Young</b></sub>](http://www.philipyoungg.com)<br />[π»](https://github.com/paypal/downshift/commits?author=philipyoungg "Code") [β οΈ](https://github.com/paypal/downshift/commits?author=philipyoungg "Tests") [π€](#ideas-philipyoungg "Ideas, Planning, & Feedback") | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -758,0 +760,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
570165
6783
810