UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

1,133 lines 50.9 kB
"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));

var _propTypes = require("./props/propTypes");

var _Common = require("../utils/Common.js");

var _viewPort = _interopRequireDefault(require("./viewPort"));

var _PositionMapping = require("./PositionMapping.js");

var _ResizeObserver = _interopRequireDefault(require("@zohodesk/virtualizer/lib/commons/ResizeObserver.js"));

var _intersectionObserver = require("./intersectionObserver");

var _DropBoxPositionMapping = require("../DropBox/DropBoxPositionMapping.js");

var _isMobilePopover = _interopRequireDefault(require("../DropBox/utils/isMobilePopover.js"));

var _selectn = _interopRequireDefault(require("selectn"));

var _Registry = _interopRequireDefault(require("./Registry.js"));

var _excluded = ["isMobile"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

global.closeGroupPopups = function (groupName) {
  var groupPopups = _Registry["default"].popups[groupName] || [];
  groupPopups.forEach(function (popup) {
    popup.state.isPopupOpen && popup.setState({
      isPopupOpen: false,
      isPopupReady: false
    });
  });
};

var defaultState = {
  position: 'bottomCenter',
  height: '0px',
  positions: {},
  //{bottomCenter: true, bottomLeft: false, ...}
  positionsOffset: {},
  //{bottomCenter: {left: ‘’,top: ‘’ }, .....}
  targetOffset: {},
  //{height: ‘’, width: ‘’,}
  popupOffset: {},
  //{height: ‘’, width: ‘’,}
  isAbsolutePositioningNeeded: true
};
var SCROLL_BLOCK_EVENTS = Object.freeze([{
  name: 'wheel',
  handlerName: 'handleBlockScroll',
  options: {
    capture: true,
    passive: false
  }
}, {
  name: 'touchmove',
  handlerName: 'handleBlockScroll',
  options: {
    capture: true,
    passive: false
  }
}, {
  name: 'scroll',
  handlerName: 'handlePositionChange',
  options: {
    capture: true,
    passive: false
  }
}, {
  name: 'keydown',
  handlerName: 'preventKeyboardScroll',
  options: {
    capture: true,
    passive: false
  }
}]);
var IFRAME_SCROLL_BLOCK_EVENTS = Object.freeze(SCROLL_BLOCK_EVENTS.filter(function (event) {
  return event.name !== 'keydown';
}));
var CLICK_EVENTS = Object.freeze([{
  name: 'click',
  handlerName: 'documentClickHandler',
  options: {
    capture: false,
    passive: false
  }
}, {
  name: 'click',
  handlerName: 'documentClickHandler1',
  options: {
    capture: true,
    passive: false
  }
}]);
/* eslint-disable react/no-deprecated */

/* eslint-disable react/prop-types */

var Popup = function Popup(Component) {
  var group = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'global';
  var needResizeHandling = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

  var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
      _ref$isAbsolutePositi = _ref.isAbsolutePositioningNeeded,
      isAbsolutePopup = _ref$isAbsolutePositi === void 0 ? true : _ref$isAbsolutePositi,
      _ref$isArrow = _ref.isArrow,
      needPopupArrow = _ref$isArrow === void 0 ? false : _ref$isArrow,
      _ref$customOrder = _ref.customOrder,
      customPositionOrder = _ref$customOrder === void 0 ? [] : _ref$customOrder,
      _ref$scrollDebounceTi = _ref.scrollDebounceTime,
      popupScrollDebounceTime = _ref$scrollDebounceTi === void 0 ? 0 : _ref$scrollDebounceTi,
      _ref$closeOnScroll = _ref.closeOnScroll,
      closeOnScrollPopup = _ref$closeOnScroll === void 0 ? false : _ref$closeOnScroll,
      _ref$isOutsideScrollB = _ref.isOutsideScrollBlocked,
      isOutsideScrollBlock = _ref$isOutsideScrollB === void 0 ? false : _ref$isOutsideScrollB;

  var Popup = /*#__PURE__*/function (_React$Component) {
    _inherits(Popup, _React$Component);

    var _super = _createSuper(Popup);

    function Popup(props) {
      var _this;

      _classCallCheck(this, Popup);

      _this = _super.call(this, props);
      _this.state = {
        isPopupOpen: props.isPopupOpen || false,
        position: 'bottomCenter',
        height: '0px',
        isPopupReady: props.isPopupOpen || false,
        positions: {},
        //{bottomCenter: true, bottomLeft: false, ...}
        positionsOffset: {},
        //{bottomCenter: {left: ‘’,top: ‘’ }, .....}
        targetOffset: {},
        //{height: ‘’, width: ‘’,}
        popupOffset: {},
        //{height: ‘’, width: ‘’,}
        isAbsolutePositioningNeeded: true,
        isMobile: false
      };
      _this.togglePopup = _this.togglePopup.bind(_assertThisInitialized(_this));
      _this.documentClickHandler = _this.documentClickHandler.bind(_assertThisInitialized(_this));
      _this.documentClickHandler1 = _this.documentClickHandler1.bind(_assertThisInitialized(_this));
      _this.removeClose = _this.removeClose.bind(_assertThisInitialized(_this));
      _this.documentKeyupHandler = _this.documentKeyupHandler.bind(_assertThisInitialized(_this));
      _this.openPopupOnly = _this.openPopupOnly.bind(_assertThisInitialized(_this));
      _this.closePopupOnly = _this.closePopupOnly.bind(_assertThisInitialized(_this));
      _this.getTargetRef = _this.getTargetRef.bind(_assertThisInitialized(_this));
      _this.getContainerRef = _this.getContainerRef.bind(_assertThisInitialized(_this));
      _this.handlePopupPosition = _this.handlePopupPosition.bind(_assertThisInitialized(_this));
      _this.handleResize = (0, _Common.debounce)(_this.handleResize.bind(_assertThisInitialized(_this)), 300);
      _this.handlePopupResize = _this.handlePopupResize.bind(_assertThisInitialized(_this));
      _this.getIsAbsolutePopup = _this.getIsAbsolutePopup.bind(_assertThisInitialized(_this));
      _this.getIsOutsideScrollBlocked = _this.getIsOutsideScrollBlocked.bind(_assertThisInitialized(_this));
      _this.getNeedArrow = _this.getNeedArrow.bind(_assertThisInitialized(_this));
      _this.getCustomPositionOrder = _this.getCustomPositionOrder.bind(_assertThisInitialized(_this));
      _this.handleOpenPopupPositionChange = _this.handleOpenPopupPositionChange.bind(_assertThisInitialized(_this));
      _this.getScrollDebounceTime = _this.getScrollDebounceTime.bind(_assertThisInitialized(_this));
      _this.getCloseOnScrollPopup = _this.getCloseOnScrollPopup.bind(_assertThisInitialized(_this));
      _this.handleCloseLastOpenedGroup = _this.handleCloseLastOpenedGroup.bind(_assertThisInitialized(_this));
      _this.handleDocumentMouseDown = _this.handleDocumentMouseDown.bind(_assertThisInitialized(_this));
      _this.handleDocumentFocus = _this.handleDocumentFocus.bind(_assertThisInitialized(_this));
      _this.handleGetNeedPrevent = _this.handleGetNeedPrevent.bind(_assertThisInitialized(_this));
      _this.handleBlockScroll = _this.handleBlockScroll.bind(_assertThisInitialized(_this));
      _this.handlePositionChange = _this.handlePositionChange.bind(_assertThisInitialized(_this));
      _this.preventKeyboardScroll = _this.preventKeyboardScroll.bind(_assertThisInitialized(_this));
      _this.updateListeners = _this.updateListeners.bind(_assertThisInitialized(_this));
      _this.addScrollBlockListeners = _this.addScrollBlockListeners.bind(_assertThisInitialized(_this));
      _this.removeScrollBlockListeners = _this.removeScrollBlockListeners.bind(_assertThisInitialized(_this));
      _this.addScrollToUpdateListeners = _this.addScrollToUpdateListeners.bind(_assertThisInitialized(_this));
      _this.removeScrollToUpdateListeners = _this.removeScrollToUpdateListeners.bind(_assertThisInitialized(_this));
      _this.handleAddingScrollBlock = _this.handleAddingScrollBlock.bind(_assertThisInitialized(_this));
      _this.handleRemovingScrollBlock = _this.handleRemovingScrollBlock.bind(_assertThisInitialized(_this));
      _this.handleIntersectionObserver = _this.handleIntersectionObserver.bind(_assertThisInitialized(_this));
      _this.updateVisibilityOnIntersection = _this.updateVisibilityOnIntersection.bind(_assertThisInitialized(_this));
      _this.handleAddingScrollToUpdatePosition = _this.handleAddingScrollToUpdatePosition.bind(_assertThisInitialized(_this));
      _this.handleRemovingScrollToUpdatePosition = _this.handleRemovingScrollToUpdatePosition.bind(_assertThisInitialized(_this));
      _this.setContainerDynamicPositioning = _this.setContainerDynamicPositioning.bind(_assertThisInitialized(_this));
      _this.updatePopupState = _this.updatePopupState.bind(_assertThisInitialized(_this));
      _this.handleScrollAndBlockEvents = _this.handleScrollAndBlockEvents.bind(_assertThisInitialized(_this));
      _this.handleIframeEventListeners = _this.handleIframeEventListeners.bind(_assertThisInitialized(_this));
      _this.handleDropElementStyleUpdate = _this.handleDropElementStyleUpdate.bind(_assertThisInitialized(_this));
      _this.positionRef = /*#__PURE__*/_react["default"].createRef();
      _this.rootElement = _Registry["default"].getRootElement();
      _this.popupObserver = new _ResizeObserver["default"](_this.handlePopupResize); //dropBoxSize

      _this.size = null;
      _this.isTargetElementVisible = false;
      _this.isAbsolutePopup = isAbsolutePopup;
      _this.needPopupArrow = needPopupArrow;
      _this.customPositionOrder = customPositionOrder;
      _this.scrollDebounceTime = popupScrollDebounceTime;
      _this.closeOnScroll = closeOnScrollPopup;
      _this.isOutsideScrollBlock = isOutsideScrollBlock;

      var scrollDebounceTime = _this.getScrollDebounceTime(_assertThisInitialized(_this));

      _this.updatePositionOnScroll = scrollDebounceTime > 0 ? (0, _Common.debounce)(_this.updatePositionOnScroll.bind(_assertThisInitialized(_this)), scrollDebounceTime) : _this.updatePositionOnScroll.bind(_assertThisInitialized(_this)); // this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);

      return _this;
    }

    _createClass(Popup, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        var group = this.getGroup();
        var groupPopups = _Registry["default"].popups[group] || [];
        groupPopups.push(this);
        _Registry["default"].popups[group] = groupPopups;

        if (Object.keys(_Registry["default"].popups).length === 1 && groupPopups.length === 1) {
          this.updateListeners(true, CLICK_EVENTS, document);
          document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);

          window.addEventListener('resize', this.handleResize);
          document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
          document.addEventListener('focus', this.handleDocumentFocus, true);
        }
      }
    }, {
      key: "componentWillReceiveProps",
      value: function componentWillReceiveProps(nextProps) {
        var isPopupOpen = this.state.isPopupOpen;

        if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
          this.setState({
            isPopupOpen: nextProps.isPopupOpen,
            isPopupReady: nextProps.isPopupOpen
          });
        }
      }
    }, {
      key: "handleScrollAndBlockEvents",
      value: function handleScrollAndBlockEvents(shouldAdd) {
        if (shouldAdd) {
          this.handleAddingScrollBlock();
          this.handleAddingScrollToUpdatePosition();
        } else {
          this.handleRemovingScrollBlock();
          this.handleRemovingScrollToUpdatePosition();
        }
      }
    }, {
      key: "handleIframeEventListeners",
      value: function handleIframeEventListeners(shouldAdd, eventList) {
        var _this2 = this;

        this.rootElement.querySelectorAll('iframe').forEach(function (frame) {
          var frameDocument = frame.contentDocument;

          if (frameDocument) {
            _this2.updateListeners(shouldAdd, eventList, frameDocument);
          }
        });
      }
    }, {
      key: "componentDidUpdate",
      value: function componentDidUpdate(prevProps, prevState) {
        var _this$state = this.state,
            isPopupReady = _this$state.isPopupReady,
            isMobile = _this$state.isMobile;

        var _ref2 = prevState || {},
            _ref2$isPopupReady = _ref2.isPopupReady,
            oldStateOpen = _ref2$isPopupReady === void 0 ? false : _ref2$isPopupReady,
            oldIsMobileState = _ref2.isMobile;

        var dropElement = this.dropElement;
        var propResizeHandling = this.props.needResizeHandling;

        if (oldStateOpen !== isPopupReady) {
          if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
            this.popupObserver.replaceObservationElement(dropElement);
          } else if (!isPopupReady) {
            this.size = null;
            this.popupObserver.disconnect();
          }
        }

        if (oldStateOpen !== isPopupReady && !isMobile || oldIsMobileState !== isMobile) {
          var shouldAdd = isPopupReady && !isMobile;
          this.handleScrollAndBlockEvents(shouldAdd);
          this.handleIframeEventListeners(shouldAdd, CLICK_EVENTS);
        }
      }
    }, {
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        var _this3 = this;

        var group = this.getGroup();
        _Registry["default"].popups = Object.keys(_Registry["default"].popups).reduce(function (res, groupName) {
          if (groupName === group) {
            var groupPopups = _Registry["default"].popups[group];
            var newGroupPopups = groupPopups.filter(function (popup) {
              return popup !== _this3;
            });
            newGroupPopups.length === 0 && _Registry["default"].lastOpenedGroup.indexOf(group) >= 0 && _Registry["default"].lastOpenedGroup.splice(_Registry["default"].lastOpenedGroup.indexOf(group), 1);
            res[group] = newGroupPopups;
          }

          return res;
        }, _Registry["default"].popups);
        this.handleRemovingScrollBlock();
        this.handleRemovingScrollToUpdatePosition();
        this.handleIframeEventListeners(false, CLICK_EVENTS);
        var noPopups = true;

        for (var i in _Registry["default"].popups) {
          if (_Registry["default"].popups[i].length >= 1) {
            noPopups = false;
            break;
          }
        }

        if (this.popupObserver) {
          this.popupObserver.disconnect();
        }

        if (noPopups) {
          this.updateListeners(false, CLICK_EVENTS, document);
          document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);

          window.removeEventListener('resize', this.handleResize);
          document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
          document.removeEventListener('focus', this.handleDocumentFocus, true);
        }
      }
    }, {
      key: "handleAddingScrollBlock",
      value: function handleAddingScrollBlock() {
        var isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
        var isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);

        if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
          (0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
          this.addScrollBlockListeners();
        }
      }
    }, {
      key: "handleRemovingScrollBlock",
      value: function handleRemovingScrollBlock() {
        var isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
        var isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);

        if (isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
          (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.handleIntersectionObserver);
          this.removeScrollBlockListeners();
        }
      }
    }, {
      key: "handleAddingScrollToUpdatePosition",
      value: function handleAddingScrollToUpdatePosition() {
        var isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
        var isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);

        if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
          (0, _intersectionObserver.addIntersectionObserver)(this.placeHolderElement, this.updateVisibilityOnIntersection);
          var shouldAddScrollToUpdatePositionListeners = _Registry["default"].getOpenedScrollableFixedPopups().length === 1 && _Registry["default"].scrollableListenerPopupRef === undefined;

          if (shouldAddScrollToUpdatePositionListeners) {
            _Registry["default"].scrollableListenerPopupRef = this;

            _Registry["default"].scrollableListenerPopupRef.addScrollToUpdateListeners();
          }
        }
      }
    }, {
      key: "handleRemovingScrollToUpdatePosition",
      value: function handleRemovingScrollToUpdatePosition() {
        var isAbsolutePositioningNeeded = this.getIsAbsolutePopup(this);
        var isOutsideScrollBlocked = this.getIsOutsideScrollBlocked(this);

        if (!isOutsideScrollBlocked && !isAbsolutePositioningNeeded) {
          (0, _intersectionObserver.removeIntersectionObserver)(this.placeHolderElement, this.updateVisibilityOnIntersection);
          var shouldRemoveScrollToUpdatePositionListeners = _Registry["default"].getOpenedScrollableFixedPopups().length === 0 && _Registry["default"].scrollableListenerPopupRef !== undefined;

          if (shouldRemoveScrollToUpdatePositionListeners) {
            _Registry["default"].scrollableListenerPopupRef.removeScrollToUpdateListeners();

            _Registry["default"].scrollableListenerPopupRef = undefined;
          }
        }
      }
    }, {
      key: "handleDropElementStyleUpdate",
      value: function handleDropElementStyleUpdate(_ref3) {
        var _ref3$top = _ref3.top,
            top = _ref3$top === void 0 ? '' : _ref3$top,
            _ref3$left = _ref3.left,
            left = _ref3$left === void 0 ? '' : _ref3$left,
            _ref3$bottom = _ref3.bottom,
            bottom = _ref3$bottom === void 0 ? '' : _ref3$bottom,
            _ref3$right = _ref3.right,
            right = _ref3$right === void 0 ? '' : _ref3$right;
        var dropElement = this.dropElement;
        Object.assign(dropElement.style, {
          top: top ? "".concat(top, "px") : '',
          left: left ? "".concat(left, "px") : '',
          right: right ? "".concat(right, "px") : '',
          bottom: bottom ? "".concat(bottom, "px") : ''
        });
      }
    }, {
      key: "setContainerDynamicPositioning",
      value: function setContainerDynamicPositioning(betterPosition, needArrow) {
        var dropElement = this.dropElement;
        var isMobile = this.state.isMobile;

        var _ref4 = betterPosition || _Common.DUMMY_OBJECT,
            view = _ref4.view,
            viewsOffset = _ref4.viewsOffset;

        var styleToApply = (0, _selectn["default"])("".concat(view), viewsOffset);

        if (isMobile) {
          this.handleDropElementStyleUpdate({
            top: '',
            left: '',
            right: '',
            bottom: ''
          });
        } else {
          this.handleDropElementStyleUpdate(styleToApply);

          if (this.positionRef.current !== view) {
            dropElement.setAttribute('data-position', "".concat(view));
            dropElement.setAttribute('data-box-direction', (0, _selectn["default"])("".concat(view, ".direction"), _DropBoxPositionMapping.positionMapping));

            if (needArrow) {
              dropElement.setAttribute('data-arrow-position', (0, _selectn["default"])("".concat(view, ".arrowPosition"), _DropBoxPositionMapping.positionMapping));
            }

            this.positionRef.current = view;
          }
        }
      }
    }, {
      key: "updatePositionOnScroll",
      value: function updatePositionOnScroll(e) {
        var scrollablePopups = _Registry["default"].getOpenedScrollableFixedPopups(); // Check if the event target is outside all dropElements


        scrollablePopups.forEach(function (_ref5) {
          var placeHolderElement = _ref5.placeHolderElement,
              defaultPosition = _ref5.defaultPosition,
              isTargetElementVisible = _ref5.isTargetElementVisible,
              handlePopupPosition = _ref5.handlePopupPosition;

          if (e.target.contains(placeHolderElement) && isTargetElementVisible) {
            handlePopupPosition(defaultPosition, true);
          }
        });
      }
    }, {
      key: "updateListeners",
      value: function updateListeners() {
        var _this4 = this;

        var add = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
        var eventList = arguments.length > 1 ? arguments[1] : undefined;
        var element = arguments.length > 2 ? arguments[2] : undefined;
        var method = add ? 'addEventListener' : 'removeEventListener';
        eventList.forEach(function (_ref6) {
          var name = _ref6.name,
              handlerName = _ref6.handlerName,
              options = _ref6.options;
          var handler = _this4[handlerName];

          if (handler) {
            element[method](name, handler, options);
          }
        });
      }
    }, {
      key: "addScrollBlockListeners",
      value: function addScrollBlockListeners() {
        // Only add scroll block listeners if at least one open popup needs outside scroll blocked
        var shouldAddScrollBlockListeners = _Registry["default"].getOpenedScrollBlockedFixedPopups().length === 1 && _Registry["default"].scrollBlockedListenerPopupRef === undefined;

        if (shouldAddScrollBlockListeners) {
          _Registry["default"].scrollBlockedListenerPopupRef = this; // Main document

          _Registry["default"].scrollBlockedListenerPopupRef.updateListeners(true, SCROLL_BLOCK_EVENTS, document); // Attach event listeners to all iframes within rootElement


          _Registry["default"].scrollBlockedListenerPopupRef.handleIframeEventListeners(true, IFRAME_SCROLL_BLOCK_EVENTS);
        }
      }
    }, {
      key: "removeScrollBlockListeners",
      value: function removeScrollBlockListeners() {
        // Only remove scroll block listeners if at least one open popup needs outside scroll blocked
        var shouldRemoveScrollBlockListeners = _Registry["default"].getOpenedScrollBlockedFixedPopups().length === 0 && _Registry["default"].scrollBlockedListenerPopupRef !== undefined;

        if (shouldRemoveScrollBlockListeners) {
          _Registry["default"].scrollBlockedListenerPopupRef.updateListeners(false, SCROLL_BLOCK_EVENTS, document);

          _Registry["default"].scrollBlockedListenerPopupRef.handleIframeEventListeners(false, IFRAME_SCROLL_BLOCK_EVENTS);

          _Registry["default"].scrollBlockedListenerPopupRef = undefined;
        }
      }
    }, {
      key: "addScrollToUpdateListeners",
      value: function addScrollToUpdateListeners() {
        document.addEventListener('scroll', this.updatePositionOnScroll, {
          capture: true,
          passive: false
        });
      }
    }, {
      key: "removeScrollToUpdateListeners",
      value: function removeScrollToUpdateListeners() {
        document.removeEventListener('scroll', this.updatePositionOnScroll, {
          capture: true,
          passive: false
        });
      }
    }, {
      key: "handleBlockScroll",
      value: function handleBlockScroll(event) {
        var scrollBlockedPopups = _Registry["default"].getOpenedScrollBlockedFixedPopups(); // Check if the event target is outside all dropElements


        var isOutsideAllDropElements = scrollBlockedPopups.every(function (_ref7) {
          var dropElement = _ref7.dropElement;
          return dropElement && dropElement !== event.target && !dropElement.contains(event.target);
        });

        if (isOutsideAllDropElements) {
          event.preventDefault();
        }
      }
    }, {
      key: "handlePositionChange",
      value: function handlePositionChange(event) {
        var scrollBlockedPopups = _Registry["default"].getOpenedScrollBlockedFixedPopups();

        scrollBlockedPopups.forEach(function (_ref8) {
          var placeHolderElement = _ref8.placeHolderElement,
              dropElement = _ref8.dropElement,
              handlePopupPosition = _ref8.handlePopupPosition,
              state = _ref8.state;

          if (dropElement && dropElement !== event.target && !dropElement.contains(event.target) && placeHolderElement && placeHolderElement !== event.target && !placeHolderElement.contains(event.target) && event.target.contains(placeHolderElement)) {
            handlePopupPosition(state.position, true);
          }
        });
      }
    }, {
      key: "preventKeyboardScroll",
      value: function preventKeyboardScroll(event) {
        var keys = [32, 37, 38, 39, 40]; // Space, Arrow keys

        var scrollBlockedPopups = _Registry["default"].getOpenedScrollBlockedFixedPopups(); // Check if the event target is outside all dropElements


        var isOutsideAllDropElements = scrollBlockedPopups.every(function (_ref9) {
          var dropElement = _ref9.dropElement;
          return dropElement && dropElement !== event.target && !dropElement.contains(event.target) && keys.includes(event.keyCode);
        });

        if (isOutsideAllDropElements) {
          event.preventDefault();
        }
      }
    }, {
      key: "handleIntersectionObserver",
      value: function handleIntersectionObserver(entry) {
        if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
          this.closePopupOnly();
        }
      }
    }, {
      key: "updateVisibilityOnIntersection",
      value: function updateVisibilityOnIntersection(entry) {
        var dropElement = this.dropElement;
        if (!dropElement) return;

        if (entry.isIntersecting === true) {
          this.isTargetElementVisible = true;
          dropElement.setAttribute('data-visible', 'visible');
        } else if (entry.intersectionRatio === 0 && entry.isIntersecting === false) {
          this.isTargetElementVisible = false;
          dropElement.setAttribute('data-visible', 'hidden');
        }
      }
    }, {
      key: "getGroup",
      value: function getGroup() {
        var popupGroup = this.props.popupGroup;
        return popupGroup || group;
      }
    }, {
      key: "getNeedArrow",
      value: function getNeedArrow(popup) {
        var isArrow = popup.props.isArrow;
        var needPopupArrow = popup.needPopupArrow;
        return isArrow !== undefined ? isArrow : needPopupArrow;
      }
    }, {
      key: "getScrollDebounceTime",
      value: function getScrollDebounceTime(popup) {
        var scrollDebounceTime = popup.props.scrollDebounceTime;
        var popupScrollDebounceTime = popup.scrollDebounceTime;
        return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
      }
    }, {
      key: "getCloseOnScrollPopup",
      value: function getCloseOnScrollPopup(popup) {
        var closeOnScroll = popup.props.closeOnScroll;
        var closeOnScrollPopup = popup.closeOnScroll;
        return closeOnScroll !== undefined ? closeOnScroll : closeOnScrollPopup;
      }
    }, {
      key: "getIsAbsolutePopup",
      value: function getIsAbsolutePopup(popup) {
        var isAbsolutePositioningNeeded = popup.props.isAbsolutePositioningNeeded;
        var isAbsolutePopup = popup.isAbsolutePopup;
        return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
      }
    }, {
      key: "getIsOutsideScrollBlocked",
      value: function getIsOutsideScrollBlocked(popup) {
        var isOutsideScrollBlocked = popup.props.isOutsideScrollBlocked;
        var isOutsideScrollBlock = popup.isOutsideScrollBlock;
        return isOutsideScrollBlocked !== undefined ? isOutsideScrollBlocked : isOutsideScrollBlock;
      }
    }, {
      key: "getCustomPositionOrder",
      value: function getCustomPositionOrder(popup) {
        var _popup$props$customOr = popup.props.customOrder,
            customOrder = _popup$props$customOr === void 0 ? [] : _popup$props$customOr;
        var customPositionOrder = popup.customPositionOrder;
        return customOrder.length !== 0 ? customOrder : customPositionOrder;
      }
    }, {
      key: "togglePopup",
      value: function togglePopup(e, defaultPosition) {
        var _this5 = this;

        var group = this.getGroup();
        this.removeClose(e);
        var isPopupOpen = this.state.isPopupOpen;
        var groupPopups = _Registry["default"].popups[group] || [];
        _Registry["default"].lastOpenedGroup = !isPopupOpen && _Registry["default"].lastOpenedGroup.indexOf(group) === -1 ? [group].concat(_toConsumableArray(_Registry["default"].lastOpenedGroup)) : _Registry["default"].lastOpenedGroup;
        isPopupOpen && _Registry["default"].lastOpenedGroup.splice(0, 1);
        groupPopups.forEach(function (popup) {
          if (popup !== _this5 && popup.state.isPopupOpen) {
            popup.setState({
              isPopupOpen: false,
              isPopupReady: false
            });
          }
        });

        if (isPopupOpen) {
          this.setState({
            isPopupOpen: false,
            isPopupReady: false
          });
        } else {
          this.handlePopupPosition(defaultPosition);
        }
      }
    }, {
      key: "openPopupOnly",
      value: function openPopupOnly(e, defaultPosition) {
        var group = this.getGroup();
        this.removeClose(e);
        _Registry["default"].lastOpenedGroup = _Registry["default"].lastOpenedGroup.indexOf(group) === -1 ? [group].concat(_toConsumableArray(_Registry["default"].lastOpenedGroup)) : _Registry["default"].lastOpenedGroup;
        this.handlePopupPosition(defaultPosition);
      }
    }, {
      key: "closePopupOnly",
      value: function closePopupOnly(e) {
        this.removeClose(e);
        var isPopupOpen = this.state.isPopupOpen;

        if (isPopupOpen) {
          _Registry["default"].lastOpenedGroup.splice(0, 1);

          this.setState({
            isPopupOpen: false,
            isPopupReady: false
          });
        }
      }
    }, {
      key: "handleCloseLastOpenedGroup",
      value: function handleCloseLastOpenedGroup() {
        var groupPopups = _Registry["default"].lastOpenedGroup.length ? _Registry["default"].popups[_Registry["default"].lastOpenedGroup[0]] || [] : [];

        _Registry["default"].lastOpenedGroup.splice(0, 1);

        groupPopups.forEach(function (popup) {
          popup.state.isPopupOpen && popup.setState({
            isPopupOpen: false,
            isPopupReady: false
          });
        });
      }
    }, {
      key: "handleDocumentMouseDown",
      value: function handleDocumentMouseDown(e) {
        var needPrevent = this.handleGetNeedPrevent(e);

        if (needPrevent) {
          this.removeClose(e);
        }
      }
    }, {
      key: "handleDocumentFocus",
      value: function handleDocumentFocus(e) {
        var needPrevent = this.handleGetNeedPrevent(e);

        if (needPrevent) {
          this.removeClose(e);
        }
      }
    }, {
      key: "handleGetNeedPrevent",
      value: function handleGetNeedPrevent(e) {
        var needPrevent = false;

        if (_Registry["default"].lastOpenedGroup.length > 1) {
          var target = e.target;
          var groupPopups = _Registry["default"].lastOpenedGroup.length ? _Registry["default"].popups[_Registry["default"].lastOpenedGroup[0]] : [];
          var openedPopup = null; // eslint-disable-next-line guard-for-in

          for (var i in groupPopups) {
            var isPopupOpen = groupPopups[i].state.isPopupOpen;

            if (isPopupOpen) {
              openedPopup = groupPopups[i];
              break;
            }
          }

          if (openedPopup) {
            var _openedPopup = openedPopup,
                dropElement = _openedPopup.dropElement,
                placeHolderElement = _openedPopup.placeHolderElement;
            var isDropBoxChild = (0, _Common.isDescendant)(dropElement, target);
            var isTargetChild = (0, _Common.isDescendant)(placeHolderElement, target); // const isPopupMassUpdateChild = isDescendant(
            //   massUpdateParent,
            //   dropElement
            // );

            if (!isDropBoxChild && !isTargetChild // && isPopupMassUpdateChild
            ) {
              needPrevent = true;
            }
          }
        }

        return needPrevent;
      }
    }, {
      key: "documentClickHandler1",
      value: function documentClickHandler1(e) {
        var needPrevent = this.handleGetNeedPrevent(e);

        if (needPrevent) {
          this.removeClose(e);
          this.handleCloseLastOpenedGroup();
        }
      }
    }, {
      key: "documentClickHandler",
      value: function documentClickHandler() {
        try {
          Object.keys(_Registry["default"].popups).forEach(function (groupName) {
            var groupPopups = _Registry["default"].popups[groupName] || [];
            groupPopups.forEach(function (popup) {
              popup.state.isPopupOpen && (!popup.props.checkBeforeClose || popup.props.checkBeforeClose && popup.props.checkBeforeClose()) && !(0, _Common.isTextSelected)() && popup.setState({
                isPopupOpen: false,
                isPopupReady: false
              });
            });
          });
          _Registry["default"].lastOpenedGroup = [];
        } catch (e) {// eslint-disable-next-line no-console
          //console.error('popup component not unmounted properly', e);
        }
      }
    }, {
      key: "documentKeyupHandler",
      value: function documentKeyupHandler(e) {
        try {
          if (e.keyCode === 27) {
            this.handleCloseLastOpenedGroup();
          }
        } catch (e) {// eslint-disable-next-line no-console
          //console.log('error', e);
        }
      }
    }, {
      key: "removeClose",
      value: function removeClose(e) {
        // e && e.preventDefault && e.preventDefault();
        (0, _Common.cancelBubblingEffect)(e);
      }
    }, {
      key: "updatePopupState",
      value: function updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute) {
        var isMobile = (0, _isMobilePopover["default"])(true);
        this.setState({
          isPopupReady: true,
          position: view,
          positions: views,
          positionsOffset: viewsOffset,
          targetOffset: targetOffset,
          popupOffset: popupOffset,
          isAbsolutePositioningNeeded: isAbsolute,
          isMobile: isMobile
        });
      }
    }, {
      key: "handlePopupPosition",
      value: function handlePopupPosition() {
        var _this6 = this;

        var defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
        var isUpdatePosition = arguments.length > 1 ? arguments[1] : undefined;

        // isUpdatePosition --->>> Window resize and dropBox resize and to update the position
        var _ref10 = this.context || {},
            direction = _ref10.direction;

        var placeHolderElement = this.placeHolderElement,
            dropElement = this.dropElement;
        var needArrow = this.getNeedArrow(this);
        var isAbsolute = this.getIsAbsolutePopup(this);
        var customOrder = this.getCustomPositionOrder(this);

        if (direction === 'rtl') {
          defaultPosition = isAbsolute ? _PositionMapping.rtlAbsolutePositionMapping[defaultPosition] : _PositionMapping.rtlFixedPositionMapping[defaultPosition];
        } else {
          defaultPosition = isAbsolute ? _PositionMapping.absolutePositionMapping[defaultPosition] : defaultPosition;
        }

        if (!placeHolderElement && !dropElement) {
          var isMobile = (0, _isMobilePopover["default"])(true);
          this.setState({
            isPopupOpen: true,
            isPopupReady: true,
            isMobile: isMobile
          });
          return;
        }

        var setPosition = function setPosition() {
          requestAnimationFrame(function () {
            var placeHolderElement = _this6.placeHolderElement,
                dropElement = _this6.dropElement;
            var _this6$state = _this6.state,
                position = _this6$state.position,
                isPopupReady = _this6$state.isPopupReady;
            var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;

            var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
              needArrow: needArrow,
              isAbsolute: isAbsolute,
              customOrder: customOrder
            });

            var _ref11 = betterPosition || _Common.DUMMY_OBJECT,
                view = _ref11.view,
                views = _ref11.views,
                viewsOffset = _ref11.viewsOffset,
                targetOffset = _ref11.targetOffset,
                popupOffset = _ref11.popupOffset;

            if (!isAbsolute) {
              if (!isPopupReady) {
                _this6.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
              }

              if (!dropElement) {
                return;
              }

              _this6.setContainerDynamicPositioning(betterPosition, needArrow);
            } else {
              if (position !== view || !isPopupReady) {
                _this6.updatePopupState(view, views, viewsOffset, targetOffset, popupOffset, isAbsolute);
              }
            }
          });
        };

        if (isUpdatePosition) {
          setPosition();
        } else {
          this.defaultPosition = defaultPosition;
          this.setState({
            isPopupOpen: true,
            isPopupReady: false
          }, setPosition);
        }
      }
    }, {
      key: "handleOpenPopupPositionChange",
      value: function handleOpenPopupPositionChange() {
        var _this7 = this;

        Object.keys(_Registry["default"].popups).forEach(function (groupName) {
          var groupPopups = _Registry["default"].popups[groupName] || [];
          groupPopups.forEach(function (popup) {
            if (popup.state.isPopupOpen) {
              var placeHolderElement = popup.placeHolderElement,
                  dropElement = popup.dropElement,
                  defaultPosition = popup.defaultPosition;
              var _popup$state = popup.state,
                  position = _popup$state.position,
                  _popup$state$position = _popup$state.positionsOffset,
                  positionsOffset = _popup$state$position === void 0 ? {} : _popup$state$position;

              if (placeHolderElement && dropElement) {
                var scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
                requestAnimationFrame(function () {
                  var needArrow = _this7.getNeedArrow(popup);

                  var isAbsolute = _this7.getIsAbsolutePopup(popup);

                  var customOrder = _this7.getCustomPositionOrder(popup);

                  var isMobile = (0, _isMobilePopover["default"])(true);

                  var betterPosition = _viewPort["default"].betterView(dropElement, placeHolderElement, defaultPosition, scrollContainer, {
                    needArrow: needArrow,
                    isAbsolute: isAbsolute,
                    customOrder: customOrder
                  });

                  var _ref12 = betterPosition || {},
                      view = _ref12.view,
                      views = _ref12.views,
                      _ref12$viewsOffset = _ref12.viewsOffset,
                      viewsOffset = _ref12$viewsOffset === void 0 ? {} : _ref12$viewsOffset,
                      targetOffset = _ref12.targetOffset,
                      popupOffset = _ref12.popupOffset;

                  var _ref13 = positionsOffset[position] || {},
                      _ref13$left = _ref13.left,
                      oldLeft = _ref13$left === void 0 ? '' : _ref13$left,
                      _ref13$top = _ref13.top,
                      oldTop = _ref13$top === void 0 ? '' : _ref13$top,
                      _ref13$bottom = _ref13.bottom,
                      oldBottom = _ref13$bottom === void 0 ? '' : _ref13$bottom,
                      _ref13$right = _ref13.right,
                      oldRight = _ref13$right === void 0 ? '' : _ref13$right;

                  var _ref14 = viewsOffset[view] || {},
                      _ref14$left = _ref14.left,
                      left = _ref14$left === void 0 ? '' : _ref14$left,
                      _ref14$top = _ref14.top,
                      top = _ref14$top === void 0 ? '' : _ref14$top,
                      _ref14$bottom = _ref14.bottom,
                      bottom = _ref14$bottom === void 0 ? '' : _ref14$bottom,
                      _ref14$right = _ref14.right,
                      right = _ref14$right === void 0 ? '' : _ref14$right;

                  var changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top || oldBottom !== bottom || oldRight !== right; // let isInViewPort = viewPort.isInViewPort(
                  //   placeHolderElement,
                  //   scrollContainer
                  // );

                  if (changeState) {
                    popup.setState({
                      position: view,
                      positions: views,
                      positionsOffset: viewsOffset,
                      targetOffset: targetOffset,
                      popupOffset: popupOffset,
                      isAbsolutePositioningNeeded: isAbsolute,
                      isMobile: isMobile
                    });
                  } // if (!isInViewPort && !isAbsolute) {
                  //   popup.setState({ isPopupOpen: false, isPopupReady: false });
                  // } else if (view && changeState) {
                  //   popup.setState({
                  //     position: view,
                  //     positions: views,
                  //     positionsOffset: viewsOffset,
                  //     targetOffset,
                  //     popupOffset,
                  //     isAbsolutePositioningNeeded: isAbsolute
                  //   });
                  // }

                });
              }
            }
          });
        });
      }
    }, {
      key: "handleResize",
      value: function handleResize() {
        this.handleOpenPopupPositionChange();
      } // handleScroll(e) {
      //   // this.handleOpenPopupPositionChange();
      //   const { closeOnScroll } = this.getCloseOnScrollPopup(this);
      //   const { isPopupReady } = this.state;
      //   if (isPopupReady) {
      //     console.log('onscrollPopupREady');
      //   }
      //   if (isPopupReady && closeOnScroll) {
      //     console.log(this, 'handle Scroll');
      //     this.togglePopup(e);
      //   }
      // }

    }, {
      key: "handlePopupResize",
      value: function handlePopupResize(popupSize) {
        var height = popupSize.height,
            width = popupSize.width;

        var _ref15 = this.size || {},
            _ref15$height = _ref15.height,
            oldHeight = _ref15$height === void 0 ? 0 : _ref15$height,
            _ref15$width = _ref15.width,
            oldWidth = _ref15$width === void 0 ? 0 : _ref15$width;

        var _this$state2 = this.state,
            isPopupReady = _this$state2.isPopupReady,
            position = _this$state2.position;

        if (isPopupReady && this.size && (oldHeight !== height || width !== oldWidth)) {
          this.handlePopupPosition(position, true);
        }

        this.size = popupSize;
      }
    }, {
      key: "getTargetRef",
      value: function getTargetRef(el) {
        this.placeHolderElement = el;
      }
    }, {
      key: "getContainerRef",
      value: function getContainerRef(el) {
        this.dropElement = el;
      }
    }, {
      key: "render",
      value: function render() {
        // const { isPopupReady, isPopupOpen } = this.state;
        var _this$state3 = this.state,
            isMobile = _this$state3.isMobile,
            restState = _objectWithoutProperties(_this$state3, _excluded); // const localState = isPopupReady ? this.state : {};


        return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, this.props, restState, {
          openPopupOnly: this.openPopupOnly,
          closePopupOnly: this.closePopupOnly,
          togglePopup: this.togglePopup,
          removeClose: this.removeClose,
          getTargetRef: this.getTargetRef,
          getContainerRef: this.getContainerRef
        }));
      }
    }]);

    return Popup;
  }(_react["default"].Component);

  Popup.displayName = Component.displayName || Component.name || Popup.name;
  Popup.contextTypes = _propTypes.ContextTypes;
  Popup.propTypes = _propTypes.PopupPropTypes;
  return (0, _hoistNonReactStatics["default"])(Popup, Component);
};

var _default = Popup;
exports["default"] = _default;