diff --git a/src/components/MuiRhfAutocompleteMultiple.tsx b/src/components/MuiRhfAutocompleteMultiple.tsx new file mode 100644 index 0000000..048b3e5 --- /dev/null +++ b/src/components/MuiRhfAutocompleteMultiple.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; + +import { TextFieldProps } from "@material-ui/core"; + +import { MuiRhfFieldProps } from "~/models/fields"; + +import MuiRhfAutocomplete from "./MuiRhfAutocomplete"; + +type MuiRhfAutocompleteProps = MuiRhfFieldProps & { + defaultValue?: unknown; + textField?: Omit; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + autocomplete?: any; +}; + +const MuiRhfAutocompleteMultiple: React.FC = ({ + defaultValue = [], + autocomplete: autocompleteProps = {}, + ...rest +}) => ( + +); + +export default MuiRhfAutocompleteMultiple; diff --git a/src/components/MuiRhfAutocompleteSingle.tsx b/src/components/MuiRhfAutocompleteSingle.tsx new file mode 100644 index 0000000..4f5d186 --- /dev/null +++ b/src/components/MuiRhfAutocompleteSingle.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; + +import { TextFieldProps } from "@material-ui/core"; + +import { MuiRhfFieldProps } from "~/models/fields"; + +import MuiRhfAutocomplete from "./MuiRhfAutocomplete"; + +type MuiRhfAutocompleteProps = MuiRhfFieldProps & { + defaultValue?: unknown; + textField?: Omit; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + autocomplete?: any; +}; + +const MuiRhfAutocompleteSingle: React.FC = ({ + defaultValue = null, + autocomplete: autocompleteProps = {}, + ...rest +}) => ( + +); + +export default MuiRhfAutocompleteSingle; diff --git a/src/components/MuiRhfCheckbox.tsx b/src/components/MuiRhfCheckbox.tsx index 9a33428..5e19f11 100644 --- a/src/components/MuiRhfCheckbox.tsx +++ b/src/components/MuiRhfCheckbox.tsx @@ -15,7 +15,7 @@ const MuiRhfCheckbox: React.FC = ({ control, errors, name, - defaultValue, + defaultValue = false, label, required, disabled, diff --git a/src/components/MuiRhfSelect.tsx b/src/components/MuiRhfSelect.tsx index ba6e0c2..4b835ff 100644 --- a/src/components/MuiRhfSelect.tsx +++ b/src/components/MuiRhfSelect.tsx @@ -17,7 +17,7 @@ const MuiRhfSelect: React.FC = ({ errors, name, label, - defaultValue, + defaultValue = "", options, select: selectProps, }) => ( diff --git a/src/components/MuiRhfTextField.tsx b/src/components/MuiRhfTextField.tsx index 60098ea..2d1dc1e 100644 --- a/src/components/MuiRhfTextField.tsx +++ b/src/components/MuiRhfTextField.tsx @@ -10,7 +10,7 @@ const MuiRhfTextField: React.FC = ({ control, errors, name, - defaultValue, + defaultValue = "", ...rest }) => ( ; select: React.FC; checkbox: React.FC; - autocomplete: React.FC; + autocompleteSingle: React.FC; + autocompleteMultiple: React.FC; }; /** Form */