fix(number-input): only allow number type (#5368)

* refactor(number-input): avoid non number type passing to number input

* chore(changeset): add changeset
This commit is contained in:
WK 2025-06-09 14:17:06 +08:00 committed by GitHub
parent f1abe161b1
commit ad807bec7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@heroui/number-input": patch
---
avoid non number type passing to NumberInput

View File

@ -5,7 +5,9 @@ import {forwardRef} from "@heroui/system";
import {UseNumberInputProps, useNumberInput} from "./use-number-input";
import NumberInputStepper from "./number-input-stepper";
export interface NumberInputProps extends UseNumberInputProps {}
export interface NumberInputProps extends Omit<UseNumberInputProps, "type"> {
type?: "number";
}
const NumberInput = forwardRef<"input", NumberInputProps>((props, ref) => {
const {

View File

@ -99,6 +99,7 @@ export function useNumberInput(originalProps: UseNumberInputProps) {
const {
ref,
as,
type,
label,
baseRef,
wrapperRef,
@ -539,6 +540,7 @@ export function useNumberInput(originalProps: UseNumberInputProps) {
return {
Component,
classNames,
type,
domRef,
label,
description,