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