react-select-custom-component
Version:
A highly customizable React dropdown component based on React Select, providing flexible and lightweight select input options.
32 lines (29 loc) • 33.1 kB
JavaScript
(function(H,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],C):(H=typeof globalThis<"u"?globalThis:H||self,C(H.MyReactTailwindPackage={},H.React))})(this,function(H,C){"use strict";var ue={exports:{}},q={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var xe;function De(){if(xe)return q;xe=1;var o=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,i,b){var w=null;if(b!==void 0&&(w=""+b),i.key!==void 0&&(w=""+i.key),"key"in i){b={};for(var g in i)g!=="key"&&(b[g]=i[g])}else b=i;return i=b.ref,{$$typeof:o,type:a,key:w,ref:i!==void 0?i:null,props:b}}return q.Fragment=t,q.jsx=n,q.jsxs=n,q}var ee={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Se;function Be(){return Se||(Se=1,process.env.NODE_ENV!=="production"&&function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case p:return"Portal";case A:return"Profiler";case k:return"StrictMode";case X:return"Suspense";case O:return"SuspenseList"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case V:return(e.displayName||"Context")+".Provider";case L:return(e._context.displayName||"Context")+".Consumer";case U:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return s=e.displayName||null,s!==null?s:o(e.type)||"Memo";case R:s=e._payload,e=e._init;try{return o(e(s))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var s=!1}catch{s=!0}if(s){s=console;var c=s.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),t(e)}}function a(){}function i(){if(F===0){ae=console.log,Ie=console.info,Ae=console.warn,Pe=console.error,Me=console.group,Le=console.groupCollapsed,We=console.groupEnd;var e={configurable:!0,enumerable:!0,value:a,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}F++}function b(){if(F--,F===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ae}),info:D({},e,{value:Ie}),warn:D({},e,{value:Ae}),error:D({},e,{value:Pe}),group:D({},e,{value:Me}),groupCollapsed:D({},e,{value:Le}),groupEnd:D({},e,{value:We})})}0>F&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function w(e){if(ge===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);ge=s&&s[1]||"",He=-1<c.stack.indexOf(`
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ge+e+He}function g(e,s){if(!e||ve)return"";var c=be.get(e);if(c!==void 0)return c;ve=!0,c=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var x=null;x=Y.H,Y.H=null,i();try{var M={DetermineComponentFrameRoot:function(){try{if(s){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(G){var ce=G}Reflect.construct(e,[],J)}else{try{J.call()}catch(G){ce=G}e.call(J.prototype)}}else{try{throw Error()}catch(G){ce=G}(J=e())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(G){if(G&&ce&&typeof G.stack=="string")return[G.stack,ce.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=M.DetermineComponentFrameRoot(),B=h[0],$=h[1];if(B&&$){var W=B.split(`
`),Z=$.split(`
`);for(h=j=0;j<W.length&&!W[j].includes("DetermineComponentFrameRoot");)j++;for(;h<Z.length&&!Z[h].includes("DetermineComponentFrameRoot");)h++;if(j===W.length||h===Z.length)for(j=W.length-1,h=Z.length-1;1<=j&&0<=h&&W[j]!==Z[h];)h--;for(;1<=j&&0<=h;j--,h--)if(W[j]!==Z[h]){if(j!==1||h!==1)do if(j--,h--,0>h||W[j]!==Z[h]){var ie=`
`+W[j].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),typeof e=="function"&&be.set(e,ie),ie}while(1<=j&&0<=h);break}}}finally{ve=!1,Y.H=x,b(),Error.prepareStackTrace=c}return W=(W=e?e.displayName||e.name:"")?w(W):"",typeof e=="function"&&be.set(e,W),W}function y(e){if(e==null)return"";if(typeof e=="function"){var s=e.prototype;return g(e,!(!s||!s.isReactComponent))}if(typeof e=="string")return w(e);switch(e){case X:return w("Suspense");case O:return w("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case U:return e=g(e.render,!1),e;case P:return y(e.type);case R:s=e._payload,e=e._init;try{return y(e(s))}catch{}}return""}function T(){var e=Y.A;return e===null?null:e.getOwner()}function N(e){if(oe.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function E(e,s){function c(){Fe||(Fe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function m(){var e=o(this.type);return Ue[e]||(Ue[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function I(e,s,c,x,M,j){return c=j.ref,e={$$typeof:_,type:e,key:s,props:j,_owner:M},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:m}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function z(e,s,c,x,M,j){if(typeof e=="string"||typeof e=="function"||e===S||e===A||e===k||e===X||e===O||e===te||typeof e=="object"&&e!==null&&(e.$$typeof===R||e.$$typeof===P||e.$$typeof===V||e.$$typeof===L||e.$$typeof===U||e.$$typeof===pe||e.getModuleId!==void 0)){var h=s.children;if(h!==void 0)if(x)if(Q(h)){for(x=0;x<h.length;x++)r(h[x],e);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else r(h,e)}else h="",(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(h+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),e===null?x="null":Q(e)?x="array":e!==void 0&&e.$$typeof===_?(x="<"+(o(e.type)||"Unknown")+" />",h=" Did you accidentally export a JSX literal instead of a component?"):x=typeof e,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,h);if(oe.call(s,"key")){h=o(e);var B=Object.keys(s).filter(function(W){return W!=="key"});x=0<B.length?"{key: someKey, "+B.join(": ..., ")+": ...}":"{key: someKey}",Ve[h+x]||(B=0<B.length?"{"+B.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,x,h,B,h),Ve[h+x]=!0)}if(h=null,c!==void 0&&(n(c),h=""+c),N(s)&&(n(s.key),h=""+s.key),"key"in s){c={};for(var $ in s)$!=="key"&&(c[$]=s[$])}else c=s;return h&&E(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),I(e,h,j,M,T(),c)}function r(e,s){if(typeof e=="object"&&e&&e.$$typeof!==ht){if(Q(e))for(var c=0;c<e.length;c++){var x=e[c];u(x)&&l(x,s)}else if(u(e))e._store&&(e._store.validated=1);else if(e===null||typeof e!="object"?c=null:(c=re&&e[re]||e["@@iterator"],c=typeof c=="function"?c:null),typeof c=="function"&&c!==e.entries&&(c=c.call(e),c!==e))for(;!(e=c.next()).done;)u(e.value)&&l(e.value,s)}}function u(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function l(e,s){if(e._store&&!e._store.validated&&e.key==null&&(e._store.validated=1,s=f(s),!Ye[s])){Ye[s]=!0;var c="";e&&e._owner!=null&&e._owner!==T()&&(c=null,typeof e._owner.tag=="number"?c=o(e._owner.type):typeof e._owner.name=="string"&&(c=e._owner.name),c=" It was passed a child from "+c+".");var x=Y.getCurrentStack;Y.getCurrentStack=function(){var M=y(e.type);return x&&(M+=x()||""),M},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',s,c),Y.getCurrentStack=x}}function f(e){var s="",c=T();return c&&(c=o(c.type))&&(s=`
Check the render method of \``+c+"`."),s||(e=o(e))&&(s=`
Check the top-level render call using <`+e+">."),s}var v=C,_=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),V=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),re=Symbol.iterator,ne=Symbol.for("react.client.reference"),Y=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=Object.prototype.hasOwnProperty,D=Object.assign,pe=Symbol.for("react.client.reference"),Q=Array.isArray,F=0,ae,Ie,Ae,Pe,Me,Le,We;a.__reactDisabledLog=!0;var ge,He,ve=!1,be=new(typeof WeakMap=="function"?WeakMap:Map),ht=Symbol.for("react.client.reference"),Fe,Ue={},Ve={},Ye={};ee.Fragment=S,ee.jsx=function(e,s,c,x,M){return z(e,s,c,!1,x,M)},ee.jsxs=function(e,s,c,x,M){return z(e,s,c,!0,x,M)}}()),ee}process.env.NODE_ENV==="production"?ue.exports=De():ue.exports=Be();var d=ue.exports;function Ge(o){const{title:t,mandatory:n,size:a="",color:i=""}=o;return d.jsxs("span",{className:"font-inter_medium text-[13px] lg:text-[14px] text-header_color",style:{fontSize:a,color:i},children:[t,n&&d.jsx("span",{className:"text-red-500",children:" *"})]})}const we=C.memo(Ge);function Je(o){const{selected:t,style:n,isMulti:a}=o;return d.jsx("ul",{className:"flex items-center gap-1 h-full w-[73%] line-clamp-1",children:a?(t==null?void 0:t.length)>0&&t.map((i,b)=>d.jsx("li",{className:"font-inter_medium",style:{color:n!=null&&n.color?n==null?void 0:n.color:"rgb(51, 51, 51)"},children:d.jsx("span",{className:"flex items-center",children:(t==null?void 0:t.length)-1!=b?`${i==null?void 0:i.name}, `:i==null?void 0:i.name})},i.id)):d.jsx("li",{className:"font-inter_medium",style:{color:n!=null&&n.color?n==null?void 0:n.color:"rgb(51, 51, 51)"},children:t==null?void 0:t.name})})}const ye=C.memo(Je),Xe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='chevron_right'%3e%3cmask%20id='mask0_1_10473'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='20'%20height='20'%3e%3crect%20id='Bounding%20box'%20x='20'%20width='20'%20height='20'%20transform='rotate(90%2020%200)'%20fill='%23D9D9D9'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1_10473)'%3e%3cpath%20id='chevron_right_2'%20d='M10.0001%2010.7886L13.3942%207.39418C13.5097%207.2789%2013.6547%207.21987%2013.8294%207.21709C14.004%207.21445%2014.1517%207.27348%2014.2726%207.39418C14.3933%207.51501%2014.4536%207.6614%2014.4536%207.83334C14.4536%208.00529%2014.3933%208.15168%2014.2726%208.27251L10.5274%2012.0177C10.4493%2012.0956%2010.367%2012.1506%2010.2805%2012.1827C10.194%2012.2148%2010.1005%2012.2308%2010.0001%2012.2308C9.89965%2012.2308%209.80618%2012.2148%209.71965%2012.1827C9.63313%2012.1506%209.55083%2012.0956%209.47278%2012.0177L5.72757%208.27251C5.61229%208.15709%205.55327%208.01202%205.55049%207.8373C5.54785%207.66272%205.60688%207.51501%205.72757%207.39418C5.8484%207.27348%205.99479%207.21313%206.16674%207.21313C6.33868%207.21313%206.48507%207.27348%206.6059%207.39418L10.0001%2010.7886Z'%20fill='%231C1B1F'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function Ze(o){const{selected:t,open:n}=o;return d.jsxs("div",{className:"absolute top-[1px] right-0 bottom-0 m-auto flex items-center",children:[(t==null?void 0:t.length)>0&&d.jsxs("span",{className:"text-[8px] text-gray-400",children:[t==null?void 0:t.length,"+ more"]}),d.jsx("img",{src:Xe,alt:"no image",className:`transition-all ${n&&"rotate-180"}`})]})}const Ee=C.memo(Ze);function fe(){return fe=Object.assign?Object.assign.bind():function(o){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(o[a]=n[a])}return o},fe.apply(null,arguments)}function Ce(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function de(o,t){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},de(o,t)}function Ke(o,t){o.prototype=Object.create(t.prototype),o.prototype.constructor=o,de(o,t)}var _e=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Qe(o,t){return!!(o===t||_e(o)&&_e(t))}function $e(o,t){if(o.length!==t.length)return!1;for(var n=0;n<o.length;n++)if(!Qe(o[n],t[n]))return!1;return!0}function he(o,t){t===void 0&&(t=$e);var n,a=[],i,b=!1;function w(){for(var g=[],y=0;y<arguments.length;y++)g[y]=arguments[y];return b&&n===this&&t(g,a)||(i=o.apply(this,g),b=!0,n=this,a=g),i}return w}var qe=typeof performance=="object"&&typeof performance.now=="function",Te=qe?function(){return performance.now()}:function(){return Date.now()};function Oe(o){cancelAnimationFrame(o.id)}function et(o,t){var n=Te();function a(){Te()-n>=t?o.call(null):i.id=requestAnimationFrame(a)}var i={id:requestAnimationFrame(a)};return i}var me=-1;function ke(o){if(o===void 0&&(o=!1),me===-1||o){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),me=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return me}var K=null;function je(o){if(o===void 0&&(o=!1),K===null||o){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var a=document.createElement("div"),i=a.style;return i.width="100px",i.height="100px",t.appendChild(a),document.body.appendChild(t),t.scrollLeft>0?K="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?K="negative":K="positive-ascending"),document.body.removeChild(t),K}return K}process.env.NODE_ENV;var tt=150,rt=function(t,n){return t},le=null,se=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(le=new WeakSet,se=new WeakSet);function nt(o){var t,n=o.getItemOffset,a=o.getEstimatedTotalSize,i=o.getItemSize,b=o.getOffsetForIndexAndAlignment,w=o.getStartIndexForOffset,g=o.getStopIndexForStartIndex,y=o.initInstanceProps,T=o.shouldResetStyleCacheOnItemSizeChange,N=o.validateProps;return t=function(E){Ke(m,E);function m(z){var r;return r=E.call(this,z)||this,r._instanceProps=y(r.props,Ce(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:Ce(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof r.props.initialScrollOffset=="number"?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=he(function(u,l,f,v){return r.props.onItemsRendered({overscanStartIndex:u,overscanStopIndex:l,visibleStartIndex:f,visibleStopIndex:v})}),r._callOnScroll=void 0,r._callOnScroll=he(function(u,l,f){return r.props.onScroll({scrollDirection:u,scrollOffset:l,scrollUpdateWasRequested:f})}),r._getItemStyle=void 0,r._getItemStyle=function(u){var l=r.props,f=l.direction,v=l.itemSize,_=l.layout,p=r._getItemStyleCache(T&&v,T&&_,T&&f),S;if(p.hasOwnProperty(u))S=p[u];else{var k=n(r.props,u,r._instanceProps),A=i(r.props,u,r._instanceProps),L=f==="horizontal"||_==="horizontal",V=f==="rtl",U=L?k:0;p[u]=S={position:"absolute",left:V?void 0:U,right:V?U:void 0,top:L?0:k,height:L?"100%":A,width:L?A:"100%"}}return S},r._getItemStyleCache=void 0,r._getItemStyleCache=he(function(u,l,f){return{}}),r._onScrollHorizontal=function(u){var l=u.currentTarget,f=l.clientWidth,v=l.scrollLeft,_=l.scrollWidth;r.setState(function(p){if(p.scrollOffset===v)return null;var S=r.props.direction,k=v;if(S==="rtl")switch(je()){case"negative":k=-v;break;case"positive-descending":k=_-f-v;break}return k=Math.max(0,Math.min(k,_-f)),{isScrolling:!0,scrollDirection:p.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(u){var l=u.currentTarget,f=l.clientHeight,v=l.scrollHeight,_=l.scrollTop;r.setState(function(p){if(p.scrollOffset===_)return null;var S=Math.max(0,Math.min(_,v-f));return{isScrolling:!0,scrollDirection:p.scrollOffset<S?"forward":"backward",scrollOffset:S,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(u){var l=r.props.outerRef;r._outerRef=u,typeof l=="function"?l(u):l!=null&&typeof l=="object"&&l.hasOwnProperty("current")&&(l.current=u)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&Oe(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=et(r._resetIsScrolling,tt)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}m.getDerivedStateFromProps=function(r,u){return ot(r,u),N(r),null};var I=m.prototype;return I.scrollTo=function(r){r=Math.max(0,r),this.setState(function(u){return u.scrollOffset===r?null:{scrollDirection:u.scrollOffset<r?"forward":"backward",scrollOffset:r,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},I.scrollToItem=function(r,u){u===void 0&&(u="auto");var l=this.props,f=l.itemCount,v=l.layout,_=this.state.scrollOffset;r=Math.max(0,Math.min(r,f-1));var p=0;if(this._outerRef){var S=this._outerRef;v==="vertical"?p=S.scrollWidth>S.clientWidth?ke():0:p=S.scrollHeight>S.clientHeight?ke():0}this.scrollTo(b(this.props,r,u,_,this._instanceProps,p))},I.componentDidMount=function(){var r=this.props,u=r.direction,l=r.initialScrollOffset,f=r.layout;if(typeof l=="number"&&this._outerRef!=null){var v=this._outerRef;u==="horizontal"||f==="horizontal"?v.scrollLeft=l:v.scrollTop=l}this._callPropsCallbacks()},I.componentDidUpdate=function(){var r=this.props,u=r.direction,l=r.layout,f=this.state,v=f.scrollOffset,_=f.scrollUpdateWasRequested;if(_&&this._outerRef!=null){var p=this._outerRef;if(u==="horizontal"||l==="horizontal")if(u==="rtl")switch(je()){case"negative":p.scrollLeft=-v;break;case"positive-ascending":p.scrollLeft=v;break;default:var S=p.clientWidth,k=p.scrollWidth;p.scrollLeft=k-S-v;break}else p.scrollLeft=v;else p.scrollTop=v}this._callPropsCallbacks()},I.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Oe(this._resetIsScrollingTimeoutId)},I.render=function(){var r=this.props,u=r.children,l=r.className,f=r.direction,v=r.height,_=r.innerRef,p=r.innerElementType,S=r.innerTagName,k=r.itemCount,A=r.itemData,L=r.itemKey,V=L===void 0?rt:L,U=r.layout,X=r.outerElementType,O=r.outerTagName,P=r.style,R=r.useIsScrolling,te=r.width,re=this.state.isScrolling,ne=f==="horizontal"||U==="horizontal",Y=ne?this._onScrollHorizontal:this._onScrollVertical,oe=this._getRangeToRender(),D=oe[0],pe=oe[1],Q=[];if(k>0)for(var F=D;F<=pe;F++)Q.push(C.createElement(u,{data:A,key:V(F,A),index:F,isScrolling:R?re:void 0,style:this._getItemStyle(F)}));var ae=a(this.props,this._instanceProps);return C.createElement(X||O||"div",{className:l,onScroll:Y,ref:this._outerRefSetter,style:fe({position:"relative",height:v,width:te,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:f},P)},C.createElement(p||S||"div",{children:Q,ref:_,style:{height:ne?"100%":ae,pointerEvents:re?"none":void 0,width:ne?ae:"100%"}}))},I._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var r=this.props.itemCount;if(r>0){var u=this._getRangeToRender(),l=u[0],f=u[1],v=u[2],_=u[3];this._callOnItemsRendered(l,f,v,_)}}if(typeof this.props.onScroll=="function"){var p=this.state,S=p.scrollDirection,k=p.scrollOffset,A=p.scrollUpdateWasRequested;this._callOnScroll(S,k,A)}},I._getRangeToRender=function(){var r=this.props,u=r.itemCount,l=r.overscanCount,f=this.state,v=f.isScrolling,_=f.scrollDirection,p=f.scrollOffset;if(u===0)return[0,0,0,0];var S=w(this.props,p,this._instanceProps),k=g(this.props,S,p,this._instanceProps),A=!v||_==="backward"?Math.max(1,l):1,L=!v||_==="forward"?Math.max(1,l):1;return[Math.max(0,S-A),Math.max(0,Math.min(u-1,k+L)),S,k]},m}(C.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ot=function(t,n){var a=t.children,i=t.direction,b=t.height,w=t.layout,g=t.innerTagName,y=t.outerTagName,T=t.width,N=n.instance;if(process.env.NODE_ENV!=="production"){(g!=null||y!=null)&&se&&!se.has(N)&&(se.add(N),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var E=i==="horizontal"||w==="horizontal";switch(i){case"horizontal":case"vertical":le&&!le.has(N)&&(le.add(N),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(w){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+w+'" was specified.'))}if(a==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(a===null?"null":typeof a)+'" was specified.'));if(E&&typeof T!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(T===null?"null":typeof T)+'" was specified.'));if(!E&&typeof b!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(b===null?"null":typeof b)+'" was specified.'))}},at=nt({getItemOffset:function(t,n){var a=t.itemSize;return n*a},getItemSize:function(t,n){var a=t.itemSize;return a},getEstimatedTotalSize:function(t){var n=t.itemCount,a=t.itemSize;return a*n},getOffsetForIndexAndAlignment:function(t,n,a,i,b,w){var g=t.direction,y=t.height,T=t.itemCount,N=t.itemSize,E=t.layout,m=t.width,I=g==="horizontal"||E==="horizontal",z=I?m:y,r=Math.max(0,T*N-z),u=Math.min(r,n*N),l=Math.max(0,n*N-z+N+w);switch(a==="smart"&&(i>=l-z&&i<=u+z?a="auto":a="center"),a){case"start":return u;case"end":return l;case"center":{var f=Math.round(l+(u-l)/2);return f<Math.ceil(z/2)?0:f>r+Math.floor(z/2)?r:f}case"auto":default:return i>=l&&i<=u?i:i<l?l:u}},getStartIndexForOffset:function(t,n){var a=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(a-1,Math.floor(n/i)))},getStopIndexForStartIndex:function(t,n,a){var i=t.direction,b=t.height,w=t.itemCount,g=t.itemSize,y=t.layout,T=t.width,N=i==="horizontal"||y==="horizontal",E=n*g,m=N?T:b,I=Math.ceil((m+a-E)/g);return Math.max(0,Math.min(w-1,n+I-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var n=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof n!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(n===null?"null":typeof n)+'" was specified.'))}});const it="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2026%2026'%20width='26px'%20fill='white'%20height='26px'%3e%3cpath%20d='M%2022.566406%204.730469%20L%2020.773438%203.511719%20C%2020.277344%203.175781%2019.597656%203.304688%2019.265625%203.796875%20L%2010.476563%2016.757813%20L%206.4375%2012.71875%20C%206.015625%2012.296875%205.328125%2012.296875%204.90625%2012.71875%20L%203.371094%2014.253906%20C%202.949219%2014.675781%202.949219%2015.363281%203.371094%2015.789063%20L%209.582031%2022%20C%209.929688%2022.347656%2010.476563%2022.613281%2010.96875%2022.613281%20C%2011.460938%2022.613281%2011.957031%2022.304688%2012.277344%2021.839844%20L%2022.855469%206.234375%20C%2023.191406%205.742188%2023.0625%205.066406%2022.566406%204.730469%20Z'/%3e%3c/svg%3e";function lt(o){const{extraData:t,selected:n,selectedAll:a,listItemStyle:i,lang:b,isMulti:w}=o,g=({index:y,style:T})=>{let N=w&&Array.isArray(n)?n==null?void 0:n.some(E=>E.id===t[y].id):n&&!Array.isArray(n)?(n==null?void 0:n.id)==t[y].id:!1;return d.jsxs("div",{title:t[y].name,className:`px-[7px] p-1 cursor-pointer hover:bg-gray-100 transition-all flex items-center gap-2 line-clamp-1 multiple-select-list-item ${y!==0&&w?"pl-3":""} ${N&&!w?"bg-gray-100 justify-between":""}`,style:{...T,color:y==0&&w?"gray":i!=null&&i.color?i==null?void 0:i.color:"gray",fontSize:i!=null&&i.size?i==null?void 0:i.size:"12px"},onClick:()=>o.changeSelectHandler(t[y]),children:[w&&d.jsx("div",{className:"w-3 h-3 flex items-center justify-center rounded-[2px] border",style:{backgroundColor:N||a?i.checkboxColor:"transparent"},children:(N||a)&&d.jsx("img",{src:it,alt:"check",className:"w-[10px]"})}),d.jsx("p",{className:"line-clamp-1",children:y===0&&a?b=="en"?"Cancel all":b=="ru"?"Отменить все":b=="uz"?"Hammasini bekor qilish":"Cancel all":t[y].name}),!w&&d.jsx("div",{className:"w-3 h-3 flex items-center justify-center",children:(N||a)&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 26 26",width:"26px",fill:i.checkboxColor,height:"26px",children:d.jsx("path",{d:"M 22.566406 4.730469 L 20.773438 3.511719 C 20.277344 3.175781 19.597656 3.304688 19.265625 3.796875 L 10.476563 16.757813 L 6.4375 12.71875 C 6.015625 12.296875 5.328125 12.296875 4.90625 12.71875 L 3.371094 14.253906 C 2.949219 14.675781 2.949219 15.363281 3.371094 15.789063 L 9.582031 22 C 9.929688 22.347656 10.476563 22.613281 10.96875 22.613281 C 11.460938 22.613281 11.957031 22.304688 12.277344 21.839844 L 22.855469 6.234375 C 23.191406 5.742188 23.0625 5.066406 22.566406 4.730469 Z"})})})]},t[y].id)};return d.jsx(d.Fragment,{children:(t==null?void 0:t.length)>0?d.jsx(d.Fragment,{children:d.jsx(at,{height:i.maxHeight,itemCount:t.length,itemSize:30,width:"100%",children:g})}):d.jsx("div",{children:d.jsx("p",{className:"text-gray-500 text-center",children:b=="ru"?"Информация не найдена":b=="en"?"Information not available":b=="uz"?"Ma'lumot topilmadi":"Information not available"})})})}const Ne=C.memo(lt);function st(o){const{placeholder:t}=o;return d.jsx("div",{className:"pl-1 h-full flex flex-col items-start justify-center",style:{color:t!=null&&t.color?t==null?void 0:t.color:"gray",fontSize:t!=null&&t.size?t==null?void 0:t.size:"12px"},children:t==null?void 0:t.name})}const ze=C.memo(st),ct="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11%2019C15.4183%2019%2019%2015.4183%2019%2011C19%206.58172%2015.4183%203%2011%203C6.58172%203%203%206.58172%203%2011C3%2015.4183%206.58172%2019%2011%2019Z'%20stroke='%23959595'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M21.0004%2020.9999L16.6504%2016.6499'%20stroke='%23959595'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";function ut(o){const{isSearch:t,lang:n}=o,a=()=>{o.searchChangeHandler(event.target.value)};return t&&d.jsx("div",{className:"flex items-center justify-center px-[6px] pt-[2px] bg-white z-10 dark:bg-dark mb-[4px] w-full multiple-select-search",children:d.jsxs("div",{className:"relative w-full",children:[d.jsx("input",{type:"search",name:"search",className:"border border-[#cfd3d586] h-[26px] w-full dark:border-gray-900 text-[11px] rounded placeholder-gray-500 dark:bg-dark focus:z-10 focus:outline-none pl-[26px] text-[#626262] placeholder:text-[11px]",placeholder:n=="ru"?"Поиск":n=="en"?"Search":n=="uz"?"Qidirish":"Search",onChange:i=>a(i.target.value)}),d.jsx("div",{className:"absolute top-0 left-2 bottom-0 pt-[7px]",children:d.jsx("img",{src:ct,alt:"no image",className:"w-[14px] text-[#130F26]"})})]})})}const Re=C.memo(ut);function ft(o){let{index:t=null,data_index:n=null,data:a=[],isMulti:i=!0,mandatory:b=!1,disabled:w=!1,title:g={name:"",size:"11px",color:"#475467"},placeholder:y={name:"Placeholder",size:"11px",color:"gray"},listItemStyle:T={color:"black",size:"11px",maxHeight:150,checkboxColor:"blue"},isSearch:N="true",lang:E="en",style:m,className:I="react-multiple-select",defaultValue:z=[]}=o;const[r,u]=C.useState([]),[l,f]=C.useState(z),[v,_]=C.useState(null),[p,S]=C.useState(!1),k=C.useRef(),A=C.useRef(),L=O=>{A.current&&!A.current.contains(O.target)&&(S(!1),(r==null?void 0:r.length)<(a==null?void 0:a.length)&&u((a==null?void 0:a.length)>0&&i?[{id:"all",name:E=="en"?"Select all":E=="ru"?"Выбрать все":E=="uz"?"Hammasini tanlash":"Select all"},...a]:a))};C.useEffect(()=>(document.addEventListener("mousedown",L),()=>{document.removeEventListener("mousedown",L)}),[]),C.useEffect(()=>{u((a==null?void 0:a.length)>0&&i?[{id:"all",name:E=="en"?"Select all":E=="ru"?"Выбрать все":E=="uz"?"Hammasini tanlash":"Select all"},...a]:a)},[a]);const V=C.useCallback(O=>{w||S(O)},[]),U=C.useCallback(O=>{var P;((P=O.trim())==null?void 0:P.length)>0?u(i?[{id:"all",name:E=="en"?"Select all":E=="ru"?"Выбрать все":E=="uz"?"Hammasini tanlash":"Select all"},...a==null?void 0:a.filter(R=>R.name.toLowerCase().indexOf(O.toLowerCase())>-1)]:a==null?void 0:a.filter(R=>R.name.toLowerCase().indexOf(O.toLowerCase())>-1)):u((a==null?void 0:a.length)>0&&i?[{id:"all",name:E=="en"?"Select all":E=="ru"?"Выбрать все":E=="uz"?"Hammasini tanlash":"Select all"},...a]:a)},[r]),X=C.useCallback(O=>{if(O.id=="all")if(v)o.changeSelectedHandler([],t,n),f([]),_(null);else{let P=r.filter(R=>R.id!="all");o.changeSelectedHandler(P,t,n),f(P),_(O)}else if(i){let P=l.find(R=>R.id===O.id);o.changeSelectedHandler&&o.changeSelectedHandler(P&&P.hasOwnProperty("id")?[...l.filter(R=>R.id!=O.id)]:[...l,O],t,n),P&&P.hasOwnProperty("id")?f(R=>R.filter(te=>te.id!=O.id)):f([...l,O]),v&&_(null)}else o.changeSelectedHandler(O,t,n),f(O)},[r,l]);return d.jsxs("div",{style:{maxWidth:m!=null&&m.maxWidth?m==null?void 0:m.maxWidth:"100%"},className:`${I}`,children:[g.hasOwnProperty("name")&&g.name&&d.jsx(we,{title:g==null?void 0:g.name,size:g==null?void 0:g.size,color:g==null?void 0:g.color,mandatory:b}),d.jsxs("div",{className:"relative text-[11px]",ref:A,children:[d.jsxs("div",{className:"relative appearance-none px-2 focus:z-10 disabled:bg-[#fff] disabled:border-[#0075FF0D] bg-white overflow-hidden gap-1 w-full transition",onClick:()=>V(!p),ref:k,title:i?(l==null?void 0:l.length)>0?l.map(O=>" "+O.name):"":l&&!Array.isArray(l)?l==null?void 0:l.name:"",style:{height:m!=null&&m.height?m==null?void 0:m.height:"30px",borderRadius:m!=null&&m.borderRadius?m==null?void 0:m.borderRadius:"5px",outline:p?`${(m==null?void 0:m.outlineColor)||"#3b82f6"} solid ${(m==null?void 0:m.borderWidth)||"2px"}`:`${(m==null?void 0:m.borderColor)||"#ccc"} solid 1px`},children:[Array.isArray(l)&&(l==null?void 0:l.length)>0||!Array.isArray(l)&&l?d.jsx(ye,{selected:l,style:m,isMulti:i}):d.jsx(ze,{placeholder:y}),d.jsx(Ee,{selected:l,open:p})]}),p&&d.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 rounded-[4px] bg-white shadow-md multiple-select-list pl-1 pb-0.5",style:{zIndex:T!=null&&T.zIndex?T==null?void 0:T.zIndex:20},children:[d.jsx(Re,{isSearch:N,lang:E,searchChangeHandler:U}),d.jsx("div",{className:"multiple-select-list-items",children:d.jsx(Ne,{extraData:r,selected:l,selectedAll:v,listItemStyle:T,lang:E,isMulti:i,changeSelectHandler:X})})]})]})]})}const dt=C.memo(ft);H.Content=ye,H.Header=we,H.Info=Ee,H.Lists=Ne,H.MultipleSelect=dt,H.Placeholder=ze,H.SearchInput=Re,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});