@@ -12,12 +12,15 @@ interface MenubarContextType {
12
12
13
13
// MenubarItem
14
14
createMenuItemHandlers : ( id : string ) => Record < string , any > ;
15
- hasFocus ? : boolean ;
15
+ hasFocus : boolean ;
16
16
17
17
// MenubarSubmenu
18
18
setActiveIndex : ( index : number ) => void ;
19
- menuItems : Set < HTMLElement > ;
20
- registerTopLevelItem : ( ref : unknown , id : string ) => void ;
19
+ menuItems : Set < HTMLButtonElement > ;
20
+ registerTopLevelItem : (
21
+ ref : React . Ref < HTMLButtonElement > ,
22
+ id : string
23
+ ) => ( ) => void ; // returns unregister fn
21
24
}
22
25
23
26
export const MenubarContext = createContext < MenubarContextType > ( {
@@ -27,20 +30,18 @@ export const MenubarContext = createContext<MenubarContextType>({
27
30
setMenuOpen : ( ) => { } ,
28
31
setActiveIndex : ( ) => { } ,
29
32
hasFocus : false ,
30
- menuItems : Set < HTMLElement > ,
31
- registerTopLevelItem ( ref : unknown , id : string ) : void {
32
- throw new Error ( 'Function not implemented.' ) ;
33
- }
33
+ menuItems : new Set < HTMLButtonElement > ( ) ,
34
+ registerTopLevelItem : ( ) => ( ) => { }
34
35
} ) ;
35
36
36
37
interface SubmenuContextType {
37
- submenuItems : Set < HTMLElement > ;
38
+ submenuItems : Set < HTMLLIElement > ;
38
39
setSubmenuActiveIndex : ( index : number ) => void ;
39
- registerSubmenuItem : ( ref : React . RefObject < HTMLElement > ) => ( ) => void ;
40
+ registerSubmenuItem : ( ref : React . Ref < HTMLLIElement > ) => ( ) => void ;
40
41
id : string ;
41
42
title : string ;
42
- first : ( ) => { } ;
43
- last : ( ) => { } ;
43
+ first : ( ) => void ;
44
+ last : ( ) => void ;
44
45
}
45
46
46
47
export const SubmenuContext = createContext < SubmenuContextType > ( {
@@ -49,10 +50,6 @@ export const SubmenuContext = createContext<SubmenuContextType>({
49
50
registerSubmenuItem : ( ) => ( ) => { } ,
50
51
id : '' ,
51
52
title : '' ,
52
- first ( ) : { } {
53
- throw new Error ( 'Function not implemented.' ) ;
54
- } ,
55
- last ( ) : { } {
56
- throw new Error ( 'Function not implemented.' ) ;
57
- }
53
+ first : ( ) => { } ,
54
+ last : ( ) => { }
58
55
} ) ;
0 commit comments