@perses-dev/components 0.24.0 → 0.26.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 (60) hide show
  1. package/dist/Dialog/Dialog.d.ts +2 -1
  2. package/dist/Dialog/Dialog.d.ts.map +1 -1
  3. package/dist/Dialog/Dialog.js +12 -1
  4. package/dist/Dialog/Dialog.js.map +1 -1
  5. package/dist/{EChart.d.ts → EChart/EChart.d.ts} +1 -1
  6. package/dist/EChart/EChart.d.ts.map +1 -0
  7. package/dist/EChart/EChart.js.map +1 -0
  8. package/dist/EChart/index.d.ts +2 -0
  9. package/dist/EChart/index.d.ts.map +1 -0
  10. package/dist/EChart/index.js +15 -0
  11. package/dist/EChart/index.js.map +1 -0
  12. package/dist/GaugeChart/GaugeChart.d.ts +1 -2
  13. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  14. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  15. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  16. package/dist/InfoTooltip/InfoTooltip.js +7 -3
  17. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  18. package/dist/Legend/Legend.d.ts +1 -2
  19. package/dist/Legend/Legend.d.ts.map +1 -1
  20. package/dist/Legend/Legend.js.map +1 -1
  21. package/dist/LineChart/LineChart.d.ts +9 -2
  22. package/dist/LineChart/LineChart.d.ts.map +1 -1
  23. package/dist/LineChart/LineChart.js +12 -4
  24. package/dist/LineChart/LineChart.js.map +1 -1
  25. package/dist/StatChart/StatChart.d.ts +1 -2
  26. package/dist/StatChart/StatChart.d.ts.map +1 -1
  27. package/dist/StatChart/StatChart.js.map +1 -1
  28. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -0
  29. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  30. package/dist/TimeSeriesTooltip/SeriesInfo.js +5 -4
  31. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  32. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts +1 -0
  33. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -1
  34. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js +3 -2
  35. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -1
  36. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +1 -0
  37. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  38. package/dist/TimeSeriesTooltip/TooltipContent.js +2 -1
  39. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  40. package/dist/cjs/Dialog/Dialog.js +11 -0
  41. package/dist/cjs/EChart/index.js +28 -0
  42. package/dist/cjs/InfoTooltip/InfoTooltip.js +7 -3
  43. package/dist/cjs/LineChart/LineChart.js +12 -4
  44. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +5 -4
  45. package/dist/cjs/TimeSeriesTooltip/TimeSeriesTooltip.js +3 -2
  46. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +2 -1
  47. package/dist/cjs/theme/component-overrides/alert.js +102 -0
  48. package/dist/cjs/theme/theme.js +2 -11
  49. package/dist/theme/component-overrides/alert.d.ts +3 -0
  50. package/dist/theme/component-overrides/alert.d.ts.map +1 -0
  51. package/dist/theme/component-overrides/alert.js +96 -0
  52. package/dist/theme/component-overrides/alert.js.map +1 -0
  53. package/dist/theme/theme.d.ts.map +1 -1
  54. package/dist/theme/theme.js +3 -12
  55. package/dist/theme/theme.js.map +1 -1
  56. package/package.json +5 -2
  57. package/dist/EChart.d.ts.map +0 -1
  58. package/dist/EChart.js.map +0 -1
  59. /package/dist/{EChart.js → EChart/EChart.js} +0 -0
  60. /package/dist/cjs/{EChart.js → EChart/EChart.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"SeriesInfo.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"names":[],"mappings":";AAkBA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuEhD"}
1
+ {"version":3,"file":"SeriesInfo.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"names":[],"mappings":";AAkBA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAyEhD"}
@@ -16,7 +16,7 @@ import { SeriesMarker } from './SeriesMarker';
16
16
  import { SeriesLabelsStack } from './SeriesLabelsStack';
17
17
  import { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';
18
18
  export function SeriesInfo(props) {
19
- const { seriesName , formattedY , markerColor , totalSeries , wrapLabels } = props;
19
+ const { seriesName , formattedY , markerColor , totalSeries , wrapLabels =true , showQuery =true } = props;
20
20
  // metric __name__ comes before opening curly brace, ignore if not populated
21
21
  // ex with metric name: node_load15{env="demo",job="node"}
22
22
  // ex without metric name: {env="demo",job="node"}
@@ -36,8 +36,9 @@ export function SeriesInfo(props) {
36
36
  markerColor: markerColor
37
37
  });
38
38
  }
39
- // add space after commas when more than one focused series
40
- const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');
39
+ // when more than one series, either show full series name or formatted labels only
40
+ const seriesInfo = showQuery ? seriesName : formattedSeriesLabels;
41
+ const formattedSeriesInfo = seriesInfo.replace(/[,]/g, ', '); // add space after commas so wrapLabels works
41
42
  return /*#__PURE__*/ _jsxs(Box, {
42
43
  sx: {
43
44
  display: 'table-row',
@@ -68,7 +69,7 @@ export function SeriesInfo(props) {
68
69
  textOverflow: 'ellipsis',
69
70
  whiteSpace: wrapLabels ? 'normal' : 'nowrap'
70
71
  }),
71
- children: inlineSeriesLabels
72
+ children: formattedSeriesInfo
72
73
  })
73
74
  ]
74
75
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.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 { Box } from '@mui/material';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n wrapLabels?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps) {\n const { seriesName, formattedY, markerColor, totalSeries, wrapLabels } = props;\n\n // metric __name__ comes before opening curly brace, ignore if not populated\n // ex with metric name: node_load15{env=\"demo\",job=\"node\"}\n // ex without metric name: {env=\"demo\",job=\"node\"}\n const splitName = seriesName.split('{');\n const seriesLabels = splitName[1] ?? seriesName;\n\n // remove curly braces that wrap labels\n const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');\n\n // determine whether to show labels on separate lines\n const splitLabels = formattedSeriesLabels.split(',');\n if (totalSeries === 1 && splitLabels.length > 1) {\n const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';\n return (\n <SeriesLabelsStack\n formattedY={formattedY}\n metricName={metricName}\n metricLabels={splitLabels}\n markerColor={markerColor}\n />\n );\n }\n\n // add space after commas when more than one focused series\n const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');\n return (\n <Box\n sx={{\n display: 'table-row',\n paddingTop: 0.5,\n }}\n >\n <Box\n sx={{\n display: 'table-cell',\n maxWidth: '520px',\n }}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.5 }} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n display: 'inline-block',\n width: 'calc(100% - 20px)',\n minWidth: 150,\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n color: theme.palette.common.white,\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n >\n {inlineSeriesLabels}\n </Box>\n </Box>\n <Box\n sx={{\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: '700',\n }}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","wrapLabels","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","inlineSeriesLabels","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","textOverflow","whiteSpace","paddingLeft","textAlign","verticalAlign","fontWeight"],"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;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,YAAY,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AU,EAAE,GAAG;SAChB;;0BAED,MAACvB,GAAG;gBACFqB,EAAE,EAAE;oBACFC,OAAO,EAAE,YAAY;oBACrBE,QAAQ,EAAE,OAAO;iBAClB;;kCAED,KAACvB,YAAY;wBAACO,WAAW,EAAEA,WAAW;wBAAEa,EAAE,EAAE;4BAAEI,SAAS,EAAE,GAAG;yBAAE;sBAAI;kCAClE,KAACzB,GAAG;wBACF0B,SAAS,EAAC,MAAM;wBAChBL,EAAE,EAAE,CAACM,KAAK,GAAM,CAAA;gCACdL,OAAO,EAAE,cAAc;gCACvBM,KAAK,EAAE,mBAAmB;gCAC1BC,QAAQ,EAAE,GAAG;gCACbL,QAAQ,EAAErB,wBAAwB;gCAClC2B,QAAQ,EAAE,QAAQ;gCAClBC,KAAK,EAAEJ,KAAK,CAACK,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY,EAAE,UAAU;gCACxBC,UAAU,EAAE1B,UAAU,GAAG,QAAQ,GAAG,QAAQ;6BAC7C,CAAA,AAAC;kCAEDU,kBAAkB;sBACf;;cACF;0BACN,KAACpB,GAAG;gBACFqB,EAAE,EAAE;oBACFC,OAAO,EAAE,YAAY;oBACrBe,WAAW,EAAE,GAAG;oBAChBC,SAAS,EAAE,OAAO;oBAClBC,aAAa,EAAE,KAAK;oBACpBC,UAAU,EAAE,KAAK;iBAClB;0BAEAjC,UAAU;cACP;;MACF,CACN;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.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 { Box } from '@mui/material';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n wrapLabels?: boolean;\n showQuery?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps) {\n const { seriesName, formattedY, markerColor, totalSeries, wrapLabels = true, showQuery = true } = props;\n\n // metric __name__ comes before opening curly brace, ignore if not populated\n // ex with metric name: node_load15{env=\"demo\",job=\"node\"}\n // ex without metric name: {env=\"demo\",job=\"node\"}\n const splitName = seriesName.split('{');\n const seriesLabels = splitName[1] ?? seriesName;\n\n // remove curly braces that wrap labels\n const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');\n\n // determine whether to show labels on separate lines\n const splitLabels = formattedSeriesLabels.split(',');\n if (totalSeries === 1 && splitLabels.length > 1) {\n const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';\n return (\n <SeriesLabelsStack\n formattedY={formattedY}\n metricName={metricName}\n metricLabels={splitLabels}\n markerColor={markerColor}\n />\n );\n }\n\n // when more than one series, either show full series name or formatted labels only\n const seriesInfo = showQuery ? seriesName : formattedSeriesLabels;\n const formattedSeriesInfo = seriesInfo.replace(/[,]/g, ', '); // add space after commas so wrapLabels works\n\n return (\n <Box\n sx={{\n display: 'table-row',\n paddingTop: 0.5,\n }}\n >\n <Box\n sx={{\n display: 'table-cell',\n maxWidth: '520px',\n }}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.5 }} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n display: 'inline-block',\n width: 'calc(100% - 20px)',\n minWidth: 150,\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n color: theme.palette.common.white,\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n >\n {formattedSeriesInfo}\n </Box>\n </Box>\n <Box\n sx={{\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: '700',\n }}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","wrapLabels","showQuery","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","seriesInfo","formattedSeriesInfo","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","textOverflow","whiteSpace","paddingLeft","textAlign","verticalAlign","fontWeight"],"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;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAC9C,SAASC,iBAAiB,QAAQ,qBAAqB,CAAC;AACxD,SAASC,wBAAwB,QAAQ,iBAAiB,CAAC;AAY3D,OAAO,SAASC,UAAU,CAACC,KAAsB,EAAE;IACjD,MAAM,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAEC,WAAW,CAAA,EAAEC,UAAU,EAAG,IAAI,CAAA,EAAEC,SAAS,EAAG,IAAI,CAAA,EAAE,GAAGN,KAAK,AAAC;IAExG,4EAA4E;IAC5E,0DAA0D;IAC1D,kDAAkD;IAClD,MAAMO,SAAS,GAAGN,UAAU,CAACO,KAAK,CAAC,GAAG,CAAC,AAAC;QACnBD,GAAY;IAAjC,MAAME,YAAY,GAAGF,CAAAA,GAAY,GAAZA,SAAS,CAAC,CAAC,CAAC,cAAZA,GAAY,cAAZA,GAAY,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wBAAwB;gCAClC6B,QAAQ,EAAE,QAAQ;gCAClBC,KAAK,EAAEJ,KAAK,CAACK,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY,EAAE,UAAU;gCACxBC,UAAU,EAAE5B,UAAU,GAAG,QAAQ,GAAG,QAAQ;6BAC7C,CAAA,AAAC;kCAEDY,mBAAmB;sBAChB;;cACF;0BACN,KAACtB,GAAG;gBACFuB,EAAE,EAAE;oBACFC,OAAO,EAAE,YAAY;oBACrBe,WAAW,EAAE,GAAG;oBAChBC,SAAS,EAAE,OAAO;oBAClBC,aAAa,EAAE,KAAK;oBACpBC,UAAU,EAAE,KAAK;iBAClB;0BAEAnC,UAAU;cACP;;MACF,CACN;AACJ,CAAC"}
@@ -5,6 +5,7 @@ interface TimeSeriesTooltipProps {
5
5
  chartRef: React.MutableRefObject<EChartsInstance | undefined>;
6
6
  chartData: EChartsDataFormat;
7
7
  pinTooltip: boolean;
8
+ showQuery?: boolean;
8
9
  wrapLabels?: boolean;
9
10
  unit?: UnitOptions;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TimeSeriesTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,oDA2D5B,CAAC"}
1
+ {"version":3,"file":"TimeSeriesTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,oDA4D5B,CAAC"}
@@ -17,7 +17,7 @@ import { getFocusedSeriesData } from './focused-series';
17
17
  import { TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';
18
18
  import { TooltipContent } from './TooltipContent';
19
19
  import { assembleTransform } from './utils';
20
- export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , pinTooltip , unit }) {
20
+ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , showQuery , pinTooltip , unit }) {
21
21
  const [pinnedPos, setPinnedPos] = useState(null);
22
22
  const mousePos = useMousePosition();
23
23
  if (mousePos === null || mousePos.target === null) return null;
@@ -62,7 +62,8 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
62
62
  },
