Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function testGetThemeProps(theme: Theme, props: AppBarProps): void {
const overriddenProps: AppBarProps = getThemeProps({ name: 'MuiAppBar', props, theme });
// AvatarProps not assignable to AppBarProps
// $ExpectError
const wronglyNamedProps: AppBarProps = getThemeProps({
name: 'MuiAvatar',
props,
theme,
});
}
function testGetThemeProps(theme: Theme, props: AppBarProps): void {
const overriddenProps: AppBarProps = getThemeProps({ name: 'MuiAppBar', props, theme });
// AvatarProps not assignable to AppBarProps
// $ExpectError
const wronglyNamedProps: AppBarProps = getThemeProps({
name: 'MuiAvatar',
props,
theme,
});
}
function useMediaQuery(queryInput, options = {}) {
const theme = useTheme();
const { iWindow } = useWindow();
const props = getThemeProps({
theme,
name: 'MuiUseMediaQuery',
props: {},
});
if (process.env.NODE_ENV !== 'production') {
if (typeof queryInput === 'function' && theme === null) {
console.error(
[
'Material-UI: the `query` argument provided is invalid.',
'You are providing a function without a theme in the context.',
'One of the parent elements needs to use a ThemeProvider.',
].join('\n')
);
}
}
function useMediaQuery(queryInput, options = {}) {
const theme = useTheme();
const props = getThemeProps({
theme,
name: 'MuiUseMediaQuery',
props: {},
});
if (process.env.NODE_ENV !== 'production') {
if (typeof queryInput === 'function' && theme === null) {
console.error(
[
'Material-UI: the `query` argument provided is invalid.',
'You are providing a function without a theme in the context.',
'One of the parent elements needs to use a ThemeProvider.',
].join('\n'),
);
}
}
function useMediaQuery(query: (theme: Theme) => string, options) {
const theme = useTheme() as Theme;
const props = getThemeProps({
theme,
name: 'MuiUseMediaQuery',
props: {},
});
return useMuiMediaQuery(theme ? query(theme) : '', {
...props,
...options,
});
}
const Modal = React.forwardRef(function Modal(inProps, ref) {
const theme = useTheme();
const props = getThemeProps({ name: 'MuiModal', props: { ...inProps }, theme });
const {
BackdropComponent = SimpleBackdrop,
BackdropProps,
children,
closeAfterTransition = false,
container,
disableAutoFocus = false,
disableBackdropClick = false,
disableEnforceFocus = false,
disableEscapeKeyDown = false,
disablePortal = false,
disableRestoreFocus = false,
disableScrollLock = false,
hideBackdrop = false,
keepMounted = false,
manager = defaultManager,