{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "usage-card",
  "title": "Usage Card",
  "description": "Sidebar footer upgrade block with a chip, title, copy, meter and a call to action.",
  "dependencies": [
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "@pestoui/style",
    "@pestoui/utils"
  ],
  "files": [
    {
      "path": "pestoui/components/usage-card.tsx",
      "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* The rail-footer upgrade block: chip, title, one line of copy, a meter, and a\n   single full-width call to action.\n *\n * Not `Card` or `PanelCard` with a narrower `--card-spacing`. Both of those are\n * section surfaces — their parts sit in separately padded bands so a header, a\n * body and a footer read as distinct regions, and `CardFooter` deliberately\n * draws its own edge. A rail footer is the opposite shape: five parts inside one\n * 12px box, on one grid, with the action touching the card's own padding.\n *\n * The tone is the other half of it. It lands on two *descendants* — the chip and\n * the badge — so it travels as one inherited custom property rather than eleven\n * `group-data-[tone=…]` pairs per part, and nothing here reads its own\n * `data-tone` to paint itself. */\n\n/* One tone map, two cvas, so the root and a chip-level override cannot drift\n   apart — the same argument `segmented-bar` makes for its band/legend pair.\n   Each entry only *names* the tone; the wash and the ink are derived from it\n   once, at the two places that consume it. */\nconst TONE_INK = {\n  selected: \"[--usage-card-tone:var(--selected)]\",\n  success: \"[--usage-card-tone:var(--success)]\",\n  warning: \"[--usage-card-tone:var(--warning)]\",\n  destructive: \"[--usage-card-tone:var(--destructive)]\",\n  info: \"[--usage-card-tone:var(--info)]\",\n  muted: \"[--usage-card-tone:var(--muted-foreground)]\",\n  \"chart-1\": \"[--usage-card-tone:var(--chart-1)]\",\n  \"chart-2\": \"[--usage-card-tone:var(--chart-2)]\",\n  \"chart-3\": \"[--usage-card-tone:var(--chart-3)]\",\n  \"chart-4\": \"[--usage-card-tone:var(--chart-4)]\",\n  \"chart-5\": \"[--usage-card-tone:var(--chart-5)]\",\n} as const\n\n/* Two tracks when a chip is present, one when it is not, which is what lets the\n   parts stay flat children instead of needing a header wrapper: the chip and the\n   title auto-place onto row 1, and everything below spans the full width. The\n   column gap is bound to the same `has-*` test as the tracks — left on\n   unconditionally it would indent a chipless card by the width of a collapsed\n   track it never asked for. */\nconst usageCardVariants = cva(\n  \"group/usage-card grid w-full min-w-0 grid-cols-1 items-center gap-y-2.5 rounded-lg border border-border bg-card p-3 text-sm text-card-foreground has-data-[slot=usage-card-icon]:grid-cols-[auto_1fr] has-data-[slot=usage-card-icon]:gap-x-2.5\",\n  {\n    variants: {\n      tone: TONE_INK,\n    },\n    defaultVariants: {\n      /* The chip is a wayfinding mark before it is a status, so the tinted\n         reading has to be asked for. */\n      tone: \"muted\",\n    },\n  }\n)\n\n/* `rounded-sm` is 9.6px against the 32px box — the 0.30 × edge squircle ratio\n   the audit found under the hardcoded radii. `rounded-lg` (16px, what the\n   roomier `PanelCard` chip uses) is exactly half this edge, which collapses the\n   chip into a circle.\n\n   No default tone: unset means the chip inherits the card's, and a value here\n   re-declares the property on the chip alone. The badge keeps reading the root,\n   which is the point — an override is a note about this one mark, not a retint\n   of the card. */\nconst usageCardIconVariants = cva(\n  \"flex size-8 shrink-0 items-center justify-center rounded-sm bg-(--usage-card-tone)/12 text-(--usage-card-tone) [&_svg]:size-4 [&_svg]:shrink-0\",\n  {\n    variants: {\n      tone: TONE_INK,\n    },\n  }\n)\n\ntype UsageCardTone = NonNullable<VariantProps<typeof usageCardVariants>[\"tone\"]>\n\ntype UsageCardProps = React.ComponentProps<\"div\"> &\n  VariantProps<typeof usageCardVariants>\n\ntype UsageCardIconProps = React.ComponentProps<\"span\"> &\n  VariantProps<typeof usageCardIconVariants>\n\n/**\n * ```tsx\n * <UsageCard tone=\"selected\">\n *   <UsageCardIcon><Zap /></UsageCardIcon>\n *   <UsageCardTitle>\n *     Runs this month\n *     <UsageCardBadge>82%</UsageCardBadge>\n *   </UsageCardTitle>\n *   <UsageCardDescription>4,100 of 5,000 included runs used.</UsageCardDescription>\n *   <UsageCardMeter><Progress value={82} /></UsageCardMeter>\n *   <UsageCardAction>\n *     <Button size=\"sm\" className=\"w-full\">Upgrade plan</Button>\n *   </UsageCardAction>\n * </UsageCard>\n * ```\n */\nfunction UsageCard({ className, tone = \"muted\", ...props }: UsageCardProps) {\n  return (\n    <div\n      data-slot=\"usage-card\"\n      data-tone={tone}\n      className={cn(usageCardVariants({ tone }), className)}\n      {...props}\n    />\n  )\n}\n\nfunction UsageCardIcon({ className, tone, ...props }: UsageCardIconProps) {\n  return (\n    <span\n      data-slot=\"usage-card-icon\"\n      data-tone={tone}\n      /* aria-hidden: the title sitting beside it already names the card, so the\n         mark would only be read back twice. */\n      aria-hidden=\"true\"\n      className={cn(usageCardIconVariants({ tone }), className)}\n      {...props}\n    />\n  )\n}\n\n/* A flex row rather than plain text, because the badge belongs on the title's\n   line — trailing it in the same box is what keeps it reading as a qualifier\n   rather than as a second heading. */\nfunction UsageCardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"usage-card-title\"\n      className={cn(\n        \"flex min-w-0 items-center gap-1.5 leading-none font-medium\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/* Same wash and ink as the chip, from the card's tone. Zero variant axes of its\n   own, so no cva: the accent is the card's, not the badge's. */\nfunction UsageCardBadge({ className, ...props }: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"usage-card-badge\"\n      className={cn(\n        \"inline-flex h-5 shrink-0 items-center justify-center rounded-full bg-(--usage-card-tone)/12 px-1.5 text-xs font-medium whitespace-nowrap tabular-nums text-(--usage-card-tone)\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/* Kept at the stock 12px `text-xs` on purpose: the type scale's caption token\n   is 13px, so swapping would change the rendered size and move layout. That\n   swap belongs to a deliberate change that snaps sizes to the scale, not to the\n   zero-change type-scale migration. If it is made, keep the size and colour\n   classes in one cn() call so the registered merger resolves them together. */\nfunction UsageCardDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"usage-card-description\"\n      className={cn(\n        \"col-span-full min-w-0 text-xs leading-normal text-pretty text-muted-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/* Slot, not a meter. Over-quota styling, thresholds and the `aria-value*` trio\n   belong to whatever is dropped in here — a bar that owns none of the numbers\n   cannot be trusted to colour them. */\nfunction UsageCardMeter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"usage-card-meter\"\n      className={cn(\"col-span-full min-w-0\", className)}\n      {...props}\n    />\n  )\n}\n\n/* One grid track, so whatever is slotted in stretches to the card's width. The\n   call site still passes `className=\"w-full\"` — that is the documented idiom and\n   it survives being moved out of this slot — but a rail footer whose upgrade\n   button sits half-width is the failure worth being structurally immune to. */\nfunction UsageCardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"usage-card-action\"\n      className={cn(\"col-span-full grid min-w-0\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  UsageCard,\n  UsageCardAction,\n  UsageCardBadge,\n  UsageCardDescription,\n  UsageCardIcon,\n  UsageCardMeter,\n  UsageCardTitle,\n  usageCardIconVariants,\n  usageCardVariants,\n}\nexport type { UsageCardIconProps, UsageCardProps, UsageCardTone }\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}