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,66 +1,17 @@
// @flow weak
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Transition from 'react-transition-group/Transition';
type ProvidedProps = {
classes: Object,
};
export type Props = {
/**
* Useful to extend the style applied to components.
*/
classes?: Object,
/**
* @ignore
*/
className?: string,
/**
* If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
*/
pulsate?: boolean,
/**
* Diameter of the ripple.
*/
rippleSize: number,
/**
* Horizontal position of the ripple center.
*/
rippleX: number,
/**
* Vertical position of the ripple center.
*/
rippleY: number,
};
type State = { rippleVisible: boolean, rippleLeaving: boolean };
/**
* @ignore - internal component.
*/
class Ripple extends React.Component<ProvidedProps & Props, State> {
static defaultProps = {
pulsate: false,
};
class Ripple extends React.Component {
state = {
rippleVisible: false,
rippleLeaving: false,
};
getRippleStyles = props => {
const { rippleSize, rippleX, rippleY } = props;
return {
width: rippleSize,
height: rippleSize,
top: -(rippleSize / 2) + rippleY,
left: -(rippleSize / 2) + rippleX,
};
};
handleEnter = () => {
this.setState({
rippleVisible: true,
@@ -99,14 +50,52 @@ class Ripple extends React.Component<ProvidedProps & Props, State> {
[classes.rippleFast]: pulsate,
});
const rippleStyles = {
width: rippleSize,
height: rippleSize,
top: -(rippleSize / 2) + rippleY,
left: -(rippleSize / 2) + rippleX,
};
return (
<Transition onEnter={this.handleEnter} onExit={this.handleExit} {...other}>
<span className={className}>
<span className={rippleClassName} style={this.getRippleStyles(this.props)} />
<span className={rippleClassName} style={rippleStyles} />
</span>
</Transition>
);
}
}
Ripple.propTypes = {
/**
* Useful to extend the style applied to components.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
*/
pulsate: PropTypes.bool,
/**
* Diameter of the ripple.
*/
rippleSize: PropTypes.number,
/**
* Horizontal position of the ripple center.
*/
rippleX: PropTypes.number,
/**
* Vertical position of the ripple center.
*/
rippleY: PropTypes.number,
};
Ripple.defaultProps = {
pulsate: false,
};
export default Ripple;