@perses-dev/components 0.37.2 → 0.38.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 (86) hide show
  1. package/README.md +1 -0
  2. package/dist/BarChart/BarChart.d.ts +16 -0
  3. package/dist/BarChart/BarChart.d.ts.map +1 -0
  4. package/dist/BarChart/BarChart.js +123 -0
  5. package/dist/BarChart/BarChart.js.map +1 -0
  6. package/dist/BarChart/index.d.ts +2 -0
  7. package/dist/BarChart/index.d.ts.map +1 -0
  8. package/dist/BarChart/index.js +15 -0
  9. package/dist/BarChart/index.js.map +1 -0
  10. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +10 -0
  11. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -0
  12. package/dist/Dialog/DiscardChangesConfirmationDialog.js +47 -0
  13. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -0
  14. package/dist/Dialog/index.d.ts +1 -0
  15. package/dist/Dialog/index.d.ts.map +1 -1
  16. package/dist/Dialog/index.js +1 -0
  17. package/dist/Dialog/index.js.map +1 -1
  18. package/dist/Legend/ListLegendItem.d.ts +1 -1
  19. package/dist/LineChart/LineChart.d.ts.map +1 -1
  20. package/dist/LineChart/LineChart.js +2 -1
  21. package/dist/LineChart/LineChart.js.map +1 -1
  22. package/dist/ModeSelector/ModeSelector.d.ts +9 -0
  23. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -0
  24. package/dist/ModeSelector/ModeSelector.js +43 -0
  25. package/dist/ModeSelector/ModeSelector.js.map +1 -0
  26. package/dist/ModeSelector/index.d.ts +2 -0
  27. package/dist/ModeSelector/index.d.ts.map +1 -0
  28. package/dist/ModeSelector/index.js +15 -0
  29. package/dist/ModeSelector/index.js.map +1 -0
  30. package/dist/SortSelector/SortSelector.d.ts +8 -0
  31. package/dist/SortSelector/SortSelector.d.ts.map +1 -0
  32. package/dist/SortSelector/SortSelector.js +42 -0
  33. package/dist/SortSelector/SortSelector.js.map +1 -0
  34. package/dist/SortSelector/index.d.ts +2 -0
  35. package/dist/SortSelector/index.d.ts.map +1 -0
  36. package/dist/SortSelector/index.js +15 -0
  37. package/dist/SortSelector/index.js.map +1 -0
  38. package/dist/TimeChart/TimeChart.d.ts +1 -0
  39. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  40. package/dist/TimeChart/TimeChart.js +49 -12
  41. package/dist/TimeChart/TimeChart.js.map +1 -1
  42. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +5 -0
  43. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  44. package/dist/TimeSeriesTooltip/LineChartTooltip.js +12 -5
  45. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  46. package/dist/TimeSeriesTooltip/nearby-series.d.ts +1 -1
  47. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  48. package/dist/TimeSeriesTooltip/nearby-series.js +87 -96
  49. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  50. package/dist/UnitSelector/UnitSelector.d.ts +2 -1
  51. package/dist/UnitSelector/UnitSelector.d.ts.map +1 -1
  52. package/dist/UnitSelector/UnitSelector.js +3 -2
  53. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  54. package/dist/cjs/BarChart/BarChart.js +129 -0
  55. package/dist/cjs/BarChart/index.js +28 -0
  56. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +53 -0
  57. package/dist/cjs/Dialog/index.js +1 -0
  58. package/dist/cjs/LineChart/LineChart.js +2 -1
  59. package/dist/cjs/ModeSelector/ModeSelector.js +49 -0
  60. package/dist/cjs/ModeSelector/index.js +28 -0
  61. package/dist/cjs/SortSelector/SortSelector.js +48 -0
  62. package/dist/cjs/SortSelector/index.js +28 -0
  63. package/dist/cjs/TimeChart/TimeChart.js +52 -10
  64. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +11 -4
  65. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +87 -96
  66. package/dist/cjs/UnitSelector/UnitSelector.js +3 -2
  67. package/dist/cjs/index.js +3 -0
  68. package/dist/cjs/model/graph.js +35 -3
  69. package/dist/cjs/utils/chart-actions.js +61 -1
  70. package/dist/cjs/utils/theme-gen.js +34 -6
  71. package/dist/index.d.ts +3 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +3 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/model/graph.d.ts +11 -2
  76. package/dist/model/graph.d.ts.map +1 -1
  77. package/dist/model/graph.js +25 -0
  78. package/dist/model/graph.js.map +1 -1
  79. package/dist/utils/chart-actions.d.ts +3 -0
  80. package/dist/utils/chart-actions.d.ts.map +1 -1
  81. package/dist/utils/chart-actions.js +66 -0
  82. package/dist/utils/chart-actions.js.map +1 -1
  83. package/dist/utils/theme-gen.d.ts.map +1 -1
  84. package/dist/utils/theme-gen.js +34 -6
  85. package/dist/utils/theme-gen.js.map +1 -1
  86. package/package.json +3 -3
