import * as React from 'react' ; import { useTranslate , ValidationError , ValidationErrorMessage } from 'ra-core' ; export interface InputHelperTextProps { helperText ? : string | boolean ; error ? : ValidationErrorMessage ; touched : boolean ; } const InputHelperText = ( props ) => { const { helperText , touched , error } = props ; const translate = useTranslate ( ) ; return touched && error ? ( < ValidationError error = { error } / > ) : typeof helperText === 'string' ? ( < > { translate ( helperText , { _ : helperText } ) } < />) : helperText !== false ? ( < span dangerouslySetInnerHTML = { defaultInnerHTML } / > ) : null ; } ; const defaultInnerHTML = { __html : '&#8203;' } ; export default InputHelperText ;