"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Pill;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/** Pills should label page content. */
function Pill({
  children,
  isActive = false,
  onClick,
  className,
  testId
}) {
  const TagName = typeof onClick === 'function' ? 'button' : 'span';
  const pillProps = {
    className: (0, _classnames.default)('pill sub-text', {
      active: isActive
    }, className),
    'test-id': testId,
    onClick: typeof onClick === 'function' ? event => {
      event.stopPropagation();
      onClick(event);
    } : undefined
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, {
    ...pillProps,
    children: children
  });
}