UNPKG

@flatbiz/antd

Version:
38 lines (34 loc) 1.21 kB
/*! @flatjs/forge MIT @flatbiz/antd */ import { b as _objectSpread2 } from './_rollupPluginBabelHelpers-BYm17lo8.js'; import { classNames } from '@dimjs/utils/class-names/class-names'; import { Fragment, cloneElement } from 'react'; import { toArray } from '@flatbiz/utils'; import { jsx } from 'react/jsx-runtime'; /** * css hover 效果 * ``` * 1. 当children为数组时,会为children添加父级(会产生新节点) * 2. 当children为单个元素时,会在children元素上添加className、style(不会产生新节点) * ``` * @param props * @returns */ var CssNodeHover = function CssNodeHover(props) { var children = toArray(props.children); if (children.length > 1) { return /*#__PURE__*/jsx("div", { className: "v-css-hover", style: props.style, children: children }); } var element = props.children; return /*#__PURE__*/jsx(Fragment, { children: /*#__PURE__*/cloneElement(element, { className: classNames('v-css-hover', element.props.className), style: _objectSpread2(_objectSpread2({}, props.style), element.props.style) }) }); }; export { CssNodeHover as C }; //# sourceMappingURL=css-node-hover-CsHQgf77.js.map