UNPKG

@rjsf/material-ui

Version:

Material UI 4 theme, fields and widgets for react-jsonschema-form

19 lines 1.67 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import FormControl from '@material-ui/core/FormControl'; import Typography from '@material-ui/core/Typography'; import { getTemplate, getUiOptions, } from '@rjsf/utils'; /** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component. * * @param props - The `FieldTemplateProps` for this component */ export default function FieldTemplate(props) { const { id, children, classNames, style, disabled, displayLabel, hidden, label, onDropPropertyClick, onKeyChange, readonly, required, rawErrors = [], errors, help, description, rawDescription, schema, uiSchema, registry, } = props; const uiOptions = getUiOptions(uiSchema); const WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions); if (hidden) { return _jsx("div", { style: { display: 'none' }, children: children }); } return (_jsx(WrapIfAdditionalTemplate, { classNames: classNames, style: style, disabled: disabled, id: id, label: label, onDropPropertyClick: onDropPropertyClick, onKeyChange: onKeyChange, readonly: readonly, required: required, schema: schema, uiSchema: uiSchema, registry: registry, children: _jsxs(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required: required, children: [children, displayLabel && rawDescription ? (_jsx(Typography, { variant: 'caption', color: 'textSecondary', children: description })) : null, errors, help] }) })); } //# sourceMappingURL=FieldTemplate.js.map