import React from 'react';
import classNames from 'classnames';
import { jsx as _jsx } from "react/jsx-runtime";
/** Pills should label page content. */
export default function Pill({
  children,
  isActive = false,
  onClick,
  className,
  testId
}) {
  const TagName = typeof onClick === 'function' ? 'button' : 'span';
  const pillProps = {
    className: classNames('pill sub-text', {
      active: isActive
    }, className),
    'test-id': testId,
    onClick: typeof onClick === 'function' ? event => {
      event.stopPropagation();
      onClick(event);
    } : undefined
  };
  return /*#__PURE__*/_jsx(TagName, {
    ...pillProps,
    children: children
  });
}