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.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
2
- import { forwardRef, memo, createElement, useState, useEffect } from 'react';
3
- import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, MenuItem, Chip, Switch, InputAdornment, IconButton, Checkbox, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Menu } from '@mui/material';
2
+ import { forwardRef, createElement, useState, useEffect, useCallback } from 'react';
3
+ import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, MenuItem, Chip, Switch, InputAdornment, IconButton, Checkbox, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Avatar } from '@mui/material';
4
4
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
5
5
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
6
6
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
7
7
  import { Dayjs } from 'dayjs';
8
- import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
9
- import _19, { get } from 'lodash';
8
+ import _, { get } from 'lodash';
10
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
10
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
12
11
  import Autocomplete3 from '@mui/material/Autocomplete';
@@ -33,11 +32,8 @@ import UndoIcon from '@mui/icons-material/Undo';
33
32
  import RedoIcon from '@mui/icons-material/Redo';
34
33
  import CloudUploadIcon from '@mui/icons-material/CloudUpload';
35
34
  import CloseIcon from '@mui/icons-material/Close';
36
- import { styled, alpha, useTheme as useTheme$1 } from '@mui/material/styles';
37
- import { LazyLoadImage } from 'react-lazy-load-image-component';
38
- import { AnimatePresence, m } from 'framer-motion';
35
+ import { Image, InsertDriveFile, Delete as Delete$1 } from '@mui/icons-material';
39
36
  import { useDropzone } from 'react-dropzone';
40
- import { useTranslation } from 'react-i18next';
41
37
 
42
38
  // src/Form/index.tsx
43
39
  var AppDatePicker = forwardRef(
@@ -61,9 +57,9 @@ var AppDatePicker = forwardRef(
61
57
  ...otherProps
62
58
  }, ref) => {
63
59
  const { values, setFieldValue, touched, errors, setFieldTouched } = useFormikContext();
64
- const fieldValue = _19.get(values, name);
65
- const fieldError = _19.get(errors, name);
66
- const isTouched = _19.get(touched, name);
60
+ const fieldValue = _.get(values, name);
61
+ const fieldError = _.get(errors, name);
62
+ const isTouched = _.get(touched, name);
67
63
  const handleChange = (newValue, context) => {
68
64
  setFieldValue(name, newValue);
69
65
  if (externalOnChange) {
@@ -76,7 +72,7 @@ var AppDatePicker = forwardRef(
76
72
  externalOnBlur(event);
77
73
  }
78
74
  };
79
- return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsx(DemoContainer, { components: ["DatePicker"], children: /* @__PURE__ */ jsx(
75
+ return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsx(
80
76
  DatePicker,
81
77
  {
82
78
  label,
@@ -171,7 +167,7 @@ var AppDatePicker = forwardRef(
171
167
  },
172
168
  ...otherProps
173
169
  }
174
- ) }) }) });
170
+ ) }) });
175
171
  }
176
172
  );
177
173
  AppDatePicker.displayName = "AppDatePicker";
