From 1f1f69f143560e68868315f0c72799d196c46fef Mon Sep 17 00:00:00 2001 From: sai6855 Date: Wed, 13 Mar 2024 20:45:13 +0530 Subject: [PATCH] Support CSS extraction --- .../src/app/material-ui/react-modal/page.tsx | 51 ++++++++++++++++++ .../src/pages/material-ui/react-modal.tsx | 52 +++++++++++++++++++ packages/mui-material/src/Modal/Modal.js | 19 ++++--- 3 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 apps/pigment-next-app/src/app/material-ui/react-modal/page.tsx create mode 100644 apps/pigment-vite-app/src/pages/material-ui/react-modal.tsx diff --git a/apps/pigment-next-app/src/app/material-ui/react-modal/page.tsx b/apps/pigment-next-app/src/app/material-ui/react-modal/page.tsx new file mode 100644 index 00000000000000..763472163e7732 --- /dev/null +++ b/apps/pigment-next-app/src/app/material-ui/react-modal/page.tsx @@ -0,0 +1,51 @@ +'use client'; +import * as React from 'react'; +import BasicModal from '../../../../../../docs/data/material/components/modal/BasicModal'; +import KeepMountedModal from '../../../../../../docs/data/material/components/modal/KeepMountedModal'; +import NestedModal from '../../../../../../docs/data/material/components/modal/NestedModal'; +import ServerModal from '../../../../../../docs/data/material/components/modal/ServerModal'; +import SpringModal from '../../../../../../docs/data/material/components/modal/SpringModal'; +import TransitionsModal from '../../../../../../docs/data/material/components/modal/TransitionsModal'; + +export default function Modal() { + return ( + +
+

Basic Modal

+
+ +
+
+
+

Keep Mounted Modal

+
+ +
+
+
+

Nested Modal

+
+ +
+
+
+

Server Modal

+
+ +
+
+
+

Spring Modal

+
+ +
+
+
+

Transitions Modal

+
+ +
+
+
+ ); +} diff --git a/apps/pigment-vite-app/src/pages/material-ui/react-modal.tsx b/apps/pigment-vite-app/src/pages/material-ui/react-modal.tsx new file mode 100644 index 00000000000000..8e5341af93c0b3 --- /dev/null +++ b/apps/pigment-vite-app/src/pages/material-ui/react-modal.tsx @@ -0,0 +1,52 @@ +import * as React from 'react'; +import MaterialUILayout from '../../Layout'; +import BasicModal from '../../../../../docs/data/material/components/modal/BasicModal.tsx'; +import KeepMountedModal from '../../../../../docs/data/material/components/modal/KeepMountedModal.tsx'; +import NestedModal from '../../../../../docs/data/material/components/modal/NestedModal.tsx'; +import ServerModal from '../../../../../docs/data/material/components/modal/ServerModal.tsx'; +import SpringModal from '../../../../../docs/data/material/components/modal/SpringModal.tsx'; +import TransitionsModal from '../../../../../docs/data/material/components/modal/TransitionsModal.tsx'; + +export default function Modal() { + return ( + +

Modal

+
+

Basic Modal

+
+ +
+
+
+

Keep Mounted Modal

+
+ +
+
+
+

Nested Modal

+
+ +
+
+
+

Server Modal

+
+ +
+
+
+

Spring Modal

+
+ +
+
+
+

Transitions Modal

+
+ +
+
+
+ ); +} diff --git a/packages/mui-material/src/Modal/Modal.js b/packages/mui-material/src/Modal/Modal.js index 69b85c5bf6d7b4..801585fcca45c1 100644 --- a/packages/mui-material/src/Modal/Modal.js +++ b/packages/mui-material/src/Modal/Modal.js @@ -9,11 +9,12 @@ import { unstable_useModal as useModal } from '@mui/base/unstable_useModal'; import composeClasses from '@mui/utils/composeClasses'; import FocusTrap from '../Unstable_TrapFocus'; import Portal from '../Portal'; -import styled from '../styles/styled'; -import useThemeProps from '../styles/useThemeProps'; +import { styled, createUseThemeProps } from '../zero-styled'; import Backdrop from '../Backdrop'; import { getModalUtilityClass } from './modalClasses'; +const useThemeProps = createUseThemeProps('MuiModal'); + const useUtilityClasses = (ownerState) => { const { open, exited, classes } = ownerState; @@ -33,17 +34,21 @@ const ModalRoot = styled('div', { return [styles.root, !ownerState.open && ownerState.exited && styles.hidden]; }, -})(({ theme, ownerState }) => ({ +})(({ theme }) => ({ position: 'fixed', zIndex: (theme.vars || theme).zIndex.modal, right: 0, bottom: 0, top: 0, left: 0, - ...(!ownerState.open && - ownerState.exited && { - visibility: 'hidden', - }), + variants: [ + { + props: ({ ownerState }) => !ownerState.open && ownerState.exited, + style: { + visibility: 'hidden', + }, + }, + ], })); const ModalBackdrop = styled(Backdrop, {