{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "decision-cards",
  "title": "Decision Cards",
  "description": "A record of decisions: the question, what was chosen, what lost and why, for case studies, design docs and postmortems.",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://miseui.junsu4621.workers.dev/r/motion.json"
  ],
  "files": [
    {
      "path": "registry/miseui/ui/decision-cards.tsx",
      "content": "import type * as React from \"react\"\nimport { useId, useState } from \"react\"\nimport { ChevronDown } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { SPRING_DEFAULT } from \"@/registry/miseui/lib/motion\"\nimport { DecisionBody, ROOT_CLASS, ROW_CLASS, type DecisionCardsVariant, type DecisionItem, type DecisionLabels } from \"@/registry/miseui/ui/decision-cards-parts\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\ntype DecisionCardsEffect = \"disclose\"\n\nconst DEFAULT_LABELS: DecisionLabels = { chosen: \"Chose\", rejected: \"Passed on\", reason: \"Why\", over: \"over\" }\nconst INSTANT = { duration: 0 } as const\n\nfunction HiddenReason({ label, children }: { label: string; children: React.ReactNode }) {\n  const [open, setOpen] = useState(false)\n  const reduceMotion = useReducedMotion() ?? false\n  const panelId = useId()\n  return (\n    <div className=\"mt-2 grid grid-cols-[minmax(0,1fr)]\">\n      <button\n        type=\"button\"\n        aria-expanded={open}\n        aria-controls={panelId}\n        data-slot=\"decision-cards-toggle\"\n        onClick={() => setOpen(!open)}\n        className=\"-ms-1 flex h-8 w-fit items-center gap-1 rounded-sm px-1 text-[13px] text-muted-foreground outline-none transition-colors duration-(--duration-fast) ease-(--ease-mise) hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:h-10\"\n      >\n        {label}\n        <ChevronDown aria-hidden=\"true\" className={cn(\"size-4 transition-transform duration-(--duration-base) ease-(--ease-mise) motion-reduce:transition-none\", open && \"rotate-180\")} />\n      </button>\n      {/* Stays mounted so the spring can run both ways, so inert is what keeps a closed reason away from assistive tech. */}\n      <motion.div\n        id={panelId}\n        data-slot=\"decision-cards-reason\"\n        inert={!open}\n        className=\"overflow-hidden\"\n        initial={false}\n        animate={{ height: open ? \"auto\" : 0 }}\n        transition={reduceMotion ? INSTANT : SPRING_DEFAULT}\n      >\n        <p className=\"pt-1 text-[13px] leading-5 text-pretty text-muted-foreground\">{children}</p>\n      </motion.div>\n    </div>\n  )\n}\n\nfunction ShownReason({ variant, children }: { variant: DecisionCardsVariant; children: React.ReactNode }) {\n  return (\n    <p data-slot=\"decision-cards-reason\" className={cn(\"text-pretty\", variant === \"ledger\" ? \"text-[13px] leading-5 text-muted-foreground\" : \"mt-3 text-sm leading-6\", variant === \"diff\" && \"text-muted-foreground\")}>\n      {children}\n    </p>\n  )\n}\n\ntype DecisionCardsProps = Omit<React.ComponentProps<\"ol\">, \"children\"> & {\n  items: readonly DecisionItem[]\n  /** `split` two boxes side by side, `diff` struck out and written in like an edit, `ledger` a compact record per row. */\n  variant?: DecisionCardsVariant\n  /** `disclose` folds each reason behind a button, so a long list can be scanned by outcome first. */\n  effect?: DecisionCardsEffect\n  /** The words around the values, for another language or another tone. */\n  labels?: Partial<DecisionLabels>\n}\n\nfunction DecisionCards({ items, variant = \"split\", effect, labels, className, ...props }: DecisionCardsProps) {\n  const words = { ...DEFAULT_LABELS, ...labels }\n  return (\n    <ol data-slot=\"decision-cards\" data-variant={variant} data-effect={effect} className={cn(ROOT_CLASS[variant], className)} {...props}>\n      {items.map((item, index) => (\n        <li key={item.id ?? item.title} data-slot=\"decision-cards-item\" className={ROW_CLASS[variant]}>\n          <DecisionBody item={item} index={index} variant={variant} labels={words} />\n          {effect === \"disclose\" ? <HiddenReason label={words.reason}>{item.reason}</HiddenReason> : <ShownReason variant={variant}>{item.reason}</ShownReason>}\n        </li>\n      ))}\n    </ol>\n  )\n}\n\nexport { DecisionCards, type DecisionCardsProps, type DecisionCardsVariant, type DecisionCardsEffect, type DecisionItem, type DecisionLabels }\n",
      "type": "registry:ui"
    },
    {
      "path": "registry/miseui/ui/decision-cards-parts.tsx",
      "content": "type DecisionCardsVariant = \"split\" | \"diff\" | \"ledger\"\n\ninterface DecisionItem {\n  /** Needed only when two decisions share a title. */\n  id?: string\n  /** The question that was open. */\n  title: string\n  chosen: string\n  /** What was on the table and did not win. */\n  rejected: string | readonly string[]\n  reason: string\n}\n\ninterface DecisionLabels {\n  chosen: string\n  rejected: string\n  reason: string\n  /** Joins the two in `ledger`: \"Postgres over MongoDB\". */\n  over: string\n}\n\nconst ROOT_CLASS: Record<DecisionCardsVariant, string> = {\n  split: \"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-4\",\n  diff: \"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-8\",\n  ledger: \"grid min-w-0 grid-cols-[minmax(0,1fr)]\",\n}\n\nconst ROW_CLASS: Record<DecisionCardsVariant, string> = {\n  split: \"@container min-w-0 rounded-lg border bg-card p-4 text-card-foreground\",\n  diff: \"min-w-0 border-t pt-4\",\n  ledger: \"min-w-0 border-b py-3 last:border-b-0\",\n}\n\nfunction toList(rejected: DecisionItem[\"rejected\"]) {\n  return typeof rejected === \"string\" ? [rejected] : rejected\n}\n\nfunction joinOptions(options: readonly string[]) {\n  return options.join(\", \")\n}\n\ninterface BodyProps {\n  item: DecisionItem\n  index: number\n  labels: DecisionLabels\n}\n\nfunction SplitBody({ item, index, labels }: BodyProps) {\n  return (\n    <>\n      <p className=\"text-xs leading-5 text-muted-foreground tabular-nums\">{String(index + 1).padStart(2, \"0\")}</p>\n      <h3 className=\"text-[15px] leading-6 font-medium text-pretty\">{item.title}</h3>\n      <div data-slot=\"decision-cards-options\" className=\"mt-3 grid gap-2 @md:grid-cols-2\">\n        <div className=\"min-w-0 rounded-md bg-mise-soft p-3\">\n          <p className=\"text-xs leading-5 text-muted-foreground\">{labels.chosen}</p>\n          <p className=\"text-sm leading-5 font-medium text-foreground\">{item.chosen}</p>\n        </div>\n        <div className=\"min-w-0 rounded-md border p-3\">\n          <p className=\"text-xs leading-5 text-muted-foreground\">{labels.rejected}</p>\n          {toList(item.rejected).map((option) => (\n            <p key={option} className=\"text-sm leading-5 text-muted-foreground\">\n              {option}\n            </p>\n          ))}\n        </div>\n      </div>\n    </>\n  )\n}\n\nfunction DiffBody({ item, labels }: BodyProps) {\n  return (\n    <>\n      <h3 className=\"text-[13px] leading-5 text-muted-foreground\">{item.title}</h3>\n      <div data-slot=\"decision-cards-diff\" className=\"mt-3 grid grid-cols-[1.25rem_minmax(0,1fr)] gap-y-1\">\n        {toList(item.rejected).map((option) => (\n          <p key={option} className=\"col-span-2 grid grid-cols-subgrid text-[15px] leading-6 text-muted-foreground\">\n            <span aria-hidden=\"true\" className=\"font-mono\">−</span>\n            <span>\n              <span className=\"sr-only\">{labels.rejected}: </span>\n              <del className=\"decoration-1\">{option}</del>\n            </span>\n          </p>\n        ))}\n        <p className=\"col-span-2 grid grid-cols-subgrid text-xl leading-7 font-semibold tracking-tight text-pretty\">\n          <span aria-hidden=\"true\" className=\"font-mono font-normal\">+</span>\n          <span>\n            <span className=\"sr-only\">{labels.chosen}: </span>\n            <ins className=\"no-underline\">{item.chosen}</ins>\n          </span>\n        </p>\n      </div>\n    </>\n  )\n}\n\nfunction LedgerBody({ item, labels }: BodyProps) {\n  return (\n    <>\n      <h3 className=\"text-[13px] leading-5 text-muted-foreground\">{item.title}</h3>\n      <p data-slot=\"decision-cards-sentence\" className=\"mt-1 text-sm leading-5 text-pretty\">\n        <strong className=\"font-medium\">{item.chosen}</strong>\n        <span className=\"text-muted-foreground\">\n          {\" \"}\n          {labels.over} {joinOptions(toList(item.rejected))}\n        </span>\n      </p>\n    </>\n  )\n}\n\nfunction DecisionBody({ variant, ...props }: BodyProps & { variant: DecisionCardsVariant }) {\n  if (variant === \"diff\") return <DiffBody {...props} />\n  if (variant === \"ledger\") return <LedgerBody {...props} />\n  return <SplitBody {...props} />\n}\n\nexport { DecisionBody, ROOT_CLASS, ROW_CLASS, type DecisionCardsVariant, type DecisionItem, type DecisionLabels }\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "display"
  ],
  "type": "registry:ui"
}