import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React from 'react';
import classNames from 'classnames';
/**
 * Renders an overlay that blocks user interaction
 */

var Overlay = function Overlay(props) {
  var show = props.show,
      onClick = props.onClick,
      onKeyPress = props.onKeyPress,
      isMobile = props.isMobile,
      rest = _objectWithoutProperties(props, ["show", "onClick", "onKeyPress", "isMobile"]);

  if (!show) {
    return null;
  }

  var overlayProps = _objectSpread({
    onClick: onClick,
    role: 'presentation',
    onKeyPress: onKeyPress || onClick,
    className: classNames({
      overlay: true,
      'mobile-only': isMobile
    })
  }, rest);

  return React.createElement("div", overlayProps);
};

Overlay.defaultProps = {
  onClick: undefined,
  onKeyPress: undefined,
  isMobile: false
};
export default Overlay;