@hudoro/dropdown
Advanced tools
Comparing version 0.0.3-beta.41 to 0.0.3-beta.42
@@ -1,2 +0,2 @@ | ||
import H, { useState as fr, useRef as pr, useEffect as J } from "react"; | ||
import H, { useState as er, useRef as or, useEffect as Y, forwardRef as fn } from "react"; | ||
var hr = { exports: {} }, q = {}; | ||
@@ -12,21 +12,21 @@ /** | ||
*/ | ||
var Lr; | ||
function pn() { | ||
if (Lr) | ||
var Wr; | ||
function hn() { | ||
if (Wr) | ||
return q; | ||
Lr = 1; | ||
var v = H, y = Symbol.for("react.element"), C = Symbol.for("react.fragment"), E = Object.prototype.hasOwnProperty, k = v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, P = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function D(T, g, F) { | ||
var h, _ = {}, O = null, $ = null; | ||
F !== void 0 && (O = "" + F), g.key !== void 0 && (O = "" + g.key), g.ref !== void 0 && ($ = g.ref); | ||
for (h in g) | ||
E.call(g, h) && !P.hasOwnProperty(h) && (_[h] = g[h]); | ||
if (T && T.defaultProps) | ||
for (h in g = T.defaultProps, g) | ||
_[h] === void 0 && (_[h] = g[h]); | ||
return { $$typeof: y, type: T, key: O, ref: $, props: _, _owner: k.current }; | ||
Wr = 1; | ||
var c = H, w = Symbol.for("react.element"), _ = Symbol.for("react.fragment"), b = Object.prototype.hasOwnProperty, j = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function P(S, p, F) { | ||
var u, t = {}, C = null, E = null; | ||
F !== void 0 && (C = "" + F), p.key !== void 0 && (C = "" + p.key), p.ref !== void 0 && (E = p.ref); | ||
for (u in p) | ||
b.call(p, u) && !y.hasOwnProperty(u) && (t[u] = p[u]); | ||
if (S && S.defaultProps) | ||
for (u in p = S.defaultProps, p) | ||
t[u] === void 0 && (t[u] = p[u]); | ||
return { $$typeof: w, type: S, key: C, ref: E, props: t, _owner: j.current }; | ||
} | ||
return q.Fragment = C, q.jsx = D, q.jsxs = D, q; | ||
return q.Fragment = _, q.jsx = P, q.jsxs = P, q; | ||
} | ||
var B = {}; | ||
var J = {}; | ||
/** | ||
@@ -41,14 +41,14 @@ * @license React | ||
*/ | ||
var Wr; | ||
function hn() { | ||
return Wr || (Wr = 1, process.env.NODE_ENV !== "production" && function() { | ||
var v = H, y = Symbol.for("react.element"), C = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), D = Symbol.for("react.provider"), T = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), $ = Symbol.for("react.offscreen"), L = Symbol.iterator, l = "@@iterator"; | ||
function W(r) { | ||
var Nr; | ||
function vn() { | ||
return Nr || (Nr = 1, process.env.NODE_ENV !== "production" && function() { | ||
var c = H, w = Symbol.for("react.element"), _ = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), P = Symbol.for("react.provider"), S = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), t = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), E = Symbol.for("react.offscreen"), I = Symbol.iterator, g = "@@iterator"; | ||
function N(r) { | ||
if (r === null || typeof r != "object") | ||
return null; | ||
var n = L && r[L] || r[l]; | ||
var n = I && r[I] || r[g]; | ||
return typeof n == "function" ? n : null; | ||
} | ||
var j = v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function f(r) { | ||
var D = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function h(r) { | ||
{ | ||
@@ -62,33 +62,33 @@ for (var n = arguments.length, e = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++) | ||
{ | ||
var o = j.ReactDebugCurrentFrame, d = o.getStackAddendum(); | ||
d !== "" && (n += "%s", e = e.concat([d])); | ||
var u = e.map(function(a) { | ||
var o = D.ReactDebugCurrentFrame, s = o.getStackAddendum(); | ||
s !== "" && (n += "%s", e = e.concat([s])); | ||
var l = e.map(function(a) { | ||
return String(a); | ||
}); | ||
u.unshift("Warning: " + n), Function.prototype.apply.call(console[r], console, u); | ||
l.unshift("Warning: " + n), Function.prototype.apply.call(console[r], console, l); | ||
} | ||
} | ||
var Y = !1, M = !1, G = !1, or = !1, K = !1, X; | ||
X = Symbol.for("react.module.reference"); | ||
function I(r) { | ||
return !!(typeof r == "string" || typeof r == "function" || r === E || r === P || K || r === k || r === F || r === h || or || r === $ || Y || M || G || typeof r == "object" && r !== null && (r.$$typeof === O || r.$$typeof === _ || r.$$typeof === D || r.$$typeof === T || r.$$typeof === g || // This needs to include all possible module reference object | ||
var B = !1, M = !1, G = !1, tr = !1, ir = !1, K; | ||
K = Symbol.for("react.module.reference"); | ||
function A(r) { | ||
return !!(typeof r == "string" || typeof r == "function" || r === b || r === y || ir || r === j || r === F || r === u || tr || r === E || B || M || G || typeof r == "object" && r !== null && (r.$$typeof === C || r.$$typeof === t || r.$$typeof === P || r.$$typeof === S || r.$$typeof === p || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
// we don't know which Flight build this will end up being used | ||
// with. | ||
r.$$typeof === X || r.getModuleId !== void 0)); | ||
r.$$typeof === K || r.getModuleId !== void 0)); | ||
} | ||
function i(r, n, e) { | ||
function R(r, n, e) { | ||
var o = r.displayName; | ||
if (o) | ||
return o; | ||
var d = n.displayName || n.name || ""; | ||
return d !== "" ? e + "(" + d + ")" : e; | ||
var s = n.displayName || n.name || ""; | ||
return s !== "" ? e + "(" + s + ")" : e; | ||
} | ||
function w(r) { | ||
function k(r) { | ||
return r.displayName || "Context"; | ||
} | ||
function b(r) { | ||
function T(r) { | ||
if (r == null) | ||
return null; | ||
if (typeof r.tag == "number" && f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function") | ||
if (typeof r.tag == "number" && h("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; | ||
@@ -98,13 +98,13 @@ if (typeof r == "string") | ||
switch (r) { | ||
case E: | ||
case b: | ||
return "Fragment"; | ||
case C: | ||
case _: | ||
return "Portal"; | ||
case P: | ||
case y: | ||
return "Profiler"; | ||
case k: | ||
case j: | ||
return "StrictMode"; | ||
case F: | ||
return "Suspense"; | ||
case h: | ||
case u: | ||
return "SuspenseList"; | ||
@@ -114,17 +114,17 @@ } | ||
switch (r.$$typeof) { | ||
case T: | ||
case S: | ||
var n = r; | ||
return w(n) + ".Consumer"; | ||
case D: | ||
return k(n) + ".Consumer"; | ||
case P: | ||
var e = r; | ||
return w(e._context) + ".Provider"; | ||
case g: | ||
return i(r, r.render, "ForwardRef"); | ||
case _: | ||
return k(e._context) + ".Provider"; | ||
case p: | ||
return R(r, r.render, "ForwardRef"); | ||
case t: | ||
var o = r.displayName || null; | ||
return o !== null ? o : b(r.type) || "Memo"; | ||
case O: { | ||
var d = r, u = d._payload, a = d._init; | ||
return o !== null ? o : T(r.type) || "Memo"; | ||
case C: { | ||
var s = r, l = s._payload, a = s._init; | ||
try { | ||
return b(a(u)); | ||
return T(a(l)); | ||
} catch { | ||
@@ -137,10 +137,10 @@ return null; | ||
} | ||
var m = Object.assign, A = 0, vr, gr, wr, br, mr, yr, xr; | ||
var m = Object.assign, W = 0, vr, wr, gr, br, mr, yr, xr; | ||
function Er() { | ||
} | ||
Er.__reactDisabledLog = !0; | ||
function Vr() { | ||
function Yr() { | ||
{ | ||
if (A === 0) { | ||
vr = console.log, gr = console.info, wr = console.warn, br = console.error, mr = console.group, yr = console.groupCollapsed, xr = console.groupEnd; | ||
if (W === 0) { | ||
vr = console.log, wr = console.info, gr = console.warn, br = console.error, mr = console.group, yr = console.groupCollapsed, xr = console.groupEnd; | ||
var r = { | ||
@@ -162,8 +162,8 @@ configurable: !0, | ||
} | ||
A++; | ||
W++; | ||
} | ||
} | ||
function Yr() { | ||
function Vr() { | ||
{ | ||
if (A--, A === 0) { | ||
if (W--, W === 0) { | ||
var r = { | ||
@@ -179,6 +179,6 @@ configurable: !0, | ||
info: m({}, r, { | ||
value: gr | ||
value: wr | ||
}), | ||
warn: m({}, r, { | ||
value: wr | ||
value: gr | ||
}), | ||
@@ -199,29 +199,29 @@ error: m({}, r, { | ||
} | ||
A < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
W < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
} | ||
} | ||
var tr = j.ReactCurrentDispatcher, ir; | ||
function Z(r, n, e) { | ||
var ar = D.ReactCurrentDispatcher, dr; | ||
function X(r, n, e) { | ||
{ | ||
if (ir === void 0) | ||
if (dr === void 0) | ||
try { | ||
throw Error(); | ||
} catch (d) { | ||
var o = d.stack.trim().match(/\n( *(at )?)/); | ||
ir = o && o[1] || ""; | ||
} catch (s) { | ||
var o = s.stack.trim().match(/\n( *(at )?)/); | ||
dr = o && o[1] || ""; | ||
} | ||
return ` | ||
` + ir + r; | ||
` + dr + r; | ||
} | ||
} | ||
var ar = !1, Q; | ||
var sr = !1, Z; | ||
{ | ||
var Mr = typeof WeakMap == "function" ? WeakMap : Map; | ||
Q = new Mr(); | ||
var Br = typeof WeakMap == "function" ? WeakMap : Map; | ||
Z = new Br(); | ||
} | ||
function Rr(r, n) { | ||
if (!r || ar) | ||
if (!r || sr) | ||
return ""; | ||
{ | ||
var e = Q.get(r); | ||
var e = Z.get(r); | ||
if (e !== void 0) | ||
@@ -231,7 +231,7 @@ return e; | ||
var o; | ||
ar = !0; | ||
var d = Error.prepareStackTrace; | ||
sr = !0; | ||
var s = Error.prepareStackTrace; | ||
Error.prepareStackTrace = void 0; | ||
var u; | ||
u = tr.current, tr.current = null, Vr(); | ||
var l; | ||
l = ar.current, ar.current = null, Yr(); | ||
try { | ||
@@ -249,4 +249,4 @@ if (n) { | ||
Reflect.construct(a, []); | ||
} catch (S) { | ||
o = S; | ||
} catch ($) { | ||
o = $; | ||
} | ||
@@ -257,4 +257,4 @@ Reflect.construct(r, [], a); | ||
a.call(); | ||
} catch (S) { | ||
o = S; | ||
} catch ($) { | ||
o = $; | ||
} | ||
@@ -266,23 +266,23 @@ r.call(a.prototype); | ||
throw Error(); | ||
} catch (S) { | ||
o = S; | ||
} catch ($) { | ||
o = $; | ||
} | ||
r(); | ||
} | ||
} catch (S) { | ||
if (S && o && typeof S.stack == "string") { | ||
for (var t = S.stack.split(` | ||
} catch ($) { | ||
if ($ && o && typeof $.stack == "string") { | ||
for (var i = $.stack.split(` | ||
`), x = o.stack.split(` | ||
`), c = t.length - 1, p = x.length - 1; c >= 1 && p >= 0 && t[c] !== x[p]; ) | ||
p--; | ||
for (; c >= 1 && p >= 0; c--, p--) | ||
if (t[c] !== x[p]) { | ||
if (c !== 1 || p !== 1) | ||
`), f = i.length - 1, v = x.length - 1; f >= 1 && v >= 0 && i[f] !== x[v]; ) | ||
v--; | ||
for (; f >= 1 && v >= 0; f--, v--) | ||
if (i[f] !== x[v]) { | ||
if (f !== 1 || v !== 1) | ||
do | ||
if (c--, p--, p < 0 || t[c] !== x[p]) { | ||
var R = ` | ||
` + t[c].replace(" at new ", " at "); | ||
return r.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", r.displayName)), typeof r == "function" && Q.set(r, R), R; | ||
if (f--, v--, v < 0 || i[f] !== x[v]) { | ||
var O = ` | ||
` + i[f].replace(" at new ", " at "); | ||
return r.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", r.displayName)), typeof r == "function" && Z.set(r, O), O; | ||
} | ||
while (c >= 1 && p >= 0); | ||
while (f >= 1 && v >= 0); | ||
break; | ||
@@ -292,37 +292,37 @@ } | ||
} finally { | ||
ar = !1, tr.current = u, Yr(), Error.prepareStackTrace = d; | ||
sr = !1, ar.current = l, Vr(), Error.prepareStackTrace = s; | ||
} | ||
var z = r ? r.displayName || r.name : "", $r = z ? Z(z) : ""; | ||
return typeof r == "function" && Q.set(r, $r), $r; | ||
var z = r ? r.displayName || r.name : "", Ar = z ? X(z) : ""; | ||
return typeof r == "function" && Z.set(r, Ar), Ar; | ||
} | ||
function Ur(r, n, e) { | ||
function Mr(r, n, e) { | ||
return Rr(r, !1); | ||
} | ||
function qr(r) { | ||
function Ur(r) { | ||
var n = r.prototype; | ||
return !!(n && n.isReactComponent); | ||
} | ||
function rr(r, n, e) { | ||
function Q(r, n, e) { | ||
if (r == null) | ||
return ""; | ||
if (typeof r == "function") | ||
return Rr(r, qr(r)); | ||
return Rr(r, Ur(r)); | ||
if (typeof r == "string") | ||
return Z(r); | ||
return X(r); | ||
switch (r) { | ||
case F: | ||
return Z("Suspense"); | ||
case h: | ||
return Z("SuspenseList"); | ||
return X("Suspense"); | ||
case u: | ||
return X("SuspenseList"); | ||
} | ||
if (typeof r == "object") | ||
switch (r.$$typeof) { | ||
case g: | ||
return Ur(r.render); | ||
case _: | ||
return rr(r.type, n, e); | ||
case O: { | ||
var o = r, d = o._payload, u = o._init; | ||
case p: | ||
return Mr(r.render); | ||
case t: | ||
return Q(r.type, n, e); | ||
case C: { | ||
var o = r, s = o._payload, l = o._init; | ||
try { | ||
return rr(u(d), n, e); | ||
return Q(l(s), n, e); | ||
} catch { | ||
@@ -334,6 +334,6 @@ } | ||
} | ||
var nr = Object.prototype.hasOwnProperty, _r = {}, jr = j.ReactDebugCurrentFrame; | ||
function er(r) { | ||
var rr = Object.prototype.hasOwnProperty, _r = {}, jr = D.ReactDebugCurrentFrame; | ||
function nr(r) { | ||
if (r) { | ||
var n = r._owner, e = rr(r.type, r._source, n ? n.type : null); | ||
var n = r._owner, e = Q(r.type, r._source, n ? n.type : null); | ||
jr.setExtraStackFrame(e); | ||
@@ -343,8 +343,8 @@ } else | ||
} | ||
function Br(r, n, e, o, d) { | ||
function qr(r, n, e, o, s) { | ||
{ | ||
var u = Function.call.bind(nr); | ||
var l = Function.call.bind(rr); | ||
for (var a in r) | ||
if (u(r, a)) { | ||
var t = void 0; | ||
if (l(r, a)) { | ||
var i = void 0; | ||
try { | ||
@@ -355,7 +355,7 @@ if (typeof r[a] != "function") { | ||
} | ||
t = r[a](n, a, o, e, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
} catch (c) { | ||
t = c; | ||
i = r[a](n, a, o, e, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
} catch (f) { | ||
i = f; | ||
} | ||
t && !(t instanceof Error) && (er(d), f("%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).", o || "React class", e, a, typeof t), er(null)), t instanceof Error && !(t.message in _r) && (_r[t.message] = !0, er(d), f("Failed %s type: %s", e, t.message), er(null)); | ||
i && !(i instanceof Error) && (nr(s), h("%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).", o || "React class", e, a, typeof i), nr(null)), i instanceof Error && !(i.message in _r) && (_r[i.message] = !0, nr(s), h("Failed %s type: %s", e, i.message), nr(null)); | ||
} | ||
@@ -365,3 +365,3 @@ } | ||
var Jr = Array.isArray; | ||
function dr(r) { | ||
function lr(r) { | ||
return Jr(r); | ||
@@ -387,5 +387,5 @@ } | ||
if (Gr(r)) | ||
return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Hr(r)), Cr(r); | ||
return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Hr(r)), Cr(r); | ||
} | ||
var U = j.ReactCurrentOwner, Kr = { | ||
var U = D.ReactCurrentOwner, Kr = { | ||
key: !0, | ||
@@ -395,6 +395,6 @@ ref: !0, | ||
__source: !0 | ||
}, Tr, Or, sr; | ||
sr = {}; | ||
}, Tr, Or, ur; | ||
ur = {}; | ||
function Xr(r) { | ||
if (nr.call(r, "ref")) { | ||
if (rr.call(r, "ref")) { | ||
var n = Object.getOwnPropertyDescriptor(r, "ref").get; | ||
@@ -407,3 +407,3 @@ if (n && n.isReactWarning) | ||
function Zr(r) { | ||
if (nr.call(r, "key")) { | ||
if (rr.call(r, "key")) { | ||
var n = Object.getOwnPropertyDescriptor(r, "key").get; | ||
@@ -417,4 +417,4 @@ if (n && n.isReactWarning) | ||
if (typeof r.ref == "string" && U.current && n && U.current.stateNode !== n) { | ||
var e = b(U.current.type); | ||
sr[e] || (f('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(U.current.type), r.ref), sr[e] = !0); | ||
var e = T(U.current.type); | ||
ur[e] || (h('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', T(U.current.type), r.ref), ur[e] = !0); | ||
} | ||
@@ -425,3 +425,3 @@ } | ||
var e = function() { | ||
Tr || (Tr = !0, f("%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)); | ||
Tr || (Tr = !0, h("%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)); | ||
}; | ||
@@ -437,3 +437,3 @@ e.isReactWarning = !0, Object.defineProperty(r, "key", { | ||
var e = function() { | ||
Or || (Or = !0, f("%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)); | ||
Or || (Or = !0, h("%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)); | ||
}; | ||
@@ -446,6 +446,6 @@ e.isReactWarning = !0, Object.defineProperty(r, "ref", { | ||
} | ||
var en = function(r, n, e, o, d, u, a) { | ||
var t = { | ||
var en = function(r, n, e, o, s, l, a) { | ||
var i = { | ||
// This tag allows us to uniquely identify this as a React Element | ||
$$typeof: y, | ||
$$typeof: w, | ||
// Built-in properties that belong on the element | ||
@@ -457,5 +457,5 @@ type: r, | ||
// Record the component responsible for creating this element. | ||
_owner: u | ||
_owner: l | ||
}; | ||
return t._store = {}, Object.defineProperty(t._store, "validated", { | ||
return i._store = {}, Object.defineProperty(i._store, "validated", { | ||
configurable: !1, | ||
@@ -465,3 +465,3 @@ enumerable: !1, | ||
value: !1 | ||
}), Object.defineProperty(t, "_self", { | ||
}), Object.defineProperty(i, "_self", { | ||
configurable: !1, | ||
@@ -471,44 +471,44 @@ enumerable: !1, | ||
value: o | ||
}), Object.defineProperty(t, "_source", { | ||
}), Object.defineProperty(i, "_source", { | ||
configurable: !1, | ||
enumerable: !1, | ||
writable: !1, | ||
value: d | ||
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t; | ||
value: s | ||
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i; | ||
}; | ||
function on(r, n, e, o, d) { | ||
function on(r, n, e, o, s) { | ||
{ | ||
var u, a = {}, t = null, x = null; | ||
e !== void 0 && (kr(e), t = "" + e), Zr(n) && (kr(n.key), t = "" + n.key), Xr(n) && (x = n.ref, Qr(n, d)); | ||
for (u in n) | ||
nr.call(n, u) && !Kr.hasOwnProperty(u) && (a[u] = n[u]); | ||
var l, a = {}, i = null, x = null; | ||
e !== void 0 && (kr(e), i = "" + e), Zr(n) && (kr(n.key), i = "" + n.key), Xr(n) && (x = n.ref, Qr(n, s)); | ||
for (l in n) | ||
rr.call(n, l) && !Kr.hasOwnProperty(l) && (a[l] = n[l]); | ||
if (r && r.defaultProps) { | ||
var c = r.defaultProps; | ||
for (u in c) | ||
a[u] === void 0 && (a[u] = c[u]); | ||
var f = r.defaultProps; | ||
for (l in f) | ||
a[l] === void 0 && (a[l] = f[l]); | ||
} | ||
if (t || x) { | ||
var p = typeof r == "function" ? r.displayName || r.name || "Unknown" : r; | ||
t && rn(a, p), x && nn(a, p); | ||
if (i || x) { | ||
var v = typeof r == "function" ? r.displayName || r.name || "Unknown" : r; | ||
i && rn(a, v), x && nn(a, v); | ||
} | ||
return en(r, t, x, d, o, U.current, a); | ||
return en(r, i, x, s, o, U.current, a); | ||
} | ||
} | ||
var ur = j.ReactCurrentOwner, Sr = j.ReactDebugCurrentFrame; | ||
function N(r) { | ||
var cr = D.ReactCurrentOwner, Pr = D.ReactDebugCurrentFrame; | ||
function L(r) { | ||
if (r) { | ||
var n = r._owner, e = rr(r.type, r._source, n ? n.type : null); | ||
Sr.setExtraStackFrame(e); | ||
var n = r._owner, e = Q(r.type, r._source, n ? n.type : null); | ||
Pr.setExtraStackFrame(e); | ||
} else | ||
Sr.setExtraStackFrame(null); | ||
Pr.setExtraStackFrame(null); | ||
} | ||
var lr; | ||
lr = !1; | ||
function cr(r) { | ||
return typeof r == "object" && r !== null && r.$$typeof === y; | ||
var pr; | ||
pr = !1; | ||
function fr(r) { | ||
return typeof r == "object" && r !== null && r.$$typeof === w; | ||
} | ||
function Pr() { | ||
function Sr() { | ||
{ | ||
if (ur.current) { | ||
var r = b(ur.current.type); | ||
if (cr.current) { | ||
var r = T(cr.current.type); | ||
if (r) | ||
@@ -533,6 +533,6 @@ return ` | ||
} | ||
var Dr = {}; | ||
var Fr = {}; | ||
function an(r) { | ||
{ | ||
var n = Pr(); | ||
var n = Sr(); | ||
if (!n) { | ||
@@ -547,3 +547,3 @@ var e = typeof r == "string" ? r : r.displayName || r.name; | ||
} | ||
function Fr(r, n) { | ||
function Ir(r, n) { | ||
{ | ||
@@ -554,25 +554,25 @@ if (!r._store || r._store.validated || r.key != null) | ||
var e = an(n); | ||
if (Dr[e]) | ||
if (Fr[e]) | ||
return; | ||
Dr[e] = !0; | ||
Fr[e] = !0; | ||
var o = ""; | ||
r && r._owner && r._owner !== ur.current && (o = " It was passed a child from " + b(r._owner.type) + "."), N(r), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', e, o), N(null); | ||
r && r._owner && r._owner !== cr.current && (o = " It was passed a child from " + T(r._owner.type) + "."), L(r), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', e, o), L(null); | ||
} | ||
} | ||
function Ir(r, n) { | ||
function $r(r, n) { | ||
{ | ||
if (typeof r != "object") | ||
return; | ||
if (dr(r)) | ||
if (lr(r)) | ||
for (var e = 0; e < r.length; e++) { | ||
var o = r[e]; | ||
cr(o) && Fr(o, n); | ||
fr(o) && Ir(o, n); | ||
} | ||
else if (cr(r)) | ||
else if (fr(r)) | ||
r._store && (r._store.validated = !0); | ||
else if (r) { | ||
var d = W(r); | ||
if (typeof d == "function" && d !== r.entries) | ||
for (var u = d.call(r), a; !(a = u.next()).done; ) | ||
cr(a.value) && Fr(a.value, n); | ||
var s = N(r); | ||
if (typeof s == "function" && s !== r.entries) | ||
for (var l = s.call(r), a; !(a = l.next()).done; ) | ||
fr(a.value) && Ir(a.value, n); | ||
} | ||
@@ -589,5 +589,5 @@ } | ||
e = n.propTypes; | ||
else if (typeof n == "object" && (n.$$typeof === g || // Note: Memo only checks outer props here. | ||
else if (typeof n == "object" && (n.$$typeof === p || // Note: Memo only checks outer props here. | ||
// Inner props are checked in the reconciler. | ||
n.$$typeof === _)) | ||
n.$$typeof === t)) | ||
e = n.propTypes; | ||
@@ -597,10 +597,10 @@ else | ||
if (e) { | ||
var o = b(n); | ||
Br(e, r.props, "prop", o, r); | ||
} else if (n.PropTypes !== void 0 && !lr) { | ||
lr = !0; | ||
var d = b(n); | ||
f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown"); | ||
var o = T(n); | ||
qr(e, r.props, "prop", o, r); | ||
} else if (n.PropTypes !== void 0 && !pr) { | ||
pr = !0; | ||
var s = T(n); | ||
h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown"); | ||
} | ||
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
} | ||
@@ -613,52 +613,53 @@ } | ||
if (o !== "children" && o !== "key") { | ||
N(r), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), N(null); | ||
L(r), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), L(null); | ||
break; | ||
} | ||
} | ||
r.ref !== null && (N(r), f("Invalid attribute `ref` supplied to `React.Fragment`."), N(null)); | ||
r.ref !== null && (L(r), h("Invalid attribute `ref` supplied to `React.Fragment`."), L(null)); | ||
} | ||
} | ||
function Ar(r, n, e, o, d, u) { | ||
function Dr(r, n, e, o, s, l) { | ||
{ | ||
var a = I(r); | ||
var a = A(r); | ||
if (!a) { | ||
var t = ""; | ||
(r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (t += " 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 x = tn(d); | ||
x ? t += x : t += Pr(); | ||
var c; | ||
r === null ? c = "null" : dr(r) ? c = "array" : r !== void 0 && r.$$typeof === y ? (c = "<" + (b(r.type) || "Unknown") + " />", t = " Did you accidentally export a JSX literal instead of a component?") : c = typeof r, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, t); | ||
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 x = tn(s); | ||
x ? i += x : i += Sr(); | ||
var f; | ||
r === null ? f = "null" : lr(r) ? f = "array" : r !== void 0 && r.$$typeof === w ? (f = "<" + (T(r.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : f = typeof r, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", f, i); | ||
} | ||
var p = on(r, n, e, d, u); | ||
if (p == null) | ||
return p; | ||
var v = on(r, n, e, s, l); | ||
if (v == null) | ||
return v; | ||
if (a) { | ||
var R = n.children; | ||
if (R !== void 0) | ||
var O = n.children; | ||
if (O !== void 0) | ||
if (o) | ||
if (dr(R)) { | ||
for (var z = 0; z < R.length; z++) | ||
Ir(R[z], r); | ||
Object.freeze && Object.freeze(R); | ||
if (lr(O)) { | ||
for (var z = 0; z < O.length; z++) | ||
$r(O[z], r); | ||
Object.freeze && Object.freeze(O); | ||
} else | ||
f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); | ||
h("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 | ||
Ir(R, r); | ||
$r(O, r); | ||
} | ||
return r === E ? sn(p) : dn(p), p; | ||
return r === b ? sn(v) : dn(v), v; | ||
} | ||
} | ||
function ln(r, n, e) { | ||
return Dr(r, n, e, !0); | ||
} | ||
function un(r, n, e) { | ||
return Ar(r, n, e, !0); | ||
return Dr(r, n, e, !1); | ||
} | ||
function ln(r, n, e) { | ||
return Ar(r, n, e, !1); | ||
} | ||
var cn = ln, fn = un; | ||
B.Fragment = E, B.jsx = cn, B.jsxs = fn; | ||
}()), B; | ||
var cn = un, pn = ln; | ||
J.Fragment = b, J.jsx = cn, J.jsxs = pn; | ||
}()), J; | ||
} | ||
process.env.NODE_ENV === "production" ? hr.exports = pn() : hr.exports = hn(); | ||
var s = hr.exports; | ||
const vn = `@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap"); | ||
process.env.NODE_ENV === "production" ? hr.exports = hn() : hr.exports = vn(); | ||
var d = hr.exports; | ||
const wn = `/* @import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap"); */ | ||
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap"); | ||
* { | ||
@@ -818,3 +819,3 @@ margin: 0; | ||
max-height: 312px; | ||
overflow-y: auto; | ||
/* overflow-y: auto; */ | ||
z-index: 999; | ||
@@ -827,2 +828,5 @@ width: 100%; | ||
gap: var(--hsd-ui-dropdown-spacing-sm); | ||
/* overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; */ | ||
} | ||
@@ -863,7 +867,11 @@ | ||
flex-direction: column; | ||
gap: var(--hsd-ui-dropdown-spacing-xs); | ||
/* overflow: hidden; */ | ||
/* gap: var(--hsd-ui-dropdown-spacing-xs); */ | ||
} | ||
.hsd-input-dropdwon-item { | ||
/* min-height: var(--height); */ | ||
/* max-height: var(--height); */ | ||
max-height: 58px; | ||
box-sizing: border-box; | ||
padding-inline: var(--paddingInline); | ||
@@ -874,11 +882,15 @@ display: flex; | ||
gap: var(--hsd-ui-dropdown-spacing-xs); | ||
padding-block: var(--paddingInline); | ||
border-radius: var(--hsd-ui-dropdown-border-radius-sm); | ||
/* min-width: max-content; */ | ||
overflow: hidden; | ||
} | ||
.hsd-input-dropdwon-item:hover { | ||
color: var(--hsd-ui-dropdown-background-color-primary); | ||
background-color: rgba(100, 181, 246, 0.21); | ||
} | ||
.hsd-input-dropdwon-item.active { | ||
color: var(--hsd-ui-dropdown-background-color-primary); | ||
/* color: var(--hsd-ui-dropdown-background-color-primary); */ | ||
/* border-radius: var(--borderRadius); */ | ||
background-color: rgba(100, 181, 246, 0.21); | ||
/* background: var(--hsd-ui-dropdown-background-color-secondary); */ | ||
@@ -914,53 +926,271 @@ /* box-shadow: 0px 0px 0px -1px #f0f0f0; */ | ||
} | ||
.hsd-input-dropdwon-item-text { | ||
color: #181a19; | ||
font-size: 14px; | ||
font-weight: 500; | ||
} | ||
.hsd-input-dropdwon-item-text.active { | ||
color: #1976d2; | ||
} | ||
.hsd-input-dropdwon-item-text-description { | ||
color: #78867f; | ||
font-size: 14px; | ||
font-weight: 400; | ||
} | ||
.hsd-input-dropdwon-item-text-description.active { | ||
color: #1976d2; | ||
} | ||
`; | ||
function gn(v) { | ||
const [y, C] = fr(v), E = pr(null), k = (P) => { | ||
E.current && !E.current.contains(P.target) && C(!1); | ||
function gn(c) { | ||
const [w, _] = er(c), b = or(null), j = (y) => { | ||
b.current && !b.current.contains(y.target) && _(!1); | ||
}; | ||
return J(() => (document.addEventListener("click", k, !0), () => { | ||
document.removeEventListener("click", k, !0); | ||
}), []), { ref: E, isComponentVisible: y, setIsComponentVisible: C }; | ||
return Y(() => (document.addEventListener("click", j, !0), () => { | ||
document.removeEventListener("click", j, !0); | ||
}), []), { ref: b, isComponentVisible: w, setIsComponentVisible: _ }; | ||
} | ||
const Nr = "hudoro-input-dropdown-styles", wn = (v) => { | ||
if (!document.getElementById(Nr)) { | ||
const y = document.createElement("style"); | ||
y.id = Nr, y.textContent = v, document.head.appendChild(y); | ||
const bn = ({ ...c }) => /* @__PURE__ */ d.jsx( | ||
"svg", | ||
{ | ||
xmlns: "http://www.w3.org/2000/svg", | ||
...c, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
color: "#939E99", | ||
children: /* @__PURE__ */ d.jsx( | ||
"path", | ||
{ | ||
d: "M4 9L12 17L20 9", | ||
stroke: "currentColor", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
) | ||
} | ||
), mn = ({ ...c }) => /* @__PURE__ */ d.jsxs( | ||
"svg", | ||
{ | ||
xmlns: "http://www.w3.org/2000/svg", | ||
...c, | ||
viewBox: "0 0 20 20", | ||
fill: "none", | ||
children: [ | ||
/* @__PURE__ */ d.jsx( | ||
"circle", | ||
{ | ||
cx: "9.80547", | ||
cy: "9.8055", | ||
r: "7.49047", | ||
stroke: "currentColor", | ||
strokeWidth: "1.3", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
), | ||
/* @__PURE__ */ d.jsx( | ||
"path", | ||
{ | ||
d: "M15.0153 15.4043L17.9519 18.3333", | ||
stroke: "currentColor", | ||
strokeWidth: "1.3", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
) | ||
] | ||
} | ||
), yn = fn( | ||
({ | ||
positionDropdown: c, | ||
dropdownLists: w, | ||
isComponentVisible: _, | ||
searchAble: b, | ||
onSearch: j, | ||
value: y, | ||
handleChangeValue: P | ||
}, S) => { | ||
const [p, F] = er(0), u = or(null); | ||
return Y(() => { | ||
if (u.current) { | ||
const t = u.current.getBoundingClientRect(); | ||
F(t.width); | ||
} | ||
}, [u, _]), /* @__PURE__ */ d.jsx(d.Fragment, { children: _ ? /* @__PURE__ */ d.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdown-lists-container | ||
hsd-input-dropdown-lists-container-${c}`, | ||
onClick: (t) => t.stopPropagation(), | ||
ref: S, | ||
children: [ | ||
b ? /* @__PURE__ */ d.jsxs( | ||
"div", | ||
{ | ||
className: "hsd-input-dropdown-container-dropdown-search", | ||
style: { | ||
order: c == "bottom" ? 1 : 2, | ||
position: "sticky", | ||
top: 0, | ||
bottom: 0 | ||
}, | ||
children: [ | ||
/* @__PURE__ */ d.jsx("div", { style: { display: "flex" }, children: /* @__PURE__ */ d.jsx(mn, { strokeWidth: 2, width: 20 }) }), | ||
/* @__PURE__ */ d.jsx( | ||
"input", | ||
{ | ||
onChange: (t) => { | ||
j && j(t.target.value); | ||
}, | ||
autoFocus: !0, | ||
style: { width: "100%" } | ||
} | ||
) | ||
] | ||
} | ||
) : null, | ||
/* @__PURE__ */ d.jsx( | ||
"div", | ||
{ | ||
className: "hsd-input-dropdwon-item-container", | ||
style: { | ||
order: c == "bottom" ? 2 : 1 | ||
}, | ||
ref: u, | ||
children: c === "bottom" ? w.map((t, C) => { | ||
const E = !!(y != null && y.find((I) => I.value === t.value)); | ||
return /* @__PURE__ */ d.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdwon-item ${E ? "active" : " "} ${t.disable ? "hsd-input-dropdwon-item-disable" : null}`, | ||
onClick: () => P(t.label, t.value), | ||
children: [ | ||
t.icon ? /* @__PURE__ */ d.jsx("div", { children: H.cloneElement(t.icon, { | ||
width: 16 | ||
}) }) : null, | ||
/* @__PURE__ */ d.jsxs("div", { children: [ | ||
/* @__PURE__ */ d.jsx( | ||
"p", | ||
{ | ||
className: `hsd-input-dropdwon-item-text ${E ? "active" : null}`, | ||
style: { | ||
textWrap: "nowrap", | ||
width: `${p - 12}px`, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis" | ||
}, | ||
children: t.label | ||
} | ||
), | ||
t.description ? /* @__PURE__ */ d.jsx( | ||
"p", | ||
{ | ||
className: `hsd-input-dropdwon-item-text-description ${E ? "active" : null}`, | ||
style: { | ||
textWrap: "nowrap", | ||
width: `${p - 12}px`, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis" | ||
}, | ||
children: t.description | ||
} | ||
) : null | ||
] }) | ||
] | ||
}, | ||
C | ||
); | ||
}) : w.reverse().map((t, C) => { | ||
const E = !!(y != null && y.find((I) => I.value === t.value)); | ||
return /* @__PURE__ */ d.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdwon-item ${E ? "active" : ""} ${t.disable ? "hsd-input-dropdwon-item-disable" : null}`, | ||
onClick: () => P(t.label, t.value), | ||
children: [ | ||
t.icon ? /* @__PURE__ */ d.jsx("div", { children: H.cloneElement(t.icon, { | ||
width: 16 | ||
}) }) : null, | ||
/* @__PURE__ */ d.jsxs("div", { children: [ | ||
/* @__PURE__ */ d.jsx( | ||
"p", | ||
{ | ||
className: `hsd-input-dropdwon-item-text ${E ? "active" : null}`, | ||
style: { | ||
textWrap: "nowrap", | ||
width: `${p - 12}px`, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis" | ||
}, | ||
children: t.label | ||
} | ||
), | ||
t.description ? /* @__PURE__ */ d.jsx( | ||
"p", | ||
{ | ||
className: `hsd-input-dropdwon-item-text-description ${E ? "active" : null}`, | ||
style: { | ||
textWrap: "nowrap", | ||
width: `${p - 12}px`, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis" | ||
}, | ||
children: t.description | ||
} | ||
) : null | ||
] }) | ||
] | ||
}, | ||
C | ||
); | ||
}) | ||
} | ||
) | ||
] | ||
} | ||
) : null }); | ||
} | ||
), Lr = "hudoro-input-dropdown-styles", xn = (c) => { | ||
if (!document.getElementById(Lr)) { | ||
const w = document.createElement("style"); | ||
w.id = Lr, w.textContent = c, document.head.appendChild(w); | ||
} | ||
}; | ||
wn(vn); | ||
const xn = ({ | ||
dropdownLists: v, | ||
onChange: y, | ||
defaultValue: C, | ||
size: E = "md", | ||
multiSelect: k, | ||
searchAble: P, | ||
iconLeft: D, | ||
placeholder: T, | ||
onSearch: g, | ||
xn(wn); | ||
const Rn = ({ | ||
dropdownLists: c, | ||
onChange: w, | ||
defaultValue: _, | ||
size: b = "md", | ||
multiSelect: j, | ||
searchAble: y, | ||
iconLeft: P, | ||
placeholder: S, | ||
onSearch: p, | ||
error: F, | ||
position: h, | ||
onBlur: _, | ||
onFocus: O, | ||
disable: $ | ||
position: u, | ||
onBlur: t, | ||
onFocus: C, | ||
disable: E | ||
}) => { | ||
const L = pr(), [l, W] = fr([]), [j, f] = fr(""), V = pr(null), { isComponentVisible: Y, ref: M, setIsComponentVisible: G } = gn(!1), or = () => { | ||
G((i) => !i); | ||
}, K = (i, w) => { | ||
if (!k) | ||
W([{ label: i, value: w }]), y([{ label: i, value: w }]), G(!1); | ||
else if (l == null ? void 0 : l.find((m) => m.value === w)) { | ||
const I = or(), [g, N] = er([]), [D, h] = er(""), V = or(null), { isComponentVisible: B, ref: M, setIsComponentVisible: G } = gn(!1), tr = () => { | ||
G((R) => !R); | ||
}, ir = (R, k) => { | ||
if (!j) | ||
N([{ label: R, value: k }]), w([{ label: R, value: k }]), G(!1); | ||
else if (g == null ? void 0 : g.find((m) => m.value === k)) { | ||
const m = [ | ||
...l ? l.filter((A) => A.value !== w) : [] | ||
...g ? g.filter((W) => W.value !== k) : [] | ||
]; | ||
W(m), y(m); | ||
N(m), w(m); | ||
} else { | ||
const m = [...l || [], { label: i, value: w }]; | ||
W(m), y(m); | ||
const m = [...g || [], { label: R, value: k }]; | ||
N(m), w(m); | ||
} | ||
}; | ||
J(() => { | ||
JSON.stringify(L.current) === JSON.stringify(C) || (L.current = C, W(L.current || [])); | ||
}, [C]); | ||
const X = () => l.length ? k ? l == null ? void 0 : l.map((i, w) => /* @__PURE__ */ s.jsx( | ||
Y(() => { | ||
JSON.stringify(I.current) === JSON.stringify(_) || (I.current = _, N(I.current || [])); | ||
}, [_]); | ||
const K = () => g.length ? j ? g == null ? void 0 : g.map((R, k) => /* @__PURE__ */ d.jsx( | ||
"p", | ||
@@ -970,32 +1200,32 @@ { | ||
className: "hsd-input-dropdown-preview-item", | ||
children: i == null ? void 0 : i.label | ||
children: R == null ? void 0 : R.label | ||
}, | ||
w | ||
)) : /* @__PURE__ */ s.jsx("p", { style: { minWidth: "max-content" }, children: l == null ? void 0 : l[0].label }) : /* @__PURE__ */ s.jsx("p", { className: "hsd-input-dropdown-placeholder", children: T }); | ||
J(() => { | ||
f(h || "bottom"); | ||
}, [h]); | ||
const I = () => { | ||
if (!h && M.current && V.current) { | ||
const i = window.innerHeight, w = M.current.getBoundingClientRect(), b = V.current.getBoundingClientRect(); | ||
w.bottom + b.height >= i - 10 ? f("top") : f(h || "bottom"); | ||
k | ||
)) : /* @__PURE__ */ d.jsx("p", { style: { minWidth: "max-content" }, children: g == null ? void 0 : g[0].label }) : /* @__PURE__ */ d.jsx("p", { className: "hsd-input-dropdown-placeholder", children: S }); | ||
Y(() => { | ||
h(u || "bottom"); | ||
}, [u]); | ||
const A = () => { | ||
if (!u && M.current && V.current) { | ||
const R = window.innerHeight, k = M.current.getBoundingClientRect(), T = V.current.getBoundingClientRect(); | ||
k.bottom + T.height >= R - 10 ? h("top") : h(u || "bottom"); | ||
} | ||
}; | ||
return J(() => (window.addEventListener("scroll", I), window.addEventListener("resize", I), () => { | ||
window.removeEventListener("scroll", I), window.removeEventListener("resize", I); | ||
}), []), J(() => { | ||
I(); | ||
}, [Y]), /* @__PURE__ */ s.jsxs( | ||
return Y(() => (window.addEventListener("scroll", A), window.addEventListener("resize", A), () => { | ||
window.removeEventListener("scroll", A), window.removeEventListener("resize", A); | ||
}), []), Y(() => { | ||
A(); | ||
}, [B]), /* @__PURE__ */ d.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdown-container ${$ ? "disable" : ""} hsd-input-dropdown-size-${E} ${Y ? "active" : ""} ${F ? "error" : ""}`, | ||
className: `hsd-input-dropdown-container ${E ? "disable" : ""} hsd-input-dropdown-size-${b} ${B ? "active" : ""} ${F ? "error" : ""}`, | ||
ref: M, | ||
onClick: or, | ||
onClick: tr, | ||
children: [ | ||
/* @__PURE__ */ s.jsxs("div", { className: "hsd-input-dropdown-preview-container", children: [ | ||
D ? /* @__PURE__ */ s.jsx(s.Fragment, { children: H.cloneElement(D, { | ||
width: zr(E), | ||
/* @__PURE__ */ d.jsxs("div", { className: "hsd-input-dropdown-preview-container", children: [ | ||
P ? /* @__PURE__ */ d.jsx(d.Fragment, { children: H.cloneElement(P, { | ||
width: zr(b), | ||
color: "#939E99" | ||
}) }) : null, | ||
/* @__PURE__ */ s.jsx( | ||
/* @__PURE__ */ d.jsx( | ||
"div", | ||
@@ -1005,148 +1235,35 @@ { | ||
tabIndex: 100, | ||
onBlur: _, | ||
onFocus: O, | ||
children: X() | ||
onBlur: t, | ||
onFocus: C, | ||
children: K() | ||
} | ||
), | ||
/* @__PURE__ */ s.jsx(mn, { strokeWidth: 2, width: zr(E) }) | ||
/* @__PURE__ */ d.jsx(bn, { strokeWidth: 2, width: zr(b) }) | ||
] }), | ||
Y ? /* @__PURE__ */ s.jsxs( | ||
"div", | ||
/* @__PURE__ */ d.jsx( | ||
yn, | ||
{ | ||
className: `hsd-input-dropdown-lists-container | ||
hsd-input-dropdown-lists-container-${j}`, | ||
onClick: (i) => i.stopPropagation(), | ||
ref: V, | ||
children: [ | ||
P ? /* @__PURE__ */ s.jsxs( | ||
"div", | ||
{ | ||
className: "hsd-input-dropdown-container-dropdown-search", | ||
style: { | ||
order: j == "bottom" ? 1 : 2, | ||
position: "sticky", | ||
top: 0, | ||
bottom: 0 | ||
}, | ||
children: [ | ||
/* @__PURE__ */ s.jsx("div", { style: { display: "flex" }, children: /* @__PURE__ */ s.jsx(bn, { strokeWidth: 2, width: 20 }) }), | ||
/* @__PURE__ */ s.jsx( | ||
"input", | ||
{ | ||
onChange: (i) => { | ||
g && g(i.target.value); | ||
}, | ||
autoFocus: !0, | ||
style: { width: "100%" } | ||
} | ||
) | ||
] | ||
} | ||
) : null, | ||
/* @__PURE__ */ s.jsx( | ||
"div", | ||
{ | ||
className: "hsd-input-dropdwon-item-container", | ||
style: { order: j == "bottom" ? 2 : 1 }, | ||
children: j === "bottom" ? v.map((i, w) => /* @__PURE__ */ s.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdwon-item ${l != null && l.find((b) => b.value === i.value) ? "active" : ""} ${i.disable ? "hsd-input-dropdwon-item-disable" : null}`, | ||
onClick: () => K(i.label, i.value), | ||
children: [ | ||
i.icon ? /* @__PURE__ */ s.jsx("div", { children: H.cloneElement(i.icon, { | ||
width: 16 | ||
}) }) : null, | ||
/* @__PURE__ */ s.jsxs("div", { children: [ | ||
" ", | ||
/* @__PURE__ */ s.jsx("p", { children: i.label }) | ||
] }) | ||
] | ||
}, | ||
w | ||
)) : v.reverse().map((i, w) => /* @__PURE__ */ s.jsxs( | ||
"div", | ||
{ | ||
className: `hsd-input-dropdwon-item ${l != null && l.find((b) => b.value === i.value) ? "active" : ""} ${i.disable ? "hsd-input-dropdwon-item-disable" : null}`, | ||
onClick: () => K(i.label, i.value), | ||
children: [ | ||
i.icon ? /* @__PURE__ */ s.jsx("div", { children: H.cloneElement(i.icon, { | ||
width: 16 | ||
}) }) : null, | ||
/* @__PURE__ */ s.jsxs("div", { children: [ | ||
" ", | ||
/* @__PURE__ */ s.jsx("p", { children: i.label }) | ||
] }) | ||
] | ||
}, | ||
w | ||
)) | ||
} | ||
) | ||
] | ||
dropdownLists: c, | ||
handleChangeValue: ir, | ||
isComponentVisible: B, | ||
positionDropdown: D, | ||
searchAble: !!y, | ||
value: g, | ||
onSearch: p, | ||
ref: V | ||
} | ||
) : null | ||
) | ||
] | ||
} | ||
); | ||
}, bn = ({ ...v }) => /* @__PURE__ */ s.jsxs( | ||
"svg", | ||
{ | ||
xmlns: "http://www.w3.org/2000/svg", | ||
...v, | ||
viewBox: "0 0 20 20", | ||
fill: "none", | ||
children: [ | ||
/* @__PURE__ */ s.jsx( | ||
"circle", | ||
{ | ||
cx: "9.80547", | ||
cy: "9.8055", | ||
r: "7.49047", | ||
stroke: "currentColor", | ||
strokeWidth: "1.3", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
), | ||
/* @__PURE__ */ s.jsx( | ||
"path", | ||
{ | ||
d: "M15.0153 15.4043L17.9519 18.3333", | ||
stroke: "currentColor", | ||
strokeWidth: "1.3", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
) | ||
] | ||
} | ||
), mn = ({ ...v }) => /* @__PURE__ */ s.jsx( | ||
"svg", | ||
{ | ||
xmlns: "http://www.w3.org/2000/svg", | ||
...v, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
color: "#1976D2", | ||
children: /* @__PURE__ */ s.jsx( | ||
"path", | ||
{ | ||
d: "M4 9L12 17L20 9", | ||
stroke: "currentColor", | ||
strokeLinecap: "round", | ||
strokeLinejoin: "round" | ||
} | ||
) | ||
} | ||
), zr = (v) => { | ||
if (v === "sm") | ||
}, zr = (c) => { | ||
if (c === "sm") | ||
return 16; | ||
if (v === "md") | ||
if (c === "md") | ||
return 20; | ||
if (v === "lg") | ||
if (c === "lg") | ||
return 20; | ||
}; | ||
export { | ||
xn as Dropdown | ||
Rn as Dropdown | ||
}; |
@@ -1,2 +0,2 @@ | ||
(function(A,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],f):(A=typeof globalThis<"u"?globalThis:A||self,f(A.Dropdown={},A.React))})(this,function(A,f){"use strict";var or={exports:{}},M={};/** | ||
(function(W,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(W=typeof globalThis<"u"?globalThis:W||self,u(W.Dropdown={},W.React))})(this,function(W,u){"use strict";var er={exports:{}},B={};/** | ||
* @license React | ||
@@ -9,3 +9,3 @@ * react-jsx-runtime.production.min.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var pr;function Nr(){if(pr)return M;pr=1;var g=f,x=Symbol.for("react.element"),k=Symbol.for("react.fragment"),R=Object.prototype.hasOwnProperty,T=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,D={key:!0,ref:!0,__self:!0,__source:!0};function F(S,w,I){var v,j={},O=null,W=null;I!==void 0&&(O=""+I),w.key!==void 0&&(O=""+w.key),w.ref!==void 0&&(W=w.ref);for(v in w)R.call(w,v)&&!D.hasOwnProperty(v)&&(j[v]=w[v]);if(S&&S.defaultProps)for(v in w=S.defaultProps,w)j[v]===void 0&&(j[v]=w[v]);return{$$typeof:x,type:S,key:O,ref:W,props:j,_owner:T.current}}return M.Fragment=k,M.jsx=F,M.jsxs=F,M}var U={};/** | ||
*/var pr;function Lr(){if(pr)return B;pr=1;var f=u,g=Symbol.for("react.element"),j=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,C=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function P(F,p,I){var c,t={},k=null,R=null;I!==void 0&&(k=""+I),p.key!==void 0&&(k=""+p.key),p.ref!==void 0&&(R=p.ref);for(c in p)m.call(p,c)&&!x.hasOwnProperty(c)&&(t[c]=p[c]);if(F&&F.defaultProps)for(c in p=F.defaultProps,p)t[c]===void 0&&(t[c]=p[c]);return{$$typeof:g,type:F,key:k,ref:R,props:t,_owner:C.current}}return B.Fragment=j,B.jsx=P,B.jsxs=P,B}var M={};/** | ||
* @license React | ||
@@ -18,13 +18,14 @@ * react-jsx-runtime.development.js | ||
* LICENSE file in the root directory of this source tree. | ||
*/var hr;function zr(){return hr||(hr=1,process.env.NODE_ENV!=="production"&&function(){var g=f,x=Symbol.for("react.element"),k=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),S=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),N=Symbol.iterator,l="@@iterator";function z(r){if(r===null||typeof r!="object")return null;var n=N&&r[N]||r[l];return typeof n=="function"?n:null}var C=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(r){{for(var n=arguments.length,e=new Array(n>1?n-1:0),o=1;o<n;o++)e[o-1]=arguments[o];q("error",r,e)}}function q(r,n,e){{var o=C.ReactDebugCurrentFrame,d=o.getStackAddendum();d!==""&&(n+="%s",e=e.concat([d]));var u=e.map(function(a){return String(a)});u.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,u)}}var B=!1,J=!1,G=!1,ir=!1,K=!1,X;X=Symbol.for("react.module.reference");function $(r){return!!(typeof r=="string"||typeof r=="function"||r===R||r===D||K||r===T||r===I||r===v||ir||r===W||B||J||G||typeof r=="object"&&r!==null&&(r.$$typeof===O||r.$$typeof===j||r.$$typeof===F||r.$$typeof===S||r.$$typeof===w||r.$$typeof===X||r.getModuleId!==void 0))}function t(r,n,e){var o=r.displayName;if(o)return o;var d=n.displayName||n.name||"";return d!==""?e+"("+d+")":e}function b(r){return r.displayName||"Context"}function m(r){if(r==null)return null;if(typeof r.tag=="number"&&p("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 R:return"Fragment";case k:return"Portal";case D:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case v:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case S:var n=r;return b(n)+".Consumer";case F:var e=r;return b(e._context)+".Provider";case w:return t(r,r.render,"ForwardRef");case j:var o=r.displayName||null;return o!==null?o:m(r.type)||"Memo";case O:{var d=r,u=d._payload,a=d._init;try{return m(a(u))}catch{return null}}}return null}var y=Object.assign,L=0,wr,br,mr,yr,xr,Er,Rr;function _r(){}_r.__reactDisabledLog=!0;function Br(){{if(L===0){wr=console.log,br=console.info,mr=console.warn,yr=console.error,xr=console.group,Er=console.groupCollapsed,Rr=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})}L++}}function Jr(){{if(L--,L===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:y({},r,{value:wr}),info:y({},r,{value:br}),warn:y({},r,{value:mr}),error:y({},r,{value:yr}),group:y({},r,{value:xr}),groupCollapsed:y({},r,{value:Er}),groupEnd:y({},r,{value:Rr})})}L<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var tr=C.ReactCurrentDispatcher,ar;function Z(r,n,e){{if(ar===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);ar=o&&o[1]||""}return` | ||
`+ar+r}}var dr=!1,Q;{var Hr=typeof WeakMap=="function"?WeakMap:Map;Q=new Hr}function jr(r,n){if(!r||dr)return"";{var e=Q.get(r);if(e!==void 0)return e}var o;dr=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=tr.current,tr.current=null,Br();try{if(n){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(P){o=P}Reflect.construct(r,[],a)}else{try{a.call()}catch(P){o=P}r.call(a.prototype)}}else{try{throw Error()}catch(P){o=P}r()}}catch(P){if(P&&o&&typeof P.stack=="string"){for(var i=P.stack.split(` | ||
*/var hr;function zr(){return hr||(hr=1,process.env.NODE_ENV!=="production"&&function(){var f=u,g=Symbol.for("react.element"),j=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),P=Symbol.for("react.provider"),F=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),t=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),D=Symbol.iterator,b="@@iterator";function z(r){if(r===null||typeof r!="object")return null;var n=D&&r[D]||r[b];return typeof n=="function"?n:null}var A=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(r){{for(var n=arguments.length,e=new Array(n>1?n-1:0),o=1;o<n;o++)e[o-1]=arguments[o];U("error",r,e)}}function U(r,n,e){{var o=A.ReactDebugCurrentFrame,s=o.getStackAddendum();s!==""&&(n+="%s",e=e.concat([s]));var l=e.map(function(a){return String(a)});l.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,l)}}var q=!1,J=!1,G=!1,or=!1,tr=!1,K;K=Symbol.for("react.module.reference");function N(r){return!!(typeof r=="string"||typeof r=="function"||r===m||r===x||tr||r===C||r===I||r===c||or||r===R||q||J||G||typeof r=="object"&&r!==null&&(r.$$typeof===k||r.$$typeof===t||r.$$typeof===P||r.$$typeof===F||r.$$typeof===p||r.$$typeof===K||r.getModuleId!==void 0))}function _(r,n,e){var o=r.displayName;if(o)return o;var s=n.displayName||n.name||"";return s!==""?e+"("+s+")":e}function T(r){return r.displayName||"Context"}function O(r){if(r==null)return null;if(typeof r.tag=="number"&&v("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 m:return"Fragment";case j:return"Portal";case x:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case c:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case F:var n=r;return T(n)+".Consumer";case P:var e=r;return T(e._context)+".Provider";case p:return _(r,r.render,"ForwardRef");case t:var o=r.displayName||null;return o!==null?o:O(r.type)||"Memo";case k:{var s=r,l=s._payload,a=s._init;try{return O(a(l))}catch{return null}}}return null}var y=Object.assign,L=0,gr,br,mr,yr,xr,Er,Rr;function _r(){}_r.__reactDisabledLog=!0;function Jr(){{if(L===0){gr=console.log,br=console.info,mr=console.warn,yr=console.error,xr=console.group,Er=console.groupCollapsed,Rr=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})}L++}}function Hr(){{if(L--,L===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:y({},r,{value:gr}),info:y({},r,{value:br}),warn:y({},r,{value:mr}),error:y({},r,{value:yr}),group:y({},r,{value:xr}),groupCollapsed:y({},r,{value:Er}),groupEnd:y({},r,{value:Rr})})}L<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ir=A.ReactCurrentDispatcher,ar;function X(r,n,e){{if(ar===void 0)try{throw Error()}catch(s){var o=s.stack.trim().match(/\n( *(at )?)/);ar=o&&o[1]||""}return` | ||
`+ar+r}}var dr=!1,Z;{var Gr=typeof WeakMap=="function"?WeakMap:Map;Z=new Gr}function jr(r,n){if(!r||dr)return"";{var e=Z.get(r);if(e!==void 0)return e}var o;dr=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var l;l=ir.current,ir.current=null,Jr();try{if(n){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch($){o=$}Reflect.construct(r,[],a)}else{try{a.call()}catch($){o=$}r.call(a.prototype)}}else{try{throw Error()}catch($){o=$}r()}}catch($){if($&&o&&typeof $.stack=="string"){for(var i=$.stack.split(` | ||
`),E=o.stack.split(` | ||
`),c=i.length-1,h=E.length-1;c>=1&&h>=0&&i[c]!==E[h];)h--;for(;c>=1&&h>=0;c--,h--)if(i[c]!==E[h]){if(c!==1||h!==1)do if(c--,h--,h<0||i[c]!==E[h]){var _=` | ||
`+i[c].replace(" at new "," at ");return r.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",r.displayName)),typeof r=="function"&&Q.set(r,_),_}while(c>=1&&h>=0);break}}}finally{dr=!1,tr.current=u,Jr(),Error.prepareStackTrace=d}var Y=r?r.displayName||r.name:"",Wr=Y?Z(Y):"";return typeof r=="function"&&Q.set(r,Wr),Wr}function Gr(r,n,e){return jr(r,!1)}function Kr(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function rr(r,n,e){if(r==null)return"";if(typeof r=="function")return jr(r,Kr(r));if(typeof r=="string")return Z(r);switch(r){case I:return Z("Suspense");case v:return Z("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case w:return Gr(r.render);case j:return rr(r.type,n,e);case O:{var o=r,d=o._payload,u=o._init;try{return rr(u(d),n,e)}catch{}}}return""}var nr=Object.prototype.hasOwnProperty,Cr={},kr=C.ReactDebugCurrentFrame;function er(r){if(r){var n=r._owner,e=rr(r.type,r._source,n?n.type:null);kr.setExtraStackFrame(e)}else kr.setExtraStackFrame(null)}function Xr(r,n,e,o,d){{var u=Function.call.bind(nr);for(var a in r)if(u(r,a)){var i=void 0;try{if(typeof r[a]!="function"){var E=Error((o||"React class")+": "+e+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}i=r[a](n,a,o,e,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){i=c}i&&!(i instanceof Error)&&(er(d),p("%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).",o||"React class",e,a,typeof i),er(null)),i instanceof Error&&!(i.message in Cr)&&(Cr[i.message]=!0,er(d),p("Failed %s type: %s",e,i.message),er(null))}}}var Zr=Array.isArray;function sr(r){return Zr(r)}function Qr(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,e=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return e}}function rn(r){try{return Tr(r),!1}catch{return!0}}function Tr(r){return""+r}function Sr(r){if(rn(r))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qr(r)),Tr(r)}var H=C.ReactCurrentOwner,nn={key:!0,ref:!0,__self:!0,__source:!0},Or,Pr,ur;ur={};function en(r){if(nr.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function on(r){if(nr.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function tn(r,n){if(typeof r.ref=="string"&&H.current&&n&&H.current.stateNode!==n){var e=m(H.current.type);ur[e]||(p('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',m(H.current.type),r.ref),ur[e]=!0)}}function an(r,n){{var e=function(){Or||(Or=!0,p("%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 dn(r,n){{var e=function(){Pr||(Pr=!0,p("%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 sn=function(r,n,e,o,d,u,a){var i={$$typeof:x,type:r,key:n,ref:e,props:a,_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:o}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function un(r,n,e,o,d){{var u,a={},i=null,E=null;e!==void 0&&(Sr(e),i=""+e),on(n)&&(Sr(n.key),i=""+n.key),en(n)&&(E=n.ref,tn(n,d));for(u in n)nr.call(n,u)&&!nn.hasOwnProperty(u)&&(a[u]=n[u]);if(r&&r.defaultProps){var c=r.defaultProps;for(u in c)a[u]===void 0&&(a[u]=c[u])}if(i||E){var h=typeof r=="function"?r.displayName||r.name||"Unknown":r;i&&an(a,h),E&&dn(a,h)}return sn(r,i,E,d,o,H.current,a)}}var lr=C.ReactCurrentOwner,Dr=C.ReactDebugCurrentFrame;function V(r){if(r){var n=r._owner,e=rr(r.type,r._source,n?n.type:null);Dr.setExtraStackFrame(e)}else Dr.setExtraStackFrame(null)}var cr;cr=!1;function fr(r){return typeof r=="object"&&r!==null&&r.$$typeof===x}function Fr(){{if(lr.current){var r=m(lr.current.type);if(r)return` | ||
`),h=i.length-1,w=E.length-1;h>=1&&w>=0&&i[h]!==E[w];)w--;for(;h>=1&&w>=0;h--,w--)if(i[h]!==E[w]){if(h!==1||w!==1)do if(h--,w--,w<0||i[h]!==E[w]){var S=` | ||
`+i[h].replace(" at new "," at ");return r.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",r.displayName)),typeof r=="function"&&Z.set(r,S),S}while(h>=1&&w>=0);break}}}finally{dr=!1,ir.current=l,Hr(),Error.prepareStackTrace=s}var V=r?r.displayName||r.name:"",Nr=V?X(V):"";return typeof r=="function"&&Z.set(r,Nr),Nr}function Kr(r,n,e){return jr(r,!1)}function Xr(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function Q(r,n,e){if(r==null)return"";if(typeof r=="function")return jr(r,Xr(r));if(typeof r=="string")return X(r);switch(r){case I:return X("Suspense");case c:return X("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case p:return Kr(r.render);case t:return Q(r.type,n,e);case k:{var o=r,s=o._payload,l=o._init;try{return Q(l(s),n,e)}catch{}}}return""}var rr=Object.prototype.hasOwnProperty,Cr={},kr=A.ReactDebugCurrentFrame;function nr(r){if(r){var n=r._owner,e=Q(r.type,r._source,n?n.type:null);kr.setExtraStackFrame(e)}else kr.setExtraStackFrame(null)}function Zr(r,n,e,o,s){{var l=Function.call.bind(rr);for(var a in r)if(l(r,a)){var i=void 0;try{if(typeof r[a]!="function"){var E=Error((o||"React class")+": "+e+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}i=r[a](n,a,o,e,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(nr(s),v("%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).",o||"React class",e,a,typeof i),nr(null)),i instanceof Error&&!(i.message in Cr)&&(Cr[i.message]=!0,nr(s),v("Failed %s type: %s",e,i.message),nr(null))}}}var Qr=Array.isArray;function sr(r){return Qr(r)}function rn(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,e=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return e}}function nn(r){try{return Tr(r),!1}catch{return!0}}function Tr(r){return""+r}function Or(r){if(nn(r))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rn(r)),Tr(r)}var H=A.ReactCurrentOwner,en={key:!0,ref:!0,__self:!0,__source:!0},Sr,Pr,lr;lr={};function on(r){if(rr.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function tn(r){if(rr.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function an(r,n){if(typeof r.ref=="string"&&H.current&&n&&H.current.stateNode!==n){var e=O(H.current.type);lr[e]||(v('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',O(H.current.type),r.ref),lr[e]=!0)}}function dn(r,n){{var e=function(){Sr||(Sr=!0,v("%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 sn(r,n){{var e=function(){Pr||(Pr=!0,v("%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 ln=function(r,n,e,o,s,l,a){var i={$$typeof:g,type:r,key:n,ref:e,props:a,_owner:l};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:o}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function un(r,n,e,o,s){{var l,a={},i=null,E=null;e!==void 0&&(Or(e),i=""+e),tn(n)&&(Or(n.key),i=""+n.key),on(n)&&(E=n.ref,an(n,s));for(l in n)rr.call(n,l)&&!en.hasOwnProperty(l)&&(a[l]=n[l]);if(r&&r.defaultProps){var h=r.defaultProps;for(l in h)a[l]===void 0&&(a[l]=h[l])}if(i||E){var w=typeof r=="function"?r.displayName||r.name||"Unknown":r;i&&dn(a,w),E&&sn(a,w)}return ln(r,i,E,s,o,H.current,a)}}var ur=A.ReactCurrentOwner,Fr=A.ReactDebugCurrentFrame;function Y(r){if(r){var n=r._owner,e=Q(r.type,r._source,n?n.type:null);Fr.setExtraStackFrame(e)}else Fr.setExtraStackFrame(null)}var cr;cr=!1;function fr(r){return typeof r=="object"&&r!==null&&r.$$typeof===g}function Ir(){{if(ur.current){var r=O(ur.current.type);if(r)return` | ||
Check the render method of \``+r+"`."}return""}}function ln(r){{if(r!==void 0){var n=r.fileName.replace(/^.*[\\\/]/,""),e=r.lineNumber;return` | ||
Check the render method of \``+r+"`."}return""}}function cn(r){{if(r!==void 0){var n=r.fileName.replace(/^.*[\\\/]/,""),e=r.lineNumber;return` | ||
Check your code at `+n+":"+e+"."}return""}}var Ir={};function cn(r){{var n=Fr();if(!n){var e=typeof r=="string"?r:r.displayName||r.name;e&&(n=` | ||
Check your code at `+n+":"+e+"."}return""}}var Dr={};function fn(r){{var n=Ir();if(!n){var e=typeof r=="string"?r:r.displayName||r.name;e&&(n=` | ||
Check the top-level render call using <`+e+">.")}return n}}function Ar(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var e=cn(n);if(Ir[e])return;Ir[e]=!0;var o="";r&&r._owner&&r._owner!==lr.current&&(o=" It was passed a child from "+m(r._owner.type)+"."),V(r),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',e,o),V(null)}}function $r(r,n){{if(typeof r!="object")return;if(sr(r))for(var e=0;e<r.length;e++){var o=r[e];fr(o)&&Ar(o,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 u=d.call(r),a;!(a=u.next()).done;)fr(a.value)&&Ar(a.value,n)}}}function fn(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===w||n.$$typeof===j))e=n.propTypes;else return;if(e){var o=m(n);Xr(e,r.props,"prop",o,r)}else if(n.PropTypes!==void 0&&!cr){cr=!0;var d=m(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pn(r){{for(var n=Object.keys(r.props),e=0;e<n.length;e++){var o=n[e];if(o!=="children"&&o!=="key"){V(r),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),V(null);break}}r.ref!==null&&(V(r),p("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Lr(r,n,e,o,d,u){{var a=$(r);if(!a){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 E=ln(d);E?i+=E:i+=Fr();var c;r===null?c="null":sr(r)?c="array":r!==void 0&&r.$$typeof===x?(c="<"+(m(r.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):c=typeof r,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,i)}var h=un(r,n,e,d,u);if(h==null)return h;if(a){var _=n.children;if(_!==void 0)if(o)if(sr(_)){for(var Y=0;Y<_.length;Y++)$r(_[Y],r);Object.freeze&&Object.freeze(_)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $r(_,r)}return r===R?pn(h):fn(h),h}}function hn(r,n,e){return Lr(r,n,e,!0)}function vn(r,n,e){return Lr(r,n,e,!1)}var gn=vn,wn=hn;U.Fragment=R,U.jsx=gn,U.jsxs=wn}()),U}process.env.NODE_ENV==="production"?or.exports=Nr():or.exports=zr();var s=or.exports;const Vr=`@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap"); | ||
Check the top-level render call using <`+e+">.")}return n}}function $r(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var e=fn(n);if(Dr[e])return;Dr[e]=!0;var o="";r&&r._owner&&r._owner!==ur.current&&(o=" It was passed a child from "+O(r._owner.type)+"."),Y(r),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',e,o),Y(null)}}function Ar(r,n){{if(typeof r!="object")return;if(sr(r))for(var e=0;e<r.length;e++){var o=r[e];fr(o)&&$r(o,n)}else if(fr(r))r._store&&(r._store.validated=!0);else if(r){var s=z(r);if(typeof s=="function"&&s!==r.entries)for(var l=s.call(r),a;!(a=l.next()).done;)fr(a.value)&&$r(a.value,n)}}}function pn(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===p||n.$$typeof===t))e=n.propTypes;else return;if(e){var o=O(n);Zr(e,r.props,"prop",o,r)}else if(n.PropTypes!==void 0&&!cr){cr=!0;var s=O(n);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hn(r){{for(var n=Object.keys(r.props),e=0;e<n.length;e++){var o=n[e];if(o!=="children"&&o!=="key"){Y(r),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),Y(null);break}}r.ref!==null&&(Y(r),v("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}function Wr(r,n,e,o,s,l){{var a=N(r);if(!a){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 E=cn(s);E?i+=E:i+=Ir();var h;r===null?h="null":sr(r)?h="array":r!==void 0&&r.$$typeof===g?(h="<"+(O(r.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof r,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var w=un(r,n,e,s,l);if(w==null)return w;if(a){var S=n.children;if(S!==void 0)if(o)if(sr(S)){for(var V=0;V<S.length;V++)Ar(S[V],r);Object.freeze&&Object.freeze(S)}else v("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 Ar(S,r)}return r===m?hn(w):pn(w),w}}function vn(r,n,e){return Wr(r,n,e,!0)}function wn(r,n,e){return Wr(r,n,e,!1)}var gn=wn,bn=vn;M.Fragment=m,M.jsx=gn,M.jsxs=bn}()),M}process.env.NODE_ENV==="production"?er.exports=Lr():er.exports=zr();var d=er.exports;const Yr=`/* @import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap"); */ | ||
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap"); | ||
* { | ||
@@ -184,3 +185,3 @@ margin: 0; | ||
max-height: 312px; | ||
overflow-y: auto; | ||
/* overflow-y: auto; */ | ||
z-index: 999; | ||
@@ -193,2 +194,5 @@ width: 100%; | ||
gap: var(--hsd-ui-dropdown-spacing-sm); | ||
/* overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; */ | ||
} | ||
@@ -229,7 +233,11 @@ | ||
flex-direction: column; | ||
gap: var(--hsd-ui-dropdown-spacing-xs); | ||
/* overflow: hidden; */ | ||
/* gap: var(--hsd-ui-dropdown-spacing-xs); */ | ||
} | ||
.hsd-input-dropdwon-item { | ||
/* min-height: var(--height); */ | ||
/* max-height: var(--height); */ | ||
max-height: 58px; | ||
box-sizing: border-box; | ||
padding-inline: var(--paddingInline); | ||
@@ -240,11 +248,15 @@ display: flex; | ||
gap: var(--hsd-ui-dropdown-spacing-xs); | ||
padding-block: var(--paddingInline); | ||
border-radius: var(--hsd-ui-dropdown-border-radius-sm); | ||
/* min-width: max-content; */ | ||
overflow: hidden; | ||
} | ||
.hsd-input-dropdwon-item:hover { | ||
color: var(--hsd-ui-dropdown-background-color-primary); | ||
background-color: rgba(100, 181, 246, 0.21); | ||
} | ||
.hsd-input-dropdwon-item.active { | ||
color: var(--hsd-ui-dropdown-background-color-primary); | ||
/* color: var(--hsd-ui-dropdown-background-color-primary); */ | ||
/* border-radius: var(--borderRadius); */ | ||
background-color: rgba(100, 181, 246, 0.21); | ||
/* background: var(--hsd-ui-dropdown-background-color-secondary); */ | ||
@@ -280,3 +292,21 @@ /* box-shadow: 0px 0px 0px -1px #f0f0f0; */ | ||
} | ||
`;function Yr(g){const[x,k]=f.useState(g),R=f.useRef(null),T=D=>{R.current&&!R.current.contains(D.target)&&k(!1)};return f.useEffect(()=>(document.addEventListener("click",T,!0),()=>{document.removeEventListener("click",T,!0)}),[]),{ref:R,isComponentVisible:x,setIsComponentVisible:k}}const vr="hudoro-input-dropdown-styles";(g=>{if(!document.getElementById(vr)){const x=document.createElement("style");x.id=vr,x.textContent=g,document.head.appendChild(x)}})(Vr);const Mr=({dropdownLists:g,onChange:x,defaultValue:k,size:R="md",multiSelect:T,searchAble:D,iconLeft:F,placeholder:S,onSearch:w,error:I,position:v,onBlur:j,onFocus:O,disable:W})=>{const N=f.useRef(),[l,z]=f.useState([]),[C,p]=f.useState(""),q=f.useRef(null),{isComponentVisible:B,ref:J,setIsComponentVisible:G}=Yr(!1),ir=()=>{G(t=>!t)},K=(t,b)=>{if(!T)z([{label:t,value:b}]),x([{label:t,value:b}]),G(!1);else if(l==null?void 0:l.find(y=>y.value===b)){const y=[...l?l.filter(L=>L.value!==b):[]];z(y),x(y)}else{const y=[...l||[],{label:t,value:b}];z(y),x(y)}};f.useEffect(()=>{JSON.stringify(N.current)===JSON.stringify(k)||(N.current=k,z(N.current||[]))},[k]);const X=()=>l.length?T?l==null?void 0:l.map((t,b)=>s.jsx("p",{style:{minWidth:"max-content"},className:"hsd-input-dropdown-preview-item",children:t==null?void 0:t.label},b)):s.jsx("p",{style:{minWidth:"max-content"},children:l==null?void 0:l[0].label}):s.jsx("p",{className:"hsd-input-dropdown-placeholder",children:S});f.useEffect(()=>{p(v||"bottom")},[v]);const $=()=>{if(!v&&J.current&&q.current){const t=window.innerHeight,b=J.current.getBoundingClientRect(),m=q.current.getBoundingClientRect();b.bottom+m.height>=t-10?p("top"):p(v||"bottom")}};return f.useEffect(()=>(window.addEventListener("scroll",$),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$),window.removeEventListener("resize",$)}),[]),f.useEffect(()=>{$()},[B]),s.jsxs("div",{className:`hsd-input-dropdown-container ${W?"disable":""} hsd-input-dropdown-size-${R} ${B?"active":""} ${I?"error":""}`,ref:J,onClick:ir,children:[s.jsxs("div",{className:"hsd-input-dropdown-preview-container",children:[F?s.jsx(s.Fragment,{children:f.cloneElement(F,{width:gr(R),color:"#939E99"})}):null,s.jsx("div",{className:"hsd-input-dropdown-container-preview-item",tabIndex:100,onBlur:j,onFocus:O,children:X()}),s.jsx(qr,{strokeWidth:2,width:gr(R)})]}),B?s.jsxs("div",{className:`hsd-input-dropdown-lists-container | ||
hsd-input-dropdown-lists-container-${C}`,onClick:t=>t.stopPropagation(),ref:q,children:[D?s.jsxs("div",{className:"hsd-input-dropdown-container-dropdown-search",style:{order:C=="bottom"?1:2,position:"sticky",top:0,bottom:0},children:[s.jsx("div",{style:{display:"flex"},children:s.jsx(Ur,{strokeWidth:2,width:20})}),s.jsx("input",{onChange:t=>{w&&w(t.target.value)},autoFocus:!0,style:{width:"100%"}})]}):null,s.jsx("div",{className:"hsd-input-dropdwon-item-container",style:{order:C=="bottom"?2:1},children:C==="bottom"?g.map((t,b)=>s.jsxs("div",{className:`hsd-input-dropdwon-item ${l!=null&&l.find(m=>m.value===t.value)?"active":""} ${t.disable?"hsd-input-dropdwon-item-disable":null}`,onClick:()=>K(t.label,t.value),children:[t.icon?s.jsx("div",{children:f.cloneElement(t.icon,{width:16})}):null,s.jsxs("div",{children:[" ",s.jsx("p",{children:t.label})]})]},b)):g.reverse().map((t,b)=>s.jsxs("div",{className:`hsd-input-dropdwon-item ${l!=null&&l.find(m=>m.value===t.value)?"active":""} ${t.disable?"hsd-input-dropdwon-item-disable":null}`,onClick:()=>K(t.label,t.value),children:[t.icon?s.jsx("div",{children:f.cloneElement(t.icon,{width:16})}):null,s.jsxs("div",{children:[" ",s.jsx("p",{children:t.label})]})]},b))})]}):null]})},Ur=({...g})=>s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...g,viewBox:"0 0 20 20",fill:"none",children:[s.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),qr=({...g})=>s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...g,viewBox:"0 0 24 24",fill:"none",color:"#1976D2",children:s.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),gr=g=>{if(g==="sm")return 16;if(g==="md")return 20;if(g==="lg")return 20};A.Dropdown=Mr,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}); | ||
.hsd-input-dropdwon-item-text { | ||
color: #181a19; | ||
font-size: 14px; | ||
font-weight: 500; | ||
} | ||
.hsd-input-dropdwon-item-text.active { | ||
color: #1976d2; | ||
} | ||
.hsd-input-dropdwon-item-text-description { | ||
color: #78867f; | ||
font-size: 14px; | ||
font-weight: 400; | ||
} | ||
.hsd-input-dropdwon-item-text-description.active { | ||
color: #1976d2; | ||
} | ||
`;function Vr(f){const[g,j]=u.useState(f),m=u.useRef(null),C=x=>{m.current&&!m.current.contains(x.target)&&j(!1)};return u.useEffect(()=>(document.addEventListener("click",C,!0),()=>{document.removeEventListener("click",C,!0)}),[]),{ref:m,isComponentVisible:g,setIsComponentVisible:j}}const Br=({...f})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",...f,viewBox:"0 0 24 24",fill:"none",color:"#939E99",children:d.jsx("path",{d:"M4 9L12 17L20 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Mr=({...f})=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...f,viewBox:"0 0 20 20",fill:"none",children:[d.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ur=u.forwardRef(({positionDropdown:f,dropdownLists:g,isComponentVisible:j,searchAble:m,onSearch:C,value:x,handleChangeValue:P},F)=>{const[p,I]=u.useState(0),c=u.useRef(null);return u.useEffect(()=>{if(c.current){const t=c.current.getBoundingClientRect();I(t.width)}},[c,j]),d.jsx(d.Fragment,{children:j?d.jsxs("div",{className:`hsd-input-dropdown-lists-container | ||
hsd-input-dropdown-lists-container-${f}`,onClick:t=>t.stopPropagation(),ref:F,children:[m?d.jsxs("div",{className:"hsd-input-dropdown-container-dropdown-search",style:{order:f=="bottom"?1:2,position:"sticky",top:0,bottom:0},children:[d.jsx("div",{style:{display:"flex"},children:d.jsx(Mr,{strokeWidth:2,width:20})}),d.jsx("input",{onChange:t=>{C&&C(t.target.value)},autoFocus:!0,style:{width:"100%"}})]}):null,d.jsx("div",{className:"hsd-input-dropdwon-item-container",style:{order:f=="bottom"?2:1},ref:c,children:f==="bottom"?g.map((t,k)=>{const R=!!(x!=null&&x.find(D=>D.value===t.value));return d.jsxs("div",{className:`hsd-input-dropdwon-item ${R?"active":" "} ${t.disable?"hsd-input-dropdwon-item-disable":null}`,onClick:()=>P(t.label,t.value),children:[t.icon?d.jsx("div",{children:u.cloneElement(t.icon,{width:16})}):null,d.jsxs("div",{children:[d.jsx("p",{className:`hsd-input-dropdwon-item-text ${R?"active":null}`,style:{textWrap:"nowrap",width:`${p-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:t.label}),t.description?d.jsx("p",{className:`hsd-input-dropdwon-item-text-description ${R?"active":null}`,style:{textWrap:"nowrap",width:`${p-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:t.description}):null]})]},k)}):g.reverse().map((t,k)=>{const R=!!(x!=null&&x.find(D=>D.value===t.value));return d.jsxs("div",{className:`hsd-input-dropdwon-item ${R?"active":""} ${t.disable?"hsd-input-dropdwon-item-disable":null}`,onClick:()=>P(t.label,t.value),children:[t.icon?d.jsx("div",{children:u.cloneElement(t.icon,{width:16})}):null,d.jsxs("div",{children:[d.jsx("p",{className:`hsd-input-dropdwon-item-text ${R?"active":null}`,style:{textWrap:"nowrap",width:`${p-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:t.label}),t.description?d.jsx("p",{className:`hsd-input-dropdwon-item-text-description ${R?"active":null}`,style:{textWrap:"nowrap",width:`${p-12}px`,overflow:"hidden",textOverflow:"ellipsis"},children:t.description}):null]})]},k)})})]}):null})}),vr="hudoro-input-dropdown-styles";(f=>{if(!document.getElementById(vr)){const g=document.createElement("style");g.id=vr,g.textContent=f,document.head.appendChild(g)}})(Yr);const qr=({dropdownLists:f,onChange:g,defaultValue:j,size:m="md",multiSelect:C,searchAble:x,iconLeft:P,placeholder:F,onSearch:p,error:I,position:c,onBlur:t,onFocus:k,disable:R})=>{const D=u.useRef(),[b,z]=u.useState([]),[A,v]=u.useState(""),U=u.useRef(null),{isComponentVisible:q,ref:J,setIsComponentVisible:G}=Vr(!1),or=()=>{G(_=>!_)},tr=(_,T)=>{if(!C)z([{label:_,value:T}]),g([{label:_,value:T}]),G(!1);else if(b==null?void 0:b.find(y=>y.value===T)){const y=[...b?b.filter(L=>L.value!==T):[]];z(y),g(y)}else{const y=[...b||[],{label:_,value:T}];z(y),g(y)}};u.useEffect(()=>{JSON.stringify(D.current)===JSON.stringify(j)||(D.current=j,z(D.current||[]))},[j]);const K=()=>b.length?C?b==null?void 0:b.map((_,T)=>d.jsx("p",{style:{minWidth:"max-content"},className:"hsd-input-dropdown-preview-item",children:_==null?void 0:_.label},T)):d.jsx("p",{style:{minWidth:"max-content"},children:b==null?void 0:b[0].label}):d.jsx("p",{className:"hsd-input-dropdown-placeholder",children:F});u.useEffect(()=>{v(c||"bottom")},[c]);const N=()=>{if(!c&&J.current&&U.current){const _=window.innerHeight,T=J.current.getBoundingClientRect(),O=U.current.getBoundingClientRect();T.bottom+O.height>=_-10?v("top"):v(c||"bottom")}};return u.useEffect(()=>(window.addEventListener("scroll",N),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N),window.removeEventListener("resize",N)}),[]),u.useEffect(()=>{N()},[q]),d.jsxs("div",{className:`hsd-input-dropdown-container ${R?"disable":""} hsd-input-dropdown-size-${m} ${q?"active":""} ${I?"error":""}`,ref:J,onClick:or,children:[d.jsxs("div",{className:"hsd-input-dropdown-preview-container",children:[P?d.jsx(d.Fragment,{children:u.cloneElement(P,{width:wr(m),color:"#939E99"})}):null,d.jsx("div",{className:"hsd-input-dropdown-container-preview-item",tabIndex:100,onBlur:t,onFocus:k,children:K()}),d.jsx(Br,{strokeWidth:2,width:wr(m)})]}),d.jsx(Ur,{dropdownLists:f,handleChangeValue:tr,isComponentVisible:q,positionDropdown:A,searchAble:!!x,value:b,onSearch:p,ref:U})]})},wr=f=>{if(f==="sm")return 16;if(f==="md")return 20;if(f==="lg")return 20};W.Dropdown=qr,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}); |
@@ -13,2 +13,3 @@ export interface IconPropsDropdown extends React.SVGProps<SVGSVGElement> { | ||
disable?: boolean; | ||
description?: string; | ||
}[]; | ||
@@ -15,0 +16,0 @@ defaultValue?: { |
{ | ||
"name": "@hudoro/dropdown", | ||
"version": "0.0.3-beta.41", | ||
"version": "0.0.3-beta.42", | ||
"description": "dropdown component for Hudoro UI", | ||
@@ -5,0 +5,0 @@ "author": "Prawito Hudoro", |
74938
9
1597
7