react-autocomplete
Advanced tools
Comparing version 1.5.8 to 1.5.9
@@ -23,2 +23,9 @@ 'use strict'; | ||
function getScrollOffset() { | ||
return { | ||
x: window.pageXOffset !== undefined ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft, | ||
y: window.pageYOffset !== undefined ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop | ||
}; | ||
} | ||
var Autocomplete = function (_React$Component) { | ||
@@ -52,4 +59,13 @@ _inherits(Autocomplete, _React$Component); | ||
this._ignoreBlur = false; | ||
this._ignoreFocus = false; | ||
this._scrollOffset = null; | ||
this._scrollTimer = null; | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
clearTimeout(this._scrollTimer); | ||
this._scrollTimer = null; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
@@ -80,6 +96,2 @@ value: function componentWillReceiveProps(nextProps) { | ||
} | ||
// Capture the input's focus as long as the ignoreBlur flag is set | ||
if (this._ignoreBlur) { | ||
this.refs.input.focus(); | ||
} | ||
} | ||
@@ -189,2 +201,5 @@ }, { | ||
var value = this.props.getItemValue(item); | ||
// The menu will de-render before a mouseLeave event | ||
// happens. Clear the flag to release control over focus | ||
this.setIgnoreBlur(false); | ||
this.setState({ | ||
@@ -194,5 +209,2 @@ isOpen: false, | ||
}, function () { | ||
// Clear the ignoreBlur flag after the component has | ||
// updated to release control over the input's focus | ||
_this3.setIgnoreBlur(false); | ||
_this3.props.onSelect(value, item); | ||
@@ -248,2 +260,5 @@ }); | ||
if (this._ignoreBlur) { | ||
this._ignoreFocus = true; | ||
this._scrollOffset = getScrollOffset(); | ||
this.refs.input.focus(); | ||
return; | ||
@@ -264,3 +279,28 @@ } | ||
value: function handleInputFocus(event) { | ||
if (this._ignoreBlur) { | ||
var _this5 = this; | ||
if (this._ignoreFocus) { | ||
this._ignoreFocus = false; | ||
var _scrollOffset = this._scrollOffset, | ||
x = _scrollOffset.x, | ||
y = _scrollOffset.y; | ||
this._scrollOffset = null; | ||
// Focus will cause the browser to scroll the <input> into view. | ||
// This can cause the mouse coords to change, which in turn | ||
// could cause a new highlight to happen, cancelling the click | ||
// event (when selecting with the mouse) | ||
window.scrollTo(x, y); | ||
// Some browsers wait until all focus event handlers have been | ||
// processed before scrolling the <input> into view, so let's | ||
// scroll again on the next tick to ensure we're back to where | ||
// the user was before focus was lost. We could do the deferred | ||
// scroll only, but that causes a jarring split second jump in | ||
// some browsers that scroll before the focus event handlers | ||
// are triggered. | ||
clearTimeout(this._scrollTimer); | ||
this._scrollTimer = setTimeout(function () { | ||
_this5._scrollTimer = null; | ||
window.scrollTo(x, y); | ||
}, 0); | ||
return; | ||
@@ -497,3 +537,3 @@ } | ||
Enter: function Enter(event) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
@@ -508,3 +548,3 @@ if (!this.isOpen()) { | ||
}, function () { | ||
_this5.refs.input.select(); | ||
_this6.refs.input.select(); | ||
}); | ||
@@ -521,4 +561,4 @@ } else { | ||
//this.refs.input.focus() // TODO: file issue | ||
_this5.refs.input.setSelectionRange(value.length, value.length); | ||
_this5.props.onSelect(value, item); | ||
_this6.refs.input.setSelectionRange(value.length, value.length); | ||
_this6.props.onSelect(value, item); | ||
}); | ||
@@ -525,0 +565,0 @@ } |
@@ -7,2 +7,6 @@ # CHANGELOG | ||
## [1.5.9] - 2017-06-16 | ||
### Fixed | ||
- Reworked focus management to be more consistent and handle edge cases (async focus, input out of viewport, etc., read more in #153, #246, #222, & #240) | ||
## [1.5.8] - 2017-06-16 | ||
@@ -197,3 +201,4 @@ ### Fixed | ||
[Unreleased]: https://github.com/reactjs/react-autocomplete/compare/v1.5.8...HEAD | ||
[Unreleased]: https://github.com/reactjs/react-autocomplete/compare/v1.5.9...HEAD | ||
[1.5.9]: https://github.com/reactjs/react-autocomplete/compare/v1.5.8...v1.5.9 | ||
[1.5.8]: https://github.com/reactjs/react-autocomplete/compare/v1.5.7...v1.5.8 | ||
@@ -200,0 +205,0 @@ [1.5.7]: https://github.com/reactjs/react-autocomplete/compare/v1.5.6...v1.5.7 |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.ReactAutocomplete=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){return function t(n,r,o){function i(s,l){if(!r[s]){if(!n[s]){var a="function"==typeof e&&e;if(!l&&a)return a(s,!0);if(u)return u(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[s]={exports:{}};n[s][0].call(c.exports,function(e){var t=n[s][1][e];return i(t||e)},c,c.exports,t,n,r,o)}return r[s].exports}for(var u="function"==typeof e&&e,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){(function(n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=e("react"),a=e("prop-types"),f=e("react-dom"),c=f.findDOMNode,p=e("dom-scroll-into-view"),h=["blur","checkValidity","click","focus","select","setCustomValidity","setSelectionRange","setRangeText"],d=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={isOpen:!1,highlightedIndex:null},n._debugStates=[],n.exposeAPI=n.exposeAPI.bind(n),n.handleInputFocus=n.handleInputFocus.bind(n),n.handleInputBlur=n.handleInputBlur.bind(n),n.handleChange=n.handleChange.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleInputClick=n.handleInputClick.bind(n),n}return i(t,e),s(t,[{key:"componentWillMount",value:function(){this.refs={},this._ignoreBlur=!1}},{key:"componentWillReceiveProps",value:function(e){null!==this.state.highlightedIndex&&this.setState(this.ensureHighlightedIndex),!e.autoHighlight||this.props.value===e.value&&null!==this.state.highlightedIndex||this.setState(this.maybeAutoCompleteText)}},{key:"componentDidMount",value:function(){this.isOpen()&&this.setMenuPositions()}},{key:"componentDidUpdate",value:function(e,t){(this.state.isOpen&&!t.isOpen||"open"in this.props&&this.props.open&&!e.open)&&this.setMenuPositions(),this.maybeScrollItemIntoView(),t.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen),this._ignoreBlur&&this.refs.input.focus()}},{key:"exposeAPI",value:function(e){var t=this;this.refs.input=e,h.forEach(function(n){return t[n]=e&&e[n]&&e[n].bind(e)})}},{key:"maybeScrollItemIntoView",value:function(){if(this.isOpen()&&null!==this.state.highlightedIndex){var e=this.refs["item-"+this.state.highlightedIndex],t=this.refs.menu;p(c(e),c(t),{onlyScrollIfNeeded:!0})}}},{key:"handleKeyDown",value:function(e){t.keyDownHandlers[e.key]?t.keyDownHandlers[e.key].call(this,e):this.isOpen()||this.setState({isOpen:!0})}},{key:"handleChange",value:function(e){this.props.onChange(e,e.target.value)}},{key:"getFilteredItems",value:function(e){var t=e.items;return e.shouldItemRender&&(t=t.filter(function(t){return e.shouldItemRender(t,e.value)})),e.sortItems&&t.sort(function(t,n){return e.sortItems(t,n,e.value)}),t}},{key:"maybeAutoCompleteText",value:function(e,t){var n=e.highlightedIndex,r=t.value,o=t.getItemValue,i=null===n?0:n,u=this.getFilteredItems(t)[i];if(""!==r&&u){if(0===o(u).toLowerCase().indexOf(r.toLowerCase()))return{highlightedIndex:i}}return{highlightedIndex:null}}},{key:"ensureHighlightedIndex",value:function(e,t){if(e.highlightedIndex>=this.getFilteredItems(t).length)return{highlightedIndex:null}}},{key:"setMenuPositions",value:function(){var e=this.refs.input,t=e.getBoundingClientRect(),r=n.window.getComputedStyle(e),o=parseInt(r.marginBottom,10)||0,i=parseInt(r.marginLeft,10)||0,u=parseInt(r.marginRight,10)||0;this.setState({menuTop:t.bottom+o,menuLeft:t.left+i,menuWidth:t.width+i+u})}},{key:"highlightItemFromMouse",value:function(e){this.setState({highlightedIndex:e})}},{key:"selectItemFromMouse",value:function(e){var t=this,n=this.props.getItemValue(e);this.setState({isOpen:!1,highlightedIndex:null},function(){t.setIgnoreBlur(!1),t.props.onSelect(n,e)})}},{key:"setIgnoreBlur",value:function(e){this._ignoreBlur=e}},{key:"renderMenu",value:function(){var e=this,t=this.getFilteredItems(this.props).map(function(t,n){var r=e.props.renderItem(t,e.state.highlightedIndex===n,{cursor:"default"});return l.cloneElement(r,{onMouseEnter:function(){return e.highlightItemFromMouse(n)},onClick:function(){return e.selectItemFromMouse(t)},ref:function(t){return e.refs["item-"+n]=t}})}),n={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth},r=this.props.renderMenu(t,this.props.value,n);return l.cloneElement(r,{ref:function(t){return e.refs.menu=t},onMouseEnter:function(){return e.setIgnoreBlur(!0)},onMouseLeave:function(){return e.setIgnoreBlur(!1)}})}},{key:"handleInputBlur",value:function(e){if(!this._ignoreBlur){this.setState({isOpen:!1,highlightedIndex:null});var t=this.props.inputProps.onBlur;t&&t(e)}}},{key:"handleInputFocus",value:function(e){if(!this._ignoreBlur){this.setState({isOpen:!0});var t=this.props.inputProps.onFocus;t&&t(e)}}},{key:"isInputFocused",value:function(){var e=this.refs.input;return e.ownerDocument&&e===e.ownerDocument.activeElement}},{key:"handleInputClick",value:function(){this.isInputFocused()&&!this.isOpen()&&this.setState({isOpen:!0})}},{key:"composeEventHandlers",value:function(e,t){return t?function(n){e(n),t(n)}:e}},{key:"isOpen",value:function(){return"open"in this.props?this.props.open:this.state.isOpen}},{key:"render",value:function(){this.props.debug&&this._debugStates.push({id:this._debugStates.length,state:this.state});var e=this.props.inputProps,t=this.isOpen();return l.createElement("div",u({style:u({},this.props.wrapperStyle)},this.props.wrapperProps),l.createElement("input",u({},e,{role:"combobox","aria-autocomplete":"list","aria-expanded":t,autoComplete:"off",ref:this.exposeAPI,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,onChange:this.handleChange,onKeyDown:this.composeEventHandlers(this.handleKeyDown,e.onKeyDown),onClick:this.composeEventHandlers(this.handleInputClick,e.onClick),value:this.props.value})),t&&this.renderMenu(),this.props.debug&&l.createElement("pre",{style:{marginLeft:300}},JSON.stringify(this._debugStates.slice(Math.max(0,this._debugStates.length-5),this._debugStates.length),null,2)))}}]),t}(l.Component);d.propTypes={items:a.array.isRequired,value:a.any,onChange:a.func,onSelect:a.func,shouldItemRender:a.func,sortItems:a.func,getItemValue:a.func.isRequired,renderItem:a.func.isRequired,renderMenu:a.func,menuStyle:a.object,inputProps:a.object,wrapperProps:a.object,wrapperStyle:a.object,autoHighlight:a.bool,onMenuVisibilityChange:a.func,open:a.bool,debug:a.bool},d.defaultProps={value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange:function(){},onSelect:function(){},renderMenu:function(e,t,n){return l.createElement("div",{style:u({},n,this.menuStyle),children:e})},menuStyle:{borderRadius:"3px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",background:"rgba(255, 255, 255, 0.9)",padding:"2px 0",fontSize:"90%",position:"fixed",overflow:"auto",maxHeight:"50%"},autoHighlight:!0,onMenuVisibilityChange:function(){}},d.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=this.getFilteredItems(this.props).length;if(t){var n=this.state.highlightedIndex,r=null===n||n===t-1?0:n+1;this.setState({highlightedIndex:r,isOpen:!0})}},ArrowUp:function(e){e.preventDefault();var t=this.getFilteredItems(this.props).length;if(t){var n=this.state.highlightedIndex,r=0===n||null===n?t-1:n-1;this.setState({highlightedIndex:r,isOpen:!0})}},Enter:function(e){var t=this;if(this.isOpen())if(null==this.state.highlightedIndex)this.setState({isOpen:!1},function(){t.refs.input.select()});else{e.preventDefault();var n=this.getFilteredItems(this.props)[this.state.highlightedIndex],r=this.props.getItemValue(n);this.setState({isOpen:!1,highlightedIndex:null},function(){t.refs.input.setSelectionRange(r.length,r.length),t.props.onSelect(r,n)})}},Escape:function(){this.setIgnoreBlur(!1),this.setState({highlightedIndex:null,isOpen:!1})},Tab:function(){this.setIgnoreBlur(!1)}},t.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"dom-scroll-into-view":2,"prop-types":11,react:"react","react-dom":"react-dom"}],2:[function(e,t,n){t.exports=e("./lib/dom-scroll-into-view")},{"./lib/dom-scroll-into-view":3}],3:[function(e,t,n){function r(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,u=n.alignWithTop,s=n.alignWithLeft;r=void 0===r||r;var l,a,f,c,p,h,d,v,y,g,m=o.isWindow(t),b=o.offset(e),w=o.outerHeight(e),I=o.outerWidth(e);m?(d=t,g=o.height(d),y=o.width(d),v={left:o.scrollLeft(d),top:o.scrollTop(d)},p={left:b.left-v.left,top:b.top-v.top},h={left:b.left+I-(v.left+y),top:b.top+w-(v.top+g)},c=v):(l=o.offset(t),a=t.clientHeight,f=t.clientWidth,c={left:t.scrollLeft,top:t.scrollTop},p={left:b.left-(l.left+(parseFloat(o.css(t,"borderLeftWidth"))||0)),top:b.top-(l.top+(parseFloat(o.css(t,"borderTopWidth"))||0))},h={left:b.left+I-(l.left+f+(parseFloat(o.css(t,"borderRightWidth"))||0)),top:b.top+w-(l.top+a+(parseFloat(o.css(t,"borderBottomWidth"))||0))}),p.top<0||h.top>0?!0===u?o.scrollTop(t,c.top+p.top):!1===u?o.scrollTop(t,c.top+h.top):p.top<0?o.scrollTop(t,c.top+p.top):o.scrollTop(t,c.top+h.top):i||(u=void 0===u||!!u,u?o.scrollTop(t,c.top+p.top):o.scrollTop(t,c.top+h.top)),r&&(p.left<0||h.left>0?!0===s?o.scrollLeft(t,c.left+p.left):!1===s?o.scrollLeft(t,c.left+h.left):p.left<0?o.scrollLeft(t,c.left+p.left):o.scrollLeft(t,c.left+h.left):i||(s=void 0===s||!!s,s?o.scrollLeft(t,c.left+p.left):o.scrollLeft(t,c.left+h.left)))}var o=e("./util");t.exports=r},{"./util":4}],4:[function(e,t,n){function r(e){var t,n,r,o=e.ownerDocument,i=o.body,u=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,r=t.top,n-=u.clientLeft||i.clientLeft||0,r-=u.clientTop||i.clientTop||0,{left:n,top:r}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[r],"number"!=typeof n&&(n=o.body[r])}return n}function i(e){return o(e)}function u(e){return o(e,!0)}function s(e){var t=r(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=i(o),t.top+=u(o),t}function l(e,t,n){var r="",o=e.ownerDocument;return(n=n||o.defaultView.getComputedStyle(e,null))&&(r=n.getPropertyValue(t)||n[t]),r}function a(e,t){var n=e[T]&&e[T][t];if(x.test(n)&&!S.test(t)){var r=e.style,o=r[k],i=e[O][k];e[O][k]=e[T][k],r[k]="fontSize"===t?"1em":n||0,n=r.pixelLeft+R,r[k]=o,e[O][k]=i}return""===n?"auto":n}function f(e,t){"static"===m(e,"position")&&(e.style.position="relative");var n,r,o=s(e),i={};for(r in t)n=parseFloat(m(e,r))||0,i[r]=n+t[r]-o[r];m(e,i)}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===w(e,"boxSizing")}function h(e,t,n){var r,o={},i=e.style;for(r in t)o[r]=i[r],i[r]=t[r];n.call(e);for(r in t)i[r]=o[r]}function d(e,t,n){var r,o,i,u=0;for(o=0;o<t.length;o++)if(r=t[o])for(i=0;i<n.length;i++){var s;s="border"===r?r+n[i]+"Width":r+n[i],u+=parseFloat(w(e,s))||0}return u}function v(e){return null!=e&&e==e.window}function y(e,t,n){if(v(e))return"width"===t?F.viewportWidth(e):F.viewportHeight(e);if(9===e.nodeType)return"width"===t?F.docWidth(e):F.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,i=w(e),u=p(e,i),s=0;(null==o||o<=0)&&(o=void 0,s=w(e,t),(null==s||Number(s)<0)&&(s=e.style[t]||0),s=parseFloat(s)||0),void 0===n&&(n=u?C:E);var l=void 0!==o||u,a=o||s;return n===E?l?a-d(e,["border","padding"],r,i):s:l?a+(n===C?0:n===j?-d(e,["border"],r,i):d(e,["margin"],r,i)):s+d(e,P.slice(n),r,i)}function g(e){var t,n=arguments;return 0!==e.offsetWidth?t=y.apply(void 0,n):h(e,_,function(){t=y.apply(void 0,n)}),t}function m(e,t,n){if("object"!=typeof t){if(void 0===n)return w(e,t);"number"==typeof n&&(n+="px"),e.style[t]=n}else for(var r in t)m(e,r,t[r])}function b(e,t){for(var n in t)e[n]=t[n];return e}var w,I=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,x=new RegExp("^("+I+")(?!px)[a-z%]+$","i"),S=/^(top|right|bottom|left)$/,T="currentStyle",O="runtimeStyle",k="left",R="px";"undefined"!=typeof window&&(w=window.getComputedStyle?l:a);var P=["margin","border","padding"],E=-1,j=2,C=1,F={};c(["Width","Height"],function(e){F["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],F["viewport"+e](n))},F["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,i=r.documentElement,u=i[n];return"CSS1Compat"===r.compatMode&&u||o&&o[n]||u}});var _={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);F["outer"+t]=function(t,n){return t&&g(t,e,n?0:C)};var n="width"===e?["Left","Right"]:["Top","Bottom"];F[e]=function(t,r){if(void 0===r)return t&&g(t,e,E);if(t){var o=w(t);return p(t)&&(r+=d(t,["padding","border"],n,o)),m(t,e,r)}}});var D=t.exports={getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return s(e);f(e,t)},isWindow:v,each:c,css:m,clone:function(e){var t={};for(var n in e)t[n]=e[n];if(e.overflow)for(n in e)t.overflow[n]=e.overflow[n];return t},mix:b,scrollLeft:function(e,t){if(v(e)){if(void 0===t)return i(e);window.scrollTo(t,u(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(v(e)){if(void 0===t)return u(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},merge:function(){for(var e={},t=0;t<arguments.length;t++)D.mix(e,arguments[t]);return e},viewportWidth:0,viewportHeight:0};b(D,F)},{}],5:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],6:[function(e,t,n){"use strict";function r(e,t,n,r,i,u,s,l){if(o(t),!e){var a;if(void 0===t)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,u,s,l],c=0;a=new Error(t.replace(/%s/g,function(){return f[c++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}}var o=function(e){};t.exports=r},{}],7:[function(e,t,n){"use strict";var r=e("./emptyFunction"),o=r;t.exports=o},{"./emptyFunction":5}],8:[function(e,t,n){"use strict";function r(e,t,n,r,o){}t.exports=r},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/invariant":6,"fbjs/lib/warning":7}],9:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("./lib/ReactPropTypesSecret");t.exports=function(){function e(e,t,n,r,u,s){s!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":5,"fbjs/lib/invariant":6}],10:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("fbjs/lib/warning"),u=e("./lib/ReactPropTypesSecret"),s=e("./checkPropTypes");t.exports=function(e,t){function n(e){var t=e&&(T&&e[T]||e[O]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function a(e){this.message=e,this.stack=""}function f(e){function n(n,r,i,s,l,f,c){if(s=s||k,f=f||i,c!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else;return null==r[i]?n?new a(null===r[i]?"The "+l+" `"+f+"` is marked as required in `"+s+"`, but its value is `null`.":"The "+l+" `"+f+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(r,i,s,l,f)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function c(e){function t(t,n,r,o,i,u){var s=t[n];if(w(s)!==e)return new a("Invalid "+o+" `"+i+"` of type `"+I(s)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(t)}function p(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){return new a("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l<s.length;l++){var f=e(s,l,r,o,i+"["+l+"]",u);if(f instanceof Error)return f}return null}return f(t)}function h(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var u=e.name||k;return new a("Invalid "+o+" `"+i+"` of type `"+S(t[n])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return f(t)}function d(e){function t(t,n,r,o,i){for(var u=t[n],s=0;s<e.length;s++)if(l(u,e[s]))return null;return new a("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):r.thatReturnsNull}function v(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],l=w(s);if("object"!==l)return new a("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+r+"`, expected an object.");for(var f in s)if(s.hasOwnProperty(f)){var c=e(s,f,r,o,i+"."+f,u);if(c instanceof Error)return c}return null}return f(t)}function y(e){function t(t,n,r,o,i){for(var s=0;s<e.length;s++){if(null==(0,e[s])(t,n,r,o,i,u))return null}return new a("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(e))return r.thatReturnsNull;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",x(o),n),r.thatReturnsNull}return f(t)}function g(e){function t(t,n,r,o,i){var s=t[n],l=w(s);if("object"!==l)return new a("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");for(var f in e){var c=e[f];if(c){var p=c(s,f,r,o,i+"."+f,u);if(p)return p}}return null}return f(t)}function m(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(m);if(null===t||e(t))return!0;var r=n(t);if(!r)return!1;var o,i=r.call(t);if(r!==t.entries){for(;!(o=i.next()).done;)if(!m(o.value))return!1}else for(;!(o=i.next()).done;){var u=o.value;if(u&&!m(u[1]))return!1}return!0;default:return!1}}function b(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function w(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":b(t,e)?"symbol":t}function I(e){if(void 0===e||null===e)return""+e;var t=w(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=I(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function S(e){return e.constructor&&e.constructor.name?e.constructor.name:k}var T="function"==typeof Symbol&&Symbol.iterator,O="@@iterator",k="<<anonymous>>",R={array:c("array"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:p,element:function(){function t(t,n,r,o,i){var u=t[n];if(!e(u)){return new a("Invalid "+o+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(t)}(),instanceOf:h,node:function(){function e(e,t,n,r,o){return m(e[t])?null:new a("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return f(e)}(),objectOf:v,oneOf:d,oneOfType:y,shape:g};return a.prototype=Error.prototype,R.checkPropTypes=s,R.PropTypes=R,R}},{"./checkPropTypes":8,"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":5,"fbjs/lib/invariant":6,"fbjs/lib/warning":7}],11:[function(e,t,n){t.exports=e("./factoryWithThrowingShims")()},{"./factoryWithThrowingShims":9,"./factoryWithTypeCheckers":10}],12:[function(e,t,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[1])(1)}(function(n){if("react"===n)return e;if("react-dom"===n)return t;if("undefined"!=typeof require)return require(n);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.ReactAutocomplete=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){return function t(n,r,o){function i(s,l){if(!r[s]){if(!n[s]){var a="function"==typeof e&&e;if(!l&&a)return a(s,!0);if(u)return u(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[s]={exports:{}};n[s][0].call(c.exports,function(e){var t=n[s][1][e];return i(t||e)},c,c.exports,t,n,r,o)}return r[s].exports}for(var u="function"==typeof e&&e,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){(function(n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=e("react"),f=e("prop-types"),c=e("react-dom"),p=c.findDOMNode,d=e("dom-scroll-into-view"),h=["blur","checkValidity","click","focus","select","setCustomValidity","setSelectionRange","setRangeText"],v=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={isOpen:!1,highlightedIndex:null},n._debugStates=[],n.exposeAPI=n.exposeAPI.bind(n),n.handleInputFocus=n.handleInputFocus.bind(n),n.handleInputBlur=n.handleInputBlur.bind(n),n.handleChange=n.handleChange.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleInputClick=n.handleInputClick.bind(n),n}return i(t,e),l(t,[{key:"componentWillMount",value:function(){this.refs={},this._ignoreBlur=!1,this._ignoreFocus=!1,this._scrollOffset=null,this._scrollTimer=null}},{key:"componentWillUnmount",value:function(){clearTimeout(this._scrollTimer),this._scrollTimer=null}},{key:"componentWillReceiveProps",value:function(e){null!==this.state.highlightedIndex&&this.setState(this.ensureHighlightedIndex),!e.autoHighlight||this.props.value===e.value&&null!==this.state.highlightedIndex||this.setState(this.maybeAutoCompleteText)}},{key:"componentDidMount",value:function(){this.isOpen()&&this.setMenuPositions()}},{key:"componentDidUpdate",value:function(e,t){(this.state.isOpen&&!t.isOpen||"open"in this.props&&this.props.open&&!e.open)&&this.setMenuPositions(),this.maybeScrollItemIntoView(),t.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen)}},{key:"exposeAPI",value:function(e){var t=this;this.refs.input=e,h.forEach(function(n){return t[n]=e&&e[n]&&e[n].bind(e)})}},{key:"maybeScrollItemIntoView",value:function(){if(this.isOpen()&&null!==this.state.highlightedIndex){var e=this.refs["item-"+this.state.highlightedIndex],t=this.refs.menu;d(p(e),p(t),{onlyScrollIfNeeded:!0})}}},{key:"handleKeyDown",value:function(e){t.keyDownHandlers[e.key]?t.keyDownHandlers[e.key].call(this,e):this.isOpen()||this.setState({isOpen:!0})}},{key:"handleChange",value:function(e){this.props.onChange(e,e.target.value)}},{key:"getFilteredItems",value:function(e){var t=e.items;return e.shouldItemRender&&(t=t.filter(function(t){return e.shouldItemRender(t,e.value)})),e.sortItems&&t.sort(function(t,n){return e.sortItems(t,n,e.value)}),t}},{key:"maybeAutoCompleteText",value:function(e,t){var n=e.highlightedIndex,r=t.value,o=t.getItemValue,i=null===n?0:n,u=this.getFilteredItems(t)[i];if(""!==r&&u){if(0===o(u).toLowerCase().indexOf(r.toLowerCase()))return{highlightedIndex:i}}return{highlightedIndex:null}}},{key:"ensureHighlightedIndex",value:function(e,t){if(e.highlightedIndex>=this.getFilteredItems(t).length)return{highlightedIndex:null}}},{key:"setMenuPositions",value:function(){var e=this.refs.input,t=e.getBoundingClientRect(),r=n.window.getComputedStyle(e),o=parseInt(r.marginBottom,10)||0,i=parseInt(r.marginLeft,10)||0,u=parseInt(r.marginRight,10)||0;this.setState({menuTop:t.bottom+o,menuLeft:t.left+i,menuWidth:t.width+i+u})}},{key:"highlightItemFromMouse",value:function(e){this.setState({highlightedIndex:e})}},{key:"selectItemFromMouse",value:function(e){var t=this,n=this.props.getItemValue(e);this.setIgnoreBlur(!1),this.setState({isOpen:!1,highlightedIndex:null},function(){t.props.onSelect(n,e)})}},{key:"setIgnoreBlur",value:function(e){this._ignoreBlur=e}},{key:"renderMenu",value:function(){var e=this,t=this.getFilteredItems(this.props).map(function(t,n){var r=e.props.renderItem(t,e.state.highlightedIndex===n,{cursor:"default"});return a.cloneElement(r,{onMouseEnter:function(){return e.highlightItemFromMouse(n)},onClick:function(){return e.selectItemFromMouse(t)},ref:function(t){return e.refs["item-"+n]=t}})}),n={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth},r=this.props.renderMenu(t,this.props.value,n);return a.cloneElement(r,{ref:function(t){return e.refs.menu=t},onMouseEnter:function(){return e.setIgnoreBlur(!0)},onMouseLeave:function(){return e.setIgnoreBlur(!1)}})}},{key:"handleInputBlur",value:function(e){if(this._ignoreBlur)return this._ignoreFocus=!0,this._scrollOffset=u(),void this.refs.input.focus();this.setState({isOpen:!1,highlightedIndex:null});var t=this.props.inputProps.onBlur;t&&t(e)}},{key:"handleInputFocus",value:function(e){var t=this;if(this._ignoreFocus){this._ignoreFocus=!1;var n=this._scrollOffset,r=n.x,o=n.y;return this._scrollOffset=null,window.scrollTo(r,o),clearTimeout(this._scrollTimer),void(this._scrollTimer=setTimeout(function(){t._scrollTimer=null,window.scrollTo(r,o)},0))}this.setState({isOpen:!0});var i=this.props.inputProps.onFocus;i&&i(e)}},{key:"isInputFocused",value:function(){var e=this.refs.input;return e.ownerDocument&&e===e.ownerDocument.activeElement}},{key:"handleInputClick",value:function(){this.isInputFocused()&&!this.isOpen()&&this.setState({isOpen:!0})}},{key:"composeEventHandlers",value:function(e,t){return t?function(n){e(n),t(n)}:e}},{key:"isOpen",value:function(){return"open"in this.props?this.props.open:this.state.isOpen}},{key:"render",value:function(){this.props.debug&&this._debugStates.push({id:this._debugStates.length,state:this.state});var e=this.props.inputProps,t=this.isOpen();return a.createElement("div",s({style:s({},this.props.wrapperStyle)},this.props.wrapperProps),a.createElement("input",s({},e,{role:"combobox","aria-autocomplete":"list","aria-expanded":t,autoComplete:"off",ref:this.exposeAPI,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,onChange:this.handleChange,onKeyDown:this.composeEventHandlers(this.handleKeyDown,e.onKeyDown),onClick:this.composeEventHandlers(this.handleInputClick,e.onClick),value:this.props.value})),t&&this.renderMenu(),this.props.debug&&a.createElement("pre",{style:{marginLeft:300}},JSON.stringify(this._debugStates.slice(Math.max(0,this._debugStates.length-5),this._debugStates.length),null,2)))}}]),t}(a.Component);v.propTypes={items:f.array.isRequired,value:f.any,onChange:f.func,onSelect:f.func,shouldItemRender:f.func,sortItems:f.func,getItemValue:f.func.isRequired,renderItem:f.func.isRequired,renderMenu:f.func,menuStyle:f.object,inputProps:f.object,wrapperProps:f.object,wrapperStyle:f.object,autoHighlight:f.bool,onMenuVisibilityChange:f.func,open:f.bool,debug:f.bool},v.defaultProps={value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange:function(){},onSelect:function(){},renderMenu:function(e,t,n){return a.createElement("div",{style:s({},n,this.menuStyle),children:e})},menuStyle:{borderRadius:"3px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",background:"rgba(255, 255, 255, 0.9)",padding:"2px 0",fontSize:"90%",position:"fixed",overflow:"auto",maxHeight:"50%"},autoHighlight:!0,onMenuVisibilityChange:function(){}},v.keyDownHandlers={ArrowDown:function(e){e.preventDefault();var t=this.getFilteredItems(this.props).length;if(t){var n=this.state.highlightedIndex,r=null===n||n===t-1?0:n+1;this.setState({highlightedIndex:r,isOpen:!0})}},ArrowUp:function(e){e.preventDefault();var t=this.getFilteredItems(this.props).length;if(t){var n=this.state.highlightedIndex,r=0===n||null===n?t-1:n-1;this.setState({highlightedIndex:r,isOpen:!0})}},Enter:function(e){var t=this;if(this.isOpen())if(null==this.state.highlightedIndex)this.setState({isOpen:!1},function(){t.refs.input.select()});else{e.preventDefault();var n=this.getFilteredItems(this.props)[this.state.highlightedIndex],r=this.props.getItemValue(n);this.setState({isOpen:!1,highlightedIndex:null},function(){t.refs.input.setSelectionRange(r.length,r.length),t.props.onSelect(r,n)})}},Escape:function(){this.setIgnoreBlur(!1),this.setState({highlightedIndex:null,isOpen:!1})},Tab:function(){this.setIgnoreBlur(!1)}},t.exports=v}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"dom-scroll-into-view":2,"prop-types":11,react:"react","react-dom":"react-dom"}],2:[function(e,t,n){t.exports=e("./lib/dom-scroll-into-view")},{"./lib/dom-scroll-into-view":3}],3:[function(e,t,n){function r(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,u=n.alignWithTop,s=n.alignWithLeft;r=void 0===r||r;var l,a,f,c,p,d,h,v,y,g,m=o.isWindow(t),b=o.offset(e),w=o.outerHeight(e),I=o.outerWidth(e);m?(h=t,g=o.height(h),y=o.width(h),v={left:o.scrollLeft(h),top:o.scrollTop(h)},p={left:b.left-v.left,top:b.top-v.top},d={left:b.left+I-(v.left+y),top:b.top+w-(v.top+g)},c=v):(l=o.offset(t),a=t.clientHeight,f=t.clientWidth,c={left:t.scrollLeft,top:t.scrollTop},p={left:b.left-(l.left+(parseFloat(o.css(t,"borderLeftWidth"))||0)),top:b.top-(l.top+(parseFloat(o.css(t,"borderTopWidth"))||0))},d={left:b.left+I-(l.left+f+(parseFloat(o.css(t,"borderRightWidth"))||0)),top:b.top+w-(l.top+a+(parseFloat(o.css(t,"borderBottomWidth"))||0))}),p.top<0||d.top>0?!0===u?o.scrollTop(t,c.top+p.top):!1===u?o.scrollTop(t,c.top+d.top):p.top<0?o.scrollTop(t,c.top+p.top):o.scrollTop(t,c.top+d.top):i||(u=void 0===u||!!u,u?o.scrollTop(t,c.top+p.top):o.scrollTop(t,c.top+d.top)),r&&(p.left<0||d.left>0?!0===s?o.scrollLeft(t,c.left+p.left):!1===s?o.scrollLeft(t,c.left+d.left):p.left<0?o.scrollLeft(t,c.left+p.left):o.scrollLeft(t,c.left+d.left):i||(s=void 0===s||!!s,s?o.scrollLeft(t,c.left+p.left):o.scrollLeft(t,c.left+d.left)))}var o=e("./util");t.exports=r},{"./util":4}],4:[function(e,t,n){function r(e){var t,n,r,o=e.ownerDocument,i=o.body,u=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,r=t.top,n-=u.clientLeft||i.clientLeft||0,r-=u.clientTop||i.clientTop||0,{left:n,top:r}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[r],"number"!=typeof n&&(n=o.body[r])}return n}function i(e){return o(e)}function u(e){return o(e,!0)}function s(e){var t=r(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=i(o),t.top+=u(o),t}function l(e,t,n){var r="",o=e.ownerDocument;return(n=n||o.defaultView.getComputedStyle(e,null))&&(r=n.getPropertyValue(t)||n[t]),r}function a(e,t){var n=e[O]&&e[O][t];if(x.test(n)&&!T.test(t)){var r=e.style,o=r[k],i=e[S][k];e[S][k]=e[O][k],r[k]="fontSize"===t?"1em":n||0,n=r.pixelLeft+R,r[k]=o,e[S][k]=i}return""===n?"auto":n}function f(e,t){"static"===m(e,"position")&&(e.style.position="relative");var n,r,o=s(e),i={};for(r in t)n=parseFloat(m(e,r))||0,i[r]=n+t[r]-o[r];m(e,i)}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===w(e,"boxSizing")}function d(e,t,n){var r,o={},i=e.style;for(r in t)o[r]=i[r],i[r]=t[r];n.call(e);for(r in t)i[r]=o[r]}function h(e,t,n){var r,o,i,u=0;for(o=0;o<t.length;o++)if(r=t[o])for(i=0;i<n.length;i++){var s;s="border"===r?r+n[i]+"Width":r+n[i],u+=parseFloat(w(e,s))||0}return u}function v(e){return null!=e&&e==e.window}function y(e,t,n){if(v(e))return"width"===t?C.viewportWidth(e):C.viewportHeight(e);if(9===e.nodeType)return"width"===t?C.docWidth(e):C.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,i=w(e),u=p(e,i),s=0;(null==o||o<=0)&&(o=void 0,s=w(e,t),(null==s||Number(s)<0)&&(s=e.style[t]||0),s=parseFloat(s)||0),void 0===n&&(n=u?j:_);var l=void 0!==o||u,a=o||s;return n===_?l?a-h(e,["border","padding"],r,i):s:l?a+(n===j?0:n===E?-h(e,["border"],r,i):h(e,["margin"],r,i)):s+h(e,P.slice(n),r,i)}function g(e){var t,n=arguments;return 0!==e.offsetWidth?t=y.apply(void 0,n):d(e,F,function(){t=y.apply(void 0,n)}),t}function m(e,t,n){if("object"!=typeof t){if(void 0===n)return w(e,t);"number"==typeof n&&(n+="px"),e.style[t]=n}else for(var r in t)m(e,r,t[r])}function b(e,t){for(var n in t)e[n]=t[n];return e}var w,I=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,x=new RegExp("^("+I+")(?!px)[a-z%]+$","i"),T=/^(top|right|bottom|left)$/,O="currentStyle",S="runtimeStyle",k="left",R="px";"undefined"!=typeof window&&(w=window.getComputedStyle?l:a);var P=["margin","border","padding"],_=-1,E=2,j=1,C={};c(["Width","Height"],function(e){C["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],C["viewport"+e](n))},C["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,i=r.documentElement,u=i[n];return"CSS1Compat"===r.compatMode&&u||o&&o[n]||u}});var F={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);C["outer"+t]=function(t,n){return t&&g(t,e,n?0:j)};var n="width"===e?["Left","Right"]:["Top","Bottom"];C[e]=function(t,r){if(void 0===r)return t&&g(t,e,_);if(t){var o=w(t);return p(t)&&(r+=h(t,["padding","border"],n,o)),m(t,e,r)}}});var L=t.exports={getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return s(e);f(e,t)},isWindow:v,each:c,css:m,clone:function(e){var t={};for(var n in e)t[n]=e[n];if(e.overflow)for(n in e)t.overflow[n]=e.overflow[n];return t},mix:b,scrollLeft:function(e,t){if(v(e)){if(void 0===t)return i(e);window.scrollTo(t,u(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(v(e)){if(void 0===t)return u(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},merge:function(){for(var e={},t=0;t<arguments.length;t++)L.mix(e,arguments[t]);return e},viewportWidth:0,viewportHeight:0};b(L,C)},{}],5:[function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],6:[function(e,t,n){"use strict";function r(e,t,n,r,i,u,s,l){if(o(t),!e){var a;if(void 0===t)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,i,u,s,l],c=0;a=new Error(t.replace(/%s/g,function(){return f[c++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}}var o=function(e){};t.exports=r},{}],7:[function(e,t,n){"use strict";var r=e("./emptyFunction"),o=r;t.exports=o},{"./emptyFunction":5}],8:[function(e,t,n){"use strict";function r(e,t,n,r,o){}t.exports=r},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/invariant":6,"fbjs/lib/warning":7}],9:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("./lib/ReactPropTypesSecret");t.exports=function(){function e(e,t,n,r,u,s){s!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},{"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":5,"fbjs/lib/invariant":6}],10:[function(e,t,n){"use strict";var r=e("fbjs/lib/emptyFunction"),o=e("fbjs/lib/invariant"),i=e("fbjs/lib/warning"),u=e("./lib/ReactPropTypesSecret"),s=e("./checkPropTypes");t.exports=function(e,t){function n(e){var t=e&&(O&&e[O]||e[S]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function a(e){this.message=e,this.stack=""}function f(e){function n(n,r,i,s,l,f,c){if(s=s||k,f=f||i,c!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else;return null==r[i]?n?new a(null===r[i]?"The "+l+" `"+f+"` is marked as required in `"+s+"`, but its value is `null`.":"The "+l+" `"+f+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(r,i,s,l,f)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function c(e){function t(t,n,r,o,i,u){var s=t[n];if(w(s)!==e)return new a("Invalid "+o+" `"+i+"` of type `"+I(s)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(t)}function p(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){return new a("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l<s.length;l++){var f=e(s,l,r,o,i+"["+l+"]",u);if(f instanceof Error)return f}return null}return f(t)}function d(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var u=e.name||k;return new a("Invalid "+o+" `"+i+"` of type `"+T(t[n])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return f(t)}function h(e){function t(t,n,r,o,i){for(var u=t[n],s=0;s<e.length;s++)if(l(u,e[s]))return null;return new a("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):r.thatReturnsNull}function v(e){function t(t,n,r,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],l=w(s);if("object"!==l)return new a("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+r+"`, expected an object.");for(var f in s)if(s.hasOwnProperty(f)){var c=e(s,f,r,o,i+"."+f,u);if(c instanceof Error)return c}return null}return f(t)}function y(e){function t(t,n,r,o,i){for(var s=0;s<e.length;s++){if(null==(0,e[s])(t,n,r,o,i,u))return null}return new a("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(e))return r.thatReturnsNull;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",x(o),n),r.thatReturnsNull}return f(t)}function g(e){function t(t,n,r,o,i){var s=t[n],l=w(s);if("object"!==l)return new a("Invalid "+o+" `"+i+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");for(var f in e){var c=e[f];if(c){var p=c(s,f,r,o,i+"."+f,u);if(p)return p}}return null}return f(t)}function m(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(m);if(null===t||e(t))return!0;var r=n(t);if(!r)return!1;var o,i=r.call(t);if(r!==t.entries){for(;!(o=i.next()).done;)if(!m(o.value))return!1}else for(;!(o=i.next()).done;){var u=o.value;if(u&&!m(u[1]))return!1}return!0;default:return!1}}function b(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function w(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":b(t,e)?"symbol":t}function I(e){if(void 0===e||null===e)return""+e;var t=w(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function x(e){var t=I(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function T(e){return e.constructor&&e.constructor.name?e.constructor.name:k}var O="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",k="<<anonymous>>",R={array:c("array"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:p,element:function(){function t(t,n,r,o,i){var u=t[n];if(!e(u)){return new a("Invalid "+o+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(t)}(),instanceOf:d,node:function(){function e(e,t,n,r,o){return m(e[t])?null:new a("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return f(e)}(),objectOf:v,oneOf:h,oneOfType:y,shape:g};return a.prototype=Error.prototype,R.checkPropTypes=s,R.PropTypes=R,R}},{"./checkPropTypes":8,"./lib/ReactPropTypesSecret":12,"fbjs/lib/emptyFunction":5,"fbjs/lib/invariant":6,"fbjs/lib/warning":7}],11:[function(e,t,n){t.exports=e("./factoryWithThrowingShims")()},{"./factoryWithThrowingShims":9,"./factoryWithTypeCheckers":10}],12:[function(e,t,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[1])(1)}(function(n){if("react"===n)return e;if("react-dom"===n)return t;if("undefined"!=typeof require)return require(n);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r})}); | ||
//# sourceMappingURL=react-autocomplete.min.js.map |
{ | ||
"name": "react-autocomplete", | ||
"version": "1.5.8", | ||
"version": "1.5.9", | ||
"description": "Accessible, extensible, Autocomplete for React.js", | ||
@@ -5,0 +5,0 @@ "main": "./build/lib/Autocomplete.js", |
@@ -42,4 +42,4 @@ # React Autocomplete [![Travis build status](https://travis-ci.org/reactjs/react-autocomplete.svg?branch=master)](https://travis-ci.org/reactjs/react-autocomplete/) | ||
* Development: [https://unpkg.com/react-autocomplete@1.5.7/dist/react-autocomplete.js](https://unpkg.com/react-autocomplete@1.5.7/dist/react-autocomplete.js) | ||
* Production: [https://unpkg.com/react-autocomplete@1.5.7/dist/react-autocomplete.min.js](https://unpkg.com/react-autocomplete@1.5.7/dist/react-autocomplete.min.js) | ||
* Development: [https://unpkg.com/react-autocomplete@1.5.8/dist/react-autocomplete.js](https://unpkg.com/react-autocomplete@1.5.8/dist/react-autocomplete.js) | ||
* Production: [https://unpkg.com/react-autocomplete@1.5.8/dist/react-autocomplete.min.js](https://unpkg.com/react-autocomplete@1.5.8/dist/react-autocomplete.min.js) | ||
@@ -46,0 +46,0 @@ ## API |
Sorry, the diff of this file is too big to display
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
305201
2446