@veritone-ce/design-system 2.4.11 → 2.4.12
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.
|
@@ -34,8 +34,10 @@ function UploadDropzone(props) {
|
|
|
34
34
|
uploady.BATCH_STATES.PENDING
|
|
35
35
|
);
|
|
36
36
|
const [progress, setProgress] = React.useState(0);
|
|
37
|
+
const [hasError, setHasError] = React.useState(false);
|
|
37
38
|
uploady.useBatchFinalizeListener((batch) => {
|
|
38
39
|
setBatchState(batch.state);
|
|
40
|
+
setHasError(batch.items.some((item) => item.state === uploady.FILE_STATES.ERROR));
|
|
39
41
|
});
|
|
40
42
|
uploady.useBatchProgressListener((batch) => {
|
|
41
43
|
setBatchState(batch.state);
|
|
@@ -63,7 +65,7 @@ function UploadDropzone(props) {
|
|
|
63
65
|
children: [
|
|
64
66
|
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "file", className: styles_module.default.input, ...getInputProps() }),
|
|
65
67
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles_module.default.uploadIconContainer, children: [
|
|
66
|
-
batchState === uploady.BATCH_STATES.FINISHED ? /* @__PURE__ */ jsxRuntime.jsx(CheckOutlineIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(CloudUploadOutlinedIcon, {}),
|
|
68
|
+
batchState === uploady.BATCH_STATES.FINISHED ? hasError ? /* @__PURE__ */ jsxRuntime.jsx(WarningOutlineIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(CheckOutlineIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(CloudUploadOutlinedIcon, {}),
|
|
67
69
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
68
70
|
"svg",
|
|
69
71
|
{
|
|
@@ -71,7 +73,8 @@ function UploadDropzone(props) {
|
|
|
71
73
|
className: styles_module.default.uploadProgress,
|
|
72
74
|
style: {
|
|
73
75
|
...{
|
|
74
|
-
"--progress": progress
|
|
76
|
+
"--progress": progress,
|
|
77
|
+
"--error": hasError
|
|
75
78
|
}
|
|
76
79
|
},
|
|
77
80
|
children: [
|
|
@@ -80,7 +83,7 @@ function UploadDropzone(props) {
|
|
|
80
83
|
"circle",
|
|
81
84
|
{
|
|
82
85
|
"data-success": batchState === uploady.BATCH_STATES.FINISHED,
|
|
83
|
-
"data-error":
|
|
86
|
+
"data-error": hasError,
|
|
84
87
|
className: styles_module.default.uploadProgressFg
|
|
85
88
|
}
|
|
86
89
|
)
|
|
@@ -18,7 +18,7 @@ import IconButton from '../IconButton/index.js';
|
|
|
18
18
|
import { adaptMuiSvgIcon } from '../Icon/wrappers.js';
|
|
19
19
|
import '../Icon/factory.js';
|
|
20
20
|
import styles from './styles.module.scss.js';
|
|
21
|
-
import { useUploadyContext, BATCH_STATES, useBatchAddListener, useBatchStartListener, useBatchFinalizeListener, useUploady, useBatchProgressListener, useAbortItem, useItemFinalizeListener, useItemProgressListener
|
|
21
|
+
import { useUploadyContext, BATCH_STATES, useBatchAddListener, useBatchStartListener, useBatchFinalizeListener, useUploady, FILE_STATES, useBatchProgressListener, useAbortItem, useItemFinalizeListener, useItemProgressListener } from '@rpldy/uploady';
|
|
22
22
|
import Button from '../Button/index.js';
|
|
23
23
|
|
|
24
24
|
const CloudUploadOutlinedIcon = adaptMuiSvgIcon(CloudUploadOutlined);
|
|
@@ -32,8 +32,10 @@ function UploadDropzone(props) {
|
|
|
32
32
|
BATCH_STATES.PENDING
|
|
33
33
|
);
|
|
34
34
|
const [progress, setProgress] = useState(0);
|
|
35
|
+
const [hasError, setHasError] = useState(false);
|
|
35
36
|
useBatchFinalizeListener((batch) => {
|
|
36
37
|
setBatchState(batch.state);
|
|
38
|
+
setHasError(batch.items.some((item) => item.state === FILE_STATES.ERROR));
|
|
37
39
|
});
|
|
38
40
|
useBatchProgressListener((batch) => {
|
|
39
41
|
setBatchState(batch.state);
|
|
@@ -61,7 +63,7 @@ function UploadDropzone(props) {
|
|
|
61
63
|
children: [
|
|
62
64
|
/* @__PURE__ */ jsx("input", { type: "file", className: styles.input, ...getInputProps() }),
|
|
63
65
|
/* @__PURE__ */ jsxs("span", { className: styles.uploadIconContainer, children: [
|
|
64
|
-
batchState === BATCH_STATES.FINISHED ? /* @__PURE__ */ jsx(CheckOutlineIcon, {}) : /* @__PURE__ */ jsx(CloudUploadOutlinedIcon, {}),
|
|
66
|
+
batchState === BATCH_STATES.FINISHED ? hasError ? /* @__PURE__ */ jsx(WarningOutlineIcon, {}) : /* @__PURE__ */ jsx(CheckOutlineIcon, {}) : /* @__PURE__ */ jsx(CloudUploadOutlinedIcon, {}),
|
|
65
67
|
/* @__PURE__ */ jsxs(
|
|
66
68
|
"svg",
|
|
67
69
|
{
|
|
@@ -69,7 +71,8 @@ function UploadDropzone(props) {
|
|
|
69
71
|
className: styles.uploadProgress,
|
|
70
72
|
style: {
|
|
71
73
|
...{
|
|
72
|
-
"--progress": progress
|
|
74
|
+
"--progress": progress,
|
|
75
|
+
"--error": hasError
|
|
73
76
|
}
|
|
74
77
|
},
|
|
75
78
|
children: [
|
|
@@ -78,7 +81,7 @@ function UploadDropzone(props) {
|
|
|
78
81
|
"circle",
|
|
79
82
|
{
|
|
80
83
|
"data-success": batchState === BATCH_STATES.FINISHED,
|
|
81
|
-
"data-error":
|
|
84
|
+
"data-error": hasError,
|
|
82
85
|
className: styles.uploadProgressFg
|
|
83
86
|
}
|
|
84
87
|
)
|