From 39e5ac197fe54c3555cd74f957c270e69ac4ecd2 Mon Sep 17 00:00:00 2001 From: Rodolphe Stoclin Date: Tue, 17 Dec 2024 14:16:43 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Replace=20deprecated=20`El?= =?UTF-8?q?ementRef`=20by=20`ComponentRef`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/common/component/Command/index.tsx | 16 ++++++++-------- .../module/common/component/Popover/index.tsx | 4 ++-- .../module/common/component/Separator/index.tsx | 4 ++-- .../dashboard/src/module/forms/Form/index.tsx | 6 +++--- .../dashboard/src/module/forms/Label/index.tsx | 4 ++-- .../src/module/forms/RadioGroup/index.tsx | 6 +++--- .../dashboard/src/module/forms/Select/index.tsx | 16 ++++++++-------- .../dashboard/src/module/forms/Switch/index.tsx | 4 ++-- .../shared/module/component/Accordion/index.tsx | 8 ++++---- .../shared/module/component/Spinner/index.tsx | 4 ++-- .../shared/module/component/Switch/index.tsx | 4 ++-- .../shared/module/component/Tooltip/index.tsx | 4 ++-- .../module/component/forms/Checkbox/index.tsx | 4 ++-- .../app/module/common/component/Drawer/index.tsx | 10 +++++----- 14 files changed, 47 insertions(+), 47 deletions(-) diff --git a/packages/dashboard/src/module/common/component/Command/index.tsx b/packages/dashboard/src/module/common/component/Command/index.tsx index a7bc44b7e..817610fd3 100644 --- a/packages/dashboard/src/module/common/component/Command/index.tsx +++ b/packages/dashboard/src/module/common/component/Command/index.tsx @@ -3,11 +3,11 @@ import { Command as CommandPrimitive } from "cmdk"; import { Search } from "lucide-react"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; const Command = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => (
@@ -35,7 +35,7 @@ const CommandInput = forwardRef< CommandInput.displayName = CommandPrimitive.Input.displayName; const CommandList = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >((props, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( diff --git a/packages/dashboard/src/module/common/component/Separator/index.tsx b/packages/dashboard/src/module/common/component/Separator/index.tsx index 5b5f2dcd4..cf477995d 100644 --- a/packages/dashboard/src/module/common/component/Separator/index.tsx +++ b/packages/dashboard/src/module/common/component/Separator/index.tsx @@ -2,11 +2,11 @@ import { Root } from "@radix-ui/react-separator"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; export const Separator = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >( ( diff --git a/packages/dashboard/src/module/forms/Form/index.tsx b/packages/dashboard/src/module/forms/Form/index.tsx index c334d9b15..a7bb30dca 100644 --- a/packages/dashboard/src/module/forms/Form/index.tsx +++ b/packages/dashboard/src/module/forms/Form/index.tsx @@ -5,7 +5,7 @@ import { type VariantProps, cva, cx } from "class-variance-authority"; import { createContext, forwardRef, useContext, useId } from "react"; import type { ComponentPropsWithoutRef, - ElementRef, + ComponentRef, HTMLAttributes, ReactNode, } from "react"; @@ -129,7 +129,7 @@ export const formLabelVariants = cva(styles.form__label, { }); const FormLabel = forwardRef< - ElementRef, + ComponentRef, FormLabelProps >(({ variant, selected, weight, className, ...props }, ref) => { const { error, formItemId } = useFormField(); @@ -152,7 +152,7 @@ const FormLabel = forwardRef< FormLabel.displayName = "FormLabel"; const FormControl = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ ...props }, ref) => { const { error, formItemId, formDescriptionId, formMessageId } = diff --git a/packages/dashboard/src/module/forms/Label/index.tsx b/packages/dashboard/src/module/forms/Label/index.tsx index 6116b4e53..ce5378f73 100644 --- a/packages/dashboard/src/module/forms/Label/index.tsx +++ b/packages/dashboard/src/module/forms/Label/index.tsx @@ -3,13 +3,13 @@ import { Root } from "@radix-ui/react-label"; import { type VariantProps, cva } from "class-variance-authority"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; const labelVariants = cva(styles.label); const Label = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef & VariantProps >(({ className, ...props }, ref) => ( diff --git a/packages/dashboard/src/module/forms/RadioGroup/index.tsx b/packages/dashboard/src/module/forms/RadioGroup/index.tsx index 1a643fa9d..03ac24230 100644 --- a/packages/dashboard/src/module/forms/RadioGroup/index.tsx +++ b/packages/dashboard/src/module/forms/RadioGroup/index.tsx @@ -2,11 +2,11 @@ import { Indicator, Item, Root } from "@radix-ui/react-radio-group"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; const RadioGroup = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => { return ( @@ -20,7 +20,7 @@ const RadioGroup = forwardRef< RadioGroup.displayName = Root.displayName; const RadioGroupItem = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => { return ( diff --git a/packages/dashboard/src/module/forms/Select/index.tsx b/packages/dashboard/src/module/forms/Select/index.tsx index 0bf060307..9b1b28843 100644 --- a/packages/dashboard/src/module/forms/Select/index.tsx +++ b/packages/dashboard/src/module/forms/Select/index.tsx @@ -5,7 +5,7 @@ import { cva } from "class-variance-authority"; import type { VariantProps } from "class-variance-authority"; import { Check, ChevronDown, ChevronUp } from "lucide-react"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; const Select = SelectPrimitive.Root; @@ -28,7 +28,7 @@ export interface SelectTriggerProps VariantProps {} const SelectTrigger = forwardRef< - ElementRef, + ComponentRef, SelectTriggerProps >(({ length, className = "", children, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", children, position = "popper", ...props }, ref) => ( @@ -97,7 +97,7 @@ const SelectContent = forwardRef< SelectContent.displayName = SelectPrimitive.Content.displayName; const SelectLabel = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", children, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( diff --git a/packages/shared/module/component/Accordion/index.tsx b/packages/shared/module/component/Accordion/index.tsx index 1a6d83180..5db9379d2 100644 --- a/packages/shared/module/component/Accordion/index.tsx +++ b/packages/shared/module/component/Accordion/index.tsx @@ -2,7 +2,7 @@ import * as AccordionPrimitive from "@radix-ui/react-accordion"; import { ChevronDown } from "lucide-react"; import { type ComponentPropsWithoutRef, - type ElementRef, + type ComponentRef, forwardRef, } from "react"; import styles from "./index.module.css"; @@ -10,7 +10,7 @@ import styles from "./index.module.css"; const Accordion = AccordionPrimitive.Root; const AccordionItem = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className = "", ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className = "", children, ...props }, ref) => ( @@ -41,7 +41,7 @@ const AccordionTrigger = forwardRef< AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; const AccordionContent = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef & { classNameText?: string; } diff --git a/packages/shared/module/component/Spinner/index.tsx b/packages/shared/module/component/Spinner/index.tsx index e8500b2cb..91e656cb9 100644 --- a/packages/shared/module/component/Spinner/index.tsx +++ b/packages/shared/module/component/Spinner/index.tsx @@ -1,9 +1,9 @@ import { cx } from "class-variance-authority"; import { forwardRef } from "react"; -import type { ElementRef, HTMLAttributes } from "react"; +import type { ComponentRef, HTMLAttributes } from "react"; import styles from "./index.module.css"; -type SpinnerElement = ElementRef<"span">; +type SpinnerElement = ComponentRef<"span">; interface SpinnerProps extends HTMLAttributes { className?: string; } diff --git a/packages/shared/module/component/Switch/index.tsx b/packages/shared/module/component/Switch/index.tsx index 5fef881ba..c22857b44 100644 --- a/packages/shared/module/component/Switch/index.tsx +++ b/packages/shared/module/component/Switch/index.tsx @@ -1,10 +1,10 @@ import { Root, Thumb } from "@radix-ui/react-switch"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; export const Switch = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( diff --git a/packages/shared/module/component/Tooltip/index.tsx b/packages/shared/module/component/Tooltip/index.tsx index 3b836001f..fa8b2c201 100644 --- a/packages/shared/module/component/Tooltip/index.tsx +++ b/packages/shared/module/component/Tooltip/index.tsx @@ -7,7 +7,7 @@ import { Trigger, } from "@radix-ui/react-tooltip"; import { forwardRef } from "react"; -import type { ElementRef, ReactNode } from "react"; +import type { ComponentRef, ReactNode } from "react"; import styles from "./index.module.css"; type TooltipProps = { @@ -18,7 +18,7 @@ type TooltipProps = { side?: "top" | "bottom" | "left" | "right"; }; -export const Tooltip = forwardRef, TooltipProps>( +export const Tooltip = forwardRef, TooltipProps>( ( { content, hidden = false, className = "", children, side, ...props }, ref diff --git a/packages/shared/module/component/forms/Checkbox/index.tsx b/packages/shared/module/component/forms/Checkbox/index.tsx index b62cd3d67..65275f739 100644 --- a/packages/shared/module/component/forms/Checkbox/index.tsx +++ b/packages/shared/module/component/forms/Checkbox/index.tsx @@ -3,11 +3,11 @@ import { Indicator, Root } from "@radix-ui/react-checkbox"; import { Check, Minus } from "lucide-react"; import { forwardRef } from "react"; -import type { ComponentPropsWithoutRef, ElementRef } from "react"; +import type { ComponentPropsWithoutRef, ComponentRef } from "react"; import styles from "./index.module.css"; export const Checkbox = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ ...props }, ref) => { return ( diff --git a/packages/wallet/app/module/common/component/Drawer/index.tsx b/packages/wallet/app/module/common/component/Drawer/index.tsx index d071f3adb..2315f1f7b 100644 --- a/packages/wallet/app/module/common/component/Drawer/index.tsx +++ b/packages/wallet/app/module/common/component/Drawer/index.tsx @@ -2,7 +2,7 @@ import { prefixDrawerCss } from "@module/utils/prefixDrawerCss"; import { type ComponentProps, type ComponentPropsWithoutRef, - type ElementRef, + type ComponentRef, type HTMLAttributes, forwardRef, } from "react"; @@ -27,7 +27,7 @@ const DrawerPortal = DrawerPrimitive.Portal; // const DrawerClose = DrawerPrimitive.Close; const DrawerOverlay = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + ComponentRef, ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( @@ -79,7 +79,7 @@ const DrawerFooter = ({ DrawerFooter.displayName = "DrawerFooter"; const DrawerTitle = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( @@ -87,7 +87,7 @@ const DrawerTitle = forwardRef< DrawerTitle.displayName = DrawerPrimitive.Title.displayName; const DrawerDescription = forwardRef< - ElementRef, + ComponentRef, ComponentPropsWithoutRef >(({ className, ...props }, ref) => (