diff --git a/benchmark/browser/scenarios/grid-system/index.js b/benchmark/browser/scenarios/grid-system/index.js index 11a0ebe80325db..c0c0506cd9d69c 100644 --- a/benchmark/browser/scenarios/grid-system/index.js +++ b/benchmark/browser/scenarios/grid-system/index.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; export default function GridSystem() { return ( diff --git a/docs/data/system/components/grid/AutoGrid.js b/docs/data/system/components/grid/AutoGrid.js index f36239c4d510c5..2da25555f3803c 100644 --- a/docs/data/system/components/grid/AutoGrid.js +++ b/docs/data/system/components/grid/AutoGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/AutoGrid.tsx b/docs/data/system/components/grid/AutoGrid.tsx index f36239c4d510c5..2da25555f3803c 100644 --- a/docs/data/system/components/grid/AutoGrid.tsx +++ b/docs/data/system/components/grid/AutoGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/AutoGridNoWrap.js b/docs/data/system/components/grid/AutoGridNoWrap.js index b6b10b67d4a40d..5eb04c9a6795c0 100644 --- a/docs/data/system/components/grid/AutoGridNoWrap.js +++ b/docs/data/system/components/grid/AutoGridNoWrap.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; import Avatar from '@mui/material/Avatar'; import Typography from '@mui/material/Typography'; diff --git a/docs/data/system/components/grid/AutoGridNoWrap.tsx b/docs/data/system/components/grid/AutoGridNoWrap.tsx index b6b10b67d4a40d..5eb04c9a6795c0 100644 --- a/docs/data/system/components/grid/AutoGridNoWrap.tsx +++ b/docs/data/system/components/grid/AutoGridNoWrap.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; import Avatar from '@mui/material/Avatar'; import Typography from '@mui/material/Typography'; diff --git a/docs/data/system/components/grid/BasicGrid.js b/docs/data/system/components/grid/BasicGrid.js index ba15e9eef03fe4..19bdbaa6a56f04 100644 --- a/docs/data/system/components/grid/BasicGrid.js +++ b/docs/data/system/components/grid/BasicGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/BasicGrid.tsx b/docs/data/system/components/grid/BasicGrid.tsx index ba15e9eef03fe4..19bdbaa6a56f04 100644 --- a/docs/data/system/components/grid/BasicGrid.tsx +++ b/docs/data/system/components/grid/BasicGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/ColumnsGrid.js b/docs/data/system/components/grid/ColumnsGrid.js index a431832ee9ffaa..958d85b3b0f897 100644 --- a/docs/data/system/components/grid/ColumnsGrid.js +++ b/docs/data/system/components/grid/ColumnsGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/ColumnsGrid.tsx b/docs/data/system/components/grid/ColumnsGrid.tsx index a431832ee9ffaa..958d85b3b0f897 100644 --- a/docs/data/system/components/grid/ColumnsGrid.tsx +++ b/docs/data/system/components/grid/ColumnsGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/CustomBreakpointsGrid.js b/docs/data/system/components/grid/CustomBreakpointsGrid.js index eadc153322bbb1..67b69f81a48561 100644 --- a/docs/data/system/components/grid/CustomBreakpointsGrid.js +++ b/docs/data/system/components/grid/CustomBreakpointsGrid.js @@ -1,7 +1,7 @@ import * as React from 'react'; import { ThemeProvider, createTheme } from '@mui/system'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/FullWidthGrid.js b/docs/data/system/components/grid/FullWidthGrid.js index 2a2f11f9797199..248a1901d9b6f9 100644 --- a/docs/data/system/components/grid/FullWidthGrid.js +++ b/docs/data/system/components/grid/FullWidthGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/FullWidthGrid.tsx b/docs/data/system/components/grid/FullWidthGrid.tsx index 2a2f11f9797199..248a1901d9b6f9 100644 --- a/docs/data/system/components/grid/FullWidthGrid.tsx +++ b/docs/data/system/components/grid/FullWidthGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/NestedGrid.js b/docs/data/system/components/grid/NestedGrid.js index 62870cdcc2e6eb..5121314ccc78b3 100644 --- a/docs/data/system/components/grid/NestedGrid.js +++ b/docs/data/system/components/grid/NestedGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/NestedGrid.tsx b/docs/data/system/components/grid/NestedGrid.tsx index 62870cdcc2e6eb..5121314ccc78b3 100644 --- a/docs/data/system/components/grid/NestedGrid.tsx +++ b/docs/data/system/components/grid/NestedGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/OffsetGrid.js b/docs/data/system/components/grid/OffsetGrid.js index 28eaf892f815b6..d85cb2528714ca 100644 --- a/docs/data/system/components/grid/OffsetGrid.js +++ b/docs/data/system/components/grid/OffsetGrid.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/OffsetGrid.tsx b/docs/data/system/components/grid/OffsetGrid.tsx index 28eaf892f815b6..d85cb2528714ca 100644 --- a/docs/data/system/components/grid/OffsetGrid.tsx +++ b/docs/data/system/components/grid/OffsetGrid.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/ResponsiveGrid.js b/docs/data/system/components/grid/ResponsiveGrid.js index 69d6d357206d2c..235377a9977b37 100644 --- a/docs/data/system/components/grid/ResponsiveGrid.js +++ b/docs/data/system/components/grid/ResponsiveGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/ResponsiveGrid.tsx b/docs/data/system/components/grid/ResponsiveGrid.tsx index 69d6d357206d2c..235377a9977b37 100644 --- a/docs/data/system/components/grid/ResponsiveGrid.tsx +++ b/docs/data/system/components/grid/ResponsiveGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/RowAndColumnSpacing.js b/docs/data/system/components/grid/RowAndColumnSpacing.js index be62ccee274f40..c7a7741f4d0bab 100644 --- a/docs/data/system/components/grid/RowAndColumnSpacing.js +++ b/docs/data/system/components/grid/RowAndColumnSpacing.js @@ -1,6 +1,6 @@ import * as React from 'react'; import styled from '@mui/system/styled'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import Box from '@mui/system/Box'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/RowAndColumnSpacing.tsx b/docs/data/system/components/grid/RowAndColumnSpacing.tsx index be62ccee274f40..c7a7741f4d0bab 100644 --- a/docs/data/system/components/grid/RowAndColumnSpacing.tsx +++ b/docs/data/system/components/grid/RowAndColumnSpacing.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import styled from '@mui/system/styled'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import Box from '@mui/system/Box'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/SpacingGrid.js b/docs/data/system/components/grid/SpacingGrid.js index ccaf1010be5d07..39c57967aeaa7e 100644 --- a/docs/data/system/components/grid/SpacingGrid.js +++ b/docs/data/system/components/grid/SpacingGrid.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import FormLabel from '@mui/material/FormLabel'; import FormControl from '@mui/material/FormControl'; import FormControlLabel from '@mui/material/FormControlLabel'; diff --git a/docs/data/system/components/grid/SpacingGrid.tsx b/docs/data/system/components/grid/SpacingGrid.tsx index 53cbbfca7c013e..d79ca6f09169f7 100644 --- a/docs/data/system/components/grid/SpacingGrid.tsx +++ b/docs/data/system/components/grid/SpacingGrid.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import FormLabel from '@mui/material/FormLabel'; import FormControl from '@mui/material/FormControl'; import FormControlLabel from '@mui/material/FormControlLabel'; diff --git a/docs/data/system/components/grid/VariableWidthGrid.js b/docs/data/system/components/grid/VariableWidthGrid.js index d3aca8f0f6e4a7..c28f8ee132ec4a 100644 --- a/docs/data/system/components/grid/VariableWidthGrid.js +++ b/docs/data/system/components/grid/VariableWidthGrid.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/data/system/components/grid/VariableWidthGrid.tsx b/docs/data/system/components/grid/VariableWidthGrid.tsx index d3aca8f0f6e4a7..c28f8ee132ec4a 100644 --- a/docs/data/system/components/grid/VariableWidthGrid.tsx +++ b/docs/data/system/components/grid/VariableWidthGrid.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@mui/system/Box'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; import styled from '@mui/system/styled'; const Item = styled('div')(({ theme }) => ({ diff --git a/docs/pages/system/api/grid.json b/docs/pages/system/api/grid.json index 5cb2520cc074ce..f57038887ffade 100644 --- a/docs/pages/system/api/grid.json +++ b/docs/pages/system/api/grid.json @@ -63,7 +63,7 @@ "styles": { "classes": [], "globalClasses": {}, "name": null }, "spread": true, "forwardsRefTo": "HTMLElement", - "filename": "/packages/mui-system/src/Grid/Grid.tsx", + "filename": "/packages/mui-system/src/Unstable_Grid/Grid.tsx", "inheritance": null, "demos": "", "cssComponent": true diff --git a/packages/mui-joy/src/Grid/Grid.test.js b/packages/mui-joy/src/Grid/Grid.test.js index a49f47303fb0ab..7b7f68e6449043 100644 --- a/packages/mui-joy/src/Grid/Grid.test.js +++ b/packages/mui-joy/src/Grid/Grid.test.js @@ -16,7 +16,7 @@ describe('Joy UI ', () => { render, ThemeProvider, refInstanceof: window.HTMLElement, - muiName: 'MuiGrid', + muiName: 'JoyGrid', testVariantProps: { container: true, spacing: 5 }, skip: ['componentsProp', 'classesRoot'], })); diff --git a/packages/mui-joy/src/Grid/Grid.tsx b/packages/mui-joy/src/Grid/Grid.tsx index 2e3ac6a3d78025..fd2f793506caf3 100644 --- a/packages/mui-joy/src/Grid/Grid.tsx +++ b/packages/mui-joy/src/Grid/Grid.tsx @@ -1,16 +1,16 @@ import PropTypes from 'prop-types'; -import { createGrid } from '@mui/system/Grid'; +import { createGrid } from '@mui/system/Unstable_Grid'; import { OverridableComponent } from '@mui/types'; import { styled, useThemeProps } from '../styles'; import { GridTypeMap } from './GridProps'; const Grid = createGrid({ createStyledComponent: styled('div', { - name: 'MuiGrid', + name: 'JoyGrid', overridesResolver: (props, styles) => styles.root, }), - componentName: 'MuiGrid', - useThemeProps: (inProps) => useThemeProps({ props: inProps, name: 'MuiGrid' }), + componentName: 'JoyGrid', + useThemeProps: (inProps) => useThemeProps({ props: inProps, name: 'JoyGrid' }), }) as OverridableComponent; Grid.propTypes /* remove-proptypes */ = { diff --git a/packages/mui-joy/src/Grid/GridProps.ts b/packages/mui-joy/src/Grid/GridProps.ts index 1ec28ae667ea04..863094b1ebaa83 100644 --- a/packages/mui-joy/src/Grid/GridProps.ts +++ b/packages/mui-joy/src/Grid/GridProps.ts @@ -1,6 +1,6 @@ import React from 'react'; import { OverrideProps } from '@mui/types'; -import { GridBaseProps } from '@mui/system/Grid'; +import { GridBaseProps } from '@mui/system/Unstable_Grid'; import { SxProps, SystemProps } from '../styles/types'; export type GridSlot = 'root'; diff --git a/packages/mui-joy/src/Grid/gridClasses.ts b/packages/mui-joy/src/Grid/gridClasses.ts index 0b438ae87723c3..07d876b50a414e 100644 --- a/packages/mui-joy/src/Grid/gridClasses.ts +++ b/packages/mui-joy/src/Grid/gridClasses.ts @@ -1,10 +1,10 @@ import { generateUtilityClass, generateUtilityClasses } from '@mui/base'; -import { GridClasses } from '@mui/system/Grid'; +import { GridClasses } from '@mui/system/Unstable_Grid'; export type GridClassKey = keyof GridClasses; export function getGridUtilityClass(slot: string): string { - return generateUtilityClass('MuiGrid', slot); + return generateUtilityClass('JoyGrid', slot); } const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as const; @@ -12,7 +12,7 @@ const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'] as const; const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'] as const; const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const; -const gridClasses: GridClasses = generateUtilityClasses('MuiGrid', [ +const gridClasses: GridClasses = generateUtilityClasses('JoyGrid', [ 'root', 'container', 'item', diff --git a/packages/mui-joy/src/styles/components.d.ts b/packages/mui-joy/src/styles/components.d.ts index 80a8933985a2df..4664456e3320d7 100644 --- a/packages/mui-joy/src/styles/components.d.ts +++ b/packages/mui-joy/src/styles/components.d.ts @@ -122,6 +122,10 @@ export interface Components { defaultProps?: Partial; styleOverrides?: OverridesStyleRules; }; + JoyGrid?: { + defaultProps?: Partial; + styleOverrides?: OverridesStyleRules; + }; JoyIconButton?: { defaultProps?: Partial; styleOverrides?: OverridesStyleRules; @@ -195,8 +199,4 @@ export interface Components { defaultProps?: Partial; styleOverrides?: OverridesStyleRules; }; - MuiGrid?: { - defaultProps?: Partial; - styleOverrides?: OverridesStyleRules; - }; } diff --git a/packages/mui-material/src/Unstable_Grid2/Grid2.test.js b/packages/mui-material/src/Unstable_Grid2/Grid2.test.js new file mode 100644 index 00000000000000..43ccba34d379b0 --- /dev/null +++ b/packages/mui-material/src/Unstable_Grid2/Grid2.test.js @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { describeConformance, createRenderer } from 'test/utils'; +import Grid2, { grid2Classes as classes } from '@mui/material/Unstable_Grid2'; + +// The main tests are in mui-system Unstable_Grid folder +describe('', () => { + const { render } = createRenderer(); + + const defaultProps = { + children:
, + }; + + describeConformance(, () => ({ + classes, + inheritComponent: 'div', + render, + refInstanceof: window.HTMLElement, + muiName: 'MuiGrid2', + testVariantProps: { container: true, spacing: 5 }, + skip: ['componentsProp', 'classesRoot'], + })); +}); diff --git a/packages/mui-material/src/Unstable_Grid2/Grid2.tsx b/packages/mui-material/src/Unstable_Grid2/Grid2.tsx new file mode 100644 index 00000000000000..5b452cf9fe4938 --- /dev/null +++ b/packages/mui-material/src/Unstable_Grid2/Grid2.tsx @@ -0,0 +1,36 @@ +import PropTypes from 'prop-types'; +import { createGrid } from '@mui/system/Unstable_Grid'; +import { OverridableComponent } from '@mui/types'; +import { styled, useThemeProps } from '../styles'; +import { Grid2TypeMap } from './Grid2Props'; + +const Grid2 = createGrid({ + createStyledComponent: styled('div', { + name: 'MuiGrid2', + overridesResolver: (props, styles) => styles.root, + }), + componentName: 'MuiGrid2', + // eslint-disable-next-line material-ui/mui-name-matches-component-name + useThemeProps: (inProps) => useThemeProps({ props: inProps, name: 'MuiGrid2' }), +}) as OverridableComponent; + +Grid2.propTypes /* remove-proptypes */ = { + // ----------------------------- Warning -------------------------------- + // | These PropTypes are generated from the TypeScript type definitions | + // | To update them edit TypeScript types and run "yarn proptypes" | + // ---------------------------------------------------------------------- + /** + * The content of the component. + */ + children: PropTypes.node, + /** + * @ignore + */ + sx: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), + PropTypes.func, + PropTypes.object, + ]), +} as any; + +export default Grid2; diff --git a/packages/mui-material/src/Unstable_Grid2/Grid2Props.ts b/packages/mui-material/src/Unstable_Grid2/Grid2Props.ts new file mode 100644 index 00000000000000..668ce5f197a60b --- /dev/null +++ b/packages/mui-material/src/Unstable_Grid2/Grid2Props.ts @@ -0,0 +1,19 @@ +import React from 'react'; +import { OverrideProps } from '@mui/types'; +import { SxProps, SystemProps } from '@mui/system'; +import { GridBaseProps } from '@mui/system/Unstable_Grid'; +import { Theme } from '../styles'; + +export type Grid2Slot = 'root'; + +export interface Grid2TypeMap

{ + props: P & GridBaseProps & { sx?: SxProps } & SystemProps; + defaultComponent: D; +} + +export type Grid2Props< + D extends React.ElementType = Grid2TypeMap['defaultComponent'], + P = { + component?: React.ElementType; + }, +> = OverrideProps, D>; diff --git a/packages/mui-material/src/Unstable_Grid2/grid2Classes.ts b/packages/mui-material/src/Unstable_Grid2/grid2Classes.ts new file mode 100644 index 00000000000000..97437f862aa6b4 --- /dev/null +++ b/packages/mui-material/src/Unstable_Grid2/grid2Classes.ts @@ -0,0 +1,36 @@ +import { generateUtilityClass, generateUtilityClasses } from '@mui/base'; +import { GridClasses } from '@mui/system/Unstable_Grid'; + +export type Grid2ClassKey = keyof GridClasses; + +export function getGrid2UtilityClass(slot: string): string { + return generateUtilityClass('MuiGrid2', slot); +} + +const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as const; +const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'] as const; +const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'] as const; +const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] as const; + +const grid2Classes: GridClasses = generateUtilityClasses('MuiGrid2', [ + 'root', + 'container', + 'item', + 'zeroMinWidth', + + // spacings + ...SPACINGS.map((spacing) => `spacing-xs-${spacing}` as const), + // direction values + ...DIRECTIONS.map((direction) => `direction-xs-${direction}` as const), + // wrap values + ...WRAPS.map((wrap) => `wrap-xs-${wrap}` as const), + + // grid sizes for all breakpoints + ...GRID_SIZES.map((size) => `grid-xs-${size}` as const), + ...GRID_SIZES.map((size) => `grid-sm-${size}` as const), + ...GRID_SIZES.map((size) => `grid-md-${size}` as const), + ...GRID_SIZES.map((size) => `grid-lg-${size}` as const), + ...GRID_SIZES.map((size) => `grid-xl-${size}` as const), +]); + +export default grid2Classes; diff --git a/packages/mui-material/src/Unstable_Grid2/index.ts b/packages/mui-material/src/Unstable_Grid2/index.ts new file mode 100644 index 00000000000000..163e527be89b0d --- /dev/null +++ b/packages/mui-material/src/Unstable_Grid2/index.ts @@ -0,0 +1,4 @@ +export { default } from './Grid2'; +export * from './Grid2Props'; +export { default as grid2Classes } from './grid2Classes'; +export * from './grid2Classes'; diff --git a/packages/mui-material/src/index.d.ts b/packages/mui-material/src/index.d.ts index 1d085f391278bf..3d21ac2d8bbaee 100644 --- a/packages/mui-material/src/index.d.ts +++ b/packages/mui-material/src/index.d.ts @@ -224,6 +224,9 @@ export * from './FormLabel'; export { default as Grid } from './Grid'; export * from './Grid'; +export { default as Unstable_Grid2 } from './Unstable_Grid2'; +export * from './Unstable_Grid2'; + export { default as Grow } from './Grow'; export * from './Grow'; diff --git a/packages/mui-material/src/index.js b/packages/mui-material/src/index.js index 0075c7b4ee7c2b..1aaf78d619f603 100644 --- a/packages/mui-material/src/index.js +++ b/packages/mui-material/src/index.js @@ -153,6 +153,9 @@ export * from './FormLabel'; export { default as Grid } from './Grid'; export * from './Grid'; +export { default as Unstable_Grid2 } from './Unstable_Grid2'; +export * from './Unstable_Grid2'; + export { default as Grow } from './Grow'; export * from './Grow'; diff --git a/packages/mui-material/src/styles/components.d.ts b/packages/mui-material/src/styles/components.d.ts index 40f8dc28018a7c..d270c12520103a 100644 --- a/packages/mui-material/src/styles/components.d.ts +++ b/packages/mui-material/src/styles/components.d.ts @@ -228,6 +228,11 @@ export interface Components { styleOverrides?: ComponentsOverrides['MuiGrid']; variants?: ComponentsVariants['MuiGrid']; }; + MuiGrid2?: { + defaultProps?: ComponentsProps['MuiGrid2']; + styleOverrides?: ComponentsOverrides['MuiGrid2']; + variants?: ComponentsVariants['MuiGrid2']; + }; MuiImageList?: { defaultProps?: ComponentsProps['MuiImageList']; styleOverrides?: ComponentsOverrides['MuiImageList']; diff --git a/packages/mui-material/src/styles/overrides.d.ts b/packages/mui-material/src/styles/overrides.d.ts index 9bae49c34c19b1..927587a167786c 100644 --- a/packages/mui-material/src/styles/overrides.d.ts +++ b/packages/mui-material/src/styles/overrides.d.ts @@ -44,6 +44,7 @@ import { FormGroupClassKey } from '../FormGroup'; import { FormHelperTextClassKey } from '../FormHelperText'; import { FormLabelClassKey } from '../FormLabel'; import { GridClassKey } from '../Grid'; +import { Grid2Slot } from '../Unstable_Grid2'; import { IconButtonClassKey } from '../IconButton'; import { IconClassKey } from '../Icon'; import { ImageListClassKey } from '../ImageList'; @@ -181,6 +182,7 @@ export interface ComponentNameToClassKey { MuiFormHelperText: FormHelperTextClassKey; MuiFormLabel: FormLabelClassKey; MuiGrid: GridClassKey; + MuiGrid2: Grid2Slot; MuiIcon: IconClassKey; MuiIconButton: IconButtonClassKey; MuiImageList: ImageListClassKey; diff --git a/packages/mui-material/src/styles/props.d.ts b/packages/mui-material/src/styles/props.d.ts index 158fcbfe173802..97ae5f767cf66f 100644 --- a/packages/mui-material/src/styles/props.d.ts +++ b/packages/mui-material/src/styles/props.d.ts @@ -43,6 +43,7 @@ import { FormGroupProps } from '../FormGroup'; import { FormHelperTextProps } from '../FormHelperText'; import { FormLabelProps } from '../FormLabel'; import { GridProps } from '../Grid'; +import { Grid2Props } from '../Unstable_Grid2'; import { IconButtonProps } from '../IconButton'; import { IconProps } from '../Icon'; import { ImageListProps } from '../ImageList'; @@ -167,6 +168,7 @@ export interface ComponentsPropsList { MuiFormHelperText: FormHelperTextProps; MuiFormLabel: FormLabelProps; MuiGrid: GridProps; + MuiGrid2: Grid2Props; MuiImageList: ImageListProps; MuiImageListItem: ImageListItemProps; MuiImageListItemBar: ImageListItemBarProps; diff --git a/packages/mui-system/src/Grid/Grid.test.js b/packages/mui-system/src/Unstable_Grid/Grid.test.js similarity index 99% rename from packages/mui-system/src/Grid/Grid.test.js rename to packages/mui-system/src/Unstable_Grid/Grid.test.js index c9c1b3fd5cee27..5299976d42680f 100644 --- a/packages/mui-system/src/Grid/Grid.test.js +++ b/packages/mui-system/src/Unstable_Grid/Grid.test.js @@ -2,7 +2,7 @@ import * as React from 'react'; import { expect } from 'chai'; import { describeConformance, createRenderer, screen } from 'test/utils'; import { ThemeProvider, createTheme } from '@mui/system'; -import Grid, { gridClasses as classes } from '@mui/system/Grid'; +import Grid, { gridClasses as classes } from '@mui/system/Unstable_Grid'; describe('System ', () => { const { render } = createRenderer(); diff --git a/packages/mui-system/src/Grid/Grid.tsx b/packages/mui-system/src/Unstable_Grid/Grid.tsx similarity index 100% rename from packages/mui-system/src/Grid/Grid.tsx rename to packages/mui-system/src/Unstable_Grid/Grid.tsx diff --git a/packages/mui-system/src/Grid/GridProps.ts b/packages/mui-system/src/Unstable_Grid/GridProps.ts similarity index 100% rename from packages/mui-system/src/Grid/GridProps.ts rename to packages/mui-system/src/Unstable_Grid/GridProps.ts diff --git a/packages/mui-system/src/Grid/createGrid.tsx b/packages/mui-system/src/Unstable_Grid/createGrid.tsx similarity index 97% rename from packages/mui-system/src/Grid/createGrid.tsx rename to packages/mui-system/src/Unstable_Grid/createGrid.tsx index cb0bf790f54805..ce3b38eac2e4b1 100644 --- a/packages/mui-system/src/Grid/createGrid.tsx +++ b/packages/mui-system/src/Unstable_Grid/createGrid.tsx @@ -59,10 +59,6 @@ export default function createGrid( const NestedContext = React.createContext(false); - const getGridUtilityClass = (slot: string) => { - return generateUtilityClass(componentName, slot); - }; - const useUtilityClasses = (ownerState: GridOwnerState, theme: typeof defaultTheme) => { const { container, direction, spacing, wrap, gridSize } = ownerState; @@ -77,7 +73,7 @@ export default function createGrid( ], }; - return composeClasses(slots, getGridUtilityClass, {}); + return composeClasses(slots, (slot) => generateUtilityClass(componentName, slot), {}); }; const GridRoot = createStyledComponent<{ diff --git a/packages/mui-system/src/Grid/gridClasses.ts b/packages/mui-system/src/Unstable_Grid/gridClasses.ts similarity index 100% rename from packages/mui-system/src/Grid/gridClasses.ts rename to packages/mui-system/src/Unstable_Grid/gridClasses.ts diff --git a/packages/mui-system/src/Grid/gridGenerator.test.js b/packages/mui-system/src/Unstable_Grid/gridGenerator.test.js similarity index 100% rename from packages/mui-system/src/Grid/gridGenerator.test.js rename to packages/mui-system/src/Unstable_Grid/gridGenerator.test.js diff --git a/packages/mui-system/src/Grid/gridGenerator.ts b/packages/mui-system/src/Unstable_Grid/gridGenerator.ts similarity index 100% rename from packages/mui-system/src/Grid/gridGenerator.ts rename to packages/mui-system/src/Unstable_Grid/gridGenerator.ts diff --git a/packages/mui-system/src/Grid/index.ts b/packages/mui-system/src/Unstable_Grid/index.ts similarity index 100% rename from packages/mui-system/src/Grid/index.ts rename to packages/mui-system/src/Unstable_Grid/index.ts diff --git a/packages/mui-system/src/index.d.ts b/packages/mui-system/src/index.d.ts index f9fa2ea4b73b55..ddcf861551ba49 100644 --- a/packages/mui-system/src/index.d.ts +++ b/packages/mui-system/src/index.d.ts @@ -175,3 +175,6 @@ export * from './Container/createContainer'; export { default as Container } from './Container'; export * from './Container'; + +export { default as Unstable_Grid } from './Unstable_Grid'; +export * from './Unstable_Grid'; diff --git a/packages/mui-system/src/index.js b/packages/mui-system/src/index.js index 53f6a5ae7f3588..c404c373d5f970 100644 --- a/packages/mui-system/src/index.js +++ b/packages/mui-system/src/index.js @@ -48,6 +48,12 @@ export * from './colorManipulator'; export { default as ThemeProvider } from './ThemeProvider'; export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider'; export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar'; + +/** ----------------- */ +/** Layout components */ export { default as createContainer } from './Container/createContainer'; export { default as Container } from './Container'; export * from './Container'; + +export { default as Unstable_Grid } from './Unstable_Grid/Grid'; +export * from './Unstable_Grid'; diff --git a/packages/mui-system/test/typescript/moduleAugmentation/gridCustomBreakpoints.spec.tsx b/packages/mui-system/test/typescript/moduleAugmentation/gridCustomBreakpoints.spec.tsx index ac85ec388ec250..4af643c3b6fbcc 100644 --- a/packages/mui-system/test/typescript/moduleAugmentation/gridCustomBreakpoints.spec.tsx +++ b/packages/mui-system/test/typescript/moduleAugmentation/gridCustomBreakpoints.spec.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { createTheme, ThemeProvider } from '@mui/system'; -import Grid from '@mui/system/Grid'; +import Grid from '@mui/system/Unstable_Grid'; declare module '@mui/system' { interface BreakpointOverrides {