@fullkekw/popup 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,9 +1,9 @@
1
- import Le, { createContext as Er, useState as k, useEffect as L, useContext as Ye } from "react";
1
+ import Le, { createContext as Er, useState as D, useEffect as L, useContext as Ye } from "react";
2
2
  import { createPortal as _r } from "react-dom";
3
3
  function Rr(m) {
4
4
  return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
5
5
  }
6
- var K = { exports: {} }, V = {};
6
+ var G = { exports: {} }, V = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.min.js
@@ -41,7 +41,7 @@ var Ne;
41
41
  function Or() {
42
42
  return Ne || (Ne = 1, process.env.NODE_ENV !== "production" && function() {
43
43
  var m = Le, O = Symbol.for("react.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), d = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), a = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), h = Symbol.iterator, C = "@@iterator";
44
- function X(e) {
44
+ function H(e) {
45
45
  if (e === null || typeof e != "object")
46
46
  return null;
47
47
  var r = h && e[h] || e[C];
@@ -52,10 +52,10 @@ function Or() {
52
52
  {
53
53
  for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
54
54
  t[n - 1] = arguments[n];
55
- H("error", e, t);
55
+ Z("error", e, t);
56
56
  }
57
57
  }
58
- function H(e, r, t) {
58
+ function Z(e, r, t) {
59
59
  {
60
60
  var n = S.ReactDebugCurrentFrame, f = n.getStackAddendum();
61
61
  f !== "" && (r += "%s", t = t.concat([f]));
@@ -65,10 +65,10 @@ function Or() {
65
65
  l.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, l);
66
66
  }
67
67
  }
68
- var Z = !1, I = !1, Q = !1, Ue = !1, ze = !1, ce;
68
+ var z = !1, k = !1, Q = !1, Ue = !1, ze = !1, ce;
69
69
  ce = Symbol.for("react.module.reference");
70
70
  function qe(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === v || e === i || ze || e === p || e === P || e === u || Ue || e === x || Z || I || Q || typeof e == "object" && e !== null && (e.$$typeof === a || e.$$typeof === g || e.$$typeof === c || e.$$typeof === d || e.$$typeof === y || // This needs to include all possible module reference object
71
+ return !!(typeof e == "string" || typeof e == "function" || e === v || e === i || ze || e === p || e === P || e === u || Ue || e === x || z || k || Q || typeof e == "object" && e !== null && (e.$$typeof === a || e.$$typeof === g || e.$$typeof === c || e.$$typeof === d || e.$$typeof === y || // This needs to include all possible module reference object
72
72
  // types supported by any Flight configuration anywhere since
73
73
  // we don't know which Flight build this will end up being used
74
74
  // with.
@@ -84,7 +84,7 @@ function Or() {
84
84
  function le(e) {
85
85
  return e.displayName || "Context";
86
86
  }
87
- function D(e) {
87
+ function I(e) {
88
88
  if (e == null)
89
89
  return null;
90
90
  if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
@@ -117,11 +117,11 @@ function Or() {
117
117
  return Je(e, e.render, "ForwardRef");
118
118
  case g:
119
119
  var n = e.displayName || null;
120
- return n !== null ? n : D(e.type) || "Memo";
120
+ return n !== null ? n : I(e.type) || "Memo";
121
121
  case a: {
122
122
  var f = e, l = f._payload, s = f._init;
123
123
  try {
124
- return D(s(l));
124
+ return I(s(l));
125
125
  } catch {
126
126
  return null;
127
127
  }
@@ -192,7 +192,7 @@ function Or() {
192
192
  }
193
193
  }
194
194
  var ee = S.ReactCurrentDispatcher, re;
195
- function z(e, r, t) {
195
+ function q(e, r, t) {
196
196
  {
197
197
  if (re === void 0)
198
198
  try {
@@ -205,16 +205,16 @@ function Or() {
205
205
  ` + re + e;
206
206
  }
207
207
  }
208
- var te = !1, q;
208
+ var te = !1, J;
209
209
  {
210
210
  var Ge = typeof WeakMap == "function" ? WeakMap : Map;
211
- q = new Ge();
211
+ J = new Ge();
212
212
  }
213
213
  function Ee(e, r) {
214
214
  if (!e || te)
215
215
  return "";
216
216
  {
217
- var t = q.get(e);
217
+ var t = J.get(e);
218
218
  if (t !== void 0)
219
219
  return t;
220
220
  }
@@ -269,7 +269,7 @@ function Or() {
269
269
  if (b--, E--, E < 0 || o[b] !== w[E]) {
270
270
  var j = `
271
271
  ` + o[b].replace(" at new ", " at ");
272
- return e.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, j), j;
272
+ return e.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", e.displayName)), typeof e == "function" && J.set(e, j), j;
273
273
  }
274
274
  while (b >= 1 && E >= 0);
275
275
  break;
@@ -278,8 +278,8 @@ function Or() {
278
278
  } finally {
279
279
  te = !1, ee.current = l, Ke(), Error.prepareStackTrace = f;
280
280
  }
281
- var W = e ? e.displayName || e.name : "", F = W ? z(W) : "";
282
- return typeof e == "function" && q.set(e, F), F;
281
+ var W = e ? e.displayName || e.name : "", F = W ? q(W) : "";
282
+ return typeof e == "function" && J.set(e, F), F;
283
283
  }
284
284
  function Xe(e, r, t) {
285
285
  return Ee(e, !1);
@@ -288,29 +288,29 @@ function Or() {
288
288
  var r = e.prototype;
289
289
  return !!(r && r.isReactComponent);
290
290
  }
291
- function J(e, r, t) {
291
+ function B(e, r, t) {
292
292
  if (e == null)
293
293
  return "";
294
294
  if (typeof e == "function")
295
295
  return Ee(e, He(e));
296
296
  if (typeof e == "string")
297
- return z(e);
297
+ return q(e);
298
298
  switch (e) {
299
299
  case P:
300
- return z("Suspense");
300
+ return q("Suspense");
301
301
  case u:
302
- return z("SuspenseList");
302
+ return q("SuspenseList");
303
303
  }
304
304
  if (typeof e == "object")
305
305
  switch (e.$$typeof) {
306
306
  case y:
307
307
  return Xe(e.render);
308
308
  case g:
309
- return J(e.type, r, t);
309
+ return B(e.type, r, t);
310
310
  case a: {
311
311
  var n = e, f = n._payload, l = n._init;
312
312
  try {
313
- return J(l(f), r, t);
313
+ return B(l(f), r, t);
314
314
  } catch {
315
315
  }
316
316
  }
@@ -318,9 +318,9 @@ function Or() {
318
318
  return "";
319
319
  }
320
320
  var M = Object.prototype.hasOwnProperty, _e = {}, Re = S.ReactDebugCurrentFrame;
321
- function B(e) {
321
+ function K(e) {
322
322
  if (e) {
323
- var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
323
+ var r = e._owner, t = B(e.type, e._source, r ? r.type : null);
324
324
  Re.setExtraStackFrame(t);
325
325
  } else
326
326
  Re.setExtraStackFrame(null);
@@ -340,7 +340,7 @@ function Or() {
340
340
  } catch (b) {
341
341
  o = b;
342
342
  }
343
- o && !(o instanceof Error) && (B(f), R("%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, s, typeof o), B(null)), o instanceof Error && !(o.message in _e) && (_e[o.message] = !0, B(f), R("Failed %s type: %s", t, o.message), B(null));
343
+ o && !(o instanceof Error) && (K(f), R("%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, s, typeof o), K(null)), o instanceof Error && !(o.message in _e) && (_e[o.message] = !0, K(f), R("Failed %s type: %s", t, o.message), K(null));
344
344
  }
345
345
  }
346
346
  }
@@ -465,7 +465,7 @@ function Or() {
465
465
  var ae = S.ReactCurrentOwner, Pe = S.ReactDebugCurrentFrame;
466
466
  function $(e) {
467
467
  if (e) {
468
- var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
468
+ var r = e._owner, t = B(e.type, e._source, r ? r.type : null);
469
469
  Pe.setExtraStackFrame(t);
470
470
  } else
471
471
  Pe.setExtraStackFrame(null);
@@ -478,7 +478,7 @@ function Or() {
478
478
  function Ce() {
479
479
  {
480
480
  if (ae.current) {
481
- var e = D(ae.current.type);
481
+ var e = I(ae.current.type);
482
482
  if (e)
483
483
  return `
484
484
 
@@ -513,7 +513,7 @@ Check the top-level render call using <` + t + ">.");
513
513
  return;
514
514
  je[t] = !0;
515
515
  var n = "";
516
- e && e._owner && e._owner !== ae.current && (n = " It was passed a child from " + D(e._owner.type) + "."), $(e), R('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), $(null);
516
+ e && e._owner && e._owner !== ae.current && (n = " It was passed a child from " + I(e._owner.type) + "."), $(e), R('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), $(null);
517
517
  }
518
518
  }
519
519
  function De(e, r) {
@@ -528,7 +528,7 @@ Check the top-level render call using <` + t + ">.");
528
528
  else if (ie(e))
529
529
  e._store && (e._store.validated = !0);
530
530
  else if (e) {
531
- var f = X(e);
531
+ var f = H(e);
532
532
  if (typeof f == "function" && f !== e.entries)
533
533
  for (var l = f.call(e), s; !(s = l.next()).done; )
534
534
  ie(s.value) && ke(s.value, r);
@@ -550,11 +550,11 @@ Check the top-level render call using <` + t + ">.");
550
550
  else
551
551
  return;
552
552
  if (t) {
553
- var n = D(r);
553
+ var n = I(r);
554
554
  Ze(t, e.props, "prop", n, e);
555
555
  } else if (r.PropTypes !== void 0 && !oe) {
556
556
  oe = !0;
557
- var f = D(r);
557
+ var f = I(r);
558
558
  R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown");
559
559
  }
560
560
  typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
@@ -582,7 +582,7 @@ Check the top-level render call using <` + t + ">.");
582
582
  var w = cr();
583
583
  w ? o += w : o += Ce();
584
584
  var b;
585
- e === null ? b = "null" : ne(e) ? b = "array" : e !== void 0 && e.$$typeof === O ? (b = "<" + (D(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, o);
585
+ e === null ? b = "null" : ne(e) ? b = "array" : e !== void 0 && e.$$typeof === O ? (b = "<" + (I(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, o);
586
586
  }
587
587
  var E = fr(e, r, t, f, l);
588
588
  if (E == null)
@@ -601,7 +601,7 @@ Check the top-level render call using <` + t + ">.");
601
601
  De(j, e);
602
602
  }
603
603
  if (M.call(r, "key")) {
604
- var F = D(e), T = Object.keys(r).filter(function(hr) {
604
+ var F = I(e), T = Object.keys(r).filter(function(hr) {
605
605
  return hr !== "key";
606
606
  }), ue = T.length > 0 ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}";
607
607
  if (!Ie[F + ue]) {
@@ -629,7 +629,7 @@ React keys must be passed directly to JSX without using spread:
629
629
  }
630
630
  var $e;
631
631
  function wr() {
632
- return $e || ($e = 1, process.env.NODE_ENV === "production" ? K.exports = xr() : K.exports = Or()), K.exports;
632
+ return $e || ($e = 1, process.env.NODE_ENV === "production" ? G.exports = xr() : G.exports = Or()), G.exports;
633
633
  }
634
634
  var N = wr(), se = { exports: {} };
635
635
  /*!
@@ -671,13 +671,13 @@ function Sr() {
671
671
  }(se)), se.exports;
672
672
  }
673
673
  var Tr = Sr();
674
- const G = /* @__PURE__ */ Rr(Tr), Me = {
674
+ const X = /* @__PURE__ */ Rr(Tr), Me = {
675
675
  disableScroll: !0,
676
676
  exitOnDocument: !0,
677
677
  exitOnEscape: !0,
678
678
  preventStateChange: !1
679
679
  }, fe = Er({}), Pr = ({ className: m, settings: O, children: _ }) => {
680
- const [v] = k(Ve(O ?? {}, Me)), [p, i] = k([]), c = {
680
+ const [v] = D(Ve(O ?? {}, Me)), [p, i] = D([]), c = {
681
681
  nodes: p,
682
682
  toggleNode: d,
683
683
  registerNode: y,
@@ -713,20 +713,22 @@ const G = /* @__PURE__ */ Rr(Tr), Me = {
713
713
  }
714
714
  return /* @__PURE__ */ N.jsxs(fe.Provider, { value: c, children: [
715
715
  _,
716
- /* @__PURE__ */ N.jsx("section", { className: G("fkw-popup-container", m), id: "fkw-popup-container" })
716
+ /* @__PURE__ */ N.jsx("section", { className: X("fkw-popup-container", m), id: "fkw-popup-container" })
717
717
  ] });
718
718
  }, Cr = ({ children: m, className: O, layerClassName: _, style: v, id: p, settings: i, isOpen: c, setIsOpen: d, animation: y, ...P }) => {
719
- const u = Ye(fe), [g] = k(y ?? "scale"), [a] = k(Ve(i ?? {}, Me)), [x, h] = k(!1), [C, X] = k(null), [S, R] = k(!1), [H, Z] = k(0);
719
+ const u = Ye(fe), [g] = D(y ?? "scale"), [a] = D(Ve(i ?? {}, Me)), [x, h] = D(!1), [C, H] = D(null), [S, R] = D(!1), [Z, z] = D(0);
720
720
  return L(() => {
721
- X(document.querySelector("#fkw-popup-container")), h(!0), u.registerNode({
721
+ H(document.querySelector("#fkw-popup-container")), h(!0), u.registerNode({
722
722
  id: p,
723
723
  open: !1,
724
724
  zIndex: 0,
725
725
  settings: a
726
726
  });
727
727
  }, []), L(() => {
728
- const I = u.nodes.find((Q) => Q.id === p);
729
- I && (R(I.open), Z(I.zIndex));
728
+ const k = u.nodes.find((Q) => Q.id === p);
729
+ k && (R(k.open), k.zIndex !== 0 ? z(k.zIndex) : setTimeout(() => {
730
+ z(k.zIndex);
731
+ }, 200));
730
732
  }, [u]), L(() => {
731
733
  d === void 0 || c === S || d(S);
732
734
  }, [S]), L(() => {
@@ -735,13 +737,13 @@ const G = /* @__PURE__ */ Rr(Tr), Me = {
735
737
  "section",
736
738
  {
737
739
  id: p,
738
- className: G("fkw-popup-layer", S && "fkw-popup-layer--open", _),
739
- style: { zIndex: 1e4 + H, cursor: a.exitOnDocument && !a.preventStateChange ? "pointer" : "auto", ...v },
740
- onClick: a.exitOnDocument && !a.preventStateChange ? (I) => u.toggleDocument(p, I) : void 0,
740
+ className: X("fkw-popup-layer", S && "fkw-popup-layer--open", _),
741
+ style: { zIndex: 1e4 + Z, cursor: a.exitOnDocument && !a.preventStateChange ? "pointer" : "auto", ...v },
742
+ onClick: a.exitOnDocument && !a.preventStateChange ? (k) => u.toggleDocument(p, k) : void 0,
741
743
  children: /* @__PURE__ */ N.jsx(
742
744
  "article",
743
745
  {
744
- className: G("fkw-popup", S && "fkw-popup--open", g && `fkw-popup-animation--${g}`, O),
746
+ className: X("fkw-popup", S && "fkw-popup--open", g && `fkw-popup-animation--${g}`, O),
745
747
  role: "dialog",
746
748
  "aria-modal": !0,
747
749
  "aria-hidden": !S,
@@ -752,7 +754,7 @@ const G = /* @__PURE__ */ Rr(Tr), Me = {
752
754
  }
753
755
  ) }), C);
754
756
  }, jr = ({ children: m, as: O, className: _, onClick: v, disabled: p, popupId: i, ...c }) => {
755
- const d = Ye(fe), y = O ?? "button", [P, u] = k(!1);
757
+ const d = Ye(fe), y = O ?? "button", [P, u] = D(!1);
756
758
  L(() => {
757
759
  const a = d.nodes.find((x) => x.id === i);
758
760
  a && u(a.open);
@@ -760,7 +762,7 @@ const G = /* @__PURE__ */ Rr(Tr), Me = {
760
762
  function g(a) {
761
763
  d.toggleNode(i), v && v(a);
762
764
  }
763
- return /* @__PURE__ */ N.jsx(y, { className: G("fkw-popup-button", P && "fkw-popup-button--active", _), role: "button", onClick: g, "aria-haspopup": "dialog", tabIndex: 0, disabled: p, "aria-disabled": p, "data-fkw-popup-operator": i, "aria-label": P ? "Close Popup" : "Open Popup", ...c, children: m });
765
+ return /* @__PURE__ */ N.jsx(y, { className: X("fkw-popup-button", P && "fkw-popup-button--active", _), role: "button", onClick: g, "aria-haspopup": "dialog", tabIndex: 0, disabled: p, "aria-disabled": p, "data-fkw-popup-operator": i, "aria-label": P ? "Close Popup" : "Open Popup", ...c, children: m });
764
766
  };
765
767
  function Ve(m, O) {
766
768
  const _ = { ...O };