@cleartrip/ct-design-horizontal-scroll 4.0.0-TEST.3 → 5.0.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.
Files changed (45) hide show
  1. package/README.md +85 -0
  2. package/dist/HorizontalScroll.d.ts +3 -3
  3. package/dist/HorizontalScroll.d.ts.map +1 -1
  4. package/dist/HorizontalScroll.native.d.ts +5 -0
  5. package/dist/HorizontalScroll.native.d.ts.map +1 -0
  6. package/dist/constants.d.ts +10 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/ct-design-horizontal-scroll.browser.cjs.js +14 -1
  9. package/dist/ct-design-horizontal-scroll.browser.cjs.js.map +1 -1
  10. package/dist/ct-design-horizontal-scroll.browser.esm.js +14 -1
  11. package/dist/ct-design-horizontal-scroll.browser.esm.js.map +1 -1
  12. package/dist/ct-design-horizontal-scroll.cjs.js +40 -128
  13. package/dist/ct-design-horizontal-scroll.cjs.js.map +1 -1
  14. package/dist/ct-design-horizontal-scroll.esm.js +42 -128
  15. package/dist/ct-design-horizontal-scroll.esm.js.map +1 -1
  16. package/dist/ct-design-horizontal-scroll.umd.js +1619 -1871
  17. package/dist/ct-design-horizontal-scroll.umd.js.map +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.native.d.ts +4 -0
  21. package/dist/index.native.d.ts.map +1 -0
  22. package/dist/style.d.ts +40 -0
  23. package/dist/style.d.ts.map +1 -0
  24. package/dist/type.d.ts +21 -27
  25. package/dist/type.d.ts.map +1 -1
  26. package/package.json +31 -12
  27. package/src/HorizontalScroll.native.tsx +80 -0
  28. package/src/HorizontalScroll.tsx +62 -0
  29. package/src/constants.ts +10 -0
  30. package/src/index.native.ts +3 -0
  31. package/src/index.ts +3 -0
  32. package/src/style.ts +86 -0
  33. package/src/type.ts +67 -0
  34. package/dist/StyledHorizontalScroll/StyledHorizontalScroll.d.ts +0 -6
  35. package/dist/StyledHorizontalScroll/StyledHorizontalScroll.d.ts.map +0 -1
  36. package/dist/StyledHorizontalScroll/index.d.ts +0 -2
  37. package/dist/StyledHorizontalScroll/index.d.ts.map +0 -1
  38. package/dist/StyledLeftShadow/StyledLeftShadow.d.ts +0 -11
  39. package/dist/StyledLeftShadow/StyledLeftShadow.d.ts.map +0 -1
  40. package/dist/StyledLeftShadow/index.d.ts +0 -2
  41. package/dist/StyledLeftShadow/index.d.ts.map +0 -1
  42. package/dist/StyledRightShadow/StyledRightShadow.d.ts +0 -11
  43. package/dist/StyledRightShadow/StyledRightShadow.d.ts.map +0 -1
  44. package/dist/StyledRightShadow/index.d.ts +0 -2
  45. package/dist/StyledRightShadow/index.d.ts.map +0 -1
@@ -1,1962 +1,1710 @@
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'), 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', 'styled-components', '@cleartrip/ct-design-icons', '@cleartrip/ct-design-theme', '@cleartrip/ct-design-common-utils', '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.ctDesignIcons, global.ctDesignTheme, global.ctDesignCommonUtils, global.ReactDOM, global.useMergeRefs));
5
- })(this, (function (exports, jsxRuntime, React, ctDesignContainer, styled, ctDesignIcons, ctDesignTheme, ctDesignCommonUtils, ReactDOM, useMergeRefs) { 'use strict';
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
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
- }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-use-merge-refs'), require('@cleartrip/ct-design-style-manager')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', '@cleartrip/ct-design-use-merge-refs', '@cleartrip/ct-design-style-manager'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemHorizontalScroll = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.useMergeRefs, global.ctDesignStyleManager));
5
+ })(this, (function (exports, jsxRuntime, react, ctDesignContainer, useMergeRefs, ctDesignStyleManager) { 'use strict';
26
6
 
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
- var styled__default = /*#__PURE__*/_interopDefault(styled);
29
- var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
30
- var useMergeRefs__default = /*#__PURE__*/_interopDefault(useMergeRefs);
31
-
32
- /******************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
47
-
48
- var __assign = function () {
49
- __assign = Object.assign || function __assign(t) {
50
- for (var s, i = 1, n = arguments.length; i < n; i++) {
51
- s = arguments[i];
52
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
53
- }
54
- return t;
55
- };
56
- return __assign.apply(this, arguments);
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
- }
66
- function __makeTemplateObject(cooked, raw) {
67
- if (Object.defineProperty) {
68
- Object.defineProperty(cooked, "raw", {
69
- value: raw
70
- });
71
- } else {
72
- cooked.raw = raw;
73
- }
74
- return cooked;
75
- }
76
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
77
- var e = new Error(message);
78
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
79
- };
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
80
8
 
81
- 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) {
82
- var width = _a.width;
83
- return width || '64px';
84
- }, function (_a) {
85
- var shadowGradientStyle = _a.shadowGradientStyle;
86
- return (shadowGradientStyle === null || shadowGradientStyle === void 0 ? void 0 : shadowGradientStyle.right) || "linear-gradient(270deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%)";
87
- }, function (_a) {
88
- var css = _a.css;
89
- return css && styled.css(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n\t", "\n "], ["\n\t", "\n "])), css);
90
- });
91
- var templateObject_1$2, templateObject_2$2;
92
-
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) {
94
- var width = _a.width;
95
- return width || '64px';
96
- }, function (_a) {
97
- var shadowGradientStyle = _a.shadowGradientStyle;
98
- return (shadowGradientStyle === null || shadowGradientStyle === void 0 ? void 0 : shadowGradientStyle.left) || "linear-gradient(90deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%)";
99
- }, function (_a) {
100
- var css = _a.css;
101
- return css && styled.css(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n\t", "\n "], ["\n\t", "\n "])), css);
102
- });
103
- var templateObject_1$1, templateObject_2$1;
9
+ var useMergeRefs__default = /*#__PURE__*/_interopDefault(useMergeRefs);
104
10
 
105
- 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) {
106
- var css = _a.css;
107
- return css && styled.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t", "\n "], ["\n\t", "\n "])), css);
108
- });
109
- var templateObject_1, templateObject_2;
110
-
111
- exports.ARROW_SIZE = void 0;
112
- (function (ARROW_SIZE) {
113
- ARROW_SIZE["SM"] = "sm";
114
- ARROW_SIZE["MD"] = "md";
115
- ARROW_SIZE["LG"] = "lg";
116
- })(exports.ARROW_SIZE || (exports.ARROW_SIZE = {}));
117
- exports.ARROW_DIRECTION = void 0;
118
- (function (ARROW_DIRECTION) {
119
- ARROW_DIRECTION["LEFT"] = "LEFT";
120
- ARROW_DIRECTION["RIGHT"] = "RIGHT";
121
- })(exports.ARROW_DIRECTION || (exports.ARROW_DIRECTION = {}));
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
- }
11
+ var isDevelopment$1 = false;
132
12
 
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
- }
13
+ /*
142
14
 
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
- }
15
+ Based off glamor's StyleSheet, thanks Sunil ❤️
148
16
 
149
- function _inheritsLoose(t, o) {
150
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
151
- }
17
+ high performance StyleSheet for css-in-js systems
152
18
 
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
- }
19
+ - uses multiple style tags behind the scenes for millions of rules
20
+ - uses `insertRule` for appending in production for *much* faster performance
168
21
 
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
- }
22
+ // usage
228
23
 
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
- }
24
+ import { StyleSheet } from '@emotion/sheet'
240
25
 
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
- }
26
+ let styleSheet = new StyleSheet({ key: '', container: document.head })
251
27
 
252
- /**
253
- * Adds a CSS class to a given element.
254
- *
255
- * @param element the element
256
- * @param className the CSS class name
257
- */
28
+ styleSheet.insert('#box { border: 1px solid red; }')
29
+ - appends a css rule into the stylesheet
258
30
 
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
- }
31
+ styleSheet.flush()
32
+ - empties the stylesheet of all its contents
262
33
 
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
- }
34
+ */
282
35
 
