'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var Overlay_styles = require('./Overlay.styles.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

var _excluded = ["withBlur", "className", "backgroundColorProperty", "onOverlayClick", "zIndex", "transparent", "isClickable"];

/**
 * Overlay - подложка для всплывающих компонент (Modal, Toast и т.д.).
 */
var Overlay = function Overlay(_ref) {
  var withBlur = _ref.withBlur,
    className = _ref.className,
    backgroundColorProperty = _ref.backgroundColorProperty,
    onOverlayClick = _ref.onOverlayClick,
    zIndex = _ref.zIndex,
    transparent = _ref.transparent,
    _ref$isClickable = _ref.isClickable,
    isClickable = _ref$isClickable === void 0 ? true : _ref$isClickable,
    rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
  var handleOverlayClick = React.useCallback(function (event) {
    if (!isClickable) {
      return;
    }
    onOverlayClick === null || onOverlayClick === void 0 || onOverlayClick(event);
  }, [isClickable, onOverlayClick]);
  return /*#__PURE__*/React__default.default.createElement(Overlay_styles.StyledOverlay, _rollupPluginBabelHelpers.extends({
    className: className,
    backgroundColorToken: backgroundColorProperty,
    transparent: transparent,
    clickable: isClickable,
    onClick: handleOverlayClick,
    zIndex: zIndex,
    withBlur: withBlur
  }, rest));
};

exports.Overlay = Overlay;
