Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][ListItem] Removing deprecated props #41566

Merged
merged 30 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2efb7a1
Removing deprecated props from material-ui ListItem
Mar 20, 2024
6a09a81
Removed ListItem's dependency on ExtendButtonBase
Mar 20, 2024
5fde6a0
Merge branch 'next' into material-ui-listitem-remove-props
Mar 22, 2024
5a84d05
Updated migration document
Mar 22, 2024
418bf7a
Adding space between headings in markdown
Mar 22, 2024
8f8db62
Rephrasing breaking changes section in migration doc
Mar 25, 2024
503d663
Merge branch 'next' into material-ui-listitem-remove-props
Apr 10, 2024
6e14621
Codemod changes for converting ListItem to ListItemButton
Apr 10, 2024
86242b4
Fixing failed test case related to component
Apr 11, 2024
9b31019
Fixing failing theme related test case
Apr 12, 2024
0947ef8
Updated test cases for codemod
Apr 17, 2024
7f6f9f4
Merge branch 'next' into material-ui-listitem-remove-props
Jun 13, 2024
c1179d4
Merge branch 'next' into material-ui-listitem-remove-props
Jun 16, 2024
37946b2
Merge branch 'next' into material-ui-listitem-remove-props
mnajdova Jul 31, 2024
463ced8
Update the migration guide
mnajdova Jul 31, 2024
1e1630c
wrong import
mnajdova Jul 31, 2024
fdb20e9
improve codemod
mnajdova Jul 31, 2024
2e38c09
lint issues
mnajdova Jul 31, 2024
60dfaf5
improve codemod
mnajdova Jul 31, 2024
a9861fe
finish codemod
mnajdova Jul 31, 2024
5e78016
fixed some issues
mnajdova Jul 31, 2024
0e23f10
docs:typescript:formatted
mnajdova Jul 31, 2024
c312da3
remove style assosiated with some of the removed classes
mnajdova Jul 31, 2024
842d1f6
remove unused import
mnajdova Jul 31, 2024
21bc5f4
add codemod instructions, fix theme codemod
mnajdova Aug 2, 2024
5bde93a
Update docs/data/material/migration/migrating-to-v6/migrating-to-v6.md
mnajdova Aug 5, 2024
b40c0f5
Merge branch 'next' into material-ui-listitem-remove-props
mnajdova Aug 8, 2024
ffa33da
Fix usage of wrong class names
mnajdova Aug 8, 2024
30aa518
Update docs/data/material/migration/migrating-to-v6/migrating-to-v6.md
mnajdova Aug 8, 2024
ac75cc6
Update docs/data/material/migration/migrating-to-v6/migrating-to-v6.md
mnajdova Aug 8, 2024
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
6 changes: 3 additions & 3 deletions docs/data/material/integrations/routing/ListRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import List from '@mui/material/List';
import Box from '@mui/material/Box';
import ListItem from '@mui/material/ListItem';
import Paper from '@mui/material/Paper';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
Expand All @@ -18,6 +17,7 @@ import {
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import { ListItemButton } from '@mui/material';

function Router(props) {
const { children } = props;
Expand Down Expand Up @@ -45,10 +45,10 @@ function ListItemLink(props) {

return (
<li>
<ListItem button component={Link} to={to}>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItem>
</ListItemButton>
</li>
);
}
Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/integrations/routing/ListRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import List from '@mui/material/List';
import Box from '@mui/material/Box';
import ListItem from '@mui/material/ListItem';
import Paper from '@mui/material/Paper';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
Expand All @@ -18,6 +17,7 @@ import {
useLocation,
} from 'react-router-dom';
import { StaticRouter } from 'react-router-dom/server';
import { ListItemButton } from '@mui/material';

function Router(props: { children?: React.ReactNode }) {
const { children } = props;
Expand Down Expand Up @@ -49,10 +49,10 @@ function ListItemLink(props: ListItemLinkProps) {

return (
<li>
<ListItem button component={Link} to={to}>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItem>
</ListItemButton>
</li>
);
}
Expand Down
48 changes: 0 additions & 48 deletions docs/pages/material-ui/api/list-item.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@
"type": { "name": "enum", "description": "'center'<br>&#124;&nbsp;'flex-start'" },
"default": "'center'"
},
"autoFocus": {
"type": { "name": "bool" },
"default": "false",
"deprecated": true,
"deprecationInfo": "checkout <a href=\"/material-ui/api/list-item-button/\">ListItemButton</a> instead"
},
"button": {
"type": { "name": "bool" },
"default": "false",
"deprecated": true,
"deprecationInfo": "checkout <a href=\"/material-ui/api/list-item-button/\">ListItemButton</a> instead"
},
"children": { "type": { "name": "custom", "description": "node" } },
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
"component": { "type": { "name": "elementType" } },
Expand All @@ -34,22 +22,10 @@
},
"ContainerProps": { "type": { "name": "object" }, "default": "{}", "deprecated": true },
"dense": { "type": { "name": "bool" }, "default": "false" },
"disabled": {
"type": { "name": "bool" },
"default": "false",
"deprecated": true,
"deprecationInfo": "checkout <a href=\"/material-ui/api/list-item-button/\">ListItemButton</a> instead"
},
"disableGutters": { "type": { "name": "bool" }, "default": "false" },
"disablePadding": { "type": { "name": "bool" }, "default": "false" },
"divider": { "type": { "name": "bool" }, "default": "false" },
"secondaryAction": { "type": { "name": "node" } },
"selected": {
"type": { "name": "bool" },
"default": "false",
"deprecated": true,
"deprecationInfo": "checkout <a href=\"/material-ui/api/list-item-button/\">ListItemButton</a> instead"
},
"slotProps": {
"type": { "name": "shape", "description": "{ root?: object }" },
"default": "{}"
Expand Down Expand Up @@ -78,12 +54,6 @@
"description": "Styles applied to the component element if `alignItems=\"flex-start\"`.",
"isGlobal": false
},
{
"key": "button",
"className": "MuiListItem-button",
"description": "Styles applied to the inner `component` element if `button={true}`.",
"isGlobal": false
},
{
"key": "container",
"className": "MuiListItem-container",
Expand All @@ -96,24 +66,12 @@
"description": "Styles applied to the component element if dense.",
"isGlobal": false
},
{
"key": "disabled",
"className": "Mui-disabled",
"description": "State class applied to the inner `component` element if `disabled={true}`.",
"isGlobal": true
},
{
"key": "divider",
"className": "MuiListItem-divider",
"description": "Styles applied to the inner `component` element if `divider={true}`.",
"isGlobal": false
},
{
"key": "focusVisible",
"className": "Mui-focusVisible",
"description": "State class applied to the `component`'s `focusVisibleClassName` prop if `button={true}`.",
"isGlobal": true
},
{
"key": "gutters",
"className": "MuiListItem-gutters",
Expand All @@ -137,12 +95,6 @@
"className": "MuiListItem-secondaryAction",
"description": "Styles applied to the component element if `children` includes `ListItemSecondaryAction`.",
"isGlobal": false
},
{
"key": "selected",
"className": "Mui-selected",
"description": "State class applied to the root element if `selected={true}`.",
"isGlobal": true
}
],
"spread": true,
Expand Down
28 changes: 0 additions & 28 deletions docs/translations/api-docs/list-item/list-item.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"componentDescription": "Uses an additional container component if `ListItemSecondaryAction` is the last child.",
"propDescriptions": {
"alignItems": { "description": "Defines the <code>align-items</code> style property." },
"autoFocus": {
"description": "If <code>true</code>, the list item is focused during the first mount. Focus will also be triggered if the value changes from false to true."
},
"button": {
"description": "If <code>true</code>, the list item is a button (using <code>ButtonBase</code>). Props intended for <code>ButtonBase</code> can then be applied to <code>ListItem</code>."
},
"children": {
"description": "The content of the component if a <code>ListItemSecondaryAction</code> is used it must be the last child."
},
Expand All @@ -29,7 +23,6 @@
"dense": {
"description": "If <code>true</code>, compact vertical padding designed for keyboard and mouse input is used. The prop defaults to the value inherited from the parent List component."
},
"disabled": { "description": "If <code>true</code>, the component is disabled." },
"disableGutters": {
"description": "If <code>true</code>, the left and right padding is removed."
},
Expand All @@ -38,7 +31,6 @@
"description": "If <code>true</code>, a 1px light border is added to the bottom of the list item."
},
"secondaryAction": { "description": "The element to display at the end of ListItem." },
"selected": { "description": "Use to apply selected styling." },
"slotProps": {
"description": "The extra props for the slot components. You can override the existing props or add new ones.<br>This prop is an alias for the <code>componentsProps</code> prop, which will be deprecated in the future."
},
Expand All @@ -55,11 +47,6 @@
"nodeName": "the component element",
"conditions": "<code>alignItems=\"flex-start\"</code>"
},
"button": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the inner <code>component</code> element",
"conditions": "<code>button={true}</code>"
},
"container": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the container element",
Expand All @@ -70,21 +57,11 @@
"nodeName": "the component element",
"conditions": "dense"
},
"disabled": {
"description": "State class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the inner <code>component</code> element",
"conditions": "<code>disabled={true}</code>"
},
"divider": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the inner <code>component</code> element",
"conditions": "<code>divider={true}</code>"
},
"focusVisible": {
"description": "State class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the <code>component</code>&#39;s <code>focusVisibleClassName</code> prop",
"conditions": "<code>button={true}</code>"
},
"gutters": {
"description": "Styles applied to {{nodeName}} unless {{conditions}}.",
"nodeName": "the inner <code>component</code> element",
Expand All @@ -103,11 +80,6 @@
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the component element",
"conditions": "<code>children</code> includes <code>ListItemSecondaryAction</code>"
},
"selected": {
"description": "State class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>selected={true}</code>"
}
}
}
50 changes: 2 additions & 48 deletions packages/mui-material/src/ListItem/ListItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ export interface ListItemBaseProps {
* @default 'center'
*/
alignItems?: 'flex-start' | 'center';
/**
* If `true`, the list item is focused during the first mount.
* Focus will also be triggered if the value changes from false to true.
* @default false
* @deprecated checkout [ListItemButton](/material-ui/api/list-item-button/) instead
*/
autoFocus?: boolean;
/**
* The content of the component if a `ListItemSecondaryAction` is used it must
* be the last child.
Expand Down Expand Up @@ -50,12 +43,6 @@ export interface ListItemBaseProps {
* @default false
*/
dense?: boolean;
/**
* If `true`, the component is disabled.
* @default false
* @deprecated checkout [ListItemButton](/material-ui/api/list-item-button/) instead
*/
disabled?: boolean;
/**
* If `true`, the left and right padding is removed.
* @default false
Expand All @@ -75,12 +62,6 @@ export interface ListItemBaseProps {
* The element to display at the end of ListItem.
*/
secondaryAction?: React.ReactNode;
/**
* Use to apply selected styling.
* @default false
* @deprecated checkout [ListItemButton](/material-ui/api/list-item-button/) instead
*/
selected?: boolean;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down Expand Up @@ -151,35 +132,8 @@ export interface ListItemTypeMap<AdditionalProps, RootComponent extends React.El
*
* - [ListItem API](https://mui.com/material-ui/api/list-item/)
*/
declare const ListItem: ExtendButtonBase<
ListItemTypeMap<
{
/**
* If `true`, the list item is a button (using `ButtonBase`). Props intended
* for `ButtonBase` can then be applied to `ListItem`.
* @default false
* @deprecated checkout [ListItemButton](/material-ui/api/list-item-button/) instead
*
*/
button: true;
},
'div'
>
> &
OverridableComponent<
ListItemTypeMap<
{
/**
* If `true`, the list item is a button (using `ButtonBase`). Props intended
* for `ButtonBase` can then be applied to `ListItem`.
* @default false
* @deprecated checkout [ListItemButton](/material-ui/api/list-item-button/) instead
*/
button?: false;
},
'li'
>
>;
declare const ListItem: ExtendButtonBase<ListItemTypeMap<{}, 'div'>> &
DiegoAndai marked this conversation as resolved.
Show resolved Hide resolved
OverridableComponent<ListItemTypeMap<{}, 'li'>>;

export type ListItemProps<
RootComponent extends React.ElementType = 'li',
Expand Down
Loading
Loading