@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,137 +1,137 @@
1
1
  import './ColorPicker.css';
2
2
  import { Button as H } from "../Button/Button2.js";
3
- import { Tooltip as G } from "../Tooltip/Tooltip2.js";
3
+ import { Tooltip as X } from "../Tooltip/Tooltip2.js";
4
4
  import { InputNumber as N } from "../InputNumber/InputNumber2.js";
5
- import { InputText as X } from "../InputText/InputText2.js";
5
+ import { InputText as Y } from "../InputText/InputText2.js";
6
6
  /* empty css */
7
- import { useEffect as Y, useMemo as A, useRef as B, useState as y } from "react";
8
- import { jsx as d, jsxs as b } from "react/jsx-runtime";
9
- var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
10
- const i = t.replace("#", "").trim();
11
- if (![3, 6].includes(i.length)) return null;
12
- const h = i.length === 3 ? i.split("").map((s) => s + s).join("") : i, c = parseInt(h, 16);
13
- return Number.isNaN(c) ? null : {
14
- r: c >> 16 & 255,
15
- g: c >> 8 & 255,
16
- b: c & 255
7
+ import { useEffect as A, useMemo as F, useRef as I, useState as y } from "react";
8
+ import { jsx as i, jsxs as b } from "react/jsx-runtime";
9
+ var k = (o, a, m) => Math.min(m, Math.max(a, o)), x = (o) => {
10
+ const a = o.replace("#", "").trim();
11
+ if (![3, 6].includes(a.length)) return null;
12
+ const m = a.length === 3 ? a.split("").map((c) => c + c).join("") : a, l = parseInt(m, 16);
13
+ return Number.isNaN(l) ? null : {
14
+ r: l >> 16 & 255,
15
+ g: l >> 8 & 255,
16
+ b: l & 255
17
17
  };
18
- }, L = (t) => {
19
- const i = t.trim().replace("#", "").toLowerCase();
20
- return `#${i.length === 3 ? i.split("").map((h) => h + h).join("") : i}`;
21
- }, R = ({ r: t, g: i, b: h }) => `#${[
22
- t,
23
- i,
24
- h
25
- ].map((c) => k(Math.round(c), 0, 255).toString(16).padStart(2, "0")).join("")}`, v = ({ r: t, g: i, b: h }) => {
26
- const c = t / 255, s = i / 255, r = h / 255, o = Math.max(c, s, r), l = o - Math.min(c, s, r);
27
- let n = 0;
28
- l !== 0 && (o === c ? n = (s - r) / l % 6 : o === s ? n = (r - c) / l + 2 : n = (c - s) / l + 4, n = Math.round(n * 60), n < 0 && (n += 360));
29
- const a = o === 0 ? 0 : l / o, m = o;
18
+ }, L = (o) => {
19
+ const a = o.trim().replace("#", "").toLowerCase();
20
+ return `#${a.length === 3 ? a.split("").map((m) => m + m).join("") : a}`;
21
+ }, R = ({ r: o, g: a, b: m }) => `#${[
22
+ o,
23
+ a,
24
+ m
25
+ ].map((l) => k(Math.round(l), 0, 255).toString(16).padStart(2, "0")).join("")}`, v = ({ r: o, g: a, b: m }) => {
26
+ const l = o / 255, c = a / 255, r = m / 255, n = Math.max(l, c, r), h = n - Math.min(l, c, r);
27
+ let t = 0;
28
+ h !== 0 && (n === l ? t = (c - r) / h % 6 : n === c ? t = (r - l) / h + 2 : t = (l - c) / h + 4, t = Math.round(t * 60), t < 0 && (t += 360));
29
+ const s = n === 0 ? 0 : h / n, d = n;
30
30
  return {
31
- h: n,
32
- s: Math.round(a * 100),
33
- v: Math.round(m * 100)
31
+ h: t,
32
+ s: Math.round(s * 100),
33
+ v: Math.round(d * 100)
34
34
  };
35
- }, E = ({ h: t, s: i, v: h }) => {
36
- const c = i / 100, s = h / 100, r = s * c, o = r * (1 - Math.abs(t / 60 % 2 - 1)), l = s - r;
37
- let n = 0, a = 0, m = 0;
38
- return t < 60 ? (n = r, a = o) : t < 120 ? (n = o, a = r) : t < 180 ? (a = r, m = o) : t < 240 ? (a = o, m = r) : t < 300 ? (n = o, m = r) : (n = r, m = o), {
39
- r: Math.round((n + l) * 255),
40
- g: Math.round((a + l) * 255),
41
- b: Math.round((m + l) * 255)
35
+ }, E = ({ h: o, s: a, v: m }) => {
36
+ const l = a / 100, c = m / 100, r = c * l, n = r * (1 - Math.abs(o / 60 % 2 - 1)), h = c - r;
37
+ let t = 0, s = 0, d = 0;
38
+ return o < 60 ? (t = r, s = n) : o < 120 ? (t = n, s = r) : o < 180 ? (s = r, d = n) : o < 240 ? (s = n, d = r) : o < 300 ? (t = n, d = r) : (t = r, d = n), {
39
+ r: Math.round((t + h) * 255),
40
+ g: Math.round((s + h) * 255),
41
+ b: Math.round((d + h) * 255)
42
42
  };
43
- }, F = ({ r: t, g: i, b: h }) => {
44
- const c = t / 255, s = i / 255, r = h / 255, o = Math.max(c, s, r), l = Math.min(c, s, r), n = o - l;
45
- let a = 0;
46
- n !== 0 && (o === c ? a = (s - r) / n % 6 : o === s ? a = (r - c) / n + 2 : a = (c - s) / n + 4, a = Math.round(a * 60), a < 0 && (a += 360));
47
- const m = (o + l) / 2, M = n === 0 ? 0 : n / (1 - Math.abs(2 * m - 1));
43
+ }, U = ({ r: o, g: a, b: m }) => {
44
+ const l = o / 255, c = a / 255, r = m / 255, n = Math.max(l, c, r), h = Math.min(l, c, r), t = n - h;
45
+ let s = 0;
46
+ t !== 0 && (n === l ? s = (c - r) / t % 6 : n === c ? s = (r - l) / t + 2 : s = (l - c) / t + 4, s = Math.round(s * 60), s < 0 && (s += 360));
47
+ const d = (n + h) / 2, M = t === 0 ? 0 : t / (1 - Math.abs(2 * d - 1));
48
48
  return {
49
- h: a,
49
+ h: s,
50
50
  s: Math.round(M * 100),
51
- l: Math.round(m * 100)
51
+ l: Math.round(d * 100)
52
52
  };
53
- }, T = ({ h: t, s: i, l: h }) => {
54
- const c = i / 100, s = h / 100, r = (1 - Math.abs(2 * s - 1)) * c, o = r * (1 - Math.abs(t / 60 % 2 - 1)), l = s - r / 2;
55
- let n = 0, a = 0, m = 0;
56
- return t < 60 ? (n = r, a = o) : t < 120 ? (n = o, a = r) : t < 180 ? (a = r, m = o) : t < 240 ? (a = o, m = r) : t < 300 ? (n = o, m = r) : (n = r, m = o), {
57
- r: Math.round((n + l) * 255),
58
- g: Math.round((a + l) * 255),
59
- b: Math.round((m + l) * 255)
53
+ }, T = ({ h: o, s: a, l: m }) => {
54
+ const l = a / 100, c = m / 100, r = (1 - Math.abs(2 * c - 1)) * l, n = r * (1 - Math.abs(o / 60 % 2 - 1)), h = c - r / 2;
55
+ let t = 0, s = 0, d = 0;
56
+ return o < 60 ? (t = r, s = n) : o < 120 ? (t = n, s = r) : o < 180 ? (s = r, d = n) : o < 240 ? (s = n, d = r) : o < 300 ? (t = n, d = r) : (t = r, d = n), {
57
+ r: Math.round((t + h) * 255),
58
+ g: Math.round((s + h) * 255),
59
+ b: Math.round((d + h) * 255)
60
60
  };
61
- }, Z = ({ value: t = "#4e79a7", onChange: i, swatches: h, swatchesLabel: c = "Already in use" }) => {
62
- const [s, r] = y("hex"), o = A(() => {
61
+ }, ee = ({ value: o = "#4e79a7", onChange: a, swatches: m, swatchesLabel: l = "Already in use", bare: c = !1 }) => {
62
+ const [r, n] = y("hex"), h = F(() => {
63
63
  const e = /* @__PURE__ */ new Set();
64
- return (h ?? []).forEach((p) => {
64
+ return (m ?? []).forEach((p) => {
65
65
  const u = x(p);
66
66
  u && e.add(R(u));
67
67
  }), [...e];
68
- }, [h]), [l, n] = y(() => {
69
- const e = x(t) || {
68
+ }, [m]), [t, s] = y(() => {
69
+ const e = x(o) || {
70
70
  r: 78,
71
71
  g: 121,
72
72
  b: 167
73
73
  };
74
74
  return v(e);
75
- }), [a, m] = y(() => x(t) ? L(t) : null), M = B(null), S = B(l);
76
- S.current = l, Y(() => {
77
- const e = x(t);
78
- e && (n(v(e)), m(L(t)));
79
- }, [t]);
75
+ }), [d, M] = y(() => x(o) ? L(o) : null), S = I(null), $ = I(t);
76
+ $.current = t, A(() => {
77
+ const e = x(o);
78
+ e && (s(v(e)), M(L(o)));
79
+ }, [o]);
80
80
  const g = (e) => {
81
81
  const p = {
82
82
  h: k(e.h, 0, 360),
83
83
  s: k(e.s, 0, 100),
84
84
  v: k(e.v, 0, 100)
85
85
  };
86
- n(p), m(null);
86
+ s(p), M(null);
87
87
  const u = R(E(p));
88
- i?.(u);
89
- }, $ = (e) => {
88
+ a?.(u);
89
+ }, j = (e) => {
90
90
  const p = x(e);
91
- p && (n(v(p)), m(L(e)), i?.(e));
92
- }, j = (e, p) => {
93
- const u = M.current?.getBoundingClientRect();
91
+ p && (s(v(p)), M(L(e)), a?.(e));
92
+ }, B = (e, p) => {
93
+ const u = S.current?.getBoundingClientRect();
94
94
  if (!u) return;
95
- const w = k(e - u.left, 0, u.width), P = k(p - u.top, 0, u.height), z = Math.round(w / u.width * 100), D = Math.round(100 - P / u.height * 100);
95
+ const w = k(e - u.left, 0, u.width), z = k(p - u.top, 0, u.height), D = Math.round(w / u.width * 100), G = Math.round(100 - z / u.height * 100);
96
96
  g({
97
- h: S.current.h,
98
- s: z,
99
- v: D
97
+ h: $.current.h,
98
+ s: D,
99
+ v: G
100
100
  });
101
- }, I = (e) => {
101
+ }, P = (e) => {
102
102
  e.preventDefault();
103
103
  try {
104
104
  e.currentTarget.setPointerCapture(e.pointerId);
105
105
  } catch {
106
106
  }
107
- j(e.clientX, e.clientY);
108
- const p = (w) => j(w.clientX, w.clientY), u = () => {
107
+ B(e.clientX, e.clientY);
108
+ const p = (w) => B(w.clientX, w.clientY), u = () => {
109
109
  window.removeEventListener("pointermove", p), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u);
110
110
  };
111
111
  window.addEventListener("pointermove", p), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u);
112
- }, f = a ? x(a) ?? E(l) : E(l), C = a ?? R(f), _ = F(f);
112
+ }, f = d ? x(d) ?? E(t) : E(t), C = d ?? R(f), _ = U(f);
113
113
  return /* @__PURE__ */ b("div", {
114
- className: "color-picker",
114
+ className: `color-picker${c ? " color-picker--bare" : ""}`,
115
115
  children: [
116
- o.length > 0 && /* @__PURE__ */ b("div", {
116
+ h.length > 0 && /* @__PURE__ */ b("div", {
117
117
  className: "color-picker__swatches",
118
- children: [/* @__PURE__ */ d("span", {
118
+ children: [/* @__PURE__ */ i("span", {
119
119
  className: "color-picker__swatches-label",
120
- children: c
121
- }), /* @__PURE__ */ d("div", {
120
+ children: l
121
+ }), /* @__PURE__ */ i("div", {
122
122
  className: "color-picker__swatches-row",
123
- children: o.map((e) => /* @__PURE__ */ d(G, {
123
+ children: h.map((e) => /* @__PURE__ */ i(X, {
124
124
  title: e,
125
- children: /* @__PURE__ */ d("button", {
125
+ children: /* @__PURE__ */ i("button", {
126
126
  className: `color-picker__swatch${e === C.toLowerCase() ? " is-selected" : ""}`,
127
- onClick: () => $(e),
127
+ onClick: () => j(e),
128
128
  style: { backgroundColor: e },
129
129
  type: "button"
130
130
  })
131
131
  }, e))
132
132
  })]
133
133
  }),
134
- /* @__PURE__ */ d("div", {
134
+ /* @__PURE__ */ i("div", {
135
135
  className: "color-picker__preview",
136
136
  style: { backgroundColor: C }
137
137
  }),
@@ -139,29 +139,29 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
139
139
  className: "color-picker__controls",
140
140
  children: [/* @__PURE__ */ b("div", {
141
141
  className: "color-picker__sv",
142
- ref: M,
143
- style: { backgroundColor: `hsl(${l.h}, 100%, 50%)` },
144
- onPointerDown: I,
142
+ ref: S,
143
+ style: { backgroundColor: `hsl(${t.h}, 100%, 50%)` },
144
+ onPointerDown: P,
145
145
  children: [
146
- /* @__PURE__ */ d("div", { className: "color-picker__sv-white" }),
147
- /* @__PURE__ */ d("div", { className: "color-picker__sv-black" }),
148
- /* @__PURE__ */ d("div", {
146
+ /* @__PURE__ */ i("div", { className: "color-picker__sv-white" }),
147
+ /* @__PURE__ */ i("div", { className: "color-picker__sv-black" }),
148
+ /* @__PURE__ */ i("div", {
149
149
  className: "color-picker__sv-handle",
150
150
  style: {
151
- left: `${l.s}%`,
152
- top: `${100 - l.v}%`
151
+ left: `${t.s}%`,
152
+ top: `${100 - t.v}%`
153
153
  }
154
154
  })
155
155
  ]
156
- }), /* @__PURE__ */ d("div", {
156
+ }), /* @__PURE__ */ i("div", {
157
157
  className: "color-picker__slider",
158
- children: /* @__PURE__ */ d("input", {
158
+ children: /* @__PURE__ */ i("input", {
159
159
  type: "range",
160
160
  min: 0,
161
161
  max: 360,
162
- value: l.h,
162
+ value: t.h,
163
163
  onChange: (e) => g({
164
- ...l,
164
+ ...t,
165
165
  h: Number(e.target.value)
166
166
  })
167
167
  })
@@ -170,40 +170,40 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
170
170
  /* @__PURE__ */ b("div", {
171
171
  className: "color-picker__mode-toggle",
172
172
  children: [
173
- /* @__PURE__ */ d(H, {
173
+ /* @__PURE__ */ i(H, {
174
174
  variant: "plain",
175
- className: s === "hex" ? "is-active" : "",
176
- onClick: () => r("hex"),
175
+ className: r === "hex" ? "is-active" : "",
176
+ onClick: () => n("hex"),
177
177
  children: "Hex"
178
178
  }),
179
- /* @__PURE__ */ d(H, {
179
+ /* @__PURE__ */ i(H, {
180
180
  variant: "plain",
181
- className: s === "rgb" ? "is-active" : "",
182
- onClick: () => r("rgb"),
181
+ className: r === "rgb" ? "is-active" : "",
182
+ onClick: () => n("rgb"),
183
183
  children: "RGB"
184
184
  }),
185
- /* @__PURE__ */ d(H, {
185
+ /* @__PURE__ */ i(H, {
186
186
  variant: "plain",
187
- className: s === "hsl" ? "is-active" : "",
188
- onClick: () => r("hsl"),
187
+ className: r === "hsl" ? "is-active" : "",
188
+ onClick: () => n("hsl"),
189
189
  children: "HSL"
190
190
  })
191
191
  ]
192
192
  }),
193
- s === "hex" && /* @__PURE__ */ d("div", {
193
+ r === "hex" && /* @__PURE__ */ i("div", {
194
194
  className: "color-picker__fields color-picker__fields--hex",
195
- children: /* @__PURE__ */ d(X, {
195
+ children: /* @__PURE__ */ i(Y, {
196
196
  label: "Hex",
197
197
  value: C,
198
198
  onChange: (e) => {
199
- x(e) && $(e.startsWith("#") ? e : `#${e}`);
199
+ x(e) && j(e.startsWith("#") ? e : `#${e}`);
200
200
  }
201
201
  })
202
202
  }),
203
- s === "rgb" && /* @__PURE__ */ b("div", {
203
+ r === "rgb" && /* @__PURE__ */ b("div", {
204
204
  className: "color-picker__fields color-picker__fields--rgb",
205
205
  children: [
206
- /* @__PURE__ */ d(N, {
206
+ /* @__PURE__ */ i(N, {
207
207
  label: "R",
208
208
  min: 0,
209
209
  max: 255,
@@ -213,7 +213,7 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
213
213
  r: e ?? 0
214
214
  }))
215
215
  }),
216
- /* @__PURE__ */ d(N, {
216
+ /* @__PURE__ */ i(N, {
217
217
  label: "G",
218
218
  min: 0,
219
219
  max: 255,
@@ -223,7 +223,7 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
223
223
  g: e ?? 0
224
224
  }))
225
225
  }),
226
- /* @__PURE__ */ d(N, {
226
+ /* @__PURE__ */ i(N, {
227
227
  label: "B",
228
228
  min: 0,
229
229
  max: 255,
@@ -235,10 +235,10 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
235
235
  })
236
236
  ]
237
237
  }),
238
- s === "hsl" && /* @__PURE__ */ b("div", {
238
+ r === "hsl" && /* @__PURE__ */ b("div", {
239
239
  className: "color-picker__fields color-picker__fields--hsl",
240
240
  children: [
241
- /* @__PURE__ */ d(N, {
241
+ /* @__PURE__ */ i(N, {
242
242
  label: "H",
243
243
  min: 0,
244
244
  max: 360,
@@ -251,7 +251,7 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
251
251
  g(v(p));
252
252
  }
253
253
  }),
254
- /* @__PURE__ */ d(N, {
254
+ /* @__PURE__ */ i(N, {
255
255
  label: "S",
256
256
  min: 0,
257
257
  max: 100,
@@ -264,7 +264,7 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
264
264
  g(v(p));
265
265
  }
266
266
  }),
267
- /* @__PURE__ */ d(N, {
267
+ /* @__PURE__ */ i(N, {
268
268
  label: "L",
269
269
  min: 0,
270
270
  max: 100,
@@ -283,5 +283,5 @@ var k = (t, i, h) => Math.min(h, Math.max(i, t)), x = (t) => {
283
283
  });
284
284
  };
285
285
  export {
286
- Z as ColorPicker
286
+ ee as ColorPicker
287
287
  };
@@ -1,37 +1,39 @@
1
1
  import './ConfirmDialog.css';
2
- import { Modal as n } from "../Modal/Modal2.js";
2
+ import { libMessages as n } from "../../contexts/LanguageContext/libMessages.js";
3
+ import { useMessages as m } from "../../hooks/useLanguage.js";
4
+ import { Modal as c } from "../Modal/Modal2.js";
3
5
  /* empty css */
4
6
  import "react";
5
7
  import { jsx as a } from "react/jsx-runtime";
6
- var p = ({ isOpen: r = !1, message: t, title: l, confirm: o, cancel: i, usePortal: e = !1 }) => {
7
- const d = {
8
+ var x = ({ isOpen: t = !1, message: e, title: s, confirm: o, cancel: i, usePortal: l = !1 }) => {
9
+ const r = m(n), d = {
8
10
  variant: i?.variant || "default",
9
11
  icon: i?.icon || "clear",
10
12
  onClick: i?.onClick,
11
13
  disabled: i?.disabled,
12
- text: i?.text || "Cancel"
14
+ text: i?.text || r.cancel
13
15
  };
14
- return /* @__PURE__ */ a(n, {
15
- isOpen: r,
16
- title: l,
16
+ return /* @__PURE__ */ a(c, {
17
+ isOpen: t,
18
+ title: s,
17
19
  onClose: i?.onClick ? () => i.onClick() : void 0,
18
20
  size: "small",
19
21
  className: "confirm-dialog",
20
- usePortal: e,
22
+ usePortal: l,
21
23
  primary: {
22
24
  variant: o?.variant || "danger",
23
25
  icon: o?.icon || "checkmark",
24
26
  onClick: o?.onClick,
25
27
  disabled: o?.disabled,
26
- text: o?.text || "Confirm"
28
+ text: o?.text || r.confirm
27
29
  },
28
30
  secondary: d,
29
31
  children: /* @__PURE__ */ a("div", {
30
32
  className: "confirm-dialog__body",
31
- children: /* @__PURE__ */ a("p", { children: t })
33
+ children: /* @__PURE__ */ a("p", { children: e })
32
34
  })
33
35
  });
34
36
  };
35
37
  export {
36
- p as default
38
+ x as default
37
39
  };
@@ -1,49 +1,51 @@
1
1
  import './ConfirmPopover.css';
2
- import { Icon as f } from "../Icon/Icon2.js";
3
- import { Button as p } from "../Button/Button2.js";
4
- import { Popover as _ } from "../Popover/Popover2.js";
2
+ import { Icon as _ } from "../Icon/Icon2.js";
3
+ import { libMessages as u } from "../../contexts/LanguageContext/libMessages.js";
4
+ import { useMessages as x } from "../../hooks/useLanguage.js";
5
+ import { Button as l } from "../Button/Button2.js";
6
+ import { Popover as C } from "../Popover/Popover2.js";
5
7
  /* empty css */
6
8
  import { jsx as o, jsxs as m } from "react/jsx-runtime";
7
- var j = ({ visible: t, onClose: n, anchorEl: s, title: a, message: c, icon: e, confirm: r, cancel: i, placement: d = "auto", offset: l }) => {
8
- const v = () => {
9
- r.onClick(), n();
9
+ var b = ({ visible: p, onClose: e, anchorEl: d, title: n, message: s, icon: a, confirm: r, cancel: i, placement: v = "auto", offset: c }) => {
10
+ const t = x(u), f = () => {
11
+ r.onClick(), e();
10
12
  }, h = () => {
11
- i?.onClick?.(), n();
13
+ i?.onClick?.(), e();
12
14
  };
13
- return /* @__PURE__ */ o(_, {
14
- visible: t,
15
- onClose: n,
16
- anchorEl: s,
17
- placement: d,
18
- ...l !== void 0 ? { offset: l } : {},
15
+ return /* @__PURE__ */ o(C, {
16
+ visible: p,
17
+ onClose: e,
18
+ anchorEl: d,
19
+ placement: v,
20
+ ...c !== void 0 ? { offset: c } : {},
19
21
  children: /* @__PURE__ */ m("div", {
20
22
  className: "confirm-popover",
21
23
  children: [
22
- (a || e) && /* @__PURE__ */ m("div", {
24
+ (n || a) && /* @__PURE__ */ m("div", {
23
25
  className: "confirm-popover__header",
24
- children: [e && /* @__PURE__ */ o(f, { name: e }), a && /* @__PURE__ */ o("span", {
26
+ children: [a && /* @__PURE__ */ o(_, { name: a }), n && /* @__PURE__ */ o("span", {
25
27
  className: "confirm-popover__title",
26
- children: a
28
+ children: n
27
29
  })]
28
30
  }),
29
- c && /* @__PURE__ */ o("div", {
31
+ s && /* @__PURE__ */ o("div", {
30
32
  className: "confirm-popover__message",
31
- children: c
33
+ children: s
32
34
  }),
33
35
  /* @__PURE__ */ m("div", {
34
36
  className: "confirm-popover__actions",
35
- children: [/* @__PURE__ */ o(p, {
37
+ children: [/* @__PURE__ */ o(l, {
36
38
  size: "small",
37
39
  variant: i?.variant ?? "default",
38
40
  icon: i?.icon,
39
41
  onClick: h,
40
- children: i?.text ?? "Cancel"
41
- }), /* @__PURE__ */ o(p, {
42
+ children: i?.text ?? t.cancel
43
+ }), /* @__PURE__ */ o(l, {
42
44
  size: "small",
43
45
  variant: r.variant ?? "info",
44
46
  icon: r.icon,
45
- onClick: v,
46
- children: r.text ?? "Confirm"
47
+ onClick: f,
48
+ children: r.text ?? t.confirm
47
49
  })]
48
50
  })
49
51
  ]
@@ -51,5 +53,5 @@ var j = ({ visible: t, onClose: n, anchorEl: s, title: a, message: c, icon: e, c
51
53
  });
52
54
  };
53
55
  export {
54
- j as ConfirmPopover
56
+ b as ConfirmPopover
55
57
  };
@@ -1,53 +1,66 @@
1
1
  import './ContextMenu.css';
2
2
  /* empty css */
3
- import { useEffect as y, useRef as v, useState as u } from "react";
4
- import { Fragment as C, jsx as d, jsxs as R } from "react/jsx-runtime";
5
- import { createPortal as $ } from "react-dom";
6
- var E = ({ target: e, onClose: l, children: f, autoClose: a = !1 }) => {
7
- const c = v(null), [p, h] = u(!1), [x, b] = u(() => {
8
- if (!e) return { opacity: 0 };
9
- const n = e.getBoundingClientRect();
10
- return {
11
- top: `${n.bottom}px`,
12
- left: `${n.left}px`,
3
+ import { useEffect as M, useRef as k, useState as p } from "react";
4
+ import { Fragment as F, jsx as x, jsxs as E } from "react/jsx-runtime";
5
+ import { createPortal as H } from "react-dom";
6
+ var f = (n, t) => t ? {
7
+ top: t.y,
8
+ bottom: t.y,
9
+ left: t.x
10
+ } : n ? n.getBoundingClientRect() : null, A = ({ target: n, position: t, onClose: d, children: h, autoClose: y = !1 }) => {
11
+ const c = k(null), [b, v] = p(!1), [w, g] = p(() => {
12
+ const i = f(n, t);
13
+ return i ? {
14
+ top: `${i.bottom}px`,
15
+ left: `${i.left}px`,
13
16
  opacity: 0
17
+ } : { opacity: 0 };
18
+ }), u = t?.x, s = t?.y;
19
+ M(() => {
20
+ const i = u === void 0 || s === void 0 ? null : {
21
+ x: u,
22
+ y: s
14
23
  };
15
- });
16
- y(() => {
17
- if (!e || !c.current) return;
18
- const n = requestAnimationFrame(() => {
24
+ if (!f(n, i) || !c.current) return;
25
+ const $ = requestAnimationFrame(() => {
19
26
  if (!c.current) return;
20
- const m = e.getBoundingClientRect(), r = c.current.getBoundingClientRect(), s = document.documentElement.clientWidth || window.innerWidth, w = document.documentElement.clientHeight || window.innerHeight, t = 8;
21
- let i = m.bottom, o = m.left;
22
- o + r.width > s - t && (o = Math.max(t, s - r.width - t)), o < t && (o = t), i + r.height > w - t && (i = Math.max(t, m.top - r.height)), i < t && (i = t), b({
23
- top: `${i}px`,
24
- left: `${o}px`,
27
+ const m = f(n, i);
28
+ if (!m) return;
29
+ const l = c.current.getBoundingClientRect(), a = document.documentElement.clientWidth || window.innerWidth, C = document.documentElement.clientHeight || window.innerHeight, e = 8;
30
+ let o = m.bottom, r = m.left;
31
+ r + l.width > a - e && (r = Math.max(e, a - l.width - e)), r < e && (r = e), o + l.height > C - e && (o = Math.max(e, m.top - l.height)), o < e && (o = e), g({
32
+ top: `${o}px`,
33
+ left: `${r}px`,
25
34
  opacity: 1
26
- }), h(!0);
35
+ }), v(!0);
27
36
  });
28
37
  return () => {
29
- cancelAnimationFrame(n);
38
+ cancelAnimationFrame($);
30
39
  };
31
- }, [e]);
32
- const g = (n) => {
33
- a && l?.();
40
+ }, [
41
+ n,
42
+ u,
43
+ s
44
+ ]);
45
+ const R = (i) => {
46
+ y && d?.();
34
47
  };
35
- return e ? $(/* @__PURE__ */ R(C, { children: [/* @__PURE__ */ d("div", {
48
+ return !n && !t ? null : H(/* @__PURE__ */ E(F, { children: [/* @__PURE__ */ x("div", {
36
49
  style: {
37
50
  position: "fixed",
38
51
  inset: 0,
39
52
  zIndex: 1190
40
53
  },
41
54
  className: "memobit-context-menu-back-drop",
42
- onClick: l
43
- }), /* @__PURE__ */ d("div", {
55
+ onClick: d
56
+ }), /* @__PURE__ */ x("div", {
44
57
  ref: c,
45
- className: `memobit-context-menu ${p ? "memobit-context-menu--visible" : ""}`,
46
- style: x,
47
- onClick: g,
48
- children: f
49
- })] }), document.body) : null;
58
+ className: `memobit-context-menu ${b ? "memobit-context-menu--visible" : ""}`,
59
+ style: w,
60
+ onClick: R,
61
+ children: h
62
+ })] }), document.body);
50
63
  };
51
64
  export {
52
- E as ContextMenu
65
+ A as ContextMenu
53
66
  };