import { type ReactNode } from 'react'; import clsx from 'clsx'; import './rds-form-control.scss'; import { FormControl as MuiFormControl, FormGroup as MuiFormGroup, FormHelperText as MuiFormHelperText, FormLabel as MuiFormLabel, type FormControlProps } from '@mui/material'; export interface RdsFormControlProps extends Omit { label?: string; helperText?: string; children: ReactNode; isRequired?: boolean; isGroup?: boolean; } const RdsFormControl = ({ label, helperText, children, isRequired = false, isGroup = false, required, error, ...props }: RdsFormControlProps) => { const isRequiredProp = required !== undefined ? required : isRequired; const content = isGroup ? ( {children} ) : ( children ); return ( {label && ( {label} )} {content} {helperText && {helperText}} ); }; RdsFormControl.displayName = 'RdsFormControl'; export default RdsFormControl;