From a6b74ea37a3436c9a3a7b21eee415c0d5543791e Mon Sep 17 00:00:00 2001 From: Akshay Mishra Date: Mon, 5 Jan 2026 23:47:05 +0530 Subject: [PATCH] Allow step='any' in NumericInput --- uui-components/src/inputs/NumericInput.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/uui-components/src/inputs/NumericInput.tsx b/uui-components/src/inputs/NumericInput.tsx index f4656ce23a..71071fc899 100644 --- a/uui-components/src/inputs/NumericInput.tsx +++ b/uui-components/src/inputs/NumericInput.tsx @@ -32,7 +32,7 @@ export interface NumericInputProps downIcon?: Icon; /** Increase/decrease step on up/down icons clicks and up/down arrow keys */ - step?: number; + step?: number | 'any'; /** CSS classes to put directly on the Input element */ inputCx?: CX; @@ -90,6 +90,7 @@ export const NumericInput = React.forwardRef( const min = initialMin ?? 0; const max = initialMax ?? Number.MAX_SAFE_INTEGER; const formatOptions = initialFormatOptions ?? { maximumFractionDigits: 0 }; + const stepValue = step === 'any' ? 1 : step ?? 1; const placeholderValue = React.useMemo(() => { if (typeof value === 'number') { @@ -144,13 +145,13 @@ export const NumericInput = React.forwardRef( }; const handleIncreaseValue = () => { - let newValue = getCalculatedValue({ value, step, action: 'incr' }); + let newValue = getCalculatedValue({ value, step: stepValue, action: 'incr' }); newValue = getMinMaxValidatedValue({ value: newValue, min, max }); props.onValueChange(newValue); }; const handleDecreaseValue = () => { - let newValue = getCalculatedValue({ value, step, action: 'decr' }); + let newValue = getCalculatedValue({ value, step: stepValue, action: 'decr' }); newValue = getMinMaxValidatedValue({ value: newValue, min, max }); props.onValueChange(newValue); }; @@ -227,7 +228,7 @@ export const NumericInput = React.forwardRef( onBlur={ handleBlur } min={ min } max={ max } - step={ step || 'any' } + step={ step === undefined ? 'any' : step } id={ props.id } ref={ inputRef } />