@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,50 +1,52 @@
|
|
|
1
1
|
import './DatePicker.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { createPortal as
|
|
11
|
-
var
|
|
12
|
-
const [
|
|
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
|
-
}), [
|
|
18
|
+
}), [W, m] = b(null), [G, H] = b({
|
|
17
19
|
position: "fixed",
|
|
18
20
|
visibility: "hidden"
|
|
19
|
-
}),
|
|
20
|
-
|
|
21
|
-
f && t instanceof Date &&
|
|
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 ? !
|
|
28
|
-
|
|
29
|
+
const o = i ? !C : y;
|
|
30
|
+
N(() => {
|
|
29
31
|
if (i) return;
|
|
30
32
|
const e = (n) => {
|
|
31
|
-
o &&
|
|
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 =
|
|
36
|
-
if (i || !o || !
|
|
37
|
-
const e =
|
|
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: `${
|
|
41
|
-
left: `${
|
|
42
|
+
top: `${Z}px`,
|
|
43
|
+
left: `${O}px`,
|
|
42
44
|
zIndex: 1100
|
|
43
45
|
});
|
|
44
46
|
}, [i, o]);
|
|
45
|
-
|
|
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
|
|
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} ${
|
|
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
|
-
},
|
|
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),
|
|
75
|
+
g?.(e), v && s !== "multiple" && !i && u(!1);
|
|
74
76
|
return;
|
|
75
77
|
}
|
|
76
78
|
const n = new Date(e);
|
|
77
|
-
n.setHours(
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
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
|
-
},
|
|
83
|
-
e.stopPropagation(),
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
...
|
|
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:
|
|
91
|
-
rangeStart: s === "range" ?
|
|
92
|
-
onRangeStartChange: s === "range" ?
|
|
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(
|
|
96
|
-
clockSize:
|
|
97
|
-
format:
|
|
98
|
-
minuteStep:
|
|
99
|
-
onChange:
|
|
100
|
-
value:
|
|
101
|
-
withClock:
|
|
102
|
-
withSeconds:
|
|
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:
|
|
109
|
-
className: `datepicker__input ${
|
|
110
|
+
ref: p,
|
|
111
|
+
className: `datepicker__input ${C ? "datepicker__input--disabled" : ""} ${o ? "datepicker__input--open" : ""}`,
|
|
110
112
|
onClick: () => {
|
|
111
|
-
|
|
113
|
+
C || i || (o && m(null), u(!o));
|
|
112
114
|
},
|
|
113
115
|
children: [/* @__PURE__ */ r("span", {
|
|
114
|
-
className: `datepicker__value ${
|
|
115
|
-
children:
|
|
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: [
|
|
119
|
-
title:
|
|
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:
|
|
125
|
+
onClick: T,
|
|
124
126
|
children: "×"
|
|
125
127
|
})
|
|
126
128
|
}), /* @__PURE__ */ r("span", {
|
|
127
129
|
className: "datepicker__icon",
|
|
128
|
-
children: /* @__PURE__ */ r(
|
|
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:
|
|
135
|
-
}) :
|
|
136
|
+
children: M()
|
|
137
|
+
}) : ae(/* @__PURE__ */ h("div", {
|
|
136
138
|
ref: c,
|
|
137
139
|
className: "datepicker__dropdown",
|
|
138
|
-
style:
|
|
139
|
-
children: [/* @__PURE__ */ r(
|
|
140
|
-
title:
|
|
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:
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
146
|
+
onClick: U,
|
|
147
|
+
children: /* @__PURE__ */ r(E, { name: "clear" })
|
|
146
148
|
})
|
|
147
|
-
}),
|
|
149
|
+
}), M()]
|
|
148
150
|
}), document.body))]
|
|
149
151
|
});
|
|
150
152
|
};
|
|
151
153
|
export {
|
|
152
|
-
|
|
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 {
|
|
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
|
|
7
|
+
import { Tooltip as u } from "../Tooltip/Tooltip2.js";
|
|
6
8
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import { Fragment as
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}, [
|
|
21
|
-
if (!
|
|
22
|
-
const e = (
|
|
23
|
-
|
|
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
|
-
|
|
28
|
-
|
|
30
|
+
i,
|
|
31
|
+
o,
|
|
29
32
|
w
|
|
30
|
-
]), !
|
|
31
|
-
const
|
|
32
|
-
"--drawer-width":
|
|
33
|
-
"--drawer-max-width":
|
|
34
|
-
"--drawer-margin":
|
|
35
|
-
"--drawer-border-radius":
|
|
36
|
-
"--drawer-shadow":
|
|
37
|
-
zIndex:
|
|
38
|
-
},
|
|
39
|
-
return /* @__PURE__ */
|
|
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:
|
|
42
|
-
style: { zIndex:
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
-
className: `drawer drawer--${
|
|
45
|
-
style:
|
|
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__ */
|
|
50
|
+
/* @__PURE__ */ d("div", {
|
|
48
51
|
className: "drawer__header",
|
|
49
52
|
children: [
|
|
50
|
-
|
|
51
|
-
title:
|
|
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:
|
|
58
|
+
onClick: _,
|
|
56
59
|
size: "small",
|
|
57
60
|
variant: "ghost",
|
|
58
61
|
icon: "arrow-left"
|
|
59
62
|
})
|
|
60
63
|
}),
|
|
61
|
-
(c || m) && /* @__PURE__ */
|
|
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
|
-
|
|
71
|
+
v.length > 0 && /* @__PURE__ */ r("div", {
|
|
69
72
|
className: "drawer__header-actions",
|
|
70
|
-
children:
|
|
71
|
-
const
|
|
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
|
-
}),
|
|
80
|
-
return
|
|
81
|
-
title:
|
|
82
|
+
}), b = e.title ?? e.label;
|
|
83
|
+
return b ? /* @__PURE__ */ r(u, {
|
|
84
|
+
title: b,
|
|
82
85
|
position: "bottom",
|
|
83
|
-
children:
|
|
84
|
-
}, e.id) : /* @__PURE__ */ r(
|
|
86
|
+
children: n
|
|
87
|
+
}, e.id) : /* @__PURE__ */ r(X.Fragment, { children: n }, e.id);
|
|
85
88
|
})
|
|
86
89
|
}),
|
|
87
|
-
|
|
88
|
-
title:
|
|
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:
|
|
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:
|
|
104
|
+
children: D
|
|
102
105
|
}),
|
|
103
|
-
|
|
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__ */
|
|
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
|
-
|
|
132
|
+
re as Drawer
|
|
130
133
|
};
|