{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "link",
  "title": "Link",
  "description": "One link: a hairline underline at rest, and pointing at it, focusing it or holding its card open draws a highlighter stroke through the whole word, on from the left and off to the right.",
  "dependencies": [
    "@radix-ui/react-slot"
  ],
  "registryDependencies": [
    "https://thedirectors.agency/ui/r/0nlytype.json"
  ],
  "files": [
    {
      "path": "registry/0nlytype/ui/link.tsx",
      "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype LinkProps = React.ComponentProps<\"a\"> & {\n  /** Render the child element (your router's link, say) with the link's look. */\n  asChild?: boolean\n  /** Leaves the site: opens in a new tab and takes the ↗, the one place an arrow belongs. */\n  external?: boolean\n  /**\n   * quiet sets the underline in rule, for a run of links that already reads as links. reference drops the line for a raised\n   * reference mark (* † ‡ …). address writes where the link goes after it when pointed at (not with asChild).\n   */\n  variant?: \"quiet\" | \"reference\" | \"address\"\n}\n\n/** Hangs past the end of the line (see base.css), so the link keeps room for it and it never starts a line alone. */\nconst out = (\n  <>\n    <span className=\"ot-link-out\" aria-hidden=\"true\">\n      ↗\n    </span>\n    <span className=\"ot-sr\"> (opens in a new tab)</span>\n  </>\n)\n\n/** Where a link goes, as print spells it out: no scheme, no www, no trailing slash. */\nconst addressOf = (href: string) => href.replace(/^[a-z][a-z0-9+.-]*:(\\/\\/)?/i, \"\").replace(/^www\\./, \"\").replace(/\\/$/, \"\") || href\n\n/** A hairline underline; pointing at it draws a highlighter stroke through the words. */\nfunction Link({ className, asChild = false, external = false, variant, children, ...props }: LinkProps) {\n  const Comp = asChild ? Slot : \"a\"\n  const address =\n    variant === \"address\" && !asChild && props.href ? (\n      <span className=\"ot-link-address\" aria-hidden=\"true\">\n        ({addressOf(props.href)})\n      </span>\n    ) : null\n  const link = (\n    <Comp\n      data-slot=\"link\"\n      data-variant={variant}\n      className={cn(\"ot-link\", className)}\n      {...(external ? { target: \"_blank\", rel: \"noreferrer\" } : {})}\n      {...props}\n    >\n      {asChild ? (\n        children\n      ) : (\n        <>\n          {children}\n          {external ? out : null}\n        </>\n      )}\n    </Comp>\n  )\n  // Keep room for the address even at rest; it steps under the words when their measure is full.\n  return address ? <span className=\"ot-link-addressed\">{link}{address}</span> : link\n}\n\nexport { Link, type LinkProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "movement": "II",
    "underneath": "native",
    "contract": "ot-link"
  },
  "type": "registry:ui"
}
