import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/defineProperty";

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import Button from '../Button';
import { ArrowLeft16, ArrowRight16 } from '@wfp/icons-react';
import { settings } from '../../globals/js';
var prefix = settings.prefix;

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

  var _super = _createSuper(FormControls);

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

    return _super.apply(this, arguments);
  }

  _createClass(FormControls, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          className = _this$props.className,
          onNextClick = _this$props.onNextClick,
          nextDisabled = _this$props.nextDisabled,
          nextIcon = _this$props.nextIcon,
          nextHidden = _this$props.nextHidden,
          nextText = _this$props.nextText,
          onPreviousClick = _this$props.onPreviousClick,
          previousDisabled = _this$props.previousDisabled,
          previousIcon = _this$props.previousIcon,
          previousHidden = _this$props.previousHidden,
          previousText = _this$props.previousText,
          onSubmitClick = _this$props.onSubmitClick,
          submitDisabled = _this$props.submitDisabled,
          submitIcon = _this$props.submitIcon,
          submitHidden = _this$props.submitHidden,
          submitText = _this$props.submitText;
      var formControlsClasses = classNames("".concat(prefix, "--form-controls"), className);
      return /*#__PURE__*/React.createElement("div", {
        className: formControlsClasses
      }, /*#__PURE__*/React.createElement("div", {
        className: "".concat(prefix, "--form-controls__steps")
      }, !previousHidden && /*#__PURE__*/React.createElement(Button, {
        disabled: previousDisabled,
        kind: "secondary",
        className: "".concat(prefix, "--form-controls__prev"),
        icon: previousIcon,
        onClick: onPreviousClick
      }, previousText)), /*#__PURE__*/React.createElement("div", null, !nextHidden && /*#__PURE__*/React.createElement(Button, {
        disabled: nextDisabled,
        kind: "secondary",
        className: "".concat(prefix, "--form-controls__next"),
        icon: nextIcon,
        type: "submit",
        onClick: onNextClick
      }, nextText), !submitHidden && /*#__PURE__*/React.createElement(Button, {
        disabled: submitDisabled,
        type: "submit",
        className: "next",
        icon: submitIcon,
        onClick: onSubmitClick
      }, submitText)));
    }
  }]);

  return FormControls;
}(React.Component);

_defineProperty(FormControls, "propTypes", {
  /**
   * Specify the text to be read by screen-readers when visiting the <Tabs>
   * component
   */
  className: PropTypes.string,
  onNextClick: PropTypes.func,
  nextDisabled: PropTypes.bool,
  nextIcon: PropTypes.object,
  nextHidden: PropTypes.bool,
  nextText: PropTypes.node,
  onPreviousClick: PropTypes.func,
  previousDisabled: PropTypes.bool,
  previousIcon: PropTypes.object,
  previousHidden: PropTypes.bool,
  previousText: PropTypes.node,
  onSubmitClick: PropTypes.func,
  submitDisabled: PropTypes.bool,
  submitIcon: PropTypes.object,
  submitHidden: PropTypes.bool,
  submitText: PropTypes.node
});

_defineProperty(FormControls, "defaultProps", {
  nextIcon: ArrowRight16,
  nextText: 'Next',
  previousIcon: ArrowLeft16,
  previousText: 'Previous',
  submitText: 'Submit'
});

export { FormControls as default };