{"version":3,"file":"Badge.cjs","names":[],"sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport classnames from \"classnames\";\nimport React, { type ComponentType, type PropsWithChildren } from \"react\";\nimport styles from \"./Badge.module.css\";\nimport { Typography } from \"../Typography/Typography\";\n\ntype BadgeProps = {\n  /**\n   * The CSS class name.\n   */\n  className?: string;\n  /**\n   * The type of badge.\n   */\n  kind?: \"default\" | \"grey\" | \"on-solid\" | \"blue\" | \"green\" | \"red\";\n  /**\n   * An icon to display within the badge.\n   */\n  Icon?: ComponentType<React.SVGAttributes<SVGElement>>;\n};\n\n/**\n * A Badge component.\n */\nexport const Badge: React.FC<PropsWithChildren<BadgeProps>> = ({\n  children,\n  Icon,\n  kind = \"default\",\n  className,\n}) => {\n  const classes = classnames(styles.badge, className, {\n    [styles[\"has-icon\"]]: !!Icon,\n  });\n  return (\n    <Typography\n      as=\"span\"\n      size=\"sm\"\n      weight=\"medium\"\n      className={classes}\n      data-kind={kind}\n    >\n      {Icon && <Icon width=\"16\" height=\"16\" aria-hidden={true} />}\n      {children}\n    </Typography>\n  );\n};\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,SAAkD,EAC7D,UACA,MACA,OAAO,WACP,gBACI;AAIJ,QACE,iBAAA,GAAA,kBAAA,MAAC,mBAAA,YAAD;EACE,IAAG;EACH,MAAK;EACL,QAAO;EACP,YAAA,GAAA,WAAA,SARuB,qBAAA,QAAO,OAAO,WAAW,GACjD,qBAAA,QAAO,cAAc,CAAC,CAAC,MACzB,CAAC;EAOE,aAAW;YALb,CAOG,QAAQ,iBAAA,GAAA,kBAAA,KAAC,MAAD;GAAM,OAAM;GAAK,QAAO;GAAK,eAAa;GAAQ,CAAA,EAC1D,SACU"}