@memobit/libs 3.4.3 → 3.6.0

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.
Files changed (60) hide show
  1. package/dist/components/AngleSlider/AngleSlider2.js +27 -27
  2. package/dist/components/AppHeader/AppHeader2.js +39 -36
  3. package/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +48 -52
  4. package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +64 -65
  5. package/dist/components/Blockquote/Blockquote2.js +14 -14
  6. package/dist/components/BulkActionBar/BulkActionBar2.js +34 -30
  7. package/dist/components/Calendar/Calendar2.js +10 -8
  8. package/dist/components/Card/Card.css +1 -1
  9. package/dist/components/Confetti/Confetti2.js +2 -3
  10. package/dist/components/ControlPanel/ControlPanelFilter.js +26 -26
  11. package/dist/components/DataView/DataView.CardView.js +8 -4
  12. package/dist/components/DataView/DataView.ColumnSelector.js +24 -21
  13. package/dist/components/DataView/DataView.MiniSort.js +18 -16
  14. package/dist/components/DataView/DataView2.js +90 -86
  15. package/dist/components/DiffViewer/DiffViewer2.js +124 -118
  16. package/dist/components/Dropdown/Dropdown2.js +0 -3
  17. package/dist/components/EventCalendar/EventCalendar.Chip.js +21 -21
  18. package/dist/components/EventCalendar/EventCalendar.Month.js +19 -19
  19. package/dist/components/FloatingWindow/FloatingWindow2.js +60 -60
  20. package/dist/components/Grid/Grid2.js +18 -18
  21. package/dist/components/InputPIN/InputPIN2.js +42 -42
  22. package/dist/components/MiniSort/MiniSort2.js +47 -43
  23. package/dist/components/MiniStatsCard/MiniStatsCard2.js +20 -20
  24. package/dist/components/Pagination/Pagination2.js +18 -18
  25. package/dist/components/Popover/Popover2.js +23 -21
  26. package/dist/components/ProtectedRoute/ProtectedRoute.css +1 -0
  27. package/dist/components/ProtectedRoute/ProtectedRoute2.js +19 -0
  28. package/dist/components/RangeSlider/RangeSlider2.js +25 -25
  29. package/dist/components/Rating/RatingIcon.js +9 -9
  30. package/dist/components/RichTextEditor/hooks/useLinkPrompt.js +7 -6
  31. package/dist/components/RollingNumber/RollingNumber2.js +33 -31
  32. package/dist/components/Separator/Separator2.js +27 -23
  33. package/dist/components/Skeleton/Skeleton2.js +6 -8
  34. package/dist/components/Slider/Slider2.js +32 -32
  35. package/dist/components/Splitter/Splitter2.js +34 -34
  36. package/dist/components/StackedBar/StackedBar2.js +36 -34
  37. package/dist/components/Stats/Stats2.js +20 -16
  38. package/dist/components/StickyBar/StickyBar2.js +26 -22
  39. package/dist/components/Timeline/Timeline2.js +53 -47
  40. package/dist/components/Tooltip/Tooltip2.js +7 -8
  41. package/dist/components/TourHud/TourHud2.js +20 -20
  42. package/dist/components/Transition/Transition2.js +20 -20
  43. package/dist/components/Tree/Tree2.js +23 -23
  44. package/dist/contexts/AuthContext/AuthContext.js +33 -32
  45. package/dist/helpers/Charts.js +18 -0
  46. package/dist/helpers/Http.js +102 -0
  47. package/dist/helpers/Images.js +19 -0
  48. package/dist/helpers/Numbers.js +5 -4
  49. package/dist/helpers/VersionInfo.js +1 -1
  50. package/dist/hooks/useAccountMenu.js +58 -0
  51. package/dist/http.d.ts +97 -0
  52. package/dist/http.js +14 -0
  53. package/dist/index.d.ts +152 -5
  54. package/dist/index.js +334 -309
  55. package/dist/node_modules/qrcode.react/lib/esm/index.js +2 -2
  56. package/dist/router.d.ts +18 -0
  57. package/dist/router.js +4 -0
  58. package/dist/version.js +2 -2
  59. package/dist/version.json +4 -4
  60. package/package.json +38 -23
@@ -1,11 +1,11 @@
1
1
  import './AngleSlider.css';
