diff --git a/.changeset/curvy-bears-nail.md b/.changeset/curvy-bears-nail.md new file mode 100644 index 0000000000..2fe6479ffc --- /dev/null +++ b/.changeset/curvy-bears-nail.md @@ -0,0 +1,5 @@ +--- +'@backstage/theme': patch +--- + +Don't use top level @material-ui imports diff --git a/packages/app/src/components/Root/LogoFull.tsx b/packages/app/src/components/Root/LogoFull.tsx index c7b1c846c4..da6911bb17 100644 --- a/packages/app/src/components/Root/LogoFull.tsx +++ b/packages/app/src/components/Root/LogoFull.tsx @@ -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: { diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index af053f623c..b74c6459d8 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -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'; diff --git a/packages/app/src/components/search/SearchModal.tsx b/packages/app/src/components/search/SearchModal.tsx index 34caeeae63..0f80d0fc68 100644 --- a/packages/app/src/components/search/SearchModal.tsx +++ b/packages/app/src/components/search/SearchModal.tsx @@ -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'; diff --git a/packages/app/src/components/search/SearchPage.tsx b/packages/app/src/components/search/SearchPage.tsx index 6914fa71cb..be1c49be1b 100644 --- a/packages/app/src/components/search/SearchPage.tsx +++ b/packages/app/src/components/search/SearchPage.tsx @@ -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) => ({ diff --git a/packages/techdocs-cli-embedded-app/src/components/Root/LogoIcon.tsx b/packages/techdocs-cli-embedded-app/src/components/Root/LogoIcon.tsx index 073cf6edad..ff4b5132b0 100644 --- a/packages/techdocs-cli-embedded-app/src/components/Root/LogoIcon.tsx +++ b/packages/techdocs-cli-embedded-app/src/components/Root/LogoIcon.tsx @@ -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: { diff --git a/packages/techdocs-cli-embedded-app/src/components/TechDocsPage/TechDocsPage.tsx b/packages/techdocs-cli-embedded-app/src/components/TechDocsPage/TechDocsPage.tsx index cc20081198..5ad0a10edb 100644 --- a/packages/techdocs-cli-embedded-app/src/components/TechDocsPage/TechDocsPage.tsx +++ b/packages/techdocs-cli-embedded-app/src/components/TechDocsPage/TechDocsPage.tsx @@ -16,7 +16,8 @@ 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 LightIcon from '@material-ui/icons/Brightness7'; diff --git a/packages/theme/report.api.md b/packages/theme/report.api.md index faec0b8456..3882c66f45 100644 --- a/packages/theme/report.api.md +++ b/packages/theme/report.api.md @@ -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( }; // @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; diff --git a/packages/theme/src/unified/UnifiedThemeProvider.tsx b/packages/theme/src/unified/UnifiedThemeProvider.tsx index 465a4dda24..e44e5502f3 100644 --- a/packages/theme/src/unified/UnifiedThemeProvider.tsx +++ b/packages/theme/src/unified/UnifiedThemeProvider.tsx @@ -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, diff --git a/packages/theme/src/v4/baseTheme.ts b/packages/theme/src/v4/baseTheme.ts index ef63e2a5fa..9f994c6b94 100644 --- a/packages/theme/src/v4/baseTheme.ts +++ b/packages/theme/src/v4/baseTheme.ts @@ -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'; diff --git a/packages/theme/src/v4/types.ts b/packages/theme/src/v4/types.ts index c5100dab8f..16b18e14bc 100644 --- a/packages/theme/src/v4/types.ts +++ b/packages/theme/src/v4/types.ts @@ -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,