diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index c51c718fec40a8..15a9793db09626 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -14,7 +14,8 @@ "packages/mui-utils", "packages/mui-core", "packages/mui-styled-engine", - "packages/mui-styled-engine-sc" + "packages/mui-styled-engine-sc", + "packages/mui-material-next" ], "publishDirectory": { "@mui/codemod": "packages/mui-codemod/build", @@ -28,7 +29,8 @@ "@mui/private-theming": "packages/mui-private-theming/build", "@mui/types": "packages/mui-types/build", "@mui/utils": "packages/mui-utils/build", - "@mui/core": "packages/mui-core/build" + "@mui/core": "packages/mui-core/build", + "@mui/material-next": "packages/mui-material-next/build" }, "sandboxes": [ "material-ui-issue-dh2yh", diff --git a/babel.config.js b/babel.config.js index e1bc92ed298e55..83d84b153b35a4 100644 --- a/babel.config.js +++ b/babel.config.js @@ -20,6 +20,7 @@ const defaultAlias = { '@mui/private-theming': resolveAliasPath('./packages/mui-private-theming/src'), '@mui/core': resolveAliasPath('./packages/mui-core/src'), '@mui/utils': resolveAliasPath('./packages/mui-utils/src'), + '@mui/material-next': resolveAliasPath('./packages/mui-material-next/src'), }; const productionPlugins = [ diff --git a/docs/babel.config.js b/docs/babel.config.js index efbdbb27e53504..a1bbaac6f73550 100644 --- a/docs/babel.config.js +++ b/docs/babel.config.js @@ -27,6 +27,7 @@ const alias = { '@mui/private-theming': '../packages/mui-private-theming/src', '@mui/utils': '../packages/mui-utils/src', '@mui/core': '../packages/mui-core/src', + '@mui/material-next': '../packages/mui-material-next/src', docs: './', modules: '../modules', pages: './pages', diff --git a/docs/next.config.js b/docs/next.config.js index 74647cc08e5e5d..801a76d61beafb 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -129,6 +129,7 @@ module.exports = { '@mui/private-theming': '../packages/mui-private-theming/src', '@mui/utils': '../packages/mui-utils/src', '@mui/core': '../packages/mui-core/src', + '@mui/material-next': '../packages/mui-material-next/src', // all legacy package names in this monorepo '@material-ui/core': '../packages/mui-material/src', '@material-ui/docs': '../packages/mui-docs/src', diff --git a/docs/src/modules/utils/helpers.ts b/docs/src/modules/utils/helpers.ts index 2a9bcec3c89ebf..3d07c0e08700eb 100644 --- a/docs/src/modules/utils/helpers.ts +++ b/docs/src/modules/utils/helpers.ts @@ -170,6 +170,7 @@ export function getDependencies( '@mui/private-theming': getMuiPackageVersion('theming', muiCommitRef), '@mui/core': getMuiPackageVersion('core', muiCommitRef), '@mui/utils': getMuiPackageVersion('utils', muiCommitRef), + '@mui/material-next': getMuiPackageVersion('material-next', muiCommitRef), }; // TODO: Where is this coming from and why does it need to be injected this way. diff --git a/packages/mui-material-next/README.md b/packages/mui-material-next/README.md new file mode 100644 index 00000000000000..e9a273af19a2fa --- /dev/null +++ b/packages/mui-material-next/README.md @@ -0,0 +1,5 @@ +# @mui/material-next + +Material Design components built using @mui/core. + +This package is a nursery for components that will ultimately replace the @mui/material ones. diff --git a/packages/mui-material-next/package.json b/packages/mui-material-next/package.json new file mode 100644 index 00000000000000..9c8c726837bae9 --- /dev/null +++ b/packages/mui-material-next/package.json @@ -0,0 +1,81 @@ +{ + "name": "@mui/material-next", + "version": "6.0.0-alpha.0", + "private": false, + "author": "Material-UI Team", + "description": "Material Design components built using @mui/core.", + "main": "./src/index.ts", + "keywords": [ + "react", + "react-component", + "material-ui", + "material design" + ], + "repository": { + "type": "git", + "url": "https://github.com/mui-org/material-ui.git", + "directory": "packages/mui-material-next" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/mui-org/material-ui/issues" + }, + "homepage": "https://material-ui.com/", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/material-ui" + }, + "scripts": { + "build": "yarn build:modern && yarn build:node && yarn build:stable && yarn build:types && yarn build:copy-files", + "build:modern": "node ../../scripts/build modern", + "build:node": "node ../../scripts/build node", + "build:stable": "node ../../scripts/build stable", + "build:copy-files": "node ../../scripts/copy-files.js", + "build:types": "node ../../scripts/buildTypes", + "prebuild": "rimraf build tsconfig.build.tsbuildinfo", + "release": "yarn build && npm publish build --tag next", + "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-material-next/**/*.test.{js,ts,tsx}'", + "typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{spec,d}.{ts,tsx}\" && tsc -p tsconfig.json", + "typescript:module-augmentation": "node scripts/testModuleAugmentation.js" + }, + "peerDependencies": { + "@emotion/react": "^11.4.1", + "@emotion/styled": "^11.3.0", + "@types/react": "^16.8.6 || ^17.0.0", + "react": "^17.0.2", + "react-dom": "^17.0.2" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@emotion/react": { + "optional": true + }, + "@emotion/styled": { + "optional": true + } + }, + "dependencies": { + "@babel/runtime": "^7.14.8", + "@mui/core": "5.0.0-alpha.45", + "@mui/system": "5.0.0-rc.0", + "@mui/types": "7.0.0-rc.0", + "@mui/utils": "5.0.0-rc.0", + "@popperjs/core": "^2.4.4", + "@types/react-transition-group": "^4.2.0", + "clsx": "^1.1.1", + "csstype": "^3.0.8", + "hoist-non-react-statics": "^3.3.2", + "prop-types": "^15.7.2", + "react-is": "^17.0.2", + "react-transition-group": "^4.4.0" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=12.0.0" + } +} diff --git a/packages/mui-material-next/src/index.test.js b/packages/mui-material-next/src/index.test.js new file mode 100644 index 00000000000000..c848ef0abc01ca --- /dev/null +++ b/packages/mui-material-next/src/index.test.js @@ -0,0 +1,20 @@ +/* eslint import/namespace: ['error', { allowComputed: true }] */ +/** + * Important: This test also serves as a point to + * import the entire lib for coverage reporting + */ + +import { expect } from 'chai'; +import * as materialNext from './index'; + +describe('@mui/material-next', () => { + it('should have exports', () => { + expect(typeof materialNext).to.equal('object'); + }); + + it('should not have undefined exports', () => { + Object.keys(materialNext).forEach((exportKey) => + expect(Boolean(materialNext[exportKey])).to.equal(true), + ); + }); +}); diff --git a/packages/mui-material-next/src/index.ts b/packages/mui-material-next/src/index.ts new file mode 100644 index 00000000000000..2d1ec238274a0b --- /dev/null +++ b/packages/mui-material-next/src/index.ts @@ -0,0 +1 @@ +export default () => {}; diff --git a/packages/mui-material-next/tsconfig.build.json b/packages/mui-material-next/tsconfig.build.json new file mode 100644 index 00000000000000..fbbdcccf08b981 --- /dev/null +++ b/packages/mui-material-next/tsconfig.build.json @@ -0,0 +1,19 @@ +{ + // This config is for emitting declarations (.d.ts) only + // Actual .ts source files are transpiled via babel + "extends": "./tsconfig", + "compilerOptions": { + "composite": true, + "declaration": true, + "noEmit": false, + "emitDeclarationOnly": true, + "outDir": "build", + "rootDir": "./src" + }, + "include": ["./src/**/*.ts*"], + "exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"], + "references": [ + { "path": "../mui-core/tsconfig.build.json" }, + { "path": "../mui-system/tsconfig.build.json" } + ] +} diff --git a/packages/mui-material-next/tsconfig.json b/packages/mui-material-next/tsconfig.json new file mode 100644 index 00000000000000..f8b0df49de6047 --- /dev/null +++ b/packages/mui-material-next/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig", + "include": ["src/**/*"] +} diff --git a/scripts/generateProptypes.ts b/scripts/generateProptypes.ts index 593918106114f0..821d6b634e70b0 100644 --- a/scripts/generateProptypes.ts +++ b/scripts/generateProptypes.ts @@ -307,6 +307,7 @@ async function run(argv: HandlerArgv) { path.resolve(__dirname, '../packages/mui-core/src'), path.resolve(__dirname, '../packages/mui-material/src'), path.resolve(__dirname, '../packages/mui-lab/src'), + path.resolve(__dirname, '../packages/mui-material-next/src'), ].map((folderPath) => glob('+([A-Z])*/+([A-Z])*.*@(d.ts|ts|tsx)', { absolute: true, diff --git a/scripts/sizeSnapshot/webpack.config.js b/scripts/sizeSnapshot/webpack.config.js index fcc0410d69e87c..7d9007c3fd8841 100644 --- a/scripts/sizeSnapshot/webpack.config.js +++ b/scripts/sizeSnapshot/webpack.config.js @@ -52,6 +52,18 @@ async function getWebpackEntries() { }, ); + const materialNextPackagePath = path.join(workspaceRoot, 'packages/mui-material-next/build'); + const materialNextComponents = ( + await glob(path.join(materialNextPackagePath, '([A-Z])*/index.js')) + ).map((componentPath) => { + const componentName = path.basename(path.dirname(componentPath)); + + return { + name: componentName, + path: path.relative(workspaceRoot, path.dirname(componentPath)), + }; + }); + return [ { // WARNING: Changing the name will break tracking of bundle size over time @@ -125,6 +137,11 @@ async function getWebpackEntries() { name: '@material-ui/core.legacy', path: path.join(path.relative(workspaceRoot, materialPackagePath), 'legacy/index.js'), }, + { + name: '@mui/material-next', + path: path.join(path.relative(workspaceRoot, materialNextPackagePath), 'index.js'), + }, + ...materialNextComponents, ]; } diff --git a/test/karma.tests.js b/test/karma.tests.js index f694703fac3a63..aa6551f8549992 100644 --- a/test/karma.tests.js +++ b/test/karma.tests.js @@ -40,3 +40,10 @@ coreContext.keys().forEach(coreContext); const utilsContext = require.context('../packages/mui-utils/src/', true, /\.test\.(js|ts|tsx)$/); utilsContext.keys().forEach(utilsContext); + +const materialNextContext = require.context( + '../packages/mui-material-next/src/', + true, + /\.test\.(js|ts|tsx)$/, +); +materialNextContext.keys().forEach(materialNextContext); diff --git a/tsconfig.json b/tsconfig.json index 00bef307cec674..a48144fe5a7610 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,6 +33,8 @@ "@mui/core/*": ["./packages/mui-core/src/*"], "@mui/docs": ["./packages/mui-docs/src"], "@mui/docs/*": ["./packages/mui-docs/src/*"], + "@mui/material-next": ["./packages/mui-material-next/src"], + "@mui/material-next/*": ["./packages/mui-material-next/src/*"], "test/*": ["./test/*"], "typescript-to-proptypes": ["./packages/typescript-to-proptypes/src"] }, diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index 92a334618049c1..256269c375bf01 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -20,6 +20,7 @@ module.exports = { '@mui/private-theming': path.resolve(__dirname, './packages/mui-private-theming/src'), '@mui/core': path.resolve(__dirname, './packages/mui-core/src'), '@mui/utils': path.resolve(__dirname, './packages/mui-utils/src'), + '@mui/material-next': path.resolve(__dirname, './packages/mui-material-next/src'), 'typescript-to-proptypes': path.resolve(__dirname, './packages/typescript-to-proptypes/src'), docs: path.resolve(__dirname, './docs'), },