@caspeco/casper-ui-library 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/image-upload/image-upload-dropzone.js +88 -86
- package/dist/components/image-upload/image-upload-helper.d.ts +3 -0
- package/dist/components/image-upload/image-upload-helper.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-helper.js +20 -3
- package/dist/components/image-upload/image-upload-modal.d.ts.map +1 -1
- package/dist/components/image-upload/image-upload-modal.js +98 -73
- package/dist/components/image-upload/translations.d.ts +7 -0
- package/dist/components/image-upload/translations.d.ts.map +1 -1
- package/dist/components/image-upload/translations.js +6 -0
- package/dist/node_modules/@dnd-kit/dom/index.js +237 -233
- package/dist/node_modules/@dnd-kit/dom/sortable.js +367 -326
- package/dist/node_modules/@dnd-kit/dom/utilities.js +11 -11
- package/dist/node_modules/@dnd-kit/react/sortable.js +55 -40
- package/package.json +20 -20
|
@@ -1,111 +1,113 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Text as
|
|
4
|
-
import
|
|
5
|
-
import { sanitizeFilename as
|
|
6
|
-
import { ImageIconLarge as
|
|
7
|
-
import { translations as
|
|
8
|
-
import { Alert as
|
|
9
|
-
import { ThemeColorVariable as
|
|
10
|
-
function
|
|
11
|
-
const e =
|
|
12
|
-
locale:
|
|
13
|
-
setFileItem:
|
|
14
|
-
setHasImageChanged:
|
|
15
|
-
} =
|
|
16
|
-
let u;
|
|
17
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = re.createRef(), e[0] = u) : u = e[0];
|
|
18
|
-
const n = u;
|
|
19
|
-
let g;
|
|
20
|
-
e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = function(r, a) {
|
|
21
|
-
const T = new FileReader();
|
|
22
|
-
T.onload = a, T.readAsDataURL(r);
|
|
23
|
-
}, e[1] = g) : g = e[1];
|
|
24
|
-
const J = g;
|
|
1
|
+
import { jsx as u, jsxs as M, Fragment as te } from "react/jsx-runtime";
|
|
2
|
+
import { c as re } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { Text as N, Box as $, Input as le } from "@chakra-ui/react";
|
|
4
|
+
import ae, { useState as V } from "react";
|
|
5
|
+
import { sanitizeFilename as oe } from "./image-upload-helper.js";
|
|
6
|
+
import { ImageIconLarge as ne } from "./image-upload-icons.js";
|
|
7
|
+
import { translations as g } from "./translations.js";
|
|
8
|
+
import { Alert as q } from "../alert/alert.js";
|
|
9
|
+
import { ThemeColorVariable as H, ThemeRadiusVariable as ie, ThemeSpaceVariable as G } from "../../theme/theme-types.js";
|
|
10
|
+
function _e(J) {
|
|
11
|
+
const e = re.c(37), {
|
|
12
|
+
locale: r,
|
|
13
|
+
setFileItem: A,
|
|
14
|
+
setHasImageChanged: C
|
|
15
|
+
} = J, [K, z] = V(!1), [w, O] = V(!1), [E, W] = V(!1);
|
|
25
16
|
let h;
|
|
26
|
-
e[
|
|
27
|
-
const
|
|
17
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = ae.createRef(), e[0] = h) : h = e[0];
|
|
18
|
+
const o = h;
|
|
28
19
|
let b;
|
|
29
|
-
e[
|
|
20
|
+
e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = function(l, a) {
|
|
21
|
+
const R = new FileReader();
|
|
22
|
+
R.onload = a, R.readAsDataURL(l);
|
|
23
|
+
}, e[1] = b) : b = e[1];
|
|
24
|
+
const P = b;
|
|
25
|
+
let _;
|
|
26
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = ["image/jpeg", "image/png", "image/webp", "image/gif", "image/svg+xml"], e[2] = _) : _ = e[2];
|
|
27
|
+
const Q = _;
|
|
28
|
+
let D;
|
|
29
|
+
e[3] !== A || e[4] !== C ? (D = (t) => {
|
|
30
30
|
const {
|
|
31
|
-
target:
|
|
31
|
+
target: l
|
|
32
32
|
} = t;
|
|
33
|
-
if (!
|
|
33
|
+
if (!l || !l.files || !l.files[0])
|
|
34
34
|
return;
|
|
35
|
-
const a =
|
|
36
|
-
if (!
|
|
37
|
-
|
|
35
|
+
const a = l.files[0];
|
|
36
|
+
if (!Q.includes(a.type)) {
|
|
37
|
+
W(!0);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
fileName:
|
|
43
|
-
data:
|
|
40
|
+
W(!1), a.size > 3145728 ? O(!0) : (O(!1), P(a, (R) => {
|
|
41
|
+
const v = R.target?.result, ee = {
|
|
42
|
+
fileName: oe(a.name),
|
|
43
|
+
data: v
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
A(ee), C(!0);
|
|
46
46
|
}));
|
|
47
|
-
}, e[3] =
|
|
48
|
-
const
|
|
49
|
-
let _;
|
|
50
|
-
e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = () => {
|
|
51
|
-
n.current && n.current.click();
|
|
52
|
-
}, e[6] = _) : _ = e[6];
|
|
53
|
-
const P = _;
|
|
54
|
-
let D;
|
|
55
|
-
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = (t) => {
|
|
56
|
-
t.preventDefault(), t.dataTransfer.items && t.dataTransfer.items.length > 0 && C(!0);
|
|
57
|
-
}, e[7] = D) : D = e[7];
|
|
58
|
-
const Q = D;
|
|
47
|
+
}, e[3] = A, e[4] = C, e[5] = D) : D = e[5];
|
|
48
|
+
const n = D;
|
|
59
49
|
let x;
|
|
60
|
-
e[
|
|
61
|
-
|
|
62
|
-
}, e[
|
|
50
|
+
e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = () => {
|
|
51
|
+
o.current && o.current.click();
|
|
52
|
+
}, e[6] = x) : x = e[6];
|
|
63
53
|
const X = x;
|
|
64
54
|
let y;
|
|
65
|
-
e[
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (t) => {
|
|
56
|
+
t.preventDefault(), t.dataTransfer.items && t.dataTransfer.items.length > 0 && z(!0);
|
|
57
|
+
}, e[7] = y) : y = e[7];
|
|
58
|
+
const Y = y;
|
|
59
|
+
let F;
|
|
60
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = () => {
|
|
61
|
+
z(!1);
|
|
62
|
+
}, e[8] = F) : F = e[8];
|
|
63
|
+
const Z = F;
|
|
64
|
+
let S;
|
|
65
|
+
e[9] !== n ? (S = (t) => {
|
|
66
|
+
if (t.preventDefault(), !!o.current && t.dataTransfer.files && t.dataTransfer.files.length > 0) {
|
|
67
|
+
const l = new DataTransfer();
|
|
68
68
|
Array.from(t.dataTransfer.files).forEach((a) => {
|
|
69
|
-
|
|
70
|
-
}),
|
|
71
|
-
target:
|
|
72
|
-
}), t.dataTransfer.clearData(),
|
|
69
|
+
l.items.add(a);
|
|
70
|
+
}), o.current.files = l.files, n({
|
|
71
|
+
target: o.current
|
|
72
|
+
}), t.dataTransfer.clearData(), z(!1);
|
|
73
73
|
}
|
|
74
|
-
}, e[9] =
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
78
|
-
const
|
|
74
|
+
}, e[9] = n, e[10] = S) : S = e[10];
|
|
75
|
+
const U = S, j = K ? H.OnSurfaceBorder : "transparent";
|
|
76
|
+
let T;
|
|
77
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ u(ne, {}), e[11] = T) : T = e[11];
|
|
78
|
+
const k = g[r];
|
|
79
79
|
let i;
|
|
80
|
-
e[12] !==
|
|
81
|
-
const
|
|
80
|
+
e[12] !== k.pullAndDrop ? (i = /* @__PURE__ */ u(N, { children: k.pullAndDrop }), e[12] = k.pullAndDrop, e[13] = i) : i = e[13];
|
|
81
|
+
const B = g[r], L = g[r];
|
|
82
82
|
let s;
|
|
83
|
-
e[14] !==
|
|
84
|
-
|
|
83
|
+
e[14] !== L.upload ? (s = /* @__PURE__ */ u($, { as: "span", color: H.Accent, textDecoration: "underline", children: L.upload }), e[14] = L.upload, e[15] = s) : s = e[15];
|
|
84
|
+
let c;
|
|
85
|
+
e[16] !== B.or || e[17] !== s ? (c = /* @__PURE__ */ M(N, { children: [
|
|
86
|
+
B.or,
|
|
85
87
|
" ",
|
|
86
|
-
|
|
88
|
+
s,
|
|
87
89
|
"."
|
|
88
|
-
] }), e[
|
|
89
|
-
let c;
|
|
90
|
-
e[16] !== o ? (c = /* @__PURE__ */ p(te, { type: "file", ref: n, display: "none", onChange: o }), e[16] = o, e[17] = c) : c = e[17];
|
|
90
|
+
] }), e[16] = B.or, e[17] = s, e[18] = c) : c = e[18];
|
|
91
91
|
let f;
|
|
92
|
-
e[
|
|
93
|
-
F,
|
|
94
|
-
i,
|
|
95
|
-
s,
|
|
96
|
-
c
|
|
97
|
-
] }), e[18] = E, e[19] = i, e[20] = s, e[21] = c, e[22] = U, e[23] = f) : f = e[23];
|
|
92
|
+
e[19] !== n ? (f = /* @__PURE__ */ u(le, { type: "file", ref: o, display: "none", onChange: n }), e[19] = n, e[20] = f) : f = e[20];
|
|
98
93
|
let m;
|
|
99
|
-
e[24] !==
|
|
94
|
+
e[21] !== U || e[22] !== i || e[23] !== c || e[24] !== f || e[25] !== j ? (m = /* @__PURE__ */ M($, { p: "108px", bg: H.BackgroundDisabled, borderWidth: "1px", borderColor: j, transition: "150ms ease", borderRadius: ie.Medium, display: "flex", alignItems: "center", justifyContent: "center", flexDir: "column", onDragOver: Y, onDragLeave: Z, onDrop: U, onClick: X, cursor: "pointer", children: [
|
|
95
|
+
T,
|
|
96
|
+
i,
|
|
97
|
+
c,
|
|
98
|
+
f
|
|
99
|
+
] }), e[21] = U, e[22] = i, e[23] = c, e[24] = f, e[25] = j, e[26] = m) : m = e[26];
|
|
100
100
|
let d;
|
|
101
|
-
e[27] !==
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
e[27] !== r || e[28] !== E ? (d = E && /* @__PURE__ */ u(q, { mt: G.Medium, type: "error", children: g[r].unsupportedFormat }), e[27] = r, e[28] = E, e[29] = d) : d = e[29];
|
|
102
|
+
let p;
|
|
103
|
+
e[30] !== r || e[31] !== w ? (p = w && /* @__PURE__ */ u(q, { mt: G.Medium, type: "error", children: g[r].sizeExceeded }), e[30] = r, e[31] = w, e[32] = p) : p = e[32];
|
|
104
|
+
let I;
|
|
105
|
+
return e[33] !== m || e[34] !== d || e[35] !== p ? (I = /* @__PURE__ */ M(te, { children: [
|
|
105
106
|
m,
|
|
106
|
-
d
|
|
107
|
-
|
|
107
|
+
d,
|
|
108
|
+
p
|
|
109
|
+
] }), e[33] = m, e[34] = d, e[35] = p, e[36] = I) : I = e[36], I;
|
|
108
110
|
}
|
|
109
111
|
export {
|
|
110
|
-
|
|
112
|
+
_e as default
|
|
111
113
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { FileItem } from './image-upload-dropzone.js';
|
|
1
2
|
export declare function sanitizeFilename(filename: string): string;
|
|
3
|
+
export declare function readBlobAsDataUrl(blob: Blob): Promise<string>;
|
|
4
|
+
export declare function loadImageFileItem(src: string, signal?: AbortSignal): Promise<FileItem>;
|
|
2
5
|
//# sourceMappingURL=image-upload-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-upload-helper.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/image-upload-helper.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD"}
|
|
1
|
+
{"version":3,"file":"image-upload-helper.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/image-upload-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAO7D;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAO5F"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function t(a) {
|
|
2
|
+
return a.replace(/[^a-zA-Z0-9-.]/g, "_");
|
|
3
|
+
}
|
|
4
|
+
function o(a) {
|
|
5
|
+
return new Promise((r, n) => {
|
|
6
|
+
const e = new FileReader();
|
|
7
|
+
e.onload = () => r(e.result), e.onerror = () => n(e.error ?? new Error("Failed to read image data")), e.readAsDataURL(a);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
async function i(a, r) {
|
|
11
|
+
const e = await (await fetch(a, {
|
|
12
|
+
signal: r
|
|
13
|
+
})).blob();
|
|
14
|
+
return {
|
|
15
|
+
data: await o(e),
|
|
16
|
+
fileName: t(a)
|
|
17
|
+
};
|
|
3
18
|
}
|
|
4
19
|
export {
|
|
5
|
-
|
|
20
|
+
i as loadImageFileItem,
|
|
21
|
+
o as readBlobAsDataUrl,
|
|
22
|
+
t as sanitizeFilename
|
|
6
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-upload-modal.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/image-upload-modal.tsx"],"names":[],"mappings":"AAOA,OAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,KAAK,IAAI,EAAE,sBAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAE1E,UAAU,uBAAuB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,sBAAsB,CAAC;IACpC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3F,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,EAChC,KAAK,EACL,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,eAAe,EACf,eAAe,EACf,OAAO,GACP,EAAE,uBAAuB,+
|
|
1
|
+
{"version":3,"file":"image-upload-modal.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/image-upload-modal.tsx"],"names":[],"mappings":"AAOA,OAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,KAAK,IAAI,EAAE,sBAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAE1E,UAAU,uBAAuB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,sBAAsB,CAAC;IACpC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3F,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,gBAAgB,CAAC,EAChC,KAAK,EACL,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,eAAe,EACf,eAAe,EACf,OAAO,GACP,EAAE,uBAAuB,+BA8GzB"}
|
|
@@ -1,82 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { jsx as l, jsxs as C, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { c as J } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { ButtonGroup as K } from "@chakra-ui/react";
|
|
4
|
+
import { useState as E, useEffect as Q } from "react";
|
|
5
|
+
import { ImageCropper as Y } from "./image-cropper.js";
|
|
6
|
+
import Z from "./image-upload-dropzone.js";
|
|
7
|
+
import { loadImageFileItem as W } from "./image-upload-helper.js";
|
|
8
|
+
import { RemoveIcon as ee } from "./image-upload-icons.js";
|
|
9
|
+
import { translations as F } from "./translations.js";
|
|
10
|
+
import { Text as te } from "../text/text.js";
|
|
11
|
+
import { ModalHeader as oe } from "../modal/modal-header.js";
|
|
12
|
+
import { ModalBody as re } from "../modal/modal-body.js";
|
|
13
|
+
import { Button as L } from "../button/button.js";
|
|
14
|
+
import { ModalFooter as ae } from "../modal/modal-footer.js";
|
|
15
|
+
import { ModalCloseButton as le } from "../modal/modal-close-button.js";
|
|
16
|
+
import { Modal as ie } from "../modal/modal.js";
|
|
17
|
+
import { ThemeFontSizeVariable as me, ThemeFontVariable as ne, ThemeColorVariable as X, ThemeSpaceVariable as i } from "../../theme/theme-types.js";
|
|
18
|
+
function Fe(A) {
|
|
19
|
+
const e = J.c(48), {
|
|
20
|
+
title: T,
|
|
21
|
+
src: o,
|
|
22
|
+
savedCrop: B,
|
|
23
|
+
isOpen: k,
|
|
24
|
+
aspectRatio: w,
|
|
25
|
+
crop: n,
|
|
26
|
+
locale: m,
|
|
27
|
+
onClose: z,
|
|
28
|
+
handleSaveImage: H,
|
|
29
|
+
setPreviewImage: r,
|
|
30
|
+
setCrop: a
|
|
31
|
+
} = A, [O, G] = E(!1);
|
|
32
|
+
let b;
|
|
33
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = {
|
|
31
34
|
data: "",
|
|
32
35
|
fileName: ""
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
}, e[0] = b) : b = e[0];
|
|
37
|
+
const [t, u] = E(b);
|
|
38
|
+
let I, S;
|
|
39
|
+
e[1] !== o ? (I = () => {
|
|
40
|
+
if (!o)
|
|
41
|
+
return;
|
|
42
|
+
const D = new AbortController();
|
|
43
|
+
return W(o, D.signal).then((U) => {
|
|
44
|
+
D.signal.aborted || u(U);
|
|
45
|
+
}).catch(console.error), () => {
|
|
46
|
+
D.abort();
|
|
47
|
+
};
|
|
48
|
+
}, S = [o], e[1] = o, e[2] = I, e[3] = S) : (I = e[2], S = e[3]), Q(I, S);
|
|
49
|
+
let v;
|
|
50
|
+
e[4] !== n || e[5] !== t || e[6] !== H || e[7] !== O ? (v = () => {
|
|
51
|
+
H(t, n, O);
|
|
52
|
+
}, e[4] = n, e[5] = t, e[6] = H, e[7] = O, e[8] = v) : v = e[8];
|
|
53
|
+
const R = v, V = (!t.data || !t.fileName) && !o, P = (!t.data || !t.fileName) && o;
|
|
54
|
+
let y;
|
|
55
|
+
e[9] !== z || e[10] !== B || e[11] !== a || e[12] !== r || e[13] !== o ? (y = () => {
|
|
56
|
+
u({
|
|
53
57
|
data: "",
|
|
54
58
|
fileName: ""
|
|
55
|
-
}),
|
|
56
|
-
}, z =
|
|
57
|
-
|
|
59
|
+
}), r(""), o && (W(o).then(u).catch(console.error), r(o)), a(B || null), z();
|
|
60
|
+
}, e[9] = z, e[10] = B, e[11] = a, e[12] = r, e[13] = o, e[14] = y) : y = e[14];
|
|
61
|
+
const s = y;
|
|
62
|
+
let x;
|
|
63
|
+
e[15] !== a || e[16] !== r ? (x = () => {
|
|
64
|
+
u({
|
|
58
65
|
data: "",
|
|
59
66
|
fileName: ""
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
}), r(""), a(null);
|
|
68
|
+
}, e[15] = a, e[16] = r, e[17] = x) : x = e[17];
|
|
69
|
+
const _ = x;
|
|
70
|
+
let c;
|
|
71
|
+
e[18] !== T ? (c = /* @__PURE__ */ l(te, { color: X.OnSurfaceHeader, fontFamily: ne.SubHeader, fontWeight: "medium", fontSize: me.XLarge, children: T }), e[18] = T, e[19] = c) : c = e[19];
|
|
72
|
+
let M;
|
|
73
|
+
e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ l(le, {}), e[20] = M) : M = e[20];
|
|
74
|
+
let f;
|
|
75
|
+
e[21] !== c ? (f = /* @__PURE__ */ C(oe, { display: "flex", alignItems: "center", justifyContent: "space-between", p: i.Medium, children: [
|
|
76
|
+
c,
|
|
77
|
+
M
|
|
78
|
+
] }), e[21] = c, e[22] = f) : f = e[22];
|
|
79
|
+
let d;
|
|
80
|
+
e[23] !== w || e[24] !== n || e[25] !== t.data || e[26] !== t.fileName || e[27] !== _ || e[28] !== m || e[29] !== a || e[30] !== r ? (d = /* @__PURE__ */ l(re, { display: "flex", flexDirection: "column", p: `${i.Large} ${i.Medium}`, children: t.data && t.fileName ? /* @__PURE__ */ C(q, { children: [
|
|
81
|
+
/* @__PURE__ */ l(Y, { src: t.data, crop: n, onCropCallback: a, aspectRatio: w, setPreviewImage: r }),
|
|
82
|
+
/* @__PURE__ */ l(K, { gap: i.Small, mt: i.Large, flexWrap: "wrap", children: /* @__PURE__ */ C(L, { variant: "ghost", onClick: _, gap: i.XSmall, children: [
|
|
83
|
+
/* @__PURE__ */ l(ee, {}),
|
|
84
|
+
F[m].remove
|
|
85
|
+
] }) })
|
|
86
|
+
] }) : /* @__PURE__ */ l(Z, { locale: m, setFileItem: u, setHasImageChanged: G }) }), e[23] = w, e[24] = n, e[25] = t.data, e[26] = t.fileName, e[27] = _, e[28] = m, e[29] = a, e[30] = r, e[31] = d) : d = e[31];
|
|
87
|
+
const $ = F[m];
|
|
88
|
+
let p;
|
|
89
|
+
e[32] !== s || e[33] !== $.secondary ? (p = /* @__PURE__ */ l(L, { variant: "ghost", onClick: s, children: $.secondary }), e[32] = s, e[33] = $.secondary, e[34] = p) : p = e[34];
|
|
90
|
+
const j = P ? F[m].remove : F[m].primary;
|
|
91
|
+
let h;
|
|
92
|
+
e[35] !== V || e[36] !== R || e[37] !== j ? (h = /* @__PURE__ */ l(L, { variant: "primary", onClick: R, isDisabled: V, children: j }), e[35] = V, e[36] = R, e[37] = j, e[38] = h) : h = e[38];
|
|
93
|
+
let g;
|
|
94
|
+
e[39] !== p || e[40] !== h ? (g = /* @__PURE__ */ C(ae, { p: i.Medium, gap: i.Medium, borderTop: `1px solid ${X.OnSurfaceBorder}`, children: [
|
|
95
|
+
p,
|
|
96
|
+
h
|
|
97
|
+
] }), e[39] = p, e[40] = h, e[41] = g) : g = e[41];
|
|
98
|
+
let N;
|
|
99
|
+
return e[42] !== s || e[43] !== k || e[44] !== d || e[45] !== g || e[46] !== f ? (N = /* @__PURE__ */ C(ie, { isOpen: k, onClose: s, size: "md", children: [
|
|
100
|
+
f,
|
|
101
|
+
d,
|
|
102
|
+
g
|
|
103
|
+
] }), e[42] = s, e[43] = k, e[44] = d, e[45] = g, e[46] = f, e[47] = N) : N = e[47], N;
|
|
79
104
|
}
|
|
80
105
|
export {
|
|
81
|
-
|
|
106
|
+
Fe as ImageUploadModal
|
|
82
107
|
};
|
|
@@ -5,6 +5,7 @@ export declare const translations: {
|
|
|
5
5
|
secondary: string;
|
|
6
6
|
remove: string;
|
|
7
7
|
pullAndDrop: string;
|
|
8
|
+
or: string;
|
|
8
9
|
upload: string;
|
|
9
10
|
unsupportedFormat: string;
|
|
10
11
|
sizeExceeded: string;
|
|
@@ -14,6 +15,7 @@ export declare const translations: {
|
|
|
14
15
|
secondary: string;
|
|
15
16
|
remove: string;
|
|
16
17
|
pullAndDrop: string;
|
|
18
|
+
or: string;
|
|
17
19
|
upload: string;
|
|
18
20
|
unsupportedFormat: string;
|
|
19
21
|
sizeExceeded: string;
|
|
@@ -23,6 +25,7 @@ export declare const translations: {
|
|
|
23
25
|
secondary: string;
|
|
24
26
|
remove: string;
|
|
25
27
|
pullAndDrop: string;
|
|
28
|
+
or: string;
|
|
26
29
|
upload: string;
|
|
27
30
|
unsupportedFormat: string;
|
|
28
31
|
sizeExceeded: string;
|
|
@@ -32,6 +35,7 @@ export declare const translations: {
|
|
|
32
35
|
secondary: string;
|
|
33
36
|
remove: string;
|
|
34
37
|
pullAndDrop: string;
|
|
38
|
+
or: string;
|
|
35
39
|
upload: string;
|
|
36
40
|
unsupportedFormat: string;
|
|
37
41
|
sizeExceeded: string;
|
|
@@ -41,6 +45,7 @@ export declare const translations: {
|
|
|
41
45
|
secondary: string;
|
|
42
46
|
remove: string;
|
|
43
47
|
pullAndDrop: string;
|
|
48
|
+
or: string;
|
|
44
49
|
upload: string;
|
|
45
50
|
unsupportedFormat: string;
|
|
46
51
|
sizeExceeded: string;
|
|
@@ -50,6 +55,7 @@ export declare const translations: {
|
|
|
50
55
|
secondary: string;
|
|
51
56
|
remove: string;
|
|
52
57
|
pullAndDrop: string;
|
|
58
|
+
or: string;
|
|
53
59
|
upload: string;
|
|
54
60
|
unsupportedFormat: string;
|
|
55
61
|
sizeExceeded: string;
|
|
@@ -59,6 +65,7 @@ export declare const translations: {
|
|
|
59
65
|
secondary: string;
|
|
60
66
|
remove: string;
|
|
61
67
|
pullAndDrop: string;
|
|
68
|
+
or: string;
|
|
62
69
|
upload: string;
|
|
63
70
|
unsupportedFormat: string;
|
|
64
71
|
sizeExceeded: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../lib/components/image-upload/translations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAc1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DxB,CAAC"}
|
|
@@ -3,6 +3,7 @@ const e = {
|
|
|
3
3
|
secondary: "Cancel",
|
|
4
4
|
remove: "Remove image",
|
|
5
5
|
pullAndDrop: "Drag and drop the image here",
|
|
6
|
+
or: "or",
|
|
6
7
|
upload: "Upload a file",
|
|
7
8
|
unsupportedFormat: "Unsupported file format. Please upload a JPG, PNG, WebP, GIF, or SVG.",
|
|
8
9
|
sizeExceeded: "The image size exceeds 3MB. Please choose a smaller file or reduce the size of the current image."
|
|
@@ -12,6 +13,7 @@ const e = {
|
|
|
12
13
|
secondary: "Avbryt",
|
|
13
14
|
remove: "Ta bort bild",
|
|
14
15
|
pullAndDrop: "Dra och släpp bilden här",
|
|
16
|
+
or: "eller",
|
|
15
17
|
upload: "ladda upp en fil",
|
|
16
18
|
unsupportedFormat: "Otillåtet filformat. Vänligen ladda upp JPG, PNG, WebP, GIF, eller SVG.",
|
|
17
19
|
sizeExceeded: "Storleken på bilden du försöker ladda upp överskrider 3MB. Vänligen välj en mindre fil eller minska storleken på den nuvarande bilden."
|
|
@@ -23,6 +25,7 @@ const e = {
|
|
|
23
25
|
secondary: "Avbryt",
|
|
24
26
|
remove: "Fjern bilde",
|
|
25
27
|
pullAndDrop: "Dra og slipp bildet her",
|
|
28
|
+
or: "eller",
|
|
26
29
|
upload: "Last opp en fil",
|
|
27
30
|
unsupportedFormat: "Ugyldig filformat. Vennligst last opp en JPG, PNG, WebP, GIF eller SVG.",
|
|
28
31
|
sizeExceeded: "Bildet du prøver å laste opp overstiger 3MB. Vennligst velg en mindre fil eller reduser størrelsen på det nåværende bildet."
|
|
@@ -32,6 +35,7 @@ const e = {
|
|
|
32
35
|
secondary: "Annuller",
|
|
33
36
|
remove: "Fjern billede",
|
|
34
37
|
pullAndDrop: "Træk og slip billedet her",
|
|
38
|
+
or: "eller",
|
|
35
39
|
upload: "Upload en fil",
|
|
36
40
|
unsupportedFormat: "Ugyldigt filformat. Upload venligst en JPG, PNG, WebP, GIF eller SVG.",
|
|
37
41
|
sizeExceeded: "Billedets størrelse overstiger 3MB. Vælg venligst en mindre fil eller reducer størrelsen på det nuværende billede."
|
|
@@ -41,6 +45,7 @@ const e = {
|
|
|
41
45
|
secondary: "Annuler",
|
|
42
46
|
remove: "Supprimer l'image",
|
|
43
47
|
pullAndDrop: "Glissez-déposez l'image ici",
|
|
48
|
+
or: "ou",
|
|
44
49
|
upload: "Télécharger un fichier",
|
|
45
50
|
unsupportedFormat: "Format de fichier non pris en charge. Veuillez télécharger un JPG, PNG, WebP, GIF ou SVG.",
|
|
46
51
|
sizeExceeded: "La taille de l'image dépasse 3 Mo. Veuillez choisir un fichier plus petit ou réduire la taille de l'image actuelle."
|
|
@@ -50,6 +55,7 @@ const e = {
|
|
|
50
55
|
secondary: "Annuleren",
|
|
51
56
|
remove: "Afbeelding verwijderen",
|
|
52
57
|
pullAndDrop: "Sleep de afbeelding hierheen",
|
|
58
|
+
or: "of",
|
|
53
59
|
upload: "Een bestand uploaden",
|
|
54
60
|
unsupportedFormat: "Ongeldig bestandsformaat. Upload een JPG, PNG, WebP, GIF of SVG.",
|
|
55
61
|
sizeExceeded: "De afbeelding die je probeert te uploaden is groter dan 3 MB. Kies een kleiner bestand of verklein de huidige afbeelding."
|