@perses-dev/components 0.0.0-snapshot-saving-defaults-refinements-1b25cec → 0.0.0-snapshot-time-chart-rewrite-4667058

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 (307) hide show
  1. package/dist/ContentWithLegend/ContentWithLegend.d.ts +1 -1
  2. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  3. package/dist/ContentWithLegend/ContentWithLegend.js +5 -3
  4. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  5. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +10 -4
  6. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  7. package/dist/ContentWithLegend/model/content-with-legend-model.js +27 -8
  8. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  9. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
  10. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  11. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  12. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +2 -5
  13. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  14. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  15. package/dist/Drawer/Drawer.js +1 -1
  16. package/dist/Drawer/Drawer.js.map +1 -1
  17. package/dist/EChart/EChart.d.ts +2 -1
  18. package/dist/EChart/EChart.d.ts.map +1 -1
  19. package/dist/EChart/EChart.js +15 -3
  20. package/dist/EChart/EChart.js.map +1 -1
  21. package/dist/GaugeChart/GaugeChart.d.ts +2 -2
  22. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  23. package/dist/GaugeChart/GaugeChart.js +7 -5
  24. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  25. package/dist/Legend/CompactLegend.d.ts +4 -2
  26. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  27. package/dist/Legend/CompactLegend.js +6 -3
  28. package/dist/Legend/CompactLegend.js.map +1 -1
  29. package/dist/Legend/Legend.d.ts +17 -3
  30. package/dist/Legend/Legend.d.ts.map +1 -1
  31. package/dist/Legend/Legend.js +7 -4
  32. package/dist/Legend/Legend.js.map +1 -1
  33. package/dist/Legend/ListLegend.d.ts +4 -2
  34. package/dist/Legend/ListLegend.d.ts.map +1 -1
  35. package/dist/Legend/ListLegend.js +6 -5
  36. package/dist/Legend/ListLegend.js.map +1 -1
  37. package/dist/Legend/ListLegendItem.d.ts +16 -3
  38. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  39. package/dist/Legend/ListLegendItem.js +17 -5
  40. package/dist/Legend/ListLegendItem.js.map +1 -1
  41. package/dist/Legend/TableLegend.d.ts +6 -3
  42. package/dist/Legend/TableLegend.d.ts.map +1 -1
  43. package/dist/Legend/TableLegend.js +17 -3
  44. package/dist/Legend/TableLegend.js.map +1 -1
  45. package/dist/Legend/index.d.ts +1 -0
  46. package/dist/Legend/index.d.ts.map +1 -1
  47. package/dist/Legend/index.js +1 -0
  48. package/dist/Legend/index.js.map +1 -1
  49. package/dist/Legend/legend-model.d.ts +24 -0
  50. package/dist/Legend/legend-model.d.ts.map +1 -0
  51. package/dist/Legend/legend-model.js +19 -0
  52. package/dist/Legend/legend-model.js.map +1 -0
  53. package/dist/LineChart/LineChart.d.ts +6 -11
  54. package/dist/LineChart/LineChart.d.ts.map +1 -1
  55. package/dist/LineChart/LineChart.js +36 -9
  56. package/dist/LineChart/LineChart.js.map +1 -1
  57. package/dist/LineChart/index.d.ts +0 -1
  58. package/dist/LineChart/index.d.ts.map +1 -1
  59. package/dist/LineChart/index.js.map +1 -1
  60. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  61. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  62. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +12 -0
  63. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -0
  64. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +45 -0
  65. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -0
  66. package/dist/RefreshIntervalPicker/index.d.ts +2 -0
  67. package/dist/RefreshIntervalPicker/index.d.ts.map +1 -0
  68. package/dist/{model/units → RefreshIntervalPicker}/index.js +1 -3
  69. package/dist/RefreshIntervalPicker/index.js.map +1 -0
  70. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +36 -0
  71. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -0
  72. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +65 -0
  73. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -0
  74. package/dist/SettingsAutocomplete/index.d.ts +2 -0
  75. package/dist/SettingsAutocomplete/index.d.ts.map +1 -0
  76. package/dist/{model/units/constants.js → SettingsAutocomplete/index.js} +2 -4
  77. package/dist/SettingsAutocomplete/index.js.map +1 -0
  78. package/dist/StatChart/StatChart.d.ts +3 -2
  79. package/dist/StatChart/StatChart.d.ts.map +1 -1
  80. package/dist/StatChart/StatChart.js +75 -22
  81. package/dist/StatChart/StatChart.js.map +1 -1
  82. package/dist/StatChart/calculateFontSize.d.ts +14 -0
  83. package/dist/StatChart/calculateFontSize.d.ts.map +1 -0
  84. package/dist/StatChart/calculateFontSize.js +47 -0
  85. package/dist/StatChart/calculateFontSize.js.map +1 -0
  86. package/dist/Table/InnerTable.js +3 -3
  87. package/dist/Table/InnerTable.js.map +1 -1
  88. package/dist/Table/Table.d.ts +1 -1
  89. package/dist/Table/Table.d.ts.map +1 -1
  90. package/dist/Table/Table.js +58 -10
  91. package/dist/Table/Table.js.map +1 -1
  92. package/dist/Table/TableCell.d.ts +16 -3
  93. package/dist/Table/TableCell.d.ts.map +1 -1
  94. package/dist/Table/TableCell.js +13 -5
  95. package/dist/Table/TableCell.js.map +1 -1
  96. package/dist/Table/TableCheckbox.js +1 -1
  97. package/dist/Table/TableCheckbox.js.map +1 -1
  98. package/dist/Table/TableHeaderCell.d.ts +23 -0
  99. package/dist/Table/TableHeaderCell.d.ts.map +1 -0
  100. package/dist/Table/TableHeaderCell.js +53 -0
  101. package/dist/Table/TableHeaderCell.js.map +1 -0
  102. package/dist/Table/TableRow.d.ts.map +1 -1
  103. package/dist/Table/TableRow.js +3 -3
  104. package/dist/Table/TableRow.js.map +1 -1
  105. package/dist/Table/VirtualizedTable.d.ts +3 -3
  106. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  107. package/dist/Table/VirtualizedTable.js +51 -10
  108. package/dist/Table/VirtualizedTable.js.map +1 -1
  109. package/dist/Table/model/table-model.d.ts +81 -3
  110. package/dist/Table/model/table-model.d.ts.map +1 -1
  111. package/dist/Table/model/table-model.js +22 -7
  112. package/dist/Table/model/table-model.js.map +1 -1
  113. package/dist/TimeChart/TimeChart.d.ts +23 -0
  114. package/dist/TimeChart/TimeChart.d.ts.map +1 -0
  115. package/dist/TimeChart/TimeChart.js +314 -0
  116. package/dist/TimeChart/TimeChart.js.map +1 -0
  117. package/dist/TimeChart/index.d.ts +2 -0
  118. package/dist/TimeChart/index.d.ts.map +1 -0
  119. package/dist/{LegendOptionsEditor → TimeChart}/index.js +1 -1
  120. package/dist/TimeChart/index.js.map +1 -0
  121. package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.d.ts → LineChartTooltip.d.ts} +5 -4
  122. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -0
  123. package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +7 -6
  124. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -0
  125. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +16 -0
  126. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -0
  127. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +76 -0
  128. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -0
  129. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +2 -2
  130. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  131. package/dist/TimeSeriesTooltip/TooltipHeader.js +10 -8
  132. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  133. package/dist/TimeSeriesTooltip/index.d.ts +2 -1
  134. package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
  135. package/dist/TimeSeriesTooltip/index.js +2 -1
  136. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  137. package/dist/TimeSeriesTooltip/nearby-series.d.ts +23 -4
  138. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  139. package/dist/TimeSeriesTooltip/nearby-series.js +175 -17
  140. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  141. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +4 -0
  142. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  143. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  144. package/dist/TimeSeriesTooltip/utils.d.ts +25 -0
  145. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  146. package/dist/TimeSeriesTooltip/utils.js +29 -1
  147. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  148. package/dist/UnitSelector/UnitSelector.d.ts +1 -1
  149. package/dist/UnitSelector/UnitSelector.d.ts.map +1 -1
  150. package/dist/UnitSelector/UnitSelector.js +11 -24
  151. package/dist/UnitSelector/UnitSelector.js.map +1 -1
  152. package/dist/YAxisLabel.js +1 -1
  153. package/dist/YAxisLabel.js.map +1 -1
  154. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +5 -3
  155. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +28 -9
  156. package/dist/cjs/Drawer/Drawer.js +1 -1
  157. package/dist/cjs/EChart/EChart.js +22 -5
  158. package/dist/cjs/GaugeChart/GaugeChart.js +7 -5
  159. package/dist/cjs/Legend/CompactLegend.js +7 -4
  160. package/dist/cjs/Legend/Legend.js +8 -5
  161. package/dist/cjs/Legend/ListLegend.js +7 -6
  162. package/dist/cjs/Legend/ListLegendItem.js +17 -5
  163. package/dist/cjs/Legend/TableLegend.js +17 -3
  164. package/dist/cjs/Legend/index.js +1 -0
  165. package/dist/cjs/{model/units/types.js → Legend/legend-model.js} +7 -10
  166. package/dist/cjs/LineChart/LineChart.js +35 -47
  167. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  168. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +51 -0
  169. package/dist/cjs/{model/units → RefreshIntervalPicker}/index.js +1 -3
  170. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +66 -0
  171. package/dist/cjs/SettingsAutocomplete/index.js +28 -0
  172. package/dist/cjs/StatChart/StatChart.js +82 -24
  173. package/dist/cjs/StatChart/calculateFontSize.js +51 -0
  174. package/dist/cjs/Table/InnerTable.js +3 -3
  175. package/dist/cjs/Table/Table.js +57 -9
  176. package/dist/cjs/Table/TableCell.js +13 -5
  177. package/dist/cjs/Table/TableCheckbox.js +1 -1
  178. package/dist/cjs/Table/TableHeaderCell.js +59 -0
  179. package/dist/cjs/Table/TableRow.js +2 -2
  180. package/dist/cjs/Table/VirtualizedTable.js +51 -10
  181. package/dist/cjs/Table/model/table-model.js +22 -7
  182. package/dist/cjs/TimeChart/TimeChart.js +320 -0
  183. package/dist/cjs/{LegendOptionsEditor → TimeChart}/index.js +1 -1
  184. package/dist/cjs/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +7 -45
  185. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +87 -0
  186. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +10 -8
  187. package/dist/cjs/TimeSeriesTooltip/index.js +2 -1
  188. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +171 -17
  189. package/dist/cjs/TimeSeriesTooltip/utils.js +35 -3
  190. package/dist/cjs/UnitSelector/UnitSelector.js +15 -28
  191. package/dist/cjs/YAxisLabel.js +1 -1
  192. package/dist/cjs/index.js +3 -1
  193. package/dist/cjs/model/index.js +1 -2
  194. package/dist/cjs/model/timeOption.js +16 -0
  195. package/dist/cjs/{model/units/constants.js → theme/component-overrides/paper.js} +9 -5
  196. package/dist/cjs/theme/palette/background.js +2 -2
  197. package/dist/cjs/theme/theme.js +2 -0
  198. package/dist/cjs/utils/axis.js +58 -0
  199. package/dist/cjs/{LineChart/utils.js → utils/chart-actions.js} +9 -47
  200. package/dist/cjs/utils/format.js +47 -1
  201. package/dist/cjs/utils/index.js +3 -1
  202. package/dist/cjs/utils/theme-gen.js +44 -2
  203. package/dist/index.d.ts +3 -1
  204. package/dist/index.d.ts.map +1 -1
  205. package/dist/index.js +3 -1
  206. package/dist/index.js.map +1 -1
  207. package/dist/model/graph.d.ts +20 -3
  208. package/dist/model/graph.d.ts.map +1 -1
  209. package/dist/model/graph.js.map +1 -1
  210. package/dist/model/index.d.ts +1 -2
  211. package/dist/model/index.d.ts.map +1 -1
  212. package/dist/model/index.js +1 -2
  213. package/dist/model/index.js.map +1 -1
  214. package/dist/model/theme.d.ts +4 -6
  215. package/dist/model/theme.d.ts.map +1 -1
  216. package/dist/model/theme.js.map +1 -1
  217. package/dist/model/timeOption.d.ts +6 -0
  218. package/dist/model/timeOption.d.ts.map +1 -0
  219. package/dist/model/{units/types.js → timeOption.js} +2 -9
  220. package/dist/model/timeOption.js.map +1 -0
  221. package/dist/theme/component-overrides/paper.d.ts +3 -0
  222. package/dist/theme/component-overrides/paper.d.ts.map +1 -0
  223. package/dist/theme/component-overrides/paper.js +21 -0
  224. package/dist/theme/component-overrides/paper.js.map +1 -0
  225. package/dist/theme/palette/background.js +2 -2
  226. package/dist/theme/palette/background.js.map +1 -1
  227. package/dist/theme/theme.d.ts.map +1 -1
  228. package/dist/theme/theme.js +2 -0
  229. package/dist/theme/theme.js.map +1 -1
  230. package/dist/utils/axis.d.ts +14 -0
  231. package/dist/utils/axis.d.ts.map +1 -0
  232. package/dist/utils/axis.js +45 -0
  233. package/dist/utils/axis.js.map +1 -0
  234. package/dist/utils/chart-actions.d.ts +18 -0
  235. package/dist/utils/chart-actions.d.ts.map +1 -0
  236. package/dist/utils/chart-actions.js +52 -0
  237. package/dist/utils/chart-actions.js.map +1 -0
  238. package/dist/utils/format.d.ts +6 -0
  239. package/dist/utils/format.d.ts.map +1 -1
  240. package/dist/utils/format.js +47 -0
  241. package/dist/utils/format.js.map +1 -1
  242. package/dist/utils/index.d.ts +3 -1
  243. package/dist/utils/index.d.ts.map +1 -1
  244. package/dist/utils/index.js +3 -1
  245. package/dist/utils/index.js.map +1 -1
  246. package/dist/utils/theme-gen.d.ts.map +1 -1
  247. package/dist/utils/theme-gen.js +38 -1
  248. package/dist/utils/theme-gen.js.map +1 -1
  249. package/package.json +5 -9
  250. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts +0 -8
  251. package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +0 -1
  252. package/dist/LegendOptionsEditor/LegendOptionsEditor.js +0 -109
  253. package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +0 -1
  254. package/dist/LegendOptionsEditor/index.d.ts +0 -2
  255. package/dist/LegendOptionsEditor/index.d.ts.map +0 -1
  256. package/dist/LegendOptionsEditor/index.js.map +0 -1
  257. package/dist/LineChart/utils.d.ts +0 -30
  258. package/dist/LineChart/utils.d.ts.map +0 -1
  259. package/dist/LineChart/utils.js +0 -90
  260. package/dist/LineChart/utils.js.map +0 -1
  261. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +0 -1
  262. package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +0 -1
  263. package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +0 -115
  264. package/dist/cjs/model/legend.js +0 -102
  265. package/dist/cjs/model/units/bytes.js +0 -84
  266. package/dist/cjs/model/units/decimal.js +0 -62
  267. package/dist/cjs/model/units/percent.js +0 -73
  268. package/dist/cjs/model/units/time.js +0 -105
  269. package/dist/cjs/model/units/units.js +0 -101
  270. package/dist/cjs/model/units/utils.js +0 -42
  271. package/dist/model/legend.d.ts +0 -36
  272. package/dist/model/legend.d.ts.map +0 -1
  273. package/dist/model/legend.js +0 -81
  274. package/dist/model/legend.js.map +0 -1
  275. package/dist/model/units/bytes.d.ts +0 -13
  276. package/dist/model/units/bytes.d.ts.map +0 -1
  277. package/dist/model/units/bytes.js +0 -66
  278. package/dist/model/units/bytes.js.map +0 -1
  279. package/dist/model/units/constants.d.ts +0 -2
  280. package/dist/model/units/constants.d.ts.map +0 -1
  281. package/dist/model/units/constants.js.map +0 -1
  282. package/dist/model/units/decimal.d.ts +0 -13
  283. package/dist/model/units/decimal.d.ts.map +0 -1
  284. package/dist/model/units/decimal.js +0 -49
  285. package/dist/model/units/decimal.js.map +0 -1
  286. package/dist/model/units/index.d.ts +0 -4
  287. package/dist/model/units/index.d.ts.map +0 -1
  288. package/dist/model/units/index.js.map +0 -1
  289. package/dist/model/units/percent.d.ts +0 -12
  290. package/dist/model/units/percent.d.ts.map +0 -1
  291. package/dist/model/units/percent.js +0 -60
  292. package/dist/model/units/percent.js.map +0 -1
  293. package/dist/model/units/time.d.ts +0 -22
  294. package/dist/model/units/time.d.ts.map +0 -1
  295. package/dist/model/units/time.js +0 -91
  296. package/dist/model/units/time.js.map +0 -1
  297. package/dist/model/units/types.d.ts +0 -47
  298. package/dist/model/units/types.d.ts.map +0 -1
  299. package/dist/model/units/types.js.map +0 -1
  300. package/dist/model/units/units.d.ts +0 -40
  301. package/dist/model/units/units.d.ts.map +0 -1
  302. package/dist/model/units/units.js +0 -80
  303. package/dist/model/units/units.js.map +0 -1
  304. package/dist/model/units/utils.d.ts +0 -4
  305. package/dist/model/units/utils.d.ts.map +0 -1
  306. package/dist/model/units/utils.js +0 -32
  307. package/dist/model/units/utils.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ export * from './TimeChart';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TimeChart/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC"}
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './LegendOptionsEditor';
13
+ export * from './TimeChart';
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeChart/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 './TimeChart';\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,6 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { UnitOptions } from '@perses-dev/core';
1
3
  import { ECharts as EChartsInstance } from 'echarts/core';
