import { makeStyles, tokens } from '@fluentui/react-components'; import type { FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; import { errorId } from '@rjsf/utils'; const useStyles = makeStyles({ list: { marginTop: 0, marginBottom: 0, paddingLeft: 0, listStyleType: 'none' }, listItem: { paddingLeft: tokens.spacingHorizontalL, paddingTop: tokens.spacingVerticalXS, paddingBottom: tokens.spacingVerticalXS, }, errorLabel: { color: tokens.colorPaletteRedForeground1 }, }); /** The `FieldErrorTemplate` component renders the errors local to the particular field * * @param props - The `FieldErrorProps` for the errors being rendered */ export default function FieldErrorTemplate< T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any, >(props: FieldErrorProps) { const { errors = [], fieldPathId } = props; const classes = useStyles(); if (errors.length === 0) { return null; } const id = errorId(fieldPathId); return ( ); }