@availity/mui-file-selector 2.0.5 → 3.0.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/dist/index.js CHANGED
@@ -1,152 +1,40 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, { get: all[name], enumerable: true });
40
- };
41
- var __copyProps = (to, from, except, desc) => {
42
- if (from && typeof from === "object" || typeof from === "function") {
43
- for (let key of __getOwnPropNames(from))
44
- if (!__hasOwnProp.call(to, key) && key !== except)
45
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
- }
47
- return to;
48
- };
49
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
- // If the importer is in node compatibility mode or this is not an ESM
51
- // file that has been converted to a CommonJS file using a Babel-
52
- // compatible transform (i.e. "__esModule" has not been set), then set
53
- // "default" to the CommonJS "module.exports" for node compatibility.
54
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
- mod
56
- ));
57
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
- var __async = (__this, __arguments, generator) => {
59
- return new Promise((resolve, reject) => {
60
- var fulfilled = (value) => {
61
- try {
62
- step(generator.next(value));
63
- } catch (e) {
64
- reject(e);
65
- }
66
- };
67
- var rejected = (value) => {
68
- try {
69
- step(generator.throw(value));
70
- } catch (e) {
71
- reject(e);
72
- }
73
- };
74
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
- step((generator = generator.apply(__this, __arguments)).next());
76
- });
77
- };
78
-
79
- // src/index.ts
80
- var index_exports = {};
81
- __export(index_exports, {
82
- CLOUD_URL: () => CLOUD_URL,
83
- Dropzone: () => Dropzone,
84
- Dropzone2: () => Dropzone2,
85
- DropzoneContainer: () => DropzoneContainer,
86
- ErrorAlert: () => ErrorAlert,
87
- FileList: () => FileList,
88
- FileList2: () => FileList2,
89
- FilePickerBtn: () => FilePickerBtn,
90
- FileRow: () => FileRow,
91
- FileRow2: () => FileRow2,
92
- FileSelector: () => FileSelector,
93
- FileSelector2: () => FileSelector2,
94
- FileTypesMessage: () => FileTypesMessage,
95
- HeaderMessage: () => HeaderMessage,
96
- UploadProgressBar: () => UploadProgressBar,
97
- createCounter: () => createCounter,
98
- formatFileTooLarge: () => formatFileTooLarge,
99
- innerBoxStyles: () => innerBoxStyles,
100
- outerBoxStyles: () => outerBoxStyles,
101
- useUploadCore: () => useUploadCore
102
- });
103
- module.exports = __toCommonJS(index_exports);
104
-
105
1
  // src/lib/Dropzone.tsx
106
- var import_react = require("react");
107
- var import_styles = require("@mui/material/styles");
108
- var import_react_dropzone = require("react-dropzone");
109
- var import_react_hook_form2 = require("react-hook-form");
110
- var import_mui_divider = require("@availity/mui-divider");
111
- var import_mui_icon2 = require("@availity/mui-icon");
112
- var import_mui_layout = require("@availity/mui-layout");
113
- var import_mui_typography = require("@availity/mui-typography");
2
+ import { useCallback } from "react";
3
+ import { styled } from "@mui/material/styles";
4
+ import { useDropzone } from "react-dropzone";
5
+ import { useFormContext } from "react-hook-form";
6
+ import { Divider } from "@availity/mui-divider";
7
+ import { CloudUploadIcon, PlusIcon } from "@availity/mui-icon";
8
+ import { Box, Stack } from "@availity/mui-layout";
9
+ import { Typography } from "@availity/mui-typography";
114
10
 
115
11
  // src/lib/FilePickerBtn.tsx
116
- var import_react_hook_form = require("react-hook-form");
117
- var import_mui_button = require("@availity/mui-button");
118
- var import_mui_form_utils = require("@availity/mui-form-utils");
119
- var import_jsx_runtime = require("react/jsx-runtime");
120
- var FilePickerBtn = (_a) => {
121
- var _b = _a, {
122
- name,
123
- children,
124
- color,
125
- inputId,
126
- inputProps = {},
127
- maxSize,
128
- onChange,
129
- onClick
130
- } = _b, rest = __objRest(_b, [
131
- "name",
132
- "children",
133
- "color",
134
- "inputId",
135
- "inputProps",
136
- "maxSize",
137
- "onChange",
138
- "onClick"
139
- ]);
12
+ import { Controller } from "react-hook-form";
13
+ import { Button } from "@availity/mui-button";
14
+ import { Input } from "@availity/mui-form-utils";
15
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ var FilePickerBtn = ({
17
+ name,
18
+ children,
19
+ color,
20
+ inputId,
21
+ inputProps = {},
22
+ maxSize,
23
+ onChange,
24
+ onClick,
25
+ ...rest
26
+ }) => {
140
27
  const { accept, multiple, ref, style, type: inputType } = inputProps;
141
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
142
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
- import_react_hook_form.Controller,
28
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
29
+ /* @__PURE__ */ jsx(
30
+ Controller,
144
31
  {
145
32
  name,
146
33
  defaultValue: [],
147
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
- import_mui_form_utils.Input,
149
- __spreadProps(__spreadValues({}, field), {
34
+ render: ({ field }) => /* @__PURE__ */ jsx(
35
+ Input,
36
+ {
37
+ ...field,
150
38
  onChange,
151
39
  value: [],
152
40
  inputRef: ref,
@@ -154,56 +42,64 @@ var FilePickerBtn = (_a) => {
154
42
  sx: style,
155
43
  inputProps: {
156
44
  accept,
157
- size: maxSize != null ? maxSize : void 0,
45
+ size: maxSize ?? void 0,
158
46
  multiple
159
47
  },
160
48
  id: inputId
161
- })
49
+ }
162
50
  )
163
51
  }
164
52
  ),
165
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button.Button, __spreadProps(__spreadValues({ color }, rest), { onClick, fullWidth: false, children }))
53
+ /* @__PURE__ */ jsx(Button, { color, ...rest, onClick, fullWidth: false, children })
166
54
  ] });
167
55
  };
168
56
 
169
57
  // src/lib/util.ts
170
- var import_mui_icon = require("@availity/mui-icon");
58
+ import {
59
+ FileArchiveIcon,
60
+ FileCodeIcon,
61
+ FileCsvIcon,
62
+ FileExcelIcon,
63
+ FileIcon,
64
+ FileImageIcon,
65
+ FileLinesIcon,
66
+ FilePdfIcon,
67
+ FilePowerpointIcon,
68
+ FileWordIcon
69
+ } from "@availity/mui-icon";
171
70
  function formatBytes(bytes, decimals = 2) {
172
71
  if (!+bytes) return "0 Bytes";
173
72
  const k = 1024;
174
- const dm = decimals < 0 ? 0 : decimals;
73
+ const dm = Math.max(decimals, 0);
175
74
  const sizes = ["Bytes", "KB", "MB", "GB"];
176
75
  const i = Math.floor(Math.log(bytes) / Math.log(k));
177
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
76
+ return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
178
77
  }
179
78
  var FILE_EXT_ICONS = {
180
- png: import_mui_icon.FileImageIcon,
181
- jpg: import_mui_icon.FileImageIcon,
182
- jpeg: import_mui_icon.FileImageIcon,
183
- gif: import_mui_icon.FileImageIcon,
184
- csv: import_mui_icon.FileCsvIcon,
185
- ppt: import_mui_icon.FilePowerpointIcon,
186
- pptx: import_mui_icon.FilePowerpointIcon,
187
- xls: import_mui_icon.FileExcelIcon,
188
- xlsx: import_mui_icon.FileExcelIcon,
189
- doc: import_mui_icon.FileWordIcon,
190
- docx: import_mui_icon.FileWordIcon,
191
- txt: import_mui_icon.FileLinesIcon,
192
- text: import_mui_icon.FileLinesIcon,
193
- zip: import_mui_icon.FileArchiveIcon,
194
- "7zip": import_mui_icon.FileArchiveIcon,
195
- xml: import_mui_icon.FileCodeIcon,
196
- html: import_mui_icon.FileCodeIcon,
197
- pdf: import_mui_icon.FilePdfIcon
79
+ png: FileImageIcon,
80
+ jpg: FileImageIcon,
81
+ jpeg: FileImageIcon,
82
+ gif: FileImageIcon,
83
+ csv: FileCsvIcon,
84
+ ppt: FilePowerpointIcon,
85
+ pptx: FilePowerpointIcon,
86
+ xls: FileExcelIcon,
87
+ xlsx: FileExcelIcon,
88
+ doc: FileWordIcon,
89
+ docx: FileWordIcon,
90
+ txt: FileLinesIcon,
91
+ text: FileLinesIcon,
92
+ zip: FileArchiveIcon,
93
+ "7zip": FileArchiveIcon,
94
+ xml: FileCodeIcon,
95
+ html: FileCodeIcon,
96
+ pdf: FilePdfIcon
198
97
  };
199
98
  var isValidKey = (key) => key ? key in FILE_EXT_ICONS : false;
