1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | import Fade from '../Fade';
|
8 | export const styles = {
|
9 |
|
10 | root: {
|
11 |
|
12 | zIndex: -1,
|
13 | position: 'fixed',
|
14 | display: 'flex',
|
15 | alignItems: 'center',
|
16 | justifyContent: 'center',
|
17 | right: 0,
|
18 | bottom: 0,
|
19 | top: 0,
|
20 | left: 0,
|
21 | backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
22 | WebkitTapHighlightColor: 'transparent'
|
23 | },
|
24 |
|
25 |
|
26 | invisible: {
|
27 | backgroundColor: 'transparent'
|
28 | }
|
29 | };
|
30 | const Backdrop = React.forwardRef(function Backdrop(props, ref) {
|
31 | const {
|
32 | children,
|
33 | classes,
|
34 | className,
|
35 | invisible = false,
|
36 | open,
|
37 | transitionDuration,
|
38 |
|
39 | TransitionComponent = Fade
|
40 | } = props,
|
41 | other = _objectWithoutPropertiesLoose(props, ["children", "classes", "className", "invisible", "open", "transitionDuration", "TransitionComponent"]);
|
42 |
|
43 | return React.createElement(TransitionComponent, _extends({
|
44 | in: open,
|
45 | timeout: transitionDuration
|
46 | }, other), React.createElement("div", {
|
47 | className: clsx(classes.root, className, invisible && classes.invisible),
|
48 | "aria-hidden": true,
|
49 | ref: ref
|
50 | }, children));
|
51 | });
|
52 | process.env.NODE_ENV !== "production" ? Backdrop.propTypes = {
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | |
59 |
|
60 |
|
61 | children: PropTypes.node,
|
62 |
|
63 | |
64 |
|
65 |
|
66 |
|
67 | classes: PropTypes.object,
|
68 |
|
69 | |
70 |
|
71 |
|
72 | className: PropTypes.string,
|
73 |
|
74 | |
75 |
|
76 |
|
77 |
|
78 | invisible: PropTypes.bool,
|
79 |
|
80 | |
81 |
|
82 |
|
83 | open: PropTypes.bool.isRequired,
|
84 |
|
85 | |
86 |
|
87 |
|
88 |
|
89 | transitionDuration: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
90 | appear: PropTypes.number,
|
91 | enter: PropTypes.number,
|
92 | exit: PropTypes.number
|
93 | })])
|
94 | } : void 0;
|
95 | export default withStyles(styles, {
|
96 | name: 'MuiBackdrop'
|
97 | })(Backdrop); |
\ | No newline at end of file |