Refactor:upgrade react19 ref as props (#25225)

Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
zyileven
2025-09-08 09:46:02 +08:00
committed by GitHub
parent 27bf244b3b
commit 98204d78fb
8 changed files with 83 additions and 78 deletions

View File

@@ -30,9 +30,10 @@ export type InputProps = {
wrapperClassName?: string
styleCss?: CSSProperties
unit?: string
ref?: React.Ref<HTMLInputElement>
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & VariantProps<typeof inputVariants>
const Input = React.forwardRef<HTMLInputElement, InputProps>(({
const Input = ({
size,
disabled,
destructive,
@@ -46,8 +47,9 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
placeholder,
onChange = noop,
unit,
ref,
...props
}, ref) => {
}: InputProps) => {
const { t } = useTranslation()
return (
<div className={cn('relative w-full', wrapperClassName)}>
@@ -93,7 +95,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
}
</div>
)
})
}
Input.displayName = 'Input'