@perses-dev/components 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +2 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +88 -51
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +4 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/DateTimeRangePicker/index.js +1 -1
- package/dist/DateTimeRangePicker/index.js.map +1 -1
- package/dist/DateTimeRangePicker/utils.js +1 -1
- package/dist/DateTimeRangePicker/utils.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +24 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -0
- package/dist/Dialog/Dialog.js +74 -0
- package/dist/Dialog/Dialog.js.map +1 -0
- package/dist/Dialog/index.d.ts +2 -0
- package/dist/Dialog/index.d.ts.map +1 -0
- package/dist/{Tooltip → Dialog}/index.js +2 -3
- package/dist/{Tooltip → Dialog}/index.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/Drawer/index.js.map +1 -1
- package/dist/EChart.js +1 -1
- package/dist/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +5 -10
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/GaugeChart/index.js +1 -1
- package/dist/GaugeChart/index.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.d.ts +1 -6
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +2 -9
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.test.js +1 -1
- package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -1
- package/dist/InfoTooltip/index.js +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.d.ts +5 -4
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +21 -16
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +18 -6
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +1 -1
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/index.js +1 -1
- package/dist/Legend/index.js.map +1 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +1 -1
- package/dist/LegendOptionsEditor/index.js +1 -1
- package/dist/LegendOptionsEditor/index.js.map +1 -1
- package/dist/LineChart/LineChart.js +3 -3
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.js +1 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/LineChart/utils.js +1 -1
- package/dist/LineChart/utils.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js +1 -1
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +21 -12
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/StatChart.test.js +1 -1
- package/dist/StatChart/StatChart.test.js.map +1 -1
- package/dist/StatChart/index.js +1 -1
- package/dist/StatChart/index.js.map +1 -1
- package/dist/{Tooltip → TimeSeriesTooltip}/SeriesInfo.d.ts +1 -2
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.js +89 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +2 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.test.js +52 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +9 -0
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +99 -0
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.d.ts +2 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
- package/dist/{Tooltip/Tooltip.d.ts → TimeSeriesTooltip/TimeSeriesTooltip.d.ts} +4 -4
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -0
- package/dist/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +3 -4
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.d.ts +1 -2
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +2 -0
- package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipContent.test.js +78 -0
- package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
- package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
- package/dist/TimeSeriesTooltip/focused-series.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.d.ts +0 -0
- package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
- package/dist/TimeSeriesTooltip/focused-series.test.js.map +1 -0
- package/dist/TimeSeriesTooltip/index.d.ts +9 -0
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/index.js +22 -0
- package/dist/TimeSeriesTooltip/index.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
- package/dist/TimeSeriesTooltip/utils.js.map +1 -0
- package/dist/UnitSelector/UnitSelector.js +1 -1
- package/dist/UnitSelector/UnitSelector.js.map +1 -1
- package/dist/UnitSelector/UnitSelector.test.js +1 -1
- package/dist/UnitSelector/UnitSelector.test.js.map +1 -1
- package/dist/UnitSelector/index.js +1 -1
- package/dist/UnitSelector/index.js.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +87 -50
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +4 -1
- package/dist/cjs/DateTimeRangePicker/index.js +1 -1
- package/dist/cjs/DateTimeRangePicker/utils.js +1 -1
- package/dist/cjs/Dialog/Dialog.js +85 -0
- package/dist/cjs/{Tooltip → Dialog}/index.js +2 -3
- package/dist/cjs/Drawer/Drawer.js +1 -1
- package/dist/cjs/Drawer/index.js +1 -1
- package/dist/cjs/EChart.js +1 -1
- package/dist/cjs/ErrorAlert.js +1 -1
- package/dist/cjs/ErrorBoundary.js +1 -1
- package/dist/cjs/GaugeChart/GaugeChart.js +5 -10
- package/dist/cjs/GaugeChart/index.js +1 -1
- package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
- package/dist/cjs/InfoTooltip/InfoTooltip.test.js +1 -1
- package/dist/cjs/InfoTooltip/index.js +1 -1
- package/dist/cjs/JSONEditor.js +25 -15
- package/dist/cjs/Legend/CompactLegend.js +1 -1
- package/dist/cjs/Legend/Legend.js +17 -5
- package/dist/cjs/Legend/LegendColorBadge.js +1 -1
- package/dist/cjs/Legend/ListLegend.js +1 -1
- package/dist/cjs/Legend/ListLegendItem.js +1 -1
- package/dist/cjs/Legend/index.js +1 -1
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
- package/dist/cjs/LegendOptionsEditor/index.js +1 -1
- package/dist/cjs/LineChart/LineChart.js +3 -3
- package/dist/cjs/LineChart/index.js +1 -1
- package/dist/cjs/LineChart/utils.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/cjs/OptionsEditorLayout/index.js +1 -1
- package/dist/cjs/StatChart/StatChart.js +21 -12
- package/dist/cjs/StatChart/StatChart.test.js +1 -1
- package/dist/cjs/StatChart/index.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -0
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +54 -0
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +105 -0
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
- package/dist/cjs/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +4 -4
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +80 -0
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/index.js +35 -0
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
- package/dist/cjs/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
- package/dist/cjs/UnitSelector/UnitSelector.js +1 -1
- package/dist/cjs/UnitSelector/UnitSelector.test.js +1 -1
- package/dist/cjs/UnitSelector/index.js +1 -1
- package/dist/cjs/YAxisLabel.js +1 -1
- package/dist/cjs/context/ChartsThemeProvider.js +1 -1
- package/dist/cjs/context/TimeZoneProvider.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/model/graph.js +4 -15
- package/dist/cjs/model/index.js +2 -1
- package/dist/cjs/model/legend.js +67 -0
- package/dist/cjs/model/legend.test.js +29 -0
- package/dist/cjs/model/theme.js +1 -1
- package/dist/cjs/model/units/bytes.js +1 -1
- package/dist/cjs/model/units/constants.js +1 -1
- package/dist/cjs/model/units/decimal.js +5 -2
- package/dist/cjs/model/units/index.js +1 -1
- package/dist/cjs/model/units/percent.js +1 -1
- package/dist/cjs/model/units/time.js +1 -1
- package/dist/cjs/model/units/types.js +1 -1
- package/dist/cjs/model/units/units.js +1 -1
- package/dist/cjs/model/units/units.test.js +59 -6
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test-utils/index.js +1 -1
- package/dist/cjs/test-utils/theme.js +6 -1
- package/dist/cjs/theme/index.js +1 -1
- package/dist/cjs/theme/palette/background.js +1 -1
- package/dist/cjs/theme/palette/colors/blue.js +1 -1
- package/dist/cjs/theme/palette/colors/common.js +1 -1
- package/dist/cjs/theme/palette/colors/green.js +1 -1
- package/dist/cjs/theme/palette/colors/grey.js +1 -1
- package/dist/cjs/theme/palette/colors/index.js +1 -1
- package/dist/cjs/theme/palette/colors/orange.js +1 -1
- package/dist/cjs/theme/palette/colors/purple.js +1 -1
- package/dist/cjs/theme/palette/colors/red.js +1 -1
- package/dist/cjs/theme/palette/colors/types.js +1 -1
- package/dist/cjs/theme/palette/error.js +1 -1
- package/dist/cjs/theme/palette/grey.js +1 -1
- package/dist/cjs/theme/palette/index.js +1 -1
- package/dist/cjs/theme/palette/palette-options.js +1 -1
- package/dist/cjs/theme/palette/primary.js +1 -1
- package/dist/cjs/theme/palette/secondary.js +1 -1
- package/dist/cjs/theme/palette/success.js +1 -1
- package/dist/cjs/theme/palette/text.js +1 -1
- package/dist/cjs/theme/palette/warning.js +1 -1
- package/dist/cjs/theme/theme.js +12 -1
- package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
- package/dist/cjs/theme/typography.js +1 -1
- package/dist/cjs/utils/combine-sx.js +1 -1
- package/dist/cjs/utils/component-ids.js +1 -1
- package/dist/cjs/utils/format.js +1 -1
- package/dist/cjs/utils/format.test.js +1 -1
- package/dist/cjs/utils/index.js +1 -1
- package/dist/cjs/utils/mathjs.js +1 -1
- package/dist/cjs/utils/theme-gen.js +6 -1
- package/dist/cjs/utils/theme-gen.test.js +6 -1
- package/dist/context/ChartsThemeProvider.js +1 -1
- package/dist/context/ChartsThemeProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +1 -16
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js +1 -5
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +2 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +22 -0
- package/dist/model/legend.d.ts.map +1 -0
- package/dist/model/legend.js +51 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/legend.test.d.ts +2 -0
- package/dist/model/legend.test.d.ts.map +1 -0
- package/dist/model/legend.test.js +27 -0
- package/dist/model/legend.test.js.map +1 -0
- package/dist/model/theme.d.ts +11 -0
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/units/bytes.js +1 -1
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/constants.js +1 -1
- package/dist/model/units/constants.js.map +1 -1
- package/dist/model/units/decimal.d.ts.map +1 -1
- package/dist/model/units/decimal.js +5 -2
- package/dist/model/units/decimal.js.map +1 -1
- package/dist/model/units/index.js +1 -1
- package/dist/model/units/index.js.map +1 -1
- package/dist/model/units/percent.js +1 -1
- package/dist/model/units/percent.js.map +1 -1
- package/dist/model/units/time.js +1 -1
- package/dist/model/units/time.js.map +1 -1
- package/dist/model/units/types.js +1 -1
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.js +1 -1
- package/dist/model/units/units.js.map +1 -1
- package/dist/model/units/units.test.js +59 -6
- package/dist/model/units/units.test.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +6 -1
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/palette/background.js +1 -1
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/palette/colors/blue.js +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/common.js +1 -1
- package/dist/theme/palette/colors/common.js.map +1 -1
- package/dist/theme/palette/colors/green.js +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.js +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js +1 -1
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.js +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.js +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.js +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/colors/types.js +1 -1
- package/dist/theme/palette/colors/types.js.map +1 -1
- package/dist/theme/palette/error.js +1 -1
- package/dist/theme/palette/error.js.map +1 -1
- package/dist/theme/palette/grey.js +1 -1
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/theme/palette/index.js +1 -1
- package/dist/theme/palette/index.js.map +1 -1
- package/dist/theme/palette/palette-options.js +1 -1
- package/dist/theme/palette/palette-options.js.map +1 -1
- package/dist/theme/palette/primary.js +1 -1
- package/dist/theme/palette/primary.js.map +1 -1
- package/dist/theme/palette/secondary.js +1 -1
- package/dist/theme/palette/secondary.js.map +1 -1
- package/dist/theme/palette/success.js +1 -1
- package/dist/theme/palette/success.js.map +1 -1
- package/dist/theme/palette/text.js +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.js +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +13 -2
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/types/ThemeExtension.d.js +1 -1
- package/dist/theme/types/ThemeExtension.d.js.map +1 -1
- package/dist/theme/typography.js +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/combine-sx.js +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/format.test.js +1 -1
- package/dist/utils/format.test.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.js +1 -1
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +6 -1
- package/dist/utils/theme-gen.js.map +1 -1
- package/dist/utils/theme-gen.test.js +6 -1
- package/dist/utils/theme-gen.test.js.map +1 -1
- package/package.json +5 -3
- package/dist/Tooltip/SeriesInfo.d.ts.map +0 -1
- package/dist/Tooltip/SeriesInfo.js +0 -143
- package/dist/Tooltip/SeriesInfo.js.map +0 -1
- package/dist/Tooltip/SeriesMarker.d.ts.map +0 -1
- package/dist/Tooltip/SeriesMarker.js.map +0 -1
- package/dist/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/TooltipContent.d.ts.map +0 -1
- package/dist/Tooltip/TooltipContent.js.map +0 -1
- package/dist/Tooltip/focused-series.d.ts.map +0 -1
- package/dist/Tooltip/focused-series.js.map +0 -1
- package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
- package/dist/Tooltip/focused-series.test.js.map +0 -1
- package/dist/Tooltip/index.d.ts +0 -3
- package/dist/Tooltip/index.d.ts.map +0 -1
- package/dist/Tooltip/tooltip-model.d.ts.map +0 -1
- package/dist/Tooltip/tooltip-model.js.map +0 -1
- package/dist/Tooltip/utils.d.ts.map +0 -1
- package/dist/Tooltip/utils.js.map +0 -1
- package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -31,7 +31,6 @@ use([
|
|
|
31
31
|
TooltipComponent,
|
|
32
32
|
CanvasRenderer
|
|
33
33
|
]);
|
|
34
|
-
const PANEL_PADDING = 32;
|
|
35
34
|
const MIN_VALUE_SIZE = 12;
|
|
36
35
|
const MAX_VALUE_SIZE = 36;
|
|
37
36
|
export function StatChart(props) {
|
|
@@ -92,27 +91,37 @@ export function StatChart(props) {
|
|
|
92
91
|
// adjusts fontSize depending on number of characters, clamp also used in fontSize attribute
|
|
93
92
|
const charactersAdjust = formattedValue.length;
|
|
94
93
|
const valueSize = isLargePanel === true ? MAX_VALUE_SIZE : Math.min(width, height) / charactersAdjust;
|
|
94
|
+
const containerPadding = `${chartsTheme.container.padding.default}px`;
|
|
95
95
|
return /*#__PURE__*/ _jsxs(Box, {
|
|
96
|
+
sx: {
|
|
97
|
+
height: '100%',
|
|
98
|
+
width: '100%',
|
|
99
|
+
display: 'flex',
|
|
100
|
+
flexDirection: 'column'
|
|
101
|
+
},
|
|
96
102
|
children: [
|
|
97
103
|
/*#__PURE__*/ _jsx(Typography, {
|
|
98
104
|
variant: "h3",
|
|
99
105
|
sx: (theme)=>({
|
|
100
106
|
color: theme.palette.text.primary,
|
|
101
|
-
fontSize: `clamp(${MIN_VALUE_SIZE}px, ${valueSize}px, ${MAX_VALUE_SIZE}px)
|
|
107
|
+
fontSize: `clamp(${MIN_VALUE_SIZE}px, ${valueSize}px, ${MAX_VALUE_SIZE}px)`,
|
|
108
|
+
padding: `${containerPadding} ${containerPadding} 0 ${containerPadding}`
|
|
102
109
|
}),
|
|
103
110
|
children: formattedValue
|
|
104
111
|
}),
|
|
105
|
-
sparkline !== undefined && /*#__PURE__*/ _jsx(
|
|
112
|
+
sparkline !== undefined && /*#__PURE__*/ _jsx(Box, {
|
|
106
113
|
sx: {
|
|
107
|
-
|
|
108
|
-
height: height,
|
|
109
|
-
position: 'absolute',
|
|
110
|
-
bottom: 0,
|
|
111
|
-
left: 0
|
|
114
|
+
flex: 1
|
|
112
115
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
children: /*#__PURE__*/ _jsx(EChart, {
|
|
117
|
+
sx: {
|
|
118
|
+
width: '100%',
|
|
119
|
+
height: '100%'
|
|
120
|
+
},
|
|
121
|
+
option: option,
|
|
122
|
+
theme: chartsTheme.echartsTheme,
|
|
123
|
+
renderer: "svg"
|
|
124
|
+
})
|
|
116
125
|
})
|
|
117
126
|
]
|
|
118
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/StatChart/StatChart.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/StatChart/StatChart.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, { useMemo } from 'react';\nimport { Box, Typography } from '@mui/material';\nimport { merge } from 'lodash-es';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { GaugeChart as EChartsGaugeChart, GaugeSeriesOption } from 'echarts/charts';\nimport { LineChart as EChartsLineChart, LineSeriesOption } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsThemeProvider';\nimport { formatValue, UnitOptions } from '../model/units';\nimport { EChart } from '../EChart';\nimport { GraphSeries } from '../model/graph';\n\nuse([\n EChartsGaugeChart,\n EChartsLineChart,\n GridComponent,\n DatasetComponent,\n TitleComponent,\n TooltipComponent,\n CanvasRenderer,\n]);\n\nconst MIN_VALUE_SIZE = 12;\nconst MAX_VALUE_SIZE = 36;\n\nexport interface StatChartData {\n calculatedValue?: number;\n seriesData?: GraphSeries;\n name?: string;\n}\n\ninterface StatChartProps {\n width: number;\n height: number;\n data: StatChartData;\n unit: UnitOptions;\n sparkline?: LineSeriesOption;\n}\n\nexport function StatChart(props: StatChartProps) {\n const { width, height, data, unit, sparkline } = props;\n const chartsTheme = useChartsTheme();\n\n const formattedValue = data.calculatedValue === undefined ? '' : formatValue(data.calculatedValue, unit);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.seriesData === undefined) return chartsTheme.noDataOption;\n\n const series = data.seriesData;\n\n const statSeries: Array<GaugeSeriesOption | LineSeriesOption> = [];\n\n if (sparkline !== undefined) {\n const lineSeries: LineSeriesOption = {\n type: 'line',\n data: [...series.values],\n zlevel: 1,\n symbol: 'none',\n animation: false,\n silent: true,\n };\n const mergedSeries = merge(lineSeries, sparkline);\n statSeries.push(mergedSeries);\n }\n\n const option = {\n title: {\n show: false,\n },\n grid: {\n show: false,\n top: '35%', // adds space above sparkline\n right: 0,\n bottom: 0,\n left: 0,\n containLabel: false,\n },\n xAxis: {\n type: 'time',\n show: false,\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n show: false,\n },\n tooltip: {\n show: false,\n },\n series: statSeries,\n };\n\n return option;\n }, [data, chartsTheme, sparkline]);\n\n const isLargePanel = width > 250 && height > 180;\n // adjusts fontSize depending on number of characters, clamp also used in fontSize attribute\n const charactersAdjust = formattedValue.length;\n const valueSize = isLargePanel === true ? MAX_VALUE_SIZE : Math.min(width, height) / charactersAdjust;\n\n const containerPadding = `${chartsTheme.container.padding.default}px`;\n\n return (\n <Box sx={{ height: '100%', width: '100%', display: 'flex', flexDirection: 'column' }}>\n <Typography\n variant=\"h3\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n fontSize: `clamp(${MIN_VALUE_SIZE}px, ${valueSize}px, ${MAX_VALUE_SIZE}px)`,\n padding: `${containerPadding} ${containerPadding} 0 ${containerPadding}`,\n })}\n >\n {formattedValue}\n </Typography>\n {sparkline !== undefined && (\n <Box sx={{ flex: 1 }}>\n <EChart\n sx={{\n width: '100%',\n height: '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n renderer=\"svg\"\n />\n </Box>\n )}\n </Box>\n );\n}\n"],"names":["React","useMemo","Box","Typography","merge","use","GaugeChart","EChartsGaugeChart","LineChart","EChartsLineChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","formatValue","EChart","MIN_VALUE_SIZE","MAX_VALUE_SIZE","StatChart","props","width","height","data","unit","sparkline","chartsTheme","formattedValue","calculatedValue","undefined","option","seriesData","noDataOption","series","statSeries","lineSeries","type","values","zlevel","symbol","animation","silent","mergedSeries","push","title","show","grid","top","right","bottom","left","containLabel","xAxis","boundaryGap","yAxis","tooltip","isLargePanel","charactersAdjust","length","valueSize","Math","min","containerPadding","container","padding","default","sx","display","flexDirection","variant","theme","color","palette","text","primary","fontSize","flex","echartsTheme","renderer"],"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,OAAO,QAAQ,OAAO,CAAC;AACvC,SAASC,GAAG,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChD,SAASC,KAAK,QAAQ,WAAW,CAAC;AAClC,SAASC,GAAG,QAA2B,cAAc,CAAC;AACtD,SAASC,UAAU,IAAIC,iBAAiB,QAA2B,gBAAgB,CAAC;AACpF,SAASC,SAAS,IAAIC,gBAAgB,QAA0B,gBAAgB,CAAC;AACjF,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,oBAAoB,CAAC;AACvG,SAASC,cAAc,QAAQ,mBAAmB,CAAC;AACnD,SAASC,cAAc,QAAQ,gCAAgC,CAAC;AAChE,SA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BACTmE,OAAO,EAAC,IAAI;gBACZH,EAAE,EAAE,CAACI,KAAK,GAAM,CAAA;wBACdC,KAAK,EAAED,KAAK,CAACE,OAAO,CAACC,IAAI,CAACC,OAAO;wBACjCC,QAAQ,EAAE,CAAC,MAAM,EAAE1D,cAAc,CAAC,IAAI,EAAE0C,SAAS,CAAC,IAAI,EAAEzC,cAAc,CAAC,GAAG,CAAC;wBAC3E8C,OAAO,EAAE,CAAC,EAAEF,gBAAgB,CAAC,CAAC,EAAEA,gBAAgB,CAAC,GAAG,EAAEA,gBAAgB,CAAC,CAAC;qBACzE,CAAA,AAAC;0BAEDnC,cAAc;cACJ;YACZF,SAAS,KAAKI,SAAS,kBACtB,KAAC5B,GAAG;gBAACiE,EAAE,EAAE;oBAAEU,IAAI,EAAE,CAAC;iBAAE;0BAClB,cAAA,KAAC5D,MAAM;oBACLkD,EAAE,EAAE;wBACF7C,KAAK,EAAE,MAAM;wBACbC,MAAM,EAAE,MAAM;qBACf;oBACDQ,MAAM,EAAEA,MAAM;oBACdwC,KAAK,EAAE5C,WAAW,CAACmD,YAAY;oBAC/BC,QAAQ,EAAC,KAAK;kBACd;cACE,AACP;;MACG,CACN;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/StatChart/StatChart.test.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/StatChart/StatChart.test.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 { render, screen } from '@testing-library/react';\nimport { ChartsThemeProvider } from '../context/ChartsThemeProvider';\nimport { UnitOptions } from '../model';\nimport { testChartsTheme } from '../test-utils';\nimport { StatChart, StatChartData } from './StatChart';\n\ndescribe('StatChart', () => {\n const renderChart = (unit: UnitOptions) => {\n const contentDimensions = {\n width: 200,\n height: 200,\n };\n render(\n <ChartsThemeProvider chartsTheme={testChartsTheme}>\n <StatChart width={contentDimensions.width} height={contentDimensions.height} data={mockStatData} unit={unit} />\n </ChartsThemeProvider>\n );\n };\n\n const mockStatData: StatChartData = {\n calculatedValue: 7.72931659687181,\n name: 'Example Stat Chart',\n seriesData: {\n name: '(((count(count(node_cpu_seconds_total{job=\"example\"}) by (cpu))',\n values: [\n [1654006170000, 7.736401673473903],\n [1654006185000, 7.733891213538757],\n [1654006200000, 7.731101813010433],\n [1654006215000, 7.722454672079215],\n [1654006230000, 7.722733612256738],\n ],\n },\n };\n\n it('render default options (no sparkline)', () => {\n const unit: UnitOptions = {\n kind: 'Decimal',\n decimal_places: 2,\n };\n renderChart(unit);\n expect(screen.getByText('7.73')).toBeInTheDocument();\n });\n\n it('show value with bytes unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Bytes',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 bytes')).toBeInTheDocument();\n });\n\n it('show value with seconds time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Seconds',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 seconds')).toBeInTheDocument();\n });\n\n it('show value with months time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Months',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 months')).toBeInTheDocument();\n });\n});\n"],"names":["render","screen","ChartsThemeProvider","testChartsTheme","StatChart","describe","renderChart","unit","contentDimensions","width","height","chartsTheme","data","mockStatData","calculatedValue","name","seriesData","values","it","kind","decimal_places","expect","getByText","toBeInTheDocument"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEA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M,CAACpB,MAAM,CAACqB,SAAS,CAAC,MAAM,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,uCAAuC,EAAE,IAAM;QAChD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,OAAO;SACd,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,YAAY,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,8CAA8C,EAAE,IAAM;QACvD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,SAAS;SAChB,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,cAAc,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,6CAA6C,EAAE,IAAM;QACtD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,QAAQ;SACf,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,aAAa,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/StatChart/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/StatChart/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/StatChart/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 './StatChart';\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,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
interface SeriesInfoProps {
|
|
2
|
+
export interface SeriesInfoProps {
|
|
3
3
|
seriesName: string;
|
|
4
4
|
y: number;
|
|
5
5
|
formattedY: string;
|
|
@@ -8,5 +8,4 @@ interface SeriesInfoProps {
|
|
|
8
8
|
wrapLabels?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare function SeriesInfo(props: SeriesInfoProps): JSX.Element;
|
|
11
|
-
export {};
|
|
12
11
|
//# sourceMappingURL=SeriesInfo.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Box } from '@mui/material';
|
|
15
|
+
import { SeriesMarker } from './SeriesMarker';
|
|
16
|
+
import { SeriesLabelsStack } from './SeriesLabelsStack';
|
|
17
|
+
import { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';
|
|
18
|
+
export function SeriesInfo(props) {
|
|
19
|
+
const { seriesName , formattedY , markerColor , totalSeries , wrapLabels } = props;
|
|
20
|
+
// metric __name__ comes before opening curly brace, ignore if not populated
|
|
21
|
+
// ex with metric name: node_load15{env="demo",job="node"}
|
|
22
|
+
// ex without metric name: {env="demo",job="node"}
|
|
23
|
+
const splitName = seriesName.split('{');
|
|
24
|
+
var ref;
|
|
25
|
+
const seriesLabels = (ref = splitName[1]) !== null && ref !== void 0 ? ref : seriesName;
|
|
26
|
+
// remove curly braces that wrap labels
|
|
27
|
+
const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');
|
|
28
|
+
// determine whether to show labels on separate lines
|
|
29
|
+
const splitLabels = formattedSeriesLabels.split(',');
|
|
30
|
+
if (totalSeries === 1 && splitLabels.length > 1) {
|
|
31
|
+
const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';
|
|
32
|
+
return /*#__PURE__*/ _jsx(SeriesLabelsStack, {
|
|
33
|
+
formattedY: formattedY,
|
|
34
|
+
metricName: metricName,
|
|
35
|
+
metricLabels: splitLabels,
|
|
36
|
+
markerColor: markerColor
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// add space after commas when more than one focused series
|
|
40
|
+
const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');
|
|
41
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
42
|
+
sx: {
|
|
43
|
+
display: 'table-row',
|
|
44
|
+
paddingTop: 0.5
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
48
|
+
sx: {
|
|
49
|
+
display: 'table-cell',
|
|
50
|
+
maxWidth: '520px'
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx(SeriesMarker, {
|
|
54
|
+
markerColor: markerColor,
|
|
55
|
+
sx: {
|
|
56
|
+
marginTop: 0.5
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
60
|
+
component: "span",
|
|
61
|
+
sx: (theme)=>({
|
|
62
|
+
display: 'inline-block',
|
|
63
|
+
width: 'calc(100% - 20px)',
|
|
64
|
+
minWidth: 150,
|
|
65
|
+
maxWidth: TOOLTIP_LABELS_MAX_WIDTH,
|
|
66
|
+
overflow: 'hidden',
|
|
67
|
+
color: theme.palette.common.white,
|
|
68
|
+
textOverflow: 'ellipsis',
|
|
69
|
+
whiteSpace: wrapLabels ? 'normal' : 'nowrap'
|
|
70
|
+
}),
|
|
71
|
+
children: inlineSeriesLabels
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
76
|
+
sx: {
|
|
77
|
+
display: 'table-cell',
|
|
78
|
+
paddingLeft: 1.5,
|
|
79
|
+
textAlign: 'right',
|
|
80
|
+
verticalAlign: 'top',
|
|
81
|
+
fontWeight: '700'
|
|
82
|
+
},
|
|
83
|
+
children: formattedY
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=SeriesInfo.js.map
|
|
@@ -0,0 +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,QAAQ,gBAAgB,CAAC;AAC9C,SAASC,iBAAiB,QAAQ,qBAAqB,CAAC;AACxD,SAASC,wBAAwB,QAAQ,iBAAiB,CAAC;AAW3D,OAAO,SAASC,UAAU,CAACC,KAAsB,EAAE;IACjD,MAAM,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAEC,WAAW,CAAA,EAAEC,UAAU,C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F0B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeriesInfo.test.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { render } from '@testing-library/react';
|
|
15
|
+
import { screen } from '@testing-library/dom';
|
|
16
|
+
import { SeriesInfo } from './SeriesInfo';
|
|
17
|
+
describe('SeriesInfo', ()=>{
|
|
18
|
+
const renderComponent = (props)=>{
|
|
19
|
+
render(/*#__PURE__*/ _jsx(SeriesInfo, {
|
|
20
|
+
...props
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
it('render metric __name__ beside formattedY value', ()=>{
|
|
24
|
+
const seriesInfo = {
|
|
25
|
+
seriesName: 'node_load1{env="demo",instance="demo.do.prometheus.io:9100",job="node"}',
|
|
26
|
+
y: 0.28,
|
|
27
|
+
formattedY: '28.0%',
|
|
28
|
+
markerColor: 'hsla(1016196180,50%,50%,0.8)',
|
|
29
|
+
totalSeries: 1,
|
|
30
|
+
wrapLabels: true
|
|
31
|
+
};
|
|
32
|
+
renderComponent(seriesInfo);
|
|
33
|
+
expect(screen.getByText('node_load1:')).toBeInTheDocument();
|
|
34
|
+
expect(screen.getByText('28.0%')).toBeInTheDocument();
|
|
35
|
+
expect(screen.getByText('demo.do.prometheus.io:9100')).toBeInTheDocument(); // TODO: remove quotes
|
|
36
|
+
});
|
|
37
|
+
it('render preformatted series name beside formattedY value', ()=>{
|
|
38
|
+
const seriesInfo = {
|
|
39
|
+
seriesName: 'Node memory total',
|
|
40
|
+
y: 552341504,
|
|
41
|
+
formattedY: '526.75 MB',
|
|
42
|
+
markerColor: 'hsla(-1756459732,50%,50%,0.8)',
|
|
43
|
+
totalSeries: 2,
|
|
44
|
+
wrapLabels: true
|
|
45
|
+
};
|
|
46
|
+
renderComponent(seriesInfo);
|
|
47
|
+
expect(screen.getByText('Node memory total')).toBeInTheDocument();
|
|
48
|
+
expect(screen.getByText('526.75 MB')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=SeriesInfo.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.test.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 { render } from '@testing-library/react';\nimport { screen } from '@testing-library/dom';\nimport { SeriesInfo, SeriesInfoProps } from './SeriesInfo';\n\ndescribe('SeriesInfo', () => {\n const renderComponent = (props: SeriesInfoProps) => {\n render(<SeriesInfo {...props} />);\n };\n\n it('render metric __name__ beside formattedY value', () => {\n const seriesInfo: SeriesInfoProps = {\n seriesName: 'node_load1{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n y: 0.28,\n formattedY: '28.0%',\n markerColor: 'hsla(1016196180,50%,50%,0.8)',\n totalSeries: 1,\n wrapLabels: true,\n };\n renderComponent(seriesInfo);\n expect(screen.getByText('node_load1:')).toBeInTheDocument();\n expect(screen.getByText('28.0%')).toBeInTheDocument();\n expect(screen.getByText('demo.do.prometheus.io:9100')).toBeInTheDocument(); // TODO: remove quotes\n });\n\n it('render preformatted series name beside formattedY value', () => {\n const seriesInfo: SeriesInfoProps = {\n seriesName: 'Node memory total',\n y: 552341504,\n formattedY: '526.75 MB',\n markerColor: 'hsla(-1756459732,50%,50%,0.8)',\n totalSeries: 2,\n wrapLabels: true,\n };\n renderComponent(seriesInfo);\n expect(screen.getByText('Node memory total')).toBeInTheDocument();\n expect(screen.getByText('526.75 MB')).toBeInTheDocument();\n });\n});\n"],"names":["render","screen","SeriesInfo","describe","renderComponent","props","it","seriesInfo","seriesName","y","formattedY","markerColor","totalSeries","wrapLabels","expect","getByText","toBeInTheDocument"],"mappings":"AAAA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AAC;YACdC,UAAU,EAAE,IAAI;SACjB,AAAC;QACFT,eAAe,CAACG,UAAU,CAAC,CAAC;QAC5BO,MAAM,CAACb,MAAM,CAACc,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;QAClEF,MAAM,CAACb,MAAM,CAACc,SAAS,CAAC,WAAW,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SeriesLabelsStackProps {
|
|
3
|
+
formattedY: string;
|
|
4
|
+
metricName: string;
|
|
5
|
+
metricLabels: string[];
|
|
6
|
+
markerColor: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function SeriesLabelsStack(props: SeriesLabelsStackProps): JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SeriesLabelsStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeriesLabelsStack.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAiE9D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Box, Divider, Stack, Typography } from '@mui/material';
|
|
15
|
+
import { SeriesMarker } from './SeriesMarker';
|
|
16
|
+
export function SeriesLabelsStack(props) {
|
|
17
|
+
const { formattedY , markerColor , metricName , metricLabels } = props;
|
|
18
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
19
|
+
spacing: 0.5,
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
22
|
+
sx: (theme)=>({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
height: '16px',
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'left',
|
|
28
|
+
color: theme.palette.common.white,
|
|
29
|
+
fontSize: '11px'
|
|
30
|
+
}),
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ _jsx(SeriesMarker, {
|
|
33
|
+
markerColor: markerColor,
|
|
34
|
+
sx: {
|
|
35
|
+
marginTop: 0.25
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
39
|
+
component: "span",
|
|
40
|
+
children: [
|
|
41
|
+
metricName,
|
|
42
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
43
|
+
component: "span",
|
|
44
|
+
sx: (theme)=>({
|
|
45
|
+
color: theme.palette.common.white,
|
|
46
|
+
fontWeight: 700,
|
|
47
|
+
paddingLeft: '2px'
|
|
48
|
+
}),
|
|
49
|
+
children: formattedY
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
56
|
+
sx: (theme)=>({
|
|
57
|
+
borderColor: theme.palette.grey['500']
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
61
|
+
sx: (theme)=>({
|
|
62
|
+
color: theme.palette.common.white
|
|
63
|
+
}),
|
|
64
|
+
children: metricLabels.map((label)=>{
|
|
65
|
+
// show labels on separate lines when many labels and only one focused series
|
|
66
|
+
if (label) {
|
|
67
|
+
const [name, value] = label.split('=');
|
|
68
|
+
const formattedName = value !== undefined ? `${name}: ` : name;
|
|
69
|
+
const formattedValue = value !== undefined ? value.replace(/(^"|"$)/g, '') : value;
|
|
70
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
71
|
+
sx: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
gap: '4px'
|
|
74
|
+
},
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
77
|
+
sx: {
|
|
78
|
+
fontSize: '11px'
|
|
79
|
+
},
|
|
80
|
+
children: formattedName
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
83
|
+
sx: (theme)=>({
|
|
84
|
+
color: theme.palette.common.white,
|
|
85
|
+
fontWeight: 700,
|
|
86
|
+
fontSize: '11px'
|
|
87
|
+
}),
|
|
88
|
+
children: formattedValue
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
}, label);
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=SeriesLabelsStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.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, Divider, Stack, Typography } from '@mui/material';\nimport { SeriesMarker } from './SeriesMarker';\n\nexport interface SeriesLabelsStackProps {\n formattedY: string;\n metricName: string;\n metricLabels: string[];\n markerColor: string;\n}\n\nexport function SeriesLabelsStack(props: SeriesLabelsStackProps) {\n const { formattedY, markerColor, metricName, metricLabels } = props;\n return (\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n display: 'flex',\n height: '16px',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'left',\n color: theme.palette.common.white,\n fontSize: '11px',\n })}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.25 }} />\n <Box component=\"span\">\n {metricName}\n <Box\n component=\"span\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n paddingLeft: '2px',\n })}\n >\n {formattedY}\n </Box>\n </Box>\n </Box>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {metricLabels.map((label) => {\n // show labels on separate lines when many labels and only one focused series\n if (label) {\n const [name, value] = label.split('=');\n const formattedName = value !== undefined ? `${name}: ` : name;\n const formattedValue = value !== undefined ? value.replace(/(^\"|\"$)/g, '') : value;\n return (\n <Box key={label} sx={{ display: 'flex', gap: '4px' }}>\n <Typography sx={{ fontSize: '11px' }}>{formattedName}</Typography>\n <Typography\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n fontSize: '11px',\n })}\n >\n {formattedValue}\n </Typography>\n </Box>\n );\n }\n })}\n </Box>\n </Stack>\n );\n}\n"],"names":["Box","Divider","Stack","Typography","SeriesMarker","SeriesLabelsStack","props","formattedY","markerColor","metricName","metricLabels","spacing","sx","theme","display","height","flexDirection","alignItems","justifyContent","color","palette","common","white","fontSize","marginTop","component","fontWeight","paddingLeft","borderColor","grey","map","label","name","value","split","formattedName","undefined","formattedValue","replace","gap"],"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,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAS9C,OAAO,SAASC,iBAAiB,CAACC,KAA6B,EAAE;IAC/D,MAAM,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAEC,UAAU,CAAA,EAAEC,YAAY,CAAA,EAAE,GAAGJ,KAAK,AAAC;IACpE,qBACE,MAACJ,KAAK;QAACS,OAAO,EAAE,GAAG;;0BACjB,MAACX,GAAG;gBACFY,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;wBACdC,OAAO,EAAE,MAAM;wBACfC,MAAM,EAAE,MAAM;wBACdC,aAAa,EAAE,KAAK;wBACpBC,UAAU,EAAE,QAAQ;wBACpBC,cAAc,EAAE,MAAM;wBACtBC,KAAK,EAAEN,KAAK,CAACO,OAAO,CAACC,MAAM,CAACC,KAAK;wBACjCC,QAAQ,EAAE,MAAM;qBACjB,CAAA,AAAC;;kCAEF,KAACnB,YAAY;wBAACI,WAAW,EAAEA,WAAW;wBAAEI,EAAE,EAAE;4BAAEY,SAAS,EAAE,IAAI;yBAAE;sBAAI;kCACnE,MAACxB,GAAG;wBAACyB,SAAS,EAAC,MAAM;;4BAClBhB,UAAU;0CACX,KAACT,GAAG;gCACFyB,SAAS,EAAC,MAAM;gCAChBb,EAAE,EAAE,CAACC,KAAK,GA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AU,EAAE,GAAG;4CACfH,QAAQ,EAAE,MAAM;yCACjB,CAAA,AAAC;8CAEDc,cAAc;kCACJ;;2BAVLN,KAAK,CAWT,CACN;oBACJ,CAAC;gBACH,CAAC,CAAC;cACE;;MACA,CACR;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
interface SeriesMarkerProps extends BoxProps<'div'> {
|
|
3
4
|
markerColor: string;
|
|
4
5
|
}
|
|
5
6
|
export declare function SeriesMarker(props: SeriesMarkerProps): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeriesMarker.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,UAAU,iBAAkB,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAkBpD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Box } from '@mui/material';
|
|
15
|
+
import { combineSx } from '../utils';
|
|
15
16
|
export function SeriesMarker(props) {
|
|
16
|
-
const { markerColor } = props;
|
|
17
|
+
const { markerColor , sx } = props;
|
|
17
18
|
return /*#__PURE__*/ _jsx(Box, {
|
|
18
|
-
sx: {
|
|
19
|
+
sx: combineSx({
|
|
19
20
|
display: 'inline-block',
|
|
20
|
-
width: '
|
|
21
|
+
width: '11px',
|
|
22
|
+
height: '11px',
|
|
21
23
|
borderRadius: '2px',
|
|
22
|
-
height: '12px',
|
|
23
|
-
marginTop: 0.25,
|
|
24
24
|
marginRight: 1,
|
|
25
25
|
verticalAlign: 'top'
|
|
26
|
-
},
|
|
26
|
+
}, sx),
|
|
27
27
|
style: {
|
|
28
28
|
backgroundColor: markerColor
|
|
29
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.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, BoxProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps) {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx","SeriesMarker","props","markerColor","sx","display","width","height","borderRadius","marginRight","verticalAlign","style","backgroundColor"],"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,QAAkB,eAAe,CAAC;AAC9C,SAASC,SAAS,QAAQ,UAAU,CAAC;AAMrC,OAAO,SAASC,YAAY,CAACC,KAAwB,EAAE;IACrD,MAAM,EAAEC,WAAW,CAAA,EAAEC,EAAE,CAAA,EAAE,GAAGF,KAAK,AAAC;IAClC,qBACE,KAACH,GAAG;QACFK,EAAE,EAAEJ,SAAS,CACX;YACEK,OAAO,EAAE,cAAc;YACvBC,KAAK,EAAE,MAAM;YACbC,MAAM,EAAE,MAAM;YACdC,YAAY,EAAE,KAAK;YACnBC,WAAW,EAAE,CAAC;YACdC,aAAa,EAAE,KAAK;SACrB,EACDN,EAAE,CACH;QACDO,KAAK,EAAE;YAAEC,eAAe,EAAET,WAAW;SAAE;MAClC,CACP;AACJ,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ECharts as EChartsInstance } from 'echarts/core';
|
|
3
3
|
import { EChartsDataFormat, UnitOptions } from '../model';
|
|
4
|
-
interface
|
|
4
|
+
interface TimeSeriesTooltipProps {
|
|
5
5
|
chartRef: React.MutableRefObject<EChartsInstance | undefined>;
|
|
6
6
|
chartData: EChartsDataFormat;
|
|
7
7
|
pinTooltip: boolean;
|
|
8
8
|
wrapLabels?: boolean;
|
|
9
9
|
unit?: UnitOptions;
|
|
10
10
|
}
|
|
11
|
-
declare const
|
|
12
|
-
export {
|
|
13
|
-
//# sourceMappingURL=
|
|
11
|
+
export declare const TimeSeriesTooltip: React.NamedExoticComponent<TimeSeriesTooltipProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=TimeSeriesTooltip.d.ts.map
|
|
@@ -0,0 +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,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -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
|
-
const
|
|
20
|
+
export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , pinTooltip , unit }) {
|
|
21
21
|
const [pinnedPos, setPinnedPos] = useState(null);
|
|
22
22
|
const mousePos = useMousePosition();
|
|
23
23
|
if (mousePos === null || mousePos.target === null) return null;
|
|
@@ -67,6 +67,5 @@ const Tooltip = /*#__PURE__*/ React.memo(function Tooltip({ chartRef , chartData
|
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
-
export { Tooltip };
|
|
71
70
|
|
|
72
|
-
//# sourceMappingURL=
|
|
71
|
+
//# sourceMappingURL=TimeSeriesTooltip.js.map
|
|
@@ -0,0 +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,gBAAgB,QAAQ,iBAAiB,CAAC;AAC7G,SA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,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,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FocusedSeriesArray } from './focused-series';
|
|
3
|
-
interface TooltipContentProps {
|
|
3
|
+
export interface TooltipContentProps {
|
|
4
4
|
focusedSeries: FocusedSeriesArray | null;
|
|
5
5
|
wrapLabels?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function TooltipContent(props: TooltipContentProps): JSX.Element;
|
|
8
|
-
export {};
|
|
9
8
|
//# sourceMappingURL=TooltipContent.d.ts.map
|