import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, DropdownMenu } from '@gravity-ui/uikit';
import { useFormContext } from "../../hooks/FormContext.js";
import { formBuilderCn } from "../../utils/cn.js";
import { FieldCard } from "../FieldCard/FieldCard.js";
import './FormBuilderBody.css';
const b = formBuilderCn('form-builder-body');
export const FormBuilderBody = ({ className }) => {
    const { formFields, addField } = useFormContext();
    const inputTypeMenuItems = [
        {
            type: 'text',
            action: () => addField('text'),
            text: 'Text Input',
        },
        {
            type: 'number',
            action: () => addField('number'),
            text: 'Number Input',
        },
        {
            type: 'boolean',
            action: () => addField('boolean'),
            text: 'Boolean Input',
        },
        {
            type: 'textarea',
            action: () => addField('textarea'),
            text: 'Textarea Input',
        },
        {
            type: 'select',
            action: () => addField('select'),
            text: 'Select Input',
        },
        {
            type: 'object',
            action: () => addField('object'),
            text: 'Object Input',
        },
        {
            type: 'array',
            action: () => addField('array'),
            text: 'Array Input',
        },
        {
            type: 'oneOf',
            action: () => addField('oneOf'),
            text: 'OneOf Input',
        },
        {
            type: 'anyOf',
            action: () => addField('anyOf'),
            text: 'AnyOf Input',
        },
    ];
    return (_jsxs("div", { className: b(null, className), children: [_jsx("div", { className: b('fields-list'), children: formFields.map((field) => (_jsx(FieldCard, { field: field, inputTypeMenuItems: inputTypeMenuItems }, field.id))) }), _jsx("div", { className: b('field'), children: _jsx(DropdownMenu, { items: inputTypeMenuItems, renderSwitcher: (props) => (_jsx(Button, { ...props, view: "action", size: "l", children: "+ Add Field" })) }) })] }));
};
//# sourceMappingURL=FormBuilderBody.js.map
