Skip to content
Snippets Groups Projects

feat: redesign tooltips for schema and nodelink

Merged Marcos Pieras requested to merge tooltipSchema into main
@@ -26,6 +26,7 @@ interface TooltipOptions {
onOpenChange?: (open: boolean) => void;
boundaryElement?: React.RefObject<HTMLElement> | null;
showArrow?: boolean;
interactive?: boolean;
}
export function useTooltip({
@@ -35,11 +36,13 @@ export function useTooltip({
onOpenChange: setControlledOpen,
boundaryElement = null,
showArrow = false,
interactive = true,
}: TooltipOptions = {}): {
open: boolean;
setOpen: (open: boolean) => void;
interactions: ReturnType<typeof useInteractions>;
data: ReturnType<typeof useFloating>;
interactive: boolean;
} {
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(initialOpen);
@@ -97,8 +100,9 @@ export function useTooltip({
setOpen,
interactions: interactions,
data: data,
interactive: interactive,
}),
[open, setOpen, interactions, data],
[open, setOpen, interactions, data, interactive],
);
}
@@ -129,9 +133,9 @@ export const TooltipTrigger = React.forwardRef<HTMLElement, React.HTMLProps<HTML
const context = useTooltipContext();
const childrenRef = React.useMemo(() => {
if (children == null) {
return React.createElement('div').ref;
return null;
} else {
return (children as React.ReactElement).ref;
return (children as any).ref;
}
}, [children]);
@@ -204,6 +208,7 @@ export const TooltipContent = React.forwardRef<
...context.data.floatingStyles,
...style,
display: context.data.middlewareData.hide?.referenceHidden ? 'none' : 'block',
pointerEvents: context.interactive ? 'auto' : 'none',
}}
{...context.interactions.getFloatingProps(props)}
>
Loading