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][Hidden] Remove deprecated Hidden component #45283

Merged
merged 7 commits into from
Feb 12, 2025
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
175 changes: 86 additions & 89 deletions apps/pigment-css-next-app/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Image from 'next/image';
import { styled, css } from '@mui/material-pigment-css';
import PigmentStack from '@mui/material/PigmentStack';
import PigmentContainer from '@mui/material/PigmentContainer';
import PigmentHidden from '@mui/material/PigmentHidden';
import styles from './page.module.css';

const visuallyHidden = css({
Expand Down Expand Up @@ -94,101 +93,99 @@ const Description = styled.div({

export default function Home() {
return (
<PigmentHidden implementation="css" only="xs">
<PigmentContainer maxWidth="md">
<Main>
<PigmentStack spacing={2}>
<div>Test</div>
<div>Test</div>
<div>Test</div>
</PigmentStack>
<div className={visuallyHidden}>I am invisible</div>
<Description>
<p>
Get started by editing&nbsp;
<code className={styles.code}>src/app/page.tsx</code>
</p>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener"
>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</Description>

<div className={styles.center}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<div className={styles.grid}>
<PigmentContainer maxWidth="md">
<Main>
<PigmentStack spacing={2}>
<div>Test</div>
<div>Test</div>
<div>Test</div>
</PigmentStack>
<div className={visuallyHidden}>I am invisible</div>
<Description>
<p>
Get started by editing&nbsp;
<code className={styles.code}>src/app/page.tsx</code>
</p>
<div>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</Description>

<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>Learn about Next.js in an interactive course with&nbsp;quizzes!</p>
</a>
<div className={styles.center}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>Explore the Next.js 13 playground.</p>
</a>
<div className={styles.grid}>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>Instantly deploy your Next.js site to a shareable URL with Vercel.</p>
</a>
</div>
</Main>
</PigmentContainer>
</PigmentHidden>
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>Learn about Next.js in an interactive course with&nbsp;quizzes!</p>
</a>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>Explore the Next.js 13 playground.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>Instantly deploy your Next.js site to a shareable URL with Vercel.</p>
</a>
</div>
</Main>
</PigmentContainer>
);
}
19 changes: 0 additions & 19 deletions docs/data/material/components/hidden/hidden.md

This file was deleted.

28 changes: 28 additions & 0 deletions docs/data/material/migration/upgrade-to-v7/upgrade-to-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@
Expect updates as new breaking changes are introduced.
:::

### Hidden and PigmentHidden components removed

The deprecated `Hidden` and `PigmentHidden` components have been removed.

Use the `sx` prop to replace `implementation="css"`:

```diff
-<Hidden implementation="css" xlUp><Paper /></Hidden>
+<Paper sx={{ display: { xl: 'none', xs: 'block' } }} />
```

```diff
-<Hidden implementation="css" mdDown><Paper /></Hidden>
+<Paper sx={{ display: { xs: 'none', md: 'block' } }} />
```
aarongarciah marked this conversation as resolved.
Show resolved Hide resolved

Use the `useMediaQuery` hook to replace `implementation="js"`:

```diff
-<Hidden implementation="js" xlUp><Paper /></Hidden>
+const hidden = useMediaQuery(theme => theme.breakpoints.up('xl'));
+return hidden ? null : <Paper />;
```

:::warning
There's no codemod available for this change, as each project's setup will heavily influence the migration.

Check warning on line 52 in docs/data/material/migration/upgrade-to-v7/upgrade-to-v7.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/data/material/migration/upgrade-to-v7/upgrade-to-v7.md", "range": {"start": {"line": 52, "column": 71}}}, "severity": "WARNING"}
:::

### Lab components moved to the main package

The following `@mui/lab` components and hook have been moved to `@mui/material`:
Expand Down
1 change: 0 additions & 1 deletion docs/data/material/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const pages: MuiPage[] = [
{ pathname: '/material-ui/react-grid2', title: 'Grid v2' },
{ pathname: '/material-ui/react-stack' },
{ pathname: '/material-ui/react-image-list', title: 'Image List' },
{ pathname: '/material-ui/react-hidden', deprecated: true },
],
},
{
Expand Down
2 changes: 0 additions & 2 deletions docs/data/material/pagesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ module.exports = [
{ pathname: '/material-ui/api/grid' },
{ pathname: '/material-ui/api/grid-2' },
{ pathname: '/material-ui/api/grow' },
{ pathname: '/material-ui/api/hidden' },
{ pathname: '/material-ui/api/icon' },
{ pathname: '/material-ui/api/icon-button' },
{ pathname: '/material-ui/api/image-list' },
Expand Down Expand Up @@ -84,7 +83,6 @@ module.exports = [
{ pathname: '/material-ui/api/paper' },
{ pathname: '/material-ui/api/pigment-container' },
{ pathname: '/material-ui/api/pigment-grid' },
{ pathname: '/material-ui/api/pigment-hidden' },
{ pathname: '/material-ui/api/pigment-stack' },
{ pathname: '/material-ui/api/popover' },
{ pathname: '/material-ui/api/popper' },
Expand Down
19 changes: 0 additions & 19 deletions docs/pages/material-ui/api/hidden.js

This file was deleted.

45 changes: 0 additions & 45 deletions docs/pages/material-ui/api/hidden.json

This file was deleted.

23 changes: 0 additions & 23 deletions docs/pages/material-ui/api/pigment-hidden.js

This file was deleted.

Loading
Loading