Skip to content

Commit bfb64e5

Browse files
committed
types
1 parent 27f7e89 commit bfb64e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/forms/uncontrolled/inputTypes.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ const RangeInputWrapper = styled(FormInputWrapper)`
292292
`;
293293
type RangeProps = React.ComponentPropsWithoutRef<'input'> & InputProps & {
294294
wrapperProps?: React.ComponentPropsWithoutRef<'label'>;
295-
onChangeValue?: (value: number) => void;
295+
onChangeValue?: (value: number | undefined) => void;
296296
labels?: {value: number; label: string}[];
297297
};
298298
export const RangeInput = ({label, help, wrapperProps, onChangeValue, labels, ...props}: RangeProps) => {
@@ -303,8 +303,8 @@ export const RangeInput = ({label, help, wrapperProps, onChangeValue, labels, ..
303303
<input type="range" {...props}
304304
list={labels && labels.length > 0 ? datalistId : undefined}
305305
onChange={e => {
306-
const newValue = Number(e.target.value);
307-
onChangeValue?.(newValue);
306+
const newValue = parseFloat(e.target.value);
307+
onChangeValue?.(isNaN(newValue) ? undefined : newValue);
308308
props.onChange?.(e);
309309
}}
310310
/>

0 commit comments

Comments
 (0)