diff --git a/packages/platform/atoms/src/components/ui/button.tsx b/packages/platform/atoms/src/components/ui/button.tsx index f44261ad80..fb6d40e910 100644 --- a/packages/platform/atoms/src/components/ui/button.tsx +++ b/packages/platform/atoms/src/components/ui/button.tsx @@ -1,10 +1,16 @@ import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; -import * as React from "react"; +import { forwardRef } from "react"; +import type { ButtonHTMLAttributes } from "react"; import { cn } from "../../lib/utils"; -const buttonVariants = cva( +type buttonVariantsType = (props: { + variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined; + size: "default" | "sm" | "lg" | "icon" | null | undefined; + className: string | undefined; +}) => string; +const buttonVariants: buttonVariantsType = cva( "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", { variants: { @@ -31,12 +37,12 @@ const buttonVariants = cva( ); export interface ButtonProps - extends React.ButtonHTMLAttributes, + extends ButtonHTMLAttributes, VariantProps { asChild?: boolean; } -const Button = React.forwardRef( +const Button = forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button"; return ; diff --git a/packages/platform/atoms/src/components/ui/toast.tsx b/packages/platform/atoms/src/components/ui/toast.tsx index 3e660716ce..cc270ce38e 100644 --- a/packages/platform/atoms/src/components/ui/toast.tsx +++ b/packages/platform/atoms/src/components/ui/toast.tsx @@ -1,6 +1,13 @@ import * as ToastPrimitives from "@radix-ui/react-toast"; import { cva, type VariantProps } from "class-variance-authority"; -import * as React from "react"; +import type { + ForwardRefExoticComponent, + ElementRef, + ComponentPropsWithoutRef, + RefAttributes, + ReactElement, +} from "react"; +import { forwardRef } from "react"; import { Icon } from "@calcom/ui/components/icon"; @@ -8,9 +15,9 @@ import { cn } from "../../lib/utils"; const ToastProvider = ToastPrimitives.Provider; -const ToastViewport = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const ToastViewport = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef & VariantProps ->(({ className, variant, ...props }, ref) => { - return ; -}); +const Toast: ForwardRefExoticComponent> = + forwardRef< + ElementRef, + ComponentPropsWithoutRef & VariantProps + >(({ className, variant, ...props }, ref) => { + return ( + + ); + }); Toast.displayName = ToastPrimitives.Root.displayName; -const ToastAction = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const ToastAction = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const ToastClose = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef +const ToastTitle = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); ToastTitle.displayName = ToastPrimitives.Title.displayName; -const ToastDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef +const ToastDescription = forwardRef< + ElementRef, + ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); ToastDescription.displayName = ToastPrimitives.Description.displayName; -type ToastProps = React.ComponentPropsWithoutRef; +type ToastProps = ComponentPropsWithoutRef; -type ToastActionElement = React.ReactElement; +type ToastActionElement = ReactElement; export { type ToastProps,