Merge pull request #27068 from deejay1/material-imports
chore(material-ui): Don't use top level material-ui imports
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/theme': patch
|
||||
---
|
||||
|
||||
Internal refactor to avoid top-level imports from MUI.
|
||||
@@ -1 +1,5 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
rules: {
|
||||
'@backstage/no-top-level-material-ui-4-imports': 'error',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
svg: {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// NOTE: This file is intentionally .jsx, so that there is one file in this repo where we make sure .jsx files work.
|
||||
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
svg: {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React, { PropsWithChildren } from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import HomeIcon from '@material-ui/icons/Home';
|
||||
import RuleIcon from '@material-ui/icons/AssignmentTurnedIn';
|
||||
import MapIcon from '@material-ui/icons/MyLocation';
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
|
||||
import React from 'react';
|
||||
import { InfoCard } from '@backstage/core-components';
|
||||
import {
|
||||
List,
|
||||
Grid,
|
||||
ListItem,
|
||||
ListItemText,
|
||||
ListItemSecondaryAction,
|
||||
Switch,
|
||||
} from '@material-ui/core';
|
||||
import List from '@material-ui/core/List';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import ListItem from '@material-ui/core/ListItem';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
|
||||
import Switch from '@material-ui/core/Switch';
|
||||
import useLocalStorage from 'react-use/esm/useLocalStorage';
|
||||
|
||||
export function AdvancedSettings() {
|
||||
|
||||
@@ -70,7 +70,8 @@ import {
|
||||
EntityOwnershipCard,
|
||||
EntityUserProfileCard,
|
||||
} from '@backstage/plugin-org';
|
||||
import { Button, Grid } from '@material-ui/core';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
|
||||
import {
|
||||
|
||||
@@ -37,7 +37,8 @@ import {
|
||||
searchApiRef,
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { Grid, makeStyles } from '@material-ui/core';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import React, { ComponentType, PropsWithChildren } from 'react';
|
||||
|
||||
const entities = [
|
||||
@@ -126,8 +127,8 @@ const useStyles = makeStyles(theme => ({
|
||||
boxShadow: theme.shadows[1],
|
||||
},
|
||||
searchBarOutline: {
|
||||
borderStyle: 'none'
|
||||
}
|
||||
borderStyle: 'none',
|
||||
},
|
||||
}));
|
||||
|
||||
const useLogoStyles = makeStyles(theme => ({
|
||||
@@ -156,9 +157,14 @@ export const DefaultTemplate = () => {
|
||||
className={container}
|
||||
logo={<TemplateBackstageLogo classes={{ svg, path }} />}
|
||||
/>
|
||||
<Grid container item xs={12} justifyContent='center'>
|
||||
<Grid container item xs={12} justifyContent="center">
|
||||
<HomePageSearchBar
|
||||
InputProps={{ classes: { root: classes.searchBarInput, notchedOutline: classes.searchBarOutline }}}
|
||||
InputProps={{
|
||||
classes: {
|
||||
root: classes.searchBarInput,
|
||||
notchedOutline: classes.searchBarOutline,
|
||||
},
|
||||
}}
|
||||
placeholder="Search"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import React from 'react';
|
||||
import type { FieldValidation } from '@rjsf/utils';
|
||||
import { scaffolderPlugin } from '@backstage/plugin-scaffolder';
|
||||
import { TextField } from '@material-ui/core';
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import {
|
||||
createScaffolderFieldExtension,
|
||||
FieldExtensionComponentProps,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
LayoutTemplate,
|
||||
scaffolderPlugin,
|
||||
} from '@backstage/plugin-scaffolder';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
|
||||
const TwoColumn: LayoutTemplate = ({ properties, description, title }) => {
|
||||
const mid = Math.ceil(properties.length / 2);
|
||||
|
||||
@@ -29,14 +29,12 @@ import {
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { TechDocsSearchResultListItem } from '@backstage/plugin-techdocs';
|
||||
import { CatalogSearchResultListItem } from '@backstage/plugin-catalog';
|
||||
import {
|
||||
Box,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Grid,
|
||||
makeStyles,
|
||||
} from '@material-ui/core';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import DialogActions from '@material-ui/core/DialogActions';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
|
||||
|
||||
@@ -25,8 +25,8 @@ import {
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import { CatalogSearchResultListItem } from '@backstage/plugin-catalog';
|
||||
import {
|
||||
catalogApiRef,
|
||||
CATALOG_FILTER_EXISTS,
|
||||
catalogApiRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { SearchType } from '@backstage/plugin-search';
|
||||
import {
|
||||
@@ -38,7 +38,10 @@ import {
|
||||
useSearch,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { TechDocsSearchResultListItem } from '@backstage/plugin-techdocs';
|
||||
import { Grid, makeStyles, Paper, Theme } from '@material-ui/core';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import { Theme } from '@material-ui/core/styles/createTheme';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import React from 'react';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
rules: {
|
||||
'@backstage/no-top-level-material-ui-4-imports': 'error',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
svg: {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
svg: {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import React, { PropsWithChildren } from 'react';
|
||||
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import LibraryBooks from '@material-ui/icons/LibraryBooks';
|
||||
import LogoFull from './LogoFull';
|
||||
import LogoIcon from './LogoIcon';
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { Theme, makeStyles } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Theme } from '@material-ui/core/styles/createTheme';
|
||||
|
||||
import { Box, Tooltip, IconButton } from '@material-ui/core';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import Tooltip from '@material-ui/core/Tooltip';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import LightIcon from '@material-ui/icons/Brightness7';
|
||||
import DarkIcon from '@material-ui/icons/Brightness4';
|
||||
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname, {
|
||||
rules: {
|
||||
'@backstage/no-top-level-material-ui-4-imports': 'error',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -12,9 +12,10 @@ import { ReactNode } from 'react';
|
||||
import { Theme } from '@mui/material/styles';
|
||||
import { Theme as Theme_2 } from '@material-ui/core/styles';
|
||||
import { Theme as Theme_3 } from '@material-ui/core';
|
||||
import type { Theme as Theme_4 } from '@material-ui/core/styles/createTheme';
|
||||
import { ThemeOptions } from '@mui/material/styles';
|
||||
import { ThemeOptions as ThemeOptions_2 } from '@material-ui/core/styles';
|
||||
import type { ThemeOptions as ThemeOptions_3 } from '@material-ui/core';
|
||||
import type { ThemeOptions as ThemeOptions_3 } from '@material-ui/core/styles/createTheme';
|
||||
import { UnifiedTheme as UnifiedTheme_2 } from '@backstage/theme';
|
||||
|
||||
// @public @deprecated
|
||||
@@ -91,7 +92,7 @@ export type BackstagePaletteOptions = PaletteOptions &
|
||||
BackstagePaletteAdditions;
|
||||
|
||||
// @public @deprecated
|
||||
export interface BackstageTheme extends Theme_3 {
|
||||
export interface BackstageTheme extends Theme_4 {
|
||||
// (undocumented)
|
||||
getPageTheme: (selector: PageThemeSelector) => PageTheme;
|
||||
// (undocumented)
|
||||
@@ -188,13 +189,13 @@ export function createBaseThemeOptions<PaletteOptions>(
|
||||
};
|
||||
|
||||
// @public @deprecated
|
||||
export function createTheme(options: SimpleThemeOptions): Theme_3;
|
||||
export function createTheme(options: SimpleThemeOptions): Theme_4;
|
||||
|
||||
// @public @deprecated
|
||||
export function createThemeOptions(options: SimpleThemeOptions): ThemeOptions_3;
|
||||
|
||||
// @public @deprecated
|
||||
export function createThemeOverrides(theme: Theme_3): Overrides;
|
||||
export function createThemeOverrides(theme: Theme_4): Overrides;
|
||||
|
||||
// @public
|
||||
export function createUnifiedTheme(options: UnifiedThemeOptions): UnifiedTheme;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React, { ReactNode } from 'react';
|
||||
import { CssBaseline } from '@material-ui/core';
|
||||
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||
import {
|
||||
ThemeProvider,
|
||||
StylesProvider,
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
|
||||
import { Theme as Mui5Theme } from '@mui/material/styles';
|
||||
import { createTheme as createMuiTheme } from '@material-ui/core/styles';
|
||||
import type {
|
||||
GridProps,
|
||||
SwitchProps,
|
||||
Theme,
|
||||
ThemeOptions,
|
||||
} from '@material-ui/core';
|
||||
import type { Theme, ThemeOptions } from '@material-ui/core/styles/createTheme';
|
||||
import type { GridProps } from '@material-ui/core/Grid';
|
||||
import type { SwitchProps } from '@material-ui/core/Switch';
|
||||
|
||||
import { Overrides } from '@material-ui/core/styles/overrides';
|
||||
import { SimpleThemeOptions } from './types';
|
||||
import { createBaseThemeOptions } from '../base';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import type {
|
||||
Theme as MuiTheme,
|
||||
ThemeOptions as MuiThemeOptions,
|
||||
} from '@material-ui/core';
|
||||
} from '@material-ui/core/styles/createTheme';
|
||||
import type {
|
||||
PaletteOptions as MuiPaletteOptions,
|
||||
Palette as MuiPalette,
|
||||
|
||||
Reference in New Issue
Block a user