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,19 +1,15 @@
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; }
// weak
import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
// @inheritedComponent ButtonBase
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import ButtonBase from '../ButtonBase';
import { capitalizeFirstLetter } from '../utils/helpers';
import Icon from '../Icon';
import '../SvgIcon'; // Ensure CSS specificity
import { capitalize } from '../utils/helpers';
import { isMuiElement } from '../utils/reactHelpers';
import '../SvgIcon'; // Ensure CSS specificity
export const styles = theme => ({
root: {
@@ -29,18 +25,15 @@ export const styles = theme => ({
duration: theme.transitions.duration.shortest
})
},
colorAccent: {
color: theme.palette.secondary.A200
},
colorContrast: {
color: theme.palette.getContrastText(theme.palette.primary[500])
},
colorPrimary: {
color: theme.palette.primary[500]
},
colorInherit: {
color: 'inherit'
},
colorPrimary: {
color: theme.palette.primary.main
},
colorSecondary: {
color: theme.palette.secondary.main
},
disabled: {
color: theme.palette.action.disabled
},
@@ -49,13 +42,6 @@ export const styles = theme => ({
display: 'flex',
alignItems: 'inherit',
justifyContent: 'inherit'
},
icon: {
width: '1em',
height: '1em'
},
keyboardFocused: {
backgroundColor: theme.palette.text.divider
}
});
@@ -64,43 +50,60 @@ export const styles = theme => ({
* regarding the available icon options.
*/
function IconButton(props) {
const { buttonRef, children, classes, className, color, disabled, rootRef } = props,
other = _objectWithoutProperties(props, ['buttonRef', 'children', 'classes', 'className', 'color', 'disabled', 'rootRef']);
const { children, classes, className, color, disabled } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'color', 'disabled']);
return React.createElement(
ButtonBase,
_extends({
className: classNames(classes.root, {
[classes[`color${capitalizeFirstLetter(color)}`]]: color !== 'default',
[classes[`color${capitalize(color)}`]]: color !== 'default',
[classes.disabled]: disabled
}, className),
centerRipple: true,
keyboardFocusedClassName: classes.keyboardFocused,
focusRipple: true,
disabled: disabled
}, other, {
rootRef: buttonRef,
ref: rootRef
}),
}, other),
React.createElement(
'span',
{ className: classes.label },
typeof children === 'string' ? React.createElement(
Icon,
{ className: classes.icon },
children
) : React.Children.map(children, child => {
React.Children.map(children, child => {
if (isMuiElement(child, ['Icon', 'SvgIcon'])) {
return React.cloneElement(child, {
className: classNames(classes.icon, child.props.className)
});
return React.cloneElement(child, { fontSize: true });
}
return child;
})
)
);
}
IconButton.propTypes = process.env.NODE_ENV !== "production" ? {
/**
* The icon element.
*/
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(['default', 'inherit', 'primary', 'secondary']),
/**
* If `true`, the button will be disabled.
*/
disabled: PropTypes.bool,
/**
* If `true`, the ripple will be disabled.
*/
disableRipple: PropTypes.bool
} : {};
IconButton.defaultProps = {
color: 'default',
disabled: false,