formik-form-components 0.2.28 → 0.2.30
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/README.md +0 -2
- package/dist/index.d.ts +56 -264
- package/dist/index.js +624 -1203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +601 -1176
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var formik = require('formik');
|
|
4
|
-
var
|
|
4
|
+
var React3 = require('react');
|
|
5
5
|
var material = require('@mui/material');
|
|
6
6
|
var DatePicker = require('@mui/x-date-pickers/DatePicker');
|
|
7
7
|
var LocalizationProvider = require('@mui/x-date-pickers/LocalizationProvider');
|
|
8
8
|
var AdapterDayjs = require('@mui/x-date-pickers/AdapterDayjs');
|
|
9
9
|
var CalendarMonthIcon = require('@mui/icons-material/CalendarMonth');
|
|
10
|
-
var
|
|
10
|
+
var _17 = require('lodash');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var DateTimePicker = require('@mui/x-date-pickers/DateTimePicker');
|
|
13
|
-
var Autocomplete3 = require('@mui/material/Autocomplete');
|
|
14
|
-
var Typography9 = require('@mui/material/Typography');
|
|
15
13
|
var react = require('@iconify/react');
|
|
16
14
|
var PhoneInput = require('react-phone-number-input');
|
|
17
15
|
require('react-phone-number-input/style.css');
|
|
@@ -41,11 +39,9 @@ var reactI18next = require('react-i18next');
|
|
|
41
39
|
|
|
42
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
41
|
|
|
44
|
-
var
|
|
42
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
45
43
|
var CalendarMonthIcon__default = /*#__PURE__*/_interopDefault(CalendarMonthIcon);
|
|
46
|
-
var
|
|
47
|
-
var Autocomplete3__default = /*#__PURE__*/_interopDefault(Autocomplete3);
|
|
48
|
-
var Typography9__default = /*#__PURE__*/_interopDefault(Typography9);
|
|
44
|
+
var _17__default = /*#__PURE__*/_interopDefault(_17);
|
|
49
45
|
var PhoneInput__default = /*#__PURE__*/_interopDefault(PhoneInput);
|
|
50
46
|
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
51
47
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
@@ -66,20 +62,21 @@ var CloudUploadIcon__default = /*#__PURE__*/_interopDefault(CloudUploadIcon);
|
|
|
66
62
|
var CloseIcon__default = /*#__PURE__*/_interopDefault(CloseIcon);
|
|
67
63
|
|
|
68
64
|
// src/Form/index.tsx
|
|
69
|
-
var AppDatePicker =
|
|
65
|
+
var AppDatePicker = React3.forwardRef(
|
|
70
66
|
({
|
|
71
67
|
name,
|
|
72
68
|
label,
|
|
73
69
|
disabled = false,
|
|
70
|
+
disablePast = false,
|
|
74
71
|
format = "DD/MM/YYYY",
|
|
75
72
|
sx,
|
|
76
73
|
textFieldSx,
|
|
77
74
|
...otherProps
|
|
78
75
|
}, ref) => {
|
|
79
|
-
const { values, setFieldValue, touched, errors
|
|
80
|
-
const fieldValue =
|
|
81
|
-
const fieldError =
|
|
82
|
-
const isTouched =
|
|
76
|
+
const { values, setFieldValue, touched, errors } = formik.useFormikContext();
|
|
77
|
+
const fieldValue = _17__default.default.get(values, name);
|
|
78
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
79
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
83
80
|
const handleChange = (newValue) => {
|
|
84
81
|
setFieldValue(name, newValue);
|
|
85
82
|
};
|
|
@@ -89,10 +86,10 @@ var AppDatePicker = React4.forwardRef(
|
|
|
89
86
|
label,
|
|
90
87
|
value: fieldValue,
|
|
91
88
|
onChange: handleChange,
|
|
92
|
-
format,
|
|
93
89
|
disabled,
|
|
90
|
+
disablePast,
|
|
94
91
|
slots: {
|
|
95
|
-
openPickerIcon: CalendarMonthIcon__default.default
|
|
92
|
+
openPickerIcon: () => /* @__PURE__ */ jsxRuntime.jsx(CalendarMonthIcon__default.default, {})
|
|
96
93
|
},
|
|
97
94
|
slotProps: {
|
|
98
95
|
textField: {
|
|
@@ -100,7 +97,8 @@ var AppDatePicker = React4.forwardRef(
|
|
|
100
97
|
fullWidth: true,
|
|
101
98
|
error: isTouched && Boolean(fieldError),
|
|
102
99
|
helperText: isTouched && fieldError ? fieldError : void 0,
|
|
103
|
-
sx: textFieldSx
|
|
100
|
+
sx: textFieldSx,
|
|
101
|
+
inputFormat: format
|
|
104
102
|
}
|
|
105
103
|
},
|
|
106
104
|
...otherProps
|
|
@@ -110,7 +108,7 @@ var AppDatePicker = React4.forwardRef(
|
|
|
110
108
|
);
|
|
111
109
|
AppDatePicker.displayName = "AppDatePicker";
|
|
112
110
|
var AppDatePicker_default = AppDatePicker;
|
|
113
|
-
var AppDateAndTimePicker =
|
|
111
|
+
var AppDateAndTimePicker = React3.forwardRef((props, ref) => {
|
|
114
112
|
const {
|
|
115
113
|
name,
|
|
116
114
|
label,
|
|
@@ -135,9 +133,9 @@ var AppDateAndTimePicker = React4.forwardRef((props, ref) => {
|
|
|
135
133
|
} = props;
|
|
136
134
|
const theme = material.useTheme();
|
|
137
135
|
const { errors, touched, values, setFieldValue, setFieldTouched } = formik.useFormikContext();
|
|
138
|
-
const fieldError =
|
|
139
|
-
const isTouched =
|
|
140
|
-
const val =
|
|
136
|
+
const fieldError = _17.get(errors, name);
|
|
137
|
+
const isTouched = _17.get(touched, name);
|
|
138
|
+
const val = _17.get(values, name);
|
|
141
139
|
const handleChange = (value) => {
|
|
142
140
|
setFieldValue(name, value);
|
|
143
141
|
if (externalOnChange) {
|
|
@@ -313,27 +311,32 @@ function AppFormErrorMessage({
|
|
|
313
311
|
textSx
|
|
314
312
|
}) {
|
|
315
313
|
const { errors, touched } = formik.useFormikContext();
|
|
316
|
-
const fieldError =
|
|
317
|
-
const isTouched =
|
|
314
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
315
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
318
316
|
const showError = fieldError && typeof fieldError === "string";
|
|
319
317
|
if (alwaysShow) {
|
|
320
318
|
return showError ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
319
|
material.Box,
|
|
322
320
|
{
|
|
323
|
-
sx: [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
sx: [
|
|
322
|
+
{
|
|
323
|
+
mt: 0.5,
|
|
324
|
+
...containerSx
|
|
325
|
+
},
|
|
326
|
+
sx
|
|
327
|
+
],
|
|
327
328
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
328
329
|
material.Typography,
|
|
329
330
|
{
|
|
330
331
|
variant: "caption",
|
|
331
332
|
color: "error",
|
|
332
|
-
sx: [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
333
|
+
sx: [
|
|
334
|
+
{
|
|
335
|
+
fontSize: "0.75rem",
|
|
336
|
+
display: "block",
|
|
337
|
+
...textSx
|
|
338
|
+
}
|
|
339
|
+
],
|
|
337
340
|
children: fieldError
|
|
338
341
|
}
|
|
339
342
|
)
|
|
@@ -344,20 +347,25 @@ function AppFormErrorMessage({
|
|
|
344
347
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
348
|
material.Box,
|
|
346
349
|
{
|
|
347
|
-
sx: [
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
350
|
+
sx: [
|
|
351
|
+
{
|
|
352
|
+
mt: 0.5,
|
|
353
|
+
...containerSx
|
|
354
|
+
},
|
|
355
|
+
sx
|
|
356
|
+
],
|
|
351
357
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
352
358
|
material.Typography,
|
|
353
359
|
{
|
|
354
360
|
variant: "caption",
|
|
355
361
|
color: "error",
|
|
356
|
-
sx: [
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
sx: [
|
|
363
|
+
{
|
|
364
|
+
fontSize: "0.75rem",
|
|
365
|
+
display: "block",
|
|
366
|
+
...textSx
|
|
367
|
+
}
|
|
368
|
+
],
|
|
361
369
|
children: fieldError
|
|
362
370
|
}
|
|
363
371
|
)
|
|
@@ -367,7 +375,7 @@ function AppFormErrorMessage({
|
|
|
367
375
|
return null;
|
|
368
376
|
}
|
|
369
377
|
var AppFormErrorMessage_default = AppFormErrorMessage;
|
|
370
|
-
var AppTextArea =
|
|
378
|
+
var AppTextArea = React3.forwardRef(({
|
|
371
379
|
name,
|
|
372
380
|
label,
|
|
373
381
|
placeholder = "Enter text...",
|
|
@@ -391,9 +399,9 @@ var AppTextArea = React4.forwardRef(({
|
|
|
391
399
|
}, ref) => {
|
|
392
400
|
var _a, _b, _c, _d;
|
|
393
401
|
const { errors, getFieldProps, touched, setFieldValue } = formik.useFormikContext();
|
|
394
|
-
const fieldError =
|
|
395
|
-
const isTouched =
|
|
396
|
-
const value =
|
|
402
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
403
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
404
|
+
const value = _17__default.default.get(getFieldProps(name), "value", "");
|
|
397
405
|
const handleChange = (e) => {
|
|
398
406
|
const newValue = e.target.value;
|
|
399
407
|
if (maxLength && newValue.length > maxLength)
|
|
@@ -547,9 +555,9 @@ function AppTagsCreator({
|
|
|
547
555
|
inputSx
|
|
548
556
|
}) {
|
|
549
557
|
const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = formik.useFormikContext();
|
|
550
|
-
const fieldError =
|
|
551
|
-
const isTouched =
|
|
552
|
-
const val =
|
|
558
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
559
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
560
|
+
const val = _17__default.default.get(values, name);
|
|
553
561
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
554
562
|
material.FormControl,
|
|
555
563
|
{
|
|
@@ -573,7 +581,7 @@ function AppTagsCreator({
|
|
|
573
581
|
flexWrap: "wrap",
|
|
574
582
|
gap: 0.5,
|
|
575
583
|
...chipContainerSx
|
|
576
|
-
}, children: value == null ? void 0 : value.map((option, index) => /* @__PURE__ */
|
|
584
|
+
}, children: value == null ? void 0 : value.map((option, index) => /* @__PURE__ */ React3.createElement(
|
|
577
585
|
material.Chip,
|
|
578
586
|
{
|
|
579
587
|
variant: "outlined",
|
|
@@ -672,8 +680,8 @@ function AppSwitchInput({
|
|
|
672
680
|
...otherProps
|
|
673
681
|
}) {
|
|
674
682
|
const { errors, touched, setFieldValue, values } = formik.useFormikContext();
|
|
675
|
-
const fieldError =
|
|
676
|
-
const isTouched =
|
|
683
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
684
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
677
685
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
678
686
|
material.Box,
|
|
679
687
|
{
|
|
@@ -771,9 +779,9 @@ function AppSwitch({
|
|
|
771
779
|
...otherProps
|
|
772
780
|
}) {
|
|
773
781
|
const { errors, touched, setFieldValue, values } = formik.useFormikContext();
|
|
774
|
-
const fieldValue =
|
|
775
|
-
const fieldError =
|
|
776
|
-
const isTouched =
|
|
782
|
+
const fieldValue = _17__default.default.get(values, name);
|
|
783
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
784
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
777
785
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
778
786
|
material.Stack,
|
|
779
787
|
{
|
|
@@ -879,9 +887,9 @@ function AppAutoComplete({
|
|
|
879
887
|
errorSx
|
|
880
888
|
}) {
|
|
881
889
|
const { errors, touched, getFieldProps, values, setFieldValue } = formik.useFormikContext();
|
|
882
|
-
const fieldError =
|
|
883
|
-
const isTouched =
|
|
884
|
-
const formikValue =
|
|
890
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
891
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
892
|
+
const formikValue = _17__default.default.get(values, name);
|
|
885
893
|
const val = propValue !== void 0 ? propValue : formikValue || [];
|
|
886
894
|
return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
|
|
887
895
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -892,7 +900,7 @@ function AppAutoComplete({
|
|
|
892
900
|
id: "tags-filled",
|
|
893
901
|
options,
|
|
894
902
|
freeSolo: true,
|
|
895
|
-
renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */
|
|
903
|
+
renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ React3.createElement(
|
|
896
904
|
material.Chip,
|
|
897
905
|
{
|
|
898
906
|
variant: "outlined",
|
|
@@ -941,64 +949,88 @@ function AppAutoComplete({
|
|
|
941
949
|
] });
|
|
942
950
|
}
|
|
943
951
|
function AppAutoCompleter({
|
|
944
|
-
placeholder,
|
|
945
952
|
name,
|
|
946
953
|
label,
|
|
954
|
+
placeholder,
|
|
947
955
|
options,
|
|
948
|
-
|
|
956
|
+
multiple = false,
|
|
957
|
+
freeSolo = false,
|
|
949
958
|
sx,
|
|
950
959
|
formControlSx,
|
|
951
960
|
textFieldSx,
|
|
952
|
-
|
|
953
|
-
errorSx
|
|
961
|
+
chipSx,
|
|
962
|
+
errorSx,
|
|
963
|
+
...rest
|
|
954
964
|
}) {
|
|
955
965
|
const { errors, touched, values, setFieldValue } = formik.useFormikContext();
|
|
956
|
-
const fieldError =
|
|
957
|
-
const isTouched =
|
|
958
|
-
const
|
|
959
|
-
const
|
|
960
|
-
|
|
966
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
967
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
968
|
+
const formikValue = _17__default.default.get(values, name);
|
|
969
|
+
const isObjectOption = typeof options[0] === "object";
|
|
970
|
+
const resolvedValue = React3__default.default.useMemo(() => {
|
|
971
|
+
var _a;
|
|
972
|
+
if (!isObjectOption)
|
|
973
|
+
return formikValue != null ? formikValue : multiple ? [] : null;
|
|
974
|
+
if (multiple) {
|
|
975
|
+
return options.filter(
|
|
976
|
+
(opt) => (formikValue != null ? formikValue : []).includes(opt.value)
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
return (_a = options.find((opt) => opt.value === formikValue)) != null ? _a : null;
|
|
980
|
+
}, [formikValue, options, multiple, isObjectOption]);
|
|
981
|
+
const handleChange = (event, newValue, reason) => {
|
|
982
|
+
var _a, _b;
|
|
983
|
+
if (!isObjectOption) {
|
|
984
|
+
setFieldValue(name, newValue);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (multiple) {
|
|
988
|
+
setFieldValue(
|
|
989
|
+
name,
|
|
990
|
+
(_a = newValue == null ? void 0 : newValue.map((v) => v.value)) != null ? _a : []
|
|
991
|
+
);
|
|
992
|
+
} else {
|
|
993
|
+
setFieldValue(name, (_b = newValue == null ? void 0 : newValue.value) != null ? _b : null);
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, sx: formControlSx, children: [
|
|
961
997
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
962
|
-
|
|
998
|
+
material.Autocomplete,
|
|
963
999
|
{
|
|
964
|
-
|
|
1000
|
+
multiple,
|
|
1001
|
+
freeSolo,
|
|
965
1002
|
options,
|
|
966
|
-
value:
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1003
|
+
value: resolvedValue,
|
|
1004
|
+
onChange: handleChange,
|
|
1005
|
+
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
1006
|
+
isOptionEqualToValue: (option, value) => typeof option === "string" || typeof value === "string" ? option === value : option.value === value.value,
|
|
1007
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
1008
|
+
const tagProps = getTagProps({ index });
|
|
1009
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1010
|
+
material.Chip,
|
|
1011
|
+
{
|
|
1012
|
+
...tagProps,
|
|
1013
|
+
label: typeof option === "string" ? option : option.label,
|
|
1014
|
+
sx: chipSx
|
|
1015
|
+
}
|
|
1016
|
+
);
|
|
1017
|
+
}),
|
|
974
1018
|
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
975
1019
|
material.TextField,
|
|
976
1020
|
{
|
|
977
1021
|
...params,
|
|
978
1022
|
label,
|
|
979
1023
|
placeholder,
|
|
980
|
-
error: Boolean(fieldError
|
|
1024
|
+
error: Boolean(fieldError && isTouched),
|
|
981
1025
|
helperText: isTouched && fieldError,
|
|
982
1026
|
sx: textFieldSx
|
|
983
1027
|
}
|
|
984
1028
|
),
|
|
985
|
-
|
|
986
|
-
|
|
1029
|
+
sx,
|
|
1030
|
+
...rest
|
|
987
1031
|
}
|
|
988
1032
|
),
|
|
989
|
-
fieldError
|
|
990
|
-
material.Typography,
|
|
991
|
-
{
|
|
992
|
-
variant: "caption",
|
|
993
|
-
display: "block",
|
|
994
|
-
gutterBottom: true,
|
|
995
|
-
sx: {
|
|
996
|
-
color: "#FF5630",
|
|
997
|
-
...errorSx
|
|
998
|
-
},
|
|
999
|
-
children: fieldError
|
|
1000
|
-
}
|
|
1001
|
-
)
|
|
1033
|
+
fieldError && isTouched && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", sx: { color: "#FF5630", ...errorSx }, children: fieldError })
|
|
1002
1034
|
] });
|
|
1003
1035
|
}
|
|
1004
1036
|
var AppCheckBox = ({
|
|
@@ -1015,19 +1047,17 @@ var AppCheckBox = ({
|
|
|
1015
1047
|
containerSx,
|
|
1016
1048
|
iconSx,
|
|
1017
1049
|
checkedSx,
|
|
1018
|
-
|
|
1050
|
+
checkboxProps
|
|
1019
1051
|
}) => {
|
|
1020
1052
|
const { getFieldProps, setFieldValue, touched, errors } = formik.useFormikContext();
|
|
1021
|
-
const fieldError =
|
|
1022
|
-
const isTouched =
|
|
1023
|
-
material.useTheme();
|
|
1053
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
1054
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
1024
1055
|
const value = getFieldProps(name).value;
|
|
1025
|
-
const checkedValues = (() => {
|
|
1026
|
-
if (Array.isArray(value))
|
|
1056
|
+
const checkedValues = React3__default.default.useMemo(() => {
|
|
1057
|
+
if (Array.isArray(value))
|
|
1027
1058
|
return value.map(String);
|
|
1028
|
-
}
|
|
1029
1059
|
return value ? [String(value)] : [];
|
|
1030
|
-
})
|
|
1060
|
+
}, [value]);
|
|
1031
1061
|
const handleChange = (itemValue, isChecked) => {
|
|
1032
1062
|
if (option.length === 1) {
|
|
1033
1063
|
setFieldValue(name, isChecked ? itemValue : false);
|
|
@@ -1039,119 +1069,109 @@ var AppCheckBox = ({
|
|
|
1039
1069
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1040
1070
|
material.Box,
|
|
1041
1071
|
{
|
|
1042
|
-
sx: [
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
opacity: 0.7,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1072
|
+
sx: [
|
|
1073
|
+
{
|
|
1074
|
+
width: "100%",
|
|
1075
|
+
...disabled && { opacity: 0.7, pointerEvents: "none" }
|
|
1076
|
+
},
|
|
1077
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
1078
|
+
],
|
|
1049
1079
|
children: [
|
|
1050
1080
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1051
|
-
|
|
1081
|
+
material.Typography,
|
|
1052
1082
|
{
|
|
1053
1083
|
variant: "subtitle2",
|
|
1054
1084
|
gutterBottom: true,
|
|
1055
|
-
sx: [
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
content: '" *"',
|
|
1061
|
-
|
|
1062
|
-
}
|
|
1085
|
+
sx: [
|
|
1086
|
+
{
|
|
1087
|
+
color: "text.primary",
|
|
1088
|
+
fontWeight: "medium",
|
|
1089
|
+
...required && {
|
|
1090
|
+
"&:after": { content: '" *"', color: "error.main" }
|
|
1091
|
+
},
|
|
1092
|
+
...disabled && { color: "text.disabled" }
|
|
1063
1093
|
},
|
|
1064
|
-
...
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
}, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
|
|
1094
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
1095
|
+
],
|
|
1068
1096
|
children: label
|
|
1069
1097
|
}
|
|
1070
1098
|
),
|
|
1071
1099
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1072
1100
|
material.Box,
|
|
1073
1101
|
{
|
|
1074
|
-
sx: [
|
|
1075
|
-
display: "flex",
|
|
1076
|
-
flexDirection: row ? "row" : "column",
|
|
1077
|
-
flexWrap: row ? "wrap" : "nowrap",
|
|
1078
|
-
gap: 2,
|
|
1079
|
-
...row ? {
|
|
1080
|
-
"& > *": {
|
|
1081
|
-
minWidth: "fit-content"
|
|
1082
|
-
}
|
|
1083
|
-
} : {}
|
|
1084
|
-
}, ...Array.isArray(containerSx) ? containerSx : [containerSx]],
|
|
1085
|
-
children: option.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1086
|
-
material.Box,
|
|
1102
|
+
sx: [
|
|
1087
1103
|
{
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
"&:hover": {
|
|
1094
|
-
backgroundColor: !disabled ? "action.hover" : "transparent"
|
|
1095
|
-
},
|
|
1096
|
-
px: 2,
|
|
1097
|
-
py: 1,
|
|
1098
|
-
...disabled && {
|
|
1099
|
-
color: "text.disabled"
|
|
1100
|
-
}
|
|
1101
|
-
}],
|
|
1102
|
-
children: [
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1104
|
-
material.Checkbox,
|
|
1105
|
-
{
|
|
1106
|
-
name: `${name}.${item.name}`,
|
|
1107
|
-
checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
|
|
1108
|
-
onChange: (e) => handleChange(item.value, e.target.checked),
|
|
1109
|
-
disabled: disabled || item.disabled,
|
|
1110
|
-
sx: [{
|
|
1111
|
-
color: "primary.main",
|
|
1112
|
-
"&.Mui-checked": {
|
|
1113
|
-
color: "primary.main",
|
|
1114
|
-
...checkedSx
|
|
1115
|
-
},
|
|
1116
|
-
"& .MuiSvgIcon-root": {
|
|
1117
|
-
fontSize: 24,
|
|
1118
|
-
...iconSx
|
|
1119
|
-
},
|
|
1120
|
-
"&.Mui-disabled": {
|
|
1121
|
-
color: "action.disabled"
|
|
1122
|
-
}
|
|
1123
|
-
}, ...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]],
|
|
1124
|
-
...rest
|
|
1125
|
-
}
|
|
1126
|
-
),
|
|
1127
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1128
|
-
Typography9__default.default,
|
|
1129
|
-
{
|
|
1130
|
-
variant: "body2",
|
|
1131
|
-
sx: [{
|
|
1132
|
-
color: disabled ? "text.disabled" : "text.primary",
|
|
1133
|
-
...disabled && {
|
|
1134
|
-
color: "text.disabled"
|
|
1135
|
-
}
|
|
1136
|
-
}, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
|
|
1137
|
-
children: item.label
|
|
1138
|
-
}
|
|
1139
|
-
)
|
|
1140
|
-
]
|
|
1104
|
+
display: "flex",
|
|
1105
|
+
flexDirection: row ? "row" : "column",
|
|
1106
|
+
flexWrap: row ? "wrap" : "nowrap",
|
|
1107
|
+
gap: 2,
|
|
1108
|
+
...row && { "& > *": { minWidth: "fit-content" } }
|
|
1141
1109
|
},
|
|
1142
|
-
|
|
1143
|
-
|
|
1110
|
+
...Array.isArray(containerSx) ? containerSx : [containerSx]
|
|
1111
|
+
],
|
|
1112
|
+
children: option.map((item) => {
|
|
1113
|
+
const isChecked = option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value));
|
|
1114
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1115
|
+
material.Box,
|
|
1116
|
+
{
|
|
1117
|
+
sx: {
|
|
1118
|
+
display: "flex",
|
|
1119
|
+
alignItems: "center",
|
|
1120
|
+
borderRadius: 1,
|
|
1121
|
+
transition: "background-color 0.2s",
|
|
1122
|
+
"&:hover": {
|
|
1123
|
+
backgroundColor: !disabled ? "action.hover" : "transparent"
|
|
1124
|
+
},
|
|
1125
|
+
px: 2,
|
|
1126
|
+
py: 1,
|
|
1127
|
+
...disabled && { color: "text.disabled" }
|
|
1128
|
+
},
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1131
|
+
material.Checkbox,
|
|
1132
|
+
{
|
|
1133
|
+
name: `${name}.${item.name}`,
|
|
1134
|
+
checked: isChecked,
|
|
1135
|
+
onChange: (e) => handleChange(item.value, e.target.checked),
|
|
1136
|
+
disabled: disabled || item.disabled,
|
|
1137
|
+
sx: [
|
|
1138
|
+
{
|
|
1139
|
+
color: "primary.main",
|
|
1140
|
+
"&.Mui-checked": { color: "primary.main", ...checkedSx },
|
|
1141
|
+
"& .MuiSvgIcon-root": { fontSize: 24, ...iconSx },
|
|
1142
|
+
"&.Mui-disabled": { color: "action.disabled" }
|
|
1143
|
+
},
|
|
1144
|
+
...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]
|
|
1145
|
+
],
|
|
1146
|
+
...checkboxProps
|
|
1147
|
+
}
|
|
1148
|
+
),
|
|
1149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
+
material.Typography,
|
|
1151
|
+
{
|
|
1152
|
+
variant: "body2",
|
|
1153
|
+
sx: [
|
|
1154
|
+
{ color: disabled ? "text.disabled" : "text.primary" },
|
|
1155
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
1156
|
+
],
|
|
1157
|
+
children: item.label
|
|
1158
|
+
}
|
|
1159
|
+
)
|
|
1160
|
+
]
|
|
1161
|
+
},
|
|
1162
|
+
item.name
|
|
1163
|
+
);
|
|
1164
|
+
})
|
|
1144
1165
|
}
|
|
1145
1166
|
),
|
|
1146
1167
|
isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1147
|
-
|
|
1168
|
+
material.Typography,
|
|
1148
1169
|
{
|
|
1149
1170
|
variant: "caption",
|
|
1150
|
-
sx: [
|
|
1151
|
-
display: "block",
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
}, ...Array.isArray(errorSx) ? errorSx : [errorSx]],
|
|
1171
|
+
sx: [
|
|
1172
|
+
{ display: "block", mt: 0.5, color: "error.main" },
|
|
1173
|
+
...Array.isArray(errorSx) ? errorSx : [errorSx]
|
|
1174
|
+
],
|
|
1155
1175
|
children: fieldError
|
|
1156
1176
|
}
|
|
1157
1177
|
)
|
|
@@ -1160,7 +1180,7 @@ var AppCheckBox = ({
|
|
|
1160
1180
|
);
|
|
1161
1181
|
};
|
|
1162
1182
|
var AppCheckBox_default = AppCheckBox;
|
|
1163
|
-
var Iconify =
|
|
1183
|
+
var Iconify = React3.forwardRef(({ icon, width = 20, color, sx, ...other }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1164
1184
|
material.Box,
|
|
1165
1185
|
{
|
|
1166
1186
|
ref,
|
|
@@ -1176,63 +1196,27 @@ function AppInputField({
|
|
|
1176
1196
|
name,
|
|
1177
1197
|
label,
|
|
1178
1198
|
type,
|
|
1179
|
-
InputProps,
|
|
1180
1199
|
required,
|
|
1181
1200
|
variant = "outlined",
|
|
1201
|
+
InputProps,
|
|
1182
1202
|
...otherProps
|
|
1183
1203
|
}) {
|
|
1184
1204
|
const { errors, getFieldProps, touched } = formik.useFormikContext();
|
|
1185
|
-
const fieldError =
|
|
1186
|
-
const isTouched =
|
|
1187
|
-
const [showPassword, setShowPassword] =
|
|
1188
|
-
const handleShowPassword = () =>
|
|
1189
|
-
setShowPassword(!showPassword);
|
|
1190
|
-
};
|
|
1205
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
1206
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
1207
|
+
const [showPassword, setShowPassword] = React3.useState(false);
|
|
1208
|
+
const handleShowPassword = () => setShowPassword(!showPassword);
|
|
1191
1209
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
1210
|
material.TextField,
|
|
1193
1211
|
{
|
|
1194
1212
|
...getFieldProps(name),
|
|
1195
1213
|
fullWidth: true,
|
|
1196
1214
|
variant,
|
|
1197
|
-
label: required
|
|
1215
|
+
label: required ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1198
1216
|
label,
|
|
1199
1217
|
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { color: "red", pl: 0.5 }, component: "span", children: "*" })
|
|
1200
1218
|
] }) : label,
|
|
1201
1219
|
error: Boolean(fieldError) && isTouched,
|
|
1202
|
-
sx: {
|
|
1203
|
-
".Mui-error": {
|
|
1204
|
-
m: 0,
|
|
1205
|
-
mt: 0
|
|
1206
|
-
},
|
|
1207
|
-
".MuiFormLabel-root": {
|
|
1208
|
-
top: "-10px",
|
|
1209
|
-
color: "text.primary"
|
|
1210
|
-
},
|
|
1211
|
-
".MuiInputLabel-root.Mui-focused": {
|
|
1212
|
-
color: "text.primary"
|
|
1213
|
-
},
|
|
1214
|
-
".MuiInputLabel-shrink": {
|
|
1215
|
-
top: 0
|
|
1216
|
-
},
|
|
1217
|
-
".MuiFormLabel-asterisk": {
|
|
1218
|
-
color: "red"
|
|
1219
|
-
},
|
|
1220
|
-
"& .MuiInputBase-input.MuiOutlinedInput-input": {
|
|
1221
|
-
color: "common.black"
|
|
1222
|
-
},
|
|
1223
|
-
".MuiOutlinedInput-root": {
|
|
1224
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
1225
|
-
},
|
|
1226
|
-
"react-tel-input": {
|
|
1227
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
1228
|
-
},
|
|
1229
|
-
"& input:-webkit-autofill": {
|
|
1230
|
-
WebkitBoxShadow: "0 0 0 1000px transparent inset !important",
|
|
1231
|
-
WebkitTextFillColor: "inherit !important",
|
|
1232
|
-
transition: "background-color 9999s ease-in-out 0s !important",
|
|
1233
|
-
caretColor: "inherit"
|
|
1234
|
-
}
|
|
1235
|
-
},
|
|
1236
1220
|
helperText: isTouched && fieldError,
|
|
1237
1221
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
1238
1222
|
InputProps: type === "password" ? {
|
|
@@ -1242,7 +1226,7 @@ function AppInputField({
|
|
|
1242
1226
|
}
|
|
1243
1227
|
);
|
|
1244
1228
|
}
|
|
1245
|
-
var AppMultiSelector =
|
|
1229
|
+
var AppMultiSelector = React3.forwardRef(
|
|
1246
1230
|
({
|
|
1247
1231
|
name,
|
|
1248
1232
|
label,
|
|
@@ -1268,10 +1252,10 @@ var AppMultiSelector = React4.forwardRef(
|
|
|
1268
1252
|
}, ref) => {
|
|
1269
1253
|
const theme = material.useTheme();
|
|
1270
1254
|
const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
|
|
1271
|
-
const fieldError =
|
|
1272
|
-
const isTouched = Boolean(
|
|
1255
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
1256
|
+
const isTouched = Boolean(_17__default.default.get(touched, name));
|
|
1273
1257
|
const hasError = Boolean(fieldError) && isTouched;
|
|
1274
|
-
const currentValue =
|
|
1258
|
+
const currentValue = _17__default.default.get(values, name);
|
|
1275
1259
|
const selectedValues = Array.isArray(currentValue) ? currentValue : [];
|
|
1276
1260
|
const selectedCount = selectedValues.length;
|
|
1277
1261
|
const isMaxReached = maxSelections ? selectedCount >= maxSelections : false;
|
|
@@ -1294,7 +1278,7 @@ var AppMultiSelector = React4.forwardRef(
|
|
|
1294
1278
|
return options.filter((opt) => selectedValues.includes(opt.value));
|
|
1295
1279
|
};
|
|
1296
1280
|
if (mode === "autocomplete") {
|
|
1297
|
-
const debouncedSearch =
|
|
1281
|
+
const debouncedSearch = React3__default.default.useRef();
|
|
1298
1282
|
const handleSearchChange = (query) => {
|
|
1299
1283
|
if (debouncedSearch.current) {
|
|
1300
1284
|
clearTimeout(debouncedSearch.current);
|
|
@@ -1310,10 +1294,7 @@ var AppMultiSelector = React4.forwardRef(
|
|
|
1310
1294
|
return options2;
|
|
1311
1295
|
const inputValueLower = inputValue.toLowerCase();
|
|
1312
1296
|
return options2.filter(
|
|
1313
|
-
(option) =>
|
|
1314
|
-
var _a, _b, _c;
|
|
1315
|
-
return option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower) || ((_a = option.searchAbleValue1) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || ((_b = option.searchAbleValue2) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option.searchAbleValue3) == null ? void 0 : _c.toLowerCase().includes(inputValueLower));
|
|
1316
|
-
}
|
|
1297
|
+
(option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
|
|
1317
1298
|
);
|
|
1318
1299
|
};
|
|
1319
1300
|
const selectedOptions = getSelectedOptions();
|
|
@@ -1374,33 +1355,36 @@ var AppMultiSelector = React4.forwardRef(
|
|
|
1374
1355
|
}
|
|
1375
1356
|
}
|
|
1376
1357
|
),
|
|
1377
|
-
renderOption: (props, option, { selected }) =>
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1358
|
+
renderOption: (props, option, { selected }) => {
|
|
1359
|
+
const { key, ...restProps } = props;
|
|
1360
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { ...restProps, children: [
|
|
1361
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1362
|
+
material.Checkbox,
|
|
1363
|
+
{
|
|
1364
|
+
checked: selected,
|
|
1365
|
+
disabled: option.disabled || isMaxReached && !selected,
|
|
1366
|
+
sx: checkboxSx
|
|
1367
|
+
}
|
|
1368
|
+
),
|
|
1369
|
+
option.icon,
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
|
+
material.Typography,
|
|
1372
|
+
{
|
|
1373
|
+
variant: "body2",
|
|
1374
|
+
sx: {
|
|
1375
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
1376
|
+
...option.textSx
|
|
1377
|
+
},
|
|
1378
|
+
children: option.label
|
|
1379
|
+
}
|
|
1380
|
+
)
|
|
1381
|
+
] }, key);
|
|
1382
|
+
},
|
|
1399
1383
|
renderTags: (value, getTagProps) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1400
1384
|
material.Box,
|
|
1401
1385
|
{
|
|
1402
1386
|
sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 },
|
|
1403
|
-
children: value.map((option, index) => /* @__PURE__ */
|
|
1387
|
+
children: value.map((option, index) => /* @__PURE__ */ React3.createElement(
|
|
1404
1388
|
material.Chip,
|
|
1405
1389
|
{
|
|
1406
1390
|
...getTagProps({ index }),
|
|
@@ -1578,8 +1562,8 @@ var AppPhoneNoInput = ({
|
|
|
1578
1562
|
withCountryCallingCode = true
|
|
1579
1563
|
}) => {
|
|
1580
1564
|
const { values, errors, touched, setFieldValue, setFieldTouched } = formik.useFormikContext();
|
|
1581
|
-
const fieldError =
|
|
1582
|
-
const isTouched =
|
|
1565
|
+
const fieldError = React3.useMemo(() => _17__default.default.get(errors, name), [errors, name]);
|
|
1566
|
+
const isTouched = React3.useMemo(() => _17__default.default.get(touched, name), [touched, name]);
|
|
1583
1567
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1584
1568
|
material.Box,
|
|
1585
1569
|
{
|
|
@@ -1670,167 +1654,186 @@ var AppPhoneNoInput = ({
|
|
|
1670
1654
|
);
|
|
1671
1655
|
};
|
|
1672
1656
|
var AppPhoneNoInput_default = AppPhoneNoInput;
|
|
1673
|
-
var AppRadioGroup =
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
onChange
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
onBlur
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
material.
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
"& .MuiFormGroup-root": {
|
|
1716
|
-
mt: 1
|
|
1717
|
-
}
|
|
1718
|
-
}, ...Array.isArray(formControlSx) ? formControlSx : [formControlSx]],
|
|
1719
|
-
children: [
|
|
1720
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1721
|
-
material.FormLabel,
|
|
1657
|
+
var AppRadioGroup = React3.forwardRef(
|
|
1658
|
+
({
|
|
1659
|
+
name,
|
|
1660
|
+
options = [],
|
|
1661
|
+
label,
|
|
1662
|
+
required = false,
|
|
1663
|
+
disabled = false,
|
|
1664
|
+
row = false,
|
|
1665
|
+
sx,
|
|
1666
|
+
formControlSx,
|
|
1667
|
+
radioGroupSx,
|
|
1668
|
+
formLabelSx,
|
|
1669
|
+
radioSx,
|
|
1670
|
+
labelSx,
|
|
1671
|
+
errorSx,
|
|
1672
|
+
onChange,
|
|
1673
|
+
onBlur,
|
|
1674
|
+
...rest
|
|
1675
|
+
}, ref) => {
|
|
1676
|
+
const { errors, touched, getFieldProps, setFieldValue } = formik.useFormikContext();
|
|
1677
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
1678
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
1679
|
+
const value = _17__default.default.get(getFieldProps(name), "value");
|
|
1680
|
+
const handleChange = (event) => {
|
|
1681
|
+
const newValue = event.target.value;
|
|
1682
|
+
setFieldValue(name, newValue);
|
|
1683
|
+
if (onChange) {
|
|
1684
|
+
onChange(event, newValue);
|
|
1685
|
+
}
|
|
1686
|
+
};
|
|
1687
|
+
const handleBlur = (event) => {
|
|
1688
|
+
if (onBlur) {
|
|
1689
|
+
onBlur(event);
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1693
|
+
material.FormControl,
|
|
1694
|
+
{
|
|
1695
|
+
component: "fieldset",
|
|
1696
|
+
error: Boolean(fieldError) && isTouched,
|
|
1697
|
+
disabled,
|
|
1698
|
+
sx: [
|
|
1722
1699
|
{
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1737
|
-
material.Typography,
|
|
1700
|
+
width: "100%",
|
|
1701
|
+
"& .MuiFormGroup-root": {
|
|
1702
|
+
mt: 1
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
...Array.isArray(formControlSx) ? formControlSx : [formControlSx]
|
|
1706
|
+
],
|
|
1707
|
+
children: [
|
|
1708
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1709
|
+
material.FormLabel,
|
|
1710
|
+
{
|
|
1711
|
+
component: "legend",
|
|
1712
|
+
sx: [
|
|
1738
1713
|
{
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1714
|
+
color: "text.primary",
|
|
1715
|
+
mb: 1,
|
|
1716
|
+
"&.Mui-focused": {
|
|
1717
|
+
color: "text.primary"
|
|
1743
1718
|
},
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
)
|
|
1747
|
-
]
|
|
1748
|
-
}
|
|
1749
|
-
),
|
|
1750
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1751
|
-
material.RadioGroup,
|
|
1752
|
-
{
|
|
1753
|
-
...getFieldProps(name),
|
|
1754
|
-
value: value != null ? value : "",
|
|
1755
|
-
onChange: handleChange,
|
|
1756
|
-
onBlur: handleBlur,
|
|
1757
|
-
row,
|
|
1758
|
-
sx: [{
|
|
1759
|
-
"& .MuiFormControlLabel-root": {
|
|
1760
|
-
mr: row ? 3 : 0,
|
|
1761
|
-
mb: row ? 0 : 1,
|
|
1762
|
-
"&:last-of-type": {
|
|
1763
|
-
mb: 0
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
}, ...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]],
|
|
1767
|
-
...rest,
|
|
1768
|
-
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1769
|
-
material.FormControlLabel,
|
|
1770
|
-
{
|
|
1771
|
-
value: option.value,
|
|
1772
|
-
disabled: disabled || option.disabled,
|
|
1773
|
-
control: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1774
|
-
material.Radio,
|
|
1775
|
-
{
|
|
1776
|
-
sx: [{
|
|
1777
|
-
color: "primary.main",
|
|
1778
|
-
"&.Mui-checked": {
|
|
1779
|
-
color: "primary.main"
|
|
1780
|
-
},
|
|
1781
|
-
"&.Mui-disabled": {
|
|
1782
|
-
color: "action.disabled"
|
|
1783
|
-
},
|
|
1784
|
-
...radioSx,
|
|
1785
|
-
...option.radioSx
|
|
1786
|
-
}]
|
|
1719
|
+
"&.Mui-disabled": {
|
|
1720
|
+
color: "text.disabled"
|
|
1787
1721
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1722
|
+
},
|
|
1723
|
+
...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]
|
|
1724
|
+
],
|
|
1725
|
+
children: [
|
|
1726
|
+
label,
|
|
1727
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1790
1728
|
material.Typography,
|
|
1791
1729
|
{
|
|
1792
|
-
|
|
1793
|
-
sx:
|
|
1794
|
-
color:
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
children: option.label
|
|
1730
|
+
component: "span",
|
|
1731
|
+
sx: {
|
|
1732
|
+
color: "error.main",
|
|
1733
|
+
ml: 0.5
|
|
1734
|
+
},
|
|
1735
|
+
children: "*"
|
|
1799
1736
|
}
|
|
1800
|
-
)
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1737
|
+
)
|
|
1738
|
+
]
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1742
|
+
material.RadioGroup,
|
|
1743
|
+
{
|
|
1744
|
+
...getFieldProps(name),
|
|
1745
|
+
value: value != null ? value : "",
|
|
1746
|
+
onChange: handleChange,
|
|
1747
|
+
onBlur: handleBlur,
|
|
1748
|
+
row,
|
|
1749
|
+
sx: [
|
|
1750
|
+
{
|
|
1751
|
+
"& .MuiFormControlLabel-root": {
|
|
1752
|
+
mr: row ? 3 : 0,
|
|
1753
|
+
mb: row ? 0 : 1,
|
|
1754
|
+
"&:last-of-type": {
|
|
1755
|
+
mb: 0
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]
|
|
1760
|
+
],
|
|
1761
|
+
...rest,
|
|
1762
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1763
|
+
material.FormControlLabel,
|
|
1764
|
+
{
|
|
1765
|
+
value: option.value,
|
|
1766
|
+
disabled: disabled || option.disabled,
|
|
1767
|
+
control: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1768
|
+
material.Radio,
|
|
1769
|
+
{
|
|
1770
|
+
sx: [
|
|
1771
|
+
{
|
|
1772
|
+
color: "primary.main",
|
|
1773
|
+
"&.Mui-checked": {
|
|
1774
|
+
color: "primary.main"
|
|
1775
|
+
},
|
|
1776
|
+
"&.Mui-disabled": {
|
|
1777
|
+
color: "action.disabled"
|
|
1778
|
+
},
|
|
1779
|
+
...radioSx,
|
|
1780
|
+
...option.radioSx
|
|
1781
|
+
}
|
|
1782
|
+
]
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1786
|
+
material.Typography,
|
|
1787
|
+
{
|
|
1788
|
+
variant: "body2",
|
|
1789
|
+
sx: [
|
|
1790
|
+
{
|
|
1791
|
+
color: disabled || option.disabled ? "text.disabled" : "text.primary",
|
|
1792
|
+
...labelSx,
|
|
1793
|
+
...option.labelSx
|
|
1794
|
+
}
|
|
1795
|
+
],
|
|
1796
|
+
children: option.label
|
|
1797
|
+
}
|
|
1798
|
+
),
|
|
1799
|
+
sx: [
|
|
1800
|
+
{
|
|
1801
|
+
m: 0,
|
|
1802
|
+
mr: row ? 3 : 0,
|
|
1803
|
+
mb: row ? 0 : 1,
|
|
1804
|
+
"&:last-of-type": {
|
|
1805
|
+
mb: 0
|
|
1806
|
+
},
|
|
1807
|
+
...option.sx
|
|
1808
|
+
}
|
|
1809
|
+
]
|
|
1810
|
+
},
|
|
1811
|
+
option.value
|
|
1812
|
+
))
|
|
1813
|
+
}
|
|
1814
|
+
),
|
|
1815
|
+
isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1816
|
+
material.FormHelperText,
|
|
1817
|
+
{
|
|
1818
|
+
sx: [
|
|
1819
|
+
{
|
|
1820
|
+
color: "error.main",
|
|
1821
|
+
mx: 0,
|
|
1822
|
+
mt: 0.5,
|
|
1823
|
+
...errorSx
|
|
1824
|
+
}
|
|
1825
|
+
],
|
|
1826
|
+
children: fieldError
|
|
1827
|
+
}
|
|
1828
|
+
)
|
|
1829
|
+
]
|
|
1830
|
+
}
|
|
1831
|
+
) });
|
|
1832
|
+
}
|
|
1833
|
+
);
|
|
1831
1834
|
AppRadioGroup.displayName = "AppRadioGroup";
|
|
1832
1835
|
var AppRadioGroup_default = AppRadioGroup;
|
|
1833
|
-
var AppRating =
|
|
1836
|
+
var AppRating = React3.forwardRef(
|
|
1834
1837
|
({
|
|
1835
1838
|
name,
|
|
1836
1839
|
label,
|
|
@@ -1870,9 +1873,9 @@ var AppRating = React4.forwardRef(
|
|
|
1870
1873
|
}, ref) => {
|
|
1871
1874
|
material.useTheme();
|
|
1872
1875
|
const { errors, touched, setFieldValue, values, setFieldTouched } = formik.useFormikContext();
|
|
1873
|
-
const val =
|
|
1874
|
-
const fieldError =
|
|
1875
|
-
const isTouched =
|
|
1876
|
+
const val = _17__default.default.get(values, name);
|
|
1877
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
1878
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
1876
1879
|
const hasError = Boolean(fieldError) && isTouched;
|
|
1877
1880
|
const handleChange = (event, newValue) => {
|
|
1878
1881
|
setFieldValue(name, newValue);
|
|
@@ -2614,7 +2617,7 @@ var Mark = class {
|
|
|
2614
2617
|
*/
|
|
2615
2618
|
toJSON() {
|
|
2616
2619
|
let obj = { type: this.type.name };
|
|
2617
|
-
for (let
|
|
2620
|
+
for (let _18 in this.attrs) {
|
|
2618
2621
|
obj.attrs = this.attrs;
|
|
2619
2622
|
break;
|
|
2620
2623
|
}
|
|
@@ -3562,7 +3565,7 @@ var Node = class {
|
|
|
3562
3565
|
*/
|
|
3563
3566
|
toJSON() {
|
|
3564
3567
|
let obj = { type: this.type.name };
|
|
3565
|
-
for (let
|
|
3568
|
+
for (let _18 in this.attrs) {
|
|
3566
3569
|
obj.attrs = this.attrs;
|
|
3567
3570
|
break;
|
|
3568
3571
|
}
|
|
@@ -4291,7 +4294,7 @@ var NodeType = class {
|
|
|
4291
4294
|
throw new RangeError("Schema is missing its top node type ('" + topType + "')");
|
|
4292
4295
|
if (!result.text)
|
|
4293
4296
|
throw new RangeError("Every schema needs a 'text' type");
|
|
4294
|
-
for (let
|
|
4297
|
+
for (let _18 in result.text.attrs)
|
|
4295
4298
|
throw new RangeError("The text node type should not have attributes");
|
|
4296
4299
|
return result;
|
|
4297
4300
|
}
|
|
@@ -9300,7 +9303,7 @@ function removeDuplicates(array, by = JSON.stringify) {
|
|
|
9300
9303
|
function simplifyChangedRanges(changes) {
|
|
9301
9304
|
const uniqueChanges = removeDuplicates(changes);
|
|
9302
9305
|
return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
|
|
9303
|
-
const rest = uniqueChanges.filter((
|
|
9306
|
+
const rest = uniqueChanges.filter((_18, i) => i !== index);
|
|
9304
9307
|
return !rest.some((otherChange) => {
|
|
9305
9308
|
return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
|
|
9306
9309
|
});
|
|
@@ -10325,7 +10328,7 @@ var Drop = Extension.create({
|
|
|
10325
10328
|
new Plugin({
|
|
10326
10329
|
key: new PluginKey("tiptapDrop"),
|
|
10327
10330
|
props: {
|
|
10328
|
-
handleDrop: (
|
|
10331
|
+
handleDrop: (_18, e, slice, moved) => {
|
|
10329
10332
|
this.editor.emit("drop", {
|
|
10330
10333
|
editor: this.editor,
|
|
10331
10334
|
event: e,
|
|
@@ -11141,12 +11144,13 @@ var AppRichTextEditor = ({
|
|
|
11141
11144
|
labelSx,
|
|
11142
11145
|
buttonSx,
|
|
11143
11146
|
activeButtonSx,
|
|
11144
|
-
dialogSx
|
|
11147
|
+
dialogSx,
|
|
11148
|
+
showButtons
|
|
11145
11149
|
}) => {
|
|
11146
11150
|
material.useTheme();
|
|
11147
11151
|
const { values, setFieldValue } = formik.useFormikContext();
|
|
11148
|
-
const [linkDialogOpen, setLinkDialogOpen] =
|
|
11149
|
-
const [linkUrl, setLinkUrl] =
|
|
11152
|
+
const [linkDialogOpen, setLinkDialogOpen] = React3.useState(false);
|
|
11153
|
+
const [linkUrl, setLinkUrl] = React3.useState("");
|
|
11150
11154
|
const editor = react$1.useEditor({
|
|
11151
11155
|
extensions: [
|
|
11152
11156
|
StarterKit__default.default,
|
|
@@ -11157,15 +11161,23 @@ var AppRichTextEditor = ({
|
|
|
11157
11161
|
content: values[name] || "",
|
|
11158
11162
|
onUpdate({ editor: editor2 }) {
|
|
11159
11163
|
setFieldValue(name, editor2.getHTML());
|
|
11160
|
-
}
|
|
11164
|
+
},
|
|
11165
|
+
editorProps: { attributes: { class: "prose" } },
|
|
11166
|
+
immediatelyRender: false
|
|
11167
|
+
// SSR-safe
|
|
11161
11168
|
});
|
|
11162
|
-
|
|
11169
|
+
React3.useEffect(() => {
|
|
11163
11170
|
if (editor && values[name] !== editor.getHTML()) {
|
|
11164
11171
|
editor.commands.setContent(values[name] || "");
|
|
11165
11172
|
}
|
|
11166
11173
|
}, [values[name]]);
|
|
11167
11174
|
if (!editor)
|
|
11168
11175
|
return null;
|
|
11176
|
+
const openLinkDialog = () => {
|
|
11177
|
+
const previousUrl = editor.getAttributes("link").href || "";
|
|
11178
|
+
setLinkUrl(previousUrl);
|
|
11179
|
+
setLinkDialogOpen(true);
|
|
11180
|
+
};
|
|
11169
11181
|
const applyLink = () => {
|
|
11170
11182
|
editor.chain().focus().extendMarkRange("link").setLink({ href: linkUrl }).run();
|
|
11171
11183
|
setLinkDialogOpen(false);
|
|
@@ -11174,47 +11186,151 @@ var AppRichTextEditor = ({
|
|
|
11174
11186
|
editor.chain().focus().unsetLink().run();
|
|
11175
11187
|
setLinkDialogOpen(false);
|
|
11176
11188
|
};
|
|
11189
|
+
const renderButton = (onClick, Icon2, active, tooltip) => /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: tooltip, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11190
|
+
material.IconButton,
|
|
11191
|
+
{
|
|
11192
|
+
onClick,
|
|
11193
|
+
color: active ? "primary" : "default",
|
|
11194
|
+
sx: {
|
|
11195
|
+
...buttonSx,
|
|
11196
|
+
...active ? activeButtonSx : {}
|
|
11197
|
+
},
|
|
11198
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, {})
|
|
11199
|
+
}
|
|
11200
|
+
) }, tooltip);
|
|
11201
|
+
const defaultButtons = [
|
|
11202
|
+
"bold",
|
|
11203
|
+
"italic",
|
|
11204
|
+
"underline",
|
|
11205
|
+
"strike",
|
|
11206
|
+
"bulletList",
|
|
11207
|
+
"orderedList",
|
|
11208
|
+
"alignLeft",
|
|
11209
|
+
"alignCenter",
|
|
11210
|
+
"alignRight",
|
|
11211
|
+
"heading1",
|
|
11212
|
+
"heading2",
|
|
11213
|
+
"undo",
|
|
11214
|
+
"redo",
|
|
11215
|
+
"link"
|
|
11216
|
+
];
|
|
11217
|
+
const buttonsToRender = showButtons && showButtons.length > 0 ? showButtons : defaultButtons;
|
|
11218
|
+
const renderToolbarButton = (id) => {
|
|
11219
|
+
switch (id) {
|
|
11220
|
+
case "bold":
|
|
11221
|
+
return renderButton(
|
|
11222
|
+
() => editor.chain().focus().toggleBold().run(),
|
|
11223
|
+
FormatBoldIcon__default.default,
|
|
11224
|
+
editor.isActive("bold"),
|
|
11225
|
+
"Bold"
|
|
11226
|
+
);
|
|
11227
|
+
case "italic":
|
|
11228
|
+
return renderButton(
|
|
11229
|
+
() => editor.chain().focus().toggleItalic().run(),
|
|
11230
|
+
FormatItalicIcon__default.default,
|
|
11231
|
+
editor.isActive("italic"),
|
|
11232
|
+
"Italic"
|
|
11233
|
+
);
|
|
11234
|
+
case "underline":
|
|
11235
|
+
return renderButton(
|
|
11236
|
+
() => editor.chain().focus().toggleUnderline().run(),
|
|
11237
|
+
FormatUnderlinedIcon__default.default,
|
|
11238
|
+
editor.isActive("underline"),
|
|
11239
|
+
"Underline"
|
|
11240
|
+
);
|
|
11241
|
+
case "strike":
|
|
11242
|
+
return renderButton(
|
|
11243
|
+
() => editor.chain().focus().toggleStrike().run(),
|
|
11244
|
+
StrikethroughSIcon__default.default,
|
|
11245
|
+
editor.isActive("strike"),
|
|
11246
|
+
"Strike"
|
|
11247
|
+
);
|
|
11248
|
+
case "bulletList":
|
|
11249
|
+
return renderButton(
|
|
11250
|
+
() => editor.chain().focus().toggleBulletList().run(),
|
|
11251
|
+
FormatListBulletedIcon__default.default,
|
|
11252
|
+
editor.isActive("bulletList"),
|
|
11253
|
+
"Bullet List"
|
|
11254
|
+
);
|
|
11255
|
+
case "orderedList":
|
|
11256
|
+
return renderButton(
|
|
11257
|
+
() => editor.chain().focus().toggleOrderedList().run(),
|
|
11258
|
+
FormatListNumberedIcon__default.default,
|
|
11259
|
+
editor.isActive("orderedList"),
|
|
11260
|
+
"Numbered List"
|
|
11261
|
+
);
|
|
11262
|
+
case "alignLeft":
|
|
11263
|
+
return renderButton(
|
|
11264
|
+
() => editor.chain().focus().setTextAlign("left").run(),
|
|
11265
|
+
FormatAlignLeftIcon__default.default,
|
|
11266
|
+
editor.isActive({ textAlign: "left" }),
|
|
11267
|
+
"Align Left"
|
|
11268
|
+
);
|
|
11269
|
+
case "alignCenter":
|
|
11270
|
+
return renderButton(
|
|
11271
|
+
() => editor.chain().focus().setTextAlign("center").run(),
|
|
11272
|
+
FormatAlignCenterIcon__default.default,
|
|
11273
|
+
editor.isActive({ textAlign: "center" }),
|
|
11274
|
+
"Align Center"
|
|
11275
|
+
);
|
|
11276
|
+
case "alignRight":
|
|
11277
|
+
return renderButton(
|
|
11278
|
+
() => editor.chain().focus().setTextAlign("right").run(),
|
|
11279
|
+
FormatAlignRightIcon__default.default,
|
|
11280
|
+
editor.isActive({ textAlign: "right" }),
|
|
11281
|
+
"Align Right"
|
|
11282
|
+
);
|
|
11283
|
+
case "heading1":
|
|
11284
|
+
return renderButton(
|
|
11285
|
+
() => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
11286
|
+
TitleIcon__default.default,
|
|
11287
|
+
editor.isActive("heading", { level: 1 }),
|
|
11288
|
+
"Heading 1"
|
|
11289
|
+
);
|
|
11290
|
+
case "heading2":
|
|
11291
|
+
return renderButton(
|
|
11292
|
+
() => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
11293
|
+
TitleIcon__default.default,
|
|
11294
|
+
editor.isActive("heading", { level: 2 }),
|
|
11295
|
+
"Heading 2"
|
|
11296
|
+
);
|
|
11297
|
+
case "undo":
|
|
11298
|
+
return renderButton(
|
|
11299
|
+
() => editor.chain().focus().undo().run(),
|
|
11300
|
+
UndoIcon__default.default,
|
|
11301
|
+
false,
|
|
11302
|
+
"Undo"
|
|
11303
|
+
);
|
|
11304
|
+
case "redo":
|
|
11305
|
+
return renderButton(
|
|
11306
|
+
() => editor.chain().focus().redo().run(),
|
|
11307
|
+
RedoIcon__default.default,
|
|
11308
|
+
false,
|
|
11309
|
+
"Redo"
|
|
11310
|
+
);
|
|
11311
|
+
case "link":
|
|
11312
|
+
return renderButton(openLinkDialog, UndoIcon__default.default, false, "Insert Link");
|
|
11313
|
+
default:
|
|
11314
|
+
return null;
|
|
11315
|
+
}
|
|
11316
|
+
};
|
|
11177
11317
|
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { width: "100%", ...sx }, children: [
|
|
11178
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11179
|
-
formik.ErrorMessage,
|
|
11180
|
-
{
|
|
11181
|
-
name,
|
|
11182
|
-
render: (msg) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11183
|
-
material.Typography,
|
|
11184
|
-
{
|
|
11185
|
-
variant: "caption",
|
|
11186
|
-
sx: [
|
|
11187
|
-
{
|
|
11188
|
-
color: "error.main",
|
|
11189
|
-
display: "block",
|
|
11190
|
-
mt: 0.5,
|
|
11191
|
-
...errorSx
|
|
11192
|
-
}
|
|
11193
|
-
],
|
|
11194
|
-
children: msg
|
|
11195
|
-
}
|
|
11196
|
-
)
|
|
11197
|
-
}
|
|
11198
|
-
),
|
|
11199
11318
|
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11200
11319
|
material.Typography,
|
|
11201
11320
|
{
|
|
11202
11321
|
variant: "button",
|
|
11203
|
-
sx:
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
...labelSx
|
|
11209
|
-
}
|
|
11210
|
-
],
|
|
11322
|
+
sx: {
|
|
11323
|
+
mb: 1,
|
|
11324
|
+
display: "block",
|
|
11325
|
+
...labelSx
|
|
11326
|
+
},
|
|
11211
11327
|
children: [
|
|
11212
11328
|
label,
|
|
11213
11329
|
required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
|
|
11214
11330
|
]
|
|
11215
11331
|
}
|
|
11216
11332
|
),
|
|
11217
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11333
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11218
11334
|
material.Box,
|
|
11219
11335
|
{
|
|
11220
11336
|
sx: {
|
|
@@ -11229,142 +11345,7 @@ var AppRichTextEditor = ({
|
|
|
11229
11345
|
borderColor: "divider",
|
|
11230
11346
|
...toolbarSx
|
|
11231
11347
|
},
|
|
11232
|
-
children:
|
|
11233
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11234
|
-
material.IconButton,
|
|
11235
|
-
{
|
|
11236
|
-
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
11237
|
-
color: editor.isActive("bold") ? "primary" : "default",
|
|
11238
|
-
sx: {
|
|
11239
|
-
...buttonSx,
|
|
11240
|
-
...editor.isActive("bold") ? activeButtonSx : {}
|
|
11241
|
-
},
|
|
11242
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatBoldIcon__default.default, {})
|
|
11243
|
-
}
|
|
11244
|
-
) }),
|
|
11245
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11246
|
-
material.IconButton,
|
|
11247
|
-
{
|
|
11248
|
-
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
11249
|
-
color: editor.isActive("italic") ? "primary" : "default",
|
|
11250
|
-
sx: {
|
|
11251
|
-
...buttonSx,
|
|
11252
|
-
...editor.isActive("italic") ? activeButtonSx : {}
|
|
11253
|
-
},
|
|
11254
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatItalicIcon__default.default, {})
|
|
11255
|
-
}
|
|
11256
|
-
) }),
|
|
11257
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11258
|
-
material.IconButton,
|
|
11259
|
-
{
|
|
11260
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
11261
|
-
color: editor.isActive("underline") ? "primary" : "default",
|
|
11262
|
-
sx: {
|
|
11263
|
-
...buttonSx,
|
|
11264
|
-
...editor.isActive("underline") ? activeButtonSx : {}
|
|
11265
|
-
},
|
|
11266
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatUnderlinedIcon__default.default, {})
|
|
11267
|
-
}
|
|
11268
|
-
) }),
|
|
11269
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Strike", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11270
|
-
material.IconButton,
|
|
11271
|
-
{
|
|
11272
|
-
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
11273
|
-
color: editor.isActive("strike") ? "primary" : "default",
|
|
11274
|
-
sx: {
|
|
11275
|
-
...buttonSx,
|
|
11276
|
-
...editor.isActive("strike") ? activeButtonSx : {}
|
|
11277
|
-
},
|
|
11278
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(StrikethroughSIcon__default.default, {})
|
|
11279
|
-
}
|
|
11280
|
-
) }),
|
|
11281
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11282
|
-
material.IconButton,
|
|
11283
|
-
{
|
|
11284
|
-
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
11285
|
-
color: editor.isActive("bulletList") ? "primary" : "default",
|
|
11286
|
-
sx: {
|
|
11287
|
-
...buttonSx,
|
|
11288
|
-
...editor.isActive("bulletList") ? activeButtonSx : {}
|
|
11289
|
-
},
|
|
11290
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatListBulletedIcon__default.default, {})
|
|
11291
|
-
}
|
|
11292
|
-
) }),
|
|
11293
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11294
|
-
material.IconButton,
|
|
11295
|
-
{
|
|
11296
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
11297
|
-
color: editor.isActive("orderedList") ? "primary" : "default",
|
|
11298
|
-
sx: {
|
|
11299
|
-
...buttonSx,
|
|
11300
|
-
...editor.isActive("orderedList") ? activeButtonSx : {}
|
|
11301
|
-
},
|
|
11302
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatListNumberedIcon__default.default, {})
|
|
11303
|
-
}
|
|
11304
|
-
) }),
|
|
11305
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11306
|
-
material.IconButton,
|
|
11307
|
-
{
|
|
11308
|
-
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
11309
|
-
color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
|
|
11310
|
-
sx: {
|
|
11311
|
-
...buttonSx,
|
|
11312
|
-
...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
|
|
11313
|
-
},
|
|
11314
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignLeftIcon__default.default, {})
|
|
11315
|
-
}
|
|
11316
|
-
) }),
|
|
11317
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11318
|
-
material.IconButton,
|
|
11319
|
-
{
|
|
11320
|
-
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
11321
|
-
color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
|
|
11322
|
-
sx: {
|
|
11323
|
-
...buttonSx,
|
|
11324
|
-
...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
|
|
11325
|
-
},
|
|
11326
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignCenterIcon__default.default, {})
|
|
11327
|
-
}
|
|
11328
|
-
) }),
|
|
11329
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11330
|
-
material.IconButton,
|
|
11331
|
-
{
|
|
11332
|
-
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
11333
|
-
color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
|
|
11334
|
-
sx: {
|
|
11335
|
-
...buttonSx,
|
|
11336
|
-
...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
|
|
11337
|
-
},
|
|
11338
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignRightIcon__default.default, {})
|
|
11339
|
-
}
|
|
11340
|
-
) }),
|
|
11341
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11342
|
-
material.IconButton,
|
|
11343
|
-
{
|
|
11344
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
11345
|
-
color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
|
|
11346
|
-
sx: {
|
|
11347
|
-
...buttonSx,
|
|
11348
|
-
...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
|
|
11349
|
-
},
|
|
11350
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "1rem" } })
|
|
11351
|
-
}
|
|
11352
|
-
) }),
|
|
11353
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11354
|
-
material.IconButton,
|
|
11355
|
-
{
|
|
11356
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
11357
|
-
color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
|
|
11358
|
-
sx: {
|
|
11359
|
-
...buttonSx,
|
|
11360
|
-
...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
|
|
11361
|
-
},
|
|
11362
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "0.85rem" } })
|
|
11363
|
-
}
|
|
11364
|
-
) }),
|
|
11365
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Undo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().undo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(UndoIcon__default.default, {}) }) }),
|
|
11366
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Redo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(RedoIcon__default.default, {}) }) })
|
|
11367
|
-
]
|
|
11348
|
+
children: buttonsToRender.map((btn) => renderToolbarButton(btn))
|
|
11368
11349
|
}
|
|
11369
11350
|
),
|
|
11370
11351
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11382,9 +11363,7 @@ var AppRichTextEditor = ({
|
|
|
11382
11363
|
"& .ProseMirror": {
|
|
11383
11364
|
outline: "none",
|
|
11384
11365
|
minHeight: 150,
|
|
11385
|
-
"& > * + *": {
|
|
11386
|
-
mt: 2
|
|
11387
|
-
},
|
|
11366
|
+
"& > * + *": { mt: 2 },
|
|
11388
11367
|
"& h1": {
|
|
11389
11368
|
fontSize: "2em",
|
|
11390
11369
|
fontWeight: "bold",
|
|
@@ -11397,20 +11376,12 @@ var AppRichTextEditor = ({
|
|
|
11397
11376
|
lineHeight: 1.3,
|
|
11398
11377
|
color: "text.primary"
|
|
11399
11378
|
},
|
|
11400
|
-
"& p": {
|
|
11401
|
-
|
|
11402
|
-
lineHeight: 1.6
|
|
11403
|
-
},
|
|
11404
|
-
"& ul, & ol": {
|
|
11405
|
-
pl: 3,
|
|
11406
|
-
color: "text.primary"
|
|
11407
|
-
},
|
|
11379
|
+
"& p": { color: "text.primary", lineHeight: 1.6 },
|
|
11380
|
+
"& ul, & ol": { pl: 3, color: "text.primary" },
|
|
11408
11381
|
"& a": {
|
|
11409
11382
|
color: "primary.main",
|
|
11410
11383
|
textDecoration: "none",
|
|
11411
|
-
"&:hover": {
|
|
11412
|
-
textDecoration: "underline"
|
|
11413
|
-
}
|
|
11384
|
+
"&:hover": { textDecoration: "underline" }
|
|
11414
11385
|
},
|
|
11415
11386
|
...contentSx
|
|
11416
11387
|
},
|
|
@@ -11447,19 +11418,6 @@ var AppRichTextEditor = ({
|
|
|
11447
11418
|
borderRadius: 1,
|
|
11448
11419
|
border: "1px solid",
|
|
11449
11420
|
borderColor: "divider",
|
|
11450
|
-
"& .MuiDialogTitle-root": {
|
|
11451
|
-
borderBottom: "1px solid",
|
|
11452
|
-
borderColor: "divider",
|
|
11453
|
-
p: 2
|
|
11454
|
-
},
|
|
11455
|
-
"& .MuiDialogContent-root": {
|
|
11456
|
-
p: 2
|
|
11457
|
-
},
|
|
11458
|
-
"& .MuiDialogActions-root": {
|
|
11459
|
-
p: 2,
|
|
11460
|
-
borderTop: "1px solid",
|
|
11461
|
-
borderColor: "divider"
|
|
11462
|
-
},
|
|
11463
11421
|
...dialogSx
|
|
11464
11422
|
}
|
|
11465
11423
|
},
|
|
@@ -11491,542 +11449,7 @@ var AppRichTextEditor = ({
|
|
|
11491
11449
|
] });
|
|
11492
11450
|
};
|
|
11493
11451
|
var AppRichTextEditor_default = AppRichTextEditor;
|
|
11494
|
-
var
|
|
11495
|
-
({
|
|
11496
|
-
name,
|
|
11497
|
-
label,
|
|
11498
|
-
multiple = true,
|
|
11499
|
-
options = [],
|
|
11500
|
-
setSearchQuery,
|
|
11501
|
-
required = false,
|
|
11502
|
-
variant = "outlined",
|
|
11503
|
-
disabled = false,
|
|
11504
|
-
readOnly = false,
|
|
11505
|
-
showHelperText = false,
|
|
11506
|
-
helperText,
|
|
11507
|
-
maxSelections,
|
|
11508
|
-
showSelectedCount = false,
|
|
11509
|
-
sx,
|
|
11510
|
-
formControlSx,
|
|
11511
|
-
labelSx,
|
|
11512
|
-
inputSx,
|
|
11513
|
-
textFieldSx,
|
|
11514
|
-
autocompleteSx,
|
|
11515
|
-
listboxSx,
|
|
11516
|
-
optionSx,
|
|
11517
|
-
chipSx,
|
|
11518
|
-
errorSx,
|
|
11519
|
-
helperTextSx,
|
|
11520
|
-
selectedCountSx,
|
|
11521
|
-
renderInput: externalRenderInput,
|
|
11522
|
-
renderOption: externalRenderOption,
|
|
11523
|
-
renderTags: externalRenderTags,
|
|
11524
|
-
renderGroup: externalRenderGroup,
|
|
11525
|
-
labelComponent: LabelComponent = material.InputLabel,
|
|
11526
|
-
inputComponent: InputComponent = "input",
|
|
11527
|
-
errorComponent: ErrorComponent = material.Typography,
|
|
11528
|
-
helperTextComponent: HelperTextComponent = material.FormHelperText,
|
|
11529
|
-
labelProps = {},
|
|
11530
|
-
inputProps = {},
|
|
11531
|
-
textFieldProps = {},
|
|
11532
|
-
autocompleteProps = {},
|
|
11533
|
-
checkboxProps = {},
|
|
11534
|
-
chipProps = {},
|
|
11535
|
-
errorProps = {},
|
|
11536
|
-
helperTextProps = {},
|
|
11537
|
-
className = "",
|
|
11538
|
-
formControlClassName = "",
|
|
11539
|
-
labelClassName = "",
|
|
11540
|
-
inputClassName = "",
|
|
11541
|
-
textFieldClassName = "",
|
|
11542
|
-
autocompleteClassName = "",
|
|
11543
|
-
listboxClassName = "",
|
|
11544
|
-
optionClassName = "",
|
|
11545
|
-
chipClassName = "",
|
|
11546
|
-
errorClassName = "",
|
|
11547
|
-
helperTextClassName = "",
|
|
11548
|
-
onInputChange: externalOnInputChange,
|
|
11549
|
-
onChange: externalOnChange,
|
|
11550
|
-
onOpen,
|
|
11551
|
-
onClose,
|
|
11552
|
-
onBlur: externalOnBlur,
|
|
11553
|
-
onFocus: externalOnFocus,
|
|
11554
|
-
onClear,
|
|
11555
|
-
onMaxSelectionsReached,
|
|
11556
|
-
onRemove,
|
|
11557
|
-
onAdd,
|
|
11558
|
-
...otherProps
|
|
11559
|
-
}, ref) => {
|
|
11560
|
-
material.useTheme();
|
|
11561
|
-
const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
|
|
11562
|
-
const fieldError = _19__default.default.get(errors, name);
|
|
11563
|
-
const isTouched = Boolean(_19__default.default.get(touched, name));
|
|
11564
|
-
const hasError = Boolean(fieldError) && isTouched;
|
|
11565
|
-
const val = _19__default.default.get(values, name);
|
|
11566
|
-
const selectedValues = Array.isArray(val) ? val : [];
|
|
11567
|
-
const selectedCount = selectedValues.length;
|
|
11568
|
-
const handleChange = (event, value, reason, details) => {
|
|
11569
|
-
const normalizedValue = (() => {
|
|
11570
|
-
if (value === null)
|
|
11571
|
-
return [];
|
|
11572
|
-
const arr = Array.isArray(value) ? value : [value];
|
|
11573
|
-
return arr.map(
|
|
11574
|
-
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
11575
|
-
);
|
|
11576
|
-
})();
|
|
11577
|
-
if (maxSelections && normalizedValue.length > maxSelections) {
|
|
11578
|
-
if (onMaxSelectionsReached) {
|
|
11579
|
-
onMaxSelectionsReached(maxSelections);
|
|
11580
|
-
}
|
|
11581
|
-
return;
|
|
11582
|
-
}
|
|
11583
|
-
if (reason === "selectOption" || reason === "removeOption") {
|
|
11584
|
-
const added = normalizedValue.filter(
|
|
11585
|
-
(item) => !selectedValues.some((v) => v.value === item.value)
|
|
11586
|
-
);
|
|
11587
|
-
const removed = selectedValues.filter(
|
|
11588
|
-
(item) => !normalizedValue.some((v) => v.value === item.value)
|
|
11589
|
-
);
|
|
11590
|
-
if (added.length > 0 && onAdd) {
|
|
11591
|
-
added.forEach((item) => onAdd(item));
|
|
11592
|
-
}
|
|
11593
|
-
if (removed.length > 0 && onRemove) {
|
|
11594
|
-
removed.forEach((item) => onRemove(item));
|
|
11595
|
-
}
|
|
11596
|
-
}
|
|
11597
|
-
setFieldValue(name, normalizedValue, true);
|
|
11598
|
-
if (externalOnChange) {
|
|
11599
|
-
externalOnChange(event, normalizedValue, reason);
|
|
11600
|
-
}
|
|
11601
|
-
};
|
|
11602
|
-
const handleInputChange = (event, value, reason) => {
|
|
11603
|
-
if (setSearchQuery) {
|
|
11604
|
-
setSearchQuery(value);
|
|
11605
|
-
}
|
|
11606
|
-
if (externalOnInputChange) {
|
|
11607
|
-
externalOnInputChange(event, value, reason);
|
|
11608
|
-
}
|
|
11609
|
-
};
|
|
11610
|
-
const handleBlur = (event) => {
|
|
11611
|
-
setFieldTouched(name, true, true);
|
|
11612
|
-
if (externalOnBlur) {
|
|
11613
|
-
externalOnBlur(event);
|
|
11614
|
-
}
|
|
11615
|
-
};
|
|
11616
|
-
const handleFocus = (event) => {
|
|
11617
|
-
if (externalOnFocus) {
|
|
11618
|
-
externalOnFocus(event);
|
|
11619
|
-
}
|
|
11620
|
-
};
|
|
11621
|
-
const filterOptions = (options2, { inputValue }) => {
|
|
11622
|
-
if (!inputValue)
|
|
11623
|
-
return options2;
|
|
11624
|
-
const inputValueLower = inputValue.toLowerCase();
|
|
11625
|
-
return options2.filter(
|
|
11626
|
-
(option) => {
|
|
11627
|
-
var _a, _b, _c, _d;
|
|
11628
|
-
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || String(option.value).toLowerCase().includes(inputValueLower) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValueLower)) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValueLower));
|
|
11629
|
-
}
|
|
11630
|
-
);
|
|
11631
|
-
};
|
|
11632
|
-
const defaultRenderInput = (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11633
|
-
material.TextField,
|
|
11634
|
-
{
|
|
11635
|
-
...params,
|
|
11636
|
-
variant,
|
|
11637
|
-
error: hasError,
|
|
11638
|
-
helperText: "",
|
|
11639
|
-
placeholder: "",
|
|
11640
|
-
inputRef: inputProps.ref,
|
|
11641
|
-
inputProps: {
|
|
11642
|
-
...params.inputProps,
|
|
11643
|
-
...inputProps,
|
|
11644
|
-
className: `${params.inputProps.className || ""} ${inputClassName}`.trim()
|
|
11645
|
-
},
|
|
11646
|
-
InputProps: {
|
|
11647
|
-
...params.InputProps,
|
|
11648
|
-
...textFieldProps.InputProps,
|
|
11649
|
-
className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
|
|
11650
|
-
},
|
|
11651
|
-
sx: [
|
|
11652
|
-
{
|
|
11653
|
-
"& .MuiOutlinedInput-root": {
|
|
11654
|
-
borderRadius: "8px",
|
|
11655
|
-
"& fieldset": {
|
|
11656
|
-
borderColor: hasError ? "error.main" : "divider"
|
|
11657
|
-
},
|
|
11658
|
-
"&:hover fieldset": {
|
|
11659
|
-
borderColor: hasError ? "error.main" : "text.primary"
|
|
11660
|
-
},
|
|
11661
|
-
"&.Mui-focused fieldset": {
|
|
11662
|
-
borderColor: hasError ? "error.main" : "primary.main"
|
|
11663
|
-
},
|
|
11664
|
-
"& .MuiInputLabel-root": {
|
|
11665
|
-
// Your label styles here
|
|
11666
|
-
}
|
|
11667
|
-
}
|
|
11668
|
-
},
|
|
11669
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
11670
|
-
],
|
|
11671
|
-
...textFieldProps
|
|
11672
|
-
}
|
|
11673
|
-
);
|
|
11674
|
-
const defaultRenderOption = (props, option, { selected }) => /* @__PURE__ */ React4.createElement(
|
|
11675
|
-
"li",
|
|
11676
|
-
{
|
|
11677
|
-
...props,
|
|
11678
|
-
key: option.value,
|
|
11679
|
-
className: `${props.className || ""} ${optionClassName}`.trim(),
|
|
11680
|
-
style: {
|
|
11681
|
-
...props.style,
|
|
11682
|
-
opacity: option.disabled ? 0.5 : 1,
|
|
11683
|
-
pointerEvents: option.disabled ? "none" : "auto"
|
|
11684
|
-
}
|
|
11685
|
-
},
|
|
11686
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11687
|
-
material.Checkbox,
|
|
11688
|
-
{
|
|
11689
|
-
checked: selected,
|
|
11690
|
-
disabled: option.disabled,
|
|
11691
|
-
sx: {
|
|
11692
|
-
color: "text.secondary",
|
|
11693
|
-
"&.Mui-checked": {
|
|
11694
|
-
color: "primary.main"
|
|
11695
|
-
},
|
|
11696
|
-
"&.Mui-disabled": {
|
|
11697
|
-
color: "text.disabled"
|
|
11698
|
-
},
|
|
11699
|
-
mr: 1,
|
|
11700
|
-
...checkboxProps.sx
|
|
11701
|
-
},
|
|
11702
|
-
...checkboxProps
|
|
11703
|
-
}
|
|
11704
|
-
),
|
|
11705
|
-
option.icon && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
11706
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11707
|
-
material.Typography,
|
|
11708
|
-
{
|
|
11709
|
-
variant: "body2",
|
|
11710
|
-
sx: [
|
|
11711
|
-
{
|
|
11712
|
-
color: option.disabled ? "text.disabled" : "text.primary",
|
|
11713
|
-
...option.textSx
|
|
11714
|
-
},
|
|
11715
|
-
...Array.isArray(optionSx) ? optionSx : [optionSx]
|
|
11716
|
-
],
|
|
11717
|
-
children: option.label
|
|
11718
|
-
}
|
|
11719
|
-
)
|
|
11720
|
-
);
|
|
11721
|
-
const defaultRenderTags = (value, getTagProps) => /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
|
|
11722
|
-
const { key, ...tagProps } = getTagProps({ index });
|
|
11723
|
-
return /* @__PURE__ */ React4.createElement(
|
|
11724
|
-
material.Chip,
|
|
11725
|
-
{
|
|
11726
|
-
...tagProps,
|
|
11727
|
-
key: option.value,
|
|
11728
|
-
label: option.label,
|
|
11729
|
-
disabled: disabled || option.disabled,
|
|
11730
|
-
sx: [
|
|
11731
|
-
{
|
|
11732
|
-
height: "24px",
|
|
11733
|
-
borderRadius: "4px",
|
|
11734
|
-
"& .MuiChip-deleteIcon": {
|
|
11735
|
-
color: "text.secondary",
|
|
11736
|
-
"&:hover": {
|
|
11737
|
-
color: "text.primary"
|
|
11738
|
-
}
|
|
11739
|
-
},
|
|
11740
|
-
...chipSx
|
|
11741
|
-
},
|
|
11742
|
-
...Array.isArray(chipSx) ? chipSx : [chipSx]
|
|
11743
|
-
],
|
|
11744
|
-
className: `${chipClassName} ${option.disabled ? "Mui-disabled" : ""}`.trim(),
|
|
11745
|
-
...chipProps
|
|
11746
|
-
}
|
|
11747
|
-
);
|
|
11748
|
-
}) });
|
|
11749
|
-
const renderSelectedCount = () => {
|
|
11750
|
-
if (!showSelectedCount || !multiple)
|
|
11751
|
-
return null;
|
|
11752
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11753
|
-
material.Typography,
|
|
11754
|
-
{
|
|
11755
|
-
variant: "caption",
|
|
11756
|
-
sx: [
|
|
11757
|
-
{
|
|
11758
|
-
mt: 0.5,
|
|
11759
|
-
color: "text.secondary",
|
|
11760
|
-
...selectedCountSx
|
|
11761
|
-
},
|
|
11762
|
-
...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
|
|
11763
|
-
],
|
|
11764
|
-
children: [
|
|
11765
|
-
`${selectedCount} selected`,
|
|
11766
|
-
maxSelections ? ` (max ${maxSelections})` : ""
|
|
11767
|
-
]
|
|
11768
|
-
}
|
|
11769
|
-
);
|
|
11770
|
-
};
|
|
11771
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11772
|
-
material.Box,
|
|
11773
|
-
{
|
|
11774
|
-
ref,
|
|
11775
|
-
className: `app-searchable-multi-selector ${className}`.trim(),
|
|
11776
|
-
sx: [
|
|
11777
|
-
{
|
|
11778
|
-
width: "100%"
|
|
11779
|
-
},
|
|
11780
|
-
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
11781
|
-
],
|
|
11782
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11783
|
-
material.FormControl,
|
|
11784
|
-
{
|
|
11785
|
-
fullWidth: true,
|
|
11786
|
-
error: hasError,
|
|
11787
|
-
disabled,
|
|
11788
|
-
className: `app-searchable-multi-selector-form-control ${formControlClassName}`.trim(),
|
|
11789
|
-
sx: [
|
|
11790
|
-
{
|
|
11791
|
-
"& .MuiAutocomplete-root": {
|
|
11792
|
-
"& .MuiOutlinedInput-root": {
|
|
11793
|
-
padding: "4px"
|
|
11794
|
-
},
|
|
11795
|
-
"& .MuiAutocomplete-input": {
|
|
11796
|
-
padding: "8.5px 4px"
|
|
11797
|
-
}
|
|
11798
|
-
}
|
|
11799
|
-
},
|
|
11800
|
-
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
11801
|
-
],
|
|
11802
|
-
children: [
|
|
11803
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11804
|
-
LabelComponent,
|
|
11805
|
-
{
|
|
11806
|
-
shrink: true,
|
|
11807
|
-
htmlFor: `autocomplete-${name}`,
|
|
11808
|
-
className: `app-searchable-multi-selector-label ${labelClassName}`.trim(),
|
|
11809
|
-
sx: [
|
|
11810
|
-
{
|
|
11811
|
-
mb: 1,
|
|
11812
|
-
color: hasError ? "error.main" : "text.primary",
|
|
11813
|
-
"&.Mui-focused": {
|
|
11814
|
-
color: hasError ? "error.main" : "primary.main"
|
|
11815
|
-
},
|
|
11816
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
11817
|
-
}
|
|
11818
|
-
],
|
|
11819
|
-
...labelProps,
|
|
11820
|
-
children: [
|
|
11821
|
-
label,
|
|
11822
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11823
|
-
material.Box,
|
|
11824
|
-
{
|
|
11825
|
-
component: "span",
|
|
11826
|
-
sx: {
|
|
11827
|
-
color: "error.main",
|
|
11828
|
-
ml: 0.5
|
|
11829
|
-
},
|
|
11830
|
-
children: "*"
|
|
11831
|
-
}
|
|
11832
|
-
)
|
|
11833
|
-
]
|
|
11834
|
-
}
|
|
11835
|
-
),
|
|
11836
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11837
|
-
material.Autocomplete,
|
|
11838
|
-
{
|
|
11839
|
-
multiple,
|
|
11840
|
-
id: `autocomplete-${name}`,
|
|
11841
|
-
options,
|
|
11842
|
-
value: selectedValues,
|
|
11843
|
-
filterOptions,
|
|
11844
|
-
onInputChange: handleInputChange,
|
|
11845
|
-
onChange: handleChange,
|
|
11846
|
-
onOpen,
|
|
11847
|
-
onClose,
|
|
11848
|
-
onBlur: handleBlur,
|
|
11849
|
-
onFocus: handleFocus,
|
|
11850
|
-
disableCloseOnSelect: multiple,
|
|
11851
|
-
readOnly,
|
|
11852
|
-
disabled,
|
|
11853
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
11854
|
-
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
11855
|
-
getOptionDisabled: (option) => !!option.disabled,
|
|
11856
|
-
renderInput: externalRenderInput || defaultRenderInput,
|
|
11857
|
-
renderOption: externalRenderOption || defaultRenderOption,
|
|
11858
|
-
renderTags: externalRenderTags || defaultRenderTags,
|
|
11859
|
-
renderGroup: externalRenderGroup,
|
|
11860
|
-
ListboxProps: {
|
|
11861
|
-
className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
|
|
11862
|
-
sx: {
|
|
11863
|
-
"& .MuiAutocomplete-option": {
|
|
11864
|
-
px: 2,
|
|
11865
|
-
py: 1,
|
|
11866
|
-
'&[aria-selected="true"]': {
|
|
11867
|
-
backgroundColor: "action.selected",
|
|
11868
|
-
"&.Mui-focused": {
|
|
11869
|
-
backgroundColor: "action.hover"
|
|
11870
|
-
}
|
|
11871
|
-
},
|
|
11872
|
-
"&.Mui-focused": {
|
|
11873
|
-
backgroundColor: "action.hover"
|
|
11874
|
-
}
|
|
11875
|
-
},
|
|
11876
|
-
...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
|
|
11877
|
-
...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
|
|
11878
|
-
}
|
|
11879
|
-
},
|
|
11880
|
-
className: `app-searchable-multi-selector-autocomplete ${autocompleteClassName}`.trim(),
|
|
11881
|
-
sx: [
|
|
11882
|
-
{
|
|
11883
|
-
"& .MuiAutocomplete-tag": {
|
|
11884
|
-
margin: 0,
|
|
11885
|
-
height: "auto"
|
|
11886
|
-
},
|
|
11887
|
-
"& .MuiAutocomplete-endAdornment": {
|
|
11888
|
-
right: 8
|
|
11889
|
-
}
|
|
11890
|
-
},
|
|
11891
|
-
...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
|
|
11892
|
-
],
|
|
11893
|
-
...autocompleteProps,
|
|
11894
|
-
...otherProps
|
|
11895
|
-
}
|
|
11896
|
-
),
|
|
11897
|
-
(showHelperText || hasError) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11898
|
-
HelperTextComponent,
|
|
11899
|
-
{
|
|
11900
|
-
error: hasError,
|
|
11901
|
-
sx: [
|
|
11902
|
-
{
|
|
11903
|
-
mx: 0,
|
|
11904
|
-
mt: 0.5,
|
|
11905
|
-
...hasError ? {
|
|
11906
|
-
color: "error.main",
|
|
11907
|
-
...errorSx
|
|
11908
|
-
} : {
|
|
11909
|
-
color: "text.secondary",
|
|
11910
|
-
...helperTextSx
|
|
11911
|
-
}
|
|
11912
|
-
}
|
|
11913
|
-
],
|
|
11914
|
-
className: `app-searchable-multi-selector-helper-text ${helperTextClassName} ${hasError ? "Mui-error" : ""}`.trim(),
|
|
11915
|
-
...helperTextProps,
|
|
11916
|
-
children: hasError ? fieldError : helperText
|
|
11917
|
-
}
|
|
11918
|
-
),
|
|
11919
|
-
renderSelectedCount()
|
|
11920
|
-
]
|
|
11921
|
-
}
|
|
11922
|
-
)
|
|
11923
|
-
}
|
|
11924
|
-
);
|
|
11925
|
-
}
|
|
11926
|
-
);
|
|
11927
|
-
AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
|
|
11928
|
-
var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
|
|
11929
|
-
function AppSearchableSelectInput({
|
|
11930
|
-
name,
|
|
11931
|
-
label,
|
|
11932
|
-
options = [],
|
|
11933
|
-
required = false,
|
|
11934
|
-
variant = "outlined",
|
|
11935
|
-
placeholder,
|
|
11936
|
-
setSearchQuery,
|
|
11937
|
-
isResetRequired,
|
|
11938
|
-
...otherProps
|
|
11939
|
-
}) {
|
|
11940
|
-
const { errors, touched, setFieldValue, values } = formik.useFormikContext();
|
|
11941
|
-
const fieldError = _19__default.default.get(errors, name);
|
|
11942
|
-
const isTouched = _19__default.default.get(touched, name);
|
|
11943
|
-
const val = _19__default.default.get(values, name);
|
|
11944
|
-
const selectedOption = options.find((option) => option.value === val) || null;
|
|
11945
|
-
const handleChange = (event, newValue) => {
|
|
11946
|
-
setFieldValue(name, newValue ? newValue.value : "");
|
|
11947
|
-
};
|
|
11948
|
-
const handleSearchChange = (event) => {
|
|
11949
|
-
const { value } = event.target;
|
|
11950
|
-
if (setSearchQuery) {
|
|
11951
|
-
setSearchQuery(value);
|
|
11952
|
-
}
|
|
11953
|
-
};
|
|
11954
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11955
|
-
material.FormControl,
|
|
11956
|
-
{
|
|
11957
|
-
fullWidth: true,
|
|
11958
|
-
variant,
|
|
11959
|
-
error: isTouched && Boolean(fieldError),
|
|
11960
|
-
sx: {
|
|
11961
|
-
padding: "0px !important",
|
|
11962
|
-
".MuiAutocomplete-endAdornment": { right: "0 !important" },
|
|
11963
|
-
".MuiInputBase-root": {
|
|
11964
|
-
padding: "0px !important",
|
|
11965
|
-
pr: "39px !important",
|
|
11966
|
-
pl: "10px !important"
|
|
11967
|
-
},
|
|
11968
|
-
".MuiOutlinedInput-root": {
|
|
11969
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
11970
|
-
}
|
|
11971
|
-
},
|
|
11972
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11973
|
-
material.Autocomplete,
|
|
11974
|
-
{
|
|
11975
|
-
options,
|
|
11976
|
-
getOptionLabel: (option) => option.label || String(option.value),
|
|
11977
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
11978
|
-
value: selectedOption,
|
|
11979
|
-
onChange: handleChange,
|
|
11980
|
-
filterOptions: (options2, { inputValue }) => {
|
|
11981
|
-
return options2.filter(
|
|
11982
|
-
(option) => {
|
|
11983
|
-
var _a, _b, _c, _d;
|
|
11984
|
-
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValue.toLowerCase())) || String(option.value).toLowerCase().includes(inputValue.toLowerCase()) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValue.toLowerCase())) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValue.toLowerCase())) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValue.toLowerCase()));
|
|
11985
|
-
}
|
|
11986
|
-
);
|
|
11987
|
-
},
|
|
11988
|
-
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11989
|
-
material.TextField,
|
|
11990
|
-
{
|
|
11991
|
-
...params,
|
|
11992
|
-
onChange: handleSearchChange,
|
|
11993
|
-
label: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11994
|
-
label,
|
|
11995
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { color: "red" }, component: "span", children: " *" })
|
|
11996
|
-
] }),
|
|
11997
|
-
variant,
|
|
11998
|
-
placeholder,
|
|
11999
|
-
error: Boolean(fieldError) && isTouched,
|
|
12000
|
-
helperText: isTouched && fieldError ? fieldError : "",
|
|
12001
|
-
FormHelperTextProps: {
|
|
12002
|
-
sx: { color: "#FF5630" }
|
|
12003
|
-
},
|
|
12004
|
-
sx: {
|
|
12005
|
-
"& .MuiInputLabel-root": {
|
|
12006
|
-
color: "text.primary"
|
|
12007
|
-
},
|
|
12008
|
-
"& .MuiInputLabel-root.Mui-focused": {
|
|
12009
|
-
color: "text.primary"
|
|
12010
|
-
},
|
|
12011
|
-
"& .MuiOutlinedInput-input": {
|
|
12012
|
-
color: "common.black"
|
|
12013
|
-
},
|
|
12014
|
-
"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
12015
|
-
borderColor: "common.white"
|
|
12016
|
-
},
|
|
12017
|
-
"& .MuiSvgIcon-root": {
|
|
12018
|
-
color: "common.black"
|
|
12019
|
-
}
|
|
12020
|
-
}
|
|
12021
|
-
}
|
|
12022
|
-
),
|
|
12023
|
-
...otherProps
|
|
12024
|
-
}
|
|
12025
|
-
)
|
|
12026
|
-
}
|
|
12027
|
-
);
|
|
12028
|
-
}
|
|
12029
|
-
var AppSelectInput = React4.forwardRef(
|
|
11452
|
+
var AppSelectInput = React3.forwardRef(
|
|
12030
11453
|
({
|
|
12031
11454
|
name,
|
|
12032
11455
|
label,
|
|
@@ -12049,10 +11472,10 @@ var AppSelectInput = React4.forwardRef(
|
|
|
12049
11472
|
}, ref) => {
|
|
12050
11473
|
const theme = material.useTheme();
|
|
12051
11474
|
const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
|
|
12052
|
-
const fieldError =
|
|
12053
|
-
const isTouched = Boolean(
|
|
11475
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
11476
|
+
const isTouched = Boolean(_17__default.default.get(touched, name));
|
|
12054
11477
|
const hasError = Boolean(fieldError) && isTouched;
|
|
12055
|
-
const currentValue =
|
|
11478
|
+
const currentValue = _17__default.default.get(values, name);
|
|
12056
11479
|
const handleValueChange = (newValue) => {
|
|
12057
11480
|
setFieldValue(name, newValue, true);
|
|
12058
11481
|
if (externalOnChange) {
|
|
@@ -12064,7 +11487,7 @@ var AppSelectInput = React4.forwardRef(
|
|
|
12064
11487
|
};
|
|
12065
11488
|
const selectedOption = options.find((opt) => opt.value === currentValue) || null;
|
|
12066
11489
|
if (mode === "autocomplete") {
|
|
12067
|
-
const debouncedSearch =
|
|
11490
|
+
const debouncedSearch = React3__default.default.useRef();
|
|
12068
11491
|
const handleSearchChange = (query) => {
|
|
12069
11492
|
if (debouncedSearch.current) {
|
|
12070
11493
|
clearTimeout(debouncedSearch.current);
|
|
@@ -12080,10 +11503,7 @@ var AppSelectInput = React4.forwardRef(
|
|
|
12080
11503
|
return options2;
|
|
12081
11504
|
const inputValueLower = inputValue.toLowerCase();
|
|
12082
11505
|
return options2.filter(
|
|
12083
|
-
(option) =>
|
|
12084
|
-
var _a, _b, _c;
|
|
12085
|
-
return option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower) || ((_a = option.searchAbleValue1) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || ((_b = option.searchAbleValue2) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option.searchAbleValue3) == null ? void 0 : _c.toLowerCase().includes(inputValueLower));
|
|
12086
|
-
}
|
|
11506
|
+
(option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
|
|
12087
11507
|
);
|
|
12088
11508
|
};
|
|
12089
11509
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { ref, sx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12139,20 +11559,23 @@ var AppSelectInput = React4.forwardRef(
|
|
|
12139
11559
|
}
|
|
12140
11560
|
}
|
|
12141
11561
|
),
|
|
12142
|
-
renderOption: (props, option) =>
|
|
12143
|
-
|
|
12144
|
-
/* @__PURE__ */ jsxRuntime.
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
11562
|
+
renderOption: (props, option) => {
|
|
11563
|
+
const { key, ...restProps } = props;
|
|
11564
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { ...restProps, children: [
|
|
11565
|
+
option.icon,
|
|
11566
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11567
|
+
material.Typography,
|
|
11568
|
+
{
|
|
11569
|
+
variant: "body2",
|
|
11570
|
+
sx: {
|
|
11571
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
11572
|
+
...option.textSx
|
|
11573
|
+
},
|
|
11574
|
+
children: option.label
|
|
11575
|
+
}
|
|
11576
|
+
)
|
|
11577
|
+
] }, key);
|
|
11578
|
+
}
|
|
12156
11579
|
}
|
|
12157
11580
|
)
|
|
12158
11581
|
}
|
|
@@ -12251,7 +11674,7 @@ var AppSelectInput_default = AppSelectInput;
|
|
|
12251
11674
|
var AppSimpleUploadFile = ({
|
|
12252
11675
|
name,
|
|
12253
11676
|
label = "Upload Files",
|
|
12254
|
-
accept = "
|
|
11677
|
+
accept = "",
|
|
12255
11678
|
multiple = false,
|
|
12256
11679
|
disabled = false,
|
|
12257
11680
|
required = false,
|
|
@@ -12266,8 +11689,8 @@ var AppSimpleUploadFile = ({
|
|
|
12266
11689
|
onError
|
|
12267
11690
|
}) => {
|
|
12268
11691
|
const { setFieldValue, values, errors, touched } = formik.useFormikContext();
|
|
12269
|
-
const fieldValue =
|
|
12270
|
-
const fieldError =
|
|
11692
|
+
const fieldValue = _17__default.default.get(values, name);
|
|
11693
|
+
const fieldError = _17__default.default.get(touched, name) ? _17__default.default.get(errors, name) : void 0;
|
|
12271
11694
|
const handleChange = (event) => {
|
|
12272
11695
|
const files = event.target.files;
|
|
12273
11696
|
if (!files || files.length === 0)
|
|
@@ -12294,7 +11717,7 @@ var AppSimpleUploadFile = ({
|
|
|
12294
11717
|
if (!fieldValue || index < 0 || index >= fieldValue.length)
|
|
12295
11718
|
return;
|
|
12296
11719
|
const fileToRemove = fieldValue[index];
|
|
12297
|
-
const newFiles = fieldValue.filter((
|
|
11720
|
+
const newFiles = fieldValue.filter((_18, i) => i !== index);
|
|
12298
11721
|
setFieldValue(name, newFiles);
|
|
12299
11722
|
onRemove == null ? void 0 : onRemove(fileToRemove);
|
|
12300
11723
|
if (fileToRemove.preview) {
|
|
@@ -12661,7 +12084,7 @@ function getRatio(ratio = "1/1") {
|
|
|
12661
12084
|
}[ratio];
|
|
12662
12085
|
}
|
|
12663
12086
|
var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
|
|
12664
|
-
var Image =
|
|
12087
|
+
var Image = React3.forwardRef(
|
|
12665
12088
|
({
|
|
12666
12089
|
ratio,
|
|
12667
12090
|
disabledEffect = false,
|
|
@@ -12839,8 +12262,8 @@ function MultiFilePreview({
|
|
|
12839
12262
|
if ((files == null ? void 0 : files.length) == null) {
|
|
12840
12263
|
return null;
|
|
12841
12264
|
}
|
|
12842
|
-
const [anchorEl, setAnchorEl] =
|
|
12843
|
-
const [selectedFile, setSelectedFile] =
|
|
12265
|
+
const [anchorEl, setAnchorEl] = React3.useState(null);
|
|
12266
|
+
const [selectedFile, setSelectedFile] = React3.useState(null);
|
|
12844
12267
|
const canViewPrivate = true;
|
|
12845
12268
|
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: files.map((file) => {
|
|
12846
12269
|
const typedFile = file;
|
|
@@ -13121,7 +12544,7 @@ function BackgroundIllustration() {
|
|
|
13121
12544
|
)
|
|
13122
12545
|
] });
|
|
13123
12546
|
}
|
|
13124
|
-
var BackgroundIllustration_default =
|
|
12547
|
+
var BackgroundIllustration_default = React3.memo(BackgroundIllustration);
|
|
13125
12548
|
function UploadIllustration({ ...other }) {
|
|
13126
12549
|
const theme = styles.useTheme();
|
|
13127
12550
|
const PRIMARY_MAIN = theme.palette.primary.main;
|
|
@@ -13675,7 +13098,7 @@ function UploadIllustration({ ...other }) {
|
|
|
13675
13098
|
)
|
|
13676
13099
|
] }) });
|
|
13677
13100
|
}
|
|
13678
|
-
var UploadIllustration_default =
|
|
13101
|
+
var UploadIllustration_default = React3.memo(UploadIllustration);
|
|
13679
13102
|
var StyledDropZone = styles.styled("div")(({ theme }) => ({
|
|
13680
13103
|
outline: "none",
|
|
13681
13104
|
cursor: "pointer",
|
|
@@ -13846,12 +13269,12 @@ function Placeholder({ sx, ...other }) {
|
|
|
13846
13269
|
var AppUploadFile = ({ name, ...rest }) => {
|
|
13847
13270
|
var _a, _b, _c;
|
|
13848
13271
|
const { errors, touched, setFieldValue, values } = formik.useFormikContext();
|
|
13849
|
-
const fieldError =
|
|
13850
|
-
const isTouched =
|
|
13851
|
-
let val =
|
|
13272
|
+
const fieldError = _17__default.default.get(errors, name);
|
|
13273
|
+
const isTouched = _17__default.default.get(touched, name);
|
|
13274
|
+
let val = _17__default.default.get(values, name);
|
|
13852
13275
|
if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
|
|
13853
13276
|
val = val ? [val] : [];
|
|
13854
|
-
} else if (!((_b = rest.multiple) != null ? _b : false) &&
|
|
13277
|
+
} else if (!((_b = rest.multiple) != null ? _b : false) && _17__default.default.isArray(val)) {
|
|
13855
13278
|
val = val[0];
|
|
13856
13279
|
}
|
|
13857
13280
|
((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
|
|
@@ -13953,7 +13376,7 @@ var SubmitButton = ({
|
|
|
13953
13376
|
...rest
|
|
13954
13377
|
}) => {
|
|
13955
13378
|
const { submitForm, isSubmitting } = formik.useFormikContext();
|
|
13956
|
-
const [isLoading, setIsLoading] =
|
|
13379
|
+
const [isLoading, setIsLoading] = React3.useState(false);
|
|
13957
13380
|
const handleClick = async () => {
|
|
13958
13381
|
try {
|
|
13959
13382
|
setIsLoading(true);
|
|
@@ -14020,8 +13443,6 @@ exports.AppPhoneNoInput = AppPhoneNoInput_default;
|
|
|
14020
13443
|
exports.AppRadioGroup = AppRadioGroup_default;
|
|
14021
13444
|
exports.AppRating = AppRating_default;
|
|
14022
13445
|
exports.AppRichTextEditor = AppRichTextEditor_default;
|
|
14023
|
-
exports.AppSearchableMultiSelector = AppSearchableMultiSelector_default;
|
|
14024
|
-
exports.AppSearchableSelectInput = AppSearchableSelectInput;
|
|
14025
13446
|
exports.AppSelectInput = AppSelectInput_default;
|
|
14026
13447
|
exports.AppSimpleUploadFile = AppSimpleUploadFile_default;
|
|
14027
13448
|
exports.AppSwitch = AppSwitch;
|