-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Expand file tree
/
Copy pathAccordion.d.ts
More file actions
164 lines (155 loc) · 5.77 KB
/
Accordion.d.ts
File metadata and controls
164 lines (155 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import * as React from 'react';
import { SxProps } from '@mui/system';
import { CreateThemeComponent, Theme } from '../stylesOptimized';
import { TransitionProps } from '../transitions/transition';
import { AccordionClasses, AccordionClassKey } from './accordionClasses';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
import { ExtendPaperTypeMap, PaperProps } from '../Paper/Paper';
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
export interface AccordionSlots {
/**
* The component that renders the root.
* @default Paper
*/
root: React.ElementType;
/**
* The component that renders the heading.
* @default 'h3'
*/
heading: React.ElementType;
/**
* The component that renders the transition.
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Collapse
*/
transition: React.ElementType;
/**
* The component that renders the region.
* @default 'div'
*/
region: React.ElementType;
}
export interface AccordionRootSlotPropsOverrides {}
export interface AccordionHeadingSlotPropsOverrides {}
export interface AccordionTransitionSlotPropsOverrides {}
export interface AccordionRegionSlotPropsOverrides {}
export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<
AccordionSlots,
{
/**
* Props forwarded to the root slot.
* By default, the available props are based on the Paper element.
*/
root: SlotProps<
React.ElementType<PaperProps>,
AccordionRootSlotPropsOverrides,
AccordionOwnerState
>;
/**
* Props forwarded to the heading slot.
* By default, the available props are based on the h3 element.
*/
heading: SlotProps<'h3', AccordionHeadingSlotPropsOverrides, AccordionOwnerState>;
/**
* Props forwarded to the transition slot.
* By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component.
*/
transition: SlotComponentProps<
React.ElementType,
TransitionProps & AccordionTransitionSlotPropsOverrides,
AccordionOwnerState
>;
/**
* Props forwarded to the region slot.
* By default, the available props are based on the div element.
*/
region: SlotProps<'div', AccordionRegionSlotPropsOverrides, AccordionOwnerState>;
}
>;
export type AccordionTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'div',
> = ExtendPaperTypeMap<
{
props: AdditionalProps & {
/**
* The content of the component.
*/
children: NonNullable<React.ReactNode>;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<AccordionClasses>;
/**
* If `true`, expands the accordion by default.
* @default false
*/
defaultExpanded?: boolean;
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean;
/**
* If `true`, it removes the margin between two expanded accordion items and the increase of height.
* @default false
*/
disableGutters?: boolean;
/**
* If `true`, expands the accordion, otherwise collapse it.
* Setting this prop enables control over the accordion.
*/
expanded?: boolean;
/**
* Callback fired when the expand/collapse state is changed.
*
* @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
* @param {boolean} expanded The `expanded` state of the accordion.
*/
onChange?: (event: React.SyntheticEvent, expanded: boolean) => void;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* The component used for the transition.
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
TransitionComponent?: React.JSXElementConstructor<
TransitionProps & { children?: React.ReactElement<unknown, any> }
>;
/**
* Props applied to the transition element.
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
* @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
TransitionProps?: TransitionProps;
} & AccordionSlotsAndSlotProps;
defaultComponent: RootComponent;
},
'onChange' | 'classes'
>;
/**
*
* Demos:
*
* - [Accordion](https://mui.com/material-ui/react-accordion/)
*
* API:
*
* - [Accordion API](https://mui.com/material-ui/api/accordion/)
* - inherits [Paper API](https://mui.com/material-ui/api/paper/)
*/
declare const Accordion: OverridableComponent<AccordionTypeMap>;
export type AccordionProps<
RootComponent extends React.ElementType = AccordionTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<AccordionTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType;
};
export interface AccordionOwnerState extends AccordionProps {}
export type AccordionTheme = {
MuiAccordion?: CreateThemeComponent<AccordionClassKey, AccordionProps>;
};
export default Accordion;