chore: decouple calcom/ui/Tooltip from atoms (#19798)
* chore: decouple calcom/ui from atoms #1 * recover input from main * fix: vite config dialog
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-switch": "^1.1.0",
|
||||
"@radix-ui/react-toast": "^1.1.5",
|
||||
"@radix-ui/react-tooltip-atoms": "npm:@radix-ui/react-tooltip@^1.0.0",
|
||||
"@tanstack/react-query": "^5.17.15",
|
||||
"class-variance-authority": "^0.4.0",
|
||||
"clsx": "^2.0.0",
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
In this file we can edit all the Primitives from radix-ui/react-tooltip
|
||||
when building atoms package this will automatically replace the TooltipPrimitives used in components from all over the monorepo
|
||||
ensuring that we don't have issues with atoms.
|
||||
*/
|
||||
import * as TooltipPrimitives from "@radix-ui/react-tooltip-atoms";
|
||||
|
||||
const PortalAsFragment: React.FC<{ children: JSX.Element }> = ({ children }) => <>{children}</>;
|
||||
|
||||
export const Tooltip = TooltipPrimitives.Tooltip;
|
||||
export const TooltipTrigger = TooltipPrimitives.TooltipTrigger;
|
||||
export const TooltipContent = TooltipPrimitives.TooltipContent;
|
||||
export const TooltipArrow = TooltipPrimitives.TooltipArrow;
|
||||
export const TooltipProvider = TooltipPrimitives.TooltipProvider;
|
||||
export const Portal = PortalAsFragment;
|
||||
export const Trigger = TooltipPrimitives.Trigger;
|
||||
export const Provider = TooltipPrimitives.Provider;
|
||||
export const Content = TooltipPrimitives.Content;
|
||||
export const Arrow = TooltipPrimitives.Arrow;
|
||||
export const Root = TooltipPrimitives.Root;
|
||||
export const createTooltipScope = TooltipPrimitives.createTooltipScope;
|
||||
export const TooltipPortal = PortalAsFragment;
|
||||
@@ -53,6 +53,7 @@ export default defineConfig(({ mode }) => {
|
||||
os: resolve("../../../node_modules/rollup-plugin-node-builtins"),
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
"@calcom/lib/markdownToSafeHTML": path.resolve(__dirname, "./lib/markdownToSafeHTML"),
|
||||
"@radix-ui/react-tooltip": path.resolve(__dirname, "./src/components/ui/tooltip.tsx"),
|
||||
".prisma/client": path.resolve(__dirname, "../../prisma-client"),
|
||||
"@prisma/client": path.resolve(__dirname, "../../prisma-client"),
|
||||
"@calcom/prisma": path.resolve(__dirname, "../../prisma"),
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
||||
import React from "react";
|
||||
|
||||
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
|
||||
export function Tooltip({
|
||||
@@ -24,7 +23,6 @@ export function Tooltip({
|
||||
side?: "top" | "right" | "bottom" | "left";
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
} & TooltipPrimitive.TooltipContentProps) {
|
||||
const isPlatform = useIsPlatform();
|
||||
const Content = (
|
||||
<TooltipPrimitive.Content
|
||||
{...props}
|
||||
@@ -48,7 +46,7 @@ export function Tooltip({
|
||||
defaultOpen={defaultOpen}
|
||||
onOpenChange={onOpenChange}>
|
||||
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
||||
{isPlatform ? <>{Content}</> : <TooltipPrimitive.Portal>{Content}</TooltipPrimitive.Portal>}
|
||||
<TooltipPrimitive.Portal>{Content}</TooltipPrimitive.Portal>
|
||||
</TooltipPrimitive.Root>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user