-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Export Pigment CSS layout components #42693
Merged
+1,707
−130
Merged
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
3a23222
export pigment layout components
siriwatknp 2f14862
reexport layout components
siriwatknp 24ed402
poc with latest pigment
siriwatknp 088e088
restore
siriwatknp 8ab5f8a
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp c8cb8fb
[docs-infra] support mulitple entrypoints
siriwatknp 2bf53cf
run docs:api
siriwatknp 79b5dd2
update pigment to latest
siriwatknp 9a5882f
add PigmentGrid
siriwatknp fe622f5
add layout component demo pages
siriwatknp 865e815
ignore PigmentContainer, PigmentGrid, and PigmentStack
siriwatknp 646a3c3
test windows fix
siriwatknp 9bc2fad
add classes
siriwatknp 050ac80
add specs
siriwatknp 7ef300d
run docs:api
siriwatknp 9e75c6a
add 'grow' to grid size
siriwatknp f8d6b16
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp 3d4a775
Revert "test windows fix"
siriwatknp 2053947
update to latest pigment css
siriwatknp 8b7be98
link PigmentGrid API to Grid2
siriwatknp 661b5d4
Merge branch 'next' of https://github.com/mui/material-ui into pigmen…
siriwatknp ac919fa
add useDefaultProps
siriwatknp 823aae0
remove use client from demo pages
siriwatknp 5c828bc
fix
siriwatknp 362e233
Revert "add useDefaultProps"
siriwatknp 6cd978a
ignore Pigment layout components
siriwatknp 146f943
remove useDefaultProps from PigmentGrid
siriwatknp e66f40d
run proptypes and docs:api
siriwatknp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion
2
...i-material/src/Hidden/hiddenCssClasses.js → ...i-material/src/Hidden/hiddenCssClasses.ts
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
99 changes: 99 additions & 0 deletions
99
packages/mui-material/src/PigmentContainer/PigmentContainer.tsx
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,99 @@ | ||
import * as React from 'react'; | ||
import clsx from 'clsx'; | ||
// @ts-ignore | ||
import Container from '@pigment-css/react/Container'; | ||
import capitalize from '@mui/utils/capitalize'; | ||
import composeClasses from '@mui/utils/composeClasses'; | ||
import generateUtilityClass from '@mui/utils/generateUtilityClass'; | ||
import { SxProps, Breakpoint } from '@mui/system'; | ||
import { Theme } from '../styles'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
import { ContainerClasses } from '../Container/containerClasses'; | ||
|
||
export interface ContainerOwnProps { | ||
children?: React.ReactNode; | ||
/** | ||
* Override or extend the styles applied to the component. | ||
*/ | ||
classes?: Partial<ContainerClasses>; | ||
/** | ||
* If `true`, the left and right padding is removed. | ||
* @default false | ||
*/ | ||
disableGutters?: boolean; | ||
/** | ||
* Set the max-width to match the min-width of the current breakpoint. | ||
* This is useful if you'd prefer to design for a fixed set of sizes | ||
* instead of trying to accommodate a fully fluid viewport. | ||
* It's fluid by default. | ||
* @default false | ||
*/ | ||
fixed?: boolean; | ||
/** | ||
* Determine the max-width of the container. | ||
* The container width grows with the size of the screen. | ||
* Set to `false` to disable `maxWidth`. | ||
* @default 'lg' | ||
*/ | ||
maxWidth?: Breakpoint | false; | ||
/** | ||
* The system prop that allows defining system overrides as well as additional CSS styles. | ||
*/ | ||
sx?: SxProps<Theme>; | ||
} | ||
|
||
export interface ContainerTypeMap< | ||
AdditionalProps = {}, | ||
RootComponent extends React.ElementType = 'div', | ||
> { | ||
props: AdditionalProps & ContainerOwnProps; | ||
defaultComponent: RootComponent; | ||
} | ||
|
||
export type ContainerProps< | ||
RootComponent extends React.ElementType = ContainerTypeMap['defaultComponent'], | ||
AdditionalProps = {}, | ||
> = OverrideProps<ContainerTypeMap<AdditionalProps, RootComponent>, RootComponent> & { | ||
component?: React.ElementType; | ||
}; | ||
|
||
const useUtilityClasses = (ownerState: ContainerOwnProps) => { | ||
const { classes, fixed, disableGutters, maxWidth } = ownerState; | ||
|
||
const slots = { | ||
root: [ | ||
'root', | ||
maxWidth && `maxWidth${capitalize(String(maxWidth))}`, | ||
fixed && 'fixed', | ||
disableGutters && 'disableGutters', | ||
], | ||
}; | ||
|
||
return composeClasses(slots, (slot) => generateUtilityClass('MuiContainer', slot), classes); | ||
}; | ||
|
||
const PigmentContainer = React.forwardRef(function PigmentContainer( | ||
{ className, disableGutters = false, fixed = false, maxWidth = 'lg', ...props }, | ||
ref, | ||
) { | ||
const ownerState = { | ||
...props, | ||
disableGutters, | ||
fixed, | ||
maxWidth, | ||
}; | ||
const classes = useUtilityClasses(ownerState); | ||
return ( | ||
<Container | ||
className={clsx(classes.root, className)} | ||
disableGutters={disableGutters} | ||
fixed={fixed} | ||
maxWidth={maxWidth} | ||
{...props} | ||
// @ts-ignore | ||
ref={ref} | ||
/> | ||
); | ||
}) as OverridableComponent<ContainerTypeMap>; | ||
|
||
export default PigmentContainer; |
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,3 @@ | ||
export { default } from './PigmentContainer'; | ||
export * from './PigmentContainer'; | ||
export { default as containerClasses } from '../Container/containerClasses'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this
@ts-ignore
is far beyond this PR, it's related to the tsconfig setup with proper module resolution which I am not sure how to solve it.