@perses-dev/components 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-test-internal-dep-dd238ac

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 (450) hide show
  1. package/README.md +2 -3
  2. package/dist/ColorPicker/ColorPicker.d.ts +12 -0
  3. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -0
  4. package/dist/ColorPicker/ColorPicker.js +78 -0
  5. package/dist/ColorPicker/ColorPicker.js.map +1 -0
  6. package/dist/ColorPicker/index.d.ts +2 -0
  7. package/dist/ColorPicker/index.d.ts.map +1 -0
  8. package/dist/{Tooltip → ColorPicker}/index.js +2 -3
  9. package/dist/ColorPicker/index.js.map +1 -0
  10. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +2 -1
  11. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  12. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +88 -51
  13. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  14. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  15. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  16. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  17. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  18. package/dist/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  19. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  20. package/dist/DateTimeRangePicker/index.js +1 -1
  21. package/dist/DateTimeRangePicker/index.js.map +1 -1
  22. package/dist/DateTimeRangePicker/utils.js +1 -1
  23. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  24. package/dist/Dialog/Dialog.d.ts +24 -0
  25. package/dist/Dialog/Dialog.d.ts.map +1 -0
  26. package/dist/Dialog/Dialog.js +74 -0
  27. package/dist/Dialog/Dialog.js.map +1 -0
  28. package/dist/Dialog/index.d.ts +2 -0
  29. package/dist/Dialog/index.d.ts.map +1 -0
  30. package/dist/Dialog/index.js +15 -0
  31. package/dist/{Tooltip → Dialog}/index.js.map +1 -1
  32. package/dist/Drawer/Drawer.js +1 -1
  33. package/dist/Drawer/Drawer.js.map +1 -1
  34. package/dist/Drawer/index.js +1 -1
  35. package/dist/Drawer/index.js.map +1 -1
  36. package/dist/{EChart.d.ts → EChart/EChart.d.ts} +3 -3
  37. package/dist/EChart/EChart.d.ts.map +1 -0
  38. package/dist/{EChart.js → EChart/EChart.js} +2 -3
  39. package/dist/EChart/EChart.js.map +1 -0
  40. package/dist/EChart/index.d.ts +2 -0
  41. package/dist/EChart/index.d.ts.map +1 -0
  42. package/dist/EChart/index.js +15 -0
  43. package/dist/EChart/index.js.map +1 -0
  44. package/dist/ErrorAlert.js +1 -1
  45. package/dist/ErrorAlert.js.map +1 -1
  46. package/dist/ErrorBoundary.js +1 -1
  47. package/dist/ErrorBoundary.js.map +1 -1
  48. package/dist/GaugeChart/GaugeChart.d.ts +1 -2
  49. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  50. package/dist/GaugeChart/GaugeChart.js +3 -2
  51. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  52. package/dist/GaugeChart/index.js +1 -1
  53. package/dist/GaugeChart/index.js.map +1 -1
  54. package/dist/InfoTooltip/InfoTooltip.d.ts +1 -6
  55. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  56. package/dist/InfoTooltip/InfoTooltip.js +2 -9
  57. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  58. package/dist/InfoTooltip/index.js +1 -1
  59. package/dist/InfoTooltip/index.js.map +1 -1
  60. package/dist/JSONEditor.js +1 -1
  61. package/dist/JSONEditor.js.map +1 -1
  62. package/dist/Legend/CompactLegend.js +1 -1
  63. package/dist/Legend/CompactLegend.js.map +1 -1
  64. package/dist/Legend/Legend.d.ts.map +1 -1
  65. package/dist/Legend/Legend.js +13 -5
  66. package/dist/Legend/Legend.js.map +1 -1
  67. package/dist/Legend/LegendColorBadge.js +1 -1
  68. package/dist/Legend/LegendColorBadge.js.map +1 -1
  69. package/dist/Legend/ListLegend.js +1 -1
  70. package/dist/Legend/ListLegend.js.map +1 -1
  71. package/dist/Legend/ListLegendItem.js +1 -1
  72. package/dist/Legend/ListLegendItem.js.map +1 -1
  73. package/dist/Legend/index.js +1 -1
  74. package/dist/Legend/index.js.map +1 -1
  75. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  76. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  77. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  78. package/dist/LegendOptionsEditor/index.js +1 -1
  79. package/dist/LegendOptionsEditor/index.js.map +1 -1
  80. package/dist/LineChart/LineChart.d.ts +4 -2
  81. package/dist/LineChart/LineChart.d.ts.map +1 -1
  82. package/dist/LineChart/LineChart.js +4 -4
  83. package/dist/LineChart/LineChart.js.map +1 -1
  84. package/dist/LineChart/index.js +1 -1
  85. package/dist/LineChart/index.js.map +1 -1
  86. package/dist/LineChart/utils.js +2 -2
  87. package/dist/LineChart/utils.js.map +1 -1
  88. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  89. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  90. package/dist/OptionsEditorLayout/OptionsEditorControl.js +2 -2
  91. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  92. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  93. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  94. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +3 -2
  95. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  96. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +18 -6
  97. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  98. package/dist/OptionsEditorLayout/index.js +1 -1
  99. package/dist/OptionsEditorLayout/index.js.map +1 -1
  100. package/dist/StatChart/StatChart.d.ts +1 -3
  101. package/dist/StatChart/StatChart.d.ts.map +1 -1
  102. package/dist/StatChart/StatChart.js +23 -16
  103. package/dist/StatChart/StatChart.js.map +1 -1
  104. package/dist/StatChart/index.js +1 -1
  105. package/dist/StatChart/index.js.map +1 -1
  106. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +4 -0
  107. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -0
  108. package/dist/ThresholdsEditor/ThresholdColorPicker.js +76 -0
  109. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -0
  110. package/dist/ThresholdsEditor/ThresholdInput.d.ts +13 -0
  111. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -0
  112. package/dist/ThresholdsEditor/ThresholdInput.js +61 -0
  113. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -0
  114. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +10 -0
  115. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -0
  116. package/dist/ThresholdsEditor/ThresholdsEditor.js +215 -0
  117. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -0
  118. package/dist/ThresholdsEditor/index.d.ts +2 -0
  119. package/dist/ThresholdsEditor/index.d.ts.map +1 -0
  120. package/dist/ThresholdsEditor/index.js +15 -0
  121. package/dist/ThresholdsEditor/index.js.map +1 -0
  122. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesInfo.d.ts +1 -2
  123. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -0
  124. package/dist/TimeSeriesTooltip/SeriesInfo.js +89 -0
  125. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -0
  126. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +9 -0
  127. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -0
  128. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +99 -0
  129. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -0
  130. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.d.ts +2 -1
  131. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -0
  132. package/dist/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  133. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -0
  134. package/dist/{Tooltip/Tooltip.d.ts → TimeSeriesTooltip/TimeSeriesTooltip.d.ts} +4 -4
  135. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -0
  136. package/dist/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +3 -4
  137. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -0
  138. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.d.ts +1 -2
  139. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -0
  140. package/dist/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  141. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -0
  142. package/dist/TimeSeriesTooltip/focused-series.d.ts.map +1 -0
  143. package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.js +6 -6
  144. package/dist/TimeSeriesTooltip/focused-series.js.map +1 -0
  145. package/dist/TimeSeriesTooltip/index.d.ts +9 -0
  146. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -0
  147. package/dist/TimeSeriesTooltip/index.js +22 -0
  148. package/dist/TimeSeriesTooltip/index.js.map +1 -0
  149. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -0
  150. package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  151. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -0
  152. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -0
  153. package/dist/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  154. package/dist/TimeSeriesTooltip/utils.js.map +1 -0
  155. package/dist/UnitSelector/UnitSelector.js +1 -1
  156. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  157. package/dist/UnitSelector/index.js +1 -1
  158. package/dist/UnitSelector/index.js.map +1 -1
  159. package/dist/YAxisLabel.js +1 -1
  160. package/dist/YAxisLabel.js.map +1 -1
  161. package/dist/cjs/ColorPicker/ColorPicker.js +128 -0
  162. package/dist/cjs/{Tooltip → ColorPicker}/index.js +2 -3
  163. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +87 -50
  164. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +3 -2
  165. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +4 -1
  166. package/dist/cjs/DateTimeRangePicker/index.js +1 -1
  167. package/dist/cjs/DateTimeRangePicker/utils.js +1 -1
  168. package/dist/cjs/Dialog/Dialog.js +85 -0
  169. package/dist/cjs/Dialog/index.js +28 -0
  170. package/dist/cjs/Drawer/Drawer.js +1 -1
  171. package/dist/cjs/Drawer/index.js +1 -1
  172. package/dist/cjs/{EChart.js → EChart/EChart.js} +5 -11
  173. package/dist/cjs/EChart/index.js +28 -0
  174. package/dist/cjs/ErrorAlert.js +1 -1
  175. package/dist/cjs/ErrorBoundary.js +1 -1
  176. package/dist/cjs/GaugeChart/GaugeChart.js +3 -2
  177. package/dist/cjs/GaugeChart/index.js +1 -1
  178. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -18
  179. package/dist/cjs/InfoTooltip/index.js +1 -1
  180. package/dist/cjs/JSONEditor.js +1 -1
  181. package/dist/cjs/Legend/CompactLegend.js +1 -1
  182. package/dist/cjs/Legend/Legend.js +13 -5
  183. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  184. package/dist/cjs/Legend/ListLegend.js +1 -1
  185. package/dist/cjs/Legend/ListLegendItem.js +1 -1
  186. package/dist/cjs/Legend/index.js +1 -1
  187. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +13 -18
  188. package/dist/cjs/LegendOptionsEditor/index.js +1 -1
  189. package/dist/cjs/LineChart/LineChart.js +43 -4
  190. package/dist/cjs/LineChart/index.js +1 -1
  191. package/dist/cjs/LineChart/utils.js +3 -8
  192. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  193. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +2 -2
  194. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  195. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +23 -6
  196. package/dist/cjs/OptionsEditorLayout/index.js +1 -1
  197. package/dist/cjs/StatChart/StatChart.js +24 -60
  198. package/dist/cjs/StatChart/index.js +1 -1
  199. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +87 -0
  200. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +72 -0
  201. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +265 -0
  202. package/dist/cjs/ThresholdsEditor/index.js +28 -0
  203. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +95 -0
  204. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +105 -0
  205. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/SeriesMarker.js +7 -7
  206. package/dist/cjs/{Tooltip/Tooltip.js → TimeSeriesTooltip/TimeSeriesTooltip.js} +4 -4
  207. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/TooltipContent.js +1 -1
  208. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/focused-series.js +6 -6
  209. package/dist/cjs/TimeSeriesTooltip/index.js +35 -0
  210. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/tooltip-model.js +1 -1
  211. package/dist/cjs/{Tooltip → TimeSeriesTooltip}/utils.js +1 -1
  212. package/dist/cjs/UnitSelector/UnitSelector.js +1 -1
  213. package/dist/cjs/UnitSelector/index.js +1 -1
  214. package/dist/cjs/YAxisLabel.js +1 -1
  215. package/dist/cjs/context/ChartsThemeProvider.js +1 -1
  216. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  217. package/dist/cjs/index.js +5 -1
  218. package/dist/cjs/model/graph.js +4 -15
  219. package/dist/cjs/model/index.js +2 -1
  220. package/dist/cjs/model/legend.js +67 -0
  221. package/dist/cjs/model/theme.js +1 -1
  222. package/dist/cjs/model/units/bytes.js +1 -1
  223. package/dist/cjs/model/units/constants.js +1 -1
  224. package/dist/cjs/model/units/decimal.js +5 -2
  225. package/dist/cjs/model/units/index.js +1 -1
  226. package/dist/cjs/model/units/percent.js +1 -1
  227. package/dist/cjs/model/units/time.js +1 -1
  228. package/dist/cjs/model/units/types.js +1 -1
  229. package/dist/cjs/model/units/units.js +1 -1
  230. package/dist/cjs/test/index.js +1 -1
  231. package/dist/cjs/test/render.js +1 -1
  232. package/dist/cjs/test/setup-tests.js +1 -1
  233. package/dist/cjs/test-utils/index.js +1 -1
  234. package/dist/cjs/test-utils/theme.js +14 -1
  235. package/dist/cjs/theme/index.js +1 -1
  236. package/dist/cjs/theme/palette/background.js +1 -1
  237. package/dist/cjs/theme/palette/colors/blue.js +1 -1
  238. package/dist/cjs/theme/palette/colors/common.js +1 -1
  239. package/dist/cjs/theme/palette/colors/green.js +1 -1
  240. package/dist/cjs/theme/palette/colors/grey.js +1 -1
  241. package/dist/cjs/theme/palette/colors/index.js +1 -1
  242. package/dist/cjs/theme/palette/colors/orange.js +1 -1
  243. package/dist/cjs/theme/palette/colors/purple.js +1 -1
  244. package/dist/cjs/theme/palette/colors/red.js +1 -1
  245. package/dist/cjs/theme/palette/colors/types.js +1 -1
  246. package/dist/cjs/theme/palette/error.js +1 -1
  247. package/dist/cjs/theme/palette/grey.js +1 -1
  248. package/dist/cjs/theme/palette/index.js +1 -1
  249. package/dist/cjs/theme/palette/palette-options.js +1 -1
  250. package/dist/cjs/theme/palette/primary.js +1 -1
  251. package/dist/cjs/theme/palette/secondary.js +1 -1
  252. package/dist/cjs/theme/palette/success.js +1 -1
  253. package/dist/cjs/theme/palette/text.js +1 -1
  254. package/dist/cjs/theme/palette/warning.js +1 -1
  255. package/dist/cjs/theme/theme.js +17 -1
  256. package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
  257. package/dist/cjs/theme/typography.js +5 -1
  258. package/dist/cjs/utils/combine-sx.js +1 -1
  259. package/dist/cjs/utils/component-ids.js +1 -1
  260. package/dist/cjs/utils/format.js +1 -1
  261. package/dist/cjs/utils/index.js +1 -1
  262. package/dist/cjs/utils/mathjs.js +1 -1
  263. package/dist/cjs/utils/theme-gen.js +16 -8
  264. package/dist/context/ChartsThemeProvider.js +1 -1
  265. package/dist/context/ChartsThemeProvider.js.map +1 -1
  266. package/dist/context/TimeZoneProvider.js +1 -1
  267. package/dist/context/TimeZoneProvider.js.map +1 -1
  268. package/dist/index.d.ts +4 -0
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +5 -1
  271. package/dist/index.js.map +1 -1
  272. package/dist/model/graph.d.ts +3 -18
  273. package/dist/model/graph.d.ts.map +1 -1
  274. package/dist/model/graph.js +1 -5
  275. package/dist/model/graph.js.map +1 -1
  276. package/dist/model/index.d.ts +1 -0
  277. package/dist/model/index.d.ts.map +1 -1
  278. package/dist/model/index.js +2 -1
  279. package/dist/model/index.js.map +1 -1
  280. package/dist/model/legend.d.ts +22 -0
  281. package/dist/model/legend.d.ts.map +1 -0
  282. package/dist/model/legend.js +51 -0
  283. package/dist/model/legend.js.map +1 -0
  284. package/dist/model/theme.d.ts +16 -0
  285. package/dist/model/theme.d.ts.map +1 -1
  286. package/dist/model/theme.js +1 -1
  287. package/dist/model/theme.js.map +1 -1
  288. package/dist/model/units/bytes.d.ts +1 -1
  289. package/dist/model/units/bytes.d.ts.map +1 -1
  290. package/dist/model/units/bytes.js +1 -1
  291. package/dist/model/units/bytes.js.map +1 -1
  292. package/dist/model/units/constants.js +1 -1
  293. package/dist/model/units/constants.js.map +1 -1
  294. package/dist/model/units/decimal.d.ts +1 -1
  295. package/dist/model/units/decimal.d.ts.map +1 -1
  296. package/dist/model/units/decimal.js +5 -2
  297. package/dist/model/units/decimal.js.map +1 -1
  298. package/dist/model/units/index.js +1 -1
  299. package/dist/model/units/index.js.map +1 -1
  300. package/dist/model/units/percent.d.ts +1 -1
  301. package/dist/model/units/percent.d.ts.map +1 -1
  302. package/dist/model/units/percent.js +1 -1
  303. package/dist/model/units/percent.js.map +1 -1
  304. package/dist/model/units/time.d.ts +1 -1
  305. package/dist/model/units/time.d.ts.map +1 -1
  306. package/dist/model/units/time.js +1 -1
  307. package/dist/model/units/time.js.map +1 -1
  308. package/dist/model/units/types.d.ts +1 -1
  309. package/dist/model/units/types.d.ts.map +1 -1
  310. package/dist/model/units/types.js +1 -1
  311. package/dist/model/units/types.js.map +1 -1
  312. package/dist/model/units/units.js +1 -1
  313. package/dist/model/units/units.js.map +1 -1
  314. package/dist/test/index.js +1 -1
  315. package/dist/test/index.js.map +1 -1
  316. package/dist/test/render.js +1 -1
  317. package/dist/test/render.js.map +1 -1
  318. package/dist/test/setup-tests.js +1 -1
  319. package/dist/test/setup-tests.js.map +1 -1
  320. package/dist/test-utils/index.js +1 -1
  321. package/dist/test-utils/index.js.map +1 -1
  322. package/dist/test-utils/theme.d.ts.map +1 -1
  323. package/dist/test-utils/theme.js +14 -1
  324. package/dist/test-utils/theme.js.map +1 -1
  325. package/dist/theme/index.js +1 -1
  326. package/dist/theme/index.js.map +1 -1
  327. package/dist/theme/palette/background.js +1 -1
  328. package/dist/theme/palette/background.js.map +1 -1
  329. package/dist/theme/palette/colors/blue.js +1 -1
  330. package/dist/theme/palette/colors/blue.js.map +1 -1
  331. package/dist/theme/palette/colors/common.js +1 -1
  332. package/dist/theme/palette/colors/common.js.map +1 -1
  333. package/dist/theme/palette/colors/green.js +1 -1
  334. package/dist/theme/palette/colors/green.js.map +1 -1
  335. package/dist/theme/palette/colors/grey.js +1 -1
  336. package/dist/theme/palette/colors/grey.js.map +1 -1
  337. package/dist/theme/palette/colors/index.js +1 -1
  338. package/dist/theme/palette/colors/index.js.map +1 -1
  339. package/dist/theme/palette/colors/orange.js +1 -1
  340. package/dist/theme/palette/colors/orange.js.map +1 -1
  341. package/dist/theme/palette/colors/purple.js +1 -1
  342. package/dist/theme/palette/colors/purple.js.map +1 -1
  343. package/dist/theme/palette/colors/red.js +1 -1
  344. package/dist/theme/palette/colors/red.js.map +1 -1
  345. package/dist/theme/palette/colors/types.js +1 -1
  346. package/dist/theme/palette/colors/types.js.map +1 -1
  347. package/dist/theme/palette/error.js +1 -1
  348. package/dist/theme/palette/error.js.map +1 -1
  349. package/dist/theme/palette/grey.js +1 -1
  350. package/dist/theme/palette/grey.js.map +1 -1
  351. package/dist/theme/palette/index.js +1 -1
  352. package/dist/theme/palette/index.js.map +1 -1
  353. package/dist/theme/palette/palette-options.js +1 -1
  354. package/dist/theme/palette/palette-options.js.map +1 -1
  355. package/dist/theme/palette/primary.js +1 -1
  356. package/dist/theme/palette/primary.js.map +1 -1
  357. package/dist/theme/palette/secondary.js +1 -1
  358. package/dist/theme/palette/secondary.js.map +1 -1
  359. package/dist/theme/palette/success.js +1 -1
  360. package/dist/theme/palette/success.js.map +1 -1
  361. package/dist/theme/palette/text.js +1 -1
  362. package/dist/theme/palette/text.js.map +1 -1
  363. package/dist/theme/palette/warning.js +1 -1
  364. package/dist/theme/palette/warning.js.map +1 -1
  365. package/dist/theme/theme.d.ts.map +1 -1
  366. package/dist/theme/theme.js +18 -2
  367. package/dist/theme/theme.js.map +1 -1
  368. package/dist/theme/types/ThemeExtension.d.js +1 -1
  369. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  370. package/dist/theme/typography.d.ts +4 -0
  371. package/dist/theme/typography.d.ts.map +1 -1
  372. package/dist/theme/typography.js +5 -1
  373. package/dist/theme/typography.js.map +1 -1
  374. package/dist/utils/combine-sx.js +1 -1
  375. package/dist/utils/combine-sx.js.map +1 -1
  376. package/dist/utils/component-ids.js +1 -1
  377. package/dist/utils/component-ids.js.map +1 -1
  378. package/dist/utils/format.js +1 -1
  379. package/dist/utils/format.js.map +1 -1
  380. package/dist/utils/index.js +1 -1
  381. package/dist/utils/index.js.map +1 -1
  382. package/dist/utils/mathjs.js +1 -1
  383. package/dist/utils/mathjs.js.map +1 -1
  384. package/dist/utils/theme-gen.d.ts.map +1 -1
  385. package/dist/utils/theme-gen.js +15 -2
  386. package/dist/utils/theme-gen.js.map +1 -1
  387. package/package.json +10 -4
  388. package/dist/EChart.d.ts.map +0 -1
  389. package/dist/EChart.js.map +0 -1
  390. package/dist/InfoTooltip/InfoTooltip.test.d.ts +0 -2
  391. package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +0 -1
  392. package/dist/InfoTooltip/InfoTooltip.test.js +0 -36
  393. package/dist/InfoTooltip/InfoTooltip.test.js.map +0 -1
  394. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts +0 -2
  395. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.d.ts.map +0 -1
  396. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -41
  397. package/dist/LegendOptionsEditor/LegendOptionsEditor.test.js.map +0 -1
  398. package/dist/StatChart/StatChart.test.d.ts +0 -2
  399. package/dist/StatChart/StatChart.test.d.ts.map +0 -1
  400. package/dist/StatChart/StatChart.test.js +0 -94
  401. package/dist/StatChart/StatChart.test.js.map +0 -1
  402. package/dist/Tooltip/SeriesInfo.d.ts.map +0 -1
  403. package/dist/Tooltip/SeriesInfo.js +0 -143
  404. package/dist/Tooltip/SeriesInfo.js.map +0 -1
  405. package/dist/Tooltip/SeriesMarker.d.ts.map +0 -1
  406. package/dist/Tooltip/SeriesMarker.js.map +0 -1
  407. package/dist/Tooltip/Tooltip.d.ts.map +0 -1
  408. package/dist/Tooltip/Tooltip.js.map +0 -1
  409. package/dist/Tooltip/TooltipContent.d.ts.map +0 -1
  410. package/dist/Tooltip/TooltipContent.js.map +0 -1
  411. package/dist/Tooltip/focused-series.d.ts.map +0 -1
  412. package/dist/Tooltip/focused-series.js.map +0 -1
  413. package/dist/Tooltip/focused-series.test.d.ts +0 -2
  414. package/dist/Tooltip/focused-series.test.d.ts.map +0 -1
  415. package/dist/Tooltip/focused-series.test.js +0 -93
  416. package/dist/Tooltip/focused-series.test.js.map +0 -1
  417. package/dist/Tooltip/index.d.ts +0 -3
  418. package/dist/Tooltip/index.d.ts.map +0 -1
  419. package/dist/Tooltip/tooltip-model.d.ts.map +0 -1
  420. package/dist/Tooltip/tooltip-model.js.map +0 -1
  421. package/dist/Tooltip/utils.d.ts.map +0 -1
  422. package/dist/Tooltip/utils.js.map +0 -1
  423. package/dist/UnitSelector/UnitSelector.test.d.ts +0 -2
  424. package/dist/UnitSelector/UnitSelector.test.d.ts.map +0 -1
  425. package/dist/UnitSelector/UnitSelector.test.js +0 -204
  426. package/dist/UnitSelector/UnitSelector.test.js.map +0 -1
  427. package/dist/cjs/InfoTooltip/InfoTooltip.test.js +0 -43
  428. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.test.js +0 -48
  429. package/dist/cjs/StatChart/StatChart.test.js +0 -96
  430. package/dist/cjs/Tooltip/SeriesInfo.js +0 -149
  431. package/dist/cjs/Tooltip/focused-series.test.js +0 -95
  432. package/dist/cjs/UnitSelector/UnitSelector.test.js +0 -211
  433. package/dist/cjs/model/units/units.test.js +0 -153
  434. package/dist/cjs/utils/format.test.js +0 -47
  435. package/dist/cjs/utils/theme-gen.test.js +0 -197
  436. package/dist/model/units/units.test.d.ts +0 -2
  437. package/dist/model/units/units.test.d.ts.map +0 -1
  438. package/dist/model/units/units.test.js +0 -151
  439. package/dist/model/units/units.test.js.map +0 -1
  440. package/dist/utils/format.test.d.ts +0 -2
  441. package/dist/utils/format.test.d.ts.map +0 -1
  442. package/dist/utils/format.test.js +0 -45
  443. package/dist/utils/format.test.js.map +0 -1
  444. package/dist/utils/theme-gen.test.d.ts +0 -2
  445. package/dist/utils/theme-gen.test.d.ts.map +0 -1
  446. package/dist/utils/theme-gen.test.js +0 -195
  447. package/dist/utils/theme-gen.test.js.map +0 -1
  448. /package/dist/{Tooltip → TimeSeriesTooltip}/focused-series.d.ts +0 -0
  449. /package/dist/{Tooltip → TimeSeriesTooltip}/tooltip-model.d.ts +0 -0
  450. /package/dist/{Tooltip → TimeSeriesTooltip}/utils.d.ts +0 -0
