1
- import React , { ReactNode , FunctionComponent } from 'react' ;
1
+ import React , { FunctionComponent } from 'react' ;
2
2
export type Callback = ( instance : Instance ) => void ;
3
3
/**
4
4
* - ready function accepts a callback as its parameter and executes it as soon as Tabs get mounted.
@@ -8,12 +8,32 @@ export type Callback = (instance: Instance) => void;
8
8
* - ready function can be executed multiple times and its identity is stable and won’t change on re-renders.
9
9
*/
10
10
export type Ready = ( callback : Callback ) => void ;
11
+ export interface TabProps {
12
+ 'tab-id' : string ;
13
+ className : string ;
14
+ title : string ;
15
+ tabIndex : number ;
16
+ id ?: string ;
17
+ role ?: string ;
18
+ }
19
+ export interface IconProps {
20
+ className : string ;
21
+ role : string ;
22
+ }
23
+ export interface TabComponentProps {
24
+ id : string ;
25
+ isSelected : boolean ;
26
+ api : Instance ;
27
+ tabProps : TabProps ;
28
+ iconProps ?: IconProps ;
29
+ }
11
30
export interface Options {
12
31
/** * default value is "ltr"*/
13
32
direction ?: 'rtl' | 'ltr' ;
14
- defaultPanelComponent ?: ( ) => ReactNode | null ;
15
- tabComponent ?: ( props : any ) => ReactNode ;
16
- selectedTabID ?: string ; tabs ?: Array < TabData > ;
33
+ defaultPanelComponent ?: ( ) => FunctionComponent < { id : string , isSelected : boolean , api : Instance } > | null ;
34
+ tabComponent ?: FunctionComponent < TabComponentProps > ;
35
+ selectedTabID ?: string ;
36
+ tabs ?: Array < TabData > ;
17
37
/** * default value is true */
18
38
accessibility ?: boolean ;
19
39
/** * default value is false */
@@ -22,12 +42,14 @@ export interface Options {
22
42
onInit ?: ( ) => void ;
23
43
onChange ?: ( { currentData, previousData, closedTabIDs, openedTabIDs } : { currentData : any , previousData : any , closedTabIDs : Array < string > , openedTabIDs : Array < string > } ) => void ;
24
44
/** * defautl value function returns true */
25
- beforeSelect ?: ( e : React . MouseEvent < HTMLInputElement > , id : string ) => boolean ; onFirstSelect ?: ( { currentSelectedTabId, previousSelectedTabId } : { currentSelectedTabId : string , previousSelectedTabId : string } ) => void ;
45
+ beforeSelect ?: ( e : React . MouseEvent < HTMLElement > , id : string ) => boolean ;
46
+ onFirstSelect ?: ( { currentSelectedTabId, previousSelectedTabId } : { currentSelectedTabId : string , previousSelectedTabId : string } ) => void ;
26
47
onSelect ?: ( { currentSelectedTabId, previousSelectedTabId } : { currentSelectedTabId : string , previousSelectedTabId : string } ) => void ;
27
48
onOpen ?: ( openedTabIDs : Array < string > ) => void ;
28
49
/** * defautl value function returns true */
29
- beforeClose ?: ( e : React . MouseEvent < HTMLInputElement > , id : string ) => boolean ;
30
- onClose ?: ( closedTabIDs : Array < string > ) => void ; onDestroy ?: ( ) => void ;
50
+ beforeClose ?: ( e : React . MouseEvent < HTMLElement > , id : string ) => boolean ;
51
+ onClose ?: ( closedTabIDs : Array < string > ) => void ;
52
+ onDestroy ?: ( ) => void ;
31
53
}
32
54
export interface TabData {
33
55
id ?: string ;
@@ -40,7 +62,7 @@ export interface TabData {
40
62
iconClass ?: string ;
41
63
/** * default value is false */
42
64
disable ?: boolean ;
43
- panelComponent ?: React . ReactNode | React . ReactElement | React . FunctionComponent ;
65
+ panelComponent ?: React . ReactElement < any , any > | FunctionComponent < { id : string , isSelected : boolean , api : Instance } > | null ;
44
66
[ x : string ] : unknown ;
45
67
}
46
68
export interface CurrentData {
0 commit comments