virtualdropdown-select
Version:
A component that allows us to use select and search for long select options.
31 lines (28 loc) • 29.6 kB
JavaScript
(function(O,Z){typeof exports=="object"&&typeof module<"u"?module.exports=Z(require("react")):typeof define=="function"&&define.amd?define(["react"],Z):(O=typeof globalThis<"u"?globalThis:O||self,O.VirtualDropdownSelect=Z(O.React))})(this,function(O){"use strict";var Z={exports:{}},se={};/**
* @license React
* react-jsx-runtime.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 ke;function et(){if(ke)return se;ke=1;var o=O,n=Symbol.for("react.element"),l=Symbol.for("react.fragment"),f=Object.prototype.hasOwnProperty,y=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,F={key:!0,ref:!0,__self:!0,__source:!0};function W(x,b,P){var p,T={},k=null,z=null;P!==void 0&&(k=""+P),b.key!==void 0&&(k=""+b.key),b.ref!==void 0&&(z=b.ref);for(p in b)f.call(b,p)&&!F.hasOwnProperty(p)&&(T[p]=b[p]);if(x&&x.defaultProps)for(p in b=x.defaultProps,b)T[p]===void 0&&(T[p]=b[p]);return{$$typeof:n,type:x,key:k,ref:z,props:T,_owner:y.current}}return se.Fragment=l,se.jsx=W,se.jsxs=W,se}var le={};/**
* @license React
* react-jsx-runtime.development.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 ze;function tt(){return ze||(ze=1,process.env.NODE_ENV!=="production"&&function(){var o=O,n=Symbol.for("react.element"),l=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),W=Symbol.for("react.provider"),x=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),R=Symbol.iterator,t="@@iterator";function c(e){if(e===null||typeof e!="object")return null;var r=R&&e[R]||e[t];return typeof r=="function"?r:null}var a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function s(e){{for(var r=arguments.length,i=new Array(r>1?r-1:0),u=1;u<r;u++)i[u-1]=arguments[u];v("error",e,i)}}function v(e,r,i){{var u=a.ReactDebugCurrentFrame,_=u.getStackAddendum();_!==""&&(r+="%s",i=i.concat([_]));var E=i.map(function(g){return String(g)});E.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,E)}}var S=!1,h=!1,w=!1,C=!1,N=!1,L;L=Symbol.for("react.module.reference");function X(e){return!!(typeof e=="string"||typeof e=="function"||e===f||e===F||N||e===y||e===P||e===p||C||e===z||S||h||w||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===T||e.$$typeof===W||e.$$typeof===x||e.$$typeof===b||e.$$typeof===L||e.getModuleId!==void 0))}function $(e,r,i){var u=e.displayName;if(u)return u;var _=r.displayName||r.name||"";return _!==""?i+"("+_+")":i}function q(e){return e.displayName||"Context"}function B(e){if(e==null)return null;if(typeof e.tag=="number"&&s("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case l:return"Portal";case F:return"Profiler";case y:return"StrictMode";case P:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var r=e;return q(r)+".Consumer";case W:var i=e;return q(i._context)+".Provider";case b:return $(e,e.render,"ForwardRef");case T:var u=e.displayName||null;return u!==null?u:B(e.type)||"Memo";case k:{var _=e,E=_._payload,g=_._init;try{return B(g(E))}catch{return null}}}return null}var J=Object.assign,Q=0,ie,d,I,j,M,U,K;function ee(){}ee.__reactDisabledLog=!0;function te(){{if(Q===0){ie=console.log,d=console.info,I=console.warn,j=console.error,M=console.group,U=console.groupCollapsed,K=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Q++}}function pe(){{if(Q--,Q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},e,{value:ie}),info:J({},e,{value:d}),warn:J({},e,{value:I}),error:J({},e,{value:j}),group:J({},e,{value:M}),groupCollapsed:J({},e,{value:U}),groupEnd:J({},e,{value:K})})}Q<0&&s("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _e=a.ReactCurrentDispatcher,xe;function he(e,r,i){{if(xe===void 0)try{throw Error()}catch(_){var u=_.stack.trim().match(/\n( *(at )?)/);xe=u&&u[1]||""}return`
`+xe+e}}var Re=!1,ve;{var ht=typeof WeakMap=="function"?WeakMap:Map;ve=new ht}function Le(e,r){if(!e||Re)return"";{var i=ve.get(e);if(i!==void 0)return i}var u;Re=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var E;E=_e.current,_e.current=null,te();try{if(r){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(H){u=H}Reflect.construct(e,[],g)}else{try{g.call()}catch(H){u=H}e.call(g.prototype)}}else{try{throw Error()}catch(H){u=H}e()}}catch(H){if(H&&u&&typeof H.stack=="string"){for(var m=H.stack.split(`
`),Y=u.stack.split(`
`),A=m.length-1,D=Y.length-1;A>=1&&D>=0&&m[A]!==Y[D];)D--;for(;A>=1&&D>=0;A--,D--)if(m[A]!==Y[D]){if(A!==1||D!==1)do if(A--,D--,D<0||m[A]!==Y[D]){var G=`
`+m[A].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),typeof e=="function"&&ve.set(e,G),G}while(A>=1&&D>=0);break}}}finally{Re=!1,_e.current=E,pe(),Error.prepareStackTrace=_}var ae=e?e.displayName||e.name:"",re=ae?he(ae):"";return typeof e=="function"&&ve.set(e,re),re}function vt(e,r,i){return Le(e,!1)}function mt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function me(e,r,i){if(e==null)return"";if(typeof e=="function")return Le(e,mt(e));if(typeof e=="string")return he(e);switch(e){case P:return he("Suspense");case p:return he("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case b:return vt(e.render);case T:return me(e.type,r,i);case k:{var u=e,_=u._payload,E=u._init;try{return me(E(_),r,i)}catch{}}}return""}var ce=Object.prototype.hasOwnProperty,Ve={},Ue=a.ReactDebugCurrentFrame;function ge(e){if(e){var r=e._owner,i=me(e.type,e._source,r?r.type:null);Ue.setExtraStackFrame(i)}else Ue.setExtraStackFrame(null)}function gt(e,r,i,u,_){{var E=Function.call.bind(ce);for(var g in e)if(E(e,g)){var m=void 0;try{if(typeof e[g]!="function"){var Y=Error((u||"React class")+": "+i+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Y.name="Invariant Violation",Y}m=e[g](r,g,u,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(A){m=A}m&&!(m instanceof Error)&&(ge(_),s("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",i,g,typeof m),ge(null)),m instanceof Error&&!(m.message in Ve)&&(Ve[m.message]=!0,ge(_),s("Failed %s type: %s",i,m.message),ge(null))}}}var yt=Array.isArray;function Ee(e){return yt(e)}function bt(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,i=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function St(e){try{return Ye(e),!1}catch{return!0}}function Ye(e){return""+e}function Be(e){if(St(e))return s("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",bt(e)),Ye(e)}var ue=a.ReactCurrentOwner,wt={key:!0,ref:!0,__self:!0,__source:!0},He,Ke,Te;Te={};function _t(e){if(ce.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function xt(e){if(ce.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Rt(e,r){if(typeof e.ref=="string"&&ue.current&&r&&ue.current.stateNode!==r){var i=B(ue.current.type);Te[i]||(s('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',B(ue.current.type),e.ref),Te[i]=!0)}}function Et(e,r){{var i=function(){He||(He=!0,s("%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://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function Tt(e,r){{var i=function(){Ke||(Ke=!0,s("%s: `ref` 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://reactjs.org/link/special-props)",r))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var Ot=function(e,r,i,u,_,E,g){var m={$$typeof:n,type:e,key:r,ref:i,props:g,_owner:E};return m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(m,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(m,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m};function It(e,r,i,u,_){{var E,g={},m=null,Y=null;i!==void 0&&(Be(i),m=""+i),xt(r)&&(Be(r.key),m=""+r.key),_t(r)&&(Y=r.ref,Rt(r,_));for(E in r)ce.call(r,E)&&!wt.hasOwnProperty(E)&&(g[E]=r[E]);if(e&&e.defaultProps){var A=e.defaultProps;for(E in A)g[E]===void 0&&(g[E]=A[E])}if(m||Y){var D=typeof e=="function"?e.displayName||e.name||"Unknown":e;m&&Et(g,D),Y&&Tt(g,D)}return Ot(e,m,Y,_,u,ue.current,g)}}var Oe=a.ReactCurrentOwner,Je=a.ReactDebugCurrentFrame;function oe(e){if(e){var r=e._owner,i=me(e.type,e._source,r?r.type:null);Je.setExtraStackFrame(i)}else Je.setExtraStackFrame(null)}var Ie;Ie=!1;function Ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Ge(){{if(Oe.current){var e=B(Oe.current.type);if(e)return`
Check the render method of \``+e+"`."}return""}}function Ct(e){return""}var Xe={};function Pt(e){{var r=Ge();if(!r){var i=typeof e=="string"?e:e.displayName||e.name;i&&(r=`
Check the top-level render call using <`+i+">.")}return r}}function qe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=Pt(r);if(Xe[i])return;Xe[i]=!0;var u="";e&&e._owner&&e._owner!==Oe.current&&(u=" It was passed a child from "+B(e._owner.type)+"."),oe(e),s('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,u),oe(null)}}function Qe(e,r){{if(typeof e!="object")return;if(Ee(e))for(var i=0;i<e.length;i++){var u=e[i];Ce(u)&&qe(u,r)}else if(Ce(e))e._store&&(e._store.validated=!0);else if(e){var _=c(e);if(typeof _=="function"&&_!==e.entries)for(var E=_.call(e),g;!(g=E.next()).done;)Ce(g.value)&&qe(g.value,r)}}}function kt(e){{var r=e.type;if(r==null||typeof r=="string")return;var i;if(typeof r=="function")i=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===b||r.$$typeof===T))i=r.propTypes;else return;if(i){var u=B(r);gt(i,e.props,"prop",u,e)}else if(r.PropTypes!==void 0&&!Ie){Ie=!0;var _=B(r);s("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&s("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function zt(e){{for(var r=Object.keys(e.props),i=0;i<r.length;i++){var u=r[i];if(u!=="children"&&u!=="key"){oe(e),s("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),oe(null);break}}e.ref!==null&&(oe(e),s("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}}var Ze={};function $e(e,r,i,u,_,E){{var g=X(e);if(!g){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=Ct();Y?m+=Y:m+=Ge();var A;e===null?A="null":Ee(e)?A="array":e!==void 0&&e.$$typeof===n?(A="<"+(B(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):A=typeof e,s("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",A,m)}var D=It(e,r,i,_,E);if(D==null)return D;if(g){var G=r.children;if(G!==void 0)if(u)if(Ee(G)){for(var ae=0;ae<G.length;ae++)Qe(G[ae],e);Object.freeze&&Object.freeze(G)}else s("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 Qe(G,e)}if(ce.call(r,"key")){var re=B(e),H=Object.keys(r).filter(function(Mt){return Mt!=="key"}),Pe=H.length>0?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}";if(!Ze[re+Pe]){var Ft=H.length>0?"{"+H.join(": ..., ")+": ...}":"{}";s(`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} />`,Pe,re,Ft,re),Ze[re+Pe]=!0}}return e===f?zt(D):kt(D),D}}function jt(e,r,i){return $e(e,r,i,!0)}function At(e,r,i){return $e(e,r,i,!1)}var Dt=At,Wt=jt;le.Fragment=f,le.jsx=Dt,le.jsxs=Wt}()),le}var je;function rt(){return je||(je=1,process.env.NODE_ENV==="production"?Z.exports=et():Z.exports=tt()),Z.exports}var V=rt();function ye(){return ye=Object.assign?Object.assign.bind():function(o){for(var n=1;n<arguments.length;n++){var l=arguments[n];for(var f in l)({}).hasOwnProperty.call(l,f)&&(o[f]=l[f])}return o},ye.apply(null,arguments)}function Ae(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function be(o,n){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,f){return l.__proto__=f,l},be(o,n)}function nt(o,n){o.prototype=Object.create(n.prototype),o.prototype.constructor=o,be(o,n)}var De=Number.isNaN||function(n){return typeof n=="number"&&n!==n};function it(o,n){return!!(o===n||De(o)&&De(n))}function ot(o,n){if(o.length!==n.length)return!1;for(var l=0;l<o.length;l++)if(!it(o[l],n[l]))return!1;return!0}function Se(o,n){n===void 0&&(n=ot);var l,f=[],y,F=!1;function W(){for(var x=[],b=0;b<arguments.length;b++)x[b]=arguments[b];return F&&l===this&&n(x,f)||(y=o.apply(this,x),F=!0,l=this,f=x),y}return W}var at=typeof performance=="object"&&typeof performance.now=="function",We=at?function(){return performance.now()}:function(){return Date.now()};function Fe(o){cancelAnimationFrame(o.id)}function st(o,n){var l=We();function f(){We()-l>=n?o.call(null):y.id=requestAnimationFrame(f)}var y={id:requestAnimationFrame(f)};return y}var we=-1;function Me(o){if(o===void 0&&(o=!1),we===-1||o){var n=document.createElement("div"),l=n.style;l.width="50px",l.height="50px",l.overflow="scroll",document.body.appendChild(n),we=n.offsetWidth-n.clientWidth,document.body.removeChild(n)}return we}var ne=null;function Ne(o){if(o===void 0&&(o=!1),ne===null||o){var n=document.createElement("div"),l=n.style;l.width="50px",l.height="50px",l.overflow="scroll",l.direction="rtl";var f=document.createElement("div"),y=f.style;return y.width="100px",y.height="100px",n.appendChild(f),document.body.appendChild(n),n.scrollLeft>0?ne="positive-descending":(n.scrollLeft=1,n.scrollLeft===0?ne="negative":ne="positive-ascending"),document.body.removeChild(n),ne}return ne}process.env.NODE_ENV;var lt=150,ct=function(n,l){return n},fe=null,de=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(fe=new WeakSet,de=new WeakSet);function ut(o){var n,l=o.getItemOffset,f=o.getEstimatedTotalSize,y=o.getItemSize,F=o.getOffsetForIndexAndAlignment,W=o.getStartIndexForOffset,x=o.getStopIndexForStartIndex,b=o.initInstanceProps,P=o.shouldResetStyleCacheOnItemSizeChange,p=o.validateProps;return n=function(T){nt(k,T);function k(R){var t;return t=T.call(this,R)||this,t._instanceProps=b(t.props,Ae(t)),t._outerRef=void 0,t._resetIsScrollingTimeoutId=null,t.state={instance:Ae(t),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof t.props.initialScrollOffset=="number"?t.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},t._callOnItemsRendered=void 0,t._callOnItemsRendered=Se(function(c,a,s,v){return t.props.onItemsRendered({overscanStartIndex:c,overscanStopIndex:a,visibleStartIndex:s,visibleStopIndex:v})}),t._callOnScroll=void 0,t._callOnScroll=Se(function(c,a,s){return t.props.onScroll({scrollDirection:c,scrollOffset:a,scrollUpdateWasRequested:s})}),t._getItemStyle=void 0,t._getItemStyle=function(c){var a=t.props,s=a.direction,v=a.itemSize,S=a.layout,h=t._getItemStyleCache(P&&v,P&&S,P&&s),w;if(h.hasOwnProperty(c))w=h[c];else{var C=l(t.props,c,t._instanceProps),N=y(t.props,c,t._instanceProps),L=s==="horizontal"||S==="horizontal",X=s==="rtl",$=L?C:0;h[c]=w={position:"absolute",left:X?void 0:$,right:X?$:void 0,top:L?0:C,height:L?"100%":N,width:L?N:"100%"}}return w},t._getItemStyleCache=void 0,t._getItemStyleCache=Se(function(c,a,s){return{}}),t._onScrollHorizontal=function(c){var a=c.currentTarget,s=a.clientWidth,v=a.scrollLeft,S=a.scrollWidth;t.setState(function(h){if(h.scrollOffset===v)return null;var w=t.props.direction,C=v;if(w==="rtl")switch(Ne()){case"negative":C=-v;break;case"positive-descending":C=S-s-v;break}return C=Math.max(0,Math.min(C,S-s)),{isScrolling:!0,scrollDirection:h.scrollOffset<C?"forward":"backward",scrollOffset:C,scrollUpdateWasRequested:!1}},t._resetIsScrollingDebounced)},t._onScrollVertical=function(c){var a=c.currentTarget,s=a.clientHeight,v=a.scrollHeight,S=a.scrollTop;t.setState(function(h){if(h.scrollOffset===S)return null;var w=Math.max(0,Math.min(S,v-s));return{isScrolling:!0,scrollDirection:h.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!1}},t._resetIsScrollingDebounced)},t._outerRefSetter=function(c){var a=t.props.outerRef;t._outerRef=c,typeof a=="function"?a(c):a!=null&&typeof a=="object"&&a.hasOwnProperty("current")&&(a.current=c)},t._resetIsScrollingDebounced=function(){t._resetIsScrollingTimeoutId!==null&&Fe(t._resetIsScrollingTimeoutId),t._resetIsScrollingTimeoutId=st(t._resetIsScrolling,lt)},t._resetIsScrolling=function(){t._resetIsScrollingTimeoutId=null,t.setState({isScrolling:!1},function(){t._getItemStyleCache(-1,null)})},t}k.getDerivedStateFromProps=function(t,c){return ft(t,c),p(t),null};var z=k.prototype;return z.scrollTo=function(t){t=Math.max(0,t),this.setState(function(c){return c.scrollOffset===t?null:{scrollDirection:c.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},z.scrollToItem=function(t,c){c===void 0&&(c="auto");var a=this.props,s=a.itemCount,v=a.layout,S=this.state.scrollOffset;t=Math.max(0,Math.min(t,s-1));var h=0;if(this._outerRef){var w=this._outerRef;v==="vertical"?h=w.scrollWidth>w.clientWidth?Me():0:h=w.scrollHeight>w.clientHeight?Me():0}this.scrollTo(F(this.props,t,c,S,this._instanceProps,h))},z.componentDidMount=function(){var t=this.props,c=t.direction,a=t.initialScrollOffset,s=t.layout;if(typeof a=="number"&&this._outerRef!=null){var v=this._outerRef;c==="horizontal"||s==="horizontal"?v.scrollLeft=a:v.scrollTop=a}this._callPropsCallbacks()},z.componentDidUpdate=function(){var t=this.props,c=t.direction,a=t.layout,s=this.state,v=s.scrollOffset,S=s.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var h=this._outerRef;if(c==="horizontal"||a==="horizontal")if(c==="rtl")switch(Ne()){case"negative":h.scrollLeft=-v;break;case"positive-ascending":h.scrollLeft=v;break;default:var w=h.clientWidth,C=h.scrollWidth;h.scrollLeft=C-w-v;break}else h.scrollLeft=v;else h.scrollTop=v}this._callPropsCallbacks()},z.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Fe(this._resetIsScrollingTimeoutId)},z.render=function(){var t=this.props,c=t.children,a=t.className,s=t.direction,v=t.height,S=t.innerRef,h=t.innerElementType,w=t.innerTagName,C=t.itemCount,N=t.itemData,L=t.itemKey,X=L===void 0?ct:L,$=t.layout,q=t.outerElementType,B=t.outerTagName,J=t.style,Q=t.useIsScrolling,ie=t.width,d=this.state.isScrolling,I=s==="horizontal"||$==="horizontal",j=I?this._onScrollHorizontal:this._onScrollVertical,M=this._getRangeToRender(),U=M[0],K=M[1],ee=[];if(C>0)for(var te=U;te<=K;te++)ee.push(O.createElement(c,{data:N,key:X(te,N),index:te,isScrolling:Q?d:void 0,style:this._getItemStyle(te)}));var pe=f(this.props,this._instanceProps);return O.createElement(q||B||"div",{className:a,onScroll:j,ref:this._outerRefSetter,style:ye({position:"relative",height:v,width:ie,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:s},J)},O.createElement(h||w||"div",{children:ee,ref:S,style:{height:I?"100%":pe,pointerEvents:d?"none":void 0,width:I?pe:"100%"}}))},z._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var t=this.props.itemCount;if(t>0){var c=this._getRangeToRender(),a=c[0],s=c[1],v=c[2],S=c[3];this._callOnItemsRendered(a,s,v,S)}}if(typeof this.props.onScroll=="function"){var h=this.state,w=h.scrollDirection,C=h.scrollOffset,N=h.scrollUpdateWasRequested;this._callOnScroll(w,C,N)}},z._getRangeToRender=function(){var t=this.props,c=t.itemCount,a=t.overscanCount,s=this.state,v=s.isScrolling,S=s.scrollDirection,h=s.scrollOffset;if(c===0)return[0,0,0,0];var w=W(this.props,h,this._instanceProps),C=x(this.props,w,h,this._instanceProps),N=!v||S==="backward"?Math.max(1,a):1,L=!v||S==="forward"?Math.max(1,a):1;return[Math.max(0,w-N),Math.max(0,Math.min(c-1,C+L)),w,C]},k}(O.PureComponent),n.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},n}var ft=function(n,l){var f=n.children,y=n.direction,F=n.height,W=n.layout,x=n.innerTagName,b=n.outerTagName,P=n.width,p=l.instance;if(process.env.NODE_ENV!=="production"){(x!=null||b!=null)&&de&&!de.has(p)&&(de.add(p),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var T=y==="horizontal"||W==="horizontal";switch(y){case"horizontal":case"vertical":fe&&!fe.has(p)&&(fe.add(p),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". '+('"'+y+'" 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(f==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(f===null?"null":typeof f)+'" was specified.'));if(T&&typeof P!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(P===null?"null":typeof P)+'" was specified.'));if(!T&&typeof F!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(F===null?"null":typeof F)+'" was specified.'))}},dt=ut({getItemOffset:function(n,l){var f=n.itemSize;return l*f},getItemSize:function(n,l){var f=n.itemSize;return f},getEstimatedTotalSize:function(n){var l=n.itemCount,f=n.itemSize;return f*l},getOffsetForIndexAndAlignment:function(n,l,f,y,F,W){var x=n.direction,b=n.height,P=n.itemCount,p=n.itemSize,T=n.layout,k=n.width,z=x==="horizontal"||T==="horizontal",R=z?k:b,t=Math.max(0,P*p-R),c=Math.min(t,l*p),a=Math.max(0,l*p-R+p+W);switch(f==="smart"&&(y>=a-R&&y<=c+R?f="auto":f="center"),f){case"start":return c;case"end":return a;case"center":{var s=Math.round(a+(c-a)/2);return s<Math.ceil(R/2)?0:s>t+Math.floor(R/2)?t:s}case"auto":default:return y>=a&&y<=c?y:y<a?a:c}},getStartIndexForOffset:function(n,l){var f=n.itemCount,y=n.itemSize;return Math.max(0,Math.min(f-1,Math.floor(l/y)))},getStopIndexForStartIndex:function(n,l,f){var y=n.direction,F=n.height,W=n.itemCount,x=n.itemSize,b=n.layout,P=n.width,p=y==="horizontal"||b==="horizontal",T=l*x,k=p?P:F,z=Math.ceil((k+f-T)/x);return Math.max(0,Math.min(W-1,l+z-1))},initInstanceProps:function(n){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(n){var l=n.itemSize;if(process.env.NODE_ENV!=="production"&&typeof l!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(l===null?"null":typeof l)+'" was specified.'))}});function pt({fullData:o,chunkSize:n=100,itemHeight:l=35,displayKey:f="customer",inputWidth:y="100%",inputHeight:F="35px",inputColor:W="#ccc",multipleSelect:x=!0,dropdownWidth:b="350px",maxDropdownHeight:P=300,onChange:p,keyField:T="id"}){const[k,z]=O.useState(""),[R,t]=O.useState(!1),[c,a]=O.useState({width:parseInt(b)||350,height:P}),[s,v]=O.useState([]),[S,h]=O.useState([]),[w,C]=O.useState([]),N=O.useRef(null),L=O.useRef(null),X=O.useRef(null),$=w.length<o.length;O.useEffect(()=>{C(o.slice(0,n))},[o,n]),O.useEffect(()=>{const d=I=>{R&&L.current&&!L.current.contains(I.target)&&!X.current.contains(I.target)&&(t(!1),z(""))};return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[R]),O.useEffect(()=>{const d=()=>{if(N.current){const I=window.innerHeight,j=N.current.getBoundingClientRect(),M=I-j.bottom-20,U=N.current.offsetWidth;a({width:U,height:Math.max(Math.min(M,P),200)})}};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[R,P]);const q=O.useMemo(()=>{if(!k)return w;const d=k.toLowerCase();return o.filter(I=>Object.values(I).some(j=>String(j).toLowerCase().includes(d)))},[o,w,k]),B=()=>{t(!R)},J=(d,I,j)=>{if(x){const M=j?[...S,I]:S.filter(U=>U[T]!==d);h(M),v(M.map(U=>U[T])),p==null||p(M)}else{const M=j?[I]:[];h(M),v(j?[d]:[]),z(""),t(!1),p==null||p(M)}},Q=d=>{d?(v(o.map(I=>I[T])),h(o),p==null||p(o)):(v([]),h([]),p==null||p([]))},ie=()=>{const d=w.length,I=o.slice(d,d+n);C(j=>[...j,...I])};return V.jsxs("div",{style:{position:"relative",width:b},ref:N,children:[V.jsx("div",{style:{position:"relative"},children:V.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",border:`1px solid ${W}`,borderRadius:"4px",minHeight:F,padding:"4px 8px",boxSizing:"border-box",gap:"8px",cursor:"text",width:y},onClick:()=>{var d;(d=X.current)==null||d.focus()},children:[V.jsx("input",{ref:X,type:"text",placeholder:S.length===0?"Search...":"",style:{height:"100%",border:"none",outline:"none",padding:"0",flex:"1",fontSize:"14px",minWidth:"50px",backgroundColor:"transparent",width:"100%"},value:x?k:k||S[0]&&f.split(".").reduce((d,I)=>d==null?void 0:d[I],S[0])||"",onChange:d=>{z(d.target.value),R||t(!0),x||(h([]),v([]))},onClick:d=>{d.stopPropagation(),B()}}),x&&S.length>0&&V.jsxs("div",{style:{backgroundColor:"#e3e3e3",borderRadius:"16px",padding:"2px 8px",fontSize:"12px",color:"#666",display:"flex",alignItems:"center",gap:"4px",whiteSpace:"nowrap"},children:[V.jsxs("span",{children:[S.length," ",S.length===1?"item":"items"," selected"]}),V.jsx("button",{onClick:d=>{d.stopPropagation(),h([]),v([])},style:{border:"none",background:"none",padding:"0",cursor:"pointer",fontSize:"14px",color:"#666",display:"flex",alignItems:"center"},children:"×"})]})]})}),R&&V.jsxs("div",{ref:L,style:{position:"absolute",top:"calc(100% + 8px)",left:0,width:"100%",backgroundColor:"#fff",border:"1px solid #e1e4e8",borderRadius:"4px",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.3)",zIndex:1e3,boxSizing:"border-box"},children:[x&&V.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #e1e4e8"},children:[V.jsx("input",{type:"checkbox",onChange:d=>Q(d.target.checked),checked:s.length>0&&s.length===o.length,style:{marginRight:"8px"}}),V.jsx("span",{style:{fontSize:"14px"},children:"Select All"})]}),V.jsx(dt,{height:c.height,itemCount:q.length,itemSize:l,width:c.width,onItemsRendered:({visibleStopIndex:d})=>{$&&d>=q.length-1&&ie()},style:{padding:"4px 0",overflowX:"hidden"},children:({index:d,style:I})=>{const j=q[d],M=f.split(".").reduce((K,ee)=>K==null?void 0:K[ee],j),U=s.includes(j[T]);return V.jsxs("div",{style:{...I,display:"flex",alignItems:"center",padding:"0 12px",fontSize:"14px",backgroundColor:x?U?"#f1f8ff":"transparent":U?"#e6f3ff":"transparent",cursor:"pointer"},onClick:K=>{K.target.type!=="checkbox"&&J(j[T],j,!U)},children:[x&&V.jsx("input",{type:"checkbox",checked:U,onChange:K=>{K.stopPropagation(),J(j[T],j,K.target.checked)},style:{marginRight:"8px"}}),M]})}}),q.length===0&&V.jsx("div",{style:{padding:"12px",textAlign:"center",color:"#666",fontSize:"14px"},children:"No results found"})]})]})}return pt});