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,16 +1,14 @@
// @flow
import React from 'react';
import type { Node, ElementType } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Typography from '../Typography';
import withStyles from '../styles/withStyles';
export const styles = (theme: Object) => ({
export const styles = theme => ({
root: {
'label + div > &': {
marginTop: -theme.spacing.unit * 2,
},
display: 'flex',
maxHeight: '2em',
alignItems: 'center',
},
positionStart: {
marginRight: theme.spacing.unit,
@@ -20,41 +18,7 @@ export const styles = (theme: Object) => ({
},
});
type ProvidedProps = {
classes: Object,
component: ElementType,
disableTypography: boolean,
};
export type Props = {
/**
* The content of the component, normally an `IconButton` or string.
*/
children?: Node,
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component?: ElementType,
/**
* If children is a string then disable wrapping in a Typography component.
*/
disableTypography?: boolean,
/**
* The position this adornment should appear relative to the `Input`.
*/
position: 'start' | 'end',
};
function InputAdornment(props: ProvidedProps & Props) {
function InputAdornment(props) {
const {
children,
component: Component,
@@ -78,7 +42,7 @@ function InputAdornment(props: ProvidedProps & Props) {
{...other}
>
{typeof children === 'string' && !disableTypography ? (
<Typography color="secondary">{children}</Typography>
<Typography color="textSecondary">{children}</Typography>
) : (
children
)}
@@ -86,6 +50,34 @@ function InputAdornment(props: ProvidedProps & Props) {
);
}
InputAdornment.propTypes = {
/**
* The content of the component, normally an `IconButton` or string.
*/
children: PropTypes.node.isRequired,
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
/**
* If children is a string then disable wrapping in a Typography component.
*/
disableTypography: PropTypes.bool,
/**
* The position this adornment should appear relative to the `Input`.
*/
position: PropTypes.oneOf(['start', 'end']),
};
InputAdornment.defaultProps = {
component: 'div',
disableTypography: false,