UNPKG

@carbon/react

Version:

React components for the Carbon Design System

41 lines (40 loc) 1.24 kB
/** * Copyright IBM Corp. 2023, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { KeyboardEvent, RefObject } from 'react'; type ActionType = { type: 'enableIcons' | 'enableSelectableItems' | 'registerItem'; payload: any; }; type StateType = { isRoot: boolean; hasIcons: boolean; hasSelectableItems: boolean; size: 'xs' | 'sm' | 'md' | 'lg' | null; items: any[]; requestCloseRoot: (e: Pick<KeyboardEvent<HTMLUListElement>, 'type'>) => void; }; declare function menuReducer(state: StateType, action: ActionType): { hasIcons: boolean; isRoot: boolean; hasSelectableItems: boolean; size: "xs" | "sm" | "md" | "lg" | null; items: any[]; requestCloseRoot: (e: Pick<KeyboardEvent<HTMLUListElement>, "type">) => void; }; type DispatchFuncProps = { type: ActionType['type']; payload: { ref: RefObject<HTMLLIElement | null>; disabled: boolean; }; }; type MenuContextProps = { state: StateType; dispatch: (props: DispatchFuncProps) => void; }; declare const MenuContext: import("react").Context<MenuContextProps>; export { MenuContext, menuReducer };