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

react-autocomplete

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-autocomplete - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

4

build/lib/Autocomplete.js

@@ -191,3 +191,5 @@ 'use strict';

var menuNode = this.refs.menu;
scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });
if (itemNode) {
scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });
}
}

@@ -194,0 +196,0 @@ },

@@ -7,2 +7,7 @@ # CHANGELOG

## [1.4.2] - 2017-04-02
### Fixed
- Workaround for "Cannot read property 'ownerDocument' of null"
## [1.4.1] - 2017-03-16

@@ -147,3 +152,4 @@ ### Fixed

[Unreleased]: https://github.com/reactjs/react-autocomplete/compare/v1.4.1...HEAD
[Unreleased]: https://github.com/reactjs/react-autocomplete/compare/v1.4.2...HEAD
[1.4.2]: https://github.com/reactjs/react-autocomplete/compare/v1.4.1...v1.4.2
[1.4.1]: https://github.com/reactjs/react-autocomplete/compare/v1.4.0...v1.4.1

@@ -150,0 +156,0 @@ [1.4.0]: https://github.com/reactjs/react-autocomplete/compare/v1.3.1...v1.4.0

@@ -204,3 +204,5 @@ (function (g, factory) {

var menuNode = this.refs.menu;
scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });
if (itemNode) {
scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), { onlyScrollIfNeeded: true });
}
}

