UNPKG

@datalayer/primer-rjsf

Version:

React JSON Schema Form (RJSF) for Primer

14 lines (13 loc) 958 B
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { Box, Flash, Heading } from '@primer/react'; import { TranslatableString, } from "@rjsf/utils"; /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form` * * @param props - The `ErrorListProps` for this component */ export default function ErrorList({ errors, registry }) { const { translateString } = registry; return (_jsx(Box, { mb: 3, sx: { borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default', borderRadius: 2 }, children: _jsxs(Box, { p: 3, children: [_jsx(Heading, { as: "h3", sx: { fontSize: 3 }, children: translateString(TranslatableString.ErrorsLabel) }), _jsx(_Fragment, { children: errors.map((error, i) => { return (_jsx(Flash, { variant: "danger", sx: { marginTop: 2 }, children: error.stack }, i)); }) })] }) })); }