interface.d.ts 1014 B

1234567891011121314151617181920212223
  1. import type { MenuDividerType as RcMenuDividerType, MenuItemGroupType as RcMenuItemGroupType, MenuItemType as RcMenuItemType, SubMenuType as RcSubMenuType } from 'rc-menu/lib/interface';
  2. export type DataAttributes = {
  3. [Key in `data-${string}`]: unknown;
  4. };
  5. export interface MenuItemType extends RcMenuItemType, DataAttributes {
  6. danger?: boolean;
  7. icon?: React.ReactNode;
  8. title?: string;
  9. }
  10. export interface SubMenuType<T extends MenuItemType = MenuItemType> extends Omit<RcSubMenuType, 'children'> {
  11. icon?: React.ReactNode;
  12. theme?: 'dark' | 'light';
  13. children: ItemType<T>[];
  14. }
  15. export interface MenuItemGroupType<T extends MenuItemType = MenuItemType> extends Omit<RcMenuItemGroupType, 'children'> {
  16. children?: ItemType<T>[];
  17. key?: React.Key;
  18. }
  19. export interface MenuDividerType extends RcMenuDividerType {
  20. dashed?: boolean;
  21. key?: React.Key;
  22. }
  23. export type ItemType<T extends MenuItemType = MenuItemType> = T | SubMenuType<T> | MenuItemGroupType<T> | MenuDividerType | null;