formik-form-components 0.2.12 → 0.2.14

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
@@ -7,8 +7,7 @@ var DatePicker = require('@mui/x-date-pickers/DatePicker');
7
7
  var LocalizationProvider = require('@mui/x-date-pickers/LocalizationProvider');
8
8
  var AdapterDayjs = require('@mui/x-date-pickers/AdapterDayjs');
9
9
  var dayjs = require('dayjs');
10
- var demo = require('@mui/x-date-pickers/internals/demo');
11
- var _19 = require('lodash');
10
+ var _ = require('lodash');
12
11
  var jsxRuntime = require('react/jsx-runtime');
13
12
  var DateTimePicker = require('@mui/x-date-pickers/DateTimePicker');
14
13
  var Autocomplete3 = require('@mui/material/Autocomplete');
@@ -35,15 +34,12 @@ var UndoIcon = require('@mui/icons-material/Undo');
35
34
  var RedoIcon = require('@mui/icons-material/Redo');
36
35
  var CloudUploadIcon = require('@mui/icons-material/CloudUpload');
37
36
  var CloseIcon = require('@mui/icons-material/Close');
38
- var styles = require('@mui/material/styles');
39
- var reactLazyLoadImageComponent = require('react-lazy-load-image-component');
40
- var framerMotion = require('framer-motion');
37
+ var iconsMaterial = require('@mui/icons-material');
41
38
  var reactDropzone = require('react-dropzone');
42
- var reactI18next = require('react-i18next');
43
39
 
44
40
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
45
41
 
46
- var _19__default = /*#__PURE__*/_interopDefault(_19);
42
+ var ___default = /*#__PURE__*/_interopDefault(_);
47
43
  var Autocomplete3__default = /*#__PURE__*/_interopDefault(Autocomplete3);
48
44
  var Typography10__default = /*#__PURE__*/_interopDefault(Typography10);
49
45
  var Select__default = /*#__PURE__*/_interopDefault(Select);
@@ -88,9 +84,9 @@ var AppDatePicker = react.forwardRef(
88
84
  ...otherProps
89
85
  }, ref) => {
90
86
  const { values, setFieldValue, touched, errors, setFieldTouched } = formik.useFormikContext();
91
- const fieldValue = _19__default.default.get(values, name);
92
- const fieldError = _19__default.default.get(errors, name);
93
- const isTouched = _19__default.default.get(touched, name);
87
+ const fieldValue = ___default.default.get(values, name);
88
+ const fieldError = ___default.default.get(errors, name);
89
+ const isTouched = ___default.default.get(touched, name);
94
90
  const handleChange = (newValue, context) => {
95
91
  setFieldValue(name, newValue);
96
92
  if (externalOnChange) {
@@ -103,7 +99,7 @@ var AppDatePicker = react.forwardRef(
103
99
  externalOnBlur(event);
104
100
  }
105
101
  };
106
- return /* @__PURE__ */ jsxRuntime.jsx(LocalizationProvider.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs, children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx, ref, children: /* @__PURE__ */ jsxRuntime.jsx(demo.DemoContainer, { components: ["DatePicker"], children: /* @__PURE__ */ jsxRuntime.jsx(
102
+ return /* @__PURE__ */ jsxRuntime.jsx(LocalizationProvider.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs, children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx, ref, children: /* @__PURE__ */ jsxRuntime.jsx(
107
103
  DatePicker.DatePicker,
108
104
  {
109
105
  label,
@@ -198,7 +194,7 @@ var AppDatePicker = react.forwardRef(
198
194
  },
199
195
  ...otherProps
200
196
  }
201
- ) }) }) });
197
+ ) }) });
202
198
  }
203
199
  );
204
200
  AppDatePicker.displayName = "AppDatePicker";
