@cleartrip/ct-design-horizontal-scroll 2.16.0 → 3.1.0-SNAPSHOT-test.6

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