283
- var config = {
284
- disabled: false
285
- };
36
+ function sheetForTag(tag) {
37
+ if (tag.sheet) {
38
+ return tag.sheet;
39
+ } // this weirdness brought to you by firefox
286
40
 
287
- var TransitionGroupContext = React__namespace.default.createContext(null);
41
+ /* istanbul ignore next */
288
42
 
289
- var forceReflow = function forceReflow(node) {
290
- return node.scrollTop;
291
- };
43
+ for (var i = 0; i < document.styleSheets.length; i++) {
44
+ if (document.styleSheets[i].ownerNode === tag) {
45
+ return document.styleSheets[i];
46
+ }
47
+ } // this function should always return with a value
48
+ // TS can't understand it though so we make it stop complaining here
292
49
 
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;
50
+ return undefined;
51
+ }
52
+ function createStyleElement(options) {
53
+ var tag = document.createElement('style');
54
+ tag.setAttribute('data-emotion', options.key);
55
+ if (options.nonce !== undefined) {
56
+ tag.setAttribute('nonce', options.nonce);
57
+ }
58
+ tag.appendChild(document.createTextNode(''));
59
+ tag.setAttribute('data-s', '');
60
+ return tag;
61
+ }
62
+ var StyleSheet = /*#__PURE__*/function () {
63
+ // Using Node instead of HTMLElement since container may be a ShadowRoot
64
+ function StyleSheet(options) {
65
+ var _this = this;
66
+ this._insertTag = function (tag) {
67
+ var before;
68
+ if (_this.tags.length === 0) {
69
+ if (_this.insertionPoint) {
70
+ before = _this.insertionPoint.nextSibling;
71
+ } else if (_this.prepend) {
72
+ before = _this.container.firstChild;
404
73
  } else {
405
- initialStatus = ENTERED;
74
+ before = _this.before;
406
75
  }
407
76
  } else {
408
- if (props.unmountOnExit || props.mountOnEnter) {
409
- initialStatus = UNMOUNTED;
410
- } else {
411
- initialStatus = EXITED;
412
- }
77
+ before = _this.tags[_this.tags.length - 1].nextSibling;
413
78
  }
414
- _this.state = {
415
- status: initialStatus
79
+ _this.container.insertBefore(tag, before);
80
+ _this.tags.push(tag);
81
+ };
82
+ this.isSpeedy = options.speedy === undefined ? !isDevelopment$1 : options.speedy;
83
+ this.tags = [];
84
+ this.ctr = 0;
85
+ this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
86
+
87
+ this.key = options.key;
88
+ this.container = options.container;
89
+ this.prepend = options.prepend;
90
+ this.insertionPoint = options.insertionPoint;
91
+ this.before = null;
92
+ }
93
+ var _proto = StyleSheet.prototype;
94
+ _proto.hydrate = function hydrate(nodes) {
95
+ nodes.forEach(this._insertTag);
96
+ };
97
+ _proto.insert = function insert(rule) {
98
+ // the max length is how many rules we have per style tag, it's 65000 in speedy mode
99
+ // it's 1 in dev because we insert source maps that map a single rule to a location
100
+ // and you can only have one source map per style tag
101
+ if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
102
+ this._insertTag(createStyleElement(this));
103
+ }
104
+ var tag = this.tags[this.tags.length - 1];
105
+ if (this.isSpeedy) {
106
+ var sheet = sheetForTag(tag);
107
+ try {
108
+ // this is the ultrafast version, works across browsers
109
+ // the big drawback is that the css won't be editable in devtools
110
+ sheet.insertRule(rule, sheet.cssRules.length);
111
+ } catch (e) {}
112
+ } else {
113
+ tag.appendChild(document.createTextNode(rule));
114
+ }
115
+ this.ctr++;
116
+ };
117
+ _proto.flush = function flush() {
118
+ this.tags.forEach(function (tag) {
119
+ var _tag$parentNode;
120
+ return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
121
+ });
122
+ this.tags = [];
123
+ this.ctr = 0;
124
+ };
125
+ return StyleSheet;
126
+ }();
127
+
128
+ var stylisExports = {};
129
+ var stylis = {
130
+ get exports(){ return stylisExports; },
131
+ set exports(v){ stylisExports = v; },
132
+ };
133
+
134
+ (function (module, exports) {
135
+ (function (e, r) {
136
+ r(exports) ;
137
+ })(this, function (e) {
138
+
139
+ var r = "-ms-";
140
+ var a = "-moz-";
141
+ var c = "-webkit-";
142
+ var n = "comm";
143
+ var t = "rule";
144
+ var s = "decl";
145
+ var i = "@page";
146
+ var u = "@media";
147
+ var o = "@import";
148
+ var f = "@charset";
149
+ var l = "@viewport";
150
+ var p = "@supports";
151
+ var h = "@document";
152
+ var v = "@namespace";
153
+ var d = "@keyframes";
154
+ var b = "@font-face";
155
+ var w = "@counter-style";
156
+ var m = "@font-feature-values";
157
+ var g = "@layer";
158
+ var k = Math.abs;
159
+ var $ = String.fromCharCode;
160
+ var x = Object.assign;
161
+ function E(e, r) {
162
+ return M(e, 0) ^ 45 ? (((r << 2 ^ M(e, 0)) << 2 ^ M(e, 1)) << 2 ^ M(e, 2)) << 2 ^ M(e, 3) : 0;
163
+ }
164
+ function y(e) {
165
+ return e.trim();
166
+ }
167
+ function T(e, r) {
168
+ return (e = r.exec(e)) ? e[0] : e;
169
+ }
170
+ function A(e, r, a) {
171
+ return e.replace(r, a);
172
+ }
173
+ function O(e, r) {
174
+ return e.indexOf(r);
175
+ }
176
+ function M(e, r) {
177
+ return e.charCodeAt(r) | 0;
178
+ }
179
+ function C(e, r, a) {
180
+ return e.slice(r, a);
181
+ }
182
+ function R(e) {
183
+ return e.length;
184
+ }
185
+ function S(e) {
186
+ return e.length;
187
+ }
188
+ function z(e, r) {
189
+ return r.push(e), e;
190
+ }
191
+ function N(e, r) {
192
+ return e.map(r).join("");
193
+ }
194
+ e.line = 1;
195
+ e.column = 1;
196
+ e.length = 0;
197
+ e.position = 0;
198
+ e.character = 0;
199
+ e.characters = "";
200
+ function P(r, a, c, n, t, s, i) {
201
+ return {
202
+ value: r,
203
+ root: a,
204
+ parent: c,
205
+ type: n,
206
+ props: t,
207
+ children: s,
208
+ line: e.line,
209
+ column: e.column,
210
+ length: i,
211
+ return: ""
416
212
  };
417
- _this.nextCallback = null;
418
- return _this;
419
213
  }
420
- Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
421
- var nextIn = _ref.in;
422
- if (nextIn && prevState.status === UNMOUNTED) {
423
- return {
424
- status: EXITED
425
- };
214
+ function j(e, r) {
215
+ return x(P("", null, null, "", null, null, 0), e, {
216
+ length: -e.length
217
+ }, r);
218
+ }
219
+ function U() {
220
+ return e.character;
221
+ }
222
+ function _() {
223
+ e.character = e.position > 0 ? M(e.characters, --e.position) : 0;
224
+ if (e.column--, e.character === 10) e.column = 1, e.line--;
225
+ return e.character;
226
+ }
227
+ function F() {
228
+ e.character = e.position < e.length ? M(e.characters, e.position++) : 0;
229
+ if (e.column++, e.character === 10) e.column = 1, e.line++;
230
+ return e.character;
231
+ }
232
+ function I() {
233
+ return M(e.characters, e.position);
234
+ }
235
+ function L() {
236
+ return e.position;
237
+ }
238
+ function D(r, a) {
239
+ return C(e.characters, r, a);
240
+ }
241
+ function Y(e) {
242
+ switch (e) {
243
+ case 0:
244
+ case 9:
245
+ case 10:
246
+ case 13:
247
+ case 32:
248
+ return 5;
249
+ case 33:
250
+ case 43:
251
+ case 44:
252
+ case 47:
253
+ case 62:
254
+ case 64:
255
+ case 126:
256
+ case 59:
257
+ case 123:
258
+ case 125:
259
+ return 4;
260
+ case 58:
261
+ return 3;
262
+ case 34:
263
+ case 39:
264
+ case 40:
265
+ case 91:
266
+ return 2;
267
+ case 41:
268
+ case 93:
269
+ return 1;
270
+ }
271
+ return 0;
272
+ }
273
+ function K(r) {
274
+ return e.line = e.column = 1, e.length = R(e.characters = r), e.position = 0, [];
275
+ }
276
+ function V(r) {
277
+ return e.characters = "", r;
278
+ }
279
+ function W(r) {
280
+ return y(D(e.position - 1, q(r === 91 ? r + 2 : r === 40 ? r + 1 : r)));
281
+ }
282
+ function B(e) {
283
+ return V(H(K(e)));
284
+ }
285
+ function G(r) {
286
+ while (e.character = I()) if (e.character < 33) F();else break;
287
+ return Y(r) > 2 || Y(e.character) > 3 ? "" : " ";
288
+ }
289
+ function H(r) {
290
+ while (F()) switch (Y(e.character)) {
291
+ case 0:
292
+ z(Q(e.position - 1), r);
293
+ break;
294
+ case 2:
295
+ z(W(e.character), r);
296
+ break;
297
+ default:
298
+ z($(e.character), r);
426
299
  }
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;
300
+ return r;
301
+ }
302
+ function Z(r, a) {
303
+ while (--a && F()) if (e.character < 48 || e.character > 102 || e.character > 57 && e.character < 65 || e.character > 70 && e.character < 97) break;
304
+ return D(r, L() + (a < 6 && I() == 32 && F() == 32));
305
+ }
306
+ function q(r) {
307
+ while (F()) switch (e.character) {
308
+ case r:
309
+ return e.position;
310
+ case 34:
311
+ case 39:
312
+ if (r !== 34 && r !== 39) q(e.character);
313
+ break;
314
+ case 40:
315
+ if (r === 41) q(r);
316
+ break;
317
+ case 92:
318
+ F();
319
+ break;
320
+ }
321
+ return e.position;
322
+ }
323
+ function J(r, a) {
324
+ while (F()) if (r + e.character === 47 + 10) break;else if (r + e.character === 42 + 42 && I() === 47) break;
325
+ return "/*" + D(a, e.position - 1) + "*" + $(r === 47 ? r : F());
326
+ }
327
+ function Q(r) {
328
+ while (!Y(I())) F();
329
+ return D(r, e.position);
330
+ }
331
+ function X(e) {
332
+ return V(ee("", null, null, null, [""], e = K(e), 0, [0], e));
333
+ }
334
+ function ee(e, r, a, c, n, t, s, i, u) {
335
+ var o = 0;
336
+ var f = 0;
337
+ var l = s;
338
+ var p = 0;
339
+ var h = 0;
340
+ var v = 0;
341
+ var d = 1;
342
+ var b = 1;
343
+ var w = 1;
344
+ var m = 0;
345
+ var g = "";
346
+ var k = n;
347
+ var x = t;
348
+ var E = c;
349
+ var y = g;
350
+ while (b) switch (v = m, m = F()) {
351
+ case 40:
352
+ if (v != 108 && M(y, l - 1) == 58) {
353
+ if (O(y += A(W(m), "&", "&\f"), "&\f") != -1) w = -1;
354
+ break;
456
355
  }
457
- } else {
458
- if (status === ENTERING || status === ENTERED) {
459
- nextStatus = EXITING;
356
+ case 34:
357
+ case 39:
358
+ case 91:
359
+ y += W(m);
360
+ break;
361
+ case 9:
362
+ case 10:
363
+ case 13:
364
+ case 32:
365
+ y += G(v);
366
+ break;
367
+ case 92:
368
+ y += Z(L() - 1, 7);
369
+ continue;
370
+ case 47:
371
+ switch (I()) {
372
+ case 42:
373
+ case 47:
374
+ z(ae(J(F(), L()), r, a), u);
375
+ break;
376
+ default:
377
+ y += "/";
460
378
  }
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);
379
+ break;
380
+ case 123 * d:
381
+ i[o++] = R(y) * w;
382
+ case 125 * d:
383
+ case 59:
384
+ case 0:
385
+ switch (m) {
386
+ case 0:
387
+ case 125:
388
+ b = 0;
389
+ case 59 + f:
390
+ if (w == -1) y = A(y, /\f/g, "");
391
+ if (h > 0 && R(y) - l) z(h > 32 ? ce(y + ";", c, a, l - 1) : ce(A(y, " ", "") + ";", c, a, l - 2), u);
392
+ break;
393
+ case 59:
394
+ y += ";";
395
+ default:
396
+ z(E = re(y, r, a, o, f, n, i, g, k = [], x = [], l), t);
397
+ if (m === 123) if (f === 0) ee(y, r, E, E, k, t, l, i, x);else switch (p === 99 && M(y, 3) === 110 ? 100 : p) {
398
+ case 100:
399
+ case 108:
400
+ case 109:
401
+ case 115:
402
+ ee(e, E, E, c && z(re(e, E, E, 0, 0, n, i, g, n, k = [], l), x), n, x, l, i, c ? k : x);
403
+ break;
404
+ default:
405
+ ee(y, E, E, E, [""], x, 0, i, x);
406
+ }
407
+ }
408
+ o = f = h = 0, d = w = 1, g = y = "", l = s;
409
+ break;
410
+ case 58:
411
+ l = 1 + R(y), h = v;
412
+ default:
413
+ if (d < 1) if (m == 123) --d;else if (m == 125 && d++ == 0 && _() == 125) continue;
414
+ switch (y += $(m), m * d) {
415
+ case 38:
416
+ w = f > 0 ? 1 : (y += "\f", -1);
417
+ break;
418
+ case 44:
419
+ i[o++] = (R(y) - 1) * w, w = 1;
420
+ break;
421
+ case 64:
422
+ if (I() === 45) y += W(F());
423
+ p = I(), f = l = R(g = y += Q(L())), m++;
424
+ break;
425
+ case 45:
426
+ if (v === 45 && R(y) == 2) d = 0;
498
427
  }
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
428
  }
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);
429
+ return t;
430
+ }
431
+ function re(e, r, a, c, n, s, i, u, o, f, l) {
432
+ var p = n - 1;
433
+ var h = n === 0 ? s : [""];
434
+ var v = S(h);
435
+ for (var d = 0, b = 0, w = 0; d < c; ++d) for (var m = 0, g = C(e, p + 1, p = k(b = i[d])), $ = e; m < v; ++m) if ($ = y(b > 0 ? h[m] + " " + g : A(g, /&\f/g, h[m]))) o[w++] = $;
436
+ return P(e, r, a, n === 0 ? t : u, o, f, l);
437
+ }
438
+ function ae(e, r, a) {
439
+ return P(e, r, a, n, $(U()), C(e, 2, -2), 0);
440
+ }
441
+ function ce(e, r, a, c) {
442
+ return P(e, r, a, s, C(e, 0, c), C(e, c + 1, -1), c);
443
+ }
444
+ function ne(e, n, t) {
445
+ switch (E(e, n)) {
446
+ case 5103:
447
+ return c + "print-" + e + e;
448
+ case 5737:
449
+ case 4201:
450
+ case 3177:
451
+ case 3433:
452
+ case 1641:
453
+ case 4457:
454
+ case 2921:
455
+ case 5572:
456
+ case 6356:
457
+ case 5844:
458
+ case 3191:
459
+ case 6645:
460
+ case 3005:
461
+ case 6391:
462
+ case 5879:
463
+ case 5623:
464
+ case 6135:
465
+ case 4599:
466
+ case 4855:
467
+ case 4215:
468
+ case 6389:
469
+ case 5109:
470
+ case 5365:
471
+ case 5621:
472
+ case 3829:
473
+ return c + e + e;
474
+ case 4789:
475
+ return a + e + e;
476
+ case 5349:
477
+ case 4246:
478
+ case 4810:
479
+ case 6968:
480
+ case 2756:
481
+ return c + e + a + e + r + e + e;
482
+ case 5936:
483
+ switch (M(e, n + 11)) {
484
+ case 114:
485
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
486
+ case 108:
487
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
488
+ case 45:
489
+ return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
490
+ }
491
+ case 6828:
492
+ case 4268:
493
+ case 2903:
494
+ return c + e + r + e + e;
495
+ case 6165:
496
+ return c + e + r + "flex-" + e + e;
497
+ case 5187:
498
+ return c + e + A(e, /(\w+).+(:[^]+)/, c + "box-$1$2" + r + "flex-$1$2") + e;
499
+ case 5443:
500
+ return c + e + r + "flex-item-" + A(e, /flex-|-self/g, "") + (!T(e, /flex-|baseline/) ? r + "grid-row-" + A(e, /flex-|-self/g, "") : "") + e;
501
+ case 4675:
502
+ return c + e + r + "flex-line-pack" + A(e, /align-content|flex-|-self/g, "") + e;
503
+ case 5548:
504
+ return c + e + r + A(e, "shrink", "negative") + e;
505
+ case 5292:
506
+ return c + e + r + A(e, "basis", "preferred-size") + e;
507
+ case 6060:
508
+ return c + "box-" + A(e, "-grow", "") + c + e + r + A(e, "grow", "positive") + e;
509
+ case 4554:
510
+ return c + A(e, /([^-])(transform)/g, "$1" + c + "$2") + e;
511
+ case 6187:
512
+ return A(A(A(e, /(zoom-|grab)/, c + "$1"), /(image-set)/, c + "$1"), e, "") + e;
513
+ case 5495:
514
+ case 3959:
515
+ return A(e, /(image-set\([^]*)/, c + "$1" + "$`$1");
516
+ case 4968:
517
+ return A(A(e, /(.+:)(flex-)?(.*)/, c + "box-pack:$3" + r + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + c + e + e;
518
+ case 4200:
519
+ if (!T(e, /flex-|baseline/)) return r + "grid-column-align" + C(e, n) + e;
520
+ break;
521
+ case 2592:
522
+ case 3360:
523
+ return r + A(e, "template-", "") + e;
524
+ case 4384:
525
+ case 3616:
526
+ if (t && t.some(function (e, r) {
527
+ return n = r, T(e.props, /grid-\w+-end/);
528
+ })) {
529
+ return ~O(e + (t = t[n].value), "span") ? e : r + A(e, "-start", "") + e + r + "grid-row-span:" + (~O(t, "span") ? T(t, /\d+/) : +T(t, /\d+/) - +T(e, /\d+/)) + ";";
530
+ }
531
+ return r + A(e, "-start", "") + e;
532
+ case 4896:
533
+ case 4128:
534
+ return t && t.some(function (e) {
535
+ return T(e.props, /grid-\w+-start/);
536
+ }) ? e : r + A(A(e, "-end", "-span"), "span ", "") + e;
537
+ case 4095:
538
+ case 3583:
539
+ case 4068:
540
+ case 2532:
541
+ return A(e, /(.+)-inline(.+)/, c + "$1$2") + e;
542
+ case 8116:
543
+ case 7059:
544
+ case 5753:
545
+ case 5535:
546
+ case 5445:
547
+ case 5701:
548
+ case 4933:
549
+ case 4677:
550
+ case 5533:
551
+ case 5789:
552
+ case 5021:
553
+ case 4765:
554
+ if (R(e) - 1 - n > 6) switch (M(e, n + 1)) {
555
+ case 109:
556
+ if (M(e, n + 4) !== 45) break;
557
+ case 102:
558
+ return A(e, /(.+:)(.+)-([^]+)/, "$1" + c + "$2-$3" + "$1" + a + (M(e, n + 3) == 108 ? "$3" : "$2-$3")) + e;
559
+ case 115:
560
+ return ~O(e, "stretch") ? ne(A(e, "stretch", "fill-available"), n, t) + e : e;
561
+ }
562
+ break;
563
+ case 5152:
564
+ case 5920:
565
+ return A(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (a, c, n, t, s, i, u) {
566
+ return r + c + ":" + n + u + (t ? r + c + "-span:" + (s ? i : +i - +n) + u : "") + e;
566
567
  });
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
- }
568
+ case 4949:
569
+ if (M(e, n + 6) === 121) return A(e, ":", ":" + c) + e;
570
+ break;
571
+ case 6444:
572
+ switch (M(e, M(e, 14) === 45 ? 18 : 11)) {
573
+ case 120:
574
+ return A(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + c + (M(e, 14) === 45 ? "inline-" : "") + "box$3" + "$1" + c + "$2$3" + "$1" + r + "$2box$3") + e;
575
+ case 100:
576
+ return A(e, ":", ":" + r) + e;
577
+ }
578
+ break;
579
+ case 5719:
580
+ case 2647:
581
+ case 2135:
582
+ case 3927:
583
+ case 2391:
584
+ return A(e, "scroll-", "scroll-snap-") + e;
585
+ }
586
+ return e;
587
+ }
588
+ function te(e, r) {
589
+ var a = "";
590
+ var c = S(e);
591
+ for (var n = 0; n < c; n++) a += r(e[n], n, e, r) || "";
592
+ return a;
593
+ }
594
+ function se(e, r, a, c) {
595
+ switch (e.type) {
596
+ case g:
597
+ if (e.children.length) break;
598
+ case o:
599
+ case s:
600
+ return e.return = e.return || e.value;
601
+ case n:
602
+ return "";
603
+ case d:
604
+ return e.return = e.value + "{" + te(e.children, c) + "}";
605
+ case t:
606
+ e.value = e.props.join(",");
607
+ }
608
+ return R(a = te(e.children, c)) ? e.return = e.value + "{" + a + "}" : "";
609
+ }
610
+ function ie(e) {
611
+ var r = S(e);
612
+ return function (a, c, n, t) {
613
+ var s = "";
614
+ for (var i = 0; i < r; i++) s += e[i](a, c, n, t) || "";
615
+ return s;
592
616
  };
593
- this.nextCallback.cancel = function () {
594
- active = false;
617
+ }
618
+ function ue(e) {
619
+ return function (r) {
620
+ if (!r.root) if (r = r.return) e(r);
595
621
  };
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);
622
+ }
623
+ function oe(e, n, i, u) {
624
+ if (e.length > -1) if (!e.return) switch (e.type) {
625
+ case s:
626
+ e.return = ne(e.value, e.length, i);
627
+ return;
628
+ case d:
629
+ return te([j(e, {
630
+ value: A(e.value, "@", "@" + c)
631
+ })], u);
632
+ case t:
633
+ if (e.length) return N(e.props, function (n) {
634
+ switch (T(n, /(::plac\w+|:read-\w+)/)) {
635
+ case ":read-only":
636
+ case ":read-write":
637
+ return te([j(e, {
638
+ props: [A(n, /:(read-\w+)/, ":" + a + "$1")]
639
+ })], u);
640
+ case "::placeholder":
641
+ return te([j(e, {
642
+ props: [A(n, /:(plac\w+)/, ":" + c + "input-$1")]
643
+ }), j(e, {
644
+ props: [A(n, /:(plac\w+)/, ":" + a + "$1")]
645
+ }), j(e, {
646
+ props: [A(n, /:(plac\w+)/, r + "input-$1")]
647
+ })], u);
648
+ }
649
+ return "";
650
+ });
614
651
  }
615
- };
616
- _proto.render = function render() {
617
- var status = this.state.status;
618
- if (status === UNMOUNTED) {
619
- return null;
652
+ }
653
+ function fe(e) {
654
+ switch (e.type) {
655
+ case t:
656
+ e.props = e.props.map(function (r) {
657
+ return N(B(r), function (r, a, c) {
658
+ switch (M(r, 0)) {
659
+ case 12:
660
+ return C(r, 1, R(r));
661
+ case 0:
662
+ case 40:
663
+ case 43:
664
+ case 62:
665
+ case 126:
666
+ return r;
667
+ case 58:
668
+ if (c[++a] === "global") c[a] = "", c[++a] = "\f" + C(c[a], a = 1, -1);
669
+ case 32:
670
+ return a === 1 ? "" : r;
671
+ default:
672
+ switch (a) {
673
+ case 0:
674
+ e = r;
675
+ return S(c) > 1 ? "" : r;
676
+ case a = S(c) - 1:
677
+ case 2:
678
+ return a === 2 ? r + e + e : r + e;
679
+ default:
680
+ return r;
681
+ }
682
+ }
683
+ });
684
+ });
620
685
  }
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);
686
+ }
687
+ e.CHARSET = f;
688
+ e.COMMENT = n;
689
+ e.COUNTER_STYLE = w;
690
+ e.DECLARATION = s;
691
+ e.DOCUMENT = h;
692
+ e.FONT_FACE = b;
693
+ e.FONT_FEATURE_VALUES = m;
694
+ e.IMPORT = o;
695
+ e.KEYFRAMES = d;
696
+ e.LAYER = g;
697
+ e.MEDIA = u;
698
+ e.MOZ = a;
699
+ e.MS = r;
700
+ e.NAMESPACE = v;
701
+ e.PAGE = i;
702
+ e.RULESET = t;
703
+ e.SUPPORTS = p;
704
+ e.VIEWPORT = l;
705
+ e.WEBKIT = c;
706
+ e.abs = k;
707
+ e.alloc = K;
708
+ e.append = z;
709
+ e.assign = x;
710
+ e.caret = L;
711
+ e.char = U;
712
+ e.charat = M;
713
+ e.combine = N;
714
+ e.comment = ae;
715
+ e.commenter = J;
716
+ e.compile = X;
717
+ e.copy = j;
718
+ e.dealloc = V;
719
+ e.declaration = ce;
720
+ e.delimit = W;
721
+ e.delimiter = q;
722
+ e.escaping = Z;
723
+ e.from = $;
724
+ e.hash = E;
725
+ e.identifier = Q;
726
+ e.indexof = O;
727
+ e.match = T;
728
+ e.middleware = ie;
729
+ e.namespace = fe;
730
+ e.next = F;
731
+ e.node = P;
732
+ e.parse = ee;
733
+ e.peek = I;
734
+ e.prefix = ne;
735
+ e.prefixer = oe;
736
+ e.prev = _;
737
+ e.replace = A;
738
+ e.ruleset = re;
739
+ e.rulesheet = ue;
740
+ e.serialize = te;
741
+ e.sizeof = S;
742
+ e.slice = D;
743
+ e.stringify = se;
744
+ e.strlen = R;
745
+ e.substr = C;
746
+ e.token = Y;
747
+ e.tokenize = B;
748
+ e.tokenizer = H;
749
+ e.trim = y;
750
+ e.whitespace = G;
751
+ Object.defineProperty(e, "__esModule", {
752
+ value: true
675
753
  });
754
+ });
755
+ })(stylis, stylisExports);
756
+
757
+ var weakMemoize = function weakMemoize(func) {
758
+ var cache = new WeakMap();
759
+ return function (arg) {
760
+ if (cache.has(arg)) {
761
+ // Use non-null assertion because we just checked that the cache `has` it
762
+ // This allows us to remove `undefined` from the return value
763
+ return cache.get(arg);
764
+ }
765
+ var ret = func(arg);
766
+ cache.set(arg, ret);
767
+ return ret;
676
768
  };
677
- var removeClass = function removeClass(node, classes) {
678
- return node && classes && classes.split(' ').forEach(function (c) {
679
- return removeClass$1(node, c);
680
- });
769
+ };
770
+
771
+ function memoize(fn) {
772
+ var cache = Object.create(null);
773
+ return function (arg) {
774
+ if (cache[arg] === undefined) cache[arg] = fn(arg);
775
+ return cache[arg];
681
776
  };
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);
777
+ }
778
+
779
+ var isBrowser$1 = typeof document !== 'undefined';
780
+ var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
781
+ var previous = 0;
782
+ var character = 0;
783
+ while (true) {
784
+ previous = character;
785
+ character = stylisExports.peek(); // &\f
786
+
787
+ if (previous === 38 && character === 12) {
788
+ points[index] = 1;
789
+ }
790
+ if (stylisExports.token(character)) {
791
+ break;
792
+ }
793
+ stylisExports.next();
794
+ }
795
+ return stylisExports.slice(begin, stylisExports.position);
796
+ };
797
+ var toRules = function toRules(parsed, points) {
798
+ // pretend we've started with a comma
799
+ var index = -1;
800
+ var character = 44;
801
+ do {
802
+ switch (stylisExports.token(character)) {
803
+ case 0:
804
+ // &\f
805
+ if (character === 38 && stylisExports.peek() === 12) {
806
+ // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
807
+ // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
808
+ // and when it should just concatenate the outer and inner selectors
809
+ // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
810
+ points[index] = 1;
812
811
  }
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);
812
+ parsed[index] += identifierWithPointTracking(stylisExports.position - 1, points, index);
813
+ break;
814
+ case 2:
815
+ parsed[index] += stylisExports.delimit(character);
816
+ break;
817
+ case 4:
818
+ // comma
819
+ if (character === 44) {
820
+ // colon
821
+ parsed[++index] = stylisExports.peek() === 58 ? '&\f' : '';
822
+ points[index] = parsed[index].length;
823
+ break;
821
824
  }
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;
825
+
826
+ // fallthrough
827
+
828
+ default:
829
+ parsed[index] += stylisExports.from(character);
841
830
  }
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 = {};
831
+ } while (character = stylisExports.next());
832
+ return parsed;
833
+ };
834
+ var getRules = function getRules(value, points) {
835
+ return stylisExports.dealloc(toRules(stylisExports.alloc(value), points));
836
+ }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
895
837
 
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;
838
+ var fixedElements = /* #__PURE__ */new WeakMap();
839
+ var compat = function compat(element) {
840
+ if (element.type !== 'rule' || !element.parent ||
841
+ // positive .length indicates that this rule contains pseudo
842
+ // negative .length indicates that this rule has been already prefixed
843
+ element.length < 1) {
844
+ return;
899
845
  }
846
+ var value = element.value;
847
+ var parent = element.parent;
848
+ var isImplicitRule = element.column === parent.column && element.line === parent.line;
849
+ while (parent.type !== 'rule') {
850
+ parent = parent.parent;
851
+ if (!parent) return;
852
+ } // short-circuit for the simplest case
900
853
 
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
- */
854
+ if (element.props.length === 1 && value.charCodeAt(0) !== 58
855
+ /* colon */ && !fixedElements.get(parent)) {
856
+ return;
857
+ } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
858
+ // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
907
859
 
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;
860
+ if (isImplicitRule) {
861
+ return;
920
862
  }
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
- }
863
+ fixedElements.set(element, true);
864
+ var points = [];
865
+ var rules = getRules(value, points);
866
+ var parentRules = parent.props;
867
+ for (var i = 0, k = 0; i < rules.length; i++) {
868
+ for (var j = 0; j < parentRules.length; j++, k++) {
869
+ element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
958
870
  }
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]);
871
+ }
872
+ };
873
+ var removeLabel = function removeLabel(element) {
874
+ if (element.type === 'decl') {
875
+ var value = element.value;
876
+ if (
877
+ // charcode for l
878
+ value.charCodeAt(0) === 108 &&
879
+ // charcode for b
880
+ value.charCodeAt(2) === 98) {
881
+ // this ignores label
882
+ element["return"] = '';
883
+ element.value = '';
973
884
  }
974
- return childMapping;
975
885
  }
976
- function getProp(child, prop, props) {
977
- return props[prop] != null ? props[prop] : child.props[prop];
886
+ };
887
+
888
+ /* eslint-disable no-fallthrough */
889
+
890
+ function prefix(value, length) {
891
+ switch (stylisExports.hash(value, length)) {
892
+ // color-adjust
893
+ case 5103:
894
+ return stylisExports.WEBKIT + 'print-' + value + value;
895
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
896
+
897
+ case 5737:
898
+ case 4201:
899
+ case 3177:
900
+ case 3433:
901
+ case 1641:
902
+ case 4457:
903
+ case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
904
+
905
+ case 5572:
906
+ case 6356:
907
+ case 5844:
908
+ case 3191:
909
+ case 6645:
910
+ case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
911
+
912
+ case 6391:
913
+ case 5879:
914
+ case 5623:
915
+ case 6135:
916
+ case 4599:
917
+ case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
918
+
919
+ case 4215:
920
+ case 6389:
921
+ case 5109:
922
+ case 5365:
923
+ case 5621:
924
+ case 3829:
925
+ return stylisExports.WEBKIT + value + value;
926
+ // appearance, user-select, transform, hyphens, text-size-adjust
927
+
928
+ case 5349:
929
+ case 4246:
930
+ case 4810:
931
+ case 6968:
932
+ case 2756:
933
+ return stylisExports.WEBKIT + value + stylisExports.MOZ + value + stylisExports.MS + value + value;
934
+ // flex, flex-direction
935
+
936
+ case 6828:
937
+ case 4268:
938
+ return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
939
+ // order
940
+
941
+ case 6165:
942
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-' + value + value;
943
+ // align-items
944
+
945
+ case 5187:
946
+ return stylisExports.WEBKIT + value + stylisExports.replace(value, /(\w+).+(:[^]+)/, stylisExports.WEBKIT + 'box-$1$2' + stylisExports.MS + 'flex-$1$2') + value;
947
+ // align-self
948
+
949
+ case 5443:
950
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-item-' + stylisExports.replace(value, /flex-|-self/, '') + value;
951
+ // align-content
952
+
953
+ case 4675:
954
+ return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-line-pack' + stylisExports.replace(value, /align-content|flex-|-self/, '') + value;
955
+ // flex-shrink
956
+
957
+ case 5548:
958
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'shrink', 'negative') + value;
959
+ // flex-basis
960
+
961
+ case 5292:
962
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'basis', 'preferred-size') + value;
963
+ // flex-grow
964
+
965
+ case 6060:
966
+ return stylisExports.WEBKIT + 'box-' + stylisExports.replace(value, '-grow', '') + stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'grow', 'positive') + value;
967
+ // transition
968
+
969
+ case 4554:
970
+ return stylisExports.WEBKIT + stylisExports.replace(value, /([^-])(transform)/g, '$1' + stylisExports.WEBKIT + '$2') + value;
971
+ // cursor
972
+
973
+ case 6187:
974
+ return stylisExports.replace(stylisExports.replace(stylisExports.replace(value, /(zoom-|grab)/, stylisExports.WEBKIT + '$1'), /(image-set)/, stylisExports.WEBKIT + '$1'), value, '') + value;
975
+ // background, background-image
976
+
977
+ case 5495:
978
+ case 3959:
979
+ return stylisExports.replace(value, /(image-set\([^]*)/, stylisExports.WEBKIT + '$1' + '$`$1');
980
+ // justify-content
981
+
982
+ case 4968:
983
+ return stylisExports.replace(stylisExports.replace(value, /(.+:)(flex-)?(.*)/, stylisExports.WEBKIT + 'box-pack:$3' + stylisExports.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylisExports.WEBKIT + value + value;
984
+ // (margin|padding)-inline-(start|end)
985
+
986
+ case 4095:
987
+ case 3583:
988
+ case 4068:
989
+ case 2532:
990
+ return stylisExports.replace(value, /(.+)-inline(.+)/, stylisExports.WEBKIT + '$1$2') + value;
991
+ // (min|max)?(width|height|inline-size|block-size)
992
+
993
+ case 8116:
994
+ case 7059:
995
+ case 5753:
996
+ case 5535:
997
+ case 5445:
998
+ case 5701:
999
+ case 4933:
1000
+ case 4677:
1001
+ case 5533:
1002
+ case 5789:
1003
+ case 5021:
1004
+ case 4765:
1005
+ // stretch, max-content, min-content, fill-available
1006
+ if (stylisExports.strlen(value) - 1 - length > 6) switch (stylisExports.charat(value, length + 1)) {
1007
+ // (m)ax-content, (m)in-content
1008
+ case 109:
1009
+ // -
1010
+ if (stylisExports.charat(value, length + 4) !== 45) break;
1011
+ // (f)ill-available, (f)it-content
1012
+
1013
+ case 102:
1014
+ return stylisExports.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylisExports.WEBKIT + '$2-$3' + '$1' + stylisExports.MOZ + (stylisExports.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
1015
+ // (s)tretch
1016
+
1017
+ case 115:
1018
+ return ~stylisExports.indexof(value, 'stretch') ? prefix(stylisExports.replace(value, 'stretch', 'fill-available'), length) + value : value;
1019
+ }
1020
+ break;
1021
+ // position: sticky
1022
+
1023
+ case 4949:
1024
+ // (s)ticky?
1025
+ if (stylisExports.charat(value, length + 1) !== 115) break;
1026
+ // display: (flex|inline-flex)
1027
+
1028
+ case 6444:
1029
+ switch (stylisExports.charat(value, stylisExports.strlen(value) - 3 - (~stylisExports.indexof(value, '!important') && 10))) {
1030
+ // stic(k)y
1031
+ case 107:
1032
+ return stylisExports.replace(value, ':', ':' + stylisExports.WEBKIT) + value;
1033
+ // (inline-)?fl(e)x
1034
+
1035
+ case 101:
1036
+ return stylisExports.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylisExports.WEBKIT + (stylisExports.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylisExports.WEBKIT + '$2$3' + '$1' + stylisExports.MS + '$2box$3') + value;
1037
+ }
1038
+ break;
1039
+ // writing-mode
1040
+
1041
+ case 5936:
1042
+ switch (stylisExports.charat(value, length + 11)) {
1043
+ // vertical-l(r)
1044
+ case 114:
1045
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
1046
+ // vertical-r(l)
1047
+
1048
+ case 108:
1049
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
1050
+ // horizontal(-)tb
1051
+
1052
+ case 45:
1053
+ return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
1054
+ }
1055
+ return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
978
1056
  }
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)
1057
+ return value;
1058
+ }
1059
+ var prefixer = function prefixer(element, index, children, callback) {
1060
+ if (element.length > -1) if (!element["return"]) switch (element.type) {
1061
+ case stylisExports.DECLARATION:
1062
+ element["return"] = prefix(element.value, element.length);
1063
+ break;
1064
+ case stylisExports.KEYFRAMES:
1065
+ return stylisExports.serialize([stylisExports.copy(element, {
1066
+ value: stylisExports.replace(element.value, '@', '@' + stylisExports.WEBKIT)
1067
+ })], callback);
1068
+ case stylisExports.RULESET:
1069
+ if (element.length) return stylisExports.combine(element.props, function (value) {
1070
+ switch (stylisExports.match(value, /(::plac\w+|:read-\w+)/)) {
1071
+ // :read-(only|write)
1072
+ case ':read-only':
1073
+ case ':read-write':
1074
+ return stylisExports.serialize([stylisExports.copy(element, {
1075
+ props: [stylisExports.replace(value, /:(read-\w+)/, ':' + stylisExports.MOZ + '$1')]
1076
+ })], callback);
1077
+ // :placeholder
1078
+
1079
+ case '::placeholder':
1080
+ return stylisExports.serialize([stylisExports.copy(element, {
1081
+ props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.WEBKIT + 'input-$1')]
1082
+ }), stylisExports.copy(element, {
1083
+ props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.MOZ + '$1')]
1084
+ }), stylisExports.copy(element, {
1085
+ props: [stylisExports.replace(value, /:(plac\w+)/, stylisExports.MS + 'input-$1')]
1086
+ })], callback);
1087
+ }
1088
+ return '';
987
1089
  });