@@ -48,5 +48,71 @@
48
48
  }
49
49
  }
50
50
  }
51
+ /*
52
+ * Convert a point from pixel coordinate to logical coordinate.
53
+ * Used to determine if cursor is over chart canvas and closest datapoint.
54
+ * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel
55
+ */ export function getPointInGrid(cursorCoordX, cursorCoordY, chart) {
56
+ if (chart === undefined) {
57
+ return null;
58
+ }
59
+ const pointInPixel = [
60
+ cursorCoordX,
61
+ cursorCoordY
62
+ ];
63
+ if (!chart.containPixel('grid', pointInPixel)) {
64
+ return null;
65
+ }
66
+ const pointInGrid = chart.convertFromPixel('grid', pointInPixel);
67
+ return pointInGrid;
68
+ }
69
+ /*
70
+ * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.
71
+ * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.
72
+ * More info: https://echarts.apache.org/en/api.html#action
73
+ */ export function batchDispatchNearbySeriesActions(chart, nearbySeriesIndexes, emphasizedSeriesIndexes, nonEmphasizedSeriesIndexes, emphasizedDatapoints, duplicateDatapoints) {
74
+ // Accounts for multiple series that are rendered direct on top of eachother.
75
+ // Only applies select state to the datapoint that is visible to avoid color mismatch.
76
+ const lastEmphasizedDatapoint = duplicateDatapoints.length > 0 ? duplicateDatapoints[duplicateDatapoints.length - 1] : emphasizedDatapoints[emphasizedDatapoints.length - 1];
77
+ if (lastEmphasizedDatapoint !== undefined) {
78
+ // Corresponds to select options inside getTimeSeries util.
79
+ // https://echarts.apache.org/en/option.html#series-line.select.itemStyle
80
+ chart.dispatchAction({
81
+ type: 'select',
82
+ seriesIndex: lastEmphasizedDatapoint.seriesIndex,
83
+ dataIndex: lastEmphasizedDatapoint.dataIndex,
84
+ // Shared crosshair should not emphasize datapoints on adjacent charts.
85
+ escapeConnect: true
86
+ });
87
+ }
88
+ // Clears emphasis state of all lines that are not emphasized.
89
+ // Emphasized is a subset of just the nearby series that are closest to cursor.
90
+ chart.dispatchAction({
91
+ type: 'downplay',
92
+ seriesIndex: nonEmphasizedSeriesIndexes
93
+ });
94
+ // https://echarts.apache.org/en/api.html#action.highlight
95
+ if (emphasizedSeriesIndexes.length > 0) {
96
+ // Fadeout opacity of all series not closest to cursor.
97
+ chart.dispatchAction({
98
+ type: 'highlight',
99
+ seriesIndex: emphasizedSeriesIndexes,
100
+ notBlur: false,
101
+ escapeConnect: true
102
+ });
103
+ } else {
104
+ // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.
105
+ chart.dispatchAction({
106
+ type: 'highlight',
107
+ seriesIndex: nearbySeriesIndexes,
108
+ notBlur: true,
109
+ escapeConnect: true
110
+ });
111
+ // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting
112
+ chart.dispatchAction({
113
+ type: 'toggleSelect'
114
+ });
115
+ }
116
+ }
51
117
 
