'use client';
import * as facelessUIImport 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, blockType, blocks, duplicateRow, hasMaxRows, labels, moveRow, removeRow, rowCount, rowIndex } = props;
    const { useModal } = facelessUIImport;
    const { closeModal, openModal } = useModal();
    const drawerSlug = useDrawerSlug('blocks-drawer');
    const [indexToAdd, setIndexToAdd] = React.useState(null);
    return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(BlocksDrawer, {
        addRow: (_, rowBlockType)=>{
            if (typeof addRow === 'function') {
                addRow(indexToAdd, rowBlockType);
            }
            closeModal(drawerSlug);
        },
        addRowIndex: rowIndex,
        blocks: blocks,
        drawerSlug: drawerSlug,
        labels: labels
    }), /*#__PURE__*/ React.createElement(ArrayAction, {
        addRow: (index)=>{
            setIndexToAdd(index);
            openModal(drawerSlug);
        },
        duplicateRow: ()=>duplicateRow(rowIndex, blockType),
        hasMaxRows: hasMaxRows,
        index: rowIndex,
        moveRow: moveRow,
        removeRow: removeRow,
        rowCount: rowCount
    }));
};

//# sourceMappingURL=RowActions.js.map