"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 _IconBank = _interopRequireDefault(require("@instructure/ui-icons/lib/Line/IconBank"));

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

var _StimulusShowInfo = _interopRequireDefault(require("../StimulusShowInfo"));

var _Overlay = _interopRequireDefault(require("../../../../../common/components/shared/overlay/Overlay"));

var _ActionButtons = _interopRequireDefault(require("../../../../../building/components/resources/ActionButtons"));

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

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

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'ceqOh',
  template: function template(theme) {
    return "\n\n.ceqOh_dRGY{padding-bottom:".concat(theme.stimulusPadding || 'inherit', ";padding-top:").concat(theme.stimulusPadding || 'inherit', "}\n\n.ceqOh_fsuY{align-items:center;display:flex;height:1rem;justify-content:space-between;padding-left:").concat(theme.headerPadding || 'inherit', ";padding-right:").concat(theme.headerPadding || 'inherit', "}\n\n.ceqOh_cKlw{display:flex;overflow:hidden}\n\n.ceqOh_ffXB{color:").concat(theme.stimulusLabelColor || 'inherit', ";font-size:").concat(theme.stimulusLabelFontSize || 'inherit', ";margin:0 ").concat(theme.stimulusLabelMargin || 'inherit', ";overflow:hidden;text-overflow:ellipsis}\n\n.ceqOh_dMwa{height:100%;padding:").concat(theme.stimulusContentPaddingTop || 'inherit', " ").concat(theme.stimulusContentPaddingLeftRight || 'inherit', " ").concat(theme.stimulusContentPaddingBottom || 'inherit', "}");
  },
  'stimulus': 'ceqOh_dRGY',
  'header': 'ceqOh_fsuY',
  'leftHeader': 'ceqOh_cKlw',
  'stimulusLabel': 'ceqOh_ffXB',
  'stimulusContent': 'ceqOh_dMwa'
};

var _ref =
/*#__PURE__*/
_react.default.createElement(_IconBank.default, null);

var StimulusShow = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(StimulusShow, _Component);

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

  (0, _createClass2.default)(StimulusShow, [{
    key: "renderBankIcon",
    value: function renderBankIcon() {
      if (this.props.isBankedContent || this.props.quizEntry.isArchivedBankEntry) {
        return _ref;
      }
    }
  }, {
    key: "render",
    value: function render() {
      return _react.default.createElement(_Overlay.default, {
        onClick: this.props.switchOnEditing,
        wrapperClassName: styles.stimulusWrapper,
        tabIndex: "-1"
      }, _react.default.createElement("div", {
        className: styles.stimulus
      }, _react.default.createElement("div", {
        className: styles.header
      }, _react.default.createElement("div", {
        className: styles.leftHeader
      }, this.renderBankIcon(), _react.default.createElement("div", {
        className: styles.stimulusLabel
      }, "Ysgogiad")), _react.default.createElement(_ActionButtons.default, {
        connectDragSource: this.props.connectDragSource,
        displayPosition: this.props.displayPosition,
        onDelete: this.props.openDeleteStimulusModal,
        quizEntries: this.props.quizEntries,
        quizEntry: this.props.quizEntry,
        scrollKey: this.props.scrollKey,
        shouldDisableDragHandle: this.props.shouldDisableDragHandle,
        switchOnEditing: this.props.switchOnEditing,
        shouldFocusOnMount: this.props.shouldFocusOnMount
      })), _react.default.createElement("div", {
        role: "presentation",
        onClick: this.props.switchOnEditing,
        className: styles.stimulusContent
      }, _react.default.createElement(_StimulusShowInfo.default, {
        stimulus: this.props.stimulus
      }))));
    }
  }]);
  StimulusShow.displayName = "StimulusShow";
  return StimulusShow;
}(_react.Component), _class2.propTypes = {
  connectDragSource: _propTypes.default.func.isRequired,
  displayPosition: _propTypes.default.number.isRequired,
  isBankedContent: _propTypes.default.bool,
  openDeleteStimulusModal: _propTypes.default.func.isRequired,
  quizEntries: _reactImmutableProptypes.default.listOf(_reactImmutableProptypes.default.record).isRequired,
  quizEntry: _reactImmutableProptypes.default.record.isRequired,
  scrollKey: _propTypes.default.string,
  shouldDisableDragHandle: _propTypes.default.bool,
  stimulus: _reactImmutableProptypes.default.record.isRequired,
  switchOnEditing: _propTypes.default.func.isRequired,
  shouldFocusOnMount: _propTypes.default.bool.isRequired
}, _class2.defaultProps = {
  isBankedContent: false,
  scrollKey: '',
  shouldDisableDragHandle: false,
  shouldFocusOnMount: false
}, _temp)) || _class);
exports.default = StimulusShow;