"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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

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 _classnames = _interopRequireDefault(require("classnames"));

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

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

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

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

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

var _dec, _class, _class2, _temp;

var styles = {
  componentId: 'yAmvo',
  template: function template(theme) {
    return "\n\n.yAmvo_dnnz{transition:transform ".concat(theme.iconTransitionDuration || 'inherit', "}\n\n.yAmvo_bPeN{transform:rotateX(180deg)}");
  },
  'icon': 'yAmvo_dnnz',
  'iconOpened': 'yAmvo_bPeN'
};
var ExpandButton = (_dec = (0, _lib.default)(_theme.default, styles), _dec(_class = (_temp = _class2 =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(ExpandButton, _Component);

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

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

      return _react.default.createElement(_IconArrowOpenDown.default, {
        className: (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, styles.icon, true), (0, _defineProperty2.default)(_classNames, styles.iconOpened, this.props.isExpanded), _classNames))
      });
    }
  }, {
    key: "render",
    value: function render() {
      return _react.default.createElement(_Button.default, {
        variant: "icon",
        size: "medium",
        onClick: this.props.onClick,
        icon: this.renderIcon(),
        title: this.props.title
      }, _react.default.createElement(_ScreenReaderContent.default, null, this.props.title));
    }
  }]);
  ExpandButton.displayName = "ExpandButton";
  return ExpandButton;
}(_react.Component), _class2.propTypes = {
  isExpanded: _propTypes.default.bool.isRequired,
  title: _propTypes.default.string.isRequired,
  onClick: _propTypes.default.func.isRequired
}, _temp)) || _class);
exports.default = ExpandButton;