@hai-dev/ui-kit 1.0.3 → 1.0.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as io, Fragment as ho, jsx as
|
|
1
|
+
import { jsxs as io, Fragment as ho, jsx as h } from "react/jsx-runtime";
|
|
2
2
|
import { useState as s, useRef as M } from "react";
|
|
3
3
|
import "../../index-BiffjjQq.js";
|
|
4
4
|
import { c as mo } from "../../index-B2JRaoNz.js";
|
|
@@ -38,11 +38,11 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
38
38
|
},
|
|
39
39
|
showErrorPopup: K = !1,
|
|
40
40
|
minDimension: a = uo,
|
|
41
|
-
aspectRatio:
|
|
41
|
+
aspectRatio: m = go,
|
|
42
42
|
locale: e = Co,
|
|
43
43
|
timeout: E = Po,
|
|
44
44
|
fileMaxSize: D = Eo,
|
|
45
|
-
allowedExtensions:
|
|
45
|
+
allowedExtensions: d,
|
|
46
46
|
allowedMimeTypes: S,
|
|
47
47
|
circular: Q,
|
|
48
48
|
width: V,
|
|
@@ -51,32 +51,32 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
51
51
|
multiple: L,
|
|
52
52
|
fromSources: $,
|
|
53
53
|
...oo
|
|
54
|
-
} = k, [to,
|
|
55
|
-
P(o),
|
|
54
|
+
} = k, [to, i] = s(!1), [p, w] = s([]), [f, C] = s([]), [l, U] = s(0), _ = M(null), x = M(null), [y, A] = s(!1), [T, v] = s(""), [ro, I] = s(!1), F = (o = []) => {
|
|
55
|
+
P(o, p), i(!1);
|
|
56
56
|
}, eo = () => {
|
|
57
|
-
P([]),
|
|
57
|
+
P([], p), i(!1);
|
|
58
58
|
}, no = () => {
|
|
59
59
|
I(!1);
|
|
60
60
|
}, u = (o) => {
|
|
61
|
-
j(o), w(o), C(Array(o.length)), U(0),
|
|
61
|
+
j(o), w(o), C(Array(o.length)), U(0), i(!0), v("");
|
|
62
62
|
}, g = (o) => {
|
|
63
|
-
o instanceof Error && (console.warn(o.message), B(o), v(o.message), I(!0), w([]),
|
|
63
|
+
o instanceof Error && (console.warn(o.message), B(o), v(o.message), I(!0), w([]), i(!1));
|
|
64
64
|
}, ao = async (o) => {
|
|
65
65
|
const { files: r } = o.target;
|
|
66
66
|
if (r?.length)
|
|
67
67
|
try {
|
|
68
68
|
if (A(!0), H(), L) {
|
|
69
69
|
const t = Array.from(r);
|
|
70
|
-
t.forEach((
|
|
70
|
+
t.forEach((c) => {
|
|
71
71
|
N(
|
|
72
|
-
|
|
73
|
-
{ maxSize: D, allowedExtensions:
|
|
72
|
+
c,
|
|
73
|
+
{ maxSize: D, allowedExtensions: d, allowedMimeTypes: S },
|
|
74
74
|
e
|
|
75
75
|
);
|
|
76
76
|
});
|
|
77
77
|
const n = await Promise.all(
|
|
78
78
|
t.map(
|
|
79
|
-
(
|
|
79
|
+
(c) => R(c, a, e, E)
|
|
80
80
|
)
|
|
81
81
|
);
|
|
82
82
|
u(n);
|
|
@@ -84,7 +84,7 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
84
84
|
const t = r[0];
|
|
85
85
|
N(
|
|
86
86
|
t,
|
|
87
|
-
{ maxSize: D, allowedExtensions:
|
|
87
|
+
{ maxSize: D, allowedExtensions: d, allowedMimeTypes: S },
|
|
88
88
|
e
|
|
89
89
|
);
|
|
90
90
|
const n = await R(t, a, e, E);
|
|
@@ -96,9 +96,9 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
96
96
|
o.target.value = "", A(!1);
|
|
97
97
|
}
|
|
98
98
|
}, so = (o) => {
|
|
99
|
-
const { width: r, height: t } = o.currentTarget, n = wo(r, t, a,
|
|
100
|
-
C((
|
|
101
|
-
const b = [...
|
|
99
|
+
const { width: r, height: t } = o.currentTarget, n = wo(r, t, a, m);
|
|
100
|
+
C((c) => {
|
|
101
|
+
const b = [...c];
|
|
102
102
|
return b[l] = n, b;
|
|
103
103
|
});
|
|
104
104
|
}, lo = (o, r) => {
|
|
@@ -117,18 +117,18 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
117
117
|
f[l],
|
|
118
118
|
e
|
|
119
119
|
);
|
|
120
|
-
Z(t), l >=
|
|
120
|
+
Z(t), l >= p.length - 1 && F();
|
|
121
121
|
} catch (t) {
|
|
122
122
|
t instanceof Error && (console.warn(t), g(t));
|
|
123
123
|
}
|
|
124
124
|
}, po = () => {
|
|
125
125
|
O(), U((o) => o + 1);
|
|
126
126
|
}, co = async () => {
|
|
127
|
-
const o =
|
|
127
|
+
const o = p.slice(l);
|
|
128
128
|
try {
|
|
129
129
|
const r = await Promise.all(
|
|
130
130
|
o.map(
|
|
131
|
-
(t) => _o(t, a,
|
|
131
|
+
(t) => _o(t, a, m, e)
|
|
132
132
|
)
|
|
133
133
|
);
|
|
134
134
|
F(r);
|
|
@@ -137,7 +137,7 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
return /* @__PURE__ */ io(ho, { children: [
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ h(
|
|
141
141
|
So,
|
|
142
142
|
{
|
|
143
143
|
onChange: ao,
|
|
@@ -147,7 +147,7 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
147
147
|
buttonDisabled: y,
|
|
148
148
|
locale: e,
|
|
149
149
|
width: V,
|
|
150
|
-
allowedExtensions:
|
|
150
|
+
allowedExtensions: d,
|
|
151
151
|
onDragDrop: J,
|
|
152
152
|
onDragLeave: G,
|
|
153
153
|
onDragOver: q,
|
|
@@ -158,12 +158,12 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
158
158
|
children: fo[e].upload
|
|
159
159
|
}
|
|
160
160
|
),
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ h(
|
|
162
162
|
Do,
|
|
163
163
|
{
|
|
164
164
|
open: to,
|
|
165
165
|
photoCrops: f,
|
|
166
|
-
photoSources:
|
|
166
|
+
photoSources: p,
|
|
167
167
|
onNextPhoto: po,
|
|
168
168
|
onSkipCrop: co,
|
|
169
169
|
photoError: T,
|
|
@@ -173,14 +173,14 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
173
173
|
onPhotoLoad: so,
|
|
174
174
|
imageRef: _,
|
|
175
175
|
minDimension: a,
|
|
176
|
-
aspectRatio:
|
|
176
|
+
aspectRatio: m,
|
|
177
177
|
locale: e,
|
|
178
178
|
circular: Q,
|
|
179
179
|
keepSelection: W,
|
|
180
180
|
photoIndex: l
|
|
181
181
|
}
|
|
182
182
|
),
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ h(
|
|
184
184
|
Lo,
|
|
185
185
|
{
|
|
186
186
|
open: K && ro,
|
|
@@ -189,7 +189,7 @@ import '../../assets/photo-crop-uploader.css';const xo = "_photoCropCanvas_1i4lr
|
|
|
189
189
|
locale: e
|
|
190
190
|
}
|
|
191
191
|
),
|
|
192
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ h(
|
|
193
193
|
"canvas",
|
|
194
194
|
{
|
|
195
195
|
className: mo(yo.photoCropCanvas),
|
|
@@ -20,7 +20,7 @@ export type PhotoCropUploaderCustomProps = {
|
|
|
20
20
|
onError?: (error: Error) => unknown;
|
|
21
21
|
onStartCrop?: () => unknown;
|
|
22
22
|
onEndCrop?: (photoData: PhotoDataUrl) => unknown;
|
|
23
|
-
onClose?: (skipPhotosData: PhotoDataUrl[]) => unknown;
|
|
23
|
+
onClose?: (skipPhotosData: PhotoDataUrl[], sourcesData: PhotoDataUrl[]) => unknown;
|
|
24
24
|
onDragOver?: (event: DragEvent<HTMLDivElement>) => unknown;
|
|
25
25
|
onDragLeave?: (event: DragEvent<HTMLDivElement>) => unknown;
|
|
26
26
|
onDragDrop?: (event: DragEvent<HTMLDivElement>) => unknown;
|