Skip to content

Commit 2fcc135

Browse files
[SvgIcon] Rename nativeColor -> htmlColor
1 parent a74b020 commit 2fcc135

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

docs/src/modules/utils/textToHash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function textToHash(text, unique = {}) {
1818
// eslint-disable-next-line no-useless-escape
1919
.replace(/[!@#\$%\^&\*\(\)=_\+\[\]{}`~;:'"\|,\.<>\/\?\s]+/g, '-')
2020
.replace(/-+/g, '-')
21-
.replace(/-$/g, ''),
21+
.replace(/^-|-$/g, ''),
2222
),
2323
unique,
2424
);

docs/src/modules/utils/textToHash.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ describe('textToHash', () => {
1313
textToHash('createGenerateClassName([options]) => class name generator'),
1414
'creategenerateclassname-options-class-name-generator',
1515
);
16+
assert.strictEqual(
17+
textToHash('@material-ui/core/styles vs @material-ui/styles'),
18+
'material-ui-core-styles-vs-material-ui-styles',
19+
);
1620
});
1721

1822
it('should generate a unique hash', () => {

docs/src/pages/versions/LatestVersions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function LatestVersions(props) {
5555
variant="body2"
5656
color="secondary"
5757
rel="nofollow"
58-
href="https://next.material-ui.com/"
58+
href="https://next--material-ui.netlify.com/"
5959
>
6060
Documentation
6161
</Link>

packages/material-ui/src/SvgIcon/SvgIcon.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface SvgIconProps
66
color?: PropTypes.Color | 'action' | 'disabled' | 'error';
77
component?: React.ReactType<SvgIconProps>;
88
fontSize?: 'inherit' | 'default' | 'small' | 'large';
9-
nativeColor?: string;
9+
htmlColor?: string;
1010
shapeRendering?: string;
1111
titleAccess?: string;
1212
viewBox?: string;

packages/material-ui/src/SvgIcon/SvgIcon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const SvgIcon = React.forwardRef(function SvgIcon(props, ref) {
6060
color,
6161
component: Component,
6262
fontSize,
63-
nativeColor,
63+
htmlColor,
6464
titleAccess,
6565
viewBox,
6666
...other
@@ -78,7 +78,7 @@ const SvgIcon = React.forwardRef(function SvgIcon(props, ref) {
7878
)}
7979
focusable="false"
8080
viewBox={viewBox}
81-
color={nativeColor}
81+
color={htmlColor}
8282
aria-hidden={titleAccess ? 'false' : 'true'}
8383
role={titleAccess ? 'img' : 'presentation'}
8484
ref={ref}
@@ -121,7 +121,7 @@ SvgIcon.propTypes = {
121121
/**
122122
* Applies a color attribute to the SVG element.
123123
*/
124-
nativeColor: PropTypes.string,
124+
htmlColor: PropTypes.string,
125125
/**
126126
* The shape-rendering attribute. The behavior of the different options is described on the
127127
* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).

pages/api/svg-icon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import SvgIcon from '@material-ui/core/SvgIcon';
2323
| <span class="prop-name">color</span> | <span class="prop-type">enum:&nbsp;'inherit', 'primary', 'secondary', 'action', 'error', 'disabled'<br></span> | <span class="prop-default">'inherit'</span> | The color of the component. It supports those theme colors that make sense for this component. You can use the `nativeColor` property to apply a color attribute to the SVG element. |
2424
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'svg'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
2525
| <span class="prop-name">fontSize</span> | <span class="prop-type">enum:&nbsp;'inherit'&nbsp;&#124;<br>&nbsp;'default'&nbsp;&#124;<br>&nbsp;'small'&nbsp;&#124;<br>&nbsp;'large'<br></span> | <span class="prop-default">'default'</span> | The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size. |
26-
| <span class="prop-name">nativeColor</span> | <span class="prop-type">string</span> |   | Applies a color attribute to the SVG element. |
26+
| <span class="prop-name">htmlColor</span> | <span class="prop-type">string</span> |   | Applies a color attribute to the SVG element. |
2727
| <span class="prop-name">shapeRendering</span> | <span class="prop-type">string</span> |   | The shape-rendering attribute. The behavior of the different options is described on the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering). If you are having issues with blurry icons you should investigate this property. |
2828
| <span class="prop-name">titleAccess</span> | <span class="prop-type">string</span> |   | Provides a human-readable title for the element that contains it. https://www.w3.org/TR/SVG-access/#Equivalent |
2929
| <span class="prop-name">viewBox</span> | <span class="prop-type">string</span> | <span class="prop-default">'0 0 24 24'</span> | Allows you to redefine what the coordinates without units mean inside an SVG element. For example, if the SVG element is 500 (width) by 200 (height), and you pass viewBox="0 0 50 20", this means that the coordinates inside the SVG will go from the top left corner (0,0) to bottom right (50,20) and each unit will be worth 10px. |

0 commit comments

Comments
 (0)