'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { useModal } from '@faceless-ui/modal';
import React from 'react';
import { ArrayAction } from '../../elements/ArrayAction/index.js';
import { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js';
import { BlocksDrawer } from './BlocksDrawer/index.js';
export const RowActions = (props)=>{
    const { addRow, blocks, blockType, copyRow, duplicateRow, hasMaxRows, isSortable, labels, moveRow, pasteRow, removeRow, rowCount, rowIndex } = props;
    const { closeModal, openModal } = useModal();
    const drawerSlug = useDrawerSlug('blocks-drawer');
    const [indexToAdd, setIndexToAdd] = React.useState(null);
    return /*#__PURE__*/ _jsxDEV(React.Fragment, {
        children: [
            /*#__PURE__*/ _jsxDEV(BlocksDrawer, {
                addRow: (_, rowBlockType)=>{
                    if (typeof addRow === 'function') {
                        void addRow(indexToAdd, rowBlockType);
                    }
                    closeModal(drawerSlug);
                },
                addRowIndex: rowIndex,
                blocks: blocks,
                drawerSlug: drawerSlug,
                labels: labels
            }, void 0, false, {
                fileName: "src/fields/Blocks/RowActions.tsx",
                lineNumber: 50,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV(ArrayAction, {
                addRow: (index)=>{
                    setIndexToAdd(index);
                    openModal(drawerSlug);
                },
                copyRow: copyRow,
                duplicateRow: ()=>duplicateRow(rowIndex, blockType),
                hasMaxRows: hasMaxRows,
                index: rowIndex,
                isSortable: isSortable,
                moveRow: moveRow,
                pasteRow: pasteRow,
                removeRow: removeRow,
                rowCount: rowCount
            }, void 0, false, {
                fileName: "src/fields/Blocks/RowActions.tsx",
                lineNumber: 62,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/fields/Blocks/RowActions.tsx",
        lineNumber: 49,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=RowActions.js.map