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/dist/index.mjs CHANGED
@@ -1,15 +1,13 @@
1
1
  import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
2
- import React4, { 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, InputLabel, Switch, InputAdornment, IconButton, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Menu } from '@mui/material';
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';
7
7
  import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
8
- import _19, { get } from 'lodash';
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,15 +41,16 @@ 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, setFieldTouched } = useFormikContext();
52
- const fieldValue = _19.get(values, name);
53
- const fieldError = _19.get(errors, name);
54
- const isTouched = _19.get(touched, name);
50
+ const { values, setFieldValue, touched, errors } = useFormikContext();
51
+ const fieldValue = _17.get(values, name);
52
+ const fieldError = _17.get(errors, name);
53
+ const isTouched = _17.get(touched, name);
55
54
  const handleChange = (newValue) => {
56
55
  setFieldValue(name, newValue);
57
56
  };
@@ -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
@@ -285,27 +285,32 @@ function AppFormErrorMessage({
285
285
  textSx
286
286
  }) {
287
287
  const { errors, touched } = useFormikContext();
288
- const fieldError = _19.get(errors, name);
289
- const isTouched = _19.get(touched, name);
288
+ const fieldError = _17.get(errors, name);
289
+ const isTouched = _17.get(touched, name);
290
290
  const showError = fieldError && typeof fieldError === "string";
291
291
  if (alwaysShow) {
292
292
  return showError ? /* @__PURE__ */ jsx(
293
293
  Box,
294
294
  {
295
- sx: [{
296
- mt: 0.5,
297
- ...containerSx
298
- }, sx],
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
- fontSize: "0.75rem",
306
- display: "block",
307
- ...textSx
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
- mt: 0.5,
321
- ...containerSx
322
- }, sx],
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
- fontSize: "0.75rem",
330
- display: "block",
331
- ...textSx
332
- }],
336
+ sx: [
337
+ {
338
+ fontSize: "0.75rem",
339
+ display: "block",
340
+ ...textSx
341
+ }
342
+ ],
333
343
  children: fieldError
334
344
  }
335
345
  )
