* fix(ui): resolve React 19 ref deprecation warning in Tooltip (#30110) * fix(ui): preserve numeric tooltip content in Tooltip component guard
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
||||
import React from "react";
|
||||
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
|
||||
export function Tooltip({
|
||||
children,
|
||||
content,
|
||||
@@ -40,13 +39,17 @@ export function Tooltip({
|
||||
</TooltipPrimitive.Content>
|
||||
);
|
||||
|
||||
if (content === undefined || content === null || content === "") return <>{children}</>;
|
||||
|
||||
const trigger = React.isValidElement(children) ? children : <span>{children}</span>;
|
||||
|
||||
return (
|
||||
<TooltipPrimitive.Root
|
||||
delayDuration={delayDuration || 50}
|
||||
open={open}
|
||||
defaultOpen={defaultOpen}
|
||||
onOpenChange={onOpenChange}>
|
||||
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
||||
<TooltipPrimitive.Trigger asChild>{trigger}</TooltipPrimitive.Trigger>
|
||||
<TooltipPrimitive.Portal>{Content}</TooltipPrimitive.Portal>
|
||||
</TooltipPrimitive.Root>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user