@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.
Files changed (35) hide show
  1. package/dist/components/AppContainer/AppContainer.d.ts +1 -1
  2. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  3. package/dist/components/AppContainer/AppContainer.js +31 -23
  4. package/dist/components/AppContainer/hooks/useAppContainerStore.d.ts.map +1 -1
  5. package/dist/components/AppContainer/hooks/useAppContainerStore.js +12 -9
  6. package/dist/components/AppContainer/types.d.ts +1 -0
  7. package/dist/components/AppContainer/types.d.ts.map +1 -1
  8. package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
  9. package/dist/components/EmojiPicker/EmojiPanel.js +50 -49
  10. package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
  11. package/dist/components/EmojiPicker/IconsPanel.js +79 -78
  12. package/dist/components/FilePicker/FilePicker.d.ts +2 -3
  13. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  14. package/dist/components/FilePicker/FilePicker.js +88 -122
  15. package/dist/components/FilePicker/FilePickerGiphy.d.ts +1 -3
  16. package/dist/components/FilePicker/FilePickerGiphy.d.ts.map +1 -1
  17. package/dist/components/FilePicker/FilePickerGiphy.js +43 -44
  18. package/dist/components/FilePicker/FilePickerLink.d.ts +2 -3
  19. package/dist/components/FilePicker/FilePickerLink.d.ts.map +1 -1
  20. package/dist/components/FilePicker/FilePickerLink.js +21 -21
  21. package/dist/components/FilePicker/FilePickerUnsplash.d.ts +1 -3
  22. package/dist/components/FilePicker/FilePickerUnsplash.d.ts.map +1 -1
  23. package/dist/components/FilePicker/FilePickerUnsplash.js +45 -46
  24. package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -3
  25. package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
  26. package/dist/components/FilePicker/FilePickerUpload.js +49 -43
  27. package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
  28. package/dist/components/NavMenu/components/NavMenuItem.js +6 -5
  29. package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts +2 -2
  30. package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
  31. package/dist/components/WorkspaceMenu/WorkspaceMenu.js +100 -103
  32. package/dist/lang/locales/ui_en.json.js +20 -12
  33. package/dist/lang/locales/ui_es.json.js +18 -10
  34. package/dist/lang/locales/ui_ru.json.js +24 -16
  35. package/package.json +1 -1
@@ -1,146 +1,121 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { useState as b, useMemo as y } from "react";
3
- import { ImageAdd02Icon as x } from "@hugeicons/core-free-icons";
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 W, Button as I, Text as H, Popover as g, Tabs as f, Stack as q } from "@mantine/core";
6
- import { useMenu as J } from "../../hooks/useMenu.js";
7
- import { FilePickerGallery as K } from "./FilePickerGallery.js";
8
- import { FilePickerGiphy as Q } from "./FilePickerGiphy.js";
9
- import { FilePickerLink as X } from "./FilePickerLink.js";
10
- import { FilePickerUnsplash as Y } from "./FilePickerUnsplash.js";
11
- import { FilePickerUpload as Z } from "./FilePickerUpload.js";
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: P,
21
- onRemove: L,
22
- onUpload: h,
23
- uploading: S = !1,
24
- showTabs: a = _,
25
- children: C,
26
- width: M = 610,
27
- position: N = "bottom-end",
28
- readOnly: w = !1,
29
- hasImage: A,
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: d,
32
- type: U = "image",
33
- galleryCollection: c = [],
34
- isValidMediaUrl: B,
35
- popoverProps: G,
36
- dropZoneProps: j,
37
- targetProps: T,
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 [v, u] = b(!1), { isMobile: l } = J(), m = y(
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: !l && /* @__PURE__ */ e("span", { children: n.gallery }) }),
69
- visible: a.includes("gallery") && !!c.length
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: !l && /* @__PURE__ */ e("span", { children: n.upload }) }),
74
- visible: a.includes("upload") && !!h
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: !l && /* @__PURE__ */ e("span", { children: n.link }) }),
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: !l && /* @__PURE__ */ e("span", { children: n.searchImages }) }),
84
- visible: a.includes("unsplash") && d
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: !l && /* @__PURE__ */ e("span", { children: "GIFs" }) }),
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
- l,
70
+ n,
94
71
  a,