988
- });
989
1090
  }
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
- });
1091
+ };
1092
+ var getServerStylisCache = isBrowser$1 ? undefined : weakMemoize(function () {
1093
+ return memoize(function () {
1094
+ return {};
1095
+ });
1096
+ });
1097
+ var defaultStylisPlugins = [prefixer];
1098
+ var createCache = function createCache(options) {
1099
+ var key = options.key;
1100
+ if (isBrowser$1 && key === 'css') {
1101
+ var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1102
+ // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1103
+ // note this very very intentionally targets all style elements regardless of the key to ensure
1104
+ // that creating a cache works inside of render of a React component
1105
+
1106
+ Array.prototype.forEach.call(ssrStyles, function (node) {
1107
+ // we want to only move elements which have a space in the data-emotion attribute value
1108
+ // because that indicates that it is an Emotion 11 server-side rendered style elements
1109
+ // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
1110
+ // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
1111
+ // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
1112
+ // will not result in the Emotion 10 styles being destroyed
1113
+ var dataEmotionAttribute = node.getAttribute('data-emotion');
1114
+ if (dataEmotionAttribute.indexOf(' ') === -1) {
1115
+ return;
1025
1116
  }
1117
+ document.head.appendChild(node);
1118
+ node.setAttribute('data-s', '');
1026
1119
  });
1027
- return children;
1028
1120
  }
1029
-
1030
- var values = Object.values || function (obj) {
1031
- return Object.keys(obj).map(function (k) {
1032
- return obj[k];
1121
+ var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1122
+ var inserted = {};
1123
+ var container;
1124
+ var nodesToHydrate = [];
1125
+ if (isBrowser$1) {
1126
+ container = options.container || document.head;
1127
+ Array.prototype.forEach.call(
1128
+ // this means we will ignore elements which don't have a space in them which
1129
+ // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1130
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1131
+ var attrib = node.getAttribute("data-emotion").split(' ');
1132
+ for (var i = 1; i < attrib.length; i++) {
1133
+ inserted[attrib[i]] = true;
1134
+ }
1135
+ nodesToHydrate.push(node);
1033
1136
  });
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;
1137
+ }
1138
+ var _insert;
1139
+ var omnipresentPlugins = [compat, removeLabel];
1140
+ if (!getServerStylisCache) {
1141
+ var currentSheet;
1142
+ var finalizingPlugins = [stylisExports.stringify, stylisExports.rulesheet(function (rule) {
1143
+ currentSheet.insert(rule);
1144
+ })];
1145
+ var serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
1146
+ var stylis = function stylis(styles) {
1147
+ return stylisExports.serialize(stylisExports.compile(styles), serializer);
1083
1148
  };
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
- });
1149
+ _insert = function insert(selector, serialized, sheet, shouldCache) {
1150
+ currentSheet = sheet;
1151
+ stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1152
+ if (shouldCache) {
1153
+ cache.inserted[serialized.name] = true;
1108
1154
  }
1109
1155
  };
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));
1156
+ } else {
1157
+ var _finalizingPlugins = [stylisExports.stringify];
1158
+ var _serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
1159
+ var _stylis = function _stylis(styles) {
1160
+ return stylisExports.serialize(stylisExports.compile(styles), _serializer);
1128
1161
  };
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];
1162
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1163
+ var getRules = function getRules(selector, serialized) {
1164
+ var name = serialized.name;
1165
+ if (serverStylisCache[name] === undefined) {
1166
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1152
1167
  }
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];
1168
+ return serverStylisCache[name];
1169
+ };
1170
+ _insert = function _insert(selector, serialized, sheet, shouldCache) {
1171
+ var name = serialized.name;
1172
+ var rules = getRules(selector, serialized);
1173
+ if (cache.compat === undefined) {
1174
+ // in regular mode, we don't set the styles on the inserted cache
1175
+ // since we don't need to and that would be wasting memory
1176
+ // we return them so that they are rendered in a style tag
1177
+ if (shouldCache) {
1178
+ cache.inserted[name] = true;
1181
1179
  }
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];
1180
+ return rules;
1181
+ } else {
1182
+ // in compat mode, we put the styles on the inserted cache so
1183
+ // that emotion-server can pull out the styles
1184
+ // except when we don't want to cache it which was in Global but now
1185
+ // is nowhere but we don't want to do a major right now
1186
+ // and just in case we're going to leave the case here
1187
+ // it's also not affecting client side bundle size
1188
+ // so it's really not a big deal
1189
+ if (shouldCache) {
1190
+ cache.inserted[name] = rules;
1191
+ } else {
1192
+ return rules;
1187
1193
  }
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
1194
  }
