"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Button = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
require("../styles/button.css");
require("../styles/main.css");
var _Loader = require("./Loader");
var _excluded = ["intent", "appearance", "disabled", "size", "align", "isLoading", "isActive", "isFullWidth", "children"];
var Button = function Button(_ref) {
  var intent = _ref.intent,
    appearance = _ref.appearance,
    disabled = _ref.disabled,
    size = _ref.size,
    align = _ref.align,
    isLoading = _ref.isLoading,
    isActive = _ref.isActive,
    isFullWidth = _ref.isFullWidth,
    children = _ref.children,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var loading = isLoading && "loading";
  var active = isActive && "active";
  var fullWidth = isFullWidth && 'full-width';
  return /*#__PURE__*/_react.default.createElement("button", Object.assign({
    type: "button",
    className: ['button', intent, appearance, size, align, loading, active, fullWidth].join(' '),
    disabled: disabled || isLoading
  }, props), isLoading ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
    style: {
      display: "flex",
      justifyContent: 'center',
      padding: 16,
      paddingBottom: 22,
      paddingRight: 22
    }
  }, /*#__PURE__*/_react.default.createElement(_Loader.Loader, null))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children));
};
exports.Button = Button;
Button.defaultProps = {
  intent: 'default',
  appearance: 'none',
  disabled: false,
  size: 'medium',
  align: 'center',
  isLoading: false,
  isActive: false,
  isFullWidth: false,
  onClick: undefined
};