@cleartrip/ct-design-horizontal-scroll 3.13.0 → 3.13.1-SNAPSHOT-atp-changes.0

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.
@@ -1,12 +1,32 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('styled-components'), require('@cleartrip/ct-design-icons'), require('@cleartrip/ct-design-theme'), require('@cleartrip/ct-design-common-utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', 'styled-components', '@cleartrip/ct-design-icons', '@cleartrip/ct-design-theme', '@cleartrip/ct-design-common-utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemHorizontalScroll = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.styled, global.ctDesignIcons, global.ctDesignTheme, global.ctDesignCommonUtils));
5
- })(this, (function (exports, jsxRuntime, react, ctDesignContainer, styled, ctDesignIcons, ctDesignTheme, ctDesignCommonUtils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('styled-components'), require('@cleartrip/ct-design-icons'), require('@cleartrip/ct-design-theme'), require('@cleartrip/ct-design-common-utils'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', 'styled-components', '@cleartrip/ct-design-icons', '@cleartrip/ct-design-theme', '@cleartrip/ct-design-common-utils', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemHorizontalScroll = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.styled, global.ctDesignIcons, global.ctDesignTheme, global.ctDesignCommonUtils, global.ReactDOM));
5
+ })(this, (function (exports, jsxRuntime, React, ctDesignContainer, styled, ctDesignIcons, ctDesignTheme, ctDesignCommonUtils, ReactDOM) { 'use strict';
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
9
28
  var styled__default = /*#__PURE__*/_interopDefault(styled);
29
+ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
10
30
 
11
31
  /******************************************************************************
12
32
  Copyright (c) Microsoft Corporation.
@@ -34,6 +54,14 @@
34
54
  };
35
55
  return __assign.apply(this, arguments);
36
56
  };
57
+ function __rest(s, e) {
58
+ var t = {};
59
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ }
37
65
  function __makeTemplateObject(cooked, raw) {
38
66
  if (Object.defineProperty) {
39
67
  Object.defineProperty(cooked, "raw", {
@@ -91,6 +119,1771 @@
91
119
  ARROW_DIRECTION["RIGHT"] = "RIGHT";
92
120
  })(exports.ARROW_DIRECTION || (exports.ARROW_DIRECTION = {}));
93
121
 
122
+ function _extends() {
123
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
124
+ for (var i = 1; i < arguments.length; i++) {
125
+ var source = arguments[i];
126
+ for (var key in source) {
127
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
128
+ target[key] = source[key];
129
+ }
130
+ }
131
+ }
132
+ return target;
133
+ };
134
+ return _extends.apply(this, arguments);
135
+ }
136
+
137
+ function _objectWithoutPropertiesLoose(source, excluded) {
138
+ if (source == null) return {};
139
+ var target = {};
140
+ var sourceKeys = Object.keys(source);
141
+ var key, i;
142
+ for (i = 0; i < sourceKeys.length; i++) {
143
+ key = sourceKeys[i];
144
+ if (excluded.indexOf(key) >= 0) continue;
145
+ target[key] = source[key];
146
+ }
147
+ return target;
148
+ }
149
+
150
+ function _setPrototypeOf(o, p) {
151
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
152
+ o.__proto__ = p;
153
+ return o;
154
+ };
155
+ return _setPrototypeOf(o, p);
156
+ }
157
+
158
+ function _inheritsLoose(subClass, superClass) {
159
+ subClass.prototype = Object.create(superClass.prototype);
160
+ subClass.prototype.constructor = subClass;
161
+ _setPrototypeOf(subClass, superClass);
162
+ }
163
+
164
+ /**
165
+ * Copyright (c) 2013-present, Facebook, Inc.
166
+ *
167
+ * This source code is licensed under the MIT license found in the
168
+ * LICENSE file in the root directory of this source tree.
169
+ */
170
+ var ReactPropTypesSecret_1;
171
+ var hasRequiredReactPropTypesSecret;
172
+ function requireReactPropTypesSecret() {
173
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
174
+ hasRequiredReactPropTypesSecret = 1;
175
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
176
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
177
+ return ReactPropTypesSecret_1;
178
+ }
179
+
180
+ /**
181
+ * Copyright (c) 2013-present, Facebook, Inc.
182
+ *
183
+ * This source code is licensed under the MIT license found in the
184
+ * LICENSE file in the root directory of this source tree.
185
+ */
186
+ var factoryWithThrowingShims;
187
+ var hasRequiredFactoryWithThrowingShims;
188
+ function requireFactoryWithThrowingShims() {
189
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
190
+ hasRequiredFactoryWithThrowingShims = 1;
191
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
192
+ function emptyFunction() {}
193
+ function emptyFunctionWithReset() {}
194
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
195
+ factoryWithThrowingShims = function () {
196
+ function shim(props, propName, componentName, location, propFullName, secret) {
197
+ if (secret === ReactPropTypesSecret) {
198
+ // It is still safe when called from React.
199
+ return;
200
+ }
201
+ var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
202
+ err.name = 'Invariant Violation';
203
+ throw err;
204
+ }
205
+ shim.isRequired = shim;
206
+ function getShim() {
207
+ return shim;
208
+ }
209
+ // Important!
210
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
211
+ var ReactPropTypes = {
212
+ array: shim,
213
+ bigint: shim,
214
+ bool: shim,
215
+ func: shim,
216
+ number: shim,
217
+ object: shim,
218
+ string: shim,
219
+ symbol: shim,
220
+ any: shim,
221
+ arrayOf: getShim,
222
+ element: shim,
223
+ elementType: shim,
224
+ instanceOf: getShim,
225
+ node: shim,
226
+ objectOf: getShim,
227
+ oneOf: getShim,
228
+ oneOfType: getShim,
229
+ shape: getShim,
230
+ exact: getShim,
231
+ checkPropTypes: emptyFunctionWithReset,
232
+ resetWarningCache: emptyFunction
233
+ };
234
+ ReactPropTypes.PropTypes = ReactPropTypes;
235
+ return ReactPropTypes;
236
+ };
237
+ return factoryWithThrowingShims;
238
+ }
239
+
240
+ /**
241
+ * Copyright (c) 2013-present, Facebook, Inc.
242
+ *
243
+ * This source code is licensed under the MIT license found in the
244
+ * LICENSE file in the root directory of this source tree.
245
+ */
246
+ {
247
+ // By explicitly using `prop-types` you are opting into new production behavior.
248
+ // http://fb.me/prop-types-in-prod
249
+ requireFactoryWithThrowingShims()();
250
+ }
251
+
252
+ /**
253
+ * Checks if a given element has a CSS class.
254
+ *
255
+ * @param element the element
256
+ * @param className the CSS class name
257
+ */
258
+ function hasClass(element, className) {
259
+ if (element.classList) return !!className && element.classList.contains(className);
260
+ return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
261
+ }
262
+
263
+ /**
264
+ * Adds a CSS class to a given element.
265
+ *
266
+ * @param element the element
267
+ * @param className the CSS class name
268
+ */
269
+
270
+ function addClass(element, className) {
271
+ 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);
272
+ }
273
+
274
+ function replaceClassName(origClass, classToRemove) {
275
+ return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
276
+ }
277
+ /**
278
+ * Removes a CSS class from a given element.
279
+ *
280
+ * @param element the element
281
+ * @param className the CSS class name
282
+ */
283
+
284
+ function removeClass$1(element, className) {
285
+ if (element.classList) {
286
+ element.classList.remove(className);
287
+ } else if (typeof element.className === 'string') {
288
+ element.className = replaceClassName(element.className, className);
289
+ } else {
290
+ element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
291
+ }
292
+ }
293
+
294
+ var config = {
295
+ disabled: false
296
+ };
297
+
298
+ var TransitionGroupContext = React__namespace.default.createContext(null);
299
+
300
+ var forceReflow = function forceReflow(node) {
301
+ return node.scrollTop;
302
+ };
303
+
304
+ var UNMOUNTED = 'unmounted';
305
+ var EXITED = 'exited';
306
+ var ENTERING = 'entering';
307
+ var ENTERED = 'entered';
308
+ var EXITING = 'exiting';
309
+ /**
310
+ * The Transition component lets you describe a transition from one component
311
+ * state to another _over time_ with a simple declarative API. Most commonly
312
+ * it's used to animate the mounting and unmounting of a component, but can also
313
+ * be used to describe in-place transition states as well.
314
+ *
315
+ * ---
316
+ *
317
+ * **Note**: `Transition` is a platform-agnostic base component. If you're using
318
+ * transitions in CSS, you'll probably want to use
319
+ * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
320
+ * instead. It inherits all the features of `Transition`, but contains
321
+ * additional features necessary to play nice with CSS transitions (hence the
322
+ * name of the component).
323
+ *
324
+ * ---
325
+ *
326
+ * By default the `Transition` component does not alter the behavior of the
327
+ * component it renders, it only tracks "enter" and "exit" states for the
328
+ * components. It's up to you to give meaning and effect to those states. For
329
+ * example we can add styles to a component when it enters or exits:
330
+ *
331
+ * ```jsx
332
+ * import { Transition } from 'react-transition-group';
333
+ *
334
+ * const duration = 300;
335
+ *
336
+ * const defaultStyle = {
337
+ * transition: `opacity ${duration}ms ease-in-out`,
338
+ * opacity: 0,
339
+ * }
340
+ *
341
+ * const transitionStyles = {
342
+ * entering: { opacity: 1 },
343
+ * entered: { opacity: 1 },
344
+ * exiting: { opacity: 0 },
345
+ * exited: { opacity: 0 },
346
+ * };
347
+ *
348
+ * const Fade = ({ in: inProp }) => (
349
+ * <Transition in={inProp} timeout={duration}>
350
+ * {state => (
351
+ * <div style={{
352
+ * ...defaultStyle,
353
+ * ...transitionStyles[state]
354
+ * }}>
355
+ * I'm a fade Transition!
356
+ * </div>
357
+ * )}
358
+ * </Transition>
359
+ * );
360
+ * ```
361
+ *
362
+ * There are 4 main states a Transition can be in:
363
+ * - `'entering'`
364
+ * - `'entered'`
365
+ * - `'exiting'`
366
+ * - `'exited'`
367
+ *
368
+ * Transition state is toggled via the `in` prop. When `true` the component
369
+ * begins the "Enter" stage. During this stage, the component will shift from
370
+ * its current transition state, to `'entering'` for the duration of the
371
+ * transition and then to the `'entered'` stage once it's complete. Let's take
372
+ * the following example (we'll use the
373
+ * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
374
+ *
375
+ * ```jsx
376
+ * function App() {
377
+ * const [inProp, setInProp] = useState(false);
378
+ * return (
379
+ * <div>
380
+ * <Transition in={inProp} timeout={500}>
381
+ * {state => (
382
+ * // ...
383
+ * )}
384
+ * </Transition>
385
+ * <button onClick={() => setInProp(true)}>
386
+ * Click to Enter
387
+ * </button>
388
+ * </div>
389
+ * );
390
+ * }
391
+ * ```
392
+ *
393
+ * When the button is clicked the component will shift to the `'entering'` state
394
+ * and stay there for 500ms (the value of `timeout`) before it finally switches
395
+ * to `'entered'`.
396
+ *
397
+ * When `in` is `false` the same thing happens except the state moves from
398
+ * `'exiting'` to `'exited'`.
399
+ */
400
+
401
+ var Transition = /*#__PURE__*/function (_React$Component) {
402
+ _inheritsLoose(Transition, _React$Component);
403
+ function Transition(props, context) {
404
+ var _this;
405
+ _this = _React$Component.call(this, props, context) || this;
406
+ var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
407
+
408
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
409
+ var initialStatus;
410
+ _this.appearStatus = null;
411
+ if (props.in) {
412
+ if (appear) {
413
+ initialStatus = EXITED;
414
+ _this.appearStatus = ENTERING;
415
+ } else {
416
+ initialStatus = ENTERED;
417
+ }
418
+ } else {
419
+ if (props.unmountOnExit || props.mountOnEnter) {
420
+ initialStatus = UNMOUNTED;
421
+ } else {
422
+ initialStatus = EXITED;
423
+ }
424
+ }
425
+ _this.state = {
426
+ status: initialStatus
427
+ };
428
+ _this.nextCallback = null;
429
+ return _this;
430
+ }
431
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
432
+ var nextIn = _ref.in;
433
+ if (nextIn && prevState.status === UNMOUNTED) {
434
+ return {
435
+ status: EXITED
436
+ };
437
+ }
438
+ return null;
439
+ } // getSnapshotBeforeUpdate(prevProps) {
440
+ // let nextStatus = null
441
+ // if (prevProps !== this.props) {
442
+ // const { status } = this.state
443
+ // if (this.props.in) {
444
+ // if (status !== ENTERING && status !== ENTERED) {
445
+ // nextStatus = ENTERING
446
+ // }
447
+ // } else {
448
+ // if (status === ENTERING || status === ENTERED) {
449
+ // nextStatus = EXITING
450
+ // }
451
+ // }
452
+ // }
453
+ // return { nextStatus }
454
+ // }
455
+ ;
456
+
457
+ var _proto = Transition.prototype;
458
+ _proto.componentDidMount = function componentDidMount() {
459
+ this.updateStatus(true, this.appearStatus);
460
+ };
461
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
462
+ var nextStatus = null;
463
+ if (prevProps !== this.props) {
464
+ var status = this.state.status;
465
+ if (this.props.in) {
466
+ if (status !== ENTERING && status !== ENTERED) {
467
+ nextStatus = ENTERING;
468
+ }
469
+ } else {
470
+ if (status === ENTERING || status === ENTERED) {
471
+ nextStatus = EXITING;
472
+ }
473
+ }
474
+ }
475
+ this.updateStatus(false, nextStatus);
476
+ };
477
+ _proto.componentWillUnmount = function componentWillUnmount() {
478
+ this.cancelNextCallback();
479
+ };
480
+ _proto.getTimeouts = function getTimeouts() {
481
+ var timeout = this.props.timeout;
482
+ var exit, enter, appear;
483
+ exit = enter = appear = timeout;
484
+ if (timeout != null && typeof timeout !== 'number') {
485
+ exit = timeout.exit;
486
+ enter = timeout.enter; // TODO: remove fallback for next major
487
+
488
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
489
+ }
490
+ return {
491
+ exit: exit,
492
+ enter: enter,
493
+ appear: appear
494
+ };
495
+ };
496
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
497
+ if (mounting === void 0) {
498
+ mounting = false;
499
+ }
500
+ if (nextStatus !== null) {
501
+ // nextStatus will always be ENTERING or EXITING.
502
+ this.cancelNextCallback();
503
+ if (nextStatus === ENTERING) {
504
+ if (this.props.unmountOnExit || this.props.mountOnEnter) {
505
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default.default.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
506
+ // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
507
+ // To make the animation happen, we have to separate each rendering and avoid being processed as batched.
508
+
509
+ if (node) forceReflow(node);
510
+ }
511
+ this.performEnter(mounting);
512
+ } else {
513
+ this.performExit();
514
+ }
515
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
516
+ this.setState({
517
+ status: UNMOUNTED
518
+ });
519
+ }
520
+ };
521
+ _proto.performEnter = function performEnter(mounting) {
522
+ var _this2 = this;
523
+ var enter = this.props.enter;
524
+ var appearing = this.context ? this.context.isMounting : mounting;
525
+ var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM__default.default.findDOMNode(this), appearing],
526
+ maybeNode = _ref2[0],
527
+ maybeAppearing = _ref2[1];
528
+ var timeouts = this.getTimeouts();
529
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
530
+ // if we are mounting and running this it means appear _must_ be set
531
+
532
+ if (!mounting && !enter || config.disabled) {
533
+ this.safeSetState({
534
+ status: ENTERED
535
+ }, function () {
536
+ _this2.props.onEntered(maybeNode);
537
+ });
538
+ return;
539
+ }
540
+ this.props.onEnter(maybeNode, maybeAppearing);
541
+ this.safeSetState({
542
+ status: ENTERING
543
+ }, function () {
544
+ _this2.props.onEntering(maybeNode, maybeAppearing);
545
+ _this2.onTransitionEnd(enterTimeout, function () {
546
+ _this2.safeSetState({
547
+ status: ENTERED
548
+ }, function () {
549
+ _this2.props.onEntered(maybeNode, maybeAppearing);
550
+ });
551
+ });
552
+ });
553
+ };
554
+ _proto.performExit = function performExit() {
555
+ var _this3 = this;
556
+ var exit = this.props.exit;
557
+ var timeouts = this.getTimeouts();
558
+ var maybeNode = this.props.nodeRef ? undefined : ReactDOM__default.default.findDOMNode(this); // no exit animation skip right to EXITED
559
+
560
+ if (!exit || config.disabled) {
561
+ this.safeSetState({
562
+ status: EXITED
563
+ }, function () {
564
+ _this3.props.onExited(maybeNode);
565
+ });
566
+ return;
567
+ }
568
+ this.props.onExit(maybeNode);
569
+ this.safeSetState({
570
+ status: EXITING
571
+ }, function () {
572
+ _this3.props.onExiting(maybeNode);
573
+ _this3.onTransitionEnd(timeouts.exit, function () {
574
+ _this3.safeSetState({
575
+ status: EXITED
576
+ }, function () {
577
+ _this3.props.onExited(maybeNode);
578
+ });
579
+ });
580
+ });
581
+ };
582
+ _proto.cancelNextCallback = function cancelNextCallback() {
583
+ if (this.nextCallback !== null) {
584
+ this.nextCallback.cancel();
585
+ this.nextCallback = null;
586
+ }
587
+ };
588
+ _proto.safeSetState = function safeSetState(nextState, callback) {
589
+ // This shouldn't be necessary, but there are weird race conditions with
590
+ // setState callbacks and unmounting in testing, so always make sure that
591
+ // we can cancel any pending setState callbacks after we unmount.
592
+ callback = this.setNextCallback(callback);
593
+ this.setState(nextState, callback);
594
+ };
595
+ _proto.setNextCallback = function setNextCallback(callback) {
596
+ var _this4 = this;
597
+ var active = true;
598
+ this.nextCallback = function (event) {
599
+ if (active) {
600
+ active = false;
601
+ _this4.nextCallback = null;
602
+ callback(event);
603
+ }
604
+ };
605
+ this.nextCallback.cancel = function () {
606
+ active = false;
607
+ };
608
+ return this.nextCallback;
609
+ };
610
+ _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
611
+ this.setNextCallback(handler);
612
+ var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM__default.default.findDOMNode(this);
613
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
614
+ if (!node || doesNotHaveTimeoutOrListener) {
615
+ setTimeout(this.nextCallback, 0);
616
+ return;
617
+ }
618
+ if (this.props.addEndListener) {
619
+ var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
620
+ maybeNode = _ref3[0],
621
+ maybeNextCallback = _ref3[1];
622
+ this.props.addEndListener(maybeNode, maybeNextCallback);
623
+ }
624
+ if (timeout != null) {
625
+ setTimeout(this.nextCallback, timeout);
626
+ }
627
+ };
628
+ _proto.render = function render() {
629
+ var status = this.state.status;
630
+ if (status === UNMOUNTED) {
631
+ return null;
632
+ }
633
+ var _this$props = this.props,
634
+ children = _this$props.children;
635
+ _this$props.in;
636
+ _this$props.mountOnEnter;
637
+ _this$props.unmountOnExit;
638
+ _this$props.appear;
639
+ _this$props.enter;
640
+ _this$props.exit;
641
+ _this$props.timeout;
642
+ _this$props.addEndListener;
643
+ _this$props.onEnter;
644
+ _this$props.onEntering;
645
+ _this$props.onEntered;
646
+ _this$props.onExit;
647
+ _this$props.onExiting;
648
+ _this$props.onExited;
649
+ _this$props.nodeRef;
650
+ var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
651
+ return /*#__PURE__*/(
652
+ // allows for nested Transitions
653
+ React__namespace.default.createElement(TransitionGroupContext.Provider, {
654
+ value: null
655
+ }, typeof children === 'function' ? children(status, childProps) : React__namespace.default.cloneElement(React__namespace.default.Children.only(children), childProps))
656
+ );
657
+ };
658
+ return Transition;
659
+ }(React__namespace.default.Component);
660
+ Transition.contextType = TransitionGroupContext;
661
+ Transition.propTypes = {}; // Name the function so it is clearer in the documentation
662
+
663
+ function noop() {}
664
+ Transition.defaultProps = {
665
+ in: false,
666
+ mountOnEnter: false,
667
+ unmountOnExit: false,
668
+ appear: false,
669
+ enter: true,
670
+ exit: true,
671
+ onEnter: noop,
672
+ onEntering: noop,
673
+ onEntered: noop,
674
+ onExit: noop,
675
+ onExiting: noop,
676
+ onExited: noop
677
+ };
678
+ Transition.UNMOUNTED = UNMOUNTED;
679
+ Transition.EXITED = EXITED;
680
+ Transition.ENTERING = ENTERING;
681
+ Transition.ENTERED = ENTERED;
682
+ Transition.EXITING = EXITING;
683
+
684
+ var _addClass = function addClass$1(node, classes) {
685
+ return node && classes && classes.split(' ').forEach(function (c) {
686
+ return addClass(node, c);
687
+ });
688
+ };
689
+ var removeClass = function removeClass(node, classes) {
690
+ return node && classes && classes.split(' ').forEach(function (c) {
691
+ return removeClass$1(node, c);
692
+ });
693
+ };
694
+ /**
695
+ * A transition component inspired by the excellent
696
+ * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
697
+ * use it if you're using CSS transitions or animations. It's built upon the
698
+ * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
699
+ * component, so it inherits all of its props.
700
+ *
701
+ * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
702
+ * and `exit` states of the transition. The first class is applied and then a
703
+ * second `*-active` class in order to activate the CSS transition. After the
704
+ * transition, matching `*-done` class names are applied to persist the
705
+ * transition state.
706
+ *
707
+ * ```jsx
708
+ * function App() {
709
+ * const [inProp, setInProp] = useState(false);
710
+ * return (
711
+ * <div>
712
+ * <CSSTransition in={inProp} timeout={200} classNames="my-node">
713
+ * <div>
714
+ * {"I'll receive my-node-* classes"}
715
+ * </div>
716
+ * </CSSTransition>
717
+ * <button type="button" onClick={() => setInProp(true)}>
718
+ * Click to Enter
719
+ * </button>
720
+ * </div>
721
+ * );
722
+ * }
723
+ * ```
724
+ *
725
+ * When the `in` prop is set to `true`, the child component will first receive
726
+ * the class `example-enter`, then the `example-enter-active` will be added in
727
+ * the next tick. `CSSTransition` [forces a
728
+ * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
729
+ * between before adding the `example-enter-active`. This is an important trick
730
+ * because it allows us to transition between `example-enter` and
731
+ * `example-enter-active` even though they were added immediately one after
732
+ * another. Most notably, this is what makes it possible for us to animate
733
+ * _appearance_.
734
+ *
735
+ * ```css
736
+ * .my-node-enter {
737
+ * opacity: 0;
738
+ * }
739
+ * .my-node-enter-active {
740
+ * opacity: 1;
741
+ * transition: opacity 200ms;
742
+ * }
743
+ * .my-node-exit {
744
+ * opacity: 1;
745
+ * }
746
+ * .my-node-exit-active {
747
+ * opacity: 0;
748
+ * transition: opacity 200ms;
749
+ * }
750
+ * ```
751
+ *
752
+ * `*-active` classes represent which styles you want to animate **to**, so it's
753
+ * important to add `transition` declaration only to them, otherwise transitions
754
+ * might not behave as intended! This might not be obvious when the transitions
755
+ * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
756
+ * the example above (minus `transition`), but it becomes apparent in more
757
+ * complex transitions.
758
+ *
759
+ * **Note**: If you're using the
760
+ * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
761
+ * prop, make sure to define styles for `.appear-*` classes as well.
762
+ */
763
+
764
+ var CSSTransition = /*#__PURE__*/function (_React$Component) {
765
+ _inheritsLoose(CSSTransition, _React$Component);
766
+ function CSSTransition() {
767
+ var _this;
768
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
769
+ args[_key] = arguments[_key];
770
+ }
771
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
772
+ _this.appliedClasses = {
773
+ appear: {},
774
+ enter: {},
775
+ exit: {}
776
+ };
777
+ _this.onEnter = function (maybeNode, maybeAppearing) {
778
+ var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
779
+ node = _this$resolveArgument[0],
780
+ appearing = _this$resolveArgument[1];
781
+ _this.removeClasses(node, 'exit');
782
+ _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
783
+ if (_this.props.onEnter) {
784
+ _this.props.onEnter(maybeNode, maybeAppearing);
785
+ }
786
+ };
787
+ _this.onEntering = function (maybeNode, maybeAppearing) {
788
+ var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
789
+ node = _this$resolveArgument2[0],
790
+ appearing = _this$resolveArgument2[1];
791
+ var type = appearing ? 'appear' : 'enter';
792
+ _this.addClass(node, type, 'active');
793
+ if (_this.props.onEntering) {
794
+ _this.props.onEntering(maybeNode, maybeAppearing);
795
+ }
796
+ };
797
+ _this.onEntered = function (maybeNode, maybeAppearing) {
798
+ var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
799
+ node = _this$resolveArgument3[0],
800
+ appearing = _this$resolveArgument3[1];
801
+ var type = appearing ? 'appear' : 'enter';
802
+ _this.removeClasses(node, type);
803
+ _this.addClass(node, type, 'done');
804
+ if (_this.props.onEntered) {
805
+ _this.props.onEntered(maybeNode, maybeAppearing);
806
+ }
807
+ };
808
+ _this.onExit = function (maybeNode) {
809
+ var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
810
+ node = _this$resolveArgument4[0];
811
+ _this.removeClasses(node, 'appear');
812
+ _this.removeClasses(node, 'enter');
813
+ _this.addClass(node, 'exit', 'base');
814
+ if (_this.props.onExit) {
815
+ _this.props.onExit(maybeNode);
816
+ }
817
+ };
818
+ _this.onExiting = function (maybeNode) {
819
+ var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
820
+ node = _this$resolveArgument5[0];
821
+ _this.addClass(node, 'exit', 'active');
822
+ if (_this.props.onExiting) {
823
+ _this.props.onExiting(maybeNode);
824
+ }
825
+ };
826
+ _this.onExited = function (maybeNode) {
827
+ var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
828
+ node = _this$resolveArgument6[0];
829
+ _this.removeClasses(node, 'exit');
830
+ _this.addClass(node, 'exit', 'done');
831
+ if (_this.props.onExited) {
832
+ _this.props.onExited(maybeNode);
833
+ }
834
+ };
835
+ _this.resolveArguments = function (maybeNode, maybeAppearing) {
836
+ return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
837
+ : [maybeNode, maybeAppearing];
838
+ };
839
+ _this.getClassNames = function (type) {
840
+ var classNames = _this.props.classNames;
841
+ var isStringClassNames = typeof classNames === 'string';
842
+ var prefix = isStringClassNames && classNames ? classNames + "-" : '';
843
+ var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
844
+ var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
845
+ var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
846
+ return {
847
+ baseClassName: baseClassName,
848
+ activeClassName: activeClassName,
849
+ doneClassName: doneClassName
850
+ };
851
+ };
852
+ return _this;
853
+ }
854
+ var _proto = CSSTransition.prototype;
855
+ _proto.addClass = function addClass(node, type, phase) {
856
+ var className = this.getClassNames(type)[phase + "ClassName"];
857
+ var _this$getClassNames = this.getClassNames('enter'),
858
+ doneClassName = _this$getClassNames.doneClassName;
859
+ if (type === 'appear' && phase === 'done' && doneClassName) {
860
+ className += " " + doneClassName;
861
+ } // This is to force a repaint,
862
+ // which is necessary in order to transition styles when adding a class name.
863
+
864
+ if (phase === 'active') {
865
+ if (node) forceReflow(node);
866
+ }
867
+ if (className) {
868
+ this.appliedClasses[type][phase] = className;
869
+ _addClass(node, className);
870
+ }
871
+ };
872
+ _proto.removeClasses = function removeClasses(node, type) {
873
+ var _this$appliedClasses$ = this.appliedClasses[type],
874
+ baseClassName = _this$appliedClasses$.base,
875
+ activeClassName = _this$appliedClasses$.active,
876
+ doneClassName = _this$appliedClasses$.done;
877
+ this.appliedClasses[type] = {};
878
+ if (baseClassName) {
879
+ removeClass(node, baseClassName);
880
+ }
881
+ if (activeClassName) {
882
+ removeClass(node, activeClassName);
883
+ }
884
+ if (doneClassName) {
885
+ removeClass(node, doneClassName);
886
+ }
887
+ };
888
+ _proto.render = function render() {
889
+ var _this$props = this.props;
890
+ _this$props.classNames;
891
+ var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
892
+ return /*#__PURE__*/React__namespace.default.createElement(Transition, _extends({}, props, {
893
+ onEnter: this.onEnter,
894
+ onEntered: this.onEntered,
895
+ onEntering: this.onEntering,
896
+ onExit: this.onExit,
897
+ onExiting: this.onExiting,
898
+ onExited: this.onExited
899
+ }));
900
+ };
901
+ return CSSTransition;
902
+ }(React__namespace.default.Component);
903
+ CSSTransition.defaultProps = {
904
+ classNames: ''
905
+ };
906
+ CSSTransition.propTypes = {};
907
+
908
+ function _assertThisInitialized(self) {
909
+ if (self === void 0) {
910
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
911
+ }
912
+ return self;
913
+ }
914
+
915
+ /**
916
+ * Given `this.props.children`, return an object mapping key to child.
917
+ *
918
+ * @param {*} children `this.props.children`
919
+ * @return {object} Mapping of key to child
920
+ */
921
+
922
+ function getChildMapping(children, mapFn) {
923
+ var mapper = function mapper(child) {
924
+ return mapFn && React.isValidElement(child) ? mapFn(child) : child;
925
+ };
926
+ var result = Object.create(null);
927
+ if (children) React.Children.map(children, function (c) {
928
+ return c;
929
+ }).forEach(function (child) {
930
+ // run the map function here instead so that the key is the computed one
931
+ result[child.key] = mapper(child);
932
+ });
933
+ return result;
934
+ }
935
+ /**
936
+ * When you're adding or removing children some may be added or removed in the
937
+ * same render pass. We want to show *both* since we want to simultaneously
938
+ * animate elements in and out. This function takes a previous set of keys
939
+ * and a new set of keys and merges them with its best guess of the correct
940
+ * ordering. In the future we may expose some of the utilities in
941
+ * ReactMultiChild to make this easy, but for now React itself does not
942
+ * directly have this concept of the union of prevChildren and nextChildren
943
+ * so we implement it here.
944
+ *
945
+ * @param {object} prev prev children as returned from
946
+ * `ReactTransitionChildMapping.getChildMapping()`.
947
+ * @param {object} next next children as returned from
948
+ * `ReactTransitionChildMapping.getChildMapping()`.
949
+ * @return {object} a key set that contains all keys in `prev` and all keys
950
+ * in `next` in a reasonable order.
951
+ */
952
+
953
+ function mergeChildMappings(prev, next) {
954
+ prev = prev || {};
955
+ next = next || {};
956
+ function getValueForKey(key) {
957
+ return key in next ? next[key] : prev[key];
958
+ } // For each key of `next`, the list of keys to insert before that key in
959
+ // the combined list
960
+
961
+ var nextKeysPending = Object.create(null);
962
+ var pendingKeys = [];
963
+ for (var prevKey in prev) {
964
+ if (prevKey in next) {
965
+ if (pendingKeys.length) {
966
+ nextKeysPending[prevKey] = pendingKeys;
967
+ pendingKeys = [];
968
+ }
969
+ } else {
970
+ pendingKeys.push(prevKey);
971
+ }
972
+ }
973
+ var i;
974
+ var childMapping = {};
975
+ for (var nextKey in next) {
976
+ if (nextKeysPending[nextKey]) {
977
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
978
+ var pendingNextKey = nextKeysPending[nextKey][i];
979
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
980
+ }
981
+ }
982
+ childMapping[nextKey] = getValueForKey(nextKey);
983
+ } // Finally, add the keys which didn't appear before any key in `next`
984
+
985
+ for (i = 0; i < pendingKeys.length; i++) {
986
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
987
+ }
988
+ return childMapping;
989
+ }
990
+ function getProp(child, prop, props) {
991
+ return props[prop] != null ? props[prop] : child.props[prop];
992
+ }
993
+ function getInitialChildMapping(props, onExited) {
994
+ return getChildMapping(props.children, function (child) {
995
+ return React.cloneElement(child, {
996
+ onExited: onExited.bind(null, child),
997
+ in: true,
998
+ appear: getProp(child, 'appear', props),
999
+ enter: getProp(child, 'enter', props),
1000
+ exit: getProp(child, 'exit', props)
1001
+ });
1002
+ });
1003
+ }
1004
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
1005
+ var nextChildMapping = getChildMapping(nextProps.children);
1006
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
1007
+ Object.keys(children).forEach(function (key) {
1008
+ var child = children[key];
1009
+ if (!React.isValidElement(child)) return;
1010
+ var hasPrev = (key in prevChildMapping);
1011
+ var hasNext = (key in nextChildMapping);
1012
+ var prevChild = prevChildMapping[key];
1013
+ var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
1014
+
1015
+ if (hasNext && (!hasPrev || isLeaving)) {
1016
+ // console.log('entering', key)
1017
+ children[key] = React.cloneElement(child, {
1018
+ onExited: onExited.bind(null, child),
1019
+ in: true,
1020
+ exit: getProp(child, 'exit', nextProps),
1021
+ enter: getProp(child, 'enter', nextProps)
1022
+ });
1023
+ } else if (!hasNext && hasPrev && !isLeaving) {
1024
+ // item is old (exiting)
1025
+ // console.log('leaving', key)
1026
+ children[key] = React.cloneElement(child, {
1027
+ in: false
1028
+ });
1029
+ } else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
1030
+ // item hasn't changed transition states
1031
+ // copy over the last transition props;
1032
+ // console.log('unchanged', key)
1033
+ children[key] = React.cloneElement(child, {
1034
+ onExited: onExited.bind(null, child),
1035
+ in: prevChild.props.in,
1036
+ exit: getProp(child, 'exit', nextProps),
1037
+ enter: getProp(child, 'enter', nextProps)
1038
+ });
1039
+ }
1040
+ });
1041
+ return children;
1042
+ }
1043
+
1044
+ var values = Object.values || function (obj) {
1045
+ return Object.keys(obj).map(function (k) {
1046
+ return obj[k];
1047
+ });
1048
+ };
1049
+ var defaultProps = {
1050
+ component: 'div',
1051
+ childFactory: function childFactory(child) {
1052
+ return child;
1053
+ }
1054
+ };
1055
+ /**
1056
+ * The `<TransitionGroup>` component manages a set of transition components
1057
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
1058
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
1059
+ * and unmounting of components over time.
1060
+ *
1061
+ * Consider the example below. As items are removed or added to the TodoList the
1062
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
1063
+ *
1064
+ * Note that `<TransitionGroup>` does not define any animation behavior!
1065
+ * Exactly _how_ a list item animates is up to the individual transition
1066
+ * component. This means you can mix and match animations across different list
1067
+ * items.
1068
+ */
1069
+
1070
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
1071
+ _inheritsLoose(TransitionGroup, _React$Component);
1072
+ function TransitionGroup(props, context) {
1073
+ var _this;
1074
+ _this = _React$Component.call(this, props, context) || this;
1075
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
1076
+
1077
+ _this.state = {
1078
+ contextValue: {
1079
+ isMounting: true
1080
+ },
1081
+ handleExited: handleExited,
1082
+ firstRender: true
1083
+ };
1084
+ return _this;
1085
+ }
1086
+ var _proto = TransitionGroup.prototype;
1087
+ _proto.componentDidMount = function componentDidMount() {
1088
+ this.mounted = true;
1089
+ this.setState({
1090
+ contextValue: {
1091
+ isMounting: false
1092
+ }
1093
+ });
1094
+ };
1095
+ _proto.componentWillUnmount = function componentWillUnmount() {
1096
+ this.mounted = false;
1097
+ };
1098
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
1099
+ var prevChildMapping = _ref.children,
1100
+ handleExited = _ref.handleExited,
1101
+ firstRender = _ref.firstRender;
1102
+ return {
1103
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
1104
+ firstRender: false
1105
+ };
1106
+ } // node is `undefined` when user provided `nodeRef` prop
1107
+ ;
1108
+
1109
+ _proto.handleExited = function handleExited(child, node) {
1110
+ var currentChildMapping = getChildMapping(this.props.children);
1111
+ if (child.key in currentChildMapping) return;
1112
+ if (child.props.onExited) {
1113
+ child.props.onExited(node);
1114
+ }
1115
+ if (this.mounted) {
1116
+ this.setState(function (state) {
1117
+ var children = _extends({}, state.children);
1118
+ delete children[child.key];
1119
+ return {
1120
+ children: children
1121
+ };
1122
+ });
1123
+ }
1124
+ };
1125
+ _proto.render = function render() {
1126
+ var _this$props = this.props,
1127
+ Component = _this$props.component,
1128
+ childFactory = _this$props.childFactory,
1129
+ props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
1130
+ var contextValue = this.state.contextValue;
1131
+ var children = values(this.state.children).map(childFactory);
1132
+ delete props.appear;
1133
+ delete props.enter;
1134
+ delete props.exit;
1135
+ if (Component === null) {
1136
+ return /*#__PURE__*/React__namespace.default.createElement(TransitionGroupContext.Provider, {
1137
+ value: contextValue
1138
+ }, children);
1139
+ }
1140
+ return /*#__PURE__*/React__namespace.default.createElement(TransitionGroupContext.Provider, {
1141
+ value: contextValue
1142
+ }, /*#__PURE__*/React__namespace.default.createElement(Component, props, children));
1143
+ };
1144
+ return TransitionGroup;
1145
+ }(React__namespace.default.Component);
1146
+ TransitionGroup.propTypes = {};
1147
+ TransitionGroup.defaultProps = defaultProps;
1148
+
1149
+ /**
1150
+ * The `<ReplaceTransition>` component is a specialized `Transition` component
1151
+ * that animates between two children.
1152
+ *
1153
+ * ```jsx
1154
+ * <ReplaceTransition in>
1155
+ * <Fade><div>I appear first</div></Fade>
1156
+ * <Fade><div>I replace the above</div></Fade>
1157
+ * </ReplaceTransition>
1158
+ * ```
1159
+ */
1160
+
1161
+ var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
1162
+ _inheritsLoose(ReplaceTransition, _React$Component);
1163
+ function ReplaceTransition() {
1164
+ var _this;
1165
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
1166
+ _args[_key] = arguments[_key];
1167
+ }
1168
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
1169
+ _this.handleEnter = function () {
1170
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1171
+ args[_key2] = arguments[_key2];
1172
+ }
1173
+ return _this.handleLifecycle('onEnter', 0, args);
1174
+ };
1175
+ _this.handleEntering = function () {
1176
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1177
+ args[_key3] = arguments[_key3];
1178
+ }
1179
+ return _this.handleLifecycle('onEntering', 0, args);
1180
+ };
1181
+ _this.handleEntered = function () {
1182
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1183
+ args[_key4] = arguments[_key4];
1184
+ }
1185
+ return _this.handleLifecycle('onEntered', 0, args);
1186
+ };
1187
+ _this.handleExit = function () {
1188
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1189
+ args[_key5] = arguments[_key5];
1190
+ }
1191
+ return _this.handleLifecycle('onExit', 1, args);
1192
+ };
1193
+ _this.handleExiting = function () {
1194
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1195
+ args[_key6] = arguments[_key6];
1196
+ }
1197
+ return _this.handleLifecycle('onExiting', 1, args);
1198
+ };
1199
+ _this.handleExited = function () {
1200
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1201
+ args[_key7] = arguments[_key7];
1202
+ }
1203
+ return _this.handleLifecycle('onExited', 1, args);
1204
+ };
1205
+ return _this;
1206
+ }
1207
+ var _proto = ReplaceTransition.prototype;
1208
+ _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
1209
+ var _child$props;
1210
+ var children = this.props.children;
1211
+ var child = React__namespace.default.Children.toArray(children)[idx];
1212
+ if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
1213
+ if (this.props[handler]) {
1214
+ var maybeNode = child.props.nodeRef ? undefined : ReactDOM__default.default.findDOMNode(this);
1215
+ this.props[handler](maybeNode);
1216
+ }
1217
+ };
1218
+ _proto.render = function render() {
1219
+ var _this$props = this.props,
1220
+ children = _this$props.children,
1221
+ inProp = _this$props.in,
1222
+ props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
1223
+ var _React$Children$toArr = React__namespace.default.Children.toArray(children),
1224
+ first = _React$Children$toArr[0],
1225
+ second = _React$Children$toArr[1];
1226
+ delete props.onEnter;
1227
+ delete props.onEntering;
1228
+ delete props.onEntered;
1229
+ delete props.onExit;
1230
+ delete props.onExiting;
1231
+ delete props.onExited;
1232
+ return /*#__PURE__*/React__namespace.default.createElement(TransitionGroup, props, inProp ? React__namespace.default.cloneElement(first, {
1233
+ key: 'first',
1234
+ onEnter: this.handleEnter,
1235
+ onEntering: this.handleEntering,
1236
+ onEntered: this.handleEntered
1237
+ }) : React__namespace.default.cloneElement(second, {
1238
+ key: 'second',
1239
+ onEnter: this.handleExit,
1240
+ onEntering: this.handleExiting,
1241
+ onEntered: this.handleExited
1242
+ }));
1243
+ };
1244
+ return ReplaceTransition;
1245
+ }(React__namespace.default.Component);
1246
+ ReplaceTransition.propTypes = {};
1247
+
1248
+ var _leaveRenders, _enterRenders;
1249
+ function areChildrenDifferent(oldChildren, newChildren) {
1250
+ if (oldChildren === newChildren) return false;
1251
+ if (React__namespace.default.isValidElement(oldChildren) && React__namespace.default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
1252
+ return false;
1253
+ }
1254
+ return true;
1255
+ }
1256
+ /**
1257
+ * Enum of modes for SwitchTransition component
1258
+ * @enum { string }
1259
+ */
1260
+
1261
+ var modes = {
1262
+ out: 'out-in',
1263
+ in: 'in-out'
1264
+ };
1265
+ var callHook = function callHook(element, name, cb) {
1266
+ return function () {
1267
+ var _element$props;
1268
+ element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
1269
+ cb();
1270
+ };
1271
+ };
1272
+ var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
1273
+ var current = _ref.current,
1274
+ changeState = _ref.changeState;
1275
+ return React__namespace.default.cloneElement(current, {
1276
+ in: false,
1277
+ onExited: callHook(current, 'onExited', function () {
1278
+ changeState(ENTERING, null);
1279
+ })
1280
+ });
1281
+ }, _leaveRenders[modes.in] = function (_ref2) {
1282
+ var current = _ref2.current,
1283
+ changeState = _ref2.changeState,
1284
+ children = _ref2.children;
1285
+ return [current, React__namespace.default.cloneElement(children, {
1286
+ in: true,
1287
+ onEntered: callHook(children, 'onEntered', function () {
1288
+ changeState(ENTERING);
1289
+ })
1290
+ })];
1291
+ }, _leaveRenders);
1292
+ var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
1293
+ var children = _ref3.children,
1294
+ changeState = _ref3.changeState;
1295
+ return React__namespace.default.cloneElement(children, {
1296
+ in: true,
1297
+ onEntered: callHook(children, 'onEntered', function () {
1298
+ changeState(ENTERED, React__namespace.default.cloneElement(children, {
1299
+ in: true
1300
+ }));
1301
+ })
1302
+ });
1303
+ }, _enterRenders[modes.in] = function (_ref4) {
1304
+ var current = _ref4.current,
1305
+ children = _ref4.children,
1306
+ changeState = _ref4.changeState;
1307
+ return [React__namespace.default.cloneElement(current, {
1308
+ in: false,
1309
+ onExited: callHook(current, 'onExited', function () {
1310
+ changeState(ENTERED, React__namespace.default.cloneElement(children, {
1311
+ in: true
1312
+ }));
1313
+ })
1314
+ }), React__namespace.default.cloneElement(children, {
1315
+ in: true
1316
+ })];
1317
+ }, _enterRenders);
1318
+ /**
1319
+ * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
1320
+ * You can use it when you want to control the render between state transitions.
1321
+ * 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.
1322
+ *
1323
+ * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
1324
+ * 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.
1325
+ *
1326
+ * **Note**: If you want the animation to happen simultaneously
1327
+ * (that is, to have the old child removed and a new child inserted **at the same time**),
1328
+ * you should use
1329
+ * [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
1330
+ * instead.
1331
+ *
1332
+ * ```jsx
1333
+ * function App() {
1334
+ * const [state, setState] = useState(false);
1335
+ * return (
1336
+ * <SwitchTransition>
1337
+ * <CSSTransition
1338
+ * key={state ? "Goodbye, world!" : "Hello, world!"}
1339
+ * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
1340
+ * classNames='fade'
1341
+ * >
1342
+ * <button onClick={() => setState(state => !state)}>
1343
+ * {state ? "Goodbye, world!" : "Hello, world!"}
1344
+ * </button>
1345
+ * </CSSTransition>
1346
+ * </SwitchTransition>
1347
+ * );
1348
+ * }
1349
+ * ```
1350
+ *
1351
+ * ```css
1352
+ * .fade-enter{
1353
+ * opacity: 0;
1354
+ * }
1355
+ * .fade-exit{
1356
+ * opacity: 1;
1357
+ * }
1358
+ * .fade-enter-active{
1359
+ * opacity: 1;
1360
+ * }
1361
+ * .fade-exit-active{
1362
+ * opacity: 0;
1363
+ * }
1364
+ * .fade-enter-active,
1365
+ * .fade-exit-active{
1366
+ * transition: opacity 500ms;
1367
+ * }
1368
+ * ```
1369
+ */
1370
+
1371
+ var SwitchTransition = /*#__PURE__*/function (_React$Component) {
1372
+ _inheritsLoose(SwitchTransition, _React$Component);
1373
+ function SwitchTransition() {
1374
+ var _this;
1375
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1376
+ args[_key] = arguments[_key];
1377
+ }
1378
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
1379
+ _this.state = {
1380
+ status: ENTERED,
1381
+ current: null
1382
+ };
1383
+ _this.appeared = false;
1384
+ _this.changeState = function (status, current) {
1385
+ if (current === void 0) {
1386
+ current = _this.state.current;
1387
+ }
1388
+ _this.setState({
1389
+ status: status,
1390
+ current: current
1391
+ });
1392
+ };
1393
+ return _this;
1394
+ }
1395
+ var _proto = SwitchTransition.prototype;
1396
+ _proto.componentDidMount = function componentDidMount() {
1397
+ this.appeared = true;
1398
+ };
1399
+ SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
1400
+ if (props.children == null) {
1401
+ return {
1402
+ current: null
1403
+ };
1404
+ }
1405
+ if (state.status === ENTERING && props.mode === modes.in) {
1406
+ return {
1407
+ status: ENTERING
1408
+ };
1409
+ }
1410
+ if (state.current && areChildrenDifferent(state.current, props.children)) {
1411
+ return {
1412
+ status: EXITING
1413
+ };
1414
+ }
1415
+ return {
1416
+ current: React__namespace.default.cloneElement(props.children, {
1417
+ in: true
1418
+ })
1419
+ };
1420
+ };
1421
+ _proto.render = function render() {
1422
+ var _this$props = this.props,
1423
+ children = _this$props.children,
1424
+ mode = _this$props.mode,
1425
+ _this$state = this.state,
1426
+ status = _this$state.status,
1427
+ current = _this$state.current;
1428
+ var data = {
1429
+ children: children,
1430
+ current: current,
1431
+ changeState: this.changeState,
1432
+ status: status
1433
+ };
1434
+ var component;
1435
+ switch (status) {
1436
+ case ENTERING:
1437
+ component = enterRenders[mode](data);
1438
+ break;
1439
+ case EXITING:
1440
+ component = leaveRenders[mode](data);
1441
+ break;
1442
+ case ENTERED:
1443
+ component = current;
1444
+ }
1445
+ return /*#__PURE__*/React__namespace.default.createElement(TransitionGroupContext.Provider, {
1446
+ value: {
1447
+ isMounting: !this.appeared
1448
+ }
1449
+ }, component);
1450
+ };
1451
+ return SwitchTransition;
1452
+ }(React__namespace.default.Component);
1453
+ SwitchTransition.propTypes = {};
1454
+ SwitchTransition.defaultProps = {
1455
+ mode: modes.out
1456
+ };
1457
+
1458
+ var useMergeRefs = function () {
1459
+ var refs = [];
1460
+ for (var _i = 0; _i < arguments.length; _i++) {
1461
+ refs[_i] = arguments[_i];
1462
+ }
1463
+ return React.useMemo(function () {
1464
+ if (refs.every(function (ref) {
1465
+ return ref == null;
1466
+ })) {
1467
+ return null;
1468
+ }
1469
+ return function (instance) {
1470
+ refs.forEach(function (ref) {
1471
+ if (typeof ref === 'function') {
1472
+ ref(instance);
1473
+ } else if (ref) {
1474
+ ref.current = instance;
1475
+ }
1476
+ });
1477
+ };
1478
+ }, refs);
1479
+ };
1480
+
1481
+ var styles = {
1482
+ zoom: {
1483
+ entering: {
1484
+ transform: 'none'
1485
+ },
1486
+ entered: {
1487
+ transform: 'none'
1488
+ }
1489
+ },
1490
+ fade: {
1491
+ entering: {
1492
+ opacity: 1
1493
+ },
1494
+ entered: {
1495
+ opacity: 1
1496
+ }
1497
+ },
1498
+ grow: {
1499
+ entering: {
1500
+ opacity: 1,
1501
+ transform: 'scale(1, 1)'
1502
+ },
1503
+ entered: {
1504
+ opacity: 1,
1505
+ transform: 'none'
1506
+ }
1507
+ },
1508
+ slide_fade: {
1509
+ entering: {
1510
+ opacity: 0,
1511
+ transform: 'translateY(4px)'
1512
+ },
1513
+ entered: {
1514
+ opacity: 1,
1515
+ transform: ''
1516
+ },
1517
+ exited: {
1518
+ opacity: 0,
1519
+ transform: 'translateY(4px)'
1520
+ }
1521
+ },
1522
+ grow_from_container: {},
1523
+ collapse: {},
1524
+ slide: {}
1525
+ };
1526
+ var defaultTransform = {
1527
+ grow: 'scale(0.75, 0.5625)',
1528
+ zoom: 'scale(0)'
1529
+ };
1530
+ var reflow = function (node) {
1531
+ return node.scrollTop;
1532
+ };
1533
+ function getTransitionProps(props, options) {
1534
+ var _a, _b;
1535
+ var timeout = props.timeout,
1536
+ easing = props.easing,
1537
+ _c = props.style,
1538
+ style = _c === void 0 ? {} : _c;
1539
+ return {
1540
+ duration: (_a = style.transitionDuration) !== null && _a !== void 0 ? _a : typeof timeout === 'number' ? timeout : timeout[options.mode] || 0,
1541
+ easing: (_b = style.transitionTimingFunction) !== null && _b !== void 0 ? _b : typeof easing === 'object' ? easing[options.mode] : easing,
1542
+ delay: style.transitionDelay
1543
+ };
1544
+ }
1545
+ function getTranslateValue(direction, node, containerRef) {
1546
+ var rect = node.getBoundingClientRect();
1547
+ var containerRect = containerRef && containerRef.getBoundingClientRect();
1548
+ var computedStyle = window.getComputedStyle(node);
1549
+ var transform = computedStyle.getPropertyValue('-webkit-transform') || computedStyle.getPropertyValue('transform');
1550
+ var offsetX = 0;
1551
+ var offsetY = 0;
1552
+ if (transform && transform !== 'none' && typeof transform === 'string') {
1553
+ var transformValues = transform.split('(')[1].split(')')[0].split(',');
1554
+ offsetX = parseInt(transformValues[4], 10);
1555
+ offsetY = parseInt(transformValues[5], 10);
1556
+ }
1557
+ if (direction === 'left') {
1558
+ if (containerRect) {
1559
+ return "translateX(".concat(containerRect.right + offsetX - rect.left, "px)");
1560
+ }
1561
+ return "translateX(".concat(window.innerWidth + offsetX - rect.left, "px)");
1562
+ }
1563
+ if (direction === 'right') {
1564
+ if (containerRect) {
1565
+ return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px)");
1566
+ }
1567
+ return "translateX(-".concat(rect.left + rect.width - offsetX, "px)");
1568
+ }
1569
+ if (direction === 'up') {
1570
+ if (containerRect) {
1571
+ return "translateY(".concat(containerRect.bottom + offsetY - rect.top, "px)");
1572
+ }
1573
+ return "translateY(".concat(window.innerHeight + offsetY - rect.top, "px)");
1574
+ }
1575
+ if (containerRect) {
1576
+ return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px)");
1577
+ }
1578
+ return "translateY(-".concat(rect.top + rect.height - offsetY, "px)");
1579
+ }
1580
+ function setTranslateValue(direction, node, containerRef) {
1581
+ var transform = getTranslateValue(direction, node, containerRef);
1582
+ if (transform) {
1583
+ node.style.webkitTransform = transform;
1584
+ node.style.transform = transform;
1585
+ }
1586
+ }
1587
+ function getGrowFromContainerStyles(_a) {
1588
+ var containerRef = _a.containerRef,
1589
+ node = _a.node,
1590
+ transitionProps = _a.transitionProps;
1591
+ var _b = transitionProps !== null && transitionProps !== void 0 ? transitionProps : {},
1592
+ _c = _b.delay,
1593
+ delay = _c === void 0 ? 0 : _c,
1594
+ _d = _b.duration,
1595
+ duration = _d === void 0 ? 300 : _d,
1596
+ _e = _b.easing,
1597
+ easing = _e === void 0 ? '' : _e;
1598
+ requestAnimationFrame(function () {
1599
+ var _a;
1600
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) return;
1601
+ var _b = (_a = containerRef.current.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {},
1602
+ width = _b.width,
1603
+ height = _b.height,
1604
+ top = _b.top,
1605
+ left = _b.left;
1606
+ node.style.transition = '';
1607
+ node.style.opacity = '0';
1608
+ var _c = node.getBoundingClientRect(),
1609
+ realHeight = _c.height,
1610
+ realWidth = _c.width;
1611
+ requestAnimationFrame(function () {
1612
+ node.style.transformOrigin = 'top left';
1613
+ node.style.top = top + 'px';
1614
+ node.style.left = left + 'px';
1615
+ node.style.opacity = '0';
1616
+ node.style.height = height + 'px';
1617
+ node.style.width = width + 'px';
1618
+ node.style.transform = 'translate(0, 0)';
1619
+ requestAnimationFrame(function () {
1620
+ node.style.transition = "opacity ".concat(duration / 3, "ms ").concat(delay, "ms ").concat(easing, ", width ").concat(duration, "ms ").concat(delay, "ms ").concat(easing, ", height ").concat(duration, "ms ").concat(delay, "ms ").concat(easing, ", transform ").concat(duration, "ms ").concat(delay, "ms ").concat(easing);
1621
+ node.style.height = realHeight + 'px';
1622
+ node.style.width = realWidth + 'px';
1623
+ node.style.opacity = '1';
1624
+ node.style.transform = "translate(".concat(-left, "px, ").concat(-top, "px)");
1625
+ });
1626
+ });
1627
+ });
1628
+ }
1629
+ function getExitGrowFromContainerStyles(_a) {
1630
+ var containerRef = _a.containerRef,
1631
+ node = _a.node,
1632
+ transitionProps = _a.transitionProps;
1633
+ var _b = transitionProps !== null && transitionProps !== void 0 ? transitionProps : {},
1634
+ _c = _b.delay,
1635
+ delay = _c === void 0 ? 0 : _c,
1636
+ _d = _b.duration,
1637
+ duration = _d === void 0 ? 300 : _d,
1638
+ _e = _b.easing,
1639
+ easing = _e === void 0 ? '' : _e;
1640
+ var resizingTime = 6 * duration / 10;
1641
+ var fadingDelay = 5 * duration / 10;
1642
+ requestAnimationFrame(function () {
1643
+ var _a;
1644
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current)) return;
1645
+ var _b = (_a = containerRef.current.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {},
1646
+ width = _b.width,
1647
+ height = _b.height,
1648
+ top = _b.top,
1649
+ left = _b.left;
1650
+ node.style.transition = "opacity ".concat(duration, "ms ").concat(fadingDelay, "ms ").concat(easing, ", width ").concat(resizingTime, "ms ").concat(delay, "ms ").concat(easing, ", height ").concat(resizingTime, "ms ").concat(delay, "ms ").concat(easing, ", transform ").concat(resizingTime, "ms ").concat(delay, "ms ").concat(easing);
1651
+ node.style.transformOrigin = 'top left';
1652
+ node.style.top = top + 'px';
1653
+ node.style.left = left + 'px';
1654
+ node.style.opacity = '0';
1655
+ node.style.height = height + 'px';
1656
+ node.style.width = width + 'px';
1657
+ node.style.transform = 'translate(0, 0)';
1658
+ });
1659
+ }
1660
+ React__namespace.forwardRef(function (_a, forwardedRef) {
1661
+ var _b = _a.appear,
1662
+ appear = _b === void 0 ? true : _b,
1663
+ inProp = _a.in;
1664
+ _a.css;
1665
+ var style = _a.style,
1666
+ type = _a.type,
1667
+ children = _a.children,
1668
+ timeout = _a.timeout,
1669
+ easing = _a.easing,
1670
+ containerRef = _a.containerRef,
1671
+ _c = _a.slideDirection,
1672
+ slideDirection = _c === void 0 ? 'down' : _c,
1673
+ onEnter = _a.onEnter,
1674
+ onEntered = _a.onEntered,
1675
+ onEntering = _a.onEntering,
1676
+ onExit = _a.onExit,
1677
+ onExited = _a.onExited,
1678
+ onExiting = _a.onExiting,
1679
+ addEndListener = _a.addEndListener,
1680
+ other = __rest(_a, ["appear", "in", "css", "style", "type", "children", "timeout", "easing", "containerRef", "slideDirection", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "addEndListener"]);
1681
+ var theme = ctDesignTheme.useTheme();
1682
+ var defaultTimeout = {
1683
+ enter: theme.transitions.duration.enteringScreen,
1684
+ exit: theme.transitions.duration.leavingScreen
1685
+ };
1686
+ timeout = timeout || defaultTimeout;
1687
+ var nodeRef = React__namespace.useRef(null);
1688
+ var handleRef = useMergeRefs(nodeRef, children === null || children === void 0 ? void 0 : children.ref, forwardedRef);
1689
+ var normalizedTransitionCallback = function (callback) {
1690
+ return function (maybeIsAppearing) {
1691
+ if (callback) {
1692
+ var node = nodeRef.current;
1693
+ if (maybeIsAppearing === undefined) {
1694
+ callback(node);
1695
+ } else {
1696
+ callback(node, maybeIsAppearing);
1697
+ }
1698
+ }
1699
+ };
1700
+ };
1701
+ var handleEnter = normalizedTransitionCallback(function (node, isAppearing) {
1702
+ if (type === 'slide') {
1703
+ setTranslateValue(slideDirection, node, containerRef);
1704
+ }
1705
+ reflow(node);
1706
+ var transitionProps = getTransitionProps({
1707
+ style: style,
1708
+ timeout: timeout,
1709
+ easing: easing
1710
+ }, {
1711
+ mode: 'enter'
1712
+ });
1713
+ if (type === 'fade') {
1714
+ node.style.webkitTransition = theme.transitions.create('opacity', transitionProps);
1715
+ node.style.transition = theme.transitions.create('opacity', transitionProps);
1716
+ }
1717
+ if (type === 'slide_fade') {
1718
+ node.style.webkitTransition = [theme.transitions.create('opacity', transitionProps), theme.transitions.create('transform', transitionProps)].join(',');
1719
+ node.style.transition = [theme.transitions.create('opacity', transitionProps), theme.transitions.create('transform', transitionProps)].join(',');
1720
+ }
1721
+ if (type === 'grow_from_container') {
1722
+ getGrowFromContainerStyles({
1723
+ node: node,
1724
+ containerRef: containerRef,
1725
+ transitionProps: transitionProps
1726
+ });
1727
+ }
1728
+ if (type === 'grow') {
1729
+ var duration = void 0;
1730
+ node.style.transition = [theme.transitions.create('opacity', {
1731
+ duration: transitionProps.duration,
1732
+ delay: transitionProps.delay
1733
+ }), theme.transitions.create('transform', {
1734
+ duration: duration,
1735
+ delay: transitionProps.delay,
1736
+ easing: transitionProps.easing
1737
+ })].join(',');
1738
+ }
1739
+ if (type === 'zoom') {
1740
+ node.style.webkitTransition = theme.transitions.create('transform', transitionProps);
1741
+ node.style.transition = theme.transitions.create('transform', transitionProps);
1742
+ }
1743
+ if (onEnter) {
1744
+ onEnter(node, isAppearing);
1745
+ }
1746
+ });
1747
+ var handleEntering = normalizedTransitionCallback(function (node, isAppearing) {
1748
+ if (type === 'slide') {
1749
+ var easingValue = easing || {
1750
+ enter: theme.transitions.easing.easeOut,
1751
+ exit: theme.transitions.easing.sharp
1752
+ };
1753
+ var transitionProps = getTransitionProps({
1754
+ timeout: timeout,
1755
+ style: style,
1756
+ easing: easingValue
1757
+ }, {
1758
+ mode: 'enter'
1759
+ });
1760
+ node.style.webkitTransition = theme.transitions.create('-webkit-transform', __assign({}, transitionProps));
1761
+ node.style.transition = theme.transitions.create('transform', __assign({}, transitionProps));
1762
+ node.style.webkitTransform = 'none';
1763
+ node.style.transform = 'none';
1764
+ }
1765
+ if (onEntering) {
1766
+ onEntering(node, isAppearing);
1767
+ }
1768
+ });
1769
+ var handleEntered = normalizedTransitionCallback(onEntered);
1770
+ var handleExiting = normalizedTransitionCallback(onExiting);
1771
+ var handleExit = normalizedTransitionCallback(function (node) {
1772
+ var transitionProps = getTransitionProps({
1773
+ style: style,
1774
+ timeout: timeout,
1775
+ easing: easing
1776
+ }, {
1777
+ mode: 'exit'
1778
+ });
1779
+ if (type == 'fade') {
1780
+ node.style.webkitTransition = theme.transitions.create('opacity', transitionProps);
1781
+ node.style.transition = theme.transitions.create('opacity', transitionProps);
1782
+ }
1783
+ if (type === 'slide_fade') {
1784
+ node.style.transition = '';
1785
+ node.style.webkitTransition = '';
1786
+ }
1787
+ if (type === 'grow_from_container') {
1788
+ getExitGrowFromContainerStyles({
1789
+ node: node,
1790
+ containerRef: containerRef,
1791
+ transitionProps: transitionProps
1792
+ });
1793
+ }
1794
+ if (type === 'grow') {
1795
+ node.style.transition = [theme.transitions.create('opacity', {
1796
+ duration: transitionProps.duration,
1797
+ delay: transitionProps.delay
1798
+ }), theme.transitions.create('transform', {
1799
+ duration: transitionProps.duration,
1800
+ delay: transitionProps.delay,
1801
+ easing: transitionProps.easing
1802
+ })].join(',');
1803
+ node.style.opacity = 0;
1804
+ node.style.transform = 'scale(0.75, 0.5625)';
1805
+ }
1806
+ if (type === 'zoom') {
1807
+ node.style.webkitTransition = theme.transitions.create('transform', transitionProps);
1808
+ node.style.transition = theme.transitions.create('transform', transitionProps);
1809
+ }
1810
+ if (type === 'slide') {
1811
+ node.style.webkitTransition = theme.transitions.create('-webkit-transform', transitionProps);
1812
+ node.style.transition = theme.transitions.create('transform', transitionProps);
1813
+ setTranslateValue(slideDirection, node, containerRef);
1814
+ }
1815
+ if (onExit) {
1816
+ onExit(node);
1817
+ }
1818
+ });
1819
+ var handleExited = normalizedTransitionCallback(function (node) {
1820
+ if (type === 'slide') {
1821
+ node.style.webkitTransition = '';
1822
+ node.style.transition = '';
1823
+ }
1824
+ if (onExited) {
1825
+ onExited(node);
1826
+ }
1827
+ });
1828
+ var handleAddEndListener = function (next) {
1829
+ if (addEndListener && nodeRef.current) {
1830
+ addEndListener(nodeRef.current, next);
1831
+ }
1832
+ };
1833
+ var updatePosition = React__namespace.useCallback(function () {
1834
+ if (nodeRef.current) {
1835
+ setTranslateValue(slideDirection, nodeRef.current, containerRef);
1836
+ }
1837
+ }, [slideDirection, containerRef]);
1838
+ React__namespace.useEffect(function () {
1839
+ if (inProp || slideDirection === 'down' || slideDirection === 'right') {
1840
+ return undefined;
1841
+ }
1842
+ var handleResize = ctDesignCommonUtils.debounce(function () {
1843
+ if (nodeRef.current) {
1844
+ setTranslateValue(slideDirection, nodeRef.current, containerRef);
1845
+ }
1846
+ });
1847
+ window.addEventListener('resize', handleResize);
1848
+ return function () {
1849
+ window.removeEventListener('resize', handleResize);
1850
+ };
1851
+ }, [slideDirection, inProp, containerRef]);
1852
+ React__namespace.useEffect(function () {
1853
+ if (type === 'slide' && !inProp) {
1854
+ updatePosition();
1855
+ }
1856
+ }, [inProp, updatePosition]);
1857
+ return jsxRuntime.jsx(Transition, __assign({
1858
+ appear: appear,
1859
+ in: inProp,
1860
+ nodeRef: nodeRef,
1861
+ onEnter: handleEnter,
1862
+ onEntered: handleEntered,
1863
+ onEntering: handleEntering,
1864
+ onExit: handleExit,
1865
+ onExited: handleExited,
1866
+ onExiting: handleExiting,
1867
+ addEndListener: handleAddEndListener,
1868
+ timeout: timeout
1869
+ }, other, {
1870
+ children: function (state) {
1871
+ var childProp = {
1872
+ style: __assign(__assign(__assign({
1873
+ opacity: (type == 'fade' || type === 'grow') && 0,
1874
+ transform: defaultTransform[type],
1875
+ visibility: state === 'exited' && !inProp ? 'hidden' : undefined
1876
+ }, styles[type][state]), style), children.props.style),
1877
+ ref: handleRef
1878
+ };
1879
+ if (type === 'slide') {
1880
+ childProp = __assign(__assign({}, childProp), children.props);
1881
+ }
1882
+ return React__namespace.cloneElement(children, childProp);
1883
+ }
1884
+ }));
1885
+ });
1886
+
94
1887
  var HOVER_TYPE;
