@perses-dev/components 0.30.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.
Files changed (187) hide show
  1. package/dist/ContentWithLegend/ContentWithLegend.d.ts +11 -0
  2. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -0
  3. package/dist/ContentWithLegend/ContentWithLegend.js +65 -0
  4. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -0
  5. package/dist/ContentWithLegend/index.d.ts +2 -0
  6. package/dist/ContentWithLegend/index.d.ts.map +1 -0
  7. package/dist/ContentWithLegend/index.js +15 -0
  8. package/dist/ContentWithLegend/index.js.map +1 -0
  9. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +68 -0
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -0
  11. package/dist/ContentWithLegend/model/content-with-legend-model.js +90 -0
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -0
  13. package/dist/EChart/EChart.d.ts.map +1 -1
  14. package/dist/EChart/EChart.js +9 -1
  15. package/dist/EChart/EChart.js.map +1 -1
  16. package/dist/Legend/CompactLegend.d.ts +6 -4
  17. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  18. package/dist/Legend/CompactLegend.js +4 -1
  19. package/dist/Legend/CompactLegend.js.map +1 -1
  20. package/dist/Legend/Legend.d.ts +11 -9
  21. package/dist/Legend/Legend.d.ts.map +1 -1
  22. package/dist/Legend/Legend.js +70 -21
  23. package/dist/Legend/Legend.js.map +1 -1
  24. package/dist/Legend/ListLegend.d.ts +5 -8
  25. package/dist/Legend/ListLegend.d.ts.map +1 -1
  26. package/dist/Legend/ListLegend.js +17 -103
  27. package/dist/Legend/ListLegend.js.map +1 -1
  28. package/dist/Legend/ListLegendItem.d.ts +8 -8
  29. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  30. package/dist/Legend/ListLegendItem.js +9 -12
  31. package/dist/Legend/ListLegendItem.js.map +1 -1
  32. package/dist/Legend/TableLegend.d.ts +12 -0
  33. package/dist/Legend/TableLegend.d.ts.map +1 -0
  34. package/dist/Legend/TableLegend.js +61 -0
  35. package/dist/Legend/TableLegend.js.map +1 -0
  36. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  37. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +35 -3
  38. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  39. package/dist/LineChart/LineChart.d.ts +2 -1
  40. package/dist/LineChart/LineChart.d.ts.map +1 -1
  41. package/dist/LineChart/LineChart.js +83 -36
  42. package/dist/LineChart/LineChart.js.map +1 -1
  43. package/dist/StatChart/StatChart.d.ts.map +1 -1
  44. package/dist/StatChart/StatChart.js +8 -1
  45. package/dist/StatChart/StatChart.js.map +1 -1
  46. package/dist/Table/InnerTable.d.ts +9 -0
  47. package/dist/Table/InnerTable.d.ts.map +1 -0
  48. package/dist/Table/InnerTable.js +38 -0
  49. package/dist/Table/InnerTable.js.map +1 -0
  50. package/dist/Table/Table.d.ts +10 -0
  51. package/dist/Table/Table.d.ts.map +1 -0
  52. package/dist/Table/Table.js +101 -0
  53. package/dist/Table/Table.js.map +1 -0
  54. package/dist/Table/TableBody.d.ts +6 -0
  55. package/dist/Table/TableBody.d.ts.map +1 -0
  56. package/dist/Table/TableBody.js +23 -0
  57. package/dist/Table/TableBody.js.map +1 -0
  58. package/dist/Table/TableCell.d.ts +18 -0
  59. package/dist/Table/TableCell.d.ts.map +1 -0
  60. package/dist/Table/TableCell.js +91 -0
  61. package/dist/Table/TableCell.js.map +1 -0
  62. package/dist/Table/TableCheckbox.d.ts +9 -0
  63. package/dist/Table/TableCheckbox.d.ts.map +1 -0
  64. package/dist/Table/TableCheckbox.js +49 -0
  65. package/dist/Table/TableCheckbox.js.map +1 -0
  66. package/dist/Table/TableHead.d.ts +6 -0
  67. package/dist/Table/TableHead.d.ts.map +1 -0
  68. package/dist/Table/TableHead.js +23 -0
  69. package/dist/Table/TableHead.js.map +1 -0
  70. package/dist/Table/TableRow.d.ts +9 -0
  71. package/dist/Table/TableRow.d.ts.map +1 -0
  72. package/dist/Table/TableRow.js +29 -0
  73. package/dist/Table/TableRow.js.map +1 -0
  74. package/dist/Table/VirtualizedTable.d.ts +11 -0
  75. package/dist/Table/VirtualizedTable.d.ts.map +1 -0
  76. package/dist/Table/VirtualizedTable.js +152 -0
  77. package/dist/Table/VirtualizedTable.js.map +1 -0
  78. package/dist/Table/VirtualizedTableContainer.d.ts +6 -0
  79. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -0
  80. package/dist/Table/VirtualizedTableContainer.js +24 -0
  81. package/dist/Table/VirtualizedTableContainer.js.map +1 -0
  82. package/dist/Table/hooks/useTableKeyboardNav.d.ts +32 -0
  83. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -0
  84. package/dist/Table/hooks/useTableKeyboardNav.js +98 -0
  85. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -0
  86. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +29 -0
  87. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -0
  88. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +89 -0
  89. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -0
  90. package/dist/Table/index.d.ts +4 -0
  91. package/dist/Table/index.d.ts.map +1 -0
  92. package/dist/Table/index.js +16 -0
  93. package/dist/Table/index.js.map +1 -0
  94. package/dist/Table/model/table-model.d.ts +83 -0
  95. package/dist/Table/model/table-model.d.ts.map +1 -0
  96. package/dist/Table/model/table-model.js +73 -0
  97. package/dist/Table/model/table-model.js.map +1 -0
  98. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -0
  99. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  100. package/dist/TimeSeriesTooltip/SeriesInfo.js +11 -9
  101. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  102. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts +6 -5
  103. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -1
  104. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js +48 -21
  105. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -1
  106. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +3 -3
  107. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  108. package/dist/TimeSeriesTooltip/TooltipContent.js +28 -67
  109. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  110. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +12 -0
  111. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -0
  112. package/dist/TimeSeriesTooltip/TooltipHeader.js +163 -0
  113. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -0
  114. package/dist/TimeSeriesTooltip/index.d.ts +2 -1
  115. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
  116. package/dist/TimeSeriesTooltip/index.js +2 -1
  117. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  118. package/dist/TimeSeriesTooltip/nearby-series.d.ts +46 -0
  119. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -0
  120. package/dist/TimeSeriesTooltip/nearby-series.js +200 -0
  121. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -0
  122. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +17 -17
  123. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  124. package/dist/TimeSeriesTooltip/tooltip-model.js +7 -2
  125. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  126. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  127. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  128. package/dist/TimeSeriesTooltip/utils.js +6 -5
  129. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  130. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +70 -0
  131. package/dist/cjs/ContentWithLegend/index.js +28 -0
  132. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +100 -0
  133. package/dist/cjs/EChart/EChart.js +9 -1
  134. package/dist/cjs/Legend/CompactLegend.js +4 -1
  135. package/dist/cjs/Legend/Legend.js +70 -21
  136. package/dist/cjs/Legend/ListLegend.js +17 -103
  137. package/dist/cjs/Legend/ListLegendItem.js +8 -11
  138. package/dist/cjs/Legend/TableLegend.js +67 -0
  139. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +34 -2
  140. package/dist/cjs/LineChart/LineChart.js +83 -36
  141. package/dist/cjs/StatChart/StatChart.js +8 -1
  142. package/dist/cjs/Table/InnerTable.js +44 -0
  143. package/dist/cjs/Table/Table.js +102 -0
  144. package/dist/cjs/Table/TableBody.js +29 -0
  145. package/dist/cjs/Table/TableCell.js +97 -0
  146. package/dist/cjs/Table/TableCheckbox.js +55 -0
  147. package/dist/cjs/Table/TableHead.js +29 -0
  148. package/dist/cjs/Table/TableRow.js +35 -0
  149. package/dist/cjs/Table/VirtualizedTable.js +155 -0
  150. package/dist/cjs/Table/VirtualizedTableContainer.js +30 -0
  151. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +99 -0
  152. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +93 -0
  153. package/dist/cjs/Table/index.js +33 -0
  154. package/dist/cjs/Table/model/table-model.js +80 -0
  155. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +10 -8
  156. package/dist/cjs/TimeSeriesTooltip/TimeSeriesTooltip.js +45 -57
  157. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +26 -65
  158. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +174 -0
  159. package/dist/cjs/TimeSeriesTooltip/index.js +2 -1
  160. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +206 -0
  161. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +13 -3
  162. package/dist/cjs/TimeSeriesTooltip/utils.js +5 -4
  163. package/dist/cjs/context/SnackbarProvider.js +66 -0
  164. package/dist/cjs/index.js +3 -0
  165. package/dist/cjs/model/legend.js +37 -2
  166. package/dist/cjs/theme/palette/grey.js +6 -2
  167. package/dist/context/SnackbarProvider.d.ts +23 -0
  168. package/dist/context/SnackbarProvider.d.ts.map +1 -0
  169. package/dist/context/SnackbarProvider.js +59 -0
  170. package/dist/context/SnackbarProvider.js.map +1 -0
  171. package/dist/index.d.ts +3 -0
  172. package/dist/index.d.ts.map +1 -1
  173. package/dist/index.js +3 -0
  174. package/dist/index.js.map +1 -1
  175. package/dist/model/legend.d.ts +19 -5
  176. package/dist/model/legend.d.ts.map +1 -1
  177. package/dist/model/legend.js +31 -1
  178. package/dist/model/legend.js.map +1 -1
  179. package/dist/theme/palette/grey.d.ts.map +1 -1
  180. package/dist/theme/palette/grey.js +6 -2
  181. package/dist/theme/palette/grey.js.map +1 -1
  182. package/package.json +6 -6
  183. package/dist/TimeSeriesTooltip/focused-series.d.ts +0 -25
  184. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +0 -1
  185. package/dist/TimeSeriesTooltip/focused-series.js +0 -110
  186. package/dist/TimeSeriesTooltip/focused-series.js.map +0 -1
  187. package/dist/cjs/TimeSeriesTooltip/focused-series.js +0 -116
