Skip to content
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

Merged
merged 25 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/data/material/pagesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Copy link
Member

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:

SCR-20240713-bcxd

{ pathname: '/material-ui/api/collapse' },
{ pathname: '/material-ui/api/container' },
{ pathname: '/material-ui/api/css-baseline' },
Expand Down Expand Up @@ -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' },
Expand All @@ -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' },
Expand Down Expand Up @@ -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' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ pathname: '/material-ui/api/text-field' },
{ pathname: '/material-ui/api/timeline' },
{ pathname: '/material-ui/api/timeline-connector' },
Expand Down
23 changes: 23 additions & 0 deletions docs/pages/material-ui/api/click-away-listener.js
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,
};
};
34 changes: 34 additions & 0 deletions docs/pages/material-ui/api/click-away-listener.json
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>&#124;&nbsp;'onMouseDown'<br>&#124;&nbsp;'onMouseUp'<br>&#124;&nbsp;'onPointerDown'<br>&#124;&nbsp;'onPointerUp'<br>&#124;&nbsp;false"
},
"default": "'onClick'"
},
"touchEvent": {
"type": {
"name": "enum",
"description": "'onTouchEnd'<br>&#124;&nbsp;'onTouchStart'<br>&#124;&nbsp;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
}
19 changes: 19 additions & 0 deletions docs/pages/material-ui/api/no-ssr.js
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,
};
};
17 changes: 17 additions & 0 deletions docs/pages/material-ui/api/no-ssr.json
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
}
9 changes: 8 additions & 1 deletion docs/pages/material-ui/api/popper.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@
"import Popper from '@mui/material/Popper';",
"import { Popper } from '@mui/material';"
],
"classes": [],
"classes": [
{
"key": "root",
aarongarciah marked this conversation as resolved.
Show resolved Hide resolved
"className": "MuiPopper-root",
"description": "Class name applied to the root element.",
"isGlobal": false
}
],
"spread": true,
"themeDefaultProps": false,
"muiName": "MuiPopper",
Expand Down
19 changes: 19 additions & 0 deletions docs/pages/material-ui/api/portal.js
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,
};
};
20 changes: 20 additions & 0 deletions docs/pages/material-ui/api/portal.json
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>&#124;&nbsp;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
}
23 changes: 23 additions & 0 deletions docs/pages/material-ui/api/textarea-autosize.js
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,
};
};
22 changes: 22 additions & 0 deletions docs/pages/material-ui/api/textarea-autosize.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"props": {
"maxRows": { "type": { "name": "union", "description": "number<br>&#124;&nbsp;string" } },
"minRows": {
"type": { "name": "union", "description": "number<br>&#124;&nbsp;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 &quot;click away&quot; event is detected."
},
"touchEvent": {
"description": "The touch event to listen to. You can disable the listener by providing <code>false</code>."
}
},
"classDescriptions": {}
}
11 changes: 11 additions & 0 deletions docs/translations/api-docs/no-ssr/no-ssr.json
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": {}
}
2 changes: 1 addition & 1 deletion docs/translations/api-docs/popper/popper.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
"description": "Help supporting a react-transition-group/Transition component."
}
},
"classDescriptions": {}
"classDescriptions": { "root": { "description": "Class name applied to the root element." } }
}
13 changes: 13 additions & 0 deletions docs/translations/api-docs/portal/portal.json
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&#39;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": {}
}
1 change: 0 additions & 1 deletion packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
},
"dependencies": {
"@babel/runtime": "^7.24.7",
"@mui/base": "workspace:*",
"@mui/core-downloads-tracker": "workspace:^",
"@mui/system": "workspace:*",
"@mui/types": "workspace:^",
Expand Down
13 changes: 6 additions & 7 deletions packages/mui-material/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { OverridableStringUnion } from '@mui/types';
import {
useAutocomplete,
import { IconButtonProps, InternalStandardProps as StandardProps, Theme } from '@mui/material';
import { ChipProps, ChipTypeMap } from '@mui/material/Chip';
import { PaperProps } from '@mui/material/Paper';
import { PopperProps } from '@mui/material/Popper';
import useAutocomplete, {
AutocompleteChangeDetails,
AutocompleteChangeReason,
AutocompleteCloseReason,
Expand All @@ -11,11 +14,7 @@ import {
createFilterOptions,
UseAutocompleteProps,
AutocompleteFreeSoloValueMapping,
} from '@mui/base';
import { IconButtonProps, InternalStandardProps as StandardProps, Theme } from '@mui/material';
import { ChipProps, ChipTypeMap } from '@mui/material/Chip';
import { PaperProps } from '@mui/material/Paper';
import { PopperProps } from '@mui/material/Popper';
} from '../useAutocomplete';
import { AutocompleteClasses } from './autocompleteClasses';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import PropTypes from 'prop-types';
import clsx from 'clsx';
import integerPropType from '@mui/utils/integerPropType';
import chainPropTypes from '@mui/utils/chainPropTypes';
import { useAutocomplete, createFilterOptions } from '@mui/base';
import composeClasses from '@mui/utils/composeClasses';
import { alpha } from '@mui/system/colorManipulator';
import useAutocomplete, { createFilterOptions } from '../useAutocomplete';
import Popper from '../Popper';
import ListSubheader from '../ListSubheader';
import Paper from '../Paper';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Badge/Badge.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { OverridableStringUnion, Simplify } from '@mui/types';
import { SlotComponentProps } from '@mui/base/utils';
import { SlotComponentProps } from '../utils/types';
import { Theme } from '../styles';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
import { BadgeClasses } from './badgeClasses';
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import PropTypes from 'prop-types';
import clsx from 'clsx';
import usePreviousProps from '@mui/utils/usePreviousProps';
import composeClasses from '@mui/utils/composeClasses';
import { useBadge } from '@mui/base/useBadge';
import { useSlotProps } from '@mui/base/utils';
import useBadge from './useBadge';
import useSlotProps from '../utils/useSlotProps';
import { styled } from '../zero-styled';
import { useDefaultProps } from '../DefaultPropsProvider';
import capitalize from '../utils/capitalize';
Expand Down
Loading