@perses-dev/components 0.53.0-rc.0 → 0.53.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (534) hide show
  1. package/dist/AlignSelector/AlignSelector.js +1 -1
  2. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  3. package/dist/AlignSelector/index.js +1 -1
  4. package/dist/AlignSelector/index.js.map +1 -1
  5. package/dist/ColorPicker/ColorPicker.js +1 -1
  6. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  7. package/dist/ColorPicker/OptionsColorPicker.js +1 -1
  8. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  9. package/dist/ColorPicker/index.js +1 -1
  10. package/dist/ColorPicker/index.js.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.js +1 -1
  12. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  13. package/dist/ContentWithLegend/index.js +1 -1
  14. package/dist/ContentWithLegend/index.js.map +1 -1
  15. package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
  16. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  17. package/dist/DensitySelector/DensitySelector.js +1 -1
  18. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  19. package/dist/DensitySelector/index.js +1 -1
  20. package/dist/DensitySelector/index.js.map +1 -1
  21. package/dist/Dialog/Dialog.js +1 -1
  22. package/dist/Dialog/Dialog.js.map +1 -1
  23. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  24. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  25. package/dist/Dialog/index.js +1 -1
  26. package/dist/Dialog/index.js.map +1 -1
  27. package/dist/DragAndDrop/DragAndDropList.js +1 -1
  28. package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
  29. package/dist/DragAndDrop/DragButton.js +1 -1
  30. package/dist/DragAndDrop/DragButton.js.map +1 -1
  31. package/dist/DragAndDrop/DropIndicator.js +1 -1
  32. package/dist/DragAndDrop/DropIndicator.js.map +1 -1
  33. package/dist/DragAndDrop/index.js +1 -1
  34. package/dist/DragAndDrop/index.js.map +1 -1
  35. package/dist/DragAndDrop/model.js +1 -1
  36. package/dist/DragAndDrop/model.js.map +1 -1
  37. package/dist/Drawer/Drawer.js +1 -1
  38. package/dist/Drawer/Drawer.js.map +1 -1
  39. package/dist/Drawer/index.js +1 -1
  40. package/dist/Drawer/index.js.map +1 -1
  41. package/dist/EChart/EChart.js +1 -1
  42. package/dist/EChart/EChart.js.map +1 -1
  43. package/dist/EChart/index.js +1 -1
  44. package/dist/EChart/index.js.map +1 -1
  45. package/dist/ErrorAlert.js +1 -1
  46. package/dist/ErrorAlert.js.map +1 -1
  47. package/dist/ErrorBoundary.js +1 -1
  48. package/dist/ErrorBoundary.js.map +1 -1
  49. package/dist/FontSizeSelector/FontSizeSelector.js +1 -1
  50. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  51. package/dist/FontSizeSelector/index.js +1 -1
  52. package/dist/FontSizeSelector/index.js.map +1 -1
  53. package/dist/FormEditor/FormActions.js +1 -1
  54. package/dist/FormEditor/FormActions.js.map +1 -1
  55. package/dist/FormEditor/index.js +1 -1
  56. package/dist/FormEditor/index.js.map +1 -1
  57. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  58. package/dist/FormatControls/FormatControls.js +10 -23
  59. package/dist/FormatControls/FormatControls.js.map +1 -1
  60. package/dist/FormatControls/UnitSelector.d.ts +9 -0
  61. package/dist/FormatControls/UnitSelector.d.ts.map +1 -0
  62. package/dist/FormatControls/UnitSelector.js +47 -0
  63. package/dist/FormatControls/UnitSelector.js.map +1 -0
  64. package/dist/FormatControls/index.d.ts +1 -0
  65. package/dist/FormatControls/index.d.ts.map +1 -1
  66. package/dist/FormatControls/index.js +2 -1
  67. package/dist/FormatControls/index.js.map +1 -1
  68. package/dist/InfoTooltip/InfoTooltip.js +1 -1
  69. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  70. package/dist/InfoTooltip/index.js +1 -1
  71. package/dist/InfoTooltip/index.js.map +1 -1
  72. package/dist/JSONEditor.js +1 -1
  73. package/dist/JSONEditor.js.map +1 -1
  74. package/dist/Legend/CompactLegend.js +1 -1
  75. package/dist/Legend/CompactLegend.js.map +1 -1
  76. package/dist/Legend/Legend.js +1 -1
  77. package/dist/Legend/Legend.js.map +1 -1
  78. package/dist/Legend/LegendColorBadge.js +1 -1
  79. package/dist/Legend/LegendColorBadge.js.map +1 -1
  80. package/dist/Legend/ListLegend.js +1 -1
  81. package/dist/Legend/ListLegend.js.map +1 -1
  82. package/dist/Legend/ListLegendItem.js +1 -1
  83. package/dist/Legend/ListLegendItem.js.map +1 -1
  84. package/dist/Legend/TableLegend.js +1 -1
  85. package/dist/Legend/TableLegend.js.map +1 -1
  86. package/dist/Legend/index.js +1 -1
  87. package/dist/Legend/index.js.map +1 -1
  88. package/dist/Legend/legend-model.js +1 -1
  89. package/dist/Legend/legend-model.js.map +1 -1
  90. package/dist/LinksEditor/LinkEditorForm.js +1 -1
  91. package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
  92. package/dist/LinksEditor/LinksEditor.js +1 -1
  93. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  94. package/dist/LinksEditor/index.js +1 -1
  95. package/dist/LinksEditor/index.js.map +1 -1
  96. package/dist/ModeSelector/ModeSelector.js +1 -1
  97. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  98. package/dist/ModeSelector/index.js +1 -1
  99. package/dist/ModeSelector/index.js.map +1 -1
  100. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  101. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  102. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  103. package/dist/OptionsEditorLayout/OptionsEditorControl.js +5 -2
  104. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  105. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  106. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  107. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  108. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  109. package/dist/OptionsEditorLayout/index.js +1 -1
  110. package/dist/OptionsEditorLayout/index.js.map +1 -1
  111. package/dist/Overlay/Overlay.js +1 -1
  112. package/dist/Overlay/Overlay.js.map +1 -1
  113. package/dist/Overlay/index.js +1 -1
  114. package/dist/Overlay/index.js.map +1 -1
  115. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  116. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  117. package/dist/RefreshIntervalPicker/index.js +1 -1
  118. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  119. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
  120. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  121. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +16 -3
  122. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  123. package/dist/SettingsAutocomplete/index.js +1 -1
  124. package/dist/SettingsAutocomplete/index.js.map +1 -1
  125. package/dist/SortSelector/SortSelector.js +1 -1
  126. package/dist/SortSelector/SortSelector.js.map +1 -1
  127. package/dist/SortSelector/SortSelectorButtons.js +1 -1
  128. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  129. package/dist/SortSelector/index.js +1 -1
  130. package/dist/SortSelector/index.js.map +1 -1
  131. package/dist/Table/InnerTable.js +1 -1
  132. package/dist/Table/InnerTable.js.map +1 -1
  133. package/dist/Table/Table.d.ts +1 -1
  134. package/dist/Table/Table.d.ts.map +1 -1
  135. package/dist/Table/Table.js +31 -7
  136. package/dist/Table/Table.js.map +1 -1
  137. package/dist/Table/TableBody.js +1 -1
  138. package/dist/Table/TableBody.js.map +1 -1
  139. package/dist/Table/TableCell.d.ts +4 -2
  140. package/dist/Table/TableCell.d.ts.map +1 -1
  141. package/dist/Table/TableCell.js +27 -5
  142. package/dist/Table/TableCell.js.map +1 -1
  143. package/dist/Table/TableCheckbox.js +1 -1
  144. package/dist/Table/TableCheckbox.js.map +1 -1
  145. package/dist/Table/TableFoot.js +1 -1
  146. package/dist/Table/TableFoot.js.map +1 -1
  147. package/dist/Table/TableHead.js +1 -1
  148. package/dist/Table/TableHead.js.map +1 -1
  149. package/dist/Table/TableHeaderCell.js +1 -1
  150. package/dist/Table/TableHeaderCell.js.map +1 -1
  151. package/dist/Table/TableRow.js +1 -1
  152. package/dist/Table/TableRow.js.map +1 -1
  153. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  154. package/dist/Table/VirtualizedTable.js +19 -3
  155. package/dist/Table/VirtualizedTable.js.map +1 -1
  156. package/dist/Table/VirtualizedTableContainer.js +1 -1
  157. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  158. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  159. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  160. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
  161. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  162. package/dist/Table/index.js +1 -1
  163. package/dist/Table/index.js.map +1 -1
  164. package/dist/Table/model/table-model.d.ts +16 -6
  165. package/dist/Table/model/table-model.d.ts.map +1 -1
  166. package/dist/Table/model/table-model.js +4 -3
  167. package/dist/Table/model/table-model.js.map +1 -1
  168. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  169. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  170. package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
  171. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  172. package/dist/ThresholdsEditor/index.js +1 -1
  173. package/dist/ThresholdsEditor/index.js.map +1 -1
  174. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -1
  175. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  176. package/dist/TimeRangeSelector/DateTimeRangePicker.js +21 -33
  177. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  178. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +6 -1
  179. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  180. package/dist/TimeRangeSelector/TimeRangeSelector.js +140 -19
  181. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  182. package/dist/TimeRangeSelector/index.js +1 -1
  183. package/dist/TimeRangeSelector/index.js.map +1 -1
  184. package/dist/TimeRangeSelector/utils.js +1 -1
  185. package/dist/TimeRangeSelector/utils.js.map +1 -1
  186. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
  187. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  188. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  189. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  190. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  191. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  192. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +4 -0
  193. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  194. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +3 -2
  195. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  196. package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
  197. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  198. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  199. package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -3
  200. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  201. package/dist/TimeSeriesTooltip/index.js +1 -1
  202. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  203. package/dist/TimeSeriesTooltip/nearby-series.d.ts +3 -14
  204. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  205. package/dist/TimeSeriesTooltip/nearby-series.js +80 -58
  206. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  207. package/dist/TimeSeriesTooltip/tooltip-model.js +1 -1
  208. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  209. package/dist/TimeSeriesTooltip/utils.js +1 -1
  210. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  211. package/dist/TimeZoneSelector.d.ts +16 -0
  212. package/dist/TimeZoneSelector.d.ts.map +1 -0
  213. package/dist/TimeZoneSelector.js +58 -0
  214. package/dist/TimeZoneSelector.js.map +1 -0
  215. package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
  216. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  217. package/dist/ToolbarIconButton/index.js +1 -1
  218. package/dist/ToolbarIconButton/index.js.map +1 -1
  219. package/dist/TransformsEditor/TransformEditor.js +1 -1
  220. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  221. package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
  222. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  223. package/dist/TransformsEditor/TransformsEditor.js +1 -1
  224. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  225. package/dist/TransformsEditor/index.js +1 -1
  226. package/dist/TransformsEditor/index.js.map +1 -1
  227. package/dist/ValueMappingEditor/ValueMappingEditor.js +1 -1
  228. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
  229. package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
  230. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
  231. package/dist/ValueMappingEditor/index.js +1 -1
  232. package/dist/ValueMappingEditor/index.js.map +1 -1
  233. package/dist/YAxisLabel.js +1 -1
  234. package/dist/YAxisLabel.js.map +1 -1
  235. package/dist/cjs/AlignSelector/AlignSelector.js +1 -1
  236. package/dist/cjs/AlignSelector/index.js +1 -1
  237. package/dist/cjs/ColorPicker/ColorPicker.js +1 -1
  238. package/dist/cjs/ColorPicker/OptionsColorPicker.js +1 -1
  239. package/dist/cjs/ColorPicker/index.js +1 -1
  240. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +1 -1
  241. package/dist/cjs/ContentWithLegend/index.js +1 -1
  242. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +1 -1
  243. package/dist/cjs/DensitySelector/DensitySelector.js +1 -1
  244. package/dist/cjs/DensitySelector/index.js +1 -1
  245. package/dist/cjs/Dialog/Dialog.js +1 -1
  246. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  247. package/dist/cjs/Dialog/index.js +1 -1
  248. package/dist/cjs/DragAndDrop/DragAndDropList.js +1 -1
  249. package/dist/cjs/DragAndDrop/DragButton.js +1 -1
  250. package/dist/cjs/DragAndDrop/DropIndicator.js +1 -1
  251. package/dist/cjs/DragAndDrop/index.js +1 -1
  252. package/dist/cjs/DragAndDrop/model.js +1 -1
  253. package/dist/cjs/Drawer/Drawer.js +1 -1
  254. package/dist/cjs/Drawer/index.js +1 -1
  255. package/dist/cjs/EChart/EChart.js +1 -1
  256. package/dist/cjs/EChart/index.js +1 -1
  257. package/dist/cjs/ErrorAlert.js +1 -1
  258. package/dist/cjs/ErrorBoundary.js +1 -1
  259. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +1 -1
  260. package/dist/cjs/FontSizeSelector/index.js +1 -1
  261. package/dist/cjs/FormEditor/FormActions.js +1 -1
  262. package/dist/cjs/FormEditor/index.js +1 -1
  263. package/dist/cjs/FormatControls/FormatControls.js +9 -22
  264. package/dist/cjs/FormatControls/UnitSelector.js +55 -0
  265. package/dist/cjs/FormatControls/index.js +2 -1
  266. package/dist/cjs/InfoTooltip/InfoTooltip.js +1 -1
  267. package/dist/cjs/InfoTooltip/index.js +1 -1
  268. package/dist/cjs/JSONEditor.js +1 -1
  269. package/dist/cjs/Legend/CompactLegend.js +1 -1
  270. package/dist/cjs/Legend/Legend.js +1 -1
  271. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  272. package/dist/cjs/Legend/ListLegend.js +1 -1
  273. package/dist/cjs/Legend/ListLegendItem.js +1 -1
  274. package/dist/cjs/Legend/TableLegend.js +1 -1
  275. package/dist/cjs/Legend/index.js +1 -1
  276. package/dist/cjs/Legend/legend-model.js +1 -1
  277. package/dist/cjs/LinksEditor/LinkEditorForm.js +1 -1
  278. package/dist/cjs/LinksEditor/LinksEditor.js +1 -1
  279. package/dist/cjs/LinksEditor/index.js +1 -1
  280. package/dist/cjs/ModeSelector/ModeSelector.js +1 -1
  281. package/dist/cjs/ModeSelector/index.js +1 -1
  282. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  283. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +5 -2
  284. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  285. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  286. package/dist/cjs/OptionsEditorLayout/index.js +1 -1
  287. package/dist/cjs/Overlay/Overlay.js +1 -1
  288. package/dist/cjs/Overlay/index.js +1 -1
  289. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  290. package/dist/cjs/RefreshIntervalPicker/index.js +1 -1
  291. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +16 -3
  292. package/dist/cjs/SettingsAutocomplete/index.js +1 -1
  293. package/dist/cjs/SortSelector/SortSelector.js +1 -1
  294. package/dist/cjs/SortSelector/SortSelectorButtons.js +1 -1
  295. package/dist/cjs/SortSelector/index.js +1 -1
  296. package/dist/cjs/Table/InnerTable.js +1 -1
  297. package/dist/cjs/Table/Table.js +29 -5
  298. package/dist/cjs/Table/TableBody.js +1 -1
  299. package/dist/cjs/Table/TableCell.js +25 -3
  300. package/dist/cjs/Table/TableCheckbox.js +1 -1
  301. package/dist/cjs/Table/TableFoot.js +1 -1
  302. package/dist/cjs/Table/TableHead.js +1 -1
  303. package/dist/cjs/Table/TableHeaderCell.js +1 -1
  304. package/dist/cjs/Table/TableRow.js +1 -1
  305. package/dist/cjs/Table/VirtualizedTable.js +19 -3
  306. package/dist/cjs/Table/VirtualizedTableContainer.js +1 -1
  307. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  308. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
  309. package/dist/cjs/Table/index.js +1 -1
  310. package/dist/cjs/Table/model/table-model.js +4 -3
  311. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +1 -1
  312. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +1 -1
  313. package/dist/cjs/ThresholdsEditor/index.js +1 -1
  314. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +20 -32
  315. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +139 -18
  316. package/dist/cjs/TimeRangeSelector/index.js +1 -1
  317. package/dist/cjs/TimeRangeSelector/utils.js +1 -1
  318. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -1
  319. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  320. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +1 -1
  321. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +3 -2
  322. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +1 -1
  323. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -3
  324. package/dist/cjs/TimeSeriesTooltip/index.js +1 -1
  325. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +80 -58
  326. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +1 -1
  327. package/dist/cjs/TimeSeriesTooltip/utils.js +1 -1
  328. package/dist/cjs/TimeZoneSelector.js +63 -0
  329. package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +1 -1
  330. package/dist/cjs/ToolbarIconButton/index.js +1 -1
  331. package/dist/cjs/TransformsEditor/TransformEditor.js +1 -1
  332. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +1 -1
  333. package/dist/cjs/TransformsEditor/TransformsEditor.js +1 -1
  334. package/dist/cjs/TransformsEditor/index.js +1 -1
  335. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +1 -1
  336. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +1 -1
  337. package/dist/cjs/ValueMappingEditor/index.js +1 -1
  338. package/dist/cjs/YAxisLabel.js +1 -1
  339. package/dist/cjs/context/ChartsProvider.js +1 -1
  340. package/dist/cjs/context/ItemActionsProvider.js +111 -0
  341. package/dist/cjs/context/SelectionProvider.js +128 -0
  342. package/dist/cjs/context/SnackbarProvider.js +1 -1
  343. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  344. package/dist/cjs/context/index.js +3 -1
  345. package/dist/cjs/controls/TextField.js +1 -1
  346. package/dist/cjs/controls/index.js +1 -1
  347. package/dist/cjs/index.js +2 -1
  348. package/dist/cjs/model/graph.js +1 -1
  349. package/dist/cjs/model/index.js +2 -1
  350. package/dist/cjs/model/theme.js +1 -1
  351. package/dist/cjs/model/timeOption.js +1 -1
  352. package/dist/cjs/model/timeZoneOption.js +34 -0
  353. package/dist/cjs/test/index.js +1 -1
  354. package/dist/cjs/test/render.js +1 -1
  355. package/dist/cjs/test/setup-tests.js +1 -1
  356. package/dist/cjs/test-utils/index.js +1 -1
  357. package/dist/cjs/test-utils/theme.js +1 -1
  358. package/dist/cjs/theme/component-overrides/alert.js +1 -1
  359. package/dist/cjs/theme/component-overrides/paper.js +1 -1
  360. package/dist/cjs/theme/index.js +1 -1
  361. package/dist/cjs/theme/palette/background.js +1 -1
  362. package/dist/cjs/theme/palette/colors/blue.js +1 -1
  363. package/dist/cjs/theme/palette/colors/common.js +1 -1
  364. package/dist/cjs/theme/palette/colors/green.js +1 -1
  365. package/dist/cjs/theme/palette/colors/grey.js +1 -1
  366. package/dist/cjs/theme/palette/colors/index.js +1 -1
  367. package/dist/cjs/theme/palette/colors/orange.js +1 -1
  368. package/dist/cjs/theme/palette/colors/purple.js +1 -1
  369. package/dist/cjs/theme/palette/colors/red.js +1 -1
  370. package/dist/cjs/theme/palette/colors/types.js +1 -1
  371. package/dist/cjs/theme/palette/error.js +1 -1
  372. package/dist/cjs/theme/palette/grey.js +1 -1
  373. package/dist/cjs/theme/palette/index.js +1 -1
  374. package/dist/cjs/theme/palette/palette-options.js +1 -1
  375. package/dist/cjs/theme/palette/primary.js +1 -1
  376. package/dist/cjs/theme/palette/secondary.js +1 -1
  377. package/dist/cjs/theme/palette/success.js +1 -1
  378. package/dist/cjs/theme/palette/text.js +1 -1
  379. package/dist/cjs/theme/palette/warning.js +1 -1
  380. package/dist/cjs/theme/theme.js +1 -1
  381. package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
  382. package/dist/cjs/theme/typography.js +1 -1
  383. package/dist/cjs/utils/axis.js +80 -5
  384. package/dist/cjs/utils/browser-storage.js +1 -1
  385. package/dist/cjs/utils/chart-actions.js +1 -1
  386. package/dist/cjs/utils/combine-sx.js +1 -1
  387. package/dist/cjs/utils/component-ids.js +1 -1
  388. package/dist/cjs/utils/data-field-interpolation.js +230 -0
  389. package/dist/cjs/utils/format.js +1 -1
  390. package/dist/cjs/utils/index.js +5 -2
  391. package/dist/cjs/utils/mathjs.js +1 -1
  392. package/dist/cjs/utils/memo.js +1 -1
  393. package/dist/cjs/utils/selection-interpolation.js +69 -0
  394. package/dist/cjs/utils/theme-gen.js +1 -1
  395. package/dist/cjs/utils/variable-interpolation.js +192 -0
  396. package/dist/context/ChartsProvider.js +1 -1
  397. package/dist/context/ChartsProvider.js.map +1 -1
  398. package/dist/context/ItemActionsProvider.d.ts +25 -0
  399. package/dist/context/ItemActionsProvider.d.ts.map +1 -0
  400. package/dist/context/ItemActionsProvider.js +95 -0
  401. package/dist/context/ItemActionsProvider.js.map +1 -0
  402. package/dist/context/SelectionProvider.d.ts +34 -0
  403. package/dist/context/SelectionProvider.d.ts.map +1 -0
  404. package/dist/context/SelectionProvider.js +120 -0
  405. package/dist/context/SelectionProvider.js.map +1 -0
  406. package/dist/context/SnackbarProvider.js +1 -1
  407. package/dist/context/SnackbarProvider.js.map +1 -1
  408. package/dist/context/TimeZoneProvider.js +1 -1
  409. package/dist/context/TimeZoneProvider.js.map +1 -1
  410. package/dist/context/index.d.ts +2 -0
  411. package/dist/context/index.d.ts.map +1 -1
  412. package/dist/context/index.js +3 -1
  413. package/dist/context/index.js.map +1 -1
  414. package/dist/controls/TextField.js +1 -1
  415. package/dist/controls/TextField.js.map +1 -1
  416. package/dist/controls/index.js +1 -1
  417. package/dist/controls/index.js.map +1 -1
  418. package/dist/index.d.ts +1 -0
  419. package/dist/index.d.ts.map +1 -1
  420. package/dist/index.js +2 -1
  421. package/dist/index.js.map +1 -1
  422. package/dist/model/graph.js +1 -1
  423. package/dist/model/graph.js.map +1 -1
  424. package/dist/model/index.d.ts +1 -0
  425. package/dist/model/index.d.ts.map +1 -1
  426. package/dist/model/index.js +2 -1
  427. package/dist/model/index.js.map +1 -1
  428. package/dist/model/theme.d.ts +1 -0
  429. package/dist/model/theme.d.ts.map +1 -1
  430. package/dist/model/theme.js +1 -1
  431. package/dist/model/theme.js.map +1 -1
  432. package/dist/model/timeOption.js +1 -1
  433. package/dist/model/timeOption.js.map +1 -1
  434. package/dist/model/timeZoneOption.d.ts +10 -0
  435. package/dist/model/timeZoneOption.d.ts.map +1 -0
  436. package/dist/model/timeZoneOption.js +29 -0
  437. package/dist/model/timeZoneOption.js.map +1 -0
  438. package/dist/test/index.js +1 -1
  439. package/dist/test/index.js.map +1 -1
  440. package/dist/test/render.js +1 -1
  441. package/dist/test/render.js.map +1 -1
  442. package/dist/test/setup-tests.js +1 -1
  443. package/dist/test/setup-tests.js.map +1 -1
  444. package/dist/test-utils/index.js +1 -1
  445. package/dist/test-utils/index.js.map +1 -1
  446. package/dist/test-utils/theme.js +1 -1
  447. package/dist/test-utils/theme.js.map +1 -1
  448. package/dist/theme/component-overrides/alert.js +1 -1
  449. package/dist/theme/component-overrides/alert.js.map +1 -1
  450. package/dist/theme/component-overrides/paper.js +1 -1
  451. package/dist/theme/component-overrides/paper.js.map +1 -1
  452. package/dist/theme/index.js +1 -1
  453. package/dist/theme/index.js.map +1 -1
  454. package/dist/theme/palette/background.js +1 -1
  455. package/dist/theme/palette/background.js.map +1 -1
  456. package/dist/theme/palette/colors/blue.js +1 -1
  457. package/dist/theme/palette/colors/blue.js.map +1 -1
  458. package/dist/theme/palette/colors/common.js +1 -1
  459. package/dist/theme/palette/colors/common.js.map +1 -1
  460. package/dist/theme/palette/colors/green.js +1 -1
  461. package/dist/theme/palette/colors/green.js.map +1 -1
  462. package/dist/theme/palette/colors/grey.js +1 -1
  463. package/dist/theme/palette/colors/grey.js.map +1 -1
  464. package/dist/theme/palette/colors/index.js +1 -1
  465. package/dist/theme/palette/colors/index.js.map +1 -1
  466. package/dist/theme/palette/colors/orange.js +1 -1
  467. package/dist/theme/palette/colors/orange.js.map +1 -1
  468. package/dist/theme/palette/colors/purple.js +1 -1
  469. package/dist/theme/palette/colors/purple.js.map +1 -1
  470. package/dist/theme/palette/colors/red.js +1 -1
  471. package/dist/theme/palette/colors/red.js.map +1 -1
  472. package/dist/theme/palette/colors/types.js +1 -1
  473. package/dist/theme/palette/colors/types.js.map +1 -1
  474. package/dist/theme/palette/error.js +1 -1
  475. package/dist/theme/palette/error.js.map +1 -1
  476. package/dist/theme/palette/grey.js +1 -1
  477. package/dist/theme/palette/grey.js.map +1 -1
  478. package/dist/theme/palette/index.js +1 -1
  479. package/dist/theme/palette/index.js.map +1 -1
  480. package/dist/theme/palette/palette-options.js +1 -1
  481. package/dist/theme/palette/palette-options.js.map +1 -1
  482. package/dist/theme/palette/primary.js +1 -1
  483. package/dist/theme/palette/primary.js.map +1 -1
  484. package/dist/theme/palette/secondary.js +1 -1
  485. package/dist/theme/palette/secondary.js.map +1 -1
  486. package/dist/theme/palette/success.js +1 -1
  487. package/dist/theme/palette/success.js.map +1 -1
  488. package/dist/theme/palette/text.js +1 -1
  489. package/dist/theme/palette/text.js.map +1 -1
  490. package/dist/theme/palette/warning.js +1 -1
  491. package/dist/theme/palette/warning.js.map +1 -1
  492. package/dist/theme/theme.js +1 -1
  493. package/dist/theme/theme.js.map +1 -1
  494. package/dist/theme/types/ThemeExtension.d.js +1 -1
  495. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  496. package/dist/theme/typography.js +1 -1
  497. package/dist/theme/typography.js.map +1 -1
  498. package/dist/utils/axis.d.ts +18 -0
  499. package/dist/utils/axis.d.ts.map +1 -1
  500. package/dist/utils/axis.js +79 -3
  501. package/dist/utils/axis.js.map +1 -1
  502. package/dist/utils/browser-storage.js +1 -1
  503. package/dist/utils/browser-storage.js.map +1 -1
  504. package/dist/utils/chart-actions.js +1 -1
  505. package/dist/utils/chart-actions.js.map +1 -1
  506. package/dist/utils/combine-sx.js +1 -1
  507. package/dist/utils/combine-sx.js.map +1 -1
  508. package/dist/utils/component-ids.js +1 -1
  509. package/dist/utils/component-ids.js.map +1 -1
  510. package/dist/utils/data-field-interpolation.d.ts +84 -0
  511. package/dist/utils/data-field-interpolation.d.ts.map +1 -0
  512. package/dist/utils/data-field-interpolation.js +239 -0
  513. package/dist/utils/data-field-interpolation.js.map +1 -0
  514. package/dist/utils/format.js +1 -1
  515. package/dist/utils/format.js.map +1 -1
  516. package/dist/utils/index.d.ts +4 -1
  517. package/dist/utils/index.d.ts.map +1 -1
  518. package/dist/utils/index.js +5 -2
  519. package/dist/utils/index.js.map +1 -1
  520. package/dist/utils/mathjs.js +1 -1
  521. package/dist/utils/mathjs.js.map +1 -1
  522. package/dist/utils/memo.js +1 -1
  523. package/dist/utils/memo.js.map +1 -1
  524. package/dist/utils/selection-interpolation.d.ts +32 -0
  525. package/dist/utils/selection-interpolation.d.ts.map +1 -0
  526. package/dist/utils/selection-interpolation.js +77 -0
  527. package/dist/utils/selection-interpolation.js.map +1 -0
  528. package/dist/utils/theme-gen.js +1 -1
  529. package/dist/utils/theme-gen.js.map +1 -1
  530. package/dist/utils/variable-interpolation.d.ts +71 -0
  531. package/dist/utils/variable-interpolation.d.ts.map +1 -0
  532. package/dist/utils/variable-interpolation.js +176 -0
  533. package/dist/utils/variable-interpolation.js.map +1 -0
  534. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeRangeSelector/utils.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange, isRelativeTimeRange, TimeRangeValue } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\nexport const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';\n\nexport interface CustomTimeOption {\n value: TimeRangeValue | undefined;\n display: string;\n}\n\nexport function buildCustomTimeOption(value: AbsoluteTimeRange | undefined, timeZone: string): CustomTimeOption {\n return { value, display: formatTimeRange(value, timeZone) };\n}\n\n/**\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date): boolean {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n * @param timeRange absolute time range with a start and end datetime\n * @param dateFormat date format string\n * @param timeZone\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string): string {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n\n/**\n * Format the time range for display purpose only (e.g. in the selector)\n * @param value\n * @param timeZone\n */\nexport function formatTimeRange(value: TimeRangeValue | undefined, timeZone: string): string {\n if (!value) {\n return 'Custom Time Range';\n }\n return !isRelativeTimeRange(value) ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;\n}\n"],"names":["isBefore","isValid","isRelativeTimeRange","formatWithTimeZone","DATE_TIME_FORMAT","buildCustomTimeOption","value","timeZone","display","formatTimeRange","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","formattedStart","start","formattedEnd","end","pastDuration"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAC7C,SAA4BC,mBAAmB,QAAwB,mBAAmB;AAC1F,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,OAAO,MAAMC,mBAAmB,sBAAsB;AAOtD,OAAO,SAASC,sBAAsBC,KAAoC,EAAEC,QAAgB;IAC1F,OAAO;QAAED;QAAOE,SAASC,gBAAgBH,OAAOC;IAAU;AAC5D;AAEA;;CAEC,GACD,OAAO,SAASG,kBAAkBC,SAAe,EAAEC,OAAa;IAC9D,oCAAoC;IACpC,IAAI,CAACX,QAAQU,cAAc,CAACV,QAAQW,UAAU;QAC5CC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,IAAI,CAACd,SAASW,WAAWC,UAAU;QACjCC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,OAAO;AACT;AAEA;;;;;CAKC,GACD,OAAO,SAASC,oBAAoBC,SAA4B,EAAEC,UAAkB,EAAEV,QAAiB;IACrG,MAAMW,iBAAiBf,mBAAmBa,UAAUG,KAAK,EAAEF,YAAYV;IACvE,MAAMa,eAAejB,mBAAmBa,UAAUK,GAAG,EAAEJ,YAAYV;IACnE,OAAO,GAAGW,eAAe,GAAG,EAAEE,cAAc;AAC9C;AAEA;;;;CAIC,GACD,OAAO,SAASX,gBAAgBH,KAAiC,EAAEC,QAAgB;IACjF,IAAI,CAACD,OAAO;QACV,OAAO;IACT;IACA,OAAO,CAACJ,oBAAoBI,SAASS,oBAAoBT,OAAOF,kBAAkBG,YAAYD,MAAMgB,YAAY;AAClH"}
