import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2021-2025 GoodData Corporation
import { useIntl } from "react-intl";
import { Bubble, BubbleHoverTrigger, DropdownButton } from "@gooddata/sdk-ui-kit";
import { getTooltip } from "./DashboardListItem.js";
const tooltipAlignPoints = [
    { align: "cl cr", offset: { x: 0, y: -2 } },
    { align: "cr cl", offset: { x: 0, y: 10 } },
];
function Button({ accessibilityLimitation, toggleDropdown, isOpen, label }) {
    const icon = accessibilityLimitation === undefined ? undefined : "gd-icon-circle-exclamation";
    return (_jsx(DropdownButton, { className: "dashboard-dropdown-button s-dashboards-dropdown-button", value: label, isOpen: isOpen, onClick: toggleDropdown, iconLeft: icon }));
}
export function DashboardListButton(props) {
    const { accessibilityLimitation } = props;
    const intl = useIntl();
    const tooltip = getTooltip(intl, accessibilityLimitation);
    if (!tooltip) {
        return _jsx(Button, { ...props });
    }
    return (_jsxs(BubbleHoverTrigger, { tagName: "div", showDelay: 200, hideDelay: 0, children: [
            _jsx(Button, { ...props }), _jsx(Bubble, { className: "bubble-primary", alignPoints: tooltipAlignPoints, arrowOffsets: { "cr cl": [15, 0] }, children: tooltip })
        ] }));
}
//# sourceMappingURL=DashboardListButton.js.map