'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _LearnosityCalculator = require('quiz-interactions/lib/components/common/components/LearnosityCalculator');

var _LearnosityCalculator2 = _interopRequireDefault(_LearnosityCalculator);

var _formatMessage = require('format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

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

var _Button2 = _interopRequireDefault(_Button);

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

var _ScreenReaderContent2 = _interopRequireDefault(_ScreenReaderContent);

var _IconCalculator = require('@instructure/ui-icons/lib/Line/IconCalculator');

var _IconCalculator2 = _interopRequireDefault(_IconCalculator);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var CalculatorButton = function CalculatorButton(_ref) {
  var toggleCalculator = _ref.toggleCalculator,
      enabled = _ref.enabled;
  return _react2.default.createElement(
    _Button2.default,
    {
      icon: _IconCalculator2.default,
      onClick: toggleCalculator,
      disabled: !enabled
    },
    _react2.default.createElement(
      _ScreenReaderContent2.default,
      null,
      'Calculator'
    )
  );
};

CalculatorButton.propTypes = {
  toggleCalculator: _propTypes2.default.func.isRequired,
  enabled: _propTypes2.default.bool.isRequired
};

function Calculator(props) {
  return _react2.default.createElement(_LearnosityCalculator2.default, Object.assign({}, props, {
    render: CalculatorButton
  }));
}

Calculator.propTypes = {
  activeCalculatorId: _propTypes2.default.string,
  authenticateLearnosity: _propTypes2.default.func.isRequired,
  calculatorType: _propTypes2.default.oneOf(['none', 'basic', 'scientific']).isRequired,
  quizSessionId: _propTypes2.default.number.isRequired
};