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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var formik = require('formik');
4
- var React4 = require('react');
4
+ var React3 = require('react');
5
5
  var material = require('@mui/material');
6
6
  var DatePicker = require('@mui/x-date-pickers/DatePicker');
7
7
  var LocalizationProvider = require('@mui/x-date-pickers/LocalizationProvider');
@@ -10,8 +10,6 @@ var CalendarMonthIcon = require('@mui/icons-material/CalendarMonth');
10
10
  var _17 = require('lodash');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var DateTimePicker = require('@mui/x-date-pickers/DateTimePicker');
13
- var Autocomplete3 = require('@mui/material/Autocomplete');
14
- var Typography9 = require('@mui/material/Typography');
15
13
  var react = require('@iconify/react');
16
14
  var PhoneInput = require('react-phone-number-input');
17
15
  require('react-phone-number-input/style.css');
@@ -41,11 +39,9 @@ var reactI18next = require('react-i18next');
41
39
 
42
40
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
43
41
 
44
- var React4__default = /*#__PURE__*/_interopDefault(React4);
42
+ var React3__default = /*#__PURE__*/_interopDefault(React3);
45
43
  var CalendarMonthIcon__default = /*#__PURE__*/_interopDefault(CalendarMonthIcon);
46
44
  var _17__default = /*#__PURE__*/_interopDefault(_17);
47
- var Autocomplete3__default = /*#__PURE__*/_interopDefault(Autocomplete3);
48
- var Typography9__default = /*#__PURE__*/_interopDefault(Typography9);
49
45
  var PhoneInput__default = /*#__PURE__*/_interopDefault(PhoneInput);
50
46
  var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
51
47
  var Link__default = /*#__PURE__*/_interopDefault(Link);
@@ -66,17 +62,18 @@ var CloudUploadIcon__default = /*#__PURE__*/_interopDefault(CloudUploadIcon);
66
62
  var CloseIcon__default = /*#__PURE__*/_interopDefault(CloseIcon);
67
63
 
68
64
  // src/Form/index.tsx
