@starasia/dropdown 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(B,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(B=typeof globalThis<"u"?globalThis:B||self,l(B.Dropdown={},B.React))})(this,function(B,l){"use strict";var tr={exports:{}},J={};/**
1
+ (function(V,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],c):(V=typeof globalThis<"u"?globalThis:V||self,c(V.Dropdown={},V.React))})(this,function(V,c){"use strict";var tr={exports:{}},G={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var hr;function Yr(){if(hr)return J;hr=1;var u=l,f=Symbol.for("react.element"),m=Symbol.for("react.fragment"),x=Object.prototype.hasOwnProperty,p=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function T(y,v,F){var k,O={},A=null,W=null;F!==void 0&&(A=""+F),v.key!==void 0&&(A=""+v.key),v.ref!==void 0&&(W=v.ref);for(k in v)x.call(v,k)&&!h.hasOwnProperty(k)&&(O[k]=v[k]);if(y&&y.defaultProps)for(k in v=y.defaultProps,v)O[k]===void 0&&(O[k]=v[k]);return{$$typeof:f,type:y,key:A,ref:W,props:O,_owner:p.current}}return J.Fragment=m,J.jsx=T,J.jsxs=T,J}var H={};/**
9
+ */var hr;function Yr(){if(hr)return G;hr=1;var p=c,f=Symbol.for("react.element"),m=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,v=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,w={key:!0,ref:!0,__self:!0,__source:!0};function I(j,b,S){var _,W={},R=null,N=null;S!==void 0&&(R=""+S),b.key!==void 0&&(R=""+b.key),b.ref!==void 0&&(N=b.ref);for(_ in b)E.call(b,_)&&!w.hasOwnProperty(_)&&(W[_]=b[_]);if(j&&j.defaultProps)for(_ in b=j.defaultProps,b)W[_]===void 0&&(W[_]=b[_]);return{$$typeof:f,type:j,key:R,ref:N,props:W,_owner:v.current}}return G.Fragment=m,G.jsx=I,G.jsxs=I,G}var X={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,22 +14,22 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var wr;function Mr(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&function(){var u=l,f=Symbol.for("react.element"),m=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),y=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),D=Symbol.iterator,o="@@iterator";function z(r){if(r===null||typeof r!="object")return null;var n=D&&r[D]||r[o];return typeof n=="function"?n:null}var P=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(r){{for(var n=arguments.length,e=new Array(n>1?n-1:0),a=1;a<n;a++)e[a-1]=arguments[a];L("error",r,e)}}function L(r,n,e){{var a=P.ReactDebugCurrentFrame,d=a.getStackAddendum();d!==""&&(n+="%s",e=e.concat([d]));var c=e.map(function(s){return String(s)});c.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,c)}}var K=!1,G=!1,Q=!1,or=!1,$=!1,q;q=Symbol.for("react.module.reference");function N(r){return!!(typeof r=="string"||typeof r=="function"||r===x||r===h||$||r===p||r===F||r===k||or||r===W||K||G||Q||typeof r=="object"&&r!==null&&(r.$$typeof===A||r.$$typeof===O||r.$$typeof===T||r.$$typeof===y||r.$$typeof===v||r.$$typeof===q||r.getModuleId!==void 0))}function j(r,n,e){var a=r.displayName;if(a)return a;var d=n.displayName||n.name||"";return d!==""?e+"("+d+")":e}function E(r){return r.displayName||"Context"}function C(r){if(r==null)return null;if(typeof r.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case x:return"Fragment";case m:return"Portal";case h:return"Profiler";case p:return"StrictMode";case F:return"Suspense";case k:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case y:var n=r;return E(n)+".Consumer";case T:var e=r;return E(e._context)+".Provider";case v:return j(r,r.render,"ForwardRef");case O:var a=r.displayName||null;return a!==null?a:C(r.type)||"Memo";case A:{var d=r,c=d._payload,s=d._init;try{return C(s(c))}catch{return null}}}return null}var R=Object.assign,Y=0,xr,mr,yr,kr,Er,Rr,jr;function _r(){}_r.__reactDisabledLog=!0;function $r(){{if(Y===0){xr=console.log,mr=console.info,yr=console.warn,kr=console.error,Er=console.group,Rr=console.groupCollapsed,jr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:_r,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}Y++}}function qr(){{if(Y--,Y===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},r,{value:xr}),info:R({},r,{value:mr}),warn:R({},r,{value:yr}),error:R({},r,{value:kr}),group:R({},r,{value:Er}),groupCollapsed:R({},r,{value:Rr}),groupEnd:R({},r,{value:jr})})}Y<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ir=P.ReactCurrentDispatcher,sr;function rr(r,n,e){{if(sr===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);sr=a&&a[1]||""}return`
18
- `+sr+r}}var dr=!1,nr;{var rn=typeof WeakMap=="function"?WeakMap:Map;nr=new rn}function Cr(r,n){if(!r||dr)return"";{var e=nr.get(r);if(e!==void 0)return e}var a;dr=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=ir.current,ir.current=null,$r();try{if(n){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(S){a=S}Reflect.construct(r,[],s)}else{try{s.call()}catch(S){a=S}r.call(s.prototype)}}else{try{throw Error()}catch(S){a=S}r()}}catch(S){if(S&&a&&typeof S.stack=="string"){for(var i=S.stack.split(`
19
- `),_=a.stack.split(`
20
- `),g=i.length-1,b=_.length-1;g>=1&&b>=0&&i[g]!==_[b];)b--;for(;g>=1&&b>=0;g--,b--)if(i[g]!==_[b]){if(g!==1||b!==1)do if(g--,b--,b<0||i[g]!==_[b]){var I=`
21
- `+i[g].replace(" at new "," at ");return r.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",r.displayName)),typeof r=="function"&&nr.set(r,I),I}while(g>=1&&b>=0);break}}}finally{dr=!1,ir.current=c,qr(),Error.prepareStackTrace=d}var U=r?r.displayName||r.name:"",M=U?rr(U):"";return typeof r=="function"&&nr.set(r,M),M}function nn(r,n,e){return Cr(r,!1)}function en(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function er(r,n,e){if(r==null)return"";if(typeof r=="function")return Cr(r,en(r));if(typeof r=="string")return rr(r);switch(r){case F:return rr("Suspense");case k:return rr("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case v:return nn(r.render);case O:return er(r.type,n,e);case A:{var a=r,d=a._payload,c=a._init;try{return er(c(d),n,e)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,Sr={},Tr=P.ReactDebugCurrentFrame;function ar(r){if(r){var n=r._owner,e=er(r.type,r._source,n?n.type:null);Tr.setExtraStackFrame(e)}else Tr.setExtraStackFrame(null)}function an(r,n,e,a,d){{var c=Function.call.bind(X);for(var s in r)if(c(r,s)){var i=void 0;try{if(typeof r[s]!="function"){var _=Error((a||"React class")+": "+e+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}i=r[s](n,s,a,e,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(g){i=g}i&&!(i instanceof Error)&&(ar(d),w("%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).",a||"React class",e,s,typeof i),ar(null)),i instanceof Error&&!(i.message in Sr)&&(Sr[i.message]=!0,ar(d),w("Failed %s type: %s",e,i.message),ar(null))}}}var tn=Array.isArray;function cr(r){return tn(r)}function on(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,e=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return e}}function sn(r){try{return Or(r),!1}catch{return!0}}function Or(r){return""+r}function Pr(r){if(sn(r))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",on(r)),Or(r)}var Z=P.ReactCurrentOwner,dn={key:!0,ref:!0,__self:!0,__source:!0},Ir,Dr,lr;lr={};function cn(r){if(X.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function ln(r){if(X.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function un(r,n){if(typeof r.ref=="string"&&Z.current&&n&&Z.current.stateNode!==n){var e=C(Z.current.type);lr[e]||(w('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',C(Z.current.type),r.ref),lr[e]=!0)}}function pn(r,n){{var e=function(){Ir||(Ir=!0,w("%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)",n))};e.isReactWarning=!0,Object.defineProperty(r,"key",{get:e,configurable:!0})}}function fn(r,n){{var e=function(){Dr||(Dr=!0,w("%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)",n))};e.isReactWarning=!0,Object.defineProperty(r,"ref",{get:e,configurable:!0})}}var vn=function(r,n,e,a,d,c,s){var i={$$typeof:f,type:r,key:n,ref:e,props:s,_owner:c};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function hn(r,n,e,a,d){{var c,s={},i=null,_=null;e!==void 0&&(Pr(e),i=""+e),ln(n)&&(Pr(n.key),i=""+n.key),cn(n)&&(_=n.ref,un(n,d));for(c in n)X.call(n,c)&&!dn.hasOwnProperty(c)&&(s[c]=n[c]);if(r&&r.defaultProps){var g=r.defaultProps;for(c in g)s[c]===void 0&&(s[c]=g[c])}if(i||_){var b=typeof r=="function"?r.displayName||r.name||"Unknown":r;i&&pn(s,b),_&&fn(s,b)}return vn(r,i,_,d,a,Z.current,s)}}var ur=P.ReactCurrentOwner,Fr=P.ReactDebugCurrentFrame;function V(r){if(r){var n=r._owner,e=er(r.type,r._source,n?n.type:null);Fr.setExtraStackFrame(e)}else Fr.setExtraStackFrame(null)}var pr;pr=!1;function fr(r){return typeof r=="object"&&r!==null&&r.$$typeof===f}function Ar(){{if(ur.current){var r=C(ur.current.type);if(r)return`
17
+ */var wr;function Mr(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&function(){var p=c,f=Symbol.for("react.element"),m=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),j=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),L=Symbol.iterator,y="@@iterator";function o(r){if(r===null||typeof r!="object")return null;var n=L&&r[L]||r[y];return typeof n=="function"?n:null}var h=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(r){{for(var n=arguments.length,e=new Array(n>1?n-1:0),a=1;a<n;a++)e[a-1]=arguments[a];g("error",r,e)}}function g(r,n,e){{var a=h.ReactDebugCurrentFrame,d=a.getStackAddendum();d!==""&&(n+="%s",e=e.concat([d]));var u=e.map(function(s){return String(s)});u.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,u)}}var C=!1,B=!1,Y=!1,or=!1,$=!1,q;q=Symbol.for("react.module.reference");function M(r){return!!(typeof r=="string"||typeof r=="function"||r===E||r===w||$||r===v||r===S||r===_||or||r===N||C||B||Y||typeof r=="object"&&r!==null&&(r.$$typeof===R||r.$$typeof===W||r.$$typeof===I||r.$$typeof===j||r.$$typeof===b||r.$$typeof===q||r.getModuleId!==void 0))}function T(r,n,e){var a=r.displayName;if(a)return a;var d=n.displayName||n.name||"";return d!==""?e+"("+d+")":e}function O(r){return r.displayName||"Context"}function F(r){if(r==null)return null;if(typeof r.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case E:return"Fragment";case m:return"Portal";case w:return"Profiler";case v:return"StrictMode";case S:return"Suspense";case _:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case j:var n=r;return O(n)+".Consumer";case I:var e=r;return O(e._context)+".Provider";case b:return T(r,r.render,"ForwardRef");case W:var a=r.displayName||null;return a!==null?a:F(r.type)||"Memo";case R:{var d=r,u=d._payload,s=d._init;try{return F(s(u))}catch{return null}}}return null}var P=Object.assign,U=0,xr,mr,yr,kr,Er,Rr,jr;function _r(){}_r.__reactDisabledLog=!0;function $r(){{if(U===0){xr=console.log,mr=console.info,yr=console.warn,kr=console.error,Er=console.group,Rr=console.groupCollapsed,jr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:_r,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}U++}}function qr(){{if(U--,U===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},r,{value:xr}),info:P({},r,{value:mr}),warn:P({},r,{value:yr}),error:P({},r,{value:kr}),group:P({},r,{value:Er}),groupCollapsed:P({},r,{value:Rr}),groupEnd:P({},r,{value:jr})})}U<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ir=h.ReactCurrentDispatcher,sr;function rr(r,n,e){{if(sr===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);sr=a&&a[1]||""}return`
18
+ `+sr+r}}var dr=!1,nr;{var rn=typeof WeakMap=="function"?WeakMap:Map;nr=new rn}function Cr(r,n){if(!r||dr)return"";{var e=nr.get(r);if(e!==void 0)return e}var a;dr=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=ir.current,ir.current=null,$r();try{if(n){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(A){a=A}Reflect.construct(r,[],s)}else{try{s.call()}catch(A){a=A}r.call(s.prototype)}}else{try{throw Error()}catch(A){a=A}r()}}catch(A){if(A&&a&&typeof A.stack=="string"){for(var i=A.stack.split(`
19
+ `),D=a.stack.split(`
20
+ `),x=i.length-1,k=D.length-1;x>=1&&k>=0&&i[x]!==D[k];)k--;for(;x>=1&&k>=0;x--,k--)if(i[x]!==D[k]){if(x!==1||k!==1)do if(x--,k--,k<0||i[x]!==D[k]){var z=`
21
+ `+i[x].replace(" at new "," at ");return r.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",r.displayName)),typeof r=="function"&&nr.set(r,z),z}while(x>=1&&k>=0);break}}}finally{dr=!1,ir.current=u,qr(),Error.prepareStackTrace=d}var K=r?r.displayName||r.name:"",H=K?rr(K):"";return typeof r=="function"&&nr.set(r,H),H}function nn(r,n,e){return Cr(r,!1)}function en(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function er(r,n,e){if(r==null)return"";if(typeof r=="function")return Cr(r,en(r));if(typeof r=="string")return rr(r);switch(r){case S:return rr("Suspense");case _:return rr("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case b:return nn(r.render);case W:return er(r.type,n,e);case R:{var a=r,d=a._payload,u=a._init;try{return er(u(d),n,e)}catch{}}}return""}var Z=Object.prototype.hasOwnProperty,Sr={},Tr=h.ReactDebugCurrentFrame;function ar(r){if(r){var n=r._owner,e=er(r.type,r._source,n?n.type:null);Tr.setExtraStackFrame(e)}else Tr.setExtraStackFrame(null)}function an(r,n,e,a,d){{var u=Function.call.bind(Z);for(var s in r)if(u(r,s)){var i=void 0;try{if(typeof r[s]!="function"){var D=Error((a||"React class")+": "+e+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}i=r[s](n,s,a,e,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){i=x}i&&!(i instanceof Error)&&(ar(d),l("%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).",a||"React class",e,s,typeof i),ar(null)),i instanceof Error&&!(i.message in Sr)&&(Sr[i.message]=!0,ar(d),l("Failed %s type: %s",e,i.message),ar(null))}}}var tn=Array.isArray;function cr(r){return tn(r)}function on(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,e=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return e}}function sn(r){try{return Or(r),!1}catch{return!0}}function Or(r){return""+r}function Pr(r){if(sn(r))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",on(r)),Or(r)}var Q=h.ReactCurrentOwner,dn={key:!0,ref:!0,__self:!0,__source:!0},Ir,Dr,lr;lr={};function cn(r){if(Z.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function ln(r){if(Z.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function un(r,n){if(typeof r.ref=="string"&&Q.current&&n&&Q.current.stateNode!==n){var e=F(Q.current.type);lr[e]||(l('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',F(Q.current.type),r.ref),lr[e]=!0)}}function pn(r,n){{var e=function(){Ir||(Ir=!0,l("%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)",n))};e.isReactWarning=!0,Object.defineProperty(r,"key",{get:e,configurable:!0})}}function fn(r,n){{var e=function(){Dr||(Dr=!0,l("%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)",n))};e.isReactWarning=!0,Object.defineProperty(r,"ref",{get:e,configurable:!0})}}var vn=function(r,n,e,a,d,u,s){var i={$$typeof:f,type:r,key:n,ref:e,props:s,_owner:u};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function hn(r,n,e,a,d){{var u,s={},i=null,D=null;e!==void 0&&(Pr(e),i=""+e),ln(n)&&(Pr(n.key),i=""+n.key),cn(n)&&(D=n.ref,un(n,d));for(u in n)Z.call(n,u)&&!dn.hasOwnProperty(u)&&(s[u]=n[u]);if(r&&r.defaultProps){var x=r.defaultProps;for(u in x)s[u]===void 0&&(s[u]=x[u])}if(i||D){var k=typeof r=="function"?r.displayName||r.name||"Unknown":r;i&&pn(s,k),D&&fn(s,k)}return vn(r,i,D,d,a,Q.current,s)}}var ur=h.ReactCurrentOwner,Fr=h.ReactDebugCurrentFrame;function J(r){if(r){var n=r._owner,e=er(r.type,r._source,n?n.type:null);Fr.setExtraStackFrame(e)}else Fr.setExtraStackFrame(null)}var pr;pr=!1;function fr(r){return typeof r=="object"&&r!==null&&r.$$typeof===f}function Ar(){{if(ur.current){var r=F(ur.current.type);if(r)return`
22
22
 
23
23
  Check the render method of \``+r+"`."}return""}}function wn(r){{if(r!==void 0){var n=r.fileName.replace(/^.*[\\\/]/,""),e=r.lineNumber;return`
24
24
 
25
25
  Check your code at `+n+":"+e+"."}return""}}var Wr={};function gn(r){{var n=Ar();if(!n){var e=typeof r=="string"?r:r.displayName||r.name;e&&(n=`
26
26
 
27
- Check the top-level render call using <`+e+">.")}return n}}function Lr(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var e=gn(n);if(Wr[e])return;Wr[e]=!0;var a="";r&&r._owner&&r._owner!==ur.current&&(a=" It was passed a child from "+C(r._owner.type)+"."),V(r),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',e,a),V(null)}}function zr(r,n){{if(typeof r!="object")return;if(cr(r))for(var e=0;e<r.length;e++){var a=r[e];fr(a)&&Lr(a,n)}else if(fr(r))r._store&&(r._store.validated=!0);else if(r){var d=z(r);if(typeof d=="function"&&d!==r.entries)for(var c=d.call(r),s;!(s=c.next()).done;)fr(s.value)&&Lr(s.value,n)}}}function bn(r){{var n=r.type;if(n==null||typeof n=="string")return;var e;if(typeof n=="function")e=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===v||n.$$typeof===O))e=n.propTypes;else return;if(e){var a=C(n);an(e,r.props,"prop",a,r)}else if(n.PropTypes!==void 0&&!pr){pr=!0;var d=C(n);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xn(r){{for(var n=Object.keys(r.props),e=0;e<n.length;e++){var a=n[e];if(a!=="children"&&a!=="key"){V(r),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),V(null);break}}r.ref!==null&&(V(r),w("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var Nr={};function Br(r,n,e,a,d,c){{var s=N(r);if(!s){var i="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(i+=" 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 _=wn(d);_?i+=_:i+=Ar();var g;r===null?g="null":cr(r)?g="array":r!==void 0&&r.$$typeof===f?(g="<"+(C(r.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):g=typeof r,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",g,i)}var b=hn(r,n,e,d,c);if(b==null)return b;if(s){var I=n.children;if(I!==void 0)if(a)if(cr(I)){for(var U=0;U<I.length;U++)zr(I[U],r);Object.freeze&&Object.freeze(I)}else w("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 zr(I,r)}if(X.call(n,"key")){var M=C(r),S=Object.keys(n).filter(function(jn){return jn!=="key"}),vr=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!Nr[M+vr]){var Rn=S.length>0?"{"+S.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
27
+ Check the top-level render call using <`+e+">.")}return n}}function Lr(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var e=gn(n);if(Wr[e])return;Wr[e]=!0;var a="";r&&r._owner&&r._owner!==ur.current&&(a=" It was passed a child from "+F(r._owner.type)+"."),J(r),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',e,a),J(null)}}function zr(r,n){{if(typeof r!="object")return;if(cr(r))for(var e=0;e<r.length;e++){var a=r[e];fr(a)&&Lr(a,n)}else if(fr(r))r._store&&(r._store.validated=!0);else if(r){var d=o(r);if(typeof d=="function"&&d!==r.entries)for(var u=d.call(r),s;!(s=u.next()).done;)fr(s.value)&&Lr(s.value,n)}}}function bn(r){{var n=r.type;if(n==null||typeof n=="string")return;var e;if(typeof n=="function")e=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===b||n.$$typeof===W))e=n.propTypes;else return;if(e){var a=F(n);an(e,r.props,"prop",a,r)}else if(n.PropTypes!==void 0&&!pr){pr=!0;var d=F(n);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xn(r){{for(var n=Object.keys(r.props),e=0;e<n.length;e++){var a=n[e];if(a!=="children"&&a!=="key"){J(r),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),J(null);break}}r.ref!==null&&(J(r),l("Invalid attribute `ref` supplied to `React.Fragment`."),J(null))}}var Nr={};function Br(r,n,e,a,d,u){{var s=M(r);if(!s){var i="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(i+=" 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 D=wn(d);D?i+=D:i+=Ar();var x;r===null?x="null":cr(r)?x="array":r!==void 0&&r.$$typeof===f?(x="<"+(F(r.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):x=typeof r,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,i)}var k=hn(r,n,e,d,u);if(k==null)return k;if(s){var z=n.children;if(z!==void 0)if(a)if(cr(z)){for(var K=0;K<z.length;K++)zr(z[K],r);Object.freeze&&Object.freeze(z)}else l("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 zr(z,r)}if(Z.call(n,"key")){var H=F(r),A=Object.keys(n).filter(function(jn){return jn!=="key"}),vr=A.length>0?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}";if(!Nr[H+vr]){var Rn=A.length>0?"{"+A.join(": ..., ")+": ...}":"{}";l(`A props object containing a "key" prop is being spread into JSX:
28
28
  let props = %s;
29
29
  <%s {...props} />
30
30
  React keys must be passed directly to JSX without using spread:
31
31
  let props = %s;
32
- <%s key={someKey} {...props} />`,vr,M,Rn,M),Nr[M+vr]=!0}}return r===x?xn(b):bn(b),b}}function mn(r,n,e){return Br(r,n,e,!0)}function yn(r,n,e){return Br(r,n,e,!1)}var kn=yn,En=mn;H.Fragment=x,H.jsx=kn,H.jsxs=En}()),H}process.env.NODE_ENV==="production"?tr.exports=Yr():tr.exports=Mr();var t=tr.exports;const Vr=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
32
+ <%s key={someKey} {...props} />`,vr,H,Rn,H),Nr[H+vr]=!0}}return r===E?xn(k):bn(k),k}}function mn(r,n,e){return Br(r,n,e,!0)}function yn(r,n,e){return Br(r,n,e,!1)}var kn=yn,En=mn;X.Fragment=E,X.jsx=kn,X.jsxs=En}()),X}process.env.NODE_ENV==="production"?tr.exports=Yr():tr.exports=Mr();var t=tr.exports;const Vr=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
33
33
  * {
34
34
  margin: 0;
35
35
  padding: 0;
@@ -232,6 +232,12 @@ React keys must be passed directly to JSX without using spread:
232
232
  white-space: nowrap; */
233
233
  }
