@perses-dev/components 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-datasource-browser-test-28cbb71

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 (400) hide show
  1. package/README.md +2 -3
  2. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +2 -1
  3. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  4. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +88 -51
  5. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  6. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  7. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  8. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  9. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  10. package/dist/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  11. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  12. package/dist/DateTimeRangePicker/index.js +1 -1
  13. package/dist/DateTimeRangePicker/index.js.map +1 -1
  14. package/dist/DateTimeRangePicker/utils.js +1 -1
  15. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  16. package/dist/Dialog/Dialog.d.ts +24 -0
  17. package/dist/Dialog/Dialog.d.ts.map +1 -0
  18. package/dist/Dialog/Dialog.js +74 -0
  19. package/dist/Dialog/Dialog.js.map +1 -0
  20. package/dist/Dialog/index.d.ts +2 -0
  21. package/dist/Dialog/index.d.ts.map +1 -0
  22. package/dist/{Tooltip → Dialog}/index.js +2 -3
  23. package/dist/{Tooltip → Dialog}/index.js.map +1 -1
  24. package/dist/Drawer/Drawer.js +1 -1
  25. package/dist/Drawer/Drawer.js.map +1 -1
  26. package/dist/Drawer/index.js +1 -1
  27. package/dist/Drawer/index.js.map +1 -1
  28. package/dist/EChart.d.ts.map +1 -1
  29. package/dist/EChart.js +2 -3
  30. package/dist/EChart.js.map +1 -1
  31. package/dist/ErrorAlert.js +1 -1
  32. package/dist/ErrorAlert.js.map +1 -1
  33. package/dist/ErrorBoundary.js +1 -1
  34. package/dist/ErrorBoundary.js.map +1 -1
  35. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  36. package/dist/GaugeChart/GaugeChart.js +3 -2
  37. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  38. package/dist/GaugeChart/index.js +1 -1
  39. package/dist/GaugeChart/index.js.map +1 -1
  40. package/dist/InfoTooltip/InfoTooltip.d.ts +1 -6
  41. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  42. package/dist/InfoTooltip/InfoTooltip.js +2 -9
  43. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  44. package/dist/InfoTooltip/InfoTooltip.test.js +1 -1
  45. package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -1
  46. package/dist/InfoTooltip/index.js +1 -1
  47. package/dist/InfoTooltip/index.js.map +1 -1
  48. package/dist/JSONEditor.js +1 -1
  49. package/dist/JSONEditor.js.map +1 -1
  50. package/dist/Legend/CompactLegend.js +1 -1
  51. package/dist/Legend/CompactLegend.js.map +1 -1
  52. package/dist/Legend/Legend.d.ts.map +1 -1
  53. package/dist/Legend/Legend.js +17 -6
  54. package/dist/Legend/Legend.js.map +1 -1
  55. package/dist/Legend/LegendColorBadge.js +1 -1
  56. package/dist/Legend/LegendColorBadge.js.map +1 -1
  57. package/dist/Legend/ListLegend.js +1 -1
  58. package/dist/Legend/ListLegend.js.map +1 -1
  59. package/dist/Legend/ListLegendItem.js +1 -1
  60. package/dist/Legend/ListLegendItem.js.map +1 -1
  61. package/dist/Legend/index.js +1 -1
  62. package/dist/Legend/index.js.map +1 -1
  63. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  64. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  65. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  66. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  67. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +1 -1
  68. package/dist/LegendOptionsEditor/index.js +1 -1
  69. package/dist/LegendOptionsEditor/index.js.map +1 -1
  70. package/dist/LineChart/LineChart.js +3 -3
  71. package/dist/LineChart/LineChart.js.map +1 -1
  72. package/dist/LineChart/index.js +1 -1
  73. package/dist/LineChart/index.js.map +1 -1
  74. package/dist/LineChart/utils.js +2 -2
  75. package/dist/LineChart/utils.js.map +1 -1
  76. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  77. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  78. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  79. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  80. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  81. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  82. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  83. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  84. package/dist/OptionsEditorLayout/index.js +1 -1
  85. package/dist/OptionsEditorLayout/index.js.map +1 -1
  86. package/dist/StatChart/StatChart.d.ts.map +1 -1
  87. package/dist/StatChart/StatChart.js +22 -13
  88. package/dist/StatChart/StatChart.js.map +1 -1
  89. package/dist/StatChart/StatChart.test.js +1 -1
  90. package/dist/StatChart/StatChart.test.js.map +1 -1
  91. package/dist/StatChart/index.js +1 -1
  92. package/dist/StatChart/index.js.map +1 -1
  93. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesInfo.d.ts +1 -2
  94. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -0
  95. package/dist/TimeSeriesTooltip/SeriesInfo.js +89 -0
  96. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
  97. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts +2 -0
  98. package/dist/TimeSeriesTooltip/SeriesInfo.test.d.ts.map +1 -0
  99. package/dist/TimeSeriesTooltip/SeriesInfo.test.js +52 -0
  100. package/dist/TimeSeriesTooltip/SeriesInfo.test.js.map +1 -0
  101. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +9 -0
  102. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -0
  103. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +99 -0
  104. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
  105. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.d.ts +2 -1
  106. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -0
  107. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  108. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
  109. package/dist/{Tooltip/Tooltip.d.ts → TimeSeriesTooltip/TimeSeriesTooltip.d.ts} +4 -4
  110. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -0
  111. package/dist/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +3 -4
  112. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -0
  113. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.d.ts +1 -2
  114. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -0
  115. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  116. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -0
  117. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts +2 -0
  118. package/dist/TimeSeriesTooltip/TooltipContent.test.d.ts.map +1 -0
  119. package/dist/TimeSeriesTooltip/TooltipContent.test.js +78 -0
  120. package/dist/TimeSeriesTooltip/TooltipContent.test.js.map +1 -0
  121. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
  122. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -0
  123. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  124. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -0
  125. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.d.ts +0 -0
  126. package/dist/TimeSeriesTooltip/focused-series.test.d.ts.map +1 -0
  127. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  128. package/dist/TimeSeriesTooltip/focused-series.test.js.map +1 -0
  129. package/dist/TimeSeriesTooltip/index.d.ts +9 -0
  130. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -0
  131. package/dist/TimeSeriesTooltip/index.js +22 -0
  132. package/dist/TimeSeriesTooltip/index.js.map +1 -0
  133. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
  134. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -0
  135. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  136. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -0
  137. package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
  138. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -0
  139. package/dist/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  140. package/dist/TimeSeriesTooltip/utils.js.map +1 -0
  141. package/dist/UnitSelector/UnitSelector.js +1 -1
  142. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  143. package/dist/UnitSelector/UnitSelector.test.js +1 -1
  144. package/dist/UnitSelector/UnitSelector.test.js.map +1 -1
  145. package/dist/UnitSelector/index.js +1 -1
  146. package/dist/UnitSelector/index.js.map +1 -1
  147. package/dist/YAxisLabel.js +1 -1
  148. package/dist/YAxisLabel.js.map +1 -1
  149. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +87 -50
  150. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  151. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  152. package/dist/cjs/DateTimeRangePicker/index.js +1 -1
  153. package/dist/cjs/DateTimeRangePicker/utils.js +1 -1
  154. package/dist/cjs/Dialog/Dialog.js +85 -0
  155. package/dist/cjs/{Tooltip → Dialog}/index.js +2 -3
  156. package/dist/cjs/Drawer/Drawer.js +1 -1
  157. package/dist/cjs/Drawer/index.js +1 -1
  158. package/dist/cjs/EChart.js +5 -11
  159. package/dist/cjs/ErrorAlert.js +1 -1
  160. package/dist/cjs/ErrorBoundary.js +1 -1
  161. package/dist/cjs/GaugeChart/GaugeChart.js +3 -2
  162. package/dist/cjs/GaugeChart/index.js +1 -1
  163. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
  164. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +1 -1
  165. package/dist/cjs/InfoTooltip/index.js +1 -1
  166. package/dist/cjs/JSONEditor.js +1 -1
  167. package/dist/cjs/Legend/CompactLegend.js +1 -1
  168. package/dist/cjs/Legend/Legend.js +16 -5
  169. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  170. package/dist/cjs/Legend/ListLegend.js +1 -1
  171. package/dist/cjs/Legend/ListLegendItem.js +1 -1
  172. package/dist/cjs/Legend/index.js +1 -1
  173. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  174. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +23 -2
  175. package/dist/cjs/LegendOptionsEditor/index.js +1 -1
  176. package/dist/cjs/LineChart/LineChart.js +3 -3
  177. package/dist/cjs/LineChart/index.js +1 -1
  178. package/dist/cjs/LineChart/utils.js +3 -8
  179. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  180. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  181. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  182. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  183. package/dist/cjs/OptionsEditorLayout/index.js +1 -1
  184. package/dist/cjs/StatChart/StatChart.js +23 -19
  185. package/dist/cjs/StatChart/StatChart.test.js +1 -1
  186. package/dist/cjs/StatChart/index.js +1 -1
  187. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -0
  188. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.test.js +54 -0
  189. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +105 -0
  190. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  191. package/dist/cjs/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +4 -4
  192. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  193. package/dist/cjs/TimeSeriesTooltip/TooltipContent.test.js +80 -0
  194. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.js +3 -3
  195. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.test.js +1 -1
  196. package/dist/cjs/TimeSeriesTooltip/index.js +35 -0
  197. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  198. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  199. package/dist/cjs/UnitSelector/UnitSelector.js +1 -1
  200. package/dist/cjs/UnitSelector/UnitSelector.test.js +1 -1
  201. package/dist/cjs/UnitSelector/index.js +1 -1
  202. package/dist/cjs/YAxisLabel.js +1 -1
  203. package/dist/cjs/context/ChartsThemeProvider.js +1 -1
  204. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  205. package/dist/cjs/index.js +3 -1
  206. package/dist/cjs/model/graph.js +4 -15
  207. package/dist/cjs/model/index.js +2 -1
  208. package/dist/cjs/model/legend.js +67 -0
  209. package/dist/cjs/model/legend.test.js +29 -0
  210. package/dist/cjs/model/theme.js +1 -1
  211. package/dist/cjs/model/units/bytes.js +1 -1
  212. package/dist/cjs/model/units/constants.js +1 -1
  213. package/dist/cjs/model/units/decimal.js +5 -2
  214. package/dist/cjs/model/units/index.js +1 -1
  215. package/dist/cjs/model/units/percent.js +1 -1
  216. package/dist/cjs/model/units/time.js +1 -1
  217. package/dist/cjs/model/units/types.js +1 -1
  218. package/dist/cjs/model/units/units.js +1 -1
  219. package/dist/cjs/model/units/units.test.js +59 -6
  220. package/dist/cjs/test/index.js +1 -1
  221. package/dist/cjs/test/render.js +1 -1
  222. package/dist/cjs/test/setup-tests.js +1 -1
  223. package/dist/cjs/test-utils/index.js +1 -1
  224. package/dist/cjs/test-utils/theme.js +6 -1
  225. package/dist/cjs/theme/index.js +1 -1
  226. package/dist/cjs/theme/palette/background.js +1 -1
  227. package/dist/cjs/theme/palette/colors/blue.js +1 -1
  228. package/dist/cjs/theme/palette/colors/common.js +1 -1
  229. package/dist/cjs/theme/palette/colors/green.js +1 -1
  230. package/dist/cjs/theme/palette/colors/grey.js +1 -1
  231. package/dist/cjs/theme/palette/colors/index.js +1 -1
  232. package/dist/cjs/theme/palette/colors/orange.js +1 -1
  233. package/dist/cjs/theme/palette/colors/purple.js +1 -1
  234. package/dist/cjs/theme/palette/colors/red.js +1 -1
  235. package/dist/cjs/theme/palette/colors/types.js +1 -1
  236. package/dist/cjs/theme/palette/error.js +1 -1
  237. package/dist/cjs/theme/palette/grey.js +1 -1
  238. package/dist/cjs/theme/palette/index.js +1 -1
  239. package/dist/cjs/theme/palette/palette-options.js +1 -1
  240. package/dist/cjs/theme/palette/primary.js +1 -1
  241. package/dist/cjs/theme/palette/secondary.js +1 -1
  242. package/dist/cjs/theme/palette/success.js +1 -1
  243. package/dist/cjs/theme/palette/text.js +1 -1
  244. package/dist/cjs/theme/palette/warning.js +1 -1
  245. package/dist/cjs/theme/theme.js +12 -1
  246. package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
  247. package/dist/cjs/theme/typography.js +5 -1
  248. package/dist/cjs/utils/combine-sx.js +1 -1
  249. package/dist/cjs/utils/component-ids.js +1 -1
  250. package/dist/cjs/utils/format.js +1 -1
  251. package/dist/cjs/utils/format.test.js +1 -1
  252. package/dist/cjs/utils/index.js +1 -1
  253. package/dist/cjs/utils/mathjs.js +1 -1
  254. package/dist/cjs/utils/theme-gen.js +8 -8
  255. package/dist/cjs/utils/theme-gen.test.js +6 -1
  256. package/dist/context/ChartsThemeProvider.js +1 -1
  257. package/dist/context/ChartsThemeProvider.js.map +1 -1
  258. package/dist/context/TimeZoneProvider.js +1 -1
  259. package/dist/context/TimeZoneProvider.js.map +1 -1
  260. package/dist/index.d.ts +2 -0
  261. package/dist/index.d.ts.map +1 -1
  262. package/dist/index.js +3 -1
  263. package/dist/index.js.map +1 -1
  264. package/dist/model/graph.d.ts +1 -16
  265. package/dist/model/graph.d.ts.map +1 -1
  266. package/dist/model/graph.js +1 -5
  267. package/dist/model/graph.js.map +1 -1
  268. package/dist/model/index.d.ts +1 -0
  269. package/dist/model/index.d.ts.map +1 -1
  270. package/dist/model/index.js +2 -1
  271. package/dist/model/index.js.map +1 -1
  272. package/dist/model/legend.d.ts +22 -0
  273. package/dist/model/legend.d.ts.map +1 -0
  274. package/dist/model/legend.js +51 -0
  275. package/dist/model/legend.js.map +1 -0
  276. package/dist/model/legend.test.d.ts +2 -0
  277. package/dist/model/legend.test.d.ts.map +1 -0
  278. package/dist/model/legend.test.js +27 -0
  279. package/dist/model/legend.test.js.map +1 -0
  280. package/dist/model/theme.d.ts +11 -0
  281. package/dist/model/theme.d.ts.map +1 -1
  282. package/dist/model/theme.js +1 -1
  283. package/dist/model/theme.js.map +1 -1
  284. package/dist/model/units/bytes.js +1 -1
  285. package/dist/model/units/bytes.js.map +1 -1
  286. package/dist/model/units/constants.js +1 -1
  287. package/dist/model/units/constants.js.map +1 -1
  288. package/dist/model/units/decimal.d.ts.map +1 -1
  289. package/dist/model/units/decimal.js +5 -2
  290. package/dist/model/units/decimal.js.map +1 -1
  291. package/dist/model/units/index.js +1 -1
  292. package/dist/model/units/index.js.map +1 -1
  293. package/dist/model/units/percent.js +1 -1
  294. package/dist/model/units/percent.js.map +1 -1
  295. package/dist/model/units/time.js +1 -1
  296. package/dist/model/units/time.js.map +1 -1
  297. package/dist/model/units/types.js +1 -1
  298. package/dist/model/units/types.js.map +1 -1
  299. package/dist/model/units/units.js +1 -1
  300. package/dist/model/units/units.js.map +1 -1
  301. package/dist/model/units/units.test.js +59 -6
  302. package/dist/model/units/units.test.js.map +1 -1
  303. package/dist/test/index.js +1 -1
  304. package/dist/test/index.js.map +1 -1
  305. package/dist/test/render.js +1 -1
  306. package/dist/test/render.js.map +1 -1
  307. package/dist/test/setup-tests.js +1 -1
  308. package/dist/test/setup-tests.js.map +1 -1
  309. package/dist/test-utils/index.js +1 -1
  310. package/dist/test-utils/index.js.map +1 -1
  311. package/dist/test-utils/theme.d.ts.map +1 -1
  312. package/dist/test-utils/theme.js +6 -1
  313. package/dist/test-utils/theme.js.map +1 -1
  314. package/dist/theme/index.js +1 -1
  315. package/dist/theme/index.js.map +1 -1
  316. package/dist/theme/palette/background.js +1 -1
  317. package/dist/theme/palette/background.js.map +1 -1
  318. package/dist/theme/palette/colors/blue.js +1 -1
  319. package/dist/theme/palette/colors/blue.js.map +1 -1
  320. package/dist/theme/palette/colors/common.js +1 -1
  321. package/dist/theme/palette/colors/common.js.map +1 -1
  322. package/dist/theme/palette/colors/green.js +1 -1
  323. package/dist/theme/palette/colors/green.js.map +1 -1
  324. package/dist/theme/palette/colors/grey.js +1 -1
  325. package/dist/theme/palette/colors/grey.js.map +1 -1
  326. package/dist/theme/palette/colors/index.js +1 -1
  327. package/dist/theme/palette/colors/index.js.map +1 -1
  328. package/dist/theme/palette/colors/orange.js +1 -1
  329. package/dist/theme/palette/colors/orange.js.map +1 -1
  330. package/dist/theme/palette/colors/purple.js +1 -1
  331. package/dist/theme/palette/colors/purple.js.map +1 -1
  332. package/dist/theme/palette/colors/red.js +1 -1
  333. package/dist/theme/palette/colors/red.js.map +1 -1
  334. package/dist/theme/palette/colors/types.js +1 -1
  335. package/dist/theme/palette/colors/types.js.map +1 -1
  336. package/dist/theme/palette/error.js +1 -1
  337. package/dist/theme/palette/error.js.map +1 -1
  338. package/dist/theme/palette/grey.js +1 -1
  339. package/dist/theme/palette/grey.js.map +1 -1
  340. package/dist/theme/palette/index.js +1 -1
  341. package/dist/theme/palette/index.js.map +1 -1
  342. package/dist/theme/palette/palette-options.js +1 -1
  343. package/dist/theme/palette/palette-options.js.map +1 -1
  344. package/dist/theme/palette/primary.js +1 -1
  345. package/dist/theme/palette/primary.js.map +1 -1
  346. package/dist/theme/palette/secondary.js +1 -1
  347. package/dist/theme/palette/secondary.js.map +1 -1
  348. package/dist/theme/palette/success.js +1 -1
  349. package/dist/theme/palette/success.js.map +1 -1
  350. package/dist/theme/palette/text.js +1 -1
  351. package/dist/theme/palette/text.js.map +1 -1
  352. package/dist/theme/palette/warning.js +1 -1
  353. package/dist/theme/palette/warning.js.map +1 -1
  354. package/dist/theme/theme.d.ts.map +1 -1
  355. package/dist/theme/theme.js +13 -2
  356. package/dist/theme/theme.js.map +1 -1
  357. package/dist/theme/types/ThemeExtension.d.js +1 -1
  358. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  359. package/dist/theme/typography.d.ts +4 -0
  360. package/dist/theme/typography.d.ts.map +1 -1
  361. package/dist/theme/typography.js +5 -1
  362. package/dist/theme/typography.js.map +1 -1
  363. package/dist/utils/combine-sx.js +1 -1
  364. package/dist/utils/combine-sx.js.map +1 -1
  365. package/dist/utils/component-ids.js +1 -1
  366. package/dist/utils/component-ids.js.map +1 -1
  367. package/dist/utils/format.js +1 -1
  368. package/dist/utils/format.js.map +1 -1
  369. package/dist/utils/format.test.js +1 -1
  370. package/dist/utils/format.test.js.map +1 -1
  371. package/dist/utils/index.js +1 -1
  372. package/dist/utils/index.js.map +1 -1
  373. package/dist/utils/mathjs.js +1 -1
  374. package/dist/utils/mathjs.js.map +1 -1
  375. package/dist/utils/theme-gen.d.ts.map +1 -1
  376. package/dist/utils/theme-gen.js +7 -2
  377. package/dist/utils/theme-gen.js.map +1 -1
  378. package/dist/utils/theme-gen.test.js +6 -1
  379. package/dist/utils/theme-gen.test.js.map +1 -1
  380. package/package.json +4 -3
  381. package/dist/Tooltip/SeriesInfo.d.ts.map +0 -1
  382. package/dist/Tooltip/SeriesInfo.js +0 -143
  383. package/dist/Tooltip/SeriesInfo.js.map +0 -1
  384. package/dist/Tooltip/SeriesMarker.d.ts.map +0 -1
  385. package/dist/Tooltip/SeriesMarker.js.map +0 -1
  386. package/dist/Tooltip/Tooltip.d.ts.map +0 -1
  387. package/dist/Tooltip/Tooltip.js.map +0 -1
  388. package/dist/Tooltip/TooltipContent.d.ts.map +0 -1
  389. package/dist/Tooltip/TooltipContent.js.map +0 -1
  390. package/dist/Tooltip/focused-series.d.ts.map +0 -1
  391. package/dist/Tooltip/focused-series.js.map +0 -1
  392. package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
  393. package/dist/Tooltip/focused-series.test.js.map +0 -1
  394. package/dist/Tooltip/index.d.ts +0 -3
  395. package/dist/Tooltip/index.d.ts.map +0 -1
  396. package/dist/Tooltip/tooltip-model.d.ts.map +0 -1
  397. package/dist/Tooltip/tooltip-model.js.map +0 -1
  398. package/dist/Tooltip/utils.d.ts.map +0 -1
  399. package/dist/Tooltip/utils.js.map +0 -1
  400. package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/StatChart.test.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, screen } from '@testing-library/react';\nimport { ChartsThemeProvider } from '../context/ChartsThemeProvider';\nimport { UnitOptions } from '../model';\nimport { testChartsTheme } from '../test-utils';\nimport { StatChart, StatChartData } from './StatChart';\n\ndescribe('StatChart', () => {\n const renderChart = (unit: UnitOptions) => {\n const contentDimensions = {\n width: 200,\n height: 200,\n };\n render(\n <ChartsThemeProvider chartsTheme={testChartsTheme}>\n <StatChart width={contentDimensions.width} height={contentDimensions.height} data={mockStatData} unit={unit} />\n </ChartsThemeProvider>\n );\n };\n\n const mockStatData: StatChartData = {\n calculatedValue: 7.72931659687181,\n name: 'Example Stat Chart',\n seriesData: {\n name: '(((count(count(node_cpu_seconds_total{job=\"example\"}) by (cpu))',\n values: [\n [1654006170000, 7.736401673473903],\n [1654006185000, 7.733891213538757],\n [1654006200000, 7.731101813010433],\n [1654006215000, 7.722454672079215],\n [1654006230000, 7.722733612256738],\n ],\n },\n };\n\n it('render default options (no sparkline)', () => {\n const unit: UnitOptions = {\n kind: 'Decimal',\n decimal_places: 2,\n };\n renderChart(unit);\n expect(screen.getByText('7.73')).toBeInTheDocument();\n });\n\n it('show value with bytes unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Bytes',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 bytes')).toBeInTheDocument();\n });\n\n it('show value with seconds time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Seconds',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 seconds')).toBeInTheDocument();\n });\n\n it('show value with months time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Months',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 months')).toBeInTheDocument();\n });\n});\n"],"names":["render","screen","ChartsThemeProvider","testChartsTheme","StatChart","describe","renderChart","unit","contentDimensions","width","height","chartsTheme","data","mockStatData","calculatedValue","name","seriesData","values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C,EAAE,IAAM;QAChD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,SAAS;YACfC,cAAc,EAAE,CAAC;SAClB,AAAC;QACFd,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,MAAM,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,uCAAuC,EAAE,IAAM;QAChD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,OAAO;SACd,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,YAAY,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,8CAA8C,EAAE,IAAM;QACvD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,SAAS;SAChB,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,cAAc,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,6CAA6C,EAAE,IAAM;QACtD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,QAAQ;SACf,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,aAAa,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/StatChart/StatChart.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render, screen } from '@testing-library/react';\nimport { ChartsThemeProvider } from '../context/ChartsThemeProvider';\nimport { UnitOptions } from '../model';\nimport { testChartsTheme } from '../test-utils';\nimport { StatChart, StatChartData } from './StatChart';\n\ndescribe('StatChart', () => {\n const renderChart = (unit: UnitOptions) => {\n const contentDimensions = {\n width: 200,\n height: 200,\n };\n render(\n <ChartsThemeProvider chartsTheme={testChartsTheme}>\n <StatChart width={contentDimensions.width} height={contentDimensions.height} data={mockStatData} unit={unit} />\n </ChartsThemeProvider>\n );\n };\n\n const mockStatData: StatChartData = {\n calculatedValue: 7.72931659687181,\n name: 'Example Stat Chart',\n seriesData: {\n name: '(((count(count(node_cpu_seconds_total{job=\"example\"}) by (cpu))',\n values: [\n [1654006170000, 7.736401673473903],\n [1654006185000, 7.733891213538757],\n [1654006200000, 7.731101813010433],\n [1654006215000, 7.722454672079215],\n [1654006230000, 7.722733612256738],\n ],\n },\n };\n\n it('render default options (no sparkline)', () => {\n const unit: UnitOptions = {\n kind: 'Decimal',\n decimal_places: 2,\n };\n renderChart(unit);\n expect(screen.getByText('7.73')).toBeInTheDocument();\n });\n\n it('show value with bytes unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Bytes',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 bytes')).toBeInTheDocument();\n });\n\n it('show value with seconds time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Seconds',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 seconds')).toBeInTheDocument();\n });\n\n it('show value with months time unit formatting', () => {\n const unit: UnitOptions = {\n kind: 'Months',\n };\n renderChart(unit);\n expect(screen.getByText('7.73 months')).toBeInTheDocument();\n });\n});\n"],"names":["render","screen","ChartsThemeProvider","testChartsTheme","StatChart","describe","renderChart","unit","contentDimensions","width","height","chartsTheme","data","mockStatData","calculatedValue","name","seriesData","values","it","kind","decimal_places","expect","getByText","toBeInTheDocument"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,wBAAwB,CAAC;AACxD,SAASC,mBAAmB,QAAQ,gCAAgC,CAAC;AAErE,SAASC,eAAe,QAAQ,eAAe,CAAC;AAChD,SAASC,SAAS,QAAuB,aAAa,CAAC;AAEvDC,QAAQ,CAAC,WAAW,EAAE,IAAM;IAC1B,MAAMC,WAAW,GAAG,CAACC,IAAiB,GAAK;QACzC,MAAMC,iBAAiB,GAAG;YACxBC,KAAK,EAAE,GAAG;YACVC,MAAM,EAAE,GAAG;SACZ,AAAC;QACFV,MAAM,eACJ,KAACE,mBAAmB;YAACS,WAAW,EAAER,eAAe;sBAC/C,cAAA,KAACC,SAAS;gBAACK,KAAK,EAAED,iBAAiB,CAACC,KAAK;gBAAEC,MAAM,EAAEF,iBAAiB,CAACE,MAAM;gBAAEE,IAAI,EAAEC,YAAY;gBAAEN,IAAI,EAAEA,IAAI;cAAI;UAC3F,CACvB,CAAC;IACJ,CAAC,AAAC;IAEF,MAAMM,YAAY,GAAkB;QAClCC,eAAe,EAAE,gBAAgB;QACjCC,IAAI,EAAE,oBAAoB;QAC1BC,UAAU,EAAE;YACVD,IAAI,EAAE,iEAAiE;YACvEE,MAAM,EAAE;gBACN;AAAC,iCAAa;AAAE,qCAAiB;iBAAC;gBAClC;AAAC,iCAAa;AAAE,qCAAiB;iBAAC;gBAClC;AAAC,iCAAa;AAAE,qCAAiB;iBAAC;gBAClC;AAAC,iCAAa;AAAE,qCAAiB;iBAAC;gBAClC;AAAC,iCAAa;AAAE,qCAAiB;iBAAC;aACnC;SACF;KACF,AAAC;IAEFC,EAAE,CAAC,uCAAuC,EAAE,IAAM;QAChD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,SAAS;YACfC,cAAc,EAAE,CAAC;SAClB,AAAC;QACFd,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,MAAM,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,uCAAuC,EAAE,IAAM;QAChD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,OAAO;SACd,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,YAAY,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,8CAA8C,EAAE,IAAM;QACvD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,SAAS;SAChB,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,cAAc,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEHL,EAAE,CAAC,6CAA6C,EAAE,IAAM;QACtD,MAAMX,IAAI,GAAgB;YACxBY,IAAI,EAAE,QAAQ;SACf,AAAC;QACFb,WAAW,CAACC,IAAI,CAAC,CAAC;QAClBc,MAAM,CAACpB,MAAM,CAACqB,SAAS,CAAC,aAAa,CAAC,CAAC,CAACC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './StatChart';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/StatChart/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './StatChart';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- interface SeriesInfoProps {
2
+ export interface SeriesInfoProps {
3
3
  seriesName: string;
4
4
  y: number;
5
5
  formattedY: string;
@@ -8,5 +8,4 @@ interface SeriesInfoProps {
8
8
  wrapLabels?: boolean;
9
9
  }
10
10
  export declare function SeriesInfo(props: SeriesInfoProps): JSX.Element;
11
- export {};
12
11
  //# sourceMappingURL=SeriesInfo.d.ts.map
@@ -0,0 +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,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuEhD"}
@@ -0,0 +1,89 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Box } from '@mui/material';
15
+ import { SeriesMarker } from './SeriesMarker';
16
+ import { SeriesLabelsStack } from './SeriesLabelsStack';
17
+ import { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';
18
+ export function SeriesInfo(props) {
19
+ const { seriesName , formattedY , markerColor , totalSeries , wrapLabels } = props;
20
+ // metric __name__ comes before opening curly brace, ignore if not populated
21
+ // ex with metric name: node_load15{env="demo",job="node"}
22
+ // ex without metric name: {env="demo",job="node"}
23
+ const splitName = seriesName.split('{');
24
+ var ref;
25
+ const seriesLabels = (ref = splitName[1]) !== null && ref !== void 0 ? ref : seriesName;
26
+ // remove curly braces that wrap labels
27
+ const formattedSeriesLabels = seriesLabels.replace(/[{}]/g, '');
28
+ // determine whether to show labels on separate lines
29
+ const splitLabels = formattedSeriesLabels.split(',');
30
+ if (totalSeries === 1 && splitLabels.length > 1) {
31
+ const metricName = splitName[0] ? `${splitName[0]}:` : 'value:';
32
+ return /*#__PURE__*/ _jsx(SeriesLabelsStack, {
33
+ formattedY: formattedY,
34
+ metricName: metricName,
35
+ metricLabels: splitLabels,
36
+ markerColor: markerColor
37
+ });
38
+ }
39
+ // add space after commas when more than one focused series
40
+ const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');
41
+ return /*#__PURE__*/ _jsxs(Box, {
42
+ sx: {
43
+ display: 'table-row',
44
+ paddingTop: 0.5
45
+ },
46
+ children: [
47
+ /*#__PURE__*/ _jsxs(Box, {
48
+ sx: {
49
+ display: 'table-cell',
50
+ maxWidth: '520px'
51
+ },
52
+ children: [
53
+ /*#__PURE__*/ _jsx(SeriesMarker, {
54
+ markerColor: markerColor,
55
+ sx: {
56
+ marginTop: 0.5
57
+ }
58
+ }),
59
+ /*#__PURE__*/ _jsx(Box, {
60
+ component: "span",
61
+ sx: (theme)=>({
62
+ display: 'inline-block',
63
+ width: 'calc(100% - 20px)',
64
+ minWidth: 150,
65
+ maxWidth: TOOLTIP_LABELS_MAX_WIDTH,
66
+ overflow: 'hidden',
67
+ color: theme.palette.common.white,
68
+ textOverflow: 'ellipsis',
69
+ whiteSpace: wrapLabels ? 'normal' : 'nowrap'
70
+ }),
71
+ children: inlineSeriesLabels
72
+ })
73
+ ]
74
+ }),
75
+ /*#__PURE__*/ _jsx(Box, {
76
+ sx: {
77
+ display: 'table-cell',
78
+ paddingLeft: 1.5,
79
+ textAlign: 'right',
80
+ verticalAlign: 'top',
81
+ fontWeight: '700'
82
+ },
83
+ children: formattedY
84
+ })
85
+ ]
86
+ });
87
+ }
88
+
89
+ //# sourceMappingURL=SeriesInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { SeriesMarker } from './SeriesMarker';\nimport { SeriesLabelsStack } from './SeriesLabelsStack';\nimport { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';\n\nexport interface SeriesInfoProps {\n seriesName: string;\n y: number;\n formattedY: string;\n markerColor: string;\n totalSeries: number;\n wrapLabels?: boolean;\n}\n\nexport function SeriesInfo(props: SeriesInfoProps) {\n const { seriesName, formattedY, markerColor, totalSeries, wrapLabels } = 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 when more than one focused series\n const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ');\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 textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n })}\n >\n {inlineSeriesLabels}\n </Box>\n </Box>\n <Box\n sx={{\n display: 'table-cell',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n fontWeight: '700',\n }}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","SeriesMarker","SeriesLabelsStack","TOOLTIP_LABELS_MAX_WIDTH","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","wrapLabels","splitName","split","seriesLabels","formattedSeriesLabels","replace","splitLabels","length","metricName","metricLabels","inlineSeriesLabels","sx","display","paddingTop","maxWidth","marginTop","component","theme","width","minWidth","overflow","color","palette","common","white","textOverflow","whiteSpace","paddingLeft","textAlign","verticalAlign","fontWeight"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAC9C,SAASC,iBAAiB,QAAQ,qBAAqB,CAAC;AACxD,SAASC,wBAAwB,QAAQ,iBAAiB,CAAC;AAW3D,OAAO,SAASC,UAAU,CAACC,KAAsB,EAAE;IACjD,MAAM,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAA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AAE;sBAAI;kCAClE,KAACzB,GAAG;wBACF0B,SAAS,EAAC,MAAM;wBAChBL,EAAE,EAAE,CAACM,KAAK,GAAM,CAAA;gCACdL,OAAO,EAAE,cAAc;gCACvBM,KAAK,EAAE,mBAAmB;gCAC1BC,QAAQ,EAAE,GAAG;gCACbL,QAAQ,EAAErB,wBAAwB;gCAClC2B,QAAQ,EAAE,QAAQ;gCAClBC,KAAK,EAAEJ,KAAK,CAACK,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCC,YAAY,EAAE,UAAU;gCACxBC,UAAU,EAAE1B,UAAU,GAAG,QAAQ,GAAG,QAAQ;6BAC7C,CAAA,AAAC;kCAEDU,kBAAkB;sBACf;;cACF;0BACN,KAACpB,GAAG;gBACFqB,EAAE,EAAE;oBACFC,OAAO,EAAE,YAAY;oBACrBe,WAAW,EAAE,GAAG;oBAChBC,SAAS,EAAE,OAAO;oBAClBC,aAAa,EAAE,KAAK;oBACpBC,UAAU,EAAE,KAAK;iBAClB;0BAEAjC,UAAU;cACP;;MACF,CACN;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SeriesInfo.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeriesInfo.test.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/SeriesInfo.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,52 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { render } from '@testing-library/react';
15
+ import { screen } from '@testing-library/dom';
16
+ import { SeriesInfo } from './SeriesInfo';
17
+ describe('SeriesInfo', ()=>{
18
+ const renderComponent = (props)=>{
19
+ render(/*#__PURE__*/ _jsx(SeriesInfo, {
20
+ ...props
21
+ }));
22
+ };
23
+ it('render metric __name__ beside formattedY value', ()=>{
24
+ const seriesInfo = {
25
+ seriesName: 'node_load1{env="demo",instance="demo.do.prometheus.io:9100",job="node"}',
26
+ y: 0.28,
27
+ formattedY: '28.0%',
28
+ markerColor: 'hsla(1016196180,50%,50%,0.8)',
29
+ totalSeries: 1,
30
+ wrapLabels: true
31
+ };
32
+ renderComponent(seriesInfo);
33
+ expect(screen.getByText('node_load1:')).toBeInTheDocument();
34
+ expect(screen.getByText('28.0%')).toBeInTheDocument();
35
+ expect(screen.getByText('demo.do.prometheus.io:9100')).toBeInTheDocument(); // TODO: remove quotes
36
+ });
37
+ it('render preformatted series name beside formattedY value', ()=>{
38
+ const seriesInfo = {
39
+ seriesName: 'Node memory total',
40
+ y: 552341504,
41
+ formattedY: '526.75 MB',
42
+ markerColor: 'hsla(-1756459732,50%,50%,0.8)',
43
+ totalSeries: 2,
44
+ wrapLabels: true
45
+ };
46
+ renderComponent(seriesInfo);
47
+ expect(screen.getByText('Node memory total')).toBeInTheDocument();
48
+ expect(screen.getByText('526.75 MB')).toBeInTheDocument();
49
+ });
50
+ });
51
+
52
+ //# sourceMappingURL=SeriesInfo.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesInfo.test.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { render } from '@testing-library/react';\nimport { screen } from '@testing-library/dom';\nimport { SeriesInfo, SeriesInfoProps } from './SeriesInfo';\n\ndescribe('SeriesInfo', () => {\n const renderComponent = (props: SeriesInfoProps) => {\n render(<SeriesInfo {...props} />);\n };\n\n it('render metric __name__ beside formattedY value', () => {\n const seriesInfo: SeriesInfoProps = {\n seriesName: 'node_load1{env=\"demo\",instance=\"demo.do.prometheus.io:9100\",job=\"node\"}',\n y: 0.28,\n formattedY: '28.0%',\n markerColor: 'hsla(1016196180,50%,50%,0.8)',\n totalSeries: 1,\n wrapLabels: true,\n };\n renderComponent(seriesInfo);\n expect(screen.getByText('node_load1:')).toBeInTheDocument();\n expect(screen.getByText('28.0%')).toBeInTheDocument();\n expect(screen.getByText('demo.do.prometheus.io:9100')).toBeInTheDocument(); // TODO: remove quotes\n });\n\n it('render preformatted series name beside formattedY value', () => {\n const seriesInfo: SeriesInfoProps = {\n seriesName: 'Node memory total',\n y: 552341504,\n formattedY: '526.75 MB',\n markerColor: 'hsla(-1756459732,50%,50%,0.8)',\n totalSeries: 2,\n wrapLabels: true,\n };\n renderComponent(seriesInfo);\n expect(screen.getByText('Node memory total')).toBeInTheDocument();\n expect(screen.getByText('526.75 MB')).toBeInTheDocument();\n });\n});\n"],"names":["render","screen","SeriesInfo","describe","renderComponent","props","it","seriesInfo","seriesName","y","formattedY","markerColor","totalSeries","wrapLabels","expect","getByText","toBeInTheDocument"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,MAAM,QAAQ,wBAAwB,CAAC;AAChD,SAASC,MAAM,QAAQ,sBAAsB,CAAC;AAC9C,SAASC,UAAU,QAAyB,cAAc,CAAC;AAE3DC,QAAQ,C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@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export interface SeriesLabelsStackProps {
3
+ formattedY: string;
4
+ metricName: string;
5
+ metricLabels: string[];
6
+ markerColor: string;
7
+ }
8
+ export declare function SeriesLabelsStack(props: SeriesLabelsStackProps): JSX.Element;
9
+ //# sourceMappingURL=SeriesLabelsStack.d.ts.map
@@ -0,0 +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,eAiE9D"}
@@ -0,0 +1,99 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Box, Divider, Stack, Typography } from '@mui/material';
15
+ import { SeriesMarker } from './SeriesMarker';
16
+ export function SeriesLabelsStack(props) {
17
+ const { formattedY , markerColor , metricName , metricLabels } = props;
18
+ return /*#__PURE__*/ _jsxs(Stack, {
19
+ spacing: 0.5,
20
+ children: [
21
+ /*#__PURE__*/ _jsxs(Box, {
22
+ sx: (theme)=>({
23
+ display: 'flex',
24
+ height: '16px',
25
+ flexDirection: 'row',
26
+ alignItems: 'center',
27
+ justifyContent: 'left',
28
+ color: theme.palette.common.white,
29
+ fontSize: '11px'
30
+ }),
31
+ children: [
32
+ /*#__PURE__*/ _jsx(SeriesMarker, {
33
+ markerColor: markerColor,
34
+ sx: {
35
+ marginTop: 0.25
36
+ }
37
+ }),
38
+ /*#__PURE__*/ _jsxs(Box, {
39
+ component: "span",
40
+ children: [
41
+ metricName,
42
+ /*#__PURE__*/ _jsx(Box, {
43
+ component: "span",
44
+ sx: (theme)=>({
45
+ color: theme.palette.common.white,
46
+ fontWeight: 700,
47
+ paddingLeft: '2px'
48
+ }),
49
+ children: formattedY
50
+ })
51
+ ]
52
+ })
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ _jsx(Divider, {
56
+ sx: (theme)=>({
57
+ borderColor: theme.palette.grey['500']
58
+ })
59
+ }),
60
+ /*#__PURE__*/ _jsx(Box, {
61
+ sx: (theme)=>({
62
+ color: theme.palette.common.white
63
+ }),
64
+ children: metricLabels.map((label)=>{
65
+ // show labels on separate lines when many labels and only one focused series
66
+ if (label) {
67
+ const [name, value] = label.split('=');
68
+ const formattedName = value !== undefined ? `${name}: ` : name;
69
+ const formattedValue = value !== undefined ? value.replace(/(^"|"$)/g, '') : value;
70
+ return /*#__PURE__*/ _jsxs(Box, {
71
+ sx: {
72
+ display: 'flex',
73
+ gap: '4px'
74
+ },
75
+ children: [
76
+ /*#__PURE__*/ _jsx(Typography, {
77
+ sx: {
78
+ fontSize: '11px'
79
+ },
80
+ children: formattedName
81
+ }),
82
+ /*#__PURE__*/ _jsx(Typography, {
83
+ sx: (theme)=>({
84
+ color: theme.palette.common.white,
85
+ fontWeight: 700,
86
+ fontSize: '11px'
87
+ }),
88
+ children: formattedValue
89
+ })
90
+ ]
91
+ }, label);
92
+ }
93
+ })
94
+ })
95
+ ]
96
+ });
97
+ }
98
+
99
+ //# sourceMappingURL=SeriesLabelsStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesLabelsStack.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Stack, Typography } from '@mui/material';\nimport { 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;AAAA,SAASA,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,YAAY,QAAQ,gBAAgB,CAAC;AAS9C,OAAO,SAASC,iBAAiB,CAACC,KAA6B,EAAE;IAC/D,MAAM,EAAEC,UAAU,CAAA,EAAEC,WAAW,CAAA,EAAEC,UAAU,CAAA,EAAEC,YAAY,CAAA,EAAE,GAAGJ,KAAK,AAAC;IACpE,qBACE,MAACJ,KAAK;QAACS,OAAO,EAAE,GAAG;;0BACjB,MAACX,GAAG;gBACFY,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;wBACdC,OAAO,EAAE,MAAM;wBACfC,MAAM,EAAE,MAAM;wBACdC,aAAa,EAAE,KAAK;wBACpBC,UAAU,EAAE,QAAQ;wBACpBC,cAAc,EAAE,MAAM;wBACtBC,KAAK,EAAEN,KAAK,CAACO,OAAO,CAACC,MAAM,CAACC,KAAK;wBACjCC,QAAQ,EAAE,MAAM;qBACjB,CAAA,AAAC;;kCAEF,KAACnB,YAAY;wBAACI,WAAW,EAAEA,WAAW;wBAAEI,EAAE,EAAE;4BAAEY,SAAS,EAAE,IAAI;yBAAE;sBAAI;kCACnE,MAACxB,GAAG;wBAACyB,SAAS,E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AE,EAAE,CAACC,KAAK,GAAM,CAAA;4CACdM,KAAK,EAAEN,KAAK,CAACO,OAAO,CAACC,MAAM,CAACC,KAAK;4CACjCI,UAAU,EAAE,GAAG;4CACfH,QAAQ,EAAE,MAAM;yCACjB,CAAA,AAAC;8CAEDc,cAAc;kCACJ;;2BAVLN,KAAK,CAWT,CACN;oBACJ,CAAC;gBACH,CAAC,CAAC;cACE;;MACA,CACR;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- interface SeriesMarkerProps {
2
+ import { BoxProps } from '@mui/material';
3
+ interface SeriesMarkerProps extends BoxProps<'div'> {
3
4
  markerColor: string;
4
5
  }
5
6
  export declare function SeriesMarker(props: SeriesMarkerProps): JSX.Element;
@@ -0,0 +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,eAkBpD"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -12,18 +12,18 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Box } from '@mui/material';
15
+ import { combineSx } from '../utils';
15
16
  export function SeriesMarker(props) {
16
- const { markerColor } = props;
17
+ const { markerColor , sx } = props;
17
18
  return /*#__PURE__*/ _jsx(Box, {
18
- sx: {
19
+ sx: combineSx({
19
20
  display: 'inline-block',
20
- width: '12px',
21
+ width: '11px',
22
+ height: '11px',
21
23
  borderRadius: '2px',
22
- height: '12px',
23
- marginTop: 0.25,
24
24
  marginRight: 1,
25
25
  verticalAlign: 'top'
26
- },
26
+ }, sx),
27
27
  style: {
28
28
  backgroundColor: markerColor
29
29
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { 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;AAAA,SAASA,GAAG,QAAkB,eAAe,CAAC;AAC9C,SAASC,SAAS,QAAQ,UAAU,CAAC;AAMrC,OAAO,SAASC,YAAY,CAACC,KAAwB,EAAE;IACrD,MAAM,EAAEC,WAAW,CAAA,EAAEC,EAAE,CAAA,EAAE,GAAGF,KAAK,AAAC;IAClC,qBACE,KAACH,GAAG;QACFK,EAAE,EAAEJ,SAAS,CACX;YACEK,OAAO,EAAE,cAAc;YACvBC,KAAK,EAAE,MAAM;YACbC,MAAM,EAAE,MAAM;YACdC,YAAY,EAAE,KAAK;YACnBC,WAAW,EAAE,CAAC;YACdC,aAAa,EAAE,KAAK;SACrB,EACDN,EAAE,CACH;QACDO,KAAK,EAAE;YAAEC,eAAe,EAAET,WAAW;SAAE;MAClC,CACP;AACJ,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ECharts as EChartsInstance } from 'echarts/core';
3
3
  import { EChartsDataFormat, UnitOptions } from '../model';
4
- interface TooltipProps {
4
+ interface TimeSeriesTooltipProps {
5
5
  chartRef: React.MutableRefObject<EChartsInstance | undefined>;
6
6
  chartData: EChartsDataFormat;
7
7
  pinTooltip: boolean;
8
8
  wrapLabels?: boolean;
9
9
  unit?: UnitOptions;
10
10
  }
11
- declare const Tooltip: React.NamedExoticComponent<TooltipProps>;
12
- export { Tooltip };
13
- //# sourceMappingURL=Tooltip.d.ts.map
11
+ export declare const TimeSeriesTooltip: React.NamedExoticComponent<TimeSeriesTooltipProps>;
12
+ export {};
13
+ //# sourceMappingURL=TimeSeriesTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1D,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,oDA2D5B,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -17,7 +17,7 @@ import { getFocusedSeriesData } from './focused-series';
17
17
  import { TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';
18
18
  import { TooltipContent } from './TooltipContent';
19
19
  import { assembleTransform } from './utils';
20
- const Tooltip = /*#__PURE__*/ React.memo(function Tooltip({ chartRef , chartData , wrapLabels , pinTooltip , unit }) {
20
+ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , pinTooltip , unit }) {
21
21
  const [pinnedPos, setPinnedPos] = useState(null);
22
22
  const mousePos = useMousePosition();
23
23
  if (mousePos === null || mousePos.target === null) return null;
@@ -67,6 +67,5 @@ const Tooltip = /*#__PURE__*/ React.memo(function Tooltip({ chartRef , chartData
67
67
  })
68
68
  });
69
69
  });
70
- export { Tooltip };
71
70
 
72
- //# sourceMappingURL=Tooltip.js.map
71
+ //# sourceMappingURL=TimeSeriesTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeSeriesTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useState } from 'react';\nimport { Box, Portal } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { getFocusedSeriesData } from './focused-series';\nimport { CursorCoordinates, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, useMousePosition } from './tooltip-model';\nimport { TooltipContent } from './TooltipContent';\nimport { assembleTransform } from './utils';\n\ninterface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n pinTooltip: boolean;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n}\n\nexport const TimeSeriesTooltip = React.memo(function TimeSeriesTooltip({\n chartRef,\n chartData,\n wrapLabels,\n pinTooltip,\n unit,\n}: TimeSeriesTooltipProps) {\n const [pinnedPos, setPinnedPos] = useState<CursorCoordinates | null>(null);\n const mousePos = useMousePosition();\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 focusedSeries = getFocusedSeriesData(mousePos, chartData, pinnedPos, chart, unit);\n const chartWidth = chart?.getWidth() ?? 750;\n const chartHeight = chart?.getHeight() ?? 230;\n const cursorTransform = assembleTransform(mousePos, focusedSeries.length, chartWidth, chartHeight, pinnedPos);\n\n if (focusedSeries.length === 0) {\n return null;\n }\n\n if (pinTooltip === true && pinnedPos === null) {\n setPinnedPos(mousePos);\n }\n\n return (\n <Portal>\n <Box\n sx={(theme) => ({\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: '#2E313E', // TODO: use colors from theme, separate styles for dark mode\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n zIndex: theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <TooltipContent focusedSeries={focusedSeries} wrapLabels={wrapLabels} />\n </Box>\n </Portal>\n );\n});\n"],"names":["React","useState","Box","Portal","getFocusedSeriesData","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","useMousePosition","TooltipContent","assembleTransform","TimeSeriesTooltip","memo","chartRef","chartData","wrapLabels","pinTooltip","unit","pinnedPos","setPinnedPos","mousePos","target","tagName","chart","current","focusedSeries","chartWidth","getWidth","chartHeight","getHeight","cursorTransform","length","sx","theme","maxWidth","maxHeight","position","top","left","backgroundColor","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO,CAAC;AACxC,SAASC,GAAG,EAAEC,MAAM,QAAQ,eAAe,CAAC;AAG5C,SAASC,oBAAoB,QAAQ,kBAAkB,CAAC;AACxD,SAA4BC,kBAAkB,EAAEC,iBAAiB,EAAEC,gBAAgB,QAAQ,iBAAiB,CAAC;AAC7G,SAASC,cAAc,QAAQ,kBAAkB,CAAC;AAClD,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAU5C,OAAO,MAAMC,iBAAiB,iBAAGV,KAAK,CAACW,IAAI,CAAC,SAASD,iBAAiB,CAAC,EACrEE,QAAQ,CAAA,EACRC,SAAS,CAAA,EACTC,UAAU,CAAA,EACVC,UAAU,CAAA,EACVC,IAAI,CAAA,EACmB,EAAE;IACzB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGjB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AACD,GAAG;YACF6B,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;oBACdC,QAAQ,EAAE3B,iBAAiB;oBAC3B4B,SAAS,EAAE7B,kBAAkB;oBAC7B8B,QAAQ,EAAE,UAAU;oBACpBC,GAAG,EAAE,CAAC;oBACNC,IAAI,EAAE,CAAC;oBACPC,eAAe,EAAE,SAAS;oBAC1BC,YAAY,EAAE,KAAK;oBACnBC,KAAK,EAAE,MAAM;oBACbC,QAAQ,EAAE,MAAM;oBAChBC,UAAU,EAAE,SAAS;oBACrBC,OAAO,EAAE,CAAC;oBACVC,UAAU,EAAE,mBAAmB;oBAC/BC,MAAM,EAAEb,KAAK,CAACa,MAAM,CAACC,OAAO;oBAC5BC,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE;wBACTC,SAAS,EAAE,MAAM;qBAClB;iBACF,CAAA,AAAC;YACFC,KAAK,EAAE;gBACLC,SAAS,EAAErB,eAAe;aAC3B;sBAED,cAAA,KAACrB,cAAc;gBAACgB,aAAa,EAAEA,aAAa;gBAAEV,UAAU,EAAEA,UAAU;cAAI;UACpE;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { FocusedSeriesArray } from './focused-series';
3
- interface TooltipContentProps {
3
+ export interface TooltipContentProps {
4
4
  focusedSeries: FocusedSeriesArray | null;
5
5
  wrapLabels?: boolean;
6
6
  }
7
7
  export declare function TooltipContent(props: TooltipContentProps): JSX.Element;
8
- export {};
9
8
  //# sourceMappingURL=TooltipContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqExD"}
@@ -1,4 +1,4 @@
1
- // Copyright 2022 The Perses Authors
1
+ // Copyright 2023 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -0,0 +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, Divider, Stack, Typography } from '@mui/material';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { FocusedSeriesArray } from './focused-series';\nimport { SeriesInfo } from './SeriesInfo';\n\nexport interface TooltipContentProps {\n focusedSeries: FocusedSeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const { focusedSeries, wrapLabels } = props;\n const { formatWithUserTimeZone } = useTimeZone();\n\n const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;\n\n const formatTimeSeriesHeader = (timeString: string) => {\n const date = new Date(timeString);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n\n return (\n <>\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 </>\n );\n };\n\n const sortedFocusedSeries = useMemo(() => {\n if (focusedSeries === null) return null;\n return focusedSeries.sort((a, b) => (a.y > b.y ? -1 : 1));\n }, [focusedSeries]);\n\n if (sortedFocusedSeries !== null && seriesTime !== null) {\n return (\n <Stack py={1} px={1.5} spacing={0.5}>\n <Typography variant=\"caption\">{formatTimeSeriesHeader(seriesTime)}</Typography>\n <Divider\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n })}\n />\n <Box\n sx={{\n display: 'table',\n }}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor }) => {\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 />\n );\n })}\n </Box>\n </Stack>\n );\n } else {\n return <></>;\n }\n}\n"],"names":["useMemo","Box","Divider","Stack","Typography","useTimeZone","SeriesInfo","TooltipContent","props","focusedSeries","wrapLabels","formatWithUserTimeZone","seriesTime","date","formatTimeSeriesHeader","timeString","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","sortedFocusedSeries","sort","a","b","y","py","px","spacing","borderColor","grey","display","map","datumIdx","seriesIdx","seriesName","formattedY","markerColor","key","toString","totalSeries","length"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,OAAO,QAAQ,OAAO,CAAC;AAChC,SAASC,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,WAAW,QAAQ,6BAA6B,CAAC;AAE1D,SAASC,UAAU,QAAQ,c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
+ export {};
2
+ //# sourceMappingURL=TooltipContent.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipContent.test.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipContent.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { render } from '@testing-library/react';
15
+ import { screen } from '@testing-library/dom';
16
+ import { TooltipContent } from './TooltipContent';
17
+ describe('TooltipContent', ()=>{
18
+ const renderComponent = (props)=>{
19
+ render(/*#__PURE__*/ _jsx(TooltipContent, {
20
+ ...props
21
+ }));
22
+ };
23
+ it('render tooltip content with a single series name', ()=>{
24
+ const tooltipContent = {
25
+ focusedSeries: [
26
+ {
27
+ seriesIdx: 0,
28
+ datumIdx: 84,
29
+ seriesName: 'Test node demo.do.prometheus.io:9100',
30
+ date: 'Dec 23, 2022, 1:53:00 PM',
31
+ x: 1671821580000,
32
+ y: 0.1,
33
+ formattedY: '0.1',
34
+ markerColor: 'hsla(19838016,50%,50%,0.8)'
35
+ }
36
+ ],
37
+ wrapLabels: true
38
+ };
39
+ renderComponent(tooltipContent);
40
+ expect(screen.getByText('Test node demo.do.prometheus.io:9100')).toBeInTheDocument();
41
+ expect(screen.getByText('Dec 23, 2022 -')).toBeInTheDocument();
42
+ expect(screen.getByText('13:53:00')).toBeInTheDocument();
43
+ expect(screen.getByText('0.1')).toBeInTheDocument();
44
+ });
45
+ it('render tooltip content with multiple series data', ()=>{
46
+ const tooltipContent = {
47
+ focusedSeries: [
48
+ {
49
+ seriesIdx: 2,
50
+ datumIdx: 48,
51
+ seriesName: 'node_memory_MemFree_bytes{env="demo",instance="demo.do.prometheus.io:9100",job="node"}',
52
+ date: 'Dec 23, 2022, 1:44:00 PM',
53
+ x: 1671821040000,
54
+ y: 84635648,
55
+ formattedY: '84.64M',
56
+ markerColor: 'hsla(1887856572,50%,50%,0.8)'
57
+ },
58
+ {
59
+ seriesIdx: 1,
60
+ datumIdx: 48,
61
+ seriesName: 'node_memory_Buffers_bytes{env="demo",instance="demo.do.prometheus.io:9100",job="node"}',
62
+ date: 'Dec 23, 2022, 1:44:00 PM',
63
+ x: 1671821040000,
64
+ y: 33771520,
65
+ formattedY: '33.77M',
66
+ markerColor: 'hsla(158479636,50%,50%,0.8)'
67
+ }
68
+ ],
69
+ wrapLabels: true
70
+ };
71
+ renderComponent(tooltipContent);
72
+ expect(screen.getByText('84.64M')).toBeInTheDocument();
73
+ expect(screen.getByText('33.77M')).toBeInTheDocument();
74
+ expect(screen.getAllByText('env="demo", instance="demo.do.prometheus.io:9100", job="node"')).toHaveLength(2);
75
+ });
76
+ });
77
+
78
+ //# sourceMappingURL=TooltipContent.test.js.map