63
63
  children: /*#__PURE__*/ _jsx(TooltipContent, {
64
64
  focusedSeries: focusedSeries,
65
- wrapLabels: wrapLabels
65
+ wrapLabels: wrapLabels,
66
+ showQuery: showQuery
66
67
  })
67
68
  })
68
69
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.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 React, { useState } from 'react';\nimport { Box, Portal } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { getFocusedSeriesData } from './focused-series';\nimport { CursorCoordinates, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';\nimport { TooltipContent } from './TooltipContent';\nimport { assembleTransform } from './utils';\n\ninterface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n pinTooltip: boolean;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n}\n\nexport const TimeSeriesTooltip = React.memo(function TimeSeriesTooltip({\n chartRef,\n chartData,\n wrapLabels,\n pinTooltip,\n unit,\n}: TimeSeriesTooltipProps) {\n const [pinnedPos, setPinnedPos] = useState<CursorCoordinates | null>(null);\n const mousePos = useMousePosition();\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // ensure user is hovering over a chart before checking for nearby series\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const focusedSeries = getFocusedSeriesData(mousePos, chartData, pinnedPos, chart, unit);\n const chartWidth = chart?.getWidth() ?? 750;\n const chartHeight = chart?.getHeight() ?? 230;\n const cursorTransform = assembleTransform(mousePos, focusedSeries.length, chartWidth, chartHeight, pinnedPos);\n\n if (focusedSeries.length === 0) {\n return null;\n }\n\n if (pinTooltip === true && pinnedPos === null) {\n setPinnedPos(mousePos);\n }\n\n return (\n <Portal>\n <Box\n sx={(theme) => ({\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: '#2E313E', // TODO: use colors from theme, separate styles for dark mode\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n zIndex: theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <TooltipContent focusedSeries={focusedSeries} wrapLabels={wrapLabels} />\n </Box>\n </Portal>\n );\n});\n"],"names":["React","useState","Box","Portal","getFocusedSeriesData","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","useMousePosition","TooltipContent","assembleTransform","TimeSeriesTooltip","memo","chartRef","chartData","wrapLabels","pinTooltip","unit","pinnedPos","setPinnedPos","mousePos","target","tagName","chart","current","focusedSeries","chartWidth","getWidth","chartHeight","getHeight","cursorTransform","length","sx","theme","maxWidth","maxHeight","position","top","left","backgroundColor","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform"],"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;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO,CAAC;AACxC,SAASC,GAAG,EAAEC,MAAM,QAAQ,eAAe,CAAC;AAG5C,SAASC,oBAAoB,QAAQ,kBAAkB,CAAC;AACxD,SAA4BC,kBAAkB,EAAEC,iBAAiB,EAAEC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AAe,GAAGpB,iBAAiB,CAACU,QAAQ,EAAEK,aAAa,CAACM,MAAM,EAAEL,UAAU,EAAEE,WAAW,EAAEV,SAAS,CAAC,AAAC;IAE9G,IAAIO,aAAa,CAACM,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAIf,UAAU,KAAK,IAAI,IAAIE,SAAS,KAAK,IAAI,EAAE;QAC7CC,YAAY,CAACC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,qBACE,KAAChB,MAAM;kBACL,cAAA,KAACD,GAAG;YACF6B,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;oBACdC,QAAQ,EAAE3B,iBAAiB;oBAC3B4B,SAAS,EAAE7B,kBAAkB;oBAC7B8B,QAAQ,EAAE,UAAU;oBACpBC,GAAG,EAAE,CAAC;oBACNC,IAAI,EAAE,CAAC;oBACPC,eAAe,EAAE,SAAS;oBAC1BC,YAAY,EAAE,KAAK;oBACnBC,KAAK,EAAE,MAAM;oBACbC,QAAQ,EAAE,MAAM;oBAChBC,UAAU,EAAE,SAAS;oBACrBC,OAAO,EAAE,CAAC;oBACVC,UAAU,EAAE,mBAAmB;oBAC/BC,MAAM,EAAEb,KAAK,CAACa,MAAM,CAACC,OAAO;oBAC5BC,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE;wBACTC,SAAS,EAAE,MAAM;qBAClB;iBACF,CAAA,AAAC;YACFC,KAAK,EAAE;gBACLC,SAAS,EAAErB,eAAe;aAC3B;sBAED,cAAA,KAACrB,cAAc;gBAACgB,aAAa,EAAEA,aAAa;gBAAEV,UAAU,EAAEA,UAAU;cAAI;UACpE;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.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 React, { useState } from 'react';\nimport { Box, Portal } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { getFocusedSeriesData } from './focused-series';\nimport { CursorCoordinates, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';\nimport { TooltipContent } from './TooltipContent';\nimport { assembleTransform } from './utils';\n\ninterface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n pinTooltip: boolean;\n showQuery?: boolean;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n}\n\nexport const TimeSeriesTooltip = React.memo(function TimeSeriesTooltip({\n chartRef,\n chartData,\n wrapLabels,\n showQuery,\n pinTooltip,\n unit,\n}: TimeSeriesTooltipProps) {\n const [pinnedPos, setPinnedPos] = useState<CursorCoordinates | null>(null);\n const mousePos = useMousePosition();\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // ensure user is hovering over a chart before checking for nearby series\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const focusedSeries = getFocusedSeriesData(mousePos, chartData, pinnedPos, chart, unit);\n const chartWidth = chart?.getWidth() ?? 750;\n const chartHeight = chart?.getHeight() ?? 230;\n const cursorTransform = assembleTransform(mousePos, focusedSeries.length, chartWidth, chartHeight, pinnedPos);\n\n if (focusedSeries.length === 0) {\n return null;\n }\n\n if (pinTooltip === true && pinnedPos === null) {\n setPinnedPos(mousePos);\n }\n\n return (\n <Portal>\n <Box\n sx={(theme) => ({\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: '#2E313E', // TODO: use colors from theme, separate styles for dark mode\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n zIndex: theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <TooltipContent focusedSeries={focusedSeries} wrapLabels={wrapLabels} showQuery={showQuery} />\n </Box>\n </Portal>\n );\n});\n"],"names":["React","useState","Box","Portal","getFocusedSeriesData","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","useMousePosition","TooltipContent","assembleTransform","TimeSeriesTooltip","memo","chartRef","chartData","wrapLabels","showQuery","pinTooltip","unit","pinnedPos","setPinnedPos","mousePos","target","tagName","chart","current","focusedSeries","chartWidth","getWidth","chartHeight","getHeight","cursorTransform","length","sx","theme","maxWidth","maxHeight","position","top","left","backgroundColor","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform"],"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;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO,CAAC;AACxC,SAASC,GAAG,EAAEC,MAAM,QAAQ,eAAe,CAAC;AAG5C,SAASC,oBAAoB,QAAQ,kBAAkB,CAAC;AACxD,SAA4BC,kBAAkB,EAAEC,iBAAiB,EAAEC,gBAAgB,QAAQ,iBAAiB,CAAC;AAC7G,SAASC,cAAc,QAAQ,kBAAkB,CAAC;AAClD,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAW5C,OAAO,MAAMC,iBAAiB,iBAAGV,KAAK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M,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAIf,UAAU,KAAK,IAAI,IAAIE,SAAS,KAAK,IAAI,EAAE;QAC7CC,YAAY,CAACC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,qBACE,KAACjB,MAAM;kBACL,cAAA,KAACD,GAAG;YACF8B,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;oBACdC,QAAQ,EAAE5B,iBAAiB;oBAC3B6B,SAAS,EAAE9B,kBAAkB;oBAC7B+B,QAAQ,EAAE,UAAU;oBACpBC,GAAG,EAAE,CAAC;oBACNC,IAAI,EAAE,CAAC;oBACPC,eAAe,EAAE,SAAS;oBAC1BC,YAAY,EAAE,KAAK;oBACnBC,KAAK,EAAE,MAAM;oBACbC,QAAQ,EAAE,MAAM;oBAChBC,UAAU,EAAE,SAAS;oBACrBC,OAAO,EAAE,CAAC;oBACVC,UAAU,EAAE,mBAAmB;oBAC/BC,MAAM,EAAEb,KAAK,CAACa,MAAM,CAACC,OAAO;oBAC5BC,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE;wBACTC,SAAS,EAAE,MAAM;qBAClB;iBACF,CAAA,AAAC;YACFC,KAAK,EAAE;gBACLC,SAAS,EAAErB,eAAe;aAC3B;sBAED,cAAA,KAACtB,cAAc;gBAACiB,aAAa,EAAEA,aAAa;gBAAEX,UAAU,EAAEA,UAAU;gBAAEC,SAAS,EAAEA,SAAS;cAAI;UAC1F;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
@@ -2,6 +2,7 @@
2
2
  import { FocusedSeriesArray } from './focused-series';
3
3
  export interface TooltipContentProps {
4
4
  focusedSeries: FocusedSeriesArray | null;
5
+ showQuery?: boolean;
5
6
  wrapLabels?: boolean;
6
7
  }
7
8
  export declare function TooltipContent(props: TooltipContentProps): JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqExD"}
1
+ {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAsExD"}
@@ -16,7 +16,7 @@ import { Box, Divider, Stack, Typography } from '@mui/material';
16
16
  import { useTimeZone } from '../context/TimeZoneProvider';
17
17
  import { SeriesInfo } from './SeriesInfo';
18
18
  export function TooltipContent(props) {
19
- const { focusedSeries , wrapLabels } = props;
19
+ const { focusedSeries , showQuery , wrapLabels } = props;
20
20
  const { formatWithUserTimeZone } = useTimeZone();
21
21
  const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;
22
22
  const formatTimeSeriesHeader = (timeString)=>{
@@ -75,6 +75,7 @@ export function TooltipContent(props) {
75
75
  formattedY: formattedY,
76
76
  markerColor: markerColor,
77
77
  totalSeries: sortedFocusedSeries.length,
78
+ showQuery: showQuery,
78
79
  wrapLabels: wrapLabels
79
80
  }, key);
80
81
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.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 { useMemo } from 'react';\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { FocusedSeriesArray } from './focused-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n focusedSeries: FocusedSeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const { focusedSeries, wrapLabels } = props;\n const { formatWithUserTimeZone } = useTimeZone();\n\n const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;\n\n const formatTimeSeriesHeader = (timeString: string) => {\n const date = new Date(timeString);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n\n return (\n <>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </>\n );\n };\n\n const sortedFocusedSeries = useMemo(() => {\n if (focusedSeries === null) return null;\n return focusedSeries.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [focusedSeries]);\n\n if (sortedFocusedSeries !== null && seriesTime !== null) {\n return (\n <Stack py={1} px={1.5} spacing={0.5}>\n <Typography variant=\"caption\">{formatTimeSeriesHeader(seriesTime)}</Typography>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={{\n display: 'table',\n }}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n />\n );\n })}\n </Box>\n </Stack>\n );\n } else {\n return <></>;\n }\n}\n"],"names":["useMemo","Box","Divider","Stack","Typography","useTimeZone","SeriesInfo","TooltipContent","props","focusedSeries","wrapLabels","formatWithUserTimeZone","seriesTime","date","formatTimeSeriesHeader","timeString","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","sortedFocusedSeries","sort","a","b","y","py","px","spacing","borderColor","grey","display","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","key","toString","totalSeries","length"],"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;AAAA,SAASA,OAAO,QAAQ,OAAO,CAAC;AAChC,SAASC,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,WAAW,QAAQ,6BAA6B,CAAC;AAE1D,SAASC,UAAU,QAAQ,cAAc,CAAC;AAO1C,OAAO,SAASC,cAAc,CAACC,KAA0B,EAAE;IACzD,MAAM,EAAEC,aAAa,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGF,KAAK,AAAC;IAC5C,MAAM,EAAEG,sBAAsB,CAAA,EAAE,GAAGN,WAAW,EAAE,AAAC;IAEjD,MAAMO,UAAU,GAAGH,aAAa,IAAIA,aAAa,CAAC,CAAC,CAAC,IAAIA,aAAa,CAAC,CAAC,CAAC,CAACI,IAAI,GAAGJ,aAAa,CAAC,CAAC,CAAC,CAACI,IAAI,GAAG,IAA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;4BACdc,WAAW,EAAEd,KAAK,CAACE,OAAO,CAACa,IAAI,CAAC,KAAK,CAAC;yBACvC,CAAA,AAAC;kBACF;8BACF,KAACnC,GAAG;oBACFmB,EAAE,EAAE;wBACFiB,OAAO,EAAE,OAAO;qBACjB;8BAEAV,mBAAmB,CAACW,GAAG,CAAC,CAAC,EAAEC,QAAQ,CAAA,EAAEC,SAAS,CAAA,EAAEC,UAAU,CAAA,EAAEV,CAAC,CAAA,EAAEW,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAE,GAAK;wBAC5F,IAAIJ,QAAQ,KAAK,IAAI,IAAIC,SAAS,KAAK,IAAI,EAAE,OAAO,IAAI,CAAC;wBACzD,MAAMI,GAAG,GAAGJ,SAAS,CAACK,QAAQ,EAAE,GAAGN,QAAQ,CAACM,QAAQ,EAAE,AAAC;wBAEvD,qBACE,KAACvC,UAAU;4BAETmC,UAAU,EAAEA,UAAU;4BACtBV,CAAC,EAAEA,CAAC;4BACJW,UAAU,EAAEA,UAAU;4BACtBC,WAAW,EAAEA,WAAW;4BACxBG,WAAW,EAAEnB,mBAAmB,CAACoB,MAAM;4BACvCrC,UAAU,EAAEA,UAAU;2BANjBkC,GAAG,CAOR,CACF;oBACJ,CAAC,CAAC;kBACE;;UACA,CACR;IACJ,OAAO;QACL,qBAAO,mBAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.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 { useMemo } from 'react';\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { FocusedSeriesArray } from './focused-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n focusedSeries: FocusedSeriesArray | null;\n showQuery?: boolean;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const { focusedSeries, showQuery, wrapLabels } = props;\n const { formatWithUserTimeZone } = useTimeZone();\n\n const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;\n\n const formatTimeSeriesHeader = (timeString: string) => {\n const date = new Date(timeString);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n\n return (\n <>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </>\n );\n };\n\n const sortedFocusedSeries = useMemo(() => {\n if (focusedSeries === null) return null;\n return focusedSeries.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [focusedSeries]);\n\n if (sortedFocusedSeries !== null && seriesTime !== null) {\n return (\n <Stack py={1} px={1.5} spacing={0.5}>\n <Typography variant=\"caption\">{formatTimeSeriesHeader(seriesTime)}</Typography>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={{\n display: 'table',\n }}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n showQuery={showQuery}\n wrapLabels={wrapLabels}\n />\n );\n })}\n </Box>\n </Stack>\n );\n } else {\n return <></>;\n }\n}\n"],"names":["useMemo","Box","Divider","Stack","Typography","useTimeZone","SeriesInfo","TooltipContent","props","focusedSeries","showQuery","wrapLabels","formatWithUserTimeZone","seriesTime","date","formatTimeSeriesHeader","timeString","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","sortedFocusedSeries","sort","a","b","y","py","px","spacing","borderColor","grey","display","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","key","toString","totalSeries","length"],"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;AAAA,SAASA,OAAO,QAAQ,OAAO,CAAC;AAChC,SAASC,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,WAAW,QAAQ,6BAA6B,CAAC;AAE1D,SAASC,UAAU,QAAQ,cAAc,CAAC;AAQ1C,OAAO,SAASC,cAAc,CAACC,KAA0B,EAAE;IACzD,MAAM,EAAEC,aAAa,CAAA,EAAEC,SAAS,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGH,KAAK,AAAC;IACvD,MAAM,EAAEI,sBAAsB,CAAA,EAAE,GAAGP,WAAW,EAAE,AAAC;IAEjD,MAAMQ,UAAU,GAAGJ,aAAa,IAAIA,aAAa,CAAC,CAAC,CAAC,IAAIA,aAAa,CAAC,CAAC,CAAC,CAACK,IAAI,GAAGL,aAAa,CAAC,CAAC,CAAC,CAACK,IAAI,GAAG,IAAI,AAAC;IAE7G,MAAMC,sBAAsB,GAAG,CAACC,UAAkB,GAAK;QACrD,MAAMF,IAAI,GAAG,IAAIG,IAAI,CAACD,UAAU,CAAC,AAAC;QAClC,MAAME,aAAa,GAAGN,sBAAsB,CAACE,IAAI,EAAE,iBAAiB,CAAC,AAAC;QACtE,MAAMK,aAAa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C,EAAEC,QAAQ,CAAA,EAAEC,SAAS,CAAA,EAAEC,UAAU,CAAA,EAAEV,CAAC,CAAA,EAAEW,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAE,GAAK;wBAC5F,IAAIJ,QAAQ,KAAK,IAAI,IAAIC,SAAS,KAAK,IAAI,EAAE,OAAO,IAAI,CAAC;wBACzD,MAAMI,GAAG,GAAGJ,SAAS,CAACK,QAAQ,EAAE,GAAGN,QAAQ,CAACM,QAAQ,EAAE,AAAC;wBAEvD,qBACE,KAACxC,UAAU;4BAEToC,UAAU,EAAEA,UAAU;4BACtBV,CAAC,EAAEA,CAAC;4BACJW,UAAU,EAAEA,UAAU;4BACtBC,WAAW,EAAEA,WAAW;4BACxBG,WAAW,EAAEnB,mBAAmB,CAACoB,MAAM;4BACvCtC,SAAS,EAAEA,SAAS;4BACpBC,UAAU,EAAEA,UAAU;2BAPjBkC,GAAG,CAQR,CACF;oBACJ,CAAC,CAAC;kBACE;;UACA,CACR;IACJ,OAAO;QACL,qBAAO,mBAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -64,6 +64,16 @@ const SecondaryButton = ({ children , ...props })=>/*#__PURE__*/ (0, _jsxRuntime
64
64
  ...props,
65
65
  children: children
66
66
  });
67
+ /*
68
+ * Material-ui has a prop "scroll=paper" that is specifically for dialog header and actions to be sticky and body to scroll,
69
+ * but that doesn't work when dialog content is wrapped in form.
70
+ * https://github.com/mui-org/material-ui/issues/13253
71
+ * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog
72
+ */ const Form = (0, _material.styled)('form')({
73
+ overflowY: 'auto',
74
+ display: 'flex',
75
+ flexDirection: 'column'
76
+ });
67
77
  /**
68
78
  * Render the CSS of the dialog's close button, according to the given material theme.
69
79
  * @param theme material theme
@@ -79,6 +89,7 @@ const Dialog = ({ children , ...props })=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ma
79
89
  children: children
80
90
  });
81
91
  Dialog.Header = Header;
92
+ Dialog.Form = Form;
82
93
  Dialog.Content = Content;
83
94
  Dialog.PrimaryButton = PrimaryButton;
84
95
  Dialog.SecondaryButton = SecondaryButton;
@@ -0,0 +1,28 @@
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
+ _exportStar(require("./EChart"), exports);
18
+ function _exportStar(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
21
+ enumerable: true,
22
+ get: function() {
23
+ return from[k];
24
+ }
25
+ });
26
+ });
27
+ return from;
28
+ }
@@ -27,6 +27,12 @@ function _interopRequireDefault(obj) {
27
27
  };
28
28
  }
29
29
  const InfoTooltip = ({ id , title , description , placement , children , enterDelay , enterNextDelay })=>{
30
+ // Only wrap in a div if passed a non-element. This enables the tooltip to
31
+ // support text with a wrapper div while avoiding breaking css on element
32
+ // children by unnecessarily wrapping them.
33
+ const formattedChildren = /*#__PURE__*/ _react.default.isValidElement(children) ? children : /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
34
+ children: children
35
+ });
30
36
  return /*#__PURE__*/ (0, _jsxRuntime.jsx)(StyledTooltip, {
31
37
  arrow: true,
32
38
  id: id,
@@ -37,9 +43,7 @@ const InfoTooltip = ({ id , title , description , placement , children , enterDe
37
43
  }),
38
44
  enterDelay: enterDelay !== null && enterDelay !== void 0 ? enterDelay : 500,
39
45
  enterNextDelay: enterNextDelay !== null && enterNextDelay !== void 0 ? enterNextDelay : 500,
40
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
41
- children: children
42
- })
46
+ children: formattedChildren
43
47
  });
