{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip",
  "type": "registry:ui",
  "title": "Tooltip",
  "description": "Tooltip displays contextual information when a user hovers over or focuses a trigger element.",
  "dependencies": [
    "@radix-ui/react-tooltip@^1.2.8",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/tooltip/Tooltip.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/Tooltip.tsx",
      "content": "'use client';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport * as React from 'react';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { TooltipProps, TooltipTriggerProps } from './Tooltip.types';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipContext } from './TooltipContext';\nimport { TooltipDescription } from './TooltipDescription';\nimport { TooltipLabel } from './TooltipLabel';\nimport { TooltipPortal } from './TooltipPortal';\n\nconst Tooltip = ({\n  children,\n  variant = 'default',\n  size = 'md',\n  delayDuration = 100,\n  arrow = true,\n  defaultMotion,\n  ...props\n}: TooltipProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n\n  return (\n    <TooltipPrimitive.Provider delayDuration={delayDuration}>\n      <TooltipContext.Provider value={{ variant, size, arrow, motion }}>\n        <TooltipPrimitive.Root {...props}>{children}</TooltipPrimitive.Root>\n      </TooltipContext.Provider>\n    </TooltipPrimitive.Provider>\n  );\n};\n\nTooltip.displayName = 'Tooltip';\nTooltip.Content = TooltipContent;\nexport const TooltipTrigger = React.forwardRef<\n  React.ComponentRef<typeof TooltipPrimitive.Trigger>,\n  TooltipTriggerProps\n>((props, ref) => <TooltipPrimitive.Trigger ref={ref} data-slot=\"tooltip-trigger\" {...props} />);\nTooltipTrigger.displayName = 'Tooltip.Trigger';\nTooltip.Trigger = TooltipTrigger;\nTooltip.Portal = TooltipPortal;\nTooltip.Label = TooltipLabel;\nTooltip.Description = TooltipDescription;\n\nexport { Tooltip, TooltipPortal };\n"
    },
    {
      "path": "src/components/tooltip/Tooltip.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/Tooltip.types.ts",
      "content": "import type * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport type { ComponentPropsWithoutRef, HTMLAttributes, ReactNode } from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\n\n/** Visual variant — `default` for light surfaces, `inverse` for dark or colored surfaces. */\nexport type TooltipVariant = 'default' | 'inverse';\n\n/** Size of the tooltip text. `md` uses body typography, `sm` uses caption typography. */\nexport type TooltipSize = 'sm' | 'md';\n\n/** Supplementary information anchored to a trigger. */\nexport type TooltipProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> &\n  MotionProps & {\n    /** Content rendered inside the component. */\n    children?: ReactNode;\n    /** Visual variant — `default` suits light surfaces; `inverse` suits dark or colored surfaces. */\n    variant?: TooltipVariant;\n    /** Size of the tooltip text. `md` uses body typography, `sm` uses caption typography. */\n    size?: TooltipSize;\n    /** Shows a directional arrow pointing at the trigger. */\n    arrow?: boolean;\n    /** Milliseconds before the tooltip appears after hover. */\n    delayDuration?: number;\n  };\n\n/** Props for `Tooltip.Content` — the floating surface that wraps label and description. */\nexport type TooltipContentProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> &\n  MotionProps & {\n    /** DOM node to portal the content into. Defaults to `document.body`. */\n    portalContainer?: ComponentPropsWithoutRef<typeof TooltipPrimitive.Portal>['container'];\n  };\n\n/** Props for `Tooltip.Label` — bold title text rendered inside the tooltip. */\nexport type TooltipLabelProps = HTMLAttributes<HTMLSpanElement>;\n\n/** Props for `Tooltip.Description` — supporting text rendered below the label. */\nexport type TooltipDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/** Props for the internal tooltip arrow element. */\nexport type TooltipArrowProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>;\n\n/** Props for `Tooltip.Trigger` — the element the tooltip is anchored to. */\nexport type TooltipTriggerProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>;\n\n/** Props for `Tooltip.Portal`. */\nexport type TooltipPortalProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Portal>;\n"
    },
    {
      "path": "src/components/tooltip/Tooltip.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/Tooltip.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nexport const tooltipContentVariants = cva(\n  'rounded-ws-control-md z-ws-popout px-ws-5 flex flex-col gap-0',\n  {\n    variants: {\n      variant: {\n        inverse: 'bg-ws-static-overlay drop-shadow-ws-medium text-ws-static-strong',\n        default:\n          'bg-ws-static-inverse-background drop-shadow-ws-controls-tooltip text-ws-static-inverse-strong',\n      },\n      size: {\n        md: 'py-ws-4',\n        sm: 'py-ws-3 has-[p]:py-ws-4',\n      },\n    },\n    defaultVariants: {\n      variant: 'default',\n      size: 'md',\n    },\n  },\n);\n\nexport const tooltipContentMotionVariants = cva('', {\n  variants: {\n    enabled: {\n      true: cn(\n        'origin-radix-tooltip',\n        'transition-none',\n        'animate-in fade-in-0 zoom-in-95',\n        'duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-smooth-out)',\n        'data-[state=instant-open]:animate-none',\n        'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n        'data-[state=closed]:duration-(--ws-motion-duration-quick)',\n      ),\n      false: '',\n    },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const tooltipLabelVariants = cva('', {\n  variants: {\n    variant: {\n      inverse: 'text-ws-static-strong',\n      default: 'text-ws-static-inverse-strong',\n    },\n    size: {\n      md: 'typography-body-strong-md',\n      sm: 'typography-body-strong-sm',\n    },\n  },\n  defaultVariants: {\n    variant: 'default',\n    size: 'md',\n  },\n});\n\nexport const tooltipDescriptionVariants = cva('', {\n  variants: {\n    variant: {\n      inverse: 'text-ws-static-subtle',\n      default: 'text-ws-static-inverse-subtle',\n    },\n    size: {\n      md: 'typography-body-md',\n      sm: 'typography-body-sm',\n    },\n  },\n  defaultVariants: {\n    variant: 'default',\n    size: 'md',\n  },\n});\n\n// Placed from the parent content's data-side, the side Radix resolved after collision flipping, not\n// the requested side prop: a flipped tooltip keeps its arrow pointing at the trigger. Only the\n// direct parent counts, so a tooltip content nested inside another one cannot match both sides.\nexport const tooltipArrowVariants = cva(\n  cn(\n    'absolute',\n    '[[data-side=top]>&]:h-ws-3 [[data-side=top]>&]:w-ws-5 [[data-side=top]>&]:top-full [[data-side=top]>&]:left-1/2 [[data-side=top]>&]:-translate-x-1/2 [[data-side=top]>&]:[clip-path:polygon(0_0,100%_0,50%_100%)]',\n    '[[data-side=right]>&]:h-ws-5 [[data-side=right]>&]:w-ws-3 [[data-side=right]>&]:top-1/2 [[data-side=right]>&]:right-full [[data-side=right]>&]:-translate-y-1/2 [[data-side=right]>&]:[clip-path:polygon(100%_0,0_50%,100%_100%)]',\n    '[[data-side=bottom]>&]:h-ws-3 [[data-side=bottom]>&]:w-ws-5 [[data-side=bottom]>&]:bottom-full [[data-side=bottom]>&]:left-1/2 [[data-side=bottom]>&]:-translate-x-1/2 [[data-side=bottom]>&]:[clip-path:polygon(50%_0,100%_100%,0_100%)]',\n    '[[data-side=left]>&]:h-ws-5 [[data-side=left]>&]:w-ws-3 [[data-side=left]>&]:top-1/2 [[data-side=left]>&]:left-full [[data-side=left]>&]:-translate-y-1/2 [[data-side=left]>&]:[clip-path:polygon(0_0,100%_50%,0_100%)]',\n  ),\n  {\n    variants: {\n      variant: {\n        inverse: 'bg-ws-static-overlay',\n        default: 'bg-ws-static-inverse-background',\n      },\n    },\n    defaultVariants: {\n      variant: 'default',\n    },\n  },\n);\n"
    },
    {
      "path": "src/components/tooltip/TooltipContent.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/TooltipContent.tsx",
      "content": "'use client';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { TooltipContentProps } from './Tooltip.types';\nimport {\n  tooltipArrowVariants,\n  tooltipContentMotionVariants,\n  tooltipContentVariants,\n} from './Tooltip.variants';\nimport { TooltipContext, TooltipPortalContext } from './TooltipContext';\n\nexport const TooltipContent = React.forwardRef<\n  React.ComponentRef<typeof TooltipPrimitive.Content>,\n  TooltipContentProps\n>(({ className, sideOffset, children, portalContainer, defaultMotion, ...props }, ref) => {\n  const { variant, size, arrow, motion: tooltipMotion } = React.useContext(TooltipContext);\n  const motion = useDefaultMotion(defaultMotion ?? tooltipMotion);\n  const insidePortal = React.useContext(TooltipPortalContext);\n\n  const content = (\n    // Reset for descendants: the flag only applies to the Content placed directly in a Portal.\n    <TooltipPortalContext.Provider value={false}>\n      <TooltipPrimitive.Content\n        ref={ref}\n        data-slot=\"tooltip-content\"\n        sideOffset={sideOffset ?? (arrow ? 7 : 3)}\n        className={cn(\n          tooltipContentVariants({ variant, size }),\n          tooltipContentMotionVariants({ enabled: motion }),\n          className,\n        )}\n        {...props}\n      >\n        {children}\n        {arrow && (\n          <div\n            data-slot=\"tooltip-arrow\"\n            className={cn(tooltipArrowVariants({ variant }))}\n            data-testid=\"tooltip-arrow\"\n          />\n        )}\n      </TooltipPrimitive.Content>\n    </TooltipPortalContext.Provider>\n  );\n\n  // Portals to document.body by default, like Select.Content: rendered in place the tooltip is\n  // clipped by a Modal / Sidepanel and trapped in their stacking context, below z-ws-popout.\n  // Inside Tooltip.Portal it renders into that one, so the wrapper's container and forceMount win.\n  // The Portal gates mounting on its own forceMount, so Content forceMount must reach it too.\n  return insidePortal ? (\n    content\n  ) : (\n    <TooltipPrimitive.Portal container={portalContainer} forceMount={props.forceMount}>\n      {content}\n    </TooltipPrimitive.Portal>\n  );\n});\n\nTooltipContent.displayName = 'Tooltip.Content';\n"
    },
    {
      "path": "src/components/tooltip/TooltipContext.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/TooltipContext.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\nimport type { TooltipSize, TooltipVariant } from './Tooltip.types';\n\nexport const TooltipContext = React.createContext<{\n  variant: TooltipVariant;\n  size: TooltipSize;\n  arrow: boolean;\n  motion?: boolean;\n}>({\n  variant: 'default',\n  size: 'md',\n  arrow: true,\n});\n\n/** True inside `Tooltip.Portal`: `Tooltip.Content` then renders into it instead of its own portal. */\nexport const TooltipPortalContext = React.createContext(false);\n"
    },
    {
      "path": "src/components/tooltip/TooltipDescription.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/TooltipDescription.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { TooltipDescriptionProps } from './Tooltip.types';\nimport { tooltipDescriptionVariants } from './Tooltip.variants';\nimport { TooltipContext } from './TooltipContext';\n\nexport const TooltipDescription = React.forwardRef<HTMLParagraphElement, TooltipDescriptionProps>(\n  ({ className, ...props }, ref) => {\n    const { variant, size } = React.useContext(TooltipContext);\n\n    return (\n      <p\n        ref={ref}\n        data-slot=\"tooltip-description\"\n        className={cn(tooltipDescriptionVariants({ variant, size }), className)}\n        {...props}\n      />\n    );\n  },\n);\n\nTooltipDescription.displayName = 'Tooltip.Description';\n"
    },
    {
      "path": "src/components/tooltip/TooltipLabel.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/TooltipLabel.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { TooltipLabelProps } from './Tooltip.types';\nimport { tooltipLabelVariants } from './Tooltip.variants';\nimport { TooltipContext } from './TooltipContext';\n\nexport const TooltipLabel = React.forwardRef<HTMLSpanElement, TooltipLabelProps>(\n  ({ className, ...props }, ref) => {\n    const { variant, size } = React.useContext(TooltipContext);\n\n    return (\n      <span\n        ref={ref}\n        data-slot=\"tooltip-label\"\n        className={cn(tooltipLabelVariants({ variant, size }), className)}\n        {...props}\n      />\n    );\n  },\n);\n\nTooltipLabel.displayName = 'Tooltip.Label';\n"
    },
    {
      "path": "src/components/tooltip/TooltipPortal.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/tooltip/TooltipPortal.tsx",
      "content": "'use client';\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\n\nimport type { TooltipPortalProps } from './Tooltip.types';\nimport { TooltipPortalContext } from './TooltipContext';\n\n// Tooltip.Content portals itself, so this wrapper is optional. When it is used, its `container`\n// and `forceMount` must win: Content sees the flag and skips its own Portal.\nexport const TooltipPortal = (props: TooltipPortalProps) => (\n  <TooltipPortalContext.Provider value>\n    <TooltipPrimitive.Portal {...props} />\n  </TooltipPortalContext.Provider>\n);\n\nTooltipPortal.displayName = 'Tooltip.Portal';\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
