siam-ui-utils 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CustomBootstrap.js +9 -9
- package/dist/_virtual/_commonjsHelpers.js +7 -7
- package/dist/_virtual/events.js +6 -6
- package/dist/_virtual/events2.js +5 -5
- package/dist/_virtual/index.js +8 -8
- package/dist/_virtual/index2.js +5 -5
- package/dist/assets/img/copiar.png.js +5 -5
- package/dist/assets/img/take-photo.jpg.js +5 -5
- package/dist/constants.js +9 -9
- package/dist/copy-link/index.js +60 -60
- package/dist/copy-link/styles.css +37 -37
- package/dist/custom-input/CustomInputCheckbox.js +37 -37
- package/dist/custom-input/CustomInputCurrency.js +84 -84
- package/dist/custom-input/CustomInputFile.js +47 -47
- package/dist/custom-input/CustomInputRadio.js +68 -68
- package/dist/custom-input/constant.js +5 -5
- package/dist/custom-input/index.js +12 -12
- package/dist/drag-and-dropzone/DropzoneComponent.js +83 -83
- package/dist/drag-and-dropzone/config.js +59 -59
- package/dist/drag-and-dropzone/index.js +39 -39
- package/dist/dropzone/Input.js +77 -77
- package/dist/dropzone/Layout.js +50 -50
- package/dist/dropzone/Preview.js +117 -117
- package/dist/dropzone/SubmitButton.js +34 -34
- package/dist/dropzone/assets/cancel.svg.js +5 -5
- package/dist/dropzone/assets/remove.svg.js +5 -5
- package/dist/dropzone/assets/restart.svg.js +5 -5
- package/dist/dropzone/index.js +514 -514
- package/dist/dropzone/utils.js +93 -93
- package/dist/dropzone-uploader/base/index.js +135 -135
- package/dist/dropzone-uploader/index.js +7 -7
- package/dist/dropzone-uploader/styled/index.js +148 -148
- package/dist/iconos/constants-svg.js +666 -666
- package/dist/iconos/icon-button-svg.js +50 -50
- package/dist/iconos/index.js +24 -24
- package/dist/iconos/styled-icon.js +26 -26
- package/dist/index.js +4 -4
- package/dist/intl-messages/index.js +11 -11
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -9
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js +77 -0
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js.map +1 -0
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +111 -111
- package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +106 -106
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +125 -125
- package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +75 -75
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +225 -225
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +122 -122
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +83 -83
- package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +68 -68
- package/dist/node_modules/classnames/index.js +62 -62
- package/dist/node_modules/dom-helpers/esm/addClass.js +10 -10
- package/dist/node_modules/dom-helpers/esm/hasClass.js +8 -8
- package/dist/node_modules/dom-helpers/esm/removeClass.js +16 -16
- package/dist/node_modules/dropzone/dist/dropzone.js +1968 -1968
- package/dist/node_modules/events/events.js +372 -372
- package/dist/node_modules/just-extend/index.esm.js +43 -43
- package/dist/node_modules/react-transition-group/esm/CSSTransition.js +275 -275
- package/dist/node_modules/react-transition-group/esm/Transition.js +441 -441
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +146 -146
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -6
- package/dist/node_modules/react-transition-group/esm/config.js +7 -7
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +100 -100
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -24
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js +7 -7
- package/dist/react-notifications/Notification.js +73 -73
- package/dist/react-notifications/NotificationContainer.js +59 -59
- package/dist/react-notifications/NotificationManager.js +174 -174
- package/dist/react-notifications/Notifications.js +72 -72
- package/dist/react-notifications/constants.js +26 -26
- package/dist/react-notifications/index.js +11 -11
- package/dist/select/custom-select/constants.js +8 -8
- package/dist/select/custom-select/index.js +89 -89
- package/dist/select/custom-select-input/index.js +12 -12
- package/dist/select/index.js +9 -9
- package/dist/select/multi-select/badge-label-multi-select.js +29 -29
- package/dist/select/multi-select/index.css +36 -36
- package/dist/select/multi-select/index.js +171 -171
- package/dist/select/multi-select/index.js.map +1 -1
- package/dist/select/multi-select/styled-component.js +23 -23
- package/dist/select/multi-select/styled-component.js.map +1 -1
- package/dist/timer/index.js +60 -60
- package/dist/timer/styles.css +58 -58
- package/dist/tomar-foto/index.js +62 -62
- package/dist/view-layout/button-editor.js +14 -14
- package/dist/view-layout/constants.js +11 -11
- package/dist/view-layout/editor-layer.js +28 -28
- package/dist/view-layout/index.js +53 -53
- package/dist/view-layout/slot-wrapper.js +39 -39
- package/dist/view-layout/styles.css +126 -126
- package/dist/where-by-room/index.js +20 -20
- package/dist/where-by-room/room.js +78 -78
- package/package.json +1 -4
|
@@ -1,441 +1,441 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "../../@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";
|
|
2
|
-
import _inheritsLoose from "../../@babel/runtime/helpers/esm/inheritsLoose.js";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import ReactDOM from "react-dom";
|
|
6
|
-
import config from "./config.js";
|
|
7
|
-
import { timeoutsShape } from "./utils/PropTypes.js";
|
|
8
|
-
import TransitionGroupContext from "./TransitionGroupContext.js";
|
|
9
|
-
import { forceReflow } from "./utils/reflow.js";
|
|
10
|
-
var define_process_env_default = {};
|
|
11
|
-
var UNMOUNTED = "unmounted";
|
|
12
|
-
var EXITED = "exited";
|
|
13
|
-
var ENTERING = "entering";
|
|
14
|
-
var ENTERED = "entered";
|
|
15
|
-
var EXITING = "exiting";
|
|
16
|
-
var Transition = /* @__PURE__ */ (function(_React$Component) {
|
|
17
|
-
_inheritsLoose(Transition2, _React$Component);
|
|
18
|
-
function Transition2(props, context) {
|
|
19
|
-
var _this;
|
|
20
|
-
_this = _React$Component.call(this, props, context) || this;
|
|
21
|
-
var parentGroup = context;
|
|
22
|
-
var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
|
23
|
-
var initialStatus;
|
|
24
|
-
_this.appearStatus = null;
|
|
25
|
-
if (props.in) {
|
|
26
|
-
if (appear) {
|
|
27
|
-
initialStatus = EXITED;
|
|
28
|
-
_this.appearStatus = ENTERING;
|
|
29
|
-
} else {
|
|
30
|
-
initialStatus = ENTERED;
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
if (props.unmountOnExit || props.mountOnEnter) {
|
|
34
|
-
initialStatus = UNMOUNTED;
|
|
35
|
-
} else {
|
|
36
|
-
initialStatus = EXITED;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
_this.state = {
|
|
40
|
-
status: initialStatus
|
|
41
|
-
};
|
|
42
|
-
_this.nextCallback = null;
|
|
43
|
-
return _this;
|
|
44
|
-
}
|
|
45
|
-
Transition2.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
|
46
|
-
var nextIn = _ref.in;
|
|
47
|
-
if (nextIn && prevState.status === UNMOUNTED) {
|
|
48
|
-
return {
|
|
49
|
-
status: EXITED
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
};
|
|
54
|
-
var _proto = Transition2.prototype;
|
|
55
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
56
|
-
this.updateStatus(true, this.appearStatus);
|
|
57
|
-
};
|
|
58
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
59
|
-
var nextStatus = null;
|
|
60
|
-
if (prevProps !== this.props) {
|
|
61
|
-
var status = this.state.status;
|
|
62
|
-
if (this.props.in) {
|
|
63
|
-
if (status !== ENTERING && status !== ENTERED) {
|
|
64
|
-
nextStatus = ENTERING;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
if (status === ENTERING || status === ENTERED) {
|
|
68
|
-
nextStatus = EXITING;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
this.updateStatus(false, nextStatus);
|
|
73
|
-
};
|
|
74
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
75
|
-
this.cancelNextCallback();
|
|
76
|
-
};
|
|
77
|
-
_proto.getTimeouts = function getTimeouts() {
|
|
78
|
-
var timeout2 = this.props.timeout;
|
|
79
|
-
var exit, enter, appear;
|
|
80
|
-
exit = enter = appear = timeout2;
|
|
81
|
-
if (timeout2 != null && typeof timeout2 !== "number") {
|
|
82
|
-
exit = timeout2.exit;
|
|
83
|
-
enter = timeout2.enter;
|
|
84
|
-
appear = timeout2.appear !== void 0 ? timeout2.appear : enter;
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
exit,
|
|
88
|
-
enter,
|
|
89
|
-
appear
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
_proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
|
93
|
-
if (mounting === void 0) {
|
|
94
|
-
mounting = false;
|
|
95
|
-
}
|
|
96
|
-
if (nextStatus !== null) {
|
|
97
|
-
this.cancelNextCallback();
|
|
98
|
-
if (nextStatus === ENTERING) {
|
|
99
|
-
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
100
|
-
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
|
|
101
|
-
if (node) forceReflow(node);
|
|
102
|
-
}
|
|
103
|
-
this.performEnter(mounting);
|
|
104
|
-
} else {
|
|
105
|
-
this.performExit();
|
|
106
|
-
}
|
|
107
|
-
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
|
108
|
-
this.setState({
|
|
109
|
-
status: UNMOUNTED
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
_proto.performEnter = function performEnter(mounting) {
|
|
114
|
-
var _this2 = this;
|
|
115
|
-
var enter = this.props.enter;
|
|
116
|
-
var appearing = this.context ? this.context.isMounting : mounting;
|
|
117
|
-
var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing], maybeNode = _ref2[0], maybeAppearing = _ref2[1];
|
|
118
|
-
var timeouts = this.getTimeouts();
|
|
119
|
-
var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
|
120
|
-
if (!mounting && !enter || config.disabled) {
|
|
121
|
-
this.safeSetState({
|
|
122
|
-
status: ENTERED
|
|
123
|
-
}, function() {
|
|
124
|
-
_this2.props.onEntered(maybeNode);
|
|
125
|
-
});
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
this.props.onEnter(maybeNode, maybeAppearing);
|
|
129
|
-
this.safeSetState({
|
|
130
|
-
status: ENTERING
|
|
131
|
-
}, function() {
|
|
132
|
-
_this2.props.onEntering(maybeNode, maybeAppearing);
|
|
133
|
-
_this2.onTransitionEnd(enterTimeout, function() {
|
|
134
|
-
_this2.safeSetState({
|
|
135
|
-
status: ENTERED
|
|
136
|
-
}, function() {
|
|
137
|
-
_this2.props.onEntered(maybeNode, maybeAppearing);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
_proto.performExit = function performExit() {
|
|
143
|
-
var _this3 = this;
|
|
144
|
-
var exit = this.props.exit;
|
|
145
|
-
var timeouts = this.getTimeouts();
|
|
146
|
-
var maybeNode = this.props.nodeRef ? void 0 : ReactDOM.findDOMNode(this);
|
|
147
|
-
if (!exit || config.disabled) {
|
|
148
|
-
this.safeSetState({
|
|
149
|
-
status: EXITED
|
|
150
|
-
}, function() {
|
|
151
|
-
_this3.props.onExited(maybeNode);
|
|
152
|
-
});
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
this.props.onExit(maybeNode);
|
|
156
|
-
this.safeSetState({
|
|
157
|
-
status: EXITING
|
|
158
|
-
}, function() {
|
|
159
|
-
_this3.props.onExiting(maybeNode);
|
|
160
|
-
_this3.onTransitionEnd(timeouts.exit, function() {
|
|
161
|
-
_this3.safeSetState({
|
|
162
|
-
status: EXITED
|
|
163
|
-
}, function() {
|
|
164
|
-
_this3.props.onExited(maybeNode);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
_proto.cancelNextCallback = function cancelNextCallback() {
|
|
170
|
-
if (this.nextCallback !== null) {
|
|
171
|
-
this.nextCallback.cancel();
|
|
172
|
-
this.nextCallback = null;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
_proto.safeSetState = function safeSetState(nextState, callback) {
|
|
176
|
-
callback = this.setNextCallback(callback);
|
|
177
|
-
this.setState(nextState, callback);
|
|
178
|
-
};
|
|
179
|
-
_proto.setNextCallback = function setNextCallback(callback) {
|
|
180
|
-
var _this4 = this;
|
|
181
|
-
var active = true;
|
|
182
|
-
this.nextCallback = function(event) {
|
|
183
|
-
if (active) {
|
|
184
|
-
active = false;
|
|
185
|
-
_this4.nextCallback = null;
|
|
186
|
-
callback(event);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
this.nextCallback.cancel = function() {
|
|
190
|
-
active = false;
|
|
191
|
-
};
|
|
192
|
-
return this.nextCallback;
|
|
193
|
-
};
|
|
194
|
-
_proto.onTransitionEnd = function onTransitionEnd(timeout2, handler) {
|
|
195
|
-
this.setNextCallback(handler);
|
|
196
|
-
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
|
|
197
|
-
var doesNotHaveTimeoutOrListener = timeout2 == null && !this.props.addEndListener;
|
|
198
|
-
if (!node || doesNotHaveTimeoutOrListener) {
|
|
199
|
-
setTimeout(this.nextCallback, 0);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (this.props.addEndListener) {
|
|
203
|
-
var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], maybeNode = _ref3[0], maybeNextCallback = _ref3[1];
|
|
204
|
-
this.props.addEndListener(maybeNode, maybeNextCallback);
|
|
205
|
-
}
|
|
206
|
-
if (timeout2 != null) {
|
|
207
|
-
setTimeout(this.nextCallback, timeout2);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
_proto.render = function render() {
|
|
211
|
-
var status = this.state.status;
|
|
212
|
-
if (status === UNMOUNTED) {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
var _this$props = this.props, children = _this$props.children;
|
|
216
|
-
_this$props.in;
|
|
217
|
-
_this$props.mountOnEnter;
|
|
218
|
-
_this$props.unmountOnExit;
|
|
219
|
-
_this$props.appear;
|
|
220
|
-
_this$props.enter;
|
|
221
|
-
_this$props.exit;
|
|
222
|
-
_this$props.timeout;
|
|
223
|
-
_this$props.addEndListener;
|
|
224
|
-
_this$props.onEnter;
|
|
225
|
-
_this$props.onEntering;
|
|
226
|
-
_this$props.onEntered;
|
|
227
|
-
_this$props.onExit;
|
|
228
|
-
_this$props.onExiting;
|
|
229
|
-
_this$props.onExited;
|
|
230
|
-
_this$props.nodeRef;
|
|
231
|
-
var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
|
|
232
|
-
return (
|
|
233
|
-
// allows for nested Transitions
|
|
234
|
-
/* @__PURE__ */ React.createElement(TransitionGroupContext.Provider, {
|
|
235
|
-
value: null
|
|
236
|
-
}, typeof children === "function" ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))
|
|
237
|
-
);
|
|
238
|
-
};
|
|
239
|
-
return Transition2;
|
|
240
|
-
})(React.Component);
|
|
241
|
-
Transition.contextType = TransitionGroupContext;
|
|
242
|
-
Transition.propTypes = define_process_env_default.NODE_ENV !== "production" ? {
|
|
243
|
-
/**
|
|
244
|
-
* A React reference to DOM element that need to transition:
|
|
245
|
-
* https://stackoverflow.com/a/51127130/4671932
|
|
246
|
-
*
|
|
247
|
-
* - When `nodeRef` prop is used, `node` is not passed to callback functions
|
|
248
|
-
* (e.g. `onEnter`) because user already has direct access to the node.
|
|
249
|
-
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
|
|
250
|
-
* `nodeRef` need to be provided to `Transition` with changed `key` prop
|
|
251
|
-
* (see
|
|
252
|
-
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
|
|
253
|
-
*/
|
|
254
|
-
nodeRef: PropTypes.shape({
|
|
255
|
-
current: typeof Element === "undefined" ? PropTypes.any : function(propValue, key, componentName, location, propFullName, secret) {
|
|
256
|
-
var value = propValue[key];
|
|
257
|
-
return PropTypes.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
|
|
258
|
-
}
|
|
259
|
-
}),
|
|
260
|
-
/**
|
|
261
|
-
* A `function` child can be used instead of a React element. This function is
|
|
262
|
-
* called with the current transition status (`'entering'`, `'entered'`,
|
|
263
|
-
* `'exiting'`, `'exited'`), which can be used to apply context
|
|
264
|
-
* specific props to a component.
|
|
265
|
-
*
|
|
266
|
-
* ```jsx
|
|
267
|
-
* <Transition in={this.state.in} timeout={150}>
|
|
268
|
-
* {state => (
|
|
269
|
-
* <MyComponent className={`fade fade-${state}`} />
|
|
270
|
-
* )}
|
|
271
|
-
* </Transition>
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
|
275
|
-
/**
|
|
276
|
-
* Show the component; triggers the enter or exit states
|
|
277
|
-
*/
|
|
278
|
-
in: PropTypes.bool,
|
|
279
|
-
/**
|
|
280
|
-
* By default the child component is mounted immediately along with
|
|
281
|
-
* the parent `Transition` component. If you want to "lazy mount" the component on the
|
|
282
|
-
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
|
|
283
|
-
* mounted, even on "exited", unless you also specify `unmountOnExit`.
|
|
284
|
-
*/
|
|
285
|
-
mountOnEnter: PropTypes.bool,
|
|
286
|
-
/**
|
|
287
|
-
* By default the child component stays mounted after it reaches the `'exited'` state.
|
|
288
|
-
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
|
|
289
|
-
*/
|
|
290
|
-
unmountOnExit: PropTypes.bool,
|
|
291
|
-
/**
|
|
292
|
-
* By default the child component does not perform the enter transition when
|
|
293
|
-
* it first mounts, regardless of the value of `in`. If you want this
|
|
294
|
-
* behavior, set both `appear` and `in` to `true`.
|
|
295
|
-
*
|
|
296
|
-
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
|
|
297
|
-
* > only adds an additional enter transition. However, in the
|
|
298
|
-
* > `<CSSTransition>` component that first enter transition does result in
|
|
299
|
-
* > additional `.appear-*` classes, that way you can choose to style it
|
|
300
|
-
* > differently.
|
|
301
|
-
*/
|
|
302
|
-
appear: PropTypes.bool,
|
|
303
|
-
/**
|
|
304
|
-
* Enable or disable enter transitions.
|
|
305
|
-
*/
|
|
306
|
-
enter: PropTypes.bool,
|
|
307
|
-
/**
|
|
308
|
-
* Enable or disable exit transitions.
|
|
309
|
-
*/
|
|
310
|
-
exit: PropTypes.bool,
|
|
311
|
-
/**
|
|
312
|
-
* The duration of the transition, in milliseconds.
|
|
313
|
-
* Required unless `addEndListener` is provided.
|
|
314
|
-
*
|
|
315
|
-
* You may specify a single timeout for all transitions:
|
|
316
|
-
*
|
|
317
|
-
* ```jsx
|
|
318
|
-
* timeout={500}
|
|
319
|
-
* ```
|
|
320
|
-
*
|
|
321
|
-
* or individually:
|
|
322
|
-
*
|
|
323
|
-
* ```jsx
|
|
324
|
-
* timeout={{
|
|
325
|
-
* appear: 500,
|
|
326
|
-
* enter: 300,
|
|
327
|
-
* exit: 500,
|
|
328
|
-
* }}
|
|
329
|
-
* ```
|
|
330
|
-
*
|
|
331
|
-
* - `appear` defaults to the value of `enter`
|
|
332
|
-
* - `enter` defaults to `0`
|
|
333
|
-
* - `exit` defaults to `0`
|
|
334
|
-
*
|
|
335
|
-
* @type {number | { enter?: number, exit?: number, appear?: number }}
|
|
336
|
-
*/
|
|
337
|
-
timeout: function timeout(props) {
|
|
338
|
-
var pt = timeoutsShape;
|
|
339
|
-
if (!props.addEndListener) pt = pt.isRequired;
|
|
340
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
341
|
-
args[_key - 1] = arguments[_key];
|
|
342
|
-
}
|
|
343
|
-
return pt.apply(void 0, [props].concat(args));
|
|
344
|
-
},
|
|
345
|
-
/**
|
|
346
|
-
* Add a custom transition end trigger. Called with the transitioning
|
|
347
|
-
* DOM node and a `done` callback. Allows for more fine grained transition end
|
|
348
|
-
* logic. Timeouts are still used as a fallback if provided.
|
|
349
|
-
*
|
|
350
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
351
|
-
*
|
|
352
|
-
* ```jsx
|
|
353
|
-
* addEndListener={(node, done) => {
|
|
354
|
-
* // use the css transitionend event to mark the finish of a transition
|
|
355
|
-
* node.addEventListener('transitionend', done, false);
|
|
356
|
-
* }}
|
|
357
|
-
* ```
|
|
358
|
-
*/
|
|
359
|
-
addEndListener: PropTypes.func,
|
|
360
|
-
/**
|
|
361
|
-
* Callback fired before the "entering" status is applied. An extra parameter
|
|
362
|
-
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
363
|
-
*
|
|
364
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
365
|
-
*
|
|
366
|
-
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
367
|
-
*/
|
|
368
|
-
onEnter: PropTypes.func,
|
|
369
|
-
/**
|
|
370
|
-
* Callback fired after the "entering" status is applied. An extra parameter
|
|
371
|
-
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
372
|
-
*
|
|
373
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
374
|
-
*
|
|
375
|
-
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
376
|
-
*/
|
|
377
|
-
onEntering: PropTypes.func,
|
|
378
|
-
/**
|
|
379
|
-
* Callback fired after the "entered" status is applied. An extra parameter
|
|
380
|
-
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
381
|
-
*
|
|
382
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
383
|
-
*
|
|
384
|
-
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
385
|
-
*/
|
|
386
|
-
onEntered: PropTypes.func,
|
|
387
|
-
/**
|
|
388
|
-
* Callback fired before the "exiting" status is applied.
|
|
389
|
-
*
|
|
390
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
391
|
-
*
|
|
392
|
-
* @type Function(node: HtmlElement) -> void
|
|
393
|
-
*/
|
|
394
|
-
onExit: PropTypes.func,
|
|
395
|
-
/**
|
|
396
|
-
* Callback fired after the "exiting" status is applied.
|
|
397
|
-
*
|
|
398
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
399
|
-
*
|
|
400
|
-
* @type Function(node: HtmlElement) -> void
|
|
401
|
-
*/
|
|
402
|
-
onExiting: PropTypes.func,
|
|
403
|
-
/**
|
|
404
|
-
* Callback fired after the "exited" status is applied.
|
|
405
|
-
*
|
|
406
|
-
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
407
|
-
*
|
|
408
|
-
* @type Function(node: HtmlElement) -> void
|
|
409
|
-
*/
|
|
410
|
-
onExited: PropTypes.func
|
|
411
|
-
} : {};
|
|
412
|
-
function noop() {
|
|
413
|
-
}
|
|
414
|
-
Transition.defaultProps = {
|
|
415
|
-
in: false,
|
|
416
|
-
mountOnEnter: false,
|
|
417
|
-
unmountOnExit: false,
|
|
418
|
-
appear: false,
|
|
419
|
-
enter: true,
|
|
420
|
-
exit: true,
|
|
421
|
-
onEnter: noop,
|
|
422
|
-
onEntering: noop,
|
|
423
|
-
onEntered: noop,
|
|
424
|
-
onExit: noop,
|
|
425
|
-
onExiting: noop,
|
|
426
|
-
onExited: noop
|
|
427
|
-
};
|
|
428
|
-
Transition.UNMOUNTED = UNMOUNTED;
|
|
429
|
-
Transition.EXITED = EXITED;
|
|
430
|
-
Transition.ENTERING = ENTERING;
|
|
431
|
-
Transition.ENTERED = ENTERED;
|
|
432
|
-
Transition.EXITING = EXITING;
|
|
433
|
-
export {
|
|
434
|
-
ENTERED,
|
|
435
|
-
ENTERING,
|
|
436
|
-
EXITED,
|
|
437
|
-
EXITING,
|
|
438
|
-
UNMOUNTED,
|
|
439
|
-
Transition as default
|
|
440
|
-
};
|
|
441
|
-
//# sourceMappingURL=Transition.js.map
|
|
1
|
+
import _objectWithoutPropertiesLoose from "../../@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";
|
|
2
|
+
import _inheritsLoose from "../../@babel/runtime/helpers/esm/inheritsLoose.js";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import ReactDOM from "react-dom";
|
|
6
|
+
import config from "./config.js";
|
|
7
|
+
import { timeoutsShape } from "./utils/PropTypes.js";
|
|
8
|
+
import TransitionGroupContext from "./TransitionGroupContext.js";
|
|
9
|
+
import { forceReflow } from "./utils/reflow.js";
|
|
10
|
+
var define_process_env_default = {};
|
|
11
|
+
var UNMOUNTED = "unmounted";
|
|
12
|
+
var EXITED = "exited";
|
|
13
|
+
var ENTERING = "entering";
|
|
14
|
+
var ENTERED = "entered";
|
|
15
|
+
var EXITING = "exiting";
|
|
16
|
+
var Transition = /* @__PURE__ */ (function(_React$Component) {
|
|
17
|
+
_inheritsLoose(Transition2, _React$Component);
|
|
18
|
+
function Transition2(props, context) {
|
|
19
|
+
var _this;
|
|
20
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
21
|
+
var parentGroup = context;
|
|
22
|
+
var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
|
23
|
+
var initialStatus;
|
|
24
|
+
_this.appearStatus = null;
|
|
25
|
+
if (props.in) {
|
|
26
|
+
if (appear) {
|
|
27
|
+
initialStatus = EXITED;
|
|
28
|
+
_this.appearStatus = ENTERING;
|
|
29
|
+
} else {
|
|
30
|
+
initialStatus = ENTERED;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (props.unmountOnExit || props.mountOnEnter) {
|
|
34
|
+
initialStatus = UNMOUNTED;
|
|
35
|
+
} else {
|
|
36
|
+
initialStatus = EXITED;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
_this.state = {
|
|
40
|
+
status: initialStatus
|
|
41
|
+
};
|
|
42
|
+
_this.nextCallback = null;
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
Transition2.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
|
46
|
+
var nextIn = _ref.in;
|
|
47
|
+
if (nextIn && prevState.status === UNMOUNTED) {
|
|
48
|
+
return {
|
|
49
|
+
status: EXITED
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
54
|
+
var _proto = Transition2.prototype;
|
|
55
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
56
|
+
this.updateStatus(true, this.appearStatus);
|
|
57
|
+
};
|
|
58
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
59
|
+
var nextStatus = null;
|
|
60
|
+
if (prevProps !== this.props) {
|
|
61
|
+
var status = this.state.status;
|
|
62
|
+
if (this.props.in) {
|
|
63
|
+
if (status !== ENTERING && status !== ENTERED) {
|
|
64
|
+
nextStatus = ENTERING;
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (status === ENTERING || status === ENTERED) {
|
|
68
|
+
nextStatus = EXITING;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this.updateStatus(false, nextStatus);
|
|
73
|
+
};
|
|
74
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
75
|
+
this.cancelNextCallback();
|
|
76
|
+
};
|
|
77
|
+
_proto.getTimeouts = function getTimeouts() {
|
|
78
|
+
var timeout2 = this.props.timeout;
|
|
79
|
+
var exit, enter, appear;
|
|
80
|
+
exit = enter = appear = timeout2;
|
|
81
|
+
if (timeout2 != null && typeof timeout2 !== "number") {
|
|
82
|
+
exit = timeout2.exit;
|
|
83
|
+
enter = timeout2.enter;
|
|
84
|
+
appear = timeout2.appear !== void 0 ? timeout2.appear : enter;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
exit,
|
|
88
|
+
enter,
|
|
89
|
+
appear
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
_proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
|
93
|
+
if (mounting === void 0) {
|
|
94
|
+
mounting = false;
|
|
95
|
+
}
|
|
96
|
+
if (nextStatus !== null) {
|
|
97
|
+
this.cancelNextCallback();
|
|
98
|
+
if (nextStatus === ENTERING) {
|
|
99
|
+
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
100
|
+
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
|
|
101
|
+
if (node) forceReflow(node);
|
|
102
|
+
}
|
|
103
|
+
this.performEnter(mounting);
|
|
104
|
+
} else {
|
|
105
|
+
this.performExit();
|
|
106
|
+
}
|
|
107
|
+
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
|
108
|
+
this.setState({
|
|
109
|
+
status: UNMOUNTED
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
_proto.performEnter = function performEnter(mounting) {
|
|
114
|
+
var _this2 = this;
|
|
115
|
+
var enter = this.props.enter;
|
|
116
|
+
var appearing = this.context ? this.context.isMounting : mounting;
|
|
117
|
+
var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing], maybeNode = _ref2[0], maybeAppearing = _ref2[1];
|
|
118
|
+
var timeouts = this.getTimeouts();
|
|
119
|
+
var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
|
120
|
+
if (!mounting && !enter || config.disabled) {
|
|
121
|
+
this.safeSetState({
|
|
122
|
+
status: ENTERED
|
|
123
|
+
}, function() {
|
|
124
|
+
_this2.props.onEntered(maybeNode);
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.props.onEnter(maybeNode, maybeAppearing);
|
|
129
|
+
this.safeSetState({
|
|
130
|
+
status: ENTERING
|
|
131
|
+
}, function() {
|
|
132
|
+
_this2.props.onEntering(maybeNode, maybeAppearing);
|
|
133
|
+
_this2.onTransitionEnd(enterTimeout, function() {
|
|
134
|
+
_this2.safeSetState({
|
|
135
|
+
status: ENTERED
|
|
136
|
+
}, function() {
|
|
137
|
+
_this2.props.onEntered(maybeNode, maybeAppearing);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
_proto.performExit = function performExit() {
|
|
143
|
+
var _this3 = this;
|
|
144
|
+
var exit = this.props.exit;
|
|
145
|
+
var timeouts = this.getTimeouts();
|
|
146
|
+
var maybeNode = this.props.nodeRef ? void 0 : ReactDOM.findDOMNode(this);
|
|
147
|
+
if (!exit || config.disabled) {
|
|
148
|
+
this.safeSetState({
|
|
149
|
+
status: EXITED
|
|
150
|
+
}, function() {
|
|
151
|
+
_this3.props.onExited(maybeNode);
|
|
152
|
+
});
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.props.onExit(maybeNode);
|
|
156
|
+
this.safeSetState({
|
|
157
|
+
status: EXITING
|
|
158
|
+
}, function() {
|
|
159
|
+
_this3.props.onExiting(maybeNode);
|
|
160
|
+
_this3.onTransitionEnd(timeouts.exit, function() {
|
|
161
|
+
_this3.safeSetState({
|
|
162
|
+
status: EXITED
|
|
163
|
+
}, function() {
|
|
164
|
+
_this3.props.onExited(maybeNode);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
_proto.cancelNextCallback = function cancelNextCallback() {
|
|
170
|
+
if (this.nextCallback !== null) {
|
|
171
|
+
this.nextCallback.cancel();
|
|
172
|
+
this.nextCallback = null;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
_proto.safeSetState = function safeSetState(nextState, callback) {
|
|
176
|
+
callback = this.setNextCallback(callback);
|
|
177
|
+
this.setState(nextState, callback);
|
|
178
|
+
};
|
|
179
|
+
_proto.setNextCallback = function setNextCallback(callback) {
|
|
180
|
+
var _this4 = this;
|
|
181
|
+
var active = true;
|
|
182
|
+
this.nextCallback = function(event) {
|
|
183
|
+
if (active) {
|
|
184
|
+
active = false;
|
|
185
|
+
_this4.nextCallback = null;
|
|
186
|
+
callback(event);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
this.nextCallback.cancel = function() {
|
|
190
|
+
active = false;
|
|
191
|
+
};
|
|
192
|
+
return this.nextCallback;
|
|
193
|
+
};
|
|
194
|
+
_proto.onTransitionEnd = function onTransitionEnd(timeout2, handler) {
|
|
195
|
+
this.setNextCallback(handler);
|
|
196
|
+
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
|
|
197
|
+
var doesNotHaveTimeoutOrListener = timeout2 == null && !this.props.addEndListener;
|
|
198
|
+
if (!node || doesNotHaveTimeoutOrListener) {
|
|
199
|
+
setTimeout(this.nextCallback, 0);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (this.props.addEndListener) {
|
|
203
|
+
var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback], maybeNode = _ref3[0], maybeNextCallback = _ref3[1];
|
|
204
|
+
this.props.addEndListener(maybeNode, maybeNextCallback);
|
|
205
|
+
}
|
|
206
|
+
if (timeout2 != null) {
|
|
207
|
+
setTimeout(this.nextCallback, timeout2);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
_proto.render = function render() {
|
|
211
|
+
var status = this.state.status;
|
|
212
|
+
if (status === UNMOUNTED) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
var _this$props = this.props, children = _this$props.children;
|
|
216
|
+
_this$props.in;
|
|
217
|
+
_this$props.mountOnEnter;
|
|
218
|
+
_this$props.unmountOnExit;
|
|
219
|
+
_this$props.appear;
|
|
220
|
+
_this$props.enter;
|
|
221
|
+
_this$props.exit;
|
|
222
|
+
_this$props.timeout;
|
|
223
|
+
_this$props.addEndListener;
|
|
224
|
+
_this$props.onEnter;
|
|
225
|
+
_this$props.onEntering;
|
|
226
|
+
_this$props.onEntered;
|
|
227
|
+
_this$props.onExit;
|
|
228
|
+
_this$props.onExiting;
|
|
229
|
+
_this$props.onExited;
|
|
230
|
+
_this$props.nodeRef;
|
|
231
|
+
var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
|
|
232
|
+
return (
|
|
233
|
+
// allows for nested Transitions
|
|
234
|
+
/* @__PURE__ */ React.createElement(TransitionGroupContext.Provider, {
|
|
235
|
+
value: null
|
|
236
|
+
}, typeof children === "function" ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))
|
|
237
|
+
);
|
|
238
|
+
};
|
|
239
|
+
return Transition2;
|
|
240
|
+
})(React.Component);
|
|
241
|
+
Transition.contextType = TransitionGroupContext;
|
|
242
|
+
Transition.propTypes = define_process_env_default.NODE_ENV !== "production" ? {
|
|
243
|
+
/**
|
|
244
|
+
* A React reference to DOM element that need to transition:
|
|
245
|
+
* https://stackoverflow.com/a/51127130/4671932
|
|
246
|
+
*
|
|
247
|
+
* - When `nodeRef` prop is used, `node` is not passed to callback functions
|
|
248
|
+
* (e.g. `onEnter`) because user already has direct access to the node.
|
|
249
|
+
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
|
|
250
|
+
* `nodeRef` need to be provided to `Transition` with changed `key` prop
|
|
251
|
+
* (see
|
|
252
|
+
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
|
|
253
|
+
*/
|
|
254
|
+
nodeRef: PropTypes.shape({
|
|
255
|
+
current: typeof Element === "undefined" ? PropTypes.any : function(propValue, key, componentName, location, propFullName, secret) {
|
|
256
|
+
var value = propValue[key];
|
|
257
|
+
return PropTypes.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
/**
|
|
261
|
+
* A `function` child can be used instead of a React element. This function is
|
|
262
|
+
* called with the current transition status (`'entering'`, `'entered'`,
|
|
263
|
+
* `'exiting'`, `'exited'`), which can be used to apply context
|
|
264
|
+
* specific props to a component.
|
|
265
|
+
*
|
|
266
|
+
* ```jsx
|
|
267
|
+
* <Transition in={this.state.in} timeout={150}>
|
|
268
|
+
* {state => (
|
|
269
|
+
* <MyComponent className={`fade fade-${state}`} />
|
|
270
|
+
* )}
|
|
271
|
+
* </Transition>
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
|
|
275
|
+
/**
|
|
276
|
+
* Show the component; triggers the enter or exit states
|
|
277
|
+
*/
|
|
278
|
+
in: PropTypes.bool,
|
|
279
|
+
/**
|
|
280
|
+
* By default the child component is mounted immediately along with
|
|
281
|
+
* the parent `Transition` component. If you want to "lazy mount" the component on the
|
|
282
|
+
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
|
|
283
|
+
* mounted, even on "exited", unless you also specify `unmountOnExit`.
|
|
284
|
+
*/
|
|
285
|
+
mountOnEnter: PropTypes.bool,
|
|
286
|
+
/**
|
|
287
|
+
* By default the child component stays mounted after it reaches the `'exited'` state.
|
|
288
|
+
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
|
|
289
|
+
*/
|
|
290
|
+
unmountOnExit: PropTypes.bool,
|
|
291
|
+
/**
|
|
292
|
+
* By default the child component does not perform the enter transition when
|
|
293
|
+
* it first mounts, regardless of the value of `in`. If you want this
|
|
294
|
+
* behavior, set both `appear` and `in` to `true`.
|
|
295
|
+
*
|
|
296
|
+
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
|
|
297
|
+
* > only adds an additional enter transition. However, in the
|
|
298
|
+
* > `<CSSTransition>` component that first enter transition does result in
|
|
299
|
+
* > additional `.appear-*` classes, that way you can choose to style it
|
|
300
|
+
* > differently.
|
|
301
|
+
*/
|
|
302
|
+
appear: PropTypes.bool,
|
|
303
|
+
/**
|
|
304
|
+
* Enable or disable enter transitions.
|
|
305
|
+
*/
|
|
306
|
+
enter: PropTypes.bool,
|
|
307
|
+
/**
|
|
308
|
+
* Enable or disable exit transitions.
|
|
309
|
+
*/
|
|
310
|
+
exit: PropTypes.bool,
|
|
311
|
+
/**
|
|
312
|
+
* The duration of the transition, in milliseconds.
|
|
313
|
+
* Required unless `addEndListener` is provided.
|
|
314
|
+
*
|
|
315
|
+
* You may specify a single timeout for all transitions:
|
|
316
|
+
*
|
|
317
|
+
* ```jsx
|
|
318
|
+
* timeout={500}
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* or individually:
|
|
322
|
+
*
|
|
323
|
+
* ```jsx
|
|
324
|
+
* timeout={{
|
|
325
|
+
* appear: 500,
|
|
326
|
+
* enter: 300,
|
|
327
|
+
* exit: 500,
|
|
328
|
+
* }}
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* - `appear` defaults to the value of `enter`
|
|
332
|
+
* - `enter` defaults to `0`
|
|
333
|
+
* - `exit` defaults to `0`
|
|
334
|
+
*
|
|
335
|
+
* @type {number | { enter?: number, exit?: number, appear?: number }}
|
|
336
|
+
*/
|
|
337
|
+
timeout: function timeout(props) {
|
|
338
|
+
var pt = timeoutsShape;
|
|
339
|
+
if (!props.addEndListener) pt = pt.isRequired;
|
|
340
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
341
|
+
args[_key - 1] = arguments[_key];
|
|
342
|
+
}
|
|
343
|
+
return pt.apply(void 0, [props].concat(args));
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* Add a custom transition end trigger. Called with the transitioning
|
|
347
|
+
* DOM node and a `done` callback. Allows for more fine grained transition end
|
|
348
|
+
* logic. Timeouts are still used as a fallback if provided.
|
|
349
|
+
*
|
|
350
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
351
|
+
*
|
|
352
|
+
* ```jsx
|
|
353
|
+
* addEndListener={(node, done) => {
|
|
354
|
+
* // use the css transitionend event to mark the finish of a transition
|
|
355
|
+
* node.addEventListener('transitionend', done, false);
|
|
356
|
+
* }}
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
addEndListener: PropTypes.func,
|
|
360
|
+
/**
|
|
361
|
+
* Callback fired before the "entering" status is applied. An extra parameter
|
|
362
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
363
|
+
*
|
|
364
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
365
|
+
*
|
|
366
|
+
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
367
|
+
*/
|
|
368
|
+
onEnter: PropTypes.func,
|
|
369
|
+
/**
|
|
370
|
+
* Callback fired after the "entering" status is applied. An extra parameter
|
|
371
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
372
|
+
*
|
|
373
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
374
|
+
*
|
|
375
|
+
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
376
|
+
*/
|
|
377
|
+
onEntering: PropTypes.func,
|
|
378
|
+
/**
|
|
379
|
+
* Callback fired after the "entered" status is applied. An extra parameter
|
|
380
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
381
|
+
*
|
|
382
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
383
|
+
*
|
|
384
|
+
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
385
|
+
*/
|
|
386
|
+
onEntered: PropTypes.func,
|
|
387
|
+
/**
|
|
388
|
+
* Callback fired before the "exiting" status is applied.
|
|
389
|
+
*
|
|
390
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
391
|
+
*
|
|
392
|
+
* @type Function(node: HtmlElement) -> void
|
|
393
|
+
*/
|
|
394
|
+
onExit: PropTypes.func,
|
|
395
|
+
/**
|
|
396
|
+
* Callback fired after the "exiting" status is applied.
|
|
397
|
+
*
|
|
398
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
399
|
+
*
|
|
400
|
+
* @type Function(node: HtmlElement) -> void
|
|
401
|
+
*/
|
|
402
|
+
onExiting: PropTypes.func,
|
|
403
|
+
/**
|
|
404
|
+
* Callback fired after the "exited" status is applied.
|
|
405
|
+
*
|
|
406
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
407
|
+
*
|
|
408
|
+
* @type Function(node: HtmlElement) -> void
|
|
409
|
+
*/
|
|
410
|
+
onExited: PropTypes.func
|
|
411
|
+
} : {};
|
|
412
|
+
function noop() {
|
|
413
|
+
}
|
|
414
|
+
Transition.defaultProps = {
|
|
415
|
+
in: false,
|
|
416
|
+
mountOnEnter: false,
|
|
417
|
+
unmountOnExit: false,
|
|
418
|
+
appear: false,
|
|
419
|
+
enter: true,
|
|
420
|
+
exit: true,
|
|
421
|
+
onEnter: noop,
|
|
422
|
+
onEntering: noop,
|
|
423
|
+
onEntered: noop,
|
|
424
|
+
onExit: noop,
|
|
425
|
+
onExiting: noop,
|
|
426
|
+
onExited: noop
|
|
427
|
+
};
|
|
428
|
+
Transition.UNMOUNTED = UNMOUNTED;
|
|
429
|
+
Transition.EXITED = EXITED;
|
|
430
|
+
Transition.ENTERING = ENTERING;
|
|
431
|
+
Transition.ENTERED = ENTERED;
|
|
432
|
+
Transition.EXITING = EXITING;
|
|
433
|
+
export {
|
|
434
|
+
ENTERED,
|
|
435
|
+
ENTERING,
|
|
436
|
+
EXITED,
|
|
437
|
+
EXITING,
|
|
438
|
+
UNMOUNTED,
|
|
439
|
+
Transition as default
|
|
440
|
+
};
|
|
441
|
+
//# sourceMappingURL=Transition.js.map
|