UNPKG

@rjsf/react-bootstrap

Version:

React Bootstrap theme, fields and widgets for react-jsonschema-form, powered by react-bootstrap

13 lines 1.55 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { getTemplate, getUiOptions, } from '@rjsf/utils'; import Form from 'react-bootstrap/Form'; export default function FieldTemplate({ id, children, displayLabel, rawErrors = [], errors, help, description, rawDescription, classNames, style, disabled, label, hidden, onKeyRename, onKeyRenameBlur, onRemoveProperty, readonly, required, schema, uiSchema, registry, }) { const uiOptions = getUiOptions(uiSchema); const WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions); if (hidden) { return _jsx("div", { className: 'hidden', children: children }); } const isCheckbox = uiOptions.widget === 'checkbox'; return (_jsx(WrapIfAdditionalTemplate, { classNames: classNames, style: style, disabled: disabled, id: id, label: label, displayLabel: displayLabel, rawDescription: rawDescription, onKeyRename: onKeyRename, onKeyRenameBlur: onKeyRenameBlur, onRemoveProperty: onRemoveProperty, readonly: readonly, required: required, schema: schema, uiSchema: uiSchema, registry: registry, children: _jsxs(Form.Group, { children: [displayLabel && !isCheckbox && (_jsxs(Form.Label, { htmlFor: id, className: rawErrors.length > 0 ? 'text-danger' : '', children: [label, required ? '*' : null] })), children, displayLabel && rawDescription && !isCheckbox && (_jsx(Form.Text, { className: rawErrors.length > 0 ? 'text-danger' : 'text-muted', children: description })), errors, help] }) })); } //# sourceMappingURL=FieldTemplate.js.map