-
-
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] Remove dependency to @mui/base #42907
Changes from all commits
d8c5595
44b6dc7
2224463
dadb6ea
bdb3601
2e71c28
09efcda
b7a6ecb
f99cec3
eaad5a2
f87da15
f862f49
eb71306
5ce9e53
0c6c4a9
a0d474f
468335a
4913bbe
41cc450
ba47077
107a86e
16ef35b
fd3dcad
e3cf68d
cc5aea6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ module.exports = [ | |
{ pathname: '/material-ui/api/checkbox' }, | ||
{ pathname: '/material-ui/api/chip' }, | ||
{ pathname: '/material-ui/api/circular-progress' }, | ||
{ pathname: '/material-ui/api/click-away-listener' }, | ||
{ pathname: '/material-ui/api/collapse' }, | ||
{ pathname: '/material-ui/api/container' }, | ||
{ pathname: '/material-ui/api/css-baseline' }, | ||
|
@@ -76,6 +77,7 @@ module.exports = [ | |
{ pathname: '/material-ui/api/mobile-stepper' }, | ||
{ pathname: '/material-ui/api/modal' }, | ||
{ pathname: '/material-ui/api/native-select' }, | ||
{ pathname: '/material-ui/api/no-ssr' }, | ||
{ pathname: '/material-ui/api/outlined-input' }, | ||
{ pathname: '/material-ui/api/pagination' }, | ||
{ pathname: '/material-ui/api/pagination-item' }, | ||
|
@@ -86,6 +88,7 @@ module.exports = [ | |
{ pathname: '/material-ui/api/pigment-stack' }, | ||
{ pathname: '/material-ui/api/popover' }, | ||
{ pathname: '/material-ui/api/popper' }, | ||
{ pathname: '/material-ui/api/portal' }, | ||
{ pathname: '/material-ui/api/radio' }, | ||
{ pathname: '/material-ui/api/radio-group' }, | ||
{ pathname: '/material-ui/api/rating' }, | ||
|
@@ -125,6 +128,7 @@ module.exports = [ | |
{ pathname: '/material-ui/api/tab-panel' }, | ||
{ pathname: '/material-ui/api/tabs' }, | ||
{ pathname: '/material-ui/api/tab-scroll-button' }, | ||
{ pathname: '/material-ui/api/textarea-autosize' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same idea as above with https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize |
||
{ pathname: '/material-ui/api/text-field' }, | ||
{ pathname: '/material-ui/api/timeline' }, | ||
{ pathname: '/material-ui/api/timeline-connector' }, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from 'react'; | ||
import ApiPage from 'docs/src/modules/components/ApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './click-away-listener.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <ApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context( | ||
'docs/translations/api-docs/click-away-listener', | ||
false, | ||
/\.\/click-away-listener.*.json$/, | ||
); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"props": { | ||
"children": { "type": { "name": "custom", "description": "element" }, "required": true }, | ||
"onClickAway": { "type": { "name": "func" }, "required": true }, | ||
"disableReactTree": { "type": { "name": "bool" }, "default": "false" }, | ||
"mouseEvent": { | ||
"type": { | ||
"name": "enum", | ||
"description": "'onClick'<br>| 'onMouseDown'<br>| 'onMouseUp'<br>| 'onPointerDown'<br>| 'onPointerUp'<br>| false" | ||
}, | ||
"default": "'onClick'" | ||
}, | ||
"touchEvent": { | ||
"type": { | ||
"name": "enum", | ||
"description": "'onTouchEnd'<br>| 'onTouchStart'<br>| false" | ||
}, | ||
"default": "'onTouchEnd'" | ||
} | ||
}, | ||
"name": "ClickAwayListener", | ||
"imports": [ | ||
"import ClickAwayListener from '@mui/material/ClickAwayListener';", | ||
"import { ClickAwayListener } from '@mui/material';" | ||
], | ||
"classes": [], | ||
"spread": false, | ||
"themeDefaultProps": null, | ||
"muiName": "MuiClickAwayListener", | ||
"filename": "/packages/mui-material/src/ClickAwayListener/ClickAwayListener.tsx", | ||
"inheritance": null, | ||
"demos": "<ul><li><a href=\"/material-ui/react-click-away-listener/\">Click-Away Listener</a></li>\n<li><a href=\"/material-ui/react-menu/\">Menu</a></li></ul>", | ||
"cssComponent": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import ApiPage from 'docs/src/modules/components/ApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './no-ssr.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <ApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context('docs/translations/api-docs/no-ssr', false, /\.\/no-ssr.*.json$/); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"props": { | ||
"children": { "type": { "name": "node" } }, | ||
"defer": { "type": { "name": "bool" }, "default": "false" }, | ||
"fallback": { "type": { "name": "node" }, "default": "null" } | ||
}, | ||
"name": "NoSsr", | ||
"imports": ["import NoSsr from '@mui/material/NoSsr';", "import { NoSsr } from '@mui/material';"], | ||
"classes": [], | ||
"spread": false, | ||
"themeDefaultProps": null, | ||
"muiName": "MuiNoSsr", | ||
"filename": "/packages/mui-material/src/NoSsr/NoSsr.tsx", | ||
"inheritance": null, | ||
"demos": "<ul><li><a href=\"/material-ui/react-no-ssr/\">No SSR</a></li></ul>", | ||
"cssComponent": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import ApiPage from 'docs/src/modules/components/ApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './portal.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <ApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context('docs/translations/api-docs/portal', false, /\.\/portal.*.json$/); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"props": { | ||
"children": { "type": { "name": "node" } }, | ||
"container": { "type": { "name": "union", "description": "HTML element<br>| func" } }, | ||
"disablePortal": { "type": { "name": "bool" }, "default": "false" } | ||
}, | ||
"name": "Portal", | ||
"imports": [ | ||
"import Portal from '@mui/material/Portal';", | ||
"import { Portal } from '@mui/material';" | ||
], | ||
"classes": [], | ||
"spread": false, | ||
"themeDefaultProps": null, | ||
"muiName": "MuiPortal", | ||
"filename": "/packages/mui-material/src/Portal/Portal.tsx", | ||
"inheritance": null, | ||
"demos": "<ul><li><a href=\"/material-ui/react-portal/\">Portal</a></li></ul>", | ||
"cssComponent": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from 'react'; | ||
import ApiPage from 'docs/src/modules/components/ApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './textarea-autosize.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <ApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context( | ||
'docs/translations/api-docs/textarea-autosize', | ||
false, | ||
/\.\/textarea-autosize.*.json$/, | ||
); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"props": { | ||
"maxRows": { "type": { "name": "union", "description": "number<br>| string" } }, | ||
"minRows": { | ||
"type": { "name": "union", "description": "number<br>| string" }, | ||
"default": "1" | ||
} | ||
}, | ||
"name": "TextareaAutosize", | ||
"imports": [ | ||
"import TextareaAutosize from '@mui/material/TextareaAutosize';", | ||
"import { TextareaAutosize } from '@mui/material';" | ||
], | ||
"classes": [], | ||
"spread": true, | ||
"themeDefaultProps": null, | ||
"muiName": "MuiTextareaAutosize", | ||
"filename": "/packages/mui-material/src/TextareaAutosize/TextareaAutosize.tsx", | ||
"inheritance": null, | ||
"demos": "<ul><li><a href=\"/material-ui/react-textarea-autosize/\">Textarea Autosize</a></li></ul>", | ||
"cssComponent": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"componentDescription": "Listen for click events that occur somewhere in the document, outside of the element itself.\nFor instance, if you need to hide a menu when people click anywhere else on your page.", | ||
"propDescriptions": { | ||
"children": { "description": "The wrapped element.", "requiresRef": true }, | ||
"disableReactTree": { | ||
"description": "If <code>true</code>, the React tree is ignored and only the DOM tree is considered. This prop changes how portaled elements are handled." | ||
}, | ||
"mouseEvent": { | ||
"description": "The mouse event to listen to. You can disable the listener by providing <code>false</code>." | ||
}, | ||
"onClickAway": { | ||
"description": "Callback fired when a "click away" event is detected." | ||
}, | ||
"touchEvent": { | ||
"description": "The touch event to listen to. You can disable the listener by providing <code>false</code>." | ||
} | ||
}, | ||
"classDescriptions": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"componentDescription": "NoSsr purposely removes components from the subject of Server Side Rendering (SSR).\n\nThis component can be useful in a variety of situations:\n\n* Escape hatch for broken dependencies not supporting SSR.\n* Improve the time-to-first paint on the client by only rendering above the fold.\n* Reduce the rendering time on the server.\n* Under too heavy server load, you can turn on service degradation.", | ||
"propDescriptions": { | ||
"children": { "description": "You can wrap a node." }, | ||
"defer": { | ||
"description": "If <code>true</code>, the component will not only prevent server-side rendering. It will also defer the rendering of the children into a different screen frame." | ||
}, | ||
"fallback": { "description": "The fallback content to display." } | ||
}, | ||
"classDescriptions": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"componentDescription": "Portals provide a first-class way to render children into a DOM node\nthat exists outside the DOM hierarchy of the parent component.", | ||
"propDescriptions": { | ||
"children": { "description": "The children to render into the <code>container</code>." }, | ||
"container": { | ||
"description": "An HTML element or function that returns one. The <code>container</code> will have the portal children appended to it.<br>You can also provide a callback, which is called in a React layout effect. This lets you set the container from a ref, and also makes server-side rendering possible.<br>By default, it uses the body of the top-level document object, so it's simply <code>document.body</code> most of the time." | ||
}, | ||
"disablePortal": { | ||
"description": "The <code>children</code> will be under the DOM hierarchy of the parent component." | ||
} | ||
}, | ||
"classDescriptions": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"componentDescription": "", | ||
"propDescriptions": { | ||
"maxRows": { "description": "Maximum number of rows to display." }, | ||
"minRows": { "description": "Minimum number of rows to display." } | ||
}, | ||
"classDescriptions": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ export const projectSettings: ProjectSettings = { | |
getHookInfo: getBaseUiHookInfo, | ||
translationLanguages: LANGUAGES, | ||
skipComponent: () => false, | ||
skipHook: (filename) => { | ||
return filename.match(/(useSlotProps)/) !== null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hook was anyway not documented, so I've added this option to skip, otherwise the docgen generation failed. It's an optional prop it won't break other ts projects. |
||
}, | ||
onCompleted: async () => { | ||
await generateBaseUIApiPages(); | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,3 @@ | ||
import * as React from 'react'; | ||
import { Simplify } from '@mui/types'; | ||
import { isHostComponent } from './isHostComponent'; | ||
export { default as appendOwnerState } from '@mui/utils/appendOwnerState'; | ||
|
||
/** | ||
* Type of the ownerState based on the type of an element it applies to. | ||
* This resolves to the provided OwnerState for React components and `undefined` for host components. | ||
* Falls back to `OwnerState | undefined` when the exact type can't be determined in development time. | ||
*/ | ||
type OwnerStateWhenApplicable<ElementType extends React.ElementType, OwnerState> = | ||
ElementType extends React.ComponentType<any> | ||
? OwnerState | ||
: ElementType extends keyof React.JSX.IntrinsicElements | ||
? undefined | ||
: OwnerState | undefined; | ||
|
||
export type AppendOwnerStateReturnType< | ||
ElementType extends React.ElementType, | ||
OtherProps, | ||
OwnerState, | ||
> = Simplify< | ||
OtherProps & { | ||
ownerState: OwnerStateWhenApplicable<ElementType, OwnerState>; | ||
} | ||
>; | ||
|
||
/** | ||
* Appends the ownerState object to the props, merging with the existing one if necessary. | ||
* | ||
* @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied. | ||
* @param otherProps Props of the element. | ||
* @param ownerState | ||
*/ | ||
export function appendOwnerState< | ||
ElementType extends React.ElementType, | ||
OtherProps extends Record<string, any>, | ||
OwnerState, | ||
>( | ||
elementType: ElementType | undefined, | ||
otherProps: OtherProps, | ||
ownerState: OwnerState, | ||
): AppendOwnerStateReturnType<ElementType, OtherProps, OwnerState> { | ||
if (elementType === undefined || isHostComponent(elementType)) { | ||
return otherProps as AppendOwnerStateReturnType<ElementType, OtherProps, OwnerState>; | ||
} | ||
|
||
return { | ||
...otherProps, | ||
ownerState: { ...otherProps.ownerState, ...ownerState }, | ||
} as AppendOwnerStateReturnType<ElementType, OtherProps, OwnerState>; | ||
} | ||
export type { AppendOwnerStateReturnType } from '@mui/utils/appendOwnerState'; |
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.
I'm confused about this. Would it mean we will have:
@mui/material/ClickAwayListener
@mui/base/ClickAwayListener
@base_ui/react/ClickAwayListener
. I mean, I imagine we need it https://stackoverflow.com/questions/32553158/detect-click-outside-react-component