Completely updated React, fixed #11, (hopefully)

This commit is contained in:
2018-03-04 19:11:49 -05:00
parent 6e0afd6e2a
commit 34e5f5139a
13674 changed files with 333464 additions and 473223 deletions

View File

@@ -1,22 +1,20 @@
import * as React from 'react';
import { StandardProps, PropTypes } from '..';
export interface IconProps extends StandardProps<
React.HTMLAttributes<HTMLSpanElement>,
IconClassKey
> {
color?: PropTypes.Color | 'action' | 'contrast' | 'disabled' | 'error';
export interface IconProps
extends StandardProps<React.HTMLAttributes<HTMLSpanElement>, IconClassKey> {
color?: PropTypes.Color | 'action' | 'disabled' | 'error';
fontSize?: boolean;
}
export type IconClassKey =
| 'root'
| 'colorAccent'
| 'colorSecondary'
| 'colorAction'
| 'colorContrast'
| 'colorDisabled'
| 'colorError'
| 'colorPrimary'
;
| 'fontSize';
declare const Icon: React.ComponentType<IconProps>;

View File

@@ -1,43 +1,43 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { capitalizeFirstLetter } from '../utils/helpers';
import { capitalize } from '../utils/helpers';
export const styles = theme => ({
root: {
userSelect: 'none'
},
colorAccent: {
color: theme.palette.secondary.A200
colorPrimary: {
color: theme.palette.primary.main
},
colorSecondary: {
color: theme.palette.secondary.main
},
colorAction: {
color: theme.palette.action.active
},
colorContrast: {
color: theme.palette.getContrastText(theme.palette.primary[500])
},
colorDisabled: {
color: theme.palette.action.disabled
},
colorError: {
color: theme.palette.error[500]
color: theme.palette.error.main
},
colorPrimary: {
color: theme.palette.primary[500]
fontSize: {
width: '1em',
height: '1em'
}
});
function Icon(props) {
const { children, classes, className: classNameProp, color } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'color']);
const { children, classes, className: classNameProp, color, fontSize } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'color', 'fontSize']);
const className = classNames('material-icons', classes.root, {
[classes[`color${capitalizeFirstLetter(color)}`]]: color !== 'inherit'
[classes[`color${capitalize(color)}`]]: color !== 'inherit',
[classes.fontSize]: fontSize
}, classNameProp);
return React.createElement(
@@ -47,8 +47,32 @@ function Icon(props) {
);
}
Icon.propTypes = process.env.NODE_ENV !== "production" ? {
/**
* The name of the icon font ligature.
*/
children: PropTypes.node,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The color of the component. It supports those theme colors that make sense for this component.
*/
color: PropTypes.oneOf(['inherit', 'secondary', 'action', 'disabled', 'error', 'primary']),
/**
* If `true`, the icon size will be determined by the font-size.
*/
fontSize: PropTypes.bool
} : {};
Icon.defaultProps = {
color: 'inherit'
color: 'inherit',
fontSize: false
};
Icon.muiName = 'Icon';