@@ -4,17 +4,16 @@ import { type ElementRef } from 'react';
44import { jsx } from '@emotion/core' ;
55import AutosizeInput from 'react-input-autosize' ;
66
7- import type { PropsWithStyles , ClassNamesState } from '../types' ;
7+ import type { CommonProps } from '../types' ;
8+ import { cleanCommonProps } from '../utils' ;
89
9- export type InputProps = PropsWithStyles & {
10- cx : ( ?ClassNamesState , ?string ) => string | void ,
10+ export type InputProps = CommonProps & {
1111 /** Reference to the internal element */
1212 innerRef : ( ElementRef < * > ) => void ,
1313 /** Set whether the input should be visible. Does not affect input size. */
1414 isHidden : boolean ,
1515 /** Whether the input is disabled */
1616 isDisabled ? : boolean ,
17- className ? : string ,
1817 /** The ID of the form that the input belongs to */
1918 form ? : string ,
2019} ;
@@ -40,26 +39,23 @@ const inputStyle = isHidden => ({
4039 color : 'inherit' ,
4140} ) ;
4241
43- const Input = ( {
44- className,
45- cx,
46- getStyles,
47- innerRef,
48- isHidden,
49- isDisabled,
50- theme,
51- selectProps,
52- ...props
53- } : InputProps ) => (
54- < div css = { getStyles ( 'input' , { theme, ...props } ) } >
55- < AutosizeInput
56- className = { cx ( { input : true } , className ) }
57- inputRef = { innerRef }
58- inputStyle = { inputStyle ( isHidden ) }
59- disabled = { isDisabled }
60- { ...props }
61- />
62- </ div >
63- ) ;
42+ const Input = ( props : InputProps ) => {
43+ const { className, cx, getStyles } = props ;
44+ const { innerRef, isDisabled, isHidden, ...innerProps } = cleanCommonProps (
45+ props
46+ ) ;
47+
48+ return (
49+ < div css = { getStyles ( 'input' , props ) } >
50+ < AutosizeInput
51+ className = { cx ( { input : true } , className ) }
52+ inputRef = { innerRef }
53+ inputStyle = { inputStyle ( isHidden ) }
54+ disabled = { isDisabled }
55+ { ...innerProps }
56+ />
57+ </ div >
58+ ) ;
59+ } ;
6460
6561export default Input ;
0 commit comments