UNPKG

@wulperstudio/cms

Version:
69 lines 2.67 kB
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["direction", "gap", "alignItems"]; import React from 'react'; import { Icon } from '@iconify/react'; import { IconButton, Stack, Typography, useTheme } from '@mui/material'; import { Tooltip } from '../Tooltip'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; var IconText = function IconText(_ref) { var nameIcon = _ref.nameIcon, text = _ref.text, typographyProps = _ref.typographyProps, colorIcon = _ref.colorIcon, titleTooltip = _ref.titleTooltip, tooltipPros = _ref.tooltipPros, isOpenTooltip = _ref.isOpenTooltip, iconButtonProps = _ref.iconButtonProps, containerProps = _ref.containerProps; var theme = useTheme(); var _ref2 = containerProps || {}, _ref2$direction = _ref2.direction, direction = _ref2$direction === void 0 ? 'row' : _ref2$direction, _ref2$gap = _ref2.gap, gap = _ref2$gap === void 0 ? '.5rem' : _ref2$gap, _ref2$alignItems = _ref2.alignItems, alignItems = _ref2$alignItems === void 0 ? 'center' : _ref2$alignItems, rest = _objectWithoutProperties(_ref2, _excluded); return /*#__PURE__*/_jsxs(Stack, Object.assign({ direction: direction, gap: gap, alignItems: alignItems }, rest, { children: [isOpenTooltip && /*#__PURE__*/_jsx(Tooltip, Object.assign({ title: titleTooltip || 'default-title-tooltip' }, tooltipPros, { children: /*#__PURE__*/_jsx(IconButton, Object.assign({ disableTouchRipple: true, disableFocusRipple: true, disableRipple: true, sx: { border: "1px solid ".concat(theme.palette.background.paper) } }, iconButtonProps, { children: /*#__PURE__*/_jsx(Icon, { className: "icon-tooltip", icon: nameIcon != null ? nameIcon : 'akar-icons:circle-fill', color: colorIcon != null ? colorIcon : theme.palette.primary.main }) })) })), !isOpenTooltip && /*#__PURE__*/_jsx(IconButton, Object.assign({ disableTouchRipple: true, disableFocusRipple: true, disableRipple: true, sx: { border: "1px solid ".concat(theme.palette.background.paper) } }, iconButtonProps, { children: /*#__PURE__*/_jsx(Icon, { className: "icon-tooltip", icon: nameIcon != null ? nameIcon : 'akar-icons:circle-fill', color: colorIcon != null ? colorIcon : theme.palette.primary.main }) })), /*#__PURE__*/_jsx(Typography, Object.assign({ variant: "body1" }, typographyProps, { children: text }))] })); }; export default IconText;