diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index d57d8736268d66..f02e3d66c811c1 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -8,6 +8,7 @@ "packages/material-ui-system", "packages/material-ui-types", "packages/material-ui-utils", + "packages/material-ui-unstyled", "packages/material-ui-styled-engine", "packages/material-ui-styled-engine-sc" ], @@ -20,7 +21,8 @@ "@material-ui/styled-engine-sc": "packages/material-ui-styled-engine-sc/build", "@material-ui/system": "packages/material-ui-system/build", "@material-ui/types": "packages/material-ui-types", - "@material-ui/utils": "packages/material-ui-utils/build" + "@material-ui/utils": "packages/material-ui-utils/build", + "@material-ui/unstyled": "packages/material-ui-unstyled/build" }, "sandboxes": [ "material-ui-issue-dh2yh", diff --git a/babel.config.js b/babel.config.js index b5f0c1cd970c0f..b5b77d8501928a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,6 +12,7 @@ const defaultAlias = { '@material-ui/styled-engine-sc': './packages/material-ui-styled-engine-sc/src', '@material-ui/styles': './packages/material-ui-styles/src', '@material-ui/system': './packages/material-ui-system/src', + '@material-ui/unstyled': './packages/material-ui-unstyled/src', '@material-ui/utils': './packages/material-ui-utils/src', 'typescript-to-proptypes': './packages/typescript-to-proptypes/src', }; diff --git a/docs/babel.config.js b/docs/babel.config.js index c17c6843349a53..4a80d57e5156f0 100644 --- a/docs/babel.config.js +++ b/docs/babel.config.js @@ -25,6 +25,7 @@ const alias = { // '@material-ui/styled-engine': '../packages/material-ui-styled-engine-sc/src', '@material-ui/system': '../packages/material-ui-system/src', '@material-ui/utils': '../packages/material-ui-utils/src', + '@material-ui/unstyled': '../packages/material-ui-unstyled/src', docs: './', modules: '../modules', pages: './pages', diff --git a/docs/next.config.js b/docs/next.config.js index 178ad045e1cffb..cc54352f5913df 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -131,6 +131,7 @@ module.exports = { '@material-ui/styles': '../packages/material-ui-styles/src', '@material-ui/system': '../packages/material-ui-system/src', '@material-ui/utils': '../packages/material-ui-utils/src', + '@material-ui/unstyled': '../packages/material-ui-unstyled/src', }, transformFunctions: ['require'], }, diff --git a/docs/package.json b/docs/package.json index 0fd8ef0dd84224..65f709963cc5d3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -38,6 +38,7 @@ "@material-ui/styles": "^5.0.0-alpha.1", "@material-ui/system": "^5.0.0-alpha.1", "@material-ui/types": "^5.0.0", + "@material-ui/unstyled": "^5.0.0-alpha.1", "@trendmicro/react-interpolate": "^0.5.5", "@types/autosuggest-highlight": "^3.1.0", "@types/css-mediaquery": "^0.1.0", diff --git a/docs/pages/api-docs/slider-unstyled.md b/docs/pages/api-docs/slider-unstyled.md index a5c01589498091..1aa5fe1e92ff93 100644 --- a/docs/pages/api-docs/slider-unstyled.md +++ b/docs/pages/api-docs/slider-unstyled.md @@ -1,5 +1,5 @@ --- -filename: /packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js +filename: /packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js --- @@ -11,9 +11,9 @@ filename: /packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js ## Import ```js -import SliderUnstyled from '@material-ui/lab/SliderUnstyled'; +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; // or -import { SliderUnstyled } from '@material-ui/lab'; +import { SliderUnstyled } from '@material-ui/unstyled'; ``` You can learn more about the difference by [reading this guide](/guides/minimizing-bundle-size/). diff --git a/docs/src/modules/utils/helpers.js b/docs/src/modules/utils/helpers.js index 7bde646e578880..ca337f20c312e3 100644 --- a/docs/src/modules/utils/helpers.js +++ b/docs/src/modules/utils/helpers.js @@ -140,6 +140,7 @@ function getDependencies(raw, options = {}) { '@material-ui/styled-engine-sc': getMuiPackageVersion('styled-engine-sc', muiCommitRef), '@material-ui/styles': getMuiPackageVersion('styles', muiCommitRef), '@material-ui/system': getMuiPackageVersion('system', muiCommitRef), + '@material-ui/unstyled': getMuiPackageVersion('unstyled', muiCommitRef), '@material-ui/utils': getMuiPackageVersion('utils', muiCommitRef), '@material-ui/pickers': 'next', '@emotion/core': 'latest', diff --git a/docs/src/pages/components/slider-styled/UnstyledSlider.js b/docs/src/pages/components/slider-styled/UnstyledSlider.js index 3a192601c49ee5..3582f918e9d5b5 100644 --- a/docs/src/pages/components/slider-styled/UnstyledSlider.js +++ b/docs/src/pages/components/slider-styled/UnstyledSlider.js @@ -1,6 +1,6 @@ import * as React from 'react'; import { experimentalStyled as styled } from '@material-ui/core/styles'; -import SliderUnstyled from '@material-ui/lab/SliderUnstyled'; +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; const StyledSlider = styled(SliderUnstyled)` color: black; diff --git a/docs/src/pages/components/slider-styled/UnstyledSlider.tsx b/docs/src/pages/components/slider-styled/UnstyledSlider.tsx index 3a192601c49ee5..3582f918e9d5b5 100644 --- a/docs/src/pages/components/slider-styled/UnstyledSlider.tsx +++ b/docs/src/pages/components/slider-styled/UnstyledSlider.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { experimentalStyled as styled } from '@material-ui/core/styles'; -import SliderUnstyled from '@material-ui/lab/SliderUnstyled'; +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; const StyledSlider = styled(SliderUnstyled)` color: black; diff --git a/package.json b/package.json index 1852ca5f4ac3c2..fbcc0ea1bf8edc 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "benchmark:browser": "yarn workspace benchmark browser", "build:codesandbox": "lerna run --parallel --scope \"@material-ui/*\" build", "docs:api": "rimraf ./docs/pages/api-docs && yarn docs:api:build", - "docs:api:build": "cross-env BABEL_ENV=test __NEXT_EXPORT_TRAILING_SLASH=true babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/buildApi.ts ./docs/pages/api-docs ./packages/material-ui/src ./packages/material-ui-lab/src", + "docs:api:build": "cross-env BABEL_ENV=test __NEXT_EXPORT_TRAILING_SLASH=true babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/buildApi.ts ./docs/pages/api-docs ./packages/material-ui-unstyled/src ./packages/material-ui/src ./packages/material-ui-lab/src", "docs:build": "yarn workspace docs build", "docs:build-sw": "yarn workspace docs build-sw", "docs:build-color-preview": "babel-node scripts/buildColorTypes", diff --git a/packages/material-ui-lab/package.json b/packages/material-ui-lab/package.json index c370a8616c34ab..6252a7d11d41c7 100644 --- a/packages/material-ui-lab/package.json +++ b/packages/material-ui-lab/package.json @@ -48,6 +48,7 @@ "dependencies": { "@babel/runtime": "^7.4.4", "@material-ui/system": "^5.0.0-alpha.14", + "@material-ui/unstyled": "^5.0.0-alpha.14", "@material-ui/utils": "^5.0.0-alpha.14", "clsx": "^1.0.4", "prop-types": "^15.7.2", diff --git a/packages/material-ui-lab/src/SliderStyled/SliderStyled.d.ts b/packages/material-ui-lab/src/SliderStyled/SliderStyled.d.ts index 769b69945dbf65..3b80b4c84322c5 100644 --- a/packages/material-ui-lab/src/SliderStyled/SliderStyled.d.ts +++ b/packages/material-ui-lab/src/SliderStyled/SliderStyled.d.ts @@ -1,6 +1,9 @@ import * as React from 'react'; import { SxProps } from '@material-ui/core/Box'; -import { ExtendSliderUnstyledTypeMap, ExtendSliderUnstyled } from '../SliderUnstyled'; +import { + ExtendSliderUnstyledTypeMap, + ExtendSliderUnstyled, +} from '@material-ui/unstyled/SliderUnstyled'; export type SliderStyledTypeMap< D extends React.ElementType = 'span', diff --git a/packages/material-ui-lab/src/SliderStyled/SliderStyled.js b/packages/material-ui-lab/src/SliderStyled/SliderStyled.js index 85b20ef08b04e1..f47f91b54b331a 100644 --- a/packages/material-ui-lab/src/SliderStyled/SliderStyled.js +++ b/packages/material-ui-lab/src/SliderStyled/SliderStyled.js @@ -8,7 +8,7 @@ import { darken, } from '@material-ui/core/styles'; import { capitalize } from '@material-ui/core/utils'; -import SliderUnstyled from '../SliderUnstyled'; +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; import ValueLabelStyled from './ValueLabelStyled'; const overridesResolver = (props, styles, name) => { diff --git a/packages/material-ui-lab/src/SliderStyled/ValueLabelStyled.js b/packages/material-ui-lab/src/SliderStyled/ValueLabelStyled.js index d4a56df7213609..c1bf4da4ed3e18 100644 --- a/packages/material-ui-lab/src/SliderStyled/ValueLabelStyled.js +++ b/packages/material-ui-lab/src/SliderStyled/ValueLabelStyled.js @@ -1,6 +1,6 @@ import * as React from 'react'; import { useThemeProps, experimentalStyled } from '@material-ui/core/styles'; -import ValueLabelUnstyled from '../SliderUnstyled/ValueLabelUnstyled'; +import { ValueLabelUnstyled } from '@material-ui/unstyled/SliderUnstyled'; const overridesResolver = (_, styles) => { const componentName = 'MuiSlider-valueLabel'; diff --git a/packages/material-ui-lab/src/SliderUnstyled/index.d.ts b/packages/material-ui-lab/src/SliderUnstyled/index.d.ts deleted file mode 100644 index 89f78b13135807..00000000000000 --- a/packages/material-ui-lab/src/SliderUnstyled/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './SliderUnstyled'; -export * from './SliderUnstyled'; diff --git a/packages/material-ui-lab/src/SliderUnstyled/index.js b/packages/material-ui-lab/src/SliderUnstyled/index.js deleted file mode 100644 index 14f6f5b5479b07..00000000000000 --- a/packages/material-ui-lab/src/SliderUnstyled/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './SliderUnstyled'; diff --git a/packages/material-ui-lab/src/index.d.ts b/packages/material-ui-lab/src/index.d.ts index e39c77f9f8641c..d0c63e8c4a56d6 100644 --- a/packages/material-ui-lab/src/index.d.ts +++ b/packages/material-ui-lab/src/index.d.ts @@ -25,9 +25,6 @@ export * from './Skeleton'; export { default as SliderStyled } from './SliderStyled'; export * from './SliderStyled'; -export { default as SliderUnstyled } from './SliderUnstyled'; -export * from './SliderUnstyled'; - export { default as SpeedDial } from './SpeedDial'; export * from './SpeedDial'; diff --git a/packages/material-ui-lab/src/index.js b/packages/material-ui-lab/src/index.js index 89891ec2cb7e3f..f2ca8bff18413d 100644 --- a/packages/material-ui-lab/src/index.js +++ b/packages/material-ui-lab/src/index.js @@ -29,9 +29,6 @@ export * from './Skeleton'; export { default as SliderStyled } from './SliderStyled'; export * from './SliderStyled'; -export { default as SliderUnstyled } from './SliderUnstyled'; -export * from './SliderUnstyled'; - export { default as SpeedDial } from './SpeedDial'; export * from './SpeedDial'; diff --git a/packages/material-ui-unstyled/README.md b/packages/material-ui-unstyled/README.md new file mode 100644 index 00000000000000..396298e112d10b --- /dev/null +++ b/packages/material-ui-unstyled/README.md @@ -0,0 +1,19 @@ +# @material-ui/unstyled + +This package hosts unstyled React components that can be used for creating custom design systems. + +## Installation + +Install the package in your project directory with: + +```sh +// with npm +npm install @material-ui/unstyled@next + +// with yarn +yarn add @material-ui/unstyled@next +``` + +## Documentation + +[The documentation](https://material-ui.com/) diff --git a/packages/material-ui-unstyled/package.json b/packages/material-ui-unstyled/package.json new file mode 100644 index 00000000000000..360616acb492e9 --- /dev/null +++ b/packages/material-ui-unstyled/package.json @@ -0,0 +1,63 @@ +{ + "name": "@material-ui/unstyled", + "version": "5.0.0-alpha.14", + "private": false, + "author": "Material-UI Team", + "description": "Material-UI Unstyled - collection of unstyled React components.", + "main": "./src/index.js", + "keywords": [ + "react", + "react-component", + "material-ui", + "unstyled" + ], + "repository": { + "type": "git", + "url": "https://github.com/mui-org/material-ui.git", + "directory": "packages/material-ui-unstyled" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/mui-org/material-ui/issues" + }, + "homepage": "https://material-ui.com", + "scripts": { + "build": "yarn build:legacy && yarn build:modern &&yarn build:node && yarn build:stable && yarn build:copy-files", + "build:legacy": "node ../../scripts/build legacy", + "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", + "prebuild": "rimraf build", + "release": "yarn build && npm publish build --tag next", + "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/material-ui-lab/**/*.test.{js,ts,tsx}'", + "typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{spec,d}.{ts,tsx}\" && tsc -p tsconfig.json" + }, + "peerDependencies": { + "@types/react": "^16.8.6", + "react": "^16.8.0", + "react-dom": "^16.8.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + }, + "dependencies": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "^5.0.0-alpha.14", + "clsx": "^1.0.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0" + }, + "devDependencies": { + "@material-ui/types": "^5.1.0" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=10.0.0" + } +} diff --git a/packages/material-ui-unstyled/src/OverridableComponent.d.ts b/packages/material-ui-unstyled/src/OverridableComponent.d.ts new file mode 100644 index 00000000000000..1ef05f04dc9d8a --- /dev/null +++ b/packages/material-ui-unstyled/src/OverridableComponent.d.ts @@ -0,0 +1,51 @@ +import * as React from 'react'; +import { Omit } from '@material-ui/types'; + +/** + * A component whose root component can be controlled via a `component` prop. + * + * Adjusts valid props based on the type of `component`. + */ +export interface OverridableComponent { + ( + props: { + /** + * The component used for the root node. + * Either a string to use a HTML element or a component. + */ + component: C; + } & OverrideProps + ): JSX.Element; + (props: DefaultComponentProps): JSX.Element; +} + +/** + * Props of the component if `component={Component}` is used. + */ +// prettier-ignore +export type OverrideProps< + M extends OverridableTypeMap, + C extends React.ElementType +> = ( + & BaseProps + & Omit, keyof BaseProps> +); + +/** + * Props if `component={Component}` is NOT used. + */ +// prettier-ignore +export type DefaultComponentProps = + & BaseProps + & Omit, keyof BaseProps>; + +/** + * Props defined on the component (+ common material-ui props). + */ +// prettier-ignore +export type BaseProps = M['props']; + +export interface OverridableTypeMap { + props: {}; + defaultComponent: React.ElementType; +} diff --git a/packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.d.ts b/packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.d.ts similarity index 98% rename from packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.d.ts rename to packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.d.ts index 365c53559e79aa..f9df1dc3d505e9 100644 --- a/packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.d.ts +++ b/packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.d.ts @@ -1,4 +1,4 @@ -import { OverridableComponent, OverridableTypeMap } from '@material-ui/core/OverridableComponent'; +import { OverridableComponent, OverridableTypeMap } from '../OverridableComponent'; export interface Mark { value: number; diff --git a/packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js b/packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js similarity index 98% rename from packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js rename to packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js index 93ac95061a175d..b72450c4a641b0 100644 --- a/packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js +++ b/packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js @@ -1,16 +1,16 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; -import { chainPropTypes } from '@material-ui/utils'; import { - useIsFocusVisible, + chainPropTypes, + unstable_useIsFocusVisible as useIsFocusVisible, unstable_useEnhancedEffect as useEnhancedEffect, - ownerDocument, - useEventCallback, - useForkRef, - capitalize, - useControlled, -} from '@material-ui/core/utils'; + unstable_ownerDocument as ownerDocument, + unstable_useEventCallback as useEventCallback, + unstable_useForkRef as useForkRef, + unstable_capitalize as capitalize, + unstable_useControlled as useControlled, +} from '@material-ui/utils'; import ValueLabelComponent from './ValueLabelUnstyled'; function asc(a, b) { diff --git a/packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.test.js b/packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.test.js similarity index 100% rename from packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.test.js rename to packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.test.js diff --git a/packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.d.ts b/packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.d.ts new file mode 100644 index 00000000000000..931495f006b9fa --- /dev/null +++ b/packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.d.ts @@ -0,0 +1,30 @@ +import * as React from 'react'; + +export interface ValueLabelUnstyledProps { + className?: string; + style?: React.CSSProperties; + /** + * The components used for each slot inside the ValueLabel. + * Either a string to use a HTML element or a component. + * @default {} + */ + components?: { + Root?: React.ElementType; + }; + /** + * The value of the slider. + * For ranged sliders, provide an array with two values. + */ + value?: number | number[]; + /** + * Controls when the value label is displayed: + * + * - `auto` the value label will display when the thumb is hovered or focused. + * - `on` will display persistently. + * - `off` will never display. + * @default 'off' + */ + valueLabelDisplay?: 'on' | 'auto' | 'off'; +} + +export default function ValueLabel(props: ValueLabelUnstyledProps): JSX.Element; diff --git a/packages/material-ui-lab/src/SliderUnstyled/ValueLabelUnstyled.js b/packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.js similarity index 94% rename from packages/material-ui-lab/src/SliderUnstyled/ValueLabelUnstyled.js rename to packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.js index 7d254f7c5f1a92..5c351efd78a64a 100644 --- a/packages/material-ui-lab/src/SliderUnstyled/ValueLabelUnstyled.js +++ b/packages/material-ui-unstyled/src/SliderUnstyled/ValueLabelUnstyled.js @@ -1,6 +1,6 @@ import * as React from 'react'; -import { capitalize } from '@material-ui/core/utils'; import clsx from 'clsx'; +import { unstable_capitalize as capitalize } from '@material-ui/utils'; const getUtilityClass = (name) => { return `MuiSlider-valueLabel${capitalize(name)}`; diff --git a/packages/material-ui-unstyled/src/SliderUnstyled/index.d.ts b/packages/material-ui-unstyled/src/SliderUnstyled/index.d.ts new file mode 100644 index 00000000000000..00e1bbef8e481b --- /dev/null +++ b/packages/material-ui-unstyled/src/SliderUnstyled/index.d.ts @@ -0,0 +1,4 @@ +export { default } from './SliderUnstyled'; +export * from './SliderUnstyled'; +export { default as ValueLabelUnstyled } from './ValueLabelUnstyled'; +export * from './ValueLabelUnstyled'; diff --git a/packages/material-ui-unstyled/src/SliderUnstyled/index.js b/packages/material-ui-unstyled/src/SliderUnstyled/index.js new file mode 100644 index 00000000000000..ff1b7e2b1d2cb7 --- /dev/null +++ b/packages/material-ui-unstyled/src/SliderUnstyled/index.js @@ -0,0 +1,2 @@ +export { default } from './SliderUnstyled'; +export { default as ValueLabelUnstyled } from './ValueLabelUnstyled'; diff --git a/packages/material-ui-unstyled/src/index.d.ts b/packages/material-ui-unstyled/src/index.d.ts new file mode 100644 index 00000000000000..b99d51ffb7908e --- /dev/null +++ b/packages/material-ui-unstyled/src/index.d.ts @@ -0,0 +1,2 @@ +export { default as SliderUnstyled } from './SliderUnstyled'; +export * from './SliderUnstyled'; diff --git a/packages/material-ui-unstyled/src/index.js b/packages/material-ui-unstyled/src/index.js new file mode 100644 index 00000000000000..b99d51ffb7908e --- /dev/null +++ b/packages/material-ui-unstyled/src/index.js @@ -0,0 +1,2 @@ +export { default as SliderUnstyled } from './SliderUnstyled'; +export * from './SliderUnstyled'; diff --git a/packages/material-ui-unstyled/src/index.test.js b/packages/material-ui-unstyled/src/index.test.js new file mode 100644 index 00000000000000..14b6a93996f844 --- /dev/null +++ b/packages/material-ui-unstyled/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 MaterialUI from './index'; + +describe('@material-ui/unstyled', () => { + it('should have exports', () => { + expect(typeof MaterialUI).to.equal('object'); + }); + + it('should not have undefined exports', () => { + Object.keys(MaterialUI).forEach((exportKey) => + expect(Boolean(MaterialUI[exportKey])).to.equal(true), + ); + }); +}); diff --git a/packages/material-ui-unstyled/tsconfig.json b/packages/material-ui-unstyled/tsconfig.json new file mode 100644 index 00000000000000..9baeec04607c9f --- /dev/null +++ b/packages/material-ui-unstyled/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig", + "include": ["src/**/*", "test/**/*", "../material-ui/src/internal/svg-icons/Add.js"] +} diff --git a/scripts/generateProptypes.ts b/scripts/generateProptypes.ts index 3141f405fd4ea7..035ed8d2c9b843 100644 --- a/scripts/generateProptypes.ts +++ b/scripts/generateProptypes.ts @@ -185,8 +185,12 @@ async function generateProptypes( const jsContent = await fse.readFile(jsFile, 'utf8'); const unstyledFile = tsFile.endsWith('Styled.d.ts') - ? tsFile.replace(/Styled/g, 'Unstyled') + ? tsFile.replace(/material-ui-lab|material-ui-core|Styled/g, (matched) => { + if (matched === 'Styled') return 'Unstyled'; + return 'material-ui-unstyled'; + }) : null; + const result = ttp.inject(proptypes, jsContent, { removeExistingPropTypes: true, babelOptions: { @@ -279,6 +283,7 @@ async function run(argv: HandlerArgv) { const allFiles = await Promise.all( [ + path.resolve(__dirname, '../packages/material-ui-unstyled/src'), path.resolve(__dirname, '../packages/material-ui/src'), path.resolve(__dirname, '../packages/material-ui-lab/src'), ].map((folderPath) => diff --git a/scripts/sizeSnapshot/webpack.config.js b/scripts/sizeSnapshot/webpack.config.js index 5dbd325dcba86e..ba19ad1d6b8eaf 100644 --- a/scripts/sizeSnapshot/webpack.config.js +++ b/scripts/sizeSnapshot/webpack.config.js @@ -149,6 +149,7 @@ module.exports = async function webpackConfig(webpack, environment) { '@material-ui/styles': path.join(workspaceRoot, 'packages/material-ui-styles/build'), '@material-ui/system': path.join(workspaceRoot, 'packages/material-ui-system/build'), '@material-ui/utils': path.join(workspaceRoot, 'packages/material-ui-utils/build'), + '@material-ui/unstyled': path.join(workspaceRoot, 'packages/material-ui-unstyled/build'), }, }, entry: { [entry.name]: path.join(workspaceRoot, entry.path) }, diff --git a/tsconfig.json b/tsconfig.json index d11baad69c0603..8d338b36589c63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,6 +27,8 @@ "@material-ui/styles/*": ["./packages/material-ui-styles/src/*"], "@material-ui/system": ["./packages/material-ui-system/src"], "@material-ui/types": ["./packages/material-ui-types"], + "@material-ui/unstyled": ["./packages/material-ui-unstyled/src"], + "@material-ui/unstyled/*": ["./packages/material-ui-unstyled/src/*"], "test/*": ["./test/*"], "typescript-to-proptypes": ["./packages/typescript-to-proptypes/src"] }, diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index a28ca8cc895e42..c5715bccedccad 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -23,6 +23,7 @@ module.exports = { ), '@material-ui/styles': path.resolve(__dirname, './packages/material-ui-styles/src'), '@material-ui/system': path.resolve(__dirname, './packages/material-ui-system/src'), + '@material-ui/unstyled': path.resolve(__dirname, './packages/material-ui-unstyled/src'), '@material-ui/utils': path.resolve(__dirname, './packages/material-ui-utils/src'), 'typescript-to-proptypes': path.resolve(__dirname, './packages/typescript-to-proptypes/src'), docs: path.resolve(__dirname, './docs'),