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,11 +1,9 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface PaperProps extends StandardProps<
React.HTMLAttributes<HTMLDivElement>,
PaperClassKey
> {
component?: React.ReactType;
export interface PaperProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, PaperClassKey> {
component?: React.ReactType<PaperProps>;
elevation?: number;
square?: boolean;
}
@@ -37,8 +35,7 @@ export type PaperClassKey =
| 'shadow21'
| 'shadow22'
| 'shadow23'
| 'shadow24'
;
| 'shadow24';
declare const Paper: React.ComponentType<PaperProps>;

View File

@@ -1,16 +1,13 @@
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 _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _extends from 'babel-runtime/helpers/extends';
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import warning from 'warning';
import withStyles from '../styles/withStyles';
export const styles = theme => {
const shadows = {};
theme.shadows.forEach((shadow, index) => {
shadows[`shadow${index}`] = {
boxShadow: shadow
@@ -31,21 +28,50 @@ function Paper(props) {
const {
classes,
className: classNameProp,
component: ComponentProp,
component: Component,
square,
elevation
} = props,
other = _objectWithoutProperties(props, ['classes', 'className', 'component', 'square', 'elevation']);
warning(elevation >= 0 && elevation < 25, `Material-UI: this elevation \`${elevation}\` is not implemented.`);
process.env.NODE_ENV !== "production" ? warning(elevation >= 0 && elevation < 25, `Material-UI: this elevation \`${elevation}\` is not implemented.`) : void 0;
const className = classNames(classes.root, classes[`shadow${elevation >= 0 ? elevation : 0}`], {
const className = classNames(classes.root, classes[`shadow${elevation}`], {
[classes.rounded]: !square
}, classNameProp);
return React.createElement(ComponentProp, _extends({ className: className }, other));
return React.createElement(Component, _extends({ className: className }, other));
}
Paper.propTypes = process.env.NODE_ENV !== "production" ? {
/**
* The content of the component.
*/
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]),
/**
* Shadow depth, corresponds to `dp` in the spec.
* It's accepting values between 0 and 24 inclusive.
*/
elevation: PropTypes.number,
/**
* If `true`, rounded corners are disabled.
*/
square: PropTypes.bool
} : {};
Paper.defaultProps = {
component: 'div',
elevation: 2,