import type { UIType } from "../../types"; import type { SubMenuIds } from "./constants/subMenuIds"; import type { TmpComponentType } from "../../types/tmp"; interface BaseMenuItem { id: string; weight: number; ariaLabel?: string; label: string; } interface BaseSettingsMenuItem extends BaseMenuItem { icon: TmpComponentType | string; isHiddenFor?: UIType[]; } export declare enum MenuItemType { OPEN_SUB_MENU = "OPEN_SUB_MENU", CLICK = "CLICK", SWITCH = "SWITCH" } export declare enum SubMenuItemType { OPEN_SUB_MENU = "OPEN_SUB_MENU", SELECT_VALUE = "SELECT_VALUE" } export interface OpenSubMenuSettingsMenuItem extends BaseSettingsMenuItem { type: MenuItemType.OPEN_SUB_MENU; subMenuId: SubMenuIds; value: string; valueComponent?: any; getSubItemForFocus: () => HTMLLIElement; } export interface ClickSettingsMenuItem extends BaseSettingsMenuItem { type: MenuItemType.CLICK; onClick: () => void; } export interface SwitchSettingsMenuItem extends BaseSettingsMenuItem { type: MenuItemType.SWITCH; onClick: (enabled: boolean) => void; enabled: boolean; tooltipText?: string; maxTooltipWidth?: number; } export type AdditionalSwitchSettingsMenuItem = Omit & { icon: string; onChangeEnabled: (enabled: boolean) => void; }; export type AdditionalClickSettingsMenuItem = Omit & { icon: string; }; export type SettingsMenuItem = OpenSubMenuSettingsMenuItem | ClickSettingsMenuItem | SwitchSettingsMenuItem; export type AdditionalSettingsMenuItem = AdditionalSwitchSettingsMenuItem | AdditionalClickSettingsMenuItem; interface SubMenuItemBase { selected?: boolean; valueComponent?: TmpComponentType; valueComponentParams?: { [key: string]: U; }; bottomBordered?: boolean; label?: string; sublabel?: string; ariaLabel?: string; onClick?: () => void; } export interface SelectValueSubMenuItem< T = any, U = any > extends SubMenuItemBase { type: SubMenuItemType.SELECT_VALUE; value: T; dataValue?: T | keyof T; selectItem: (value: T) => void; } export interface OpenSubMenuSubMenuItem extends SubMenuItemBase { type: SubMenuItemType.OPEN_SUB_MENU; id: string; subMenuId: SubMenuIds; getSubItemForFocus?: () => HTMLLIElement; } export type SubMenuItem = SelectValueSubMenuItem | OpenSubMenuSubMenuItem; export interface SubMenuList { id: SubMenuIds; parentItemId?: string; items: SubMenuItem[]; returnFromSubMenu?: () => void; ariaLabelReturnFromSubMenu?: string; title: string; closeSettingsMenu: () => void; minWidth?: number; onMount?: () => void; } export interface ContextMenuItem extends BaseMenuItem { onClick: () => void; } export type AdditionalContextMenuItem = ContextMenuItem; export type MenuRefs = { [key: string]: HTMLUListElement; }; export {};