UNPKG

1.27 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3import * as React from 'react';
4import classNames from 'classnames';
5import CSSMotion from 'rc-motion';
6import { getMotion } from "../utils/legacyUtil";
7export default function Mask(props) {
8 var prefixCls = props.prefixCls,
9 visible = props.visible,
10 zIndex = props.zIndex,
11 mask = props.mask,
12 maskMotion = props.maskMotion,
13 maskAnimation = props.maskAnimation,
14 maskTransitionName = props.maskTransitionName;
15
16 if (!mask) {
17 return null;
18 }
19
20 var motion = {};
21
22 if (maskMotion || maskTransitionName || maskAnimation) {
23 motion = _objectSpread({
24 motionAppear: true
25 }, getMotion({
26 motion: maskMotion,
27 prefixCls: prefixCls,
28 transitionName: maskTransitionName,
29 animation: maskAnimation
30 }));
31 }
32
33 return /*#__PURE__*/React.createElement(CSSMotion, _extends({}, motion, {
34 visible: visible,
35 removeOnLeave: true
36 }), function (_ref) {
37 var className = _ref.className;
38 return /*#__PURE__*/React.createElement("div", {
39 style: {
40 zIndex: zIndex
41 },
42 className: classNames("".concat(prefixCls, "-mask"), className)
43 });
44 });
45}
\No newline at end of file