@@ -207,0 +209,0 @@ },

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):t.ReactAutocomplete=e(t.React,t.ReactDOM)}(this,function(t,e){return function(t){return function e(n,o,i){function r(l,u){if(!o[l]){if(!n[l]){var p="function"==typeof t&&t;if(!u&&p)return p(l,!0);if(s)return s(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var h=o[l]={exports:{}};n[l][0].call(h.exports,function(t){var e=n[l][1][t];return r(e?e:t)},h,h.exports,e,n,o,i)}return o[l].exports}for(var s="function"==typeof t&&t,l=0;l<i.length;l++)r(i[l]);return r}({1:[function(t,e,n){(function(n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=t("react"),r=i.PropTypes,s=t("react-dom"),l=s.findDOMNode,u=t("dom-scroll-into-view"),p=[],f=i.createClass({displayName:"Autocomplete",propTypes:{items:r.array.isRequired,value:r.any,onChange:r.func,onSelect:r.func,shouldItemRender:r.func,sortItems:r.func,getItemValue:r.func.isRequired,renderItem:r.func.isRequired,renderMenu:r.func,menuStyle:r.object,inputProps:r.object,wrapperProps:r.object,wrapperStyle:r.object,autoHighlight:r.bool,onMenuVisibilityChange:r.func,open:r.bool,debug:r.bool},getDefaultProps:function(){return{value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange:function(){},onSelect:function(){},renderMenu:function(t,e,n){return i.createElement("div",{style:o({},n,this.menuStyle),children:t})},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(){}}},getInitialState:function(){return{isOpen:!1,highlightedIndex:null}},componentWillMount:function(){this._ignoreBlur=!1,this._performAutoCompleteOnUpdate=!1,this._performAutoCompleteOnKeyUp=!1},componentWillReceiveProps:function(t){this._performAutoCompleteOnUpdate=!0,(this.props.items!==t.items||this.state.highlightedIndex>=t.items.length)&&this.setState({highlightedIndex:null})},componentDidUpdate:function(t,e){this.state.isOpen===!0&&e.isOpen===!1&&this.setMenuPositions(),this.state.isOpen&&this._performAutoCompleteOnUpdate&&(this._performAutoCompleteOnUpdate=!1,this.maybeAutoCompleteText()),this.maybeScrollItemIntoView(),e.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen)},maybeScrollItemIntoView:function(){if(this.state.isOpen===!0&&null!==this.state.highlightedIndex){var t=this.refs["item-"+this.state.highlightedIndex],e=this.refs.menu;u(l(t),l(e),{onlyScrollIfNeeded:!0})}},handleKeyDown:function(t){this.keyDownHandlers[t.key]?this.keyDownHandlers[t.key].call(this,t):this.setState({highlightedIndex:null,isOpen:!0})},handleChange:function(t){this._performAutoCompleteOnKeyUp=!0,this.props.onChange(t,t.target.value)},handleKeyUp:function(){this._performAutoCompleteOnKeyUp&&(this._performAutoCompleteOnKeyUp=!1,this.maybeAutoCompleteText())},keyDownHandlers:{ArrowDown:function(t){t.preventDefault();var e=this.getFilteredItems().length;if(e){var n=this.state.highlightedIndex,o=null===n||n===e-1?0:n+1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:o,isOpen:!0})}},ArrowUp:function(t){t.preventDefault();var e=this.getFilteredItems().length;if(e){var n=this.state.highlightedIndex,o=0===n||null===n?e-1:n-1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:o,isOpen:!0})}},Enter:function(t){var e=this;if(this.state.isOpen!==!1)if(null==this.state.highlightedIndex)this.setState({isOpen:!1},function(){e.refs.input.select()});else{t.preventDefault();var n=this.getFilteredItems()[this.state.highlightedIndex],o=this.props.getItemValue(n);this.setState({isOpen:!1,highlightedIndex:null},function(){e.refs.input.setSelectionRange(o.length,o.length),e.props.onSelect(o,n)})}},Escape:function(t){this.setState({highlightedIndex:null,isOpen:!1})}},getFilteredItems:function(){var t=this,e=this.props.items;return this.props.shouldItemRender&&(e=e.filter(function(e){return t.props.shouldItemRender(e,t.props.value)})),this.props.sortItems&&e.sort(function(e,n){return t.props.sortItems(e,n,t.props.value)}),e},maybeAutoCompleteText:function(){if(this.props.autoHighlight&&""!==this.props.value){var t=this.state.highlightedIndex,e=this.getFilteredItems();if(0!==e.length){var n=null!==t?e[t]:e[0],o=this.props.getItemValue(n),i=0===o.toLowerCase().indexOf(this.props.value.toLowerCase());i&&null===t&&this.setState({highlightedIndex:0})}}},setMenuPositions:function(){var t=this.refs.input,e=t.getBoundingClientRect(),o=n.window.getComputedStyle(t),i=parseInt(o.marginBottom,10)||0,r=parseInt(o.marginLeft,10)||0,s=parseInt(o.marginRight,10)||0;this.setState({menuTop:e.bottom+i,menuLeft:e.left+r,menuWidth:e.width+r+s})},highlightItemFromMouse:function(t){this.setState({highlightedIndex:t})},selectItemFromMouse:function(t){var e=this,n=this.props.getItemValue(t);this.setState({isOpen:!1,highlightedIndex:null},function(){e.props.onSelect(n,t),e.refs.input.focus()})},setIgnoreBlur:function(t){this._ignoreBlur=t},renderMenu:function(){var t=this,e=this.getFilteredItems().map(function(e,n){var o=t.props.renderItem(e,t.state.highlightedIndex===n,{cursor:"default"});return i.cloneElement(o,{onMouseDown:function(){return t.setIgnoreBlur(!0)},onMouseEnter:function(){return t.highlightItemFromMouse(n)},onClick:function(){return t.selectItemFromMouse(e)},ref:"item-"+n})}),n={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth},o=this.props.renderMenu(e,this.props.value,n);return i.cloneElement(o,{ref:"menu"})},handleInputBlur:function(){this._ignoreBlur||this.setState({isOpen:!1,highlightedIndex:null})},handleInputFocus:function(){return this._ignoreBlur?void this.setIgnoreBlur(!1):(this._ignoreClick=!0,void this.setState({isOpen:!0}))},isInputFocused:function(){var t=this.refs.input;return t.ownerDocument&&t===t.ownerDocument.activeElement},handleInputClick:function(){this.isInputFocused()&&this.state.isOpen===!1?this.setState({isOpen:!0}):null===this.state.highlightedIndex||this._ignoreClick||this.selectItemFromMouse(this.getFilteredItems()[this.state.highlightedIndex]),this._ignoreClick=!1},composeEventHandlers:function(t,e){return e?function(n){t(n),e(n)}:t},render:function(){this.props.debug&&p.push({id:p.length,state:this.state});var t=this.props.inputProps,e="open"in this.props?this.props.open:this.state.isOpen;return i.createElement("div",o({style:o({},this.props.wrapperStyle)},this.props.wrapperProps),i.createElement("input",o({},t,{role:"combobox","aria-autocomplete":"list","aria-expanded":e,autoComplete:"off",ref:"input",onFocus:this.composeEventHandlers(this.handleInputFocus,t.onFocus),onBlur:this.composeEventHandlers(this.handleInputBlur,t.onBlur),onChange:this.handleChange,onKeyDown:this.composeEventHandlers(this.handleKeyDown,t.onKeyDown),onKeyUp:this.composeEventHandlers(this.handleKeyUp,t.onKeyUp),onClick:this.composeEventHandlers(this.handleInputClick,t.onClick),value:this.props.value})),e&&this.renderMenu(),this.props.debug&&i.createElement("pre",{style:{marginLeft:300}},JSON.stringify(p.slice(p.length-5,p.length),null,2)))}});e.exports=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"dom-scroll-into-view":2,react:"react","react-dom":"react-dom"}],2:[function(t,e,n){e.exports=t("./lib/dom-scroll-into-view")},{"./lib/dom-scroll-into-view":3}],3:[function(t,e,n){function o(t,e,n){n=n||{},9===e.nodeType&&(e=i.getWindow(e));var o=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,s=n.alignWithTop,l=n.alignWithLeft;o=void 0===o||o;var u,p,f,h,a,d,c,m,g,v,y=i.isWindow(e),w=i.offset(t),I=i.outerHeight(t),b=i.outerWidth(t);y?(c=e,v=i.height(c),g=i.width(c),m={left:i.scrollLeft(c),top:i.scrollTop(c)},a={left:w.left-m.left,top:w.top-m.top},d={left:w.left+b-(m.left+g),top:w.top+I-(m.top+v)},h=m):(u=i.offset(e),p=e.clientHeight,f=e.clientWidth,h={left:e.scrollLeft,top:e.scrollTop},a={left:w.left-(u.left+(parseFloat(i.css(e,"borderLeftWidth"))||0)),top:w.top-(u.top+(parseFloat(i.css(e,"borderTopWidth"))||0))},d={left:w.left+b-(u.left+f+(parseFloat(i.css(e,"borderRightWidth"))||0)),top:w.top+I-(u.top+p+(parseFloat(i.css(e,"borderBottomWidth"))||0))}),a.top<0||d.top>0?s===!0?i.scrollTop(e,h.top+a.top):s===!1?i.scrollTop(e,h.top+d.top):a.top<0?i.scrollTop(e,h.top+a.top):i.scrollTop(e,h.top+d.top):r||(s=void 0===s||!!s,s?i.scrollTop(e,h.top+a.top):i.scrollTop(e,h.top+d.top)),o&&(a.left<0||d.left>0?l===!0?i.scrollLeft(e,h.left+a.left):l===!1?i.scrollLeft(e,h.left+d.left):a.left<0?i.scrollLeft(e,h.left+a.left):i.scrollLeft(e,h.left+d.left):r||(l=void 0===l||!!l,l?i.scrollLeft(e,h.left+a.left):i.scrollLeft(e,h.left+d.left)))}var i=t("./util");e.exports=o},{"./util":4}],4:[function(t,e,n){function o(t){var e,n,o,i=t.ownerDocument,r=i.body,s=i&&i.documentElement;return e=t.getBoundingClientRect(),n=e.left,o=e.top,n-=s.clientLeft||r.clientLeft||0,o-=s.clientTop||r.clientTop||0,{left:n,top:o}}function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var i=t.document;n=i.documentElement[o],"number"!=typeof n&&(n=i.body[o])}return n}function r(t){return i(t)}function s(t){return i(t,!0)}function l(t){var e=o(t),n=t.ownerDocument,i=n.defaultView||n.parentWindow;return e.left+=r(i),e.top+=s(i),e}function u(t,e,n){var o="",i=t.ownerDocument;return(n=n||i.defaultView.getComputedStyle(t,null))&&(o=n.getPropertyValue(e)||n[e]),o}function p(t,e){var n=t[C]&&t[C][e];if(x.test(n)&&!O.test(e)){var o=t.style,i=o[T],r=t[S][T];t[S][T]=t[C][T],o[T]="fontSize"===e?"1em":n||0,n=o.pixelLeft+F,o[T]=i,t[S][T]=r}return""===n?"auto":n}function f(t,e){"static"===y(t,"position")&&(t.style.position="relative");var n,o,i=l(t),r={};for(o in e)n=parseFloat(y(t,o))||0,r[o]=n+e[o]-i[o];y(t,r)}function h(t,e){for(var n=0;n<t.length;n++)e(t[n])}function a(t){return"border-box"===I(t,"boxSizing")}function d(t,e,n){var o,i={},r=t.style;for(o in e)i[o]=r[o],r[o]=e[o];n.call(t);for(o in e)r[o]=i[o]}function c(t,e,n){var o,i,r,s=0;for(i=0;i<e.length;i++)if(o=e[i])for(r=0;r<n.length;r++){var l;l="border"===o?o+n[r]+"Width":o+n[r],s+=parseFloat(I(t,l))||0}return s}function m(t){return null!=t&&t==t.window}function g(t,e,n){if(m(t))return"width"===e?H.viewportWidth(t):H.viewportHeight(t);if(9===t.nodeType)return"width"===e?H.docWidth(t):H.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],i="width"===e?t.offsetWidth:t.offsetHeight,r=I(t),s=a(t,r),l=0;(null==i||i<=0)&&(i=void 0,l=I(t,e),(null==l||Number(l)<0)&&(l=t.style[e]||0),l=parseFloat(l)||0),void 0===n&&(n=s?W:D);var u=void 0!==i||s,p=i||l;return n===D?u?p-c(t,["border","padding"],o,r):l:u?p+(n===W?0:n===E?-c(t,["border"],o,r):c(t,["margin"],o,r)):l+c(t,L.slice(n),o,r)}function v(t){var e,n=arguments;return 0!==t.offsetWidth?e=g.apply(void 0,n):d(t,U,function(){e=g.apply(void 0,n)}),e}function y(t,e,n){if("object"!=typeof e)return"undefined"==typeof n?I(t,e):("number"==typeof n&&(n+="px"),void(t.style[e]=n));for(var o in e)y(t,o,e[o])}function w(t,e){for(var n in e)t[n]=e[n];return t}var I,b=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,x=new RegExp("^("+b+")(?!px)[a-z%]+$","i"),O=/^(top|right|bottom|left)$/,C="currentStyle",S="runtimeStyle",T="left",F="px";"undefined"!=typeof window&&(I=window.getComputedStyle?u:p);var L=["margin","border","padding"],D=-1,E=2,W=1,M=0,H={};h(["Width","Height"],function(t){H["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],H["viewport"+t](n))},H["viewport"+t]=function(e){var n="client"+t,o=e.document,i=o.body,r=o.documentElement,s=r[n];return"CSS1Compat"===o.compatMode&&s||i&&i[n]||s}});var U={position:"absolute",visibility:"hidden",display:"block"};h(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);H["outer"+e]=function(e,n){return e&&v(e,t,n?M:W)};var n="width"===t?["Left","Right"]:["Top","Bottom"];H[t]=function(e,o){if(void 0===o)return e&&v(e,t,D);if(e){var i=I(e),r=a(e);return r&&(o+=c(e,["padding","border"],n,i)),y(e,t,o)}}});var _=e.exports={getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){return"undefined"==typeof e?l(t):void f(t,e)},isWindow:m,each:h,css:y,clone:function(t){var e={};for(var n in t)e[n]=t[n];var o=t.overflow;if(o)for(n in t)e.overflow[n]=t.overflow[n];return e},mix:w,scrollLeft:function(t,e){if(m(t)){if(void 0===e)return r(t);window.scrollTo(e,s(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(m(t)){if(void 0===e)return s(t);window.scrollTo(r(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},merge:function(){for(var t={},e=0;e<arguments.length;e++)_.mix(t,arguments[e]);return t},viewportWidth:0,viewportHeight:0};w(_,H)},{}]},{},[1])(1)}(function(n){if("react"===n)return t;if("react-dom"===n)return e;if("undefined"!=typeof require)return require(n);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):t.ReactAutocomplete=e(t.React,t.ReactDOM)}(this,function(t,e){return function(t){return function e(n,o,i){function r(l,u){if(!o[l]){if(!n[l]){var p="function"==typeof t&&t;if(!u&&p)return p(l,!0);if(s)return s(l,!0);var f=new Error("Cannot find module '"+l+"'");throw f.code="MODULE_NOT_FOUND",f}var h=o[l]={exports:{}};n[l][0].call(h.exports,function(t){var e=n[l][1][t];return r(e?e:t)},h,h.exports,e,n,o,i)}return o[l].exports}for(var s="function"==typeof t&&t,l=0;l<i.length;l++)r(i[l]);return r}({1:[function(t,e,n){(function(n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=t("react"),r=i.PropTypes,s=t("react-dom"),l=s.findDOMNode,u=t("dom-scroll-into-view"),p=[],f=i.createClass({displayName:"Autocomplete",propTypes:{items:r.array.isRequired,value:r.any,onChange:r.func,onSelect:r.func,shouldItemRender:r.func,sortItems:r.func,getItemValue:r.func.isRequired,renderItem:r.func.isRequired,renderMenu:r.func,menuStyle:r.object,inputProps:r.object,wrapperProps:r.object,wrapperStyle:r.object,autoHighlight:r.bool,onMenuVisibilityChange:r.func,open:r.bool,debug:r.bool},getDefaultProps:function(){return{value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange:function(){},onSelect:function(){},renderMenu:function(t,e,n){return i.createElement("div",{style:o({},n,this.menuStyle),children:t})},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(){}}},getInitialState:function(){return{isOpen:!1,highlightedIndex:null}},componentWillMount:function(){this._ignoreBlur=!1,this._performAutoCompleteOnUpdate=!1,this._performAutoCompleteOnKeyUp=!1},componentWillReceiveProps:function(t){this._performAutoCompleteOnUpdate=!0,(this.props.items!==t.items||this.state.highlightedIndex>=t.items.length)&&this.setState({highlightedIndex:null})},componentDidUpdate:function(t,e){this.state.isOpen===!0&&e.isOpen===!1&&this.setMenuPositions(),this.state.isOpen&&this._performAutoCompleteOnUpdate&&(this._performAutoCompleteOnUpdate=!1,this.maybeAutoCompleteText()),this.maybeScrollItemIntoView(),e.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen)},maybeScrollItemIntoView:function(){if(this.state.isOpen===!0&&null!==this.state.highlightedIndex){var t=this.refs["item-"+this.state.highlightedIndex],e=this.refs.menu;t&&u(l(t),l(e),{onlyScrollIfNeeded:!0})}},handleKeyDown:function(t){this.keyDownHandlers[t.key]?this.keyDownHandlers[t.key].call(this,t):this.setState({highlightedIndex:null,isOpen:!0})},handleChange:function(t){this._performAutoCompleteOnKeyUp=!0,this.props.onChange(t,t.target.value)},handleKeyUp:function(){this._performAutoCompleteOnKeyUp&&(this._performAutoCompleteOnKeyUp=!1,this.maybeAutoCompleteText())},keyDownHandlers:{ArrowDown:function(t){t.preventDefault();var e=this.getFilteredItems().length;if(e){var n=this.state.highlightedIndex,o=null===n||n===e-1?0:n+1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:o,isOpen:!0})}},ArrowUp:function(t){t.preventDefault();var e=this.getFilteredItems().length;if(e){var n=this.state.highlightedIndex,o=0===n||null===n?e-1:n-1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:o,isOpen:!0})}},Enter:function(t){var e=this;if(this.state.isOpen!==!1)if(null==this.state.highlightedIndex)this.setState({isOpen:!1},function(){e.refs.input.select()});else{t.preventDefault();var n=this.getFilteredItems()[this.state.highlightedIndex],o=this.props.getItemValue(n);this.setState({isOpen:!1,highlightedIndex:null},function(){e.refs.input.setSelectionRange(o.length,o.length),e.props.onSelect(o,n)})}},Escape:function(t){this.setState({highlightedIndex:null,isOpen:!1})}},getFilteredItems:function(){var t=this,e=this.props.items;return this.props.shouldItemRender&&(e=e.filter(function(e){return t.props.shouldItemRender(e,t.props.value)})),this.props.sortItems&&e.sort(function(e,n){return t.props.sortItems(e,n,t.props.value)}),e},maybeAutoCompleteText:function(){if(this.props.autoHighlight&&""!==this.props.value){var t=this.state.highlightedIndex,e=this.getFilteredItems();if(0!==e.length){var n=null!==t?e[t]:e[0],o=this.props.getItemValue(n),i=0===o.toLowerCase().indexOf(this.props.value.toLowerCase());i&&null===t&&this.setState({highlightedIndex:0})}}},setMenuPositions:function(){var t=this.refs.input,e=t.getBoundingClientRect(),o=n.window.getComputedStyle(t),i=parseInt(o.marginBottom,10)||0,r=parseInt(o.marginLeft,10)||0,s=parseInt(o.marginRight,10)||0;this.setState({menuTop:e.bottom+i,menuLeft:e.left+r,menuWidth:e.width+r+s})},highlightItemFromMouse:function(t){this.setState({highlightedIndex:t})},selectItemFromMouse:function(t){var e=this,n=this.props.getItemValue(t);this.setState({isOpen:!1,highlightedIndex:null},function(){e.props.onSelect(n,t),e.refs.input.focus()})},setIgnoreBlur:function(t){this._ignoreBlur=t},renderMenu:function(){var t=this,e=this.getFilteredItems().map(function(e,n){var o=t.props.renderItem(e,t.state.highlightedIndex===n,{cursor:"default"});return i.cloneElement(o,{onMouseDown:function(){return t.setIgnoreBlur(!0)},onMouseEnter:function(){return t.highlightItemFromMouse(n)},onClick:function(){return t.selectItemFromMouse(e)},ref:"item-"+n})}),n={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth},o=this.props.renderMenu(e,this.props.value,n);return i.cloneElement(o,{ref:"menu"})},handleInputBlur:function(){this._ignoreBlur||this.setState({isOpen:!1,highlightedIndex:null})},handleInputFocus:function(){return this._ignoreBlur?void this.setIgnoreBlur(!1):(this._ignoreClick=!0,void this.setState({isOpen:!0}))},isInputFocused:function(){var t=this.refs.input;return t.ownerDocument&&t===t.ownerDocument.activeElement},handleInputClick:function(){this.isInputFocused()&&this.state.isOpen===!1?this.setState({isOpen:!0}):null===this.state.highlightedIndex||this._ignoreClick||this.selectItemFromMouse(this.getFilteredItems()[this.state.highlightedIndex]),this._ignoreClick=!1},composeEventHandlers:function(t,e){return e?function(n){t(n),e(n)}:t},render:function(){this.props.debug&&p.push({id:p.length,state:this.state});var t=this.props.inputProps,e="open"in this.props?this.props.open:this.state.isOpen;return i.createElement("div",o({style:o({},this.props.wrapperStyle)},this.props.wrapperProps),i.createElement("input",o({},t,{role:"combobox","aria-autocomplete":"list","aria-expanded":e,autoComplete:"off",ref:"input",onFocus:this.composeEventHandlers(this.handleInputFocus,t.onFocus),onBlur:this.composeEventHandlers(this.handleInputBlur,t.onBlur),onChange:this.handleChange,onKeyDown:this.composeEventHandlers(this.handleKeyDown,t.onKeyDown),onKeyUp:this.composeEventHandlers(this.handleKeyUp,t.onKeyUp),onClick:this.composeEventHandlers(this.handleInputClick,t.onClick),value:this.props.value})),e&&this.renderMenu(),this.props.debug&&i.createElement("pre",{style:{marginLeft:300}},JSON.stringify(p.slice(p.length-5,p.length),null,2)))}});e.exports=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"dom-scroll-into-view":2,react:"react","react-dom":"react-dom"}],2:[function(t,e,n){e.exports=t("./lib/dom-scroll-into-view")},{"./lib/dom-scroll-into-view":3}],3:[function(t,e,n){function o(t,e,n){n=n||{},9===e.nodeType&&(e=i.getWindow(e));var o=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,s=n.alignWithTop,l=n.alignWithLeft;o=void 0===o||o;var u,p,f,h,a,d,c,m,g,v,y=i.isWindow(e),w=i.offset(t),I=i.outerHeight(t),b=i.outerWidth(t);y?(c=e,v=i.height(c),g=i.width(c),m={left:i.scrollLeft(c),top:i.scrollTop(c)},a={left:w.left-m.left,top:w.top-m.top},d={left:w.left+b-(m.left+g),top:w.top+I-(m.top+v)},h=m):(u=i.offset(e),p=e.clientHeight,f=e.clientWidth,h={left:e.scrollLeft,top:e.scrollTop},a={left:w.left-(u.left+(parseFloat(i.css(e,"borderLeftWidth"))||0)),top:w.top-(u.top+(parseFloat(i.css(e,"borderTopWidth"))||0))},d={left:w.left+b-(u.left+f+(parseFloat(i.css(e,"borderRightWidth"))||0)),top:w.top+I-(u.top+p+(parseFloat(i.css(e,"borderBottomWidth"))||0))}),a.top<0||d.top>0?s===!0?i.scrollTop(e,h.top+a.top):s===!1?i.scrollTop(e,h.top+d.top):a.top<0?i.scrollTop(e,h.top+a.top):i.scrollTop(e,h.top+d.top):r||(s=void 0===s||!!s,s?i.scrollTop(e,h.top+a.top):i.scrollTop(e,h.top+d.top)),o&&(a.left<0||d.left>0?l===!0?i.scrollLeft(e,h.left+a.left):l===!1?i.scrollLeft(e,h.left+d.left):a.left<0?i.scrollLeft(e,h.left+a.left):i.scrollLeft(e,h.left+d.left):r||(l=void 0===l||!!l,l?i.scrollLeft(e,h.left+a.left):i.scrollLeft(e,h.left+d.left)))}var i=t("./util");e.exports=o},{"./util":4}],4:[function(t,e,n){function o(t){var e,n,o,i=t.ownerDocument,r=i.body,s=i&&i.documentElement;return e=t.getBoundingClientRect(),n=e.left,o=e.top,n-=s.clientLeft||r.clientLeft||0,o-=s.clientTop||r.clientTop||0,{left:n,top:o}}function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var i=t.document;n=i.documentElement[o],"number"!=typeof n&&(n=i.body[o])}return n}function r(t){return i(t)}function s(t){return i(t,!0)}function l(t){var e=o(t),n=t.ownerDocument,i=n.defaultView||n.parentWindow;return e.left+=r(i),e.top+=s(i),e}function u(t,e,n){var o="",i=t.ownerDocument;return(n=n||i.defaultView.getComputedStyle(t,null))&&(o=n.getPropertyValue(e)||n[e]),o}function p(t,e){var n=t[C]&&t[C][e];if(x.test(n)&&!O.test(e)){var o=t.style,i=o[T],r=t[S][T];t[S][T]=t[C][T],o[T]="fontSize"===e?"1em":n||0,n=o.pixelLeft+F,o[T]=i,t[S][T]=r}return""===n?"auto":n}function f(t,e){"static"===y(t,"position")&&(t.style.position="relative");var n,o,i=l(t),r={};for(o in e)n=parseFloat(y(t,o))||0,r[o]=n+e[o]-i[o];y(t,r)}function h(t,e){for(var n=0;n<t.length;n++)e(t[n])}function a(t){return"border-box"===I(t,"boxSizing")}function d(t,e,n){var o,i={},r=t.style;for(o in e)i[o]=r[o],r[o]=e[o];n.call(t);for(o in e)r[o]=i[o]}function c(t,e,n){var o,i,r,s=0;for(i=0;i<e.length;i++)if(o=e[i])for(r=0;r<n.length;r++){var l;l="border"===o?o+n[r]+"Width":o+n[r],s+=parseFloat(I(t,l))||0}return s}function m(t){return null!=t&&t==t.window}function g(t,e,n){if(m(t))return"width"===e?H.viewportWidth(t):H.viewportHeight(t);if(9===t.nodeType)return"width"===e?H.docWidth(t):H.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],i="width"===e?t.offsetWidth:t.offsetHeight,r=I(t),s=a(t,r),l=0;(null==i||i<=0)&&(i=void 0,l=I(t,e),(null==l||Number(l)<0)&&(l=t.style[e]||0),l=parseFloat(l)||0),void 0===n&&(n=s?W:D);var u=void 0!==i||s,p=i||l;return n===D?u?p-c(t,["border","padding"],o,r):l:u?p+(n===W?0:n===E?-c(t,["border"],o,r):c(t,["margin"],o,r)):l+c(t,L.slice(n),o,r)}function v(t){var e,n=arguments;return 0!==t.offsetWidth?e=g.apply(void 0,n):d(t,U,function(){e=g.apply(void 0,n)}),e}function y(t,e,n){if("object"!=typeof e)return"undefined"==typeof n?I(t,e):("number"==typeof n&&(n+="px"),void(t.style[e]=n));for(var o in e)y(t,o,e[o])}function w(t,e){for(var n in e)t[n]=e[n];return t}var I,b=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,x=new RegExp("^("+b+")(?!px)[a-z%]+$","i"),O=/^(top|right|bottom|left)$/,C="currentStyle",S="runtimeStyle",T="left",F="px";"undefined"!=typeof window&&(I=window.getComputedStyle?u:p);var L=["margin","border","padding"],D=-1,E=2,W=1,M=0,H={};h(["Width","Height"],function(t){H["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],H["viewport"+t](n))},H["viewport"+t]=function(e){var n="client"+t,o=e.document,i=o.body,r=o.documentElement,s=r[n];return"CSS1Compat"===o.compatMode&&s||i&&i[n]||s}});var U={position:"absolute",visibility:"hidden",display:"block"};h(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);H["outer"+e]=function(e,n){return e&&v(e,t,n?M:W)};var n="width"===t?["Left","Right"]:["Top","Bottom"];H[t]=function(e,o){if(void 0===o)return e&&v(e,t,D);if(e){var i=I(e),r=a(e);return r&&(o+=c(e,["padding","border"],n,i)),y(e,t,o)}}});var _=e.exports={getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){return"undefined"==typeof e?l(t):void f(t,e)},isWindow:m,each:h,css:y,clone:function(t){var e={};for(var n in t)e[n]=t[n];var o=t.overflow;if(o)for(n in t)e.overflow[n]=t.overflow[n];return e},mix:w,scrollLeft:function(t,e){if(m(t)){if(void 0===e)return r(t);window.scrollTo(e,s(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(m(t)){if(void 0===e)return s(t);window.scrollTo(r(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},merge:function(){for(var t={},e=0;e<arguments.length;e++)_.mix(t,arguments[e]);return t},viewportWidth:0,viewportHeight:0};w(_,H)},{}]},{},[1])(1)}(function(n){if("react"===n)return t;if("react-dom"===n)return e;if("undefined"!=typeof require)return require(n);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o})});
//# sourceMappingURL=react-autocomplete.min.js.map
{
"name": "react-autocomplete",
"version": "1.4.1",
"version": "1.4.2",
"description": "Accessible, extensible, Autocomplete for React.js",

@@ -5,0 +5,0 @@ "main": "./build/lib/Autocomplete.js",

@@ -23,4 +23,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.4.0/dist/react-autocomplete.js](https://unpkg.com/react-autocomplete@1.4.0/dist/react-autocomplete.js)
* Production: [https://unpkg.com/react-autocomplete@1.4.0/dist/react-autocomplete.min.js](https://unpkg.com/react-autocomplete@1.4.0/dist/react-autocomplete.min.js)
* Development: [https://unpkg.com/react-autocomplete@1.4.1/dist/react-autocomplete.js](https://unpkg.com/react-autocomplete@1.4.1/dist/react-autocomplete.js)
* Production: [https://unpkg.com/react-autocomplete@1.4.1/dist/react-autocomplete.min.js](https://unpkg.com/react-autocomplete@1.4.1/dist/react-autocomplete.min.js)

@@ -27,0 +27,0 @@ ## API

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc