@layers-app/shared 0.2.3 → 0.2.4
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/AppContainer/AppContainer.d.ts +1 -1
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +31 -23
- package/dist/components/AppContainer/hooks/useAppContainerStore.d.ts.map +1 -1
- package/dist/components/AppContainer/hooks/useAppContainerStore.js +12 -9
- package/dist/components/AppContainer/types.d.ts +1 -0
- package/dist/components/AppContainer/types.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPanel.js +50 -49
- package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
- package/dist/components/EmojiPicker/IconsPanel.js +79 -78
- package/dist/components/FilePicker/FilePicker.d.ts +2 -3
- package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePicker.js +88 -122
- package/dist/components/FilePicker/FilePickerGiphy.d.ts +1 -3
- package/dist/components/FilePicker/FilePickerGiphy.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerGiphy.js +43 -44
- package/dist/components/FilePicker/FilePickerLink.d.ts +2 -3
- package/dist/components/FilePicker/FilePickerLink.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerLink.js +21 -21
- package/dist/components/FilePicker/FilePickerUnsplash.d.ts +1 -3
- package/dist/components/FilePicker/FilePickerUnsplash.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUnsplash.js +45 -46
- package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -3
- package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
- package/dist/components/FilePicker/FilePickerUpload.js +49 -43
- package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
- package/dist/components/NavMenu/components/NavMenuItem.js +6 -5
- package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts +2 -2
- package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
- package/dist/components/WorkspaceMenu/WorkspaceMenu.js +100 -103
- package/dist/lang/locales/ui_en.json.js +20 -12
- package/dist/lang/locales/ui_es.json.js +18 -10
- package/dist/lang/locales/ui_ru.json.js +24 -16
- package/package.json +1 -1
|
@@ -1,146 +1,121 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useMemo as y } from "react";
|
|
3
|
+
import { useTranslation as q } from "react-i18next";
|
|
4
|
+
import { ImageAdd02Icon as C } from "@hugeicons/core-free-icons";
|
|
4
5
|
import { HugeiconsIcon as F } from "@hugeicons/react";
|
|
5
|
-
import { Flex as r, ActionIcon as
|
|
6
|
-
import { useMenu as
|
|
7
|
-
import { FilePickerGallery as
|
|
8
|
-
import { FilePickerGiphy as
|
|
9
|
-
import { FilePickerLink as
|
|
10
|
-
import { FilePickerUnsplash as
|
|
11
|
-
import { FilePickerUpload as
|
|
6
|
+
import { Flex as r, ActionIcon as E, Button as P, Text as J, Popover as g, Tabs as f, Stack as K } from "@mantine/core";
|
|
7
|
+
import { useMenu as Q } from "../../hooks/useMenu.js";
|
|
8
|
+
import { FilePickerGallery as W } from "./FilePickerGallery.js";
|
|
9
|
+
import { FilePickerGiphy as X } from "./FilePickerGiphy.js";
|
|
10
|
+
import { FilePickerLink as Y } from "./FilePickerLink.js";
|
|
11
|
+
import { FilePickerUnsplash as Z } from "./FilePickerUnsplash.js";
|
|
12
|
+
import { FilePickerUpload as _ } from "./FilePickerUpload.js";
|
|
12
13
|
import z from "./FilePicker.module.css.js";
|
|
13
|
-
const
|
|
14
|
+
const $ = [
|
|
14
15
|
"gallery",
|
|
15
16
|
"upload",
|
|
16
17
|
"link",
|
|
17
18
|
"unsplash",
|
|
18
19
|
"giphy"
|
|
19
20
|
], me = ({
|
|
20
|
-
onChange:
|
|
21
|
-
onRemove:
|
|
22
|
-
onUpload:
|
|
23
|
-
uploading:
|
|
24
|
-
showTabs: a =
|
|
25
|
-
children:
|
|
26
|
-
width:
|
|
27
|
-
position:
|
|
28
|
-
readOnly:
|
|
29
|
-
hasImage:
|
|
21
|
+
onChange: L,
|
|
22
|
+
onRemove: j,
|
|
23
|
+
onUpload: m,
|
|
24
|
+
uploading: G = !1,
|
|
25
|
+
showTabs: a = $,
|
|
26
|
+
children: M,
|
|
27
|
+
width: S = 610,
|
|
28
|
+
position: A = "bottom-end",
|
|
29
|
+
readOnly: B = !1,
|
|
30
|
+
hasImage: I,
|
|
30
31
|
giphyToken: o,
|
|
31
|
-
unsplashClientId:
|
|
32
|
-
type:
|
|
33
|
-
galleryCollection:
|
|
34
|
-
isValidMediaUrl:
|
|
35
|
-
popoverProps:
|
|
36
|
-
dropZoneProps:
|
|
37
|
-
targetProps:
|
|
38
|
-
onOpenedChange: D
|
|
39
|
-
locales: n = {
|
|
40
|
-
gallery: "Gallery",
|
|
41
|
-
link: "Link",
|
|
42
|
-
search: "Search",
|
|
43
|
-
searchImages: "Search image",
|
|
44
|
-
upload: "Upload",
|
|
45
|
-
uploadFile: "Upload file",
|
|
46
|
-
change: "Change",
|
|
47
|
-
save: "Save",
|
|
48
|
-
remove: "Remove",
|
|
49
|
-
error: "Error",
|
|
50
|
-
dragOrClickToChoose: "Drag images here or click to select files",
|
|
51
|
-
maxFileSize: "Images wider than 1600px are recommended. Maximum file size: 5MB.",
|
|
52
|
-
pasteLink: "Paste the image link...",
|
|
53
|
-
submitLink: "Apply",
|
|
54
|
-
worksWithAnyImage: "Works with any images from the Internet",
|
|
55
|
-
noImages: "No images",
|
|
56
|
-
errors: {
|
|
57
|
-
typeIsNotAllowed: "This file type is not supported",
|
|
58
|
-
shouldNotExceed: "File size should not exceed 5 MB.",
|
|
59
|
-
doNotUploadMoreThanSingleFile: "Please upload no more than one file.",
|
|
60
|
-
invalidLink: "Invalid link"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
32
|
+
unsplashClientId: c,
|
|
33
|
+
type: v = "image",
|
|
34
|
+
galleryCollection: d = [],
|
|
35
|
+
isValidMediaUrl: N,
|
|
36
|
+
popoverProps: U,
|
|
37
|
+
dropZoneProps: V,
|
|
38
|
+
targetProps: w,
|
|
39
|
+
onOpenedChange: D
|
|
63
40
|
}) => {
|
|
64
|
-
const [
|
|
41
|
+
const { t: l } = q("ui"), [b, u] = x(!1), { isMobile: n } = Q(), h = y(
|
|
65
42
|
() => [
|
|
66
43
|
{
|
|
67
44
|
value: "gallery",
|
|
68
|
-
label: /* @__PURE__ */ e(r, { children: !
|
|
69
|
-
visible: a.includes("gallery") && !!
|
|
45
|
+
label: /* @__PURE__ */ e(r, { children: !n && /* @__PURE__ */ e("span", { children: l("changeCover.gallery") }) }),
|
|
46
|
+
visible: a.includes("gallery") && !!d.length
|
|
70
47
|
},
|
|
71
48
|
{
|
|
72
49
|
value: "upload",
|
|
73
|
-
label: /* @__PURE__ */ e(r, { children: !
|
|
74
|
-
visible: a.includes("upload") && !!
|
|
50
|
+
label: /* @__PURE__ */ e(r, { children: !n && /* @__PURE__ */ e("span", { children: l("changeCover.upload") }) }),
|
|
51
|
+
visible: a.includes("upload") && !!m
|
|
75
52
|
},
|
|
76
53
|
{
|
|
77
54
|
value: "link",
|
|
78
|
-
label: /* @__PURE__ */ e(r, { children: !
|
|
55
|
+
label: /* @__PURE__ */ e(r, { children: !n && /* @__PURE__ */ e("span", { children: l("changeCover.link") }) }),
|
|
79
56
|
visible: a.includes("link")
|
|
80
57
|
},
|
|
81
58
|
{
|
|
82
59
|
value: "unsplash",
|
|
83
|
-
label: /* @__PURE__ */ e(r, { children: !
|
|
84
|
-
visible: a.includes("unsplash") &&
|
|
60
|
+
label: /* @__PURE__ */ e(r, { children: !n && /* @__PURE__ */ e("span", { children: l("changeCover.searchImages") }) }),
|
|
61
|
+
visible: a.includes("unsplash") && c
|
|
85
62
|
},
|
|
86
63
|
{
|
|
87
64
|
value: "giphy",
|
|
88
|
-
label: /* @__PURE__ */ e(r, { children: !
|
|
65
|
+
label: /* @__PURE__ */ e(r, { children: !n && /* @__PURE__ */ e("span", { children: "GIFs" }) }),
|
|
89
66
|
visible: a.includes("giphy") && o
|
|
90
67
|
}
|
|
91
68
|
].filter((i) => i.visible),
|
|
92
69
|
[
|
|
93
|
-
|
|
70
|
+
n,
|
|
94
71
|
a,
|
|
95
|
-
|
|
72
|
+
c,
|
|
96
73
|
o,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
c.length,
|
|
101
|
-
h
|
|
74
|
+
l,
|
|
75
|
+
d.length,
|
|
76
|
+
m
|
|
102
77
|
]
|
|
103
|
-
), [
|
|
104
|
-
if (
|
|
105
|
-
const i =
|
|
78
|
+
), [s, H] = x(() => {
|
|
79
|
+
if (h[0]) return h[0].value;
|
|
80
|
+
const i = h.find((T) => T.visible);
|
|
106
81
|
return i ? i.value : "";
|
|
107
82
|
}), O = (i) => {
|
|
108
|
-
|
|
83
|
+
m?.(i, u);
|
|
109
84
|
}, p = (i) => {
|
|
110
|
-
|
|
111
|
-
}, R = y(() =>
|
|
112
|
-
/* @__PURE__ */ e(F, { icon:
|
|
85
|
+
L?.(i), u(!1);
|
|
86
|
+
}, R = y(() => n ? /* @__PURE__ */ t(E, { size: "lg", children: [
|
|
87
|
+
/* @__PURE__ */ e(F, { icon: C, size: 22 }),
|
|
113
88
|
" "
|
|
114
89
|
] }) : /* @__PURE__ */ e(
|
|
115
|
-
|
|
90
|
+
P,
|
|
116
91
|
{
|
|
117
92
|
variant: "default",
|
|
118
93
|
size: "xs",
|
|
119
|
-
leftSection: /* @__PURE__ */ e(F, { icon:
|
|
120
|
-
children: /* @__PURE__ */ e(
|
|
94
|
+
leftSection: /* @__PURE__ */ e(F, { icon: C, size: 16 }),
|
|
95
|
+
children: /* @__PURE__ */ e(J, { fw: 600, size: "sm", children: l("changeCover.change") })
|
|
121
96
|
}
|
|
122
|
-
), [
|
|
97
|
+
), [l, n]), k = (i) => {
|
|
123
98
|
u(i), D?.(i);
|
|
124
99
|
};
|
|
125
|
-
return /* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ t(
|
|
126
101
|
g,
|
|
127
102
|
{
|
|
128
|
-
width:
|
|
103
|
+
width: S,
|
|
129
104
|
radius: "var(--mantine-spacing-sm)",
|
|
130
|
-
position:
|
|
105
|
+
position: A,
|
|
131
106
|
shadow: "md",
|
|
132
|
-
opened:
|
|
107
|
+
opened: b,
|
|
133
108
|
onChange: k,
|
|
134
109
|
withinPortal: !0,
|
|
135
|
-
...
|
|
110
|
+
...U || {},
|
|
136
111
|
children: [
|
|
137
|
-
/* @__PURE__ */ e(g.Target, { children: /* @__PURE__ */ e(r, { onClick: () => k(!
|
|
138
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ e(g.Target, { children: /* @__PURE__ */ e(r, { onClick: () => k(!b), ...w, children: M ?? R }) }),
|
|
113
|
+
/* @__PURE__ */ t(g.Dropdown, { p: 0, children: [
|
|
139
114
|
/* @__PURE__ */ e(r, { justify: "space-between", align: "center", children: /* @__PURE__ */ e(
|
|
140
115
|
f,
|
|
141
116
|
{
|
|
142
117
|
defaultValue: "gallery",
|
|
143
|
-
value:
|
|
118
|
+
value: s,
|
|
144
119
|
styles: {
|
|
145
120
|
list: {
|
|
146
121
|
alignItems: "center",
|
|
@@ -148,7 +123,7 @@ const _ = [
|
|
|
148
123
|
}
|
|
149
124
|
},
|
|
150
125
|
w: "100%",
|
|
151
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ t(
|
|
152
127
|
f.List,
|
|
153
128
|
{
|
|
154
129
|
style: {
|
|
@@ -157,21 +132,21 @@ const _ = [
|
|
|
157
132
|
px: 8,
|
|
158
133
|
h: 54,
|
|
159
134
|
children: [
|
|
160
|
-
|
|
135
|
+
h.map((i) => /* @__PURE__ */ e(
|
|
161
136
|
f.Tab,
|
|
162
137
|
{
|
|
163
138
|
className: z.originalTab,
|
|
164
|
-
disabled:
|
|
139
|
+
disabled: B,
|
|
165
140
|
h: "100%",
|
|
166
141
|
p: 0,
|
|
167
142
|
value: i.value,
|
|
168
|
-
onClick: () =>
|
|
143
|
+
onClick: () => H(i.value),
|
|
169
144
|
children: /* @__PURE__ */ e(r, { className: z.customTab, px: "sm", h: 36, children: i.label })
|
|
170
145
|
},
|
|
171
146
|
i.value
|
|
172
147
|
)),
|
|
173
|
-
|
|
174
|
-
|
|
148
|
+
I && /* @__PURE__ */ e(
|
|
149
|
+
P,
|
|
175
150
|
{
|
|
176
151
|
variant: "subtle",
|
|
177
152
|
fz: "sm",
|
|
@@ -179,10 +154,10 @@ const _ = [
|
|
|
179
154
|
fw: 500,
|
|
180
155
|
px: "sm",
|
|
181
156
|
size: "30px",
|
|
182
|
-
onClick:
|
|
157
|
+
onClick: j,
|
|
183
158
|
color: "var(--mantine-color-gray-light-color)",
|
|
184
159
|
style: { marginLeft: "auto" },
|
|
185
|
-
children:
|
|
160
|
+
children: l("remove")
|
|
186
161
|
}
|
|
187
162
|
)
|
|
188
163
|
]
|
|
@@ -190,48 +165,39 @@ const _ = [
|
|
|
190
165
|
)
|
|
191
166
|
}
|
|
192
167
|
) }),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
195
|
-
|
|
168
|
+
/* @__PURE__ */ t(K, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
|
|
169
|
+
s === "gallery" && !!d.length && /* @__PURE__ */ e(
|
|
170
|
+
W,
|
|
196
171
|
{
|
|
197
|
-
galleryCollection:
|
|
172
|
+
galleryCollection: d,
|
|
198
173
|
onChange: p
|
|
199
174
|
}
|
|
200
175
|
),
|
|
201
|
-
|
|
202
|
-
|
|
176
|
+
s === "upload" && /* @__PURE__ */ e(
|
|
177
|
+
_,
|
|
203
178
|
{
|
|
204
|
-
|
|
205
|
-
uploading:
|
|
206
|
-
dropZoneProps:
|
|
179
|
+
type: v || "image",
|
|
180
|
+
uploading: G,
|
|
181
|
+
dropZoneProps: V,
|
|
207
182
|
onUpload: O
|
|
208
183
|
}
|
|
209
184
|
),
|
|
210
|
-
|
|
211
|
-
|
|
185
|
+
s === "link" && /* @__PURE__ */ e(
|
|
186
|
+
Y,
|
|
212
187
|
{
|
|
213
|
-
|
|
214
|
-
type: U || "image",
|
|
188
|
+
type: v || "image",
|
|
215
189
|
onChange: p,
|
|
216
|
-
isValidMediaUrl:
|
|
190
|
+
isValidMediaUrl: N
|
|
217
191
|
}
|
|
218
192
|
),
|
|
219
|
-
|
|
220
|
-
|
|
193
|
+
s === "unsplash" && c && /* @__PURE__ */ e(
|
|
194
|
+
Z,
|
|
221
195
|
{
|
|
222
|
-
|
|
223
|
-
clientId: d,
|
|
196
|
+
clientId: c,
|
|
224
197
|
onChange: p
|
|
225
198
|
}
|
|
226
199
|
),
|
|
227
|
-
|
|
228
|
-
Q,
|
|
229
|
-
{
|
|
230
|
-
locales: n,
|
|
231
|
-
token: o,
|
|
232
|
-
onChange: p
|
|
233
|
-
}
|
|
234
|
-
)
|
|
200
|
+
s === "giphy" && o && /* @__PURE__ */ e(X, { token: o, onChange: p })
|
|
235
201
|
] })
|
|
236
202
|
] })
|
|
237
203
|
]
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const FilePickerGiphy: ({ locales, token, onChange, }: {
|
|
3
|
-
locales: FilePickerLocales;
|
|
1
|
+
export declare const FilePickerGiphy: ({ token, onChange, }: {
|
|
4
2
|
token?: string;
|
|
5
3
|
onChange?: (v: string) => void;
|
|
6
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerGiphy.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerGiphy.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilePickerGiphy.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerGiphy.tsx"],"names":[],"mappings":"AAmCA,eAAO,MAAM,eAAe,GAAI,sBAG7B;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,4CAoGA,CAAC"}
|
|
@@ -1,91 +1,90 @@
|
|
|
1
1
|
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
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 { useGiphyPhotos as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onChange: s
|
|
2
|
+
import { useState as m, useMemo as x, useEffect as b, useCallback as S } from "react";
|
|
3
|
+
import { useTranslation as P } from "react-i18next";
|
|
4
|
+
import { Search01Icon as w } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as z } from "@hugeicons/react";
|
|
6
|
+
import { Stack as C, TextInput as L, Loader as T, Box as k, SimpleGrid as j, AspectRatio as D, Button as G } from "@mantine/core";
|
|
7
|
+
import { useDebouncedValue as M, useDebouncedCallback as q } from "@mantine/hooks";
|
|
8
|
+
import { NoData as B } from "../NoData/NoData.js";
|
|
9
|
+
import { FilePickerSkeletonLoader as F } from "./FilePickerSkeletonLoader.js";
|
|
10
|
+
import { useGiphyPhotos as N } from "./api/giphyApi.js";
|
|
11
|
+
import Q from "./FilePicker.module.css.js";
|
|
12
|
+
const v = (n) => (n || []).reduce((r, o) => (r[o.id] = o, r), {}), U = ({
|
|
13
|
+
token: n,
|
|
14
|
+
onChange: r
|
|
16
15
|
}) => {
|
|
17
|
-
const { t:
|
|
16
|
+
const { t: o } = P("ui"), [l, y] = m(""), [u] = M(l, 800), [d, p] = m(1), [h, g] = m({}), { data: i, isLoading: s } = N(
|
|
18
17
|
{ q: u, limit: 24, offset: (d - 1) * 24 + 1 },
|
|
19
18
|
d,
|
|
20
|
-
|
|
21
|
-
),
|
|
22
|
-
() => Object.values({ ...h, ...
|
|
23
|
-
[h,
|
|
24
|
-
), f =
|
|
19
|
+
n
|
|
20
|
+
), a = x(
|
|
21
|
+
() => Object.values({ ...h, ...v(i?.items) }),
|
|
22
|
+
[h, i?.items]
|
|
23
|
+
), f = q(() => {
|
|
25
24
|
setTimeout(() => {
|
|
26
|
-
g((e) => ({ ...e, ...
|
|
25
|
+
g((e) => ({ ...e, ...v(i?.items) }));
|
|
27
26
|
}, 0);
|
|
28
27
|
}, 100);
|
|
29
28
|
b(() => {
|
|
30
29
|
f();
|
|
31
|
-
}, [
|
|
30
|
+
}, [i?.items, f]), b(() => {
|
|
32
31
|
g({});
|
|
33
32
|
}, [u]);
|
|
34
|
-
const
|
|
33
|
+
const I = S(
|
|
35
34
|
(e) => {
|
|
36
|
-
|
|
35
|
+
y(e.currentTarget.value), p(1);
|
|
37
36
|
},
|
|
38
37
|
[]
|
|
39
38
|
);
|
|
40
|
-
return /* @__PURE__ */ c(
|
|
39
|
+
return /* @__PURE__ */ c(C, { gap: "sm", children: [
|
|
41
40
|
/* @__PURE__ */ t(
|
|
42
|
-
|
|
41
|
+
L,
|
|
43
42
|
{
|
|
44
|
-
leftSection:
|
|
43
|
+
leftSection: s ? /* @__PURE__ */ t(T, { size: 16 }) : /* @__PURE__ */ t(z, { size: 16, icon: w }),
|
|
45
44
|
maxLength: 50,
|
|
46
|
-
placeholder:
|
|
45
|
+
placeholder: o("changeCover.searchImage"),
|
|
47
46
|
"data-autofocus": !0,
|
|
48
47
|
value: l,
|
|
49
|
-
onChange:
|
|
48
|
+
onChange: I
|
|
50
49
|
}
|
|
51
50
|
),
|
|
52
|
-
/* @__PURE__ */ c(
|
|
53
|
-
!!
|
|
54
|
-
/* @__PURE__ */ t(
|
|
55
|
-
|
|
51
|
+
/* @__PURE__ */ c(k, { mah: 300, w: "100%", style: { overflowY: "auto" }, children: [
|
|
52
|
+
!!a.length && /* @__PURE__ */ c(C, { gap: 8, children: [
|
|
53
|
+
/* @__PURE__ */ t(j, { cols: 4, spacing: 10, children: a.map((e) => /* @__PURE__ */ t(
|
|
54
|
+
D,
|
|
56
55
|
{
|
|
57
|
-
onClick: () =>
|
|
56
|
+
onClick: () => r?.(e.images.original.url),
|
|
58
57
|
ratio: 120 / 65,
|
|
59
|
-
className:
|
|
58
|
+
className: Q.itemImage,
|
|
60
59
|
style: {
|
|
61
60
|
backgroundImage: `url(${e.images.preview_webp.url})`
|
|
62
61
|
}
|
|
63
62
|
},
|
|
64
63
|
e.id
|
|
65
64
|
)) }),
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
i?.hasMore && /* @__PURE__ */ t(
|
|
66
|
+
G,
|
|
68
67
|
{
|
|
69
68
|
variant: "subtle",
|
|
70
|
-
loading:
|
|
69
|
+
loading: s,
|
|
71
70
|
onClick: () => p((e) => e + 1),
|
|
72
|
-
children:
|
|
71
|
+
children: o("loadMode")
|
|
73
72
|
}
|
|
74
73
|
)
|
|
75
74
|
] }),
|
|
76
|
-
!
|
|
77
|
-
|
|
75
|
+
!a.length && !s && /* @__PURE__ */ t(k, { pb: 16, children: /* @__PURE__ */ t(
|
|
76
|
+
B,
|
|
78
77
|
{
|
|
79
78
|
size: 120,
|
|
80
79
|
illustration: "noImage",
|
|
81
|
-
description:
|
|
80
|
+
description: o("changeCover.noResult"),
|
|
82
81
|
titleProps: { size: "xs", c: "dimmed" }
|
|
83
82
|
}
|
|
84
83
|
) }),
|
|
85
|
-
!
|
|
84
|
+
!a.length && s && /* @__PURE__ */ t(F, {})
|
|
86
85
|
] })
|
|
87
86
|
] });
|
|
88
87
|
};
|
|
89
88
|
export {
|
|
90
|
-
|
|
89
|
+
U as FilePickerGiphy
|
|
91
90
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const FilePickerLink: ({
|
|
3
|
-
locales: FilePickerLocales;
|
|
1
|
+
import { FileType } from './types';
|
|
2
|
+
export declare const FilePickerLink: ({ onChange, type, isValidMediaUrl, }: {
|
|
4
3
|
onChange?: (v: string) => void;
|
|
5
4
|
type: FileType;
|
|
6
5
|
isValidMediaUrl?: (url: string) => boolean;
|
|
@@ -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":"AAWA,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,4CA+DA,CAAC"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import F from "
|
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as c } from "react-i18next";
|
|
3
|
+
import { Stack as m, FocusTrap as d, TextInput as f, Flex as p, Button as h } from "@mantine/core";
|
|
4
|
+
import { useForm as g } from "@mantine/form";
|
|
5
|
+
import { isValidUrl as v, isImageUrl as k, isVideoUrl as x, isAudioUrl as F } from "../../helpers/validation.js";
|
|
6
|
+
import L from "./FilePicker.module.css.js";
|
|
6
7
|
const U = ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isValidMediaUrl: a
|
|
8
|
+
onChange: o,
|
|
9
|
+
type: a,
|
|
10
|
+
isValidMediaUrl: s
|
|
11
11
|
}) => {
|
|
12
|
-
const l =
|
|
12
|
+
const { t: i } = c("ui"), l = g({
|
|
13
13
|
initialValues: {
|
|
14
14
|
url: ""
|
|
15
15
|
},
|
|
16
16
|
validate: {
|
|
17
|
-
url: (
|
|
17
|
+
url: (e) => (e || "").trim().length > 0 && v(e) ? null : i("changeCover.invalidLink")
|
|
18
18
|
}
|
|
19
19
|
}), n = async () => {
|
|
20
|
-
const { values:
|
|
21
|
-
let
|
|
22
|
-
|
|
20
|
+
const { values: e } = l;
|
|
21
|
+
let r;
|
|
22
|
+
a === "image" ? r = await k(e.url) : a === "video" ? s && s(e.url) ? r = !0 : r = await x(e.url) : a === "audio" ? r = await F(e.url) : r = !0, r ? o?.(e.url) : l.setFieldError("url", i("changeCover.invalidLink"));
|
|
23
23
|
};
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ u(m, { gap: "sm", children: [
|
|
25
25
|
/* @__PURE__ */ t(d, { active: !0, children: /* @__PURE__ */ t(
|
|
26
|
-
|
|
26
|
+
f,
|
|
27
27
|
{
|
|
28
28
|
maxLength: 500,
|
|
29
29
|
size: "sm",
|
|
30
|
-
placeholder: i.pasteLink,
|
|
30
|
+
placeholder: i("changeCover.pasteLink"),
|
|
31
31
|
"data-autofocus": !0,
|
|
32
32
|
...l.getInputProps("url")
|
|
33
33
|
}
|
|
34
34
|
) }),
|
|
35
|
-
/* @__PURE__ */ t(
|
|
36
|
-
|
|
35
|
+
/* @__PURE__ */ t(p, { justify: "flex-end", align: "center", children: /* @__PURE__ */ t(
|
|
36
|
+
h,
|
|
37
37
|
{
|
|
38
38
|
onClick: n,
|
|
39
|
-
className:
|
|
39
|
+
className: L.button,
|
|
40
40
|
disabled: !l.values.url,
|
|
41
|
-
children: i.save
|
|
41
|
+
children: i("customDrawer.save")
|
|
42
42
|
}
|
|
43
43
|
) })
|
|
44
44
|
] });
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const FilePickerUnsplash: ({ locales, onChange, clientId, }: {
|
|
3
|
-
locales: FilePickerLocales;
|
|
1
|
+
export declare const FilePickerUnsplash: ({ onChange, clientId, }: {
|
|
4
2
|
clientId?: string;
|
|
5
3
|
onChange?: (v: string) => void;
|
|
6
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePickerUnsplash.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUnsplash.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilePickerUnsplash.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUnsplash.tsx"],"names":[],"mappings":"AAmCA,eAAO,MAAM,kBAAkB,GAAI,yBAGhC;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,4CAwGA,CAAC"}
|