UNPKG

1.75 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
7Object.defineProperty(exports, "__esModule", {
8 value: true
9});
10exports.default = Mask;
11
12var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
16var React = _interopRequireWildcard(require("react"));
17
18var _classnames = _interopRequireDefault(require("classnames"));
19
20var _rcMotion = _interopRequireDefault(require("rc-motion"));
21
22var _legacyUtil = require("../utils/legacyUtil");
23
24function Mask(props) {
25 var prefixCls = props.prefixCls,
26 visible = props.visible,
27 zIndex = props.zIndex,
28 mask = props.mask,
29 maskMotion = props.maskMotion,
30 maskAnimation = props.maskAnimation,
31 maskTransitionName = props.maskTransitionName;
32
33 if (!mask) {
34 return null;
35 }
36
37 var motion = {};
38
39 if (maskMotion || maskTransitionName || maskAnimation) {
40 motion = (0, _objectSpread2.default)({
41 motionAppear: true
42 }, (0, _legacyUtil.getMotion)({
43 motion: maskMotion,
44 prefixCls: prefixCls,
45 transitionName: maskTransitionName,
46 animation: maskAnimation
47 }));
48 }
49
50 return /*#__PURE__*/React.createElement(_rcMotion.default, (0, _extends2.default)({}, motion, {
51 visible: visible,
52 removeOnLeave: true
53 }), function (_ref) {
54 var className = _ref.className;
55 return /*#__PURE__*/React.createElement("div", {
56 style: {
57 zIndex: zIndex
58 },
59 className: (0, _classnames.default)("".concat(prefixCls, "-mask"), className)
60 });
61 });
62}
\No newline at end of file