formik-form-components 0.2.13 → 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
  {
@@ -954,9 +950,9 @@ function AppAutoComplete({
954
950
  errorSx
955
951
  }) {
956
952
  const { errors, touched, getFieldProps, values, setFieldValue } = formik.useFormikContext();
957
- const fieldError = _19__default.default.get(errors, name);
958
- const isTouched = _19__default.default.get(touched, name);
959
- const formikValue = _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);
960
956
  const val = propValue !== void 0 ? propValue : formikValue || [];
961
957
  return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
962
958
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1028,9 +1024,9 @@ function AppAutoCompleter({
1028
1024
  errorSx
1029
1025
  }) {
1030
1026
  const { errors, touched, values, setFieldValue } = formik.useFormikContext();
1031
- const fieldError = _19__default.default.get(errors, name);
1032
- const isTouched = _19__default.default.get(touched, name);
1033
- 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);
1034
1030
  const selectedOption = options.find((opt) => opt.value === value) || null;
1035
1031
  return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
1036
1032
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1093,14 +1089,23 @@ var AppCheckBox = ({
1093
1089
  ...rest
1094
1090
  }) => {
1095
1091
  const { getFieldProps, setFieldValue, touched, errors } = formik.useFormikContext();
1096
- const fieldError = _19__default.default.get(errors, name);
1097
- const isTouched = _19__default.default.get(touched, name);
1092
+ const fieldError = ___default.default.get(errors, name);
1093
+ const isTouched = ___default.default.get(touched, name);
1098
1094
  material.useTheme();
1099
1095
  const value = getFieldProps(name).value;
1100
- const checkedNames = Array.isArray(value) ? value : value ? [value] : [];
1101
- const handleChange = (itemName, isChecked) => {
1102
- const newValue = isChecked ? [...checkedNames, itemName] : checkedNames.filter((n) => n !== itemName);
1103
- 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
+ }
1104
1109
  };
1105
1110
  return /* @__PURE__ */ jsxRuntime.jsxs(
1106
1111
  material.Box,
@@ -1169,11 +1174,9 @@ var AppCheckBox = ({
1169
1174
  /* @__PURE__ */ jsxRuntime.jsx(
1170
1175
  material.Checkbox,
1171
1176
  {
1172
- ...getFieldProps(name),
1173
- name,
1174
- value: item.name,
1175
- checked: checkedNames.includes(item.name),
1176
- 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),
1177
1180
  disabled: disabled || item.disabled,
1178
1181
  sx: [{
1179
1182
  color: "primary.main",
@@ -1250,8 +1253,8 @@ function AppInputField({
1250
1253
  ...otherProps
1251
1254
  }) {
1252
1255
  const { errors, getFieldProps, touched } = formik.useFormikContext();
1253
- const fieldError = _19__default.default.get(errors, name);
1254
- const isTouched = _19__default.default.get(touched, name);
1256
+ const fieldError = ___default.default.get(errors, name);
1257
+ const isTouched = ___default.default.get(touched, name);
1255
1258
  const [showPassword, setShowPassword] = react.useState(false);
1256
1259
  const handleShowPassword = () => {
1257
1260
  setShowPassword(!showPassword);
@@ -1342,9 +1345,9 @@ var AppMultiSelector = react.forwardRef(
1342
1345
  }, ref) => {
1343
1346
  const theme = material.useTheme();
1344
1347
  const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
1345
- const fieldError = _19__default.default.get(errors, name);
1346
- const isTouched = _19__default.default.get(touched, name);
1347
- 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);
1348
1351
  const selectedValues = Array.isArray(val) ? val : [];
1349
1352
  const handleChange = (event, child) => {
1350
1353
  const newValue = event.target.value;
@@ -1602,8 +1605,8 @@ var AppPhoneNoInput = ({
1602
1605
  ...otherProps
1603
1606
  }) => {
1604
1607
  const { values, errors, touched, setFieldValue, getFieldProps } = formik.useFormikContext();
1605
- const fieldError = _19__default.default.get(errors, name);
1606
- const isTouched = _19__default.default.get(touched, name);
1608
+ const fieldError = ___default.default.get(errors, name);
1609
+ const isTouched = ___default.default.get(touched, name);
1607
1610
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: [{ mb: 2 }, containerSx, sx], children: [
1608
1611
  label && /* @__PURE__ */ jsxRuntime.jsxs(
1609
1612
  material.Typography,
@@ -1687,9 +1690,9 @@ var AppRadioGroup = react.forwardRef(({
1687
1690
  ...rest
1688
1691
  }, ref) => {
1689
1692
  const { errors, touched, getFieldProps, setFieldValue } = formik.useFormikContext();
1690
- const fieldError = _19__default.default.get(errors, name);
1691
- const isTouched = _19__default.default.get(touched, name);
1692
- 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");
1693
1696
  const handleChange = (event) => {
1694
1697
  const newValue = event.target.value;
1695
1698
  setFieldValue(name, newValue);
@@ -1867,9 +1870,9 @@ var AppRating = react.forwardRef(({
1867
1870
  }, ref) => {
1868
1871
  material.useTheme();
1869
1872
  const { errors, touched, setFieldValue, values, setFieldTouched } = formik.useFormikContext();
1870
- const val = _19__default.default.get(values, name);
1871
- const fieldError = _19__default.default.get(errors, name);
1872
- 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);
1873
1876
  const hasError = Boolean(fieldError) && isTouched;
1874
1877
  const handleChange = (event, newValue) => {
1875
1878
  setFieldValue(name, newValue);
@@ -3550,7 +3553,7 @@ var Node = class {
3550
3553
  copy2 = mark.addToSet(copy2);
3551
3554
  }
3552
3555
  if (!Mark.sameSet(copy2, this.marks))
3553
- 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)}`);
3554
3557
  this.content.forEach((node) => node.check());
3555
3558
  }
3556
3559
  /**
@@ -3799,17 +3802,17 @@ var ContentMatch = class {
3799
3802
  */
3800
3803
  toString() {
3801
3804
  let seen = [];
3802
- function scan(m2) {
3803
- seen.push(m2);
3804
- for (let i = 0; i < m2.next.length; i++)
3805
- if (seen.indexOf(m2.next[i].next) == -1)
3806
- 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);
3807
3810
  }
3808
3811
  scan(this);
3809
- return seen.map((m2, i) => {
3810
- let out = i + (m2.validEnd ? "*" : " ") + " ";
3811
- for (let i2 = 0; i2 < m2.next.length; i2++)
3812
- 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);
3813
3816
  return out;
3814
3817
  }).join("\n");
3815
3818
  }
@@ -4690,13 +4693,13 @@ var NodeContext = class {
4690
4693
  }
4691
4694
  finish(openEnd) {
4692
4695
  if (!(this.options & OPT_PRESERVE_WS)) {
4693
- let last = this.content[this.content.length - 1], m2;
4694
- 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))) {
4695
4698
  let text = last;
4696
- if (last.text.length == m2[0].length)
4699
+ if (last.text.length == m[0].length)
4697
4700
  this.content.pop();
4698
4701
  else
4699
- 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));
4700
4703
  }
4701
4704
  }
4702
4705
  let content = Fragment2.from(this.content);
@@ -4848,7 +4851,7 @@ var ParseContext = class {
4848
4851
  if (rule.ignore)
4849
4852
  return null;
4850
4853
  if (rule.clearMark)
4851
- marks = marks.filter((m2) => !rule.clearMark(m2));
4854
+ marks = marks.filter((m) => !rule.clearMark(m));
4852
4855
  else
4853
4856
  marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
4854
4857
  if (rule.consuming === false)
@@ -4954,9 +4957,9 @@ var ParseContext = class {
4954
4957
  if (top.match)
4955
4958
  top.match = top.match.matchType(node.type);
4956
4959
  let nodeMarks = Mark.none;
4957
- for (let m2 of innerMarks.concat(node.marks))
4958
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node.type))
4959
- 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);
4960
4963
  top.content.push(node.mark(nodeMarks));
4961
4964
  return true;
4962
4965
  }
@@ -4979,9 +4982,9 @@ var ParseContext = class {
4979
4982
  if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
4980
4983
  options |= OPT_OPEN_LEFT;
4981
4984
  let applyMarks = Mark.none;
4982
- marks = marks.filter((m2) => {
4983
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
4984
- 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);
4985
4988
  return false;
4986
4989
  }
4987
4990
  return true;
@@ -5369,10 +5372,10 @@ var Mapping = class {
5369
5372
  /**
5370
5373
  @internal
5371
5374
  */
5372
- setMirror(n, m2) {
5375
+ setMirror(n, m) {
5373
5376
  if (!this.mirror)
5374
5377
  this.mirror = [];
5375
- this.mirror.push(n, m2);
5378
+ this.mirror.push(n, m);
5376
5379
  }
5377
5380
  /**
5378
5381
  Append the inverse of the given mapping to this one.
@@ -5914,9 +5917,9 @@ function removeMark(tr, from, to, mark) {
5914
5917
  for (let i = 0; i < toRemove.length; i++) {
5915
5918
  let style = toRemove[i], found2;
5916
5919
  for (let j = 0; j < matched.length; j++) {
5917
- let m2 = matched[j];
5918
- if (m2.step == step - 1 && style.eq(matched[j].style))
5919
- found2 = m2;
5920
+ let m = matched[j];
5921
+ if (m.step == step - 1 && style.eq(matched[j].style))
5922
+ found2 = m;
5920
5923
  }
5921
5924
  if (found2) {
5922
5925
  found2.to = end;
@@ -5927,7 +5930,7 @@ function removeMark(tr, from, to, mark) {
5927
5930
  }
5928
5931
  }
5929
5932
  });
5930
- 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)));
5931
5934
  }
5932
5935
  function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
5933
5936
  let node = tr.doc.nodeAt(pos);
@@ -5943,11 +5946,11 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
5943
5946
  if (!parentType.allowsMarkType(child.marks[j].type))
5944
5947
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
5945
5948
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
5946
- let m2, newline = /\r?\n|\r/g, slice;
5947
- while (m2 = newline.exec(child.text)) {
5949
+ let m, newline = /\r?\n|\r/g, slice;
5950
+ while (m = newline.exec(child.text)) {
5948
5951
  if (!slice)
5949
5952
  slice = new Slice(Fragment2.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
5950
- 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));
5951
5954
  }
5952
5955
  }
5953
5956
  }
@@ -6079,9 +6082,9 @@ function setBlockType(tr, from, to, type, attrs) {
6079
6082
  function replaceNewlines(tr, node, pos, mapFrom) {
6080
6083
  node.forEach((child, offset) => {
6081
6084
  if (child.isText) {
6082
- let m2, newline = /\r?\n|\r/g;
6083
- while (m2 = newline.exec(child.text)) {
6084
- 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);
6085
6088
  tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
6086
6089
  }
6087
6090
  }
@@ -10147,11 +10150,11 @@ var Mark2 = class _Mark extends Extendable {
10147
10150
  const isAtEnd = currentPos.pos === currentPos.end();
10148
10151
  if (isAtEnd) {
10149
10152
  const currentMarks = currentPos.marks();
10150
- 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);
10151
10154
  if (!isInMark) {
10152
10155
  return false;
10153
10156
  }
10154
- 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);
10155
10158
  if (removeMark2) {
10156
10159
  tr.removeStoredMark(removeMark2);
10157
10160
  }
@@ -11179,12 +11182,14 @@ var AppRichTextEditor = ({
11179
11182
  material.Typography,
11180
11183
  {
11181
11184
  variant: "caption",
11182
- sx: [{
11183
- color: "error.main",
11184
- display: "block",
11185
- mt: 0.5,
11186
- ...errorSx
11187
- }],
11185
+ sx: [
11186
+ {
11187
+ color: "error.main",
11188
+ display: "block",
11189
+ mt: 0.5,
11190
+ ...errorSx
11191
+ }
11192
+ ],
11188
11193
  children: msg
11189
11194
  }
11190
11195
  )
@@ -11194,167 +11199,173 @@ var AppRichTextEditor = ({
11194
11199
  material.Typography,
11195
11200
  {
11196
11201
  variant: "button",
11197
- sx: [{
11198
- color: "text.primary",
11199
- mb: 1,
11200
- display: "block",
11201
- ...labelSx
11202
- }],
11202
+ sx: [
11203
+ {
11204
+ color: "text.primary",
11205
+ mb: 1,
11206
+ display: "block",
11207
+ ...labelSx
11208
+ }
11209
+ ],
11203
11210
  children: [
11204
11211
  label,
11205
11212
  required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
11206
11213
  ]
11207
11214
  }
11208
11215
  ),
11209
- /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: {
11210
- mb: 1,
11211
- display: "flex",
11212
- gap: 1,
11213
- flexWrap: "wrap",
11214
- p: 1,
11215
- bgcolor: "background.paper",
11216
- borderRadius: 1,
11217
- border: "1px solid",
11218
- borderColor: "divider",
11219
- ...toolbarSx
11220
- }, children: [
11221
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(
11222
- material.IconButton,
11223
- {
11224
- onClick: () => editor.chain().focus().toggleBold().run(),
11225
- color: editor.isActive("bold") ? "primary" : "default",
11226
- sx: {
11227
- ...buttonSx,
11228
- ...editor.isActive("bold") ? activeButtonSx : {}
11229
- },
11230
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatBoldIcon__default.default, {})
11231
- }
11232
- ) }),
11233
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(
11234
- material.IconButton,
11235
- {
11236
- onClick: () => editor.chain().focus().toggleItalic().run(),
11237
- color: editor.isActive("italic") ? "primary" : "default",
11238
- sx: {
11239
- ...buttonSx,
11240
- ...editor.isActive("italic") ? activeButtonSx : {}
11241
- },
11242
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatItalicIcon__default.default, {})
11243
- }
11244
- ) }),
11245
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(
11246
- material.IconButton,
11247
- {
11248
- onClick: () => editor.chain().focus().toggleUnderline().run(),
11249
- color: editor.isActive("underline") ? "primary" : "default",
11250
- sx: {
11251
- ...buttonSx,
11252
- ...editor.isActive("underline") ? activeButtonSx : {}
11253
- },
11254
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatUnderlinedIcon__default.default, {})
11255
- }
11256
- ) }),
11257
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Strike", children: /* @__PURE__ */ jsxRuntime.jsx(
11258
- material.IconButton,
11259
- {
11260
- onClick: () => editor.chain().focus().toggleStrike().run(),
11261
- color: editor.isActive("strike") ? "primary" : "default",
11262
- sx: {
11263
- ...buttonSx,
11264
- ...editor.isActive("strike") ? activeButtonSx : {}
11265
- },
11266
- children: /* @__PURE__ */ jsxRuntime.jsx(StrikethroughSIcon__default.default, {})
11267
- }
11268
- ) }),
11269
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsxRuntime.jsx(
11270
- material.IconButton,
11271
- {
11272
- onClick: () => editor.chain().focus().toggleBulletList().run(),
11273
- color: editor.isActive("bulletList") ? "primary" : "default",
11274
- sx: {
11275
- ...buttonSx,
11276
- ...editor.isActive("bulletList") ? activeButtonSx : {}
11277
- },
11278
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListBulletedIcon__default.default, {})
11279
- }
11280
- ) }),
11281
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsxRuntime.jsx(
11282
- material.IconButton,
11283
- {
11284
- onClick: () => editor.chain().focus().toggleOrderedList().run(),
11285
- color: editor.isActive("orderedList") ? "primary" : "default",
11286
- sx: {
11287
- ...buttonSx,
11288
- ...editor.isActive("orderedList") ? activeButtonSx : {}
11289
- },
11290
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListNumberedIcon__default.default, {})
11291
- }
11292
- ) }),
11293
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsxRuntime.jsx(
11294
- material.IconButton,
11295
- {
11296
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
11297
- color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11298
- sx: {
11299
- ...buttonSx,
11300
- ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11301
- },
11302
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignLeftIcon__default.default, {})
11303
- }
11304
- ) }),
11305
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsxRuntime.jsx(
11306
- material.IconButton,
11307
- {
11308
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
11309
- color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11310
- sx: {
11311
- ...buttonSx,
11312
- ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11313
- },
11314
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignCenterIcon__default.default, {})
11315
- }
11316
- ) }),
11317
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsxRuntime.jsx(
11318
- material.IconButton,
11319
- {
11320
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
11321
- color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11322
- sx: {
11323
- ...buttonSx,
11324
- ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11325
- },
11326
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignRightIcon__default.default, {})
11327
- }
11328
- ) }),
11329
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsxRuntime.jsx(
11330
- material.IconButton,
11331
- {
11332
- onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11333
- color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11334
- sx: {
11335
- ...buttonSx,
11336
- ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11337
- },
11338
- children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "1rem" } })
11339
- }
11340
- ) }),
11341
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxRuntime.jsxs(
11342
- material.IconButton,
11343
- {
11344
- onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11345
- color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11346
- sx: {
11347
- ...buttonSx,
11348
- ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11349
- },
11350
- children: [
11351
- /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "0.85rem" } }),
11352
- /* @__PURE__ */ jsxRuntime.jsx(UndoIcon__default.default, {})
11353
- ]
11354
- }
11355
- ) }),
11356
- /* @__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, {}) }) })
11357
- ] }),
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
+ ),
11358
11369
  /* @__PURE__ */ jsxRuntime.jsx(
11359
11370
  material.Box,
11360
11371
  {
@@ -11547,10 +11558,10 @@ var AppSearchableMultiSelector = react.forwardRef(
11547
11558
  }, ref) => {
11548
11559
  material.useTheme();
11549
11560
  const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
11550
- const fieldError = _19__default.default.get(errors, name);
11551
- 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));
11552
11563
  const hasError = Boolean(fieldError) && isTouched;
11553
- const val = _19__default.default.get(values, name);
11564
+ const val = ___default.default.get(values, name);
11554
11565
  const selectedValues = Array.isArray(val) ? val : [];
11555
11566
  const selectedCount = selectedValues.length;
11556
11567
  const handleChange = (event, value, reason, details) => {
@@ -11926,9 +11937,9 @@ function AppSearchableSelectInput({
11926
11937
  ...otherProps
11927
11938
  }) {
11928
11939
  const { errors, touched, setFieldValue, values } = formik.useFormikContext();
11929
- const fieldError = _19__default.default.get(errors, name);
11930
- const isTouched = _19__default.default.get(touched, name);
11931
- 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);
11932
11943
  const selectedOption = options.find((option) => option.value === val) || null;
11933
11944
  const handleChange = (event, newValue) => {
11934
11945
  setFieldValue(name, newValue ? newValue.value : "");
@@ -12054,10 +12065,10 @@ var AppSelectInput = react.forwardRef(
12054
12065
  }, ref) => {
12055
12066
  const theme = material.useTheme();
12056
12067
  const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
12057
- const fieldError = _19__default.default.get(errors, name);
12058
- const isTouched = _19__default.default.get(touched, name);
12068
+ const fieldError = ___default.default.get(errors, name);
12069
+ const isTouched = ___default.default.get(touched, name);
12059
12070
  const hasError = Boolean(fieldError) && isTouched;
12060
- const value = _19__default.default.get(values, name);
12071
+ const value = ___default.default.get(values, name);
12061
12072
  const handleChange = (event, child) => {
12062
12073
  setFieldValue(name, event.target.value, true);
12063
12074
  if (externalOnChange) {
@@ -12299,8 +12310,8 @@ var AppSimpleUploadFile = ({
12299
12310
  onError
12300
12311
  }) => {
12301
12312
  const { setFieldValue, values, errors, touched } = formik.useFormikContext();
12302
- const fieldValue = _19__default.default.get(values, name);
12303
- 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;
12304
12315
  const handleChange = (event) => {
12305
12316
  const files = event.target.files;
12306
12317
  if (!files || files.length === 0)
@@ -12421,1557 +12432,241 @@ var AppSimpleUploadFile = ({
12421
12432
  ] });
12422
12433
  };
12423
12434
  var AppSimpleUploadFile_default = AppSimpleUploadFile;
12424
-
12425
- // src/file-thumbnail/utils.ts
12426
- var FORMAT_PDF = ["pdf"];
12427
- var FORMAT_TEXT = ["txt"];
12428
- var FORMAT_PHOTOSHOP = ["psd"];
12429
- var FORMAT_WORD = ["doc", "docx"];
12430
- var FORMAT_EXCEL = ["xls", "xlsx"];
12431
- var FORMAT_ZIP = ["zip", "rar", "iso"];
12432
- var FORMAT_ILLUSTRATOR = ["ai", "esp"];
12433
- var FORMAT_POWERPOINT = ["ppt", "pptx"];
12434
- var FORMAT_AUDIO = ["wav", "aif", "mp3", "aac"];
12435
- var FORMAT_IMG = ["jpg", "jpeg", "gif", "bmp", "png", "svg"];
12436
- var FORMAT_VIDEO = ["m4v", "avi", "mpg", "mp4", "webm"];
12437
- var iconUrl = (icon) => `/assets/icons/files/${icon}.svg`;
12438
- function fileFormat(fileUrl) {
12439
- let format;
12440
- switch (fileUrl == null ? void 0 : fileUrl.includes(fileTypeByUrl(fileUrl))) {
12441
- case FORMAT_TEXT.includes(fileTypeByUrl(fileUrl)):
12442
- format = "txt";
12443
- break;
12444
- case FORMAT_ZIP.includes(fileTypeByUrl(fileUrl)):
12445
- format = "zip";
12446
- break;
12447
- case FORMAT_AUDIO.includes(fileTypeByUrl(fileUrl)):
12448
- format = "audio";
12449
- break;
12450
- case FORMAT_IMG.includes(fileTypeByUrl(fileUrl)):
12451
- format = "image";
12452
- break;
12453
- case FORMAT_VIDEO.includes(fileTypeByUrl(fileUrl)):
12454
- format = "video";
12455
- break;
12456
- case FORMAT_WORD.includes(fileTypeByUrl(fileUrl)):
12457
- format = "word";
12458
- break;
12459
- case FORMAT_EXCEL.includes(fileTypeByUrl(fileUrl)):
12460
- format = "excel";
12461
- break;
12462
- case FORMAT_POWERPOINT.includes(fileTypeByUrl(fileUrl)):
12463
- format = "powerpoint";
12464
- break;
12465
- case FORMAT_PDF.includes(fileTypeByUrl(fileUrl)):
12466
- format = "pdf";
12467
- break;
12468
- case FORMAT_PHOTOSHOP.includes(fileTypeByUrl(fileUrl)):
12469
- format = "photoshop";
12470
- break;
12471
- case FORMAT_ILLUSTRATOR.includes(fileTypeByUrl(fileUrl)):
12472
- format = "illustrator";
12473
- break;
12474
- default:
12475
- format = fileTypeByUrl(fileUrl);
12476
- }
12477
- return format;
12478
- }
12479
- function fileThumb(fileUrl) {
12480
- let thumb;
12481
- switch (fileFormat(fileUrl)) {
12482
- case "folder":
12483
- thumb = iconUrl("ic_folder");
12484
- break;
12485
- case "txt":
12486
- thumb = iconUrl("ic_txt");
12487
- break;
12488
- case "zip":
12489
- thumb = iconUrl("ic_zip");
12490
- break;
12491
- case "audio":
12492
- thumb = iconUrl("ic_audio");
12493
- break;
12494
- case "video":
12495
- thumb = iconUrl("ic_video");
12496
- break;
12497
- case "word":
12498
- thumb = iconUrl("ic_word");
12499
- break;
12500
- case "excel":
12501
- thumb = iconUrl("ic_excel");
12502
- break;
12503
- case "powerpoint":
12504
- thumb = iconUrl("ic_power_point");
12505
- break;
12506
- case "pdf":
12507
- thumb = iconUrl("ic_pdf");
12508
- break;
12509
- case "photoshop":
12510
- thumb = iconUrl("ic_pts");
12511
- break;
12512
- case "illustrator":
12513
- thumb = iconUrl("ic_ai");
12514
- break;
12515
- case "image":
12516
- thumb = iconUrl("ic_img");
12517
- break;
12518
- default:
12519
- thumb = iconUrl("ic_file");
12520
- }
12521
- return thumb;
12522
- }
12523
- function fileTypeByUrl(fileUrl = "") {
12524
- return fileUrl && fileUrl.split(".").pop() || "";
12525
- }
12526
- function fileNameByUrl(fileUrl) {
12527
- return fileUrl.split("/").pop();
12528
- }
12529
- function fileData(file) {
12530
- if (typeof file === "string") {
12531
- return {
12532
- key: file,
12533
- preview: file,
12534
- name: fileNameByUrl(file),
12535
- type: fileTypeByUrl(file)
12536
- };
12537
- }
12538
- return {
12539
- key: file == null ? void 0 : file.preview,
12540
- name: file == null ? void 0 : file.name,
12541
- size: file == null ? void 0 : file.size,
12542
- path: file == null ? void 0 : file.path,
12543
- type: file == null ? void 0 : file.type,
12544
- preview: file == null ? void 0 : file.preview,
12545
- lastModified: file == null ? void 0 : file.lastModified,
12546
- lastModifiedDate: file == null ? void 0 : file.lastModifiedDate
12547
- };
12548
- }
12549
- function DownloadButton({ onDownload }) {
12550
- const theme = styles.useTheme();
12551
- return /* @__PURE__ */ jsxRuntime.jsx(
12552
- material.IconButton,
12553
- {
12554
- onClick: onDownload,
12555
- sx: {
12556
- p: 0,
12557
- top: 0,
12558
- right: 0,
12559
- width: 1,
12560
- height: 1,
12561
- zIndex: 9,
12562
- opacity: 0,
12563
- position: "absolute",
12564
- borderRadius: "unset",
12565
- // color: 'common.white',
12566
- justifyContent: "center",
12567
- bgcolor: "grey.800",
12568
- color: "common.white",
12569
- transition: theme.transitions.create("opacity"),
12570
- "&:hover": {
12571
- opacity: 1,
12572
- backgroundColor: styles.alpha(theme.palette.grey[900], 0.64),
12573
- backdropFilter: "blur(6px)"
12574
- }
12575
- },
12576
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:arrow-circle-down-fill", width: 24 })
12577
- }
12578
- );
12579
- }
12580
- function FileThumbnail({
12581
- file,
12582
- tooltip,
12583
- imageView,
12584
- 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,
12585
12444
  sx,
12586
- imgSx
12587
- }) {
12588
- const { name = "", path = "", preview = "" } = fileData(file);
12589
- const format = fileFormat(path || preview);
12590
- const renderContent = format === "image" && imageView === true ? /* @__PURE__ */ jsxRuntime.jsx(
12591
- material.Box,
12592
- {
12593
- component: "img",
12594
- src: preview,
12595
- sx: {
12596
- width: 1,
12597
- height: 1,
12598
- flexShrink: 0,
12599
- objectFit: "cover",
12600
- ...imgSx
12601
- }
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 };
12602
12468
  }
12603
- ) : /* @__PURE__ */ jsxRuntime.jsx(
12604
- material.Box,
12605
- {
12606
- component: "img",
12607
- src: fileThumb(format),
12608
- sx: {
12609
- width: 32,
12610
- height: 32,
12611
- flexShrink: 0,
12612
- ...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);
12613
12489
  }
12614
- }
12490
+ },
12491
+ [
12492
+ currentFiles,
12493
+ disabled,
12494
+ isMaxFilesReached,
12495
+ multiple,
12496
+ name,
12497
+ setFieldValue,
12498
+ maxFiles,
12499
+ externalOnDrop
12500
+ ]
12615
12501
  );
12616
- if (tooltip === true) {
12617
- return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: name, children: /* @__PURE__ */ jsxRuntime.jsxs(
12618
- material.Stack,
12619
- {
12620
- flexShrink: 0,
12621
- component: "span",
12622
- alignItems: "center",
12623
- justifyContent: "center",
12624
- sx: {
12625
- width: "fit-content",
12626
- height: "inherit"
12627
- },
12628
- children: [
12629
- renderContent,
12630
- onDownload && /* @__PURE__ */ jsxRuntime.jsx(DownloadButton, { onDownload })
12631
- ]
12632
- }
12633
- ) });
12634
- }
12635
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12636
- renderContent,
12637
- onDownload && /* @__PURE__ */ jsxRuntime.jsx(DownloadButton, { onDownload })
12638
- ] });
12639
- }
12640
- function RejectionFiles({ fileRejections }) {
12641
- if (!fileRejections.length) {
12642
- return null;
12643
- }
12644
- function formatBytes2(bytes) {
12645
- const b = bytes != null ? bytes : 0;
12646
- if (b === 0)
12647
- return "0 Bytes";
12648
- const k = 1024;
12649
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12650
- const i = Math.floor(Math.log(b) / Math.log(k));
12651
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12652
- }
12653
- return /* @__PURE__ */ jsxRuntime.jsx(
12654
- material.Paper,
12655
- {
12656
- variant: "outlined",
12657
- sx: {
12658
- py: 1,
12659
- px: 2,
12660
- mt: 3,
12661
- bgcolor: (theme) => styles.alpha(theme.palette.error.main, 0.08),
12662
- borderColor: (theme) => styles.alpha(theme.palette.error.main, 0.24)
12663
- },
12664
- children: fileRejections.map(({ file, errors }) => {
12665
- const { path, size } = fileData(file);
12666
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { my: 1 }, children: [
12667
- /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "subtitle2", noWrap: true, children: [
12668
- path,
12669
- " - ",
12670
- size != null ? formatBytes2(size) : ""
12671
- ] }),
12672
- errors.map((error) => /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { component: "span", sx: { typography: "caption" }, children: [
12673
- "- ",
12674
- error.message
12675
- ] }, error.code))
12676
- ] }, path);
12677
- })
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);
12678
12511
  }
12679
- );
12680
- }
12681
-
12682
- // src/image/getRatio.ts
12683
- function getRatio(ratio = "1/1") {
12684
- return {
12685
- "4/3": "calc(100% / 4 * 3)",
12686
- "3/4": "calc(100% / 3 * 4)",
12687
- "6/4": "calc(100% / 6 * 4)",
12688
- "4/6": "calc(100% / 4 * 6)",
12689
- "16/9": "calc(100% / 16 * 9)",
12690
- "9/16": "calc(100% / 9 * 16)",
12691
- "21/9": "calc(100% / 21 * 9)",
12692
- "9/21": "calc(100% / 9 * 21)",
12693
- "1/1": "100%"
12694
- }[ratio];
12695
- }
12696
- var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12697
- var Image = react.forwardRef(
12698
- ({
12699
- ratio,
12700
- disabledEffect = false,
12701
- effect = "blur",
12702
- src,
12703
- wrapperProps,
12704
- style,
12705
- sx,
12706
- ...other
12707
- }, ref) => {
12708
- const content = /* @__PURE__ */ jsxRuntime.jsx(
12709
- material.Box,
12710
- {
12711
- component: reactLazyLoadImageComponent.LazyLoadImage,
12712
- wrapperClassName: "wrapper",
12713
- effect: disabledEffect ? void 0 : effect,
12714
- placeholderSrc: disabledEffect ? TRANSPARENT_PNG : TRANSPARENT_PNG,
12715
- src,
12716
- wrapperProps,
12717
- style,
12718
- sx: {
12719
- width: 1,
12720
- height: 1,
12721
- objectFit: "cover",
12722
- ...sx
12723
- },
12724
- ...other
12725
- }
12726
- );
12727
- if (ratio) {
12728
- return /* @__PURE__ */ jsxRuntime.jsx(
12729
- material.Box,
12730
- {
12731
- ref,
12732
- component: "span",
12733
- sx: {
12734
- width: 1,
12735
- lineHeight: 1,
12736
- display: "block",
12737
- overflow: "hidden",
12738
- position: "relative",
12739
- pt: getRatio(ratio),
12740
- "& .wrapper": {
12741
- top: 0,
12742
- left: 0,
12743
- width: 1,
12744
- height: 1,
12745
- position: "absolute",
12746
- backgroundSize: "cover !important"
12747
- },
12748
- ...sx
12749
- },
12750
- children: content
12751
- }
12752
- );
12753
- }
12754
- return /* @__PURE__ */ jsxRuntime.jsx(
12755
- material.Box,
12756
- {
12757
- ref,
12758
- component: "span",
12759
- sx: {
12760
- lineHeight: 1,
12761
- display: "block",
12762
- overflow: "hidden",
12763
- position: "relative",
12764
- "& .wrapper": {
12765
- width: 1,
12766
- height: 1,
12767
- backgroundSize: "cover !important"
12768
- },
12769
- ...sx
12770
- },
12771
- children: content
12772
- }
12773
- );
12774
- }
12775
- );
12776
- Image.displayName = "Image";
12777
- var Image_default = Image;
12778
-
12779
- // src/animate/variants/transition.ts
12780
- var varTranEnter = (props) => {
12781
- const duration = (props == null ? void 0 : props.durationIn) != null ? props == null ? void 0 : props.durationIn : 0.64;
12782
- const ease = (props == null ? void 0 : props.easeIn) != null ? props == null ? void 0 : props.easeIn : [0.43, 0.13, 0.23, 0.96];
12783
- return { duration, ease };
12784
- };
12785
- var varTranExit = (props) => {
12786
- const duration = (props == null ? void 0 : props.durationOut) != null ? props == null ? void 0 : props.durationOut : 0.48;
12787
- const ease = (props == null ? void 0 : props.easeOut) != null ? props == null ? void 0 : props.easeOut : [0.43, 0.13, 0.23, 0.96];
12788
- return { duration, ease };
12789
- };
12790
-
12791
- // src/animate/variants/fade.ts
12792
- var varFade = (props) => {
12793
- const distance = (props == null ? void 0 : props.distance) != null ? props == null ? void 0 : props.distance : 120;
12794
- const durationIn = props == null ? void 0 : props.durationIn;
12795
- const durationOut = props == null ? void 0 : props.durationOut;
12796
- const easeIn = props == null ? void 0 : props.easeIn;
12797
- const easeOut = props == null ? void 0 : props.easeOut;
12798
- return {
12799
- // IN
12800
- in: {
12801
- initial: { opacity: 0 },
12802
- animate: { opacity: 1, transition: varTranEnter },
12803
- exit: { opacity: 0, transition: varTranExit }
12804
- },
12805
- inUp: {
12806
- initial: { y: distance, opacity: 0 },
12807
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12808
- exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12809
- },
12810
- inDown: {
12811
- initial: { y: -distance, opacity: 0 },
12812
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12813
- exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12814
- },
12815
- inLeft: {
12816
- initial: { x: -distance, opacity: 0 },
12817
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12818
- exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12819
- },
12820
- inRight: {
12821
- initial: { x: distance, opacity: 0 },
12822
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12823
- exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12824
- },
12825
- // OUT
12826
- out: {
12827
- initial: { opacity: 1 },
12828
- animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12829
- exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12830
- },
12831
- outUp: {
12832
- initial: { y: 0, opacity: 1 },
12833
- animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12834
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12835
- },
12836
- outDown: {
12837
- initial: { y: 0, opacity: 1 },
12838
- animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12839
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12840
- },
12841
- outLeft: {
12842
- initial: { x: 0, opacity: 1 },
12843
- animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12844
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12845
- },
12846
- outRight: {
12847
- initial: { x: 0, opacity: 1 },
12848
- animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12849
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12850
- }
12851
- };
12852
- };
12853
- function formatBytes(bytes) {
12854
- const b = bytes != null ? bytes : 0;
12855
- if (b === 0)
12856
- return "0 Bytes";
12857
- const k = 1024;
12858
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12859
- const i = Math.floor(Math.log(b) / Math.log(k));
12860
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12861
- }
12862
- function MultiFilePreview({
12863
- thumbnail,
12864
- files,
12865
- onRemove,
12866
- sx,
12867
- isClickable,
12868
- isEditable,
12869
- onDeleteButtonClick,
12870
- onPrivacyUpdateClick
12871
- }) {
12872
- if ((files == null ? void 0 : files.length) == null) {
12873
- return null;
12874
- }
12875
- const [anchorEl, setAnchorEl] = react.useState(null);
12876
- const [selectedFile, setSelectedFile] = react.useState(null);
12877
- const canViewPrivate = true;
12878
- return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: files.map((file) => {
12879
- const typedFile = file;
12880
- const { key, name = "", size = 0 } = fileData(typedFile);
12881
- const isStringFile = typeof file === "string";
12882
- if (thumbnail === true) {
12883
- return (
12884
- // @ts-ignore
12885
- /* @__PURE__ */ jsxRuntime.jsxs(
12886
- material.Stack,
12887
- {
12888
- component: framerMotion.m.div,
12889
- ...varFade().inUp,
12890
- alignItems: "center",
12891
- display: "inline-flex",
12892
- justifyContent: "center",
12893
- sx: {
12894
- m: 0.5,
12895
- width: 80,
12896
- height: 80,
12897
- borderRadius: 1.25,
12898
- overflow: "hidden",
12899
- position: "relative",
12900
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12901
- ...sx
12902
- },
12903
- children: [
12904
- /* @__PURE__ */ jsxRuntime.jsx(
12905
- FileThumbnail,
12906
- {
12907
- tooltip: true,
12908
- imageView: true,
12909
- file: typedFile,
12910
- sx: { position: "absolute" },
12911
- imgSx: { position: "absolute" }
12912
- }
12913
- ),
12914
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(
12915
- material.IconButton,
12916
- {
12917
- size: "small",
12918
- onClick: () => onRemove(typedFile),
12919
- sx: {
12920
- top: 4,
12921
- right: 4,
12922
- p: "1px",
12923
- position: "absolute",
12924
- color: (theme) => styles.alpha(theme.palette.common.white, 0.72),
12925
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.48),
12926
- "&:hover": {
12927
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.72)
12928
- }
12929
- },
12930
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill", width: 16 })
12931
- }
12932
- )
12933
- ]
12934
- },
12935
- key
12936
- )
12937
- );
12938
- }
12939
- return (
12940
- // @ts-ignore
12941
- /* @__PURE__ */ jsxRuntime.jsxs(
12942
- material.Stack,
12943
- {
12944
- component: framerMotion.m.div,
12945
- ...varFade().inUp,
12946
- spacing: 2,
12947
- direction: "row",
12948
- alignItems: "center",
12949
- sx: {
12950
- my: 1,
12951
- px: 1,
12952
- py: 0.75,
12953
- borderRadius: 0.75,
12954
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12955
- ...sx,
12956
- opacity: "1 !important",
12957
- transform: "none !important"
12958
- },
12959
- children: [
12960
- (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" } }) : (
12961
- // eslint-disable-next-line @next/next/no-img-element
12962
- /* @__PURE__ */ jsxRuntime.jsx(
12963
- "img",
12964
- {
12965
- src: `${typedFile == null ? void 0 : typedFile.preview}`,
12966
- alt: (typedFile == null ? void 0 : typedFile.name) != null ? typedFile == null ? void 0 : typedFile.name : "",
12967
- style: { width: "40px", height: "40px" }
12968
- }
12969
- )
12970
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { file: typedFile }),
12971
- /* @__PURE__ */ jsxRuntime.jsxs(
12972
- material.Stack,
12973
- {
12974
- flexGrow: 1,
12975
- sx: { minWidth: 0, cursor: "pointer" },
12976
- onClick: () => {
12977
- if (isClickable === true && typedFile.url != null) {
12978
- window.open(`${typedFile == null ? void 0 : typedFile.url}`, "_blank");
12979
- }
12980
- },
12981
- children: [
12982
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle2", sx: { wordBreak: "break-all", whiteSpace: "break-spaces" }, noWrap: true, children: isStringFile ? file : name }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", sx: { color: "text.secondary" }, children: isStringFile ? "" : formatBytes(size) })
12984
- ]
12985
- }
12986
- ),
12987
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { edge: "end", size: "small", onClick: () => onRemove(typedFile), children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill" }) }),
12988
- isEditable === true && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12989
- /* @__PURE__ */ jsxRuntime.jsx(
12990
- material.IconButton,
12991
- {
12992
- edge: "end",
12993
- size: "small",
12994
- onClick: (event) => {
12995
- event.stopPropagation();
12996
- setAnchorEl(event.currentTarget);
12997
- setSelectedFile(typedFile);
12998
- },
12999
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:more-horizontal-fill" })
13000
- }
13001
- ),
13002
- /* @__PURE__ */ jsxRuntime.jsxs(
13003
- material.Menu,
13004
- {
13005
- anchorEl,
13006
- open: Boolean(anchorEl) && selectedFile === file,
13007
- onClose: () => setAnchorEl(null),
13008
- children: [
13009
- /* @__PURE__ */ jsxRuntime.jsxs(
13010
- material.MenuItem,
13011
- {
13012
- onClick: (e) => {
13013
- e.stopPropagation();
13014
- setAnchorEl(null);
13015
- if (onDeleteButtonClick) {
13016
- onDeleteButtonClick(typedFile);
13017
- }
13018
- },
13019
- children: [
13020
- /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:trash-2-outline", width: 20 }),
13021
- "Delete"
13022
- ]
13023
- }
13024
- ),
13025
- /* @__PURE__ */ jsxRuntime.jsxs(
13026
- material.MenuItem,
13027
- {
13028
- onClick: (e) => {
13029
- e.stopPropagation();
13030
- if (onPrivacyUpdateClick) {
13031
- onPrivacyUpdateClick(typedFile);
13032
- }
13033
- },
13034
- children: [
13035
- /* @__PURE__ */ jsxRuntime.jsx(
13036
- Iconify_default,
13037
- {
13038
- icon: (typedFile == null ? void 0 : typedFile.is_private) === true ? "eva:unlock-outline" : "eva:lock-outline",
13039
- width: 20
13040
- }
13041
- ),
13042
- (typedFile == null ? void 0 : typedFile.is_private) === true ? "Public" : "Private"
13043
- ]
13044
- }
13045
- )
13046
- ]
13047
- }
13048
- )
13049
- ] })
13050
- ]
13051
- },
13052
- key
13053
- )
13054
- );
13055
- }) });
13056
- }
13057
- function SingleFilePreview({ file }) {
13058
- if (!file) {
13059
- return null;
13060
- }
13061
- const imgUrl = (typeof file === "string" ? file : file.preview) || "";
13062
- return /* @__PURE__ */ jsxRuntime.jsx(
13063
- material.Box,
13064
- {
13065
- sx: {
13066
- position: "relative",
13067
- width: "100%",
13068
- height: "100%",
13069
- "& .wrapper": {
13070
- width: "100%",
13071
- height: "100%",
13072
- position: "relative"
13073
- }
13074
- },
13075
- children: /* @__PURE__ */ jsxRuntime.jsx(
13076
- Image_default,
13077
- {
13078
- src: imgUrl,
13079
- effect: "opacity",
13080
- wrapperProps: {
13081
- style: {
13082
- width: "100%",
13083
- height: "100%",
13084
- position: "relative"
13085
- }
13086
- },
13087
- style: {
13088
- top: 8,
13089
- left: 8,
13090
- zIndex: 8,
13091
- borderRadius: 1,
13092
- position: "absolute",
13093
- width: "calc(100% - 16px)",
13094
- height: "calc(100% - 16px)",
13095
- objectFit: "cover"
13096
- }
13097
- }
13098
- )
13099
- }
13100
- );
13101
- }
13102
- function BackgroundIllustration() {
13103
- const theme = styles.useTheme();
13104
- const PRIMARY_MAIN = theme.palette.primary.main;
13105
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13106
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "BG", x1: "19.496%", x2: "77.479%", y1: "71.822%", y2: "16.69%", children: [
13107
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: PRIMARY_MAIN }),
13108
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: PRIMARY_MAIN, stopOpacity: "0" })
13109
- ] }) }),
13110
- /* @__PURE__ */ jsxRuntime.jsx(
13111
- "path",
13112
- {
13113
- fill: "url(#BG)",
13114
- fillRule: "nonzero",
13115
- 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",
13116
- opacity: "0.2"
13117
- }
13118
- )
13119
- ] });
13120
- }
13121
- var BackgroundIllustration_default = react.memo(BackgroundIllustration);
13122
- function UploadIllustration({ ...other }) {
13123
- const theme = styles.useTheme();
13124
- const PRIMARY_MAIN = theme.palette.primary.main;
13125
- const PRIMARY_DARK = theme.palette.primary.dark;
13126
- const PRIMARY_DARKER = theme.palette.primary.dark;
13127
- 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: [
13128
- /* @__PURE__ */ jsxRuntime.jsx(BackgroundIllustration_default, {}),
13129
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "linearGradient-2", x1: "30.113%", x2: "30.113%", y1: "0%", y2: "100%", children: [
13130
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopOpacity: "0" }),
13131
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%" })
13132
- ] }) }),
13133
- /* @__PURE__ */ jsxRuntime.jsx(
13134
- "path",
13135
- {
13136
- fill: "#FF4842",
13137
- fillRule: "nonzero",
13138
- 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",
13139
- opacity: "0.05"
13140
- }
13141
- ),
13142
- /* @__PURE__ */ jsxRuntime.jsx(
13143
- "path",
13144
- {
13145
- fill: "#FF4842",
13146
- fillRule: "nonzero",
13147
- 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",
13148
- opacity: "0.05"
13149
- }
13150
- ),
13151
- /* @__PURE__ */ jsxRuntime.jsx(
13152
- "path",
13153
- {
13154
- fill: "#FF4842",
13155
- fillRule: "nonzero",
13156
- 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",
13157
- opacity: "0.05"
13158
- }
13159
- ),
13160
- /* @__PURE__ */ jsxRuntime.jsx(
13161
- "path",
13162
- {
13163
- fill: PRIMARY_DARKER,
13164
- fillRule: "nonzero",
13165
- 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"
13166
- }
13167
- ),
13168
- /* @__PURE__ */ jsxRuntime.jsx(
13169
- "path",
13170
- {
13171
- fill: "#FFF",
13172
- fillRule: "nonzero",
13173
- d: "M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",
13174
- transform: "rotate(34.64 262.678 162.06)"
13175
- }
13176
- ),
13177
- /* @__PURE__ */ jsxRuntime.jsx(
13178
- "path",
13179
- {
13180
- fill: "#FFC107",
13181
- fillRule: "nonzero",
13182
- d: "M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",
13183
- transform: "rotate(34.804 278.687 137.92)"
13184
- }
13185
- ),
13186
- /* @__PURE__ */ jsxRuntime.jsx(
13187
- "path",
13188
- {
13189
- fill: "#FFC107",
13190
- fillRule: "nonzero",
13191
- d: "M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",
13192
- opacity: "0.5",
13193
- transform: "rotate(34.64 268.35 153.887)"
13194
- }
13195
- ),
13196
- /* @__PURE__ */ jsxRuntime.jsx(
13197
- "path",
13198
- {
13199
- fill: "#FFC107",
13200
- fillRule: "nonzero",
13201
- d: "M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",
13202
- opacity: "0.3",
13203
- transform: "rotate(34.64 257.265 169.926)"
13204
- }
13205
- ),
13206
- /* @__PURE__ */ jsxRuntime.jsx(
13207
- "path",
13208
- {
13209
- fill: "#FFF",
13210
- fillRule: "nonzero",
13211
- d: "M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",
13212
- transform: "rotate(16.29 248.893 159.951)"
13213
- }
13214
- ),
13215
- /* @__PURE__ */ jsxRuntime.jsx(
13216
- "path",
13217
- {
13218
- fill: "#FF4842",
13219
- fillRule: "nonzero",
13220
- d: "M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",
13221
- transform: "rotate(16.29 257.127 131.835)"
13222
- }
13223
- ),
13224
- /* @__PURE__ */ jsxRuntime.jsx(
13225
- "path",
13226
- {
13227
- fill: "#FF4842",
13228
- fillRule: "nonzero",
13229
- d: "M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",
13230
- opacity: "0.5",
13231
- transform: "rotate(16.29 251.658 150.547)"
13232
- }
13233
- ),
13234
- /* @__PURE__ */ jsxRuntime.jsx(
13235
- "path",
13236
- {
13237
- fill: "#FF4842",
13238
- fillRule: "nonzero",
13239
- d: "M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",
13240
- opacity: "0.3",
13241
- transform: "rotate(16.29 246.19 169.256)"
13242
- }
13243
- ),
13244
- /* @__PURE__ */ jsxRuntime.jsx(
13245
- "path",
13246
- {
13247
- fill: "#FFF",
13248
- fillRule: "nonzero",
13249
- d: "M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",
13250
- transform: "rotate(4.6 241.52 160.258)"
13251
- }
13252
- ),
13253
- /* @__PURE__ */ jsxRuntime.jsx(
13254
- "path",
13255
- {
13256
- fill: "#1890FF",
13257
- fillRule: "nonzero",
13258
- d: "M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",
13259
- transform: "rotate(4.6 243.874 131.06)"
13260
- }
13261
- ),
13262
- /* @__PURE__ */ jsxRuntime.jsx(
13263
- "path",
13264
- {
13265
- fill: "#1890FF",
13266
- fillRule: "nonzero",
13267
- d: "M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",
13268
- opacity: "0.5",
13269
- transform: "rotate(4.6 242.308 150.487)"
13270
- }
13271
- ),
13272
- /* @__PURE__ */ jsxRuntime.jsx(
13273
- "path",
13274
- {
13275
- fill: "#1890FF",
13276
- fillRule: "nonzero",
13277
- d: "M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",
13278
- opacity: "0.3",
13279
- transform: "rotate(4.6 240.746 169.92)"
13280
- }
13281
- ),
13282
- /* @__PURE__ */ jsxRuntime.jsx(
13283
- "path",
13284
- {
13285
- fill: "#FFF",
13286
- fillRule: "nonzero",
13287
- d: "M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",
13288
- transform: "rotate(-2.61 236.157 162.002)"
13289
- }
13290
- ),
13291
- /* @__PURE__ */ jsxRuntime.jsx(
13292
- "path",
13293
- {
13294
- fill: PRIMARY_MAIN,
13295
- fillRule: "nonzero",
13296
- d: "M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",
13297
- transform: "rotate(-2.61 234.825 132.734)"
13298
- }
13299
- ),
13300
- /* @__PURE__ */ jsxRuntime.jsx(
13301
- "path",
13302
- {
13303
- fill: PRIMARY_MAIN,
13304
- fillRule: "nonzero",
13305
- d: "M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",
13306
- opacity: "0.5",
13307
- transform: "rotate(-2.862 236.39 151.563)"
13308
- }
13309
- ),
13310
- /* @__PURE__ */ jsxRuntime.jsx(
13311
- "path",
13312
- {
13313
- fill: PRIMARY_MAIN,
13314
- fillRule: "nonzero",
13315
- d: "M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",
13316
- opacity: "0.3",
13317
- transform: "rotate(-2.61 236.599 171.683)"
13318
- }
13319
- ),
13320
- /* @__PURE__ */ jsxRuntime.jsx(
13321
- "path",
13322
- {
13323
- fill: "#F4F6F8",
13324
- fillRule: "nonzero",
13325
- 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"
13326
- }
13327
- ),
13328
- /* @__PURE__ */ jsxRuntime.jsx(
13329
- "path",
13330
- {
13331
- fill: "#000",
13332
- fillRule: "nonzero",
13333
- 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",
13334
- opacity: "0.1"
13335
- }
13336
- ),
13337
- /* @__PURE__ */ jsxRuntime.jsx(
13338
- "path",
13339
- {
13340
- fill: PRIMARY_MAIN,
13341
- fillRule: "nonzero",
13342
- 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"
13343
- }
13344
- ),
13345
- /* @__PURE__ */ jsxRuntime.jsx(
13346
- "path",
13347
- {
13348
- fill: "#FF4842",
13349
- fillRule: "nonzero",
13350
- 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",
13351
- opacity: "0.1"
13352
- }
13353
- ),
13354
- /* @__PURE__ */ jsxRuntime.jsx(
13355
- "path",
13356
- {
13357
- fill: "#FFF",
13358
- fillRule: "nonzero",
13359
- 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"
13360
- }
13361
- ),
13362
- /* @__PURE__ */ jsxRuntime.jsx(
13363
- "path",
13364
- {
13365
- fill: PRIMARY_MAIN,
13366
- fillRule: "nonzero",
13367
- 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",
13368
- opacity: "0.3"
13369
- }
13370
- ),
13371
- /* @__PURE__ */ jsxRuntime.jsx(
13372
- "path",
13373
- {
13374
- fill: PRIMARY_MAIN,
13375
- fillRule: "nonzero",
13376
- 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"
13377
- }
13378
- ),
13379
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "380.363", cy: "298.487", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "8.945", ry: "1.513" }),
13380
- /* @__PURE__ */ jsxRuntime.jsx(
13381
- "path",
13382
- {
13383
- fill: PRIMARY_MAIN,
13384
- fillRule: "nonzero",
13385
- 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"
13386
- }
13387
- ),
13388
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "390.052", cy: "264.383", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "5.044", ry: "1" }),
13389
- /* @__PURE__ */ jsxRuntime.jsx(
13390
- "path",
13391
- {
13392
- fill: PRIMARY_MAIN,
13393
- fillRule: "nonzero",
13394
- 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"
13395
- }
13396
- ),
13397
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "346.97", cy: "270.022", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "6.09", ry: "1.028" }),
13398
- /* @__PURE__ */ jsxRuntime.jsx(
13399
- "rect",
13400
- {
13401
- width: "51.026",
13402
- height: "91.312",
13403
- x: "303.926",
13404
- y: "69.211",
13405
- fill: "#FFF",
13406
- fillRule: "nonzero",
13407
- rx: "4.737",
13408
- transform: "rotate(-71.99 329.44 114.867)"
13409
- }
13410
- ),
13411
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "303.613", cy: "103.507", r: "9.376", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.2" }),
13412
- /* @__PURE__ */ jsxRuntime.jsx(
13413
- "path",
13414
- {
13415
- fill: PRIMARY_MAIN,
13416
- fillRule: "nonzero",
13417
- d: "M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",
13418
- opacity: "0.2",
13419
- transform: "rotate(-71.99 345.867 106.913)"
13420
- }
13421
- ),
13422
- /* @__PURE__ */ jsxRuntime.jsx(
13423
- "path",
13424
- {
13425
- fill: PRIMARY_MAIN,
13426
- fillRule: "nonzero",
13427
- d: "M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",
13428
- opacity: "0.2",
13429
- transform: "rotate(-71.99 334.312 110.042)"
13430
- }
13431
- ),
13432
- /* @__PURE__ */ jsxRuntime.jsx(
13433
- "path",
13434
- {
13435
- fill: PRIMARY_MAIN,
13436
- fillRule: "nonzero",
13437
- d: "M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",
13438
- opacity: "0.2",
13439
- transform: "rotate(-71.99 338.393 118.259)"
13440
- }
13441
- ),
13442
- /* @__PURE__ */ jsxRuntime.jsx(
13443
- "path",
13444
- {
13445
- fill: PRIMARY_MAIN,
13446
- fillRule: "nonzero",
13447
- d: "M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",
13448
- opacity: "0.2",
13449
- transform: "rotate(-71.99 339.79 125.599)"
13450
- }
13451
- ),
13452
- /* @__PURE__ */ jsxRuntime.jsx(
13453
- "path",
13454
- {
13455
- fill: PRIMARY_MAIN,
13456
- fillRule: "nonzero",
13457
- d: "M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",
13458
- opacity: "0.5",
13459
- transform: "rotate(-71.99 350.544 140.3)"
13460
- }
13461
- ),
13462
- /* @__PURE__ */ jsxRuntime.jsx(
13463
- "rect",
13464
- {
13465
- width: "50.3",
13466
- height: "78.305",
13467
- x: "291.549",
13468
- y: "174.486",
13469
- fill: "#FFF",
13470
- fillRule: "nonzero",
13471
- rx: "4",
13472
- transform: "rotate(-57.265 316.7 213.638)"
13473
- }
13474
- ),
13475
- /* @__PURE__ */ jsxRuntime.jsx(
13476
- "path",
13477
- {
13478
- fill: "#DFE3E8",
13479
- fillRule: "nonzero",
13480
- d: "M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",
13481
- transform: "rotate(-57.57 285.154 205.563)"
13482
- }
13483
- ),
13484
- /* @__PURE__ */ jsxRuntime.jsx(
13485
- "path",
13486
- {
13487
- fill: "#DFE3E8",
13488
- fillRule: "nonzero",
13489
- d: "M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",
13490
- transform: "rotate(-57.57 298.635 200.737)"
13491
- }
13492
- ),
13493
- /* @__PURE__ */ jsxRuntime.jsx(
13494
- "path",
13495
- {
13496
- fill: "#DFE3E8",
13497
- fillRule: "nonzero",
13498
- d: "M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",
13499
- transform: "rotate(-57.57 304.171 204.251)"
13500
- }
13501
- ),
13502
- /* @__PURE__ */ jsxRuntime.jsx(
13503
- "path",
13504
- {
13505
- fill: "#DFE3E8",
13506
- fillRule: "nonzero",
13507
- d: "M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",
13508
- transform: "rotate(-57.57 309.706 207.771)"
13509
- }
13510
- ),
13511
- /* @__PURE__ */ jsxRuntime.jsx(
13512
- "path",
13513
- {
13514
- fill: "#DFE3E8",
13515
- fillRule: "nonzero",
13516
- d: "M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",
13517
- transform: "rotate(-57.265 315.485 212.94)"
13518
- }
13519
- ),
13520
- /* @__PURE__ */ jsxRuntime.jsx(
13521
- "path",
13522
- {
13523
- fill: "#F4F6F8",
13524
- fillRule: "nonzero",
13525
- d: "M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",
13526
- transform: "rotate(-57.57 320.777 214.804)"
13527
- }
13528
- ),
13529
- /* @__PURE__ */ jsxRuntime.jsx(
13530
- "path",
13531
- {
13532
- fill: "#F4F6F8",
13533
- fillRule: "nonzero",
13534
- d: "M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",
13535
- transform: "rotate(-57.57 326.313 218.318)"
13536
- }
13537
- ),
13538
- /* @__PURE__ */ jsxRuntime.jsx(
13539
- "path",
13540
- {
13541
- fill: "#DFE3E8",
13542
- fillRule: "nonzero",
13543
- d: "M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",
13544
- transform: "rotate(-57.57 345.465 214.454)"
13545
- }
13546
- ),
13547
- /* @__PURE__ */ jsxRuntime.jsx(
13548
- "path",
13549
- {
13550
- fill: PRIMARY_MAIN,
13551
- fillRule: "nonzero",
13552
- 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"
13553
- }
13554
- ),
13555
- /* @__PURE__ */ jsxRuntime.jsx(
13556
- "path",
13557
- {
13558
- fill: PRIMARY_DARK,
13559
- fillRule: "nonzero",
13560
- 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",
13561
- opacity: "0.243"
13562
- }
13563
- ),
13564
- /* @__PURE__ */ jsxRuntime.jsx(
13565
- "path",
13566
- {
13567
- fill: "url(#linearGradient-2)",
13568
- fillRule: "nonzero",
13569
- 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",
13570
- opacity: "0.32"
13571
- }
13572
- ),
13573
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "119.593", cy: "258.664", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13574
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "101.03", cy: "260.545", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13575
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "108.459", cy: "265.905", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13576
- /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "89.193", cy: "265.433", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13577
- /* @__PURE__ */ jsxRuntime.jsx(
13578
- "path",
13579
- {
13580
- fill: PRIMARY_MAIN,
13581
- fillRule: "nonzero",
13582
- 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"
13583
- }
13584
- ),
13585
- /* @__PURE__ */ jsxRuntime.jsx(
13586
- "path",
13587
- {
13588
- stroke: PRIMARY_DARKER,
13589
- strokeLinecap: "round",
13590
- strokeWidth: "0.5",
13591
- 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"
13592
- }
13593
- ),
13594
- /* @__PURE__ */ jsxRuntime.jsx(
13595
- "path",
13596
- {
13597
- fill: PRIMARY_MAIN,
13598
- fillRule: "nonzero",
13599
- 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"
13600
- }
13601
- ),
13602
- /* @__PURE__ */ jsxRuntime.jsx(
13603
- "path",
13604
- {
13605
- stroke: PRIMARY_DARKER,
13606
- strokeLinecap: "round",
13607
- strokeWidth: "0.5",
13608
- d: "M91.113 247.808s8.353 12.115 9.968 12.647"
13609
- }
13610
- ),
13611
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M90.344 249.701L92.293 249.701" }),
13612
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M92.68 254.132L95.738 254.263" }),
13613
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M94.542 250.586L94.21 252.179" }),
13614
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M97.792 255.432L97.732 256.879" }),
13615
- /* @__PURE__ */ jsxRuntime.jsx(
13616
- "path",
13617
- {
13618
- fill: PRIMARY_MAIN,
13619
- fillRule: "nonzero",
13620
- 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"
13621
- }
13622
- ),
13623
- /* @__PURE__ */ jsxRuntime.jsx(
13624
- "path",
13625
- {
13626
- stroke: PRIMARY_DARKER,
13627
- strokeLinecap: "round",
13628
- strokeWidth: "0.5",
13629
- d: "M111.051 247.808s-8.371 12.115-9.97 12.647"
13630
- }
13631
- ),
13632
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M111.82 249.701L109.871 249.701" }),
13633
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M109.485 254.132L106.426 254.263" }),
13634
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M107.622 250.586L107.954 252.179" }),
13635
- /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M104.372 255.432L104.432 256.879" }),
13636
- /* @__PURE__ */ jsxRuntime.jsx(
13637
- "path",
13638
- {
13639
- fill: PRIMARY_MAIN,
13640
- fillRule: "nonzero",
13641
- 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"
13642
- }
13643
- ),
13644
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "84.467", cy: "87.003", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13645
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "395.425", cy: "138.681", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13646
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "279.178", cy: "66.467", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13647
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "97.4", cy: "122.68", r: "10.838", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13648
- /* @__PURE__ */ jsxRuntime.jsx(
13649
- "path",
13650
- {
13651
- fill: PRIMARY_DARK,
13652
- fillRule: "nonzero",
13653
- 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"
13654
- }
13655
- ),
13656
- /* @__PURE__ */ jsxRuntime.jsx(
13657
- "path",
13658
- {
13659
- fill: PRIMARY_MAIN,
13660
- fillRule: "nonzero",
13661
- 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",
13662
- opacity: "0.72"
13663
- }
13664
- ),
13665
- /* @__PURE__ */ jsxRuntime.jsx(
13666
- "path",
13667
- {
13668
- fill: PRIMARY_DARK,
13669
- fillRule: "nonzero",
13670
- 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"
13671
- }
13672
- )
13673
- ] }) });
13674
- }
13675
- var UploadIllustration_default = react.memo(UploadIllustration);
13676
- var StyledDropZone = styles.styled("div")(({ theme }) => ({
13677
- outline: "none",
13678
- cursor: "pointer",
13679
- overflow: "hidden",
13680
- position: "relative",
13681
- padding: theme.spacing(5),
13682
- borderRadius: theme.shape.borderRadius,
13683
- transition: theme.transitions.create("padding"),
13684
- backgroundColor: theme.palette.background.default,
13685
- border: `1px dashed ${styles.alpha(theme.palette.grey[500], 0.32)}`,
13686
- "&:hover": {
13687
- opacity: 0.72
13688
- }
13689
- }));
13690
- function Upload({
13691
- disabled,
13692
- multiple = false,
13693
- error,
13694
- helperText,
13695
- //
13696
- file,
13697
- onDelete,
13698
- //
13699
- files,
13700
- thumbnail,
13701
- onUpload,
13702
- onRemove,
13703
- onRemoveAll,
13704
- sx,
13705
- ...other
13706
- }) {
13707
- 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,
13708
12519
  multiple,
13709
- disabled,
13710
- ...other
12520
+ disabled: disabled || isMaxFilesReached,
12521
+ onDragEnter: () => setIsDragging(true),
12522
+ onDragLeave: () => setIsDragging(false),
12523
+ onDropAccepted: () => setIsDragging(false)
13711
12524
  });
13712
- const { t } = reactI18next.useTranslation();
13713
- const hasFile = !!file && !multiple;
13714
- const hasFiles = files && multiple && files.length > 0;
13715
- const isError = isDragReject || !!error;
13716
- return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { width: 1, position: "relative", ...sx }, children: [
13717
- /* @__PURE__ */ jsxRuntime.jsxs(
13718
- 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,
13719
12532
  {
13720
- ...getRootProps(),
13721
- sx: {
13722
- ...isDragActive && {
13723
- opacity: 0.72
13724
- },
13725
- ...isError && {
13726
- color: "error.main",
13727
- bgcolor: "error.lighter",
13728
- borderColor: "error.light"
13729
- },
13730
- ...disabled && {
13731
- opacity: 0.48,
13732
- 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
+ }
13733
12544
  },
13734
- ...hasFile && {
13735
- padding: "12% 0"
13736
- }
13737
- },
13738
- children: [
13739
- /* @__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 }),
13740
12565
  /* @__PURE__ */ jsxRuntime.jsx(
13741
- Placeholder,
12566
+ material.Box,
13742
12567
  {
13743
- sx: {
13744
- ...hasFile && {
13745
- 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" })
13746
12581
  }
13747
- }
12582
+ ) })
13748
12583
  }
13749
- ),
13750
- hasFile && /* @__PURE__ */ jsxRuntime.jsx(SingleFilePreview, { file })
13751
- ]
13752
- }
13753
- ),
13754
- helperText && helperText,
13755
- /* @__PURE__ */ jsxRuntime.jsx(RejectionFiles, { fileRejections }),
13756
- hasFile && onDelete && /* @__PURE__ */ jsxRuntime.jsx(
13757
- material.IconButton,
13758
- {
13759
- size: "small",
13760
- onClick: onDelete,
13761
- sx: {
13762
- top: 16,
13763
- right: 16,
13764
- zIndex: 9,
13765
- position: "absolute",
13766
- color: (theme) => styles.alpha(theme.palette.common.white, 0.8),
13767
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.72),
13768
- "&:hover": {
13769
- bgcolor: (theme) => styles.alpha(theme.palette.grey[900], 0.48)
13770
- }
13771
- },
13772
- children: /* @__PURE__ */ jsxRuntime.jsx(Iconify_default, { icon: "eva:close-fill", width: 18 })
13773
- }
13774
- ),
13775
- hasFiles === true && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13776
- /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { my: 3 }, children: /* @__PURE__ */ jsxRuntime.jsx(MultiFilePreview, { files, thumbnail, onRemove }) }),
13777
- /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "row", justifyContent: "flex-end", spacing: 1.5, children: [
13778
- onRemoveAll && /* @__PURE__ */ jsxRuntime.jsx(material.Button, { color: "inherit", variant: "outlined", size: "small", onClick: onRemoveAll, children: t("Remove all") }),
13779
- onUpload && /* @__PURE__ */ jsxRuntime.jsx(material.Button, { size: "small", variant: "contained", onClick: onUpload, children: t("Upload files") })
13780
- ] })
13781
- ] })
13782
- ] });
13783
- }
13784
- function Placeholder({ sx, ...other }) {
13785
- const { t } = reactI18next.useTranslation();
13786
- return /* @__PURE__ */ jsxRuntime.jsxs(
13787
- material.Stack,
13788
- {
13789
- spacing: 5,
13790
- alignItems: "center",
13791
- justifyContent: "center",
13792
- direction: {
13793
- xs: "column",
13794
- md: "row"
13795
- },
13796
- sx: {
13797
- width: 1,
13798
- textAlign: {
13799
- xs: "center",
13800
- md: "left"
13801
- },
13802
- ...sx
13803
- },
13804
- ...other,
13805
- children: [
13806
- /* @__PURE__ */ jsxRuntime.jsx(UploadIllustration_default, { sx: { width: 220 } }),
13807
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13808
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { gutterBottom: true, variant: "h5", children: t("Drop or Select file") }),
13809
- /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
13810
- t("Drop files here or click"),
13811
- /* @__PURE__ */ jsxRuntime.jsx(
13812
- material.Typography,
13813
- {
13814
- variant: "body2",
13815
- component: "span",
13816
- sx: {
13817
- mx: 0.5,
13818
- textDecoration: "underline"
13819
- },
13820
- children: t("browse")
13821
- }
13822
- ),
13823
- t("thorough your machine")
13824
- ] })
12584
+ )
13825
12585
  ] })
13826
- ]
13827
- }
13828
- );
13829
- }
13830
- async function blobToBase64(file) {
13831
- return new Promise((resolve, reject) => {
13832
- const reader = new FileReader();
13833
- reader.readAsDataURL(file);
13834
- reader.onloadend = function() {
13835
- const base64data = reader.result;
13836
- resolve(base64data);
13837
- };
13838
- reader.onerror = function(err) {
13839
- reject(err);
13840
- };
13841
- });
13842
- }
13843
- var AppUploadFile = ({
13844
- name,
13845
- sx,
13846
- uploadSx,
13847
- errorSx,
13848
- helperTextSx,
13849
- previewSx,
13850
- dropZoneSx,
13851
- ...rest
13852
- }) => {
13853
- var _a, _b;
13854
- const { errors, touched, setFieldValue, values } = formik.useFormikContext();
13855
- const fieldError = _19__default.default.get(errors, name);
13856
- const isTouched = _19__default.default.get(touched, name);
13857
- let val = _19__default.default.get(values, name);
13858
- if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13859
- val = val ? [val] : [];
13860
- } else if (!((_b = rest.multiple) != null ? _b : false) && _19__default.default.isArray(val)) {
13861
- val = val[0];
13862
- }
13863
- const formatValue = (val2) => {
13864
- if (rest.multiple) {
13865
- return (Array.isArray(val2) ? val2 : []).map((item) => ({
13866
- ...(item == null ? void 0 : item.file) ? item : { file: item, preview: item == null ? void 0 : item.preview }
13867
- }));
13868
- }
13869
- return (val2 == null ? void 0 : val2.file) ? val2 : val2 ? { file: val2, preview: val2.preview } : null;
12586
+ },
12587
+ index
12588
+ );
13870
12589
  };
13871
- const formattedValue = formatValue(val);
13872
- const currentFiles = Array.isArray(val) ? val : [];
13873
- const isMaxFilesReached = rest.maxFiles !== null && rest.maxFiles !== void 0 && currentFiles.length >= rest.maxFiles;
13874
12590
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx, children: [
13875
- /* @__PURE__ */ jsxRuntime.jsx(
13876
- Upload,
12591
+ /* @__PURE__ */ jsxRuntime.jsxs(
12592
+ material.Box,
13877
12593
  {
13878
- ...rest,
13879
- file: rest.multiple ? void 0 : formattedValue,
13880
- files: rest.multiple ? formattedValue : void 0,
13881
- error: Boolean(fieldError) && isTouched,
13882
- disabled: isMaxFilesReached,
13883
- sx: [{
13884
- "& .MuiDropzoneArea-root": {
13885
- minHeight: 200,
12594
+ ...getRootProps(),
12595
+ sx: [
12596
+ {
12597
+ p: 3,
13886
12598
  border: "2px dashed",
13887
- borderColor: "divider",
13888
12599
  borderRadius: 1,
13889
- "&: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 && {
13890
12606
  borderColor: "primary.main",
13891
- backgroundColor: "action.hover"
13892
- },
13893
- ...dropZoneSx
13894
- },
13895
- "& .MuiDropzonePreviewList-root": {
13896
- ...previewSx
12607
+ bgcolor: "action.hover"
12608
+ }
13897
12609
  },
13898
- ...uploadSx
13899
- }],
13900
- onDrop: (fileVal) => {
13901
- (async () => {
13902
- var _a2;
13903
- const images = await Promise.all(
13904
- fileVal.map(async (single) => {
13905
- var _a3;
13906
- return {
13907
- preview: ((_a3 = single == null ? void 0 : single.type) == null ? void 0 : _a3.includes("image")) ? await blobToBase64(single) : void 0,
13908
- file: single
13909
- };
13910
- })
13911
- );
13912
- const currentValue = Array.isArray(val) ? [...val] : [];
13913
- if (rest.multiple === true) {
13914
- if (currentValue.length >= ((_a2 = rest.maxFiles) != null ? _a2 : Infinity))
13915
- return;
13916
- setFieldValue(name, [...currentValue, ...images], true);
13917
- } else {
13918
- setFieldValue(name, images[0], true);
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
+ ]
13919
12632
  }
13920
- })();
13921
- },
13922
- onDelete: () => {
13923
- var _a2;
13924
- if ((_a2 = rest.multiple) != null ? _a2 : false) {
13925
- setFieldValue(name, [], true);
13926
- } else {
13927
- setFieldValue(name, null, true);
13928
- }
13929
- },
13930
- onRemove: (fileToRemove) => {
13931
- if (rest.multiple) {
13932
- const currentFiles2 = Array.isArray(val) ? [...val] : [];
13933
- const filteredFiles = currentFiles2.filter((file) => {
13934
- const fileObj = (file == null ? void 0 : file.file) ? file.file : file;
13935
- return !_19__default.default.isEqual(fileObj, fileToRemove);
13936
- });
13937
- setFieldValue(name, filteredFiles, true);
13938
- } else {
13939
- setFieldValue(name, null, true);
13940
- }
13941
- }
12633
+ )
12634
+ ]
13942
12635
  }
13943
12636
  ),
13944
- 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(
13945
12639
  material.Typography,
13946
12640
  {
13947
12641
  variant: "caption",
13948
- sx: [{
13949
- color: "error.main",
13950
- display: "block",
13951
- mt: 0.5,
13952
- ...errorSx
13953
- }],
13954
- gutterBottom: true,
12642
+ sx: [
12643
+ {
12644
+ display: "block",
12645
+ color: "error.main",
12646
+ mt: 1
12647
+ },
12648
+ ...Array.isArray(errorSx) ? errorSx : [errorSx]
12649
+ ],
13955
12650
  children: fieldError
13956
12651
  }
13957
12652
  ),
13958
- rest.maxFiles != null && /* @__PURE__ */ jsxRuntime.jsxs(
12653
+ /* @__PURE__ */ jsxRuntime.jsxs(
13959
12654
  material.Typography,
13960
12655
  {
13961
12656
  variant: "caption",
13962
- sx: [{
13963
- display: "block",
13964
- color: "text.secondary",
13965
- mt: 0.5,
13966
- ...helperTextSx
13967
- }],
13968
- gutterBottom: true,
12657
+ sx: [
12658
+ {
12659
+ display: "block",
12660
+ color: "text.secondary",
12661
+ mt: 0.5
12662
+ },
12663
+ ...Array.isArray(helperTextSx) ? helperTextSx : [helperTextSx]
12664
+ ],
13969
12665
  children: [
13970
- "Maximum ",
13971
- rest.maxFiles,
13972
- " file",
13973
- rest.maxFiles !== 1 ? "s" : "",
13974
- " allowed"
12666
+ (currentFiles == null ? void 0 : currentFiles.length) || 0,
12667
+ " of ",
12668
+ maxFiles,
12669
+ " files selected"
13975
12670
  ]
13976
12671
  }
13977
12672
  )