@memobit/libs 3.28.0 → 3.28.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.
@@ -1,108 +1,114 @@
1
1
  import './Tooltip.css';
2
2
  /* empty css */
3
- import { createContext as U, useCallback as F, useContext as W, useEffect as C, useRef as d, useState as M } from "react";
4
- import { Fragment as X, jsx as $, jsxs as I } from "react/jsx-runtime";
5
- import { createPortal as Y } from "react-dom";
6
- var j = U(null), re = ({ title: y, position: h = "top", delay: z = 200, children: V, disabled: E = !1, className: O = "", maxWidth: p, maxHeight: a }) => {
7
- const [g, u] = M(!1), [D, q] = M(0), w = W(j), [x, A] = M({
3
+ import { createContext as H, useCallback as F, useContext as tt, useEffect as C, useRef as w, useState as P } from "react";
4
+ import { Fragment as et, jsx as x, jsxs as V } from "react/jsx-runtime";
5
+ import { createPortal as rt } from "react-dom";
6
+ var j = H(null), lt = ({ title: y, position: c = "top", delay: z = 200, children: q, disabled: E = !1, className: A = "", maxWidth: p, maxHeight: f }) => {
7
+ const [g, u] = P(!1), [D, G] = P(0), m = tt(j), [d, J] = P({
8
8
  top: 0,
9
9
  left: 0
10
- }), c = d(null), n = d(null), l = d(null), f = d(null), m = d(!1), v = a !== void 0, b = v ? 150 : 0, B = !!y && !E, L = g && B && D === 0, N = g && B || D > 0, G = F((t) => {
11
- q((e) => Math.max(0, e + (t ? 1 : -1)));
10
+ }), s = w(null), n = w(null), a = w(null), h = w(null), v = w(!1), T = f !== void 0, M = T ? 150 : 0, B = !!y && !E, $ = g && B && D === 0, N = g && B || D > 0, K = F((e) => {
11
+ G((t) => Math.max(0, t + (e ? 1 : -1)));
12
12
  }, []);
13
13
  C(() => {
14
- if (!(!w || !N))
15
- return w(!0), () => w(!1);
16
- }, [N, w]);
17
- const T = F(() => {
18
- if (!l.current || !f.current) return;
19
- const t = l.current.firstElementChild?.getBoundingClientRect();
20
- let e = t && t.width > 0 ? t : l.current.getBoundingClientRect();
21
- if (e.width === 0 && e.height === 0) {
14
+ if (!(!m || !N))
15
+ return m(!0), () => m(!1);
16
+ }, [N, m]);
17
+ const R = F(() => {
18
+ if (!a.current || !h.current) return;
19
+ const e = a.current.firstElementChild?.getBoundingClientRect();
20
+ let t = e && e.width > 0 ? e : a.current.getBoundingClientRect();
21
+ if (t.width === 0 && t.height === 0) {
22
22
  const _ = document.createRange();
23
- _.selectNodeContents(l.current);
24
- const P = _.getBoundingClientRect();
25
- (P.width > 0 || P.height > 0) && (e = P);
23
+ _.selectNodeContents(a.current);
24
+ const L = _.getBoundingClientRect();
25
+ (L.width > 0 || L.height > 0) && (t = L);
26
26
  }
27
- const r = f.current.getBoundingClientRect(), R = 8;
27
+ const r = h.current.getBoundingClientRect(), b = 8;
28
28
  let o = 0, i = 0;
29
- switch (h) {
29
+ switch (c) {
30
30
  case "top":
31
- o = e.top - r.height - R, i = e.left + e.width / 2 - r.width / 2;
31
+ o = t.top - r.height - b, i = t.left + t.width / 2 - r.width / 2;
32
32
  break;
33
33
  case "bottom":
34
- o = e.bottom + R, i = e.left + e.width / 2 - r.width / 2;
34
+ o = t.bottom + b, i = t.left + t.width / 2 - r.width / 2;
35
35
  break;
36
36
  case "left":
37
- o = e.top + e.height / 2 - r.height / 2, i = e.left - r.width - R;
37
+ o = t.top + t.height / 2 - r.height / 2, i = t.left - r.width - b;
38
38
  break;
39
39
  case "right":
40
- o = e.top + e.height / 2 - r.height / 2, i = e.right + R;
40
+ o = t.top + t.height / 2 - r.height / 2, i = t.right + b;
41
41
  }
42
- const s = 8;
43
- i < s && (i = s), i + r.width > window.innerWidth - s && (i = window.innerWidth - r.width - s), o < s && (o = s), o + r.height > window.innerHeight - s && (o = window.innerHeight - r.height - s), A({
42
+ const l = 8;
43
+ i < l && (i = l), i + r.width > window.innerWidth - l && (i = window.innerWidth - r.width - l), o < l && (o = l), o + r.height > window.innerHeight - l && (o = window.innerHeight - r.height - l);
44
+ const k = 12, I = c === "top" || c === "bottom", X = I ? t.left + t.width / 2 - i : t.top + t.height / 2 - o, Y = I ? r.width : r.height, Z = Math.min(Math.max(X, k), Y - k);
45
+ J({
44
46
  top: o,
45
- left: i
47
+ left: i,
48
+ arrowOffset: Z
46
49
  });
47
- }, [h]), S = () => {
48
- E || m.current || (n.current && (clearTimeout(n.current), n.current = null), c.current = setTimeout(() => {
50
+ }, [c]), S = () => {
51
+ E || v.current || (n.current && (clearTimeout(n.current), n.current = null), s.current = setTimeout(() => {
49
52
  u(!0);
50
53
  }, z));
51
- }, k = () => {
52
- m.current || (c.current && clearTimeout(c.current), b > 0 ? n.current = setTimeout(() => u(!1), b) : u(!1));
53
- }, J = (t) => {
54
- t.pointerType !== "touch" && t.pointerType !== "pen" || E || (m.current = !0, c.current && (clearTimeout(c.current), c.current = null), t.stopPropagation(), u((e) => !e));
54
+ }, O = () => {
55
+ v.current || (s.current && clearTimeout(s.current), M > 0 ? n.current = setTimeout(() => u(!1), M) : u(!1));
56
+ }, Q = (e) => {
57
+ e.pointerType !== "touch" && e.pointerType !== "pen" || E || (v.current = !0, s.current && (clearTimeout(s.current), s.current = null), e.stopPropagation(), u((t) => !t));
55
58
  };
56
59
  C(() => {
57
- if (!L) return;
58
- const t = (e) => {
59
- e.target instanceof Node && f.current?.contains(e.target) || u(!1);
60
+ if (!$) return;
61
+ const e = (t) => {
62
+ t.target instanceof Node && h.current?.contains(t.target) || u(!1);
60
63
  };
61
- return T(), window.addEventListener("scroll", t, !0), window.addEventListener("resize", T), () => {
62
- window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", T);
64
+ return R(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", R), () => {
65
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", R);
63
66
  };
64
- }, [L, T]), C(() => {
67
+ }, [$, R]), C(() => {
65
68
  if (!g) return;
66
- const t = (e) => {
67
- l.current?.contains(e.target) || f.current?.contains(e.target) || u(!1);
69
+ const e = (t) => {
70
+ a.current?.contains(t.target) || h.current?.contains(t.target) || u(!1);
68
71
  };
69
- return document.addEventListener("pointerdown", t), () => {
70
- document.removeEventListener("pointerdown", t), m.current = !1;
72
+ return document.addEventListener("pointerdown", e), () => {
73
+ document.removeEventListener("pointerdown", e), v.current = !1;
71
74
  };
72
75
  }, [g]), C(() => () => {
73
- c.current && clearTimeout(c.current), n.current && clearTimeout(n.current);
76
+ s.current && clearTimeout(s.current), n.current && clearTimeout(n.current);
74
77
  }, []);
75
- const K = () => {
76
- v && n.current && (clearTimeout(n.current), n.current = null);
77
- }, Q = () => {
78
- v && (n.current = setTimeout(() => u(!1), b));
78
+ const U = () => {
79
+ T && n.current && (clearTimeout(n.current), n.current = null);
80
+ }, W = () => {
81
+ T && (n.current = setTimeout(() => u(!1), M));
79
82
  };
80
- return /* @__PURE__ */ I(X, { children: [/* @__PURE__ */ $("span", {
81
- ref: l,
83
+ return /* @__PURE__ */ V(et, { children: [/* @__PURE__ */ x("span", {
84
+ ref: a,
82
85
  className: "tooltip-trigger",
83
86
  onMouseEnter: S,
84
- onMouseLeave: k,
87
+ onMouseLeave: O,
85
88
  onFocus: S,
86
- onBlur: k,
87
- onPointerDown: J,
88
- children: /* @__PURE__ */ $(j.Provider, {
89
- value: G,
90
- children: V
89
+ onBlur: O,
90
+ onPointerDown: Q,
91
+ children: /* @__PURE__ */ x(j.Provider, {
92
+ value: K,
93
+ children: q
91
94
  })
92
- }), L && Y(/* @__PURE__ */ I("div", {
93
- ref: f,
94
- className: `tooltip tooltip--${h} ${v ? "tooltip--scrollable" : ""} ${O}`,
95
+ }), $ && rt(/* @__PURE__ */ V("div", {
96
+ ref: h,
97
+ className: `tooltip tooltip--${c} ${T ? "tooltip--scrollable" : ""} ${A}`,
95
98
  style: {
96
- top: `${x.top}px`,
97
- left: `${x.left}px`,
99
+ top: `${d.top}px`,
100
+ left: `${d.left}px`,
98
101
  ...p !== void 0 && { maxWidth: typeof p == "number" ? `${p}px` : p },
99
- ...a !== void 0 && { maxHeight: typeof a == "number" ? `${a}px` : a }
102
+ ...f !== void 0 && { maxHeight: typeof f == "number" ? `${f}px` : f }
100
103
  },
101
- onMouseEnter: K,
102
- onMouseLeave: Q,
103
- children: [y, /* @__PURE__ */ $("div", { className: `tooltip__arrow tooltip__arrow--${h}` })]
104
+ onMouseEnter: U,
105
+ onMouseLeave: W,
106
+ children: [y, /* @__PURE__ */ x("div", {
107
+ className: `tooltip__arrow tooltip__arrow--${c}`,
108
+ style: d.arrowOffset === void 0 ? void 0 : c === "top" || c === "bottom" ? { left: `${d.arrowOffset}px` } : { top: `${d.arrowOffset}px` }
109
+ })]
104
110
  }), document.body)] });
105
111
  };
106
112
  export {
107
- re as Tooltip
113
+ lt as Tooltip
108
114
  };
@@ -23,7 +23,7 @@ var r = (i) => {
23
23
  const o = {
24
24
  ...i,
25
25
  lib: d,
26
- libBuildNumber: 630,
26
+ libBuildNumber: 633,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
- var I = "3.28.0", B = 630, L = "26e4027", _ = "2026-11-04T04:07:49.215Z", r = "630";
1
+ var I = "3.28.1", B = 633, L = "a03a4fe", _ = "2026-11-04T17:35:49.993Z", a = "633";
2
2
  export {
3
3
  _ as LIB_BUILD_DATE,
4
- r as LIB_BUILD_ID,
4
+ a 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.0",
3
- "buildNumber": 630,
4
- "commit": "26e4027",
5
- "buildDate": "2026-11-04T04:07:49.215Z"
2
+ "version": "3.28.1",
3
+ "buildNumber": 633,
4
+ "commit": "a03a4fe",
5
+ "buildDate": "2026-11-04T17:35:49.993Z"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memobit/libs",
3
- "version": "3.28.0",
3
+ "version": "3.28.1",
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",
@@ -132,7 +132,7 @@
132
132
  "brace-expansion@1": "1.1.21",
133
133
  "brace-expansion@5": "5.0.12",
134
134
  "esbuild": "0.28.2",
135
- "fast-uri@3": "3.1.8",
135
+ "fast-uri@3": "3.1.9",
136
136
  "immutable": "5.1.9",
137
137
  "js-yaml": "4.3.2",
138
138
  "minimatch@10": "10.2.6",