@@ -228,9 +224,9 @@ var AppDateAndTimePicker = react.forwardRef((props, ref) => {
228
224
  } = props;
229
225
  const theme = material.useTheme();
230
226
  const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
231
- const fieldError = _19.get(errors, name);
232
- const isTouched = _19.get(touched, name);
233
- const val = _19.get(values, name);
227
+ const fieldError = _.get(errors, name);
228
+ const isTouched = _.get(touched, name);
229
+ const val = _.get(values, name);
234
230
  const handleChange = (value) => {
235
231
  setFieldValue(name, value);
236
232
  if (externalOnChange) {
@@ -406,8 +402,8 @@ function AppFormErrorMessage({
406
402
  textSx
407
403
  }) {
408
404
  const { errors, touched } = formik.useFormikContext();
409
- const fieldError = _19__default.default.get(errors, name);
410
- const isTouched = _19__default.default.get(touched, name);
405
+ const fieldError = ___default.default.get(errors, name);
406
+ const isTouched = ___default.default.get(touched, name);
411
407
  const showError = fieldError && typeof fieldError === "string";
412
408
  if (alwaysShow) {
413
409
  return showError ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -484,9 +480,9 @@ var AppTextArea = react.forwardRef(({
484
480
  }, ref) => {
485
481
  var _a, _b, _c, _d;
486
482
  const { errors, getFieldProps, touched, setFieldValue } = formik.useFormikContext();
487
- const fieldError = _19__default.default.get(errors, name);
488
- const isTouched = _19__default.default.get(touched, name);
489
- const value = _19__default.default.get(getFieldProps(name), "value", "");
483
+ const fieldError = ___default.default.get(errors, name);
484
+ const isTouched = ___default.default.get(touched, name);
485
+ const value = ___default.default.get(getFieldProps(name), "value", "");
490
486
  const handleChange = (e) => {
491
487
  const newValue = e.target.value;
492
488
  if (maxLength && newValue.length > maxLength)
@@ -640,9 +636,9 @@ function AppTagsCreator({
640
636
  inputSx
641
637
  }) {
642
638
  const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = formik.useFormikContext();
643
- const fieldError = _19__default.default.get(errors, name);
644
- const isTouched = _19__default.default.get(touched, name);
645
- const val = _19__default.default.get(values, name);
639
+ const fieldError = ___default.default.get(errors, name);
640
+ const isTouched = ___default.default.get(touched, name);
641
+ const val = ___default.default.get(values, name);
646
642
  return /* @__PURE__ */ jsxRuntime.jsxs(
647
643
  material.FormControl,
648
644
  {
@@ -765,8 +761,8 @@ function AppSwitchInput({
765
761
  ...otherProps
766
762
  }) {
767
763
  const { errors, touched, setFieldValue, values } = formik.useFormikContext();
768
- const fieldError = _19__default.default.get(errors, name);
769
- const isTouched = _19__default.default.get(touched, name);
764
+ const fieldError = ___default.default.get(errors, name);
765
+ const isTouched = ___default.default.get(touched, name);
770
766
  return /* @__PURE__ */ jsxRuntime.jsxs(
771
767
  material.Box,
772
768
  {
@@ -855,9 +851,9 @@ function AppSwitch({
855
851
  ...otherProps
856
852
  }) {
857
853
  const { errors, touched, setFieldValue, values } = formik.useFormikContext();
858
- const fieldValue = _19__default.default.get(values, name);
859
- const fieldError = _19__default.default.get(errors, name);
860
- const isTouched = _19__default.default.get(touched, name);
854
+ const fieldValue = ___default.default.get(values, name);
855
+ const fieldError = ___default.default.get(errors, name);
856
+ const isTouched = ___default.default.get(touched, name);
861
857
  return /* @__PURE__ */ jsxRuntime.jsxs(
862
858
  material.Stack,
863
859
  {
@@ -945,6 +941,8 @@ function AppAutoComplete({
945
941
  variant = "outlined",
946
942
  label,
947
943
  options = [],
944
+ value: propValue,
945
+ onChange: propOnChange,
948
946
  sx,
949
947
  formControlSx,
950
948
  textFieldSx,
@@ -952,9 +950,10 @@ function AppAutoComplete({
952
950
  errorSx
953
951
  }) {
954
952
  const { errors, touched, getFieldProps, values, setFieldValue } = formik.useFormikContext();
955
- const fieldError = _19__default.default.get(errors, name);
956
- const isTouched = _19__default.default.get(touched, name);
957
- const val = _19__default.default.get(values, name);
953
+ const fieldError = ___default.default.get(errors, name);
954
+ const isTouched = ___default.default.get(touched, name);
955
+ const formikValue = ___default.default.get(values, name);
956
+ const val = propValue !== void 0 ? propValue : formikValue || [];
958
957
  return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
959
958
  /* @__PURE__ */ jsxRuntime.jsx(
960
959
  material.Autocomplete,
@@ -964,10 +963,23 @@ function AppAutoComplete({
964
963
  id: "tags-filled",
965
964
  options,
966
965
  freeSolo: true,
967
- renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ react.createElement(material.Chip, { variant: "outlined", label: option, ...getTagProps({ index }), key: index, sx: chipSx })),
966
+ renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ react.createElement(
967
+ material.Chip,
968
+ {
969
+ variant: "outlined",
970
+ label: option,
971
+ ...getTagProps({ index }),
972
+ key: index,
973
+ sx: chipSx
974
+ }
975
+ )),
968
976
  value: val,
969
- onChange: (event, newValue) => {
970
- setFieldValue(name, newValue, true);
977
+ onChange: (event, newValue, reason, details) => {
978
+ if (propOnChange) {
979
+ propOnChange(event, newValue, reason, details);
980
+ } else {
981
+ setFieldValue(name, newValue, true);
982
+ }
971
983
  },
972
984
  renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
973
985
  material.TextField,
@@ -1012,9 +1024,9 @@ function AppAutoCompleter({
1012
1024
  errorSx
1013
1025
  }) {
1014
1026
  const { errors, touched, values, setFieldValue } = formik.useFormikContext();
1015
- const fieldError = _19__default.default.get(errors, name);
1016
- const isTouched = _19__default.default.get(touched, name);
1017
- const value = _19__default.default.get(values, name);
1027
+ const fieldError = ___default.default.get(errors, name);
1028
+ const isTouched = ___default.default.get(touched, name);
1029
+ const value = ___default.default.get(values, name);
1018
1030
  const selectedOption = options.find((opt) => opt.value === value) || null;
1019
1031
  return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
1020
1032
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1077,14 +1089,23 @@ var AppCheckBox = ({
1077
1089
  ...rest
1078
1090
  }) => {
1079
1091
  const { getFieldProps, setFieldValue, touched, errors } = formik.useFormikContext();
1080
- const fieldError = _19__default.default.get(errors, name);
1081
- const isTouched = _19__default.default.get(touched, name);
1092
+ const fieldError = ___default.default.get(errors, name);
1093
+ const isTouched = ___default.default.get(touched, name);
1082
1094
  material.useTheme();
1083
1095
  const value = getFieldProps(name).value;
1084
- const checkedNames = Array.isArray(value) ? value : value ? [value] : [];
1085
- const handleChange = (itemName, isChecked) => {
1086
- const newValue = isChecked ? [...checkedNames, itemName] : checkedNames.filter((n) => n !== itemName);
1087
- setFieldValue(name, option.length === 1 ? isChecked : newValue);
1096
+ const checkedValues = (() => {
1097
+ if (Array.isArray(value)) {
1098
+ return value.map(String);
1099
+ }
1100
+ return value ? [String(value)] : [];
1101
+ })();
1102
+ const handleChange = (itemValue, isChecked) => {
1103
+ if (option.length === 1) {
1104
+ setFieldValue(name, isChecked ? itemValue : false);
1105
+ } else {
1106
+ const newValue = isChecked ? [...checkedValues, String(itemValue)] : checkedValues.filter((v) => v !== String(itemValue));
1107
+ setFieldValue(name, newValue);
1108
+ }
1088
1109
  };
1089
1110
  return /* @__PURE__ */ jsxRuntime.jsxs(
1090
1111
  material.Box,
@@ -1153,11 +1174,9 @@ var AppCheckBox = ({
1153
1174
  /* @__PURE__ */ jsxRuntime.jsx(
1154
1175
  material.Checkbox,
1155
1176
  {
1156
- ...getFieldProps(name),
1157
- name,
1158
- value: item.name,
1159
- checked: checkedNames.includes(item.name),
1160
- onChange: (e) => handleChange(item.name, e.target.checked),
1177
+ name: `${name}.${item.name}`,
1178
+ checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
1179
+ onChange: (e) => handleChange(item.value, e.target.checked),
1161
1180
  disabled: disabled || item.disabled,
1162
1181
  sx: [{
1163
1182
  color: "primary.main",
@@ -1234,8 +1253,8 @@ function AppInputField({
1234
1253
  ...otherProps
1235
1254
  }) {
1236
1255
  const { errors, getFieldProps, touched } = formik.useFormikContext();
1237
- const fieldError = _19__default.default.get(errors, name);
1238
- const isTouched = _19__default.default.get(touched, name);
1256
+ const fieldError = ___default.default.get(errors, name);
1257
+ const isTouched = ___default.default.get(touched, name);
1239
1258
  const [showPassword, setShowPassword] = react.useState(false);
1240
1259
  const handleShowPassword = () => {
1241
1260
  setShowPassword(!showPassword);
@@ -1326,9 +1345,9 @@ var AppMultiSelector = react.forwardRef(
1326
1345
  }, ref) => {
1327
1346
  const theme = material.useTheme();
1328
1347
  const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
1329
- const fieldError = _19__default.default.get(errors, name);
1330
- const isTouched = _19__default.default.get(touched, name);
1331
- const val = _19__default.default.get(values, name);
1348
+ const fieldError = ___default.default.get(errors, name);
1349
+ const isTouched = ___default.default.get(touched, name);
1350
+ const val = ___default.default.get(values, name);
1332
1351
  const selectedValues = Array.isArray(val) ? val : [];
1333
1352
  const handleChange = (event, child) => {
1334
1353
  const newValue = event.target.value;
@@ -1586,8 +1605,8 @@ var AppPhoneNoInput = ({
1586
1605
  ...otherProps
1587
1606
  }) => {
1588
1607
  const { values, errors, touched, setFieldValue, getFieldProps } = formik.useFormikContext();
1589
- const fieldError = _19__default.default.get(errors, name);
1590
- const isTouched = _19__default.default.get(touched, name);
1608
+ const fieldError = ___default.default.get(errors, name);
1609
+ const isTouched = ___default.default.get(touched, name);
1591
1610
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: [{ mb: 2 }, containerSx, sx], children: [
1592
1611
  label && /* @__PURE__ */ jsxRuntime.jsxs(
1593
1612
  material.Typography,
@@ -1671,9 +1690,9 @@ var AppRadioGroup = react.forwardRef(({
1671
1690
  ...rest
1672
1691
  }, ref) => {
1673
1692
  const { errors, touched, getFieldProps, setFieldValue } = formik.useFormikContext();
1674
- const fieldError = _19__default.default.get(errors, name);
1675
- const isTouched = _19__default.default.get(touched, name);
1676
- const value = _19__default.default.get(getFieldProps(name), "value");
1693
+ const fieldError = ___default.default.get(errors, name);
1694
+ const isTouched = ___default.default.get(touched, name);
1695
+ const value = ___default.default.get(getFieldProps(name), "value");
1677
1696
  const handleChange = (event) => {
1678
1697
  const newValue = event.target.value;
1679
1698
  setFieldValue(name, newValue);
@@ -1851,9 +1870,9 @@ var AppRating = react.forwardRef(({
1851
1870
  }, ref) => {
1852
1871
  material.useTheme();
1853
1872
  const { errors, touched, setFieldValue, values, setFieldTouched } = formik.useFormikContext();
1854
- const val = _19__default.default.get(values, name);
1855
- const fieldError = _19__default.default.get(errors, name);
1856
- const isTouched = _19__default.default.get(touched, name);
1873
+ const val = ___default.default.get(values, name);
1874
+ const fieldError = ___default.default.get(errors, name);
1875
+ const isTouched = ___default.default.get(touched, name);
1857
1876
  const hasError = Boolean(fieldError) && isTouched;
1858
1877
  const handleChange = (event, newValue) => {
1859
1878
  setFieldValue(name, newValue);
@@ -3534,7 +3553,7 @@ var Node = class {
3534
3553
  copy2 = mark.addToSet(copy2);
3535
3554
  }
3536
3555
  if (!Mark.sameSet(copy2, this.marks))
3537
- throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
3556
+ throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
3538
3557
  this.content.forEach((node) => node.check());
3539
3558
  }
3540
3559
  /**
@@ -3783,17 +3802,17 @@ var ContentMatch = class {
3783
3802
  */
3784
3803
  toString() {
3785
3804
  let seen = [];
3786
- function scan(m2) {
3787
- seen.push(m2);
3788
- for (let i = 0; i < m2.next.length; i++)
3789
- if (seen.indexOf(m2.next[i].next) == -1)
3790
- scan(m2.next[i].next);
3805
+ function scan(m) {
3806
+ seen.push(m);
3807
+ for (let i = 0; i < m.next.length; i++)
3808
+ if (seen.indexOf(m.next[i].next) == -1)
3809
+ scan(m.next[i].next);
3791
3810
  }
3792
3811
  scan(this);
3793
- return seen.map((m2, i) => {
3794
- let out = i + (m2.validEnd ? "*" : " ") + " ";
3795
- for (let i2 = 0; i2 < m2.next.length; i2++)
3796
- out += (i2 ? ", " : "") + m2.next[i2].type.name + "->" + seen.indexOf(m2.next[i2].next);
3812
+ return seen.map((m, i) => {
3813
+ let out = i + (m.validEnd ? "*" : " ") + " ";
3814
+ for (let i2 = 0; i2 < m.next.length; i2++)
3815
+ out += (i2 ? ", " : "") + m.next[i2].type.name + "->" + seen.indexOf(m.next[i2].next);
3797
3816
  return out;
3798
3817
  }).join("\n");
3799
3818
  }
@@ -4674,13 +4693,13 @@ var NodeContext = class {
4674
4693
  }
4675
4694
  finish(openEnd) {
4676
4695
  if (!(this.options & OPT_PRESERVE_WS)) {
4677
- let last = this.content[this.content.length - 1], m2;
4678
- if (last && last.isText && (m2 = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4696
+ let last = this.content[this.content.length - 1], m;
4697
+ if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4679
4698
  let text = last;
4680
- if (last.text.length == m2[0].length)
4699
+ if (last.text.length == m[0].length)
4681
4700
  this.content.pop();
4682
4701
  else
4683
- this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
4702
+ this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
4684
4703
  }
4685
4704
  }
4686
4705
  let content = Fragment2.from(this.content);
@@ -4832,7 +4851,7 @@ var ParseContext = class {
4832
4851
  if (rule.ignore)
4833
4852
  return null;
4834
4853
  if (rule.clearMark)
4835
- marks = marks.filter((m2) => !rule.clearMark(m2));
4854
+ marks = marks.filter((m) => !rule.clearMark(m));
4836
4855
  else
4837
4856
  marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
4838
4857
  if (rule.consuming === false)
@@ -4938,9 +4957,9 @@ var ParseContext = class {
4938
4957
  if (top.match)
4939
4958
  top.match = top.match.matchType(node.type);
4940
4959
  let nodeMarks = Mark.none;
4941
- for (let m2 of innerMarks.concat(node.marks))
4942
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node.type))
4943
- nodeMarks = m2.addToSet(nodeMarks);
4960
+ for (let m of innerMarks.concat(node.marks))
4961
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))
4962
+ nodeMarks = m.addToSet(nodeMarks);
4944
4963
  top.content.push(node.mark(nodeMarks));
4945
4964
  return true;
4946
4965
  }
@@ -4963,9 +4982,9 @@ var ParseContext = class {
4963
4982
  if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
4964
4983
  options |= OPT_OPEN_LEFT;
4965
4984
  let applyMarks = Mark.none;
4966
- marks = marks.filter((m2) => {
4967
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
4968
- applyMarks = m2.addToSet(applyMarks);
4985
+ marks = marks.filter((m) => {
4986
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
4987
+ applyMarks = m.addToSet(applyMarks);
4969
4988
  return false;
4970
4989
  }
4971
4990
  return true;
@@ -5353,10 +5372,10 @@ var Mapping = class {
5353
5372
  /**
5354
5373
  @internal
5355
5374
  */
5356
- setMirror(n, m2) {
5375
+ setMirror(n, m) {
5357
5376
  if (!this.mirror)
5358
5377
  this.mirror = [];
5359
- this.mirror.push(n, m2);
5378
+ this.mirror.push(n, m);
5360
5379
  }
5361
5380
  /**
5362
5381
  Append the inverse of the given mapping to this one.
@@ -5898,9 +5917,9 @@ function removeMark(tr, from, to, mark) {
5898
5917
  for (let i = 0; i < toRemove.length; i++) {
5899
5918
  let style = toRemove[i], found2;
5900
5919
  for (let j = 0; j < matched.length; j++) {
5901
- let m2 = matched[j];
5902
- if (m2.step == step - 1 && style.eq(matched[j].style))
5903
- found2 = m2;
5920
+ let m = matched[j];
5921
+ if (m.step == step - 1 && style.eq(matched[j].style))
5922
+ found2 = m;
5904
5923
  }
5905
5924
  if (found2) {
5906
5925
  found2.to = end;
@@ -5911,7 +5930,7 @@ function removeMark(tr, from, to, mark) {
5911
5930
  }
5912
5931
  }
5913
5932
  });
5914
- matched.forEach((m2) => tr.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
5933
+ matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
5915
5934
  }
5916
5935
  function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
5917
5936
  let node = tr.doc.nodeAt(pos);
@@ -5927,11 +5946,11 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
5927
5946
  if (!parentType.allowsMarkType(child.marks[j].type))
5928
5947
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
5929
5948
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
5930
- let m2, newline = /\r?\n|\r/g, slice;
5931
- while (m2 = newline.exec(child.text)) {
5949
+ let m, newline = /\r?\n|\r/g, slice;
5950
+ while (m = newline.exec(child.text)) {
5932
5951
  if (!slice)
5933
5952
  slice = new Slice(Fragment2.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
5934
- replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice));
5953
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
5935
5954
  }
5936
5955
  }
5937
5956
  }
@@ -6063,9 +6082,9 @@ function setBlockType(tr, from, to, type, attrs) {
6063
6082
  function replaceNewlines(tr, node, pos, mapFrom) {
6064
6083
  node.forEach((child, offset) => {
6065
6084
  if (child.isText) {
6066
- let m2, newline = /\r?\n|\r/g;
6067
- while (m2 = newline.exec(child.text)) {
6068
- let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m2.index);
6085
+ let m, newline = /\r?\n|\r/g;
6086
+ while (m = newline.exec(child.text)) {
6087
+ let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
6069
6088
  tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
6070
6089
  }
6071
6090
  }
@@ -10131,11 +10150,11 @@ var Mark2 = class _Mark extends Extendable {
10131
10150
  const isAtEnd = currentPos.pos === currentPos.end();
10132
10151
  if (isAtEnd) {
10133
10152
  const currentMarks = currentPos.marks();
10134
- const isInMark = !!currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10153
+ const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10135
10154
  if (!isInMark) {
10136
10155
  return false;
10137
10156
  }
10138
- const removeMark2 = currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10157
+ const removeMark2 = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10139
10158
  if (removeMark2) {
10140
10159
  tr.removeStoredMark(removeMark2);
10141
10160
  }
@@ -11163,12 +11182,14 @@ var AppRichTextEditor = ({
11163
11182
  material.Typography,
11164
11183
  {
11165
11184
  variant: "caption",
11166
- sx: [{
11167
- color: "error.main",
11168
- display: "block",
11169
- mt: 0.5,
11170
- ...errorSx
11171
- }],
11185
+ sx: [
11186
+ {
11187
+ color: "error.main",
11188
+ display: "block",
11189
+ mt: 0.5,
11190
+ ...errorSx
11191
+ }
11192
+ ],
11172
11193
  children: msg
11173
11194
  }
11174
11195
  )
@@ -11178,167 +11199,173 @@ var AppRichTextEditor = ({
11178
11199
  material.Typography,
11179
11200
  {
11180
11201
  variant: "button",
11181
- sx: [{
11182
- color: "text.primary",
11183
- mb: 1,
11184
- display: "block",
11185
- ...labelSx
11186
- }],
11202
+ sx: [
11203
+ {
11204
+ color: "text.primary",
11205
+ mb: 1,
11206
+ display: "block",
11207
+ ...labelSx
11208
+ }
11209
+ ],
11187
11210
  children: [
11188
11211
  label,
11189
11212
  required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
11190
11213
  ]
11191
11214
  }
11192
11215
  ),
11193
- /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: {
11194
- mb: 1,
11195
- display: "flex",
11196
- gap: 1,
11197
- flexWrap: "wrap",
11198
- p: 1,
11199
- bgcolor: "background.paper",
11200
- borderRadius: 1,
11201
- border: "1px solid",
11202
- borderColor: "divider",
11203
- ...toolbarSx
11204
- }, children: [
11205
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(
11206
- material.IconButton,
11207
- {
11208
- onClick: () => editor.chain().focus().toggleBold().run(),
11209
- color: editor.isActive("bold") ? "primary" : "default",
11210
- sx: {
11211
- ...buttonSx,
11212
- ...editor.isActive("bold") ? activeButtonSx : {}
11213
- },
11214
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatBoldIcon__default.default, {})
11215
- }
11216
- ) }),
11217
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(
11218
- material.IconButton,
11219
- {
11220
- onClick: () => editor.chain().focus().toggleItalic().run(),
11221
- color: editor.isActive("italic") ? "primary" : "default",
11222
- sx: {
11223
- ...buttonSx,
11224
- ...editor.isActive("italic") ? activeButtonSx : {}
11225
- },
11226
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatItalicIcon__default.default, {})
11227
- }
11228
- ) }),
11229
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(
11230
- material.IconButton,
11231
- {
11232
- onClick: () => editor.chain().focus().toggleUnderline().run(),
11233
- color: editor.isActive("underline") ? "primary" : "default",
11234
- sx: {
11235
- ...buttonSx,
11236
- ...editor.isActive("underline") ? activeButtonSx : {}
11237
- },
11238
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatUnderlinedIcon__default.default, {})
11239
- }
11240
- ) }),
11241
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Strike", children: /* @__PURE__ */ jsxRuntime.jsx(
11242
- material.IconButton,
11243
- {
11244
- onClick: () => editor.chain().focus().toggleStrike().run(),
11245
- color: editor.isActive("strike") ? "primary" : "default",
11246
- sx: {
11247
- ...buttonSx,
11248
- ...editor.isActive("strike") ? activeButtonSx : {}
11249
- },
11250
- children: /* @__PURE__ */ jsxRuntime.jsx(StrikethroughSIcon__default.default, {})
11251
- }
11252
- ) }),
11253
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsxRuntime.jsx(
11254
- material.IconButton,
11255
- {
11256
- onClick: () => editor.chain().focus().toggleBulletList().run(),
11257
- color: editor.isActive("bulletList") ? "primary" : "default",
11258
- sx: {
11259
- ...buttonSx,
11260
- ...editor.isActive("bulletList") ? activeButtonSx : {}
11261
- },
11262
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListBulletedIcon__default.default, {})
11263
- }
11264
- ) }),
11265
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsxRuntime.jsx(
11266
- material.IconButton,
11267
- {
11268
- onClick: () => editor.chain().focus().toggleOrderedList().run(),
11269
- color: editor.isActive("orderedList") ? "primary" : "default",
11270
- sx: {
11271
- ...buttonSx,
11272
- ...editor.isActive("orderedList") ? activeButtonSx : {}
11273
- },
11274
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListNumberedIcon__default.default, {})
11275
- }
11276
- ) }),
11277
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsxRuntime.jsx(
11278
- material.IconButton,
11279
- {
11280
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
11281
- color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11282
- sx: {
11283
- ...buttonSx,
11284
- ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11285
- },
11286
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignLeftIcon__default.default, {})
11287
- }
11288
- ) }),
11289
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsxRuntime.jsx(
11290
- material.IconButton,
11291
- {
11292
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
11293
- color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11294
- sx: {
11295
- ...buttonSx,
11296
- ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11297
- },
11298
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignCenterIcon__default.default, {})
11299
- }
11300
- ) }),
11301
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsxRuntime.jsx(
11302
- material.IconButton,
11303
- {
11304
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
11305
- color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11306
- sx: {
11307
- ...buttonSx,
11308
- ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11309
- },
11310
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignRightIcon__default.default, {})
11311
- }
11312
- ) }),
11313
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsxRuntime.jsx(
11314
- material.IconButton,
11315
- {
11316
- onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11317
- color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11318
- sx: {
11319
- ...buttonSx,
11320
- ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11321
- },
11322
- children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "1rem" } })
11323
- }
11324
- ) }),
11325
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxRuntime.jsxs(
11326
- material.IconButton,
11327
- {
11328
- onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11329
- color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11330
- sx: {
11331
- ...buttonSx,
11332
- ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11333
- },
11334
- children: [
11335
- /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "0.85rem" } }),
11336
- /* @__PURE__ */ jsxRuntime.jsx(UndoIcon__default.default, {})
11337
- ]
11338
- }
11339
- ) }),
11340
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Redo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(RedoIcon__default.default, {}) }) })
11341
- ] }),
11216
+ /* @__PURE__ */ jsxRuntime.jsxs(
11217
+ material.Box,
11218
+ {
11219
+ sx: {
11220
+ mb: 1,
11221
+ display: "flex",
11222
+ gap: 1,
11223
+ flexWrap: "wrap",
11224
+ p: 1,
11225
+ bgcolor: "background.paper",
11226
+ borderRadius: 1,
11227
+ border: "1px solid",
11228
+ borderColor: "divider",
11229
+ ...toolbarSx
11230
+ },
11231
+ children: [
11232
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(
11233
+ material.IconButton,
11234
+ {
11235
+ onClick: () => editor.chain().focus().toggleBold().run(),
11236
+ color: editor.isActive("bold") ? "primary" : "default",
11237
+ sx: {
11238
+ ...buttonSx,
11239
+ ...editor.isActive("bold") ? activeButtonSx : {}
11240
+ },
11241
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatBoldIcon__default.default, {})
11242
+ }
11243
+ ) }),
11244
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(
11245
+ material.IconButton,
11246
+ {
11247
+ onClick: () => editor.chain().focus().toggleItalic().run(),
11248
+ color: editor.isActive("italic") ? "primary" : "default",
11249
+ sx: {
11250
+ ...buttonSx,
11251
+ ...editor.isActive("italic") ? activeButtonSx : {}
11252
+ },
11253
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatItalicIcon__default.default, {})
11254
+ }
11255
+ ) }),
11256
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(
11257
+ material.IconButton,
11258
+ {
11259
+ onClick: () => editor.chain().focus().toggleUnderline().run(),
11260
+ color: editor.isActive("underline") ? "primary" : "default",
11261
+ sx: {
11262
+ ...buttonSx,
11263
+ ...editor.isActive("underline") ? activeButtonSx : {}
11264
+ },
11265
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatUnderlinedIcon__default.default, {})
11266
+ }
11267
+ ) }),
11268
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Strike", children: /* @__PURE__ */ jsxRuntime.jsx(
11269
+ material.IconButton,
11270
+ {
11271
+ onClick: () => editor.chain().focus().toggleStrike().run(),
11272
+ color: editor.isActive("strike") ? "primary" : "default",
11273
+ sx: {
11274
+ ...buttonSx,
11275
+ ...editor.isActive("strike") ? activeButtonSx : {}
11276
+ },
11277
+ children: /* @__PURE__ */ jsxRuntime.jsx(StrikethroughSIcon__default.default, {})
11278
+ }
11279
+ ) }),
11280
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsxRuntime.jsx(
11281
+ material.IconButton,
11282
+ {
11283
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
11284
+ color: editor.isActive("bulletList") ? "primary" : "default",
11285
+ sx: {
11286
+ ...buttonSx,
11287
+ ...editor.isActive("bulletList") ? activeButtonSx : {}
11288
+ },
11289
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatListBulletedIcon__default.default, {})
11290
+ }
11291
+ ) }),
11292
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsxRuntime.jsx(
11293
+ material.IconButton,
11294
+ {
11295
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
11296
+ color: editor.isActive("orderedList") ? "primary" : "default",
11297
+ sx: {
11298
+ ...buttonSx,
11299
+ ...editor.isActive("orderedList") ? activeButtonSx : {}
11300
+ },
11301
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatListNumberedIcon__default.default, {})
11302
+ }
11303
+ ) }),
11304
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsxRuntime.jsx(
11305
+ material.IconButton,
11306
+ {
11307
+ onClick: () => editor.chain().focus().setTextAlign("left").run(),
11308
+ color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11309
+ sx: {
11310
+ ...buttonSx,
11311
+ ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11312
+ },
11313
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignLeftIcon__default.default, {})
11314
+ }
11315
+ ) }),
11316
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsxRuntime.jsx(
11317
+ material.IconButton,
11318
+ {
11319
+ onClick: () => editor.chain().focus().setTextAlign("center").run(),
11320
+ color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11321
+ sx: {
11322
+ ...buttonSx,
11323
+ ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11324
+ },
11325
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignCenterIcon__default.default, {})
11326
+ }
11327
+ ) }),
11328
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsxRuntime.jsx(
11329
+ material.IconButton,
11330
+ {
11331
+ onClick: () => editor.chain().focus().setTextAlign("right").run(),
11332
+ color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11333
+ sx: {
11334
+ ...buttonSx,
11335
+ ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11336
+ },
11337
+ children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignRightIcon__default.default, {})
11338
+ }
11339
+ ) }),
11340
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsxRuntime.jsx(
11341
+ material.IconButton,
11342
+ {
11343
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11344
+ color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11345
+ sx: {
11346
+ ...buttonSx,
11347
+ ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11348
+ },
11349
+ children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "1rem" } })
11350
+ }
11351
+ ) }),
11352
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxRuntime.jsx(
11353
+ material.IconButton,
11354
+ {
11355
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11356
+ color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11357
+ sx: {
11358
+ ...buttonSx,
11359
+ ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11360
+ },
11361
+ children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "0.85rem" } })
11362
+ }
11363
+ ) }),
11364
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Undo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().undo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(UndoIcon__default.default, {}) }) }),
11365
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Redo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(RedoIcon__default.default, {}) }) })
11366
+ ]
11367
+ }
11368
+ ),
11342
11369
  /* @__PURE__ */ jsxRuntime.jsx(
11343
11370
  material.Box,
11344
11371
  {
@@ -11531,10 +11558,10 @@ var AppSearchableMultiSelector = react.forwardRef(
11531
11558
  }, ref) => {
11532
11559
  material.useTheme();
11533
11560
  const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
11534
- const fieldError = _19__default.default.get(errors, name);
11535
- const isTouched = Boolean(_19__default.default.get(touched, name));
11561
+ const fieldError = ___default.default.get(errors, name);
11562
+ const isTouched = Boolean(___default.default.get(touched, name));
11536
11563
  const hasError = Boolean(fieldError) && isTouched;
11537
- const val = _19__default.default.get(values, name);
11564
+ const val = ___default.default.get(values, name);
11538
11565
  const selectedValues = Array.isArray(val) ? val : [];
11539
11566
  const selectedCount = selectedValues.length;
11540
11567
  const handleChange = (event, value, reason, details) => {
@@ -11910,9 +11937,9 @@ function AppSearchableSelectInput({
11910
11937
  ...otherProps
11911
11938
  }) {
11912
11939
  const { errors, touched, setFieldValue, values } = formik.useFormikContext();
11913
- const fieldError = _19__default.default.get(errors, name);
11914
- const isTouched = _19__default.default.get(touched, name);
11915
- const val = _19__default.default.get(values, name);
11940
+ const fieldError = ___default.default.get(errors, name);
11941
+ const isTouched = ___default.default.get(touched, name);
11942
+ const val = ___default.default.get(values, name);
11916
11943
  const selectedOption = options.find((option) => option.value === val) || null;
11917
11944
  const handleChange = (event, newValue) => {
11918
11945
  setFieldValue(name, newValue ? newValue.value : "");
@@ -12038,10 +12065,10 @@ var AppSelectInput = react.forwardRef(
12038
12065
  }, ref) => {
12039
12066
  const theme = material.useTheme();
12040
12067
  const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
12041
- const fieldError = _19__default.default.get(errors, name);
12042
- const isTouched = _19__default.default.get(touched, name);
12068
+ const fieldError = ___default.default.get(errors, name);
12069
+ const isTouched = ___default.default.get(touched, name);
12043
12070
  const hasError = Boolean(fieldError) && isTouched;
12044
- const value = _19__default.default.get(values, name);
12071
+ const value = ___default.default.get(values, name);
12045
12072
  const handleChange = (event, child) => {
12046
12073
  setFieldValue(name, event.target.value, true);
12047
12074
  if (externalOnChange) {
@@ -12283,8 +12310,8 @@ var AppSimpleUploadFile = ({
12283
12310
  onError
12284
12311
  }) => {
12285
12312
  const { setFieldValue, values, errors, touched } = formik.useFormikContext();
12286
- const fieldValue = _19__default.default.get(values, name);
12287
- const fieldError = _19__default.default.get(touched, name) ? _19__default.default.get(errors, name) : void 0;
12313
+ const fieldValue = ___default.default.get(values, name);
12314
+ const fieldError = ___default.default.get(touched, name) ? ___default.default.get(errors, name) : void 0;
12288
12315
  const handleChange = (event) => {
12289
12316
  const files = event.target.files;
12290
12317
  if (!files || files.length === 0)
@@ -12405,1545 +12432,241 @@ var AppSimpleUploadFile = ({
12405
12432
  ] });
12406
12433
  };
12407
12434
  var AppSimpleUploadFile_default = AppSimpleUploadFile;
12408
-
12409
- // src/file-thumbnail/utils.ts
12410
- var FORMAT_PDF = ["pdf"];
12411
- var FORMAT_TEXT = ["txt"];
12412
- var FORMAT_PHOTOSHOP = ["psd"];
12413
- var FORMAT_WORD = ["doc", "docx"];
12414
- var FORMAT_EXCEL = ["xls", "xlsx"];
12415
- var FORMAT_ZIP = ["zip", "rar", "iso"];
12416
- var FORMAT_ILLUSTRATOR = ["ai", "esp"];
12417
- var FORMAT_POWERPOINT = ["ppt", "pptx"];
12418
- var FORMAT_AUDIO = ["wav", "aif", "mp3", "aac"];
12419
- var FORMAT_IMG = ["jpg", "jpeg", "gif", "bmp", "png", "svg"];
12420
- var FORMAT_VIDEO = ["m4v", "avi", "mpg", "mp4", "webm"];
12421
- var iconUrl = (icon) => `/assets/icons/files/${icon}.svg`;
12422
- function fileFormat(fileUrl) {
12423
- let format;
12424
- switch (fileUrl == null ? void 0 : fileUrl.includes(fileTypeByUrl(fileUrl))) {
12425
- case FORMAT_TEXT.includes(fileTypeByUrl(fileUrl)):
12426
- format = "txt";
12427
- break;
12428
- case FORMAT_ZIP.includes(fileTypeByUrl(fileUrl)):
12429
- format = "zip";
12430
- break;
12431
- case FORMAT_AUDIO.includes(fileTypeByUrl(fileUrl)):
12432
- format = "audio";
12433
- break;
12434
- case FORMAT_IMG.includes(fileTypeByUrl(fileUrl)):
12435
- format = "image";
12436
- break;
12437
- case FORMAT_VIDEO.includes(fileTypeByUrl(fileUrl)):
12438
- format = "video";
12439
- break;
12440
- case FORMAT_WORD.includes(fileTypeByUrl(fileUrl)):
12441
- format = "word";
12442
- break;
12443
- case FORMAT_EXCEL.includes(fileTypeByUrl(fileUrl)):
12444
- format = "excel";
12445
- break;
12446
- case FORMAT_POWERPOINT.includes(fileTypeByUrl(fileUrl)):
12447
- format = "powerpoint";
12448
- break;
12449
- case FORMAT_PDF.includes(fileTypeByUrl(fileUrl)):
12450
- format = "pdf";
12451
- break;
12452
- case FORMAT_PHOTOSHOP.includes(fileTypeByUrl(fileUrl)):
12453
- format = "photoshop";
12454
- break;
12455
- case FORMAT_ILLUSTRATOR.includes(fileTypeByUrl(fileUrl)):
12456
- format = "illustrator";
12457
- break;
12458
- default:
12459
- format = fileTypeByUrl(fileUrl);
12460
- }
12461
- return format;
12462
- }
12463
- function fileThumb(fileUrl) {
12464
- let thumb;
12465
- switch (fileFormat(fileUrl)) {
12466
- case "folder":
12467
- thumb = iconUrl("ic_folder");
12468
- break;
12469
- case "txt":
12470
- thumb = iconUrl("ic_txt");
12471
- break;
12472
- case "zip":
12473
- thumb = iconUrl("ic_zip");
12474
- break;
12475
- case "audio":
12476
- thumb = iconUrl("ic_audio");
12477
- break;
12478
- case "video":
12479
- thumb = iconUrl("ic_video");
12480
- break;
12481
- case "word":
12482
- thumb = iconUrl("ic_word");
12483
- break;
12484
- case "excel":
12485
- thumb = iconUrl("ic_excel");
12486
- break;
12487
- case "powerpoint":
12488
- thumb = iconUrl("ic_power_point");
12489
- break;
12490
- case "pdf":
12491
- thumb = iconUrl("ic_pdf");
12492
- break;
12493
- case "photoshop":
12494
- thumb = iconUrl("ic_pts");
12495
- break;
12496
- case "illustrator":
12497
- thumb = iconUrl("ic_ai");
12498
- break;
12499
- case "image":
12500
- thumb = iconUrl("ic_img");
12501
- break;
12502
- default:
12503
- thumb = iconUrl("ic_file");
12504
- }
12505
- return thumb;
12506
- }
12507
- function fileTypeByUrl(fileUrl = "") {
12508
- return fileUrl && fileUrl.split(".").pop() || "";
12509
- }
12510
- function fileNameByUrl(fileUrl) {
12511
- return fileUrl.split("/").pop();
12512
- }
12513
- function fileData(file) {
12514
- if (typeof file === "string") {
12515
- return {
12516
- key: file,
12517
- preview: file,
12518
- name: fileNameByUrl(file),
12519
- type: fileTypeByUrl(file)
12520
- };
12521
- }
12522
- return {
12523
- key: file == null ? void 0 : file.preview,
12524
- name: file == null ? void 0 : file.name,
12525
- size: file == null ? void 0 : file.size,
12526
- path: file == null ? void 0 : file.path,
12527
- type: file == null ? void 0 : file.type,
12528
- preview: file == null ? void 0 : file.preview,
12529
- lastModified: file == null ? void 0 : file.lastModified,
12530
- lastModifiedDate: file == null ? void 0 : file.lastModifiedDate
12531
- };
12532
- }
12533
- function DownloadButton({ onDownload }) {
12534
- const theme = styles.useTheme();
12535
- return /* @__PURE__ */ jsxRuntime.jsx(
12536
- material.IconButton,
12537
- {
12538
- onClick: onDownload,
12539
- sx: {
12540
- p: 0,
12541
- top: 0,
12542
- right: 0,
12543
- width: 1,
12544
- height: 1,
12545
- zIndex: 9,
12546
- opacity: 0,
12547
- position: "absolute",
12548
- borderRadius: "unset",
12549
- // color: 'common.white',
12550
- justifyContent: "center",
12551
- bgcolor: "grey.800",
12552
- color: "common.white",
12553
- transition: theme.transitions.create("opacity"),
12554
- "&:hover": {
12555
- opacity: 1,
12556
- backgroundColor: styles.alpha(theme.palette.grey[900], 0.64),
12557
- backdropFilter: "blur(6px)"
12558
- }
12559
- },
12560
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:arrow-circle-down-fill", width: 24 })
12561
- }
12562
- );
12563
- }
12564
- function FileThumbnail({
12565
- file,
12566
- tooltip,
12567
- imageView,
12568
- onDownload,
12435
+ var AppUploadFile = ({
12436
+ name,
12437
+ label,
12438
+ multiple = false,
12439
+ accept = "image/*",
12440
+ maxFiles = 5,
12441
+ maxSize = 5 * 1024 * 1024,
12442
+ // 5MB
12443
+ disabled = false,
12569
12444
  sx,
12570
- imgSx
12571
- }) {
12572
- const { name = "", path = "", preview = "" } = fileData(file);
12573
- const format = fileFormat(path || preview);
12574
- const renderContent = format === "image" && imageView === true ? /* @__PURE__ */ jsxRuntime.jsx(
12575
- material.Box,
12576
- {
12577
- component: "img",
12578
- src: preview,
12579
- sx: {
12580
- width: 1,
12581
- height: 1,
12582
- flexShrink: 0,
12583
- objectFit: "cover",
12584
- ...imgSx
12585
- }
12445
+ dropZoneSx,
12446
+ previewSx,
12447
+ errorSx,
12448
+ helperTextSx,
12449
+ onDrop: externalOnDrop,
12450
+ onDelete: externalOnDelete,
12451
+ ...rest
12452
+ }) => {
12453
+ var _a;
12454
+ const { errors, touched, setFieldValue, values } = formik.useFormikContext();
12455
+ const fieldError = ___default.default.get(errors, name);
12456
+ const isTouched = ___default.default.get(touched, name);
12457
+ const [isDragging, setIsDragging] = react.useState(false);
12458
+ const currentFiles = ___default.default.get(values, name, multiple ? [] : []) || [];
12459
+ const isMaxFilesReached = multiple && currentFiles && currentFiles.length >= maxFiles;
12460
+ const processFile = async (file) => {
12461
+ if (file.type.startsWith("image/")) {
12462
+ const preview = await new Promise((resolve) => {
12463
+ const reader = new FileReader();
12464
+ reader.onload = () => resolve(reader.result);
12465
+ reader.readAsDataURL(file);
12466
+ });
12467
+ return { file, preview, name: file.name, type: file.type };
12586
12468
  }
12587
- ) : /* @__PURE__ */ jsxRuntime.jsx(
12588
- material.Box,
12589
- {
12590
- component: "img",
12591
- src: fileThumb(format),
12592
- sx: {
12593
- width: 32,
12594
- height: 32,
12595
- flexShrink: 0,
12596
- ...sx
12469
+ return { file, name: file.name, type: file.type };
12470
+ };
12471
+ const handleDrop = react.useCallback(
12472
+ async (acceptedFiles) => {
12473
+ if (disabled || isMaxFilesReached)
12474
+ return;
12475
+ try {
12476
+ const newFiles = await Promise.all(acceptedFiles.map(processFile));
12477
+ if (multiple) {
12478
+ const updatedFiles = [...currentFiles || [], ...newFiles].slice(
12479
+ 0,
12480
+ maxFiles
12481
+ );
12482
+ setFieldValue(name, updatedFiles, true);
12483
+ } else {
12484
+ setFieldValue(name, newFiles[0] || null, true);
12485
+ }
12486
+ externalOnDrop == null ? void 0 : externalOnDrop(acceptedFiles);
12487
+ } catch (error) {
12488
+ console.error("Error processing files:", error);
12597
12489
  }
12598
- }
12490
+ },
12491
+ [
12492
+ currentFiles,
12493
+ disabled,
12494
+ isMaxFilesReached,
12495
+ multiple,
12496
+ name,
12497
+ setFieldValue,
12498
+ maxFiles,
12499
+ externalOnDrop
12500
+ ]
12599
12501
  );
12600
- if (tooltip === true) {
12601
- return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: name, children: /* @__PURE__ */ jsxRuntime.jsxs(
12602
- material.Stack,
12603
- {
12604
- flexShrink: 0,
12605
- component: "span",
12606
- alignItems: "center",
12607
- justifyContent: "center",
12608
- sx: {
12609
- width: "fit-content",
12610
- height: "inherit"
12611
- },
12612
- children: [
12613
- renderContent,
12614
- onDownload && /* @__PURE__ */ jsxRuntime.jsx(DownloadButton, { onDownload })
12615
- ]
12616
- }
12617
- ) });
12618
- }
12619
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12620
- renderContent,
12621
- onDownload && /* @__PURE__ */ jsxRuntime.jsx(DownloadButton, { onDownload })
12622
- ] });
12623
- }
12624
- function RejectionFiles({ fileRejections }) {
12625
- if (!fileRejections.length) {
12626
- return null;
12627
- }
12628
- function formatBytes2(bytes) {
12629
- const b = bytes != null ? bytes : 0;
12630
- if (b === 0)
12631
- return "0 Bytes";
12632
- const k = 1024;
12633
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12634
- const i = Math.floor(Math.log(b) / Math.log(k));
12635
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12636
- }
12637
- return /* @__PURE__ */ jsxRuntime.jsx(
12638
- material.Paper,
12639
- {
12640
- variant: "outlined",
12641
- sx: {
12642
- py: 1,
12643
- px: 2,
12644
- mt: 3,
12645
- bgcolor: (theme) => styles.alpha(theme.palette.error.main, 0.08),
12646
- borderColor: (theme) => styles.alpha(theme.palette.error.main, 0.24)
12647
- },
12648
- children: fileRejections.map(({ file, errors }) => {
12649
- const { path, size } = fileData(file);
12650
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { my: 1 }, children: [
12651
- /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "subtitle2", noWrap: true, children: [
12652
- path,
12653
- " - ",
12654
- size != null ? formatBytes2(size) : ""
12655
- ] }),
12656
- errors.map((error) => /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { component: "span", sx: { typography: "caption" }, children: [
12657
- "- ",
12658
- error.message
12659
- ] }, error.code))
12660
- ] }, path);
12661
- })
12502
+ const handleRemove = (index) => {
12503
+ if (disabled)
12504
+ return;
12505
+ if (multiple) {
12506
+ const updatedFiles = [...currentFiles || []];
12507
+ updatedFiles.splice(index, 1);
12508
+ setFieldValue(name, updatedFiles, true);
12509
+ } else {
12510
+ setFieldValue(name, null, true);
12662
12511
  }
12663
- );
12664
- }
12665
-
12666
- // src/image/getRatio.ts
12667
- function getRatio(ratio = "1/1") {
12668
- return {
12669
- "4/3": "calc(100% / 4 * 3)",
12670
- "3/4": "calc(100% / 3 * 4)",
12671
- "6/4": "calc(100% / 6 * 4)",
12672
- "4/6": "calc(100% / 4 * 6)",
12673
- "16/9": "calc(100% / 16 * 9)",
12674
- "9/16": "calc(100% / 9 * 16)",
12675
- "21/9": "calc(100% / 21 * 9)",
12676
- "9/21": "calc(100% / 9 * 21)",
12677
- "1/1": "100%"
12678
- }[ratio];
12679
- }
12680
- var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12681
- var Image = react.forwardRef(
12682
- ({
12683
- ratio,
12684
- disabledEffect = false,
12685
- effect = "blur",
12686
- src,
12687
- wrapperProps,
12688
- style,
12689
- sx,
12690
- ...other
12691
- }, ref) => {
12692
- const content = /* @__PURE__ */ jsxRuntime.jsx(
12693
- material.Box,
12694
- {
12695
- component: reactLazyLoadImageComponent.LazyLoadImage,
12696
- wrapperClassName: "wrapper",
12697
- effect: disabledEffect ? void 0 : effect,
12698
- placeholderSrc: disabledEffect ? TRANSPARENT_PNG : TRANSPARENT_PNG,
12699
- src,
12700
- wrapperProps,
12701
- style,
12702
- sx: {
12703
- width: 1,
12704
- height: 1,
12705
- objectFit: "cover",
12706
- ...sx
12707
- },
12708
- ...other
12709
- }
12710
- );
12711
- if (ratio) {
12712
- return /* @__PURE__ */ jsxRuntime.jsx(
12713
- material.Box,
12714
- {
12715
- ref,
12716
- component: "span",
12717
- sx: {
12718
- width: 1,
12719
- lineHeight: 1,
12720
- display: "block",
12721
- overflow: "hidden",
12722
- position: "relative",
12723
- pt: getRatio(ratio),
12724
- "& .wrapper": {
12725
- top: 0,
12726
- left: 0,
12727
- width: 1,
12728
- height: 1,
12729
- position: "absolute",
12730
- backgroundSize: "cover !important"
12731
- },
12732
- ...sx
12733
- },
12734
- children: content
12735
- }
12736
- );
12737
- }
12738
- return /* @__PURE__ */ jsxRuntime.jsx(
12739
- material.Box,
12740
- {
12741
- ref,
12742
- component: "span",
12743
- sx: {
12744
- lineHeight: 1,
12745
- display: "block",
12746
- overflow: "hidden",
12747
- position: "relative",
12748
- "& .wrapper": {
12749
- width: 1,
12750
- height: 1,
12751
- backgroundSize: "cover !important"
12752
- },
12753
- ...sx
12754
- },
12755
- children: content
12756
- }
12757
- );
12758
- }
12759
- );
12760
- Image.displayName = "Image";
12761
- var Image_default = Image;
12762
-
12763
- // src/animate/variants/transition.ts
12764
- var varTranEnter = (props) => {
12765
- const duration = (props == null ? void 0 : props.durationIn) != null ? props == null ? void 0 : props.durationIn : 0.64;
12766
- const ease = (props == null ? void 0 : props.easeIn) != null ? props == null ? void 0 : props.easeIn : [0.43, 0.13, 0.23, 0.96];
12767
- return { duration, ease };
12768
- };
12769
- var varTranExit = (props) => {
12770
- const duration = (props == null ? void 0 : props.durationOut) != null ? props == null ? void 0 : props.durationOut : 0.48;
12771
- const ease = (props == null ? void 0 : props.easeOut) != null ? props == null ? void 0 : props.easeOut : [0.43, 0.13, 0.23, 0.96];
12772
- return { duration, ease };
12773
- };
12774
-
12775
- // src/animate/variants/fade.ts
12776
- var varFade = (props) => {
12777
- const distance = (props == null ? void 0 : props.distance) != null ? props == null ? void 0 : props.distance : 120;
12778
- const durationIn = props == null ? void 0 : props.durationIn;
12779
- const durationOut = props == null ? void 0 : props.durationOut;
12780
- const easeIn = props == null ? void 0 : props.easeIn;
12781
- const easeOut = props == null ? void 0 : props.easeOut;
12782
- return {
12783
- // IN
12784
- in: {
12785
- initial: { opacity: 0 },
12786
- animate: { opacity: 1, transition: varTranEnter },
12787
- exit: { opacity: 0, transition: varTranExit }
12788
- },
12789
- inUp: {
12790
- initial: { y: distance, opacity: 0 },
12791
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12792
- exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12793
- },
12794
- inDown: {
12795
- initial: { y: -distance, opacity: 0 },
12796
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12797
- exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12798
- },
12799
- inLeft: {
12800
- initial: { x: -distance, opacity: 0 },
12801
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12802
- exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12803
- },
12804
- inRight: {
12805
- initial: { x: distance, opacity: 0 },
12806
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12807
- exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12808
- },
12809
- // OUT
12810
- out: {
12811
- initial: { opacity: 1 },
12812
- animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12813
- exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12814
- },
12815
- outUp: {
12816
- initial: { y: 0, opacity: 1 },
12817
- animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12818
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12819
- },
12820
- outDown: {
12821
- initial: { y: 0, opacity: 1 },
12822
- animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12823
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12824
- },
12825
- outLeft: {
12826
- initial: { x: 0, opacity: 1 },
12827
- animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12828
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12829
- },
12830
- outRight: {
12831
- initial: { x: 0, opacity: 1 },
12832
- animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12833
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12834
- }
12835
- };
12836
- };
12837
- function formatBytes(bytes) {
12838
- const b = bytes != null ? bytes : 0;
12839
- if (b === 0)
12840
- return "0 Bytes";
12841
- const k = 1024;
12842
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12843
- const i = Math.floor(Math.log(b) / Math.log(k));
12844
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12845
- }
12846
- function MultiFilePreview({
12847
- thumbnail,
12848
- files,
12849
- onRemove,
12850
- sx,
12851
- isClickable,
12852
- isEditable,
12853
- onDeleteButtonClick,
12854
- onPrivacyUpdateClick
12855
- }) {
12856
- if ((files == null ? void 0 : files.length) == null) {
12857
- return null;
12858
- }
12859
- const [anchorEl, setAnchorEl] = react.useState(null);
12860
- const [selectedFile, setSelectedFile] = react.useState(null);
12861
- const canViewPrivate = true;
12862
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: files.map((file) => {
12863
- const typedFile = file;
12864
- const { key, name = "", size = 0 } = fileData(typedFile);
12865
- const isStringFile = typeof file === "string";
12866
- if (thumbnail === true) {
12867
- return (
12868
- // @ts-ignore
12869
- /* @__PURE__ */ jsxRuntime.jsxs(
12870
- material.Stack,
12871
- {
12872
- component: framerMotion.m.div,
12873
- ...varFade().inUp,
12874
- alignItems: "center",
12875
- display: "inline-flex",
12876
- justifyContent: "center",
12877
- sx: {
12878
- m: 0.5,
12879
- width: 80,
12880
- height: 80,
12881
- borderRadius: 1.25,
12882
- overflow: "hidden",
12883
- position: "relative",
12884
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12885
- ...sx
12886
- },
12887
- children: [
12888
- /* @__PURE__ */ jsxRuntime.jsx(
12889
- FileThumbnail,
12890
- {
12891
- tooltip: true,
12892
- imageView: true,
12893
- file: typedFile,
12894
- sx: { position: "absolute" },
12895
- imgSx: { position: "absolute" }
12896
- }
12897
- ),
12898
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(
12899
- material.IconButton,
12900
- {
12901
- size: "small",
12902
- onClick: () => onRemove(typedFile),
12903
- sx: {
12904
- top: 4,
12905
- right: 4,
12906
- p: "1px",
12907
- position: "absolute",
12908
- color: (theme) => styles.alpha(theme.palette.common.white, 0.72),
12909
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.48),
12910
- "&:hover": {
12911
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.72)
12912
- }
12913
- },
12914
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill", width: 16 })
12915
- }
12916
- )
12917
- ]
12918
- },
12919
- key
12920
- )
12921
- );
12922
- }
12923
- return (
12924
- // @ts-ignore
12925
- /* @__PURE__ */ jsxRuntime.jsxs(
12926
- material.Stack,
12927
- {
12928
- component: framerMotion.m.div,
12929
- ...varFade().inUp,
12930
- spacing: 2,
12931
- direction: "row",
12932
- alignItems: "center",
12933
- sx: {
12934
- my: 1,
12935
- px: 1,
12936
- py: 0.75,
12937
- borderRadius: 0.75,
12938
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12939
- ...sx,
12940
- opacity: "1 !important",
12941
- transform: "none !important"
12942
- },
12943
- children: [
12944
- (typedFile == null ? void 0 : typedFile.preview) != null ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (typedFile == null ? void 0 : typedFile.is_private) === true && !canViewPrivate ? /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "garden:lock-locked-fill-12", sx: { width: "26px", height: "26px" } }) : (
12945
- // eslint-disable-next-line @next/next/no-img-element
12946
- /* @__PURE__ */ jsxRuntime.jsx(
12947
- "img",
12948
- {
12949
- src: `${typedFile == null ? void 0 : typedFile.preview}`,
12950
- alt: (typedFile == null ? void 0 : typedFile.name) != null ? typedFile == null ? void 0 : typedFile.name : "",
12951
- style: { width: "40px", height: "40px" }
12952
- }
12953
- )
12954
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { file: typedFile }),
12955
- /* @__PURE__ */ jsxRuntime.jsxs(
12956
- material.Stack,
12957
- {
12958
- flexGrow: 1,
12959
- sx: { minWidth: 0, cursor: "pointer" },
12960
- onClick: () => {
12961
- if (isClickable === true && typedFile.url != null) {
12962
- window.open(`${typedFile == null ? void 0 : typedFile.url}`, "_blank");
12963
- }
12964
- },
12965
- children: [
12966
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle2", sx: { wordBreak: "break-all", whiteSpace: "break-spaces" }, noWrap: true, children: isStringFile ? file : name }),
12967
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", sx: { color: "text.secondary" }, children: isStringFile ? "" : formatBytes(size) })
12968
- ]
12969
- }
12970
- ),
12971
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { edge: "end", size: "small", onClick: () => onRemove(typedFile), children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill" }) }),
12972
- isEditable === true && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12973
- /* @__PURE__ */ jsxRuntime.jsx(
12974
- material.IconButton,
12975
- {
12976
- edge: "end",
12977
- size: "small",
12978
- onClick: (event) => {
12979
- event.stopPropagation();
12980
- setAnchorEl(event.currentTarget);
12981
- setSelectedFile(typedFile);
12982
- },
12983
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:more-horizontal-fill" })
12984
- }
12985
- ),
12986
- /* @__PURE__ */ jsxRuntime.jsxs(
12987
- material.Menu,
12988
- {
12989
- anchorEl,
12990
- open: Boolean(anchorEl) && selectedFile === file,
12991
- onClose: () => setAnchorEl(null),
12992
- children: [
12993
- /* @__PURE__ */ jsxRuntime.jsxs(
12994
- material.MenuItem,
12995
- {
12996
- onClick: (e) => {
12997
- e.stopPropagation();
12998
- setAnchorEl(null);
12999
- if (onDeleteButtonClick) {
13000
- onDeleteButtonClick(typedFile);
13001
- }
13002
- },
13003
- children: [
13004
- /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:trash-2-outline", width: 20 }),
13005
- "Delete"
13006
- ]
13007
- }
13008
- ),
13009
- /* @__PURE__ */ jsxRuntime.jsxs(
13010
- material.MenuItem,
13011
- {
13012
- onClick: (e) => {
13013
- e.stopPropagation();
13014
- if (onPrivacyUpdateClick) {
13015
- onPrivacyUpdateClick(typedFile);
13016
- }
13017
- },
13018
- children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(
13020
- Iconify_default,
13021
- {
13022
- icon: (typedFile == null ? void 0 : typedFile.is_private) === true ? "eva:unlock-outline" : "eva:lock-outline",
13023
- width: 20
13024
- }
13025
- ),
13026
- (typedFile == null ? void 0 : typedFile.is_private) === true ? "Public" : "Private"
13027
- ]
13028
- }
13029
- )
13030
- ]
13031
- }
13032
- )
13033
- ] })
13034
- ]
13035
- },
13036
- key
13037
- )
13038
- );
13039
- }) });
13040
- }
13041
- function SingleFilePreview({ file }) {
13042
- if (!file) {
13043
- return null;
13044
- }
13045
- const imgUrl = (typeof file === "string" ? file : file.preview) || "";
13046
- return /* @__PURE__ */ jsxRuntime.jsx(
13047
- material.Box,
13048
- {
13049
- sx: {
13050
- position: "relative",
13051
- width: "100%",
13052
- height: "100%",
13053
- "& .wrapper": {
13054
- width: "100%",
13055
- height: "100%",
13056
- position: "relative"
13057
- }
13058
- },
13059
- children: /* @__PURE__ */ jsxRuntime.jsx(
13060
- Image_default,
13061
- {
13062
- src: imgUrl,
13063
- effect: "opacity",
13064
- wrapperProps: {
13065
- style: {
13066
- width: "100%",
13067
- height: "100%",
13068
- position: "relative"
13069
- }
13070
- },
13071
- style: {
13072
- top: 8,
13073
- left: 8,
13074
- zIndex: 8,
13075
- borderRadius: 1,
13076
- position: "absolute",
13077
- width: "calc(100% - 16px)",
13078
- height: "calc(100% - 16px)",
13079
- objectFit: "cover"
13080
- }
13081
- }
13082
- )
13083
- }
13084
- );
13085
- }
13086
- function BackgroundIllustration() {
13087
- const theme = styles.useTheme();
13088
- const PRIMARY_MAIN = theme.palette.primary.main;
13089
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13090
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "BG", x1: "19.496%", x2: "77.479%", y1: "71.822%", y2: "16.69%", children: [
13091
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: PRIMARY_MAIN }),
13092
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: PRIMARY_MAIN, stopOpacity: "0" })
13093
- ] }) }),
13094
- /* @__PURE__ */ jsxRuntime.jsx(
13095
- "path",
13096
- {
13097
- fill: "url(#BG)",
13098
- fillRule: "nonzero",
13099
- d: "M0 198.78c0 41.458 14.945 79.236 39.539 107.786 28.214 32.765 69.128 53.365 114.734 53.434a148.44 148.44 0 0056.495-11.036c9.051-3.699 19.182-3.274 27.948 1.107a75.779 75.779 0 0033.957 8.01c5.023 0 9.942-.494 14.7-1.433 13.58-2.67 25.94-8.99 36.09-17.94 6.378-5.627 14.547-8.456 22.897-8.446h.142c27.589 0 53.215-8.732 74.492-23.696 19.021-13.36 34.554-31.696 44.904-53.224C474.92 234.58 480 213.388 480 190.958c0-76.93-59.774-139.305-133.498-139.305-7.516 0-14.88.663-22.063 1.899C305.418 21.42 271.355 0 232.499 0a103.651 103.651 0 00-45.88 10.661c-13.24 6.487-25.011 15.705-34.64 26.939-32.698.544-62.931 11.69-87.676 30.291C25.351 97.155 0 144.882 0 198.781z",
13100
- opacity: "0.2"
13101
- }
13102
- )
13103
- ] });
13104
- }
13105
- var BackgroundIllustration_default = react.memo(BackgroundIllustration);
13106
- function UploadIllustration({ ...other }) {
13107
- const theme = styles.useTheme();
13108
- const PRIMARY_MAIN = theme.palette.primary.main;
13109
- const PRIMARY_DARK = theme.palette.primary.dark;
13110
- const PRIMARY_DARKER = theme.palette.primary.dark;
13111
- return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { ...other, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 480 360", xmlns: "http://www.w3.org/2000/svg", children: [
13112
- /* @__PURE__ */ jsxRuntime.jsx(BackgroundIllustration_default, {}),
13113
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "linearGradient-2", x1: "30.113%", x2: "30.113%", y1: "0%", y2: "100%", children: [
13114
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopOpacity: "0" }),
13115
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%" })
13116
- ] }) }),
13117
- /* @__PURE__ */ jsxRuntime.jsx(
13118
- "path",
13119
- {
13120
- fill: "#FF4842",
13121
- fillRule: "nonzero",
13122
- d: "M293.006 206.192c-2.248 2.672-4.676 2.628-6.123 2.251l.054-1.384s5.979-2.733 5.827-2.159c-.057.215.057.733.242 1.292zM309.393 209.217c-3.818 2.206-6.058-.38-6.578-1.112.32-.84.801-2.204.703-2.592-.144-.577 5.827 2.155 5.827 2.155l.048 1.549zM305.303 187.204s3.632-2.093 4.425-1.151c.792.942-4.425 1.151-4.425 1.151zM307.497 188.355s-.598.299.721.681c1.318.383-.721-.681-.721-.681zM285.532 182.599c-.123.036 3.022 2.123 5.862.395-.012 0-5.154-.61-5.862-.395zM291.239 186.591s-.861 1.692-2.625 1.943c-1.764.251 2.625-1.943 2.625-1.943zM302.785 190.262s4.138 6.578 3.346 8.129c-.793 1.552-3.346-8.129-3.346-8.129zM294.62 216.416c0 .368 0 .712-.036.996-.107 1.33-3.381.828-3.381.828-2.99.416-4.066-1.019-4.422-2.392a5.444 5.444 0 01-.164-1.363 5.606 5.606 0 01.054-.819v-.272a1.998 1.998 0 011.859.379c1.331 1.08 3.095.252 3.095.252s1.294.107 1.793.538c.281.242.745-.341 1.098-.897.021.359.054 1.007.074 1.701.024.356.03.714.03 1.049z",
13123
- opacity: "0.05"
13124
- }
13125
- ),
13126
- /* @__PURE__ */ jsxRuntime.jsx(
13127
- "path",
13128
- {
13129
- fill: "#FF4842",
13130
- fillRule: "nonzero",
13131
- d: "M289.37 216.339s-.897.879-2.589-.479a5.444 5.444 0 01-.164-1.363c.864.658 2.466 1.842 2.753 1.842zM294.62 216.416a.67.67 0 01-.519.132.672.672 0 01-.452-.287c.348-.266.669-.566.956-.897.009.359.015.717.015 1.052zM301.637 217.032c0 .371 0 .715.033.996.108 1.333 3.382.828 3.382.828 2.989.419 4.066-1.017 4.421-2.392a5.728 5.728 0 00.111-2.182v-.272a2.024 2.024 0 00-1.862.379c-1.331 1.08-3.092.251-3.092.251s-1.294.111-1.794.542c-.281.242-.744-.341-1.094-.897a61.426 61.426 0 00-.078 1.701c-.024.35-.03.708-.027 1.046z",
13132
- opacity: "0.05"
13133
- }
13134
- ),
13135
- /* @__PURE__ */ jsxRuntime.jsx(
13136
- "path",
13137
- {
13138
- fill: "#FF4842",
13139
- fillRule: "nonzero",
13140
- d: "M306.887 216.949s.897.879 2.587-.479c.112-.444.169-.901.167-1.36-.867.655-2.47 1.839-2.754 1.839zM301.637 217.032a.67.67 0 00.969-.155 6.35 6.35 0 01-.957-.897c-.009.356-.014.714-.012 1.052zM319.614 106.269c.063-.138.123-.275.18-.41.057-.134.077-.209.11-.317-.11.237-.206.48-.29.727z",
13141
- opacity: "0.05"
13142
- }
13143
- ),
13144
- /* @__PURE__ */ jsxRuntime.jsx(
13145
- "path",
13146
- {
13147
- fill: PRIMARY_DARKER,
13148
- fillRule: "nonzero",
13149
- d: "M157.592 279.461a4.114 4.114 0 01-.917-3.131l13.196-107.979 1.094-8.97a4.142 4.142 0 014.078-3.635l38.654-.257a4.135 4.135 0 004.108-4.249l-.015-.409a4.14 4.14 0 014.135-4.279h40.619a4.134 4.134 0 014.098 4.682 4.137 4.137 0 003.995 4.682l39.01.996a4.13 4.13 0 013.97 4.831l-19.502 113.909-.368 2.152a4.042 4.042 0 01-.598 1.543l-135.557.114z"
13150
- }
13151
- ),
13152
- /* @__PURE__ */ jsxRuntime.jsx(
13153
- "path",
13154
- {
13155
- fill: "#FFF",
13156
- fillRule: "nonzero",
13157
- d: "M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",
13158
- transform: "rotate(34.64 262.678 162.06)"
13159
- }
13160
- ),
13161
- /* @__PURE__ */ jsxRuntime.jsx(
13162
- "path",
13163
- {
13164
- fill: "#FFC107",
13165
- fillRule: "nonzero",
13166
- d: "M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",
13167
- transform: "rotate(34.804 278.687 137.92)"
13168
- }
13169
- ),
13170
- /* @__PURE__ */ jsxRuntime.jsx(
13171
- "path",
13172
- {
13173
- fill: "#FFC107",
13174
- fillRule: "nonzero",
13175
- d: "M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",
13176
- opacity: "0.5",
13177
- transform: "rotate(34.64 268.35 153.887)"
13178
- }
13179
- ),
13180
- /* @__PURE__ */ jsxRuntime.jsx(
13181
- "path",
13182
- {
13183
- fill: "#FFC107",
13184
- fillRule: "nonzero",
13185
- d: "M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",
13186
- opacity: "0.3",
13187
- transform: "rotate(34.64 257.265 169.926)"
13188
- }
13189
- ),
13190
- /* @__PURE__ */ jsxRuntime.jsx(
13191
- "path",
13192
- {
13193
- fill: "#FFF",
13194
- fillRule: "nonzero",
13195
- d: "M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",
13196
- transform: "rotate(16.29 248.893 159.951)"
13197
- }
13198
- ),
13199
- /* @__PURE__ */ jsxRuntime.jsx(
13200
- "path",
13201
- {
13202
- fill: "#FF4842",
13203
- fillRule: "nonzero",
13204
- d: "M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",
13205
- transform: "rotate(16.29 257.127 131.835)"
13206
- }
13207
- ),
13208
- /* @__PURE__ */ jsxRuntime.jsx(
13209
- "path",
13210
- {
13211
- fill: "#FF4842",
13212
- fillRule: "nonzero",
13213
- d: "M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",
13214
- opacity: "0.5",
13215
- transform: "rotate(16.29 251.658 150.547)"
13216
- }
13217
- ),
13218
- /* @__PURE__ */ jsxRuntime.jsx(
13219
- "path",
13220
- {
13221
- fill: "#FF4842",
13222
- fillRule: "nonzero",
13223
- d: "M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",
13224
- opacity: "0.3",
13225
- transform: "rotate(16.29 246.19 169.256)"
13226
- }
13227
- ),
13228
- /* @__PURE__ */ jsxRuntime.jsx(
13229
- "path",
13230
- {
13231
- fill: "#FFF",
13232
- fillRule: "nonzero",
13233
- d: "M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",
13234
- transform: "rotate(4.6 241.52 160.258)"
13235
- }
13236
- ),
13237
- /* @__PURE__ */ jsxRuntime.jsx(
13238
- "path",
13239
- {
13240
- fill: "#1890FF",
13241
- fillRule: "nonzero",
13242
- d: "M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",
13243
- transform: "rotate(4.6 243.874 131.06)"
13244
- }
13245
- ),
13246
- /* @__PURE__ */ jsxRuntime.jsx(
13247
- "path",
13248
- {
13249
- fill: "#1890FF",
13250
- fillRule: "nonzero",
13251
- d: "M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",
13252
- opacity: "0.5",
13253
- transform: "rotate(4.6 242.308 150.487)"
13254
- }
13255
- ),
13256
- /* @__PURE__ */ jsxRuntime.jsx(
13257
- "path",
13258
- {
13259
- fill: "#1890FF",
13260
- fillRule: "nonzero",
13261
- d: "M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",
13262
- opacity: "0.3",
13263
- transform: "rotate(4.6 240.746 169.92)"
13264
- }
13265
- ),
13266
- /* @__PURE__ */ jsxRuntime.jsx(
13267
- "path",
13268
- {
13269
- fill: "#FFF",
13270
- fillRule: "nonzero",
13271
- d: "M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",
13272
- transform: "rotate(-2.61 236.157 162.002)"
13273
- }
13274
- ),
13275
- /* @__PURE__ */ jsxRuntime.jsx(
13276
- "path",
13277
- {
13278
- fill: PRIMARY_MAIN,
13279
- fillRule: "nonzero",
13280
- d: "M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",
13281
- transform: "rotate(-2.61 234.825 132.734)"
13282
- }
13283
- ),
13284
- /* @__PURE__ */ jsxRuntime.jsx(
13285
- "path",
13286
- {
13287
- fill: PRIMARY_MAIN,
13288
- fillRule: "nonzero",
13289
- d: "M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",
13290
- opacity: "0.5",
13291
- transform: "rotate(-2.862 236.39 151.563)"
13292
- }
13293
- ),
13294
- /* @__PURE__ */ jsxRuntime.jsx(
13295
- "path",
13296
- {
13297
- fill: PRIMARY_MAIN,
13298
- fillRule: "nonzero",
13299
- d: "M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",
13300
- opacity: "0.3",
13301
- transform: "rotate(-2.61 236.599 171.683)"
13302
- }
13303
- ),
13304
- /* @__PURE__ */ jsxRuntime.jsx(
13305
- "path",
13306
- {
13307
- fill: "#F4F6F8",
13308
- fillRule: "nonzero",
13309
- d: "M232.679 225.726l-20.294 7.851-29.661 11.466c-1.121-2.093-2.771-4.921-4.813-8.297-7.026-11.642-18.65-29.75-29.001-45.665-11.66-17.938-21.696-33.075-21.696-33.075l7.265-2.093 59.346-17.23 38.854 87.043z"
13310
- }
13311
- ),
13312
- /* @__PURE__ */ jsxRuntime.jsx(
13313
- "path",
13314
- {
13315
- fill: "#000",
13316
- fillRule: "nonzero",
13317
- d: "M232.679 225.726l-20.294 7.851a152.535 152.535 0 01-34.484 3.169c-7.026-11.642-18.65-29.75-29-45.665l-14.42-35.18 59.343-17.218 38.855 87.043z",
13318
- opacity: "0.1"
13319
- }
13320
- ),
13321
- /* @__PURE__ */ jsxRuntime.jsx(
13322
- "path",
13323
- {
13324
- fill: PRIMARY_MAIN,
13325
- fillRule: "nonzero",
13326
- d: "M247.777 220.841s-31.526 18.65-78.596 14.432l-37.525-91.486 17.984-3.091 62.168-10.677 35.279 89.043.69 1.779z"
13327
- }
13328
- ),
13329
- /* @__PURE__ */ jsxRuntime.jsx(
13330
- "path",
13331
- {
13332
- fill: "#FF4842",
13333
- fillRule: "nonzero",
13334
- d: "M247.075 219.074c-7.424.365-16.013.329-24.654-.702-9.351-1.101-18.757-3.367-26.82-7.523-6.742-3.471-12.506-7.247-17.532-11.776-13.074-11.759-21.164-28.579-28.429-58.365l62.168-10.677 35.267 89.043z",
13335
- opacity: "0.1"
13336
- }
13337
- ),
13338
- /* @__PURE__ */ jsxRuntime.jsx(
13339
- "path",
13340
- {
13341
- fill: "#FFF",
13342
- fillRule: "nonzero",
13343
- d: "M270.203 213.959s-23.239 4.55-46.894 1.749c-9.351-1.1-18.757-3.367-26.82-7.522-6.742-3.471-12.503-7.247-17.532-11.777-16.181-14.557-24.725-36.866-33.536-81.918 0 0 38.633 9.325 76.836-11.101-.012.015 12.865 80.373 47.946 110.569z"
13344
- }
13345
- ),
13346
- /* @__PURE__ */ jsxRuntime.jsx(
13347
- "path",
13348
- {
13349
- fill: PRIMARY_MAIN,
13350
- fillRule: "nonzero",
13351
- d: "M165.405 131.03s31.416-1.776 40.187-8.548l1.331 4.276s-20.758 9.157-41.518 9.268v-4.996zM165.405 152.137s30.417-1.665 53.399-12.766l.777 1.776s-18.237 10.647-54.176 13.433v-2.443zM167.853 160.362s30.418-1.665 53.397-12.766l.777 1.776s-18.237 10.643-54.174 13.433v-2.443zM170.299 168.599s30.417-1.666 53.399-12.766l.774 1.775s-18.237 10.647-54.173 13.433v-2.442zM172.748 176.835s30.417-1.665 53.396-12.766l.777 1.776s-18.237 10.647-54.173 13.433v-2.443zM175.193 185.075s30.417-1.665 53.399-12.766l.774 1.776s-18.237 10.643-54.173 13.433v-2.443z",
13352
- opacity: "0.3"
13353
- }
13354
- ),
13355
- /* @__PURE__ */ jsxRuntime.jsx(
13356
- "path",
13357
- {
13358
- fill: PRIMARY_MAIN,
13359
- fillRule: "nonzero",
13360
- d: "M389.069 287.344s-12.641-.762-11.152 8.097c0 0-.299 1.563 1.124 2.275 0 0 .021-.658 1.295-.434.454.077.916.099 1.375.066a2.832 2.832 0 001.677-.694c.468-.409 3.555-1.468 4.936-7.274 0 0 1.023-1.267.981-1.593l-2.132.897s.73 1.54.156 2.816c0 0-.069-2.759-.479-2.691-.083 0-1.109.533-1.109.533s1.253 2.69.299 4.628c0 0 .359-3.304-.699-4.434l-1.495.876s1.465 2.768.472 5.029c0 0 .254-3.465-.789-4.817l-1.361 1.062s1.379 2.729.539 4.604c0 0-.111-4.036-.835-4.341 0 0-1.195 1.049-1.369 1.494 0 0 .942 1.98.356 3.026 0 0-.359-2.691-.652-2.691 0 0-1.196 1.794-1.309 2.99 0 0 .051-1.818 1.022-3.172a3.593 3.593 0 00-1.818.942s.186-1.262 2.111-1.37c0 0 .981-1.351 1.241-1.435 0 0-1.914-.158-3.074.356 0 0 1.023-1.196 3.427-.649l1.342-1.094s-2.52-.347-3.588.036c0 0 1.229-1.052 3.95-.299l1.462-.873s-2.147-.463-3.426-.299c0 0 1.348-.729 3.856.06l1.044-.47s-1.573-.299-2.033-.358c-.461-.06-.488-.174-.488-.174a5.426 5.426 0 012.957.329s2.222-.813 2.186-.954z"
13361
- }
13362
- ),
13363
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "380.363", cy: "298.487", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "8.945", ry: "1.513" }),
13364
- /* @__PURE__ */ jsxRuntime.jsx(
13365
- "path",
13366
- {
13367
- fill: PRIMARY_MAIN,
13368
- fillRule: "nonzero",
13369
- d: "M394.956 258.102s-7.125-.43-6.279 4.565a1.218 1.218 0 00.631 1.283s.015-.371.733-.245c.255.042.515.054.774.036.349-.023.681-.159.945-.389.264-.23 2.003-.828 2.783-4.102 0 0 .577-.714.553-.897l-1.196.511s.41.87.087 1.591c0 0-.039-1.558-.269-1.522-.048 0-.625.299-.625.299s.706 1.495.173 2.61c0 0 .204-1.862-.394-2.502l-.846.496s.825 1.561.266 2.834c0 0 .143-1.955-.446-2.714l-.765.598s.774 1.539.299 2.595c0 0-.063-2.275-.469-2.446a4.75 4.75 0 00-.775.834s.532 1.118.204 1.707c0 0-.204-1.515-.368-1.521 0 0-.67 1.001-.739 1.689a3.671 3.671 0 01.577-1.794 2.007 2.007 0 00-1.025.532s.104-.711 1.196-.771c0 0 .553-.763.699-.81 0 0-1.079-.09-1.734.2 0 0 .577-.67 1.932-.365l.759-.619s-1.423-.194-2.024.021c0 0 .694-.598 2.227-.161l.826-.494a7.445 7.445 0 00-1.935-.164s.763-.413 2.174.033l.598-.263s-.897-.177-1.148-.203c-.252-.027-.275-.099-.275-.099a3.078 3.078 0 011.668.185s1.232-.46 1.208-.538z"
13370
- }
13371
- ),
13372
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "390.052", cy: "264.383", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "5.044", ry: "1" }),
13373
- /* @__PURE__ */ jsxRuntime.jsx(
13374
- "path",
13375
- {
13376
- fill: PRIMARY_MAIN,
13377
- fillRule: "nonzero",
13378
- d: "M352.896 262.437s-8.604-.52-7.588 5.51a1.47 1.47 0 00.763 1.549s0-.449.897-.299c.309.052.623.067.935.045a1.923 1.923 0 001.142-.473c.318-.279 2.419-.998 3.361-4.951 0 0 .697-.861.667-1.085l-1.468.622s.496 1.046.104 1.916c0 0-.048-1.877-.326-1.835-.056 0-.753.364-.753.364s.852 1.824.209 3.152c0 0 .245-2.249-.475-3.02l-1.023.598s.996 1.886.32 3.423c0 0 .174-2.359-.535-3.289l-.927.724s.939 1.857.365 3.133c0 0-.072-2.747-.565-2.954 0 0-.81.715-.933 1.008 0 0 .64 1.348.242 2.06 0 0-.245-1.83-.445-1.839 0 0-.804 1.214-.897 2.042.04-.768.28-1.512.697-2.159a2.427 2.427 0 00-1.235.643s.125-.858 1.435-.933c0 0 .667-.92.846-.974 0 0-1.303-.111-2.093.239 0 0 .694-.807 2.329-.44l.915-.747s-1.713-.233-2.442.024c0 0 .837-.715 2.69-.191l.996-.598s-1.462-.314-2.335-.201c0 0 .921-.496 2.625.042l.711-.32s-1.07-.209-1.384-.242c-.314-.033-.329-.119-.329-.119a3.69 3.69 0 012.012.221s1.519-.553 1.492-.646z"
13379
- }
13380
- ),
13381
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "346.97", cy: "270.022", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "6.09", ry: "1.028" }),
13382
- /* @__PURE__ */ jsxRuntime.jsx(
13383
- "rect",
13384
- {
13385
- width: "51.026",
13386
- height: "91.312",
13387
- x: "303.926",
13388
- y: "69.211",
13389
- fill: "#FFF",
13390
- fillRule: "nonzero",
13391
- rx: "4.737",
13392
- transform: "rotate(-71.99 329.44 114.867)"
13393
- }
13394
- ),
13395
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "303.613", cy: "103.507", r: "9.376", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.2" }),
13396
- /* @__PURE__ */ jsxRuntime.jsx(
13397
- "path",
13398
- {
13399
- fill: PRIMARY_MAIN,
13400
- fillRule: "nonzero",
13401
- d: "M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",
13402
- opacity: "0.2",
13403
- transform: "rotate(-71.99 345.867 106.913)"
13404
- }
13405
- ),
13406
- /* @__PURE__ */ jsxRuntime.jsx(
13407
- "path",
13408
- {
13409
- fill: PRIMARY_MAIN,
13410
- fillRule: "nonzero",
13411
- d: "M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",
13412
- opacity: "0.2",
13413
- transform: "rotate(-71.99 334.312 110.042)"
13414
- }
13415
- ),
13416
- /* @__PURE__ */ jsxRuntime.jsx(
13417
- "path",
13418
- {
13419
- fill: PRIMARY_MAIN,
13420
- fillRule: "nonzero",
13421
- d: "M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",
13422
- opacity: "0.2",
13423
- transform: "rotate(-71.99 338.393 118.259)"
13424
- }
13425
- ),
13426
- /* @__PURE__ */ jsxRuntime.jsx(
13427
- "path",
13428
- {
13429
- fill: PRIMARY_MAIN,
13430
- fillRule: "nonzero",
13431
- d: "M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",
13432
- opacity: "0.2",
13433
- transform: "rotate(-71.99 339.79 125.599)"
13434
- }
13435
- ),
13436
- /* @__PURE__ */ jsxRuntime.jsx(
13437
- "path",
13438
- {
13439
- fill: PRIMARY_MAIN,
13440
- fillRule: "nonzero",
13441
- d: "M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",
13442
- opacity: "0.5",
13443
- transform: "rotate(-71.99 350.544 140.3)"
13444
- }
13445
- ),
13446
- /* @__PURE__ */ jsxRuntime.jsx(
13447
- "rect",
13448
- {
13449
- width: "50.3",
13450
- height: "78.305",
13451
- x: "291.549",
13452
- y: "174.486",
13453
- fill: "#FFF",
13454
- fillRule: "nonzero",
13455
- rx: "4",
13456
- transform: "rotate(-57.265 316.7 213.638)"
13457
- }
13458
- ),
13459
- /* @__PURE__ */ jsxRuntime.jsx(
13460
- "path",
13461
- {
13462
- fill: "#DFE3E8",
13463
- fillRule: "nonzero",
13464
- d: "M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",
13465
- transform: "rotate(-57.57 285.154 205.563)"
13466
- }
13467
- ),
13468
- /* @__PURE__ */ jsxRuntime.jsx(
13469
- "path",
13470
- {
13471
- fill: "#DFE3E8",
13472
- fillRule: "nonzero",
13473
- d: "M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",
13474
- transform: "rotate(-57.57 298.635 200.737)"
13475
- }
13476
- ),
13477
- /* @__PURE__ */ jsxRuntime.jsx(
13478
- "path",
13479
- {
13480
- fill: "#DFE3E8",
13481
- fillRule: "nonzero",
13482
- d: "M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",
13483
- transform: "rotate(-57.57 304.171 204.251)"
13484
- }
13485
- ),
13486
- /* @__PURE__ */ jsxRuntime.jsx(
13487
- "path",
13488
- {
13489
- fill: "#DFE3E8",
13490
- fillRule: "nonzero",
13491
- d: "M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",
13492
- transform: "rotate(-57.57 309.706 207.771)"
13493
- }
13494
- ),
13495
- /* @__PURE__ */ jsxRuntime.jsx(
13496
- "path",
13497
- {
13498
- fill: "#DFE3E8",
13499
- fillRule: "nonzero",
13500
- d: "M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",
13501
- transform: "rotate(-57.265 315.485 212.94)"
13502
- }
13503
- ),
13504
- /* @__PURE__ */ jsxRuntime.jsx(
13505
- "path",
13506
- {
13507
- fill: "#F4F6F8",
13508
- fillRule: "nonzero",
13509
- d: "M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",
13510
- transform: "rotate(-57.57 320.777 214.804)"
13511
- }
13512
- ),
13513
- /* @__PURE__ */ jsxRuntime.jsx(
13514
- "path",
13515
- {
13516
- fill: "#F4F6F8",
13517
- fillRule: "nonzero",
13518
- d: "M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",
13519
- transform: "rotate(-57.57 326.313 218.318)"
13520
- }
13521
- ),
13522
- /* @__PURE__ */ jsxRuntime.jsx(
13523
- "path",
13524
- {
13525
- fill: "#DFE3E8",
13526
- fillRule: "nonzero",
13527
- d: "M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",
13528
- transform: "rotate(-57.57 345.465 214.454)"
13529
- }
13530
- ),
13531
- /* @__PURE__ */ jsxRuntime.jsx(
13532
- "path",
13533
- {
13534
- fill: PRIMARY_MAIN,
13535
- fillRule: "nonzero",
13536
- d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z"
13537
- }
13538
- ),
13539
- /* @__PURE__ */ jsxRuntime.jsx(
13540
- "path",
13541
- {
13542
- fill: PRIMARY_DARK,
13543
- fillRule: "nonzero",
13544
- d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",
13545
- opacity: "0.243"
13546
- }
13547
- ),
13548
- /* @__PURE__ */ jsxRuntime.jsx(
13549
- "path",
13550
- {
13551
- fill: "url(#linearGradient-2)",
13552
- fillRule: "nonzero",
13553
- d: "M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",
13554
- opacity: "0.32"
13555
- }
13556
- ),
13557
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "119.593", cy: "258.664", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13558
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "101.03", cy: "260.545", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13559
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "108.459", cy: "265.905", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13560
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "89.193", cy: "265.433", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13561
- /* @__PURE__ */ jsxRuntime.jsx(
13562
- "path",
13563
- {
13564
- fill: PRIMARY_MAIN,
13565
- fillRule: "nonzero",
13566
- d: "M100.925 260.398s6.796-22.279-1.064-31.204c-5.881-6.676-12.557-5.877-15.547-5.052a5.528 5.528 0 00-3.564 2.963c-1.046 2.254-.858 5.913 6.521 10.186 12.35 7.151 13.119 16.96 13.119 16.96l.535 6.147z"
13567
- }
13568
- ),
13569
- /* @__PURE__ */ jsxRuntime.jsx(
13570
- "path",
13571
- {
13572
- stroke: PRIMARY_DARKER,
13573
- strokeLinecap: "round",
13574
- strokeWidth: "0.5",
13575
- d: "M85.382 227.302s20.031 6.278 15.546 33.096M97.083 229.547s-2.76 1.86-1.88 4.655M87.39 231.203s1.687-1.716 3.741-.768M95.31 239.832s2.963-1.495 3.728.379M102.638 242.962s-2.224-.176-2.263.897"
13576
- }
13577
- ),
13578
- /* @__PURE__ */ jsxRuntime.jsx(
13579
- "path",
13580
- {
13581
- fill: PRIMARY_MAIN,
13582
- fillRule: "nonzero",
13583
- d: "M101.2 260.575s-7.961-16.193-10.147-15.846c-1.037.17-1.516 1.196-1.734 2.218a6.516 6.516 0 00.434 3.941c1.13 2.601 4.165 7.519 11.447 9.687z"
13584
- }
13585
- ),
13586
- /* @__PURE__ */ jsxRuntime.jsx(
13587
- "path",
13588
- {
13589
- stroke: PRIMARY_DARKER,
13590
- strokeLinecap: "round",
13591
- strokeWidth: "0.5",
13592
- d: "M91.113 247.808s8.353 12.115 9.968 12.647"
13593
- }
13594
- ),
13595
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M90.344 249.701L92.293 249.701" }),
13596
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M92.68 254.132L95.738 254.263" }),
13597
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M94.542 250.586L94.21 252.179" }),
13598
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M97.792 255.432L97.732 256.879" }),
13599
- /* @__PURE__ */ jsxRuntime.jsx(
13600
- "path",
13601
- {
13602
- fill: PRIMARY_MAIN,
13603
- fillRule: "nonzero",
13604
- d: "M100.964 260.575s7.959-16.193 10.144-15.846c1.041.17 1.519 1.196 1.734 2.218a6.514 6.514 0 01-.433 3.941c-1.13 2.601-4.168 7.519-11.445 9.687z"
13605
- }
13606
- ),
13607
- /* @__PURE__ */ jsxRuntime.jsx(
13608
- "path",
13609
- {
13610
- stroke: PRIMARY_DARKER,
13611
- strokeLinecap: "round",
13612
- strokeWidth: "0.5",
13613
- d: "M111.051 247.808s-8.371 12.115-9.97 12.647"
13614
- }
13615
- ),
13616
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M111.82 249.701L109.871 249.701" }),
13617
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M109.485 254.132L106.426 254.263" }),
13618
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M107.622 250.586L107.954 252.179" }),
13619
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M104.372 255.432L104.432 256.879" }),
13620
- /* @__PURE__ */ jsxRuntime.jsx(
13621
- "path",
13622
- {
13623
- fill: PRIMARY_MAIN,
13624
- fillRule: "nonzero",
13625
- d: "M87.295 264.357a1.375 1.375 0 01-.452-.685.599.599 0 01.317-.697c.3-.11.598.09.837.299.24.21.512.431.81.38a1.237 1.237 0 01-.382-1.16.47.47 0 01.105-.236c.161-.174.454-.099.648.039.598.43.787 1.264.79 2.018.03-.277.03-.555 0-.831a.853.853 0 01.334-.727.938.938 0 01.476-.114.988.988 0 01.774.222.767.767 0 01-.03.947c-.229.257-.5.474-.801.64a1.805 1.805 0 00-.571.547.399.399 0 00-.042.096h-1.74a4.826 4.826 0 01-1.073-.738zM117.626 257.833a1.355 1.355 0 01-.452-.682.599.599 0 01.314-.696c.299-.111.598.089.837.299.239.209.509.436.817.391a1.236 1.236 0 01-.386-1.157.472.472 0 01.107-.236c.162-.173.455-.099.649.036.613.433.787 1.268.79 2.021a4.008 4.008 0 000-.834.852.852 0 01.299-.736.955.955 0 01.475-.11.998.998 0 01.774.218.768.768 0 01-.033.951 2.996 2.996 0 01-.798.64 1.767 1.767 0 00-.571.544.499.499 0 00-.042.098h-1.701a4.78 4.78 0 01-1.079-.747zM107.518 264.357a1.406 1.406 0 01-.455-.685.6.6 0 01.317-.697c.299-.11.598.09.837.299.239.21.505.437.816.395a1.247 1.247 0 01-.385-1.16.472.472 0 01.107-.236c.162-.174.455-.099.649.039.613.43.783 1.264.789 2.018.03-.277.03-.555 0-.832a.855.855 0 01.314-.735.93.93 0 01.476-.114.988.988 0 01.774.222.764.764 0 01-.033.947 3.028 3.028 0 01-.798.64 1.798 1.798 0 00-.571.547.411.411 0 00-.042.096h-1.734c-.385-.2-.742-.45-1.061-.744z"
13626
- }
13627
- ),
13628
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "84.467", cy: "87.003", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13629
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "395.425", cy: "138.681", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13630
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "279.178", cy: "66.467", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13631
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "97.4", cy: "122.68", r: "10.838", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13632
- /* @__PURE__ */ jsxRuntime.jsx(
13633
- "path",
13634
- {
13635
- fill: PRIMARY_DARK,
13636
- fillRule: "nonzero",
13637
- d: "M206.029 209.911c-7.975 0-14.44 6.465-14.44 14.44s6.465 14.44 14.44 14.44 14.44-6.465 14.44-14.44-6.465-14.44-14.44-14.44z"
13638
- }
13639
- ),
13640
- /* @__PURE__ */ jsxRuntime.jsx(
13641
- "path",
13642
- {
13643
- fill: PRIMARY_MAIN,
13644
- fillRule: "nonzero",
13645
- d: "M206.029 211.59c7.047 0 12.761 5.714 12.761 12.761 0 7.048-5.714 12.761-12.761 12.761-7.048 0-12.761-5.713-12.761-12.761.006-7.045 5.716-12.754 12.761-12.761",
13646
- opacity: "0.72"
13647
- }
13648
- ),
13649
- /* @__PURE__ */ jsxRuntime.jsx(
13650
- "path",
13651
- {
13652
- fill: PRIMARY_DARK,
13653
- fillRule: "nonzero",
13654
- d: "M200.058 225.406l-.699-.681a.721.721 0 010-1.065l6.127-5.984a.753.753 0 01.546-.231c.206 0 .404.083.545.231l6.127 5.978a.733.733 0 010 1.065l-.699.682a.768.768 0 01-1.091 0l-3.622-3.727v8.843a.725.725 0 01-.219.523.76.76 0 01-.534.217h-1.009a.75.75 0 01-.759-.74v-8.832l-3.622 3.726a.768.768 0 01-1.091-.005z"
13655
- }
13656
- )
13657
- ] }) });
13658
- }
13659
- var UploadIllustration_default = react.memo(UploadIllustration);
13660
- var StyledDropZone = styles.styled("div")(({ theme }) => ({
13661
- outline: "none",
13662
- cursor: "pointer",
13663
- overflow: "hidden",
13664
- position: "relative",
13665
- padding: theme.spacing(5),
13666
- borderRadius: theme.shape.borderRadius,
13667
- transition: theme.transitions.create("padding"),
13668
- backgroundColor: theme.palette.background.default,
13669
- border: `1px dashed ${styles.alpha(theme.palette.grey[500], 0.32)}`,
13670
- "&:hover": {
13671
- opacity: 0.72
13672
- }
13673
- }));
13674
- function Upload({
13675
- disabled,
13676
- multiple = false,
13677
- error,
13678
- helperText,
13679
- //
13680
- file,
13681
- onDelete,
13682
- //
13683
- files,
13684
- thumbnail,
13685
- onUpload,
13686
- onRemove,
13687
- onRemoveAll,
13688
- sx,
13689
- ...other
13690
- }) {
13691
- const { getRootProps, getInputProps, isDragActive, isDragReject, fileRejections } = reactDropzone.useDropzone({
12512
+ externalOnDelete == null ? void 0 : externalOnDelete();
12513
+ };
12514
+ const { getRootProps, getInputProps, isDragActive } = reactDropzone.useDropzone({
12515
+ onDrop: handleDrop,
12516
+ accept: accept ? { [accept]: [] } : void 0,
12517
+ maxFiles: multiple ? maxFiles - ((currentFiles == null ? void 0 : currentFiles.length) || 0) : 1,
12518
+ maxSize,
13692
12519
  multiple,
13693
- disabled,
13694
- ...other
12520
+ disabled: disabled || isMaxFilesReached,
12521
+ onDragEnter: () => setIsDragging(true),
12522
+ onDragLeave: () => setIsDragging(false),
12523
+ onDropAccepted: () => setIsDragging(false)
13695
12524
  });
13696
- const { t } = reactI18next.useTranslation();
13697
- const hasFile = !!file && !multiple;
13698
- const hasFiles = files && multiple && files.length > 0;
13699
- const isError = isDragReject || !!error;
13700
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { width: 1, position: "relative", ...sx }, children: [
13701
- /* @__PURE__ */ jsxRuntime.jsxs(
13702
- StyledDropZone,
12525
+ const renderPreview = (file, index) => {
12526
+ var _a2;
12527
+ const isImage = (_a2 = file.type) == null ? void 0 : _a2.startsWith("image/");
12528
+ const previewUrl = file.preview || (typeof file.file === "string" ? file.file : "");
12529
+ const fileName = file.name || (typeof file.file === "string" ? file.file.split("/").pop() : file.file.name);
12530
+ return /* @__PURE__ */ jsxRuntime.jsx(
12531
+ material.Paper,
13703
12532
  {
13704
- ...getRootProps(),
13705
- sx: {
13706
- ...isDragActive && {
13707
- opacity: 0.72
13708
- },
13709
- ...isError && {
13710
- color: "error.main",
13711
- bgcolor: "error.lighter",
13712
- borderColor: "error.light"
13713
- },
13714
- ...disabled && {
13715
- opacity: 0.48,
13716
- pointerEvents: "none"
12533
+ sx: [
12534
+ {
12535
+ position: "relative",
12536
+ p: 1,
12537
+ borderRadius: 1,
12538
+ overflow: "hidden",
12539
+ border: "1px solid",
12540
+ borderColor: "divider",
12541
+ "&:hover .file-actions": {
12542
+ opacity: 1
12543
+ }
13717
12544
  },
13718
- ...hasFile && {
13719
- padding: "12% 0"
13720
- }
13721
- },
13722
- children: [
13723
- /* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),
12545
+ ...Array.isArray(previewSx) ? previewSx : [previewSx]
12546
+ ],
12547
+ children: /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
12548
+ isImage && previewUrl ? /* @__PURE__ */ jsxRuntime.jsx(
12549
+ material.Avatar,
12550
+ {
12551
+ variant: "rounded",
12552
+ src: previewUrl,
12553
+ sx: { width: 48, height: 48, bgcolor: "background.paper" },
12554
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Image, {})
12555
+ }
12556
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
12557
+ material.Avatar,
12558
+ {
12559
+ variant: "rounded",
12560
+ sx: { width: 48, height: 48, bgcolor: "action.hover" },
12561
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.InsertDriveFile, {})
12562
+ }
12563
+ ),
12564
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", noWrap: true, sx: { flex: 1, maxWidth: 200 }, children: fileName }),
13724
12565
  /* @__PURE__ */ jsxRuntime.jsx(
13725
- Placeholder,
12566
+ material.Box,
13726
12567
  {
13727
- sx: {
13728
- ...hasFile && {
13729
- opacity: 0
12568
+ className: "file-actions",
12569
+ sx: { opacity: 0, transition: "opacity 0.2s" },
12570
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Remove", children: /* @__PURE__ */ jsxRuntime.jsx(
12571
+ material.IconButton,
12572
+ {
12573
+ size: "small",
12574
+ color: "error",
12575
+ onClick: (e) => {
12576
+ e.stopPropagation();
12577
+ handleRemove(index);
12578
+ },
12579
+ disabled,
12580
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Delete, { fontSize: "small" })
13730
12581
  }
13731
- }
12582
+ ) })
13732
12583
  }
13733
- ),
13734
- hasFile && /* @__PURE__ */ jsxRuntime.jsx(SingleFilePreview, { file })
13735
- ]
13736
- }
13737
- ),
13738
- helperText && helperText,
13739
- /* @__PURE__ */ jsxRuntime.jsx(RejectionFiles, { fileRejections }),
13740
- hasFile && onDelete && /* @__PURE__ */ jsxRuntime.jsx(
13741
- material.IconButton,
13742
- {
13743
- size: "small",
13744
- onClick: onDelete,
13745
- sx: {
13746
- top: 16,
13747
- right: 16,
13748
- zIndex: 9,
13749
- position: "absolute",
13750
- color: (theme) => styles.alpha(theme.palette.common.white, 0.8),
13751
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.72),
13752
- "&:hover": {
13753
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.48)
13754
- }
13755
- },
13756
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill", width: 18 })
13757
- }
13758
- ),
13759
- hasFiles === true && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13760
- /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { my: 3 }, children: /* @__PURE__ */ jsxRuntime.jsx(MultiFilePreview, { files, thumbnail, onRemove }) }),
13761
- /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "row", justifyContent: "flex-end", spacing: 1.5, children: [
13762
- onRemoveAll && /* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", variant: "outlined", size: "small", onClick: onRemoveAll, children: t("Remove all") }),
13763
- onUpload && /* @__PURE__ */ jsxRuntime.jsx(material.Button, { size: "small", variant: "contained", onClick: onUpload, children: t("Upload files") })
13764
- ] })
13765
- ] })
13766
- ] });
13767
- }
13768
- function Placeholder({ sx, ...other }) {
13769
- const { t } = reactI18next.useTranslation();
13770
- return /* @__PURE__ */ jsxRuntime.jsxs(
13771
- material.Stack,
13772
- {
13773
- spacing: 5,
13774
- alignItems: "center",
13775
- justifyContent: "center",
13776
- direction: {
13777
- xs: "column",
13778
- md: "row"
13779
- },
13780
- sx: {
13781
- width: 1,
13782
- textAlign: {
13783
- xs: "center",
13784
- md: "left"
13785
- },
13786
- ...sx
13787
- },
13788
- ...other,
13789
- children: [
13790
- /* @__PURE__ */ jsxRuntime.jsx(UploadIllustration_default, { sx: { width: 220 } }),
13791
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13792
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { gutterBottom: true, variant: "h5", children: t("Drop or Select file") }),
13793
- /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
13794
- t("Drop files here or click"),
13795
- /* @__PURE__ */ jsxRuntime.jsx(
13796
- material.Typography,
13797
- {
13798
- variant: "body2",
13799
- component: "span",
13800
- sx: {
13801
- mx: 0.5,
13802
- textDecoration: "underline"
13803
- },
13804
- children: t("browse")
13805
- }
13806
- ),
13807
- t("thorough your machine")
13808
- ] })
12584
+ )
13809
12585
  ] })
