@perses-dev/components 0.8.1 → 0.10.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 (131) hide show
  1. package/dist/Drawer/Drawer.d.ts +3 -4
  2. package/dist/Drawer/Drawer.d.ts.map +1 -1
  3. package/dist/Drawer/Drawer.js +35 -1
  4. package/dist/Drawer/Drawer.js.map +1 -0
  5. package/dist/Drawer/index.js +15 -1
  6. package/dist/Drawer/index.js.map +1 -0
  7. package/dist/EChart.d.ts.map +1 -1
  8. package/dist/EChart.js +142 -1
  9. package/dist/EChart.js.map +1 -0
  10. package/dist/ErrorAlert.js +25 -1
  11. package/dist/ErrorAlert.js.map +1 -0
  12. package/dist/ErrorBoundary.js +16 -1
  13. package/dist/ErrorBoundary.js.map +1 -0
  14. package/dist/GaugeChart/GaugeChart.js +172 -1
  15. package/dist/GaugeChart/GaugeChart.js.map +1 -0
  16. package/dist/GaugeChart/index.js +15 -1
  17. package/dist/GaugeChart/index.js.map +1 -0
  18. package/dist/InfoTooltip/InfoTooltip.js +79 -1
  19. package/dist/InfoTooltip/InfoTooltip.js.map +1 -0
  20. package/dist/InfoTooltip/InfoTooltip.test.js +36 -1
  21. package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -0
  22. package/dist/InfoTooltip/index.js +15 -1
  23. package/dist/InfoTooltip/index.js.map +1 -0
  24. package/dist/LineChart/LineChart.js +198 -1
  25. package/dist/LineChart/LineChart.js.map +1 -0
  26. package/dist/LineChart/index.js +15 -1
  27. package/dist/LineChart/index.js.map +1 -0
  28. package/dist/LineChart/utils.js +63 -1
  29. package/dist/LineChart/utils.js.map +1 -0
  30. package/dist/StatChart/StatChart.js +121 -1
  31. package/dist/StatChart/StatChart.js.map +1 -0
  32. package/dist/StatChart/StatChart.test.js +82 -1
  33. package/dist/StatChart/StatChart.test.js.map +1 -0
  34. package/dist/StatChart/index.js +15 -1
  35. package/dist/StatChart/index.js.map +1 -0
  36. package/dist/TimeRangeSelector/AbsoluteTimePicker.js +175 -1
  37. package/dist/TimeRangeSelector/AbsoluteTimePicker.js.map +1 -0
  38. package/dist/TimeRangeSelector/TimeRangeSelector.js +52 -1
  39. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  40. package/dist/TimeRangeSelector/index.js +16 -1
  41. package/dist/TimeRangeSelector/index.js.map +1 -0
  42. package/dist/TimeRangeSelector/utils.js +36 -1
  43. package/dist/TimeRangeSelector/utils.js.map +1 -0
  44. package/dist/Tooltip/SeriesInfo.js +143 -1
  45. package/dist/Tooltip/SeriesInfo.js.map +1 -0
  46. package/dist/Tooltip/SeriesMarker.js +33 -1
  47. package/dist/Tooltip/SeriesMarker.js.map +1 -0
  48. package/dist/Tooltip/Tooltip.js +72 -1
  49. package/dist/Tooltip/Tooltip.js.map +1 -0
  50. package/dist/Tooltip/TooltipContent.js +89 -1
  51. package/dist/Tooltip/TooltipContent.js.map +1 -0
  52. package/dist/Tooltip/focused-series.js +108 -1
  53. package/dist/Tooltip/focused-series.js.map +1 -0
  54. package/dist/Tooltip/focused-series.test.js +75 -1
  55. package/dist/Tooltip/focused-series.test.js.map +1 -0
  56. package/dist/Tooltip/index.js +16 -1
  57. package/dist/Tooltip/index.js.map +1 -0
  58. package/dist/Tooltip/tooltip-model.js +80 -1
  59. package/dist/Tooltip/tooltip-model.js.map +1 -0
  60. package/dist/Tooltip/utils.js +46 -1
  61. package/dist/Tooltip/utils.js.map +1 -0
  62. package/dist/cjs/Drawer/Drawer.js +26 -13
  63. package/dist/cjs/Drawer/index.js +16 -17
  64. package/dist/cjs/EChart.js +114 -89
  65. package/dist/cjs/ErrorAlert.js +16 -12
  66. package/dist/cjs/ErrorBoundary.js +10 -6
  67. package/dist/cjs/GaugeChart/GaugeChart.js +90 -57
  68. package/dist/cjs/GaugeChart/index.js +16 -17
  69. package/dist/cjs/InfoTooltip/InfoTooltip.js +90 -33
  70. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +27 -17
  71. package/dist/cjs/InfoTooltip/index.js +16 -17
  72. package/dist/cjs/LineChart/LineChart.js +122 -87
  73. package/dist/cjs/LineChart/index.js +16 -17
  74. package/dist/cjs/LineChart/utils.js +23 -23
  75. package/dist/cjs/StatChart/StatChart.js +107 -46
  76. package/dist/cjs/StatChart/StatChart.test.js +65 -21
  77. package/dist/cjs/StatChart/index.js +16 -17
  78. package/dist/cjs/TimeRangeSelector/AbsoluteTimePicker.js +144 -64
  79. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +45 -22
  80. package/dist/cjs/TimeRangeSelector/index.js +17 -18
  81. package/dist/cjs/TimeRangeSelector/utils.js +19 -16
  82. package/dist/cjs/Tooltip/SeriesInfo.js +120 -48
  83. package/dist/cjs/Tooltip/SeriesMarker.js +20 -11
  84. package/dist/cjs/Tooltip/Tooltip.js +95 -67
  85. package/dist/cjs/Tooltip/TooltipContent.js +76 -31
  86. package/dist/cjs/Tooltip/focused-series.js +40 -36
  87. package/dist/cjs/Tooltip/focused-series.test.js +36 -16
  88. package/dist/cjs/Tooltip/index.js +17 -18
  89. package/dist/cjs/Tooltip/tooltip-model.js +46 -30
  90. package/dist/cjs/Tooltip/utils.js +13 -16
  91. package/dist/cjs/context/ChartsThemeProvider.js +65 -13
  92. package/dist/cjs/index.js +27 -28
  93. package/dist/cjs/model/graph.js +10 -5
  94. package/dist/cjs/model/index.js +18 -19
  95. package/dist/cjs/model/theme.js +4 -2
  96. package/dist/cjs/model/units.js +68 -51
  97. package/dist/cjs/test/index.js +16 -17
  98. package/dist/cjs/test/render.js +22 -12
  99. package/dist/cjs/test/setup-tests.js +4 -2
  100. package/dist/cjs/utils/combine-sx.js +15 -16
  101. package/dist/cjs/utils/index.js +17 -18
  102. package/dist/cjs/utils/theme-gen.js +64 -55
  103. package/dist/cjs/utils/theme-gen.test.js +14 -12
  104. package/dist/context/ChartsThemeProvider.js +36 -1
  105. package/dist/context/ChartsThemeProvider.js.map +1 -0
  106. package/dist/index.js +26 -1
  107. package/dist/index.js.map +1 -0
  108. package/dist/model/graph.js +15 -1
  109. package/dist/model/graph.js.map +1 -0
  110. package/dist/model/index.js +17 -1
  111. package/dist/model/index.js.map +1 -0
  112. package/dist/model/theme.js +15 -1
  113. package/dist/model/theme.js.map +1 -0
  114. package/dist/model/units.d.ts.map +1 -1
  115. package/dist/model/units.js +196 -1
  116. package/dist/model/units.js.map +1 -0
  117. package/dist/test/index.js +15 -1
  118. package/dist/test/index.js.map +1 -0
  119. package/dist/test/render.js +32 -1
  120. package/dist/test/render.js.map +1 -0
  121. package/dist/test/setup-tests.js +18 -1
  122. package/dist/test/setup-tests.js.map +1 -0
  123. package/dist/utils/combine-sx.js +27 -1
  124. package/dist/utils/combine-sx.js.map +1 -0
  125. package/dist/utils/index.js +16 -1
  126. package/dist/utils/index.js.map +1 -0
  127. package/dist/utils/theme-gen.js +183 -1
  128. package/dist/utils/theme-gen.js.map +1 -0
  129. package/dist/utils/theme-gen.test.js +196 -1
  130. package/dist/utils/theme-gen.test.js.map +1 -0
  131. package/package.json +8 -4
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,21 +10,21 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./graph"), exports);
30
- __exportStar(require("./theme"), exports);
31
- __exportStar(require("./units"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./graph"), exports);
18
+ _exportStar(require("./theme"), exports);
19
+ _exportStar(require("./units"), exports);
20
+ function _exportStar(from, to) {
21
+ Object.keys(from).forEach(function(k) {
22
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ });
29
+ return from;
30
+ }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,4 +10,7 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,13 +10,26 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.formatNumber = exports.abbreviateLargeNumber = exports.formatValue = exports.DEFAULT_DECIMAL_PLACES = void 0;
16
- const date_fns_1 = require("date-fns");
17
- const mathjs_1 = require("mathjs");
18
- exports.DEFAULT_DECIMAL_PLACES = 2;
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ DEFAULT_DECIMAL_PLACES: ()=>DEFAULT_DECIMAL_PLACES,
25
+ formatValue: ()=>formatValue,
26
+ abbreviateLargeNumber: ()=>abbreviateLargeNumber,
27
+ formatNumber: ()=>formatNumber
28
+ });
29
+ const _dateFns = require("date-fns");
30
+ const _mathjs = require("mathjs");
31
+ const DEFAULT_DECIMAL_PLACES = 2;
19
32
  function formatValue(value, unitOptions) {
20
- var _a;
21
33
  if (unitOptions === undefined) {
22
34
  return value.toString();
23
35
  }
@@ -31,15 +43,23 @@ function formatValue(value, unitOptions) {
31
43
  return formatPercent(value, unitOptions);
32
44
  }
33
45
  if (isBytesUnit(unitOptions)) {
34
- const decimals = (_a = unitOptions.decimal_places) !== null && _a !== void 0 ? _a : exports.DEFAULT_DECIMAL_PLACES;
46
+ var _decimal_places;
47
+ const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
35
48
  return formatBytes(value, decimals);
36
49
  }
37
50
  const exhaustive = unitOptions;
38
51
  throw new Error(`Unknown unit options ${exhaustive}`);
39
52
  }
