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,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface DividerProps extends StandardProps<
React.HTMLAttributes<HTMLHRElement>,
DividerClassKey
> {
export interface DividerProps
extends StandardProps<React.HTMLAttributes<HTMLHRElement>, DividerClassKey> {
absolute?: boolean;
component?: React.ReactType<DividerProps>;
inset?: boolean;
light?: boolean;
}
export type DividerClassKey =
| 'root'
| 'default'
| 'inset'
| 'light'
| 'absolute'
;
export type DividerClassKey = 'root' | 'default' | 'inset' | 'light' | 'absolute';
declare const Divider: React.ComponentType<DividerProps>;

View File

@@ -17,12 +17,14 @@ var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProp
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _ref;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
@@ -31,6 +33,8 @@ var _withStyles = require('../styles/withStyles');
var _withStyles2 = _interopRequireDefault(_withStyles);
var _colorManipulator = require('../styles/colorManipulator');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var styles = exports.styles = function styles(theme) {
@@ -41,14 +45,14 @@ var styles = exports.styles = function styles(theme) {
border: 'none',
flexShrink: 0
},
default: {
backgroundColor: theme.palette.text.divider
},
inset: {
marginLeft: 72
},
default: {
backgroundColor: theme.palette.divider
},
light: {
backgroundColor: theme.palette.text.lightDivider
backgroundColor: (0, _colorManipulator.fade)(theme.palette.divider, 0.08)
},
absolute: {
position: 'absolute',
@@ -59,53 +63,51 @@ var styles = exports.styles = function styles(theme) {
};
};
var babelPluginFlowReactPropTypes_proptype_Props = {
absolute: require('prop-types').bool,
/**
* Useful to extend the style applied to components.
*/
classes: require('prop-types').object,
/**
* @ignore
*/
className: require('prop-types').string,
/**
* If `true`, the divider will be indented.
*/
inset: require('prop-types').bool,
/**
* If `true`, the divider will have a lighter color.
*/
light: require('prop-types').bool
};
function Divider(props) {
var _classNames;
var absolute = props.absolute,
classes = props.classes,
classNameProp = props.className,
Component = props.component,
inset = props.inset,
light = props.light,
other = (0, _objectWithoutProperties3.default)(props, ['absolute', 'classes', 'className', 'inset', 'light']);
other = (0, _objectWithoutProperties3.default)(props, ['absolute', 'classes', 'className', 'component', 'inset', 'light']);
var className = (0, _classnames2.default)(classes.root, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.absolute, absolute), (0, _defineProperty3.default)(_classNames, classes.inset, inset), (0, _defineProperty3.default)(_classNames, light ? classes.light : classes.default, true), _classNames), classNameProp);
var className = (0, _classnames2.default)(classes.root, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.absolute, absolute), (0, _defineProperty3.default)(_classNames, classes.inset, inset), _classNames), light ? classes.light : classes.default, classNameProp);
return _react2.default.createElement('hr', (0, _extends3.default)({ className: className }, other));
return _react2.default.createElement(Component, (0, _extends3.default)({ className: className }, other));
}
Divider.propTypes = process.env.NODE_ENV !== "production" ? (_ref = {
classes: require('prop-types').object.isRequired,
absolute: require('prop-types').bool
}, (0, _defineProperty3.default)(_ref, 'classes', require('prop-types').object), (0, _defineProperty3.default)(_ref, 'className', require('prop-types').string), (0, _defineProperty3.default)(_ref, 'inset', require('prop-types').bool), (0, _defineProperty3.default)(_ref, 'light', require('prop-types').bool), _ref) : {};
Divider.propTypes = process.env.NODE_ENV !== "production" ? {
absolute: _propTypes2.default.bool,
/**
* Useful to extend the style applied to components.
*/
classes: _propTypes2.default.object.isRequired,
/**
* @ignore
*/
className: _propTypes2.default.string,
/**
* The component used for the root node.
* Either a string to use a DOM element or a component.
*/
component: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
/**
* If `true`, the divider will be indented.
*/
inset: _propTypes2.default.bool,
/**
* If `true`, the divider will have a lighter color.
*/
light: _propTypes2.default.bool
} : {};
Divider.defaultProps = {
absolute: false,
component: 'hr',
inset: false,
light: false
};

View File

@@ -1,24 +1,24 @@
// @flow
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { fade } from '../styles/colorManipulator';
export const styles = (theme: Object) => ({
export const styles = theme => ({
root: {
height: 1,
margin: 0, // Reset browser default style.
border: 'none',
flexShrink: 0,
},
default: {
backgroundColor: theme.palette.text.divider,
},
inset: {
marginLeft: 72,
},
default: {
backgroundColor: theme.palette.divider,
},
light: {
backgroundColor: theme.palette.text.lightDivider,
backgroundColor: fade(theme.palette.divider, 0.08),
},
absolute: {
position: 'absolute',
@@ -28,48 +28,58 @@ export const styles = (theme: Object) => ({
},
});
type ProvidedProps = {
classes: Object,
};
export type Props = {
absolute?: boolean,
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* If `true`, the divider will be indented.
*/
inset?: boolean,
/**
* If `true`, the divider will have a lighter color.
*/
light?: boolean,
};
function Divider(props: ProvidedProps & Props) {
const { absolute, classes, className: classNameProp, inset, light, ...other } = props;
function Divider(props) {
const {
absolute,
classes,
className: classNameProp,
component: Component,
inset,
light,
...other
} = props;
const className = classNames(
classes.root,
{
[classes.absolute]: absolute,
[classes.inset]: inset,
[light ? classes.light : classes.default]: true,
},
light ? classes.light : classes.default,
classNameProp,
);
return <hr className={className} {...other} />;
return <Component className={className} {...other} />;
}
Divider.propTypes = {
absolute: PropTypes.bool,
/**
* 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 `true`, the divider will be indented.
*/
inset: PropTypes.bool,
/**
* If `true`, the divider will have a lighter color.
*/
light: PropTypes.bool,
};
Divider.defaultProps = {
absolute: false,
component: 'hr',
inset: false,
light: false,
};

View File

@@ -1,3 +1 @@
// @flow
export { default } from './Divider';