Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dialog] Fix support for custom breakpoints #26331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/pages/api-docs/dialog.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"fullWidth": { "type": { "name": "bool" } },
"maxWidth": {
"type": {
"name": "enum",
"description": "'lg'<br>&#124;&nbsp;'md'<br>&#124;&nbsp;'sm'<br>&#124;&nbsp;'xl'<br>&#124;&nbsp;'xs'<br>&#124;&nbsp;false"
"name": "union",
"description": "'xs'<br>&#124;&nbsp;'sm'<br>&#124;&nbsp;'md'<br>&#124;&nbsp;'lg'<br>&#124;&nbsp;'xl'<br>&#124;&nbsp;false<br>&#124;&nbsp;string"
},
"default": "'sm'"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/Dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PaperProps } from '../Paper';
import { ModalProps } from '../Modal';
import { TransitionHandlerProps, TransitionProps } from '../transitions/transition';
import { DialogClasses } from './dialogClasses';
import { Breakpoint } from '../styles/createBreakpoints';

export interface DialogProps
extends StandardProps<ModalProps & Partial<TransitionHandlerProps>, 'children'> {
Expand Down Expand Up @@ -47,7 +48,7 @@ export interface DialogProps
* Set to `false` to disable `maxWidth`.
* @default 'sm'
*/
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
maxWidth?: Breakpoint | false;
/**
* Callback fired when the backdrop is clicked.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ Dialog.propTypes /* remove-proptypes */ = {
* Set to `false` to disable `maxWidth`.
* @default 'sm'
*/
maxWidth: PropTypes.oneOf(['lg', 'md', 'sm', 'xl', 'xs', false]),
maxWidth: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]),
PropTypes.string,
]),
/**
* Callback fired when the backdrop is clicked.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import Container from '@material-ui/core/Container';
import Dialog from '@material-ui/core/Dialog';
import { createTheme, ThemeProvider } from '@material-ui/core/styles';

// testing docs/src/pages/customization/breakpoints/breakpoints.md
Expand Down Expand Up @@ -41,6 +42,9 @@ function MyContainer() {
<ThemeProvider theme={theme}>
hello
<Container maxWidth="tablet">yooo</Container>
<Dialog open maxWidth="tablet">
<div />
</Dialog>
</ThemeProvider>
);
}