"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _reactDom = _interopRequireDefault(require("react-dom"));
class ElementPopover extends _react.default.Component {
  constructor(props) {
    super(props);
    (0, _defineProperty2.default)(this, "state", {
      isMounted: false
    });
    this.el = document.createElement('div');
    if (props.className) {
      this.el.className = props.className;
    }
    if (props.style) {
      this.el.style = props.style;
    }
  }
  componentDidMount() {
    document.body.appendChild(this.el);
  }
  componentDidUpdate() {
    const {
      className,
      style
    } = this.props;
    if (className) {
      this.el.className = className;
    }
    if (style) {
      this.el.style = style;
    }
  }
  componentWillUnmount() {
    document.body.removeChild(this.el);
  }
  render() {
    return /*#__PURE__*/_reactDom.default.createPortal(this.props.children, this.el);
  }
}
var _default = exports.default = ElementPopover;