69
- var AppDatePicker = React4.forwardRef(
65
+ var AppDatePicker = React3.forwardRef(
70
66
  ({
71
67
  name,
72
68
  label,
73
69
  disabled = false,
70
+ disablePast = false,
74
71
  format = "DD/MM/YYYY",
75
72
  sx,
76
73
  textFieldSx,
77
74
  ...otherProps
78
75
  }, ref) => {
79
- const { values, setFieldValue, touched, errors, setFieldTouched } = formik.useFormikContext();
76
+ const { values, setFieldValue, touched, errors } = formik.useFormikContext();
80
77
  const fieldValue = _17__default.default.get(values, name);
81
78
  const fieldError = _17__default.default.get(errors, name);
82
79
  const isTouched = _17__default.default.get(touched, name);
@@ -89,10 +86,10 @@ var AppDatePicker = React4.forwardRef(
89
86
  label,
90
87
  value: fieldValue,
91
88
  onChange: handleChange,
92
- format,
93
89
  disabled,
90
+ disablePast,
94
91
  slots: {
95
- openPickerIcon: CalendarMonthIcon__default.default
92
+ openPickerIcon: () => /* @__PURE__ */ jsxRuntime.jsx(CalendarMonthIcon__default.default, {})
96
93
  },
97
94
  slotProps: {
98
95
  textField: {
@@ -100,7 +97,8 @@ var AppDatePicker = React4.forwardRef(
100
97
  fullWidth: true,
101
98
  error: isTouched && Boolean(fieldError),
102
99
  helperText: isTouched && fieldError ? fieldError : void 0,
103
- sx: textFieldSx
100
+ sx: textFieldSx,
101
+ inputFormat: format
104
102
  }
105
103
  },
106
104
  ...otherProps
@@ -110,7 +108,7 @@ var AppDatePicker = React4.forwardRef(
110
108
  );
111
109
  AppDatePicker.displayName = "AppDatePicker";
112
110
  var AppDatePicker_default = AppDatePicker;
113
- var AppDateAndTimePicker = React4.forwardRef((props, ref) => {
111
+ var AppDateAndTimePicker = React3.forwardRef((props, ref) => {
114
112
  const {
115
113
  name,
116
114
  label,
@@ -320,20 +318,25 @@ function AppFormErrorMessage({
320
318
  return showError ? /* @__PURE__ */ jsxRuntime.jsx(
321
319
  material.Box,
322
320
  {
323
- sx: [{
324
- mt: 0.5,
325
- ...containerSx
326
- }, sx],
321
+ sx: [
322
+ {
323
+ mt: 0.5,
324
+ ...containerSx
325
+ },
326
+ sx
327
+ ],
327
328
  children: /* @__PURE__ */ jsxRuntime.jsx(
328
329
  material.Typography,
329
330
  {
330
331
  variant: "caption",
331
332
  color: "error",
332
- sx: [{
333
- fontSize: "0.75rem",
334
- display: "block",
335
- ...textSx
336
- }],
333
+ sx: [
334
+ {
335
+ fontSize: "0.75rem",
336
+ display: "block",
337
+ ...textSx
338
+ }
339
+ ],
337
340
  children: fieldError
338
341
  }
339
342
  )
@@ -344,20 +347,25 @@ function AppFormErrorMessage({
344
347
  return /* @__PURE__ */ jsxRuntime.jsx(
345
348
  material.Box,
346
349
  {
347
- sx: [{
348
- mt: 0.5,
349
- ...containerSx
350
- }, sx],
350
+ sx: [
351
+ {
352
+ mt: 0.5,
353
+ ...containerSx
354
+ },
355
+ sx
356
+ ],
351
357
  children: /* @__PURE__ */ jsxRuntime.jsx(
352
358
  material.Typography,
353
359
  {
354
360
  variant: "caption",
355
361
  color: "error",
356
- sx: [{
357
- fontSize: "0.75rem",
358
- display: "block",
359
- ...textSx
360
- }],
362
+ sx: [
363
+ {
364
+ fontSize: "0.75rem",
365
+ display: "block",
366
+ ...textSx
367
+ }
368
+ ],
361
369
  children: fieldError
362
370
  }
363
371
  )
@@ -367,7 +375,7 @@ function AppFormErrorMessage({
367
375
  return null;
368
376
  }
369
377
  var AppFormErrorMessage_default = AppFormErrorMessage;
370
- var AppTextArea = React4.forwardRef(({
378
+ var AppTextArea = React3.forwardRef(({
371
379
  name,
372
380
  label,
373
381
  placeholder = "Enter text...",
@@ -573,7 +581,7 @@ function AppTagsCreator({
573
581
  flexWrap: "wrap",
574
582
  gap: 0.5,
575
583
  ...chipContainerSx
576
- }, children: value == null ? void 0 : value.map((option, index) => /* @__PURE__ */ React4.createElement(
584
+ }, children: value == null ? void 0 : value.map((option, index) => /* @__PURE__ */ React3.createElement(
577
585
  material.Chip,
578
586
  {
579
587
  variant: "outlined",
@@ -892,7 +900,7 @@ function AppAutoComplete({
892
900
  id: "tags-filled",
893
901
  options,
894
902
  freeSolo: true,
895
- renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ React4.createElement(
903
+ renderTags: (value, getTagProps) => value.map((option, index) => /* @__PURE__ */ React3.createElement(
896
904
  material.Chip,
897
905
  {
898
906
  variant: "outlined",
@@ -941,64 +949,88 @@ function AppAutoComplete({
941
949
  ] });
942
950
  }
943
951
  function AppAutoCompleter({
944
- placeholder,
945
952
  name,
946
953
  label,
954
+ placeholder,
947
955
  options,
948
- disabled,
956
+ multiple = false,
957
+ freeSolo = false,
949
958
  sx,
950
959
  formControlSx,
951
960
  textFieldSx,
952
- listboxSx,
953
- errorSx
961
+ chipSx,
962
+ errorSx,
963
+ ...rest
954
964
  }) {
955
965
  const { errors, touched, values, setFieldValue } = formik.useFormikContext();
956
966
  const fieldError = _17__default.default.get(errors, name);
957
967
  const isTouched = _17__default.default.get(touched, name);
958
- const value = _17__default.default.get(values, name);
959
- const selectedOption = options.find((opt) => opt.value === value) || null;
960
- return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, variant: "filled", sx: formControlSx, children: [
968
+ const formikValue = _17__default.default.get(values, name);
969
+ const isObjectOption = typeof options[0] === "object";
970
+ const resolvedValue = React3__default.default.useMemo(() => {
971
+ var _a;
972
+ if (!isObjectOption)
973
+ return formikValue != null ? formikValue : multiple ? [] : null;
974
+ if (multiple) {
975
+ return options.filter(
976
+ (opt) => (formikValue != null ? formikValue : []).includes(opt.value)
977
+ );
978
+ }
979
+ return (_a = options.find((opt) => opt.value === formikValue)) != null ? _a : null;
980
+ }, [formikValue, options, multiple, isObjectOption]);
981
+ const handleChange = (event, newValue, reason) => {
982
+ var _a, _b;
983
+ if (!isObjectOption) {
984
+ setFieldValue(name, newValue);
985
+ return;
986
+ }
987
+ if (multiple) {
988
+ setFieldValue(
989
+ name,
990
+ (_a = newValue == null ? void 0 : newValue.map((v) => v.value)) != null ? _a : []
991
+ );
992
+ } else {
993
+ setFieldValue(name, (_b = newValue == null ? void 0 : newValue.value) != null ? _b : null);
994
+ }
995
+ };
996
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, sx: formControlSx, children: [
961
997
  /* @__PURE__ */ jsxRuntime.jsx(
962
- Autocomplete3__default.default,
998
+ material.Autocomplete,
963
999
  {
964
- id: `${name}-autocomplete`,
1000
+ multiple,
1001
+ freeSolo,
965
1002
  options,
966
- value: selectedOption,
967
- getOptionLabel: (option) => (option == null ? void 0 : option.label) || "",
968
- isOptionEqualToValue: (option, value2) => option.value === value2.value,
969
- autoHighlight: true,
970
- onChange: (_18, newValue) => {
971
- setFieldValue(name, newValue ? newValue.value : null);
972
- },
973
- renderOption: (props, option) => /* @__PURE__ */ React4.createElement(material.Box, { component: "li", ...props, key: option.value, sx: listboxSx }, option.label),
1003
+ value: resolvedValue,
1004
+ onChange: handleChange,
1005
+ getOptionLabel: (option) => typeof option === "string" ? option : option.label,
1006
+ isOptionEqualToValue: (option, value) => typeof option === "string" || typeof value === "string" ? option === value : option.value === value.value,
1007
+ renderTags: (value, getTagProps) => value.map((option, index) => {
1008
+ const tagProps = getTagProps({ index });
1009
+ return /* @__PURE__ */ jsxRuntime.jsx(
1010
+ material.Chip,
1011
+ {
1012
+ ...tagProps,
1013
+ label: typeof option === "string" ? option : option.label,
1014
+ sx: chipSx
1015
+ }
1016
+ );
1017
+ }),
974
1018
  renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
975
1019
  material.TextField,
976
1020
  {
977
1021
  ...params,
978
1022
  label,
979
1023
  placeholder,
980
- error: Boolean(fieldError) && isTouched,
1024
+ error: Boolean(fieldError && isTouched),
981
1025
  helperText: isTouched && fieldError,
982
1026
  sx: textFieldSx
983
1027
  }
984
1028
  ),
985
- disabled,
986
- sx
1029
+ sx,
1030
+ ...rest
987
1031
  }
988
1032
  ),
989
- fieldError != null && isTouched === true && /* @__PURE__ */ jsxRuntime.jsx(
990
- material.Typography,
991
- {
992
- variant: "caption",
993
- display: "block",
994
- gutterBottom: true,
995
- sx: {
996
- color: "#FF5630",
997
- ...errorSx
998
- },
999
- children: fieldError
1000
- }
1001
- )
1033
+ fieldError && isTouched && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", sx: { color: "#FF5630", ...errorSx }, children: fieldError })
1002
1034
  ] });
1003
1035
  }
1004
1036
  var AppCheckBox = ({
@@ -1015,19 +1047,17 @@ var AppCheckBox = ({
1015
1047
  containerSx,
1016
1048
  iconSx,
1017
1049
  checkedSx,
1018
- ...rest
1050
+ checkboxProps
1019
1051
  }) => {
1020
1052
  const { getFieldProps, setFieldValue, touched, errors } = formik.useFormikContext();
1021
1053
  const fieldError = _17__default.default.get(errors, name);
1022
1054
  const isTouched = _17__default.default.get(touched, name);
1023
- material.useTheme();
1024
1055
  const value = getFieldProps(name).value;
1025
- const checkedValues = (() => {
1026
- if (Array.isArray(value)) {
1056
+ const checkedValues = React3__default.default.useMemo(() => {
1057
+ if (Array.isArray(value))
1027
1058
  return value.map(String);
1028
- }
1029
1059
  return value ? [String(value)] : [];
1030
- })();
1060
+ }, [value]);
1031
1061
  const handleChange = (itemValue, isChecked) => {
1032
1062
  if (option.length === 1) {
1033
1063
  setFieldValue(name, isChecked ? itemValue : false);
@@ -1039,119 +1069,109 @@ var AppCheckBox = ({
1039
1069
  return /* @__PURE__ */ jsxRuntime.jsxs(
1040
1070
  material.Box,
1041
1071
  {
1042
- sx: [{
1043
- width: "100%",
1044
- ...disabled && {
1045
- opacity: 0.7,
1046
- pointerEvents: "none"
1047
- }
1048
- }, ...Array.isArray(sx) ? sx : [sx]],
1072
+ sx: [
1073
+ {
1074
+ width: "100%",
1075
+ ...disabled && { opacity: 0.7, pointerEvents: "none" }
1076
+ },
1077
+ ...Array.isArray(sx) ? sx : [sx]
1078
+ ],
1049
1079
  children: [
1050
1080
  label && /* @__PURE__ */ jsxRuntime.jsx(
1051
- Typography9__default.default,
1081
+ material.Typography,
1052
1082
  {
1053
1083
  variant: "subtitle2",
1054
1084
  gutterBottom: true,
1055
- sx: [{
1056
- color: "text.primary",
1057
- fontWeight: "medium",
1058
- ...required && {
1059
- "&:after": {
1060
- content: '" *"',
1061
- color: "error.main"
1062
- }
1085
+ sx: [
1086
+ {
1087
+ color: "text.primary",
1088
+ fontWeight: "medium",
1089
+ ...required && {
1090
+ "&:after": { content: '" *"', color: "error.main" }
1091
+ },
1092
+ ...disabled && { color: "text.disabled" }
1063
1093
  },
1064
- ...disabled && {
1065
- color: "text.disabled"
1066
- }
1067
- }, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
1094
+ ...Array.isArray(labelSx) ? labelSx : [labelSx]
1095
+ ],
1068
1096
  children: label
1069
1097
  }
1070
1098
  ),
1071
1099
  /* @__PURE__ */ jsxRuntime.jsx(
1072
1100
  material.Box,
1073
1101
  {
1074
- sx: [{
1075
- display: "flex",
1076
- flexDirection: row ? "row" : "column",
1077
- flexWrap: row ? "wrap" : "nowrap",
1078
- gap: 2,
1079
- ...row ? {
1080
- "& > *": {
1081
- minWidth: "fit-content"
1082
- }
1083
- } : {}
1084
- }, ...Array.isArray(containerSx) ? containerSx : [containerSx]],
1085
- children: option.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1086
- material.Box,
1102
+ sx: [
1087
1103
  {
1088
- sx: [{
1089
- display: "flex",
1090
- alignItems: "center",
1091
- borderRadius: 1,
1092
- transition: "background-color 0.2s",
1093
- "&:hover": {
1094
- backgroundColor: !disabled ? "action.hover" : "transparent"
1095
- },
1096
- px: 2,
1097
- py: 1,
1098
- ...disabled && {
1099
- color: "text.disabled"
1100
- }
1101
- }],
1102
- children: [
1103
- /* @__PURE__ */ jsxRuntime.jsx(
1104
- material.Checkbox,
1105
- {
1106
- name: `${name}.${item.name}`,
1107
- checked: option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value)),
1108
- onChange: (e) => handleChange(item.value, e.target.checked),
1109
- disabled: disabled || item.disabled,
1110
- sx: [{
1111
- color: "primary.main",
1112
- "&.Mui-checked": {
1113
- color: "primary.main",
1114
- ...checkedSx
1115
- },
1116
- "& .MuiSvgIcon-root": {
1117
- fontSize: 24,
1118
- ...iconSx
1119
- },
1120
- "&.Mui-disabled": {
1121
- color: "action.disabled"
1122
- }
1123
- }, ...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]],
1124
- ...rest
1125
- }
1126
- ),
1127
- /* @__PURE__ */ jsxRuntime.jsx(
1128
- Typography9__default.default,
1129
- {
1130
- variant: "body2",
1131
- sx: [{
1132
- color: disabled ? "text.disabled" : "text.primary",
1133
- ...disabled && {
1134
- color: "text.disabled"
1135
- }
1136
- }, ...Array.isArray(labelSx) ? labelSx : [labelSx]],
1137
- children: item.label
1138
- }
1139
- )
1140
- ]
1104
+ display: "flex",
1105
+ flexDirection: row ? "row" : "column",
1106
+ flexWrap: row ? "wrap" : "nowrap",
1107
+ gap: 2,
1108
+ ...row && { "& > *": { minWidth: "fit-content" } }
1141
1109
  },
1142
- item.name
1143
- ))
1110
+ ...Array.isArray(containerSx) ? containerSx : [containerSx]
1111
+ ],
1112
+ children: option.map((item) => {
1113
+ const isChecked = option.length === 1 ? getFieldProps(name).value === item.value : checkedValues.includes(String(item.value));
1114
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1115
+ material.Box,
1116
+ {
1117
+ sx: {
1118
+ display: "flex",
1119
+ alignItems: "center",
1120
+ borderRadius: 1,
1121
+ transition: "background-color 0.2s",
1122
+ "&:hover": {
1123
+ backgroundColor: !disabled ? "action.hover" : "transparent"
1124
+ },
1125
+ px: 2,
1126
+ py: 1,
1127
+ ...disabled && { color: "text.disabled" }
1128
+ },
1129
+ children: [
1130
+ /* @__PURE__ */ jsxRuntime.jsx(
1131
+ material.Checkbox,
1132
+ {
1133
+ name: `${name}.${item.name}`,
1134
+ checked: isChecked,
1135
+ onChange: (e) => handleChange(item.value, e.target.checked),
1136
+ disabled: disabled || item.disabled,
1137
+ sx: [
1138
+ {
1139
+ color: "primary.main",
1140
+ "&.Mui-checked": { color: "primary.main", ...checkedSx },
1141
+ "& .MuiSvgIcon-root": { fontSize: 24, ...iconSx },
1142
+ "&.Mui-disabled": { color: "action.disabled" }
1143
+ },
1144
+ ...Array.isArray(checkboxSx) ? checkboxSx : [checkboxSx]
1145
+ ],
1146
+ ...checkboxProps
1147
+ }
1148
+ ),
1149
+ /* @__PURE__ */ jsxRuntime.jsx(
1150
+ material.Typography,
1151
+ {
1152
+ variant: "body2",
1153
+ sx: [
1154
+ { color: disabled ? "text.disabled" : "text.primary" },
1155
+ ...Array.isArray(labelSx) ? labelSx : [labelSx]
1156
+ ],
1157
+ children: item.label
1158
+ }
1159
+ )
1160
+ ]
1161
+ },
1162
+ item.name
1163
+ );
1164
+ })
1144
1165
  }
1145
1166
  ),
1146
1167
  isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
1147
- Typography9__default.default,
1168
+ material.Typography,
1148
1169
  {
1149
1170
  variant: "caption",
1150
- sx: [{
1151
- display: "block",
1152
- mt: 0.5,
1153
- color: "error.main"
1154
- }, ...Array.isArray(errorSx) ? errorSx : [errorSx]],
1171
+ sx: [
1172
+ { display: "block", mt: 0.5, color: "error.main" },
1173
+ ...Array.isArray(errorSx) ? errorSx : [errorSx]
1174
+ ],
1155
1175
  children: fieldError
1156
1176
  }
1157
1177
  )
@@ -1160,7 +1180,7 @@ var AppCheckBox = ({
1160
1180
  );
1161
1181
  };
1162
1182
  var AppCheckBox_default = AppCheckBox;
1163
- var Iconify = React4.forwardRef(({ icon, width = 20, color, sx, ...other }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1183
+ var Iconify = React3.forwardRef(({ icon, width = 20, color, sx, ...other }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1164
1184
  material.Box,
1165
1185
  {
1166
1186
  ref,
@@ -1176,63 +1196,27 @@ function AppInputField({
1176
1196
  name,
1177
1197
  label,
1178
1198
  type,
1179
- InputProps,
1180
1199
  required,
1181
1200
  variant = "outlined",
1201
+ InputProps,
1182
1202
  ...otherProps
1183
1203
  }) {
1184
1204
  const { errors, getFieldProps, touched } = formik.useFormikContext();
1185
1205
  const fieldError = _17__default.default.get(errors, name);
1186
1206
  const isTouched = _17__default.default.get(touched, name);
1187
- const [showPassword, setShowPassword] = React4.useState(false);
1188
- const handleShowPassword = () => {
1189
- setShowPassword(!showPassword);
1190
- };
1207
+ const [showPassword, setShowPassword] = React3.useState(false);
1208
+ const handleShowPassword = () => setShowPassword(!showPassword);
1191
1209
  return /* @__PURE__ */ jsxRuntime.jsx(
1192
1210
  material.TextField,
1193
1211
  {
1194
1212
  ...getFieldProps(name),
1195
1213
  fullWidth: true,
1196
1214
  variant,
1197
- label: required === true ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1215
+ label: required ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1198
1216
  label,
1199
1217
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { color: "red", pl: 0.5 }, component: "span", children: "*" })
1200
1218
  ] }) : label,
1201
1219
  error: Boolean(fieldError) && isTouched,
1202
- sx: {
1203
- ".Mui-error": {
1204
- m: 0,
1205
- mt: 0
1206
- },
1207
- ".MuiFormLabel-root": {
1208
- top: "-10px",
1209
- color: "text.primary"
1210
- },
1211
- ".MuiInputLabel-root.Mui-focused": {
1212
- color: "text.primary"
1213
- },
1214
- ".MuiInputLabel-shrink": {
1215
- top: 0
1216
- },
1217
- ".MuiFormLabel-asterisk": {
1218
- color: "red"
1219
- },
1220
- "& .MuiInputBase-input.MuiOutlinedInput-input": {
1221
- color: "common.black"
1222
- },
1223
- ".MuiOutlinedInput-root": {
1224
- backgroundColor: (theme) => `${theme.palette.common.white} !important`
1225
- },
1226
- "react-tel-input": {
1227
- backgroundColor: (theme) => `${theme.palette.common.white} !important`
1228
- },
1229
- "& input:-webkit-autofill": {
1230
- WebkitBoxShadow: "0 0 0 1000px transparent inset !important",
1231
- WebkitTextFillColor: "inherit !important",
1232
- transition: "background-color 9999s ease-in-out 0s !important",
1233
- caretColor: "inherit"
1234
- }
1235
- },
1236
1220
  helperText: isTouched && fieldError,
1237
1221
  type: type === "password" ? showPassword ? "text" : "password" : type,
1238
1222
  InputProps: type === "password" ? {
@@ -1242,7 +1226,7 @@ function AppInputField({
1242
1226
  }
1243
1227
  );
1244
1228
  }
1245
- var AppMultiSelector = React4.forwardRef(
1229
+ var AppMultiSelector = React3.forwardRef(
1246
1230
  ({
1247
1231
  name,
1248
1232
  label,
@@ -1294,7 +1278,7 @@ var AppMultiSelector = React4.forwardRef(
1294
1278
  return options.filter((opt) => selectedValues.includes(opt.value));
1295
1279
  };
1296
1280
  if (mode === "autocomplete") {
1297
- const debouncedSearch = React4__default.default.useRef();
1281
+ const debouncedSearch = React3__default.default.useRef();
1298
1282
  const handleSearchChange = (query) => {
1299
1283
  if (debouncedSearch.current) {
1300
1284
  clearTimeout(debouncedSearch.current);
@@ -1400,7 +1384,7 @@ var AppMultiSelector = React4.forwardRef(
1400
1384
  material.Box,
1401
1385
  {
1402
1386
  sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 },
1403
- children: value.map((option, index) => /* @__PURE__ */ React4.createElement(
1387
+ children: value.map((option, index) => /* @__PURE__ */ React3.createElement(
1404
1388
  material.Chip,
1405
1389
  {
1406
1390
  ...getTagProps({ index }),
@@ -1578,8 +1562,8 @@ var AppPhoneNoInput = ({
1578
1562
  withCountryCallingCode = true
1579
1563
  }) => {
1580
1564
  const { values, errors, touched, setFieldValue, setFieldTouched } = formik.useFormikContext();
1581
- const fieldError = React4.useMemo(() => _17__default.default.get(errors, name), [errors, name]);
1582
- const isTouched = React4.useMemo(() => _17__default.default.get(touched, name), [touched, name]);
1565
+ const fieldError = React3.useMemo(() => _17__default.default.get(errors, name), [errors, name]);
1566
+ const isTouched = React3.useMemo(() => _17__default.default.get(touched, name), [touched, name]);
1583
1567
  return /* @__PURE__ */ jsxRuntime.jsxs(
1584
1568
  material.Box,
1585
1569
  {
@@ -1670,167 +1654,186 @@ var AppPhoneNoInput = ({
1670
1654
  );
1671
1655
  };
1672
1656
  var AppPhoneNoInput_default = AppPhoneNoInput;
1673
- var AppRadioGroup = React4.forwardRef(({
1674
- name,
1675
- options = [],
1676
- label,
1677
- required = false,
1678
- disabled = false,
1679
- row = false,
1680
- sx,
1681
- formControlSx,
1682
- radioGroupSx,
1683
- formLabelSx,
1684
- radioSx,
1685
- labelSx,
1686
- errorSx,
1687
- onChange,
1688
- onBlur,
1689
- ...rest
1690
- }, ref) => {
1691
- const { errors, touched, getFieldProps, setFieldValue } = formik.useFormikContext();
1692
- const fieldError = _17__default.default.get(errors, name);
1693
- const isTouched = _17__default.default.get(touched, name);
1694
- const value = _17__default.default.get(getFieldProps(name), "value");
1695
- const handleChange = (event) => {
1696
- const newValue = event.target.value;
1697
- setFieldValue(name, newValue);
1698
- if (onChange) {
1699
- onChange(event, newValue);
1700
- }
1701
- };
1702
- const handleBlur = (event) => {
1703
- if (onBlur) {
1704
- onBlur(event);
1705
- }
1706
- };
1707
- return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(
1708
- material.FormControl,
1709
- {
1710
- component: "fieldset",
1711
- error: Boolean(fieldError) && isTouched,
1712
- disabled,
1713
- sx: [{
1714
- width: "100%",
1715
- "& .MuiFormGroup-root": {
1716
- mt: 1
1717
- }
1718
- }, ...Array.isArray(formControlSx) ? formControlSx : [formControlSx]],
1719
- children: [
1720
- label && /* @__PURE__ */ jsxRuntime.jsxs(
1721
- material.FormLabel,
1657
+ var AppRadioGroup = React3.forwardRef(
1658
+ ({
1659
+ name,
1660
+ options = [],
1661
+ label,
1662
+ required = false,
1663
+ disabled = false,
1664
+ row = false,
1665
+ sx,
1666
+ formControlSx,
1667
+ radioGroupSx,
1668
+ formLabelSx,
1669
+ radioSx,
1670
+ labelSx,
1671
+ errorSx,
1672
+ onChange,
1673
+ onBlur,
1674
+ ...rest
1675
+ }, ref) => {
1676
+ const { errors, touched, getFieldProps, setFieldValue } = formik.useFormikContext();
1677
+ const fieldError = _17__default.default.get(errors, name);
1678
+ const isTouched = _17__default.default.get(touched, name);
1679
+ const value = _17__default.default.get(getFieldProps(name), "value");
1680
+ const handleChange = (event) => {
1681
+ const newValue = event.target.value;
1682
+ setFieldValue(name, newValue);
1683
+ if (onChange) {
1684
+ onChange(event, newValue);
1685
+ }
1686
+ };
1687
+ const handleBlur = (event) => {
1688
+ if (onBlur) {
1689
+ onBlur(event);
1690
+ }
1691
+ };
1692
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx, ref, children: /* @__PURE__ */ jsxRuntime.jsxs(
1693
+ material.FormControl,
1694
+ {
1695
+ component: "fieldset",
1696
+ error: Boolean(fieldError) && isTouched,
1697
+ disabled,
1698
+ sx: [
1722
1699
  {
1723
- component: "legend",
1724
- sx: [{
1725
- color: "text.primary",
1726
- mb: 1,
1727
- "&.Mui-focused": {
1728
- color: "text.primary"
1729
- },
1730
- "&.Mui-disabled": {
1731
- color: "text.disabled"
1732
- }
1733
- }, ...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]],
1734
- children: [
1735
- label,
1736
- required && /* @__PURE__ */ jsxRuntime.jsx(
1737
- material.Typography,
1700
+ width: "100%",
1701
+ "& .MuiFormGroup-root": {
1702
+ mt: 1
1703
+ }
1704
+ },
1705
+ ...Array.isArray(formControlSx) ? formControlSx : [formControlSx]
1706
+ ],
1707
+ children: [
1708
+ label && /* @__PURE__ */ jsxRuntime.jsxs(
1709
+ material.FormLabel,
1710
+ {
1711
+ component: "legend",
1712
+ sx: [
1738
1713
  {
1739
- component: "span",
1740
- sx: {
1741
- color: "error.main",
1742
- ml: 0.5
1714
+ color: "text.primary",
1715
+ mb: 1,
1716
+ "&.Mui-focused": {
1717
+ color: "text.primary"
1743
1718
  },
1744
- children: "*"
1745
- }
1746
- )
1747
- ]
1748
- }
1749
- ),
1750
- /* @__PURE__ */ jsxRuntime.jsx(
1751
- material.RadioGroup,
1752
- {
1753
- ...getFieldProps(name),
1754
- value: value != null ? value : "",
1755
- onChange: handleChange,
1756
- onBlur: handleBlur,
1757
- row,
1758
- sx: [{
1759
- "& .MuiFormControlLabel-root": {
1760
- mr: row ? 3 : 0,
1761
- mb: row ? 0 : 1,
1762
- "&:last-of-type": {
1763
- mb: 0
1764
- }
1765
- }
1766
- }, ...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]],
1767
- ...rest,
1768
- children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1769
- material.FormControlLabel,
1770
- {
1771
- value: option.value,
1772
- disabled: disabled || option.disabled,
1773
- control: /* @__PURE__ */ jsxRuntime.jsx(
1774
- material.Radio,
1775
- {
1776
- sx: [{
1777
- color: "primary.main",
1778
- "&.Mui-checked": {
1779
- color: "primary.main"
1780
- },
1781
- "&.Mui-disabled": {
1782
- color: "action.disabled"
1783
- },
1784
- ...radioSx,
1785
- ...option.radioSx
1786
- }]
1719
+ "&.Mui-disabled": {
1720
+ color: "text.disabled"
1787
1721
  }
1788
- ),
1789
- label: /* @__PURE__ */ jsxRuntime.jsx(
1722
+ },
1723
+ ...Array.isArray(formLabelSx) ? formLabelSx : [formLabelSx]
1724
+ ],
1725
+ children: [
1726
+ label,
1727
+ required && /* @__PURE__ */ jsxRuntime.jsx(
1790
1728
  material.Typography,
1791
1729
  {
1792
- variant: "body2",
1793
- sx: [{
1794
- color: disabled || option.disabled ? "text.disabled" : "text.primary",
1795
- ...labelSx,
1796
- ...option.labelSx
1797
- }],
1798
- children: option.label
1730
+ component: "span",
1731
+ sx: {
1732
+ color: "error.main",
1733
+ ml: 0.5
1734
+ },
1735
+ children: "*"
1799
1736
  }
1800
- ),
1801
- sx: [{
1802
- m: 0,
1803
- mr: row ? 3 : 0,
1804
- mb: row ? 0 : 1,
1805
- "&:last-of-type": {
1806
- mb: 0
1807
- },
1808
- ...option.sx
1809
- }]
1810
- },
1811
- option.value
1812
- ))
1813
- }
1814
- ),
1815
- isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
1816
- material.FormHelperText,
1817
- {
1818
- sx: [{
1819
- color: "error.main",
1820
- mx: 0,
1821
- mt: 0.5,
1822
- ...errorSx
1823
- }],
1824
- children: fieldError
1825
- }
1826
- )
1827
- ]
1828
- }
1829
- ) });
1830
- });
1737
+ )
1738
+ ]
1739
+ }
1740
+ ),
1741
+ /* @__PURE__ */ jsxRuntime.jsx(
1742
+ material.RadioGroup,
1743
+ {
1744
+ ...getFieldProps(name),
1745
+ value: value != null ? value : "",
1746
+ onChange: handleChange,
1747
+ onBlur: handleBlur,
1748
+ row,
1749
+ sx: [
1750
+ {
1751
+ "& .MuiFormControlLabel-root": {
1752
+ mr: row ? 3 : 0,
1753
+ mb: row ? 0 : 1,
1754
+ "&:last-of-type": {
1755
+ mb: 0
1756
+ }
1757
+ }
1758
+ },
1759
+ ...Array.isArray(radioGroupSx) ? radioGroupSx : [radioGroupSx]
1760
+ ],
1761
+ ...rest,
1762
+ children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1763
+ material.FormControlLabel,
1764
+ {
1765
+ value: option.value,
1766
+ disabled: disabled || option.disabled,
1767
+ control: /* @__PURE__ */ jsxRuntime.jsx(
1768
+ material.Radio,
1769
+ {
1770
+ sx: [
1771
+ {
1772
+ color: "primary.main",
1773
+ "&.Mui-checked": {
1774
+ color: "primary.main"
1775
+ },
1776
+ "&.Mui-disabled": {
1777
+ color: "action.disabled"
1778
+ },
1779
+ ...radioSx,
1780
+ ...option.radioSx
1781
+ }
1782
+ ]
1783
+ }
1784
+ ),
1785
+ label: /* @__PURE__ */ jsxRuntime.jsx(
1786
+ material.Typography,
1787
+ {
1788
+ variant: "body2",
1789
+ sx: [
1790
+ {
1791
+ color: disabled || option.disabled ? "text.disabled" : "text.primary",
1792
+ ...labelSx,
1793
+ ...option.labelSx
1794
+ }
1795
+ ],
1796
+ children: option.label
1797
+ }
1798
+ ),
1799
+ sx: [
1800
+ {
1801
+ m: 0,
1802
+ mr: row ? 3 : 0,
1803
+ mb: row ? 0 : 1,
1804
+ "&:last-of-type": {
1805
+ mb: 0
1806
+ },
1807
+ ...option.sx
1808
+ }
1809
+ ]
1810
+ },
1811
+ option.value
1812
+ ))
1813
+ }
1814
+ ),
1815
+ isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
1816
+ material.FormHelperText,
1817
+ {
1818
+ sx: [
1819
+ {
1820
+ color: "error.main",
1821
+ mx: 0,
1822
+ mt: 0.5,
1823
+ ...errorSx
1824
+ }
1825
+ ],
1826
+ children: fieldError
1827
+ }
1828
+ )
1829
+ ]
1830
+ }
1831
+ ) });
1832
+ }
1833
+ );
1831
1834
  AppRadioGroup.displayName = "AppRadioGroup";
1832
1835
  var AppRadioGroup_default = AppRadioGroup;
1833
- var AppRating = React4.forwardRef(
1836
+ var AppRating = React3.forwardRef(
1834
1837
  ({
1835
1838
  name,
1836
1839
  label,
@@ -11141,12 +11144,13 @@ var AppRichTextEditor = ({
11141
11144
  labelSx,
11142
11145
  buttonSx,
11143
11146
  activeButtonSx,
11144
- dialogSx
11147
+ dialogSx,
11148
+ showButtons
11145
11149
  }) => {
11146
11150
  material.useTheme();
11147
11151
  const { values, setFieldValue } = formik.useFormikContext();
11148
- const [linkDialogOpen, setLinkDialogOpen] = React4.useState(false);
11149
- const [linkUrl, setLinkUrl] = React4.useState("");
11152
+ const [linkDialogOpen, setLinkDialogOpen] = React3.useState(false);
11153
+ const [linkUrl, setLinkUrl] = React3.useState("");
11150
11154
  const editor = react$1.useEditor({
11151
11155
  extensions: [
11152
11156
  StarterKit__default.default,
@@ -11157,15 +11161,23 @@ var AppRichTextEditor = ({
11157
11161
  content: values[name] || "",
11158
11162
  onUpdate({ editor: editor2 }) {
11159
11163
  setFieldValue(name, editor2.getHTML());
11160
- }
11164
+ },
11165
+ editorProps: { attributes: { class: "prose" } },
11166
+ immediatelyRender: false
11167
+ // SSR-safe
11161
11168
  });
11162
- React4.useEffect(() => {
11169
+ React3.useEffect(() => {
11163
11170
  if (editor && values[name] !== editor.getHTML()) {
11164
11171
  editor.commands.setContent(values[name] || "");
11165
11172
  }
11166
11173
  }, [values[name]]);
11167
11174
  if (!editor)
11168
11175
  return null;
11176
+ const openLinkDialog = () => {
11177
+ const previousUrl = editor.getAttributes("link").href || "";
11178
+ setLinkUrl(previousUrl);
11179
+ setLinkDialogOpen(true);
11180
+ };
11169
11181
  const applyLink = () => {
11170
11182
  editor.chain().focus().extendMarkRange("link").setLink({ href: linkUrl }).run();
11171
11183
  setLinkDialogOpen(false);
@@ -11174,47 +11186,151 @@ var AppRichTextEditor = ({
11174
11186
  editor.chain().focus().unsetLink().run();
11175
11187
  setLinkDialogOpen(false);
11176
11188
  };
11189
+ const renderButton = (onClick, Icon2, active, tooltip) => /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: tooltip, children: /* @__PURE__ */ jsxRuntime.jsx(
11190
+ material.IconButton,
11191
+ {
11192
+ onClick,
11193
+ color: active ? "primary" : "default",
11194
+ sx: {
11195
+ ...buttonSx,
11196
+ ...active ? activeButtonSx : {}
11197
+ },
11198
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, {})
11199
+ }
11200
+ ) }, tooltip);
11201
+ const defaultButtons = [
11202
+ "bold",
11203
+ "italic",
11204
+ "underline",
11205
+ "strike",
11206
+ "bulletList",
11207
+ "orderedList",
11208
+ "alignLeft",
11209
+ "alignCenter",
11210
+ "alignRight",
11211
+ "heading1",
11212
+ "heading2",
11213
+ "undo",
11214
+ "redo",
11215
+ "link"
11216
+ ];
11217
+ const buttonsToRender = showButtons && showButtons.length > 0 ? showButtons : defaultButtons;
11218
+ const renderToolbarButton = (id) => {
11219
+ switch (id) {
11220
+ case "bold":
11221
+ return renderButton(
11222
+ () => editor.chain().focus().toggleBold().run(),
11223
+ FormatBoldIcon__default.default,
11224
+ editor.isActive("bold"),
11225
+ "Bold"
11226
+ );
11227
+ case "italic":
11228
+ return renderButton(
11229
+ () => editor.chain().focus().toggleItalic().run(),
11230
+ FormatItalicIcon__default.default,
11231
+ editor.isActive("italic"),
11232
+ "Italic"
11233
+ );
11234
+ case "underline":
11235
+ return renderButton(
11236
+ () => editor.chain().focus().toggleUnderline().run(),
11237
+ FormatUnderlinedIcon__default.default,
11238
+ editor.isActive("underline"),
11239
+ "Underline"
11240
+ );
11241
+ case "strike":
11242
+ return renderButton(
11243
+ () => editor.chain().focus().toggleStrike().run(),
11244
+ StrikethroughSIcon__default.default,
11245
+ editor.isActive("strike"),
11246
+ "Strike"
11247
+ );
11248
+ case "bulletList":
11249
+ return renderButton(
11250
+ () => editor.chain().focus().toggleBulletList().run(),
11251
+ FormatListBulletedIcon__default.default,
11252
+ editor.isActive("bulletList"),
11253
+ "Bullet List"
11254
+ );
11255
+ case "orderedList":
11256
+ return renderButton(
11257
+ () => editor.chain().focus().toggleOrderedList().run(),
11258
+ FormatListNumberedIcon__default.default,
11259
+ editor.isActive("orderedList"),
11260
+ "Numbered List"
11261
+ );
11262
+ case "alignLeft":
11263
+ return renderButton(
11264
+ () => editor.chain().focus().setTextAlign("left").run(),
11265
+ FormatAlignLeftIcon__default.default,
11266
+ editor.isActive({ textAlign: "left" }),
11267
+ "Align Left"
11268
+ );
11269
+ case "alignCenter":
11270
+ return renderButton(
11271
+ () => editor.chain().focus().setTextAlign("center").run(),
11272
+ FormatAlignCenterIcon__default.default,
11273
+ editor.isActive({ textAlign: "center" }),
11274
+ "Align Center"
11275
+ );
11276
+ case "alignRight":
11277
+ return renderButton(
11278
+ () => editor.chain().focus().setTextAlign("right").run(),
11279
+ FormatAlignRightIcon__default.default,
11280
+ editor.isActive({ textAlign: "right" }),
11281
+ "Align Right"
11282
+ );
11283
+ case "heading1":
11284
+ return renderButton(
11285
+ () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11286
+ TitleIcon__default.default,
11287
+ editor.isActive("heading", { level: 1 }),
11288
+ "Heading 1"
11289
+ );
11290
+ case "heading2":
11291
+ return renderButton(
11292
+ () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11293
+ TitleIcon__default.default,
11294
+ editor.isActive("heading", { level: 2 }),
11295
+ "Heading 2"
11296
+ );
11297
+ case "undo":
11298
+ return renderButton(
11299
+ () => editor.chain().focus().undo().run(),
11300
+ UndoIcon__default.default,
11301
+ false,
11302
+ "Undo"
11303
+ );
11304
+ case "redo":
11305
+ return renderButton(
11306
+ () => editor.chain().focus().redo().run(),
11307
+ RedoIcon__default.default,
11308
+ false,
11309
+ "Redo"
11310
+ );
11311
+ case "link":
11312
+ return renderButton(openLinkDialog, UndoIcon__default.default, false, "Insert Link");
11313
+ default:
11314
+ return null;
11315
+ }
11316
+ };
11177
11317
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { width: "100%", ...sx }, children: [
11178
- /* @__PURE__ */ jsxRuntime.jsx(
11179
- formik.ErrorMessage,
11180
- {
11181
- name,
11182
- render: (msg) => /* @__PURE__ */ jsxRuntime.jsx(
11183
- material.Typography,
11184
- {
11185
- variant: "caption",
11186
- sx: [
11187
- {
11188
- color: "error.main",
11189
- display: "block",
11190
- mt: 0.5,
11191
- ...errorSx
11192
- }
11193
- ],
11194
- children: msg
11195
- }
11196
- )
11197
- }
11198
- ),
11199
11318
  label && /* @__PURE__ */ jsxRuntime.jsxs(
11200
11319
  material.Typography,
11201
11320
  {
11202
11321
  variant: "button",
11203
- sx: [
11204
- {
11205
- color: "text.primary",
11206
- mb: 1,
11207
- display: "block",
11208
- ...labelSx
11209
- }
11210
- ],
11322
+ sx: {
11323
+ mb: 1,
11324
+ display: "block",
11325
+ ...labelSx
11326
+ },
11211
11327
  children: [
11212
11328
  label,
11213
11329
  required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
11214
11330
  ]
11215
11331
  }
11216
11332
  ),
11217
- /* @__PURE__ */ jsxRuntime.jsxs(
11333
+ /* @__PURE__ */ jsxRuntime.jsx(
11218
11334
  material.Box,
11219
11335
  {
11220
11336
  sx: {
@@ -11229,142 +11345,7 @@ var AppRichTextEditor = ({
11229
11345
  borderColor: "divider",
11230
11346
  ...toolbarSx
11231
11347
  },
11232
- children: [
11233
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(
11234
- material.IconButton,
11235
- {
11236
- onClick: () => editor.chain().focus().toggleBold().run(),
11237
- color: editor.isActive("bold") ? "primary" : "default",
11238
- sx: {
11239
- ...buttonSx,
11240
- ...editor.isActive("bold") ? activeButtonSx : {}
11241
- },
11242
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatBoldIcon__default.default, {})
11243
- }
11244
- ) }),
11245
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(
11246
- material.IconButton,
11247
- {
11248
- onClick: () => editor.chain().focus().toggleItalic().run(),
11249
- color: editor.isActive("italic") ? "primary" : "default",
11250
- sx: {
11251
- ...buttonSx,
11252
- ...editor.isActive("italic") ? activeButtonSx : {}
11253
- },
11254
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatItalicIcon__default.default, {})
11255
- }
11256
- ) }),
11257
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Underline", children: /* @__PURE__ */ jsxRuntime.jsx(
11258
- material.IconButton,
11259
- {
11260
- onClick: () => editor.chain().focus().toggleUnderline().run(),
11261
- color: editor.isActive("underline") ? "primary" : "default",
11262
- sx: {
11263
- ...buttonSx,
11264
- ...editor.isActive("underline") ? activeButtonSx : {}
11265
- },
11266
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatUnderlinedIcon__default.default, {})
11267
- }
11268
- ) }),
11269
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Strike", children: /* @__PURE__ */ jsxRuntime.jsx(
11270
- material.IconButton,
11271
- {
11272
- onClick: () => editor.chain().focus().toggleStrike().run(),
11273
- color: editor.isActive("strike") ? "primary" : "default",
11274
- sx: {
11275
- ...buttonSx,
11276
- ...editor.isActive("strike") ? activeButtonSx : {}
11277
- },
11278
- children: /* @__PURE__ */ jsxRuntime.jsx(StrikethroughSIcon__default.default, {})
11279
- }
11280
- ) }),
11281
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Bullet List", children: /* @__PURE__ */ jsxRuntime.jsx(
11282
- material.IconButton,
11283
- {
11284
- onClick: () => editor.chain().focus().toggleBulletList().run(),
11285
- color: editor.isActive("bulletList") ? "primary" : "default",
11286
- sx: {
11287
- ...buttonSx,
11288
- ...editor.isActive("bulletList") ? activeButtonSx : {}
11289
- },
11290
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListBulletedIcon__default.default, {})
11291
- }
11292
- ) }),
11293
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Numbered List", children: /* @__PURE__ */ jsxRuntime.jsx(
11294
- material.IconButton,
11295
- {
11296
- onClick: () => editor.chain().focus().toggleOrderedList().run(),
11297
- color: editor.isActive("orderedList") ? "primary" : "default",
11298
- sx: {
11299
- ...buttonSx,
11300
- ...editor.isActive("orderedList") ? activeButtonSx : {}
11301
- },
11302
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatListNumberedIcon__default.default, {})
11303
- }
11304
- ) }),
11305
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Left", children: /* @__PURE__ */ jsxRuntime.jsx(
11306
- material.IconButton,
11307
- {
11308
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
11309
- color: editor.isActive({ textAlign: "left" }) ? "primary" : "default",
11310
- sx: {
11311
- ...buttonSx,
11312
- ...editor.isActive({ textAlign: "left" }) ? activeButtonSx : {}
11313
- },
11314
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignLeftIcon__default.default, {})
11315
- }
11316
- ) }),
11317
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Center", children: /* @__PURE__ */ jsxRuntime.jsx(
11318
- material.IconButton,
11319
- {
11320
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
11321
- color: editor.isActive({ textAlign: "center" }) ? "primary" : "default",
11322
- sx: {
11323
- ...buttonSx,
11324
- ...editor.isActive({ textAlign: "center" }) ? activeButtonSx : {}
11325
- },
11326
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignCenterIcon__default.default, {})
11327
- }
11328
- ) }),
11329
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Align Right", children: /* @__PURE__ */ jsxRuntime.jsx(
11330
- material.IconButton,
11331
- {
11332
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
11333
- color: editor.isActive({ textAlign: "right" }) ? "primary" : "default",
11334
- sx: {
11335
- ...buttonSx,
11336
- ...editor.isActive({ textAlign: "right" }) ? activeButtonSx : {}
11337
- },
11338
- children: /* @__PURE__ */ jsxRuntime.jsx(FormatAlignRightIcon__default.default, {})
11339
- }
11340
- ) }),
11341
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 1", children: /* @__PURE__ */ jsxRuntime.jsx(
11342
- material.IconButton,
11343
- {
11344
- onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
11345
- color: editor.isActive("heading", { level: 1 }) ? "primary" : "default",
11346
- sx: {
11347
- ...buttonSx,
11348
- ...editor.isActive("heading", { level: 1 }) ? activeButtonSx : {}
11349
- },
11350
- children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "1rem" } })
11351
- }
11352
- ) }),
11353
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Heading 2", children: /* @__PURE__ */ jsxRuntime.jsx(
11354
- material.IconButton,
11355
- {
11356
- onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
11357
- color: editor.isActive("heading", { level: 2 }) ? "primary" : "default",
11358
- sx: {
11359
- ...buttonSx,
11360
- ...editor.isActive("heading", { level: 2 }) ? activeButtonSx : {}
11361
- },
11362
- children: /* @__PURE__ */ jsxRuntime.jsx(TitleIcon__default.default, { sx: { fontSize: "0.85rem" } })
11363
- }
11364
- ) }),
11365
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Undo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().undo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(UndoIcon__default.default, {}) }) }),
11366
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Redo", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => editor.chain().focus().redo().run(), children: /* @__PURE__ */ jsxRuntime.jsx(RedoIcon__default.default, {}) }) })
11367
- ]
11348
+ children: buttonsToRender.map((btn) => renderToolbarButton(btn))
11368
11349
  }
11369
11350
  ),
11370
11351
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11382,9 +11363,7 @@ var AppRichTextEditor = ({
11382
11363
  "& .ProseMirror": {
11383
11364
  outline: "none",
11384
11365
  minHeight: 150,
11385
- "& > * + *": {
11386
- mt: 2
11387
- },
11366
+ "& > * + *": { mt: 2 },
11388
11367
  "& h1": {
11389
11368
  fontSize: "2em",
11390
11369
  fontWeight: "bold",
@@ -11397,20 +11376,12 @@ var AppRichTextEditor = ({
11397
11376
  lineHeight: 1.3,
11398
11377
  color: "text.primary"
11399
11378
  },
11400
- "& p": {
11401
- color: "text.primary",
11402
- lineHeight: 1.6
11403
- },
11404
- "& ul, & ol": {
11405
- pl: 3,
11406
- color: "text.primary"
11407
- },
11379
+ "& p": { color: "text.primary", lineHeight: 1.6 },
11380
+ "& ul, & ol": { pl: 3, color: "text.primary" },
11408
11381
  "& a": {
11409
11382
  color: "primary.main",
11410
11383
  textDecoration: "none",
11411
- "&:hover": {
11412
- textDecoration: "underline"
11413
- }
11384
+ "&:hover": { textDecoration: "underline" }
11414
11385
  },
11415
11386
  ...contentSx
11416
11387
  },
@@ -11447,19 +11418,6 @@ var AppRichTextEditor = ({
11447
11418
  borderRadius: 1,
11448
11419
  border: "1px solid",
11449
11420
  borderColor: "divider",
11450
- "& .MuiDialogTitle-root": {
11451
- borderBottom: "1px solid",
11452
- borderColor: "divider",
11453
- p: 2
11454
- },
11455
- "& .MuiDialogContent-root": {
11456
- p: 2
11457
- },
11458
- "& .MuiDialogActions-root": {
11459
- p: 2,
11460
- borderTop: "1px solid",
11461
- borderColor: "divider"
11462
- },
11463
11421
  ...dialogSx
11464
11422
  }
11465
11423
  },
@@ -11491,7 +11449,7 @@ var AppRichTextEditor = ({
11491
11449
  ] });
11492
11450
  };
11493
11451
  var AppRichTextEditor_default = AppRichTextEditor;
11494
- var AppSelectInput = React4.forwardRef(
11452
+ var AppSelectInput = React3.forwardRef(
11495
11453
  ({
11496
11454
  name,
11497
11455
  label,
@@ -11529,7 +11487,7 @@ var AppSelectInput = React4.forwardRef(
11529
11487
  };
11530
11488
  const selectedOption = options.find((opt) => opt.value === currentValue) || null;
11531
11489
  if (mode === "autocomplete") {
11532
- const debouncedSearch = React4__default.default.useRef();
11490
+ const debouncedSearch = React3__default.default.useRef();
11533
11491
  const handleSearchChange = (query) => {
11534
11492
  if (debouncedSearch.current) {
11535
11493
  clearTimeout(debouncedSearch.current);
@@ -11716,7 +11674,7 @@ var AppSelectInput_default = AppSelectInput;
11716
11674
  var AppSimpleUploadFile = ({
11717
11675
  name,
11718
11676
  label = "Upload Files",
11719
- accept = "image/*",
11677
+ accept = "",
11720
11678
  multiple = false,
11721
11679
  disabled = false,
11722
11680
  required = false,
@@ -12126,7 +12084,7 @@ function getRatio(ratio = "1/1") {
12126
12084
  }[ratio];
12127
12085
  }
12128
12086
  var TRANSPARENT_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AApIBgX6cJqkAAAAASUVORK5CYII=";
12129
- var Image = React4.forwardRef(
12087
+ var Image = React3.forwardRef(
12130
12088
  ({
12131
12089
  ratio,
12132
12090
  disabledEffect = false,
@@ -12304,8 +12262,8 @@ function MultiFilePreview({
12304
12262
  if ((files == null ? void 0 : files.length) == null) {
12305
12263
  return null;
12306
12264
  }
12307
- const [anchorEl, setAnchorEl] = React4.useState(null);
12308
- const [selectedFile, setSelectedFile] = React4.useState(null);
12265
+ const [anchorEl, setAnchorEl] = React3.useState(null);
12266
+ const [selectedFile, setSelectedFile] = React3.useState(null);
12309
12267
  const canViewPrivate = true;
12310
12268
  return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: files.map((file) => {
12311
12269
  const typedFile = file;
@@ -12586,7 +12544,7 @@ function BackgroundIllustration() {
12586
12544
  )
12587
12545
  ] });
12588
12546
  }
12589
- var BackgroundIllustration_default = React4.memo(BackgroundIllustration);
12547
+ var BackgroundIllustration_default = React3.memo(BackgroundIllustration);
12590
12548
  function UploadIllustration({ ...other }) {
12591
12549
  const theme = styles.useTheme();
12592
12550
  const PRIMARY_MAIN = theme.palette.primary.main;
@@ -13140,7 +13098,7 @@ function UploadIllustration({ ...other }) {
13140
13098
  )
13141
13099
  ] }) });
13142
13100
  }
13143
- var UploadIllustration_default = React4.memo(UploadIllustration);
13101
+ var UploadIllustration_default = React3.memo(UploadIllustration);
13144
13102
  var StyledDropZone = styles.styled("div")(({ theme }) => ({
13145
13103
  outline: "none",
13146
13104
  cursor: "pointer",
@@ -13418,7 +13376,7 @@ var SubmitButton = ({
13418
13376
  ...rest
13419
13377
  }) => {
13420
13378
  const { submitForm, isSubmitting } = formik.useFormikContext();
13421
- const [isLoading, setIsLoading] = React4.useState(false);
13379
+ const [isLoading, setIsLoading] = React3.useState(false);
13422
13380
  const handleClick = async () => {
13423
13381
  try {
13424
13382
  setIsLoading(true);