@commander-services/cmd-dropdown-portal 1.5.0 → 1.6.1

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/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export declare interface CmdDropdownPortalProps {
7
7
  elementId: string;
8
8
  children: default_2.ReactNode;
9
9
  handleOpen: (value: boolean) => void;
10
+ target?: HTMLElement;
11
+ keepWidth?: boolean;
10
12
  }
11
13
 
12
14
  export { }
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as xe from "react";
1
+ import * as ke from "react";
2
2
  import A, { useState as fr } from "react";
3
3
  import dr from "react-dom";
4
4
  var K = { exports: {} }, L = {};
@@ -15,17 +15,17 @@ var Ce;
15
15
  function vr() {
16
16
  if (Ce) return L;
17
17
  Ce = 1;
18
- var g = A, f = Symbol.for("react.element"), y = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, k = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, j = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ var v = A, f = Symbol.for("react.element"), y = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, x = v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, j = { key: !0, ref: !0, __self: !0, __source: !0 };
19
19
  function C(w, d, R) {
20
- var c, p = {}, v = null, T = null;
21
- R !== void 0 && (v = "" + R), d.key !== void 0 && (v = "" + d.key), d.ref !== void 0 && (T = d.ref);
22
- for (c in d) h.call(d, c) && !j.hasOwnProperty(c) && (p[c] = d[c]);
23
- if (w && w.defaultProps) for (c in d = w.defaultProps, d) p[c] === void 0 && (p[c] = d[c]);
24
- return { $$typeof: f, type: w, key: v, ref: T, props: p, _owner: k.current };
20
+ var c, m = {}, p = null, T = null;
21
+ R !== void 0 && (p = "" + R), d.key !== void 0 && (p = "" + d.key), d.ref !== void 0 && (T = d.ref);
22
+ for (c in d) h.call(d, c) && !j.hasOwnProperty(c) && (m[c] = d[c]);
23
+ if (w && w.defaultProps) for (c in d = w.defaultProps, d) m[c] === void 0 && (m[c] = d[c]);
24
+ return { $$typeof: f, type: w, key: p, ref: T, props: m, _owner: x.current };
25
25
  }
26
26
  return L.Fragment = y, L.jsx = C, L.jsxs = C, L;
27
27
  }
