import * as React from 'react' ; import classNames from 'classnames/dedupe' ; import { Argument as ClassValue } from 'classnames' ; const defaultProps = { className : '' as ClassValue , type : 'text' , elementRef : React . createRef < HTMLInputElement > ( ) , } ; type InputControlProps = React . InputHTMLAttributes < HTMLInputElement > & typeof defaultProps ; type State = Record < string , unknown > ; class InputControl extends React . Component < InputControlProps , State > { public static defaultProps = defaultProps ; public render ( ) { const { className , type , elementRef , ... passthroughProps } = this . props ; const inputClassNames = [ 'form-control' , className ] ; if ( [ 'hidden' , 'range' ] . indexOf ( type ) !== - 1 ) { inputClassNames . push ( { 'form-control' : false } ) ; } if ( type === 'range' ) { inputClassNames . push ( 'custom-range' ) ; } return ( < input { ... passthroughProps } className = { classNames ( inputClassNames ) } ref = { elementRef } type = { type } / > ) ; } } export { InputControlProps } ; export default InputControl ;