@availity/mui-file-selector 1.4.3 → 1.5.1
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 +23 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +15 -15
- package/src/lib/useUploadCore.tsx +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.5.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.5.0...@availity/mui-file-selector@1.5.1) (2025-04-11)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-paper` updated to version `1.5.0`
|
|
10
|
+
* `mui-alert` updated to version `1.5.0`
|
|
11
|
+
* `mui-button` updated to version `1.5.0`
|
|
12
|
+
* `mui-divider` updated to version `1.5.0`
|
|
13
|
+
* `mui-form-utils` updated to version `1.5.0`
|
|
14
|
+
* `mui-icon` updated to version `1.5.0`
|
|
15
|
+
* `mui-layout` updated to version `1.5.0`
|
|
16
|
+
* `mui-list` updated to version `1.5.0`
|
|
17
|
+
* `mui-progress` updated to version `1.5.0`
|
|
18
|
+
* `mui-typography` updated to version `1.5.0`
|
|
19
|
+
* `mui-dialog` updated to version `1.5.0`
|
|
20
|
+
* `mui-textfield` updated to version `1.5.0`
|
|
21
|
+
## [1.5.0](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.4.3...@availity/mui-file-selector@1.5.0) (2025-04-10)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **mui-file-selector:** pass onChunkComplete method in usUpdateNav ([f2b5ec1](https://github.com/Availity/element/commit/f2b5ec1a97205c6f2a83f9f7b7a3abbad16d0eb6))
|
|
27
|
+
|
|
5
28
|
## [1.4.3](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.4.2...@availity/mui-file-selector@1.4.3) (2025-04-09)
|
|
6
29
|
|
|
7
30
|
### Dependency Updates
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { DropEvent, FileRejection, FileError, DropzoneInputProps } from 'react-d
|
|
|
4
4
|
import Upload, { UploadOptions } from '@availity/upload-core';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
7
|
+
import { OnSuccessPayload } from 'tus-js-client';
|
|
7
8
|
import { ButtonProps } from '@availity/mui-button';
|
|
8
9
|
import { FileRejection as FileRejection$1, DropEvent as DropEvent$1, FileError as FileError$1 } from 'react-dropzone/typings/react-dropzone';
|
|
9
10
|
|
|
@@ -86,8 +87,9 @@ declare const ErrorAlert: ({ errors, fileName, id, onClose }: ErrorAlertProps) =
|
|
|
86
87
|
|
|
87
88
|
type Options = {
|
|
88
89
|
onError?: (error: Error) => void;
|
|
89
|
-
onSuccess?: () => void;
|
|
90
|
+
onSuccess?: (response: OnSuccessPayload) => void;
|
|
90
91
|
onProgress?: () => void;
|
|
92
|
+
onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
|
|
91
93
|
} & UploadOptions;
|
|
92
94
|
type UploadQueryOptions = UseQueryOptions<Upload, Error, Upload, [string, string, Options]>;
|
|
93
95
|
declare function useUploadCore(file: File, options: Options, queryOptions?: UploadQueryOptions): _tanstack_react_query.UseQueryResult<Upload, Error>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DropEvent, FileRejection, FileError, DropzoneInputProps } from 'react-d
|
|
|
4
4
|
import Upload, { UploadOptions } from '@availity/upload-core';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
7
|
+
import { OnSuccessPayload } from 'tus-js-client';
|
|
7
8
|
import { ButtonProps } from '@availity/mui-button';
|
|
8
9
|
import { FileRejection as FileRejection$1, DropEvent as DropEvent$1, FileError as FileError$1 } from 'react-dropzone/typings/react-dropzone';
|
|
9
10
|
|
|
@@ -86,8 +87,9 @@ declare const ErrorAlert: ({ errors, fileName, id, onClose }: ErrorAlertProps) =
|
|
|
86
87
|
|
|
87
88
|
type Options = {
|
|
88
89
|
onError?: (error: Error) => void;
|
|
89
|
-
onSuccess?: () => void;
|
|
90
|
+
onSuccess?: (response: OnSuccessPayload) => void;
|
|
90
91
|
onProgress?: () => void;
|
|
92
|
+
onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
|
|
91
93
|
} & UploadOptions;
|
|
92
94
|
type UploadQueryOptions = UseQueryOptions<Upload, Error, Upload, [string, string, Options]>;
|
|
93
95
|
declare function useUploadCore(file: File, options: Options, queryOptions?: UploadQueryOptions): _tanstack_react_query.UseQueryResult<Upload, Error>;
|
package/dist/index.js
CHANGED
|
@@ -657,12 +657,13 @@ var import_react_query = require("@tanstack/react-query");
|
|
|
657
657
|
var import_upload_core = __toESM(require("@availity/upload-core"));
|
|
658
658
|
function startUpload(file, options) {
|
|
659
659
|
return __async(this, null, function* () {
|
|
660
|
-
const _a = options, { onSuccess, onError, onProgress } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress"]);
|
|
660
|
+
const _a = options, { onSuccess, onError, onProgress, onChunkComplete } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress", "onChunkComplete"]);
|
|
661
661
|
const upload = new import_upload_core.default(file, uploadOptions);
|
|
662
662
|
yield upload.generateId();
|
|
663
663
|
if (onSuccess) upload.onSuccess.push(onSuccess);
|
|
664
664
|
if (onError) upload.onError.push(onError);
|
|
665
665
|
if (onProgress) upload.onProgress.push(onProgress);
|
|
666
|
+
if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
|
|
666
667
|
upload.start();
|
|
667
668
|
return upload;
|
|
668
669
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -632,12 +632,13 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
632
632
|
import Upload from "@availity/upload-core";
|
|
633
633
|
function startUpload(file, options) {
|
|
634
634
|
return __async(this, null, function* () {
|
|
635
|
-
const _a = options, { onSuccess, onError, onProgress } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress"]);
|
|
635
|
+
const _a = options, { onSuccess, onError, onProgress, onChunkComplete } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress", "onChunkComplete"]);
|
|
636
636
|
const upload = new Upload(file, uploadOptions);
|
|
637
637
|
yield upload.generateId();
|
|
638
638
|
if (onSuccess) upload.onSuccess.push(onSuccess);
|
|
639
639
|
if (onError) upload.onError.push(onError);
|
|
640
640
|
if (onProgress) upload.onProgress.push(onProgress);
|
|
641
|
+
if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
|
|
641
642
|
upload.start();
|
|
642
643
|
return upload;
|
|
643
644
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-file-selector",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Availity MUI file-selector Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,29 +40,29 @@
|
|
|
40
40
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@availity/api-axios": "^10.0.
|
|
44
|
-
"@availity/mui-alert": "^1.0.
|
|
45
|
-
"@availity/mui-button": "^1.1.
|
|
46
|
-
"@availity/mui-divider": "^1.0.
|
|
47
|
-
"@availity/mui-form-utils": "^1.1.
|
|
48
|
-
"@availity/mui-icon": "^1.0.
|
|
49
|
-
"@availity/mui-layout": "^1.0.
|
|
50
|
-
"@availity/mui-list": "^1.0.
|
|
51
|
-
"@availity/mui-progress": "^1.0.
|
|
52
|
-
"@availity/mui-typography": "^1.0.
|
|
53
|
-
"@availity/upload-core": "^7.
|
|
43
|
+
"@availity/api-axios": "^10.0.3",
|
|
44
|
+
"@availity/mui-alert": "^1.0.3",
|
|
45
|
+
"@availity/mui-button": "^1.1.1",
|
|
46
|
+
"@availity/mui-divider": "^1.0.2",
|
|
47
|
+
"@availity/mui-form-utils": "^1.1.3",
|
|
48
|
+
"@availity/mui-icon": "^1.0.2",
|
|
49
|
+
"@availity/mui-layout": "^1.0.2",
|
|
50
|
+
"@availity/mui-list": "^1.0.3",
|
|
51
|
+
"@availity/mui-progress": "^1.0.2",
|
|
52
|
+
"@availity/mui-typography": "^1.0.2",
|
|
53
|
+
"@availity/upload-core": "^7.1.1",
|
|
54
54
|
"@tanstack/react-query": "^4.36.1",
|
|
55
55
|
"react-dropzone": "^11.7.1",
|
|
56
|
-
"react-hook-form": "^7.
|
|
56
|
+
"react-hook-form": "^7.55.0",
|
|
57
57
|
"tus-js-client": "4.2.3",
|
|
58
58
|
"uuid": "^9.0.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@availity/mui-paper": "^1.0.
|
|
61
|
+
"@availity/mui-paper": "^1.0.2",
|
|
62
62
|
"@mui/material": "^6.4.5",
|
|
63
63
|
"react": "18.2.0",
|
|
64
64
|
"react-dom": "18.2.0",
|
|
65
|
-
"tsup": "^8.
|
|
65
|
+
"tsup": "^8.4.0",
|
|
66
66
|
"typescript": "^5.4.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
@@ -2,17 +2,19 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
2
2
|
import type { UseQueryOptions } from '@tanstack/react-query';
|
|
3
3
|
import Upload from '@availity/upload-core';
|
|
4
4
|
import type { UploadOptions } from '@availity/upload-core';
|
|
5
|
+
import type { OnSuccessPayload } from 'tus-js-client';
|
|
5
6
|
|
|
6
7
|
export type Options = {
|
|
7
8
|
onError?: (error: Error) => void;
|
|
8
|
-
onSuccess?: () => void;
|
|
9
|
+
onSuccess?: (response: OnSuccessPayload) => void;
|
|
9
10
|
onProgress?: () => void;
|
|
11
|
+
onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
|
|
10
12
|
} & UploadOptions;
|
|
11
13
|
|
|
12
14
|
export type UploadQueryOptions = UseQueryOptions<Upload, Error, Upload, [string, string, Options]>;
|
|
13
15
|
|
|
14
16
|
async function startUpload(file: File, options: Options) {
|
|
15
|
-
const { onSuccess, onError, onProgress, ...uploadOptions } = options;
|
|
17
|
+
const { onSuccess, onError, onProgress, onChunkComplete, ...uploadOptions } = options;
|
|
16
18
|
const upload = new Upload(file, uploadOptions);
|
|
17
19
|
|
|
18
20
|
await upload.generateId();
|
|
@@ -20,6 +22,7 @@ async function startUpload(file: File, options: Options) {
|
|
|
20
22
|
if (onSuccess) upload.onSuccess.push(onSuccess);
|
|
21
23
|
if (onError) upload.onError.push(onError);
|
|
22
24
|
if (onProgress) upload.onProgress.push(onProgress);
|
|
25
|
+
if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
|
|
23
26
|
|
|
24
27
|
upload.start();
|
|
25
28
|
|