@genai-fi/base 4.3.8 → 4.3.9

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,8 +1,8 @@
1
1
  import { jsxs as R, jsx as u } from "react/jsx-runtime";
2
- import { useState as w, useRef as g, useEffect as M } from "react";
2
+ import { useState as w, useRef as g, useEffect as p } from "react";
3
3
  import { C as V } from "../../Close-TS8H1lQg.js";
4
4
  import { IconButton as T } from "@mui/material";
5
- import '../../assets/SidePanel.css';const W = "_sidePanel_dklbs_1", Z = "_dark_dklbs_15", K = "_sidePanelHorizontal_dklbs_20", U = "_sidePanelVertical_dklbs_25", X = "_closed_dklbs_29", j = "_opening_dklbs_37", C = "_open_dklbs_37", F = "_resizer_dklbs_57", O = "_resizerHorizontal_dklbs_68", Y = "_resizerVertical_dklbs_77", G = "_noSelect_dklbs_85", q = "_resizerBar_dklbs_89", J = "_resizerDark_dklbs_100", Q = "_resizing_dklbs_115", ee = "_resizerHandle_dklbs_119", te = "_minimised_dklbs_152", ie = "_content_dklbs_234", ne = "_closeButton_dklbs_242", t = {
5
+ import '../../assets/SidePanel.css';const W = "_sidePanel_dklbs_1", Z = "_dark_dklbs_15", K = "_sidePanelHorizontal_dklbs_20", U = "_sidePanelVertical_dklbs_25", X = "_closed_dklbs_29", j = "_opening_dklbs_37", C = "_open_dklbs_37", F = "_resizer_dklbs_57", O = "_resizerHorizontal_dklbs_68", Y = "_resizerVertical_dklbs_77", G = "_noSelect_dklbs_85", q = "_resizerBar_dklbs_89", J = "_resizerDark_dklbs_100", Q = "_resizing_dklbs_115", ee = "_resizerHandle_dklbs_119", te = "_minimised_dklbs_152", ne = "_content_dklbs_234", ie = "_closeButton_dklbs_242", t = {
6
6
  sidePanel: W,
7
7
  dark: Z,
8
8
  sidePanelHorizontal: K,
@@ -19,61 +19,61 @@ import '../../assets/SidePanel.css';const W = "_sidePanel_dklbs_1", Z = "_dark_d
19
19
  resizing: Q,
20
20
  resizerHandle: ee,
21
21
  minimised: te,
22
- content: ie,
23
- closeButton: ne
24
- }, I = 30, $ = 300, p = Math.max($, Math.floor(window.innerWidth * 0.25)), l = "sidePanelWidth";
22
+ content: ne,
23
+ closeButton: ie
24
+ }, M = 30, $ = 300, I = Math.max($, Math.floor(window.innerWidth * 0.25)), l = "sidePanelWidth";
25
25
  function le({
26
26
  children: N,
27
27
  open: o,
28
28
  onClose: m,
29
29
  onOpen: E,
30
30
  closeLabel: A,
31
- position: n = "right",
31
+ position: i = "right",
32
32
  dark: P = !1
33
33
  }) {
34
- const [_, s] = w(o ? p : 0), S = g(null), [z, x] = w(!1), [b, H] = w(!1), [k, y] = w(!o), v = g(null), f = g(null), c = g(
35
- window.sessionStorage.getItem(l) ? Number(window.sessionStorage.getItem(l)) : p
34
+ const [_, s] = w(o ? I : 0), S = g(null), [z, x] = w(!1), [k, H] = w(!1), [b, y] = w(!o), v = g(null), f = g(null), c = g(
35
+ window.sessionStorage.getItem(l) ? Number(window.sessionStorage.getItem(l)) : I
36
36
  ), a = Math.max(
37
37
  $,
38
- Math.floor(n === "right" ? window.innerWidth * 0.9 : window.innerHeight * 0.9)
38
+ Math.floor(i === "right" ? window.innerWidth * 0.9 : window.innerHeight * 0.9)
39
39
  );
40
- M(() => {
40
+ p(() => {
41
41
  if (o)
42
42
  H(!0), y(!1), f.current = document.activeElement ? document.activeElement : null;
43
43
  else {
44
44
  s(0);
45
- const i = setTimeout(() => {
45
+ const n = setTimeout(() => {
46
46
  y(!0), f.current && document.contains(f.current) && f.current.focus();
47
47
  }, 300);
48
- return () => clearTimeout(i);
48
+ return () => clearTimeout(n);
49
49
  }
50
- }, [o]), M(() => {
51
- if (b) {
52
- v.current && v.current.focus(), s(c.current || p);
53
- const i = setTimeout(() => {
50
+ }, [o]), p(() => {
51
+ if (k) {
52
+ v.current && v.current.focus(), s(c.current || I);
53
+ const n = setTimeout(() => {
54
54
  H(!1);
55
55
  }, 300);
56
- return () => clearTimeout(i);
56
+ return () => clearTimeout(n);
57
57
  }
58
- }, [b]), M(() => {
58
+ }, [k]), p(() => {
59
59
  if (z) {
60
- let i = function(e) {
60
+ let n = function(e) {
61
61
  if (z && S.current) {
62
- const D = S.current.getBoundingClientRect(), B = n === "right" ? D.right - e.clientX : D.bottom - e.clientY, h = Math.max(Math.min(B, a), I);
62
+ const D = S.current.getBoundingClientRect(), B = i === "right" ? D.right - e.clientX : D.bottom - e.clientY, h = Math.max(Math.min(B, a), M);
63
63
  h - B > 10 ? s(0) : (c.current = h, s(h), window.sessionStorage.setItem(l, h.toString())), e.preventDefault();
64
64
  }
65
65
  }, r = function() {
66
66
  x(!1);
67
67
  };
68
- return window.addEventListener("pointermove", i, { passive: !1 }), window.addEventListener("pointerup", r), document.body.classList.add(t.noSelect), () => {
69
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", r), document.body.classList.remove(t.noSelect);
68
+ return window.addEventListener("pointermove", n, { passive: !1 }), window.addEventListener("pointerup", r), document.body.classList.add(t.noSelect), () => {
69
+ window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), document.body.classList.remove(t.noSelect);
70
70
  };
71
71
  }
72
- }, [z, n, a]);
73
- const d = _ === 0 || k, L = /* @__PURE__ */ R(
72
+ }, [z, i, a]);
73
+ const d = _ === 0 || b, L = /* @__PURE__ */ R(
74
74
  "div",
75
75
  {
76
- className: `${t.resizer} ${z ? t.resizing : ""} ${n === "right" ? t.resizerVertical : t.resizerHorizontal} ${P ? t.resizerDark : ""}`,
76
+ className: `${t.resizer} ${z ? t.resizing : ""} ${i === "right" ? t.resizerVertical : t.resizerHorizontal} ${P ? t.resizerDark : ""}`,
77
77
  onPointerDown: () => {
78
78
  x(!0), E && E();
79
79
  },
@@ -84,25 +84,25 @@ function le({
84
84
  {
85
85
  className: `${t.resizerHandle} ${d ? t.minimised : ""}`,
86
86
  role: "separator",
87
- "aria-orientation": n === "right" ? "vertical" : "horizontal",
87
+ "aria-orientation": i === "right" ? "vertical" : "horizontal",
88
88
  "aria-label": "Resize sidebar",
89
89
  tabIndex: 0,
90
90
  "aria-valuenow": _,
91
91
  "aria-valuemin": 0,
92
92
  "aria-valuemax": a,
93
93
  ref: v,
94
- onKeyDown: (i) => {
95
- n === "right" ? i.key === "ArrowRight" ? s((r) => {
94
+ onKeyDown: (n) => {
95
+ i === "right" ? n.key === "ArrowRight" ? s((r) => {
96
96
  const e = Math.min(a, Math.max(0, r - 50));
97
97
  return c.current = e, window.sessionStorage.setItem(l, e.toString()), e;
98
- }) : i.key === "ArrowLeft" && s((r) => {
99
- const e = Math.max(I, Math.min(a, r + 50));
98
+ }) : n.key === "ArrowLeft" && s((r) => {
99
+ const e = Math.max(M, Math.min(a, r + 50));
100
100
  return c.current = e, window.sessionStorage.setItem(l, e.toString()), e;
101
- }) : i.key === "ArrowDown" ? s((r) => {
101
+ }) : n.key === "ArrowDown" ? s((r) => {
102
102
  const e = Math.min(a, Math.max(0, r - 50));
103
103
  return c.current = e, window.sessionStorage.setItem(l, e.toString()), e;
104
- }) : i.key === "ArrowUp" && s((r) => {
105
- const e = Math.max(I, Math.min(a, r + 50));
104
+ }) : n.key === "ArrowUp" && s((r) => {
105
+ const e = Math.max(M, Math.min(a, r + 50));
106
106
  return c.current = e, window.sessionStorage.setItem(l, e.toString()), e;
107
107
  });
108
108
  }
@@ -114,23 +114,23 @@ function le({
114
114
  return /* @__PURE__ */ R(
115
115
  "aside",
116
116
  {
117
- className: `${t.sidePanel} ${o ? t.open : t.closed} ${b ? t.opening : ""} ${n === "right" ? t.sidePanelVertical : t.sidePanelHorizontal} ${P ? t.dark : ""}`,
118
- style: n === "right" ? {
117
+ className: `${t.sidePanel} ${o ? t.open : t.closed} ${k ? t.opening : ""} ${i === "right" ? t.sidePanelVertical : t.sidePanelHorizontal} ${P ? t.dark : ""}`,
118
+ style: i === "right" ? {
119
119
  width: d ? 0 : _,
120
- visibility: k ? "hidden" : void 0,
120
+ display: b ? "none" : void 0,
121
121
  flexBasis: d ? 0 : "unset"
122
122
  } : {
123
123
  height: d ? 0 : _,
124
- visibility: k ? "hidden" : void 0,
124
+ display: b ? "none" : void 0,
125
125
  flexBasis: d ? 0 : "unset"
126
126
  },
127
127
  ref: S,
128
128
  "aria-hidden": !o,
129
- onKeyDownCapture: (i) => {
130
- i.key === "Escape" && (i.stopPropagation(), m == null || m());
129
+ onKeyDownCapture: (n) => {
130
+ n.key === "Escape" && (n.stopPropagation(), m == null || m());
131
131
  },
132
132
  children: [
133
- (n === "right" || n === "bottom") && L,
133
+ (i === "right" || i === "bottom") && L,
134
134
  /* @__PURE__ */ u("div", { className: t.content, children: d ? null : N }),
135
135
  m && _ > 50 && /* @__PURE__ */ u("div", { className: t.closeButton, children: /* @__PURE__ */ u(
136
136
  T,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/base",
3
- "version": "4.3.8",
3
+ "version": "4.3.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",