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

[core] Batch small changes #20980

Merged
merged 13 commits into from
May 11, 2020
Merged
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Big thanks to the 27 contributors who made this release possible.

Here are some highlights ✨:

- 💎 A new diamond sponsor: [Sencha](https://www.creative-tim.com/), thank you!
- 💎 A new diamond sponsor: [Sencha](https://sencha.com/), thank you!
- ⚛️ More tests migrated from enzyme to testing-library @marcosvega91.
- And many more 🐛 bug fixes and 📚 improvements.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/discover-more/backers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const requireRaw = require.context(
);

export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} disableAd />;
}

Page.getInitialProps = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/discover-more/showcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const requireRaw = require.context(
);

export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} disableToc />;
}

Page.getInitialProps = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/getting-started/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const requireRaw = require.context(
);

export default function Page({ demos, docs }) {
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} />;
return <MarkdownDocs demos={demos} docs={docs} requireDemo={requireDemo} disableToc />;
}

Page.getInitialProps = () => {
Expand Down
18 changes: 7 additions & 11 deletions docs/src/modules/components/AppTableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useStyles = makeStyles((theme) => ({
},
contents: {
marginTop: theme.spacing(2),
paddingLeft: theme.spacing(1),
paddingLeft: 8,
},
ul: {
padding: 0,
Expand All @@ -36,20 +36,16 @@ const useStyles = makeStyles((theme) => ({
},
item: {
fontSize: '.8125rem',
lineHeight: 2,
// paddingLeft: theme.spacing(1) where `border` is used as the "active" marker
paddingLeft: Math.max(0, theme.spacing(1) - 4),
borderLeft: `4px solid transparent`,
padding: `4px 0 4px 5px`,
borderLeft: `3px solid transparent`,
boxSizing: 'border-box',
'&:hover': {
borderLeft: `4px solid ${
theme.palette.type === 'light' ? theme.palette.grey[200] : theme.palette.grey[900]
}`,
borderLeftColor:
theme.palette.type === 'light' ? theme.palette.grey[200] : theme.palette.grey[900],
},
'&$active,&:active': {
borderLeft: `4px solid ${
theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[800]
}`,
borderLeftColor:
theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[800],
},
},
secondaryItem: {
Expand Down
5 changes: 1 addition & 4 deletions docs/src/modules/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,6 @@ const useStyles = makeStyles(
[theme.breakpoints.up('sm')]: {
borderRadius: theme.shape.borderRadius,
},
'&:focus': {
outline: `2px dashed ${theme.palette.text.primary}`,
},
},
/* Isolate the demo with an outline. */
demoBgOutlined: {
Expand Down Expand Up @@ -682,7 +679,7 @@ const useStyles = makeStyles(
'& pre': {
overflow: 'auto',
lineHeight: 1.5,
margin: '0px !important',
margin: '0 !important',
maxHeight: 1000,
},
},
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LANGUAGES = ['en', 'zh', 'ru', 'pt', 'es', 'fr', 'de', 'ja', 'aa'];
const LANGUAGES_SSR = ['en', 'zh', 'ru', 'pt', 'es'];

// Work in progress
const LANGUAGES_IN_PROGRESS = [...LANGUAGES];
const LANGUAGES_IN_PROGRESS = LANGUAGES.slice();

// Valid languages to use in production
const LANGUAGES_LABEL = [
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/material-icons/SearchIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const useDialogStyles = makeStyles((theme) => ({
color: theme.palette.primary.dark,
backgroundSize: '30px 30px',
backgroundColor: '#fff',
backgroundPosition: '0 0, 0 15px, 15px -15px, -15px 0px',
backgroundPosition: '0 0, 0 15px, 15px -15px, -15px 0',
backgroundImage:
'linear-gradient(45deg, #f4f4f4 25%, transparent 25%), linear-gradient(-45deg, #f4f4f4 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f4f4f4 75%), linear-gradient(-45deg, transparent 75%, #f4f4f4 75%)',
},
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/slider/CustomizedSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ const AirbnbSlider = withStyles({
border: '1px solid currentColor',
marginTop: -12,
marginLeft: -13,
boxShadow: '#ebebeb 0px 2px 2px',
boxShadow: '#ebebeb 0 2px 2px',
'&:focus, &:hover, &$active': {
boxShadow: '#ccc 0px 2px 3px 1px',
boxShadow: '#ccc 0 2px 3px 1px',
},
'& .bar': {
// display: inline-block !important;
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/slider/CustomizedSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ const AirbnbSlider = withStyles({
border: '1px solid currentColor',
marginTop: -12,
marginLeft: -13,
boxShadow: '#ebebeb 0px 2px 2px',
boxShadow: '#ebebeb 0 2px 2px',
'&:focus, &:hover, &$active': {
boxShadow: '#ccc 0px 2px 3px 1px',
boxShadow: '#ccc 0 2px 3px 1px',
},
'& .bar': {
// display: inline-block !important;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/tables/ReactVirtualizedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const styles = (theme) => ({
// https://github.com/bvaughn/react-virtualized/issues/454
'& .ReactVirtualized__Table__headerRow': {
flip: false,
paddingRight: theme.direction === 'rtl' ? '0px !important' : undefined,
paddingRight: theme.direction === 'rtl' ? '0 !important' : undefined,
},
},
tableRow: {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/tables/ReactVirtualizedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const styles = (theme: Theme) =>
// https://github.com/bvaughn/react-virtualized/issues/454
'& .ReactVirtualized__Table__headerRow': {
flip: false,
paddingRight: theme.direction === 'rtl' ? '0px !important' : undefined,
paddingRight: theme.direction === 'rtl' ? '0 !important' : undefined,
},
},
tableRow: {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/tabs/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Here is an example of customizing the component. You can learn more about this i

{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}}

👑 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://deprecate.mui-treasury.com/components/tabs).
👑 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/tabs/).

## Vertical tabs

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/customization/theming/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@ function App() {
</React.StrictMode>,
);
}
````
```
2 changes: 1 addition & 1 deletion packages/material-ui-lab/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const styles = (theme) => ({
listbox: {
listStyle: 'none',
margin: 0,
padding: '8px 0px',
padding: '8px 0',
maxHeight: '40vh',
overflow: 'auto',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ const ToggleButtonGroup = React.forwardRef(function ToggleButton(props, ref) {
let newValue;

if (value && index >= 0) {
newValue = [...value];
newValue = value.slice();
newValue.splice(index, 1);
} else {
newValue = value ? [...value, buttonValue] : [buttonValue];
newValue = value ? value.concat(buttonValue) : [buttonValue];
}

onChange(event, newValue);
Expand Down
12 changes: 6 additions & 6 deletions packages/material-ui-lab/src/TreeView/TreeView.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import TreeViewContext from './TreeViewContext';
import { withStyles } from '@material-ui/core/styles';
import { useControlled } from '@material-ui/core/utils';
import TreeViewContext from './TreeViewContext';

export const styles = {
/* Styles applied to the root element. */
Expand Down Expand Up @@ -196,7 +196,7 @@ const TreeView = React.forwardRef(function TreeView(props, ref) {
return oldTabbable;
});
} else {
newExpanded = [value, ...expanded];
newExpanded = [value].concat(expanded);
}

if (onNodeToggle) {
Expand All @@ -217,7 +217,7 @@ const TreeView = React.forwardRef(function TreeView(props, ref) {
const topLevelNodes = nodeMap.current[-1].children;
diff = topLevelNodes.filter((node) => !isExpanded(node));
}
const newExpanded = [...expanded, ...diff];
const newExpanded = expanded.concat(diff);

if (diff.length > 0) {
setExpandedState(newExpanded);
Expand Down Expand Up @@ -295,7 +295,7 @@ const TreeView = React.forwardRef(function TreeView(props, ref) {
if (selected.indexOf(value) !== -1) {
newSelected = selected.filter((id) => id !== value);
} else {
newSelected = [value, ...selected];
newSelected = [value].concat(selected);
}

if (onNodeSelect) {
Expand Down Expand Up @@ -411,9 +411,9 @@ const TreeView = React.forwardRef(function TreeView(props, ref) {
if (map) {
nodes.push(id);
if (map.children) {
nodes.push(...map.children);
nodes.concat(map.children);
map.children.forEach((node) => {
nodes.push(...getNodesToRemove(node));
nodes.concat(getNodesToRemove(node));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export default function useAutocomplete(props) {
let newValue = option;

if (multiple) {
newValue = Array.isArray(value) ? [...value] : [];
newValue = Array.isArray(value) ? value.slice() : [];

if (process.env.NODE_ENV !== 'production') {
const matches = newValue.filter((val) => getOptionSelected(option, val));
Expand Down Expand Up @@ -716,7 +716,7 @@ export default function useAutocomplete(props) {
case 'Backspace':
if (multiple && inputValue === '' && value.length > 0) {
const index = focusedTag === -1 ? value.length - 1 : focusedTag;
const newValue = [...value];
const newValue = value.slice();
newValue.splice(index, 1);
handleValue(event, newValue, 'remove-option', {
option: value[index],
Expand Down Expand Up @@ -805,7 +805,7 @@ export default function useAutocomplete(props) {
};

const handleTagDelete = (index) => (event) => {
const newValue = [...value];
const newValue = value.slice();
newValue.splice(index, 1);
handleValue(event, newValue, 'remove-option', {
option: value[index],
Expand Down
31 changes: 2 additions & 29 deletions packages/material-ui-styles/src/withStyles/withStyles.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, assert } from 'chai';
import { expect } from 'chai';
import React from 'react';
import PropTypes from 'prop-types';
import { stub } from 'sinon';
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('withStyles', () => {

const ref = React.createRef();
mount(<StyledTarget ref={ref} />);
assert.instanceOf(ref.current, TargetComponent);
expect(ref.current instanceof TargetComponent).to.equal(true);
});

it('forwards refs to React.forwardRef types', () => {
Expand All @@ -69,33 +69,6 @@ describe('withStyles', () => {
mount(<StyledTarget ref={ref} />);
expect(ref.current.nodeName).to.equal('DIV');
});

// describe('innerRef', () => {
// beforeEach(() => {
// consoleErrorMock.spy();
// PropTypes.resetWarningCache();
// });

// afterEach(() => {
// consoleErrorMock.reset();
// });

// it('is deprecated', () => {
// const ThemedDiv = withStyles({})('div');

// mount(
// <React.Fragment>
// <ThemedDiv innerRef={React.createRef()} />
// </React.Fragment>,
// );

// assert.strictEqual(consoleErrorMock.callCount(), 1);
// assert.include(
// consoleErrorMock.messages()[0],
// 'Warning: Failed prop type: Material-UI: The `innerRef` prop is deprecated',
// );
// });
// });
});

it('should forward the props', () => {
Expand Down
14 changes: 0 additions & 14 deletions packages/material-ui-system/src/spacing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,6 @@ describe('spacing', () => {
padding: 16,
},
});

// const output3 = spacing({
// theme: {},
// p: 1,
// sm: {
// p: 2,
// },
// });
// assert.deepEqual(output3, {
// padding: 8,
// '@media (min-width:600px)': {
// padding: 16,
// },
// });
});

it('should support full version', () => {
Expand Down
14 changes: 0 additions & 14 deletions packages/material-ui-system/src/style.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@ describe('style', () => {
backgroundColor: 'red',
},
});

// const output3 = bgcolor({
// theme: {},
// bgcolor: 'blue',
// sm: {
// bgcolor: 'red',
// },
// });
// assert.deepEqual(output3, {
// backgroundColor: 'blue',
// '@media (min-width:600px)': {
// backgroundColor: 'red',
// },
// });
});

const boxShadow = style({
Expand Down
8 changes: 4 additions & 4 deletions packages/material-ui/src/LinearProgress/LinearProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export const styles = (theme) => {
dashedColorPrimary: {
backgroundImage: `radial-gradient(${backgroundPrimary} 0%, ${backgroundPrimary} 16%, transparent 42%)`,
backgroundSize: '10px 10px',
backgroundPosition: '0px -23px',
backgroundPosition: '0 -23px',
},
/* Styles applied to the additional bar element if `variant="buffer"` and `color="secondary"`. */
dashedColorSecondary: {
backgroundImage: `radial-gradient(${backgroundSecondary} 0%, ${backgroundSecondary} 16%, transparent 42%)`,
backgroundSize: '10px 10px',
backgroundPosition: '0px -23px',
backgroundPosition: '0 -23px',
},
/* Styles applied to the layered bar1 and bar2 elements. */
bar: {
Expand Down Expand Up @@ -145,11 +145,11 @@ export const styles = (theme) => {
'@keyframes buffer': {
'0%': {
opacity: 1,
backgroundPosition: '0px -23px',
backgroundPosition: '0 -23px',
},
'50%': {
opacity: 0,
backgroundPosition: '0px -23px',
backgroundPosition: '0 -23px',
},
'100%': {
opacity: 1,
Expand Down
6 changes: 0 additions & 6 deletions packages/material-ui/src/Popover/Popover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,6 @@ describe('<Popover />', () => {
'Warning: Failed prop type: Invalid prop `PaperProps.component` supplied to `MockedPopover`. Expected an element type that can hold a ref.',
);
});

// it('should warn if anchorEl is not visible', () => {
// mount(<Popover open anchorEl={document.createElement('div')} />);
// assert.strictEqual(consoleErrorMock.callCount(), 1);
// assert.include(consoleErrorMock.messages()[0], 'The node element should be visible');
// });
});

describe('prop anchorReference="anchorPosition"', () => {
Expand Down
Loading