Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

chore: fix forwardref (#1747)

bautistaaa887e8da6eb46
diff --git a/packages/ui/src/components/alert-dialog.tsx b/packages/ui/src/components/alert-dialog.tsx
index b4350c9f..ff60eb39 100644
--- a/packages/ui/src/components/alert-dialog.tsx
+++ b/packages/ui/src/components/alert-dialog.tsx
@@ -15,29 +15,27 @@ const AlertDialogPortal = ({ ...props }: AlertDialogPrimitive.AlertDialogPortalP
);
AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName;
-const AlertDialogOverlay = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Overlay>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
->(({ className, children: _, ...props }, ref) => (
+const AlertDialogOverlay = ({
+ className,
+ children: _,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) => (
<AlertDialogPrimitive.Overlay
className={cn(
'bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm',
className,
)}
{...props}
- ref={ref}
/>
-));
-AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
+);
-const AlertDialogContent = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
->(({ className, ...props }, ref) => (
+const AlertDialogContent = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) => (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
- ref={ref}
className={cn(
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg md:w-full',
className,
@@ -45,8 +43,7 @@ const AlertDialogContent = React.forwardRef<
{...props}
/>
</AlertDialogPortal>
-));
-AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
+);
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
@@ -61,49 +58,42 @@ const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDiv
);
AlertDialogFooter.displayName = 'AlertDialogFooter';
-const AlertDialogTitle = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Title>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
->(({ className, ...props }, ref) => (
+const AlertDialogTitle = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) => (
<AlertDialogPrimitive.Title
- ref={ref}
- className={cn('text-lg font-semibold', className)}
+ className={cn('text-lg font-semibold leading-none tracking-tight', className)}
{...props}
/>
-));
-AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
+);
-const AlertDialogDescription = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Description>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
->(({ className, ...props }, ref) => (
+const AlertDialogDescription = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) => (
<AlertDialogPrimitive.Description
- ref={ref}
className={cn('text-muted-foreground text-sm', className)}
{...props}
/>
-));
-AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
+);
-const AlertDialogAction = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Action>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
->(({ className, ...props }, ref) => (
- <AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
-));
-AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
+const AlertDialogAction = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) => (
+ <AlertDialogPrimitive.Action className={cn(buttonVariants(), className)} {...props} />
+);
-const AlertDialogCancel = React.forwardRef<
- React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
->(({ className, ...props }, ref) => (
+const AlertDialogCancel = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) => (
<AlertDialogPrimitive.Cancel
- ref={ref}
className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}
{...props}
/>
-));
-AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
+);
export {
AlertDialog,
diff --git a/packages/ui/src/components/alert.tsx b/packages/ui/src/components/alert.tsx
index 81b40338..0c7b3355 100644
--- a/packages/ui/src/components/alert.tsx
+++ b/packages/ui/src/components/alert.tsx
@@ -21,31 +21,20 @@ const alertVariants = cva(
},
);
-const Alert = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
->(({ className, variant, ...props }, ref) => (
- <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
-));
-Alert.displayName = 'Alert';
+const Alert = ({
+ className,
+ variant,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>) => (
+ <div role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
+);
-const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
- ({ className, ...props }, ref) => (
- <h5
- ref={ref}
- className={cn('mb-1 font-medium leading-none tracking-tight', className)}
- {...props}
- />
- ),
+const AlertTitle = ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
+ <h5 className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props} />
);
-AlertTitle.displayName = 'AlertTitle';
-const AlertDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes<HTMLParagraphElement>
->(({ className, ...props }, ref) => (
- <div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
-));
-AlertDescription.displayName = 'AlertDescription';
+const AlertDescription = ({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) => (
+ <div className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
+);
export { Alert, AlertTitle, AlertDescription };
diff --git a/packages/ui/src/components/avatar.tsx b/packages/ui/src/components/avatar.tsx
index 31694923..7dae8940 100644
--- a/packages/ui/src/components/avatar.tsx
+++ b/packages/ui/src/components/avatar.tsx
@@ -5,44 +5,32 @@ import type { ComponentProps } from 'react';
import * as React from 'react';
import { cn } from '../cn';
-const Avatar = React.forwardRef<
- React.ComponentRef<typeof AvatarPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
->(({ className, ...props }, ref) => (
+const Avatar = ({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) => (
<AvatarPrimitive.Root
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
- ref={ref}
{...props}
/>
-));
-Avatar.displayName = AvatarPrimitive.Root.displayName;
+);
-const AvatarImage = React.forwardRef<
- React.ComponentRef<typeof AvatarPrimitive.Image>,
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
->(({ className, ...props }, ref) => (
- <AvatarPrimitive.Image
- className={cn('aspect-square h-full w-full', className)}
- ref={ref}
- {...props}
- />
-));
-AvatarImage.displayName = AvatarPrimitive.Image.displayName;
+const AvatarImage = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AvatarPrimitive.Image>) => (
+ <AvatarPrimitive.Image className={cn('aspect-square h-full w-full', className)} {...props} />
+);
-const AvatarFallback = React.forwardRef<
- React.ComponentRef<typeof AvatarPrimitive.Fallback>,
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
->(({ className, ...props }, ref) => (
+const AvatarFallback = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) => (
<AvatarPrimitive.Fallback
className={cn(
'bg-muted flex h-full w-full items-center justify-center rounded-full',
className,
)}
- ref={ref}
{...props}
/>
-));
-AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
+);
// million-ignore
function DefaultAvatar(props: ComponentProps<'svg'>) {
diff --git a/packages/ui/src/components/badge.tsx b/packages/ui/src/components/badge.tsx
index 625fdf64..d256e1d0 100644
--- a/packages/ui/src/components/badge.tsx
+++ b/packages/ui/src/components/badge.tsx
@@ -31,10 +31,8 @@ export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
-const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
- ({ variant, className, ...props }, ref) => (
- <div className={cn(badgeVariants({ variant }), className)} ref={ref} {...props} />
- ),
+const Badge = ({ variant, className, ...props }: BadgeProps) => (
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
);
export { Badge, badgeVariants };
diff --git a/packages/ui/src/components/button.tsx b/packages/ui/src/components/button.tsx
index 874b1302..38aced46 100644
--- a/packages/ui/src/components/button.tsx
+++ b/packages/ui/src/components/button.tsx
@@ -38,14 +38,9 @@ export interface ButtonProps
asChild?: boolean;
}
-const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
- ({ className, variant, size, asChild = false, ...props }, ref) => {
- const Comp = asChild ? Slot : 'button';
- return (
- <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
- );
- },
-);
-Button.displayName = 'Button';
+const Button = ({ className, variant, size, asChild = false, ...props }: ButtonProps) => {
+ const Comp = asChild ? Slot : 'button';
+ return <Comp className={cn(buttonVariants({ variant, size, className }))} {...props} />;
+};
export { Button, buttonVariants };
diff --git a/packages/ui/src/components/card.tsx b/packages/ui/src/components/card.tsx
index 79bc4ef4..5c4e2137 100644
--- a/packages/ui/src/components/card.tsx
+++ b/packages/ui/src/components/card.tsx
@@ -1,54 +1,31 @@
import * as React from 'react';
import { cn } from '../cn';
-const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => (
- <div
- className={cn('bg-card text-card-foreground rounded-3xl border shadow-sm', className)}
- ref={ref}
- {...props}
- />
- ),
+const Card = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn('bg-card text-card-foreground rounded-3xl border shadow-sm', className)}
+ {...props}
+ />
);
-Card.displayName = 'Card';
-const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => (
- <div className={cn('flex flex-col space-y-1.5 p-6', className)} ref={ref} {...props} />
- ),
+const CardHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
);
-CardHeader.displayName = 'CardHeader';
-const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
- ({ className, ...props }, ref) => (
- <h3
- className={cn('text-lg font-semibold leading-none tracking-tight', className)}
- ref={ref}
- {...props}
- />
- ),
+const CardTitle = ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (
+ <h3 className={cn('text-lg font-semibold leading-none tracking-tight', className)} {...props} />
);
-CardTitle.displayName = 'CardTitle';
-const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => (
- <div className={cn('text-muted-foreground text-sm', className)} ref={ref} {...props} />
- ),
+const CardDescription = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn('text-muted-foreground text-sm', className)} {...props} />
);
-CardDescription.displayName = 'CardDescription';
-const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => (
- <div className={cn('p-6 pt-0', className)} ref={ref} {...props} />
- ),
+const CardContent = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn('p-6 pt-0', className)} {...props} />
);
-CardContent.displayName = 'CardContent';
-const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => (
- <div className={cn(' flex items-center p-6 pt-0', className)} ref={ref} {...props} />
- ),
+const CardFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn(' flex items-center p-6 pt-0', className)} {...props} />
);
-CardFooter.displayName = 'CardFooter';
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
diff --git a/packages/ui/src/components/chart.tsx b/packages/ui/src/components/chart.tsx
index ad779cf2..59c8b963 100644
--- a/packages/ui/src/components/chart.tsx
+++ b/packages/ui/src/components/chart.tsx
@@ -34,13 +34,16 @@ function useChart() {
return context;
}
-const ChartContainer = React.forwardRef<
- HTMLDivElement,
- React.ComponentProps<'div'> & {
- config: ChartConfig;
- children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
- }
->(({ id, className, children, config, ...props }, ref) => {
+const ChartContainer = ({
+ id,
+ className,
+ children,
+ config,
+ ...props
+}: React.ComponentProps<'div'> & {
+ config: ChartConfig;
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
+}) => {
const uniqueId = React.useId();
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
@@ -48,7 +51,6 @@ const ChartContainer = React.forwardRef<
<ChartContext.Provider value={{ config }}>
<div
data-chart={chartId}
- ref={ref}
className={cn(
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
className,
@@ -60,8 +62,7 @@ const ChartContainer = React.forwardRef<
</div>
</ChartContext.Provider>
);
-});
-ChartContainer.displayName = 'Chart';
+};
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color);
diff --git a/packages/ui/src/components/checkbox.tsx b/packages/ui/src/components/checkbox.tsx
index bafa77a1..36ff01be 100644
--- a/packages/ui/src/components/checkbox.tsx
+++ b/packages/ui/src/components/checkbox.tsx
@@ -5,23 +5,18 @@ import { Check } from 'lucide-react';
import * as React from 'react';
import { cn } from '../cn';
-const Checkbox = React.forwardRef<
- React.ComponentRef<typeof CheckboxPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
->(({ className, ...props }, ref) => (
+const Checkbox = ({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) => (
<CheckboxPrimitive.Root
className={cn(
'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer h-4 w-4 shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
- ref={ref}
{...props}
>
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
<Check className="h-4 w-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
-));
-Checkbox.displayName = CheckboxPrimitive.Root.displayName;
+);
export { Checkbox };
diff --git a/packages/ui/src/components/dialog.tsx b/packages/ui/src/components/dialog.tsx
index 295d4dee..df0428fc 100644
--- a/packages/ui/src/components/dialog.tsx
+++ b/packages/ui/src/components/dialog.tsx
@@ -14,29 +14,24 @@ function DialogPortal({ ...props }: DialogPrimitive.DialogPortalProps) {
}
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
-interface ContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
+interface ContentProps extends React.ComponentProps<typeof DialogPrimitive.Content> {
displayX?: boolean;
}
-const DialogOverlay = React.forwardRef<
- React.ComponentRef<typeof DialogPrimitive.Overlay>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
->(({ className, ...props }, ref) => (
+const DialogOverlay = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Overlay>) => (
<DialogPrimitive.Overlay
className={cn(
'bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm',
className,
)}
- ref={ref}
{...props}
/>
-));
-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+);
-const DialogContent = React.forwardRef<
- React.ComponentRef<typeof DialogPrimitive.Content>,
- ContentProps
->(({ className, children, displayX = true, ...props }, ref) => (
+const DialogContent = ({ className, children, displayX = true, ...props }: ContentProps) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
@@ -44,7 +39,6 @@ const DialogContent = React.forwardRef<
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-3xl md:w-full',
className,
)}
- ref={ref}
{...props}
>
{children}
@@ -56,8 +50,7 @@ const DialogContent = React.forwardRef<
) : null}
</DialogPrimitive.Content>
</DialogPortal>
-));
-DialogContent.displayName = DialogPrimitive.Content.displayName;
+);
function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return (
@@ -79,29 +72,25 @@ function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivEleme
}
DialogFooter.displayName = 'DialogFooter';
-const DialogTitle = React.forwardRef<
- React.ComponentRef<typeof DialogPrimitive.Title>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
->(({ className, ...props }, ref) => (
+const DialogTitle = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Title>) => (
<DialogPrimitive.Title
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
- ref={ref}
{...props}
/>
-));
-DialogTitle.displayName = DialogPrimitive.Title.displayName;
+);
-const DialogDescription = React.forwardRef<
- React.ComponentRef<typeof DialogPrimitive.Description>,
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
->(({ className, ...props }, ref) => (
+const DialogDescription = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof DialogPrimitive.Description>) => (
<DialogPrimitive.Description
className={cn('text-muted-foreground text-sm', className)}
- ref={ref}
{...props}
/>
-));
-DialogDescription.displayName = DialogPrimitive.Description.displayName;
+);
export {
Dialog,
diff --git a/packages/ui/src/components/dropdown-menu.tsx b/packages/ui/src/components/dropdown-menu.tsx
index 9a05fb20..a19a11ab 100644
--- a/packages/ui/src/components/dropdown-menu.tsx
+++ b/packages/ui/src/components/dropdown-menu.tsx
@@ -17,89 +17,84 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
-const DropdownMenuSubTrigger = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
- inset?: boolean;
- }
->(({ className, inset, children, ...props }, ref) => (
+const DropdownMenuSubTrigger = ({
+ className,
+ inset,
+ children,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
+ inset?: boolean;
+}) => (
<DropdownMenuPrimitive.SubTrigger
className={cn(
'focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none',
inset && 'pl-8',
className,
)}
- ref={ref}
{...props}
>
{children}
<ChevronRight className="ml-auto h-4 w-4" />
</DropdownMenuPrimitive.SubTrigger>
-));
-DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
+);
-const DropdownMenuSubContent = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
->(({ className, ...props }, ref) => (
+const DropdownMenuSubContent = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) => (
<DropdownMenuPrimitive.SubContent
className={cn(
'bg-popover text-popover-foreground animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md',
className,
)}
- ref={ref}
{...props}
/>
-));
-DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
+);
-const DropdownMenuContent = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
->(({ className, sideOffset = 4, ...props }, ref) => (
+const DropdownMenuContent = ({
+ className,
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) => (
<DropdownMenuPrimitive.Portal>
<DropdownMenuPrimitive.Content
className={cn(
'bg-popover text-popover-foreground animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md',
className,
)}
- ref={ref}
sideOffset={sideOffset}
{...props}
/>
</DropdownMenuPrimitive.Portal>
-));
-DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
-
-const DropdownMenuItem = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
- inset?: boolean;
- }
->(({ className, inset, ...props }, ref) => (
+);
+
+const DropdownMenuItem = ({
+ className,
+ inset,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }) => (
<DropdownMenuPrimitive.Item
className={cn(
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
inset && 'pl-8',
className,
)}
- ref={ref}
{...props}
/>
-));
-DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
-
-const DropdownMenuCheckboxItem = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
->(({ className, children, checked, ...props }, ref) => (
+);
+
+const DropdownMenuCheckboxItem = ({
+ className,
+ children,
+ checked,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) => (
<DropdownMenuPrimitive.CheckboxItem
checked={checked}
className={cn(
'focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
- ref={ref}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
@@ -109,19 +104,18 @@ const DropdownMenuCheckboxItem = React.forwardRef<
</span>
{children}
</DropdownMenuPrimitive.CheckboxItem>
-));
-DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
+);
-const DropdownMenuRadioItem = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
->(({ className, children, ...props }, ref) => (
+const DropdownMenuRadioItem = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) => (
<DropdownMenuPrimitive.RadioItem
className={cn(
'focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
- ref={ref}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
@@ -131,34 +125,28 @@ const DropdownMenuRadioItem = React.forwardRef<
</span>
{children}
</DropdownMenuPrimitive.RadioItem>
-));
-DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
-
-const DropdownMenuLabel = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
- inset?: boolean;
- }
->(({ className, inset, ...props }, ref) => (
+);
+
+const DropdownMenuLabel = ({
+ className,
+ inset,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }) => (
<DropdownMenuPrimitive.Label
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
- ref={ref}
{...props}
/>
-));
-DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
+);
-const DropdownMenuSeparator = React.forwardRef<
- React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
->(({ className, ...props }, ref) => (
+const DropdownMenuSeparator = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) => (
<DropdownMenuPrimitive.Separator
className={cn('bg-muted -mx-1 my-1 h-px', className)}
- ref={ref}
{...props}
/>
-));
-DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
+);
function DropdownMenuShortcut({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {
return (
diff --git a/packages/ui/src/components/form.tsx b/packages/ui/src/components/form.tsx
index 1aaa85de..511dede0 100644
--- a/packages/ui/src/components/form.tsx
+++ b/packages/ui/src/components/form.tsx
@@ -65,40 +65,29 @@ interface FormItemContextValue {
const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);
-const FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
- ({ className, ...props }, ref) => {
- const id = React.useId();
-
- return (
- <FormItemContext.Provider value={{ id }}>
- <div className={cn('space-y-2', className)} ref={ref} {...props} />
- </FormItemContext.Provider>
- );
- },
-);
-FormItem.displayName = 'FormItem';
-
-const FormLabel = React.forwardRef<
- React.ComponentRef<typeof LabelPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
->(({ className, ...props }, ref) => {
+const FormItem = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
+ const id = React.useId();
+
+ return (
+ <FormItemContext.Provider value={{ id }}>
+ <div className={cn('space-y-2', className)} {...props} />
+ </FormItemContext.Provider>
+ );
+};
+
+const FormLabel = ({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) => {
const { error, formItemId } = useFormField();
return (
<Label
className={cn(error && 'text-destructive dark:text-error-label', className)}
htmlFor={formItemId}
- ref={ref}
{...props}
/>
);
-});
-FormLabel.displayName = 'FormLabel';
+};
-const FormControl = React.forwardRef<
- React.ComponentRef<typeof Slot>,
- React.ComponentPropsWithoutRef<typeof Slot>
->(({ ...props }, ref) => {
+const FormControl = ({ ...props }: React.ComponentProps<typeof Slot>) => {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
return (
@@ -106,34 +95,28 @@ const FormControl = React.forwardRef<
aria-describedby={!error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`}
aria-invalid={Boolean(error)}
id={formItemId}
- ref={ref}
{...props}
/>
);
-});
-FormControl.displayName = 'FormControl';
+};
-const FormDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes<HTMLParagraphElement>
->(({ className, ...props }, ref) => {
+const FormDescription = ({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) => {
const { formDescriptionId } = useFormField();
return (
<p
className={cn('text-muted-foreground text-sm', className)}
id={formDescriptionId}
- ref={ref}
{...props}
/>
);
-});
-FormDescription.displayName = 'FormDescription';
+};
-const FormMessage = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes<HTMLParagraphElement>
->(({ className, children, ...props }, ref) => {
+const FormMessage = ({
+ className,
+ children,
+ ...props
+}: React.HTMLAttributes<HTMLParagraphElement>) => {
const { error, formMessageId } = useFormField();
const body = error ? String(error.message) : children;
@@ -145,14 +128,12 @@ const FormMessage = React.forwardRef<
<p
className={cn('text-destructive dark:text-error-label text-sm font-medium', className)}
id={formMessageId}
- ref={ref}
{...props}
>
{body}
</p>
);
-});
-FormMessage.displayName = 'FormMessage';
+};
export {
Form,
diff --git a/packages/ui/src/components/hover-card.tsx b/packages/ui/src/components/hover-card.tsx
index df53cf3e..9c85e36e 100644
--- a/packages/ui/src/components/hover-card.tsx
+++ b/packages/ui/src/components/hover-card.tsx
@@ -9,13 +9,14 @@ const HoverCard = HoverCardPrimitive.Root;
const HoverCardTrigger = HoverCardPrimitive.Trigger;
-const HoverCardContent = React.forwardRef<
- React.ComponentRef<typeof HoverCardPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
->(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
+const HoverCardContent = ({
+ className,
+ align = 'center',
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof HoverCardPrimitive.Content>) => (
<HoverCardPrimitive.Portal>
<HoverCardPrimitive.Content
- ref={ref}
align={align}
sideOffset={sideOffset}
className={cn(
@@ -25,7 +26,6 @@ const HoverCardContent = React.forwardRef<
{...props}
/>
</HoverCardPrimitive.Portal>
-));
-HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
+);
export { HoverCard, HoverCardContent, HoverCardTrigger };
diff --git a/packages/ui/src/components/input.tsx b/packages/ui/src/components/input.tsx
index 16c94688..15d5f54a 100644
--- a/packages/ui/src/components/input.tsx
+++ b/packages/ui/src/components/input.tsx
@@ -4,21 +4,17 @@ import { cn } from '../cn';
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
-const Input = React.forwardRef<HTMLInputElement, InputProps>(
- ({ className, type, ...props }, ref) => {
- return (
- <input
- className={cn(
- 'border-input ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border bg-transparent px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50',
- className,
- )}
- ref={ref}
- type={type}
- {...props}
- />
- );
- },
-);
-Input.displayName = 'Input';
+const Input = ({ className, type, ...props }: InputProps) => {
+ return (
+ <input
+ className={cn(
+ 'border-input ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border bg-transparent px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50',
+ className,
+ )}
+ type={type}
+ {...props}
+ />
+ );
+};
export { Input };
diff --git a/packages/ui/src/components/label.tsx b/packages/ui/src/components/label.tsx
index 4b93eb5a..1210ce66 100644
--- a/packages/ui/src/components/label.tsx
+++ b/packages/ui/src/components/label.tsx
@@ -9,12 +9,11 @@ const labelVariants = cva(
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
);
-const Label = React.forwardRef<
- React.ComponentRef<typeof LabelPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>
->(({ className, ...props }, ref) => (
- <LabelPrimitive.Root className={cn(labelVariants(), className)} ref={ref} {...props} />
-));
-Label.displayName = LabelPrimitive.Root.displayName;
+const Label = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>) => (
+ <LabelPrimitive.Root className={cn(labelVariants(), className)} {...props} />
+);
export { Label };
diff --git a/packages/ui/src/components/navigation-menu.tsx b/packages/ui/src/components/navigation-menu.tsx
index 20085e21..25b292ab 100644
--- a/packages/ui/src/components/navigation-menu.tsx
+++ b/packages/ui/src/components/navigation-menu.tsx
@@ -5,32 +5,29 @@ import { ChevronDown } from 'lucide-react';
import * as React from 'react';
import { cn } from '../cn';
-const NavigationMenu = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
->(({ className, children, ...props }, ref) => (
+const NavigationMenu = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.Root>) => (
<NavigationMenuPrimitive.Root
className={cn('relative z-10 flex flex-1 items-center justify-center', className)}
- ref={ref}
{...props}
>
{children}
<NavigationMenuViewport />
</NavigationMenuPrimitive.Root>
-));
-NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
+);
-const NavigationMenuList = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.List>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
->(({ className, ...props }, ref) => (
+const NavigationMenuList = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) => (
<NavigationMenuPrimitive.List
className={cn('group flex flex-1 list-none items-center justify-center space-x-1', className)}
- ref={ref}
{...props}
/>
-));
-NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
+);
const NavigationMenuItem = NavigationMenuPrimitive.Item;
@@ -38,13 +35,13 @@ const navigationMenuTriggerStyle = cva(
'inline-flex items-center justify-center rounded-xl text-sm font-medium transition-colors focus:outline-none focus:bg-accent focus:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none bg-transparent hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent/50 data-[active]:bg-accent/50 h-10 py-2 px-4 group w-max',
);
-const NavigationMenuTrigger = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
->(({ className, children, ...props }, ref) => (
+const NavigationMenuTrigger = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) => (
<NavigationMenuPrimitive.Trigger
className={cn(navigationMenuTriggerStyle(), 'group', className)}
- ref={ref}
{...props}
>
{children}{' '}
@@ -53,59 +50,52 @@ const NavigationMenuTrigger = React.forwardRef<
className="relative top-[1px] ml-3 h-4 w-4 transition duration-200 group-data-[state=open]:rotate-180"
/>
</NavigationMenuPrimitive.Trigger>
-));
-NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
+);
-const NavigationMenuContent = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
->(({ className, ...props }, ref) => (
+const NavigationMenuContent = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) => (
<NavigationMenuPrimitive.Content
className={cn(
'data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 left-0 top-0 w-full md:absolute md:w-auto ',
className,
)}
- ref={ref}
{...props}
/>
-));
-NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
+);
const NavigationMenuLink = NavigationMenuPrimitive.Link;
-const NavigationMenuViewport = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.Viewport>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
->(({ className, ...props }, ref) => (
+const NavigationMenuViewport = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) => (
<div className={cn('absolute left-0 top-full flex justify-center')}>
<NavigationMenuPrimitive.Viewport
className={cn(
'origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow-lg md:w-[var(--radix-navigation-menu-viewport-width)]',
className,
)}
- ref={ref}
{...props}
/>
</div>
-));
-NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
+);
-const NavigationMenuIndicator = React.forwardRef<
- React.ComponentRef<typeof NavigationMenuPrimitive.Indicator>,
- React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
->(({ className, ...props }, ref) => (
+const NavigationMenuIndicator = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) => (
<NavigationMenuPrimitive.Indicator
className={cn(
'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
className,
)}
- ref={ref}
{...props}
>
<div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
</NavigationMenuPrimitive.Indicator>
-));
-NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
+);
export {
NavigationMenu,
diff --git a/packages/ui/src/components/popover.tsx b/packages/ui/src/components/popover.tsx
index 6a8e832d..e4aeb69f 100644
--- a/packages/ui/src/components/popover.tsx
+++ b/packages/ui/src/components/popover.tsx
@@ -9,10 +9,12 @@ const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverAnchor = PopoverPrimitive.Anchor;
-const PopoverContent = React.forwardRef<
- React.ComponentRef<typeof PopoverPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
->(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
+const PopoverContent = ({
+ className,
+ align = 'center',
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof PopoverPrimitive.Content>) => (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Content
align={align}
@@ -20,12 +22,10 @@ const PopoverContent = React.forwardRef<
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none',
className,
)}
- ref={ref}
sideOffset={sideOffset}
{...props}
/>
</PopoverPrimitive.Portal>
-));
-PopoverContent.displayName = PopoverPrimitive.Content.displayName;
+);
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
diff --git a/packages/ui/src/components/progress.tsx b/packages/ui/src/components/progress.tsx
index 0e652642..bfdbb9f4 100644
--- a/packages/ui/src/components/progress.tsx
+++ b/packages/ui/src/components/progress.tsx
@@ -8,12 +8,13 @@ interface ProgressIndicator {
indicatorClassName?: string;
}
-const Progress = React.forwardRef<
- ProgressIndicator & React.ComponentRef<typeof ProgressPrimitive.Root>,
- ProgressIndicator & React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
->(({ indicatorClassName, className, value, ...props }, ref) => (
+const Progress = ({
+ indicatorClassName,
+ className,
+ value,
+ ...props
+}: ProgressIndicator & React.ComponentProps<typeof ProgressPrimitive.Root>) => (
<ProgressPrimitive.Root
- ref={ref}
className={cn('bg-secondary relative h-4 w-full overflow-hidden rounded-full', className)}
{...props}
>
@@ -22,7 +23,6 @@ const Progress = React.forwardRef<
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
-));
-Progress.displayName = ProgressPrimitive.Root.displayName;
+);
export { Progress };
diff --git a/packages/ui/src/components/radio-group.tsx b/packages/ui/src/components/radio-group.tsx
index 4d8a6a76..94d9d6e6 100644
--- a/packages/ui/src/components/radio-group.tsx
+++ b/packages/ui/src/components/radio-group.tsx
@@ -6,21 +6,20 @@ import * as React from 'react';
import { cn } from '../cn';
-const RadioGroup = React.forwardRef<
- React.ComponentRef<typeof RadioGroupPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
->(({ className, ...props }, ref) => {
- return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />;
-});
-RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
+const RadioGroup = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) => {
+ return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} />;
+};
-const RadioGroupItem = React.forwardRef<
- React.ComponentRef<typeof RadioGroupPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
->(({ className, children: _, ...props }, ref) => {
+const RadioGroupItem = ({
+ className,
+ children: _,
+ ...props
+}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) => {
return (
<RadioGroupPrimitive.Item
- ref={ref}
className={cn(
'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
@@ -32,7 +31,6 @@ const RadioGroupItem = React.forwardRef<
</RadioGroupPrimitive.Indicator>
</RadioGroupPrimitive.Item>
);
-});
-RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
+};
export { RadioGroup, RadioGroupItem };
diff --git a/packages/ui/src/components/scroll-area.tsx b/packages/ui/src/components/scroll-area.tsx
index 26b0d11f..2058f5bb 100644
--- a/packages/ui/src/components/scroll-area.tsx
+++ b/packages/ui/src/components/scroll-area.tsx
@@ -4,28 +4,25 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
import * as React from 'react';
import { cn } from '../cn';
-const ScrollArea = React.forwardRef<
- React.ComponentRef<typeof ScrollAreaPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
->(({ className, children, ...props }, ref) => (
- <ScrollAreaPrimitive.Root
- className={cn('relative overflow-hidden', className)}
- ref={ref}
- {...props}
- >
+const ScrollArea = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) => (
+ <ScrollAreaPrimitive.Root className={cn('relative overflow-hidden', className)} {...props}>
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
{children}
</ScrollAreaPrimitive.Viewport>
<ScrollBar />
<ScrollAreaPrimitive.Corner />
</ScrollAreaPrimitive.Root>
-));
-ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
+);
-const ScrollBar = React.forwardRef<
- React.ComponentRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
->(({ className, orientation = 'vertical', ...props }, ref) => (
+const ScrollBar = ({
+ className,
+ orientation = 'vertical',
+ ...props
+}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) => (
<ScrollAreaPrimitive.ScrollAreaScrollbar
className={cn(
'flex touch-none select-none transition-colors',
@@ -34,12 +31,10 @@ const ScrollBar = React.forwardRef<
className,
)}
orientation={orientation}
- ref={ref}
{...props}
>
<ScrollAreaPrimitive.ScrollAreaThumb className="bg-border relative flex-1 rounded-full" />
</ScrollAreaPrimitive.ScrollAreaScrollbar>
-));
-ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
+);
export { ScrollArea, ScrollBar };
diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx
index 11794705..60b7aa10 100644
--- a/packages/ui/src/components/select.tsx
+++ b/packages/ui/src/components/select.tsx
@@ -11,16 +11,16 @@ const SelectGroup = SelectPrimitive.Group;
const SelectValue = SelectPrimitive.Value;
-const SelectTrigger = React.forwardRef<
- React.ComponentRef<typeof SelectPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
->(({ className, children, ...props }, ref) => (
+const SelectTrigger = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Trigger>) => (
<SelectPrimitive.Trigger
className={cn(
'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex h-10 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
- ref={ref}
{...props}
>
{children}
@@ -28,13 +28,14 @@ const SelectTrigger = React.forwardRef<
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
-));
-SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
+);
-const SelectContent = React.forwardRef<
- React.ComponentRef<typeof SelectPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
->(({ className, children, position = 'popper', ...props }, ref) => (
+const SelectContent = ({
+ className,
+ children,
+ position = 'popper',
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Content>) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
className={cn(
@@ -44,7 +45,6 @@ const SelectContent = React.forwardRef<
className,
)}
position={position}
- ref={ref}
{...props}
>
<SelectPrimitive.Viewport
@@ -58,31 +58,28 @@ const SelectContent = React.forwardRef<
</SelectPrimitive.Viewport>
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
-));
-SelectContent.displayName = SelectPrimitive.Content.displayName;
+);
-const SelectLabel = React.forwardRef<
- React.ComponentRef<typeof SelectPrimitive.Label>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
->(({ className, ...props }, ref) => (
+const SelectLabel = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Label>) => (
<SelectPrimitive.Label
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
- ref={ref}
{...props}
/>
-));
-SelectLabel.displayName = SelectPrimitive.Label.displayName;
+);
-const SelectItem = React.forwardRef<
- React.ComponentRef<typeof SelectPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
->(({ className, children, ...props }, ref) => (
+const SelectItem = ({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Item>) => (
<SelectPrimitive.Item
className={cn(
'focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className,
)}
- ref={ref}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
@@ -93,20 +90,14 @@ const SelectItem = React.forwardRef<
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
-));
-SelectItem.displayName = SelectPrimitive.Item.displayName;
+);
-const SelectSeparator = React.forwardRef<
- React.ComponentRef<typeof SelectPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
->(({ className, ...props }, ref) => (
- <SelectPrimitive.Separator
- className={cn('bg-muted -mx-1 my-1 h-px', className)}
- ref={ref}
- {...props}
- />
-));
-SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
+const SelectSeparator = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof SelectPrimitive.Separator>) => (
+ <SelectPrimitive.Separator className={cn('bg-muted -mx-1 my-1 h-px', className)} {...props} />
+);
export {
Select,
diff --git a/packages/ui/src/components/separator.tsx b/packages/ui/src/components/separator.tsx
index 836e3530..700546b9 100644
--- a/packages/ui/src/components/separator.tsx
+++ b/packages/ui/src/components/separator.tsx
@@ -4,10 +4,12 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
import * as React from 'react';
import { cn } from '../cn';
-const Separator = React.forwardRef<
- React.ComponentRef<typeof SeparatorPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
->(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
+const Separator = ({
+ className,
+ orientation = 'horizontal',
+ decorative = true,
+ ...props
+}: React.ComponentProps<typeof SeparatorPrimitive.Root>) => (
<SeparatorPrimitive.Root
className={cn(
'bg-border shrink-0',
@@ -16,10 +18,8 @@ const Separator = React.forwardRef<
)}
decorative={decorative}
orientation={orientation}
- ref={ref}
{...props}
/>
-));
-Separator.displayName = SeparatorPrimitive.Root.displayName;
+);
export { Separator };
diff --git a/packages/ui/src/components/sheet.tsx b/packages/ui/src/components/sheet.tsx
index 16c5c6c1..1f031f40 100644
--- a/packages/ui/src/components/sheet.tsx
+++ b/packages/ui/src/components/sheet.tsx
@@ -18,20 +18,18 @@ const SheetPortal = ({ ...props }: SheetPrimitive.DialogPortalProps) => (
);
SheetPortal.displayName = SheetPrimitive.Portal.displayName;
-const SheetOverlay = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Overlay>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
->(({ className, ...props }, ref) => (
+const SheetOverlay = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Overlay>) => (
<SheetPrimitive.Overlay
className={cn(
'bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm',
className,
)}
{...props}
- ref={ref}
/>
-));
-SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
+);
const sheetVariants = cva(
'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
@@ -53,16 +51,13 @@ const sheetVariants = cva(
);
interface SheetContentProps
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
+ extends React.ComponentProps<typeof SheetPrimitive.Content>,
VariantProps<typeof sheetVariants> {}
-const SheetContent = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Content>,
- SheetContentProps
->(({ side = 'right', className, children, ...props }, ref) => (
+const SheetContent = ({ side = 'right', className, children, ...props }: SheetContentProps) => (
<SheetPortal>
<SheetOverlay />
- <SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
+ <SheetPrimitive.Content className={cn(sheetVariants({ side }), className)} {...props}>
{children}
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
<X className="h-4 w-4" />
@@ -70,7 +65,7 @@ const SheetContent = React.forwardRef<
</SheetPrimitive.Close>
</SheetPrimitive.Content>
</SheetPortal>
-));
+);
SheetContent.displayName = SheetPrimitive.Content.displayName;
const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
@@ -86,29 +81,22 @@ const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElemen
);
SheetFooter.displayName = 'SheetFooter';
-const SheetTitle = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Title>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
->(({ className, ...props }, ref) => (
+const SheetTitle = ({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) => (
<SheetPrimitive.Title
- ref={ref}
className={cn('text-foreground text-lg font-semibold', className)}
{...props}
/>
-));
-SheetTitle.displayName = SheetPrimitive.Title.displayName;
+);
-const SheetDescription = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Description>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
->(({ className, ...props }, ref) => (
+const SheetDescription = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof SheetPrimitive.Description>) => (
<SheetPrimitive.Description
- ref={ref}
className={cn('text-muted-foreground text-sm', className)}
{...props}
/>
-));
-SheetDescription.displayName = SheetPrimitive.Description.displayName;
+);
export {
Sheet,
diff --git a/packages/ui/src/components/switch.tsx b/packages/ui/src/components/switch.tsx
index c6162125..5251d5dd 100644
--- a/packages/ui/src/components/switch.tsx
+++ b/packages/ui/src/components/switch.tsx
@@ -5,17 +5,13 @@ import * as React from 'react';
import { cn } from '../cn';
-const Switch = React.forwardRef<
- React.ComponentRef<typeof SwitchPrimitives.Root>,
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
->(({ className, ...props }, ref) => (
+const Switch = ({ className, ...props }: React.ComponentProps<typeof SwitchPrimitives.Root>) => (
<SwitchPrimitives.Root
className={cn(
'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
{...props}
- ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
@@ -23,7 +19,6 @@ const Switch = React.forwardRef<
)}
/>
</SwitchPrimitives.Root>
-));
-Switch.displayName = SwitchPrimitives.Root.displayName;
+);
export { Switch };
diff --git a/packages/ui/src/components/table.tsx b/packages/ui/src/components/table.tsx
index 191741b5..125c087b 100644
--- a/packages/ui/src/components/table.tsx
+++ b/packages/ui/src/components/table.tsx
@@ -1,90 +1,50 @@
import * as React from 'react';
import { cn } from '../cn';
-const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
- ({ className, ...props }, ref) => (
- <div className="w-full overflow-auto">
- <table className={cn('w-full caption-bottom text-sm', className)} ref={ref} {...props} />
- </div>
- ),
+const Table = ({ className, ...props }: React.HTMLAttributes<HTMLTableElement>) => (
+ <div className="w-full overflow-auto">
+ <table className={cn('w-full caption-bottom text-sm', className)} {...props} />
+ </div>
);
-Table.displayName = 'Table';
-const TableHeader = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes<HTMLTableSectionElement>
->(({ className, ...props }, ref) => (
- <thead className={cn('[&_tr]:border-b', className)} ref={ref} {...props} />
-));
-TableHeader.displayName = 'TableHeader';
+const TableHeader = ({ className, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) => (
+ <thead className={cn('[&_tr]:border-b', className)} {...props} />
+);
+
+const TableBody = ({ className, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) => (
+ <tbody className={cn('[&_tr:last-child]:border-0', className)} {...props} />
+);
-const TableBody = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes<HTMLTableSectionElement>
->(({ className, ...props }, ref) => (
- <tbody className={cn('[&_tr:last-child]:border-0', className)} ref={ref} {...props} />
-));
-TableBody.displayName = 'TableBody';
+const TableFooter = ({ className, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) => (
+ <tfoot className={cn('bg-primary text-primary-foreground font-medium', className)} {...props} />
+);
-const TableFooter = React.forwardRef<
- HTMLTableSectionElement,
- React.HTMLAttributes<HTMLTableSectionElement>
->(({ className, ...props }, ref) => (
- <tfoot
- className={cn('bg-primary text-primary-foreground font-medium', className)}
- ref={ref}
+const TableRow = ({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (
+ <tr
+ className={cn(
+ 'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
+ className,
+ )}
{...props}
/>
-));
-TableFooter.displayName = 'TableFooter';
-
-const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
- ({ className, ...props }, ref) => (
- <tr
- className={cn(
- 'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
- className,
- )}
- ref={ref}
- {...props}
- />
- ),
);
-TableRow.displayName = 'TableRow';
-const TableHead = React.forwardRef<
- HTMLTableCellElement,
- React.ThHTMLAttributes<HTMLTableCellElement>
->(({ className, ...props }, ref) => (
+const TableHead = ({ className, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) => (
<th
className={cn(
'text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0',
className,
)}
- ref={ref}
{...props}
/>
-));
-TableHead.displayName = 'TableHead';
+);
-const TableCell = React.forwardRef<
- HTMLTableCellElement,
- React.TdHTMLAttributes<HTMLTableCellElement>
->(({ className, ...props }, ref) => (
- <td
- className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
- ref={ref}
- {...props}
- />
-));
-TableCell.displayName = 'TableCell';
+const TableCell = ({ className, ...props }: React.TdHTMLAttributes<HTMLTableCellElement>) => (
+ <td className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)} {...props} />
+);
-const TableCaption = React.forwardRef<
- HTMLTableCaptionElement,
- React.HTMLAttributes<HTMLTableCaptionElement>
->(({ className, ...props }, ref) => (
- <caption className={cn('text-muted-foreground mt-4 text-sm', className)} ref={ref} {...props} />
-));
-TableCaption.displayName = 'TableCaption';
+const TableCaption = ({ className, ...props }: React.HTMLAttributes<HTMLTableCaptionElement>) => (
+ <caption className={cn('text-muted-foreground mt-4 text-sm', className)} {...props} />
+);
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
diff --git a/packages/ui/src/components/tabs.tsx b/packages/ui/src/components/tabs.tsx
index f6134821..5fac0cab 100644
--- a/packages/ui/src/components/tabs.tsx
+++ b/packages/ui/src/components/tabs.tsx
@@ -6,88 +6,74 @@ import { cn } from '../cn';
const Tabs = TabsPrimitive.Root;
-const TabsList = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.List>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
->(({ className, ...props }, ref) => (
+const TabsList = ({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) => (
<TabsPrimitive.List
className={cn(
'bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1',
className,
)}
- ref={ref}
{...props}
/>
-));
-TabsList.displayName = TabsPrimitive.List.displayName;
+);
-const VerticalTabsList = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.List>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
->(({ className, ...props }, ref) => (
- <TabsPrimitive.List className={cn('flex flex-col gap-4', className)} ref={ref} {...props} />
-));
-VerticalTabsList.displayName = TabsPrimitive.List.displayName;
+const VerticalTabsList = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.List>) => (
+ <TabsPrimitive.List className={cn('flex flex-col gap-4', className)} {...props} />
+);
-const TabsTrigger = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
->(({ className, ...props }, ref) => (
+const TabsTrigger = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.Trigger>) => (
<TabsPrimitive.Trigger
className={cn(
'ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-sm px-4 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm',
className,
)}
- ref={ref}
{...props}
/>
-));
-TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
+);
-const VerticalTabsTrigger = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
->(({ className, ...props }, ref) => (
+const VerticalTabsTrigger = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.Trigger>) => (
<TabsPrimitive.Trigger
className={cn(
'border-border dark:border-ring data-[state=active]:bg-border ring-offset-background focus-visible:ring-ring data-[state=active]:text-foreground whitespace-nowrap rounded-xl border px-3 py-1.5 text-sm font-medium transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm',
className,
)}
- ref={ref}
{...props}
/>
-));
-VerticalTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
+);
-const TabsContent = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
->(({ className, ...props }, ref) => (
+const TabsContent = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.Content>) => (
<TabsPrimitive.Content
className={cn(
'ring-offset-background focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-2',
className,
)}
- ref={ref}
{...props}
/>
-));
-TabsContent.displayName = TabsPrimitive.Content.displayName;
+);
-const VerticalTabsContent = React.forwardRef<
- React.ComponentRef<typeof TabsPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
->(({ className, ...props }, ref) => (
+const VerticalTabsContent = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof TabsPrimitive.Content>) => (
<TabsPrimitive.Content
className={cn(
'ring-offset-background focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
className,
)}
- ref={ref}
{...props}
/>
-));
-VerticalTabsContent.displayName = TabsPrimitive.Content.displayName;
+);
export {
Tabs,
diff --git a/packages/ui/src/components/toast.tsx b/packages/ui/src/components/toast.tsx
index 8a4a9b4f..02abe10a 100644
--- a/packages/ui/src/components/toast.tsx
+++ b/packages/ui/src/components/toast.tsx
@@ -7,19 +7,18 @@ import { cn } from '../cn';
const ToastProvider = ToastPrimitives.Provider;
-const ToastViewport = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Viewport>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
->(({ className, ...props }, ref) => (
+const ToastViewport = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Viewport>) => (
<ToastPrimitives.Viewport
className={cn(
'fixed top-10 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-14 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',
className,
)}
- ref={ref}
{...props}
/>
-));
+);
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
const toastVariants = cva(
@@ -54,81 +53,69 @@ const bgToastVariants = cva('absolute -left-1 bottom-0 right-0 top-0', {
},
});
-const Toast = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Root>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>
->(({ className, variant, ...props }, ref) => {
+const Toast = ({
+ className,
+ variant,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>) => {
return (
- <ToastPrimitives.Root
- className={cn(toastVariants({ variant }), className)}
- ref={ref}
- {...props}
- >
+ <ToastPrimitives.Root className={cn(toastVariants({ variant }), className)} {...props}>
<div className={cn(bgToastVariants({ variant }))} />
<div className="z-50 inline-flex w-full gap-x-3">{props.children}</div>
</ToastPrimitives.Root>
);
-});
+};
Toast.displayName = ToastPrimitives.Root.displayName;
-const ToastAction = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Action>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
->(({ className, ...props }, ref) => (
+const ToastAction = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Action>) => (
<ToastPrimitives.Action
className={cn(
'ring-offset-background focus:ring-ring group-[.destructive]:border-destructive-foreground group-[.destructive]:dark:hover:text-destructive-foreground group-[.destructive]:hover:bg-destructive-foreground group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-black bg-transparent px-3 text-sm font-medium transition-colors hover:bg-transparent/10 focus:outline-none focus:ring-2 focus:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:hover:bg-transparent/10 dark:border-white',
className,
)}
- ref={ref}
{...props}
/>
-));
+);
ToastAction.displayName = ToastPrimitives.Action.displayName;
-const ToastClose = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Close>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
->(({ className, ...props }, ref) => (
+const ToastClose = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Close>) => (
<ToastPrimitives.Close
className={cn(
'text-foreground/50 hover:text-foreground absolute right-2 top-2 rounded-md p-1 opacity-0 transition-opacity focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
className,
)}
- ref={ref}
toast-close=""
{...props}
>
<X className="h-4 w-4" />
</ToastPrimitives.Close>
-));
+);
ToastClose.displayName = ToastPrimitives.Close.displayName;
-const ToastTitle = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Title>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Title
- className={cn('z-10 text-sm font-semibold', className)}
- ref={ref}
- {...props}
- />
-));
-ToastTitle.displayName = ToastPrimitives.Title.displayName;
+const ToastTitle = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Title>) => (
+ <ToastPrimitives.Title className={cn('z-10 text-sm font-semibold', className)} {...props} />
+);
-const ToastDescription = React.forwardRef<
- React.ComponentRef<typeof ToastPrimitives.Description>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
->(({ className, ...props }, ref) => (
+const ToastDescription = ({
+ className,
+ ...props
+}: React.ComponentProps<typeof ToastPrimitives.Description>) => (
<ToastPrimitives.Description
className={cn('z-10 text-sm text-black/50 opacity-90 dark:text-white/50', className)}
- ref={ref}
{...props}
/>
-));
-ToastDescription.displayName = ToastPrimitives.Description.displayName;
+);
-type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
+type ToastProps = React.ComponentProps<typeof Toast>;
type ToastActionElement = React.ReactElement<typeof ToastAction>;
diff --git a/packages/ui/src/components/toggle-group.tsx b/packages/ui/src/components/toggle-group.tsx
index da421efa..eae0a2fd 100644
--- a/packages/ui/src/components/toggle-group.tsx
+++ b/packages/ui/src/components/toggle-group.tsx
@@ -12,32 +12,34 @@ const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariant
variant: 'default',
});
-const ToggleGroup = React.forwardRef<
- React.ComponentRef<typeof ToggleGroupPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
- VariantProps<typeof toggleVariants>
->(({ className, variant, size, children, ...props }, ref) => (
+const ToggleGroup = ({
+ className,
+ variant,
+ size,
+ children,
+ ...props
+}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
+ VariantProps<typeof toggleVariants>) => (
<ToggleGroupPrimitive.Root
- ref={ref}
className={cn('flex items-center justify-center gap-1', className)}
{...props}
>
<ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
</ToggleGroupPrimitive.Root>
-));
-
-ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
-
-const ToggleGroupItem = React.forwardRef<
- React.ComponentRef<typeof ToggleGroupPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
- VariantProps<typeof toggleVariants>
->(({ className, children, variant, size, ...props }, ref) => {
+);
+
+const ToggleGroupItem = ({
+ className,
+ children,
+ variant,
+ size,
+ ...props
+}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
+ VariantProps<typeof toggleVariants>) => {
const context = React.useContext(ToggleGroupContext);
return (
<ToggleGroupPrimitive.Item
- ref={ref}
className={cn(
toggleVariants({
variant: context.variant || variant,
@@ -50,8 +52,6 @@ const ToggleGroupItem = React.forwardRef<
{children}
</ToggleGroupPrimitive.Item>
);
-});
-
-ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
+};
export { ToggleGroup, ToggleGroupItem };
diff --git a/packages/ui/src/components/toggle.tsx b/packages/ui/src/components/toggle.tsx
index 979080e6..a453f952 100644
--- a/packages/ui/src/components/toggle.tsx
+++ b/packages/ui/src/components/toggle.tsx
@@ -27,16 +27,14 @@ const toggleVariants = cva(
},
);
-const Toggle = React.forwardRef<
- React.ComponentRef<typeof TogglePrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>
->(({ className, variant, size, ...props }, ref) => (
- <TogglePrimitive.Root
- ref={ref}
- className={cn(toggleVariants({ variant, size, className }))}
- {...props}
- />
-));
+const Toggle = ({
+ className,
+ variant,
+ size,
+ ...props
+}: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>) => (
+ <TogglePrimitive.Root className={cn(toggleVariants({ variant, size, className }))} {...props} />
+);
Toggle.displayName = TogglePrimitive.Root.displayName;
diff --git a/packages/ui/src/components/tooltip.tsx b/packages/ui/src/components/tooltip.tsx
index 83286c95..48949512 100644
--- a/packages/ui/src/components/tooltip.tsx
+++ b/packages/ui/src/components/tooltip.tsx
@@ -10,20 +10,19 @@ const Tooltip = TooltipPrimitive.Root;
const TooltipTrigger = TooltipPrimitive.Trigger;
-const TooltipContent = React.forwardRef<
- React.ComponentRef<typeof TooltipPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
->(({ className, sideOffset = 4, ...props }, ref) => (
+const TooltipContent = ({
+ className,
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof TooltipPrimitive.Content>) => (
<TooltipPrimitive.Content
className={cn(
'bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border px-3 py-1.5 text-sm shadow-md',
className,
)}
- ref={ref}
sideOffset={sideOffset}
{...props}
/>
-));
-TooltipContent.displayName = TooltipPrimitive.Content.displayName;
+);
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
diff --git a/packages/ui/src/components/year-selector.tsx b/packages/ui/src/components/year-selector.tsx
index 029487c6..1f80b263 100644
--- a/packages/ui/src/components/year-selector.tsx
+++ b/packages/ui/src/components/year-selector.tsx
@@ -59,10 +59,11 @@ export const YearSelector = (props: {
);
};
-const SelectItem = React.forwardRef<
- React.ComponentRef<typeof Select.Item>,
- React.ComponentPropsWithoutRef<typeof Select.Item>
->(({ children, className, ...props }, forwardedRef) => {
+const SelectItem = ({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<typeof Select.Item>) => {
return (
<Select.Item
className={cn(
@@ -71,10 +72,9 @@ const SelectItem = React.forwardRef<
className,
)}
{...props}
- ref={forwardedRef}
>
<Select.ItemText>{children}</Select.ItemText>
<Select.ItemIndicator className="absolute left-0 inline-flex w-[25px] items-center justify-center"></Select.ItemIndicator>
</Select.Item>
);
-});
+};