@reportportal/ui-kit 0.0.1-alpha.254 → 0.0.1-alpha.255
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.
|
@@ -14,7 +14,7 @@ export interface AttachmentFile {
|
|
|
14
14
|
interface AttachedFilesListProps {
|
|
15
15
|
files: AttachmentFile[];
|
|
16
16
|
className?: string;
|
|
17
|
-
onRemoveFile
|
|
17
|
+
onRemoveFile?: (fileId: string) => void;
|
|
18
18
|
onDownloadFile?: (file: AttachmentFile) => void;
|
|
19
19
|
}
|
|
20
20
|
export declare const AttachedFilesList: ({ files, className, onRemoveFile, onDownloadFile, }: AttachedFilesListProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/fileDropArea.js
CHANGED
|
@@ -52,18 +52,18 @@ const w = (e, a) => {
|
|
|
52
52
|
) || n.push(g.INCORRECT_FILE_FORMAT);
|
|
53
53
|
}
|
|
54
54
|
return n;
|
|
55
|
-
},
|
|
55
|
+
}, N = (e, a, r) => r || (v(e) ? null : {
|
|
56
56
|
[g.INCORRECT_FILE_SIZE]: a.incorrectFileSize,
|
|
57
57
|
[g.INCORRECT_FILE_FORMAT]: a.incorrectFileFormat
|
|
58
|
-
}[e[0]]), U = 128,
|
|
59
|
-
maxFileSize: e =
|
|
58
|
+
}[e[0]]), U = 128, T = U * 1024 * 1024, V = ({
|
|
59
|
+
maxFileSize: e = T,
|
|
60
60
|
acceptFileMimeTypes: a = [],
|
|
61
61
|
onFilesAdded: r
|
|
62
62
|
}) => {
|
|
63
63
|
const [o, n] = I(null), s = d(
|
|
64
|
-
(
|
|
64
|
+
(t) => {
|
|
65
65
|
n(null);
|
|
66
|
-
const p =
|
|
66
|
+
const p = t.map((f) => ({
|
|
67
67
|
file: f,
|
|
68
68
|
validationErrors: w(f, { maxFileSize: e, acceptFileMimeTypes: a })
|
|
69
69
|
}));
|
|
@@ -75,27 +75,27 @@ const w = (e, a) => {
|
|
|
75
75
|
},
|
|
76
76
|
[e, a, r]
|
|
77
77
|
), l = d(
|
|
78
|
-
(
|
|
79
|
-
s(
|
|
78
|
+
(t) => {
|
|
79
|
+
s(t);
|
|
80
80
|
},
|
|
81
81
|
[s]
|
|
82
82
|
), c = d(
|
|
83
|
-
(
|
|
84
|
-
const { files: p } =
|
|
85
|
-
p && s([...p]),
|
|
83
|
+
(t) => {
|
|
84
|
+
const { files: p } = t.currentTarget;
|
|
85
|
+
p && s([...p]), t.currentTarget.value = "";
|
|
86
86
|
},
|
|
87
87
|
[s]
|
|
88
|
-
),
|
|
88
|
+
), i = d(() => {
|
|
89
89
|
n(null);
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
92
|
error: o,
|
|
93
93
|
handleFileInputChange: c,
|
|
94
|
-
clearError:
|
|
94
|
+
clearError: i,
|
|
95
95
|
onDrop: l
|
|
96
96
|
};
|
|
97
97
|
}, W = ({
|
|
98
|
-
maxFileSize: e =
|
|
98
|
+
maxFileSize: e = T,
|
|
99
99
|
acceptFileMimeTypes: a = [],
|
|
100
100
|
onFilesAdded: r
|
|
101
101
|
}) => {
|
|
@@ -114,15 +114,15 @@ const w = (e, a) => {
|
|
|
114
114
|
clearError: l
|
|
115
115
|
};
|
|
116
116
|
}, $ = ({ isOverlay: e = !1 }) => {
|
|
117
|
-
const [a, r] = I(!1), o = A(null), n = d((
|
|
117
|
+
const [a, r] = I(!1), o = A(null), n = d((t) => {
|
|
118
118
|
var p;
|
|
119
|
-
|
|
120
|
-
}, []), s = d((
|
|
121
|
-
|
|
122
|
-
}, []), l = d((
|
|
123
|
-
|
|
124
|
-
}, []), c = d((
|
|
125
|
-
|
|
119
|
+
t.preventDefault(), (p = t.dataTransfer) != null && p.types.includes("Files") && r(!0);
|
|
120
|
+
}, []), s = d((t) => {
|
|
121
|
+
t.preventDefault(), o.current && !o.current.contains(t.relatedTarget) && r(!1);
|
|
122
|
+
}, []), l = d((t) => {
|
|
123
|
+
t.preventDefault();
|
|
124
|
+
}, []), c = d((t) => {
|
|
125
|
+
t.preventDefault(), r(!1);
|
|
126
126
|
}, []);
|
|
127
127
|
return {
|
|
128
128
|
handlers: e ? {
|
|
@@ -199,7 +199,7 @@ const X = ({
|
|
|
199
199
|
role: "alert",
|
|
200
200
|
"aria-live": "assertive",
|
|
201
201
|
"aria-atomic": "true",
|
|
202
|
-
children:
|
|
202
|
+
children: N([a], r) || a
|
|
203
203
|
}
|
|
204
204
|
) : null;
|
|
205
205
|
}, u = h.bind(D), H = ({ icon: e, description: a, fileSizeMessage: r, className: o }) => {
|
|
@@ -208,18 +208,18 @@ const X = ({
|
|
|
208
208
|
error: s,
|
|
209
209
|
isDisabled: l,
|
|
210
210
|
isMultipleFiles: c,
|
|
211
|
-
overlayProps:
|
|
212
|
-
onDrop:
|
|
211
|
+
overlayProps: i,
|
|
212
|
+
onDrop: t,
|
|
213
213
|
handleDropzoneClick: p,
|
|
214
214
|
registerOpenFunction: m
|
|
215
215
|
} = E(), f = n === "overlay";
|
|
216
|
-
return /* @__PURE__ */ _(Z, { multiple: c, disabled: l, noClick: f, onDrop:
|
|
216
|
+
return /* @__PURE__ */ _(Z, { multiple: c, disabled: l, noClick: f, onDrop: t, children: ({ getRootProps: R, getInputProps: b, isDragActive: O, open: y }) => {
|
|
217
217
|
m(y);
|
|
218
|
-
const z = f ? !!(
|
|
218
|
+
const z = f ? !!(i != null && i.isDragActive) : O;
|
|
219
219
|
return /* @__PURE__ */ F(
|
|
220
220
|
"div",
|
|
221
221
|
{
|
|
222
|
-
...
|
|
222
|
+
...R({
|
|
223
223
|
className: u("file-drop-area", o, {
|
|
224
224
|
"file-drop-area--active": z,
|
|
225
225
|
"file-drop-area--disabled": l,
|
|
@@ -251,34 +251,34 @@ const X = ({
|
|
|
251
251
|
}) => {
|
|
252
252
|
const { messages: n, clearError: s } = E();
|
|
253
253
|
k(() => {
|
|
254
|
-
e.some((
|
|
254
|
+
e.some((t) => !v(t.validationErrors)) && s();
|
|
255
255
|
}, [e, s]);
|
|
256
256
|
const l = d(
|
|
257
|
-
(
|
|
257
|
+
(i) => () => r == null ? void 0 : r(i.id),
|
|
258
258
|
[r]
|
|
259
259
|
), c = d(
|
|
260
|
-
(
|
|
260
|
+
(i) => () => o == null ? void 0 : o(i),
|
|
261
261
|
[o]
|
|
262
262
|
);
|
|
263
|
-
return v(e) ? null : /* @__PURE__ */ _("div", { className: K("attached-files-list", a), children: e.map((
|
|
264
|
-
const
|
|
265
|
-
|
|
263
|
+
return v(e) ? null : /* @__PURE__ */ _("div", { className: K("attached-files-list", a), children: e.map((i) => {
|
|
264
|
+
const t = N(
|
|
265
|
+
i.validationErrors ?? [],
|
|
266
266
|
n,
|
|
267
|
-
|
|
267
|
+
i.customErrorMessage
|
|
268
268
|
);
|
|
269
269
|
return /* @__PURE__ */ _(
|
|
270
270
|
P,
|
|
271
271
|
{
|
|
272
|
-
fileName:
|
|
273
|
-
size:
|
|
274
|
-
uploadingProgress:
|
|
275
|
-
isUploadFailed:
|
|
276
|
-
isUploading:
|
|
277
|
-
onRemove: l(
|
|
278
|
-
...
|
|
279
|
-
...o && { onDownload: c(
|
|
272
|
+
fileName: i.fileName,
|
|
273
|
+
size: i.size,
|
|
274
|
+
uploadingProgress: i.uploadingProgress,
|
|
275
|
+
isUploadFailed: i.isUploadFailed || !!t,
|
|
276
|
+
isUploading: i.isUploading,
|
|
277
|
+
...r && { onRemove: l(i) },
|
|
278
|
+
...t && { uploadFailedMessage: t },
|
|
279
|
+
...o && { onDownload: c(i) }
|
|
280
280
|
},
|
|
281
|
-
|
|
281
|
+
i.id
|
|
282
282
|
);
|
|
283
283
|
}) });
|
|
284
284
|
}, ee = h.bind(D), x = ({
|
|
@@ -291,7 +291,7 @@ const X = ({
|
|
|
291
291
|
messages: l,
|
|
292
292
|
onFilesAdded: c
|
|
293
293
|
}) => {
|
|
294
|
-
const
|
|
294
|
+
const i = n === "overlay", t = W({
|
|
295
295
|
maxFileSize: e,
|
|
296
296
|
acceptFileMimeTypes: a,
|
|
297
297
|
messages: l,
|
|
@@ -299,18 +299,18 @@ const X = ({
|
|
|
299
299
|
isDisabled: o,
|
|
300
300
|
onFilesAdded: c
|
|
301
301
|
}), p = $({
|
|
302
|
-
isOverlay:
|
|
302
|
+
isOverlay: i
|
|
303
303
|
});
|
|
304
304
|
return /* @__PURE__ */ _(
|
|
305
305
|
X,
|
|
306
306
|
{
|
|
307
|
-
...
|
|
307
|
+
...t,
|
|
308
308
|
variant: n,
|
|
309
309
|
messages: l,
|
|
310
310
|
overlayProps: p,
|
|
311
311
|
isDisabled: o,
|
|
312
312
|
isMultipleFiles: r,
|
|
313
|
-
children: (() =>
|
|
313
|
+
children: (() => i ? /* @__PURE__ */ _("div", { className: ee("file-drop-area--overlay"), ...p.handlers, children: s }) : s)()
|
|
314
314
|
}
|
|
315
315
|
);
|
|
316
316
|
};
|