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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (514) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +9 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +42 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/BarChart/BarChart.d.ts +2 -1
  10. package/dist/BarChart/BarChart.d.ts.map +1 -1
  11. package/dist/BarChart/BarChart.js +11 -6
  12. package/dist/BarChart/BarChart.js.map +1 -1
  13. package/dist/ColorPicker/ColorPicker.d.ts +3 -1
  14. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/ColorPicker.js +28 -13
  16. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  17. package/dist/ColorPicker/OptionsColorPicker.d.ts +9 -0
  18. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  19. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +16 -13
  20. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  21. package/dist/ColorPicker/index.d.ts +1 -0
  22. package/dist/ColorPicker/index.d.ts.map +1 -1
  23. package/dist/ColorPicker/index.js +1 -0
  24. package/dist/ColorPicker/index.js.map +1 -1
  25. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
  26. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  27. package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
  28. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  29. package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -3
  30. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  31. package/dist/DensitySelector/DensitySelector.d.ts +8 -0
  32. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  33. package/dist/DensitySelector/DensitySelector.js +46 -0
  34. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  35. package/dist/DensitySelector/index.d.ts +2 -0
  36. package/dist/DensitySelector/index.d.ts.map +1 -0
  37. package/dist/DensitySelector/index.js +15 -0
  38. package/dist/DensitySelector/index.js.map +1 -0
  39. package/dist/Dialog/Dialog.d.ts +9 -14
  40. package/dist/Dialog/Dialog.d.ts.map +1 -1
  41. package/dist/Dialog/Dialog.js +7 -3
  42. package/dist/Dialog/Dialog.js.map +1 -1
  43. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  44. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  45. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  46. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  47. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  48. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  49. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  50. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  51. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  52. package/dist/DragAndDrop/DragButton.js +97 -0
  53. package/dist/DragAndDrop/DragButton.js.map +1 -0
  54. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  55. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  56. package/dist/DragAndDrop/DropIndicator.js +44 -0
  57. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  58. package/dist/DragAndDrop/index.d.ts +4 -0
  59. package/dist/DragAndDrop/index.d.ts.map +1 -0
  60. package/dist/DragAndDrop/index.js +17 -0
  61. package/dist/DragAndDrop/index.js.map +1 -0
  62. package/dist/DragAndDrop/model.d.ts +11 -0
  63. package/dist/DragAndDrop/model.d.ts.map +1 -0
  64. package/dist/DragAndDrop/model.js +17 -0
  65. package/dist/DragAndDrop/model.js.map +1 -0
  66. package/dist/Drawer/Drawer.d.ts +2 -1
  67. package/dist/Drawer/Drawer.d.ts.map +1 -1
  68. package/dist/Drawer/Drawer.js +1 -1
  69. package/dist/Drawer/Drawer.js.map +1 -1
  70. package/dist/EChart/EChart.d.ts +2 -2
  71. package/dist/EChart/EChart.d.ts.map +1 -1
  72. package/dist/EChart/EChart.js +5 -6
  73. package/dist/EChart/EChart.js.map +1 -1
  74. package/dist/ErrorAlert.d.ts +2 -1
  75. package/dist/ErrorAlert.d.ts.map +1 -1
  76. package/dist/ErrorAlert.js.map +1 -1
  77. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
  78. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  79. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  80. package/dist/FormEditor/FormActions.d.ts +16 -0
  81. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  82. package/dist/FormEditor/FormActions.js +75 -0
  83. package/dist/FormEditor/FormActions.js.map +1 -0
  84. package/dist/FormEditor/index.d.ts +2 -0
  85. package/dist/FormEditor/index.d.ts.map +1 -0
  86. package/dist/FormEditor/index.js +15 -0
  87. package/dist/FormEditor/index.js.map +1 -0
  88. package/dist/FormatControls/FormatControls.d.ts +2 -1
  89. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  90. package/dist/FormatControls/FormatControls.js +2 -2
  91. package/dist/FormatControls/FormatControls.js.map +1 -1
  92. package/dist/GaugeChart/GaugeChart.d.ts +2 -1
  93. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  94. package/dist/GaugeChart/GaugeChart.js +4 -7
  95. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  96. package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
  97. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  98. package/dist/InfoTooltip/InfoTooltip.js +3 -4
  99. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  100. package/dist/JSONEditor.d.ts +2 -1
  101. package/dist/JSONEditor.d.ts.map +1 -1
  102. package/dist/JSONEditor.js.map +1 -1
  103. package/dist/Legend/CompactLegend.d.ts +2 -1
  104. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  105. package/dist/Legend/CompactLegend.js.map +1 -1
  106. package/dist/Legend/Legend.d.ts +2 -1
  107. package/dist/Legend/Legend.d.ts.map +1 -1
  108. package/dist/Legend/Legend.js +8 -4
  109. package/dist/Legend/Legend.js.map +1 -1
  110. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  111. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  112. package/dist/Legend/LegendColorBadge.js +2 -2
  113. package/dist/Legend/LegendColorBadge.js.map +1 -1
  114. package/dist/Legend/ListLegend.d.ts +2 -1
  115. package/dist/Legend/ListLegend.d.ts.map +1 -1
  116. package/dist/Legend/ListLegend.js.map +1 -1
  117. package/dist/Legend/ListLegendItem.d.ts +5 -5
  118. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  119. package/dist/Legend/ListLegendItem.js +8 -12
  120. package/dist/Legend/ListLegendItem.js.map +1 -1
  121. package/dist/Legend/TableLegend.d.ts +2 -1
  122. package/dist/Legend/TableLegend.d.ts.map +1 -1
  123. package/dist/Legend/TableLegend.js +1 -0
  124. package/dist/Legend/TableLegend.js.map +1 -1
  125. package/dist/Legend/legend-model.d.ts.map +1 -1
  126. package/dist/Legend/legend-model.js.map +1 -1
  127. package/dist/LineChart/LineChart.d.ts +1 -1
  128. package/dist/LineChart/LineChart.d.ts.map +1 -1
  129. package/dist/LineChart/LineChart.js +6 -11
  130. package/dist/LineChart/LineChart.js.map +1 -1
  131. package/dist/LinksEditor/LinksEditor.d.ts +8 -0
  132. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -0
  133. package/dist/LinksEditor/LinksEditor.js +161 -0
  134. package/dist/LinksEditor/LinksEditor.js.map +1 -0
  135. package/dist/LinksEditor/index.d.ts +2 -0
  136. package/dist/LinksEditor/index.d.ts.map +1 -0
  137. package/dist/LinksEditor/index.js +15 -0
  138. package/dist/LinksEditor/index.js.map +1 -0
  139. package/dist/ModeSelector/ModeSelector.d.ts +2 -1
  140. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  141. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  142. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  143. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  144. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  145. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
  146. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  147. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  148. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  149. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  150. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  151. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  152. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  153. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  154. package/dist/Overlay/Overlay.d.ts +16 -0
  155. package/dist/Overlay/Overlay.d.ts.map +1 -0
  156. package/dist/Overlay/Overlay.js +52 -0
  157. package/dist/Overlay/Overlay.js.map +1 -0
  158. package/dist/Overlay/index.d.ts +2 -0
  159. package/dist/Overlay/index.d.ts.map +1 -0
  160. package/dist/Overlay/index.js +15 -0
  161. package/dist/Overlay/index.js.map +1 -0
  162. package/dist/PieChart/PieChart.d.ts +14 -0
  163. package/dist/PieChart/PieChart.d.ts.map +1 -0
  164. package/dist/PieChart/PieChart.js +92 -0
  165. package/dist/PieChart/PieChart.js.map +1 -0
  166. package/dist/PieChart/index.d.ts +2 -0
  167. package/dist/PieChart/index.d.ts.map +1 -0
  168. package/dist/PieChart/index.js +15 -0
  169. package/dist/PieChart/index.js.map +1 -0
  170. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
  171. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  172. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  173. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  174. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  175. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  176. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  177. package/dist/SortSelector/SortSelector.d.ts +2 -1
  178. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  179. package/dist/SortSelector/SortSelector.js.map +1 -1
  180. package/dist/SortSelector/SortSelectorButtons.d.ts +9 -0
  181. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  182. package/dist/SortSelector/SortSelectorButtons.js +42 -0
  183. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  184. package/dist/SortSelector/index.d.ts +1 -0
  185. package/dist/SortSelector/index.d.ts.map +1 -1
  186. package/dist/SortSelector/index.js +2 -1
  187. package/dist/SortSelector/index.js.map +1 -1
  188. package/dist/StatChart/StatChart.d.ts +6 -5
  189. package/dist/StatChart/StatChart.d.ts.map +1 -1
  190. package/dist/StatChart/StatChart.js +10 -16
  191. package/dist/StatChart/StatChart.js.map +1 -1
  192. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  193. package/dist/StatChart/calculateFontSize.js +2 -4
  194. package/dist/StatChart/calculateFontSize.js.map +1 -1
  195. package/dist/StatChart/utils/formatStatChartValue.d.ts +3 -0
  196. package/dist/StatChart/utils/formatStatChartValue.d.ts.map +1 -0
  197. package/dist/StatChart/utils/formatStatChartValue.js +26 -0
  198. package/dist/StatChart/utils/formatStatChartValue.js.map +1 -0
  199. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +27 -0
  200. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  201. package/dist/StatusHistoryChart/StatusHistoryChart.js +132 -0
  202. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  203. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +13 -0
  204. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  205. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  206. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  207. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  208. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  209. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  210. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  211. package/dist/StatusHistoryChart/index.d.ts +3 -0
  212. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  213. package/dist/StatusHistoryChart/index.js +16 -0
  214. package/dist/StatusHistoryChart/index.js.map +1 -0
  215. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  216. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  217. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  218. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  219. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  220. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  221. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  222. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  223. package/dist/Table/InnerTable.d.ts.map +1 -1
  224. package/dist/Table/InnerTable.js +2 -1
  225. package/dist/Table/InnerTable.js.map +1 -1
  226. package/dist/Table/Table.d.ts +2 -1
  227. package/dist/Table/Table.d.ts.map +1 -1
  228. package/dist/Table/Table.js +10 -8
  229. package/dist/Table/Table.js.map +1 -1
  230. package/dist/Table/TableCell.d.ts +4 -2
  231. package/dist/Table/TableCell.d.ts.map +1 -1
  232. package/dist/Table/TableCell.js +28 -6
  233. package/dist/Table/TableCell.js.map +1 -1
  234. package/dist/Table/TableCheckbox.d.ts +2 -1
  235. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  236. package/dist/Table/TableCheckbox.js.map +1 -1
  237. package/dist/Table/TableHeaderCell.d.ts +3 -2
  238. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  239. package/dist/Table/TableHeaderCell.js.map +1 -1
  240. package/dist/Table/VirtualizedTable.d.ts +5 -4
  241. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  242. package/dist/Table/VirtualizedTable.js +17 -14
  243. package/dist/Table/VirtualizedTable.js.map +1 -1
  244. package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
  245. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  246. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  247. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  248. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  249. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  250. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  251. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  252. package/dist/Table/index.d.ts +1 -2
  253. package/dist/Table/index.d.ts.map +1 -1
  254. package/dist/Table/index.js +1 -1
  255. package/dist/Table/index.js.map +1 -1
  256. package/dist/Table/model/table-model.d.ts +22 -2
  257. package/dist/Table/model/table-model.d.ts.map +1 -1
  258. package/dist/Table/model/table-model.js +27 -21
  259. package/dist/Table/model/table-model.js.map +1 -1
  260. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  261. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  262. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  263. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  264. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
  265. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  266. package/dist/ThresholdsEditor/ThresholdsEditor.js +18 -26
  267. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  268. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  269. package/dist/TimeChart/TimeChart.js +5 -8
  270. package/dist/TimeChart/TimeChart.js.map +1 -1
  271. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +19 -0
  272. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  273. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +43 -28
  274. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  275. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +36 -0
  276. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  277. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  278. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  279. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  280. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  281. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  282. package/dist/TimeRangeSelector/index.js.map +1 -0
  283. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  284. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  285. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  286. package/dist/TimeRangeSelector/utils.js.map +1 -0
  287. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  288. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  289. package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  290. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  291. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
  292. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  293. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -2
  294. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  295. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
  296. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  297. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  298. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
  299. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  300. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  301. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  302. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  303. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  304. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  305. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
  306. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  307. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  308. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  309. package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -14
  310. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  311. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  312. package/dist/TimeSeriesTooltip/nearby-series.js +15 -25
  313. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  314. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +8 -1
  315. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  316. package/dist/TimeSeriesTooltip/tooltip-model.js +13 -2
  317. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  318. package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
  319. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  320. package/dist/TimeSeriesTooltip/utils.js +2 -4
  321. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  322. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  323. package/dist/TransformsEditor/TransformEditor.d.ts +9 -0
  324. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -0
  325. package/dist/TransformsEditor/TransformEditor.js +289 -0
  326. package/dist/TransformsEditor/TransformEditor.js.map +1 -0
  327. package/dist/TransformsEditor/TransformEditorContainer.d.ts +10 -0
  328. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -0
  329. package/dist/TransformsEditor/TransformEditorContainer.js +118 -0
  330. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -0
  331. package/dist/TransformsEditor/TransformsEditor.d.ts +9 -0
  332. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -0
  333. package/dist/TransformsEditor/TransformsEditor.js +90 -0
  334. package/dist/TransformsEditor/TransformsEditor.js.map +1 -0
  335. package/dist/TransformsEditor/index.d.ts +2 -0
  336. package/dist/TransformsEditor/index.d.ts.map +1 -0
  337. package/dist/TransformsEditor/index.js +15 -0
  338. package/dist/TransformsEditor/index.js.map +1 -0
  339. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +10 -0
  340. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -0
  341. package/dist/ValueMappingEditor/ValueMappingEditor.js +374 -0
  342. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
  343. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +8 -0
  344. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -0
  345. package/dist/ValueMappingEditor/ValueMappingsEditor.js +118 -0
  346. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
  347. package/dist/ValueMappingEditor/index.d.ts +2 -0
  348. package/dist/ValueMappingEditor/index.d.ts.map +1 -0
  349. package/dist/ValueMappingEditor/index.js +15 -0
  350. package/dist/ValueMappingEditor/index.js.map +1 -0
  351. package/dist/YAxisLabel.d.ts +2 -1
  352. package/dist/YAxisLabel.d.ts.map +1 -1
  353. package/dist/YAxisLabel.js +4 -2
  354. package/dist/YAxisLabel.js.map +1 -1
  355. package/dist/cjs/AlignSelector/AlignSelector.js +50 -0
  356. package/dist/cjs/AlignSelector/index.js +30 -0
  357. package/dist/cjs/BarChart/BarChart.js +12 -7
  358. package/dist/cjs/ColorPicker/ColorPicker.js +28 -54
  359. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +18 -15
  360. package/dist/cjs/ColorPicker/index.js +1 -0
  361. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
  362. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -3
  363. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  364. package/dist/cjs/DensitySelector/index.js +30 -0
  365. package/dist/cjs/Dialog/Dialog.js +7 -3
  366. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  367. package/dist/cjs/DragAndDrop/DragButton.js +121 -0
  368. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  369. package/dist/cjs/DragAndDrop/index.js +32 -0
  370. package/dist/cjs/DragAndDrop/model.js +25 -0
  371. package/dist/cjs/Drawer/Drawer.js +1 -1
  372. package/dist/cjs/EChart/EChart.js +5 -47
  373. package/dist/cjs/FormEditor/FormActions.js +83 -0
  374. package/dist/cjs/FormEditor/index.js +30 -0
  375. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  376. package/dist/cjs/GaugeChart/GaugeChart.js +5 -8
  377. package/dist/cjs/InfoTooltip/InfoTooltip.js +3 -9
  378. package/dist/cjs/Legend/Legend.js +8 -4
  379. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  380. package/dist/cjs/Legend/ListLegendItem.js +6 -50
  381. package/dist/cjs/Legend/TableLegend.js +1 -0
  382. package/dist/cjs/LineChart/LineChart.js +8 -13
  383. package/dist/cjs/LinksEditor/LinksEditor.js +174 -0
  384. package/dist/cjs/LinksEditor/index.js +30 -0
  385. package/dist/cjs/Overlay/Overlay.js +71 -0
  386. package/dist/cjs/Overlay/index.js +30 -0
  387. package/dist/cjs/PieChart/PieChart.js +100 -0
  388. package/dist/cjs/PieChart/index.js +30 -0
  389. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  390. package/dist/cjs/SortSelector/SortSelectorButtons.js +50 -0
  391. package/dist/cjs/SortSelector/index.js +2 -1
  392. package/dist/cjs/StatChart/StatChart.js +13 -19
  393. package/dist/cjs/StatChart/calculateFontSize.js +2 -4
  394. package/dist/cjs/StatChart/utils/formatStatChartValue.js +34 -0
  395. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +140 -0
  396. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  397. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  398. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  399. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  400. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  401. package/dist/cjs/Table/InnerTable.js +2 -1
  402. package/dist/cjs/Table/Table.js +9 -7
  403. package/dist/cjs/Table/TableCell.js +28 -6
  404. package/dist/cjs/Table/VirtualizedTable.js +17 -14
  405. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  406. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  407. package/dist/cjs/Table/index.js +1 -7
  408. package/dist/cjs/Table/model/table-model.js +30 -21
  409. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
  410. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +18 -26
  411. package/dist/cjs/TimeChart/TimeChart.js +5 -8
  412. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +37 -30
  413. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  414. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  415. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
  416. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +6 -11
  417. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -2
  418. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
  419. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -14
  420. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +15 -25
  421. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +22 -2
  422. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -4
  423. package/dist/cjs/TransformsEditor/TransformEditor.js +297 -0
  424. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +131 -0
  425. package/dist/cjs/TransformsEditor/TransformsEditor.js +103 -0
  426. package/dist/cjs/TransformsEditor/index.js +30 -0
  427. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +387 -0
  428. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +131 -0
  429. package/dist/cjs/ValueMappingEditor/index.js +30 -0
  430. package/dist/cjs/YAxisLabel.js +4 -2
  431. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  432. package/dist/cjs/controls/TextField.js +54 -0
  433. package/dist/cjs/controls/index.js +30 -0
  434. package/dist/cjs/index.js +12 -1
  435. package/dist/cjs/model/timeOption.js +19 -1
  436. package/dist/cjs/theme/index.js +1 -0
  437. package/dist/cjs/theme/palette/background.js +2 -0
  438. package/dist/cjs/theme/theme.js +6 -6
  439. package/dist/cjs/utils/chart-actions.js +2 -3
  440. package/dist/cjs/utils/format.js +19 -1
  441. package/dist/cjs/utils/theme-gen.js +5 -7
  442. package/dist/context/ChartsProvider.d.ts +2 -2
  443. package/dist/context/ChartsProvider.d.ts.map +1 -1
  444. package/dist/context/ChartsProvider.js.map +1 -1
  445. package/dist/context/TimeZoneProvider.d.ts +4 -4
  446. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  447. package/dist/context/TimeZoneProvider.js +1 -1
  448. package/dist/context/TimeZoneProvider.js.map +1 -1
  449. package/dist/controls/TextField.d.ts +9 -0
  450. package/dist/controls/TextField.d.ts.map +1 -0
  451. package/dist/controls/TextField.js +41 -0
  452. package/dist/controls/TextField.js.map +1 -0
  453. package/dist/controls/index.d.ts +2 -0
  454. package/dist/controls/index.d.ts.map +1 -0
  455. package/dist/controls/index.js +15 -0
  456. package/dist/controls/index.js.map +1 -0
  457. package/dist/index.d.ts +12 -1
  458. package/dist/index.d.ts.map +1 -1
  459. package/dist/index.js +12 -1
  460. package/dist/index.js.map +1 -1
  461. package/dist/model/timeOption.d.ts +2 -1
  462. package/dist/model/timeOption.d.ts.map +1 -1
  463. package/dist/model/timeOption.js +13 -2
  464. package/dist/model/timeOption.js.map +1 -1
  465. package/dist/test/render.d.ts +3 -3
  466. package/dist/test/render.d.ts.map +1 -1
  467. package/dist/test/render.js.map +1 -1
  468. package/dist/theme/index.d.ts +2 -0
  469. package/dist/theme/index.d.ts.map +1 -1
  470. package/dist/theme/index.js +1 -0
  471. package/dist/theme/index.js.map +1 -1
  472. package/dist/theme/palette/background.d.ts.map +1 -1
  473. package/dist/theme/palette/background.js +2 -0
  474. package/dist/theme/palette/background.js.map +1 -1
  475. package/dist/theme/theme.d.ts +2 -2
  476. package/dist/theme/theme.d.ts.map +1 -1
  477. package/dist/theme/theme.js +5 -5
  478. package/dist/theme/theme.js.map +1 -1
  479. package/dist/utils/axis.d.ts +1 -7
  480. package/dist/utils/axis.d.ts.map +1 -1
  481. package/dist/utils/axis.js.map +1 -1
  482. package/dist/utils/chart-actions.d.ts.map +1 -1
  483. package/dist/utils/chart-actions.js +2 -3
  484. package/dist/utils/chart-actions.js.map +1 -1
  485. package/dist/utils/component-ids.d.ts.map +1 -1
  486. package/dist/utils/component-ids.js.map +1 -1
  487. package/dist/utils/format.d.ts +10 -4
  488. package/dist/utils/format.d.ts.map +1 -1
  489. package/dist/utils/format.js +16 -1
  490. package/dist/utils/format.js.map +1 -1
  491. package/dist/utils/theme-gen.js +5 -7
  492. package/dist/utils/theme-gen.js.map +1 -1
  493. package/package.json +12 -8
  494. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
  495. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  496. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  497. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
  498. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  499. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  500. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  501. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
  502. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  503. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  504. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  505. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  506. package/dist/DateTimeRangePicker/index.js.map +0 -1
  507. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  508. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  509. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  510. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
  511. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  512. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  513. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  514. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -0,0 +1,42 @@
