formik-form-components 0.2.29 → 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/dist/index.d.ts +49 -75
- package/dist/index.js +529 -571
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +507 -547
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
|
|
2
|
-
import
|
|
3
|
-
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, Autocomplete, Checkbox, Chip, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Switch, InputAdornment, IconButton,
|
|
2
|
+
import React3, { forwardRef, createElement, memo, useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, Autocomplete, Checkbox, Chip, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Switch, InputAdornment, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Tooltip, Paper, Menu } 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';
|
|
@@ -8,8 +8,6 @@ import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
|
|
|
8
8
|
import _17, { get } from 'lodash';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
11
|
-
import Autocomplete3 from '@mui/material/Autocomplete';
|
|
12
|
-
import Typography9 from '@mui/material/Typography';
|
|
13
11
|
import { Icon } from '@iconify/react';
|
|
14
12
|
import PhoneInput from 'react-phone-number-input';
|
|
15
13
|
import 'react-phone-number-input/style.css';
|
|
@@ -43,12 +41,13 @@ var AppDatePicker = forwardRef(
|
|
|
43
41
|
name,
|
|
44
42
|
label,
|
|
45
43
|
disabled = false,
|
|
44
|
+
disablePast = false,
|
|
46
45
|
format = "DD/MM/YYYY",
|
|
47
46
|
sx,
|
|
48
47
|
textFieldSx,
|
|
49
48
|
...otherProps
|
|
50
49
|
}, ref) => {
|
|
51
|
-
const { values, setFieldValue, touched, errors
|
|
50
|
+
const { values, setFieldValue, touched, errors } = useFormikContext();
|
|
52
51
|
const fieldValue = _17.get(values, name);
|
|
53
52
|
const fieldError = _17.get(errors, name);
|
|
54
53
|
const isTouched = _17.get(touched, name);
|
|
@@ -61,10 +60,10 @@ var AppDatePicker = forwardRef(
|
|
|
61
60
|
label,
|
|
62
61
|
value: fieldValue,
|
|
63
62
|
onChange: handleChange,
|
|
64
|
-
format,
|
|
65
63
|
disabled,
|
|
64
|
+
disablePast,
|
|
66
65
|
slots: {
|
|
67
|
-
openPickerIcon: CalendarMonthIcon
|
|
66
|
+
openPickerIcon: () => /* @__PURE__ */ jsx(CalendarMonthIcon, {})
|
|
68
67
|
},
|
|
69
68
|
slotProps: {
|
|
70
69
|
textField: {
|
|
@@ -72,7 +71,8 @@ var AppDatePicker = forwardRef(
|
|
|
72
71
|
fullWidth: true,
|
|
73
72
|
error: isTouched && Boolean(fieldError),
|
|
74
73
|
helperText: isTouched && fieldError ? fieldError : void 0,
|
|
75
|
-
sx: textFieldSx
|
|
74
|
+
sx: textFieldSx,
|
|
75
|
+
inputFormat: format
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
...otherProps
|
|
@@ -292,20 +292,25 @@ function AppFormErrorMessage({
|
|
|
292
292
|
return showError ? /* @__PURE__ */ jsx(
|
|
293
293
|
Box,
|
|
294
294
|
{
|
|
295
|
-
sx: [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
sx: [
|
|
296
|
+
{
|
|
297
|
+
mt: 0.5,
|
|
298
|
+
...containerSx
|
|
299
|
+
},
|
|
300
|
+
sx
|
|
301
|
+
],
|
|
299
302
|
children: /* @__PURE__ */ jsx(
|
|
300
303
|
Typography,
|
|
301
304
|
{
|
|
302
305
|
variant: "caption",
|
|
303
306
|
color: "error",
|
|
304
|
-
sx: [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
sx: [
|
|
308
|
+
{
|
|
309
|
+
fontSize: "0.75rem",
|
|
310
|
+
display: "block",
|
|
311
|
+
...textSx
|
|
312
|
+
}
|
|
313
|
+
],
|
|
309
314
|
children: fieldError
|
|
310
315
|
}
|
|
311
316
|
)
|
|
@@ -316,20 +321,25 @@ function AppFormErrorMessage({
|
|
|
316
321
|
return /* @__PURE__ */ jsx(
|
|
317
322
|
Box,
|
|
318
323
|
{
|
|
319
|
-
sx: [
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
324
|
+
sx: [
|
|
325
|
+
{
|
|
326
|
+
mt: 0.5,
|
|
327
|
+
...containerSx
|
|
328
|
+
},
|
|
329
|
+
sx
|
|
330
|
+
],
|
|
323
331
|
children: /* @__PURE__ */ jsx(
|
|
324
332
|
Typography,
|
|
325
333
|
{
|
|
326
334
|
variant: "caption",
|
|
327
335
|
color: "error",
|
|
328
|
-
sx: [
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
336
|
+
sx: [
|
|
337
|
+
{
|
|
338
|
+
fontSize: "0.75rem",
|
|
339
|
+
display: "block",
|
|
340
|
+
...textSx
|
|
341
|
+
}
|
|
342
|
+
],
|
|
333
343
|
children: fieldError
|
|
334
344
|
}
|
|
335
345
|
)
|
|
@@ -913,64 +923,88 @@ function AppAutoComplete({
|
|
|
913
923
|
] });
|
|
914
924
|
}
|
|
915
925
|
function AppAutoCompleter({
|
|
916
|
-
placeholder,
|
|
917
926
|
name,
|
|
918
927
|
label,
|
|
928
|
+
placeholder,
|
|
919
929
|
options,
|
|
920
|
-
|
|
930
|
+
multiple = false,
|
|
931
|
+
freeSolo = false,
|
|
921
932
|
sx,
|
|
922
933
|
formControlSx,
|
|
923
934
|
textFieldSx,
|
|
924
|
-
|
|
925
|
-
errorSx
|
|
935
|
+
chipSx,
|
|
936
|
+
errorSx,
|
|
937
|
+
...rest
|
|
926
938
|
}) {
|
|
927
939
|
const { errors, touched, values, setFieldValue } = useFormikContext();
|
|
928
940
|
const fieldError = _17.get(errors, name);
|
|
929
941
|
const isTouched = _17.get(touched, name);
|
|
930
|
-
const
|
|
931
|
-
const
|
|
932
|
-
|
|
942
|
+
const formikValue = _17.get(values, name);
|
|
943
|
+
const isObjectOption = typeof options[0] === "object";
|
|
944
|
+
const resolvedValue = React3.useMemo(() => {
|
|
945
|
+
var _a;
|
|
946
|
+
if (!isObjectOption)
|
|
947
|
+
return formikValue != null ? formikValue : multiple ? [] : null;
|
|
948
|
+
if (multiple) {
|
|
949
|
+
return options.filter(
|
|
950
|
+
(opt) => (formikValue != null ? formikValue : []).includes(opt.value)
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
return (_a = options.find((opt) => opt.value === formikValue)) != null ? _a : null;
|
|
954
|
+
}, [formikValue, options, multiple, isObjectOption]);
|
|
955
|
+
const handleChange = (event, newValue, reason) => {
|
|
956
|
+
var _a, _b;
|
|
957
|
+
if (!isObjectOption) {
|
|
958
|
+
setFieldValue(name, newValue);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
if (multiple) {
|
|
962
|
+
setFieldValue(
|
|
963
|
+
name,
|
|
964
|
+
(_a = newValue == null ? void 0 : newValue.map((v) => v.value)) != null ? _a : []
|
|
965
|
+
);
|
|
966
|
+
} else {
|
|
967
|
+
setFieldValue(name, (_b = newValue == null ? void 0 : newValue.value) != null ? _b : null);
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, sx: formControlSx, children: [
|
|
933
971
|
/* @__PURE__ */ jsx(
|
|
934
|
-
|
|
972
|
+
Autocomplete,
|
|
935
973
|
{
|
|
936
|
-
|
|
974
|
+
multiple,
|
|
975
|
+
freeSolo,
|
|
937
976
|
options,
|
|
938
|
-
value:
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
977
|
+
value: resolvedValue,
|
|
978
|
+
onChange: handleChange,
|
|
979
|
+
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
980
|
+
isOptionEqualToValue: (option, value) => typeof option === "string" || typeof value === "string" ? option === value : option.value === value.value,
|
|
981
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
982
|
+
const tagProps = getTagProps({ index });
|
|
983
|
+
return /* @__PURE__ */ jsx(
|
|
984
|
+
Chip,
|
|
985
|
+
{
|
|
986
|
+
...tagProps,
|
|
987
|
+
label: typeof option === "string" ? option : option.label,
|
|
988
|
+
sx: chipSx
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
}),
|
|
946
992
|
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
947
993
|
TextField,
|
|
948
994
|
{
|
|
949
995
|
...params,
|
|
950
996
|
label,
|
|
951
997
|
placeholder,
|
|
952
|
-
error: Boolean(fieldError
|
|
998
|
+
error: Boolean(fieldError && isTouched),
|
|
953
999
|
helperText: isTouched && fieldError,
|
|
954
1000
|
sx: textFieldSx
|
|
955
1001
|
}
|
|
956
1002
|
),
|
|
957
|
-
|
|
958
|
-
|
|
1003
|
+
sx,
|
|
1004
|
+
...rest
|
|
959
1005
|
}
|
|
960
1006
|
),
|
|
961
|
-
fieldError
|
|
962
|
-
Typography,
|
|
963
|
-
{
|
|
964
|
-
variant: "caption",
|
|
965
|
-
display: "block",
|
|
966
|
-
gutterBottom: true,
|
|
967
|
-
sx: {
|
|
968
|
-
color: "#FF5630",
|
|
969
|
-
...errorSx
|
|
970
|
-
},
|
|
971
|
-
children: fieldError
|
|
972
|
-
}
|
|
973
|
-
)
|
|
1007
|
+
fieldError && isTouched && /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { color: "#FF5630", ...errorSx }, children: fieldError })
|
|
974
1008
|
] });
|
|
975
1009
|
}
|
|
976
1010
|
var AppCheckBox = ({
|
|
@@ -987,19 +1021,17 @@ var AppCheckBox = ({
|
|
|
987
1021
|
containerSx,
|
|
988
1022
|
iconSx,
|
|
989
1023
|
checkedSx,
|
|
990
|
-
|
|
1024
|
+
checkboxProps
|
|
991
1025
|
}) => {
|
|
992
1026
|
const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
|
|
993
1027
|
const fieldError = _17.get(errors, name);
|
|
994
1028
|
const isTouched = _17.get(touched, name);
|
|
995
|
-
useTheme();
|
|
996
1029
|
const value = getFieldProps(name).value;
|
|
997
|
-
const checkedValues = (() => {
|
|
998
|
-
if (Array.isArray(value))
|
|
1030
|
+
const checkedValues = React3.useMemo(() => {
|
|
1031
|
+
if (Array.isArray(value))
|
|
999
1032
|
return value.map(String);
|
|
1000
|
-
}
|
|
1001
1033
|
return value ? [String(value)] : [];
|
|
1002
|
-
})
|
|
1034
|
+
}, [value]);
|
|
1003
1035
|
const handleChange = (itemValue, isChecked) => {
|
|
1004
1036
|
if (option.length === 1) {
|
|
1005
1037
|
setFieldValue(name, isChecked ? itemValue : false);
|
|
@@ -1011,119 +1043,109 @@ var AppCheckBox = ({
|
|
|
1011
1043
|
return /* @__PURE__ */ jsxs(
|
|
1012
1044
|
Box,
|
|
1013
1045
|
{
|
|
1014
|
-
sx: [
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
opacity: 0.7,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1046
|
+
sx: [
|
|
1047
|
+
{
|
|
1048
|
+
width: "100%",
|
|
1049
|
+
...disabled && { opacity: 0.7, pointerEvents: "none" }
|
|
1050
|
+
},
|
|
1051
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
1052
|
+
],
|
|
1021
1053
|
children: [
|
|
1022
1054
|
label && /* @__PURE__ */ jsx(
|
|
1023
|
-
|
|
1055
|
+
Typography,
|
|
1024
1056
|
{
|
|
1025
1057
|
variant: "subtitle2",
|
|
1026
1058
|
gutterBottom: true,
|
|
1027
|
-
sx: [
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
content: '" *"',
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1059
|
+
sx: [
|
|
1060
|
+
{
|
|
1061
|
+
color: "text.primary",
|
|
1062
|
+
fontWeight: "medium",
|
|
1063
|
+
...required && {
|
|
1064
|
+
"&:after": { content: '" *"', color: "error.main" }
|
|
1065
|
+
},
|
|
1066
|
+
...disabled && { color: "text.disabled" }
|
|
1035
1067
|
},
|
|
1036
|
-
...
|
|
1037
|
-
|
|
1038
|
-
}
|
|
1039
|
-
}, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
|
|
1068
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
1069
|
+
],
|
|
1040
1070
|
children: label
|
|
1041
1071
|
}
|
|
1042
1072
|
),
|
|
1043
1073
|
/* @__PURE__ */ jsx(
|
|
1044
1074
|
Box,
|
|
1045
1075
|
{
|
|
1046
|
-
sx: [
|
|
1047
|
-
display: "flex",
|
|
1048
|
-
flexDirection: row ? "row" : "column",
|
|
1049
|
-
flexWrap: row ? "wrap" : "nowrap",
|
|
1050
|
-
gap: 2,
|
|
1051
|
-
...row ? {
|
|
1052
|
-
"& > *": {
|
|
1053
|
-
minWidth: "fit-content"
|
|
1054
|
-
}
|
|
1055
|
-
} : {}
|
|
1056
|
-
}, ...Array.isArray(containerSx) ? containerSx : [containerSx]],
|
|
1057
|
-
children: option.map((item) => /* @__PURE__ */ jsxs(
|
|
1058
|
-
Box,
|
|
1076
|
+
sx: [
|
|
1059
1077
|
{
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
"&:hover": {
|
|
1066
|
-
backgroundColor: !disabled ? "action.hover" : "transparent"
|
|
1067
|
-
},
|
|
1068
|
-
px: 2,
|
|
1069
|
-
py: 1,
|
|
1070
|
-
...disabled && {
|
|
1071
|
-
color: "text.disabled"
|
|
1072
|
-
}
|
|
1073
|
-
}],
|
|
1074
|
-
children: [
|
|
1075
|
-
/* @__PURE__ */ jsx(
|
|
1076
|
-
Checkbox,
|
|
1077
|
-
{
|
|
1078
|
-
name: `${name}.${item.name}`,
|
|
1079
|
-
checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
|
|
1080
|
-
onChange: (e) => handleChange(item.value, e.target.checked),
|
|
1081
|
-
disabled: disabled || item.disabled,
|
|
1082
|
-
sx: [{
|
|
1083
|
-
color: "primary.main",
|
|
1084
|
-
"&.Mui-checked": {
|
|
1085
|
-
color: "primary.main",
|
|
1086
|
-
...checkedSx
|
|
1087
|
-
},
|
|
1088
|
-
"& .MuiSvgIcon-root": {
|
|
1089
|
-
fontSize: 24,
|
|
1090
|
-
...iconSx
|
|
1091
|
-
},
|
|
1092
|
-
"&.Mui-disabled": {
|
|
1093
|
-
color: "action.disabled"
|
|
1094
|
-
}
|
|
1095
|
-
}, ...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]],
|
|
1096
|
-
...rest
|
|
1097
|
-
}
|
|
1098
|
-
),
|
|
1099
|
-
/* @__PURE__ */ jsx(
|
|
1100
|
-
Typography9,
|
|
1101
|
-
{
|
|
1102
|
-
variant: "body2",
|
|
1103
|
-
sx: [{
|
|
1104
|
-
color: disabled ? "text.disabled" : "text.primary",
|
|
1105
|
-
...disabled && {
|
|
1106
|
-
color: "text.disabled"
|
|
1107
|
-
}
|
|
1108
|
-
}, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
|
|
1109
|
-
children: item.label
|
|
1110
|
-
}
|
|
1111
|
-
)
|
|
1112
|
-
]
|
|
1078
|
+
display: "flex",
|
|
1079
|
+
flexDirection: row ? "row" : "column",
|
|
1080
|
+
flexWrap: row ? "wrap" : "nowrap",
|
|
1081
|
+
gap: 2,
|
|
1082
|
+
...row && { "& > *": { minWidth: "fit-content" } }
|
|
1113
1083
|
},
|
|
1114
|
-
|
|
1115
|
-
|
|
1084
|
+
...Array.isArray(containerSx) ? containerSx : [containerSx]
|
|
1085
|
+
],
|
|
1086
|
+
children: option.map((item) => {
|
|
1087
|
+
const isChecked = option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value));
|
|
1088
|
+
return /* @__PURE__ */ jsxs(
|
|
1089
|
+
Box,
|
|
1090
|
+
{
|
|
1091
|
+
sx: {
|
|
1092
|
+
display: "flex",
|
|
1093
|
+
alignItems: "center",
|
|
1094
|
+
borderRadius: 1,
|
|
1095
|
+
transition: "background-color 0.2s",
|
|
1096
|
+
"&:hover": {
|
|
1097
|
+
backgroundColor: !disabled ? "action.hover" : "transparent"
|
|
1098
|
+
},
|
|
1099
|
+
px: 2,
|
|
1100
|
+
py: 1,
|
|
1101
|
+
...disabled && { color: "text.disabled" }
|
|
1102
|
+
},
|
|
1103
|
+
children: [
|
|
1104
|
+
/* @__PURE__ */ jsx(
|
|
1105
|
+
Checkbox,
|
|
1106
|
+
{
|
|
1107
|
+
name: `${name}.${item.name}`,
|
|
1108
|
+
checked: isChecked,
|
|
1109
|
+
onChange: (e) => handleChange(item.value, e.target.checked),
|
|
1110
|
+
disabled: disabled || item.disabled,
|
|
1111
|
+
sx: [
|
|
1112
|
+
{
|
|
1113
|
+
color: "primary.main",
|
|
1114
|
+
"&.Mui-checked": { color: "primary.main", ...checkedSx },
|
|
1115
|
+
"& .MuiSvgIcon-root": { fontSize: 24, ...iconSx },
|
|
1116
|
+
"&.Mui-disabled": { color: "action.disabled" }
|
|
1117
|
+
},
|
|
1118
|
+
...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]
|
|
1119
|
+
],
|
|
1120
|
+
...checkboxProps
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ jsx(
|
|
1124
|
+
Typography,
|
|
1125
|
+
{
|
|
1126
|
+
variant: "body2",
|
|
1127
|
+
sx: [
|
|
1128
|
+
{ color: disabled ? "text.disabled" : "text.primary" },
|
|
1129
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
1130
|
+
],
|
|
1131
|
+
children: item.label
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1136
|
+
item.name
|
|
1137
|
+
);
|
|
1138
|
+
})
|
|
1116
1139
|
}
|
|
1117
1140
|
),
|
|
1118
1141
|
isTouched && fieldError && /* @__PURE__ */ jsx(
|
|
1119
|
-
|
|
1142
|
+
Typography,
|
|
1120
1143
|
{
|
|
1121
1144
|
variant: "caption",
|
|
1122
|
-
sx: [
|
|
1123
|
-
display: "block",
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
}, ...Array.isArray(errorSx) ? errorSx : [errorSx]],
|
|
1145
|
+
sx: [
|
|
1146
|
+
{ display: "block", mt: 0.5, color: "error.main" },
|
|
1147
|
+
...Array.isArray(errorSx) ? errorSx : [errorSx]
|
|
1148
|
+
],
|
|
1127
1149
|
children: fieldError
|
|
1128
1150
|
}
|
|
1129
1151
|
)
|
|
@@ -1148,63 +1170,27 @@ function AppInputField({
|
|
|
1148
1170
|
name,
|
|
1149
1171
|
label,
|
|
1150
1172
|
type,
|
|
1151
|
-
InputProps,
|
|
1152
1173
|
required,
|
|
1153
1174
|
variant = "outlined",
|
|
1175
|
+
InputProps,
|
|
1154
1176
|
...otherProps
|
|
1155
1177
|
}) {
|
|
1156
1178
|
const { errors, getFieldProps, touched } = useFormikContext();
|
|
1157
1179
|
const fieldError = _17.get(errors, name);
|
|
1158
1180
|
const isTouched = _17.get(touched, name);
|
|
1159
1181
|
const [showPassword, setShowPassword] = useState(false);
|
|
1160
|
-
const handleShowPassword = () =>
|
|
1161
|
-
setShowPassword(!showPassword);
|
|
1162
|
-
};
|
|
1182
|
+
const handleShowPassword = () => setShowPassword(!showPassword);
|
|
1163
1183
|
return /* @__PURE__ */ jsx(
|
|
1164
1184
|
TextField,
|
|
1165
1185
|
{
|
|
1166
1186
|
...getFieldProps(name),
|
|
1167
1187
|
fullWidth: true,
|
|
1168
1188
|
variant,
|
|
1169
|
-
label: required
|
|
1189
|
+
label: required ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1170
1190
|
label,
|
|
1171
1191
|
/* @__PURE__ */ jsx(Typography, { sx: { color: "red", pl: 0.5 }, component: "span", children: "*" })
|
|
1172
1192
|
] }) : label,
|
|
1173
1193
|
error: Boolean(fieldError) && isTouched,
|
|
1174
|
-
sx: {
|
|
1175
|
-
".Mui-error": {
|
|
1176
|
-
m: 0,
|
|
1177
|
-
mt: 0
|
|
1178
|
-
},
|
|
1179
|
-
".MuiFormLabel-root": {
|
|
1180
|
-
top: "-10px",
|
|
1181
|
-
color: "text.primary"
|
|
1182
|
-
},
|
|
1183
|
-
".MuiInputLabel-root.Mui-focused": {
|
|
1184
|
-
color: "text.primary"
|
|
1185
|
-
},
|
|
1186
|
-
".MuiInputLabel-shrink": {
|
|
1187
|
-
top: 0
|
|
1188
|
-
},
|
|
1189
|
-
".MuiFormLabel-asterisk": {
|
|
1190
|
-
color: "red"
|
|
1191
|
-
},
|
|
1192
|
-
"& .MuiInputBase-input.MuiOutlinedInput-input": {
|
|
1193
|
-
color: "common.black"
|
|
1194
|
-
},
|
|
1195
|
-
".MuiOutlinedInput-root": {
|
|
1196
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
1197
|
-
},
|
|
1198
|
-
"react-tel-input": {
|
|
1199
|
-
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
1200
|
-
},
|
|
1201
|
-
"& input:-webkit-autofill": {
|
|
1202
|
-
WebkitBoxShadow: "0 0 0 1000px transparent inset !important",
|
|
1203
|
-
WebkitTextFillColor: "inherit !important",
|
|
1204
|
-
transition: "background-color 9999s ease-in-out 0s !important",
|
|
1205
|
-
caretColor: "inherit"
|
|
1206
|
-
}
|
|
1207
|
-
},
|
|
1208
1194
|
helperText: isTouched && fieldError,
|
|
1209
1195
|
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
1210
1196
|
InputProps: type === "password" ? {
|
|
@@ -1266,7 +1252,7 @@ var AppMultiSelector = forwardRef(
|
|
|
1266
1252
|
return options.filter((opt) => selectedValues.includes(opt.value));
|
|
1267
1253
|
};
|
|
1268
1254
|
if (mode === "autocomplete") {
|
|
1269
|
-
const debouncedSearch =
|
|
1255
|
+
const debouncedSearch = React3.useRef();
|
|
1270
1256
|
const handleSearchChange = (query) => {
|
|
1271
1257
|
if (debouncedSearch.current) {
|
|
1272
1258
|
clearTimeout(debouncedSearch.current);
|
|
@@ -1642,164 +1628,183 @@ var AppPhoneNoInput = ({
|
|
|
1642
1628
|
);
|
|
1643
1629
|
};
|
|
1644
1630
|
var AppPhoneNoInput_default = AppPhoneNoInput;
|
|
1645
|
-
var AppRadioGroup = forwardRef(
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
onChange
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
onBlur
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
"& .MuiFormGroup-root": {
|
|
1688
|
-
mt: 1
|
|
1689
|
-
}
|
|
1690
|
-
}, ...Array.isArray(formControlSx) ? formControlSx : [formControlSx]],
|
|
1691
|
-
children: [
|
|
1692
|
-
label && /* @__PURE__ */ jsxs(
|
|
1693
|
-
FormLabel,
|
|
1631
|
+
var AppRadioGroup = forwardRef(
|
|
1632
|
+
({
|
|
1633
|
+
name,
|
|
1634
|
+
options = [],
|
|
1635
|
+
label,
|
|
1636
|
+
required = false,
|
|
1637
|
+
disabled = false,
|
|
1638
|
+
row = false,
|
|
1639
|
+
sx,
|
|
1640
|
+
formControlSx,
|
|
1641
|
+
radioGroupSx,
|
|
1642
|
+
formLabelSx,
|
|
1643
|
+
radioSx,
|
|
1644
|
+
labelSx,
|
|
1645
|
+
errorSx,
|
|
1646
|
+
onChange,
|
|
1647
|
+
onBlur,
|
|
1648
|
+
...rest
|
|
1649
|
+
}, ref) => {
|
|
1650
|
+
const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
|
|
1651
|
+
const fieldError = _17.get(errors, name);
|
|
1652
|
+
const isTouched = _17.get(touched, name);
|
|
1653
|
+
const value = _17.get(getFieldProps(name), "value");
|
|
1654
|
+
const handleChange = (event) => {
|
|
1655
|
+
const newValue = event.target.value;
|
|
1656
|
+
setFieldValue(name, newValue);
|
|
1657
|
+
if (onChange) {
|
|
1658
|
+
onChange(event, newValue);
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
const handleBlur = (event) => {
|
|
1662
|
+
if (onBlur) {
|
|
1663
|
+
onBlur(event);
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
return /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsxs(
|
|
1667
|
+
FormControl,
|
|
1668
|
+
{
|
|
1669
|
+
component: "fieldset",
|
|
1670
|
+
error: Boolean(fieldError) && isTouched,
|
|
1671
|
+
disabled,
|
|
1672
|
+
sx: [
|
|
1694
1673
|
{
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
required && /* @__PURE__ */ jsx(
|
|
1709
|
-
Typography,
|
|
1674
|
+
width: "100%",
|
|
1675
|
+
"& .MuiFormGroup-root": {
|
|
1676
|
+
mt: 1
|
|
1677
|
+
}
|
|
1678
|
+
},
|
|
1679
|
+
...Array.isArray(formControlSx) ? formControlSx : [formControlSx]
|
|
1680
|
+
],
|
|
1681
|
+
children: [
|
|
1682
|
+
label && /* @__PURE__ */ jsxs(
|
|
1683
|
+
FormLabel,
|
|
1684
|
+
{
|
|
1685
|
+
component: "legend",
|
|
1686
|
+
sx: [
|
|
1710
1687
|
{
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1688
|
+
color: "text.primary",
|
|
1689
|
+
mb: 1,
|
|
1690
|
+
"&.Mui-focused": {
|
|
1691
|
+
color: "text.primary"
|
|
1715
1692
|
},
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
)
|
|
1719
|
-
]
|
|
1720
|
-
}
|
|
1721
|
-
),
|
|
1722
|
-
/* @__PURE__ */ jsx(
|
|
1723
|
-
RadioGroup,
|
|
1724
|
-
{
|
|
1725
|
-
...getFieldProps(name),
|
|
1726
|
-
value: value != null ? value : "",
|
|
1727
|
-
onChange: handleChange,
|
|
1728
|
-
onBlur: handleBlur,
|
|
1729
|
-
row,
|
|
1730
|
-
sx: [{
|
|
1731
|
-
"& .MuiFormControlLabel-root": {
|
|
1732
|
-
mr: row ? 3 : 0,
|
|
1733
|
-
mb: row ? 0 : 1,
|
|
1734
|
-
"&:last-of-type": {
|
|
1735
|
-
mb: 0
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
}, ...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]],
|
|
1739
|
-
...rest,
|
|
1740
|
-
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
1741
|
-
FormControlLabel,
|
|
1742
|
-
{
|
|
1743
|
-
value: option.value,
|
|
1744
|
-
disabled: disabled || option.disabled,
|
|
1745
|
-
control: /* @__PURE__ */ jsx(
|
|
1746
|
-
Radio,
|
|
1747
|
-
{
|
|
1748
|
-
sx: [{
|
|
1749
|
-
color: "primary.main",
|
|
1750
|
-
"&.Mui-checked": {
|
|
1751
|
-
color: "primary.main"
|
|
1752
|
-
},
|
|
1753
|
-
"&.Mui-disabled": {
|
|
1754
|
-
color: "action.disabled"
|
|
1755
|
-
},
|
|
1756
|
-
...radioSx,
|
|
1757
|
-
...option.radioSx
|
|
1758
|
-
}]
|
|
1693
|
+
"&.Mui-disabled": {
|
|
1694
|
+
color: "text.disabled"
|
|
1759
1695
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1696
|
+
},
|
|
1697
|
+
...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]
|
|
1698
|
+
],
|
|
1699
|
+
children: [
|
|
1700
|
+
label,
|
|
1701
|
+
required && /* @__PURE__ */ jsx(
|
|
1762
1702
|
Typography,
|
|
1763
1703
|
{
|
|
1764
|
-
|
|
1765
|
-
sx:
|
|
1766
|
-
color:
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
children: option.label
|
|
1704
|
+
component: "span",
|
|
1705
|
+
sx: {
|
|
1706
|
+
color: "error.main",
|
|
1707
|
+
ml: 0.5
|
|
1708
|
+
},
|
|
1709
|
+
children: "*"
|
|
1771
1710
|
}
|
|
1772
|
-
)
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1711
|
+
)
|
|
1712
|
+
]
|
|
1713
|
+
}
|
|
1714
|
+
),
|
|
1715
|
+
/* @__PURE__ */ jsx(
|
|
1716
|
+
RadioGroup,
|
|
1717
|
+
{
|
|
1718
|
+
...getFieldProps(name),
|
|
1719
|
+
value: value != null ? value : "",
|
|
1720
|
+
onChange: handleChange,
|
|
1721
|
+
onBlur: handleBlur,
|
|
1722
|
+
row,
|
|
1723
|
+
sx: [
|
|
1724
|
+
{
|
|
1725
|
+
"& .MuiFormControlLabel-root": {
|
|
1726
|
+
mr: row ? 3 : 0,
|
|
1727
|
+
mb: row ? 0 : 1,
|
|
1728
|
+
"&:last-of-type": {
|
|
1729
|
+
mb: 0
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
},
|
|
1733
|
+
...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]
|
|
1734
|
+
],
|
|
1735
|
+
...rest,
|
|
1736
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
1737
|
+
FormControlLabel,
|
|
1738
|
+
{
|
|
1739
|
+
value: option.value,
|
|
1740
|
+
disabled: disabled || option.disabled,
|
|
1741
|
+
control: /* @__PURE__ */ jsx(
|
|
1742
|
+
Radio,
|
|
1743
|
+
{
|
|
1744
|
+
sx: [
|
|
1745
|
+
{
|
|
1746
|
+
color: "primary.main",
|
|
1747
|
+
"&.Mui-checked": {
|
|
1748
|
+
color: "primary.main"
|
|
1749
|
+
},
|
|
1750
|
+
"&.Mui-disabled": {
|
|
1751
|
+
color: "action.disabled"
|
|
1752
|
+
},
|
|
1753
|
+
...radioSx,
|
|
1754
|
+
...option.radioSx
|
|
1755
|
+
}
|
|
1756
|
+
]
|
|
1757
|
+
}
|
|
1758
|
+
),
|
|
1759
|
+
label: /* @__PURE__ */ jsx(
|
|
1760
|
+
Typography,
|
|
1761
|
+
{
|
|
1762
|
+
variant: "body2",
|
|
1763
|
+
sx: [
|
|
1764
|
+
{
|
|
1765
|
+
color: disabled || option.disabled ? "text.disabled" : "text.primary",
|
|
1766
|
+
...labelSx,
|
|
1767
|
+
...option.labelSx
|
|
1768
|
+
}
|
|
1769
|
+
],
|
|
1770
|
+
children: option.label
|
|
1771
|
+
}
|
|
1772
|
+
),
|
|
1773
|
+
sx: [
|
|
1774
|
+
{
|
|
1775
|
+
m: 0,
|
|
1776
|
+
mr: row ? 3 : 0,
|
|
1777
|
+
mb: row ? 0 : 1,
|
|
1778
|
+
"&:last-of-type": {
|
|
1779
|
+
mb: 0
|
|
1780
|
+
},
|
|
1781
|
+
...option.sx
|
|
1782
|
+
}
|
|
1783
|
+
]
|
|
1784
|
+
},
|
|
1785
|
+
option.value
|
|
1786
|
+
))
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
isTouched && fieldError && /* @__PURE__ */ jsx(
|
|
1790
|
+
FormHelperText,
|
|
1791
|
+
{
|
|
1792
|
+
sx: [
|
|
1793
|
+
{
|
|
1794
|
+
color: "error.main",
|
|
1795
|
+
mx: 0,
|
|
1796
|
+
mt: 0.5,
|
|
1797
|
+
...errorSx
|
|
1798
|
+
}
|
|
1799
|
+
],
|
|
1800
|
+
children: fieldError
|
|
1801
|
+
}
|
|
1802
|
+
)
|
|
1803
|
+
]
|
|
1804
|
+
}
|
|
1805
|
+
) });
|
|
1806
|
+
}
|
|
1807
|
+
);
|
|
1803
1808
|
AppRadioGroup.displayName = "AppRadioGroup";
|
|
1804
1809
|
var AppRadioGroup_default = AppRadioGroup;
|
|
1805
1810
|
var AppRating = forwardRef(
|
|
@@ -11113,7 +11118,8 @@ var AppRichTextEditor = ({
|
|
|
11113
11118
|
labelSx,
|
|
11114
11119
|
buttonSx,
|
|
11115
11120
|
activeButtonSx,
|
|
11116
|
-
dialogSx
|
|
11121
|
+
dialogSx,
|
|
11122
|
+
showButtons
|
|
11117
11123
|
}) => {
|
|
11118
11124
|
useTheme();
|
|
11119
11125
|
const { values, setFieldValue } = useFormikContext();
|
|
@@ -11129,7 +11135,10 @@ var AppRichTextEditor = ({
|
|
|
11129
11135
|
content: values[name] || "",
|
|
11130
11136
|
onUpdate({ editor: editor2 }) {
|
|
11131
11137
|
setFieldValue(name, editor2.getHTML());
|
|
11132
|
-
}
|
|
11138
|
+
},
|
|
11139
|
+
editorProps: { attributes: { class: "prose" } },
|
|
11140
|
+
immediatelyRender: false
|
|
11141
|
+
// SSR-safe
|
|
11133
11142
|
});
|
|
11134
11143
|
useEffect(() => {
|
|
11135
11144
|
if (editor && values[name] !== editor.getHTML()) {
|
|
@@ -11138,6 +11147,11 @@ var AppRichTextEditor = ({
|
|
|
11138
11147
|
}, [values[name]]);
|
|
11139
11148
|
if (!editor)
|
|
11140
11149
|
return null;
|
|
11150
|
+
const openLinkDialog = () => {
|
|
11151
|
+
const previousUrl = editor.getAttributes("link").href || "";
|
|
11152
|
+
setLinkUrl(previousUrl);
|
|
11153
|
+
setLinkDialogOpen(true);
|
|
11154
|
+
};
|
|
11141
11155
|
const applyLink = () => {
|
|
11142
11156
|
editor.chain().focus().extendMarkRange("link").setLink({ href: linkUrl }).run();
|
|
11143
11157
|
setLinkDialogOpen(false);
|
|
@@ -11146,47 +11160,151 @@ var AppRichTextEditor = ({
|
|
|
11146
11160
|
editor.chain().focus().unsetLink().run();
|
|
11147
11161
|
setLinkDialogOpen(false);
|
|
11148
11162
|
};
|
|
11163
|
+
const renderButton = (onClick, Icon2, active, tooltip) => /* @__PURE__ */ jsx(Tooltip, { title: tooltip, children: /* @__PURE__ */ jsx(
|
|
11164
|
+
IconButton,
|
|
11165
|
+
{
|
|
11166
|
+
onClick,
|
|
11167
|
+
color: active ? "primary" : "default",
|
|
11168
|
+
sx: {
|
|
11169
|
+
...buttonSx,
|
|
11170
|
+
...active ? activeButtonSx : {}
|
|
11171
|
+
},
|
|
11172
|
+
children: /* @__PURE__ */ jsx(Icon2, {})
|
|
11173
|
+
}
|
|
11174
|
+
) }, tooltip);
|
|
11175
|
+
const defaultButtons = [
|
|
11176
|
+
"bold",
|
|
11177
|
+
"italic",
|
|
11178
|
+
"underline",
|
|
11179
|
+
"strike",
|
|
11180
|
+
"bulletList",
|
|
11181
|
+
"orderedList",
|
|
11182
|
+
"alignLeft",
|
|
11183
|
+
"alignCenter",
|
|
11184
|
+
"alignRight",
|
|
11185
|
+
"heading1",
|
|
11186
|
+
"heading2",
|
|
11187
|
+
"undo",
|
|
11188
|
+
"redo",
|
|
11189
|
+
"link"
|
|
11190
|
+
];
|
|
11191
|
+
const buttonsToRender = showButtons && showButtons.length > 0 ? showButtons : defaultButtons;
|
|
11192
|
+
const renderToolbarButton = (id) => {
|
|
11193
|
+
switch (id) {
|
|
11194
|
+
case "bold":
|
|
11195
|
+
return renderButton(
|
|
11196
|
+
() => editor.chain().focus().toggleBold().run(),
|
|
11197
|
+
FormatBoldIcon,
|
|
11198
|
+
editor.isActive("bold"),
|
|
11199
|
+
"Bold"
|
|
11200
|
+
);
|
|
11201
|
+
case "italic":
|
|
11202
|
+
return renderButton(
|
|
11203
|
+
() => editor.chain().focus().toggleItalic().run(),
|
|
11204
|
+
FormatItalicIcon,
|
|
11205
|
+
editor.isActive("italic"),
|
|
11206
|
+
"Italic"
|
|
11207
|
+
);
|
|
11208
|
+
case "underline":
|
|
11209
|
+
return renderButton(
|
|
11210
|
+
() => editor.chain().focus().toggleUnderline().run(),
|
|
11211
|
+
FormatUnderlinedIcon,
|
|
11212
|
+
editor.isActive("underline"),
|
|
11213
|
+
"Underline"
|
|
11214
|
+
);
|
|
11215
|
+
case "strike":
|
|
11216
|
+
return renderButton(
|
|
11217
|
+
() => editor.chain().focus().toggleStrike().run(),
|
|
11218
|
+
StrikethroughSIcon,
|
|
11219
|
+
editor.isActive("strike"),
|
|
11220
|
+
"Strike"
|
|
11221
|
+
);
|
|
11222
|
+
case "bulletList":
|
|
11223
|
+
return renderButton(
|
|
11224
|
+
() => editor.chain().focus().toggleBulletList().run(),
|
|
11225
|
+
FormatListBulletedIcon,
|
|
11226
|
+
editor.isActive("bulletList"),
|
|
11227
|
+
"Bullet List"
|
|
11228
|
+
);
|
|
11229
|
+
case "orderedList":
|
|
11230
|
+
return renderButton(
|
|
11231
|
+
() => editor.chain().focus().toggleOrderedList().run(),
|
|
11232
|
+
FormatListNumberedIcon,
|
|
11233
|
+
editor.isActive("orderedList"),
|
|
11234
|
+
"Numbered List"
|
|
11235
|
+
);
|
|
11236
|
+
case "alignLeft":
|
|
11237
|
+
return renderButton(
|
|
11238
|
+
() => editor.chain().focus().setTextAlign("left").run(),
|
|
11239
|
+
FormatAlignLeftIcon,
|
|
11240
|
+
editor.isActive({ textAlign: "left" }),
|
|
11241
|
+
"Align Left"
|
|
11242
|
+
);
|
|
11243
|
+
case "alignCenter":
|
|
11244
|
+
return renderButton(
|
|
11245
|
+
() => editor.chain().focus().setTextAlign("center").run(),
|
|
11246
|
+
FormatAlignCenterIcon,
|
|
11247
|
+
editor.isActive({ textAlign: "center" }),
|
|
11248
|
+
"Align Center"
|
|
11249
|
+
);
|
|
11250
|
+
case "alignRight":
|
|
11251
|
+
return renderButton(
|
|
11252
|
+
() => editor.chain().focus().setTextAlign("right").run(),
|
|
11253
|
+
FormatAlignRightIcon,
|
|
11254
|
+
editor.isActive({ textAlign: "right" }),
|
|
11255
|
+
"Align Right"
|
|
11256
|
+
);
|
|
11257
|
+
case "heading1":
|
|
11258
|
+
return renderButton(
|
|
11259
|
+
() => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
11260
|
+
TitleIcon,
|
|
11261
|
+
editor.isActive("heading", { level: 1 }),
|
|
11262
|
+
"Heading 1"
|
|
11263
|
+
);
|
|
11264
|
+
case "heading2":
|
|
11265
|
+
return renderButton(
|
|
11266
|
+
() => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
11267
|
+
TitleIcon,
|
|
11268
|
+
editor.isActive("heading", { level: 2 }),
|
|
11269
|
+
"Heading 2"
|
|
11270
|
+
);
|
|
11271
|
+
case "undo":
|
|
11272
|
+
return renderButton(
|
|
11273
|
+
() => editor.chain().focus().undo().run(),
|
|
11274
|
+
UndoIcon,
|
|
11275
|
+
false,
|
|
11276
|
+
"Undo"
|
|
11277
|
+
);
|
|
11278
|
+
case "redo":
|
|
11279
|
+
return renderButton(
|
|
11280
|
+
() => editor.chain().focus().redo().run(),
|
|
11281
|
+
RedoIcon,
|
|
11282
|
+
false,
|
|
11283
|
+
"Redo"
|
|
11284
|
+
);
|
|
11285
|
+
case "link":
|
|
11286
|
+
return renderButton(openLinkDialog, UndoIcon, false, "Insert Link");
|
|
11287
|
+
default:
|
|
11288
|
+
return null;
|
|
11289
|
+
}
|
|
11290
|
+
};
|
|
11149
11291
|
return /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", ...sx }, children: [
|
|
11150
|
-
/* @__PURE__ */ jsx(
|
|
11151
|
-
ErrorMessage,
|
|
11152
|
-
{
|
|
11153
|
-
name,
|
|
11154
|
-
render: (msg) => /* @__PURE__ */ jsx(
|
|
11155
|
-
Typography,
|
|
11156
|
-
{
|
|
11157
|
-
variant: "caption",
|
|
11158
|
-
sx: [
|
|
11159
|
-
{
|
|
11160
|
-
color: "error.main",
|
|
11161
|
-
display: "block",
|
|
11162
|
-
mt: 0.5,
|
|
11163
|
-
...errorSx
|
|
11164
|
-
}
|
|
11165
|
-
],
|
|
11166
|
-
children: msg
|
|
11167
|
-
}
|
|
11168
|
-
)
|
|
11169
|
-
}
|
|
11170
|
-
),
|
|
11171
11292
|
label && /* @__PURE__ */ jsxs(
|
|
11172
11293
|
Typography,
|
|
11173
11294
|
{
|
|
11174
11295
|
variant: "button",
|
|
11175
|
-
sx:
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
...labelSx
|
|
11181
|
-
}
|
|
11182
|
-
],
|
|
11296
|
+
sx: {
|
|
11297
|
+
mb: 1,
|
|
11298
|
+
display: "block",
|
|
11299
|
+
...labelSx
|
|
11300
|
+
},
|
|
11183
11301
|
children: [
|
|
11184
11302
|
label,
|
|
11185
11303
|
required && /* @__PURE__ */ jsx(Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
|
|
11186
11304
|
]
|
|
11187
11305
|
}
|
|
11188
11306
|
),
|
|
11189
|
-
/* @__PURE__ */
|
|
11307
|
+
/* @__PURE__ */ jsx(
|
|
11190
11308
|
Box,
|
|
11191
11309
|
{
|
|
11192
11310
|
sx: {
|
|
@@ -11201,142 +11319,7 @@ var AppRichTextEditor = ({
|
|
|
11201
11319
|
borderColor: "divider",
|
|
11202
11320
|
...toolbarSx
|
|
11203
11321
|
},
|
|
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
|
-
]
|
|
11322
|
+
children: buttonsToRender.map((btn) => renderToolbarButton(btn))
|
|
11340
11323
|
}
|
|
11341
11324
|
),
|
|
11342
11325
|
/* @__PURE__ */ jsx(
|
|
@@ -11354,9 +11337,7 @@ var AppRichTextEditor = ({
|
|
|
11354
11337
|
"& .ProseMirror": {
|
|
11355
11338
|
outline: "none",
|
|
11356
11339
|
minHeight: 150,
|
|
11357
|
-
"& > * + *": {
|
|
11358
|
-
mt: 2
|
|
11359
|
-
},
|
|
11340
|
+
"& > * + *": { mt: 2 },
|
|
11360
11341
|
"& h1": {
|
|
11361
11342
|
fontSize: "2em",
|
|
11362
11343
|
fontWeight: "bold",
|
|
@@ -11369,20 +11350,12 @@ var AppRichTextEditor = ({
|
|
|
11369
11350
|
lineHeight: 1.3,
|
|
11370
11351
|
color: "text.primary"
|
|
11371
11352
|
},
|
|
11372
|
-
"& p": {
|
|
11373
|
-
|
|
11374
|
-
lineHeight: 1.6
|
|
11375
|
-
},
|
|
11376
|
-
"& ul, & ol": {
|
|
11377
|
-
pl: 3,
|
|
11378
|
-
color: "text.primary"
|
|
11379
|
-
},
|
|
11353
|
+
"& p": { color: "text.primary", lineHeight: 1.6 },
|
|
11354
|
+
"& ul, & ol": { pl: 3, color: "text.primary" },
|
|
11380
11355
|
"& a": {
|
|
11381
11356
|
color: "primary.main",
|
|
11382
11357
|
textDecoration: "none",
|
|
11383
|
-
"&:hover": {
|
|
11384
|
-
textDecoration: "underline"
|
|
11385
|
-
}
|
|
11358
|
+
"&:hover": { textDecoration: "underline" }
|
|
11386
11359
|
},
|
|
11387
11360
|
...contentSx
|
|
11388
11361
|
},
|
|
@@ -11419,19 +11392,6 @@ var AppRichTextEditor = ({
|
|
|
11419
11392
|
borderRadius: 1,
|
|
11420
11393
|
border: "1px solid",
|
|
11421
11394
|
borderColor: "divider",
|
|
11422
|
-
"& .MuiDialogTitle-root": {
|
|
11423
|
-
borderBottom: "1px solid",
|
|
11424
|
-
borderColor: "divider",
|
|
11425
|
-
p: 2
|
|
11426
|
-
},
|
|
11427
|
-
"& .MuiDialogContent-root": {
|
|
11428
|
-
p: 2
|
|
11429
|
-
},
|
|
11430
|
-
"& .MuiDialogActions-root": {
|
|
11431
|
-
p: 2,
|
|
11432
|
-
borderTop: "1px solid",
|
|
11433
|
-
borderColor: "divider"
|
|
11434
|
-
},
|
|
11435
11395
|
...dialogSx
|
|
11436
11396
|
}
|
|
11437
11397
|
},
|
|
@@ -11501,7 +11461,7 @@ var AppSelectInput = forwardRef(
|
|
|
11501
11461
|
};
|
|
11502
11462
|
const selectedOption = options.find((opt) => opt.value === currentValue) || null;
|
|
11503
11463
|
if (mode === "autocomplete") {
|
|
11504
|
-
const debouncedSearch =
|
|
11464
|
+
const debouncedSearch = React3.useRef();
|
|
11505
11465
|
const handleSearchChange = (query) => {
|
|
11506
11466
|
if (debouncedSearch.current) {
|
|
11507
11467
|
clearTimeout(debouncedSearch.current);
|
|
@@ -11688,7 +11648,7 @@ var AppSelectInput_default = AppSelectInput;
|
|
|
11688
11648
|
var AppSimpleUploadFile = ({
|
|
11689
11649
|
name,
|
|
11690
11650
|
label = "Upload Files",
|
|
11691
|
-
accept = "
|
|
11651
|
+
accept = "",
|
|
11692
11652
|
multiple = false,
|
|
11693
11653
|
disabled = false,
|
|
11694
11654
|
required = false,
|