52
118
  //# sourceMappingURL=chart-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/chart-actions.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 { ECharts as EChartsInstance } from 'echarts/core';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance) {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance) {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance, totalSeries: number) {\n if (chart.dispatchAction !== undefined) {\n for (let i = 0; i < totalSeries; i++) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: i,\n });\n }\n }\n}\n"],"names":["enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","totalSeries","i","seriesIndex"],"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;AAYjC;;;CAGC,GACD,OAAO,SAASA,cAAc,CAACC,KAAsB,EAAE;IACrD,MAAMC,UAAU,GAAGD,KAAK,CAAC,QAAQ,CAAC,AAAC;IACnC,IAAIC,UAAU,KAAKC,SAAS,EAAE,OAAO;IACrC,IAAID,UAAU,CAACE,MAAM,CAACC,OAAO,KAAKF,SAAS,IAAID,UAAU,CAACE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;QACnF,wGAAwG;QACxG,IAAIJ,UAAU,CAACE,MAAM,CAACC,OAAO,CAAC,CAAC,CAAC,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;YAC9ET,KAAK,CAACU,cAAc,CAAC;gBACnBC,IAAI,EAAE,kBAAkB;gBACxBC,GAAG,EAAE,gBAAgB;gBACrBC,oBAAoB,EAAE,IAAI;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED;;CAEC,GACD,OAAO,SAASC,YAAY,CAACd,KAAsB,EAAE;IACnD,wEAAwE;IACxEA,KAAK,CAACU,cAAc,CAAC;QACnBC,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC;AACL,CAAC;AAED;;;CAGC,GACD,OAAO,SAASI,sBAAsB,CAACf,KAAsB,EAAEgB,WAAmB,EAAE;IAClF,IAAIhB,KAAK,CAACU,cAAc,KAAKR,SAAS,EAAE;QACtC,IAAK,IAAIe,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,WAAW,EAAEC,CAAC,EAAE,CAAE;YACpCjB,KAAK,CAACU,cAAc,CAAC;gBACnBC,IAAI,EAAE,UAAU;gBAChBO,WAAW,EAAED,CAAC;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/chart-actions.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 { ECharts as EChartsInstance } from 'echarts/core';\nimport { DatapointInfo } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n // TODO: remove startIndex and endIndex once LineChart is deprecated\n startIndex?: number;\n endIndex?: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance) {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance) {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance, totalSeries: number) {\n if (chart.dispatchAction !== undefined) {\n for (let i = 0; i < totalSeries; i++) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: i,\n });\n }\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance) {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n) {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n"],"names":["enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","totalSeries","i","seriesIndex","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","dataIndex","escapeConnect","notBlur"],"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;AAajC;;;CAGC,GACD,OAAO,SAASA,cAAc,CAACC,KAAsB,EAAE;IACrD,MAAMC,UAAU,GAAGD,KAAK,CAAC,QAAQ,CAAC,AAAC;IACnC,IAAIC,UAAU,KAA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AC3FlC,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,WAAW;YACjBO,WAAW,EAAES,mBAAmB;YAChCQ,OAAO,EAAE,IAAI;YACbD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEH,mGAAmG;QACnGlC,KAAK,CAACU,cAAc,CAAC;YACnBC,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY;AAC1B;;;GAGG;AACH,wBAAwB,CAAC,EAAE,MAAM,GAChC,iBAAiB,CAmNnB"}
