import type { HTMLAttributes, ReactNode } from "react"; import { cx } from "../../utils/cx.utils"; import { Icon } from "../icons/icon"; import type { IconName } from "../icons/icons"; import "./pill.component.css"; /** Sizes accepted by every {@link Pill} variant. Defaults to `"md"`. */ export type PillSize = "sm" | "md" | "xl"; /** Props shared by every {@link Pill} variant. */ export interface PillProps extends Omit, "children"> { /** Text shown inside the pill. Always rendered uppercase. */ children: ReactNode; /** Name of an icon rendered on the left side of the pill. */ icon?: IconName; /** Size of the pill. Defaults to `"md"`. */ size?: PillSize; } /** Icon pixel size per {@link PillSize}. */ const ICON_SIZES: Record = { sm: 12, md: 14, xl: 20, }; function renderContent(children: ReactNode, icon: IconName | undefined, size: PillSize) { return ( <> {icon ? (