` by default. You can change this
* behavior by providing a `component` prop.
* If you use React v16+ and would like to avoid a wrapping `
` 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 `` components, that are toggled `in` and out as they
* leave. the `` will inject specific transition props, so
* remember to spread them through if you are wrapping the `` as
* with our `` 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