1
+ {"version":3,"file":"theme-gen.d.ts","sourceRoot":"","sources":["../../src/utils/theme-gen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK3D,aAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY;AAC1B;;;GAGG;AACH,wBAAwB,CAAC,EAAE,MAAM,GAChC,iBAAiB,CA+OnB"}
@@ -16,9 +16,9 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
16
16
  * The id of the container that will have the chart tooltip appended to it.
17
17
  * By default, chart tooltip uses the body of the top-level document object.
18
18
  */ tooltipPortalContainerId) {
19
- var ref, ref1, ref2, ref3, ref4;
20
- var ref5;
21
- const primaryTextColor = (ref5 = (ref = muiTheme.palette.text) === null || ref === void 0 ? void 0 : ref.primary) !== null && ref5 !== void 0 ? ref5 : DEFAULT_TEXT_COLOR;
19
+ var ref, ref1, ref2, ref3, ref4, ref5, ref6;
20
+ var ref7;
21
+ const primaryTextColor = (ref7 = (ref = muiTheme.palette.text) === null || ref === void 0 ? void 0 : ref.primary) !== null && ref7 !== void 0 ? ref7 : DEFAULT_TEXT_COLOR;
22
22
  const muiConvertedTheme = {
23
23
  title: {
24
24
  show: false
@@ -70,7 +70,7 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
70
70
  lineStyle: {
71
71
  width: 0.5,
72
72
  color: muiTheme.palette.grey[300],
73
- opacity: 0.6
73
+ opacity: 0.4
74
74
  }
75
75
  },
76
76
  splitArea: {
@@ -107,7 +107,7 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
107
107
  lineStyle: {
108
108
  width: 0.5,
109
109
  color: muiTheme.palette.grey[300],
110
- opacity: 0.6
110
+ opacity: 0.4
111
111
  }
112
112
  },
113
113
  splitArea: {
@@ -156,7 +156,30 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
156
156
  borderColor: primaryTextColor
157
157
  }
158
158
  },
159
- tooltip: {},
159
+ tooltip: {
160
+ backgroundColor: (ref5 = muiTheme.palette.designSystem) === null || ref5 === void 0 ? void 0 : ref5.grey[800],
161
+ borderColor: (ref6 = muiTheme.palette.designSystem) === null || ref6 === void 0 ? void 0 : ref6.grey[800],
162
+ textStyle: {
163
+ color: '#fff',
164
+ fontSize: 11
165
+ }
166
+ },
167
+ axisPointer: {
168
+ lineStyle: {
169
+ color: muiTheme.palette.grey[500]
170
+ }
171
+ },
172
+ markLine: {
173
+ symbol: 'none',
174
+ symbolSize: 0,
175
+ itemStyle: {
176
+ color: muiTheme.palette.grey[500]
177
+ },
178
+ lineStyle: {
179
+ type: 'dashed',
180
+ width: 1
181
+ }
182
+ },
160
183
  line: {
161
184
  showSymbol: false,
162
185
  symbol: 'circle',
@@ -175,7 +198,12 @@ export function generateChartsTheme(muiTheme, echartsTheme, /**
175
198
  barMaxWidth: 150,
176
199
  itemStyle: {
177
200
  borderWidth: 0,
201
+ borderRadius: 0,
178
202
  borderColor: muiTheme.palette.grey[300]
203
+ },
204
+ label: {
205
+ show: false,
206
+ color: primaryTextColor
179
207
  }
180
208
  },
181
209
  gauge: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(\n muiTheme: MuiTheme,\n echartsTheme: EChartsTheme,\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string\n): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n // Accessible categorical palette from: https://davidmathlogic.com/colorblind\n color: [\n '#56B4E9', // lt blue\n '#009E73', // med green\n '#0072B2', // dk blue\n '#CC79A7', // lt purple\n '#F0E442', // yellow\n '#E69F00', // orange\n '#D55E00', // red\n ],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n timeAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {},\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return {\n tooltipPortalContainerId,\n echartsTheme: merge(muiConvertedTheme, echartsTheme),\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n };\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","echartsTheme","tooltipPortalContainerId","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","timeAxis","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","line","showSymbol","symbol","symbolSize","smooth","emphasis","bar","barMaxWidth","itemStyle","borderWidth","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF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D,IAAI,EAAE,SAAS;gBACfc,IAAI,EAAE,QAAQ;gBACdH,GAAG,EAAE,QAAQ;aACd;YACDiD,KAAK,EAAE;gBACLxD,IAAI,EAAE,KAAK;aACZ;YACDyD,KAAK,EAAE;gBACLzD,IAAI,EAAE,KAAK;aACZ;SACF;QACD0D,SAAS,EAAE;YACTrC,KAAK,EAAE,CAAC;YACRnB,KAAK,EAAE,SAAS;SACjB;QACDyD,SAAS,EAAE;YACTC,OAAO,EAAE;gBACPC,OAAO,EAAEC,QAAQ,CAACvE,QAAQ,CAACwE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;aAC7C;SACF;QACDC,UAAU,EAAE;YACVC,YAAY,EAAE1E,QAAQ,CAACI,OAAO,CAACuE,OAAO,CAACC,IAAI;YAC3CxE,OAAO,EAAE;gBAAC,SAAS;gBAAEJ,QAAQ,CAACI,OAAO,CAACyE,OAAO,CAACD,IAAI;gBAAE5E,QAAQ,CAACI,OAAO,CAAC0E,KAAK,CAACF,IAAI;aAAC;SACjF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/theme-gen.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 { Theme } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { EChartsTheme, PersesChartsTheme } from '../model';\n\nconst DEFAULT_TEXT_COLOR = '#222';\n\n// avoid component override type errors since only palette and typography are used\ntype MuiTheme = Omit<Theme, 'components'>;\n\nexport function generateChartsTheme(\n muiTheme: MuiTheme,\n echartsTheme: EChartsTheme,\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string\n): PersesChartsTheme {\n const primaryTextColor = muiTheme.palette.text?.primary ?? DEFAULT_TEXT_COLOR;\n\n const muiConvertedTheme: EChartsTheme = {\n title: {\n show: false,\n },\n textStyle: {\n color: primaryTextColor,\n fontFamily: muiTheme.typography.fontFamily,\n fontSize: 12,\n },\n grid: {\n top: 5,\n right: 20,\n bottom: 0,\n left: 20,\n containLabel: true,\n },\n // Accessible categorical palette from: https://davidmathlogic.com/colorblind\n color: [\n '#56B4E9', // lt blue\n '#009E73', // med green\n '#0072B2', // dk blue\n '#CC79A7', // lt purple\n '#F0E442', // yellow\n '#E69F00', // orange\n '#D55E00', // red\n ],\n categoryAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n timeAxis: {\n show: true,\n axisLabel: {\n show: true,\n color: primaryTextColor,\n margin: 15,\n },\n axisTick: {\n show: false,\n length: 6,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: muiTheme.palette.grey[600],\n },\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.4,\n },\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: [muiTheme.palette.grey[300]],\n },\n },\n },\n valueAxis: {\n show: true,\n axisLabel: {\n color: primaryTextColor,\n margin: 12,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: true,\n lineStyle: {\n width: 0.5,\n color: muiTheme.palette.grey[300],\n opacity: 0.6,\n },\n },\n },\n legend: {\n orient: 'horizontal',\n textStyle: {\n color: primaryTextColor,\n },\n pageTextStyle: {\n color: muiTheme.palette.grey[600],\n },\n pageIconColor: muiTheme?.palette?.action?.active,\n pageIconInactiveColor: muiTheme?.palette?.action?.disabled,\n },\n toolbox: {\n show: true,\n top: 10,\n right: 10,\n iconStyle: {\n borderColor: primaryTextColor,\n },\n },\n tooltip: {\n backgroundColor: muiTheme.palette.designSystem?.grey[800],\n borderColor: muiTheme.palette.designSystem?.grey[800],\n textStyle: {\n color: '#fff',\n fontSize: 11,\n },\n },\n axisPointer: {\n lineStyle: {\n color: muiTheme.palette.grey[500],\n },\n },\n markLine: {\n symbol: 'none',\n symbolSize: 0,\n itemStyle: {\n color: muiTheme.palette.grey[500],\n },\n lineStyle: {\n type: 'dashed',\n width: 1,\n },\n },\n line: {\n showSymbol: false,\n symbol: 'circle',\n symbolSize: 4,\n smooth: false,\n lineStyle: {\n width: 1,\n },\n emphasis: {\n lineStyle: {\n width: 1.5,\n },\n },\n },\n bar: {\n barMaxWidth: 150,\n itemStyle: {\n borderWidth: 0,\n borderRadius: 0,\n borderColor: muiTheme.palette.grey[300],\n },\n label: {\n show: false,\n color: primaryTextColor,\n },\n },\n gauge: {\n detail: {\n fontSize: 18,\n fontWeight: 600,\n valueAnimation: false,\n },\n splitLine: {\n distance: 0,\n length: 4,\n lineStyle: {\n width: 1,\n },\n },\n splitNumber: 12,\n },\n };\n\n return {\n tooltipPortalContainerId,\n echartsTheme: merge(muiConvertedTheme, echartsTheme),\n noDataOption: {\n title: {\n show: true,\n textStyle: {\n color: primaryTextColor,\n fontSize: 16,\n fontWeight: 400,\n },\n text: 'No data',\n left: 'center',\n top: 'center',\n },\n xAxis: {\n show: false,\n },\n yAxis: {\n show: false,\n },\n },\n sparkline: {\n width: 2,\n color: '#1976d2',\n },\n container: {\n padding: {\n default: parseInt(muiTheme.spacing(1.5), 10),\n },\n },\n thresholds: {\n defaultColor: muiTheme.palette.success.main,\n palette: ['#FFCC00', muiTheme.palette.warning.main, muiTheme.palette.error.main],\n },\n };\n}\n"],"names":["merge","DEFAULT_TEXT_COLOR","generateChartsTheme","muiTheme","echartsTheme","tooltipPortalContainerId","primaryTextColor","palette","text","primary","muiConvertedTheme","title","show","textStyle","color","fontFamily","typography","fontSize","grid","top","right","bottom","left","containLabel","categoryAxis","axisLabel","margin","axisTick","length","lineStyle","grey","axisLine","splitLine","width","opacity","splitArea","areaStyle","timeAxis","valueAxis","legend","orient","pageTextStyle","pageIconColor","action","active","pageIconInactiveColor","disabled","toolbox","iconStyle","borderColor","tooltip","backgroundColor","designSystem","axisPointer","markLine","symbol","symbolSize","itemStyle","type","line","showSymbol","smooth","emphasis","bar","barMaxWidth","borderWidth","borderRadius","label","gauge","detail","fontWeight","valueAnimation","distance","splitNumber","noDataOption","xAxis","yAxis","sparkline","container","padding","default","parseInt","spacing","thresholds","defaultColor","success","main","warning","error"],"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,OAAOA,KAAK,MAAM,cAAc,CAAC;AAGjC,MAAMC,kBAAkB,GAAG,MAAM,AAAC;AAKlC,OAAO,SAASC,mBAAmB,CACjCC,QAAkB,EAClBC,YAA0B,EAC1B;;;GAGC,GACDC,wBAAiC,EACd;QACMF,GAAqB,EA4H3BA,IAAiB,QACTA,IAAiB,QAWvBA,IAA6B,EACjCA,IAA6B;QAzIrBA,IAA8B;IAAvD,MAAMG,gBAAgB,GAAGH,CAAAA,IAA8B,GAA9BA,CAAAA,GAAqB,GAArBA,QAAQ,CAACI,OAAO,CAACC,IAAI,cAArBL,GAAqB,WAAS,GAA9BA,KAAAA,CAA8B,GAA9BA,GAAqB,CAAEM,OAAO,cAA9B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AQ,EAAE,CAAC;gBACX5C,MAAM,EAAE,CAAC;gBACTC,SAAS,EAAE;oBACTI,KAAK,EAAE,CAAC;iBACT;aACF;YACDwC,WAAW,EAAE,EAAE;SAChB;KACF,AAAC;IAEF,OAAO;QACLpE,wBAAwB;QACxBD,YAAY,EAAEJ,KAAK,CAACU,iBAAiB,EAAEN,YAAY,CAAC;QACpDsE,YAAY,EAAE;YACZ/D,KAAK,EAAE;gBACLC,IAAI,EAAE,IAAI;gBACVC,SAAS,EAAE;oBACTC,KAAK,EAAER,gBAAgB;oBACvBW,QAAQ,EAAE,EAAE;oBACZqD,UAAU,EAAE,GAAG;iBAChB;gBACD9D,IAAI,EAAE,SAAS;gBACfc,IAAI,EAAE,QAAQ;gBACdH,GAAG,EAAE,QAAQ;aACd;YACDwD,KAAK,EAAE;gBACL/D,IAAI,EAAE,KAAK;aACZ;YACDgE,KAAK,EAAE;gBACLhE,IAAI,EAAE,KAAK;aACZ;SACF;QACDiE,SAAS,EAAE;YACT5C,KAAK,EAAE,CAAC;YACRnB,KAAK,EAAE,SAAS;SACjB;QACDgE,SAAS,EAAE;YACTC,OAAO,EAAE;gBACPC,OAAO,EAAEC,QAAQ,CAAC9E,QAAQ,CAAC+E,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;aAC7C;SACF;QACDC,UAAU,EAAE;YACVC,YAAY,EAAEjF,QAAQ,CAACI,OAAO,CAAC8E,OAAO,CAACC,IAAI;YAC3C/E,OAAO,EAAE;gBAAC,SAAS;gBAAEJ,QAAQ,CAACI,OAAO,CAACgF,OAAO,CAACD,IAAI;gBAAEnF,QAAQ,CAACI,OAAO,CAACiF,KAAK,CAACF,IAAI;aAAC;SACjF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/components",
3
- "version": "0.37.2",
3
+ "version": "0.38.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.37.2",
39
+ "@perses-dev/core": "0.38.0",
40
40
  "@tanstack/react-table": "^8.9.1",
41
41
  "@uiw/react-codemirror": "^4.19.1",
42
42
  "date-fns": "^2.28.0",
@@ -50,7 +50,7 @@
50
50
  "react-virtuoso": "^4.3.6"
51
51
  },
52
52
  "devDependencies": {
53
- "@perses-dev/storybook": "0.37.2"
53
+ "@perses-dev/storybook": "0.38.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@mui/material": "^5.10.0",