{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "clinical-citation",
  "title": "Clinical citation",
  "description": "A record cited in the sentence that relies on it: a lab result, note, image or guideline, opening on hover or focus like shadcn's Inline Citation.",
  "dependencies": [],
  "registryDependencies": [
    "button",
    "hover-card"
  ],
  "files": [
    {
      "path": "registry/base-nova/clinical-citation/clinical-citation.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"cn\"\n\nimport { Button } from \"@/components/ui/button\"\nimport {\n  HoverCard,\n  HoverCardContent,\n  HoverCardTrigger,\n} from \"@/components/ui/hover-card\"\n\n/** A record an AI answer relies on: a result, a note, an image, a guideline. */\nexport type ClinicalSource = {\n  id: string\n  title: string\n  /** The chip's text, such as \"Troponin\". Defaults to the title. */\n  label?: string\n  /** What it is, such as \"Lab result\", \"ECG\" or \"Nursing note\". */\n  kind?: string\n  /** An ISO 8601 date, or any text you want shown as the date. */\n  date?: string\n  /** A quote or summary of the part the answer relies on. */\n  detail?: string\n  /** Where to read it in your record. */\n  href?: string\n}\n\nexport function clinicalSourceMeta(source: ClinicalSource) {\n  return [source.kind, source.date].filter(Boolean).join(\" · \")\n}\n\n/**\n * A record cited in the sentence that relies on it. It opens on hover or\n * focus, as shadcn's Inline Citation does, and shows what the record says.\n */\nexport type ClinicalCitationProps = {\n  /**\n   * The record cited: `{ id, title, label?, kind?, date?, detail?, href? }`.\n   * `label` is the chip's text, `detail` quotes the part relied on and\n   * `href` opens it in your record.\n   */\n  source: ClinicalSource\n  /** Classes for the chip. */\n  className?: string\n}\n\nexport function ClinicalCitation({ source, className }: ClinicalCitationProps) {\n  const meta = clinicalSourceMeta(source)\n  return (\n    <HoverCard>\n      <HoverCardTrigger\n        delay={10}\n        closeDelay={100}\n        render={\n          <Button\n            data-slot=\"clinical-citation\"\n            variant=\"secondary\"\n            size=\"xs\"\n            className={cn(\"mx-0.5\", className)}\n          />\n        }\n      >\n        {source.label ?? source.title}\n      </HoverCardTrigger>\n      <HoverCardContent className=\"flex w-72 flex-col gap-1 text-sm\">\n        <div className=\"font-medium\">{source.title}</div>\n        {meta && <div className=\"text-xs text-muted-foreground\">{meta}</div>}\n        {source.detail && (\n          <p className=\"text-muted-foreground\">{source.detail}</p>\n        )}\n        {source.href && (\n          <a\n            href={source.href}\n            className=\"w-fit rounded-sm text-xs text-muted-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50\"\n          >\n            Open in the record\n          </a>\n        )}\n      </HoverCardContent>\n    </HoverCard>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "docs": "Clinical citation docs: https://organui.com/docs/ai-elements/clinical-citation. Built for shadcn's Base UI styles; Radix projects get the Radix version through a {style} registry URL (https://organui.com/docs/base-ui#radix).",
  "categories": [
    "ai"
  ],
  "type": "registry:ui"
}