import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import { useIntl } from "react-intl";
import { messages } from "@gooddata/sdk-ui";
import { Item, ItemsWrapper, Overlay, Separator } from "@gooddata/sdk-ui-kit";
import { useAttributeHierarchyDialog } from "./AttributeHierarchyDialogProvider.js";
const ALIGN_POINTS = [{ align: "br tr" }];
export function AddActionMenu({ rowIndex, alignTo, onClose }) {
    const { formatMessage } = useIntl();
    const { onAddEmptyAttribute } = useAttributeHierarchyDialog();
    const handleAddAbove = () => {
        onAddEmptyAttribute(rowIndex - 1);
        onClose();
    };
    const handleAddBellow = () => {
        onAddEmptyAttribute(rowIndex);
        onClose();
    };
    const addAboveText = formatMessage(messages["hierarchyAddAttributeAbove"]);
    const addBellowText = formatMessage(messages["hierarchyAddAttributeBellow"]);
    return (_jsx(Overlay, { alignTo: alignTo, alignPoints: ALIGN_POINTS, closeOnMouseDrag: true, closeOnOutsideClick: true, onClose: onClose, className: "attribute-hierarchy-add-action-menu s-attribute-hierarchy-add-action-menu", children: _jsxs(ItemsWrapper, { smallItemsSpacing: true, children: [
                _jsxs(Item, { onClick: handleAddAbove, children: [
                        _jsx("i", { className: "gd-icon-arrow-up s-add-above" }), addAboveText] }), _jsx(Separator, {}), _jsxs(Item, { onClick: handleAddBellow, children: [
                        _jsx("i", { className: "gd-icon-arrow-down s-add-below" }), addBellowText] })
            ] }) }));
}
//# sourceMappingURL=AddActionMenu.js.map