fix: improve email code sign-in experience (#28307)

This commit is contained in:
lyzno1
2025-11-20 11:19:15 +08:00
committed by GitHub
parent 6be013e072
commit e8d03a422d
4 changed files with 55 additions and 17 deletions

View File

@@ -32,12 +32,11 @@ export type InputProps = {
wrapperClassName?: string
styleCss?: CSSProperties
unit?: string
ref?: React.Ref<HTMLInputElement>
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & VariantProps<typeof inputVariants>
const removeLeadingZeros = (value: string) => value.replace(/^(-?)0+(?=\d)/, '$1')
const Input = ({
const Input = React.forwardRef<HTMLInputElement, InputProps>(({
size,
disabled,
destructive,
@@ -53,9 +52,8 @@ const Input = ({
onChange = noop,
onBlur = noop,
unit,
ref,
...props
}: InputProps) => {
}, ref) => {
const { t } = useTranslation()
const handleNumberChange: ChangeEventHandler<HTMLInputElement> = (e) => {
if (value === 0) {
@@ -135,7 +133,7 @@ const Input = ({
}
</div>
)
}
})
Input.displayName = 'Input'