@perses-dev/components 0.0.0-snapshot-explorer-plugin-c4a7621 → 0.0.0-snapshot-profile-8090608
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/DragAndDrop/DragButton.d.ts +2 -2
- package/dist/DragAndDrop/DragButton.d.ts.map +1 -1
- package/dist/DragAndDrop/DragButton.js +5 -3
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.d.ts +3 -2
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +26 -4
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +2 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +5 -6
- package/dist/JSONEditor.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +15 -4
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableCell.d.ts +2 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +4 -2
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableFoot.d.ts +4 -0
- package/dist/Table/TableFoot.d.ts.map +1 -0
- package/dist/{BarChart/index.js → Table/TableFoot.js} +11 -3
- package/dist/Table/TableFoot.js.map +1 -0
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +3 -2
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +33 -2
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +18 -2
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +4 -2
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +6 -6
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeRangeSelector/utils.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +2 -5
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -5
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -8
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +6 -16
- 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 +27 -23
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/cjs/DragAndDrop/DragButton.js +4 -2
- package/dist/cjs/EChart/EChart.js +25 -3
- package/dist/cjs/InfoTooltip/InfoTooltip.js +2 -1
- package/dist/cjs/JSONEditor.js +4 -5
- package/dist/cjs/Overlay/Overlay.js +1 -1
- package/dist/cjs/Table/Table.js +14 -3
- package/dist/cjs/Table/TableCell.js +4 -2
- package/dist/cjs/{StatChart/utils/formatStatChartValue.js → Table/TableFoot.js} +12 -15
- package/dist/cjs/Table/VirtualizedTable.js +32 -1
- package/dist/cjs/Table/model/table-model.js +7 -2
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +9 -9
- package/dist/cjs/TimeChart/TimeChart.js +5 -5
- package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +2 -2
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +1 -4
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +1 -4
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +6 -25
- package/dist/cjs/TimeSeriesTooltip/utils.js +26 -22
- package/dist/cjs/context/ChartsProvider.js +3 -1
- package/dist/cjs/index.js +0 -5
- package/dist/cjs/test-utils/theme.js +1 -0
- package/dist/context/ChartsProvider.d.ts +2 -0
- package/dist/context/ChartsProvider.d.ts.map +1 -1
- package/dist/context/ChartsProvider.js +3 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/model/timeOption.js.map +1 -1
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +1 -0
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/component-overrides/alert.js.map +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/package.json +6 -11
- package/dist/BarChart/BarChart.d.ts +0 -16
- package/dist/BarChart/BarChart.d.ts.map +0 -1
- package/dist/BarChart/BarChart.js +0 -134
- package/dist/BarChart/BarChart.js.map +0 -1
- package/dist/BarChart/index.d.ts +0 -2
- package/dist/BarChart/index.d.ts.map +0 -1
- package/dist/BarChart/index.js.map +0 -1
- package/dist/GaugeChart/GaugeChart.d.ts +0 -23
- package/dist/GaugeChart/GaugeChart.d.ts.map +0 -1
- package/dist/GaugeChart/GaugeChart.js +0 -214
- package/dist/GaugeChart/GaugeChart.js.map +0 -1
- package/dist/GaugeChart/index.d.ts +0 -2
- package/dist/GaugeChart/index.d.ts.map +0 -1
- package/dist/GaugeChart/index.js +0 -15
- package/dist/GaugeChart/index.js.map +0 -1
- package/dist/PieChart/PieChart.d.ts +0 -14
- package/dist/PieChart/PieChart.d.ts.map +0 -1
- package/dist/PieChart/PieChart.js +0 -92
- package/dist/PieChart/PieChart.js.map +0 -1
- package/dist/PieChart/index.d.ts +0 -2
- package/dist/PieChart/index.d.ts.map +0 -1
- package/dist/PieChart/index.js +0 -15
- package/dist/PieChart/index.js.map +0 -1
- package/dist/StatChart/StatChart.d.ts +0 -21
- package/dist/StatChart/StatChart.d.ts.map +0 -1
- package/dist/StatChart/StatChart.js +0 -185
- package/dist/StatChart/StatChart.js.map +0 -1
- package/dist/StatChart/calculateFontSize.d.ts +0 -16
- package/dist/StatChart/calculateFontSize.d.ts.map +0 -1
- package/dist/StatChart/calculateFontSize.js +0 -49
- package/dist/StatChart/calculateFontSize.js.map +0 -1
- package/dist/StatChart/index.d.ts +0 -2
- package/dist/StatChart/index.d.ts.map +0 -1
- package/dist/StatChart/index.js +0 -15
- package/dist/StatChart/index.js.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.d.ts +0 -3
- package/dist/StatChart/utils/formatStatChartValue.d.ts.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.js +0 -26
- package/dist/StatChart/utils/formatStatChartValue.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +0 -27
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.js +0 -132
- package/dist/StatusHistoryChart/StatusHistoryChart.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +0 -13
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js +0 -47
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +0 -2
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.js +0 -41
- package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +0 -1
- package/dist/StatusHistoryChart/index.d.ts +0 -3
- package/dist/StatusHistoryChart/index.d.ts.map +0 -1
- package/dist/StatusHistoryChart/index.js +0 -16
- package/dist/StatusHistoryChart/index.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.d.ts +0 -6
- package/dist/StatusHistoryChart/utils/get-color.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.js +0 -100
- package/dist/StatusHistoryChart/utils/get-color.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +0 -3
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js +0 -27
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +0 -1
- package/dist/cjs/BarChart/BarChart.js +0 -142
- package/dist/cjs/BarChart/index.js +0 -30
- package/dist/cjs/GaugeChart/GaugeChart.js +0 -227
- package/dist/cjs/GaugeChart/index.js +0 -30
- package/dist/cjs/PieChart/PieChart.js +0 -100
- package/dist/cjs/PieChart/index.js +0 -30
- package/dist/cjs/StatChart/StatChart.js +0 -198
- package/dist/cjs/StatChart/calculateFontSize.js +0 -55
- package/dist/cjs/StatChart/index.js +0 -30
- package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +0 -140
- package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +0 -55
- package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +0 -48
- package/dist/cjs/StatusHistoryChart/index.js +0 -31
- package/dist/cjs/StatusHistoryChart/utils/get-color.js +0 -125
- package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAQ,gBAAgB,EAAkC,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LineChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAQ,gBAAgB,EAAkC,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,OAAO,EACL,iBAAiB,EAMlB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IACxD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,8DA2F3B,CAAC"}
|
|
@@ -17,7 +17,7 @@ import useResizeObserver from 'use-resize-observer';
|
|
|
17
17
|
import { TooltipContent } from './TooltipContent';
|
|
18
18
|
import { TooltipHeader } from './TooltipHeader';
|
|
19
19
|
import { legacyGetNearbySeriesData } from './nearby-series';
|
|
20
|
-
import {
|
|
20
|
+
import { TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, TOOLTIP_MIN_WIDTH, useMousePosition } from './tooltip-model';
|
|
21
21
|
import { assembleTransform } from './utils';
|
|
22
22
|
export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ chartRef, chartData, enablePinning = true, wrapLabels, format, onUnpinClick, pinnedPos, containerId }) {
|
|
23
23
|
const [showAllSeries, setShowAllSeries] = useState(false);
|
|
@@ -29,7 +29,6 @@ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ c
|
|
|
29
29
|
// Ensure user is hovering over a chart before checking for nearby series.
|
|
30
30
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
31
31
|
const chart = chartRef.current;
|
|
32
|
-
const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
33
32
|
// Get series nearby the cursor and pass into tooltip content children.
|
|
34
33
|
const nearbySeries = legacyGetNearbySeriesData({
|
|
35
34
|
mousePos,
|
|
@@ -46,9 +45,7 @@ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ c
|
|
|
46
45
|
const containerElement = containerId ? document.querySelector(containerId) : undefined;
|
|
47
46
|
// if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
|
|
48
47
|
const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
49
|
-
|
|
50
|
-
transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
51
|
-
}
|
|
48
|
+
transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
52
49
|
return /*#__PURE__*/ _jsx(Portal, {
|
|
53
50
|
container: containerElement,
|
|
54
51
|
children: /*#__PURE__*/ _jsx(Box, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { FormatOptions } from '@perses-dev/core';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, MutableRefObject, ReactElement, useRef, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { legacyGetNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { FormatOptions } from '@perses-dev/core';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, MutableRefObject, ReactElement, useRef, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { legacyGetNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MIN_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\nexport interface TimeSeriesTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n enablePinning?: boolean;\n wrapLabels?: boolean;\n format?: FormatOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n}\n\nexport const LineChartTooltip = memo(function LineChartTooltip({\n chartRef,\n chartData,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n containerId,\n}: TimeSeriesTooltipProps): ReactElement | null {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n const transform = useRef<string | undefined>();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = legacyGetNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = chartData.timeSeries.length;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: maxHeight ?? TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: transform.current,\n display: transform.current ? 'block' : 'none',\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useRef","useState","useResizeObserver","TooltipContent","TooltipHeader","legacyGetNearbySeriesData","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","TOOLTIP_MIN_WIDTH","useMousePosition","assembleTransform","LineChartTooltip","chartRef","chartData","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","containerId","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","transform","isTooltipPinned","target","tagName","chart","current","nearbySeries","length","totalSeries","timeSeries","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","container","sx","theme","minWidth","maxWidth","padding","position","top","left","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","display","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,SAASC,IAAI,EAAkCC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/E,OAAOC,uBAAuB,sBAAsB;AAEpD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,yBAAyB,QAAQ,kBAAkB;AAC5D,SAEEC,yBAAyB,EACzBC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB,QACX,kBAAkB;AACzB,SAASC,iBAAiB,QAAQ,UAAU;AAiB5C,OAAO,MAAMC,iCAAmBb,KAAK,SAASa,iBAAiB,EAC7DC,QAAQ,EACRC,SAAS,EACTC,gBAAgB,IAAI,E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ZC,SAAS;oBACTC,YAAY;oBACZ,yEAAyE;oBACzEC,QAAQ5C,cAAc,OAAO,SAAS2B,MAAMiB,MAAM,CAACC,OAAO;oBAC1DC,UAAU;oBACV,WAAW;wBACTC,WAAW;oBACb;gBACF,CAAA;YACAC,OAAO;gBACLvC,WAAWA,UAAUK,OAAO;gBAC5BmC,SAASxC,UAAUK,OAAO,GAAG,UAAU;YACzC;sBAEA,cAAA,MAACnC;gBAAMuE,SAAS;;kCACd,KAACjE;wBACC8B,cAAcA;wBACdE,aAAaA;wBACbrB,eAAeA;wBACfc,iBAAiBA;wBACjBR,eAAeA;wBACfiD,gBAAgB,CAACC,UAAYjD,iBAAiBiD;wBAC9CrD,cAAcA;;kCAEhB,KAACf;wBAAeqE,QAAQtC;wBAAclB,YAAYA;;;;;;AAK5D,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH, EMPHASIZED_SERIES_DESCRIPTION, NEARBY_SERIES_DESCRIPTION } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n emphasizeText?: boolean;\n wrapLabels?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps): ReactElement {\n const { seriesName, formattedY, markerColor, totalSeries, emphasizeText = false, wrapLabels = true } = props;\n\n // metric __name__ comes before opening curly brace, ignore if not populated\n // ex with metric name: node_load15{env=\"demo\",job=\"node\"}\n // ex without metric name: {env=\"demo\",job=\"node\"}\n const splitName = seriesName.split('{');\n const seriesLabels = splitName[1] ?? seriesName;\n\n // remove curly braces that wrap labels\n const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');\n\n // determine whether to show labels on separate lines\n const splitLabels = formattedSeriesLabels.split(',');\n if (totalSeries === 1 && splitLabels.length > 1) {\n const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';\n return (\n <SeriesLabelsStack\n formattedY={formattedY}\n metricName={metricName}\n metricLabels={splitLabels}\n markerColor={markerColor}\n />\n );\n }\n\n // add space after commas so wrapLabels works\n const formattedSeriesInfo = seriesName.replace(/[,]/g, ', ');\n\n return (\n <Box\n sx={{\n display: 'table-row',\n paddingTop: 0.5,\n }}\n >\n <Box\n sx={{\n display: 'table-cell',\n maxWidth: '520px',\n }}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.5 }} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n display: 'inline-block',\n width: 'calc(100% - 20px)',\n minWidth: 150,\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n color: theme.palette.common.white,\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n aria-label={emphasizeText ? EMPHASIZED_SERIES_DESCRIPTION : NEARBY_SERIES_DESCRIPTION}\n >\n {formattedSeriesInfo}\n </Box>\n </Box>\n <Box\n sx={(theme) => ({\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n })}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","EMPHASIZED_SERIES_DESCRIPTION","NEARBY_SERIES_DESCRIPTION","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","emphasizeText","wrapLabels","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","formattedSeriesInfo","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","fontWeight","typography","fontWeightBold","fontWeightRegular","textOverflow","whiteSpace","aria-label","paddingLeft","textAlign","verticalAlign"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,wBAAwB,EAAEC,6BAA6B,EAAEC,yBAAyB,QAAQ,kBAAkB;AAYrH,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,UAAU,EAAEC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAEC,aAAa,IAAI,EAAE,GAAGN;IAEvG,4EAA4E;IAC5E,0DAA0D;IAC1D,kDAAkD;IAClD,MAAMO,YAAYN,WAAWO,KAAK,CAAC;IACnC,MAAMC,eAAeF,SAAS,CAAC,EAAE,IAAIN;IAErC,uCAAuC;IACvC,MAAMS,wBAAwBD,aAAaE,OAAO,CAAC,SAAS;IAE5D,qDAAqD;IACrD,MAAMC,cAAcF,sBAAsBF,KAAK,CAAC;IAChD,IAAIJ,gBAAgB,KAAKQ,YAAYC,MAAM,GAAG,GAAG;QAC/C,MAAMC,aAAaP,SAAS,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH, EMPHASIZED_SERIES_DESCRIPTION, NEARBY_SERIES_DESCRIPTION } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n emphasizeText?: boolean;\n wrapLabels?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps): ReactElement {\n const { seriesName, formattedY, markerColor, totalSeries, emphasizeText = false, wrapLabels = true } = props;\n\n // metric __name__ comes before opening curly brace, ignore if not populated\n // ex with metric name: node_load15{env=\"demo\",job=\"node\"}\n // ex without metric name: {env=\"demo\",job=\"node\"}\n const splitName = seriesName.split('{');\n const seriesLabels = splitName[1] ?? seriesName;\n\n // remove curly braces that wrap labels\n const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');\n\n // determine whether to show labels on separate lines\n const splitLabels = formattedSeriesLabels.split(',');\n if (totalSeries === 1 && splitLabels.length > 1) {\n const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';\n return (\n <SeriesLabelsStack\n formattedY={formattedY}\n metricName={metricName}\n metricLabels={splitLabels}\n markerColor={markerColor}\n />\n );\n }\n\n // add space after commas so wrapLabels works\n const formattedSeriesInfo = seriesName.replace(/[,]/g, ', ');\n\n return (\n <Box\n sx={{\n display: 'table-row',\n paddingTop: 0.5,\n }}\n >\n <Box\n sx={{\n display: 'table-cell',\n maxWidth: '520px',\n }}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.5 }} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n display: 'inline-block',\n width: 'calc(100% - 20px)',\n minWidth: 150,\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n color: theme.palette.common.white,\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n aria-label={emphasizeText ? EMPHASIZED_SERIES_DESCRIPTION : NEARBY_SERIES_DESCRIPTION}\n >\n {formattedSeriesInfo}\n </Box>\n </Box>\n <Box\n sx={(theme) => ({\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,\n })}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","EMPHASIZED_SERIES_DESCRIPTION","NEARBY_SERIES_DESCRIPTION","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","emphasizeText","wrapLabels","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","formattedSeriesInfo","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","fontWeight","typography","fontWeightBold","fontWeightRegular","textOverflow","whiteSpace","aria-label","paddingLeft","textAlign","verticalAlign"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAE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CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;gCAChGC,cAAc;gCACdC,YAAY9B,aAAa,WAAW;4BACtC,CAAA;wBACA+B,cAAYhC,gBAAgBR,gCAAgCC;kCAE3DkB;;;;0BAGL,KAACvB;gBACCwB,IAAI,CAACM,QAAW,CAAA;wBACdL,SAAS;wBACToB,aAAa;wBACbC,WAAW;wBACXC,eAAe;wBACfT,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;oBAClG,CAAA;0BAEChC;;;;AAIT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { SeriesMarker } from './SeriesMarker';\n\nexport interface SeriesLabelsStackProps {\n formattedY: string;\n metricName: string;\n metricLabels: string[];\n markerColor: string;\n}\n\nexport function SeriesLabelsStack(props: SeriesLabelsStackProps): ReactElement {\n const { formattedY, markerColor, metricName, metricLabels } = props;\n return (\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n display: 'flex',\n height: '16px',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'left',\n color: theme.palette.common.white,\n fontSize: '11px',\n })}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.25 }} />\n <Box component=\"span\">\n {metricName}\n <Box\n component=\"span\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n paddingLeft: '2px',\n })}\n >\n {formattedY}\n </Box>\n </Box>\n </Box>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {metricLabels.map((label) => {\n // show labels on separate lines when many labels and only one focused series\n if (label) {\n const [name, value] = label.split('=');\n const formattedName = value !== undefined ? `${name}: ` : name;\n const formattedValue = value !== undefined ? value.replace(/(^\"|\"$)/g, '') : value;\n return (\n <Box key={label} sx={{ display: 'flex', gap: '4px' }}>\n <Typography sx={{ fontSize: '11px' }}>{formattedName}</Typography>\n <Typography\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n fontSize: '11px',\n })}\n >\n {formattedValue}\n </Typography>\n </Box>\n );\n }\n })}\n </Box>\n </Stack>\n );\n}\n"],"names":["Box","Divider","Stack","Typography","SeriesMarker","SeriesLabelsStack","props","formattedY","markerColor","metricName","metricLabels","spacing","sx","theme","display","height","flexDirection","alignItems","justifyContent","color","palette","common","white","fontSize","marginTop","component","fontWeight","paddingLeft","borderColor","grey","map","label","name","value","split","formattedName","undefined","formattedValue","replace","gap"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAEhE,SAASC,YAAY,QAAQ,iBAAiB;AAS9C,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAEC,UAAU,EAAEC,YAAY,EAAE,GAAGJ;IAC9D,qBACE,MAACJ;QAAMS,SAAS;;0BACd,MAACX;gBACCY,IAAI,CAACC,QAAW,CAAA;wBACdC,SAAS;wBACTC,QAAQ;wBACRC,eAAe;wBACfC,YAAY;wBACZC,gBAAgB;wBAChBC,OAAON,MAAMO,OAAO,CAACC,MAAM,CAACC,KAAK;wBACjCC,UAAU;oBACZ,CAAA;;kCAEA,KAACnB;wBAAaI,aAAaA;wBAAaI,IAAI;4BAAEY,WAAW;wBAAK;;kCAC9D,MAACxB;wBAAIyB,WAAU;;4BACZhB;0CACD,KAACT;gCACCyB,WAAU;gCACVb,IAAI,CAACC,QAAW,CAAA;wCACdM,OAAON,MAAMO,OAAO,CAACC,MAAM,CAACC,KAAK;wCACjCI,YAAY;wCACZC,aAAa;oCACf,CAAA;0CAECpB;;;;;;0BAIP,KAACN;gBACCW,IAAI,CAACC,QAAW,CAAA;wBACde,aAAaf,MAAMO,OAAO,CAACS,IAAI,CAAC,MAAM;oBACxC,CAAA;;0BAEF,KAAC7B;gBACCY,IAAI,CAACC,QAAW,CAAA;wBACdM,OAAON,MAAMO,OAAO,CAACC,MAAM,CAACC,KAAK;oBACnC,CAAA;0BAECZ,aAAaoB,GAAG,CAAC,CAACC;oBACjB,6EAA6E;oBAC7E,IAAIA,OAAO;wBACT,MAAM,CAACC,MAAMC,MAAM,GAAGF,MAAMG,KAAK,CAAC;wBAClC,MAAMC,gBAAgBF,UAAUG,YAAY,
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { SeriesMarker } from './SeriesMarker';\n\nexport interface SeriesLabelsStackProps {\n formattedY: string;\n metricName: string;\n metricLabels: string[];\n markerColor: string;\n}\n\nexport function SeriesLabelsStack(props: SeriesLabelsStackProps): ReactElement {\n const { formattedY, markerColor, metricName, metricLabels } = props;\n return (\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n display: 'flex',\n height: '16px',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'left',\n color: theme.palette.common.white,\n fontSize: '11px',\n })}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.25 }} />\n <Box component=\"span\">\n {metricName}\n <Box\n component=\"span\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n paddingLeft: '2px',\n })}\n >\n {formattedY}\n </Box>\n </Box>\n </Box>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {metricLabels.map((label) => {\n // show labels on separate lines when many labels and only one focused series\n if (label) {\n const [name, value] = label.split('=');\n const formattedName = value !== undefined ? `${name}: ` : name;\n const formattedValue = value !== undefined ? value.replace(/(^\"|\"$)/g, '') : value;\n return (\n <Box key={label} sx={{ display: 'flex', gap: '4px' }}>\n <Typography sx={{ fontSize: '11px' }}>{formattedName}</Typography>\n <Typography\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n fontSize: '11px',\n })}\n >\n {formattedValue}\n </Typography>\n </Box>\n );\n }\n })}\n </Box>\n </Stack>\n );\n}\n"],"names":["Box","Divider","Stack","Typography","SeriesMarker","SeriesLabelsStack","props","formattedY","markerColor","metricName","metricLabels","spacing","sx","theme","display","height","flexDirection","alignItems","justifyContent","color","palette","common","white","fontSize","marginTop","component","fontWeight","paddingLeft","borderColor","grey","map","label","name","value","split","formattedName","undefined","formattedValue","replace","gap"],"mappings":"AAAA,oCA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AAC;wBAClC,MAAMC,gBAAgBF,UAAUG,YAAY,GAAGJ,KAAK,EAAE,CAAC,GAAGA;wBAC1D,MAAMK,iBAAiBJ,UAAUG,YAAYH,MAAMK,OAAO,CAAC,YAAY,MAAML;wBAC7E,qBACE,MAACjC;4BAAgBY,IAAI;gCAAEE,SAAS;gCAAQyB,KAAK;4BAAM;;8CACjD,KAACpC;oCAAWS,IAAI;wCAAEW,UAAU;oCAAO;8CAAIY;;8CACvC,KAAChC;oCACCS,IAAI,CAACC,QAAW,CAAA;4CACdM,OAAON,MAAMO,OAAO,CAACC,MAAM,CAACC,KAAK;4CACjCI,YAAY;4CACZH,UAAU;wCACZ,CAAA;8CAECc;;;2BATKN;oBAad;gBACF;;;;AAIR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAQ,gBAAgB,EAAoB,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"TimeChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAQ,gBAAgB,EAAoB,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,iBAAiB,CAAC;AAMtE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IACxD,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,6DAwE3B,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
import { memo, useRef, useState } from 'react';
|
|
15
15
|
import { Box, Portal, Stack } from '@mui/material';
|
|
16
16
|
import useResizeObserver from 'use-resize-observer';
|
|
17
|
-
import {
|
|
17
|
+
import { useMousePosition } from './tooltip-model';
|
|
18
18
|
import { assembleTransform, getTooltipStyles } from './utils';
|
|
19
19
|
import { getNearbySeriesData } from './nearby-series';
|
|
20
20
|
import { TooltipHeader } from './TooltipHeader';
|
|
@@ -29,13 +29,10 @@ export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ c
|
|
|
29
29
|
// Ensure user is hovering over a chart before checking for nearby series.
|
|
30
30
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
31
31
|
const chart = chartRef.current;
|
|
32
|
-
const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
33
32
|
const containerElement = containerId ? document.querySelector(containerId) : undefined;
|
|
34
33
|
// if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
|
|
35
34
|
const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
36
|
-
|
|
37
|
-
transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
38
|
-
}
|
|
35
|
+
transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
39
36
|
// Get series nearby the cursor and pass into tooltip content children.
|
|
40
37
|
const nearbySeries = getNearbySeriesData({
|
|
41
38
|
mousePos,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { memo, MutableRefObject, useRef, useState } from 'react';\nimport { Box, Portal, Stack } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { FormatOptions, TimeSeries } from '@perses-dev/core';\nimport useResizeObserver from 'use-resize-observer';\nimport { TimeChartSeriesMapping } from '../model';\nimport { CursorCoordinates,
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { memo, MutableRefObject, useRef, useState } from 'react';\nimport { Box, Portal, Stack } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { FormatOptions, TimeSeries } from '@perses-dev/core';\nimport useResizeObserver from 'use-resize-observer';\nimport { TimeChartSeriesMapping } from '../model';\nimport { CursorCoordinates, useMousePosition } from './tooltip-model';\nimport { assembleTransform, getTooltipStyles } from './utils';\nimport { getNearbySeriesData } from './nearby-series';\nimport { TooltipHeader } from './TooltipHeader';\nimport { TooltipContent } from './TooltipContent';\n\nexport interface TimeChartTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n enablePinning?: boolean;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n onUnpinClick?: () => void;\n format?: FormatOptions;\n wrapLabels?: boolean;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n containerId,\n chartRef,\n data,\n seriesMapping,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const transform = useRef<string | undefined>();\n\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null || data === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)}\n style={{\n transform: transform.current,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["memo","useRef","useState","Box","Portal","Stack","useResizeObserver","useMousePosition","assembleTransform","getTooltipStyles","getNearbySeriesData","TooltipHeader","TooltipContent","TimeChartTooltip","containerId","chartRef","data","seriesMapping","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","transform","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","nearbySeries","length","totalSeries","container","sx","theme","style","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,IAAI,EAAoBC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACjE,SAASC,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,OAAOC,uBAAuB,sBAAsB;AAEpD,SAA4BC,gBAAgB,QAAQ,kBAAkB;AACtE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,UAAU;AAC9D,SAASC,mBAAmB,QAAQ,kBAAkB;A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U,OAAO;YAC9B;sBAEA,cAAA,MAAC9B;gBAAM4C,SAAS;;kCACd,KAACtC;wBACC+B,cAAcA;wBACdE,aAAaA;wBACb1B,eAAeA;wBACfa,iBAAiBA;wBACjBR,eAAeA;wBACf2B,gBAAgB,CAACC,UAAY3B,iBAAiB2B;wBAC9C9B,cAAcA;;kCAEhB,KAACT;wBAAewC,QAAQV;wBAAcvB,YAAYA;;;;;;AAK5D,GAAG"}
|
|
@@ -57,14 +57,7 @@ type ZREventProperties = {
|
|
|
57
57
|
zrEventControl?: 'no_globalout' | 'only_globalout';
|
|
58
58
|
zrByTouch?: boolean;
|
|
59
59
|
};
|
|
60
|
-
export type ZRRawMouseEvent =
|
|
61
|
-
type ZRBrowser = {
|
|
62
|
-
ie: RegExpMatchArray | null;
|
|
63
|
-
edge: RegExpMatchArray | null;
|
|
64
|
-
};
|
|
65
|
-
export declare const browser: ZRBrowser;
|
|
66
|
-
export declare const pointerEventsSupported: boolean | "" | RegExpMatchArray | null | undefined;
|
|
67
|
-
export declare const trackingEventName: string;
|
|
60
|
+
export type ZRRawMouseEvent = MouseEvent & ZREventProperties;
|
|
68
61
|
export declare const useMousePosition: () => CursorData['coords'];
|
|
69
62
|
export type TooltipConfig = {
|
|
70
63
|
wrapLabels: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-model.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/tooltip-model.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,wBAAwB,QAA0B,CAAC;AAChE,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,eAAO,MAAM,oBAAoB,MAAM,C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AE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,QAAO,UAAU,CAAC,QAAQ,CAkCtD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,yBAAyB,CAAC"}
|
|
@@ -45,14 +45,6 @@ export const defaultCursorData = {
|
|
|
45
45
|
chartWidth: 0
|
|
46
46
|
};
|
|
47
47
|
export const EMPTY_TOOLTIP_DATA = [];
|
|
48
|
-
export const browser = {
|
|
49
|
-
// IE 11 Trident/7.0; rv:11.0
|
|
50
|
-
ie: navigator.userAgent.match(/MSIE\s([\d.]+)/) || navigator.userAgent.match(/Trident\/.+?rv:(([\d.]+))/),
|
|
51
|
-
// IE 12 and 12+
|
|
52
|
-
edge: navigator.userAgent.match(/Edge?\/([\d.]+)/)
|
|
53
|
-
};
|
|
54
|
-
export const pointerEventsSupported = 'onpointerdown' in window && (browser.edge || browser.ie && browser.ie[1] && +browser.ie[1] >= 11);
|
|
55
|
-
export const trackingEventName = pointerEventsSupported ? 'pointermove' : 'mousemove';
|
|
56
48
|
export const useMousePosition = ()=>{
|
|
57
49
|
const [coords, setCoords] = useState(null);
|
|
58
50
|
useEffect(()=>{
|
|
@@ -67,22 +59,20 @@ export const useMousePosition = ()=>{
|
|
|
67
59
|
y: e.clientY
|
|
68
60
|
},
|
|
69
61
|
plotCanvas: {
|
|
70
|
-
//
|
|
62
|
+
// Default to zrender mousemove coords since they handle browser inconsistencies for us
|
|
71
63
|
// ex: Firefox and Chrome have slightly different implementations of offsetX and offsetY
|
|
72
64
|
// more info: https://github.com/ecomfe/zrender/blob/5.5.0/src/core/event.ts#L46-L120
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
// Fallback to offsetX and offsetY to ensure tooltip works correctly in Edge
|
|
66
|
+
x: e.zrX ?? e.offsetX,
|
|
67
|
+
y: e.zrY ?? e.offsetY
|
|
75
68
|
},
|
|
76
69
|
// necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)
|
|
77
70
|
target: e.target
|
|
78
71
|
});
|
|
79
72
|
};
|
|
80
|
-
|
|
81
|
-
// which leads to missing zrender mousemove coordinates
|
|
82
|
-
// {@link https://github.com/ecomfe/zrender/blob/ae8cfaae186e6c1bf66b5dc431b2cdda5e67dacf/src/dom/HandlerProxy.ts#L423-L428 }
|
|
83
|
-
window.addEventListener(trackingEventName, setFromEvent);
|
|
73
|
+
window.addEventListener('mousemove', setFromEvent);
|
|
84
74
|
return ()=>{
|
|
85
|
-
window.removeEventListener(
|
|
75
|
+
window.removeEventListener('mousemove', setFromEvent);
|
|
86
76
|
};
|
|
87
77
|
}, []);
|
|
88
78
|
return coords;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/tooltip-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useState } from 'react';\nimport { NearbySeriesArray } from './nearby-series';\n\nexport const TOOLTIP_MIN_WIDTH = 375;\nexport const TOOLTIP_MAX_WIDTH = 650;\nexport const TOOLTIP_MAX_HEIGHT = 650;\nexport const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;\nexport const TOOLTIP_ADJUST_Y_POS_MULTIPLIER = 0.75;\nexport const TOOLTIP_PADDING = 8;\n\nexport const FALLBACK_CHART_WIDTH = 750;\n\nexport const NEARBY_SERIES_DESCRIPTION = 'nearby series showing in tooltip';\nexport const EMPHASIZED_SERIES_DESCRIPTION = 'emphasized series showing as bold in tooltip';\n\nexport const TOOLTIP_BG_COLOR_FALLBACK = '#2E313E';\n\nexport const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: true,\n});\n\nexport const defaultCursorData = {\n coords: {\n plotCanvas: {\n x: 0,\n y: 0,\n },\n zrender: {\n x: 0,\n y: 0,\n },\n target: null,\n },\n chartWidth: 0,\n};\n\nexport const EMPTY_TOOLTIP_DATA: NearbySeriesArray = [];\n\n/**\n * ECharts is built with zrender, zrX and zrY are undefined when not hovering over a chart canvas\n */\nexport interface ZRCoordinate {\n x?: number;\n y?: number;\n}\n\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\nexport interface CursorCoordinates {\n page: Coordinate;\n client: Coordinate;\n plotCanvas: ZRCoordinate;\n target: EventTarget | null;\n}\n\nexport interface CursorData {\n coords: CursorCoordinates | null;\n chartWidth?: number;\n}\n\nexport interface TooltipData {\n focusedSeries: NearbySeriesArray | null;\n cursor: CursorData;\n}\n\ntype ZREventProperties = {\n zrX?: number;\n zrY?: number;\n zrDelta?: number;\n zrEventControl?: 'no_globalout' | 'only_globalout';\n zrByTouch?: boolean;\n};\n\nexport type ZRRawMouseEvent =
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/tooltip-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useState } from 'react';\nimport { NearbySeriesArray } from './nearby-series';\n\nexport const TOOLTIP_MIN_WIDTH = 375;\nexport const TOOLTIP_MAX_WIDTH = 650;\nexport const TOOLTIP_MAX_HEIGHT = 650;\nexport const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;\nexport const TOOLTIP_ADJUST_Y_POS_MULTIPLIER = 0.75;\nexport const TOOLTIP_PADDING = 8;\n\nexport const FALLBACK_CHART_WIDTH = 750;\n\nexport const NEARBY_SERIES_DESCRIPTION = 'nearby series showing in tooltip';\nexport const EMPHASIZED_SERIES_DESCRIPTION = 'emphasized series showing as bold in tooltip';\n\nexport const TOOLTIP_BG_COLOR_FALLBACK = '#2E313E';\n\nexport const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: true,\n});\n\nexport const defaultCursorData = {\n coords: {\n plotCanvas: {\n x: 0,\n y: 0,\n },\n zrender: {\n x: 0,\n y: 0,\n },\n target: null,\n },\n chartWidth: 0,\n};\n\nexport const EMPTY_TOOLTIP_DATA: NearbySeriesArray = [];\n\n/**\n * ECharts is built with zrender, zrX and zrY are undefined when not hovering over a chart canvas\n */\nexport interface ZRCoordinate {\n x?: number;\n y?: number;\n}\n\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\nexport interface CursorCoordinates {\n page: Coordinate;\n client: Coordinate;\n plotCanvas: ZRCoordinate;\n target: EventTarget | null;\n}\n\nexport interface CursorData {\n coords: CursorCoordinates | null;\n chartWidth?: number;\n}\n\nexport interface TooltipData {\n focusedSeries: NearbySeriesArray | null;\n cursor: CursorData;\n}\n\ntype ZREventProperties = {\n zrX?: number;\n zrY?: number;\n zrDelta?: number;\n zrEventControl?: 'no_globalout' | 'only_globalout';\n zrByTouch?: boolean;\n};\n\nexport type ZRRawMouseEvent = MouseEvent & ZREventProperties;\n\nexport const useMousePosition = (): CursorData['coords'] => {\n const [coords, setCoords] = useState<CursorData['coords']>(null);\n\n useEffect(() => {\n const setFromEvent = (e: ZRRawMouseEvent): void => {\n return setCoords({\n page: {\n x: e.pageX,\n y: e.pageY,\n },\n client: {\n x: e.clientX,\n y: e.clientY,\n },\n plotCanvas: {\n // Default to zrender mousemove coords since they handle browser inconsistencies for us\n // ex: Firefox and Chrome have slightly different implementations of offsetX and offsetY\n // more info: https://github.com/ecomfe/zrender/blob/5.5.0/src/core/event.ts#L46-L120\n // Fallback to offsetX and offsetY to ensure tooltip works correctly in Edge\n x: e.zrX ?? e.offsetX,\n y: e.zrY ?? e.offsetY,\n },\n // necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)\n target: e.target,\n });\n };\n window.addEventListener('mousemove', setFromEvent);\n\n return (): void => {\n window.removeEventListener('mousemove', setFromEvent);\n };\n }, []);\n\n return coords;\n};\n\nexport type TooltipConfig = {\n wrapLabels: boolean;\n hidden?: boolean;\n enablePinning?: boolean;\n};\n\nexport const DEFAULT_TOOLTIP_CONFIG: TooltipConfig = {\n wrapLabels: true,\n enablePinning: true,\n};\n\nexport const PIN_TOOLTIP_HELP_TEXT = 'Click chart to pin';\n\nexport const UNPIN_TOOLTIP_HELP_TEXT = 'Click chart to unpin';\n"],"names":["useEffect","useState","TOOLTIP_MIN_WIDTH","TOOLTIP_MAX_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_LABELS_MAX_WIDTH","TOOLTIP_ADJUST_Y_POS_MULTIPLIER","TOOLTIP_PADDING","FALLBACK_CHART_WIDTH","NEARBY_SERIES_DESCRIPTION","EMPHASIZED_SERIES_DESCRIPTION","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_DATE_FORMAT","Intl","DateTimeFormat","undefined","year","month","day","hour","minute","second","hour12","defaultCursorData","coords","plotCanvas","x","y","zrender","target","chartWidth","EMPTY_TOOLTIP_DATA","useMousePosition","setCoords","setFromEvent","e","page","pageX","pageY","client","clientX","clientY","zrX","offsetX","zrY","offsetY","window","addEventListener","removeEventListener","DEFAULT_TOOLTIP_CONFIG","wrapLabels","enablePinning","PIN_TOOLTIP_HELP_TEXT","UNPIN_TOOLTIP_HELP_TEXT"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAG5C,OAAO,MAAMC,oBAAoB,IAAI;AACrC,OAAO,MAAMC,oBAAoB,IAAI;AACrC,OAAO,MAAMC,qBAAqB,IAAI;AACtC,OAAO,MAAMC,2BAA2BF,oBAAoB,IAAI;AAChE,OAAO,MAAMG,kCAAkC,KAAK;AACpD,OAAO,MAAMC,kBAAkB,EAAE;AAEjC,OAAO,MAAMC,uBAAuB,IAAI;AAExC,OAAO,MAAMC,4BAA4B,mCAAmC;AAC5E,OAAO,MAAMC,gCAAgC,+CAA+C;AAE5F,OAAO,MAAMC,4BAA4B,UAAU;AAEnD,OAAO,MAAMC,sBAAsB,IAAIC,KAAKC,cAAc,CAACC,WAAW;IACpEC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;AACV,GAAG;AAEH,OAAO,MAAMC,oBAAoB;IAC/BC,QAAQ;QACNC,YAAY;YACVC,GAAG;YACHC,GAAG;QACL;QACAC,SAAS;YACPF,GAAG;YACHC,GAAG;QACL;QACAE,QAAQ;IACV;IACAC,YAAY;AACd,EAAE;AAEF,OAAO,MAAMC,qBAAwC,EAAE,CAAC;AA0CxD,OAAO,MAAMC,mBAAmB;IAC9B,MAAM,CAACR,QAAQS,UAAU,GAAGhC,SAA+B;IAE3DD,UAAU;QACR,MAAMkC,eAAe,CAACC;YACpB,OAAOF,UAAU;gBACfG,MAAM;oBACJV,GAAGS,EAAEE,KAAK;oBACVV,GAAGQ,EAAEG,KAAK;gBACZ;gBACAC,QAAQ;oBACNb,GAAGS,EAAEK,OAAO;oBACZb,GAAGQ,EAAEM,OAAO;gBACd;gBACAhB,YAAY;oBACV,uFAAuF;oBACvF,wFAAwF;oBACxF,qFAAqF;oBACrF,4EAA4E;oBAC5EC,GAAGS,EAAEO,GAAG,IAAIP,EAAEQ,OAAO;oBACrBhB,GAAGQ,EAAES,GAAG,IAAIT,EAAEU,OAAO;gBACvB;gBACA,0HAA0H;gBAC1HhB,QAAQM,EAAEN,MAAM;YAClB;QACF;QACAiB,OAAOC,gBAAgB,CAAC,aAAab;QAErC,OAAO;YACLY,OAAOE,mBAAmB,CAAC,aAAad;QAC1C;IACF,GAAG,EAAE;IAEL,OAAOV;AACT,EAAE;AAQF,OAAO,MAAMyB,yBAAwC;IACnDC,YAAY;IACZC,eAAe;AACjB,EAAE;AAEF,OAAO,MAAMC,wBAAwB,qBAAqB;AAE1D,OAAO,MAAMC,0BAA0B,uBAAuB"}
|
|
@@ -3,7 +3,7 @@ import { CursorCoordinates, CursorData } from './tooltip-model';
|
|
|
3
3
|
/**
|
|
4
4
|
* Determine position of tooltip depending on chart dimensions and the number of focused series
|
|
5
5
|
*/
|
|
6
|
-
export declare function assembleTransform(mousePos: CursorData['coords'],
|
|
6
|
+
export declare function assembleTransform(mousePos: CursorData['coords'], pinnedPos: CursorCoordinates | null, tooltipHeight: number, tooltipWidth: number, containerElement?: Element | null): string | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* Helper for tooltip positioning styles
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,UAAU,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,UAAU,EAMX,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC9B,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,GAChC,MAAM,GAAG,SAAS,CAmDpB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwBzB"}
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { TOOLTIP_MAX_WIDTH, TOOLTIP_MAX_HEIGHT, TOOLTIP_MIN_WIDTH,
|
|
13
|
+
import { TOOLTIP_MAX_WIDTH, TOOLTIP_MAX_HEIGHT, TOOLTIP_MIN_WIDTH, TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_PADDING } from './tooltip-model';
|
|
14
14
|
/**
|
|
15
15
|
* Determine position of tooltip depending on chart dimensions and the number of focused series
|
|
16
|
-
*/ export function assembleTransform(mousePos,
|
|
16
|
+
*/ export function assembleTransform(mousePos, pinnedPos, tooltipHeight, tooltipWidth, containerElement) {
|
|
17
17
|
if (mousePos === null) {
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
|
@@ -23,33 +23,37 @@ import { TOOLTIP_MAX_WIDTH, TOOLTIP_MAX_HEIGHT, TOOLTIP_MIN_WIDTH, TOOLTIP_ADJUS
|
|
|
23
23
|
mousePos = pinnedPos;
|
|
24
24
|
}
|
|
25
25
|
if (mousePos.plotCanvas.x === undefined) return undefined;
|
|
26
|
-
|
|
27
|
-
// Using page coordinates instead of viewport ensures the tooltip is
|
|
28
|
-
// absolutely positioned correctly as the user scrolls
|
|
29
|
-
let x = mousePos.page.x;
|
|
26
|
+
let x = mousePos.page.x + cursorPaddingX; // Default to right side of the cursor
|
|
30
27
|
let y = mousePos.page.y + cursorPaddingY;
|
|
31
|
-
// If containerElement is defined,
|
|
32
|
-
let containerRect;
|
|
28
|
+
// If containerElement is defined, adjust coordinates relative to the container
|
|
33
29
|
if (containerElement) {
|
|
34
|
-
|
|
35
|
-
containerRect = containerElement.getBoundingClientRect();
|
|
36
|
-
// calculate the mouse position relative to container
|
|
30
|
+
const containerRect = containerElement.getBoundingClientRect();
|
|
37
31
|
x = x - containerRect.left + containerElement.scrollLeft;
|
|
38
32
|
y = y - containerRect.top + containerElement.scrollTop;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
// Ensure tooltip does not go out of the container's bottom
|
|
34
|
+
const containerBottom = containerRect.top + containerElement.scrollHeight;
|
|
35
|
+
if (y + tooltipHeight > containerBottom) {
|
|
36
|
+
y = Math.max(containerBottom - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// Ensure tooltip does not go out of the screen on the bottom
|
|
40
|
+
if (y + tooltipHeight > window.innerHeight + window.scrollY) {
|
|
41
|
+
y = Math.max(window.innerHeight + window.scrollY - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
// Ensure tooltip does not go out of the screen on the right
|
|
45
|
+
if (x + tooltipWidth > window.innerWidth) {
|
|
46
|
+
x = mousePos.page.x - tooltipWidth - cursorPaddingX; // Move to the left of the cursor
|
|
47
|
+
}
|
|
48
|
+
// Ensure tooltip does not go out of the screen on the left
|
|
49
|
+
if (x < cursorPaddingX) {
|
|
50
|
+
x = cursorPaddingX;
|
|
51
|
+
}
|
|
52
|
+
// Ensure tooltip does not go out of the screen on the top
|
|
53
|
+
if (y < TOOLTIP_PADDING / 2) {
|
|
54
|
+
y = TOOLTIP_PADDING / 2;
|
|
55
|
+
}
|
|
56
|
+
return `translate3d(${x}px, ${y}px, 0)`;
|
|
53
57
|
}
|
|
54
58
|
/**
|
|
55
59
|
* Helper for tooltip positioning styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport {\n CursorCoordinates,\n CursorData,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MIN_WIDTH,\n
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/utils.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport {\n CursorCoordinates,\n CursorData,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MIN_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_PADDING,\n} from './tooltip-model';\n\n/**\n * Determine position of tooltip depending on chart dimensions and the number of focused series\n */\nexport function assembleTransform(\n mousePos: CursorData['coords'],\n pinnedPos: CursorCoordinates | null,\n tooltipHeight: number,\n tooltipWidth: number,\n containerElement?: Element | null\n): string | undefined {\n if (mousePos === null) {\n return undefined;\n }\n\n const cursorPaddingX = 32;\n const cursorPaddingY = 16;\n\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n }\n\n if (mousePos.plotCanvas.x === undefined) return undefined;\n\n let x = mousePos.page.x + cursorPaddingX; // Default to right side of the cursor\n let y = mousePos.page.y + cursorPaddingY;\n\n // If containerElement is defined, adjust coordinates relative to the container\n if (containerElement) {\n const containerRect = containerElement.getBoundingClientRect();\n x = x - containerRect.left + containerElement.scrollLeft;\n y = y - containerRect.top + containerElement.scrollTop;\n\n // Ensure tooltip does not go out of the container's bottom\n const containerBottom = containerRect.top + containerElement.scrollHeight;\n if (y + tooltipHeight > containerBottom) {\n y = Math.max(containerBottom - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);\n }\n } else {\n // Ensure tooltip does not go out of the screen on the bottom\n if (y + tooltipHeight > window.innerHeight + window.scrollY) {\n y = Math.max(window.innerHeight + window.scrollY - tooltipHeight - cursorPaddingY, TOOLTIP_PADDING / 2);\n }\n }\n\n // Ensure tooltip does not go out of the screen on the right\n if (x + tooltipWidth > window.innerWidth) {\n x = mousePos.page.x - tooltipWidth - cursorPaddingX; // Move to the left of the cursor\n }\n\n // Ensure tooltip does not go out of the screen on the left\n if (x < cursorPaddingX) {\n x = cursorPaddingX;\n }\n\n // Ensure tooltip does not go out of the screen on the top\n if (y < TOOLTIP_PADDING / 2) {\n y = TOOLTIP_PADDING / 2;\n }\n\n return `translate3d(${x}px, ${y}px, 0)`;\n}\n\n/**\n * Helper for tooltip positioning styles\n */\nexport function getTooltipStyles(\n theme: Theme,\n pinnedPos: CursorCoordinates | null,\n maxHeight?: number\n): Record<string, unknown> {\n const adjustedMaxHeight = maxHeight ? maxHeight - TOOLTIP_PADDING : undefined;\n return {\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: adjustedMaxHeight ?? TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n };\n}\n"],"names":["TOOLTIP_MAX_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_MIN_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_PADDING","assembleTransform","mousePos","pinnedPos","tooltipHeight","tooltipWidth","containerElement","undefined","cursorPaddingX","cursorPaddingY","plotCanvas","x","page","y","containerRect","getBoundingClientRect","left","scrollLeft","top","scrollTop","containerBottom","scrollHeight","Math","max","window","innerHeight","scrollY","innerWidth","getTooltipStyles","theme","maxHeight","adjustedMaxHeight","minWidth","maxWidth","padding","position","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAGEA,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,EACjBC,yBAAyB,EACzBC,eAAe,QACV,kBAAkB;AAEzB;;CAEC,GACD,OAAO,SAASC,kBACdC,QAA8B,EAC9BC,SAAmC,EACnCC,aAAqB,EACrBC,YAAoB,EACpBC,gBAAiC;IAEjC,IAAIJ,aAAa,MAAM;QACrB,OAAOK;IACT;IAEA,MAAMC,iBAAiB;IACvB,MAAMC,iBAAiB;IAEvB,IAAIN,cAAc,MAAM;QACtBD,WAAWC;IACb;IAEA,IAAID,SAASQ,UAAU,CAACC,CAAC,KAAKJ,WAAW,OAAOA;IAEhD,IAAII,IAAIT,SAASU,IAAI,CAACD,CAAC,GAAGH,gBAAgB,sCAAsC;IAChF,IAAIK,IAAIX,SAASU,IAAI,CAACC,CAAC,GAAGJ;IAE1B,+EAA+E;IAC/E,IAAIH,kBAAkB;QACpB,MAAMQ,gBAAgBR,iBAAiBS,qBAAqB;QAC5DJ,IAAIA,IAAIG,cAAcE,IAAI,GAAGV,iBAAiBW,UAAU;QACxDJ,IAAIA,IAAIC,cAAcI,GAAG,GAAGZ,iBAAiBa,SAAS;QAEtD,2DAA2D;QAC3D,MAAMC,kBAAkBN,cAAcI,GAAG,GAAGZ,iBAAiBe,YAAY;QACzE,IAAIR,IAAIT,gBAAgBgB,iBAAiB;YACvCP,IAAIS,KAAKC,GAAG,CAACH,kBAAkBhB,gBAAgBK,gBAAgBT,kBAAkB;QACnF;IACF,OAAO;QACL,6DAA6D;QAC7D,IAAIa,IAAIT,gBAAgBoB,OAAOC,WAAW,GAAGD,OAAOE,OAAO,EAAE;YAC3Db,IAAIS,KAAKC,GAAG,CAACC,OAAOC,WAAW,GAAGD,OAAOE,OAAO,GAAGtB,gBAAgBK,gBAAgBT,kBAAkB;QACvG;IACF;IAEA,4DAA4D;IAC5D,IAAIW,IAAIN,eAAemB,OAAOG,UAAU,EAAE;QACxChB,IAAIT,SAASU,IAAI,CAACD,CAAC,GAAGN,eAAeG,gBAAgB,iCAAiC;IACxF;IAEA,2DAA2D;IAC3D,IAAIG,IAAIH,gBAAgB;QACtBG,IAAIH;IACN;IAEA,0DAA0D;IAC1D,IAAIK,IAAIb,kBAAkB,GAAG;QAC3Ba,IAAIb,kBAAkB;IACxB;IAEA,OAAO,CAAC,YAAY,EAAEW,EAAE,IAAI,EAAEE,EAAE,MAAM,CAAC;AACzC;AAEA;;CAEC,GACD,OAAO,SAASe,iBACdC,KAAY,EACZ1B,SAAmC,EACnC2B,SAAkB;IAElB,MAAMC,oBAAoBD,YAAYA,YAAY9B,kBAAkBO;IACpE,OAAO;QACLyB,UAAUlC;QACVmC,UAAUrC;QACVkC,WAAWC,qBAAqBlC;QAChCqC,SAAS;QACTC,UAAU;QACVjB,KAAK;QACLF,MAAM;QACNoB,iBAAiBP,MAAMQ,OAAO,CAACC,YAAY,EAAEC,IAAI,CAAC,IAAI,IAAIxC;QAC1DyC,cAAc;QACdC,OAAO;QACPC,UAAU;QACVC,YAAY;QACZC,SAAS;QACTC,YAAY;QACZ,yEAAyE;QACzEC,QAAQ3C,cAAc,OAAO,SAAS0B,MAAMiB,MAAM,CAACC,OAAO;QAC1DC,UAAU;QACV,WAAW;YACTC,WAAW;QACb;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TransformsEditor/TransformEditorContainer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Divider, IconButton, Stack, Tooltip, Typography } from '@mui/material';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport EyeOffIcon from 'mdi-material-ui/EyeOffOutline';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { Transform, TRANSFORM_TEXT } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { TransformEditor, TransformEditorProps } from './TransformEditor';\n\nexport interface TransformEditorContainerProps extends TransformEditorProps {\n index?: number;\n isCollapsed: boolean;\n onCollapse: (collapsed: boolean) => void;\n onDelete: () => void;\n}\n\nexport function TransformEditorContainer({\n index,\n value,\n isCollapsed,\n onChange,\n onCollapse,\n onDelete,\n ...props\n}: TransformEditorContainerProps): ReactElement {\n function handleTransformDisable(): void {\n onChange({ ...value, spec: { ...value.spec, disabled: !value.spec?.disabled } } as Transform);\n }\n\n return (\n <Stack {...props}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n justifyContent=\"space-between\"\n gap={4}\n >\n <Stack direction=\"row\" gap={1}>\n <IconButton data-testid={`transform-toggle#${index}`} size=\"small\" onClick={() => onCollapse(!isCollapsed)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\" sx={{ textTransform: 'none' }}>\n {value.kind ? (\n <span>\n <strong>{TRANSFORM_TEXT[value.kind]}</strong>\n </span>\n ) : (\n <strong>Select a transformation kind</strong>\n )}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" gap={1}>\n {isCollapsed && (\n <>\n <Tooltip\n title={value.spec?.disabled ? 'Enable transformation' : 'Disable transformation'}\n placement=\"top\"\n >\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={handleTransformDisable}>\n {value.spec?.disabled ? <EyeOffIcon /> : <EyeIcon />}\n </IconButton>\n </Tooltip>\n <Divider flexItem orientation=\"vertical\" variant=\"middle\" />\n </>\n )}\n <Tooltip title=\"Remove transformation\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Stack>\n </Stack>\n {!isCollapsed && <TransformEditor value={value} onChange={onChange} />}\n </Stack>\n );\n}\n"],"names":["Divider","IconButton","Stack","Tooltip","Typography","ChevronRight","ChevronDown","EyeOffIcon","EyeIcon","DeleteIcon","TRANSFORM_TEXT","TransformEditor","TransformEditorContainer","index","value","isCollapsed","onChange","onCollapse","onDelete","props","handleTransformDisable","spec","disabled","direction","alignItems","borderBottom","borderColor","theme","palette","divider","justifyContent","gap","data-testid","size","onClick","variant","component","sx","textTransform","kind","span","strong","title","placement","marginLeft","flexItem","orientation"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,UAAU,QAAQ,gBAAgB;AAChF,OAAOC,kBAAkB,+BAA+B;AACxD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,gBAAgB,gCAAgC;AACvD,SAAoBC,cAAc,QAAQ,mBAAmB;AAE7D,SAASC,eAAe,QAA8B,oBAAoB;AAS1E,OAAO,SAASC,yBAAyB,EACvCC,KAAK,EACLC,KAAK,EACLC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACR,GAAGC,OAC2B;IAC9B,SAASC;QACPJ,SAAS;YAAE,GAAGF,KAAK;YAAEO,MAAM;gBAAE,GAAGP,MAAMO,IAAI;gBAAEC,UAAU,CAACR,MAAMO,IAAI,EAAEC;YAAS;QAAE;IAChF;IAEA,qBACE,MAACpB;QAAO,GAAGiB,KAAK;;0BACd,MAACjB;gBACCqB,WAAU;gBACVC,YAAW;gBACXC,cAAc;gBACdC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;gBAC7CC,gBAAe;gBACfC,KAAK;;kCAEL,MAAC7B;wBAAMqB,WAAU;wBAAMQ,KAAK;;0CAC1B,KAAC9B;gCAAW+B,eAAa,CAAC,iBAAiB,EAAEnB,
|
|
1
|
+
{"version":3,"sources":["../../src/TransformsEditor/TransformEditorContainer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Divider, IconButton, Stack, Tooltip, Typography } from '@mui/material';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport EyeOffIcon from 'mdi-material-ui/EyeOffOutline';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { Transform, TRANSFORM_TEXT } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { TransformEditor, TransformEditorProps } from './TransformEditor';\n\nexport interface TransformEditorContainerProps extends TransformEditorProps {\n index?: number;\n isCollapsed: boolean;\n onCollapse: (collapsed: boolean) => void;\n onDelete: () => void;\n}\n\nexport function TransformEditorContainer({\n index,\n value,\n isCollapsed,\n onChange,\n onCollapse,\n onDelete,\n ...props\n}: TransformEditorContainerProps): ReactElement {\n function handleTransformDisable(): void {\n onChange({ ...value, spec: { ...value.spec, disabled: !value.spec?.disabled } } as Transform);\n }\n\n return (\n <Stack {...props}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n justifyContent=\"space-between\"\n gap={4}\n >\n <Stack direction=\"row\" gap={1}>\n <IconButton data-testid={`transform-toggle#${index}`} size=\"small\" onClick={() => onCollapse(!isCollapsed)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\" sx={{ textTransform: 'none' }}>\n {value.kind ? (\n <span>\n <strong>{TRANSFORM_TEXT[value.kind]}</strong>\n </span>\n ) : (\n <strong>Select a transformation kind</strong>\n )}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" gap={1}>\n {isCollapsed && (\n <>\n <Tooltip\n title={value.spec?.disabled ? 'Enable transformation' : 'Disable transformation'}\n placement=\"top\"\n >\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={handleTransformDisable}>\n {value.spec?.disabled ? <EyeOffIcon /> : <EyeIcon />}\n </IconButton>\n </Tooltip>\n <Divider flexItem orientation=\"vertical\" variant=\"middle\" />\n </>\n )}\n <Tooltip title=\"Remove transformation\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Stack>\n </Stack>\n {!isCollapsed && <TransformEditor value={value} onChange={onChange} />}\n </Stack>\n );\n}\n"],"names":["Divider","IconButton","Stack","Tooltip","Typography","ChevronRight","ChevronDown","EyeOffIcon","EyeIcon","DeleteIcon","TRANSFORM_TEXT","TransformEditor","TransformEditorContainer","index","value","isCollapsed","onChange","onCollapse","onDelete","props","handleTransformDisable","spec","disabled","direction","alignItems","borderBottom","borderColor","theme","palette","divider","justifyContent","gap","data-testid","size","onClick","variant","component","sx","textTransform","kind","span","strong","title","placement","marginLeft","flexItem","orientation"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,UAAU,QAAQ,gBAAgB;AAChF,OAAOC,kBAAkB,+BAA+B;AACxD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,gBAAgB,gCAAgC;AACvD,SAAoBC,cAAc,QAAQ,mBAAmB;AAE7D,SAASC,eAAe,QAA8B,oBAAoB;AAS1E,OAAO,SAASC,yBAAyB,EACvCC,KAAK,EACLC,KAAK,EACLC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACR,GAAGC,OAC2B;IAC9B,SAASC;QACPJ,SAAS;YAAE,GAAGF,KAAK;YAAEO,MAAM;gBAAE,GAAGP,MAAMO,IAAI;gBAAEC,UAAU,CAACR,MAAMO,IAAI,EAAEC;YAAS;QAAE;IAChF;IAEA,qBACE,MAACpB;QAAO,GAAGiB,KAAK;;0BACd,MAACjB;gBACCqB,WAAU;gBACVC,YAAW;gBACXC,cAAc;gBACdC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;gBAC7CC,gBAAe;gBACfC,KAAK;;kCAEL,MAAC7B;wBAAMqB,WAAU;wBAAMQ,KAAK;;0CAC1B,KAAC9B;gCAAW+B,eAAa,CAAC,iBAAiB,EAAEnB,OAAO;gCAAEoB,MAAK;gCAAQC,SAAS,IAAMjB,WAAW,CAACF;0CAC3FA,4BAAc,KAACV,kCAAkB,KAACC;;0CAErC,KAACF;gCAAW+B,SAAQ;gCAAWC,WAAU;gCAAKC,IAAI;oCAAEC,eAAe;gCAAO;0CACvExB,MAAMyB,IAAI,iBACT,KAACC;8CACC,cAAA,KAACC;kDAAQ/B,cAAc,CAACI,MAAMyB,IAAI,CAAC;;mDAGrC,KAACE;8CAAO;;;;;kCAKd,MAACvC;wBAAMqB,WAAU;wBAAMQ,KAAK;;4BACzBhB,6BACC;;kDACE,KAACZ;wCACCuC,OAAO5B,MAAMO,IAAI,EAAEC,WAAW,0BAA0B;wCACxDqB,WAAU;kDAEV,cAAA,KAAC1C;4CAAWgC,MAAK;4CAAQI,IAAI;gDAAEO,YAAY;4CAAO;4CAAGV,SAASd;sDAC3DN,MAAMO,IAAI,EAAEC,yBAAW,KAACf,gCAAgB,KAACC;;;kDAG9C,KAACR;wCAAQ6C,QAAQ;wCAACC,aAAY;wCAAWX,SAAQ;;;;0CAGrD,KAAChC;gCAAQuC,OAAM;gCAAwBC,WAAU;0CAC/C,cAAA,KAAC1C;oCAAWgC,MAAK;oCAAQI,IAAI;wCAAEO,YAAY;oCAAO;oCAAGV,SAAShB;8CAC5D,cAAA,KAACT;;;;;;;YAKR,CAACM,6BAAe,KAACJ;gBAAgBG,OAAOA;gBAAOE,UAAUA;;;;AAGhE"}
|
|
@@ -64,7 +64,7 @@ function handleMoveDown(element, elements) {
|
|
|
64
64
|
newElements.splice(index + 1, 0, element);
|
|
65
65
|
return newElements;
|
|
66
66
|
}
|
|
67
|
-
function DragButton({ onMoveUp, onMoveDown, onMoveLeft, onMoveRight, menuSx }) {
|
|
67
|
+
const DragButton = /*#__PURE__*/ (0, _react.forwardRef)(function DragButton({ onMoveUp, onMoveDown, onMoveLeft, onMoveRight, menuSx, ...otherProps }, ref) {
|
|
68
68
|
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
69
69
|
const open = Boolean(anchorEl);
|
|
70
70
|
function handleClick(event) {
|
|
@@ -77,6 +77,8 @@ function DragButton({ onMoveUp, onMoveDown, onMoveLeft, onMoveRight, menuSx }) {
|
|
|
77
77
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
78
78
|
children: [
|
|
79
79
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
80
|
+
...otherProps,
|
|
81
|
+
ref: ref,
|
|
80
82
|
"aria-label": "move",
|
|
81
83
|
"aria-haspopup": true,
|
|
82
84
|
"aria-expanded": open,
|
|
@@ -118,4 +120,4 @@ function DragButton({ onMoveUp, onMoveDown, onMoveLeft, onMoveRight, menuSx }) {
|
|
|
118
120
|
})
|
|
119
121
|
]
|
|
120
122
|
});
|
|
121
|
-
}
|
|
123
|
+
});
|