1 | import * as React from 'react';
|
2 | import { Simplify } from '@mui/types';
|
3 | import Popper, { PopperProps } from '../Popper';
|
4 | import { PolymorphicProps, SlotComponentProps } from '../utils';
|
5 | import { UseMenuListboxSlotProps } from '../useMenu';
|
6 | import { ListAction } from '../useList';
|
7 | export interface MenuRootSlotPropsOverrides {
|
8 | }
|
9 | export interface MenuListboxSlotPropsOverrides {
|
10 | }
|
11 | export interface MenuActions {
|
12 | dispatch: (action: ListAction<string>) => void;
|
13 | }
|
14 | export interface MenuOwnProps {
|
15 | |
16 |
|
17 |
|
18 |
|
19 | actions?: React.Ref<MenuActions>;
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 | anchorEl?: PopperProps['anchorEl'];
|
26 | children?: React.ReactNode;
|
27 | className?: string;
|
28 | defaultOpen?: boolean;
|
29 | listboxId?: string;
|
30 | |
31 |
|
32 |
|
33 | onOpenChange?: (open: boolean) => void;
|
34 | |
35 |
|
36 |
|
37 |
|
38 | open?: boolean;
|
39 | |
40 |
|
41 |
|
42 |
|
43 | slotProps?: {
|
44 | root?: SlotComponentProps<typeof Popper, MenuRootSlotPropsOverrides, MenuOwnerState>;
|
45 | listbox?: SlotComponentProps<'ul', MenuListboxSlotPropsOverrides, MenuOwnerState>;
|
46 | };
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 | slots?: MenuSlots;
|
53 | }
|
54 | export interface MenuSlots {
|
55 | |
56 |
|
57 |
|
58 |
|
59 | root?: React.ElementType;
|
60 | |
61 |
|
62 |
|
63 |
|
64 | listbox?: React.ElementType;
|
65 | }
|
66 | export interface MenuTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'ul'> {
|
67 | props: MenuOwnProps & AdditionalProps;
|
68 | defaultComponent: RootComponentType;
|
69 | }
|
70 | export type MenuProps<RootComponentType extends React.ElementType = MenuTypeMap['defaultComponent']> = PolymorphicProps<MenuTypeMap<{}, RootComponentType>, RootComponentType>;
|
71 | export type MenuOwnerState = Simplify<MenuOwnProps & {
|
72 | open: boolean;
|
73 | }>;
|
74 | export type MenuRootSlotProps = {
|
75 | anchorEl: PopperProps['anchorEl'];
|
76 | children?: React.ReactNode;
|
77 | className?: string;
|
78 | keepMounted: PopperProps['keepMounted'];
|
79 | open: boolean;
|
80 | ownerState: MenuOwnerState;
|
81 | ref: React.Ref<any>;
|
82 | };
|
83 | export type MenuListboxSlotProps = UseMenuListboxSlotProps & {
|
84 | className: string | undefined;
|
85 | ownerState: MenuOwnerState;
|
86 | };
|