@@ -12,12 +12,15 @@ interface MenubarContextType {
1212
1313 // MenubarItem
1414 createMenuItemHandlers : ( id : string ) => Record < string , any > ;
15- hasFocus ? : boolean ;
15+ hasFocus : boolean ;
1616
1717 // MenubarSubmenu
1818 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
2124}
2225
2326export const MenubarContext = createContext < MenubarContextType > ( {
@@ -27,20 +30,18 @@ export const MenubarContext = createContext<MenubarContextType>({
2730 setMenuOpen : ( ) => { } ,
2831 setActiveIndex : ( ) => { } ,
2932 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 : ( ) => ( ) => { }
3435} ) ;
3536
3637interface SubmenuContextType {
37- submenuItems : Set < HTMLElement > ;
38+ submenuItems : Set < HTMLLIElement > ;
3839 setSubmenuActiveIndex : ( index : number ) => void ;
39- registerSubmenuItem : ( ref : React . RefObject < HTMLElement > ) => ( ) => void ;
40+ registerSubmenuItem : ( ref : React . Ref < HTMLLIElement > ) => ( ) => void ;
4041 id : string ;
4142 title : string ;
42- first : ( ) => { } ;
43- last : ( ) => { } ;
43+ first : ( ) => void ;
44+ last : ( ) => void ;
4445}
4546
4647export const SubmenuContext = createContext < SubmenuContextType > ( {
@@ -49,10 +50,6 @@ export const SubmenuContext = createContext<SubmenuContextType>({
4950 registerSubmenuItem : ( ) => ( ) => { } ,
5051 id : '' ,
5152 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 : ( ) => { }
5855} ) ;
0 commit comments