UNPKG

1.46 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5export const styles = {
6 /* Styles applied to the root element. */
7 root: {
8 zIndex: -1,
9 position: 'fixed',
10 right: 0,
11 bottom: 0,
12 top: 0,
13 left: 0,
14 backgroundColor: 'rgba(0, 0, 0, 0.5)',
15 WebkitTapHighlightColor: 'transparent'
16 },
17
18 /* Styles applied to the root element if `invisible={true}`. */
19 invisible: {
20 backgroundColor: 'transparent'
21 }
22};
23/**
24 * @ignore - internal component.
25 */
26
27const SimpleBackdrop = /*#__PURE__*/React.forwardRef(function SimpleBackdrop(props, ref) {
28 const {
29 invisible = false,
30 open
31 } = props,
32 other = _objectWithoutPropertiesLoose(props, ["invisible", "open"]);
33
34 return open ? /*#__PURE__*/React.createElement("div", _extends({
35 "aria-hidden": true,
36 ref: ref
37 }, other, {
38 style: _extends({}, styles.root, invisible ? styles.invisible : {}, other.style)
39 })) : null;
40});
41process.env.NODE_ENV !== "production" ? SimpleBackdrop.propTypes = {
42 /**
43 * If `true`, the backdrop is invisible.
44 * It can be used when rendering a popover or a custom select component.
45 */
46 invisible: PropTypes.bool,
47
48 /**
49 * If `true`, the backdrop is open.
50 */
51 open: PropTypes.bool.isRequired
52} : void 0;
53export default SimpleBackdrop;
\No newline at end of file