react-autowhatever
Advanced tools
Comparing version 9.0.0 to 9.1.0
@@ -63,2 +63,3 @@ 'use strict'; | ||
item: 'react-autowhatever__item', | ||
itemFirst: 'react-autowhatever__item--first', | ||
itemHighlighted: 'react-autowhatever__item--highlighted', | ||
@@ -65,0 +66,0 @@ sectionContainer: 'react-autowhatever__section-container', |
@@ -78,2 +78,3 @@ 'use strict'; | ||
items.map(function (item, itemIndex) { | ||
var isFirst = itemIndex === 0; | ||
var isHighlighted = itemIndex === highlightedItemIndex; | ||
@@ -84,3 +85,3 @@ var itemKey = sectionPrefix + 'item-' + itemIndex; | ||
id: getItemId(sectionIndex, itemIndex) | ||
}, theme(itemKey, 'item', isHighlighted && 'itemHighlighted'), itemPropsObj); | ||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), itemPropsObj); | ||
@@ -87,0 +88,0 @@ if (isHighlighted) { |
@@ -127,2 +127,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
item: 'react-autowhatever__item', | ||
itemFirst: 'react-autowhatever__item--first', | ||
itemHighlighted: 'react-autowhatever__item--highlighted', | ||
@@ -670,2 +671,3 @@ sectionContainer: 'react-autowhatever__section-container', | ||
/***/ }, | ||
@@ -940,2 +942,3 @@ /* 5 */ | ||
items.map(function (item, itemIndex) { | ||
var isFirst = itemIndex === 0; | ||
var isHighlighted = itemIndex === highlightedItemIndex; | ||
@@ -946,3 +949,3 @@ var itemKey = sectionPrefix + 'item-' + itemIndex; | ||
id: getItemId(sectionIndex, itemIndex) | ||
}, theme(itemKey, 'item', isHighlighted && 'itemHighlighted'), itemPropsObj); | ||
}, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), itemPropsObj); | ||
@@ -949,0 +952,0 @@ if (isHighlighted) { |
@@ -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 s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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")}}(),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}}(),c=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=n(2),p=r(l),f=n(3),d=r(f),h=n(4),m=r(h),y=n(6),v=r(y),g=n(8),I=r(g),b=function(){return!0},P={},w=function(e){return p.default.createElement("input",e)},x=function(e){var t=e.children,n=e.containerProps;return p.default.createElement("div",c({children:t},n))},T={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",itemHighlighted:"react-autowhatever__item--highlighted",sectionContainer:"react-autowhatever__section-container",sectionContainerFirst:"react-autowhatever__section-container--first",sectionTitle:"react-autowhatever__section-title"},_=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]),c=s(a,2),l=c[0],p=c[1];r.onKeyDown(e,{newHighlightedSectionIndex:l,newHighlightedItemIndex:p});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),a(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,d.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,m.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,s=n.shouldRenderSection,a=n.renderSectionTitle,c=n.highlightedSectionIndex,l=n.highlightedItemIndex,f=n.itemProps;return o.map(function(n,o){if(!s(n))return null;var d="react-autowhatever-"+r+"-",h=d+"section-"+o+"-",m=0===o;return p.default.createElement("div",t(h+"container","sectionContainer",m&&"sectionContainerFirst"),p.default.createElement(v.default,{section:n,renderSectionTitle:a,theme:t,sectionKeyPrefix:h}),p.default.createElement(I.default,{items:e.sectionsItems[o],itemProps:f,renderItem:i,renderItemData:u,sectionIndex:o,highlightedItemIndex:c===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,s=n.highlightedItemIndex,a=n.itemProps;return p.default.createElement(I.default,{items:e,itemProps:a,renderItem:o,renderItemData:i,highlightedItemIndex:null===u?s: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,a=this.state.isInputFocused,l=r?this.renderSections():this.renderItems(),f=null!==l,d=this.getItemId(u,s),h=e("react-autowhatever-"+n+"-container","container",f&&"containerOpen"),m="react-autowhatever-"+n,y=o(c({type:"text",value:"",autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-owns":m,"aria-expanded":f,"aria-haspopup":f,"aria-activedescendant":d},e("react-autowhatever-"+n+"-input","input",f&&"inputOpen",a&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=i({children:l,containerProps:c({id:m},e("react-autowhatever-"+n+"-items-container","itemsContainer",f&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference})});return p.default.createElement("div",h,y,v)}}]),t}(l.Component);_.propTypes={id:l.PropTypes.string,multiSection:l.PropTypes.bool,renderInputComponent:l.PropTypes.func,renderItemsContainer:l.PropTypes.func,items:l.PropTypes.array.isRequired,renderItem:l.PropTypes.func,renderItemData:l.PropTypes.object,shouldRenderSection:l.PropTypes.func,renderSectionTitle:l.PropTypes.func,getSectionItems:l.PropTypes.func,inputProps:l.PropTypes.object,itemProps:l.PropTypes.oneOfType([l.PropTypes.object,l.PropTypes.func]),highlightedSectionIndex:l.PropTypes.number,highlightedItemIndex:l.PropTypes.number,theme:l.PropTypes.oneOfType([l.PropTypes.object,l.PropTypes.array])},_.defaultProps={id:"1",multiSection:!1,renderInputComponent:w,renderItemsContainer:x,shouldRenderSection:b,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:P,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:P,itemProps:P,highlightedSectionIndex:null,highlightedItemIndex:null,theme:T},t.default=_},function(t,n){t.exports=e},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,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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<s.length&&0===s[e];)e++;return e===s.length?null:e}function r(e){for(null===e?e=s.length-1:e--;e>=0&&0===s[e];)e--;return e===-1?null:e}function o(e){var r=n(e,2),o=r[0],i=r[1];return a?null===i||i===s[o]-1?(o=t(o),null===o?[null,null]:[o,0]):[o,i+1]:0===s||i===s-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 a?null===i||0===i?(o=r(o),null===o?[null,null]:[o,s[o]-1]):[o,i-1]:0===s||0===i?[null,null]:null===i?[null,s-1]:[null,i-1]}function u(e){return null===o(e)[1]}var s=e.data,a=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,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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(5),s=r(u),a=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 c=n.map(function(e){return r[e]}).filter(a);return"string"==typeof c[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,o(c)):c.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(o(c)))}}},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),s=1;s<arguments.length;s++){o=arguments[s],i=r(Object(o));for(var a=0;a<i.length;a++)u[i[a]]=o[i[a]]}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 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}}(),a=n(2),c=r(a),l=n(7),p=r(l),f=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(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?c.default.createElement("div",r(o+"title","sectionTitle"),i):null}}]),t}(a.Component);f.propTypes={section:a.PropTypes.any.isRequired,renderSectionTitle:a.PropTypes.func.isRequired,theme:a.PropTypes.func.isRequired,sectionKeyPrefix:a.PropTypes.string.isRequired},t.default=f},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={},s=void 0,a=void 0;for(s=0,a=n.length;s<a;s++)u[n[s]]=!0;for(s=0,a=o.length;s<a;s++){var c=o[s],l=e[c],p=t[c];if(l!==p){if(!u[c]||null===l||null===p||"object"!==("undefined"==typeof l?"undefined":r(l))||"object"!==("undefined"==typeof p?"undefined":r(p)))return!0;var f=Object.keys(l),d=Object.keys(p);if(f.length!==d.length)return!0;for(var h=0,m=f.length;h<m;h++){var y=f[h];if(l[y]!==p[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 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},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}}(),c=n(2),l=r(c),p=n(9),f=r(p),d=n(7),h=r(d),m=function(e){function t(){var e,n,r,u;o(this,t);for(var s=arguments.length,a=Array(s),c=0;c<s;c++)a[c]=arguments[c];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},u=n,i(r,u)}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,h.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,a=t.highlightedItemIndex,c=t.getItemId,p=t.theme,d=t.keyPrefix,h=null===u?d:d+"section-"+u+"-",m="function"==typeof r;return l.default.createElement("ul",s({role:"listbox"},p(h+"items-list","itemsList")),n.map(function(t,n){var d=n===a,y=h+"item-"+n,v=m?r({sectionIndex:u,itemIndex:n}):r,g=s({id:c(u,n)},p(y,"item",d&&"itemHighlighted"),v);return d&&(g.ref=e.storeHighlightedItemReference),l.default.createElement(f.default,s({},g,{sectionIndex:u,itemIndex:n,item:t,renderItem:o,renderItemData:i}))}))}}]),t}(c.Component);m.propTypes={items:c.PropTypes.array.isRequired,itemProps:c.PropTypes.oneOfType([c.PropTypes.object,c.PropTypes.func]),renderItem:c.PropTypes.func.isRequired,renderItemData:c.PropTypes.object.isRequired,sectionIndex:c.PropTypes.number,highlightedItemIndex:c.PropTypes.number,onHighlightedItemChange:c.PropTypes.func.isRequired,getItemId:c.PropTypes.func.isRequired,theme:c.PropTypes.func.isRequired,keyPrefix:c.PropTypes.string.isRequired},m.defaultProps={sectionIndex:null},t.default=m},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 s(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},c=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),p=r(l),f=n(7),d=r(f),h=function(e){function t(){var e,n,r,o;i(this,t);for(var s=arguments.length,a=Array(s),c=0;c<s;c++)a[c]=arguments[c];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),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 s(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e){return(0,d.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.item,n=e.renderItem,r=e.renderItemData,i=o(e,["item","renderItem","renderItemData"]);return delete i.sectionIndex,delete i.itemIndex,"function"==typeof i.onMouseEnter&&(i.onMouseEnter=this.onMouseEnter),"function"==typeof i.onMouseLeave&&(i.onMouseLeave=this.onMouseLeave),"function"==typeof i.onMouseDown&&(i.onMouseDown=this.onMouseDown),"function"==typeof i.onClick&&(i.onClick=this.onClick),p.default.createElement("li",a({role:"option"},i,{ref:this.storeItemReference}),n(t,r))}}]),t}(l.Component);h.propTypes={sectionIndex:l.PropTypes.number,itemIndex:l.PropTypes.number.isRequired,item:l.PropTypes.any.isRequired,renderItem:l.PropTypes.func.isRequired,renderItemData:l.PropTypes.object.isRequired,onMouseEnter:l.PropTypes.func,onMouseLeave:l.PropTypes.func,onMouseDown:l.PropTypes.func,onClick:l.PropTypes.func},t.default=h}])}); | ||
!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 s=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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")}}(),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}}(),c=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=n(2),p=r(l),f=n(3),d=r(f),h=n(4),m=r(h),y=n(6),v=r(y),g=n(8),I=r(g),b=function(){return!0},P={},w=function(e){return p.default.createElement("input",e)},x=function(e){var t=e.children,n=e.containerProps;return p.default.createElement("div",c({children:t},n))},_={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"},T=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]),c=s(a,2),l=c[0],p=c[1];r.onKeyDown(e,{newHighlightedSectionIndex:l,newHighlightedItemIndex:p});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),a(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,d.default)({multiSection:e.multiSection,data:e.multiSection?this.sectionsLengths:e.items.length})}},{key:"setTheme",value:function(e){this.theme=(0,m.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,s=n.shouldRenderSection,a=n.renderSectionTitle,c=n.highlightedSectionIndex,l=n.highlightedItemIndex,f=n.itemProps;return o.map(function(n,o){if(!s(n))return null;var d="react-autowhatever-"+r+"-",h=d+"section-"+o+"-",m=0===o;return p.default.createElement("div",t(h+"container","sectionContainer",m&&"sectionContainerFirst"),p.default.createElement(v.default,{section:n,renderSectionTitle:a,theme:t,sectionKeyPrefix:h}),p.default.createElement(I.default,{items:e.sectionsItems[o],itemProps:f,renderItem:i,renderItemData:u,sectionIndex:o,highlightedItemIndex:c===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,s=n.highlightedItemIndex,a=n.itemProps;return p.default.createElement(I.default,{items:e,itemProps:a,renderItem:o,renderItemData:i,highlightedItemIndex:null===u?s: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,a=this.state.isInputFocused,l=r?this.renderSections():this.renderItems(),f=null!==l,d=this.getItemId(u,s),h=e("react-autowhatever-"+n+"-container","container",f&&"containerOpen"),m="react-autowhatever-"+n,y=o(c({type:"text",value:"",autoComplete:"off",role:"combobox","aria-autocomplete":"list","aria-owns":m,"aria-expanded":f,"aria-haspopup":f,"aria-activedescendant":d},e("react-autowhatever-"+n+"-input","input",f&&"inputOpen",a&&"inputFocused"),this.props.inputProps,{onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.props.inputProps.onKeyDown&&this.onKeyDown,ref:this.storeInputReference})),v=i({children:l,containerProps:c({id:m},e("react-autowhatever-"+n+"-items-container","itemsContainer",f&&"itemsContainerOpen"),{ref:this.storeItemsContainerReference})});return p.default.createElement("div",h,y,v)}}]),t}(l.Component);T.propTypes={id:l.PropTypes.string,multiSection:l.PropTypes.bool,renderInputComponent:l.PropTypes.func,renderItemsContainer:l.PropTypes.func,items:l.PropTypes.array.isRequired,renderItem:l.PropTypes.func,renderItemData:l.PropTypes.object,shouldRenderSection:l.PropTypes.func,renderSectionTitle:l.PropTypes.func,getSectionItems:l.PropTypes.func,inputProps:l.PropTypes.object,itemProps:l.PropTypes.oneOfType([l.PropTypes.object,l.PropTypes.func]),highlightedSectionIndex:l.PropTypes.number,highlightedItemIndex:l.PropTypes.number,theme:l.PropTypes.oneOfType([l.PropTypes.object,l.PropTypes.array])},T.defaultProps={id:"1",multiSection:!1,renderInputComponent:w,renderItemsContainer:x,shouldRenderSection:b,renderItem:function(){throw new Error("`renderItem` must be provided")},renderItemData:P,renderSectionTitle:function(){throw new Error("`renderSectionTitle` must be provided")},getSectionItems:function(){throw new Error("`getSectionItems` must be provided")},inputProps:P,itemProps:P,highlightedSectionIndex:null,highlightedItemIndex:null,theme:_},t.default=T},function(t,n){t.exports=e},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,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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<s.length&&0===s[e];)e++;return e===s.length?null:e}function r(e){for(null===e?e=s.length-1:e--;e>=0&&0===s[e];)e--;return e===-1?null:e}function o(e){var r=n(e,2),o=r[0],i=r[1];return a?null===i||i===s[o]-1?(o=t(o),null===o?[null,null]:[o,0]):[o,i+1]:0===s||i===s-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 a?null===i||0===i?(o=r(o),null===o?[null,null]:[o,s[o]-1]):[o,i-1]:0===s||0===i?[null,null]:null===i?[null,s-1]:[null,i-1]}function u(e){return null===o(e)[1]}var s=e.data,a=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,s=e[Symbol.iterator]();!(r=(u=s.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.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(5),s=r(u),a=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 c=n.map(function(e){return r[e]}).filter(a);return"string"==typeof c[0]||"function"==typeof u?{key:e,className:u?u.apply(void 0,o(c)):c.join(" ")}:{key:e,style:s.default.apply(void 0,[{}].concat(o(c)))}}},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),s=1;s<arguments.length;s++){o=arguments[s],i=r(Object(o));for(var a=0;a<i.length;a++)u[i[a]]=o[i[a]]}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 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}}(),a=n(2),c=r(a),l=n(7),p=r(l),f=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return u(t,e),s(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?c.default.createElement("div",r(o+"title","sectionTitle"),i):null}}]),t}(a.Component);f.propTypes={section:a.PropTypes.any.isRequired,renderSectionTitle:a.PropTypes.func.isRequired,theme:a.PropTypes.func.isRequired,sectionKeyPrefix:a.PropTypes.string.isRequired},t.default=f},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={},s=void 0,a=void 0;for(s=0,a=n.length;s<a;s++)u[n[s]]=!0;for(s=0,a=o.length;s<a;s++){var c=o[s],l=e[c],p=t[c];if(l!==p){if(!u[c]||null===l||null===p||"object"!==("undefined"==typeof l?"undefined":r(l))||"object"!==("undefined"==typeof p?"undefined":r(p)))return!0;var f=Object.keys(l),d=Object.keys(p);if(f.length!==d.length)return!0;for(var h=0,m=f.length;h<m;h++){var y=f[h];if(l[y]!==p[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 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},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}}(),c=n(2),l=r(c),p=n(9),f=r(p),d=n(7),h=r(d),m=function(e){function t(){var e,n,r,u;o(this,t);for(var s=arguments.length,a=Array(s),c=0;c<s;c++)a[c]=arguments[c];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.storeHighlightedItemReference=function(e){r.props.onHighlightedItemChange(null===e?null:e.item)},u=n,i(r,u)}return u(t,e),a(t,[{key:"shouldComponentUpdate",value:function(e){return(0,h.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,a=t.highlightedItemIndex,c=t.getItemId,p=t.theme,d=t.keyPrefix,h=null===u?d:d+"section-"+u+"-",m="function"==typeof r;return l.default.createElement("ul",s({role:"listbox"},p(h+"items-list","itemsList")),n.map(function(t,n){var d=0===n,y=n===a,v=h+"item-"+n,g=m?r({sectionIndex:u,itemIndex:n}):r,I=s({id:c(u,n)},p(v,"item",d&&"itemFirst",y&&"itemHighlighted"),g);return y&&(I.ref=e.storeHighlightedItemReference),l.default.createElement(f.default,s({},I,{sectionIndex:u,itemIndex:n,item:t,renderItem:o,renderItemData:i}))}))}}]),t}(c.Component);m.propTypes={items:c.PropTypes.array.isRequired,itemProps:c.PropTypes.oneOfType([c.PropTypes.object,c.PropTypes.func]),renderItem:c.PropTypes.func.isRequired,renderItemData:c.PropTypes.object.isRequired,sectionIndex:c.PropTypes.number,highlightedItemIndex:c.PropTypes.number,onHighlightedItemChange:c.PropTypes.func.isRequired,getItemId:c.PropTypes.func.isRequired,theme:c.PropTypes.func.isRequired,keyPrefix:c.PropTypes.string.isRequired},m.defaultProps={sectionIndex:null},t.default=m},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 s(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},c=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),p=r(l),f=n(7),d=r(f),h=function(e){function t(){var e,n,r,o;i(this,t);for(var s=arguments.length,a=Array(s),c=0;c<s;c++)a[c]=arguments[c];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),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 s(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e){return(0,d.default)(e,this.props,["renderItemData"])}},{key:"render",value:function(){var e=this.props,t=e.item,n=e.renderItem,r=e.renderItemData,i=o(e,["item","renderItem","renderItemData"]);return delete i.sectionIndex,delete i.itemIndex,"function"==typeof i.onMouseEnter&&(i.onMouseEnter=this.onMouseEnter),"function"==typeof i.onMouseLeave&&(i.onMouseLeave=this.onMouseLeave),"function"==typeof i.onMouseDown&&(i.onMouseDown=this.onMouseDown),"function"==typeof i.onClick&&(i.onClick=this.onClick),p.default.createElement("li",a({role:"option"},i,{ref:this.storeItemReference}),n(t,r))}}]),t}(l.Component);h.propTypes={sectionIndex:l.PropTypes.number,itemIndex:l.PropTypes.number.isRequired,item:l.PropTypes.any.isRequired,renderItem:l.PropTypes.func.isRequired,renderItemData:l.PropTypes.object.isRequired,onMouseEnter:l.PropTypes.func,onMouseLeave:l.PropTypes.func,onMouseDown:l.PropTypes.func,onClick:l.PropTypes.func},t.default=h}])}); |
{ | ||
"name": "react-autowhatever", | ||
"version": "9.0.0", | ||
"version": "9.1.0", | ||
"description": "Accessible rendering layer for Autosuggest and Autocomplete components", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"autoprefixer": "^6.7.3", | ||
"autoprefixer": "^6.7.5", | ||
"autosuggest-highlight": "^3.1.0", | ||
@@ -47,4 +47,4 @@ "babel-cli": "^6.23.0", | ||
"chai": "^3.5.0", | ||
"css-loader": "^0.26.1", | ||
"eslint": "^3.15.0", | ||
"css-loader": "^0.26.2", | ||
"eslint": "^3.16.1", | ||
"eslint-plugin-react": "^6.10.0", | ||
@@ -57,3 +57,3 @@ "extract-text-webpack-plugin": "^1.0.1", | ||
"openurl": "^1.1.1", | ||
"postcss-loader": "^1.3.1", | ||
"postcss-loader": "^1.3.2", | ||
"react": "^16.0.0-alpha.2", | ||
@@ -68,3 +68,3 @@ "react-addons-test-utils": "^16.0.0-alpha.2", | ||
"sinon-chai": "^2.8.0", | ||
"style-loader": "^0.13.1", | ||
"style-loader": "^0.13.2", | ||
"webpack": "^1.13.2", | ||
@@ -71,0 +71,0 @@ "webpack-dev-server": "^1.16.2" |
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
101773
1548