import React, { HTMLAttributeAnchorTarget } from 'react'; import { AlertProps, IconProps, QAProps } from '@gravity-ui/uikit'; export type MenuItemType = 'regular' | 'action' | 'divider'; export type AsideHeaderMenuItemAriaProps = React.AriaAttributes & Pick, 'role' | 'tabIndex'>; export type OpenModalSubscriber = (open: boolean) => void; export interface MakeItemParams { icon?: React.ReactNode; title: React.ReactNode; } export interface MenuItem extends QAProps { id: string; title: React.ReactNode; tooltipText?: React.ReactNode; icon?: IconProps['data']; iconSize?: number | string; iconQa?: string; href?: string; current?: boolean; pinned?: boolean; onItemClick?: (item: MenuItem, collapsed: boolean, event: React.MouseEvent) => void; onItemClickCapture?: (event: React.SyntheticEvent) => void; itemWrapper?: (p: MakeItemParams, makeItem: (p: MakeItemParams) => React.ReactNode, opts: { collapsed: boolean; compact: boolean; item: MenuItem; ref: React.RefObject; }) => React.ReactNode; preventUserRemoving?: boolean; rightAdornment?: React.ReactNode; type?: MenuItemType; afterMoreButton?: boolean; /** * Order number. Used to determine the display order in the side menu */ order?: number; /** * Visibility flag in the side menu */ hidden?: boolean; /** * The category to which the menu item belongs. Need for grouping in the display/editing mode of all pages */ category?: string; /** * The group ID to which the menu item belongs. Used for grouping menu items */ groupId?: string; className?: string; menuItemAriaProps?: AsideHeaderMenuItemAriaProps; } export interface MenuGroup { id: string; title: string; icon?: IconProps['data']; iconSize?: number | string; /** Hide the group from display */ hidden?: boolean; /** * Optional title shown in a popup that lists group children. * Does not affect the group title displayed anywhere else. */ popupTitle?: string; /** * Optional main action for the group header, mirroring `MenuItem.onItemClick` * (receives the synthetic group-header item). When the group has its own action * (`onItemClick` and/or `href`), in the inline layout (`menuOverflow="scroll"`, * expanded sidebar) clicking the header row triggers the action like a regular * menu item, and only the chevron toggles expand/collapse. Such groups are also * listed as a clickable row in the All pages panel (view mode). */ onItemClick?: MenuItem['onItemClick']; /** * Optional link for the group header; renders the header row as an anchor. * Same click behavior split as `onItemClick`. */ href?: string; /** * Marks the group header row as the current page, like `MenuItem.current`. * Only the header row is highlighted; nested items keep their own states. */ current?: boolean; /** * @deprecated No-op since v7: the compact sidebar never renders a chevron on the * group anchor. The children popup keeps working as usual. Will be removed in the * next major version. */ hideCompactChevron?: boolean; /** * When `true` and the group has its own action (`onItemClick` and/or `href`), * the group items are not listed in the All pages panel (view mode) — the group * is represented only by its clickable header row. Has no effect for groups * without an action. */ hideItemsInAllPages?: boolean; } export interface LogoProps { text: (() => React.ReactNode) | string; className?: string; icon?: IconProps['data']; iconSrc?: string; iconClassName?: string; iconSize?: number; textSize?: number; href?: string; target?: HTMLAttributeAnchorTarget; wrapper?: (node: React.ReactNode, compact: boolean) => React.ReactNode; onClick?: (event: React.MouseEvent) => void; 'aria-label'?: string; 'aria-labelledby'?: string; } interface TopAlertBaseProps { align?: AlertProps['align']; message: AlertProps['message']; title?: AlertProps['title']; icon?: AlertProps['icon']; view?: AlertProps['view']; theme?: AlertProps['theme']; actions?: AlertProps['actions']; closable?: boolean; centered?: boolean; dense?: boolean; onCloseTopAlert?: () => void; /** * SSR-прелоад высоты: true — использовать оценку (dense/title), * число — задать конкретное значение, иначе — не устанавливать. */ preloadHeight?: boolean | number; render?: never; } export type TopAlertProps = TopAlertBaseProps | { render: (params: { handleClose: () => void; }) => React.ReactElement; }; export {};