UNPKG

@flatbiz/antd

Version:
86 lines (82 loc) 2.89 kB
/*! @flatjs/forge MIT @flatbiz/antd */ import { _ as _objectWithoutProperties, b as _objectSpread2 } from './_rollupPluginBabelHelpers-BYm17lo8.js'; import { classNames } from '@dimjs/utils/class-names/class-names'; import { isUndefined } from '@dimjs/lang/is-undefined'; import { Fragment } from 'react'; import { Popover, Tooltip } from 'antd'; import { jsx, jsxs } from 'react/jsx-runtime'; var _excluded = ["gap", "size", "hideHoverBgColor", "onClick", "className", "hidden", "style", "icon", "position", "text", "hoverTips", "tipsType"]; var IconWrapper = function IconWrapper(props) { var gap = props.gap, size = props.size, hideHoverBgColor = props.hideHoverBgColor, onClick = props.onClick, className = props.className, hidden = props.hidden, style = props.style, icon = props.icon, position = props.position, text = props.text, hoverTips = props.hoverTips, tipsType = props.tipsType, otherProps = _objectWithoutProperties(props, _excluded); var gapNew = isUndefined(gap) ? 5 : gap; var classNameNew = classNames('icon-wrapper', "icon-wrapper-".concat(size || 'middle'), { 'icon-wrapper-hidden-hover-bgcolor': hideHoverBgColor, 'icon-wrapper-tigger': !!Object.keys(props).find(function (item) { return item.startsWith('on'); }) }, className); if (hidden) return /*#__PURE__*/jsx(Fragment, {}); var _content = position === 'after' ? /*#__PURE__*/jsxs("span", _objectSpread2(_objectSpread2({ className: classNameNew, style: style, onClick: onClick }, otherProps), {}, { children: [text ? /*#__PURE__*/jsx("span", { className: "icon-wrapper-text", style: icon ? { marginRight: gapNew } : {}, children: text }) : null, icon] })) : /*#__PURE__*/jsxs("span", _objectSpread2(_objectSpread2({ className: classNameNew, style: style, onClick: onClick }, otherProps), {}, { children: [icon, text ? /*#__PURE__*/jsx("span", { className: "icon-wrapper-text", style: icon ? { marginLeft: gapNew } : {}, children: text }) : null] })); if (hoverTips) { if (tipsType === 'popover') { return /*#__PURE__*/jsx("div", { className: "icon-wrapper-wrapper", children: /*#__PURE__*/jsx(Popover, _objectSpread2(_objectSpread2({ content: hoverTips }, otherProps), {}, { children: _content })) }); } return /*#__PURE__*/jsx("div", { className: "icon-wrapper-wrapper", children: /*#__PURE__*/jsx(Tooltip, _objectSpread2(_objectSpread2({ title: hoverTips }, otherProps), {}, { children: _content })) }); } return /*#__PURE__*/jsx("div", { className: "icon-wrapper-wrapper", children: _content }); }; export { IconWrapper as I }; //# sourceMappingURL=icon-wrapper-HJ2r5GeZ.js.map