Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Toolbar = styled(MuiToolbar)({
justifyContent: 'center',
gap: '12px',
flexShrink: 0,
[`& ${tabsClasses.flexContainer}`]: {
[`& ${tabsClasses.list}`]: {
gap: '8px',
p: '8px',
pb: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Toolbar = styled(MuiToolbar)({
justifyContent: 'center',
gap: '12px',
flexShrink: 0,
[`& ${tabsClasses.flexContainer}`]: {
[`& ${tabsClasses.list}`]: {
gap: '8px',
p: '8px',
pb: 0,
Expand Down
32 changes: 32 additions & 0 deletions docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,38 @@ The following deprecated props have been removed:
/>
```

#### Tab deprecated classes removed

Use the [tab-classes codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#tab-classes) below to migrate the code as described in the following section:

```bash
npx @mui/codemod@latest deprecations/tab-classes <path>
```

The following deprecated class has been removed:

- `iconWrapper` — use the `icon` class instead

```diff
-.MuiTab-iconWrapper
+.MuiTab-icon
```

#### Tabs deprecated classes removed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it missing the sentence about the codemod?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no tabs-classes codemod.


The following deprecated classes have been removed:

- `flexContainer` — use the `list` class instead
- `flexContainerVertical` — combine the `list` and `vertical` classes instead

```diff
-.MuiTabs-flexContainer
+.MuiTabs-list

-.MuiTabs-flexContainerVertical
+.MuiTabs-list.MuiTabs-vertical
```

#### ToggleButtonGroup deprecated CSS classes removed

Use the [toggle-button-group-classes codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#toggle-button-group-classes) below to migrate the code as described in the following section:
Expand Down
14 changes: 0 additions & 14 deletions docs/pages/material-ui/api/tab-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@
"description": "Styles applied to the tablist element if `!variant=\"scrollable\"`\b\b\b.",
"isGlobal": false
},
{
"key": "flexContainer",
"className": "MuiTabList-flexContainer",
"description": "",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "flexContainerVertical",
"className": "MuiTabList-flexContainerVertical",
"description": "",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "hideScrollbar",
"className": "MuiTabList-hideScrollbar",
Expand Down
7 changes: 0 additions & 7 deletions docs/pages/material-ui/api/tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@
"description": "Styles applied to the `icon` HTML element if both `icon` and `label` are provided.",
"isGlobal": false
},
{
"key": "iconWrapper",
"className": "MuiTab-iconWrapper",
"description": "Styles applied to the `icon` HTML element if both `icon` and `label` are provided.",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "labelIcon",
"className": "MuiTab-labelIcon",
Expand Down
14 changes: 0 additions & 14 deletions docs/pages/material-ui/api/tabs.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,6 @@
"description": "Styles applied to the tablist element if `!variant=\"scrollable\"`\b\b\b.",
"isGlobal": false
},
{
"key": "flexContainer",
"className": "MuiTabs-flexContainer",
"description": "",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "flexContainerVertical",
"className": "MuiTabs-flexContainerVertical",
"description": "",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "hideScrollbar",
"className": "MuiTabs-hideScrollbar",
Expand Down
8 changes: 0 additions & 8 deletions docs/translations/api-docs/tab-list/tab-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
"nodeName": "the tablist element",
"conditions": "<code>!variant=\"scrollable\"</code>\b\b\b"
},
"flexContainer": {
"description": "",
"deprecationInfo": "use <code>list</code> instead. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"flexContainerVertical": {
"description": "",
"deprecationInfo": "use a combination of <code>list</code> and <code>vertical</code> instead. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"hideScrollbar": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the tablist element",
Expand Down
6 changes: 0 additions & 6 deletions docs/translations/api-docs/tab/tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
"nodeName": "the <code>icon</code> HTML element",
"conditions": "both <code>icon</code> and <code>label</code> are provided"
},
"iconWrapper": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the <code>icon</code> HTML element",
"conditions": "both <code>icon</code> and <code>label</code> are provided",
"deprecationInfo": "Use <code>icon</code> class instead. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details"
},
"labelIcon": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
Expand Down
8 changes: 0 additions & 8 deletions docs/translations/api-docs/tabs/tabs.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@
"nodeName": "the tablist element",
"conditions": "<code>!variant=\"scrollable\"</code>\b\b\b"
},
"flexContainer": {
"description": "",
"deprecationInfo": "use <code>list</code> instead. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"flexContainerVertical": {
"description": "",
"deprecationInfo": "use a combination of <code>list</code> and <code>vertical</code> instead. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"hideScrollbar": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the tablist element",
Expand Down
5 changes: 1 addition & 4 deletions packages/mui-material/src/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useUtilityClasses = (ownerState) => {
selected && 'selected',
disabled && 'disabled',
],
icon: ['iconWrapper', 'icon'],
icon: ['icon'],
};

return composeClasses(slots, getTabUtilityClass, classes);
Expand All @@ -42,9 +42,6 @@ const TabRoot = styled(ButtonBase, {
styles[`textColor${capitalize(ownerState.textColor)}`],
ownerState.fullWidth && styles.fullWidth,
ownerState.wrapped && styles.wrapped,
{
[`& .${tabClasses.iconWrapper}`]: styles.iconWrapper,
},
{
[`& .${tabClasses.icon}`]: styles.icon,
},
Expand Down
61 changes: 0 additions & 61 deletions packages/mui-material/src/Tab/Tab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ describe('<Tab />', () => {
it('should add a classname when passed together with label', () => {
render(<Tab icon={<div className="test-icon" />} label="foo" />);
const wrapper = screen.getByRole('tab').children[0];
expect(wrapper).to.have.class(classes.iconWrapper);
expect(wrapper).to.have.class(classes.icon);
expect(wrapper).to.have.class('test-icon');
});
Expand Down Expand Up @@ -160,31 +159,6 @@ describe('<Tab />', () => {
});
});

it.skipIf(isJsdom())('should apply iconWrapper styles from theme', function test() {
const theme = createTheme({
components: {
MuiTab: {
styleOverrides: {
iconWrapper: {
backgroundColor: 'rgb(0, 0, 255)',
},
},
},
},
});

render(
<ThemeProvider theme={theme}>
<Tab icon={<div>hello</div>} label="icon" />
</ThemeProvider>,
);

const icon = screen.getByRole('tab').querySelector(`.${classes.iconWrapper}`);
expect(icon).toHaveComputedStyle({
backgroundColor: 'rgb(0, 0, 255)',
});
});

it.skipIf(isJsdom())('should apply icon styles from theme', function test() {
const theme = createTheme({
components: {
Expand All @@ -209,39 +183,4 @@ describe('<Tab />', () => {
backgroundColor: 'rgb(0, 0, 255)',
});
});

it.skipIf(isJsdom())(
'icon styles should override iconWrapper styles from theme',
function test() {
const theme = createTheme({
components: {
MuiTab: {
styleOverrides: {
iconWrapper: {
backgroundColor: 'rgb(255, 0, 0)',
},
icon: {
backgroundColor: 'rgb(0, 0, 255)',
},
},
},
},
});

render(
<ThemeProvider theme={theme}>
<Tab icon={<div>hello</div>} label="icon" />
</ThemeProvider>,
);

const icon = screen.getByRole('tab').querySelector(`.${classes.icon}`);
const iconWrapper = screen.getByRole('tab').querySelector(`.${classes.iconWrapper}`);
expect(iconWrapper).toHaveComputedStyle({
backgroundColor: 'rgb(0, 0, 255)',
});
expect(icon).toHaveComputedStyle({
backgroundColor: 'rgb(0, 0, 255)',
});
},
);
});
5 changes: 0 additions & 5 deletions packages/mui-material/src/Tab/tabClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export interface TabClasses {
fullWidth: string;
/** Styles applied to the root element if `wrapped={true}`. */
wrapped: string;
/** Styles applied to the `icon` HTML element if both `icon` and `label` are provided.
* @deprecated Use `icon` class instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details
*/
iconWrapper: string;
/** Styles applied to the `icon` HTML element if both `icon` and `label` are provided. */
icon: string;
}
Expand All @@ -44,7 +40,6 @@ const tabClasses: TabClasses = generateUtilityClasses('MuiTab', [
'disabled',
'fullWidth',
'wrapped',
'iconWrapper',
'icon',
]);

Expand Down
17 changes: 3 additions & 14 deletions packages/mui-material/src/Tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ const useUtilityClasses = (ownerState) => {
scrollableX && 'scrollableX',
scrollableY && 'scrollableY',
],
list: [
'list',
'flexContainer',
vertical && 'flexContainerVertical',
vertical && 'vertical',
centered && 'centered',
],
list: ['list', vertical && 'vertical', centered && 'centered'],
indicator: ['indicator'],
scrollButtons: ['scrollButtons', scrollButtonsHideMobile && 'scrollButtonsHideMobile'],
scrollableX: [scrollableX && 'scrollableX'],
Expand Down Expand Up @@ -160,12 +154,7 @@ const List = styled('div', {
slot: 'List',
overridesResolver: (props, styles) => {
const { ownerState } = props;
return [
styles.list,
styles.flexContainer,
ownerState.vertical && styles.flexContainerVertical,
ownerState.centered && styles.centered,
];
return [styles.list, ownerState.centered && styles.centered];
},
})({
display: 'flex',
Expand Down Expand Up @@ -822,7 +811,7 @@ const Tabs = React.forwardRef(function Tabs(inProps, ref) {

const [ListSlot, listSlotProps] = useSlot('list', {
ref: mergedRef,
className: clsx(classes.list, classes.flexContainer),
className: classes.list,
elementType: List,
externalForwardedProps,
ownerState,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Tabs/Tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe.skipIf(isSafari)('<Tabs />', () => {
<Tab />
</Tabs>,
);
const selector = `.${classes.flexContainer}.${classes.centered}`;
const selector = `.${classes.list}.${classes.centered}`;
expect(container.querySelector(selector).nodeName).to.equal('DIV');
});
});
Expand Down
8 changes: 0 additions & 8 deletions packages/mui-material/src/Tabs/tabsClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ export interface TabsClasses {
root: string;
/** Styles applied to the root element if `orientation="vertical"`. */
vertical: string;
/** Styles applied to the flex container element. */
/** @deprecated use `list` instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */
flexContainer: string;
/** Styles applied to the flex container element if `orientation="vertical"`. */
/** @deprecated use a combination of `list` and `vertical` instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */
flexContainerVertical: string;
/** Styles applied to the list element. */
list: string;
/** Styles applied to the flex container element if `centered={true}` & `!variant="scrollable"`. */
Expand Down Expand Up @@ -44,8 +38,6 @@ const tabsClasses: TabsClasses = generateUtilityClasses('MuiTabs', [
'root',
'vertical',
'list',
'flexContainer',
'flexContainerVertical',
'centered',
'scroller',
'fixed',
Expand Down
Loading