@@ -363,9 +373,9 @@ var AppTextArea = forwardRef(({
363
373
  }, ref) => {
364
374
  var _a, _b, _c, _d;
365
375
  const { errors, getFieldProps, touched, setFieldValue } = useFormikContext();
366
- const fieldError = _19.get(errors, name);
367
- const isTouched = _19.get(touched, name);
368
- const value = _19.get(getFieldProps(name), "value", "");
376
+ const fieldError = _17.get(errors, name);
377
+ const isTouched = _17.get(touched, name);
378
+ const value = _17.get(getFieldProps(name), "value", "");
369
379
  const handleChange = (e) => {
370
380
  const newValue = e.target.value;
371
381
  if (maxLength && newValue.length > maxLength)
@@ -519,9 +529,9 @@ function AppTagsCreator({
519
529
  inputSx
520
530
  }) {
521
531
  const { errors, touched, getFieldProps, values, setFieldValue, setTouched } = useFormikContext();
522
- const fieldError = _19.get(errors, name);
523
- const isTouched = _19.get(touched, name);
524
- const val = _19.get(values, name);
532
+ const fieldError = _17.get(errors, name);
533
+ const isTouched = _17.get(touched, name);
534
+ const val = _17.get(values, name);
525
535
  return /* @__PURE__ */ jsxs(
526
536
  FormControl,
527
537
  {
@@ -644,8 +654,8 @@ function AppSwitchInput({
644
654
  ...otherProps
645
655
  }) {
646
656
  const { errors, touched, setFieldValue, values } = useFormikContext();
647
- const fieldError = _19.get(errors, name);
648
- const isTouched = _19.get(touched, name);
657
+ const fieldError = _17.get(errors, name);
658
+ const isTouched = _17.get(touched, name);
649
659
  return /* @__PURE__ */ jsxs(
650
660
  Box,
651
661
  {
@@ -743,9 +753,9 @@ function AppSwitch({
743
753
  ...otherProps
744
754
  }) {
745
755
  const { errors, touched, setFieldValue, values } = useFormikContext();
746
- const fieldValue = _19.get(values, name);
747
- const fieldError = _19.get(errors, name);
748
- const isTouched = _19.get(touched, name);
756
+ const fieldValue = _17.get(values, name);
757
+ const fieldError = _17.get(errors, name);
758
+ const isTouched = _17.get(touched, name);
749
759
  return /* @__PURE__ */ jsxs(
750
760
  Stack,
751
761
  {
@@ -851,9 +861,9 @@ function AppAutoComplete({
851
861
  errorSx
852
862
  }) {
853
863
  const { errors, touched, getFieldProps, values, setFieldValue } = useFormikContext();
854
- const fieldError = _19.get(errors, name);
855
- const isTouched = _19.get(touched, name);
856
- const formikValue = _19.get(values, name);
864
+ const fieldError = _17.get(errors, name);
865
+ const isTouched = _17.get(touched, name);
866
+ const formikValue = _17.get(values, name);
857
867
  const val = propValue !== void 0 ? propValue : formikValue || [];
858
868
  return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
859
869
  /* @__PURE__ */ jsx(
@@ -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
- disabled,
930
+ multiple = false,
931
+ freeSolo = false,
921
932
  sx,
922
933
  formControlSx,
923
934
  textFieldSx,
924
- listboxSx,
925
- errorSx
935
+ chipSx,
936
+ errorSx,
937
+ ...rest
926
938
  }) {
927
939
  const { errors, touched, values, setFieldValue } = useFormikContext();
928
- const fieldError = _19.get(errors, name);
929
- const isTouched = _19.get(touched, name);
930
- const value = _19.get(values, name);
931
- const selectedOption = options.find((opt) => opt.value === value) || null;
932
- return /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
940
+ const fieldError = _17.get(errors, name);
941
+ const isTouched = _17.get(touched, name);
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
- Autocomplete3,
972
+ Autocomplete,
935
973
  {
936
- id: `${name}-autocomplete`,
974
+ multiple,
975
+ freeSolo,
937
976
  options,
938
- value: selectedOption,
939
- getOptionLabel: (option) => (option == null ? void 0 : option.label) || "",
940
- isOptionEqualToValue: (option, value2) => option.value === value2.value,
941
- autoHighlight: true,
942
- onChange: (_20, newValue) => {
943
- setFieldValue(name, newValue ? newValue.value : null);
944
- },
945
- renderOption: (props, option) => /* @__PURE__ */ createElement(Box, { component: "li", ...props, key: option.value, sx: listboxSx }, option.label),
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) && isTouched,
998
+ error: Boolean(fieldError && isTouched),
953
999
  helperText: isTouched && fieldError,
954
1000
  sx: textFieldSx
955
1001
  }
956
1002
  ),
957
- disabled,
958
- sx
1003
+ sx,
1004
+ ...rest
959
1005
  }
960
1006
  ),
961
- fieldError != null && isTouched === true && /* @__PURE__ */ jsx(
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
- ...rest
1024
+ checkboxProps
991
1025
  }) => {
992
1026
  const { getFieldProps, setFieldValue, touched, errors } = useFormikContext();
993
- const fieldError = _19.get(errors, name);
994
- const isTouched = _19.get(touched, name);
995
- useTheme();
1027
+ const fieldError = _17.get(errors, name);
1028
+ const isTouched = _17.get(touched, name);
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
- width: "100%",
1016
- ...disabled && {
1017
- opacity: 0.7,
1018
- pointerEvents: "none"
1019
- }
1020
- }, ...Array.isArray(sx) ? sx : [sx]],
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
- Typography9,
1055
+ Typography,
1024
1056
  {
1025
1057
  variant: "subtitle2",
1026
1058
  gutterBottom: true,
1027
- sx: [{
1028
- color: "text.primary",
1029
- fontWeight: "medium",
1030
- ...required && {
1031
- "&:after": {
1032
- content: '" *"',
1033
- color: "error.main"
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
- ...disabled && {
1037
- color: "text.disabled"
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
- sx: [{
1061
- display: "flex",
1062
- alignItems: "center",
1063
- borderRadius: 1,
1064
- transition: "background-color 0.2s",
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
- item.name
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
- Typography9,
1142
+ Typography,
1120
1143
  {
1121
1144
  variant: "caption",
1122
- sx: [{
1123
- display: "block",
1124
- mt: 0.5,
1125
- color: "error.main"
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
- const fieldError = _19.get(errors, name);
1158
- const isTouched = _19.get(touched, name);
1179
+ const fieldError = _17.get(errors, name);
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 === true ? /* @__PURE__ */ jsxs(Fragment, { children: [
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" ? {
@@ -1240,10 +1226,10 @@ var AppMultiSelector = forwardRef(
1240
1226
  }, ref) => {
1241
1227
  const theme = useTheme();
1242
1228
  const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
1243
- const fieldError = _19.get(errors, name);
1244
- const isTouched = Boolean(_19.get(touched, name));
1229
+ const fieldError = _17.get(errors, name);
1230
+ const isTouched = Boolean(_17.get(touched, name));
1245
1231
  const hasError = Boolean(fieldError) && isTouched;
1246
- const currentValue = _19.get(values, name);
1232
+ const currentValue = _17.get(values, name);
1247
1233
  const selectedValues = Array.isArray(currentValue) ? currentValue : [];
1248
1234
  const selectedCount = selectedValues.length;
1249
1235
  const isMaxReached = maxSelections ? selectedCount >= maxSelections : false;
@@ -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 = React4.useRef();
1255
+ const debouncedSearch = React3.useRef();
1270
1256
  const handleSearchChange = (query) => {
1271
1257
  if (debouncedSearch.current) {
1272
1258
  clearTimeout(debouncedSearch.current);
@@ -1282,10 +1268,7 @@ var AppMultiSelector = forwardRef(
1282
1268
  return options2;
1283
1269
  const inputValueLower = inputValue.toLowerCase();
1284
1270
  return options2.filter(
1285
- (option) => {
1286
- var _a, _b, _c;
1287
- 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));
1288
- }
1271
+ (option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
1289
1272
  );
1290
1273
  };
1291
1274
  const selectedOptions = getSelectedOptions();
@@ -1346,28 +1329,31 @@ var AppMultiSelector = forwardRef(
1346
1329
  }
1347
1330
  }
1348
1331
  ),
1349
- renderOption: (props, option, { selected }) => /* @__PURE__ */ jsxs("li", { ...props, children: [
1350
- /* @__PURE__ */ jsx(
1351
- Checkbox,
1352
- {
1353
- checked: selected,
1354
- disabled: option.disabled || isMaxReached && !selected,
1355
- sx: checkboxSx
1356
- }
1357
- ),
1358
- option.icon,
1359
- /* @__PURE__ */ jsx(
1360
- Typography,
1361
- {
1362
- variant: "body2",
1363
- sx: {
1364
- color: option.disabled ? "text.disabled" : "text.primary",
1365
- ...option.textSx
1366
- },
1367
- children: option.label
1368
- }
1369
- )
1370
- ] }),
1332
+ renderOption: (props, option, { selected }) => {
1333
+ const { key, ...restProps } = props;
1334
+ return /* @__PURE__ */ jsxs("li", { ...restProps, children: [
1335
+ /* @__PURE__ */ jsx(
1336
+ Checkbox,
1337
+ {
1338
+ checked: selected,
1339
+ disabled: option.disabled || isMaxReached && !selected,
1340
+ sx: checkboxSx
1341
+ }
1342
+ ),
1343
+ option.icon,
1344
+ /* @__PURE__ */ jsx(
1345
+ Typography,
1346
+ {
1347
+ variant: "body2",
1348
+ sx: {
1349
+ color: option.disabled ? "text.disabled" : "text.primary",
1350
+ ...option.textSx
1351
+ },
1352
+ children: option.label
1353
+ }
1354
+ )
1355
+ ] }, key);
1356
+ },
1371
1357
  renderTags: (value, getTagProps) => /* @__PURE__ */ jsx(
1372
1358
  Box,
1373
1359
  {
@@ -1550,8 +1536,8 @@ var AppPhoneNoInput = ({
1550
1536
  withCountryCallingCode = true
1551
1537
  }) => {
1552
1538
  const { values, errors, touched, setFieldValue, setFieldTouched } = useFormikContext();
1553
- const fieldError = useMemo(() => _19.get(errors, name), [errors, name]);
1554
- const isTouched = useMemo(() => _19.get(touched, name), [touched, name]);
1539
+ const fieldError = useMemo(() => _17.get(errors, name), [errors, name]);
1540
+ const isTouched = useMemo(() => _17.get(touched, name), [touched, name]);
1555
1541
  return /* @__PURE__ */ jsxs(
1556
1542
  Box,
1557
1543
  {
@@ -1642,164 +1628,183 @@ var AppPhoneNoInput = ({
1642
1628
  );
1643
1629
  };
1644
1630
  var AppPhoneNoInput_default = AppPhoneNoInput;
1645
- var AppRadioGroup = forwardRef(({
1646
- name,
1647
- options = [],
1648
- label,
1649
- required = false,
1650
- disabled = false,
1651
- row = false,
1652
- sx,
1653
- formControlSx,
1654
- radioGroupSx,
1655
- formLabelSx,
1656
- radioSx,
1657
- labelSx,
1658
- errorSx,
1659
- onChange,
1660
- onBlur,
1661
- ...rest
1662
- }, ref) => {
1663
- const { errors, touched, getFieldProps, setFieldValue } = useFormikContext();
1664
- const fieldError = _19.get(errors, name);
1665
- const isTouched = _19.get(touched, name);
1666
- const value = _19.get(getFieldProps(name), "value");
1667
- const handleChange = (event) => {
1668
- const newValue = event.target.value;
1669
- setFieldValue(name, newValue);
1670
- if (onChange) {
1671
- onChange(event, newValue);
1672
- }
1673
- };
1674
- const handleBlur = (event) => {
1675
- if (onBlur) {
1676
- onBlur(event);
1677
- }
1678
- };
1679
- return /* @__PURE__ */ jsx(Box, { sx, ref, children: /* @__PURE__ */ jsxs(
1680
- FormControl,
1681
- {
1682
- component: "fieldset",
1683
- error: Boolean(fieldError) && isTouched,
1684
- disabled,
1685
- sx: [{
1686
- width: "100%",
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
- component: "legend",
1696
- sx: [{
1697
- color: "text.primary",
1698
- mb: 1,
1699
- "&.Mui-focused": {
1700
- color: "text.primary"
1701
- },
1702
- "&.Mui-disabled": {
1703
- color: "text.disabled"
1704
- }
1705
- }, ...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]],
1706
- children: [
1707
- label,
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
- component: "span",
1712
- sx: {
1713
- color: "error.main",
1714
- ml: 0.5
1688
+ color: "text.primary",
1689
+ mb: 1,
1690
+ "&.Mui-focused": {
1691
+ color: "text.primary"
1715
1692
  },
1716
- children: "*"
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
- label: /* @__PURE__ */ jsx(
1696
+ },
1697
+ ...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]
1698
+ ],
1699
+ children: [
1700
+ label,
1701
+ required && /* @__PURE__ */ jsx(
1762
1702
  Typography,
1763
1703
  {
1764
- variant: "body2",
1765
- sx: [{
1766
- color: disabled || option.disabled ? "text.disabled" : "text.primary",
1767
- ...labelSx,
1768
- ...option.labelSx
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
- sx: [{
1774
- m: 0,
1775
- mr: row ? 3 : 0,
1776
- mb: row ? 0 : 1,
1777
- "&:last-of-type": {
1778
- mb: 0
1779
- },
1780
- ...option.sx
1781
- }]
1782
- },
1783
- option.value
1784
- ))
1785
- }
1786
- ),
1787
- isTouched && fieldError && /* @__PURE__ */ jsx(
1788
- FormHelperText,
1789
- {
1790
- sx: [{
1791
- color: "error.main",
1792
- mx: 0,
1793
- mt: 0.5,
1794
- ...errorSx
1795
- }],
1796
- children: fieldError
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(
@@ -1842,9 +1847,9 @@ var AppRating = forwardRef(
1842
1847
  }, ref) => {
1843
1848
  useTheme();
1844
1849
  const { errors, touched, setFieldValue, values, setFieldTouched } = useFormikContext();
1845
- const val = _19.get(values, name);
1846
- const fieldError = _19.get(errors, name);
1847
- const isTouched = _19.get(touched, name);
1850
+ const val = _17.get(values, name);
1851
+ const fieldError = _17.get(errors, name);
1852
+ const isTouched = _17.get(touched, name);
1848
1853
  const hasError = Boolean(fieldError) && isTouched;
1849
1854
  const handleChange = (event, newValue) => {
1850
1855
  setFieldValue(name, newValue);
@@ -2586,7 +2591,7 @@ var Mark = class {
2586
2591
  */
2587
2592
  toJSON() {
2588
2593
  let obj = { type: this.type.name };
2589
- for (let _20 in this.attrs) {
2594
+ for (let _18 in this.attrs) {
2590
2595
  obj.attrs = this.attrs;
2591
2596
  break;
2592
2597
  }
@@ -3534,7 +3539,7 @@ var Node = class {
3534
3539
  */
3535
3540
  toJSON() {
3536
3541
  let obj = { type: this.type.name };
3537
- for (let _20 in this.attrs) {
3542
+ for (let _18 in this.attrs) {
3538
3543
  obj.attrs = this.attrs;
3539
3544
  break;
3540
3545
  }
@@ -4263,7 +4268,7 @@ var NodeType = class {
4263
4268
  throw new RangeError("Schema is missing its top node type ('" + topType + "')");
4264
4269
  if (!result.text)
4265
4270
  throw new RangeError("Every schema needs a 'text' type");
4266
- for (let _20 in result.text.attrs)
4271
+ for (let _18 in result.text.attrs)
4267
4272
  throw new RangeError("The text node type should not have attributes");
4268
4273
  return result;
4269
4274
  }
@@ -9272,7 +9277,7 @@ function removeDuplicates(array, by = JSON.stringify) {
9272
9277
  function simplifyChangedRanges(changes) {
9273
9278
  const uniqueChanges = removeDuplicates(changes);
9274
9279
  return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
9275
- const rest = uniqueChanges.filter((_20, i) => i !== index);
9280
+ const rest = uniqueChanges.filter((_18, i) => i !== index);
9276
9281
  return !rest.some((otherChange) => {
9277
9282
  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;
9278
9283
  });
@@ -10297,7 +10302,7 @@ var Drop = Extension.create({
10297
10302
  new Plugin({
10298
10303
  key: new PluginKey("tiptapDrop"),
10299
10304
  props: {
10300
- handleDrop: (_20, e, slice, moved) => {
10305
+ handleDrop: (_18, e, slice, moved) => {
10301
10306
  this.editor.emit("drop", {
10302
10307
  editor: this.editor,
10303
10308
  event: e,
@@ -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
- color: "text.primary",
11178
- mb: 1,
11179
- display: "block",
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__ */ jsxs(
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
- color: "text.primary",
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
  },
@@ -11463,541 +11423,6 @@ var AppRichTextEditor = ({
11463
11423
  ] });
11464
11424
  };
11465
11425
  var AppRichTextEditor_default = AppRichTextEditor;
11466
- var AppSearchableMultiSelector = forwardRef(
11467
- ({
11468
- name,
11469
- label,
11470
- multiple = true,
11471
- options = [],
11472
- setSearchQuery,
11473
- required = false,
11474
- variant = "outlined",
11475
- disabled = false,
11476
- readOnly = false,
11477
- showHelperText = false,
11478
- helperText,
11479
- maxSelections,
11480
- showSelectedCount = false,
11481
- sx,
11482
- formControlSx,
11483
- labelSx,
11484
- inputSx,
11485
- textFieldSx,
11486
- autocompleteSx,
11487
- listboxSx,
11488
- optionSx,
11489
- chipSx,
11490
- errorSx,
11491
- helperTextSx,
11492
- selectedCountSx,
11493
- renderInput: externalRenderInput,
11494
- renderOption: externalRenderOption,
11495
- renderTags: externalRenderTags,
11496
- renderGroup: externalRenderGroup,
11497
- labelComponent: LabelComponent = InputLabel,
11498
- inputComponent: InputComponent = "input",
11499
- errorComponent: ErrorComponent = Typography,
11500
- helperTextComponent: HelperTextComponent = FormHelperText,
11501
- labelProps = {},
11502
- inputProps = {},
11503
- textFieldProps = {},
11504
- autocompleteProps = {},
11505
- checkboxProps = {},
11506
- chipProps = {},
11507
- errorProps = {},
11508
- helperTextProps = {},
11509
- className = "",
11510
- formControlClassName = "",
11511
- labelClassName = "",
11512
- inputClassName = "",
11513
- textFieldClassName = "",
11514
- autocompleteClassName = "",
11515
- listboxClassName = "",
11516
- optionClassName = "",
11517
- chipClassName = "",
11518
- errorClassName = "",
11519
- helperTextClassName = "",
11520
- onInputChange: externalOnInputChange,
11521
- onChange: externalOnChange,
11522
- onOpen,
11523
- onClose,
11524
- onBlur: externalOnBlur,
11525
- onFocus: externalOnFocus,
11526
- onClear,
11527
- onMaxSelectionsReached,
11528
- onRemove,
11529
- onAdd,
11530
- ...otherProps
11531
- }, ref) => {
11532
- useTheme();
11533
- const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
11534
- const fieldError = _19.get(errors, name);
11535
- const isTouched = Boolean(_19.get(touched, name));
11536
- const hasError = Boolean(fieldError) && isTouched;
11537
- const val = _19.get(values, name);
11538
- const selectedValues = Array.isArray(val) ? val : [];
11539
- const selectedCount = selectedValues.length;
11540
- const handleChange = (event, value, reason, details) => {
11541
- const normalizedValue = (() => {
11542
- if (value === null)
11543
- return [];
11544
- const arr = Array.isArray(value) ? value : [value];
11545
- return arr.map(
11546
- (item) => typeof item === "string" ? { value: item, label: item } : item
11547
- );
11548
- })();
11549
- if (maxSelections && normalizedValue.length > maxSelections) {
11550
- if (onMaxSelectionsReached) {
11551
- onMaxSelectionsReached(maxSelections);
11552
- }
11553
- return;
11554
- }
11555
- if (reason === "selectOption" || reason === "removeOption") {
11556
- const added = normalizedValue.filter(
11557
- (item) => !selectedValues.some((v) => v.value === item.value)
11558
- );
11559
- const removed = selectedValues.filter(
11560
- (item) => !normalizedValue.some((v) => v.value === item.value)
11561
- );
11562
- if (added.length > 0 && onAdd) {
11563
- added.forEach((item) => onAdd(item));
11564
- }
11565
- if (removed.length > 0 && onRemove) {
11566
- removed.forEach((item) => onRemove(item));
11567
- }
11568
- }
11569
- setFieldValue(name, normalizedValue, true);
11570
- if (externalOnChange) {
11571
- externalOnChange(event, normalizedValue, reason);
11572
- }
11573
- };
11574
- const handleInputChange = (event, value, reason) => {
11575
- if (setSearchQuery) {
11576
- setSearchQuery(value);
11577
- }
11578
- if (externalOnInputChange) {
11579
- externalOnInputChange(event, value, reason);
11580
- }
11581
- };
11582
- const handleBlur = (event) => {
11583
- setFieldTouched(name, true, true);
11584
- if (externalOnBlur) {
11585
- externalOnBlur(event);
11586
- }
11587
- };
11588
- const handleFocus = (event) => {
11589
- if (externalOnFocus) {
11590
- externalOnFocus(event);
11591
- }
11592
- };
11593
- const filterOptions = (options2, { inputValue }) => {
11594
- if (!inputValue)
11595
- return options2;
11596
- const inputValueLower = inputValue.toLowerCase();
11597
- return options2.filter(
11598
- (option) => {
11599
- var _a, _b, _c, _d;
11600
- 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));
11601
- }
11602
- );
11603
- };
11604
- const defaultRenderInput = (params) => /* @__PURE__ */ jsx(
11605
- TextField,
11606
- {
11607
- ...params,
11608
- variant,
11609
- error: hasError,
11610
- helperText: "",
11611
- placeholder: "",
11612
- inputRef: inputProps.ref,
11613
- inputProps: {
11614
- ...params.inputProps,
11615
- ...inputProps,
11616
- className: `${params.inputProps.className || ""} ${inputClassName}`.trim()
11617
- },
11618
- InputProps: {
11619
- ...params.InputProps,
11620
- ...textFieldProps.InputProps,
11621
- className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
11622
- },
11623
- sx: [
11624
- {
11625
- "& .MuiOutlinedInput-root": {
11626
- borderRadius: "8px",
11627
- "& fieldset": {
11628
- borderColor: hasError ? "error.main" : "divider"
11629
- },
11630
- "&:hover fieldset": {
11631
- borderColor: hasError ? "error.main" : "text.primary"
11632
- },
11633
- "&.Mui-focused fieldset": {
11634
- borderColor: hasError ? "error.main" : "primary.main"
11635
- },
11636
- "& .MuiInputLabel-root": {
11637
- // Your label styles here
11638
- }
11639
- }
11640
- },
11641
- ...Array.isArray(sx) ? sx : sx ? [sx] : []
11642
- ],
11643
- ...textFieldProps
11644
- }
11645
- );
11646
- const defaultRenderOption = (props, option, { selected }) => /* @__PURE__ */ createElement(
11647
- "li",
11648
- {
11649
- ...props,
11650
- key: option.value,
11651
- className: `${props.className || ""} ${optionClassName}`.trim(),
11652
- style: {
11653
- ...props.style,
11654
- opacity: option.disabled ? 0.5 : 1,
11655
- pointerEvents: option.disabled ? "none" : "auto"
11656
- }
11657
- },
11658
- /* @__PURE__ */ jsx(
11659
- Checkbox,
11660
- {
11661
- checked: selected,
11662
- disabled: option.disabled,
11663
- sx: {
11664
- color: "text.secondary",
11665
- "&.Mui-checked": {
11666
- color: "primary.main"
11667
- },
11668
- "&.Mui-disabled": {
11669
- color: "text.disabled"
11670
- },
11671
- mr: 1,
11672
- ...checkboxProps.sx
11673
- },
11674
- ...checkboxProps
11675
- }
11676
- ),
11677
- option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
11678
- /* @__PURE__ */ jsx(
11679
- Typography,
11680
- {
11681
- variant: "body2",
11682
- sx: [
11683
- {
11684
- color: option.disabled ? "text.disabled" : "text.primary",
11685
- ...option.textSx
11686
- },
11687
- ...Array.isArray(optionSx) ? optionSx : [optionSx]
11688
- ],
11689
- children: option.label
11690
- }
11691
- )
11692
- );
11693
- const defaultRenderTags = (value, getTagProps) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
11694
- const { key, ...tagProps } = getTagProps({ index });
11695
- return /* @__PURE__ */ createElement(
11696
- Chip,
11697
- {
11698
- ...tagProps,
11699
- key: option.value,
11700
- label: option.label,
11701
- disabled: disabled || option.disabled,
11702
- sx: [
11703
- {
11704
- height: "24px",
11705
- borderRadius: "4px",
11706
- "& .MuiChip-deleteIcon": {
11707
- color: "text.secondary",
11708
- "&:hover": {
11709
- color: "text.primary"
11710
- }
11711
- },
11712
- ...chipSx
11713
- },
11714
- ...Array.isArray(chipSx) ? chipSx : [chipSx]
11715
- ],
11716
- className: `${chipClassName} ${option.disabled ? "Mui-disabled" : ""}`.trim(),
11717
- ...chipProps
11718
- }
11719
- );
11720
- }) });
11721
- const renderSelectedCount = () => {
11722
- if (!showSelectedCount || !multiple)
11723
- return null;
11724
- return /* @__PURE__ */ jsxs(
11725
- Typography,
11726
- {
11727
- variant: "caption",
11728
- sx: [
11729
- {
11730
- mt: 0.5,
11731
- color: "text.secondary",
11732
- ...selectedCountSx
11733
- },
11734
- ...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
11735
- ],
11736
- children: [
11737
- `${selectedCount} selected`,
11738
- maxSelections ? ` (max ${maxSelections})` : ""
11739
- ]
11740
- }
11741
- );
11742
- };
11743
- return /* @__PURE__ */ jsx(
11744
- Box,
11745
- {
11746
- ref,
11747
- className: `app-searchable-multi-selector ${className}`.trim(),
11748
- sx: [
11749
- {
11750
- width: "100%"
11751
- },
11752
- ...Array.isArray(sx) ? sx : sx ? [sx] : []
11753
- ],
11754
- children: /* @__PURE__ */ jsxs(
11755
- FormControl,
11756
- {
11757
- fullWidth: true,
11758
- error: hasError,
11759
- disabled,
11760
- className: `app-searchable-multi-selector-form-control ${formControlClassName}`.trim(),
11761
- sx: [
11762
- {
11763
- "& .MuiAutocomplete-root": {
11764
- "& .MuiOutlinedInput-root": {
11765
- padding: "4px"
11766
- },
11767
- "& .MuiAutocomplete-input": {
11768
- padding: "8.5px 4px"
11769
- }
11770
- }
11771
- },
11772
- ...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
11773
- ],
11774
- children: [
11775
- label && /* @__PURE__ */ jsxs(
11776
- LabelComponent,
11777
- {
11778
- shrink: true,
11779
- htmlFor: `autocomplete-${name}`,
11780
- className: `app-searchable-multi-selector-label ${labelClassName}`.trim(),
11781
- sx: [
11782
- {
11783
- mb: 1,
11784
- color: hasError ? "error.main" : "text.primary",
11785
- "&.Mui-focused": {
11786
- color: hasError ? "error.main" : "primary.main"
11787
- },
11788
- ...Array.isArray(labelSx) ? labelSx : [labelSx]
11789
- }
11790
- ],
11791
- ...labelProps,
11792
- children: [
11793
- label,
11794
- required && /* @__PURE__ */ jsx(
11795
- Box,
11796
- {
11797
- component: "span",
11798
- sx: {
11799
- color: "error.main",
11800
- ml: 0.5
11801
- },
11802
- children: "*"
11803
- }
11804
- )
11805
- ]
11806
- }
11807
- ),
11808
- /* @__PURE__ */ jsx(
11809
- Autocomplete,
11810
- {
11811
- multiple,
11812
- id: `autocomplete-${name}`,
11813
- options,
11814
- value: selectedValues,
11815
- filterOptions,
11816
- onInputChange: handleInputChange,
11817
- onChange: handleChange,
11818
- onOpen,
11819
- onClose,
11820
- onBlur: handleBlur,
11821
- onFocus: handleFocus,
11822
- disableCloseOnSelect: multiple,
11823
- readOnly,
11824
- disabled,
11825
- isOptionEqualToValue: (option, value) => option.value === value.value,
11826
- getOptionLabel: (option) => typeof option === "string" ? option : option.label,
11827
- getOptionDisabled: (option) => !!option.disabled,
11828
- renderInput: externalRenderInput || defaultRenderInput,
11829
- renderOption: externalRenderOption || defaultRenderOption,
11830
- renderTags: externalRenderTags || defaultRenderTags,
11831
- renderGroup: externalRenderGroup,
11832
- ListboxProps: {
11833
- className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
11834
- sx: {
11835
- "& .MuiAutocomplete-option": {
11836
- px: 2,
11837
- py: 1,
11838
- '&[aria-selected="true"]': {
11839
- backgroundColor: "action.selected",
11840
- "&.Mui-focused": {
11841
- backgroundColor: "action.hover"
11842
- }
11843
- },
11844
- "&.Mui-focused": {
11845
- backgroundColor: "action.hover"
11846
- }
11847
- },
11848
- ...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
11849
- ...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
11850
- }
11851
- },
11852
- className: `app-searchable-multi-selector-autocomplete ${autocompleteClassName}`.trim(),
11853
- sx: [
11854
- {
11855
- "& .MuiAutocomplete-tag": {
11856
- margin: 0,
11857
- height: "auto"
11858
- },
11859
- "& .MuiAutocomplete-endAdornment": {
11860
- right: 8
11861
- }
11862
- },
11863
- ...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
11864
- ],
11865
- ...autocompleteProps,
11866
- ...otherProps
11867
- }
11868
- ),
11869
- (showHelperText || hasError) && /* @__PURE__ */ jsx(
11870
- HelperTextComponent,
11871
- {
11872
- error: hasError,
11873
- sx: [
11874
- {
11875
- mx: 0,
11876
- mt: 0.5,
11877
- ...hasError ? {
11878
- color: "error.main",
11879
- ...errorSx
11880
- } : {
11881
- color: "text.secondary",
11882
- ...helperTextSx
11883
- }
11884
- }
11885
- ],
11886
- className: `app-searchable-multi-selector-helper-text ${helperTextClassName} ${hasError ? "Mui-error" : ""}`.trim(),
11887
- ...helperTextProps,
11888
- children: hasError ? fieldError : helperText
11889
- }
11890
- ),
11891
- renderSelectedCount()
11892
- ]
11893
- }
11894
- )
11895
- }
11896
- );
11897
- }
11898
- );
11899
- AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
11900
- var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
11901
- function AppSearchableSelectInput({
11902
- name,
11903
- label,
11904
- options = [],
11905
- required = false,
11906
- variant = "outlined",
11907
- placeholder,
11908
- setSearchQuery,
11909
- isResetRequired,
11910
- ...otherProps
11911
- }) {
11912
- const { errors, touched, setFieldValue, values } = useFormikContext();
11913
- const fieldError = _19.get(errors, name);
11914
- const isTouched = _19.get(touched, name);
11915
- const val = _19.get(values, name);
11916
- const selectedOption = options.find((option) => option.value === val) || null;
11917
- const handleChange = (event, newValue) => {
11918
- setFieldValue(name, newValue ? newValue.value : "");
11919
- };
11920
- const handleSearchChange = (event) => {
11921
- const { value } = event.target;
11922
- if (setSearchQuery) {
11923
- setSearchQuery(value);
11924
- }
11925
- };
11926
- return /* @__PURE__ */ jsx(
11927
- FormControl,
11928
- {
11929
- fullWidth: true,
11930
- variant,
11931
- error: isTouched && Boolean(fieldError),
11932
- sx: {
11933
- padding: "0px !important",
11934
- ".MuiAutocomplete-endAdornment": { right: "0 !important" },
11935
- ".MuiInputBase-root": {
11936
- padding: "0px !important",
11937
- pr: "39px !important",
11938
- pl: "10px !important"
11939
- },
11940
- ".MuiOutlinedInput-root": {
11941
- backgroundColor: (theme) => `${theme.palette.common.white} !important`
11942
- }
11943
- },
11944
- children: /* @__PURE__ */ jsx(
11945
- Autocomplete,
11946
- {
11947
- options,
11948
- getOptionLabel: (option) => option.label || String(option.value),
11949
- isOptionEqualToValue: (option, value) => option.value === value.value,
11950
- value: selectedOption,
11951
- onChange: handleChange,
11952
- filterOptions: (options2, { inputValue }) => {
11953
- return options2.filter(
11954
- (option) => {
11955
- var _a, _b, _c, _d;
11956
- 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()));
11957
- }
11958
- );
11959
- },
11960
- renderInput: (params) => /* @__PURE__ */ jsx(
11961
- TextField,
11962
- {
11963
- ...params,
11964
- onChange: handleSearchChange,
11965
- label: /* @__PURE__ */ jsxs(Fragment, { children: [
11966
- label,
11967
- required && /* @__PURE__ */ jsx(Typography, { sx: { color: "red" }, component: "span", children: " *" })
11968
- ] }),
11969
- variant,
11970
- placeholder,
11971
- error: Boolean(fieldError) && isTouched,
11972
- helperText: isTouched && fieldError ? fieldError : "",
11973
- FormHelperTextProps: {
11974
- sx: { color: "#FF5630" }
11975
- },
11976
- sx: {
11977
- "& .MuiInputLabel-root": {
11978
- color: "text.primary"
11979
- },
11980
- "& .MuiInputLabel-root.Mui-focused": {
11981
- color: "text.primary"
11982
- },
11983
- "& .MuiOutlinedInput-input": {
11984
- color: "common.black"
11985
- },
11986
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
11987
- borderColor: "common.white"
11988
- },
11989
- "& .MuiSvgIcon-root": {
11990
- color: "common.black"
11991
- }
11992
- }
11993
- }
11994
- ),
11995
- ...otherProps
11996
- }
11997
- )
11998
- }
11999
- );
12000
- }
12001
11426
  var AppSelectInput = forwardRef(
12002
11427
  ({
12003
11428
  name,
@@ -12021,10 +11446,10 @@ var AppSelectInput = forwardRef(
12021
11446
  }, ref) => {
12022
11447
  const theme = useTheme();
12023
11448
  const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
12024
- const fieldError = _19.get(errors, name);
12025
- const isTouched = Boolean(_19.get(touched, name));
11449
+ const fieldError = _17.get(errors, name);
11450
+ const isTouched = Boolean(_17.get(touched, name));
12026
11451
  const hasError = Boolean(fieldError) && isTouched;
12027
- const currentValue = _19.get(values, name);
11452
+ const currentValue = _17.get(values, name);
12028
11453
  const handleValueChange = (newValue) => {
12029
11454
  setFieldValue(name, newValue, true);
12030
11455
  if (externalOnChange) {
@@ -12036,7 +11461,7 @@ var AppSelectInput = forwardRef(
12036
11461
  };
12037
11462
  const selectedOption = options.find((opt) => opt.value === currentValue) || null;
12038
11463
  if (mode === "autocomplete") {
12039
- const debouncedSearch = React4.useRef();
11464
+ const debouncedSearch = React3.useRef();
12040
11465
  const handleSearchChange = (query) => {
12041
11466
  if (debouncedSearch.current) {
12042
11467
  clearTimeout(debouncedSearch.current);
@@ -12052,10 +11477,7 @@ var AppSelectInput = forwardRef(
12052
11477
  return options2;
12053
11478
  const inputValueLower = inputValue.toLowerCase();
12054
11479
  return options2.filter(
12055
- (option) => {
12056
- var _a, _b, _c;
12057
- 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));
12058
- }
11480
+ (option) => option.label.toLowerCase().includes(inputValueLower) || String(option.value).toLowerCase().includes(inputValueLower)
12059
11481
  );
12060
11482
  };
12061
11483
  return /* @__PURE__ */ jsx(Box, { ref, sx, children: /* @__PURE__ */ jsx(
@@ -12111,20 +11533,23 @@ var AppSelectInput = forwardRef(
12111
11533
  }
12112
11534
  }
12113
11535
  ),
12114
- renderOption: (props, option) => /* @__PURE__ */ jsxs("li", { ...props, children: [
12115
- option.icon,
12116
- /* @__PURE__ */ jsx(
12117
- Typography,
12118
- {
12119
- variant: "body2",
12120
- sx: {
12121
- color: option.disabled ? "text.disabled" : "text.primary",
12122
- ...option.textSx
12123
- },
12124
- children: option.label
12125
- }
12126
- )
12127
- ] })
11536
+ renderOption: (props, option) => {
11537
+ const { key, ...restProps } = props;
11538
+ return /* @__PURE__ */ jsxs("li", { ...restProps, children: [
11539
+ option.icon,
11540
+ /* @__PURE__ */ jsx(
11541
+ Typography,
11542
+ {
11543
+ variant: "body2",
11544
+ sx: {
11545
+ color: option.disabled ? "text.disabled" : "text.primary",
11546
+ ...option.textSx
11547
+ },
11548
+ children: option.label
11549
+ }
11550
+ )
11551
+ ] }, key);
11552
+ }
12128
11553
  }
12129
11554
  )
12130
11555
  }
@@ -12223,7 +11648,7 @@ var AppSelectInput_default = AppSelectInput;
12223
11648
  var AppSimpleUploadFile = ({
12224
11649
  name,
12225
11650
  label = "Upload Files",
12226
- accept = "image/*",
11651
+ accept = "",
12227
11652
  multiple = false,
12228
11653
  disabled = false,
12229
11654
  required = false,
@@ -12238,8 +11663,8 @@ var AppSimpleUploadFile = ({
12238
11663
  onError
12239
11664
  }) => {
12240
11665
  const { setFieldValue, values, errors, touched } = useFormikContext();
12241
- const fieldValue = _19.get(values, name);
12242
- const fieldError = _19.get(touched, name) ? _19.get(errors, name) : void 0;
11666
+ const fieldValue = _17.get(values, name);
11667
+ const fieldError = _17.get(touched, name) ? _17.get(errors, name) : void 0;
12243
11668
  const handleChange = (event) => {
12244
11669
  const files = event.target.files;
12245
11670
  if (!files || files.length === 0)
@@ -12266,7 +11691,7 @@ var AppSimpleUploadFile = ({
12266
11691
  if (!fieldValue || index < 0 || index >= fieldValue.length)
12267
11692
  return;
12268
11693
  const fileToRemove = fieldValue[index];
12269
- const newFiles = fieldValue.filter((_20, i) => i !== index);
11694
+ const newFiles = fieldValue.filter((_18, i) => i !== index);
12270
11695
  setFieldValue(name, newFiles);
12271
11696
  onRemove == null ? void 0 : onRemove(fileToRemove);
12272
11697
  if (fileToRemove.preview) {
@@ -13818,12 +13243,12 @@ function Placeholder({ sx, ...other }) {
13818
13243
  var AppUploadFile = ({ name, ...rest }) => {
13819
13244
  var _a, _b, _c;
13820
13245
  const { errors, touched, setFieldValue, values } = useFormikContext();
13821
- const fieldError = _19.get(errors, name);
13822
- const isTouched = _19.get(touched, name);
13823
- let val = _19.get(values, name);
13246
+ const fieldError = _17.get(errors, name);
13247
+ const isTouched = _17.get(touched, name);
13248
+ let val = _17.get(values, name);
13824
13249
  if (((_a = rest.multiple) != null ? _a : false) && typeof val === "string") {
13825
13250
  val = val ? [val] : [];
13826
- } else if (!((_b = rest.multiple) != null ? _b : false) && _19.isArray(val)) {
13251
+ } else if (!((_b = rest.multiple) != null ? _b : false) && _17.isArray(val)) {
13827
13252
  val = val[0];
13828
13253
  }
13829
13254
  ((_c = rest.multiple) != null ? _c : false) ? (val != null ? val : []).map((__) => (__ == null ? void 0 : __.file) ? __ == null ? void 0 : __.file : __) : val;
@@ -13980,6 +13405,6 @@ var SubmitButton = ({
13980
13405
  };
13981
13406
  var SubmitButton_default = SubmitButton;
13982
13407
 
13983
- export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor, AppSearchableMultiSelector_default as AppSearchableMultiSelector, AppSearchableSelectInput, AppSelectInput_default as AppSelectInput, AppSimpleUploadFile_default as AppSimpleUploadFile, AppSwitch, AppSwitchInput, AppTagsCreator, AppTextArea_default as AppTextArea, AppUploadFile_default as AppUploadFile, Form_default as Form, Iconify_default as Iconify, SubmitButton_default as SubmitButton };
13408
+ export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor, AppSelectInput_default as AppSelectInput, AppSimpleUploadFile_default as AppSimpleUploadFile, AppSwitch, AppSwitchInput, AppTagsCreator, AppTextArea_default as AppTextArea, AppUploadFile_default as AppUploadFile, Form_default as Form, Iconify_default as Iconify, SubmitButton_default as SubmitButton };
13984
13409
  //# sourceMappingURL=out.js.map
13985
13410
  //# sourceMappingURL=index.mjs.map