rc-trigger
Version:
base abstract trigger component for react
45 lines (41 loc) • 1.27 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import * as React from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import { getMotion } from "../utils/legacyUtil";
export default function Mask(props) {
var prefixCls = props.prefixCls,
visible = props.visible,
zIndex = props.zIndex,
mask = props.mask,
maskMotion = props.maskMotion,
maskAnimation = props.maskAnimation,
maskTransitionName = props.maskTransitionName;
if (!mask) {
return null;
}
var motion = {};
if (maskMotion || maskTransitionName || maskAnimation) {
motion = _objectSpread({
motionAppear: true
}, getMotion({
motion: maskMotion,
prefixCls: prefixCls,
transitionName: maskTransitionName,
animation: maskAnimation
}));
}
return /*#__PURE__*/React.createElement(CSSMotion, _extends({}, motion, {
visible: visible,
removeOnLeave: true
}), function (_ref) {
var className = _ref.className;
return /*#__PURE__*/React.createElement("div", {
style: {
zIndex: zIndex
},
className: classNames("".concat(prefixCls, "-mask"), className)
});
});
}