"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _PopoverCore = require("./PopoverCore/PopoverCore");
var _requestAnimationFrame = _interopRequireDefault(require("../utils/request-animation-frame"));
var _deprecationLog = _interopRequireDefault(require("../utils/deprecationLog"));
var _excluded = ["animate", "theme", "skin"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Popover/Popover.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
/**
 *  This has been added in order to fix jsdom not having requestAnimation frame
 *  installed. Jest by default has this polyfilled, but mocha fails on it.
 */
if (process.env.NODE_ENV === 'test') {
  _requestAnimationFrame.default.install();
}
var ANIMATION_ENTER = 150;
var ANIMATION_EXIT = 100;
class Popover extends _react.PureComponent {
  render() {
    var _this$props = this.props,
      {
        animate,
        theme,
        skin
      } = _this$props,
      rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
    var timeout = animate ? {
      enter: ANIMATION_ENTER,
      exit: ANIMATION_EXIT
    } : undefined;
    if (theme) {
      (0, _deprecationLog.default)('<Popover/> - theme prop is deprecated and will be removed in next major version, please use skin instead');
    }
    return /*#__PURE__*/_react.default.createElement(_PopoverCore.PopoverCore, (0, _extends2.default)({
      timeout: timeout
    }, rest, {
      skin: skin || theme,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 44,
        columnNumber: 12
      }
    }));
  }
}
Popover.displayName = 'Popover';
Popover.Element = _PopoverCore.PopoverCore.Element;
Popover.Content = _PopoverCore.PopoverCore.Content;
Popover.defaultProps = {
  appendTo: 'parent',
  theme: 'light',
  // TODO: add default skin value once theme is removed
  animate: false,
  interactive: true
};
var _default = exports.default = Popover;
//# sourceMappingURL=Popover.js.map