@starasia/dropdown 1.0.3 → 1.0.5
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.
- package/dist/dropdown.es.js +187 -846
- package/dist/dropdown.umd.js +15 -64
- package/package.json +1 -1
package/dist/dropdown.umd.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
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={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
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`
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
28
|
-
let props = %s;
|
|
29
|
-
<%s {...props} />
|
|
30
|
-
React keys must be passed directly to JSX without using spread:
|
|
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");
|
|
1
|
+
(function(w,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(w=typeof globalThis<"u"?globalThis:w||self,n(w.Dropdown={},w.jsxRuntime,w.React))})(this,function(w,n,o){"use strict";const q=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
33
2
|
* {
|
|
34
3
|
margin: 0;
|
|
35
4
|
padding: 0;
|
|
@@ -38,27 +7,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
38
7
|
}
|
|
39
8
|
:root {
|
|
40
9
|
/* color */
|
|
41
|
-
/*
|
|
42
|
-
--starasia-ui-dropdown-color-primary-blue: var(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
--starasia-ui-dropdown-color-
|
|
47
|
-
--starasia-ui-color-blue-500,
|
|
48
|
-
#3b82f6
|
|
49
|
-
);
|
|
50
|
-
--starasia-ui-dropdown-color-tertiary-blue: var(
|
|
51
|
-
--starasia-ui-color-blue-300,
|
|
52
|
-
#93c5fd
|
|
53
|
-
);
|
|
54
|
-
--starasia-ui-dropdown-color-quaternary-blue: var(
|
|
55
|
-
--starasia-ui-color-blue-100,
|
|
56
|
-
#dbeafe
|
|
57
|
-
);
|
|
58
|
-
--starasia-ui-dropdown-color-quinary-blue: var(
|
|
59
|
-
--starasia-ui-color-blue-50,
|
|
60
|
-
#eff6ff
|
|
61
|
-
);
|
|
10
|
+
/* brand */
|
|
11
|
+
--starasia-ui-dropdown-color-primary-blue: var(--starasia-ui-brand-primary-default);
|
|
12
|
+
--starasia-ui-dropdown-color-secondary-blue: var(--starasia-ui-brand-primary-default);
|
|
13
|
+
--starasia-ui-dropdown-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
|
|
14
|
+
--starasia-ui-dropdown-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
15
|
+
--starasia-ui-dropdown-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
62
16
|
/* gray */
|
|
63
17
|
--starasia-ui-dropdown-color-primary-gray: var(
|
|
64
18
|
--starasia-ui-color-gray-700,
|
|
@@ -97,10 +51,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
97
51
|
);
|
|
98
52
|
|
|
99
53
|
/* border color */
|
|
100
|
-
--starasia-ui-dropdown-border-color-primary: var(
|
|
101
|
-
--starasia-ui-color-blue-500,
|
|
102
|
-
#3b82f6
|
|
103
|
-
);
|
|
54
|
+
--starasia-ui-dropdown-border-color-primary: var(--starasia-ui-brand-primary-default);
|
|
104
55
|
--starasia-ui-dropdown-border-color-secondary: var(
|
|
105
56
|
--starasia-ui-color-gray-300,
|
|
106
57
|
#d1d5db
|
|
@@ -126,7 +77,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
126
77
|
--starasia-ui-dropdown-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
|
|
127
78
|
|
|
128
79
|
/* shadow */
|
|
129
|
-
--starasia-ui-dropdown-box-shadow: 0px 0px 0px 2px rgba(
|
|
80
|
+
--starasia-ui-dropdown-box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary), 0.2);
|
|
130
81
|
|
|
131
82
|
/* below is for size,above is */
|
|
132
83
|
--starasia-ui-dropdown-fontWeight-normal: var(
|
|
@@ -294,12 +245,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
294
245
|
}
|
|
295
246
|
|
|
296
247
|
.starasia-input-dropdwon-item:hover {
|
|
297
|
-
background-color: rgba(
|
|
248
|
+
background-color: rgba(var(--starasia-ui-raw-color-brand-secondary), 0.21);
|
|
298
249
|
}
|
|
299
250
|
.starasia-input-dropdwon-item.active {
|
|
300
251
|
/* color: var(--starasia-ui-dropdown-background-color-primary); */
|
|
301
252
|
/* border-radius: var(--borderRadius); */
|
|
302
|
-
background-color: rgba(
|
|
253
|
+
background-color: rgba(var(--starasia-ui-raw-color-brand-secondary), 0.21);
|
|
303
254
|
/* background: var(--starasia-ui-dropdown-background-color-secondary); */
|
|
304
255
|
/* box-shadow: 0px 0px 0px -1px #f0f0f0; */
|
|
305
256
|
}
|
|
@@ -344,7 +295,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
344
295
|
font-weight: 500;
|
|
345
296
|
}
|
|
346
297
|
.starasia-input-dropdwon-item-text.active {
|
|
347
|
-
color:
|
|
298
|
+
color: var(--starasia-ui-brand-primary-default);
|
|
348
299
|
}
|
|
349
300
|
|
|
350
301
|
.starasia-input-dropdwon-item-text-description {
|
|
@@ -354,14 +305,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
354
305
|
font-weight: 400;
|
|
355
306
|
}
|
|
356
307
|
.starasia-input-dropdwon-item-text-description.active {
|
|
357
|
-
color:
|
|
308
|
+
color: var(--starasia-ui-brand-primary-default);
|
|
358
309
|
}
|
|
359
310
|
|
|
360
311
|
/* for checkbox */
|
|
361
312
|
.checkbox-wrapper-30 .checkbox {
|
|
362
313
|
--bg: #fff;
|
|
363
314
|
--brdr: #d1d6ee;
|
|
364
|
-
--brdr-actv:
|
|
315
|
+
--brdr-actv: var(--starasia-ui-brand-primary-default);
|
|
365
316
|
--brdr-hovr: #bbc1e1;
|
|
366
317
|
--dur: calc((var(--size, 2) / 2) * 0.6s);
|
|
367
318
|
display: inline-block;
|
|
@@ -433,4 +384,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
433
384
|
height: 100%;
|
|
434
385
|
width: 100%;
|
|
435
386
|
}
|
|
436
|
-
`;function
|
|
387
|
+
`;function A(a){const[e,t]=o.useState(a),p=o.useRef(null),i=s=>{p.current&&!p.current.contains(s.target)&&t(!1)};return o.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)}),[]),{ref:p,isComponentVisible:e,setIsComponentVisible:t}}const D=({...a})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...a,viewBox:"0 0 24 24",fill:"none",color:"#939E99",children:n.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})}),F=({...a})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...a,viewBox:"0 0 20 20",fill:"none",children:[n.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),O=({isChecked:a})=>n.jsxs("div",{className:"checkbox-wrapper-30",children:[n.jsxs("span",{className:"checkbox",children:[n.jsx("input",{type:"checkbox",style:{pointerEvents:"none"},checked:a}),n.jsx("svg",{children:n.jsx("use",{xlinkHref:"#checkbox-30",className:"checkbox"})})]}),n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"none"},children:n.jsx("symbol",{id:"checkbox-30",viewBox:"0 0 22 22",children:n.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"})})})]}),H=o.forwardRef(({positionDropdown:a,dropdownLists:e,isComponentVisible:t,searchAble:p,onSearch:i,value:s,handleChangeValue:g,multiSelect:l,searchValue:v},E)=>{const[m,z]=o.useState(0),[N,k]=o.useState(),h=o.useRef(null);return o.useEffect(()=>{if(h.current){const r=h.current.getBoundingClientRect();z(r.width)}},[h,t]),o.useEffect(()=>{e&&v?e.forEach(r=>{if(r.label.startsWith(v||"")){k(r.value);return}}):k(void 0)},[v,e]),n.jsx(n.Fragment,{children:t?n.jsxs("div",{className:"starasia-input-dropdown-lists-container",onClick:r=>r.stopPropagation(),ref:E,children:[p?n.jsxs("div",{className:"starasia-input-dropdown-container-dropdown-search",style:{order:a=="bottom"?0:2,position:"sticky",top:0,bottom:0,zIndex:1},children:[n.jsx("div",{style:{display:"flex"},children:n.jsx(F,{strokeWidth:2,width:20})}),n.jsx("input",{onChange:r=>{i&&i(r.target.value)},value:v,autoFocus:!0,style:{width:"100%"}})]}):null,n.jsx("div",{className:`starasia-input-dropdwon-item-container ${l?"multi":""}`,ref:h,children:e.map((r,f)=>{const x=!!(s!=null&&s.find(C=>C.value===r.value));return n.jsxs("div",{className:`starasia-input-dropdwon-item ${x?"active":" "} ${r.disable?"starasia-input-dropdwon-item-disable":null}`,onClick:()=>g(r.label,r.value),children:[l?n.jsx("div",{style:{marginRight:"8px"},children:n.jsx(O,{isChecked:x})}):null,r.icon?n.jsx("div",{children:o.cloneElement(r.icon,{width:16})}):null,n.jsxs("div",{children:[n.jsx("p",{className:`starasia-input-dropdwon-item-text ${x?"active":null} ${r.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${m-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:r.label}),r.description?n.jsx("p",{className:`starasia-input-dropdwon-item-text-description ${x?"active":null} ${r.disable?"starasia-input-dropdwon-item-disable":null}`,style:{textWrap:"nowrap",width:`${m-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:r.description}):null]})]},f)})})]}):null})}),M=({children:a,handleChangePosition:e})=>{const t=o.useRef(null);o.useEffect(()=>{var g;const i=()=>{if(t.current){let l=t.current.parentElement;for(;l&&!p(l);)l=l.parentElement;l&&e()}};let s=(g=t.current)==null?void 0:g.parentElement;for(;s&&!p(s);)s=s.parentElement;return s&&s.addEventListener("scroll",i),i(),()=>{s&&s.removeEventListener("scroll",i)}},[]);const p=i=>i&&(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);return n.jsx("div",{ref:t,children:a})},W="starasia-input-dropdown-styles";(a=>{if(!document.getElementById(W)){const e=document.createElement("style");e.id=W,e.textContent=a,document.head.appendChild(e)}})(q);const P=({dropdownLists:a,onChange:e,defaultValue:t,size:p="md",multiSelect:i,searchAble:s,iconLeft:g,placeholder:l,onSearch:v,error:E,onBlur:m,onFocus:z,disable:N,searchValue:k})=>{const h=o.useRef(),[r,f]=o.useState([]),[x,C]=o.useState(""),b=o.useRef(null),{isComponentVisible:I,ref:B,setIsComponentVisible:S}=A(!1),V=()=>{S(d=>!d)},j=(d,c)=>{if(!i)f([{label:d,value:c}]),e([{label:d,value:c}]),S(!1);else if(r==null?void 0:r.find(u=>u.value===c)){const u=[...r?r.filter(G=>G.value!==c):[]];f(u),e(u)}else{const u=[...r||[],{label:d,value:c}];f(u),e(u)}};o.useEffect(()=>{JSON.stringify(h.current)===JSON.stringify(t)||(h.current=t,f(h.current||[]))},[t]);const J=()=>r.length?i?r==null?void 0:r.map((d,c)=>n.jsxs("div",{className:"starasia-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:d==null?void 0:d.label},c),n.jsx(T,{onClick:()=>j(d.label,d.value)})]})):n.jsx("p",{style:{minWidth:"max-content"},children:r==null?void 0:r[0].label}):n.jsx("p",{className:"starasia-input-dropdown-placeholder",children:l}),y=()=>{if(B.current&&b.current){const d=window.innerHeight,c=B.current.getBoundingClientRect(),L=b.current.getBoundingClientRect(),u=c.bottom+L.height;b.current.style.left=`${c.left}px`,b.current.style.width=`${c.width}px`,u>=d-10?(b.current.style.top=`${c.top-L.height-5}px`,C("top")):(b.current.style.top=`${c.top+c.height}px`,C("bottom"))}};return o.useEffect(()=>(window.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y),window.removeEventListener("resize",y)}),[]),o.useEffect(()=>{y()},[I]),n.jsx(M,{handleChangePosition:y,children:n.jsxs("div",{className:`starasia-input-dropdown-container ${N?"disable":""} starasia-input-dropdown-size-${p} ${I?"active":""} ${E?"error":""}`,ref:B,onClick:V,children:[n.jsxs("div",{className:"starasia-input-dropdown-preview-container",children:[g?n.jsx(n.Fragment,{children:o.cloneElement(g,{width:$(p),color:"#939E99",style:{color:"#939E99"}})}):null,n.jsx("div",{className:"starasia-input-dropdown-container-preview-item",tabIndex:100,onBlur:m,onFocus:z,children:J()}),n.jsx(D,{strokeWidth:2,width:$(p),style:{color:"#939E99"}})]}),n.jsx(H,{dropdownLists:a,handleChangeValue:j,isComponentVisible:I,positionDropdown:x,searchAble:!!s,value:r,onSearch:v,ref:b,multiSelect:i,searchValue:k})]})})},$=a=>{if(a==="sm")return 16;if(a==="md")return 16;if(a==="lg")return 20},T=a=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",...a,children:n.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})});w.Dropdown=P,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|