"use strict";

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

var React = _interopRequireWildcard(require("react"));

var _styles = require("../styles");

var _button = _interopRequireDefault(require("./button"));

var _constants = require("./constants");

var _examplesList = _interopRequireDefault(require("./examples-list"));

var _examples$BUTTON$exam;

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

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 _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 _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); }

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function CloudComponent() {
  return React.createElement("svg", {
    width: 24,
    height: 24,
    viewBox: "0 0 24 24",
    fill: "none",
    style: {
      width: 24,
      height: 24
    }
  }, React.createElement("rect", {
    width: 24,
    height: 24
  }), React.createElement("path", {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M14.5 5C12.8755 5 11.4519 5.86084 10.6609 7.15112C10.2905 7.05249 9.90137 7 9.5 7C7.14185 7 5.20752 8.81372 5.01562 11.1221C3.28247 11.5605 2 13.1304 2 15C2 17.2092 3.79077 19 6 19H11V14.4143L9.70703 15.707C9.31665 16.0977 8.68335 16.0977 8.29297 15.707C7.90234 15.3167 7.90234 14.6833 8.29297 14.293L11.293 11.293C11.6833 10.9023 12.3167 10.9023 12.707 11.293L15.707 14.293C16.0977 14.6833 16.0977 15.3167 15.707 15.707C15.3167 16.0977 14.6833 16.0977 14.293 15.707L13 14.4143V19H17C19.7615 19 22 16.7615 22 14C22 11.9492 20.7656 10.187 18.9993 9.41577C18.9543 6.96924 16.9573 5 14.5 5Z",
    fill: "white"
  }));
}

var ButtonContainer = (0, _styles.styled)('div', {
  display: 'flex',
  width: '100%',
  height: '100%',
  alignItems: 'flex-start',
  flexDirection: 'column'
});
var ButtonRow = (0, _styles.styled)('div', {
  display: 'flex',
  ':not(:first-child)': {
    marginTop: '20px'
  }
});

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

  function MainButtonStory() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, MainButtonStory);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MainButtonStory)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
      first: false,
      second: false,
      third: false,
      mini: false,
      disabled: false,
      square: false,
      round: false
    });

    _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onClick", function (id) {
      if (!_this.state[id]) {
        _this.setState(_defineProperty({}, id, true));

        setTimeout(function () {
          _this.setState(_defineProperty({}, id, false));
        }, 1000);
      }
    });

    return _this;
  }

  _createClass(MainButtonStory, [{
    key: "render",
    value: function render() {
      return React.createElement(ButtonContainer, null, React.createElement(ButtonRow, null, React.createElement(_button.default, null, "Primary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true
      }, "Primary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.first,
        onClick: this.onClick.bind(this, 'first')
      }, "Click Me")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        kind: _constants.KIND.secondary
      }, "Secondary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        kind: _constants.KIND.secondary
      }, "Secondary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.second,
        onClick: this.onClick.bind(this, 'second'),
        kind: _constants.KIND.secondary
      }, "Click Me")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        kind: _constants.KIND.tertiary
      }, "Tertiary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        kind: _constants.KIND.tertiary
      }, "Tertiary"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.third,
        onClick: this.onClick.bind(this, 'third'),
        kind: _constants.KIND.tertiary
      }, "Click Me")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        kind: _constants.KIND.minimal
      }, "Minimal"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        kind: _constants.KIND.minimal
      }, "Minimal"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.mini,
        onClick: this.onClick.bind(this, 'mini'),
        kind: _constants.KIND.minimal
      }, "Click Me")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        disabled: true
      }, "Disabled"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        disabled: true
      }, "Disabled"), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.disabled,
        disabled: true,
        onClick: this.onClick.bind(this, 'disabled')
      }, "Try To Click Me")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        shape: _constants.SHAPE.square
      }, React.createElement(CloudComponent, null)), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        shape: _constants.SHAPE.square
      }, React.createElement(CloudComponent, null)), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.square,
        shape: _constants.SHAPE.square,
        onClick: this.onClick.bind(this, 'square')
      }, React.createElement(CloudComponent, null)), React.createElement("div", {
        style: {
          marginLeft: '10px'
        }
      }, '<--- Click It')), React.createElement(ButtonRow, null, React.createElement(_button.default, {
        shape: _constants.SHAPE.round
      }, React.createElement(CloudComponent, null)), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: true,
        shape: _constants.SHAPE.round
      }, React.createElement(CloudComponent, null)), React.createElement(_button.default, {
        style: {
          marginLeft: '10px'
        },
        isLoading: this.state.round,
        shape: _constants.SHAPE.round,
        onClick: this.onClick.bind(this, 'round')
      }, React.createElement(CloudComponent, null)), React.createElement("div", {
        style: {
          marginLeft: '10px'
        }
      }, '<--- Click It')));
    }
  }]);

  return MainButtonStory;
}(React.Component);

var _default = (_examples$BUTTON$exam = {}, _defineProperty(_examples$BUTTON$exam, _examplesList.default.BUTTON, function Story1() {
  return React.createElement(MainButtonStory, null);
}), _defineProperty(_examples$BUTTON$exam, _examplesList.default.BUTTON_COMPACT, function Story2() {
  return React.createElement(ButtonContainer, null, React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact
  }, "Primary")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    kind: _constants.KIND.secondary
  }, "Secondary")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    kind: _constants.KIND.tertiary
  }, "Tertiary")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    kind: _constants.KIND.minimal
  }, "Minimal")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    disabled: true
  }, "Disabled")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    shape: _constants.SHAPE.square
  }, React.createElement(CloudComponent, null))), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    shape: _constants.SHAPE.round
  }, React.createElement(CloudComponent, null))));
}), _defineProperty(_examples$BUTTON$exam, _examplesList.default.BUTTON_WITH_ENHANCERS, function Story3() {
  return React.createElement(ButtonContainer, null, React.createElement(ButtonRow, null, React.createElement(_button.default, null, "Primary")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    startEnhancer: CloudComponent
  }, "Start Enhancer")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    endEnhancer: CloudComponent
  }, "End Enhancer")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    startEnhancer: CloudComponent,
    endEnhancer: CloudComponent
  }, "Both Enhancers")));
}), _defineProperty(_examples$BUTTON$exam, _examplesList.default.BUTTON_COMPACT_WITH_ENHANCERS, function Story4() {
  return React.createElement(ButtonContainer, null, React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact
  }, "Primary")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    startEnhancer: CloudComponent
  }, "Start Enhancer")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    endEnhancer: CloudComponent
  }, "End Enhancer")), React.createElement(ButtonRow, null, React.createElement(_button.default, {
    size: _constants.SIZE.compact,
    startEnhancer: CloudComponent,
    endEnhancer: CloudComponent
  }, "Both Enhancers")));
}), _examples$BUTTON$exam);

exports.default = _default;