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

select2-react-component

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

select2-react-component - npm Package Compare versions

Comparing version 5.10.2 to 5.10.3

2

dist/select2-react-component.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).Select2={},e.React,e.ReactDOM)}(this,function(e,l,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var s=[{l:"a",s:/[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi},{l:"aa",s:/ꜳ/gi},{l:"ae",s:/[æǽǣ]/gi},{l:"ao",s:/ꜵ/gi},{l:"au",s:/ꜷ/gi},{l:"av",s:/[ꜹꜻ]/gi},{l:"ay",s:/ꜽ/gi},{l:"b",s:/[ⓑbḃḅḇƀƃɓ]/gi},{l:"c",s:/[ⓒcćĉċčçḉƈȼꜿↄ]/gi},{l:"d",s:/[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi},{l:"dz",s:/[dzdž]/gi},{l:"e",s:/[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi},{l:"f",s:/[ⓕfḟƒꝼ]/gi},{l:"g",s:/[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi},{l:"h",s:/[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi},{l:"hv",s:/ƕ/gi},{l:"i",s:/[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi},{l:"j",s:/[ⓙjĵǰɉ]/gi},{l:"k",s:/[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi},{l:"l",s:/[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi},{l:"lj",s:/lj/gi},{l:"m",s:/[ⓜmḿṁṃɱɯ]/gi},{l:"n",s:/[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi},{l:"nj",s:/nj/gi},{l:"o",s:/[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi},{l:"oi",s:/ƣ/gi},{l:"oe",s:/œ/gi},{l:"oo",s:/ꝏ/gi},{l:"ou",s:/ȣ/gi},{l:"p",s:/[ⓟpṕṗƥᵽꝑꝓꝕ]/gi},{l:"q",s:/[ⓠqɋꝗꝙ]/gi},{l:"r",s:/[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi},{l:"s",s:/[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi},{l:"t",s:/[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi},{l:"tz",s:/ꜩ/gi},{l:"u",s:/[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi},{l:"v",s:/[ⓥvṽṿʋꝟʌ]/gi},{l:"vy",s:/ꝡ/gi},{l:"w",s:/[ⓦwẁẃŵẇẅẘẉⱳ]/gi},{l:"x",s:/[ⓧxẋẍ]/gi},{l:"y",s:/[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi},{l:"z",s:/[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi}];function c(e,t){var r,n,o,i;try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a=l.value,u=a.options;if(u)try{for(var c=(o=void 0,d(u)),p=c.next();!p.done;p=c.next()){var h=p.value;if(h.value===t)return h}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(o)throw o.error}}else if(a.value===t)return a}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return null}function o(e,t,r){var n,o;if(r){var i=Array.isArray(t)?t:[],s=[];try{for(var l=d(i),a=l.next();!a.done;a=l.next()){var u=c(e,a.value);u&&s.push(u)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return s}return c(e,t)}function i(e){var t,r,n,o;try{for(var i=d(e),s=i.next();!s.done;s=i.next()){var l=s.value,a=l.options;if(a)try{for(var u=(n=void 0,d(a)),c=u.next();!c.done;c=u.next()){var p;if(!(p=c.value).disabled)return p.value}}catch(e){n={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}else if(!(p=l).disabled)return p.value}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return null}function a(e,t){var r,n,o,i;if(v(t))return!0;try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a=l.value,u=a.options;if(u)try{for(var c=(o=void 0,d(u)),p=c.next();!p.done;p=c.next()){if(p.value.value===t)return!1}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(o)throw o.error}}else if(a.value===t)return!1}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!0}function u(e,t){for(var r=v(t),n=e.length-1;0<=n;n--){var o=e[n],i=o.options;if(i)for(var s=i.length-1;0<=s;s--){var l=i[s];if(r&&!l.disabled)return l.value;r=l.value===t}else{l=o;if(r&&!l.disabled)return l.value;r=l.value===t}}return r?t:null}function p(e,t){var r,n,o,i,s=v(t);try{for(var l=d(e),a=l.next();!a.done;a=l.next()){var u=a.value,c=u.options;if(c)try{for(var p=(o=void 0,d(c)),h=p.next();!h.done;h=p.next()){var f=h.value;if(s){if(!f.disabled)return f.value}else s=f.value===t}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}else{f=u;if(s){if(!f.disabled)return f.value}else s=f.value===t}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return s?t:null}function v(e){return null==e}function h(e,t,r,n){if(v(e))return t.scrollTop=0;var o,i=function(e,t){var r,n,o=0;try{for(var i=d(e),s=i.next();!s.done;s=i.next()){var l=s.value,a=l.options;if(a){o++;var u=a.findIndex(function(e){return e.value===t});if(-1!==u)return o+u;o+=a.length}else{if(l.value===t)return o;o++}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return 0}(r,e);return 5<i-n?(n+=i-n-5,(o=t.querySelectorAll("li").item(i))&&(t.scrollTop=o.offsetTop-t.offsetHeight),n):0<n-i?(n-=n-i,(o=t.querySelectorAll("li").item(n-1))&&(t.scrollTop=o.offsetTop),n):null}function f(e,t,r){return!t||null!==m(e).match(new RegExp(function(e,t){e=m(function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(e)),t&&"function"==typeof t&&(e=t(e));return e}(t,r),"i"))}function m(e){var t,r;try{for(var n=d(s),o=n.next();!o.done;o=n.next()){var i=o.value;e=e.replace(i.s,i.l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return e}function y(e,t,r){var n,o;if(t){var i=[];try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a=l.value,u=a.options;if(u){if(u.some(function(e){return f(e.label,t,r)})){var c=u.filter(function(e){return f(e.label,t,r)});i.push({label:a.label,options:c})}}else f(a.label,t,r)&&i.push(a)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return i}return e}function g(e,t){var r=e.classes?" "+e.classes:"";return e.value===t?"select2-results__option select2-results__option--highlighted"+r:"select2-results__option"+r}function S(e){return e?"select2-container select2-container--default select2-container-dropdown select2-container--open":"select2-container select2-container--default select2-container-dropdown"}function b(e,t){return void 0===e&&(e=void 0),"select2 select2-container select2-container--default "+(e?"select2-container--disabled":"")+" "+(t?"select2-container--open":"")+" select2-container--below select2-container--focus"}function x(e){return void 0===e&&(e=void 0),"select2-selection select2-selection--"+(e?"multiple":"single")}function E(e,t){return"number"!=typeof t&&(t=6),function(e){var t,r,n=0;try{for(var o=d(e),i=o.next();!i.done;i=o.next()){var s=i.value.options;s?n+=s.length:n++}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}(e)<t}function T(e){return e?"select2-search select2-search--dropdown select2-search--hide":"select2-search select2-search--dropdown"}function O(e,t,r){return r?e&&e.some(function(e){return e.value===t.value})?"true":"false":e&&t.value===e.value?"true":"false"}function k(e,t){for(var r=0;r<e.length;r++)if(e[r].value===t.value)return void e.splice(r,1)}var V,_=(r(N,V=l.PureComponent),Object.defineProperty(N.prototype,"searchText",{get:function(){return this.innerSearchText},set:function(e){this.props.customSearchEnabled&&this.props.search&&this.props.search(e),this.innerSearchText=e},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"dropdownStyle",{get:function(){return S(this.isOpen)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"containerStyle",{get:function(){return b(this.props.disabled,this.isOpen)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"selectionStyle",{get:function(){return x(this.props.multiple)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isSearchboxHidden",{get:function(){return!this.props.customSearchEnabled&&E(this.props.data,this.props.minCountForSearch)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"searchStyle",{get:function(){return T(this.isSearchboxHidden)},enumerable:!1,configurable:!0}),N.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;e.value!==this.value&&(this.value=e.value,this.setState({value:e.value},function(){t.updateOptionAndHoveringValue()}))},N.prototype.updateOptionAndHoveringValue=function(){var e=o(this.props.data,this.value,this.props.multiple);null!==e&&(this.option=e,this.setState({option:this.option})),Array.isArray(e)||(this.hoveringValue=this.value),this.setState({hoveringValue:this.hoveringValue})},N.prototype.UNSAFE_componentWillMount=function(){this.updateOptionAndHoveringValue()},N.prototype.componentDidMount=function(){var e=t.findDOMNode(this);this.searchInputElement=e.childNodes[1].childNodes[0].childNodes[0].childNodes[0],this.resultsElement=e.childNodes[1].childNodes[0].childNodes[1].childNodes[0],this.mounted=!0,this.value=this.props.value},N.prototype.componentWillUnmount=function(){this.mounted=!1,this.cancelFocusoutTimer()},N.prototype.render=function(){var t=this,e=this.renderResult(),r=this.renderSelection();return l.createElement("div",{className:this.containerStyle},l.createElement("div",{className:"selection",onClick:function(){return t.toggleOpenAndClose()}},l.createElement("div",{className:this.selectionStyle,role:"combobox"},r)),l.createElement("div",{className:this.dropdownStyle},l.createElement("div",{className:"select2-dropdown select2-dropdown--below"},l.createElement("div",{className:this.searchStyle},l.createElement("input",{value:this.searchText,onChange:this.onChange,onKeyDown:function(e){return t.keyDown(e)},onKeyUp:function(e){return t.keyUp(e)},onKeyPress:function(e){return t.keyPress(e)},onBlur:function(){return t.focusout()},className:"select2-search__field",type:"search",role:"textbox",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",maxLength:this.props.maximumInputLength,spellCheck:!1})),l.createElement("div",{className:"select2-results"},l.createElement("ul",{className:"select2-results__options",role:"tree",tabIndex:-1,onKeyDown:function(e){return t.keyDown(e)},onFocus:function(){return t.cancelFocusoutTimer()},onBlur:function(){return t.focusout()}},e)))))},N.prototype.renderSelection=function(){var r=this;if(this.props.multiple){var e=this.option.map(function(t,e){return l.createElement("li",{className:"select2-selection__choice",title:t.label,key:e},l.createElement("span",{onClick:function(e){return r.removeSelection(e,t)},className:"select2-selection__choice__remove",role:"presentation"},"×"),t.label)});return l.createElement("ul",{className:"select2-selection__rendered"},e)}var t=this.option,n=t?t.component?l.createElement(t.component,{option:t}):t.label:l.createElement("span",{className:"select2-selection__placeholder"},this.props.placeholder);return[l.createElement("span",{key:"label",className:"select2-selection__rendered",title:t?t.label:""},n),l.createElement("span",{key:"arrow",className:"select2-selection__arrow",role:"presentation"},l.createElement("b",{role:"presentation"}))]},N.prototype.renderResult=function(){var s=this;return this.getFilteredData(!1).map(function(e,t){var r=e.options;if(r){var n=r.map(function(e,t){var r=e.component?l.createElement(e.component,{option:e}):e.label;return l.createElement("li",{className:s.getOptionStyle(e),key:t,role:"treeitem","aria-selected":s.isSelected(e),"aria-disabled":s.isDisabled(e),onMouseEnter:function(){return s.mouseenter(e)},onClick:function(){return s.click(e)}},r)});return l.createElement("li",{className:"select2-results__option",role:"group",key:t},l.createElement("strong",{className:"select2-results__group"},e.label),l.createElement("ul",{className:"select2-results__options select2-results__options--nested"},n))}var o=e,i=o.component?l.createElement(o.component,{option:o}):o.label;return l.createElement("li",{className:s.getOptionStyle(o),key:t,role:"treeitem","aria-selected":s.isSelected(o),"aria-disabled":s.isDisabled(o),onMouseEnter:function(){return s.mouseenter(o)},onClick:function(){return s.click(o)}},i)})},N.prototype.getFilteredData=function(e){var t=this.props.customSearchEnabled||this.props.minimumInputLength&&this.props.minimumInputLength>this.searchText.length?this.props.data:y(this.props.data,this.searchText);if(a(t,this.hoveringValue)&&(this.hoveringValue=i(t),e&&this.setState({hoveringValue:this.hoveringValue}),this.resultsElement)){var r=h(this.hoveringValue,this.resultsElement,t,this.lastScrollTopIndex);null!==r&&(this.lastScrollTopIndex=r,e&&this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}return t},N.prototype.getOptionStyle=function(e){return g(e,this.hoveringValue)},N.prototype.mouseenter=function(e){e.disabled||(this.hoveringValue=e.value,this.setState({hoveringValue:this.hoveringValue}))},N.prototype.click=function(e){e.disabled||this.select(e),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N.prototype.toggleOpenAndClose=function(){var t=this;this.props.disabled||(this.isOpen=!this.isOpen,this.setState({isOpen:this.isOpen}),this.isOpen&&(this.props.keepSearchText||(this.innerSearchText=""),this.setState({searchText:this.searchText},function(){if(t.focusSearchboxOrResultsElement(),t.resultsElement){var e=h(t.hoveringValue,t.resultsElement,t.props.data,t.lastScrollTopIndex);null!==e&&(t.lastScrollTopIndex=e)}}),this.props.open&&this.props.open()),this.focusoutTimer&&clearTimeout(this.focusoutTimer))},N.prototype.focusout=function(){var e=this;this.focusoutTimer=setTimeout(function(){e.isOpen=!1,e.mounted&&e.setState({isOpen:e.isOpen}),e.focusoutTimer=void 0},200)},N.prototype.moveUp=function(){if(this.hoveringValue=u(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),this.resultsElement){var e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex);null!==e&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}},N.prototype.moveDown=function(){if(this.hoveringValue=p(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),this.resultsElement){var e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex);null!==e&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}},N.prototype.selectByEnter=function(){if(this.hoveringValue){var e=c(this.props.data,this.hoveringValue);this.select(e)}},N.prototype.select=function(t){if(null!==t)if(this.props.multiple){var e=this.option,r=e.findIndex(function(e){return e.value===t.value});-1===r?e.push(t):e.splice(r,1),this.setState({option:this.option})}else this.option=t,this.isOpen=!1,this.setState({option:this.option,isOpen:this.isOpen});this.props.update&&this.props.update(this.props.multiple?this.option.map(function(e){return e.value}):this.option.value)},N.prototype.keyDown=function(e){this.props.keydown&&this.props.keydown(e),40===e.keyCode?(this.moveDown(),e.preventDefault()):38===e.keyCode?(this.moveUp(),e.preventDefault()):13===e.keyCode&&(this.selectByEnter(),e.preventDefault())},N.prototype.keyUp=function(e){this.props.keyup&&this.props.keyup(e)},N.prototype.keyPress=function(e){this.props.keypress&&this.props.keypress(e)},N.prototype.isSelected=function(e){return O(this.option,e,this.props.multiple)},N.prototype.isDisabled=function(e){return e.disabled?"true":"false"},N.prototype.focusSearchboxOrResultsElement=function(){this.isSearchboxHidden?this.resultsElement&&this.resultsElement.focus():this.searchInputElement&&this.searchInputElement.focus()},N.prototype.removeSelection=function(e,t){var r=this;k(this.option,t),this.props.update&&this.props.update(this.option.map(function(e){return e.value})),e.preventDefault(),e.stopPropagation(),this.isOpen&&this.setState({option:this.option},function(){r.focusSearchboxOrResultsElement()}),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N.prototype.cancelFocusoutTimer=function(){this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N);function N(){var t=null!==V&&V.apply(this,arguments)||this;return t.hoveringValue=null,t.option=null,t.isOpen=!1,t.innerSearchText="",t.lastScrollTopIndex=0,t.value=t.props.value,t.onChange=function(e){t.searchText=e.currentTarget.value,t.setState({searchText:t.searchText})},t}var w,D=(r(I,w=l.PureComponent),Object.defineProperty(I.prototype,"dropdownStyle",{get:function(){return S(this.isOpen&&0<this.props.data.length)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"containerStyle",{get:function(){return b(!1,this.isOpen&&0<this.props.data.length)},enumerable:!1,configurable:!0}),I.prototype.UNSAFE_componentWillMount=function(){var e=o(this.props.data,this.props.value,!1);null!==e&&(this.option=e,this.setState({option:this.option})),Array.isArray(e)||(this.hoveringValue=this.props.value),this.setState({hoveringValue:this.hoveringValue})},I.prototype.componentDidMount=function(){var e=t.findDOMNode(this);this.searchInputElement=e.childNodes[0].childNodes[0].childNodes[0].childNodes[0],this.resultsElement=e.childNodes[1].childNodes[0].childNodes[0].childNodes[0]},I.prototype.render=function(){var t=this,e=this.renderResult();return l.createElement("div",{className:this.containerStyle},l.createElement("div",{className:"selection"},l.createElement("div",{className:"select2-search select2-search--dropdown"},l.createElement("input",{value:this.props.value,onChange:this.onChange,onKeyDown:function(e){return t.keyDown(e)},onKeyUp:function(e){return t.keyUp(e)},onKeyPress:function(e){return t.keyPress(e)},onBlur:function(){return t.focusout()},onClick:function(){return t.toggleOpenAndClose()},className:"select2-search__field",type:"search",role:"textbox",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))),l.createElement("div",{className:this.dropdownStyle},l.createElement("div",{className:"select2-dropdown"},l.createElement("div",{className:"select2-results"},l.createElement("ul",{className:"select2-results__options",role:"tree",tabIndex:-1,onKeyDown:function(e){return t.keyDown(e)}},e)))))},I.prototype.renderResult=function(){var s=this;return this.getFilteredData(!1).map(function(e,t){var r=e.options;if(r){var n=r.map(function(e,t){var r=e.component?l.createElement(e.component,{option:e}):e.label;return l.createElement("li",{className:s.getOptionStyle(e),key:t,role:"treeitem","aria-selected":s.isSelected(e),"aria-disabled":s.isDisabled(e),onMouseEnter:function(){return s.mouseenter(e)},onClick:function(){return s.click(e)}},r)});return l.createElement("li",{className:"select2-results__option",role:"group",key:t},l.createElement("strong",{className:"select2-results__group"},e.label),l.createElement("ul",{className:"select2-results__options select2-results__options--nested"},n))}var o=e,i=o.component?l.createElement(o.component,{option:o}):o.label;return l.createElement("li",{className:s.getOptionStyle(o),key:t,role:"treeitem","aria-selected":s.isSelected(o),"aria-disabled":s.isDisabled(o),onMouseEnter:function(){return s.mouseenter(o)},onClick:function(){return s.click(o)}},i)})},I.prototype.getFilteredData=function(e){var t=this.props.data;if(a(t,this.hoveringValue)&&(this.hoveringValue=i(t),e&&this.setState({hoveringValue:this.hoveringValue}),this.resultsElement)){var r=h(this.hoveringValue,this.resultsElement,t,this.lastScrollTopIndex);null!==r&&(this.lastScrollTopIndex=r,e&&this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}return t},I.prototype.getOptionStyle=function(e){return g(e,this.hoveringValue)},I.prototype.mouseenter=function(e){e.disabled||(this.hoveringValue=e.value,this.setState({hoveringValue:this.hoveringValue}))},I.prototype.click=function(e){e.disabled||this.select(e),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},I.prototype.toggleOpenAndClose=function(){if(this.isOpen=!this.isOpen,this.setState({isOpen:this.isOpen}),this.isOpen&&(this.focusSearchboxOrResultsElement(),this.resultsElement)){var e=h(this.hoveringValue,this.resultsElement,this.props.data,this.lastScrollTopIndex);null!==e&&(this.lastScrollTopIndex=e)}this.focusoutTimer&&clearTimeout(this.focusoutTimer)},I.prototype.focusout=function(){var e=this;this.focusoutTimer=setTimeout(function(){e.isOpen=!1,e.setState({isOpen:e.isOpen}),e.focusoutTimer=void 0},200)},I.prototype.moveUp=function(){if(this.hoveringValue=u(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),this.resultsElement){var e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex);null!==e&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}},I.prototype.moveDown=function(){if(this.hoveringValue=p(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),this.resultsElement){var e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex);null!==e&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))}},I.prototype.selectByEnter=function(){if(this.hoveringValue){var e=c(this.props.data,this.hoveringValue);this.select(e)}},I.prototype.select=function(e){null!==e&&(this.option=e,this.isOpen=!1,this.setState({option:this.option,isOpen:this.isOpen})),this.props.select&&this.props.select(this.option.value),this.props.update&&this.props.update(this.option.value)},I.prototype.keyDown=function(e){this.props.keydown&&this.props.keydown(e),40===e.keyCode?(this.moveDown(),e.preventDefault()):38===e.keyCode?(this.moveUp(),e.preventDefault()):13===e.keyCode&&(this.selectByEnter(),e.preventDefault())},I.prototype.keyUp=function(e){this.props.keyup&&this.props.keyup(e)},I.prototype.keyPress=function(e){this.props.keypress&&this.props.keypress(e)},I.prototype.isSelected=function(e){return O(this.option,e,!1)},I.prototype.isDisabled=function(e){return e.disabled?"true":"false"},I.prototype.focusSearchboxOrResultsElement=function(){this.searchInputElement&&this.searchInputElement.focus()},I);function I(){var t=null!==w&&w.apply(this,arguments)||this;return t.hoveringValue=null,t.option=null,t.isOpen=!1,t.lastScrollTopIndex=0,t.onChange=function(e){t.props.search&&t.props.search(e.currentTarget.value),t.props.update&&t.props.update(e.currentTarget.value)},t}e.AutoComplete=D,e.Select2=_,e.getContainerStyle=b,e.getDropdownStyle=S,e.getFilteredData=y,e.getFirstAvailableOption=i,e.getLastScrollTopIndex=h,e.getNextOption=p,e.getOptionByValue=c,e.getOptionStyle=g,e.getOptionsByValue=o,e.getPreviousOption=u,e.getSearchStyle=T,e.getSelectionStyle=x,e.isSearchboxHiddex=E,e.isSelected=O,e.removeSelection=k,e.timeout=200,e.valueIsNotInFilteredData=a,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Select2={},e.React,e.ReactDOM)}(this,function(e,l,t){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)};function o(e,t){function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],n=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var s=[{l:"a",s:/[ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ]/gi},{l:"aa",s:/ꜳ/gi},{l:"ae",s:/[æǽǣ]/gi},{l:"ao",s:/ꜵ/gi},{l:"au",s:/ꜷ/gi},{l:"av",s:/[ꜹꜻ]/gi},{l:"ay",s:/ꜽ/gi},{l:"b",s:/[ⓑbḃḅḇƀƃɓ]/gi},{l:"c",s:/[ⓒcćĉċčçḉƈȼꜿↄ]/gi},{l:"d",s:/[ⓓdḋďḍḑḓḏđƌɖɗꝺ]/gi},{l:"dz",s:/[dzdž]/gi},{l:"e",s:/[ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ]/gi},{l:"f",s:/[ⓕfḟƒꝼ]/gi},{l:"g",s:/[ⓖgǵĝḡğġǧģǥɠꞡᵹꝿ]/gi},{l:"h",s:/[ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ]/gi},{l:"hv",s:/ƕ/gi},{l:"i",s:/[ⓘiìíîĩīĭİïḯỉǐȉȋịįḭɨı]/gi},{l:"j",s:/[ⓙjĵǰɉ]/gi},{l:"k",s:/[ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ]/gi},{l:"l",s:/[ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇꝆ]/gi},{l:"lj",s:/lj/gi},{l:"m",s:/[ⓜmḿṁṃɱɯ]/gi},{l:"n",s:/[ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ]/gi},{l:"nj",s:/nj/gi},{l:"o",s:/[ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔƟꝋꝍɵ]/gi},{l:"oi",s:/ƣ/gi},{l:"oe",s:/œ/gi},{l:"oo",s:/ꝏ/gi},{l:"ou",s:/ȣ/gi},{l:"p",s:/[ⓟpṕṗƥᵽꝑꝓꝕ]/gi},{l:"q",s:/[ⓠqɋꝗꝙ]/gi},{l:"r",s:/[ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ]/gi},{l:"s",s:/[ⓢsßẞśṥŝṡšṧṣṩșşȿꞩꞅẛ]/gi},{l:"t",s:/[ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ]/gi},{l:"tz",s:/ꜩ/gi},{l:"u",s:/[ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ]/gi},{l:"v",s:/[ⓥvṽṿʋꝟʌ]/gi},{l:"vy",s:/ꝡ/gi},{l:"w",s:/[ⓦwẁẃŵẇẅẘẉⱳ]/gi},{l:"x",s:/[ⓧxẋẍ]/gi},{l:"y",s:/[ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ]/gi},{l:"z",s:/[ⓩzźẑżžẓẕƶȥɀⱬꝣ]/gi}];function c(e,t){var o,n,r,i;try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a=l.value,u=a.options;if(u)try{for(var c=(r=void 0,d(u)),p=c.next();!p.done;p=c.next()){var h=p.value;if(h.value===t)return h}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}else if(a.value===t)return a}}catch(e){o={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return null}function r(e,t,o){var n,r;if(o){var i=Array.isArray(t)?t:[],s=[];try{for(var l=d(i),a=l.next();!a.done;a=l.next()){var u=c(e,a.value);u&&s.push(u)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return s}return c(e,t)}function i(e){var t,o,n,r;try{for(var i=d(e),s=i.next();!s.done;s=i.next()){var l=s.value,a=l.options;if(a)try{for(var u,c=(n=void 0,d(a)),p=c.next();!p.done;p=c.next()){if(!(u=p.value).disabled)return u.value}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}else if(!(u=l).disabled)return u.value}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(t)throw t.error}}return null}function a(e,t){var o,n,r,i;if(v(t))return!0;try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a=l.value,u=a.options;if(u)try{for(var c=(r=void 0,d(u)),p=c.next();!p.done;p=c.next()){if(p.value.value===t)return!1}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}else if(a.value===t)return!1}}catch(e){o={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return!0}function u(e,t){for(var o=v(t),n=e.length-1;0<=n;n--){var r=e[n],i=r.options;if(i)for(var s=i.length-1;0<=s;s--){var l=i[s];if(o&&!l.disabled)return l.value;o=l.value===t}else{l=r;if(o&&!l.disabled)return l.value;o=l.value===t}}return o?t:null}function p(e,t){var o,n,r,i,s=v(t);try{for(var l=d(e),a=l.next();!a.done;a=l.next()){var u=a.value,c=u.options;if(c)try{for(var p=(r=void 0,d(c)),h=p.next();!h.done;h=p.next()){var f=h.value;if(s){if(!f.disabled)return f.value}else s=f.value===t}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}else{f=u;if(s){if(!f.disabled)return f.value}else s=f.value===t}}}catch(e){o={error:e}}finally{try{a&&!a.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}return s?t:null}function v(e){return null==e}function h(e,t,o,n){if(v(e))return t.scrollTop=0;var r,i=function(e,t){var o,n,r=0;try{for(var i=d(e),s=i.next();!s.done;s=i.next()){var l=s.value,a=l.options;if(a){r++;var u=a.findIndex(function(e){return e.value===t});if(-1!==u)return r+u;r+=a.length}else{if(l.value===t)return r;r++}}}catch(e){o={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return 0}(o,e);return 5<i-n?(n+=i-n-5,(r=t.querySelectorAll("li").item(i))&&(t.scrollTop=r.offsetTop-t.offsetHeight),n):0<n-i?(n-=n-i,(r=t.querySelectorAll("li").item(n-1))&&(t.scrollTop=r.offsetTop),n):null}function f(e,t,o){return!t||null!==m(e).match(new RegExp(function(e,t){e=m(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")),t&&"function"==typeof t&&(e=t(e));return e}(t,o),"i"))}function m(e){var t,o;try{for(var n=d(s),r=n.next();!r.done;r=n.next()){var i=r.value;e=e.replace(i.s,i.l)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return e}function y(e,t,o){var n,r;if(t){var i=[];try{for(var s=d(e),l=s.next();!l.done;l=s.next()){var a,u=l.value,c=u.options;c?c.some(function(e){return f(e.label,t,o)})&&(a=c.filter(function(e){return f(e.label,t,o)}),i.push({label:u.label,options:a})):f(u.label,t,o)&&i.push(u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}return e}function g(e,t){var o=e.classes?" "+e.classes:"";return e.value===t?"select2-results__option select2-results__option--highlighted"+o:"select2-results__option"+o}function S(e){return e?"select2-container select2-container--default select2-container-dropdown select2-container--open":"select2-container select2-container--default select2-container-dropdown"}function b(e,t){return void 0===e&&(e=void 0),"select2 select2-container select2-container--default "+(e?"select2-container--disabled":"")+" "+(t?"select2-container--open":"")+" select2-container--below select2-container--focus"}function x(e){return void 0===e&&(e=void 0),"select2-selection select2-selection--"+(e?"multiple":"single")}function E(e,t){return"number"!=typeof t&&(t=6),function(e){var t,o,n=0;try{for(var r=d(e),i=r.next();!i.done;i=r.next()){var s=i.value.options;s?n+=s.length:n++}}catch(e){t={error:e}}finally{try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}return n}(e)<t}function T(e){return e?"select2-search select2-search--dropdown select2-search--hide":"select2-search select2-search--dropdown"}function O(e,t,o){return o?e&&e.some(function(e){return e.value===t.value})?"true":"false":e&&t.value===e.value?"true":"false"}function k(e,t){for(var o=0;o<e.length;o++)if(e[o].value===t.value)return void e.splice(o,1)}var V,_=(o(N,V=l.PureComponent),Object.defineProperty(N.prototype,"searchText",{get:function(){return this.innerSearchText},set:function(e){this.props.customSearchEnabled&&this.props.search&&this.props.search(e),this.innerSearchText=e},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"dropdownStyle",{get:function(){return S(this.isOpen)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"containerStyle",{get:function(){return b(this.props.disabled,this.isOpen)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"selectionStyle",{get:function(){return x(this.props.multiple)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"isSearchboxHidden",{get:function(){return!this.props.customSearchEnabled&&E(this.props.data,this.props.minCountForSearch)},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"searchStyle",{get:function(){return T(this.isSearchboxHidden)},enumerable:!1,configurable:!0}),N.prototype.UNSAFE_componentWillReceiveProps=function(e){var t=this;e.value!==this.value&&(this.value=e.value,this.setState({value:e.value},function(){t.updateOptionAndHoveringValue()}))},N.prototype.updateOptionAndHoveringValue=function(){var e=r(this.props.data,this.value,this.props.multiple);null!==e&&(this.option=e,this.setState({option:this.option})),Array.isArray(e)||(this.hoveringValue=this.value),this.setState({hoveringValue:this.hoveringValue})},N.prototype.UNSAFE_componentWillMount=function(){this.updateOptionAndHoveringValue()},N.prototype.componentDidMount=function(){var e=t.findDOMNode(this);this.searchInputElement=e.childNodes[1].childNodes[0].childNodes[0].childNodes[0],this.resultsElement=e.childNodes[1].childNodes[0].childNodes[1].childNodes[0],this.mounted=!0,this.value=this.props.value},N.prototype.componentWillUnmount=function(){this.mounted=!1,this.cancelFocusoutTimer()},N.prototype.render=function(){var t=this,e=this.renderResult(),o=this.renderSelection();return l.createElement("div",{className:this.containerStyle},l.createElement("div",{className:"selection",onClick:function(){return t.toggleOpenAndClose()}},l.createElement("div",{className:this.selectionStyle,role:"combobox"},o)),l.createElement("div",{className:this.dropdownStyle},l.createElement("div",{className:"select2-dropdown select2-dropdown--below"},l.createElement("div",{className:this.searchStyle},l.createElement("input",{value:this.searchText,onChange:this.onChange,onKeyDown:function(e){return t.keyDown(e)},onKeyUp:function(e){return t.keyUp(e)},onKeyPress:function(e){return t.keyPress(e)},onFocus:function(){return t.cancelFocusoutTimer()},onBlur:function(){return t.focusout()},className:"select2-search__field",type:"search",role:"textbox",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",maxLength:this.props.maximumInputLength,spellCheck:!1})),l.createElement("div",{className:"select2-results"},l.createElement("ul",{className:"select2-results__options",role:"tree",tabIndex:-1,onKeyDown:function(e){return t.keyDown(e)},onFocus:function(){return t.cancelFocusoutTimer()},onBlur:function(){return t.focusout()}},e)))))},N.prototype.renderSelection=function(){var o=this;if(this.props.multiple){var e=this.option.map(function(t,e){return l.createElement("li",{className:"select2-selection__choice",title:t.label,key:e},l.createElement("span",{onClick:function(e){return o.removeSelection(e,t)},className:"select2-selection__choice__remove",role:"presentation"},"×"),t.label)});return l.createElement("ul",{className:"select2-selection__rendered"},e)}var t=this.option,n=t?t.component?l.createElement(t.component,{option:t}):t.label:l.createElement("span",{className:"select2-selection__placeholder"},this.props.placeholder);return[l.createElement("span",{key:"label",className:"select2-selection__rendered",title:t?t.label:""},n),l.createElement("span",{key:"arrow",className:"select2-selection__arrow",role:"presentation"},l.createElement("b",{role:"presentation"}))]},N.prototype.renderResult=function(){var s=this;return this.getFilteredData(!1).map(function(e,t){var o=e.options;if(o){var n=o.map(function(e,t){var o=e.component?l.createElement(e.component,{option:e}):e.label;return l.createElement("li",{className:s.getOptionStyle(e),key:t,role:"treeitem","aria-selected":s.isSelected(e),"aria-disabled":s.isDisabled(e),onMouseEnter:function(){return s.mouseenter(e)},onClick:function(){return s.click(e)}},o)});return l.createElement("li",{className:"select2-results__option",role:"group",key:t},l.createElement("strong",{className:"select2-results__group"},e.label),l.createElement("ul",{className:"select2-results__options select2-results__options--nested"},n))}var r=e,i=r.component?l.createElement(r.component,{option:r}):r.label;return l.createElement("li",{className:s.getOptionStyle(r),key:t,role:"treeitem","aria-selected":s.isSelected(r),"aria-disabled":s.isDisabled(r),onMouseEnter:function(){return s.mouseenter(r)},onClick:function(){return s.click(r)}},i)})},N.prototype.getFilteredData=function(e){var t,o=this.props.customSearchEnabled||this.props.minimumInputLength&&this.props.minimumInputLength>this.searchText.length?this.props.data:y(this.props.data,this.searchText);return a(o,this.hoveringValue)&&(this.hoveringValue=i(o),e&&this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(t=h(this.hoveringValue,this.resultsElement,o,this.lastScrollTopIndex))&&(this.lastScrollTopIndex=t,e&&this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))),o},N.prototype.getOptionStyle=function(e){return g(e,this.hoveringValue)},N.prototype.mouseenter=function(e){e.disabled||(this.hoveringValue=e.value,this.setState({hoveringValue:this.hoveringValue}))},N.prototype.click=function(e){e.disabled||this.select(e),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N.prototype.toggleOpenAndClose=function(){var t=this;this.props.disabled||(this.isOpen=!this.isOpen,this.setState({isOpen:this.isOpen}),this.isOpen&&(this.props.keepSearchText||(this.innerSearchText=""),this.setState({searchText:this.searchText},function(){var e;t.focusSearchboxOrResultsElement(),!t.resultsElement||null!==(e=h(t.hoveringValue,t.resultsElement,t.props.data,t.lastScrollTopIndex))&&(t.lastScrollTopIndex=e)}),this.props.open&&this.props.open()),this.focusoutTimer&&clearTimeout(this.focusoutTimer))},N.prototype.focusout=function(){var e=this;this.focusoutTimer=setTimeout(function(){e.isOpen=!1,e.mounted&&e.setState({isOpen:e.isOpen}),e.focusoutTimer=void 0},200)},N.prototype.moveUp=function(){var e;this.hoveringValue=u(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex))&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))},N.prototype.moveDown=function(){var e;this.hoveringValue=p(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex))&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))},N.prototype.selectByEnter=function(){var e;this.hoveringValue&&(e=c(this.props.data,this.hoveringValue),this.select(e))},N.prototype.select=function(t){var e,o;null!==t&&(this.props.multiple?(-1===(o=(e=this.option).findIndex(function(e){return e.value===t.value}))?e.push(t):e.splice(o,1),this.setState({option:this.option})):(this.option=t,this.isOpen=!1,this.setState({option:this.option,isOpen:this.isOpen}))),this.props.update&&this.props.update(this.props.multiple?this.option.map(function(e){return e.value}):this.option.value)},N.prototype.keyDown=function(e){this.props.keydown&&this.props.keydown(e),40===e.keyCode?(this.moveDown(),e.preventDefault()):38===e.keyCode?(this.moveUp(),e.preventDefault()):13===e.keyCode&&(this.selectByEnter(),e.preventDefault())},N.prototype.keyUp=function(e){this.props.keyup&&this.props.keyup(e)},N.prototype.keyPress=function(e){this.props.keypress&&this.props.keypress(e)},N.prototype.isSelected=function(e){return O(this.option,e,this.props.multiple)},N.prototype.isDisabled=function(e){return e.disabled?"true":"false"},N.prototype.focusSearchboxOrResultsElement=function(){this.isSearchboxHidden?this.resultsElement&&this.resultsElement.focus():this.searchInputElement&&this.searchInputElement.focus()},N.prototype.removeSelection=function(e,t){var o=this;k(this.option,t),this.props.update&&this.props.update(this.option.map(function(e){return e.value})),e.preventDefault(),e.stopPropagation(),this.isOpen&&this.setState({option:this.option},function(){o.focusSearchboxOrResultsElement()}),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N.prototype.cancelFocusoutTimer=function(){this.focusoutTimer&&clearTimeout(this.focusoutTimer)},N);function N(){var t=null!==V&&V.apply(this,arguments)||this;return t.hoveringValue=null,t.option=null,t.isOpen=!1,t.innerSearchText="",t.lastScrollTopIndex=0,t.value=t.props.value,t.onChange=function(e){t.searchText=e.currentTarget.value,t.setState({searchText:t.searchText})},t}var w,D=(o(I,w=l.PureComponent),Object.defineProperty(I.prototype,"dropdownStyle",{get:function(){return S(this.isOpen&&0<this.props.data.length)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"containerStyle",{get:function(){return b(!1,this.isOpen&&0<this.props.data.length)},enumerable:!1,configurable:!0}),I.prototype.UNSAFE_componentWillMount=function(){var e=r(this.props.data,this.props.value,!1);null!==e&&(this.option=e,this.setState({option:this.option})),Array.isArray(e)||(this.hoveringValue=this.props.value),this.setState({hoveringValue:this.hoveringValue})},I.prototype.componentDidMount=function(){var e=t.findDOMNode(this);this.searchInputElement=e.childNodes[0].childNodes[0].childNodes[0].childNodes[0],this.resultsElement=e.childNodes[1].childNodes[0].childNodes[0].childNodes[0]},I.prototype.render=function(){var t=this,e=this.renderResult();return l.createElement("div",{className:this.containerStyle},l.createElement("div",{className:"selection"},l.createElement("div",{className:"select2-search select2-search--dropdown"},l.createElement("input",{value:this.props.value,onChange:this.onChange,onKeyDown:function(e){return t.keyDown(e)},onKeyUp:function(e){return t.keyUp(e)},onKeyPress:function(e){return t.keyPress(e)},onBlur:function(){return t.focusout()},onClick:function(){return t.toggleOpenAndClose()},className:"select2-search__field",type:"search",role:"textbox",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))),l.createElement("div",{className:this.dropdownStyle},l.createElement("div",{className:"select2-dropdown"},l.createElement("div",{className:"select2-results"},l.createElement("ul",{className:"select2-results__options",role:"tree",tabIndex:-1,onKeyDown:function(e){return t.keyDown(e)}},e)))))},I.prototype.renderResult=function(){var s=this;return this.getFilteredData(!1).map(function(e,t){var o=e.options;if(o){var n=o.map(function(e,t){var o=e.component?l.createElement(e.component,{option:e}):e.label;return l.createElement("li",{className:s.getOptionStyle(e),key:t,role:"treeitem","aria-selected":s.isSelected(e),"aria-disabled":s.isDisabled(e),onMouseEnter:function(){return s.mouseenter(e)},onClick:function(){return s.click(e)}},o)});return l.createElement("li",{className:"select2-results__option",role:"group",key:t},l.createElement("strong",{className:"select2-results__group"},e.label),l.createElement("ul",{className:"select2-results__options select2-results__options--nested"},n))}var r=e,i=r.component?l.createElement(r.component,{option:r}):r.label;return l.createElement("li",{className:s.getOptionStyle(r),key:t,role:"treeitem","aria-selected":s.isSelected(r),"aria-disabled":s.isDisabled(r),onMouseEnter:function(){return s.mouseenter(r)},onClick:function(){return s.click(r)}},i)})},I.prototype.getFilteredData=function(e){var t,o=this.props.data;return a(o,this.hoveringValue)&&(this.hoveringValue=i(o),e&&this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(t=h(this.hoveringValue,this.resultsElement,o,this.lastScrollTopIndex))&&(this.lastScrollTopIndex=t,e&&this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))),o},I.prototype.getOptionStyle=function(e){return g(e,this.hoveringValue)},I.prototype.mouseenter=function(e){e.disabled||(this.hoveringValue=e.value,this.setState({hoveringValue:this.hoveringValue}))},I.prototype.click=function(e){e.disabled||this.select(e),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},I.prototype.toggleOpenAndClose=function(){var e;this.isOpen=!this.isOpen,this.setState({isOpen:this.isOpen}),this.isOpen&&(this.focusSearchboxOrResultsElement(),!this.resultsElement||null!==(e=h(this.hoveringValue,this.resultsElement,this.props.data,this.lastScrollTopIndex))&&(this.lastScrollTopIndex=e)),this.focusoutTimer&&clearTimeout(this.focusoutTimer)},I.prototype.focusout=function(){var e=this;this.focusoutTimer=setTimeout(function(){e.isOpen=!1,e.setState({isOpen:e.isOpen}),e.focusoutTimer=void 0},200)},I.prototype.moveUp=function(){var e;this.hoveringValue=u(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex))&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))},I.prototype.moveDown=function(){var e;this.hoveringValue=p(this.getFilteredData(!0),this.hoveringValue),this.setState({hoveringValue:this.hoveringValue}),!this.resultsElement||null!==(e=h(this.hoveringValue,this.resultsElement,this.getFilteredData(!0),this.lastScrollTopIndex))&&(this.lastScrollTopIndex=e,this.setState({lastScrollTopIndex:this.lastScrollTopIndex}))},I.prototype.selectByEnter=function(){var e;this.hoveringValue&&(e=c(this.props.data,this.hoveringValue),this.select(e))},I.prototype.select=function(e){null!==e&&(this.option=e,this.isOpen=!1,this.setState({option:this.option,isOpen:this.isOpen})),this.props.select&&this.props.select(this.option.value),this.props.update&&this.props.update(this.option.value)},I.prototype.keyDown=function(e){this.props.keydown&&this.props.keydown(e),40===e.keyCode?(this.moveDown(),e.preventDefault()):38===e.keyCode?(this.moveUp(),e.preventDefault()):13===e.keyCode&&(this.selectByEnter(),e.preventDefault())},I.prototype.keyUp=function(e){this.props.keyup&&this.props.keyup(e)},I.prototype.keyPress=function(e){this.props.keypress&&this.props.keypress(e)},I.prototype.isSelected=function(e){return O(this.option,e,!1)},I.prototype.isDisabled=function(e){return e.disabled?"true":"false"},I.prototype.focusSearchboxOrResultsElement=function(){this.searchInputElement&&this.searchInputElement.focus()},I);function I(){var t=null!==w&&w.apply(this,arguments)||this;return t.hoveringValue=null,t.option=null,t.isOpen=!1,t.lastScrollTopIndex=0,t.onChange=function(e){t.props.search&&t.props.search(e.currentTarget.value),t.props.update&&t.props.update(e.currentTarget.value)},t}e.AutoComplete=D,e.Select2=_,e.getContainerStyle=b,e.getDropdownStyle=S,e.getFilteredData=y,e.getFirstAvailableOption=i,e.getLastScrollTopIndex=h,e.getNextOption=p,e.getOptionByValue=c,e.getOptionStyle=g,e.getOptionsByValue=r,e.getPreviousOption=u,e.getSearchStyle=T,e.getSelectionStyle=x,e.isSearchboxHiddex=E,e.isSelected=O,e.removeSelection=k,e.timeout=200,e.valueIsNotInFilteredData=a,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -119,3 +119,3 @@ import { __extends } from "tslib";

React.createElement("div", { className: this.searchStyle },
React.createElement("input", { value: this.searchText, onChange: this.onChange, onKeyDown: function (e) { return _this.keyDown(e); }, onKeyUp: function (e) { return _this.keyUp(e); }, onKeyPress: function (e) { return _this.keyPress(e); }, onBlur: function () { return _this.focusout(); }, className: 'select2-search__field', type: 'search', role: 'textbox', autoComplete: 'off', autoCorrect: 'off', autoCapitalize: 'off', maxLength: this.props.maximumInputLength, spellCheck: false })),
React.createElement("input", { value: this.searchText, onChange: this.onChange, onKeyDown: function (e) { return _this.keyDown(e); }, onKeyUp: function (e) { return _this.keyUp(e); }, onKeyPress: function (e) { return _this.keyPress(e); }, onFocus: function () { return _this.cancelFocusoutTimer(); }, onBlur: function () { return _this.focusout(); }, className: 'select2-search__field', type: 'search', role: 'textbox', autoComplete: 'off', autoCorrect: 'off', autoCapitalize: 'off', maxLength: this.props.maximumInputLength, spellCheck: false })),
React.createElement("div", { className: 'select2-results' },

@@ -122,0 +122,0 @@ React.createElement("ul", { className: 'select2-results__options', role: 'tree', tabIndex: -1, onKeyDown: function (e) { return _this.keyDown(e); }, onFocus: function () { return _this.cancelFocusoutTimer(); }, onBlur: function () { return _this.focusout(); } }, results))))));

{
"name": "select2-react-component",
"version": "5.10.2",
"version": "5.10.3",
"description": "A reactjs select component.",

@@ -20,5 +20,2 @@ "main": "dist/select2-react-component.min.js",

"homepage": "https://github.com/plantain-00/select2-component#readme",
"files": [
"dist"
],
"dependencies": {

@@ -28,9 +25,11 @@ "@types/node": "*",

"react-dom": "16",
"select2-component": "^5.10.2"
"select2-component": "^5.10.3"
},
"devDependencies": {
"@types/react": "16.9.41",
"@types/react": "16.9.49",
"@types/react-dom": "16.9.8"
},
"gitHead": "32b718924b102c0ad643abf3cfd26ac5028e7c54"
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc