@caseparts-org/caseblocks 0.0.116 → 0.0.117

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.
@@ -9,18 +9,18 @@ import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vl
9
9
  function D(r) {
10
10
  return r ? r.includes(" ") ? r : `${r} center` : "top center";
11
11
  }
12
- function U(r) {
12
+ function T(r) {
13
13
  const d = D(r).toLowerCase(), [s, c] = d.split(" ");
14
14
  return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: c === "left" || c === "top" ? "start" : c === "right" || c === "bottom" ? "end" : "center" };
15
15
  }
16
- function $(r, d, s, c, p = 8) {
16
+ function U(r, d, s, c, p = 8) {
17
17
  const n = r.getBoundingClientRect(), l = d.getBoundingClientRect();
18
18
  let a = 0, u = 0;
19
19
  s === "top" ? a = n.top - l.height - p : s === "bottom" ? a = n.bottom + p : s === "left" ? u = n.left - l.width - p : s === "right" && (u = n.right + p), s === "top" || s === "bottom" ? c === "start" ? u = n.left : c === "end" ? u = n.right - l.width : u = n.left + n.width / 2 - l.width / 2 : c === "start" ? a = n.top : c === "end" ? a = n.bottom - l.height : a = n.top + n.height / 2 - l.height / 2;
20
20
  const w = window.innerWidth, h = window.innerHeight;
21
21
  return a = Math.max(4, Math.min(h - l.height - 4, a)), u = Math.max(4, Math.min(w - l.width - 4, u)), { top: a, left: u };
22
22
  }
23
- const K = ({
23
+ const J = ({
24
24
  trigger: r,
25
25
  children: d,
26
26
  position: s,
@@ -32,7 +32,7 @@ const K = ({
32
32
  open: u,
33
33
  onOpenChange: w
34
34
  }) => {
35
- const { side: h, align: y } = U(s), [M, S] = f.useState(!1), x = typeof u == "boolean", o = x ? u : M, [m, R] = f.useState(null), b = f.useRef(null), v = f.useRef(null), L = (t) => {
35
+ const { side: h, align: y } = T(s), [M, S] = f.useState(!1), x = typeof u == "boolean", o = x ? u : M, [m, R] = f.useState(null), b = f.useRef(null), v = f.useRef(null), L = (t) => {
36
36
  const e = typeof t == "function" ? t(o) : t;
37
37
  x ? w == null || w(e) : S(e);
38
38
  }, _ = () => {
@@ -59,7 +59,7 @@ const K = ({
59
59
  const t = b.current, e = v.current;
60
60
  if (!t || !e) return;
61
61
  const i = () => {
62
- R($(t, e, h, y, 8));
62
+ R(U(t, e, h, y, 8));
63
63
  };
64
64
  return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
65
65
  window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
@@ -78,7 +78,7 @@ const K = ({
78
78
  const e = (i) => {
79
79
  const g = i.target;
80
80
  if (!g) return;
81
- g.closest('[data-popover-close="true"]') && E();
81
+ g.closest('[data-popover-close="true"]') && setTimeout(() => E(), 0);
82
82
  };
83
83
  return t.addEventListener("click", e), () => t.removeEventListener("click", e);
84
84
  }, [o, a]), f.useEffect(() => {
@@ -122,5 +122,5 @@ const K = ({
122
122
  ] });
123
123
  };
124
124
  export {
125
- K as Popover
125
+ J as Popover
126
126
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.116",
4
+ "version": "0.0.117",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",