import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { useCallback } from 'react';
import { StyledOverlay } from './Overlay.styles.js';

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 = _objectWithoutProperties(_ref, _excluded);
  var handleOverlayClick = useCallback(function (event) {
    if (!isClickable) {
      return;
    }
    onOverlayClick === null || onOverlayClick === void 0 || onOverlayClick(event);
  }, [isClickable, onOverlayClick]);
  return /*#__PURE__*/React__default.createElement(StyledOverlay, _extends({
    className: className,
    backgroundColorToken: backgroundColorProperty,
    transparent: transparent,
    clickable: isClickable,
    onClick: handleOverlayClick,
    zIndex: zIndex,
    withBlur: withBlur
  }, rest));
};

export { Overlay };
