@layers-app/shared 0.4.1 → 0.4.2
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/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +55 -59
- package/dist/components/AttachmentsGalleryModal/styles.module.css.js +24 -22
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +109 -83
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerList.js +62 -63
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +128 -120
- package/dist/components/ColorPicker/icons.js +3 -3
- package/dist/components/ColorPicker/types.d.ts +3 -1
- package/dist/components/ColorPicker/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/types.js +11 -5
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.js +55 -45
- package/dist/components/FilePicker/FilePicker.d.ts +3 -1
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +44 -42
- package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -1
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +28 -28
- package/dist/components/LanguagePicker/LanguagePicker.d.ts +13 -3
- package/dist/components/LanguagePicker/LanguagePicker.d.ts.map +1 -1
- package/dist/components/LanguagePicker/LanguagePicker.js +65 -43
- package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts +6 -1
- package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts.map +1 -1
- package/dist/components/OnboardingTour/OnboardingTourFooter.js +39 -21
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts +4 -5
- package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts.map +1 -1
- package/dist/components/OnboardingTour/OnboardingTourWrapper.js +86 -118
- package/dist/components/OnboardingTour/index.d.ts +1 -1
- package/dist/components/OnboardingTour/index.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts +4 -0
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.js +65 -36
- package/dist/components/UserAvatar/index.d.ts.map +1 -1
- package/dist/components/UserAvatar/index.js +38 -31
- package/dist/config/brand.d.ts +2 -0
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +28 -22
- package/dist/config/envConfig.d.ts +4 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +445 -439
- package/dist/lang/locales/ui_ru.json.js +1 -1
- package/dist/store/featureProgress.d.ts +3 -6
- package/dist/store/featureProgress.d.ts.map +1 -1
- package/dist/store/featureProgress.js +56 -22
- package/dist/store/plansModal.d.ts.map +1 -1
- package/dist/store/plansModal.js +10 -10
- package/package.json +2 -2
|
@@ -1,63 +1,72 @@
|
|
|
1
1
|
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { openRemoveConfirmModal as
|
|
2
|
+
import { useRef as C, useEffect as u } from "react";
|
|
3
|
+
import { useTranslation as k } from "react-i18next";
|
|
4
|
+
import { openRemoveConfirmModal as P } from "../modals/RemoveConfirmModal.js";
|
|
5
5
|
import w from "./CommentComposer.module.css.js";
|
|
6
|
-
const
|
|
7
|
-
children:
|
|
8
|
-
onSubmit:
|
|
9
|
-
editorRef:
|
|
10
|
-
commentDraft:
|
|
6
|
+
const M = ({
|
|
7
|
+
children: b,
|
|
8
|
+
onSubmit: E,
|
|
9
|
+
editorRef: m,
|
|
10
|
+
commentDraft: f,
|
|
11
11
|
onBlur: c,
|
|
12
|
-
inputContainerRef:
|
|
13
|
-
isFloat:
|
|
12
|
+
inputContainerRef: p,
|
|
13
|
+
isFloat: v,
|
|
14
14
|
isEdit: i,
|
|
15
15
|
hasChanges: s,
|
|
16
|
-
ns:
|
|
16
|
+
ns: y
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
const
|
|
18
|
+
const d = C(null), L = i || v, { t: r } = k(y);
|
|
19
|
+
return u(() => {
|
|
20
|
+
const t = (e) => {
|
|
21
21
|
if (e.code === "Enter" && !e.shiftKey) {
|
|
22
22
|
if (e.stopPropagation(), i ? s : !s) return;
|
|
23
|
-
|
|
23
|
+
d.current && d.current.contains(document.activeElement) && (e.preventDefault(), E());
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
return document.addEventListener("keydown",
|
|
27
|
-
}, [
|
|
26
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
27
|
+
}, [E, i, s]), u(() => {
|
|
28
28
|
if (!L) return;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const t = m.current;
|
|
30
|
+
t && setTimeout(() => {
|
|
31
|
+
t.focus(() => ({ defaultSelection: "rootEnd" }));
|
|
32
32
|
}, 100);
|
|
33
|
-
}, []),
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
33
|
+
}, []), u(() => {
|
|
34
|
+
const t = m.current;
|
|
35
|
+
if (!t) return;
|
|
36
36
|
const e = () => setTimeout(() => {
|
|
37
|
-
|
|
38
|
-
}, 0),
|
|
39
|
-
const n =
|
|
37
|
+
t.focus(() => ({ defaultSelection: "rootEnd" }));
|
|
38
|
+
}, 0), o = (a) => {
|
|
39
|
+
const n = a.target;
|
|
40
40
|
if (!n || n.closest("button") || n.closest("[data-no-focus]")) return;
|
|
41
41
|
if (n.closest("[data-editor-spacer='true']")) {
|
|
42
42
|
e();
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
|
|
45
|
+
const l = n.closest(`.${w.commentComposerWrapper}`);
|
|
46
|
+
if (!l) return;
|
|
47
|
+
const g = l.querySelector("[data-comment-footer]");
|
|
48
|
+
if (!g || !g.contains(n)) return;
|
|
49
|
+
l.querySelector(`.${w.imagePreviewWrapper}`) || l.querySelector(`.${w.filePreviewWrapper}`) || e();
|
|
50
50
|
};
|
|
51
|
-
return document.addEventListener("mousedown",
|
|
52
|
-
}, [
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
52
|
+
}, [m]), u(() => {
|
|
53
|
+
const t = d.current;
|
|
54
|
+
if (!t) return;
|
|
55
|
+
const e = () => {
|
|
56
|
+
requestAnimationFrame(() => {
|
|
57
|
+
p.current?.scrollIntoView({ block: "nearest" });
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return t.addEventListener("paste", e), () => t.removeEventListener("paste", e);
|
|
61
|
+
}, [p]), u(() => {
|
|
62
|
+
const t = (e) => {
|
|
63
|
+
const o = e.target;
|
|
64
|
+
if (!o) return;
|
|
65
|
+
const a = p.current;
|
|
66
|
+
if (a && !a.contains(o) && !(o.closest(".mantine-Modal-root") || o.closest(".floating-text-format-popup") || o.closest('[data-test-id="floating-link-dropdown"]'))) {
|
|
58
67
|
if (i) {
|
|
59
68
|
if (!s) {
|
|
60
|
-
e.stopPropagation(), e.preventDefault(),
|
|
69
|
+
e.stopPropagation(), e.preventDefault(), P({
|
|
61
70
|
title: r("composer.discardTitle"),
|
|
62
71
|
children: r("composer.discardDescription"),
|
|
63
72
|
labels: {
|
|
@@ -75,9 +84,9 @@ const W = ({
|
|
|
75
84
|
c?.();
|
|
76
85
|
return;
|
|
77
86
|
}
|
|
78
|
-
if (
|
|
79
|
-
if (
|
|
80
|
-
e.stopPropagation(), e.preventDefault(),
|
|
87
|
+
if (v) {
|
|
88
|
+
if (f.text.trim() !== "" || (f.files?.length ?? 0) > 0) {
|
|
89
|
+
e.stopPropagation(), e.preventDefault(), P({
|
|
81
90
|
title: r("editor.composer.discardCommentTitle"),
|
|
82
91
|
children: r("editor.composer.discardCommentDescription"),
|
|
83
92
|
labels: {
|
|
@@ -93,11 +102,12 @@ const W = ({
|
|
|
93
102
|
c?.();
|
|
94
103
|
return;
|
|
95
104
|
}
|
|
105
|
+
o.closest('button, [role="button"]') && (window.getSelection()?.removeAllRanges(), document.activeElement?.blur());
|
|
96
106
|
}
|
|
97
107
|
};
|
|
98
|
-
return document.addEventListener("mousedown",
|
|
99
|
-
}, [i,
|
|
108
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
109
|
+
}, [i, v, s, f, c]), /* @__PURE__ */ S("div", { ref: d, children: b });
|
|
100
110
|
};
|
|
101
111
|
export {
|
|
102
|
-
|
|
112
|
+
M as CommentEditorHandler
|
|
103
113
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { type IconSvgElement } from '@hugeicons/react';
|
|
2
3
|
import { FlexProps, FloatingPosition, PopoverProps } from '@mantine/core';
|
|
3
4
|
import { DropzoneProps, FileWithPath } from '@mantine/dropzone';
|
|
4
5
|
import type { BreadcrumbItem, MediaFile } from '../MediaLibrary/types';
|
|
@@ -56,7 +57,8 @@ export type FilePickerProps = PropsWithChildren<{
|
|
|
56
57
|
};
|
|
57
58
|
inline?: boolean;
|
|
58
59
|
tab?: TabType | string;
|
|
60
|
+
uploadIcon?: IconSvgElement;
|
|
59
61
|
}>;
|
|
60
|
-
export declare const FilePicker: ({ onChange, onRemove, onUpload, uploading, showTabs, children, width, position, readOnly, hasImage, giphyToken: _giphyToken, unsplashClientId: _unsplashClientId, type, galleryCollection, isValidMediaUrl, popoverProps, dropZoneProps, targetProps, onOpenedChange, googleDrive, mediaLibrary, inline, tab: tabProp, }: PropsWithChildren<FilePickerProps>) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare const FilePicker: ({ onChange, onRemove, onUpload, uploading, showTabs, children, width, position, readOnly, hasImage, giphyToken: _giphyToken, unsplashClientId: _unsplashClientId, type, galleryCollection, isValidMediaUrl, popoverProps, dropZoneProps, targetProps, onOpenedChange, googleDrive, mediaLibrary, inline, tab: tabProp, uploadIcon, }: PropsWithChildren<FilePickerProps>) => import("react/jsx-runtime").JSX.Element;
|
|
61
63
|
export {};
|
|
62
64
|
//# sourceMappingURL=FilePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilePicker.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePicker.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { useState as E, useMemo as u, useEffect as
|
|
3
|
-
import { useTranslation as
|
|
2
|
+
import { useState as E, useMemo as u, useEffect as le } from "react";
|
|
3
|
+
import { useTranslation as ie } from "react-i18next";
|
|
4
4
|
import { ImageAdd02Icon as V } from "@hugeicons/core-free-icons";
|
|
5
5
|
import { HugeiconsIcon as j } from "@hugeicons/react";
|
|
6
|
-
import { Flex as r, ActionIcon as
|
|
6
|
+
import { Flex as r, ActionIcon as re, Button as A, Text as ae, Tabs as x, Box as oe, Popover as F, Stack as se } from "@mantine/core";
|
|
7
7
|
import { getEnvConfig as L } from "../../config/envConfig.js";
|
|
8
|
-
import { isFeature as
|
|
9
|
-
import { useMenu as
|
|
10
|
-
import { usePlatform as
|
|
11
|
-
import { MediaLibraryBrowser as
|
|
12
|
-
import { FilePickerGallery as
|
|
13
|
-
import { FilePickerGiphy as
|
|
14
|
-
import { FilePickerLink as
|
|
15
|
-
import { FilePickerUnsplash as
|
|
16
|
-
import { FilePickerGoogleDrive as
|
|
17
|
-
import { FilePickerUpload as
|
|
18
|
-
import { coverCollections as
|
|
8
|
+
import { isFeature as te } from "../../helpers/feature.js";
|
|
9
|
+
import { useMenu as ce } from "../../hooks/useMenu.js";
|
|
10
|
+
import { usePlatform as de } from "../../hooks/usePlatform.js";
|
|
11
|
+
import { MediaLibraryBrowser as ue } from "../MediaLibrary/MediaLibraryBrowser.js";
|
|
12
|
+
import { FilePickerGallery as he } from "./FilePickerGallery.js";
|
|
13
|
+
import { FilePickerGiphy as pe } from "./FilePickerGiphy.js";
|
|
14
|
+
import { FilePickerLink as me } from "./FilePickerLink.js";
|
|
15
|
+
import { FilePickerUnsplash as fe } from "./FilePickerUnsplash.js";
|
|
16
|
+
import { FilePickerGoogleDrive as ge } from "./FilePickerGoogleDrive.js";
|
|
17
|
+
import { FilePickerUpload as ve } from "./FilePickerUpload.js";
|
|
18
|
+
import { coverCollections as be } from "./coverCollections.js";
|
|
19
19
|
import w from "./FilePicker.module.css.js";
|
|
20
|
-
const
|
|
20
|
+
const Ce = [
|
|
21
21
|
"gallery",
|
|
22
22
|
"upload",
|
|
23
23
|
"link",
|
|
@@ -25,19 +25,19 @@ const be = [
|
|
|
25
25
|
"giphy",
|
|
26
26
|
"googleDrive",
|
|
27
27
|
"media"
|
|
28
|
-
],
|
|
28
|
+
], He = ({
|
|
29
29
|
onChange: N,
|
|
30
30
|
onRemove: U,
|
|
31
31
|
onUpload: b,
|
|
32
32
|
uploading: _ = !1,
|
|
33
|
-
showTabs: o =
|
|
33
|
+
showTabs: o = Ce,
|
|
34
34
|
children: H,
|
|
35
35
|
width: O = 610,
|
|
36
36
|
position: R = "bottom-end",
|
|
37
37
|
readOnly: $ = !1,
|
|
38
38
|
hasImage: q,
|
|
39
|
-
giphyToken:
|
|
40
|
-
unsplashClientId:
|
|
39
|
+
giphyToken: ke,
|
|
40
|
+
unsplashClientId: ye,
|
|
41
41
|
type: S = "image",
|
|
42
42
|
galleryCollection: h = [],
|
|
43
43
|
isValidMediaUrl: J,
|
|
@@ -48,9 +48,10 @@ const be = [
|
|
|
48
48
|
googleDrive: l,
|
|
49
49
|
mediaLibrary: a,
|
|
50
50
|
inline: p = !1,
|
|
51
|
-
tab: C
|
|
51
|
+
tab: C,
|
|
52
|
+
uploadIcon: Y
|
|
52
53
|
}) => {
|
|
53
|
-
const { t: i } =
|
|
54
|
+
const { t: i } = ie("ui"), [T, m] = E(!1), { isMobile: I } = ce(), M = de(), f = u(() => h.length > 0 ? h : p ? be.map((n) => ({
|
|
54
55
|
...n,
|
|
55
56
|
title: i(`coverGroups.${n.id}`, { defaultValue: n.id })
|
|
56
57
|
})) : h, [h, p, i]), s = u(() => [
|
|
@@ -89,7 +90,7 @@ const be = [
|
|
|
89
90
|
{
|
|
90
91
|
value: "media",
|
|
91
92
|
label: /* @__PURE__ */ e(r, { children: /* @__PURE__ */ e("span", { children: i("changeCover.media", { defaultValue: "Media" }) }) }),
|
|
92
|
-
visible: o.includes("media") && !!a &&
|
|
93
|
+
visible: o.includes("media") && !!a && te()
|
|
93
94
|
}
|
|
94
95
|
].filter((y) => y.visible), [
|
|
95
96
|
o,
|
|
@@ -99,17 +100,17 @@ const be = [
|
|
|
99
100
|
b,
|
|
100
101
|
l,
|
|
101
102
|
a
|
|
102
|
-
]), g = C !== void 0, [
|
|
103
|
-
|
|
103
|
+
]), g = C !== void 0, [Z, P] = E(() => C !== void 0 ? "" : s[0]?.value ?? "");
|
|
104
|
+
le(() => {
|
|
104
105
|
g || s.length && P((n) => n && s.some((y) => y.value === n) ? n : s[0].value);
|
|
105
106
|
}, [s, g]);
|
|
106
|
-
const k = u(() => s.map((n) => n.value), [s]), v = g ? C :
|
|
107
|
+
const k = u(() => s.map((n) => n.value), [s]), v = g ? C : Z, t = u(() => v && k.includes(v) ? v : k[0] ?? "", [v, k]), z = (n) => {
|
|
107
108
|
g || P(n);
|
|
108
|
-
},
|
|
109
|
+
}, D = (n) => {
|
|
109
110
|
b?.(n, m);
|
|
110
111
|
}, c = (n) => {
|
|
111
112
|
N?.(n), p || m(!1);
|
|
112
|
-
},
|
|
113
|
+
}, ee = u(() => I ? /* @__PURE__ */ d(re, { size: "lg", children: [
|
|
113
114
|
/* @__PURE__ */ e(j, { icon: V, size: 22 }),
|
|
114
115
|
" "
|
|
115
116
|
] }) : /* @__PURE__ */ e(
|
|
@@ -118,39 +119,40 @@ const be = [
|
|
|
118
119
|
variant: "default",
|
|
119
120
|
size: "xs",
|
|
120
121
|
leftSection: /* @__PURE__ */ e(j, { icon: V, size: 16 }),
|
|
121
|
-
children: /* @__PURE__ */ e(
|
|
122
|
+
children: /* @__PURE__ */ e(ae, { fw: 600, size: "sm", children: i("changeCover.change") })
|
|
122
123
|
}
|
|
123
124
|
), [i, I]), G = (n) => {
|
|
124
125
|
m(n), X?.(n);
|
|
125
|
-
}, B = /* @__PURE__ */ d(
|
|
126
|
+
}, B = /* @__PURE__ */ d(se, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
|
|
126
127
|
t === "gallery" && !!f.length && /* @__PURE__ */ e(
|
|
127
|
-
|
|
128
|
+
he,
|
|
128
129
|
{
|
|
129
130
|
galleryCollection: f,
|
|
130
131
|
onChange: c
|
|
131
132
|
}
|
|
132
133
|
),
|
|
133
134
|
t === "upload" && /* @__PURE__ */ e(
|
|
134
|
-
|
|
135
|
+
ve,
|
|
135
136
|
{
|
|
136
137
|
type: S || "image",
|
|
137
138
|
uploading: _,
|
|
138
139
|
dropZoneProps: Q,
|
|
139
|
-
onUpload:
|
|
140
|
+
onUpload: D,
|
|
141
|
+
icon: Y
|
|
140
142
|
}
|
|
141
143
|
),
|
|
142
144
|
t === "link" && /* @__PURE__ */ e(
|
|
143
|
-
|
|
145
|
+
me,
|
|
144
146
|
{
|
|
145
147
|
type: S || "image",
|
|
146
148
|
onChange: c,
|
|
147
149
|
isValidMediaUrl: J
|
|
148
150
|
}
|
|
149
151
|
),
|
|
150
|
-
t === "unsplash" && /* @__PURE__ */ e(
|
|
151
|
-
t === "giphy" && /* @__PURE__ */ e(
|
|
152
|
+
t === "unsplash" && /* @__PURE__ */ e(fe, { onChange: c }),
|
|
153
|
+
t === "giphy" && /* @__PURE__ */ e(pe, { onChange: c }),
|
|
152
154
|
t === "googleDrive" && l && /* @__PURE__ */ e(
|
|
153
|
-
|
|
155
|
+
ge,
|
|
154
156
|
{
|
|
155
157
|
isConnected: l.isConnected,
|
|
156
158
|
connectedEmail: l.connectedEmail,
|
|
@@ -167,7 +169,7 @@ const be = [
|
|
|
167
169
|
}
|
|
168
170
|
),
|
|
169
171
|
t === "media" && a && /* @__PURE__ */ e(
|
|
170
|
-
|
|
172
|
+
ue,
|
|
171
173
|
{
|
|
172
174
|
items: a.items,
|
|
173
175
|
isLoading: a.isLoading,
|
|
@@ -179,7 +181,7 @@ const be = [
|
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
)
|
|
182
|
-
] }),
|
|
184
|
+
] }), ne = /* @__PURE__ */ e(r, { justify: "space-between", align: "center", children: /* @__PURE__ */ e(
|
|
183
185
|
x,
|
|
184
186
|
{
|
|
185
187
|
defaultValue: "gallery",
|
|
@@ -235,7 +237,7 @@ const be = [
|
|
|
235
237
|
}
|
|
236
238
|
) });
|
|
237
239
|
return p ? /* @__PURE__ */ e(
|
|
238
|
-
|
|
240
|
+
oe,
|
|
239
241
|
{
|
|
240
242
|
"data-file-picker-inline": !0,
|
|
241
243
|
bdrs: 8,
|
|
@@ -255,9 +257,9 @@ const be = [
|
|
|
255
257
|
withinPortal: !0,
|
|
256
258
|
...K || {},
|
|
257
259
|
children: [
|
|
258
|
-
/* @__PURE__ */ e(F.Target, { children: /* @__PURE__ */ e(r, { onClick: () => G(!T), ...W, children: H ??
|
|
260
|
+
/* @__PURE__ */ e(F.Target, { children: /* @__PURE__ */ e(r, { onClick: () => G(!T), ...W, children: H ?? ee }) }),
|
|
259
261
|
/* @__PURE__ */ d(F.Dropdown, { p: 0, children: [
|
|
260
|
-
|
|
262
|
+
ne,
|
|
261
263
|
B
|
|
262
264
|
] })
|
|
263
265
|
]
|
|
@@ -265,5 +267,5 @@ const be = [
|
|
|
265
267
|
);
|
|
266
268
|
};
|
|
267
269
|
export {
|
|
268
|
-
|
|
270
|
+
He as FilePicker
|
|
269
271
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type IconSvgElement } from '@hugeicons/react';
|
|
1
2
|
import { DropzoneProps, FileWithPath } from '@mantine/dropzone';
|
|
2
3
|
import { FileType } from './types';
|
|
3
4
|
import '@mantine/dropzone/styles.css';
|
|
4
|
-
export declare const FilePickerUpload: ({ type, uploading, dropZoneProps, onUpload, }: {
|
|
5
|
+
export declare const FilePickerUpload: ({ type, uploading, dropZoneProps, onUpload, icon, }: {
|
|
5
6
|
type?: FileType;
|
|
6
7
|
uploading: boolean;
|
|
7
8
|
dropZoneProps?: Omit<DropzoneProps, "onDrop">;
|
|
8
9
|
onUpload: (files: FileWithPath[]) => void;
|
|
10
|
+
icon?: IconSvgElement;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
//# sourceMappingURL=FilePickerUpload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAEL,aAAa,EAEb,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,OAAO,8BAA8B,CAAC;AAEtC,eAAO,MAAM,gBAAgB,GAAI,qDAM9B;IACD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,4CA6GA,CAAC"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Image02Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as d } from "react";
|
|
3
|
+
import { useTranslation as k, Trans as v } from "react-i18next";
|
|
4
|
+
import { Image02Icon as I } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as E } from "@hugeicons/react";
|
|
6
6
|
import { Stack as x, Text as s } from "@mantine/core";
|
|
7
|
-
import { Dropzone as
|
|
7
|
+
import { Dropzone as N, IMAGE_MIME_TYPE as T } from "@mantine/dropzone";
|
|
8
8
|
import { showNotification as h } from "@mantine/notifications";
|
|
9
9
|
import { getMaxUploadSize as g } from "../../config/envConfig.js";
|
|
10
|
-
import { showErrorNotification as
|
|
11
|
-
import
|
|
10
|
+
import { showErrorNotification as b } from "../../helpers/showNotifications.js";
|
|
11
|
+
import j from "./FilePicker.module.css.js";
|
|
12
12
|
import "@mantine/dropzone/styles.css";
|
|
13
|
-
const
|
|
13
|
+
const q = ({
|
|
14
14
|
type: a = "image",
|
|
15
15
|
uploading: u,
|
|
16
16
|
dropZoneProps: i,
|
|
17
|
-
onUpload: c
|
|
17
|
+
onUpload: c,
|
|
18
|
+
icon: y
|
|
18
19
|
}) => {
|
|
19
|
-
const { t: e } =
|
|
20
|
+
const { t: e } = k("ui"), l = i?.maxSize != null ? Math.round(i.maxSize / (1024 * 1024)) : Math.round((g() ?? 5 * 1024 * 1024) / (1024 * 1024)), m = `filePicker.description.${a}`, z = `filePicker.dropFileHere.${a}`, f = (() => {
|
|
20
21
|
const r = e(m, { maxSize: l });
|
|
21
22
|
return r !== m ? r : null;
|
|
22
|
-
})(),
|
|
23
|
+
})(), M = d(
|
|
23
24
|
(r) => {
|
|
24
25
|
if (r.filter(
|
|
25
26
|
(t) => t.errors.some((n) => n.code === "file-invalid-type")
|
|
@@ -31,7 +32,7 @@ const Y = ({
|
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
if (r.some((t) => t.errors.some((n) => n.code === "file-too-large"))) {
|
|
34
|
-
|
|
35
|
+
b({
|
|
35
36
|
title: e("errorMessage"),
|
|
36
37
|
message: e("filePicker.errors.shouldNotExceed", { maxSize: l })
|
|
37
38
|
});
|
|
@@ -48,21 +49,21 @@ const Y = ({
|
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
[e, l]
|
|
51
|
-
),
|
|
52
|
+
), S = d(c, [c]), F = i?.maxSize ?? g() ?? 5 * 1024 * 1024;
|
|
52
53
|
return /* @__PURE__ */ o(
|
|
53
|
-
|
|
54
|
+
N,
|
|
54
55
|
{
|
|
55
56
|
loading: u,
|
|
56
|
-
onDrop:
|
|
57
|
-
onReject:
|
|
57
|
+
onDrop: S,
|
|
58
|
+
onReject: M,
|
|
58
59
|
maxFiles: i?.maxFiles || 1,
|
|
59
|
-
maxSize:
|
|
60
|
-
accept:
|
|
60
|
+
maxSize: F,
|
|
61
|
+
accept: T,
|
|
61
62
|
px: 60,
|
|
62
63
|
py: "xl",
|
|
63
|
-
className: `${
|
|
64
|
+
className: `${j.pickerDropZone}`,
|
|
64
65
|
...i || {},
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ p(
|
|
66
67
|
x,
|
|
67
68
|
{
|
|
68
69
|
justify: "center",
|
|
@@ -72,25 +73,24 @@ const Y = ({
|
|
|
72
73
|
style: { pointerEvents: "none" },
|
|
73
74
|
children: [
|
|
74
75
|
/* @__PURE__ */ o(
|
|
75
|
-
|
|
76
|
+
E,
|
|
76
77
|
{
|
|
77
78
|
size: 32,
|
|
78
79
|
color: "var(--mantine-color-bright)",
|
|
79
|
-
icon:
|
|
80
|
+
icon: y ?? I
|
|
80
81
|
}
|
|
81
82
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ p(x, { gap: 8, align: "center", children: [
|
|
83
84
|
/* @__PURE__ */ o(s, { fw: 500, fz: "sm", c: "bright", lh: "sm", ta: "center", children: /* @__PURE__ */ o(
|
|
84
|
-
|
|
85
|
+
v,
|
|
85
86
|
{
|
|
86
87
|
ns: "ui",
|
|
87
|
-
i18nKey:
|
|
88
|
+
i18nKey: z,
|
|
88
89
|
components: {
|
|
89
90
|
choose: /* @__PURE__ */ o(
|
|
90
91
|
s,
|
|
91
92
|
{
|
|
92
93
|
component: "span",
|
|
93
|
-
td: "underline",
|
|
94
94
|
c: "var(--primary-color-text, var(--mantine-primary-color-filled))"
|
|
95
95
|
}
|
|
96
96
|
)
|
|
@@ -106,5 +106,5 @@ const Y = ({
|
|
|
106
106
|
);
|
|
107
107
|
};
|
|
108
108
|
export {
|
|
109
|
-
|
|
109
|
+
q as FilePickerUpload
|
|
110
110
|
};
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComboboxItem, SelectProps } from '@mantine/core';
|
|
2
|
+
export interface LanguagePickerProps {
|
|
2
3
|
value: string;
|
|
3
4
|
onChange: (value: string) => void;
|
|
4
5
|
label?: string;
|
|
6
|
+
/** Override the default 3-language list. */
|
|
7
|
+
data?: ComboboxItem[];
|
|
8
|
+
/** Map of language code → flag SVG src. Items without an entry render no leading flag. */
|
|
9
|
+
flagMap?: Record<string, string>;
|
|
10
|
+
size?: SelectProps['size'];
|
|
11
|
+
radius?: SelectProps['radius'];
|
|
12
|
+
variant?: SelectProps['variant'];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
searchable?: boolean;
|
|
15
|
+
withinPortal?: boolean;
|
|
5
16
|
}
|
|
6
|
-
export declare const LanguagePicker: ({ value, onChange, label, }: LanguagePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
17
|
+
export declare const LanguagePicker: ({ value, onChange, label, data, flagMap, size, radius, variant, disabled, searchable, withinPortal, }: LanguagePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
18
|
//# sourceMappingURL=LanguagePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LanguagePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LanguagePicker/LanguagePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LanguagePicker.d.ts","sourceRoot":"","sources":["../../../src/components/LanguagePicker/LanguagePicker.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAwB,WAAW,EAAE,MAAM,eAAe,CAAC;AAoBhF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,GAAI,uGAY5B,mBAAmB,4CA+DrB,CAAC"}
|