-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Grid] Export new grid as unstable (#33479)
- Loading branch information
1 parent
5069f1e
commit d1d1654
Showing
51 changed files
with
182 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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('<Grid2 />', () => { | ||
const { render } = createRenderer(); | ||
|
||
const defaultProps = { | ||
children: <div />, | ||
}; | ||
|
||
describeConformance(<Grid2 {...defaultProps} />, () => ({ | ||
classes, | ||
inheritComponent: 'div', | ||
render, | ||
refInstanceof: window.HTMLElement, | ||
muiName: 'MuiGrid2', | ||
testVariantProps: { container: true, spacing: 5 }, | ||
skip: ['componentsProp', 'classesRoot'], | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Grid2TypeMap>; | ||
|
||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<P = {}, D extends React.ElementType = 'div'> { | ||
props: P & GridBaseProps & { sx?: SxProps<Theme> } & SystemProps<Theme>; | ||
defaultComponent: D; | ||
} | ||
|
||
export type Grid2Props< | ||
D extends React.ElementType = Grid2TypeMap['defaultComponent'], | ||
P = { | ||
component?: React.ElementType; | ||
}, | ||
> = OverrideProps<Grid2TypeMap<P, D>, D>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default } from './Grid2'; | ||
export * from './Grid2Props'; | ||
export { default as grid2Classes } from './grid2Classes'; | ||
export * from './grid2Classes'; |
Oops, something went wrong.