@lunit/oui
Version:
Lunit Oncology UI components
21 lines (20 loc) • 1.05 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Typography } from '@mui/material';
import { forwardRef } from 'react';
import BaseTooltip from './Tooltip.styled';
const Tooltip = forwardRef(({ icon, title, children, size = 'small', placement = 'bottom', noPadding = false, ...otherProps }, ref) => {
return (_jsx(BaseTooltip, { ref: ref, arrow: true, size: size, slotProps: {
popper: {
modifiers: [
{
name: 'offset',
enabled: true,
options: {
offset: [0, 6],
},
},
],
},
}, title: icon && size === 'small' ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'row', gap: '8px' }, children: [icon, title && _jsx(Typography, { variant: "body5", children: title })] })) : (title), placement: placement, noPadding: noPadding, ...otherProps, children: children }));
});
export default Tooltip;