UNPKG

@aokiapp/rjsf-mantine-theme

Version:

Mantine theme, fields and widgets for react-jsonschema-form

73 lines (68 loc) 1.97 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var jsxRuntime = require('react/jsx-runtime'); var core = require('@mantine/core'); var utils = require('@rjsf/utils'); var FieldTemplate = require('./FieldTemplate.cjs'); function ObjectFieldTemplate(props) { const { disabled, formData, idSchema, onAddClick, properties, readonly, registry, required, schema, title, uiSchema } = props; const { description } = FieldTemplate.useFieldContext(); const options = utils.getUiOptions(uiSchema); const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, options); const { ButtonTemplates: { AddButton } } = registry.templates; const classNames = options.classNames; const legendNode = /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { gap: "xs", className: "armt-template-objectfield-legend", children: [ title && /* @__PURE__ */ jsxRuntime.jsx( TitleFieldTemplate, { id: utils.titleId(idSchema), title, required, schema, uiSchema, registry } ), description ] }); return /* @__PURE__ */ jsxRuntime.jsxs( core.Fieldset, { id: idSchema.$id, legend: legendNode, style: { width: "100%" }, className: `armt-template-objectfield ${classNames ?? ""}`, children: [ /* @__PURE__ */ jsxRuntime.jsx(core.Box, { className: "armt-template-objectfield-item", children: properties.map((prop) => prop.content) }), utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx( AddButton, { className: "object-property-expand", onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema, registry } ) ] } ); } exports.default = ObjectFieldTemplate; //# sourceMappingURL=ObjectFieldTemplate.cjs.map