@@ -19,15 +19,15 @@ Object.defineProperty(exports, "assembleTransform", {
19
19
  get: ()=>assembleTransform
20
20
  });
21
21
  const _tooltipModel = require("./tooltip-model");
22
- function assembleTransform(mousePos, seriesNum, chartWidth, pinnedPos, tooltipHeight, tooltipWidth) {
22
+ function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, tooltipWidth) {
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
@@ -35,7 +35,8 @@ function assembleTransform(mousePos, seriesNum, chartWidth, pinnedPos, tooltipHe
35
35
  let y = mousePos.page.y + cursorPaddingY;
36
36
  // adjust so tooltip does not get cut off at bottom of chart
37
37
  if (mousePos.client.y + tooltipHeight + cursorPaddingY > window.innerHeight) {
38
- y = mousePos.page.y - tooltipHeight;
38
+ // multiplier ensures tooltip isn't overly adjusted and gets cut off at the top of the viewport
39
+ y = mousePos.page.y - tooltipHeight * _tooltipModel.TOOLTIP_ADJUST_Y_POS_MULTIPLIER;
39
40
  }
40
41
  // use tooltip width to determine when to repos from right to left
41
42
  const xPosAdjustThreshold = chartWidth - tooltipWidth * 0.9;
@@ -0,0 +1,66 @@
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
+ 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
+ SnackbarProvider: ()=>_notistack.SnackbarProvider,
25
+ useSnackbar: ()=>useSnackbar
26
+ });
27
+ const _react = require("react");
28
+ const _notistack = require("notistack");
29
+ function useSnackbar() {
30
+ const { enqueueSnackbar , closeSnackbar } = (0, _notistack.useSnackbar)();
31
+ // Create variant-specific callbacks
32
+ const errorSnackbar = useEnqueueFunction(enqueueSnackbar, 'error');
33
+ const infoSnackbar = useEnqueueFunction(enqueueSnackbar, 'info');
34
+ const warningSnackbar = useEnqueueFunction(enqueueSnackbar, 'warning');
35
+ const successSnackbar = useEnqueueFunction(enqueueSnackbar, 'success');
36
+ const exceptionSnackbar = (0, _react.useCallback)((error, options)=>{
37
+ // Try to use message prop, but fallback to a default message that
38
+ // will just stringify the error provided
39
+ const message = error instanceof Error ? error.message : `An unexpected error occurred: ${error}`;
40
+ return errorSnackbar(message, options);
41
+ }, [
42
+ errorSnackbar
43
+ ]);
44
+ return {
45
+ enqueueSnackbar,
46
+ closeSnackbar,
47
+ errorSnackbar,
48
+ infoSnackbar,
49
+ warningSnackbar,
50
+ successSnackbar,
51
+ exceptionSnackbar
52
+ };
53
+ }
54
+ // Helper to create a variant-specific enqueue function
55
+ function useEnqueueFunction(enqueueSnackbar, variant) {
56
+ return (0, _react.useCallback)((message, options)=>{
57
+ const allOptions = {
58
+ ...options,
59
+ variant
60
+ };
61
+ return enqueueSnackbar(message, allOptions);
62
+ }, [
63
+ enqueueSnackbar,
64
+ variant
65
+ ]);
66
+ }
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);
@@ -29,12 +30,14 @@ _exportStar(require("./LegendOptionsEditor"), exports);
29
30
  _exportStar(require("./LineChart"), exports);
