"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectFieldRenderer = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const bem_cn_lite_1 = tslib_1.__importDefault(require("bem-cn-lite"));
const AddPropertyButton_1 = require("../AddPropertyButton/AddPropertyButton.js");
const SectionHeader_1 = require("../SectionHeader/SectionHeader.js");
const FormContext_1 = require("../../hooks/FormContext.js");
const b = (0, bem_cn_lite_1.default)('object-field-renderer');
const ObjectFieldRenderer = ({ field, fieldName: _fieldName, inputTypeMenuItems, renderNestedField, }) => {
    const { addObjectProperty } = (0, FormContext_1.useFormContext)();
    return ((0, jsx_runtime_1.jsxs)("div", { className: b('nested-fields'), children: [(0, jsx_runtime_1.jsx)(SectionHeader_1.SectionHeader, { title: "Properties:" }), field.properties.map((property, index) => renderNestedField(property, index, field.id)), (0, jsx_runtime_1.jsx)(AddPropertyButton_1.AddPropertyButton, { inputTypeMenuItems: inputTypeMenuItems, onAdd: (type) => addObjectProperty(field.id, type) })] }));
};
exports.ObjectFieldRenderer = ObjectFieldRenderer;
//# sourceMappingURL=ObjectFieldRenderer.js.map