44
48
  };
45
49
  const TooltipContent = ({ title , description })=>{
@@ -83,7 +83,10 @@ function _interopRequireWildcard(obj, nodeInterop) {
83
83
  _components.LegendComponent,
84
84
  _renderers.CanvasRenderer
85
85
  ]);
86
- function LineChart({ height , data , yAxis , unit , grid , legend , onDataZoom , onDoubleClick }) {
86
+ function LineChart({ height , data , yAxis , unit , grid , legend , tooltipConfig ={
87
+ wrapLabels: true,
88
+ showQuery: true
89
+ } , onDataZoom , onDoubleClick , __experimentalEChartsOptionsOverride }) {
87
90
  const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
88
91
  const chartRef = (0, _react.useRef)();
89
92
  const [showTooltip, setShowTooltip] = (0, _react.useState)(true);
@@ -177,6 +180,9 @@ function LineChart({ height , data , yAxis , unit , grid , legend , onDataZoom ,
177
180
  grid,
178
181
  legend
179
182
  };
183
+ if (__experimentalEChartsOptionsOverride) {
184
+ return __experimentalEChartsOptionsOverride(option);
185
+ }
180
186
  return option;
181
187
  }, [
182
188
  data,
@@ -185,7 +191,8 @@ function LineChart({ height , data , yAxis , unit , grid , legend , onDataZoom ,
185
191
  grid,
186
192
  legend,
187
193
  noDataOption,
188
- timeZone
194
+ timeZone,
195
+ __experimentalEChartsOptionsOverride
189
196
  ]);
190
197
  return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
191
198
  sx: {
@@ -215,10 +222,11 @@ function LineChart({ height , data , yAxis , unit , grid , legend , onDataZoom ,
215
222
  },
216
223
  onDoubleClick: handleOnDoubleClick,
217
224
  children: [
218
- showTooltip === true && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeSeriesTooltip.TimeSeriesTooltip, {
225
+ showTooltip === true && option.tooltip.showContent === false && tooltipConfig.hidden !== true && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeSeriesTooltip.TimeSeriesTooltip, {
219
226
  chartRef: chartRef,
220
227
  chartData: data,
221
- wrapLabels: true,
228
+ showQuery: tooltipConfig.showQuery,
229
+ wrapLabels: tooltipConfig.wrapLabels,
222
230
  pinTooltip: pinTooltip,
223
231
  unit: unit
224
232
  }),
@@ -24,7 +24,7 @@ const _seriesMarker = require("./SeriesMarker");
24
24
  const _seriesLabelsStack = require("./SeriesLabelsStack");
25
25
  const _tooltipModel = require("./tooltip-model");
26
26
  function SeriesInfo(props) {
27
- const { seriesName , formattedY , markerColor , totalSeries , wrapLabels } = props;
27
+ const { seriesName , formattedY , markerColor , totalSeries , wrapLabels =true , showQuery =true } = props;
28
28
  // metric __name__ comes before opening curly brace, ignore if not populated
29
29
  // ex with metric name: node_load15{env="demo",job="node"}
30
30
  // ex without metric name: {env="demo",job="node"}
@@ -44,8 +44,9 @@ function SeriesInfo(props) {
44
44
  markerColor: markerColor
45
45
  });
46
46
  }
47
- // add space after commas when more than one focused series
48
- const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');
47
+ // when more than one series, either show full series name or formatted labels only
48
+ const seriesInfo = showQuery ? seriesName : formattedSeriesLabels;
49
+ const formattedSeriesInfo = seriesInfo.replace(/[,]/g, ', '); // add space after commas so wrapLabels works
49
50
  return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
50
51
  sx: {
51
52
  display: 'table-row',
@@ -76,7 +77,7 @@ function SeriesInfo(props) {
76
77
  textOverflow: 'ellipsis',
77
78
  whiteSpace: wrapLabels ? 'normal' : 'nowrap'
78
79
  }),
79
- children: inlineSeriesLabels
80
+ children: formattedSeriesInfo
80
81
  })
81
82
  ]
82
83
  }),
