@availity/mui-file-selector 1.4.3 → 1.5.0

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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [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)
6
+
7
+
8
+ ### Features
9
+
10
+ * **mui-file-selector:** pass onChunkComplete method in usUpdateNav ([f2b5ec1](https://github.com/Availity/element/commit/f2b5ec1a97205c6f2a83f9f7b7a3abbad16d0eb6))
11
+
5
12
  ## [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
13
 
7
14
  ### 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.4.3",
3
+ "version": "1.5.0",
4
4
  "description": "Availity MUI file-selector Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -50,7 +50,7 @@
50
50
  "@availity/mui-list": "^1.0.2",
51
51
  "@availity/mui-progress": "^1.0.1",
52
52
  "@availity/mui-typography": "^1.0.1",
53
- "@availity/upload-core": "^7.0.3",
53
+ "@availity/upload-core": "^7.1.1",
54
54
  "@tanstack/react-query": "^4.36.1",
55
55
  "react-dropzone": "^11.7.1",
56
56
  "react-hook-form": "^7.54.2",
@@ -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