import React from 'react'; import { ClickAwayListener, Fade, Paper, PopperPlacementType } from "@mui/material"; import { PopoverContent, PopoverRoot, TopTooltipArrow, BottomTooltipArrow, LeftTooltipArrow, RightTooltipArrow, TooltipPanel } from './styled.panel'; interface Props { flip?: boolean, preventOverflow?: boolean, className?: string; content: React.ReactElement; children: React.ReactElement; open: boolean; onClose?: () => void; arrow?: boolean; placement?: PopperPlacementType; } export const RichTooltip: React.FC = ({ className, placement = "top", flip = true, preventOverflow = true, arrow = true, open, onClose = () => { }, content, children }) => { const [arrowRef, setArrowRef] = React.useState(null); const [childNode, setChildNode] = React.useState(null); return (
{React.cloneElement(children, { ...children.props, ref: setChildNode })} x) as any}> {({ TransitionProps }) => ( { arrow ? placement === 'bottom' ? : placement === 'right' ? : placement === 'left' ? : : null } {content} )}
); }