Skip to content

Commit 916f8a3

Browse files
[core] Standardize the component injection pattern
1 parent 2ac22c9 commit 916f8a3

File tree

11 files changed

+39
-34
lines changed

11 files changed

+39
-34
lines changed

docs/src/pages/demos/tables/CustomPaginationActionsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class CustomPaginationActionsTable extends React.Component {
180180
page={page}
181181
onChangePage={this.handleChangePage}
182182
onChangeRowsPerPage={this.handleChangeRowsPerPage}
183-
Actions={TablePaginationActionsWrapped}
183+
ActionsComponent={TablePaginationActionsWrapped}
184184
/>
185185
</TableRow>
186186
</TableFooter>

packages/material-ui-lab/src/SpeedDial/SpeedDial.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class SpeedDial extends React.Component {
9898
onKeyDown,
9999
open,
100100
openIcon,
101-
transition: Transition,
101+
TransitionComponent,
102102
transitionDuration,
103103
TransitionProps,
104104
...other
@@ -137,7 +137,12 @@ class SpeedDial extends React.Component {
137137

138138
return (
139139
<div className={classNames(classes.root, classNameProp)} {...other}>
140-
<Transition in={!hidden} timeout={transitionDuration} unmountOnExit {...TransitionProps}>
140+
<TransitionComponent
141+
in={!hidden}
142+
timeout={transitionDuration}
143+
unmountOnExit
144+
{...TransitionProps}
145+
>
141146
<Button
142147
variant="fab"
143148
color="primary"
@@ -155,7 +160,7 @@ class SpeedDial extends React.Component {
155160
>
156161
{icon()}
157162
</Button>
158-
</Transition>
163+
</TransitionComponent>
159164
<div
160165
id={`${id}-actions`}
161166
className={classNames(classes.actions, { [classes.actionsClosed]: !open })}
@@ -227,7 +232,7 @@ SpeedDial.propTypes = {
227232
/**
228233
* Transition component.
229234
*/
230-
transition: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
235+
TransitionComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
231236
/**
232237
* The duration for the transition, in milliseconds.
233238
* You may specify a single timeout for all transitions, or individually with an object.
@@ -244,7 +249,7 @@ SpeedDial.propTypes = {
244249

245250
SpeedDial.defaultProps = {
246251
hidden: false,
247-
transition: Zoom,
252+
TransitionComponent: Zoom,
248253
transitionDuration: {
249254
enter: duration.enteringScreen,
250255
exit: duration.leavingScreen,

packages/material-ui/src/Dialog/Dialog.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface DialogProps
1111
fullWidth?: boolean;
1212
maxWidth?: 'xs' | 'sm' | 'md' | false;
1313
PaperProps?: Partial<PaperProps>;
14-
transition?: React.ReactType;
14+
TransitionComponent?: React.ReactType;
1515
transitionDuration?: TransitionProps['timeout'];
1616
}
1717

packages/material-ui/src/Dialog/Dialog.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function Dialog(props) {
7373
onExiting,
7474
open,
7575
PaperProps,
76-
transition: TransitionProp,
76+
TransitionComponent,
7777
transitionDuration,
7878
TransitionProps,
7979
...other
@@ -95,7 +95,7 @@ function Dialog(props) {
9595
role="dialog"
9696
{...other}
9797
>
98-
<TransitionProp
98+
<TransitionComponent
9999
appear
100100
in={open}
101101
timeout={transitionDuration}
@@ -119,7 +119,7 @@ function Dialog(props) {
119119
>
120120
{children}
121121
</Paper>
122-
</TransitionProp>
122+
</TransitionComponent>
123123
</Modal>
124124
);
125125
}
@@ -214,7 +214,7 @@ Dialog.propTypes = {
214214
/**
215215
* Transition component.
216216
*/
217-
transition: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
217+
TransitionComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
218218
/**
219219
* The duration for the transition, in milliseconds.
220220
* You may specify a single timeout for all transitions, or individually with an object.
@@ -235,7 +235,7 @@ Dialog.defaultProps = {
235235
fullScreen: false,
236236
fullWidth: false,
237237
maxWidth: 'sm',
238-
transition: Fade,
238+
TransitionComponent: Fade,
239239
transitionDuration: { enter: duration.enteringScreen, exit: duration.leavingScreen },
240240
};
241241

packages/material-ui/src/Popover/Popover.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface PopoverProps
3131
PaperProps?: Partial<PaperProps>;
3232
role?: string;
3333
transformOrigin?: PopoverOrigin;
34-
transition?: React.ReactType;
34+
TransitionComponent?: React.ReactType;
3535
transitionDuration?: TransitionProps['timeout'] | 'auto';
3636
}
3737

packages/material-ui/src/Popover/Popover.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class Popover extends React.Component {
290290
PaperProps,
291291
role,
292292
transformOrigin,
293-
transition: TransitionProp,
293+
TransitionComponent,
294294
transitionDuration,
295295
TransitionProps,
296296
...other
@@ -304,7 +304,7 @@ class Popover extends React.Component {
304304

305305
return (
306306
<Modal container={container} open={open} BackdropProps={{ invisible: true }} {...other}>
307-
<TransitionProp
307+
<TransitionComponent
308308
appear
309309
in={open}
310310
onEnter={this.handleEnter}
@@ -328,7 +328,7 @@ class Popover extends React.Component {
328328
<EventListener target="window" onResize={this.handleResize} />
329329
{children}
330330
</Paper>
331-
</TransitionProp>
331+
</TransitionComponent>
332332
</Modal>
333333
);
334334
}
@@ -472,7 +472,7 @@ Popover.propTypes = {
472472
/**
473473
* Transition component.
474474
*/
475-
transition: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
475+
TransitionComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
476476
/**
477477
* Set to 'auto' to automatically calculate transition time based on height.
478478
*/
@@ -499,7 +499,7 @@ Popover.defaultProps = {
499499
vertical: 'top',
500500
horizontal: 'left',
501501
},
502-
transition: Grow,
502+
TransitionComponent: Grow,
503503
transitionDuration: 'auto',
504504
};
505505

packages/material-ui/src/Snackbar/Snackbar.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class Snackbar extends React.Component {
208208
open,
209209
resumeHideDuration,
210210
SnackbarContentProps,
211-
transition: TransitionProp,
211+
TransitionComponent,
212212
transitionDuration,
213213
TransitionProps,
214214
...other
@@ -236,7 +236,7 @@ class Snackbar extends React.Component {
236236
onFocus={disableWindowBlurListener ? undefined : this.handleResume}
237237
onBlur={disableWindowBlurListener ? undefined : this.handlePause}
238238
/>
239-
<TransitionProp
239+
<TransitionComponent
240240
appear
241241
in={open}
242242
onEnter={onEnter}
@@ -252,7 +252,7 @@ class Snackbar extends React.Component {
252252
{children || (
253253
<SnackbarContent message={message} action={action} {...SnackbarContentProps} />
254254
)}
255-
</TransitionProp>
255+
</TransitionComponent>
256256
</div>
257257
</ClickAwayListener>
258258
);
@@ -370,7 +370,7 @@ Snackbar.propTypes = {
370370
/**
371371
* Transition component.
372372
*/
373-
transition: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
373+
TransitionComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
374374
/**
375375
* The duration for the transition, in milliseconds.
376376
* You may specify a single timeout for all transitions, or individually with an object.
@@ -391,7 +391,7 @@ Snackbar.defaultProps = {
391391
horizontal: 'center',
392392
},
393393
disableWindowBlurListener: false,
394-
transition: Slide,
394+
TransitionComponent: Slide,
395395
transitionDuration: {
396396
enter: duration.enteringScreen,
397397
exit: duration.leavingScreen,

packages/material-ui/src/Stepper/StepContent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface StepContentProps
1212
last?: boolean;
1313
optional?: boolean;
1414
orientation?: Orientation;
15-
transition?: React.ComponentType<TransitionProps>;
15+
TransitionComponent?: React.ComponentType<TransitionProps>;
1616
transitionDuration?: TransitionProps['timeout'] | 'auto';
1717
}
1818

packages/material-ui/src/Stepper/StepContent.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function StepContent(props) {
3232
last,
3333
optional,
3434
orientation,
35-
transition: Transition,
35+
TransitionComponent,
3636
transitionDuration,
3737
TransitionProps,
3838
...other
@@ -45,15 +45,15 @@ function StepContent(props) {
4545

4646
return (
4747
<div className={classNames(classes.root, { [classes.last]: last }, className)} {...other}>
48-
<Transition
48+
<TransitionComponent
4949
in={active}
5050
className={classes.transition}
5151
timeout={transitionDuration}
5252
unmountOnExit
5353
{...TransitionProps}
5454
>
5555
{children}
56-
</Transition>
56+
</TransitionComponent>
5757
</div>
5858
);
5959
}
@@ -101,7 +101,7 @@ StepContent.propTypes = {
101101
/**
102102
* Collapse component.
103103
*/
104-
transition: PropTypes.func,
104+
TransitionComponent: PropTypes.func,
105105
/**
106106
* Adjust the duration of the content expand transition.
107107
* Passed as a property to the transition component.
@@ -120,7 +120,7 @@ StepContent.propTypes = {
120120
};
121121

122122
StepContent.defaultProps = {
123-
transition: Collapse,
123+
TransitionComponent: Collapse,
124124
transitionDuration: 'auto',
125125
};
126126

packages/material-ui/src/Table/TablePagination.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface LabelDisplayedRowsArgs {
1313

1414
export interface TablePaginationProps
1515
extends StandardProps<TablePaginationBaseProps, TablePaginationClassKey> {
16-
Actions?: React.ReactType<TablePaginationBaseProps>;
16+
ActionsComponent?: React.ReactType<TablePaginationBaseProps>;
1717
backIconButtonProps?: Partial<IconButtonProps>;
1818
component?: React.ReactType<TablePaginationBaseProps>;
1919
count: number;

packages/material-ui/src/Table/TablePagination.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class TablePagination extends React.Component {
7070

7171
render() {
7272
const {
73-
Actions,
73+
ActionsComponent,
7474
backIconButtonProps,
7575
classes,
7676
colSpan: colSpanProp,
@@ -134,7 +134,7 @@ class TablePagination extends React.Component {
134134
page,
135135
})}
136136
</Typography>
137-
<Actions
137+
<ActionsComponent
138138
className={classes.actions}
139139
backIconButtonProps={backIconButtonProps}
140140
count={count}
@@ -154,7 +154,7 @@ TablePagination.propTypes = {
154154
* The component used for displaying the actions.
155155
* Either a string to use a DOM element or a component.
156156
*/
157-
Actions: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
157+
ActionsComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
158158
/**
159159
* Properties applied to the back arrow `IconButton` component.
160160
*/
@@ -222,7 +222,7 @@ TablePagination.propTypes = {
222222
};
223223

224224
TablePagination.defaultProps = {
225-
Actions: TablePaginationActions,
225+
ActionsComponent: TablePaginationActions,
226226
component: TableCell,
227227
labelDisplayedRows: ({ from, to, count }) => `${from}-${to} of ${count}`,
228228
labelRowsPerPage: 'Rows per page:',

0 commit comments

Comments
 (0)