@availity/mui-file-selector 0.2.7 → 0.2.9
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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/index.js +31 -23
- package/dist/index.mjs +31 -23
- package/package.json +8 -7
- package/src/lib/FileList.tsx +21 -19
- package/src/lib/UploadProgressBar.tsx +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.2.9](https://github.com/Availity/element/compare/@availity/mui-file-selector@0.2.8...@availity/mui-file-selector@0.2.9) (2025-01-22)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-alert` updated to version `0.2.8`
|
|
10
|
+
* `mui-button` updated to version `0.2.8`
|
|
11
|
+
* `mui-form-utils` updated to version `0.2.8`
|
|
12
|
+
* `mui-icon` updated to version `0.2.8`
|
|
13
|
+
* `mui-list` updated to version `0.2.8`
|
|
14
|
+
* `mui-progress` updated to version `0.2.8`
|
|
15
|
+
## [0.2.8](https://github.com/Availity/element/compare/@availity/mui-file-selector@0.2.7...@availity/mui-file-selector@0.2.8) (2025-01-10)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* remove debug story ([091c909](https://github.com/Availity/element/commit/091c909acfb22464723dec19d6c258d30cd2ba8d))
|
|
21
|
+
* update FileList ([036e91c](https://github.com/Availity/element/commit/036e91cd37f89ef67d77d4782dced6ebf841dd5c))
|
|
22
|
+
|
|
5
23
|
## [0.2.7](https://github.com/Availity/element/compare/@availity/mui-file-selector@0.2.6...@availity/mui-file-selector@0.2.7) (2025-01-08)
|
|
6
24
|
|
|
7
25
|
### Dependency Updates
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ This package extends the MUI File Selector component: [MUI File Selector Docs](h
|
|
|
12
12
|
|
|
13
13
|
Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-file-selector-introduction--docs)
|
|
14
14
|
|
|
15
|
-
Availity standards for design and usage can be found in the [Availity Design Guide](https://
|
|
15
|
+
Availity standards for design and usage can be found in the [Availity Design Guide](https://design.availity.com/2e36e50c7)
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
package/dist/index.js
CHANGED
|
@@ -88,9 +88,9 @@ module.exports = __toCommonJS(src_exports);
|
|
|
88
88
|
var import_react3 = require("react");
|
|
89
89
|
var import_react_hook_form3 = require("react-hook-form");
|
|
90
90
|
var import_react_query2 = require("@tanstack/react-query");
|
|
91
|
-
var
|
|
91
|
+
var import_mui_button3 = require("@availity/mui-button");
|
|
92
92
|
var import_mui_layout3 = require("@availity/mui-layout");
|
|
93
|
-
var
|
|
93
|
+
var import_mui_typography3 = require("@availity/mui-typography");
|
|
94
94
|
|
|
95
95
|
// src/lib/Dropzone.tsx
|
|
96
96
|
var import_react = require("react");
|
|
@@ -297,7 +297,8 @@ var ErrorAlert = ({ errors, fileName, id, onClose }) => {
|
|
|
297
297
|
};
|
|
298
298
|
|
|
299
299
|
// src/lib/FileList.tsx
|
|
300
|
-
var
|
|
300
|
+
var import_mui_list2 = require("@availity/mui-list");
|
|
301
|
+
var import_mui_button2 = require("@availity/mui-button");
|
|
301
302
|
var import_mui_icon4 = require("@availity/mui-icon");
|
|
302
303
|
var import_mui_layout2 = require("@availity/mui-layout");
|
|
303
304
|
var import_mui_divider2 = require("@availity/mui-divider");
|
|
@@ -305,8 +306,8 @@ var import_mui_divider2 = require("@availity/mui-divider");
|
|
|
305
306
|
// src/lib/UploadProgressBar.tsx
|
|
306
307
|
var import_react2 = require("react");
|
|
307
308
|
var import_mui_progress = require("@availity/mui-progress");
|
|
308
|
-
var import_mui_typography2 = require("@availity/mui-typography");
|
|
309
309
|
var import_mui_icon2 = require("@availity/mui-icon");
|
|
310
|
+
var import_mui_list = require("@availity/mui-list");
|
|
310
311
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
311
312
|
var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
|
|
312
313
|
const [statePercentage, setStatePercentage] = (0, import_react2.useState)(upload.percentage || 0);
|
|
@@ -331,7 +332,7 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
|
|
|
331
332
|
upload.onProgress.push(handleOnProgress);
|
|
332
333
|
upload.onSuccess.push(handleOnSuccess);
|
|
333
334
|
upload.onError.push(handleOnError);
|
|
334
|
-
return upload.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
335
|
+
return upload.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_list.ListItemText, { primaryTypographyProps: { color: "text.error", variant: "body2" }, children: [
|
|
335
336
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_icon2.WarningTriangleIcon, {}),
|
|
336
337
|
" ",
|
|
337
338
|
upload.errorMessage
|
|
@@ -403,40 +404,47 @@ var FileRow = ({ file, options, onRemoveFile }) => {
|
|
|
403
404
|
const { data: upload } = useUploadCore(file, options);
|
|
404
405
|
if (!upload)
|
|
405
406
|
return null;
|
|
406
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UploadProgressBar, { upload }) }),
|
|
412
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
413
|
-
import_mui_list.ListItemButton,
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
408
|
+
import_mui_list2.ListItem,
|
|
409
|
+
{
|
|
410
|
+
secondaryAction: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
411
|
+
import_mui_button2.IconButton,
|
|
414
412
|
{
|
|
413
|
+
title: "remove file",
|
|
414
|
+
edge: "end",
|
|
415
415
|
onClick: () => {
|
|
416
416
|
onRemoveFile(upload.id, upload);
|
|
417
417
|
},
|
|
418
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_icon4.DeleteIcon, {})
|
|
419
419
|
}
|
|
420
|
-
)
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
420
|
+
),
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_mui_layout2.Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", children: [
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_list2.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, {}) }) }),
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 3, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_list2.ListItemText, { children: upload.trimFileName(upload.file.name) }) }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 2, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_list2.ListItemText, { children: formatBytes(upload.file.size) }) }),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_layout2.Grid, { xs: 6, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UploadProgressBar, { upload }) })
|
|
427
|
+
] }),
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_divider2.Divider, {})
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
);
|
|
424
432
|
};
|
|
425
433
|
var FileList = ({ files, options, onRemoveFile }) => {
|
|
426
434
|
if (files.length === 0)
|
|
427
435
|
return null;
|
|
428
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_list2.List, { children: files.map((file) => {
|
|
429
437
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FileRow, { file, options, onRemoveFile }, file.name);
|
|
430
438
|
}) });
|
|
431
439
|
};
|
|
432
440
|
|
|
433
441
|
// src/lib/FileTypesMessage.tsx
|
|
434
|
-
var
|
|
442
|
+
var import_mui_typography2 = require("@availity/mui-typography");
|
|
435
443
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
436
444
|
var FileTypesMessage = ({ allowedFileTypes, maxFileSize }) => {
|
|
437
445
|
const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
|
|
438
446
|
const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}.` : "All file types allowed.";
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_mui_typography2.Typography, { variant: "caption", children: [
|
|
440
448
|
fileSizeMsg,
|
|
441
449
|
fileTypesMsg
|
|
442
450
|
] });
|
|
@@ -524,7 +532,7 @@ var FileSelector = ({
|
|
|
524
532
|
};
|
|
525
533
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_hook_form3.FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { onSubmit: methods.handleSubmit(handleOnSubmit), children: [
|
|
526
534
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
527
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_mui_typography3.Typography, { marginBottom: "4px", children: label }),
|
|
528
536
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
529
537
|
Dropzone,
|
|
530
538
|
{
|
|
@@ -553,7 +561,7 @@ var FileSelector = ({
|
|
|
553
561
|
rejection.id
|
|
554
562
|
)) : null,
|
|
555
563
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FileList, { files, options, onRemoveFile: handleOnRemoveFile }),
|
|
556
|
-
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_mui_layout3.Grid, { xs: 12, justifyContent: "end", display: "flex", paddingTop: 2.5, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
564
|
+
files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_mui_layout3.Grid, { xs: 12, justifyContent: "end", display: "flex", paddingTop: 2.5, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_mui_button3.Button, { type: "submit", sx: { marginLeft: "auto", marginRight: 0 }, children: "Submit" }) })
|
|
557
565
|
] }) }));
|
|
558
566
|
};
|
|
559
567
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -56,7 +56,7 @@ import { useForm, FormProvider } from "react-hook-form";
|
|
|
56
56
|
import { useQueryClient } from "@tanstack/react-query";
|
|
57
57
|
import { Button as Button2 } from "@availity/mui-button";
|
|
58
58
|
import { Grid as Grid2 } from "@availity/mui-layout";
|
|
59
|
-
import { Typography as
|
|
59
|
+
import { Typography as Typography3 } from "@availity/mui-typography";
|
|
60
60
|
|
|
61
61
|
// src/lib/Dropzone.tsx
|
|
62
62
|
import { useCallback } from "react";
|
|
@@ -263,7 +263,8 @@ var ErrorAlert = ({ errors, fileName, id, onClose }) => {
|
|
|
263
263
|
};
|
|
264
264
|
|
|
265
265
|
// src/lib/FileList.tsx
|
|
266
|
-
import { List, ListItem, ListItemText, ListItemIcon
|
|
266
|
+
import { List, ListItem, ListItemText as ListItemText2, ListItemIcon } from "@availity/mui-list";
|
|
267
|
+
import { IconButton } from "@availity/mui-button";
|
|
267
268
|
import { DeleteIcon } from "@availity/mui-icon";
|
|
268
269
|
import { Grid } from "@availity/mui-layout";
|
|
269
270
|
import { Divider as Divider2 } from "@availity/mui-divider";
|
|
@@ -271,8 +272,8 @@ import { Divider as Divider2 } from "@availity/mui-divider";
|
|
|
271
272
|
// src/lib/UploadProgressBar.tsx
|
|
272
273
|
import { useState } from "react";
|
|
273
274
|
import { LinearProgress } from "@availity/mui-progress";
|
|
274
|
-
import { Typography as Typography2 } from "@availity/mui-typography";
|
|
275
275
|
import { WarningTriangleIcon } from "@availity/mui-icon";
|
|
276
|
+
import { ListItemText } from "@availity/mui-list";
|
|
276
277
|
import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
277
278
|
var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
|
|
278
279
|
const [statePercentage, setStatePercentage] = useState(upload.percentage || 0);
|
|
@@ -297,7 +298,7 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
|
|
|
297
298
|
upload.onProgress.push(handleOnProgress);
|
|
298
299
|
upload.onSuccess.push(handleOnSuccess);
|
|
299
300
|
upload.onError.push(handleOnError);
|
|
300
|
-
return upload.errorMessage ? /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4(
|
|
301
|
+
return upload.errorMessage ? /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4(ListItemText, { primaryTypographyProps: { color: "text.error", variant: "body2" }, children: [
|
|
301
302
|
/* @__PURE__ */ jsx4(WarningTriangleIcon, {}),
|
|
302
303
|
" ",
|
|
303
304
|
upload.errorMessage
|
|
@@ -374,30 +375,37 @@ function useUploadCore(file, options) {
|
|
|
374
375
|
}
|
|
375
376
|
|
|
376
377
|
// src/lib/FileList.tsx
|
|
377
|
-
import {
|
|
378
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
378
379
|
var FileRow = ({ file, options, onRemoveFile }) => {
|
|
379
380
|
const Icon = getFileExtIcon(file.name);
|
|
380
381
|
const { data: upload } = useUploadCore(file, options);
|
|
381
382
|
if (!upload)
|
|
382
383
|
return null;
|
|
383
|
-
return /* @__PURE__ */ jsxs5(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
/* @__PURE__ */ jsx5(Grid, { xs: 4, children: /* @__PURE__ */ jsx5(UploadProgressBar, { upload }) }),
|
|
389
|
-
/* @__PURE__ */ jsx5(Grid, { xs: 1, children: /* @__PURE__ */ jsx5(
|
|
390
|
-
ListItemButton,
|
|
384
|
+
return /* @__PURE__ */ jsxs5(
|
|
385
|
+
ListItem,
|
|
386
|
+
{
|
|
387
|
+
secondaryAction: /* @__PURE__ */ jsx5(
|
|
388
|
+
IconButton,
|
|
391
389
|
{
|
|
390
|
+
title: "remove file",
|
|
391
|
+
edge: "end",
|
|
392
392
|
onClick: () => {
|
|
393
393
|
onRemoveFile(upload.id, upload);
|
|
394
394
|
},
|
|
395
|
-
children: /* @__PURE__ */ jsx5(
|
|
395
|
+
children: /* @__PURE__ */ jsx5(DeleteIcon, {})
|
|
396
396
|
}
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
),
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ jsxs5(Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", children: [
|
|
400
|
+
/* @__PURE__ */ jsx5(Grid, { xs: 1, children: /* @__PURE__ */ jsx5(ListItemIcon, { children: /* @__PURE__ */ jsx5(Icon, {}) }) }),
|
|
401
|
+
/* @__PURE__ */ jsx5(Grid, { xs: 3, children: /* @__PURE__ */ jsx5(ListItemText2, { children: upload.trimFileName(upload.file.name) }) }),
|
|
402
|
+
/* @__PURE__ */ jsx5(Grid, { xs: 2, children: /* @__PURE__ */ jsx5(ListItemText2, { children: formatBytes(upload.file.size) }) }),
|
|
403
|
+
/* @__PURE__ */ jsx5(Grid, { xs: 6, children: /* @__PURE__ */ jsx5(UploadProgressBar, { upload }) })
|
|
404
|
+
] }),
|
|
405
|
+
/* @__PURE__ */ jsx5(Divider2, {})
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
);
|
|
401
409
|
};
|
|
402
410
|
var FileList = ({ files, options, onRemoveFile }) => {
|
|
403
411
|
if (files.length === 0)
|
|
@@ -408,19 +416,19 @@ var FileList = ({ files, options, onRemoveFile }) => {
|
|
|
408
416
|
};
|
|
409
417
|
|
|
410
418
|
// src/lib/FileTypesMessage.tsx
|
|
411
|
-
import { Typography as
|
|
419
|
+
import { Typography as Typography2 } from "@availity/mui-typography";
|
|
412
420
|
import { jsxs as jsxs6 } from "react/jsx-runtime";
|
|
413
421
|
var FileTypesMessage = ({ allowedFileTypes, maxFileSize }) => {
|
|
414
422
|
const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
|
|
415
423
|
const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}.` : "All file types allowed.";
|
|
416
|
-
return /* @__PURE__ */ jsxs6(
|
|
424
|
+
return /* @__PURE__ */ jsxs6(Typography2, { variant: "caption", children: [
|
|
417
425
|
fileSizeMsg,
|
|
418
426
|
fileTypesMsg
|
|
419
427
|
] });
|
|
420
428
|
};
|
|
421
429
|
|
|
422
430
|
// src/lib/FileSelector.tsx
|
|
423
|
-
import { Fragment as
|
|
431
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
424
432
|
var CLOUD_URL = "/cloud/web/appl/vault/upload/v1/resumable";
|
|
425
433
|
var FileSelector = ({
|
|
426
434
|
name,
|
|
@@ -500,8 +508,8 @@ var FileSelector = ({
|
|
|
500
508
|
setFileRejections(rejections);
|
|
501
509
|
};
|
|
502
510
|
return /* @__PURE__ */ jsx6(FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ jsxs7("form", { onSubmit: methods.handleSubmit(handleOnSubmit), children: [
|
|
503
|
-
/* @__PURE__ */ jsxs7(
|
|
504
|
-
/* @__PURE__ */ jsx6(
|
|
511
|
+
/* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
512
|
+
/* @__PURE__ */ jsx6(Typography3, { marginBottom: "4px", children: label }),
|
|
505
513
|
/* @__PURE__ */ jsx6(
|
|
506
514
|
Dropzone,
|
|
507
515
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-file-selector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Availity MUI file-selector Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@availity/api-axios": "^9.0.4",
|
|
36
|
-
"@availity/mui-alert": "^0.7.
|
|
37
|
-
"@availity/mui-button": "^0.6.
|
|
36
|
+
"@availity/mui-alert": "^0.7.3",
|
|
37
|
+
"@availity/mui-button": "^0.6.15",
|
|
38
38
|
"@availity/mui-divider": "^0.4.0",
|
|
39
|
-
"@availity/mui-form-utils": "^0.16.
|
|
40
|
-
"@availity/mui-icon": "^0.
|
|
39
|
+
"@availity/mui-form-utils": "^0.16.4",
|
|
40
|
+
"@availity/mui-icon": "^0.13.0",
|
|
41
41
|
"@availity/mui-layout": "^0.2.0",
|
|
42
|
-
"@availity/mui-list": "^0.2.
|
|
43
|
-
"@availity/mui-progress": "^0.4.
|
|
42
|
+
"@availity/mui-list": "^0.2.6",
|
|
43
|
+
"@availity/mui-progress": "^0.4.4",
|
|
44
44
|
"@availity/mui-typography": "^0.2.1",
|
|
45
45
|
"@availity/upload-core": "7.0.0-alpha.6",
|
|
46
46
|
"@tanstack/react-query": "^4.36.1",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"uuid": "^9.0.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@availity/mui-paper": "^0.1.9",
|
|
53
54
|
"@mui/material": "^5.15.15",
|
|
54
55
|
"react": "18.2.0",
|
|
55
56
|
"react-dom": "18.2.0",
|
package/src/lib/FileList.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { default as Upload, UploadOptions } from '@availity/upload-core';
|
|
2
|
-
import { List, ListItem, ListItemText, ListItemIcon
|
|
2
|
+
import { List, ListItem, ListItemText, ListItemIcon } from '@availity/mui-list';
|
|
3
|
+
import { IconButton } from '@availity/mui-button';
|
|
3
4
|
import { DeleteIcon } from '@availity/mui-icon';
|
|
4
5
|
import { Grid } from '@availity/mui-layout';
|
|
5
6
|
import { Divider } from '@availity/mui-divider';
|
|
@@ -29,36 +30,37 @@ const FileRow = ({ file, options, onRemoveFile }: FileRowProps) => {
|
|
|
29
30
|
if (!upload) return null;
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
<ListItem
|
|
34
|
+
secondaryAction={
|
|
35
|
+
<IconButton
|
|
36
|
+
title="remove file"
|
|
37
|
+
edge="end"
|
|
38
|
+
onClick={() => {
|
|
39
|
+
onRemoveFile(upload.id, upload);
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<DeleteIcon />
|
|
43
|
+
</IconButton>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<Grid container spacing={2} alignItems="center" justifyContent="space-between" width="100%">
|
|
34
47
|
<Grid xs={1}>
|
|
35
48
|
<ListItemIcon>
|
|
36
49
|
<Icon />
|
|
37
50
|
</ListItemIcon>
|
|
38
51
|
</Grid>
|
|
39
|
-
<Grid xs={
|
|
52
|
+
<Grid xs={3}>
|
|
40
53
|
<ListItemText>{upload.trimFileName(upload.file.name)}</ListItemText>
|
|
41
54
|
</Grid>
|
|
42
55
|
<Grid xs={2}>
|
|
43
|
-
<
|
|
56
|
+
<ListItemText>{formatBytes(upload.file.size)}</ListItemText>
|
|
44
57
|
</Grid>
|
|
45
|
-
<Grid xs={
|
|
58
|
+
<Grid xs={6}>
|
|
46
59
|
<UploadProgressBar upload={upload} />
|
|
47
60
|
</Grid>
|
|
48
|
-
<Grid xs={1}>
|
|
49
|
-
<ListItemButton
|
|
50
|
-
onClick={() => {
|
|
51
|
-
onRemoveFile(upload.id, upload);
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
<ListItemIcon>
|
|
55
|
-
<DeleteIcon />
|
|
56
|
-
</ListItemIcon>
|
|
57
|
-
</ListItemButton>
|
|
58
|
-
</Grid>
|
|
59
61
|
</Grid>
|
|
60
|
-
<Divider
|
|
61
|
-
|
|
62
|
+
<Divider />
|
|
63
|
+
</ListItem>
|
|
62
64
|
);
|
|
63
65
|
};
|
|
64
66
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
// import { ChangeEvent, FormEventHandler, useState } from 'react';
|
|
3
2
|
import { LinearProgress } from '@availity/mui-progress';
|
|
4
3
|
import type Upload from '@availity/upload-core';
|
|
5
|
-
import { Typography } from '@availity/mui-typography';
|
|
6
4
|
import { WarningTriangleIcon } from '@availity/mui-icon';
|
|
5
|
+
import { ListItemText } from '@availity/mui-list';
|
|
7
6
|
|
|
8
7
|
export type UploadProgressBarProps = {
|
|
9
8
|
/**
|
|
@@ -72,9 +71,9 @@ export const UploadProgressBar = ({ upload, onProgress, onError, onSuccess }: Up
|
|
|
72
71
|
|
|
73
72
|
return upload.errorMessage ? (
|
|
74
73
|
<>
|
|
75
|
-
<
|
|
74
|
+
<ListItemText primaryTypographyProps={{ color: 'text.error', variant: 'body2' }}>
|
|
76
75
|
<WarningTriangleIcon /> {upload.errorMessage}
|
|
77
|
-
</
|
|
76
|
+
</ListItemText>
|
|
78
77
|
{/* {upload.status === 'encrypted' && (
|
|
79
78
|
<div className="pwRequired">
|
|
80
79
|
<Button color="primary" onClick={toggleModal}>
|