@material-ui/core
Version:
React components that implement Google's Material Design.
56 lines (52 loc) • 1.52 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import React from 'react';
import PropTypes from 'prop-types';
export const styles = {
/* Styles applied to the root element. */
root: {
zIndex: -1,
position: 'fixed',
right: 0,
bottom: 0,
top: 0,
left: 0,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
// Remove grey highlight
WebkitTapHighlightColor: 'transparent',
// Disable scroll capabilities.
touchAction: 'none'
},
/* Styles applied to the root element if `invisible={true}`. */
invisible: {
backgroundColor: 'transparent'
}
};
/**
* @ignore - internal component.
*/
const SimpleBackdrop = React.forwardRef(function SimpleBackdrop(props, ref) {
const {
invisible = false,
open
} = props,
other = _objectWithoutPropertiesLoose(props, ["invisible", "open"]);
return open ? React.createElement("div", _extends({
"aria-hidden": true,
ref: ref
}, other, {
style: _extends({}, styles.root, {}, invisible ? styles.invisible : {}, {}, other.style)
})) : null;
});
process.env.NODE_ENV !== "production" ? SimpleBackdrop.propTypes = {
/**
* If `true`, the backdrop is invisible.
* It can be used when rendering a popover or a custom select component.
*/
invisible: PropTypes.bool,
/**
* If `true`, the backdrop is open.
*/
open: PropTypes.bool.isRequired
} : void 0;
export default SimpleBackdrop;