13810
- ]
13811
- }
13812
- );
13813
- }
13814
- async function blobToBase64(file) {
13815
- return new Promise((resolve, reject) => {
13816
- const reader = new FileReader();
13817
- reader.readAsDataURL(file);
13818
- reader.onloadend = function() {
13819
- const base64data = reader.result;
13820
- resolve(base64data);
13821
- };
13822
- reader.onerror = function(err) {
13823
- reject(err);
13824
- };
13825
- });
13826
- }
13827
- var AppUploadFile = ({
13828
- name,
13829
- sx,
13830
- uploadSx,
13831
- errorSx,
13832
- helperTextSx,
13833
- previewSx,
13834
- dropZoneSx,
13835
- ...rest
13836
- }) => {
13837
- var _a, _b, _c, _d, _e;
13838
- const { errors, touched, setFieldValue, values } = formik.useFormikContext();
13839
- const fieldError = _19__default.default.get(errors, name);
13840
- const isTouched = _19__default.default.get(touched, name);
13841
- let val = _19__default.default.get(values, name);
13842
- if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13843
- val = val ? [val] : [];
13844
- } else if (!((_b = rest.multiple) != null ? _b : false) && _19__default.default.isArray(val)) {
13845
- val = val[0];
13846
- }
13847
- const value = ((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
12586
+ },
12587
+ index
12588
+ );
12589
+ };
13848
12590
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx, children: [
13849
- /* @__PURE__ */ jsxRuntime.jsx(
13850
- Upload,
12591
+ /* @__PURE__ */ jsxRuntime.jsxs(
12592
+ material.Box,
13851
12593
  {
13852
- ...rest,
13853
- file: ((_d = rest.multiple) != null ? _d : false) ? void 0 : value,
13854
- files: ((_e = rest.multiple) != null ? _e : false) ? value : void 0,
13855
- error: Boolean(fieldError) && isTouched,
13856
- disabled: (rest == null ? void 0 : rest.maxFiles) !== null && (rest == null ? void 0 : rest.maxFiles) !== void 0 && (value == null ? void 0 : value.length) >= (rest == null ? void 0 : rest.maxFiles),
13857
- sx: [{
13858
- "& .MuiDropzoneArea-root": {
13859
- minHeight: 200,
12594
+ ...getRootProps(),
12595
+ sx: [
12596
+ {
12597
+ p: 3,
13860
12598
  border: "2px dashed",
13861
- borderColor: "divider",
13862
12599
  borderRadius: 1,
13863
- "&:hover": {
12600
+ bgcolor: isDragging ? "action.hover" : "background.paper",
12601
+ borderColor: isDragging ? "primary.main" : "divider",
12602
+ cursor: disabled ? "not-allowed" : "pointer",
12603
+ opacity: disabled ? 0.7 : 1,
12604
+ transition: "all 0.2s ease-in-out",
12605
+ "&:hover": !disabled && {
13864
12606
  borderColor: "primary.main",
13865
- backgroundColor: "action.hover"
13866
- },
13867
- ...dropZoneSx
13868
- },
13869
- "& .MuiDropzonePreviewList-root": {
13870
- ...previewSx
13871
- },
13872
- ...uploadSx
13873
- }],
13874
- onDrop: (fileVal) => {
13875
- (async () => {
13876
- var _a2;
13877
- const images = await Promise.all(
13878
- fileVal.map(async (single) => {
13879
- var _a3;
13880
- return {
13881
- preview: ((_a3 = single == null ? void 0 : single.type) == null ? void 0 : _a3.includes("image")) ? await blobToBase64(single) : void 0,
13882
- file: single
13883
- };
13884
- })
13885
- );
13886
- const currentValue = Array.isArray(value) ? value : [];
13887
- if (rest.multiple === true) {
13888
- if (currentValue.length >= ((_a2 = rest.maxFiles) != null ? _a2 : Infinity))
13889
- return;
13890
- setFieldValue(name, [...currentValue, ...images], true);
13891
- } else {
13892
- setFieldValue(name, images[0], true);
12607
+ bgcolor: "action.hover"
13893
12608
  }
13894
- })();
13895
- },
13896
- onDelete: () => {
13897
- var _a2;
13898
- if ((_a2 = rest.multiple) != null ? _a2 : false) {
13899
- setFieldValue(name, [], true);
13900
- } else {
13901
- setFieldValue(name, "", true);
13902
- }
13903
- },
13904
- onRemove: (e) => {
13905
- const afterFilter = val.filter((file) => {
13906
- var _a2;
13907
- if ((_a2 = file.file) != null ? _a2 : false) {
13908
- return !_19__default.default.isEqual(e, file.file);
12609
+ },
12610
+ ...Array.isArray(dropZoneSx) ? dropZoneSx : [dropZoneSx]
12611
+ ],
12612
+ children: [
12613
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),
12614
+ /* @__PURE__ */ jsxRuntime.jsxs(
12615
+ material.Stack,
12616
+ {
12617
+ spacing: 1,
12618
+ alignItems: "center",
12619
+ justifyContent: "center",
12620
+ textAlign: "center",
12621
+ children: [
12622
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: isDragActive ? "Drop the files here..." : `Drag & drop ${multiple ? "files" : "a file"} here, or click to select ${multiple ? "files" : "a file"}` }),
12623
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "caption", color: "text.secondary", children: [
12624
+ accept,
12625
+ " \u2022 Max ",
12626
+ maxSize / (1024 * 1024),
12627
+ "MB per file \u2022",
12628
+ " ",
12629
+ multiple ? `Max ${maxFiles} files` : "Single file only"
12630
+ ] })
12631
+ ]
13909
12632
  }
13910
- return !_19__default.default.isEqual(e, file);
13911
- });
13912
- setFieldValue(name, afterFilter, true);
13913
- }
12633
+ )
12634
+ ]
13914
12635
  }
