@@ -8,13 +8,15 @@ type NumberInputWrapperProps = {
88 onBlur ?: ( blurValue : number | undefined ) => void ;
99 onChange ?: ( newValue : number | undefined ) => void ;
1010 intOnly ?: boolean ;
11+ increment ?: number ;
1112 fullWidth ?: boolean ;
1213} & Omit < React . ComponentProps < typeof NumberInput > , 'onChange' | 'onPlus' | 'onMinus' > ;
1314
1415const NumberInputWrapper : React . FC < NumberInputWrapperProps > = ( {
1516 onBlur,
1617 onChange,
1718 intOnly = true ,
19+ increment = 1 ,
1820 fullWidth = false ,
1921 value,
2022 validated,
@@ -23,7 +25,7 @@ const NumberInputWrapper: React.FC<NumberInputWrapperProps> = ({
2325 ...otherProps
2426} ) => (
2527 < NumberInput
26- className = { fullWidth ? 'odh-number-input-wrapper m-full-width' : undefined }
28+ className = { fullWidth ? 'odh-number-input-wrapper m-full-width' : 'odh-number-input-wrapper' }
2729 inputProps = { { placeholder : '' } }
2830 inputName = "value-unit-input"
2931 { ...otherProps }
@@ -43,10 +45,10 @@ const NumberInputWrapper: React.FC<NumberInputWrapperProps> = ({
4345 onChange ( undefined ) ;
4446 return ;
4547 }
46- if ( min ) {
48+ if ( min != null ) {
4749 v = Math . max ( v , min ) ;
4850 }
49- if ( max ) {
51+ if ( max != null ) {
5052 v = Math . min ( v , max ) ;
5153 }
5254 onChange ( v ) ;
@@ -64,16 +66,16 @@ const NumberInputWrapper: React.FC<NumberInputWrapperProps> = ({
6466 onPlus = {
6567 onChange
6668 ? ( ) => {
67- const newVal = ( value || 0 ) + 1 ;
68- onChange ( min ? Math . max ( newVal , min ) : newVal ) ;
69+ const newVal = ( value || 0 ) + increment ;
70+ onChange ( max != null ? Math . min ( newVal , max ) : newVal ) ;
6971 }
7072 : undefined
7173 }
7274 onMinus = {
7375 onChange
7476 ? ( ) => {
75- const newVal = ( value || 0 ) - 1 ;
76- onChange ( max ? Math . min ( newVal , max ) : newVal ) ;
77+ const newVal = ( value || 0 ) - increment ;
78+ onChange ( min != null ? Math . max ( newVal , min ) : newVal ) ;
7779 }
7880 : undefined
7981 }
0 commit comments