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