@perses-dev/components 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-test-internal-dep-dd238ac
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/ColorPicker/ColorPicker.d.ts +12 -0
- package/dist/ColorPicker/ColorPicker.d.ts.map +1 -0
- package/dist/ColorPicker/ColorPicker.js +78 -0
- package/dist/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/ColorPicker/index.d.ts +2 -0
- package/dist/ColorPicker/index.d.ts.map +1 -0
- package/dist/{Tooltip → ColorPicker}/index.js +2 -3
- package/dist/ColorPicker/index.js.map +1 -0
- 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/Dialog/index.js +15 -0
- 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.d.ts → EChart/EChart.d.ts} +3 -3
- package/dist/EChart/EChart.d.ts.map +1 -0
- package/dist/{EChart.js → EChart/EChart.js} +2 -3
- package/dist/EChart/EChart.js.map +1 -0
- package/dist/EChart/index.d.ts +2 -0
- package/dist/EChart/index.d.ts.map +1 -0
- package/dist/EChart/index.js +15 -0
- package/dist/EChart/index.js.map +1 -0
- 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 +1 -2
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +3 -2
- 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/index.js +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.js +1 -1
- 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 +13 -5
- 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/index.js +1 -1
- package/dist/LegendOptionsEditor/index.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +4 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +4 -4
- 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 +2 -2
- 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 +2 -2
- 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.d.ts +3 -2
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +18 -6
- 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 +1 -3
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +23 -16
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/index.js +1 -1
- package/dist/StatChart/index.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +4 -0
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -0
- package/dist/ThresholdsEditor/ThresholdColorPicker.js +76 -0
- package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -0
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +13 -0
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -0
- package/dist/ThresholdsEditor/ThresholdInput.js +61 -0
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -0
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +10 -0
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -0
- package/dist/ThresholdsEditor/ThresholdsEditor.js +215 -0
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -0
- package/dist/ThresholdsEditor/index.d.ts +2 -0
- package/dist/ThresholdsEditor/index.d.ts.map +1 -0
- package/dist/ThresholdsEditor/index.js +15 -0
- package/dist/ThresholdsEditor/index.js.map +1 -0
- 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/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/focused-series.d.ts.map +1 -0
- package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +6 -6
- package/dist/TimeSeriesTooltip/focused-series.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/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/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/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/ColorPicker/ColorPicker.js +128 -0
- package/dist/cjs/{Tooltip → ColorPicker}/index.js +2 -3
- 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/Dialog/index.js +28 -0
- package/dist/cjs/Drawer/Drawer.js +1 -1
- package/dist/cjs/Drawer/index.js +1 -1
- package/dist/cjs/{EChart.js → EChart/EChart.js} +5 -11
- package/dist/cjs/EChart/index.js +28 -0
- package/dist/cjs/ErrorAlert.js +1 -1
- package/dist/cjs/ErrorBoundary.js +1 -1
- package/dist/cjs/GaugeChart/GaugeChart.js +3 -2
- package/dist/cjs/GaugeChart/index.js +1 -1
- package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
- package/dist/cjs/InfoTooltip/index.js +1 -1
- package/dist/cjs/JSONEditor.js +1 -1
- package/dist/cjs/Legend/CompactLegend.js +1 -1
- package/dist/cjs/Legend/Legend.js +13 -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/index.js +1 -1
- package/dist/cjs/LineChart/LineChart.js +43 -4
- package/dist/cjs/LineChart/index.js +1 -1
- package/dist/cjs/LineChart/utils.js +3 -8
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +2 -2
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +23 -6
- package/dist/cjs/OptionsEditorLayout/index.js +1 -1
- package/dist/cjs/StatChart/StatChart.js +24 -60
- package/dist/cjs/StatChart/index.js +1 -1
- package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +87 -0
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +72 -0
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +265 -0
- package/dist/cjs/ThresholdsEditor/index.js +28 -0
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -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/{Tooltip → TimeSeriesTooltip}/focused-series.js +6 -6
- 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/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 +5 -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/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/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 +14 -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 +17 -1
- package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
- package/dist/cjs/theme/typography.js +5 -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/index.js +1 -1
- package/dist/cjs/utils/mathjs.js +1 -1
- package/dist/cjs/utils/theme-gen.js +16 -8
- 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 +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +3 -18
- 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/theme.d.ts +16 -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.d.ts +1 -1
- package/dist/model/units/bytes.d.ts.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 +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.d.ts +1 -1
- package/dist/model/units/percent.d.ts.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.d.ts +1 -1
- package/dist/model/units/time.d.ts.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.d.ts +1 -1
- package/dist/model/units/types.d.ts.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/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 +14 -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 +18 -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.d.ts +4 -0
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +5 -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/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 +15 -2
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +10 -4
- package/dist/EChart.d.ts.map +0 -1
- package/dist/EChart.js.map +0 -1
- package/dist/InfoTooltip/InfoTooltip.test.d.ts +0 -2
- package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +0 -1
- package/dist/InfoTooltip/InfoTooltip.test.js +0 -36
- package/dist/InfoTooltip/InfoTooltip.test.js.map +0 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts +0 -2
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts.map +0 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -41
- package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +0 -1
- package/dist/StatChart/StatChart.test.d.ts +0 -2
- package/dist/StatChart/StatChart.test.d.ts.map +0 -1
- package/dist/StatChart/StatChart.test.js +0 -94
- package/dist/StatChart/StatChart.test.js.map +0 -1
- 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 +0 -2
- package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
- package/dist/Tooltip/focused-series.test.js +0 -93
- 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/UnitSelector/UnitSelector.test.d.ts +0 -2
- package/dist/UnitSelector/UnitSelector.test.d.ts.map +0 -1
- package/dist/UnitSelector/UnitSelector.test.js +0 -204
- package/dist/UnitSelector/UnitSelector.test.js.map +0 -1
- package/dist/cjs/InfoTooltip/InfoTooltip.test.js +0 -43
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -48
- package/dist/cjs/StatChart/StatChart.test.js +0 -96
- package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
- package/dist/cjs/Tooltip/focused-series.test.js +0 -95
- package/dist/cjs/UnitSelector/UnitSelector.test.js +0 -211
- package/dist/cjs/model/units/units.test.js +0 -153
- package/dist/cjs/utils/format.test.js +0 -47
- package/dist/cjs/utils/theme-gen.test.js +0 -197
- package/dist/model/units/units.test.d.ts +0 -2
- package/dist/model/units/units.test.d.ts.map +0 -1
- package/dist/model/units/units.test.js +0 -151
- package/dist/model/units/units.test.js.map +0 -1
- package/dist/utils/format.test.d.ts +0 -2
- package/dist/utils/format.test.d.ts.map +0 -1
- package/dist/utils/format.test.js +0 -45
- package/dist/utils/format.test.js.map +0 -1
- package/dist/utils/theme-gen.test.d.ts +0 -2
- package/dist/utils/theme-gen.test.d.ts.map +0 -1
- package/dist/utils/theme-gen.test.js +0 -195
- package/dist/utils/theme-gen.test.js.map +0 -1
- /package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
- /package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
- /package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
|
@@ -0,0 +1,215 @@
|
|
|
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 React, { useEffect, useRef, useState } from 'react';
|
|
15
|
+
import produce from 'immer';
|
|
16
|
+
import { IconButton, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
|
|
17
|
+
import PlusIcon from 'mdi-material-ui/Plus';
|
|
18
|
+
import { Stack } from '@mui/system';
|
|
19
|
+
import { InfoTooltip } from '../InfoTooltip';
|
|
20
|
+
import { useChartsTheme } from '../context/ChartsThemeProvider';
|
|
21
|
+
import { OptionsEditorGroup } from '../OptionsEditorLayout';
|
|
22
|
+
import { ThresholdColorPicker } from './ThresholdColorPicker';
|
|
23
|
+
import { ThresholdInput } from './ThresholdInput';
|
|
24
|
+
const DEFAULT_STEP = 10;
|
|
25
|
+
export function ThresholdsEditor({ thresholds , onChange , hideDefault , disablePercentMode }) {
|
|
26
|
+
const { thresholds: { defaultColor , palette } , } = useChartsTheme();
|
|
27
|
+
var ref;
|
|
28
|
+
const defaultThresholdColor = (ref = thresholds === null || thresholds === void 0 ? void 0 : thresholds.default_color) !== null && ref !== void 0 ? ref : defaultColor;
|
|
29
|
+
const [steps, setSteps] = useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
|
|
30
|
+
useEffect(()=>{
|
|
31
|
+
setSteps(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
|
|
32
|
+
}, [
|
|
33
|
+
thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps
|
|
34
|
+
]);
|
|
35
|
+
// every time a new threshold is added, we want to focus the recently added input
|
|
36
|
+
const recentlyAddedInputRef = useRef(null);
|
|
37
|
+
const focusRef = useRef(false);
|
|
38
|
+
useEffect(()=>{
|
|
39
|
+
var ref;
|
|
40
|
+
if (!recentlyAddedInputRef.current || !focusRef.current) return;
|
|
41
|
+
(ref = recentlyAddedInputRef.current) === null || ref === void 0 ? void 0 : ref.focus();
|
|
42
|
+
focusRef.current = false;
|
|
43
|
+
}, [
|
|
44
|
+
steps === null || steps === void 0 ? void 0 : steps.length
|
|
45
|
+
]);
|
|
46
|
+
const handleThresholdValueChange = (e, i)=>{
|
|
47
|
+
setSteps(produce(steps, (draft)=>{
|
|
48
|
+
const step = draft === null || draft === void 0 ? void 0 : draft[i];
|
|
49
|
+
if (step) {
|
|
50
|
+
step.value = Number(e.target.value);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
const handleThresholdColorChange = (color, i)=>{
|
|
55
|
+
if (thresholds !== undefined) {
|
|
56
|
+
onChange(produce(thresholds, (draft)=>{
|
|
57
|
+
if (draft.steps !== undefined) {
|
|
58
|
+
const step = draft.steps[i];
|
|
59
|
+
if (step) {
|
|
60
|
+
step.color = color;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleDefaultColorChange = (color)=>{
|
|
67
|
+
if (thresholds !== undefined) {
|
|
68
|
+
onChange(produce(thresholds, (draft)=>{
|
|
69
|
+
draft.default_color = color;
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// sort thresholds in ascending order every time an input blurs
|
|
74
|
+
const handleThresholdBlur = ()=>{
|
|
75
|
+
if (steps !== undefined) {
|
|
76
|
+
const sortedSteps = [
|
|
77
|
+
...steps
|
|
78
|
+
];
|
|
79
|
+
sortedSteps.sort((a, b)=>a.value - b.value);
|
|
80
|
+
if (thresholds !== undefined) {
|
|
81
|
+
onChange(produce(thresholds, (draft)=>{
|
|
82
|
+
draft.steps = sortedSteps;
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const deleteThreshold = (i)=>{
|
|
88
|
+
if (thresholds !== undefined) {
|
|
89
|
+
const updatedThresholds = produce(thresholds, (draft)=>{
|
|
90
|
+
if (draft.steps) {
|
|
91
|
+
draft.steps.splice(i, 1);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
onChange(updatedThresholds);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const addThresholdInput = ()=>{
|
|
98
|
+
focusRef.current = true;
|
|
99
|
+
if (thresholds === undefined) {
|
|
100
|
+
onChange({
|
|
101
|
+
steps: [
|
|
102
|
+
{
|
|
103
|
+
value: DEFAULT_STEP
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
onChange(produce(thresholds, (draft)=>{
|
|
109
|
+
const steps = draft.steps;
|
|
110
|
+
if (steps === null || steps === void 0 ? void 0 : steps.length) {
|
|
111
|
+
const lastStep = steps[steps.length - 1];
|
|
112
|
+
var _length;
|
|
113
|
+
const color = (_length = palette[steps.length]) !== null && _length !== void 0 ? _length : getRandomColor(); // we will assign color from the palette first, then generate random color
|
|
114
|
+
var ref;
|
|
115
|
+
steps.push({
|
|
116
|
+
color,
|
|
117
|
+
value: ((ref = lastStep === null || lastStep === void 0 ? void 0 : lastStep.value) !== null && ref !== void 0 ? ref : 0) + DEFAULT_STEP
|
|
118
|
+
}); // set new threshold value to last step value + 10
|
|
119
|
+
} else if (steps) {
|
|
120
|
+
steps.push({
|
|
121
|
+
value: DEFAULT_STEP
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const handleModeChange = (event, value)=>{
|
|
128
|
+
const mode = value === 'Percent' ? 'Percent' : undefined;
|
|
129
|
+
if (thresholds !== undefined) {
|
|
130
|
+
onChange(produce(thresholds, (draft)=>{
|
|
131
|
+
draft.mode = mode;
|
|
132
|
+
}));
|
|
133
|
+
} else {
|
|
134
|
+
onChange({
|
|
135
|
+
mode
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var ref1, _color, ref2;
|
|
140
|
+
return /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
|
|
141
|
+
title: "Thresholds",
|
|
142
|
+
icon: /*#__PURE__*/ _jsx(IconButton, {
|
|
143
|
+
size: "small",
|
|
144
|
+
"aria-label": "add threshold",
|
|
145
|
+
onClick: addThresholdInput,
|
|
146
|
+
children: /*#__PURE__*/ _jsx(PlusIcon, {})
|
|
147
|
+
}),
|
|
148
|
+
children: [
|
|
149
|
+
/*#__PURE__*/ _jsxs(ToggleButtonGroup, {
|
|
150
|
+
exclusive: true,
|
|
151
|
+
disabled: disablePercentMode,
|
|
152
|
+
value: (ref1 = thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode) !== null && ref1 !== void 0 ? ref1 : 'Absolute',
|
|
153
|
+
onChange: handleModeChange,
|
|
154
|
+
sx: {
|
|
155
|
+
height: '36px',
|
|
156
|
+
marginLeft: 'auto'
|
|
157
|
+
},
|
|
158
|
+
children: [
|
|
159
|
+
/*#__PURE__*/ _jsx(ToggleButton, {
|
|
160
|
+
"aria-label": "absolute",
|
|
161
|
+
value: "Absolute",
|
|
162
|
+
children: /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
163
|
+
description: "Absolute",
|
|
164
|
+
children: "#"
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx(ToggleButton, {
|
|
168
|
+
"aria-label": "percent",
|
|
169
|
+
value: "Percent",
|
|
170
|
+
children: /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
171
|
+
description: "Percentage means thresholds relative to min & max",
|
|
172
|
+
children: "%"
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
}),
|
|
177
|
+
steps && steps.map((step, i)=>/*#__PURE__*/ _jsx(ThresholdInput, {
|
|
178
|
+
inputRef: i === steps.length - 1 ? recentlyAddedInputRef : undefined,
|
|
179
|
+
label: `T${i + 1}`,
|
|
180
|
+
color: (ref2 = (_color = step.color) !== null && _color !== void 0 ? _color : palette[i]) !== null && ref2 !== void 0 ? ref2 : defaultThresholdColor,
|
|
181
|
+
value: step.value,
|
|
182
|
+
onColorChange: (color)=>handleThresholdColorChange(color, i),
|
|
183
|
+
onChange: (e)=>{
|
|
184
|
+
handleThresholdValueChange(e, i);
|
|
185
|
+
},
|
|
186
|
+
onDelete: ()=>{
|
|
187
|
+
deleteThreshold(i);
|
|
188
|
+
},
|
|
189
|
+
onBlur: handleThresholdBlur
|
|
190
|
+
}, i)).reverse(),
|
|
191
|
+
!hideDefault && /*#__PURE__*/ _jsxs(Stack, {
|
|
192
|
+
flex: 1,
|
|
193
|
+
direction: "row",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
spacing: 1,
|
|
196
|
+
children: [
|
|
197
|
+
/*#__PURE__*/ _jsx(ThresholdColorPicker, {
|
|
198
|
+
label: "default",
|
|
199
|
+
color: defaultThresholdColor,
|
|
200
|
+
onColorChange: handleDefaultColorChange
|
|
201
|
+
}),
|
|
202
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
203
|
+
children: "Default"
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// https://www.paulirish.com/2009/random-hex-color-code-snippets/
|
|
211
|
+
const getRandomColor = ()=>{
|
|
212
|
+
return '#' + Math.floor(Math.random() * 16777216).toString(16).padStart(6, '0');
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=ThresholdsEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ThresholdsEditor/ThresholdsEditor.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, { useEffect, useRef, useState } from 'react';\nimport produce from 'immer';\nimport { IconButton, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { Stack } from '@mui/system';\nimport { ThresholdOptions } from '@perses-dev/core';\nimport { InfoTooltip } from '../InfoTooltip';\nimport { useChartsTheme } from '../context/ChartsThemeProvider';\nimport { OptionsEditorGroup } from '../OptionsEditorLayout';\nimport { ThresholdColorPicker } from './ThresholdColorPicker';\nimport { ThresholdInput } from './ThresholdInput';\n\nexport interface ThresholdsEditorProps {\n onChange: (thresholds: ThresholdOptions) => void;\n thresholds?: ThresholdOptions;\n hideDefault?: boolean;\n disablePercentMode?: boolean;\n}\n\nconst DEFAULT_STEP = 10;\n\nexport function ThresholdsEditor({ thresholds, onChange, hideDefault, disablePercentMode }: ThresholdsEditorProps) {\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n const defaultThresholdColor = thresholds?.default_color ?? defaultColor;\n\n const [steps, setSteps] = useState(thresholds?.steps);\n useEffect(() => {\n setSteps(thresholds?.steps);\n }, [thresholds?.steps]);\n\n // every time a new threshold is added, we want to focus the recently added input\n const recentlyAddedInputRef = useRef<HTMLInputElement | null>(null);\n const focusRef = useRef(false);\n useEffect(() => {\n if (!recentlyAddedInputRef.current || !focusRef.current) return;\n recentlyAddedInputRef.current?.focus();\n focusRef.current = false;\n }, [steps?.length]);\n\n const handleThresholdValueChange = (e: React.ChangeEvent<HTMLInputElement>, i: number) => {\n setSteps(\n produce(steps, (draft) => {\n const step = draft?.[i];\n if (step) {\n step.value = Number(e.target.value);\n }\n })\n );\n };\n\n const handleThresholdColorChange = (color: string, i: number) => {\n if (thresholds !== undefined) {\n onChange(\n produce(thresholds, (draft) => {\n if (draft.steps !== undefined) {\n const step = draft.steps[i];\n if (step) {\n step.color = color;\n }\n }\n })\n );\n }\n };\n\n const handleDefaultColorChange = (color: string) => {\n if (thresholds !== undefined) {\n onChange(\n produce(thresholds, (draft) => {\n draft.default_color = color;\n })\n );\n }\n };\n\n // sort thresholds in ascending order every time an input blurs\n const handleThresholdBlur = () => {\n if (steps !== undefined) {\n const sortedSteps = [...steps];\n sortedSteps.sort((a, b) => a.value - b.value);\n if (thresholds !== undefined) {\n onChange(\n produce(thresholds, (draft) => {\n draft.steps = sortedSteps;\n })\n );\n }\n }\n };\n\n const deleteThreshold = (i: number): void => {\n if (thresholds !== undefined) {\n const updatedThresholds = produce(thresholds, (draft) => {\n if (draft.steps) {\n draft.steps.splice(i, 1);\n }\n });\n onChange(updatedThresholds);\n }\n };\n\n const addThresholdInput = (): void => {\n focusRef.current = true;\n if (thresholds === undefined) {\n onChange({\n steps: [{ value: DEFAULT_STEP }],\n });\n } else {\n onChange(\n produce(thresholds, (draft) => {\n const steps = draft.steps;\n if (steps?.length) {\n const lastStep = steps[steps.length - 1];\n const color = palette[steps.length] ?? getRandomColor(); // we will assign color from the palette first, then generate random color\n steps.push({ color, value: (lastStep?.value ?? 0) + DEFAULT_STEP }); // set new threshold value to last step value + 10\n } else if (steps) {\n steps.push({ value: DEFAULT_STEP });\n }\n })\n );\n }\n };\n\n const handleModeChange = (event: React.MouseEvent, value: string): void => {\n const mode = value === 'Percent' ? 'Percent' : undefined;\n if (thresholds !== undefined) {\n onChange(\n produce(thresholds, (draft) => {\n draft.mode = mode;\n })\n );\n } else {\n onChange({ mode });\n }\n };\n\n return (\n <OptionsEditorGroup\n title=\"Thresholds\"\n icon={\n <IconButton size=\"small\" aria-label=\"add threshold\" onClick={addThresholdInput}>\n <PlusIcon />\n </IconButton>\n }\n >\n <ToggleButtonGroup\n exclusive\n disabled={disablePercentMode}\n value={thresholds?.mode ?? 'Absolute'}\n onChange={handleModeChange}\n sx={{ height: '36px', marginLeft: 'auto' }}\n >\n <ToggleButton aria-label=\"absolute\" value=\"Absolute\">\n <InfoTooltip description=\"Absolute\">#</InfoTooltip>\n </ToggleButton>\n <ToggleButton aria-label=\"percent\" value=\"Percent\">\n <InfoTooltip description=\"Percentage means thresholds relative to min & max\">%</InfoTooltip>\n </ToggleButton>\n </ToggleButtonGroup>\n {steps &&\n steps\n .map((step, i) => (\n <ThresholdInput\n inputRef={i === steps.length - 1 ? recentlyAddedInputRef : undefined}\n key={i}\n label={`T${i + 1}`}\n color={step.color ?? palette[i] ?? defaultThresholdColor}\n value={step.value}\n onColorChange={(color) => handleThresholdColorChange(color, i)}\n onChange={(e) => {\n handleThresholdValueChange(e, i);\n }}\n onDelete={() => {\n deleteThreshold(i);\n }}\n onBlur={handleThresholdBlur}\n />\n ))\n .reverse()}\n {!hideDefault && (\n <Stack flex={1} direction=\"row\" alignItems=\"center\" spacing={1}>\n <ThresholdColorPicker\n label=\"default\"\n color={defaultThresholdColor}\n onColorChange={handleDefaultColorChange}\n />\n <Typography>Default</Typography>\n </Stack>\n )}\n </OptionsEditorGroup>\n );\n}\n\n// https://www.paulirish.com/2009/random-hex-color-code-snippets/\nconst getRandomColor = () => {\n return (\n '#' +\n Math.floor(Math.random() * 16777216)\n .toString(16)\n .padStart(6, '0')\n );\n};\n"],"names":["React","useEffect","useRef","useState","produce","IconButton","ToggleButton","ToggleButtonGroup","Typography","PlusIcon","Stack","InfoTooltip","useChartsTheme","OptionsEditorGroup","ThresholdColorPicker","ThresholdInput","DEFAULT_STEP","ThresholdsEditor","thresholds","onChange","hideDefault","disablePercentMode","defaultColor","palette","defaultThresholdColor","default_color","steps","setSteps","recentlyAddedInputRef","focusRef","current","focus","length","handleThresholdValueChange","e","i","draft","step","value","Number","target","handleThresholdColorChange","color","undefined","handleDefaultColorChange","handleThresholdBlur","sortedSteps","sort","a","b","deleteThreshold","updatedThresholds","splice","addThresholdInput","lastStep","getRandomColor","push","handleModeChange","event","mode","title","icon","size","aria-label","onClick","exclusive","disabled","sx","height","marginLeft","description","map","inputRef","label","onColorChange","onDelete","onBlur","reverse","flex","direction","alignItems","spacing","Math","floor","random","toString","padStart"],"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,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAC3D,OAAOC,OAAO,MAAM,OAAO,CAAC;AAC5B,SAASC,UAAU,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,eAAe,CAAC;AACxF,OAAOC,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,SAASC,KAAK,QAAQ,aAAa,CAAC;AAEpC,SAASC,WAAW,QAAQ,gBAAgB,CAAC;AAC7C,SAASC,cAAc,QAAQ,gCAAgC,CAAC;AAChE,SAASC,k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CAAC,CACjCC,QAAQ,CAAC,EAAE,CAAC,CACZC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACnB;AACJ,CAAC,AAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export * from './ThresholdsEditor';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ThresholdsEditor/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 './ThresholdsEditor';\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,oBAAoB,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,CAAA,EAAE,GAAGL,KAAK,AAAC;IAE/E,4EAA4E;IAC5E,0DAA0D;IAC1D,kDAAkD;IAClD,MAAMM,SAAS,GAAGL,UAAU,CAACM,KAAK,CAAC,GAAG,CAAC,AAAC;QACnBD,GAAY;IAAjC,MAAME,YAAY,GAAGF,CAAAA,GAAY,GAAZA,SAAS,CAA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BC,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,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,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AAE,EAAE,CAACC,KAAK,GAAM,CAAA;4CACdM,KAAK,EAAEN,KAAK,CAACO,OAAO,CAACC,MAAM,CAACC,KAAK;4CACjCI,UAAU,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
|