@@ -51,35 +51,51 @@ export const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputWeb
5151 maxLength,
5252 multiline = false ,
5353 numberOfLines,
54+ inputProps,
5455 } ,
5556 ref
5657 ) {
5758 const [ isFocused , setIsFocused ] = useState ( false ) ;
5859
59- const handleFocus = useCallback ( ( ) => {
60- setIsFocused ( true ) ;
61- onFocus ?. ( ) ;
62- } , [ onFocus ] ) ;
60+ const userOnChange = inputProps ?. onChange ;
61+ const userOnKeyDown = inputProps ?. onKeyDown ;
62+ const userOnFocus = inputProps ?. onFocus ;
63+ const userOnBlur = inputProps ?. onBlur ;
6364
64- const handleBlur = useCallback ( ( ) => {
65- setIsFocused ( false ) ;
66- onBlur ?.( ) ;
67- } , [ onBlur ] ) ;
65+ const handleFocus = useCallback (
66+ ( e : React . FocusEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
67+ setIsFocused ( true ) ;
68+ onFocus ?.( ) ;
69+ ( userOnFocus as ( ( e : React . FocusEvent < HTMLInputElement | HTMLTextAreaElement > ) => void ) | undefined ) ?.( e ) ;
70+ } ,
71+ [ onFocus , userOnFocus ]
72+ ) ;
73+
74+ const handleBlur = useCallback (
75+ ( e : React . FocusEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
76+ setIsFocused ( false ) ;
77+ onBlur ?.( ) ;
78+ ( userOnBlur as ( ( e : React . FocusEvent < HTMLInputElement | HTMLTextAreaElement > ) => void ) | undefined ) ?.( e ) ;
79+ } ,
80+ [ onBlur , userOnBlur ]
81+ ) ;
6882
6983 const handleChange = useCallback (
7084 ( e : React . ChangeEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
7185 onChangeText ?.( e . currentTarget . value ) ;
86+ ( userOnChange as ( ( e : React . ChangeEvent < HTMLInputElement | HTMLTextAreaElement > ) => void ) | undefined ) ?.( e ) ;
7287 } ,
73- [ onChangeText ]
88+ [ onChangeText , userOnChange ]
7489 ) ;
7590
7691 const handleKeyDown = useCallback (
7792 ( e : React . KeyboardEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
7893 if ( e . key === 'Enter' && ! multiline && onSubmitEditing ) {
7994 onSubmitEditing ( ) ;
8095 }
96+ ( userOnKeyDown as ( ( e : React . KeyboardEvent < HTMLInputElement | HTMLTextAreaElement > ) => void ) | undefined ) ?.( e ) ;
8197 } ,
82- [ multiline , onSubmitEditing ]
98+ [ multiline , onSubmitEditing , userOnKeyDown ]
8399 ) ;
84100
85101 // Get variant styles
@@ -117,8 +133,13 @@ export const Input = forwardRef<HTMLInputElement | HTMLTextAreaElement, InputWeb
117133 color : placeholderColor ,
118134 } ;
119135
120- // Common props for input/textarea
136+ // Common props for input/textarea.
137+ // `inputProps` is spread first so user-provided pass-through props
138+ // (onPaste, onCompositionStart, data-*, aria-*, ...) apply, then internal
139+ // props/handlers override to keep variant behavior intact. The four
140+ // chained handlers above already invoke the user-supplied versions.
121141 const commonProps = {
142+ ...inputProps ,
122143 placeholder,
123144 value,
124145 defaultValue,
0 commit comments