import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from 'react';
import { classNames } from '../utils/classNames';
import { cva } from '../utils/cva';
import { tooltipClassnames } from './constants';
import { ContentWrapper, StyledTooltip } from './styles';
import { useLogic } from './useLogic';
const tooltipCva = cva(tooltipClassnames.root, {
    variants: {
        withoutMaxWidth: {
            true: tooltipClassnames.withoutMaxWidth,
        },
    },
});
export const Tooltip = forwardRef((props, ref) => {
    const { title, placement = 'top', size = 'medium', withoutContainer = true, children, className, tooltipStyle, width, ...restProps } = useLogic(props);
    return (_jsx(StyledTooltip, { ref: ref, title: title, size: size, placement: placement, arrow: true, className: classNames(className, tooltipCva({ withoutMaxWidth: Boolean(width) })), style: tooltipStyle, ...restProps, children: withoutContainer ? (children) : (_jsx(ContentWrapper, { className: tooltipClassnames.contentWrapper, children: children })) }));
});
