'use strict';

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

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 _IconEditLine = require('instructure-icons/lib/Line/IconEditLine');

var _IconEditLine2 = _interopRequireDefault(_IconEditLine);

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 _makeScrollable = require('../../../../../common/components/shared/functionality/makeScrollable');

var _makeScrollable2 = _interopRequireDefault(_makeScrollable);

var _formatMessage = require('../../../../../common/format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

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.editButton__styles__root {\n  background-color: transparent;\n  border: none;\n  color: inherit;\n  cursor: pointer;\n  margin: ' + theme.buttonMargin + ';\n  padding: ' + theme.buttonPadding + ';\n}\n\n.editButton__styles__hiddenButton {\n  opacity: 0;\n}\n\n.editButton__styles__hiddenButton:focus {\n  opacity: 1;\n  outline: none;\n  box-shadow: inset 0 0 0 1px ' + theme.focusBorderColor + ';\n  border-radius: calc(' + theme.focusBorderRadius + ' + 0.125rem);\n}\n\n@media screen and (--editButtonBreakPoint) {\n  .editButton__styles__hiddenButton {\n    opacity: 1;\n  }\n}\n';
  },
  'root': 'editButton__styles__root',
  'hiddenButton': 'editButton__styles__hiddenButton'
};
var EditButton = (_dec = (0, _lib2.default)(_theme2.default, styles), _dec(_class = (_temp = _class2 = function (_Component) {
  (0, _inherits3.default)(EditButton, _Component);

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

  (0, _createClass3.default)(EditButton, [{
    key: 'render',
    value: function render() {
      var buttonClasses = (0, _classnames2.default)(styles.root, styles.hiddenButton);

      // using a non-instui button for the focus behavior
      return _react2.default.createElement(
        'button',
        {
          type: 'button',
          onClick: this.props.onClick,
          className: buttonClasses
        },
        _react2.default.createElement(
          _ScreenReaderContent2.default,
          null,
          this.props.screenreaderText
        ),
        _react2.default.createElement(_IconEditLine2.default, null)
      );
    }
  }]);
  EditButton.displayName = 'EditButton'
  ;
  return EditButton;
}(_react.Component), _class2.propTypes = {
  onClick: _propTypes2.default.func.isRequired,
  screenreaderText: _propTypes2.default.string
}, _class2.defaultProps = {
  screenreaderText: 'Modifye'
}, _temp)) || _class);
exports.default = (0, _makeScrollable2.default)(EditButton);