@layers-app/shared 0.2.8 → 0.3.1
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/api/giphy/slice.d.ts +1 -1
- package/dist/api/giphy/slice.d.ts.map +1 -1
- package/dist/api/unsplash/slice.d.ts +1 -1
- package/dist/api/unsplash/slice.d.ts.map +1 -1
- 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 +5 -0
- package/dist/assets/layers-logo-icon.svg.js +2 -3
- package/dist/assets/layers-logo-icon.svg2.js +5 -0
- 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/AliasTextInput/AliasTextInput.d.ts.map +1 -1
- package/dist/components/AliasTextInput/AliasTextInput.js +8 -7
- 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 +120 -120
- 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/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/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +115 -111
- package/dist/components/CommunitiesDialog/index.d.ts.map +1 -1
- package/dist/components/CommunitiesDialog/index.js +47 -46
- package/dist/components/Copyright/index.d.ts.map +1 -1
- package/dist/components/Copyright/index.js +8 -7
- 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 +1 -1
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +144 -152
- package/dist/components/FilePicker/FilePicker.module.css.js +10 -10
- package/dist/components/FilePicker/FilePickerGallery.js +13 -13
- package/dist/components/FilePicker/FilePickerGiphy.d.ts +1 -1
- package/dist/components/FilePicker/FilePickerGiphy.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerGiphy.js +46 -48
- package/dist/components/FilePicker/FilePickerLink.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerLink.js +16 -16
- package/dist/components/FilePicker/FilePickerUnsplash.d.ts +1 -1
- package/dist/components/FilePicker/FilePickerUnsplash.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUnsplash.js +49 -51
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +44 -42
- package/dist/components/FilePicker/api/giphyApi.d.ts +2 -2
- package/dist/components/FilePicker/api/giphyApi.d.ts.map +1 -1
- package/dist/components/FilePicker/api/giphyApi.js +11 -14
- package/dist/components/FilePicker/api/unsplashApi.d.ts +2 -2
- package/dist/components/FilePicker/api/unsplashApi.d.ts.map +1 -1
- package/dist/components/FilePicker/api/unsplashApi.js +14 -19
- package/dist/components/FormViewer/components/fields/SelectableCard/PictureSelectableCard.d.ts.map +1 -1
- package/dist/components/FormViewer/components/fields/SelectableCard/PictureSelectableCard.js +70 -72
- 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/helpers/conditions.d.ts +84 -84
- package/dist/components/FormViewer/helpers/helpers.d.ts +84 -84
- package/dist/components/FormViewer/helpers/steps.d.ts +84 -84
- package/dist/components/FormViewer/helpers/steps.d.ts.map +1 -1
- package/dist/components/FormViewer/helpers/steps.js +22 -21
- package/dist/components/FormViewer/hooks/useActiveControl.d.ts +71 -71
- package/dist/components/FormViewer/hooks/useActiveStep.d.ts +84 -84
- package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +3 -3
- package/dist/components/FormViewer/store/formStore.d.ts +357 -357
- package/dist/components/FormViewer/store/formStoreApi.d.ts +178 -178
- package/dist/components/FormViewer/store/selectors.d.ts +23861 -23861
- package/dist/components/FormViewer/types/schemes.d.ts +1139 -1139
- package/dist/components/Logotype.d.ts +6 -4
- package/dist/components/Logotype.d.ts.map +1 -1
- package/dist/components/Logotype.js +62 -30
- 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/OnBoarding/OnBoardingPage.js +35 -35
- 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 +6 -6
- 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 +49 -0
- package/dist/config/brand.d.ts.map +1 -0
- package/dist/config/brand.js +77 -0
- package/dist/config/envConfig.d.ts +110 -0
- package/dist/config/envConfig.d.ts.map +1 -0
- package/dist/config/envConfig.js +48 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -7
- 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/useDisableWindowScroll.js +3 -3
- 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 +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +505 -487
- package/dist/lang/locales/ui_en.json.js +1 -1
- package/dist/lang/locales/ui_es.json.js +5 -5
- package/dist/lang/locales/ui_ru.json.js +5 -5
- 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 +3 -6
- package/dist/assets/svg/default_icon.svg.js +0 -4
- package/dist/assets/svg/layers-logo-full.svg.js +0 -4
|
@@ -1,79 +1,77 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as l, useMemo as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Search01Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { useDebouncedValue as
|
|
8
|
-
import { NoData as
|
|
9
|
-
import { FilePickerSkeletonLoader as
|
|
10
|
-
import { useGiphyPhotos as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
onChange: r
|
|
2
|
+
import { useState as l, useMemo as x, useEffect as f, useCallback as I } from "react";
|
|
3
|
+
import { useTranslation as S } from "react-i18next";
|
|
4
|
+
import { Search01Icon as P } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as T } from "@hugeicons/react";
|
|
6
|
+
import { Stack as b, FocusTrap as w, TextInput as z, Loader as G, Box as C, SimpleGrid as L, AspectRatio as j, Button as D } from "@mantine/core";
|
|
7
|
+
import { useDebouncedValue as F, useDebouncedCallback as M } from "@mantine/hooks";
|
|
8
|
+
import { NoData as q } from "../NoData/NoData.js";
|
|
9
|
+
import { FilePickerSkeletonLoader as B } from "./FilePickerSkeletonLoader.js";
|
|
10
|
+
import { useGiphyPhotos as N } from "./api/giphyApi.js";
|
|
11
|
+
import Q from "./FilePicker.module.css.js";
|
|
12
|
+
const k = (c) => (c || []).reduce((o, i) => (o[i.id] = i, o), {}), U = ({
|
|
13
|
+
onChange: c
|
|
15
14
|
}) => {
|
|
16
|
-
const { t: o } =
|
|
17
|
-
{ q:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
), f = q(() => {
|
|
15
|
+
const { t: o } = S("ui"), [i, v] = l(""), [m] = F(i, 800), [u, d] = l(1), [p, h] = l({}), { data: r, isLoading: s } = N(
|
|
16
|
+
{ q: m, limit: 24, offset: (u - 1) * 24 + 1 },
|
|
17
|
+
u
|
|
18
|
+
), a = x(
|
|
19
|
+
() => Object.values({ ...p, ...k(r?.items) }),
|
|
20
|
+
[p, r?.items]
|
|
21
|
+
), g = M(() => {
|
|
24
22
|
setTimeout(() => {
|
|
25
|
-
|
|
23
|
+
h((t) => ({ ...t, ...k(r?.items) }));
|
|
26
24
|
}, 0);
|
|
27
25
|
}, 100);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
26
|
+
f(() => {
|
|
27
|
+
g();
|
|
28
|
+
}, [r?.items, g]), f(() => {
|
|
29
|
+
h({});
|
|
30
|
+
}, [m]);
|
|
31
|
+
const y = I(
|
|
34
32
|
(t) => {
|
|
35
|
-
|
|
33
|
+
v(t.currentTarget.value), d(1);
|
|
36
34
|
},
|
|
37
35
|
[]
|
|
38
36
|
);
|
|
39
|
-
return /* @__PURE__ */ n(
|
|
40
|
-
/* @__PURE__ */ e(
|
|
41
|
-
|
|
37
|
+
return /* @__PURE__ */ n(b, { gap: "sm", children: [
|
|
38
|
+
/* @__PURE__ */ e(w, { active: !0, children: /* @__PURE__ */ e(
|
|
39
|
+
z,
|
|
42
40
|
{
|
|
43
|
-
leftSection: s ? /* @__PURE__ */ e(
|
|
41
|
+
leftSection: s ? /* @__PURE__ */ e(G, { size: 16 }) : /* @__PURE__ */ e(T, { size: 16, icon: P }),
|
|
44
42
|
maxLength: 50,
|
|
45
43
|
placeholder: o("changeCover.searchGifs"),
|
|
46
44
|
"data-autofocus": !0,
|
|
47
|
-
value:
|
|
48
|
-
onChange:
|
|
45
|
+
value: i,
|
|
46
|
+
onChange: y
|
|
49
47
|
}
|
|
50
48
|
) }),
|
|
51
|
-
/* @__PURE__ */ n(
|
|
52
|
-
!!a.length && /* @__PURE__ */ n(
|
|
53
|
-
/* @__PURE__ */ e(
|
|
54
|
-
|
|
49
|
+
/* @__PURE__ */ n(C, { mah: 300, w: "100%", style: { overflowY: "auto" }, children: [
|
|
50
|
+
!!a.length && /* @__PURE__ */ n(b, { gap: 8, children: [
|
|
51
|
+
/* @__PURE__ */ e(L, { cols: 4, spacing: 10, children: a.map((t) => /* @__PURE__ */ e(
|
|
52
|
+
j,
|
|
55
53
|
{
|
|
56
|
-
onClick: () =>
|
|
54
|
+
onClick: () => c?.(t.images.original.url),
|
|
57
55
|
ratio: 120 / 65,
|
|
58
|
-
className:
|
|
56
|
+
className: Q.itemImage,
|
|
59
57
|
style: {
|
|
60
58
|
backgroundImage: `url(${t.images.preview_webp.url})`
|
|
61
59
|
}
|
|
62
60
|
},
|
|
63
61
|
t.id
|
|
64
62
|
)) }),
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
r?.hasMore && /* @__PURE__ */ e(
|
|
64
|
+
D,
|
|
67
65
|
{
|
|
68
66
|
variant: "subtle",
|
|
69
67
|
loading: s,
|
|
70
|
-
onClick: () =>
|
|
68
|
+
onClick: () => d((t) => t + 1),
|
|
71
69
|
children: o("loadMode")
|
|
72
70
|
}
|
|
73
71
|
)
|
|
74
72
|
] }),
|
|
75
|
-
!a.length && !s && /* @__PURE__ */ e(
|
|
76
|
-
|
|
73
|
+
!a.length && !s && /* @__PURE__ */ e(C, { pb: 16, children: /* @__PURE__ */ e(
|
|
74
|
+
q,
|
|
77
75
|
{
|
|
78
76
|
size: 120,
|
|
79
77
|
illustration: "noImage",
|
|
@@ -81,10 +79,10 @@ const v = (c) => (c || []).reduce((r, o) => (r[o.id] = o, r), {}), W = ({
|
|
|
81
79
|
titleProps: { size: "xs", c: "dimmed" }
|
|
82
80
|
}
|
|
83
81
|
) }),
|
|
84
|
-
!a.length && s && /* @__PURE__ */ e(
|
|
82
|
+
!a.length && s && /* @__PURE__ */ e(B, {})
|
|
85
83
|
] })
|
|
86
84
|
] });
|
|
87
85
|
};
|
|
88
86
|
export {
|
|
89
|
-
|
|
87
|
+
U as FilePickerGiphy
|
|
90
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerLink.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerLink.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilePickerLink.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerLink.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,eAAO,MAAM,cAAc,GAAI,sCAI5B;IACD,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C,4CAkEA,CAAC"}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as c } from "react-i18next";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
3
|
+
import { Search01Icon as m } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { HugeiconsIcon as d } from "@hugeicons/react";
|
|
5
|
+
import { Stack as f, FocusTrap as p, TextInput as h, Flex as g, Button as v } from "@mantine/core";
|
|
6
|
+
import { useForm as k } from "@mantine/form";
|
|
7
|
+
import { isValidUrl as x, isImageUrl as F, isVideoUrl as I, isAudioUrl as L } from "../../helpers/validation.js";
|
|
8
|
+
import w from "./FilePicker.module.css.js";
|
|
9
9
|
const P = ({
|
|
10
10
|
onChange: a,
|
|
11
11
|
type: o,
|
|
12
12
|
isValidMediaUrl: s
|
|
13
13
|
}) => {
|
|
14
|
-
const { t } = c("ui"), l =
|
|
14
|
+
const { t } = c("ui"), l = k({
|
|
15
15
|
initialValues: {
|
|
16
16
|
url: ""
|
|
17
17
|
},
|
|
18
18
|
validate: {
|
|
19
|
-
url: (e) => (e || "").trim().length > 0 &&
|
|
19
|
+
url: (e) => (e || "").trim().length > 0 && x(e) ? null : t("changeCover.invalidLink")
|
|
20
20
|
}
|
|
21
21
|
}), n = async () => {
|
|
22
22
|
const { values: e } = l;
|
|
23
23
|
let i;
|
|
24
|
-
o === "image" ? i = await
|
|
24
|
+
o === "image" ? i = await F(e.url) : o === "video" ? s && s(e.url) ? i = !0 : i = await I(e.url) : o === "audio" ? i = await L(e.url) : i = !0, i ? a?.(e.url) : l.setFieldError("url", t("changeCover.invalidLink"));
|
|
25
25
|
};
|
|
26
|
-
return /* @__PURE__ */ u(
|
|
27
|
-
/* @__PURE__ */ r(
|
|
28
|
-
|
|
26
|
+
return /* @__PURE__ */ u(f, { gap: "sm", children: [
|
|
27
|
+
/* @__PURE__ */ r(p, { active: !0, children: /* @__PURE__ */ r(
|
|
28
|
+
h,
|
|
29
29
|
{
|
|
30
30
|
maxLength: 500,
|
|
31
31
|
size: "sm",
|
|
32
32
|
placeholder: t("changeCover.pasteLink"),
|
|
33
|
-
leftSection: /* @__PURE__ */ r(
|
|
33
|
+
leftSection: /* @__PURE__ */ r(d, { size: 16, icon: m }),
|
|
34
34
|
"data-autofocus": !0,
|
|
35
35
|
...l.getInputProps("url")
|
|
36
36
|
}
|
|
37
37
|
) }),
|
|
38
|
-
/* @__PURE__ */ r(
|
|
39
|
-
|
|
38
|
+
/* @__PURE__ */ r(g, { justify: "flex-end", align: "center", mt: "sm", children: /* @__PURE__ */ r(
|
|
39
|
+
v,
|
|
40
40
|
{
|
|
41
41
|
onClick: n,
|
|
42
|
-
className:
|
|
42
|
+
className: w.button,
|
|
43
43
|
disabled: !l.values.url,
|
|
44
44
|
children: t("customDrawer.save")
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerUnsplash.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUnsplash.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,kBAAkB,GAAI,
|
|
1
|
+
{"version":3,"file":"FilePickerUnsplash.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUnsplash.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,kBAAkB,GAAI,eAEhC;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,4CAyHA,CAAC"}
|
|
@@ -1,100 +1,98 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as m, useMemo as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Search01Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { useDebouncedValue as
|
|
8
|
-
import { NoData as
|
|
9
|
-
import { FilePickerSkeletonLoader as
|
|
10
|
-
import { useUnsplashPhotos as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
13
|
-
onChange: l
|
|
14
|
-
clientId: s
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useMemo as P, useEffect as f, useCallback as T } from "react";
|
|
3
|
+
import { useTranslation as z } from "react-i18next";
|
|
4
|
+
import { Search01Icon as L } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as j } from "@hugeicons/react";
|
|
6
|
+
import { Stack as k, FocusTrap as B, TextInput as D, Loader as F, Box as c, SimpleGrid as M, AspectRatio as N, Text as C, Button as _ } from "@mantine/core";
|
|
7
|
+
import { useDebouncedValue as q, useDebouncedCallback as w } from "@mantine/hooks";
|
|
8
|
+
import { NoData as A } from "../NoData/NoData.js";
|
|
9
|
+
import { FilePickerSkeletonLoader as Q } from "./FilePickerSkeletonLoader.js";
|
|
10
|
+
import { useUnsplashPhotos as R } from "./api/unsplashApi.js";
|
|
11
|
+
import b from "./FilePicker.module.css.js";
|
|
12
|
+
const y = (l) => (l || []).reduce((r, o) => (r[o.id] = o, r), {}), X = ({
|
|
13
|
+
onChange: l
|
|
15
14
|
}) => {
|
|
16
|
-
const { t: r } =
|
|
15
|
+
const { t: r } = z("ui"), [o, v] = m(""), [u] = q(o, 800), [x, h] = m(1), [p, d] = m({}), { data: a, isLoading: n } = R(
|
|
17
16
|
{
|
|
18
|
-
query:
|
|
19
|
-
page:
|
|
17
|
+
query: u,
|
|
18
|
+
page: x,
|
|
20
19
|
per_page: 24,
|
|
21
20
|
order_by: "popular"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
), f = A(() => {
|
|
21
|
+
}
|
|
22
|
+
), i = P(
|
|
23
|
+
() => Object.values({ ...p, ...y(a?.items) }),
|
|
24
|
+
[p, a?.items]
|
|
25
|
+
), g = w(() => {
|
|
28
26
|
setTimeout(() => {
|
|
29
|
-
|
|
27
|
+
d((t) => ({ ...t, ...y(a?.items) }));
|
|
30
28
|
}, 0);
|
|
31
29
|
}, 100);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
const
|
|
30
|
+
f(() => {
|
|
31
|
+
g();
|
|
32
|
+
}, [a?.items, g]), f(() => {
|
|
33
|
+
d({});
|
|
34
|
+
}, [u]);
|
|
35
|
+
const I = T(
|
|
38
36
|
(t) => {
|
|
39
|
-
|
|
37
|
+
v(t.currentTarget.value), h(1);
|
|
40
38
|
},
|
|
41
39
|
[]
|
|
42
40
|
);
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */ e(
|
|
45
|
-
|
|
41
|
+
return /* @__PURE__ */ s(k, { gap: "sm", children: [
|
|
42
|
+
/* @__PURE__ */ e(B, { active: !0, children: /* @__PURE__ */ e(
|
|
43
|
+
D,
|
|
46
44
|
{
|
|
47
|
-
leftSection: n ? /* @__PURE__ */ e(
|
|
45
|
+
leftSection: n ? /* @__PURE__ */ e(F, { size: 16 }) : /* @__PURE__ */ e(j, { size: 16, icon: L }),
|
|
48
46
|
maxLength: 50,
|
|
49
47
|
placeholder: r("changeCover.searchImage"),
|
|
50
48
|
"data-autofocus": !0,
|
|
51
|
-
value:
|
|
52
|
-
onChange:
|
|
49
|
+
value: o,
|
|
50
|
+
onChange: I
|
|
53
51
|
}
|
|
54
52
|
) }),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
!!i.length && /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */ e(
|
|
53
|
+
/* @__PURE__ */ s(c, { mah: 300, w: "100%", style: { overflowY: "auto" }, children: [
|
|
54
|
+
!!i.length && /* @__PURE__ */ s(k, { gap: 8, children: [
|
|
55
|
+
/* @__PURE__ */ e(M, { cols: 4, spacing: 10, children: i.map((t) => /* @__PURE__ */ s(c, { children: [
|
|
58
56
|
/* @__PURE__ */ e(
|
|
59
|
-
|
|
57
|
+
N,
|
|
60
58
|
{
|
|
61
59
|
onClick: () => l?.(t.urls.regular),
|
|
62
60
|
ratio: 120 / 65,
|
|
63
|
-
className:
|
|
61
|
+
className: b.itemImage,
|
|
64
62
|
style: {
|
|
65
63
|
backgroundImage: `url(${t.urls.small})`
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
),
|
|
69
|
-
/* @__PURE__ */ e(c, { className:
|
|
67
|
+
/* @__PURE__ */ e(c, { className: b.imageAuthor, children: /* @__PURE__ */ s(C, { truncate: !0, c: "gray", size: "xs", children: [
|
|
70
68
|
r("changeCover.photoBy"),
|
|
71
69
|
" ",
|
|
72
70
|
/* @__PURE__ */ e(
|
|
73
|
-
|
|
71
|
+
C,
|
|
74
72
|
{
|
|
75
73
|
component: "a",
|
|
76
74
|
inherit: !0,
|
|
77
75
|
href: t.user.links.html,
|
|
78
76
|
target: "_blank",
|
|
79
77
|
rel: "noopener noreferrer",
|
|
80
|
-
onClick: (
|
|
78
|
+
onClick: (S) => S.stopPropagation(),
|
|
81
79
|
children: t.user.name
|
|
82
80
|
}
|
|
83
81
|
)
|
|
84
82
|
] }) })
|
|
85
83
|
] }, t.id)) }),
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
a?.hasMore && /* @__PURE__ */ e(
|
|
85
|
+
_,
|
|
88
86
|
{
|
|
89
87
|
variant: "subtle",
|
|
90
88
|
loading: n,
|
|
91
|
-
onClick: () =>
|
|
89
|
+
onClick: () => h((t) => t + 1),
|
|
92
90
|
children: r("loadMore")
|
|
93
91
|
}
|
|
94
92
|
)
|
|
95
93
|
] }),
|
|
96
94
|
!i.length && !n && /* @__PURE__ */ e(c, { pb: 16, children: /* @__PURE__ */ e(
|
|
97
|
-
|
|
95
|
+
A,
|
|
98
96
|
{
|
|
99
97
|
size: 120,
|
|
100
98
|
illustration: "noImage",
|
|
@@ -102,10 +100,10 @@ const v = (l) => (l || []).reduce((s, r) => (s[r.id] = r, s), {}), Z = ({
|
|
|
102
100
|
titleProps: { size: "xs", c: "dimmed" }
|
|
103
101
|
}
|
|
104
102
|
) }),
|
|
105
|
-
!i.length && n && /* @__PURE__ */ e(
|
|
103
|
+
!i.length && n && /* @__PURE__ */ e(Q, {})
|
|
106
104
|
] })
|
|
107
105
|
] });
|
|
108
106
|
};
|
|
109
107
|
export {
|
|
110
|
-
|
|
108
|
+
X as FilePickerUnsplash
|
|
111
109
|
};
|
|
@@ -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;AAGnC,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,4CA8GA,CAAC"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
1
|
+
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as p } from "react";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Image02Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { Dropzone as
|
|
3
|
+
import { useTranslation as F, Trans as k } from "react-i18next";
|
|
4
|
+
import { Image02Icon as v } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as I } from "@hugeicons/react";
|
|
6
|
+
import { Stack as x, Text as s } from "@mantine/core";
|
|
7
|
+
import { Dropzone as E, IMAGE_MIME_TYPE as N } from "@mantine/dropzone";
|
|
8
8
|
import { showNotification as h } from "@mantine/notifications";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
9
|
+
import { getMaxUploadSize as g } from "../../config/envConfig.js";
|
|
10
|
+
import { showErrorNotification as T } from "../../helpers/showNotifications.js";
|
|
11
|
+
import b from "./FilePicker.module.css.js";
|
|
11
12
|
import "@mantine/dropzone/styles.css";
|
|
12
|
-
const
|
|
13
|
-
type:
|
|
14
|
-
uploading:
|
|
15
|
-
dropZoneProps:
|
|
13
|
+
const Y = ({
|
|
14
|
+
type: a = "image",
|
|
15
|
+
uploading: u,
|
|
16
|
+
dropZoneProps: i,
|
|
16
17
|
onUpload: c
|
|
17
18
|
}) => {
|
|
18
|
-
const { t: e } =
|
|
19
|
-
const r = e(
|
|
20
|
-
return r !==
|
|
21
|
-
})(),
|
|
19
|
+
const { t: e } = F("ui"), l = i?.maxSize != null ? Math.round(i.maxSize / (1024 * 1024)) : Math.round((g() ?? 5 * 1024 * 1024) / (1024 * 1024)), m = `filePicker.description.${a}`, y = `filePicker.dropFileHere.${a}`, f = (() => {
|
|
20
|
+
const r = e(m, { maxSize: l });
|
|
21
|
+
return r !== m ? r : null;
|
|
22
|
+
})(), z = p(
|
|
22
23
|
(r) => {
|
|
23
24
|
if (r.filter(
|
|
24
|
-
(
|
|
25
|
+
(t) => t.errors.some((n) => n.code === "file-invalid-type")
|
|
25
26
|
).length > 0) {
|
|
26
27
|
h({
|
|
27
28
|
color: "blue",
|
|
@@ -29,15 +30,15 @@ const C = ({
|
|
|
29
30
|
});
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
if (r.some((
|
|
33
|
-
|
|
33
|
+
if (r.some((t) => t.errors.some((n) => n.code === "file-too-large"))) {
|
|
34
|
+
T({
|
|
34
35
|
title: e("errorMessage"),
|
|
35
|
-
message: e("filePicker.errors.shouldNotExceed")
|
|
36
|
+
message: e("filePicker.errors.shouldNotExceed", { maxSize: l })
|
|
36
37
|
});
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
if (r.filter(
|
|
40
|
-
(
|
|
41
|
+
(t) => t.errors.some((n) => n.code === "too-many-files")
|
|
41
42
|
).length > 0) {
|
|
42
43
|
h({
|
|
43
44
|
color: "blue",
|
|
@@ -46,22 +47,23 @@ const C = ({
|
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
|
-
[e]
|
|
50
|
-
),
|
|
50
|
+
[e, l]
|
|
51
|
+
), M = p(c, [c]), S = i?.maxSize ?? g() ?? 5 * 1024 * 1024;
|
|
51
52
|
return /* @__PURE__ */ o(
|
|
52
|
-
|
|
53
|
+
E,
|
|
53
54
|
{
|
|
54
|
-
loading:
|
|
55
|
-
onDrop:
|
|
56
|
-
onReject:
|
|
57
|
-
maxFiles:
|
|
58
|
-
|
|
55
|
+
loading: u,
|
|
56
|
+
onDrop: M,
|
|
57
|
+
onReject: z,
|
|
58
|
+
maxFiles: i?.maxFiles || 1,
|
|
59
|
+
maxSize: S,
|
|
60
|
+
accept: N,
|
|
59
61
|
px: 60,
|
|
60
62
|
py: "xl",
|
|
61
|
-
className: `${
|
|
62
|
-
...
|
|
63
|
-
children: /* @__PURE__ */
|
|
64
|
-
|
|
63
|
+
className: `${b.pickerDropZone}`,
|
|
64
|
+
...i || {},
|
|
65
|
+
children: /* @__PURE__ */ d(
|
|
66
|
+
x,
|
|
65
67
|
{
|
|
66
68
|
justify: "center",
|
|
67
69
|
gap: "var(--mantine-font-size-xs",
|
|
@@ -70,22 +72,22 @@ const C = ({
|
|
|
70
72
|
style: { pointerEvents: "none" },
|
|
71
73
|
children: [
|
|
72
74
|
/* @__PURE__ */ o(
|
|
73
|
-
|
|
75
|
+
I,
|
|
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__ */ o(
|
|
82
|
-
|
|
82
|
+
/* @__PURE__ */ d(x, { gap: 8, align: "center", children: [
|
|
83
|
+
/* @__PURE__ */ o(s, { fw: 500, fz: "sm", c: "bright", lh: "sm", ta: "center", children: /* @__PURE__ */ o(
|
|
84
|
+
k,
|
|
83
85
|
{
|
|
84
86
|
ns: "ui",
|
|
85
|
-
i18nKey:
|
|
87
|
+
i18nKey: y,
|
|
86
88
|
components: {
|
|
87
89
|
choose: /* @__PURE__ */ o(
|
|
88
|
-
|
|
90
|
+
s,
|
|
89
91
|
{
|
|
90
92
|
component: "span",
|
|
91
93
|
td: "underline",
|
|
@@ -95,7 +97,7 @@ const C = ({
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
) }),
|
|
98
|
-
|
|
100
|
+
f && /* @__PURE__ */ o(s, { fz: "xs", fw: 400, lh: "140%", c: "dimmed", ta: "center", children: f })
|
|
99
101
|
] })
|
|
100
102
|
]
|
|
101
103
|
}
|
|
@@ -104,5 +106,5 @@ const C = ({
|
|
|
104
106
|
);
|
|
105
107
|
};
|
|
106
108
|
export {
|
|
107
|
-
|
|
109
|
+
Y as FilePickerUpload
|
|
108
110
|
};
|
|
@@ -5,7 +5,7 @@ type Data = {
|
|
|
5
5
|
totalPages: number;
|
|
6
6
|
hasMore: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const fetchGiphyPhotos: (params: ApiGiphy.Request, page?: number,
|
|
9
|
-
export declare const useGiphyPhotos: (params: ApiGiphy.Request, page: number,
|
|
8
|
+
export declare const fetchGiphyPhotos: (params: ApiGiphy.Request, page?: number, _token?: string) => Promise<Data>;
|
|
9
|
+
export declare const useGiphyPhotos: (params: ApiGiphy.Request, page: number, _token?: string) => import("@tanstack/react-query").UseQueryResult<Data, Error>;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=giphyApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"giphyApi.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePicker/api/giphyApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"giphyApi.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePicker/api/giphyApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,QAAQ,CAAC,OAAO,EACxB,aAAQ,EACR,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,CA2Bd,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,QAAQ,CAAC,OAAO,EACxB,MAAM,MAAM,EACZ,SAAS,MAAM,gEAMhB,CAAC"}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import { useQuery as h } from "@tanstack/react-query";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
const a = o.q ? "/gifs/search" : "/gifs/trending",
|
|
5
|
-
|
|
6
|
-
...o,
|
|
7
|
-
api_key: i || u
|
|
8
|
-
})}`
|
|
2
|
+
import u from "query-string";
|
|
3
|
+
const g = async (o, n = 1, e) => {
|
|
4
|
+
const a = o.q ? "/gifs/search" : "/gifs/trending", i = await fetch(
|
|
5
|
+
`/v1/media/giphy${a}?${u.stringify(o)}`
|
|
9
6
|
);
|
|
10
|
-
if (!
|
|
7
|
+
if (!i.ok)
|
|
11
8
|
throw new Error("Failed to fetch Giphy photos");
|
|
12
|
-
const t = await
|
|
9
|
+
const t = await i.json(), s = t.data, r = Math.ceil(t.pagination.total_count / 12), c = t.pagination.total_count % 12 === 0 || t.pagination.total_count > t.pagination.count + t.pagination.offset;
|
|
13
10
|
return {
|
|
14
|
-
items:
|
|
11
|
+
items: s,
|
|
15
12
|
page: n,
|
|
16
13
|
totalPages: r,
|
|
17
14
|
hasMore: c
|
|
18
15
|
};
|
|
19
|
-
},
|
|
16
|
+
}, l = (o, n, e) => h({
|
|
20
17
|
queryKey: ["giphyPhotos", o, n],
|
|
21
|
-
queryFn: () =>
|
|
18
|
+
queryFn: () => g(o, n)
|
|
22
19
|
});
|
|
23
20
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
g as fetchGiphyPhotos,
|
|
22
|
+
l as useGiphyPhotos
|
|
26
23
|
};
|
|
@@ -5,7 +5,7 @@ type Data = {
|
|
|
5
5
|
totalPages: number;
|
|
6
6
|
hasMore: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const fetchUnsplashPhotos: (params: ApiUnsplash.Request,
|
|
9
|
-
export declare const useUnsplashPhotos: (params: ApiUnsplash.Request,
|
|
8
|
+
export declare const fetchUnsplashPhotos: (params: ApiUnsplash.Request, _clientId?: string, previousData?: Data) => Promise<Data>;
|
|
9
|
+
export declare const useUnsplashPhotos: (params: ApiUnsplash.Request, _clientId?: string, rest?: any) => import("@tanstack/react-query").DefinedUseQueryResult<Data, Error>;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=unsplashApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsplashApi.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePicker/api/unsplashApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"unsplashApi.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePicker/api/unsplashApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,WAAW,CAAC,OAAO,EAC3B,YAAY,MAAM,EAClB,eAAe,IAAI,KAClB,OAAO,CAAC,IAAI,CAuBd,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,WAAW,CAAC,OAAO,EAC3B,YAAY,MAAM,EAClB,OAAO,GAAG,uEAOX,CAAC"}
|