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
30 changes: 30 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 @@ -559,3 +559,33 @@ If you were already using the `surplus` key via `componentsProps`, move it to `s
-<AvatarGroup componentsProps={{ surplus: { className: 'my-class' } }}>
+<AvatarGroup slotProps={{ surplus: { className: 'my-class' } }}>
```

#### Typography deprecated CSS classes removed

The deprecated `paragraph` CSS class has been removed.
Use CSS `.MuiTypography-root:where(p)` to apply custom styles for the paragraph element instead:

```diff
-.MuiTypography-paragraph {
- margin-bottom: 16px;
-}
+.MuiTypography-root:where(p) {
+ margin-bottom: 16px;
+}
```

#### Typography deprecated props removed

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

```bash
npx @mui/codemod@latest deprecations/typography-props <path>
```

The deprecated `paragraph` prop has been removed.
Use `sx` prop to add the margin bottom instead:

```diff
-<Typography paragraph />
+<Typography sx={{ marginBottom: '16px' }} />
```
13 changes: 0 additions & 13 deletions docs/pages/material-ui/api/typography.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
"component": { "type": { "name": "elementType" } },
"gutterBottom": { "type": { "name": "bool" }, "default": "false" },
"noWrap": { "type": { "name": "bool" }, "default": "false" },
"paragraph": {
"type": { "name": "bool" },
"default": "false",
"deprecated": true,
"deprecationInfo": "Use the <code>component</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"sx": {
"type": {
"name": "union",
Expand Down Expand Up @@ -157,13 +151,6 @@
"description": "Styles applied to the root element if `variant=\"overline\"`.",
"isGlobal": false
},
{
"key": "paragraph",
"className": "MuiTypography-paragraph",
"description": "Styles applied to the root element if `paragraph={true}`.",
"isGlobal": false,
"isDeprecated": true
},
{
"key": "root",
"className": "MuiTypography-root",
Expand Down
8 changes: 0 additions & 8 deletions docs/translations/api-docs/typography/typography.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"noWrap": {
"description": "If <code>true</code>, the text will not wrap, but instead will truncate with a text overflow ellipsis.<br>Note that text overflow can only happen with block or inline-block level elements (the element needs to have a width in order to overflow)."
},
"paragraph": {
"description": "If <code>true</code>, the element will be a paragraph element."
},
"sx": {
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
},
Expand Down Expand Up @@ -116,11 +113,6 @@
"nodeName": "the root element",
"conditions": "<code>variant=\"overline\"</code>"
},
"paragraph": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>paragraph={true}</code>"
},
"root": { "description": "Styles applied to the root element." },
"subtitle1": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
Expand Down
6 changes: 0 additions & 6 deletions packages/mui-material/src/Typography/Typography.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ export interface TypographyOwnProps extends Omit<SystemProps<Theme>, 'color'> {
* @default false
*/
noWrap?: boolean | undefined;
/**
* If `true`, the element will be a paragraph element.
* @default false
* @deprecated Use the `component` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
paragraph?: boolean | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
22 changes: 2 additions & 20 deletions packages/mui-material/src/Typography/Typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const v6Colors = {
const extendSxProp = internal_createExtendSxProp();

const useUtilityClasses = (ownerState) => {
const { align, gutterBottom, noWrap, paragraph, variant, classes } = ownerState;
const { align, gutterBottom, noWrap, variant, classes } = ownerState;

const slots = {
root: [
Expand All @@ -34,7 +34,6 @@ const useUtilityClasses = (ownerState) => {
ownerState.align !== 'inherit' && `align${capitalize(align)}`,
gutterBottom && 'gutterBottom',
noWrap && 'noWrap',
paragraph && 'paragraph',
],
};

Expand All @@ -53,7 +52,6 @@ export const TypographyRoot = styled('span', {
ownerState.align !== 'inherit' && styles[`align${capitalize(ownerState.align)}`],
ownerState.noWrap && styles.noWrap,
ownerState.gutterBottom && styles.gutterBottom,
ownerState.paragraph && styles.paragraph,
];
},
})(
Expand Down Expand Up @@ -113,12 +111,6 @@ export const TypographyRoot = styled('span', {
marginBottom: '0.35em',
},
},
{
props: ({ ownerState }) => ownerState.paragraph,
style: {
marginBottom: 16,
},
},
],
})),
);
Expand Down Expand Up @@ -152,7 +144,6 @@ const Typography = React.forwardRef(function Typography(inProps, ref) {
component,
gutterBottom = false,
noWrap = false,
paragraph = false,
variant = 'body1',
variantMapping = defaultVariantMapping,
...other
Expand All @@ -166,15 +157,12 @@ const Typography = React.forwardRef(function Typography(inProps, ref) {
component,
gutterBottom,
noWrap,
paragraph,
variant,
variantMapping,
};

const Component =
component ||
(paragraph ? 'p' : variantMapping[variant] || defaultVariantMapping[variant]) ||
'span';
component || variantMapping[variant] || defaultVariantMapping[variant] || 'span';

const classes = useUtilityClasses(ownerState);

Expand Down Expand Up @@ -252,12 +240,6 @@ Typography.propTypes /* remove-proptypes */ = {
* @default false
*/
noWrap: PropTypes.bool,
/**
* If `true`, the element will be a paragraph element.
* @default false
* @deprecated Use the `component` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
paragraph: PropTypes.bool,
/**
* @ignore
*/
Expand Down
6 changes: 0 additions & 6 deletions packages/mui-material/src/Typography/Typography.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ describe('<Typography />', () => {
expect(screen.getByText(/hello/i).tagName).to.equal('SPAN');
});

it('should render a p with a paragraph', () => {
render(<Typography paragraph>Hello</Typography>);

expect(screen.getByText(/hello/i).tagName).to.equal('P');
});

it('should render the mapped headline', () => {
render(<Typography variant="h6">Hello</Typography>);

Expand Down
6 changes: 0 additions & 6 deletions packages/mui-material/src/Typography/typographyClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ export interface TypographyClasses {
noWrap: string;
/** Styles applied to the root element if `gutterBottom={true}`. */
gutterBottom: string;
/**
* Styles applied to the root element if `paragraph={true}`.
* @deprecated
*/
paragraph: string;
}

export type TypographyClassKey = keyof TypographyClasses;
Expand Down Expand Up @@ -79,7 +74,6 @@ const typographyClasses: TypographyClasses = generateUtilityClasses('MuiTypograp
'alignJustify',
'noWrap',
'gutterBottom',
'paragraph',
]);

export default typographyClasses;
Loading