@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,18 +1,25 @@
1
1
  import './InputDate.css';
2
- import { Icon as f } from "../Icon/Icon2.js";
3
- import { Tooltip as N } from "../Tooltip/Tooltip2.js";
2
+ import { Icon as N } from "../Icon/Icon2.js";
3
+ import { libMessages as M } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useMessages as P } from "../../hooks/useLanguage.js";
5
+ import { Tooltip as g } from "../Tooltip/Tooltip2.js";
4
6
  /* empty css */
5
- import { forwardRef as j, useRef as y } from "react";
7
+ import { forwardRef as F, useRef as T } from "react";
6
8
  import { jsx as e, jsxs as s } from "react/jsx-runtime";
7
- var z = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, error: c, highlighted: g, id: r, label: p, max: R, min: w, onBlur: x, onChange: o, onClick: C, onKeyDown: I, onKeyUp: $, readOnly: n = !1, required: d = !1, success: l, type: P = "date", value: u }, i) => {
8
- const m = b && u && !a && !n, h = y(null);
9
+ var q = F(({ autoComplete: v = "on", autoFocus: b, clearable: k, disabled: a, error: r, highlighted: w, id: l, label: o, max: x, min: C, onBlur: I, onChange: p, onClick: R, onKeyDown: $, onKeyUp: D, readOnly: n = !1, required: d = !1, success: c, type: j = "date", value: m }, i) => {
10
+ const u = P(M), f = k && m && !a && !n, h = T(null), y = (t) => {
11
+ h.current = t, typeof i == "function" ? i(t) : i && (i.current = t);
12
+ }, z = () => {
13
+ const t = h.current;
14
+ t && !a && !n && t.showPicker();
15
+ };
9
16
  return /* @__PURE__ */ s("div", {
10
- className: `input-date-wrapper${g ? " input-date-highlighted" : ""}`,
17
+ className: `input-date-wrapper${w ? " input-date-highlighted" : ""}`,
11
18
  children: [
12
- p && /* @__PURE__ */ s("label", {
13
- htmlFor: r,
19
+ o && /* @__PURE__ */ s("label", {
20
+ htmlFor: l,
14
21
  className: "input-date-label",
15
- children: [p, d && /* @__PURE__ */ e("span", {
22
+ children: [o, d && /* @__PURE__ */ e("span", {
16
23
  className: "input-date-required",
17
24
  children: "*"
18
25
  })]
@@ -21,49 +28,44 @@ var z = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
21
28
  className: "input-date-field",
22
29
  children: [/* @__PURE__ */ e("input", {
23
30
  autoComplete: v,
24
- autoFocus: k,
31
+ autoFocus: b,
25
32
  disabled: a,
26
- type: P === "date" ? "date" : "datetime-local",
27
- className: `input-date${c ? " input-date-error" : ""}${l ? " input-date-success" : ""}${m ? " input-date--clearable" : ""}`,
28
- id: r,
29
- max: R,
30
- min: w,
31
- ref: (t) => {
32
- h.current = t, typeof i == "function" ? i(t) : i && (i.current = t);
33
- },
34
- value: u ?? "",
35
- onBlur: x,
36
- onChange: (t) => o?.(t.target.value || void 0),
37
- onClick: C,
38
- onKeyDown: I,
39
- onKeyUp: $,
33
+ type: j === "date" ? "date" : "datetime-local",
34
+ className: `input-date${r ? " input-date-error" : ""}${c ? " input-date-success" : ""}${f ? " input-date--clearable" : ""}`,
35
+ id: l,
36
+ max: x,
37
+ min: C,
38
+ ref: y,
39
+ value: m ?? "",
40
+ onBlur: I,
41
+ onChange: (t) => p?.(t.target.value || void 0),
42
+ onClick: R,
43
+ onKeyDown: $,
44
+ onKeyUp: D,
40
45
  readOnly: n,
41
46
  required: d
42
47
  }), /* @__PURE__ */ s("div", {
43
48
  className: "input-date-actions",
44
- children: [m && /* @__PURE__ */ e(N, {
45
- title: "Clear date",
49
+ children: [f && /* @__PURE__ */ e(g, {
50
+ title: u.clearDate,
46
51
  children: /* @__PURE__ */ e("button", {
47
52
  type: "button",
48
53
  className: "input-date-clear",
49
- onClick: () => o?.(void 0),
50
- children: /* @__PURE__ */ e(f, {
54
+ onClick: () => p?.(void 0),
55
+ children: /* @__PURE__ */ e(N, {
51
56
  name: "clear",
52
57
  size: "sm"
53
58
  })
54
59
  })
55
- }), /* @__PURE__ */ e(N, {
56
- title: "Open calendar",
60
+ }), /* @__PURE__ */ e(g, {
61
+ title: u.openCalendar,
57
62
  children: /* @__PURE__ */ e("button", {
58
63
  type: "button",
59
64
  className: "input-date-picker",
60
- onClick: () => {
61
- const t = h.current;
62
- t && !a && !n && t.showPicker();
63
- },
65
+ onClick: z,
64
66
  disabled: a || n,
65
67
  tabIndex: -1,
66
- children: /* @__PURE__ */ e(f, {
68
+ children: /* @__PURE__ */ e(N, {
67
69
  name: "calendar",
68
70
  size: "sm"
69
71
  })
@@ -71,18 +73,18 @@ var z = j(({ autoComplete: v = "on", autoFocus: k, clearable: b, disabled: a, er
71
73
  })]
72
74
  })]
73
75
  }),
74
- c && /* @__PURE__ */ e("span", {
76
+ r && /* @__PURE__ */ e("span", {
75
77
  className: "input-date-error-message",
76
- children: c
78
+ children: r
77
79
  }),
78
- l && /* @__PURE__ */ e("span", {
80
+ c && /* @__PURE__ */ e("span", {
79
81
  className: "input-date-success-message",
80
- children: l
82
+ children: c
81
83
  })
82
84
  ]
83
85
  });
84
86
  });
85
- z.displayName = "InputDate";
87
+ q.displayName = "InputDate";
86
88
  export {
87
- z as InputDate
89
+ q as InputDate
88
90
  };
@@ -1,44 +1,46 @@
1
1
  import './InputSearch.css';
2
2
  import { Icon as c } from "../Icon/Icon2.js";
3
- import { Tooltip as C } from "../Tooltip/Tooltip2.js";
4
- import { InputText as S } from "../InputText/InputText2.js";
3
+ import { libMessages as b } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useMessages as g } from "../../hooks/useLanguage.js";
5
+ import { Tooltip as j } from "../Tooltip/Tooltip2.js";
6
+ import { InputText as w } from "../InputText/InputText2.js";
5
7
  /* empty css */
6
- import { forwardRef as j } from "react";
7
- import { jsx as r, jsxs as w } from "react/jsx-runtime";
8
- var T = j(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m, onBlur: l, onChange: o, onClick: p, onKeyDown: h, onKeyUp: f, placeholder: u = "Search...", readOnly: a = !1, required: d = !1, value: e, className: x = "" }, I) => {
9
- const N = () => {
8
+ import { forwardRef as C } from "react";
9
+ import { jsx as r, jsxs as M } from "react/jsx-runtime";
10
+ var T = C(({ autoComplete: i = "off", autoFocus: m, disabled: t, id: l, label: n, onBlur: p, onChange: o, onClick: h, onKeyDown: f, onKeyUp: u, placeholder: d, readOnly: s = !1, required: x = !1, value: e, className: I = "" }, N) => {
11
+ const a = g(b), _ = () => {
10
12
  o?.("");
11
- }, _ = e && e.length > 0 && !t && !a;
12
- return /* @__PURE__ */ w("div", {
13
- className: `input-search ${x}`,
13
+ }, S = e && e.length > 0 && !t && !s;
14
+ return /* @__PURE__ */ M("div", {
15
+ className: `input-search ${I}`,
14
16
  children: [
15
17
  /* @__PURE__ */ r("div", {
16
18
  className: "input-search__icon",
17
19
  children: /* @__PURE__ */ r(c, { name: "search" })
18
20
  }),
19
- /* @__PURE__ */ r(S, {
20
- autoComplete: s,
21
- autoFocus: i,
21
+ /* @__PURE__ */ r(w, {
22
+ autoComplete: i,
23
+ autoFocus: m,
22
24
  disabled: t,
23
- id: n,
24
- label: m,
25
- onBlur: l,
25
+ id: l,
26
+ label: n,
27
+ onBlur: p,
26
28
  onChange: o,
27
- onClick: p,
28
- onKeyDown: h,
29
- onKeyUp: f,
30
- placeholder: u,
31
- readOnly: a,
32
- required: d,
29
+ onClick: h,
30
+ onKeyDown: f,
31
+ onKeyUp: u,
32
+ placeholder: d ?? a.searchPlaceholder,
33
+ readOnly: s,
34
+ required: x,
33
35
  value: e,
34
- ref: I
36
+ ref: N
35
37
  }),
36
- _ && /* @__PURE__ */ r(C, {
37
- title: "Clear search",
38
+ S && /* @__PURE__ */ r(j, {
39
+ title: a.clearSearch,
38
40
  children: /* @__PURE__ */ r("button", {
39
41
  type: "button",
40
42
  className: "input-search__clear",
41
- onClick: N,
43
+ onClick: _,
42
44
  children: /* @__PURE__ */ r(c, {
43
45
  name: "clear",
44
46
  size: "sm"
@@ -0,0 +1 @@
1
+ .menu-bar{align-items:center;gap:var(--spacing-2);display:flex}.menu-bar__menu{position:relative}.menu-bar__title{padding:var(--spacing-4) var(--spacing-8);border-radius:var(--radius-sm);color:var(--body-color);font:inherit;font-size:var(--font-size-sm);cursor:default;background:0 0;border:none}.menu-bar__title:hover,.menu-bar__title--open{background:var(--list-hover-background-color)}.menu-bar__list{z-index:1200;min-width:200px;padding:var(--spacing-4);background:var(--popover-background-color);border:1px solid var(--popover-border-color);border-radius:var(--radius);box-shadow:0 var(--spacing-8) var(--spacing-24) var(--box-shadow);flex-direction:column;display:flex;position:absolute;top:100%;left:0}.menu-bar__item{justify-content:space-between;align-items:center;gap:var(--spacing-24);padding:var(--spacing-6) var(--spacing-8);border-radius:var(--radius-sm);color:var(--popover-color);font:inherit;font-size:var(--font-size-sm);text-align:left;white-space:nowrap;cursor:default;background:0 0;border:none;display:flex}.menu-bar__item:hover:not(:disabled){background:color-mix(in srgb, var(--body-accent-color) 16%, transparent)}.menu-bar__item:disabled{color:var(--body-color-muted);opacity:.6}.menu-bar__shortcut{color:var(--body-color-muted);font-size:var(--font-size-xs)}.menu-bar__separator{height:1px;margin:var(--spacing-4) var(--spacing-2);background:var(--delimiter-color)}
@@ -0,0 +1,46 @@
1
+ import './MenuBar.css';
2
+ /* empty css */
3
+ import { useEffect as d, useRef as m, useState as b } from "react";
4
+ import { jsx as a, jsxs as u } from "react/jsx-runtime";
5
+ var w = ({ menus: i, className: o }) => {
6
+ const [r, s] = b(null), l = m(null);
7
+ return d(() => {
8
+ if (r === null) return;
9
+ const n = (e) => {
10
+ e instanceof KeyboardEvent && e.key !== "Escape" || e instanceof MouseEvent && e.target instanceof Node && l.current?.contains(e.target) || s(null);
11
+ };
12
+ return window.addEventListener("mousedown", n), window.addEventListener("keydown", n), () => {
13
+ window.removeEventListener("mousedown", n), window.removeEventListener("keydown", n);
14
+ };
15
+ }, [r]), /* @__PURE__ */ a("div", {
16
+ className: `menu-bar${o ? ` ${o}` : ""}`,
17
+ ref: l,
18
+ children: i.map((n, e) => /* @__PURE__ */ u("div", {
19
+ className: "menu-bar__menu",
20
+ children: [/* @__PURE__ */ a("button", {
21
+ type: "button",
22
+ className: `menu-bar__title${r === e ? " menu-bar__title--open" : ""}`,
23
+ onClick: () => s(r === e ? null : e),
24
+ onMouseEnter: () => r !== null && s(e),
25
+ children: n.label
26
+ }), r === e && /* @__PURE__ */ a("div", {
27
+ className: "menu-bar__list",
28
+ children: n.entries.map((t, c) => t === "separator" ? /* @__PURE__ */ a("div", { className: "menu-bar__separator" }, `separator-${c}`) : /* @__PURE__ */ u("button", {
29
+ type: "button",
30
+ className: "menu-bar__item",
31
+ disabled: t.disabled,
32
+ onClick: () => {
33
+ s(null), t.onSelect();
34
+ },
35
+ children: [/* @__PURE__ */ a("span", { children: t.label }), t.shortcut && /* @__PURE__ */ a("span", {
36
+ className: "menu-bar__shortcut",
37
+ children: t.shortcut
38
+ })]
39
+ }, t.label))
40
+ })]
41
+ }, n.label))
42
+ });
43
+ };
44
+ export {
45
+ w as MenuBar
46
+ };
@@ -1,87 +1,89 @@
1
1
  import './Modal.css';
2
2
  import { Icon as L } from "../Icon/Icon2.js";
3
- import { useBodyScrollLock as P } from "../../hooks/useBodyScrollLock.js";
4
- import { useComponentEffect as R } from "../../hooks/useComponentEffect.js";
5
- import { Button as c } from "../Button/Button2.js";
6
- import { Tooltip as j } from "../Tooltip/Tooltip2.js";
3
+ import { libMessages as P } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useBodyScrollLock as R } from "../../hooks/useBodyScrollLock.js";
5
+ import { useComponentEffect as j } from "../../hooks/useComponentEffect.js";
6
+ import { useMessages as w } from "../../hooks/useLanguage.js";
7
+ import { Button as d } from "../Button/Button2.js";
8
+ import { Tooltip as B } from "../Tooltip/Tooltip2.js";
7
9
  /* empty css */
8
- import { useEffect as w, useRef as h } from "react";
10
+ import { useEffect as S, useRef as h } from "react";
9
11
  import { jsx as o, jsxs as i } from "react/jsx-runtime";
10
- import { createPortal as B } from "react-dom";
11
- var H = ({ children: r, className: k, fullHeight: p = !1, isOpen: a, noPadding: C = !1, onClose: t, onOverlayClick: _, primary: l, secondary: e, size: b = "auto", tertiary: n, title: g, titleIcon: m, usePortal: x = !1 }) => {
12
- const E = R("Modal");
13
- P(a);
14
- const N = h(null), s = h(null);
15
- if (w(() => {
12
+ import { createPortal as q } from "react-dom";
13
+ var U = ({ children: s, className: k, fullHeight: p = !1, isOpen: a, noPadding: b = !1, onClose: n, onOverlayClick: _, primary: e, secondary: l, size: C = "auto", tertiary: t, title: g, titleIcon: r, usePortal: x = !1 }) => {
14
+ const E = w(P), N = j("Modal");
15
+ R(a);
16
+ const M = h(null), m = h(null);
17
+ if (S(() => {
16
18
  if (!a) return;
17
- const d = (u) => {
18
- if (u.key !== "Escape" || !t) return;
19
+ const c = (u) => {
20
+ if (u.key !== "Escape" || !n) return;
19
21
  const v = document.querySelectorAll(".modal-overlay");
20
- v[v.length - 1] === s.current && (u.stopPropagation(), t());
22
+ v[v.length - 1] === m.current && (u.stopPropagation(), n());
21
23
  };
22
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
23
- }, [a, t]), !a) return null;
24
- const $ = l || e || n, f = /* @__PURE__ */ o("div", {
25
- ref: s,
24
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
25
+ }, [a, n]), !a) return null;
26
+ const $ = e || l || t, f = /* @__PURE__ */ o("div", {
27
+ ref: m,
26
28
  className: "modal-overlay",
27
29
  onClick: _,
28
30
  children: /* @__PURE__ */ i("div", {
29
- ref: N,
30
- className: `modal modal--${b} ${p ? "modal--full-height" : ""} ${k || ""} ${E}`,
31
- onClick: (d) => d.stopPropagation(),
31
+ ref: M,
32
+ className: `modal modal--${C} ${p ? "modal--full-height" : ""} ${k || ""} ${N}`,
33
+ onClick: (c) => c.stopPropagation(),
32
34
  children: [
33
35
  /* @__PURE__ */ i("div", {
34
36
  className: "modal__header",
35
37
  children: [/* @__PURE__ */ i("h2", { children: [
36
- m ? /* @__PURE__ */ o(L, { name: m }) : null,
38
+ r ? /* @__PURE__ */ o(L, { name: r }) : null,
37
39
  " ",
38
40
  g
39
- ] }), /* @__PURE__ */ o(j, {
40
- title: "Close modal",
41
- children: /* @__PURE__ */ o(c, {
41
+ ] }), /* @__PURE__ */ o(B, {
42
+ title: E.closeModal,
43
+ children: /* @__PURE__ */ o(d, {
42
44
  className: "modal__close",
43
45
  icon: "clear",
44
- onClick: t,
46
+ onClick: n,
45
47
  size: "medium",
46
48
  variant: "ghost"
47
49
  })
48
50
  })]
49
51
  }),
50
- r != null && /* @__PURE__ */ o("div", {
51
- className: `modal__body ${C ? "modal__body--no-padding" : ""}`,
52
- children: r
52
+ s != null && /* @__PURE__ */ o("div", {
53
+ className: `modal__body ${b ? "modal__body--no-padding" : ""}`,
54
+ children: s
53
55
  }),
54
56
  $ && /* @__PURE__ */ i("div", {
55
57
  className: "modal__footer",
56
58
  children: [
57
- n && /* @__PURE__ */ o(c, {
58
- variant: n.variant || "default",
59
- icon: n.icon,
60
- onClick: n.onClick,
61
- disabled: n.disabled,
62
- children: n.text
59
+ t && /* @__PURE__ */ o(d, {
60
+ variant: t.variant || "default",
61
+ icon: t.icon,
62
+ onClick: t.onClick,
63
+ disabled: t.disabled,
64
+ children: t.text
63
65
  }),
64
- e && /* @__PURE__ */ o(c, {
65
- variant: e.variant || "default",
66
- icon: e.icon || "clear",
67
- onClick: e.onClick,
68
- disabled: e.disabled,
69
- children: e.text
70
- }),
71
- l && /* @__PURE__ */ o(c, {
72
- variant: l.variant || "success",
73
- icon: l.icon || "checkmark",
66
+ l && /* @__PURE__ */ o(d, {
67
+ variant: l.variant || "default",
68
+ icon: l.icon || "clear",
74
69
  onClick: l.onClick,
75
70
  disabled: l.disabled,
76
71
  children: l.text
72
+ }),
73
+ e && /* @__PURE__ */ o(d, {
74
+ variant: e.variant || "success",
75
+ icon: e.icon || "checkmark",
76
+ onClick: e.onClick,
77
+ disabled: e.disabled,
78
+ children: e.text
77
79
  })
78
80
  ]
79
81
  })
80
82
  ]
81
83
  })
82
84
  });
83
- return x ? B(f, document.body) : f;
85
+ return x ? q(f, document.body) : f;
84
86
  };
85
87
  export {
86
- H as Modal
88
+ U as Modal
87
89
  };
@@ -1,92 +1,89 @@
1
1
  import './Pagination.css';
2
- import { Button as u } from "../Button/Button2.js";
3
- import { Dropdown as E } from "../Dropdown/Dropdown2.js";
4
- import { useBreakpoint as y } from "../../hooks/useBreakpoint.js";
2
+ import { libMessages as y } from "../../contexts/LanguageContext/libMessages.js";
3
+ import { useMessages as L } from "../../hooks/useLanguage.js";
4
+ import { Button as p } from "../Button/Button2.js";
5
+ import { Dropdown as O } from "../Dropdown/Dropdown2.js";
6
+ import { useBreakpoint as I } from "../../hooks/useBreakpoint.js";
5
7
  /* empty css */
6
- import { useCallback as L, useEffect as R, useRef as I, useState as O } from "react";
7
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
8
- var V = 120, j = 45, C = 8, H = 4, z = ({ currentPage: i, totalPages: r, totalItems: p, onPageChange: d, showPagesNumbers: N = !1, pageSizeOptions: o, pageSize: m, onPageSizeChange: v, pageSizeLabel: x = "Rows", horizontalAlign: D = "left" }) => {
9
- const { isAtLeast: a, isMobile: k } = y(), f = I(null), [l, w] = O(k ? 0 : 2), h = L(() => {
10
- const s = f.current, e = s?.parentElement;
8
+ import { useCallback as R, useEffect as V, useRef as j, useState as C } from "react";
9
+ import { jsx as t, jsxs as m } from "react/jsx-runtime";
10
+ var H = 120, U = 45, $ = 8, G = 4, Y = ({ currentPage: i, totalPages: n, totalItems: u, onPageChange: f, showPagesNumbers: D = !1, pageSizeOptions: o, pageSize: v, onPageSizeChange: b, pageSizeLabel: N, horizontalAlign: k = "left" }) => {
11
+ const a = L(y), { isAtLeast: l, isMobile: w } = I(), d = j(null), [c, A] = C(w ? 0 : 2), h = R(() => {
12
+ const s = d.current, e = s?.parentElement;
11
13
  if (!s || !e) return;
12
- let n = 0;
13
- for (const _ of e.children) _ !== s && (n += _.offsetWidth + C);
14
- const T = e.clientWidth - n - ((a("desktop") ? V : j) * 2 + 90 + 90 + 48), W = Math.floor(T / 53), B = Math.min(H, Math.max(0, Math.floor(W / 2)));
15
- w(B);
16
- }, [a]);
17
- R(() => {
18
- const s = f.current, e = s?.parentElement;
14
+ let r = 0;
15
+ for (const x of e.children) x !== s && (r += x.offsetWidth + $);
16
+ const W = e.clientWidth - r - ((l("desktop") ? H : U) * 2 + 90 + 90 + 48), B = Math.floor(W / 53), E = Math.min(G, Math.max(0, Math.floor(B / 2)));
17
+ A(E);
18
+ }, [l]);
19
+ V(() => {
20
+ const s = d.current, e = s?.parentElement;
19
21
  if (!s || !e) return;
20
- const n = new ResizeObserver(() => {
22
+ const r = new ResizeObserver(() => {
21
23
  h();
22
24
  });
23
- return n.observe(s), n.observe(e), h(), () => n.disconnect();
25
+ return r.observe(s), r.observe(e), h(), () => r.disconnect();
24
26
  }, [h]);
25
- const b = o && m !== void 0 && v, M = o?.map((s) => ({
27
+ const M = o && v !== void 0 && b, _ = o?.map((s) => ({
26
28
  label: `${s}`,
27
29
  value: s
28
- })), A = () => {
30
+ })), T = () => {
29
31
  const s = [], e = [];
30
- for (let n = Math.max(2, i - l); n <= Math.min(r - 1, i + l); n++) s.push(n);
31
- return i - l > 2 ? e.push(1, "...") : e.push(1), e.push(...s), i + l < r - 1 ? e.push("...", r) : r > 1 && e.push(r), e;
32
+ for (let r = Math.max(2, i - c); r <= Math.min(n - 1, i + c); r++) s.push(r);
33
+ return i - c > 2 ? e.push(1, "...") : e.push(1), e.push(...s), i + c < n - 1 ? e.push("...", n) : n > 1 && e.push(n), e;
32
34
  };
33
- return p !== void 0 && o?.length && p <= Math.min(...o) || r <= 1 && !b ? null : /* @__PURE__ */ c("div", {
34
- className: `pagination pagination--${D}`,
35
+ return u !== void 0 && o?.length && u <= Math.min(...o) || n <= 1 && !M ? null : /* @__PURE__ */ m("div", {
36
+ className: `pagination pagination--${k}`,
35
37
  children: [
36
- r > 1 && /* @__PURE__ */ c("div", {
38
+ n > 1 && /* @__PURE__ */ m("div", {
37
39
  className: "pagination__pages",
38
- ref: f,
40
+ ref: d,
39
41
  children: [
40
- /* @__PURE__ */ t(u, {
42
+ /* @__PURE__ */ t(p, {
41
43
  variant: "default",
42
44
  borders: "sharp",
43
45
  disabled: i === 1,
44
46
  icon: "previous",
45
- onClick: () => d(i - 1),
46
- children: a("desktop") ? "Previous" : ""
47
+ onClick: () => f(i - 1),
48
+ children: l("desktop") ? a.previous : ""
47
49
  }),
48
- A().map((s, e) => /* @__PURE__ */ t(u, {
50
+ T().map((s, e) => /* @__PURE__ */ t(p, {
49
51
  borders: "sharp",
50
52
  variant: s === i ? "warning" : "default",
51
53
  disabled: typeof s == "string",
52
- onClick: () => typeof s == "number" && d(s),
54
+ onClick: () => typeof s == "number" && f(s),
53
55
  children: s
54
56
  }, e)),
55
- /* @__PURE__ */ t(u, {
57
+ /* @__PURE__ */ t(p, {
56
58
  variant: "default",
57
59
  borders: "sharp",
58
- disabled: i === r,
60
+ disabled: i === n,
59
61
  sufixIcon: "next",
60
- onClick: () => d(i + 1),
61
- children: a("desktop") ? "Next" : ""
62
+ onClick: () => f(i + 1),
63
+ children: l("desktop") ? a.next : ""
62
64
  })
63
65
  ]
64
66
  }),
65
- b && M && /* @__PURE__ */ c("div", {
67
+ M && _ && /* @__PURE__ */ m("div", {
66
68
  className: "pagination__page-size",
67
- children: [/* @__PURE__ */ t("span", { children: x }), /* @__PURE__ */ t(E, {
69
+ children: [/* @__PURE__ */ t("span", { children: N ?? a.rows }), /* @__PURE__ */ t(O, {
68
70
  name: "pageSize",
69
- options: M,
70
- value: m,
71
+ options: _,
72
+ value: v,
71
73
  searchable: !1,
72
74
  usePortal: !1,
73
75
  onChange: (s) => {
74
- s && !Array.isArray(s) && v(Number(s.value));
76
+ s && !Array.isArray(s) && b(Number(s.value));
75
77
  }
76
78
  })]
77
79
  }),
78
- N && /* @__PURE__ */ c("span", {
80
+ D && /* @__PURE__ */ t("span", {
79
81
  className: "page-info",
80
- children: [
81
- "Page ",
82
- i,
83
- " of ",
84
- r
85
- ]
82
+ children: a.pageOf(i, n)
86
83
  })
87
84
  ]
88
85
  });
89
86
  };
90
87
  export {
91
- z as Pagination
88
+ Y as Pagination
92
89
  };
@@ -1,20 +1,22 @@
1
1
  import './ScrollToTop.css';
2
- import { Tooltip as m } from "../Tooltip/Tooltip2.js";
2
+ import { libMessages as a } from "../../contexts/LanguageContext/libMessages.js";
3
+ import { useMessages as f } from "../../hooks/useLanguage.js";
4
+ import { Tooltip as u } from "../Tooltip/Tooltip2.js";
3
5
  /* empty css */
4
- import { useCallback as u, useEffect as a, useState as d } from "react";
6
+ import { useCallback as T, useEffect as d, useState as v } from "react";
5
7
  import { jsx as t } from "react/jsx-runtime";
6
- var h = ({ scrollContainer: o, scrollThreshold: e = 200, className: l }) => {
7
- const [c, i] = d(!1);
8
- a(() => {
9
- const s = o ?? window, r = () => {
8
+ var k = ({ scrollContainer: o, scrollThreshold: s = 200, className: e }) => {
9
+ const i = f(a), [c, p] = v(!1);
10
+ d(() => {
11
+ const l = o ?? window, r = () => {
10
12
  const n = o ? o.scrollTop : window.scrollY;
11
- i(n > e);
13
+ p(n > s);
12
14
  };
13
- return s.addEventListener("scroll", r, { passive: !0 }), () => {
14
- s.removeEventListener("scroll", r);
15
+ return l.addEventListener("scroll", r, { passive: !0 }), () => {
16
+ l.removeEventListener("scroll", r);
15
17
  };
16
- }, [o, e]);
17
- const p = u(() => {
18
+ }, [o, s]);
19
+ const m = T(() => {
18
20
  o ? o.scrollTo({
19
21
  top: 0,
20
22
  behavior: "smooth"
@@ -23,11 +25,11 @@ var h = ({ scrollContainer: o, scrollThreshold: e = 200, className: l }) => {
23
25
  behavior: "smooth"
24
26
  });
25
27
  }, [o]);
26
- return c ? /* @__PURE__ */ t(m, {
27
- title: "Scroll to top",
28
+ return c ? /* @__PURE__ */ t(u, {
29
+ title: i.scrollToTop,
28
30
  children: /* @__PURE__ */ t("button", {
29
- className: `scroll-to-top${l ? ` ${l}` : ""}`,
30
- onClick: p,
31
+ className: `scroll-to-top${e ? ` ${e}` : ""}`,
32
+ onClick: m,
31
33
  children: /* @__PURE__ */ t("span", {
32
34
  className: "scroll-to-top__icon",
33
35
  children: "▲"
@@ -36,5 +38,5 @@ var h = ({ scrollContainer: o, scrollThreshold: e = 200, className: l }) => {
36
38
  }) : null;
37
39
  };
38
40
  export {
39
- h as ScrollToTop
41
+ k as ScrollToTop
40
42
  };