@layers-app/shared 0.3.0 → 0.3.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/assets/default-workspace-avatar.jpg.js +4 -0
- package/dist/assets/layers-logo-full.svg.js +2 -3
- package/dist/assets/layers-logo-full.svg2.js +3 -2
- package/dist/assets/layers-logo-icon.svg.js +2 -3
- package/dist/assets/layers-logo-icon.svg2.js +3 -2
- package/dist/assets/projects/figureA.svg.js +4 -0
- package/dist/assets/projects/figureB.svg.js +4 -0
- package/dist/assets/qwebchannel.d.ts +15 -0
- package/dist/assets/qwebchannel.d.ts.map +1 -0
- package/dist/assets/taskPriorities/high.svg.js +5 -0
- package/dist/assets/taskPriorities/low.svg.js +5 -0
- package/dist/assets/taskPriorities/none.svg.js +5 -0
- package/dist/assets/taskPriorities/normal.svg.js +5 -0
- package/dist/assets/taskPriorities/urgent.svg.js +5 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts +3 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.js +69 -0
- package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +27 -0
- package/dist/components/AnimatedFigurePage/types.d.ts +15 -0
- package/dist/components/AnimatedFigurePage/types.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/useParallax.d.ts +6 -0
- package/dist/components/AnimatedFigurePage/useParallax.d.ts.map +1 -0
- package/dist/components/AnimatedFigurePage/useParallax.js +29 -0
- package/dist/components/AppContainer/AppContainer.d.ts +1 -1
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +37 -36
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +80 -45
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +60 -69
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainer.js +57 -51
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +3 -1
- package/dist/components/AppContainer/types.d.ts +3 -0
- package/dist/components/AppContainer/types.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +88 -74
- package/dist/components/ColorPicker/ColorPicker.module.css.js +31 -0
- package/dist/components/ColorPicker/ColorPickerList.d.ts +6 -0
- package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPickerList.js +134 -0
- package/dist/components/ColorPicker/ColorPickerPopover.d.ts +6 -6
- package/dist/components/ColorPicker/ColorPickerPopover.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerPopover.js +29 -31
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts +13 -0
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPickerToolbar.js +132 -0
- package/dist/components/ColorPicker/icons.d.ts +11 -0
- package/dist/components/ColorPicker/icons.d.ts.map +1 -0
- package/dist/components/ColorPicker/icons.js +71 -0
- package/dist/components/ColorPicker/types.d.ts +49 -0
- package/dist/components/ColorPicker/types.d.ts.map +1 -0
- package/dist/components/ColorPicker/types.js +10 -0
- package/dist/components/ColorPicker/useRecentColors.d.ts +13 -0
- package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -0
- package/dist/components/ColorPicker/useRecentColors.js +39 -0
- package/dist/components/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +115 -111
- package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.js +12 -10
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +3 -1
- package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.js +49 -46
- package/dist/components/EmojiPicker/IconsPanel.d.ts +2 -1
- package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/IconsPanel.js +47 -45
- package/dist/components/EmojiPicker/custom-icons/customIcons.d.ts.map +1 -1
- package/dist/components/EmojiPicker/custom-icons/customIcons.js +66 -31
- package/dist/components/EntityIcon.d.ts +3 -3
- package/dist/components/EntityIcon.d.ts.map +1 -1
- package/dist/components/EntityIcon.js +59 -35
- package/dist/components/EntityTitle/EntityTitle.d.ts +1 -1
- package/dist/components/EntityTitle/EntityTitle.d.ts.map +1 -1
- package/dist/components/EntityTitle/EntityTitle.js +34 -34
- package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +111 -123
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +41 -39
- package/dist/components/FormViewer/components/fields/UploadField/UploadField.d.ts.map +1 -1
- package/dist/components/FormViewer/components/fields/UploadField/UploadField.js +34 -33
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +3 -3
- package/dist/components/Logotype.d.ts +2 -1
- package/dist/components/Logotype.d.ts.map +1 -1
- package/dist/components/Logotype.js +58 -49
- package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuItem.js +122 -107
- package/dist/components/NavMenu/types.d.ts +1 -0
- package/dist/components/NavMenu/types.d.ts.map +1 -1
- package/dist/components/ProjectIcon/ProjectIcon.js +13 -13
- package/dist/components/TreeIndent/TreeIndent.d.ts +9 -0
- package/dist/components/TreeIndent/TreeIndent.d.ts.map +1 -0
- package/dist/components/TreeIndent/TreeIndent.js +15 -0
- package/dist/components/TreeIndent/TreeIndent.module.css.js +11 -0
- package/dist/components/TreeIndent/index.d.ts +2 -0
- package/dist/components/TreeIndent/index.d.ts.map +1 -0
- package/dist/components/WorkspaceAvatar/WorkspaceAvatar.js +11 -11
- package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
- package/dist/components/WorkspaceMenu/WorkspaceMenu.js +97 -101
- package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
- package/dist/config/brand.d.ts +1 -0
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +42 -34
- package/dist/config/envConfig.d.ts +40 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/config/envConfig.js +29 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -4
- package/dist/helpers/getFileIcons.d.ts.map +1 -1
- package/dist/helpers/getFileIcons.js +34 -29
- package/dist/helpers/getFileType.d.ts +1 -1
- package/dist/helpers/getFileType.d.ts.map +1 -1
- package/dist/helpers/getFileType.js +3 -3
- package/dist/helpers/hotjar.d.ts.map +1 -1
- package/dist/helpers/hotjar.js +11 -7
- package/dist/helpers/platform.js +4 -4
- package/dist/helpers/showNotifications.d.ts +3 -0
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +79 -44
- package/dist/hooks/useDateFnsLocale.d.ts +2 -0
- package/dist/hooks/useDateFnsLocale.d.ts.map +1 -1
- package/dist/hooks/useDateFnsLocale.js +9 -8
- package/dist/hooks/useDateUtils.d.ts.map +1 -1
- package/dist/hooks/useDateUtils.js +19 -19
- package/dist/hooks/useFormatDistance.d.ts.map +1 -1
- package/dist/hooks/useFormatDistance.js +6 -6
- package/dist/hooks/useNumberQueryParam.d.ts +1 -1
- package/dist/hooks/useNumberQueryParam.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +516 -494
- package/dist/lang/locales/ui_en.json.js +7 -7
- package/dist/lang/locales/ui_es.json.js +1 -1
- package/dist/lang/locales/ui_ru.json.js +11 -11
- package/dist/utils/formatStorage.d.ts +9 -0
- package/dist/utils/formatStorage.d.ts.map +1 -1
- package/dist/utils/formatStorage.js +14 -10
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useMemo as y } from "react";
|
|
3
|
-
import { useTranslation as
|
|
3
|
+
import { useTranslation as J } from "react-i18next";
|
|
4
4
|
import { ImageAdd02Icon as F } from "@hugeicons/core-free-icons";
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Flex as a, ActionIcon as
|
|
5
|
+
import { HugeiconsIcon as P } from "@hugeicons/react";
|
|
6
|
+
import { Flex as a, ActionIcon as K, Button as M, Text as Q, Popover as u, Tabs as f, Stack as W } from "@mantine/core";
|
|
7
7
|
import { getEnvConfig as S } from "../../config/envConfig.js";
|
|
8
|
-
import { isFeature as
|
|
9
|
-
import { useMenu as
|
|
10
|
-
import { usePlatform as
|
|
11
|
-
import { MediaLibraryBrowser as
|
|
12
|
-
import { FilePickerGallery as
|
|
8
|
+
import { isFeature as X } from "../../helpers/feature.js";
|
|
9
|
+
import { useMenu as Y } from "../../hooks/useMenu.js";
|
|
10
|
+
import { usePlatform as Z } from "../../hooks/usePlatform.js";
|
|
11
|
+
import { MediaLibraryBrowser as $ } from "../MediaLibrary/MediaLibraryBrowser.js";
|
|
12
|
+
import { FilePickerGallery as D } from "./FilePickerGallery.js";
|
|
13
13
|
import { FilePickerGiphy as ee } from "./FilePickerGiphy.js";
|
|
14
|
-
import { FilePickerGoogleDrive as
|
|
14
|
+
import { FilePickerGoogleDrive as ne } from "./FilePickerGoogleDrive.js";
|
|
15
15
|
import { FilePickerLink as ie } from "./FilePickerLink.js";
|
|
16
|
-
import { FilePickerUnsplash as
|
|
16
|
+
import { FilePickerUnsplash as le } from "./FilePickerUnsplash.js";
|
|
17
17
|
import { FilePickerUpload as ae } from "./FilePickerUpload.js";
|
|
18
|
-
import
|
|
18
|
+
import I from "./FilePicker.module.css.js";
|
|
19
19
|
const re = [
|
|
20
20
|
"gallery",
|
|
21
21
|
"upload",
|
|
@@ -25,127 +25,115 @@ const re = [
|
|
|
25
25
|
"googleDrive",
|
|
26
26
|
"media"
|
|
27
27
|
], Se = ({
|
|
28
|
-
onChange:
|
|
29
|
-
onRemove:
|
|
30
|
-
onUpload:
|
|
31
|
-
uploading:
|
|
32
|
-
showTabs:
|
|
33
|
-
children:
|
|
34
|
-
width:
|
|
35
|
-
position:
|
|
36
|
-
readOnly:
|
|
37
|
-
hasImage:
|
|
28
|
+
onChange: z,
|
|
29
|
+
onRemove: B,
|
|
30
|
+
onUpload: m,
|
|
31
|
+
uploading: E = !1,
|
|
32
|
+
showTabs: s = re,
|
|
33
|
+
children: G,
|
|
34
|
+
width: T = 610,
|
|
35
|
+
position: V = "bottom-end",
|
|
36
|
+
readOnly: j = !1,
|
|
37
|
+
hasImage: L,
|
|
38
38
|
giphyToken: se,
|
|
39
39
|
unsplashClientId: oe,
|
|
40
|
-
type:
|
|
40
|
+
type: g = "image",
|
|
41
41
|
galleryCollection: d = [],
|
|
42
|
-
isValidMediaUrl:
|
|
43
|
-
popoverProps:
|
|
44
|
-
dropZoneProps:
|
|
45
|
-
targetProps:
|
|
46
|
-
onOpenedChange:
|
|
42
|
+
isValidMediaUrl: A,
|
|
43
|
+
popoverProps: N,
|
|
44
|
+
dropZoneProps: U,
|
|
45
|
+
targetProps: _,
|
|
46
|
+
onOpenedChange: H,
|
|
47
47
|
googleDrive: i,
|
|
48
|
-
mediaLibrary:
|
|
48
|
+
mediaLibrary: r
|
|
49
49
|
}) => {
|
|
50
|
-
const { t:
|
|
50
|
+
const { t: l } = J("ui"), [v, p] = x(!1), { isMobile: b } = Y(), k = Z(), h = y(
|
|
51
51
|
() => [
|
|
52
52
|
{
|
|
53
53
|
value: "gallery",
|
|
54
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
55
|
-
visible:
|
|
54
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.gallery") }) }),
|
|
55
|
+
visible: s.includes("gallery") && !!d.length
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
value: "upload",
|
|
59
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
60
|
-
visible:
|
|
59
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.upload") }) }),
|
|
60
|
+
visible: s.includes("upload") && !!m
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
value: "link",
|
|
64
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
65
|
-
visible:
|
|
64
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.link") }) }),
|
|
65
|
+
visible: s.includes("link")
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
value: "unsplash",
|
|
69
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
70
|
-
visible:
|
|
69
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.searchImages") }) }),
|
|
70
|
+
visible: s.includes("unsplash") && S().media?.unsplashEnabled !== !1
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
value: "giphy",
|
|
74
74
|
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: "GIFs" }) }),
|
|
75
|
-
visible:
|
|
75
|
+
visible: s.includes("giphy") && k.has("giphy") && S().media?.giphyEnabled !== !1
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
value: "googleDrive",
|
|
79
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
79
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.googleDrive", {
|
|
80
80
|
defaultValue: "Google Drive"
|
|
81
81
|
}) }) }),
|
|
82
|
-
visible:
|
|
82
|
+
visible: s.includes("googleDrive") && !!i
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
value: "media",
|
|
86
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children:
|
|
87
|
-
visible:
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
value: "googleDrive",
|
|
91
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.googleDrive", {
|
|
92
|
-
defaultValue: "Google Drive"
|
|
93
|
-
}) }) }),
|
|
94
|
-
visible: r.includes("googleDrive") && !!i
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
value: "media",
|
|
98
|
-
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.media", { defaultValue: "Media" }) }) }),
|
|
99
|
-
visible: r.includes("media") && !!s && I()
|
|
86
|
+
label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.media", { defaultValue: "Media" }) }) }),
|
|
87
|
+
visible: s.includes("media") && !!r && X()
|
|
100
88
|
}
|
|
101
|
-
].filter((
|
|
89
|
+
].filter((n) => n.visible),
|
|
102
90
|
[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
s,
|
|
92
|
+
k,
|
|
93
|
+
l,
|
|
106
94
|
d.length,
|
|
107
|
-
|
|
95
|
+
m,
|
|
108
96
|
i,
|
|
109
|
-
|
|
97
|
+
r
|
|
110
98
|
]
|
|
111
|
-
), [o,
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
}),
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
/* @__PURE__ */ e(
|
|
99
|
+
), [o, O] = x(() => {
|
|
100
|
+
if (h[0]) return h[0].value;
|
|
101
|
+
const n = h.find((w) => w.visible);
|
|
102
|
+
return n ? n.value : "";
|
|
103
|
+
}), R = (n) => {
|
|
104
|
+
m?.(n, p);
|
|
105
|
+
}, t = (n) => {
|
|
106
|
+
z?.(n), p(!1);
|
|
107
|
+
}, q = y(() => b ? /* @__PURE__ */ c(K, { size: "lg", children: [
|
|
108
|
+
/* @__PURE__ */ e(P, { icon: F, size: 22 }),
|
|
121
109
|
" "
|
|
122
110
|
] }) : /* @__PURE__ */ e(
|
|
123
|
-
|
|
111
|
+
M,
|
|
124
112
|
{
|
|
125
113
|
variant: "default",
|
|
126
114
|
size: "xs",
|
|
127
|
-
leftSection: /* @__PURE__ */ e(
|
|
128
|
-
children: /* @__PURE__ */ e(
|
|
115
|
+
leftSection: /* @__PURE__ */ e(P, { icon: F, size: 16 }),
|
|
116
|
+
children: /* @__PURE__ */ e(Q, { fw: 600, size: "sm", children: l("changeCover.change") })
|
|
129
117
|
}
|
|
130
|
-
), [
|
|
131
|
-
|
|
118
|
+
), [l, b]), C = (n) => {
|
|
119
|
+
p(n), H?.(n);
|
|
132
120
|
};
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
|
|
121
|
+
return /* @__PURE__ */ c(
|
|
122
|
+
u,
|
|
135
123
|
{
|
|
136
|
-
width:
|
|
124
|
+
width: T,
|
|
137
125
|
radius: "var(--mantine-spacing-sm)",
|
|
138
|
-
position:
|
|
126
|
+
position: V,
|
|
139
127
|
shadow: "md",
|
|
140
128
|
opened: v,
|
|
141
|
-
onChange:
|
|
129
|
+
onChange: C,
|
|
142
130
|
withinPortal: !0,
|
|
143
|
-
...
|
|
131
|
+
...N || {},
|
|
144
132
|
children: [
|
|
145
|
-
/* @__PURE__ */ e(
|
|
146
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ e(u.Target, { children: /* @__PURE__ */ e(a, { onClick: () => C(!v), ..._, children: G ?? q }) }),
|
|
134
|
+
/* @__PURE__ */ c(u.Dropdown, { p: 0, children: [
|
|
147
135
|
/* @__PURE__ */ e(a, { justify: "space-between", align: "center", children: /* @__PURE__ */ e(
|
|
148
|
-
|
|
136
|
+
f,
|
|
149
137
|
{
|
|
150
138
|
defaultValue: "gallery",
|
|
151
139
|
value: o,
|
|
@@ -156,8 +144,8 @@ const re = [
|
|
|
156
144
|
}
|
|
157
145
|
},
|
|
158
146
|
w: "100%",
|
|
159
|
-
children: /* @__PURE__ */
|
|
160
|
-
|
|
147
|
+
children: /* @__PURE__ */ c(
|
|
148
|
+
f.List,
|
|
161
149
|
{
|
|
162
150
|
style: {
|
|
163
151
|
gap: "4px"
|
|
@@ -165,21 +153,21 @@ const re = [
|
|
|
165
153
|
px: 8,
|
|
166
154
|
h: 54,
|
|
167
155
|
children: [
|
|
168
|
-
|
|
169
|
-
|
|
156
|
+
h.map((n) => /* @__PURE__ */ e(
|
|
157
|
+
f.Tab,
|
|
170
158
|
{
|
|
171
|
-
className:
|
|
172
|
-
disabled:
|
|
159
|
+
className: I.originalTab,
|
|
160
|
+
disabled: j,
|
|
173
161
|
h: "100%",
|
|
174
162
|
p: 0,
|
|
175
|
-
value:
|
|
176
|
-
onClick: () =>
|
|
177
|
-
children: /* @__PURE__ */ e(a, { className:
|
|
163
|
+
value: n.value,
|
|
164
|
+
onClick: () => O(n.value),
|
|
165
|
+
children: /* @__PURE__ */ e(a, { className: I.customTab, px: "sm", h: 36, children: n.label })
|
|
178
166
|
},
|
|
179
|
-
|
|
167
|
+
n.value
|
|
180
168
|
)),
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
L && /* @__PURE__ */ e(
|
|
170
|
+
M,
|
|
183
171
|
{
|
|
184
172
|
variant: "subtle",
|
|
185
173
|
fz: "sm",
|
|
@@ -187,10 +175,10 @@ const re = [
|
|
|
187
175
|
fw: 500,
|
|
188
176
|
px: "sm",
|
|
189
177
|
size: "30px",
|
|
190
|
-
onClick:
|
|
178
|
+
onClick: B,
|
|
191
179
|
color: "var(--mantine-color-gray-light-color)",
|
|
192
180
|
style: { marginLeft: "auto" },
|
|
193
|
-
children:
|
|
181
|
+
children: l("remove")
|
|
194
182
|
}
|
|
195
183
|
)
|
|
196
184
|
]
|
|
@@ -198,35 +186,35 @@ const re = [
|
|
|
198
186
|
)
|
|
199
187
|
}
|
|
200
188
|
) }),
|
|
201
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ c(W, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
|
|
202
190
|
o === "gallery" && !!d.length && /* @__PURE__ */ e(
|
|
203
|
-
|
|
191
|
+
D,
|
|
204
192
|
{
|
|
205
193
|
galleryCollection: d,
|
|
206
|
-
onChange:
|
|
194
|
+
onChange: t
|
|
207
195
|
}
|
|
208
196
|
),
|
|
209
197
|
o === "upload" && /* @__PURE__ */ e(
|
|
210
198
|
ae,
|
|
211
199
|
{
|
|
212
|
-
type:
|
|
213
|
-
uploading:
|
|
214
|
-
dropZoneProps:
|
|
215
|
-
onUpload:
|
|
200
|
+
type: g || "image",
|
|
201
|
+
uploading: E,
|
|
202
|
+
dropZoneProps: U,
|
|
203
|
+
onUpload: R
|
|
216
204
|
}
|
|
217
205
|
),
|
|
218
206
|
o === "link" && /* @__PURE__ */ e(
|
|
219
207
|
ie,
|
|
220
208
|
{
|
|
221
|
-
type:
|
|
222
|
-
onChange:
|
|
223
|
-
isValidMediaUrl:
|
|
209
|
+
type: g || "image",
|
|
210
|
+
onChange: t,
|
|
211
|
+
isValidMediaUrl: A
|
|
224
212
|
}
|
|
225
213
|
),
|
|
226
|
-
o === "unsplash" && /* @__PURE__ */ e(
|
|
227
|
-
o === "giphy" && /* @__PURE__ */ e(ee, { onChange:
|
|
214
|
+
o === "unsplash" && /* @__PURE__ */ e(le, { onChange: t }),
|
|
215
|
+
o === "giphy" && /* @__PURE__ */ e(ee, { onChange: t }),
|
|
228
216
|
o === "googleDrive" && i && /* @__PURE__ */ e(
|
|
229
|
-
|
|
217
|
+
ne,
|
|
230
218
|
{
|
|
231
219
|
isConnected: i.isConnected,
|
|
232
220
|
connectedEmail: i.connectedEmail,
|
|
@@ -236,22 +224,22 @@ const re = [
|
|
|
236
224
|
isImporting: i.isImporting,
|
|
237
225
|
onSearch: i.onSearch,
|
|
238
226
|
onLoadMore: i.onLoadMore,
|
|
239
|
-
onSelect: (
|
|
240
|
-
i.onSelect(
|
|
227
|
+
onSelect: (n) => {
|
|
228
|
+
i.onSelect(n, t);
|
|
241
229
|
},
|
|
242
230
|
error: i.error
|
|
243
231
|
}
|
|
244
232
|
),
|
|
245
|
-
o === "media" &&
|
|
246
|
-
|
|
233
|
+
o === "media" && r && /* @__PURE__ */ e(
|
|
234
|
+
$,
|
|
247
235
|
{
|
|
248
|
-
items:
|
|
249
|
-
isLoading:
|
|
250
|
-
breadcrumbs:
|
|
251
|
-
onFolderClick:
|
|
252
|
-
onBreadcrumbClick:
|
|
253
|
-
onSelect: (
|
|
254
|
-
|
|
236
|
+
items: r.items,
|
|
237
|
+
isLoading: r.isLoading,
|
|
238
|
+
breadcrumbs: r.breadcrumbs,
|
|
239
|
+
onFolderClick: r.onFolderClick,
|
|
240
|
+
onBreadcrumbClick: r.onBreadcrumbClick,
|
|
241
|
+
onSelect: (n) => {
|
|
242
|
+
r.onSelect?.(n), p(!1);
|
|
255
243
|
}
|
|
256
244
|
}
|
|
257
245
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,aAAa,EAEb,YAAY,EAEb,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,aAAa,EAEb,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,8BAA8B,CAAC;AAEtC,eAAO,MAAM,gBAAgB,GAAI,+CAK9B;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;CAC3C,4CAqGA,CAAC"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Image02Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { Dropzone as
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as d } from "react";
|
|
3
|
+
import { useTranslation as k } from "react-i18next";
|
|
4
|
+
import { Image02Icon as v } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as E } from "@hugeicons/react";
|
|
6
|
+
import { Stack as p, Text as x } from "@mantine/core";
|
|
7
|
+
import { Dropzone as I, IMAGE_MIME_TYPE as T } from "@mantine/dropzone";
|
|
8
8
|
import { showNotification as h } from "@mantine/notifications";
|
|
9
|
-
import {
|
|
9
|
+
import { getMaxUploadSize as g } from "../../config/envConfig.js";
|
|
10
|
+
import { showErrorNotification as b } from "../../helpers/showNotifications.js";
|
|
10
11
|
import "@mantine/dropzone/styles.css";
|
|
11
|
-
const
|
|
12
|
-
type:
|
|
13
|
-
uploading:
|
|
14
|
-
dropZoneProps:
|
|
15
|
-
onUpload:
|
|
12
|
+
const C = ({
|
|
13
|
+
type: s = "image",
|
|
14
|
+
uploading: u,
|
|
15
|
+
dropZoneProps: i,
|
|
16
|
+
onUpload: a
|
|
16
17
|
}) => {
|
|
17
|
-
const { t: e } =
|
|
18
|
+
const { t: e } = k("ui"), l = i?.maxSize != null ? Math.round(i.maxSize / (1024 * 1024)) : Math.round((g() ?? 5 * 1024 * 1024) / (1024 * 1024)), z = `filePicker.dropFileHere.${s}`, c = `filePicker.description.${s}`, F = e(z, {
|
|
18
19
|
defaultValue: e("dropFileHere")
|
|
19
|
-
}),
|
|
20
|
-
const r = e(c, { maxSize:
|
|
20
|
+
}), m = (() => {
|
|
21
|
+
const r = e(c, { maxSize: l });
|
|
21
22
|
return r !== c ? r : null;
|
|
22
|
-
})(),
|
|
23
|
+
})(), M = d(
|
|
23
24
|
(r) => {
|
|
24
25
|
if (r.filter(
|
|
25
|
-
(o) => o.errors.some((
|
|
26
|
+
(o) => o.errors.some((t) => t.code === "file-invalid-type")
|
|
26
27
|
).length > 0) {
|
|
27
28
|
h({
|
|
28
29
|
color: "blue",
|
|
@@ -30,15 +31,15 @@ const $ = ({
|
|
|
30
31
|
});
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
|
-
if (r.some((o) => o.errors.some((
|
|
34
|
-
|
|
34
|
+
if (r.some((o) => o.errors.some((t) => t.code === "file-too-large"))) {
|
|
35
|
+
b({
|
|
35
36
|
title: e("errorMessage"),
|
|
36
|
-
message: e("filePicker.errors.shouldNotExceed")
|
|
37
|
+
message: e("filePicker.errors.shouldNotExceed", { maxSize: l })
|
|
37
38
|
});
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
if (r.filter(
|
|
41
|
-
(o) => o.errors.some((
|
|
42
|
+
(o) => o.errors.some((t) => t.code === "too-many-files")
|
|
42
43
|
).length > 0) {
|
|
43
44
|
h({
|
|
44
45
|
color: "blue",
|
|
@@ -47,21 +48,22 @@ const $ = ({
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
|
-
[e]
|
|
51
|
-
),
|
|
51
|
+
[e, l]
|
|
52
|
+
), S = d(a, [a]), y = i?.maxSize ?? g() ?? 5 * 1024 * 1024;
|
|
52
53
|
return /* @__PURE__ */ n(
|
|
53
|
-
|
|
54
|
+
I,
|
|
54
55
|
{
|
|
55
|
-
loading:
|
|
56
|
-
onDrop:
|
|
57
|
-
onReject:
|
|
58
|
-
maxFiles:
|
|
59
|
-
|
|
56
|
+
loading: u,
|
|
57
|
+
onDrop: S,
|
|
58
|
+
onReject: M,
|
|
59
|
+
maxFiles: i?.maxFiles || 1,
|
|
60
|
+
maxSize: y,
|
|
61
|
+
accept: T,
|
|
60
62
|
px: 60,
|
|
61
63
|
py: "xl",
|
|
62
|
-
...
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
-
|
|
64
|
+
...i || {},
|
|
65
|
+
children: /* @__PURE__ */ f(
|
|
66
|
+
p,
|
|
65
67
|
{
|
|
66
68
|
justify: "center",
|
|
67
69
|
gap: "var(--mantine-font-size-xs",
|
|
@@ -70,16 +72,16 @@ const $ = ({
|
|
|
70
72
|
style: { pointerEvents: "none" },
|
|
71
73
|
children: [
|
|
72
74
|
/* @__PURE__ */ n(
|
|
73
|
-
|
|
75
|
+
E,
|
|
74
76
|
{
|
|
75
77
|
size: 32,
|
|
76
78
|
color: "var(--mantine-color-bright)",
|
|
77
|
-
icon:
|
|
79
|
+
icon: v
|
|
78
80
|
}
|
|
79
81
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */ n(
|
|
82
|
-
|
|
82
|
+
/* @__PURE__ */ f(p, { gap: 8, align: "center", children: [
|
|
83
|
+
/* @__PURE__ */ n(x, { fw: 500, fz: "sm", c: "bright", lh: "sm", ta: "center", children: F }),
|
|
84
|
+
m && /* @__PURE__ */ n(x, { fz: "xs", fw: 400, lh: "140%", c: "dimmed", ta: "center", children: m })
|
|
83
85
|
] })
|
|
84
86
|
]
|
|
85
87
|
}
|
|
@@ -88,5 +90,5 @@ const $ = ({
|
|
|
88
90
|
);
|
|
89
91
|
};
|
|
90
92
|
export {
|
|
91
|
-
|
|
93
|
+
C as FilePickerUpload
|
|
92
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/FormViewer/components/fields/UploadField/UploadField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"UploadField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/FormViewer/components/fields/UploadField/UploadField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAW1E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAK/D,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,WAAW,GAAI,qBAGzB;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,4CAsNA,CAAC"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { jsxs as v, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback as S, useMemo as
|
|
2
|
+
import { useCallback as S, useMemo as B } from "react";
|
|
3
3
|
import { useTranslation as V } from "react-i18next";
|
|
4
4
|
import { useMantineTheme as W, parseThemeColor as A, alpha as _, Stack as M, Group as $, Box as G, Text as L, InputError as X } from "@mantine/core";
|
|
5
5
|
import { Dropzone as h } from "@mantine/dropzone";
|
|
6
|
+
import { getMaxUploadSize as q } from "../../../../../config/envConfig.js";
|
|
6
7
|
import { showNotification as f } from "@mantine/notifications";
|
|
7
|
-
import { IconUpload as
|
|
8
|
+
import { IconUpload as H, IconX as J, IconCloudUpload as K } from "@tabler/icons-react";
|
|
8
9
|
import { formatBytes as C } from "../../../../../helpers/formatBytes.js";
|
|
9
|
-
import { useEvent as
|
|
10
|
-
import { getRandomId as
|
|
11
|
-
import { useSteps as
|
|
12
|
-
import { useFormViewerStore as
|
|
13
|
-
import { UploadFile as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
control:
|
|
10
|
+
import { useEvent as P } from "../../../../../hooks/useEvent.js";
|
|
11
|
+
import { getRandomId as Q } from "../../../helpers/steps.js";
|
|
12
|
+
import { useSteps as Y } from "../../../hooks/useCreateFormContext.js";
|
|
13
|
+
import { useFormViewerStore as Z } from "../../../store/formStore.js";
|
|
14
|
+
import { UploadFile as ee } from "./UploadFile/UploadFile.js";
|
|
15
|
+
import oe from "../../../FormViewer.module.css.js";
|
|
16
|
+
const te = () => q() ?? 25 * 1024 * 1024, Fe = ({
|
|
17
|
+
control: s,
|
|
17
18
|
theme: d
|
|
18
19
|
}) => {
|
|
19
|
-
const { t: o } = V("forms"), { form: a } =
|
|
20
|
+
const { t: o } = V("forms"), { form: a } = Y(), { id: r } = s, T = a.values[r], I = a.errors[r], m = s.maxSize || te(), t = s.maxFiles ?? 1, g = s.minFiles ?? 0, U = !!s.multiple || t > 1, l = s.accept && s.accept.length ? s.accept : void 0, { useStore: y } = Z(), E = y((e) => e.editing), R = y((e) => e.preview), b = W(), O = A({
|
|
20
21
|
color: d?.primaryColor || "",
|
|
21
22
|
theme: b
|
|
22
|
-
}), j =
|
|
23
|
-
const c = a.values[
|
|
23
|
+
}), j = y((e) => e.uploadFileFn), F = P((e) => {
|
|
24
|
+
const c = a.values[r]?.findIndex(
|
|
24
25
|
(u) => u.id === e.id
|
|
25
26
|
);
|
|
26
|
-
c !== -1 && a.setFieldValue(`${
|
|
27
|
+
c !== -1 && a.setFieldValue(`${r}.${c}`, e);
|
|
27
28
|
}), k = S(
|
|
28
29
|
(e) => {
|
|
29
30
|
if (e.some(
|
|
@@ -79,7 +80,7 @@ const oe = 25 * 1024 * 1024, ye = ({
|
|
|
79
80
|
[F, j]
|
|
80
81
|
), w = S(
|
|
81
82
|
(e) => {
|
|
82
|
-
const c = a.values[
|
|
83
|
+
const c = a.values[r]?.length || 0, u = typeof t == "number" ? Math.max(0, t - c) : 1 / 0;
|
|
83
84
|
if (u === 0) {
|
|
84
85
|
f({
|
|
85
86
|
message: o("uploadOption.tooManyFiles", { count: t })
|
|
@@ -89,59 +90,59 @@ const oe = 25 * 1024 * 1024, ye = ({
|
|
|
89
90
|
const z = e.slice(0, u);
|
|
90
91
|
z.forEach((p) => {
|
|
91
92
|
const n = {
|
|
92
|
-
id:
|
|
93
|
+
id: Q(),
|
|
93
94
|
file: p,
|
|
94
95
|
isError: !1,
|
|
95
96
|
isLoading: !0,
|
|
96
97
|
isSuccess: !1
|
|
97
98
|
};
|
|
98
|
-
a.insertListItem(
|
|
99
|
+
a.insertListItem(r, n), x(n);
|
|
99
100
|
}), z.length < e.length && f({
|
|
100
101
|
message: o("uploadOption.tooManyFiles", { count: t })
|
|
101
102
|
});
|
|
102
103
|
},
|
|
103
|
-
[a, x,
|
|
104
|
-
),
|
|
104
|
+
[a, x, r, t, o]
|
|
105
|
+
), D = B(() => [
|
|
105
106
|
o("uploadOption.maxSize", { size: C(m) }),
|
|
106
|
-
|
|
107
|
+
g ? o("uploadOption.minFilesWithCount", { count: g }) : "",
|
|
107
108
|
t ? o("uploadOption.maxFilesWithCount", { count: t }) : "",
|
|
108
109
|
l ? o("uploadOption.accept", { types: l.join(", ") }) : ""
|
|
109
|
-
].filter(Boolean).join(" · "), [
|
|
110
|
+
].filter(Boolean).join(" · "), [g, t, l, o, m]), N = {
|
|
110
111
|
"--primary-color": O.value,
|
|
111
112
|
"--primary-color-hover": _(O.value, 0.05)
|
|
112
113
|
};
|
|
113
|
-
return /* @__PURE__ */ v(M, { gap: 8, "data-control-id":
|
|
114
|
+
return /* @__PURE__ */ v(M, { gap: 8, "data-control-id": r, w: "100%", children: [
|
|
114
115
|
(T?.length ?? 0) < t && /* @__PURE__ */ i(
|
|
115
116
|
h,
|
|
116
117
|
{
|
|
117
118
|
radius: d?.borderRadius,
|
|
118
119
|
__size: d?.size,
|
|
119
|
-
disabled:
|
|
120
|
+
disabled: E || R,
|
|
120
121
|
onDrop: w,
|
|
121
122
|
onReject: k,
|
|
122
123
|
maxFiles: t,
|
|
123
124
|
maxSize: m,
|
|
124
125
|
accept: l,
|
|
125
|
-
multiple:
|
|
126
|
+
multiple: U,
|
|
126
127
|
unstyled: !0,
|
|
127
|
-
className:
|
|
128
|
-
style:
|
|
128
|
+
className: oe.dropzone,
|
|
129
|
+
style: N,
|
|
129
130
|
children: /* @__PURE__ */ i($, { justify: "center", py: 24, children: /* @__PURE__ */ v(M, { justify: "center", align: "center", gap: 8, children: [
|
|
130
131
|
/* @__PURE__ */ v(G, { c: "var(--primary-color)", children: [
|
|
131
|
-
/* @__PURE__ */ i(h.Accept, { children: /* @__PURE__ */ i(
|
|
132
|
-
/* @__PURE__ */ i(h.Reject, { children: /* @__PURE__ */ i(
|
|
133
|
-
/* @__PURE__ */ i(h.Idle, { children: /* @__PURE__ */ i(
|
|
132
|
+
/* @__PURE__ */ i(h.Accept, { children: /* @__PURE__ */ i(H, { size: 70, stroke: 1.2 }) }),
|
|
133
|
+
/* @__PURE__ */ i(h.Reject, { children: /* @__PURE__ */ i(J, { size: 70, stroke: 1.2 }) }),
|
|
134
|
+
/* @__PURE__ */ i(h.Idle, { children: /* @__PURE__ */ i(K, { size: 70, stroke: 1.2 }) })
|
|
134
135
|
] }),
|
|
135
136
|
/* @__PURE__ */ i(L, { size: "xl", inline: !0, ta: "center", c: d?.title?.color, children: o("uploadOption.title") }),
|
|
136
|
-
/* @__PURE__ */ i(L, { size: "sm", c: d?.description?.color, mt: 4, children:
|
|
137
|
+
/* @__PURE__ */ i(L, { size: "sm", c: d?.description?.color, mt: 4, children: D })
|
|
137
138
|
] }) })
|
|
138
139
|
}
|
|
139
140
|
),
|
|
140
141
|
T?.map((e) => /* @__PURE__ */ i(
|
|
141
|
-
|
|
142
|
+
ee,
|
|
142
143
|
{
|
|
143
144
|
file: e,
|
|
144
|
-
id:
|
|
145
|
+
id: r,
|
|
145
146
|
onReload: x,
|
|
146
147
|
theme: d
|
|
147
148
|
},
|
|
@@ -151,5 +152,5 @@ const oe = 25 * 1024 * 1024, ye = ({
|
|
|
151
152
|
] });
|
|
152
153
|
};
|
|
153
154
|
export {
|
|
154
|
-
|
|
155
|
+
Fe as UploadField
|
|
155
156
|
};
|