@@ -28,16 +28,19 @@ declare global {
28
28
}
29
29
}
30
30
}
31
+ export type JBDateInputEventType < T > = T & {
32
+ target : JBDateInputWebComponent
33
+ }
31
34
export type JBDateInputProps = {
32
35
label ?: string ,
33
36
name ?:string ,
34
37
min ?: string ,
35
38
max ?: string ,
36
39
format ?: string ,
37
40
className ?:string ,
38
- onKeyup ?: ( e :KeyboardEvent ) => void ,
39
- onChange ?: ( e :Event ) => void ,
40
- onSelect ?: ( e :CustomEvent ) => void ,
41
+ onKeyup ?: ( e :JBDateInputEventType < KeyboardEvent > ) => void ,
42
+ onChange ?: ( e :JBDateInputEventType < Event > ) => void ,
43
+ onSelect ?: ( e :JBDateInputEventType < CustomEvent > ) => void ,
41
44
valueType ?: 'GREGORIAN' | 'JALALI' | 'TIME_STAMP' ,
42
45
inputType ?: 'GREGORIAN' | 'JALALI' ,
43
46
direction ?: 'ltr' | 'rtl' ,
@@ -61,17 +64,17 @@ export const JBDateInput = React.forwardRef((props: JBDateInputProps, ref) => {
61
64
useEffect ( ( ) => {
62
65
refChangeCountSetter ( refChangeCount + 1 ) ;
63
66
} , [ element . current ] ) ;
64
- const onchange = useCallback ( ( e ) => {
67
+ const onchange = useCallback ( ( e : JBDateInputEventType < Event > ) => {
65
68
if ( props . onChange ) {
66
69
props . onChange ( e ) ;
67
70
}
68
71
} , [ props . onChange ] ) ;
69
- const onKeyup = useCallback ( ( e ) => {
72
+ const onKeyup = useCallback ( ( e : JBDateInputEventType < KeyboardEvent > ) => {
70
73
if ( props . onKeyup ) {
71
74
props . onKeyup ( e ) ;
72
75
}
73
76
} , [ props . onKeyup ] ) ;
74
- const onSelect = useCallback ( ( e ) => {
77
+ const onSelect = useCallback ( ( e : JBDateInputEventType < CustomEvent > ) => {
75
78
if ( props . onSelect ) {
76
79
props . onSelect ( e ) ;
77
80
}
0 commit comments