"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

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

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

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

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _Button = _interopRequireDefault(require("@instructure/ui-buttons/lib/components/Button"));

var _IconEdit = _interopRequireDefault(require("@instructure/ui-icons/lib/Line/IconEdit"));

var _ScreenReaderContent = _interopRequireDefault(require("@instructure/ui-a11y/lib/components/ScreenReaderContent"));

var _makeScrollable = _interopRequireDefault(require("../../../../../common/components/shared/functionality/makeScrollable"));

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/lib/format-message"));

var _passthroughProps = require("@instructure/ui-utils/lib/react/passthroughProps");

var EditButton =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(EditButton, _Component);

  function EditButton() {
    var _getPrototypeOf2;

    var _this;

    (0, _classCallCheck2.default)(this, EditButton);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(EditButton)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.focus = function () {
      _this.button.focus();
    };

    _this.handleButtonRef = function (node) {
      return _this.button = node;
    };

    return _this;
  }

  (0, _createClass2.default)(EditButton, [{
    key: "render",
    value: function render() {
      return _react.default.createElement(_Button.default, Object.assign({
        ref: this.handleButtonRef,
        variant: "icon",
        size: "small",
        icon: _IconEdit.default,
        onClick: this.props.onClick
      }, (0, _passthroughProps.omitProps)(this.props, this.constructor.propTypes)), _react.default.createElement(_ScreenReaderContent.default, null, this.props.screenreaderText));
    }
  }]);
  EditButton.displayName = "EditButton";
  return EditButton;
}(_react.Component);

EditButton.propTypes = {
  onClick: _propTypes.default.func.isRequired,
  screenreaderText: _propTypes.default.string
};
EditButton.defaultProps = {
  screenreaderText: "Modifye"
};

var _default = (0, _makeScrollable.default)(EditButton);

exports.default = _default;