import * as React from 'react'; import MuiFormHelperText from '@mui/material/FormHelperText'; import type { FormHelperTextProps as MuiFormHelperTextProps } from '@mui/material/FormHelperText'; import { styled } from '@mui/material/styles'; import type { Theme } from '../../@styles/theme-provider'; type StyledFormHelperTextProps = Pick; const StyledFormHelperText = styled(MuiFormHelperText, { shouldForwardProp: prop => prop !== 'warning' })(({ warning, theme }: StyledFormHelperTextProps & { theme: Theme }) => warning ? { '&, &.Mui-error': { color: theme.palette.warning[500] } } : {} ); export type FormHelperTextProps = Omit & { /** * If `true`, helper text should be displayed in a warning state. * @default false */ warning?: boolean; }; export const FormHelperText = React.forwardRef(function ( props: FormHelperTextProps, ref: React.Ref ) { return ; });