From 2581ebdacb132ea928ec088d64bd0a60884e210c Mon Sep 17 00:00:00 2001 From: Spenser Emery Date: Wed, 3 Jul 2024 10:00:52 -0400 Subject: [PATCH] Reduce bundle size by fixing material-icon imports * Reduce size of bundles by avoiding `import X from '@mui/icons-material'` style import statements * Fixes #2350 --- .../src/additional/ListWithDetailMasterItem.tsx | 2 +- .../src/complex/MaterialTableControl.tsx | 8 +++----- .../material-renderers/src/complex/TableToolbar.tsx | 2 +- .../material-renderers/src/complex/ValidationIcon.tsx | 2 +- .../src/layouts/ExpandPanelRenderer.tsx | 10 ++++------ .../src/mui-controls/MuiInputText.tsx | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/material-renderers/src/additional/ListWithDetailMasterItem.tsx b/packages/material-renderers/src/additional/ListWithDetailMasterItem.tsx index 69d126e36e..95276ae675 100644 --- a/packages/material-renderers/src/additional/ListWithDetailMasterItem.tsx +++ b/packages/material-renderers/src/additional/ListWithDetailMasterItem.tsx @@ -33,7 +33,7 @@ import { ListItemText, Tooltip, } from '@mui/material'; -import { Delete as DeleteIcon } from '@mui/icons-material'; +import DeleteIcon from '@mui/icons-material/Delete'; import React from 'react'; export const ListWithDetailMasterItem = ({ diff --git a/packages/material-renderers/src/complex/MaterialTableControl.tsx b/packages/material-renderers/src/complex/MaterialTableControl.tsx index 2675bc1f00..e221894a88 100644 --- a/packages/material-renderers/src/complex/MaterialTableControl.tsx +++ b/packages/material-renderers/src/complex/MaterialTableControl.tsx @@ -57,11 +57,9 @@ import { encode, ArrayTranslations, } from '@jsonforms/core'; -import { - Delete as DeleteIcon, - ArrowDownward, - ArrowUpward, -} from '@mui/icons-material'; +import DeleteIcon from '@mui/icons-material/Delete'; +import ArrowDownward from '@mui/icons-material/ArrowDownward'; +import ArrowUpward from '@mui/icons-material/ArrowUpward'; import { WithDeleteDialogSupport } from './DeleteDialog'; import NoBorderTableCell from './NoBorderTableCell'; diff --git a/packages/material-renderers/src/complex/TableToolbar.tsx b/packages/material-renderers/src/complex/TableToolbar.tsx index 5d71356e02..c23c009d5b 100644 --- a/packages/material-renderers/src/complex/TableToolbar.tsx +++ b/packages/material-renderers/src/complex/TableToolbar.tsx @@ -38,7 +38,7 @@ import { FormHelperText, Stack, } from '@mui/material'; -import { Add as AddIcon } from '@mui/icons-material'; +import AddIcon from '@mui/icons-material/Add'; import ValidationIcon from './ValidationIcon'; import NoBorderTableCell from './NoBorderTableCell'; diff --git a/packages/material-renderers/src/complex/ValidationIcon.tsx b/packages/material-renderers/src/complex/ValidationIcon.tsx index 9a566e031d..21fb98166a 100644 --- a/packages/material-renderers/src/complex/ValidationIcon.tsx +++ b/packages/material-renderers/src/complex/ValidationIcon.tsx @@ -24,7 +24,7 @@ */ import React from 'react'; -import { ErrorOutline as ErrorOutlineIcon } from '@mui/icons-material'; +import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline'; import { Badge, Tooltip, styled } from '@mui/material'; const StyledBadge = styled(Badge)(({ theme }: any) => ({ diff --git a/packages/material-renderers/src/layouts/ExpandPanelRenderer.tsx b/packages/material-renderers/src/layouts/ExpandPanelRenderer.tsx index 3e1d1bbcd6..fc02b28e6b 100644 --- a/packages/material-renderers/src/layouts/ExpandPanelRenderer.tsx +++ b/packages/material-renderers/src/layouts/ExpandPanelRenderer.tsx @@ -40,12 +40,10 @@ import { IconButton, Tooltip, } from '@mui/material'; -import { - ExpandMore as ExpandMoreIcon, - Delete as DeleteIcon, - ArrowUpward, - ArrowDownward, -} from '@mui/icons-material'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import ArrowUpward from '@mui/icons-material/ArrowUpward'; +import ArrowDownward from '@mui/icons-material/ArrowDownward'; +import DeleteIcon from '@mui/icons-material/Delete'; const iconStyle: any = { float: 'right' }; diff --git a/packages/material-renderers/src/mui-controls/MuiInputText.tsx b/packages/material-renderers/src/mui-controls/MuiInputText.tsx index f0391e027d..de4845af41 100644 --- a/packages/material-renderers/src/mui-controls/MuiInputText.tsx +++ b/packages/material-renderers/src/mui-controls/MuiInputText.tsx @@ -32,7 +32,7 @@ import { useTheme, } from '@mui/material'; import merge from 'lodash/merge'; -import { Close } from '@mui/icons-material'; +import Close from '@mui/icons-material/Close'; import { JsonFormsTheme, WithInputProps,