File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/react-core/src/components/NumberInput Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,10 @@ const defaultKeyDownHandler = (args: DefaultKeyDownHandlerArgs) => (event: React
67
67
}
68
68
} ;
69
69
70
+ const DEFAULT_VALUE = 0 ;
71
+
70
72
export const NumberInput : React . FunctionComponent < NumberInputProps > = ( {
71
- value = 0 ,
73
+ value = DEFAULT_VALUE ,
72
74
className,
73
75
widthChars,
74
76
isDisabled = false ,
@@ -121,7 +123,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
121
123
< Button
122
124
variant = "control"
123
125
aria-label = { minusBtnAriaLabel }
124
- isDisabled = { isDisabled || value <= min }
126
+ isDisabled = { isDisabled || ( typeof value === 'number' ? value : DEFAULT_VALUE ) <= min }
125
127
onClick = { ( evt ) => onMinus ( evt , inputName ) }
126
128
{ ...minusBtnProps }
127
129
>
@@ -149,7 +151,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
149
151
< Button
150
152
variant = "control"
151
153
aria-label = { plusBtnAriaLabel }
152
- isDisabled = { isDisabled || value >= max }
154
+ isDisabled = { isDisabled || ( typeof value === 'number' ? value : DEFAULT_VALUE ) >= max }
153
155
onClick = { ( evt ) => onPlus ( evt , inputName ) }
154
156
{ ...plusBtnProps }
155
157
>
You can’t perform that action at this time.
0 commit comments