Completely updated React, fixed #11, (hopefully)
This commit is contained in:
17
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.d.ts
generated
vendored
17
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.d.ts
generated
vendored
@@ -1,22 +1,17 @@
|
||||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { Theme } from '../styles/createMuiTheme';
|
||||
import { TransitionDuration, TransitionProps } from '../internal/transition';
|
||||
import { TransitionProps } from './transition';
|
||||
|
||||
export interface CollapseProps extends StandardProps<
|
||||
TransitionProps,
|
||||
CollapseClassKey,
|
||||
'children'
|
||||
> {
|
||||
export interface CollapseProps extends StandardProps<TransitionProps, CollapseClassKey, 'timeout'> {
|
||||
children?: React.ReactNode;
|
||||
collapsedHeight?: string;
|
||||
component?: React.ReactType<CollapseProps>;
|
||||
theme?: Theme;
|
||||
timeout?: TransitionDuration | 'auto';
|
||||
timeout?: TransitionProps['timeout'] | 'auto';
|
||||
}
|
||||
|
||||
export type CollapseClassKey =
|
||||
| 'container'
|
||||
| 'entered'
|
||||
;
|
||||
export type CollapseClassKey = 'container' | 'entered';
|
||||
|
||||
declare const Collapse: React.ComponentType<CollapseProps>;
|
||||
|
||||
|
233
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.js
generated
vendored
233
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.js
generated
vendored
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.styles = undefined;
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
@@ -45,6 +45,10 @@ var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Transition = require('react-transition-group/Transition');
|
||||
|
||||
var _Transition2 = _interopRequireDefault(_Transition);
|
||||
@@ -55,14 +59,10 @@ var _withStyles2 = _interopRequireDefault(_withStyles);
|
||||
|
||||
var _transitions = require('../styles/transitions');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @inheritedComponent Transition
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Node = require('react').babelPluginFlowReactPropTypes_proptype_Node || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
var styles = exports.styles = function styles(theme) {
|
||||
return {
|
||||
container: {
|
||||
@@ -83,83 +83,12 @@ var styles = exports.styles = function styles(theme) {
|
||||
};
|
||||
};
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionDuration = require('prop-types').oneOfType([require('prop-types').number, require('prop-types').shape({
|
||||
enter: require('prop-types').number,
|
||||
exit: require('prop-types').number
|
||||
}), require('prop-types').oneOf(['auto'])]);
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* The content node to be collapsed.
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_Node === 'function' ? babelPluginFlowReactPropTypes_proptype_Node.isRequired ? babelPluginFlowReactPropTypes_proptype_Node.isRequired : babelPluginFlowReactPropTypes_proptype_Node : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Node).isRequired,
|
||||
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The height of the container when collapsed.
|
||||
*/
|
||||
collapsedHeight: require('prop-types').string,
|
||||
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: require('prop-types').oneOfType([require('prop-types').number, require('prop-types').shape({
|
||||
enter: require('prop-types').number,
|
||||
exit: require('prop-types').number
|
||||
}), require('prop-types').oneOf(['auto'])])
|
||||
};
|
||||
/**
|
||||
* The Collapes transition is used by the
|
||||
* [Vetical Stepper](/demos/steppers#vertical-stepper) StepContent component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
// @inheritedComponent Transition
|
||||
|
||||
var Collapse = function (_React$Component) {
|
||||
(0, _inherits3.default)(Collapse, _React$Component);
|
||||
@@ -175,7 +104,7 @@ var Collapse = function (_React$Component) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Collapse.__proto__ || (0, _getPrototypeOf2.default)(Collapse)).call.apply(_ref, [this].concat(args))), _this), _this.wrapper = null, _this.autoTransitionDuration = undefined, _this.handleEnter = function (node) {
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Collapse.__proto__ || (0, _getPrototypeOf2.default)(Collapse)).call.apply(_ref, [this].concat(args))), _this), _this.wrapper = null, _this.autoTransitionDuration = undefined, _this.timer = null, _this.handleEnter = function (node) {
|
||||
node.style.height = _this.props.collapsedHeight;
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
@@ -188,16 +117,17 @@ var Collapse = function (_React$Component) {
|
||||
|
||||
var wrapperHeight = _this.wrapper ? _this.wrapper.clientHeight : 0;
|
||||
|
||||
var _getTransitionProps = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'enter'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps.duration;
|
||||
|
||||
if (timeout === 'auto') {
|
||||
var duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
|
||||
node.style.transitionDuration = duration2 + 'ms';
|
||||
_this.autoTransitionDuration = duration2;
|
||||
} else if (typeof timeout === 'number') {
|
||||
node.style.transitionDuration = timeout + 'ms';
|
||||
} else if (timeout) {
|
||||
node.style.transitionDuration = timeout.enter + 'ms';
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : transitionDuration + 'ms';
|
||||
}
|
||||
|
||||
node.style.height = wrapperHeight + 'px';
|
||||
@@ -225,16 +155,17 @@ var Collapse = function (_React$Component) {
|
||||
|
||||
var wrapperHeight = _this.wrapper ? _this.wrapper.clientHeight : 0;
|
||||
|
||||
var _getTransitionProps2 = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'exit'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps2.duration;
|
||||
|
||||
if (timeout === 'auto') {
|
||||
var duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
|
||||
node.style.transitionDuration = duration2 + 'ms';
|
||||
_this.autoTransitionDuration = duration2;
|
||||
} else if (typeof timeout === 'number') {
|
||||
node.style.transitionDuration = timeout + 'ms';
|
||||
} else if (timeout) {
|
||||
node.style.transitionDuration = timeout.exit + 'ms';
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : transitionDuration + 'ms';
|
||||
}
|
||||
|
||||
node.style.height = _this.props.collapsedHeight;
|
||||
@@ -242,58 +173,60 @@ var Collapse = function (_React$Component) {
|
||||
if (_this.props.onExiting) {
|
||||
_this.props.onExiting(node);
|
||||
}
|
||||
}, _this.addEndListener = function (node, next) {
|
||||
var timeout = void 0;
|
||||
|
||||
}, _this.addEndListener = function (_, next) {
|
||||
if (_this.props.timeout === 'auto') {
|
||||
timeout = _this.autoTransitionDuration || 0;
|
||||
} else {
|
||||
timeout = _this.props.timeout;
|
||||
_this.timer = setTimeout(next, _this.autoTransitionDuration || 0);
|
||||
}
|
||||
|
||||
setTimeout(next, timeout);
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(Collapse, [{
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props = this.props,
|
||||
appear = _props.appear,
|
||||
children = _props.children,
|
||||
classes = _props.classes,
|
||||
className = _props.className,
|
||||
collapsedHeight = _props.collapsedHeight,
|
||||
Component = _props.component,
|
||||
onEnter = _props.onEnter,
|
||||
onEntering = _props.onEntering,
|
||||
onEntered = _props.onEntered,
|
||||
onEntering = _props.onEntering,
|
||||
onExit = _props.onExit,
|
||||
onExiting = _props.onExiting,
|
||||
style = _props.style,
|
||||
timeout = _props.timeout,
|
||||
theme = _props.theme,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['appear', 'children', 'classes', 'collapsedHeight', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'style', 'timeout', 'theme']);
|
||||
timeout = _props.timeout,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'classes', 'className', 'collapsedHeight', 'component', 'onEnter', 'onEntered', 'onEntering', 'onExit', 'onExiting', 'style', 'theme', 'timeout']);
|
||||
|
||||
|
||||
return _react2.default.createElement(
|
||||
_Transition2.default,
|
||||
(0, _extends3.default)({
|
||||
appear: appear,
|
||||
onEntering: this.handleEntering,
|
||||
onEnter: this.handleEnter,
|
||||
onEntered: this.handleEntered,
|
||||
onExiting: this.handleExiting,
|
||||
onExit: this.handleExit,
|
||||
addEndListener: this.addEndListener,
|
||||
style: (0, _extends3.default)({ minHeight: collapsedHeight }, style)
|
||||
timeout: timeout === 'auto' ? null : timeout
|
||||
}, other),
|
||||
function (state) {
|
||||
function (state, childProps) {
|
||||
return _react2.default.createElement(
|
||||
'div',
|
||||
{
|
||||
className: (0, _classnames2.default)(classes.container, (0, _defineProperty3.default)({}, classes.entered, state === 'entered'))
|
||||
},
|
||||
Component,
|
||||
(0, _extends3.default)({
|
||||
className: (0, _classnames2.default)(classes.container, (0, _defineProperty3.default)({}, classes.entered, state === 'entered'), className),
|
||||
style: (0, _extends3.default)({}, style, {
|
||||
minHeight: collapsedHeight
|
||||
})
|
||||
}, childProps),
|
||||
_react2.default.createElement(
|
||||
'div',
|
||||
{
|
||||
@@ -316,11 +249,75 @@ var Collapse = function (_React$Component) {
|
||||
return Collapse;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Collapse.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* The content node to be collapsed.
|
||||
*/
|
||||
children: _propTypes2.default.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: _propTypes2.default.string,
|
||||
/**
|
||||
* The height of the container when collapsed.
|
||||
*/
|
||||
collapsedHeight: _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 component will transition in.
|
||||
*/
|
||||
in: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }), _propTypes2.default.oneOf(['auto'])])
|
||||
} : {};
|
||||
|
||||
Collapse.defaultProps = {
|
||||
appear: false,
|
||||
collapsedHeight: '0px',
|
||||
component: 'div',
|
||||
timeout: _transitions.duration.standard
|
||||
};
|
||||
|
||||
exports.default = (0, _withStyles2.default)(styles, {
|
||||
withTheme: true,
|
||||
name: 'MuiCollapse'
|
||||
|
237
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.js.flow
generated
vendored
237
goTorrentWebUI/node_modules/material-ui/transitions/Collapse.js.flow
generated
vendored
@@ -1,15 +1,14 @@
|
||||
// @flow
|
||||
// @inheritedComponent Transition
|
||||
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import type { Node } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Transition from 'react-transition-group/Transition';
|
||||
import withStyles from '../styles/withStyles';
|
||||
import { duration } from '../styles/transitions';
|
||||
import type { TransitionCallback } from '../internal/transition';
|
||||
import { getTransitionProps } from './utils';
|
||||
|
||||
export const styles = (theme: Object) => ({
|
||||
export const styles = theme => ({
|
||||
container: {
|
||||
height: 0,
|
||||
overflow: 'hidden',
|
||||
@@ -27,85 +26,21 @@ export const styles = (theme: Object) => ({
|
||||
},
|
||||
});
|
||||
|
||||
export type TransitionDuration = number | { enter?: number, exit?: number } | 'auto';
|
||||
|
||||
type ProvidedProps = {
|
||||
appear: boolean,
|
||||
classes: Object,
|
||||
collapsedHeight: string,
|
||||
timeout: TransitionDuration,
|
||||
theme: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear?: boolean,
|
||||
/**
|
||||
* The content node to be collapsed.
|
||||
*/
|
||||
children: Node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes?: Object,
|
||||
/**
|
||||
* The height of the container when collapsed.
|
||||
*/
|
||||
collapsedHeight?: string,
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: boolean,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme?: Object,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout?: TransitionDuration,
|
||||
};
|
||||
|
||||
class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
static defaultProps = {
|
||||
appear: false,
|
||||
collapsedHeight: '0px',
|
||||
timeout: duration.standard,
|
||||
};
|
||||
/**
|
||||
* The Collapes transition is used by the
|
||||
* [Vetical Stepper](/demos/steppers#vertical-stepper) StepContent component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
class Collapse extends React.Component {
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
||||
wrapper = null;
|
||||
autoTransitionDuration = undefined;
|
||||
timer = null;
|
||||
|
||||
handleEnter = (node: HTMLElement) => {
|
||||
handleEnter = node => {
|
||||
node.style.height = this.props.collapsedHeight;
|
||||
|
||||
if (this.props.onEnter) {
|
||||
@@ -113,20 +48,21 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
handleEntering = (node: HTMLElement) => {
|
||||
handleEntering = node => {
|
||||
const { timeout, theme } = this.props;
|
||||
const wrapperHeight = this.wrapper ? this.wrapper.clientHeight : 0;
|
||||
|
||||
const { duration: transitionDuration } = getTransitionProps(this.props, {
|
||||
mode: 'enter',
|
||||
});
|
||||
|
||||
if (timeout === 'auto') {
|
||||
const duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
|
||||
node.style.transitionDuration = `${duration2}ms`;
|
||||
this.autoTransitionDuration = duration2;
|
||||
} else if (typeof timeout === 'number') {
|
||||
node.style.transitionDuration = `${timeout}ms`;
|
||||
} else if (timeout) {
|
||||
node.style.transitionDuration = `${timeout.enter}ms`;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
node.style.transitionDuration =
|
||||
typeof transitionDuration === 'string' ? transitionDuration : `${transitionDuration}ms`;
|
||||
}
|
||||
|
||||
node.style.height = `${wrapperHeight}px`;
|
||||
@@ -136,7 +72,7 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
handleEntered = (node: HTMLElement) => {
|
||||
handleEntered = node => {
|
||||
node.style.height = 'auto';
|
||||
|
||||
if (this.props.onEntered) {
|
||||
@@ -144,7 +80,7 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
handleExit = (node: HTMLElement) => {
|
||||
handleExit = node => {
|
||||
const wrapperHeight = this.wrapper ? this.wrapper.clientHeight : 0;
|
||||
node.style.height = `${wrapperHeight}px`;
|
||||
|
||||
@@ -153,20 +89,21 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
handleExiting = (node: HTMLElement) => {
|
||||
handleExiting = node => {
|
||||
const { timeout, theme } = this.props;
|
||||
const wrapperHeight = this.wrapper ? this.wrapper.clientHeight : 0;
|
||||
|
||||
const { duration: transitionDuration } = getTransitionProps(this.props, {
|
||||
mode: 'exit',
|
||||
});
|
||||
|
||||
if (timeout === 'auto') {
|
||||
const duration2 = theme.transitions.getAutoHeightDuration(wrapperHeight);
|
||||
node.style.transitionDuration = `${duration2}ms`;
|
||||
this.autoTransitionDuration = duration2;
|
||||
} else if (typeof timeout === 'number') {
|
||||
node.style.transitionDuration = `${timeout}ms`;
|
||||
} else if (timeout) {
|
||||
node.style.transitionDuration = `${timeout.exit}ms`;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
node.style.transitionDuration =
|
||||
typeof transitionDuration === 'string' ? transitionDuration : `${transitionDuration}ms`;
|
||||
}
|
||||
|
||||
node.style.height = this.props.collapsedHeight;
|
||||
@@ -176,53 +113,56 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
addEndListener = (node, next: Function) => {
|
||||
let timeout;
|
||||
|
||||
addEndListener = (_, next) => {
|
||||
if (this.props.timeout === 'auto') {
|
||||
timeout = this.autoTransitionDuration || 0;
|
||||
} else {
|
||||
timeout = this.props.timeout;
|
||||
this.timer = setTimeout(next, this.autoTransitionDuration || 0);
|
||||
}
|
||||
|
||||
setTimeout(next, timeout);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
appear,
|
||||
children,
|
||||
classes,
|
||||
className,
|
||||
collapsedHeight,
|
||||
component: Component,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onEntered,
|
||||
onEntering,
|
||||
onExit,
|
||||
onExiting,
|
||||
style,
|
||||
timeout,
|
||||
theme,
|
||||
timeout,
|
||||
...other
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<Transition
|
||||
appear={appear}
|
||||
onEntering={this.handleEntering}
|
||||
onEnter={this.handleEnter}
|
||||
onEntered={this.handleEntered}
|
||||
onExiting={this.handleExiting}
|
||||
onExit={this.handleExit}
|
||||
addEndListener={this.addEndListener}
|
||||
style={{ minHeight: collapsedHeight, ...style }}
|
||||
timeout={timeout === 'auto' ? null : timeout}
|
||||
{...other}
|
||||
>
|
||||
{state => {
|
||||
{(state, childProps) => {
|
||||
return (
|
||||
<div
|
||||
className={classNames(classes.container, {
|
||||
[classes.entered]: state === 'entered',
|
||||
})}
|
||||
<Component
|
||||
className={classNames(
|
||||
classes.container,
|
||||
{
|
||||
[classes.entered]: state === 'entered',
|
||||
},
|
||||
className,
|
||||
)}
|
||||
style={{
|
||||
...style,
|
||||
minHeight: collapsedHeight,
|
||||
}}
|
||||
{...childProps}
|
||||
>
|
||||
<div
|
||||
className={classes.wrapper}
|
||||
@@ -232,7 +172,7 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
>
|
||||
<div className={classes.wrapperInner}>{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
</Component>
|
||||
);
|
||||
}}
|
||||
</Transition>
|
||||
@@ -240,6 +180,79 @@ class Collapse extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
}
|
||||
|
||||
Collapse.propTypes = {
|
||||
/**
|
||||
* The content node to be collapsed.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Useful to extend the style applied to components.
|
||||
*/
|
||||
classes: PropTypes.object.isRequired,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The height of the container when collapsed.
|
||||
*/
|
||||
collapsedHeight: 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 component will transition in.
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
PropTypes.oneOf(['auto']),
|
||||
]),
|
||||
};
|
||||
|
||||
Collapse.defaultProps = {
|
||||
collapsedHeight: '0px',
|
||||
component: 'div',
|
||||
timeout: duration.standard,
|
||||
};
|
||||
|
||||
export default withStyles(styles, {
|
||||
withTheme: true,
|
||||
name: 'MuiCollapse',
|
||||
|
3
goTorrentWebUI/node_modules/material-ui/transitions/Fade.d.ts
generated
vendored
3
goTorrentWebUI/node_modules/material-ui/transitions/Fade.d.ts
generated
vendored
@@ -1,10 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { Theme } from '../styles/createMuiTheme';
|
||||
import { TransitionDuration, TransitionProps } from '../internal/transition';
|
||||
import { TransitionProps } from './transition';
|
||||
|
||||
export interface FadeProps extends TransitionProps {
|
||||
theme?: Theme;
|
||||
timeout?: TransitionDuration;
|
||||
}
|
||||
|
||||
declare const Fade: React.ComponentType<FadeProps>;
|
||||
|
193
goTorrentWebUI/node_modules/material-ui/transitions/Fade.js
generated
vendored
193
goTorrentWebUI/node_modules/material-ui/transitions/Fade.js
generated
vendored
@@ -36,6 +36,10 @@ var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Transition = require('react-transition-group/Transition');
|
||||
|
||||
var _Transition2 = _interopRequireDefault(_Transition);
|
||||
@@ -46,71 +50,24 @@ var _withTheme = require('../styles/withTheme');
|
||||
|
||||
var _withTheme2 = _interopRequireDefault(_withTheme);
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
|
||||
// @inheritedComponent Transition
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionDuration = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionDuration || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element.isRequired ? babelPluginFlowReactPropTypes_proptype_Element.isRequired : babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element).isRequired,
|
||||
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: typeof babelPluginFlowReactPropTypes_proptype_TransitionDuration === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionDuration : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionDuration)
|
||||
};
|
||||
|
||||
|
||||
var reflow = function reflow(node) {
|
||||
return node.scrollTop;
|
||||
var styles = {
|
||||
entering: {
|
||||
opacity: 1
|
||||
},
|
||||
entered: {
|
||||
opacity: 1
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The Fade transition is used by the Modal component.
|
||||
* It's using [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
* The Fade transition is used by the [Modal](/demos/modals) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
|
||||
var Fade = function (_React$Component) {
|
||||
@@ -128,42 +85,45 @@ var Fade = function (_React$Component) {
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Fade.__proto__ || (0, _getPrototypeOf2.default)(Fade)).call.apply(_ref, [this].concat(args))), _this), _this.handleEnter = function (node) {
|
||||
node.style.opacity = '0';
|
||||
reflow(node);
|
||||
var theme = _this.props.theme;
|
||||
|
||||
(0, _utils.reflow)(node); // So the animation always start from the start.
|
||||
|
||||
var _getTransitionProps = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'enter'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps.duration,
|
||||
delay = _getTransitionProps.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
}, _this.handleEntering = function (node) {
|
||||
var _this$props = _this.props,
|
||||
theme = _this$props.theme,
|
||||
timeout = _this$props.timeout;
|
||||
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter
|
||||
});
|
||||
node.style.opacity = '1';
|
||||
|
||||
if (_this.props.onEntering) {
|
||||
_this.props.onEntering(node);
|
||||
}
|
||||
}, _this.handleExit = function (node) {
|
||||
var _this$props2 = _this.props,
|
||||
theme = _this$props2.theme,
|
||||
timeout = _this$props2.timeout;
|
||||
var theme = _this.props.theme;
|
||||
|
||||
var _getTransitionProps2 = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'exit'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps2.duration,
|
||||
delay = _getTransitionProps2.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
node.style.opacity = '0';
|
||||
|
||||
if (_this.props.onExit) {
|
||||
_this.props.onExit(node);
|
||||
@@ -175,44 +135,73 @@ var Fade = function (_React$Component) {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props = this.props,
|
||||
appear = _props.appear,
|
||||
children = _props.children,
|
||||
onEnter = _props.onEnter,
|
||||
onEntering = _props.onEntering,
|
||||
onExit = _props.onExit,
|
||||
styleProp = _props.style,
|
||||
theme = _props.theme,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['appear', 'children', 'onEnter', 'onEntering', 'onExit', 'style', 'theme']);
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'onEnter', 'onExit', 'style', 'theme']);
|
||||
|
||||
|
||||
var style = (0, _extends3.default)({}, styleProp);
|
||||
|
||||
// For server side rendering.
|
||||
if (!this.props.in || appear) {
|
||||
style.opacity = '0';
|
||||
}
|
||||
var style = (0, _extends3.default)({}, styleProp, _react2.default.isValidElement(children) ? children.props.style : {});
|
||||
|
||||
return _react2.default.createElement(
|
||||
_Transition2.default,
|
||||
(0, _extends3.default)({
|
||||
appear: appear,
|
||||
style: style,
|
||||
onEnter: this.handleEnter,
|
||||
onEntering: this.handleEntering,
|
||||
onExit: this.handleExit
|
||||
}, other),
|
||||
children
|
||||
(0, _extends3.default)({ appear: true, onEnter: this.handleEnter, onExit: this.handleExit }, other),
|
||||
function (state, childProps) {
|
||||
return _react2.default.cloneElement(children, (0, _extends3.default)({
|
||||
style: (0, _extends3.default)({
|
||||
opacity: 0
|
||||
}, styles[state], style)
|
||||
}, childProps));
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return Fade;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Fade.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.func]),
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number })])
|
||||
} : {};
|
||||
|
||||
Fade.defaultProps = {
|
||||
appear: true,
|
||||
timeout: {
|
||||
enter: _transitions.duration.enteringScreen,
|
||||
exit: _transitions.duration.leavingScreen
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = (0, _withTheme2.default)()(Fade);
|
206
goTorrentWebUI/node_modules/material-ui/transitions/Fade.js.flow
generated
vendored
206
goTorrentWebUI/node_modules/material-ui/transitions/Fade.js.flow
generated
vendored
@@ -1,109 +1,60 @@
|
||||
// @flow
|
||||
// @inheritedComponent Transition
|
||||
|
||||
import React from 'react';
|
||||
import type { Element } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Transition from 'react-transition-group/Transition';
|
||||
import { duration } from '../styles/transitions';
|
||||
import withTheme from '../styles/withTheme';
|
||||
import type { TransitionDuration, TransitionCallback } from '../internal/transition';
|
||||
import { reflow, getTransitionProps } from './utils';
|
||||
|
||||
type ProvidedProps = {
|
||||
appear: boolean,
|
||||
timeout: TransitionDuration,
|
||||
theme: Object,
|
||||
const styles = {
|
||||
entering: {
|
||||
opacity: 1,
|
||||
},
|
||||
entered: {
|
||||
opacity: 1,
|
||||
},
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear?: boolean,
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: Element<any>,
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: boolean,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme?: Object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style?: Object,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout?: TransitionDuration,
|
||||
};
|
||||
|
||||
const reflow = node => node.scrollTop;
|
||||
|
||||
/**
|
||||
* The Fade transition is used by the Modal component.
|
||||
* It's using [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
* The Fade transition is used by the [Modal](/demos/modals) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
class Fade extends React.Component<ProvidedProps & Props> {
|
||||
static defaultProps = {
|
||||
appear: true,
|
||||
timeout: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
class Fade extends React.Component {
|
||||
handleEnter = node => {
|
||||
const { theme } = this.props;
|
||||
reflow(node); // So the animation always start from the start.
|
||||
|
||||
handleEnter = (node: HTMLElement) => {
|
||||
node.style.opacity = '0';
|
||||
reflow(node);
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'enter',
|
||||
});
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
|
||||
if (this.props.onEnter) {
|
||||
this.props.onEnter(node);
|
||||
}
|
||||
};
|
||||
|
||||
handleEntering = (node: HTMLElement) => {
|
||||
const { theme, timeout } = this.props;
|
||||
handleExit = node => {
|
||||
const { theme } = this.props;
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'exit',
|
||||
});
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
node.style.opacity = '1';
|
||||
|
||||
if (this.props.onEntering) {
|
||||
this.props.onEntering(node);
|
||||
}
|
||||
};
|
||||
|
||||
handleExit = (node: HTMLElement) => {
|
||||
const { theme, timeout } = this.props;
|
||||
node.style.transition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('opacity', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
});
|
||||
node.style.opacity = '0';
|
||||
|
||||
if (this.props.onExit) {
|
||||
this.props.onExit(node);
|
||||
@@ -111,37 +62,74 @@ class Fade extends React.Component<ProvidedProps & Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
appear,
|
||||
children,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onExit,
|
||||
style: styleProp,
|
||||
theme,
|
||||
...other
|
||||
} = this.props;
|
||||
const { children, onEnter, onExit, style: styleProp, theme, ...other } = this.props;
|
||||
|
||||
const style = { ...styleProp };
|
||||
|
||||
// For server side rendering.
|
||||
if (!this.props.in || appear) {
|
||||
style.opacity = '0';
|
||||
}
|
||||
const style = {
|
||||
...styleProp,
|
||||
...(React.isValidElement(children) ? children.props.style : {}),
|
||||
};
|
||||
|
||||
return (
|
||||
<Transition
|
||||
appear={appear}
|
||||
style={style}
|
||||
onEnter={this.handleEnter}
|
||||
onEntering={this.handleEntering}
|
||||
onExit={this.handleExit}
|
||||
{...other}
|
||||
>
|
||||
{children}
|
||||
<Transition appear onEnter={this.handleEnter} onExit={this.handleExit} {...other}>
|
||||
{(state, childProps) => {
|
||||
return React.cloneElement(children, {
|
||||
style: {
|
||||
opacity: 0,
|
||||
...styles[state],
|
||||
...style,
|
||||
},
|
||||
...childProps,
|
||||
});
|
||||
}}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Fade.propTypes = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
]),
|
||||
};
|
||||
|
||||
Fade.defaultProps = {
|
||||
timeout: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
export default withTheme()(Fade);
|
||||
|
7
goTorrentWebUI/node_modules/material-ui/transitions/Grow.d.ts
generated
vendored
7
goTorrentWebUI/node_modules/material-ui/transitions/Grow.d.ts
generated
vendored
@@ -1,10 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { Omit } from '..';
|
||||
import { Theme } from '../styles/createMuiTheme';
|
||||
import { TransitionDuration, TransitionProps } from '../internal/transition';
|
||||
import { TransitionProps } from './transition';
|
||||
|
||||
export interface GrowProps extends TransitionProps {
|
||||
export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
|
||||
theme?: Theme;
|
||||
timeout?: TransitionDuration | 'auto';
|
||||
timeout?: TransitionProps['timeout'] | 'auto';
|
||||
}
|
||||
|
||||
declare const Grow: React.ComponentType<GrowProps>;
|
||||
|
270
goTorrentWebUI/node_modules/material-ui/transitions/Grow.js
generated
vendored
270
goTorrentWebUI/node_modules/material-ui/transitions/Grow.js
generated
vendored
@@ -32,122 +32,46 @@ var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
exports.getScale = getScale;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _CSSTransition = require('react-transition-group/CSSTransition');
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _CSSTransition2 = _interopRequireDefault(_CSSTransition);
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Transition = require('react-transition-group/Transition');
|
||||
|
||||
var _Transition2 = _interopRequireDefault(_Transition);
|
||||
|
||||
var _withTheme = require('../styles/withTheme');
|
||||
|
||||
var _withTheme2 = _interopRequireDefault(_withTheme);
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
|
||||
// @inheritedComponent CSSTransition
|
||||
|
||||
// Only exported for tests.
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionClasses = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionClasses || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
function getScale(value) {
|
||||
return 'scale(' + value + ', ' + Math.pow(value, 2) + ')';
|
||||
}
|
||||
} // @inheritedComponent Transition
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionDuration = require('prop-types').oneOfType([require('prop-types').number, require('prop-types').shape({
|
||||
enter: require('prop-types').number,
|
||||
exit: require('prop-types').number
|
||||
}), require('prop-types').oneOf(['auto'])]);
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear: require('prop-types').bool,
|
||||
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element.isRequired ? babelPluginFlowReactPropTypes_proptype_Element.isRequired : babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element).isRequired,
|
||||
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* Use that property to pass a ref callback to the root component.
|
||||
*/
|
||||
rootRef: require('prop-types').func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The animation classNames applied to the component as it enters or exits.
|
||||
* This property is a direct binding to [`CSSTransition.classNames`](https://reactcommunity.org/react-transition-group/#CSSTransition-prop-classNames).
|
||||
*/
|
||||
transitionClasses: typeof babelPluginFlowReactPropTypes_proptype_TransitionClasses === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionClasses : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionClasses),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: require('prop-types').oneOfType([require('prop-types').number, require('prop-types').shape({
|
||||
enter: require('prop-types').number,
|
||||
exit: require('prop-types').number
|
||||
}), require('prop-types').oneOf(['auto'])])
|
||||
var styles = {
|
||||
entering: {
|
||||
opacity: 1,
|
||||
transform: getScale(1)
|
||||
},
|
||||
entered: {
|
||||
opacity: 1,
|
||||
transform: getScale(1)
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The Grow transition is used by the Popover component.
|
||||
* It's using [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
* The Grow transition is used by the [Popover](/demos/popovers) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
|
||||
var Grow = function (_React$Component) {
|
||||
(0, _inherits3.default)(Grow, _React$Component);
|
||||
|
||||
@@ -162,42 +86,37 @@ var Grow = function (_React$Component) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Grow.__proto__ || (0, _getPrototypeOf2.default)(Grow)).call.apply(_ref, [this].concat(args))), _this), _this.autoTimeout = undefined, _this.handleEnter = function (node) {
|
||||
node.style.opacity = '0';
|
||||
node.style.transform = getScale(0.75);
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
}, _this.handleEntering = function (node) {
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Grow.__proto__ || (0, _getPrototypeOf2.default)(Grow)).call.apply(_ref, [this].concat(args))), _this), _this.autoTimeout = undefined, _this.timer = null, _this.handleEnter = function (node) {
|
||||
var _this$props = _this.props,
|
||||
theme = _this$props.theme,
|
||||
timeout = _this$props.timeout;
|
||||
|
||||
var duration = 0;
|
||||
(0, _utils.reflow)(node); // So the animation always start from the start.
|
||||
|
||||
var _getTransitionProps = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'enter'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps.duration,
|
||||
delay = _getTransitionProps.delay;
|
||||
|
||||
var duration = 0;
|
||||
if (timeout === 'auto') {
|
||||
duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
|
||||
_this.autoTimeout = duration;
|
||||
} else if (typeof timeout === 'number') {
|
||||
duration = timeout;
|
||||
} else if (timeout) {
|
||||
duration = timeout.enter;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
duration = transitionDuration;
|
||||
}
|
||||
|
||||
node.style.transition = [theme.transitions.create('opacity', {
|
||||
duration: duration
|
||||
duration: duration,
|
||||
delay: delay
|
||||
}), theme.transitions.create('transform', {
|
||||
duration: duration * 0.666
|
||||
duration: duration * 0.666,
|
||||
delay: delay
|
||||
})].join(',');
|
||||
|
||||
node.style.opacity = '1';
|
||||
node.style.transform = getScale(1);
|
||||
|
||||
if (_this.props.onEntering) {
|
||||
_this.props.onEntering(node);
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
}, _this.handleExit = function (node) {
|
||||
var _this$props2 = _this.props,
|
||||
@@ -206,22 +125,25 @@ var Grow = function (_React$Component) {
|
||||
|
||||
var duration = 0;
|
||||
|
||||
var _getTransitionProps2 = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'exit'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps2.duration,
|
||||
delay = _getTransitionProps2.delay;
|
||||
|
||||
if (timeout === 'auto') {
|
||||
duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
|
||||
_this.autoTimeout = duration;
|
||||
} else if (typeof timeout === 'number') {
|
||||
duration = timeout;
|
||||
} else if (timeout) {
|
||||
duration = timeout.exit;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
duration = transitionDuration;
|
||||
}
|
||||
|
||||
node.style.transition = [theme.transitions.create('opacity', {
|
||||
duration: duration
|
||||
duration: duration,
|
||||
delay: delay
|
||||
}), theme.transitions.create('transform', {
|
||||
duration: duration * 0.666,
|
||||
delay: duration * 0.333
|
||||
delay: delay || duration * 0.333
|
||||
})].join(',');
|
||||
|
||||
node.style.opacity = '0';
|
||||
@@ -230,66 +152,100 @@ var Grow = function (_React$Component) {
|
||||
if (_this.props.onExit) {
|
||||
_this.props.onExit(node);
|
||||
}
|
||||
}, _this.addEndListener = function (node, next) {
|
||||
var timeout = void 0;
|
||||
|
||||
}, _this.addEndListener = function (_, next) {
|
||||
if (_this.props.timeout === 'auto') {
|
||||
timeout = _this.autoTimeout || 0;
|
||||
} else {
|
||||
timeout = _this.props.timeout;
|
||||
_this.timer = setTimeout(next, _this.autoTimeout || 0);
|
||||
}
|
||||
|
||||
setTimeout(next, timeout);
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(Grow, [{
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props = this.props,
|
||||
appear = _props.appear,
|
||||
children = _props.children,
|
||||
onEnter = _props.onEnter,
|
||||
onEntering = _props.onEntering,
|
||||
onExit = _props.onExit,
|
||||
rootRef = _props.rootRef,
|
||||
styleProp = _props.style,
|
||||
transitionClasses = _props.transitionClasses,
|
||||
timeout = _props.timeout,
|
||||
theme = _props.theme,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['appear', 'children', 'onEnter', 'onEntering', 'onExit', 'rootRef', 'style', 'transitionClasses', 'timeout', 'theme']);
|
||||
timeout = _props.timeout,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'onEnter', 'onExit', 'style', 'theme', 'timeout']);
|
||||
|
||||
|
||||
var style = (0, _extends3.default)({}, children.props.style, styleProp);
|
||||
|
||||
// For server side rendering.
|
||||
if (!this.props.in || appear) {
|
||||
style.opacity = '0';
|
||||
}
|
||||
var style = (0, _extends3.default)({}, styleProp, _react2.default.isValidElement(children) ? children.props.style : {});
|
||||
|
||||
return _react2.default.createElement(
|
||||
_CSSTransition2.default,
|
||||
_Transition2.default,
|
||||
(0, _extends3.default)({
|
||||
classNames: transitionClasses,
|
||||
appear: true,
|
||||
onEnter: this.handleEnter,
|
||||
onEntering: this.handleEntering,
|
||||
onExit: this.handleExit,
|
||||
addEndListener: this.addEndListener,
|
||||
appear: appear,
|
||||
style: style
|
||||
}, other, {
|
||||
ref: rootRef
|
||||
}),
|
||||
children
|
||||
timeout: timeout === 'auto' ? null : timeout
|
||||
}, other),
|
||||
function (state, childProps) {
|
||||
return _react2.default.cloneElement(children, (0, _extends3.default)({
|
||||
style: (0, _extends3.default)({
|
||||
opacity: 0,
|
||||
transform: getScale(0.75)
|
||||
}, styles[state], style)
|
||||
}, childProps));
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return Grow;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Grow.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.func]),
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }), _propTypes2.default.oneOf(['auto'])])
|
||||
} : {};
|
||||
|
||||
Grow.defaultProps = {
|
||||
appear: true,
|
||||
timeout: 'auto',
|
||||
transitionClasses: {}
|
||||
timeout: 'auto'
|
||||
};
|
||||
|
||||
exports.default = (0, _withTheme2.default)()(Grow);
|
286
goTorrentWebUI/node_modules/material-ui/transitions/Grow.js.flow
generated
vendored
286
goTorrentWebUI/node_modules/material-ui/transitions/Grow.js.flow
generated
vendored
@@ -1,164 +1,91 @@
|
||||
// @flow
|
||||
// @inheritedComponent CSSTransition
|
||||
// @inheritedComponent Transition
|
||||
|
||||
import React from 'react';
|
||||
import type { Element } from 'react';
|
||||
import CSSTransition from 'react-transition-group/CSSTransition';
|
||||
import PropTypes from 'prop-types';
|
||||
import Transition from 'react-transition-group/Transition';
|
||||
import withTheme from '../styles/withTheme';
|
||||
import type { TransitionCallback, TransitionClasses } from '../internal/transition';
|
||||
import { reflow, getTransitionProps } from './utils';
|
||||
|
||||
// Only exported for tests.
|
||||
export function getScale(value: number) {
|
||||
function getScale(value) {
|
||||
return `scale(${value}, ${value ** 2})`;
|
||||
}
|
||||
|
||||
export type TransitionDuration = number | { enter?: number, exit?: number } | 'auto';
|
||||
|
||||
type ProvidedProps = {
|
||||
appear: boolean,
|
||||
timeout: TransitionDuration,
|
||||
theme: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
appear?: boolean,
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: Element<any>,
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: boolean,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited?: TransitionCallback,
|
||||
/**
|
||||
* Use that property to pass a ref callback to the root component.
|
||||
*/
|
||||
rootRef?: Function,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style?: Object,
|
||||
/**
|
||||
* The animation classNames applied to the component as it enters or exits.
|
||||
* This property is a direct binding to [`CSSTransition.classNames`](https://reactcommunity.org/react-transition-group/#CSSTransition-prop-classNames).
|
||||
*/
|
||||
transitionClasses?: TransitionClasses,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme?: Object,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout?: TransitionDuration,
|
||||
const styles = {
|
||||
entering: {
|
||||
opacity: 1,
|
||||
transform: getScale(1),
|
||||
},
|
||||
entered: {
|
||||
opacity: 1,
|
||||
transform: getScale(1),
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The Grow transition is used by the Popover component.
|
||||
* It's using [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
* The Grow transition is used by the [Popover](/demos/popovers) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
class Grow extends React.Component<ProvidedProps & Props> {
|
||||
static defaultProps = {
|
||||
appear: true,
|
||||
timeout: 'auto',
|
||||
transitionClasses: {},
|
||||
};
|
||||
class Grow extends React.Component {
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
||||
autoTimeout = undefined;
|
||||
timer = null;
|
||||
|
||||
handleEnter = (node: HTMLElement) => {
|
||||
node.style.opacity = '0';
|
||||
node.style.transform = getScale(0.75);
|
||||
handleEnter = node => {
|
||||
const { theme, timeout } = this.props;
|
||||
reflow(node); // So the animation always start from the start.
|
||||
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'enter',
|
||||
});
|
||||
let duration = 0;
|
||||
if (timeout === 'auto') {
|
||||
duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
|
||||
this.autoTimeout = duration;
|
||||
} else {
|
||||
duration = transitionDuration;
|
||||
}
|
||||
|
||||
node.style.transition = [
|
||||
theme.transitions.create('opacity', {
|
||||
duration,
|
||||
delay,
|
||||
}),
|
||||
theme.transitions.create('transform', {
|
||||
duration: duration * 0.666,
|
||||
delay,
|
||||
}),
|
||||
].join(',');
|
||||
|
||||
if (this.props.onEnter) {
|
||||
this.props.onEnter(node);
|
||||
}
|
||||
};
|
||||
|
||||
handleEntering = (node: HTMLElement) => {
|
||||
handleExit = node => {
|
||||
const { theme, timeout } = this.props;
|
||||
let duration = 0;
|
||||
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'exit',
|
||||
});
|
||||
if (timeout === 'auto') {
|
||||
duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
|
||||
this.autoTimeout = duration;
|
||||
} else if (typeof timeout === 'number') {
|
||||
duration = timeout;
|
||||
} else if (timeout) {
|
||||
duration = timeout.enter;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
duration = transitionDuration;
|
||||
}
|
||||
|
||||
node.style.transition = [
|
||||
theme.transitions.create('opacity', {
|
||||
duration,
|
||||
delay,
|
||||
}),
|
||||
theme.transitions.create('transform', {
|
||||
duration: duration * 0.666,
|
||||
}),
|
||||
].join(',');
|
||||
|
||||
node.style.opacity = '1';
|
||||
node.style.transform = getScale(1);
|
||||
|
||||
if (this.props.onEntering) {
|
||||
this.props.onEntering(node);
|
||||
}
|
||||
};
|
||||
|
||||
handleExit = (node: HTMLElement) => {
|
||||
const { theme, timeout } = this.props;
|
||||
let duration = 0;
|
||||
|
||||
if (timeout === 'auto') {
|
||||
duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
|
||||
this.autoTimeout = duration;
|
||||
} else if (typeof timeout === 'number') {
|
||||
duration = timeout;
|
||||
} else if (timeout) {
|
||||
duration = timeout.exit;
|
||||
} else {
|
||||
// The propType will warn in this case.
|
||||
}
|
||||
|
||||
node.style.transition = [
|
||||
theme.transitions.create('opacity', {
|
||||
duration,
|
||||
}),
|
||||
theme.transitions.create('transform', {
|
||||
duration: duration * 0.666,
|
||||
delay: duration * 0.333,
|
||||
delay: delay || duration * 0.333,
|
||||
}),
|
||||
].join(',');
|
||||
|
||||
@@ -170,56 +97,93 @@ class Grow extends React.Component<ProvidedProps & Props> {
|
||||
}
|
||||
};
|
||||
|
||||
addEndListener = (node, next: Function) => {
|
||||
let timeout;
|
||||
|
||||
addEndListener = (_, next) => {
|
||||
if (this.props.timeout === 'auto') {
|
||||
timeout = this.autoTimeout || 0;
|
||||
} else {
|
||||
timeout = this.props.timeout;
|
||||
this.timer = setTimeout(next, this.autoTimeout || 0);
|
||||
}
|
||||
|
||||
setTimeout(next, timeout);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
appear,
|
||||
children,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onExit,
|
||||
rootRef,
|
||||
style: styleProp,
|
||||
transitionClasses,
|
||||
timeout,
|
||||
theme,
|
||||
...other
|
||||
} = this.props;
|
||||
const { children, onEnter, onExit, style: styleProp, theme, timeout, ...other } = this.props;
|
||||
|
||||
const style = { ...children.props.style, ...styleProp };
|
||||
|
||||
// For server side rendering.
|
||||
if (!this.props.in || appear) {
|
||||
style.opacity = '0';
|
||||
}
|
||||
const style = {
|
||||
...styleProp,
|
||||
...(React.isValidElement(children) ? children.props.style : {}),
|
||||
};
|
||||
|
||||
return (
|
||||
<CSSTransition
|
||||
classNames={transitionClasses}
|
||||
<Transition
|
||||
appear
|
||||
onEnter={this.handleEnter}
|
||||
onEntering={this.handleEntering}
|
||||
onExit={this.handleExit}
|
||||
addEndListener={this.addEndListener}
|
||||
appear={appear}
|
||||
style={style}
|
||||
timeout={timeout === 'auto' ? null : timeout}
|
||||
{...other}
|
||||
ref={rootRef}
|
||||
>
|
||||
{children}
|
||||
</CSSTransition>
|
||||
{(state, childProps) => {
|
||||
return React.cloneElement(children, {
|
||||
style: {
|
||||
opacity: 0,
|
||||
transform: getScale(0.75),
|
||||
...styles[state],
|
||||
...style,
|
||||
},
|
||||
...childProps,
|
||||
});
|
||||
}}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Grow.propTypes = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*
|
||||
* Set to 'auto' to automatically calculate transition time based on height.
|
||||
*/
|
||||
timeout: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
PropTypes.oneOf(['auto']),
|
||||
]),
|
||||
};
|
||||
|
||||
Grow.defaultProps = {
|
||||
timeout: 'auto',
|
||||
};
|
||||
|
||||
export default withTheme()(Grow);
|
||||
|
5
goTorrentWebUI/node_modules/material-ui/transitions/Slide.d.ts
generated
vendored
5
goTorrentWebUI/node_modules/material-ui/transitions/Slide.d.ts
generated
vendored
@@ -1,11 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import { Theme } from '../styles/createMuiTheme';
|
||||
import { TransitionDuration, TransitionProps } from '../internal/transition';
|
||||
import { TransitionProps } from './transition';
|
||||
|
||||
export interface SlideProps extends TransitionProps {
|
||||
direction?: 'left' | 'right' | 'up' | 'down';
|
||||
direction: 'left' | 'right' | 'up' | 'down';
|
||||
theme?: Theme;
|
||||
timeout?: TransitionDuration;
|
||||
}
|
||||
|
||||
declare const Slide: React.ComponentType<SlideProps>;
|
||||
|
250
goTorrentWebUI/node_modules/material-ui/transitions/Slide.js
generated
vendored
250
goTorrentWebUI/node_modules/material-ui/transitions/Slide.js
generated
vendored
@@ -38,6 +38,10 @@ var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _reactDom = require('react-dom');
|
||||
|
||||
var _reactEventListener = require('react-event-listener');
|
||||
@@ -52,21 +56,22 @@ var _Transition = require('react-transition-group/Transition');
|
||||
|
||||
var _Transition2 = _interopRequireDefault(_Transition);
|
||||
|
||||
var _ownerWindow = require('dom-helpers/ownerWindow');
|
||||
|
||||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow);
|
||||
|
||||
var _withTheme = require('../styles/withTheme');
|
||||
|
||||
var _withTheme2 = _interopRequireDefault(_withTheme);
|
||||
|
||||
var _transitions = require('../styles/transitions');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Element = require('react').babelPluginFlowReactPropTypes_proptype_Element || require('prop-types').any;
|
||||
// @inheritedComponent Transition
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionCallback = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionCallback || require('prop-types').any;
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_TransitionDuration = require('../internal/transition').babelPluginFlowReactPropTypes_proptype_TransitionDuration || require('prop-types').any;
|
||||
|
||||
var GUTTER = 24;
|
||||
|
||||
// Translate the node so he can't be seen on the screen.
|
||||
@@ -82,7 +87,7 @@ function getTranslateValue(props, node) {
|
||||
if (node.fakeTransform) {
|
||||
transform = node.fakeTransform;
|
||||
} else {
|
||||
var computedStyle = window.getComputedStyle(node);
|
||||
var computedStyle = (0, _ownerWindow2.default)(node).getComputedStyle(node);
|
||||
transform = computedStyle.getPropertyValue('-webkit-transform') || computedStyle.getPropertyValue('transform');
|
||||
}
|
||||
|
||||
@@ -103,7 +108,7 @@ function getTranslateValue(props, node) {
|
||||
return 'translateY(100vh) translateY(-' + (rect.top - offsetY) + 'px)';
|
||||
}
|
||||
|
||||
// direction === 'down
|
||||
// direction === 'down'
|
||||
return 'translate3d(0, ' + (0 - (rect.top + rect.height)) + 'px, 0)';
|
||||
}
|
||||
|
||||
@@ -116,75 +121,10 @@ function setTranslateValue(props, node) {
|
||||
}
|
||||
}
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Direction = require('prop-types').oneOf(['left', 'right', 'up', 'down']);
|
||||
|
||||
var babelPluginFlowReactPropTypes_proptype_Props = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: typeof babelPluginFlowReactPropTypes_proptype_Element === 'function' ? babelPluginFlowReactPropTypes_proptype_Element.isRequired ? babelPluginFlowReactPropTypes_proptype_Element.isRequired : babelPluginFlowReactPropTypes_proptype_Element : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_Element).isRequired,
|
||||
|
||||
/**
|
||||
* Direction the child node will enter from.
|
||||
*/
|
||||
direction: require('prop-types').oneOf(['left', 'right', 'up', 'down']),
|
||||
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: require('prop-types').bool.isRequired,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited: typeof babelPluginFlowReactPropTypes_proptype_TransitionCallback === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionCallback : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionCallback),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: require('prop-types').object,
|
||||
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: typeof babelPluginFlowReactPropTypes_proptype_TransitionDuration === 'function' ? babelPluginFlowReactPropTypes_proptype_TransitionDuration : require('prop-types').shape(babelPluginFlowReactPropTypes_proptype_TransitionDuration),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: require('prop-types').object
|
||||
};
|
||||
|
||||
|
||||
var reflow = function reflow(node) {
|
||||
return node.scrollTop;
|
||||
};
|
||||
/**
|
||||
* The Slide transition is used by the [Snackbar](/demos/snackbars) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
|
||||
var Slide = function (_React$Component) {
|
||||
(0, _inherits3.default)(Slide, _React$Component);
|
||||
@@ -201,8 +141,7 @@ var Slide = function (_React$Component) {
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Slide.__proto__ || (0, _getPrototypeOf2.default)(Slide)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
// We use this state to handle the server-side rendering.
|
||||
firstMount: true
|
||||
mounted: false
|
||||
}, _this.transition = null, _this.handleResize = (0, _debounce2.default)(function () {
|
||||
// Skip configuration where the position is screen size invariant.
|
||||
if (_this.props.in || _this.props.direction === 'down' || _this.props.direction === 'right') {
|
||||
@@ -210,29 +149,34 @@ var Slide = function (_React$Component) {
|
||||
}
|
||||
|
||||
var node = (0, _reactDom.findDOMNode)(_this.transition);
|
||||
if (node instanceof HTMLElement) {
|
||||
if (node) {
|
||||
setTranslateValue(_this.props, node);
|
||||
}
|
||||
}, 166), _this.handleEnter = function (node) {
|
||||
setTranslateValue(_this.props, node);
|
||||
reflow(node);
|
||||
(0, _utils.reflow)(node);
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
}, _this.handleEntering = function (node) {
|
||||
var _this$props = _this.props,
|
||||
theme = _this$props.theme,
|
||||
timeout = _this$props.timeout;
|
||||
var theme = _this.props.theme;
|
||||
|
||||
var _getTransitionProps = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'enter'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps.duration,
|
||||
delay = _getTransitionProps.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
easing: theme.transitions.easing.easeOut
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
delay: delay
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
easing: theme.transitions.easing.easeOut
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
delay: delay
|
||||
});
|
||||
node.style.transform = 'translate3d(0, 0, 0)';
|
||||
node.style.webkitTransform = 'translate3d(0, 0, 0)';
|
||||
@@ -240,54 +184,81 @@ var Slide = function (_React$Component) {
|
||||
_this.props.onEntering(node);
|
||||
}
|
||||
}, _this.handleExit = function (node) {
|
||||
var _this$props2 = _this.props,
|
||||
theme = _this$props2.theme,
|
||||
timeout = _this$props2.timeout;
|
||||
var theme = _this.props.theme;
|
||||
|
||||
var _getTransitionProps2 = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'exit'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps2.duration,
|
||||
delay = _getTransitionProps2.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
easing: theme.transitions.easing.sharp
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
delay: delay
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
easing: theme.transitions.easing.sharp
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
delay: delay
|
||||
});
|
||||
setTranslateValue(_this.props, node);
|
||||
|
||||
if (_this.props.onExit) {
|
||||
_this.props.onExit(node);
|
||||
}
|
||||
}, _this.handleExited = function (node) {
|
||||
// No need for transitions when the component is hidden
|
||||
node.style.transition = '';
|
||||
node.style.webkitTransition = '';
|
||||
|
||||
if (_this.props.onExited) {
|
||||
_this.props.onExited(node);
|
||||
}
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(Slide, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
// state.firstMount handle SSR, once the component is mounted, we need
|
||||
// to propery hide it.
|
||||
// state.mounted handle SSR, once the component is mounted, we need
|
||||
// to properly hide it.
|
||||
if (!this.props.in) {
|
||||
// We need to set initial translate values of transition element
|
||||
// otherwise component will be shown when in=false.
|
||||
var element = (0, _reactDom.findDOMNode)(this.transition);
|
||||
if (element instanceof HTMLElement) {
|
||||
element.style.visibility = 'inherit';
|
||||
setTranslateValue(this.props, element);
|
||||
}
|
||||
this.updatePosition();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillReceiveProps',
|
||||
value: function componentWillReceiveProps() {
|
||||
this.setState({
|
||||
firstMount: false
|
||||
mounted: true
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
if (prevProps.direction !== this.props.direction && !this.props.in) {
|
||||
// We need to update the position of the drawer when the direction change and
|
||||
// when it's hidden.
|
||||
this.updatePosition();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
this.handleResize.cancel();
|
||||
}
|
||||
}, {
|
||||
key: 'updatePosition',
|
||||
value: function updatePosition() {
|
||||
var node = (0, _reactDom.findDOMNode)(this.transition);
|
||||
if (node) {
|
||||
node.style.visibility = 'inherit';
|
||||
setTranslateValue(this.props, node);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
@@ -298,17 +269,23 @@ var Slide = function (_React$Component) {
|
||||
onEnter = _props.onEnter,
|
||||
onEntering = _props.onEntering,
|
||||
onExit = _props.onExit,
|
||||
onExited = _props.onExited,
|
||||
styleProp = _props.style,
|
||||
theme = _props.theme,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'onEnter', 'onEntering', 'onExit', 'style', 'theme']);
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'onEnter', 'onEntering', 'onExit', 'onExited', 'style', 'theme']);
|
||||
|
||||
|
||||
var style = (0, _extends3.default)({}, styleProp);
|
||||
var style = {};
|
||||
|
||||
if (!this.props.in && this.state.firstMount) {
|
||||
// We use this state to handle the server-side rendering.
|
||||
// We don't know the width of the children ahead of time.
|
||||
// We need to render it.
|
||||
if (!this.props.in && !this.state.mounted) {
|
||||
style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
style = (0, _extends3.default)({}, style, styleProp, _react2.default.isValidElement(children) ? children.props.style : {});
|
||||
|
||||
return _react2.default.createElement(
|
||||
_reactEventListener2.default,
|
||||
{ target: 'window', onResize: this.handleResize },
|
||||
@@ -318,13 +295,13 @@ var Slide = function (_React$Component) {
|
||||
onEnter: this.handleEnter,
|
||||
onEntering: this.handleEntering,
|
||||
onExit: this.handleExit,
|
||||
onExited: this.handleExited,
|
||||
appear: true,
|
||||
style: style
|
||||
}, other, {
|
||||
style: style,
|
||||
ref: function ref(node) {
|
||||
_this2.transition = node;
|
||||
}
|
||||
}),
|
||||
}, other),
|
||||
children
|
||||
)
|
||||
);
|
||||
@@ -333,6 +310,58 @@ var Slide = function (_React$Component) {
|
||||
return Slide;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Slide.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.func]),
|
||||
/**
|
||||
* Direction the child node will enter from.
|
||||
*/
|
||||
direction: _propTypes2.default.oneOf(['left', 'right', 'up', 'down']),
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number })])
|
||||
} : {};
|
||||
|
||||
Slide.defaultProps = {
|
||||
direction: 'down',
|
||||
timeout: {
|
||||
@@ -340,4 +369,5 @@ Slide.defaultProps = {
|
||||
exit: _transitions.duration.leavingScreen
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = (0, _withTheme2.default)()(Slide);
|
270
goTorrentWebUI/node_modules/material-ui/transitions/Slide.js.flow
generated
vendored
270
goTorrentWebUI/node_modules/material-ui/transitions/Slide.js.flow
generated
vendored
@@ -1,22 +1,22 @@
|
||||
// @flow
|
||||
// @inheritedComponent Transition
|
||||
|
||||
import React from 'react';
|
||||
import type { Element } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import EventListener from 'react-event-listener';
|
||||
import debounce from 'lodash/debounce';
|
||||
import Transition from 'react-transition-group/Transition';
|
||||
import ownerWindow from 'dom-helpers/ownerWindow';
|
||||
import withTheme from '../styles/withTheme';
|
||||
import { duration } from '../styles/transitions';
|
||||
import type { TransitionDuration, TransitionCallback } from '../internal/transition';
|
||||
import { reflow, getTransitionProps } from './utils';
|
||||
|
||||
const GUTTER = 24;
|
||||
|
||||
// Translate the node so he can't be seen on the screen.
|
||||
// Later, we gonna translate back the node to his original location
|
||||
// with `translate3d(0, 0, 0)`.`
|
||||
function getTranslateValue(props, node: HTMLElement) {
|
||||
function getTranslateValue(props, node) {
|
||||
const { direction } = props;
|
||||
const rect = node.getBoundingClientRect();
|
||||
|
||||
@@ -25,7 +25,7 @@ function getTranslateValue(props, node: HTMLElement) {
|
||||
if (node.fakeTransform) {
|
||||
transform = node.fakeTransform;
|
||||
} else {
|
||||
const computedStyle = window.getComputedStyle(node);
|
||||
const computedStyle = ownerWindow(node).getComputedStyle(node);
|
||||
transform =
|
||||
computedStyle.getPropertyValue('-webkit-transform') ||
|
||||
computedStyle.getPropertyValue('transform');
|
||||
@@ -51,11 +51,11 @@ function getTranslateValue(props, node: HTMLElement) {
|
||||
return `translateY(100vh) translateY(-${rect.top - offsetY}px)`;
|
||||
}
|
||||
|
||||
// direction === 'down
|
||||
// direction === 'down'
|
||||
return `translate3d(0, ${0 - (rect.top + rect.height)}px, 0)`;
|
||||
}
|
||||
|
||||
export function setTranslateValue(props: Object, node: HTMLElement | Object) {
|
||||
export function setTranslateValue(props, node) {
|
||||
const transform = getTranslateValue(props, node);
|
||||
|
||||
if (transform) {
|
||||
@@ -64,111 +64,53 @@ export function setTranslateValue(props: Object, node: HTMLElement | Object) {
|
||||
}
|
||||
}
|
||||
|
||||
export type Direction = 'left' | 'right' | 'up' | 'down';
|
||||
|
||||
type ProvidedProps = {
|
||||
timeout: TransitionDuration,
|
||||
theme: Object,
|
||||
};
|
||||
|
||||
export type Props = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: Element<any>,
|
||||
/**
|
||||
* Direction the child node will enter from.
|
||||
*/
|
||||
direction?: Direction,
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: boolean,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited?: TransitionCallback,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style?: Object,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout?: TransitionDuration,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme?: Object,
|
||||
};
|
||||
|
||||
type State = {
|
||||
firstMount: boolean,
|
||||
};
|
||||
|
||||
const reflow = node => node.scrollTop;
|
||||
|
||||
class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
static defaultProps = {
|
||||
direction: 'down',
|
||||
timeout: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The Slide transition is used by the [Snackbar](/demos/snackbars) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
class Slide extends React.Component {
|
||||
state = {
|
||||
// We use this state to handle the server-side rendering.
|
||||
firstMount: true,
|
||||
mounted: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
// state.firstMount handle SSR, once the component is mounted, we need
|
||||
// to propery hide it.
|
||||
// state.mounted handle SSR, once the component is mounted, we need
|
||||
// to properly hide it.
|
||||
if (!this.props.in) {
|
||||
// We need to set initial translate values of transition element
|
||||
// otherwise component will be shown when in=false.
|
||||
const element = findDOMNode(this.transition);
|
||||
if (element instanceof HTMLElement) {
|
||||
element.style.visibility = 'inherit';
|
||||
setTranslateValue(this.props, element);
|
||||
}
|
||||
this.updatePosition();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps() {
|
||||
this.setState({
|
||||
firstMount: false,
|
||||
mounted: true,
|
||||
});
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (prevProps.direction !== this.props.direction && !this.props.in) {
|
||||
// We need to update the position of the drawer when the direction change and
|
||||
// when it's hidden.
|
||||
this.updatePosition();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.handleResize.cancel();
|
||||
}
|
||||
|
||||
transition = null;
|
||||
|
||||
updatePosition() {
|
||||
const node = findDOMNode(this.transition);
|
||||
if (node) {
|
||||
node.style.visibility = 'inherit';
|
||||
setTranslateValue(this.props, node);
|
||||
}
|
||||
}
|
||||
|
||||
handleResize = debounce(() => {
|
||||
// Skip configuration where the position is screen size invariant.
|
||||
if (this.props.in || this.props.direction === 'down' || this.props.direction === 'right') {
|
||||
@@ -176,12 +118,12 @@ class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
|
||||
const node = findDOMNode(this.transition);
|
||||
if (node instanceof HTMLElement) {
|
||||
if (node) {
|
||||
setTranslateValue(this.props, node);
|
||||
}
|
||||
}, 166);
|
||||
|
||||
handleEnter = (node: HTMLElement) => {
|
||||
handleEnter = node => {
|
||||
setTranslateValue(this.props, node);
|
||||
reflow(node);
|
||||
|
||||
@@ -190,16 +132,21 @@ class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
handleEntering = (node: HTMLElement) => {
|
||||
const { theme, timeout } = this.props;
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
handleEntering = node => {
|
||||
const { theme } = this.props;
|
||||
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'enter',
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.enter,
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
delay,
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
delay,
|
||||
});
|
||||
node.style.transform = 'translate3d(0, 0, 0)';
|
||||
node.style.webkitTransform = 'translate3d(0, 0, 0)';
|
||||
@@ -208,16 +155,21 @@ class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
handleExit = (node: HTMLElement) => {
|
||||
const { theme, timeout } = this.props;
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
handleExit = node => {
|
||||
const { theme } = this.props;
|
||||
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'exit',
|
||||
});
|
||||
// $FlowFixMe - https://github.com/facebook/flow/pull/5161
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: typeof timeout === 'number' ? timeout : timeout.exit,
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
delay,
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('-webkit-transform', {
|
||||
duration: transitionDuration,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
delay,
|
||||
});
|
||||
setTranslateValue(this.props, node);
|
||||
|
||||
@@ -226,27 +178,56 @@ class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
handleExited = node => {
|
||||
// No need for transitions when the component is hidden
|
||||
node.style.transition = '';
|
||||
node.style.webkitTransition = '';
|
||||
|
||||
if (this.props.onExited) {
|
||||
this.props.onExited(node);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { children, onEnter, onEntering, onExit, style: styleProp, theme, ...other } = this.props;
|
||||
const {
|
||||
children,
|
||||
onEnter,
|
||||
onEntering,
|
||||
onExit,
|
||||
onExited,
|
||||
style: styleProp,
|
||||
theme,
|
||||
...other
|
||||
} = this.props;
|
||||
|
||||
const style = { ...styleProp };
|
||||
let style = {};
|
||||
|
||||
if (!this.props.in && this.state.firstMount) {
|
||||
// We use this state to handle the server-side rendering.
|
||||
// We don't know the width of the children ahead of time.
|
||||
// We need to render it.
|
||||
if (!this.props.in && !this.state.mounted) {
|
||||
style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
style = {
|
||||
...style,
|
||||
...styleProp,
|
||||
...(React.isValidElement(children) ? children.props.style : {}),
|
||||
};
|
||||
|
||||
return (
|
||||
<EventListener target="window" onResize={this.handleResize}>
|
||||
<Transition
|
||||
onEnter={this.handleEnter}
|
||||
onEntering={this.handleEntering}
|
||||
onExit={this.handleExit}
|
||||
onExited={this.handleExited}
|
||||
appear
|
||||
style={style}
|
||||
{...other}
|
||||
ref={node => {
|
||||
this.transition = node;
|
||||
}}
|
||||
{...other}
|
||||
>
|
||||
{children}
|
||||
</Transition>
|
||||
@@ -255,4 +236,67 @@ class Slide extends React.Component<ProvidedProps & Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
Slide.propTypes = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
||||
/**
|
||||
* Direction the child node will enter from.
|
||||
*/
|
||||
direction: PropTypes.oneOf(['left', 'right', 'up', 'down']),
|
||||
/**
|
||||
* If `true`, show the component; triggers the enter or exit animation.
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExited: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExiting: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
]),
|
||||
};
|
||||
|
||||
Slide.defaultProps = {
|
||||
direction: 'down',
|
||||
timeout: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
export default withTheme()(Slide);
|
||||
|
11
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.d.ts
generated
vendored
Normal file
11
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { Theme } from '../styles/createMuiTheme';
|
||||
import { TransitionProps } from './transition';
|
||||
|
||||
export interface ZoomProps extends TransitionProps {
|
||||
theme?: Theme;
|
||||
}
|
||||
|
||||
declare const Zoom: React.ComponentType<ZoomProps>;
|
||||
|
||||
export default Zoom;
|
204
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.js
generated
vendored
Normal file
204
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
||||
|
||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _propTypes = require('prop-types');
|
||||
|
||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||
|
||||
var _Transition = require('react-transition-group/Transition');
|
||||
|
||||
var _Transition2 = _interopRequireDefault(_Transition);
|
||||
|
||||
var _transitions = require('../styles/transitions');
|
||||
|
||||
var _withTheme = require('../styles/withTheme');
|
||||
|
||||
var _withTheme2 = _interopRequireDefault(_withTheme);
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @inheritedComponent Transition
|
||||
|
||||
var styles = {
|
||||
entering: {
|
||||
transform: 'scale(1)'
|
||||
},
|
||||
entered: {
|
||||
transform: 'scale(1)'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The Zoom transition can be used for the floating variant of the
|
||||
* [Button](https://material-ui-next.com/demos/buttons/#floating-action-buttons) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
|
||||
var Zoom = function (_React$Component) {
|
||||
(0, _inherits3.default)(Zoom, _React$Component);
|
||||
|
||||
function Zoom() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
(0, _classCallCheck3.default)(this, Zoom);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Zoom.__proto__ || (0, _getPrototypeOf2.default)(Zoom)).call.apply(_ref, [this].concat(args))), _this), _this.handleEnter = function (node) {
|
||||
var theme = _this.props.theme;
|
||||
|
||||
(0, _utils.reflow)(node); // So the animation always start from the start.
|
||||
|
||||
var _getTransitionProps = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'enter'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps.duration,
|
||||
delay = _getTransitionProps.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
}, _this.handleExit = function (node) {
|
||||
var theme = _this.props.theme;
|
||||
|
||||
var _getTransitionProps2 = (0, _utils.getTransitionProps)(_this.props, {
|
||||
mode: 'exit'
|
||||
}),
|
||||
transitionDuration = _getTransitionProps2.duration,
|
||||
delay = _getTransitionProps2.delay;
|
||||
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay: delay
|
||||
});
|
||||
|
||||
if (_this.props.onExit) {
|
||||
_this.props.onExit(node);
|
||||
}
|
||||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(Zoom, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props = this.props,
|
||||
children = _props.children,
|
||||
onEnter = _props.onEnter,
|
||||
onExit = _props.onExit,
|
||||
styleProp = _props.style,
|
||||
theme = _props.theme,
|
||||
other = (0, _objectWithoutProperties3.default)(_props, ['children', 'onEnter', 'onExit', 'style', 'theme']);
|
||||
|
||||
|
||||
var style = (0, _extends3.default)({}, styleProp, _react2.default.isValidElement(children) ? children.props.style : {});
|
||||
|
||||
return _react2.default.createElement(
|
||||
_Transition2.default,
|
||||
(0, _extends3.default)({ appear: true, onEnter: this.handleEnter, onExit: this.handleExit }, other),
|
||||
function (state, childProps) {
|
||||
return _react2.default.cloneElement(children, (0, _extends3.default)({
|
||||
style: (0, _extends3.default)({
|
||||
transform: 'scale(0)'
|
||||
}, styles[state], style)
|
||||
}, childProps));
|
||||
}
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return Zoom;
|
||||
}(_react2.default.Component);
|
||||
|
||||
Zoom.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.func]),
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: _propTypes2.default.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: _propTypes2.default.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: _propTypes2.default.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: _propTypes2.default.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number })])
|
||||
} : {};
|
||||
|
||||
Zoom.defaultProps = {
|
||||
timeout: {
|
||||
enter: _transitions.duration.enteringScreen,
|
||||
exit: _transitions.duration.leavingScreen
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = (0, _withTheme2.default)()(Zoom);
|
132
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.js.flow
generated
vendored
Normal file
132
goTorrentWebUI/node_modules/material-ui/transitions/Zoom.js.flow
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
// @inheritedComponent Transition
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Transition from 'react-transition-group/Transition';
|
||||
import { duration } from '../styles/transitions';
|
||||
import withTheme from '../styles/withTheme';
|
||||
import { reflow, getTransitionProps } from './utils';
|
||||
|
||||
const styles = {
|
||||
entering: {
|
||||
transform: 'scale(1)',
|
||||
},
|
||||
entered: {
|
||||
transform: 'scale(1)',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The Zoom transition can be used for the floating variant of the
|
||||
* [Button](https://material-ui-next.com/demos/buttons/#floating-action-buttons) component.
|
||||
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
||||
*/
|
||||
class Zoom extends React.Component {
|
||||
handleEnter = node => {
|
||||
const { theme } = this.props;
|
||||
reflow(node); // So the animation always start from the start.
|
||||
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'enter',
|
||||
});
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
|
||||
if (this.props.onEnter) {
|
||||
this.props.onEnter(node);
|
||||
}
|
||||
};
|
||||
|
||||
handleExit = node => {
|
||||
const { theme } = this.props;
|
||||
const { duration: transitionDuration, delay } = getTransitionProps(this.props, {
|
||||
mode: 'exit',
|
||||
});
|
||||
node.style.transition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
node.style.webkitTransition = theme.transitions.create('transform', {
|
||||
duration: transitionDuration,
|
||||
delay,
|
||||
});
|
||||
|
||||
if (this.props.onExit) {
|
||||
this.props.onExit(node);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { children, onEnter, onExit, style: styleProp, theme, ...other } = this.props;
|
||||
|
||||
const style = {
|
||||
...styleProp,
|
||||
...(React.isValidElement(children) ? children.props.style : {}),
|
||||
};
|
||||
|
||||
return (
|
||||
<Transition appear onEnter={this.handleEnter} onExit={this.handleExit} {...other}>
|
||||
{(state, childProps) => {
|
||||
return React.cloneElement(children, {
|
||||
style: {
|
||||
transform: 'scale(0)',
|
||||
...styles[state],
|
||||
...style,
|
||||
},
|
||||
...childProps,
|
||||
});
|
||||
}}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Zoom.propTypes = {
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
||||
/**
|
||||
* If `true`, the component will transition in.
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
style: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object.isRequired,
|
||||
/**
|
||||
* The duration for the transition, in milliseconds.
|
||||
* You may specify a single timeout for all transitions, or individually with an object.
|
||||
*/
|
||||
timeout: PropTypes.oneOfType([
|
||||
PropTypes.number,
|
||||
PropTypes.shape({ enter: PropTypes.number, exit: PropTypes.number }),
|
||||
]),
|
||||
};
|
||||
|
||||
Zoom.defaultProps = {
|
||||
timeout: {
|
||||
enter: duration.enteringScreen,
|
||||
exit: duration.leavingScreen,
|
||||
},
|
||||
};
|
||||
|
||||
export default withTheme()(Zoom);
|
10
goTorrentWebUI/node_modules/material-ui/transitions/index.d.ts
generated
vendored
Normal file
10
goTorrentWebUI/node_modules/material-ui/transitions/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export { default as Slide } from './Slide';
|
||||
export * from './Slide';
|
||||
export { default as Grow } from './Grow';
|
||||
export * from './Grow';
|
||||
export { default as Fade } from './Fade';
|
||||
export * from './Fade';
|
||||
export { default as Collapse } from './Collapse';
|
||||
export * from './Collapse';
|
||||
export { default as Zoom } from './Zoom';
|
||||
export * from './Zoom';
|
52
goTorrentWebUI/node_modules/material-ui/transitions/index.js
generated
vendored
Normal file
52
goTorrentWebUI/node_modules/material-ui/transitions/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _Slide = require('./Slide');
|
||||
|
||||
Object.defineProperty(exports, 'Slide', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Slide).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Grow = require('./Grow');
|
||||
|
||||
Object.defineProperty(exports, 'Grow', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Grow).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Fade = require('./Fade');
|
||||
|
||||
Object.defineProperty(exports, 'Fade', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Fade).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Collapse = require('./Collapse');
|
||||
|
||||
Object.defineProperty(exports, 'Collapse', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Collapse).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Zoom = require('./Zoom');
|
||||
|
||||
Object.defineProperty(exports, 'Zoom', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Zoom).default;
|
||||
}
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
7
goTorrentWebUI/node_modules/material-ui/transitions/index.js.flow
generated
vendored
Normal file
7
goTorrentWebUI/node_modules/material-ui/transitions/index.js.flow
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// @flow
|
||||
|
||||
export { default as Slide } from './Slide';
|
||||
export { default as Grow } from './Grow';
|
||||
export { default as Fade } from './Fade';
|
||||
export { default as Collapse } from './Collapse';
|
||||
export { default as Zoom } from './Zoom';
|
25
goTorrentWebUI/node_modules/material-ui/transitions/transition.d.ts
generated
vendored
Normal file
25
goTorrentWebUI/node_modules/material-ui/transitions/transition.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
TransitionProps as _TransitionProps,
|
||||
TransitionActions,
|
||||
} from 'react-transition-group/Transition';
|
||||
import { TransitionEventHandler } from 'react';
|
||||
|
||||
export type TransitionHandlerKeys =
|
||||
| 'onEnter'
|
||||
| 'onEntering'
|
||||
| 'onEntered'
|
||||
| 'onExit'
|
||||
| 'onExiting'
|
||||
| 'onExited';
|
||||
export type TransitionHandlerProps = Pick<_TransitionProps, TransitionHandlerKeys>;
|
||||
|
||||
export type TransitionKeys =
|
||||
| 'in'
|
||||
| 'mountOnEnter'
|
||||
| 'unmountOnExit'
|
||||
| 'timeout'
|
||||
| 'addEndListener'
|
||||
| TransitionHandlerKeys;
|
||||
export interface TransitionProps
|
||||
extends TransitionActions,
|
||||
Partial<Pick<_TransitionProps, TransitionKeys>> {}
|
21
goTorrentWebUI/node_modules/material-ui/transitions/utils.js
generated
vendored
Normal file
21
goTorrentWebUI/node_modules/material-ui/transitions/utils.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getTransitionProps = getTransitionProps;
|
||||
var reflow = exports.reflow = function reflow(node) {
|
||||
return node.scrollTop;
|
||||
};
|
||||
|
||||
function getTransitionProps(props, options) {
|
||||
var timeout = props.timeout,
|
||||
_props$style = props.style,
|
||||
style = _props$style === undefined ? {} : _props$style;
|
||||
|
||||
|
||||
return {
|
||||
duration: style.transitionDuration || typeof timeout === 'number' ? timeout : timeout[options.mode],
|
||||
delay: style.transitionDelay
|
||||
};
|
||||
}
|
11
goTorrentWebUI/node_modules/material-ui/transitions/utils.js.flow
generated
vendored
Normal file
11
goTorrentWebUI/node_modules/material-ui/transitions/utils.js.flow
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export const reflow = node => node.scrollTop;
|
||||
|
||||
export function getTransitionProps(props, options) {
|
||||
const { timeout, style = {} } = props;
|
||||
|
||||
return {
|
||||
duration:
|
||||
style.transitionDuration || typeof timeout === 'number' ? timeout : timeout[options.mode],
|
||||
delay: style.transitionDelay,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user