import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2025-2026 GoodData Corporation
import { forwardRef } from "react";
import { simplifyText } from "@gooddata/util";
import { accessibilityConfigToAttributes } from "../../typings/utilities.js";
import { bem } from "../@utils/bem.js";
import { getButtonIconSize } from "../@utils/size.js";
import { UiIcon } from "../UiIcon/UiIcon.js";
const { b } = bem("gd-ui-kit-icon-button");
export const UiIconButtonRenderer = forwardRef(({ icon, iconColor, iconAfter, iconAfterSize = "xsmall", disableAnimation, label, size = "medium", variant = "secondary", isDesctructive, isDisabled, isActive, onClick, dataId, dataTestId, onKeyDown, ariaAttributes, accessibilityConfig, tabIndex, id, }, ref) => {
    const iconSize = getButtonIconSize(size);
    const testId = dataTestId || `${simplifyText(label ?? "")}`;
    return (_jsxs("button", { ref: ref, className: b({
            type: iconAfter ? "dropdownButton" : "button",
            size,
            variant,
            active: isActive ?? false,
            destructive: variant === "tertiary" && (isDesctructive ?? false),
        }), id: id, disabled: isDisabled, onClick: onClick, onKeyDown: onKeyDown, "data-id": dataId, "data-testid": testId, "aria-disabled": isDisabled, "aria-label": label, tabIndex: tabIndex, ...accessibilityConfigToAttributes(accessibilityConfig), ...ariaAttributes, children: [
            _jsx(UiIcon, { type: icon, size: iconSize, color: iconColor, disableAnimation: disableAnimation }), iconAfter ? _jsx(UiIcon, { type: iconAfter, size: getButtonIconSize(iconAfterSize) }) : null] }));
});
UiIconButtonRenderer.displayName = "UiIconButtonRenderer";