40
- exports.formatValue = formatValue;
41
- /* Time Unit Conversion */
42
- const timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'];
53
+ /* Time Unit Conversion */ const timeUnitKinds = [
54
+ 'Milliseconds',
55
+ 'Seconds',
56
+ 'Minutes',
57
+ 'Hours',
58
+ 'Days',
59
+ 'Weeks',
60
+ 'Months',
61
+ 'Years'
62
+ ];
43
63
  const timeUnitKindsSet = new Set(timeUnitKinds);
44
64
  function isTimeUnit(unitOptions) {
45
65
  return timeUnitKindsSet.has(unitOptions.kind);
@@ -47,7 +67,7 @@ function isTimeUnit(unitOptions) {
47
67
  function formatTime(value, unitOptions) {
48
68
  // Create a Duration from the value based on what time unit it is
49
69
  const duration = {};
50
- switch (unitOptions.kind) {
70
+ switch(unitOptions.kind){
51
71
  case 'Milliseconds':
52
72
  duration.seconds = value / 1000;
53
73
  break;
@@ -73,11 +93,13 @@ function formatTime(value, unitOptions) {
73
93
  duration.years = value;
74
94
  break;
75
95
  default:
76
- const exhaustive = unitOptions.kind;
77
- throw new Error(`Unknown time unit type ${exhaustive}`);
96
+ {
97
+ const exhaustive = unitOptions.kind;
98
+ throw new Error(`Unknown time unit type ${exhaustive}`);
99
+ }
78
100
  }
79
101
  // Find the largest whole time unit we can display the value in and use it
80
- const ms = (0, date_fns_1.milliseconds)(duration);
102
+ const ms = (0, _dateFns.milliseconds)(duration);
81
103
  const seconds = ms / 1000;
82
104
  if (seconds < 1) {
83
105
  return `${ms.toFixed()} milliseconds`;
@@ -104,29 +126,33 @@ function formatTime(value, unitOptions) {
104
126
  }
105
127
  return `${years.toFixed()} years`;
106
128
  }
107
- /* Percent Unit Conversion */
108
- const percentUnitKinds = ['Percent', 'PercentDecimal', '%'];
129
+ /* Percent Unit Conversion */ const percentUnitKinds = [
130
+ 'Percent',
131
+ 'PercentDecimal',
132
+ '%'
133
+ ];
109
134
  const percentUnitKindsSet = new Set(percentUnitKinds);
110
135
  function isPercentUnit(unitOptions) {
111
136
  return percentUnitKindsSet.has(unitOptions.kind);
112
137
  }
113
138
  function formatPercent(value, unitOptions) {
114
- var _a;
115
- const decimals = (_a = unitOptions.decimal_places) !== null && _a !== void 0 ? _a : exports.DEFAULT_DECIMAL_PLACES;
139
+ var _decimal_places;
140
+ const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
116
141
  if (unitOptions.kind === 'PercentDecimal') {
117
142
  value = value * 100;
118
143
  }
119
144
  return value.toFixed(decimals) + '%';
120
145
  }
121
- /* Decimal Unit Conversion */
122
- const decimalUnitKinds = ['Decimal'];
146
+ /* Decimal Unit Conversion */ const decimalUnitKinds = [
147
+ 'Decimal'
148
+ ];
123
149
  const decimalUnitKindsSet = new Set(decimalUnitKinds);
124
150
  function isDecimalUnit(unitOptions) {
125
151
  return decimalUnitKindsSet.has(unitOptions.kind);
126
152
  }
127
153
  function formatDecimal(value, unitOptions) {
128
- var _a;
129
- const decimals = (_a = unitOptions.decimal_places) !== null && _a !== void 0 ? _a : exports.DEFAULT_DECIMAL_PLACES;
154
+ var _decimal_places;
155
+ const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
130
156
  if (unitOptions.abbreviate === true) {
131
157
  return abbreviateLargeNumber(value, decimals);
132
158
  }
@@ -134,51 +160,42 @@ function formatDecimal(value, unitOptions) {
134
160
  style: 'decimal',
135
161
  minimumFractionDigits: 0,
136
162
  maximumFractionDigits: decimals,
137
- useGrouping: true,
163
+ useGrouping: true
138
164
  };
139
165
  const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);
140
166
  return decimalFormatter.format(value);
141
167
  }
142
- /**
143
- * Takes large numbers and abbreviates them with the appropriate suffix
144
- * 10123 -> 10.123k
145
- * 1000000 -> 1M
146
- */
147
168
  function abbreviateLargeNumber(num, decimals = 2) {
148
- const modifier = (n) => (0, mathjs_1.round)(n, decimals);
169
+ const modifier = (n)=>(0, _mathjs.round)(n, decimals);
149
170
  return formatNumber(num, modifier);
150
171
  }
151
- exports.abbreviateLargeNumber = abbreviateLargeNumber;
152
- /**
153
- * Takes large numbers, rounds and abbreviates them with the appropriate suffix
154
- * Add modifier to run on output value prior to unit being added (defaults to rounding)
155
- */
156
172
  function formatNumber(num, modifier) {
157
173
  const fn = modifier !== null && modifier !== void 0 ? modifier : Math.round;
158
- return num >= 1e12
159
- ? fn(num / 1e12) + 'T'
160
- : num >= 1e9
161
- ? fn(num / 1e9) + 'B'
162
- : num >= 1e6
163
- ? fn(num / 1e6) + 'M'
164
- : num >= 1e3
165
- ? fn(num / 1e3) + 'K'
166
- : num.toString();
174
+ return num >= 1e12 ? fn(num / 1e12) + 'T' : num >= 1e9 ? fn(num / 1e9) + 'B' : num >= 1e6 ? fn(num / 1e6) + 'M' : num >= 1e3 ? fn(num / 1e3) + 'K' : num.toString();
167
175
  }
168
- exports.formatNumber = formatNumber;
169
- /* Bytes Unit Conversion */
170
- const bytesUnitKinds = ['Bytes'];
176
+ /* Bytes Unit Conversion */ const bytesUnitKinds = [
177
+ 'Bytes'
178
+ ];
171
179
  const bytesUnitKindsSet = new Set(bytesUnitKinds);
172
180
  function isBytesUnit(unitOptions) {
173
181
  return bytesUnitKindsSet.has(unitOptions.kind);
174
182
  }
175
183
  // https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828
176
184
  function formatBytes(bytes, decimals = 2) {
177
- if (bytes === 0)
178
- return '0 Bytes';
185
+ if (bytes === 0) return '0 Bytes';
179
186
  const k = 1024;
180
187
  const dm = decimals < 0 ? 0 : decimals;
181
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
188
+ const sizes = [
189
+ 'Bytes',
190
+ 'KB',
191
+ 'MB',
192
+ 'GB',
193
+ 'TB',
194
+ 'PB',
195
+ 'EB',
196
+ 'ZB',
197
+ 'YB'
198
+ ];
182
199
  // Math.max(0, ...) ensures that we don't return -1 as a value for the index.
183
200
  // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.
184
201
  const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,19 +10,19 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./render"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./render"), exports);
18
+ function _exportStar(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
+ enumerable: true,
22
+ get: function() {
23
+ return from[k];
24
+ }
25
+ });
26
+ });
27
+ return from;
28
+ }
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderWithContext = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
1
  // Copyright 2022 The Perses Authors
