{
  "name": "tooltip",
  "type": "registry:ui",
  "framework": "react",
  "title": "Tooltip",
  "description": "A small floating label that appears above an element on hover or focus.",
  "dependencies": [
    "radix-ui"
  ],
  "files": [
    {
      "path": "ui/tooltip.tsx",
      "content": "\"use client\"\n\nimport { Tooltip as TooltipPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * Radix owns the behaviour: hover and focus delay, Escape to dismiss, and\n * collision-aware placement. Only the look is newt/ui's.\n */\nconst DEFAULT_DELAY = 150\n\n/* True below a `TooltipProvider`, so a tooltip knows it can share that one. */\nconst SharedProviderContext = React.createContext(false)\n\n/*\n * Optional. Wrap a group of tooltips in one provider and they share its\n * delays: after one closes, its neighbour opens with no wait.\n */\nfunction TooltipProvider({\n  delayDuration = DEFAULT_DELAY,\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n  return (\n    <SharedProviderContext.Provider value={true}>\n      <TooltipPrimitive.Provider delayDuration={delayDuration} {...props} />\n    </SharedProviderContext.Provider>\n  )\n}\n\n/* A tooltip with no `TooltipProvider` above it brings its own. */\nfunction Tooltip({\n  delayDuration,\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root> & {\n  /** Milliseconds the pointer rests on the trigger before the tooltip opens. */\n  delayDuration?: number\n}) {\n  const shared = React.useContext(SharedProviderContext)\n  if (shared) {\n    return <TooltipPrimitive.Root delayDuration={delayDuration} {...props} />\n  }\n  return (\n    <TooltipPrimitive.Provider delayDuration={delayDuration ?? DEFAULT_DELAY}>\n      <TooltipPrimitive.Root {...props} />\n    </TooltipPrimitive.Provider>\n  )\n}\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n  React.ComponentRef<typeof TooltipPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n    /**\n     * The element the tooltip is portalled into. Defaults to `document.body`;\n     * pass the enclosing native `<dialog>` or a themed wrapper to keep it there.\n     */\n    container?: React.ComponentProps<\n      typeof TooltipPrimitive.Portal\n    >[\"container\"]\n  }\n>(({ className, sideOffset = 8, container, ...props }, ref) => (\n  <TooltipPrimitive.Portal container={container}>\n    <TooltipPrimitive.Content\n      ref={ref}\n      sideOffset={sideOffset}\n      className={cn(\n        \"z-[120] whitespace-nowrap rounded-[var(--newt-radius-sm)] bg-[#111214] px-2.5 py-1.5 text-xs font-medium text-newt-text-primary shadow-elevation-high\",\n        className\n      )}\n      {...props}\n    />\n  </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = \"TooltipContent\"\n\nexport { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent }\n",
      "type": "registry:ui"
    }
  ]
}