@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,197 +1,205 @@
|
|
|
1
1
|
import './ThemeSettings.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { libMessages as W } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
|
+
import { useTheme as K } from "./useTheme.js";
|
|
4
|
+
import { useMessages as U } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { Checkbox as B } from "../Checkbox/Checkbox2.js";
|
|
6
|
+
import { Dropdown as J } from "../Dropdown/Dropdown2.js";
|
|
7
|
+
import { InputSearch as X } from "../InputSearch/InputSearch2.js";
|
|
8
|
+
import { Drawer as Y } from "../Drawer/Drawer2.js";
|
|
7
9
|
import { ToggleSwitch as L } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
8
|
-
import { FAVORITE_THEMES as
|
|
10
|
+
import { FAVORITE_THEMES as A, THEME_CONFIGS as Z, getThemeAppearance as ee } from "./themeConfig.js";
|
|
9
11
|
/* empty css */
|
|
10
|
-
import { useEffect as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { previewPalettes as
|
|
13
|
-
var
|
|
14
|
-
{
|
|
15
|
-
value: "all",
|
|
16
|
-
label: "All"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
value: "light",
|
|
20
|
-
label: "Light"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
value: "dark",
|
|
24
|
-
label: "Dark"
|
|
25
|
-
}
|
|
26
|
-
], de = ({ isOpen: r, onClose: g, allowedThemes: d, currentApp: o, showEffects: I = !0, showSearch: w = !0, showFavorites: b = !0, showAppearanceFilter: P = !0 }) => {
|
|
27
|
-
const { theme: f, effects: n, setPreviewTheme: $, setPreviewEffects: N, commitPreview: M, clearPreview: D } = H(), O = ["Card", "Modal"], j = [
|
|
12
|
+
import { useEffect as M, useMemo as te, useRef as I, useState as v } from "react";
|
|
13
|
+
import { Fragment as se, jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
14
|
+
import { previewPalettes as ae } from "@memobit/themes";
|
|
15
|
+
var _e = ({ isOpen: o, onClose: w, allowedThemes: d, currentApp: m, showEffects: R = !0, showSearch: b = !0, showFavorites: N = !0, showAppearanceFilter: P = !0 }) => {
|
|
16
|
+
const s = U(W), { theme: p, effects: i, setPreviewTheme: D, setPreviewEffects: C, commitPreview: O, clearPreview: $ } = K(), j = [
|
|
28
17
|
{
|
|
29
|
-
|
|
18
|
+
value: "all",
|
|
19
|
+
label: s.appearanceAll
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "light",
|
|
23
|
+
label: s.appearanceLight
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "dark",
|
|
27
|
+
label: s.appearanceDark
|
|
28
|
+
}
|
|
29
|
+
], q = [{
|
|
30
|
+
value: "Card",
|
|
31
|
+
label: s.effectComponentCard
|
|
32
|
+
}, {
|
|
33
|
+
value: "Modal",
|
|
34
|
+
label: s.effectComponentModal
|
|
35
|
+
}], z = [
|
|
36
|
+
{
|
|
37
|
+
label: s.effectNone,
|
|
30
38
|
value: ""
|
|
31
39
|
},
|
|
32
40
|
{
|
|
33
|
-
label:
|
|
41
|
+
label: s.effectNoteContainer,
|
|
34
42
|
value: "note-container-effect"
|
|
35
43
|
},
|
|
36
44
|
{
|
|
37
|
-
label:
|
|
45
|
+
label: s.effectInfuse,
|
|
38
46
|
value: "infuse-effect"
|
|
39
47
|
},
|
|
40
48
|
{
|
|
41
|
-
label:
|
|
49
|
+
label: s.effectUpLift,
|
|
42
50
|
value: "up-lift-effect"
|
|
43
51
|
},
|
|
44
52
|
{
|
|
45
|
-
label:
|
|
53
|
+
label: s.effectGlow,
|
|
46
54
|
value: "glow-effect"
|
|
47
55
|
}
|
|
48
|
-
], [
|
|
49
|
-
let e =
|
|
56
|
+
], [c, y] = v(""), [h, T] = v(!1), [f, F] = v(!1), [r, E] = v("all"), S = I(null), u = I(!1), _ = m?.trim().toLowerCase() ?? "", k = te(() => {
|
|
57
|
+
let e = Z;
|
|
50
58
|
if (d && d.length > 0) {
|
|
51
|
-
const
|
|
52
|
-
e = e.filter((
|
|
59
|
+
const a = new Set(d);
|
|
60
|
+
e = e.filter((n) => a.has(n.value));
|
|
53
61
|
}
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
e = e.filter((
|
|
62
|
+
if (h && (e = e.filter((a) => A.has(a.value))), f && _ && (e = e.filter((a) => (a.recommendedApps ?? []).some((n) => n.toLowerCase() === _))), r !== "all" && (e = e.filter((a) => ee(a.value) === r)), c.trim()) {
|
|
63
|
+
const a = c.toLowerCase().trim();
|
|
64
|
+
e = e.filter((n) => n.label.toLowerCase().includes(a) || (n.recommendedApps ?? []).some((g) => g.toLowerCase().includes(a)));
|
|
57
65
|
}
|
|
58
66
|
return e;
|
|
59
67
|
}, [
|
|
60
|
-
|
|
61
|
-
m,
|
|
68
|
+
c,
|
|
62
69
|
h,
|
|
70
|
+
f,
|
|
63
71
|
_,
|
|
64
|
-
|
|
72
|
+
r,
|
|
65
73
|
d
|
|
66
74
|
]);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
if (!
|
|
75
|
+
M(() => {
|
|
76
|
+
o ? (y(""), T(!1), F(!1), E("all")) : u.current = !1;
|
|
77
|
+
}, [o]), M(() => {
|
|
78
|
+
if (!o || c || h || f || r !== "all" || u.current) return;
|
|
71
79
|
const e = window.requestAnimationFrame(() => {
|
|
72
|
-
|
|
80
|
+
S.current?.scrollIntoView({
|
|
73
81
|
block: "center",
|
|
74
82
|
inline: "nearest"
|
|
75
|
-
}),
|
|
83
|
+
}), u.current = !0;
|
|
76
84
|
});
|
|
77
85
|
return () => window.cancelAnimationFrame(e);
|
|
78
86
|
}, [
|
|
79
|
-
|
|
80
|
-
i,
|
|
81
|
-
m,
|
|
82
|
-
h,
|
|
87
|
+
o,
|
|
83
88
|
c,
|
|
84
|
-
|
|
89
|
+
h,
|
|
90
|
+
f,
|
|
91
|
+
r,
|
|
92
|
+
p
|
|
85
93
|
]);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
effect:
|
|
92
|
-
components:
|
|
94
|
+
const G = (e) => {
|
|
95
|
+
D(e);
|
|
96
|
+
}, H = (e) => {
|
|
97
|
+
const a = !e || Array.isArray(e) ? "" : e.value;
|
|
98
|
+
C({
|
|
99
|
+
effect: a,
|
|
100
|
+
components: i.components
|
|
93
101
|
});
|
|
94
|
-
},
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
effect:
|
|
98
|
-
components:
|
|
102
|
+
}, Q = (e, a) => {
|
|
103
|
+
const n = a ? [...i.components, e] : i.components.filter((g) => g !== e);
|
|
104
|
+
C({
|
|
105
|
+
effect: i.effect,
|
|
106
|
+
components: n
|
|
99
107
|
});
|
|
100
|
-
},
|
|
101
|
-
|
|
108
|
+
}, x = () => {
|
|
109
|
+
$(), w();
|
|
110
|
+
}, V = () => {
|
|
111
|
+
O(), w();
|
|
102
112
|
};
|
|
103
|
-
return /* @__PURE__ */ t(
|
|
104
|
-
isOpen:
|
|
105
|
-
onClose:
|
|
106
|
-
title:
|
|
113
|
+
return /* @__PURE__ */ t(Y, {
|
|
114
|
+
isOpen: o,
|
|
115
|
+
onClose: x,
|
|
116
|
+
title: s.themeSettings,
|
|
107
117
|
position: "right",
|
|
108
118
|
width: "520px",
|
|
109
119
|
maxWidth: "calc(100vw - 32px)",
|
|
110
120
|
className: "theme-settings-drawer",
|
|
111
121
|
secondary: {
|
|
112
|
-
text:
|
|
122
|
+
text: s.cancel,
|
|
113
123
|
variant: "default",
|
|
114
|
-
onClick:
|
|
124
|
+
onClick: x,
|
|
115
125
|
icon: "clear"
|
|
116
126
|
},
|
|
117
127
|
primary: {
|
|
118
|
-
text:
|
|
128
|
+
text: s.saveChanges,
|
|
119
129
|
variant: "success",
|
|
120
|
-
onClick:
|
|
121
|
-
M(), g();
|
|
122
|
-
},
|
|
130
|
+
onClick: V,
|
|
123
131
|
icon: "save"
|
|
124
132
|
},
|
|
125
133
|
children: /* @__PURE__ */ t("div", {
|
|
126
134
|
className: "theme-settings",
|
|
127
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ l("div", {
|
|
128
136
|
className: "theme-settings__content",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ l("div", {
|
|
130
138
|
className: "theme-settings__section",
|
|
131
139
|
children: [
|
|
132
|
-
/* @__PURE__ */ t("label", { children:
|
|
133
|
-
(
|
|
140
|
+
/* @__PURE__ */ t("label", { children: s.selectTheme }),
|
|
141
|
+
(b || N || m) && /* @__PURE__ */ l("div", {
|
|
134
142
|
className: "theme-settings__toolbar",
|
|
135
143
|
children: [
|
|
136
|
-
|
|
137
|
-
placeholder:
|
|
138
|
-
value:
|
|
139
|
-
onChange:
|
|
144
|
+
b && /* @__PURE__ */ t(X, {
|
|
145
|
+
placeholder: s.searchThemes,
|
|
146
|
+
value: c,
|
|
147
|
+
onChange: y
|
|
140
148
|
}),
|
|
141
|
-
|
|
142
|
-
checked:
|
|
143
|
-
onChange:
|
|
144
|
-
onLabel:
|
|
145
|
-
offLabel:
|
|
149
|
+
m && /* @__PURE__ */ t(L, {
|
|
150
|
+
checked: f,
|
|
151
|
+
onChange: F,
|
|
152
|
+
onLabel: s.themesForApp(m),
|
|
153
|
+
offLabel: s.themesForApp(m),
|
|
146
154
|
size: "small"
|
|
147
155
|
}),
|
|
148
|
-
|
|
149
|
-
checked:
|
|
150
|
-
onChange:
|
|
151
|
-
onLabel:
|
|
152
|
-
offLabel:
|
|
156
|
+
N && /* @__PURE__ */ t(L, {
|
|
157
|
+
checked: h,
|
|
158
|
+
onChange: T,
|
|
159
|
+
onLabel: s.favorites,
|
|
160
|
+
offLabel: s.favorites,
|
|
153
161
|
size: "small"
|
|
154
162
|
})
|
|
155
163
|
]
|
|
156
164
|
}),
|
|
157
165
|
P && /* @__PURE__ */ t("div", {
|
|
158
166
|
className: "theme-settings__appearance",
|
|
159
|
-
children:
|
|
167
|
+
children: j.map((e) => /* @__PURE__ */ t("button", {
|
|
160
168
|
type: "button",
|
|
161
|
-
className: `theme-settings__appearance-option ${
|
|
162
|
-
onClick: () =>
|
|
169
|
+
className: `theme-settings__appearance-option ${r === e.value ? "theme-settings__appearance-option--active" : ""}`,
|
|
170
|
+
onClick: () => E(e.value),
|
|
163
171
|
children: e.label
|
|
164
172
|
}, e.value))
|
|
165
173
|
}),
|
|
166
174
|
/* @__PURE__ */ t("div", {
|
|
167
175
|
className: "theme-settings__grid",
|
|
168
|
-
children:
|
|
176
|
+
children: k.length === 0 ? /* @__PURE__ */ t("div", {
|
|
169
177
|
className: "theme-settings__empty",
|
|
170
|
-
children:
|
|
171
|
-
}) :
|
|
172
|
-
ref:
|
|
178
|
+
children: s.noThemes
|
|
179
|
+
}) : k.map((e) => /* @__PURE__ */ l("button", {
|
|
180
|
+
ref: p === e.value ? S : null,
|
|
173
181
|
type: "button",
|
|
174
|
-
className: `theme-settings__swatch ${
|
|
175
|
-
onClick: () =>
|
|
176
|
-
children: [/* @__PURE__ */
|
|
182
|
+
className: `theme-settings__swatch ${p === e.value ? "theme-settings__swatch--active" : ""}`,
|
|
183
|
+
onClick: () => G(e.value),
|
|
184
|
+
children: [/* @__PURE__ */ l("div", {
|
|
177
185
|
className: "theme-settings__preview",
|
|
178
|
-
style:
|
|
186
|
+
style: ae[e.value],
|
|
179
187
|
children: [
|
|
180
|
-
|
|
188
|
+
A.has(e.value) && /* @__PURE__ */ t("span", {
|
|
181
189
|
className: "theme-settings__favorite-badge",
|
|
182
190
|
children: "⭐"
|
|
183
191
|
}),
|
|
184
192
|
/* @__PURE__ */ t("div", { className: "theme-settings__preview-header" }),
|
|
185
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ l("div", {
|
|
186
194
|
className: "theme-settings__preview-body",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ l("div", {
|
|
188
196
|
className: "theme-settings__preview-card",
|
|
189
197
|
children: [
|
|
190
198
|
/* @__PURE__ */ t("div", { className: "theme-settings__preview-line theme-settings__preview-line--accent" }),
|
|
191
199
|
/* @__PURE__ */ t("div", { className: "theme-settings__preview-line" }),
|
|
192
200
|
/* @__PURE__ */ t("div", { className: "theme-settings__preview-line theme-settings__preview-line--short" })
|
|
193
201
|
]
|
|
194
|
-
}), /* @__PURE__ */
|
|
202
|
+
}), /* @__PURE__ */ l("div", {
|
|
195
203
|
className: "theme-settings__preview-sidebar",
|
|
196
204
|
children: [
|
|
197
205
|
/* @__PURE__ */ t("div", { className: "theme-settings__preview-dot" }),
|
|
@@ -211,29 +219,29 @@ var Z = [
|
|
|
211
219
|
}, e.value))
|
|
212
220
|
})
|
|
213
221
|
]
|
|
214
|
-
}),
|
|
222
|
+
}), R && /* @__PURE__ */ l(se, { children: [/* @__PURE__ */ l("div", {
|
|
215
223
|
className: "theme-settings__section",
|
|
216
224
|
children: [/* @__PURE__ */ t("label", {
|
|
217
225
|
htmlFor: "effect-selector",
|
|
218
|
-
children:
|
|
219
|
-
}), /* @__PURE__ */ t(
|
|
226
|
+
children: s.componentEffect
|
|
227
|
+
}), /* @__PURE__ */ t(J, {
|
|
220
228
|
id: "effect-selector",
|
|
221
229
|
name: "effect",
|
|
222
|
-
options:
|
|
223
|
-
value:
|
|
224
|
-
onChange:
|
|
225
|
-
placeholder:
|
|
230
|
+
options: z,
|
|
231
|
+
value: i.effect,
|
|
232
|
+
onChange: H,
|
|
233
|
+
placeholder: s.chooseEffect
|
|
226
234
|
})]
|
|
227
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ l("div", {
|
|
228
236
|
className: "theme-settings__section",
|
|
229
|
-
children: [/* @__PURE__ */ t("label", { children:
|
|
237
|
+
children: [/* @__PURE__ */ t("label", { children: s.applyEffectTo }), /* @__PURE__ */ t("div", {
|
|
230
238
|
className: "theme-settings__components",
|
|
231
|
-
children:
|
|
232
|
-
label: e,
|
|
233
|
-
checked:
|
|
234
|
-
onChange: (
|
|
235
|
-
disabled: !
|
|
236
|
-
}, e))
|
|
239
|
+
children: q.map((e) => /* @__PURE__ */ t(B, {
|
|
240
|
+
label: e.label,
|
|
241
|
+
checked: i.components.includes(e.value),
|
|
242
|
+
onChange: (a) => Q(e.value, a),
|
|
243
|
+
disabled: !i.effect
|
|
244
|
+
}, e.value))
|
|
237
245
|
})]
|
|
238
246
|
})] })]
|
|
239
247
|
})
|
|
@@ -241,5 +249,5 @@ var Z = [
|
|
|
241
249
|
});
|
|
242
250
|
};
|
|
243
251
|
export {
|
|
244
|
-
|
|
252
|
+
_e as ThemeSettings
|
|
245
253
|
};
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import './TipsOfTheDay.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
2
|
+
import { Icon as t } from "../Icon/Icon2.js";
|
|
3
|
+
import { libMessages as s } from "../../contexts/LanguageContext/libMessages.js";
|
|
4
|
+
import { useMessages as n } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { Card as p } from "../Card/Card2.js";
|
|
4
6
|
/* empty css */
|
|
5
7
|
import "react";
|
|
6
|
-
import { jsx as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
9
|
+
var i = (r, o) => Math.floor(Math.random() * (o - r + 1) + r), g = ({ list: r }) => {
|
|
10
|
+
const o = n(s), m = i(0, r.length - 1);
|
|
11
|
+
return /* @__PURE__ */ a(p, {
|
|
10
12
|
className: "tips-of-the-day",
|
|
11
13
|
children: [
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
"
|
|
15
|
-
|
|
14
|
+
/* @__PURE__ */ a("h3", { children: [
|
|
15
|
+
/* @__PURE__ */ e(t, { name: "sparkle" }),
|
|
16
|
+
" ",
|
|
17
|
+
o.tipOfTheDay,
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ e(t, { name: "sparkle" })
|
|
16
20
|
] }),
|
|
17
21
|
" ",
|
|
18
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ e("h4", { children: r[m] })
|
|
19
23
|
]
|
|
20
24
|
});
|
|
21
25
|
};
|
|
22
26
|
export {
|
|
23
|
-
|
|
27
|
+
g as TipsOfTheDay
|
|
24
28
|
};
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
import './Toast.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import {
|
|
2
|
+
import { Icon as n } from "../Icon/Icon2.js";
|
|
3
|
+
import { libMessages as p } from "../../contexts/LanguageContext/libMessages.js";
|
|
4
|
+
import { useMessages as f } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { Tooltip as u } from "../Tooltip/Tooltip2.js";
|
|
4
6
|
/* empty css */
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { jsx as t, jsxs as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
import { useEffect as d } from "react";
|
|
8
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
9
|
+
var j = ({ message: r, type: a = "success", onClose: s, position: i = "top-right", showDismissButton: m = !0, timeout: o = 3e3, action: e }) => {
|
|
10
|
+
const c = f(p);
|
|
11
|
+
return d(() => {
|
|
12
|
+
const l = setTimeout(() => {
|
|
13
|
+
s();
|
|
14
|
+
}, o);
|
|
15
|
+
return () => clearTimeout(l);
|
|
16
|
+
}, [s, o]), /* @__PURE__ */ h("div", {
|
|
17
|
+
className: `toast toast--fixed toast-${a} toast--${i}`,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ t("span", {
|
|
20
|
+
className: "toast__message",
|
|
21
|
+
children: r
|
|
22
|
+
}),
|
|
23
|
+
e && /* @__PURE__ */ t("button", {
|
|
24
|
+
className: "toast__action",
|
|
25
|
+
onClick: e.onClick,
|
|
26
|
+
children: e.label
|
|
27
|
+
}),
|
|
28
|
+
m && /* @__PURE__ */ t(u, {
|
|
29
|
+
title: c.close,
|
|
30
|
+
children: /* @__PURE__ */ t("button", {
|
|
31
|
+
className: "toast__close",
|
|
32
|
+
onClick: s,
|
|
33
|
+
children: /* @__PURE__ */ t(n, {
|
|
34
|
+
name: "clear",
|
|
35
|
+
size: "sm"
|
|
36
|
+
})
|
|
32
37
|
})
|
|
33
38
|
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
37
42
|
export {
|
|
38
|
-
|
|
43
|
+
j as Toast
|
|
39
44
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tool-button--active.button,.tool-button--active.button:hover{background:var(--list-hover-background-color);color:var(--body-accent-color)}.tool-button--danger.button:not(:disabled),.tool-button--danger.button:not(:disabled):hover{color:var(--body-danger-color)}.tool-button--mirrored svg{transform:scaleX(-1)}.tool-button__badged{display:flex;position:relative}.tool-button__badged--disabled{opacity:.5}.tool-button__badge{padding:0 var(--spacing-2);border-radius:var(--radius-sm);background:var(--body-accent-color);color:var(--button-info-color);font-size:var(--font-size-xxs);font-weight:var(--font-weight-bold);line-height:var(--line-height-tight);pointer-events:none;position:absolute;bottom:0;right:0}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './ToolButton.css';
|
|
2
|
+
import { Button as p } from "../Button/Button2.js";
|
|
3
|
+
import { Tooltip as d } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
|
6
|
+
var v = ({ icon: r, hint: a, onClick: s, disabled: o, active: e, danger: i, mirrored: m, badge: n, hintPosition: u = "bottom", className: b }) => {
|
|
7
|
+
const c = [
|
|
8
|
+
"tool-button",
|
|
9
|
+
m && "tool-button--mirrored",
|
|
10
|
+
i && "tool-button--danger",
|
|
11
|
+
e && "tool-button--active",
|
|
12
|
+
b
|
|
13
|
+
].filter(Boolean).join(" "), l = /* @__PURE__ */ t(p, {
|
|
14
|
+
variant: "plain",
|
|
15
|
+
size: "small",
|
|
16
|
+
icon: r,
|
|
17
|
+
onClick: s,
|
|
18
|
+
disabled: o,
|
|
19
|
+
className: c
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ t(d, {
|
|
22
|
+
title: a,
|
|
23
|
+
position: u,
|
|
24
|
+
disabled: o,
|
|
25
|
+
children: n ? /* @__PURE__ */ _("span", {
|
|
26
|
+
className: `tool-button__badged${o ? " tool-button__badged--disabled" : ""}`,
|
|
27
|
+
children: [l, /* @__PURE__ */ t("span", {
|
|
28
|
+
className: "tool-button__badge",
|
|
29
|
+
children: n
|
|
30
|
+
})]
|
|
31
|
+
}) : l
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
v as ToolButton
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tool-palette{--tool-palette-slot:38px;align-items:center;gap:var(--spacing-12);padding:var(--spacing-8) var(--spacing-4);background:var(--card-background-color);border-right:1px solid var(--border-color);flex-direction:column;flex:none;display:flex}.tool-palette__tools{width:calc(var(--tool-palette-slot) * var(--tool-palette-columns));flex-wrap:wrap;display:flex}.tool-palette__slot{width:var(--tool-palette-slot);justify-content:center;display:flex;position:relative}.tool-palette__slot--grouped:after{right:var(--spacing-2);bottom:var(--spacing-2);border-bottom:var(--spacing-4) solid var(--body-color-muted);border-left:var(--spacing-4) solid transparent;content:"";pointer-events:none;width:0;height:0;position:absolute}.tool-palette__menu{min-width:200px;padding:var(--spacing-4);flex-direction:column;display:flex}.tool-palette__menu-item.button{justify-content:flex-start;width:100%}.tool-palette__menu-item--active.button{color:var(--body-accent-color)}.tool-palette__menu-label{text-align:left;flex:1}.tool-palette__menu-shortcut{margin-left:var(--spacing-24);color:var(--body-color-muted);font-size:var(--font-size-xs)}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import './ToolPalette.css';
|
|
2
|
+
import { Button as v } from "../Button/Button2.js";
|
|
3
|
+
import { ContextMenu as w } from "../ContextMenu/ContextMenu2.js";
|
|
4
|
+
import { ToolButton as j } from "../ToolButton/ToolButton2.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { useState as m } from "react";
|
|
7
|
+
import { jsx as e, jsxs as _ } from "react/jsx-runtime";
|
|
8
|
+
var D = ({ items: f, activeId: n, onSelect: x, columns: $ = 2, children: b, className: h }) => {
|
|
9
|
+
const c = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const t of f) {
|
|
11
|
+
const o = t.group ?? t.id;
|
|
12
|
+
c.set(o, [...c.get(o) ?? [], t]);
|
|
13
|
+
}
|
|
14
|
+
const [y, C] = m({}), [s, a] = m(null), i = (t) => t.group ?? t.id, p = (t) => t.find((o) => o.id === n) ?? t.find((o) => o.id === y[i(t[0])]) ?? t[0], r = (t) => {
|
|
15
|
+
C((o) => ({
|
|
16
|
+
...o,
|
|
17
|
+
[i(t)]: t.id
|
|
18
|
+
})), x(t.id);
|
|
19
|
+
}, N = (t) => {
|
|
20
|
+
const o = p(t);
|
|
21
|
+
o.id !== n || t.length === 1 ? r(o) : r(t[(t.indexOf(o) + 1) % t.length]);
|
|
22
|
+
}, k = (t, o) => {
|
|
23
|
+
t.preventDefault(), o.length > 1 && a({
|
|
24
|
+
group: o,
|
|
25
|
+
x: t.clientX,
|
|
26
|
+
y: t.clientY
|
|
27
|
+
});
|
|
28
|
+
}, u = (t) => t.shortcut ? `${t.label} (${t.shortcut})` : t.label, M = { "--tool-palette-columns": $ };
|
|
29
|
+
return /* @__PURE__ */ _("nav", {
|
|
30
|
+
className: `tool-palette${h ? ` ${h}` : ""}`,
|
|
31
|
+
style: M,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ e("div", {
|
|
34
|
+
className: "tool-palette__tools",
|
|
35
|
+
children: [...c.values()].map((t) => {
|
|
36
|
+
const o = p(t), d = t.filter((l) => l !== o).map((l) => l.label);
|
|
37
|
+
return /* @__PURE__ */ e("span", {
|
|
38
|
+
className: `tool-palette__slot${t.length > 1 ? " tool-palette__slot--grouped" : ""}`,
|
|
39
|
+
onContextMenu: (l) => k(l, t),
|
|
40
|
+
children: /* @__PURE__ */ e(j, {
|
|
41
|
+
icon: o.icon,
|
|
42
|
+
hint: d.length > 0 ? `${u(o)} · also ${d.join(", ")}` : u(o),
|
|
43
|
+
hintPosition: "right",
|
|
44
|
+
onClick: () => N(t),
|
|
45
|
+
active: o.id === n
|
|
46
|
+
})
|
|
47
|
+
}, i(o));
|
|
48
|
+
})
|
|
49
|
+
}),
|
|
50
|
+
b,
|
|
51
|
+
s && /* @__PURE__ */ e(w, {
|
|
52
|
+
position: {
|
|
53
|
+
x: s.x,
|
|
54
|
+
y: s.y
|
|
55
|
+
},
|
|
56
|
+
onClose: () => a(null),
|
|
57
|
+
autoClose: !0,
|
|
58
|
+
children: /* @__PURE__ */ e("div", {
|
|
59
|
+
className: "tool-palette__menu",
|
|
60
|
+
children: s.group.map((t) => /* @__PURE__ */ _(v, {
|
|
61
|
+
variant: "plain",
|
|
62
|
+
size: "small",
|
|
63
|
+
icon: t.icon,
|
|
64
|
+
className: `tool-palette__menu-item${t.id === n ? " tool-palette__menu-item--active" : ""}`,
|
|
65
|
+
onClick: () => {
|
|
66
|
+
a(null), r(t);
|
|
67
|
+
},
|
|
68
|
+
children: [/* @__PURE__ */ e("span", {
|
|
69
|
+
className: "tool-palette__menu-label",
|
|
70
|
+
children: t.label
|
|
71
|
+
}), t.shortcut && /* @__PURE__ */ e("span", {
|
|
72
|
+
className: "tool-palette__menu-shortcut",
|
|
73
|
+
children: t.shortcut
|
|
74
|
+
})]
|
|
75
|
+
}, t.id))
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
D as ToolPalette
|
|
83
|
+
};
|