@perses-dev/components 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621

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 (514) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +9 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +42 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/BarChart/BarChart.d.ts +2 -1
  10. package/dist/BarChart/BarChart.d.ts.map +1 -1
  11. package/dist/BarChart/BarChart.js +11 -6
  12. package/dist/BarChart/BarChart.js.map +1 -1
  13. package/dist/ColorPicker/ColorPicker.d.ts +3 -1
  14. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/ColorPicker.js +28 -13
  16. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  17. package/dist/ColorPicker/OptionsColorPicker.d.ts +9 -0
  18. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  19. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +16 -13
  20. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  21. package/dist/ColorPicker/index.d.ts +1 -0
  22. package/dist/ColorPicker/index.d.ts.map +1 -1
  23. package/dist/ColorPicker/index.js +1 -0
  24. package/dist/ColorPicker/index.js.map +1 -1
  25. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
  26. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  27. package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
  28. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  29. package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -3
  30. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  31. package/dist/DensitySelector/DensitySelector.d.ts +8 -0
  32. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  33. package/dist/DensitySelector/DensitySelector.js +46 -0
  34. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  35. package/dist/DensitySelector/index.d.ts +2 -0
  36. package/dist/DensitySelector/index.d.ts.map +1 -0
  37. package/dist/DensitySelector/index.js +15 -0
  38. package/dist/DensitySelector/index.js.map +1 -0
  39. package/dist/Dialog/Dialog.d.ts +9 -14
  40. package/dist/Dialog/Dialog.d.ts.map +1 -1
  41. package/dist/Dialog/Dialog.js +7 -3
  42. package/dist/Dialog/Dialog.js.map +1 -1
  43. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  44. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  45. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  46. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  47. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  48. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  49. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  50. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  51. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  52. package/dist/DragAndDrop/DragButton.js +97 -0
  53. package/dist/DragAndDrop/DragButton.js.map +1 -0
  54. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  55. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  56. package/dist/DragAndDrop/DropIndicator.js +44 -0
  57. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  58. package/dist/DragAndDrop/index.d.ts +4 -0
  59. package/dist/DragAndDrop/index.d.ts.map +1 -0
  60. package/dist/DragAndDrop/index.js +17 -0
  61. package/dist/DragAndDrop/index.js.map +1 -0
  62. package/dist/DragAndDrop/model.d.ts +11 -0
  63. package/dist/DragAndDrop/model.d.ts.map +1 -0
  64. package/dist/DragAndDrop/model.js +17 -0
  65. package/dist/DragAndDrop/model.js.map +1 -0
  66. package/dist/Drawer/Drawer.d.ts +2 -1
  67. package/dist/Drawer/Drawer.d.ts.map +1 -1
  68. package/dist/Drawer/Drawer.js +1 -1
  69. package/dist/Drawer/Drawer.js.map +1 -1
  70. package/dist/EChart/EChart.d.ts +2 -2
  71. package/dist/EChart/EChart.d.ts.map +1 -1
  72. package/dist/EChart/EChart.js +5 -6
  73. package/dist/EChart/EChart.js.map +1 -1
  74. package/dist/ErrorAlert.d.ts +2 -1
  75. package/dist/ErrorAlert.d.ts.map +1 -1
  76. package/dist/ErrorAlert.js.map +1 -1
  77. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
  78. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  79. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  80. package/dist/FormEditor/FormActions.d.ts +16 -0
  81. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  82. package/dist/FormEditor/FormActions.js +75 -0
  83. package/dist/FormEditor/FormActions.js.map +1 -0
  84. package/dist/FormEditor/index.d.ts +2 -0
  85. package/dist/FormEditor/index.d.ts.map +1 -0
  86. package/dist/FormEditor/index.js +15 -0
  87. package/dist/FormEditor/index.js.map +1 -0
  88. package/dist/FormatControls/FormatControls.d.ts +2 -1
  89. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  90. package/dist/FormatControls/FormatControls.js +2 -2
  91. package/dist/FormatControls/FormatControls.js.map +1 -1
  92. package/dist/GaugeChart/GaugeChart.d.ts +2 -1
  93. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  94. package/dist/GaugeChart/GaugeChart.js +4 -7
  95. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  96. package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
  97. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  98. package/dist/InfoTooltip/InfoTooltip.js +3 -4
  99. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  100. package/dist/JSONEditor.d.ts +2 -1
  101. package/dist/JSONEditor.d.ts.map +1 -1
  102. package/dist/JSONEditor.js.map +1 -1
  103. package/dist/Legend/CompactLegend.d.ts +2 -1
  104. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  105. package/dist/Legend/CompactLegend.js.map +1 -1
  106. package/dist/Legend/Legend.d.ts +2 -1
  107. package/dist/Legend/Legend.d.ts.map +1 -1
  108. package/dist/Legend/Legend.js +8 -4
  109. package/dist/Legend/Legend.js.map +1 -1
  110. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  111. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  112. package/dist/Legend/LegendColorBadge.js +2 -2
  113. package/dist/Legend/LegendColorBadge.js.map +1 -1
  114. package/dist/Legend/ListLegend.d.ts +2 -1
  115. package/dist/Legend/ListLegend.d.ts.map +1 -1
  116. package/dist/Legend/ListLegend.js.map +1 -1
  117. package/dist/Legend/ListLegendItem.d.ts +5 -5
  118. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  119. package/dist/Legend/ListLegendItem.js +8 -12
  120. package/dist/Legend/ListLegendItem.js.map +1 -1
  121. package/dist/Legend/TableLegend.d.ts +2 -1
  122. package/dist/Legend/TableLegend.d.ts.map +1 -1
  123. package/dist/Legend/TableLegend.js +1 -0
  124. package/dist/Legend/TableLegend.js.map +1 -1
  125. package/dist/Legend/legend-model.d.ts.map +1 -1
  126. package/dist/Legend/legend-model.js.map +1 -1
  127. package/dist/LineChart/LineChart.d.ts +1 -1
  128. package/dist/LineChart/LineChart.d.ts.map +1 -1
  129. package/dist/LineChart/LineChart.js +6 -11
  130. package/dist/LineChart/LineChart.js.map +1 -1
  131. package/dist/LinksEditor/LinksEditor.d.ts +8 -0
  132. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -0
  133. package/dist/LinksEditor/LinksEditor.js +161 -0
  134. package/dist/LinksEditor/LinksEditor.js.map +1 -0
  135. package/dist/LinksEditor/index.d.ts +2 -0
  136. package/dist/LinksEditor/index.d.ts.map +1 -0
  137. package/dist/LinksEditor/index.js +15 -0
  138. package/dist/LinksEditor/index.js.map +1 -0
  139. package/dist/ModeSelector/ModeSelector.d.ts +2 -1
  140. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  141. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  142. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  143. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  144. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  145. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
  146. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  147. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  148. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  149. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  150. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  151. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  152. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  153. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  154. package/dist/Overlay/Overlay.d.ts +16 -0
  155. package/dist/Overlay/Overlay.d.ts.map +1 -0
  156. package/dist/Overlay/Overlay.js +52 -0
  157. package/dist/Overlay/Overlay.js.map +1 -0
  158. package/dist/Overlay/index.d.ts +2 -0
  159. package/dist/Overlay/index.d.ts.map +1 -0
  160. package/dist/Overlay/index.js +15 -0
  161. package/dist/Overlay/index.js.map +1 -0
  162. package/dist/PieChart/PieChart.d.ts +14 -0
  163. package/dist/PieChart/PieChart.d.ts.map +1 -0
  164. package/dist/PieChart/PieChart.js +92 -0
  165. package/dist/PieChart/PieChart.js.map +1 -0
  166. package/dist/PieChart/index.d.ts +2 -0
  167. package/dist/PieChart/index.d.ts.map +1 -0
  168. package/dist/PieChart/index.js +15 -0
  169. package/dist/PieChart/index.js.map +1 -0
  170. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
  171. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  172. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  173. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  174. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  175. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  176. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  177. package/dist/SortSelector/SortSelector.d.ts +2 -1
  178. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  179. package/dist/SortSelector/SortSelector.js.map +1 -1
  180. package/dist/SortSelector/SortSelectorButtons.d.ts +9 -0
  181. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  182. package/dist/SortSelector/SortSelectorButtons.js +42 -0
  183. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  184. package/dist/SortSelector/index.d.ts +1 -0
  185. package/dist/SortSelector/index.d.ts.map +1 -1
  186. package/dist/SortSelector/index.js +2 -1
  187. package/dist/SortSelector/index.js.map +1 -1
  188. package/dist/StatChart/StatChart.d.ts +6 -5
  189. package/dist/StatChart/StatChart.d.ts.map +1 -1
  190. package/dist/StatChart/StatChart.js +10 -16
  191. package/dist/StatChart/StatChart.js.map +1 -1
  192. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  193. package/dist/StatChart/calculateFontSize.js +2 -4
  194. package/dist/StatChart/calculateFontSize.js.map +1 -1
  195. package/dist/StatChart/utils/formatStatChartValue.d.ts +3 -0
  196. package/dist/StatChart/utils/formatStatChartValue.d.ts.map +1 -0
  197. package/dist/StatChart/utils/formatStatChartValue.js +26 -0
  198. package/dist/StatChart/utils/formatStatChartValue.js.map +1 -0
  199. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +27 -0
  200. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  201. package/dist/StatusHistoryChart/StatusHistoryChart.js +132 -0
  202. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  203. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +13 -0
  204. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  205. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  206. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  207. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  208. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  209. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  210. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  211. package/dist/StatusHistoryChart/index.d.ts +3 -0
  212. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  213. package/dist/StatusHistoryChart/index.js +16 -0
  214. package/dist/StatusHistoryChart/index.js.map +1 -0
  215. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  216. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  217. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  218. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  219. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  220. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  221. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  222. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  223. package/dist/Table/InnerTable.d.ts.map +1 -1
  224. package/dist/Table/InnerTable.js +2 -1
  225. package/dist/Table/InnerTable.js.map +1 -1
  226. package/dist/Table/Table.d.ts +2 -1
  227. package/dist/Table/Table.d.ts.map +1 -1
  228. package/dist/Table/Table.js +10 -8
  229. package/dist/Table/Table.js.map +1 -1
  230. package/dist/Table/TableCell.d.ts +4 -2
  231. package/dist/Table/TableCell.d.ts.map +1 -1
  232. package/dist/Table/TableCell.js +28 -6
  233. package/dist/Table/TableCell.js.map +1 -1
  234. package/dist/Table/TableCheckbox.d.ts +2 -1
  235. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  236. package/dist/Table/TableCheckbox.js.map +1 -1
  237. package/dist/Table/TableHeaderCell.d.ts +3 -2
  238. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  239. package/dist/Table/TableHeaderCell.js.map +1 -1
  240. package/dist/Table/VirtualizedTable.d.ts +5 -4
  241. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  242. package/dist/Table/VirtualizedTable.js +17 -14
  243. package/dist/Table/VirtualizedTable.js.map +1 -1
  244. package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
  245. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  246. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  247. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  248. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  249. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  250. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  251. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  252. package/dist/Table/index.d.ts +1 -2
  253. package/dist/Table/index.d.ts.map +1 -1
  254. package/dist/Table/index.js +1 -1
  255. package/dist/Table/index.js.map +1 -1
  256. package/dist/Table/model/table-model.d.ts +22 -2
  257. package/dist/Table/model/table-model.d.ts.map +1 -1
  258. package/dist/Table/model/table-model.js +27 -21
  259. package/dist/Table/model/table-model.js.map +1 -1
  260. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  261. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  262. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  263. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  264. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
  265. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  266. package/dist/ThresholdsEditor/ThresholdsEditor.js +18 -26
  267. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  268. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  269. package/dist/TimeChart/TimeChart.js +5 -8
  270. package/dist/TimeChart/TimeChart.js.map +1 -1
  271. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +19 -0
  272. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  273. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +43 -28
  274. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  275. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +36 -0
  276. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  277. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  278. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  279. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  280. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  281. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  282. package/dist/TimeRangeSelector/index.js.map +1 -0
  283. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  284. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  285. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  286. package/dist/TimeRangeSelector/utils.js.map +1 -0
  287. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  288. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  289. package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  290. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  291. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
  292. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  293. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -2
  294. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  295. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
  296. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  297. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  298. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
  299. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  300. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  301. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  302. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  303. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  304. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  305. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
  306. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  307. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  308. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  309. package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -14
  310. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  311. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  312. package/dist/TimeSeriesTooltip/nearby-series.js +15 -25
  313. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  314. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +8 -1
  315. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  316. package/dist/TimeSeriesTooltip/tooltip-model.js +13 -2
  317. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  318. package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
  319. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  320. package/dist/TimeSeriesTooltip/utils.js +2 -4
  321. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  322. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  323. package/dist/TransformsEditor/TransformEditor.d.ts +9 -0
  324. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -0
  325. package/dist/TransformsEditor/TransformEditor.js +289 -0
  326. package/dist/TransformsEditor/TransformEditor.js.map +1 -0
  327. package/dist/TransformsEditor/TransformEditorContainer.d.ts +10 -0
  328. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -0
  329. package/dist/TransformsEditor/TransformEditorContainer.js +118 -0
  330. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -0
  331. package/dist/TransformsEditor/TransformsEditor.d.ts +9 -0
  332. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -0
  333. package/dist/TransformsEditor/TransformsEditor.js +90 -0
  334. package/dist/TransformsEditor/TransformsEditor.js.map +1 -0
  335. package/dist/TransformsEditor/index.d.ts +2 -0
  336. package/dist/TransformsEditor/index.d.ts.map +1 -0
  337. package/dist/TransformsEditor/index.js +15 -0
  338. package/dist/TransformsEditor/index.js.map +1 -0
  339. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +10 -0
  340. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -0
  341. package/dist/ValueMappingEditor/ValueMappingEditor.js +374 -0
  342. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
  343. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +8 -0
  344. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -0
  345. package/dist/ValueMappingEditor/ValueMappingsEditor.js +118 -0
  346. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
  347. package/dist/ValueMappingEditor/index.d.ts +2 -0
  348. package/dist/ValueMappingEditor/index.d.ts.map +1 -0
  349. package/dist/ValueMappingEditor/index.js +15 -0
  350. package/dist/ValueMappingEditor/index.js.map +1 -0
  351. package/dist/YAxisLabel.d.ts +2 -1
  352. package/dist/YAxisLabel.d.ts.map +1 -1
  353. package/dist/YAxisLabel.js +4 -2
  354. package/dist/YAxisLabel.js.map +1 -1
  355. package/dist/cjs/AlignSelector/AlignSelector.js +50 -0
  356. package/dist/cjs/AlignSelector/index.js +30 -0
  357. package/dist/cjs/BarChart/BarChart.js +12 -7
  358. package/dist/cjs/ColorPicker/ColorPicker.js +28 -54
  359. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +18 -15
  360. package/dist/cjs/ColorPicker/index.js +1 -0
  361. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
  362. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -3
  363. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  364. package/dist/cjs/DensitySelector/index.js +30 -0
  365. package/dist/cjs/Dialog/Dialog.js +7 -3
  366. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  367. package/dist/cjs/DragAndDrop/DragButton.js +121 -0
  368. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  369. package/dist/cjs/DragAndDrop/index.js +32 -0
  370. package/dist/cjs/DragAndDrop/model.js +25 -0
  371. package/dist/cjs/Drawer/Drawer.js +1 -1
  372. package/dist/cjs/EChart/EChart.js +5 -47
  373. package/dist/cjs/FormEditor/FormActions.js +83 -0
  374. package/dist/cjs/FormEditor/index.js +30 -0
  375. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  376. package/dist/cjs/GaugeChart/GaugeChart.js +5 -8
  377. package/dist/cjs/InfoTooltip/InfoTooltip.js +3 -9
  378. package/dist/cjs/Legend/Legend.js +8 -4
  379. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  380. package/dist/cjs/Legend/ListLegendItem.js +6 -50
  381. package/dist/cjs/Legend/TableLegend.js +1 -0
  382. package/dist/cjs/LineChart/LineChart.js +8 -13
  383. package/dist/cjs/LinksEditor/LinksEditor.js +174 -0
  384. package/dist/cjs/LinksEditor/index.js +30 -0
  385. package/dist/cjs/Overlay/Overlay.js +71 -0
  386. package/dist/cjs/Overlay/index.js +30 -0
  387. package/dist/cjs/PieChart/PieChart.js +100 -0
  388. package/dist/cjs/PieChart/index.js +30 -0
  389. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  390. package/dist/cjs/SortSelector/SortSelectorButtons.js +50 -0
  391. package/dist/cjs/SortSelector/index.js +2 -1
  392. package/dist/cjs/StatChart/StatChart.js +13 -19
  393. package/dist/cjs/StatChart/calculateFontSize.js +2 -4
  394. package/dist/cjs/StatChart/utils/formatStatChartValue.js +34 -0
  395. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +140 -0
  396. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  397. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  398. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  399. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  400. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  401. package/dist/cjs/Table/InnerTable.js +2 -1
  402. package/dist/cjs/Table/Table.js +9 -7
  403. package/dist/cjs/Table/TableCell.js +28 -6
  404. package/dist/cjs/Table/VirtualizedTable.js +17 -14
  405. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  406. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  407. package/dist/cjs/Table/index.js +1 -7
  408. package/dist/cjs/Table/model/table-model.js +30 -21
  409. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
  410. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +18 -26
  411. package/dist/cjs/TimeChart/TimeChart.js +5 -8
  412. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +37 -30
  413. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  414. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  415. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
  416. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  417. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -2
  418. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  419. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -14
  420. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +15 -25
  421. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +22 -2
  422. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -4
  423. package/dist/cjs/TransformsEditor/TransformEditor.js +297 -0
  424. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +131 -0
  425. package/dist/cjs/TransformsEditor/TransformsEditor.js +103 -0
  426. package/dist/cjs/TransformsEditor/index.js +30 -0
  427. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +387 -0
  428. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +131 -0
  429. package/dist/cjs/ValueMappingEditor/index.js +30 -0
  430. package/dist/cjs/YAxisLabel.js +4 -2
  431. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  432. package/dist/cjs/controls/TextField.js +54 -0
  433. package/dist/cjs/controls/index.js +30 -0
  434. package/dist/cjs/index.js +12 -1
  435. package/dist/cjs/model/timeOption.js +19 -1
  436. package/dist/cjs/theme/index.js +1 -0
  437. package/dist/cjs/theme/palette/background.js +2 -0
  438. package/dist/cjs/theme/theme.js +6 -6
  439. package/dist/cjs/utils/chart-actions.js +2 -3
  440. package/dist/cjs/utils/format.js +19 -1
  441. package/dist/cjs/utils/theme-gen.js +5 -7
  442. package/dist/context/ChartsProvider.d.ts +2 -2
  443. package/dist/context/ChartsProvider.d.ts.map +1 -1
  444. package/dist/context/ChartsProvider.js.map +1 -1
  445. package/dist/context/TimeZoneProvider.d.ts +4 -4
  446. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  447. package/dist/context/TimeZoneProvider.js +1 -1
  448. package/dist/context/TimeZoneProvider.js.map +1 -1
  449. package/dist/controls/TextField.d.ts +9 -0
  450. package/dist/controls/TextField.d.ts.map +1 -0
  451. package/dist/controls/TextField.js +41 -0
  452. package/dist/controls/TextField.js.map +1 -0
  453. package/dist/controls/index.d.ts +2 -0
  454. package/dist/controls/index.d.ts.map +1 -0
  455. package/dist/controls/index.js +15 -0
  456. package/dist/controls/index.js.map +1 -0
  457. package/dist/index.d.ts +12 -1
  458. package/dist/index.d.ts.map +1 -1
  459. package/dist/index.js +12 -1
  460. package/dist/index.js.map +1 -1
  461. package/dist/model/timeOption.d.ts +2 -1
  462. package/dist/model/timeOption.d.ts.map +1 -1
  463. package/dist/model/timeOption.js +13 -2
  464. package/dist/model/timeOption.js.map +1 -1
  465. package/dist/test/render.d.ts +3 -3
  466. package/dist/test/render.d.ts.map +1 -1
  467. package/dist/test/render.js.map +1 -1
  468. package/dist/theme/index.d.ts +2 -0
  469. package/dist/theme/index.d.ts.map +1 -1
  470. package/dist/theme/index.js +1 -0
  471. package/dist/theme/index.js.map +1 -1
  472. package/dist/theme/palette/background.d.ts.map +1 -1
  473. package/dist/theme/palette/background.js +2 -0
  474. package/dist/theme/palette/background.js.map +1 -1
  475. package/dist/theme/theme.d.ts +2 -2
  476. package/dist/theme/theme.d.ts.map +1 -1
  477. package/dist/theme/theme.js +5 -5
  478. package/dist/theme/theme.js.map +1 -1
  479. package/dist/utils/axis.d.ts +1 -7
  480. package/dist/utils/axis.d.ts.map +1 -1
  481. package/dist/utils/axis.js.map +1 -1
  482. package/dist/utils/chart-actions.d.ts.map +1 -1
  483. package/dist/utils/chart-actions.js +2 -3
  484. package/dist/utils/chart-actions.js.map +1 -1
  485. package/dist/utils/component-ids.d.ts.map +1 -1
  486. package/dist/utils/component-ids.js.map +1 -1
  487. package/dist/utils/format.d.ts +10 -4
  488. package/dist/utils/format.d.ts.map +1 -1
  489. package/dist/utils/format.js +16 -1
  490. package/dist/utils/format.js.map +1 -1
  491. package/dist/utils/theme-gen.js +5 -7
  492. package/dist/utils/theme-gen.js.map +1 -1
  493. package/package.json +12 -8
  494. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
  495. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  496. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  497. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
  498. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  499. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  500. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  501. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
  502. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  503. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  504. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  505. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  506. package/dist/DateTimeRangePicker/index.js.map +0 -1
  507. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  508. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  509. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  510. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
  511. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  512. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  513. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  514. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -29,8 +29,7 @@ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ c
