Initial commit
This commit is contained in:
297
node_modules/react-transition-group/CSSTransition.js
generated
vendored
Normal file
297
node_modules/react-transition-group/CSSTransition.js
generated
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var PropTypes = _interopRequireWildcard(require("prop-types"));
|
||||
|
||||
var _addClass = _interopRequireDefault(require("dom-helpers/class/addClass"));
|
||||
|
||||
var _removeClass = _interopRequireDefault(require("dom-helpers/class/removeClass"));
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _Transition = _interopRequireDefault(require("./Transition"));
|
||||
|
||||
var _PropTypes = require("./utils/PropTypes");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
var addClass = function addClass(node, classes) {
|
||||
return node && classes && classes.split(' ').forEach(function (c) {
|
||||
return (0, _addClass.default)(node, c);
|
||||
});
|
||||
};
|
||||
|
||||
var removeClass = function removeClass(node, classes) {
|
||||
return node && classes && classes.split(' ').forEach(function (c) {
|
||||
return (0, _removeClass.default)(node, c);
|
||||
});
|
||||
};
|
||||
|
||||
var propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
|
||||
/**
|
||||
* The animation classNames applied to the component as it enters, exits or has finished the transition.
|
||||
* A single name can be provided and it will be suffixed for each stage: e.g.
|
||||
*
|
||||
* `classNames="fade"` applies `fade-enter`, `fade-enter-active`, `fade-enter-done`,
|
||||
* `fade-exit`, `fade-exit-active`, `fade-exit-done`, `fade-appear`, and `fade-appear-active`.
|
||||
* Each individual classNames can also be specified independently like:
|
||||
*
|
||||
* ```js
|
||||
* classNames={{
|
||||
* appear: 'my-appear',
|
||||
* appearActive: 'my-active-appear',
|
||||
* enter: 'my-enter',
|
||||
* enterActive: 'my-active-enter',
|
||||
* enterDone: 'my-done-enter',
|
||||
* exit: 'my-exit',
|
||||
* exitActive: 'my-active-exit',
|
||||
* exitDone: 'my-done-exit',
|
||||
* }}
|
||||
* ```
|
||||
*
|
||||
* If you want to set these classes using CSS Modules:
|
||||
*
|
||||
* ```js
|
||||
* import styles from './styles.css';
|
||||
* ```
|
||||
*
|
||||
* you might want to use camelCase in your CSS file, that way could simply spread
|
||||
* them instead of listing them one by one:
|
||||
*
|
||||
* ```js
|
||||
* classNames={{ ...styles }}
|
||||
* ```
|
||||
*
|
||||
* @type {string | {
|
||||
* appear?: string,
|
||||
* appearActive?: string,
|
||||
* enter?: string,
|
||||
* enterActive?: string,
|
||||
* enterDone?: string,
|
||||
* exit?: string,
|
||||
* exitActive?: string,
|
||||
* exitDone?: string,
|
||||
* }}
|
||||
*/
|
||||
classNames: _PropTypes.classNamesShape,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
|
||||
* applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool)
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'enter-active' or
|
||||
* 'appear-active' class is applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool)
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'enter' or
|
||||
* 'appear' classes are **removed** and the `done` class is added to the DOM node.
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool)
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'exit' class is
|
||||
* applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement)
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'exit-active' is applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement
|
||||
*/
|
||||
onExiting: PropTypes.func,
|
||||
|
||||
/**
|
||||
* A `<Transition>` callback fired immediately after the 'exit' classes
|
||||
* are **removed** and the `exit-done` class is added to the DOM node.
|
||||
*
|
||||
* @type Function(node: HtmlElement)
|
||||
*/
|
||||
onExited: PropTypes.func
|
||||
}) : {};;
|
||||
/**
|
||||
* A `Transition` component using CSS transitions and animations.
|
||||
* It's inspired by the excellent [ng-animate](http://www.nganimate.org/) library.
|
||||
*
|
||||
* `CSSTransition` applies a pair of class names during the `appear`, `enter`,
|
||||
* and `exit` stages of the transition. The first class is applied and then a
|
||||
* second "active" class in order to activate the css animation. After the animation,
|
||||
* matching `done` class names are applied to persist the animation state.
|
||||
*
|
||||
* When the `in` prop is toggled to `true` the Component will get
|
||||
* the `example-enter` CSS class and the `example-enter-active` CSS class
|
||||
* added in the next tick. This is a convention based on the `classNames` prop.
|
||||
*/
|
||||
|
||||
var CSSTransition =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inheritsLoose(CSSTransition, _React$Component);
|
||||
|
||||
function CSSTransition() {
|
||||
var _this;
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
||||
|
||||
_this.onEnter = function (node, appearing) {
|
||||
var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
||||
className = _this$getClassNames.className;
|
||||
|
||||
_this.removeClasses(node, 'exit');
|
||||
|
||||
addClass(node, className);
|
||||
|
||||
if (_this.props.onEnter) {
|
||||
_this.props.onEnter(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onEntering = function (node, appearing) {
|
||||
var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
||||
activeClassName = _this$getClassNames2.activeClassName;
|
||||
|
||||
_this.reflowAndAddClass(node, activeClassName);
|
||||
|
||||
if (_this.props.onEntering) {
|
||||
_this.props.onEntering(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onEntered = function (node, appearing) {
|
||||
var _this$getClassNames3 = _this.getClassNames('enter'),
|
||||
doneClassName = _this$getClassNames3.doneClassName;
|
||||
|
||||
_this.removeClasses(node, appearing ? 'appear' : 'enter');
|
||||
|
||||
addClass(node, doneClassName);
|
||||
|
||||
if (_this.props.onEntered) {
|
||||
_this.props.onEntered(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onExit = function (node) {
|
||||
var _this$getClassNames4 = _this.getClassNames('exit'),
|
||||
className = _this$getClassNames4.className;
|
||||
|
||||
_this.removeClasses(node, 'appear');
|
||||
|
||||
_this.removeClasses(node, 'enter');
|
||||
|
||||
addClass(node, className);
|
||||
|
||||
if (_this.props.onExit) {
|
||||
_this.props.onExit(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onExiting = function (node) {
|
||||
var _this$getClassNames5 = _this.getClassNames('exit'),
|
||||
activeClassName = _this$getClassNames5.activeClassName;
|
||||
|
||||
_this.reflowAndAddClass(node, activeClassName);
|
||||
|
||||
if (_this.props.onExiting) {
|
||||
_this.props.onExiting(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onExited = function (node) {
|
||||
var _this$getClassNames6 = _this.getClassNames('exit'),
|
||||
doneClassName = _this$getClassNames6.doneClassName;
|
||||
|
||||
_this.removeClasses(node, 'exit');
|
||||
|
||||
addClass(node, doneClassName);
|
||||
|
||||
if (_this.props.onExited) {
|
||||
_this.props.onExited(node);
|
||||
}
|
||||
};
|
||||
|
||||
_this.getClassNames = function (type) {
|
||||
var classNames = _this.props.classNames;
|
||||
var className = typeof classNames !== 'string' ? classNames[type] : classNames + '-' + type;
|
||||
var activeClassName = typeof classNames !== 'string' ? classNames[type + 'Active'] : className + '-active';
|
||||
var doneClassName = typeof classNames !== 'string' ? classNames[type + 'Done'] : className + '-done';
|
||||
return {
|
||||
className: className,
|
||||
activeClassName: activeClassName,
|
||||
doneClassName: doneClassName
|
||||
};
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = CSSTransition.prototype;
|
||||
|
||||
_proto.removeClasses = function removeClasses(node, type) {
|
||||
var _this$getClassNames7 = this.getClassNames(type),
|
||||
className = _this$getClassNames7.className,
|
||||
activeClassName = _this$getClassNames7.activeClassName,
|
||||
doneClassName = _this$getClassNames7.doneClassName;
|
||||
|
||||
className && removeClass(node, className);
|
||||
activeClassName && removeClass(node, activeClassName);
|
||||
doneClassName && removeClass(node, doneClassName);
|
||||
};
|
||||
|
||||
_proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
|
||||
// This is for to force a repaint,
|
||||
// which is necessary in order to transition styles when adding a class name.
|
||||
if (className) {
|
||||
/* eslint-disable no-unused-expressions */
|
||||
node && node.scrollTop;
|
||||
/* eslint-enable no-unused-expressions */
|
||||
|
||||
addClass(node, className);
|
||||
}
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var props = _extends({}, this.props);
|
||||
|
||||
delete props.classNames;
|
||||
return _react.default.createElement(_Transition.default, _extends({}, props, {
|
||||
onEnter: this.onEnter,
|
||||
onEntered: this.onEntered,
|
||||
onEntering: this.onEntering,
|
||||
onExit: this.onExit,
|
||||
onExiting: this.onExiting,
|
||||
onExited: this.onExited
|
||||
}));
|
||||
};
|
||||
|
||||
return CSSTransition;
|
||||
}(_react.default.Component);
|
||||
|
||||
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
||||
var _default = CSSTransition;
|
||||
exports.default = _default;
|
||||
module.exports = exports["default"];
|
||||
30
node_modules/react-transition-group/LICENSE
generated
vendored
Normal file
30
node_modules/react-transition-group/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2016, React Community
|
||||
Forked from React (https://github.com/facebook/react) Copyright 2013-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
152
node_modules/react-transition-group/ReplaceTransition.js
generated
vendored
Normal file
152
node_modules/react-transition-group/ReplaceTransition.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _reactDom = require("react-dom");
|
||||
|
||||
var _TransitionGroup = _interopRequireDefault(require("./TransitionGroup"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
var propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
in: _propTypes.default.bool.isRequired,
|
||||
children: function children(props, propName) {
|
||||
if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
||||
return null;
|
||||
}
|
||||
} : {};;
|
||||
/**
|
||||
* The `<ReplaceTransition>` component is a specialized `Transition` component
|
||||
* that animates between two children.
|
||||
*
|
||||
* ```jsx
|
||||
* <ReplaceTransition in>
|
||||
* <Fade><div>I appear first</div></Fade>
|
||||
* <Fade><div>I replace the above</div></Fade>
|
||||
* </ReplaceTransition>
|
||||
* ```
|
||||
*/
|
||||
|
||||
var ReplaceTransition =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inheritsLoose(ReplaceTransition, _React$Component);
|
||||
|
||||
function ReplaceTransition() {
|
||||
var _this;
|
||||
|
||||
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
_args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
||||
|
||||
_this.handleEnter = function () {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onEnter', 0, args);
|
||||
};
|
||||
|
||||
_this.handleEntering = function () {
|
||||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
||||
args[_key3] = arguments[_key3];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onEntering', 0, args);
|
||||
};
|
||||
|
||||
_this.handleEntered = function () {
|
||||
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
||||
args[_key4] = arguments[_key4];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onEntered', 0, args);
|
||||
};
|
||||
|
||||
_this.handleExit = function () {
|
||||
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
||||
args[_key5] = arguments[_key5];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onExit', 1, args);
|
||||
};
|
||||
|
||||
_this.handleExiting = function () {
|
||||
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
||||
args[_key6] = arguments[_key6];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onExiting', 1, args);
|
||||
};
|
||||
|
||||
_this.handleExited = function () {
|
||||
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
||||
args[_key7] = arguments[_key7];
|
||||
}
|
||||
|
||||
return _this.handleLifecycle('onExited', 1, args);
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = ReplaceTransition.prototype;
|
||||
|
||||
_proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
||||
var _child$props;
|
||||
|
||||
var children = this.props.children;
|
||||
|
||||
var child = _react.default.Children.toArray(children)[idx];
|
||||
|
||||
if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
||||
if (this.props[handler]) this.props[handler]((0, _reactDom.findDOMNode)(this));
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var _this$props = this.props,
|
||||
children = _this$props.children,
|
||||
inProp = _this$props.in,
|
||||
props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
||||
|
||||
var _React$Children$toArr = _react.default.Children.toArray(children),
|
||||
first = _React$Children$toArr[0],
|
||||
second = _React$Children$toArr[1];
|
||||
|
||||
delete props.onEnter;
|
||||
delete props.onEntering;
|
||||
delete props.onEntered;
|
||||
delete props.onExit;
|
||||
delete props.onExiting;
|
||||
delete props.onExited;
|
||||
return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
|
||||
key: 'first',
|
||||
onEnter: this.handleEnter,
|
||||
onEntering: this.handleEntering,
|
||||
onEntered: this.handleEntered
|
||||
}) : _react.default.cloneElement(second, {
|
||||
key: 'second',
|
||||
onEnter: this.handleExit,
|
||||
onEntering: this.handleExiting,
|
||||
onEntered: this.handleExited
|
||||
}));
|
||||
};
|
||||
|
||||
return ReplaceTransition;
|
||||
}(_react.default.Component);
|
||||
|
||||
ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
||||
var _default = ReplaceTransition;
|
||||
exports.default = _default;
|
||||
module.exports = exports["default"];
|
||||
602
node_modules/react-transition-group/Transition.js
generated
vendored
Normal file
602
node_modules/react-transition-group/Transition.js
generated
vendored
Normal file
@@ -0,0 +1,602 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
|
||||
|
||||
var PropTypes = _interopRequireWildcard(require("prop-types"));
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
|
||||
var _reactLifecyclesCompat = require("react-lifecycles-compat");
|
||||
|
||||
var _PropTypes = require("./utils/PropTypes");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
var UNMOUNTED = 'unmounted';
|
||||
exports.UNMOUNTED = UNMOUNTED;
|
||||
var EXITED = 'exited';
|
||||
exports.EXITED = EXITED;
|
||||
var ENTERING = 'entering';
|
||||
exports.ENTERING = ENTERING;
|
||||
var ENTERED = 'entered';
|
||||
exports.ENTERED = ENTERED;
|
||||
var EXITING = 'exiting';
|
||||
/**
|
||||
* The Transition component lets you describe a transition from one component
|
||||
* state to another _over time_ with a simple declarative API. Most commonly
|
||||
* it's used to animate the mounting and unmounting of a component, but can also
|
||||
* be used to describe in-place transition states as well.
|
||||
*
|
||||
* By default the `Transition` component does not alter the behavior of the
|
||||
* component it renders, it only tracks "enter" and "exit" states for the components.
|
||||
* It's up to you to give meaning and effect to those states. For example we can
|
||||
* add styles to a component when it enters or exits:
|
||||
*
|
||||
* ```jsx
|
||||
* import Transition from 'react-transition-group/Transition';
|
||||
*
|
||||
* const duration = 300;
|
||||
*
|
||||
* const defaultStyle = {
|
||||
* transition: `opacity ${duration}ms ease-in-out`,
|
||||
* opacity: 0,
|
||||
* }
|
||||
*
|
||||
* const transitionStyles = {
|
||||
* entering: { opacity: 0 },
|
||||
* entered: { opacity: 1 },
|
||||
* };
|
||||
*
|
||||
* const Fade = ({ in: inProp }) => (
|
||||
* <Transition in={inProp} timeout={duration}>
|
||||
* {(state) => (
|
||||
* <div style={{
|
||||
* ...defaultStyle,
|
||||
* ...transitionStyles[state]
|
||||
* }}>
|
||||
* I'm a fade Transition!
|
||||
* </div>
|
||||
* )}
|
||||
* </Transition>
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* As noted the `Transition` component doesn't _do_ anything by itself to its child component.
|
||||
* What it does do is track transition states over time so you can update the
|
||||
* component (such as by adding styles or classes) when it changes states.
|
||||
*
|
||||
* There are 4 main states a Transition can be in:
|
||||
* - `'entering'`
|
||||
* - `'entered'`
|
||||
* - `'exiting'`
|
||||
* - `'exited'`
|
||||
*
|
||||
* Transition state is toggled via the `in` prop. When `true` the component begins the
|
||||
* "Enter" stage. During this stage, the component will shift from its current transition state,
|
||||
* to `'entering'` for the duration of the transition and then to the `'entered'` stage once
|
||||
* it's complete. Let's take the following example:
|
||||
*
|
||||
* ```jsx
|
||||
* state = { in: false };
|
||||
*
|
||||
* toggleEnterState = () => {
|
||||
* this.setState({ in: true });
|
||||
* }
|
||||
*
|
||||
* render() {
|
||||
* return (
|
||||
* <div>
|
||||
* <Transition in={this.state.in} timeout={500} />
|
||||
* <button onClick={this.toggleEnterState}>Click to Enter</button>
|
||||
* </div>
|
||||
* );
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When the button is clicked the component will shift to the `'entering'` state and
|
||||
* stay there for 500ms (the value of `timeout`) before it finally switches to `'entered'`.
|
||||
*
|
||||
* When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`.
|
||||
*
|
||||
* ## Timing
|
||||
*
|
||||
* Timing is often the trickiest part of animation, mistakes can result in slight delays
|
||||
* that are hard to pin down. A common example is when you want to add an exit transition,
|
||||
* you should set the desired final styles when the state is `'exiting'`. That's when the
|
||||
* transition to those styles will start and, if you matched the `timeout` prop with the
|
||||
* CSS Transition duration, it will end exactly when the state changes to `'exited'`.
|
||||
*
|
||||
* > **Note**: For simpler transitions the `Transition` component might be enough, but
|
||||
* > take into account that it's platform-agnostic, while the `CSSTransition` component
|
||||
* > [forces reflows](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
|
||||
* > in order to make more complex transitions more predictable. For example, even though
|
||||
* > classes `example-enter` and `example-enter-active` are applied immediately one after
|
||||
* > another, you can still transition from one to the other because of the forced reflow
|
||||
* > (read [this issue](https://github.com/reactjs/react-transition-group/issues/159#issuecomment-322761171)
|
||||
* > for more info). Take this into account when choosing between `Transition` and
|
||||
* > `CSSTransition`.
|
||||
*/
|
||||
|
||||
exports.EXITING = EXITING;
|
||||
|
||||
var Transition =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inheritsLoose(Transition, _React$Component);
|
||||
|
||||
function Transition(props, context) {
|
||||
var _this;
|
||||
|
||||
_this = _React$Component.call(this, props, context) || this;
|
||||
var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears
|
||||
|
||||
var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
||||
var initialStatus;
|
||||
_this.appearStatus = null;
|
||||
|
||||
if (props.in) {
|
||||
if (appear) {
|
||||
initialStatus = EXITED;
|
||||
_this.appearStatus = ENTERING;
|
||||
} else {
|
||||
initialStatus = ENTERED;
|
||||
}
|
||||
} else {
|
||||
if (props.unmountOnExit || props.mountOnEnter) {
|
||||
initialStatus = UNMOUNTED;
|
||||
} else {
|
||||
initialStatus = EXITED;
|
||||
}
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
status: initialStatus
|
||||
};
|
||||
_this.nextCallback = null;
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = Transition.prototype;
|
||||
|
||||
_proto.getChildContext = function getChildContext() {
|
||||
return {
|
||||
transitionGroup: null // allows for nested Transitions
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
||||
var nextIn = _ref.in;
|
||||
|
||||
if (nextIn && prevState.status === UNMOUNTED) {
|
||||
return {
|
||||
status: EXITED
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}; // getSnapshotBeforeUpdate(prevProps) {
|
||||
// let nextStatus = null
|
||||
// if (prevProps !== this.props) {
|
||||
// const { status } = this.state
|
||||
// if (this.props.in) {
|
||||
// if (status !== ENTERING && status !== ENTERED) {
|
||||
// nextStatus = ENTERING
|
||||
// }
|
||||
// } else {
|
||||
// if (status === ENTERING || status === ENTERED) {
|
||||
// nextStatus = EXITING
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return { nextStatus }
|
||||
// }
|
||||
|
||||
|
||||
_proto.componentDidMount = function componentDidMount() {
|
||||
this.updateStatus(true, this.appearStatus);
|
||||
};
|
||||
|
||||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
||||
var nextStatus = null;
|
||||
|
||||
if (prevProps !== this.props) {
|
||||
var status = this.state.status;
|
||||
|
||||
if (this.props.in) {
|
||||
if (status !== ENTERING && status !== ENTERED) {
|
||||
nextStatus = ENTERING;
|
||||
}
|
||||
} else {
|
||||
if (status === ENTERING || status === ENTERED) {
|
||||
nextStatus = EXITING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updateStatus(false, nextStatus);
|
||||
};
|
||||
|
||||
_proto.componentWillUnmount = function componentWillUnmount() {
|
||||
this.cancelNextCallback();
|
||||
};
|
||||
|
||||
_proto.getTimeouts = function getTimeouts() {
|
||||
var timeout = this.props.timeout;
|
||||
var exit, enter, appear;
|
||||
exit = enter = appear = timeout;
|
||||
|
||||
if (timeout != null && typeof timeout !== 'number') {
|
||||
exit = timeout.exit;
|
||||
enter = timeout.enter;
|
||||
appear = timeout.appear;
|
||||
}
|
||||
|
||||
return {
|
||||
exit: exit,
|
||||
enter: enter,
|
||||
appear: appear
|
||||
};
|
||||
};
|
||||
|
||||
_proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
||||
if (mounting === void 0) {
|
||||
mounting = false;
|
||||
}
|
||||
|
||||
if (nextStatus !== null) {
|
||||
// nextStatus will always be ENTERING or EXITING.
|
||||
this.cancelNextCallback();
|
||||
|
||||
var node = _reactDom.default.findDOMNode(this);
|
||||
|
||||
if (nextStatus === ENTERING) {
|
||||
this.performEnter(node, mounting);
|
||||
} else {
|
||||
this.performExit(node);
|
||||
}
|
||||
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
||||
this.setState({
|
||||
status: UNMOUNTED
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_proto.performEnter = function performEnter(node, mounting) {
|
||||
var _this2 = this;
|
||||
|
||||
var enter = this.props.enter;
|
||||
var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
|
||||
var timeouts = this.getTimeouts(); // no enter animation skip right to ENTERED
|
||||
// if we are mounting and running this it means appear _must_ be set
|
||||
|
||||
if (!mounting && !enter) {
|
||||
this.safeSetState({
|
||||
status: ENTERED
|
||||
}, function () {
|
||||
_this2.props.onEntered(node);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onEnter(node, appearing);
|
||||
this.safeSetState({
|
||||
status: ENTERING
|
||||
}, function () {
|
||||
_this2.props.onEntering(node, appearing); // FIXME: appear timeout?
|
||||
|
||||
|
||||
_this2.onTransitionEnd(node, timeouts.enter, function () {
|
||||
_this2.safeSetState({
|
||||
status: ENTERED
|
||||
}, function () {
|
||||
_this2.props.onEntered(node, appearing);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
_proto.performExit = function performExit(node) {
|
||||
var _this3 = this;
|
||||
|
||||
var exit = this.props.exit;
|
||||
var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED
|
||||
|
||||
if (!exit) {
|
||||
this.safeSetState({
|
||||
status: EXITED
|
||||
}, function () {
|
||||
_this3.props.onExited(node);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onExit(node);
|
||||
this.safeSetState({
|
||||
status: EXITING
|
||||
}, function () {
|
||||
_this3.props.onExiting(node);
|
||||
|
||||
_this3.onTransitionEnd(node, timeouts.exit, function () {
|
||||
_this3.safeSetState({
|
||||
status: EXITED
|
||||
}, function () {
|
||||
_this3.props.onExited(node);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
_proto.cancelNextCallback = function cancelNextCallback() {
|
||||
if (this.nextCallback !== null) {
|
||||
this.nextCallback.cancel();
|
||||
this.nextCallback = null;
|
||||
}
|
||||
};
|
||||
|
||||
_proto.safeSetState = function safeSetState(nextState, callback) {
|
||||
// This shouldn't be necessary, but there are weird race conditions with
|
||||
// setState callbacks and unmounting in testing, so always make sure that
|
||||
// we can cancel any pending setState callbacks after we unmount.
|
||||
callback = this.setNextCallback(callback);
|
||||
this.setState(nextState, callback);
|
||||
};
|
||||
|
||||
_proto.setNextCallback = function setNextCallback(callback) {
|
||||
var _this4 = this;
|
||||
|
||||
var active = true;
|
||||
|
||||
this.nextCallback = function (event) {
|
||||
if (active) {
|
||||
active = false;
|
||||
_this4.nextCallback = null;
|
||||
callback(event);
|
||||
}
|
||||
};
|
||||
|
||||
this.nextCallback.cancel = function () {
|
||||
active = false;
|
||||
};
|
||||
|
||||
return this.nextCallback;
|
||||
};
|
||||
|
||||
_proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
||||
this.setNextCallback(handler);
|
||||
|
||||
if (node) {
|
||||
if (this.props.addEndListener) {
|
||||
this.props.addEndListener(node, this.nextCallback);
|
||||
}
|
||||
|
||||
if (timeout != null) {
|
||||
setTimeout(this.nextCallback, timeout);
|
||||
}
|
||||
} else {
|
||||
setTimeout(this.nextCallback, 0);
|
||||
}
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var status = this.state.status;
|
||||
|
||||
if (status === UNMOUNTED) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var _this$props = this.props,
|
||||
children = _this$props.children,
|
||||
childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]); // filter props for Transtition
|
||||
|
||||
|
||||
delete childProps.in;
|
||||
delete childProps.mountOnEnter;
|
||||
delete childProps.unmountOnExit;
|
||||
delete childProps.appear;
|
||||
delete childProps.enter;
|
||||
delete childProps.exit;
|
||||
delete childProps.timeout;
|
||||
delete childProps.addEndListener;
|
||||
delete childProps.onEnter;
|
||||
delete childProps.onEntering;
|
||||
delete childProps.onEntered;
|
||||
delete childProps.onExit;
|
||||
delete childProps.onExiting;
|
||||
delete childProps.onExited;
|
||||
|
||||
if (typeof children === 'function') {
|
||||
return children(status, childProps);
|
||||
}
|
||||
|
||||
var child = _react.default.Children.only(children);
|
||||
|
||||
return _react.default.cloneElement(child, childProps);
|
||||
};
|
||||
|
||||
return Transition;
|
||||
}(_react.default.Component);
|
||||
|
||||
Transition.contextTypes = {
|
||||
transitionGroup: PropTypes.object
|
||||
};
|
||||
Transition.childContextTypes = {
|
||||
transitionGroup: function transitionGroup() {}
|
||||
};
|
||||
Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* A `function` child can be used instead of a React element.
|
||||
* This function is called with the current transition status
|
||||
* ('entering', 'entered', 'exiting', 'exited', 'unmounted'), which can be used
|
||||
* to apply context specific props to a component.
|
||||
*
|
||||
* ```jsx
|
||||
* <Transition timeout={150}>
|
||||
* {(status) => (
|
||||
* <MyComponent className={`fade fade-${status}`} />
|
||||
* )}
|
||||
* </Transition>
|
||||
* ```
|
||||
*/
|
||||
children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
||||
|
||||
/**
|
||||
* Show the component; triggers the enter or exit states
|
||||
*/
|
||||
in: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* By default the child component is mounted immediately along with
|
||||
* the parent `Transition` component. If you want to "lazy mount" the component on the
|
||||
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
|
||||
* mounted, even on "exited", unless you also specify `unmountOnExit`.
|
||||
*/
|
||||
mountOnEnter: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* By default the child component stays mounted after it reaches the `'exited'` state.
|
||||
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
|
||||
*/
|
||||
unmountOnExit: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Normally a component is not transitioned if it is shown when the `<Transition>` component mounts.
|
||||
* If you want to transition on the first mount set `appear` to `true`, and the
|
||||
* component will transition in as soon as the `<Transition>` mounts.
|
||||
*
|
||||
* > Note: there are no specific "appear" states. `appear` only adds an additional `enter` transition.
|
||||
*/
|
||||
appear: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Enable or disable enter transitions.
|
||||
*/
|
||||
enter: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Enable or disable exit transitions.
|
||||
*/
|
||||
exit: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* The duration of the transition, in milliseconds.
|
||||
* Required unless `addEndListener` is provided
|
||||
*
|
||||
* You may specify a single timeout for all transitions like: `timeout={500}`,
|
||||
* or individually like:
|
||||
*
|
||||
* ```jsx
|
||||
* timeout={{
|
||||
* enter: 300,
|
||||
* exit: 500,
|
||||
* }}
|
||||
* ```
|
||||
*
|
||||
* @type {number | { enter?: number, exit?: number }}
|
||||
*/
|
||||
timeout: function timeout(props) {
|
||||
var pt = process.env.NODE_ENV !== "production" ? _PropTypes.timeoutsShape : {};;
|
||||
if (!props.addEndListener) pt = pt.isRequired;
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return pt.apply(void 0, [props].concat(args));
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a custom transition end trigger. Called with the transitioning
|
||||
* DOM node and a `done` callback. Allows for more fine grained transition end
|
||||
* logic. **Note:** Timeouts are still used as a fallback if provided.
|
||||
*
|
||||
* ```jsx
|
||||
* addEndListener={(node, done) => {
|
||||
* // use the css transitionend event to mark the finish of a transition
|
||||
* node.addEventListener('transitionend', done, false);
|
||||
* }}
|
||||
* ```
|
||||
*/
|
||||
addEndListener: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired before the "entering" status is applied. An extra parameter
|
||||
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
||||
*/
|
||||
onEnter: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired after the "entering" status is applied. An extra parameter
|
||||
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool)
|
||||
*/
|
||||
onEntering: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired after the "entered" status is applied. An extra parameter
|
||||
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
||||
*
|
||||
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
||||
*/
|
||||
onEntered: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired before the "exiting" status is applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement) -> void
|
||||
*/
|
||||
onExit: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired after the "exiting" status is applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement) -> void
|
||||
*/
|
||||
onExiting: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Callback fired after the "exited" status is applied.
|
||||
*
|
||||
* @type Function(node: HtmlElement) -> void
|
||||
*/
|
||||
onExited: PropTypes.func // Name the function so it is clearer in the documentation
|
||||
|
||||
} : {};
|
||||
|
||||
function noop() {}
|
||||
|
||||
Transition.defaultProps = {
|
||||
in: false,
|
||||
mountOnEnter: false,
|
||||
unmountOnExit: false,
|
||||
appear: false,
|
||||
enter: true,
|
||||
exit: true,
|
||||
onEnter: noop,
|
||||
onEntering: noop,
|
||||
onEntered: noop,
|
||||
onExit: noop,
|
||||
onExiting: noop,
|
||||
onExited: noop
|
||||
};
|
||||
Transition.UNMOUNTED = 0;
|
||||
Transition.EXITED = 1;
|
||||
Transition.ENTERING = 2;
|
||||
Transition.ENTERED = 3;
|
||||
Transition.EXITING = 4;
|
||||
|
||||
var _default = (0, _reactLifecyclesCompat.polyfill)(Transition);
|
||||
|
||||
exports.default = _default;
|
||||
195
node_modules/react-transition-group/TransitionGroup.js
generated
vendored
Normal file
195
node_modules/react-transition-group/TransitionGroup.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _reactLifecyclesCompat = require("react-lifecycles-compat");
|
||||
|
||||
var _ChildMapping = require("./utils/ChildMapping");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
var values = Object.values || function (obj) {
|
||||
return Object.keys(obj).map(function (k) {
|
||||
return obj[k];
|
||||
});
|
||||
};
|
||||
|
||||
var propTypes = process.env.NODE_ENV !== "production" ? {
|
||||
/**
|
||||
* `<TransitionGroup>` renders a `<div>` by default. You can change this
|
||||
* behavior by providing a `component` prop.
|
||||
* If you use React v16+ and would like to avoid a wrapping `<div>` element
|
||||
* you can pass in `component={null}`. This is useful if the wrapping div
|
||||
* borks your css styles.
|
||||
*/
|
||||
component: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* A set of `<Transition>` components, that are toggled `in` and out as they
|
||||
* leave. the `<TransitionGroup>` will inject specific transition props, so
|
||||
* remember to spread them through if you are wrapping the `<Transition>` as
|
||||
* with our `<Fade>` example.
|
||||
*/
|
||||
children: _propTypes.default.node,
|
||||
|
||||
/**
|
||||
* A convenience prop that enables or disables appear animations
|
||||
* for all children. Note that specifying this will override any defaults set
|
||||
* on individual children Transitions.
|
||||
*/
|
||||
appear: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* A convenience prop that enables or disables enter animations
|
||||
* for all children. Note that specifying this will override any defaults set
|
||||
* on individual children Transitions.
|
||||
*/
|
||||
enter: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* A convenience prop that enables or disables exit animations
|
||||
* for all children. Note that specifying this will override any defaults set
|
||||
* on individual children Transitions.
|
||||
*/
|
||||
exit: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* You may need to apply reactive updates to a child as it is exiting.
|
||||
* This is generally done by using `cloneElement` however in the case of an exiting
|
||||
* child the element has already been removed and not accessible to the consumer.
|
||||
*
|
||||
* If you do need to update a child as it leaves you can provide a `childFactory`
|
||||
* to wrap every child, even the ones that are leaving.
|
||||
*
|
||||
* @type Function(child: ReactElement) -> ReactElement
|
||||
*/
|
||||
childFactory: _propTypes.default.func
|
||||
} : {};;
|
||||
var defaultProps = {
|
||||
component: 'div',
|
||||
childFactory: function childFactory(child) {
|
||||
return child;
|
||||
}
|
||||
/**
|
||||
* The `<TransitionGroup>` component manages a set of transition components
|
||||
* (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
|
||||
* components, `<TransitionGroup>` is a state machine for managing the mounting
|
||||
* and unmounting of components over time.
|
||||
*
|
||||
* Consider the example below. As items are removed or added to the TodoList the
|
||||
* `in` prop is toggled automatically by the `<TransitionGroup>`.
|
||||
*
|
||||
* Note that `<TransitionGroup>` does not define any animation behavior!
|
||||
* Exactly _how_ a list item animates is up to the individual transition
|
||||
* component. This means you can mix and match animations across different list
|
||||
* items.
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
var TransitionGroup =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inheritsLoose(TransitionGroup, _React$Component);
|
||||
|
||||
function TransitionGroup(props, context) {
|
||||
var _this;
|
||||
|
||||
_this = _React$Component.call(this, props, context) || this;
|
||||
|
||||
var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this))); // Initial children should all be entering, dependent on appear
|
||||
|
||||
|
||||
_this.state = {
|
||||
handleExited: handleExited,
|
||||
firstRender: true
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = TransitionGroup.prototype;
|
||||
|
||||
_proto.getChildContext = function getChildContext() {
|
||||
return {
|
||||
transitionGroup: {
|
||||
isMounting: !this.appeared
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_proto.componentDidMount = function componentDidMount() {
|
||||
this.appeared = true;
|
||||
};
|
||||
|
||||
TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
||||
var prevChildMapping = _ref.children,
|
||||
handleExited = _ref.handleExited,
|
||||
firstRender = _ref.firstRender;
|
||||
return {
|
||||
children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
|
||||
firstRender: false
|
||||
};
|
||||
};
|
||||
|
||||
_proto.handleExited = function handleExited(child, node) {
|
||||
var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children);
|
||||
if (child.key in currentChildMapping) return;
|
||||
|
||||
if (child.props.onExited) {
|
||||
child.props.onExited(node);
|
||||
}
|
||||
|
||||
this.setState(function (state) {
|
||||
var children = _extends({}, state.children);
|
||||
|
||||
delete children[child.key];
|
||||
return {
|
||||
children: children
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var _this$props = this.props,
|
||||
Component = _this$props.component,
|
||||
childFactory = _this$props.childFactory,
|
||||
props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
||||
|
||||
var children = values(this.state.children).map(childFactory);
|
||||
delete props.appear;
|
||||
delete props.enter;
|
||||
delete props.exit;
|
||||
|
||||
if (Component === null) {
|
||||
return children;
|
||||
}
|
||||
|
||||
return _react.default.createElement(Component, props, children);
|
||||
};
|
||||
|
||||
return TransitionGroup;
|
||||
}(_react.default.Component);
|
||||
|
||||
TransitionGroup.childContextTypes = {
|
||||
transitionGroup: _propTypes.default.object.isRequired
|
||||
};
|
||||
TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
||||
TransitionGroup.defaultProps = defaultProps;
|
||||
|
||||
var _default = (0, _reactLifecyclesCompat.polyfill)(TransitionGroup);
|
||||
|
||||
exports.default = _default;
|
||||
module.exports = exports["default"];
|
||||
1
node_modules/react-transition-group/dist/react-transition-group.js
generated
vendored
Normal file
1
node_modules/react-transition-group/dist/react-transition-group.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/react-transition-group/index.js
generated
vendored
Normal file
18
node_modules/react-transition-group/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
var _CSSTransition = _interopRequireDefault(require("./CSSTransition"));
|
||||
|
||||
var _ReplaceTransition = _interopRequireDefault(require("./ReplaceTransition"));
|
||||
|
||||
var _TransitionGroup = _interopRequireDefault(require("./TransitionGroup"));
|
||||
|
||||
var _Transition = _interopRequireDefault(require("./Transition"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
Transition: _Transition.default,
|
||||
TransitionGroup: _TransitionGroup.default,
|
||||
ReplaceTransition: _ReplaceTransition.default,
|
||||
CSSTransition: _CSSTransition.default
|
||||
};
|
||||
37
node_modules/react-transition-group/package.json
generated
vendored
Normal file
37
node_modules/react-transition-group/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "react-transition-group",
|
||||
"version": "2.5.0",
|
||||
"description": "A react component toolset for managing animations",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactjs/react-transition-group.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "BSD-3-Clause",
|
||||
"homepage": "https://github.com/reactjs/react-transition-group#readme",
|
||||
"jest": {
|
||||
"testRegex": "-test\\.js",
|
||||
"setupFiles": [
|
||||
"./test/setup.js"
|
||||
],
|
||||
"roots": [
|
||||
"<rootDir>/test"
|
||||
]
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=15.0.0",
|
||||
"react-dom": ">=15.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"dom-helpers": "^3.3.1",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
"loose-envify"
|
||||
]
|
||||
}
|
||||
}
|
||||
150
node_modules/react-transition-group/utils/ChildMapping.js
generated
vendored
Normal file
150
node_modules/react-transition-group/utils/ChildMapping.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.getChildMapping = getChildMapping;
|
||||
exports.mergeChildMappings = mergeChildMappings;
|
||||
exports.getInitialChildMapping = getInitialChildMapping;
|
||||
exports.getNextChildMapping = getNextChildMapping;
|
||||
|
||||
var _react = require("react");
|
||||
|
||||
/**
|
||||
* Given `this.props.children`, return an object mapping key to child.
|
||||
*
|
||||
* @param {*} children `this.props.children`
|
||||
* @return {object} Mapping of key to child
|
||||
*/
|
||||
function getChildMapping(children, mapFn) {
|
||||
var mapper = function mapper(child) {
|
||||
return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
|
||||
};
|
||||
|
||||
var result = Object.create(null);
|
||||
if (children) _react.Children.map(children, function (c) {
|
||||
return c;
|
||||
}).forEach(function (child) {
|
||||
// run the map function here instead so that the key is the computed one
|
||||
result[child.key] = mapper(child);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* When you're adding or removing children some may be added or removed in the
|
||||
* same render pass. We want to show *both* since we want to simultaneously
|
||||
* animate elements in and out. This function takes a previous set of keys
|
||||
* and a new set of keys and merges them with its best guess of the correct
|
||||
* ordering. In the future we may expose some of the utilities in
|
||||
* ReactMultiChild to make this easy, but for now React itself does not
|
||||
* directly have this concept of the union of prevChildren and nextChildren
|
||||
* so we implement it here.
|
||||
*
|
||||
* @param {object} prev prev children as returned from
|
||||
* `ReactTransitionChildMapping.getChildMapping()`.
|
||||
* @param {object} next next children as returned from
|
||||
* `ReactTransitionChildMapping.getChildMapping()`.
|
||||
* @return {object} a key set that contains all keys in `prev` and all keys
|
||||
* in `next` in a reasonable order.
|
||||
*/
|
||||
|
||||
|
||||
function mergeChildMappings(prev, next) {
|
||||
prev = prev || {};
|
||||
next = next || {};
|
||||
|
||||
function getValueForKey(key) {
|
||||
return key in next ? next[key] : prev[key];
|
||||
} // For each key of `next`, the list of keys to insert before that key in
|
||||
// the combined list
|
||||
|
||||
|
||||
var nextKeysPending = Object.create(null);
|
||||
var pendingKeys = [];
|
||||
|
||||
for (var prevKey in prev) {
|
||||
if (prevKey in next) {
|
||||
if (pendingKeys.length) {
|
||||
nextKeysPending[prevKey] = pendingKeys;
|
||||
pendingKeys = [];
|
||||
}
|
||||
} else {
|
||||
pendingKeys.push(prevKey);
|
||||
}
|
||||
}
|
||||
|
||||
var i;
|
||||
var childMapping = {};
|
||||
|
||||
for (var nextKey in next) {
|
||||
if (nextKeysPending[nextKey]) {
|
||||
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
||||
var pendingNextKey = nextKeysPending[nextKey][i];
|
||||
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
||||
}
|
||||
}
|
||||
|
||||
childMapping[nextKey] = getValueForKey(nextKey);
|
||||
} // Finally, add the keys which didn't appear before any key in `next`
|
||||
|
||||
|
||||
for (i = 0; i < pendingKeys.length; i++) {
|
||||
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
||||
}
|
||||
|
||||
return childMapping;
|
||||
}
|
||||
|
||||
function getProp(child, prop, props) {
|
||||
return props[prop] != null ? props[prop] : child.props[prop];
|
||||
}
|
||||
|
||||
function getInitialChildMapping(props, onExited) {
|
||||
return getChildMapping(props.children, function (child) {
|
||||
return (0, _react.cloneElement)(child, {
|
||||
onExited: onExited.bind(null, child),
|
||||
in: true,
|
||||
appear: getProp(child, 'appear', props),
|
||||
enter: getProp(child, 'enter', props),
|
||||
exit: getProp(child, 'exit', props)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
||||
var nextChildMapping = getChildMapping(nextProps.children);
|
||||
var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
||||
Object.keys(children).forEach(function (key) {
|
||||
var child = children[key];
|
||||
if (!(0, _react.isValidElement)(child)) return;
|
||||
var hasPrev = key in prevChildMapping;
|
||||
var hasNext = key in nextChildMapping;
|
||||
var prevChild = prevChildMapping[key];
|
||||
var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering)
|
||||
|
||||
if (hasNext && (!hasPrev || isLeaving)) {
|
||||
// console.log('entering', key)
|
||||
children[key] = (0, _react.cloneElement)(child, {
|
||||
onExited: onExited.bind(null, child),
|
||||
in: true,
|
||||
exit: getProp(child, 'exit', nextProps),
|
||||
enter: getProp(child, 'enter', nextProps)
|
||||
});
|
||||
} else if (!hasNext && hasPrev && !isLeaving) {
|
||||
// item is old (exiting)
|
||||
// console.log('leaving', key)
|
||||
children[key] = (0, _react.cloneElement)(child, {
|
||||
in: false
|
||||
});
|
||||
} else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
|
||||
// item hasn't changed transition states
|
||||
// copy over the last transition props;
|
||||
// console.log('unchanged', key)
|
||||
children[key] = (0, _react.cloneElement)(child, {
|
||||
onExited: onExited.bind(null, child),
|
||||
in: prevChild.props.in,
|
||||
exit: getProp(child, 'exit', nextProps),
|
||||
enter: getProp(child, 'enter', nextProps)
|
||||
});
|
||||
}
|
||||
});
|
||||
return children;
|
||||
}
|
||||
49
node_modules/react-transition-group/utils/PropTypes.js
generated
vendored
Normal file
49
node_modules/react-transition-group/utils/PropTypes.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.transitionTimeout = transitionTimeout;
|
||||
exports.classNamesShape = exports.timeoutsShape = void 0;
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function transitionTimeout(transitionType) {
|
||||
var timeoutPropName = 'transition' + transitionType + 'Timeout';
|
||||
var enabledPropName = 'transition' + transitionType;
|
||||
return function (props) {
|
||||
// If the transition is enabled
|
||||
if (props[enabledPropName]) {
|
||||
// If no timeout duration is provided
|
||||
if (props[timeoutPropName] == null) {
|
||||
return new Error(timeoutPropName + ' wasn\'t supplied to CSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); // If the duration isn't a number
|
||||
} else if (typeof props[timeoutPropName] !== 'number') {
|
||||
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var timeoutsShape = _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
||||
enter: _propTypes.default.number,
|
||||
exit: _propTypes.default.number
|
||||
}).isRequired]);
|
||||
|
||||
exports.timeoutsShape = timeoutsShape;
|
||||
|
||||
var classNamesShape = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
||||
enter: _propTypes.default.string,
|
||||
exit: _propTypes.default.string,
|
||||
active: _propTypes.default.string
|
||||
}), _propTypes.default.shape({
|
||||
enter: _propTypes.default.string,
|
||||
enterDone: _propTypes.default.string,
|
||||
enterActive: _propTypes.default.string,
|
||||
exit: _propTypes.default.string,
|
||||
exitDone: _propTypes.default.string,
|
||||
exitActive: _propTypes.default.string
|
||||
})]);
|
||||
|
||||
exports.classNamesShape = classNamesShape;
|
||||
39
node_modules/react-transition-group/utils/SimpleSet.js
generated
vendored
Normal file
39
node_modules/react-transition-group/utils/SimpleSet.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var SimpleSet =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function SimpleSet() {
|
||||
this.v = [];
|
||||
}
|
||||
|
||||
var _proto = SimpleSet.prototype;
|
||||
|
||||
_proto.clear = function clear() {
|
||||
this.v.length = 0;
|
||||
};
|
||||
|
||||
_proto.has = function has(k) {
|
||||
return this.v.indexOf(k) !== -1;
|
||||
};
|
||||
|
||||
_proto.add = function add(k) {
|
||||
if (this.has(k)) return;
|
||||
this.v.push(k);
|
||||
};
|
||||
|
||||
_proto.delete = function _delete(k) {
|
||||
var idx = this.v.indexOf(k);
|
||||
if (idx === -1) return false;
|
||||
this.v.splice(idx, 1);
|
||||
return true;
|
||||
};
|
||||
|
||||
return SimpleSet;
|
||||
}();
|
||||
|
||||
exports.default = SimpleSet;
|
||||
module.exports = exports["default"];
|
||||
Reference in New Issue
Block a user