@memobit/libs 3.26.4 → 3.28.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 (47) hide show
  1. package/dist/components/Banner/Banner2.js +15 -13
  2. package/dist/components/BoldText/BoldText.js +5 -0
  3. package/dist/components/Calendar/Calendar2.js +108 -135
  4. package/dist/components/ColorPicker/ColorPicker.css +1 -1
  5. package/dist/components/ColorPicker/ColorPicker2.js +114 -114
  6. package/dist/components/ConfirmDialog/ConfirmDialog2.js +13 -11
  7. package/dist/components/ConfirmPopover/ConfirmPopover2.js +26 -24
  8. package/dist/components/ContextMenu/ContextMenu2.js +46 -33
  9. package/dist/components/ControlPanel/ControlPanel2.js +95 -93
  10. package/dist/components/ControlPanel/ControlPanelFilter.js +205 -193
  11. package/dist/components/ControlPanel/ControlPanelOptions.js +190 -185
  12. package/dist/components/DataView/DataView.CardView.js +83 -81
  13. package/dist/components/DataView/DataView.ColumnSelector.js +27 -25
  14. package/dist/components/DataView/DataView.TableView.js +74 -72
  15. package/dist/components/DataView/DataView2.js +169 -167
  16. package/dist/components/DatePicker/DatePicker2.js +71 -69
  17. package/dist/components/Drawer/Drawer2.js +58 -55
  18. package/dist/components/Dropdown/Dropdown2.js +187 -189
  19. package/dist/components/InputDate/InputDate2.js +43 -41
  20. package/dist/components/InputSearch/InputSearch2.js +27 -25
  21. package/dist/components/MenuBar/MenuBar.css +1 -0
  22. package/dist/components/MenuBar/MenuBar2.js +46 -0
  23. package/dist/components/Modal/Modal2.js +49 -47
  24. package/dist/components/Pagination/Pagination2.js +44 -47
  25. package/dist/components/ScrollToTop/ScrollToTop2.js +18 -16
  26. package/dist/components/ThemeSettings/ThemeSettings2.js +131 -123
  27. package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +16 -12
  28. package/dist/components/Toast/Toast2.js +38 -33
  29. package/dist/components/ToolButton/ToolButton.css +1 -0
  30. package/dist/components/ToolButton/ToolButton2.js +36 -0
  31. package/dist/components/ToolPalette/ToolPalette.css +1 -0
  32. package/dist/components/ToolPalette/ToolPalette2.js +83 -0
  33. package/dist/components/Toolbar/Toolbar2.js +58 -56
  34. package/dist/contexts/LanguageContext/LanguageContext.context.js +9 -0
  35. package/dist/contexts/LanguageContext/LanguageContext.js +19 -0
  36. package/dist/contexts/LanguageContext/libMessages.js +240 -0
  37. package/dist/helpers/Datetime.js +84 -68
  38. package/dist/helpers/Language.js +8 -0
  39. package/dist/helpers/Pagination.js +5 -4
  40. package/dist/helpers/VersionInfo.js +1 -1
  41. package/dist/hooks/useLanguage.js +16 -0
  42. package/dist/index.d.ts +133 -6
  43. package/dist/index.js +417 -399
  44. package/dist/memobit-icons.json +4 -0
  45. package/dist/version.js +2 -2
  46. package/dist/version.json +4 -4
  47. package/package.json +1 -1
@@ -1,50 +1,52 @@
1
1
  import './DatePicker.css';
2
- import { Icon as H } from "../Icon/Icon2.js";
3
- import { Tooltip as E } from "../Tooltip/Tooltip2.js";
4
- import { APP_DATE_FORMAT as Z, formatDate as l } from "../../helpers/Datetime.js";
5
- import { Calendar as O } from "../Calendar/Calendar2.js";
6
- import { TimePicker as ee } from "../TimePicker/TimePicker2.js";
2
+ import { Icon as E } from "../Icon/Icon2.js";
3
+ import { libMessages as ee } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useLanguage as te, useMessages as ne } from "../../hooks/useLanguage.js";
5
+ import { Tooltip as L } from "../Tooltip/Tooltip2.js";
6
+ import { APP_DATE_FORMAT as re, formatDate as l } from "../../helpers/Datetime.js";
7
+ import { Calendar as ie } from "../Calendar/Calendar2.js";
8
+ import { TimePicker as oe } from "../TimePicker/TimePicker2.js";
7
9
  /* empty css */
