import type { Dispatch, ReactNode, Ref, RefObject, SetStateAction, MouseEvent } from 'react';
import type { BaseProps, NoChildrenProp, OmitStrict, PropsWithDefaults, TestIdProp } from '../../types';
import type { MetaListProps } from '../MetaList';
import type { UseActiveDescendantConfig } from '../../hooks';
import type { TooltipProps } from '../Tooltip';
import type { SummaryItemProps } from '../SummaryItem';
export type AcceptedMouseEventElement = HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;
export interface MenuItemProps extends MenuObjectProps {
    /** The primary piece of item information as a string. */
    primary: string;
    /** Secondary info about an item. Useful for additional metadata or context. Will be overridden when ancestors are passed as a prop. */
    secondary?: MetaListProps['items'];
    /** A visual to assist identifying an item. e.g. Avatar or Icon. */
    visual?: ReactNode;
    /** A count to assist with number of associated items. */
    count?: number;
    /** An array of MenuItemProps to identify an item's ancestors by their primary value. Useful for flattened tree search results. */
    ancestors?: (MenuItemProps | MenuGroupProps)[];
    /** An array of either MenuItemProps or MenuGroupProps children. */
    items?: (MenuItemProps | MenuGroupProps)[];
    /**
     * For single or multi select menus, selected must be set true|false to render an item's radiobutton or checkbox.
     * May be set on parent or leaf items.
     */
    selected?: boolean;
    /** FUTURE SUPPORT: Use to indicate an item has a partial selection, some but not all of its descendants are selected. */
    partial?: boolean;
    /** Will render the action item as link. Only use for leaf items. */
    href?: string;
    /**
     * Provide a description for an item that will render in a Tooltip when hovering that item.
     * This should be used only for VERY SPECIFIC UX scenarios.
     */
    tooltip?: TooltipProps['children'];
    /** Use this function to identify and set item selections. Recommend leveraging top level Menu onItemClick handler. */
    onClick?: (id: MenuItemProps['id'], e: MouseEvent<AcceptedMouseEventElement>) => void;
    onExpand?: MenuItemProps['onClick'];
    /** Determines if the MenuItem will be disabled. */
    disabled?: boolean;
    role?: 'menuitem' | 'option';
}
export interface MenuGroupProps extends MenuObjectProps {
    /** Label of the group. */
    label: string;
    /** An array of MenuItemProps children. */
    items: MenuItemProps[];
    /** List-like role to apply to group items. */
    itemRole?: MenuItemProps['role'];
}
export type ParentMenuItemProps = MenuItemProps & {
    items: NonNullable<MenuItemProps['items']>;
};
export interface MenuListHeaderProps {
    /** Text used to indicate an expanded parent item. */
    text: string;
    /** Internal handler. */
    onClick: () => void;
}
export interface MenuObjectProps extends TestIdProp {
    /** A unique id within the entire tree of menu items. */
    id: string;
}
export interface MenuListProps {
    items: ParentMenuItemProps['items'];
    id?: string;
    ref?: Ref<HTMLFieldSetElement>;
    parent?: {
        el: HTMLFieldSetElement;
        item: ParentMenuItemProps;
        siblingItems: ParentMenuItemProps['items'];
        setExpandedItem: Dispatch<SetStateAction<ParentMenuItemProps | undefined>>;
        returnFocusRef: RefObject<HTMLButtonElement>;
    };
    menuRole?: 'menu' | 'listbox';
}
export type MenuHandleValue = {
    /**
     * Sets current menu depth to that of the given id.
     * Only applies to drill-down variant.
     */
    expandTo: (parentItemId: MenuItemProps['id']) => void;
};
export interface MenuProps extends TestIdProp, BaseProps, NoChildrenProp {
    /** An array of MenuItemProps. */
    items: (MenuItemProps | MenuGroupProps)[];
    /**
     * Determines menu item content layout structure.
     * @default 'stacked'
     */
    itemLayout?: SummaryItemProps['layout'];
    /** Renders a create new action below the menu. */
    onCreateNew?: () => void;
    /** ID placed on the menu's list element. */
    listId?: string;
    /**
     * Indicates intent for the menu.
     * As of now item types can not be mixed.
     * @default 'action'
     */
    mode?: 'action' | 'multi-select' | 'single-select';
    role?: 'menu' | 'listbox';
    /**
     * Always recommended to go for default drill-down variant for better accessibility.
     * When flyout variant is selected, its recommended not to have more than 1 nested level
     * @default 'drill-down'
     */
    variant?: 'drill-down' | 'flyout';
    /**
     * Use to accent(make bold) portions of the primary text.
     * Useful for filter/search results.
     * If passed a function, that function will be passed each items primary text.
     */
    accent?: RegExp | ((primary: string) => RegExp);
    /**
     * Item height will grow or shrink based on item count.
     * Use this indicate at which item the menu should begin its scroll.
     * @default 7
     */
    scrollAt?: number;
    /** A simple message to display when there are no items. */
    emptyText?: string;
    /**
     * A top level handler for all item clicks.
     * This is convenient way to detect which item was clicked to react by updating state or performing an action.
     * Both an item's onClick and this will be called if both are passed.
     */
    onItemClick?: MenuItemProps['onClick'];
    /**
     * A top level handler for all item pseudo focus events.
     * This is convenient way to detect which item is active to react by updating state or performing an action.
     */
    onItemActive?: (id: MenuItemProps['id']) => void;
    /**
     * A top level handler for clicks on parent items to expand their child items.
     * This is convenient way to detect when an item is expanded.
     * For lazy loading this would be a good time to set an item's items.
     * Both an item's onExpand and this will be called if both are passed.
     */
    onItemExpand?: MenuProps['onItemClick'];
    /** A top level handler for capturing when nested items have been collapsed / "back" button clicks. */
    onItemCollapse?: (id: MenuItemProps['id']) => void;
    /**
     * Show a Progress indicator at the end of a list where newly loaded items will be appended.
     * @default false
     */
    loading?: boolean;
    /** Callback to fetch more items */
    loadMore?: (id?: MenuItemProps['id']) => void;
    /** Ref placed on the root menu element. */
    ref?: Ref<HTMLDivElement>;
    /** HTML ID. */
    id?: string;
    /**
     * Currently highlighted item.
     * Setting currentItemId assumes synthetic focus is being controlled entirely by the containing component,
     * and unbinds menu useActiveDescendant keydown controls.
     * @deprecated
     */
    currentItemId?: string;
    /** Override for default active-descendant focus control element in menu */
    focusControlEl?: HTMLElement | undefined;
    /** Header region. */
    header?: ReactNode;
    /** Footer region. */
    footer?: ReactNode;
    /** Pauses evaluation of menu active descendants while true */
    pauseDescendantEvaluation?: UseActiveDescendantConfig['pauseDescendantEvaluation'];
    /**
     * Flag to indicate that Right/Left arrow navigation for expand/collapse parent items is not available.
     * Will accept enter if not selectable parent, otherwise falls back to shift + space.
     */
    arrowNavigationUnsupported?: boolean;
    /** Additional information to announce to screen reader users. Read before menu navigation instructions. */
    'aria-describedby'?: string;
    /** Label for menu or listbox element */
    'aria-label'?: string;
    /**
     * Custom menu list rendering
     * @internal
     */
    menuList?: ReactNode;
    handleRef?: Ref<MenuHandleValue>;
}
type MenuPropsWithDefaults = PropsWithDefaults<MenuProps, 'mode' | 'variant' | 'scrollAt' | 'loading' | 'itemLayout'>;
export interface MenuContextProps extends OmitStrict<MenuPropsWithDefaults, 'ref' | 'items' | 'handleRef'> {
    radioName?: string;
    componentId: string;
    pushFlyoutId: (id: string) => void;
    flyOutActiveIdStack: string[];
    focusControl: HTMLElement | null;
    updateActiveDescendants: (options?: {
        preventScroll?: boolean;
    }) => void;
    setFocusDescendant: Dispatch<SetStateAction<HTMLElement | null>>;
    setFocusReturnEl: Dispatch<SetStateAction<HTMLElement | null | undefined>>;
    getScopedItemId: (itemId: string) => string;
    updateParentDescendantStack?: (item: HTMLElement | null) => void;
    expandTo?: {
        parentItemId: MenuItemProps['id'] | undefined;
        onComplete: () => void;
    };
}
export interface NavItemsListProps {
    listRef: RefObject<HTMLUListElement>;
    cycle?: boolean;
}
export {};
//# sourceMappingURL=Menu.types.d.ts.map