"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tooltip = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("@tippyjs/react"));
const box_1 = __importDefault(require("../box"));
const core_1 = require("../core");
const link_1 = require("../link");
const consts_1 = require("./consts");
const tooltipContent_1 = require("./tooltipContent");
/**
 * A simple text popup hint.
 *
 * Displayed on mouse enter, and is hidden on mouse leave.
 *
 * */
const Tooltip = (props) => {
    const { children, fontSize = '16px', linkText, linkProps, maxWidth = '400px', text = 'Tooltip', placement = 'top', disabled = false, visible = false, } = props;
    const isDesktop = (0, core_1.useUp)('md');
    return ((0, jsx_runtime_1.jsx)(react_1.default, { content: !!text && ((0, jsx_runtime_1.jsxs)(tooltipContent_1.TooltipContent, { disabled: disabled, fontSize: fontSize, maxWidth: maxWidth, children: [isDesktop && ((0, jsx_runtime_1.jsx)(box_1.default, { bg: disabled ? consts_1.bg.disabled : consts_1.bg.regular, bottom: consts_1.pointerPlacement[placement].bottom, h: `${consts_1.pointerSize}px`, left: consts_1.pointerPlacement[placement].left, position: "absolute", right: consts_1.pointerPlacement[placement].right, top: consts_1.pointerPlacement[placement].top, transform: `translate(${consts_1.pointerPlacement[placement].translate}) rotate(45deg)`, w: `${consts_1.pointerSize}px` })), (0, jsx_runtime_1.jsxs)(core_1.v.div, { children: [text, !!linkText && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u00A0", (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({ variant: "white" }, linkProps, { children: linkText }))] }))] })] })), interactive: true, offset: [0, 2], placement: placement, popperOptions: {
            modifiers: [
                {
                    name: 'flip',
                    enabled: false,
                },
            ],
        }, visible: visible || undefined, children: children }));
};
exports.Tooltip = Tooltip;
exports.Tooltip.displayName = 'Tooltip';
exports.default = exports.Tooltip;
//# sourceMappingURL=tooltip.js.map