| 1 |
import { createContext } from 'react'; |
| 2 |
export const MenuContext = createContext<{ |
| 3 |
menuId?: string; |
| 4 |
parentMenu?: string; |
| 5 |
onSelect?: (event?: any, itemId?: any) => void; |
| 6 |
onActionClick?: (event?: any, itemId?: any, actionId?: any) => void; |
| 7 |
activeItemId?: any; |
| 8 |
selected?: any | any[]; |
| 9 |
drilldownItemPath?: string[]; |
| 10 |
drilledInMenus?: string[]; |
| 11 |
onDrillIn?: ( |
| 12 |
event: React.KeyboardEvent | React.MouseEvent, |
| 13 |
fromItemId: string, |
| 14 |
toItemId: string, |
| 15 |
itemId: string |
| 16 |
) => void; |
| 17 |
onDrillOut?: (event: React.KeyboardEvent | React.MouseEvent, toItemId: string, itemId: string) => void; |
| 18 |
onGetMenuHeight?: (menuId: string, height: number) => void; |
| 19 |
flyoutRef?: React.Ref<HTMLLIElement>; |
| 20 |
setFlyoutRef?: (ref: React.Ref<HTMLLIElement>) => void; |
| 21 |
disableHover?: boolean; |
| 22 |
role?: string; |
| 23 |
}>({ |
| 24 |
menuId: null, |
| 25 |
parentMenu: null, |
| 26 |
onActionClick: () => null, |
| 27 |
onSelect: () => null, |
| 28 |
activeItemId: null, |
| 29 |
selected: null, |
| 30 |
drilledInMenus: [], |
| 31 |
drilldownItemPath: [], |
| 32 |
onDrillIn: null, |
| 33 |
onDrillOut: null, |
| 34 |
onGetMenuHeight: () => null, |
| 35 |
flyoutRef: null, |
| 36 |
setFlyoutRef: () => null, |
| 37 |
disableHover: false, |
| 38 |
role: 'menu' |
| 39 |
}); |
| 40 |
|
| 41 |
export const MenuItemContext = createContext<{ |
| 42 |
itemId?: any; |
| 43 |
isDisabled?: boolean; |
| 44 |
}>({ |
| 45 |
itemId: null, |
| 46 |
isDisabled: false |
| 47 |
}); |