99 RefObject ,
1010 KeyboardEventHandler ,
1111 MouseEventHandler ,
12- useMemo ,
1312} from 'react'
1413import styled , { css , useTheme } from 'styled-components'
1514
@@ -22,7 +21,7 @@ import { VisibilityIcon, NotVisibilityIcon, ErrorIcon } from './icons'
2221
2322type BaseElement = HTMLInputElement
2423type BaseProps = InputHTMLAttributes < BaseElement >
25- export type NumberInputType = number | string | ''
24+ export type NumberInputType = number | ''
2625export type InputChangeHandler = ChangeEventHandler < BaseElement >
2726export type InputValueChangeHandler < T > = ( value : T ) => void
2827export type TextInputWidth = 'small' | 'medium' | 'large' | 'full'
@@ -469,36 +468,9 @@ export const TextInput: FC<TextInputProps> = props => (
469468)
470469
471470export interface NumberInputProps extends BaseInputProps < NumberInputType > { }
472- export const NumberInput : FC < NumberInputProps > = ( {
473- value,
474- step,
475- ...props
476- } ) => {
477- const decimalValue = useMemo ( ( ) => {
478- if ( step === undefined ) {
479- return 0
480- }
481- const [ _ , decimals ] = step . toString ( ) . split ( '.' ) as [
482- string ,
483- string | undefined
484- ]
485-
486- return decimals ?. length ?? 0
487- } , [ step ] )
488-
489- return (
490- < Input
491- value = {
492- step !== undefined && value !== ''
493- ? parseFloat ( value . toString ( ) ) . toFixed ( decimalValue )
494- : value
495- }
496- step = { step }
497- { ...props }
498- type = "number"
499- />
500- )
501- }
471+ export const NumberInput : FC < NumberInputProps > = props => (
472+ < Input { ...props } type = "number" />
473+ )
502474
503475export interface TextInputCredentialsProps extends BaseInputProps < string > {
504476 readonly type : TextInputCredentialsType
0 commit comments