200
- var getFileExtension = (fileName) => {
201
- var _a;
202
- return ((_a = fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "";
203
- };
99
+ var getFileExtension = (fileName) => fileName.split(".").pop()?.toLowerCase() || "";
204
100
  var getFileExtIcon = (fileName) => {
205
101
  const ext = getFileExtension(fileName);
206
- return isValidKey(ext) ? FILE_EXT_ICONS[ext] : import_mui_icon.FileIcon;
102
+ return isValidKey(ext) ? FILE_EXT_ICONS[ext] : FileIcon;
207
103
  };
208
104
  var dedupeErrors = (errors) => {
209
105
  const dedupedErrors = errors.reduce((acc, error) => {
@@ -216,7 +112,7 @@ var dedupeErrors = (errors) => {
216
112
  };
217
113
 
218
114
  // src/lib/Dropzone.tsx
219
- var import_jsx_runtime2 = require("react/jsx-runtime");
115
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
220
116
  var outerBoxStyles = {
221
117
  backgroundColor: "background.secondary",
222
118
  border: "1px dotted",
@@ -241,7 +137,7 @@ var createCounter = () => {
241
137
  };
242
138
  };
243
139
  var counter = createCounter();
244
- var DropzoneContainer = (0, import_styles.styled)(import_mui_layout.Box, { name: "AvDropzoneContainer", slot: "root" })({
140
+ var DropzoneContainer = styled(Box, { name: "AvDropzoneContainer", slot: "root" })({
245
141
  ".MuiDivider-root": {
246
142
  width: "196px",
247
143
  marginLeft: "auto",
@@ -265,11 +161,10 @@ var Dropzone = ({
265
161
  setTotalSize,
266
162
  validator
267
163
  }) => {
268
- const { getValues, setValue, watch } = (0, import_react_hook_form2.useFormContext)();
269
- const handleValidation = (0, import_react.useCallback)(
164
+ const { getValues, setValue, watch } = useFormContext();
165
+ const handleValidation = useCallback(
270
166
  (file) => {
271
- var _a2;
272
- const previous = (_a2 = watch(name)) != null ? _a2 : [];
167
+ const previous = watch(name) ?? [];
273
168
  const errors = [];
274
169
  const isDuplicate = previous.some((prev) => prev.name === file.name);
275
170
  if (isDuplicate) {
@@ -286,7 +181,7 @@ var Dropzone = ({
286
181
  });
287
182
  }
288
183
  if (allowedFileNameCharacters) {
289
- const fileName = file.name.substring(0, file.name.lastIndexOf("."));
184
+ const fileName = file.name.slice(0, Math.max(0, file.name.lastIndexOf(".")));
290
185
  const regExp = new RegExp(`([^${allowedFileNameCharacters}])`, "g");
291
186
  if (fileName.match(regExp) !== null) {
292
187
  errors.push({
@@ -297,7 +192,7 @@ var Dropzone = ({
297
192
  }
298
193
  if (allowedFileTypes.length > 0) {
299
194
  const fileName = file.name;
300
- const fileExt = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
195
+ const fileExt = fileName.slice(Math.max(0, fileName.lastIndexOf("."))).toLowerCase();
301
196
  const lowerCaseAllowedTypes = allowedFileTypes.map((type) => type.toLowerCase());
302
197
  if (!lowerCaseAllowedTypes.includes(fileExt)) {
303
198
  errors.push({
@@ -320,15 +215,14 @@ var Dropzone = ({
320
215
  },
321
216
  [maxFiles, validator, allowedFileNameCharacters, watch, name, allowedFileTypes]
322
217
  );
323
- const handleOnDrop = (0, import_react.useCallback)(
218
+ const handleOnDrop = useCallback(
324
219
  (acceptedFiles, fileRejections, event) => {
325
- var _a2;
326
220
  let newSize = 0;
327
221
  for (const file of acceptedFiles) {
328
222
  newSize += file.size;
329
223
  }
330
224
  setTotalSize((prev) => prev + newSize);
331
- const previous = (_a2 = watch(name)) != null ? _a2 : [];
225
+ const previous = watch(name) ?? [];
332
226
  if (maxTotalSize) {
333
227
  const currentTotalSize = previous.reduce((sum, file) => sum + file.size, 0);
334
228
  let newSize2 = 0;
@@ -380,14 +274,16 @@ var Dropzone = ({
380
274
  if (isTooManyFiles) {
381
275
  if (!hasTooManyFiles) {
382
276
  hasTooManyFiles = true;
383
- acc.push(__spreadProps(__spreadValues({}, rejection), {
277
+ acc.push({
278
+ ...rejection,
384
279
  id: counter.increment()
385
- }));
280
+ });
386
281
  }
387
282
  } else {
388
- acc.push(__spreadProps(__spreadValues({}, rejection), {
283
+ acc.push({
284
+ ...rejection,
389
285
  id: counter.increment()
390
- }));
286
+ });
391
287
  }
392
288
  return acc;
393
289
  },
@@ -400,7 +296,7 @@ var Dropzone = ({
400
296
  [setFileRejections, setTotalSize, watch, name, maxTotalSize, maxFiles, setValue, onDrop]
401
297
  );
402
298
  const accept = allowedFileTypes.join(",");
403
- const { getRootProps, getInputProps } = (0, import_react_dropzone.useDropzone)({
299
+ const { getRootProps, getInputProps } = useDropzone({
404
300
  onDrop: handleOnDrop,
405
301
  maxSize,
406
302
  maxFiles,
@@ -414,7 +310,7 @@ var Dropzone = ({
414
310
  accept,
415
311
  onChange
416
312
  });
417
- const _a = getRootProps(), { role, tabIndex } = _a, rootProps = __objRest(_a, ["role", "tabIndex"]);
313
+ const { role, tabIndex, ...rootProps } = getRootProps();
418
314
  const handleOnChange = (event) => {
419
315
  if (inputProps.onChange) {
420
316
  inputProps.onChange(event);
@@ -434,11 +330,11 @@ var Dropzone = ({
434
330
  if (isMaxFilesReached) {
435
331
  disabled = true;
436
332
  }
437
- return enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DropzoneContainer, __spreadProps(__spreadValues({ sx: outerBoxStyles }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_layout.Box, { sx: innerBoxStyles, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_layout.Stack, { spacing: 2, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
438
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_icon2.CloudUploadIcon, { fontSize: "xlarge", color: "secondary" }),
439
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_typography.Typography, { variant: "subtitle2", fontWeight: "700", children: "Drag and Drop Files Here" }),
440
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_divider.Divider, { flexItem: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_typography.Typography, { variant: "subtitle2", children: "OR" }) }),
441
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
333
+ return enableDropArea ? /* @__PURE__ */ jsx2(DropzoneContainer, { sx: outerBoxStyles, ...rootProps, children: /* @__PURE__ */ jsx2(Box, { sx: innerBoxStyles, children: /* @__PURE__ */ jsx2(Stack, { spacing: 2, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs2(Fragment2, { children: [
334
+ /* @__PURE__ */ jsx2(CloudUploadIcon, { fontSize: "xlarge", color: "secondary" }),
335
+ /* @__PURE__ */ jsx2(Typography, { variant: "subtitle2", fontWeight: "700", children: "Drag and Drop Files Here" }),
336
+ /* @__PURE__ */ jsx2(Divider, { flexItem: true, children: /* @__PURE__ */ jsx2(Typography, { variant: "subtitle2", children: "OR" }) }),
337
+ /* @__PURE__ */ jsx2(
442
338
  FilePickerBtn,
443
339
  {
444
340
  name,
@@ -451,7 +347,7 @@ var Dropzone = ({
451
347
  children: "Browse Files"
452
348
  }
453
349
  )
454
- ] }) }) }) })) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
350
+ ] }) }) }) }) : /* @__PURE__ */ jsx2(
455
351
  FilePickerBtn,
456
352
  {
457
353
  name,
@@ -461,35 +357,33 @@ var Dropzone = ({
461
357
  onClick: handleOnClick,
462
358
  inputProps,
463
359
  onChange: handleOnChange,
464
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_icon2.PlusIcon, {}),
360
+ startIcon: /* @__PURE__ */ jsx2(PlusIcon, {}),
465
361
  children: hasFiles ? "Add More Files" : "Add File(s)"
466
362
  }
467
363
  );
468
364
  };
469
365
 
470
366
  // src/lib/Dropzone2.tsx
471
- var import_react2 = require("react");
472
- var import_react_dropzone2 = require("react-dropzone");
473
- var import_react_hook_form3 = require("react-hook-form");
474
- var import_mui_divider2 = require("@availity/mui-divider");
475
- var import_mui_icon3 = require("@availity/mui-icon");
476
- var import_mui_layout2 = require("@availity/mui-layout");
477
- var import_mui_typography2 = require("@availity/mui-typography");
478
- var import_upload_core = __toESM(require("@availity/upload-core"));
479
- var import_jsx_runtime3 = require("react/jsx-runtime");
367
+ import { useCallback as useCallback2 } from "react";
368
+ import { useDropzone as useDropzone2 } from "react-dropzone";
369
+ import { useFormContext as useFormContext2 } from "react-hook-form";
370
+ import { Divider as Divider2 } from "@availity/mui-divider";
371
+ import { CloudUploadIcon as CloudUploadIcon2, PlusIcon as PlusIcon2 } from "@availity/mui-icon";
372
+ import { Box as Box2, Stack as Stack2 } from "@availity/mui-layout";
373
+ import { Typography as Typography2 } from "@availity/mui-typography";
374
+ import Upload from "@availity/upload-core";
375
+ import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
480
376
  var counter2 = createCounter();
481
- function startUpload(file, options) {
482
- return __async(this, null, function* () {
483
- const _a = options, { onSuccess, onError, onProgress, onChunkComplete } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress", "onChunkComplete"]);
484
- const upload = new import_upload_core.default(file, uploadOptions);
485
- yield upload.generateId();
486
- if (onSuccess) upload.onSuccess.push(onSuccess);
487
- if (onError) upload.onError.push(onError);
488
- if (onProgress) upload.onProgress.push(onProgress);
489
- if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
490
- upload.start();
491
- return upload;
492
- });
377
+ async function startUpload(file, options) {
378
+ const { onSuccess, onError, onProgress, onChunkComplete, ...uploadOptions } = options;
379
+ const upload = new Upload(file, uploadOptions);
380
+ await upload.generateId();
381
+ if (onSuccess) upload.onSuccess.push(onSuccess);
382
+ if (onError) upload.onError.push(onError);
383
+ if (onProgress) upload.onProgress.push(onProgress);
384
+ if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
385
+ upload.start();
386
+ return upload;
493
387
  }
494
388
  var Dropzone2 = ({
495
389
  allowedFileTypes = [],
@@ -508,12 +402,11 @@ var Dropzone2 = ({
508
402
  uploadOptions,
509
403
  validator
510
404
  }) => {
511
- const { getValues, setValue, watch } = (0, import_react_hook_form3.useFormContext)();
405
+ const { getValues, setValue, watch } = useFormContext2();
512
406
  const accept = allowedFileTypes.join(",");
513
- const handleValidation = (0, import_react2.useCallback)(
407
+ const handleValidation = useCallback2(
514
408
  (file) => {
515
- var _a2;
516
- const previous = (_a2 = watch(name)) != null ? _a2 : [];
409
+ const previous = watch(name) ?? [];
517
410
  const errors = [];
518
411
  const isDuplicate = previous.some((prev) => prev.file.name === file.name);
519
412
  if (isDuplicate) {
@@ -530,7 +423,7 @@ var Dropzone2 = ({
530
423
  });
531
424
  }
532
425
  if (uploadOptions.allowedFileNameCharacters) {
533
- const fileName = file.name.substring(0, file.name.lastIndexOf("."));
426
+ const fileName = file.name.slice(0, Math.max(0, file.name.lastIndexOf(".")));
534
427
  const regExp = new RegExp(`([^${uploadOptions.allowedFileNameCharacters}])`, "g");
535
428
  if (fileName.match(regExp) !== null) {
536
429
  errors.push({
@@ -541,7 +434,7 @@ var Dropzone2 = ({
541
434
  }
542
435
  if (allowedFileTypes.length > 0) {
543
436
  const fileName = file.name;
544
- const fileExt = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
437
+ const fileExt = fileName.slice(Math.max(0, fileName.lastIndexOf("."))).toLowerCase();
545
438
  const lowerCaseAllowedTypes = allowedFileTypes.map((type) => type.toLowerCase());
546
439
  if (!lowerCaseAllowedTypes.includes(fileExt)) {
547
440
  errors.push({
@@ -564,15 +457,14 @@ var Dropzone2 = ({
564
457
  },
565
458
  [maxFiles, validator, uploadOptions.allowedFileNameCharacters, allowedFileTypes, watch, name]
566
459
  );
567
- const handleOnDrop = (0, import_react2.useCallback)(
568
- (acceptedFiles, fileRejections, event) => __async(null, null, function* () {
569
- var _a2;
460
+ const handleOnDrop = useCallback2(
461
+ async (acceptedFiles, fileRejections, event) => {
570
462
  let newSize = 0;
571
463
  for (const file of acceptedFiles) {
572
464
  newSize += file.size;
573
465
  }
574
466
  setTotalSize((prev) => prev + newSize);
575
- const previous = (_a2 = watch(name)) != null ? _a2 : [];
467
+ const previous = watch(name) ?? [];
576
468
  if (maxTotalSize) {
577
469
  const currentTotalSize = previous.reduce((sum, upload) => sum + upload.file.size, 0);
578
470
  let newSize2 = 0;
@@ -602,7 +494,7 @@ var Dropzone2 = ({
602
494
  const remainingSlots = maxFiles ? Math.max(0, maxFiles - previous.length) : acceptedFiles.length;
603
495
  const filesToAdd = acceptedFiles.slice(0, remainingSlots);
604
496
  const uploads = filesToAdd.map((file) => startUpload(file, uploadOptions));
605
- setValue(name, previous.concat(yield Promise.all(uploads)));
497
+ setValue(name, previous.concat(await Promise.all(uploads)));
606
498
  if (maxFiles && acceptedFiles.length > remainingSlots) {
607
499
  fileRejections.push({
608
500
  file: acceptedFiles[remainingSlots],
@@ -625,14 +517,16 @@ var Dropzone2 = ({
625
517
  if (isTooManyFiles) {
626
518
  if (!hasTooManyFiles) {
627
519
  hasTooManyFiles = true;
628
- acc.push(__spreadProps(__spreadValues({}, rejection), {
520
+ acc.push({
521
+ ...rejection,
629
522
  id: counter2.increment()
630
- }));
523
+ });
631
524
  }
632
525
  } else {
633
- acc.push(__spreadProps(__spreadValues({}, rejection), {
526
+ acc.push({
527
+ ...rejection,
634
528
  id: counter2.increment()
635
- }));
529
+ });
636
530
  }
637
531
  return acc;
638
532
  },
@@ -641,10 +535,10 @@ var Dropzone2 = ({
641
535
  }
642
536
  if (setFileRejections) setFileRejections(fileRejections);
643
537
  if (onDrop) onDrop(acceptedFiles, fileRejections, event);
644
- }),
538
+ },
645
539
  [setFileRejections, setTotalSize, watch, name, maxTotalSize, maxFiles, uploadOptions, setValue, onDrop]
646
540
  );
647
- const { getRootProps, getInputProps } = (0, import_react_dropzone2.useDropzone)({
541
+ const { getRootProps, getInputProps } = useDropzone2({
648
542
  onDrop: handleOnDrop,
649
543
  maxSize,
650
544
  maxFiles,
@@ -658,7 +552,7 @@ var Dropzone2 = ({
658
552
  accept,
659
553
  onChange
660
554
  });
661
- const _a = getRootProps(), { role, tabIndex } = _a, rootProps = __objRest(_a, ["role", "tabIndex"]);
555
+ const { role, tabIndex, ...rootProps } = getRootProps();
662
556
  const handleOnChange = (event) => {
663
557
  if (inputProps.onChange) {
664
558
  inputProps.onChange(event);
@@ -678,11 +572,11 @@ var Dropzone2 = ({
678
572
  if (isMaxFilesReached) {
679
573
  disabled = true;
680
574
  }
681
- return enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DropzoneContainer, __spreadProps(__spreadValues({ sx: outerBoxStyles }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_layout2.Box, { sx: innerBoxStyles, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_layout2.Stack, { spacing: 2, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
682
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_icon3.CloudUploadIcon, { fontSize: "xlarge", color: "secondary" }),
683
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_typography2.Typography, { variant: "subtitle2", fontWeight: "700", children: "Drag and Drop Files Here" }),
684
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_divider2.Divider, { flexItem: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_typography2.Typography, { variant: "subtitle2", children: "OR" }) }),
685
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
575
+ return enableDropArea ? /* @__PURE__ */ jsx3(DropzoneContainer, { sx: outerBoxStyles, ...rootProps, children: /* @__PURE__ */ jsx3(Box2, { sx: innerBoxStyles, children: /* @__PURE__ */ jsx3(Stack2, { spacing: 2, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs3(Fragment3, { children: [
576
+ /* @__PURE__ */ jsx3(CloudUploadIcon2, { fontSize: "xlarge", color: "secondary" }),
577
+ /* @__PURE__ */ jsx3(Typography2, { variant: "subtitle2", fontWeight: "700", children: "Drag and Drop Files Here" }),
578
+ /* @__PURE__ */ jsx3(Divider2, { flexItem: true, children: /* @__PURE__ */ jsx3(Typography2, { variant: "subtitle2", children: "OR" }) }),
579
+ /* @__PURE__ */ jsx3(
686
580
  FilePickerBtn,
687
581
  {
688
582
  name,
@@ -695,7 +589,7 @@ var Dropzone2 = ({
695
589
  children: "Browse Files"
696
590
  }
697
591
  )
698
- ] }) }) }) })) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
592
+ ] }) }) }) }) : /* @__PURE__ */ jsx3(
699
593
  FilePickerBtn,
700
594
  {
701
595
  name,
@@ -705,16 +599,16 @@ var Dropzone2 = ({
705
599
  onClick: handleOnClick,
706
600
  inputProps,
707
601
  onChange: handleOnChange,
708
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_icon3.PlusIcon, {}),
602
+ startIcon: /* @__PURE__ */ jsx3(PlusIcon2, {}),
709
603
  children: hasFiles ? "Add More Files" : "Add File(s)"
710
604
  }
711
605
  );
712
606
  };
713
607
 
714
608
  // src/lib/ErrorAlert.tsx
715
- var import_mui_alert = require("@availity/mui-alert");
716
- var import_mui_list = require("@availity/mui-list");
717
- var import_jsx_runtime4 = require("react/jsx-runtime");
609
+ import { Alert, AlertTitle } from "@availity/mui-alert";
610
+ import { List, ListItem } from "@availity/mui-list";
611
+ import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
718
612
  var codes = {
719
613
  "file-too-large": "File exceeds maximum size",
720
614
  "upload-too-large": "File causes maximum total upload size to be exceeded",
@@ -732,15 +626,15 @@ var formatFileTooLarge = (message) => {
732
626
  };
733
627
  var ErrorAlert = ({ errors, fileName, id, onClose }) => {
734
628
  if (errors.length === 0) return null;
735
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_alert.Alert, { severity: "error", onClose, children: errors.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
736
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_alert.AlertTitle, { children: [
629
+ return /* @__PURE__ */ jsx4(Alert, { severity: "error", onClose, children: errors.length > 1 ? /* @__PURE__ */ jsxs4(Fragment4, { children: [
630
+ /* @__PURE__ */ jsxs4(AlertTitle, { children: [
737
631
  "There were ",
738
632
  errors.length,
739
633
  " error(s) found when uploading ",
740
634
  fileName
741
635
  ] }),
742
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
743
- import_mui_list.List,
636
+ /* @__PURE__ */ jsx4(
637
+ List,
744
638
  {
745
639
  sx: {
746
640
  listStyleType: "disc",
@@ -751,14 +645,14 @@ var ErrorAlert = ({ errors, fileName, id, onClose }) => {
751
645
  }
752
646
  },
753
647
  disablePadding: true,
754
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: errors.map((error) => {
648
+ children: /* @__PURE__ */ jsx4(Fragment4, { children: errors.map((error) => {
755
649
  const message = error.code === "file-too-large" ? formatFileTooLarge(error.message) : error.message;
756
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_list.ListItem, { disableGutters: true, disablePadding: true, divider: false, children: message }, `${id}-${error.code}`);
650
+ return /* @__PURE__ */ jsx4(ListItem, { disableGutters: true, disablePadding: true, divider: false, children: message }, `${id}-${error.code}`);
757
651
  }) })
758
652
  }
759
653
  )
760
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
761
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_alert.AlertTitle, { children: [
654
+ ] }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
655
+ /* @__PURE__ */ jsxs4(AlertTitle, { children: [
762
656
  codes[errors[0].code] || "Error",
763
657
  ": ",
764
658
  fileName
@@ -768,24 +662,24 @@ var ErrorAlert = ({ errors, fileName, id, onClose }) => {
768
662
  };
769
663
 
770
664
  // src/lib/FileList.tsx
771
- var import_mui_list3 = require("@availity/mui-list");
772
- var import_mui_button4 = require("@availity/mui-button");
773
- var import_mui_icon6 = require("@availity/mui-icon");
774
- var import_mui_layout5 = require("@availity/mui-layout");
775
- var import_mui_divider3 = require("@availity/mui-divider");
665
+ import { List as List2, ListItem as ListItem2, ListItemText as ListItemText2, ListItemIcon } from "@availity/mui-list";
666
+ import { IconButton as IconButton3 } from "@availity/mui-button";
667
+ import { DeleteIcon } from "@availity/mui-icon";
668
+ import { Grid as Grid2 } from "@availity/mui-layout";
669
+ import { Divider as Divider3 } from "@availity/mui-divider";
776
670
 
777
671
  // src/lib/UploadProgressBar.tsx
778
- var import_react4 = require("react");
779
- var import_mui_button3 = require("@availity/mui-button");
672
+ import { useState as useState2 } from "react";
673
+ import { Button as Button2, IconButton as IconButton2 } from "@availity/mui-button";
780
674
 
781
675
  // ../dialog/src/lib/Dialog.tsx
782
- var import_Dialog = __toESM(require("@mui/material/Dialog"));
783
- var import_styles2 = require("@mui/material/styles");
784
- var import_mui_button2 = require("@availity/mui-button");
785
- var import_mui_icon4 = require("@availity/mui-icon");
786
- var import_jsx_runtime5 = require("react/jsx-runtime");
787
- var CloseButton = (args) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_button2.IconButton, __spreadProps(__spreadValues({ title: "Close Dialog", color: "secondary" }, args), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_icon4.CloseIcon, { fontSize: "xsmall" }) }));
788
- var CloseButtonSlot = (0, import_styles2.styled)(CloseButton, {
676
+ import MuiDialog from "@mui/material/Dialog";
677
+ import { styled as styled2 } from "@mui/material/styles";
678
+ import { IconButton } from "@availity/mui-button";
679
+ import { CloseIcon } from "@availity/mui-icon";
680
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
681
+ var CloseButton = (args) => /* @__PURE__ */ jsx5(IconButton, { title: "Close Dialog", color: "secondary", ...args, children: /* @__PURE__ */ jsx5(CloseIcon, { fontSize: "xsmall" }) });
682
+ var CloseButtonSlot = styled2(CloseButton, {
789
683
  name: "MuiDialog",
790
684
  slot: "AvCloseButton",
791
685
  overridesResolver: (props, styles) => styles.avCloseButton
@@ -797,36 +691,27 @@ var CloseButtonSlot = (0, import_styles2.styled)(CloseButton, {
797
691
  marginRight: "3.5rem"
798
692
  }
799
693
  });
800
- var Dialog = (_a) => {
801
- var _b = _a, { children, closeButton = true, onClose } = _b, rest = __objRest(_b, ["children", "closeButton", "onClose"]);
802
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Dialog.default, __spreadProps(__spreadValues({ onClose }, rest), { children: [
803
- closeButton ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CloseButtonSlot, { onClick: onClose }) : null,
804
- children
805
- ] }));
806
- };
694
+ var Dialog = ({ children, closeButton = true, onClose, ...rest }) => /* @__PURE__ */ jsxs5(MuiDialog, { onClose, ...rest, children: [
695
+ closeButton ? /* @__PURE__ */ jsx5(CloseButtonSlot, { onClick: onClose }) : null,
696
+ children
697
+ ] });
807
698
 
808
699
  // ../dialog/src/lib/DialogActions.tsx
809
- var import_DialogActions = __toESM(require("@mui/material/DialogActions"));
810
- var import_jsx_runtime6 = require("react/jsx-runtime");
811
- var DialogActions = (_a) => {
812
- var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
813
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_DialogActions.default, __spreadProps(__spreadValues({}, rest), { children }));
814
- };
700
+ import MuiDialogActions from "@mui/material/DialogActions";
701
+ import { jsx as jsx6 } from "react/jsx-runtime";
702
+ var DialogActions = ({ children, ...rest }) => /* @__PURE__ */ jsx6(MuiDialogActions, { ...rest, children });
815
703
 
816
704
  // ../dialog/src/lib/DialogContent.tsx
817
- var import_DialogContent = __toESM(require("@mui/material/DialogContent"));
818
- var import_jsx_runtime7 = require("react/jsx-runtime");
819
- var DialogContent = (_a) => {
820
- var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
821
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_DialogContent.default, __spreadProps(__spreadValues({}, rest), { children }));
822
- };
705
+ import MuiDialogContent from "@mui/material/DialogContent";
706
+ import { jsx as jsx7 } from "react/jsx-runtime";
707
+ var DialogContent = ({ children, ...rest }) => /* @__PURE__ */ jsx7(MuiDialogContent, { ...rest, children });
823
708
 
824
709
  // ../dialog/src/lib/DialogTitle.tsx
825
- var import_DialogTitle = __toESM(require("@mui/material/DialogTitle"));
826
- var import_mui_alert2 = require("@availity/mui-alert");
827
- var import_styles3 = require("@mui/material/styles");
828
- var import_jsx_runtime8 = require("react/jsx-runtime");
829
- var AlertIcon = (0, import_styles3.styled)("div", {
710
+ import MuiDialogTitle from "@mui/material/DialogTitle";
711
+ import { AlertIcons } from "@availity/mui-alert";
712
+ import { styled as styled3 } from "@mui/material/styles";
713
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
714
+ var AlertIcon = styled3("div", {
830
715
  name: "MuiDialogTitle",
831
716
  slot: "AvIcon",
832
717
  overridesResolver: (props, styles) => styles.avIcon
@@ -836,55 +721,52 @@ var AlertIcon = (0, import_styles3.styled)("div", {
836
721
  marginRight: ".5rem",
837
722
  verticalAlign: "text-bottom"
838
723
  });
839
- var DialogTitle = (_a) => {
840
- var _b = _a, { children, component = "h2", icon, variant = "h5" } = _b, rest = __objRest(_b, ["children", "component", "icon", "variant"]);
841
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_DialogTitle.default, __spreadProps(__spreadValues({ component, variant }, rest), { children: [
842
- icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AlertIcon, { children: import_mui_alert2.AlertIcons[icon] }) : null,
843
- children
844
- ] }));
845
- };
724
+ var DialogTitle = ({ children, component = "h2", icon, variant = "h5", ...rest }) => /* @__PURE__ */ jsxs6(MuiDialogTitle, { component, variant, ...rest, children: [
725
+ icon ? /* @__PURE__ */ jsx8(AlertIcon, { children: AlertIcons[icon] }) : null,
726
+ children
727
+ ] });
846
728
 
847
729
  // src/lib/UploadProgressBar.tsx
848
- var import_mui_form_utils3 = require("@availity/mui-form-utils");
849
- var import_mui_icon5 = require("@availity/mui-icon");
850
- var import_mui_layout4 = require("@availity/mui-layout");
851
- var import_mui_list2 = require("@availity/mui-list");
852
- var import_mui_progress = require("@availity/mui-progress");
730
+ import { InputAdornment } from "@availity/mui-form-utils";
731
+ import { EyeIcon, EyeSlashIcon, WarningTriangleIcon } from "@availity/mui-icon";
732
+ import { Box as Box3 } from "@availity/mui-layout";
733
+ import { ListItemText } from "@availity/mui-list";
734
+ import { LinearProgress } from "@availity/mui-progress";
853
735
 
854
736
  // ../textfield/src/lib/TextField.tsx
855
- var import_react3 = require("react");
856
- var import_TextField = __toESM(require("@mui/material/TextField"));
857
- var import_mui_form_utils2 = require("@availity/mui-form-utils");
858
- var import_mui_layout3 = require("@availity/mui-layout");
859
- var import_mui_typography3 = require("@availity/mui-typography");
860
- var import_jsx_runtime9 = require("react/jsx-runtime");
861
- var TextFieldFormHelperText = (_a) => {
862
- var _b = _a, {
863
- charCount,
864
- helperText,
865
- maxLength,
866
- showCharacterCount
867
- } = _b, FormHelperTextProps2 = __objRest(_b, [
868
- "charCount",
869
- "helperText",
870
- "maxLength",
871
- "showCharacterCount"
872
- ]);
737
+ import { forwardRef, useState } from "react";
738
+ import MuiTextField from "@mui/material/TextField";
739
+ import {
740
+ FormHelperText,
741
+ FormLabel,
742
+ InputPropOverrides,
743
+ SelectAccessibilityOverrides,
744
+ SelectPropOverrides
745
+ } from "@availity/mui-form-utils";
746
+ import { Grid } from "@availity/mui-layout";
747
+ import { Typography as Typography3 } from "@availity/mui-typography";
748
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
749
+ var TextFieldFormHelperText = ({
750
+ charCount,
751
+ helperText,
752
+ maxLength,
753
+ showCharacterCount,
754
+ ...FormHelperTextProps2
755
+ }) => {
873
756
  if (showCharacterCount) {
874
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_layout3.Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
875
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, __spreadProps(__spreadValues({}, FormHelperTextProps2), { sx: { marginRight: "12px" }, children: helperText })),
876
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_typography3.Typography, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
877
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_typography3.Typography, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
757
+ return /* @__PURE__ */ jsxs7(Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
758
+ /* @__PURE__ */ jsx9(FormHelperText, { ...FormHelperTextProps2, sx: { marginRight: "12px" }, children: helperText }),
759
+ /* @__PURE__ */ jsxs7(Typography3, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
760
+ /* @__PURE__ */ jsx9(Typography3, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
878
761
  "/",
879
762
  maxLength
880
763
  ] })
881
764
  ] });
882
765
  }
883
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, __spreadProps(__spreadValues({}, FormHelperTextProps2), { children: helperText }));
766
+ return /* @__PURE__ */ jsx9(FormHelperText, { ...FormHelperTextProps2, children: helperText });
884
767
  };
885
- var TextField = (0, import_react3.forwardRef)((props, ref) => {
886
- var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
887
- const _a = props, {
768
+ var TextField = forwardRef((props, ref) => {
769
+ const {
888
770
  InputProps: InputProps2,
889
771
  helpTopicId,
890
772
  InputLabelProps,
@@ -894,65 +776,68 @@ var TextField = (0, import_react3.forwardRef)((props, ref) => {
894
776
  inputProps,
895
777
  helperText,
896
778
  showCharacterCount = false,
897
- displayOverflowMaxLength = false
898
- } = _a, rest = __objRest(_a, [
899
- "InputProps",
900
- "helpTopicId",
901
- "InputLabelProps",
902
- "FormHelperTextProps",
903
- "required",
904
- "SelectProps",
905
- "inputProps",
906
- "helperText",
907
- "showCharacterCount",
908
- "displayOverflowMaxLength"
909
- ]);
910
- const [openDetected, setOpenDetected] = (0, import_react3.useState)(false);
911
- const [charCount, setCharCount] = (0, import_react3.useState)(0);
912
- const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
913
- const allReadOnly = (InputProps2 == null ? void 0 : InputProps2.readOnly) || (inputProps == null ? void 0 : inputProps.readOnly) || ((_e = (_d = rest.slotProps) == null ? void 0 : _d.htmlInput) == null ? void 0 : _e.readOnly) || ((_g = (_f = rest.slotProps) == null ? void 0 : _f.input) == null ? void 0 : _g.readOnly);
779
+ displayOverflowMaxLength = false,
780
+ ...rest
781
+ } = props;
782
+ const [openDetected, setOpenDetected] = useState(false);
783
+ const [charCount, setCharCount] = useState(0);
784
+ const maxLength = inputProps?.maxLength || rest.slotProps?.htmlInput?.maxLength;
785
+ const allReadOnly = InputProps2?.readOnly || inputProps?.readOnly || rest.slotProps?.htmlInput?.readOnly || rest.slotProps?.input?.readOnly;
914
786
  const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
915
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
916
- import_TextField.default,
917
- __spreadProps(__spreadValues({}, rest), {
787
+ return /* @__PURE__ */ jsx9(
788
+ MuiTextField,
789
+ {
790
+ ...rest,
918
791
  onChange: (event) => {
919
792
  setCharCount(event.target.value.length);
920
793
  if (rest.onChange) rest.onChange(event);
921
794
  },
922
- helperText: helperText || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
795
+ helperText: helperText || /* @__PURE__ */ jsx9(Fragment5, {}),
923
796
  slots: { formHelperText: TextFieldFormHelperText },
924
797
  slotProps: {
925
- input: resolvedProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils2.InputPropOverrides), (_h = rest.slotProps) == null ? void 0 : _h.input), {
798
+ input: resolvedProps({
799
+ ...InputProps2,
800
+ ...InputPropOverrides,
801
+ ...rest.slotProps?.input,
926
802
  readOnly: allReadOnly
927
- })),
928
- htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
929
- "aria-required": required
930
- }, inputProps), (_i = rest.slotProps) == null ? void 0 : _i.htmlInput), {
803
+ }),
804
+ htmlInput: resolvedProps({
805
+ "aria-required": required,
806
+ ...inputProps,
807
+ ...rest.slotProps?.htmlInput,
931
808
  maxLength: !displayOverflowMaxLength ? maxLength : void 0
932
- })),
933
- 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)), (_j = rest.slotProps) == null ? void 0 : _j.select)),
934
- inputLabel: resolvedProps(__spreadValues(__spreadValues({
935
- component: import_mui_form_utils2.FormLabel,
809
+ }),
810
+ select: resolvedProps({
811
+ ...SelectProps2,
812
+ ...SelectPropOverrides,
813
+ ...SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2?.open),
814
+ ...rest.slotProps?.select
815
+ }),
816
+ inputLabel: resolvedProps({
817
+ component: FormLabel,
936
818
  helpTopicId,
937
819
  required,
938
- shrink: true
939
- }, InputLabelProps), (_k = rest.slotProps) == null ? void 0 : _k.inputLabel)),
940
- formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
941
- component: "div"
942
- }, FormHelperTextProps2), (_l = rest.slotProps) == null ? void 0 : _l.formHelperText), {
820
+ shrink: true,
821
+ ...InputLabelProps,
822
+ ...rest.slotProps?.inputLabel
823
+ }),
824
+ formHelperText: resolvedProps({
825
+ component: "div",
826
+ ...FormHelperTextProps2,
827
+ ...rest.slotProps?.formHelperText,
943
828
  charCount,
944
829
  helperText,
945
830
  maxLength,
946
831
  showCharacterCount
947
- }))
832
+ })
948
833
  },
949
834
  ref
950
- })
835
+ }
951
836
  );
952
837
  });
953
838
 
954
839
  // src/lib/UploadProgressBar.tsx
955
- var import_jsx_runtime10 = require("react/jsx-runtime");
840
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
956
841
  var ERROR_MAPPINGS = [
957
842
  {
958
843
  pattern: /but has an extension for/i,
@@ -964,13 +849,13 @@ var friendlyErrorMessage = (errorMessage) => {
964
849
  return mapping ? mapping.friendlyMessage : errorMessage;
965
850
  };
966
851
  var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
967
- const [statePercentage, setStatePercentage] = (0, import_react4.useState)(upload.percentage || 0);
968
- const [errorMessage, setErrorMessage] = (0, import_react4.useState)(
852
+ const [statePercentage, setStatePercentage] = useState2(upload.percentage || 0);
853
+ const [errorMessage, setErrorMessage] = useState2(
969
854
  upload.errorMessage ? friendlyErrorMessage(upload.errorMessage) : ""
970
855
  );
971
- const [password, setPassword] = (0, import_react4.useState)("");
972
- const [showPassword, setShowPassword] = (0, import_react4.useState)(false);
973
- const [modalOpen, setModalOpen] = (0, import_react4.useState)(false);
856
+ const [password, setPassword] = useState2("");
857
+ const [showPassword, setShowPassword] = useState2(false);
858
+ const [modalOpen, setModalOpen] = useState2(false);
974
859
  const handleOnProgress = () => {
975
860
  setStatePercentage(upload.percentage);
976
861
  setErrorMessage("");
@@ -1001,24 +886,24 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
1001
886
  upload.onProgress.push(handleOnProgress);
1002
887
  upload.onSuccess.push(handleOnSuccess);
1003
888
  upload.onError.push(handleOnError);
1004
- return errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_layout4.Box, { sx: { display: "flex", flexWrap: "wrap", columnGap: "4px" }, children: [
1005
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1006
- import_mui_list2.ListItemText,
889
+ return errorMessage ? /* @__PURE__ */ jsxs8(Box3, { sx: { display: "flex", flexWrap: "wrap", columnGap: "4px" }, children: [
890
+ /* @__PURE__ */ jsxs8(
891
+ ListItemText,
1007
892
  {
1008
893
  slotProps: { primary: { color: "text.error", variant: "body2", component: "div" } },
1009
894
  sx: { wordWrap: "break-word" },
1010
895
  children: [
1011
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_icon5.WarningTriangleIcon, { sx: { verticalAlign: "middle", mt: "-2px" } }),
896
+ /* @__PURE__ */ jsx10(WarningTriangleIcon, { sx: { verticalAlign: "middle", mt: "-2px" } }),
1012
897
  " ",
1013
898
  errorMessage
1014
899
  ]
1015
900
  }
1016
901
  ),
1017
- upload.status === "encrypted" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pwRequired", children: [
1018
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_button3.Button, { color: "secondary", size: "small", onClick: toggleModal, children: "Enter Password" }),
1019
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog, { open: modalOpen, onClose: toggleModal, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: verifyPassword, children: [
1020
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitle, { children: "Enter Password" }),
1021
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
902
+ upload.status === "encrypted" && /* @__PURE__ */ jsxs8("div", { className: "pwRequired", children: [
903
+ /* @__PURE__ */ jsx10(Button2, { color: "secondary", size: "small", onClick: toggleModal, children: "Enter Password" }),
904
+ /* @__PURE__ */ jsx10(Dialog, { open: modalOpen, onClose: toggleModal, children: /* @__PURE__ */ jsxs8("form", { onSubmit: verifyPassword, children: [
905
+ /* @__PURE__ */ jsx10(DialogTitle, { children: "Enter Password" }),
906
+ /* @__PURE__ */ jsx10(DialogContent, { children: /* @__PURE__ */ jsx10(
1022
907
  TextField,
1023
908
  {
1024
909
  type: showPassword ? "text" : "password",
@@ -1027,53 +912,52 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
1027
912
  onChange: handlePasswordChange,
1028
913
  autoFocus: true,
1029
914
  InputProps: {
1030
- endAdornment: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils3.InputAdornment, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1031
- import_mui_button3.IconButton,
915
+ endAdornment: /* @__PURE__ */ jsx10(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx10(
916
+ IconButton2,
1032
917
  {
1033
918
  title: "password visibility",
1034
919
  onClick: () => setShowPassword((prev) => !prev),
1035
920
  edge: "end",
1036
- children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_icon5.EyeIcon, { fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_icon5.EyeSlashIcon, { fontSize: "small" })
921
+ children: showPassword ? /* @__PURE__ */ jsx10(EyeIcon, { fontSize: "small" }) : /* @__PURE__ */ jsx10(EyeSlashIcon, { fontSize: "small" })
1037
922
  }
1038
923
  ) })
1039
924
  }
1040
925
  }
1041
926
  ) }),
1042
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_button3.Button, { color: "primary", type: "submit", children: "Ok" }) })
927
+ /* @__PURE__ */ jsx10(DialogActions, { children: /* @__PURE__ */ jsx10(Button2, { color: "primary", type: "submit", children: "Ok" }) })
1043
928
  ] }) })
1044
929
  ] })
1045
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_progress.LinearProgress, { value: statePercentage, "aria-label": `${upload.file.name}-progress` });
930
+ ] }) : /* @__PURE__ */ jsx10(LinearProgress, { value: statePercentage, "aria-label": `${upload.file.name}-progress` });
1046
931
  };
1047
932
 
1048
933
  // src/lib/useUploadCore.tsx
1049
- var import_react_query = require("@tanstack/react-query");
1050
- var import_upload_core2 = __toESM(require("@availity/upload-core"));
1051
- function startUpload2(file, options) {
1052
- return __async(this, null, function* () {
1053
- const _a = options, { onSuccess, onError, onProgress, onChunkComplete } = _a, uploadOptions = __objRest(_a, ["onSuccess", "onError", "onProgress", "onChunkComplete"]);
1054
- const upload = new import_upload_core2.default(file, uploadOptions);
1055
- yield upload.generateId();
1056
- if (onSuccess) upload.onSuccess.push(onSuccess);
1057
- if (onError) upload.onError.push(onError);
1058
- if (onProgress) upload.onProgress.push(onProgress);
1059
- if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
1060
- upload.start();
1061
- return upload;
1062
- });
934
+ import { useQuery } from "@tanstack/react-query";
935
+ import Upload2 from "@availity/upload-core";
936
+ async function startUpload2(file, options) {
937
+ const { onSuccess, onError, onProgress, onChunkComplete, ...uploadOptions } = options;
938
+ const upload = new Upload2(file, uploadOptions);
939
+ await upload.generateId();
940
+ if (onSuccess) upload.onSuccess.push(onSuccess);
941
+ if (onError) upload.onError.push(onError);
942
+ if (onProgress) upload.onProgress.push(onProgress);
943
+ if (onChunkComplete) upload.onChunkComplete.push(onChunkComplete);
944
+ upload.start();
945
+ return upload;
1063
946
  }
1064
947
  function useUploadCore(file, options, queryOptions) {
1065
948
  const isQueryEnabled = !!file;
1066
- return (0, import_react_query.useQuery)(__spreadValues({
949
+ return useQuery({
1067
950
  queryKey: ["upload", file.name, options],
1068
951
  queryFn: () => startUpload2(file, options),
1069
952
  enabled: isQueryEnabled,
1070
953
  retry: false,
1071
- refetchOnWindowFocus: false
1072
- }, queryOptions));
954
+ refetchOnWindowFocus: false,
955
+ ...queryOptions
956
+ });
1073
957
  }
1074
958
 
1075
959
  // src/lib/FileList.tsx
1076
- var import_jsx_runtime11 = require("react/jsx-runtime");
960
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1077
961
  var FileRow = ({
1078
962
  file,
1079
963
  options,
@@ -1085,30 +969,30 @@ var FileRow = ({
1085
969
  const Icon = getFileExtIcon(file.name);
1086
970
  const { data: upload } = useUploadCore(file, options, queryOptions);
1087
971
  if (!upload) return null;
1088
- if (CustomRow) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CustomRow, { upload, options, onRemoveFile });
1089
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1090
- import_mui_list3.ListItem,
972
+ if (CustomRow) return /* @__PURE__ */ jsx11(CustomRow, { upload, options, onRemoveFile });
973
+ return /* @__PURE__ */ jsxs9(
974
+ ListItem2,
1091
975
  {
1092
976
  disableGutters: true,
1093
- secondaryAction: !disableRemove && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1094
- import_mui_button4.IconButton,
977
+ secondaryAction: !disableRemove && /* @__PURE__ */ jsx11(
978
+ IconButton3,
1095
979
  {
1096
980
  title: "remove file",
1097
981
  edge: "end",
1098
982
  onClick: () => {
1099
983
  onRemoveFile(upload.id, upload);
1100
984
  },
1101
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_icon6.DeleteIcon, {})
985
+ children: /* @__PURE__ */ jsx11(DeleteIcon, {})
1102
986
  }
1103
987
  ),
1104
988
  children: [
1105
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_mui_layout5.Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
1106
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout5.Grid, { size: { xs: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list3.ListItemIcon, { sx: { minWidth: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, {}) }) }),
1107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout5.Grid, { size: { xs: 4 }, sx: { minWidth: "8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list3.ListItemText, { sx: { wordBreak: "break-all" }, children: upload.trimFileName(upload.file.name) }) }),
1108
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout5.Grid, { size: { xs: 2 }, sx: { minWidth: "3rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list3.ListItemText, { sx: { textAlign: "end" }, children: formatBytes(upload.file.size) }) }),
1109
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout5.Grid, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(UploadProgressBar, { upload }) })
989
+ /* @__PURE__ */ jsxs9(Grid2, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
990
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: "auto" }, children: /* @__PURE__ */ jsx11(ListItemIcon, { sx: { minWidth: "1.5rem" }, children: /* @__PURE__ */ jsx11(Icon, {}) }) }),
991
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: 4 }, sx: { minWidth: "8rem" }, children: /* @__PURE__ */ jsx11(ListItemText2, { sx: { wordBreak: "break-all" }, children: upload.trimFileName(upload.file.name) }) }),
992
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: 2 }, sx: { minWidth: "3rem" }, children: /* @__PURE__ */ jsx11(ListItemText2, { sx: { textAlign: "end" }, children: formatBytes(upload.file.size) }) }),
993
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ jsx11(UploadProgressBar, { upload }) })
1110
994
  ] }),
1111
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_divider3.Divider, {})
995
+ /* @__PURE__ */ jsx11(Divider3, {})
1112
996
  ]
1113
997
  }
1114
998
  );
@@ -1122,29 +1006,27 @@ var FileList = ({
1122
1006
  disableRemove
1123
1007
  }) => {
1124
1008
  if (files.length === 0) return null;
1125
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list3.List, { children: files.map((file) => {
1126
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1127
- FileRow,
1128
- {
1129
- file,
1130
- options,
1131
- onRemoveFile,
1132
- queryOptions,
1133
- customFileRow,
1134
- disableRemove
1135
- },
1136
- file.name
1137
- );
1138
- }) });
1009
+ return /* @__PURE__ */ jsx11(List2, { children: files.map((file) => /* @__PURE__ */ jsx11(
1010
+ FileRow,
1011
+ {
1012
+ file,
1013
+ options,
1014
+ onRemoveFile,
1015
+ queryOptions,
1016
+ customFileRow,
1017
+ disableRemove
1018
+ },
1019
+ file.name
1020
+ )) });
1139
1021
  };
1140
1022
 
1141
1023
  // src/lib/FileList2.tsx
1142
- var import_mui_list4 = require("@availity/mui-list");
1143
- var import_mui_button5 = require("@availity/mui-button");
1144
- var import_mui_icon7 = require("@availity/mui-icon");
1145
- var import_mui_layout6 = require("@availity/mui-layout");
1146
- var import_mui_divider4 = require("@availity/mui-divider");
1147
- var import_jsx_runtime12 = require("react/jsx-runtime");
1024
+ import { List as List3, ListItem as ListItem3, ListItemText as ListItemText3, ListItemIcon as ListItemIcon2 } from "@availity/mui-list";
1025
+ import { IconButton as IconButton4 } from "@availity/mui-button";
1026
+ import { DeleteIcon as DeleteIcon2 } from "@availity/mui-icon";
1027
+ import { Grid as Grid3 } from "@availity/mui-layout";
1028
+ import { Divider as Divider4 } from "@availity/mui-divider";
1029
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1148
1030
  var FileRow2 = ({
1149
1031
  upload,
1150
1032
  options,
@@ -1154,30 +1036,30 @@ var FileRow2 = ({
1154
1036
  }) => {
1155
1037
  const Icon = getFileExtIcon(upload.file.name);
1156
1038
  if (!upload) return null;
1157
- if (CustomRow) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CustomRow, { upload, options, onRemoveFile });
1158
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1159
- import_mui_list4.ListItem,
1039
+ if (CustomRow) return /* @__PURE__ */ jsx12(CustomRow, { upload, options, onRemoveFile });
1040
+ return /* @__PURE__ */ jsxs10(
1041
+ ListItem3,
1160
1042
  {
1161
1043
  disableGutters: true,
1162
- secondaryAction: !disableRemove && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1163
- import_mui_button5.IconButton,
1044
+ secondaryAction: !disableRemove && /* @__PURE__ */ jsx12(
1045
+ IconButton4,
1164
1046
  {
1165
1047
  title: "remove file",
1166
1048
  edge: "end",
1167
1049
  onClick: () => {
1168
1050
  onRemoveFile(upload.id, upload);
1169
1051
  },
1170
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_icon7.DeleteIcon, {})
1052
+ children: /* @__PURE__ */ jsx12(DeleteIcon2, {})
1171
1053
  }
1172
1054
  ),
1173
1055
  children: [
1174
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_mui_layout6.Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
1175
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_layout6.Grid, { size: { xs: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_list4.ListItemIcon, { sx: { minWidth: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, {}) }) }),
1176
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_layout6.Grid, { size: { xs: 4 }, sx: { minWidth: "8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_list4.ListItemText, { sx: { wordBreak: "break-all" }, children: upload.trimFileName(upload.file.name) }) }),
1177
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_layout6.Grid, { size: { xs: 2 }, sx: { minWidth: "3rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_list4.ListItemText, { sx: { textAlign: "end" }, children: formatBytes(upload.file.size) }) }),
1178
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_layout6.Grid, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UploadProgressBar, { upload }) })
1056
+ /* @__PURE__ */ jsxs10(Grid3, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
1057
+ /* @__PURE__ */ jsx12(Grid3, { size: { xs: "auto" }, children: /* @__PURE__ */ jsx12(ListItemIcon2, { sx: { minWidth: "1.5rem" }, children: /* @__PURE__ */ jsx12(Icon, {}) }) }),
1058
+ /* @__PURE__ */ jsx12(Grid3, { size: { xs: 4 }, sx: { minWidth: "8rem" }, children: /* @__PURE__ */ jsx12(ListItemText3, { sx: { wordBreak: "break-all" }, children: upload.trimFileName(upload.file.name) }) }),
1059
+ /* @__PURE__ */ jsx12(Grid3, { size: { xs: 2 }, sx: { minWidth: "3rem" }, children: /* @__PURE__ */ jsx12(ListItemText3, { sx: { textAlign: "end" }, children: formatBytes(upload.file.size) }) }),
1060
+ /* @__PURE__ */ jsx12(Grid3, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ jsx12(UploadProgressBar, { upload }) })
1179
1061
  ] }),
1180
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_divider4.Divider, {})
1062
+ /* @__PURE__ */ jsx12(Divider4, {})
1181
1063
  ]
1182
1064
  }
1183
1065
  );
@@ -1190,32 +1072,30 @@ var FileList2 = ({
1190
1072
  disableRemove
1191
1073
  }) => {
1192
1074
  if (uploads.length === 0) return null;
1193
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_mui_list4.List, { children: uploads.map((upload) => {
1194
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1195
- FileRow2,
1196
- {
1197
- upload,
1198
- options,
1199
- onRemoveFile,
1200
- customFileRow,
1201
- disableRemove
1202
- },
1203
- upload.id
1204
- );
1205
- }) });
1075
+ return /* @__PURE__ */ jsx12(List3, { children: uploads.map((upload) => /* @__PURE__ */ jsx12(
1076
+ FileRow2,
1077
+ {
1078
+ upload,
1079
+ options,
1080
+ onRemoveFile,
1081
+ customFileRow,
1082
+ disableRemove
1083
+ },
1084
+ upload.id
1085
+ )) });
1206
1086
  };
1207
1087
 
1208
1088
  // src/lib/FileSelector.tsx
1209
- var import_react5 = require("react");
1210
- var import_react_hook_form4 = require("react-hook-form");
1211
- var import_react_query2 = require("@tanstack/react-query");
1212
- var import_mui_layout7 = require("@availity/mui-layout");
1213
- var import_mui_typography6 = require("@availity/mui-typography");
1214
- var import_mui_alert3 = require("@availity/mui-alert");
1089
+ import { useState as useState3 } from "react";
1090
+ import { useFormContext as useFormContext3 } from "react-hook-form";
1091
+ import { useQueryClient } from "@tanstack/react-query";
1092
+ import { Grid as Grid4 } from "@availity/mui-layout";
1093
+ import { Typography as Typography6 } from "@availity/mui-typography";
1094
+ import { Alert as Alert2, AlertTitle as AlertTitle2 } from "@availity/mui-alert";
1215
1095
 
1216
1096
  // src/lib/FileTypesMessage.tsx
1217
- var import_mui_typography4 = require("@availity/mui-typography");
1218
- var import_jsx_runtime13 = require("react/jsx-runtime");
1097
+ import { Typography as Typography4 } from "@availity/mui-typography";
1098
+ import { jsxs as jsxs11 } from "react/jsx-runtime";
1219
1099
  var FileTypesMessage = ({
1220
1100
  allowedFileTypes = [],
1221
1101
  customSizeMessage,
@@ -1228,7 +1108,7 @@ var FileTypesMessage = ({
1228
1108
  const fileSizeMsg = customSizeMessage || (typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null);
1229
1109
  const totalFileSizeMsg = customTotalSizeMessage || (typeof maxTotalSize === "number" ? `Maximum total upload size is ${formatBytes(maxTotalSize)}. ` : null);
1230
1110
  const fileTypesMsg = customTypesMessage || (allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}` : "All file types allowed.");
1231
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_mui_typography4.Typography, { variant, children: [
1111
+ return /* @__PURE__ */ jsxs11(Typography4, { variant, children: [
1232
1112
  fileSizeMsg,
1233
1113
  totalFileSizeMsg,
1234
1114
  fileTypesMsg
@@ -1236,21 +1116,19 @@ var FileTypesMessage = ({
1236
1116
  };
1237
1117
 
1238
1118
  // src/lib/HeaderMessage.tsx
1239
- var import_mui_typography5 = require("@availity/mui-typography");
1240
- var import_jsx_runtime14 = require("react/jsx-runtime");
1241
- var HeaderMessage = ({ maxFiles, maxSize, maxTotalSize }) => {
1242
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_mui_typography5.Typography, { variant: "h6", children: [
1243
- "Attach up to ",
1244
- maxFiles,
1245
- " file(s), with a maximum individual size of ",
1246
- formatBytes(maxSize),
1247
- " ",
1248
- maxTotalSize && `and a maximum total size of ${formatBytes(maxTotalSize)}`
1249
- ] });
1250
- };
1119
+ import { Typography as Typography5 } from "@availity/mui-typography";
1120
+ import { jsxs as jsxs12 } from "react/jsx-runtime";
1121
+ var HeaderMessage = ({ maxFiles, maxSize, maxTotalSize }) => /* @__PURE__ */ jsxs12(Typography5, { variant: "h6", children: [
1122
+ "Attach up to ",
1123
+ maxFiles,
1124
+ " file(s), with a maximum individual size of ",
1125
+ formatBytes(maxSize),
1126
+ " ",
1127
+ maxTotalSize && `and a maximum total size of ${formatBytes(maxTotalSize)}`
1128
+ ] });
1251
1129
 
1252
1130
  // src/lib/FileSelector.tsx
1253
- var import_jsx_runtime15 = require("react/jsx-runtime");
1131
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1254
1132
  var CLOUD_URL = "/cloud/web/appl/vault/upload/v1/resumable";
1255
1133
  var FileSelector = ({
1256
1134
  name,
@@ -1281,18 +1159,19 @@ var FileSelector = ({
1281
1159
  validator,
1282
1160
  disableRemove
1283
1161
  }) => {
1284
- const [totalSize, setTotalSize] = (0, import_react5.useState)(0);
1285
- const [fileRejections, setFileRejections] = (0, import_react5.useState)([]);
1286
- const client = (0, import_react_query2.useQueryClient)();
1287
- const formMethods = (0, import_react_hook_form4.useFormContext)();
1288
- const options = __spreadProps(__spreadValues({}, uploadOptions), {
1162
+ const [totalSize, setTotalSize] = useState3(0);
1163
+ const [fileRejections, setFileRejections] = useState3([]);
1164
+ const client = useQueryClient();
1165
+ const formMethods = useFormContext3();
1166
+ const options = {
1167
+ ...uploadOptions,
1289
1168
  bucketId,
1290
1169
  customerId,
1291
1170
  clientId,
1292
1171
  fileTypes: allowedFileTypes,
1293
1172
  maxSize,
1294
1173
  allowedFileNameCharacters
1295
- });
1174
+ };
1296
1175
  if (endpoint) options.endpoint = endpoint;
1297
1176
  else if (isCloud) options.endpoint = CLOUD_URL;
1298
1177
  const handleOnRemoveFile = (uploadId, upload) => {
@@ -1302,12 +1181,12 @@ var FileSelector = ({
1302
1181
  const removedFile = prevFiles.find((file) => file.name === upload.file.name);
1303
1182
  try {
1304
1183
  upload.abort();
1305
- } catch (e) {
1184
+ } catch {
1306
1185
  console.error("Encountered an issue stopping the file upload");
1307
1186
  }
1308
1187
  formMethods.setValue(name, newFiles);
1309
- client.removeQueries(["upload", upload.file.name]);
1310
- if (removedFile == null ? void 0 : removedFile.size) setTotalSize(totalSize - removedFile.size);
1188
+ client.removeQueries({ queryKey: ["upload", upload.file.name] });
1189
+ if (removedFile?.size) setTotalSize(totalSize - removedFile.size);
1311
1190
  if (onUploadRemove) onUploadRemove(newFiles, uploadId);
1312
1191
  }
1313
1192
  };
@@ -1323,10 +1202,10 @@ var FileSelector = ({
1323
1202
  const otherRejections = fileRejections.filter(
1324
1203
  (rejection) => !rejection.errors.some((error) => error.code === TOO_MANY_FILES_CODE)
1325
1204
  );
1326
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1327
- enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1328
- label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_mui_typography6.Typography, { marginBottom: "4px", children: label }) : null,
1329
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1205
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
1206
+ enableDropArea ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
1207
+ label ? /* @__PURE__ */ jsx13(Typography6, { marginBottom: "4px", children: label }) : null,
1208
+ /* @__PURE__ */ jsx13(
1330
1209
  Dropzone,
1331
1210
  {
1332
1211
  name,
@@ -1345,7 +1224,7 @@ var FileSelector = ({
1345
1224
  validator
1346
1225
  }
1347
1226
  ),
1348
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1227
+ /* @__PURE__ */ jsx13(
1349
1228
  FileTypesMessage,
1350
1229
  {
1351
1230
  allowedFileTypes,
@@ -1358,10 +1237,10 @@ var FileSelector = ({
1358
1237
  }
1359
1238
  ),
1360
1239
  children
1361
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_mui_layout7.Grid, { container: true, rowSpacing: 3, flexDirection: "column", children: [
1362
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_mui_layout7.Grid, { children: [
1363
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HeaderMessage, { maxFiles, maxSize, maxTotalSize }),
1364
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1240
+ ] }) : /* @__PURE__ */ jsxs13(Grid4, { container: true, rowSpacing: 3, flexDirection: "column", children: [
1241
+ /* @__PURE__ */ jsxs13(Grid4, { children: [
1242
+ /* @__PURE__ */ jsx13(HeaderMessage, { maxFiles, maxSize, maxTotalSize }),
1243
+ /* @__PURE__ */ jsx13(
1365
1244
  FileTypesMessage,
1366
1245
  {
1367
1246
  allowedFileTypes,
@@ -1372,8 +1251,8 @@ var FileSelector = ({
1372
1251
  }
1373
1252
  )
1374
1253
  ] }),
1375
- children ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_mui_layout7.Grid, { children }) : null,
1376
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_mui_layout7.Grid, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1254
+ children ? /* @__PURE__ */ jsx13(Grid4, { children }) : null,
1255
+ /* @__PURE__ */ jsx13(Grid4, { children: /* @__PURE__ */ jsx13(
1377
1256
  Dropzone,
1378
1257
  {
1379
1258
  name,
@@ -1393,20 +1272,22 @@ var FileSelector = ({
1393
1272
  }
1394
1273
  ) })
1395
1274
  ] }),
1396
- tooManyFilesRejections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1397
- import_mui_alert3.Alert,
1275
+ tooManyFilesRejections.length > 0 && /* @__PURE__ */ jsxs13(
1276
+ Alert2,
1398
1277
  {
1399
1278
  severity: "error",
1400
- onClose: () => tooManyFilesRejections.forEach((rejection) => handleRemoveRejection(rejection.id)),
1279
+ onClose: () => {
1280
+ for (const rejection of tooManyFilesRejections) handleRemoveRejection(rejection.id);
1281
+ },
1401
1282
  children: [
1402
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_mui_alert3.AlertTitle, { children: "Items not allowed." }),
1283
+ /* @__PURE__ */ jsx13(AlertTitle2, { children: "Items not allowed." }),
1403
1284
  "Too many files are selected for upload, maximum ",
1404
1285
  maxFiles,
1405
1286
  " allowed."
1406
1287
  ]
1407
1288
  }
1408
1289
  ),
1409
- otherRejections.length > 0 && otherRejections.map((rejection) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1290
+ otherRejections.length > 0 && otherRejections.map((rejection) => /* @__PURE__ */ jsx13(
1410
1291
  ErrorAlert,
1411
1292
  {
1412
1293
  errors: rejection.errors,
@@ -1416,7 +1297,7 @@ var FileSelector = ({
1416
1297
  },
1417
1298
  rejection.id
1418
1299
  )),
1419
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1300
+ /* @__PURE__ */ jsx13(
1420
1301
  FileList,
1421
1302
  {
1422
1303
  files: files || [],
@@ -1431,12 +1312,12 @@ var FileSelector = ({
1431
1312
  };
1432
1313
 
1433
1314
  // src/lib/FileSelector2.tsx
1434
- var import_react6 = require("react");
1435
- var import_react_hook_form5 = require("react-hook-form");
1436
- var import_mui_layout8 = require("@availity/mui-layout");
1437
- var import_mui_typography7 = require("@availity/mui-typography");
1438
- var import_mui_alert4 = require("@availity/mui-alert");
1439
- var import_jsx_runtime16 = require("react/jsx-runtime");
1315
+ import { useState as useState4 } from "react";
1316
+ import { useFormContext as useFormContext4 } from "react-hook-form";
1317
+ import { Grid as Grid5 } from "@availity/mui-layout";
1318
+ import { Typography as Typography7 } from "@availity/mui-typography";
1319
+ import { Alert as Alert3, AlertTitle as AlertTitle3 } from "@availity/mui-alert";
1320
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
1440
1321
  var FileSelector2 = ({
1441
1322
  name,
1442
1323
  allowedFileNameCharacters,
@@ -1465,17 +1346,18 @@ var FileSelector2 = ({
1465
1346
  validator,
1466
1347
  disableRemove
1467
1348
  }) => {
1468
- const [totalSize, setTotalSize] = (0, import_react6.useState)(0);
1469
- const [fileRejections, setFileRejections] = (0, import_react6.useState)([]);
1470
- const formMethods = (0, import_react_hook_form5.useFormContext)();
1471
- const options = __spreadProps(__spreadValues({}, uploadOptions), {
1349
+ const [totalSize, setTotalSize] = useState4(0);
1350
+ const [fileRejections, setFileRejections] = useState4([]);
1351
+ const formMethods = useFormContext4();
1352
+ const options = {
1353
+ ...uploadOptions,
1472
1354
  bucketId,
1473
1355
  customerId,
1474
1356
  clientId,
1475
1357
  fileTypes: allowedFileTypes,
1476
1358
  maxSize,
1477
1359
  allowedFileNameCharacters
1478
- });
1360
+ };
1479
1361
  if (endpoint) options.endpoint = endpoint;
1480
1362
  else if (isCloud) options.endpoint = CLOUD_URL;
1481
1363
  const handleOnRemoveFile = (uploadId, upload) => {
@@ -1485,11 +1367,11 @@ var FileSelector2 = ({
1485
1367
  const removedFile = prevFiles.find((prev) => prev.file.name === upload.file.name);
1486
1368
  try {
1487
1369
  upload.abort();
1488
- } catch (e) {
1370
+ } catch {
1489
1371
  console.error("Encountered an issue stopping the file upload");
1490
1372
  }
1491
1373
  formMethods.setValue(name, newFiles);
1492
- if (removedFile == null ? void 0 : removedFile.file.size) setTotalSize(totalSize - removedFile.file.size);
1374
+ if (removedFile?.file.size) setTotalSize(totalSize - removedFile.file.size);
1493
1375
  if (onUploadRemove) onUploadRemove(newFiles, uploadId);
1494
1376
  }
1495
1377
  };
@@ -1505,10 +1387,10 @@ var FileSelector2 = ({
1505
1387
  const otherRejections = fileRejections.filter(
1506
1388
  (rejection) => !rejection.errors.some((error) => error.code === TOO_MANY_FILES_CODE)
1507
1389
  );
1508
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1509
- enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1510
- label ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_mui_typography7.Typography, { marginBottom: "4px", children: label }) : null,
1511
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1390
+ return /* @__PURE__ */ jsxs14(Fragment7, { children: [
1391
+ enableDropArea ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
1392
+ label ? /* @__PURE__ */ jsx14(Typography7, { marginBottom: "4px", children: label }) : null,
1393
+ /* @__PURE__ */ jsx14(
1512
1394
  Dropzone2,
1513
1395
  {
1514
1396
  name,
@@ -1527,7 +1409,7 @@ var FileSelector2 = ({
1527
1409
  validator
1528
1410
  }
1529
1411
  ),
1530
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1412
+ /* @__PURE__ */ jsx14(
1531
1413
  FileTypesMessage,
1532
1414
  {
1533
1415
  allowedFileTypes,
@@ -1540,10 +1422,10 @@ var FileSelector2 = ({
1540
1422
  }
1541
1423
  ),
1542
1424
  children
1543
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_mui_layout8.Grid, { container: true, rowSpacing: 3, flexDirection: "column", children: [
1544
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_mui_layout8.Grid, { children: [
1545
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HeaderMessage, { maxFiles, maxSize, maxTotalSize }),
1546
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1425
+ ] }) : /* @__PURE__ */ jsxs14(Grid5, { container: true, rowSpacing: 3, flexDirection: "column", children: [
1426
+ /* @__PURE__ */ jsxs14(Grid5, { children: [
1427
+ /* @__PURE__ */ jsx14(HeaderMessage, { maxFiles, maxSize, maxTotalSize }),
1428
+ /* @__PURE__ */ jsx14(
1547
1429
  FileTypesMessage,
1548
1430
  {
1549
1431
  allowedFileTypes,
@@ -1554,8 +1436,8 @@ var FileSelector2 = ({
1554
1436
  }
1555
1437
  )
1556
1438
  ] }),
1557
- children ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_mui_layout8.Grid, { children }) : null,
1558
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_mui_layout8.Grid, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1439
+ children ? /* @__PURE__ */ jsx14(Grid5, { children }) : null,
1440
+ /* @__PURE__ */ jsx14(Grid5, { children: /* @__PURE__ */ jsx14(
1559
1441
  Dropzone2,
1560
1442
  {
1561
1443
  name,
@@ -1575,20 +1457,22 @@ var FileSelector2 = ({
1575
1457
  }
1576
1458
  ) })
1577
1459
  ] }),
1578
- tooManyFilesRejections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1579
- import_mui_alert4.Alert,
1460
+ tooManyFilesRejections.length > 0 && /* @__PURE__ */ jsxs14(
1461
+ Alert3,
1580
1462
  {
1581
1463
  severity: "error",
1582
- onClose: () => tooManyFilesRejections.forEach((rejection) => handleRemoveRejection(rejection.id)),
1464
+ onClose: () => {
1465
+ for (const rejection of tooManyFilesRejections) handleRemoveRejection(rejection.id);
1466
+ },
1583
1467
  children: [
1584
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_mui_alert4.AlertTitle, { children: "Items not allowed." }),
1468
+ /* @__PURE__ */ jsx14(AlertTitle3, { children: "Items not allowed." }),
1585
1469
  "Too many files are selected for upload, maximum ",
1586
1470
  maxFiles,
1587
1471
  " allowed."
1588
1472
  ]
1589
1473
  }
1590
1474
  ),
1591
- otherRejections.length > 0 && otherRejections.map((rejection) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1475
+ otherRejections.length > 0 && otherRejections.map((rejection) => /* @__PURE__ */ jsx14(
1592
1476
  ErrorAlert,
1593
1477
  {
1594
1478
  errors: rejection.errors,
@@ -1598,7 +1482,7 @@ var FileSelector2 = ({
1598
1482
  },
1599
1483
  rejection.id
1600
1484
  )),
1601
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1485
+ /* @__PURE__ */ jsx14(
1602
1486
  FileList2,
1603
1487
  {
1604
1488
  uploads: uploads || [],
@@ -1610,8 +1494,7 @@ var FileSelector2 = ({
1610
1494
  )
1611
1495
  ] });
1612
1496
  };
1613
- // Annotate the CommonJS export names for ESM import in node:
1614
- 0 && (module.exports = {
1497
+ export {
1615
1498
  CLOUD_URL,
1616
1499
  Dropzone,
1617
1500
  Dropzone2,
@@ -1632,4 +1515,4 @@ var FileSelector2 = ({
1632
1515
  innerBoxStyles,
1633
1516
  outerBoxStyles,
1634
1517
  useUploadCore
1635
- });
1518
+ };