@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.
- package/dist/Drawer/Drawer.d.ts +3 -4
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +35 -1
- package/dist/Drawer/Drawer.js.map +1 -0
- package/dist/Drawer/index.js +15 -1
- package/dist/Drawer/index.js.map +1 -0
- package/dist/EChart.d.ts.map +1 -1
- package/dist/EChart.js +142 -1
- package/dist/EChart.js.map +1 -0
- package/dist/ErrorAlert.js +25 -1
- package/dist/ErrorAlert.js.map +1 -0
- package/dist/ErrorBoundary.js +16 -1
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.js +172 -1
- package/dist/GaugeChart/GaugeChart.js.map +1 -0
- package/dist/GaugeChart/index.js +15 -1
- package/dist/GaugeChart/index.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.js +79 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.test.js +36 -1
- package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -0
- package/dist/InfoTooltip/index.js +15 -1
- package/dist/InfoTooltip/index.js.map +1 -0
- package/dist/LineChart/LineChart.js +198 -1
- package/dist/LineChart/LineChart.js.map +1 -0
- package/dist/LineChart/index.js +15 -1
- package/dist/LineChart/index.js.map +1 -0
- package/dist/LineChart/utils.js +63 -1
- package/dist/LineChart/utils.js.map +1 -0
- package/dist/StatChart/StatChart.js +121 -1
- package/dist/StatChart/StatChart.js.map +1 -0
- package/dist/StatChart/StatChart.test.js +82 -1
- package/dist/StatChart/StatChart.test.js.map +1 -0
- package/dist/StatChart/index.js +15 -1
- package/dist/StatChart/index.js.map +1 -0
- package/dist/TimeRangeSelector/AbsoluteTimePicker.js +175 -1
- package/dist/TimeRangeSelector/AbsoluteTimePicker.js.map +1 -0
- package/dist/TimeRangeSelector/TimeRangeSelector.js +52 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
- package/dist/TimeRangeSelector/index.js +16 -1
- package/dist/TimeRangeSelector/index.js.map +1 -0
- package/dist/TimeRangeSelector/utils.js +36 -1
- package/dist/TimeRangeSelector/utils.js.map +1 -0
- package/dist/Tooltip/SeriesInfo.js +143 -1
- package/dist/Tooltip/SeriesInfo.js.map +1 -0
- package/dist/Tooltip/SeriesMarker.js +33 -1
- package/dist/Tooltip/SeriesMarker.js.map +1 -0
- package/dist/Tooltip/Tooltip.js +72 -1
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/TooltipContent.js +89 -1
- package/dist/Tooltip/TooltipContent.js.map +1 -0
- package/dist/Tooltip/focused-series.js +108 -1
- package/dist/Tooltip/focused-series.js.map +1 -0
- package/dist/Tooltip/focused-series.test.js +75 -1
- package/dist/Tooltip/focused-series.test.js.map +1 -0
- package/dist/Tooltip/index.js +16 -1
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/Tooltip/tooltip-model.js +80 -1
- package/dist/Tooltip/tooltip-model.js.map +1 -0
- package/dist/Tooltip/utils.js +46 -1
- package/dist/Tooltip/utils.js.map +1 -0
- package/dist/cjs/Drawer/Drawer.js +26 -13
- package/dist/cjs/Drawer/index.js +16 -17
- package/dist/cjs/EChart.js +114 -89
- package/dist/cjs/ErrorAlert.js +16 -12
- package/dist/cjs/ErrorBoundary.js +10 -6
- package/dist/cjs/GaugeChart/GaugeChart.js +90 -57
- package/dist/cjs/GaugeChart/index.js +16 -17
- package/dist/cjs/InfoTooltip/InfoTooltip.js +90 -33
- package/dist/cjs/InfoTooltip/InfoTooltip.test.js +27 -17
- package/dist/cjs/InfoTooltip/index.js +16 -17
- package/dist/cjs/LineChart/LineChart.js +122 -87
- package/dist/cjs/LineChart/index.js +16 -17
- package/dist/cjs/LineChart/utils.js +23 -23
- package/dist/cjs/StatChart/StatChart.js +107 -46
- package/dist/cjs/StatChart/StatChart.test.js +65 -21
- package/dist/cjs/StatChart/index.js +16 -17
- package/dist/cjs/TimeRangeSelector/AbsoluteTimePicker.js +144 -64
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +45 -22
- package/dist/cjs/TimeRangeSelector/index.js +17 -18
- package/dist/cjs/TimeRangeSelector/utils.js +19 -16
- package/dist/cjs/Tooltip/SeriesInfo.js +120 -48
- package/dist/cjs/Tooltip/SeriesMarker.js +20 -11
- package/dist/cjs/Tooltip/Tooltip.js +95 -67
- package/dist/cjs/Tooltip/TooltipContent.js +76 -31
- package/dist/cjs/Tooltip/focused-series.js +40 -36
- package/dist/cjs/Tooltip/focused-series.test.js +36 -16
- package/dist/cjs/Tooltip/index.js +17 -18
- package/dist/cjs/Tooltip/tooltip-model.js +46 -30
- package/dist/cjs/Tooltip/utils.js +13 -16
- package/dist/cjs/context/ChartsThemeProvider.js +65 -13
- package/dist/cjs/index.js +27 -28
- package/dist/cjs/model/graph.js +10 -5
- package/dist/cjs/model/index.js +18 -19
- package/dist/cjs/model/theme.js +4 -2
- package/dist/cjs/model/units.js +68 -51
- package/dist/cjs/test/index.js +16 -17
- package/dist/cjs/test/render.js +22 -12
- package/dist/cjs/test/setup-tests.js +4 -2
- package/dist/cjs/utils/combine-sx.js +15 -16
- package/dist/cjs/utils/index.js +17 -18
- package/dist/cjs/utils/theme-gen.js +64 -55
- package/dist/cjs/utils/theme-gen.test.js +14 -12
- package/dist/context/ChartsThemeProvider.js +36 -1
- package/dist/context/ChartsThemeProvider.js.map +1 -0
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -0
- package/dist/model/graph.js +15 -1
- package/dist/model/graph.js.map +1 -0
- package/dist/model/index.js +17 -1
- package/dist/model/index.js.map +1 -0
- package/dist/model/theme.js +15 -1
- package/dist/model/theme.js.map +1 -0
- package/dist/model/units.d.ts.map +1 -1
- package/dist/model/units.js +196 -1
- package/dist/model/units.js.map +1 -0
- package/dist/test/index.js +15 -1
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.js +32 -1
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.js +18 -1
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/utils/combine-sx.js +27 -1
- package/dist/utils/combine-sx.js.map +1 -0
- package/dist/utils/index.js +16 -1
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/theme-gen.js +183 -1
- package/dist/utils/theme-gen.js.map +1 -0
- package/dist/utils/theme-gen.test.js +196 -1
- package/dist/utils/theme-gen.test.js.map +1 -0
- package/package.json +8 -4
package/dist/cjs/model/index.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}
|
package/dist/cjs/model/theme.js
CHANGED
|
@@ -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
|
-
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
package/dist/cjs/model/units.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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
|
-
|
|
77
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
|
115
|
-
const decimals = (
|
|
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
|
-
|
|
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
|
|
129
|
-
const decimals = (
|
|
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)
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 = [
|
|
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)));
|
package/dist/cjs/test/index.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Object.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
}
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
exports
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}
|