"use strict";

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

var _propTypes = _interopRequireDefault(require("prop-types"));

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

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

var StepLink = function StepLink(props) {
  var _props$component;

  function handleClick(event) {
    if (props.onClick) {
      event.preventDefault();
      props.onClick(props.href, props.stepId);
    }
  }

  var ComponentType = (_props$component = props.component) !== null && _props$component !== void 0 ? _props$component : 'a';
  return /*#__PURE__*/_react.default.createElement(ComponentType, {
    href: props.href,
    onClick: handleClick,
    className: props.className
  }, props.children, props.screenReaderText && /*#__PURE__*/_react.default.createElement("span", {
    className: "ds-u-visibility--screen-reader"
  }, " ", props.screenReaderText));
};

exports.StepLink = StepLink;
StepLink.propTypes = {
  /**
     * Label text or HTML.
     */
  children: _propTypes.default.node.isRequired,
  href: _propTypes.default.string,
  stepId: _propTypes.default.string,
  screenReaderText: _propTypes.default.string,
  className: _propTypes.default.string,
  onClick: _propTypes.default.func,
  component: _propTypes.default.oneOfType([_propTypes.default.elementType, _propTypes.default.any])
};
var _default = StepLink;
exports.default = _default;