@@ -379,8 +375,8 @@ function AppFormErrorMessage({
379
375
  textSx
380
376
  }) {
381
377
  const { errors, touched } = useFormikContext();
382
- const fieldError = _19.get(errors, name);
383
- const isTouched = _19.get(touched, name);
378
+ const fieldError = _.get(errors, name);
379
+ const isTouched = _.get(touched, name);
384
380
  const showError = fieldError && typeof fieldError === "string";
385
381
  if (alwaysShow) {
386
382
  return showError ? /* @__PURE__ */ jsx(
@@ -457,9 +453,9 @@ var AppTextArea = forwardRef(({
457
453
  }, ref) => {
458
454
  var _a, _b, _c, _d;
459
455
  const { errors, getFieldProps, touched, setFieldValue } = useFormikContext();
460
- const fieldError = _19.get(errors, name);
461
- const isTouched = _19.get(touched, name);
462
- const value = _19.get(getFieldProps(name), "value", "");
456
+ const fieldError = _.get(errors, name);
457
+ const isTouched = _.get(touched, name);
458
+ const value = _.get(getFieldProps(name), "value", "");
463
459
  const handleChange = (e) => {
464
460
  const newValue = e.target.value;
465
461
  if (maxLength && newValue.length > maxLength)
@@ -613,9 +609,9 @@ function AppTagsCreator({
613
609
  inputSx
614
610
  }) {
615
611
  const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = useFormikContext();
616
- const fieldError = _19.get(errors, name);
617
- const isTouched = _19.get(touched, name);
618
- const val = _19.get(values, name);
612
+ const fieldError = _.get(errors, name);
613
+ const isTouched = _.get(touched, name);
614
+ const val = _.get(values, name);
619
615
  return /* @__PURE__ */ jsxs(
620
616
  FormControl,
621
617
  {
@@ -738,8 +734,8 @@ function AppSwitchInput({
738
734
  ...otherProps
739
735
  }) {
740
736
  const { errors, touched, setFieldValue, values } = useFormikContext();
741
- const fieldError = _19.get(errors, name);
742
- const isTouched = _19.get(touched, name);
737
+ const fieldError = _.get(errors, name);
738
+ const isTouched = _.get(touched, name);
743
739
  return /* @__PURE__ */ jsxs(
744
740
  Box,
745
741
  {
@@ -828,9 +824,9 @@ function AppSwitch({
828
824
  ...otherProps
829
825
  }) {
830
826
  const { errors, touched, setFieldValue, values } = useFormikContext();
831
- const fieldValue = _19.get(values, name);
832
- const fieldError = _19.get(errors, name);
833
- const isTouched = _19.get(touched, name);
827
+ const fieldValue = _.get(values, name);
828
+ const fieldError = _.get(errors, name);
829
+ const isTouched = _.get(touched, name);
834
830
  return /* @__PURE__ */ jsxs(
835
831
  Stack,
836
832
  {
@@ -927,9 +923,9 @@ function AppAutoComplete({
927
923
  errorSx
928
924
  }) {
929
925
  const { errors, touched, getFieldProps, values, setFieldValue } = useFormikContext();
930
- const fieldError = _19.get(errors, name);
931
- const isTouched = _19.get(touched, name);
932
- const formikValue = _19.get(values, name);
926
+ const fieldError = _.get(errors, name);
927
+ const isTouched = _.get(touched, name);
928
+ const formikValue = _.get(values, name);
933
929
  const val = propValue !== void 0 ? propValue : formikValue || [];
934
930
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
935
931
  /* @__PURE__ */ jsx(
@@ -1001,9 +997,9 @@ function AppAutoCompleter({
1001
997
  errorSx
1002
998
  }) {
1003
999
  const { errors, touched, values, setFieldValue } = useFormikContext();
1004
- const fieldError = _19.get(errors, name);
1005
- const isTouched = _19.get(touched, name);
1006
- const value = _19.get(values, name);
1000
+ const fieldError = _.get(errors, name);
1001
+ const isTouched = _.get(touched, name);
1002
+ const value = _.get(values, name);
1007
1003
  const selectedOption = options.find((opt) => opt.value === value) || null;
1008
1004
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
1009
1005
  /* @__PURE__ */ jsx(
@@ -1066,14 +1062,23 @@ var AppCheckBox = ({
1066
1062
  ...rest
1067
1063
  }) => {
1068
1064
  const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
1069
- const fieldError = _19.get(errors, name);
1070
- const isTouched = _19.get(touched, name);
1065
+ const fieldError = _.get(errors, name);
1066
+ const isTouched = _.get(touched, name);
1071
1067
  useTheme();
1072
1068
  const value = getFieldProps(name).value;
1073
- const checkedNames = Array.isArray(value) ? value : value ? [value] : [];
1074
- const handleChange = (itemName, isChecked) => {
1075
- const newValue = isChecked ? [...checkedNames, itemName] : checkedNames.filter((n) => n !== itemName);
1076
- setFieldValue(name, option.length === 1 ? isChecked : newValue);
1069
+ const checkedValues = (() => {
1070
+ if (Array.isArray(value)) {
1071
+ return value.map(String);
1072
+ }
1073
+ return value ? [String(value)] : [];
1074
+ })();
1075
+ const handleChange = (itemValue, isChecked) => {
1076
+ if (option.length === 1) {
1077
+ setFieldValue(name, isChecked ? itemValue : false);
1078
+ } else {
1079
+ const newValue = isChecked ? [...checkedValues, String(itemValue)] : checkedValues.filter((v) => v !== String(itemValue));
1080
+ setFieldValue(name, newValue);
1081
+ }
1077
1082
  };
1078
1083
  return /* @__PURE__ */ jsxs(
1079
1084
  Box,
@@ -1142,11 +1147,9 @@ var AppCheckBox = ({
1142
1147
  /* @__PURE__ */ jsx(
1143
1148
  Checkbox,
1144
1149
  {
1145
- ...getFieldProps(name),
1146
- name,
1147
- value: item.name,
1148
- checked: checkedNames.includes(item.name),
1149
- onChange: (e) => handleChange(item.name, e.target.checked),
1150
+ name: `${name}.${item.name}`,
1151
+ checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
1152
+ onChange: (e) => handleChange(item.value, e.target.checked),
1150
1153
  disabled: disabled || item.disabled,
1151
1154
  sx: [{
1152
1155
  color: "primary.main",
@@ -1223,8 +1226,8 @@ function AppInputField({
1223
1226
  ...otherProps
1224
1227
  }) {
1225
1228
  const { errors, getFieldProps, touched } = useFormikContext();
1226
- const fieldError = _19.get(errors, name);
1227
- const isTouched = _19.get(touched, name);
1229
+ const fieldError = _.get(errors, name);
1230
+ const isTouched = _.get(touched, name);
1228
1231
  const [showPassword, setShowPassword] = useState(false);
1229
1232
  const handleShowPassword = () => {
1230
1233
  setShowPassword(!showPassword);
@@ -1315,9 +1318,9 @@ var AppMultiSelector = forwardRef(
1315
1318
  }, ref) => {
1316
1319
  const theme = useTheme();
1317
1320
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
1318
- const fieldError = _19.get(errors, name);
1319
- const isTouched = _19.get(touched, name);
1320
- const val = _19.get(values, name);
1321
+ const fieldError = _.get(errors, name);
1322
+ const isTouched = _.get(touched, name);
1323
+ const val = _.get(values, name);
1321
1324
  const selectedValues = Array.isArray(val) ? val : [];
1322
1325
  const handleChange = (event, child) => {
1323
1326
  const newValue = event.target.value;
@@ -1575,8 +1578,8 @@ var AppPhoneNoInput = ({
1575
1578
  ...otherProps
1576
1579
  }) => {
1577
1580
  const { values, errors, touched, setFieldValue, getFieldProps } = useFormikContext();
1578
- const fieldError = _19.get(errors, name);
1579
- const isTouched = _19.get(touched, name);
1581
+ const fieldError = _.get(errors, name);
1582
+ const isTouched = _.get(touched, name);
1580
1583
  return /* @__PURE__ */ jsxs(Box, { sx: [{ mb: 2 }, containerSx, sx], children: [
1581
1584
  label && /* @__PURE__ */ jsxs(
1582
1585
  Typography,
@@ -1660,9 +1663,9 @@ var AppRadioGroup = forwardRef(({
1660
1663
  ...rest
1661
1664
  }, ref) => {
1662
1665
  const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
1663
- const fieldError = _19.get(errors, name);
1664
- const isTouched = _19.get(touched, name);
1665
- const value = _19.get(getFieldProps(name), "value");
1666
+ const fieldError = _.get(errors, name);
1667
+ const isTouched = _.get(touched, name);
1668
+ const value = _.get(getFieldProps(name), "value");
1666
1669
  const handleChange = (event) => {
1667
1670
  const newValue = event.target.value;
1668
1671
  setFieldValue(name, newValue);
@@ -1840,9 +1843,9 @@ var AppRating = forwardRef(({
1840
1843
  }, ref) => {
1841
1844
  useTheme();
1842
1845
  const { errors, touched, setFieldValue, values, setFieldTouched } = useFormikContext();
1843
- const val = _19.get(values, name);
1844
- const fieldError = _19.get(errors, name);
1845
- const isTouched = _19.get(touched, name);
1846
+ const val = _.get(values, name);
1847
+ const fieldError = _.get(errors, name);
1848
+ const isTouched = _.get(touched, name);
1846
1849
  const hasError = Boolean(fieldError) && isTouched;
1847
1850
  const handleChange = (event, newValue) => {
1848
1851
  setFieldValue(name, newValue);
@@ -3523,7 +3526,7 @@ var Node = class {
3523
3526
  copy2 = mark.addToSet(copy2);
3524
3527
  }
3525
3528
  if (!Mark.sameSet(copy2, this.marks))
3526
- throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m2) => m2.type.name)}`);
3529
+ throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
3527
3530
  this.content.forEach((node) => node.check());
3528
3531
  }
3529
3532
  /**
@@ -3772,17 +3775,17 @@ var ContentMatch = class {
3772
3775
  */
3773
3776
  toString() {
3774
3777
  let seen = [];
3775
- function scan(m2) {
3776
- seen.push(m2);
3777
- for (let i = 0; i < m2.next.length; i++)
3778
- if (seen.indexOf(m2.next[i].next) == -1)
3779
- scan(m2.next[i].next);
3778
+ function scan(m) {
3779
+ seen.push(m);
3780
+ for (let i = 0; i < m.next.length; i++)
3781
+ if (seen.indexOf(m.next[i].next) == -1)
3782
+ scan(m.next[i].next);
3780
3783
  }
3781
3784
  scan(this);
3782
- return seen.map((m2, i) => {
3783
- let out = i + (m2.validEnd ? "*" : " ") + " ";
3784
- for (let i2 = 0; i2 < m2.next.length; i2++)
3785
- out += (i2 ? ", " : "") + m2.next[i2].type.name + "->" + seen.indexOf(m2.next[i2].next);
3785
+ return seen.map((m, i) => {
3786
+ let out = i + (m.validEnd ? "*" : " ") + " ";
3787
+ for (let i2 = 0; i2 < m.next.length; i2++)
3788
+ out += (i2 ? ", " : "") + m.next[i2].type.name + "->" + seen.indexOf(m.next[i2].next);
3786
3789
  return out;
3787
3790
  }).join("\n");
3788
3791
  }
@@ -4663,13 +4666,13 @@ var NodeContext = class {
4663
4666
  }
4664
4667
  finish(openEnd) {
4665
4668
  if (!(this.options & OPT_PRESERVE_WS)) {
4666
- let last = this.content[this.content.length - 1], m2;
4667
- if (last && last.isText && (m2 = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4669
+ let last = this.content[this.content.length - 1], m;
4670
+ if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
4668
4671
  let text = last;
4669
- if (last.text.length == m2[0].length)
4672
+ if (last.text.length == m[0].length)
4670
4673
  this.content.pop();
4671
4674
  else
4672
- this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
4675
+ this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
4673
4676
  }
4674
4677
  }
4675
4678
  let content = Fragment2.from(this.content);
@@ -4821,7 +4824,7 @@ var ParseContext = class {
4821
4824
  if (rule.ignore)
4822
4825
  return null;
4823
4826
  if (rule.clearMark)
4824
- marks = marks.filter((m2) => !rule.clearMark(m2));
4827
+ marks = marks.filter((m) => !rule.clearMark(m));
4825
4828
  else
4826
4829
  marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
4827
4830
  if (rule.consuming === false)
@@ -4927,9 +4930,9 @@ var ParseContext = class {
4927
4930
  if (top.match)
4928
4931
  top.match = top.match.matchType(node.type);
4929
4932
  let nodeMarks = Mark.none;
4930
- for (let m2 of innerMarks.concat(node.marks))
4931
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, node.type))
4932
- nodeMarks = m2.addToSet(nodeMarks);
4933
+ for (let m of innerMarks.concat(node.marks))
4934
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))
4935
+ nodeMarks = m.addToSet(nodeMarks);
4933
4936
  top.content.push(node.mark(nodeMarks));
4934
4937
  return true;
4935
4938
  }
@@ -4952,9 +4955,9 @@ var ParseContext = class {
4952
4955
  if (top.options & OPT_OPEN_LEFT && top.content.length == 0)
4953
4956
  options |= OPT_OPEN_LEFT;
4954
4957
  let applyMarks = Mark.none;
4955
- marks = marks.filter((m2) => {
4956
- if (top.type ? top.type.allowsMarkType(m2.type) : markMayApply(m2.type, type)) {
4957
- applyMarks = m2.addToSet(applyMarks);
4958
+ marks = marks.filter((m) => {
4959
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
4960
+ applyMarks = m.addToSet(applyMarks);
4958
4961
  return false;
4959
4962
  }
4960
4963
  return true;
@@ -5342,10 +5345,10 @@ var Mapping = class {
5342
5345
  /**
5343
5346
  @internal
5344
5347
  */
5345
- setMirror(n, m2) {
5348
+ setMirror(n, m) {
5346
5349
  if (!this.mirror)
5347
5350
  this.mirror = [];
5348
- this.mirror.push(n, m2);
5351
+ this.mirror.push(n, m);
5349
5352
  }
5350
5353
  /**
5351
5354
  Append the inverse of the given mapping to this one.
@@ -5887,9 +5890,9 @@ function removeMark(tr, from, to, mark) {
5887
5890
  for (let i = 0; i < toRemove.length; i++) {
5888
5891
  let style = toRemove[i], found2;
5889
5892
  for (let j = 0; j < matched.length; j++) {
5890
- let m2 = matched[j];
5891
- if (m2.step == step - 1 && style.eq(matched[j].style))
5892
- found2 = m2;
5893
+ let m = matched[j];
5894
+ if (m.step == step - 1 && style.eq(matched[j].style))
5895
+ found2 = m;
5893
5896
  }
5894
5897
  if (found2) {
5895
5898
  found2.to = end;
@@ -5900,7 +5903,7 @@ function removeMark(tr, from, to, mark) {
5900
5903
  }
5901
5904
  }
5902
5905
  });
5903
- matched.forEach((m2) => tr.step(new RemoveMarkStep(m2.from, m2.to, m2.style)));
5906
+ matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
5904
5907
  }
5905
5908
  function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
5906
5909
  let node = tr.doc.nodeAt(pos);
@@ -5916,11 +5919,11 @@ function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch,
5916
5919
  if (!parentType.allowsMarkType(child.marks[j].type))
5917
5920
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
5918
5921
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
5919
- let m2, newline = /\r?\n|\r/g, slice;
5920
- while (m2 = newline.exec(child.text)) {
5922
+ let m, newline = /\r?\n|\r/g, slice;
5923
+ while (m = newline.exec(child.text)) {
5921
5924
  if (!slice)
5922
5925
  slice = new Slice(Fragment2.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
5923
- replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice));
5926
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
5924
5927
  }
5925
5928
  }
5926
5929
  }
@@ -6052,9 +6055,9 @@ function setBlockType(tr, from, to, type, attrs) {
6052
6055
  function replaceNewlines(tr, node, pos, mapFrom) {
6053
6056
  node.forEach((child, offset) => {
6054
6057
  if (child.isText) {
6055
- let m2, newline = /\r?\n|\r/g;
6056
- while (m2 = newline.exec(child.text)) {
6057
- let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m2.index);
6058
+ let m, newline = /\r?\n|\r/g;
6059
+ while (m = newline.exec(child.text)) {
6060
+ let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
6058
6061
  tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
6059
6062
  }
6060
6063
  }
@@ -10120,11 +10123,11 @@ var Mark2 = class _Mark extends Extendable {
10120
10123
  const isAtEnd = currentPos.pos === currentPos.end();
10121
10124
  if (isAtEnd) {
10122
10125
  const currentMarks = currentPos.marks();
10123
- const isInMark = !!currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10126
+ const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10124
10127
  if (!isInMark) {
10125
10128
  return false;
10126
10129
  }
10127
- const removeMark2 = currentMarks.find((m2) => (m2 == null ? void 0 : m2.type.name) === mark.name);
10130
+ const removeMark2 = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
10128
10131
  if (removeMark2) {
10129
10132
  tr.removeStoredMark(removeMark2);
10130
10133
  }
@@ -11152,12 +11155,14 @@ var AppRichTextEditor = ({
11152
11155
  Typography,
11153
11156
  {
11154
11157
  variant: "caption",
11155
- sx: [{
11156
- color: "error.main",
11157
- display: "block",
11158
- mt: 0.5,
11159
- ...errorSx
11160
- }],
11158
+ sx: [
11159
+ {
11160
+ color: "error.main",
11161
+ display: "block",
11162
+ mt: 0.5,
11163
+ ...errorSx
11164
+ }
11165
+ ],
11161
11166
  children: msg
11162
11167
  }
11163
11168
  )
@@ -11167,167 +11172,173 @@ var AppRichTextEditor = ({
11167
11172
  Typography,
11168
11173
  {
11169
11174
  variant: "button",
11170
- sx: [{
11171
- color: "text.primary",
11172
- mb: 1,
11173
- display: "block",
11174
- ...labelSx
11175
- }],
11175
+ sx: [
11176
+ {
11177
+ color: "text.primary",
11178
+ mb: 1,
11179
+ display: "block",
11180
+ ...labelSx
11181
+ }
11182
+ ],
11176
11183
  children: [
11177
11184
  label,
11178
11185
  required && /* @__PURE__ */ jsx(Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
11179
11186
  ]
11180
11187
  }
11181
11188
  ),
11182
- /* @__PURE__ */ jsxs(Box, { sx: {
11183
- mb: 1,
11184
- display: "flex",
11185
- gap: 1,
11186
- flexWrap: "wrap",
11187
- p: 1,
11188
- bgcolor: "background.paper",
11189
- borderRadius: 1,
11190
- border: "1px solid",
11191
- borderColor: "divider",
11192
- ...toolbarSx
11193
- }, children: [
11194
- /* @__PURE__ */ jsx(Tooltip, { title: "Bold", children: /* @__PURE__ */ jsx(
11195
- IconButton,
11196
- {
11197
- onClick: () => editor.chain().focus().toggleBold().run(),
11198
- color: editor.isActive("bold") ? "primary" : "default",
11199
- sx: {
11200
- ...buttonSx,
11201
- ...editor.isActive("bold") ? activeButtonSx : {}
11202
- },
11203
- children: /* @__PURE__ */ jsx(FormatBoldIcon, {})
11204
- }
11205
- ) }),
11206
- /* @__PURE__ */ jsx(Tooltip, { title: "Italic", children: /* @__PURE__ */ jsx(
11207
- IconButton,
11208
- {
11209
- onClick: () => editor.chain().focus().toggleItalic().run(),
11210
- color: editor.isActive("italic") ? "primary" : "default",
11211
- sx: {
11212
- ...buttonSx,
11213
- ...editor.isActive("italic") ? activeButtonSx : {}
11214
- },
11215
- children: /* @__PURE__ */ jsx(FormatItalicIcon, {})
11216
- }
11217
- ) }),
11218
- /* @__PURE__ */ jsx(Tooltip, { title: "Underline", children: /* @__PURE__ */ jsx(
11219
- IconButton,
11220
- {
11221
- onClick: () => editor.chain().focus().toggleUnderline().run(),
11222
- color: editor.isActive("underline") ? "primary" : "default",
11223
- sx: {
11224
- ...buttonSx,
11225
- ...editor.isActive("underline") ? activeButtonSx : {}
11226
- },
11227
- children: /* @__PURE__ */ jsx(FormatUnderlinedIcon, {})
11228
- }
11229
- ) }),
11230
- /* @__PURE__ */ jsx(Tooltip, { title: "Strike", children: /* @__PURE__ */ jsx(
11231
- IconButton,
11232
- {
11233
- onClick: () => editor.chain().focus().toggleStrike().run(),
11234
- color: editor.isActive("strike") ? "primary" : "default",
11235
- sx: {
11236
- ...buttonSx,
11237
- ...editor.isActive("strike") ? activeButtonSx : {}
11238
- },
11239
- children: /* @__PURE__ */ jsx(StrikethroughSIcon, {})
11240
- }
11241
- ) }),
11242
- /* @__PURE__ */ jsx(Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsx(
11243
- IconButton,
11244
- {
11245
- onClick: () => editor.chain().focus().toggleBulletList().run(),
11246
- color: editor.isActive("bulletList") ? "primary" : "default",
11247
- sx: {
11248
- ...buttonSx,
11249
- ...editor.isActive("bulletList") ? activeButtonSx : {}
11250
- },
11251
- children: /* @__PURE__ */ jsx(FormatListBulletedIcon, {})
11252
- }
11253
- ) }),
11254
- /* @__PURE__ */ jsx(Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsx(
11255
- IconButton,
11256
- {
11257
- onClick: () => editor.chain().focus().toggleOrderedList().run(),
11258
- color: editor.isActive("orderedList") ? "primary" : "default",
11259
- sx: {
11260
- ...buttonSx,
11261
- ...editor.isActive("orderedList") ? activeButtonSx : {}
11262
- },
11263
- children: /* @__PURE__ */ jsx(FormatListNumberedIcon, {})
11264
- }
11265
- ) }),
11266
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsx(
11267
- IconButton,
11268
- {
11269
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
11270
- color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11271
- sx: {
11272
- ...buttonSx,
11273
- ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11274
- },
11275
- children: /* @__PURE__ */ jsx(FormatAlignLeftIcon, {})
11276
- }
11277
- ) }),
11278
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsx(
11279
- IconButton,
11280
- {
11281
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
11282
- color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11283
- sx: {
11284
- ...buttonSx,
11285
- ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11286
- },
11287
- children: /* @__PURE__ */ jsx(FormatAlignCenterIcon, {})
11288
- }
11289
- ) }),
11290
- /* @__PURE__ */ jsx(Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsx(
11291
- IconButton,
11292
- {
11293
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
11294
- color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11295
- sx: {
11296
- ...buttonSx,
11297
- ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11298
- },
11299
- children: /* @__PURE__ */ jsx(FormatAlignRightIcon, {})
11300
- }
11301
- ) }),
11302
- /* @__PURE__ */ jsx(Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsx(
11303
- IconButton,
11304
- {
11305
- onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11306
- color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11307
- sx: {
11308
- ...buttonSx,
11309
- ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11310
- },
11311
- children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "1rem" } })
11312
- }
11313
- ) }),
11314
- /* @__PURE__ */ jsx(Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxs(
11315
- IconButton,
11316
- {
11317
- onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11318
- color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11319
- sx: {
11320
- ...buttonSx,
11321
- ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11322
- },
11323
- children: [
11324
- /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "0.85rem" } }),
11325
- /* @__PURE__ */ jsx(UndoIcon, {})
11326
- ]
11327
- }
11328
- ) }),
11329
- /* @__PURE__ */ jsx(Tooltip, { title: "Redo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsx(RedoIcon, {}) }) })
11330
- ] }),
11189
+ /* @__PURE__ */ jsxs(
11190
+ Box,
11191
+ {
11192
+ sx: {
11193
+ mb: 1,
11194
+ display: "flex",
11195
+ gap: 1,
11196
+ flexWrap: "wrap",
11197
+ p: 1,
11198
+ bgcolor: "background.paper",
11199
+ borderRadius: 1,
11200
+ border: "1px solid",
11201
+ borderColor: "divider",
11202
+ ...toolbarSx
11203
+ },
11204
+ children: [
11205
+ /* @__PURE__ */ jsx(Tooltip, { title: "Bold", children: /* @__PURE__ */ jsx(
11206
+ IconButton,
11207
+ {
11208
+ onClick: () => editor.chain().focus().toggleBold().run(),
11209
+ color: editor.isActive("bold") ? "primary" : "default",
11210
+ sx: {
11211
+ ...buttonSx,
11212
+ ...editor.isActive("bold") ? activeButtonSx : {}
11213
+ },
11214
+ children: /* @__PURE__ */ jsx(FormatBoldIcon, {})
11215
+ }
11216
+ ) }),
11217
+ /* @__PURE__ */ jsx(Tooltip, { title: "Italic", children: /* @__PURE__ */ jsx(
11218
+ IconButton,
11219
+ {
11220
+ onClick: () => editor.chain().focus().toggleItalic().run(),
11221
+ color: editor.isActive("italic") ? "primary" : "default",
11222
+ sx: {
11223
+ ...buttonSx,
11224
+ ...editor.isActive("italic") ? activeButtonSx : {}
11225
+ },
11226
+ children: /* @__PURE__ */ jsx(FormatItalicIcon, {})
11227
+ }
11228
+ ) }),
11229
+ /* @__PURE__ */ jsx(Tooltip, { title: "Underline", children: /* @__PURE__ */ jsx(
11230
+ IconButton,
11231
+ {
11232
+ onClick: () => editor.chain().focus().toggleUnderline().run(),
11233
+ color: editor.isActive("underline") ? "primary" : "default",
11234
+ sx: {
11235
+ ...buttonSx,
11236
+ ...editor.isActive("underline") ? activeButtonSx : {}
11237
+ },
11238
+ children: /* @__PURE__ */ jsx(FormatUnderlinedIcon, {})
11239
+ }
11240
+ ) }),
11241
+ /* @__PURE__ */ jsx(Tooltip, { title: "Strike", children: /* @__PURE__ */ jsx(
11242
+ IconButton,
11243
+ {
11244
+ onClick: () => editor.chain().focus().toggleStrike().run(),
11245
+ color: editor.isActive("strike") ? "primary" : "default",
11246
+ sx: {
11247
+ ...buttonSx,
11248
+ ...editor.isActive("strike") ? activeButtonSx : {}
11249
+ },
11250
+ children: /* @__PURE__ */ jsx(StrikethroughSIcon, {})
11251
+ }
11252
+ ) }),
11253
+ /* @__PURE__ */ jsx(Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsx(
11254
+ IconButton,
11255
+ {
11256
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
11257
+ color: editor.isActive("bulletList") ? "primary" : "default",
11258
+ sx: {
11259
+ ...buttonSx,
11260
+ ...editor.isActive("bulletList") ? activeButtonSx : {}
11261
+ },
11262
+ children: /* @__PURE__ */ jsx(FormatListBulletedIcon, {})
11263
+ }
11264
+ ) }),
11265
+ /* @__PURE__ */ jsx(Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsx(
11266
+ IconButton,
11267
+ {
11268
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
11269
+ color: editor.isActive("orderedList") ? "primary" : "default",
11270
+ sx: {
11271
+ ...buttonSx,
11272
+ ...editor.isActive("orderedList") ? activeButtonSx : {}
11273
+ },
11274
+ children: /* @__PURE__ */ jsx(FormatListNumberedIcon, {})
11275
+ }
11276
+ ) }),
11277
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsx(
11278
+ IconButton,
11279
+ {
11280
+ onClick: () => editor.chain().focus().setTextAlign("left").run(),
11281
+ color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11282
+ sx: {
11283
+ ...buttonSx,
11284
+ ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11285
+ },
11286
+ children: /* @__PURE__ */ jsx(FormatAlignLeftIcon, {})
11287
+ }
11288
+ ) }),
11289
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsx(
11290
+ IconButton,
11291
+ {
11292
+ onClick: () => editor.chain().focus().setTextAlign("center").run(),
11293
+ color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11294
+ sx: {
11295
+ ...buttonSx,
11296
+ ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11297
+ },
11298
+ children: /* @__PURE__ */ jsx(FormatAlignCenterIcon, {})
11299
+ }
11300
+ ) }),
11301
+ /* @__PURE__ */ jsx(Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsx(
11302
+ IconButton,
11303
+ {
11304
+ onClick: () => editor.chain().focus().setTextAlign("right").run(),
11305
+ color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11306
+ sx: {
11307
+ ...buttonSx,
11308
+ ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11309
+ },
11310
+ children: /* @__PURE__ */ jsx(FormatAlignRightIcon, {})
11311
+ }
11312
+ ) }),
11313
+ /* @__PURE__ */ jsx(Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsx(
11314
+ IconButton,
11315
+ {
11316
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11317
+ color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11318
+ sx: {
11319
+ ...buttonSx,
11320
+ ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11321
+ },
11322
+ children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "1rem" } })
11323
+ }
11324
+ ) }),
11325
+ /* @__PURE__ */ jsx(Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsx(
11326
+ IconButton,
11327
+ {
11328
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11329
+ color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11330
+ sx: {
11331
+ ...buttonSx,
11332
+ ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11333
+ },
11334
+ children: /* @__PURE__ */ jsx(TitleIcon, { sx: { fontSize: "0.85rem" } })
11335
+ }
11336
+ ) }),
11337
+ /* @__PURE__ */ jsx(Tooltip, { title: "Undo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().undo().run(), children: /* @__PURE__ */ jsx(UndoIcon, {}) }) }),
11338
+ /* @__PURE__ */ jsx(Tooltip, { title: "Redo", children: /* @__PURE__ */ jsx(IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsx(RedoIcon, {}) }) })
11339
+ ]
11340
+ }
11341
+ ),
11331
11342
  /* @__PURE__ */ jsx(
11332
11343
  Box,
11333
11344
  {
@@ -11520,10 +11531,10 @@ var AppSearchableMultiSelector = forwardRef(
11520
11531
  }, ref) => {
11521
11532
  useTheme();
11522
11533
  const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
11523
- const fieldError = _19.get(errors, name);
11524
- const isTouched = Boolean(_19.get(touched, name));
11534
+ const fieldError = _.get(errors, name);
11535
+ const isTouched = Boolean(_.get(touched, name));
11525
11536
  const hasError = Boolean(fieldError) && isTouched;
11526
- const val = _19.get(values, name);
11537
+ const val = _.get(values, name);
11527
11538
  const selectedValues = Array.isArray(val) ? val : [];
11528
11539
  const selectedCount = selectedValues.length;
11529
11540
  const handleChange = (event, value, reason, details) => {
@@ -11899,9 +11910,9 @@ function AppSearchableSelectInput({
11899
11910
  ...otherProps
11900
11911
  }) {
11901
11912
  const { errors, touched, setFieldValue, values } = useFormikContext();
11902
- const fieldError = _19.get(errors, name);
11903
- const isTouched = _19.get(touched, name);
11904
- const val = _19.get(values, name);
11913
+ const fieldError = _.get(errors, name);
11914
+ const isTouched = _.get(touched, name);
11915
+ const val = _.get(values, name);
11905
11916
  const selectedOption = options.find((option) => option.value === val) || null;
11906
11917
  const handleChange = (event, newValue) => {
11907
11918
  setFieldValue(name, newValue ? newValue.value : "");
@@ -12027,10 +12038,10 @@ var AppSelectInput = forwardRef(
12027
12038
  }, ref) => {
12028
12039
  const theme = useTheme();
12029
12040
  const { errors, touched, values, setFieldValue, setFieldTouched } = useFormikContext();
12030
- const fieldError = _19.get(errors, name);
12031
- const isTouched = _19.get(touched, name);
12041
+ const fieldError = _.get(errors, name);
12042
+ const isTouched = _.get(touched, name);
12032
12043
  const hasError = Boolean(fieldError) && isTouched;
12033
- const value = _19.get(values, name);
12044
+ const value = _.get(values, name);
12034
12045
  const handleChange = (event, child) => {
12035
12046
  setFieldValue(name, event.target.value, true);
12036
12047
  if (externalOnChange) {
@@ -12272,8 +12283,8 @@ var AppSimpleUploadFile = ({
12272
12283
  onError
12273
12284
  }) => {
12274
12285
  const { setFieldValue, values, errors, touched } = useFormikContext();
12275
- const fieldValue = _19.get(values, name);
12276
- const fieldError = _19.get(touched, name) ? _19.get(errors, name) : void 0;
12286
+ const fieldValue = _.get(values, name);
12287
+ const fieldError = _.get(touched, name) ? _.get(errors, name) : void 0;
12277
12288
  const handleChange = (event) => {
12278
12289
  const files = event.target.files;
12279
12290
  if (!files || files.length === 0)
@@ -12394,1557 +12405,241 @@ var AppSimpleUploadFile = ({
12394
12405
  ] });
12395
12406
  };
12396
12407
  var AppSimpleUploadFile_default = AppSimpleUploadFile;
12397
-
12398
- // src/file-thumbnail/utils.ts
12399
- var FORMAT_PDF = ["pdf"];
12400
- var FORMAT_TEXT = ["txt"];
12401
- var FORMAT_PHOTOSHOP = ["psd"];
12402
- var FORMAT_WORD = ["doc", "docx"];
12403
- var FORMAT_EXCEL = ["xls", "xlsx"];
12404
- var FORMAT_ZIP = ["zip", "rar", "iso"];
12405
- var FORMAT_ILLUSTRATOR = ["ai", "esp"];
12406
- var FORMAT_POWERPOINT = ["ppt", "pptx"];
12407
- var FORMAT_AUDIO = ["wav", "aif", "mp3", "aac"];
12408
- var FORMAT_IMG = ["jpg", "jpeg", "gif", "bmp", "png", "svg"];
12409
- var FORMAT_VIDEO = ["m4v", "avi", "mpg", "mp4", "webm"];
12410
- var iconUrl = (icon) => `/assets/icons/files/${icon}.svg`;
12411
- function fileFormat(fileUrl) {
12412
- let format;
12413
- switch (fileUrl == null ? void 0 : fileUrl.includes(fileTypeByUrl(fileUrl))) {
12414
- case FORMAT_TEXT.includes(fileTypeByUrl(fileUrl)):
12415
- format = "txt";
12416
- break;
12417
- case FORMAT_ZIP.includes(fileTypeByUrl(fileUrl)):
12418
- format = "zip";
12419
- break;
12420
- case FORMAT_AUDIO.includes(fileTypeByUrl(fileUrl)):
12421
- format = "audio";
12422
- break;
12423
- case FORMAT_IMG.includes(fileTypeByUrl(fileUrl)):
12424
- format = "image";
12425
- break;
12426
- case FORMAT_VIDEO.includes(fileTypeByUrl(fileUrl)):
12427
- format = "video";
12428
- break;
12429
- case FORMAT_WORD.includes(fileTypeByUrl(fileUrl)):
12430
- format = "word";
12431
- break;
12432
- case FORMAT_EXCEL.includes(fileTypeByUrl(fileUrl)):
12433
- format = "excel";
12434
- break;
12435
- case FORMAT_POWERPOINT.includes(fileTypeByUrl(fileUrl)):
12436
- format = "powerpoint";
12437
- break;
12438
- case FORMAT_PDF.includes(fileTypeByUrl(fileUrl)):
12439
- format = "pdf";
12440
- break;
12441
- case FORMAT_PHOTOSHOP.includes(fileTypeByUrl(fileUrl)):
12442
- format = "photoshop";
12443
- break;
12444
- case FORMAT_ILLUSTRATOR.includes(fileTypeByUrl(fileUrl)):
12445
- format = "illustrator";
12446
- break;
12447
- default:
12448
- format = fileTypeByUrl(fileUrl);
12449
- }
12450
- return format;
12451
- }
12452
- function fileThumb(fileUrl) {
12453
- let thumb;
12454
- switch (fileFormat(fileUrl)) {
12455
- case "folder":
12456
- thumb = iconUrl("ic_folder");
12457
- break;
12458
- case "txt":
12459
- thumb = iconUrl("ic_txt");
12460
- break;
12461
- case "zip":
12462
- thumb = iconUrl("ic_zip");
12463
- break;
12464
- case "audio":
12465
- thumb = iconUrl("ic_audio");
12466
- break;
12467
- case "video":
12468
- thumb = iconUrl("ic_video");
12469
- break;
12470
- case "word":
12471
- thumb = iconUrl("ic_word");
12472
- break;
12473
- case "excel":
12474
- thumb = iconUrl("ic_excel");
12475
- break;
12476
- case "powerpoint":
12477
- thumb = iconUrl("ic_power_point");
12478
- break;
12479
- case "pdf":
12480
- thumb = iconUrl("ic_pdf");
12481
- break;
12482
- case "photoshop":
12483
- thumb = iconUrl("ic_pts");
12484
- break;
12485
- case "illustrator":
12486
- thumb = iconUrl("ic_ai");
12487
- break;
12488
- case "image":
12489
- thumb = iconUrl("ic_img");
12490
- break;
12491
- default:
12492
- thumb = iconUrl("ic_file");
12493
- }
12494
- return thumb;
12495
- }
12496
- function fileTypeByUrl(fileUrl = "") {
12497
- return fileUrl && fileUrl.split(".").pop() || "";
12498
- }
12499
- function fileNameByUrl(fileUrl) {
12500
- return fileUrl.split("/").pop();
12501
- }
12502
- function fileData(file) {
12503
- if (typeof file === "string") {
12504
- return {
12505
- key: file,
12506
- preview: file,
12507
- name: fileNameByUrl(file),
12508
- type: fileTypeByUrl(file)
12509
- };
12510
- }
12511
- return {
12512
- key: file == null ? void 0 : file.preview,
12513
- name: file == null ? void 0 : file.name,
12514
- size: file == null ? void 0 : file.size,
12515
- path: file == null ? void 0 : file.path,
12516
- type: file == null ? void 0 : file.type,
12517
- preview: file == null ? void 0 : file.preview,
12518
- lastModified: file == null ? void 0 : file.lastModified,
12519
- lastModifiedDate: file == null ? void 0 : file.lastModifiedDate
12520
- };
12521
- }
12522
- function DownloadButton({ onDownload }) {
12523
- const theme = useTheme$1();
12524
- return /* @__PURE__ */ jsx(
12525
- IconButton,
12526
- {
12527
- onClick: onDownload,
12528
- sx: {
12529
- p: 0,
12530
- top: 0,
12531
- right: 0,
12532
- width: 1,
12533
- height: 1,
12534
- zIndex: 9,
12535
- opacity: 0,
12536
- position: "absolute",
12537
- borderRadius: "unset",
12538
- // color: 'common.white',
12539
- justifyContent: "center",
12540
- bgcolor: "grey.800",
12541
- color: "common.white",
12542
- transition: theme.transitions.create("opacity"),
12543
- "&:hover": {
12544
- opacity: 1,
12545
- backgroundColor: alpha(theme.palette.grey[900], 0.64),
12546
- backdropFilter: "blur(6px)"
12547
- }
12548
- },
12549
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:arrow-circle-down-fill", width: 24 })
12550
- }
12551
- );
12552
- }
12553
- function FileThumbnail({
12554
- file,
12555
- tooltip,
12556
- imageView,
12557
- onDownload,
12408
+ var AppUploadFile = ({
12409
+ name,
12410
+ label,
12411
+ multiple = false,
12412
+ accept = "image/*",
12413
+ maxFiles = 5,
12414
+ maxSize = 5 * 1024 * 1024,
12415
+ // 5MB
12416
+ disabled = false,
12558
12417
  sx,
12559
- imgSx
12560
- }) {
12561
- const { name = "", path = "", preview = "" } = fileData(file);
12562
- const format = fileFormat(path || preview);
12563
- const renderContent = format === "image" && imageView === true ? /* @__PURE__ */ jsx(
12564
- Box,
12565
- {
12566
- component: "img",
12567
- src: preview,
12568
- sx: {
12569
- width: 1,
12570
- height: 1,
12571
- flexShrink: 0,
12572
- objectFit: "cover",
12573
- ...imgSx
12574
- }
12418
+ dropZoneSx,
12419
+ previewSx,
12420
+ errorSx,
12421
+ helperTextSx,
12422
+ onDrop: externalOnDrop,
12423
+ onDelete: externalOnDelete,
12424
+ ...rest
12425
+ }) => {
12426
+ var _a;
12427
+ const { errors, touched, setFieldValue, values } = useFormikContext();
12428
+ const fieldError = _.get(errors, name);
12429
+ const isTouched = _.get(touched, name);
12430
+ const [isDragging, setIsDragging] = useState(false);
12431
+ const currentFiles = _.get(values, name, multiple ? [] : []) || [];
12432
+ const isMaxFilesReached = multiple && currentFiles && currentFiles.length >= maxFiles;
12433
+ const processFile = async (file) => {
12434
+ if (file.type.startsWith("image/")) {
12435
+ const preview = await new Promise((resolve) => {
12436
+ const reader = new FileReader();
12437
+ reader.onload = () => resolve(reader.result);
12438
+ reader.readAsDataURL(file);
12439
+ });
12440
+ return { file, preview, name: file.name, type: file.type };
12575
12441
  }
12576
- ) : /* @__PURE__ */ jsx(
12577
- Box,
12578
- {
12579
- component: "img",
12580
- src: fileThumb(format),
12581
- sx: {
12582
- width: 32,
12583
- height: 32,
12584
- flexShrink: 0,
12585
- ...sx
12442
+ return { file, name: file.name, type: file.type };
12443
+ };
12444
+ const handleDrop = useCallback(
12445
+ async (acceptedFiles) => {
12446
+ if (disabled || isMaxFilesReached)
12447
+ return;
12448
+ try {
12449
+ const newFiles = await Promise.all(acceptedFiles.map(processFile));
12450
+ if (multiple) {
12451
+ const updatedFiles = [...currentFiles || [], ...newFiles].slice(
12452
+ 0,
12453
+ maxFiles
12454
+ );
12455
+ setFieldValue(name, updatedFiles, true);
12456
+ } else {
12457
+ setFieldValue(name, newFiles[0] || null, true);
12458
+ }
12459
+ externalOnDrop == null ? void 0 : externalOnDrop(acceptedFiles);
12460
+ } catch (error) {
12461
+ console.error("Error processing files:", error);
12586
12462
  }
12587
- }
12463
+ },
12464
+ [
12465
+ currentFiles,
12466
+ disabled,
12467
+ isMaxFilesReached,
12468
+ multiple,
12469
+ name,
12470
+ setFieldValue,
12471
+ maxFiles,
12472
+ externalOnDrop
12473
+ ]
12588
12474
  );
12589
- if (tooltip === true) {
12590
- return /* @__PURE__ */ jsx(Tooltip, { title: name, children: /* @__PURE__ */ jsxs(
12591
- Stack,
12592
- {
12593
- flexShrink: 0,
12594
- component: "span",
12595
- alignItems: "center",
12596
- justifyContent: "center",
12597
- sx: {
12598
- width: "fit-content",
12599
- height: "inherit"
12600
- },
12601
- children: [
12602
- renderContent,
12603
- onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12604
- ]
12605
- }
12606
- ) });
12607
- }
12608
- return /* @__PURE__ */ jsxs(Fragment, { children: [
12609
- renderContent,
12610
- onDownload && /* @__PURE__ */ jsx(DownloadButton, { onDownload })
12611
- ] });
12612
- }
12613
- function RejectionFiles({ fileRejections }) {
12614
- if (!fileRejections.length) {
12615
- return null;
12616
- }
12617
- function formatBytes2(bytes) {
12618
- const b = bytes != null ? bytes : 0;
12619
- if (b === 0)
12620
- return "0 Bytes";
12621
- const k = 1024;
12622
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12623
- const i = Math.floor(Math.log(b) / Math.log(k));
12624
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12625
- }
12626
- return /* @__PURE__ */ jsx(
12627
- Paper,
12628
- {
12629
- variant: "outlined",
12630
- sx: {
12631
- py: 1,
12632
- px: 2,
12633
- mt: 3,
12634
- bgcolor: (theme) => alpha(theme.palette.error.main, 0.08),
12635
- borderColor: (theme) => alpha(theme.palette.error.main, 0.24)
12636
- },
12637
- children: fileRejections.map(({ file, errors }) => {
12638
- const { path, size } = fileData(file);
12639
- return /* @__PURE__ */ jsxs(Box, { sx: { my: 1 }, children: [
12640
- /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", noWrap: true, children: [
12641
- path,
12642
- " - ",
12643
- size != null ? formatBytes2(size) : ""
12644
- ] }),
12645
- errors.map((error) => /* @__PURE__ */ jsxs(Box, { component: "span", sx: { typography: "caption" }, children: [
12646
- "- ",
12647
- error.message
12648
- ] }, error.code))
12649
- ] }, path);
12650
- })
12475
+ const handleRemove = (index) => {
12476
+ if (disabled)
12477
+ return;
12478
+ if (multiple) {
12479
+ const updatedFiles = [...currentFiles || []];
12480
+ updatedFiles.splice(index, 1);
12481
+ setFieldValue(name, updatedFiles, true);
12482
+ } else {
12483
+ setFieldValue(name, null, true);
12651
12484
  }
12652
- );
12653
- }
12654
-
12655
- // src/image/getRatio.ts
12656
- function getRatio(ratio = "1/1") {
12657
- return {
12658
- "4/3": "calc(100% / 4 * 3)",
12659
- "3/4": "calc(100% / 3 * 4)",
12660
- "6/4": "calc(100% / 6 * 4)",
12661
- "4/6": "calc(100% / 4 * 6)",
12662
- "16/9": "calc(100% / 16 * 9)",
12663
- "9/16": "calc(100% / 9 * 16)",
12664
- "21/9": "calc(100% / 21 * 9)",
12665
- "9/21": "calc(100% / 9 * 21)",
12666
- "1/1": "100%"
12667
- }[ratio];
12668
- }
12669
- var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12670
- var Image = forwardRef(
12671
- ({
12672
- ratio,
12673
- disabledEffect = false,
12674
- effect = "blur",
12675
- src,
12676
- wrapperProps,
12677
- style,
12678
- sx,
12679
- ...other
12680
- }, ref) => {
12681
- const content = /* @__PURE__ */ jsx(
12682
- Box,
12683
- {
12684
- component: LazyLoadImage,
12685
- wrapperClassName: "wrapper",
12686
- effect: disabledEffect ? void 0 : effect,
12687
- placeholderSrc: disabledEffect ? TRANSPARENT_PNG : TRANSPARENT_PNG,
12688
- src,
12689
- wrapperProps,
12690
- style,
12691
- sx: {
12692
- width: 1,
12693
- height: 1,
12694
- objectFit: "cover",
12695
- ...sx
12696
- },
12697
- ...other
12698
- }
12699
- );
12700
- if (ratio) {
12701
- return /* @__PURE__ */ jsx(
12702
- Box,
12703
- {
12704
- ref,
12705
- component: "span",
12706
- sx: {
12707
- width: 1,
12708
- lineHeight: 1,
12709
- display: "block",
12710
- overflow: "hidden",
12711
- position: "relative",
12712
- pt: getRatio(ratio),
12713
- "& .wrapper": {
12714
- top: 0,
12715
- left: 0,
12716
- width: 1,
12717
- height: 1,
12718
- position: "absolute",
12719
- backgroundSize: "cover !important"
12720
- },
12721
- ...sx
12722
- },
12723
- children: content
12724
- }
12725
- );
12726
- }
12727
- return /* @__PURE__ */ jsx(
12728
- Box,
12729
- {
12730
- ref,
12731
- component: "span",
12732
- sx: {
12733
- lineHeight: 1,
12734
- display: "block",
12735
- overflow: "hidden",
12736
- position: "relative",
12737
- "& .wrapper": {
12738
- width: 1,
12739
- height: 1,
12740
- backgroundSize: "cover !important"
12741
- },
12742
- ...sx
12743
- },
12744
- children: content
12745
- }
12746
- );
12747
- }
12748
- );
12749
- Image.displayName = "Image";
12750
- var Image_default = Image;
12751
-
12752
- // src/animate/variants/transition.ts
12753
- var varTranEnter = (props) => {
12754
- const duration = (props == null ? void 0 : props.durationIn) != null ? props == null ? void 0 : props.durationIn : 0.64;
12755
- const ease = (props == null ? void 0 : props.easeIn) != null ? props == null ? void 0 : props.easeIn : [0.43, 0.13, 0.23, 0.96];
12756
- return { duration, ease };
12757
- };
12758
- var varTranExit = (props) => {
12759
- const duration = (props == null ? void 0 : props.durationOut) != null ? props == null ? void 0 : props.durationOut : 0.48;
12760
- const ease = (props == null ? void 0 : props.easeOut) != null ? props == null ? void 0 : props.easeOut : [0.43, 0.13, 0.23, 0.96];
12761
- return { duration, ease };
12762
- };
12763
-
12764
- // src/animate/variants/fade.ts
12765
- var varFade = (props) => {
12766
- const distance = (props == null ? void 0 : props.distance) != null ? props == null ? void 0 : props.distance : 120;
12767
- const durationIn = props == null ? void 0 : props.durationIn;
12768
- const durationOut = props == null ? void 0 : props.durationOut;
12769
- const easeIn = props == null ? void 0 : props.easeIn;
12770
- const easeOut = props == null ? void 0 : props.easeOut;
12771
- return {
12772
- // IN
12773
- in: {
12774
- initial: { opacity: 0 },
12775
- animate: { opacity: 1, transition: varTranEnter },
12776
- exit: { opacity: 0, transition: varTranExit }
12777
- },
12778
- inUp: {
12779
- initial: { y: distance, opacity: 0 },
12780
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12781
- exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12782
- },
12783
- inDown: {
12784
- initial: { y: -distance, opacity: 0 },
12785
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12786
- exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12787
- },
12788
- inLeft: {
12789
- initial: { x: -distance, opacity: 0 },
12790
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12791
- exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12792
- },
12793
- inRight: {
12794
- initial: { x: distance, opacity: 0 },
12795
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
12796
- exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
12797
- },
12798
- // OUT
12799
- out: {
12800
- initial: { opacity: 1 },
12801
- animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12802
- exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12803
- },
12804
- outUp: {
12805
- initial: { y: 0, opacity: 1 },
12806
- animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12807
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12808
- },
12809
- outDown: {
12810
- initial: { y: 0, opacity: 1 },
12811
- animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12812
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12813
- },
12814
- outLeft: {
12815
- initial: { x: 0, opacity: 1 },
12816
- animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12817
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12818
- },
12819
- outRight: {
12820
- initial: { x: 0, opacity: 1 },
12821
- animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
12822
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
12823
- }
12824
- };
12825
- };
12826
- function formatBytes(bytes) {
12827
- const b = bytes != null ? bytes : 0;
12828
- if (b === 0)
12829
- return "0 Bytes";
12830
- const k = 1024;
12831
- const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
12832
- const i = Math.floor(Math.log(b) / Math.log(k));
12833
- return `${parseFloat((b / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
12834
- }
12835
- function MultiFilePreview({
12836
- thumbnail,
12837
- files,
12838
- onRemove,
12839
- sx,
12840
- isClickable,
12841
- isEditable,
12842
- onDeleteButtonClick,
12843
- onPrivacyUpdateClick
12844
- }) {
12845
- if ((files == null ? void 0 : files.length) == null) {
12846
- return null;
12847
- }
12848
- const [anchorEl, setAnchorEl] = useState(null);
12849
- const [selectedFile, setSelectedFile] = useState(null);
12850
- const canViewPrivate = true;
12851
- return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: files.map((file) => {
12852
- const typedFile = file;
12853
- const { key, name = "", size = 0 } = fileData(typedFile);
12854
- const isStringFile = typeof file === "string";
12855
- if (thumbnail === true) {
12856
- return (
12857
- // @ts-ignore
12858
- /* @__PURE__ */ jsxs(
12859
- Stack,
12860
- {
12861
- component: m.div,
12862
- ...varFade().inUp,
12863
- alignItems: "center",
12864
- display: "inline-flex",
12865
- justifyContent: "center",
12866
- sx: {
12867
- m: 0.5,
12868
- width: 80,
12869
- height: 80,
12870
- borderRadius: 1.25,
12871
- overflow: "hidden",
12872
- position: "relative",
12873
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12874
- ...sx
12875
- },
12876
- children: [
12877
- /* @__PURE__ */ jsx(
12878
- FileThumbnail,
12879
- {
12880
- tooltip: true,
12881
- imageView: true,
12882
- file: typedFile,
12883
- sx: { position: "absolute" },
12884
- imgSx: { position: "absolute" }
12885
- }
12886
- ),
12887
- onRemove && /* @__PURE__ */ jsx(
12888
- IconButton,
12889
- {
12890
- size: "small",
12891
- onClick: () => onRemove(typedFile),
12892
- sx: {
12893
- top: 4,
12894
- right: 4,
12895
- p: "1px",
12896
- position: "absolute",
12897
- color: (theme) => alpha(theme.palette.common.white, 0.72),
12898
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48),
12899
- "&:hover": {
12900
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72)
12901
- }
12902
- },
12903
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 16 })
12904
- }
12905
- )
12906
- ]
12907
- },
12908
- key
12909
- )
12910
- );
12911
- }
12912
- return (
12913
- // @ts-ignore
12914
- /* @__PURE__ */ jsxs(
12915
- Stack,
12916
- {
12917
- component: m.div,
12918
- ...varFade().inUp,
12919
- spacing: 2,
12920
- direction: "row",
12921
- alignItems: "center",
12922
- sx: {
12923
- my: 1,
12924
- px: 1,
12925
- py: 0.75,
12926
- borderRadius: 0.75,
12927
- border: (theme) => `solid 1px ${theme.palette.divider}`,
12928
- ...sx,
12929
- opacity: "1 !important",
12930
- transform: "none !important"
12931
- },
12932
- children: [
12933
- (typedFile == null ? void 0 : typedFile.preview) != null ? /* @__PURE__ */ jsx(Fragment, { children: (typedFile == null ? void 0 : typedFile.is_private) === true && !canViewPrivate ? /* @__PURE__ */ jsx(Iconify_default, { icon: "garden:lock-locked-fill-12", sx: { width: "26px", height: "26px" } }) : (
12934
- // eslint-disable-next-line @next/next/no-img-element
12935
- /* @__PURE__ */ jsx(
12936
- "img",
12937
- {
12938
- src: `${typedFile == null ? void 0 : typedFile.preview}`,
12939
- alt: (typedFile == null ? void 0 : typedFile.name) != null ? typedFile == null ? void 0 : typedFile.name : "",
12940
- style: { width: "40px", height: "40px" }
12941
- }
12942
- )
12943
- ) }) : /* @__PURE__ */ jsx(FileThumbnail, { file: typedFile }),
12944
- /* @__PURE__ */ jsxs(
12945
- Stack,
12946
- {
12947
- flexGrow: 1,
12948
- sx: { minWidth: 0, cursor: "pointer" },
12949
- onClick: () => {
12950
- if (isClickable === true && typedFile.url != null) {
12951
- window.open(`${typedFile == null ? void 0 : typedFile.url}`, "_blank");
12952
- }
12953
- },
12954
- children: [
12955
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", sx: { wordBreak: "break-all", whiteSpace: "break-spaces" }, noWrap: true, children: isStringFile ? file : name }),
12956
- /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { color: "text.secondary" }, children: isStringFile ? "" : formatBytes(size) })
12957
- ]
12958
- }
12959
- ),
12960
- onRemove && /* @__PURE__ */ jsx(IconButton, { edge: "end", size: "small", onClick: () => onRemove(typedFile), children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill" }) }),
12961
- isEditable === true && /* @__PURE__ */ jsxs(Fragment, { children: [
12962
- /* @__PURE__ */ jsx(
12963
- IconButton,
12964
- {
12965
- edge: "end",
12966
- size: "small",
12967
- onClick: (event) => {
12968
- event.stopPropagation();
12969
- setAnchorEl(event.currentTarget);
12970
- setSelectedFile(typedFile);
12971
- },
12972
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:more-horizontal-fill" })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxs(
12976
- Menu,
12977
- {
12978
- anchorEl,
12979
- open: Boolean(anchorEl) && selectedFile === file,
12980
- onClose: () => setAnchorEl(null),
12981
- children: [
12982
- /* @__PURE__ */ jsxs(
12983
- MenuItem,
12984
- {
12985
- onClick: (e) => {
12986
- e.stopPropagation();
12987
- setAnchorEl(null);
12988
- if (onDeleteButtonClick) {
12989
- onDeleteButtonClick(typedFile);
12990
- }
12991
- },
12992
- children: [
12993
- /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:trash-2-outline", width: 20 }),
12994
- "Delete"
12995
- ]
12996
- }
12997
- ),
12998
- /* @__PURE__ */ jsxs(
12999
- MenuItem,
13000
- {
13001
- onClick: (e) => {
13002
- e.stopPropagation();
13003
- if (onPrivacyUpdateClick) {
13004
- onPrivacyUpdateClick(typedFile);
13005
- }
13006
- },
13007
- children: [
13008
- /* @__PURE__ */ jsx(
13009
- Iconify_default,
13010
- {
13011
- icon: (typedFile == null ? void 0 : typedFile.is_private) === true ? "eva:unlock-outline" : "eva:lock-outline",
13012
- width: 20
13013
- }
13014
- ),
13015
- (typedFile == null ? void 0 : typedFile.is_private) === true ? "Public" : "Private"
13016
- ]
13017
- }
13018
- )
13019
- ]
13020
- }
13021
- )
13022
- ] })
13023
- ]
13024
- },
13025
- key
13026
- )
13027
- );
13028
- }) });
13029
- }
13030
- function SingleFilePreview({ file }) {
13031
- if (!file) {
13032
- return null;
13033
- }
13034
- const imgUrl = (typeof file === "string" ? file : file.preview) || "";
13035
- return /* @__PURE__ */ jsx(
13036
- Box,
13037
- {
13038
- sx: {
13039
- position: "relative",
13040
- width: "100%",
13041
- height: "100%",
13042
- "& .wrapper": {
13043
- width: "100%",
13044
- height: "100%",
13045
- position: "relative"
13046
- }
13047
- },
13048
- children: /* @__PURE__ */ jsx(
13049
- Image_default,
13050
- {
13051
- src: imgUrl,
13052
- effect: "opacity",
13053
- wrapperProps: {
13054
- style: {
13055
- width: "100%",
13056
- height: "100%",
13057
- position: "relative"
13058
- }
13059
- },
13060
- style: {
13061
- top: 8,
13062
- left: 8,
13063
- zIndex: 8,
13064
- borderRadius: 1,
13065
- position: "absolute",
13066
- width: "calc(100% - 16px)",
13067
- height: "calc(100% - 16px)",
13068
- objectFit: "cover"
13069
- }
13070
- }
13071
- )
13072
- }
13073
- );
13074
- }
13075
- function BackgroundIllustration() {
13076
- const theme = useTheme$1();
13077
- const PRIMARY_MAIN = theme.palette.primary.main;
13078
- return /* @__PURE__ */ jsxs(Fragment, { children: [
13079
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "BG", x1: "19.496%", x2: "77.479%", y1: "71.822%", y2: "16.69%", children: [
13080
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: PRIMARY_MAIN }),
13081
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: PRIMARY_MAIN, stopOpacity: "0" })
13082
- ] }) }),
13083
- /* @__PURE__ */ jsx(
13084
- "path",
13085
- {
13086
- fill: "url(#BG)",
13087
- fillRule: "nonzero",
13088
- 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",
13089
- opacity: "0.2"
13090
- }
13091
- )
13092
- ] });
13093
- }
13094
- var BackgroundIllustration_default = memo(BackgroundIllustration);
13095
- function UploadIllustration({ ...other }) {
13096
- const theme = useTheme$1();
13097
- const PRIMARY_MAIN = theme.palette.primary.main;
13098
- const PRIMARY_DARK = theme.palette.primary.dark;
13099
- const PRIMARY_DARKER = theme.palette.primary.dark;
13100
- return /* @__PURE__ */ jsx(Box, { ...other, children: /* @__PURE__ */ jsxs("svg", { width: "100%", height: "100%", viewBox: "0 0 480 360", xmlns: "http://www.w3.org/2000/svg", children: [
13101
- /* @__PURE__ */ jsx(BackgroundIllustration_default, {}),
13102
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "linearGradient-2", x1: "30.113%", x2: "30.113%", y1: "0%", y2: "100%", children: [
13103
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopOpacity: "0" }),
13104
- /* @__PURE__ */ jsx("stop", { offset: "100%" })
13105
- ] }) }),
13106
- /* @__PURE__ */ jsx(
13107
- "path",
13108
- {
13109
- fill: "#FF4842",
13110
- fillRule: "nonzero",
13111
- 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",
13112
- opacity: "0.05"
13113
- }
13114
- ),
13115
- /* @__PURE__ */ jsx(
13116
- "path",
13117
- {
13118
- fill: "#FF4842",
13119
- fillRule: "nonzero",
13120
- 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",
13121
- opacity: "0.05"
13122
- }
13123
- ),
13124
- /* @__PURE__ */ jsx(
13125
- "path",
13126
- {
13127
- fill: "#FF4842",
13128
- fillRule: "nonzero",
13129
- 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",
13130
- opacity: "0.05"
13131
- }
13132
- ),
13133
- /* @__PURE__ */ jsx(
13134
- "path",
13135
- {
13136
- fill: PRIMARY_DARKER,
13137
- fillRule: "nonzero",
13138
- 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"
13139
- }
13140
- ),
13141
- /* @__PURE__ */ jsx(
13142
- "path",
13143
- {
13144
- fill: "#FFF",
13145
- fillRule: "nonzero",
13146
- d: "M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",
13147
- transform: "rotate(34.64 262.678 162.06)"
13148
- }
13149
- ),
13150
- /* @__PURE__ */ jsx(
13151
- "path",
13152
- {
13153
- fill: "#FFC107",
13154
- fillRule: "nonzero",
13155
- d: "M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",
13156
- transform: "rotate(34.804 278.687 137.92)"
13157
- }
13158
- ),
13159
- /* @__PURE__ */ jsx(
13160
- "path",
13161
- {
13162
- fill: "#FFC107",
13163
- fillRule: "nonzero",
13164
- d: "M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",
13165
- opacity: "0.5",
13166
- transform: "rotate(34.64 268.35 153.887)"
13167
- }
13168
- ),
13169
- /* @__PURE__ */ jsx(
13170
- "path",
13171
- {
13172
- fill: "#FFC107",
13173
- fillRule: "nonzero",
13174
- d: "M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",
13175
- opacity: "0.3",
13176
- transform: "rotate(34.64 257.265 169.926)"
13177
- }
13178
- ),
13179
- /* @__PURE__ */ jsx(
13180
- "path",
13181
- {
13182
- fill: "#FFF",
13183
- fillRule: "nonzero",
13184
- d: "M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",
13185
- transform: "rotate(16.29 248.893 159.951)"
13186
- }
13187
- ),
13188
- /* @__PURE__ */ jsx(
13189
- "path",
13190
- {
13191
- fill: "#FF4842",
13192
- fillRule: "nonzero",
13193
- d: "M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",
13194
- transform: "rotate(16.29 257.127 131.835)"
13195
- }
13196
- ),
13197
- /* @__PURE__ */ jsx(
13198
- "path",
13199
- {
13200
- fill: "#FF4842",
13201
- fillRule: "nonzero",
13202
- d: "M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",
13203
- opacity: "0.5",
13204
- transform: "rotate(16.29 251.658 150.547)"
13205
- }
13206
- ),
13207
- /* @__PURE__ */ jsx(
13208
- "path",
13209
- {
13210
- fill: "#FF4842",
13211
- fillRule: "nonzero",
13212
- d: "M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",
13213
- opacity: "0.3",
13214
- transform: "rotate(16.29 246.19 169.256)"
13215
- }
13216
- ),
13217
- /* @__PURE__ */ jsx(
13218
- "path",
13219
- {
13220
- fill: "#FFF",
13221
- fillRule: "nonzero",
13222
- d: "M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",
13223
- transform: "rotate(4.6 241.52 160.258)"
13224
- }
13225
- ),
13226
- /* @__PURE__ */ jsx(
13227
- "path",
13228
- {
13229
- fill: "#1890FF",
13230
- fillRule: "nonzero",
13231
- d: "M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",
13232
- transform: "rotate(4.6 243.874 131.06)"
13233
- }
13234
- ),
13235
- /* @__PURE__ */ jsx(
13236
- "path",
13237
- {
13238
- fill: "#1890FF",
13239
- fillRule: "nonzero",
13240
- d: "M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",
13241
- opacity: "0.5",
13242
- transform: "rotate(4.6 242.308 150.487)"
13243
- }
13244
- ),
13245
- /* @__PURE__ */ jsx(
13246
- "path",
13247
- {
13248
- fill: "#1890FF",
13249
- fillRule: "nonzero",
13250
- d: "M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",
13251
- opacity: "0.3",
13252
- transform: "rotate(4.6 240.746 169.92)"
13253
- }
13254
- ),
13255
- /* @__PURE__ */ jsx(
13256
- "path",
13257
- {
13258
- fill: "#FFF",
13259
- fillRule: "nonzero",
13260
- d: "M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",
13261
- transform: "rotate(-2.61 236.157 162.002)"
13262
- }
13263
- ),
13264
- /* @__PURE__ */ jsx(
13265
- "path",
13266
- {
13267
- fill: PRIMARY_MAIN,
13268
- fillRule: "nonzero",
13269
- d: "M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",
13270
- transform: "rotate(-2.61 234.825 132.734)"
13271
- }
13272
- ),
13273
- /* @__PURE__ */ jsx(
13274
- "path",
13275
- {
13276
- fill: PRIMARY_MAIN,
13277
- fillRule: "nonzero",
13278
- d: "M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",
13279
- opacity: "0.5",
13280
- transform: "rotate(-2.862 236.39 151.563)"
13281
- }
13282
- ),
13283
- /* @__PURE__ */ jsx(
13284
- "path",
13285
- {
13286
- fill: PRIMARY_MAIN,
13287
- fillRule: "nonzero",
13288
- d: "M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",
13289
- opacity: "0.3",
13290
- transform: "rotate(-2.61 236.599 171.683)"
13291
- }
13292
- ),
13293
- /* @__PURE__ */ jsx(
13294
- "path",
13295
- {
13296
- fill: "#F4F6F8",
13297
- fillRule: "nonzero",
13298
- 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"
13299
- }
13300
- ),
13301
- /* @__PURE__ */ jsx(
13302
- "path",
13303
- {
13304
- fill: "#000",
13305
- fillRule: "nonzero",
13306
- 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",
13307
- opacity: "0.1"
13308
- }
13309
- ),
13310
- /* @__PURE__ */ jsx(
13311
- "path",
13312
- {
13313
- fill: PRIMARY_MAIN,
13314
- fillRule: "nonzero",
13315
- 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"
13316
- }
13317
- ),
13318
- /* @__PURE__ */ jsx(
13319
- "path",
13320
- {
13321
- fill: "#FF4842",
13322
- fillRule: "nonzero",
13323
- 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",
13324
- opacity: "0.1"
13325
- }
13326
- ),
13327
- /* @__PURE__ */ jsx(
13328
- "path",
13329
- {
13330
- fill: "#FFF",
13331
- fillRule: "nonzero",
13332
- 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"
13333
- }
13334
- ),
13335
- /* @__PURE__ */ jsx(
13336
- "path",
13337
- {
13338
- fill: PRIMARY_MAIN,
13339
- fillRule: "nonzero",
13340
- 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",
13341
- opacity: "0.3"
13342
- }
13343
- ),
13344
- /* @__PURE__ */ jsx(
13345
- "path",
13346
- {
13347
- fill: PRIMARY_MAIN,
13348
- fillRule: "nonzero",
13349
- 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"
13350
- }
13351
- ),
13352
- /* @__PURE__ */ jsx("ellipse", { cx: "380.363", cy: "298.487", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "8.945", ry: "1.513" }),
13353
- /* @__PURE__ */ jsx(
13354
- "path",
13355
- {
13356
- fill: PRIMARY_MAIN,
13357
- fillRule: "nonzero",
13358
- 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"
13359
- }
13360
- ),
13361
- /* @__PURE__ */ jsx("ellipse", { cx: "390.052", cy: "264.383", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "5.044", ry: "1" }),
13362
- /* @__PURE__ */ jsx(
13363
- "path",
13364
- {
13365
- fill: PRIMARY_MAIN,
13366
- fillRule: "nonzero",
13367
- 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"
13368
- }
13369
- ),
13370
- /* @__PURE__ */ jsx("ellipse", { cx: "346.97", cy: "270.022", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "6.09", ry: "1.028" }),
13371
- /* @__PURE__ */ jsx(
13372
- "rect",
13373
- {
13374
- width: "51.026",
13375
- height: "91.312",
13376
- x: "303.926",
13377
- y: "69.211",
13378
- fill: "#FFF",
13379
- fillRule: "nonzero",
13380
- rx: "4.737",
13381
- transform: "rotate(-71.99 329.44 114.867)"
13382
- }
13383
- ),
13384
- /* @__PURE__ */ jsx("circle", { cx: "303.613", cy: "103.507", r: "9.376", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.2" }),
13385
- /* @__PURE__ */ jsx(
13386
- "path",
13387
- {
13388
- fill: PRIMARY_MAIN,
13389
- fillRule: "nonzero",
13390
- d: "M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",
13391
- opacity: "0.2",
13392
- transform: "rotate(-71.99 345.867 106.913)"
13393
- }
13394
- ),
13395
- /* @__PURE__ */ jsx(
13396
- "path",
13397
- {
13398
- fill: PRIMARY_MAIN,
13399
- fillRule: "nonzero",
13400
- d: "M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",
13401
- opacity: "0.2",
13402
- transform: "rotate(-71.99 334.312 110.042)"
13403
- }
13404
- ),
13405
- /* @__PURE__ */ jsx(
13406
- "path",
13407
- {
13408
- fill: PRIMARY_MAIN,
13409
- fillRule: "nonzero",
13410
- d: "M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",
13411
- opacity: "0.2",
13412
- transform: "rotate(-71.99 338.393 118.259)"
13413
- }
13414
- ),
13415
- /* @__PURE__ */ jsx(
13416
- "path",
13417
- {
13418
- fill: PRIMARY_MAIN,
13419
- fillRule: "nonzero",
13420
- d: "M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",
13421
- opacity: "0.2",
13422
- transform: "rotate(-71.99 339.79 125.599)"
13423
- }
13424
- ),
13425
- /* @__PURE__ */ jsx(
13426
- "path",
13427
- {
13428
- fill: PRIMARY_MAIN,
13429
- fillRule: "nonzero",
13430
- d: "M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",
13431
- opacity: "0.5",
13432
- transform: "rotate(-71.99 350.544 140.3)"
13433
- }
13434
- ),
13435
- /* @__PURE__ */ jsx(
13436
- "rect",
13437
- {
13438
- width: "50.3",
13439
- height: "78.305",
13440
- x: "291.549",
13441
- y: "174.486",
13442
- fill: "#FFF",
13443
- fillRule: "nonzero",
13444
- rx: "4",
13445
- transform: "rotate(-57.265 316.7 213.638)"
13446
- }
13447
- ),
13448
- /* @__PURE__ */ jsx(
13449
- "path",
13450
- {
13451
- fill: "#DFE3E8",
13452
- fillRule: "nonzero",
13453
- d: "M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",
13454
- transform: "rotate(-57.57 285.154 205.563)"
13455
- }
13456
- ),
13457
- /* @__PURE__ */ jsx(
13458
- "path",
13459
- {
13460
- fill: "#DFE3E8",
13461
- fillRule: "nonzero",
13462
- d: "M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",
13463
- transform: "rotate(-57.57 298.635 200.737)"
13464
- }
13465
- ),
13466
- /* @__PURE__ */ jsx(
13467
- "path",
13468
- {
13469
- fill: "#DFE3E8",
13470
- fillRule: "nonzero",
13471
- d: "M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",
13472
- transform: "rotate(-57.57 304.171 204.251)"
13473
- }
13474
- ),
13475
- /* @__PURE__ */ jsx(
13476
- "path",
13477
- {
13478
- fill: "#DFE3E8",
13479
- fillRule: "nonzero",
13480
- d: "M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",
13481
- transform: "rotate(-57.57 309.706 207.771)"
13482
- }
13483
- ),
13484
- /* @__PURE__ */ jsx(
13485
- "path",
13486
- {
13487
- fill: "#DFE3E8",
13488
- fillRule: "nonzero",
13489
- d: "M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",
13490
- transform: "rotate(-57.265 315.485 212.94)"
13491
- }
13492
- ),
13493
- /* @__PURE__ */ jsx(
13494
- "path",
13495
- {
13496
- fill: "#F4F6F8",
13497
- fillRule: "nonzero",
13498
- d: "M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",
13499
- transform: "rotate(-57.57 320.777 214.804)"
13500
- }
13501
- ),
13502
- /* @__PURE__ */ jsx(
13503
- "path",
13504
- {
13505
- fill: "#F4F6F8",
13506
- fillRule: "nonzero",
13507
- d: "M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",
13508
- transform: "rotate(-57.57 326.313 218.318)"
13509
- }
13510
- ),
13511
- /* @__PURE__ */ jsx(
13512
- "path",
13513
- {
13514
- fill: "#DFE3E8",
13515
- fillRule: "nonzero",
13516
- d: "M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",
13517
- transform: "rotate(-57.57 345.465 214.454)"
13518
- }
13519
- ),
13520
- /* @__PURE__ */ jsx(
13521
- "path",
13522
- {
13523
- fill: PRIMARY_MAIN,
13524
- fillRule: "nonzero",
13525
- 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"
13526
- }
13527
- ),
13528
- /* @__PURE__ */ jsx(
13529
- "path",
13530
- {
13531
- fill: PRIMARY_DARK,
13532
- fillRule: "nonzero",
13533
- 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",
13534
- opacity: "0.243"
13535
- }
13536
- ),
13537
- /* @__PURE__ */ jsx(
13538
- "path",
13539
- {
13540
- fill: "url(#linearGradient-2)",
13541
- fillRule: "nonzero",
13542
- 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",
13543
- opacity: "0.32"
13544
- }
13545
- ),
13546
- /* @__PURE__ */ jsx("ellipse", { cx: "119.593", cy: "258.664", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13547
- /* @__PURE__ */ jsx("ellipse", { cx: "101.03", cy: "260.545", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "4.846", ry: "1" }),
13548
- /* @__PURE__ */ jsx("ellipse", { cx: "108.459", cy: "265.905", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13549
- /* @__PURE__ */ jsx("ellipse", { cx: "89.193", cy: "265.433", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1", rx: "3.444", ry: "1" }),
13550
- /* @__PURE__ */ jsx(
13551
- "path",
13552
- {
13553
- fill: PRIMARY_MAIN,
13554
- fillRule: "nonzero",
13555
- 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"
13556
- }
13557
- ),
13558
- /* @__PURE__ */ jsx(
13559
- "path",
13560
- {
13561
- stroke: PRIMARY_DARKER,
13562
- strokeLinecap: "round",
13563
- strokeWidth: "0.5",
13564
- 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"
13565
- }
13566
- ),
13567
- /* @__PURE__ */ jsx(
13568
- "path",
13569
- {
13570
- fill: PRIMARY_MAIN,
13571
- fillRule: "nonzero",
13572
- 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"
13573
- }
13574
- ),
13575
- /* @__PURE__ */ jsx(
13576
- "path",
13577
- {
13578
- stroke: PRIMARY_DARKER,
13579
- strokeLinecap: "round",
13580
- strokeWidth: "0.5",
13581
- d: "M91.113 247.808s8.353 12.115 9.968 12.647"
13582
- }
13583
- ),
13584
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M90.344 249.701L92.293 249.701" }),
13585
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M92.68 254.132L95.738 254.263" }),
13586
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M94.542 250.586L94.21 252.179" }),
13587
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M97.792 255.432L97.732 256.879" }),
13588
- /* @__PURE__ */ jsx(
13589
- "path",
13590
- {
13591
- fill: PRIMARY_MAIN,
13592
- fillRule: "nonzero",
13593
- 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"
13594
- }
13595
- ),
13596
- /* @__PURE__ */ jsx(
13597
- "path",
13598
- {
13599
- stroke: PRIMARY_DARKER,
13600
- strokeLinecap: "round",
13601
- strokeWidth: "0.5",
13602
- d: "M111.051 247.808s-8.371 12.115-9.97 12.647"
13603
- }
13604
- ),
13605
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M111.82 249.701L109.871 249.701" }),
13606
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M109.485 254.132L106.426 254.263" }),
13607
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M107.622 250.586L107.954 252.179" }),
13608
- /* @__PURE__ */ jsx("path", { stroke: PRIMARY_DARKER, strokeLinecap: "round", strokeWidth: "0.5", d: "M104.372 255.432L104.432 256.879" }),
13609
- /* @__PURE__ */ jsx(
13610
- "path",
13611
- {
13612
- fill: PRIMARY_MAIN,
13613
- fillRule: "nonzero",
13614
- 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"
13615
- }
13616
- ),
13617
- /* @__PURE__ */ jsx("circle", { cx: "84.467", cy: "87.003", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13618
- /* @__PURE__ */ jsx("circle", { cx: "395.425", cy: "138.681", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13619
- /* @__PURE__ */ jsx("circle", { cx: "279.178", cy: "66.467", r: "6.467", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13620
- /* @__PURE__ */ jsx("circle", { cx: "97.4", cy: "122.68", r: "10.838", fill: PRIMARY_MAIN, fillRule: "nonzero", opacity: "0.1" }),
13621
- /* @__PURE__ */ jsx(
13622
- "path",
13623
- {
13624
- fill: PRIMARY_DARK,
13625
- fillRule: "nonzero",
13626
- 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"
13627
- }
13628
- ),
13629
- /* @__PURE__ */ jsx(
13630
- "path",
13631
- {
13632
- fill: PRIMARY_MAIN,
13633
- fillRule: "nonzero",
13634
- 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",
13635
- opacity: "0.72"
13636
- }
13637
- ),
13638
- /* @__PURE__ */ jsx(
13639
- "path",
13640
- {
13641
- fill: PRIMARY_DARK,
13642
- fillRule: "nonzero",
13643
- 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"
13644
- }
13645
- )
13646
- ] }) });
13647
- }
13648
- var UploadIllustration_default = memo(UploadIllustration);
13649
- var StyledDropZone = styled("div")(({ theme }) => ({
13650
- outline: "none",
13651
- cursor: "pointer",
13652
- overflow: "hidden",
13653
- position: "relative",
13654
- padding: theme.spacing(5),
13655
- borderRadius: theme.shape.borderRadius,
13656
- transition: theme.transitions.create("padding"),
13657
- backgroundColor: theme.palette.background.default,
13658
- border: `1px dashed ${alpha(theme.palette.grey[500], 0.32)}`,
13659
- "&:hover": {
13660
- opacity: 0.72
13661
- }
13662
- }));
13663
- function Upload({
13664
- disabled,
13665
- multiple = false,
13666
- error,
13667
- helperText,
13668
- //
13669
- file,
13670
- onDelete,
13671
- //
13672
- files,
13673
- thumbnail,
13674
- onUpload,
13675
- onRemove,
13676
- onRemoveAll,
13677
- sx,
13678
- ...other
13679
- }) {
13680
- const { getRootProps, getInputProps, isDragActive, isDragReject, fileRejections } = useDropzone({
12485
+ externalOnDelete == null ? void 0 : externalOnDelete();
12486
+ };
12487
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
12488
+ onDrop: handleDrop,
12489
+ accept: accept ? { [accept]: [] } : void 0,
12490
+ maxFiles: multiple ? maxFiles - ((currentFiles == null ? void 0 : currentFiles.length) || 0) : 1,
12491
+ maxSize,
13681
12492
  multiple,
13682
- disabled,
13683
- ...other
12493
+ disabled: disabled || isMaxFilesReached,
12494
+ onDragEnter: () => setIsDragging(true),
12495
+ onDragLeave: () => setIsDragging(false),
12496
+ onDropAccepted: () => setIsDragging(false)
13684
12497
  });
13685
- const { t } = useTranslation();
13686
- const hasFile = !!file && !multiple;
13687
- const hasFiles = files && multiple && files.length > 0;
13688
- const isError = isDragReject || !!error;
13689
- return /* @__PURE__ */ jsxs(Box, { sx: { width: 1, position: "relative", ...sx }, children: [
13690
- /* @__PURE__ */ jsxs(
13691
- StyledDropZone,
12498
+ const renderPreview = (file, index) => {
12499
+ var _a2;
12500
+ const isImage = (_a2 = file.type) == null ? void 0 : _a2.startsWith("image/");
12501
+ const previewUrl = file.preview || (typeof file.file === "string" ? file.file : "");
12502
+ const fileName = file.name || (typeof file.file === "string" ? file.file.split("/").pop() : file.file.name);
12503
+ return /* @__PURE__ */ jsx(
12504
+ Paper,
13692
12505
  {
13693
- ...getRootProps(),
13694
- sx: {
13695
- ...isDragActive && {
13696
- opacity: 0.72
13697
- },
13698
- ...isError && {
13699
- color: "error.main",
13700
- bgcolor: "error.lighter",
13701
- borderColor: "error.light"
13702
- },
13703
- ...disabled && {
13704
- opacity: 0.48,
13705
- pointerEvents: "none"
12506
+ sx: [
12507
+ {
12508
+ position: "relative",
12509
+ p: 1,
12510
+ borderRadius: 1,
12511
+ overflow: "hidden",
12512
+ border: "1px solid",
12513
+ borderColor: "divider",
12514
+ "&:hover .file-actions": {
12515
+ opacity: 1
12516
+ }
13706
12517
  },
13707
- ...hasFile && {
13708
- padding: "12% 0"
13709
- }
13710
- },
13711
- children: [
13712
- /* @__PURE__ */ jsx("input", { ...getInputProps() }),
12518
+ ...Array.isArray(previewSx) ? previewSx : [previewSx]
12519
+ ],
12520
+ children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
12521
+ isImage && previewUrl ? /* @__PURE__ */ jsx(
12522
+ Avatar,
12523
+ {
12524
+ variant: "rounded",
12525
+ src: previewUrl,
12526
+ sx: { width: 48, height: 48, bgcolor: "background.paper" },
12527
+ children: /* @__PURE__ */ jsx(Image, {})
12528
+ }
12529
+ ) : /* @__PURE__ */ jsx(
12530
+ Avatar,
12531
+ {
12532
+ variant: "rounded",
12533
+ sx: { width: 48, height: 48, bgcolor: "action.hover" },
12534
+ children: /* @__PURE__ */ jsx(InsertDriveFile, {})
12535
+ }
12536
+ ),
12537
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", noWrap: true, sx: { flex: 1, maxWidth: 200 }, children: fileName }),
13713
12538
  /* @__PURE__ */ jsx(
13714
- Placeholder,
12539
+ Box,
13715
12540
  {
13716
- sx: {
13717
- ...hasFile && {
13718
- opacity: 0
12541
+ className: "file-actions",
12542
+ sx: { opacity: 0, transition: "opacity 0.2s" },
12543
+ children: /* @__PURE__ */ jsx(Tooltip, { title: "Remove", children: /* @__PURE__ */ jsx(
12544
+ IconButton,
12545
+ {
12546
+ size: "small",
12547
+ color: "error",
12548
+ onClick: (e) => {
12549
+ e.stopPropagation();
12550
+ handleRemove(index);
12551
+ },
12552
+ disabled,
12553
+ children: /* @__PURE__ */ jsx(Delete$1, { fontSize: "small" })
13719
12554
  }
13720
- }
12555
+ ) })
13721
12556
  }
13722
- ),
13723
- hasFile && /* @__PURE__ */ jsx(SingleFilePreview, { file })
13724
- ]
13725
- }
13726
- ),
13727
- helperText && helperText,
13728
- /* @__PURE__ */ jsx(RejectionFiles, { fileRejections }),
13729
- hasFile && onDelete && /* @__PURE__ */ jsx(
13730
- IconButton,
13731
- {
13732
- size: "small",
13733
- onClick: onDelete,
13734
- sx: {
13735
- top: 16,
13736
- right: 16,
13737
- zIndex: 9,
13738
- position: "absolute",
13739
- color: (theme) => alpha(theme.palette.common.white, 0.8),
13740
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.72),
13741
- "&:hover": {
13742
- bgcolor: (theme) => alpha(theme.palette.grey[900], 0.48)
13743
- }
13744
- },
13745
- children: /* @__PURE__ */ jsx(Iconify_default, { icon: "eva:close-fill", width: 18 })
13746
- }
13747
- ),
13748
- hasFiles === true && /* @__PURE__ */ jsxs(Fragment, { children: [
13749
- /* @__PURE__ */ jsx(Box, { sx: { my: 3 }, children: /* @__PURE__ */ jsx(MultiFilePreview, { files, thumbnail, onRemove }) }),
13750
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-end", spacing: 1.5, children: [
13751
- onRemoveAll && /* @__PURE__ */ jsx(Button, { color: "inherit", variant: "outlined", size: "small", onClick: onRemoveAll, children: t("Remove all") }),
13752
- onUpload && /* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: onUpload, children: t("Upload files") })
13753
- ] })
13754
- ] })
13755
- ] });
13756
- }
13757
- function Placeholder({ sx, ...other }) {
13758
- const { t } = useTranslation();
13759
- return /* @__PURE__ */ jsxs(
13760
- Stack,
13761
- {
13762
- spacing: 5,
13763
- alignItems: "center",
13764
- justifyContent: "center",
13765
- direction: {
13766
- xs: "column",
13767
- md: "row"
13768
- },
13769
- sx: {
13770
- width: 1,
13771
- textAlign: {
13772
- xs: "center",
13773
- md: "left"
13774
- },
13775
- ...sx
13776
- },
13777
- ...other,
13778
- children: [
13779
- /* @__PURE__ */ jsx(UploadIllustration_default, { sx: { width: 220 } }),
13780
- /* @__PURE__ */ jsxs("div", { children: [
13781
- /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h5", children: t("Drop or Select file") }),
13782
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", sx: { color: "text.secondary" }, children: [
13783
- t("Drop files here or click"),
13784
- /* @__PURE__ */ jsx(
13785
- Typography,
13786
- {
13787
- variant: "body2",
13788
- component: "span",
13789
- sx: {
13790
- mx: 0.5,
13791
- textDecoration: "underline"
13792
- },
13793
- children: t("browse")
13794
- }
13795
- ),
13796
- t("thorough your machine")
13797
- ] })
12557
+ )
13798
12558
  ] })
13799
- ]
13800
- }
13801
- );
13802
- }
13803
- async function blobToBase64(file) {
13804
- return new Promise((resolve, reject) => {
13805
- const reader = new FileReader();
13806
- reader.readAsDataURL(file);
13807
- reader.onloadend = function() {
13808
- const base64data = reader.result;
13809
- resolve(base64data);
13810
- };
13811
- reader.onerror = function(err) {
13812
- reject(err);
13813
- };
13814
- });
13815
- }
13816
- var AppUploadFile = ({
13817
- name,
13818
- sx,
13819
- uploadSx,
13820
- errorSx,
13821
- helperTextSx,
13822
- previewSx,
13823
- dropZoneSx,
13824
- ...rest
13825
- }) => {
13826
- var _a, _b;
13827
- const { errors, touched, setFieldValue, values } = useFormikContext();
13828
- const fieldError = _19.get(errors, name);
13829
- const isTouched = _19.get(touched, name);
13830
- let val = _19.get(values, name);
13831
- if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13832
- val = val ? [val] : [];
13833
- } else if (!((_b = rest.multiple) != null ? _b : false) && _19.isArray(val)) {
13834
- val = val[0];
13835
- }
13836
- const formatValue = (val2) => {
13837
- if (rest.multiple) {
13838
- return (Array.isArray(val2) ? val2 : []).map((item) => ({
13839
- ...(item == null ? void 0 : item.file) ? item : { file: item, preview: item == null ? void 0 : item.preview }
13840
- }));
13841
- }
13842
- return (val2 == null ? void 0 : val2.file) ? val2 : val2 ? { file: val2, preview: val2.preview } : null;
12559
+ },
12560
+ index
12561
+ );
13843
12562
  };
13844
- const formattedValue = formatValue(val);
13845
- const currentFiles = Array.isArray(val) ? val : [];
13846
- const isMaxFilesReached = rest.maxFiles !== null && rest.maxFiles !== void 0 && currentFiles.length >= rest.maxFiles;
13847
12563
  return /* @__PURE__ */ jsxs(Box, { sx, children: [
13848
- /* @__PURE__ */ jsx(
13849
- Upload,
12564
+ /* @__PURE__ */ jsxs(
12565
+ Box,
13850
12566
  {
13851
- ...rest,
13852
- file: rest.multiple ? void 0 : formattedValue,
13853
- files: rest.multiple ? formattedValue : void 0,
13854
- error: Boolean(fieldError) && isTouched,
13855
- disabled: isMaxFilesReached,
13856
- sx: [{
13857
- "& .MuiDropzoneArea-root": {
13858
- minHeight: 200,
12567
+ ...getRootProps(),
12568
+ sx: [
12569
+ {
12570
+ p: 3,
13859
12571
  border: "2px dashed",
13860
- borderColor: "divider",
13861
12572
  borderRadius: 1,
13862
- "&:hover": {
12573
+ bgcolor: isDragging ? "action.hover" : "background.paper",
12574
+ borderColor: isDragging ? "primary.main" : "divider",
12575
+ cursor: disabled ? "not-allowed" : "pointer",
12576
+ opacity: disabled ? 0.7 : 1,
12577
+ transition: "all 0.2s ease-in-out",
12578
+ "&:hover": !disabled && {
13863
12579
  borderColor: "primary.main",
13864
- backgroundColor: "action.hover"
13865
- },
13866
- ...dropZoneSx
13867
- },
13868
- "& .MuiDropzonePreviewList-root": {
13869
- ...previewSx
12580
+ bgcolor: "action.hover"
12581
+ }
13870
12582
  },
13871
- ...uploadSx
13872
- }],
13873
- onDrop: (fileVal) => {
13874
- (async () => {
13875
- var _a2;
13876
- const images = await Promise.all(
13877
- fileVal.map(async (single) => {
13878
- var _a3;
13879
- return {
13880
- preview: ((_a3 = single == null ? void 0 : single.type) == null ? void 0 : _a3.includes("image")) ? await blobToBase64(single) : void 0,
13881
- file: single
13882
- };
13883
- })
13884
- );
13885
- const currentValue = Array.isArray(val) ? [...val] : [];
13886
- if (rest.multiple === true) {
13887
- if (currentValue.length >= ((_a2 = rest.maxFiles) != null ? _a2 : Infinity))
13888
- return;
13889
- setFieldValue(name, [...currentValue, ...images], true);
13890
- } else {
13891
- setFieldValue(name, images[0], true);
12583
+ ...Array.isArray(dropZoneSx) ? dropZoneSx : [dropZoneSx]
12584
+ ],
12585
+ children: [
12586
+ /* @__PURE__ */ jsx("input", { ...getInputProps() }),
12587
+ /* @__PURE__ */ jsxs(
12588
+ Stack,
12589
+ {
12590
+ spacing: 1,
12591
+ alignItems: "center",
12592
+ justifyContent: "center",
12593
+ textAlign: "center",
12594
+ children: [
12595
+ /* @__PURE__ */ jsx(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"}` }),
12596
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", children: [
12597
+ accept,
12598
+ " \u2022 Max ",
12599
+ maxSize / (1024 * 1024),
12600
+ "MB per file \u2022",
12601
+ " ",
12602
+ multiple ? `Max ${maxFiles} files` : "Single file only"
12603
+ ] })
12604
+ ]
13892
12605
  }
13893
- })();
13894
- },
13895
- onDelete: () => {
13896
- var _a2;
13897
- if ((_a2 = rest.multiple) != null ? _a2 : false) {
13898
- setFieldValue(name, [], true);
13899
- } else {
13900
- setFieldValue(name, null, true);
13901
- }
13902
- },
13903
- onRemove: (fileToRemove) => {
13904
- if (rest.multiple) {
13905
- const currentFiles2 = Array.isArray(val) ? [...val] : [];
13906
- const filteredFiles = currentFiles2.filter((file) => {
13907
- const fileObj = (file == null ? void 0 : file.file) ? file.file : file;
13908
- return !_19.isEqual(fileObj, fileToRemove);
13909
- });
13910
- setFieldValue(name, filteredFiles, true);
13911
- } else {
13912
- setFieldValue(name, null, true);
13913
- }
13914
- }
12606
+ )
12607
+ ]
13915
12608
  }
13916
12609
  ),
13917
- Boolean(fieldError) && Boolean(isTouched) && /* @__PURE__ */ jsx(
12610
+ ((_a = currentFiles == null ? void 0 : currentFiles.length) != null ? _a : 0) > 0 && /* @__PURE__ */ jsx(Stack, { spacing: 1, sx: { mt: 2 }, children: currentFiles == null ? void 0 : currentFiles.map((file, index) => renderPreview(file, index)) }),
12611
+ Boolean(fieldError) && isTouched && /* @__PURE__ */ jsx(
13918
12612
  Typography,
13919
12613
  {
13920
12614
  variant: "caption",
13921
- sx: [{
13922
- color: "error.main",
13923
- display: "block",
13924
- mt: 0.5,
13925
- ...errorSx
13926
- }],
13927
- gutterBottom: true,
12615
+ sx: [
12616
+ {
12617
+ display: "block",
12618
+ color: "error.main",
12619
+ mt: 1
12620
+ },
12621
+ ...Array.isArray(errorSx) ? errorSx : [errorSx]
12622
+ ],
13928
12623
  children: fieldError
13929
12624
  }
13930
12625
  ),
13931
- rest.maxFiles != null && /* @__PURE__ */ jsxs(
12626
+ /* @__PURE__ */ jsxs(
13932
12627
  Typography,
13933
12628
  {
13934
12629
  variant: "caption",
13935
- sx: [{
13936
- display: "block",
13937
- color: "text.secondary",
13938
- mt: 0.5,
13939
- ...helperTextSx
13940
- }],
13941
- gutterBottom: true,
12630
+ sx: [
12631
+ {
12632
+ display: "block",
12633
+ color: "text.secondary",
12634
+ mt: 0.5
12635
+ },
12636
+ ...Array.isArray(helperTextSx) ? helperTextSx : [helperTextSx]
12637
+ ],
13942
12638
  children: [
13943
- "Maximum ",
13944
- rest.maxFiles,
13945
- " file",
13946
- rest.maxFiles !== 1 ? "s" : "",
13947
- " allowed"
12639
+ (currentFiles == null ? void 0 : currentFiles.length) || 0,
12640
+ " of ",
12641
+ maxFiles,
12642
+ " files selected"
13948
12643
  ]
13949
12644
  }
13950
12645
  )