@perses-dev/components 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
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/BarChart/BarChart.d.ts +3 -4
- package/dist/BarChart/BarChart.d.ts.map +1 -1
- package/dist/BarChart/BarChart.js +17 -11
- package/dist/BarChart/BarChart.js.map +1 -1
- package/dist/BarChart/index.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.d.ts +1 -2
- package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/ColorPicker.js +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.d.ts +1 -2
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +2 -2
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/index.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +3 -3
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +21 -21
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +1 -2
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +8 -24
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +1 -2
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +2 -2
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/DateTimeRangePicker/index.js.map +1 -1
- package/dist/DateTimeRangePicker/utils.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +6 -6
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +5 -5
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +1 -2
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/Dialog/index.js.map +1 -1
- package/dist/Drawer/Drawer.d.ts +1 -2
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +4 -3
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Drawer/index.js.map +1 -1
- package/dist/EChart/EChart.d.ts +7 -7
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +3 -3
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/EChart/index.js.map +1 -1
- package/dist/ErrorAlert.d.ts +1 -2
- package/dist/ErrorAlert.d.ts.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -3
- package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FontSizeSelector/index.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +8 -0
- package/dist/FormatControls/FormatControls.d.ts.map +1 -0
- package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
- package/dist/FormatControls/FormatControls.js.map +1 -0
- package/dist/FormatControls/index.d.ts +2 -0
- package/dist/FormatControls/index.d.ts.map +1 -0
- package/dist/{UnitSelector → FormatControls}/index.js +1 -1
- package/dist/FormatControls/index.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.d.ts +6 -7
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +12 -12
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/GaugeChart/index.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.d.ts +2 -2
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +4 -4
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.d.ts +4 -4
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +9 -8
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +1 -2
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +1 -2
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +4 -4
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +1 -2
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +2 -2
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +7 -11
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts +1 -2
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +2 -2
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +2 -2
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +2 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +22 -24
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.d.ts +2 -3
- package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +2 -2
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/ModeSelector/index.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -3
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -2
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +23 -7
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RefreshIntervalPicker/index.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +4 -4
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SettingsAutocomplete/index.js.map +1 -1
- package/dist/SortSelector/SortSelector.d.ts +2 -3
- package/dist/SortSelector/SortSelector.d.ts.map +1 -1
- package/dist/SortSelector/SortSelector.js +2 -2
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +3 -4
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +10 -10
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.js +8 -8
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/StatChart/index.js.map +1 -1
- package/dist/Table/InnerTable.d.ts +2 -2
- package/dist/Table/InnerTable.d.ts.map +1 -1
- package/dist/Table/InnerTable.js +2 -2
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -2
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -3
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.d.ts +2 -2
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.d.ts +1 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +4 -4
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.d.ts +1 -2
- package/dist/Table/TableCheckbox.d.ts.map +1 -1
- package/dist/Table/TableCheckbox.js +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableHead.d.ts +2 -2
- package/dist/Table/TableHead.d.ts.map +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +1 -2
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.d.ts +1 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +2 -2
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +8 -8
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts +2 -2
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.d.ts +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +21 -21
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +6 -6
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +11 -11
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +1 -2
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.js +4 -4
- package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -2
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +23 -21
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/ThresholdsEditor/index.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts +3 -3
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +110 -67
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeChart/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +11 -10
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -2
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +3 -3
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +1 -2
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +1 -2
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +6 -6
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts +1 -2
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +2 -2
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +7 -7
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +8 -8
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +44 -45
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +13 -26
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +5 -11
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +5 -4
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
- package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
- package/dist/ToolbarIconButton/ToolbarIconButton.js +32 -0
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
- package/dist/ToolbarIconButton/index.d.ts +2 -0
- package/dist/ToolbarIconButton/index.d.ts.map +1 -0
- package/dist/ToolbarIconButton/index.js +15 -0
- package/dist/ToolbarIconButton/index.js.map +1 -0
- package/dist/YAxisLabel.d.ts +1 -2
- package/dist/YAxisLabel.d.ts.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/BarChart/BarChart.js +25 -17
- package/dist/cjs/BarChart/index.js +10 -8
- package/dist/cjs/ColorPicker/ColorPicker.js +19 -15
- package/dist/cjs/ColorPicker/index.js +10 -8
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +13 -11
- package/dist/cjs/ContentWithLegend/index.js +10 -8
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +29 -25
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +30 -44
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +13 -11
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +14 -12
- package/dist/cjs/DateTimeRangePicker/index.js +12 -10
- package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
- package/dist/cjs/Dialog/Dialog.js +16 -14
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +12 -10
- package/dist/cjs/Dialog/index.js +11 -9
- package/dist/cjs/Drawer/Drawer.js +8 -5
- package/dist/cjs/Drawer/index.js +10 -8
- package/dist/cjs/EChart/EChart.js +16 -12
- package/dist/cjs/EChart/index.js +10 -8
- package/dist/cjs/ErrorAlert.js +6 -4
- package/dist/cjs/ErrorBoundary.js +4 -2
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +10 -8
- package/dist/cjs/FontSizeSelector/index.js +10 -8
- package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
- package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
- package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
- package/dist/cjs/GaugeChart/index.js +10 -8
- package/dist/cjs/InfoTooltip/InfoTooltip.js +16 -14
- package/dist/cjs/InfoTooltip/index.js +10 -8
- package/dist/cjs/JSONEditor.js +19 -16
- package/dist/cjs/Legend/CompactLegend.js +10 -8
- package/dist/cjs/Legend/Legend.js +16 -14
- package/dist/cjs/Legend/LegendColorBadge.js +8 -6
- package/dist/cjs/Legend/ListLegend.js +11 -9
- package/dist/cjs/Legend/ListLegendItem.js +20 -20
- package/dist/cjs/Legend/TableLegend.js +8 -6
- package/dist/cjs/Legend/index.js +11 -9
- package/dist/cjs/Legend/legend-model.js +3 -1
- package/dist/cjs/LineChart/LineChart.js +31 -31
- package/dist/cjs/LineChart/index.js +10 -8
- package/dist/cjs/ModeSelector/ModeSelector.js +10 -8
- package/dist/cjs/ModeSelector/index.js +10 -8
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +7 -5
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +17 -15
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +6 -4
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +12 -10
- package/dist/cjs/OptionsEditorLayout/index.js +13 -11
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +28 -10
- package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +13 -11
- package/dist/cjs/SettingsAutocomplete/index.js +10 -8
- package/dist/cjs/SortSelector/SortSelector.js +10 -8
- package/dist/cjs/SortSelector/index.js +10 -8
- package/dist/cjs/StatChart/StatChart.js +22 -20
- package/dist/cjs/StatChart/calculateFontSize.js +11 -9
- package/dist/cjs/StatChart/index.js +10 -8
- package/dist/cjs/Table/InnerTable.js +7 -5
- package/dist/cjs/Table/Table.js +18 -16
- package/dist/cjs/Table/TableBody.js +5 -3
- package/dist/cjs/Table/TableCell.js +12 -10
- package/dist/cjs/Table/TableCheckbox.js +6 -4
- package/dist/cjs/Table/TableHead.js +5 -3
- package/dist/cjs/Table/TableHeaderCell.js +9 -7
- package/dist/cjs/Table/TableRow.js +5 -3
- package/dist/cjs/Table/VirtualizedTable.js +34 -32
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +4 -2
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +24 -22
- package/dist/cjs/Table/index.js +14 -10
- package/dist/cjs/Table/model/table-model.js +17 -13
- package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +17 -15
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +15 -13
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +50 -44
- package/dist/cjs/ThresholdsEditor/index.js +10 -8
- package/dist/cjs/TimeChart/TimeChart.js +123 -78
- package/dist/cjs/TimeChart/index.js +10 -8
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +31 -28
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +18 -16
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +16 -14
- package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +6 -4
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +23 -21
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +9 -7
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +35 -33
- package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +70 -53
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +56 -28
- package/dist/cjs/TimeSeriesTooltip/utils.js +19 -14
- package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +40 -0
- package/dist/cjs/ToolbarIconButton/index.js +30 -0
- package/dist/cjs/YAxisLabel.js +7 -5
- package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +41 -12
- package/dist/cjs/context/SnackbarProvider.js +7 -3
- package/dist/cjs/context/TimeZoneProvider.js +17 -9
- package/dist/cjs/context/index.js +32 -0
- package/dist/cjs/index.js +42 -41
- package/dist/cjs/model/graph.js +9 -3
- package/dist/cjs/model/index.js +12 -10
- package/dist/cjs/test/index.js +10 -8
- package/dist/cjs/test/render.js +7 -5
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/theme.js +38 -19
- package/dist/cjs/theme/component-overrides/alert.js +7 -5
- package/dist/cjs/theme/component-overrides/paper.js +4 -2
- package/dist/cjs/theme/index.js +10 -8
- package/dist/cjs/theme/palette/background.js +6 -2
- package/dist/cjs/theme/palette/colors/blue.js +3 -1
- package/dist/cjs/theme/palette/colors/common.js +6 -2
- package/dist/cjs/theme/palette/colors/green.js +3 -1
- package/dist/cjs/theme/palette/colors/grey.js +3 -1
- package/dist/cjs/theme/palette/colors/index.js +17 -15
- package/dist/cjs/theme/palette/colors/orange.js +3 -1
- package/dist/cjs/theme/palette/colors/purple.js +3 -1
- package/dist/cjs/theme/palette/colors/red.js +3 -1
- package/dist/cjs/theme/palette/error.js +3 -1
- package/dist/cjs/theme/palette/grey.js +3 -1
- package/dist/cjs/theme/palette/index.js +10 -8
- package/dist/cjs/theme/palette/palette-options.js +3 -1
- package/dist/cjs/theme/palette/primary.js +3 -1
- package/dist/cjs/theme/palette/secondary.js +3 -1
- package/dist/cjs/theme/palette/success.js +3 -1
- package/dist/cjs/theme/palette/text.js +3 -1
- package/dist/cjs/theme/palette/warning.js +3 -1
- package/dist/cjs/theme/theme.js +6 -4
- package/dist/cjs/theme/typography.js +3 -1
- package/dist/cjs/utils/axis.js +11 -7
- package/dist/cjs/utils/chart-actions.js +68 -12
- package/dist/cjs/utils/combine-sx.js +3 -1
- package/dist/cjs/utils/component-ids.js +3 -1
- package/dist/cjs/utils/format.js +16 -8
- package/dist/cjs/utils/index.js +15 -13
- package/dist/cjs/utils/mathjs.js +4 -2
- package/dist/cjs/utils/theme-gen.js +16 -18
- package/dist/context/ChartsProvider.d.ts +19 -0
- package/dist/context/ChartsProvider.d.ts.map +1 -0
- package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
- package/dist/context/ChartsProvider.js.map +1 -0
- package/dist/context/SnackbarProvider.d.ts +2 -2
- package/dist/context/SnackbarProvider.d.ts.map +1 -1
- package/dist/context/SnackbarProvider.js +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.d.ts +1 -1
- package/dist/context/TimeZoneProvider.d.ts.map +1 -1
- package/dist/context/TimeZoneProvider.js +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +17 -0
- package/dist/context/index.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +8 -8
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/theme.d.ts +1 -1
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/timeOption.js.map +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/theme.d.ts +2 -0
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +25 -16
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/component-overrides/alert.js +4 -4
- package/dist/theme/component-overrides/alert.js.map +1 -1
- package/dist/theme/component-overrides/paper.js +1 -1
- package/dist/theme/component-overrides/paper.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/palette/background.d.ts.map +1 -1
- package/dist/theme/palette/background.js +3 -1
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/common.js.map +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/colors/types.d.ts +1 -1
- package/dist/theme/palette/colors/types.d.ts.map +1 -1
- package/dist/theme/palette/colors/types.js.map +1 -1
- package/dist/theme/palette/error.js.map +1 -1
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/theme/palette/index.js.map +1 -1
- package/dist/theme/palette/palette-options.js.map +1 -1
- package/dist/theme/palette/primary.js.map +1 -1
- package/dist/theme/palette/secondary.js.map +1 -1
- package/dist/theme/palette/success.js.map +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.js +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/types/ThemeExtension.d.js.map +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +4 -4
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +4 -4
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +6 -2
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js +51 -7
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.js +1 -1
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/theme-gen.d.ts +3 -8
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +11 -15
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +8 -7
- package/dist/UnitSelector/UnitSelector.d.ts +0 -9
- package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
- package/dist/UnitSelector/UnitSelector.js.map +0 -1
- package/dist/UnitSelector/index.d.ts +0 -2
- package/dist/UnitSelector/index.d.ts.map +0 -1
- package/dist/UnitSelector/index.js.map +0 -1
- package/dist/context/ChartsThemeProvider.d.ts +0 -10
- package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
- package/dist/context/ChartsThemeProvider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Legend/TableLegend.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { Table, TableProps, TableColumnConfig } from '../Table';\nimport { LegendItem } from './legend-model';\n\nexport interface TableLegendProps extends Pick<TableProps<LegendItem>, 'sorting' | 'onSortingChange'> {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: TableProps<LegendItem>['rowSelection'] | 'ALL';\n onSelectedItemsChange: TableProps<LegendItem>['onRowSelectionChange'];\n onItemMouseOver?: TableProps<LegendItem>['onRowMouseOver'];\n onItemMouseOut?: TableProps<LegendItem>['onRowMouseOut'];\n columns?: TableProps<LegendItem>['columns'];\n}\n\nconst COLUMNS: Array<TableColumnConfig<LegendItem>> = [\n {\n accessorKey: 'label',\n header: 'Name',\n enableSorting: true,\n\n // Starting with `title` attr instead of a tooltip because it is easier to\n // implement. We should try adding a tooltip in the future, but we'll need\n // to be very careful about performance when doing so with large tables.\n cell: ({ getValue }) => <span title={getValue()}>{getValue()}</span>,\n },\n];\n\nconst getRowId: NonNullable<TableProps<LegendItem>['getRowId']> = (data) => {\n return data.id;\n};\n\nconst getCheckboxColor: TableProps<LegendItem>['getCheckboxColor'] = (data) => {\n return data.color;\n};\n\nexport function TableLegend({\n items,\n selectedItems: initRowSelection,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n height,\n width,\n columns: additionalColumns = [],\n sorting,\n onSortingChange,\n}: TableLegendProps) {\n const rowSelection = useMemo(() => {\n return typeof initRowSelection !== 'string'\n ? initRowSelection\n : // Turn \"ALL\" state into a table component friendly map of all of the selected\n // items for checkboxes.\n // TODO: clean this up if we switch to also using checkboxes in list legend.\n items.reduce((allRowSelection, item, index) => {\n
|
|
1
|
+
{"version":3,"sources":["../../src/Legend/TableLegend.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { Table, TableProps, TableColumnConfig } from '../Table';\nimport { LegendItem } from './legend-model';\n\nexport interface TableLegendProps extends Pick<TableProps<LegendItem>, 'sorting' | 'onSortingChange'> {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: TableProps<LegendItem>['rowSelection'] | 'ALL';\n onSelectedItemsChange: TableProps<LegendItem>['onRowSelectionChange'];\n onItemMouseOver?: TableProps<LegendItem>['onRowMouseOver'];\n onItemMouseOut?: TableProps<LegendItem>['onRowMouseOut'];\n columns?: TableProps<LegendItem>['columns'];\n}\n\nconst COLUMNS: Array<TableColumnConfig<LegendItem>> = [\n {\n accessorKey: 'label',\n header: 'Name',\n enableSorting: true,\n\n // Starting with `title` attr instead of a tooltip because it is easier to\n // implement. We should try adding a tooltip in the future, but we'll need\n // to be very careful about performance when doing so with large tables.\n cell: ({ getValue }) => <span title={getValue()}>{getValue()}</span>,\n },\n];\n\nconst getRowId: NonNullable<TableProps<LegendItem>['getRowId']> = (data) => {\n return data.id;\n};\n\nconst getCheckboxColor: TableProps<LegendItem>['getCheckboxColor'] = (data) => {\n return data.color;\n};\n\nexport function TableLegend({\n items,\n selectedItems: initRowSelection,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n height,\n width,\n columns: additionalColumns = [],\n sorting,\n onSortingChange,\n}: TableLegendProps) {\n const rowSelection = useMemo(() => {\n return typeof initRowSelection !== 'string'\n ? initRowSelection\n : // Turn \"ALL\" state into a table component friendly map of all of the selected\n // items for checkboxes.\n // TODO: clean this up if we switch to also using checkboxes in list legend.\n items.reduce(\n (allRowSelection, item, index) => {\n allRowSelection[getRowId(item, index)] = true;\n return allRowSelection;\n },\n {} as Record<string, boolean>\n );\n }, [initRowSelection, items]);\n\n const columns = useMemo(() => {\n return [...COLUMNS, ...additionalColumns];\n }, [additionalColumns]);\n\n return (\n <Table\n height={height}\n width={width}\n rowSelection={rowSelection}\n onRowSelectionChange={onSelectedItemsChange}\n onRowMouseOver={onItemMouseOver}\n onRowMouseOut={onItemMouseOut}\n sorting={sorting}\n onSortingChange={onSortingChange}\n data={items}\n columns={columns}\n density=\"compact\"\n getRowId={getRowId}\n getCheckboxColor={getCheckboxColor}\n checkboxSelection\n rowSelectionVariant=\"legend\"\n />\n );\n}\n"],"names":["useMemo","Table","COLUMNS","accessorKey","header","enableSorting","cell","getValue","span","title","getRowId","data","id","getCheckboxColor","color","TableLegend","items","selectedItems","initRowSelection","onSelectedItemsChange","onItemMouseOver","onItemMouseOut","height","width","columns","additionalColumns","sorting","onSortingChange","rowSelection","reduce","allRowSelection","item","index","onRowSelectionChange","onRowMouseOver","onRowMouseOut","density","checkboxSelection","rowSelectionVariant"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,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kBAAkBA;QAClBwB,iBAAiB;QACjBC,qBAAoB;;AAG1B"}
|
package/dist/Legend/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Legend/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 './Legend';\nexport * from './legend-model';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/Legend/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 './Legend';\nexport * from './legend-model';\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;AACzB,cAAc,iBAAiB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
2
|
import { LegendOptionsBase } from '@perses-dev/core';
|
|
3
|
-
export
|
|
3
|
+
export type LegendComponentOptions = LegendOptionsBase;
|
|
4
4
|
export interface LegendItem {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
@@ -19,6 +19,6 @@ export interface LegendItem {
|
|
|
19
19
|
* value. When the associated entry for a legend item is `true`, that item
|
|
20
20
|
* will be treated as selected and visually highlighted.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';
|
|
23
23
|
export declare function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState): boolean;
|
|
24
24
|
//# sourceMappingURL=legend-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend-model.d.ts","sourceRoot":"","sources":["../../src/Legend/legend-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AASrD,
|
|
1
|
+
{"version":3,"file":"legend-model.d.ts","sourceRoot":"","sources":["../../src/Legend/legend-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AASrD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;AAEhF,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,uBAAuB,WAIpG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Legend/legend-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 { MouseEventHandler } from 'react';\nimport { LegendOptionsBase } from '@perses-dev/core';\n\n// This file contains legend-related model code specific to the legend component.\n// See the `core` package for common/shared legend model code and the\n// `plugin-system` package for legend model code specific to panel plugin specs.\n\n// Note: explicitly defining different options for the legend component and\n// legend spec that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport type LegendComponentOptions = LegendOptionsBase;\n\nexport interface LegendItem {\n id: string;\n label: string;\n color: string;\n\n /**\n * Additional data for the legend item. Useful for laying out additional\n * columns when using a table legend.\n */\n data?: Record<string, unknown>;\n\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\n/**\n * State of selected items in the legend.\n * - When \"ALL\", all legend items are selected, but not visually highlighted.\n * - Otherwise, it is a Record that associates legend item ids with a boolean\n * value. When the associated entry for a legend item is `true`, that item\n * will be treated as selected and visually highlighted.\n */\nexport type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';\n\nexport function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState) {\n // In the \"ALL\" case, technically all legend items are selected, but we do\n // not render them differently.\n return selectedItems !== 'ALL' && !!selectedItems[item.id];\n}\n"],"names":["isLegendItemVisuallySelected","item","selectedItems","id"],"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;AAqCjC,OAAO,SAASA,
|
|
1
|
+
{"version":3,"sources":["../../src/Legend/legend-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 { MouseEventHandler } from 'react';\nimport { LegendOptionsBase } from '@perses-dev/core';\n\n// This file contains legend-related model code specific to the legend component.\n// See the `core` package for common/shared legend model code and the\n// `plugin-system` package for legend model code specific to panel plugin specs.\n\n// Note: explicitly defining different options for the legend component and\n// legend spec that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport type LegendComponentOptions = LegendOptionsBase;\n\nexport interface LegendItem {\n id: string;\n label: string;\n color: string;\n\n /**\n * Additional data for the legend item. Useful for laying out additional\n * columns when using a table legend.\n */\n data?: Record<string, unknown>;\n\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\n/**\n * State of selected items in the legend.\n * - When \"ALL\", all legend items are selected, but not visually highlighted.\n * - Otherwise, it is a Record that associates legend item ids with a boolean\n * value. When the associated entry for a legend item is `true`, that item\n * will be treated as selected and visually highlighted.\n */\nexport type SelectedLegendItemState = Record<LegendItem['id'], boolean> | 'ALL';\n\nexport function isLegendItemVisuallySelected(item: LegendItem, selectedItems: SelectedLegendItemState) {\n // In the \"ALL\" case, technically all legend items are selected, but we do\n // not render them differently.\n return selectedItems !== 'ALL' && !!selectedItems[item.id];\n}\n"],"names":["isLegendItemVisuallySelected","item","selectedItems","id"],"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;AAqCjC,OAAO,SAASA,6BAA6BC,IAAgB,EAAEC,aAAsC;IACnG,0EAA0E;IAC1E,+BAA+B;IAC/B,OAAOA,kBAAkB,SAAS,CAAC,CAACA,aAAa,CAACD,KAAKE,EAAE,CAAC;AAC5D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { FormatOptions } from '@perses-dev/core';
|
|
3
3
|
import type { EChartsCoreOption, GridComponentOption, LegendComponentOption, YAXisComponentOption } from 'echarts';
|
|
4
4
|
import { EChartsDataFormat, ChartInstance } from '../model/graph';
|
|
5
5
|
import { TooltipConfig } from '../TimeSeriesTooltip';
|
|
@@ -8,7 +8,7 @@ export interface LineChartProps {
|
|
|
8
8
|
height: number;
|
|
9
9
|
data: EChartsDataFormat;
|
|
10
10
|
yAxis?: YAXisComponentOption;
|
|
11
|
-
|
|
11
|
+
format?: FormatOptions;
|
|
12
12
|
grid?: GridComponentOption;
|
|
13
13
|
legend?: LegendComponentOption;
|
|
14
14
|
tooltipConfig?: TooltipConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../src/LineChart/LineChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,UAAU,EAAkD,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../src/LineChart/LineChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,UAAU,EAAkD,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EAEnB,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAgBjB,OAAO,EAAE,iBAAiB,EAA0B,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAuC,aAAa,EAA0B,MAAM,sBAAsB,CAAC;AAElH,OAAO,EAOL,aAAa,EACd,MAAM,UAAU,CAAC;AAgBlB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,oCAAoC,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,iBAAiB,CAAC;CAC1F;AAED,eAAO,MAAM,SAAS,0GAuPpB,CAAC"}
|
|
@@ -18,10 +18,10 @@ import { LineChart as EChartsLineChart } from 'echarts/charts';
|
|
|
18
18
|
import { GridComponent, DataZoomComponent, MarkAreaComponent, MarkLineComponent, MarkPointComponent, TitleComponent, ToolboxComponent, TooltipComponent, LegendComponent } from 'echarts/components';
|
|
19
19
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
20
20
|
import { EChart } from '../EChart';
|
|
21
|
-
import { useChartsTheme } from '../context/
|
|
21
|
+
import { useChartsTheme } from '../context/ChartsProvider';
|
|
22
22
|
import { LineChartTooltip, DEFAULT_TOOLTIP_CONFIG } from '../TimeSeriesTooltip';
|
|
23
23
|
import { useTimeZone } from '../context/TimeZoneProvider';
|
|
24
|
-
import { clearHighlightedSeries, enableDataZoom, getDateRange, getFormattedDate,
|
|
24
|
+
import { clearHighlightedSeries, enableDataZoom, getDateRange, getFormattedDate, getFormattedAxis, restoreChart } from '../utils';
|
|
25
25
|
use([
|
|
26
26
|
EChartsLineChart,
|
|
27
27
|
GridComponent,
|
|
@@ -35,18 +35,18 @@ use([
|
|
|
35
35
|
LegendComponent,
|
|
36
36
|
CanvasRenderer
|
|
37
37
|
]);
|
|
38
|
-
export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height
|
|
39
|
-
var
|
|
38
|
+
export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height, data, yAxis, format, grid, legend, tooltipConfig = DEFAULT_TOOLTIP_CONFIG, noDataVariant = 'message', syncGroup, onDataZoom, onDoubleClick, __experimentalEChartsOptionsOverride }, ref) {
|
|
39
|
+
var _option_tooltip;
|
|
40
40
|
const chartsTheme = useChartsTheme();
|
|
41
41
|
const chartRef = useRef();
|
|
42
42
|
const [showTooltip, setShowTooltip] = useState(true);
|
|
43
43
|
const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState(null);
|
|
44
|
-
const { timeZone
|
|
44
|
+
const { timeZone } = useTimeZone();
|
|
45
45
|
const [isDragging, setIsDragging] = useState(false);
|
|
46
46
|
const [startX, setStartX] = useState(0);
|
|
47
47
|
useImperativeHandle(ref, ()=>{
|
|
48
48
|
return {
|
|
49
|
-
highlightSeries ({ id
|
|
49
|
+
highlightSeries ({ id }) {
|
|
50
50
|
if (!chartRef.current) {
|
|
51
51
|
// when chart undef, do not highlight series when hovering over legend
|
|
52
52
|
return;
|
|
@@ -61,12 +61,10 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
61
61
|
// when chart undef, do not clear highlight series
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
clearHighlightedSeries(chartRef.current
|
|
64
|
+
clearHighlightedSeries(chartRef.current);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
}, [
|
|
68
|
-
data.timeSeries.length
|
|
69
|
-
]);
|
|
67
|
+
}, []);
|
|
70
68
|
const handleEvents = useMemo(()=>{
|
|
71
69
|
return {
|
|
72
70
|
datazoom: (params)=>{
|
|
@@ -77,10 +75,10 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
77
75
|
}, 10);
|
|
78
76
|
}
|
|
79
77
|
if (onDataZoom === undefined || params.batch[0] === undefined) return;
|
|
80
|
-
var
|
|
81
|
-
const startIndex = (
|
|
82
|
-
var
|
|
83
|
-
const endIndex = (
|
|
78
|
+
var _params_batch__startValue;
|
|
79
|
+
const startIndex = (_params_batch__startValue = params.batch[0].startValue) !== null && _params_batch__startValue !== void 0 ? _params_batch__startValue : 0;
|
|
80
|
+
var _params_batch__endValue;
|
|
81
|
+
const endIndex = (_params_batch__endValue = params.batch[0].endValue) !== null && _params_batch__endValue !== void 0 ? _params_batch__endValue : data.xAxis.length - 1;
|
|
84
82
|
const xAxisStartValue = data.xAxis[startIndex];
|
|
85
83
|
const xAxisEndValue = data.xAxis[endIndex];
|
|
86
84
|
if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {
|
|
@@ -102,14 +100,14 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
102
100
|
if (chartRef.current !== undefined) {
|
|
103
101
|
enableDataZoom(chartRef.current);
|
|
104
102
|
}
|
|
105
|
-
const { noDataOption
|
|
103
|
+
const { noDataOption } = chartsTheme;
|
|
106
104
|
const option = useMemo(()=>{
|
|
107
105
|
if (data.timeSeries === undefined) return {};
|
|
108
106
|
// The "chart" `noDataVariant` is only used when the `timeSeries` is an
|
|
109
107
|
// empty array because a `null` value will throw an error.
|
|
110
108
|
if (data.timeSeries === null || data.timeSeries.length === 0 && noDataVariant === 'message') return noDataOption;
|
|
111
|
-
var
|
|
112
|
-
const rangeMs = (
|
|
109
|
+
var _data_rangeMs;
|
|
110
|
+
const rangeMs = (_data_rangeMs = data.rangeMs) !== null && _data_rangeMs !== void 0 ? _data_rangeMs : getDateRange(data.xAxis);
|
|
113
111
|
const option = {
|
|
114
112
|
series: data.timeSeries,
|
|
115
113
|
xAxis: {
|
|
@@ -122,7 +120,7 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
},
|
|
125
|
-
yAxis:
|
|
123
|
+
yAxis: getFormattedAxis(yAxis, format),
|
|
126
124
|
animation: false,
|
|
127
125
|
tooltip: {
|
|
128
126
|
show: true,
|
|
@@ -155,7 +153,7 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
155
153
|
}, [
|
|
156
154
|
data,
|
|
157
155
|
yAxis,
|
|
158
|
-
|
|
156
|
+
format,
|
|
159
157
|
grid,
|
|
160
158
|
legend,
|
|
161
159
|
noDataOption,
|
|
@@ -194,7 +192,7 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
194
192
|
}
|
|
195
193
|
},
|
|
196
194
|
onMouseDown: (e)=>{
|
|
197
|
-
const { clientX
|
|
195
|
+
const { clientX } = e;
|
|
198
196
|
setIsDragging(true);
|
|
199
197
|
setStartX(clientX);
|
|
200
198
|
},
|
|
@@ -203,7 +201,7 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
203
201
|
if (!(e.target instanceof HTMLCanvasElement)) {
|
|
204
202
|
return;
|
|
205
203
|
}
|
|
206
|
-
const { clientX
|
|
204
|
+
const { clientX } = e;
|
|
207
205
|
if (isDragging) {
|
|
208
206
|
const deltaX = clientX - startX;
|
|
209
207
|
if (deltaX > 0) {
|
|
@@ -222,7 +220,7 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
222
220
|
setShowTooltip(false);
|
|
223
221
|
}
|
|
224
222
|
if (chartRef.current !== undefined) {
|
|
225
|
-
clearHighlightedSeries(chartRef.current
|
|
223
|
+
clearHighlightedSeries(chartRef.current);
|
|
226
224
|
}
|
|
227
225
|
},
|
|
228
226
|
onMouseEnter: ()=>{
|
|
@@ -243,13 +241,13 @@ export const LineChart = /*#__PURE__*/ forwardRef(function LineChart({ height ,
|
|
|
243
241
|
}
|
|
244
242
|
},
|
|
245
243
|
children: [
|
|
246
|
-
showTooltip === true && ((
|
|
244
|
+
showTooltip === true && ((_option_tooltip = option.tooltip) === null || _option_tooltip === void 0 ? void 0 : _option_tooltip.showContent) === false && tooltipConfig.hidden !== true && /*#__PURE__*/ _jsx(LineChartTooltip, {
|
|
247
245
|
chartRef: chartRef,
|
|
248
246
|
chartData: data,
|
|
249
247
|
wrapLabels: tooltipConfig.wrapLabels,
|
|
250
248
|
enablePinning: tooltipConfig.enablePinning,
|
|
251
249
|
pinnedPos: tooltipPinnedCoords,
|
|
252
|
-
|
|
250
|
+
format: format,
|
|
253
251
|
onUnpinClick: ()=>{
|
|
254
252
|
setTooltipPinnedCoords(null);
|
|
255
253
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/LineChart/LineChart.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 { forwardRef, MouseEvent, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { UnitOptions } from '@perses-dev/core';\nimport { Box } from '@mui/material';\nimport type {\n EChartsCoreOption,\n GridComponentOption,\n LineSeriesOption,\n LegendComponentOption,\n YAXisComponentOption,\n TooltipComponentOption,\n} from 'echarts';\nimport { ECharts as EChartsInstance, use } from 'echarts/core';\nimport { LineChart as EChartsLineChart } from 'echarts/charts';\nimport {\n GridComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n LegendComponent,\n} from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { EChart, OnEventsType } from '../EChart';\nimport { EChartsDataFormat, ChartInstanceFocusOpts, ChartInstance } from '../model/graph';\nimport { useChartsTheme } from '../context/ChartsThemeProvider';\nimport { CursorCoordinates, LineChartTooltip, TooltipConfig, DEFAULT_TOOLTIP_CONFIG } from '../TimeSeriesTooltip';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport {\n clearHighlightedSeries,\n enableDataZoom,\n getDateRange,\n getFormattedDate,\n getYAxes,\n restoreChart,\n ZoomEventData,\n} from '../utils';\n\nuse([\n EChartsLineChart,\n GridComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n LegendComponent,\n CanvasRenderer,\n]);\n\nexport interface LineChartProps {\n height: number;\n data: EChartsDataFormat;\n yAxis?: YAXisComponentOption;\n unit?: UnitOptions;\n grid?: GridComponentOption;\n legend?: LegendComponentOption;\n tooltipConfig?: TooltipConfig;\n noDataVariant?: 'chart' | 'message';\n syncGroup?: string;\n onDataZoom?: (e: ZoomEventData) => void;\n onDoubleClick?: (e: MouseEvent) => void;\n __experimentalEChartsOptionsOverride?: (options: EChartsCoreOption) => EChartsCoreOption;\n}\n\nexport const LineChart = forwardRef<ChartInstance, LineChartProps>(function LineChart(\n {\n height,\n data,\n yAxis,\n unit,\n grid,\n legend,\n tooltipConfig = DEFAULT_TOOLTIP_CONFIG,\n noDataVariant = 'message',\n syncGroup,\n onDataZoom,\n onDoubleClick,\n __experimentalEChartsOptionsOverride,\n },\n ref\n) {\n const chartsTheme = useChartsTheme();\n const chartRef = useRef<EChartsInstance>();\n const [showTooltip, setShowTooltip] = useState<boolean>(true);\n const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n const { timeZone } = useTimeZone();\n\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n\n useImperativeHandle(\n ref,\n () => {\n return {\n highlightSeries({ id }: ChartInstanceFocusOpts) {\n if (!chartRef.current) {\n // when chart undef, do not highlight series when hovering over legend\n return;\n }\n\n chartRef.current.dispatchAction({ type: 'highlight', seriesId: id });\n },\n clearHighlightedSeries: () => {\n if (!chartRef.current) {\n // when chart undef, do not clear highlight series\n return;\n }\n clearHighlightedSeries(chartRef.current, data.timeSeries.length);\n },\n };\n },\n [data.timeSeries.length]\n );\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params) => {\n if (onDataZoom === undefined) {\n setTimeout(() => {\n // workaround so unpin happens after click event\n setTooltipPinnedCoords(null);\n }, 10);\n }\n if (onDataZoom === undefined || params.batch[0] === undefined) return;\n const startIndex = params.batch[0].startValue ?? 0;\n const endIndex = params.batch[0].endValue ?? data.xAxis.length - 1;\n const xAxisStartValue = data.xAxis[startIndex];\n const xAxisEndValue = data.xAxis[endIndex];\n\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n startIndex,\n endIndex,\n };\n onDataZoom(zoomEvent);\n }\n },\n };\n }, [data, onDataZoom, setTooltipPinnedCoords]);\n\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n\n const { noDataOption } = chartsTheme;\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.timeSeries === undefined) return {};\n\n // The \"chart\" `noDataVariant` is only used when the `timeSeries` is an\n // empty array because a `null` value will throw an error.\n if (data.timeSeries === null || (data.timeSeries.length === 0 && noDataVariant === 'message')) return noDataOption;\n\n const rangeMs = data.rangeMs ?? getDateRange(data.xAxis);\n\n const option: EChartsCoreOption = {\n series: data.timeSeries,\n xAxis: {\n type: 'category',\n data: data.xAxis,\n max: data.xAxisMax,\n axisLabel: {\n formatter: (value: number) => {\n return getFormattedDate(value, rangeMs, timeZone);\n },\n },\n },\n yAxis: getYAxes(yAxis, unit),\n animation: false,\n tooltip: {\n show: true,\n trigger: 'axis',\n showContent: false, // echarts tooltip content hidden since we use custom tooltip instead\n },\n // https://echarts.apache.org/en/option.html#axisPointer\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: false, // https://github.com/apache/echarts/issues/18495\n triggerTooltip: false,\n snap: true,\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null, // https://stackoverflow.com/a/67684076/17575201\n yAxisIndex: 'none',\n },\n },\n },\n grid,\n legend,\n };\n\n if (__experimentalEChartsOptionsOverride) {\n return __experimentalEChartsOptionsOverride(option);\n }\n return option;\n }, [data, yAxis, unit, grid, legend, noDataOption, timeZone, __experimentalEChartsOptionsOverride, noDataVariant]);\n\n return (\n <Box\n sx={{ height }}\n onClick={(e) => {\n // Pin and unpin when clicking on chart canvas but not tooltip text.\n if (tooltipConfig.enablePinning && e.target instanceof HTMLCanvasElement) {\n setTooltipPinnedCoords((current) => {\n if (current === null) {\n return {\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 x: e.nativeEvent.offsetX,\n y: e.nativeEvent.offsetY,\n },\n target: e.target,\n };\n } else {\n return null;\n }\n });\n }\n }}\n onMouseDown={(e) => {\n const { clientX } = e;\n setIsDragging(true);\n setStartX(clientX);\n }}\n onMouseMove={(e) => {\n // Allow clicking inside tooltip to copy labels.\n if (!(e.target instanceof HTMLCanvasElement)) {\n return;\n }\n const { clientX } = e;\n if (isDragging) {\n const deltaX = clientX - startX;\n if (deltaX > 0) {\n // Hide tooltip when user drags to zoom.\n setShowTooltip(false);\n }\n }\n }}\n onMouseUp={() => {\n setIsDragging(false);\n setStartX(0);\n setShowTooltip(true);\n }}\n onMouseLeave={() => {\n if (tooltipPinnedCoords === null) {\n setShowTooltip(false);\n }\n if (chartRef.current !== undefined) {\n clearHighlightedSeries(chartRef.current, data.timeSeries.length);\n }\n }}\n onMouseEnter={() => {\n setShowTooltip(true);\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n onDoubleClick={(e) => {\n setTooltipPinnedCoords(null);\n // either dispatch ECharts restore action to return to orig state or allow consumer to define behavior\n if (onDoubleClick === undefined) {\n if (chartRef.current !== undefined) {\n restoreChart(chartRef.current);\n }\n } else {\n onDoubleClick(e);\n }\n }}\n >\n {/* Allows overrides prop to hide custom tooltip and use the ECharts option.tooltip instead */}\n {showTooltip === true &&\n (option.tooltip as TooltipComponentOption)?.showContent === false &&\n tooltipConfig.hidden !== true && (\n <LineChartTooltip\n chartRef={chartRef}\n chartData={data}\n wrapLabels={tooltipConfig.wrapLabels}\n enablePinning={tooltipConfig.enablePinning}\n pinnedPos={tooltipPinnedCoords}\n unit={unit}\n onUnpinClick={() => {\n setTooltipPinnedCoords(null);\n }}\n containerId={chartsTheme.tooltipPortalContainerId}\n />\n )}\n <EChart\n sx={{\n width: '100%',\n height: '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n syncGroup={syncGroup}\n />\n </Box>\n );\n});\n"],"names":["forwardRef","useImperativeHandle","useMemo","useRef","useState","Box","use","LineChart","EChartsLineChart","GridComponent","DataZoomComponent","MarkAreaComponent","MarkLineComponent","MarkPointComponent","TitleComponent","ToolboxComponent","TooltipComponent","LegendComponent","CanvasRenderer","EChart","useChartsTheme","LineChartTooltip","DEFAULT_TOOLTIP_CONFIG","useTimeZone","clearHighlightedSeries","enableDataZoom","getDateRange","getFormattedDate","getYAxes","restoreChart","height","data","yAxis","unit","grid","legend","tooltipConfig","noDataVariant","syncGroup","onDataZoom","onDoubleClick","__experimentalEChartsOptionsOverride","ref","option","chartsTheme","chartRef","showTooltip","setShowTooltip","tooltipPinnedCoords","setTooltipPinnedCoords","timeZone","isDragging","setIsDragging","startX","setStartX","highlightSeries","id","current","dispatchAction","type","seriesId","timeSeries","length","handleEvents","datazoom","params","undefined","setTimeout","batch","startIndex","startValue","endIndex","endValue","xAxis","xAxisStartValue","xAxisEndValue","zoomEvent","start","end","noDataOption","rangeMs","series","max","xAxisMax","axisLabel","formatter","value","animation","tooltip","show","trigger","showContent","axisPointer","z","triggerEmphasis","triggerTooltip","snap","toolbox","feature","dataZoom","icon","yAxisIndex","sx","onClick","e","enablePinning","target","HTMLCanvasElement","page","x","pageX","y","pageY","client","clientX","clientY","plotCanvas","nativeEvent","offsetX","offsetY","onMouseDown","onMouseMove","deltaX","onMouseUp","onMouseLeave","onMouseEnter","hidden","chartData","wrapLabels","pinnedPos","onUnpinClick","containerId","tooltipPortalContainerId","width","theme","echartsTheme","onEvents","_instance"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,UAAU,EAAcC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAE/F,SAASC,GAAG,QAAQ,eAAe,CAAC;AASpC,SAAqCC,GAAG,QAAQ,cAAc,CAAC;AAC/D,SAASC,SAAS,IAAIC,gBAAgB,QAAQ,gBAAgB,CAAC;AAC/D,SACEC,aAAa,EACbC,iBAAiB,EACjBC,iBAA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,YAAY,CAACgB,QAAQ,CAACY,OAAO,CAAC,CAAC;gBACjC,CAAC;YACH,OAAO;gBACLjB,aAAa,CAACgE,CAAC,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;;YAGA1D,WAAW,KAAK,IAAI,IACnB,CAAA,CAACH,IAAc,GAAdA,MAAM,CAAC6C,OAAO,cAAd7C,IAAc,WAAwC,GAAvD,KAAA,CAAuD,GAAtDA,IAAc,CAA6BgD,WAAW,CAAA,KAAK,KAAK,IACjEvD,aAAa,CAAC0F,MAAM,KAAK,IAAI,kBAC3B,KAACzG,gBAAgB;gBACfwB,QAAQ,EAAEA,QAAQ;gBAClBkF,SAAS,EAAEhG,IAAI;gBACfiG,UAAU,EAAE5F,aAAa,CAAC4F,UAAU;gBACpCvB,aAAa,EAAErE,aAAa,CAACqE,aAAa;gBAC1CwB,SAAS,EAAEjF,mBAAmB;gBAC9Bf,IAAI,EAAEA,IAAI;gBACViG,YAAY,EAAE,IAAM;oBAClBjF,sBAAsB,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;gBACDkF,WAAW,EAAEvF,WAAW,CAACwF,wBAAwB;cACjD,AACH;0BACH,KAACjH,MAAM;gBACLmF,EAAE,EAAE;oBACF+B,KAAK,EAAE,MAAM;oBACbvG,MAAM,EAAE,MAAM;iBACf;gBACDa,MAAM,EAAEA,MAAM;gBACd2F,KAAK,EAAE1F,WAAW,CAAC2F,YAAY;gBAC/BC,QAAQ,EAAEzE,YAAY;gBACtB0E,SAAS,EAAE5F,QAAQ;gBACnBP,SAAS,EAAEA,SAAS;cACpB;;MACE,CACN;AACJ,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/LineChart/LineChart.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 { forwardRef, MouseEvent, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { FormatOptions } from '@perses-dev/core';\nimport { Box } from '@mui/material';\nimport type {\n EChartsCoreOption,\n GridComponentOption,\n LineSeriesOption,\n LegendComponentOption,\n YAXisComponentOption,\n TooltipComponentOption,\n} from 'echarts';\nimport { ECharts as EChartsInstance, use } from 'echarts/core';\nimport { LineChart as EChartsLineChart } from 'echarts/charts';\nimport {\n GridComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n LegendComponent,\n} from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { EChart, OnEventsType } from '../EChart';\nimport { EChartsDataFormat, ChartInstanceFocusOpts, ChartInstance } from '../model/graph';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { CursorCoordinates, LineChartTooltip, TooltipConfig, DEFAULT_TOOLTIP_CONFIG } from '../TimeSeriesTooltip';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport {\n clearHighlightedSeries,\n enableDataZoom,\n getDateRange,\n getFormattedDate,\n getFormattedAxis,\n restoreChart,\n ZoomEventData,\n} from '../utils';\n\nuse([\n EChartsLineChart,\n GridComponent,\n DataZoomComponent,\n MarkAreaComponent,\n MarkLineComponent,\n MarkPointComponent,\n TitleComponent,\n ToolboxComponent,\n TooltipComponent,\n LegendComponent,\n CanvasRenderer,\n]);\n\nexport interface LineChartProps {\n height: number;\n data: EChartsDataFormat;\n yAxis?: YAXisComponentOption;\n format?: FormatOptions;\n grid?: GridComponentOption;\n legend?: LegendComponentOption;\n tooltipConfig?: TooltipConfig;\n noDataVariant?: 'chart' | 'message';\n syncGroup?: string;\n onDataZoom?: (e: ZoomEventData) => void;\n onDoubleClick?: (e: MouseEvent) => void;\n __experimentalEChartsOptionsOverride?: (options: EChartsCoreOption) => EChartsCoreOption;\n}\n\nexport const LineChart = forwardRef<ChartInstance, LineChartProps>(function LineChart(\n {\n height,\n data,\n yAxis,\n format,\n grid,\n legend,\n tooltipConfig = DEFAULT_TOOLTIP_CONFIG,\n noDataVariant = 'message',\n syncGroup,\n onDataZoom,\n onDoubleClick,\n __experimentalEChartsOptionsOverride,\n },\n ref\n) {\n const chartsTheme = useChartsTheme();\n const chartRef = useRef<EChartsInstance>();\n const [showTooltip, setShowTooltip] = useState<boolean>(true);\n const [tooltipPinnedCoords, setTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n const { timeZone } = useTimeZone();\n\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n\n useImperativeHandle(\n ref,\n () => {\n return {\n highlightSeries({ id }: ChartInstanceFocusOpts) {\n if (!chartRef.current) {\n // when chart undef, do not highlight series when hovering over legend\n return;\n }\n\n chartRef.current.dispatchAction({ type: 'highlight', seriesId: id });\n },\n clearHighlightedSeries: () => {\n if (!chartRef.current) {\n // when chart undef, do not clear highlight series\n return;\n }\n clearHighlightedSeries(chartRef.current);\n },\n };\n },\n []\n );\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params) => {\n if (onDataZoom === undefined) {\n setTimeout(() => {\n // workaround so unpin happens after click event\n setTooltipPinnedCoords(null);\n }, 10);\n }\n if (onDataZoom === undefined || params.batch[0] === undefined) return;\n const startIndex = params.batch[0].startValue ?? 0;\n const endIndex = params.batch[0].endValue ?? data.xAxis.length - 1;\n const xAxisStartValue = data.xAxis[startIndex];\n const xAxisEndValue = data.xAxis[endIndex];\n\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n startIndex,\n endIndex,\n };\n onDataZoom(zoomEvent);\n }\n },\n };\n }, [data, onDataZoom, setTooltipPinnedCoords]);\n\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n\n const { noDataOption } = chartsTheme;\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.timeSeries === undefined) return {};\n\n // The \"chart\" `noDataVariant` is only used when the `timeSeries` is an\n // empty array because a `null` value will throw an error.\n if (data.timeSeries === null || (data.timeSeries.length === 0 && noDataVariant === 'message')) return noDataOption;\n\n const rangeMs = data.rangeMs ?? getDateRange(data.xAxis);\n\n const option: EChartsCoreOption = {\n series: data.timeSeries,\n xAxis: {\n type: 'category',\n data: data.xAxis,\n max: data.xAxisMax,\n axisLabel: {\n formatter: (value: number) => {\n return getFormattedDate(value, rangeMs, timeZone);\n },\n },\n },\n yAxis: getFormattedAxis(yAxis, format),\n animation: false,\n tooltip: {\n show: true,\n trigger: 'axis',\n showContent: false, // echarts tooltip content hidden since we use custom tooltip instead\n },\n // https://echarts.apache.org/en/option.html#axisPointer\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: false, // https://github.com/apache/echarts/issues/18495\n triggerTooltip: false,\n snap: true,\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null, // https://stackoverflow.com/a/67684076/17575201\n yAxisIndex: 'none',\n },\n },\n },\n grid,\n legend,\n };\n\n if (__experimentalEChartsOptionsOverride) {\n return __experimentalEChartsOptionsOverride(option);\n }\n return option;\n }, [data, yAxis, format, grid, legend, noDataOption, timeZone, __experimentalEChartsOptionsOverride, noDataVariant]);\n\n return (\n <Box\n sx={{ height }}\n onClick={(e) => {\n // Pin and unpin when clicking on chart canvas but not tooltip text.\n if (tooltipConfig.enablePinning && e.target instanceof HTMLCanvasElement) {\n setTooltipPinnedCoords((current) => {\n if (current === null) {\n return {\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 x: e.nativeEvent.offsetX,\n y: e.nativeEvent.offsetY,\n },\n target: e.target,\n };\n } else {\n return null;\n }\n });\n }\n }}\n onMouseDown={(e) => {\n const { clientX } = e;\n setIsDragging(true);\n setStartX(clientX);\n }}\n onMouseMove={(e) => {\n // Allow clicking inside tooltip to copy labels.\n if (!(e.target instanceof HTMLCanvasElement)) {\n return;\n }\n const { clientX } = e;\n if (isDragging) {\n const deltaX = clientX - startX;\n if (deltaX > 0) {\n // Hide tooltip when user drags to zoom.\n setShowTooltip(false);\n }\n }\n }}\n onMouseUp={() => {\n setIsDragging(false);\n setStartX(0);\n setShowTooltip(true);\n }}\n onMouseLeave={() => {\n if (tooltipPinnedCoords === null) {\n setShowTooltip(false);\n }\n if (chartRef.current !== undefined) {\n clearHighlightedSeries(chartRef.current);\n }\n }}\n onMouseEnter={() => {\n setShowTooltip(true);\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n onDoubleClick={(e) => {\n setTooltipPinnedCoords(null);\n // either dispatch ECharts restore action to return to orig state or allow consumer to define behavior\n if (onDoubleClick === undefined) {\n if (chartRef.current !== undefined) {\n restoreChart(chartRef.current);\n }\n } else {\n onDoubleClick(e);\n }\n }}\n >\n {/* Allows overrides prop to hide custom tooltip and use the ECharts option.tooltip instead */}\n {showTooltip === true &&\n (option.tooltip as TooltipComponentOption)?.showContent === false &&\n tooltipConfig.hidden !== true && (\n <LineChartTooltip\n chartRef={chartRef}\n chartData={data}\n wrapLabels={tooltipConfig.wrapLabels}\n enablePinning={tooltipConfig.enablePinning}\n pinnedPos={tooltipPinnedCoords}\n format={format}\n onUnpinClick={() => {\n setTooltipPinnedCoords(null);\n }}\n containerId={chartsTheme.tooltipPortalContainerId}\n />\n )}\n <EChart\n sx={{\n width: '100%',\n height: '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n syncGroup={syncGroup}\n />\n </Box>\n );\n});\n"],"names":["forwardRef","useImperativeHandle","useMemo","useRef","useState","Box","use","LineChart","EChartsLineChart","GridComponent","DataZoomComponent","MarkAreaComponent","MarkLineComponent","MarkPointComponent","TitleComponent","ToolboxComponent","TooltipComponent","LegendComponent","CanvasRenderer","EChart","useChartsTheme","LineChartTooltip","DEFAULT_TOOLTIP_CONFIG","useTimeZone","clearHighlightedSeries","enableDataZoom","getDateRange","getFormattedDate","getFormattedAxis","restoreChart","height","data","yAxis","format","grid","legend","tooltipConfig","noDataVariant","syncGroup","onDataZoom","onDoubleClick","__experimentalEChartsOptionsOverride","ref","option","chartsTheme","chartRef","showTooltip","setShowTooltip","tooltipPinnedCoords","setTooltipPinnedCoords","timeZone","isDragging","setIsDragging","startX","setStartX","highlightSeries","id","current","dispatchAction","type","seriesId","handleEvents","datazoom","params","undefined","setTimeout","batch","startIndex","startValue","endIndex","endValue","xAxis","length","xAxisStartValue","xAxisEndValue","zoomEvent","start","end","noDataOption","timeSeries","rangeMs","series","max","xAxisMax","axisLabel","formatter","value","animation","tooltip","show","trigger","showContent","axisPointer","z","triggerEmphasis","triggerTooltip","snap","toolbox","feature","dataZoom","icon","yAxisIndex","sx","onClick","e","enablePinning","target","HTMLCanvasElement","page","x","pageX","y","pageY","client","clientX","clientY","plotCanvas","nativeEvent","offsetX","offsetY","onMouseDown","onMouseMove","deltaX","onMouseUp","onMouseLeave","onMouseEnter","hidden","chartData","wrapLabels","pinnedPos","onUnpinClick","containerId","tooltipPortalContainerId","width","theme","echartsTheme","onEvents","_instance"],"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,UAAU,EAAcC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE/F,SAASC,GAAG,QAAQ,gBAAgB;AASpC,SAAqCC,GAAG,QAAQ,eAAe;AAC/D,SAASC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,sBACvB,KAACzG;gBACCwB,UAAUA;gBACVkF,WAAWhG;gBACXiG,YAAY5F,cAAc4F,UAAU;gBACpCvB,eAAerE,cAAcqE,aAAa;gBAC1CwB,WAAWjF;gBACXf,QAAQA;gBACRiG,cAAc;oBACZjF,uBAAuB;gBACzB;gBACAkF,aAAavF,YAAYwF,wBAAwB;;0BAGvD,KAACjH;gBACCmF,IAAI;oBACF+B,OAAO;oBACPvG,QAAQ;gBACV;gBACAa,QAAQA;gBACR2F,OAAO1F,YAAY2F,YAAY;gBAC/BC,UAAU3E;gBACV4E,WAAW5F;gBACXP,WAAWA;;;;AAInB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/LineChart/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 './LineChart';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/LineChart/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 './LineChart';\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"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type ModeOption = 'value' | 'percentage';
|
|
1
|
+
export type ModeOption = 'value' | 'percentage';
|
|
3
2
|
export interface ModeSelectorProps {
|
|
4
3
|
disablePercentageMode: boolean;
|
|
5
4
|
onChange: (mode: ModeOption) => void;
|
|
6
5
|
value?: ModeOption;
|
|
7
6
|
}
|
|
8
|
-
export declare function ModeSelector({ disablePercentageMode, onChange, value }: ModeSelectorProps): JSX.Element;
|
|
7
|
+
export declare function ModeSelector({ disablePercentageMode, onChange, value }: ModeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
//# sourceMappingURL=ModeSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModeSelector.d.ts","sourceRoot":"","sources":["../../src/ModeSelector/ModeSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModeSelector.d.ts","sourceRoot":"","sources":["../../src/ModeSelector/ModeSelector.tsx"],"names":[],"mappings":"AAqBA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,qBAAqB,EAAE,QAAQ,EAAE,KAAe,EAAE,EAAE,iBAAiB,2CAoBnG"}
|
|
@@ -23,8 +23,8 @@ const MODE_OPTIONS = [
|
|
|
23
23
|
label: 'Percentage'
|
|
24
24
|
}
|
|
25
25
|
];
|
|
26
|
-
export function ModeSelector({ disablePercentageMode
|
|
27
|
-
const handleModeChange = (_, { id
|
|
26
|
+
export function ModeSelector({ disablePercentageMode, onChange, value = 'value' }) {
|
|
27
|
+
const handleModeChange = (_, { id })=>{
|
|
28
28
|
onChange(id);
|
|
29
29
|
};
|
|
30
30
|
return /*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ModeSelector/ModeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst MODE_OPTIONS: Array<{ id: ModeOption; label: string }> = [\n { id: 'value', label: 'Value' },\n { id: 'percentage', label: 'Percentage' },\n];\n\nexport type ModeOption = 'value' | 'percentage';\n\nexport interface ModeSelectorProps {\n disablePercentageMode: boolean;\n onChange: (mode: ModeOption) => void;\n value?: ModeOption;\n}\n\nexport function ModeSelector({ disablePercentageMode, onChange, value = 'value' }: ModeSelectorProps) {\n const handleModeChange = (_: unknown, { id }: { id: ModeOption }) => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <SettingsAutocomplete\n value={MODE_OPTIONS.find((o) => o.id === value)}\n options={MODE_OPTIONS}\n getOptionLabel={(o) => o.label}\n getOptionDisabled={(o) => o.id === 'percentage' && disablePercentageMode}\n onChange={handleModeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","MODE_OPTIONS","id","label","ModeSelector","disablePercentageMode","onChange","value","handleModeChange","_","control","find","o","options","getOptionLabel","getOptionDisabled","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../src/ModeSelector/ModeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst MODE_OPTIONS: Array<{ id: ModeOption; label: string }> = [\n { id: 'value', label: 'Value' },\n { id: 'percentage', label: 'Percentage' },\n];\n\nexport type ModeOption = 'value' | 'percentage';\n\nexport interface ModeSelectorProps {\n disablePercentageMode: boolean;\n onChange: (mode: ModeOption) => void;\n value?: ModeOption;\n}\n\nexport function ModeSelector({ disablePercentageMode, onChange, value = 'value' }: ModeSelectorProps) {\n const handleModeChange = (_: unknown, { id }: { id: ModeOption }) => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <SettingsAutocomplete\n value={MODE_OPTIONS.find((o) => o.id === value)}\n options={MODE_OPTIONS}\n getOptionLabel={(o) => o.label}\n getOptionDisabled={(o) => o.id === 'percentage' && disablePercentageMode}\n onChange={handleModeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","MODE_OPTIONS","id","label","ModeSelector","disablePercentageMode","onChange","value","handleModeChange","_","control","find","o","options","getOptionLabel","getOptionDisabled","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,MAAMC,eAAyD;IAC7D;QAAEC,IAAI;QAASC,OAAO;IAAQ;IAC9B;QAAED,IAAI;QAAcC,OAAO;IAAa;CACzC;AAUD,OAAO,SAASC,aAAa,EAAEC,qBAAqB,EAAEC,QAAQ,EAAEC,QAAQ,OAAO,EAAqB;IAClG,MAAMC,mBAAmB,CAACC,GAAY,EAAEP,EAAE,EAAsB;QAC9DI,SAASJ;IACX;IAEA,qBACE,KAACH;QACCI,OAAM;QACNO,uBACE,KAACV;YACCO,OAAON,aAAaU,IAAI,CAAC,CAACC,IAAMA,EAAEV,EAAE,KAAKK;YACzCM,SAASZ;YACTa,gBAAgB,CAACF,IAAMA,EAAET,KAAK;YAC9BY,mBAAmB,CAACH,IAAMA,EAAEV,EAAE,KAAK,gBAAgBG;YACnDC,UAAUE;YACVQ,gBAAgB;;;AAK1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ModeSelector/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 './ModeSelector';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/ModeSelector/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 './ModeSelector';\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,iBAAiB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type OptionsEditorColumnProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Components to render in the column. These will usually be
|
|
5
5
|
* `OptionsEditorGroup` components.
|
|
@@ -9,5 +9,5 @@ export declare type OptionsEditorColumnProps = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Lay out content in a column within panel options.
|
|
11
11
|
*/
|
|
12
|
-
export declare const OptionsEditorColumn: ({ children }: OptionsEditorColumnProps) => JSX.Element;
|
|
12
|
+
export declare const OptionsEditorColumn: ({ children }: OptionsEditorColumnProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
//# sourceMappingURL=OptionsEditorColumn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsEditorColumn.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorColumn.tsx"],"names":[],"mappings":";AAeA,
|
|
1
|
+
{"version":3,"file":"OptionsEditorColumn.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorColumn.tsx"],"names":[],"mappings":";AAeA,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,iBAAkB,wBAAwB,4CAMzE,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { Grid, Stack } from '@mui/material';
|
|
15
15
|
/**
|
|
16
16
|
* Lay out content in a column within panel options.
|
|
17
|
-
*/ export const OptionsEditorColumn = ({ children
|
|
17
|
+
*/ export const OptionsEditorColumn = ({ children })=>{
|
|
18
18
|
return /*#__PURE__*/ _jsx(Grid, {
|
|
19
19
|
item: true,
|
|
20
20
|
xs: 4,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorColumn.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 { Grid, Stack } from '@mui/material';\n\nexport type OptionsEditorColumnProps = {\n /**\n * Components to render in the column. These will usually be\n * `OptionsEditorGroup` components.\n */\n children: React.ReactNode;\n};\n\n/**\n * Lay out content in a column within panel options.\n */\nexport const OptionsEditorColumn = ({ children }: OptionsEditorColumnProps) => {\n return (\n <Grid item xs={4}>\n <Stack spacing={3}>{children}</Stack>\n </Grid>\n );\n};\n"],"names":["Grid","Stack","OptionsEditorColumn","children","item","xs","spacing"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorColumn.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 { Grid, Stack } from '@mui/material';\n\nexport type OptionsEditorColumnProps = {\n /**\n * Components to render in the column. These will usually be\n * `OptionsEditorGroup` components.\n */\n children: React.ReactNode;\n};\n\n/**\n * Lay out content in a column within panel options.\n */\nexport const OptionsEditorColumn = ({ children }: OptionsEditorColumnProps) => {\n return (\n <Grid item xs={4}>\n <Stack spacing={3}>{children}</Stack>\n </Grid>\n );\n};\n"],"names":["Grid","Stack","OptionsEditorColumn","children","item","xs","spacing"],"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,EAAEC,KAAK,QAAQ,gBAAgB;AAU5C;;CAEC,GACD,OAAO,MAAMC,sBAAsB,CAAC,EAAEC,QAAQ,EAA4B;IACxE,qBACE,KAACH;QAAKI,IAAI;QAACC,IAAI;kBACb,cAAA,KAACJ;YAAMK,SAAS;sBAAIH;;;AAG1B,EAAE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormControlLabelProps } from '@mui/material';
|
|
3
|
-
export
|
|
2
|
+
export type OptionsEditorControlProps = Pick<FormControlLabelProps, 'label' | 'control'> & {
|
|
4
3
|
description?: string;
|
|
5
4
|
};
|
|
6
|
-
export declare const OptionsEditorControl: ({ label, control, description }: OptionsEditorControlProps) => JSX.Element;
|
|
5
|
+
export declare const OptionsEditorControl: ({ label, control, description }: OptionsEditorControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
//# sourceMappingURL=OptionsEditorControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsEditorControl.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorControl.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OptionsEditorControl.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorControl.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0B,qBAAqB,EAA0B,MAAM,eAAe,CAAC;AAMtG,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG;IACzF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,oCAAqC,yBAAyB,4CAmC9F,CAAC"}
|
|
@@ -16,7 +16,7 @@ import React from 'react';
|
|
|
16
16
|
import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
|
|
17
17
|
import { useId } from '../utils';
|
|
18
18
|
import { InfoTooltip } from '../InfoTooltip';
|
|
19
|
-
export const OptionsEditorControl = ({ label
|
|
19
|
+
export const OptionsEditorControl = ({ label, control, description })=>{
|
|
20
20
|
// Make sure we have a unique ID we can use for associating labels and
|
|
21
21
|
// controls for a11y.
|
|
22
22
|
const generatedControlId = useId('EditorSectionControl');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorControl.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 { FormControl, FormLabel, FormControlLabelProps, Stack, Box, IconButton } from '@mui/material';\nimport React from 'react';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport { useId } from '../utils';\nimport { InfoTooltip } from '../InfoTooltip';\n\nexport type OptionsEditorControlProps = Pick<FormControlLabelProps, 'label' | 'control'> & {\n description?: string;\n};\n\nexport const OptionsEditorControl = ({ label, control, description }: OptionsEditorControlProps) => {\n // Make sure we have a unique ID we can use for associating labels and\n // controls for a11y.\n const generatedControlId = useId('EditorSectionControl');\n const controlId = `${generatedControlId}-control`;\n\n const controlProps = {\n id: controlId,\n };\n\n return (\n <FormControl>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <FormLabel htmlFor={controlId}>{label}</FormLabel>\n {description && (\n <InfoTooltip description={description} enterDelay={100}>\n <IconButton\n size=\"small\"\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4x', margin: '0 2px' })}\n >\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.grey[700] }}\n />\n </IconButton>\n </InfoTooltip>\n )}\n </Stack>\n <Box sx={{ width: '180px', textAlign: 'right' }}> {React.cloneElement(control, controlProps)}</Box>\n </Stack>\n </FormControl>\n );\n};\n"],"names":["FormControl","FormLabel","Stack","Box","IconButton","React","InformationOutlineIcon","useId","InfoTooltip","OptionsEditorControl","label","control","description","generatedControlId","controlId","controlProps","id","direction","alignItems","justifyContent","htmlFor","enterDelay","size","sx","theme","borderRadius","shape","padding","margin","aria-describedby","aria-hidden","fontSize","color","palette","grey","width","textAlign","cloneElement"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorControl.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 { FormControl, FormLabel, FormControlLabelProps, Stack, Box, IconButton } from '@mui/material';\nimport React from 'react';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport { useId } from '../utils';\nimport { InfoTooltip } from '../InfoTooltip';\n\nexport type OptionsEditorControlProps = Pick<FormControlLabelProps, 'label' | 'control'> & {\n description?: string;\n};\n\nexport const OptionsEditorControl = ({ label, control, description }: OptionsEditorControlProps) => {\n // Make sure we have a unique ID we can use for associating labels and\n // controls for a11y.\n const generatedControlId = useId('EditorSectionControl');\n const controlId = `${generatedControlId}-control`;\n\n const controlProps = {\n id: controlId,\n };\n\n return (\n <FormControl>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <FormLabel htmlFor={controlId}>{label}</FormLabel>\n {description && (\n <InfoTooltip description={description} enterDelay={100}>\n <IconButton\n size=\"small\"\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4x', margin: '0 2px' })}\n >\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.grey[700] }}\n />\n </IconButton>\n </InfoTooltip>\n )}\n </Stack>\n <Box sx={{ width: '180px', textAlign: 'right' }}> {React.cloneElement(control, controlProps)}</Box>\n </Stack>\n </FormControl>\n );\n};\n"],"names":["FormControl","FormLabel","Stack","Box","IconButton","React","InformationOutlineIcon","useId","InfoTooltip","OptionsEditorControl","label","control","description","generatedControlId","controlId","controlProps","id","direction","alignItems","justifyContent","htmlFor","enterDelay","size","sx","theme","borderRadius","shape","padding","margin","aria-describedby","aria-hidden","fontSize","color","palette","grey","width","textAlign","cloneElement"],"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,EAAEC,SAAS,EAAyBC,KAAK,EAAEC,GAAG,EAAEC,UAAU,QAAQ,gBAAgB;AACtG,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,4BAA4B,qCAAqC;AACxE,SAASC,KAAK,QAAQ,WAAW;AACjC,SAASC,WAAW,QAAQ,iBAAiB;AAM7C,OAAO,MAAMC,uBAAuB,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAEC,WAAW,EAA6B;IAC7F,sEAAsE;IACtE,qBAAqB;IACrB,MAAMC,qBAAqBN,MAAM;IACjC,MAAMO,YAAY,CAAC,EAAED,mBAAmB,QAAQ,CAAC;IAEjD,MAAME,eAAe;QACnBC,IAAIF;IACN;IAEA,qBACE,KAACd;kBACC,cAAA,MAACE;YAAMe,WAAU;YAAMC,YAAW;YAASC,gBAAe;;8BACxD,MAACjB;oBAAMe,WAAU;oBAAMC,YAAW;oBAASC,gBAAe;;sCACxD,KAAClB;4BAAUmB,SAASN;sCAAYJ;;wBAC/BE,6BACC,KAACJ;4BAAYI,aAAaA;4BAAaS,YAAY;sCACjD,cAAA,KAACjB;gCACCkB,MAAK;gCACLC,IAAI,CAACC,QAAW,CAAA;wCAAEC,cAAcD,MAAME,KAAK,CAACD,YAAY;wCAAEE,SAAS;wCAAMC,QAAQ;oCAAQ,CAAA;0CAEzF,cAAA,KAACtB;oCACCuB,oBAAiB;oCACjBC,eAAa;oCACbC,UAAS;oCACTR,IAAI;wCAAES,OAAO,CAACR,QAAUA,MAAMS,OAAO,CAACC,IAAI,CAAC,IAAI;oCAAC;;;;;;8BAM1D,MAAC/B;oBAAIoB,IAAI;wBAAEY,OAAO;wBAASC,WAAW;oBAAQ;;wBAAG;sCAAE/B,MAAMgC,YAAY,CAAC1B,SAASI;;;;;;AAIvF,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export type OptionsEditorGridProps = {
|
|
3
3
|
/**
|
|
4
4
|
* 1-3 `OptionsEditorColumn` components to render content in columns.
|
|
5
5
|
*/
|
|
@@ -9,5 +9,5 @@ export declare type OptionsEditorGridProps = {
|
|
|
9
9
|
* Top level grid container used to lay out content for editing in panel
|
|
10
10
|
* options.
|
|
11
11
|
*/
|
|
12
|
-
export declare const OptionsEditorGrid: ({ children }: OptionsEditorGridProps) => JSX.Element;
|
|
12
|
+
export declare const OptionsEditorGrid: ({ children }: OptionsEditorGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
//# sourceMappingURL=OptionsEditorGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsEditorGrid.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorGrid.tsx"],"names":[],"mappings":";AAeA,
|
|
1
|
+
{"version":3,"file":"OptionsEditorGrid.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorGrid.tsx"],"names":[],"mappings":";AAeA,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iBAAkB,sBAAsB,4CAMrE,CAAC"}
|
|
@@ -15,7 +15,7 @@ import { Grid } from '@mui/material';
|
|
|
15
15
|
/**
|
|
16
16
|
* Top level grid container used to lay out content for editing in panel
|
|
17
17
|
* options.
|
|
18
|
-
*/ export const OptionsEditorGrid = ({ children
|
|
18
|
+
*/ export const OptionsEditorGrid = ({ children })=>{
|
|
19
19
|
return /*#__PURE__*/ _jsx(Grid, {
|
|
20
20
|
container: true,
|
|
21
21
|
spacing: 8,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorGrid.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 { Grid } from '@mui/material';\n\nexport type OptionsEditorGridProps = {\n /**\n * 1-3 `OptionsEditorColumn` components to render content in columns.\n */\n children: React.ReactNode;\n};\n\n/**\n * Top level grid container used to lay out content for editing in panel\n * options.\n */\nexport const OptionsEditorGrid = ({ children }: OptionsEditorGridProps) => {\n return (\n <Grid container spacing={8}>\n {children}\n </Grid>\n );\n};\n"],"names":["Grid","OptionsEditorGrid","children","container","spacing"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/OptionsEditorLayout/OptionsEditorGrid.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 { Grid } from '@mui/material';\n\nexport type OptionsEditorGridProps = {\n /**\n * 1-3 `OptionsEditorColumn` components to render content in columns.\n */\n children: React.ReactNode;\n};\n\n/**\n * Top level grid container used to lay out content for editing in panel\n * options.\n */\nexport const OptionsEditorGrid = ({ children }: OptionsEditorGridProps) => {\n return (\n <Grid container spacing={8}>\n {children}\n </Grid>\n );\n};\n"],"names":["Grid","OptionsEditorGrid","children","container","spacing"],"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,QAAQ,gBAAgB;AASrC;;;CAGC,GACD,OAAO,MAAMC,oBAAoB,CAAC,EAAEC,QAAQ,EAA0B;IACpE,qBACE,KAACF;QAAKG,SAAS;QAACC,SAAS;kBACtBF;;AAGP,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type OptionsEditorGroupProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Text that communicates the purpose of the grouping.
|
|
5
5
|
*/
|
|
@@ -10,5 +10,5 @@ export declare type OptionsEditorGroupProps = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Group similar content within panel options.
|
|
12
12
|
*/
|
|
13
|
-
export declare const OptionsEditorGroup: ({ title, children, icon }: OptionsEditorGroupProps) => JSX.Element;
|
|
13
|
+
export declare const OptionsEditorGroup: ({ title, children, icon }: OptionsEditorGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
//# sourceMappingURL=OptionsEditorGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsEditorGroup.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorGroup.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,
|
|
1
|
+
{"version":3,"file":"OptionsEditorGroup.d.ts","sourceRoot":"","sources":["../../src/OptionsEditorLayout/OptionsEditorGroup.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,8BAA+B,uBAAuB,4CAYpF,CAAC"}
|