@availity/mui-file-selector 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.3.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.3.0...@availity/mui-file-selector@1.3.1) (2025-03-27)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-dialog` updated to version `1.3.0`
10
+ * `mui-textfield` updated to version `1.3.0`
11
+ ## [1.3.0](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.2.1...@availity/mui-file-selector@1.3.0) (2025-03-24)
12
+
13
+
14
+ ### Features
15
+
16
+ * **mui-file-selector:** error alert and file list style updates ([341f5c9](https://github.com/Availity/element/commit/341f5c90cab723f786908f88e72963a4e588f1ac))
17
+
5
18
  ## [1.2.1](https://github.com/Availity/element/compare/@availity/mui-file-selector@1.2.0...@availity/mui-file-selector@1.2.1) (2025-03-21)
6
19
 
7
20
  ### Dependency Updates
package/dist/index.js CHANGED
@@ -323,6 +323,7 @@ var Dropzone = ({
323
323
 
324
324
  // src/lib/ErrorAlert.tsx
325
325
  var import_mui_alert = require("@availity/mui-alert");
326
+ var import_mui_list = require("@availity/mui-list");
326
327
  var import_jsx_runtime3 = require("react/jsx-runtime");
327
328
  var codes = {
328
329
  "file-too-large": "File exceeds maximum size",
@@ -333,20 +334,35 @@ var codes = {
333
334
  };
334
335
  var ErrorAlert = ({ errors, fileName, id, onClose }) => {
335
336
  if (errors.length === 0) return null;
336
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: errors.map((error) => {
337
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_mui_alert.Alert, { severity: "error", onClose, children: [
338
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_mui_alert.AlertTitle, { children: [
339
- codes[error.code] || "Error",
340
- ": ",
341
- fileName
342
- ] }),
343
- error.message
344
- ] }, `${id}-${error.code}`);
345
- }) });
337
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_alert.Alert, { severity: "error", onClose, children: errors.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_mui_alert.AlertTitle, { children: [
339
+ "There were ",
340
+ errors.length,
341
+ " error(s) found when uploading ",
342
+ fileName
343
+ ] }),
344
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_list.List, { sx: {
345
+ listStyleType: "disc",
346
+ listStylePosition: "inside",
347
+ marginLeft: 1,
348
+ ".MuiListItem-root": {
349
+ display: "list-item"
350
+ }
351
+ }, disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: errors.map((error) => {
352
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_list.ListItem, { disableGutters: true, disablePadding: true, divider: false, children: error.message }, `${id}-${error.code}`);
353
+ }) }) })
354
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
355
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_mui_alert.AlertTitle, { children: [
356
+ codes[errors[0].code] || "Error",
357
+ ": ",
358
+ fileName
359
+ ] }),
360
+ errors[0].message
361
+ ] }) });
346
362
  };
347
363
 
348
364
  // src/lib/FileList.tsx
349
- var import_mui_list2 = require("@availity/mui-list");
365
+ var import_mui_list3 = require("@availity/mui-list");
350
366
  var import_mui_button4 = require("@availity/mui-button");
351
367
  var import_mui_icon5 = require("@availity/mui-icon");
352
368
  var import_mui_layout4 = require("@availity/mui-layout");
@@ -430,7 +446,7 @@ var DialogTitle = (_a) => {
430
446
  var import_mui_form_utils3 = require("@availity/mui-form-utils");
431
447
  var import_mui_icon3 = require("@availity/mui-icon");
432
448
  var import_mui_layout3 = require("@availity/mui-layout");
433
- var import_mui_list = require("@availity/mui-list");
449
+ var import_mui_list2 = require("@availity/mui-list");
434
450
  var import_mui_progress = require("@availity/mui-progress");
435
451
 
436
452
  // ../textfield/src/lib/TextField.tsx
@@ -438,6 +454,7 @@ var import_react2 = require("react");
438
454
  var import_TextField = __toESM(require("@mui/material/TextField"));
439
455
  var import_mui_form_utils2 = require("@availity/mui-form-utils");
440
456
  var import_mui_layout2 = require("@availity/mui-layout");
457
+ var import_mui_typography2 = require("@availity/mui-typography");
441
458
  var import_styles4 = require("@mui/material/styles");
442
459
  var import_jsx_runtime9 = require("react/jsx-runtime");
443
460
  var SelectPlaceholder = (0, import_styles4.styled)("span", {
@@ -445,6 +462,24 @@ var SelectPlaceholder = (0, import_styles4.styled)("span", {
445
462
  slot: "SelectPlaceholder",
446
463
  overridesResolver: (props, styles) => styles.avFilled
447
464
  })(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
465
+ var TextFieldFormHelperText = ({
466
+ charCount,
467
+ helperText,
468
+ maxLength,
469
+ showCharacterCount
470
+ }) => {
471
+ if (showCharacterCount) {
472
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_layout2.Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
473
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, { sx: { marginRight: "12px" }, children: helperText }),
474
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_typography2.Typography, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
475
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_typography2.Typography, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
476
+ "/",
477
+ maxLength
478
+ ] })
479
+ ] });
480
+ }
481
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.FormHelperText, { children: helperText });
482
+ };
448
483
  var TextField = (0, import_react2.forwardRef)((props, ref) => {
449
484
  var _b, _c, _d, _e, _f, _g, _h;
450
485
  const _a = props, {
@@ -456,7 +491,8 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
456
491
  SelectProps: SelectProps2,
457
492
  inputProps,
458
493
  helperText,
459
- showCharacterCount = false
494
+ showCharacterCount = false,
495
+ displayOverflowMaxLength = false
460
496
  } = _a, rest = __objRest(_a, [
461
497
  "InputProps",
462
498
  "helpTopicId",
@@ -466,10 +502,12 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
466
502
  "SelectProps",
467
503
  "inputProps",
468
504
  "helperText",
469
- "showCharacterCount"
505
+ "showCharacterCount",
506
+ "displayOverflowMaxLength"
470
507
  ]);
471
508
  const [openDetected, setOpenDetected] = (0, import_react2.useState)(false);
472
509
  const [charCount, setCharCount] = (0, import_react2.useState)(0);
510
+ const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
473
511
  const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
474
512
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
475
513
  import_TextField.default,
@@ -478,19 +516,15 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
478
516
  setCharCount(event.target.value.length);
479
517
  if (rest.onChange) rest.onChange(event);
480
518
  },
481
- helperText: showCharacterCount ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_mui_layout2.Grid, { container: true, justifyContent: "space-between", children: [
482
- helperText,
483
- " ",
484
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { style: { marginLeft: 4 }, children: [
485
- charCount || 0,
486
- "/",
487
- (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength)
488
- ] })
489
- ] }) : helperText,
490
- slots: { formHelperText: import_mui_form_utils2.FormHelperText },
519
+ helperText: helperText || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
520
+ slots: { formHelperText: TextFieldFormHelperText },
491
521
  slotProps: {
492
522
  input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils2.InputPropOverrides), (_d = rest.slotProps) == null ? void 0 : _d.input)),
493
- htmlInput: resolvedProps(__spreadValues(__spreadValues({ "aria-required": required }, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput)),
523
+ htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
524
+ "aria-required": required
525
+ }, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
526
+ maxLength: !displayOverflowMaxLength ? maxLength : void 0
527
+ })),
494
528
  select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
495
529
  displayEmpty: !!rest.placeholder,
496
530
  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
@@ -501,7 +535,15 @@ var TextField = (0, import_react2.forwardRef)((props, ref) => {
501
535
  required,
502
536
  shrink: true
503
537
  }, InputLabelProps), (_g = rest.slotProps) == null ? void 0 : _g.inputLabel)),
504
- formHelperText: resolvedProps(__spreadValues(__spreadValues({ component: "div" }, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText))
538
+ formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
539
+ component: "div"
540
+ }, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText), {
541
+ charCount,
542
+ helperText,
543
+ maxLength,
544
+ displayOverflowMaxLength,
545
+ showCharacterCount
546
+ }))
505
547
  },
506
548
  ref
507
549
  })
@@ -547,7 +589,7 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
547
589
  upload.onSuccess.push(handleOnSuccess);
548
590
  upload.onError.push(handleOnError);
549
591
  return errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_layout3.Box, { sx: { display: "flex", flexWrap: "wrap", columnGap: "4px" }, children: [
550
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_list.ListItemText, { slotProps: { primary: { color: "text.error", variant: "body2", component: "div" } }, children: [
592
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_list2.ListItemText, { slotProps: { primary: { color: "text.error", variant: "body2", component: "div" } }, sx: { wordWrap: "break-word" }, children: [
551
593
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_icon3.WarningTriangleIcon, { sx: { verticalAlign: "middle", mt: "-2px" } }),
552
594
  " ",
553
595
  errorMessage
@@ -653,7 +695,7 @@ var FileRow = ({
653
695
  if (CustomRow) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CustomRow, { upload, options, onRemoveFile });
654
696
  if (!upload) return null;
655
697
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
656
- import_mui_list2.ListItem,
698
+ import_mui_list3.ListItem,
657
699
  {
658
700
  disableGutters: true,
659
701
  secondaryAction: !disableRemove && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -668,11 +710,11 @@ var FileRow = ({
668
710
  }
669
711
  ),
670
712
  children: [
671
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_mui_layout4.Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", children: [
672
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.Grid, { size: { xs: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list2.ListItemIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, {}) }) }),
673
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.Grid, { size: { xs: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list2.ListItemText, { children: upload.trimFileName(upload.file.name) }) }),
674
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.Grid, { size: { xs: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list2.ListItemText, { children: formatBytes(upload.file.size) }) }),
675
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.Grid, { size: { xs: 6 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(UploadProgressBar, { upload }) })
713
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_mui_layout4.Grid, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
714
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.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, {}) }) }),
715
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.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) }) }),
716
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.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) }) }),
717
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_layout4.Grid, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(UploadProgressBar, { upload }) })
676
718
  ] }),
677
719
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_divider2.Divider, {})
678
720
  ]
@@ -688,7 +730,7 @@ var FileList = ({
688
730
  disableRemove
689
731
  }) => {
690
732
  if (files.length === 0) return null;
691
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list2.List, { children: files.map((file) => {
733
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_mui_list3.List, { children: files.map((file) => {
692
734
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
693
735
  FileRow,
694
736
  {
@@ -709,10 +751,10 @@ var import_react4 = require("react");
709
751
  var import_react_hook_form3 = require("react-hook-form");
710
752
  var import_react_query2 = require("@tanstack/react-query");
711
753
  var import_mui_layout5 = require("@availity/mui-layout");
712
- var import_mui_typography4 = require("@availity/mui-typography");
754
+ var import_mui_typography5 = require("@availity/mui-typography");
713
755
 
714
756
  // src/lib/FileTypesMessage.tsx
715
- var import_mui_typography2 = require("@availity/mui-typography");
757
+ var import_mui_typography3 = require("@availity/mui-typography");
716
758
  var import_jsx_runtime12 = require("react/jsx-runtime");
717
759
  var FileTypesMessage = ({
718
760
  allowedFileTypes = [],
@@ -721,17 +763,17 @@ var FileTypesMessage = ({
721
763
  }) => {
722
764
  const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
723
765
  const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}` : "All file types allowed.";
