import React, { forwardRef } from "react";
import * as RadixTooltip from "@radix-ui/react-tooltip";
import { StyledArrow, StyledContent } from "./Tooltip.styled.js";
const TooltipProvider = (props) => {
    const radixProps = {};
    if (props.delayDuration !== undefined) {
        radixProps.delayDuration = props.delayDuration;
    }
    if (props.skipDelayDuration !== undefined) {
        radixProps.skipDelayDuration = props.skipDelayDuration;
    }
    if (props.disableHoverableContent !== undefined) {
        radixProps.disableHoverableContent = props.disableHoverableContent;
    }
    return (React.createElement(RadixTooltip.Provider, { ...radixProps }, props.children));
};
const Tooltip = forwardRef((props, ref) => {
    const { content, side = "top", sideOffset = 6, align = "center", alignOffset = 0, delayDuration, avoidCollisions = true, arrow = true, open, defaultOpen, onOpenChange, className, children, } = props;
    const rootProps = {};
    if (open !== undefined) {
        rootProps.open = open;
    }
    if (defaultOpen !== undefined) {
        rootProps.defaultOpen = defaultOpen;
    }
    if (onOpenChange !== undefined) {
        rootProps.onOpenChange = onOpenChange;
    }
    if (delayDuration !== undefined) {
        rootProps.delayDuration = delayDuration;
    }
    return (React.createElement(RadixTooltip.Root, { ...rootProps },
        React.createElement(RadixTooltip.Trigger, { asChild: true }, children),
        React.createElement(RadixTooltip.Portal, null,
            React.createElement(StyledContent, { ref: ref, side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset, avoidCollisions: avoidCollisions, className: className },
                content,
                arrow && React.createElement(StyledArrow, { width: 10, height: 5 })))));
});
Tooltip.displayName = "Tooltip";
Tooltip.toString = () => StyledContent.toString();
const TooltipContentSelector = StyledContent.toString();
export { Tooltip, TooltipProvider, TooltipContentSelector, };
//# sourceMappingURL=Tooltip.js.map