Skip to content

Commit

Permalink
[core] Batch small changes (#23116)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Oct 18, 2020
1 parent 64908fa commit ed7f9db
Show file tree
Hide file tree
Showing 63 changed files with 136 additions and 90 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/accordion-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiAccordionActions-root</span> | Styles applied to the root element.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiAccordionActions-spacing</span> | Styles applied to the root element if `disableSpacing={false}`.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiAccordionActions-spacing</span> | Styles applied to the root element unless `disableSpacing={true}`.

You can override the style of the component thanks to one of these customization points:

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/accordion.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Any other props supplied will be provided to the root element ([Paper](/api/pape
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiAccordion-root</span> | Styles applied to the root element.
| <span class="prop-name">rounded</span> | <span class="prop-name">.MuiAccordion-rounded</span> | Styles applied to the root element if `square={false}`.
| <span class="prop-name">rounded</span> | <span class="prop-name">.MuiAccordion-rounded</span> | Styles applied to the root element unless `square={true}`.
| <span class="prop-name">expanded</span> | <span class="prop-name">.Mui-expanded</span> | Pseudo-class applied to the root element if `expanded={true}`.
| <span class="prop-name">disabled</span> | <span class="prop-name">.Mui-disabled</span> | Pseudo-class applied to the root element if `disabled={true}`.
| <span class="prop-name">region</span> | <span class="prop-name">.MuiAccordion-region</span> | Styles applied to the region element, the container of the children.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/card-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiCardActions-root</span> | Styles applied to the root element.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiCardActions-spacing</span> | Styles applied to the root element if `disableSpacing={false}`.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiCardActions-spacing</span> | Styles applied to the root element unless `disableSpacing={true}`.

You can override the style of the component thanks to one of these customization points:

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/dialog-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiDialogActions-root</span> | Styles applied to the root element.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiDialogActions-spacing</span> | Styles applied to the root element if `disableSpacing={false}`.
| <span class="prop-name">spacing</span> | <span class="prop-name">.MuiDialogActions-spacing</span> | Styles applied to the root element unless `disableSpacing={true}`.

You can override the style of the component thanks to one of these customization points:

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/filled-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Any other props supplied will be provided to the root element ([InputBase](/api/
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiFilledInput-root</span> | Styles applied to the root element.
| <span class="prop-name">colorSecondary</span> | <span class="prop-name">.MuiFilledInput-colorSecondary</span> | Styles applied to the root element if color secondary.
| <span class="prop-name">underline</span> | <span class="prop-name">.MuiFilledInput-underline</span> | Styles applied to the root element if `disableUnderline={false}`.
| <span class="prop-name">underline</span> | <span class="prop-name">.MuiFilledInput-underline</span> | Styles applied to the root element unless `disableUnderline={true}`.
| <span class="prop-name">focused</span> | <span class="prop-name">.Mui-focused</span> | Pseudo-class applied to the root element if the component is focused.
| <span class="prop-name">disabled</span> | <span class="prop-name">.Mui-disabled</span> | Pseudo-class applied to the root element if `disabled={true}`.
| <span class="prop-name">adornedStart</span> | <span class="prop-name">.MuiFilledInput-adornedStart</span> | Styles applied to the root element if `startAdornment` is provided.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/input-label.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Any other props supplied will be provided to the root element ([FormLabel](/api/
| <span class="prop-name">formControl</span> | <span class="prop-name">.MuiInputLabel-formControl</span> | Styles applied to the root element if the component is a descendant of `FormControl`.
| <span class="prop-name">marginDense</span> | <span class="prop-name">.MuiInputLabel-marginDense</span> | Styles applied to the root element if `margin="dense"`.
| <span class="prop-name">shrink</span> | <span class="prop-name">.MuiInputLabel-shrink</span> | Styles applied to the `input` element if `shrink={true}`.
| <span class="prop-name">animated</span> | <span class="prop-name">.MuiInputLabel-animated</span> | Styles applied to the `input` element if `disableAnimation={false}`.
| <span class="prop-name">animated</span> | <span class="prop-name">.MuiInputLabel-animated</span> | Styles applied to the `input` element unless `disableAnimation={true}`.
| <span class="prop-name">filled</span> | <span class="prop-name">.MuiInputLabel-filled</span> | Styles applied to the root element if `variant="filled"`.
| <span class="prop-name">outlined</span> | <span class="prop-name">.MuiInputLabel-outlined</span> | Styles applied to the root element if `variant="outlined"`.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Any other props supplied will be provided to the root element ([InputBase](/api/
| <span class="prop-name">focused</span> | <span class="prop-name">.Mui-focused</span> | Styles applied to the root element if the component is focused.
| <span class="prop-name">disabled</span> | <span class="prop-name">.Mui-disabled</span> | Styles applied to the root element if `disabled={true}`.
| <span class="prop-name">colorSecondary</span> | <span class="prop-name">.MuiInput-colorSecondary</span> | Styles applied to the root element if color secondary.
| <span class="prop-name">underline</span> | <span class="prop-name">.MuiInput-underline</span> | Styles applied to the root element if `disableUnderline={false}`.
| <span class="prop-name">underline</span> | <span class="prop-name">.MuiInput-underline</span> | Styles applied to the root element unless `disableUnderline={true}`.
| <span class="prop-name">error</span> | <span class="prop-name">.Mui-error</span> | Pseudo-class applied to the root element if `error={true}`.
| <span class="prop-name">marginDense</span> | <span class="prop-name">.MuiInput-marginDense</span> | Styles applied to the `input` element if `margin="dense"`.
| <span class="prop-name">multiline</span> | <span class="prop-name">.MuiInput-multiline</span> | Styles applied to the root element if `multiline={true}`.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/list-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Any other props supplied will be provided to the root element (native element).
| <span class="prop-name">alignItemsFlexStart</span> | <span class="prop-name">.MuiListItem-alignItemsFlexStart</span> | Styles applied to the `component` element if `alignItems="flex-start"`.
| <span class="prop-name">disabled</span> | <span class="prop-name">.Mui-disabled</span> | Pseudo-class applied to the inner `component` element if `disabled={true}`.
| <span class="prop-name">divider</span> | <span class="prop-name">.MuiListItem-divider</span> | Styles applied to the inner `component` element if `divider={true}`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiListItem-gutters</span> | Styles applied to the inner `component` element if `disableGutters={false}`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiListItem-gutters</span> | Styles applied to the inner `component` element unless `disableGutters={true}`.
| <span class="prop-name">button</span> | <span class="prop-name">.MuiListItem-button</span> | Styles applied to the inner `component` element if `button={true}`.
| <span class="prop-name">secondaryAction</span> | <span class="prop-name">.MuiListItem-secondaryAction</span> | Styles applied to the `component` element if `children` includes `ListItemSecondaryAction`.
| <span class="prop-name">selected</span> | <span class="prop-name">.Mui-selected</span> | Pseudo-class applied to the root element if `selected={true}`.
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/list-subheader.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Any other props supplied will be provided to the root element (native element).
| <span class="prop-name">root</span> | <span class="prop-name">.MuiListSubheader-root</span> | Styles applied to the root element.
| <span class="prop-name">colorPrimary</span> | <span class="prop-name">.MuiListSubheader-colorPrimary</span> | Styles applied to the root element if `color="primary"`.
| <span class="prop-name">colorInherit</span> | <span class="prop-name">.MuiListSubheader-colorInherit</span> | Styles applied to the root element if `color="inherit"`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiListSubheader-gutters</span> | Styles applied to the inner `component` element if `disableGutters={false}`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiListSubheader-gutters</span> | Styles applied to the inner `component` element unless `disableGutters={true}`.
| <span class="prop-name">inset</span> | <span class="prop-name">.MuiListSubheader-inset</span> | Styles applied to the root element if `inset={true}`.
| <span class="prop-name">sticky</span> | <span class="prop-name">.MuiListSubheader-sticky</span> | Styles applied to the root element if `disableSticky={false}`.
| <span class="prop-name">sticky</span> | <span class="prop-name">.MuiListSubheader-sticky</span> | Styles applied to the root element unless `disableSticky={true}`.

You can override the style of the component thanks to one of these customization points:

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiList-root</span> | Styles applied to the root element.
| <span class="prop-name">padding</span> | <span class="prop-name">.MuiList-padding</span> | Styles applied to the root element if `disablePadding={false}`.
| <span class="prop-name">padding</span> | <span class="prop-name">.MuiList-padding</span> | Styles applied to the root element unless `disablePadding={true}`.
| <span class="prop-name">dense</span> | <span class="prop-name">.MuiList-dense</span> | Styles applied to the root element if dense.
| <span class="prop-name">subheader</span> | <span class="prop-name">.MuiList-subheader</span> | Styles applied to the root element if a `subheader` is provided.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/menu-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Any other props supplied will be provided to the root element ([ListItem](/api/l
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiMenuItem-root</span> | Styles applied to the root element.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiMenuItem-gutters</span> | Styles applied to the root element if `disableGutters={false}`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiMenuItem-gutters</span> | Styles applied to the root element unless `disableGutters={true}`.
| <span class="prop-name">selected</span> | <span class="prop-name">.Mui-selected</span> | Styles applied to the root element if `selected={true}`.
| <span class="prop-name">dense</span> | <span class="prop-name">.MuiMenuItem-dense</span> | Styles applied to the root element if dense.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiPaper-root</span> | Styles applied to the root element.
| <span class="prop-name">rounded</span> | <span class="prop-name">.MuiPaper-rounded</span> | Styles applied to the root element if `square={false}`.
| <span class="prop-name">rounded</span> | <span class="prop-name">.MuiPaper-rounded</span> | Styles applied to the root element unless `square={true}`.
| <span class="prop-name">outlined</span> | <span class="prop-name">.MuiPaper-outlined</span> | Styles applied to the root element if `variant="outlined"`.
| <span class="prop-name">elevation</span> | <span class="prop-name">.MuiPaper-elevation</span> | Styles applied to the root element if `variant="elevation"`.
| <span class="prop-name">elevation0</span> | <span class="prop-name">.MuiPaper-elevation0</span> |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/toolbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Any other props supplied will be provided to the root element (native element).
| Rule name | Global class | Description |
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiToolbar-root</span> | Styles applied to the root element.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiToolbar-gutters</span> | Styles applied to the root element if `disableGutters={false}`.
| <span class="prop-name">gutters</span> | <span class="prop-name">.MuiToolbar-gutters</span> | Styles applied to the root element unless `disableGutters={true}`.
| <span class="prop-name">regular</span> | <span class="prop-name">.MuiToolbar-regular</span> | Styles applied to the root element if `variant="regular"`.
| <span class="prop-name">dense</span> | <span class="prop-name">.MuiToolbar-dense</span> | Styles applied to the root element if `variant="dense"`.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import * as PropTypes from 'prop-types';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/HighlightedCode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import PropTypes from 'prop-types';
import prism from 'docs/src/modules/utils/prism';
import MarkdownElement from './MarkdownElement';

Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/MarkdownDocs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useSelector } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
Expand Down
49 changes: 35 additions & 14 deletions docs/src/pages/components/slider-styled/NonLinearSlider.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import Slider from '@material-ui/lab/SliderStyled';
import Slider from '@material-ui/core/Slider';

const useStyles = makeStyles({
root: {
width: 250,
},
});

function valueLabelFormat(value) {
const [coefficient, exponent] = value
.toExponential()
.split('e')
.map((item) => Number(item));
return `${Math.round(coefficient)}e^${exponent}`;
const units = ['KB', 'MB', 'GB', 'TB'];

let unitIndex = 0;
let scaledValue = value;

while (scaledValue >= 1024 && unitIndex < units.length - 1) {
unitIndex += 1;
scaledValue /= 1024;
}

return `${scaledValue} ${units[unitIndex]}`;
}

function calculateValue(value) {
return 2 ** value;
}

export default function NonLinearSlider() {
const [value, setValue] = React.useState(1);
const [value, setValue] = React.useState(10);

const handleChange = (event, newValue) => {
setValue(newValue);
if (typeof newValue === 'number') {
setValue(newValue);
}
};

const classes = useStyles();

return (
<div>
<div className={classes.root}>
<Typography id="non-linear-slider" gutterBottom>
Temperature range
Storage: {valueLabelFormat(calculateValue(value))}
</Typography>
<Slider
value={value}
min={0}
step={0.1}
max={6}
scale={(x) => x ** 10}
min={5}
step={1}
max={30}
scale={calculateValue}
getAriaValueText={valueLabelFormat}
valueLabelFormat={valueLabelFormat}
onChange={handleChange}
Expand Down
49 changes: 35 additions & 14 deletions docs/src/pages/components/slider-styled/NonLinearSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,57 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import Slider from '@material-ui/lab/SliderStyled';
import Slider from '@material-ui/core/Slider';

const useStyles = makeStyles({
root: {
width: 250,
},
});

function valueLabelFormat(value: number) {
const [coefficient, exponent] = value
.toExponential()
.split('e')
.map((item) => Number(item));
return `${Math.round(coefficient)}e^${exponent}`;
const units = ['KB', 'MB', 'GB', 'TB'];

let unitIndex = 0;
let scaledValue = value;

while (scaledValue >= 1024 && unitIndex < units.length - 1) {
unitIndex += 1;
scaledValue /= 1024;
}

return `${scaledValue} ${units[unitIndex]}`;
}

function calculateValue(value: number) {
return 2 ** value;
}

export default function NonLinearSlider() {
const [value, setValue] = React.useState<number | number[]>(1);
const [value, setValue] = React.useState<number>(10);

const handleChange = (
event: React.SyntheticEvent,
newValue: number | number[],
) => {
setValue(newValue);
if (typeof newValue === 'number') {
setValue(newValue);
}
};

const classes = useStyles();

return (
<div>
<div className={classes.root}>
<Typography id="non-linear-slider" gutterBottom>
Temperature range
Storage: {valueLabelFormat(calculateValue(value))}
</Typography>
<Slider
value={value}
min={0}
step={0.1}
max={6}
scale={(x) => x ** 10}
min={5}
step={1}
max={30}
scale={calculateValue}
getAriaValueText={valueLabelFormat}
valueLabelFormat={valueLabelFormat}
onChange={handleChange}
Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/components/slider-styled/slider-styled.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ The track can be inverted with `track="inverted"`.
## Non-linear scale

You can use the `scale` prop to represent the `value` on a different scale.
For instance, in the following demo, the value _x_ represents the power of _10^x_.

In the following demo, the value _x_ represents the value _2^x_.
Increasing _x_ by one increases the represented value by factor _2_.

{{"demo": "pages/components/slider-styled/NonLinearSlider.js"}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can expect Material-UI's components to render without major issues.
<!-- #stable-snapshot -->

We support [Node.js](https://github.com/nodejs/node) starting with version 10 for server-side rendering.
Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#lts-schedule1) are supported.
Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported.

### CSS prefixing

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/landing/Sponsors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { makeStyles } from '@material-ui/core/styles';
import NoSsr from '@material-ui/core/NoSsr';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) {
return;
}

// Avoid text selection
event.preventDefault();
const finger = trackFinger(event, touchId);
const { newValue, activeIndex } = getFingerNewValue({ finger, values, source: valueDerived });
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-lab/src/TabContext/TabContext.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import PropTypes from 'prop-types';

/**
* @type {React.Context<{ idPrefix: string; value: string } | null>}
Expand Down
Loading

0 comments on commit ed7f9db

Please sign in to comment.