@@ -20,6 +20,7 @@ export const StakeInput = ({
2020} : StakeInputProps ) => {
2121 const [ value , setValue ] = useState ( stakeAmount ) ;
2222 const inputRef = useRef < HTMLInputElement > ( null ) ;
23+ const [ isFocused , setIsFocused ] = useState ( false ) ;
2324
2425 // Immediate value clamping with cleanup
2526 const handleValueChange = useCallback (
@@ -56,6 +57,7 @@ export const StakeInput = ({
5657
5758 useEffect ( ( ) => {
5859 const input = inputRef . current ;
60+ if ( ! isFocused ) return ;
5961 input ?. addEventListener ( "wheel" , handleWheel , { passive : false } ) ;
6062 return ( ) => input ?. removeEventListener ( "wheel" , handleWheel ) ;
6163 } , [ handleWheel ] ) ;
@@ -64,9 +66,19 @@ export const StakeInput = ({
6466 < div className = "flex items-center justify-between" >
6567 < NumericFormat
6668 getInputRef = { inputRef }
67- value = { value }
69+ value = { Number ( value . toFixed ( 5 ) ) }
6870 onValueChange = { ( { floatValue = 0 } ) => handleValueChange ( floatValue ) }
6971 isAllowed = { ( { floatValue = 0 } ) => floatValue >= 0 && floatValue <= maxAmount }
72+ onWheel = { ( e : React . WheelEvent < HTMLInputElement > ) => {
73+ if ( ! isFocused ) return ;
74+ e . preventDefault ( ) ;
75+ const stepSize = Math . floor ( ( maxAmount / 10 ) * 100000 ) / 100000 ; // 5 decimal precision
76+ const delta = e . deltaY < 0 ? stepSize : - stepSize ;
77+ const newValue = Math . min ( Math . max ( value + delta , 0 ) , maxAmount ) ;
78+ handleValueChange ( newValue ) ;
79+ } }
80+ onFocus = { ( ) => setIsFocused ( true ) }
81+ onBlur = { ( ) => setIsFocused ( false ) }
7082 allowNegative = { false }
7183 decimalScale = { 100 }
7284 max = { maxAmount }
0 commit comments