"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectFieldRenderer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const FormContext_1 = require("../../hooks/FormContext.js");
const cn_1 = require("../../utils/cn.js");
const AddPropertyButton_1 = require("../AddPropertyButton/AddPropertyButton.js");
const SectionHeader_1 = require("../SectionHeader/SectionHeader.js");
const b = (0, cn_1.formBuilderCn)('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
