import { jsx } from "react/jsx-runtime";
import { cn } from "@uipath/apollo-wind";
import { motion } from "motion/react";
import { forwardRef } from "react";
const TOOLBAR_ICON_BUTTON_CLASS = "grid place-items-center w-6 h-6 p-0 border-0 rounded-[4px] [transition:background-color_140ms_ease,color_140ms_ease,opacity_140ms_ease] [&>svg]:w-4 [&>svg]:h-4 [&>svg]:text-[inherit] [&>svg]:origin-center [&>svg]:transition-transform [&>svg]:duration-[140ms] [&>svg]:ease-[ease] text-(--tb-color) bg-(--tb-bg) enabled:hover:bg-(--tb-hover-bg) enabled:hover:text-(--tb-hover-color) enabled:hover:[&>svg]:scale-[1.125]";
const TOOLBAR_ICON_BUTTON_DISABLED_CLASS = 'cursor-not-allowed opacity-40 pointer-events-none';
const TOOLBAR_ICON_BUTTON_ENABLED_CLASS = 'cursor-pointer opacity-100';
const ToolbarIconButtonInner = ({ disabled, isToggled, color, hoverBg, className, style, ...rest }, ref)=>{
    const restColor = color ?? (isToggled ? 'var(--canvas-foreground)' : 'var(--canvas-foreground-de-emp)');
    const effectiveHoverColor = color ?? 'var(--canvas-foreground)';
    const restBg = isToggled ? hoverBg ?? 'var(--canvas-background-hover)' : 'transparent';
    const effectiveHoverBg = hoverBg ?? 'var(--canvas-background-hover)';
    const mergedStyle = {
        ['--tb-color']: restColor,
        ['--tb-hover-color']: effectiveHoverColor,
        ['--tb-bg']: restBg,
        ['--tb-hover-bg']: effectiveHoverBg,
        ...style
    };
    return /*#__PURE__*/ jsx(motion.button, {
        ref: ref,
        disabled: disabled,
        className: cn(TOOLBAR_ICON_BUTTON_CLASS, disabled ? TOOLBAR_ICON_BUTTON_DISABLED_CLASS : TOOLBAR_ICON_BUTTON_ENABLED_CLASS, className),
        style: mergedStyle,
        ...rest
    });
};
const ToolbarIconButton = /*#__PURE__*/ forwardRef(ToolbarIconButtonInner);
ToolbarIconButton.displayName = 'ToolbarIconButton';
export { ToolbarIconButton };
