feat: add missing propTypes

This commit is contained in:
kasia.oczkowska
2024-06-05 13:26:56 +01:00
parent 725b38c697
commit 3f5df118a0
53 changed files with 597 additions and 81 deletions

View File

@@ -1,8 +1,10 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import { Controller, useFormContext } from 'react-hook-form';
import FormControlLabel from '@mui/material/FormControlLabel';
import MuiSwitch from '@mui/material/Switch';
export default function Switch(props) {
function Switch(props) {
const { control } = useFormContext();
const inputRef = React.useRef(null);
const {
@@ -18,6 +20,7 @@ export default function Switch(props) {
className,
...switchProps
} = props;
return (
<Controller
rules={{ required }}
@@ -63,3 +66,18 @@ export default function Switch(props) {
/>
);
}
Switch.propTypes = {
required: PropTypes.bool,
name: PropTypes.string.isRequired,
defaultChecked: PropTypes.bool,
disabled: PropTypes.bool,
label: PropTypes.string.isRequired,
shouldUnregister: PropTypes.bool,
onBlur: PropTypes.func,
onChange: PropTypes.func,
FormControlLabelProps: PropTypes.object,
className: PropTypes.string,
};
export default Switch;