1202
1195
  };
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
1196
  }
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
- };
1197
+ var cache = {
1198
+ key: key,
1199
+ sheet: new StyleSheet({
1200
+ key: key,
1201
+ container: container,
1202
+ nonce: options.nonce,
1203
+ speedy: options.speedy,
1204
+ prepend: options.prepend,
1205
+ insertionPoint: options.insertionPoint
1206
+ }),
1207
+ nonce: options.nonce,
1208
+ inserted: inserted,
1209
+ registered: {},
1210
+ insert: _insert
1256
1211
  };
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;
1212
+ cache.sheet.hydrate(nodesToHydrate);
1213
+ return cache;
1214
+ };
1215
+
1216
+ /* eslint-disable */
1217
+ // Inspired by https://github.com/garycourt/murmurhash-js
1218
+ // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
1219
+ function murmur2(str) {
1220
+ // 'm' and 'r' are mixing constants generated offline.
1221
+ // They're not really 'magic', they just happen to work well.
1222
+ // const m = 0x5bd1e995;
1223
+ // const r = 24;
1224
+ // Initialize the hash
1225
+ var h = 0; // Mix 4 bytes at a time into the hash
1226
+
1227
+ var k,
1228
+ i = 0,
1229
+ len = str.length;
1230
+ for (; len >= 4; ++i, len -= 4) {
1231
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
1232
+ k = /* Math.imul(k, m): */
1233
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
1234
+ k ^= /* k >>> r: */
1235
+ k >>> 24;
1236
+ h = /* Math.imul(k, m): */
1237
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */
1238
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1239
+ } // Handle the last few bytes of the input array
1240
+
1241
+ switch (len) {
1242
+ case 3:
1243
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
1244
+ case 2:
1245
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
1246
+ case 1:
1247
+ h ^= str.charCodeAt(i) & 0xff;
1248
+ h = /* Math.imul(h, m): */
1249
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1250
+ } // Do a few final mixes of the hash to ensure the last few
1251
+ // bytes are well-incorporated.
1252
+
1253
+ h ^= h >>> 13;
1254
+ h = /* Math.imul(h, m): */
1255
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
1256
+ return ((h ^ h >>> 15) >>> 0).toString(36);
1257
+ }
1258
+
1259
+ var unitlessKeys = {
1260
+ animationIterationCount: 1,
1261
+ aspectRatio: 1,
1262
+ borderImageOutset: 1,
1263
+ borderImageSlice: 1,
1264
+ borderImageWidth: 1,
1265
+ boxFlex: 1,
1266
+ boxFlexGroup: 1,
1267
+ boxOrdinalGroup: 1,
1268
+ columnCount: 1,
1269
+ columns: 1,
1270
+ flex: 1,
1271
+ flexGrow: 1,
1272
+ flexPositive: 1,
1273
+ flexShrink: 1,
1274
+ flexNegative: 1,
1275
+ flexOrder: 1,
1276
+ gridRow: 1,
1277
+ gridRowEnd: 1,
1278
+ gridRowSpan: 1,
1279
+ gridRowStart: 1,
1280
+ gridColumn: 1,
1281
+ gridColumnEnd: 1,
1282
+ gridColumnSpan: 1,
1283
+ gridColumnStart: 1,
1284
+ msGridRow: 1,
1285
+ msGridRowSpan: 1,
1286
+ msGridColumn: 1,
1287
+ msGridColumnSpan: 1,
1288
+ fontWeight: 1,
1289
+ lineHeight: 1,
1290
+ opacity: 1,
1291
+ order: 1,
1292
+ orphans: 1,
1293
+ scale: 1,
1294
+ tabSize: 1,
1295
+ widows: 1,
1296
+ zIndex: 1,
1297
+ zoom: 1,
1298
+ WebkitLineClamp: 1,
1299
+ // SVG-related properties
1300
+ fillOpacity: 1,
1301
+ floodOpacity: 1,
1302
+ stopOpacity: 1,
1303
+ strokeDasharray: 1,
1304
+ strokeDashoffset: 1,
1305
+ strokeMiterlimit: 1,
1306
+ strokeOpacity: 1,
1307
+ strokeWidth: 1
1308
+ };
1309
+
1310
+ var isDevelopment = false;
1311
+ var hyphenateRegex = /[A-Z]|^ms/g;
1312
+ var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
1313
+ var isCustomProperty = function isCustomProperty(property) {
1314
+ return property.charCodeAt(1) === 45;
1315
+ };
1316
+ var isProcessableValue = function isProcessableValue(value) {
1317
+ return value != null && typeof value !== 'boolean';
1318
+ };
1319
+ var processStyleName = /* #__PURE__ */memoize(function (styleName) {
1320
+ return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
1321
+ });
1322
+ var processStyleValue = function processStyleValue(key, value) {
1323
+ switch (key) {
1324
+ case 'animation':
1325
+ case 'animationName':
1326
+ {
1327
+ if (typeof value === 'string') {
1328
+ return value.replace(animationRegex, function (match, p1, p2) {
1329
+ cursor = {
1330
+ name: p1,
1331
+ styles: p2,
1332
+ next: cursor
1333
+ };
1334
+ return p1;
1335
+ });
1372
1336
  }
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
1337
  }
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
1338
+ }
1339
+ if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
1340
+ return value + 'px';
1341
+ }
1342
+ return value;
1343
+ };
1344
+ var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
1345
+ function handleInterpolation(mergedProps, registered, interpolation) {
1346
+ if (interpolation == null) {
1347
+ return '';
1348
+ }
1349
+ var componentSelector = interpolation;
1350
+ if (componentSelector.__emotion_styles !== undefined) {
1351
+ return componentSelector;
1352
+ }
1353
+ switch (typeof interpolation) {
1354
+ case 'boolean':
1355
+ {
1356
+ return '';
1357
+ }
1358
+ case 'object':
1359
+ {
1360
+ var keyframes = interpolation;
1361
+ if (keyframes.anim === 1) {
1362
+ cursor = {
1363
+ name: keyframes.name,
1364
+ styles: keyframes.styles,
1365
+ next: cursor
1366
+ };
1367
+ return keyframes.name;
1433
1368
  }
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)'
1369
+ var serializedStyles = interpolation;
1370
+ if (serializedStyles.styles !== undefined) {
1371
+ var next = serializedStyles.next;
1372
+ if (next !== undefined) {
1373
+ // not the most efficient thing ever but this is a pretty rare case
1374
+ // and there will be very few iterations of this generally
1375
+ while (next !== undefined) {
1376
+ cursor = {
1377
+ name: next.name,
1378
+ styles: next.styles,
1379
+ next: cursor
1380
+ };
1381
+ next = next.next;
1382
+ }
1383
+ }
1384
+ var styles = serializedStyles.styles + ";";
1385
+ return styles;
1386
+ }
1387
+ return createStringFromObject(mergedProps, registered, interpolation);
1388
+ }
1389
+ case 'function':
1390
+ {
1391
+ if (mergedProps !== undefined) {
1392
+ var previousCursor = cursor;
1393
+ var result = interpolation(mergedProps);
1394
+ cursor = previousCursor;
1395
+ return handleInterpolation(mergedProps, registered, result);
1396
+ }
1397
+ break;
1482
1398
  }
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
- };
1399
+ } // finalize string values (regular strings and functions interpolated into css calls)
1400
+
1401
+ var asString = interpolation;
1402
+ if (registered == null) {
1403
+ return asString;
1506
1404
  }
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)");
1405
+ var cached = registered[asString];
1406
+ return cached !== undefined ? cached : asString;
1407
+ }
1408
+ function createStringFromObject(mergedProps, registered, obj) {
1409
+ var string = '';
1410
+ if (Array.isArray(obj)) {
1411
+ for (var i = 0; i < obj.length; i++) {
1412
+ string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
1524
1413
  }
1525
- if (direction === 'right') {
1526
- if (containerRect) {
1527
- return "translateX(-".concat(rect.right - containerRect.left - offsetX, "px)");
1414
+ } else {
1415
+ for (var key in obj) {
1416
+ var value = obj[key];
1417
+ if (typeof value !== 'object') {
1418
+ var asString = value;
1419
+ if (registered != null && registered[asString] !== undefined) {
1420
+ string += key + "{" + registered[asString] + "}";
1421
+ } else if (isProcessableValue(asString)) {
1422
+ string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
1423
+ }
1424
+ } else {
1425
+ if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {
1426
+ throw new Error(noComponentSelectorMessage);
1427
+ }
1428
+ if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
1429
+ for (var _i = 0; _i < value.length; _i++) {
1430
+ if (isProcessableValue(value[_i])) {
1431
+ string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
1432
+ }
1433
+ }
1434
+ } else {
1435
+ var interpolated = handleInterpolation(mergedProps, registered, value);
1436
+ switch (key) {
1437
+ case 'animation':
1438
+ case 'animationName':
1439
+ {
1440
+ string += processStyleName(key) + ":" + interpolated + ";";
1441
+ break;
1442
+ }
1443
+ default:
1444
+ {
1445
+ string += key + "{" + interpolated + "}";
1446
+ }
1447
+ }
1448
+ }
1528
1449
  }
1529
- return "translateX(-".concat(rect.left + rect.width - offsetX, "px)");
1530
1450
  }
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)");
1451
+ }
1452
+ return string;
1453
+ }
1454
+ var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes
1455
+ // keyframes are stored on the SerializedStyles object as a linked list
1456
+
1457
+ var cursor;
1458
+ function serializeStyles(args, registered, mergedProps) {
1459
+ if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
1460
+ return args[0];
1461
+ }
1462
+ var stringMode = true;
1463
+ var styles = '';
1464
+ cursor = undefined;
1465
+ var strings = args[0];
1466
+ if (strings == null || strings.raw === undefined) {
1467
+ stringMode = false;
1468
+ styles += handleInterpolation(mergedProps, registered, strings);
1469
+ } else {
1470
+ var asTemplateStringsArr = strings;
1471
+ styles += asTemplateStringsArr[0];
1472
+ } // we start at 1 since we've already handled the first arg
1473
+
1474
+ for (var i = 1; i < args.length; i++) {
1475
+ styles += handleInterpolation(mergedProps, registered, args[i]);
1476
+ if (stringMode) {
1477
+ var templateStringsArr = strings;
1478
+ styles += templateStringsArr[i];
1536
1479
  }
1537
- if (containerRect) {
1538
- return "translateY(-".concat(rect.top - containerRect.top + rect.height - offsetY, "px)");
1480
+ } // using a global regex with .exec is stateful so lastIndex has to be reset each time
1481
+
1482
+ labelPattern.lastIndex = 0;
1483
+ var identifierName = '';
1484
+ var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
1485
+
1486
+ while ((match = labelPattern.exec(styles)) !== null) {
1487
+ identifierName += '-' + match[1];
1488
+ }
1489
+ var name = murmur2(styles) + identifierName;
1490
+ return {
1491
+ name: name,
1492
+ styles: styles,
1493
+ next: cursor
1494
+ };
1495
+ }
1496
+
1497
+ var isBrowser = typeof document !== 'undefined';
1498
+ function getRegisteredStyles(registered, registeredStyles, classNames) {
1499
+ var rawClassName = '';
1500
+ classNames.split(' ').forEach(function (className) {
1501
+ if (registered[className] !== undefined) {
1502
+ registeredStyles.push(registered[className] + ";");
1503
+ } else if (className) {
1504
+ rawClassName += className + " ";
1539
1505
  }
1540
- return "translateY(-".concat(rect.top + rect.height - offsetY, "px)");
1506
+ });
1507
+ return rawClassName;
1508
+ }
1509
+ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
1510
+ var className = cache.key + "-" + serialized.name;
1511
+ if (
1512
+ // we only need to add the styles to the registered cache if the
1513
+ // class name could be used further down
1514
+ // the tree but if it's a string tag, we know it won't
1515
+ // so we don't have to add it to registered cache.
1516
+ // this improves memory usage since we can avoid storing the whole style string
1517
+ (isStringTag === false ||
1518
+ // we need to always store it if we're in compat mode and
1519
+ // in node since emotion-server relies on whether a style is in
1520
+ // the registered cache to know whether a style is global or not
1521
+ // also, note that this check will be dead code eliminated in the browser
1522
+ isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1523
+ cache.registered[className] = serialized.styles;
1541
1524
  }
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;
1525
+ };
1526
+ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1527
+ registerStyles(cache, serialized, isStringTag);
1528
+ var className = cache.key + "-" + serialized.name;
1529
+ if (cache.inserted[serialized.name] === undefined) {
1530
+ var stylesForSSR = '';
1531
+ var current = serialized;
1532
+ do {
1533
+ var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
1534
+ if (!isBrowser && maybeStyles !== undefined) {
1535
+ stylesForSSR += maybeStyles;
1536
+ }
1537
+ current = current.next;
1538
+ } while (current !== undefined);
1539
+ if (!isBrowser && stylesForSSR.length !== 0) {
1540
+ return stylesForSSR;
1547
1541
  }
1548
1542
  }
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
- });
1543
+ };
1544
+
1545
+ function insertWithoutScoping(cache, serialized) {
1546
+ if (cache.inserted[serialized.name] === undefined) {
1547
+ return cache.insert('', serialized, cache.sheet, true);
1590
1548
  }
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
- });
1549
+ }
1550
+ function merge(registered, css, className) {
1551
+ var registeredStyles = [];
1552
+ var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
1553
+ if (registeredStyles.length < 2) {
1554
+ return className;
1621
1555
  }
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);
1556
+ return rawClassName + css(registeredStyles);
1557
+ }
1558
+ var createEmotion = function createEmotion(options) {
1559
+ var cache = createCache(options);
1560
+ cache.sheet.speedy = function (value) {
1561
+ this.isSpeedy = value;
1562
+ };
1563
+ cache.compat = true;
1564
+ var css = function css() {
1565
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1566
+ args[_key] = arguments[_key];
1567
+ }
1568
+ var serialized = serializeStyles(args, cache.registered, undefined);
1569
+ insertStyles(cache, serialized, false);
1570
+ return cache.key + "-" + serialized.name;
1571
+ };
1572
+ var keyframes = function keyframes() {
1573
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1574
+ args[_key2] = arguments[_key2];
1575
+ }
1576
+ var serialized = serializeStyles(args, cache.registered);
1577
+ var animation = "animation-" + serialized.name;
1578
+ insertWithoutScoping(cache, {
1579
+ name: serialized.name,
1580
+ styles: "@keyframes " + animation + "{" + serialized.styles + "}"
1581
+ });
1582
+ return animation;
1583
+ };
1584
+ var injectGlobal = function injectGlobal() {
1585
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1586
+ args[_key3] = arguments[_key3];
1587
+ }
1588
+ var serialized = serializeStyles(args, cache.registered);
1589
+ insertWithoutScoping(cache, serialized);
1590
+ };
1591
+ var cx = function cx() {
1592
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1593
+ args[_key4] = arguments[_key4];
1594
+ }
1595
+ return merge(cache.registered, css, classnames(args));
1596
+ };
1597
+ return {
1598
+ css: css,
1599
+ cx: cx,
1600
+ injectGlobal: injectGlobal,
1601
+ keyframes: keyframes,
1602
+ hydrate: function hydrate(ids) {
1603
+ ids.forEach(function (key) {
1604
+ cache.inserted[key] = true;
1605
+ });
1606
+ },
1607
+ flush: function flush() {
1608
+ cache.registered = {};
1609
+ cache.inserted = {};
1610
+ cache.sheet.flush();
1611
+ },
1612
+ sheet: cache.sheet,
1613
+ cache: cache,
1614
+ getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),
1615
+ merge: merge.bind(null, cache.registered, css)
1616
+ };
1617
+ };
1618
+ var classnames = function classnames(args) {
1619
+ var cls = '';
1620
+ for (var i = 0; i < args.length; i++) {
1621
+ var arg = args[i];
1622
+ if (arg == null) continue;
1623
+ var toAdd = void 0;
1624
+ switch (typeof arg) {
1625
+ case 'boolean':
1626
+ break;
1627
+ case 'object':
1628
+ {
1629
+ if (Array.isArray(arg)) {
1630
+ toAdd = classnames(arg);
1657
1631
  } else {
1658
- callback(node, maybeIsAppearing);
1632
+ toAdd = '';
1633
+ for (var k in arg) {
1634
+ if (arg[k] && k) {
1635
+ toAdd && (toAdd += ' ');
1636
+ toAdd += k;
1637
+ }
1638
+ }
1659
1639
  }
1640
+ break;
1660
1641
  }
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
1642
+ default:
1643
+ {
1644
+ toAdd = arg;
1645
+ }
1646
+ }
1647
+ if (toAdd) {
1648
+ cls && (cls += ' ');
1649
+ cls += toAdd;
1650
+ }
1651
+ }
1652
+ return cls;
1653
+ };
1654
+
1655
+ var _createEmotion = createEmotion({
1656
+ key: 'css'
1657
+ }),
1658
+ css = _createEmotion.css;
1659
+
1660
+ const horizontalScrollStyles = css `
1661
+ display: flex;
1662
+ white-space: no-wrap;
1663
+ overflow-x: auto;
1664
+ scroll-behavior: smooth;
1665
+ -webkit-tap-highlight-color: transparent;
1666
+ scrollbar-width: none; /* Firefox */
1667
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
1668
+
1669
+ &::-webkit-scrollbar {
1670
+ /* WebKit */
1671
+ display: none;
1672
+ }
1673
+ `;
1674
+ const HorizontalScroll = react.forwardRef(({ children, styleConfig = {}, onScroll }, forwardRef) => {
1675
+ const { root, childContainer } = styleConfig;
1676
+ const horizontalScrollRef = react.useRef(null);
1677
+ const parentContainerRef = react.useRef(null);
1678
+ const childContainerRef = react.useRef(null);
1679
+ const combinedParentContainerRef = useMergeRefs__default.default(parentContainerRef, forwardRef);
1680
+ const combinedParenAndChildContainerRef = useMergeRefs__default.default(parentContainerRef, childContainerRef);
1681
+ const rootStyles = ctDesignStyleManager.useWebMergeStyles([...(root || []), horizontalScrollStyles], [root]);
1682
+ const handleScroll = (event) => {
1683
+ onScroll === null || onScroll === void 0 ? void 0 : onScroll({
1684
+ nativeEvent: {
1685
+ contentOffset: { x: event.currentTarget.scrollLeft, y: event.currentTarget.scrollTop },
1686
+ layoutMeasurement: { height: event.currentTarget.clientHeight, width: event.currentTarget.clientWidth },
1687
+ contentSize: { height: event.currentTarget.scrollHeight, width: event.currentTarget.scrollWidth },
1688
+ },
1754
1689
  });
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
1690
  };
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
- });
1691
+ return (jsxRuntime.jsx("div", { ref: horizontalScrollRef, onScroll: handleScroll, children: jsxRuntime.jsx("div", { ref: combinedParentContainerRef, className: rootStyles, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: childContainer }, ref: combinedParenAndChildContainerRef, children: children }) }) }));
1692
+ });
1693
+ HorizontalScroll.displayName = 'HorizontalScroll';
1848
1694
 