6
2
  // Licensed under the Apache License, Version 2.0 (the "License");
7
3
  // you may not use this file except in compliance with the License.
@@ -14,13 +10,27 @@ const jsx_runtime_1 = require("react/jsx-runtime");
14
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
11
  // See the License for the specific language governing permissions and
16
12
  // limitations under the License.
17
- const react_1 = require("@testing-library/react");
18
- const react_query_1 = require("react-query");
19
- const queryClient = new react_query_1.QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });
20
- /**
21
- * Test helper to render a React component with some common app-level providers wrapped around it.
22
- */
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "renderWithContext", {
18
+ enumerable: true,
19
+ get: ()=>renderWithContext
20
+ });
21
+ const _jsxRuntime = require("react/jsx-runtime");
22
+ const _react = require("@testing-library/react");
23
+ const _reactQuery = require("@tanstack/react-query");
24
+ const queryClient = new _reactQuery.QueryClient({
25
+ defaultOptions: {
26
+ queries: {
27
+ refetchOnWindowFocus: false
28
+ }
29
+ }
30
+ });
23
31
  function renderWithContext(ui, options) {
24
- return (0, react_1.render)((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: ui }), options);
32
+ return (0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
33
+ client: queryClient,
34
+ children: ui
35
+ }), options);
25
36
  }
