import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2025 GoodData Corporation
import { forwardRef } from "react";
import { stringUtils } 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, iconAfter, iconAfterSize = "xsmall", label, size = "medium", variant = "secondary", isDisabled, isActive, onClick, dataId, dataTestId, onKeyDown, ariaAttributes, accessibilityConfig, tabIndex, }, ref) => {
    const iconSize = getButtonIconSize(size);
    const testId = dataTestId || `${stringUtils.simplifyText(label)}`;
    return (_jsxs("button", { ref: ref, className: b({
            type: iconAfter ? "dropdownButton" : "button",
            size,
            variant,
            active: isActive,
        }), disabled: isDisabled, onClick: onClick, onKeyDown: onKeyDown, "data-id": dataId, "data-testid": testId, "aria-disabled": isDisabled, "aria-label": label, tabIndex: tabIndex, ...ariaAttributes, ...accessibilityConfigToAttributes(accessibilityConfig), children: [_jsx(UiIcon, { type: icon, size: iconSize, ariaHidden: true }), iconAfter ? (_jsx(UiIcon, { type: iconAfter, size: getButtonIconSize(iconAfterSize), ariaHidden: true })) : null] }));
});
UiIconButtonRenderer.displayName = "UiIconButtonRenderer";
//# sourceMappingURL=UiIconButtonRenderer.js.map