8
- import { useCallback as te, useEffect as x, useRef as L, useState as D } from "react";
9
- import { Fragment as ne, jsx as r, jsxs as h } from "react/jsx-runtime";
10
- import { createPortal as re } from "react-dom";
11
- var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFormat: M = "24h", withSeconds: w = !1, withClock: P = !1, clockSize: I = 208, minuteStep: z = 1, dateFormat: _ = Z, placeholder: F = "Select date...", disabled: b = !1, clearable: j = !0, autoClose: N = !0, alwaysOpen: i = !1, ...C }) => {
12
- const [B, u] = D(!1), [k, S] = D({
10
+ import { useCallback as se, useEffect as N, useRef as P, useState as b } from "react";
11
+ import { Fragment as ce, jsx as r, jsxs as h } from "react/jsx-runtime";
12
+ import { createPortal as ae } from "react-dom";
13
+ var Ce = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFormat: I = "24h", withSeconds: $ = !1, withClock: z = !1, clockSize: F = 208, minuteStep: j = 1, dateFormat: _ = re, placeholder: B, disabled: C = !1, clearable: q = !0, autoClose: v = !0, alwaysOpen: i = !1, ...R }) => {
14
+ const x = ne(ee), { language: k } = te(), [y, u] = b(!1), [D, A] = b({
13
15
  hours: 0,
14
16
  minutes: 0,
15
17
  seconds: 0
16
- }), [q, p] = D(null), [y, $] = D({
18
+ }), [W, m] = b(null), [G, H] = b({
17
19
  position: "fixed",
18
20
  visibility: "hidden"
19
- }), m = L(null), c = L(null);
20
- x(() => {
21
- f && t instanceof Date && S({
21
+ }), p = P(null), c = P(null);
22
+ N(() => {
23
+ f && t instanceof Date && A({
22
24
  hours: t.getHours(),
23
25
  minutes: t.getMinutes(),
24
26
  seconds: t.getSeconds()
25
27
  });
26
28
  }, [t, f]);
27
- const o = i ? !b : B;
28
- x(() => {
29
+ const o = i ? !C : y;
30
+ N(() => {
29
31
  if (i) return;
30
32
  const e = (n) => {
31
- o && m.current && c.current && !m.current.contains(n.target) && !c.current.contains(n.target) && (p(null), u(!1));
33
+ o && p.current && c.current && !p.current.contains(n.target) && !c.current.contains(n.target) && (m(null), u(!1));
32
34
  };
33
35
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
34
36
  }, [i, o]);
35
- const a = te(() => {
36
- if (i || !o || !m.current || !c.current) return;
37
- const e = m.current.getBoundingClientRect(), n = c.current.getBoundingClientRect(), d = 16, A = 8, T = window.innerHeight - e.bottom - d, U = e.top - d, V = T < n.height && U > n.height ? e.top - n.height - A : e.bottom + A, X = Math.max(d, Math.min(V, window.innerHeight - n.height - d)), Y = Math.max(d, Math.min(e.left, window.innerWidth - n.width - d));
38
- $({
37
+ const a = se(() => {
38
+ if (i || !o || !p.current || !c.current) return;
39
+ const e = p.current.getBoundingClientRect(), n = c.current.getBoundingClientRect(), d = 16, S = 8, V = window.innerHeight - e.bottom - d, X = e.top - d, Y = V < n.height && X > n.height ? e.top - n.height - S : e.bottom + S, Z = Math.max(d, Math.min(Y, window.innerHeight - n.height - d)), O = Math.max(d, Math.min(e.left, window.innerWidth - n.width - d));
40
+ H({
39
41
  position: "fixed",
40
- top: `${X}px`,
41
- left: `${Y}px`,
42
+ top: `${Z}px`,
43
+ left: `${O}px`,
42
44
  zIndex: 1100
43
45
  });
44
46
  }, [i, o]);
45
- x(() => {
47
+ N(() => {
46
48
  if (i || !o) {
47
- $({
49
+ H({
48
50
  position: "fixed",
49
51
  visibility: "hidden"
50
52
  });
@@ -61,93 +63,93 @@ var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFor
61
63
  o,
62
64
  a
63
65
  ]);
64
- const W = () => {
66
+ const J = () => {
65
67
  if (!t) return "";
66
68
  if (s === "single" && t instanceof Date) {
67
- const e = l(t, _);
68
- return f ? `${e} ${w ? l(t, "HH:mm:ss") : l(t, "HH:mm")}` : e;
69
+ const e = l(t, _, k);
70
+ return f ? `${e} ${$ ? l(t, "HH:mm:ss") : l(t, "HH:mm")}` : e;
69
71
  }
70
- return s === "range" && t && "start" in t ? `${l(t.start, _)} - ${l(t.end, _)}` : s === "multiple" && Array.isArray(t) ? t.map((e) => l(e, _)).join(", ") : "";
71
- }, G = (e) => {
72
+ return s === "range" && t && "start" in t ? `${l(t.start, _, k)} - ${l(t.end, _, k)}` : s === "multiple" && Array.isArray(t) ? t.map((e) => l(e, _, k)).join(", ") : "";
73
+ }, K = (e) => {
72
74
  if (!f || !(e instanceof Date)) {
73
- g?.(e), N && s !== "multiple" && !i && u(!1);
75
+ g?.(e), v && s !== "multiple" && !i && u(!1);
74
76
  return;
75
77
  }
76
78
  const n = new Date(e);
77
- n.setHours(k.hours, k.minutes, k.seconds), g?.(n), N && !i && u(!1);
78
- }, J = (e) => {
79
- if (S(e), !(t instanceof Date)) return;
79
+ n.setHours(D.hours, D.minutes, D.seconds), g?.(n), v && !i && u(!1);
80
+ }, Q = (e) => {
81
+ if (A(e), !(t instanceof Date)) return;
80
82
  const n = new Date(t);
81
83
  n.setHours(e.hours, e.minutes, e.seconds), g?.(n);
82
- }, K = (e) => {
83
- e.stopPropagation(), p(null), g?.(void 0);
84
- }, Q = () => {
85
- p(null), u(!1);
86
- }, R = W(), v = () => /* @__PURE__ */ h(ne, { children: [/* @__PURE__ */ r(O, {
87
- ...C,
84
+ }, T = (e) => {
85
+ e.stopPropagation(), m(null), g?.(void 0);
86
+ }, U = () => {
87
+ m(null), u(!1);
88
+ }, w = J(), M = () => /* @__PURE__ */ h(ce, { children: [/* @__PURE__ */ r(ie, {
89
+ ...R,
88
90
  mode: s,
89
91
  value: t,
90
- onChange: G,
91
- rangeStart: s === "range" ? q : C.rangeStart,
92
- onRangeStartChange: s === "range" ? p : C.onRangeStartChange
92
+ onChange: K,
93
+ rangeStart: s === "range" ? W : R.rangeStart,
94
+ onRangeStartChange: s === "range" ? m : R.onRangeStartChange
93
95
  }), f && s === "single" && t instanceof Date && /* @__PURE__ */ r("div", {
94
96
  className: "datepicker__time",
95
- children: /* @__PURE__ */ r(ee, {
96
- clockSize: I,
97
- format: M,
98
- minuteStep: z,
99
- onChange: J,
100
- value: k,
101
- withClock: P,
102
- withSeconds: w
97
+ children: /* @__PURE__ */ r(oe, {
98
+ clockSize: F,
99
+ format: I,
100
+ minuteStep: j,
101
+ onChange: Q,
102
+ value: D,
103
+ withClock: z,
104
+ withSeconds: $
103
105
  })
104
106
  })] });
105
107
  return /* @__PURE__ */ h("div", {
106
108
  className: "datepicker",
107
109
  children: [/* @__PURE__ */ h("div", {
108
- ref: m,
109
- className: `datepicker__input ${b ? "datepicker__input--disabled" : ""} ${o ? "datepicker__input--open" : ""}`,
110
+ ref: p,
111
+ className: `datepicker__input ${C ? "datepicker__input--disabled" : ""} ${o ? "datepicker__input--open" : ""}`,
110
112
  onClick: () => {
111
- b || i || (o && p(null), u(!o));
113
+ C || i || (o && m(null), u(!o));
112
114
  },
113
115
  children: [/* @__PURE__ */ r("span", {
114
- className: `datepicker__value ${R ? "" : "datepicker__value--placeholder"}`,
115
- children: R || F
116
+ className: `datepicker__value ${w ? "" : "datepicker__value--placeholder"}`,
117
+ children: w || (B ?? x.selectDate)
116
118
  }), /* @__PURE__ */ h("div", {
117
119
  className: "datepicker__actions",
118
- children: [j && R && /* @__PURE__ */ r(E, {
119
- title: "Clear",
120
+ children: [q && w && /* @__PURE__ */ r(L, {
121
+ title: x.clear,
120
122
  children: /* @__PURE__ */ r("button", {
121
123
  type: "button",
122
124
  className: "datepicker__clear",
123
- onClick: K,
125
+ onClick: T,
124
126
  children: "×"
125
127
  })
126
128
  }), /* @__PURE__ */ r("span", {
127
129
  className: "datepicker__icon",
128
- children: /* @__PURE__ */ r(H, { name: "calendar" })
130
+ children: /* @__PURE__ */ r(E, { name: "calendar" })
129
131
  })]
130
132
  })]
131
133
  }), o && (i ? /* @__PURE__ */ r("div", {
132
134
  ref: c,
133
135
  className: "datepicker__dropdown datepicker__dropdown--inline",
134
- children: v()
135
- }) : re(/* @__PURE__ */ h("div", {
136
+ children: M()
137
+ }) : ae(/* @__PURE__ */ h("div", {
136
138
  ref: c,
137
139
  className: "datepicker__dropdown",
138
- style: y,
139
- children: [/* @__PURE__ */ r(E, {
140
- title: "Close",
140
+ style: G,
141
+ children: [/* @__PURE__ */ r(L, {
142
+ title: x.close,
141
143
  children: /* @__PURE__ */ r("button", {
142
144
  type: "button",
143
145
  className: "datepicker__dropdown-close",
144
- onClick: Q,
145
- children: /* @__PURE__ */ r(H, { name: "clear" })
146
+ onClick: U,
147
+ children: /* @__PURE__ */ r(E, { name: "clear" })
146
148
  })
147
- }), v()]
149
+ }), M()]
148
150
  }), document.body))]
149
151
  });
150
152
  };
151
153
  export {
152
- me as DatePicker
154
+ Ce as DatePicker
153
155
  };
@@ -1,74 +1,77 @@
1
1
  import './Drawer.css';
2
2
  import { Icon as T } from "../Icon/Icon2.js";
3
- import { useBodyScrollLock as Z } from "../../hooks/useBodyScrollLock.js";
3
+ import { libMessages as Z } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useBodyScrollLock as V } from "../../hooks/useBodyScrollLock.js";
5
+ import { useMessages as W } from "../../hooks/useLanguage.js";
4
6
  import { Button as l } from "../Button/Button2.js";
5
- import { Tooltip as v } from "../Tooltip/Tooltip2.js";
7
+ import { Tooltip as u } from "../Tooltip/Tooltip2.js";
6
8
  /* empty css */
7
- import V, { useEffect as b, useState as W } from "react";
8
- import { Fragment as X, jsx as r, jsxs as i } from "react/jsx-runtime";
9
- var q = 1e3, N = 0, o = [], U = ({ isOpen: n, onClose: s, position: p = "left", width: g = "320px", maxWidth: C = "none", margin: I = 0, borderRadius: E = 0, shadow: z = "none", children: S, title: c, icon: m, className: j = "", showOverlay: D = !0, lockScroll: F = !0, hideClose: $ = !1, actions: _ = [], onBack: f, backLabel: B = "Back", primary: t, secondary: a, footer: h }) => {
10
- Z(n && F);
11
- const [w, L] = W(0);
12
- if (b(() => {
13
- if (!n) return;
14
- N += 1;
15
- const e = N;
16
- return L(e), o.push(e), () => {
17
- const d = o.indexOf(e);
18
- d !== -1 && o.splice(d, 1);
9
+ import X, { useEffect as N, useState as q } from "react";
10
+ import { Fragment as G, jsx as r, jsxs as d } from "react/jsx-runtime";
11
+ var H = 1e3, p = 0, s = [], re = ({ isOpen: i, onClose: o, position: g = "left", width: I = "320px", maxWidth: C = "none", margin: E = 0, borderRadius: z = 0, shadow: S = "none", children: D, title: c, icon: m, className: j = "", showOverlay: F = !0, lockScroll: $ = !0, hideClose: L = !1, actions: v = [], onBack: _, backLabel: R, primary: t, secondary: a, footer: h }) => {
12
+ const k = W(Z);
13
+ V(i && $);
14
+ const [w, A] = q(0);
15
+ if (N(() => {
16
+ if (!i) return;
17
+ p += 1;
18
+ const e = p;
19
+ return A(e), s.push(e), () => {
20
+ const n = s.indexOf(e);
21
+ n !== -1 && s.splice(n, 1);
19
22
  };
20
- }, [n]), b(() => {
21
- if (!n) return;
22
- const e = (d) => {
23
- d.key !== "Escape" || o[o.length - 1] !== w || s();
23
+ }, [i]), N(() => {
24
+ if (!i) return;
25
+ const e = (n) => {
26
+ n.key !== "Escape" || s[s.length - 1] !== w || o();
24
27
  };
25
28
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
26
29
  }, [
27
- n,
28
- s,
30
+ i,
31
+ o,
29
32
  w
30
- ]), !n) return null;
31
- const u = (e) => typeof e == "number" ? `${e}px` : e, k = q + w * 2, R = {
32
- "--drawer-width": g,
33
- "--drawer-max-width": u(C),
34
- "--drawer-margin": u(I),
35
- "--drawer-border-radius": u(E),
36
- "--drawer-shadow": z,
37
- zIndex: k + 1
38
- }, A = h || t || a;
39
- return /* @__PURE__ */ i(X, { children: [D && /* @__PURE__ */ r("div", {
33
+ ]), !i) return null;
34
+ const f = (e) => typeof e == "number" ? `${e}px` : e, x = H + w * 2, B = {
35
+ "--drawer-width": I,
36
+ "--drawer-max-width": f(C),
37
+ "--drawer-margin": f(E),
38
+ "--drawer-border-radius": f(z),
39
+ "--drawer-shadow": S,
40
+ zIndex: x + 1
41
+ }, M = h || t || a;
42
+ return /* @__PURE__ */ d(G, { children: [F && /* @__PURE__ */ r("div", {
40
43
  className: "drawer-overlay",
41
- onClick: s,
42
- style: { zIndex: k }
43
- }), /* @__PURE__ */ i("div", {
44
- className: `drawer drawer--${p} ${j}`,
45
- style: R,
44
+ onClick: o,
45
+ style: { zIndex: x }
46
+ }), /* @__PURE__ */ d("div", {
47
+ className: `drawer drawer--${g} ${j}`,
48
+ style: B,
46
49
  children: [
47
- /* @__PURE__ */ i("div", {
50
+ /* @__PURE__ */ d("div", {
48
51
  className: "drawer__header",
49
52
  children: [
50
- f && /* @__PURE__ */ r(v, {
51
- title: B,
53
+ _ && /* @__PURE__ */ r(u, {
54
+ title: R ?? k.back,
52
55
  position: "bottom",
53
56
  children: /* @__PURE__ */ r(l, {
54
57
  className: "drawer__back",
55
- onClick: f,
58
+ onClick: _,
56
59
  size: "small",
57
60
  variant: "ghost",
58
61
  icon: "arrow-left"
59
62
  })
60
63
  }),
61
- (c || m) && /* @__PURE__ */ i("h2", {
64
+ (c || m) && /* @__PURE__ */ d("h2", {
62
65
  className: "drawer__title",
63
66
  children: [m && /* @__PURE__ */ r(T, { name: m }), c && /* @__PURE__ */ r("span", {
64
67
  className: "drawer__title-text",
65
68
  children: c
66
69
  })]
67
70
  }),
68
- _.length > 0 && /* @__PURE__ */ r("div", {
71
+ v.length > 0 && /* @__PURE__ */ r("div", {
69
72
  className: "drawer__header-actions",
70
- children: _.map((e) => {
71
- const d = /* @__PURE__ */ r(l, {
73
+ children: v.map((e) => {
74
+ const n = /* @__PURE__ */ r(l, {
72
75
  disabled: e.disabled,
73
76
  onClick: e.onClick,
74
77
  icon: e.icon,
@@ -76,20 +79,20 @@ var q = 1e3, N = 0, o = [], U = ({ isOpen: n, onClose: s, position: p = "left",
76
79
  size: e.size ?? "small",
77
80
  variant: e.variant ?? "ghost",
78
81
  children: e.label
79
- }), x = e.title ?? e.label;
80
- return x ? /* @__PURE__ */ r(v, {
81
- title: x,
82
+ }), b = e.title ?? e.label;
83
+ return b ? /* @__PURE__ */ r(u, {
84
+ title: b,
82
85
  position: "bottom",
83
- children: d
84
- }, e.id) : /* @__PURE__ */ r(V.Fragment, { children: d }, e.id);
86
+ children: n
87
+ }, e.id) : /* @__PURE__ */ r(X.Fragment, { children: n }, e.id);
85
88
  })
86
89
  }),
87
- !$ && /* @__PURE__ */ r(v, {
88
- title: "Close drawer",
90
+ !L && /* @__PURE__ */ r(u, {
91
+ title: k.closeDrawer,
89
92
  children: /* @__PURE__ */ r(l, {
90
93
  className: "drawer__close",
91
94
  icon: "clear",
92
- onClick: s,
95
+ onClick: o,
93
96
  size: "medium",
94
97
  variant: "ghost"
95
98
  })
@@ -98,14 +101,14 @@ var q = 1e3, N = 0, o = [], U = ({ isOpen: n, onClose: s, position: p = "left",
98
101
  }),
99
102
  /* @__PURE__ */ r("div", {
100
103
  className: "drawer__content",
101
- children: S
104
+ children: D
102
105
  }),
103
- A && /* @__PURE__ */ i("div", {
106
+ M && /* @__PURE__ */ d("div", {
104
107
  className: "drawer__footer",
105
108
  children: [h && /* @__PURE__ */ r("div", {
106
109
  className: "drawer__footer-content",
107
110
  children: h
108
- }), (t || a) && /* @__PURE__ */ i("div", {
111
+ }), (t || a) && /* @__PURE__ */ d("div", {
109
112
  className: "drawer__footer-actions",
110
113
  children: [a && /* @__PURE__ */ r(l, {
111
114
  variant: a.variant || "default",
@@ -126,5 +129,5 @@ var q = 1e3, N = 0, o = [], U = ({ isOpen: n, onClose: s, position: p = "left",
126
129
  })] });
127
130
  };
128
131
  export {
129
- U as Drawer
132
+ re as Drawer
130
133
  };