1
+ // Copyright 2024 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 { Button, ButtonGroup } from '@mui/material';
15
+ export function SortSelectorButtons({ onChange, value, ...props }) {
16
+ const handleSortChange = (sort)=>{
17
+ onChange(sort);
18
+ };
19
+ return /*#__PURE__*/ _jsxs(ButtonGroup, {
20
+ "aria-label": "Sort",
21
+ ...props,
22
+ children: [
23
+ /*#__PURE__*/ _jsx(Button, {
24
+ onClick: ()=>handleSortChange(undefined),
25
+ variant: value === undefined ? 'contained' : 'outlined',
26
+ children: "None"
27
+ }),
28
+ /*#__PURE__*/ _jsx(Button, {
29
+ onClick: ()=>handleSortChange('asc'),
30
+ variant: value === 'asc' ? 'contained' : 'outlined',
31
+ children: "Asc"
32
+ }),
33
+ /*#__PURE__*/ _jsx(Button, {
34
+ onClick: ()=>handleSortChange('desc'),
35
+ variant: value === 'desc' ? 'contained' : 'outlined',
36
+ children: "Desc"
37
+ })
38
+ ]
39
+ });
40
+ }
41
+
42
+ //# sourceMappingURL=SortSelectorButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/SortSelector/SortSelectorButtons.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, ButtonGroup, ButtonGroupProps } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { SortOption } from './SortSelector';\n\nexport interface SortSelectorButtonsProps extends Omit<ButtonGroupProps, 'onChange'> {\n value?: SortOption;\n onChange: (sort?: SortOption) => void;\n}\n\nexport function SortSelectorButtons({ onChange, value, ...props }: SortSelectorButtonsProps): ReactElement {\n const handleSortChange = (sort?: SortOption): void => {\n onChange(sort);\n };\n\n return (\n <ButtonGroup aria-label=\"Sort\" {...props}>\n <Button onClick={() => handleSortChange(undefined)} variant={value === undefined ? 'contained' : 'outlined'}>\n None\n </Button>\n <Button onClick={() => handleSortChange('asc')} variant={value === 'asc' ? 'contained' : 'outlined'}>\n Asc\n </Button>\n <Button onClick={() => handleSortChange('desc')} variant={value === 'desc' ? 'contained' : 'outlined'}>\n Desc\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup","SortSelectorButtons","onChange","value","props","handleSortChange","sort","aria-label","onClick","undefined","variant"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,WAAW,QAA0B,gBAAgB;AAStE,OAAO,SAASC,oBAAoB,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGC,OAAiC;IACzF,MAAMC,mBAAmB,CAACC;QACxBJ,SAASI;IACX;IAEA,qBACE,MAACN;QAAYO,cAAW;QAAQ,GAAGH,KAAK;;0BACtC,KAACL;gBAAOS,SAAS,IAAMH,iBAAiBI;gBAAYC,SAASP,UAAUM,YAAY,cAAc;0BAAY;;0BAG7G,KAACV;gBAAOS,SAAS,IAAMH,iBAAiB;gBAAQK,SAASP,UAAU,QAAQ,cAAc;0BAAY;;0BAGrG,KAACJ;gBAAOS,SAAS,IAAMH,iBAAiB;gBAASK,SAASP,UAAU,SAAS,cAAc;0BAAY;;;;AAK7G"}
@@ -1,2 +1,3 @@
1
1
  export * from './SortSelector';