26
- exports.renderWithContext = renderWithContext;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,8 +10,11 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
13
  // Add testing library assertions
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", {
16
+ value: true
17
+ });
16
18
  require("@testing-library/jest-dom/extend-expect");
17
19
  // Always mock e-charts during tests since we don't have a proper canvas in jsdom
18
20
  jest.mock('echarts/core');
@@ -1,5 +1,4 @@
1
- "use strict";
2
- // Copyright 2021 The Perses Authors
1
+ // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
5
4
  // You may obtain a copy of the License at
@@ -11,20 +10,20 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.combineSx = void 0;
16
- /**
17
- * Combines sx props from multiple sources. Useful when creating a component and
18
- * you want consumers to be able to provide SxProps that should be combined with
19
- * some built-in styles.
20
- */
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "combineSx", {
18
+ enumerable: true,
19
+ get: ()=>combineSx
20
+ });
21
21
  function combineSx(...sxProps) {
22
- return sxProps.flatMap((sx) => {
23
- if (sx === undefined)
24
- return [];
25
- if (Array.isArray(sx))
26
- return sx;
27
- return [sx];
22
+ return sxProps.flatMap((sx)=>{
23
+ if (sx === undefined) return [];
24
+ if (Array.isArray(sx)) return sx;
25
+ return [
26
+ sx
27
+ ];
28
28
  });
29
29
  }
30
- exports.combineSx = combineSx;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright 2022 The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,20 +10,20 @@
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./combine-sx"), exports);
30
- __exportStar(require("./theme-gen"), exports);
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _exportStar(require("./combine-sx"), exports);
18
+ _exportStar(require("./theme-gen"), exports);
19
+ function _exportStar(from, to) {
20
+ Object.keys(from).forEach(function(k) {
21
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ });
28
+ return from;
29
+ }