@rjsf/semantic-ui
Version:
Semantic UI theme, fields and widgets for react-jsonschema-form
21 lines • 1.62 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getTemplate, getUiOptions, } from '@rjsf/utils';
import { Form } from 'semantic-ui-react';
import { getSemanticProps, MaybeWrap } from '../util.js';
/** 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, displayLabel, label, errors, help, hidden, description, rawDescription, registry, schema, uiSchema, ...otherProps } = props;
const semanticProps = getSemanticProps(otherProps);
const { wrapLabel, wrapContent } = semanticProps;
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, id: id, label: label, registry: registry, schema: schema, uiSchema: uiSchema, ...otherProps, children: _jsx(Form.Group, { widths: 'equal', grouped: true, children: _jsxs(MaybeWrap, { wrap: wrapContent, className: 'sui-field-content', children: [children, displayLabel && rawDescription && (_jsx(MaybeWrap, { wrap: wrapLabel, className: 'sui-field-label', children: description })), help, errors] }) }, id) }));
}
//# sourceMappingURL=FieldTemplate.js.map