30
31
  _exportStar(require("./OptionsEditorLayout"), exports);
31
32
  _exportStar(require("./StatChart"), exports);
33
+ _exportStar(require("./Table"), exports);
32
34
  _exportStar(require("./ThresholdsEditor"), exports);
33
35
  _exportStar(require("./TimeSeriesTooltip"), exports);
34
36
  _exportStar(require("./UnitSelector"), exports);
35
37
  _exportStar(require("./YAxisLabel"), exports);
36
38
  _exportStar(require("./context/ChartsThemeProvider"), exports);
37
39
  _exportStar(require("./context/TimeZoneProvider"), exports);
40
+ _exportStar(require("./context/SnackbarProvider"), exports);
38
41
  _exportStar(require("./utils"), exports);
39
42
  _exportStar(require("./model"), exports);
40
43
  _exportStar(require("./test-utils"), exports);
@@ -22,16 +22,25 @@ 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,
29
- validateLegendSpec: ()=>validateLegendSpec
31
+ isValidLegendMode: ()=>isValidLegendMode,
32
+ getLegendMode: ()=>getLegendMode,
33
+ validateLegendSpec: ()=>validateLegendSpec,
34
+ isLegendItemVisuallySelected: ()=>isLegendItemVisuallySelected
30
35
  });
