@perses-dev/components 0.31.0 → 0.32.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/ContentWithLegend/ContentWithLegend.d.ts +11 -0
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -0
- package/dist/ContentWithLegend/ContentWithLegend.js +65 -0
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -0
- package/dist/ContentWithLegend/index.d.ts +2 -0
- package/dist/ContentWithLegend/index.d.ts.map +1 -0
- package/dist/ContentWithLegend/index.js +15 -0
- package/dist/ContentWithLegend/index.js.map +1 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +68 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.js +90 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -0
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +9 -1
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +30 -15
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +2 -23
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +1 -1
- package/dist/Legend/TableLegend.d.ts +12 -0
- package/dist/Legend/TableLegend.d.ts.map +1 -0
- package/dist/Legend/TableLegend.js +61 -0
- package/dist/Legend/TableLegend.js.map +1 -0
- package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js +35 -3
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +60 -22
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +8 -1
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts +5 -5
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js +36 -54
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts +0 -2
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +21 -97
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +12 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.js +163 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -0
- package/dist/TimeSeriesTooltip/index.d.ts +1 -0
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +1 -0
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +2 -2
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +10 -14
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +2 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +2 -2
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +70 -0
- package/dist/cjs/ContentWithLegend/index.js +28 -0
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +100 -0
- package/dist/cjs/EChart/EChart.js +9 -1
- package/dist/cjs/Legend/Legend.js +30 -15
- package/dist/cjs/Legend/ListLegend.js +2 -23
- package/dist/cjs/Legend/TableLegend.js +67 -0
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +34 -2
- package/dist/cjs/LineChart/LineChart.js +60 -22
- package/dist/cjs/StatChart/StatChart.js +8 -1
- package/dist/cjs/TimeSeriesTooltip/TimeSeriesTooltip.js +34 -91
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +19 -100
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +174 -0
- package/dist/cjs/TimeSeriesTooltip/index.js +1 -0
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -2
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +3 -1
- package/dist/cjs/TimeSeriesTooltip/utils.js +2 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/model/legend.js +30 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/legend.d.ts +9 -3
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +26 -1
- package/dist/model/legend.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright 2023 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.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TooltipHeader", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>TooltipHeader
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _pin = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Pin"));
|
|
24
|
+
const _pinOutline = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/PinOutline"));
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
27
|
+
const _tooltipModel = require("./tooltip-model");
|
|
28
|
+
function _interopRequireDefault(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const TooltipHeader = /*#__PURE__*/ (0, _react.memo)(function TooltipHeader({ nearbySeries , totalSeries , isTooltipPinned , showAllSeries , onShowAllClick , onUnpinClick }) {
|
|
34
|
+
var ref;
|
|
35
|
+
const { formatWithUserTimeZone } = (0, _timeZoneProvider.useTimeZone)();
|
|
36
|
+
var ref1;
|
|
37
|
+
const seriesTimeMs = (ref1 = (ref = nearbySeries[0]) === null || ref === void 0 ? void 0 : ref.date) !== null && ref1 !== void 0 ? ref1 : null;
|
|
38
|
+
if (seriesTimeMs === null) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const formatTimeSeriesHeader = (timeMs)=>{
|
|
42
|
+
const date = new Date(timeMs);
|
|
43
|
+
const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');
|
|
44
|
+
const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');
|
|
45
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
48
|
+
variant: "caption",
|
|
49
|
+
sx: (theme)=>({
|
|
50
|
+
color: theme.palette.common.white
|
|
51
|
+
}),
|
|
52
|
+
children: formattedDate
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
55
|
+
variant: "caption",
|
|
56
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("strong", {
|
|
57
|
+
children: formattedTime
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
// TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT
|
|
64
|
+
const showAllSeriesToggle = totalSeries > 5;
|
|
65
|
+
var ref2;
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
67
|
+
sx: (theme)=>{
|
|
68
|
+
var ref;
|
|
69
|
+
return {
|
|
70
|
+
width: '100%',
|
|
71
|
+
maxWidth: _tooltipModel.TOOLTIP_MAX_WIDTH,
|
|
72
|
+
padding: theme.spacing(1.5, 2, 0.5, 2),
|
|
73
|
+
backgroundColor: (ref2 = (ref = theme.palette.designSystem) === null || ref === void 0 ? void 0 : ref.grey[800]) !== null && ref2 !== void 0 ? ref2 : _tooltipModel.TOOLTIP_BG_COLOR_FALLBACK,
|
|
74
|
+
position: 'sticky',
|
|
75
|
+
top: 0,
|
|
76
|
+
left: 0
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
81
|
+
sx: {
|
|
82
|
+
width: '100%',
|
|
83
|
+
display: 'flex',
|
|
84
|
+
justifyContent: 'start',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
paddingBottom: 0.5
|
|
87
|
+
},
|
|
88
|
+
children: [
|
|
89
|
+
formatTimeSeriesHeader(seriesTimeMs),
|
|
90
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
91
|
+
direction: "row",
|
|
92
|
+
gap: 1,
|
|
93
|
+
sx: {
|
|
94
|
+
marginLeft: 'auto'
|
|
95
|
+
},
|
|
96
|
+
children: [
|
|
97
|
+
showAllSeriesToggle && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
98
|
+
direction: "row",
|
|
99
|
+
gap: 0.5,
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
sx: {
|
|
102
|
+
textAlign: 'right'
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
106
|
+
sx: {
|
|
107
|
+
fontSize: 11
|
|
108
|
+
},
|
|
109
|
+
children: "Show All"
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Switch, {
|
|
112
|
+
checked: showAllSeries,
|
|
113
|
+
size: "small",
|
|
114
|
+
onChange: (_, checked)=>{
|
|
115
|
+
if (onShowAllClick !== undefined) {
|
|
116
|
+
return onShowAllClick(checked);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
sx: (theme)=>({
|
|
120
|
+
'& .MuiSwitch-switchBase': {
|
|
121
|
+
color: theme.palette.common.white
|
|
122
|
+
},
|
|
123
|
+
'& .MuiSwitch-track': {
|
|
124
|
+
backgroundColor: theme.palette.common.white
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
131
|
+
direction: "row",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
135
|
+
sx: {
|
|
136
|
+
marginRight: 0.5,
|
|
137
|
+
fontSize: 11,
|
|
138
|
+
verticalAlign: 'middle'
|
|
139
|
+
},
|
|
140
|
+
children: [
|
|
141
|
+
"Click to ",
|
|
142
|
+
isTooltipPinned ? 'Unpin' : 'Pin'
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
isTooltipPinned ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pin.default, {
|
|
146
|
+
onClick: ()=>{
|
|
147
|
+
if (onUnpinClick !== undefined) {
|
|
148
|
+
onUnpinClick();
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
sx: {
|
|
152
|
+
fontSize: 16,
|
|
153
|
+
cursor: 'pointer'
|
|
154
|
+
}
|
|
155
|
+
}) : /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pinOutline.default, {
|
|
156
|
+
sx: {
|
|
157
|
+
fontSize: 16
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Divider, {
|
|
167
|
+
sx: (theme)=>({
|
|
168
|
+
width: '100%',
|
|
169
|
+
borderColor: theme.palette.grey['500']
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
});
|
|
@@ -19,6 +19,7 @@ _exportStar(require("./SeriesInfo"), exports);
|
|
|
19
19
|
_exportStar(require("./SeriesLabelsStack"), exports);
|
|
20
20
|
_exportStar(require("./SeriesMarker"), exports);
|
|
21
21
|
_exportStar(require("./TooltipContent"), exports);
|
|
22
|
+
_exportStar(require("./TooltipHeader"), exports);
|
|
22
23
|
_exportStar(require("./nearby-series"), exports);
|
|
23
24
|
_exportStar(require("./tooltip-model"), exports);
|
|
24
25
|
_exportStar(require("./utils"), exports);
|
|
@@ -132,7 +132,7 @@ function checkforNearbySeries(data, pointInGrid, yBuffer, chart, unit) {
|
|
|
132
132
|
}
|
|
133
133
|
function getNearbySeriesData({ mousePos , pinnedPos , chartData , chart , unit , showAllSeries =false }) {
|
|
134
134
|
if (chart === undefined || mousePos === null) return [];
|
|
135
|
-
// prevents multiple tooltips showing from adjacent charts
|
|
135
|
+
// prevents multiple tooltips showing from adjacent charts unless tooltip is pinned
|
|
136
136
|
let cursorTargetMatchesChart = false;
|
|
137
137
|
if (mousePos.target !== null) {
|
|
138
138
|
const currentParent = mousePos.target.parentElement;
|
|
@@ -146,7 +146,7 @@ function getNearbySeriesData({ mousePos , pinnedPos , chartData , chart , unit ,
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
// allows moving cursor inside tooltip
|
|
149
|
+
// allows moving cursor inside tooltip without it fading away
|
|
150
150
|
if (pinnedPos !== null) {
|
|
151
151
|
mousePos = pinnedPos;
|
|
152
152
|
cursorTargetMatchesChart = true;
|
|
@@ -29,6 +29,7 @@ _export(exports, {
|
|
|
29
29
|
FALLBACK_CHART_WIDTH: ()=>FALLBACK_CHART_WIDTH,
|
|
30
30
|
NEARBY_SERIES_DESCRIPTION: ()=>NEARBY_SERIES_DESCRIPTION,
|
|
31
31
|
EMPHASIZED_SERIES_DESCRIPTION: ()=>EMPHASIZED_SERIES_DESCRIPTION,
|
|
32
|
+
TOOLTIP_BG_COLOR_FALLBACK: ()=>TOOLTIP_BG_COLOR_FALLBACK,
|
|
32
33
|
TOOLTIP_DATE_FORMAT: ()=>TOOLTIP_DATE_FORMAT,
|
|
33
34
|
defaultCursorData: ()=>defaultCursorData,
|
|
34
35
|
emptyTooltipData: ()=>emptyTooltipData,
|
|
@@ -37,12 +38,13 @@ _export(exports, {
|
|
|
37
38
|
const _react = require("react");
|
|
38
39
|
const TOOLTIP_MIN_WIDTH = 375;
|
|
39
40
|
const TOOLTIP_MAX_WIDTH = 650;
|
|
40
|
-
const TOOLTIP_MAX_HEIGHT =
|
|
41
|
+
const TOOLTIP_MAX_HEIGHT = 650;
|
|
41
42
|
const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;
|
|
42
43
|
const TOOLTIP_ADJUST_Y_POS_MULTIPLIER = 0.75;
|
|
43
44
|
const FALLBACK_CHART_WIDTH = 750;
|
|
44
45
|
const NEARBY_SERIES_DESCRIPTION = 'nearby series showing in tooltip';
|
|
45
46
|
const EMPHASIZED_SERIES_DESCRIPTION = 'emphasized series showing as bold in tooltip';
|
|
47
|
+
const TOOLTIP_BG_COLOR_FALLBACK = '#2E313E';
|
|
46
48
|
const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {
|
|
47
49
|
year: 'numeric',
|
|
48
50
|
month: 'short',
|
|
@@ -23,11 +23,11 @@ function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, toolt
|
|
|
23
23
|
if (mousePos === null) {
|
|
24
24
|
return 'translate3d(0, 0)';
|
|
25
25
|
}
|
|
26
|
+
const cursorPaddingX = 32;
|
|
27
|
+
const cursorPaddingY = 16;
|
|
26
28
|
if (pinnedPos !== null) {
|
|
27
29
|
mousePos = pinnedPos;
|
|
28
30
|
}
|
|
29
|
-
const cursorPaddingX = 32;
|
|
30
|
-
const cursorPaddingY = 16;
|
|
31
31
|
// Tooltip is located in a Portal attached to the body.
|
|
32
32
|
// Using page coordinates instead of viewport ensures the tooltip is
|
|
33
33
|
// absolutely positioned correctly as the user scrolls
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_exportStar(require("./ColorPicker"), exports);
|
|
18
|
+
_exportStar(require("./ContentWithLegend"), exports);
|
|
18
19
|
_exportStar(require("./DateTimeRangePicker"), exports);
|
|
19
20
|
_exportStar(require("./Dialog"), exports);
|
|
20
21
|
_exportStar(require("./Drawer"), exports);
|
package/dist/cjs/model/legend.js
CHANGED
|
@@ -22,10 +22,14 @@ function _export(target, all) {
|
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
24
|
legendPositions: ()=>legendPositions,
|
|
25
|
+
legendModes: ()=>legendModes,
|
|
25
26
|
LEGEND_POSITIONS_CONFIG: ()=>LEGEND_POSITIONS_CONFIG,
|
|
27
|
+
LEGEND_MODE_CONFIG: ()=>LEGEND_MODE_CONFIG,
|
|
26
28
|
DEFAULT_LEGEND: ()=>DEFAULT_LEGEND,
|
|
27
29
|
getLegendPosition: ()=>getLegendPosition,
|
|
28
30
|
isValidLegendPosition: ()=>isValidLegendPosition,
|
|
31
|
+
isValidLegendMode: ()=>isValidLegendMode,
|
|
32
|
+
getLegendMode: ()=>getLegendMode,
|
|
29
33
|
validateLegendSpec: ()=>validateLegendSpec,
|
|
30
34
|
isLegendItemVisuallySelected: ()=>isLegendItemVisuallySelected
|
|
31
35
|
});
|
|
@@ -33,6 +37,10 @@ const legendPositions = [
|
|
|
33
37
|
'Bottom',
|
|
34
38
|
'Right'
|
|
35
39
|
];
|
|
40
|
+
const legendModes = [
|
|
41
|
+
'List',
|
|
42
|
+
'Table'
|
|
43
|
+
];
|
|
36
44
|
const LEGEND_POSITIONS_CONFIG = {
|
|
37
45
|
Bottom: {
|
|
38
46
|
label: 'Bottom'
|
|
@@ -41,8 +49,17 @@ const LEGEND_POSITIONS_CONFIG = {
|
|
|
41
49
|
label: 'Right'
|
|
42
50
|
}
|
|
43
51
|
};
|
|
52
|
+
const LEGEND_MODE_CONFIG = {
|
|
53
|
+
List: {
|
|
54
|
+
label: 'List'
|
|
55
|
+
},
|
|
56
|
+
Table: {
|
|
57
|
+
label: 'Table'
|
|
58
|
+
}
|
|
59
|
+
};
|
|
44
60
|
const DEFAULT_LEGEND = {
|
|
45
|
-
position: 'Bottom'
|
|
61
|
+
position: 'Bottom',
|
|
62
|
+
mode: 'List'
|
|
46
63
|
};
|
|
47
64
|
function getLegendPosition(position) {
|
|
48
65
|
if (position === undefined) {
|
|
@@ -56,6 +73,15 @@ function getLegendPosition(position) {
|
|
|
56
73
|
function isValidLegendPosition(position) {
|
|
57
74
|
return legendPositions.includes(position);
|
|
58
75
|
}
|
|
76
|
+
function isValidLegendMode(mode) {
|
|
77
|
+
return legendModes.includes(mode);
|
|
78
|
+
}
|
|
79
|
+
function getLegendMode(mode) {
|
|
80
|
+
if (!mode || !isValidLegendMode(mode)) {
|
|
81
|
+
return DEFAULT_LEGEND.mode;
|
|
82
|
+
}
|
|
83
|
+
return mode;
|
|
84
|
+
}
|
|
59
85
|
function validateLegendSpec(legend) {
|
|
60
86
|
if (legend === undefined) {
|
|
61
87
|
// undefined is valid since this is how legend is hidden by default
|
|
@@ -64,6 +90,9 @@ function validateLegendSpec(legend) {
|
|
|
64
90
|
if (!isValidLegendPosition(legend.position)) {
|
|
65
91
|
return false;
|
|
66
92
|
}
|
|
93
|
+
if (legend.mode && !isValidLegendMode(legend.mode)) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
67
96
|
return true;
|
|
68
97
|
}
|
|
69
98
|
function isLegendItemVisuallySelected(item, selectedItems) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
export * from './ColorPicker';
|
|
14
|
+
export * from './ContentWithLegend';
|
|
14
15
|
export * from './DateTimeRangePicker';
|
|
15
16
|
export * from './Dialog';
|
|
16
17
|
export * from './Drawer';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ColorPicker';\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LegendOptionsEditor';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './context/SnackbarProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LegendOptionsEditor';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './context/SnackbarProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/dist/model/legend.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
2
|
export declare const legendPositions: readonly ["Bottom", "Right"];
|
|
3
3
|
export declare type LegendPositions = (typeof legendPositions)[number];
|
|
4
|
+
export declare const legendModes: readonly ["List", "Table"];
|
|
5
|
+
export declare type LegendMode = (typeof legendModes)[number];
|
|
4
6
|
export interface LegendOptions {
|
|
5
7
|
position: LegendPositions;
|
|
8
|
+
mode?: LegendMode;
|
|
6
9
|
}
|
|
7
10
|
export interface LegendItem {
|
|
8
11
|
id: string;
|
|
@@ -10,7 +13,7 @@ export interface LegendItem {
|
|
|
10
13
|
color: string;
|
|
11
14
|
onClick?: MouseEventHandler<HTMLElement>;
|
|
12
15
|
}
|
|
13
|
-
export declare type
|
|
16
|
+
export declare type LegendSingleSelectConfig = {
|
|
14
17
|
label: string;
|
|
15
18
|
};
|
|
16
19
|
/**
|
|
@@ -21,10 +24,13 @@ export declare type LegendPositionConfig = {
|
|
|
21
24
|
* will be treated as selected and visually highlighted.
|
|
22
25
|
*/
|
|
23
26
|
export declare type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';
|
|
24
|
-
export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions,
|
|
25
|
-
export declare const
|
|
27
|
+
export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>>;
|
|
28
|
+
export declare const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>>;
|
|
29
|
+
export declare const DEFAULT_LEGEND: Required<LegendOptions>;
|
|
26
30
|
export declare function getLegendPosition(position?: LegendPositions): "Bottom" | "Right";
|
|
27
31
|
export declare function isValidLegendPosition(position: LegendPositions): boolean;
|
|
32
|
+
export declare function isValidLegendMode(mode: LegendMode): boolean;
|
|
33
|
+
export declare function getLegendMode(mode?: LegendMode): "List" | "Table";
|
|
28
34
|
export declare function validateLegendSpec(legend?: LegendOptions): boolean;
|
|
29
35
|
export declare function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState): boolean;
|
|
30
36
|
//# sourceMappingURL=legend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,eAAO,MAAM,eAAe,8BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAC5D,oBAAY,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,oBAAY,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAC1C;AAED,oBAAY,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;AAEhF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,aAAa,CAGlD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,eAAe,sBAQ3D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,WAE9D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,WAEjD;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,oBAM9C;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,aAAa,WAaxD;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,uBAAuB,WAIpG"}
|
package/dist/model/legend.js
CHANGED
|
@@ -14,6 +14,10 @@ export const legendPositions = [
|
|
|
14
14
|
'Bottom',
|
|
15
15
|
'Right'
|
|
16
16
|
];
|
|
17
|
+
export const legendModes = [
|
|
18
|
+
'List',
|
|
19
|
+
'Table'
|
|
20
|
+
];
|
|
17
21
|
export const LEGEND_POSITIONS_CONFIG = {
|
|
18
22
|
Bottom: {
|
|
19
23
|
label: 'Bottom'
|
|
@@ -22,8 +26,17 @@ export const LEGEND_POSITIONS_CONFIG = {
|
|
|
22
26
|
label: 'Right'
|
|
23
27
|
}
|
|
24
28
|
};
|
|
29
|
+
export const LEGEND_MODE_CONFIG = {
|
|
30
|
+
List: {
|
|
31
|
+
label: 'List'
|
|
32
|
+
},
|
|
33
|
+
Table: {
|
|
34
|
+
label: 'Table'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
25
37
|
export const DEFAULT_LEGEND = {
|
|
26
|
-
position: 'Bottom'
|
|
38
|
+
position: 'Bottom',
|
|
39
|
+
mode: 'List'
|
|
27
40
|
};
|
|
28
41
|
export function getLegendPosition(position) {
|
|
29
42
|
if (position === undefined) {
|
|
@@ -37,6 +50,15 @@ export function getLegendPosition(position) {
|
|
|
37
50
|
export function isValidLegendPosition(position) {
|
|
38
51
|
return legendPositions.includes(position);
|
|
39
52
|
}
|
|
53
|
+
export function isValidLegendMode(mode) {
|
|
54
|
+
return legendModes.includes(mode);
|
|
55
|
+
}
|
|
56
|
+
export function getLegendMode(mode) {
|
|
57
|
+
if (!mode || !isValidLegendMode(mode)) {
|
|
58
|
+
return DEFAULT_LEGEND.mode;
|
|
59
|
+
}
|
|
60
|
+
return mode;
|
|
61
|
+
}
|
|
40
62
|
export function validateLegendSpec(legend) {
|
|
41
63
|
if (legend === undefined) {
|
|
42
64
|
// undefined is valid since this is how legend is hidden by default
|
|
@@ -45,6 +67,9 @@ export function validateLegendSpec(legend) {
|
|
|
45
67
|
if (!isValidLegendPosition(legend.position)) {
|
|
46
68
|
return false;
|
|
47
69
|
}
|
|
70
|
+
if (legend.mode && !isValidLegendMode(legend.mode)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
48
73
|
return true;
|
|
49
74
|
}
|
|
50
75
|
export function isLegendItemVisuallySelected(item, selectedItems) {
|
package/dist/model/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MouseEventHandler } from 'react';\n\nexport const legendPositions = ['Bottom', 'Right'] as const;\
|
|
1
|
+
{"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MouseEventHandler } from 'react';\n\nexport const legendPositions = ['Bottom', 'Right'] as const;\nexport type LegendPositions = (typeof legendPositions)[number];\n\nexport const legendModes = ['List', 'Table'] as const;\nexport type LegendMode = (typeof legendModes)[number];\n\nexport interface LegendOptions {\n position: LegendPositions;\n mode?: LegendMode;\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n color: string;\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n};\n\n/**\n * State of selected items in the legend.\n * - When \"ALL\", all legend items are selected, but not visually highlighted.\n * - Otherwise, it is a Record that associates legend item ids with a boolean\n * value. When the associated entry for a legend item is `true`, that item\n * will be treated as selected and visually highlighted.\n */\nexport type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n Bottom: { label: 'Bottom' },\n Right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n List: { label: 'List' },\n Table: { label: 'Table' },\n};\n\nexport const DEFAULT_LEGEND: Required<LegendOptions> = {\n position: 'Bottom',\n mode: 'List',\n};\n\nexport function getLegendPosition(position?: LegendPositions) {\n if (position === undefined) {\n return DEFAULT_LEGEND.position;\n }\n if (isValidLegendPosition(position)) {\n return position;\n }\n return DEFAULT_LEGEND.position;\n}\n\nexport function isValidLegendPosition(position: LegendPositions) {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function isValidLegendMode(mode: LegendMode) {\n return (legendModes as readonly string[]).includes(mode);\n}\n\nexport function getLegendMode(mode?: LegendMode) {\n if (!mode || !isValidLegendMode(mode)) {\n return DEFAULT_LEGEND.mode;\n }\n\n return mode;\n}\n\nexport function validateLegendSpec(legend?: LegendOptions) {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n\n return true;\n}\n\nexport function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState) {\n // In the \"ALL\" case, technically all legend items are selected, but we do\n // not render them differently.\n return selectedItems !== 'ALL' && !!selectedItems[item.id];\n}\n"],"names":["legendPositions","legendModes","LEGEND_POSITIONS_CONFIG","Bottom","label","Right","LEGEND_MODE_CONFIG","List","Table","DEFAULT_LEGEND","position","mode","getLegendPosition","undefined","isValidLegendPosition","includes","isValidLegendMode","getLegendMode","validateLegendSpec","legend","isLegendItemVisuallySelected","item","selectedItems","id"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,eAAe,GAAG;IAAC,QAAQ;IAAE,OAAO;CAAC,AAAS,CAAC;AAG5D,OAAO,MAAMC,WAAW,GAAG;IAAC,MAAM;IAAE,OAAO;CAAC,AAAS,CAAC;AA4BtD,OAAO,MAAMC,uBAAuB,GAAgE;IAClGC,MAAM,EAAE;QAAEC,KAAK,EAAE,QAAQ;KAAE;IAC3BC,KAAK,EAAE;QAAED,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAME,kBAAkB,GAA2D;IACxFC,IAAI,EAAE;QAAEH,KAAK,EAAE,MAAM;KAAE;IACvBI,KAAK,EAAE;QAAEJ,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAMK,cAAc,GAA4B;IACrDC,QAAQ,EAAE,QAAQ;IAClBC,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,OAAO,SAASC,iBAAiB,CAACF,QAA0B,EAAE;IAC5D,IAAIA,QAAQ,KAAKG,SAAS,EAAE;QAC1B,OAAOJ,cAAc,CAACC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAII,qBAAqB,CAACJ,QAAQ,CAAC,EAAE;QACnC,OAAOA,QAAQ,CAAC;IAClB,CAAC;IACD,OAAOD,cAAc,CAACC,QAAQ,CAAC;AACjC,CAAC;AAED,OAAO,SAASI,qBAAqB,CAACJ,QAAyB,EAAE;IAC/D,OAAO,AAACV,eAAe,CAAuBe,QAAQ,CAACL,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,SAASM,iBAAiB,CAACL,IAAgB,EAAE;IAClD,OAAO,AAACV,WAAW,CAAuBc,QAAQ,CAACJ,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,OAAO,SAASM,aAAa,CAACN,IAAiB,EAAE;IAC/C,IAAI,CAACA,IAAI,IAAI,CAACK,iBAAiB,CAACL,IAAI,CAAC,EAAE;QACrC,OAAOF,cAAc,CAACE,IAAI,CAAC;IAC7B,CAAC;IAED,OAAOA,IAAI,CAAC;AACd,CAAC;AAED,OAAO,SAASO,kBAAkB,CAACC,MAAsB,EAAE;IACzD,IAAIA,MAAM,KAAKN,SAAS,EAAE;QACxB,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAACC,qBAAqB,CAACK,MAAM,CAACT,QAAQ,CAAC,EAAE;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAIS,MAAM,CAACR,IAAI,IAAI,CAACK,iBAAiB,CAACG,MAAM,CAACR,IAAI,CAAC,EAAE;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,SAASS,4BAA4B,CAACC,IAAgB,EAAEC,aAAsC,EAAE;IACrG,0EAA0E;IAC1E,+BAA+B;IAC/B,OAAOA,aAAa,KAAK,KAAK,IAAI,CAAC,CAACA,aAAa,CAACD,IAAI,CAACE,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Common UI components used across Perses features",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@codemirror/lang-json": "^6.0.1",
|
|
37
37
|
"@fontsource/lato": "^4.5.10",
|
|
38
38
|
"@mui/x-date-pickers": "^5.0.0-beta.1",
|
|
39
|
-
"@perses-dev/core": "0.
|
|
39
|
+
"@perses-dev/core": "0.32.0",
|
|
40
40
|
"@tanstack/react-table": "^8.9.1",
|
|
41
41
|
"@uiw/react-codemirror": "^4.19.1",
|
|
42
42
|
"date-fns": "^2.28.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-virtuoso": "^4.3.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@perses-dev/storybook": "0.
|
|
54
|
+
"@perses-dev/storybook": "0.32.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@mui/material": "^5.10.0",
|