@@ -9,25 +9,25 @@ export function Input(s: {
99 required ?: boolean ;
1010 disabled ?: boolean ;
1111 autofocus ?: boolean ;
12- className ?: string ;
13- onInput ?: ( e : Event ) => void ;
14- onFocus ?: ( e : FocusEvent ) => void ;
15- onBlur ?: ( e : FocusEvent ) => void ;
16- onKeyDown ?: ( e : KeyboardEvent ) => void ;
17- onKeyUp ?: ( e : KeyboardEvent ) => void ;
12+ class ?: string ;
13+ "on:input" ?: ( e : Event ) => void ;
14+ "on:focus" ?: ( e : FocusEvent ) => void ;
15+ "on:blur" ?: ( e : FocusEvent ) => void ;
16+ "on:keydown" ?: ( e : KeyboardEvent ) => void ;
17+ "on:keyup" ?: ( e : KeyboardEvent ) => void ;
1818} ) {
1919 const handleInput = ( e : Event ) => {
2020 // keep the original behavior: assign into the passed `value` (may be a Pointer)
2121 ( s . value as any ) = ( e . target as HTMLInputElement ) . value ;
2222
23- if ( s . onInput ) {
24- s . onInput ( e ) ;
23+ if ( s [ "on:input" ] ) {
24+ s [ "on:input" ] ( e ) ;
2525 }
2626 } ;
2727
2828 return (
29- < div class = { `input-container ${ s . className || "" } ` } >
30- { ( s . label as any ) && < label > { s . label } </ label > }
29+ < div class = { `input-container ${ s . class || "" } ` } >
30+ { s . label && < label > { s . label } </ label > }
3131 < input
3232 type = { s . type || "text" }
3333 value = { typeof s . value === "object" ? use ( s . value ) : s . value }
@@ -37,10 +37,10 @@ export function Input(s: {
3737 disabled = { s . disabled }
3838 autofocus = { s . autofocus }
3939 on :input = { handleInput }
40- on :focus = { s . onFocus as any }
41- on :blur = { s . onBlur as any }
42- on :keydown = { s . onKeyDown as any }
43- on :keyup = { s . onKeyUp as any }
40+ on :focus = { s [ "on:focus" ] as any }
41+ on :blur = { s [ "on:blur" ] as any }
42+ on :keydown = { s [ "on:keydown" ] as any }
43+ on :keyup = { s [ "on:keyup" ] as any }
4444 />
4545 </ div >
4646 ) ;
0 commit comments