import { type IconDefinition } from '@deephaven/icons'; import type React from 'react'; import type { Shortcut } from '../shortcuts'; export type ResolvableContextAction = ContextAction | Promise | (() => Promise | ContextAction[] | ContextAction); export type MenuItem = ContextAction | Promise; export interface ContextAction { title?: string | JSX.Element; description?: string; action?: (event: Event) => void; actions?: ResolvableContextAction[]; icon?: IconDefinition | React.ReactElement; iconColor?: string; shortcut?: Shortcut; shortcutText?: string; isGlobal?: boolean; group?: number; order?: number; disabled?: boolean; menuElement?: React.ReactElement; iconOutline?: boolean; } export interface ContextActionEvent extends MouseEvent { contextActions: ResolvableContextAction[]; } export declare function isPromise(value: A | Promise): value is Promise; declare class ContextActionUtils { static actionsDisabled: boolean; static disableAllActions(): void; static enableAllActions(): void; static isContextActionEvent(e: MouseEvent): e is ContextActionEvent; /** * Compare two action items. Useful in Array.sort * @param a First context action to compare * @param b Second context action to compare */ static compareActions(a: ContextAction, b: ContextAction): number; /** * * @param actions The array of actions to sort */ static sortActions(actions: ContextAction[]): ContextAction[]; static isMacPlatform(): boolean; /** * Retrieve the preferred modifier key based on the current platform */ static getModifierKey(): 'metaKey' | 'ctrlKey'; /** * Returns true if the modifier key for the current platform is down for the event (Ctrl for windows/linux, Command (meta) for mac) * @param event The event to get the meta key status from */ static isModifierKeyDown(event: KeyboardEvent | MouseEvent | React.KeyboardEvent | React.MouseEvent): boolean; /** * Returns the menu items for the provided context actions, or empty array if none found. * @param actionsParam The actions to get menu items for * @param includePromises Whether or not to include promises in the returned menu items */ static getMenuItems(actionsParam: ResolvableContextAction | ResolvableContextAction[], includePromises?: true): MenuItem[]; static getMenuItems(actionsParam: ResolvableContextAction | ResolvableContextAction[], includePromises: false): ContextAction[]; /** * Returns the index of the next menu item in a list that doesn't have a disabled=true prop * @param startIndex the starting position for the iteration * @param delta the direction of travel, -1 or 1 * @param menuItems an array of menuItems */ static getNextMenuItem(startIndex: number, delta: -1 | 1, menuItems: MenuItem[]): number; } export default ContextActionUtils; //# sourceMappingURL=ContextActionUtils.d.ts.map