import _pt from "prop-types";
var _excluded = ["className", "children", "size", "variation"];

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; }

import React from 'react';
import classNames from 'classnames';
import { t } from '../i18n';
export var Badge = function Badge(props) {
  var _props$className = props.className,
      className = _props$className === void 0 ? '' : _props$className,
      children = props.children,
      size = props.size,
      variation = props.variation,
      others = _objectWithoutProperties(props, _excluded);

  var sizeClasses = {
    big: 'ds-c-badge--big'
  };
  var variationClass = variation && "ds-c-badge--".concat(variation);
  var classes = classNames('ds-c-badge', variationClass, sizeClasses[size], className);
  return /*#__PURE__*/React.createElement("span", _extends({
    className: classes
  }, others), variation && /*#__PURE__*/React.createElement("span", {
    className: "ds-u-visibility--screen-reader"
  }, t("badge.".concat(variation)), ": "), children);
};
Badge.propTypes = {
  /**
     * Additional classes to be added to the root badge element.
     * Useful for adding utility classes.
     */
  className: _pt.string,

  /**
     * Label text or HTML.
     */
  children: _pt.oneOfType([_pt.string, _pt.node]).isRequired,

  /**
     * Sets the font size of the Badge. Only supports 'big'
     */
  size: _pt.oneOf(['big']),

  /**
     * A string corresponding to the badge-component variation classes
     */
  variation: _pt.oneOf(['info', 'success', 'warn', 'alert'])
};
export default Badge;