"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;

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

var _Link = _interopRequireDefault(require("../link/Link"));

var _Text = _interopRequireDefault(require("../text/Text"));

var _BreadCrumbsModule = _interopRequireDefault(require("./BreadCrumbs.module.css"));

var _compileClassNames4 = _interopRequireDefault(require("../../libraries/compileClassNames"));

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 _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 _default(props) {
  var text = props.text,
      children = props.children,
      href = props.href,
      onClick = props.onClick,
      active = props.active,
      dataId = props.dataId,
      ariaLabel = props.ariaLabel,
      role = props.role,
      ariaCurrent = props.ariaCurrent,
      customClassName = props.customClassName,
      isEllipsis = props.isEllipsis,
      size = props.size,
      tagAttributeProps = props.tagAttributeProps;
  var classes = (0, _compileClassNames4["default"])(customClassName, _defineProperty({}, _BreadCrumbsModule["default"].flex, true));
  var contentClassName = (0, _compileClassNames4["default"])(customClassName, _defineProperty({}, _BreadCrumbsModule["default"].content, true), _defineProperty({}, customClassName.content, !!customClassName.content));
  return /*#__PURE__*/_react["default"].createElement("li", _extends({
    "aria-label": ariaLabel,
    "aria-current": ariaCurrent,
    role: role,
    className: classes
  }, tagAttributeProps), href && !active ? /*#__PURE__*/_react["default"].createElement("span", {
    className: contentClassName
  }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
    text: text,
    href: href,
    onClick: onClick,
    customIdPrefix: dataId,
    size: size,
    active: active,
    textEllipsis: isEllipsis
  })) : typeof children == "string" || text ? /*#__PURE__*/_react["default"].createElement("span", {
    className: contentClassName
  }, /*#__PURE__*/_react["default"].createElement(_Text["default"], {
    onClick: onClick,
    customIdPrefix: dataId,
    content: children ? children : text,
    size: size,
    isEllipsis: isEllipsis
  })) : children);
}