UNPKG

@vlinderclimate/net-zero-ui

Version:

<div align="center"> <img src="https://storage.yandexcloud.net/static.vlinderstorage.com/Telegram_VlinderTech.png" width=200 /> </div> <h1 align="center">Net Zero UI kit</h1>

53 lines (46 loc) 2.34 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tslib_es6 = require('../tslib.es6-9240d9d1.js'); var jsxRuntime = require('react/jsx-runtime'); var styles = require('@mui/material/styles'); var MuiTooltip = require('@mui/material/Tooltip'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var MuiTooltip__default = /*#__PURE__*/_interopDefaultLegacy(MuiTooltip); exports.TooltipSizeVariants = void 0; (function (TooltipSizeVariants) { TooltipSizeVariants["Small"] = "small"; TooltipSizeVariants["Medium"] = "medium"; TooltipSizeVariants["Large"] = "large"; })(exports.TooltipSizeVariants || (exports.TooltipSizeVariants = {})); var sizeMap = new Map([ [exports.TooltipSizeVariants.Small, { y: 0.5, x: 2 }], [exports.TooltipSizeVariants.Medium, { y: 1, x: 3 }], [exports.TooltipSizeVariants.Large, { y: 2.6, x: 4 }] ]); var StyledTooltip = styles.styled(function (_a) { var className = _a.className; _a.size; var props = tslib_es6.__rest(_a, ["className", "size"]); return (jsxRuntime.jsx(MuiTooltip__default["default"], tslib_es6.__assign({}, props, { classes: { popper: className } }), void 0)); })(function (_a) { var _b; var _c, _d, _e, _f; var theme = _a.theme, size = _a.size; return (_b = {}, _b["& ." + MuiTooltip.tooltipClasses.tooltip] = { padding: theme.spacing((_d = (_c = sizeMap.get(size)) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0, (_f = (_e = sizeMap.get(size)) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0), borderRadius: size === exports.TooltipSizeVariants.Small ? theme.borders.radius.sm : theme.borders.radius.xl1, boxShadow: theme.boxShadow.md }, _b); }); var Container = styles.styled("div")(function (_a) { _a.theme; return ({ position: "relative" }); }); var Tooltip = function (_a) { var children = _a.children, props = tslib_es6.__rest(_a, ["children"]); return (jsxRuntime.jsx(StyledTooltip, tslib_es6.__assign({}, props, { children: jsxRuntime.jsx(Container, { children: children }, void 0) }), void 0)); }; exports["default"] = Tooltip; exports.sizeMap = sizeMap;