'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React from 'react';
import { ChevronIcon } from '../../icons/Chevron/index.js';
import { CopyIcon } from '../../icons/Copy/index.js';
import { MoreIcon } from '../../icons/More/index.js';
import { PlusIcon } from '../../icons/Plus/index.js';
import { XIcon } from '../../icons/X/index.js';
import { useTranslation } from '../../providers/Translation/index.js';
import { ClipboardActionLabel } from '../ClipboardAction/ClipboardActionLabel.js';
import './index.scss';
import { Popup, PopupList } from '../Popup/index.js';
const baseClass = 'array-actions';
export const ArrayAction = ({ addRow, copyRow, duplicateRow, hasMaxRows, index, isSortable, moveRow, pasteRow, removeRow, rowCount })=>{
    const { t } = useTranslation();
    return /*#__PURE__*/ _jsxDEV(Popup, {
        button: /*#__PURE__*/ _jsxDEV(MoreIcon, {}, void 0, false, {
            fileName: "src/elements/ArrayAction/index.tsx",
            lineNumber: 45,
            columnNumber: 15
        }, void 0),
        buttonClassName: `${baseClass}__button`,
        className: baseClass,
        horizontalAlign: "center",
        render: ({ close })=>{
            return /*#__PURE__*/ _jsxDEV(PopupList.ButtonGroup, {
                buttonSize: "small",
                children: [
                    isSortable && index !== 0 && /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                        className: `${baseClass}__action ${baseClass}__move-up`,
                        onClick: ()=>{
                            moveRow(index, index - 1);
                            close();
                        },
                        children: [
                            /*#__PURE__*/ _jsxDEV("div", {
                                className: `${baseClass}__action-chevron`,
                                children: /*#__PURE__*/ _jsxDEV(ChevronIcon, {
                                    direction: "up"
                                }, void 0, false, {
                                    fileName: "src/elements/ArrayAction/index.tsx",
                                    lineNumber: 61,
                                    columnNumber: 19
                                }, void 0)
                            }, void 0, false, {
                                fileName: "src/elements/ArrayAction/index.tsx",
                                lineNumber: 60,
                                columnNumber: 17
                            }, void 0),
                            t('general:moveUp')
                        ]
                    }, void 0, true, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 53,
                        columnNumber: 15
                    }, void 0),
                    isSortable && index < rowCount - 1 && /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                        className: `${baseClass}__action`,
                        onClick: ()=>{
                            moveRow(index, index + 1);
                            close();
                        },
                        children: [
                            /*#__PURE__*/ _jsxDEV("div", {
                                className: `${baseClass}__action-chevron`,
                                children: /*#__PURE__*/ _jsxDEV(ChevronIcon, {}, void 0, false, {
                                    fileName: "src/elements/ArrayAction/index.tsx",
                                    lineNumber: 75,
                                    columnNumber: 19
                                }, void 0)
                            }, void 0, false, {
                                fileName: "src/elements/ArrayAction/index.tsx",
                                lineNumber: 74,
                                columnNumber: 17
                            }, void 0),
                            t('general:moveDown')
                        ]
                    }, void 0, true, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 67,
                        columnNumber: 15
                    }, void 0),
                    !hasMaxRows && /*#__PURE__*/ _jsxDEV(React.Fragment, {
                        children: [
                            /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                                className: `${baseClass}__action ${baseClass}__add`,
                                onClick: ()=>{
                                    void addRow(index + 1);
                                    close();
                                },
                                children: [
                                    /*#__PURE__*/ _jsxDEV(PlusIcon, {}, void 0, false, {
                                        fileName: "src/elements/ArrayAction/index.tsx",
                                        lineNumber: 89,
                                        columnNumber: 19
                                    }, void 0),
                                    t('general:addBelow')
                                ]
                            }, void 0, true, {
                                fileName: "src/elements/ArrayAction/index.tsx",
                                lineNumber: 82,
                                columnNumber: 17
                            }, void 0),
                            /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                                className: `${baseClass}__action ${baseClass}__duplicate`,
                                onClick: ()=>{
                                    duplicateRow(index);
                                    close();
                                },
                                children: [
                                    /*#__PURE__*/ _jsxDEV(CopyIcon, {}, void 0, false, {
                                        fileName: "src/elements/ArrayAction/index.tsx",
                                        lineNumber: 99,
                                        columnNumber: 19
                                    }, void 0),
                                    t('general:duplicate')
                                ]
                            }, void 0, true, {
                                fileName: "src/elements/ArrayAction/index.tsx",
                                lineNumber: 92,
                                columnNumber: 17
                            }, void 0)
                        ]
                    }, void 0, true, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 81,
                        columnNumber: 15
                    }, void 0),
                    /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                        className: `${baseClass}__action ${baseClass}__copy`,
                        onClick: ()=>{
                            copyRow(index);
                            close();
                        },
                        children: /*#__PURE__*/ _jsxDEV(ClipboardActionLabel, {
                            isRow: true
                        }, void 0, false, {
                            fileName: "src/elements/ArrayAction/index.tsx",
                            lineNumber: 111,
                            columnNumber: 15
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 104,
                        columnNumber: 13
                    }, void 0),
                    /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                        className: `${baseClass}__action ${baseClass}__paste`,
                        onClick: ()=>{
                            pasteRow(index);
                            close();
                        },
                        children: /*#__PURE__*/ _jsxDEV(ClipboardActionLabel, {
                            isPaste: true,
                            isRow: true
                        }, void 0, false, {
                            fileName: "src/elements/ArrayAction/index.tsx",
                            lineNumber: 120,
                            columnNumber: 15
                        }, void 0)
                    }, void 0, false, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 113,
                        columnNumber: 13
                    }, void 0),
                    /*#__PURE__*/ _jsxDEV(PopupList.Button, {
                        className: `${baseClass}__action ${baseClass}__remove`,
                        onClick: ()=>{
                            removeRow(index);
                            close();
                        },
                        children: [
                            /*#__PURE__*/ _jsxDEV(XIcon, {}, void 0, false, {
                                fileName: "src/elements/ArrayAction/index.tsx",
                                lineNumber: 129,
                                columnNumber: 15
                            }, void 0),
                            t('general:remove')
                        ]
                    }, void 0, true, {
                        fileName: "src/elements/ArrayAction/index.tsx",
                        lineNumber: 122,
                        columnNumber: 13
                    }, void 0)
                ]
            }, void 0, true, {
                fileName: "src/elements/ArrayAction/index.tsx",
                lineNumber: 51,
                columnNumber: 11
            }, void 0);
        },
        size: "medium"
    }, void 0, false, {
        fileName: "src/elements/ArrayAction/index.tsx",
        lineNumber: 44,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map