29
29
  // Ensure user is hovering over a chart before checking for nearby series.
30
30
  if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
31
31
  const chart = chartRef.current;
32
- var _chart_getWidth;
33
- const chartWidth = (_chart_getWidth = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && _chart_getWidth !== void 0 ? _chart_getWidth : FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
32
+ const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
34
33
  // Get series nearby the cursor and pass into tooltip content children.
35
34
  const nearbySeries = legacyGetNearbySeriesData({
36
35
  mousePos,
@@ -48,24 +47,21 @@ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ c
48
47
  // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
49
48
  const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
50
49
  if (!isTooltipPinned) {
51
- transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0, containerElement);
50
+ transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);
52
51
  }
53
52
  return /*#__PURE__*/ _jsx(Portal, {
54
53
  container: containerElement,
55
54
  children: /*#__PURE__*/ _jsx(Box, {
56
55
  ref: tooltipRef,
57
- sx: (theme)=>{
58
- var _theme_palette_designSystem;
59
- var _theme_palette_designSystem_grey_;
60
- return {
56
+ sx: (theme)=>({
61
57
  minWidth: TOOLTIP_MIN_WIDTH,
62
58
  maxWidth: TOOLTIP_MAX_WIDTH,
63
- maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : TOOLTIP_MAX_HEIGHT,
59
+ maxHeight: maxHeight ?? TOOLTIP_MAX_HEIGHT,
64
60
  padding: 0,
65
61
  position: 'absolute',
66
62
  top: 0,
67
63
  left: 0,
68
- backgroundColor: (_theme_palette_designSystem_grey_ = (_theme_palette_designSystem = theme.palette.designSystem) === null || _theme_palette_designSystem === void 0 ? void 0 : _theme_palette_designSystem.grey[800]) !== null && _theme_palette_designSystem_grey_ !== void 0 ? _theme_palette_designSystem_grey_ : TOOLTIP_BG_COLOR_FALLBACK,
64
+ backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,
69
65
  borderRadius: '6px',
70
66
  color: '#fff',
71
67
  fontSize: '11px',
@@ -78,8 +74,7 @@ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ c
78
74
  '&:hover': {
79
75
  overflowY: 'auto'
80
76
  }
81
- };
82
- },
77
+ }),
83
78
  style: {
84
79
  transform: transform.current,
85
80
  display: transform.current ? 'block' : 'none'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { FormatOptions } from '@perses-dev/core';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, useRef, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { legacyGetNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n FALLBACK_CHART_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MIN_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\nexport interface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n enablePinning?: boolean;\n wrapLabels?: boolean;\n format?: FormatOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n}\n\nexport const LineChartTooltip = memo(function LineChartTooltip({\n chartRef,\n chartData,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n containerId,\n}: TimeSeriesTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n const transform = useRef<string | undefined>();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = legacyGetNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = chartData.timeSeries.length;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n if (!isTooltipPinned) {\n transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);\n }\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: maxHeight ?? TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: transform.current,\n display: transform.current ? 'block' : 'none',\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useRef","useState","useResizeObserver","TooltipContent","TooltipHeader","legacyGetNearbySeriesData","FALLBACK_CHART_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","TOOLTIP_MIN_WIDTH","useMousePosition","assembleTransform","LineChartTooltip","chartRef","chartData","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","containerId","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","transform","isTooltipPinned","target","tagName","chart","current","chartWidth","getWidth","nearbySeries","length","totalSeries","timeSeries","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","container","sx","theme","minWidth","maxWidth","padding","position","top","left","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","display","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,SAASC,IAAI,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/C,OAAOC,uBAAuB,sBAAsB;AAEpD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,yBAAyB,QAAQ,kBAAkB;AAC5D,SAEEC,oBAAoB,EACpBC,yBAAyB,EACzBC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB,QACX,kBAAkB;AACzB,SAASC,iBAAiB,QAAQ,UAAU;AAiB5C,OAAO,MAAMC,iCAAmBd,KAAK,SAASc,iBAAiB,EAC7DC,QAAQ,EACRC,SAAS,EACTC,gBAAgB,IAAI,EACpBC,UAAU,EACVC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,WAAW,EACY;IACvB,MAAM,CAACC,eAAeC,iBAAiB,GAAGtB,SAAS;IACnD,MAAMuB,WAAWb;IACjB,MAAM,EAAEc,MAAM,EAAEC,KAAK,EAAEC,KAAKC,UAAU,EAAE,GAAG1B;IAC3C,MAAM2B,YAAY7B;IAElB,MAAM8B,kBAAkBV,cAAc,QAAQJ;IAE9C,IAAIQ,aAAa,QAAQA,SAASO,MAAM,KAAK,MAAM,OAAO;IAE1D,0EAA0E;IAC1E,IAAIX,cAAc,QAAQ,AAACI,SAASO,MAAM,CAAiBC,OAAO,KAAK,UAAU,OAAO;IAExF,MAAMC,QAA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A;YACAC,OAAO;gBACLzC,WAAWA,UAAUK,OAAO;gBAC5BqC,SAAS1C,UAAUK,OAAO,GAAG,UAAU;YACzC;sBAEA,cAAA,MAACpC;gBAAM0E,SAAS;;kCACd,KAACpE;wBACCiC,cAAcA;wBACdE,aAAaA;wBACbvB,eAAeA;wBACfc,iBAAiBA;wBACjBR,eAAeA;wBACfmD,gBAAgB,CAACC,UAAYnD,iBAAiBmD;wBAC9CvD,cAAcA;;kCAEhB,KAAChB;wBAAewE,QAAQtC;wBAAcpB,YAAYA;;;;;;AAK5D,GAAG"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { FormatOptions } from '@perses-dev/core';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, MutableRefObject, ReactElement, useRef, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { legacyGetNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n FALLBACK_CHART_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MIN_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\nexport interface TimeSeriesTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n enablePinning?: boolean;\n wrapLabels?: boolean;\n format?: FormatOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n}\n\nexport const LineChartTooltip = memo(function LineChartTooltip({\n chartRef,\n chartData,\n enablePinning = true,\n wrapLabels,\n format,\n onUnpinClick,\n pinnedPos,\n containerId,\n}: TimeSeriesTooltipProps): ReactElement | null {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n const transform = useRef<string | undefined>();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = legacyGetNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n format,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = chartData.timeSeries.length;\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n if (!isTooltipPinned) {\n transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);\n }\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: maxHeight ?? TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: transform.current,\n display: transform.current ? 'block' : 'none',\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useRef","useState","useResizeObserver","TooltipContent","TooltipHeader","legacyGetNearbySeriesData","FALLBACK_CHART_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","TOOLTIP_MIN_WIDTH","useMousePosition","assembleTransform","LineChartTooltip","chartRef","chartData","enablePinning","wrapLabels","format","onUnpinClick","pinnedPos","containerId","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","transform","isTooltipPinned","target","tagName","chart","current","chartWidth","getWidth","nearbySeries","length","totalSeries","timeSeries","containerElement","document","querySelector","undefined","maxHeight","getBoundingClientRect","container","sx","theme","minWidth","maxWidth","padding","position","top","left","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","display","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAA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SeriesInfoProps {
2
3
  seriesName: string;
3
4
  y: number;
@@ -7,5 +8,5 @@ export interface SeriesInfoProps {
7
8
  emphasizeText?: boolean;
8
9
  wrapLabels?: boolean;
9
10
  }
10
- export declare function SeriesInfo(props: SeriesInfoProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function SeriesInfo(props: SeriesInfoProps): ReactElement;
11
12
  //# sourceMappingURL=SeriesInfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeriesInfo.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0EhD"}
1
+ {"version":3,"file":"SeriesInfo.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAKrC,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CA0E/D"}
@@ -21,8 +21,7 @@ export function SeriesInfo(props) {
21
21
  // ex with metric name: node_load15{env="demo",job="node"}
22
22
  // ex without metric name: {env="demo",job="node"}
23
23
  const splitName = seriesName.split('{');
24
- var _splitName_;
25
- const seriesLabels = (_splitName_ = splitName[1]) !== null && _splitName_ !== void 0 ? _splitName_ : seriesName;
24
+ const seriesLabels = splitName[1] ?? seriesName;
26
25
  // remove curly braces that wrap labels
27
26
  const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');
28
27
  // determine whether to show labels on separate lines
@@ -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 { 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) {\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","f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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 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,S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
  formattedY: string;
3
4
  metricName: string;
4
5
  metricLabels: string[];
5
6
  markerColor: string;
6
7
  }
7
- export declare function SeriesLabelsStack(props: SeriesLabelsStackProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function SeriesLabelsStack(props: SeriesLabelsStackProps): ReactElement;
8
9
  //# sourceMappingURL=SeriesLabelsStack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeriesLabelsStack.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAiE9D"}
1
+ {"version":3,"file":"SeriesLabelsStack.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAiE7E"}
@@ -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 { SeriesMarker } from './SeriesMarker';\n\nexport interface SeriesLabelsStackProps {\n formattedY: string;\n metricName: string;\n metricLabels: string[];\n markerColor: string;\n}\n\nexport function SeriesLabelsStack(props: SeriesLabelsStackProps) {\n const { formattedY, markerColor, metricName, metricLabels } = props;\n return (\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n display: 'flex',\n height: '16px',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'left',\n color: theme.palette.common.white,\n fontSize: '11px',\n })}\n >\n <SeriesMarker markerColor={markerColor} sx={{ marginTop: 0.25 }} />\n <Box component=\"span\">\n {metricName}\n <Box\n component=\"span\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n paddingLeft: '2px',\n })}\n >\n {formattedY}\n </Box>\n </Box>\n </Box>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {metricLabels.map((label) => {\n // show labels on separate lines when many labels and only one focused series\n if (label) {\n const [name, value] = label.split('=');\n const formattedName = value !== undefined ? `${name}: ` : name;\n const formattedValue = value !== undefined ? value.replace(/(^\"|\"$)/g, '') : value;\n return (\n <Box key={label} sx={{ display: 'flex', gap: '4px' }}>\n <Typography sx={{ fontSize: '11px' }}>{formattedName}</Typography>\n <Typography\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n fontSize: '11px',\n })}\n >\n {formattedValue}\n </Typography>\n </Box>\n );\n }\n })}\n </Box>\n </Stack>\n );\n}\n"],"names":["Box","Divider","Stack","Typography","SeriesMarker","SeriesLabelsStack","props","formattedY","markerColor","metricName","metricLabels","spacing","sx","theme","display","height","flexDirection","alignItems","justifyContent","color","palette","common","white","fontSize","marginTop","component","fontWeight","paddingLeft","borderColor","grey","map","label","name","value","split","formattedName","undefined","formattedValue","replace","gap"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAChE,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,CAAC,EAAEJ,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
+ {"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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MO,OAAO,CAACC,MAAM,CAACC,KAAK;4CACjCI,YAAY;4CACZH,UAAU;wCACZ,CAAA;8CAECc;;;2BATKN;oBAad;gBACF;;;;AAIR"}
@@ -1,7 +1,8 @@
1
1
  import { BoxProps } from '@mui/material';
2
+ import { ReactElement } from 'react';
2
3
  interface SeriesMarkerProps extends BoxProps<'div'> {
3
4
  markerColor: string;
4
5
  }
5
- export declare function SeriesMarker(props: SeriesMarkerProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function SeriesMarker(props: SeriesMarkerProps): ReactElement;
6
7
  export {};
7
8
  //# sourceMappingURL=SeriesMarker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SeriesMarker.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,UAAU,iBAAkB,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAkBpD"}
1
+ {"version":3,"file":"SeriesMarker.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,UAAU,iBAAkB,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAkBnE"}
@@ -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 { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps) {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx","SeriesMarker","props","markerColor","sx","display","width","height","borderRadius","marginRight","verticalAlign","style","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,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 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,10 +1,10 @@
1
- /// <reference types="react" />
1
+ import { MutableRefObject } from 'react';
2
2
  import { ECharts as EChartsInstance } from 'echarts/core';
3
3
  import { FormatOptions, TimeSeries } from '@perses-dev/core';
4
4
  import { TimeChartSeriesMapping } from '../model';
5
5
  import { CursorCoordinates } from './tooltip-model';
6
6
  export interface TimeChartTooltipProps {
7
- chartRef: React.MutableRefObject<EChartsInstance | undefined>;
7
+ chartRef: MutableRefObject<EChartsInstance | undefined>;
8
8
  data: TimeSeries[];
9
9
  seriesMapping: TimeChartSeriesMapping;
10
10
  enablePinning?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"TimeChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"names":[],"mappings":";AAeA,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,EAA0C,MAAM,iBAAiB,CAAC;AAM5F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,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,6DA2E3B,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,EAA0C,MAAM,iBAAiB,CAAC;AAM5F,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,6DA2E3B,CAAC"}
@@ -29,13 +29,12 @@ export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ c
29
29
  // Ensure user is hovering over a chart before checking for nearby series.
30
30
  if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
31
31
  const chart = chartRef.current;
32
- var _chart_getWidth;
33
- const chartWidth = (_chart_getWidth = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && _chart_getWidth !== void 0 ? _chart_getWidth : FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
32
+ const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
34
33
  const containerElement = containerId ? document.querySelector(containerId) : undefined;
35
34
  // if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
36
35
  const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
37
36
  if (!isTooltipPinned) {
38
- transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0, containerElement);
37
+ transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);
39
38
  }
40
39
  // Get series nearby the cursor and pass into tooltip content children.
41
40
  const nearbySeries = getNearbySeriesData({
@@ -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, 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, FALLBACK_CHART_WIDTH, 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: React.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 const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\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 if (!isTooltipPinned) {\n transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);\n }\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","FALLBACK_CHART_WIDTH","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","chartWidth","getWidth","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,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAGnD,OAAOC,uBAAuB,sBAAsB;AAEpD,SAA4BC,oBAAoB,EAAEC,gBAAgB,QAAQ,kBAAkB;AAC5F,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,UAAU;AAC9D,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAkBlD,OAAO,MAAMC,iCAAmBd,KAAK,SAASc,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,GAAGvB,SAAS;IACnD,MAAMwB,YAAYzB;IAElB,MAAM0B,WAAWnB;IACjB,MAAM,EAAEoB,MAAM,EAAEC,KAAK,EAAEC,KAAKC,UAAU,EAAE,GAAGzB;IAE3C,MAAM0B,kBAAkBT,cAAc,QAAQJ;IAE9C,IAAIQ,aAAa,QAAQA,SAASM,MA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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, FALLBACK_CHART_WIDTH, 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 const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\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 if (!isTooltipPinned) {\n transform.current = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);\n }\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","FALLBACK_CHART_WIDTH","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","chartWidth","getWidth","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,oBAAoB,EAAEC,gBAAgB,QAAQ,kBAAkB;AAC5F,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,UAAU;AAC9D,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,cAAc,QAAQ,mBAAmB;AAkBlD,OAAO,MAAMC,iCAAmBd,KAAK,SAASc,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,GAAGvB,SAAS;IACnD,MAAMwB,YAAYzB;IAElB,MAAM0B,WAAWnB;IACjB,MAAM,EAAEoB,MAAM,EAAEC,KAAK,EAAEC,KAAKC,UAAU,EAAE,GAAGzB;IAE3C,MAAM0B,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;IAC9B,MAAMC,aAAaF,OAAOG,cAAc/B,sBAAsB,+CAA+C;IAE7G,MAAMgC,mBAAmBxB,cAAcyB,SAASC,aAAa,CAAC1B,eAAe2B;IAC7E,uHAAuH;IACvH,MAAMC,YAAYJ,mBAAmBA,iBAAiBK,qBAAqB,GAAGhB,MAAM,GAAGc;IAEvF,IAAI,CAACV,iBAAiB;QACpBN,UAAUU,OAAO,GAAG3B,kBAAkBkB,UAAUU,YAAYd,WAAWK,UAAU,GAAGC,SAAS,GAAGU;IAClG;IAEA,uEAAuE;IACvE,MAAMM,eAAelC,oBAAoB;QACvCgB;QACAV;QACAC;QACAK;QACAY;QACAd;QACAG;IACF;IACA,IAAIqB,aAAaC,MAAM,KAAK,GAAG;QAC7B,OAAO;IACT;IAEA,MAAMC,cAAc9B,KAAK6B,MAAM;IAE/B,qBACE,KAAC1C;QAAO4C,WAAWT;kBACjB,cAAA,KAACpC;YACC2B,KAAKC;YACLkB,IAAI,CAACC,QAAUxC,iBAAiBwC,OAAO3B,WAAWoB;YAClDQ,OAAO;gBACLzB,WAAWA,UAAUU,OAAO;YAC9B;sBAEA,cAAA,MAAC/B;gBAAM+C,SAAS;;kCACd,KAACxC;wBACCiC,cAAcA;wBACdE,aAAaA;wBACb5B,eAAeA;wBACfa,iBAAiBA;wBACjBR,eAAeA;wBACf6B,gBAAgB,CAACC,UAAY7B,iBAAiB6B;wBAC9ChC,cAAcA;;kCAEhB,KAACT;wBAAe0C,QAAQV;wBAAczB,YAAYA;;;;;;AAK5D,GAAG"}
@@ -1,7 +1,8 @@
1
+ import { ReactElement } from 'react';
1
2
  import { NearbySeriesArray } from './nearby-series';
2
3
  export interface TooltipContentProps {
3
4
  series: NearbySeriesArray | null;
4
5
  wrapLabels?: boolean;
5
6
  }
6
- export declare function TooltipContent(props: TooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare function TooltipContent(props: TooltipContentProps): ReactElement | null;
7
8
  //# sourceMappingURL=TooltipContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,kDAsCxD"}
1
+ {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CAsC9E"}
@@ -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 { 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) {\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,SAASA,OAAO,QAAQ,QAAQ;AAChC,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 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 +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,0DA2HxB,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,0DAyHxB,CAAC"}
@@ -15,19 +15,15 @@ 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 { format } from 'date-fns';
18
+ import { getDateAndTime } from '../utils';
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
- var _nearbySeries_;
22
- var _nearbySeries__date;
23
- const seriesTimeMs = (_nearbySeries__date = (_nearbySeries_ = nearbySeries[0]) === null || _nearbySeries_ === void 0 ? void 0 : _nearbySeries_.date) !== null && _nearbySeries__date !== void 0 ? _nearbySeries__date : null;
21
+ const seriesTimeMs = nearbySeries[0]?.date ?? null;
24
22
  if (seriesTimeMs === null) {
25
23
  return null;
26
24
  }
27
25
  const formatTimeSeriesHeader = (timeMs)=>{
28
- const date = new Date(timeMs);
29
- const formattedDate = format(date, 'MMM dd, yyyy - ');
30
- const formattedTime = format(date, 'HH:mm:ss');
26
+ const { formattedTime, formattedDate } = getDateAndTime(timeMs);
31
27
  return /*#__PURE__*/ _jsxs(Box, {
32
28
  children: [
33
29
  /*#__PURE__*/ _jsx(Typography, {
@@ -50,19 +46,15 @@ export const TooltipHeader = /*#__PURE__*/ memo(function TooltipHeader({ nearbyS
50
46
  const showAllSeriesToggle = enablePinning && totalSeries > 5;
51
47
  const pinTooltipHelpText = isTooltipPinned ? UNPIN_TOOLTIP_HELP_TEXT : PIN_TOOLTIP_HELP_TEXT;
52
48
  return /*#__PURE__*/ _jsxs(Box, {
53
- sx: (theme)=>{
54
- var _theme_palette_designSystem;
55
- var _theme_palette_designSystem_grey_;
56
- return {
49
+ sx: (theme)=>({
57
50
  width: '100%',
58
51
  maxWidth: TOOLTIP_MAX_WIDTH,
59
52
  padding: theme.spacing(1.5, 2, 0.5, 2),
60
- backgroundColor: (_theme_palette_designSystem_grey_ = (_theme_palette_designSystem = theme.palette.designSystem) === null || _theme_palette_designSystem === void 0 ? void 0 : _theme_palette_designSystem.grey[800]) !== null && _theme_palette_designSystem_grey_ !== void 0 ? _theme_palette_designSystem_grey_ : TOOLTIP_BG_COLOR_FALLBACK,
53
+ backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,
61
54
  position: 'sticky',
62
55
  top: 0,
63
56
  left: 0
64
- };
65
- },
57
+ }),
66
58
  children: [
67
59
  /*#__PURE__*/ _jsxs(Box, {
68
60
  sx: {
@@ -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 } from 'react';\nimport { format } from 'date-fns';\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) => {\n const date = new Date(timeMs);\n const formattedDate = format(date, 'MMM dd, yyyy - ');\n const formattedTime = format(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","format","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","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","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,QAAQ,QAAQ;AAC7B,SAASC,MAAM,QAAQ,WAAW;AAElC,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;QACEN;QAAAA;IAArB,MAAMO,eAAeP,CAAAA,uBAAAA,iBAAAA,YAAY,CAAC,EAAE,cAAfA,qCAAAA,eAAiBQ,IAAI,cAArBR,iCAAAA,sBAAyB;IAC9C,IAAIO,iBAAiB,MAAM;QACzB,OAAO;IACT;IAEA,MAAME,yBAAyB,CAACC;QAC9B,MAAMF,OAAO,IAAIG,KAAKD;QACtB,MAAME,gBAAgBlB,OAAOc,MAAM;QACnC,MAAMK,gBAAgBnB,OAAOc,MAAM;QACnC,qBACE,MAACtB;;8BACC,KAACE;oBACC0B,SAAQ;oBACRC,IAAI,CAACC,QAAW,CAAA;4BACdC,OAAOD,MAAME,OAAO,CAACC,MAAM,CAACC,KAAK;wBACnC,CAAA;8BAECR;;8BAEH,KAACxB;oBAAW0B,SAAQ;8BAClB,cAAA,KAACO;kCAAQR;;;;;IAIjB;IAEA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IAAI;4CACFiC,aAAa;4CACbN,UAAU;4CACVO,eAAe;wCACjB;kDAEC1B;;oCAEFrB,gCACC,KAACX;wCACC2D,SAAS;4CACP,IAAI5C,iBAAiByC,WAAW;gDAC9BzC;4CACF;wCACF;wCACAS,IAAI;4CACF2B,UAAU;4CACVS,QAAQ;wCACV;uDAGF,KAAC3D;wCAAWuB,IAAI;4CAAE2B,UAAU;wCAAG;;;;;;;;0BAMzC,KAACvD;gBACC4B,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 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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BAAMgD,WAAU;wBAAMC,KAAK;wBAAGxB,IAAI;4BAAEyB,YAAY;wBAAO;;4BACrDlB,qCACC,MAAChC;gCAAMgD,WAAU;gCAAMC,KAAK;gCAAKH,YAAW;gCAASrB,IAAI;oCAAE0B,WAAW;gCAAQ;;kDAC5E,KAACpD;wCAAW0B,IAAI;4CAAE2B,UAAU;wCAAG;kDAAG;;kDAClC,KAACnD;wCACCoD,SAASvC;wCACTwC,MAAK;wCACLC,UAAU,CAACC,GAAGH;4CACZ,IAAIrC,mBAAmByC,WAAW;gDAChC,OAAOzC,eAAeqC;4CACxB;wCACF;wCACA5B,IAAI,CAACC,QAAW,CAAA;gDACd,2BAA2B;oDACzBC,OAAOD,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 +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;AA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,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,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,iBAAiB,CAwCpB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAqB,GACtB,EAAE;IACD,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,iBAAiB,CAwCpB;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,CAgBT"}
@@ -22,12 +22,9 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
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
24
  */ export function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, format) {
25
- var _data_;
26
25
  const currentNearbySeriesData = [];
27
- var _pointInGrid_;
28
- const cursorX = (_pointInGrid_ = pointInGrid[0]) !== null && _pointInGrid_ !== void 0 ? _pointInGrid_ : null;
29
- var _pointInGrid_1;
30
- const cursorY = (_pointInGrid_1 = pointInGrid[1]) !== null && _pointInGrid_1 !== void 0 ? _pointInGrid_1 : null;
26
+ const cursorX = pointInGrid[0] ?? null;
27
+ const cursorY = pointInGrid[1] ?? null;
31
28
  if (cursorX === null || cursorY === null) return currentNearbySeriesData;
32
29
  if (chart.dispatchAction === undefined) return currentNearbySeriesData;
33
30
  if (!Array.isArray(data)) return currentNearbySeriesData;
@@ -39,7 +36,7 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
39
36
  const totalSeries = data.length;
40
37
  const yValueCounts = new Map();
41
38
  // Only need to loop through first dataset source since getCommonTimeScale ensures xAxis timestamps are consistent
42
- const firstTimeSeriesValues = (_data_ = data[0]) === null || _data_ === void 0 ? void 0 : _data_.values;
39
+ const firstTimeSeriesValues = data[0]?.values;
43
40
  const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);
44
41
  if (closestTimestamp === null) {
45
42
  return EMPTY_TOOLTIP_DATA;
@@ -47,15 +44,14 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
47
44
  // find the timestamp with data that is closest to cursorX
48
45
  for(let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++){
49
46
  const currentSeries = seriesMapping[seriesIdx];
50
- if (currentSeries === undefined) break;
47
+ if (!currentSeries) break;
51
48
  const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;
52
- if (currentDataset == null) break;
49
+ if (!currentDataset) break;
53
50
  const currentDatasetValues = currentDataset.values;
54
51
  if (currentDatasetValues === undefined || !Array.isArray(currentDatasetValues)) break;
55
52
  const lineSeries = currentSeries;
56
53
  const currentSeriesName = lineSeries.name ? lineSeries.name.toString() : '';
57
- var _lineSeries_color;
58
- const markerColor = (_lineSeries_color = lineSeries.color) !== null && _lineSeries_color !== void 0 ? _lineSeries_color : '#000';
54
+ const markerColor = lineSeries.color ?? '#000';
59
55
  if (Array.isArray(data)) {
60
56
  for(let datumIdx = 0; datumIdx < currentDatasetValues.length; datumIdx++){
61
57
  const nearbyTimeSeries = currentDatasetValues[datumIdx];
@@ -77,10 +73,9 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
77
73
  if (isClosestToCursor) {
78
74
  // shows as bold in tooltip, customize 'emphasis' options in getTimeSeries util
79
75
  emphasizedSeriesIndexes.push(seriesIdx);
80
- var _yValueCounts_get;
81
76
  // Used to determine which datapoint to apply select styles to.
82
77
  // Accounts for cases where lines may be rendered directly on top of eachother.
83
- const duplicateValuesCount = (_yValueCounts_get = yValueCounts.get(yValue)) !== null && _yValueCounts_get !== void 0 ? _yValueCounts_get : 0;
78
+ const duplicateValuesCount = yValueCounts.get(yValue) ?? 0;
84
79
  yValueCounts.set(yValue, duplicateValuesCount + 1);
85
80
  if (duplicateValuesCount > 0) {
86
81
  duplicateDatapoints.push({
@@ -132,10 +127,8 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
132
127
  * Adjust yBuffer to increase or decrease number of series shown
133
128
  */ export function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, format) {
134
129
  const currentNearbySeriesData = [];
135
- var _pointInGrid_;
136
- const cursorX = (_pointInGrid_ = pointInGrid[0]) !== null && _pointInGrid_ !== void 0 ? _pointInGrid_ : null;
137
- var _pointInGrid_1;
138
- const cursorY = (_pointInGrid_1 = pointInGrid[1]) !== null && _pointInGrid_1 !== void 0 ? _pointInGrid_1 : null;
130
+ const cursorX = pointInGrid[0] ?? null;
131
+ const cursorY = pointInGrid[1] ?? null;
139
132
  if (cursorX === null || cursorY === null) {
140
133
  return currentNearbySeriesData;
141
134
  }
@@ -149,12 +142,10 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
149
142
  if (currentSeries === undefined) break;
150
143
  if (currentNearbySeriesData.length >= OPTIMIZED_MODE_SERIES_LIMIT) break;
151
144
  const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';
152
- var _currentSeries_color;
153
- const markerColor = (_currentSeries_color = currentSeries.color) !== null && _currentSeries_color !== void 0 ? _currentSeries_color : '#000';
145
+ const markerColor = currentSeries.color ?? '#000';
154
146
  if (Array.isArray(currentSeries.data)) {
155
147
  for(let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++){
156
- var _data_xAxis_datumIdx;
157
- const xValue = (_data_xAxis_datumIdx = data.xAxis[datumIdx]) !== null && _data_xAxis_datumIdx !== void 0 ? _data_xAxis_datumIdx : 0;
148
+ const xValue = data.xAxis[datumIdx] ?? 0;
158
149
  const yValue = currentSeries.data[datumIdx];
159
150
  // ensure null values not displayed in tooltip
160
151
  if (yValue !== undefined && yValue !== null && cursorX === datumIdx) {
@@ -172,7 +163,7 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
172
163
  } else {
173
164
  nonEmphasizedSeriesIndexes.push(seriesIdx);
174
165
  // ensure series not close to cursor are not highlighted
175
- if ((chart === null || chart === void 0 ? void 0 : chart.dispatchAction) !== undefined) {
166
+ if (chart?.dispatchAction !== undefined) {
176
167
  chart.dispatchAction({
177
168
  type: 'downplay',
178
169
  seriesIndex: seriesIdx
@@ -200,7 +191,7 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
200
191
  }
201
192
  }
202
193
  }
203
- if ((chart === null || chart === void 0 ? void 0 : chart.dispatchAction) !== undefined) {
194
+ if (chart?.dispatchAction !== undefined) {
204
195
  // Clears emphasis state of all lines that are not emphasized.
205
196
  // Emphasized is a subset of just the nearby series that are closest to cursor.
206
197
  chart.dispatchAction({
@@ -304,10 +295,9 @@ export const SHOW_FEWER_SERIES_LIMIT = 5;
304
295
  totalSeries,
305
296
  showAllSeries
306
297
  });
307
- var _mousePos_plotCanvas_x, _mousePos_plotCanvas_y;
308
298
  const pointInPixel = [
309
- (_mousePos_plotCanvas_x = mousePos.plotCanvas.x) !== null && _mousePos_plotCanvas_x !== void 0 ? _mousePos_plotCanvas_x : 0,
310
- (_mousePos_plotCanvas_y = mousePos.plotCanvas.y) !== null && _mousePos_plotCanvas_y !== void 0 ? _mousePos_plotCanvas_y : 0
299
+ mousePos.plotCanvas.x ?? 0,
300
+ mousePos.plotCanvas.y ?? 0
311
301
  ];
312
302
  if (chart.containPixel('grid', pointInPixel)) {
313
303
  const pointInGrid = chart.convertFromPixel('grid', pointInPixel);