"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.FocusHelper = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _reactDom = _interopRequireDefault(require("react-dom"));

var FocusHelper = function FocusHelper() {
  var _this = this;

  (0, _defineProperty2.default)(this, "$el", null);
  (0, _defineProperty2.default)(this, "setEl", function (el) {
    return _this.$el = el;
  });
  (0, _defineProperty2.default)(this, "focus", function () {
    var $el = _this.$el;

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

        if ($el && $el.focus) {
          $el.focus();
        }
      }
    }
  });
  (0, _defineProperty2.default)(this, "setElAndFocus", function (el) {
    _this.setEl(el);

    _this.focus();
  });
};

exports.FocusHelper = FocusHelper;