'use strict';

var React = require('react');
var PropTypes = require('prop-types');
var classnames = require('classnames');
var Button = require('../../Button/Button.js');
var Settings = require('../../../constants/Settings.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);

var iotPrefix = Settings.settings.iotPrefix;
var propTypes = {
  onNext: PropTypes__default.default.func.isRequired,
  onBack: PropTypes__default.default.func.isRequired,
  onSubmit: PropTypes__default.default.func.isRequired,
  onCancel: PropTypes__default.default.func.isRequired,
  backLabel: PropTypes__default.default.node.isRequired,
  nextLabel: PropTypes__default.default.node.isRequired,
  cancelLabel: PropTypes__default.default.node.isRequired,
  submitLabel: PropTypes__default.default.node.isRequired,
  hasPrev: PropTypes__default.default.bool,
  hasNext: PropTypes__default.default.bool,
  footerLeftContent: PropTypes__default.default.node,
  nextDisabled: PropTypes__default.default.bool,
  sendingData: PropTypes__default.default.bool,
  testId: PropTypes__default.default.string
};
var defaultProps = {
  footerLeftContent: null,
  nextDisabled: false,
  hasPrev: true,
  hasNext: true,
  sendingData: false,
  testId: 'wizard-footer'
};
var WizardFooter = function WizardFooter(_ref) {
  var onNext = _ref.onNext,
    onBack = _ref.onBack,
    onSubmit = _ref.onSubmit,
    className = _ref.className,
    onCancel = _ref.onCancel,
    cancelLabel = _ref.cancelLabel,
    backLabel = _ref.backLabel,
    nextLabel = _ref.nextLabel,
    submitLabel = _ref.submitLabel,
    hasPrev = _ref.hasPrev,
    hasNext = _ref.hasNext,
    footerLeftContent = _ref.footerLeftContent,
    nextDisabled = _ref.nextDisabled,
    sendingData = _ref.sendingData,
    testId = _ref.testId;
  return /*#__PURE__*/React__default.default.createElement(React.Fragment, null, footerLeftContent && /*#__PURE__*/React__default.default.createElement("div", {
    className: "WizardInline-custom-footer-content"
  }, footerLeftContent), /*#__PURE__*/React__default.default.createElement("div", {
    "data-testid": testId,
    className: classnames__default.default(className, "".concat(iotPrefix, "--wizard-footer__buttons"))
  }, !hasPrev ? /*#__PURE__*/React__default.default.createElement(Button, {
    onClick: onCancel,
    kind: "secondary"
    // TODO: pass testId in v3 to override defaults
    // testId={`${testId}-cancel-button`}
  }, cancelLabel) : null, hasPrev ? /*#__PURE__*/React__default.default.createElement(Button, {
    onClick: onBack,
    kind: "secondary"
    // TODO: pass testId in v3 to override defaults
    // testId={`${testId}-previous-button`}
  }, backLabel) : null, hasNext ? /*#__PURE__*/React__default.default.createElement(Button, {
    onClick: onNext,
    disabled: nextDisabled
    // TODO: pass testId in v3 to override defaults
    // testId={`${testId}-next-button`}
  }, nextLabel) : /*#__PURE__*/React__default.default.createElement(Button, {
    onClick: onSubmit,
    disabled: nextDisabled,
    loading: sendingData
    // TODO: pass testId in v3 to override defaults
    // testId={`${testId}-submit-button`}
  }, submitLabel)));
};
WizardFooter.propTypes = propTypes;
WizardFooter.defaultProps = defaultProps;
WizardFooter.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "WizardFooter",
  "props": {
    "footerLeftContent": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "node"
      },
      "required": false
    },
    "nextDisabled": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasPrev": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasNext": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "sendingData": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "'wizard-footer'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "onNext": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onBack": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onSubmit": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onCancel": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "backLabel": {
      "description": "",
      "type": {
        "name": "node"
      },
      "required": true
    },
    "nextLabel": {
      "description": "",
      "type": {
        "name": "node"
      },
      "required": true
    },
    "cancelLabel": {
      "description": "",
      "type": {
        "name": "node"
      },
      "required": true
    },
    "submitLabel": {
      "description": "",
      "type": {
        "name": "node"
      },
      "required": true
    }
  }
};
var WizardFooter$1 = WizardFooter;

module.exports = WizardFooter$1;