2
- import React from 'react';
3
- import { EChartsDataFormat, UnitOptions } from '../model';
4
+ import { EChartsDataFormat } from '../model';
4
5
  import { CursorCoordinates } from './tooltip-model';
5
6
  export interface TimeSeriesTooltipProps {
6
7
  chartRef: React.MutableRefObject<EChartsInstance | undefined>;
@@ -10,5 +11,5 @@ export interface TimeSeriesTooltipProps {
10
11
  onUnpinClick?: () => void;
11
12
  pinnedPos: CursorCoordinates | null;
12
13
  }
13
- export declare const TimeSeriesTooltip: React.NamedExoticComponent<TimeSeriesTooltipProps>;
14
- //# sourceMappingURL=TimeSeriesTooltip.d.ts.map
14
+ export declare const LineChartTooltip: import("react").NamedExoticComponent<TimeSeriesTooltipProps>;
15
+ //# sourceMappingURL=LineChartTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7C,OAAO,EACL,iBAAiB,EAOlB,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,8DAkF3B,CAAC"}
@@ -12,14 +12,14 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Box, Portal, Stack } from '@mui/material';
15
- import React, { useState } from 'react';
15
+ import { memo, useState } from 'react';
16
16
  import useResizeObserver from 'use-resize-observer';
17
17
  import { TooltipContent } from './TooltipContent';
