UNPKG

@stakefish/ui

Version:

<div align="center"> <a href="https://www.npmjs.com/package/@stakefish/ui"><img src="https://gateway.pinata.cloud/ipfs/QmbZL1ceA8Yiz2pKALTg919jYx141DPUGegC9L4XpyayW5" width="300" /></a> </div>

43 lines (40 loc) 2.04 kB
import { a as __rest, _ as __assign } from '../tslib.es6-35932c2c.js'; import { jsx } from 'react/jsx-runtime'; import { styled } from '@mui/material/styles'; import MuiTooltip, { tooltipClasses } from '@mui/material/Tooltip'; var TooltipSizeVariants; (function (TooltipSizeVariants) { TooltipSizeVariants["Small"] = "small"; TooltipSizeVariants["Medium"] = "medium"; TooltipSizeVariants["Large"] = "large"; })(TooltipSizeVariants || (TooltipSizeVariants = {})); var sizeMap = new Map([ [TooltipSizeVariants.Small, { y: 1, x: 2 }], [TooltipSizeVariants.Medium, { y: 2, x: 3 }], [TooltipSizeVariants.Large, { y: 3, x: 3 }] ]); var StyledTooltip = styled(function (_a) { var className = _a.className; _a.size; var props = __rest(_a, ["className", "size"]); return (jsx(MuiTooltip, __assign({}, props, { classes: { popper: className } }), void 0)); })(function (_a) { var _b, _c; var _d, _e, _f, _g; var theme = _a.theme, size = _a.size; return (_b = {}, _b["& .".concat(tooltipClasses.tooltip)] = (_c = { padding: theme.spacing((_e = (_d = sizeMap.get(size)) === null || _d === void 0 ? void 0 : _d.y) !== null && _e !== void 0 ? _e : 0, (_g = (_f = sizeMap.get(size)) === null || _f === void 0 ? void 0 : _f.x) !== null && _g !== void 0 ? _g : 0), borderRadius: size === TooltipSizeVariants.Small ? theme.borders.radius.sm : theme.borders.radius.lg, boxShadow: theme.boxShadow.md }, _c[theme.breakpoints.down("sm")] = { padding: theme.spacing(2), borderRadius: size === TooltipSizeVariants.Small ? theme.borders.radius.xs1 : theme.borders.radius.sm }, _c), _b); }); var Tooltip = function (_a) { var children = _a.children, props = __rest(_a, ["children"]); return jsx(StyledTooltip, __assign({}, props, { children: children }), void 0); }; export { TooltipSizeVariants, Tooltip as default, sizeMap };