import { jsx } from "react/jsx-runtime";
import * as React from "react";
import { cva } from "class-variance-authority";
import { cn } from "../../lib/utils.js";
const badgeVariants = cva(
  // 2026-05-23 Path B revert:icon-as-text / numeric-in-circle 用 leading-none canonical(對齊 Material Avatar `line-height: 1` / Polaris Badge / Carbon Tag 共識)。
  // 視覺等效驗證:Badge container 顯式 `h-4 (16px)` + `flex items-center` 主導,text 被 items-center 置中,line-height 1.0 vs 1.3 視覺零差別。
  // user 2026-05-23「或是其實根本不用分?」+「照你建議」path B:統一 leading-none,不分。
  // 廢除 2026-05-21 F1 fix 的 leading-compact migration(那次 anchor「不影響高度的話就改」core constraint 是高度不變,Path B 同樣滿足且更簡單)。
  "inline-flex items-center justify-center rounded-full leading-none",
  {
    variants: {
      variant: {
        critical: "bg-notification text-on-emphasis",
        high: "bg-info text-on-emphasis",
        medium: "bg-info-subtle text-info-text",
        low: "bg-secondary text-fg-muted"
      },
      dot: {
        true: "w-1.5 h-1.5",
        false: "min-w-4 h-4 px-1 text-[10px] font-medium"
      }
    },
    defaultVariants: {
      variant: "low",
      dot: false
    }
  }
);
const Badge = React.forwardRef(
  ({ variant, dot = false, count, max, className, role, ...props }, ref) => {
    const effectiveVariant = variant ?? (dot ? "critical" : "low");
    const display = dot ? null : max != null && count != null && count > max ? `${max}+` : `${count}`;
    return /* @__PURE__ */ jsx(
      "span",
      {
        ref,
        role: role ?? "status",
        className: cn(badgeVariants({ variant: effectiveVariant, dot }), className),
        ...props,
        children: display
      }
    );
  }
);
Badge.displayName = "Badge";
const badgeMeta = {
  component: "Badge",
  family: null,
  // self-contained(對齊 spec frontmatter 2026-06-11 修),
  variants: {
    critical: { purpose: "deep-orange 底白字（bg-notification = deep-orange-6）" },
    high: { purpose: "藍底白字（bg-info）" },
    medium: { purpose: "淺藍底藍字（bg-info-subtle）" },
    low: { purpose: "使用者切 tab 才看，不需搶注意力" }
  },
  sizes: {},
  states: ["default"],
  tokens: {
    bg: ["bg-info", "bg-info-subtle", "bg-notification", "bg-secondary"],
    fg: ["text-fg-muted", "text-info-text", "text-on-emphasis"],
    ring: []
  },
  defaultVariant: "low"
};
export {
  Badge,
  badgeMeta,
  badgeVariants
};
//# sourceMappingURL=badge.js.map