2
+ export * from './SortSelectorButtons';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SortSelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SortSelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2024 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './SortSelector';
14
+ export * from './SortSelectorButtons';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/SortSelector/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 './SortSelector';\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,iBAAiB"}
1
+ {"version":3,"sources":["../../src/SortSelector/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './SortSelector';\nexport * from './SortSelectorButtons';\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,iBAAiB;AAC/B,cAAc,wBAAwB"}
@@ -1,20 +1,21 @@
1
+ import { FC } from 'react';
1
2
  import { FormatOptions } from '@perses-dev/core';
2
3
  import { LineSeriesOption } from 'echarts/charts';
3
- import { GraphSeries } from '../model/graph';
4
+ import { GraphSeries } from '../model';
4
5
  import { FontSizeOption } from '../FontSizeSelector';
5
6
  export interface StatChartData {
6
- calculatedValue?: number | null;
7
+ color: string;
8
+ calculatedValue?: string | number | null;
7
9
  seriesData?: GraphSeries;
8
10
  }
9
11
  export interface StatChartProps {
10
12
  width: number;
11
13
  height: number;
12
14
  data: StatChartData;
13
- format: FormatOptions;
14
- color?: string;
15
+ format?: FormatOptions;
15
16
  sparkline?: LineSeriesOption;
16
17
  showSeriesName?: boolean;
17
18
  valueFontSize?: FontSizeOption;
18
19
  }
19
- export declare function StatChart(props: StatChartProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare const StatChart: FC<StatChartProps>;
20
21
  //# sourceMappingURL=StatChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatChart.d.ts","sourceRoot":"","sources":["../../src/StatChart/StatChart.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAe,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAI9D,OAAO,EAAiC,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAUrD,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAoI9C"}
1
+ {"version":3,"file":"StatChart.d.ts","sourceRoot":"","sources":["../../src/StatChart/StatChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAiC,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKjF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAWrD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAiIxC,CAAC"}
@@ -12,16 +12,16 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { useMemo } from 'react';
15
- import { formatValue } from '@perses-dev/core';
16
15
  import { Box, Typography, styled } from '@mui/material';
17
16
  import merge from 'lodash/merge';
18
17
  import { use } from 'echarts/core';
19
18
  import { LineChart as EChartsLineChart } from 'echarts/charts';
20
19
  import { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';
21
20
  import { CanvasRenderer } from 'echarts/renderers';
22
- import { useChartsTheme } from '../context/ChartsProvider';
21
+ import { useChartsTheme } from '../context';
23
22
  import { EChart } from '../EChart';
24
23
  import { useOptimalFontSize } from './calculateFontSize';
24
+ import { formatStatChartValue } from './utils/formatStatChartValue';
25
25
  use([
26
26
  EChartsLineChart,
27
27
  GridComponent,
@@ -34,21 +34,15 @@ const LINE_HEIGHT = 1.2;
34
34
  const SERIES_NAME_MAX_FONT_SIZE = 30;
35
35
  const SERIES_NAME_FONT_WEIGHT = 400;
36
36
  const VALUE_FONT_WEIGHT = 700;
37
- export function StatChart(props) {
38
- var _data_seriesData, _data_seriesData1;
39
- const { width, height, data, format, color, sparkline, showSeriesName, valueFontSize } = props;
37
+ export const StatChart = (props)=>{
38
+ const { width, height, data, sparkline, showSeriesName, format, valueFontSize } = props;
40
39
  const chartsTheme = useChartsTheme();
41
- let formattedValue = '';
42
- if (data.calculatedValue === null) {
43
- formattedValue = 'null';
44
- } else if (typeof data.calculatedValue === 'number') {
45
- formattedValue = formatValue(data.calculatedValue, format);
46
- }
40
+ const color = data.color;
41
+ const formattedValue = formatStatChartValue(data.calculatedValue, format);
47
42
  const containerPadding = chartsTheme.container.padding.default;
48
- var _data_seriesData_name;
49
43
  // calculate series name font size and height
50
44
  let seriesNameFontSize = useOptimalFontSize({
51
- text: (_data_seriesData_name = data === null || data === void 0 ? void 0 : (_data_seriesData = data.seriesData) === null || _data_seriesData === void 0 ? void 0 : _data_seriesData.name) !== null && _data_seriesData_name !== void 0 ? _data_seriesData_name : '',
45
+ text: data?.seriesData?.name ?? '',
52
46
  fontWeight: SERIES_NAME_FONT_WEIGHT,
53
47
  width,
54
48
  height: height * 0.125,
@@ -147,7 +141,7 @@ export function StatChart(props) {
147
141
  showSeriesName && /*#__PURE__*/ _jsx(SeriesName, {
148
142
  padding: containerPadding,
149
143
  fontSize: seriesNameFontSize,
150
- children: (_data_seriesData1 = data.seriesData) === null || _data_seriesData1 === void 0 ? void 0 : _data_seriesData1.name
144
+ children: data.seriesData?.name
151
145
  }),
152
146
  /*#__PURE__*/ _jsx(Value, {
153
147
  variant: "h3",
@@ -167,7 +161,7 @@ export function StatChart(props) {
167
161
  })
168
162
  ]
169
163
  });
170
- }
164
+ };
171
165
  const SeriesName = styled(Typography, {
172
166
  shouldForwardProp: (prop)=>prop !== 'padding' && prop !== 'fontSize'
173
167
  })(({ theme, padding, fontSize })=>({
@@ -181,7 +175,7 @@ const SeriesName = styled(Typography, {
181
175
  const Value = styled(Typography, {
182
176
  shouldForwardProp: (prop)=>prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline'
183
177
  })(({ theme, color, padding, fontSize, sparkline })=>({
184
- color: color !== null && color !== void 0 ? color : theme.palette.text.primary,
178
+ color: color ?? theme.palette.text.primary,
185
179
  fontSize: `${fontSize}px`,
186
180
  padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,
187
181
  whiteSpace: 'nowrap',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/StatChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\nimport { Box, Typography, styled } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { LineChart as EChartsLineChart, LineSeriesOption } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { EChart } from '../EChart';\nimport { GraphSeries } from '../model/graph';\nimport { FontSizeOption } from '../FontSizeSelector';\nimport { useOptimalFontSize } from './calculateFontSize';\n\nuse([EChartsLineChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst LINE_HEIGHT = 1.2;\nconst SERIES_NAME_MAX_FONT_SIZE = 30;\nconst SERIES_NAME_FONT_WEIGHT = 400;\nconst VALUE_FONT_WEIGHT = 700;\n\nexport interface StatChartData {\n calculatedValue?: number | null;\n seriesData?: GraphSeries;\n}\n\nexport interface StatChartProps {\n width: number;\n height: number;\n data: StatChartData;\n format: FormatOptions;\n color?: string;\n sparkline?: LineSeriesOption;\n showSeriesName?: boolean;\n valueFontSize?: FontSizeOption;\n}\n\nexport function StatChart(props: StatChartProps) {\n const { width, height, data, format, color, sparkline, showSeriesName, valueFontSize } = props;\n const chartsTheme = useChartsTheme();\n\n let formattedValue = '';\n if (data.calculatedValue === null) {\n formattedValue = 'null';\n } else if (typeof data.calculatedValue === 'number') {\n formattedValue = formatValue(data.calculatedValue, format);\n }\n\n const containerPadding = chartsTheme.container.padding.default;\n\n // calculate series name font size and height\n let seriesNameFontSize = useOptimalFontSize({\n text: data?.seriesData?.name ?? '',\n fontWeight: SERIES_NAME_FONT_WEIGHT,\n width,\n height: height * 0.125, // assume series name will take 12.5% of available height\n lineHeight: LINE_HEIGHT,\n maxSize: SERIES_NAME_MAX_FONT_SIZE,\n });\n const seriesNameHeight = showSeriesName ? seriesNameFontSize * LINE_HEIGHT + containerPadding : 0;\n\n // calculate value font size and height\n const availableWidth = width - containerPadding * 2;\n const availableHeight = height - seriesNameHeight;\n const optimalValueFontSize = useOptimalFontSize({\n text: formattedValue,\n // override the font size if user selects it in the settings\n fontSizeOverride: valueFontSize,\n fontWeight: VALUE_FONT_WEIGHT,\n // without sparkline, use only 50% of the available width so it looks better for multiseries\n width: sparkline ? availableWidth : availableWidth * 0.5,\n // with sparkline, use only 25% of available height to leave room for chart\n // without sparkline, value should take up 90% of available space\n height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,\n lineHeight: LINE_HEIGHT,\n });\n const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;\n\n // make sure the series name font size is slightly smaller than value font size\n seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.seriesData === undefined) return chartsTheme.noDataOption;\n\n const series = data.seriesData;\n const statSeries: LineSeriesOption[] = [];\n\n if (sparkline !== undefined) {\n const lineSeries = {\n type: 'line',\n name: series.name,\n data: series.values,\n zlevel: 1,\n symbol: 'none',\n animation: false,\n silent: true,\n };\n const mergedSeries = merge(lineSeries, sparkline);\n statSeries.push(mergedSeries);\n }\n\n const option = {\n title: {\n show: false,\n },\n grid: {\n show: false,\n top: '35%', // adds space above sparkline\n right: 0,\n bottom: 0,\n left: 0,\n containLabel: false,\n },\n xAxis: {\n type: 'time',\n show: false,\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n show: false,\n min: (value: { min: number; max: number }) => {\n if (value.min >= 0 && value.min <= 1) {\n // helps with percent-decimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n return value.min;\n },\n },\n tooltip: {\n show: false,\n },\n series: statSeries,\n };\n\n return option;\n }, [data, chartsTheme, sparkline]);\n\n const textAlignment = sparkline ? 'auto' : 'center';\n const textStyles = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: textAlignment,\n alignItems: textAlignment,\n };\n\n return (\n <Box sx={{ height: '100%', width: '100%', ...textStyles }}>\n {showSeriesName && (\n <SeriesName padding={containerPadding} fontSize={seriesNameFontSize}>\n {data.seriesData?.name}\n </SeriesName>\n )}\n <Value variant=\"h3\" color={color} fontSize={optimalValueFontSize} padding={containerPadding}>\n {formattedValue}\n </Value>\n {sparkline !== undefined && (\n <EChart\n sx={{\n width: '100%',\n height: height - seriesNameHeight - valueFontHeight,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n renderer=\"svg\"\n />\n )}\n </Box>\n );\n}\n\nconst SeriesName = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'padding' && prop !== 'fontSize',\n})<{ padding?: number; fontSize?: number; textAlignment?: string }>(({ theme, padding, fontSize }) => ({\n color: theme.palette.text.secondary,\n padding: `${padding}px`,\n fontSize: `${fontSize}px`,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}));\n\nconst Value = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline',\n})<{ color?: string; padding?: number; fontSize?: number; sparkline?: boolean }>(\n ({ theme, color, padding, fontSize, sparkline }) => ({\n color: color ?? theme.palette.text.primary,\n fontSize: `${fontSize}px`,\n padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,\n whiteSpace: 'nowrap',\n lineHeight: LINE_HEIGHT,\n })\n);\n"],"names":["useMemo","formatValue","Box","Typography","styled","merge","use","LineChart","EChartsLineChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","useOptimalFontSize","LINE_HEIGHT","SERIES_NAME_MAX_FONT_SIZE","SERIES_NAME_FONT_WEIGHT","VALUE_FONT_WEIGHT","StatChart","props","data","width","height","format","color","sparkline","showSeriesName","valueFontSize","chartsTheme","formattedValue","calculatedValue","containerPadding","container","padding","default","seriesNameFontSize","text","seriesData","name","fontWeight","lineHeight","maxSize","seriesNameHeight","availableWidth","availableHeight","optimalValueFontSize","fontSizeOverride","valueFontHeight","Math","min","option","undefined","noDataOption","series","statSeries","lineSeries","type","values","zlevel","symbol","animation","silent","mergedSeries","push","title","show","grid","top","right","bottom","left","containLabel","xAxis","boundaryGap","yAxis","value","tooltip","textAlignment","textStyles","display","flexDirection","justifyContent","alignItems","sx","SeriesName","fontSize","Value","variant","theme","echartsTheme","renderer","shouldForwardProp","prop","palette","secondary","overflow","textOverflow","whiteSpace","primary"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,WAAW,QAAuB,mBAAmB;AAC9D,SAASC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACxD,OAAOC,WAAW,eAAe;AACjC,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,aAAaC,gBAAgB,QAA0B,iBAAiB;AACjF,SAASC,aAAa,E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AA;QACnDD,OAAOA,kBAAAA,mBAAAA,QAASgE,MAAMK,OAAO,CAACzD,IAAI,CAAC8D,OAAO;QAC1Cb,UAAU,CAAC,EAAEA,SAAS,EAAE,CAAC;QACzBpD,SAASR,YAAY,CAAC,EAAEQ,QAAQ,GAAG,EAAEA,QAAQ,KAAK,EAAEA,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAEA,QAAQ,EAAE,CAAC;QACnFgE,YAAY;QACZzD,YAAY1B;IACd,CAAA"}
1
+ {"version":3,"sources":["../../src/StatChart/StatChart.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 { FC, useMemo } from 'react';\nimport { FormatOptions } from '@perses-dev/core';\nimport { Box, Typography, styled } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { LineChart as EChartsLineChart, LineSeriesOption } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context';\nimport { EChart } from '../EChart';\nimport { GraphSeries } from '../model';\nimport { FontSizeOption } from '../FontSizeSelector';\nimport { useOptimalFontSize } from './calculateFontSize';\nimport { formatStatChartValue } from './utils/formatStatChartValue';\n\nuse([EChartsLineChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst LINE_HEIGHT = 1.2;\nconst SERIES_NAME_MAX_FONT_SIZE = 30;\nconst SERIES_NAME_FONT_WEIGHT = 400;\nconst VALUE_FONT_WEIGHT = 700;\n\nexport interface StatChartData {\n color: string;\n calculatedValue?: string | number | null;\n seriesData?: GraphSeries;\n}\n\nexport interface StatChartProps {\n width: number;\n height: number;\n data: StatChartData;\n format?: FormatOptions;\n sparkline?: LineSeriesOption;\n showSeriesName?: boolean;\n valueFontSize?: FontSizeOption;\n}\n\nexport const StatChart: FC<StatChartProps> = (props) => {\n const { width, height, data, sparkline, showSeriesName, format, valueFontSize } = props;\n const chartsTheme = useChartsTheme();\n const color = data.color;\n\n const formattedValue = formatStatChartValue(data.calculatedValue, format);\n\n const containerPadding = chartsTheme.container.padding.default;\n\n // calculate series name font size and height\n let seriesNameFontSize = useOptimalFontSize({\n text: data?.seriesData?.name ?? '',\n fontWeight: SERIES_NAME_FONT_WEIGHT,\n width,\n height: height * 0.125, // assume series name will take 12.5% of available height\n lineHeight: LINE_HEIGHT,\n maxSize: SERIES_NAME_MAX_FONT_SIZE,\n });\n\n const seriesNameHeight = showSeriesName ? seriesNameFontSize * LINE_HEIGHT + containerPadding : 0;\n\n // calculate value font size and height\n const availableWidth = width - containerPadding * 2;\n const availableHeight = height - seriesNameHeight;\n const optimalValueFontSize = useOptimalFontSize({\n text: formattedValue,\n // override the font size if user selects it in the settings\n fontSizeOverride: valueFontSize,\n fontWeight: VALUE_FONT_WEIGHT,\n // without sparkline, use only 50% of the available width so it looks better for multiseries\n width: sparkline ? availableWidth : availableWidth * 0.5,\n // with sparkline, use only 25% of available height to leave room for chart\n // without sparkline, value should take up 90% of available space\n height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,\n lineHeight: LINE_HEIGHT,\n });\n const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;\n\n // make sure the series name font size is slightly smaller than value font size\n seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.seriesData === undefined) return chartsTheme.noDataOption;\n\n const series = data.seriesData;\n const statSeries: LineSeriesOption[] = [];\n\n if (sparkline !== undefined) {\n const lineSeries = {\n type: 'line',\n name: series.name,\n data: series.values,\n zlevel: 1,\n symbol: 'none',\n animation: false,\n silent: true,\n };\n const mergedSeries = merge(lineSeries, sparkline);\n statSeries.push(mergedSeries);\n }\n\n const option = {\n title: {\n show: false,\n },\n grid: {\n show: false,\n top: '35%', // adds space above sparkline\n right: 0,\n bottom: 0,\n left: 0,\n containLabel: false,\n },\n xAxis: {\n type: 'time',\n show: false,\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n show: false,\n min: (value: { min: number; max: number }): number => {\n if (value.min >= 0 && value.min <= 1) {\n // helps with percent-decimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n return value.min;\n },\n },\n tooltip: {\n show: false,\n },\n series: statSeries,\n };\n\n return option;\n }, [data, chartsTheme, sparkline]);\n\n const textAlignment = sparkline ? 'auto' : 'center';\n const textStyles = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: textAlignment,\n alignItems: textAlignment,\n };\n\n return (\n <Box sx={{ height: '100%', width: '100%', ...textStyles }}>\n {showSeriesName && (\n <SeriesName padding={containerPadding} fontSize={seriesNameFontSize}>\n {data.seriesData?.name}\n </SeriesName>\n )}\n <Value variant=\"h3\" color={color} fontSize={optimalValueFontSize} padding={containerPadding}>\n {formattedValue}\n </Value>\n {sparkline !== undefined && (\n <EChart\n sx={{\n width: '100%',\n height: height - seriesNameHeight - valueFontHeight,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n renderer=\"svg\"\n />\n )}\n </Box>\n );\n};\n\nconst SeriesName = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'padding' && prop !== 'fontSize',\n})<{ padding?: number; fontSize?: number; textAlignment?: string }>(({ theme, padding, fontSize }) => ({\n color: theme.palette.text.secondary,\n padding: `${padding}px`,\n fontSize: `${fontSize}px`,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}));\n\nconst Value = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline',\n})<{ color?: string; padding?: number; fontSize?: number; sparkline?: boolean }>(\n ({ theme, color, padding, fontSize, sparkline }) => ({\n color: color ?? theme.palette.text.primary,\n fontSize: `${fontSize}px`,\n padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,\n whiteSpace: 'nowrap',\n lineHeight: LINE_HEIGHT,\n })\n);\n"],"names":["useMemo","Box","Typography","styled","merge","use","LineChart","EChartsLineChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","useOptimalFontSize","formatStatChartValue","LINE_HEIGHT","SERIES_NAME_MAX_FONT_SIZE","SERIES_NAME_FONT_WEIGHT","VALUE_FONT_WEIGHT","StatChart","props","width","height","data","sparkline","showSeriesName","format","valueFontSize","chartsTheme","color","formattedValue","calculatedValue","containerPadding","container","padding","default","seriesNameFontSize","text","seriesData","name","fontWeight","lineHeight","maxSize","seriesNameHeight","availableWidth","availableHeight","optimalValueFontSize","fontSizeOverride","valueFontHeight","Math","min","option","undefined","noDataOption","series","statSeries","lineSeries","type","values","zlevel","symbol","animation","silent","mergedSeries","push","title","show","grid","top","right","bottom","left","containLabel","xAxis","boundaryGap","yAxis","value","tooltip","textAlignment","textStyles","display","flexDirection","justifyContent","alignItems","sx","SeriesName","fontSize","Value","variant","theme","echartsTheme","renderer","shouldForwardProp","prop","palette","secondary","overflow","textOverflow","whiteSpace","primary"],"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,SAAaA,OAAO,QAAQ,QAAQ;AAEpC,SAASC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACxD,OAAOC,WAAW,eAAe;AACjC,SAASC,GAAG,QAA2B,e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Q,GAAG,EAAEA,QAAQ,KAAK,EAAEA,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAEA,QAAQ,EAAE,CAAC;QACnFgE,YAAY;QACZzD,YAAY1B;IACd,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculateFontSize.d.ts","sourceRoot":"","sources":["../../src/StatChart/calculateFontSize.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC;AAcD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,iBAAiB,UA0BnB"}
1
+ {"version":3,"file":"calculateFontSize.d.ts","sourceRoot":"","sources":["../../src/StatChart/calculateFontSize.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC;AAcD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,MAAM,CA0B5B"}
@@ -31,10 +31,8 @@ function getGlobalCanvasContext() {
31
31
  return Number(fontSizeOverride);
32
32
  }
33
33
  const textStyle = echartsTheme.textStyle;
34
- var _Number;
35
- const fontSize = (_Number = Number(textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize)) !== null && _Number !== void 0 ? _Number : 12;
36
- var _textStyle_fontFamily;
37
- const fontFamily = (_textStyle_fontFamily = textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontFamily) !== null && _textStyle_fontFamily !== void 0 ? _textStyle_fontFamily : 'Lato';
34
+ const fontSize = Number(textStyle?.fontSize) ?? 12;
35
+ const fontFamily = textStyle?.fontFamily ?? 'Lato';
38
36
  // set the font on the canvas context
39
37
  const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;
40
38
  ctx.font = fontStyle;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/calculateFontSize.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\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext() {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize) {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"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,cAAc,QAAQ,4BAA4B;AAa3D,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,aAAa,CAAC,UAAUC,UAAU,CAAC;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,YAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG,SAAS;QACvBD;IAAjB,MAAME,WAAWF,CAAAA,UAAAA,OAAOC,sBAAAA,gCAAAA,UAAWC,QAAQ,eAA1BF,qBAAAA,UAA+B;QAC7BC;IAAnB,MAAME,aAAaF,CAAAA,wBAAAA,sBAAAA,gCAAAA,UAAWE,UAAU,cAArBF,mCAAAA,wBAAyB;IAE5C,qCAAqC;IACrC,MAAMG,YAAY,CAAC,EAAEb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,WAAW,CAAC;IAC7DN,IAAIQ,IAAI,GAAGD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,WAAW,CAACjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,KAAK,GAAIU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,GAAG,CAACH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,GAAG,CAACF,eAAef,WAAWe;AACtD"}
1
+ {"version":3,"sources":["../../src/StatChart/calculateFontSize.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\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext(): CanvasRenderingContext2D {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize): number {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWid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-0,0 +1,3 @@
1
+ import { FormatOptions } from '@perses-dev/core';
2
+ export declare const formatStatChartValue: (value?: string | number | null, format?: FormatOptions) => string;
3
+ //# sourceMappingURL=formatStatChartValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatStatChartValue.d.ts","sourceRoot":"","sources":["../../../src/StatChart/utils/formatStatChartValue.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,oBAAoB,WAAY,MAAM,GAAG,MAAM,GAAG,IAAI,WAAW,aAAa,KAAG,MAU7F,CAAC"}
@@ -0,0 +1,26 @@
1
+ // Copyright 2024 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 { formatValue } from '@perses-dev/core';
14
+ export const formatStatChartValue = (value, format)=>{
15
+ if (value === null) {
16
+ return 'null';
17
+ } else if (typeof value === 'number') {
18
+ return formatValue(value, format);
19
+ } else if (value === undefined) {
20
+ return '';
21
+ } else {
22
+ return value;
23
+ }
24
+ };
25
+
26
+ //# sourceMappingURL=formatStatChartValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/StatChart/utils/formatStatChartValue.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormatOptions, formatValue } from '@perses-dev/core';\n\nexport const formatStatChartValue = (value?: string | number | null, format?: FormatOptions): string => {\n if (value === null) {\n return 'null';\n } else if (typeof value === 'number') {\n return formatValue(value, format);\n } else if (value === undefined) {\n return '';\n } else {\n return value;\n }\n};\n"],"names":["formatValue","formatStatChartValue","value","format","undefined"],"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,SAAwBA,WAAW,QAAQ,mBAAmB;AAE9D,OAAO,MAAMC,uBAAuB,CAACC,OAAgCC;IACnE,IAAID,UAAU,MAAM;QAClB,OAAO;IACT,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpC,OAAOF,YAAYE,OAAOC;IAC5B,OAAO,IAAID,UAAUE,WAAW;QAC9B,OAAO;IACT,OAAO;QACL,OAAOF;IACT;AACF,EAAE"}
@@ -0,0 +1,27 @@
1
+ import { LegendComponentOption } from 'echarts/components';
2
+ import { TimeScale } from '@perses-dev/core';
3
+ import { FC } from 'react';
4
+ export type StatusHistoryData = [number, number, number | undefined];
5
+ export interface StatusHistoryDataItem {
6
+ value: StatusHistoryData;
7
+ label?: string;
8
+ itemStyle?: {
9
+ color?: string;
10
+ borderColor?: string;
11
+ borderWidth?: number;
12
+ };
13
+ }
14
+ export interface StatusHistoryChartProps {
15
+ height: number;
16
+ data: StatusHistoryDataItem[];
17
+ xAxisCategories: number[];
18
+ yAxisCategories: string[];
19
+ legend?: LegendComponentOption;
20
+ timeScale?: TimeScale;
21
+ colors?: Array<{
22
+ value: number | string;
23
+ color: string;
24
+ }>;
25
+ }
26
+ export declare const StatusHistoryChart: FC<StatusHistoryChartProps>;
27
+ //# sourceMappingURL=StatusHistoryChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusHistoryChart.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/StatusHistoryChart.tsx"],"names":[],"mappings":"AAeA,OAAO,EAML,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAiB3B,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,iBAAiB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA+F1D,CAAC"}
@@ -0,0 +1,132 @@
1
+ // Copyright 2024 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 { Box, useTheme } from '@mui/material';
15
+ import { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';
16
+ import { GridComponent, DatasetComponent, TitleComponent, TooltipComponent, VisualMapComponent } from 'echarts/components';
17
+ import { use } from 'echarts/core';
18
+ import { CanvasRenderer } from 'echarts/renderers';
19
+ import { useChartsTheme } from '../context/ChartsProvider';
20
+ import { useTimeZone } from '../context/TimeZoneProvider';
21
+ import { EChart } from '../EChart';
22
+ import { getFormattedStatusHistoryAxisLabel } from './get-formatted-axis-label';
23
+ import { generateTooltipHTML } from './StatusHistoryTooltip';
24
+ use([
25
+ EChartsHeatmapChart,
26
+ VisualMapComponent,
27
+ GridComponent,
28
+ DatasetComponent,
29
+ TitleComponent,
30
+ TooltipComponent,
31
+ CanvasRenderer
32
+ ]);
33
+ export const StatusHistoryChart = (props)=>{
34
+ const { height, data, xAxisCategories, yAxisCategories, timeScale, colors } = props;
35
+ const { timeZone } = useTimeZone();
36
+ const chartsTheme = useChartsTheme();
37
+ const theme = useTheme();
38
+ const option = {
39
+ tooltip: {
40
+ appendToBody: true,
41
+ formatter: (params)=>{
42
+ return generateTooltipHTML({
43
+ data: params.data.value,
44
+ label: params.data.label,
45
+ marker: params.marker,
46
+ xAxisCategories,
47
+ yAxisCategories,
48
+ theme
49
+ });
50
+ }
51
+ },
52
+ grid: {
53
+ top: '5%',
54
+ bottom: '5%'
55
+ },
56
+ xAxis: {
57
+ type: 'category',
58
+ data: xAxisCategories,
59
+ axisLine: {
60
+ show: false
61
+ },
62
+ splitArea: {
63
+ show: false
64
+ },
65
+ axisLabel: {
66
+ hideOverlap: true,
67
+ formatter: getFormattedStatusHistoryAxisLabel(timeScale?.rangeMs ?? 0, timeZone)
68
+ }
69
+ },
70
+ yAxis: {
71
+ type: 'category',
72
+ data: yAxisCategories,
73
+ axisLine: {
74
+ show: false
75
+ },
76
+ splitArea: {
77
+ show: false,
78
+ interval: 0
79
+ },
80
+ splitLine: {
81
+ show: false
82
+ },
83
+ axisLabel: {
84
+ interval: 0
85
+ }
86
+ },
87
+ visualMap: {
88
+ show: false,
89
+ type: 'piecewise',
90
+ pieces: colors
91
+ },
92
+ series: [
93
+ {
94
+ name: 'Status history',
95
+ type: 'heatmap',
96
+ coordinateSystem: 'cartesian2d',
97
+ data: data,
98
+ label: {
99
+ show: false
100
+ },
101
+ itemStyle: {
102
+ borderWidth: 1,
103
+ borderType: 'solid',
104
+ borderColor: '#ffffff'
105
+ },
106
+ emphasis: {
107
+ itemStyle: {
108
+ opacity: 0.5
109
+ }
110
+ }
111
+ }
112
+ ]
113
+ };
114
+ return /*#__PURE__*/ _jsx(Box, {
115
+ style: {
116
+ height: height
117
+ },
118
+ sx: {
119
+ overflow: 'auto'
120
+ },
121
+ children: /*#__PURE__*/ _jsx(EChart, {
122
+ sx: {
123
+ width: '100%',
124
+ height: height
125
+ },
126
+ option: option,
127
+ theme: chartsTheme.echartsTheme
128
+ })
129
+ });
130
+ };
131
+
132
+ //# sourceMappingURL=StatusHistoryChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/StatusHistoryChart/StatusHistoryChart.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';\nimport {\n GridComponent,\n DatasetComponent,\n TitleComponent,\n TooltipComponent,\n VisualMapComponent,\n LegendComponentOption,\n} from 'echarts/components';\nimport { use } from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { TimeScale } from '@perses-dev/core';\nimport { EChartsCoreOption } from 'echarts';\nimport { FC } from 'react';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { EChart } from '../EChart';\nimport { getFormattedStatusHistoryAxisLabel } from './get-formatted-axis-label';\nimport { generateTooltipHTML } from './StatusHistoryTooltip';\n\nuse([\n EChartsHeatmapChart,\n VisualMapComponent,\n GridComponent,\n DatasetComponent,\n TitleComponent,\n TooltipComponent,\n CanvasRenderer,\n]);\n\nexport type StatusHistoryData = [number, number, number | undefined];\n\nexport interface StatusHistoryDataItem {\n value: StatusHistoryData;\n label?: string;\n itemStyle?: {\n color?: string;\n borderColor?: string;\n borderWidth?: number;\n };\n}\n\nexport interface StatusHistoryChartProps {\n height: number;\n data: StatusHistoryDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n legend?: LegendComponentOption;\n timeScale?: TimeScale;\n colors?: Array<{ value: number | string; color: string }>;\n}\n\nexport const StatusHistoryChart: FC<StatusHistoryChartProps> = (props) => {\n const { height, data, xAxisCategories, yAxisCategories, timeScale, colors } = props;\n const { timeZone } = useTimeZone();\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n\n const option: EChartsCoreOption = {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: StatusHistoryDataItem; marker: string }) => {\n return generateTooltipHTML({\n data: params.data.value,\n label: params.data.label,\n marker: params.marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n });\n },\n },\n grid: {\n top: '5%',\n bottom: '5%',\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLine: {\n show: false,\n },\n splitArea: {\n show: false,\n },\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedStatusHistoryAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: {\n type: 'category',\n data: yAxisCategories,\n axisLine: {\n show: false,\n },\n splitArea: {\n show: false,\n interval: 0,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n interval: 0,\n },\n },\n visualMap: {\n show: false,\n type: 'piecewise',\n pieces: colors,\n },\n series: [\n {\n name: 'Status history',\n type: 'heatmap',\n coordinateSystem: 'cartesian2d',\n data: data,\n label: {\n show: false,\n },\n itemStyle: {\n borderWidth: 1,\n borderType: 'solid',\n borderColor: '#ffffff',\n },\n emphasis: {\n itemStyle: {\n opacity: 0.5,\n },\n },\n },\n ],\n };\n\n return (\n <Box style={{ height: height }} sx={{ overflow: 'auto' }}>\n <EChart\n sx={{\n width: '100%',\n height: height,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n </Box>\n );\n};\n"],"names":["Box","useTheme","HeatmapChart","EChartsHeatmapChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","VisualMapComponent","use","CanvasRenderer","useChartsTheme","useTimeZone","EChart","getFormattedStatusHistoryAxisLabel","generateTooltipHTML","StatusHistoryChart","props","height","data","xAxisCategories","yAxisCategories","timeScale","colors","timeZone","chartsTheme","theme","option","tooltip","appendToBody","formatter","params","value","label","marker","grid","top","bottom","xAxis","type","axisLine","show","splitArea","axisLabel","hideOverlap","rangeMs","yAxis","interval","splitLine","visualMap","pieces","series","name","coordinateSystem","itemStyle","borderWidth","borderType","borderColor","emphasis","opacity","style","sx","overflow","width","echartsTheme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAC9C,SAASC,gBAAgBC,mBAAmB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P,MAAM;YACR;YACAE,WAAW;gBACTI,UAAU;YACZ;QACF;QACAE,WAAW;YACTR,MAAM;YACNF,MAAM;YACNW,QAAQ3B;QACV;QACA4B,QAAQ;YACN;gBACEC,MAAM;gBACNb,MAAM;gBACNc,kBAAkB;gBAClBlC,MAAMA;gBACNc,OAAO;oBACLQ,MAAM;gBACR;gBACAa,WAAW;oBACTC,aAAa;oBACbC,YAAY;oBACZC,aAAa;gBACf;gBACAC,UAAU;oBACRJ,WAAW;wBACTK,SAAS;oBACX;gBACF;YACF;SACD;IACH;IAEA,qBACE,KAAC3D;QAAI4D,OAAO;YAAE1C,QAAQA;QAAO;QAAG2C,IAAI;YAAEC,UAAU;QAAO;kBACrD,cAAA,KAACjD;YACCgD,IAAI;gBACFE,OAAO;gBACP7C,QAAQA;YACV;YACAS,QAAQA;YACRD,OAAOD,YAAYuC,YAAY;;;AAIvC,EAAE"}
@@ -0,0 +1,13 @@
1
+ import { Theme } from '@mui/material';
2
+ import { StatusHistoryData } from './StatusHistoryChart';
3
+ interface CustomTooltipProps {
4
+ data: StatusHistoryData;
5
+ label?: string;
6
+ marker: string;
7
+ xAxisCategories: number[];
8
+ yAxisCategories: string[];
9
+ theme: Theme;
10
+ }
11
+ export declare function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme, }: CustomTooltipProps): string;
12
+ export {};
13
+ //# sourceMappingURL=StatusHistoryTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusHistoryTooltip.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/StatusHistoryTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,UAAU,kBAAkB;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,eAAe,EACf,eAAe,EACf,KAAK,GACN,EAAE,kBAAkB,GAAG,MAAM,CAmC7B"}
@@ -0,0 +1,47 @@
1
+ // Copyright 2024 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 { css } from '@mui/material';
14
+ import { getDateAndTime } from '../utils';
15
+ export function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme }) {
16
+ const [x, y] = data;
17
+ const xAxisLabel = xAxisCategories[x];
18
+ const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);
19
+ const tooltipHeader = css`
20
+ border-bottom: 1px solid ${theme.palette.grey[500]};
21
+ padding-bottom: 8px;
22
+ `;
23
+ const tooltipContentStyles = css`
24
+ display: flex;
25
+ justify-content: space-between;
26
+ padding-top: 8px;
27
+ `;
28
+ const labelStyles = css`
29
+ margin-right: 16px;
30
+ `;
31
+ return `
32
+ <div>
33
+ <div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
34
+ <div style="${tooltipContentStyles.styles}">
35
+ <div style="${labelStyles.styles}">
36
+ ${marker}
37
+ <strong>${yAxisCategories[y]}</strong>
38
+ </div>
39
+ <div>
40
+ ${label}
41
+ </div>
42
+ </div>
43
+ </div>
44
+ `;
45
+ }
46
+
47
+ //# sourceMappingURL=StatusHistoryTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/StatusHistoryChart/StatusHistoryTooltip.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { css, Theme } from '@mui/material';\nimport { getDateAndTime } from '../utils';\nimport { StatusHistoryData } from './StatusHistoryChart';\n\ninterface CustomTooltipProps {\n data: StatusHistoryData;\n label?: string;\n marker: string;\n xAxisCategories: number[];\n yAxisCategories: string[];\n theme: Theme;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n}: CustomTooltipProps): string {\n const [x, y] = data;\n const xAxisLabel = xAxisCategories[x];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${yAxisCategories[y]}</strong>\n </div>\n <div>\n ${label}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","getDateAndTime","generateTooltipHTML","data","label","marker","xAxisCategories","yAxisCategories","theme","x","y","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","styles"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAe,gBAAgB;AAC3C,SAASC,cAAc,QAAQ,WAAW;AAY1C,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,eAAe,EACfC,KAAK,EACc;IACnB,MAAM,CAACC,GAAGC,EAAE,GAAGP;IACf,MAAMQ,aAAaL,eAAe,CAACG,EAAE;IAErC,MAAM,EAAEG,aAAa,EAAEC,aAAa,EAAE,GAAGZ,eAAeU;IAExD,MAAMG,gBAAgBd,GAAG,CAAC;6BACC,EAAEQ,MAAMO,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBjB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMkB,cAAclB,GAAG,CAAC;;EAExB,CAAC;IAED,OAAO,CAAC;;kBAEQ,EAAEc,cAAcK,MAAM,CAAC,EAAE,EAAEP,cAAc,CAAC,EAAEC,cAAc;kBAC1D,EAAEI,qBAAqBE,MAAM,CAAC;oBAC5B,EAAED,YAAYC,MAAM,CAAC;UAC/B,EAAEd,OAAO;kBACD,EAAEE,eAAe,CAACG,EAAE,CAAC;;;UAG7B,EAAEN,MAAM;;;;EAIhB,CAAC;AACH"}
@@ -0,0 +1,2 @@
1
+ export declare function getFormattedStatusHistoryAxisLabel(rangeMs: number, timezone: string): (value: number) => string;
2
+ //# sourceMappingURL=get-formatted-axis-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-formatted-axis-label.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/get-formatted-axis-label.ts"],"names":[],"mappings":"AAgBA,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAC1D,MAAM,KAAG,MAAM,CA6BxC"}