"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.createCustomPopupContainer = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _excluded = ["children", "shouldFitContainer", "shouldRenderToParent"],
  _excluded2 = ["children", "shouldFitContainer", "shouldRenderToParent"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/**
 * The purpose of this component is to hide the default Popup border.
 * HoverCard border implementation is in ContentContainer where it can
 * change between the default border and prism border during runtime.
 */
var CustomPopupContainer = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
  var children = _ref.children,
    _ = _ref.shouldFitContainer,
    __ = _ref.shouldRenderToParent,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
    ref: ref
  }), children);
});

/**
 * Factory function to create a CustomPopupContainer with a specific z-index
 */
var createCustomPopupContainer = exports.createCustomPopupContainer = function createCustomPopupContainer(zIndex) {
  return /*#__PURE__*/_react.default.forwardRef(
  // FIXME: ...props spreads all props to the div, including isReferenceHidden, which is not a valid prop for a div.
  // Find another way but adding exceptions with _, __, ___ etc.
  function (_ref2, ref) {
    var children = _ref2.children,
      _ = _ref2.shouldFitContainer,
      __ = _ref2.shouldRenderToParent,
      props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
    return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
      ref: ref
    }, zIndex !== undefined && {
      style: _objectSpread(_objectSpread({}, props.style), {}, {
        zIndex: zIndex
      })
    }), children);
  });
};
var _default = exports.default = CustomPopupContainer;