@@ -64,7 +64,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
64
64
  }
65
65
  return newObj;
66
66
  }
67
- const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , pinTooltip , unit }) {
67
+ const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , showQuery , pinTooltip , unit }) {
68
68
  const [pinnedPos, setPinnedPos] = (0, _react.useState)(null);
69
69
  const mousePos = (0, _tooltipModel.useMousePosition)();
70
70
  if (mousePos === null || mousePos.target === null) return null;
@@ -109,7 +109,8 @@ const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesT
109
109
  },
110
110
  children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_tooltipContent.TooltipContent, {
111
111
  focusedSeries: focusedSeries,
112
- wrapLabels: wrapLabels
112
+ wrapLabels: wrapLabels,
113
+ showQuery: showQuery
113
114
  })
114
115
  })
115
116
  });
@@ -24,7 +24,7 @@ const _material = require("@mui/material");
24
24
  const _timeZoneProvider = require("../context/TimeZoneProvider");
25
25
  const _seriesInfo = require("./SeriesInfo");
26
26
  function TooltipContent(props) {
27
- const { focusedSeries , wrapLabels } = props;
27
+ const { focusedSeries , showQuery , wrapLabels } = props;
28
28
  const { formatWithUserTimeZone } = (0, _timeZoneProvider.useTimeZone)();
29
29
  const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;
30
30
  const formatTimeSeriesHeader = (timeString)=>{
@@ -83,6 +83,7 @@ function TooltipContent(props) {
83
83
  formattedY: formattedY,
84
84
  markerColor: markerColor,
85
85
  totalSeries: sortedFocusedSeries.length,
86
+ showQuery: showQuery,
86
87
  wrapLabels: wrapLabels
87
88
  }, key);
88
89
  })
