1270 lines
46 KiB
JavaScript
1270 lines
46 KiB
JavaScript
import {
|
|
_extends,
|
|
_objectWithoutPropertiesLoose,
|
|
init_extends,
|
|
require_prop_types
|
|
} from "./chunk-RIUOJBJ7.js";
|
|
import {
|
|
require_react_dom
|
|
} from "./chunk-UPELNCPK.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-BG45W2ER.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-HXA6O6EE.js";
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
function _setPrototypeOf(t, e) {
|
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
|
|
return t2.__proto__ = e2, t2;
|
|
}, _setPrototypeOf(t, e);
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
function _inheritsLoose(t, o) {
|
|
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
}
|
|
|
|
// node_modules/react-transition-group/esm/Transition.js
|
|
var import_prop_types2 = __toESM(require_prop_types());
|
|
var import_react2 = __toESM(require_react());
|
|
var import_react_dom = __toESM(require_react_dom());
|
|
|
|
// node_modules/react-transition-group/esm/config.js
|
|
var config_default = {
|
|
disabled: false
|
|
};
|
|
|
|
// node_modules/react-transition-group/esm/utils/PropTypes.js
|
|
var import_prop_types = __toESM(require_prop_types());
|
|
var timeoutsShape = true ? import_prop_types.default.oneOfType([import_prop_types.default.number, import_prop_types.default.shape({
|
|
enter: import_prop_types.default.number,
|
|
exit: import_prop_types.default.number,
|
|
appear: import_prop_types.default.number
|
|
}).isRequired]) : null;
|
|
var classNamesShape = true ? import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.shape({
|
|
enter: import_prop_types.default.string,
|
|
exit: import_prop_types.default.string,
|
|
active: import_prop_types.default.string
|
|
}), import_prop_types.default.shape({
|
|
enter: import_prop_types.default.string,
|
|
enterDone: import_prop_types.default.string,
|
|
enterActive: import_prop_types.default.string,
|
|
exit: import_prop_types.default.string,
|
|
exitDone: import_prop_types.default.string,
|
|
exitActive: import_prop_types.default.string
|
|
})]) : null;
|
|
|
|
// node_modules/react-transition-group/esm/TransitionGroupContext.js
|
|
var import_react = __toESM(require_react());
|
|
var TransitionGroupContext_default = import_react.default.createContext(null);
|
|
|
|
// node_modules/react-transition-group/esm/utils/reflow.js
|
|
var forceReflow = function forceReflow2(node) {
|
|
return node.scrollTop;
|
|
};
|
|
|
|
// node_modules/react-transition-group/esm/Transition.js
|
|
var UNMOUNTED = "unmounted";
|
|
var EXITED = "exited";
|
|
var ENTERING = "entering";
|
|
var ENTERED = "entered";
|
|
var EXITING = "exiting";
|
|
var Transition = function(_React$Component) {
|
|
_inheritsLoose(Transition2, _React$Component);
|
|
function Transition2(props, context) {
|
|
var _this;
|
|
_this = _React$Component.call(this, props, context) || this;
|
|
var parentGroup = context;
|
|
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;
|
|
}
|
|
Transition2.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
|
var nextIn = _ref.in;
|
|
if (nextIn && prevState.status === UNMOUNTED) {
|
|
return {
|
|
status: EXITED
|
|
};
|
|
}
|
|
return null;
|
|
};
|
|
var _proto = Transition2.prototype;
|
|
_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 timeout2 = this.props.timeout;
|
|
var exit, enter, appear;
|
|
exit = enter = appear = timeout2;
|
|
if (timeout2 != null && typeof timeout2 !== "number") {
|
|
exit = timeout2.exit;
|
|
enter = timeout2.enter;
|
|
appear = timeout2.appear !== void 0 ? timeout2.appear : enter;
|
|
}
|
|
return {
|
|
exit,
|
|
enter,
|
|
appear
|
|
};
|
|
};
|
|
_proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
|
if (mounting === void 0) {
|
|
mounting = false;
|
|
}
|
|
if (nextStatus !== null) {
|
|
this.cancelNextCallback();
|
|
if (nextStatus === ENTERING) {
|
|
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
var node = this.props.nodeRef ? this.props.nodeRef.current : import_react_dom.default.findDOMNode(this);
|
|
if (node) forceReflow(node);
|
|
}
|
|
this.performEnter(mounting);
|
|
} else {
|
|
this.performExit();
|
|
}
|
|
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
|
this.setState({
|
|
status: UNMOUNTED
|
|
});
|
|
}
|
|
};
|
|
_proto.performEnter = function performEnter(mounting) {
|
|
var _this2 = this;
|
|
var enter = this.props.enter;
|
|
var appearing = this.context ? this.context.isMounting : mounting;
|
|
var _ref2 = this.props.nodeRef ? [appearing] : [import_react_dom.default.findDOMNode(this), appearing], maybeNode = _ref2[0], maybeAppearing = _ref2[1];
|
|
var timeouts = this.getTimeouts();
|
|
var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
|
if (!mounting && !enter || config_default.disabled) {
|
|
this.safeSetState({
|
|
status: ENTERED
|
|
}, function() {
|
|
_this2.props.onEntered(maybeNode);
|
|
});
|
|
return;
|
|
}
|
|
this.props.onEnter(maybeNode, maybeAppearing);
|
|
this.safeSetState({
|
|
status: ENTERING
|
|
}, function() {
|
|
_this2.props.onEntering(maybeNode, maybeAppearing);
|
|
_this2.onTransitionEnd(enterTimeout, function() {
|
|
_this2.safeSetState({
|
|
status: ENTERED
|
|
}, function() {
|
|
_this2.props.onEntered(maybeNode, maybeAppearing);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
_proto.performExit = function performExit() {
|
|
var _this3 = this;
|
|
var exit = this.props.exit;
|
|
var timeouts = this.getTimeouts();
|
|
var maybeNode = this.props.nodeRef ? void 0 : import_react_dom.default.findDOMNode(this);
|
|
if (!exit || config_default.disabled) {
|
|
this.safeSetState({
|
|
status: EXITED
|
|
}, function() {
|
|
_this3.props.onExited(maybeNode);
|
|
});
|
|
return;
|
|
}
|
|
this.props.onExit(maybeNode);
|
|
this.safeSetState({
|
|
status: EXITING
|
|
}, function() {
|
|
_this3.props.onExiting(maybeNode);
|
|
_this3.onTransitionEnd(timeouts.exit, function() {
|
|
_this3.safeSetState({
|
|
status: EXITED
|
|
}, function() {
|
|
_this3.props.onExited(maybeNode);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
_proto.cancelNextCallback = function cancelNextCallback() {
|
|
if (this.nextCallback !== null) {
|
|
this.nextCallback.cancel();
|
|
this.nextCallback = null;
|
|
}
|
|
};
|
|
_proto.safeSetState = function safeSetState(nextState, callback) {
|
|
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(timeout2, handler) {
|
|
this.setNextCallback(handler);
|
|
var node = this.props.nodeRef ? this.props.nodeRef.current : import_react_dom.default.findDOMNode(this);
|
|
var doesNotHaveTimeoutOrListener = timeout2 == null && !this.props.addEndListener;
|
|
if (!node || doesNotHaveTimeoutOrListener) {
|
|
setTimeout(this.nextCallback, 0);
|
|
return;
|
|
}
|
|
if (this.props.addEndListener) {
|
|
var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], maybeNode = _ref3[0], maybeNextCallback = _ref3[1];
|
|
this.props.addEndListener(maybeNode, maybeNextCallback);
|
|
}
|
|
if (timeout2 != null) {
|
|
setTimeout(this.nextCallback, timeout2);
|
|
}
|
|
};
|
|
_proto.render = function render() {
|
|
var status = this.state.status;
|
|
if (status === UNMOUNTED) {
|
|
return null;
|
|
}
|
|
var _this$props = this.props, children2 = _this$props.children, _in = _this$props.in, _mountOnEnter = _this$props.mountOnEnter, _unmountOnExit = _this$props.unmountOnExit, _appear = _this$props.appear, _enter = _this$props.enter, _exit = _this$props.exit, _timeout = _this$props.timeout, _addEndListener = _this$props.addEndListener, _onEnter = _this$props.onEnter, _onEntering = _this$props.onEntering, _onEntered = _this$props.onEntered, _onExit = _this$props.onExit, _onExiting = _this$props.onExiting, _onExited = _this$props.onExited, _nodeRef = _this$props.nodeRef, childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
|
|
return (
|
|
// allows for nested Transitions
|
|
import_react2.default.createElement(TransitionGroupContext_default.Provider, {
|
|
value: null
|
|
}, typeof children2 === "function" ? children2(status, childProps) : import_react2.default.cloneElement(import_react2.default.Children.only(children2), childProps))
|
|
);
|
|
};
|
|
return Transition2;
|
|
}(import_react2.default.Component);
|
|
Transition.contextType = TransitionGroupContext_default;
|
|
Transition.propTypes = true ? {
|
|
/**
|
|
* A React reference to DOM element that need to transition:
|
|
* https://stackoverflow.com/a/51127130/4671932
|
|
*
|
|
* - When `nodeRef` prop is used, `node` is not passed to callback functions
|
|
* (e.g. `onEnter`) because user already has direct access to the node.
|
|
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
|
|
* `nodeRef` need to be provided to `Transition` with changed `key` prop
|
|
* (see
|
|
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
|
|
*/
|
|
nodeRef: import_prop_types2.default.shape({
|
|
current: typeof Element === "undefined" ? import_prop_types2.default.any : function(propValue, key, componentName, location, propFullName, secret) {
|
|
var value = propValue[key];
|
|
return import_prop_types2.default.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
|
|
}
|
|
}),
|
|
/**
|
|
* A `function` child can be used instead of a React element. This function is
|
|
* called with the current transition status (`'entering'`, `'entered'`,
|
|
* `'exiting'`, `'exited'`), which can be used to apply context
|
|
* specific props to a component.
|
|
*
|
|
* ```jsx
|
|
* <Transition in={this.state.in} timeout={150}>
|
|
* {state => (
|
|
* <MyComponent className={`fade fade-${state}`} />
|
|
* )}
|
|
* </Transition>
|
|
* ```
|
|
*/
|
|
children: import_prop_types2.default.oneOfType([import_prop_types2.default.func.isRequired, import_prop_types2.default.element.isRequired]).isRequired,
|
|
/**
|
|
* Show the component; triggers the enter or exit states
|
|
*/
|
|
in: import_prop_types2.default.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: import_prop_types2.default.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: import_prop_types2.default.bool,
|
|
/**
|
|
* By default the child component does not perform the enter transition when
|
|
* it first mounts, regardless of the value of `in`. If you want this
|
|
* behavior, set both `appear` and `in` to `true`.
|
|
*
|
|
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
|
|
* > only adds an additional enter transition. However, in the
|
|
* > `<CSSTransition>` component that first enter transition does result in
|
|
* > additional `.appear-*` classes, that way you can choose to style it
|
|
* > differently.
|
|
*/
|
|
appear: import_prop_types2.default.bool,
|
|
/**
|
|
* Enable or disable enter transitions.
|
|
*/
|
|
enter: import_prop_types2.default.bool,
|
|
/**
|
|
* Enable or disable exit transitions.
|
|
*/
|
|
exit: import_prop_types2.default.bool,
|
|
/**
|
|
* The duration of the transition, in milliseconds.
|
|
* Required unless `addEndListener` is provided.
|
|
*
|
|
* You may specify a single timeout for all transitions:
|
|
*
|
|
* ```jsx
|
|
* timeout={500}
|
|
* ```
|
|
*
|
|
* or individually:
|
|
*
|
|
* ```jsx
|
|
* timeout={{
|
|
* appear: 500,
|
|
* enter: 300,
|
|
* exit: 500,
|
|
* }}
|
|
* ```
|
|
*
|
|
* - `appear` defaults to the value of `enter`
|
|
* - `enter` defaults to `0`
|
|
* - `exit` defaults to `0`
|
|
*
|
|
* @type {number | { enter?: number, exit?: number, appear?: number }}
|
|
*/
|
|
timeout: function timeout(props) {
|
|
var pt = 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. Timeouts are still used as a fallback if provided.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* ```jsx
|
|
* addEndListener={(node, done) => {
|
|
* // use the css transitionend event to mark the finish of a transition
|
|
* node.addEventListener('transitionend', done, false);
|
|
* }}
|
|
* ```
|
|
*/
|
|
addEndListener: import_prop_types2.default.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
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
*/
|
|
onEnter: import_prop_types2.default.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
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
*/
|
|
onEntering: import_prop_types2.default.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
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
*/
|
|
onEntered: import_prop_types2.default.func,
|
|
/**
|
|
* Callback fired before the "exiting" status is applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement) -> void
|
|
*/
|
|
onExit: import_prop_types2.default.func,
|
|
/**
|
|
* Callback fired after the "exiting" status is applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement) -> void
|
|
*/
|
|
onExiting: import_prop_types2.default.func,
|
|
/**
|
|
* Callback fired after the "exited" status is applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
*
|
|
* @type Function(node: HtmlElement) -> void
|
|
*/
|
|
onExited: import_prop_types2.default.func
|
|
} : {};
|
|
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 = UNMOUNTED;
|
|
Transition.EXITED = EXITED;
|
|
Transition.ENTERING = ENTERING;
|
|
Transition.ENTERED = ENTERED;
|
|
Transition.EXITING = EXITING;
|
|
var Transition_default = Transition;
|
|
|
|
// node_modules/react-transition-group/esm/CSSTransition.js
|
|
init_extends();
|
|
var import_prop_types3 = __toESM(require_prop_types());
|
|
|
|
// node_modules/dom-helpers/esm/hasClass.js
|
|
function hasClass(element, className) {
|
|
if (element.classList) return !!className && element.classList.contains(className);
|
|
return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
|
}
|
|
|
|
// node_modules/dom-helpers/esm/addClass.js
|
|
function addClass(element, className) {
|
|
if (element.classList) element.classList.add(className);
|
|
else if (!hasClass(element, className)) if (typeof element.className === "string") element.className = element.className + " " + className;
|
|
else element.setAttribute("class", (element.className && element.className.baseVal || "") + " " + className);
|
|
}
|
|
|
|
// node_modules/dom-helpers/esm/removeClass.js
|
|
function replaceClassName(origClass, classToRemove) {
|
|
return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
|
|
}
|
|
function removeClass(element, className) {
|
|
if (element.classList) {
|
|
element.classList.remove(className);
|
|
} else if (typeof element.className === "string") {
|
|
element.className = replaceClassName(element.className, className);
|
|
} else {
|
|
element.setAttribute("class", replaceClassName(element.className && element.className.baseVal || "", className));
|
|
}
|
|
}
|
|
|
|
// node_modules/react-transition-group/esm/CSSTransition.js
|
|
var import_react3 = __toESM(require_react());
|
|
var _addClass = function addClass2(node, classes) {
|
|
return node && classes && classes.split(" ").forEach(function(c) {
|
|
return addClass(node, c);
|
|
});
|
|
};
|
|
var removeClass2 = function removeClass3(node, classes) {
|
|
return node && classes && classes.split(" ").forEach(function(c) {
|
|
return removeClass(node, c);
|
|
});
|
|
};
|
|
var CSSTransition = function(_React$Component) {
|
|
_inheritsLoose(CSSTransition2, _React$Component);
|
|
function CSSTransition2() {
|
|
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.appliedClasses = {
|
|
appear: {},
|
|
enter: {},
|
|
exit: {}
|
|
};
|
|
_this.onEnter = function(maybeNode, maybeAppearing) {
|
|
var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument[0], appearing = _this$resolveArgument[1];
|
|
_this.removeClasses(node, "exit");
|
|
_this.addClass(node, appearing ? "appear" : "enter", "base");
|
|
if (_this.props.onEnter) {
|
|
_this.props.onEnter(maybeNode, maybeAppearing);
|
|
}
|
|
};
|
|
_this.onEntering = function(maybeNode, maybeAppearing) {
|
|
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1];
|
|
var type = appearing ? "appear" : "enter";
|
|
_this.addClass(node, type, "active");
|
|
if (_this.props.onEntering) {
|
|
_this.props.onEntering(maybeNode, maybeAppearing);
|
|
}
|
|
};
|
|
_this.onEntered = function(maybeNode, maybeAppearing) {
|
|
var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument3[0], appearing = _this$resolveArgument3[1];
|
|
var type = appearing ? "appear" : "enter";
|
|
_this.removeClasses(node, type);
|
|
_this.addClass(node, type, "done");
|
|
if (_this.props.onEntered) {
|
|
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
}
|
|
};
|
|
_this.onExit = function(maybeNode) {
|
|
var _this$resolveArgument4 = _this.resolveArguments(maybeNode), node = _this$resolveArgument4[0];
|
|
_this.removeClasses(node, "appear");
|
|
_this.removeClasses(node, "enter");
|
|
_this.addClass(node, "exit", "base");
|
|
if (_this.props.onExit) {
|
|
_this.props.onExit(maybeNode);
|
|
}
|
|
};
|
|
_this.onExiting = function(maybeNode) {
|
|
var _this$resolveArgument5 = _this.resolveArguments(maybeNode), node = _this$resolveArgument5[0];
|
|
_this.addClass(node, "exit", "active");
|
|
if (_this.props.onExiting) {
|
|
_this.props.onExiting(maybeNode);
|
|
}
|
|
};
|
|
_this.onExited = function(maybeNode) {
|
|
var _this$resolveArgument6 = _this.resolveArguments(maybeNode), node = _this$resolveArgument6[0];
|
|
_this.removeClasses(node, "exit");
|
|
_this.addClass(node, "exit", "done");
|
|
if (_this.props.onExited) {
|
|
_this.props.onExited(maybeNode);
|
|
}
|
|
};
|
|
_this.resolveArguments = function(maybeNode, maybeAppearing) {
|
|
return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] : [maybeNode, maybeAppearing];
|
|
};
|
|
_this.getClassNames = function(type) {
|
|
var classNames = _this.props.classNames;
|
|
var isStringClassNames = typeof classNames === "string";
|
|
var prefix = isStringClassNames && classNames ? classNames + "-" : "";
|
|
var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
|
|
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
|
|
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
|
|
return {
|
|
baseClassName,
|
|
activeClassName,
|
|
doneClassName
|
|
};
|
|
};
|
|
return _this;
|
|
}
|
|
var _proto = CSSTransition2.prototype;
|
|
_proto.addClass = function addClass3(node, type, phase) {
|
|
var className = this.getClassNames(type)[phase + "ClassName"];
|
|
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
|
|
if (type === "appear" && phase === "done" && doneClassName) {
|
|
className += " " + doneClassName;
|
|
}
|
|
if (phase === "active") {
|
|
if (node) forceReflow(node);
|
|
}
|
|
if (className) {
|
|
this.appliedClasses[type][phase] = className;
|
|
_addClass(node, className);
|
|
}
|
|
};
|
|
_proto.removeClasses = function removeClasses(node, type) {
|
|
var _this$appliedClasses$ = this.appliedClasses[type], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
|
|
this.appliedClasses[type] = {};
|
|
if (baseClassName) {
|
|
removeClass2(node, baseClassName);
|
|
}
|
|
if (activeClassName) {
|
|
removeClass2(node, activeClassName);
|
|
}
|
|
if (doneClassName) {
|
|
removeClass2(node, doneClassName);
|
|
}
|
|
};
|
|
_proto.render = function render() {
|
|
var _this$props = this.props, _ = _this$props.classNames, props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
|
return import_react3.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 CSSTransition2;
|
|
}(import_react3.default.Component);
|
|
CSSTransition.defaultProps = {
|
|
classNames: ""
|
|
};
|
|
CSSTransition.propTypes = true ? _extends({}, Transition_default.propTypes, {
|
|
/**
|
|
* The animation classNames applied to the component as it appears, enters,
|
|
* exits or has finished the transition. A single name can be provided, which
|
|
* will be suffixed for each stage, e.g. `classNames="fade"` applies:
|
|
*
|
|
* - `fade-appear`, `fade-appear-active`, `fade-appear-done`
|
|
* - `fade-enter`, `fade-enter-active`, `fade-enter-done`
|
|
* - `fade-exit`, `fade-exit-active`, `fade-exit-done`
|
|
*
|
|
* A few details to note about how these classes are applied:
|
|
*
|
|
* 1. They are _joined_ with the ones that are already defined on the child
|
|
* component, so if you want to add some base styles, you can use
|
|
* `className` without worrying that it will be overridden.
|
|
*
|
|
* 2. If the transition component mounts with `in={false}`, no classes are
|
|
* applied yet. You might be expecting `*-exit-done`, but if you think
|
|
* about it, a component cannot finish exiting if it hasn't entered yet.
|
|
*
|
|
* 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
|
|
* allows you to define different behavior for when appearing is done and
|
|
* when regular entering is done, using selectors like
|
|
* `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
|
|
* an epic entrance animation when element first appears in the DOM using
|
|
* [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
|
|
* simply use `fade-enter-done` for defining both cases.
|
|
*
|
|
* Each individual classNames can also be specified independently like:
|
|
*
|
|
* ```js
|
|
* classNames={{
|
|
* appear: 'my-appear',
|
|
* appearActive: 'my-active-appear',
|
|
* appearDone: 'my-done-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,
|
|
* appearDone?: string,
|
|
* enter?: string,
|
|
* enterActive?: string,
|
|
* enterDone?: string,
|
|
* exit?: string,
|
|
* exitActive?: string,
|
|
* exitDone?: string,
|
|
* }}
|
|
*/
|
|
classNames: classNamesShape,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
|
|
* applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
*/
|
|
onEnter: import_prop_types3.default.func,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'enter-active' or
|
|
* 'appear-active' class is applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
*/
|
|
onEntering: import_prop_types3.default.func,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'enter' or
|
|
* 'appear' classes are **removed** and the `done` class is added to the DOM node.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
*
|
|
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
*/
|
|
onEntered: import_prop_types3.default.func,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'exit' class is
|
|
* applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
*
|
|
* @type Function(node: HtmlElement)
|
|
*/
|
|
onExit: import_prop_types3.default.func,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'exit-active' is applied.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
*
|
|
* @type Function(node: HtmlElement)
|
|
*/
|
|
onExiting: import_prop_types3.default.func,
|
|
/**
|
|
* A `<Transition>` callback fired immediately after the 'exit' classes
|
|
* are **removed** and the `exit-done` class is added to the DOM node.
|
|
*
|
|
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
*
|
|
* @type Function(node: HtmlElement)
|
|
*/
|
|
onExited: import_prop_types3.default.func
|
|
}) : {};
|
|
|
|
// node_modules/react-transition-group/esm/ReplaceTransition.js
|
|
var import_prop_types5 = __toESM(require_prop_types());
|
|
var import_react6 = __toESM(require_react());
|
|
var import_react_dom2 = __toESM(require_react_dom());
|
|
|
|
// node_modules/react-transition-group/esm/TransitionGroup.js
|
|
init_extends();
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
function _assertThisInitialized(e) {
|
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
return e;
|
|
}
|
|
|
|
// node_modules/react-transition-group/esm/TransitionGroup.js
|
|
var import_prop_types4 = __toESM(require_prop_types());
|
|
var import_react5 = __toESM(require_react());
|
|
|
|
// node_modules/react-transition-group/esm/utils/ChildMapping.js
|
|
var import_react4 = __toESM(require_react());
|
|
function getChildMapping(children2, mapFn) {
|
|
var mapper = function mapper2(child) {
|
|
return mapFn && (0, import_react4.isValidElement)(child) ? mapFn(child) : child;
|
|
};
|
|
var result = /* @__PURE__ */ Object.create(null);
|
|
if (children2) import_react4.Children.map(children2, function(c) {
|
|
return c;
|
|
}).forEach(function(child) {
|
|
result[child.key] = mapper(child);
|
|
});
|
|
return result;
|
|
}
|
|
function mergeChildMappings(prev, next) {
|
|
prev = prev || {};
|
|
next = next || {};
|
|
function getValueForKey(key) {
|
|
return key in next ? next[key] : prev[key];
|
|
}
|
|
var nextKeysPending = /* @__PURE__ */ 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);
|
|
}
|
|
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, import_react4.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 children2 = mergeChildMappings(prevChildMapping, nextChildMapping);
|
|
Object.keys(children2).forEach(function(key) {
|
|
var child = children2[key];
|
|
if (!(0, import_react4.isValidElement)(child)) return;
|
|
var hasPrev = key in prevChildMapping;
|
|
var hasNext = key in nextChildMapping;
|
|
var prevChild = prevChildMapping[key];
|
|
var isLeaving = (0, import_react4.isValidElement)(prevChild) && !prevChild.props.in;
|
|
if (hasNext && (!hasPrev || isLeaving)) {
|
|
children2[key] = (0, import_react4.cloneElement)(child, {
|
|
onExited: onExited.bind(null, child),
|
|
in: true,
|
|
exit: getProp(child, "exit", nextProps),
|
|
enter: getProp(child, "enter", nextProps)
|
|
});
|
|
} else if (!hasNext && hasPrev && !isLeaving) {
|
|
children2[key] = (0, import_react4.cloneElement)(child, {
|
|
in: false
|
|
});
|
|
} else if (hasNext && hasPrev && (0, import_react4.isValidElement)(prevChild)) {
|
|
children2[key] = (0, import_react4.cloneElement)(child, {
|
|
onExited: onExited.bind(null, child),
|
|
in: prevChild.props.in,
|
|
exit: getProp(child, "exit", nextProps),
|
|
enter: getProp(child, "enter", nextProps)
|
|
});
|
|
}
|
|
});
|
|
return children2;
|
|
}
|
|
|
|
// node_modules/react-transition-group/esm/TransitionGroup.js
|
|
var values = Object.values || function(obj) {
|
|
return Object.keys(obj).map(function(k) {
|
|
return obj[k];
|
|
});
|
|
};
|
|
var defaultProps = {
|
|
component: "div",
|
|
childFactory: function childFactory(child) {
|
|
return child;
|
|
}
|
|
};
|
|
var TransitionGroup = function(_React$Component) {
|
|
_inheritsLoose(TransitionGroup2, _React$Component);
|
|
function TransitionGroup2(props, context) {
|
|
var _this;
|
|
_this = _React$Component.call(this, props, context) || this;
|
|
var handleExited = _this.handleExited.bind(_assertThisInitialized(_this));
|
|
_this.state = {
|
|
contextValue: {
|
|
isMounting: true
|
|
},
|
|
handleExited,
|
|
firstRender: true
|
|
};
|
|
return _this;
|
|
}
|
|
var _proto = TransitionGroup2.prototype;
|
|
_proto.componentDidMount = function componentDidMount() {
|
|
this.mounted = true;
|
|
this.setState({
|
|
contextValue: {
|
|
isMounting: false
|
|
}
|
|
});
|
|
};
|
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
this.mounted = false;
|
|
};
|
|
TransitionGroup2.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
|
var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender;
|
|
return {
|
|
children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
|
|
firstRender: false
|
|
};
|
|
};
|
|
_proto.handleExited = function handleExited(child, node) {
|
|
var currentChildMapping = getChildMapping(this.props.children);
|
|
if (child.key in currentChildMapping) return;
|
|
if (child.props.onExited) {
|
|
child.props.onExited(node);
|
|
}
|
|
if (this.mounted) {
|
|
this.setState(function(state) {
|
|
var children2 = _extends({}, state.children);
|
|
delete children2[child.key];
|
|
return {
|
|
children: children2
|
|
};
|
|
});
|
|
}
|
|
};
|
|
_proto.render = function render() {
|
|
var _this$props = this.props, Component = _this$props.component, childFactory2 = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
|
var contextValue = this.state.contextValue;
|
|
var children2 = values(this.state.children).map(childFactory2);
|
|
delete props.appear;
|
|
delete props.enter;
|
|
delete props.exit;
|
|
if (Component === null) {
|
|
return import_react5.default.createElement(TransitionGroupContext_default.Provider, {
|
|
value: contextValue
|
|
}, children2);
|
|
}
|
|
return import_react5.default.createElement(TransitionGroupContext_default.Provider, {
|
|
value: contextValue
|
|
}, import_react5.default.createElement(Component, props, children2));
|
|
};
|
|
return TransitionGroup2;
|
|
}(import_react5.default.Component);
|
|
TransitionGroup.propTypes = true ? {
|
|
/**
|
|
* `<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: import_prop_types4.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.
|
|
*
|
|
* While this component is meant for multiple `Transition` or `CSSTransition`
|
|
* children, sometimes you may want to have a single transition child with
|
|
* content that you want to be transitioned out and in when you change it
|
|
* (e.g. routes, images etc.) In that case you can change the `key` prop of
|
|
* the transition child as you change its content, this will cause
|
|
* `TransitionGroup` to transition the child out and back in.
|
|
*/
|
|
children: import_prop_types4.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: import_prop_types4.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: import_prop_types4.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: import_prop_types4.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: import_prop_types4.default.func
|
|
} : {};
|
|
TransitionGroup.defaultProps = defaultProps;
|
|
var TransitionGroup_default = TransitionGroup;
|
|
|
|
// node_modules/react-transition-group/esm/ReplaceTransition.js
|
|
var ReplaceTransition = function(_React$Component) {
|
|
_inheritsLoose(ReplaceTransition2, _React$Component);
|
|
function ReplaceTransition2() {
|
|
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 = ReplaceTransition2.prototype;
|
|
_proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
|
var _child$props;
|
|
var children2 = this.props.children;
|
|
var child = import_react6.default.Children.toArray(children2)[idx];
|
|
if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
|
if (this.props[handler]) {
|
|
var maybeNode = child.props.nodeRef ? void 0 : import_react_dom2.default.findDOMNode(this);
|
|
this.props[handler](maybeNode);
|
|
}
|
|
};
|
|
_proto.render = function render() {
|
|
var _this$props = this.props, children2 = _this$props.children, inProp = _this$props.in, props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
|
var _React$Children$toArr = import_react6.default.Children.toArray(children2), 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 import_react6.default.createElement(TransitionGroup_default, props, inProp ? import_react6.default.cloneElement(first, {
|
|
key: "first",
|
|
onEnter: this.handleEnter,
|
|
onEntering: this.handleEntering,
|
|
onEntered: this.handleEntered
|
|
}) : import_react6.default.cloneElement(second, {
|
|
key: "second",
|
|
onEnter: this.handleExit,
|
|
onEntering: this.handleExiting,
|
|
onEntered: this.handleExited
|
|
}));
|
|
};
|
|
return ReplaceTransition2;
|
|
}(import_react6.default.Component);
|
|
ReplaceTransition.propTypes = true ? {
|
|
in: import_prop_types5.default.bool.isRequired,
|
|
children: function children(props, propName) {
|
|
if (import_react6.default.Children.count(props[propName]) !== 2) return new Error('"' + propName + '" must be exactly two transition components.');
|
|
return null;
|
|
}
|
|
} : {};
|
|
|
|
// node_modules/react-transition-group/esm/SwitchTransition.js
|
|
var import_react7 = __toESM(require_react());
|
|
var import_prop_types6 = __toESM(require_prop_types());
|
|
var _leaveRenders;
|
|
var _enterRenders;
|
|
function areChildrenDifferent(oldChildren, newChildren) {
|
|
if (oldChildren === newChildren) return false;
|
|
if (import_react7.default.isValidElement(oldChildren) && import_react7.default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
var modes = {
|
|
out: "out-in",
|
|
in: "in-out"
|
|
};
|
|
var callHook = function callHook2(element, name, cb) {
|
|
return function() {
|
|
var _element$props;
|
|
element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
|
|
cb();
|
|
};
|
|
};
|
|
var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function(_ref) {
|
|
var current = _ref.current, changeState = _ref.changeState;
|
|
return import_react7.default.cloneElement(current, {
|
|
in: false,
|
|
onExited: callHook(current, "onExited", function() {
|
|
changeState(ENTERING, null);
|
|
})
|
|
});
|
|
}, _leaveRenders[modes.in] = function(_ref2) {
|
|
var current = _ref2.current, changeState = _ref2.changeState, children2 = _ref2.children;
|
|
return [current, import_react7.default.cloneElement(children2, {
|
|
in: true,
|
|
onEntered: callHook(children2, "onEntered", function() {
|
|
changeState(ENTERING);
|
|
})
|
|
})];
|
|
}, _leaveRenders);
|
|
var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function(_ref3) {
|
|
var children2 = _ref3.children, changeState = _ref3.changeState;
|
|
return import_react7.default.cloneElement(children2, {
|
|
in: true,
|
|
onEntered: callHook(children2, "onEntered", function() {
|
|
changeState(ENTERED, import_react7.default.cloneElement(children2, {
|
|
in: true
|
|
}));
|
|
})
|
|
});
|
|
}, _enterRenders[modes.in] = function(_ref4) {
|
|
var current = _ref4.current, children2 = _ref4.children, changeState = _ref4.changeState;
|
|
return [import_react7.default.cloneElement(current, {
|
|
in: false,
|
|
onExited: callHook(current, "onExited", function() {
|
|
changeState(ENTERED, import_react7.default.cloneElement(children2, {
|
|
in: true
|
|
}));
|
|
})
|
|
}), import_react7.default.cloneElement(children2, {
|
|
in: true
|
|
})];
|
|
}, _enterRenders);
|
|
var SwitchTransition = function(_React$Component) {
|
|
_inheritsLoose(SwitchTransition2, _React$Component);
|
|
function SwitchTransition2() {
|
|
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.state = {
|
|
status: ENTERED,
|
|
current: null
|
|
};
|
|
_this.appeared = false;
|
|
_this.changeState = function(status, current) {
|
|
if (current === void 0) {
|
|
current = _this.state.current;
|
|
}
|
|
_this.setState({
|
|
status,
|
|
current
|
|
});
|
|
};
|
|
return _this;
|
|
}
|
|
var _proto = SwitchTransition2.prototype;
|
|
_proto.componentDidMount = function componentDidMount() {
|
|
this.appeared = true;
|
|
};
|
|
SwitchTransition2.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
if (props.children == null) {
|
|
return {
|
|
current: null
|
|
};
|
|
}
|
|
if (state.status === ENTERING && props.mode === modes.in) {
|
|
return {
|
|
status: ENTERING
|
|
};
|
|
}
|
|
if (state.current && areChildrenDifferent(state.current, props.children)) {
|
|
return {
|
|
status: EXITING
|
|
};
|
|
}
|
|
return {
|
|
current: import_react7.default.cloneElement(props.children, {
|
|
in: true
|
|
})
|
|
};
|
|
};
|
|
_proto.render = function render() {
|
|
var _this$props = this.props, children2 = _this$props.children, mode = _this$props.mode, _this$state = this.state, status = _this$state.status, current = _this$state.current;
|
|
var data = {
|
|
children: children2,
|
|
current,
|
|
changeState: this.changeState,
|
|
status
|
|
};
|
|
var component;
|
|
switch (status) {
|
|
case ENTERING:
|
|
component = enterRenders[mode](data);
|
|
break;
|
|
case EXITING:
|
|
component = leaveRenders[mode](data);
|
|
break;
|
|
case ENTERED:
|
|
component = current;
|
|
}
|
|
return import_react7.default.createElement(TransitionGroupContext_default.Provider, {
|
|
value: {
|
|
isMounting: !this.appeared
|
|
}
|
|
}, component);
|
|
};
|
|
return SwitchTransition2;
|
|
}(import_react7.default.Component);
|
|
SwitchTransition.propTypes = true ? {
|
|
/**
|
|
* Transition modes.
|
|
* `out-in`: Current element transitions out first, then when complete, the new element transitions in.
|
|
* `in-out`: New element transitions in first, then when complete, the current element transitions out.
|
|
*
|
|
* @type {'out-in'|'in-out'}
|
|
*/
|
|
mode: import_prop_types6.default.oneOf([modes.in, modes.out]),
|
|
/**
|
|
* Any `Transition` or `CSSTransition` component.
|
|
*/
|
|
children: import_prop_types6.default.oneOfType([import_prop_types6.default.element.isRequired])
|
|
} : {};
|
|
SwitchTransition.defaultProps = {
|
|
mode: modes.out
|
|
};
|
|
|
|
export {
|
|
Transition_default,
|
|
TransitionGroup_default
|
|
};
|
|
//# sourceMappingURL=chunk-KDLLJ6MK.js.map
|