@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.
- package/dist/components/Banner/Banner2.js +15 -13
- package/dist/components/BoldText/BoldText.js +5 -0
- package/dist/components/Calendar/Calendar2.js +108 -135
- package/dist/components/ColorPicker/ColorPicker.css +1 -1
- package/dist/components/ColorPicker/ColorPicker2.js +114 -114
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +13 -11
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +26 -24
- package/dist/components/ContextMenu/ContextMenu2.js +46 -33
- package/dist/components/ControlPanel/ControlPanel2.js +95 -93
- package/dist/components/ControlPanel/ControlPanelFilter.js +205 -193
- package/dist/components/ControlPanel/ControlPanelOptions.js +190 -185
- package/dist/components/DataView/DataView.CardView.js +83 -81
- package/dist/components/DataView/DataView.ColumnSelector.js +27 -25
- package/dist/components/DataView/DataView.TableView.js +74 -72
- package/dist/components/DataView/DataView2.js +169 -167
- package/dist/components/DatePicker/DatePicker2.js +71 -69
- package/dist/components/Drawer/Drawer2.js +58 -55
- package/dist/components/Dropdown/Dropdown2.js +187 -189
- package/dist/components/InputDate/InputDate2.js +43 -41
- package/dist/components/InputSearch/InputSearch2.js +27 -25
- package/dist/components/MenuBar/MenuBar.css +1 -0
- package/dist/components/MenuBar/MenuBar2.js +46 -0
- package/dist/components/Modal/Modal2.js +49 -47
- package/dist/components/Pagination/Pagination2.js +44 -47
- package/dist/components/ScrollToTop/ScrollToTop2.js +18 -16
- package/dist/components/ThemeSettings/ThemeSettings2.js +131 -123
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +16 -12
- package/dist/components/Toast/Toast2.js +38 -33
- package/dist/components/ToolButton/ToolButton.css +1 -0
- package/dist/components/ToolButton/ToolButton2.js +36 -0
- package/dist/components/ToolPalette/ToolPalette.css +1 -0
- package/dist/components/ToolPalette/ToolPalette2.js +83 -0
- package/dist/components/Toolbar/Toolbar2.js +58 -56
- package/dist/contexts/LanguageContext/LanguageContext.context.js +9 -0
- package/dist/contexts/LanguageContext/LanguageContext.js +19 -0
- package/dist/contexts/LanguageContext/libMessages.js +240 -0
- package/dist/helpers/Datetime.js +84 -68
- package/dist/helpers/Language.js +8 -0
- package/dist/helpers/Pagination.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useLanguage.js +16 -0
- package/dist/index.d.ts +133 -6
- package/dist/index.js +417 -399
- package/dist/memobit-icons.json +4 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- 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
|
|
3
|
+
import { Tooltip as X } from "../Tooltip/Tooltip2.js";
|
|
4
4
|
import { InputNumber as N } from "../InputNumber/InputNumber2.js";
|
|
5
|
-
import { InputText as
|
|
5
|
+
import { InputText as Y } from "../InputText/InputText2.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { useEffect as
|
|
8
|
-
import { jsx as
|
|
9
|
-
var k = (
|
|
10
|
-
const
|
|
11
|
-
if (![3, 6].includes(
|
|
12
|
-
const
|
|
13
|
-
return Number.isNaN(
|
|
14
|
-
r:
|
|
15
|
-
g:
|
|
16
|
-
b:
|
|
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 = (
|
|
19
|
-
const
|
|
20
|
-
return `#${
|
|
21
|
-
}, R = ({ r:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
].map((
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
const
|
|
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:
|
|
32
|
-
s: Math.round(
|
|
33
|
-
v: Math.round(
|
|
31
|
+
h: t,
|
|
32
|
+
s: Math.round(s * 100),
|
|
33
|
+
v: Math.round(d * 100)
|
|
34
34
|
};
|
|
35
|
-
}, E = ({ h:
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
return
|
|
39
|
-
r: Math.round((
|
|
40
|
-
g: Math.round((
|
|
41
|
-
b: Math.round((
|
|
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
|
-
},
|
|
44
|
-
const
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
const
|
|
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:
|
|
49
|
+
h: s,
|
|
50
50
|
s: Math.round(M * 100),
|
|
51
|
-
l: Math.round(
|
|
51
|
+
l: Math.round(d * 100)
|
|
52
52
|
};
|
|
53
|
-
}, T = ({ h:
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
return
|
|
57
|
-
r: Math.round((
|
|
58
|
-
g: Math.round((
|
|
59
|
-
b: Math.round((
|
|
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
|
-
},
|
|
62
|
-
const [
|
|
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 (
|
|
64
|
+
return (m ?? []).forEach((p) => {
|
|
65
65
|
const u = x(p);
|
|
66
66
|
u && e.add(R(u));
|
|
67
67
|
}), [...e];
|
|
68
|
-
}, [
|
|
69
|
-
const e = x(
|
|
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
|
-
}), [
|
|
76
|
-
|
|
77
|
-
const e = x(
|
|
78
|
-
e && (
|
|
79
|
-
}, [
|
|
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
|
-
|
|
86
|
+
s(p), M(null);
|
|
87
87
|
const u = R(E(p));
|
|
88
|
-
|
|
89
|
-
},
|
|
88
|
+
a?.(u);
|
|
89
|
+
}, j = (e) => {
|
|
90
90
|
const p = x(e);
|
|
91
|
-
p && (
|
|
92
|
-
},
|
|
93
|
-
const u =
|
|
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),
|
|
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:
|
|
98
|
-
s:
|
|
99
|
-
v:
|
|
97
|
+
h: $.current.h,
|
|
98
|
+
s: D,
|
|
99
|
+
v: G
|
|
100
100
|
});
|
|
101
|
-
},
|
|
101
|
+
}, P = (e) => {
|
|
102
102
|
e.preventDefault();
|
|
103
103
|
try {
|
|
104
104
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
105
105
|
} catch {
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
const p = (w) =>
|
|
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 =
|
|
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
|
-
|
|
116
|
+
h.length > 0 && /* @__PURE__ */ b("div", {
|
|
117
117
|
className: "color-picker__swatches",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ i("span", {
|
|
119
119
|
className: "color-picker__swatches-label",
|
|
120
|
-
children:
|
|
121
|
-
}), /* @__PURE__ */
|
|
120
|
+
children: l
|
|
121
|
+
}), /* @__PURE__ */ i("div", {
|
|
122
122
|
className: "color-picker__swatches-row",
|
|
123
|
-
children:
|
|
123
|
+
children: h.map((e) => /* @__PURE__ */ i(X, {
|
|
124
124
|
title: e,
|
|
125
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ i("button", {
|
|
126
126
|
className: `color-picker__swatch${e === C.toLowerCase() ? " is-selected" : ""}`,
|
|
127
|
-
onClick: () =>
|
|
127
|
+
onClick: () => j(e),
|
|
128
128
|
style: { backgroundColor: e },
|
|
129
129
|
type: "button"
|
|
130
130
|
})
|
|
131
131
|
}, e))
|
|
132
132
|
})]
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
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:
|
|
143
|
-
style: { backgroundColor: `hsl(${
|
|
144
|
-
onPointerDown:
|
|
142
|
+
ref: S,
|
|
143
|
+
style: { backgroundColor: `hsl(${t.h}, 100%, 50%)` },
|
|
144
|
+
onPointerDown: P,
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
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: `${
|
|
152
|
-
top: `${100 -
|
|
151
|
+
left: `${t.s}%`,
|
|
152
|
+
top: `${100 - t.v}%`
|
|
153
153
|
}
|
|
154
154
|
})
|
|
155
155
|
]
|
|
156
|
-
}), /* @__PURE__ */
|
|
156
|
+
}), /* @__PURE__ */ i("div", {
|
|
157
157
|
className: "color-picker__slider",
|
|
158
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: /* @__PURE__ */ i("input", {
|
|
159
159
|
type: "range",
|
|
160
160
|
min: 0,
|
|
161
161
|
max: 360,
|
|
162
|
-
value:
|
|
162
|
+
value: t.h,
|
|
163
163
|
onChange: (e) => g({
|
|
164
|
-
...
|
|
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__ */
|
|
173
|
+
/* @__PURE__ */ i(H, {
|
|
174
174
|
variant: "plain",
|
|
175
|
-
className:
|
|
176
|
-
onClick: () =>
|
|
175
|
+
className: r === "hex" ? "is-active" : "",
|
|
176
|
+
onClick: () => n("hex"),
|
|
177
177
|
children: "Hex"
|
|
178
178
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ i(H, {
|
|
180
180
|
variant: "plain",
|
|
181
|
-
className:
|
|
182
|
-
onClick: () =>
|
|
181
|
+
className: r === "rgb" ? "is-active" : "",
|
|
182
|
+
onClick: () => n("rgb"),
|
|
183
183
|
children: "RGB"
|
|
184
184
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ i(H, {
|
|
186
186
|
variant: "plain",
|
|
187
|
-
className:
|
|
188
|
-
onClick: () =>
|
|
187
|
+
className: r === "hsl" ? "is-active" : "",
|
|
188
|
+
onClick: () => n("hsl"),
|
|
189
189
|
children: "HSL"
|
|
190
190
|
})
|
|
191
191
|
]
|
|
192
192
|
}),
|
|
193
|
-
|
|
193
|
+
r === "hex" && /* @__PURE__ */ i("div", {
|
|
194
194
|
className: "color-picker__fields color-picker__fields--hex",
|
|
195
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ i(Y, {
|
|
196
196
|
label: "Hex",
|
|
197
197
|
value: C,
|
|
198
198
|
onChange: (e) => {
|
|
199
|
-
x(e) &&
|
|
199
|
+
x(e) && j(e.startsWith("#") ? e : `#${e}`);
|
|
200
200
|
}
|
|
201
201
|
})
|
|
202
202
|
}),
|
|
203
|
-
|
|
203
|
+
r === "rgb" && /* @__PURE__ */ b("div", {
|
|
204
204
|
className: "color-picker__fields color-picker__fields--rgb",
|
|
205
205
|
children: [
|
|
206
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
|
|
238
|
+
r === "hsl" && /* @__PURE__ */ b("div", {
|
|
239
239
|
className: "color-picker__fields color-picker__fields--hsl",
|
|
240
240
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
|
|
286
|
+
ee as ColorPicker
|
|
287
287
|
};
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import './ConfirmDialog.css';
|
|
2
|
-
import {
|
|
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
|
|
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 ||
|
|
14
|
+
text: i?.text || r.cancel
|
|
13
15
|
};
|
|
14
|
-
return /* @__PURE__ */ a(
|
|
15
|
-
isOpen:
|
|
16
|
-
title:
|
|
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:
|
|
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 ||
|
|
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:
|
|
33
|
+
children: /* @__PURE__ */ a("p", { children: e })
|
|
32
34
|
})
|
|
33
35
|
});
|
|
34
36
|
};
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
x as default
|
|
37
39
|
};
|
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import './ConfirmPopover.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
|
8
|
-
const
|
|
9
|
-
r.onClick(),
|
|
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?.(),
|
|
13
|
+
i?.onClick?.(), e();
|
|
12
14
|
};
|
|
13
|
-
return /* @__PURE__ */ o(
|
|
14
|
-
visible:
|
|
15
|
-
onClose:
|
|
16
|
-
anchorEl:
|
|
17
|
-
placement:
|
|
18
|
-
...
|
|
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
|
-
(
|
|
24
|
+
(n || a) && /* @__PURE__ */ m("div", {
|
|
23
25
|
className: "confirm-popover__header",
|
|
24
|
-
children: [
|
|
26
|
+
children: [a && /* @__PURE__ */ o(_, { name: a }), n && /* @__PURE__ */ o("span", {
|
|
25
27
|
className: "confirm-popover__title",
|
|
26
|
-
children:
|
|
28
|
+
children: n
|
|
27
29
|
})]
|
|
28
30
|
}),
|
|
29
|
-
|
|
31
|
+
s && /* @__PURE__ */ o("div", {
|
|
30
32
|
className: "confirm-popover__message",
|
|
31
|
-
children:
|
|
33
|
+
children: s
|
|
32
34
|
}),
|
|
33
35
|
/* @__PURE__ */ m("div", {
|
|
34
36
|
className: "confirm-popover__actions",
|
|
35
|
-
children: [/* @__PURE__ */ o(
|
|
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 ??
|
|
41
|
-
}), /* @__PURE__ */ o(
|
|
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:
|
|
46
|
-
children: r.text ??
|
|
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
|
-
|
|
56
|
+
b as ConfirmPopover
|
|
55
57
|
};
|
|
@@ -1,53 +1,66 @@
|
|
|
1
1
|
import './ContextMenu.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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 =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
}),
|
|
35
|
+
}), v(!0);
|
|
27
36
|
});
|
|
28
37
|
return () => {
|
|
29
|
-
cancelAnimationFrame(
|
|
38
|
+
cancelAnimationFrame($);
|
|
30
39
|
};
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
}, [
|
|
41
|
+
n,
|
|
42
|
+
u,
|
|
43
|
+
s
|
|
44
|
+
]);
|
|
45
|
+
const R = (i) => {
|
|
46
|
+
y && d?.();
|
|
34
47
|
};
|
|
35
|
-
return
|
|
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:
|
|
43
|
-
}), /* @__PURE__ */
|
|
55
|
+
onClick: d
|
|
56
|
+
}), /* @__PURE__ */ x("div", {
|
|
44
57
|
ref: c,
|
|
45
|
-
className: `memobit-context-menu ${
|
|
46
|
-
style:
|
|
47
|
-
onClick:
|
|
48
|
-
children:
|
|
49
|
-
})] }), document.body)
|
|
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
|
-
|
|
65
|
+
A as ContextMenu
|
|
53
66
|
};
|