@@ -0,0 +1,102 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "MuiAlert", {
18
+ enumerable: true,
19
+ get: ()=>MuiAlert
20
+ });
21
+ const _material = require("@mui/material");
22
+ const MuiAlert = {
23
+ defaultProps: {
24
+ variant: 'standard',
25
+ severity: 'success'
26
+ },
27
+ styleOverrides: {
28
+ standardError: ({ theme })=>{
29
+ return theme.palette.mode === 'dark' ? {
30
+ ...theme.typography.body1,
31
+ backgroundColor: theme.palette.error.dark,
32
+ color: theme.palette.error.light,
33
+ [`& .${_material.alertClasses.icon}`]: {
34
+ color: theme.palette.error.main
35
+ }
36
+ } : {
37
+ ...theme.typography.body1,
38
+ backgroundColor: theme.palette.error.light,
39
+ color: theme.palette.error.dark,
40
+ [`& .${_material.alertClasses.icon}`]: {
41
+ color: theme.palette.error.main
42
+ }
43
+ };
44
+ },
45
+ standardInfo: ({ theme })=>{
46
+ return theme.palette.mode === 'dark' ? {
47
+ ...theme.typography.body1,
48
+ backgroundColor: theme.palette.info.dark,
49
+ color: theme.palette.info.light,
50
+ [`& .${_material.alertClasses.icon}`]: {
51
+ color: theme.palette.info.main
52
+ }
53
+ } : {
54
+ ...theme.typography.body1,
55
+ backgroundColor: theme.palette.info.light,
56
+ color: theme.palette.info.dark,
57
+ [`& .${_material.alertClasses.icon}`]: {
58
+ color: theme.palette.info.main
59
+ }
60
+ };
61
+ },
62
+ standardSuccess: ({ theme })=>{
63
+ return theme.palette.mode === 'dark' ? {
64
+ ...theme.typography.body1,
65
+ backgroundColor: theme.palette.success.dark,
66
+ color: theme.palette.success.light,
67
+ [`& .${_material.alertClasses.icon}`]: {
68
+ color: theme.palette.success.main
69
+ }
70
+ } : {
71
+ ...theme.typography.body1,
72
+ backgroundColor: theme.palette.success.light,
73
+ color: theme.palette.success.dark,
74
+ [`& .${_material.alertClasses.icon}`]: {
75
+ color: theme.palette.success.main
76
+ }
77
+ };
78
+ },
79
+ standardWarning: ({ theme })=>{
80
+ return theme.palette.mode === 'dark' ? {
81
+ ...theme.typography.body1,
82
+ backgroundColor: theme.palette.warning.dark,
83
+ color: theme.palette.warning.light,
84
+ [`& .${_material.alertClasses.icon}`]: {
85
+ color: theme.palette.warning.main
86
+ }
87
+ } : {
88
+ ...theme.typography.body1,
89
+ backgroundColor: theme.palette.warning.light,
90
+ color: theme.palette.warning.dark,
91
+ [`& .${_material.alertClasses.icon}`]: {
92
+ color: theme.palette.warning.main
93
+ }
94
+ };
95
+ },
96
+ root: {
97
+ ['& .' + _material.linkClasses.root]: {
98
+ textDecoration: 'underline'
99
+ }
100
+ }
101
+ }
102
+ };
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "getTheme", {
19
19
  get: ()=>getTheme
20
20
  });
