{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip-abbr-glossary",
  "title": "Tooltip Abbr Glossary",
  "description": "An abbreviation as a semantic abbr element with its meaning in the title, the accessible description and a focus-reachable tooltip, for the first use of a term.",
  "registryDependencies": [
    "tooltip"
  ],
  "files": [
    {
      "path": "registry/patterns/tooltip-abbr-glossary/tooltip-abbr-glossary.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\"\n\nexport interface TooltipAbbrGlossaryProps {\n  /** The abbreviation as written, e.g. \"WCAG\". */\n  term: string\n  /** What it stands for or means. */\n  definition: string\n}\n\n/**\n * An abbreviation with its meaning. It is a semantic `<abbr>` with a `title`\n * (so the meaning exists without JavaScript and in print), made focusable, with\n * the definition in a tooltip for mouse and keyboard users and in the\n * accessible description for screen readers. Only the first use in a text\n * needs it.\n */\nexport function TooltipAbbrGlossary({\n  term,\n  definition,\n}: TooltipAbbrGlossaryProps) {\n  const id = React.useId()\n  return (\n    <Tooltip>\n      <TooltipTrigger asChild>\n        <abbr\n          title={definition}\n          aria-describedby={id}\n          // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- focusable so keyboard users can read the definition\n          tabIndex={0}\n          className=\"focus-visible:ring-ring cursor-help rounded-sm underline decoration-dotted underline-offset-4 outline-none focus-visible:ring-2\"\n        >\n          {term}\n        </abbr>\n      </TooltipTrigger>\n      <TooltipContent className=\"max-w-64\">{definition}</TooltipContent>\n      <span id={id} className=\"sr-only\">\n        {definition}\n      </span>\n    </Tooltip>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}