react-autowhatever
Advanced tools
Comparing version 10.1.0 to 10.1.1
@@ -365,3 +365,2 @@ 'use strict'; | ||
'aria-expanded': isOpen, | ||
'aria-haspopup': isOpen, | ||
'aria-activedescendant': ariaActivedescendant | ||
@@ -368,0 +367,0 @@ }, theme('react-autowhatever-' + id + '-input', 'input', isOpen && 'inputOpen', isInputFocused && 'inputFocused'), this.props.inputProps, { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.Autowhatever=t(require("React")):e.Autowhatever=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1).default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var 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}}(),c=n(2),f=r(c),d=n(3),p=r(d),h=n(8),m=r(h),y=n(9),v=r(y),g=n(11),I=r(g),b=n(13),w=r(b),_={},x=function(e){return f.default.createElement("input",e)},O=function(e){var t=e.containerProps,n=e.children;return f.default.createElement("div",t,n)},j={container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"},P=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){if(null===t)return null;var r=n.props.id,o=null===e?"":"section-"+e;return"react-autowhatever-"+r+"-"+o+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,r=t.inputProps,o=t.highlightedSectionIndex,i=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var u="ArrowDown"===e.key?"next":"prev",a=n.sectionIterator[u]([o,i]),l=s(a,2),c=l[0],f=l[1];r.onKeyDown(e,{newHighlightedSectionIndex:c,newHighlightedItemIndex:f});break;default:r.onKeyDown(e,{highlightedSectionIndex:o,highlightedItemIndex:i})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map(function(t){return e.getSectionItems(t)}),this.sectionsLengths=this.sectionsItems.map(function(e){return e.length}),this.allSectionsAreEmpty=this.sectionsLengths.every(function(e){return 0===e}))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,m.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,v.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,r=n.id,o=n.items,i=n.renderItem,u=n.renderItemData,a=n.renderSectionTitle,s=n.highlightedSectionIndex,l=n.highlightedItemIndex,c=n.itemProps;return o.map(function(n,o){var d="react-autowhatever-"+r+"-",p=d+"section-"+o+"-",h=0===o;return f.default.createElement("div",t(p+"container","sectionContainer",h&&"sectionContainerFirst"),f.default.createElement(I.default,{section:n,renderSectionTitle:a,theme:t,sectionKeyPrefix:p}),f.default.createElement(w.default,{items:e.sectionsItems[o],itemProps:c,renderItem:i,renderItemData:u,sectionIndex:o,highlightedItemIndex:s===o?l:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:d,ref:e.storeItemsListReference}))})}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,r=n.id,o=n.renderItem,i=n.renderItemData,u=n.highlightedSectionIndex,a=n.highlightedItemIndex,s=n.itemProps;return f.default.createElement(w.default,{items:e,itemProps:s,renderItem:o,renderItemData:i,highlightedItemIndex:null===u?a:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+r+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,r=t.scrollTop;n<r?r=n:n+e.offsetHeight>r+t.offsetHeight&&(r=n+e.offsetHeight-t.offsetHeight),r!==t.scrollTop&&(t.scrollTop=r)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,r=t.multiSection,o=t.renderInputComponent,i=t.renderItemsContainer,u=t.highlightedSectionIndex,s=t.highlightedItemIndex,l=this.state.isInputFocused,c=r?this.renderSections():this.renderItems(),d=null!==c,p=this.getItemId(u,s),h=e("react-autowhatever-"+n+"-container","container",d&&"containerOpen"),m="react-autowhatever-"+n,y=o(a({type:"text",value:"",autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-owns":m,"aria-expanded":d,"aria-haspopup":d,"aria-activedescendant":p},e("react-autowhatever-"+n+"-input","input",d&&"inputOpen",l&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=i({containerProps:a({id:m},e("react-autowhatever-"+n+"-items-container","itemsContainer",d&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:c});return f.default.createElement("div",h,y,v)}}]),t}(c.Component);P.propTypes={id:p.default.string,multiSection:p.default.bool,renderInputComponent:p.default.func,renderItemsContainer:p.default.func,items:p.default.array.isRequired,renderItem:p.default.func,renderItemData:p.default.object,renderSectionTitle:p.default.func,getSectionItems:p.default.func,inputProps:p.default.object,itemProps:p.default.oneOfType([p.default.object,p.default.func]),highlightedSectionIndex:p.default.number,highlightedItemIndex:p.default.number,theme:p.default.oneOfType([p.default.object,p.default.array])},P.defaultProps={id:"1",multiSection:!1,renderInputComponent:x,renderItemsContainer:O,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:_,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:_,itemProps:_,highlightedSectionIndex:null,highlightedItemIndex:null,theme:j},t.default=P},function(t,n){t.exports=e},function(e,t,n){e.exports=n(4)()},function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(7);e.exports=function(){function e(e,t,n,r,u,a){a!==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}},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i,u,a,s){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,u,a,s],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=r},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t){"use strict";var n=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.exports=function(e){function t(e){for(null===e?e=0:e++;e<a.length&&0===a[e];)e++;return e===a.length?null:e}function r(e){for(null===e?e=a.length-1:e--;e>=0&&0===a[e];)e--;return e===-1?null:e}function o(e){var r=n(e,2),o=r[0],i=r[1];return s?null===i||i===a[o]-1?(o=t(o),null===o?[null,null]:[o,0]):[o,i+1]:0===a||i===a-1?[null,null]:null===i?[null,0]:[null,i+1]}function i(e){var t=n(e,2),o=t[0],i=t[1];return s?null===i||0===i?(o=r(o),null===o?[null,null]:[o,a[o]-1]):[o,i-1]:0===a||0===i?[null,null]:null===i?[null,a-1]:[null,i-1]}function u(e){return null===o(e)[1]}var a=e.data,s=e.multiSection;return{next:o,prev:i,isLast:u}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n(10),a=r(u),s=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=i(t,2),r=n[0],u=n[1];return function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var l=n.map(function(e){return r[e]}).filter(s);return"string"==typeof l[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,o(l)):l.join(" ")}:{key:e,style:a.default.apply(void 0,[{}].concat(o(l)))}}},e.exports=t.default},function(e,t){"use strict";function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter(function(t){return o.call(e,t)})}var o=Object.prototype.propertyIsEnumerable;e.exports=Object.assign||function(e,t){for(var o,i,u=n(e),a=1;a<arguments.length;a++){o=arguments[a],i=r(Object(o));for(var s=0;s<i.length;s++)u[i[s]]=o[i[s]]}return u}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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}}(),s=n(2),l=r(s),c=n(3),f=r(c),d=n(12),p=r(d),h=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,p.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,r=e.theme,o=e.sectionKeyPrefix,i=n(t);return i?l.default.createElement("div",r(o+"title","sectionTitle"),i):null}}]),t}(s.Component);h.propTypes={section:f.default.any.isRequired,renderSectionTitle:f.default.func.isRequired,theme:f.default.func.isRequired,sectionKeyPrefix:f.default.string.isRequired},t.default=h},function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e===t)return!1;var o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!0;var u={},a=void 0,s=void 0;for(a=0,s=n.length;a<s;a++)u[n[a]]=!0;for(a=0,s=o.length;a<s;a++){var l=o[a],c=e[l],f=t[l];if(c!==f){if(!u[l]||null===c||null===f||"object"!==("undefined"==typeof c?"undefined":r(c))||"object"!==("undefined"==typeof f?"undefined":r(f)))return!0;var d=Object.keys(c),p=Object.keys(f);if(d.length!==p.length)return!0;for(var h=0,m=d.length;h<m;h++){var y=d[h];if(c[y]!==f[y])return!0}}}return!1}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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=n(2),c=r(l),f=n(3),d=r(f),p=n(14),h=r(p),m=n(12),y=r(m),v=function(e){function t(){var e,n,r,u;o(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},u=n,i(r,u)}return u(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e){return(0,y.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,r=t.itemProps,o=t.renderItem,i=t.renderItemData,u=t.sectionIndex,s=t.highlightedItemIndex,l=t.getItemId,f=t.theme,d=t.keyPrefix,p=null===u?d:d+"section-"+u+"-",m="function"==typeof r;return c.default.createElement("ul",a({role:"listbox"},f(p+"items-list","itemsList")),n.map(function(t,n){var d=0===n,y=n===s,v=p+"item-"+n,g=m?r({sectionIndex:u,itemIndex:n}):r,I=a({id:l(u,n)},f(v,"item",d&&"itemFirst",y&&"itemHighlighted"),g);return y&&(I.ref=e.storeHighlightedItemReference),c.default.createElement(h.default,a({},I,{sectionIndex:u,isHighlighted:y,itemIndex:n,item:t,renderItem:o,renderItemData:i}))}))}}]),t}(l.Component);v.propTypes={items:d.default.array.isRequired,itemProps:d.default.oneOfType([d.default.object,d.default.func]),renderItem:d.default.func.isRequired,renderItemData:d.default.object.isRequired,sectionIndex:d.default.number,highlightedItemIndex:d.default.number,onHighlightedItemChange:d.default.func.isRequired,getItemId:d.default.func.isRequired,theme:d.default.func.isRequired,keyPrefix:d.default.string.isRequired},v.defaultProps={sectionIndex:null},t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var 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}}(),c=n(2),f=r(c),d=n(3),p=r(d),h=n(12),m=r(h),y=function(e){function t(){var e,n,r,o;i(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.storeItemReference=function(e){null!==e&&(r.item=e)},r.onMouseEnter=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseEnter(e,{sectionIndex:n,itemIndex:o})},r.onMouseLeave=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseLeave(e,{sectionIndex:n,itemIndex:o})},r.onMouseDown=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseDown(e,{sectionIndex:n,itemIndex:o})},r.onClick=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onClick(e,{sectionIndex:n,itemIndex:o})},o=n,u(r,o)}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){return(0,m.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,r=e.renderItem,i=e.renderItemData,u=o(e,["isHighlighted","item","renderItem","renderItemData"]);return delete u.sectionIndex,delete u.itemIndex,"function"==typeof u.onMouseEnter&&(u.onMouseEnter=this.onMouseEnter),"function"==typeof u.onMouseLeave&&(u.onMouseLeave=this.onMouseLeave),"function"==typeof u.onMouseDown&&(u.onMouseDown=this.onMouseDown),"function"==typeof u.onClick&&(u.onClick=this.onClick),f.default.createElement("li",s({role:"option"},u,{ref:this.storeItemReference}),r(n,s({isHighlighted:t},i)))}}]),t}(c.Component);y.propTypes={sectionIndex:p.default.number,isHighlighted:p.default.bool.isRequired,itemIndex:p.default.number.isRequired,item:p.default.any.isRequired,renderItem:p.default.func.isRequired,renderItemData:p.default.object.isRequired,onMouseEnter:p.default.func,onMouseLeave:p.default.func,onMouseDown:p.default.func,onClick:p.default.func},t.default=y}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React")):"function"==typeof define&&define.amd?define(["React"],t):"object"==typeof exports?exports.Autowhatever=t(require("React")):e.Autowhatever=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1).default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var 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}}(),c=n(2),f=r(c),d=n(3),p=r(d),h=n(8),m=r(h),y=n(9),v=r(y),g=n(11),I=r(g),b=n(13),w=r(b),_={},x=function(e){return f.default.createElement("input",e)},O=function(e){var t=e.containerProps,n=e.children;return f.default.createElement("div",t,n)},j={container:"react-autowhatever__container",containerOpen:"react-autowhatever__container--open",input:"react-autowhatever__input",inputOpen:"react-autowhatever__input--open",inputFocused:"react-autowhatever__input--focused",itemsContainer:"react-autowhatever__items-container",itemsContainerOpen:"react-autowhatever__items-container--open",itemsList:"react-autowhatever__items-list",item:"react-autowhatever__item",itemFirst:"react-autowhatever__item--first",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"},P=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.storeInputReference=function(e){null!==e&&(n.input=e)},n.storeItemsContainerReference=function(e){null!==e&&(n.itemsContainer=e)},n.onHighlightedItemChange=function(e){n.highlightedItem=e},n.getItemId=function(e,t){if(null===t)return null;var r=n.props.id,o=null===e?"":"section-"+e;return"react-autowhatever-"+r+"-"+o+"-item-"+t},n.onFocus=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!0}),t.onFocus&&t.onFocus(e)},n.onBlur=function(e){var t=n.props.inputProps;n.setState({isInputFocused:!1}),t.onBlur&&t.onBlur(e)},n.onKeyDown=function(e){var t=n.props,r=t.inputProps,o=t.highlightedSectionIndex,i=t.highlightedItemIndex;switch(e.key){case"ArrowDown":case"ArrowUp":var u="ArrowDown"===e.key?"next":"prev",a=n.sectionIterator[u]([o,i]),l=s(a,2),c=l[0],f=l[1];r.onKeyDown(e,{newHighlightedSectionIndex:c,newHighlightedItemIndex:f});break;default:r.onKeyDown(e,{highlightedSectionIndex:o,highlightedItemIndex:i})}},n.highlightedItem=null,n.state={isInputFocused:!1},n.setSectionsItems(e),n.setSectionIterator(e),n.setTheme(e),n}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"componentWillReceiveProps",value:function(e){e.items!==this.props.items&&this.setSectionsItems(e),e.items===this.props.items&&e.multiSection===this.props.multiSection||this.setSectionIterator(e),e.theme!==this.props.theme&&this.setTheme(e)}},{key:"componentDidUpdate",value:function(){this.ensureHighlightedItemIsVisible()}},{key:"setSectionsItems",value:function(e){e.multiSection&&(this.sectionsItems=e.items.map(function(t){return e.getSectionItems(t)}),this.sectionsLengths=this.sectionsItems.map(function(e){return e.length}),this.allSectionsAreEmpty=this.sectionsLengths.every(function(e){return 0===e}))}},{key:"setSectionIterator",value:function(e){this.sectionIterator=(0,m.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,v.default)(e.theme)}},{key:"renderSections",value:function(){var e=this;if(this.allSectionsAreEmpty)return null;var t=this.theme,n=this.props,r=n.id,o=n.items,i=n.renderItem,u=n.renderItemData,a=n.renderSectionTitle,s=n.highlightedSectionIndex,l=n.highlightedItemIndex,c=n.itemProps;return o.map(function(n,o){var d="react-autowhatever-"+r+"-",p=d+"section-"+o+"-",h=0===o;return f.default.createElement("div",t(p+"container","sectionContainer",h&&"sectionContainerFirst"),f.default.createElement(I.default,{section:n,renderSectionTitle:a,theme:t,sectionKeyPrefix:p}),f.default.createElement(w.default,{items:e.sectionsItems[o],itemProps:c,renderItem:i,renderItemData:u,sectionIndex:o,highlightedItemIndex:s===o?l:null,onHighlightedItemChange:e.onHighlightedItemChange,getItemId:e.getItemId,theme:t,keyPrefix:d,ref:e.storeItemsListReference}))})}},{key:"renderItems",value:function(){var e=this.props.items;if(0===e.length)return null;var t=this.theme,n=this.props,r=n.id,o=n.renderItem,i=n.renderItemData,u=n.highlightedSectionIndex,a=n.highlightedItemIndex,s=n.itemProps;return f.default.createElement(w.default,{items:e,itemProps:s,renderItem:o,renderItemData:i,highlightedItemIndex:null===u?a:null,onHighlightedItemChange:this.onHighlightedItemChange,getItemId:this.getItemId,theme:t,keyPrefix:"react-autowhatever-"+r+"-"})}},{key:"ensureHighlightedItemIsVisible",value:function(){var e=this.highlightedItem;if(e){var t=this.itemsContainer,n=e.offsetParent===t?e.offsetTop:e.offsetTop-t.offsetTop,r=t.scrollTop;n<r?r=n:n+e.offsetHeight>r+t.offsetHeight&&(r=n+e.offsetHeight-t.offsetHeight),r!==t.scrollTop&&(t.scrollTop=r)}}},{key:"render",value:function(){var e=this.theme,t=this.props,n=t.id,r=t.multiSection,o=t.renderInputComponent,i=t.renderItemsContainer,u=t.highlightedSectionIndex,s=t.highlightedItemIndex,l=this.state.isInputFocused,c=r?this.renderSections():this.renderItems(),d=null!==c,p=this.getItemId(u,s),h=e("react-autowhatever-"+n+"-container","container",d&&"containerOpen"),m="react-autowhatever-"+n,y=o(a({type:"text",value:"",autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-owns":m,"aria-expanded":d,"aria-activedescendant":p},e("react-autowhatever-"+n+"-input","input",d&&"inputOpen",l&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=i({containerProps:a({id:m},e("react-autowhatever-"+n+"-items-container","itemsContainer",d&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference}),children:c});return f.default.createElement("div",h,y,v)}}]),t}(c.Component);P.propTypes={id:p.default.string,multiSection:p.default.bool,renderInputComponent:p.default.func,renderItemsContainer:p.default.func,items:p.default.array.isRequired,renderItem:p.default.func,renderItemData:p.default.object,renderSectionTitle:p.default.func,getSectionItems:p.default.func,inputProps:p.default.object,itemProps:p.default.oneOfType([p.default.object,p.default.func]),highlightedSectionIndex:p.default.number,highlightedItemIndex:p.default.number,theme:p.default.oneOfType([p.default.object,p.default.array])},P.defaultProps={id:"1",multiSection:!1,renderInputComponent:x,renderItemsContainer:O,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:_,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:_,itemProps:_,highlightedSectionIndex:null,highlightedItemIndex:null,theme:j},t.default=P},function(t,n){t.exports=e},function(e,t,n){e.exports=n(4)()},function(e,t,n){"use strict";var r=n(5),o=n(6),i=n(7);e.exports=function(){function e(e,t,n,r,u,a){a!==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}},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i,u,a,s){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,u,a,s],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=r},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t){"use strict";var n=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.exports=function(e){function t(e){for(null===e?e=0:e++;e<a.length&&0===a[e];)e++;return e===a.length?null:e}function r(e){for(null===e?e=a.length-1:e--;e>=0&&0===a[e];)e--;return e===-1?null:e}function o(e){var r=n(e,2),o=r[0],i=r[1];return s?null===i||i===a[o]-1?(o=t(o),null===o?[null,null]:[o,0]):[o,i+1]:0===a||i===a-1?[null,null]:null===i?[null,0]:[null,i+1]}function i(e){var t=n(e,2),o=t[0],i=t[1];return s?null===i||0===i?(o=r(o),null===o?[null,null]:[o,a[o]-1]):[o,i-1]:0===a||0===i?[null,null]:null===i?[null,a-1]:[null,i-1]}function u(e){return null===o(e)[1]}var a=e.data,s=e.multiSection;return{next:o,prev:i,isLast:u}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=n(10),a=r(u),s=function(e){return e};t.default=function(e){var t=Array.isArray(e)&&2===e.length?e:[e,null],n=i(t,2),r=n[0],u=n[1];return function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var l=n.map(function(e){return r[e]}).filter(s);return"string"==typeof l[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,o(l)):l.join(" ")}:{key:e,style:a.default.apply(void 0,[{}].concat(o(l)))}}},e.exports=t.default},function(e,t){"use strict";function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(e){var t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e))),t.filter(function(t){return o.call(e,t)})}var o=Object.prototype.propertyIsEnumerable;e.exports=Object.assign||function(e,t){for(var o,i,u=n(e),a=1;a<arguments.length;a++){o=arguments[a],i=r(Object(o));for(var s=0;s<i.length;s++)u[i[s]]=o[i[s]]}return u}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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}}(),s=n(2),l=r(s),c=n(3),f=r(c),d=n(12),p=r(d),h=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,p.default)(e,this.props)}},{key:"render",value:function(){var e=this.props,t=e.section,n=e.renderSectionTitle,r=e.theme,o=e.sectionKeyPrefix,i=n(t);return i?l.default.createElement("div",r(o+"title","sectionTitle"),i):null}}]),t}(s.Component);h.propTypes={section:f.default.any.isRequired,renderSectionTitle:f.default.func.isRequired,theme:f.default.func.isRequired,sectionKeyPrefix:f.default.string.isRequired},t.default=h},function(e,t){"use strict";function n(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e===t)return!1;var o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!0;var u={},a=void 0,s=void 0;for(a=0,s=n.length;a<s;a++)u[n[a]]=!0;for(a=0,s=o.length;a<s;a++){var l=o[a],c=e[l],f=t[l];if(c!==f){if(!u[l]||null===c||null===f||"object"!==("undefined"==typeof c?"undefined":r(c))||"object"!==("undefined"==typeof f?"undefined":r(f)))return!0;var d=Object.keys(c),p=Object.keys(f);if(d.length!==p.length)return!0;for(var h=0,m=d.length;h<m;h++){var y=d[h];if(c[y]!==f[y])return!0}}}return!1}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=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=n(2),c=r(l),f=n(3),d=r(f),p=n(14),h=r(p),m=n(12),y=r(m),v=function(e){function t(){var e,n,r,u;o(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},u=n,i(r,u)}return u(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e){return(0,y.default)(e,this.props,["itemProps"])}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,r=t.itemProps,o=t.renderItem,i=t.renderItemData,u=t.sectionIndex,s=t.highlightedItemIndex,l=t.getItemId,f=t.theme,d=t.keyPrefix,p=null===u?d:d+"section-"+u+"-",m="function"==typeof r;return c.default.createElement("ul",a({role:"listbox"},f(p+"items-list","itemsList")),n.map(function(t,n){var d=0===n,y=n===s,v=p+"item-"+n,g=m?r({sectionIndex:u,itemIndex:n}):r,I=a({id:l(u,n)},f(v,"item",d&&"itemFirst",y&&"itemHighlighted"),g);return y&&(I.ref=e.storeHighlightedItemReference),c.default.createElement(h.default,a({},I,{sectionIndex:u,isHighlighted:y,itemIndex:n,item:t,renderItem:o,renderItemData:i}))}))}}]),t}(l.Component);v.propTypes={items:d.default.array.isRequired,itemProps:d.default.oneOfType([d.default.object,d.default.func]),renderItem:d.default.func.isRequired,renderItemData:d.default.object.isRequired,sectionIndex:d.default.number,highlightedItemIndex:d.default.number,onHighlightedItemChange:d.default.func.isRequired,getItemId:d.default.func.isRequired,theme:d.default.func.isRequired,keyPrefix:d.default.string.isRequired},v.defaultProps={sectionIndex:null},t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var 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}}(),c=n(2),f=r(c),d=n(3),p=r(d),h=n(12),m=r(h),y=function(e){function t(){var e,n,r,o;i(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.storeItemReference=function(e){null!==e&&(r.item=e)},r.onMouseEnter=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseEnter(e,{sectionIndex:n,itemIndex:o})},r.onMouseLeave=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseLeave(e,{sectionIndex:n,itemIndex:o})},r.onMouseDown=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onMouseDown(e,{sectionIndex:n,itemIndex:o})},r.onClick=function(e){var t=r.props,n=t.sectionIndex,o=t.itemIndex;r.props.onClick(e,{sectionIndex:n,itemIndex:o})},o=n,u(r,o)}return a(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e){return(0,m.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.isHighlighted,n=e.item,r=e.renderItem,i=e.renderItemData,u=o(e,["isHighlighted","item","renderItem","renderItemData"]);return delete u.sectionIndex,delete u.itemIndex,"function"==typeof u.onMouseEnter&&(u.onMouseEnter=this.onMouseEnter),"function"==typeof u.onMouseLeave&&(u.onMouseLeave=this.onMouseLeave),"function"==typeof u.onMouseDown&&(u.onMouseDown=this.onMouseDown),"function"==typeof u.onClick&&(u.onClick=this.onClick),f.default.createElement("li",s({role:"option"},u,{ref:this.storeItemReference}),r(n,s({isHighlighted:t},i)))}}]),t}(c.Component);y.propTypes={sectionIndex:p.default.number,isHighlighted:p.default.bool.isRequired,itemIndex:p.default.number.isRequired,item:p.default.any.isRequired,renderItem:p.default.func.isRequired,renderItemData:p.default.object.isRequired,onMouseEnter:p.default.func,onMouseLeave:p.default.func,onMouseDown:p.default.func,onClick:p.default.func},t.default=y}])}); |
{ | ||
"name": "react-autowhatever", | ||
"version": "10.1.0", | ||
"version": "10.1.1", | ||
"description": "Accessible rendering layer for Autosuggest and Autocomplete components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
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
140525
2506