1
+ {"version":3,"sources":["../../src/TimeRangeSelector/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange, isRelativeTimeRange, TimeRangeValue } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\nexport const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';\n\nexport interface CustomTimeOption {\n value: TimeRangeValue | undefined;\n display: string;\n}\n\nexport function buildCustomTimeOption(value: AbsoluteTimeRange | undefined, timeZone: string): CustomTimeOption {\n return { value, display: formatTimeRange(value, timeZone) };\n}\n\n/**\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date): boolean {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n * @param timeRange absolute time range with a start and end datetime\n * @param dateFormat date format string\n * @param timeZone\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string): string {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n\n/**\n * Format the time range for display purpose only (e.g. in the selector)\n * @param value\n * @param timeZone\n */\nexport function formatTimeRange(value: TimeRangeValue | undefined, timeZone: string): string {\n if (!value) {\n return 'Custom Time Range';\n }\n return !isRelativeTimeRange(value) ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone) : value.pastDuration;\n}\n"],"names":["isBefore","isValid","isRelativeTimeRange","formatWithTimeZone","DATE_TIME_FORMAT","buildCustomTimeOption","value","timeZone","display","formatTimeRange","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","formattedStart","start","formattedEnd","end","pastDuration"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAC7C,SAA4BC,mBAAmB,QAAwB,mBAAmB;AAC1F,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,OAAO,MAAMC,mBAAmB,sBAAsB;AAOtD,OAAO,SAASC,sBAAsBC,KAAoC,EAAEC,QAAgB;IAC1F,OAAO;QAAED;QAAOE,SAASC,gBAAgBH,OAAOC;IAAU;AAC5D;AAEA;;CAEC,GACD,OAAO,SAASG,kBAAkBC,SAAe,EAAEC,OAAa;IAC9D,oCAAoC;IACpC,IAAI,CAACX,QAAQU,cAAc,CAACV,QAAQW,UAAU;QAC5CC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,IAAI,CAACd,SAASW,WAAWC,UAAU;QACjCC,QAAQC,KAAK,CAAC;QACd,OAAO;IACT;IACA,OAAO;AACT;AAEA;;;;;CAKC,GACD,OAAO,SAASC,oBAAoBC,SAA4B,EAAEC,UAAkB,EAAEV,QAAiB;IACrG,MAAMW,iBAAiBf,mBAAmBa,UAAUG,KAAK,EAAEF,YAAYV;IACvE,MAAMa,eAAejB,mBAAmBa,UAAUK,GAAG,EAAEJ,YAAYV;IACnE,OAAO,GAAGW,eAAe,GAAG,EAAEE,cAAc;AAC9C;AAEA;;;;CAIC,GACD,OAAO,SAASX,gBAAgBH,KAAiC,EAAEC,QAAgB;IACjF,IAAI,CAACD,OAAO;QACV,OAAO;IACT;IACA,OAAO,CAACJ,oBAAoBI,SAASS,oBAAoBT,OAAOF,kBAAkBG,YAAYD,MAAMgB,YAAY;AAClH"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -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,GAAGA,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG;QACvD,qBACE,KAACZ;YACCO,YAAYA;YACZY,YAAYA;YACZC,cAAcH;YACdT,aAAaA;;IAGnB;IAEA,6CAA6C;IAC7C,MAAMa,sBAAsBf,WAAWU,OAAO,CAAC,QAAQ;IAEvD,qBACE,MAAClB;QACCwB,IAAI;YACFC,SAAS;YACTC,YAAY;QACd;;0BAEA,MAAC1B;gBACCwB,IAAI;oBACFC,SAAS;oBACTE,UAAU;gBACZ;;kCAEA,KAAC1B;wBAAaS,aAAaA;wBAAac,IAAI;4BAAEI,WAAW;wBAAI;;kCAC7D,KAAC5B;wBACC6B,WAAU;wBACVL,IAAI,CAACM,QAAW,CAAA;gCACdL,SAAS;gCACTM,OAAO;gCACPC,UAAU;gCACVL,UAAUxB;gCACV8B,UAAU;gCACVC,OAAOJ,MAAMK,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;gCAChGC,cAAc;gCACdC,YAAY9B,aAAa,WAAW;4BACtC,CAAA;wBACA+B,cAAYhC,gBAAgBR,gCAAgCC;kCAE3DkB;;;;0BAGL,KAACvB;gBACCwB,IAAI,CAACM,QAAW,CAAA;wBACdL,SAAS;wBACToB,aAAa;wBACbC,WAAW;wBACXC,eAAe;wBACfT,YAAY1B,gBAAgBkB,MAAMS,UAAU,CAACC,cAAc,GAAGV,MAAMS,UAAU,CAACE,iBAAiB;oBAClG,CAAA;0BAEChC;;;;AAIT"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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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,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,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -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,EAA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AK;4CACjCI,YAAY;4CACZH,UAAU;wCACZ,CAAA;8CAECc;;;2BATKN;oBAad;gBACF;;;;AAIR"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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,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,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps): ReactElement {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx","SeriesMarker","props","markerColor","sx","display","width","height","borderRadius","marginRight","verticalAlign","style","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAE9C,SAASC,SAAS,QAAQ,WAAW;AAMrC,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,WAAW,EAAEC,EAAE,EAAE,GAAGF;IAC5B,qBACE,KAACH;QACCK,IAAIJ,UACF;YACEK,SAAS;YACTC,OAAO;YACPC,QAAQ;YACRC,cAAc;YACdC,aAAa;YACbC,eAAe;QACjB,GACAN;QAEFO,OAAO;YAAEC,iBAAiBT;QAAY;;AAG5C"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps): ReactElement {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx","SeriesMarker","props","markerColor","sx","display","width","height","borderRadius","marginRight","verticalAlign","style","backgroundColor"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAE9C,SAASC,SAAS,QAAQ,WAAW;AAMrC,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,WAAW,EAAEC,EAAE,EAAE,GAAGF;IAC5B,qBACE,KAACH;QACCK,IAAIJ,UACF;YACEK,SAAS;YACTC,OAAO;YACPC,QAAQ;YACRC,cAAc;YACdC,aAAa;YACbC,eAAe;QACjB,GACAN;QAEFO,OAAO;YAAEC,iBAAiBT;QAAY;;AAG5C"}
@@ -16,6 +16,10 @@ export interface TimeChartTooltipProps {
16
16
  containerId?: string;
17
17
  onUnpinClick?: () => void;
18
18
  format?: FormatOptions;
19
+ /**
20
+ * Map of series ID to format options for per-series formatting (used with multiple Y axes)
21
+ */
22
+ seriesFormatMap?: Map<string, FormatOptions>;
19
23
  wrapLabels?: boolean;
20
24
  }
21
25
  export declare const TimeChartTooltip: import("react").NamedExoticComponent<TimeChartTooltipProps>;
@@ -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,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"}
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;;OAEG;IACH,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB,6DA0E3B,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -19,7 +19,7 @@ import { assembleTransform, getTooltipStyles } from './utils';
19
19
  import { getNearbySeriesData } from './nearby-series';
20
20
  import { TooltipHeader } from './TooltipHeader';
21
21
  import { TooltipContent } from './TooltipContent';
22
- export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ containerId, chartRef, data, seriesMapping, enablePinning = true, wrapLabels, format, onUnpinClick, pinnedPos }) {
22
+ export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ containerId, chartRef, data, seriesMapping, enablePinning = true, wrapLabels, format, seriesFormatMap, onUnpinClick, pinnedPos }) {
23
23
  const [showAllSeries, setShowAllSeries] = useState(false);
24
24
  const transform = useRef();
25
25
  const mousePos = useMousePosition();
@@ -41,6 +41,7 @@ export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ c
41
41
  pinnedPos,
42
42
  chart,
43
43
  format,
44
+ seriesFormatMap,
44
45
  showAllSeries
45
46
  });
