"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _typography = require("../../typography");

var _icon = require("../../icon");

var _typography2 = require("../../../mixins/typography");

var _branding = require("../../../mixins/branding");

var _focus = require("../../../mixins/focus");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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; }

// Needs to be a button for accessibility, form-next semantic reasons.
var StyledButton = _styledComponents["default"].button.withConfig({
  displayName: "StyledButton",
  componentId: "sc-60g69u-0"
})(["background:none;border:none;display:flex;align-items:center;color:inherit;font-size:inherit;margin:6px;", " svg > g > g{transition:", ";}", "{svg{box-shadow:", " ", ",", ";border-radius:50%;}}&[disabled]{cursor:default;}&:not([disabled]):hover{svg > g > g{fill:", ";transition:", ";}}&:not([disabled]):active{svg > g > g{fill:", ";transition:", ";}}"], (0, _focus.getBaseFocusState)({
  activeTransition: false
}), _focus.transitionFade, _focus.FOCUS_VISIBLE_SELECTOR, (0, _focus.focusedBorderShadow)({
  inset: false
}), _focus.focusedBorderColor, _focus.focusedBoxShadow, (0, _branding.getPaletteColor)('brand-primary-base-hover'), _focus.transitionInstant, (0, _branding.getPaletteColor)('brand-primary-base'), _focus.transitionInstant);

var OffsetSpan = (0, _styledComponents["default"])(_typography.Span).withConfig({
  displayName: "OffsetSpan",
  componentId: "sc-60g69u-1"
})(["font-family:", ";padding-right:22px;display:-webkit-inline-box;-webkit-box-align:center;"], _typography2.getFontFamily);

var NextButton = function NextButton(_ref) {
  var children = _ref.children,
      disabled = _ref.disabled,
      spacing = _ref.spacing,
      className = _ref.className,
      dataCy = _ref['data-cy'],
      dataQa = _ref['data-qa'],
      id = _ref.id,
      props = _objectWithoutProperties(_ref, ["children", "disabled", "spacing", "className", "data-cy", "data-qa", "id"]);

  return /*#__PURE__*/_react["default"].createElement(StyledButton, _extends({
    type: "submit",
    disabled: disabled,
    spacing: spacing,
    className: className,
    "data-cy": dataCy,
    "data-qa": dataQa,
    id: id
  }, props), children != null ? /*#__PURE__*/_react["default"].createElement(OffsetSpan, {
    fontSize: "f2",
    bold: true,
    colorName: "greyscale-dark"
  }, children) : null, /*#__PURE__*/_react["default"].createElement(_icon.NextIcon, {
    disabled: disabled
  }));
};

exports.NextButton = NextButton;
NextButton.displayName = 'NextButton';