react-awesome-combobox
Version:
A combobox for React
14 lines • 25.9 kB
JavaScript
module.exports=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=17)}([function(e,t,r){var n,o,i,a={},l=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),u=(i={},function(e,t){if("function"==typeof e)return e();if(void 0===i[e]){var n=function(e,t){return t?t.querySelector(e):document.querySelector(e)}.call(this,e,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}i[e]=n}return i[e]}),c=null,f=0,s=[],p=r(7);function d(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=a[r.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](r.parts[i]);for(;i<r.parts.length;i++)o.parts.push(v(r.parts[i],t))}else{var u=[];for(i=0;i<r.parts.length;i++)u.push(v(r.parts[i],t));a[r.id]={id:r.id,refs:1,parts:u}}}}function y(e,t){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],u=t.base?i[0]+t.base:i[0],s={css:i[1],media:i[2],sourceMap:i[3]};r[u]?r[u].parts.push(s):n.push(r[u]={id:u,parts:[s]})}return n}function g(e,t){var n=u(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=s[s.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),s.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=u(e.insertAt.before,n);n.insertBefore(t,o)}}function b(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=s.indexOf(e);0<=t&&s.splice(t,1)}function h(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var n=function(){0;return r.nc}();n&&(e.attrs.nonce=n)}return m(t,e.attrs),g(e,t),t}function m(t,n){Object.keys(n).forEach(function(e){t.setAttribute(e,n[e])})}function v(t,e){var n,r,o,i,u,s;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var a=f++;n=c||(c=h(e)),r=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else o=t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(u=e,s=document.createElement("link"),void 0===u.attrs.type&&(u.attrs.type="text/css"),u.attrs.rel="stylesheet",m(s,u.attrs),g(u,s),r=function(e,t,n){var r=n.css,o=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||i)&&(r=p(r));o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var u=new Blob([r],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(u),s&&URL.revokeObjectURL(s)}.bind(null,n=s,e),function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(e),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}e.exports=function(e,u){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(u=u||{}).attrs="object"==typeof u.attrs?u.attrs:{},u.singleton||"boolean"==typeof u.singleton||(u.singleton=l()),u.insertInto||(u.insertInto="head"),u.insertAt||(u.insertAt="bottom");var s=y(e,u);return d(s,u),function(e){for(var t=[],n=0;n<s.length;n++){var r=s[n];(o=a[r.id]).refs--,t.push(o)}e&&d(y(e,u),u);for(n=0;n<t.length;n++){var o;if(0===(o=t[n]).refs){for(var i=0;i<o.parts.length;i++)o.parts[i]();delete a[o.id]}}}};var S,w=(S=[],function(e,t){return S[e]=t,S.filter(Boolean).join("\n")});function x(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var i=document.createTextNode(o),u=e.childNodes;u[t]&&e.removeChild(u[t]),u.length?e.insertBefore(i,u[t]):e.appendChild(i)}}},function(e,t){e.exports=function(n){var u=[];return u.toString=function(){return this.map(function(e){var t=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(u=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(u))))+" */"),i=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(i).concat([o]).join("\n")}var u;return[n].join("\n")}(e,n);return e[2]?"@media "+e[2]+"{"+t+"}":t}).join("")},u.i=function(e,t){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(n[o]=!0)}for(r=0;r<e.length;r++){var i=e[r];"number"==typeof i[0]&&n[i[0]]||(t&&!i[2]?i[2]=t:t&&(i[2]="("+i[2]+") and ("+t+")"),u.push(i))}},u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function r(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(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"searchData",value:function(e,n,r){var o=this;return r=r.toLowerCase(),e.filter(function(e){var t=o.getObjectPropertyValue(e,n);return Array.isArray(t)?t.some(function(e){return o.isSearchValueIncluded(e,r)}):o.isSearchValueIncluded(t,r)}).map(function(e){var t=o.getObjectPropertyValue(e,n);return o.generateResultItem(e,t,r)})}},{key:"generateResultItem",value:function(e,t,n){var r=t.substring(0,t.toUpperCase().indexOf(n.toUpperCase())),o=t.substr(t.toUpperCase().indexOf(n.toUpperCase()),n.length);return{item:e,before:r,hit:o,after:t.substring((r+o).length,t.length),selectedInput:t}}},{key:"getObjectPropertyValue",value:function(e,t){var n=this,r=t.split("/");for(t=r.pop();0<r.length&&!Array.isArray(e);)e=e[r.shift()];if(Array.isArray(e)){var o=[],i=r.length?r.join(".")+"."+t:t;return e.forEach(function(e){return o.push(n.getObjectPropertyValue(e,i))}),o}return e[t]||""}},{key:"isSearchValueIncluded",value:function(e,t){return-1!==e.toString().toLowerCase().indexOf(t)}}]),e}();t.default=o},function(e,t,n){e.exports=n(13)()},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){(e.exports=n(1)(!1)).push([e.i,".combobox-container {\n position: relative;\n width: 100%;\n}\n\n\n.combobox-container *,\n.combobox-container *:before,\n.combobox-container *:after {\n box-sizing: border-box;\n}\n\n.combobox-input {\n width: 100%;\n padding-left: 10px;\n font-size: 1rem;\n}\n\n.combobox-suggestion-container {\n position: absolute;\n border: 1px solid #D4D4D4;\n border-bottom: none;\n border-top: none;\n z-index: 99;\n top: 100%;\n left: 0;\n right: 0;\n overflow: hidden;\n overflow-y: auto;\n}",""])},function(e,t,n){var r=n(5);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(0)(r,o);r.locals&&(e.exports=r.locals)},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var o=t.protocol+"//"+t.host,i=o+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var n,r=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(n=0===r.indexOf("//")?r:0===r.indexOf("/")?o+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")})}},function(e,t,n){(e.exports=n(1)(!1)).push([e.i,".combobox-suggestion-content {\n padding: 10px;\n cursor: pointer;\n border-bottom: 1px solid #D4D4D4;\n color: gray;\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n display: flex;\n align-items: center;\n}\n\n.combobox-suggestion-content:hover {\n background-color: #F1F1F1;\n}\n\n.combobox-suggestion-content.active-item {\n color: #FFFFFF;\n}\n\n.combobox-suggestion-content.active-item mark {\n background-color: rgba(255, 241, 0, 0.5);\n}",""])},function(e,t,n){var r=n(8);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(0)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ComboboxSuggestion=void 0;var c="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},r=function(){function r(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(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),f=i(n(4)),o=i(n(3));n(9);var p=i(n(2));function i(e){return e&&e.__esModule?e:{default:e}}(t.ComboboxSuggestion=function(e){function n(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.showSuggestion=t.showSuggestion.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,f.default.Component),r(n,[{key:"showSuggestion",value:function(e,t){return f.default.createElement("span",null,e.before,t?f.default.createElement("mark",null,e.hit):f.default.createElement("strong",null,e.hit),e.after)}},{key:"render",value:function(){var e=this.props,o=e.suggestion,t=e.bgColor,n=e.active,r=e.onClick,i=e.highlight,u=e.itemHeight,s=e.display,a=e.filterProperty,l={height:u+"px",backgroundColor:n?t:"#FFFFFF"};return f.default.createElement("div",{className:"combobox-suggestion-content "+(n?"active-item":""),onClick:r,style:l},f.default.createElement("span",null,("object"===c(o.item)||"[object Object]"===o.item)&&s&&s.fields&&0<s.fields.length?s.fields.map(function(e,t){var n=t===s.fields.length-1;if(e===a)return f.default.createElement("span",{key:t},o.before,i?f.default.createElement("mark",null,o.hit):f.default.createElement("strong",null,o.hit),o.after,!n&&s.seperator+" ");if(1<e.split("/").length){var r=p.default.getObjectPropertyValue(o.item,e);return f.default.createElement("span",{key:t},r,!n&&s.seperator+" ")}return f.default.createElement("span",{key:t},o.item[e],!n&&s.seperator+" ")}):this.showSuggestion(o,i)))}}]),n}()).propTypes={active:o.default.bool,bgColor:o.default.string.isRequired,display:o.default.shape({seperator:o.default.string,fields:o.default.arrayOf(o.default.string)}),filterProperty:o.default.string,highlight:o.default.bool,itemHeight:o.default.number.isRequired,onClick:o.default.func,suggestion:o.default.shape({before:o.default.string,hit:o.default.string,after:o.default.string})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10);Object.defineProperty(t,"ComboboxSuggestion",{enumerable:!0,get:function(){return r.ComboboxSuggestion}})},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var s=n(12);function r(){}e.exports=function(){function e(e,t,n,r,o,i){if(i!==s){var u=new Error("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");throw u.name="Invariant Violation",u}}function t(){return e}var n={array:e.isRequired=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,exact:t};return n.checkPropTypes=r,n.PropTypes=n}},function(e,t,n){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var a=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i<arguments.length;i++){for(var u in n=Object(arguments[i]))l.call(n,u)&&(o[u]=n[u]);if(a){r=a(n);for(var s=0;s<r.length;s++)c.call(n,r[s])&&(o[r[s]]=n[r[s]])}}return o}},function(e,t,n){"use strict";
/** @license React v16.6.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var c=n(14),r="function"==typeof Symbol&&Symbol.for,f=r?Symbol.for("react.element"):60103,l=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,y=r?Symbol.for("react.suspense"):60113,g=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,h="function"==typeof Symbol&&Symbol.iterator;function m(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,o,i,u,s){if(!e){if((e=void 0)===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=[n,r,o,i,u,s],l=0;(e=Error(t.replace(/%s/g,function(){return a[l++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S={};function w(e,t,n){this.props=e,this.context=t,this.refs=S,this.updater=n||v}function x(){}function O(e,t,n){this.props=e,this.context=t,this.refs=S,this.updater=n||v}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&m("85"),this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},x.prototype=w.prototype;var j=O.prototype=new x;j.constructor=O,c(j,w.prototype),j.isPureReactComponent=!0;var _={current:null,currentDispatcher:null},k=Object.prototype.hasOwnProperty,C={key:!0,ref:!0,__self:!0,__source:!0};function P(e,t,n){var r=void 0,o={},i=null,u=null;if(null!=t)for(r in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(i=""+t.key),t)k.call(t,r)&&!C.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var a=Array(s),l=0;l<s;l++)a[l]=arguments[l+2];o.children=a}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===o[r]&&(o[r]=s[r]);return{$$typeof:f,type:e,key:i,ref:u,props:o,_owner:_.current}}function E(e){return"object"==typeof e&&null!==e&&e.$$typeof===f}var R=/\/+/g,I=[];function F(e,t,n,r){if(I.length){var o=I.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function T(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,I.length<10&&I.push(e)}function U(e,t,n){return null==e?0:function e(t,n,r,o){var i=typeof t;"undefined"!==i&&"boolean"!==i||(t=null);var u=!1;if(null===t)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case f:case l:u=!0}}if(u)return r(o,t,""===n?"."+L(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;s<t.length;s++){var a=n+L(i=t[s],s);u+=e(i,a,r,o)}else if("function"==typeof(a=null===t||"object"!=typeof t?null:"function"==typeof(a=h&&t[h]||t["@@iterator"])?a:null))for(t=a.call(t),s=0;!(i=t.next()).done;)u+=e(i=i.value,a=n+L(i,s++),r,o);else"object"===i&&m("31","[object Object]"==(r=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return u}(e,"",t,n)}function L(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function A(e,t){e.func.call(e.context,t,e.count++)}function $(e,t,n){var r,o,i=e.result,u=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?M(e,i,n,function(e){return e}):null!=e&&(E(e)&&(o=u+(!(r=e).key||t&&t.key===e.key?"":(""+e.key).replace(R,"$&/")+"/")+n,e={$$typeof:f,type:r.type,key:o,ref:r.ref,props:r.props,_owner:r._owner}),i.push(e))}function M(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(R,"$&/")+"/"),U(e,$,t=F(t,i,r,o)),T(t)}var D={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return M(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;U(e,A,t=F(null,null,t,n)),T(t)},count:function(e){return U(e,function(){return null},null)},toArray:function(e){var t=[];return M(e,t,null,function(e){return e}),t},only:function(e){return E(e)||m("143"),e}},createRef:function(){return{current:null}},Component:w,PureComponent:O,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:a,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:d,render:e}},lazy:function(e){return{$$typeof:b,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:g,type:e,compare:void 0===t?null:t}},Fragment:o,StrictMode:i,Suspense:y,createElement:P,cloneElement:function(e,t,n){null==e&&m("267",e);var r=void 0,o=c({},e.props),i=e.key,u=e.ref,s=e._owner;if(null!=t){void 0!==t.ref&&(u=t.ref,s=_.current),void 0!==t.key&&(i=""+t.key);var a=void 0;for(r in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)k.call(t,r)&&!C.hasOwnProperty(r)&&(o[r]=void 0===t[r]&&void 0!==a?a[r]:t[r])}if(1===(r=arguments.length-2))o.children=n;else if(1<r){a=Array(r);for(var l=0;l<r;l++)a[l]=arguments[l+2];o.children=a}return{$$typeof:f,type:e.type,key:i,ref:u,props:o,_owner:s}},createFactory:function(e){var t=P.bind(null,e);return t.type=e,t},isValidElement:E,version:"16.6.3",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:_,assign:c}};D.unstable_ConcurrentMode=p,D.unstable_Profiler=u;var H={default:D},V=D||H;e.exports=V.default||V},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u="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},r=function(){function r(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(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),g=i(n(4)),o=i(n(3)),s=i(n(2)),b=n(11);function i(e){return e&&e.__esModule?e:{default:e}}n(6);var a=38,l=40,c=27,f=9,p=13,d=14,y=function(e){function n(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.state={currentFocus:-1,suggestions:[],inputValue:""},t.suggestions=g.default.createRef(),t.onInputHandler=t.onInputHandler.bind(t),t.setCurrentSuggestion=t.setCurrentSuggestion.bind(t),t.closeSuggestionsList=t.closeSuggestionsList.bind(t),t.onKeyDownHandler=t.onKeyDownHandler.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,g.default.Component),r(n,[{key:"componentDidMount",value:function(){var e=this;document.addEventListener("click",function(){e.closeSuggestionsList()})}},{key:"componentWillUnmount",value:function(){var e=this;document.removeEventListener("click",function(){e.closeSuggestionsList()})}},{key:"onInputHandler",value:function(e){var t=e.target.value,n=this.props,r=n.data,o=n.filterProperty;this.closeSuggestionsList();var i=[];"object"!==u(r[0])&&Array.isArray(r)?r.map(function(e){return-1!==(e=String(e)).toUpperCase().indexOf(t.toUpperCase())&&i.push(s.default.generateResultItem(e,e,t)),i}):i=s.default.searchData(r,o,t),this.setState({inputValue:t,suggestions:t?i:[]})}},{key:"setCurrentSuggestion",value:function(t){var e=this,n=this.props,r=n.display,o=n.filterProperty,i=("object"===u(t.item)||"[object Object]"===t.item)&&r&&r.fields&&0<r.fields.length?r.fields.map(function(e){return e===o?t.selectedInput:1<e.split("/").length?s.default.getObjectPropertyValue(t.item,e):t.item[e]}):[t.selectedInput];i=i.join(r.seperator+" "),this.setState({inputValue:i},function(){e.closeSuggestionsList(),e.props.onSelectItem(t.item)})}},{key:"closeSuggestionsList",value:function(){this.setState({suggestions:[],currentFocus:-1})}},{key:"onKeyDownHandler",value:function(e){var t=this,n=this.props,r=n.itemHeight,o=n.visibleItems;switch(e.keyCode){case c:case f:e.target.setSelectionRange(e.target.value.length,e.target.value.length),this.closeSuggestionsList();break;case l:this.setState(function(e){return{currentFocus:e.currentFocus>=e.suggestions.length-1?0:e.currentFocus+1}},function(){(t.state.currentFocus+1)*r>o*r+t.suggestions.current.scrollTop&&(t.suggestions.current.scrollTop+=r),t.state.currentFocus*r<t.suggestions.current.scrollTop&&(t.suggestions.current.scrollTop=0)});break;case a:this.setState(function(e){return{currentFocus:e.currentFocus<=0?e.suggestions.length-1:e.currentFocus-1}},function(){t.state.currentFocus*r<t.suggestions.current.scrollTop&&(t.suggestions.current.scrollTop-=r),(t.state.currentFocus+1)*r>o*r+t.suggestions.current.scrollTop&&(t.suggestions.current.scrollTop=t.suggestions.current.querySelectorAll("div").length*r)});break;case d:case p:e.preventDefault(),-1<this.state.currentFocus&&this.setCurrentSuggestion(this.state.suggestions[this.state.currentFocus],e)}}},{key:"render",value:function(){var n=this,e=this.props,r=e.bgColor,t=e.data,o=e.itemHeight,i=e.highlight,u=e.placeholder,s=e.display,a=e.filterProperty,l=e.visibleItems,c=this.state,f=c.suggestions,p=c.inputValue,d={maxHeight:"calc("+l+" * "+o+" * 1px)"},y={height:o+"px"};return g.default.createElement("div",{className:"combobox-container"},t&&0<t.length&&g.default.createElement(g.default.Fragment,null,g.default.createElement("input",{autoComplete:"off",className:"combobox-input",name:"lastname",onChange:this.onInputHandler,onKeyDown:this.onKeyDownHandler,placeholder:u,style:y,type:"text",value:p}),g.default.createElement("div",{className:"combobox-suggestion-container",ref:this.suggestions,style:d},0<f.length&&f.map(function(e,t){return g.default.createElement(b.ComboboxSuggestion,{active:n.state.currentFocus===t,bgColor:r,display:s,filterProperty:a,highlight:i,itemHeight:o,key:t,onClick:function(){return n.setCurrentSuggestion(e)},suggestion:e})}))))}}]),n}();(t.default=y).defaultProps={bgColor:"#6B9FCE",placeholder:"Search...",itemHeight:40,visibleItems:5,highlight:!1,display:{seperator:",",fields:[]},onSelectItem:function(){return null}},y.propTypes={bgColor:o.default.string,data:o.default.array.isRequired,display:o.default.shape({fields:o.default.arrayOf(o.default.string).isRequired,seperator:o.default.string}),filterProperty:function(e,t,n){if(["object","[object Object]"].includes(u(e.data[0]))&&"string"!=typeof e[t])return new Error("Invalid prop "+t+" supplied to "+n+'. Validation failed.\n Missing Property "filterProperty" type string.')},highlight:o.default.bool,itemHeight:o.default.number,onSelectItem:o.default.func,placeholder:o.default.string,visibleItems:o.default.number}},function(e,t,n){"use strict";var r,o=n(16),i=(r=o)&&r.__esModule?r:{default:r};e.exports={Combobox:i.default}}]);