import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { tasty, TooltipProvider } from '@cube-dev/ui-kit';
import { useHasOverflow } from '../hooks';
import { titleize } from '../utils';
const TooltipWrapper = tasty({
    styles: {
        Name: {
            display: 'block',
            width: 'max-content',
            preset: 't4m',
        },
        Title: {
            display: 'block',
            width: 'max-content',
            preset: 't3',
        },
        Description: {
            display: 'block',
            preset: 'p3',
        },
        Type: {
            preset: 'c2',
            opacity: 0.7,
        },
    },
});
export function InstanceTooltipProvider(props) {
    const { name, fullName, type, title, description, children, isDisabled, forceShown, overflowRef, } = props;
    const hasOverflow = useHasOverflow(overflowRef);
    const isAutoTitle = titleize(name) === title;
    if ((!forceShown && (isDisabled || (!hasOverflow && isAutoTitle) || !overflowRef)) || !fullName) {
        return children;
    }
    return (_jsx(TooltipProvider, { title: _jsx(_Fragment, { children: _jsxs(TooltipWrapper, { children: [type && _jsx("div", { "data-element": "Type", children: type }), _jsx("div", { "data-element": "Name", children: fullName }), _jsx("div", { "data-element": "Title", children: title }), _jsx("div", { "data-element": "Description", children: description })] }) }), width: "max-content", delay: 1000, placement: "right", children: children }));
}
//# sourceMappingURL=InstanceTooltipProvider.js.map