UNPKG

@zendeskgarden/container-menu

Version:

Containers relating to Menu in the Garden Design System

33 lines (32 loc) 1.22 kB
/** * Copyright Zendesk, Inc. * * Use of this source code is governed under the Apache License, Version 2.0 * found at http://www.apache.org/licenses/LICENSE-2.0. */ import { Reducer } from 'react'; import { MenuItem, IMenuItemBase, ISelectedItem, IMenuItemGroup } from './types'; export declare const triggerLink: (element: HTMLAnchorElement, view: Window) => void; export declare const StateChangeTypes: Record<string, string>; export declare const isItemGroup: (item: MenuItem) => item is IMenuItemGroup; export declare const isValidItem: (item: MenuItem) => item is IMenuItemBase; export declare const toMenuItemKeyDownType: (type: string) => keyof typeof StateChangeTypes; type ReducerState = { /** Nested menu transition state */ focusOnOpen: boolean; isTransitionNext: boolean; isTransitionPrevious: boolean; transitionType: string | null; nestedPathIds: string[]; valuesRef: string[]; /** Uncontrolled state */ focusedValue?: string | null; selectedItems?: ISelectedItem[]; isExpanded?: boolean; }; type ReducerAction = { type: string; payload: Record<string, any>; }; export declare const stateReducer: Reducer<ReducerState, ReducerAction>; export {};