"use strict";

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

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

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 _getPrototypeOf2 = _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 _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));

var _Menu = _interopRequireDefault(require("@instructure/ui-menu/lib/components/Menu"));

var _MenuItem = _interopRequireDefault(require("@instructure/ui-menu/lib/components/Menu/MenuItem"));

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

var _IconMore = _interopRequireDefault(require("@instructure/ui-icons/lib/Solid/IconMore"));

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

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

var _lib = _interopRequireDefault(require("@instructure/ui-themeable/lib"));

var _QTIImportModal = _interopRequireDefault(require("../../../building/components/QTIImportModal"));

var _constants = require("@instructure/quiz-common/lib/constants");

var _theme = _interopRequireDefault(require("./theme"));

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

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'HITck',
  template: function template(theme) {
    return "\n\n.HeaderMenu__styles__menuIcon {\n  vertical-align: middle;\n  margin-right: ".concat(theme.menuIconMargin || 'inherit', ";\n  font-size: ").concat(theme.menuIconFontSize || 'inherit', ";\n}\n");
  },
  'menuIcon': 'HeaderMenu__styles__menuIcon'
};
var HeaderMenu = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(HeaderMenu, _Component);

  function HeaderMenu() {
    (0, _classCallCheck2.default)(this, HeaderMenu);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HeaderMenu).apply(this, arguments));
  }

  (0, _createClass2.default)(HeaderMenu, [{
    key: "renderMenu",
    value: function renderMenu() {
      return _react.default.createElement(_Menu.default, {
        trigger: _react.default.createElement(_Button.default, {
          variant: "icon",
          icon: _IconMore.default
        }, _react.default.createElement(_ScreenReaderContent.default, null, "More Item Banking Actions"))
      }, _react.default.createElement(_MenuItem.default, {
        key: "import",
        disabled: !this.props.bank.canImport(),
        onSelect: this.props.openImportModal
      }, _react.default.createElement(_IconImportContent.default, {
        className: styles.menuIcon,
        "data-automation": "sdk-headermenu-import-content"
      }), "Import content"));
    }
  }, {
    key: "render",
    value: function render() {
      var bank = this.props.bank;
      return _react.default.createElement("div", null, this.renderMenu(), _react.default.createElement(_QTIImportModal.default, {
        parentId: bank.id,
        parentType: _constants.PARENT_TYPE_BANK,
        qtiImport: bank.getLatestImport(),
        "data-automation": "sdk-qti-import-modal"
      }));
    }
  }]);
  HeaderMenu.displayName = "HeaderMenu";
  return HeaderMenu;
}(_react.Component), _class2.propTypes = {
  openImportModal: _propTypes.default.func.isRequired,
  bank: _reactImmutableProptypes.default.record.isRequired
}, _temp)) || _class);
exports.default = HeaderMenu;