"use strict";

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

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

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

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

var _formatMessage = _interopRequireDefault(require("format-message"));

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

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

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

var _LearnosityCalculator = _interopRequireDefault(require("../../../LearnosityCalculator"));

var CalculatorButton = function CalculatorButton(_ref) {
  var toggleCalculator = _ref.toggleCalculator,
      enabled = _ref.enabled;
  return _react.default.createElement(_Button.default, {
    icon: _IconCalculator.default,
    onClick: toggleCalculator,
    disabled: !enabled
  }, _react.default.createElement(_ScreenReaderContent.default, null, "\u0627\u0644\u062D\u0627\u0633\u0628\u0629"));
};

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

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

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