1- import { forwardRef , RefObject , useRef } from 'react' ;
1+ import { ForwardedRef , forwardRef , RefObject , useRef } from 'react' ;
22import { useLocale , useNumberField , AriaNumberFieldProps } from 'react-aria' ;
33import { useNumberFieldState } from 'react-stately' ;
44
@@ -36,7 +36,10 @@ const StepperContainer = tasty({
3636 } ,
3737} ) ;
3838
39- function NumberInput ( props : WithNullableValue < CubeNumberInputProps > , ref ) {
39+ function NumberInput (
40+ props : WithNullableValue < CubeNumberInputProps > ,
41+ ref : ForwardedRef < HTMLElement > ,
42+ ) {
4043 props = castNullableNumberValue ( props ) ;
4144 props = useProviderProps ( props ) ;
4245 props = useFieldProps ( props ) ;
@@ -53,9 +56,9 @@ function NumberInput(props: WithNullableValue<CubeNumberInputProps>, ref) {
5356 let showStepper = ! hideStepper ;
5457 let { locale } = useLocale ( ) ;
5558 let state = useNumberFieldState ( { ...props , locale } ) ;
56- let defaultInputRef = useRef ( null ) ;
59+ let localInputRef = useRef < HTMLInputElement > ( null ) ;
5760
58- inputRef = inputRef || defaultInputRef ;
61+ inputRef = inputRef ?? localInputRef ;
5962
6063 let {
6164 groupProps,
@@ -113,7 +116,7 @@ function NumberInput(props: WithNullableValue<CubeNumberInputProps>, ref) {
113116}
114117
115118/**
116- * NumberFields allow users to enter a number, and increment or decrement the value using stepper buttons.
119+ * NumberFields allow users to enter a number and increment or decrement the value using stepper buttons.
117120 */
118121const _NumberInput = forwardRef ( NumberInput ) ;
119122
0 commit comments