'use strict';

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

var _defineProperty2 = require('babel-runtime/helpers/defineProperty');

var _defineProperty3 = _interopRequireDefault(_defineProperty2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _dec, _class, _class2, _temp;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _IconArrowOpenDownLine = require('instructure-icons/lib/Line/IconArrowOpenDownLine');

var _IconArrowOpenDownLine2 = _interopRequireDefault(_IconArrowOpenDownLine);

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 _lib = require('@instructure/ui-themeable/lib');

var _lib2 = _interopRequireDefault(_lib);

var _theme = require('./theme');

var _theme2 = _interopRequireDefault(_theme);

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

var styles = {
  template: function template(theme) {
    return '/*  imported from styles.css  */\n\n.ExpandButton__styles__icon {\n  transition: transform ' + theme.iconTransitionDuration + ';\n}\n\n.ExpandButton__styles__iconOpened {\n  transform: rotate3d(1, 0, 0, 180deg);\n}\n';
  },
  'icon': 'ExpandButton__styles__icon',
  'iconOpened': 'ExpandButton__styles__iconOpened'
};
var ExpandButton = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp = _class2 = function (_Component) {
  (0, _inherits3.default)(ExpandButton, _Component);

  function ExpandButton() {
    (0, _classCallCheck3.default)(this, ExpandButton);
    return (0, _possibleConstructorReturn3.default)(this, (ExpandButton.__proto__ || Object.getPrototypeOf(ExpandButton)).apply(this, arguments));
  }

  (0, _createClass3.default)(ExpandButton, [{
    key: 'renderIcon',
    value: function renderIcon() {
      var _classNames;

      return _react2.default.createElement(_IconArrowOpenDownLine2.default, {
        className: (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, styles.icon, true), (0, _defineProperty3.default)(_classNames, styles.iconOpened, this.props.isExpanded), _classNames))
      });
    }
  }, {
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        _Button2.default,
        {
          variant: 'icon',
          size: 'medium',
          onClick: this.props.onClick,
          icon: this.renderIcon(),
          title: this.props.title
        },
        _react2.default.createElement(
          _ScreenReaderContent2.default,
          null,
          this.props.title
        )
      );
    }
  }]);
  ExpandButton.displayName = 'ExpandButton'
  ;
  return ExpandButton;
}(_react.Component), _class2.propTypes = {
  isExpanded: _propTypes2.default.bool.isRequired,
  title: _propTypes2.default.string.isRequired,
  onClick: _propTypes2.default.func.isRequired
}, _temp)) || _class);
exports.default = ExpandButton;