724
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_mui_typography2.Typography, { variant, children: [
766
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_mui_typography3.Typography, { variant, children: [
725
767
  fileSizeMsg,
726
768
  fileTypesMsg
727
769
  ] });
728
770
  };
729
771
 
730
772
  // src/lib/HeaderMessage.tsx
731
- var import_mui_typography3 = require("@availity/mui-typography");
773
+ var import_mui_typography4 = require("@availity/mui-typography");
732
774
  var import_jsx_runtime13 = require("react/jsx-runtime");
733
775
  var HeaderMessage = ({ maxFiles, maxSize }) => {
734
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_mui_typography3.Typography, { variant: "h6", children: [
776
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_mui_typography4.Typography, { variant: "h6", children: [
735
777
  "Attach up to ",
736
778
  maxFiles,
737
779
  " file(s), with a maximum individual size of ",
@@ -804,7 +846,7 @@ var FileSelector = ({
804
846
  };
805
847
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
806
848
  enableDropArea ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
807
- label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_mui_typography4.Typography, { marginBottom: "4px", children: label }) : null,
849
+ label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_mui_typography5.Typography, { marginBottom: "4px", children: label }) : null,
808
850
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
809
851
  Dropzone,
810
852
  {
package/dist/index.mjs CHANGED
@@ -281,6 +281,7 @@ var Dropzone = ({
281
281
 
282
282
  // src/lib/ErrorAlert.tsx
283
283
  import { Alert, AlertTitle } from "@availity/mui-alert";
284
+ import { List, ListItem } from "@availity/mui-list";
284
285
  import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
285
286
  var codes = {
286
287
  "file-too-large": "File exceeds maximum size",
@@ -291,20 +292,35 @@ var codes = {
291
292
  };
292
293
  var ErrorAlert = ({ errors, fileName, id, onClose }) => {
293
294
  if (errors.length === 0) return null;
294
- return /* @__PURE__ */ jsx3(Fragment3, { children: errors.map((error) => {
295
- return /* @__PURE__ */ jsxs3(Alert, { severity: "error", onClose, children: [
296
- /* @__PURE__ */ jsxs3(AlertTitle, { children: [
297
- codes[error.code] || "Error",
298
- ": ",
299
- fileName
300
- ] }),
301
- error.message
302
- ] }, `${id}-${error.code}`);
303
- }) });
295
+ return /* @__PURE__ */ jsx3(Alert, { severity: "error", onClose, children: errors.length > 1 ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
296
+ /* @__PURE__ */ jsxs3(AlertTitle, { children: [
297
+ "There were ",
298
+ errors.length,
299
+ " error(s) found when uploading ",
300
+ fileName
301
+ ] }),
302
+ /* @__PURE__ */ jsx3(List, { sx: {
303
+ listStyleType: "disc",
304
+ listStylePosition: "inside",
305
+ marginLeft: 1,
306
+ ".MuiListItem-root": {
307
+ display: "list-item"
308
+ }
309
+ }, disablePadding: true, children: /* @__PURE__ */ jsx3(Fragment3, { children: errors.map((error) => {
310
+ return /* @__PURE__ */ jsx3(ListItem, { disableGutters: true, disablePadding: true, divider: false, children: error.message }, `${id}-${error.code}`);
311
+ }) }) })
312
+ ] }) : /* @__PURE__ */ jsxs3(Fragment3, { children: [
313
+ /* @__PURE__ */ jsxs3(AlertTitle, { children: [
314
+ codes[errors[0].code] || "Error",
315
+ ": ",
316
+ fileName
317
+ ] }),
318
+ errors[0].message
319
+ ] }) });
304
320
  };
305
321
 
306
322
  // src/lib/FileList.tsx
307
- import { List, ListItem, ListItemText as ListItemText2, ListItemIcon } from "@availity/mui-list";
323
+ import { List as List2, ListItem as ListItem2, ListItemText as ListItemText2, ListItemIcon } from "@availity/mui-list";
308
324
  import { IconButton as IconButton3 } from "@availity/mui-button";
309
325
  import { DeleteIcon } from "@availity/mui-icon";
310
326
  import { Grid as Grid2 } from "@availity/mui-layout";
@@ -402,13 +418,32 @@ import {
402
418
  SelectPropOverrides
403
419
  } from "@availity/mui-form-utils";
404
420
  import { Grid } from "@availity/mui-layout";
421
+ import { Typography as Typography2 } from "@availity/mui-typography";
405
422
  import { styled as styled4 } from "@mui/material/styles";
406
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
423
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
407
424
  var SelectPlaceholder = styled4("span", {
408
425
  name: "MuiTextField",
409
426
  slot: "SelectPlaceholder",
410
427
  overridesResolver: (props, styles) => styles.avFilled
411
428
  })(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
429
+ var TextFieldFormHelperText = ({
430
+ charCount,
431
+ helperText,
432
+ maxLength,
433
+ showCharacterCount
434
+ }) => {
435
+ if (showCharacterCount) {
436
+ return /* @__PURE__ */ jsxs6(Grid, { container: true, justifyContent: "space-between", flexWrap: "nowrap", children: [
437
+ /* @__PURE__ */ jsx9(FormHelperText, { sx: { marginRight: "12px" }, children: helperText }),
438
+ /* @__PURE__ */ jsxs6(Typography2, { variant: "caption", marginTop: "4px", lineHeight: "1.25rem", children: [
439
+ /* @__PURE__ */ jsx9(Typography2, { component: "span", variant: "inherit", color: charCount > maxLength ? "error" : "textPrimary", children: charCount || 0 }),
440
+ "/",
441
+ maxLength
442
+ ] })
443
+ ] });
444
+ }
445
+ return /* @__PURE__ */ jsx9(FormHelperText, { children: helperText });
446
+ };
412
447
  var TextField = forwardRef((props, ref) => {
413
448
  var _b, _c, _d, _e, _f, _g, _h;
414
449
  const _a = props, {
@@ -420,7 +455,8 @@ var TextField = forwardRef((props, ref) => {
420
455
  SelectProps: SelectProps2,
421
456
  inputProps,
422
457
  helperText,
423
- showCharacterCount = false
458
+ showCharacterCount = false,
459
+ displayOverflowMaxLength = false
424
460
  } = _a, rest = __objRest(_a, [
425
461
  "InputProps",
426
462
  "helpTopicId",
@@ -430,10 +466,12 @@ var TextField = forwardRef((props, ref) => {
430
466
  "SelectProps",
431
467
  "inputProps",
432
468
  "helperText",
433
- "showCharacterCount"
469
+ "showCharacterCount",
470
+ "displayOverflowMaxLength"
434
471
  ]);
435
472
  const [openDetected, setOpenDetected] = useState(false);
436
473
  const [charCount, setCharCount] = useState(0);
474
+ const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
437
475
  const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
438
476
  return /* @__PURE__ */ jsx9(
439
477
  MuiTextField,
@@ -442,19 +480,15 @@ var TextField = forwardRef((props, ref) => {
442
480
  setCharCount(event.target.value.length);
443
481
  if (rest.onChange) rest.onChange(event);
444
482
  },
445
- helperText: showCharacterCount ? /* @__PURE__ */ jsxs6(Grid, { container: true, justifyContent: "space-between", children: [
446
- helperText,
447
- " ",
448
- /* @__PURE__ */ jsxs6("span", { style: { marginLeft: 4 }, children: [
449
- charCount || 0,
450
- "/",
451
- (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength)
452
- ] })
453
- ] }) : helperText,
454
- slots: { formHelperText: FormHelperText },
483
+ helperText: helperText || /* @__PURE__ */ jsx9(Fragment4, {}),
484
+ slots: { formHelperText: TextFieldFormHelperText },
455
485
  slotProps: {
456
486
  input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), InputPropOverrides), (_d = rest.slotProps) == null ? void 0 : _d.input)),
457
- htmlInput: resolvedProps(__spreadValues(__spreadValues({ "aria-required": required }, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput)),
487
+ htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
488
+ "aria-required": required
489
+ }, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
490
+ maxLength: !displayOverflowMaxLength ? maxLength : void 0
491
+ })),
458
492
  select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
459
493
  displayEmpty: !!rest.placeholder,
460
494
  renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ jsx9(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
@@ -465,7 +499,15 @@ var TextField = forwardRef((props, ref) => {
465
499
  required,
466
500
  shrink: true
467
501
  }, InputLabelProps), (_g = rest.slotProps) == null ? void 0 : _g.inputLabel)),
468
- formHelperText: resolvedProps(__spreadValues(__spreadValues({ component: "div" }, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText))
502
+ formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
503
+ component: "div"
504
+ }, FormHelperTextProps2), (_h = rest.slotProps) == null ? void 0 : _h.formHelperText), {
505
+ charCount,
506
+ helperText,
507
+ maxLength,
508
+ displayOverflowMaxLength,
509
+ showCharacterCount
510
+ }))
469
511
  },
470
512
  ref
471
513
  })
