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

[unstyled] Create package and move SliderUnstyled there #23270

Merged
merged 30 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5901bda
move core/utils to utils
mnajdova Oct 26, 2020
c9489d7
prettier
mnajdova Oct 26, 2020
e866f5e
MuiError
mnajdova Oct 26, 2020
080dd7e
ts-ignore
mnajdova Oct 26, 2020
a717de8
scafolded new unstyled package and moved SliderUnstyled
mnajdova Oct 26, 2020
a31e1b0
proptypes & build:api updates
mnajdova Oct 26, 2020
7557b42
fixed exports
mnajdova Oct 26, 2020
a1fdfb4
typings
mnajdova Oct 26, 2020
562b060
lint errors & types fixes
mnajdova Oct 26, 2020
96a2f55
docs:api
mnajdova Oct 26, 2020
9b389b6
renamed Slider to SliderUnstyled
mnajdova Oct 27, 2020
ad82d99
Merge branch 'next' into feat/slider-unstyled-new-package
mnajdova Oct 27, 2020
b54dfd9
lint and ts errors
mnajdova Oct 27, 2020
c625415
Add compat for usage in utils itself
eps1lon Oct 27, 2020
bd907da
Fix lint
eps1lon Oct 27, 2020
3e1a26b
fixed unstyled path resolution
mnajdova Oct 27, 2020
324b3a8
exported new utils as unstable_
mnajdova Oct 27, 2020
11bbc63
Merge pull request #11 from eps1lon/feat/add-core-utils-to-utils-comp…
mnajdova Oct 27, 2020
1f11303
prettier
mnajdova Oct 27, 2020
d20209d
lint error fixed
mnajdova Oct 27, 2020
eb881e3
Merge branch 'feat/add-core-utils-to-utils' into feat/slider-unstyled…
mnajdova Oct 28, 2020
0767f6a
merged feat/add-core-utils-to-utils and updates
mnajdova Oct 28, 2020
a9a4247
replaced .ts files with original .js & d.ts files
mnajdova Oct 28, 2020
3957119
fixed import
mnajdova Oct 28, 2020
328ca77
removed file
mnajdova Oct 28, 2020
2747327
removed file
mnajdova Oct 28, 2020
1cd7521
Merge branch 'feat/add-core-utils-to-utils' into feat/slider-unstyled…
mnajdova Oct 28, 2020
6e4b92f
Merge branch 'next' into feat/slider-unstyled-new-package
mnajdova Oct 28, 2020
d57039e
fixed codesadnbox version for the new package
mnajdova Oct 28, 2020
d62e6a9
Update packages/material-ui-lab/package.json
mnajdova Oct 29, 2020
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: 3 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/packages/material-ui-icons/legacy
/packages/material-ui-icons/src
/packages/material-ui-icons/templateSvgIcon.js
/packages/material-ui-utils/macros/__fixtures__/
# Ignore fixtures
/packages/typescript-to-proptypes/test/*/*
/tmp
Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
1 change: 1 addition & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/api-docs/slider-unstyled.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
filename: /packages/material-ui-lab/src/SliderUnstyled/SliderUnstyled.js
filename: /packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js
---

<!--- This documentation is automatically generated, do not try to edit it. -->
Expand All @@ -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/).
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/slider-styled/UnstyledSlider.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/slider-styled/UnstyledSlider.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui-lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.11",
mnajdova marked this conversation as resolved.
Show resolved Hide resolved
"@material-ui/utils": "^5.0.0-alpha.14",
"clsx": "^1.0.4",
"prop-types": "^15.7.2",
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui-lab/src/SliderStyled/SliderStyled.d.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-lab/src/SliderStyled/SliderStyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 0 additions & 2 deletions packages/material-ui-lab/src/SliderUnstyled/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/material-ui-lab/src/SliderUnstyled/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/material-ui-lab/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 0 additions & 3 deletions packages/material-ui-lab/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
19 changes: 19 additions & 0 deletions packages/material-ui-unstyled/README.md
Original file line number Diff line number Diff line change
@@ -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/)
63 changes: 63 additions & 0 deletions packages/material-ui-unstyled/package.json
Original file line number Diff line number Diff line change
@@ -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"
Copy link
Member

Choose a reason for hiding this comment

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

Dev dependency?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is dev dependency

},
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=10.0.0"
}
}
51 changes: 51 additions & 0 deletions packages/material-ui-unstyled/src/OverridableComponent.d.ts
Original file line number Diff line number Diff line change
@@ -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<M extends OverridableTypeMap> {
<C extends React.ElementType>(
props: {
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: C;
} & OverrideProps<M, C>
): JSX.Element;
(props: DefaultComponentProps<M>): JSX.Element;
}

/**
* Props of the component if `component={Component}` is used.
*/
// prettier-ignore
export type OverrideProps<
M extends OverridableTypeMap,
C extends React.ElementType
> = (
& BaseProps<M>
& Omit<React.ComponentPropsWithRef<C>, keyof BaseProps<M>>
);

/**
* Props if `component={Component}` is NOT used.
*/
// prettier-ignore
export type DefaultComponentProps<M extends OverridableTypeMap> =
& BaseProps<M>
& Omit<React.ComponentPropsWithRef<M['defaultComponent']>, keyof BaseProps<M>>;

/**
* Props defined on the component (+ common material-ui props).
*/
// prettier-ignore
export type BaseProps<M extends OverridableTypeMap> = M['props'];

export interface OverridableTypeMap {
props: {};
defaultComponent: React.ElementType;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OverridableComponent, OverridableTypeMap } from '@material-ui/core/OverridableComponent';
import { OverridableComponent, OverridableTypeMap } from '../OverridableComponent';

export interface Mark {
value: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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)}`;
Expand Down
4 changes: 4 additions & 0 deletions packages/material-ui-unstyled/src/SliderUnstyled/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default } from './SliderUnstyled';
export * from './SliderUnstyled';
export { default as ValueLabelUnstyled } from './ValueLabelUnstyled';
export * from './ValueLabelUnstyled';
2 changes: 2 additions & 0 deletions packages/material-ui-unstyled/src/SliderUnstyled/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './SliderUnstyled';
export { default as ValueLabelUnstyled } from './ValueLabelUnstyled';
2 changes: 2 additions & 0 deletions packages/material-ui-unstyled/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as SliderUnstyled } from './SliderUnstyled';
export * from './SliderUnstyled';
2 changes: 2 additions & 0 deletions packages/material-ui-unstyled/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as SliderUnstyled } from './SliderUnstyled';
export * from './SliderUnstyled';
Loading