@bigbinary/neeto-molecules 3.2.1 → 3.2.3

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.
Files changed (61) hide show
  1. package/dist/BrowserSupport.js +2 -1
  2. package/dist/BrowserSupport.js.map +1 -1
  3. package/dist/DownloadMobileAppCallout.js +2 -1
  4. package/dist/DownloadMobileAppCallout.js.map +1 -1
  5. package/dist/EmailForm.js +2 -1
  6. package/dist/EmailForm.js.map +1 -1
  7. package/dist/FloatingActionMenu.js +2 -1
  8. package/dist/FloatingActionMenu.js.map +1 -1
  9. package/dist/IconPicker.js +916 -4
  10. package/dist/IconPicker.js.map +1 -1
  11. package/dist/IpRestriction.js +3093 -7
  12. package/dist/IpRestriction.js.map +1 -1
  13. package/dist/KeyboardShortcuts.js +2 -1
  14. package/dist/KeyboardShortcuts.js.map +1 -1
  15. package/dist/MenuBar.js +1804 -12
  16. package/dist/MenuBar.js.map +1 -1
  17. package/dist/NeetoWidget.js +1957 -3
  18. package/dist/NeetoWidget.js.map +1 -1
  19. package/dist/PhoneNumber.js +12 -4
  20. package/dist/PhoneNumber.js.map +1 -1
  21. package/dist/SendToFields.js +1919 -1
  22. package/dist/SendToFields.js.map +1 -1
  23. package/dist/ShareViaEmail.js +2 -1
  24. package/dist/ShareViaEmail.js.map +1 -1
  25. package/dist/ShareViaLink.js +860 -2
  26. package/dist/ShareViaLink.js.map +1 -1
  27. package/dist/_commonjsHelpers-1c8beb5f.js +4 -0
  28. package/dist/_commonjsHelpers-1c8beb5f.js.map +1 -0
  29. package/dist/cjs/BrowserSupport.js +3 -3
  30. package/dist/cjs/BrowserSupport.js.map +1 -1
  31. package/dist/cjs/DownloadMobileAppCallout.js +3 -3
  32. package/dist/cjs/DownloadMobileAppCallout.js.map +1 -1
  33. package/dist/cjs/EmailForm.js +2 -1
  34. package/dist/cjs/EmailForm.js.map +1 -1
  35. package/dist/cjs/FloatingActionMenu.js +2 -1
  36. package/dist/cjs/FloatingActionMenu.js.map +1 -1
  37. package/dist/cjs/IconPicker.js +920 -5
  38. package/dist/cjs/IconPicker.js.map +1 -1
  39. package/dist/cjs/IpRestriction.js +3101 -15
  40. package/dist/cjs/IpRestriction.js.map +1 -1
  41. package/dist/cjs/KeyboardShortcuts.js +3 -3
  42. package/dist/cjs/KeyboardShortcuts.js.map +1 -1
  43. package/dist/cjs/MenuBar.js +1807 -10
  44. package/dist/cjs/MenuBar.js.map +1 -1
  45. package/dist/cjs/NeetoWidget.js +1958 -5
  46. package/dist/cjs/NeetoWidget.js.map +1 -1
  47. package/dist/cjs/PhoneNumber.js +12 -4
  48. package/dist/cjs/PhoneNumber.js.map +1 -1
  49. package/dist/cjs/SendToFields.js +1921 -3
  50. package/dist/cjs/SendToFields.js.map +1 -1
  51. package/dist/cjs/ShareViaEmail.js +2 -1
  52. package/dist/cjs/ShareViaEmail.js.map +1 -1
  53. package/dist/cjs/ShareViaLink.js +860 -3
  54. package/dist/cjs/ShareViaLink.js.map +1 -1
  55. package/dist/cjs/_commonjsHelpers-68cdf74f.js +6 -0
  56. package/dist/cjs/_commonjsHelpers-68cdf74f.js.map +1 -0
  57. package/dist/cjs/platform-628b3bd8.js +1252 -0
  58. package/dist/cjs/platform-628b3bd8.js.map +1 -0
  59. package/dist/platform-e221afea.js +1250 -0
  60. package/dist/platform-e221afea.js.map +1 -0
  61. package/package.json +16 -17
@@ -5,8 +5,13 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
5
5
  var React = require('react');
6
6
  var classnames = require('classnames');
7
7
  var Typography = require('@bigbinary/neetoui/Typography');
8
- var reactTransitionGroup = require('react-transition-group');
9
- var _extends = require('@babel/runtime/helpers/extends');
8
+ var _extends = require('@babel/runtime/helpers/esm/extends');
9
+ var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/esm/objectWithoutPropertiesLoose');
10
+ var _inheritsLoose = require('@babel/runtime/helpers/esm/inheritsLoose');
11
+ var index = require('./index-248c4f4c.js');
12
+ var ReactDOM = require('react-dom');
13
+ var _assertThisInitialized = require('@babel/runtime/helpers/esm/assertThisInitialized');
14
+ var _extends$1 = require('@babel/runtime/helpers/extends');
10
15
  var Plus = require('@bigbinary/neeto-icons/Plus');
11
16
  var Button = require('@bigbinary/neetoui/Button');
12
17
  var injectCss = require('./inject-css-80a5faa3.js');
@@ -17,7 +22,6 @@ var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
17
22
  var Search$1 = require('@bigbinary/neeto-icons/Search');
18
23
  var Close = require('@bigbinary/neeto-icons/Close');
19
24
  var Input = require('@bigbinary/neetoui/Input');
20
- var index = require('./index-248c4f4c.js');
21
25
  var ramda = require('ramda');
22
26
 
23
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -28,6 +32,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
32
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
29
33
  var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
30
34
  var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
35
+ var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
36
+ var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
37
+ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
38
+ var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
39
+ var _extends__default$1 = /*#__PURE__*/_interopDefaultLegacy(_extends$1);
31
40
  var Plus__default = /*#__PURE__*/_interopDefaultLegacy(Plus);
32
41
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
33
42
  var withT__default = /*#__PURE__*/_interopDefaultLegacy(withT);
@@ -35,6 +44,1794 @@ var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search$1);
35
44
  var Close__default = /*#__PURE__*/_interopDefaultLegacy(Close);
36
45
  var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
37
46
 
