@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
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GaugeChart = 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,33 +10,50 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "GaugeChart", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>GaugeChart
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _core = require("echarts/core");
|
|
24
|
+
const _charts = require("echarts/charts");
|
|
25
|
+
const _components = require("echarts/components");
|
|
26
|
+
const _renderers = require("echarts/renderers");
|
|
27
|
+
const _chartsThemeProvider = require("../context/ChartsThemeProvider");
|
|
28
|
+
const _units = require("../model/units");
|
|
29
|
+
const _echart = require("../EChart");
|
|
30
|
+
(0, _core.use)([
|
|
31
|
+
_charts.GaugeChart,
|
|
32
|
+
_components.GridComponent,
|
|
33
|
+
_components.TitleComponent,
|
|
34
|
+
_components.TooltipComponent,
|
|
35
|
+
_renderers.CanvasRenderer
|
|
36
|
+
]);
|
|
26
37
|
function GaugeChart(props) {
|
|
27
|
-
const { width, height, data, unit, axisLine, max
|
|
28
|
-
const chartsTheme = (0,
|
|
29
|
-
const option = (0,
|
|
30
|
-
if (data === null || data === undefined)
|
|
31
|
-
return chartsTheme.noDataOption;
|
|
38
|
+
const { width , height , data , unit , axisLine , max } = props;
|
|
39
|
+
const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
|
|
40
|
+
const option = (0, _react.useMemo)(()=>{
|
|
41
|
+
if (data === null || data === undefined) return chartsTheme.noDataOption;
|
|
32
42
|
const calculatedValue = data;
|
|
33
43
|
return {
|
|
34
44
|
title: {
|
|
35
|
-
show: false
|
|
45
|
+
show: false
|
|
36
46
|
},
|
|
37
47
|
tooltip: {
|
|
38
|
-
show: false
|
|
48
|
+
show: false
|
|
39
49
|
},
|
|
40
50
|
series: [
|
|
41
51
|
{
|
|
42
52
|
type: 'gauge',
|
|
43
|
-
center: [
|
|
53
|
+
center: [
|
|
54
|
+
'50%',
|
|
55
|
+
'65%'
|
|
56
|
+
],
|
|
44
57
|
radius: '100%',
|
|
45
58
|
startAngle: 200,
|
|
46
59
|
endAngle: -20,
|
|
@@ -51,49 +64,57 @@ function GaugeChart(props) {
|
|
|
51
64
|
show: true,
|
|
52
65
|
width: 22,
|
|
53
66
|
itemStyle: {
|
|
54
|
-
color: 'auto'
|
|
55
|
-
}
|
|
67
|
+
color: 'auto'
|
|
68
|
+
}
|
|
56
69
|
},
|
|
57
70
|
pointer: {
|
|
58
|
-
show: false
|
|
71
|
+
show: false
|
|
59
72
|
},
|
|
60
73
|
axisLine: {
|
|
61
74
|
lineStyle: {
|
|
62
|
-
color: [
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
color: [
|
|
76
|
+
[
|
|
77
|
+
1,
|
|
78
|
+
'#e1e5e9'
|
|
79
|
+
]
|
|
80
|
+
],
|
|
81
|
+
width: 22
|
|
82
|
+
}
|
|
65
83
|
},
|
|
66
84
|
axisTick: {
|
|
67
85
|
show: false,
|
|
68
|
-
distance: 0
|
|
86
|
+
distance: 0
|
|
69
87
|
},
|
|
70
88
|
splitLine: {
|
|
71
|
-
show: true
|
|
89
|
+
show: true
|
|
72
90
|
},
|
|
73
91
|
axisLabel: {
|
|
74
92
|
show: false,
|
|
75
93
|
distance: -18,
|
|
76
94
|
color: '#999',
|
|
77
|
-
fontSize: 12
|
|
95
|
+
fontSize: 12
|
|
78
96
|
},
|
|
79
97
|
anchor: {
|
|
80
|
-
show: false
|
|
98
|
+
show: false
|
|
81
99
|
},
|
|
82
100
|
title: {
|
|
83
|
-
show: false
|
|
101
|
+
show: false
|
|
84
102
|
},
|
|
85
103
|
detail: {
|
|
86
|
-
show: false
|
|
104
|
+
show: false
|
|
87
105
|
},
|
|
88
106
|
data: [
|
|
89
107
|
{
|
|
90
|
-
value: calculatedValue
|
|
91
|
-
}
|
|
92
|
-
]
|
|
108
|
+
value: calculatedValue
|
|
109
|
+
}
|
|
110
|
+
]
|
|
93
111
|
},
|
|
94
112
|
{
|
|
95
113
|
type: 'gauge',
|
|
96
|
-
center: [
|
|
114
|
+
center: [
|
|
115
|
+
'50%',
|
|
116
|
+
'65%'
|
|
117
|
+
],
|
|
97
118
|
radius: '114%',
|
|
98
119
|
startAngle: 200,
|
|
99
120
|
endAngle: -20,
|
|
@@ -102,44 +123,56 @@ function GaugeChart(props) {
|
|
|
102
123
|
pointer: {
|
|
103
124
|
show: false,
|
|
104
125
|
itemStyle: {
|
|
105
|
-
color: 'auto'
|
|
106
|
-
}
|
|
126
|
+
color: 'auto'
|
|
127
|
+
}
|
|
107
128
|
},
|
|
108
129
|
axisLine,
|
|
109
130
|
axisTick: {
|
|
110
|
-
show: false
|
|
131
|
+
show: false
|
|
111
132
|
},
|
|
112
133
|
splitLine: {
|
|
113
|
-
show: false
|
|
134
|
+
show: false
|
|
114
135
|
},
|
|
115
136
|
axisLabel: {
|
|
116
|
-
show: false
|
|
137
|
+
show: false
|
|
117
138
|
},
|
|
118
139
|
detail: {
|
|
119
140
|
show: true,
|
|
120
141
|
width: '60%',
|
|
121
142
|
borderRadius: 8,
|
|
122
|
-
offsetCenter: [
|
|
143
|
+
offsetCenter: [
|
|
144
|
+
0,
|
|
145
|
+
'-9%'
|
|
146
|
+
],
|
|
123
147
|
color: 'inherit',
|
|
124
|
-
formatter: (value)
|
|
125
|
-
return (0,
|
|
148
|
+
formatter: (value)=>{
|
|
149
|
+
return (0, _units.formatValue)(value, {
|
|
126
150
|
kind: unit.kind,
|
|
127
|
-
decimal_places: 0
|
|
151
|
+
decimal_places: 0
|
|
128
152
|
});
|
|
129
|
-
}
|
|
153
|
+
}
|
|
130
154
|
},
|
|
131
155
|
data: [
|
|
132
156
|
{
|
|
133
|
-
value: calculatedValue
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
]
|
|
157
|
+
value: calculatedValue
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
]
|
|
138
162
|
};
|
|
139
|
-
}, [
|
|
140
|
-
|
|
163
|
+
}, [
|
|
164
|
+
data,
|
|
165
|
+
chartsTheme,
|
|
166
|
+
unit,
|
|
167
|
+
axisLine,
|
|
168
|
+
max
|
|
169
|
+
]);
|
|
170
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_echart.EChart, {
|
|
171
|
+
sx: {
|
|
141
172
|
width: width,
|
|
142
|
-
height: height
|
|
143
|
-
},
|
|
173
|
+
height: height
|
|
174
|
+
},
|
|
175
|
+
option: option,
|
|
176
|
+
theme: chartsTheme.themeName
|
|
177
|
+
});
|
|
144
178
|
}
|
|
145
|
-
exports.GaugeChart = GaugeChart;
|
|
@@ -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("./GaugeChart"), 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,39 +1,96 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
TooltipPlacement: ()=>TooltipPlacement,
|
|
25
|
+
InfoTooltip: ()=>InfoTooltip
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
|
|
29
|
+
const _material = require("@mui/material");
|
|
30
|
+
function _interopRequireDefault(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
6
35
|
var TooltipPlacement;
|
|
7
|
-
(function
|
|
8
|
-
TooltipPlacement["Top"] =
|
|
9
|
-
TooltipPlacement["Left"] =
|
|
10
|
-
TooltipPlacement["Right"] =
|
|
11
|
-
TooltipPlacement["Bottom"] =
|
|
12
|
-
})(TooltipPlacement
|
|
13
|
-
const InfoTooltip = ({ id, title, description, placement, children
|
|
14
|
-
return (
|
|
36
|
+
(function(TooltipPlacement) {
|
|
37
|
+
TooltipPlacement["Top"] = 'top';
|
|
38
|
+
TooltipPlacement["Left"] = 'left';
|
|
39
|
+
TooltipPlacement["Right"] = 'right';
|
|
40
|
+
TooltipPlacement["Bottom"] = 'bottom';
|
|
41
|
+
})(TooltipPlacement || (TooltipPlacement = {}));
|
|
42
|
+
const InfoTooltip = ({ id , title , description , placement , children })=>{
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(StyledTooltip, {
|
|
44
|
+
arrow: true,
|
|
45
|
+
id: id,
|
|
46
|
+
placement: placement,
|
|
47
|
+
title: /*#__PURE__*/ (0, _jsxRuntime.jsx)(TooltipContent, {
|
|
48
|
+
title: title,
|
|
49
|
+
description: description
|
|
50
|
+
}),
|
|
51
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
52
|
+
children: children
|
|
53
|
+
})
|
|
54
|
+
});
|
|
15
55
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
56
|
+
const TooltipContent = ({ title , description })=>{
|
|
57
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
58
|
+
children: [
|
|
59
|
+
title && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
60
|
+
variant: "body2",
|
|
61
|
+
sx: (theme)=>({
|
|
62
|
+
color: theme.palette.text.primary,
|
|
63
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
64
|
+
}),
|
|
65
|
+
children: title
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
68
|
+
variant: "caption",
|
|
69
|
+
sx: (theme)=>({
|
|
70
|
+
color: theme.palette.text.primary
|
|
71
|
+
}),
|
|
72
|
+
children: description
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
24
76
|
};
|
|
25
|
-
const StyledTooltip = (0,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
[`& .${material_1.tooltipClasses.arrow}`]: {
|
|
34
|
-
color: theme.palette.background.paper,
|
|
35
|
-
'&::before': {
|
|
77
|
+
const StyledTooltip = (0, _material.styled)(({ className , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
78
|
+
...props,
|
|
79
|
+
classes: {
|
|
80
|
+
popper: className
|
|
81
|
+
}
|
|
82
|
+
}))(({ theme })=>({
|
|
83
|
+
[`& .${_material.tooltipClasses.tooltip}`]: {
|
|
36
84
|
backgroundColor: theme.palette.secondary.main,
|
|
85
|
+
color: theme.palette.grey[900],
|
|
86
|
+
maxWidth: '300px',
|
|
87
|
+
padding: theme.spacing(1),
|
|
88
|
+
boxShadow: theme.shadows[1]
|
|
37
89
|
},
|
|
38
|
-
|
|
39
|
-
|
|
90
|
+
[`& .${_material.tooltipClasses.arrow}`]: {
|
|
91
|
+
color: theme.palette.background.paper,
|
|
92
|
+
'&::before': {
|
|
93
|
+
backgroundColor: theme.palette.secondary.main
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
1
|
// Copyright 2022 The Perses Authors
|
|
8
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
3
|
// you may not use this file except in compliance with the License.
|
|
@@ -16,18 +10,34 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
11
|
// See the License for the specific language governing permissions and
|
|
18
12
|
// limitations under the License.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _react = require("@testing-library/react");
|
|
19
|
+
const _userEvent = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/user-event"));
|
|
20
|
+
const _dom = require("@testing-library/dom");
|
|
21
|
+
const _infoTooltip = require("./InfoTooltip");
|
|
22
|
+
function _interopRequireDefault(obj) {
|
|
23
|
+
return obj && obj.__esModule ? obj : {
|
|
24
|
+
default: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
describe('InfoTooltip', ()=>{
|
|
24
28
|
const title = 'Tooltip Title';
|
|
25
29
|
const description = 'this is a tooltip';
|
|
26
|
-
it('should render title and description', async ()
|
|
27
|
-
(0,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
it('should render title and description', async ()=>{
|
|
31
|
+
(0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_infoTooltip.InfoTooltip, {
|
|
32
|
+
title: title,
|
|
33
|
+
description: description,
|
|
34
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
35
|
+
children: "tooltipAnchor"
|
|
36
|
+
})
|
|
37
|
+
}));
|
|
38
|
+
const tooltipAnchor = _dom.screen.getByText('tooltipAnchor');
|
|
39
|
+
_userEvent.default.hover(tooltipAnchor);
|
|
40
|
+
await _dom.screen.findByText(title);
|
|
41
|
+
_dom.screen.findByText(description);
|
|
32
42
|
});
|
|
33
43
|
});
|
|
@@ -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("./InfoTooltip"), 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
|
+
}
|