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,68 +1,28 @@
// @flow
// @inheritedComponent ListItem
import React from 'react';
import type { ElementType, Node } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import ListItem from '../List/ListItem';
export const styles = (theme: Object) => ({
export const styles = theme => ({
root: {
...theme.typography.subheading,
height: 24,
height: theme.spacing.unit * 3,
boxSizing: 'content-box',
background: 'none',
width: 'auto',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
'&:focus': {
background: theme.palette.text.divider,
},
'&:hover': {
backgroundColor: theme.palette.text.divider,
'&$selected': {
backgroundColor: theme.palette.action.selected,
},
},
selected: {
backgroundColor: theme.palette.text.divider,
},
selected: {},
});
type ProvidedProps = {
classes: Object,
role: string,
selected: boolean,
};
export type Props = {
/**
* Menu item contents.
*/
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,
/**
* @ignore
*/
role?: string,
/**
* Use to apply selected styling.
*/
selected?: boolean,
};
function MenuItem(props: ProvidedProps & Props) {
function MenuItem(props) {
const { classes, className: classNameProp, component, selected, role, ...other } = props;
const className = classNames(
@@ -85,7 +45,36 @@ function MenuItem(props: ProvidedProps & Props) {
);
}
MenuItem.propTypes = {
/**
* Menu item contents.
*/
children: PropTypes.node,
/**
* 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]),
/**
* @ignore
*/
role: PropTypes.string,
/**
* Use to apply selected styling.
*/
selected: PropTypes.bool,
};
MenuItem.defaultProps = {
component: 'li',
role: 'menuitem',
selected: false,
};