234
234
 
235
+ /* remove default focus outline when container is focused for keyboard handling */
236
+ .starasia-input-dropdown-lists-container:focus {
237
+ outline: none;
238
+ box-shadow: none;
239
+ }
240
+
235
241
  .starasia-input-dropdown-lists-container-bottom {
236
242
  top: 100%;
237
243
  margin-top: var(--starasia-ui-dropdown-spacing-xs);
@@ -304,6 +310,10 @@ React keys must be passed directly to JSX without using spread:
304
310
  /* box-shadow: 0px 0px 0px -1px #f0f0f0; */
305
311
  }
306
312
 
313
+ .starasia-input-dropdwon-item.highlight {
314
+ background-color: rgba(100, 181, 246, 0.21);
315
+ }
316
+
307
317
  .starasia-input-dropdwon-item-disable {
308
318
  color: var(--starasia-ui-dropdown-color-disable) !important;
309
319
  pointer-events: none;
@@ -433,4 +443,4 @@ React keys must be passed directly to JSX without using spread:
433
443
  height: 100%;
434
444
  width: 100%;
435
445
  }
436
- `;function Ur(u){const[f,m]=l.useState(u),x=l.useRef(null),p=h=>{x.current&&!x.current.contains(h.target)&&m(!1)};return l.useEffect(()=>(document.addEventListener("click",p,!0),()=>{document.removeEventListener("click",p,!0)}),[]),{ref:x,isComponentVisible:f,setIsComponentVisible:m}}const Jr=({...u})=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...u,viewBox:"0 0 24 24",fill:"none",color:"#939E99",children:t.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})}),Hr=({...u})=>t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...u,viewBox:"0 0 20 20",fill:"none",children:[t.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Kr=({isChecked:u})=>t.jsxs("div",{className:"checkbox-wrapper-30",children:[t.jsxs("span",{className:"checkbox",children:[t.jsx("input",{type:"checkbox",style:{pointerEvents:"none"},checked:u}),t.jsx("svg",{children:t.jsx("use",{xlinkHref:"#checkbox-30",className:"checkbox"})})]}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"none"},children:t.jsx("symbol",{id:"checkbox-30",viewBox:"0 0 22 22",children:t.jsx("path",{fill:"none",stroke:"currentColor",d:"M5.5,11.3L9,14.8L20.2,3.3l0,0c-0.5-1-1.5-1.8-2.7-1.8h-13c-1.7,0-3,1.3-3,3v13c0,1.7,1.3,3,3,3h13 c1.7,0,3-1.3,3-3v-13c0-0.4-0.1-0.8-0.3-1.2"})})})]}),Gr=l.forwardRef(({positionDropdown:u,dropdownLists:f,isComponentVisible:m,searchAble:x,onSearch:p,value:h,handleChangeValue:T,multiSelect:y,searchValue:v},F)=>{const[k,O]=l.useState(0),[A,W]=l.useState(),D=l.useRef(null);return l.useEffect(()=>{if(D.current){const o=D.current.getBoundingClientRect();O(o.width)}},[D,m]),l.useEffect(()=>{f&&v?f.forEach(o=>{if(o.label.startsWith(v||"")){W(o.value);return}}):W(void 0)},[v,f]),t.jsx(t.Fragment,{children:m?t.jsxs("div",{className:"starasia-input-dropdown-lists-container",onClick:o=>o.stopPropagation(),ref:F,children:[x?t.jsxs("div",{className:"starasia-input-dropdown-container-dropdown-search",style:{order:u=="bottom"?0:2,position:"sticky",top:0,bottom:0,zIndex:1},children:[t.jsx("div",{style:{display:"flex"},children:t.jsx(Hr,{strokeWidth:2,width:20})}),t.jsx("input",{onChange:o=>{p&&p(o.target.value)},value:v,autoFocus:!0,style:{width:"100%"}})]}):null,t.jsx("div",{className:`starasia-input-dropdwon-item-container ${y?"multi":""}`,ref:D,children:f.map((o,z)=>{const P=!!(h!=null&&h.find(w=>w.value===o.value));return t.jsxs("div",{className:`starasia-input-dropdwon-item ${P?"active":" "} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,onClick:()=>T(o.label,o.value),children:[y?t.jsx("div",{style:{marginRight:"8px"},children:t.jsx(Kr,{isChecked:P})}):null,o.icon?t.jsx("div",{children:l.cloneElement(o.icon,{width:16})}):null,t.jsxs("div",{children:[t.jsx("p",{className:`starasia-input-dropdwon-item-text ${P?"active":null} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${k-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.description?t.jsx("p",{className:`starasia-input-dropdwon-item-text-description ${P?"active":null} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${k-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:o.description}):null]})]},z)})})]}):null})}),Xr=({children:u,handleChangePosition:f})=>{const m=l.useRef(null);l.useEffect(()=>{var T;const p=()=>{if(m.current){let y=m.current.parentElement;for(;y&&!x(y);)y=y.parentElement;y&&f()}};let h=(T=m.current)==null?void 0:T.parentElement;for(;h&&!x(h);)h=h.parentElement;return h&&h.addEventListener("scroll",p),p(),()=>{h&&h.removeEventListener("scroll",p)}},[]);const x=p=>p&&(p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth);return t.jsx("div",{ref:m,children:u})},gr="starasia-input-dropdown-styles";(u=>{if(!document.getElementById(gr)){const f=document.createElement("style");f.id=gr,f.textContent=u,document.head.appendChild(f)}})(Vr);const Zr=({dropdownLists:u,onChange:f,defaultValue:m,size:x="md",multiSelect:p,searchAble:h,iconLeft:T,placeholder:y,onSearch:v,error:F,onBlur:k,onFocus:O,disable:A,searchValue:W})=>{const D=l.useRef(),[o,z]=l.useState([]),[P,w]=l.useState(""),L=l.useRef(null),{isComponentVisible:K,ref:G,setIsComponentVisible:Q}=Ur(!1),or=()=>{Q(j=>!j)},$=(j,E)=>{if(!p)z([{label:j,value:E}]),f([{label:j,value:E}]),Q(!1);else if(o==null?void 0:o.find(R=>R.value===E)){const R=[...o?o.filter(Y=>Y.value!==E):[]];z(R),f(R)}else{const R=[...o||[],{label:j,value:E}];z(R),f(R)}};l.useEffect(()=>{JSON.stringify(D.current)===JSON.stringify(m)||(D.current=m,z(D.current||[]))},[m]);const q=()=>o.length?p?o==null?void 0:o.map((j,E)=>t.jsxs("div",{className:"starasia-input-dropdown-preview-item",children:[t.jsx("p",{style:{minWidth:"max-content"},children:j==null?void 0:j.label},E),t.jsx(Qr,{onClick:()=>$(j.label,j.value)})]})):t.jsx("p",{style:{minWidth:"max-content"},children:o==null?void 0:o[0].label}):t.jsx("p",{className:"starasia-input-dropdown-placeholder",children:y}),N=()=>{if(G.current&&L.current){const j=window.innerHeight,E=G.current.getBoundingClientRect(),C=L.current.getBoundingClientRect(),R=E.bottom+C.height;L.current.style.left=`${E.left}px`,L.current.style.width=`${E.width}px`,R>=j-10?(L.current.style.top=`${E.top-C.height-5}px`,w("top")):(L.current.style.top=`${E.top+E.height}px`,w("bottom"))}};return l.useEffect(()=>(window.addEventListener("scroll",N),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N),window.removeEventListener("resize",N)}),[]),l.useEffect(()=>{N()},[K]),t.jsx(Xr,{handleChangePosition:N,children:t.jsxs("div",{className:`starasia-input-dropdown-container ${A?"disable":""} starasia-input-dropdown-size-${x} ${K?"active":""} ${F?"error":""}`,ref:G,onClick:or,children:[t.jsxs("div",{className:"starasia-input-dropdown-preview-container",children:[T?t.jsx(t.Fragment,{children:l.cloneElement(T,{width:br(x),color:"#939E99",style:{color:"#939E99"}})}):null,t.jsx("div",{className:"starasia-input-dropdown-container-preview-item",tabIndex:100,onBlur:k,onFocus:O,children:q()}),t.jsx(Jr,{strokeWidth:2,width:br(x),style:{color:"#939E99"}})]}),t.jsx(Gr,{dropdownLists:u,handleChangeValue:$,isComponentVisible:K,positionDropdown:P,searchAble:!!h,value:o,onSearch:v,ref:L,multiSelect:p,searchValue:W})]})})},br=u=>{if(u==="sm")return 16;if(u==="md")return 16;if(u==="lg")return 20},Qr=u=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",...u,children:t.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})});B.Dropdown=Zr,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
446
+ `;function Ur(p){const[f,m]=c.useState(p),E=c.useRef(null),v=w=>{E.current&&!E.current.contains(w.target)&&m(!1)};return c.useEffect(()=>(document.addEventListener("click",v,!0),()=>{document.removeEventListener("click",v,!0)}),[]),{ref:E,isComponentVisible:f,setIsComponentVisible:m}}const Hr=({...p})=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...p,viewBox:"0 0 24 24",fill:"none",color:"#939E99",children:t.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})}),Jr=({...p})=>t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...p,viewBox:"0 0 20 20",fill:"none",children:[t.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Kr=({isChecked:p})=>t.jsxs("div",{className:"checkbox-wrapper-30",children:[t.jsxs("span",{className:"checkbox",children:[t.jsx("input",{type:"checkbox",style:{pointerEvents:"none"},checked:p}),t.jsx("svg",{children:t.jsx("use",{xlinkHref:"#checkbox-30",className:"checkbox"})})]}),t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"none"},children:t.jsx("symbol",{id:"checkbox-30",viewBox:"0 0 22 22",children:t.jsx("path",{fill:"none",stroke:"currentColor",d:"M5.5,11.3L9,14.8L20.2,3.3l0,0c-0.5-1-1.5-1.8-2.7-1.8h-13c-1.7,0-3,1.3-3,3v13c0,1.7,1.3,3,3,3h13 c1.7,0,3-1.3,3-3v-13c0-0.4-0.1-0.8-0.3-1.2"})})})]}),Gr=c.forwardRef(({positionDropdown:p,dropdownLists:f,isComponentVisible:m,searchAble:E,onSearch:v,value:w,handleChangeValue:I,multiSelect:j,searchValue:b},S)=>{const[_,W]=c.useState(0),[R,N]=c.useState(),L=c.useRef(null),y=c.useRef(null);return c.useEffect(()=>{if(L.current){const o=L.current.getBoundingClientRect();W(o.width)}},[L,m]),c.useEffect(()=>{f&&b?f.forEach(o=>{if(o.label.startsWith(b||"")){N(o.value);return}}):N(void 0)},[b,f]),c.useEffect(()=>{const o=y.current||(S==null?void 0:S.current);if(!o||!m)return;const h=f.filter(g=>!g.disable),l=g=>{if(g.key==="ArrowDown"){if(g.preventDefault(),!h.length)return;const C=h.findIndex(Y=>Y.value===R),B=C===-1?0:(C+1)%h.length;N(h[B].value)}else if(g.key==="ArrowUp"){if(g.preventDefault(),!h.length)return;const C=h.findIndex(Y=>Y.value===R),B=C<=0?h.length-1:C-1;N(h[B].value)}else if(g.key==="Enter"){if(g.preventDefault(),!R)return;const C=f.find(B=>B.value===R);C&&!C.disable&&I(C.label,C.value)}};return o.addEventListener("keydown",l),()=>o.removeEventListener("keydown",l)},[m,f,R,I,S]),c.useEffect(()=>{if(!R)return;const o=L.current;if(!o)return;const h=o.querySelector(`[data-value="${R}"]`);h&&h.scrollIntoView&&h.scrollIntoView({block:"nearest"})},[R]),t.jsx(t.Fragment,{children:m?t.jsxs("div",{className:"starasia-input-dropdown-lists-container",onClick:o=>o.stopPropagation(),ref:o=>{if(y.current=o,typeof S=="function")S(o);else if(S)try{S.current=o}catch{}},tabIndex:0,children:[E?t.jsxs("div",{className:"starasia-input-dropdown-container-dropdown-search",style:{order:p=="bottom"?0:2,position:"sticky",top:0,bottom:0,zIndex:1},children:[t.jsx("div",{style:{display:"flex"},children:t.jsx(Jr,{strokeWidth:2,width:20})}),t.jsx("input",{onChange:o=>{v&&v(o.target.value)},value:b,autoFocus:!0,style:{width:"100%"}})]}):null,t.jsx("div",{className:`starasia-input-dropdwon-item-container ${j?"multi":""}`,ref:L,children:f.map((o,h)=>{const l=!!(w!=null&&w.find(g=>g.value===o.value));return t.jsxs("div",{"data-value":o.value,className:`starasia-input-dropdwon-item ${l?"active":" "} ${R===o.value?"highlight":""} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,onClick:()=>I(o.label,o.value),children:[j?t.jsx("div",{style:{marginRight:"8px"},children:t.jsx(Kr,{isChecked:l})}):null,o.icon?t.jsx("div",{children:c.cloneElement(o.icon,{width:16})}):null,t.jsxs("div",{children:[t.jsx("p",{className:`starasia-input-dropdwon-item-text ${l?"active":null} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${_-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.description?t.jsx("p",{className:`starasia-input-dropdwon-item-text-description ${l?"active":null} ${o.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${_-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:o.description}):null]})]},h)})})]}):null})}),Xr=({children:p,handleChangePosition:f})=>{const m=c.useRef(null);c.useEffect(()=>{var I;const v=()=>{if(m.current){let j=m.current.parentElement;for(;j&&!E(j);)j=j.parentElement;j&&f()}};let w=(I=m.current)==null?void 0:I.parentElement;for(;w&&!E(w);)w=w.parentElement;return w&&w.addEventListener("scroll",v),v(),()=>{w&&w.removeEventListener("scroll",v)}},[]);const E=v=>v&&(v.scrollHeight>v.clientHeight||v.scrollWidth>v.clientWidth);return t.jsx("div",{ref:m,children:p})},gr="starasia-input-dropdown-styles";(p=>{if(!document.getElementById(gr)){const f=document.createElement("style");f.id=gr,f.textContent=p,document.head.appendChild(f)}})(Vr);const Zr=({dropdownLists:p,onChange:f,defaultValue:m,size:E="md",multiSelect:v,searchAble:w,iconLeft:I,placeholder:j,onSearch:b,error:S,onBlur:_,onFocus:W,disable:R,searchValue:N})=>{const L=c.useRef(),[y,o]=c.useState([]),[h,l]=c.useState(""),g=c.useRef(null),{isComponentVisible:C,ref:B,setIsComponentVisible:Y}=Ur(!1),or=()=>{Y(T=>!T)},$=(T,O)=>{if(!v)o([{label:T,value:O}]),f([{label:T,value:O}]),Y(!1);else if(y==null?void 0:y.find(P=>P.value===O)){const P=[...y?y.filter(U=>U.value!==O):[]];o(P),f(P)}else{const P=[...y||[],{label:T,value:O}];o(P),f(P)}};c.useEffect(()=>{JSON.stringify(L.current)===JSON.stringify(m)||(L.current=m,o(L.current||[]))},[m]);const q=()=>y.length?v?y==null?void 0:y.map((T,O)=>t.jsxs("div",{className:"starasia-input-dropdown-preview-item",children:[t.jsx("p",{style:{minWidth:"max-content"},children:T==null?void 0:T.label},O),t.jsx(Qr,{onClick:()=>$(T.label,T.value)})]})):t.jsx("p",{style:{minWidth:"max-content"},children:y==null?void 0:y[0].label}):t.jsx("p",{className:"starasia-input-dropdown-placeholder",children:j}),M=()=>{if(B.current&&g.current){const T=window.innerHeight,O=B.current.getBoundingClientRect(),F=g.current.getBoundingClientRect(),P=O.bottom+F.height;g.current.style.left=`${O.left}px`,g.current.style.width=`${O.width}px`,P>=T-10?(g.current.style.top=`${O.top-F.height-5}px`,l("top")):(g.current.style.top=`${O.top+O.height}px`,l("bottom"))}};return c.useEffect(()=>(window.addEventListener("scroll",M),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M),window.removeEventListener("resize",M)}),[]),c.useEffect(()=>{M()},[C]),c.useEffect(()=>{C&&g.current&&!w&&setTimeout(()=>{try{g.current&&g.current.focus()}catch{}},0)},[C,w]),t.jsx(Xr,{handleChangePosition:M,children:t.jsxs("div",{className:`starasia-input-dropdown-container ${R?"disable":""} starasia-input-dropdown-size-${E} ${C?"active":""} ${S?"error":""}`,ref:B,onClick:or,children:[t.jsxs("div",{className:"starasia-input-dropdown-preview-container",children:[I?t.jsx(t.Fragment,{children:c.cloneElement(I,{width:br(E),color:"#939E99",style:{color:"#939E99"}})}):null,t.jsx("div",{className:"starasia-input-dropdown-container-preview-item",tabIndex:100,onBlur:_,onFocus:W,children:q()}),t.jsx(Hr,{strokeWidth:2,width:br(E),style:{color:"#939E99"}})]}),t.jsx(Gr,{dropdownLists:p,handleChangeValue:$,isComponentVisible:C,positionDropdown:h,searchAble:!!w,value:y,onSearch:b,ref:g,multiSelect:v,searchValue:N})]})})},br=p=>{if(p==="sm")return 16;if(p==="md")return 16;if(p==="lg")return 20},Qr=p=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",...p,children:t.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})});V.Dropdown=Zr,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/dropdown",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "dropdown component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/dropdown.umd.js",