2
2
  /* empty css */
3
- import { useCallback as c, useMemo as G, useRef as A } from "react";
3
+ import { useCallback as c, useMemo as L, useRef as A } from "react";
4
4
  import { jsx as f, jsxs as m } from "react/jsx-runtime";
5
- var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180, N = (e, h) => ({
6
- x: o + h * Math.sin($(e)),
7
- y: o - h * Math.cos($(e))
8
- }), q = ({ disabled: e = !1, label: h, max: i = D, min: a = 0, onChange: u, size: j = 120, step: l = 1, tickStep: p = 45, keyboardStep: w, showValue: T = !0, value: y, variant: B = "accent" }) => {
5
+ var y = 42, o = 50, U = 2 * Math.PI * y, D = 360, $ = (e) => e * Math.PI / 180, w = (e, d) => ({
6
+ x: o + d * Math.sin($(e)),
7
+ y: o - d * Math.cos($(e))
8
+ }), J = ({ disabled: e = !1, label: d, max: i = D, min: a = 0, onChange: u, size: j = 120, step: l = 1, tickStep: h = 45, keyboardStep: N, showValue: T = !0, value: p, variant: B = "accent" }) => {
9
9
  const R = A(null), g = A(!1), P = Math.max(1, i - a), _ = c((r) => {
10
10
  const n = l > 0 ? Math.round(r / l) * l : r;
11
11
  return Math.min(i, Math.max(a, n));
@@ -33,7 +33,7 @@ var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180,
33
33
  g.current && (r.currentTarget.releasePointerCapture(r.pointerId), g.current = !1);
34
34
  }, []), X = c((r) => {
35
35
  if (e) return;
36
- const n = w ?? (l > 0 ? l : 1), t = r.key === "PageUp" ? n * 10 : r.key === "PageDown" ? -n * 10 : 0, s = r.key === "ArrowRight" || r.key === "ArrowUp" ? n : r.key === "ArrowLeft" || r.key === "ArrowDown" ? -n : 0;
36
+ const n = N ?? (l > 0 ? l : 1), t = r.key === "PageUp" ? n * 10 : r.key === "PageDown" ? -n * 10 : 0, s = r.key === "ArrowRight" || r.key === "ArrowUp" ? n : r.key === "ArrowLeft" || r.key === "ArrowDown" ? -n : 0;
37
37
  if (r.key === "Home") {
38
38
  r.preventDefault(), u(a);
39
39
  return;
@@ -42,33 +42,33 @@ var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180,
42
42
  r.preventDefault(), u(i);
43
43
  return;
44
44
  }
45
- t === 0 && s === 0 || (r.preventDefault(), u(_(y + t + s)));
45
+ t === 0 && s === 0 || (r.preventDefault(), u(_(p + t + s)));
46
46
  }, [
47
47
  _,
48
48
  e,
49
- w,
49
+ N,
50
50
  i,
51
51
  a,
52
52
  u,
53
53
  l,
54
- y
55
- ]), Y = G(() => {
56
- if (!p || p <= 0) return [];
54
+ p
55
+ ]), Y = L(() => {
56
+ if (!h || h <= 0) return [];
57
57
  const r = [];
58
- for (let n = a; n < a + P; n += p) r.push(n);
58
+ for (let n = a; n < a + P; n += h) r.push(n);
59
59
  return r;
60
60
  }, [
61
61
  a,
62
62
  P,
63
- p
64
- ]), z = (Math.min(i, Math.max(a, y)) - a) / P, M = N(y, d);
63
+ h
64
+ ]), z = (Math.min(i, Math.max(a, p)) - a) / P, M = w(p, y), G = [
65
+ "angle-slider",
66
+ `angle-slider--${B}`,
67
+ e ? "angle-slider--disabled" : ""
68
+ ].filter(Boolean).join(" "), H = { "--_angle-size": `${j}px` };
65
69
  return /* @__PURE__ */ m("div", {
66
- className: [
67
- "angle-slider",
68
- `angle-slider--${B}`,
69
- e ? "angle-slider--disabled" : ""
70
- ].filter(Boolean).join(" "),
71
- style: { "--_angle-size": `${j}px` },
70
+ className: G,
71
+ style: H,
72
72
  children: [
73
73
  /* @__PURE__ */ m("svg", {
74
74
  className: "angle-slider__dial",
@@ -84,10 +84,10 @@ var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180,
84
84
  className: "angle-slider__track",
85
85
  cx: o,
86
86
  cy: o,
87
- r: d
87
+ r: y
88
88
  }),
89
89
  Y.map((r) => {
90
- const n = N(r, d), t = N(r, d - 6);
90
+ const n = w(r, y), t = w(r, 36);
91
91
  return /* @__PURE__ */ f("line", {
92
92
  className: "angle-slider__tick",
93
93
  x1: t.x,
@@ -100,7 +100,7 @@ var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180,
100
100
  className: "angle-slider__progress",
101
101
  cx: o,
102
102
  cy: o,
103
- r: d,
103
+ r: y,
104
104
  strokeDasharray: `${U * z} ${U}`,
105
105
  transform: `rotate(-90 ${o} ${o})`
106
106
  }),
@@ -121,15 +121,15 @@ var d = 42, o = 50, U = 2 * Math.PI * d, D = 360, $ = (e) => e * Math.PI / 180,
121
121
  }),
122
122
  T && /* @__PURE__ */ m("span", {
123
123
  className: "angle-slider__value",
124
- children: [Math.round(y), "°"]
124
+ children: [Math.round(p), "°"]
125
125
  }),
126
- h && /* @__PURE__ */ f("span", {
126
+ d && /* @__PURE__ */ f("span", {
127
127
  className: "angle-slider__label",
128
- children: h
128
+ children: d
129
129
  })
130
130
  ]
131
131
  });
132
132
  };
133
133
  export {
134
- q as AngleSlider
134
+ J as AngleSlider
135
135
  };
@@ -1,44 +1,47 @@
1
1
  import './AppHeader.css';
2
- import { Icon as m } from "../Icon/Icon2.js";
3
- import { Separator as h } from "../Separator/Separator2.js";
2
+ import { Icon as h } from "../Icon/Icon2.js";
3
+ import { Separator as o } from "../Separator/Separator2.js";
4
4
  /* empty css */
5
5
  import "react";
6
- import { Fragment as o, jsx as a, jsxs as e } from "react/jsx-runtime";
7
- var u = ({ emoji: r, icon: p, svg: s, appName: c, heading: n, onClick: d, className: l = "", showSeparator: i = !0 }) => /* @__PURE__ */ e(o, { children: [/* @__PURE__ */ e("div", {
8
- className: [
6
+ import { Fragment as t, jsx as a, jsxs as e } from "react/jsx-runtime";
7
+ var v = ({ emoji: r, icon: p, svg: s, appName: c, heading: n, onClick: d, className: l = "", showSeparator: m = !0 }) => {
8
+ const i = [
9
9
  "app-header",
10
10
  d ? "app-header--clickable" : "",
11
11
  l
12
- ].filter(Boolean).join(" "),
13
- onClick: d,
14
- children: [
15
- r && /* @__PURE__ */ a("span", {
16
- className: "app-header__icon",
17
- children: r
18
- }),
19
- s && /* @__PURE__ */ a("span", {
20
- className: "app-header__icon",
21
- children: s
22
- }),
23
- p && /* @__PURE__ */ a("span", {
24
- className: "app-header__icon",
25
- children: /* @__PURE__ */ a(m, { name: p })
26
- }),
27
- /* @__PURE__ */ e("div", {
28
- className: "app-header__copy",
29
- children: [c && /* @__PURE__ */ a("span", {
30
- className: "app-header__app-name",
31
- children: c
32
- }), n && /* @__PURE__ */ a("span", {
33
- className: "app-header__headline",
34
- children: n
35
- })]
36
- })
37
- ]
38
- }), i && /* @__PURE__ */ a(h, {
39
- className: "app-header__separator",
40
- spacing: 0
41
- })] });
12
+ ].filter(Boolean).join(" ");
13
+ return /* @__PURE__ */ e(t, { children: [/* @__PURE__ */ e("div", {
14
+ className: i,
15
+ onClick: d,
16
+ children: [
17
+ r && /* @__PURE__ */ a("span", {
18
+ className: "app-header__icon",
19
+ children: r
20
+ }),
21
+ s && /* @__PURE__ */ a("span", {
22
+ className: "app-header__icon",
23
+ children: s
24
+ }),
25
+ p && /* @__PURE__ */ a("span", {
26
+ className: "app-header__icon",
27
+ children: /* @__PURE__ */ a(h, { name: p })
28
+ }),
29
+ /* @__PURE__ */ e("div", {
30
+ className: "app-header__copy",
31
+ children: [c && /* @__PURE__ */ a("span", {
32
+ className: "app-header__app-name",
33
+ children: c
34
+ }), n && /* @__PURE__ */ a("span", {
35
+ className: "app-header__headline",
36
+ children: n
37
+ })]
38
+ })
39
+ ]
40
+ }), m && /* @__PURE__ */ a(o, {
41
+ className: "app-header__separator",
42
+ spacing: 0
43
+ })] });
44
+ };
42
45
  export {
43
- u as AppHeader
46
+ v as AppHeader
44
47
  };
@@ -1,122 +1,118 @@
1
1
  import './ChangePasswordModal.css';
2
- import { Modal as k } from "../../Modal/Modal2.js";
3
- import { InputPassword as m } from "../../InputPassword/InputPassword2.js";
4
- import { Toast as T } from "../../Toast/Toast2.js";
2
+ import { Modal as y } from "../../Modal/Modal2.js";
3
+ import { InputPassword as h } from "../../InputPassword/InputPassword2.js";
4
+ import { Toast as v } from "../../Toast/Toast2.js";
5
+ import { HttpMethod as C, buildRequestHeaders as E, readErrorMessage as x } from "../../../helpers/Http.js";
5
6
  import { useAuth as F } from "../../../hooks/useAuth/useAuth.js";
6
7
  /* empty css */
7
- import { useEffect as E, useState as o } from "react";
8
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
9
- function U({ isOpen: l, onClose: c }) {
10
- const { config: b } = F(), [i, u] = o(""), [n, f] = o(""), [w, p] = o(""), [g, a] = o(""), [r, C] = o(!1), [h, P] = o(null);
11
- E(() => {
12
- l && (u(""), f(""), p(""), a(""));
13
- }, [l]);
14
- const y = async () => {
15
- if (!i || !n || !w) {
8
+ import { useEffect as k, useState as o } from "react";
9
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
10
+ function z({ isOpen: n, onClose: l }) {
11
+ const { config: b } = F(), [i, m] = o(""), [d, u] = o(""), [c, f] = o(""), [g, a] = o(""), [r, p] = o(!1), [w, P] = o(null);
12
+ k(() => {
13
+ n && (m(""), u(""), f(""), a(""));
14
+ }, [n]);
15
+ const N = async () => {
16
+ if (!i || !d || !c) {
16
17
  a("All fields are required");
17
18
  return;
18
19
  }
19
- if (n !== w) {
20
+ if (d !== c) {
20
21
  a("New passwords do not match");
21
22
  return;
22
23
  }
23
- if (n.length < 8) {
24
+ if (d.length < 8) {
24
25
  a("New password must be at least 8 characters long");
25
26
  return;
26
27
  }
27
- C(!0), a("");
28
+ p(!0), a("");
28
29
  try {
29
- const s = document.cookie.match(/(?:^|;\s*)csrf_token=([^;]+)/), t = s ? decodeURIComponent(s[1]) : null, _ = { "Content-Type": "application/json" };
30
- t && (_["X-CSRF-Token"] = t);
31
- const N = await fetch(`${b.apiBaseUrl}/auth/changePassword`, {
32
- method: "POST",
30
+ const s = await fetch(`${b.apiBaseUrl}/auth/changePassword`, {
31
+ method: C.Post,
33
32
  credentials: "include",
34
- headers: _,
33
+ headers: E(C.Post),
35
34
  body: JSON.stringify({
36
35
  currentPassword: i,
37
- newPassword: n
36
+ newPassword: d
38
37
  })
39
38
  });
40
- if (!N.ok) {
41
- const v = await N.json();
42
- throw new Error(v.error || "Failed to change password");
43
- }
39
+ if (!s.ok) throw new Error(await x(s));
44
40
  P({
45
41
  message: "Password changed successfully!",
46
42
  type: "success"
47
43
  }), setTimeout(() => {
48
- c();
44
+ l();
49
45
  }, 2e3);
50
46
  } catch (s) {
51
- const t = s instanceof Error ? s.message : "Failed to change password";
52
- a(t);
47
+ const M = s instanceof Error ? s.message : "Failed to change password";
48
+ a(M);
53
49
  } finally {
54
- C(!1);
50
+ p(!1);
55
51
  }
56
- }, M = () => {
52
+ }, _ = () => {
57
53
  P(null);
58
54
  };
59
- return /* @__PURE__ */ d(k, {
60
- isOpen: l,
61
- onClose: c,
55
+ return /* @__PURE__ */ t(y, {
56
+ isOpen: n,
57
+ onClose: l,
62
58
  title: "Change Password",
63
59
  size: "medium",
64
60
  primary: {
65
61
  text: r ? "Changing..." : "Change Password",
66
- onClick: y,
62
+ onClick: N,
67
63
  icon: "lock",
68
64
  variant: "success",
69
65
  disabled: r
70
66
  },
71
67
  secondary: {
72
68
  text: "Cancel",
73
- onClick: c,
69
+ onClick: l,
74
70
  icon: "clear",
75
71
  variant: "default",
76
72
  disabled: r
77
73
  },
78
- children: [/* @__PURE__ */ d("div", {
74
+ children: [/* @__PURE__ */ t("div", {
79
75
  className: "ChangePasswordModal",
80
76
  children: [
81
- /* @__PURE__ */ d("div", {
77
+ /* @__PURE__ */ t("div", {
82
78
  className: "ChangePasswordModal__field",
83
79
  children: [/* @__PURE__ */ e("label", {
84
80
  htmlFor: "current-password",
85
81
  className: "ChangePasswordModal__label",
86
82
  children: "Current Password"
87
- }), /* @__PURE__ */ e(m, {
83
+ }), /* @__PURE__ */ e(h, {
88
84
  id: "current-password",
89
85
  value: i,
90
- onChange: (s) => u(s),
86
+ onChange: (s) => m(s),
91
87
  placeholder: "Enter current password",
92
88
  disabled: r,
93
89
  autoFocus: !0
94
90
  })]
95
91
  }),
96
- /* @__PURE__ */ d("div", {
92
+ /* @__PURE__ */ t("div", {
97
93
  className: "ChangePasswordModal__field",
98
94
  children: [/* @__PURE__ */ e("label", {
99
95
  htmlFor: "new-password",
100
96
  className: "ChangePasswordModal__label",
101
97
  children: "New Password"
102
- }), /* @__PURE__ */ e(m, {
98
+ }), /* @__PURE__ */ e(h, {
103
99
  id: "new-password",
104
- value: n,
105
- onChange: (s) => f(s),
100
+ value: d,
101
+ onChange: (s) => u(s),
106
102
  placeholder: "Enter new password",
107
103
  disabled: r
108
104
  })]
109
105
  }),
110
- /* @__PURE__ */ d("div", {
106
+ /* @__PURE__ */ t("div", {
111
107
  className: "ChangePasswordModal__field",
112
108
  children: [/* @__PURE__ */ e("label", {
113
109
  htmlFor: "confirm-password",
114
110
  className: "ChangePasswordModal__label",
115
111
  children: "Confirm New Password"
116
- }), /* @__PURE__ */ e(m, {
112
+ }), /* @__PURE__ */ e(h, {
117
113
  id: "confirm-password",
118
- value: w,
119
- onChange: (s) => p(s),
114
+ value: c,
115
+ onChange: (s) => f(s),
120
116
  placeholder: "Confirm new password",
121
117
  disabled: r
122
118
  })]
@@ -126,13 +122,13 @@ function U({ isOpen: l, onClose: c }) {
126
122
  children: g
127
123
  })
128
124
  ]
129
- }), h && /* @__PURE__ */ e(T, {
130
- message: h.message,
131
- type: h.type,
132
- onClose: M
125
+ }), w && /* @__PURE__ */ e(v, {
126
+ message: w.message,
127
+ type: w.type,
128
+ onClose: _
133
129
  })]
134
130
  });
135
131
  }
136
132
  export {
137
- U as ChangePasswordModal
133
+ z as ChangePasswordModal
138
134
  };