@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
46 lines • 1.87 kB
text/typescript
import { IconProps } from "../Icon/type.mjs";
import { IconContentConfig } from "../Icon/components/IconProvider.mjs";
import "../Icon/index.mjs";
import { MenuInfo, RcMenuDividerType, RcMenuItemGroupType, RcMenuItemType, RcSubMenuType } from "./itemInterface.mjs";
import { Key, ReactNode, Ref } from "react";
import { MenuProps, MenuRef } from "antd";
//#region src/Menu/type.d.ts
interface MenuItemType extends RcMenuItemType {
/**
* Whether to close the menu when this item is clicked.
* Set to `false` to keep the menu open (useful for items with Upload, file picker, etc.)
* @default true
*/
closeOnClick?: boolean;
danger?: boolean;
desc?: ReactNode;
icon?: IconProps['icon'];
loading?: boolean;
title?: string;
}
interface SubMenuType<T extends MenuItemType = MenuItemType> extends Omit<RcSubMenuType, 'children'> {
children: ItemType<T>[];
desc?: ReactNode;
icon?: IconProps['icon'];
}
interface MenuItemGroupType<T extends MenuItemType = MenuItemType> extends Omit<RcMenuItemGroupType, 'children'> {
children?: ItemType<T>[];
key?: Key;
}
interface MenuDividerType extends RcMenuDividerType {
dashed?: boolean;
key?: Key;
}
type ItemType<T extends MenuItemType = MenuItemType> = T | SubMenuType<T> | MenuItemGroupType<T> | MenuDividerType | null;
type GenericItemType<T = unknown> = T extends (infer U extends MenuItemType) ? unknown extends U ? ItemType : ItemType<U> : ItemType;
interface MenuProps$1<T = unknown> extends Omit<MenuProps, 'items'> {
compact?: boolean;
iconProps?: IconContentConfig;
items: GenericItemType<T>[];
ref?: Ref<MenuRef>;
shadow?: boolean;
variant?: 'filled' | 'outlined' | 'borderless';
}
//#endregion
export { GenericItemType, ItemType, MenuDividerType, type MenuInfo, MenuItemGroupType, MenuItemType, MenuProps$1 as MenuProps, SubMenuType };
//# sourceMappingURL=type.d.mts.map