import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2025-2026 GoodData Corporation
import cx from "classnames";
import { compact } from "lodash-es";
import { UiIcon, UiTooltip } from "@gooddata/sdk-ui-kit";
import { DrillType } from "./types.js";
const DRILL_ICON_NAME = {
    [DrillType.DRILL_TO_DASHBOARD]: "drillTo",
    [DrillType.DRILL_TO_INSIGHT]: "drillTo",
    [DrillType.DRILL_TO_URL]: "link",
    [DrillType.DRILL_DOWN]: "trendDown",
    [DrillType.CROSS_FILTERING]: "filter",
    [DrillType.KEY_DRIVER_ANALYSIS]: "explainai",
};
export function DrillSelectDropdownMenuItem({ item, }) {
    const { type, name, attributeValue } = item.data;
    const { isDisabled, tooltip } = item;
    const renderLoading = () => {
        return (_jsx("div", { className: "gd-drill-to-url-modal-picker s-drill-to-url-modal-picker", children: _jsx("div", { className: "gd-spinner small" }) }));
    };
    const itemClassName = cx("gd-drill-modal-picker-list-item", "s-gd-drill-modal-picker-item", `s-${type}`, {
        "is-disabled": isDisabled,
    });
    // make sure there is no trailing space in case attributeLabel is empty
    const title = compact([name, attributeValue]).join(" ");
    const content = (_jsxs("div", { className: itemClassName, title: title, children: [
            _jsx("div", { className: "gd-drill-modal-picker-icon-wrapper", children: _jsx(UiIcon, { type: DRILL_ICON_NAME[type], size: 16, color: "complementary-5" }) }), name ? (_jsxs("p", { children: [name, attributeValue ? _jsxs("span", { children: ["\u00A0(", attributeValue, ")"] }) : null] })) : (renderLoading())] }));
    if (tooltip) {
        return (_jsx(UiTooltip, { anchor: content, content: tooltip, optimalPlacement: true, triggerBy: ["hover"], arrowPlacement: "left" }));
    }
    return content;
}
//# sourceMappingURL=DrillSelectDropdownMenuItem.js.map