21
21
  const _material = require("@mui/material");
22
+ const _alert = require("./component-overrides/alert");
22
23
  const _paletteOptions = require("./palette/palette-options");
23
24
  const _typography = require("./typography");
24
25
  const getModalBackgroundStyle = ({ theme })=>{
@@ -41,6 +42,7 @@ function getTheme(mode) {
41
42
  }
42
43
  // Overrides for component default prop values and styles go here
43
44
  const components = {
45
+ MuiAlert: _alert.MuiAlert,
44
46
  MuiFormControl: {
45
47
  defaultProps: {
46
48
  size: 'small'
@@ -65,16 +67,5 @@ const components = {
65
67
  styleOverrides: {
66
68
  paper: getModalBackgroundStyle
67
69
  }
68
- },
69
- MuiAlert: {
70
- styleOverrides: {
71
- standardError: ({ theme })=>({
72
- backgroundColor: theme.palette.designSystem.red[500],
73
- color: theme.palette.common.white,
74
- [`& .${_material.alertClasses.icon}`]: {
75
- color: theme.palette.common.white
76
- }
77
- })
78
- }
79
70
  }
80
71
  };
@@ -0,0 +1,3 @@
1
+ import { Components, Theme } from '@mui/material';
2
+ export declare const MuiAlert: Components<Theme>['MuiAlert'];
3
+ //# sourceMappingURL=alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/theme/component-overrides/alert.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,KAAK,EAA6B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,CAwFlD,CAAC"}