@rjsf/material-ui
Version:
Material UI 4 theme, fields and widgets for react-jsonschema-form
21 lines • 1.31 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import ErrorIcon from '@material-ui/icons/Error';
import Box from '@material-ui/core/Box';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
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(Paper, { elevation: 2, children: _jsxs(Box, { mb: 2, p: 2, children: [_jsx(Typography, { variant: 'h6', children: translateString(TranslatableString.ErrorsLabel) }), _jsx(List, { dense: true, children: errors.map((error, i) => {
return (_jsxs(ListItem, { children: [_jsx(ListItemIcon, { children: _jsx(ErrorIcon, { color: 'error' }) }), _jsx(ListItemText, { primary: error.stack })] }, i));
}) })] }) }));
}
//# sourceMappingURL=ErrorList.js.map