95
- d,
72
+ c,
96
73
  o,
97
- n.gallery,
98
- n.link,
99
- n.upload,
100
- c.length,
101
- h
74
+ l,
75
+ d.length,
76
+ m
102
77
  ]
103
- ), [t, E] = b(() => {
104
- if (m[0]) return m[0].value;
105
- const i = m.find((V) => V.visible);
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
- h?.(i, u);
83
+ m?.(i, u);
109
84
  }, p = (i) => {
110
- P?.(i), u(!1);
111
- }, R = y(() => l ? /* @__PURE__ */ s(W, { size: "lg", children: [
112
- /* @__PURE__ */ e(F, { icon: x, size: 22 }),
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
- I,
90
+ P,
116
91
  {
117
92
  variant: "default",
118
93
  size: "xs",
119
- leftSection: /* @__PURE__ */ e(F, { icon: x, size: 16 }),
120
- children: /* @__PURE__ */ e(H, { fw: 600, size: "sm", children: n?.change })
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
- ), [n, l]), k = (i) => {
97
+ ), [l, n]), k = (i) => {
123
98
  u(i), D?.(i);
124
99
  };
125
- return /* @__PURE__ */ s(
100
+ return /* @__PURE__ */ t(
126
101
  g,
127
102
  {
128
- width: M,
103
+ width: S,
129
104
  radius: "var(--mantine-spacing-sm)",
130
- position: N,
105
+ position: A,
131
106
  shadow: "md",
132
- opened: v,
107
+ opened: b,
133
108
  onChange: k,
134
109
  withinPortal: !0,
135
- ...G || {},
110
+ ...U || {},
136
111
  children: [
137
- /* @__PURE__ */ e(g.Target, { children: /* @__PURE__ */ e(r, { onClick: () => k(!v), ...T, children: C ?? R }) }),
138
- /* @__PURE__ */ s(g.Dropdown, { p: 0, children: [
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: t,
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__ */ s(
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
- m.map((i) => /* @__PURE__ */ e(
135
+ h.map((i) => /* @__PURE__ */ e(
161
136
  f.Tab,
162
137
  {
163
138
  className: z.originalTab,
164
- disabled: w,
139
+ disabled: B,
165
140
  h: "100%",
166
141
  p: 0,
167
142
  value: i.value,
168
- onClick: () => E(i.value),
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
- A && /* @__PURE__ */ e(
174
- I,
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: L,
157
+ onClick: j,
183
158
  color: "var(--mantine-color-gray-light-color)",
184
159
  style: { marginLeft: "auto" },
185
- children: n.remove
160
+ children: l("remove")
186
161
  }
187
162
  )
188
163
  ]
@@ -190,48 +165,39 @@ const _ = [
190
165
  )
191
166
  }
192
167
  ) }),
193
- /* @__PURE__ */ s(q, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
194
- t === "gallery" && !!c.length && /* @__PURE__ */ e(
195
- K,
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: c,
172
+ galleryCollection: d,
198
173
  onChange: p
199
174
  }
200
175
  ),
201
- t === "upload" && /* @__PURE__ */ e(
202
- Z,
176
+ s === "upload" && /* @__PURE__ */ e(
177
+ _,
203
178
  {
204
- locales: n,
205
- uploading: S,
206
- dropZoneProps: j,
179
+ type: v || "image",
180
+ uploading: G,
181
+ dropZoneProps: V,
207
182
  onUpload: O
208
183
  }
209
184
  ),
210
- t === "link" && /* @__PURE__ */ e(
211
- X,
185
+ s === "link" && /* @__PURE__ */ e(
186
+ Y,
212
187
  {
213
- locales: n,
214
- type: U || "image",
188
+ type: v || "image",
215
189
  onChange: p,
216
- isValidMediaUrl: B
190
+ isValidMediaUrl: N
217
191
  }
218
192
  ),
219
- t === "unsplash" && d && /* @__PURE__ */ e(
220
- Y,
193
+ s === "unsplash" && c && /* @__PURE__ */ e(
194
+ Z,
221
195
  {
222
- locales: n,
223
- clientId: d,
196
+ clientId: c,
224
197
  onChange: p
225
198
  }
226
199
  ),
227
- t === "giphy" && o && /* @__PURE__ */ e(
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
- import { FilePickerLocales } from './types';
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":"AA0BA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU5C,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,4CAoGA,CAAC"}
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 v, useEffect as b, useCallback as P } from "react";
3
- import { useTranslation as w } from "react-i18next";
4
- import { Search01Icon as z } from "@hugeicons/core-free-icons";
5
- import { HugeiconsIcon as L } from "@hugeicons/react";
6
- import { Stack as k, TextInput as T, Loader as j, Box as y, SimpleGrid as D, AspectRatio as G, Button as M } from "@mantine/core";
7
- import { useDebouncedValue as q, useDebouncedCallback as B } from "@mantine/hooks";
8
- import { NoData as F } from "../NoData/NoData.js";
9
- import { FilePickerSkeletonLoader as N } from "./FilePickerSkeletonLoader.js";
10
- import { useGiphyPhotos as Q } from "./api/giphyApi.js";
11
- import A from "./FilePicker.module.css.js";
12
- const C = (i) => (i || []).reduce((r, s) => (r[s.id] = s, r), {}), W = ({
13
- locales: i,
14
- token: r,
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: I } = w(), [l, x] = m(""), [u] = q(l, 800), [d, p] = m(1), [h, g] = m({}), { data: o, isLoading: a } = Q(
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
- r
21
- ), n = v(
22
- () => Object.values({ ...h, ...C(o?.items) }),
23
- [h, o?.items]
24
- ), f = B(() => {
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, ...C(o?.items) }));
25
+ g((e) => ({ ...e, ...v(i?.items) }));
27
26
  }, 0);
28
27
  }, 100);
29
28
  b(() => {
30
29
  f();
31
- }, [o?.items, f]), b(() => {
30
+ }, [i?.items, f]), b(() => {
32
31
  g({});
33
32
  }, [u]);
34
- const S = P(
33
+ const I = S(
35
34
  (e) => {
36
- x(e.currentTarget.value), p(1);
35
+ y(e.currentTarget.value), p(1);
37
36
  },
38
37
  []
39
38
  );
40
- return /* @__PURE__ */ c(k, { gap: "sm", children: [
39
+ return /* @__PURE__ */ c(C, { gap: "sm", children: [
41
40
  /* @__PURE__ */ t(
42
- T,
41
+ L,
43
42
  {
44
- leftSection: a ? /* @__PURE__ */ t(j, { size: 16 }) : /* @__PURE__ */ t(L, { size: 16, icon: z }),
43
+ leftSection: s ? /* @__PURE__ */ t(T, { size: 16 }) : /* @__PURE__ */ t(z, { size: 16, icon: w }),
45
44
  maxLength: 50,
46
- placeholder: i.search,
45
+ placeholder: o("changeCover.searchImage"),
47
46
  "data-autofocus": !0,
48
47
  value: l,
49
- onChange: S
48
+ onChange: I
50
49
  }
51
50
  ),
52
- /* @__PURE__ */ c(y, { mah: 300, w: "100%", style: { overflowY: "auto" }, children: [
53
- !!n.length && /* @__PURE__ */ c(k, { gap: 8, children: [
54
- /* @__PURE__ */ t(D, { cols: 4, spacing: 10, children: n.map((e) => /* @__PURE__ */ t(
55
- G,
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: () => s?.(e.images.original.url),
56
+ onClick: () => r?.(e.images.original.url),
58
57
  ratio: 120 / 65,
59
- className: A.itemImage,
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
- o?.hasMore && /* @__PURE__ */ t(
67
- M,
65
+ i?.hasMore && /* @__PURE__ */ t(
66
+ G,
68
67
  {
69
68
  variant: "subtle",
70
- loading: a,
69
+ loading: s,
71
70
  onClick: () => p((e) => e + 1),
72
- children: I("loadMode")
71
+ children: o("loadMode")
73
72
  }
74
73
  )
75
74
  ] }),
76
- !n.length && !a && /* @__PURE__ */ t(y, { pb: 16, children: /* @__PURE__ */ t(
77
- F,
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: i.noImages,
80
+ description: o("changeCover.noResult"),
82
81
  titleProps: { size: "xs", c: "dimmed" }
83
82
  }
84
83
  ) }),
85
- !n.length && a && /* @__PURE__ */ t(N, {})
84
+ !a.length && s && /* @__PURE__ */ t(F, {})
86
85
  ] })
87
86
  ] });
88
87
  };
89
88
  export {
90
- W as FilePickerGiphy
89
+ U as FilePickerGiphy
91
90
  };
@@ -1,6 +1,5 @@
1
- import { FilePickerLocales, FileType } from './types';
2
- export declare const FilePickerLink: ({ locales, onChange, type, isValidMediaUrl, }: {
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":"AASA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAItD,eAAO,MAAM,cAAc,GAAI,+CAK5B;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,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,4CA6DA,CAAC"}
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 o, jsx as t } from "react/jsx-runtime";
2
- import { Stack as m, FocusTrap as d, TextInput as c, Flex as f, Button as p } from "@mantine/core";
3
- import { useForm as h } from "@mantine/form";
4
- import { isValidUrl as g, isImageUrl as k, isVideoUrl as v, isAudioUrl as x } from "../../helpers/validation.js";
5
- import F from "./FilePicker.module.css.js";
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
- locales: i,
8
- onChange: u,
9
- type: s,
10
- isValidMediaUrl: a
8
+ onChange: o,
9
+ type: a,
10
+ isValidMediaUrl: s
11
11
  }) => {
12
- const l = h({
12
+ const { t: i } = c("ui"), l = g({
13
13
  initialValues: {
14
14
  url: ""
15
15
  },
16
16
  validate: {
17
- url: (r) => (r || "").trim().length > 0 && g(r) ? null : i.errors.invalidLink
17
+ url: (e) => (e || "").trim().length > 0 && v(e) ? null : i("changeCover.invalidLink")
18
18
  }
19
19
  }), n = async () => {
20
- const { values: r } = l;
21
- let e;
22
- s === "image" ? e = await k(r.url) : s === "video" ? a && a(r.url) ? e = !0 : e = await v(r.url) : s === "audio" ? e = await x(r.url) : e = !0, e ? u?.(r.url) : l.setFieldError("url", i.errors.invalidLink);
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__ */ o(m, { gap: "sm", children: [
24
+ return /* @__PURE__ */ u(m, { gap: "sm", children: [
25
25
  /* @__PURE__ */ t(d, { active: !0, children: /* @__PURE__ */ t(
26
- c,
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(f, { justify: "flex-end", align: "center", children: /* @__PURE__ */ t(
36
- p,
35
+ /* @__PURE__ */ t(p, { justify: "flex-end", align: "center", children: /* @__PURE__ */ t(
36
+ h,
37
37
  {
38
38
  onClick: n,
39
- className: F.button,
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
- import { FilePickerLocales } from './types';
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":"AA0BA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU5C,eAAO,MAAM,kBAAkB,GAAI,kCAIhC;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,4CAwGA,CAAC"}
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"}