import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Tooltip } from '../Tooltip';
import { classNames } from '../utils/classNames';
import { copyTypographyClassnames } from './constants';
import { StyledCopyIcon, TypographyWrapper, Wrapper } from './styles';
import { useLogic } from './useLogic';
export const CopyTypography = (props) => {
    const { handleMouseLeave, handleClick, tooltipTitle, isIconOnLeft, isIconOnRight, restProps, copyPosition, color, showCopyIcon, isOverflow, children, tooltipProps, } = useLogic(props);
    const renderIcon = () => (_jsx(StyledCopyIcon, { size: "sm", "$copyPosition": copyPosition, color: color, className: classNames({
            [copyTypographyClassnames.showIconOnHover]: showCopyIcon === 'onHover',
        }) }));
    return (_jsx(Tooltip, { title: tooltipTitle, disableInteractive: true, placement: "bottom", ...tooltipProps, children: _jsxs(Wrapper, { onMouseLeave: handleMouseLeave, onClick: handleClick, component: "div", color: color, ...restProps, children: [isIconOnLeft && renderIcon(), _jsx(TypographyWrapper, { className: classNames({
                        [copyTypographyClassnames.overflow]: isOverflow,
                    }), children: children }), isIconOnRight && renderIcon()] }) }));
};