1849
- var HOVER_TYPE;
1850
- (function (HOVER_TYPE) {
1851
- HOVER_TYPE["ENTER"] = "ENTER";
1852
- HOVER_TYPE["LEAVE"] = "LEAVE";
1853
- })(HOVER_TYPE || (HOVER_TYPE = {}));
1854
- var ITooltipV2BorderSize;
1855
- (function (ITooltipV2BorderSize) {
1856
- ITooltipV2BorderSize["XS"] = "xs";
1857
- ITooltipV2BorderSize["SM"] = "sm";
1858
- ITooltipV2BorderSize["MD"] = "md";
1859
- ITooltipV2BorderSize["LG"] = "lg";
1860
- ITooltipV2BorderSize["XL"] = "xl";
1861
- })(ITooltipV2BorderSize || (ITooltipV2BorderSize = {}));
1862
- var ITooltipV2Position;
1863
- (function (ITooltipV2Position) {
1864
- ITooltipV2Position["AUTO"] = "auto";
1865
- ITooltipV2Position["LEFT"] = "left";
1866
- ITooltipV2Position["RIGHT"] = "right";
1867
- ITooltipV2Position["TOP"] = "top";
1868
- ITooltipV2Position["BOTTOM"] = "bottom";
1869
- })(ITooltipV2Position || (ITooltipV2Position = {}));
1870
-
1871
- var FLEX_RIGHT_PRECISION = 5;
1872
- var HorizontalScroll = React.forwardRef(function (_a, forwardRef) {
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;
1874
- var _d = shadowWidth || {}, leftShadowWidth = _d.left, rightShadowWidth = _d.right;
1875
- var theme = ctDesignTheme.useTheme();
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;
1877
- var _e = React.useState(false), isHovering = _e[0], setIsHovering = _e[1];
1878
- var _f = React.useState({
1879
- left: false,
1880
- right: false,
1881
- }), shadowDirection = _f[0], setShadowDirection = _f[1];
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);
1887
- var updateArrowIcons = function () {
1888
- if (horizontalScrollRef.current && childContainerRef.current) {
1889
- var _a = horizontalScrollRef.current.getBoundingClientRect(), horizontalScrollRight = _a.right, horizontalScrollLeft = _a.left;
1890
- var _b = childContainerRef.current.getBoundingClientRect(), childContainerRight = _b.right, childContainerLeft = _b.left;
1891
- if (childContainerLeft - horizontalScrollLeft < -FLEX_RIGHT_PRECISION) {
1892
- setShadowDirection(function (prevState) { return (__assign(__assign({}, prevState), { left: true })); });
1893
- }
1894
- else {
1895
- setShadowDirection(function (prevState) { return (__assign(__assign({}, prevState), { left: false })); });
1896
- }
1897
- if (childContainerRight - horizontalScrollRight > FLEX_RIGHT_PRECISION) {
1898
- setShadowDirection(function (prevState) { return (__assign(__assign({}, prevState), { right: true })); });
1899
- }
1900
- else {
1901
- setShadowDirection(function (prevState) { return (__assign(__assign({}, prevState), { right: false })); });
1902
- }
1903
- }
1904
- };
1905
- React.useEffect(function () {
1906
- var _a;
1907
- setTimeout(updateArrowIcons, 200);
1908
- var callback = ctDesignCommonUtils.debounce(updateArrowIcons, 200);
1909
- (_a = parentContainerRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', callback);
1910
- return function () {
1911
- var _a;
1912
- (_a = parentContainerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', callback);
1913
- };
1914
- }, []);
1915
- var onHover = React.useCallback(function (type) { return function () {
1916
- if (type === HOVER_TYPE.ENTER) {
1917
- setIsHovering(true);
1918
- }
1919
- else {
1920
- setIsHovering(false);
1921
- }
1922
- }; }, []);
1923
- var onArrowClick = function (arrowDirection) { return function () {
1924
- if (parentContainerRef.current && horizontalScrollRef.current) {
1925
- var parentContainerElement = parentContainerRef.current;
1926
- var horizontalScrollWidth = horizontalScrollRef.current.getBoundingClientRect().width;
1927
- if (arrowDirection === exports.ARROW_DIRECTION.RIGHT) {
1928
- parentContainerElement.scrollLeft = parentContainerElement.scrollLeft + horizontalScrollWidth / 2;
1929
- }
1930
- else {
1931
- parentContainerElement.scrollLeft = parentContainerElement.scrollLeft - horizontalScrollWidth / 2;
1932
- }
1933
- }
1934
- }; };
1935
- var arrowDimension = React.useMemo(function () {
1936
- switch (arrowSize) {
1937
- case exports.ARROW_SIZE.SM: {
1938
- return theme.size[6];
1939
- }
1940
- case exports.ARROW_SIZE.MD: {
1941
- return theme.size[6];
1942
- }
1943
- case exports.ARROW_SIZE.LG: {
1944
- return theme.size[10];
1945
- }
1946
- default: {
1947
- return theme.size[6];
1948
- }
1949
- }
1950
- }, [arrowSize]);
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
- });
1953
- HorizontalScroll.defaultProps = {
1954
- children: null,
1955
- className: '',
1956
- };
1695
+ exports.ARROW_DIRECTION = void 0;
1696
+ (function (ARROW_DIRECTION) {
1697
+ ARROW_DIRECTION["LEFT"] = "LEFT";
1698
+ ARROW_DIRECTION["RIGHT"] = "RIGHT";
1699
+ })(exports.ARROW_DIRECTION || (exports.ARROW_DIRECTION = {}));
1700
+ exports.ARROW_SIZE = void 0;
1701
+ (function (ARROW_SIZE) {
1702
+ ARROW_SIZE["SM"] = "sm";
1703
+ ARROW_SIZE["MD"] = "md";
1704
+ ARROW_SIZE["LG"] = "lg";
1705
+ })(exports.ARROW_SIZE || (exports.ARROW_SIZE = {}));
1957
1706
 
1958
- exports.HorizontalScroll = HorizontalScroll;
1959
- exports.StyledHorizontalScroll = StyledHorizontalScroll;
1707
+ exports.HorizontalScroll = HorizontalScroll;
1960
1708
 
1961
1709
  }));
1962
1710
  //# sourceMappingURL=ct-design-horizontal-scroll.umd.js.map