13915
12636
  ),
13916
- Boolean(fieldError) && Boolean(isTouched) && /* @__PURE__ */ jsxRuntime.jsx(
12637
+ ((_a = currentFiles == null ? void 0 : currentFiles.length) != null ? _a : 0) > 0 && /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { spacing: 1, sx: { mt: 2 }, children: currentFiles == null ? void 0 : currentFiles.map((file, index) => renderPreview(file, index)) }),
12638
+ Boolean(fieldError) && isTouched && /* @__PURE__ */ jsxRuntime.jsx(
13917
12639
  material.Typography,
13918
12640
  {
13919
12641
  variant: "caption",
13920
- sx: [{
13921
- color: "error.main",
13922
- display: "block",
13923
- mt: 0.5,
13924
- ...errorSx
13925
- }],
13926
- gutterBottom: true,
12642
+ sx: [
12643
+ {
12644
+ display: "block",
12645
+ color: "error.main",
12646
+ mt: 1
12647
+ },
12648
+ ...Array.isArray(errorSx) ? errorSx : [errorSx]
12649
+ ],
13927
12650
  children: fieldError
13928
12651
  }
13929
12652
  ),
13930
- rest.maxFiles != null && /* @__PURE__ */ jsxRuntime.jsxs(
12653
+ /* @__PURE__ */ jsxRuntime.jsxs(
13931
12654
  material.Typography,
13932
12655
  {
13933
12656
  variant: "caption",
13934
- sx: [{
13935
- display: "block",
13936
- color: "text.secondary",
13937
- mt: 0.5,
13938
- ...helperTextSx
13939
- }],
13940
- gutterBottom: true,
12657
+ sx: [
12658
+ {
12659
+ display: "block",
12660
+ color: "text.secondary",
12661
+ mt: 0.5
12662
+ },
12663
+ ...Array.isArray(helperTextSx) ? helperTextSx : [helperTextSx]
12664
+ ],
13941
12665
  children: [
13942
- "Maximum ",
13943
- rest.maxFiles,
13944
- " file",
13945
- rest.maxFiles !== 1 ? "s" : "",
13946
- " allowed"
12666
+ (currentFiles == null ? void 0 : currentFiles.length) || 0,
12667
+ " of ",
12668
+ maxFiles,
12669
+ " files selected"
13947
12670
  ]
13948
12671
  }
13949
12672
  )