31
36
  const legendPositions = [
32
37
  'Bottom',
33
38
  'Right'
34
39
  ];
40
+ const legendModes = [
41
+ 'List',
42
+ 'Table'
43
+ ];
35
44
  const LEGEND_POSITIONS_CONFIG = {
36
45
  Bottom: {
37
46
  label: 'Bottom'
@@ -40,8 +49,17 @@ const LEGEND_POSITIONS_CONFIG = {
40
49
  label: 'Right'
41
50
  }
42
51
  };
52
+ const LEGEND_MODE_CONFIG = {
53
+ List: {
54
+ label: 'List'
55
+ },
56
+ Table: {
57
+ label: 'Table'
58
+ }
59
+ };
43
60
  const DEFAULT_LEGEND = {
44
- position: 'Bottom'
61
+ position: 'Bottom',
62
+ mode: 'List'
45
63
  };
46
64
  function getLegendPosition(position) {
47
65
  if (position === undefined) {
@@ -55,6 +73,15 @@ function getLegendPosition(position) {
55
73
  function isValidLegendPosition(position) {
56
74
  return legendPositions.includes(position);
57
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
+ }
58
85
  function validateLegendSpec(legend) {
59
86
  if (legend === undefined) {
60
87
  // undefined is valid since this is how legend is hidden by default
@@ -63,5 +90,13 @@ function validateLegendSpec(legend) {
63
90
  if (!isValidLegendPosition(legend.position)) {
64
91
  return false;
65
92
  }
93
+ if (legend.mode && !isValidLegendMode(legend.mode)) {
94
+ return false;
95
+ }
66
96
  return true;
67
97
  }
98
+ function isLegendItemVisuallySelected(item, selectedItems) {
99
+ // In the "ALL" case, technically all legend items are selected, but we do
100
+ // not render them differently.
101
+ return selectedItems !== 'ALL' && !!selectedItems[item.id];
102
+ }
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "greyOption", {
21
21
  const _grey = require("./colors/grey");
22
22
  const greyOption = (mode)=>{
23
23
  return mode === 'light' ? {
24
+ 50: _grey.grey[50],
24
25
  100: _grey.grey[100],
25
26
  200: _grey.grey[200],
26
27
  300: _grey.grey[300],
@@ -29,8 +30,10 @@ const greyOption = (mode)=>{
29
30
  600: _grey.grey[600],
30
31
  700: _grey.grey[700],
31
32
  800: _grey.grey[800],
32
- 900: _grey.grey[900]
33
+ 900: _grey.grey[900],
34
+ 950: _grey.grey[950]
33
35
  } : {
36
+ 50: _grey.grey[950],
34
37
  100: _grey.grey[900],
35
38
  200: _grey.grey[800],
36
39
  300: _grey.grey[700],
@@ -39,6 +42,7 @@ const greyOption = (mode)=>{
39
42
  600: _grey.grey[400],
40
43
  700: _grey.grey[300],
41
44
  800: _grey.grey[200],
42
- 900: _grey.grey[100]
45
+ 900: _grey.grey[100],
46
+ 950: _grey.grey[50]
43
47
  };
44
48
  };
@@ -0,0 +1,23 @@
1
+ import { SnackbarProvider as NotistackProvider, ProviderContext as NotistackContext, SnackbarMessage, OptionsObject, SnackbarKey } from 'notistack';
2
+ export interface SnackbarContext extends NotistackContext {
3
+ errorSnackbar: EnqueueFunction;
4
+ infoSnackbar: EnqueueFunction;
5
+ warningSnackbar: EnqueueFunction;
6
+ successSnackbar: EnqueueFunction;
7
+ /**
8
+ * Useful for catch blocks where the error will be of type `unknown`, tries
9
+ * to show the `message` property if passed an instance of `Error`.
10
+ */
11
+ exceptionSnackbar: (error: unknown, options?: SnackbarOptions) => SnackbarKey;
12
+ }
13
+ declare type EnqueueFunction = (message: SnackbarMessage, options?: SnackbarOptions) => SnackbarKey;
14
+ declare type SnackbarOptions = Omit<OptionsObject, 'variant'>;
15
+ /**
16
+ * Application-wide provider for showing snackbars/toasts.
17
+ */
18
+ export { NotistackProvider as SnackbarProvider };
19
+ /**
20
+ * Gets the SnackbarContext with methods for displaying snackbars/toasts.
21
+ */
22
+ export declare function useSnackbar(): SnackbarContext;
23
+ //# sourceMappingURL=SnackbarProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnackbarProvider.d.ts","sourceRoot":"","sources":["../../src/context/SnackbarProvider.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,gBAAgB,IAAI,iBAAiB,EACrC,eAAe,IAAI,gBAAgB,EAEnC,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,aAAa,EAAE,eAAe,CAAC;IAC/B,YAAY,EAAE,eAAe,CAAC;IAC9B,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,eAAe,CAAC;IAEjC;;;OAGG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,WAAW,CAAC;CAC/E;AAED,aAAK,eAAe,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,WAAW,CAAC;AAE5F,aAAK,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,iBAAiB,IAAI,gBAAgB,EAAE,CAAC;AAEjD;;GAEG;AACH,wBAAgB,WAAW,IAAI,eAAe,CA6B7C"}
@@ -0,0 +1,59 @@
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
+ import { useCallback } from 'react';
14
+ import { SnackbarProvider as NotistackProvider, useSnackbar as useNotistack } from 'notistack';
15
+ /**
16
+ * Application-wide provider for showing snackbars/toasts.
17
+ */ export { NotistackProvider as SnackbarProvider };
18
+ /**
19
+ * Gets the SnackbarContext with methods for displaying snackbars/toasts.
20
+ */ export function useSnackbar() {
21
+ const { enqueueSnackbar , closeSnackbar } = useNotistack();
22
+ // Create variant-specific callbacks
23
+ const errorSnackbar = useEnqueueFunction(enqueueSnackbar, 'error');
24
+ const infoSnackbar = useEnqueueFunction(enqueueSnackbar, 'info');
25
+ const warningSnackbar = useEnqueueFunction(enqueueSnackbar, 'warning');
26
+ const successSnackbar = useEnqueueFunction(enqueueSnackbar, 'success');
27
+ const exceptionSnackbar = useCallback((error, options)=>{
28
+ // Try to use message prop, but fallback to a default message that
29
+ // will just stringify the error provided
30
+ const message = error instanceof Error ? error.message : `An unexpected error occurred: ${error}`;
31
+ return errorSnackbar(message, options);
32
+ }, [
33
+ errorSnackbar
34
+ ]);
35
+ return {
36
+ enqueueSnackbar,
37
+ closeSnackbar,
38
+ errorSnackbar,
39
+ infoSnackbar,
40
+ warningSnackbar,
41
+ successSnackbar,
42
+ exceptionSnackbar
43
+ };
44
+ }
45
+ // Helper to create a variant-specific enqueue function
46
+ function useEnqueueFunction(enqueueSnackbar, variant) {
47
+ return useCallback((message, options)=>{
48
+ const allOptions = {
49
+ ...options,
50
+ variant
51
+ };
52
+ return enqueueSnackbar(message, allOptions);
53
+ }, [
54
+ enqueueSnackbar,
55
+ variant
56
+ ]);
57
+ }
58
+
59
+ //# sourceMappingURL=SnackbarProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/context/SnackbarProvider.tsx"],"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 { useCallback } from 'react';\nimport {\n SnackbarProvider as NotistackProvider,\n ProviderContext as NotistackContext,\n useSnackbar as useNotistack,\n SnackbarMessage,\n OptionsObject,\n SnackbarKey,\n} from 'notistack';\n\nexport interface SnackbarContext extends NotistackContext {\n errorSnackbar: EnqueueFunction;\n infoSnackbar: EnqueueFunction;\n warningSnackbar: EnqueueFunction;\n successSnackbar: EnqueueFunction;\n\n /**\n * Useful for catch blocks where the error will be of type `unknown`, tries\n * to show the `message` property if passed an instance of `Error`.\n */\n exceptionSnackbar: (error: unknown, options?: SnackbarOptions) => SnackbarKey;\n}\n\ntype EnqueueFunction = (message: SnackbarMessage, options?: SnackbarOptions) => SnackbarKey;\n\ntype SnackbarOptions = Omit<OptionsObject, 'variant'>;\n\n/**\n * Application-wide provider for showing snackbars/toasts.\n */\nexport { NotistackProvider as SnackbarProvider };\n\n/**\n * Gets the SnackbarContext with methods for displaying snackbars/toasts.\n */\nexport function useSnackbar(): SnackbarContext {\n const { enqueueSnackbar, closeSnackbar } = useNotistack();\n\n // Create variant-specific callbacks\n const errorSnackbar = useEnqueueFunction(enqueueSnackbar, 'error');\n const infoSnackbar = useEnqueueFunction(enqueueSnackbar, 'info');\n const warningSnackbar = useEnqueueFunction(enqueueSnackbar, 'warning');\n const successSnackbar = useEnqueueFunction(enqueueSnackbar, 'success');\n\n const exceptionSnackbar: SnackbarContext['exceptionSnackbar'] = useCallback(\n (error, options) => {\n // Try to use message prop, but fallback to a default message that\n // will just stringify the error provided\n const message = error instanceof Error ? error.message : `An unexpected error occurred: ${error}`;\n\n return errorSnackbar(message, options);\n },\n [errorSnackbar]\n );\n\n return {\n enqueueSnackbar,\n closeSnackbar,\n errorSnackbar,\n infoSnackbar,\n warningSnackbar,\n successSnackbar,\n exceptionSnackbar,\n };\n}\n\n// Helper to create a variant-specific enqueue function\nfunction useEnqueueFunction(\n enqueueSnackbar: NotistackContext['enqueueSnackbar'],\n variant: OptionsObject['variant']\n): EnqueueFunction {\n return useCallback(\n (message, options) => {\n const allOptions: OptionsObject = {\n ...options,\n variant,\n };\n return enqueueSnackbar(message, allOptions);\n },\n [enqueueSnackbar, variant]\n );\n}\n"],"names":["useCallback","SnackbarProvider","NotistackProvider","useSnackbar","useNotistack","enqueueSnackbar","closeSnackbar","errorSnackbar","useEnqueueFunction","infoSnackbar","warningSnackbar","successSnackbar","exceptionSnackbar","error","options","message","Error","variant","allOptions"],"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,SAASA,WAAW,QAAQ,OAAO,CAAC;AACpC,SACEC,gBAAgB,IAAIC,iBAAiB,EAErCC,WAAW,IAAIC,YAAY,QAItB,WAAW,CAAC;AAmBnB;;CAEC,GACD,SAASF,iBAAiB,IAAID,gBAAgB,GAAG;AAEjD;;CAEC,GACD,O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
  export * from './ColorPicker';
2
+ export * from './ContentWithLegend';
2
3
  export * from './DateTimeRangePicker';
3
4
  export * from './Dialog';
4
5
  export * from './Drawer';
@@ -13,12 +14,14 @@ export * from './LegendOptionsEditor';
13
14
  export * from './LineChart';
14
15
  export * from './OptionsEditorLayout';
15
16
  export * from './StatChart';
17
+ export * from './Table';
16
18
  export * from './ThresholdsEditor';
17
19
  export * from './TimeSeriesTooltip';
18
20
  export * from './UnitSelector';
19
21
  export * from './YAxisLabel';
20
22
  export * from './context/ChartsThemeProvider';
21
23
  export * from './context/TimeZoneProvider';
24
+ export * from './context/SnackbarProvider';
22
25
  export * from './utils';
23
26
  export * from './model';
24
27
  export * from './test-utils';
@@ -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,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,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';
@@ -25,12 +26,14 @@ export * from './LegendOptionsEditor';
25
26
  export * from './LineChart';
26
27
  export * from './OptionsEditorLayout';
27
28
  export * from './StatChart';
29
+ export * from './Table';
28
30
  export * from './ThresholdsEditor';
29
31
  export * from './TimeSeriesTooltip';
30
32
  export * from './UnitSelector';
31
33
  export * from './YAxisLabel';
32
34
  export * from './context/ChartsThemeProvider';
33
35
  export * from './context/TimeZoneProvider';
36
+ export * from './context/SnackbarProvider';
34
37
  export * from './utils';
35
38
  export * from './model';
36
39
  export * from './test-utils';
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 './ThresholdsEditor';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\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,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,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"}
@@ -1,22 +1,36 @@
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;
9
12
  label: string;
10
- isSelected: boolean;
11
13
  color: string;
12
- onClick: MouseEventHandler<HTMLElement>;
14
+ onClick?: MouseEventHandler<HTMLElement>;
13
15
  }
14
- export declare type LegendPositionConfig = {
16
+ export declare type LegendSingleSelectConfig = {
15
17
  label: string;
16
18
  };
17
- export declare const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendPositionConfig>>;
18
- export declare const DEFAULT_LEGEND: LegendOptions;
19
+ /**
20
+ * State of selected items in the legend.
21
+ * - When "ALL", all legend items are selected, but not visually highlighted.
22
+ * - Otherwise, it is a Record that associates legend item ids with a boolean
23
+ * value. When the associated entry for a legend item is `true`, that item
24
+ * will be treated as selected and visually highlighted.
25
+ */
26
+ export declare type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';
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>;
19
30
  export declare function getLegendPosition(position?: LegendPositions): "Bottom" | "Right";
20
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";
21
34
  export declare function validateLegendSpec(legend?: LegendOptions): boolean;
35
+ export declare function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState): boolean;
22
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;AAE5D,oBAAY,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM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AuB,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"}
@@ -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,7 +67,15 @@ 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
  }
75
+ export function isLegendItemVisuallySelected(item, selectedItems) {
76
+ // In the "ALL" case, technically all legend items are selected, but we do
77
+ // not render them differently.
78
+ return selectedItems !== 'ALL' && !!selectedItems[item.id];
79
+ }
50
80
 
51
81
  //# sourceMappingURL=legend.js.map
@@ -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;\n\nexport type LegendPositions = (typeof legendPositions)[number];\n\nexport interface LegendOptions {\n position: LegendPositions;\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n isSelected: boolean;\n color: string;\n onClick: MouseEventHandler<HTMLElement>;\n}\n\nexport type LegendPositionConfig = {\n label: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendPositionConfig>> = {\n Bottom: { label: 'Bottom' },\n Right: { label: 'Right' },\n};\n\nexport const DEFAULT_LEGEND: LegendOptions = {\n position: 'Bottom',\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 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 return true;\n}\n"],"names":["legendPositions","LEGEND_POSITIONS_CONFIG","Bottom","label","Right","DEFAULT_LEGEND","position","getLegendPosition","undefined","isValidLegendPosition","includes","validateLegendSpec","legend"],"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;AAoB5D,OAAO,MAAMC,uBAAuB,GAA4D;IAC9FC,MAAM,EAAE;QAAEC,KAAK,EAAE,QAAQ;KAAE;IAC3BC,KAAK,EAAE;QAAED,KAAK,EAAE,OAAO;KAAE;CAC1B,CAAC;AAEF,OAAO,MAAME,cAAc,GAAkB;IAC3CC,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,OAAO,SAASC,iBAAiB,CAACD,QAA0B,EAAE;IAC5D,IAAIA,QAAQ,KAAKE,SAAS,EAAE;QAC1B,OAAOH,cAAc,CAACC,QAAQ,CAAC;IACjC,CAAC;IACD,IAAIG,qBAAqB,CAACH,QAAQ,CAAC,EAAE;QACnC,OAAOA,QAAQ,CAAC;IAClB,CAAC;IACD,OAAOD,cAAc,CAACC,QAAQ,CAAC;AACjC,CAAC;AAED,OAAO,SAASG,qBAAqB,CAACH,QAAyB,EAAE;IAC/D,OAAO,AAACN,eAAe,CAAuBU,QAAQ,CAACJ,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,OAAO,SAASK,kBAAkB,CAACC,MAAsB,EAAE;IACzD,IAAIA,MAAM,KAAKJ,SAAS,EAAE;QACxB,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAACC,qBAAqB,CAACG,MAAM,CAACN,QAAQ,CAAC,EAAE;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
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;AA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,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"grey.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/grey.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5D,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,cAAc,CAAC,MAAM,CAyBnE,CAAC"}
1
+ {"version":3,"file":"grey.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/grey.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5D,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,cAAc,CAAC,MAAM,CA6BnE,CAAC"}
@@ -13,6 +13,7 @@
13
13
  import { grey } from './colors/grey';
14
14
  export const greyOption = (mode)=>{
15
15
  return mode === 'light' ? {
16
+ 50: grey[50],
16
17
  100: grey[100],
17
18
  200: grey[200],
18
19
  300: grey[300],
@@ -21,8 +22,10 @@ export const greyOption = (mode)=>{
21
22
  600: grey[600],
22
23
  700: grey[700],
23
24
  800: grey[800],
24
- 900: grey[900]
25
+ 900: grey[900],
26
+ 950: grey[950]
25
27
  } : {
28
+ 50: grey[950],
26
29
  100: grey[900],
27
30
  200: grey[800],
28
31
  300: grey[700],
@@ -31,7 +34,8 @@ export const greyOption = (mode)=>{
31
34
  600: grey[400],
32
35
  700: grey[300],
33
36
  800: grey[200],
34
- 900: grey[100]
37
+ 900: grey[100],
38
+ 950: grey[50]
35
39
  };
36
40
  };
37
41
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/palette/grey.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 { PaletteOptions, PaletteMode } from '@mui/material';\nimport { grey } from './colors/grey';\n\nexport const greyOption = (mode: PaletteMode): PaletteOptions['grey'] => {\n return mode === 'light'\n ? {\n 100: grey[100],\n 200: grey[200],\n 300: grey[300],\n 400: grey[400],\n 500: grey[500],\n 600: grey[600],\n 700: grey[700],\n 800: grey[800],\n 900: grey[900],\n }\n : // Reverse greys from darkest to lightest for Dark mode\n {\n 100: grey[900],\n 200: grey[800],\n 300: grey[700],\n 400: grey[600],\n 500: grey[500],\n 600: grey[400],\n 700: grey[300],\n 800: grey[200],\n 900: grey[100],\n };\n};\n"],"names":["grey","greyOption","mode"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;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// 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 { PaletteOptions, PaletteMode } from '@mui/material';\nimport { grey } from './colors/grey';\n\nexport const greyOption = (mode: PaletteMode): PaletteOptions['grey'] => {\n return mode === 'light'\n ? {\n 50: grey[50],\n 100: grey[100],\n 200: grey[200],\n 300: grey[300],\n 400: grey[400],\n 500: grey[500],\n 600: grey[600],\n 700: grey[700],\n 800: grey[800],\n 900: grey[900],\n 950: grey[950],\n }\n : // Reverse greys from darkest to lightest for Dark mode\n {\n 50: grey[950],\n 100: grey[900],\n 200: grey[800],\n 300: grey[700],\n 400: grey[600],\n 500: grey[500],\n 600: grey[400],\n 700: grey[300],\n 800: grey[200],\n 900: grey[100],\n 950: grey[50],\n };\n};\n"],"names":["grey","greyOption","mode"],"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;AAGjC,SAASA,IAAI,QAAQ,eAAe,CAAC;AAErC,OAAO,MAAMC,UAAU,GAAG,CAACC,IAAiB,GAA6B;IACvE,OAAOA,IAAI,KAAK,OAAO,GACnB;AACE,QAAA,EAAE,EAAEF,IAAI,CAAC,EAAE,CAAC;AACZ,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;KACf,GAED;AACE,QAAA,EAAE,EAAEA,IAAI,CAAC,GAAG,CAAC;AACb,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,GAAG,CAAC;AACd,QAAA,GAAG,EAAEA,IAAI,CAAC,EAAE,CAAC;KACd,CAAC;AACR,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/components",
3
- "version": "0.30.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,22 +36,22 @@
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.30.0",
39
+ "@perses-dev/core": "0.32.0",
40
+ "@tanstack/react-table": "^8.9.1",
40
41
  "@uiw/react-codemirror": "^4.19.1",
41
42
  "date-fns": "^2.28.0",
42
43
  "date-fns-tz": "^1.3.7",
43
- "echarts": "^5.4.1",
44
+ "echarts": "npm:echarts-nightly@5.5.0-dev.20230517",
44
45
  "lodash-es": "^4.17.21",
45
46
  "mathjs": "^10.6.4",
46
47
  "mdi-material-ui": "^7.4.0",
47
48
  "numbro": "^2.3.6",
48
49
  "react-colorful": "^5.6.1",
49
50
  "react-error-boundary": "^3.1.4",
50
- "react-window": "^1.8.8"
51
+ "react-virtuoso": "^4.3.6"
51
52
  },
52
53
  "devDependencies": {
53
- "@perses-dev/storybook": "0.30.0",
54
- "@types/react-window": "^1.8.5"
54
+ "@perses-dev/storybook": "0.32.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@mui/material": "^5.10.0",
@@ -1,25 +0,0 @@
1
- import { ECharts as EChartsInstance } from 'echarts/core';
2
- import { UnitOptions, EChartsDataFormat } from '../model';
3
- import { CursorData } from './tooltip-model';
4
- export interface FocusedSeriesInfo {
5
- seriesIdx: number | null;
6
- datumIdx: number | null;
7
- seriesName: string;
8
- date: number;
9
- markerColor: string;
10
- x: number;
11
- y: number;
12
- formattedY: string;
13
- }
14
- export declare type FocusedSeriesArray = FocusedSeriesInfo[];
15
- /**
16
- * Returns formatted series data for the points that are close to the user's cursor
17
- * Adjust yBuffer to increase or decrease number of series shown
18
- */
19
- export declare function getNearbySeries(data: EChartsDataFormat, pointInGrid: number[], yBuffer: number, unit?: UnitOptions): FocusedSeriesArray;
20
- /**
21
- * Uses mouse position to determine whether user is hovering over a chart canvas
22
- * If yes, convert from pixel values to logical cartesian coordinates and return all focused series
23
- */
24
- export declare function getFocusedSeriesData(mousePos: CursorData['coords'], chartData: EChartsDataFormat, pinnedPos: CursorData['coords'], chart?: EChartsInstance, unit?: UnitOptions): FocusedSeriesArray;
25
- //# sourceMappingURL=focused-series.d.ts.map