File tree Expand file tree Collapse file tree
packages/react-core/src/components/NumberInput Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,8 +67,10 @@ const defaultKeyDownHandler = (args: DefaultKeyDownHandlerArgs) => (event: React
6767 }
6868} ;
6969
70+ const DEFAULT_VALUE = 0 ;
71+
7072export const NumberInput : React . FunctionComponent < NumberInputProps > = ( {
71- value = 0 ,
73+ value = DEFAULT_VALUE ,
7274 className,
7375 widthChars,
7476 isDisabled = false ,
@@ -121,7 +123,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
121123 < Button
122124 variant = "control"
123125 aria-label = { minusBtnAriaLabel }
124- isDisabled = { isDisabled || value <= min }
126+ isDisabled = { isDisabled || ( typeof value === 'number' ? value : DEFAULT_VALUE ) <= min }
125127 onClick = { ( evt ) => onMinus ( evt , inputName ) }
126128 { ...minusBtnProps }
127129 >
@@ -149,7 +151,7 @@ export const NumberInput: React.FunctionComponent<NumberInputProps> = ({
149151 < Button
150152 variant = "control"
151153 aria-label = { plusBtnAriaLabel }
152- isDisabled = { isDisabled || value >= max }
154+ isDisabled = { isDisabled || ( typeof value === 'number' ? value : DEFAULT_VALUE ) >= max }
153155 onClick = { ( evt ) => onPlus ( evt , inputName ) }
154156 { ...plusBtnProps }
155157 >
You can’t perform that action at this time.
0 commit comments