18
18
  import { TooltipHeader } from './TooltipHeader';
19
- import { getNearbySeriesData } from './nearby-series';
19
+ import { legacyGetNearbySeriesData } from './nearby-series';
20
20
  import { FALLBACK_CHART_WIDTH, TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_HEIGHT, TOOLTIP_MAX_WIDTH, TOOLTIP_MIN_WIDTH, useMousePosition } from './tooltip-model';
21
21
  import { assembleTransform } from './utils';
22
- export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , unit , onUnpinClick , pinnedPos }) {
22
+ export const LineChartTooltip = /*#__PURE__*/ memo(function LineChartTooltip({ chartRef , chartData , wrapLabels , unit , onUnpinClick , pinnedPos }) {
23
23
  const [showAllSeries, setShowAllSeries] = useState(false);
24
24
  const mousePos = useMousePosition();
25
25
  const { height , width , ref: tooltipRef } = useResizeObserver();
@@ -32,7 +32,7 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
32
32
  const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
33
33
  const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0);
34
34
  // Get series nearby the cursor and pass into tooltip content children.
35
- const nearbySeries = getNearbySeriesData({
35
+ const nearbySeries = legacyGetNearbySeriesData({
36
36
  mousePos,
37
37
  chartData,
38
38
  pinnedPos,
@@ -65,7 +65,8 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
65
65
  visibility: 'visible',
66
66
  opacity: 1,
67
67
  transition: 'all 0.1s ease-out',
68
- zIndex: theme.zIndex.tooltip,
68
+ // Ensure pinned tooltip shows behind edit panel drawer and sticky header
69
+ zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,
69
70
  overflow: 'hidden',
70
71
  '&:hover': {
71
72
  overflowY: 'auto'
@@ -96,4 +97,4 @@ export const TimeSeriesTooltip = /*#__PURE__*/ React.memo(function TimeSeriesToo
96
97
  });
97
98
  });
98
99
 
99
- //# sourceMappingURL=TimeSeriesTooltip.js.map
100
+ //# sourceMappingURL=LineChartTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/LineChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport { UnitOptions } from '@perses-dev/core';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { memo, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { EChartsDataFormat } from '../model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { legacyGetNearbySeriesData } from './nearby-series';\nimport {\n CursorCoordinates,\n FALLBACK_CHART_WIDTH,\n TOOLTIP_BG_COLOR_FALLBACK,\n TOOLTIP_MAX_HEIGHT,\n TOOLTIP_MAX_WIDTH,\n TOOLTIP_MIN_WIDTH,\n useMousePosition,\n} from './tooltip-model';\nimport { assembleTransform } from './utils';\n\nexport interface TimeSeriesTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n chartData: EChartsDataFormat;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n}\n\nexport const LineChartTooltip = memo(function LineChartTooltip({\n chartRef,\n chartData,\n wrapLabels,\n unit,\n onUnpinClick,\n pinnedPos,\n}: TimeSeriesTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null;\n\n if (mousePos === null || mousePos.target === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\n const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = legacyGetNearbySeriesData({\n mousePos,\n chartData,\n pinnedPos,\n chart,\n unit,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = chartData.timeSeries.length;\n\n return (\n <Portal>\n <Box\n ref={tooltipRef}\n sx={(theme) => ({\n minWidth: TOOLTIP_MIN_WIDTH,\n maxWidth: TOOLTIP_MAX_WIDTH,\n maxHeight: TOOLTIP_MAX_HEIGHT,\n padding: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n borderRadius: '6px',\n color: '#fff',\n fontSize: '11px',\n visibility: 'visible',\n opacity: 1,\n transition: 'all 0.1s ease-out',\n // Ensure pinned tooltip shows behind edit panel drawer and sticky header\n zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,\n overflow: 'hidden',\n '&:hover': {\n overflowY: 'auto',\n },\n })}\n style={{\n transform: cursorTransform,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useState","useResizeObserver","TooltipContent","TooltipHeader","legacyGetNearbySeriesData","FALLBACK_CHART_WIDTH","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_HEIGHT","TOOLTIP_MAX_WIDTH","TOOLTIP_MIN_WIDTH","useMousePosition","assembleTransform","LineChartTooltip","chartRef","chartData","wrapLabels","unit","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","chartWidth","getWidth","cursorTransform","nearbySeries","length","totalSeries","timeSeries","theme","sx","minWidth","maxWidth","maxHeight","padding","position","top","left","backgroundColor","palette","designSystem","grey","borderRadius","color","fontSize","visibility","opacity","transition","zIndex","tooltip","overflow","overflowY","style","transform","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,eAAe,CAAC;AAGnD,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AACvC,OAAOC,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAASC,cAAc,QAAQ,kBAAkB,CAAC;AAClD,SAASC,aAAa,QAAQ,iBAAiB,CAAC;AAChD,SAASC,yBAAyB,QAAQ,iBAAiB,CAAC;AAC5D,SAEEC,oBAAoB,EACpBC,yBAAyB,EACzBC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB,QACX,iBAAiB,CAAC;AACzB,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAW5C,OAAO,MAAMC,gBAAgB,iBAAGb,IAAI,CAAC,SAASa,gBAAgB,CAAC,EAC7DC,QAAQ,CAAA,EACRC,SAAS,CAAA,EACTC,UAAU,CAAA,EACVC,IAAI,CAAA,EACJC,YAAY,CAAA,E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BACxBV,eAAe,EAAEA,eAAe;wBAChCP,aAAa,EAAEA,aAAa;wBAC5B6C,cAAc,EAAE,CAACC,OAAO,GAAK7C,gBAAgB,CAAC6C,OAAO,CAAC;wBACtDhD,YAAY,EAAEA,YAAY;sBAC1B;kCACF,KAACf,cAAc;wBAACgE,MAAM,EAAEhC,YAAY;wBAAEnB,UAAU,EAAEA,UAAU;sBAAI;;cAC1D;UACJ;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { ECharts as EChartsInstance } from 'echarts/core';
3
+ import { UnitOptions, TimeSeries } from '@perses-dev/core';
4
+ import { TimeChartSeriesMapping } from '../model';
5
+ import { CursorCoordinates } from './tooltip-model';
6
+ export interface TimeChartTooltipProps {
7
+ chartRef: React.MutableRefObject<EChartsInstance | undefined>;
8
+ data: TimeSeries[];
9
+ seriesMapping: TimeChartSeriesMapping;
10
+ wrapLabels?: boolean;
11
+ unit?: UnitOptions;
12
+ onUnpinClick?: () => void;
13
+ pinnedPos: CursorCoordinates | null;
14
+ }
15
+ export declare const TimeChartTooltip: import("react").NamedExoticComponent<TimeChartTooltipProps>;
16
+ //# sourceMappingURL=TimeChartTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeChartTooltip.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAA0C,MAAM,iBAAiB,CAAC;AAM5F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC9D,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,aAAa,EAAE,sBAAsB,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,6DA+D3B,CAAC"}
@@ -0,0 +1,76 @@
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 { memo, useState } from 'react';
15
+ import { Box, Portal, Stack } from '@mui/material';
16
+ import useResizeObserver from 'use-resize-observer';
17
+ import { FALLBACK_CHART_WIDTH, useMousePosition } from './tooltip-model';
18
+ import { assembleTransform, getTooltipStyles } from './utils';
19
+ import { getNearbySeriesData } from './nearby-series';
20
+ import { TooltipHeader } from './TooltipHeader';
21
+ import { TooltipContent } from './TooltipContent';
22
+ export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip({ chartRef , data , seriesMapping , wrapLabels , unit , onUnpinClick , pinnedPos }) {
23
+ const [showAllSeries, setShowAllSeries] = useState(false);
24
+ const mousePos = useMousePosition();
25
+ const { height , width , ref: tooltipRef } = useResizeObserver();
26
+ const isTooltipPinned = pinnedPos !== null;
27
+ if (mousePos === null || mousePos.target === null || data === null) return null;
28
+ // Ensure user is hovering over a chart before checking for nearby series.
29
+ if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
30
+ const chart = chartRef.current;
31
+ var ref;
32
+ const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
33
+ const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0);
34
+ // Get series nearby the cursor and pass into tooltip content children.
35
+ const nearbySeries = getNearbySeriesData({
36
+ mousePos,
37
+ data,
38
+ seriesMapping,
39
+ pinnedPos,
40
+ chart,
41
+ unit,
42
+ showAllSeries
43
+ });
44
+ if (nearbySeries.length === 0) {
45
+ return null;
46
+ }
47
+ const totalSeries = data.length;
48
+ return /*#__PURE__*/ _jsx(Portal, {
49
+ children: /*#__PURE__*/ _jsx(Box, {
50
+ ref: tooltipRef,
51
+ sx: (theme)=>getTooltipStyles(theme, pinnedPos),
52
+ style: {
53
+ transform: cursorTransform
54
+ },
55
+ children: /*#__PURE__*/ _jsxs(Stack, {
56
+ spacing: 0.5,
57
+ children: [
58
+ /*#__PURE__*/ _jsx(TooltipHeader, {
59
+ nearbySeries: nearbySeries,
60
+ totalSeries: totalSeries,
61
+ isTooltipPinned: isTooltipPinned,
62
+ showAllSeries: showAllSeries,
63
+ onShowAllClick: (checked)=>setShowAllSeries(checked),
64
+ onUnpinClick: onUnpinClick
65
+ }),
66
+ /*#__PURE__*/ _jsx(TooltipContent, {
67
+ series: nearbySeries,
68
+ wrapLabels: wrapLabels
69
+ })
70
+ ]
71
+ })
72
+ })
73
+ });
74
+ });
75
+
76
+ //# sourceMappingURL=TimeChartTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { memo, useState } from 'react';\nimport { Box, Portal, Stack } from '@mui/material';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { UnitOptions, TimeSeries } from '@perses-dev/core';\nimport useResizeObserver from 'use-resize-observer';\nimport { TimeChartSeriesMapping } from '../model';\nimport { CursorCoordinates, FALLBACK_CHART_WIDTH, useMousePosition } from './tooltip-model';\nimport { assembleTransform, getTooltipStyles } from './utils';\nimport { getNearbySeriesData } from './nearby-series';\nimport { TooltipHeader } from './TooltipHeader';\nimport { TooltipContent } from './TooltipContent';\n\nexport interface TimeChartTooltipProps {\n chartRef: React.MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n wrapLabels?: boolean;\n unit?: UnitOptions;\n onUnpinClick?: () => void;\n pinnedPos: CursorCoordinates | null;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n chartRef,\n data,\n seriesMapping,\n wrapLabels,\n unit,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null;\n\n if (mousePos === null || mousePos.target === null || data === null) return null;\n\n // Ensure user is hovering over a chart before checking for nearby series.\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n const chart = chartRef.current;\n const chartWidth = chart?.getWidth() ?? FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.\n const cursorTransform = assembleTransform(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0);\n\n // Get series nearby the cursor and pass into tooltip content children.\n const nearbySeries = getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n unit,\n showAllSeries,\n });\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal>\n <Box\n ref={tooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos)}\n style={{\n transform: cursorTransform,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["memo","useState","Box","Portal","Stack","useResizeObserver","FALLBACK_CHART_WIDTH","useMousePosition","assembleTransform","getTooltipStyles","getNearbySeriesData","TooltipHeader","TooltipContent","TimeChartTooltip","chartRef","data","seriesMapping","wrapLabels","unit","onUnpinClick","pinnedPos","showAllSeries","setShowAllSeries","mousePos","height","width","ref","tooltipRef","isTooltipPinned","target","tagName","chart","current","chartWidth","getWidth","cursorTransform","nearbySeries","length","totalSeries","sx","theme","style","transform","spacing","onShowAllClick","checked","series"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,IAAI,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AACvC,SAASC,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,eAAe,CAAC;AAGnD,OAAOC,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAA4BC,oBAAoB,EAAEC,gBAAgB,QAAQ,iBAAiB,CAAC;AAC5F,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS,CAAC;AAC9D,SAASC,mBAA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AANA,MAAM,cAANA,MAAM,GAAI,CAAC,EAAEC,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,AAAC;IAEpG,uEAAuE;IACvE,MAAMW,YAAY,GAAG1B,mBAAmB,CAAC;QACvCa,QAAQ;QACRR,IAAI;QACJC,aAAa;QACbI,SAAS;QACTW,KAAK;QACLb,IAAI;QACJG,aAAa;KACd,CAAC,AAAC;IACH,IAAIe,YAAY,CAACC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAMC,WAAW,GAAGvB,IAAI,CAACsB,MAAM,AAAC;IAEhC,qBACE,KAAClC,MAAM;kBACL,cAAA,KAACD,GAAG;YACFwB,GAAG,EAAEC,UAAU;YACfY,EAAE,EAAE,CAACC,KAAK,GAAK/B,gBAAgB,CAAC+B,KAAK,EAAEpB,SAAS,CAAC;YACjDqB,KAAK,EAAE;gBACLC,SAAS,EAAEP,eAAe;aAC3B;sBAED,cAAA,MAAC/B,KAAK;gBAACuC,OAAO,EAAE,GAAG;;kCACjB,KAAChC,aAAa;wBACZyB,YAAY,EAAEA,YAAY;wBAC1BE,WAAW,EAAEA,WAAW;wBACxBV,eAAe,EAAEA,eAAe;wBAChCP,aAAa,EAAEA,aAAa;wBAC5BuB,cAAc,EAAE,CAACC,OAAO,GAAKvB,gBAAgB,CAACuB,OAAO,CAAC;wBACtD1B,YAAY,EAAEA,YAAY;sBAC1B;kCACF,KAACP,cAAc;wBAACkC,MAAM,EAAEV,YAAY;wBAAEnB,UAAU,EAAEA,UAAU;sBAAI;;cAC1D;UACJ;MACC,CACT;AACJ,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { NearbySeriesArray } from './nearby-series';
3
3
  export interface TooltipHeaderProps {
4
4
  nearbySeries: NearbySeriesArray;
@@ -8,5 +8,5 @@ export interface TooltipHeaderProps {
8
8
  onShowAllClick?: (checked: boolean) => void;
9
9
  onUnpinClick?: () => void;
10
10
  }
11
- export declare const TooltipHeader: React.NamedExoticComponent<TooltipHeaderProps>;
11
+ export declare const TooltipHeader: import("react").NamedExoticComponent<TooltipHeaderProps>;
12
12
  //# sourceMappingURL=TooltipHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipHeader.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,gDAqHxB,CAAC"}
1
+ {"version":3,"file":"TooltipHeader.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,0DAsHxB,CAAC"}
@@ -14,12 +14,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Box, Divider, Typography, Stack, Switch } from '@mui/material';
15
15
  import Pin from 'mdi-material-ui/Pin';
16
16
  import PinOutline from 'mdi-material-ui/PinOutline';
17
- import React from 'react';
18
- import { useTimeZone } from '../context/TimeZoneProvider';
17
+ import { memo } from 'react';
18
+ import { format } from 'date-fns';
19
19
  import { TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_WIDTH } from './tooltip-model';
20
- export const TooltipHeader = /*#__PURE__*/ React.memo(function TooltipHeader({ nearbySeries , totalSeries , isTooltipPinned , showAllSeries , onShowAllClick , onUnpinClick }) {
20
+ export const TooltipHeader = /*#__PURE__*/ memo(function TooltipHeader({ nearbySeries , totalSeries , isTooltipPinned , showAllSeries , onShowAllClick , onUnpinClick }) {
21
21
  var ref;
22
- const { formatWithUserTimeZone } = useTimeZone();
23
22
  var ref1;
24
23
  const seriesTimeMs = (ref1 = (ref = nearbySeries[0]) === null || ref === void 0 ? void 0 : ref.date) !== null && ref1 !== void 0 ? ref1 : null;
25
24
  if (seriesTimeMs === null) {
@@ -27,8 +26,8 @@ export const TooltipHeader = /*#__PURE__*/ React.memo(function TooltipHeader({ n
27
26
  }
28
27
  const formatTimeSeriesHeader = (timeMs)=>{
29
28
  const date = new Date(timeMs);
30
- const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');
31
- const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');
29
+ const formattedDate = format(date, 'MMM dd, yyyy - ');
30
+ const formattedTime = format(date, 'HH:mm:ss');
32
31
  return /*#__PURE__*/ _jsxs(Box, {
33
32
  children: [
34
33
  /*#__PURE__*/ _jsx(Typography, {
@@ -83,7 +82,7 @@ export const TooltipHeader = /*#__PURE__*/ React.memo(function TooltipHeader({ n
83
82
  children: [
84
83
  showAllSeriesToggle && /*#__PURE__*/ _jsxs(Stack, {
85
84
  direction: "row",
86
- gap: 1,
85
+ gap: 0.5,
87
86
  alignItems: "center",
88
87
  sx: {
89
88
  textAlign: 'right'
@@ -93,7 +92,7 @@ export const TooltipHeader = /*#__PURE__*/ React.memo(function TooltipHeader({ n
93
92
  sx: {
94
93
  fontSize: 11
95
94
  },
96
- children: "Show All?"
95
+ children: "Show All"
97
96
  }),
98
97
  /*#__PURE__*/ _jsx(Switch, {
99
98
  checked: showAllSeries,
@@ -106,6 +105,9 @@ export const TooltipHeader = /*#__PURE__*/ React.memo(function TooltipHeader({ n
106
105
  sx: (theme)=>({
107
106
  '& .MuiSwitch-switchBase': {
108
107
  color: theme.palette.common.white
108
+ },
109
+ '& .MuiSwitch-track': {
110
+ backgroundColor: theme.palette.common.white
109
111
  }
110
112
  })
111
113
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipHeader.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Typography, Stack, Switch } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport React from 'react';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { NearbySeriesArray } from './nearby-series';\nimport { TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_WIDTH } from './tooltip-model';\n\nexport interface TooltipHeaderProps {\n nearbySeries: NearbySeriesArray;\n totalSeries: number;\n isTooltipPinned: boolean;\n showAllSeries: boolean;\n onShowAllClick?: (checked: boolean) => void;\n onUnpinClick?: () => void;\n}\n\nexport const TooltipHeader = React.memo(function TooltipHeader({\n nearbySeries,\n totalSeries,\n isTooltipPinned,\n showAllSeries,\n onShowAllClick,\n onUnpinClick,\n}: TooltipHeaderProps) {\n const { formatWithUserTimeZone } = useTimeZone();\n\n const seriesTimeMs = nearbySeries[0]?.date ?? null;\n if (seriesTimeMs === null) {\n return null;\n }\n\n const formatTimeSeriesHeader = (timeMs: number) => {\n const date = new Date(timeMs);\n const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');\n const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n // TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT\n const showAllSeriesToggle = totalSeries > 5;\n\n return (\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box\n sx={{\n width: '100%',\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n paddingBottom: 0.5,\n }}\n >\n {formatTimeSeriesHeader(seriesTimeMs)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={1} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography sx={{ fontSize: 11 }}>Show All?</Typography>\n <Switch\n checked={showAllSeries}\n size=\"small\"\n onChange={(_, checked) => {\n if (onShowAllClick !== undefined) {\n return onShowAllClick(checked);\n }\n }}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n <Stack direction=\"row\" alignItems=\"center\">\n <Typography\n sx={{\n marginRight: 0.5,\n fontSize: 11,\n verticalAlign: 'middle',\n }}\n >\n Click to {isTooltipPinned ? 'Unpin' : 'Pin'}\n </Typography>\n {isTooltipPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n sx={{\n fontSize: 16,\n cursor: 'pointer',\n }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n </Stack>\n </Box>\n <Divider\n sx={(theme) => ({\n width: '100%',\n borderColor: theme.palette.grey['500'],\n })}\n />\n </Box>\n );\n});\n"],"names":["Box","Divider","Typography","Stack","Switch","Pin","PinOutline","React","useTimeZone","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","TooltipHeader","memo","nearbySeries","totalSeries","isTooltipPinned","showAllSeries","onShowAllClick","onUnpinClick","formatWithUserTimeZone","seriesTimeMs","date","formatTimeSeriesHeader","timeMs","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","showAllSeriesToggle","width","maxWidth","padding","spacing","backgroundColor","designSystem","grey","position","top","left","display","justifyContent","alignItems","paddingBottom","direction","gap","marginLeft","textAlign","fontSize","checked","size","onChange","_","undefined","marginRight","verticalAlign","onClick","cursor","borderColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,QAAQ,eAAe,CAAC;AACxE,OAAOC,GAAG,MAAM,qBAAqB,CAAC;AACtC,OAAOC,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAOC,KAAK,MAAM,OAAO,CAAC;AAC1B,SAASC,WAAW,QAAQ,6BAA6B,CAAC;AAE1D,SAASC,yBAAyB,EAAEC,iBAAiB,QAAQ,iBAAiB,CAAC;AAW/E,OAAO,MAAMC,aAAa,iB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../src/TimeSeriesTooltip/TooltipHeader.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Divider, Typography, Stack, Switch } from '@mui/material';\nimport Pin from 'mdi-material-ui/Pin';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport { memo } from 'react';\nimport { format } from 'date-fns';\nimport { NearbySeriesArray } from './nearby-series';\nimport { TOOLTIP_BG_COLOR_FALLBACK, TOOLTIP_MAX_WIDTH } from './tooltip-model';\n\nexport interface TooltipHeaderProps {\n nearbySeries: NearbySeriesArray;\n totalSeries: number;\n isTooltipPinned: boolean;\n showAllSeries: boolean;\n onShowAllClick?: (checked: boolean) => void;\n onUnpinClick?: () => void;\n}\n\nexport const TooltipHeader = memo(function TooltipHeader({\n nearbySeries,\n totalSeries,\n isTooltipPinned,\n showAllSeries,\n onShowAllClick,\n onUnpinClick,\n}: TooltipHeaderProps) {\n const seriesTimeMs = nearbySeries[0]?.date ?? null;\n if (seriesTimeMs === null) {\n return null;\n }\n\n const formatTimeSeriesHeader = (timeMs: number) => {\n const date = new Date(timeMs);\n const formattedDate = format(date, 'MMM dd, yyyy - ');\n const formattedTime = format(date, 'HH:mm:ss');\n return (\n <Box>\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.common.white,\n })}\n >\n {formattedDate}\n </Typography>\n <Typography variant=\"caption\">\n <strong>{formattedTime}</strong>\n </Typography>\n </Box>\n );\n };\n\n // TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT\n const showAllSeriesToggle = totalSeries > 5;\n\n return (\n <Box\n sx={(theme) => ({\n width: '100%',\n maxWidth: TOOLTIP_MAX_WIDTH,\n padding: theme.spacing(1.5, 2, 0.5, 2),\n backgroundColor: theme.palette.designSystem?.grey[800] ?? TOOLTIP_BG_COLOR_FALLBACK,\n position: 'sticky',\n top: 0,\n left: 0,\n })}\n >\n <Box\n sx={{\n width: '100%',\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n paddingBottom: 0.5,\n }}\n >\n {formatTimeSeriesHeader(seriesTimeMs)}\n <Stack direction=\"row\" gap={1} sx={{ marginLeft: 'auto' }}>\n {showAllSeriesToggle && (\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\" sx={{ textAlign: 'right' }}>\n <Typography sx={{ fontSize: 11 }}>Show All</Typography>\n <Switch\n checked={showAllSeries}\n size=\"small\"\n onChange={(_, checked) => {\n if (onShowAllClick !== undefined) {\n return onShowAllClick(checked);\n }\n }}\n sx={(theme) => ({\n '& .MuiSwitch-switchBase': {\n color: theme.palette.common.white,\n },\n '& .MuiSwitch-track': {\n backgroundColor: theme.palette.common.white,\n },\n })}\n />\n </Stack>\n )}\n <Stack direction=\"row\" alignItems=\"center\">\n <Typography\n sx={{\n marginRight: 0.5,\n fontSize: 11,\n verticalAlign: 'middle',\n }}\n >\n Click to {isTooltipPinned ? 'Unpin' : 'Pin'}\n </Typography>\n {isTooltipPinned ? (\n <Pin\n onClick={() => {\n if (onUnpinClick !== undefined) {\n onUnpinClick();\n }\n }}\n sx={{\n fontSize: 16,\n cursor: 'pointer',\n }}\n />\n ) : (\n <PinOutline sx={{ fontSize: 16 }} />\n )}\n </Stack>\n </Stack>\n </Box>\n <Divider\n sx={(theme) => ({\n width: '100%',\n borderColor: theme.palette.grey['500'],\n })}\n />\n </Box>\n );\n});\n"],"names":["Box","Divider","Typography","Stack","Switch","Pin","PinOutline","memo","format","TOOLTIP_BG_COLOR_FALLBACK","TOOLTIP_MAX_WIDTH","TooltipHeader","nearbySeries","totalSeries","isTooltipPinned","showAllSeries","onShowAllClick","onUnpinClick","seriesTimeMs","date","formatTimeSeriesHeader","timeMs","Date","formattedDate","formattedTime","variant","sx","theme","color","palette","common","white","strong","showAllSeriesToggle","width","maxWidth","padding","spacing","backgroundColor","designSystem","grey","position","top","left","display","justifyContent","alignItems","paddingBottom","direction","gap","marginLeft","textAlign","fontSize","checked","size","onChange","_","undefined","marginRight","verticalAlign","onClick","cursor","borderColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,QAAQ,eAAe,CAAC;AACxE,OAAOC,GAAG,MAAM,qBAAqB,CAAC;AACtC,OAAOC,UAAU,MAAM,4BAA4B,CAAC;AACpD,SAASC,IAAI,QAAQ,OAAO,CAAC;AAC7B,SAASC,MAAM,QAAQ,UAAU,CAAC;AAElC,SAASC,yBAAyB,EAAEC,iBAAiB,QAAQ,iBAAiB,CAAC;AAW/E,OAAO,MAAMC,aAAa,iBAAGJ,IAAI,CAAC,SAASI,aAAa,CAAC,EACvDC,YAAY,CAAA,EACZC,WAAW,CAAA,EACXC,eAAe,CAAA,EACfC,aAAa,CAAA,EACbC,cAAc,CAAA,EACdC,YAAY,CAAA,EACO,EAAE;QACAL,GAAe;QAAfA,IAAqB;IAA1C,MAAMM,YAAY,GAAGN,CAAAA,IAAqB,GAArBA,CAAAA,GAAe,GAAfA,YAAY,CAAC,CAAC,CAAC,cAAfA,GAAe,WAAM,GAArBA,KAAAA,CAAqB,GAArBA,GAAe,CAAEO,IAAI,cAArBP,IAAqB,cAArBA,IAAqB,GAAI,IAAI,AAAC;IACnD,IAAIM,YAAY,KAAK,IAAI,EAAE;QACzB,OAAO,IAAI,CAAC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AQ;;kDACxC,MAAC5C,UAAU;wCACTwB,EAAE,EAAE;4CACFgC,WAAW,EAAE,GAAG;4CAChBN,QAAQ,EAAE,EAAE;4CACZO,aAAa,EAAE,QAAQ;yCACxB;;4CACF,WACU;4CAAC7C,eAAe,GAAG,OAAO,GAAG,KAAK;;sCAChC;oCACZA,eAAe,iBACd,KAACT,GAAG;wCACFuD,OAAO,EAAE,IAAM;4CACb,IAAI3C,YAAY,KAAKwC,SAAS,EAAE;gDAC9BxC,YAAY,EAAE,CAAC;4CACjB,CAAC;wCACH,CAAC;wCACDS,EAAE,EAAE;4CACF0B,QAAQ,EAAE,EAAE;4CACZS,MAAM,EAAE,SAAS;yCAClB;sCACD,iBAEF,KAACvD,UAAU;wCAACoB,EAAE,EAAE;4CAAE0B,QAAQ,EAAE,EAAE;yCAAE;sCAAI,AACrC;;8BACK;;sBACF;;cACJ;0BACN,KAACnD,OAAO;gBACNyB,EAAE,EAAE,CAACC,KAAK,GAAM,CAAA;wBACdO,KAAK,EAAE,MAAM;wBACb4B,WAAW,EAAEnC,KAAK,CAACE,OAAO,CAACW,IAAI,CAAC,KAAK,CAAC;qBACvC,CAAA,AAAC;cACF;;MACE,CACN;AACJ,CAAC,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
- export * from './TimeSeriesTooltip';
1
+ export * from './LineChartTooltip';
2
2
  export * from './SeriesInfo';
3
3
  export * from './SeriesLabelsStack';
4
4
  export * from './SeriesMarker';
5
+ export * from './TimeChartTooltip';
5
6
  export * from './TooltipContent';
6
7
  export * from './TooltipHeader';
7
8
  export * from './nearby-series';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -10,10 +10,11 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './TimeSeriesTooltip';
13
+ export * from './LineChartTooltip';
14
14
  export * from './SeriesInfo';
15
15
  export * from './SeriesLabelsStack';
16
16
  export * from './SeriesMarker';
17
+ export * from './TimeChartTooltip';
17
18
  export * from './TooltipContent';
18
19
  export * from './TooltipHeader';
19
20
  export * from './nearby-series';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './TimeSeriesTooltip';\nexport * from './SeriesInfo';\nexport * from './SeriesLabelsStack';\nexport * from './SeriesMarker';\nexport * from './TooltipContent';\nexport * from './TooltipHeader';\nexport * from './nearby-series';\nexport * from './tooltip-model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './LineChartTooltip';\nexport * from './SeriesInfo';\nexport * from './SeriesLabelsStack';\nexport * from './SeriesMarker';\nexport * from './TimeChartTooltip';\nexport * from './TooltipContent';\nexport * from './TooltipHeader';\nexport * from './nearby-series';\nexport * from './tooltip-model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { ECharts as EChartsInstance } from 'echarts/core';
2
- import { UnitOptions, EChartsDataFormat } from '../model';
2
+ import { UnitOptions, TimeSeries } from '@perses-dev/core';
3
+ import { EChartsDataFormat, TimeChartSeriesMapping } from '../model';
3
4
  import { CursorCoordinates, CursorData } from './tooltip-model';
4
5
  export declare const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5;
5
6
  export declare const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30;
@@ -17,15 +18,33 @@ export interface NearbySeriesInfo {
17
18
  }
18
19
  export declare type NearbySeriesArray = NearbySeriesInfo[];
19
20
  /**
20
- * Returns formatted series data for the points that are close to the user's cursor
21
+ * Returns formatted series data for the points that are close to the user's cursor.
22
+ * Adjust xBuffer and yBuffer to increase or decrease number of series shown.
23
+ */
24
+ export declare function checkforNearbyTimeSeries(data: TimeSeries[], seriesMapping: TimeChartSeriesMapping, pointInGrid: number[], yBuffer: number, chart?: EChartsInstance, unit?: UnitOptions): NearbySeriesArray;
25
+ /**
26
+ * [DEPRECATED] Returns formatted series data for the points that are close to the user's cursor
21
27
  * Adjust yBuffer to increase or decrease number of series shown
22
28
  */
23
- export declare function checkforNearbySeries(data: EChartsDataFormat, pointInGrid: number[], yBuffer: number, chart?: EChartsInstance, unit?: UnitOptions): NearbySeriesArray;
29
+ export declare function legacyCheckforNearbySeries(data: EChartsDataFormat, pointInGrid: number[], yBuffer: number, chart?: EChartsInstance, unit?: UnitOptions): NearbySeriesArray;
24
30
  /**
25
31
  * Uses mouse position to determine whether user is hovering over a chart canvas
26
32
  * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
27
33
  */
28
- export declare function getNearbySeriesData({ mousePos, pinnedPos, chartData, chart, unit, showAllSeries, }: {
34
+ export declare function getNearbySeriesData({ mousePos, pinnedPos, data, seriesMapping, chart, unit, showAllSeries, }: {
35
+ mousePos: CursorData['coords'];
36
+ pinnedPos: CursorCoordinates | null;
37
+ data: TimeSeries[];
38
+ seriesMapping: TimeChartSeriesMapping;
39
+ chart?: EChartsInstance;
40
+ unit?: UnitOptions;
41
+ showAllSeries?: boolean;
42
+ }): NearbySeriesArray;
43
+ /**
44
+ * [DEPRECATED] Uses mouse position to determine whether user is hovering over a chart canvas
45
+ * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series
46
+ */
47
+ export declare function legacyGetNearbySeriesData({ mousePos, pinnedPos, chartData, chart, unit, showAllSeries, }: {
29
48
  mousePos: CursorData['coords'];
30
49
  pinnedPos: CursorCoordinates | null;
31
50
  chartData: EChartsDataFormat;
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-series.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/nearby-series.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAe,WAAW,EAAE,iBAAiB,EAA+B,MAAM,UAAU,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGhE,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,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;IACnB,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