{"version":3,"file":"MenuContext.cjs","names":[],"sources":["../../../src/components/Menu/MenuContext.tsx"],"sourcesContent":["/*\nCopyright 2023 New Vector Ltd.\n\nSPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\nPlease see LICENSE files in the repository root for full details.\n*/\n\nimport { type ComponentType, type ReactNode, createContext } from \"react\";\n\nexport interface MenuItemWrapperProps {\n  /**\n   * Event callback for when the item is selected via mouse, touch, or keyboard.\n   * Calling event.preventDefault in this handler will prevent the menu from\n   * being dismissed.\n   */\n  onSelect: (e: Event) => void;\n  children: ReactNode;\n}\n\nexport interface SubMenuWrapperProps {\n  /**\n   * The trigger element that opens the submenu (typically a MenuItem).\n   */\n  trigger: ReactNode;\n  /**\n   * The submenu contents.\n   */\n  children: ReactNode;\n  /**\n   * Whether the submenu is open (controlled).\n   */\n  open?: boolean;\n  /**\n   * Event handler called when the open state of the submenu changes.\n   */\n  onOpenChange?: (open: boolean) => void;\n}\n\nexport interface MenuData {\n  /**\n   * A component that wraps interactive menu items.\n   */\n  MenuItemWrapper: ComponentType<MenuItemWrapperProps> | null;\n  /**\n   * A component that wraps submenus.\n   */\n  SubMenuWrapper: ComponentType<SubMenuWrapperProps> | null;\n  /**\n   * Event handler called when the open state of the menu changes.\n   */\n  onOpenChange: (open: boolean) => void;\n}\n\n/**\n * A React context providing information about the menu in which a given\n * component resides.\n */\nexport const MenuContext = createContext<MenuData | null>(null);\n"],"mappings":";;;;;;AAyDA,IAAa,eAAA,oBAAA,eAA6C,KAAK"}