1 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
4 |
|
5 | var _fadeStyles;
|
6 |
|
7 | import classNames from 'classnames';
|
8 | import React from 'react';
|
9 | import PropTypes from 'prop-types';
|
10 | import Transition, { ENTERED, ENTERING } from 'react-transition-group/Transition';
|
11 | var propTypes = {
|
12 | |
13 |
|
14 |
|
15 | in: PropTypes.bool,
|
16 |
|
17 | |
18 |
|
19 |
|
20 | mountOnEnter: PropTypes.bool,
|
21 |
|
22 | |
23 |
|
24 |
|
25 | unmountOnExit: PropTypes.bool,
|
26 |
|
27 | |
28 |
|
29 |
|
30 |
|
31 | appear: PropTypes.bool,
|
32 |
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 | timeout: PropTypes.number,
|
39 |
|
40 | |
41 |
|
42 |
|
43 | onEnter: PropTypes.func,
|
44 |
|
45 | |
46 |
|
47 |
|
48 | onEntering: PropTypes.func,
|
49 |
|
50 | |
51 |
|
52 |
|
53 | onEntered: PropTypes.func,
|
54 |
|
55 | |
56 |
|
57 |
|
58 | onExit: PropTypes.func,
|
59 |
|
60 | |
61 |
|
62 |
|
63 | onExiting: PropTypes.func,
|
64 |
|
65 | |
66 |
|
67 |
|
68 | onExited: PropTypes.func
|
69 | };
|
70 | var defaultProps = {
|
71 | in: false,
|
72 | timeout: 300,
|
73 | mountOnEnter: false,
|
74 | unmountOnExit: false,
|
75 | appear: false
|
76 | };
|
77 | var fadeStyles = (_fadeStyles = {}, _fadeStyles[ENTERING] = 'in', _fadeStyles[ENTERED] = 'in', _fadeStyles);
|
78 |
|
79 | var Fade =
|
80 |
|
81 | function (_React$Component) {
|
82 | _inheritsLoose(Fade, _React$Component);
|
83 |
|
84 | function Fade() {
|
85 | return _React$Component.apply(this, arguments) || this;
|
86 | }
|
87 |
|
88 | var _proto = Fade.prototype;
|
89 |
|
90 | _proto.render = function render() {
|
91 | var _this$props = this.props,
|
92 | className = _this$props.className,
|
93 | children = _this$props.children,
|
94 | props = _objectWithoutPropertiesLoose(_this$props, ["className", "children"]);
|
95 |
|
96 | return React.createElement(Transition, props, function (status, innerProps) {
|
97 | return React.cloneElement(children, _extends({}, innerProps, {
|
98 | className: classNames('fade', className, children.props.className, fadeStyles[status])
|
99 | }));
|
100 | });
|
101 | };
|
102 |
|
103 | return Fade;
|
104 | }(React.Component);
|
105 |
|
106 | Fade.propTypes = propTypes;
|
107 | Fade.defaultProps = defaultProps;
|
108 | export default Fade; |
\ | No newline at end of file |