46
47
  if (nearbySeries.length === 0) {
@@ -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, useMousePosition } from './tooltip-model';\nimport { assembleTransform, getTooltipStyles } from './utils';\nimport { getNearbySeriesData } from './nearby-series';\nimport { TooltipHeader } from './TooltipHeader';\nimport { TooltipContent } from './TooltipContent';\n\nexport interface TimeChartTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n enablePinning?: boolean;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n onUnpinClick?: () => void;\n format?: FormatOptions;\n wrapLabels?: boolean;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n containerId,\n chartRef,\n data,\n seriesMapping,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const transform = useRef<string | undefined>();\n\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null || data === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n transform.current = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)}\n style={{\n transform: transform.current,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["memo","useRef","useState","Box","Portal","Stack","useResizeObserver","useMousePosition","assembleTransform","getTooltipStyles","getNearbySeriesData","TooltipHeader","TooltipContent","TimeChartTooltip","containerId","chartRef","data","seriesMapping","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","transform","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","nearbySeries","length","totalSeries","container","sx","theme","style","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,IAAI,EAAoBC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACjE,SAASC,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,OAAOC,uBAAuB,sBAAsB;AAEpD,SAA4BC,gBAAgB,QAAQ,kBAAkB;AACtE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,UAAU;AAC9D,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAkBlD,OAAO,MAAMC,iCAAmBb,KAAK,SAASa,iBAAiB,EAC7DC,WAAW,EACXC,QAAQ,EACRC,IAAI,EACJC,aAAa,EACbC,gBAAgB,IAAI,EACpBC,UAAU,EACVC,MAAM,EACNC,YAAY,EACZC,SAAS,EACa;IACtB,MAAM,CAACC,eAAeC,iBAAiB,GAAGtB,SAAS;IACnD,MAAMuB,YAAYxB;IAElB,MAAMyB,WAAWnB;IACjB,MAAM,EAAEoB,MAAM,EAAEC,KAAK,EAAEC,KAAKC,UAAU,EAAE,GAAGxB;IAE3C,MAAMyB,kBAAkBT,cAAc,QAAQJ;IAE9C,IAAIQ,aAAa,QAAQA,SAASM,MAAM,KAAK,QAAQhB,SAAS,MAAM,OAAO;IAE3E,0EAA0E;IAC1E,IAAIM,cAAc,QAAQ,AAACI,SAASM,MAAM,CAAiBC,OAAO,KAAK,UAAU,OAAO;IAExF,MAAMC,QAAQnB,SAASoB,OAAO;IAE9B,MAAMC,mBAAmBtB,cAAcuB,SAASC,aAAa,CAACxB,eAAeyB;IAC7E,uHAAuH;IACvH,MAAMC,YAAYJ,mBAAmBA,iBAAiBK,qBAAqB,GAAGd,MAAM,GAAGY;IAEvFd,UAAUU,OAAO,GAAG3B,kBAAkBkB,UAAUJ,WAAWK,UAAU,GAAGC,SAAS,GAAGQ;IAEpF,uEAAuE;IACvE,MAAMM,eAAehC,oBAAoB;QACvCgB;QACAV;QACAC;QACAK;QACAY;QACAd;QACAG;IACF;IACA,IAAImB,aAAaC,MAAM,KAAK,GAAG;QAC7B,OAAO;IACT;IAEA,MAAMC,cAAc5B,KAAK2B,MAAM;IAE/B,qBACE,KAACvC;QAAOyC,WAAWT;kBACjB,cAAA,KAACjC;YACC0B,KAAKC;YACLgB,IAAI,CAACC,QAAUtC,iBAAiBsC,OAAOzB,WAAWkB;YAClDQ,OAAO;gBACLvB,WAAWA,UAAUU,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"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright 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 /**\n * Map of series ID to format options for per-series formatting (used with multiple Y axes)\n */\n seriesFormatMap?: Map<string, 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 seriesFormatMap,\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 seriesFormatMap,\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","seriesFormatMap","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,+BAA+B;AAC/B,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,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AAc7B,KAAK4B,MAAM;IAE/B,qBACE,KAACxC;QAAO0C,WAAWT;kBACjB,cAAA,KAAClC;YACC2B,KAAKC;YACLgB,IAAI,CAACC,QAAUvC,iBAAiBuC,OAAOzB,WAAWkB;YAClDQ,OAAO;gBACLvB,WAAWA,UAAUU,OAAO;YAC9B;sBAEA,cAAA,MAAC/B;gBAAM6C,SAAS;;kCACd,KAACvC;wBACCgC,cAAcA;wBACdE,aAAaA;wBACb3B,eAAeA;wBACfc,iBAAiBA;wBACjBR,eAAeA;wBACf2B,gBAAgB,CAACC,UAAY3B,iBAAiB2B;wBAC9C9B,cAAcA;;kCAEhB,KAACV;wBAAeyC,QAAQV;wBAAcxB,YAAYA;;;;;;AAK5D,GAAG"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport { NearbySeriesArray } from './nearby-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps): ReactElement | null {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["useMemo","Box","SeriesInfo","TooltipContent","props","series","wrapLabels","sortedFocusedSeries","sort","a","b","y","sx","theme","display","padding","spacing","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","isClosestToCursor","key","toString","totalSeries","length","emphasizeText"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,UAAU,QAAQ,eAAe;AAO1C,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAE/B,MAAMG,sBAAsBP,QAAQ;QAClC,IAAIK,WAAW,MAAM,OAAO;QAC5B,OAAOA,OAAOG,IAAI,CAAC,CAACC,GAAGC,IAAOD,EAAEE,CAAC,GAAGD,EAAEC,CAAC,GAAG,CAAC,IAAI;IACjD,GAAG;QAACN;KAAO;IAEX,IAAIA,WAAW,QAAQE,wBAAwB,MAAM;QACnD,OAAO;IACT;IACA,kDAAkD;IAClD,qBACE,KAACN;QACCW,IAAI,CAACC,QAAW,CAAA;gBACdC,SAAS;gBACTC,SAASF,MAAMG,OAAO,CAAC,KAAK;YAC9B,CAAA;kBAECT,oBAAoBU,GAAG,CAAC,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAET,CAAC,EAAEU,UAAU,EAAEC,WAAW,EAAEC,iBAAiB,EAAE;YAC1G,IAAIL,aAAa,QAAQC,cAAc,MAAM,OAAO;YACpD,MAAMK,MAAML,UAAUM,QAAQ,KAAKP,SAASO,QAAQ;YAEpD,qBACE,KAACvB;gBAECkB,YAAYA;gBACZT,GAAGA;gBACHU,YAAYA;gBACZC,aAAaA;gBACbI,aAAanB,oBAAoBoB,MAAM;gBACvCrB,YAAYA;gBACZsB,eAAeL;eAPVC;QAUX;;AAGN"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport { NearbySeriesArray } from './nearby-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps): ReactElement | null {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["useMemo","Box","SeriesInfo","TooltipContent","props","series","wrapLabels","sortedFocusedSeries","sort","a","b","y","sx","theme","display","padding","spacing","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","isClosestToCursor","key","toString","totalSeries","length","emphasizeText"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,UAAU,QAAQ,eAAe;AAO1C,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAE/B,MAAMG,sBAAsBP,QAAQ;QAClC,IAAIK,WAAW,MAAM,OAAO;QAC5B,OAAOA,OAAOG,IAAI,CAAC,CAACC,GAAGC,IAAOD,EAAEE,CAAC,GAAGD,EAAEC,CAAC,GAAG,CAAC,IAAI;IACjD,GAAG;QAACN;KAAO;IAEX,IAAIA,WAAW,QAAQE,wBAAwB,MAAM;QACnD,OAAO;IACT;IACA,kDAAkD;IAClD,qBACE,KAACN;QACCW,IAAI,CAACC,QAAW,CAAA;gBACdC,SAAS;gBACTC,SAASF,MAAMG,OAAO,CAAC,KAAK;YAC9B,CAAA;kBAECT,oBAAoBU,GAAG,CAAC,CAAC,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAET,CAAC,EAAEU,UAAU,EAAEC,WAAW,EAAEC,iBAAiB,EAAE;YAC1G,IAAIL,aAAa,QAAQC,cAAc,MAAM,OAAO;YACpD,MAAMK,MAAML,UAAUM,QAAQ,KAAKP,SAASO,QAAQ;YAEpD,qBACE,KAACvB;gBAECkB,YAAYA;gBACZT,GAAGA;gBACHU,YAAYA;gBACZC,aAAaA;gBACbI,aAAanB,oBAAoBoB,MAAM;gBACvCrB,YAAYA;gBACZsB,eAAeL;eAPVC;QAUX;;AAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipHeader.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAQpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,0DAyHxB,CAAC"}
1
+ {"version":3,"file":"TooltipHeader.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAQpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,0DA4HxB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -15,15 +15,18 @@ import { Box, Divider, Typography, Stack, Switch } from '@mui/material';
15
15
  import Pin from 'mdi-material-ui/Pin';
16
16
  import PinOutline from 'mdi-material-ui/PinOutline';
17
17
  import { memo } from 'react';
18
- import { getDateAndTime } from '../utils';
18
+ import { useTimeZone } from '../context/TimeZoneProvider';
19
19
  import { TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_WIDTH, PIN_TOOLTIP_HELP_TEXT, UNPIN_TOOLTIP_HELP_TEXT } from './tooltip-model';
20
20
  export const TooltipHeader = /*#__PURE__*/ memo(function TooltipHeader({ nearbySeries, totalSeries, isTooltipPinned, showAllSeries, enablePinning = true, onShowAllClick, onUnpinClick }) {
21
+ const { formatWithUserTimeZone } = useTimeZone();
21
22
  const seriesTimeMs = nearbySeries[0]?.date ?? null;
22
23
  if (seriesTimeMs === null) {
23
24
  return null;
24
25
  }
25
26
  const formatTimeSeriesHeader = (timeMs)=>{
26
- const { formattedTime, formattedDate } = getDateAndTime(timeMs);
27
+ const date = new Date(timeMs);
28
+ const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');
29
+ const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');
27
30
  return /*#__PURE__*/ _jsxs(Box, {
28
31
  children: [
29
32
  /*#__PURE__*/ _jsx(Typography, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipHeader.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, Typography, Stack, Switch } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport { memo, ReactElement } from 'react';\nimport { getDateAndTime } from '../utils';\nimport { NearbySeriesArray } from './nearby-series';\nimport {\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_WIDTH,\n PIN_TOOLTIP_HELP_TEXT,\n UNPIN_TOOLTIP_HELP_TEXT,\n} from './tooltip-model';\n\nexport interface TooltipHeaderProps {\n nearbySeries: NearbySeriesArray;\n totalSeries: number;\n isTooltipPinned: boolean;\n showAllSeries: boolean;\n enablePinning?: boolean;\n onShowAllClick?: (checked: boolean) => void;\n onUnpinClick?: () => void;\n}\n\nexport const TooltipHeader = memo(function TooltipHeader({\n nearbySeries,\n totalSeries,\n isTooltipPinned,\n showAllSeries,\n enablePinning = true,\n onShowAllClick,\n onUnpinClick,\n}: TooltipHeaderProps) {\n const seriesTimeMs = nearbySeries[0]?.date ?? null;\n if (seriesTimeMs === null) {\n return null;\n }\n\n const formatTimeSeriesHeader = (timeMs: number): ReactElement => {\n const { formattedTime, formattedDate } = getDateAndTime(timeMs);\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n // TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT\n const showAllSeriesToggle = enablePinning && totalSeries > 5;\n\n const pinTooltipHelpText = isTooltipPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT;\n\n return (\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box\n sx={{\n width: '100%',\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n paddingBottom: 0.5,\n }}\n >\n {formatTimeSeriesHeader(seriesTimeMs)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography sx={{ fontSize: 11 }}>Show All</Typography>\n <Switch\n checked={showAllSeries}\n size=\"small\"\n onChange={(_, checked) => {\n if (onShowAllClick !== undefined) {\n return onShowAllClick(checked);\n }\n }}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n '& .MuiSwitch-track': {\n backgroundColor: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n {enablePinning && (\n <Stack direction=\"row\" alignItems=\"center\">\n <Typography\n sx={{\n marginRight: 0.5,\n fontSize: 11,\n verticalAlign: 'middle',\n }}\n >\n {pinTooltipHelpText}\n </Typography>\n {isTooltipPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n sx={{\n fontSize: 16,\n cursor: 'pointer',\n }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n )}\n </Stack>\n </Box>\n <Divider\n sx={(theme) => ({\n width: '100%',\n borderColor: theme.palette.grey['500'],\n })}\n />\n </Box>\n );\n});\n"],"names":["Box","Divider","Typography","Stack","Switch","Pin","PinOutline","memo","getDateAndTime","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","PIN_TOOLTIP_HELP_TEXT","UNPIN_TOOLTIP_HELP_TEXT","TooltipHeader","nearbySeries","totalSeries","isTooltipPinned","showAllSeries","enablePinning","onShowAllClick","onUnpinClick","seriesTimeMs","date","formatTimeSeriesHeader","timeMs","formattedTime","formattedDate","variant","sx","theme","color","palette","common","white","strong","showAllSeriesToggle","pinTooltipHelpText","width","maxWidth","padding","spacing","backgroundColor","designSystem","grey","position","top","left","display","justifyContent","alignItems","paddingBottom","direction","gap","marginLeft","textAlign","fontSize","checked","size","onChange","_","undefined","marginRight","verticalAlign","onClick","cursor","borderColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,QAAQ,gBAAgB;AACxE,OAAOC,SAAS,sBAAsB;AACtC,OAAOC,gBAAgB,6BAA6B;AACpD,SAASC,IAAI,QAAsB,QAAQ;AAC3C,SAASC,cAAc,QAAQ,WAAW;AAE1C,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAYzB,OAAO,MAAMC,8BAAgBN,KAAK,SAASM,cAAc,EACvDC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,gBAAgB,IAAI,EACpBC,cAAc,EACdC,YAAY,EACO;IACnB,MAAMC,eAAeP,YAAY,CAAC,EAAE,EAAEQ,QAAQ;IAC9C,IAAID,iBAAiB,MAAM;QACzB,OAAO;IACT;IAEA,MAAME,yBAAyB,CAAC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OD,MAAME,OAAO,CAACC,MAAM,CAACC,KAAK;gDACnC;gDACA,sBAAsB;oDACpBQ,iBAAiBZ,MAAME,OAAO,CAACC,MAAM,CAACC,KAAK;gDAC7C;4CACF,CAAA;;;;4BAILf,+BACC,MAACf;gCAAMgD,WAAU;gCAAMF,YAAW;;kDAChC,KAAC/C;wCACC0B,IAAI;4CACFiC,aAAa;4CACbN,UAAU;4CACVO,eAAe;wCACjB;kDAEC1B;;oCAEFpB,gCACC,KAACX;wCACC0D,SAAS;4CACP,IAAI3C,iBAAiBwC,WAAW;gDAC9BxC;4CACF;wCACF;wCACAQ,IAAI;4CACF2B,UAAU;4CACVS,QAAQ;wCACV;uDAGF,KAAC1D;wCAAWsB,IAAI;4CAAE2B,UAAU;wCAAG;;;;;;;;0BAMzC,KAACtD;gBACC2B,IAAI,CAACC,QAAW,CAAA;wBACdQ,OAAO;wBACP4B,aAAapC,MAAME,OAAO,CAACY,IAAI,CAAC,MAAM;oBACxC,CAAA;;;;AAIR,GAAG"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Typography, Stack, Switch } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport { memo, ReactElement } from 'react';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { NearbySeriesArray } from './nearby-series';\nimport {\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_WIDTH,\n PIN_TOOLTIP_HELP_TEXT,\n UNPIN_TOOLTIP_HELP_TEXT,\n} from './tooltip-model';\n\nexport interface TooltipHeaderProps {\n nearbySeries: NearbySeriesArray;\n totalSeries: number;\n isTooltipPinned: boolean;\n showAllSeries: boolean;\n enablePinning?: boolean;\n onShowAllClick?: (checked: boolean) => void;\n onUnpinClick?: () => void;\n}\n\nexport const TooltipHeader = memo(function TooltipHeader({\n nearbySeries,\n totalSeries,\n isTooltipPinned,\n showAllSeries,\n enablePinning = true,\n onShowAllClick,\n onUnpinClick,\n}: TooltipHeaderProps) {\n const { formatWithUserTimeZone } = useTimeZone();\n const seriesTimeMs = nearbySeries[0]?.date ?? null;\n if (seriesTimeMs === null) {\n return null;\n }\n\n const formatTimeSeriesHeader = (timeMs: number): ReactElement => {\n const date = new Date(timeMs);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n // TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT\n const showAllSeriesToggle = enablePinning && totalSeries > 5;\n\n const pinTooltipHelpText = isTooltipPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT;\n\n return (\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box\n sx={{\n width: '100%',\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n paddingBottom: 0.5,\n }}\n >\n {formatTimeSeriesHeader(seriesTimeMs)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography sx={{ fontSize: 11 }}>Show All</Typography>\n <Switch\n checked={showAllSeries}\n size=\"small\"\n onChange={(_, checked) => {\n if (onShowAllClick !== undefined) {\n return onShowAllClick(checked);\n }\n }}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n '& .MuiSwitch-track': {\n backgroundColor: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n {enablePinning && (\n <Stack direction=\"row\" alignItems=\"center\">\n <Typography\n sx={{\n marginRight: 0.5,\n fontSize: 11,\n verticalAlign: 'middle',\n }}\n >\n {pinTooltipHelpText}\n </Typography>\n {isTooltipPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n sx={{\n fontSize: 16,\n cursor: 'pointer',\n }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n )}\n </Stack>\n </Box>\n <Divider\n sx={(theme) => ({\n width: '100%',\n borderColor: theme.palette.grey['500'],\n })}\n />\n </Box>\n );\n});\n"],"names":["Box","Divider","Typography","Stack","Switch","Pin","PinOutline","memo","useTimeZone","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","PIN_TOOLTIP_HELP_TEXT","UNPIN_TOOLTIP_HELP_TEXT","TooltipHeader","nearbySeries","totalSeries","isTooltipPinned","showAllSeries","enablePinning","onShowAllClick","onUnpinClick","formatWithUserTimeZone","seriesTimeMs","date","formatTimeSeriesHeader","timeMs","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","showAllSeriesToggle","pinTooltipHelpText","width","maxWidth","padding","spacing","backgroundColor","designSystem","grey","position","top","left","display","justifyContent","alignItems","paddingBottom","direction","gap","marginLeft","textAlign","fontSize","checked","size","onChange","_","undefined","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CACF;wCACAU,IAAI;4CACF2B,UAAU;4CACVS,QAAQ;wCACV;uDAGF,KAAC5D;wCAAWwB,IAAI;4CAAE2B,UAAU;wCAAG;;;;;;;;0BAMzC,KAACxD;gBACC6B,IAAI,CAACC,QAAW,CAAA;wBACdQ,OAAO;wBACP4B,aAAapC,MAAME,OAAO,CAACY,IAAI,CAAC,MAAM;oBACxC,CAAA;;;;AAIR,GAAG"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './SeriesInfo';\nexport * from './SeriesLabelsStack';\nexport * from './SeriesMarker';\nexport * from './TimeChartTooltip';\nexport * from './TooltipContent';\nexport * from './TooltipHeader';\nexport * from './nearby-series';\nexport * from './tooltip-model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './SeriesInfo';\nexport * from './SeriesLabelsStack';\nexport * from './SeriesMarker';\nexport * from './TimeChartTooltip';\nexport * from './TooltipContent';\nexport * from './TooltipHeader';\nexport * from './nearby-series';\nexport * from './tooltip-model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
@@ -21,7 +21,7 @@ export type NearbySeriesArray = NearbySeriesInfo[];
21
21
  * Returns formatted series data for the points that are close to the user's cursor.
22
22
  * Adjust xBuffer and yBuffer to increase or decrease number of series shown.
23
23
  */
24
- export declare function checkforNearbyTimeSeries(data: TimeSeries[], seriesMapping: TimeChartSeriesMapping, pointInGrid: number[], yBuffer: number, chart: EChartsInstance, format?: FormatOptions): NearbySeriesArray;
24
+ export declare function checkforNearbyTimeSeries(data: TimeSeries[], seriesMapping: TimeChartSeriesMapping, pointInGrid: number[], yBuffer: number, chart: EChartsInstance, format?: FormatOptions, seriesFormatMap?: Map<string, FormatOptions>, cursorPixelY?: number): NearbySeriesArray;
25
25
  /**
26
26
  * [DEPRECATED] Returns formatted series data for the points that are close to the user's cursor
27
27
  * Adjust yBuffer to increase or decrease number of series shown
@@ -31,25 +31,14 @@ export declare function legacyCheckforNearbySeries(data: EChartsDataFormat, poin
31
31
  * Uses mouse position to determine whether user is hovering over a chart canvas
32
32
  * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
33
33
  */
34
- export declare function getNearbySeriesData({ mousePos, pinnedPos, data, seriesMapping, chart, format, showAllSeries, }: {
34
+ export declare function getNearbySeriesData({ mousePos, pinnedPos, data, seriesMapping, chart, format, seriesFormatMap, showAllSeries, }: {
35
35
  mousePos: CursorData['coords'];
36
36
  pinnedPos: CursorCoordinates | null;
37
37
  data: TimeSeries[];
38
38
  seriesMapping: TimeChartSeriesMapping;
39
39
  chart?: EChartsInstance;
40
40
  format?: FormatOptions;
41
- showAllSeries?: boolean;
42
- }): NearbySeriesArray;
43
- /**
44
- * [DEPRECATED] Uses mouse position to determine whether user is hovering over a chart canvas
45
- * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
46
- */
47
- export declare function legacyGetNearbySeriesData({ mousePos, pinnedPos, chartData, chart, format, showAllSeries, }: {
48
- mousePos: CursorData['coords'];
49
- pinnedPos: CursorCoordinates | null;
50
- chartData: EChartsDataFormat;
51
- chart?: EChartsInstance;
52
- format?: FormatOptions;
41
+ seriesFormatMap?: Map<string, FormatOptions>;
53
42
  showAllSeries?: boolean;
54
43
  }): NearbySeriesArray;
55
44
  export declare function isWithinPercentageRange({ valueToCheck, baseValue, percentage, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-series.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/nearby-series.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,E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B,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,aAAa,EACb,KAAK,EACL,MAAM,EACN,eAAe,EACf,aAAqB,GACtB,EAAE;IACD,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,iBAAiB,CAmEpB;AAKD,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,SAAS,EACT,UAAU,GACX,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAKV;AAKD,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,WAAW,EACX,aAAqB,GACtB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,MAAM,CAcT"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -21,7 +21,8 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
21
21
  /**
22
22
  * Returns formatted series data for the points that are close to the user's cursor.
23
23
  * Adjust xBuffer and yBuffer to increase or decrease number of series shown.
24
- */ export function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format) {
24
+ */ export function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format, seriesFormatMap, // in the case of multi-axis, we need the cursor Y position in pixel space
25
+ cursorPixelY) {
25
26
  const currentNearbySeriesData = [];
26
27
  const cursorX = pointInGrid[0] ?? null;
27
28
  const cursorY = pointInGrid[1] ?? null;
@@ -41,6 +42,23 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
41
42
  if (closestTimestamp === null) {
42
43
  return EMPTY_TOOLTIP_DATA;
43
44
  }
45
+ // For multi-axis support: convert yBuffer to pixel space for consistent comparison
46
+ // This allows us to compare series on different Y axes fairly
47
+ let yBufferPixels = null;
48
+ if (cursorPixelY !== undefined) {
49
+ // Convert a point at cursorY and cursorY + yBuffer to pixels to get the buffer in pixel space
50
+ const cursorPoint = chart.convertToPixel('grid', [
51
+ 0,
52
+ cursorY
53
+ ]);
54
+ const bufferPoint = chart.convertToPixel('grid', [
55
+ 0,
56
+ cursorY + yBuffer
57
+ ]);
58
+ if (cursorPoint && bufferPoint && cursorPoint[1] !== undefined && bufferPoint[1] !== undefined) {
59
+ yBufferPixels = Math.abs(bufferPoint[1] - cursorPoint[1]);
60
+ }
61
+ }
44
62
  // find the timestamp with data that is closest to cursorX
45
63
  for(let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++){
46
64
  const currentSeries = seriesMapping[seriesIdx];
@@ -51,7 +69,10 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
51
69
  if (currentDatasetValues === undefined || !Array.isArray(currentDatasetValues)) break;
52
70
  const lineSeries = currentSeries;
53
71
  const currentSeriesName = lineSeries.name ? lineSeries.name.toString() : '';
72
+ const seriesId = lineSeries.id ? lineSeries.id.toString() : '';
54
73
  const markerColor = lineSeries.color ?? '#000';
74
+ // Get the format for this series (from seriesFormatMap or fallback to default format)
75
+ const seriesFormat = seriesFormatMap?.get(seriesId) ?? format;
55
76
  if (Array.isArray(data)) {
56
77
  for(let datumIdx = 0; datumIdx < currentDatasetValues.length; datumIdx++){
57
78
  const nearbyTimeSeries = currentDatasetValues[datumIdx];
@@ -61,15 +82,59 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
61
82
  // TODO: ensure null values not displayed in tooltip
62
83
  if (yValue !== undefined && yValue !== null) {
63
84
  if (closestTimestamp === xValue) {
64
- if (cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {
85
+ // Check if this series is nearby the cursor
86
+ let isNearby = false;
87
+ // For multi-axis: compare in pixel space
88
+ if (cursorPixelY !== undefined && yBufferPixels !== null) {
89
+ const dataPointPixel = chart.convertToPixel({
90
+ seriesIndex: seriesIdx
91
+ }, [
92
+ datumIdx,
93
+ yValue
94
+ ]);
95
+ if (dataPointPixel && dataPointPixel[1] !== undefined) {
96
+ const pixelDistance = Math.abs(cursorPixelY - dataPointPixel[1]);
97
+ isNearby = pixelDistance <= yBufferPixels;
98
+ } else {
99
+ // Fallback to data-space comparison for primary axis
100
+ isNearby = cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer;
101
+ }
102
+ } else {
103
+ // Fallback to original data-space comparison
104
+ isNearby = cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer;
105
+ }
106
+ if (isNearby) {
65
107
  // show fewer bold series in tooltip when many total series
66
108
  const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;
67
109
  const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);
68
- const isClosestToCursor = isWithinPercentageRange({
69
- valueToCheck: cursorY,
70
- baseValue: yValue,
71
- percentage: percentRangeToCheck
72
- });
110
+ // For isClosestToCursor, also use pixel space for multi-axis
111
+ let isClosestToCursor = false;
112
+ if (cursorPixelY !== undefined) {
113
+ const dataPointPixel = chart.convertToPixel({
114
+ seriesIndex: seriesIdx
115
+ }, [
116
+ datumIdx,
117
+ yValue
118
+ ]);
119
+ if (dataPointPixel && dataPointPixel[1] !== undefined) {
120
+ const pixelDistance = Math.abs(cursorPixelY - dataPointPixel[1]);
121
+ // Use percentage of buffer for "closest" determination
122
+ const tightBufferPixels = (yBufferPixels ?? 50) * (percentRangeToCheck / 100);
123
+ isClosestToCursor = pixelDistance <= Math.max(tightBufferPixels, 5);
124
+ } else {
125
+ isClosestToCursor = isWithinPercentageRange({
126
+ valueToCheck: cursorY,
127
+ baseValue: yValue,
128
+ percentage: percentRangeToCheck
129
+ });
130
+ }
131
+ } else {
132
+ isClosestToCursor = isWithinPercentageRange({
133
+ valueToCheck: cursorY,
134
+ baseValue: yValue,
135
+ percentage: percentRangeToCheck
136
+ });
137
+ }
73
138
  if (isClosestToCursor) {
74
139
  // shows as bold in tooltip, customize 'emphasis' options in getTimeSeries util
75
140
  emphasizedSeriesIndexes.push(seriesIdx);
@@ -100,7 +165,7 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
100
165
  seriesIndex: seriesIdx
101
166
  });
102
167
  }
103
- const formattedY = formatValue(yValue, format);
168
+ const formattedY = formatValue(yValue, seriesFormat);
104
169
  currentNearbySeriesData.push({
105
170
  seriesIdx: seriesIdx,
106
171
  datumIdx: datumIdx,
@@ -222,7 +287,7 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
222
287
  /**
223
288
  * Uses mouse position to determine whether user is hovering over a chart canvas
224
289
  * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
225
- */ export function getNearbySeriesData({ mousePos, pinnedPos, data, seriesMapping, chart, format, showAllSeries = false }) {
290
+ */ export function getNearbySeriesData({ mousePos, pinnedPos, data, seriesMapping, chart, format, seriesFormatMap, showAllSeries = false }) {
226
291
  if (chart === undefined || mousePos === null) return EMPTY_TOOLTIP_DATA;
227
292
  // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned
228
293
  let cursorTargetMatchesChart = false;
@@ -246,7 +311,8 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
246
311
  if (cursorTargetMatchesChart === false || data === null || chart['_model'] === undefined) return EMPTY_TOOLTIP_DATA;
247
312
  // mousemove position undefined when not hovering over chart canvas
248
313
  if (mousePos.plotCanvas.x === undefined || mousePos.plotCanvas.y === undefined) return EMPTY_TOOLTIP_DATA;
249
- const pointInGrid = getPointInGrid(mousePos.plotCanvas.x, mousePos.plotCanvas.y, chart);
314
+ const cursorPixelY = mousePos.plotCanvas.y;
315
+ const pointInGrid = getPointInGrid(mousePos.plotCanvas.x, cursorPixelY, chart);
250
316
  if (pointInGrid !== null) {
251
317
  const chartModel = chart['_model'];
252
318
  const yAxisScale = chartModel.getComponent('yAxis').axis.scale;
@@ -269,57 +335,13 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
269
335
  totalSeries,
270
336
  showAllSeries
271
337
  });
272
- return checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format);
338
+ // Detect if chart has multiple Y-axes by checking if any series uses yAxisIndex > 0
339
+ const hasMultipleYAxes = seriesMapping.some((series)=>series.yAxisIndex !== undefined && series.yAxisIndex > 0);
340
+ return checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format, seriesFormatMap, hasMultipleYAxes ? cursorPixelY : undefined);
273
341
  }
274
342
  // no nearby series found
275
343
  return EMPTY_TOOLTIP_DATA;
276
344
  }
277
- /**
278
- * [DEPRECATED] Uses mouse position to determine whether user is hovering over a chart canvas
279
- * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
280
- */ export function legacyGetNearbySeriesData({ mousePos, pinnedPos, chartData, chart, format, showAllSeries = false }) {
281
- if (chart === undefined || mousePos === null) return [];
282
- // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned
283
- let cursorTargetMatchesChart = false;
284
- if (mousePos.target !== null) {
285
- const currentParent = mousePos.target.parentElement;
286
- if (currentParent !== null) {
287
- const currentGrandparent = currentParent.parentElement;
288
- if (currentGrandparent !== null) {
289
- const chartDom = chart.getDom();
290
- if (chartDom === currentGrandparent) {
291
- cursorTargetMatchesChart = true;
292
- }
293
- }
294
- }
295
- }
296
- // allows moving cursor inside tooltip without it fading away
297
- if (pinnedPos !== null) {
298
- mousePos = pinnedPos;
299
- cursorTargetMatchesChart = true;
300
- }
301
- if (cursorTargetMatchesChart === false) return [];
302
- if (chart['_model'] === undefined) return [];
303
- const chartModel = chart['_model'];
304
- const yInterval = chartModel.getComponent('yAxis').axis.scale._interval;
305
- const totalSeries = chartData.timeSeries.length;
306
- const yBuffer = getYBuffer({
307
- yInterval,
308
- totalSeries,
309
- showAllSeries
310
- });
311
- const pointInPixel = [
312
- mousePos.plotCanvas.x ?? 0,
313
- mousePos.plotCanvas.y ?? 0
314
- ];
315
- if (chart.containPixel('grid', pointInPixel)) {
316
- const pointInGrid = chart.convertFromPixel('grid', pointInPixel);
317
- if (pointInGrid[0] !== undefined && pointInGrid[1] !== undefined) {
318
- return legacyCheckforNearbySeries(chartData, pointInGrid, yBuffer, chart, format);
319
- }
320
- }
321
- return [];
322
- }
323
345
  /*
324
346
  * Check if two numbers are within a specified percentage range
325
347
  */ export function isWithinPercentageRange({ valueToCheck, baseValue, percentage }) {