47
+ /**
48
+ * Checks if a given element has a CSS class.
49
+ *
50
+ * @param element the element
51
+ * @param className the CSS class name
52
+ */
53
+ function hasClass(element, className) {
54
+ if (element.classList) return !!className && element.classList.contains(className);
55
+ return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
56
+ }
57
+
58
+ /**
59
+ * Adds a CSS class to a given element.
60
+ *
61
+ * @param element the element
62
+ * @param className the CSS class name
63
+ */
64
+
65
+ function addClass(element, className) {
66
+ 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);
67
+ }
68
+
69
+ function replaceClassName(origClass, classToRemove) {
70
+ return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
71
+ }
72
+ /**
73
+ * Removes a CSS class from a given element.
74
+ *
75
+ * @param element the element
76
+ * @param className the CSS class name
77
+ */
78
+
79
+
80
+ function removeClass$1(element, className) {
81
+ if (element.classList) {
82
+ element.classList.remove(className);
83
+ } else if (typeof element.className === 'string') {
84
+ element.className = replaceClassName(element.className, className);
85
+ } else {
86
+ element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
87
+ }
88
+ }
89
+
90
+ var config = {
91
+ disabled: false
92
+ };
93
+
94
+ var timeoutsShape = process.env.NODE_ENV !== 'production' ? index.propTypes.exports.oneOfType([index.propTypes.exports.number, index.propTypes.exports.shape({
95
+ enter: index.propTypes.exports.number,
96
+ exit: index.propTypes.exports.number,
97
+ appear: index.propTypes.exports.number
98
+ }).isRequired]) : null;
99
+ var classNamesShape = process.env.NODE_ENV !== 'production' ? index.propTypes.exports.oneOfType([index.propTypes.exports.string, index.propTypes.exports.shape({
100
+ enter: index.propTypes.exports.string,
101
+ exit: index.propTypes.exports.string,
102
+ active: index.propTypes.exports.string
103
+ }), index.propTypes.exports.shape({
104
+ enter: index.propTypes.exports.string,
105
+ enterDone: index.propTypes.exports.string,
106
+ enterActive: index.propTypes.exports.string,
107
+ exit: index.propTypes.exports.string,
108
+ exitDone: index.propTypes.exports.string,
109
+ exitActive: index.propTypes.exports.string
110
+ })]) : null;
111
+
112
+ var TransitionGroupContext = React__default["default"].createContext(null);
113
+
114
+ var forceReflow = function forceReflow(node) {
115
+ return node.scrollTop;
116
+ };
117
+
118
+ var UNMOUNTED = 'unmounted';
119
+ var EXITED = 'exited';
120
+ var ENTERING = 'entering';
121
+ var ENTERED = 'entered';
122
+ var EXITING = 'exiting';
123
+ /**
124
+ * The Transition component lets you describe a transition from one component
125
+ * state to another _over time_ with a simple declarative API. Most commonly
126
+ * it's used to animate the mounting and unmounting of a component, but can also
127
+ * be used to describe in-place transition states as well.
128
+ *
129
+ * ---
130
+ *
131
+ * **Note**: `Transition` is a platform-agnostic base component. If you're using
132
+ * transitions in CSS, you'll probably want to use
133
+ * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
134
+ * instead. It inherits all the features of `Transition`, but contains
135
+ * additional features necessary to play nice with CSS transitions (hence the
136
+ * name of the component).
137
+ *
138
+ * ---
139
+ *
140
+ * By default the `Transition` component does not alter the behavior of the
141
+ * component it renders, it only tracks "enter" and "exit" states for the
142
+ * components. It's up to you to give meaning and effect to those states. For
143
+ * example we can add styles to a component when it enters or exits:
144
+ *
145
+ * ```jsx
146
+ * import { Transition } from 'react-transition-group';
147
+ *
148
+ * const duration = 300;
149
+ *
150
+ * const defaultStyle = {
151
+ * transition: `opacity ${duration}ms ease-in-out`,
152
+ * opacity: 0,
153
+ * }
154
+ *
155
+ * const transitionStyles = {
156
+ * entering: { opacity: 1 },
157
+ * entered: { opacity: 1 },
158
+ * exiting: { opacity: 0 },
159
+ * exited: { opacity: 0 },
160
+ * };
161
+ *
162
+ * const Fade = ({ in: inProp }) => (
163
+ * <Transition in={inProp} timeout={duration}>
164
+ * {state => (
165
+ * <div style={{
166
+ * ...defaultStyle,
167
+ * ...transitionStyles[state]
168
+ * }}>
169
+ * I'm a fade Transition!
170
+ * </div>
171
+ * )}
172
+ * </Transition>
173
+ * );
174
+ * ```
175
+ *
176
+ * There are 4 main states a Transition can be in:
177
+ * - `'entering'`
178
+ * - `'entered'`
179
+ * - `'exiting'`
180
+ * - `'exited'`
181
+ *
182
+ * Transition state is toggled via the `in` prop. When `true` the component
183
+ * begins the "Enter" stage. During this stage, the component will shift from
184
+ * its current transition state, to `'entering'` for the duration of the
185
+ * transition and then to the `'entered'` stage once it's complete. Let's take
186
+ * the following example (we'll use the
187
+ * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
188
+ *
189
+ * ```jsx
190
+ * function App() {
191
+ * const [inProp, setInProp] = useState(false);
192
+ * return (
193
+ * <div>
194
+ * <Transition in={inProp} timeout={500}>
195
+ * {state => (
196
+ * // ...
197
+ * )}
198
+ * </Transition>
199
+ * <button onClick={() => setInProp(true)}>
200
+ * Click to Enter
201
+ * </button>
202
+ * </div>
203
+ * );
204
+ * }
205
+ * ```
206
+ *
207
+ * When the button is clicked the component will shift to the `'entering'` state
208
+ * and stay there for 500ms (the value of `timeout`) before it finally switches
209
+ * to `'entered'`.
210
+ *
211
+ * When `in` is `false` the same thing happens except the state moves from
212
+ * `'exiting'` to `'exited'`.
213
+ */
214
+
215
+ var Transition = /*#__PURE__*/function (_React$Component) {
216
+ _inheritsLoose__default["default"](Transition, _React$Component);
217
+
218
+ function Transition(props, context) {
219
+ var _this;
220
+
221
+ _this = _React$Component.call(this, props, context) || this;
222
+ var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
223
+
224
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
225
+ var initialStatus;
226
+ _this.appearStatus = null;
227
+
228
+ if (props.in) {
229
+ if (appear) {
230
+ initialStatus = EXITED;
231
+ _this.appearStatus = ENTERING;
232
+ } else {
233
+ initialStatus = ENTERED;
234
+ }
235
+ } else {
236
+ if (props.unmountOnExit || props.mountOnEnter) {
237
+ initialStatus = UNMOUNTED;
238
+ } else {
239
+ initialStatus = EXITED;
240
+ }
241
+ }
242
+
243
+ _this.state = {
244
+ status: initialStatus
245
+ };
246
+ _this.nextCallback = null;
247
+ return _this;
248
+ }
249
+
250
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
251
+ var nextIn = _ref.in;
252
+
253
+ if (nextIn && prevState.status === UNMOUNTED) {
254
+ return {
255
+ status: EXITED
256
+ };
257
+ }
258
+
259
+ return null;
260
+ } // getSnapshotBeforeUpdate(prevProps) {
261
+ // let nextStatus = null
262
+ // if (prevProps !== this.props) {
263
+ // const { status } = this.state
264
+ // if (this.props.in) {
265
+ // if (status !== ENTERING && status !== ENTERED) {
266
+ // nextStatus = ENTERING
267
+ // }
268
+ // } else {
269
+ // if (status === ENTERING || status === ENTERED) {
270
+ // nextStatus = EXITING
271
+ // }
272
+ // }
273
+ // }
274
+ // return { nextStatus }
275
+ // }
276
+ ;
277
+
278
+ var _proto = Transition.prototype;
279
+
280
+ _proto.componentDidMount = function componentDidMount() {
281
+ this.updateStatus(true, this.appearStatus);
282
+ };
283
+
284
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
285
+ var nextStatus = null;
286
+
287
+ if (prevProps !== this.props) {
288
+ var status = this.state.status;
289
+
290
+ if (this.props.in) {
291
+ if (status !== ENTERING && status !== ENTERED) {
292
+ nextStatus = ENTERING;
293
+ }
294
+ } else {
295
+ if (status === ENTERING || status === ENTERED) {
296
+ nextStatus = EXITING;
297
+ }
298
+ }
299
+ }
300
+
301
+ this.updateStatus(false, nextStatus);
302
+ };
303
+
304
+ _proto.componentWillUnmount = function componentWillUnmount() {
305
+ this.cancelNextCallback();
306
+ };
307
+
308
+ _proto.getTimeouts = function getTimeouts() {
309
+ var timeout = this.props.timeout;
310
+ var exit, enter, appear;
311
+ exit = enter = appear = timeout;
312
+
313
+ if (timeout != null && typeof timeout !== 'number') {
314
+ exit = timeout.exit;
315
+ enter = timeout.enter; // TODO: remove fallback for next major
316
+
317
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
318
+ }
319
+
320
+ return {
321
+ exit: exit,
322
+ enter: enter,
323
+ appear: appear
324
+ };
325
+ };
326
+
327
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
328
+ if (mounting === void 0) {
329
+ mounting = false;
330
+ }
331
+
332
+ if (nextStatus !== null) {
333
+ // nextStatus will always be ENTERING or EXITING.
334
+ this.cancelNextCallback();
335
+
336
+ if (nextStatus === ENTERING) {
337
+ if (this.props.unmountOnExit || this.props.mountOnEnter) {
338
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default["default"].findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
339
+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
340
+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
341
+
342
+ if (node) forceReflow(node);
343
+ }
344
+
345
+ this.performEnter(mounting);
346
+ } else {
347
+ this.performExit();
348
+ }
349
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
350
+ this.setState({
351
+ status: UNMOUNTED
352
+ });
353
+ }
354
+ };
355
+
356
+ _proto.performEnter = function performEnter(mounting) {
357
+ var _this2 = this;
358
+
359
+ var enter = this.props.enter;
360
+ var appearing = this.context ? this.context.isMounting : mounting;
361
+
362
+ var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM__default["default"].findDOMNode(this), appearing],
363
+ maybeNode = _ref2[0],
364
+ maybeAppearing = _ref2[1];
365
+
366
+ var timeouts = this.getTimeouts();
367
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
368
+ // if we are mounting and running this it means appear _must_ be set
369
+
370
+ if (!mounting && !enter || config.disabled) {
371
+ this.safeSetState({
372
+ status: ENTERED
373
+ }, function () {
374
+ _this2.props.onEntered(maybeNode);
375
+ });
376
+ return;
377
+ }
378
+
379
+ this.props.onEnter(maybeNode, maybeAppearing);
380
+ this.safeSetState({
381
+ status: ENTERING
382
+ }, function () {
383
+ _this2.props.onEntering(maybeNode, maybeAppearing);
384
+
385
+ _this2.onTransitionEnd(enterTimeout, function () {
386
+ _this2.safeSetState({
387
+ status: ENTERED
388
+ }, function () {
389
+ _this2.props.onEntered(maybeNode, maybeAppearing);
390
+ });
391
+ });
392
+ });
393
+ };
394
+
395
+ _proto.performExit = function performExit() {
396
+ var _this3 = this;
397
+
398
+ var exit = this.props.exit;
399
+ var timeouts = this.getTimeouts();
400
+ var maybeNode = this.props.nodeRef ? undefined : ReactDOM__default["default"].findDOMNode(this); // no exit animation skip right to EXITED
401
+
402
+ if (!exit || config.disabled) {
403
+ this.safeSetState({
404
+ status: EXITED
405
+ }, function () {
406
+ _this3.props.onExited(maybeNode);
407
+ });
408
+ return;
409
+ }
410
+
411
+ this.props.onExit(maybeNode);
412
+ this.safeSetState({
413
+ status: EXITING
414
+ }, function () {
415
+ _this3.props.onExiting(maybeNode);
416
+
417
+ _this3.onTransitionEnd(timeouts.exit, function () {
418
+ _this3.safeSetState({
419
+ status: EXITED
420
+ }, function () {
421
+ _this3.props.onExited(maybeNode);
422
+ });
423
+ });
424
+ });
425
+ };
426
+
427
+ _proto.cancelNextCallback = function cancelNextCallback() {
428
+ if (this.nextCallback !== null) {
429
+ this.nextCallback.cancel();
430
+ this.nextCallback = null;
431
+ }
432
+ };
433
+
434
+ _proto.safeSetState = function safeSetState(nextState, callback) {
435
+ // This shouldn't be necessary, but there are weird race conditions with
436
+ // setState callbacks and unmounting in testing, so always make sure that
437
+ // we can cancel any pending setState callbacks after we unmount.
438
+ callback = this.setNextCallback(callback);
439
+ this.setState(nextState, callback);
440
+ };
441
+
442
+ _proto.setNextCallback = function setNextCallback(callback) {
443
+ var _this4 = this;
444
+
445
+ var active = true;
446
+
447
+ this.nextCallback = function (event) {
448
+ if (active) {
449
+ active = false;
450
+ _this4.nextCallback = null;
451
+ callback(event);
452
+ }
453
+ };
454
+
455
+ this.nextCallback.cancel = function () {
456
+ active = false;
457
+ };
458
+
459
+ return this.nextCallback;
460
+ };
461
+
462
+ _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
463
+ this.setNextCallback(handler);
464
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default["default"].findDOMNode(this);
465
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
466
+
467
+ if (!node || doesNotHaveTimeoutOrListener) {
468
+ setTimeout(this.nextCallback, 0);
469
+ return;
470
+ }
471
+
472
+ if (this.props.addEndListener) {
473
+ var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
474
+ maybeNode = _ref3[0],
475
+ maybeNextCallback = _ref3[1];
476
+
477
+ this.props.addEndListener(maybeNode, maybeNextCallback);
478
+ }
479
+
480
+ if (timeout != null) {
481
+ setTimeout(this.nextCallback, timeout);
482
+ }
483
+ };
484
+
485
+ _proto.render = function render() {
486
+ var status = this.state.status;
487
+
488
+ if (status === UNMOUNTED) {
489
+ return null;
490
+ }
491
+
492
+ var _this$props = this.props,
493
+ children = _this$props.children;
494
+ _this$props.in;
495
+ _this$props.mountOnEnter;
496
+ _this$props.unmountOnExit;
497
+ _this$props.appear;
498
+ _this$props.enter;
499
+ _this$props.exit;
500
+ _this$props.timeout;
501
+ _this$props.addEndListener;
502
+ _this$props.onEnter;
503
+ _this$props.onEntering;
504
+ _this$props.onEntered;
505
+ _this$props.onExit;
506
+ _this$props.onExiting;
507
+ _this$props.onExited;
508
+ _this$props.nodeRef;
509
+ var childProps = _objectWithoutPropertiesLoose__default["default"](_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
510
+
511
+ return (
512
+ /*#__PURE__*/
513
+ // allows for nested Transitions
514
+ React__default["default"].createElement(TransitionGroupContext.Provider, {
515
+ value: null
516
+ }, typeof children === 'function' ? children(status, childProps) : React__default["default"].cloneElement(React__default["default"].Children.only(children), childProps))
517
+ );
518
+ };
519
+
520
+ return Transition;
521
+ }(React__default["default"].Component);
522
+
523
+ Transition.contextType = TransitionGroupContext;
524
+ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
525
+ /**
526
+ * A React reference to DOM element that need to transition:
527
+ * https://stackoverflow.com/a/51127130/4671932
528
+ *
529
+ * - When `nodeRef` prop is used, `node` is not passed to callback functions
530
+ * (e.g. `onEnter`) because user already has direct access to the node.
531
+ * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
532
+ * `nodeRef` need to be provided to `Transition` with changed `key` prop
533
+ * (see
534
+ * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
535
+ */
536
+ nodeRef: index.propTypes.exports.shape({
537
+ current: typeof Element === 'undefined' ? index.propTypes.exports.any : function (propValue, key, componentName, location, propFullName, secret) {
538
+ var value = propValue[key];
539
+ return index.propTypes.exports.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
540
+ }
541
+ }),
542
+
543
+ /**
544
+ * A `function` child can be used instead of a React element. This function is
545
+ * called with the current transition status (`'entering'`, `'entered'`,
546
+ * `'exiting'`, `'exited'`), which can be used to apply context
547
+ * specific props to a component.
548
+ *
549
+ * ```jsx
550
+ * <Transition in={this.state.in} timeout={150}>
551
+ * {state => (
552
+ * <MyComponent className={`fade fade-${state}`} />
553
+ * )}
554
+ * </Transition>
555
+ * ```
556
+ */
557
+ children: index.propTypes.exports.oneOfType([index.propTypes.exports.func.isRequired, index.propTypes.exports.element.isRequired]).isRequired,
558
+
559
+ /**
560
+ * Show the component; triggers the enter or exit states
561
+ */
562
+ in: index.propTypes.exports.bool,
563
+
564
+ /**
565
+ * By default the child component is mounted immediately along with
566
+ * the parent `Transition` component. If you want to "lazy mount" the component on the
567
+ * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
568
+ * mounted, even on "exited", unless you also specify `unmountOnExit`.
569
+ */
570
+ mountOnEnter: index.propTypes.exports.bool,
571
+
572
+ /**
573
+ * By default the child component stays mounted after it reaches the `'exited'` state.
574
+ * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
575
+ */
576
+ unmountOnExit: index.propTypes.exports.bool,
577
+
578
+ /**
579
+ * By default the child component does not perform the enter transition when
580
+ * it first mounts, regardless of the value of `in`. If you want this
581
+ * behavior, set both `appear` and `in` to `true`.
582
+ *
583
+ * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
584
+ * > only adds an additional enter transition. However, in the
585
+ * > `<CSSTransition>` component that first enter transition does result in
586
+ * > additional `.appear-*` classes, that way you can choose to style it
587
+ * > differently.
588
+ */
589
+ appear: index.propTypes.exports.bool,
590
+
591
+ /**
592
+ * Enable or disable enter transitions.
593
+ */
594
+ enter: index.propTypes.exports.bool,
595
+
596
+ /**
597
+ * Enable or disable exit transitions.
598
+ */
599
+ exit: index.propTypes.exports.bool,
600
+
601
+ /**
602
+ * The duration of the transition, in milliseconds.
603
+ * Required unless `addEndListener` is provided.
604
+ *
605
+ * You may specify a single timeout for all transitions:
606
+ *
607
+ * ```jsx
608
+ * timeout={500}
609
+ * ```
610
+ *
611
+ * or individually:
612
+ *
613
+ * ```jsx
614
+ * timeout={{
615
+ * appear: 500,
616
+ * enter: 300,
617
+ * exit: 500,
618
+ * }}
619
+ * ```
620
+ *
621
+ * - `appear` defaults to the value of `enter`
622
+ * - `enter` defaults to `0`
623
+ * - `exit` defaults to `0`
624
+ *
625
+ * @type {number | { enter?: number, exit?: number, appear?: number }}
626
+ */
627
+ timeout: function timeout(props) {
628
+ var pt = timeoutsShape;
629
+ if (!props.addEndListener) pt = pt.isRequired;
630
+
631
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
632
+ args[_key - 1] = arguments[_key];
633
+ }
634
+
635
+ return pt.apply(void 0, [props].concat(args));
636
+ },
637
+
638
+ /**
639
+ * Add a custom transition end trigger. Called with the transitioning
640
+ * DOM node and a `done` callback. Allows for more fine grained transition end
641
+ * logic. Timeouts are still used as a fallback if provided.
642
+ *
643
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
644
+ *
645
+ * ```jsx
646
+ * addEndListener={(node, done) => {
647
+ * // use the css transitionend event to mark the finish of a transition
648
+ * node.addEventListener('transitionend', done, false);
649
+ * }}
650
+ * ```
651
+ */
652
+ addEndListener: index.propTypes.exports.func,
653
+
654
+ /**
655
+ * Callback fired before the "entering" status is applied. An extra parameter
656
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
657
+ *
658
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
659
+ *
660
+ * @type Function(node: HtmlElement, isAppearing: bool) -> void
661
+ */
662
+ onEnter: index.propTypes.exports.func,
663
+
664
+ /**
665
+ * Callback fired after the "entering" status is applied. An extra parameter
666
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
667
+ *
668
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
669
+ *
670
+ * @type Function(node: HtmlElement, isAppearing: bool)
671
+ */
672
+ onEntering: index.propTypes.exports.func,
673
+
674
+ /**
675
+ * Callback fired after the "entered" status is applied. An extra parameter
676
+ * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
677
+ *
678
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
679
+ *
680
+ * @type Function(node: HtmlElement, isAppearing: bool) -> void
681
+ */
682
+ onEntered: index.propTypes.exports.func,
683
+
684
+ /**
685
+ * Callback fired before the "exiting" status is applied.
686
+ *
687
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
688
+ *
689
+ * @type Function(node: HtmlElement) -> void
690
+ */
691
+ onExit: index.propTypes.exports.func,
692
+
693
+ /**
694
+ * Callback fired after the "exiting" status is applied.
695
+ *
696
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
697
+ *
698
+ * @type Function(node: HtmlElement) -> void
699
+ */
700
+ onExiting: index.propTypes.exports.func,
701
+
702
+ /**
703
+ * Callback fired after the "exited" status is applied.
704
+ *
705
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
706
+ *
707
+ * @type Function(node: HtmlElement) -> void
708
+ */
709
+ onExited: index.propTypes.exports.func
710
+ } : {}; // Name the function so it is clearer in the documentation
711
+
712
+ function noop() {}
713
+
714
+ Transition.defaultProps = {
715
+ in: false,
716
+ mountOnEnter: false,
717
+ unmountOnExit: false,
718
+ appear: false,
719
+ enter: true,
720
+ exit: true,
721
+ onEnter: noop,
722
+ onEntering: noop,
723
+ onEntered: noop,
724
+ onExit: noop,
725
+ onExiting: noop,
726
+ onExited: noop
727
+ };
728
+ Transition.UNMOUNTED = UNMOUNTED;
729
+ Transition.EXITED = EXITED;
730
+ Transition.ENTERING = ENTERING;
731
+ Transition.ENTERED = ENTERED;
732
+ Transition.EXITING = EXITING;
733
+
734
+ var _addClass = function addClass$1(node, classes) {
735
+ return node && classes && classes.split(' ').forEach(function (c) {
736
+ return addClass(node, c);
737
+ });
738
+ };
739
+
740
+ var removeClass = function removeClass(node, classes) {
741
+ return node && classes && classes.split(' ').forEach(function (c) {
742
+ return removeClass$1(node, c);
743
+ });
744
+ };
745
+ /**
746
+ * A transition component inspired by the excellent
747
+ * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
748
+ * use it if you're using CSS transitions or animations. It's built upon the
749
+ * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
750
+ * component, so it inherits all of its props.
751
+ *
752
+ * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
753
+ * and `exit` states of the transition. The first class is applied and then a
754
+ * second `*-active` class in order to activate the CSS transition. After the
755
+ * transition, matching `*-done` class names are applied to persist the
756
+ * transition state.
757
+ *
758
+ * ```jsx
759
+ * function App() {
760
+ * const [inProp, setInProp] = useState(false);
761
+ * return (
762
+ * <div>
763
+ * <CSSTransition in={inProp} timeout={200} classNames="my-node">
764
+ * <div>
765
+ * {"I'll receive my-node-* classes"}
766
+ * </div>
767
+ * </CSSTransition>
768
+ * <button type="button" onClick={() => setInProp(true)}>
769
+ * Click to Enter
770
+ * </button>
771
+ * </div>
772
+ * );
773
+ * }
774
+ * ```
775
+ *
776
+ * When the `in` prop is set to `true`, the child component will first receive
777
+ * the class `example-enter`, then the `example-enter-active` will be added in
778
+ * the next tick. `CSSTransition` [forces a
779
+ * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
780
+ * between before adding the `example-enter-active`. This is an important trick
781
+ * because it allows us to transition between `example-enter` and
782
+ * `example-enter-active` even though they were added immediately one after
783
+ * another. Most notably, this is what makes it possible for us to animate
784
+ * _appearance_.
785
+ *
786
+ * ```css
787
+ * .my-node-enter {
788
+ * opacity: 0;
789
+ * }
790
+ * .my-node-enter-active {
791
+ * opacity: 1;
792
+ * transition: opacity 200ms;
793
+ * }
794
+ * .my-node-exit {
795
+ * opacity: 1;
796
+ * }
797
+ * .my-node-exit-active {
798
+ * opacity: 0;
799
+ * transition: opacity 200ms;
800
+ * }
801
+ * ```
802
+ *
803
+ * `*-active` classes represent which styles you want to animate **to**, so it's
804
+ * important to add `transition` declaration only to them, otherwise transitions
805
+ * might not behave as intended! This might not be obvious when the transitions
806
+ * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
807
+ * the example above (minus `transition`), but it becomes apparent in more
808
+ * complex transitions.
809
+ *
810
+ * **Note**: If you're using the
811
+ * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
812
+ * prop, make sure to define styles for `.appear-*` classes as well.
813
+ */
814
+
815
+
816
+ var CSSTransition = /*#__PURE__*/function (_React$Component) {
817
+ _inheritsLoose__default["default"](CSSTransition, _React$Component);
818
+
819
+ function CSSTransition() {
820
+ var _this;
821
+
822
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
823
+ args[_key] = arguments[_key];
824
+ }
825
+
826
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
827
+ _this.appliedClasses = {
828
+ appear: {},
829
+ enter: {},
830
+ exit: {}
831
+ };
832
+
833
+ _this.onEnter = function (maybeNode, maybeAppearing) {
834
+ var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
835
+ node = _this$resolveArgument[0],
836
+ appearing = _this$resolveArgument[1];
837
+
838
+ _this.removeClasses(node, 'exit');
839
+
840
+ _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
841
+
842
+ if (_this.props.onEnter) {
843
+ _this.props.onEnter(maybeNode, maybeAppearing);
844
+ }
845
+ };
846
+
847
+ _this.onEntering = function (maybeNode, maybeAppearing) {
848
+ var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
849
+ node = _this$resolveArgument2[0],
850
+ appearing = _this$resolveArgument2[1];
851
+
852
+ var type = appearing ? 'appear' : 'enter';
853
+
854
+ _this.addClass(node, type, 'active');
855
+
856
+ if (_this.props.onEntering) {
857
+ _this.props.onEntering(maybeNode, maybeAppearing);
858
+ }
859
+ };
860
+
861
+ _this.onEntered = function (maybeNode, maybeAppearing) {
862
+ var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
863
+ node = _this$resolveArgument3[0],
864
+ appearing = _this$resolveArgument3[1];
865
+
866
+ var type = appearing ? 'appear' : 'enter';
867
+
868
+ _this.removeClasses(node, type);
869
+
870
+ _this.addClass(node, type, 'done');
871
+
872
+ if (_this.props.onEntered) {
873
+ _this.props.onEntered(maybeNode, maybeAppearing);
874
+ }
875
+ };
876
+
877
+ _this.onExit = function (maybeNode) {
878
+ var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
879
+ node = _this$resolveArgument4[0];
880
+
881
+ _this.removeClasses(node, 'appear');
882
+
883
+ _this.removeClasses(node, 'enter');
884
+
885
+ _this.addClass(node, 'exit', 'base');
886
+
887
+ if (_this.props.onExit) {
888
+ _this.props.onExit(maybeNode);
889
+ }
890
+ };
891
+
892
+ _this.onExiting = function (maybeNode) {
893
+ var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
894
+ node = _this$resolveArgument5[0];
895
+
896
+ _this.addClass(node, 'exit', 'active');
897
+
898
+ if (_this.props.onExiting) {
899
+ _this.props.onExiting(maybeNode);
900
+ }
901
+ };
902
+
903
+ _this.onExited = function (maybeNode) {
904
+ var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
905
+ node = _this$resolveArgument6[0];
906
+
907
+ _this.removeClasses(node, 'exit');
908
+
909
+ _this.addClass(node, 'exit', 'done');
910
+
911
+ if (_this.props.onExited) {
912
+ _this.props.onExited(maybeNode);
913
+ }
914
+ };
915
+
916
+ _this.resolveArguments = function (maybeNode, maybeAppearing) {
917
+ return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
918
+ : [maybeNode, maybeAppearing];
919
+ };
920
+
921
+ _this.getClassNames = function (type) {
922
+ var classNames = _this.props.classNames;
923
+ var isStringClassNames = typeof classNames === 'string';
924
+ var prefix = isStringClassNames && classNames ? classNames + "-" : '';
925
+ var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
926
+ var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
927
+ var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
928
+ return {
929
+ baseClassName: baseClassName,
930
+ activeClassName: activeClassName,
931
+ doneClassName: doneClassName
932
+ };
933
+ };
934
+
935
+ return _this;
936
+ }
937
+
938
+ var _proto = CSSTransition.prototype;
939
+
940
+ _proto.addClass = function addClass(node, type, phase) {
941
+ var className = this.getClassNames(type)[phase + "ClassName"];
942
+
943
+ var _this$getClassNames = this.getClassNames('enter'),
944
+ doneClassName = _this$getClassNames.doneClassName;
945
+
946
+ if (type === 'appear' && phase === 'done' && doneClassName) {
947
+ className += " " + doneClassName;
948
+ } // This is to force a repaint,
949
+ // which is necessary in order to transition styles when adding a class name.
950
+
951
+
952
+ if (phase === 'active') {
953
+ if (node) forceReflow(node);
954
+ }
955
+
956
+ if (className) {
957
+ this.appliedClasses[type][phase] = className;
958
+
959
+ _addClass(node, className);
960
+ }
961
+ };
962
+
963
+ _proto.removeClasses = function removeClasses(node, type) {
964
+ var _this$appliedClasses$ = this.appliedClasses[type],
965
+ baseClassName = _this$appliedClasses$.base,
966
+ activeClassName = _this$appliedClasses$.active,
967
+ doneClassName = _this$appliedClasses$.done;
968
+ this.appliedClasses[type] = {};
969
+
970
+ if (baseClassName) {
971
+ removeClass(node, baseClassName);
972
+ }
973
+
974
+ if (activeClassName) {
975
+ removeClass(node, activeClassName);
976
+ }
977
+
978
+ if (doneClassName) {
979
+ removeClass(node, doneClassName);
980
+ }
981
+ };
982
+
983
+ _proto.render = function render() {
984
+ var _this$props = this.props;
985
+ _this$props.classNames;
986
+ var props = _objectWithoutPropertiesLoose__default["default"](_this$props, ["classNames"]);
987
+
988
+ return /*#__PURE__*/React__default["default"].createElement(Transition, _extends__default["default"]({}, props, {
989
+ onEnter: this.onEnter,
990
+ onEntered: this.onEntered,
991
+ onEntering: this.onEntering,
992
+ onExit: this.onExit,
993
+ onExiting: this.onExiting,
994
+ onExited: this.onExited
995
+ }));
996
+ };
997
+
998
+ return CSSTransition;
999
+ }(React__default["default"].Component);
1000
+
1001
+ CSSTransition.defaultProps = {
1002
+ classNames: ''
1003
+ };
1004
+ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends__default["default"]({}, Transition.propTypes, {
1005
+ /**
1006
+ * The animation classNames applied to the component as it appears, enters,
1007
+ * exits or has finished the transition. A single name can be provided, which
1008
+ * will be suffixed for each stage, e.g. `classNames="fade"` applies:
1009
+ *
1010
+ * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
1011
+ * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
1012
+ * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
1013
+ *
1014
+ * A few details to note about how these classes are applied:
1015
+ *
1016
+ * 1. They are _joined_ with the ones that are already defined on the child
1017
+ * component, so if you want to add some base styles, you can use
1018
+ * `className` without worrying that it will be overridden.
1019
+ *
1020
+ * 2. If the transition component mounts with `in={false}`, no classes are
1021
+ * applied yet. You might be expecting `*-exit-done`, but if you think
1022
+ * about it, a component cannot finish exiting if it hasn't entered yet.
1023
+ *
1024
+ * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
1025
+ * allows you to define different behavior for when appearing is done and
1026
+ * when regular entering is done, using selectors like
1027
+ * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
1028
+ * an epic entrance animation when element first appears in the DOM using
1029
+ * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
1030
+ * simply use `fade-enter-done` for defining both cases.
1031
+ *
1032
+ * Each individual classNames can also be specified independently like:
1033
+ *
1034
+ * ```js
1035
+ * classNames={{
1036
+ * appear: 'my-appear',
1037
+ * appearActive: 'my-active-appear',
1038
+ * appearDone: 'my-done-appear',
1039
+ * enter: 'my-enter',
1040
+ * enterActive: 'my-active-enter',
1041
+ * enterDone: 'my-done-enter',
1042
+ * exit: 'my-exit',
1043
+ * exitActive: 'my-active-exit',
1044
+ * exitDone: 'my-done-exit',
1045
+ * }}
1046
+ * ```
1047
+ *
1048
+ * If you want to set these classes using CSS Modules:
1049
+ *
1050
+ * ```js
1051
+ * import styles from './styles.css';
1052
+ * ```
1053
+ *
1054
+ * you might want to use camelCase in your CSS file, that way could simply
1055
+ * spread them instead of listing them one by one:
1056
+ *
1057
+ * ```js
1058
+ * classNames={{ ...styles }}
1059
+ * ```
1060
+ *
1061
+ * @type {string | {
1062
+ * appear?: string,
1063
+ * appearActive?: string,
1064
+ * appearDone?: string,
1065
+ * enter?: string,
1066
+ * enterActive?: string,
1067
+ * enterDone?: string,
1068
+ * exit?: string,
1069
+ * exitActive?: string,
1070
+ * exitDone?: string,
1071
+ * }}
1072
+ */
1073
+ classNames: classNamesShape,
1074
+
1075
+ /**
1076
+ * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
1077
+ * applied.
1078
+ *
1079
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1080
+ *
1081
+ * @type Function(node: HtmlElement, isAppearing: bool)
1082
+ */
1083
+ onEnter: index.propTypes.exports.func,
1084
+
1085
+ /**
1086
+ * A `<Transition>` callback fired immediately after the 'enter-active' or
1087
+ * 'appear-active' class is applied.
1088
+ *
1089
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1090
+ *
1091
+ * @type Function(node: HtmlElement, isAppearing: bool)
1092
+ */
1093
+ onEntering: index.propTypes.exports.func,
1094
+
1095
+ /**
1096
+ * A `<Transition>` callback fired immediately after the 'enter' or
1097
+ * 'appear' classes are **removed** and the `done` class is added to the DOM node.
1098
+ *
1099
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed.
1100
+ *
1101
+ * @type Function(node: HtmlElement, isAppearing: bool)
1102
+ */
1103
+ onEntered: index.propTypes.exports.func,
1104
+
1105
+ /**
1106
+ * A `<Transition>` callback fired immediately after the 'exit' class is
1107
+ * applied.
1108
+ *
1109
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
1110
+ *
1111
+ * @type Function(node: HtmlElement)
1112
+ */
1113
+ onExit: index.propTypes.exports.func,
1114
+
1115
+ /**
1116
+ * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
1117
+ *
1118
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
1119
+ *
1120
+ * @type Function(node: HtmlElement)
1121
+ */
1122
+ onExiting: index.propTypes.exports.func,
1123
+
1124
+ /**
1125
+ * A `<Transition>` callback fired immediately after the 'exit' classes
1126
+ * are **removed** and the `exit-done` class is added to the DOM node.
1127
+ *
1128
+ * **Note**: when `nodeRef` prop is passed, `node` is not passed
1129
+ *
1130
+ * @type Function(node: HtmlElement)
1131
+ */
1132
+ onExited: index.propTypes.exports.func
1133
+ }) : {};
1134
+
1135
+ /**
1136
+ * Given `this.props.children`, return an object mapping key to child.
1137
+ *
1138
+ * @param {*} children `this.props.children`
1139
+ * @return {object} Mapping of key to child
1140
+ */
1141
+
1142
+ function getChildMapping(children, mapFn) {
1143
+ var mapper = function mapper(child) {
1144
+ return mapFn && React.isValidElement(child) ? mapFn(child) : child;
1145
+ };
1146
+
1147
+ var result = Object.create(null);
1148
+ if (children) React.Children.map(children, function (c) {
1149
+ return c;
1150
+ }).forEach(function (child) {
1151
+ // run the map function here instead so that the key is the computed one
1152
+ result[child.key] = mapper(child);
1153
+ });
1154
+ return result;
1155
+ }
1156
+ /**
1157
+ * When you're adding or removing children some may be added or removed in the
1158
+ * same render pass. We want to show *both* since we want to simultaneously
1159
+ * animate elements in and out. This function takes a previous set of keys
1160
+ * and a new set of keys and merges them with its best guess of the correct
1161
+ * ordering. In the future we may expose some of the utilities in
1162
+ * ReactMultiChild to make this easy, but for now React itself does not
1163
+ * directly have this concept of the union of prevChildren and nextChildren
1164
+ * so we implement it here.
1165
+ *
1166
+ * @param {object} prev prev children as returned from
1167
+ * `ReactTransitionChildMapping.getChildMapping()`.
1168
+ * @param {object} next next children as returned from
1169
+ * `ReactTransitionChildMapping.getChildMapping()`.
1170
+ * @return {object} a key set that contains all keys in `prev` and all keys
1171
+ * in `next` in a reasonable order.
1172
+ */
1173
+
1174
+ function mergeChildMappings(prev, next) {
1175
+ prev = prev || {};
1176
+ next = next || {};
1177
+
1178
+ function getValueForKey(key) {
1179
+ return key in next ? next[key] : prev[key];
1180
+ } // For each key of `next`, the list of keys to insert before that key in
1181
+ // the combined list
1182
+
1183
+
1184
+ var nextKeysPending = Object.create(null);
1185
+ var pendingKeys = [];
1186
+
1187
+ for (var prevKey in prev) {
1188
+ if (prevKey in next) {
1189
+ if (pendingKeys.length) {
1190
+ nextKeysPending[prevKey] = pendingKeys;
1191
+ pendingKeys = [];
1192
+ }
1193
+ } else {
1194
+ pendingKeys.push(prevKey);
1195
+ }
1196
+ }
1197
+
1198
+ var i;
1199
+ var childMapping = {};
1200
+
1201
+ for (var nextKey in next) {
1202
+ if (nextKeysPending[nextKey]) {
1203
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
1204
+ var pendingNextKey = nextKeysPending[nextKey][i];
1205
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
1206
+ }
1207
+ }
1208
+
1209
+ childMapping[nextKey] = getValueForKey(nextKey);
1210
+ } // Finally, add the keys which didn't appear before any key in `next`
1211
+
1212
+
1213
+ for (i = 0; i < pendingKeys.length; i++) {
1214
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
1215
+ }
1216
+
1217
+ return childMapping;
1218
+ }
1219
+
1220
+ function getProp(child, prop, props) {
1221
+ return props[prop] != null ? props[prop] : child.props[prop];
1222
+ }
1223
+
1224
+ function getInitialChildMapping(props, onExited) {
1225
+ return getChildMapping(props.children, function (child) {
1226
+ return React.cloneElement(child, {
1227
+ onExited: onExited.bind(null, child),
1228
+ in: true,
1229
+ appear: getProp(child, 'appear', props),
1230
+ enter: getProp(child, 'enter', props),
1231
+ exit: getProp(child, 'exit', props)
1232
+ });
1233
+ });
1234
+ }
1235
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
1236
+ var nextChildMapping = getChildMapping(nextProps.children);
1237
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
1238
+ Object.keys(children).forEach(function (key) {
1239
+ var child = children[key];
1240
+ if (!React.isValidElement(child)) return;
1241
+ var hasPrev = (key in prevChildMapping);
1242
+ var hasNext = (key in nextChildMapping);
1243
+ var prevChild = prevChildMapping[key];
1244
+ var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
1245
+
1246
+ if (hasNext && (!hasPrev || isLeaving)) {
1247
+ // console.log('entering', key)
1248
+ children[key] = React.cloneElement(child, {
1249
+ onExited: onExited.bind(null, child),
1250
+ in: true,
1251
+ exit: getProp(child, 'exit', nextProps),
1252
+ enter: getProp(child, 'enter', nextProps)
1253
+ });
1254
+ } else if (!hasNext && hasPrev && !isLeaving) {
1255
+ // item is old (exiting)
1256
+ // console.log('leaving', key)
1257
+ children[key] = React.cloneElement(child, {
1258
+ in: false
1259
+ });
1260
+ } else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
1261
+ // item hasn't changed transition states
1262
+ // copy over the last transition props;
1263
+ // console.log('unchanged', key)
1264
+ children[key] = React.cloneElement(child, {
1265
+ onExited: onExited.bind(null, child),
1266
+ in: prevChild.props.in,
1267
+ exit: getProp(child, 'exit', nextProps),
1268
+ enter: getProp(child, 'enter', nextProps)
1269
+ });
1270
+ }
1271
+ });
1272
+ return children;
1273
+ }
1274
+
1275
+ var values = Object.values || function (obj) {
1276
+ return Object.keys(obj).map(function (k) {
1277
+ return obj[k];
1278
+ });
1279
+ };
1280
+
1281
+ var defaultProps = {
1282
+ component: 'div',
1283
+ childFactory: function childFactory(child) {
1284
+ return child;
1285
+ }
1286
+ };
1287
+ /**
1288
+ * The `<TransitionGroup>` component manages a set of transition components
1289
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
1290
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
1291
+ * and unmounting of components over time.
1292
+ *
1293
+ * Consider the example below. As items are removed or added to the TodoList the
1294
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
1295
+ *
1296
+ * Note that `<TransitionGroup>` does not define any animation behavior!
1297
+ * Exactly _how_ a list item animates is up to the individual transition
1298
+ * component. This means you can mix and match animations across different list
1299
+ * items.
1300
+ */
1301
+
1302
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
1303
+ _inheritsLoose__default["default"](TransitionGroup, _React$Component);
1304
+
1305
+ function TransitionGroup(props, context) {
1306
+ var _this;
1307
+
1308
+ _this = _React$Component.call(this, props, context) || this;
1309
+
1310
+ var handleExited = _this.handleExited.bind(_assertThisInitialized__default["default"](_this)); // Initial children should all be entering, dependent on appear
1311
+
1312
+
1313
+ _this.state = {
1314
+ contextValue: {
1315
+ isMounting: true
1316
+ },
1317
+ handleExited: handleExited,
1318
+ firstRender: true
1319
+ };
1320
+ return _this;
1321
+ }
1322
+
1323
+ var _proto = TransitionGroup.prototype;
1324
+
1325
+ _proto.componentDidMount = function componentDidMount() {
1326
+ this.mounted = true;
1327
+ this.setState({
1328
+ contextValue: {
1329
+ isMounting: false
1330
+ }
1331
+ });
1332
+ };
1333
+
1334
+ _proto.componentWillUnmount = function componentWillUnmount() {
1335
+ this.mounted = false;
1336
+ };
1337
+
1338
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
1339
+ var prevChildMapping = _ref.children,
1340
+ handleExited = _ref.handleExited,
1341
+ firstRender = _ref.firstRender;
1342
+ return {
1343
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
1344
+ firstRender: false
1345
+ };
1346
+ } // node is `undefined` when user provided `nodeRef` prop
1347
+ ;
1348
+
1349
+ _proto.handleExited = function handleExited(child, node) {
1350
+ var currentChildMapping = getChildMapping(this.props.children);
1351
+ if (child.key in currentChildMapping) return;
1352
+
1353
+ if (child.props.onExited) {
1354
+ child.props.onExited(node);
1355
+ }
1356
+
1357
+ if (this.mounted) {
1358
+ this.setState(function (state) {
1359
+ var children = _extends__default["default"]({}, state.children);
1360
+
1361
+ delete children[child.key];
1362
+ return {
1363
+ children: children
1364
+ };
1365
+ });
1366
+ }
1367
+ };
1368
+
1369
+ _proto.render = function render() {
1370
+ var _this$props = this.props,
1371
+ Component = _this$props.component,
1372
+ childFactory = _this$props.childFactory,
1373
+ props = _objectWithoutPropertiesLoose__default["default"](_this$props, ["component", "childFactory"]);
1374
+
1375
+ var contextValue = this.state.contextValue;
1376
+ var children = values(this.state.children).map(childFactory);
1377
+ delete props.appear;
1378
+ delete props.enter;
1379
+ delete props.exit;
1380
+
1381
+ if (Component === null) {
1382
+ return /*#__PURE__*/React__default["default"].createElement(TransitionGroupContext.Provider, {
1383
+ value: contextValue
1384
+ }, children);
1385
+ }
1386
+
1387
+ return /*#__PURE__*/React__default["default"].createElement(TransitionGroupContext.Provider, {
1388
+ value: contextValue
1389
+ }, /*#__PURE__*/React__default["default"].createElement(Component, props, children));
1390
+ };
1391
+
1392
+ return TransitionGroup;
1393
+ }(React__default["default"].Component);
1394
+
1395
+ TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
1396
+ /**
1397
+ * `<TransitionGroup>` renders a `<div>` by default. You can change this
1398
+ * behavior by providing a `component` prop.
1399
+ * If you use React v16+ and would like to avoid a wrapping `<div>` element
1400
+ * you can pass in `component={null}`. This is useful if the wrapping div
1401
+ * borks your css styles.
1402
+ */
1403
+ component: index.propTypes.exports.any,
1404
+
1405
+ /**
1406
+ * A set of `<Transition>` components, that are toggled `in` and out as they
1407
+ * leave. the `<TransitionGroup>` will inject specific transition props, so
1408
+ * remember to spread them through if you are wrapping the `<Transition>` as
1409
+ * with our `<Fade>` example.
1410
+ *
1411
+ * While this component is meant for multiple `Transition` or `CSSTransition`
1412
+ * children, sometimes you may want to have a single transition child with
1413
+ * content that you want to be transitioned out and in when you change it
1414
+ * (e.g. routes, images etc.) In that case you can change the `key` prop of
1415
+ * the transition child as you change its content, this will cause
1416
+ * `TransitionGroup` to transition the child out and back in.
1417
+ */
1418
+ children: index.propTypes.exports.node,
1419
+
1420
+ /**
1421
+ * A convenience prop that enables or disables appear animations
1422
+ * for all children. Note that specifying this will override any defaults set
1423
+ * on individual children Transitions.
1424
+ */
1425
+ appear: index.propTypes.exports.bool,
1426
+
1427
+ /**
1428
+ * A convenience prop that enables or disables enter animations
1429
+ * for all children. Note that specifying this will override any defaults set
1430
+ * on individual children Transitions.
1431
+ */
1432
+ enter: index.propTypes.exports.bool,
1433
+
1434
+ /**
1435
+ * A convenience prop that enables or disables exit animations
1436
+ * for all children. Note that specifying this will override any defaults set
1437
+ * on individual children Transitions.
1438
+ */
1439
+ exit: index.propTypes.exports.bool,
1440
+
1441
+ /**
1442
+ * You may need to apply reactive updates to a child as it is exiting.
1443
+ * This is generally done by using `cloneElement` however in the case of an exiting
1444
+ * child the element has already been removed and not accessible to the consumer.
1445
+ *
1446
+ * If you do need to update a child as it leaves you can provide a `childFactory`
1447
+ * to wrap every child, even the ones that are leaving.
1448
+ *
1449
+ * @type Function(child: ReactElement) -> ReactElement
1450
+ */
1451
+ childFactory: index.propTypes.exports.func
1452
+ } : {};
1453
+ TransitionGroup.defaultProps = defaultProps;
1454
+
1455
+ /**
1456
+ * The `<ReplaceTransition>` component is a specialized `Transition` component
1457
+ * that animates between two children.
1458
+ *
1459
+ * ```jsx
1460
+ * <ReplaceTransition in>
1461
+ * <Fade><div>I appear first</div></Fade>
1462
+ * <Fade><div>I replace the above</div></Fade>
1463
+ * </ReplaceTransition>
1464
+ * ```
1465
+ */
1466
+
1467
+ var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
1468
+ _inheritsLoose__default["default"](ReplaceTransition, _React$Component);
1469
+
1470
+ function ReplaceTransition() {
1471
+ var _this;
1472
+
1473
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
1474
+ _args[_key] = arguments[_key];
1475
+ }
1476
+
1477
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
1478
+
1479
+ _this.handleEnter = function () {
1480
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1481
+ args[_key2] = arguments[_key2];
1482
+ }
1483
+
1484
+ return _this.handleLifecycle('onEnter', 0, args);
1485
+ };
1486
+
1487
+ _this.handleEntering = function () {
1488
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1489
+ args[_key3] = arguments[_key3];
1490
+ }
1491
+
1492
+ return _this.handleLifecycle('onEntering', 0, args);
1493
+ };
1494
+
1495
+ _this.handleEntered = function () {
1496
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1497
+ args[_key4] = arguments[_key4];
1498
+ }
1499
+
1500
+ return _this.handleLifecycle('onEntered', 0, args);
1501
+ };
1502
+
1503
+ _this.handleExit = function () {
1504
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1505
+ args[_key5] = arguments[_key5];
1506
+ }
1507
+
1508
+ return _this.handleLifecycle('onExit', 1, args);
1509
+ };
1510
+
1511
+ _this.handleExiting = function () {
1512
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1513
+ args[_key6] = arguments[_key6];
1514
+ }
1515
+
1516
+ return _this.handleLifecycle('onExiting', 1, args);
1517
+ };
1518
+
1519
+ _this.handleExited = function () {
1520
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1521
+ args[_key7] = arguments[_key7];
1522
+ }
1523
+
1524
+ return _this.handleLifecycle('onExited', 1, args);
1525
+ };
1526
+
1527
+ return _this;
1528
+ }
1529
+
1530
+ var _proto = ReplaceTransition.prototype;
1531
+
1532
+ _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
1533
+ var _child$props;
1534
+
1535
+ var children = this.props.children;
1536
+ var child = React__default["default"].Children.toArray(children)[idx];
1537
+ if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
1538
+
1539
+ if (this.props[handler]) {
1540
+ var maybeNode = child.props.nodeRef ? undefined : ReactDOM__default["default"].findDOMNode(this);
1541
+ this.props[handler](maybeNode);
1542
+ }
1543
+ };
1544
+
1545
+ _proto.render = function render() {
1546
+ var _this$props = this.props,
1547
+ children = _this$props.children,
1548
+ inProp = _this$props.in,
1549
+ props = _objectWithoutPropertiesLoose__default["default"](_this$props, ["children", "in"]);
1550
+
1551
+ var _React$Children$toArr = React__default["default"].Children.toArray(children),
1552
+ first = _React$Children$toArr[0],
1553
+ second = _React$Children$toArr[1];
1554
+
1555
+ delete props.onEnter;
1556
+ delete props.onEntering;
1557
+ delete props.onEntered;
1558
+ delete props.onExit;
1559
+ delete props.onExiting;
1560
+ delete props.onExited;
1561
+ return /*#__PURE__*/React__default["default"].createElement(TransitionGroup, props, inProp ? React__default["default"].cloneElement(first, {
1562
+ key: 'first',
1563
+ onEnter: this.handleEnter,
1564
+ onEntering: this.handleEntering,
1565
+ onEntered: this.handleEntered
1566
+ }) : React__default["default"].cloneElement(second, {
1567
+ key: 'second',
1568
+ onEnter: this.handleExit,
1569
+ onEntering: this.handleExiting,
1570
+ onEntered: this.handleExited
1571
+ }));
1572
+ };
1573
+
1574
+ return ReplaceTransition;
1575
+ }(React__default["default"].Component);
1576
+
1577
+ ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
1578
+ in: index.propTypes.exports.bool.isRequired,
1579
+ children: function children(props, propName) {
1580
+ if (React__default["default"].Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
1581
+ return null;
1582
+ }
1583
+ } : {};
1584
+
1585
+ var _leaveRenders, _enterRenders;
1586
+
1587
+ function areChildrenDifferent(oldChildren, newChildren) {
1588
+ if (oldChildren === newChildren) return false;
1589
+
1590
+ if (React__default["default"].isValidElement(oldChildren) && React__default["default"].isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
1591
+ return false;
1592
+ }
1593
+
1594
+ return true;
1595
+ }
1596
+ /**
1597
+ * Enum of modes for SwitchTransition component
1598
+ * @enum { string }
1599
+ */
1600
+
1601
+
1602
+ var modes = {
1603
+ out: 'out-in',
1604
+ in: 'in-out'
1605
+ };
1606
+
1607
+ var callHook = function callHook(element, name, cb) {
1608
+ return function () {
1609
+ var _element$props;
1610
+
1611
+ element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
1612
+ cb();
1613
+ };
1614
+ };
1615
+
1616
+ var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
1617
+ var current = _ref.current,
1618
+ changeState = _ref.changeState;
1619
+ return React__default["default"].cloneElement(current, {
1620
+ in: false,
1621
+ onExited: callHook(current, 'onExited', function () {
1622
+ changeState(ENTERING, null);
1623
+ })
1624
+ });
1625
+ }, _leaveRenders[modes.in] = function (_ref2) {
1626
+ var current = _ref2.current,
1627
+ changeState = _ref2.changeState,
1628
+ children = _ref2.children;
1629
+ return [current, React__default["default"].cloneElement(children, {
1630
+ in: true,
1631
+ onEntered: callHook(children, 'onEntered', function () {
1632
+ changeState(ENTERING);
1633
+ })
1634
+ })];
1635
+ }, _leaveRenders);
1636
+ var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
1637
+ var children = _ref3.children,
1638
+ changeState = _ref3.changeState;
1639
+ return React__default["default"].cloneElement(children, {
1640
+ in: true,
1641
+ onEntered: callHook(children, 'onEntered', function () {
1642
+ changeState(ENTERED, React__default["default"].cloneElement(children, {
1643
+ in: true
1644
+ }));
1645
+ })
1646
+ });
1647
+ }, _enterRenders[modes.in] = function (_ref4) {
1648
+ var current = _ref4.current,
1649
+ children = _ref4.children,
1650
+ changeState = _ref4.changeState;
1651
+ return [React__default["default"].cloneElement(current, {
1652
+ in: false,
1653
+ onExited: callHook(current, 'onExited', function () {
1654
+ changeState(ENTERED, React__default["default"].cloneElement(children, {
1655
+ in: true
1656
+ }));
1657
+ })
1658
+ }), React__default["default"].cloneElement(children, {
1659
+ in: true
1660
+ })];
1661
+ }, _enterRenders);
1662
+ /**
1663
+ * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
1664
+ * You can use it when you want to control the render between state transitions.
1665
+ * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them.
1666
+ *
1667
+ * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
1668
+ * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child.
1669
+ *
1670
+ * **Note**: If you want the animation to happen simultaneously
1671
+ * (that is, to have the old child removed and a new child inserted **at the same time**),
1672
+ * you should use
1673
+ * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
1674
+ * instead.
1675
+ *
1676
+ * ```jsx
1677
+ * function App() {
1678
+ * const [state, setState] = useState(false);
1679
+ * return (
1680
+ * <SwitchTransition>
1681
+ * <CSSTransition
1682
+ * key={state ? "Goodbye, world!" : "Hello, world!"}
1683
+ * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
1684
+ * classNames='fade'
1685
+ * >
1686
+ * <button onClick={() => setState(state => !state)}>
1687
+ * {state ? "Goodbye, world!" : "Hello, world!"}
1688
+ * </button>
1689
+ * </CSSTransition>
1690
+ * </SwitchTransition>
1691
+ * );
1692
+ * }
1693
+ * ```
1694
+ *
1695
+ * ```css
1696
+ * .fade-enter{
1697
+ * opacity: 0;
1698
+ * }
1699
+ * .fade-exit{
1700
+ * opacity: 1;
1701
+ * }
1702
+ * .fade-enter-active{
1703
+ * opacity: 1;
1704
+ * }
1705
+ * .fade-exit-active{
1706
+ * opacity: 0;
1707
+ * }
1708
+ * .fade-enter-active,
1709
+ * .fade-exit-active{
1710
+ * transition: opacity 500ms;
1711
+ * }
1712
+ * ```
1713
+ */
1714
+
1715
+ var SwitchTransition = /*#__PURE__*/function (_React$Component) {
1716
+ _inheritsLoose__default["default"](SwitchTransition, _React$Component);
1717
+
1718
+ function SwitchTransition() {
1719
+ var _this;
1720
+
1721
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1722
+ args[_key] = arguments[_key];
1723
+ }
1724
+
1725
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
1726
+ _this.state = {
1727
+ status: ENTERED,
1728
+ current: null
1729
+ };
1730
+ _this.appeared = false;
1731
+
1732
+ _this.changeState = function (status, current) {
1733
+ if (current === void 0) {
1734
+ current = _this.state.current;
1735
+ }
1736
+
1737
+ _this.setState({
1738
+ status: status,
1739
+ current: current
1740
+ });
1741
+ };
1742
+
1743
+ return _this;
1744
+ }
1745
+
1746
+ var _proto = SwitchTransition.prototype;
1747
+
1748
+ _proto.componentDidMount = function componentDidMount() {
1749
+ this.appeared = true;
1750
+ };
1751
+
1752
+ SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
1753
+ if (props.children == null) {
1754
+ return {
1755
+ current: null
1756
+ };
1757
+ }
1758
+
1759
+ if (state.status === ENTERING && props.mode === modes.in) {
1760
+ return {
1761
+ status: ENTERING
1762
+ };
1763
+ }
1764
+
1765
+ if (state.current && areChildrenDifferent(state.current, props.children)) {
1766
+ return {
1767
+ status: EXITING
1768
+ };
1769
+ }
1770
+
1771
+ return {
1772
+ current: React__default["default"].cloneElement(props.children, {
1773
+ in: true
1774
+ })
1775
+ };
1776
+ };
1777
+
1778
+ _proto.render = function render() {
1779
+ var _this$props = this.props,
1780
+ children = _this$props.children,
1781
+ mode = _this$props.mode,
1782
+ _this$state = this.state,
1783
+ status = _this$state.status,
1784
+ current = _this$state.current;
1785
+ var data = {
1786
+ children: children,
1787
+ current: current,
1788
+ changeState: this.changeState,
1789
+ status: status
1790
+ };
1791
+ var component;
1792
+
1793
+ switch (status) {
1794
+ case ENTERING:
1795
+ component = enterRenders[mode](data);
1796
+ break;
1797
+
1798
+ case EXITING:
1799
+ component = leaveRenders[mode](data);
1800
+ break;
1801
+
1802
+ case ENTERED:
1803
+ component = current;
1804
+ }
1805
+
1806
+ return /*#__PURE__*/React__default["default"].createElement(TransitionGroupContext.Provider, {
1807
+ value: {
1808
+ isMounting: !this.appeared
1809
+ }
1810
+ }, component);
1811
+ };
1812
+
1813
+ return SwitchTransition;
1814
+ }(React__default["default"].Component);
1815
+
1816
+ SwitchTransition.propTypes = process.env.NODE_ENV !== "production" ? {
1817
+ /**
1818
+ * Transition modes.
1819
+ * `out-in`: Current element transitions out first, then when complete, the new element transitions in.
1820
+ * `in-out`: New element transitions in first, then when complete, the current element transitions out.
1821
+ *
1822
+ * @type {'out-in'|'in-out'}
1823
+ */
1824
+ mode: index.propTypes.exports.oneOf([modes.in, modes.out]),
1825
+
1826
+ /**
1827
+ * Any `Transition` or `CSSTransition` component.
1828
+ */
1829
+ children: index.propTypes.exports.oneOfType([index.propTypes.exports.element.isRequired])
1830
+ } : {};
1831
+ SwitchTransition.defaultProps = {
1832
+ mode: modes.out
1833
+ };
1834
+
38
1835
  var css = ".neeto-molecules-menubar__wrapper{background-color:rgb(var(--neeto-ui-white))!important;border-right:1px solid rgb(var(--neeto-ui-gray-200));flex-shrink:0;overflow:hidden;transition:all .3s}.neeto-molecules-menubar__container{height:100vh;overflow-y:auto;padding:32px!important;width:324px}@media screen and (max-width:1024px){.neeto-molecules-menubar__container{padding:40px 24px 24px!important;width:280px}}@media screen and (max-width:768px){.neeto-molecules-menubar__container{padding:40px 20px 24px!important;width:240px}}.neeto-molecules-menubar__title{margin-bottom:16px}.neeto-molecules-menubar__search{align-items:center;display:flex;gap:4px;margin-bottom:20px}.neeto-molecules-menubar__subtitle{align-items:center;display:flex;justify-content:space-between;margin-bottom:20px;margin-top:20px}.neeto-molecules-menubar__subtitle-actions{align-items:center;display:flex;gap:4px}.neeto-molecules-menubar__add-new-wrap,.neeto-molecules-menubar__block{margin-bottom:8px;padding:7px 8px}.neeto-molecules-menubar__block{align-items:center;border:thin solid transparent;border-radius:var(--neeto-ui-rounded);cursor:pointer;display:flex;justify-content:space-between;text-align:left;transition:all .3s;width:100%}.neeto-molecules-menubar__block:active,.neeto-molecules-menubar__block:focus,.neeto-molecules-menubar__block:focus-visible,.neeto-molecules-menubar__block:hover{background-color:rgb(var(--neeto-ui-gray-200));outline:none;text-decoration:none}.neeto-molecules-menubar__block--active{background-color:rgb(var(--neeto-ui-primary-100));border-color:rgb(var(--neeto-ui-primary-100));box-shadow:none;position:relative}.neeto-molecules-menubar__block--active:after{background-color:rgb(var(--neeto-ui-primary-500));border-bottom-left-radius:var(--neeto-ui-rounded);border-top-left-radius:var(--neeto-ui-rounded);content:\"\";height:100%;left:-1px;position:absolute;top:0;width:3px}.neeto-molecules-menubar__block--active:active,.neeto-molecules-menubar__block--active:focus,.neeto-molecules-menubar__block--active:focus-visible,.neeto-molecules-menubar__block--active:hover{background-color:rgb(var(--neeto-ui-primary-100))}.neeto-molecules-menubar__block .neeto-molecules-menubar__block-label{align-items:center;display:flex}.neeto-molecules-menubar__block .neeto-molecules-menubar__block-icon{margin-right:4px}.neeto-molecules-menubar__item{border:thin solid transparent;border-radius:var(--neeto-ui-rounded);cursor:pointer;margin-bottom:8px;padding:12px;text-align:left;transition:all .3s;width:100%}@media screen and (max-width:1024px){.neeto-molecules-menubar__item{padding:10px}}@media screen and (max-width:768px){.neeto-molecules-menubar__item{padding:8px}}.neeto-molecules-menubar__item:active,.neeto-molecules-menubar__item:focus,.neeto-molecules-menubar__item:focus-visible,.neeto-molecules-menubar__item:hover{background-color:rgb(var(--neeto-ui-gray-200));outline:none}.neeto-molecules-menubar__item--active{background-color:rgb(var(--neeto-ui-white));border-color:rgb(var(--neeto-ui-gray-300));box-shadow:var(--neeto-ui-shadow-xs);color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-menubar__item--active:active,.neeto-molecules-menubar__item--active:focus,.neeto-molecules-menubar__item--active:focus-visible,.neeto-molecules-menubar__item--active:hover{background-color:rgb(var(--neeto-ui-white))}.neeto-molecules-menubar-enter.neeto-molecules-menubar__wrapper{width:0}.neeto-molecules-menubar-enter-active.neeto-molecules-menubar__wrapper,.neeto-molecules-menubar-enter-done.neeto-molecules-menubar__wrapper,.neeto-molecules-menubar-exit.neeto-molecules-menubar__wrapper{width:324px}.neeto-molecules-menubar-exit-active.neeto-molecules-menubar__wrapper{width:0}";