@@ -511,7 +553,7 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
511
553
  upload.onSuccess.push(handleOnSuccess);
512
554
  upload.onError.push(handleOnError);
513
555
  return errorMessage ? /* @__PURE__ */ jsxs7(Box2, { sx: { display: "flex", flexWrap: "wrap", columnGap: "4px" }, children: [
514
- /* @__PURE__ */ jsxs7(ListItemText, { slotProps: { primary: { color: "text.error", variant: "body2", component: "div" } }, children: [
556
+ /* @__PURE__ */ jsxs7(ListItemText, { slotProps: { primary: { color: "text.error", variant: "body2", component: "div" } }, sx: { wordWrap: "break-word" }, children: [
515
557
  /* @__PURE__ */ jsx10(WarningTriangleIcon, { sx: { verticalAlign: "middle", mt: "-2px" } }),
516
558
  " ",
517
559
  errorMessage
@@ -628,7 +670,7 @@ var FileRow = ({
628
670
  if (CustomRow) return /* @__PURE__ */ jsx11(CustomRow, { upload, options, onRemoveFile });
629
671
  if (!upload) return null;
630
672
  return /* @__PURE__ */ jsxs8(
631
- ListItem,
673
+ ListItem2,
632
674
  {
633
675
  disableGutters: true,
634
676
  secondaryAction: !disableRemove && /* @__PURE__ */ jsx11(
@@ -643,11 +685,11 @@ var FileRow = ({
643
685
  }
644
686
  ),
645
687
  children: [
646
- /* @__PURE__ */ jsxs8(Grid2, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", children: [
647
- /* @__PURE__ */ jsx11(Grid2, { size: { xs: 1 }, children: /* @__PURE__ */ jsx11(ListItemIcon, { children: /* @__PURE__ */ jsx11(Icon, {}) }) }),
648
- /* @__PURE__ */ jsx11(Grid2, { size: { xs: 3 }, children: /* @__PURE__ */ jsx11(ListItemText2, { children: upload.trimFileName(upload.file.name) }) }),
649
- /* @__PURE__ */ jsx11(Grid2, { size: { xs: 2 }, children: /* @__PURE__ */ jsx11(ListItemText2, { children: formatBytes(upload.file.size) }) }),
650
- /* @__PURE__ */ jsx11(Grid2, { size: { xs: 6 }, children: /* @__PURE__ */ jsx11(UploadProgressBar, { upload }) })
688
+ /* @__PURE__ */ jsxs8(Grid2, { container: true, spacing: 2, alignItems: "center", justifyContent: "space-between", width: "100%", flexWrap: "wrap", children: [
689
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: "auto" }, children: /* @__PURE__ */ jsx11(ListItemIcon, { sx: { minWidth: "1.5rem" }, children: /* @__PURE__ */ jsx11(Icon, {}) }) }),
690
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: 4 }, sx: { minWidth: "8rem" }, children: /* @__PURE__ */ jsx11(ListItemText2, { sx: { wordBreak: "break-all" }, children: upload.trimFileName(upload.file.name) }) }),
691
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: 2 }, sx: { minWidth: "3rem" }, children: /* @__PURE__ */ jsx11(ListItemText2, { sx: { textAlign: "end" }, children: formatBytes(upload.file.size) }) }),
692
+ /* @__PURE__ */ jsx11(Grid2, { size: { xs: "grow" }, sx: { minWidth: "6rem" }, children: /* @__PURE__ */ jsx11(UploadProgressBar, { upload }) })
651
693
  ] }),
652
694
  /* @__PURE__ */ jsx11(Divider2, {})
653
695
  ]
@@ -663,7 +705,7 @@ var FileList = ({
663
705
  disableRemove
664
706
  }) => {
665
707
  if (files.length === 0) return null;
666
- return /* @__PURE__ */ jsx11(List, { children: files.map((file) => {
708
+ return /* @__PURE__ */ jsx11(List2, { children: files.map((file) => {
667
709
  return /* @__PURE__ */ jsx11(
668
710
  FileRow,
669
711
  {
@@ -684,10 +726,10 @@ import { useState as useState3 } from "react";
684
726
  import { useFormContext as useFormContext2 } from "react-hook-form";
685
727
  import { useQueryClient } from "@tanstack/react-query";
686
728
  import { Grid as Grid3 } from "@availity/mui-layout";
687
- import { Typography as Typography4 } from "@availity/mui-typography";
729
+ import { Typography as Typography5 } from "@availity/mui-typography";
688
730
 
689
731
  // src/lib/FileTypesMessage.tsx
690
- import { Typography as Typography2 } from "@availity/mui-typography";
732
+ import { Typography as Typography3 } from "@availity/mui-typography";
691
733
  import { jsxs as jsxs9 } from "react/jsx-runtime";
692
734
  var FileTypesMessage = ({
693
735
  allowedFileTypes = [],
@@ -696,17 +738,17 @@ var FileTypesMessage = ({
696
738
  }) => {
697
739
  const fileSizeMsg = typeof maxFileSize === "number" ? `Maximum file size is ${formatBytes(maxFileSize)}. ` : null;
698
740
  const fileTypesMsg = allowedFileTypes.length > 0 ? `Supported file types include: ${allowedFileTypes.join(", ")}` : "All file types allowed.";
699
- return /* @__PURE__ */ jsxs9(Typography2, { variant, children: [
741
+ return /* @__PURE__ */ jsxs9(Typography3, { variant, children: [
700
742
  fileSizeMsg,
701
743
  fileTypesMsg
702
744
  ] });
703
745
  };
704
746
 
705
747
  // src/lib/HeaderMessage.tsx
706
- import { Typography as Typography3 } from "@availity/mui-typography";
748
+ import { Typography as Typography4 } from "@availity/mui-typography";
707
749
  import { jsxs as jsxs10 } from "react/jsx-runtime";
708
750
  var HeaderMessage = ({ maxFiles, maxSize }) => {
709
- return /* @__PURE__ */ jsxs10(Typography3, { variant: "h6", children: [
751
+ return /* @__PURE__ */ jsxs10(Typography4, { variant: "h6", children: [
710
752
  "Attach up to ",
711
753
  maxFiles,
712
754
  " file(s), with a maximum individual size of ",
@@ -715,7 +757,7 @@ var HeaderMessage = ({ maxFiles, maxSize }) => {
715
757
  };
716
758
 
717
759
  // src/lib/FileSelector.tsx
718
- import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
760
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
719
761
  var CLOUD_URL = "/cloud/web/appl/vault/upload/v1/resumable";
720
762
  var FileSelector = ({
721
763
  name,
@@ -777,9 +819,9 @@ var FileSelector = ({
777
819
  const rejections = fileRejections.filter((value) => value.id !== id);
778
820
  setFileRejections(rejections);
779
821
  };
780
- return /* @__PURE__ */ jsxs11(Fragment4, { children: [
781
- enableDropArea ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
782
- label ? /* @__PURE__ */ jsx12(Typography4, { marginBottom: "4px", children: label }) : null,
822
+ return /* @__PURE__ */ jsxs11(Fragment5, { children: [
823
+ enableDropArea ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
824
+ label ? /* @__PURE__ */ jsx12(Typography5, { marginBottom: "4px", children: label }) : null,
783
825
  /* @__PURE__ */ jsx12(
784
826
  Dropzone,
785
827
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-file-selector",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Availity MUI file-selector Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -1,4 +1,5 @@
1
1
  import { Alert, AlertTitle } from '@availity/mui-alert';
2
+ import { List, ListItem } from '@availity/mui-list';
2
3
  import type { FileRejection } from 'react-dropzone';
3
4
 
4
5
  const codes: Record<string, string> = {
@@ -30,17 +31,39 @@ export const ErrorAlert = ({ errors, fileName, id, onClose }: ErrorAlertProps) =
30
31
  if (errors.length === 0) return null;
31
32
 
32
33
  return (
33
- <>
34
- {errors.map((error) => {
35
- return (
36
- <Alert severity="error" onClose={onClose} key={`${id}-${error.code}`}>
37
- <AlertTitle>
38
- {codes[error.code] || 'Error'}: {fileName}
39
- </AlertTitle>
40
- {error.message}
41
- </Alert>
42
- );
43
- })}
44
- </>
34
+ <Alert severity="error" onClose={onClose}>
35
+ {errors.length > 1 ?
36
+ <>
37
+ <AlertTitle>
38
+ There were {errors.length} error(s) found when uploading {fileName}
39
+ </AlertTitle>
40
+ <List sx={{
41
+ listStyleType: 'disc',
42
+ listStylePosition: 'inside',
43
+ marginLeft: 1,
44
+ '.MuiListItem-root': {
45
+ display: 'list-item'
46
+ }
47
+ }} disablePadding>
48
+ <>
49
+ {errors.map((error) => {
50
+ return (
51
+ <ListItem disableGutters disablePadding divider={false} key={`${id}-${error.code}`}>
52
+ {error.message}
53
+ </ListItem>
54
+ );
55
+ })}
56
+ </>
57
+ </List>
58
+ </>
59
+ :
60
+ <>
61
+ <AlertTitle>
62
+ {codes[errors[0].code] || 'Error'}: {fileName}
63
+ </AlertTitle>
64
+ {errors[0].message}
65
+ </>
66
+ }
67
+ </Alert>
45
68
  );
46
69
  };
@@ -74,19 +74,19 @@ export const FileRow = ({
74
74
  )
75
75
  }
76
76
  >
77
- <Grid container spacing={2} alignItems="center" justifyContent="space-between" width="100%">
78
- <Grid size={{ xs: 1 }}>
79
- <ListItemIcon>
77
+ <Grid container spacing={2} alignItems="center" justifyContent="space-between" width="100%" flexWrap="wrap">
78
+ <Grid size={{ xs: "auto" }}>
79
+ <ListItemIcon sx={{minWidth: '1.5rem'}}>
80
80
  <Icon />
81
81
  </ListItemIcon>
82
82
  </Grid>
83
- <Grid size={{ xs: 3 }}>
84
- <ListItemText>{upload.trimFileName(upload.file.name)}</ListItemText>
83
+ <Grid size={{ xs: 4 }} sx={{minWidth: '8rem'}}>
84
+ <ListItemText sx={{wordBreak: 'break-all'}}>{upload.trimFileName(upload.file.name)}</ListItemText>
85
85
  </Grid>
86
- <Grid size={{ xs: 2 }}>
87
- <ListItemText>{formatBytes(upload.file.size)}</ListItemText>
86
+ <Grid size={{ xs: 2 }} sx={{minWidth: '3rem'}}>
87
+ <ListItemText sx={{textAlign: 'end'}}>{formatBytes(upload.file.size)}</ListItemText>
88
88
  </Grid>
89
- <Grid size={{ xs: 6 }}>
89
+ <Grid size={{ xs: 'grow' }} sx={{minWidth: '6rem'}}>
90
90
  <UploadProgressBar upload={upload} />
91
91
  </Grid>
92
92
  </Grid>
@@ -77,7 +77,7 @@ export const UploadProgressBar = ({ upload, onProgress, onError, onSuccess }: Up
77
77
 
78
78
  return errorMessage ? (
79
79
  <Box sx={{display: 'flex', flexWrap: 'wrap', columnGap: '4px'}}>
80
- <ListItemText slotProps={{primary: { color: 'text.error', variant: 'body2', component: 'div' }}}>
80
+ <ListItemText slotProps={{primary: { color: 'text.error', variant: 'body2', component: 'div' }}} sx={{wordWrap: 'break-word'}}>
81
81
  <WarningTriangleIcon sx={{verticalAlign: 'middle', mt: '-2px'}}/> {errorMessage}
82
82
  </ListItemText>
83
83
  {upload.status === 'encrypted' && (