import { jsx as ___EmotionJSX } from "@emotion/core";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/core';
import Loader from './shared-components/loader';
import Container from './shared-components/container';
import { ButtonBase, ButtonText, ButtonContents } from './style';

var _ref = process.env.NODE_ENV === "production" ? {
  name: "oary8u-Button",
  styles: "padding-top:2px;label:Button;"
} : {
  name: "oary8u-Button",
  styles: "padding-top:2px;label:Button;",
  map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaGFyZWQtY29tcG9uZW50cy9idXR0b24vaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNkRvQiIsImZpbGUiOiIuLi8uLi8uLi9zcmMvc2hhcmVkLWNvbXBvbmVudHMvYnV0dG9uL2luZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcblxuaW1wb3J0IExvYWRlciBmcm9tICcuL3NoYXJlZC1jb21wb25lbnRzL2xvYWRlcic7XG5pbXBvcnQgQ29udGFpbmVyIGZyb20gJy4vc2hhcmVkLWNvbXBvbmVudHM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ID0gdGhpcy5wcm9wcztcblxuICAgIHJldHVybiAoXG4gICAgICA8QnV0dG9uQmFzZVxuICAgICAgICBkaXNhYmxlZD17ZGlzYWJsZWR9XG4gICAgICAgIG9uQ2xpY2s9eyFkaXNhYmxlZCAmJiAhbG9hZGluZyA/IG9uQ2xpY2sgOiBldmVudCA9PiBldmVudC5wcmV2ZW50RGVmYXVsdCgpfVxuICAgICAgICBidXR0b25UeXBlPXtidXR0b25UeXBlfVxuICAgICAgICBsb2FkaW5nPXtsb2FkaW5nfVxuICAgICAgICB0eXBlPVwiYnV0dG9uXCJcbiAgICAgICAgdGV4dENvbG9yPXt0ZXh0Q29sb3J9XG4gICAgICAgIHsuLi5yZXN0fVxuICAgICAgPlxuICAgICAgICA8QnV0dG9uQ29udGVudHMgbG9hZGluZz17bG9hZGluZ30gaGFzSWNvbj17ISFpY29ufT5cbiAgICAgICAgICB7aWNvbn1cbiAgICAgICAgICA8QnV0dG9uVGV4dFxuICAgICAgICAgICAgbG9hZGluZz17bG9hZGluZ31cbiAgICAgICAgICAgIGhhc0ljb249eyEhaWNvbn1cbiAgICAgICAgICAgIGNzcz17Y3NzYHBhZGRpbmctdG9wOiAycHg7YH1cbiAgICAgICAgICA+XG4gICAgICAgICAgICB7Y2hpbGRyZW59XG4gICAgICAgICAgPC9CdXR0b25UZXh0PlxuICAgICAgICA8L0J1dHRvbkNvbnRlbnRzPlxuICAgICAgICA8TG9hZGVyXG4gICAgICAgICAgbG9hZGluZz17bG9hZGluZ31cbiAgICAgICAgICBkaXNhYmxlZD17ZGlzYWJsZWR9XG4gICAgICAgICAgYnV0dG9uVHlwZT17YnV0dG9uVHlwZX1cbiAgICAgICAgICB0ZXh0Q29sb3I9e3RleHRDb2xvcn1cbiAgICAgICAgLz5cbiAgICAgIDwvQnV0dG9uQmFzZT5cbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBMaW5rQnV0dG9uIGZyb20gJy4vY29tcG9uZW50cy9saW5rQnV0dG9uJztcbmV4cG9ydCBSb3VuZEJ1dHRvbiBmcm9tICcuL2NvbXBvbmVudHMvcm91bmRCdXR0b24nO1xuZXhwb3J0IFRleHRCdXR0b24gZnJvbSAnLi9jb21wb25lbnRzL3RleHRCdXR0b24nO1xuZXhwb3J0IGRlZmF1bHQgQnV0dG9uO1xuIl19 */"
};

var Button =
/*#__PURE__*/
function (_React$Component) {
  _inherits(Button, _React$Component);

  function Button() {
    _classCallCheck(this, Button);

    return _possibleConstructorReturn(this, _getPrototypeOf(Button).apply(this, arguments));
  }

  _createClass(Button, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          onClick = _this$props.onClick,
          disabled = _this$props.disabled,
          children = _this$props.children,
          buttonType = _this$props.buttonType,
          loading = _this$props.loading,
          icon = _this$props.icon,
          textColor = _this$props.textColor,
          rest = _objectWithoutProperties(_this$props, ["onClick", "disabled", "children", "buttonType", "loading", "icon", "textColor"]);

      return ___EmotionJSX(ButtonBase, _extends({
        disabled: disabled,
        onClick: !disabled && !loading ? onClick : function (event) {
          return event.preventDefault();
        },
        buttonType: buttonType,
        loading: loading,
        type: "button",
        textColor: textColor
      }, rest), ___EmotionJSX(ButtonContents, {
        loading: loading,
        hasIcon: !!icon
      }, icon, ___EmotionJSX(ButtonText, {
        loading: loading,
        hasIcon: !!icon,
        css: _ref
      }, children)), ___EmotionJSX(Loader, {
        loading: loading,
        disabled: disabled,
        buttonType: buttonType,
        textColor: textColor
      }));
    }
  }]);

  return Button;
}(React.Component);

Button.Container = Container;
Button.propTypes = {
  onClick: PropTypes.func,
  disabled: PropTypes.bool,
  children: PropTypes.node.isRequired,
  buttonType: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'quaternary']),
  loading: PropTypes.bool,
  icon: PropTypes.node,
  textColor: PropTypes.string
};
Button.defaultProps = {
  disabled: false,
  buttonType: 'primary',
  loading: false,
  onClick: function onClick() {},
  textColor: ''
};
import _LinkButton from './components/linkButton';
export { _LinkButton as LinkButton };
import _RoundButton from './components/roundButton';
export { _RoundButton as RoundButton };
import _TextButton from './components/textButton';
export { _TextButton as TextButton };
export default Button;