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

[Popper] Move from mui-material to mui-core #28923

Merged
merged 18 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b1234e7
[Popper]: Move from mui-material to mui-core
rebeccahongsf Oct 8, 2021
f55f1fc
[Popper]Import Popper back into mui-material pkg
rebeccahongsf Oct 8, 2021
fedca53
[Popper]:Revert Popper import path for dependents
rebeccahongsf Oct 8, 2021
50cdaaf
[Popper]: Update Tooltip popper import
rebeccahongsf Oct 8, 2021
5a5ac5b
[Popper]: Revert Popper import
rebeccahongsf Oct 8, 2021
00f92d3
[Popper]: Run yarn prettier
rebeccahongsf Oct 8, 2021
816b370
[Popper]: Update documentation to include Unstyled import
rebeccahongsf Oct 9, 2021
37774e5
[Popper]: Remove unnecessary Popper import within core index.js
rebeccahongsf Oct 9, 2021
74189c1
[Popper]: Update documentation to display correct import name for Pop…
rebeccahongsf Oct 9, 2021
ecd82d9
[Popper]: Fix Popper import within Tooltip
rebeccahongsf Oct 9, 2021
70d6d73
[Popper]: Revert Popper export changes in material
rebeccahongsf Oct 11, 2021
f317878
[Popper] Update imports to follow the same format as other files
rebeccahongsf Oct 11, 2021
0a4d05d
[Popper]: Remove popper package from material
rebeccahongsf Oct 11, 2021
8ad39d2
[Popper]: Add popperjs pkg to core
rebeccahongsf Oct 11, 2021
e23ed5e
[Popper]: Adjust Popper ThemeProvider import, Revert PickersPopper po…
rebeccahongsf Oct 12, 2021
3586940
[Popper]: Update snapshot scripts webpack conditional for Popper testing
rebeccahongsf Oct 12, 2021
20d0df0
Merge remote-tracking branch 'upstream/master' into unstyled-popper
rebeccahongsf Oct 12, 2021
5278e11
[Popper]: Fixup prettier issue with webpack
rebeccahongsf Oct 12, 2021
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
2 changes: 1 addition & 1 deletion docs/pages/api-docs/popper.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"styles": { "classes": [], "globalClasses": {}, "name": null },
"spread": true,
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/mui-material/src/Popper/Popper.js",
"filename": "/packages/mui-core/src/Popper/Popper.js",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/autocomplete/\">Autocomplete</a></li>\n<li><a href=\"/components/menus/\">Menus</a></li>\n<li><a href=\"/components/popper/\">Popper</a></li></ul>",
"cssComponent": false
Expand Down
8 changes: 8 additions & 0 deletions docs/src/pages/components/popper/popper.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ There is a 3rd party package [`material-ui-popup-state`](https://github.com/jcor
state for you in most cases.

{{"demo": "pages/components/popper/PopperPopupState.js"}}

## Unstyled

As the component does not have any styles, it also comes with the unstyled package.

```js
import Popper from '@mui/core/Popper';
```
1 change: 1 addition & 0 deletions packages/mui-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@babel/runtime": "^7.15.4",
"@emotion/is-prop-valid": "^1.1.0",
"@mui/utils": "^5.0.1",
"@popperjs/core": "^2.4.4",
"clsx": "^1.1.1",
"prop-types": "^15.7.2",
"react-is": "^17.0.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { createPopper } from '@popperjs/core';
import { chainPropTypes, refType, HTMLElementType } from '@mui/utils';
import { useThemeWithoutDefault as useTheme } from '@mui/system';
import {
chainPropTypes,
HTMLElementType,
refType,
unstable_ownerDocument as ownerDocument,
unstable_useEnhancedEffect as useEnhancedEffect,
unstable_useForkRef as useForkRef,
} from '@mui/utils';
import { createPopper } from '@popperjs/core';
rebeccahongsf marked this conversation as resolved.
Show resolved Hide resolved
import PropTypes from 'prop-types';
import * as React from 'react';
import Portal from '../Portal';
import ownerDocument from '../utils/ownerDocument';
import useForkRef from '../utils/useForkRef';
import useEnhancedEffect from '../utils/useEnhancedEffect';

function flipPlacement(placement, theme) {
const direction = (theme && theme.direction) || 'ltr';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { expect } from 'chai';
import { useFakeTimers } from 'sinon';
import PropTypes from 'prop-types';
import { describeConformance, act, createClientRender, fireEvent, screen } from 'test/utils';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import { ThemeProvider, createTheme } from '@mui/system';
import Grow from '@mui/material/Grow';
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
import Popper from '@mui/material/Popper';
import Popper from '@mui/core/Popper';

describe('<Popper />', () => {
let rtlTheme;
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-core/src/Popper/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './Popper';
export * from './Popper';
1 change: 1 addition & 0 deletions packages/mui-core/src/Popper/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Popper';
3 changes: 3 additions & 0 deletions packages/mui-core/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export * from './ModalUnstyled';

export { default as NoSsr } from './NoSsr';

export { default as Popper } from './Popper';
export * from './Popper';

export { default as Portal } from './Portal';
export * from './Portal';

Expand Down
2 changes: 2 additions & 0 deletions packages/mui-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export * from './ModalUnstyled';

export { default as NoSsr } from './NoSsr';

export { default as Popper } from './Popper';

export { default as Portal } from './Portal';

export { default as SliderUnstyled } from './SliderUnstyled';
Expand Down
1 change: 0 additions & 1 deletion packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@mui/system": "^5.0.3",
"@mui/types": "^7.0.0",
"@mui/utils": "^5.0.1",
"@popperjs/core": "^2.4.4",
"@types/react-transition-group": "^4.4.3",
"clsx": "^1.1.1",
"csstype": "^3.0.9",
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Popper/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './Popper';
export * from './Popper';
export { default } from '@mui/core/Popper';
export * from '@mui/core/Popper';
2 changes: 1 addition & 1 deletion packages/mui-material/src/Popper/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './Popper';
export { default } from '@mui/core/Popper';
2 changes: 1 addition & 1 deletion packages/mui-material/src/Tooltip/Tooltip.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { MUIStyledCommonProps, SxProps } from '@mui/system';
import { PopperProps } from '@mui/core/Popper';
import { InternalStandardProps as StandardProps, Theme } from '..';
import { TransitionProps } from '../transitions/transition';
import { PopperProps } from '../Popper/Popper';
import { TooltipClasses } from './tooltipClasses';

export interface TooltipComponentsPropsOverrides {}
Expand Down
9 changes: 6 additions & 3 deletions scripts/sizeSnapshot/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ async function getWebpackEntries() {
entryName = '@material-ui/core/Paper.esm';
} else if (componentName === 'TextareaAutosize') {
entryName = '@material-ui/core/Textarea';
} else if (['Popper'].indexOf(componentName) !== -1) {
entryName = `@material-ui/core/${componentName}`;
}

return {
Expand All @@ -32,9 +30,14 @@ async function getWebpackEntries() {
const coreComponents = (await glob(path.join(corePackagePath, '([A-Z])*/index.js'))).map(
(componentPath) => {
const componentName = path.basename(path.dirname(componentPath));
let entryName = componentName;

if (['Popper'].indexOf(componentName) !== -1) {
entryName = `@material-ui/core/${componentName}`;
}

return {
id: componentName,
id: entryName,
path: path.relative(workspaceRoot, path.dirname(componentPath)),
};
},
Expand Down