@memobit/libs 3.28.1 → 3.28.2

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.
@@ -1,111 +1,121 @@
1
1
  import './Popover.css';
2
2
  /* empty css */
3
- import { useCallback as N, useEffect as O, useRef as _, useState as M } from "react";
4
- import { jsx as x, jsxs as z } from "react/jsx-runtime";
5
- import { createPortal as C } from "react-dom";
6
- var i = 20, P = 16, G = 8, B = ({ children: y, visible: h, onClose: g, anchorEl: c, offset: u = G, placement: a = "auto" }) => {
7
- const m = _(null), v = _(null), [w, A] = M({
3
+ import { useCallback as z, useEffect as y, useRef as A, useState as G } from "react";
4
+ import { jsx as F, jsxs as S } from "react/jsx-runtime";
5
+ import { createPortal as T } from "react-dom";
6
+ var l = 20, M = 16, j = 8, q = ({ children: b, visible: d, onClose: v, anchorEl: h, offset: m = j, placement: r = "auto" }) => {
7
+ const f = A(null), R = A(null), [u, k] = G({
8
8
  top: 0,
9
9
  left: 0,
10
10
  placement: "bottom",
11
11
  arrowOffset: null
12
- }), f = N(() => {
13
- if (!c || !m.current || !h) return;
14
- const t = c.getBoundingClientRect(), e = m.current.getBoundingClientRect(), n = {
12
+ }), p = z(() => {
13
+ if (!h || !f.current || !d) return;
14
+ const t = h.getBoundingClientRect(), e = {
15
+ width: f.current.offsetWidth,
16
+ height: f.current.offsetHeight
17
+ }, o = {
15
18
  width: window.innerWidth,
16
19
  height: window.innerHeight
17
- }, R = (p, d) => p >= i && d >= i && p + e.height <= n.height - i && d + e.width <= n.width - i, l = {
20
+ }, E = (i, n) => i >= l && n >= l && i + e.height <= o.height - l && n + e.width <= o.width - l, w = {
18
21
  bottom: {
19
- top: t.bottom + u,
22
+ top: t.bottom + m,
20
23
  left: t.left + (t.width - e.width) / 2
21
24
  },
22
25
  top: {
23
- top: t.top - e.height - u,
26
+ top: t.top - e.height - m,
24
27
  left: t.left + (t.width - e.width) / 2
25
28
  },
26
29
  left: {
27
30
  top: t.top + (t.height - e.height) / 2,
28
- left: t.left - e.width - u
31
+ left: t.left - e.width - m
29
32
  },
30
33
  right: {
31
34
  top: t.top + (t.height - e.height) / 2,
32
- left: t.right + u
35
+ left: t.right + m
33
36
  }
34
- };
35
- let o, { top: r, left: s } = l.bottom;
36
- if (a === "auto")
37
- o = [
38
- "bottom",
39
- "top",
40
- "right",
41
- "left"
42
- ].find((p) => {
43
- const d = l[p];
44
- return R(d.top, d.left);
45
- }) || "bottom", { top: r, left: s } = l[o];
46
- else {
47
- const p = l[a];
48
- R(p.top, p.left) ? (o = a, { top: r, left: s } = p) : (o = [
37
+ }, _ = t.top > o.height - t.bottom ? "top" : "bottom";
38
+ let c, L = !0;
39
+ if (r === "auto") {
40
+ const i = [
49
41
  "bottom",
50
42
  "top",
51
43
  "right",
52
44
  "left"
53
- ].filter((d) => d !== a).find((d) => {
54
- const L = l[d];
55
- return R(L.top, L.left);
56
- }) || a, { top: r, left: s } = l[o]);
45
+ ].find((n) => {
46
+ const s = w[n];
47
+ return E(s.top, s.left);
48
+ });
49
+ L = i !== void 0, c = i ?? _;
50
+ } else {
51
+ const i = w[r];
52
+ if (E(i.top, i.left)) c = r;
53
+ else {
54
+ const n = [
55
+ "bottom",
56
+ "top",
57
+ "right",
58
+ "left"
59
+ ].filter((s) => s !== r).find((s) => {
60
+ const P = w[s];
61
+ return E(P.top, P.left);
62
+ });
63
+ L = n !== void 0, c = n ?? (r === "top" || r === "bottom" ? _ : r);
64
+ }
57
65
  }
58
- (o === "top" || o === "bottom") && (s < i && (s = i), s + e.width > n.width - i && (s = n.width - e.width - i)), (o === "left" || o === "right") && (r < i && (r = i), r + e.height > n.height - i && (r = n.height - e.height - i));
59
- const E = o === "top" || o === "bottom", b = E ? t.left + t.width / 2 - s : t.top + t.height / 2 - r, k = E ? e.width : e.height, I = Math.min(Math.max(b, P), k - P);
60
- A({
61
- top: r,
62
- left: s,
63
- placement: o,
64
- arrowOffset: I
66
+ let { top: a, left: g } = w[c];
67
+ const x = (i, n, s) => Math.max(l, Math.min(i, s - n - l)), O = c === "top" || c === "bottom";
68
+ O ? (g = x(g, e.width, o.width), L || (a = x(a, e.height, o.height))) : a = x(a, e.height, o.height);
69
+ const N = O ? t.left + t.width / 2 - g : t.top + t.height / 2 - a, V = O ? e.width : e.height, W = Math.min(Math.max(N, M), V - M);
70
+ k({
71
+ top: a,
72
+ left: g,
73
+ placement: c,
74
+ arrowOffset: W
65
75
  });
66
76
  }, [
67
- c,
68
77
  h,
69
- u,
70
- a
78
+ d,
79
+ m,
80
+ r
71
81
  ]);
72
- if (O(() => (h && (v.current = requestAnimationFrame(f)), () => {
73
- v.current !== null && cancelAnimationFrame(v.current);
74
- }), [h, f]), O(() => {
75
- if (!h) return;
76
- const t = (n) => {
77
- m.current && c && !m.current.contains(n.target) && !c.contains(n.target) && g();
78
- }, e = (n) => {
79
- n.key === "Escape" && g();
82
+ if (y(() => (d && (R.current = requestAnimationFrame(p)), () => {
83
+ R.current !== null && cancelAnimationFrame(R.current);
84
+ }), [d, p]), y(() => {
85
+ if (!d) return;
86
+ const t = (o) => {
87
+ f.current && h && !f.current.contains(o.target) && !h.contains(o.target) && v();
88
+ }, e = (o) => {
89
+ o.key === "Escape" && v();
80
90
  };
81
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", e), window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
82
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", e), window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
91
+ return document.addEventListener("mousedown", t), document.addEventListener("keydown", e), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
92
+ document.removeEventListener("mousedown", t), document.removeEventListener("keydown", e), window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
83
93
  };
84
94
  }, [
95
+ d,
96
+ v,
85
97
  h,
86
- g,
87
- c,
88
- f
89
- ]), !h || !c) return null;
90
- const F = /* @__PURE__ */ z("div", {
91
- ref: m,
92
- className: `simple-popover simple-popover--${w.placement}`,
98
+ p
99
+ ]), !d || !h) return null;
100
+ const I = /* @__PURE__ */ S("div", {
101
+ ref: f,
102
+ className: `simple-popover simple-popover--${u.placement}`,
93
103
  style: {
94
104
  position: "fixed",
95
- top: w.top,
96
- left: w.left,
105
+ top: u.top,
106
+ left: u.left,
97
107
  zIndex: 9999
98
108
  },
99
- children: [/* @__PURE__ */ x("div", {
109
+ children: [/* @__PURE__ */ F("div", {
100
110
  className: "simple-popover__arrow",
101
- style: w.arrowOffset === null ? void 0 : { "--popover-arrow-position": `${w.arrowOffset}px` }
102
- }), /* @__PURE__ */ x("div", {
111
+ style: u.arrowOffset === null ? void 0 : { "--popover-arrow-position": `${u.arrowOffset}px` }
112
+ }), /* @__PURE__ */ F("div", {
103
113
  className: "simple-popover__content",
104
- children: y
114
+ children: b
105
115
  })]
106
116
  });
107
- return C(F, document.body);
117
+ return T(I, document.body);
108
118
  };
109
119
  export {
110
- B as Popover
120
+ q as Popover
111
121
  };
@@ -23,7 +23,7 @@ var r = (i) => {
23
23
  const o = {
24
24
  ...i,
25
25
  lib: d,
26
- libBuildNumber: 633,
26
+ libBuildNumber: 635,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
- var I = "3.28.1", B = 633, L = "a03a4fe", _ = "2026-11-04T17:35:49.993Z", a = "633";
1
+ var I = "3.28.2", B = 635, L = "699cf06", _ = "2026-11-04T21:37:23.925Z", r = "635";
2
2
  export {
3
3
  _ as LIB_BUILD_DATE,
4
- a as LIB_BUILD_ID,
4
+ r as LIB_BUILD_ID,
5
5
  B as LIB_BUILD_NUMBER,
6
6
  L as LIB_COMMIT,
7
7
  I as LIB_VERSION
package/dist/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "3.28.1",
3
- "buildNumber": 633,
4
- "commit": "a03a4fe",
5
- "buildDate": "2026-11-04T17:35:49.993Z"
2
+ "version": "3.28.2",
3
+ "buildNumber": 635,
4
+ "commit": "699cf06",
5
+ "buildDate": "2026-11-04T21:37:23.925Z"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memobit/libs",
3
- "version": "3.28.1",
3
+ "version": "3.28.2",
4
4
  "description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
5
5
  "keywords": [
6
6
  "react",