{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "table-tooltip-support", "title": "Table Tooltip Support", "dependencies": [ "radix-ui" ], "registryDependencies": [ "table-shared-core" ], "files": [ { "path": "components/tooltip/index.ts", "content": "export * from \"./tooltip\";\nexport * from \"./_components\";\n", "type": "registry:file", "target": "components/tooltip/index.ts" }, { "path": "components/tooltip/tooltip.tsx", "content": "\"use client\";\n\nimport type { Tooltip as TooltipPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport type { AlignType } from \"../../types\";\nimport {\n TooltipContent,\n TooltipProvider,\n TooltipRoot,\n TooltipTrigger,\n} from \"./_components\";\n\nexport type TooltipPlacement =\n | \"top\"\n | \"left\"\n | \"right\"\n | \"bottom\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\"\n | \"leftTop\"\n | \"leftBottom\"\n | \"rightTop\"\n | \"rightBottom\";\nexport type AbstractTooltipProps = {\n placement?: TooltipPlacement;\n};\n\ntype TooltipProps = AbstractTooltipProps &\n Omit, \"side\"> & {\n /**\n * The text shown in the tooltip\n */\n title?: React.ReactNode;\n placement?: TooltipPlacement;\n hidden?: boolean;\n classNames?: {\n title?: string;\n arrow?: string;\n };\n styles?: {\n title?: React.CSSProperties;\n arrow?: React.CSSProperties;\n };\n align?: AlignType;\n };\nconst Tooltip = (props: TooltipProps) => {\n const triggerRef = React.useRef(null);\n\n const isShadcnTooltip = !(\"title\" in props);\n if (isShadcnTooltip) return ;\n\n if (!props.title) {\n return <>{props.children};\n }\n\n const {\n children,\n title,\n placement,\n hidden,\n classNames,\n styles,\n align: domAlign,\n ...restProps\n } = props;\n\n let side: \"top\" | \"right\" | \"bottom\" | \"left\" = \"bottom\";\n if (placement?.includes(\"top\")) {\n side = \"top\";\n } else if (placement?.includes(\"right\")) {\n side = \"right\";\n } else if (placement?.includes(\"left\")) {\n side = \"left\";\n }\n\n let align: \"start\" | \"center\" | \"end\" = \"center\";\n if (placement?.includes(\"Top\")) {\n align = \"start\";\n } else if (placement?.includes(\"Left\")) {\n align = \"start\";\n } else if (placement?.includes(\"Right\")) {\n align = \"end\";\n }\n\n const alignOffset = domAlign?.offset?.[0];\n const sideOffset = domAlign?.offset?.[1];\n\n return (\n <>\n \n \n event.preventDefault()}\n >\n {children}\n \n \n \n \n );\n};\n\nexport { Tooltip };\nexport type { TooltipProps };\n", "type": "registry:file", "target": "components/tooltip/tooltip.tsx" }, { "path": "components/tooltip/_components.tsx", "content": "import { Tooltip as TooltipPrimitive } from \"radix-ui\";\n\nimport { cn } from \"../../lib/utils\";\n\nfunction TooltipContent({\n className,\n sideOffset = 4,\n children,\n classNames,\n styles,\n ...props\n}: React.ComponentProps & {\n classNames?: {\n arrow?: string;\n };\n styles?: {\n arrow?: React.CSSProperties;\n };\n}) {\n return (\n \n \n {children}\n \n \n \n );\n}\n\nexport {\n TooltipProvider,\n Tooltip as TooltipRoot,\n TooltipTrigger,\n} from \"../../shadcn/tooltip\";\n\nexport { TooltipContent };\n", "type": "registry:file", "target": "components/tooltip/_components.tsx" }, { "path": "shadcn/tooltip.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Tooltip as TooltipPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@acme/ui/lib/utils\"\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction Tooltip({\n ...props\n}: React.ComponentProps) {\n return \n}\n\nfunction TooltipTrigger({\n ...props\n}: React.ComponentProps) {\n return \n}\n\nfunction TooltipContent({\n className,\n sideOffset = 0,\n children,\n ...props\n}: React.ComponentProps) {\n return (\n \n \n {children}\n \n \n \n )\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n", "type": "registry:file", "target": "shadcn/tooltip.tsx" } ], "type": "registry:component" }