95
1888
  (function (HOVER_TYPE) {
96
1889
  HOVER_TYPE["ENTER"] = "ENTER";
@@ -119,14 +1912,14 @@
119
1912
  var _d = shadowWidth || {}, leftShadowWidth = _d.left, rightShadowWidth = _d.right;
120
1913
  var theme = ctDesignTheme.useTheme();
121
1914
  var childrenContainer = styleConfig.childrenContainer, leftChevron = styleConfig.leftChevron, leftShadowContainer = styleConfig.leftShadowContainer, leftShadowWrapper = styleConfig.leftShadowWrapper, rightChevron = styleConfig.rightChevron, rightShadowContainer = styleConfig.rightShadowContainer, rightShadowWrapper = styleConfig.rightShadowWrapper, root = styleConfig.root, scrollWrapper = styleConfig.scrollWrapper;
122
- var _e = react.useState(false), isHovering = _e[0], setIsHovering = _e[1];
123
- var _f = react.useState({
1915
+ var _e = React.useState(false), isHovering = _e[0], setIsHovering = _e[1];
1916
+ var _f = React.useState({
124
1917
  left: false,
125
1918
  right: false,
126
1919
  }), shadowDirection = _f[0], setShadowDirection = _f[1];
127
- var horizontalScrollRef = react.useRef(null);
128
- var parentContainerRef = react.useRef(null);
129
- var childContainerRef = react.useRef(null);
1920
+ var horizontalScrollRef = React.useRef(null);
1921
+ var parentContainerRef = React.useRef(null);
1922
+ var childContainerRef = React.useRef(null);
130
1923
  var updateArrowIcons = function () {
131
1924
  if (horizontalScrollRef.current && childContainerRef.current) {
132
1925
  var _a = horizontalScrollRef.current.getBoundingClientRect(), horizontalScrollRight = _a.right, horizontalScrollLeft = _a.left;
@@ -145,7 +1938,7 @@
145
1938
  }
146
1939
  }
147
1940
  };
148
- react.useEffect(function () {
1941
+ React.useEffect(function () {
149
1942
  var _a;
150
1943
  setTimeout(updateArrowIcons, 200);
151
1944
  var callback = ctDesignCommonUtils.debounce(updateArrowIcons, 200);
@@ -155,7 +1948,7 @@
155
1948
  (_a = parentContainerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', callback);
156
1949
  };
157
1950
  }, []);
158
- var onHover = react.useCallback(function (type) { return function () {
1951
+ var onHover = React.useCallback(function (type) { return function () {
159
1952
  if (type === HOVER_TYPE.ENTER) {
160
1953
  setIsHovering(true);
161
1954
  }
@@ -175,7 +1968,7 @@
175
1968
  }
176
1969
  }
177
1970
  }; };
178
- var arrowDimension = react.useMemo(function () {
1971
+ var arrowDimension = React.useMemo(function () {
179
1972
  switch (arrowSize) {
180
1973
  case exports.ARROW_SIZE.SM: {
181
1974
  return theme.size[6];