import classNames from 'classnames' import IVConstraintsIndicator from '../IVConstraintsIndicator' import ComponentHelpText from '../HelpText' export function ErrorMessage({ id, message, }: { id?: string message: React.ReactNode }) { return (

{message}

) } interface IVInputFieldProps { children: React.ReactChild label?: React.ReactNode helpText?: React.ReactNode className?: string id: string errorMessage?: React.ReactNode // only used for showing the '(optional)' indicator, does not affect the validity of the field. optional?: boolean constraints?: string | React.ReactNode } export default function IVInputField({ children, label, helpText, className, id, errorMessage, constraints, optional = false, // don't show 'optional' indicator by default }: IVInputFieldProps) { return (
{label && ( )} {constraints && ( )}
{children} {helpText && ( {helpText} )} {errorMessage && }
) }