@@ -1,94 +0,0 @@
1
- // Copyright 2022 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, screen } from '@testing-library/react';
15
- import { ChartsThemeProvider } from '../context/ChartsThemeProvider';
16
- import { testChartsTheme } from '../test-utils';
17
- import { StatChart } from './StatChart';
18
- describe('StatChart', ()=>{
19
- const renderChart = (unit)=>{
20
- const contentDimensions = {
21
- width: 200,
22
- height: 200
23
- };
24
- render(/*#__PURE__*/ _jsx(ChartsThemeProvider, {
25
- chartsTheme: testChartsTheme,
26
- children: /*#__PURE__*/ _jsx(StatChart, {
27
- width: contentDimensions.width,
28
- height: contentDimensions.height,
29
- data: mockStatData,
30
- unit: unit
31
- })
32
- }));
33
- };
34
- const mockStatData = {
35
- calculatedValue: 7.72931659687181,
36
- name: 'Example Stat Chart',
37
- seriesData: {
38
- name: '(((count(count(node_cpu_seconds_total{job="example"}) by (cpu))',
39
- values: [
40
- [
41
- 1654006170000,
42
- 7.736401673473903
43
- ],
44
- [
45
- 1654006185000,
46
- 7.733891213538757
47
- ],
48
- [
49
- 1654006200000,
50
- 7.731101813010433
51
- ],
52
- [
53
- 1654006215000,
54
- 7.722454672079215
55
- ],
56
- [
57
- 1654006230000,
58
- 7.722733612256738
59
- ]
60
- ]
61
- }
62
- };
63
- it('render default options (no sparkline)', ()=>{
64
- const unit = {
65
- kind: 'Decimal',
66
- decimal_places: 2
67
- };
68
- renderChart(unit);
69
- expect(screen.getByText('7.73')).toBeInTheDocument();
70
- });
71
- it('show value with bytes unit formatting', ()=>{
72
- const unit = {
73
- kind: 'Bytes'
74
- };
75
- renderChart(unit);
76
- expect(screen.getByText('7.73 bytes')).toBeInTheDocument();
77
- });
78
- it('show value with seconds time unit formatting', ()=>{
79
- const unit = {
80
- kind: 'Seconds'
81
- };
82
- renderChart(unit);
83
- expect(screen.getByText('7.73 seconds')).toBeInTheDocument();
84
- });
85
- it('show value with months time unit formatting', ()=>{
86
- const unit = {
87
- kind: 'Months'
88
- };
89
- renderChart(unit);
90
- expect(screen.getByText('7.73 months')).toBeInTheDocument();
91
- });
92
- });
93
-
94
- //# sourceMappingURL=StatChart.test.js.map
@@ -1 +0,0 @@
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","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,WA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C,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 +0,0 @@
1
- {"version":3,"file":"SeriesInfo.d.ts","sourceRoot":"","sources":["../../src/Tooltip/SeriesInfo.tsx"],"names":[],"mappings":";AAiBA,UAAU,eAAe;IACvB,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,eAkHhD"}
@@ -1,143 +0,0 @@
1
- // Copyright 2022 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
- import { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';
17
- export function SeriesInfo(props) {
18
- const { seriesName , formattedY , markerColor , totalSeries , wrapLabels } = props;
19
- // TODO (sjcobb): regex to remove __name__, improve series labels
20
- const formattedSeriesLabels = seriesName.replace(/[{}"]/g, '');
21
- if (totalSeries === 1) {
22
- const jsonFormattedSeries = seriesName[0] === '{' ? true : false;
23
- return /*#__PURE__*/ _jsxs(Stack, {
24
- spacing: 0.5,
25
- children: [
26
- /*#__PURE__*/ _jsxs(Box, {
27
- sx: (theme)=>({
28
- height: '16px',
29
- display: 'flex',
30
- flexDirection: 'row',
31
- alignItems: 'center',
32
- justifyContent: 'left',
33
- color: theme.palette.common.white,
34
- fontSize: '11px'
35
- }),
36
- children: [
37
- /*#__PURE__*/ _jsx(SeriesMarker, {
38
- markerColor: markerColor
39
- }),
40
- /*#__PURE__*/ _jsxs(Box, {
41
- component: "span",
42
- children: [
43
- "value:",
44
- /*#__PURE__*/ _jsx(Box, {
45
- component: "span",
46
- sx: (theme)=>({
47
- color: theme.palette.common.white,
48
- fontWeight: 700,
49
- paddingLeft: '2px'
50
- }),
51
- children: formattedY
52
- })
53
- ]
54
- })
55
- ]
56
- }),
57
- /*#__PURE__*/ _jsx(Divider, {
58
- sx: (theme)=>({
59
- borderColor: theme.palette.grey['500']
60
- })
61
- }),
62
- /*#__PURE__*/ _jsx(Box, {
63
- sx: (theme)=>({
64
- color: theme.palette.common.white
65
- }),
66
- children: formattedSeriesLabels.split(',').map((name)=>{
67
- if (name) {
68
- const [key, value] = jsonFormattedSeries ? name.split(':') : name.split('=');
69
- const formattedKey = value !== undefined ? `${key}: ` : key;
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: formattedKey
81
- }),
82
- /*#__PURE__*/ _jsx(Typography, {
83
- sx: (theme)=>({
84
- color: theme.palette.common.white,
85
- fontWeight: 700,
86
- fontSize: '11px'
87
- }),
88
- children: value
89
- })
90
- ]
91
- }, name);
92
- }
93
- })
94
- })
95
- ]
96
- });
97
- }
98
- const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ').replace(/[:=]/g, ': ');
99
- return /*#__PURE__*/ _jsxs(Box, {
100
- sx: {
101
- display: 'table-row',
102
- paddingTop: 0.5
103
- },
104
- children: [
105
- /*#__PURE__*/ _jsxs(Box, {
106
- sx: {
107
- display: 'table-cell',
108
- maxWidth: '520px'
109
- },
110
- children: [
111
- /*#__PURE__*/ _jsx(SeriesMarker, {
112
- markerColor: markerColor
113
- }),
114
- /*#__PURE__*/ _jsx(Box, {
115
- component: "span",
116
- sx: (theme)=>({
117
- color: theme.palette.common.white,
118
- display: 'inline-block',
119
- maxWidth: TOOLTIP_LABELS_MAX_WIDTH,
120
- overflow: 'hidden',
121
- textOverflow: 'ellipsis',
122
- whiteSpace: wrapLabels ? 'normal' : 'nowrap',
123
- width: 'calc(100% - 20px)'
124
- }),
125
- children: inlineSeriesLabels
126
- })
127
- ]
128
- }),
129
- /*#__PURE__*/ _jsx(Box, {
130
- sx: {
131
- display: 'table-cell',
132
- fontWeight: '700',
133
- paddingLeft: 1.5,
134
- textAlign: 'right',
135
- verticalAlign: 'top'
136
- },
137
- children: formattedY
138
- })
139
- ]
140
- });
141
- }
142
-
143
- //# sourceMappingURL=SeriesInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/SeriesInfo.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 { Box, Divider, Stack, Typography } from '@mui/material';\nimport { SeriesMarker } from './SeriesMarker';\nimport { TOOLTIP_LABELS_MAX_WIDTH } from './tooltip-model';\n\ninterface 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 // TODO (sjcobb): regex to remove __name__, improve series labels\n const formattedSeriesLabels = seriesName.replace(/[{}\"]/g, '');\n\n if (totalSeries === 1) {\n const jsonFormattedSeries = seriesName[0] === '{' ? true : false;\n return (\n <Stack spacing={0.5}>\n <Box\n sx={(theme) => ({\n height: '16px',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'left',\n color: theme.palette.common.white,\n fontSize: '11px',\n })}\n >\n <SeriesMarker markerColor={markerColor} />\n <Box component=\"span\">\n value:\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 {formattedSeriesLabels.split(',').map((name) => {\n if (name) {\n const [key, value] = jsonFormattedSeries ? name.split(':') : name.split('=');\n const formattedKey = value !== undefined ? `${key}: ` : key;\n return (\n <Box key={name} sx={{ display: 'flex', gap: '4px' }}>\n <Typography sx={{ fontSize: '11px' }}>{formattedKey}</Typography>\n <Typography\n sx={(theme) => ({\n color: theme.palette.common.white,\n fontWeight: 700,\n fontSize: '11px',\n })}\n >\n {value}\n </Typography>\n </Box>\n );\n }\n })}\n </Box>\n </Stack>\n );\n }\n\n const inlineSeriesLabels = formattedSeriesLabels.replace(/[,]/g, ', ').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} />\n <Box\n component=\"span\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n display: 'inline-block',\n maxWidth: TOOLTIP_LABELS_MAX_WIDTH,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: wrapLabels ? 'normal' : 'nowrap',\n width: 'calc(100% - 20px)',\n })}\n >\n {inlineSeriesLabels}\n </Box>\n </Box>\n <Box\n sx={{\n display: 'table-cell',\n fontWeight: '700',\n paddingLeft: 1.5,\n textAlign: 'right',\n verticalAlign: 'top',\n }}\n >\n {formattedY}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","Divider","Stack","Typography","SeriesMarker","TOOLTIP_LABELS_MAX_WIDTH","SeriesInfo","props","seriesName","formattedY","markerColor","totalSeries","wrapLabels","formattedSeriesLabels","replace","jsonFormattedSeries","spacing","sx","theme","height","display","flexDirection","alignItems","justifyContent","color","palette","common","white","fontSize","component","fontWeight","paddingLeft","borderColor","grey","split","map","name","key","value","formattedKey","undefined","gap","inlineSeriesLabels","paddingTop","maxWidth","overflow","textOverflow","whiteSpace","width","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;AAAA,SAASA,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAChE,SAASC,Y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C,CAACA,OAAO,UAAU,IAAI,CAAC,AAAC;IAC9F,qBACE,MAACd,GAAG;QACFiB,EAAE,EAAE;YACFG,OAAO,EAAE,WAAW;YACpBuB,UAAU,EAAE,GAAG;SAChB;;0BAED,MAAC3C,GAAG;gBACFiB,EAAE,EAAE;oBACFG,OAAO,EAAE,YAAY;oBACrBwB,QAAQ,EAAE,OAAO;iBAClB;;kCAED,KAACxC,YAAY;wBAACM,WAAW,EAAEA,WAAW;sBAAI;kCAC1C,KAACV,GAAG;wBACF6B,SAAS,EAAC,MAAM;wBAChBZ,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;gCACdM,KAAK,EAAEN,KAAK,CAACO,OAAO,CAACC,MAAM,CAACC,KAAK;gCACjCP,OAAO,EAAE,cAAc;gCACvBwB,QAAQ,EAAEvC,wBAAwB;gCAClCwC,QAAQ,EAAE,QAAQ;gCAClBC,YAAY,EAAE,UAAU;gCACxBC,UAAU,EAAEnC,UAAU,GAAG,QAAQ,GAAG,QAAQ;gCAC5CoC,KAAK,EAAE,mBAAmB;6BAC3B,CAAA,AAAC;kCAEDN,kBAAkB;sBACf;;cACF;0BACN,KAAC1C,GAAG;gBACFiB,EAAE,EAAE;oBACFG,OAAO,EAAE,YAAY;oBACrBU,UAAU,EAAE,KAAK;oBACjBC,WAAW,EAAE,GAAG;oBAChBkB,SAAS,EAAE,OAAO;oBAClBC,aAAa,EAAE,KAAK;iBACrB;0BAEAzC,UAAU;cACP;;MACF,CACN;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeriesMarker.d.ts","sourceRoot":"","sources":["../../src/Tooltip/SeriesMarker.tsx"],"names":[],"mappings":";AAeA,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAgBpD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/SeriesMarker.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 { Box } from '@mui/material';\n\ninterface SeriesMarkerProps {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps) {\n const { markerColor } = props;\n return (\n <Box\n sx={{\n display: 'inline-block',\n width: '12px',\n borderRadius: '2px',\n height: '12px',\n marginTop: 0.25,\n marginRight: 1,\n verticalAlign: 'top',\n }}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","SeriesMarker","props","markerColor","sx","display","width","borderRadius","height","marginTop","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,QAAQ,eAAe,CAAC;AAMpC,OAAO,SAASC,YAAY,CAACC,KAAwB,EAAE;IACrD,MAAM,EAAEC,WAAW,CAAA,EAAE,GAAGD,KAAK,AAAC;IAC9B,qBACE,KAACF,GAAG;QACFI,EAAE,EAAE;YACFC,OAAO,EAAE,cAAc;YACvBC,KAAK,EAAE,MAAM;YACbC,YAAY,EAAE,KAAK;YACnBC,MAAM,EAAE,MAAM;YACdC,SAAS,EAAE,IAAI;YACfC,WAAW,EAAE,CAAC;YACdC,aAAa,EAAE,KAAK;SACrB;QACDC,KAAK,EAAE;YAAEC,eAAe,EAAEV,WAAW;SAAE;MAClC,CACP;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.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,YAAY;IACpB,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,QAAA,MAAM,OAAO,0CAqDX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/Tooltip.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 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 TooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n pinTooltip: boolean;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n}\n\nconst Tooltip = React.memo(function Tooltip({ chartRef, chartData, wrapLabels, pinTooltip, unit }: TooltipProps) {\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\nexport { Tooltip };\n"],"names":["React","useState","Box","Portal","getFocusedSeriesData","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","useMousePosition","TooltipContent","assembleTransform","Tooltip","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,MAAMC,OAAO,iBAAGV,KAAK,CAACW,IAAI,CAAC,SAASD,OAAO,CAAC,EAAEE,QAAQ,CAAA,EAAEC,SAAS,CAAA,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAEC,IAAI,CAAA,EAAgB,EAAE;IAC/G,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGjB,QAAQ,CAA2B,IAAI,CAAC,AAAC;IAC3E,MAAMkB,QAAQ,GAAGZ,gBAAgB,EAAE,AAAC;IAEpC,IAAIY,QAAQ,KAAK,IAAI,IAAIA,QAAQ,CAACC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI,CAAC;IAE/D,yEAAyE;IACzE,IAAIH,SAAS,KAAK,IAAI,IAAI,AAACE,QAAQ,CAACC,MAAM,CAAiBC,OAAO,KAAK,QAAQ,EAAE,OAAO,IAAI,CAAC;IAE7F,MAAMC,KAAK,GAAGV,QAAQ,CAACW,OAAO,AAAC;IAC/B,MAAMC,aAAa,GAAGpB,oB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,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,AAAC;AAEH,SAASJ,OAAO,GAAG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../src/Tooltip/TooltipContent.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,UAAU,mBAAmB;IAC3B,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqExD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/TooltipContent.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 { 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\ninterface 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,cAAc,CAAC;AAO1C,OAAO,SAASC,cAAc,CAACC,KAA0B,EAAE;IACzD,MAAM,EAAEC,aAAa,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGF,KAAK,AAAC;IAC5C,MAAM,EAAEG,sBAAsB,CAAA,EAAE,GAAGN,WAAW,EAAE,AAAC;IAEjD,MAAMO,UAAU,GAAGH,aAAa,IAAIA,aAAa,CAAC,CAAC,CAAC,IAAIA,aAAa,CAAC,CAAC,CAAC,CAACI,IAAI,GAAGJ,aAAa,CAAC,CAAC,CAAC,CAACI,IAAI,GAAG,IAAI,AAAC;IAE7G,MAAMC,sBAAsB,GAAG,CAACC,UAAkB,GAAK;QACrD,MAAMF,IAAI,GAAG,IAAIG,IAAI,CAACD,UAAU,CAAC,AAAC;QAClC,MAAME,aAAa,GAAGN,sBAAsB,CAACE,IAAI,EAAE,iBAAiB,CAAC,AAAC;QACtE,MAAMK,aAAa,GAAGP,sBAAsB,CAACE,IAAI,EAAE,UAAU,CAAC,AAAC;QAE/D,qBACE;;8BACE,KAACT,UAAU;oBACTe,OAAO,EAAC,SAAS;oBACjBC,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;4BACdC,KAAK,EAAED,KAAK,CAACE,OAAO,CAACC,MAAM,CAACC,KAAK;yBAClC,CAAA,AAAC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GAAGJ,SAAS,CAACK,QAAQ,EAAE,GAAGN,QAAQ,CAACM,QAAQ,EAAE,AAAC;wBAEvD,qBACE,KAACvC,UAAU;4BAETmC,UAAU,EAAEA,UAAU;4BACtBV,CAAC,EAAEA,CAAC;4BACJW,UAAU,EAAEA,UAAU;4BACtBC,WAAW,EAAEA,WAAW;4BACxBG,WAAW,EAAEnB,mBAAmB,CAACoB,MAAM;4BACvCrC,UAAU,EAAEA,UAAU;2BANjBkC,GAAG,CAOR,CACF;oBACJ,CAAC,CAAC;kBACE;;UACA,CACR;IACJ,OAAO;QACL,qBAAO,mBAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"focused-series.d.ts","sourceRoot":"","sources":["../../src/Tooltip/focused-series.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAe,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,UAAU,EAA0C,MAAM,iBAAiB,CAAC;AAErF,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oBAAY,kBAAkB,GAAG,iBAAiB,EAAE,CAAC;AAErD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,iBAAiB,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,GACjB,kBAAkB,CA4CpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC9B,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC/B,KAAK,CAAC,EAAE,eAAe,EACvB,IAAI,CAAC,EAAE,WAAW,sBA2CnB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/focused-series.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\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { formatValue, UnitOptions, EChartsDataFormat } from '../model';\nimport { CursorData, TOOLTIP_DATE_FORMAT, TOOLTIP_MAX_ITEMS } from './tooltip-model';\n\nexport interface FocusedSeriesInfo {\n seriesIdx: number | null;\n datumIdx: number | null;\n seriesName: string;\n date: string;\n markerColor: string;\n x: number;\n y: number;\n formattedY: string;\n}\n\nexport type FocusedSeriesArray = FocusedSeriesInfo[];\n\n/**\n * Returns formatted series data for the points that are close to the user's cursor\n * Adjust yBuffer to increase or decrease number of series shown\n */\nexport function getNearbySeries(\n data: EChartsDataFormat,\n pointInGrid: number[],\n yBuffer: number,\n unit?: UnitOptions\n): FocusedSeriesArray {\n const currentFocusedData: FocusedSeriesArray = [];\n const focusedX: number | null = pointInGrid[0] ?? null;\n const focusedY: number | null = pointInGrid[1] ?? null;\n\n if (focusedX === null || focusedY === null) {\n return currentFocusedData;\n }\n\n if (Array.isArray(data.xAxis) && Array.isArray(data.timeSeries)) {\n for (let seriesIdx = 0; seriesIdx < data.timeSeries.length; seriesIdx++) {\n const currentSeries = data.timeSeries[seriesIdx];\n if (currentFocusedData.length >= TOOLTIP_MAX_ITEMS) break;\n if (currentSeries !== undefined) {\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const markerColor = currentSeries.color ?? '#000';\n if (Array.isArray(currentSeries.data)) {\n for (let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++) {\n const xValue = data.xAxis[datumIdx] ?? 0;\n const yValue = currentSeries.data[datumIdx] ?? 0;\n if (focusedX === datumIdx) {\n if (yValue !== '-' && focusedY <= yValue + yBuffer && focusedY >= yValue - yBuffer) {\n // determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201\n const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;\n const formattedDate = TOOLTIP_DATE_FORMAT.format(xValueMilliSeconds);\n const formattedY = formatValue(yValue, unit);\n currentFocusedData.push({\n seriesIdx: seriesIdx,\n datumIdx: datumIdx,\n seriesName: currentSeriesName,\n date: formattedDate,\n x: xValue,\n y: yValue,\n formattedY: formattedY,\n markerColor: markerColor.toString(),\n });\n }\n }\n }\n }\n }\n }\n }\n return currentFocusedData;\n}\n\n/**\n * Uses mouse position to determine whether user is hovering over a chart canvas\n * If yes, convert from pixel values to logical cartesian coordinates and return all focused series\n */\nexport function getFocusedSeriesData(\n mousePos: CursorData['coords'],\n chartData: EChartsDataFormat,\n pinnedPos: CursorData['coords'],\n chart?: EChartsInstance,\n unit?: UnitOptions\n) {\n if (chart === undefined || mousePos === null) return [];\n\n // prevents multiple tooltips showing from adjacent charts\n let cursorTargetMatchesChart = false;\n if (mousePos.target !== null) {\n const currentParent = (<HTMLElement>mousePos.target).parentElement;\n if (currentParent !== null) {\n const currentGrandparent = currentParent.parentElement;\n if (currentGrandparent !== null) {\n const chartDom = chart.getDom();\n if (chartDom === currentGrandparent) {\n cursorTargetMatchesChart = true;\n }\n }\n }\n }\n\n // allows moving cursor inside tooltip\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n cursorTargetMatchesChart = true;\n }\n\n if (cursorTargetMatchesChart === false) return [];\n\n if (chart['_model'] === undefined) return [];\n const chartModel = chart['_model'];\n const yAxisInterval = chartModel.getComponent('yAxis').axis.scale._interval;\n\n const seriesNum = chartData.timeSeries.length;\n // tooltip trigger area gets smaller with more series\n const yBuffer = seriesNum > TOOLTIP_MAX_ITEMS ? yAxisInterval * 0.5 : yAxisInterval * 2;\n\n const pointInPixel = [mousePos.plotCanvas.x ?? 0, mousePos.plotCanvas.y ?? 0];\n if (chart.containPixel('grid', pointInPixel)) {\n const pointInGrid = chart.convertFromPixel('grid', pointInPixel);\n if (pointInGrid[0] !== undefined && pointInGrid[1] !== undefined) {\n return getNearbySeries(chartData, pointInGrid, yBuffer, unit);\n }\n }\n return [];\n}\n"],"names":["formatValue","TOOLTIP_DATE_FORMAT","TOOLTIP_MAX_ITEMS","getNearbySeries","data","pointInGrid","yBuffer","unit","currentFocusedData","focusedX","focusedY","Array","isArray","xAxis","timeSeries","seriesIdx","length","currentSeries","undefined","currentSeriesName","name","toString","markerColor","color","datumIdx","xValue","yValue","xValueMilliSeconds","formattedDate","format","formattedY","push","seriesName","date","x","y","getFocusedSeriesData","mousePos","chartData","pinnedPos","chart","cursorTargetMatchesChart","target","currentParent","parentElement","currentGrandparent","chartDom","getDom","chartModel","yAxisInterval","getComponent","axis","scale","_interval","seriesNum","pointInPixel","plotCanvas","containPixel","convertFromPixel"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,WAAW,QAAwC,UAAU,CAAC;AACvE,SAAqBC,mBAAmB,EAAEC,iBAAiB,QAAQ,iBAAiB,CAAC;AAerF;;;CAGC,GACD,OAAO,SAASC,eAAe,CAC7BC,IAAuB,EACvBC,WAAqB,EACrBC,OAAe,EACfC,IAAkB,EACE;IACpB,MAAM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AAGA,aAAa,GAAG,CAAC,AAAC;QAElEZ,EAAqB,EAAOA,EAAqB;IAAvE,MAAMkB,YAAY,GAAG;QAAClB,CAAAA,EAAqB,GAArBA,QAAQ,CAACmB,UAAU,CAACtB,CAAC,cAArBG,EAAqB,cAArBA,EAAqB,GAAI,CAAC;QAAEA,CAAAA,EAAqB,GAArBA,QAAQ,CAACmB,UAAU,CAACrB,CAAC,cAArBE,EAAqB,cAArBA,EAAqB,GAAI,CAAC;KAAC,AAAC;IAC9E,IAAIG,KAAK,CAACiB,YAAY,CAAC,MAAM,EAAEF,YAAY,CAAC,EAAE;QAC5C,MAAMlD,WAAW,GAAGmC,KAAK,CAACkB,gBAAgB,CAAC,MAAM,EAAEH,YAAY,CAAC,AAAC;QACjE,IAAIlD,WAAW,CAAC,CAAC,CAAC,KAAKa,SAAS,IAAIb,WAAW,CAAC,CAAC,CAAC,KAAKa,SAAS,EAAE;YAChE,OAAOf,eAAe,CAACmC,SAAS,EAAEjC,WAAW,EAAEC,OAAO,EAAEC,IAAI,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=focused-series.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focused-series.test.d.ts","sourceRoot":"","sources":["../../src/Tooltip/focused-series.test.ts"],"names":[],"mappings":""}
@@ -1,93 +0,0 @@
1
- // Copyright 2022 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 { getNearbySeries } from './focused-series';
14
- describe('getNearbySeries', ()=>{
15
- const chartData = {
16
- timeSeries: [
17
- {
18
- type: 'line',
19
- name: 'env="demo", instance="demo.do.prometheus", job="node", mode="test"',
20
- color: 'hsla(-1365438424,50%,50%,0.8)',
21
- data: [
22
- 0.0002315202231525094,
23
- 0.00022873082287300112,
24
- 0.00023152022315149463,
25
- 0.00023152022315149463,
26
- 0.00022873082287300112
27
- ],
28
- symbol: 'circle'
29
- },
30
- {
31
- type: 'line',
32
- name: 'env="demo", instance="demo.do.prometheus", job="node", mode="test alt"',
33
- color: 'hsla(286664040,50%,50%,0.8)',
34
- data: [
35
- 0.05245188284519867,
36
- 0.0524463040446356,
37
- 0.0524463040446356,
38
- 0.05247140864723438,
39
- 0.052482566248230646
40
- ],
41
- symbol: 'circle'
42
- }
43
- ],
44
- xAxis: [
45
- 1654007865000,
46
- 1654007880000,
47
- 1654007895000,
48
- 1654007910000,
49
- 1654007925000
50
- ],
51
- rangeMs: 60000
52
- };
53
- // https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel
54
- const pointInGrid = [
55
- 2,
56
- 0.0560655737704918
57
- ]; // converted from chart.getZr() mousemove coordinates
58
- const yBuffer = 0.02; // calculated from y axis interval
59
- const focusedSeriesOutput = [
60
- {
61
- date: 'May 31, 2022, 2:38:15 PM',
62
- datumIdx: 2,
63
- markerColor: 'hsla(286664040,50%,50%,0.8)',
64
- seriesName: 'env="demo", instance="demo.do.prometheus", job="node", mode="test alt"',
65
- seriesIdx: 1,
66
- x: 1654007895000,
67
- y: 0.0524463040446356,
68
- formattedY: '0.05'
69
- }
70
- ];
71
- it('should return focused series data for points nearby the cursor', ()=>{
72
- const decimalUnit = {
73
- kind: 'Decimal',
74
- decimal_places: 2
75
- };
76
- expect(getNearbySeries(chartData, pointInGrid, yBuffer, decimalUnit)).toEqual(focusedSeriesOutput);
77
- });
78
- it('should return series values formatted as a percent', ()=>{
79
- const percentFormattedOutput = [
80
- ...focusedSeriesOutput
81
- ];
82
- if (percentFormattedOutput[0]) {
83
- percentFormattedOutput[0].formattedY = '5%';
84
- }
85
- const percentFormattedUnit = {
86
- kind: 'PercentDecimal',
87
- decimal_places: 0
88
- };
89
- expect(getNearbySeries(chartData, pointInGrid, yBuffer, percentFormattedUnit)).toEqual(percentFormattedOutput);
90
- });
91
- });
92
-
93
- //# sourceMappingURL=focused-series.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/focused-series.test.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\nimport { EChartsDataFormat, UnitOptions } from '../model';\nimport { getNearbySeries } from './focused-series';\n\ndescribe('getNearbySeries', () => {\n const chartData: EChartsDataFormat = {\n timeSeries: [\n {\n type: 'line',\n name: 'env=\"demo\", instance=\"demo.do.prometheus\", job=\"node\", mode=\"test\"',\n color: 'hsla(-1365438424,50%,50%,0.8)',\n data: [\n 0.0002315202231525094, 0.00022873082287300112, 0.00023152022315149463, 0.00023152022315149463,\n 0.00022873082287300112,\n ],\n symbol: 'circle',\n },\n {\n type: 'line',\n name: 'env=\"demo\", instance=\"demo.do.prometheus\", job=\"node\", mode=\"test alt\"',\n color: 'hsla(286664040,50%,50%,0.8)',\n data: [0.05245188284519867, 0.0524463040446356, 0.0524463040446356, 0.05247140864723438, 0.052482566248230646],\n symbol: 'circle',\n },\n ],\n xAxis: [1654007865000, 1654007880000, 1654007895000, 1654007910000, 1654007925000],\n rangeMs: 60000,\n };\n\n // https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n const pointInGrid = [2, 0.0560655737704918]; // converted from chart.getZr() mousemove coordinates\n\n const yBuffer = 0.02; // calculated from y axis interval\n\n const focusedSeriesOutput = [\n {\n date: 'May 31, 2022, 2:38:15 PM',\n datumIdx: 2,\n markerColor: 'hsla(286664040,50%,50%,0.8)',\n seriesName: 'env=\"demo\", instance=\"demo.do.prometheus\", job=\"node\", mode=\"test alt\"',\n seriesIdx: 1,\n x: 1654007895000,\n y: 0.0524463040446356,\n formattedY: '0.05',\n },\n ];\n\n it('should return focused series data for points nearby the cursor', () => {\n const decimalUnit: UnitOptions = {\n kind: 'Decimal',\n decimal_places: 2,\n };\n expect(getNearbySeries(chartData, pointInGrid, yBuffer, decimalUnit)).toEqual(focusedSeriesOutput);\n });\n\n it('should return series values formatted as a percent', () => {\n const percentFormattedOutput = [...focusedSeriesOutput];\n if (percentFormattedOutput[0]) {\n percentFormattedOutput[0].formattedY = '5%';\n }\n const percentFormattedUnit: UnitOptions = {\n kind: 'PercentDecimal',\n decimal_places: 0,\n };\n expect(getNearbySeries(chartData, pointInGrid, yBuffer, percentFormattedUnit)).toEqual(percentFormattedOutput);\n });\n});\n"],"names":["getNearbySeries","describe","chartData","timeSeries","type","name","color","data","symbol","xAxis","rangeMs","pointInGrid","yBuffer","focusedSeriesOutput","date","datumIdx","markerColor","seriesName","seriesIdx","x","y","formattedY","it","decimalUnit","kind","decimal_places","expect","toEqual","percentFormattedOutput","percentFormattedUnit"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,eAAe,QAAQ,kBAAkB,CAAC;AAEnDC,QAAQ,CAAC,iBAAiB,EAAE,IAAM;IAChC,MAAMC,SAAS,GAAsB;QACnCC,UAAU,EAAE;YACV;gBACEC,IAAI,EAAE,MAAM;gBACZC,IAAI,EAAE,oEAAoE;gBAC1EC,KAAK,EAAE,+BAA+B;gBACt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B,GAAG;eAAIf,mBAAmB;SAAC,AAAC;QACxD,IAAIe,sBAAsB,CAAC,CAAC,CAAC,EAAE;YAC7BA,sBAAsB,CAAC,CAAC,CAAC,CAACP,UAAU,GAAG,IAAI,CAAC;QAC9C,CAAC;QACD,MAAMQ,oBAAoB,GAAgB;YACxCL,IAAI,EAAE,gBAAgB;YACtBC,cAAc,EAAE,CAAC;SAClB,AAAC;QACFC,MAAM,CAAC1B,eAAe,CAACE,SAAS,EAAES,WAAW,EAAEC,OAAO,EAAEiB,oBAAoB,CAAC,CAAC,CAACF,OAAO,CAACC,sBAAsB,CAAC,CAAC;IACjH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './Tooltip';
2
- export * from './SeriesMarker';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip-model.d.ts","sourceRoot":"","sources":["../../src/Tooltip/tooltip-model.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,wBAAwB,QAA0B,CAAC;AAEhE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,mBAAmB,qBAQ9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAiB7B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;CAG5B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,UAAU,EAAE;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,OAAO,EAAE;QACP,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,aAAK,iBAAiB,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,QAAO,UAAU,CAAC,QAAQ,CAgCtD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/tooltip-model.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\nimport { useEffect, useState } from 'react';\nimport { FocusedSeriesArray } from './focused-series';\n\nexport const TOOLTIP_MAX_WIDTH = 650;\nexport const TOOLTIP_MAX_HEIGHT = 230;\nexport const TOOLTIP_LABELS_MAX_WIDTH = TOOLTIP_MAX_WIDTH - 150;\n\nexport const TOOLTIP_MAX_ITEMS = 50;\n\nexport const TOOLTIP_DATE_FORMAT = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hour12: true,\n});\n\nexport const defaultCursorData = {\n coords: {\n viewport: {\n x: 0,\n y: 0,\n },\n plotCanvas: {\n x: 0,\n y: 0,\n },\n zrender: {\n x: 0,\n y: 0,\n },\n target: null,\n },\n chartWidth: 0,\n};\n\nexport const emptyTooltipData = {\n cursor: defaultCursorData,\n focusedSeries: null,\n};\n\nexport interface CursorCoordinates {\n viewport: {\n x: number;\n y: number;\n };\n plotCanvas: {\n x: number;\n y: number;\n };\n zrender: {\n x?: number;\n y?: number;\n };\n target: EventTarget | null;\n}\n\nexport interface CursorData {\n coords: CursorCoordinates | null;\n chartWidth?: number;\n}\n\nexport interface TooltipData {\n focusedSeries: FocusedSeriesArray | null;\n cursor: CursorData;\n}\n\ntype ZREventProperties = {\n zrX?: number;\n zrY?: number;\n zrDelta?: number;\n zrEventControl?: 'no_globalout' | 'only_globalout';\n zrByTouch?: boolean;\n};\n\nexport type ZRRawMouseEvent = MouseEvent & ZREventProperties;\n\nexport const useMousePosition = (): CursorData['coords'] => {\n const [coords, setCoords] = useState<CursorData['coords']>(null);\n\n useEffect(() => {\n const setFromEvent = (e: ZRRawMouseEvent) => {\n return setCoords({\n viewport: {\n x: e.clientX,\n y: e.clientY,\n },\n plotCanvas: {\n x: e.offsetX,\n y: e.offsetY,\n },\n zrender: {\n // echarts canvas coordinates added automatically by zrender\n // zrX and zrY are similar to offsetX and offsetY but they return undefined when not hovering over a chart canvas\n x: e.zrX,\n y: e.zrY,\n },\n // necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)\n target: e.target,\n });\n };\n window.addEventListener('mousemove', setFromEvent);\n\n return () => {\n window.removeEventListener('mousemove', setFromEvent);\n };\n }, []);\n\n return coords;\n};\n"],"names":["useEffect","useState","TOOLTIP_MAX_WIDTH","TOOLTIP_MAX_HEIGHT","TOOLTIP_LABELS_MAX_WIDTH","TOOLTIP_MAX_ITEMS","TOOLTIP_DATE_FORMAT","Intl","DateTimeFormat","undefined","year","month","day","hour","minute","second","hour12","defaultCursorData","coords","viewport","x","y","plotCanvas","zrender","target","chartWidth","emptyTooltipData","cursor","focusedSeries","useMousePosition","setCoords","setFromEvent","e","clientX","clientY","offsetX","offsetY","zrX","zrY","window","addEventListener","removeEventListener"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAG5C,OAAO,MAAMC,iBAAiB,GAAG,GAAG,CAAC;AACrC,OAAO,MAAMC,kBAAkB,GAAG,GAAG,CAAC;AACtC,OAAO,MAAMC,wBAAwB,GAAGF,iBAAiB,GAAG,GAAG,CAAC;AAEhE,OAAO,MAAMG,iBAAiB,GAAG,EAAE,CAAC;AAEpC,OAAO,MAAMC,mBAAmB,GAAG,IAAIC,IAAI,CAACC,cAAc,CAACC,SAAS,EAAE;IACpEC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,OAAO;IACdC,GAAG,EAAE,SAAS;IACdC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE,SAAS;IACjBC,MAAM,EAAE,SAAS;IACjBC,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,OAAO,MAAMC,iBAAiB,GAAG;IAC/BC,MAAM,EAAE;QACNC,QAAQ,EAAE;YACRC,CAAC,EAAE,CAAC;YACJC,CAAC,EAAE,CAAC;SACL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1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/Tooltip/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AAEnF;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,iBAAiB,GAAG,IAAI,UAoCpC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/Tooltip/utils.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\nimport { CursorCoordinates, CursorData, TOOLTIP_MAX_WIDTH } from './tooltip-model';\n\n/**\n * Determine position of tooltip depending on chart dimensions and the number of focused series\n */\nexport function assembleTransform(\n mousePos: CursorData['coords'],\n seriesNum: number,\n chartWidth: number,\n chartHeight: number,\n pinnedPos: CursorCoordinates | null\n) {\n if (mousePos === null) {\n return 'translate3d(0, 0)';\n }\n\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n }\n\n const cursorPaddingX = 32;\n const cursorPaddingY = 16;\n const x = mousePos.viewport.x;\n let y = mousePos.viewport.y + cursorPaddingY;\n\n const isCloseToBottom = mousePos.viewport.y > window.innerHeight * 0.8;\n const yPosAdjustThreshold = chartHeight * 0.75;\n // adjust so tooltip does not get cut off at bottom of chart, reduce multiplier to move up\n if (isCloseToBottom === true) {\n if (seriesNum > 6) {\n y = mousePos.viewport.y * 0.65;\n } else {\n y = mousePos.viewport.y * 0.75;\n }\n } else if (mousePos.plotCanvas.y > yPosAdjustThreshold) {\n y = mousePos.viewport.y * 0.85;\n }\n\n // use tooltip width to determine when to repos from right to left (width is narrower when only 1 focused series since labels wrap)\n const tooltipWidth = seriesNum > 1 ? TOOLTIP_MAX_WIDTH : TOOLTIP_MAX_WIDTH / 2;\n const xPosAdjustThreshold = chartWidth - tooltipWidth * 0.9;\n\n // reposition so tooltip is never too close to right side of chart or left side of browser window\n return mousePos.plotCanvas.x > xPosAdjustThreshold && x > TOOLTIP_MAX_WIDTH\n ? `translate3d(${x - cursorPaddingX}px, ${y}px, 0) translateX(-100%)`\n : `translate3d(${x + cursorPaddingX}px, ${y}px, 0)`;\n}\n"],"names":["TOOLTIP_MAX_WIDTH","assembleTransform","mousePos","seriesNum","chartWidth","chartHeight","pinnedPos","cursorPaddingX","cursorPaddingY","x","viewport","y","isCloseToBottom","window","innerHeight","yPosAdjustThreshold","plotCanvas","tooltipWidth","xPosAdjustThreshold"],"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,SAAwCA,iBAAiB,QAAQ,iBAAiB,CAAC;AAEnF;;CAEC,GACD,OAAO,SAASC,iBAAiB,CAC/BC,QAA8B,EAC9BC,SAAiB,EACjBC,UAAkB,EAClBC,WAAmB,EACnBC,SAAmC,EACnC;IACA,IAAIJ,QAAQ,KAAK,IAAI,EAAE;QACrB,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,IAAII,SAAS,KAAK,IAAI,EAAE;QACtBJ,QAAQ,GAAGI,SAAS,CAAC;IACvB,CAAC;IAED,MAAMC,cAAc,GAAG,EAAE,AAAC;IAC1B,MAAMC,cAAc,GAAG,EAAE,AAAC;IAC1B,MAAMC,CAAC,GAAGP,Q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.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnitSelector.test.d.ts","sourceRoot":"","sources":["../../src/UnitSelector/UnitSelector.test.tsx"],"names":[],"mappings":""}