39
1836
  injectCss.n(css,{});
40
1837
 
@@ -44,7 +1841,7 @@ var AddNew = function AddNew(_ref) {
44
1841
  label = _ref$label === void 0 ? "" : _ref$label,
45
1842
  onClick = _ref.onClick,
46
1843
  otherProps = _objectWithoutProperties__default["default"](_ref, _excluded$5);
47
- return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
1844
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends__default$1["default"]({
48
1845
  className: "neeto-molecules-menubar__add-new-wrap"
49
1846
  }, otherProps), /*#__PURE__*/React__default["default"].createElement(Button__default["default"], {
50
1847
  icon: Plus__default["default"],
@@ -79,7 +1876,7 @@ var Block = function Block(_ref) {
79
1876
  var Parent = url ? reactRouterDom.Link : function (props) {
80
1877
  return /*#__PURE__*/React__default["default"].createElement("button", props);
81
1878
  };
82
- return /*#__PURE__*/React__default["default"].createElement(Parent, _extends__default["default"]({
1879
+ return /*#__PURE__*/React__default["default"].createElement(Parent, _extends__default$1["default"]({
83
1880
  "data-cy": otherProps["data-cy"] || "menubar-block",
84
1881
  to: url,
85
1882
  className: classnames__default["default"]("neeto-molecules-menubar__block", _defineProperty__default["default"]({
@@ -118,7 +1915,7 @@ var Item = function Item(_ref) {
118
1915
  _ref$className = _ref.className,
119
1916
  className = _ref$className === void 0 ? "" : _ref$className,
120
1917
  otherProps = _objectWithoutProperties__default["default"](_ref, _excluded$3);
121
- return /*#__PURE__*/React__default["default"].createElement("button", _extends__default["default"]({
1918
+ return /*#__PURE__*/React__default["default"].createElement("button", _extends__default$1["default"]({
122
1919
  className: classnames__default["default"]("neeto-molecules-menubar__item", _defineProperty__default["default"]({
123
1920
  "neeto-molecules-menubar__item--active": active
124
1921
  }, className, className))
@@ -143,7 +1940,7 @@ var Search = withT__default["default"](function (_ref) {
143
1940
  props = _objectWithoutProperties__default["default"](_ref, _excluded$2);
144
1941
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isCollapsed && /*#__PURE__*/React__default["default"].createElement("div", {
145
1942
  className: "neeto-molecules-menubar__search"
146
- }, /*#__PURE__*/React__default["default"].createElement(Input__default["default"], _extends__default["default"]({
1943
+ }, /*#__PURE__*/React__default["default"].createElement(Input__default["default"], _extends__default$1["default"]({
147
1944
  placeholder: t("neetoMolecules.common.actions.search"),
148
1945
  prefix: /*#__PURE__*/React__default["default"].createElement(Search__default["default"], null),
149
1946
  type: "search"
@@ -170,13 +1967,13 @@ var SubTitle = function SubTitle(_ref) {
170
1967
  var children = _ref.children,
171
1968
  iconProps = _ref.iconProps,
172
1969
  otherProps = _objectWithoutProperties__default["default"](_ref, _excluded$1);
173
- return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({
1970
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends__default$1["default"]({
174
1971
  className: "neeto-molecules-menubar__subtitle",
175
1972
  "data-cy": otherProps["data-cy"] || "menubar-subtitle-heading"
176
1973
  }, otherProps), children, /*#__PURE__*/React__default["default"].createElement("div", {
177
1974
  className: "neeto-molecules-menubar__subtitle-actions"
178
1975
  }, iconProps === null || iconProps === void 0 ? void 0 : iconProps.map(function (iconProp, index) {
179
- return /*#__PURE__*/React__default["default"].createElement(Button__default["default"], _extends__default["default"]({
1976
+ return /*#__PURE__*/React__default["default"].createElement(Button__default["default"], _extends__default$1["default"]({
180
1977
  key: index,
181
1978
  style: "text"
182
1979
  }, iconProp));
@@ -193,7 +1990,7 @@ var MenuBar = function MenuBar(_ref) {
193
1990
  _ref$className = _ref.className,
194
1991
  className = _ref$className === void 0 ? "" : _ref$className,
195
1992
  otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
196
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.CSSTransition, {
1993
+ return /*#__PURE__*/React__default["default"].createElement(CSSTransition, {
197
1994
  unmountOnExit: true,
198
1995
  classNames: "neeto-molecules-menubar",
199
1996
  "in": showMenu,