import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2025 GoodData Corporation
import { useRef } from "react";
import { useIntl } from "react-intl";
import UiAsyncTableDropdownItem from "./UiAsyncTableDropdownItem.js";
import { Dropdown } from "../../../Dropdown/Dropdown.js";
import { DropdownList } from "../../../Dropdown/DropdownList.js";
import { UiButton } from "../../UiButton/UiButton.js";
import { UiAutofocus } from "../../UiFocusManager/UiAutofocus.js";
import { e } from "../asyncTableBem.js";
import { messages } from "../locales.js";
export function UiAsyncTableBulkActions({ bulkActions }) {
    const buttonRef = useRef(null);
    const intl = useIntl();
    return (_jsx("div", { className: e("bulk-actions"), children: _jsx(Dropdown, { renderButton: ({ toggleDropdown }) => (_jsx(UiButton, { variant: "primary", ref: buttonRef, isDisabled: !bulkActions.length, label: intl.formatMessage(messages["chooseAction"]), onClick: () => toggleDropdown(), size: "small", iconAfter: "navigateDown" })), alignPoints: [{ align: "bl tl" }], renderBody: ({ closeDropdown }) => (_jsx(UiAutofocus, { children: _jsx(DropdownList, { items: bulkActions, renderItem: ({ item }) => (_jsx(UiAsyncTableDropdownItem, { label: item.label, onClick: () => {
                            item.onClick();
                            closeDropdown();
                        } })), width: 200, renderVirtualisedList: true }) })) }) }));
}
//# sourceMappingURL=UiAsyncTableBulkActions.js.map