UNPKG

@astarte-platform/react-bootstrap

Version:

React Bootstrap theme, fields and widgets for react-jsonschema-form, powered by react-bootstrap, this is a package from a fork of official project

12 lines 1.36 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, onDropPropertyClick, onKeyChange, readonly, required, schema, uiSchema, registry, }) { const uiOptions = getUiOptions(uiSchema); const WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions); if (hidden) { return _jsx("div", { className: 'hidden', 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(Form.Group, { children: [displayLabel && (_jsxs(Form.Label, { htmlFor: id, className: rawErrors.length > 0 ? 'text-danger' : '', children: [label, required ? '*' : null] })), children, displayLabel && rawDescription && (_jsx(Form.Text, { className: rawErrors.length > 0 ? 'text-danger' : 'text-muted', children: description })), errors, help] }) })); } //# sourceMappingURL=FieldTemplate.js.map