@perses-dev/components 0.52.0-beta.1 → 0.52.0-beta.2
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/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/src/AlignSelector/AlignSelector.js.map +1 -0
- package/dist/{TransformsEditor → src/AlignSelector}/index.js.map +1 -1
- package/dist/src/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/src/ColorPicker/OptionsColorPicker.js.map +1 -0
- package/dist/src/ColorPicker/index.js.map +1 -0
- package/dist/src/ContentWithLegend/ContentWithLegend.js.map +1 -0
- package/dist/{SettingsAutocomplete → src/ContentWithLegend}/index.js.map +1 -1
- package/dist/src/ContentWithLegend/model/content-with-legend-model.js.map +1 -0
- package/dist/src/DensitySelector/DensitySelector.js.map +1 -0
- package/dist/{ValueMappingEditor → src/DensitySelector}/index.js.map +1 -1
- package/dist/src/Dialog/Dialog.js.map +1 -0
- package/dist/src/Dialog/DiscardChangesConfirmationDialog.js.map +1 -0
- package/dist/{test-utils → src/Dialog}/index.js.map +1 -1
- package/dist/src/DragAndDrop/DragAndDropList.js.map +1 -0
- package/dist/src/DragAndDrop/DragButton.js.map +1 -0
- package/dist/src/DragAndDrop/DropIndicator.js.map +1 -0
- package/dist/src/DragAndDrop/index.js.map +1 -0
- package/dist/src/DragAndDrop/model.js.map +1 -0
- package/dist/src/Drawer/Drawer.js.map +1 -0
- package/dist/src/Drawer/index.js.map +1 -0
- package/dist/src/EChart/EChart.js.map +1 -0
- package/dist/src/EChart/index.js.map +1 -0
- package/dist/src/ErrorAlert.js.map +1 -0
- package/dist/{context/index.js.map → src/ErrorBoundary.js.map} +1 -1
- package/dist/src/FontSizeSelector/FontSizeSelector.js.map +1 -0
- package/dist/{OptionsEditorLayout → src/FontSizeSelector}/index.js.map +1 -1
- package/dist/src/FormEditor/FormActions.js.map +1 -0
- package/dist/{AlignSelector → src/FormEditor}/index.js.map +1 -1
- package/dist/src/FormatControls/FormatControls.js.map +1 -0
- package/dist/{ContentWithLegend → src/FormatControls}/index.js.map +1 -1
- package/dist/src/InfoTooltip/InfoTooltip.js.map +1 -0
- package/dist/{FormatControls → src/InfoTooltip}/index.js.map +1 -1
- package/dist/src/JSONEditor.js.map +1 -0
- package/dist/src/Legend/CompactLegend.js.map +1 -0
- package/dist/src/Legend/Legend.js.map +1 -0
- package/dist/src/Legend/LegendColorBadge.js.map +1 -0
- package/dist/src/Legend/ListLegend.js.map +1 -0
- package/dist/src/Legend/ListLegendItem.js.map +1 -0
- package/dist/src/Legend/TableLegend.js.map +1 -0
- package/dist/src/Legend/index.js.map +1 -0
- package/dist/src/Legend/legend-model.js.map +1 -0
- package/dist/src/LinksEditor/LinksEditor.js.map +1 -0
- package/dist/src/LinksEditor/index.js.map +1 -0
- package/dist/src/ModeSelector/ModeSelector.js.map +1 -0
- package/dist/src/ModeSelector/index.js.map +1 -0
- package/dist/src/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -0
- package/dist/src/OptionsEditorLayout/OptionsEditorControl.js.map +1 -0
- package/dist/src/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -0
- package/dist/src/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -0
- package/dist/src/OptionsEditorLayout/index.js.map +1 -0
- package/dist/src/Overlay/Overlay.js.map +1 -0
- package/dist/{FormEditor → src/Overlay}/index.js.map +1 -1
- package/dist/src/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -0
- package/dist/src/RefreshIntervalPicker/index.js.map +1 -0
- package/dist/src/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -0
- package/dist/src/SettingsAutocomplete/index.js.map +1 -0
- package/dist/src/SortSelector/SortSelector.js.map +1 -0
- package/dist/src/SortSelector/SortSelectorButtons.js.map +1 -0
- package/dist/{DensitySelector → src/SortSelector}/index.js.map +1 -1
- package/dist/src/Table/InnerTable.js.map +1 -0
- package/dist/src/Table/Table.js.map +1 -0
- package/dist/src/Table/TableBody.js.map +1 -0
- package/dist/src/Table/TableCell.js.map +1 -0
- package/dist/src/Table/TableCheckbox.js.map +1 -0
- package/dist/src/Table/TableFoot.js.map +1 -0
- package/dist/src/Table/TableHead.js.map +1 -0
- package/dist/src/Table/TableHeaderCell.js.map +1 -0
- package/dist/src/Table/TableRow.js.map +1 -0
- package/dist/src/Table/VirtualizedTable.js.map +1 -0
- package/dist/src/Table/VirtualizedTableContainer.js.map +1 -0
- package/dist/src/Table/hooks/useTableKeyboardNav.js.map +1 -0
- package/dist/src/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -0
- package/dist/{controls → src/Table}/index.js.map +1 -1
- package/dist/src/Table/model/table-model.js.map +1 -0
- package/dist/src/ThresholdsEditor/ThresholdInput.js.map +1 -0
- package/dist/src/ThresholdsEditor/ThresholdsEditor.js.map +1 -0
- package/dist/src/ThresholdsEditor/index.js.map +1 -0
- package/dist/src/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
- package/dist/src/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
- package/dist/src/TimeRangeSelector/index.js.map +1 -0
- package/dist/src/TimeRangeSelector/utils.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/TooltipContent.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/TooltipHeader.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/index.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/nearby-series.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/tooltip-model.js.map +1 -0
- package/dist/src/TimeSeriesTooltip/utils.js.map +1 -0
- package/dist/src/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
- package/dist/src/ToolbarIconButton/index.js.map +1 -0
- package/dist/src/TransformsEditor/TransformEditor.js.map +1 -0
- package/dist/src/TransformsEditor/TransformEditorContainer.js.map +1 -0
- package/dist/src/TransformsEditor/TransformsEditor.js.map +1 -0
- package/dist/src/TransformsEditor/index.js.map +1 -0
- package/dist/src/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
- package/dist/src/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
- package/dist/{RefreshIntervalPicker → src/ValueMappingEditor}/index.js.map +1 -1
- package/dist/src/YAxisLabel.js.map +1 -0
- package/dist/src/context/ChartsProvider.js.map +1 -0
- package/dist/src/context/SnackbarProvider.js.map +1 -0
- package/dist/src/context/TimeZoneProvider.js.map +1 -0
- package/dist/{test/setup-tests.js.map → src/context/index.js.map} +1 -1
- package/dist/src/controls/TextField.js.map +1 -0
- package/dist/{LinksEditor → src/controls}/index.js.map +1 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/model/graph.js.map +1 -0
- package/dist/src/model/index.js.map +1 -0
- package/dist/src/model/theme.js.map +1 -0
- package/dist/src/model/timeOption.js.map +1 -0
- package/dist/{Dialog → src/test}/index.js.map +1 -1
- package/dist/src/test/render.js.map +1 -0
- package/dist/src/test/setup-tests.js.map +1 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/theme.js.map +1 -0
- package/dist/src/theme/component-overrides/alert.js.map +1 -0
- package/dist/src/theme/component-overrides/paper.js.map +1 -0
- package/dist/src/theme/index.js.map +1 -0
- package/dist/src/theme/palette/background.js.map +1 -0
- package/dist/src/theme/palette/colors/blue.js.map +1 -0
- package/dist/src/theme/palette/colors/common.js.map +1 -0
- package/dist/src/theme/palette/colors/green.js.map +1 -0
- package/dist/src/theme/palette/colors/grey.js.map +1 -0
- package/dist/src/theme/palette/colors/index.js.map +1 -0
- package/dist/src/theme/palette/colors/orange.js.map +1 -0
- package/dist/src/theme/palette/colors/purple.js.map +1 -0
- package/dist/src/theme/palette/colors/red.js.map +1 -0
- package/dist/src/theme/palette/colors/types.js.map +1 -0
- package/dist/src/theme/palette/error.js.map +1 -0
- package/dist/src/theme/palette/grey.js.map +1 -0
- package/dist/src/theme/palette/index.js.map +1 -0
- package/dist/src/theme/palette/palette-options.js.map +1 -0
- package/dist/src/theme/palette/primary.js.map +1 -0
- package/dist/src/theme/palette/secondary.js.map +1 -0
- package/dist/src/theme/palette/success.js.map +1 -0
- package/dist/src/theme/palette/text.js.map +1 -0
- package/dist/src/theme/palette/warning.js.map +1 -0
- package/dist/src/theme/theme.js.map +1 -0
- package/dist/src/theme/types/ThemeExtension.d.js.map +1 -0
- package/dist/src/theme/typography.js.map +1 -0
- package/dist/src/utils/axis.js.map +1 -0
- package/dist/src/utils/chart-actions.js.map +1 -0
- package/dist/src/utils/combine-sx.js.map +1 -0
- package/dist/src/utils/component-ids.js.map +1 -0
- package/dist/src/utils/format.js.map +1 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/mathjs.js.map +1 -0
- package/dist/src/utils/theme-gen.js.map +1 -0
- package/package.json +2 -2
- package/dist/AlignSelector/AlignSelector.js.map +0 -1
- package/dist/ColorPicker/ColorPicker.js.map +0 -1
- package/dist/ColorPicker/OptionsColorPicker.js.map +0 -1
- package/dist/ColorPicker/index.js.map +0 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +0 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +0 -1
- package/dist/DensitySelector/DensitySelector.js.map +0 -1
- package/dist/Dialog/Dialog.js.map +0 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +0 -1
- package/dist/DragAndDrop/DragAndDropList.js.map +0 -1
- package/dist/DragAndDrop/DragButton.js.map +0 -1
- package/dist/DragAndDrop/DropIndicator.js.map +0 -1
- package/dist/DragAndDrop/index.js.map +0 -1
- package/dist/DragAndDrop/model.js.map +0 -1
- package/dist/Drawer/Drawer.js.map +0 -1
- package/dist/Drawer/index.js.map +0 -1
- package/dist/EChart/EChart.js.map +0 -1
- package/dist/EChart/index.js.map +0 -1
- package/dist/ErrorAlert.js.map +0 -1
- package/dist/ErrorBoundary.js.map +0 -1
- package/dist/FontSizeSelector/FontSizeSelector.js.map +0 -1
- package/dist/FontSizeSelector/index.js.map +0 -1
- package/dist/FormEditor/FormActions.js.map +0 -1
- package/dist/FormatControls/FormatControls.js.map +0 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +0 -1
- package/dist/InfoTooltip/index.js.map +0 -1
- package/dist/JSONEditor.js.map +0 -1
- package/dist/Legend/CompactLegend.js.map +0 -1
- package/dist/Legend/Legend.js.map +0 -1
- package/dist/Legend/LegendColorBadge.js.map +0 -1
- package/dist/Legend/ListLegend.js.map +0 -1
- package/dist/Legend/ListLegendItem.js.map +0 -1
- package/dist/Legend/TableLegend.js.map +0 -1
- package/dist/Legend/index.js.map +0 -1
- package/dist/Legend/legend-model.js.map +0 -1
- package/dist/LinksEditor/LinksEditor.js.map +0 -1
- package/dist/ModeSelector/ModeSelector.js.map +0 -1
- package/dist/ModeSelector/index.js.map +0 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +0 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +0 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +0 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +0 -1
- package/dist/Overlay/Overlay.js.map +0 -1
- package/dist/Overlay/index.js.map +0 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +0 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +0 -1
- package/dist/SortSelector/SortSelector.js.map +0 -1
- package/dist/SortSelector/SortSelectorButtons.js.map +0 -1
- package/dist/SortSelector/index.js.map +0 -1
- package/dist/Table/InnerTable.js.map +0 -1
- package/dist/Table/Table.js.map +0 -1
- package/dist/Table/TableBody.js.map +0 -1
- package/dist/Table/TableCell.js.map +0 -1
- package/dist/Table/TableCheckbox.js.map +0 -1
- package/dist/Table/TableFoot.js.map +0 -1
- package/dist/Table/TableHead.js.map +0 -1
- package/dist/Table/TableHeaderCell.js.map +0 -1
- package/dist/Table/TableRow.js.map +0 -1
- package/dist/Table/VirtualizedTable.js.map +0 -1
- package/dist/Table/VirtualizedTableContainer.js.map +0 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +0 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +0 -1
- package/dist/Table/index.js.map +0 -1
- package/dist/Table/model/table-model.js.map +0 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +0 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +0 -1
- package/dist/ThresholdsEditor/index.js.map +0 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +0 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +0 -1
- package/dist/TimeRangeSelector/index.js.map +0 -1
- package/dist/TimeRangeSelector/utils.js.map +0 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +0 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +0 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +0 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +0 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +0 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +0 -1
- package/dist/TimeSeriesTooltip/index.js.map +0 -1
- package/dist/TimeSeriesTooltip/nearby-series.js.map +0 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +0 -1
- package/dist/TimeSeriesTooltip/utils.js.map +0 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +0 -1
- package/dist/ToolbarIconButton/index.js.map +0 -1
- package/dist/TransformsEditor/TransformEditor.js.map +0 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +0 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +0 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +0 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +0 -1
- package/dist/YAxisLabel.js.map +0 -1
- package/dist/context/ChartsProvider.js.map +0 -1
- package/dist/context/SnackbarProvider.js.map +0 -1
- package/dist/context/TimeZoneProvider.js.map +0 -1
- package/dist/controls/TextField.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/model/graph.js.map +0 -1
- package/dist/model/index.js.map +0 -1
- package/dist/model/theme.js.map +0 -1
- package/dist/model/timeOption.js.map +0 -1
- package/dist/test/index.js.map +0 -1
- package/dist/test/render.js.map +0 -1
- package/dist/test-utils/theme.js.map +0 -1
- package/dist/theme/component-overrides/alert.js.map +0 -1
- package/dist/theme/component-overrides/paper.js.map +0 -1
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/palette/background.js.map +0 -1
- package/dist/theme/palette/colors/blue.js.map +0 -1
- package/dist/theme/palette/colors/common.js.map +0 -1
- package/dist/theme/palette/colors/green.js.map +0 -1
- package/dist/theme/palette/colors/grey.js.map +0 -1
- package/dist/theme/palette/colors/index.js.map +0 -1
- package/dist/theme/palette/colors/orange.js.map +0 -1
- package/dist/theme/palette/colors/purple.js.map +0 -1
- package/dist/theme/palette/colors/red.js.map +0 -1
- package/dist/theme/palette/colors/types.js.map +0 -1
- package/dist/theme/palette/error.js.map +0 -1
- package/dist/theme/palette/grey.js.map +0 -1
- package/dist/theme/palette/index.js.map +0 -1
- package/dist/theme/palette/palette-options.js.map +0 -1
- package/dist/theme/palette/primary.js.map +0 -1
- package/dist/theme/palette/secondary.js.map +0 -1
- package/dist/theme/palette/success.js.map +0 -1
- package/dist/theme/palette/text.js.map +0 -1
- package/dist/theme/palette/warning.js.map +0 -1
- package/dist/theme/theme.js.map +0 -1
- package/dist/theme/types/ThemeExtension.d.js.map +0 -1
- package/dist/theme/typography.js.map +0 -1
- package/dist/utils/axis.js.map +0 -1
- package/dist/utils/chart-actions.js.map +0 -1
- package/dist/utils/combine-sx.js.map +0 -1
- package/dist/utils/component-ids.js.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/mathjs.js.map +0 -1
- package/dist/utils/theme-gen.js.map +0 -1
- /package/dist/cjs/{AlignSelector → src/AlignSelector}/AlignSelector.js +0 -0
- /package/dist/cjs/{AlignSelector → src/AlignSelector}/index.js +0 -0
- /package/dist/cjs/{ColorPicker → src/ColorPicker}/ColorPicker.js +0 -0
- /package/dist/cjs/{ColorPicker → src/ColorPicker}/OptionsColorPicker.js +0 -0
- /package/dist/cjs/{ColorPicker → src/ColorPicker}/index.js +0 -0
- /package/dist/cjs/{ContentWithLegend → src/ContentWithLegend}/ContentWithLegend.js +0 -0
- /package/dist/cjs/{ContentWithLegend → src/ContentWithLegend}/index.js +0 -0
- /package/dist/cjs/{ContentWithLegend → src/ContentWithLegend}/model/content-with-legend-model.js +0 -0
- /package/dist/cjs/{DensitySelector → src/DensitySelector}/DensitySelector.js +0 -0
- /package/dist/cjs/{DensitySelector → src/DensitySelector}/index.js +0 -0
- /package/dist/cjs/{Dialog → src/Dialog}/Dialog.js +0 -0
- /package/dist/cjs/{Dialog → src/Dialog}/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/cjs/{Dialog → src/Dialog}/index.js +0 -0
- /package/dist/cjs/{DragAndDrop → src/DragAndDrop}/DragAndDropList.js +0 -0
- /package/dist/cjs/{DragAndDrop → src/DragAndDrop}/DragButton.js +0 -0
- /package/dist/cjs/{DragAndDrop → src/DragAndDrop}/DropIndicator.js +0 -0
- /package/dist/cjs/{DragAndDrop → src/DragAndDrop}/index.js +0 -0
- /package/dist/cjs/{DragAndDrop → src/DragAndDrop}/model.js +0 -0
- /package/dist/cjs/{Drawer → src/Drawer}/Drawer.js +0 -0
- /package/dist/cjs/{Drawer → src/Drawer}/index.js +0 -0
- /package/dist/cjs/{EChart → src/EChart}/EChart.js +0 -0
- /package/dist/cjs/{EChart → src/EChart}/index.js +0 -0
- /package/dist/cjs/{ErrorAlert.js → src/ErrorAlert.js} +0 -0
- /package/dist/cjs/{ErrorBoundary.js → src/ErrorBoundary.js} +0 -0
- /package/dist/cjs/{FontSizeSelector → src/FontSizeSelector}/FontSizeSelector.js +0 -0
- /package/dist/cjs/{FontSizeSelector → src/FontSizeSelector}/index.js +0 -0
- /package/dist/cjs/{FormEditor → src/FormEditor}/FormActions.js +0 -0
- /package/dist/cjs/{FormEditor → src/FormEditor}/index.js +0 -0
- /package/dist/cjs/{FormatControls → src/FormatControls}/FormatControls.js +0 -0
- /package/dist/cjs/{FormatControls → src/FormatControls}/index.js +0 -0
- /package/dist/cjs/{InfoTooltip → src/InfoTooltip}/InfoTooltip.js +0 -0
- /package/dist/cjs/{InfoTooltip → src/InfoTooltip}/index.js +0 -0
- /package/dist/cjs/{JSONEditor.js → src/JSONEditor.js} +0 -0
- /package/dist/cjs/{Legend → src/Legend}/CompactLegend.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/Legend.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/LegendColorBadge.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/ListLegend.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/ListLegendItem.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/TableLegend.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/index.js +0 -0
- /package/dist/cjs/{Legend → src/Legend}/legend-model.js +0 -0
- /package/dist/cjs/{LinksEditor → src/LinksEditor}/LinksEditor.js +0 -0
- /package/dist/cjs/{LinksEditor → src/LinksEditor}/index.js +0 -0
- /package/dist/cjs/{ModeSelector → src/ModeSelector}/ModeSelector.js +0 -0
- /package/dist/cjs/{ModeSelector → src/ModeSelector}/index.js +0 -0
- /package/dist/cjs/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorColumn.js +0 -0
- /package/dist/cjs/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorControl.js +0 -0
- /package/dist/cjs/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorGrid.js +0 -0
- /package/dist/cjs/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorGroup.js +0 -0
- /package/dist/cjs/{OptionsEditorLayout → src/OptionsEditorLayout}/index.js +0 -0
- /package/dist/cjs/{Overlay → src/Overlay}/Overlay.js +0 -0
- /package/dist/cjs/{Overlay → src/Overlay}/index.js +0 -0
- /package/dist/cjs/{RefreshIntervalPicker → src/RefreshIntervalPicker}/RefreshIntervalPicker.js +0 -0
- /package/dist/cjs/{RefreshIntervalPicker → src/RefreshIntervalPicker}/index.js +0 -0
- /package/dist/cjs/{SettingsAutocomplete → src/SettingsAutocomplete}/SettingsAutocomplete.js +0 -0
- /package/dist/cjs/{SettingsAutocomplete → src/SettingsAutocomplete}/index.js +0 -0
- /package/dist/cjs/{SortSelector → src/SortSelector}/SortSelector.js +0 -0
- /package/dist/cjs/{SortSelector → src/SortSelector}/SortSelectorButtons.js +0 -0
- /package/dist/cjs/{SortSelector → src/SortSelector}/index.js +0 -0
- /package/dist/cjs/{Table → src/Table}/InnerTable.js +0 -0
- /package/dist/cjs/{Table → src/Table}/Table.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableBody.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableCell.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableCheckbox.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableFoot.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableHead.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableHeaderCell.js +0 -0
- /package/dist/cjs/{Table → src/Table}/TableRow.js +0 -0
- /package/dist/cjs/{Table → src/Table}/VirtualizedTable.js +0 -0
- /package/dist/cjs/{Table → src/Table}/VirtualizedTableContainer.js +0 -0
- /package/dist/cjs/{Table → src/Table}/hooks/useTableKeyboardNav.js +0 -0
- /package/dist/cjs/{Table → src/Table}/hooks/useVirtualizedTableKeyboardNav.js +0 -0
- /package/dist/cjs/{Table → src/Table}/index.js +0 -0
- /package/dist/cjs/{Table → src/Table}/model/table-model.js +0 -0
- /package/dist/cjs/{ThresholdsEditor → src/ThresholdsEditor}/ThresholdInput.js +0 -0
- /package/dist/cjs/{ThresholdsEditor → src/ThresholdsEditor}/ThresholdsEditor.js +0 -0
- /package/dist/cjs/{ThresholdsEditor → src/ThresholdsEditor}/index.js +0 -0
- /package/dist/cjs/{TimeRangeSelector → src/TimeRangeSelector}/DateTimeRangePicker.js +0 -0
- /package/dist/cjs/{TimeRangeSelector → src/TimeRangeSelector}/TimeRangeSelector.js +0 -0
- /package/dist/cjs/{TimeRangeSelector → src/TimeRangeSelector}/index.js +0 -0
- /package/dist/cjs/{TimeRangeSelector → src/TimeRangeSelector}/utils.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesInfo.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesLabelsStack.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesMarker.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TimeChartTooltip.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TooltipContent.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TooltipHeader.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/index.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/nearby-series.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/tooltip-model.js +0 -0
- /package/dist/cjs/{TimeSeriesTooltip → src/TimeSeriesTooltip}/utils.js +0 -0
- /package/dist/cjs/{ToolbarIconButton → src/ToolbarIconButton}/ToolbarIconButton.js +0 -0
- /package/dist/cjs/{ToolbarIconButton → src/ToolbarIconButton}/index.js +0 -0
- /package/dist/cjs/{TransformsEditor → src/TransformsEditor}/TransformEditor.js +0 -0
- /package/dist/cjs/{TransformsEditor → src/TransformsEditor}/TransformEditorContainer.js +0 -0
- /package/dist/cjs/{TransformsEditor → src/TransformsEditor}/TransformsEditor.js +0 -0
- /package/dist/cjs/{TransformsEditor → src/TransformsEditor}/index.js +0 -0
- /package/dist/cjs/{ValueMappingEditor → src/ValueMappingEditor}/ValueMappingEditor.js +0 -0
- /package/dist/cjs/{ValueMappingEditor → src/ValueMappingEditor}/ValueMappingsEditor.js +0 -0
- /package/dist/cjs/{ValueMappingEditor → src/ValueMappingEditor}/index.js +0 -0
- /package/dist/cjs/{YAxisLabel.js → src/YAxisLabel.js} +0 -0
- /package/dist/cjs/{context → src/context}/ChartsProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/SnackbarProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/TimeZoneProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/index.js +0 -0
- /package/dist/cjs/{controls → src/controls}/TextField.js +0 -0
- /package/dist/cjs/{controls → src/controls}/index.js +0 -0
- /package/dist/cjs/{index.js → src/index.js} +0 -0
- /package/dist/cjs/{model → src/model}/graph.js +0 -0
- /package/dist/cjs/{model → src/model}/index.js +0 -0
- /package/dist/cjs/{model → src/model}/theme.js +0 -0
- /package/dist/cjs/{model → src/model}/timeOption.js +0 -0
- /package/dist/cjs/{test → src/test}/index.js +0 -0
- /package/dist/cjs/{test → src/test}/render.js +0 -0
- /package/dist/cjs/{test → src/test}/setup-tests.js +0 -0
- /package/dist/cjs/{test-utils → src/test-utils}/index.js +0 -0
- /package/dist/cjs/{test-utils → src/test-utils}/theme.js +0 -0
- /package/dist/cjs/{theme → src/theme}/component-overrides/alert.js +0 -0
- /package/dist/cjs/{theme → src/theme}/component-overrides/paper.js +0 -0
- /package/dist/cjs/{theme → src/theme}/index.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/background.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/blue.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/common.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/green.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/grey.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/index.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/orange.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/purple.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/red.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/colors/types.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/error.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/grey.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/index.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/palette-options.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/primary.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/secondary.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/success.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/text.js +0 -0
- /package/dist/cjs/{theme → src/theme}/palette/warning.js +0 -0
- /package/dist/cjs/{theme → src/theme}/theme.js +0 -0
- /package/dist/cjs/{theme → src/theme}/types/ThemeExtension.d.js +0 -0
- /package/dist/cjs/{theme → src/theme}/typography.js +0 -0
- /package/dist/cjs/{utils → src/utils}/axis.js +0 -0
- /package/dist/cjs/{utils → src/utils}/chart-actions.js +0 -0
- /package/dist/cjs/{utils → src/utils}/combine-sx.js +0 -0
- /package/dist/cjs/{utils → src/utils}/component-ids.js +0 -0
- /package/dist/cjs/{utils → src/utils}/format.js +0 -0
- /package/dist/cjs/{utils → src/utils}/index.js +0 -0
- /package/dist/cjs/{utils → src/utils}/mathjs.js +0 -0
- /package/dist/cjs/{utils → src/utils}/theme-gen.js +0 -0
- /package/dist/{AlignSelector → src/AlignSelector}/AlignSelector.js +0 -0
- /package/dist/{AlignSelector → src/AlignSelector}/index.js +0 -0
- /package/dist/{ColorPicker → src/ColorPicker}/ColorPicker.js +0 -0
- /package/dist/{ColorPicker → src/ColorPicker}/OptionsColorPicker.js +0 -0
- /package/dist/{ColorPicker → src/ColorPicker}/index.js +0 -0
- /package/dist/{ContentWithLegend → src/ContentWithLegend}/ContentWithLegend.js +0 -0
- /package/dist/{ContentWithLegend → src/ContentWithLegend}/index.js +0 -0
- /package/dist/{ContentWithLegend → src/ContentWithLegend}/model/content-with-legend-model.js +0 -0
- /package/dist/{DensitySelector → src/DensitySelector}/DensitySelector.js +0 -0
- /package/dist/{DensitySelector → src/DensitySelector}/index.js +0 -0
- /package/dist/{Dialog → src/Dialog}/Dialog.js +0 -0
- /package/dist/{Dialog → src/Dialog}/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/{Dialog → src/Dialog}/index.js +0 -0
- /package/dist/{DragAndDrop → src/DragAndDrop}/DragAndDropList.js +0 -0
- /package/dist/{DragAndDrop → src/DragAndDrop}/DragButton.js +0 -0
- /package/dist/{DragAndDrop → src/DragAndDrop}/DropIndicator.js +0 -0
- /package/dist/{DragAndDrop → src/DragAndDrop}/index.js +0 -0
- /package/dist/{DragAndDrop → src/DragAndDrop}/model.js +0 -0
- /package/dist/{Drawer → src/Drawer}/Drawer.js +0 -0
- /package/dist/{Drawer → src/Drawer}/index.js +0 -0
- /package/dist/{EChart → src/EChart}/EChart.js +0 -0
- /package/dist/{EChart → src/EChart}/index.js +0 -0
- /package/dist/{ErrorAlert.js → src/ErrorAlert.js} +0 -0
- /package/dist/{ErrorBoundary.js → src/ErrorBoundary.js} +0 -0
- /package/dist/{FontSizeSelector → src/FontSizeSelector}/FontSizeSelector.js +0 -0
- /package/dist/{FontSizeSelector → src/FontSizeSelector}/index.js +0 -0
- /package/dist/{FormEditor → src/FormEditor}/FormActions.js +0 -0
- /package/dist/{FormEditor → src/FormEditor}/index.js +0 -0
- /package/dist/{FormatControls → src/FormatControls}/FormatControls.js +0 -0
- /package/dist/{FormatControls → src/FormatControls}/index.js +0 -0
- /package/dist/{InfoTooltip → src/InfoTooltip}/InfoTooltip.js +0 -0
- /package/dist/{InfoTooltip → src/InfoTooltip}/index.js +0 -0
- /package/dist/{JSONEditor.js → src/JSONEditor.js} +0 -0
- /package/dist/{Legend → src/Legend}/CompactLegend.js +0 -0
- /package/dist/{Legend → src/Legend}/Legend.js +0 -0
- /package/dist/{Legend → src/Legend}/LegendColorBadge.js +0 -0
- /package/dist/{Legend → src/Legend}/ListLegend.js +0 -0
- /package/dist/{Legend → src/Legend}/ListLegendItem.js +0 -0
- /package/dist/{Legend → src/Legend}/TableLegend.js +0 -0
- /package/dist/{Legend → src/Legend}/index.js +0 -0
- /package/dist/{Legend → src/Legend}/legend-model.js +0 -0
- /package/dist/{LinksEditor → src/LinksEditor}/LinksEditor.js +0 -0
- /package/dist/{LinksEditor → src/LinksEditor}/index.js +0 -0
- /package/dist/{ModeSelector → src/ModeSelector}/ModeSelector.js +0 -0
- /package/dist/{ModeSelector → src/ModeSelector}/index.js +0 -0
- /package/dist/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorColumn.js +0 -0
- /package/dist/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorControl.js +0 -0
- /package/dist/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorGrid.js +0 -0
- /package/dist/{OptionsEditorLayout → src/OptionsEditorLayout}/OptionsEditorGroup.js +0 -0
- /package/dist/{OptionsEditorLayout → src/OptionsEditorLayout}/index.js +0 -0
- /package/dist/{Overlay → src/Overlay}/Overlay.js +0 -0
- /package/dist/{Overlay → src/Overlay}/index.js +0 -0
- /package/dist/{RefreshIntervalPicker → src/RefreshIntervalPicker}/RefreshIntervalPicker.js +0 -0
- /package/dist/{RefreshIntervalPicker → src/RefreshIntervalPicker}/index.js +0 -0
- /package/dist/{SettingsAutocomplete → src/SettingsAutocomplete}/SettingsAutocomplete.js +0 -0
- /package/dist/{SettingsAutocomplete → src/SettingsAutocomplete}/index.js +0 -0
- /package/dist/{SortSelector → src/SortSelector}/SortSelector.js +0 -0
- /package/dist/{SortSelector → src/SortSelector}/SortSelectorButtons.js +0 -0
- /package/dist/{SortSelector → src/SortSelector}/index.js +0 -0
- /package/dist/{Table → src/Table}/InnerTable.js +0 -0
- /package/dist/{Table → src/Table}/Table.js +0 -0
- /package/dist/{Table → src/Table}/TableBody.js +0 -0
- /package/dist/{Table → src/Table}/TableCell.js +0 -0
- /package/dist/{Table → src/Table}/TableCheckbox.js +0 -0
- /package/dist/{Table → src/Table}/TableFoot.js +0 -0
- /package/dist/{Table → src/Table}/TableHead.js +0 -0
- /package/dist/{Table → src/Table}/TableHeaderCell.js +0 -0
- /package/dist/{Table → src/Table}/TableRow.js +0 -0
- /package/dist/{Table → src/Table}/VirtualizedTable.js +0 -0
- /package/dist/{Table → src/Table}/VirtualizedTableContainer.js +0 -0
- /package/dist/{Table → src/Table}/hooks/useTableKeyboardNav.js +0 -0
- /package/dist/{Table → src/Table}/hooks/useVirtualizedTableKeyboardNav.js +0 -0
- /package/dist/{Table → src/Table}/index.js +0 -0
- /package/dist/{Table → src/Table}/model/table-model.js +0 -0
- /package/dist/{ThresholdsEditor → src/ThresholdsEditor}/ThresholdInput.js +0 -0
- /package/dist/{ThresholdsEditor → src/ThresholdsEditor}/ThresholdsEditor.js +0 -0
- /package/dist/{ThresholdsEditor → src/ThresholdsEditor}/index.js +0 -0
- /package/dist/{TimeRangeSelector → src/TimeRangeSelector}/DateTimeRangePicker.js +0 -0
- /package/dist/{TimeRangeSelector → src/TimeRangeSelector}/TimeRangeSelector.js +0 -0
- /package/dist/{TimeRangeSelector → src/TimeRangeSelector}/index.js +0 -0
- /package/dist/{TimeRangeSelector → src/TimeRangeSelector}/utils.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesInfo.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesLabelsStack.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/SeriesMarker.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TimeChartTooltip.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TooltipContent.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/TooltipHeader.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/index.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/nearby-series.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/tooltip-model.js +0 -0
- /package/dist/{TimeSeriesTooltip → src/TimeSeriesTooltip}/utils.js +0 -0
- /package/dist/{ToolbarIconButton → src/ToolbarIconButton}/ToolbarIconButton.js +0 -0
- /package/dist/{ToolbarIconButton → src/ToolbarIconButton}/index.js +0 -0
- /package/dist/{TransformsEditor → src/TransformsEditor}/TransformEditor.js +0 -0
- /package/dist/{TransformsEditor → src/TransformsEditor}/TransformEditorContainer.js +0 -0
- /package/dist/{TransformsEditor → src/TransformsEditor}/TransformsEditor.js +0 -0
- /package/dist/{TransformsEditor → src/TransformsEditor}/index.js +0 -0
- /package/dist/{ValueMappingEditor → src/ValueMappingEditor}/ValueMappingEditor.js +0 -0
- /package/dist/{ValueMappingEditor → src/ValueMappingEditor}/ValueMappingsEditor.js +0 -0
- /package/dist/{ValueMappingEditor → src/ValueMappingEditor}/index.js +0 -0
- /package/dist/{YAxisLabel.js → src/YAxisLabel.js} +0 -0
- /package/dist/{context → src/context}/ChartsProvider.js +0 -0
- /package/dist/{context → src/context}/SnackbarProvider.js +0 -0
- /package/dist/{context → src/context}/TimeZoneProvider.js +0 -0
- /package/dist/{context → src/context}/index.js +0 -0
- /package/dist/{controls → src/controls}/TextField.js +0 -0
- /package/dist/{controls → src/controls}/index.js +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{model → src/model}/graph.js +0 -0
- /package/dist/{model → src/model}/index.js +0 -0
- /package/dist/{model → src/model}/theme.js +0 -0
- /package/dist/{model → src/model}/timeOption.js +0 -0
- /package/dist/{test → src/test}/index.js +0 -0
- /package/dist/{test → src/test}/render.js +0 -0
- /package/dist/{test → src/test}/setup-tests.js +0 -0
- /package/dist/{test-utils → src/test-utils}/index.js +0 -0
- /package/dist/{test-utils → src/test-utils}/theme.js +0 -0
- /package/dist/{theme → src/theme}/component-overrides/alert.js +0 -0
- /package/dist/{theme → src/theme}/component-overrides/paper.js +0 -0
- /package/dist/{theme → src/theme}/index.js +0 -0
- /package/dist/{theme → src/theme}/palette/background.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/blue.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/common.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/green.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/grey.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/index.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/orange.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/purple.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/red.js +0 -0
- /package/dist/{theme → src/theme}/palette/colors/types.js +0 -0
- /package/dist/{theme → src/theme}/palette/error.js +0 -0
- /package/dist/{theme → src/theme}/palette/grey.js +0 -0
- /package/dist/{theme → src/theme}/palette/index.js +0 -0
- /package/dist/{theme → src/theme}/palette/palette-options.js +0 -0
- /package/dist/{theme → src/theme}/palette/primary.js +0 -0
- /package/dist/{theme → src/theme}/palette/secondary.js +0 -0
- /package/dist/{theme → src/theme}/palette/success.js +0 -0
- /package/dist/{theme → src/theme}/palette/text.js +0 -0
- /package/dist/{theme → src/theme}/palette/warning.js +0 -0
- /package/dist/{theme → src/theme}/theme.js +0 -0
- /package/dist/{theme → src/theme}/types/ThemeExtension.d.js +0 -0
- /package/dist/{theme → src/theme}/typography.js +0 -0
- /package/dist/{utils → src/utils}/axis.js +0 -0
- /package/dist/{utils → src/utils}/chart-actions.js +0 -0
- /package/dist/{utils → src/utils}/combine-sx.js +0 -0
- /package/dist/{utils → src/utils}/component-ids.js +0 -0
- /package/dist/{utils → src/utils}/format.js +0 -0
- /package/dist/{utils → src/utils}/index.js +0 -0
- /package/dist/{utils → src/utils}/mathjs.js +0 -0
- /package/dist/{utils → src/utils}/theme-gen.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeRangeSelector/utils.ts"],"sourcesContent":["// Copyright 2024 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 { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange, isRelativeTimeRange, TimeRangeValue } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\nexport const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';\n\nexport interface CustomTimeOption {\n value: TimeRangeValue | undefined;\n display: string;\n}\n\nexport function buildCustomTimeOption(value: AbsoluteTimeRange | undefined, timeZone: string): CustomTimeOption {\n return { value, display: formatTimeRange(value, timeZone) };\n}\n\n/**\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date): boolean {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n * @param timeRange absolute time range with a start and end datetime\n * @param dateFormat date format string\n * @param timeZone\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string): string {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n\n/**\n * Format the time range for display purpose only (e.g. in the selector)\n * @param value\n * @param timeZone\n */\nexport function formatTimeRange(value: TimeRangeValue | undefined, timeZone: string): string {\n if (!value) {\n return 'Custom Time Range';\n }\n return !isRelativeTimeRange(value) ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;\n}\n"],"names":["isBefore","isValid","isRelativeTimeRange","formatWithTimeZone","DATE_TIME_FORMAT","buildCustomTimeOption","value","timeZone","display","formatTimeRange","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","formattedStart","start","formattedEnd","end","pastDuration"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAC7C,SAA4BC,mBAAmB,QAAwB,mBAAmB;AAC1F,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,OAAO,MAAMC,mBAAmB,sBAAsB;AAOtD,OAAO,SAASC,sBAAsBC,KAAoC,EAAEC,QAAgB;IAC1F,OAAO;QAAED;QAAOE,SAASC,gBAAgBH,OAAOC;IAAU;AAC5D;AAEA;;CAEC,GACD,OAAO,SAASG,kBAAkBC,SAAe,EAAEC,OAAa;IAC9D,oCAAoC;IACpC,IAAI,CAACX,QAAQU,cAAc,CAACV,QAAQW,UAAU;QAC5CC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,IAAI,CAACd,SAASW,WAAWC,UAAU;QACjCC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,OAAO;AACT;AAEA;;;;;CAKC,GACD,OAAO,SAASC,oBAAoBC,SAA4B,EAAEC,UAAkB,EAAEV,QAAiB;IACrG,MAAMW,iBAAiBf,mBAAmBa,UAAUG,KAAK,EAAEF,YAAYV;IACvE,MAAMa,eAAejB,mBAAmBa,UAAUK,GAAG,EAAEJ,YAAYV;IACnE,OAAO,GAAGW,eAAe,GAAG,EAAEE,cAAc;AAC9C;AAEA;;;;CAIC,GACD,OAAO,SAASX,gBAAgBH,KAAiC,EAAEC,QAAgB;IACjF,IAAI,CAACD,OAAO;QACV,OAAO;IACT;IACA,OAAO,CAACJ,oBAAoBI,SAASS,oBAAoBT,OAAOF,kBAAkBG,YAAYD,MAAMgB,YAAY;AAClH"}
|
|
@@ -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 { ReactElement } from 'react';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH, EMPHASIZED_SERIES_DESCRIPTION, NEARBY_SERIES_DESCRIPTION } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n emphasizeText?: boolean;\n wrapLabels?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps): ReactElement {\n const { seriesName, formattedY, markerColor, totalSeries, emphasizeText = false, wrapLabels = true } = props;\n\n // metric __name__ comes before opening curly brace, ignore if not populated\n // ex with metric name: node_load15{env=\"demo\",job=\"node\"}\n // ex without metric name: {env=\"demo\",job=\"node\"}\n const splitName = seriesName.split('{');\n const seriesLabels = splitName[1] ?? seriesName;\n\n // remove curly braces that wrap labels\n const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');\n\n // determine whether to show labels on separate lines\n const splitLabels = formattedSeriesLabels.split(',');\n if (totalSeries === 1 && splitLabels.length > 1) {\n const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';\n return (\n <SeriesLabelsStack\n formattedY={formattedY}\n metricName={metricName}\n metricLabels={splitLabels}\n markerColor={markerColor}\n />\n );\n }\n\n // add space after commas so wrapLabels works\n const formattedSeriesInfo = seriesName.replace(/[,]/g, ', ');\n\n return (\n <Box\n sx={{\n display: 'table-row',\n paddingTop: 0.5,\n }}\n >\n <Box\n sx={{\n display: 'table-cell',\n maxWidth: '520px',\n }}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.5 }} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n display: 'inline-block',\n width: 'calc(100% - 20px)',\n minWidth: 150,\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n color: theme.palette.common.white,\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n aria-label={emphasizeText ? EMPHASIZED_SERIES_DESCRIPTION : NEARBY_SERIES_DESCRIPTION}\n >\n {formattedSeriesInfo}\n </Box>\n </Box>\n <Box\n sx={(theme) => ({\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n })}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","EMPHASIZED_SERIES_DESCRIPTION","NEARBY_SERIES_DESCRIPTION","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","emphasizeText","wrapLabels","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","formattedSeriesInfo","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","fontWeight","typography","fontWeightBold","fontWeightRegular","textOverflow","whiteSpace","aria-label","paddingLeft","textAlign","verticalAlign"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,wBAAwB,EAAEC,6BAA6B,EAAEC,yBAAyB,QAAQ,kBAAkB;AAYrH,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAEC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAEC,aAAa,IAAI,EAAE,GAAGN;IAEvG,4EAA4E;IAC5E,0DAA0D;IAC1D,kDAAkD;IAClD,MAAMO,YAAYN,WAAWO,KAAK,CAAC;IACnC,MAAMC,eAAeF,SAAS,CAAC,EAAE,IAAIN;IAErC,uCAAuC;IACvC,MAAMS,wBAAwBD,aAAaE,OAAO,CAAC,SAAS;IAE5D,qDAAqD;IACrD,MAAMC,cAAcF,sBAAsBF,KAAK,CAAC;IAChD,IAAIJ,gBAAgB,KAAKQ,YAAYC,MAAM,GAAG,GAAG;QAC/C,MAAMC,aAAaP,SAAS,CAAC,EAAE,GAAG,GAAGA,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG;QACvD,qBACE,KAACZ;YACCO,YAAYA;YACZY,YAAYA;YACZC,cAAcH;YACdT,aAAaA;;IAGnB;IAEA,6CAA6C;IAC7C,MAAMa,sBAAsBf,WAAWU,OAAO,CAAC,QAAQ;IAEvD,qBACE,MAAClB;QACCwB,IAAI;YACFC,SAAS;YACTC,YAAY;QACd;;0BAEA,MAAC1B;gBACCwB,IAAI;oBACFC,SAAS;oBACTE,UAAU;gBACZ;;kCAEA,KAAC1B;wBAAaS,aAAaA;wBAAac,IAAI;4BAAEI,WAAW;wBAAI;;kCAC7D,KAAC5B;wBACC6B,WAAU;wBACVL,IAAI,CAACM,QAAW,CAAA;gCACdL,SAAS;gCACTM,OAAO;gCACPC,UAAU;gCACVL,UAAUxB;gCACV8B,UAAU;gCACVC,OAAOJ,MAAMK,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;gCAChGC,cAAc;gCACdC,YAAY9B,aAAa,WAAW;4BACtC,CAAA;wBACA+B,cAAYhC,gBAAgBR,gCAAgCC;kCAE3DkB;;;;0BAGL,KAACvB;gBACCwB,IAAI,CAACM,QAAW,CAAA;wBACdL,SAAS;wBACToB,aAAa;wBACbC,WAAW;wBACXC,eAAe;wBACfT,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;oBAClG,CAAA;0BAEChC;;;;AAIT"}
|
|
@@ -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 { ReactElement } from 'react';\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): ReactElement {\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,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Y,GAAGJ,KAAK,EAAE,CAAC,GAAGA;wBAC1D,MAAMK,iBAAiBJ,UAAUG,YAAYH,MAAMK,OAAO,CAAC,YAAY,MAAML;wBAC7E,qBACE,MAACjC;4BAAgBY,IAAI;gCAAEE,SAAS;gCAAQyB,KAAK;4BAAM;;8CACjD,KAACpC;oCAAWS,IAAI;wCAAEW,UAAU;oCAAO;8CAAIY;;8CACvC,KAAChC;oCACCS,IAAI,CAACC,QAAW,CAAA;4CACdM,OAAON,MAAMO,OAAO,CAACC,MAAM,CAACC,KAAK;4CACjCI,YAAY;4CACZH,UAAU;wCACZ,CAAA;8CAECc;;;2BATKN;oBAad;gBACF;;;;AAIR"}
|
|
@@ -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 { ReactElement } from 'react';\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps): ReactElement {\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,SAASA,GAAG,QAAkB,gBAAgB;AAE9C,SAASC,SAAS,QAAQ,WAAW;AAMrC,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,WAAW,EAAEC,EAAE,EAAE,GAAGF;IAC5B,qBACE,KAACH;QACCK,IAAIJ,UACF;YACEK,SAAS;YACTC,OAAO;YACPC,QAAQ;YACRC,cAAc;YACdC,aAAa;YACbC,eAAe;QACjB,GACAN;QAEFO,OAAO;YAAEC,iBAAiBT;QAAY;;AAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeSeriesTooltip/TimeChartTooltip.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 { memo, MutableRefObject, useRef, useState } from 'react';\nimport { Box, Portal, Stack } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { FormatOptions, TimeSeries } from '@perses-dev/core';\nimport useResizeObserver from 'use-resize-observer';\nimport { TimeChartSeriesMapping } from '../model';\nimport { CursorCoordinates, useMousePosition } from './tooltip-model';\nimport { assembleTransform, getTooltipStyles } from './utils';\nimport { getNearbySeriesData } from './nearby-series';\nimport { TooltipHeader } from './TooltipHeader';\nimport { TooltipContent } from './TooltipContent';\n\nexport interface TimeChartTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n enablePinning?: boolean;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n onUnpinClick?: () => void;\n format?: FormatOptions;\n wrapLabels?: boolean;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n containerId,\n chartRef,\n data,\n seriesMapping,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const transform = useRef<string | undefined>();\n\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null || data === 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\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)}\n style={{\n transform: transform.current,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["memo","useRef","useState","Box","Portal","Stack","useResizeObserver","useMousePosition","assembleTransform","getTooltipStyles","getNearbySeriesData","TooltipHeader","TooltipContent","TimeChartTooltip","containerId","chartRef","data","seriesMapping","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","transform","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","nearbySeries","length","totalSeries","container","sx","theme","style","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,IAAI,EAAoBC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACjE,SAASC,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,OAAOC,uBAAuB,sBAAsB;AAEpD,SAA4BC,gBAAgB,QAAQ,kBAAkB;AACtE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,UAAU;AAC9D,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAkBlD,OAAO,MAAMC,iCAAmBb,KAAK,SAASa,iBAAiB,EAC7DC,WAAW,EACXC,QAAQ,EACRC,IAAI,EACJC,aAAa,EACbC,gBAAgB,IAAI,EACpBC,UAAU,EACVC,MAAM,EACNC,YAAY,EACZC,SAAS,EACa;IACtB,MAAM,CAACC,eAAeC,iBAAiB,GAAGtB,SAAS;IACnD,MAAMuB,YAAYxB;IAElB,MAAMyB,WAA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eSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport { NearbySeriesArray } from './nearby-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps): ReactElement | null {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["useMemo","Box","SeriesInfo","TooltipContent","props","series","wrapLabels","sortedFocusedSeries","sort","a","b","y","sx","theme","display","padding","spacing","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","isClosestToCursor","key","toString","totalSeries","length","emphasizeText"],"mappings":"AAAA,oCAAoC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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, Typography, Stack, Switch } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport { memo, ReactElement } from 'react';\nimport { getDateAndTime } from '../utils';\nimport { NearbySeriesArray } from './nearby-series';\nimport {\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_WIDTH,\n PIN_TOOLTIP_HELP_TEXT,\n UNPIN_TOOLTIP_HELP_TEXT,\n} from './tooltip-model';\n\nexport interface TooltipHeaderProps {\n nearbySeries: NearbySeriesArray;\n totalSeries: number;\n isTooltipPinned: boolean;\n showAllSeries: boolean;\n enablePinning?: boolean;\n onShowAllClick?: (checked: boolean) => void;\n onUnpinClick?: () => void;\n}\n\nexport const TooltipHeader = memo(function TooltipHeader({\n nearbySeries,\n totalSeries,\n isTooltipPinned,\n showAllSeries,\n enablePinning = true,\n onShowAllClick,\n onUnpinClick,\n}: TooltipHeaderProps) {\n const seriesTimeMs = nearbySeries[0]?.date ?? null;\n if (seriesTimeMs === null) {\n return null;\n }\n\n const formatTimeSeriesHeader = (timeMs: number): ReactElement => {\n const { formattedTime, formattedDate } = getDateAndTime(timeMs);\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n // TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT\n const showAllSeriesToggle = enablePinning && totalSeries > 5;\n\n const pinTooltipHelpText = isTooltipPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT;\n\n return (\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box\n sx={{\n width: '100%',\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n paddingBottom: 0.5,\n }}\n >\n {formatTimeSeriesHeader(seriesTimeMs)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography sx={{ fontSize: 11 }}>Show All</Typography>\n <Switch\n checked={showAllSeries}\n size=\"small\"\n onChange={(_, checked) => {\n if (onShowAllClick !== undefined) {\n return onShowAllClick(checked);\n }\n }}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n '& .MuiSwitch-track': {\n backgroundColor: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n {enablePinning && (\n <Stack direction=\"row\" alignItems=\"center\">\n <Typography\n sx={{\n marginRight: 0.5,\n fontSize: 11,\n verticalAlign: 'middle',\n }}\n >\n {pinTooltipHelpText}\n </Typography>\n {isTooltipPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n sx={{\n fontSize: 16,\n cursor: 'pointer',\n }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n )}\n </Stack>\n </Box>\n <Divider\n sx={(theme) => ({\n width: '100%',\n borderColor: theme.palette.grey['500'],\n })}\n />\n </Box>\n );\n});\n"],"names":["Box","Divider","Typography","Stack","Switch","Pin","PinOutline","memo","getDateAndTime","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","PIN_TOOLTIP_HELP_TEXT","UNPIN_TOOLTIP_HELP_TEXT","TooltipHeader","nearbySeries","totalSeries","isTooltipPinned","showAllSeries","enablePinning","onShowAllClick","onUnpinClick","seriesTimeMs","date","formatTimeSeriesHeader","timeMs","formattedTime","formattedDate","variant","sx","theme","color","palette","common","white","strong","showAllSeriesToggle","pinTooltipHelpText","width","maxWidth","padding","spacing","backgroundColor","designSystem","grey","position","top","left","display","justifyContent","alignItems","paddingBottom","direction","gap","marginLeft","textAlign","fontSize","checked","size","onChange","_","undefined","marginRight","verticalAlign","onClick","cursor","borderColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,QAAQ,gBAAgB;AACxE,OAAOC,SAAS,sBAAsB;AACtC,OAAOC,gBAAgB,6BAA6B;AACpD,SAASC,IAAI,QAAsB,QAAQ;AAC3C,SAASC,cAAc,QAAQ,WAAW;AAE1C,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAYzB,OAAO,MAAMC,8BAAgBN,KAAK,SAASM,cAAc,EACvDC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,gBAAgB,IAAI,EACpBC,cAAc,EACdC,YAAY,EACO;IACnB,MAAMC,eAAeP,YAAY,CAAC,EAAE,EAAEQ,QAAQ;IAC9C,IAAID,iBAAiB,MAAM;QACzB,OAAO;IACT;IAEA,MAAME,yBAAyB,CAACC;QAC9B,MAAM,EAAEC,aAAa,EAAEC,aAAa,EAAE,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DACA,sBAAsB;oDACpBQ,iBAAiBZ,MAAME,OAAO,CAACC,MAAM,CAACC,KAAK;gDAC7C;4CACF,CAAA;;;;4BAILf,+BACC,MAACf;gCAAMgD,WAAU;gCAAMF,YAAW;;kDAChC,KAAC/C;wCACC0B,IAAI;4CACFiC,aAAa;4CACbN,UAAU;4CACVO,eAAe;wCACjB;kDAEC1B;;oCAEFpB,gCACC,KAACX;wCACC0D,SAAS;4CACP,IAAI3C,iBAAiBwC,WAAW;gDAC9BxC;4CACF;wCACF;wCACAQ,IAAI;4CACF2B,UAAU;4CACVS,QAAQ;wCACV;uDAGF,KAAC1D;wCAAWsB,IAAI;4CAAE2B,UAAU;wCAAG;;;;;;;;0BAMzC,KAACtD;gBACC2B,IAAI,CAACC,QAAW,CAAA;wBACdQ,OAAO;wBACP4B,aAAapC,MAAME,OAAO,CAACY,IAAI,CAAC,MAAM;oBACxC,CAAA;;;;AAIR,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeSeriesTooltip/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 './SeriesInfo';\nexport * from './SeriesLabelsStack';\nexport * from './SeriesMarker';\nexport * from './TimeChartTooltip';\nexport * from './TooltipContent';\nexport * from './TooltipHeader';\nexport * from './nearby-series';\nexport * from './tooltip-model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeSeriesTooltip/nearby-series.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { LineSeriesOption } from 'echarts/charts';\nimport { formatValue, TimeSeriesValueTuple, FormatOptions, TimeSeries } from '@perses-dev/core';\nimport { EChartsDataFormat, OPTIMIZED_MODE_SERIES_LIMIT, TimeChartSeriesMapping, DatapointInfo } from '../model';\nimport { batchDispatchNearbySeriesActions, getPointInGrid, getClosestTimestamp } from '../utils';\nimport { CursorCoordinates, CursorData, EMPTY_TOOLTIP_DATA } from './tooltip-model';\n\n// increase multipliers to show more series in tooltip\nexport const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5; // adjusts how many series show in tooltip (higher == more series shown)\nexport const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30; // used for adjustment after series number divisor\nexport const SHOW_FEWER_SERIES_LIMIT = 5;\n\nexport interface NearbySeriesInfo {\n seriesIdx: number | null;\n datumIdx: number | null;\n seriesName: string;\n date: number;\n markerColor: string;\n x: number;\n y: number;\n formattedY: string;\n isClosestToCursor: boolean;\n}\n\nexport type NearbySeriesArray = NearbySeriesInfo[];\n\n/**\n * Returns formatted series data for the points that are close to the user's cursor.\n * Adjust xBuffer and yBuffer to increase or decrease number of series shown.\n */\nexport function checkforNearbyTimeSeries(\n data: TimeSeries[],\n seriesMapping: TimeChartSeriesMapping,\n pointInGrid: number[],\n yBuffer: number,\n chart: EChartsInstance,\n format?: FormatOptions\n): NearbySeriesArray {\n const currentNearbySeriesData: NearbySeriesArray = [];\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) return currentNearbySeriesData;\n\n if (chart.dispatchAction === undefined) return currentNearbySeriesData;\n\n if (!Array.isArray(data)) return currentNearbySeriesData;\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [];\n const emphasizedDatapoints: DatapointInfo[] = [];\n const duplicateDatapoints: DatapointInfo[] = [];\n\n const totalSeries = data.length;\n\n const yValueCounts: Map<number, number> = new Map();\n\n // Only need to loop through first dataset source since getCommonTimeScale ensures xAxis timestamps are consistent\n const firstTimeSeriesValues = data[0]?.values;\n const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);\n\n if (closestTimestamp === null) {\n return EMPTY_TOOLTIP_DATA;\n }\n\n // find the timestamp with data that is closest to cursorX\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = seriesMapping[seriesIdx];\n if (!currentSeries) break;\n\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n\n const currentDatasetValues: TimeSeriesValueTuple[] = currentDataset.values;\n if (currentDatasetValues === undefined || !Array.isArray(currentDatasetValues)) break;\n const lineSeries = currentSeries as LineSeriesOption;\n const currentSeriesName = lineSeries.name ? lineSeries.name.toString() : '';\n const markerColor = lineSeries.color ?? '#000';\n if (Array.isArray(data)) {\n for (let datumIdx = 0; datumIdx < currentDatasetValues.length; datumIdx++) {\n const nearbyTimeSeries = currentDatasetValues[datumIdx];\n if (nearbyTimeSeries === undefined || !Array.isArray(nearbyTimeSeries)) break;\n\n const xValue = nearbyTimeSeries[0];\n const yValue = nearbyTimeSeries[1];\n\n // TODO: ensure null values not displayed in tooltip\n if (yValue !== undefined && yValue !== null) {\n if (closestTimestamp === xValue) {\n if (cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {\n // show fewer bold series in tooltip when many total series\n const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;\n const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);\n const isClosestToCursor = isWithinPercentageRange({\n valueToCheck: cursorY,\n baseValue: yValue,\n percentage: percentRangeToCheck,\n });\n if (isClosestToCursor) {\n // shows as bold in tooltip, customize 'emphasis' options in getTimeSeries util\n emphasizedSeriesIndexes.push(seriesIdx);\n\n // Used to determine which datapoint to apply select styles to.\n // Accounts for cases where lines may be rendered directly on top of eachother.\n const duplicateValuesCount = yValueCounts.get(yValue) ?? 0;\n yValueCounts.set(yValue, duplicateValuesCount + 1);\n if (duplicateValuesCount > 0) {\n duplicateDatapoints.push({\n seriesIndex: seriesIdx,\n dataIndex: datumIdx,\n seriesName: currentSeriesName,\n yValue: yValue,\n });\n }\n\n // keep track of all bold datapoints in tooltip so that 'select' state only applied to topmost\n emphasizedDatapoints.push({\n seriesIndex: seriesIdx,\n dataIndex: datumIdx,\n seriesName: currentSeriesName,\n yValue: yValue,\n });\n } else {\n nonEmphasizedSeriesIndexes.push(seriesIdx);\n // ensure series far away from cursor are not highlighted\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: seriesIdx,\n });\n }\n const formattedY = formatValue(yValue, format);\n currentNearbySeriesData.push({\n seriesIdx: seriesIdx,\n datumIdx: datumIdx,\n seriesName: currentSeriesName,\n date: closestTimestamp,\n x: xValue,\n y: yValue,\n formattedY: formattedY,\n markerColor: markerColor.toString(),\n isClosestToCursor,\n });\n nearbySeriesIndexes.push(seriesIdx);\n }\n }\n }\n }\n }\n }\n\n batchDispatchNearbySeriesActions(\n chart,\n nearbySeriesIndexes,\n emphasizedSeriesIndexes,\n nonEmphasizedSeriesIndexes,\n emphasizedDatapoints,\n duplicateDatapoints\n );\n\n return currentNearbySeriesData;\n}\n\n/**\n * [DEPRECATED] Returns formatted series data for the points that are close to the user's cursor\n * Adjust yBuffer to increase or decrease number of series shown\n */\nexport function legacyCheckforNearbySeries(\n data: EChartsDataFormat,\n pointInGrid: number[],\n yBuffer: number,\n chart?: EChartsInstance,\n format?: FormatOptions\n): NearbySeriesArray {\n const currentNearbySeriesData: NearbySeriesArray = [];\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) {\n return currentNearbySeriesData;\n }\n\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [];\n const totalSeries = data.timeSeries.length;\n if (Array.isArray(data.xAxis) && Array.isArray(data.timeSeries)) {\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = data.timeSeries[seriesIdx];\n if (currentSeries === undefined) break;\n if (currentNearbySeriesData.length >= OPTIMIZED_MODE_SERIES_LIMIT) break;\n\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const markerColor = currentSeries.color ?? '#000';\n if (Array.isArray(currentSeries.data)) {\n for (let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++) {\n const xValue = data.xAxis[datumIdx] ?? 0;\n const yValue = currentSeries.data[datumIdx];\n // ensure null values not displayed in tooltip\n if (yValue !== undefined && yValue !== null && cursorX === datumIdx) {\n if (yValue !== '-' && cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {\n // show fewer bold series in tooltip when many total series\n const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;\n const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);\n const isClosestToCursor = isWithinPercentageRange({\n valueToCheck: cursorY,\n baseValue: yValue,\n percentage: percentRangeToCheck,\n });\n if (isClosestToCursor) {\n emphasizedSeriesIndexes.push(seriesIdx);\n } else {\n nonEmphasizedSeriesIndexes.push(seriesIdx);\n // ensure series not close to cursor are not highlighted\n if (chart?.dispatchAction !== undefined) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: seriesIdx,\n });\n }\n }\n\n // determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201\n const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;\n const formattedY = formatValue(yValue, format);\n currentNearbySeriesData.push({\n seriesIdx: seriesIdx,\n datumIdx: datumIdx,\n seriesName: currentSeriesName,\n date: xValueMilliSeconds,\n x: xValue,\n y: yValue,\n formattedY: formattedY,\n markerColor: markerColor.toString(),\n isClosestToCursor,\n });\n nearbySeriesIndexes.push(seriesIdx);\n }\n }\n }\n }\n }\n }\n if (chart?.dispatchAction !== undefined) {\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n }\n }\n\n return currentNearbySeriesData;\n}\n\n/**\n * Uses mouse position to determine whether user is hovering over a chart canvas\n * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series\n */\nexport function getNearbySeriesData({\n mousePos,\n pinnedPos,\n data,\n seriesMapping,\n chart,\n format,\n showAllSeries = false,\n}: {\n mousePos: CursorData['coords'];\n pinnedPos: CursorCoordinates | null;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n chart?: EChartsInstance;\n format?: FormatOptions;\n showAllSeries?: boolean;\n}): NearbySeriesArray {\n if (chart === undefined || mousePos === null) return EMPTY_TOOLTIP_DATA;\n\n // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned\n let cursorTargetMatchesChart = false;\n if (mousePos.target !== null) {\n const currentParent = (<HTMLElement>mousePos.target).parentElement;\n if (currentParent !== null) {\n const currentGrandparent = currentParent.parentElement;\n if (currentGrandparent !== null) {\n const chartDom = chart.getDom();\n if (chartDom === currentGrandparent) {\n cursorTargetMatchesChart = true;\n }\n }\n }\n }\n\n // allows moving cursor inside tooltip without it fading away\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n cursorTargetMatchesChart = true;\n }\n\n if (cursorTargetMatchesChart === false || data === null || chart['_model'] === undefined) return EMPTY_TOOLTIP_DATA;\n\n // mousemove position undefined when not hovering over chart canvas\n if (mousePos.plotCanvas.x === undefined || mousePos.plotCanvas.y === undefined) return EMPTY_TOOLTIP_DATA;\n\n const pointInGrid = getPointInGrid(mousePos.plotCanvas.x, mousePos.plotCanvas.y, chart);\n if (pointInGrid !== null) {\n const chartModel = chart['_model'];\n const yInterval = chartModel.getComponent('yAxis').axis.scale._interval;\n const totalSeries = data.length;\n const yBuffer = getYBuffer({ yInterval, totalSeries, showAllSeries });\n return checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format);\n }\n\n // no nearby series found\n return EMPTY_TOOLTIP_DATA;\n}\n\n/**\n * [DEPRECATED] Uses mouse position to determine whether user is hovering over a chart canvas\n * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series\n */\nexport function legacyGetNearbySeriesData({\n mousePos,\n pinnedPos,\n chartData,\n chart,\n format,\n showAllSeries = false,\n}: {\n mousePos: CursorData['coords'];\n pinnedPos: CursorCoordinates | null;\n chartData: EChartsDataFormat;\n chart?: EChartsInstance;\n format?: FormatOptions;\n showAllSeries?: boolean;\n}): NearbySeriesArray {\n if (chart === undefined || mousePos === null) return [];\n\n // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned\n let cursorTargetMatchesChart = false;\n if (mousePos.target !== null) {\n const currentParent = (<HTMLElement>mousePos.target).parentElement;\n if (currentParent !== null) {\n const currentGrandparent = currentParent.parentElement;\n if (currentGrandparent !== null) {\n const chartDom = chart.getDom();\n if (chartDom === currentGrandparent) {\n cursorTargetMatchesChart = true;\n }\n }\n }\n }\n\n // allows moving cursor inside tooltip without it fading away\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n cursorTargetMatchesChart = true;\n }\n\n if (cursorTargetMatchesChart === false) return [];\n\n if (chart['_model'] === undefined) return [];\n const chartModel = chart['_model'];\n const yInterval = chartModel.getComponent('yAxis').axis.scale._interval;\n const totalSeries = chartData.timeSeries.length;\n const yBuffer = getYBuffer({ yInterval, totalSeries, showAllSeries });\n const pointInPixel = [mousePos.plotCanvas.x ?? 0, mousePos.plotCanvas.y ?? 0];\n if (chart.containPixel('grid', pointInPixel)) {\n const pointInGrid = chart.convertFromPixel('grid', pointInPixel);\n if (pointInGrid[0] !== undefined && pointInGrid[1] !== undefined) {\n return legacyCheckforNearbySeries(chartData, pointInGrid, yBuffer, chart, format);\n }\n }\n\n return [];\n}\n\n/*\n * Check if two numbers are within a specified percentage range\n */\nexport function isWithinPercentageRange({\n valueToCheck,\n baseValue,\n percentage,\n}: {\n valueToCheck: number;\n baseValue: number;\n percentage: number;\n}): boolean {\n const range = (percentage / 100) * baseValue;\n const lowerBound = baseValue - range;\n const upperBound = baseValue + range;\n return valueToCheck >= lowerBound && valueToCheck <= upperBound;\n}\n\n/*\n * Get range to check within for nearby series to show in tooltip.\n */\nexport function getYBuffer({\n yInterval,\n totalSeries,\n showAllSeries = false,\n}: {\n yInterval: number;\n totalSeries: number;\n showAllSeries?: boolean;\n}): number {\n if (showAllSeries) {\n return yInterval * 10; // roughly correlates with grid so entire canvas is searched\n }\n\n // never let nearby series range be less than roughly the size of a single tick\n const yBufferMin = yInterval * 0.3;\n\n // tooltip trigger area gets smaller with more series\n if (totalSeries > SHOW_FEWER_SERIES_LIMIT) {\n const adjustedBuffer = (yInterval * DYNAMIC_NEARBY_SERIES_MULTIPLIER) / totalSeries;\n return Math.max(yBufferMin, adjustedBuffer);\n }\n\n // increase multiplier to expand nearby series range\n return Math.max(yBufferMin, yInterval * INCREASE_NEARBY_SERIES_MULTIPLIER);\n}\n"],"names":["formatValue","OPTIMIZED_MODE_SERIES_LIMIT","batchDispatchNearbySeriesActions","getPointInGrid","getClosestTimestamp","EMPTY_TOOLTIP_DATA","INCREASE_NEARBY_SERIES_MULTIPLIER","DYNAMIC_NEARBY_SERIES_MULTIPLIER","SHOW_FEWER_SERIES_LIMIT","checkforNearbyTimeSeries","data","seriesMapping","pointInGrid","yBuffer","chart","format","currentNearbySeriesData","cursorX","cursorY","dispatchAction","undefined","Array","isArray","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","totalSeries","length","yValueCounts","Map","firstTimeSeriesValues","values","closestTimestamp","seriesIdx","currentSeries","currentDataset","currentDatasetValues","lineSeries","currentSeriesName","name","toString","markerColor","color","datumIdx","nearbyTimeSeries","xValue","yValue","minPercentRange","percentRangeToCheck","Math","max","isClosestToCursor","isWithinPercentageRange","valueToCheck","baseValue","percentage","push","duplicateValuesCount","get","set","seriesIndex","dataIndex","seriesName","type","formattedY","date","x","y","legacyCheckforNearbySeries","timeSeries","xAxis","xValueMilliSeconds","notBlur","escapeConnect","getNearbySeriesData","mousePos","pinnedPos","showAllSeries","cursorTargetMatchesChart","target","currentParent","parentElement","currentGrandparent","chartDom","getDom","plotCanvas","chartModel","yInterval","getComponent","axis","scale","_interval","getYBuffer","legacyGetNearbySeriesData","chartData","pointInPixel","containPixel","convertFromPixel","range","lowerBound","upperBound","yBufferMin","adjustedBuffer"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,WAAW,QAAyD,mBAAmB;AAChG,SAA4BC,2BAA2B,QAA+C,WAAW;AACjH,SAASC,gCAAgC,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,WAAW;AACjG,SAAwCC,kBAAkB,QAAQ,kBAAkB;AAEpF,sDAAsD;AACtD,OAAO,MAAMC,oCAAoC,IAAI,CAAC,wEAAwE;AAC9H,OAAO,MAAMC,mCAAmC,GAAG,CAAC,kDAAkD;AACtG,OAAO,MAAMC,0BAA0B,EAAE;AAgBzC;;;CAGC,GACD,OAAO,SAASC,yBACdC,IAAkB,EAClBC,aAAqC,EACrCC,WAAqB,EACrBC,OAAe,EACfC,KAAsB,EACtBC,MAAsB;IAEtB,MAAMC,0BAA6C,EAAE;IACrD,MAAMC,UAAyBL,WAAW,CAAC,EAAE,IAAI;IACjD,MAAMM,UAAyBN,WAAW,CAAC,EAAE,IAAI;IAEjD,IAAIK,YAAY,QAAQC,YAAY,MAAM,OAAOF;IAEjD,IAAIF,MAAMK,cAAc,KAAKC,WAAW,OAAOJ;IAE/C,IAAI,CAACK,MAAMC,OAAO,CAACZ,OAAO,OAAOM;IACjC,MAAMO,sBAAgC,EAAE;IACxC,MAAMC,0BAAoC,EAAE;IAC5C,MAAMC,6BAAuC,EAAE;IAC/C,MAAMC,uBAAwC,EAAE;IAChD,MAAMC,sBAAuC,EAAE;IAE/C,MAAMC,cAAclB,KAAKmB,MAAM;IAE/B,MAAMC,eAAoC,IAAIC;IAE9C,kHAAkH;IAClH,MAAMC,wB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AC/B,MAAME,aAAa9C,YAAY4C;IAC/B,OAAO7C,gBAAgB8C,cAAc9C,gBAAgB+C;AACvD;AAEA;;CAEC,GACD,OAAO,SAASR,WAAW,EACzBL,SAAS,EACT7D,WAAW,EACXmD,gBAAgB,KAAK,EAKtB;IACC,IAAIA,eAAe;QACjB,OAAOU,YAAY,IAAI,4DAA4D;IACrF;IAEA,+EAA+E;IAC/E,MAAMc,aAAad,YAAY;IAE/B,qDAAqD;IACrD,IAAI7D,cAAcpB,yBAAyB;QACzC,MAAMgG,iBAAiB,AAACf,YAAYlF,mCAAoCqB;QACxE,OAAOuB,KAAKC,GAAG,CAACmD,YAAYC;IAC9B;IAEA,oDAAoD;IACpD,OAAOrD,KAAKC,GAAG,CAACmD,YAAYd,YAAYnF;AAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeSeriesTooltip/tooltip-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useState } from 'react';\nimport { NearbySeriesArray } from './nearby-series';\n\nexport const TOOLTIP_MIN_WIDTH = 375;\nexport const TOOLTIP_MAX_WIDTH = 650;\nexport const TOOLTIP_MAX_HEIGHT = 650;\nexport const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;\nexport const TOOLTIP_ADJUST_Y_POS_MULTIPLIER = 0.75;\nexport const TOOLTIP_PADDING = 8;\n\nexport const FALLBACK_CHART_WIDTH = 750;\n\nexport const NEARBY_SERIES_DESCRIPTION = 'nearby series showing in tooltip';\nexport const EMPHASIZED_SERIES_DESCRIPTION = 'emphasized series showing as bold in tooltip';\n\nexport const TOOLTIP_BG_COLOR_FALLBACK = '#2E313E';\n\nexport const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: true,\n});\n\nexport const defaultCursorData = {\n coords: {\n plotCanvas: {\n x: 0,\n y: 0,\n },\n zrender: {\n x: 0,\n y: 0,\n },\n target: null,\n },\n chartWidth: 0,\n};\n\nexport const EMPTY_TOOLTIP_DATA: NearbySeriesArray = [];\n\n/**\n * ECharts is built with zrender, zrX and zrY are undefined when not hovering over a chart canvas\n */\nexport interface ZRCoordinate {\n x?: number;\n y?: number;\n}\n\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\nexport interface CursorCoordinates {\n page: Coordinate;\n client: Coordinate;\n plotCanvas: ZRCoordinate;\n target: EventTarget | null;\n}\n\nexport interface CursorData {\n coords: CursorCoordinates | null;\n chartWidth?: number;\n}\n\nexport interface TooltipData {\n focusedSeries: NearbySeriesArray | null;\n cursor: CursorData;\n}\n\ntype ZREventProperties = {\n zrX?: number;\n zrY?: number;\n zrDelta?: number;\n zrEventControl?: 'no_globalout' | 'only_globalout';\n zrByTouch?: boolean;\n};\n\nexport type ZRRawMouseEvent = MouseEvent & ZREventProperties;\n\nexport const useMousePosition = (): CursorData['coords'] => {\n const [coords, setCoords] = useState<CursorData['coords']>(null);\n\n useEffect(() => {\n const setFromEvent = (e: ZRRawMouseEvent): void => {\n return setCoords({\n page: {\n x: e.pageX,\n y: e.pageY,\n },\n client: {\n x: e.clientX,\n y: e.clientY,\n },\n plotCanvas: {\n // Default to zrender mousemove coords since they handle browser inconsistencies for us\n // ex: Firefox and Chrome have slightly different implementations of offsetX and offsetY\n // more info: https://github.com/ecomfe/zrender/blob/5.5.0/src/core/event.ts#L46-L120\n // Fallback to offsetX and offsetY to ensure tooltip works correctly in Edge\n x: e.zrX ?? e.offsetX,\n y: e.zrY ?? e.offsetY,\n },\n // necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)\n target: e.target,\n });\n };\n window.addEventListener('mousemove', setFromEvent);\n\n return (): void => {\n window.removeEventListener('mousemove', setFromEvent);\n };\n }, []);\n\n return coords;\n};\n\nexport type TooltipConfig = {\n wrapLabels: boolean;\n hidden?: boolean;\n enablePinning?: boolean;\n};\n\nexport const DEFAULT_TOOLTIP_CONFIG: TooltipConfig = {\n wrapLabels: true,\n enablePinning: true,\n};\n\nexport const PIN_TOOLTIP_HELP_TEXT = 'Click chart to pin';\n\nexport const UNPIN_TOOLTIP_HELP_TEXT = 'Click chart to unpin';\n"],"names":["useEffect","useState","TOOLTIP_MIN_WIDTH","TOOLTIP_MAX_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_LABELS_MAX_WIDTH","TOOLTIP_ADJUST_Y_POS_MULTIPLIER","TOOLTIP_PADDING","FALLBACK_CHART_WIDTH","NEARBY_SERIES_DESCRIPTION","EMPHASIZED_SERIES_DESCRIPTION","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_DATE_FORMAT","Intl","DateTimeFormat","undefined","year","month","day","hour","minute","second","hour12","defaultCursorData","coords","plotCanvas","x","y","zrender","target","chartWidth","EMPTY_TOOLTIP_DATA","useMousePosition","setCoords","setFromEvent","e","page","pageX","pageY","client","clientX","clientY","zrX","offsetX","zrY","offsetY","window","addEventListener","removeEventListener","DEFAULT_TOOLTIP_CONFIG","wrapLabels","enablePinning","PIN_TOOLTIP_HELP_TEXT","UNPIN_TOOLTIP_HELP_TEXT"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AA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AEN,MAAM;YAClB;QACF;QACAiB,OAAOC,gBAAgB,CAAC,aAAab;QAErC,OAAO;YACLY,OAAOE,mBAAmB,CAAC,aAAad;QAC1C;IACF,GAAG,EAAE;IAEL,OAAOV;AACT,EAAE;AAQF,OAAO,MAAMyB,yBAAwC;IACnDC,YAAY;IACZC,eAAe;AACjB,EAAE;AAEF,OAAO,MAAMC,wBAAwB,qBAAqB;AAE1D,OAAO,MAAMC,0BAA0B,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TimeSeriesTooltip/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport {\n CursorCoordinates,\n CursorData,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MIN_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_PADDING,\n} from './tooltip-model';\n\n/**\n * Determine position of tooltip depending on chart dimensions and the number of focused series\n */\nexport function assembleTransform(\n mousePos: CursorData['coords'],\n pinnedPos: CursorCoordinates | null,\n tooltipHeight: number,\n tooltipWidth: number,\n containerElement?: Element | null\n): string | undefined {\n if (mousePos === null) {\n return undefined;\n }\n\n const cursorPaddingX = 32;\n const cursorPaddingY = 16;\n\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n }\n\n if (mousePos.plotCanvas.x === undefined) return undefined;\n\n let x = mousePos.page.x + cursorPaddingX; // Default to right side of the cursor\n let y = mousePos.page.y + cursorPaddingY;\n\n // If containerElement is defined, adjust coordinates relative to the container\n if (containerElement) {\n const containerRect = containerElement.getBoundingClientRect();\n x = x - containerRect.left + containerElement.scrollLeft;\n y = y - containerRect.top + containerElement.scrollTop;\n\n // Ensure tooltip does not go out of the container's bottom\n const containerBottom = containerRect.top + containerElement.scrollHeight;\n if (y + tooltipHeight > containerBottom) {\n y = Math.max(containerBottom - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);\n }\n } else {\n // Ensure tooltip does not go out of the screen on the bottom\n if (y + tooltipHeight > window.innerHeight + window.scrollY) {\n y = Math.max(window.innerHeight + window.scrollY - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);\n }\n }\n\n // Ensure tooltip does not go out of the screen on the right\n if (x + tooltipWidth > window.innerWidth) {\n x = mousePos.page.x - tooltipWidth - cursorPaddingX; // Move to the left of the cursor\n }\n\n // Ensure tooltip does not go out of the screen on the left\n if (x < cursorPaddingX) {\n x = cursorPaddingX;\n }\n\n // Ensure tooltip does not go out of the screen on the top\n if (y < TOOLTIP_PADDING / 2) {\n y = TOOLTIP_PADDING / 2;\n }\n\n return `translate3d(${x}px, ${y}px, 0)`;\n}\n\n/**\n * Helper for tooltip positioning styles\n */\nexport function getTooltipStyles(\n theme: Theme,\n pinnedPos: CursorCoordinates | null,\n maxHeight?: number\n): Record<string, unknown> {\n const adjustedMaxHeight = maxHeight ? maxHeight - TOOLTIP_PADDING : undefined;\n return {\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: adjustedMaxHeight ?? TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n };\n}\n"],"names":["TOOLTIP_MAX_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_MIN_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_PADDING","assembleTransform","mousePos","pinnedPos","tooltipHeight","tooltipWidth","containerElement","undefined","cursorPaddingX","cursorPaddingY","plotCanvas","x","page","y","containerRect","getBoundingClientRect","left","scrollLeft","top","scrollTop","containerBottom","scrollHeight","Math","max","window","innerHeight","scrollY","innerWidth","getTooltipStyles","theme","maxHeight","adjustedMaxHeight","minWidth","maxWidth","padding","position","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAGEA,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,yBAAyB,EACzBC,eAAe,QACV,kBAAkB;AAEzB;;CAEC,GACD,OAAO,SAASC,kBACdC,QAA8B,EAC9BC,SAAmC,EACnCC,aAAqB,EACrBC,YAAoB,EACpBC,gBAAiC;IAEjC,IAAIJ,aAAa,MAAM;QACrB,OAAOK;IACT;IAEA,MAAMC,iBAAiB;IACvB,MAAMC,iBAAiB;IAEvB,IAAIN,cAAc,MAAM;QACtBD,WAAWC;IACb;IAEA,IAAID,SAASQ,UAAU,CAACC,CAAC,KAAKJ,WAAW,OAAOA;IAEhD,IAAII,IAAIT,SAASU,IAAI,CAACD,CAAC,GAAGH,gBAAgB,sCAAsC;IAChF,IAAIK,IAAIX,SAASU,IAAI,CAACC,CAAC,GAAGJ;IAE1B,+EAA+E;IAC/E,IAAIH,kBAAkB;QACpB,MAAMQ,gBAA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1DyC,cAAc;QACdC,OAAO;QACPC,UAAU;QACVC,YAAY;QACZC,SAAS;QACTC,YAAY;QACZ,yEAAyE;QACzEC,QAAQ3C,cAAc,OAAO,SAAS0B,MAAMiB,MAAM,CAACC,OAAO;QAC1DC,UAAU;QACV,WAAW;YACTC,WAAW;QACb;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ToolbarIconButton/ToolbarIconButton.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 { ForwardedRef, forwardRef, ReactElement } from 'react';\nimport { Button, styled, ButtonProps } from '@mui/material';\n\ntype ToolbarIconButtonProps = ButtonProps;\n\nfunction IconButton(props: ToolbarIconButtonProps, ref: ForwardedRef<HTMLButtonElement>): ReactElement {\n return <StyledIconButton ref={ref} variant=\"outlined\" color=\"secondary\" {...props} />;\n}\n\nconst StyledIconButton = styled(Button)(({ theme }) => ({\n // Using a button with some adjusted styles because it is easier to inherit\n // styling and variants from themes than with an IconButton.\n padding: theme.spacing(0.5),\n minWidth: 'auto',\n}));\n\nexport const ToolbarIconButton = forwardRef(IconButton);\n"],"names":["forwardRef","Button","styled","IconButton","props","ref","StyledIconButton","variant","color","theme","padding","spacing","minWidth","ToolbarIconButton"],"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,SAAuBA,UAAU,QAAsB,QAAQ;AAC/D,SAASC,MAAM,EAAEC,MAAM,QAAqB,gBAAgB;AAI5D,SAASC,WAAWC,KAA6B,EAAEC,GAAoC;IACrF,qBAAO,KAACC;QAAiBD,KAAKA;QAAKE,SAAQ;QAAWC,OAAM;QAAa,GAAGJ,KAAK;;AACnF;AAEA,MAAME,mBAAmBJ,OAAOD,QAAQ,CAAC,EAAEQ,KAAK,EAAE,GAAM,CAAA;QACtD,2EAA2E;QAC3E,4DAA4D;QAC5DC,SAASD,MAAME,OAAO,CAAC;QACvBC,UAAU;IACZ,CAAA;AAEA,OAAO,MAAMC,kCAAoBb,WAAWG,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ToolbarIconButton/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 './ToolbarIconButton';\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,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TransformsEditor/TransformEditor.tsx"],"sourcesContent":["// Copyright 2024 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 {\n Autocomplete,\n FormControlLabel,\n MenuItem,\n Stack,\n StackProps,\n Switch,\n Typography,\n TextField as MuiTextField,\n} from '@mui/material';\nimport {\n JoinByColumnValueTransform,\n MergeColumnsTransform,\n MergeIndexedColumnsTransform,\n MergeSeriesTransform,\n Transform,\n} from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { TextField } from '../controls';\n\ninterface TransformSpecEditorProps<Spec> {\n value: Spec;\n onChange: (transform: Spec) => void;\n}\n\nfunction JoinByColumnValueTransformEditor({\n value,\n onChange,\n}: TransformSpecEditorProps<JoinByColumnValueTransform>): ReactElement {\n return (\n <Stack direction=\"row\">\n <Autocomplete\n freeSolo\n multiple\n id=\"join-columns\"\n sx={{ width: '100%' }}\n options={[]} // TODO: autofill columns name when query results is available to panel editors\n value={value.spec.columns ?? []}\n renderInput={(params) => <MuiTextField {...params} variant=\"outlined\" label=\"Columns\" required />}\n onChange={(_, columns) => {\n onChange({\n ...value,\n spec: {\n ...value.spec,\n columns: columns,\n },\n });\n }}\n />\n <FormControlLabel\n label=\"Enabled\"\n labelPlacement=\"start\"\n control={\n <Switch\n value={!value.spec.disabled}\n checked={!value.spec.disabled}\n onChange={(e) =>\n onChange({\n ...value,\n spec: { ...value.spec, disabled: !e.target.checked },\n })\n }\n />\n }\n />\n </Stack>\n );\n}\n\nfunction MergeColumnsTransformEditor({\n value,\n onChange,\n}: TransformSpecEditorProps<MergeColumnsTransform>): ReactElement {\n return (\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n <Autocomplete\n freeSolo\n multiple\n id=\"merge-columns-columns\"\n sx={{ width: '100%' }}\n options={[]}\n value={value.spec.columns ?? []}\n renderInput={(params) => <MuiTextField {...params} variant=\"outlined\" label=\"Columns\" required />}\n onChange={(_, columns) => {\n onChange({\n ...value,\n spec: {\n ...value.spec,\n columns: columns,\n },\n });\n }}\n />\n\n <TextField\n id=\"merge-columns-name\"\n variant=\"outlined\"\n label=\"Output Name\"\n value={value.spec.name ?? ''}\n sx={{ width: '100%' }}\n onChange={(name) => {\n onChange({\n ...value,\n spec: {\n ...value.spec,\n name: name,\n },\n });\n }}\n required\n />\n <FormControlLabel\n label=\"Enabled\"\n labelPlacement=\"start\"\n control={\n <Switch\n value={!value.spec.disabled}\n checked={!value.spec.disabled}\n onChange={(e) =>\n onChange({\n ...value,\n spec: { ...value.spec, disabled: !e.target.checked },\n })\n }\n />\n }\n />\n </Stack>\n );\n}\n\nfunction MergeIndexedColumnsTransformEditor({\n value,\n onChange,\n}: TransformSpecEditorProps<MergeIndexedColumnsTransform>): ReactElement {\n return (\n <Stack direction=\"row\">\n <TextField\n id=\"merge-indexed-columns\"\n variant=\"outlined\"\n label=\"Column\"\n placeholder=\"Example: 'value' for merging 'value #1', 'value #2' and 'value #...'\"\n value={value.spec.column ?? ''}\n sx={{ width: '100%' }}\n onChange={(column) => {\n onChange({\n ...value,\n spec: { ...value.spec, column: column },\n });\n }}\n required\n />\n <FormControlLabel\n label=\"Enabled\"\n labelPlacement=\"start\"\n control={\n <Switch\n value={!value.spec.disabled}\n checked={!value.spec.disabled}\n onChange={(e) =>\n onChange({\n ...value,\n spec: { ...value.spec, disabled: !e.target.checked },\n })\n }\n />\n }\n />\n </Stack>\n );\n}\n\nfunction MergeSeriesTransformEditor({ value, onChange }: TransformSpecEditorProps<MergeSeriesTransform>): ReactElement {\n return (\n <Stack direction=\"row\">\n <FormControlLabel\n label=\"Enabled\"\n labelPlacement=\"start\"\n control={\n <Switch\n value={!value.spec.disabled}\n checked={!value.spec.disabled}\n onChange={(e) =>\n onChange({\n ...value,\n spec: { ...value.spec, disabled: !e.target.checked },\n })\n }\n />\n }\n />\n </Stack>\n );\n}\n\nexport interface TransformEditorProps extends Omit<StackProps, 'children' | 'value' | 'onChange'> {\n value: Transform;\n onChange: (transform: Transform) => void;\n}\n\nexport function TransformEditor({ value, onChange, ...props }: TransformEditorProps): ReactElement {\n return (\n <Stack gap={2} sx={{ width: '100%' }} mt={1} {...props}>\n <TextField\n select\n label=\"Kind\"\n value={value.kind}\n onChange={(kind) => onChange({ ...value, kind: kind as unknown as Transform['kind'] } as Transform)}\n >\n <MenuItem value=\"JoinByColumnValue\">\n <Stack>\n <Typography>Join by column value</Typography>\n <Typography variant=\"caption\">Regroup rows with equal cell value in a column</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"MergeColumns\">\n <Stack>\n <Typography>Merge columns</Typography>\n <Typography variant=\"caption\">Multiple columns are merged to one column</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"MergeIndexedColumns\">\n <Stack>\n <Typography>Merge indexed columns</Typography>\n <Typography variant=\"caption\">Indexed columns are merged to one column</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"MergeSeries\">\n <Stack>\n <Typography>Merge series</Typography>\n <Typography variant=\"caption\">Series will be merged by their labels</Typography>\n </Stack>\n </MenuItem>\n </TextField>\n {value.kind === 'JoinByColumnValue' && <JoinByColumnValueTransformEditor value={value} onChange={onChange} />}\n {value.kind === 'MergeColumns' && <MergeColumnsTransformEditor value={value} onChange={onChange} />}\n {value.kind === 'MergeIndexedColumns' && <MergeIndexedColumnsTransformEditor value={value} onChange={onChange} />}\n {value.kind === 'MergeSeries' && <MergeSeriesTransformEditor value={value} onChange={onChange} />}\n </Stack>\n );\n}\n"],"names":["Autocomplete","FormControlLabel","MenuItem","Stack","Switch","Typography","TextField","MuiTextField","JoinByColumnValueTransformEditor","value","onChange","direction","freeSolo","multiple","id","sx","width","options","spec","columns","renderInput","params","variant","label","required","_","labelPlacement","control","disabled","checked","e","target","MergeColumnsTransformEditor","gap","alignItems","name","MergeIndexedColumnsTransformEditor","placeholder","column","MergeSeriesTransformEditor","TransformEditor","props","mt","select","kind"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AA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AMA;oBAAqC;;kCAEpF,KAAC1C;wBAASO,OAAM;kCACd,cAAA,MAACN;;8CACC,KAACE;8CAAW;;8CACZ,KAACA;oCAAWiB,SAAQ;8CAAU;;;;;kCAGlC,KAACpB;wBAASO,OAAM;kCACd,cAAA,MAACN;;8CACC,KAACE;8CAAW;;8CACZ,KAACA;oCAAWiB,SAAQ;8CAAU;;;;;kCAGlC,KAACpB;wBAASO,OAAM;kCACd,cAAA,MAACN;;8CACC,KAACE;8CAAW;;8CACZ,KAACA;oCAAWiB,SAAQ;8CAAU;;;;;kCAGlC,KAACpB;wBAASO,OAAM;kCACd,cAAA,MAACN;;8CACC,KAACE;8CAAW;;8CACZ,KAACA;oCAAWiB,SAAQ;8CAAU;;;;;;;YAInCb,MAAMmC,IAAI,KAAK,qCAAuB,KAACpC;gBAAiCC,OAAOA;gBAAOC,UAAUA;;YAChGD,MAAMmC,IAAI,KAAK,gCAAkB,KAACZ;gBAA4BvB,OAAOA;gBAAOC,UAAUA;;YACtFD,MAAMmC,IAAI,KAAK,uCAAyB,KAACR;gBAAmC3B,OAAOA;gBAAOC,UAAUA;;YACpGD,MAAMmC,IAAI,KAAK,+BAAiB,KAACL;gBAA2B9B,OAAOA;gBAAOC,UAAUA;;;;AAG3F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TransformsEditor/TransformEditorContainer.tsx"],"sourcesContent":["// Copyright 2024 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 { Divider, IconButton, Stack, Tooltip, Typography } from '@mui/material';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport EyeOffIcon from 'mdi-material-ui/EyeOffOutline';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { Transform, TRANSFORM_TEXT } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { TransformEditor, TransformEditorProps } from './TransformEditor';\n\nexport interface TransformEditorContainerProps extends TransformEditorProps {\n index?: number;\n isCollapsed: boolean;\n onCollapse: (collapsed: boolean) => void;\n onDelete: () => void;\n}\n\nexport function TransformEditorContainer({\n index,\n value,\n isCollapsed,\n onChange,\n onCollapse,\n onDelete,\n ...props\n}: TransformEditorContainerProps): ReactElement {\n function handleTransformDisable(): void {\n onChange({ ...value, spec: { ...value.spec, disabled: !value.spec?.disabled } } as Transform);\n }\n\n return (\n <Stack {...props}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n justifyContent=\"space-between\"\n gap={4}\n >\n <Stack direction=\"row\" gap={1}>\n <IconButton data-testid={`transform-toggle#${index}`} size=\"small\" onClick={() => onCollapse(!isCollapsed)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\" sx={{ textTransform: 'none' }}>\n {value.kind ? (\n <span>\n <strong>{TRANSFORM_TEXT[value.kind]}</strong>\n </span>\n ) : (\n <strong>Select a transformation kind</strong>\n )}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" gap={1}>\n {isCollapsed && (\n <>\n <Tooltip\n title={value.spec?.disabled ? 'Enable transformation' : 'Disable transformation'}\n placement=\"top\"\n >\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={handleTransformDisable}>\n {value.spec?.disabled ? <EyeOffIcon /> : <EyeIcon />}\n </IconButton>\n </Tooltip>\n <Divider flexItem orientation=\"vertical\" variant=\"middle\" />\n </>\n )}\n <Tooltip title=\"Remove transformation\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Stack>\n </Stack>\n {!isCollapsed && <TransformEditor value={value} onChange={onChange} />}\n </Stack>\n );\n}\n"],"names":["Divider","IconButton","Stack","Tooltip","Typography","ChevronRight","ChevronDown","EyeOffIcon","EyeIcon","DeleteIcon","TRANSFORM_TEXT","TransformEditor","TransformEditorContainer","index","value","isCollapsed","onChange","onCollapse","onDelete","props","handleTransformDisable","spec","disabled","direction","alignItems","borderBottom","borderColor","theme","palette","divider","justifyContent","gap","data-testid","size","onClick","variant","component","sx","textTransform","kind","span","strong","title","placement","marginLeft","flexItem","orientation"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,UAAU,QAAQ,gBAAgB;AAChF,OAAOC,kBAAkB,+BAA+B;AACxD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,gBAAgB,gCAAgC;AACvD,SAAoBC,cAAc,QAAQ,mBAAmB;AAE7D,SAASC,eAAe,QAA8B,oBAAoB;AAS1E,OAAO,SAASC,yBAAyB,EACvCC,KAAK,EACLC,KAAK,EACLC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACR,GAAGC,OAC2B;IAC9B,SAASC;QACPJ,SAAS;YAAE,GAAGF,KAAK;YAAEO,MAAM;gBAAE,GAAGP,MAAMO,IAAI;gBAAEC,UAAU,CAACR,MAAMO,IAAI,EAAEC;YAAS;QAAE;IAChF;IAEA,qBACE,MAACpB;QAAO,GAAGiB,KAAK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yright 2024 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 { Transform } from '@perses-dev/core';\nimport { Button, Stack, StackProps } from '@mui/material';\nimport { ReactElement, useState } from 'react';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { TransformEditorContainer } from './TransformEditorContainer';\n\nexport interface TransformsEditorProps extends Omit<StackProps, 'onChange'> {\n value: Transform[];\n onChange: (transforms: Transform[]) => void;\n}\n\nexport function TransformsEditor({ value, onChange, ...props }: TransformsEditorProps): ReactElement {\n const [transformsCollapsed, setTransformsCollapsed] = useState(value.map(() => true));\n\n function handleTransformChange(index: number, transform: Transform): void {\n const updatedTransforms = [...value];\n updatedTransforms[index] = transform;\n onChange(updatedTransforms);\n }\n\n function handleTransformAdd(): void {\n const updatedTransforms = [...value];\n // @ts-expect-error: Unknown transform\n updatedTransforms.push({ kind: '', spec: {} });\n onChange(updatedTransforms);\n setTransformsCollapsed((prev) => {\n prev.push(false);\n return [...prev];\n });\n }\n\n function handleTransformDelete(index: number): void {\n const updatedTransforms = [...value];\n updatedTransforms.splice(index, 1);\n onChange(updatedTransforms);\n setTransformsCollapsed((prev) => {\n prev.splice(index, 1);\n return [...prev];\n });\n }\n\n function handleTransformCollapseExpand(index: number, collapsed: boolean): void {\n setTransformsCollapsed((prev) => {\n prev[index] = collapsed;\n return [...prev];\n });\n }\n\n return (\n <Stack gap={1} {...props}>\n {value.map((transform, i) => (\n <TransformEditorContainer\n key={i}\n index={i}\n value={transform}\n isCollapsed={transformsCollapsed[i] ?? true}\n onChange={(updatedTransform: Transform) => handleTransformChange(i, updatedTransform)}\n onDelete={() => handleTransformDelete(i)}\n onCollapse={(collapsed) => handleTransformCollapseExpand(i, collapsed)}\n />\n ))}\n\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleTransformAdd}>\n Add Transformation\n </Button>\n </Stack>\n );\n}\n"],"names":["Button","Stack","useState","AddIcon","TransformEditorContainer","TransformsEditor","value","onChange","props","transformsCollapsed","setTransformsCollapsed","map","handleTransformChange","index","transform","updatedTransforms","handleTransformAdd","push","kind","spec","prev","handleTransformDelete","splice","handleTransformCollapseExpand","collapsed","gap","i","isCollapsed","updatedTransform","onDelete","onCollapse","variant","startIcon","sx","marginTop","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,MAAM,EAAEC,KAAK,QAAoB,gBAAgB;AAC1D,SAAuBC,QAAQ,QAAQ,QAAQ;AAC/C,OAAOC,aAAa,uBAAuB;AAC3C,SAASC,wBAAwB,QAAQ,6BAA6B;AAOtE,OAAO,SAASC,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAA8B;IACnF,MAAM,CAACC,qBAAqBC,uBAAuB,GAAGR,SAASI,MAAMK,GAAG,CAAC,IAAM;IAE/E,SAASC,sBAAsBC,KAAa,EAAEC,SAAoB;QAChE,MAAMC,oBAAoB;eAAIT;SAAM;QACpCS,iBAAiB,CAACF,MAAM,GAAGC;QAC3BP,SAASQ;IACX;IAEA,SAASC;QACP,MAAMD,oBAAoB;eAAIT;SAAM;QACpC,sCAAsC;QACtCS,kBAAkBE,IAAI,CAAC;YAAEC,MAAM;YAAIC,MAAM,CAAC;QAAE;QAC5CZ,SAASQ;QACTL,uBAAuB,CAACU;YACtBA,KAAKH,IAAI,CAAC;YACV,OAAO;mBAAIG;aAAK;QAClB;IACF;IAEA,SAASC,sBAAsBR,KAAa;QAC1C,MAAME,oBAAoB;eAAIT;SAAM;QACpCS,kBAAkBO,MAAM,CAACT,OAAO;QAChCN,SAASQ;QACTL,uBAAuB,CAACU;YACtBA,KAAKE,MAAM,CAACT,OAAO;YACnB,OAAO;mBAAIO;aAAK;QAClB;IACF;IAEA,SAASG,8BAA8BV,KAAa,EAAEW,SAAkB;QACtEd,uBAAuB,CAACU;YACtBA,IAAI,CAACP,MAAM,GAAGW;YACd,OAAO;mBAAIJ;aAAK;QAClB;IACF;IAEA,qBACE,MAACnB;QAAMwB,KAAK;QAAI,GAAGjB,KAAK;;YACrBF,MAAMK,GAAG,CAAC,CAACG,WAAWY,kBACrB,KAACtB;oBAECS,OAAOa;oBACPpB,OAAOQ;oBACPa,aAAalB,mBAAmB,CAACiB,EAAE,IAAI;oBACvCnB,UAAU,CAACqB,mBAAgChB,sBAAsBc,GAAGE;oBACpEC,UAAU,IAAMR,sBAAsBK;oBACtCI,YAAY,CAACN,YAAcD,8BAA8BG,GAAGF;mBANvDE;0BAUT,KAAC1B;gBAAO+B,SAAQ;gBAAYC,yBAAW,KAAC7B;gBAAY8B,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASnB;0BAAoB;;;;AAK7G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/TransformsEditor/index.ts"],"sourcesContent":["// Copyright 2024 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 './TransformsEditor';\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,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ValueMappingEditor/ValueMappingEditor.tsx"],"sourcesContent":["// Copyright 2024 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 {\n Grid2Props as GridProps,\n IconButton,\n MenuItem,\n Stack,\n StackProps,\n TextField,\n Tooltip,\n Typography,\n Grid2 as Grid,\n} from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core';\nimport { FC } from 'react';\nimport { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';\n\ninterface ValueMappingConditionEditorProps extends Omit<StackProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (condition: ValueMapping) => void;\n}\n\nconst ConditionEditor: FC<ValueMappingConditionEditorProps> = ({ mapping, onChange, ...props }) => {\n switch (mapping.kind) {\n case 'Value':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Value\"\n placeholder=\"Exact value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, value: e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Range':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"From\"\n placeholder=\"Start of range\"\n value={mapping.spec?.from ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, from: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n <TextField\n label=\"To\"\n placeholder=\"End of range (inclusive)\"\n value={mapping.spec?.to ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: { ...mapping.spec, to: e.target.value === '' ? undefined : +e.target.value },\n })\n }\n fullWidth\n />\n </Stack>\n );\n case 'Regex':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Regular Expression\"\n placeholder=\"JavaScript regular expression\"\n value={mapping.spec?.pattern ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { ...mapping.spec, pattern: e.target.value } })}\n fullWidth\n />\n </Stack>\n );\n case 'Misc':\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n select\n label=\"Value\"\n value={mapping.spec?.value ?? ''}\n onChange={(e) => onChange({ ...mapping, spec: { value: e.target.value } } as ValueMapping)}\n SelectProps={{\n renderValue: (selected) => {\n switch (selected) {\n case 'empty':\n return 'Empty';\n case 'null':\n return 'Null';\n case 'NaN':\n return 'NaN';\n case 'true':\n return 'True';\n case 'false':\n return 'False';\n default:\n return String(selected);\n }\n },\n }}\n fullWidth\n >\n <MenuItem value=\"empty\">\n <Stack>\n <Typography>Empty</Typography>\n <Typography variant=\"caption\">Matches empty string</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"null\">\n <Stack>\n <Typography>Null</Typography>\n <Typography variant=\"caption\">Matches null or undefined</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"NaN\">\n <Stack>\n <Typography>NaN</Typography>\n <Typography variant=\"caption\">Matches Not a Number value</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"true\">\n <Stack>\n <Typography>True</Typography>\n <Typography variant=\"caption\">Matches true boolean</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"false\">\n <Stack>\n <Typography>False</Typography>\n <Typography variant=\"caption\">Matches false boolean</Typography>\n </Stack>\n </MenuItem>\n </TextField>\n </Stack>\n );\n default:\n return null;\n }\n};\nexport interface ValueMappingEditorProps extends Omit<GridProps, 'onChange'> {\n mapping: ValueMapping;\n onChange: (mapping: ValueMapping) => void;\n onDelete: () => void;\n}\n\nexport const ValueMappingEditor: FC<ValueMappingEditorProps> = ({ mapping, onChange, onDelete, ...props }) => {\n const handleColorChange = (color?: string): void => {\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec.result,\n color,\n },\n },\n } as ValueMapping);\n };\n return (\n <Grid container spacing={2} {...props}>\n <Grid size={{ xs: 5 }}>\n <Stack direction=\"row\" gap={1} width=\"100%\">\n <TextField\n select\n label=\"Type\"\n value={mapping.kind}\n onChange={(e) => onChange({ ...mapping, kind: e.target.value } as ValueMapping)}\n required\n sx={{ width: '120px' }}\n >\n <MenuItem value=\"Value\">\n <Stack>\n <Typography>Value</Typography>\n {mapping.kind !== 'Value' && <Typography variant=\"caption\">Matches an exact text value</Typography>}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Range\">\n <Stack>\n <Typography>Range</Typography>\n {mapping.kind !== 'Range' && (\n <Typography variant=\"caption\">Matches against a numerical range</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Regex\">\n <Stack>\n <Typography>Regex</Typography>\n {mapping.kind !== 'Regex' && (\n <Typography variant=\"caption\">Matches against a regular expression</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Misc\">\n <Stack>\n <Typography>Misc</Typography>\n {mapping.kind !== 'Misc' && (\n <Typography variant=\"caption\">Matches against empty, null and NaN values</Typography>\n )}\n </Stack>\n </MenuItem>\n </TextField>\n <ConditionEditor\n width=\"100%\"\n mapping={mapping}\n onChange={(updatedMapping) => onChange({ ...mapping, ...updatedMapping })}\n />\n </Stack>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <TextField\n label=\"Display text\"\n value={mapping.spec?.result?.value ?? ''}\n onChange={(e) =>\n onChange({\n ...mapping,\n spec: {\n ...mapping.spec,\n result: {\n ...mapping.spec?.result,\n value: e.target.value,\n },\n },\n } as ValueMapping)\n }\n fullWidth\n />\n </Grid>\n <Grid size={{ xs: 1 }}>\n <Stack direction=\"row\" justifyContent=\"center\" gap={1}>\n {mapping.spec?.result?.color ? (\n <OptionsColorPicker\n label=\"Color\"\n color={mapping.spec.result.color ?? '#000'}\n onColorChange={handleColorChange}\n onClear={() => handleColorChange(undefined)}\n />\n ) : (\n <IconButton onClick={() => handleColorChange('#000')}>\n <PlusIcon />\n </IconButton>\n )}\n </Stack>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"end\">\n <Tooltip title=\"Remove mapping settings\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Grid>\n </Grid>\n );\n};\n"],"names":["IconButton","MenuItem","Stack","TextField","Tooltip","Typography","Grid2","Grid","DeleteIcon","PlusIcon","OptionsColorPicker","ConditionEditor","mapping","onChange","props","kind","gap","direction","label","placeholder","value","spec","e","target","fullWidth","from","undefined","to","pattern","select","SelectProps","renderValue","selected","String","variant","ValueMappingEditor","onDelete","handleColorChange","color","result","container","spacing","size","xs","width","required","sx","updatedMapping","justifyContent","onColorChange","onClear","onClick","textAlign","title","placement","marginLeft"],"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,SAEEA,UAAU,EACVC,QAAQ,EACRC,KAAK,EAELC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,SAASC,IAAI,QACR,gBAAgB;AACvB,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,cAAc,uBAAuB;AAG5C,SAASC,kBAAkB,QAAQ,oCAAoC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Mb,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/ValueMappingEditor/ValueMappingsEditor.tsx"],"sourcesContent":["// Copyright 2024 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 { Button, Divider, Stack, Typography, Grid2 as Grid } from '@mui/material';\n\nimport { FC, useState } from 'react';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { ValueMapping } from '@perses-dev/core';\nimport { ValueMappingEditor } from './ValueMappingEditor';\n\nexport interface ValueMappingsEditorProps {\n mappings: ValueMapping[];\n onChange: (valueMappings: ValueMapping[]) => void;\n}\n\nexport const ValueMappingsEditor: FC<ValueMappingsEditorProps> = ({ mappings, onChange }) => {\n const [valueMappings, setValueMappings] = useState<ValueMapping[]>(mappings);\n\n function handleValueMappingChange(index: number, mapping: ValueMapping): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings[index] = mapping;\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleAddValueMappingEditor(): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.push({ kind: 'Value', spec: { result: { value: '' } } } as ValueMapping);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n function handleValueMappingDelete(index: number): void {\n const updatedValueMapings = [...valueMappings];\n updatedValueMapings.splice(index, 1);\n setValueMappings(updatedValueMapings);\n onChange(updatedValueMapings);\n }\n\n return (\n <Stack spacing={1}>\n <Grid container spacing={2}>\n <Grid size={{ xs: 5 }}>\n <Typography variant=\"subtitle1\">Condition</Typography>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <Typography variant=\"subtitle1\">Display Text</Typography>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"center\">\n <Typography variant=\"subtitle1\">Color</Typography>\n </Grid>\n <Grid size={{ xs: 1 }}></Grid>\n </Grid>\n <Stack gap={1.5} divider={<Divider flexItem orientation=\"horizontal\" />}>\n {valueMappings.map((mapping, i) => (\n <ValueMappingEditor\n key={i}\n mapping={mapping}\n onChange={(updatedMapping: ValueMapping) => handleValueMappingChange(i, updatedMapping)}\n onDelete={() => handleValueMappingDelete(i)}\n />\n ))}\n </Stack>\n\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleAddValueMappingEditor}>\n Add value mappings\n </Button>\n </Stack>\n );\n};\n"],"names":["Button","Divider","Stack","Typography","Grid2","Grid","useState","AddIcon","ValueMappingEditor","ValueMappingsEditor","mappings","onChange","valueMappings","setValueMappings","handleValueMappingChange","index","mapping","updatedValueMapings","handleAddValueMappingEditor","push","kind","spec","result","value","handleValueMappingDelete","splice","spacing","container","size","xs","variant","textAlign","gap","divider","flexItem","orientation","map","i","updatedMapping","onDelete","startIcon","sx","marginTop","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAASC,IAAI,QAAQ,gBAAgB;AAElF,SAAaC,QAAQ,QAAQ,QAAQ;AACrC,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,kBAAkB,QAAQ,uBAAuB;AAO1D,OAAO,MAAMC,sBAAoD,CAAC,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;IACtF,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,SAAyBI;IAEnE,SAASI,yBAAyBC,KAA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gBAAE;gBAAGC,SAASzB;0BAA6B;;;;AAKtH,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/ValueMappingEditor/index.ts"],"sourcesContent":["// Copyright 2024 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 './ValueMappingsEditor';\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,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/YAxisLabel.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, Typography } from '@mui/material';\nimport { ReactElement } from 'react';\n\ninterface YAxisLabelProps {\n name: string;\n height: number;\n}\n\nexport function YAxisLabel({ name, height }: YAxisLabelProps): ReactElement {\n return (\n <Box\n style={{\n maxWidth: height, // allows rotated text to truncate instead of causing overlap\n top: `calc(${height}px / 2)`,\n }}\n sx={{\n display: 'inline-block',\n position: 'absolute',\n transform: 'translateX(-50%) rotate(-90deg)',\n transformOrigin: 'top',\n textAlign: 'center',\n zIndex: 1,\n }}\n >\n <Typography\n variant=\"body1\"\n aria-label=\"y axis label\"\n sx={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {name}\n </Typography>\n </Box>\n );\n}\n"],"names":["Box","Typography","YAxisLabel","name","height","style","maxWidth","top","sx","display","position","transform","transformOrigin","textAlign","zIndex","variant","aria-label","whiteSpace","overflow","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,UAAU,QAAQ,gBAAgB;AAQhD,OAAO,SAASC,WAAW,EAAEC,IAAI,EAAEC,MAAM,EAAmB;IAC1D,qBACE,KAACJ;QACCK,OAAO;YACLC,UAAUF;YACVG,KAAK,CAAC,KAAK,EAAEH,OAAO,OAAO,CAAC;QAC9B;QACAI,IAAI;YACFC,SAAS;YACTC,UAAU;YACVC,WAAW;YACXC,iBAAiB;YACjBC,WAAW;YACXC,QAAQ;QACV;kBAEA,cAAA,KAACb;YACCc,SAAQ;YACRC,cAAW;YACXR,IAAI;gBACFS,YAAY;gBACZC,UAAU;gBACVC,cAAc;YAChB;sBAEChB;;;AAIT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/ChartsProvider.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, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n enableSyncGrouping?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n enableSyncGrouping: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n enableSyncGrouping,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"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,OAAOA,SAASC,aAAa,EAAgBC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAmB1F,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAEC,qBAAqB,IAAI,EAAE,GAAGJ;IAEpF,MAAM,CAACK,yBAAyBC,2BAA2B,GAAGR,SAAmC;IAEjG,MAAMS,MAAMV,QAAQ;QAClB,OAAO;YACLK;YACAC;YACAE;YACAD;YACAE;QACF;IACF,GAAG;QAACJ;QAAaC;QAAeC;QAAoBC;QAAyBC;KAA2B;IAExG,qBAAO,KAACE,mBAAmBC,QAAQ;QAACC,OAAOH;kBAAMN;;AACnD;AAEA,OAAO,MAAMO,mCAAqBb,cAA6CgB,WAAW;AAE1F,OAAO,SAASC;IACd,MAAML,MAAMX,WAAWY;IACvB,IAAID,QAAQI,WAAW;QACrB,MAAM,IAAIE,MAAM;IAClB;IACA,OAAON;AACT;AAEA,OAAO,SAASO;IACd,MAAMP,MAAMK;IACZ,OAAOL,IAAIL,WAAW;AACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/SnackbarProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useCallback } from 'react';\nimport {\n SnackbarProvider as NotistackProvider,\n ProviderContext as NotistackContext,\n useSnackbar as useNotistack,\n SnackbarMessage,\n OptionsObject,\n SnackbarKey,\n} from 'notistack';\n\nexport interface SnackbarContext extends NotistackContext {\n errorSnackbar: EnqueueFunction;\n infoSnackbar: EnqueueFunction;\n warningSnackbar: EnqueueFunction;\n successSnackbar: EnqueueFunction;\n\n /**\n * Useful for catch blocks where the error will be of type `unknown`, tries\n * to show the `message` property if passed an instance of `Error`.\n */\n exceptionSnackbar: (error: unknown, options?: SnackbarOptions) => SnackbarKey;\n}\n\ntype EnqueueFunction = (message: SnackbarMessage, options?: SnackbarOptions) => SnackbarKey;\n\ntype SnackbarOptions = Omit<OptionsObject, 'variant'>;\n\n/**\n * Application-wide provider for showing snackbars/toasts.\n */\nexport { NotistackProvider as SnackbarProvider };\n\n/**\n * Gets the SnackbarContext with methods for displaying snackbars/toasts.\n */\nexport function useSnackbar(): SnackbarContext {\n const { enqueueSnackbar, closeSnackbar } = useNotistack();\n\n // Create variant-specific callbacks\n const errorSnackbar = useEnqueueFunction(enqueueSnackbar, 'error');\n const infoSnackbar = useEnqueueFunction(enqueueSnackbar, 'info');\n const warningSnackbar = useEnqueueFunction(enqueueSnackbar, 'warning');\n const successSnackbar = useEnqueueFunction(enqueueSnackbar, 'success');\n\n const exceptionSnackbar: SnackbarContext['exceptionSnackbar'] = useCallback(\n (error, options) => {\n // Try to use message prop, but fallback to a default message that\n // will just stringify the error provided\n const message = error instanceof Error ? error.message : `An unexpected error occurred: ${error}`;\n\n return errorSnackbar(message, options);\n },\n [errorSnackbar]\n );\n\n return {\n enqueueSnackbar,\n closeSnackbar,\n errorSnackbar,\n infoSnackbar,\n warningSnackbar,\n successSnackbar,\n exceptionSnackbar,\n };\n}\n\n// Helper to create a variant-specific enqueue function\nfunction useEnqueueFunction(\n enqueueSnackbar: NotistackContext['enqueueSnackbar'],\n variant: OptionsObject['variant']\n): EnqueueFunction {\n return useCallback(\n (message, options) => {\n const allOptions: OptionsObject = {\n ...options,\n variant,\n };\n return enqueueSnackbar(message, allOptions);\n },\n [enqueueSnackbar, variant]\n );\n}\n"],"names":["useCallback","SnackbarProvider","NotistackProvider","useSnackbar","useNotistack","enqueueSnackbar","closeSnackbar","errorSnackbar","useEnqueueFunction","infoSnackbar","warningSnackbar","successSnackbar","exceptionSnackbar","error","options","message","Error","variant","allOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,QAAQ,QAAQ;AACpC,SACEC,oBAAoBC,iBAAiB,EAErCC,eAAeC,YAAY,QAItB,YAAY;AAmBnB;;CAEC,GACD,SAASF,qBAAqBD,gBAAgB,GAAG;AAEjD;;CAEC,GACD,OAAO,SAASE;IACd,MAAM,EAAEE,eAAe,EAAEC,aAAa,EAAE,GAAGF;IAE3C,oCAAoC;IACpC,MAAMG,gBAAgBC,mBAAmBH,iBAAiB;IAC1D,MAAMI,eAAeD,mBAAmBH,iBAAiB;IACzD,MAAMK,kBAAkBF,mBAAmBH,iBAAiB;IAC5D,MAAMM,kBAAkBH,mBAAmBH,iBAAiB;IAE5D,MAAMO,oBAA0DZ,YAC9D,CAACa,OAAOC;QACN,kEAAkE;QAClE,yCAAyC;QACzC,MAAMC,UAAUF,iBAAiBG,QAAQH,MAAME,OAAO,GAAG,CAAC,8BAA8B,EAAEF,OAAO;QAEjG,OAAON,cAAcQ,SAASD;IAChC,GACA;QAACP;KAAc;IAGjB,OAAO;QACLF;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;IACF;AACF;AAEA,uDAAuD;AACvD,SAASJ,mBACPH,eAAoD,EACpDY,OAAiC;IAEjC,OAAOjB,YACL,CAACe,SAASD;QACR,MAAMI,aAA4B;YAChC,GAAGJ,OAAO;YACVG;QACF;QACA,OAAOZ,gBAAgBU,SAASG;IAClC,GACA;QAACb;QAAiBY;KAAQ;AAE9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/TimeZoneProvider.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, { createContext, ReactElement, useContext } from 'react';\nimport { formatWithTimeZone, dateFormatOptionsWithTimeZone } from '../utils';\n\nexport const TimeZoneContext = createContext<string | undefined>(undefined);\n\nexport interface TimeZoneProviderProps {\n timeZone?: string;\n children?: React.ReactNode;\n}\n\nexport function TimeZoneProvider(props: TimeZoneProviderProps): ReactElement {\n const { children, timeZone } = props;\n return <TimeZoneContext.Provider value={timeZone}>{children}</TimeZoneContext.Provider>;\n}\n\nexport function useTimeZone(): {\n timeZone: string;\n formatWithUserTimeZone: (date: Date, formatString: string) => string;\n dateFormatOptionsWithUserTimeZone: (dateFormatOptions: Intl.DateTimeFormatOptions) => Intl.DateTimeFormatOptions;\n} {\n const timeZone = useContext(TimeZoneContext);\n return {\n // fallback to \"local\" timezone if TimeZoneProvider is not present in the React tree\n timeZone: timeZone ?? 'local',\n formatWithUserTimeZone(date: Date, formatString: string): string {\n return formatWithTimeZone(date, formatString, timeZone);\n },\n dateFormatOptionsWithUserTimeZone(dateFormatOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions {\n return dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone);\n },\n };\n}\n"],"names":["React","createContext","useContext","formatWithTimeZone","dateFormatOptionsWithTimeZone","TimeZoneContext","undefined","TimeZoneProvider","props","children","timeZone","Provider","value","useTimeZone","formatWithUserTimeZone","date","formatString","dateFormatOptionsWithUserTimeZone","dateFormatOptions"],"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,OAAOA,SAASC,aAAa,EAAgBC,UAAU,QAAQ,QAAQ;AACvE,SAASC,kBAAkB,EAAEC,6BAA6B,QAAQ,WAAW;AAE7E,OAAO,MAAMC,gCAAkBJ,cAAkCK,WAAW;AAO5E,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF;IAC/B,qBAAO,KAACH,gBAAgBM,QAAQ;QAACC,OAAOF;kBAAWD;;AACrD;AAEA,OAAO,SAASI;IAKd,MAAMH,WAAWR,WAAWG;IAC5B,OAAO;QACL,oFAAoF;QACpFK,UAAUA,YAAY;QACtBI,wBAAuBC,IAAU,EAAEC,YAAoB;YACrD,OAAOb,mBAAmBY,MAAMC,cAAcN;QAChD;QACAO,mCAAkCC,iBAA6C;YAC7E,OAAOd,8BAA8Bc,mBAAmBR;QAC1D;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/context/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 './ChartsProvider';\nexport * from './SnackbarProvider';\nexport * from './TimeZoneProvider';\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,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/TextField.tsx"],"sourcesContent":["// Copyright 2024 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 { TextFieldProps as MuiTextFieldProps, TextField as MuiTextField } from '@mui/material';\nimport { ChangeEvent, ForwardedRef, forwardRef, useCallback, useMemo, useState } from 'react';\nimport debounce from 'lodash/debounce';\n\ntype TextFieldProps = Omit<MuiTextFieldProps, 'onChange'> & { debounceMs?: number; onChange?: (value: string) => void };\n\nexport const TextField = forwardRef(function (\n { debounceMs = 250, value, onChange, ...props }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const [currentValue, setCurrentValue] = useState(value);\n\n function handleChange(event: ChangeEvent<HTMLInputElement>): void {\n setCurrentValue(event.target.value);\n debounceFn(event.target.value);\n }\n\n const handleDebounceFn = useCallback(\n (inputValue: string) => {\n onChange?.(inputValue);\n },\n [onChange]\n );\n\n const debounceFn = useMemo(() => debounce(handleDebounceFn, debounceMs), [debounceMs, handleDebounceFn]);\n\n return <MuiTextField ref={ref} value={currentValue} onChange={handleChange} {...props} />;\n});\nTextField.displayName = 'TextField';\n"],"names":["TextField","MuiTextField","forwardRef","useCallback","useMemo","useState","debounce","debounceMs","value","onChange","props","ref","currentValue","setCurrentValue","handleChange","event","target","debounceFn","handleDebounceFn","inputValue","displayName"],"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,SAA8CA,aAAaC,YAAY,QAAQ,gBAAgB;AAC/F,SAAoCC,UAAU,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC9F,OAAOC,cAAc,kBAAkB;AAIvC,OAAO,MAAMN,0BAAYE,WAAW,SAClC,EAAEK,aAAa,GAAG,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAuB,EAC/DC,GAAiC;IAEjC,MAAM,CAACC,cAAcC,gBAAgB,GAAGR,SAASG;IAEjD,SAASM,aAAaC,KAAoC;QACxDF,gBAAgBE,MAAMC,MAAM,CAACR,KAAK;QAClCS,WAAWF,MAAMC,MAAM,CAACR,KAAK;IAC/B;IAEA,MAAMU,mBAAmBf,YACvB,CAACgB;QACCV,WAAWU;IACb,GACA;QAACV;KAAS;IAGZ,MAAMQ,aAAab,QAAQ,IAAME,SAASY,kBAAkBX,aAAa;QAACA;QAAYW;KAAiB;IAEvG,qBAAO,KAACjB;QAAaU,KAAKA;QAAKH,OAAOI;QAAcH,UAAUK;QAAe,GAAGJ,KAAK;;AACvF,GAAG;AACHV,UAAUoB,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/index.ts"],"sourcesContent":["// Copyright 2024 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 './TextField';\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,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AlignSelector';\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './controls';\nexport * from './Dialog';\nexport * from './DensitySelector';\nexport * from './DragAndDrop';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './FormEditor';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LinksEditor';\nexport * from './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './Overlay';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeRangeSelector';\nexport * from './TimeSeriesTooltip';\nexport * from './ToolbarIconButton';\nexport * from './FormatControls';\nexport * from './YAxisLabel';\nexport * from './context';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './TransformsEditor';\nexport * from './RefreshIntervalPicker';\nexport * from './ValueMappingEditor';\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,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB;AACnC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,YAAY;AAC1B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/graph.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesValueTuple } from '@perses-dev/core';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport { LegendItem } from '../Legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n id?: string;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {\n data: EChartsValues[];\n}\n\n// Used for TimeChart dataset support, each time series returned is mapped to series options using datasetIndex\n// - https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\nexport type TimeChartSeriesMapping = TimeSeriesOption[];\nexport type TimeChartLegendItems = LegendItem[];\n\nexport type TimeSeriesOption = LineSeriesOption | BarSeriesOption;\n\nexport type EChartsDataFormat = {\n timeSeries: LegacyTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n\n// Intentionally making this an object to start because it is plausible we will\n// want to support focusing by other attributes (e.g. index, name) in the future,\n// and starting with an object will make adding them a non-breaking change.\nexport type ChartInstanceFocusOpts = {\n name?: string; // e.g the TimeSeriesChart plugin uses name\n};\n\nexport type ChartInstance = {\n /**\n * Highlight the series associated with the specified options.\n */\n highlightSeries: (opts: ChartInstanceFocusOpts) => void;\n\n /**\n * Clear all highlighted series.\n */\n clearHighlightedSeries: () => void;\n};\n\nexport const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';\n\nexport const DEFAULT_PINNED_CROSSHAIR: LineSeriesOption = {\n name: PINNED_CROSSHAIR_SERIES_NAME,\n type: 'line',\n // https://echarts.apache.org/en/option.html#series-line.markLine\n markLine: {\n data: [],\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n blur: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n },\n};\n\nexport interface DatapointInfo {\n dataIndex: number;\n seriesIndex: number;\n seriesName: string;\n yValue: number;\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","PINNED_CROSSHAIR_SERIES_NAME","DEFAULT_PINNED_CROSSHAIR","name","type","markLine","data","lineStyle","width","emphasis","opacity","blur"],"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;AAMjC,0EAA0E;AAC1E,OAAO,MAAMA,8BAA8B,KAAK;AAkDhD,OAAO,MAAMC,+BAA+B,mBAAmB;AAE/D,OAAO,MAAMC,2BAA6C;IACxDC,MAAMF;IACNG,MAAM;IACN,iEAAiE;IACjEC,UAAU;QACRC,MAAM,EAAE;QACRC,WAAW;YACTH,MAAM;YACNI,OAAO;QACT;QACAC,UAAU;YACRF,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;QACAC,MAAM;YACJJ,WAAW;gBACTC,OAAO;gBACPE,SAAS;YACX;QACF;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/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 './graph';\nexport * from './theme';\nexport * from './timeOption';\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,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ThresholdColorPalette } from '@perses-dev/core';\nimport type {\n EChartsOption,\n BarSeriesOption,\n LineSeriesOption,\n GaugeSeriesOption,\n TitleComponentOption,\n ComposeOption,\n XAXisComponentOption,\n YAXisComponentOption,\n} from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: NoDataOption;\n sparkline: {\n width: number;\n color: string;\n };\n /**\n * Theming for the container that wraps a chart.\n */\n container: {\n /**\n * Padding in pixels.\n */\n padding: {\n default: number;\n };\n };\n thresholds: ThresholdColorPalette;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, chart tooltip uses the body of the top-level document object.\n */\n tooltipPortalContainerId?: string;\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n\nexport type NoDataOption = ComposeOption<TitleComponentOption | XAXisComponentOption | YAXisComponentOption>;\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;AA+CjC,WAA6G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/timeOption.ts"],"sourcesContent":["// Copyright 2024 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 { DurationString, parseDurationString, RelativeTimeRange } from '@perses-dev/core';\nimport { formatDuration } from 'date-fns';\n\nexport interface TimeOption {\n value: RelativeTimeRange;\n display: string;\n}\n\nexport function buildRelativeTimeOption(duration: DurationString): TimeOption {\n return {\n value: { pastDuration: duration },\n display: `Last ${formatDuration(parseDurationString(duration), { delimiter: ', ' })}`,\n };\n}\n"],"names":["parseDurationString","formatDuration","buildRelativeTimeOption","duration","value","pastDuration","display","delimiter"],"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,SAAyBA,mBAAmB,QAA2B,mBAAmB;AAC1F,SAASC,cAAc,QAAQ,WAAW;AAO1C,OAAO,SAASC,wBAAwBC,QAAwB;IAC9D,OAAO;QACLC,OAAO;YAAEC,cAAcF;QAAS;QAChCG,SAAS,CAAC,KAAK,EAAEL,eAAeD,oBAAoBG,WAAW;YAAEI,WAAW;QAAK,IAAI;IACvF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/test/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 './render';\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,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/test/render.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, RenderOptions, RenderResult } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactElement } from 'react';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["render","QueryClient","QueryClientProvider","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqC,yBAAyB;AAC7E,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAGzE,MAAMC,cAAc,IAAIF,YAAY;IAAEG,gBAAgB;QAAEC,SAAS;YAAEC,sBAAsB;QAAM;IAAE;AAAE;AAEnG;;CAEC,GACD,OAAO,SAASC,kBAAkBC,EAAgB,EAAEC,OAAwC;IAC1F,OAAOT,qBAAO,KAACE;QAAoBQ,QAAQP;kBAAcK;QAA2BC;AACtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/test/setup-tests.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\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,iCAAiC;AACjC,OAAO,0CAA0C;AAEjD,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/test-utils/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 './theme';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/test-utils/theme.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createTheme as createMuiTheme } from '@mui/material';\nimport { PersesChartsTheme, EChartsTheme } from '../model';\nimport { generateChartsTheme } from '../utils';\nimport { SharedChartsState } from '../context';\n\n// app specific echarts option overrides\nconst TEST_ECHARTS_THEME_OVERRIDES: EChartsTheme = {\n textStyle: { fontFamily: 'Lato' },\n categoryAxis: {\n splitLine: {\n show: false,\n },\n },\n timeAxis: {\n splitLine: {\n show: false,\n },\n },\n bar: {\n barCategoryGap: 2,\n },\n};\n\nexport const testChartsTheme: PersesChartsTheme = generateChartsTheme(createMuiTheme({}), {\n echartsTheme: TEST_ECHARTS_THEME_OVERRIDES,\n});\n\nexport const mockChartsContext: SharedChartsState = {\n chartsTheme: testChartsTheme,\n enablePinning: false,\n enableSyncGrouping: true,\n lastTooltipPinnedCoords: null,\n setLastTooltipPinnedCoords: () => null,\n};\n"],"names":["createTheme","createMuiTheme","generateChartsTheme","TEST_ECHARTS_THEME_OVERRIDES","textStyle","fontFamily","categoryAxis","splitLine","show","timeAxis","bar","barCategoryGap","testChartsTheme","echartsTheme","mockChartsContext","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAeC,cAAc,QAAQ,gBAAgB;AAE9D,SAASC,mBAAmB,QAAQ,WAAW;AAG/C,wCAAwC;AACxC,MAAMC,+BAA6C;IACjDC,WAAW;QAAEC,YAAY;IAAO;IAChCC,cAAc;QACZC,WAAW;YACTC,MAAM;QACR;IACF;IACAC,UAAU;QACRF,WAAW;YACTC,MAAM;QACR;IACF;IACAE,KAAK;QACHC,gBAAgB;IAClB;AACF;AAEA,OAAO,MAAMC,kBAAqCV,oBAAoBD,eAAe,CAAC,IAAI;IACxFY,cAAcV;AAChB,GAAG;AAEH,OAAO,MAAMW,oBAAuC;IAClDC,aAAaH;IACbI,eAAe;IACfC,oBAAoB;IACpBC,yBAAyB;IACzBC,4BAA4B,IAAM;AACpC,EAAE"}
|