import _defineProperty from "@babel/runtime/helpers/defineProperty";
import ReactDom from 'react-dom';
export var FocusHelper = function FocusHelper() {
  var _this = this;

  _defineProperty(this, "$el", null);

  _defineProperty(this, "setEl", function (el) {
    return _this.$el = el;
  });

  _defineProperty(this, "focus", function () {
    var $el = _this.$el;

    if ($el) {
      if ($el.focus) {
        $el.focus();
      } else {
        $el = ReactDom.findDOMNode($el);

        if ($el && $el.focus) {
          $el.focus();
        }
      }
    }
  });

  _defineProperty(this, "setElAndFocus", function (el) {
    _this.setEl(el);

    _this.focus();
  });
};