28
- var $ = {};
28
+ var W = {};
29
29
  /**
30
30
  * @license React
31
31
  * react-jsx-runtime.development.js
@@ -38,22 +38,22 @@ var $ = {};
38
38
  var Pe;
39
39
  function pr() {
40
40
  return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
41
- var g = A, f = Symbol.for("react.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), w = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), W = Symbol.iterator, V = "@@iterator";
41
+ var v = A, f = Symbol.for("react.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), w = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), $ = Symbol.iterator, V = "@@iterator";
42
42
  function J(e) {
43
43
  if (e === null || typeof e != "object")
44
44
  return null;
45
- var r = W && e[W] || e[V];
45
+ var r = $ && e[$] || e[V];
46
46
  return typeof r == "function" ? r : null;
47
47
  }
48
- var O = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
49
- function m(e) {
48
+ var O = v.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
49
+ function E(e) {
50
50
  {
51
51
  for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
52
52
  t[n - 1] = arguments[n];
53
- ke("error", e, t);
53
+ xe("error", e, t);
54
54
  }
55
55
  }
56
- function ke(e, r, t) {
56
+ function xe(e, r, t) {
57
57
  {
58
58
  var n = O.ReactDebugCurrentFrame, i = n.getStackAddendum();
59
59
  i !== "" && (r += "%s", t = t.concat([i]));
@@ -66,7 +66,7 @@ function pr() {
66
66
  var je = !1, De = !1, Fe = !1, Ae = !1, Ie = !1, re;
67
67
  re = Symbol.for("react.module.reference");
68
68
  function Ye(e) {
69
- return !!(typeof e == "string" || typeof e == "function" || e === h || e === j || Ie || e === k || e === R || e === c || Ae || e === T || je || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === v || e.$$typeof === p || e.$$typeof === C || e.$$typeof === w || e.$$typeof === d || // This needs to include all possible module reference object
69
+ return !!(typeof e == "string" || typeof e == "function" || e === h || e === j || Ie || e === x || e === R || e === c || Ae || e === T || je || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === m || e.$$typeof === C || e.$$typeof === w || e.$$typeof === d || // This needs to include all possible module reference object
70
70
  // types supported by any Flight configuration anywhere since
71
71
  // we don't know which Flight build this will end up being used
72
72
  // with.
@@ -85,7 +85,7 @@ function pr() {
85
85
  function P(e) {
86
86
  if (e == null)
87
87
  return null;
88
- if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
88
+ if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
89
89
  return e.displayName || e.name || null;
90
90
  if (typeof e == "string")
91
91
  return e;
@@ -96,7 +96,7 @@ function pr() {
96
96
  return "Portal";
97
97
  case j:
98
98
  return "Profiler";
99
- case k:
99
+ case x:
100
100
  return "StrictMode";
101
101
  case R:
102
102
  return "Suspense";
@@ -113,10 +113,10 @@ function pr() {
113
113
  return te(t._context) + ".Provider";
114
114
  case d:
115
115
  return Le(e, e.render, "ForwardRef");
116
- case p:
116
+ case m:
117
117
  var n = e.displayName || null;
118
118
  return n !== null ? n : P(e.type) || "Memo";
119
- case v: {
119
+ case p: {
120
120
  var i = e, u = i._payload, o = i._init;
121
121
  try {
122
122
  return P(o(u));
@@ -131,7 +131,7 @@ function pr() {
131
131
  function ce() {
132
132
  }
133
133
  ce.__reactDisabledLog = !0;
134
- function $e() {
134
+ function We() {
135
135
  {
136
136
  if (I === 0) {
137
137
  ne = console.log, ae = console.info, oe = console.warn, ie = console.error, ue = console.group, se = console.groupCollapsed, le = console.groupEnd;
@@ -154,7 +154,7 @@ function pr() {
154
154
  I++;
155
155
  }
156
156
  }
157
- function We() {
157
+ function $e() {
158
158
  {
159
159
  if (I--, I === 0) {
160
160
  var e = {
@@ -186,7 +186,7 @@ function pr() {
186
186
  })
187
187
  });
188
188
  }
189
- I < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
+ I < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
190
  }
191
191
  }
192
192
  var q = O.ReactCurrentDispatcher, z;
@@ -221,7 +221,7 @@ function pr() {
221
221
  var i = Error.prepareStackTrace;
222
222
  Error.prepareStackTrace = void 0;
223
223
  var u;
224
- u = q.current, q.current = null, $e();
224
+ u = q.current, q.current = null, We();
225
225
  try {
226
226
  if (r) {
227
227
  var o = function() {
@@ -257,14 +257,14 @@ function pr() {
257
257
  } catch (b) {
258
258
  if (b && n && typeof b.stack == "string") {
259
259
  for (var a = b.stack.split(`
260
- `), E = n.stack.split(`
261
- `), s = a.length - 1, l = E.length - 1; s >= 1 && l >= 0 && a[s] !== E[l]; )
260
+ `), g = n.stack.split(`
261
+ `), s = a.length - 1, l = g.length - 1; s >= 1 && l >= 0 && a[s] !== g[l]; )
262
262
  l--;
263
263
  for (; s >= 1 && l >= 0; s--, l--)
264
- if (a[s] !== E[l]) {
264
+ if (a[s] !== g[l]) {
265
265
  if (s !== 1 || l !== 1)
266
266
  do
267
- if (s--, l--, l < 0 || a[s] !== E[l]) {
267
+ if (s--, l--, l < 0 || a[s] !== g[l]) {
268
268
  var _ = `
269
269
  ` + a[s].replace(" at new ", " at ");
270
270
  return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, _), _;
@@ -274,10 +274,10 @@ function pr() {
274
274
  }
275
275
  }
276
276
  } finally {
277
- G = !1, q.current = u, We(), Error.prepareStackTrace = i;
277
+ G = !1, q.current = u, $e(), Error.prepareStackTrace = i;
278
278
  }
279
- var F = e ? e.displayName || e.name : "", x = F ? M(F) : "";
280
- return typeof e == "function" && B.set(e, x), x;
279
+ var F = e ? e.displayName || e.name : "", k = F ? M(F) : "";
280
+ return typeof e == "function" && B.set(e, k), k;
281
281
  }
282
282
  function Me(e, r, t) {
283
283
  return fe(e, !1);
@@ -303,9 +303,9 @@ function pr() {
303
303
  switch (e.$$typeof) {
304
304
  case d:
305
305
  return Me(e.render);
306
- case p:
306
+ case m:
307
307
  return U(e.type, r, t);
308
- case v: {
308
+ case p: {
309
309
  var n = e, i = n._payload, u = n._init;
310
310
  try {
311
311
  return U(u(i), r, t);
@@ -331,14 +331,14 @@ function pr() {
331
331
  var a = void 0;
332
332
  try {
333
333
  if (typeof e[o] != "function") {
334
- var E = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
335
- throw E.name = "Invariant Violation", E;
334
+ var g = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
335
+ throw g.name = "Invariant Violation", g;
336
336
  }
337
337
  a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
338
338
  } catch (s) {
339
339
  a = s;
340
340
  }
341
- a && !(a instanceof Error) && (N(i), m("%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).", n || "React class", t, o, typeof a), N(null)), a instanceof Error && !(a.message in de) && (de[a.message] = !0, N(i), m("Failed %s type: %s", t, a.message), N(null));
341
+ a && !(a instanceof Error) && (N(i), E("%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).", n || "React class", t, o, typeof a), N(null)), a instanceof Error && !(a.message in de) && (de[a.message] = !0, N(i), E("Failed %s type: %s", t, a.message), N(null));
342
342
  }
343
343
  }
344
344
  }
@@ -364,7 +364,7 @@ function pr() {
364
364
  }
365
365
  function me(e) {
366
366
  if (Je(e))
367
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), pe(e);
367
+ return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), pe(e);
368
368
  }
369
369
  var Ee = O.ReactCurrentOwner, qe = {
370
370
  key: !0,
@@ -394,7 +394,7 @@ function pr() {
394
394
  function Xe(e, r) {
395
395
  {
396
396
  var t = function() {
397
- ge || (ge = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
397
+ ge || (ge = !0, E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
398
398
  };
399
399
  t.isReactWarning = !0, Object.defineProperty(e, "key", {
400
400
  get: t,
@@ -405,7 +405,7 @@ function pr() {
405
405
  function Ze(e, r) {
406
406
  {
407
407
  var t = function() {
408
- be || (be = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
408
+ be || (be = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
409
409
  };
410
410
  t.isReactWarning = !0, Object.defineProperty(e, "ref", {
411
411
  get: t,
@@ -444,8 +444,8 @@ function pr() {
444
444
  };
445
445
  function er(e, r, t, n, i) {
446
446
  {
447
- var u, o = {}, a = null, E = null;
448
- t !== void 0 && (me(t), a = "" + t), Ge(r) && (me(r.key), a = "" + r.key), ze(r) && (E = r.ref, He(r, i));
447
+ var u, o = {}, a = null, g = null;
448
+ t !== void 0 && (me(t), a = "" + t), Ge(r) && (me(r.key), a = "" + r.key), ze(r) && (g = r.ref, He(r, i));
449
449
  for (u in r)
450
450
  Y.call(r, u) && !qe.hasOwnProperty(u) && (o[u] = r[u]);
451
451
  if (e && e.defaultProps) {
@@ -453,11 +453,11 @@ function pr() {
453
453
  for (u in s)
454
454
  o[u] === void 0 && (o[u] = s[u]);
455
455
  }
456
- if (a || E) {
456
+ if (a || g) {
457
457
  var l = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
458
- a && Xe(o, l), E && Ze(o, l);
458
+ a && Xe(o, l), g && Ze(o, l);
459
459
  }
460
- return Qe(e, a, E, i, n, Ee.current, o);
460
+ return Qe(e, a, g, i, n, Ee.current, o);
461
461
  }
462
462
  }
463
463
  var X = O.ReactCurrentOwner, ye = O.ReactDebugCurrentFrame;
@@ -511,7 +511,7 @@ Check the top-level render call using <` + t + ">.");
511
511
  return;
512
512
  Re[t] = !0;
513
513
  var n = "";
514
- e && e._owner && e._owner !== X.current && (n = " It was passed a child from " + P(e._owner.type) + "."), D(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
514
+ e && e._owner && e._owner !== X.current && (n = " It was passed a child from " + P(e._owner.type) + "."), D(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
515
515
  }
516
516
  }
517
517
  function we(e, r) {
@@ -543,7 +543,7 @@ Check the top-level render call using <` + t + ">.");
543
543
  t = r.propTypes;
544
544
  else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
545
545
  // Inner props are checked in the reconciler.
546
- r.$$typeof === p))
546
+ r.$$typeof === m))
547
547
  t = r.propTypes;
548
548
  else
549
549
  return;
@@ -553,9 +553,9 @@ Check the top-level render call using <` + t + ">.");
553
553
  } else if (r.PropTypes !== void 0 && !Z) {
554
554
  Z = !0;
555
555
  var i = P(r);
556
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
556
+ E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
557
557
  }
558
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
558
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
559
  }
560
560
  }
561
561
  function ar(e) {
@@ -563,11 +563,11 @@ Check the top-level render call using <` + t + ">.");
563
563
  for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
564
564
  var n = r[t];
565
565
  if (n !== "children" && n !== "key") {
566
- D(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
566
+ D(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
567
567
  break;
568
568
  }
569
569
  }
570
- e.ref !== null && (D(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
570
+ e.ref !== null && (D(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
571
571
  }
572
572
  }
573
573
  var Te = {};
@@ -577,10 +577,10 @@ Check the top-level render call using <` + t + ">.");
577
577
  if (!o) {
578
578
  var a = "";
579
579
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
580
- var E = rr();
581
- E ? a += E : a += he();
580
+ var g = rr();
581
+ g ? a += g : a += he();
582
582
  var s;
583
- e === null ? s = "null" : H(e) ? s = "array" : e !== void 0 && e.$$typeof === f ? (s = "<" + (P(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
583
+ e === null ? s = "null" : H(e) ? s = "array" : e !== void 0 && e.$$typeof === f ? (s = "<" + (P(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
584
584
  }
585
585
  var l = er(e, r, t, i, u);
586
586
  if (l == null)
@@ -594,22 +594,22 @@ Check the top-level render call using <` + t + ">.");
594
594
  we(_[F], e);
595
595
  Object.freeze && Object.freeze(_);
596
596
  } else
597
- m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
597
+ E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
598
  else
599
599
  we(_, e);
600
600
  }
601
601
  if (Y.call(r, "key")) {
602
- var x = P(e), b = Object.keys(r).filter(function(cr) {
602
+ var k = P(e), b = Object.keys(r).filter(function(cr) {
603
603
  return cr !== "key";
604
604
  }), ee = b.length > 0 ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}";
605
- if (!Te[x + ee]) {
605
+ if (!Te[k + ee]) {
606
606
  var lr = b.length > 0 ? "{" + b.join(": ..., ") + ": ...}" : "{}";
607
- m(`A props object containing a "key" prop is being spread into JSX:
607
+ E(`A props object containing a "key" prop is being spread into JSX:
608
608
  let props = %s;
609
609
  <%s {...props} />
610
610
  React keys must be passed directly to JSX without using spread:
611
611
  let props = %s;
612
- <%s key={someKey} {...props} />`, ee, x, lr, x), Te[x + ee] = !0;
612
+ <%s key={someKey} {...props} />`, ee, k, lr, k), Te[k + ee] = !0;
613
613
  }
614
614
  }
615
615
  return e === h ? ar(l) : nr(l), l;
@@ -622,55 +622,55 @@ React keys must be passed directly to JSX without using spread:
622
622
  return Oe(e, r, t, !1);
623
623
  }
624
624
  var ur = ir, sr = or;
625
- $.Fragment = h, $.jsx = ur, $.jsxs = sr;
626
- }()), $;
625
+ W.Fragment = h, W.jsx = ur, W.jsxs = sr;
626
+ }()), W;
627
627
  }
628
628
  var Se;
629
629
  function mr() {
630
630
  return Se || (Se = 1, process.env.NODE_ENV === "production" ? K.exports = vr() : K.exports = pr()), K.exports;
631
631
  }
632
632
  var Er = mr();
633
- const gr = (g, f) => {
633
+ const gr = (v, f) => {
634
634
  const y = (h) => {
635
- g.current && !g.current.contains(h.target) && f(h);
635
+ v.current && !v.current.contains(h.target) && f(h);
636
636
  };
637
- xe.useEffect(() => (document.addEventListener("click", y, { capture: !0 }), () => {
637
+ ke.useEffect(() => (document.addEventListener("click", y, { capture: !0 }), () => {
638
638
  document.removeEventListener("click", y, { capture: !0 });
639
639
  }));
640
- }, br = "Escape", yr = (g, f) => {
640
+ }, br = "Escape", yr = (v, f) => {
641
641
  const y = ({ key: h }) => {
642
- h === g && f();
642
+ h === v && f();
643
643
  };
644
- xe.useEffect(() => (document.addEventListener("keyup", y), () => {
644
+ ke.useEffect(() => (document.addEventListener("keyup", y), () => {
645
645
  document.removeEventListener("keyup", y);
646
646
  }), []);
647
647
  }, hr = () => ({ useOutsideClick: gr, useKeyPress: yr, ESCAPE_KEY: br }), Rr = hr;
648
- function Tr(g) {
649
- const [f, y] = fr(null), { useOutsideClick: h, useKeyPress: k, ESCAPE_KEY: j } = Rr(), C = A.useRef(), w = () => {
648
+ function Tr(v) {
649
+ const [f, y] = fr(null), { useOutsideClick: h, useKeyPress: x, ESCAPE_KEY: j } = Rr(), C = A.useRef(), w = () => {
650
650
  setTimeout(function() {
651
- g.handleOpen(!1);
651
+ v.handleOpen(!1);
652
652
  }, 50);
653
653
  };
654
654
  h(C, () => {
655
655
  w();
656
- }), k(j, () => {
656
+ }), x(j, () => {
657
657
  w();
658
658
  });
659
- const d = (c, p) => {
660
- const v = c.getBoundingClientRect(), T = p.getBoundingClientRect();
661
- return v.bottom >= T.top && v.bottom <= T.bottom;
659
+ const d = (c, m) => {
660
+ const p = c.getBoundingClientRect(), T = m.getBoundingClientRect();
661
+ return p.bottom >= T.top && p.bottom <= T.bottom;
662
662
  }, R = A.useCallback(() => {
663
- const c = document.getElementById(g.elementId), p = document.getElementById("cmd-modal-body");
664
- if (c && (!p || d(c, p))) {
665
- const v = c.getBoundingClientRect(), T = 260, W = window.innerHeight - v.bottom, V = v.left, J = v.bottom, O = v.width;
666
- W >= T || !p ? y({
663
+ const c = document.getElementById(v.elementId), m = document.getElementById("cmd-modal-body");
664
+ if (c && (!m || d(c, m))) {
665
+ const p = c.getBoundingClientRect(), T = 260, $ = window.innerHeight - p.bottom, V = p.left, J = p.bottom, O = p.width;
666
+ $ >= T || !m ? y({
667
667
  // top: rect.bottom + window.scrollY,
668
668
  top: J,
669
669
  left: V,
670
670
  width: O,
671
671
  bottom: void 0
672
672
  }) : y({
673
- bottom: window.innerHeight - v.top - window.scrollY + 3,
673
+ bottom: window.innerHeight - p.top - window.scrollY + 3,
674
674
  left: V,
675
675
  width: O,
676
676
  top: void 0
@@ -682,25 +682,25 @@ function Tr(g) {
682
682
  window.removeEventListener("scroll", R, { capture: !0 }), window.removeEventListener("resize", R, { capture: !0 });
683
683
  }), [R]), A.useEffect(() => {
684
684
  R();
685
- }, [g.elementId]), f ? dr.createPortal(
685
+ }, [v.elementId]), f ? dr.createPortal(
686
686
  /* @__PURE__ */ Er.jsx(
687
687
  "div",
688
688
  {
689
689
  className: "font-poppins",
690
- id: `cmd-dropdown-portal-${g.elementId}`,
690
+ id: `cmd-dropdown-portal-${v.elementId}`,
691
691
  ref: C,
692
692
  style: {
693
693
  position: "absolute",
694
694
  left: f.left,
695
- width: f.width,
696
695
  zIndex: 999999,
697
696
  ...f.top !== void 0 ? { top: f.top } : {},
698
- ...f.bottom !== void 0 ? { bottom: f.bottom } : {}
697
+ ...f.bottom !== void 0 ? { bottom: f.bottom } : {},
698
+ ...v.keepWidth ? {} : { width: f.width }
699
699
  },
700
- children: g.children
700
+ children: v.children
701
701
  }
702
702
  ),
703
- document.body
703
+ v.target || document.body
704
704
  ) : null;
705
705
  }
706
706
  export {