@availity/mui-file-selector 1.4.2 → 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 +14 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -11
- package/dist/index.mjs +3 -11
- package/package.json +3 -3
- package/src/lib/useUploadCore.tsx +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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
|
+
|
|
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)
|
|
13
|
+
|
|
14
|
+
### Dependency Updates
|
|
15
|
+
|
|
16
|
+
* `mui-form-utils` updated to version `1.4.2`
|
|
17
|
+
* `mui-dialog` updated to version `1.4.2`
|
|
18
|
+
* `mui-textfield` updated to version `1.4.2`
|
|
5
19
|
## [1.4.2](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.4.1...@availity/mui-file-selector@1.4.2) (2025-04-08)
|
|
6
20
|
|
|
7
21
|
### 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
|
@@ -455,13 +455,7 @@ var import_TextField = __toESM(require("@mui/material/TextField"));
|
|
|
455
455
|
var import_mui_form_utils2 = require("@availity/mui-form-utils");
|
|
456
456
|
var import_mui_layout2 = require("@availity/mui-layout");
|
|
457
457
|
var import_mui_typography2 = require("@availity/mui-typography");
|
|
458
|
-
var import_styles4 = require("@mui/material/styles");
|
|
459
458
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
460
|
-
var SelectPlaceholder = (0, import_styles4.styled)("span", {
|
|
461
|
-
name: "MuiTextField",
|
|
462
|
-
slot: "SelectPlaceholder",
|
|
463
|
-
overridesResolver: (props, styles) => styles.avFilled
|
|
464
|
-
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
465
459
|
var TextFieldFormHelperText = (_a) => {
|
|
466
460
|
var _b = _a, {
|
|
467
461
|
charCount,
|
|
@@ -531,10 +525,7 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
531
525
|
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
532
526
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
533
527
|
})),
|
|
534
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
535
|
-
displayEmpty: !!rest.placeholder,
|
|
536
|
-
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
537
|
-
}, SelectProps2), import_mui_form_utils2.SelectPropOverrides), (0, import_mui_form_utils2.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
528
|
+
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), import_mui_form_utils2.SelectPropOverrides), (0, import_mui_form_utils2.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
538
529
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
539
530
|
component: import_mui_form_utils2.FormLabel,
|
|
540
531
|
helpTopicId,
|
|
@@ -666,12 +657,13 @@ var import_react_query = require("@tanstack/react-query");
|
|
|
666
657
|
var import_upload_core = __toESM(require("@availity/upload-core"));
|
|
667
658
|
function startUpload(file, options) {
|
|
668
659
|
return __async(this, null, function* () {
|
|
669
|
-
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"]);
|
|
670
661
|
const upload = new import_upload_core.default(file, uploadOptions);
|
|
671
662
|
yield upload.generateId();
|
|
672
663
|
if (onSuccess) upload.onSuccess.push(onSuccess);
|
|
673
664
|
if (onError) upload.onError.push(onError);
|
|
674
665
|
if (onProgress) upload.onProgress.push(onProgress);
|
|
666
|
+
if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
|
|
675
667
|
upload.start();
|
|
676
668
|
return upload;
|
|
677
669
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -419,13 +419,7 @@ import {
|
|
|
419
419
|
} from "@availity/mui-form-utils";
|
|
420
420
|
import { Grid } from "@availity/mui-layout";
|
|
421
421
|
import { Typography as Typography2 } from "@availity/mui-typography";
|
|
422
|
-
import { styled as styled4 } from "@mui/material/styles";
|
|
423
422
|
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
424
|
-
var SelectPlaceholder = styled4("span", {
|
|
425
|
-
name: "MuiTextField",
|
|
426
|
-
slot: "SelectPlaceholder",
|
|
427
|
-
overridesResolver: (props, styles) => styles.avFilled
|
|
428
|
-
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
429
423
|
var TextFieldFormHelperText = (_a) => {
|
|
430
424
|
var _b = _a, {
|
|
431
425
|
charCount,
|
|
@@ -495,10 +489,7 @@ var TextField = forwardRef((props, ref) => {
|
|
|
495
489
|
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
496
490
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
497
491
|
})),
|
|
498
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
499
|
-
displayEmpty: !!rest.placeholder,
|
|
500
|
-
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ jsx9(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
501
|
-
}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
492
|
+
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
502
493
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
503
494
|
component: FormLabel,
|
|
504
495
|
helpTopicId,
|
|
@@ -641,12 +632,13 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
641
632
|
import Upload from "@availity/upload-core";
|
|
642
633
|
function startUpload(file, options) {
|
|
643
634
|
return __async(this, null, function* () {
|
|
644
|
-
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"]);
|
|
645
636
|
const upload = new Upload(file, uploadOptions);
|
|
646
637
|
yield upload.generateId();
|
|
647
638
|
if (onSuccess) upload.onSuccess.push(onSuccess);
|
|
648
639
|
if (onError) upload.onError.push(onError);
|
|
649
640
|
if (onProgress) upload.onProgress.push(onProgress);
|
|
641
|
+
if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
|
|
650
642
|
upload.start();
|
|
651
643
|
return upload;
|
|
652
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.0",
|
|
4
4
|
"description": "Availity MUI file-selector Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@availity/mui-alert": "^1.0.2",
|
|
45
45
|
"@availity/mui-button": "^1.1.0",
|
|
46
46
|
"@availity/mui-divider": "^1.0.1",
|
|
47
|
-
"@availity/mui-form-utils": "^1.1.
|
|
47
|
+
"@availity/mui-form-utils": "^1.1.2",
|
|
48
48
|
"@availity/mui-icon": "^1.0.1",
|
|
49
49
|
"@availity/mui-layout": "^1.0.1",
|
|
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.
|
|
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
|
|