UNPKG

@maherunlocker/custom-react-table

Version:
16 lines 925 B
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import { Tooltip as MuiTooltip } from '@mui/material'; import { makeStyles } from '@mui/styles'; const useStyles = makeStyles({ truncated: { textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', }, }); export const TooltipCellRenderer = ({ cell: { value }, column: { align = 'left' }, }) => _jsx(TooltipCell, { text: value, align: align }); export const TooltipCell = ({ text, tooltip = text, align, }) => { const classes = useStyles({}); return (_jsx(_Fragment, { children: tooltip !== null && tooltip !== '' && (_jsx(MuiTooltip, Object.assign({ title: tooltip !== undefined && tooltip !== null ? tooltip : ' ', className: classes.truncated, arrow: true, style: { textAlign: align } }, { children: _jsx("span", { children: text }) }))) })); }; //# sourceMappingURL=TooltipCell.js.map