diff --git a/examples/auth/src/app/(app)/_components/Gutter/index.tsx b/examples/auth/src/app/(app)/_components/Gutter/index.tsx index 3845a1a62f..8303e35cb9 100644 --- a/examples/auth/src/app/(app)/_components/Gutter/index.tsx +++ b/examples/auth/src/app/(app)/_components/Gutter/index.tsx @@ -1,6 +1,4 @@ -import type { Ref } from 'react' - -import React, { forwardRef } from 'react' +import React from 'react' import classes from './index.module.scss' @@ -8,12 +6,12 @@ type Props = { children: React.ReactNode className?: string left?: boolean - ref?: Ref + ref?: React.Ref right?: boolean } -export const Gutter: React.FC = forwardRef((props, ref) => { - const { children, className, left = true, right = true } = props +export const Gutter: React.FC }> = (props) => { + const { children, className, left = true, right = true, ref } = props return (
= forwardRef((props, {children}
) -}) - -Gutter.displayName = 'Gutter' +} diff --git a/examples/draft-preview/src/components/Gutter/index.tsx b/examples/draft-preview/src/components/Gutter/index.tsx index 3845a1a62f..8303e35cb9 100644 --- a/examples/draft-preview/src/components/Gutter/index.tsx +++ b/examples/draft-preview/src/components/Gutter/index.tsx @@ -1,6 +1,4 @@ -import type { Ref } from 'react' - -import React, { forwardRef } from 'react' +import React from 'react' import classes from './index.module.scss' @@ -8,12 +6,12 @@ type Props = { children: React.ReactNode className?: string left?: boolean - ref?: Ref + ref?: React.Ref right?: boolean } -export const Gutter: React.FC = forwardRef((props, ref) => { - const { children, className, left = true, right = true } = props +export const Gutter: React.FC }> = (props) => { + const { children, className, left = true, right = true, ref } = props return (
= forwardRef((props, {children}
) -}) - -Gutter.displayName = 'Gutter' +} diff --git a/examples/form-builder/src/components/Gutter/index.tsx b/examples/form-builder/src/components/Gutter/index.tsx index fa7da778e8..1156d8c434 100644 --- a/examples/form-builder/src/components/Gutter/index.tsx +++ b/examples/form-builder/src/components/Gutter/index.tsx @@ -1,6 +1,4 @@ -import type { Ref } from 'react' - -import React, { forwardRef } from 'react' +import React from 'react' import classes from './index.module.scss' @@ -8,12 +6,12 @@ type Props = { children: React.ReactNode className?: string left?: boolean - ref?: Ref + ref?: React.Ref right?: boolean } -export const Gutter: React.FC = forwardRef((props, ref) => { - const { children, className, left = true, right = true } = props +export const Gutter: React.FC }> = (props) => { + const { children, className, left = true, right = true, ref } = props return (
= forwardRef((props, {children}
) -}) - -Gutter.displayName = 'Gutter' +} diff --git a/examples/live-preview/src/app/(app)/_components/Gutter/index.tsx b/examples/live-preview/src/app/(app)/_components/Gutter/index.tsx index 3845a1a62f..8303e35cb9 100644 --- a/examples/live-preview/src/app/(app)/_components/Gutter/index.tsx +++ b/examples/live-preview/src/app/(app)/_components/Gutter/index.tsx @@ -1,6 +1,4 @@ -import type { Ref } from 'react' - -import React, { forwardRef } from 'react' +import React from 'react' import classes from './index.module.scss' @@ -8,12 +6,12 @@ type Props = { children: React.ReactNode className?: string left?: boolean - ref?: Ref + ref?: React.Ref right?: boolean } -export const Gutter: React.FC = forwardRef((props, ref) => { - const { children, className, left = true, right = true } = props +export const Gutter: React.FC }> = (props) => { + const { children, className, left = true, right = true, ref } = props return (
= forwardRef((props, {children}
) -}) - -Gutter.displayName = 'Gutter' +} diff --git a/examples/localization/src/components/ui/button.tsx b/examples/localization/src/components/ui/button.tsx index 5b7a65282e..78ef80b8e2 100644 --- a/examples/localization/src/components/ui/button.tsx +++ b/examples/localization/src/components/ui/button.tsx @@ -34,16 +34,19 @@ export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean + ref?: React.Ref } -const Button = React.forwardRef( - ({ asChild = false, className, size, variant, ...props }, ref) => { - const Comp = asChild ? Slot : 'button' - return ( - - ) - }, -) -Button.displayName = 'Button' +const Button: React.FC = ({ + asChild = false, + className, + size, + variant, + ref, + ...props +}) => { + const Comp = asChild ? Slot : 'button' + return +} export { Button, buttonVariants } diff --git a/examples/localization/src/components/ui/card.tsx b/examples/localization/src/components/ui/card.tsx index 5d7b80ed67..5a7e35a51f 100644 --- a/examples/localization/src/components/ui/card.tsx +++ b/examples/localization/src/components/ui/card.tsx @@ -1,56 +1,48 @@ -/* eslint-disable jsx-a11y/heading-has-content */ import { cn } from 'src/utilities/cn' import * as React from 'react' -const Card = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const Card: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -Card.displayName = 'Card' -const CardHeader = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const CardHeader: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -CardHeader.displayName = 'CardHeader' -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -

- ), +const CardTitle: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +

) -CardTitle.displayName = 'CardTitle' -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( +const CardDescription: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => (

-)) -CardDescription.displayName = 'CardDescription' - -const CardContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -

- ), ) -CardContent.displayName = 'CardContent' -const CardFooter = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const CardContent: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
+) + +const CardFooter: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -CardFooter.displayName = 'CardFooter' export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } diff --git a/examples/localization/src/components/ui/checkbox.tsx b/examples/localization/src/components/ui/checkbox.tsx index fe23eed55e..db07cad266 100644 --- a/examples/localization/src/components/ui/checkbox.tsx +++ b/examples/localization/src/components/ui/checkbox.tsx @@ -5,10 +5,11 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox' import { Check } from 'lucide-react' import * as React from 'react' -const Checkbox = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const Checkbox: React.FC< + { + ref?: React.Ref + } & React.ComponentProps +> = ({ className, ref, ...props }) => ( -)) -Checkbox.displayName = CheckboxPrimitive.Root.displayName +) export { Checkbox } diff --git a/examples/localization/src/components/ui/input.tsx b/examples/localization/src/components/ui/input.tsx index eb103a810b..b82e875724 100644 --- a/examples/localization/src/components/ui/input.tsx +++ b/examples/localization/src/components/ui/input.tsx @@ -1,23 +1,22 @@ import { cn } from 'src/utilities/cn' import * as React from 'react' -export interface InputProps extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ type, className, ...props }, ref) => { - return ( - - ) - }, -) -Input.displayName = 'Input' +const Input: React.FC< + { + ref?: React.Ref + } & React.InputHTMLAttributes +> = ({ type, className, ref, ...props }) => { + return ( + + ) +} export { Input } diff --git a/examples/localization/src/components/ui/label.tsx b/examples/localization/src/components/ui/label.tsx index da8a964c4e..0df4cf607b 100644 --- a/examples/localization/src/components/ui/label.tsx +++ b/examples/localization/src/components/ui/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.ElementRef, - React.ComponentPropsWithoutRef & VariantProps ->(({ className, ...props }, ref) => ( +const Label: React.FC< + { ref?: React.Ref } & React.ComponentProps & + VariantProps +> = ({ className, ref, ...props }) => ( -)) -Label.displayName = LabelPrimitive.Root.displayName +) export { Label } diff --git a/examples/localization/src/components/ui/pagination.tsx b/examples/localization/src/components/ui/pagination.tsx index d2e01e28f6..86b56931a6 100644 --- a/examples/localization/src/components/ui/pagination.tsx +++ b/examples/localization/src/components/ui/pagination.tsx @@ -1,11 +1,9 @@ -/* eslint-disable react/button-has-type */ import type { ButtonProps } from '@/components/ui/button' import { buttonVariants } from '@/components/ui/button' import { cn } from 'src/utilities/cn' import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react' import * as React from 'react' -import { useTranslations } from 'next-intl' const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (