@perses-dev/components 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59

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 (505) hide show
  1. package/dist/BarChart/BarChart.d.ts +3 -4
  2. package/dist/BarChart/BarChart.d.ts.map +1 -1
  3. package/dist/BarChart/BarChart.js +17 -11
  4. package/dist/BarChart/BarChart.js.map +1 -1
  5. package/dist/BarChart/index.js.map +1 -1
  6. package/dist/ColorPicker/ColorPicker.d.ts +1 -2
  7. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  8. package/dist/ColorPicker/ColorPicker.js +1 -1
  9. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  10. package/dist/ColorPicker/index.js.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.d.ts +1 -2
  12. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  13. package/dist/ContentWithLegend/ContentWithLegend.js +2 -2
  14. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  15. package/dist/ContentWithLegend/index.js.map +1 -1
  16. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +3 -3
  17. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  18. package/dist/ContentWithLegend/model/content-with-legend-model.js +21 -21
  19. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  20. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +1 -2
  21. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  22. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +8 -24
  23. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  24. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
  25. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  26. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
  27. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  28. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +1 -2
  29. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  30. package/dist/DateTimeRangePicker/TimeRangeSelector.js +2 -2
  31. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  32. package/dist/DateTimeRangePicker/index.js.map +1 -1
  33. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  34. package/dist/Dialog/Dialog.d.ts +6 -6
  35. package/dist/Dialog/Dialog.d.ts.map +1 -1
  36. package/dist/Dialog/Dialog.js +5 -5
  37. package/dist/Dialog/Dialog.js.map +1 -1
  38. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +1 -2
  39. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  40. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  41. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  42. package/dist/Dialog/index.js.map +1 -1
  43. package/dist/Drawer/Drawer.d.ts +1 -2
  44. package/dist/Drawer/Drawer.d.ts.map +1 -1
  45. package/dist/Drawer/Drawer.js +4 -3
  46. package/dist/Drawer/Drawer.js.map +1 -1
  47. package/dist/Drawer/index.js.map +1 -1
  48. package/dist/EChart/EChart.d.ts +7 -7
  49. package/dist/EChart/EChart.d.ts.map +1 -1
  50. package/dist/EChart/EChart.js +3 -3
  51. package/dist/EChart/EChart.js.map +1 -1
  52. package/dist/EChart/index.js.map +1 -1
  53. package/dist/ErrorAlert.d.ts +1 -2
  54. package/dist/ErrorAlert.d.ts.map +1 -1
  55. package/dist/ErrorAlert.js +1 -1
  56. package/dist/ErrorAlert.js.map +1 -1
  57. package/dist/ErrorBoundary.js.map +1 -1
  58. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -3
  59. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  60. package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
  61. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  62. package/dist/FontSizeSelector/index.js.map +1 -1
  63. package/dist/FormatControls/FormatControls.d.ts +8 -0
  64. package/dist/FormatControls/FormatControls.d.ts.map +1 -0
  65. package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
  66. package/dist/FormatControls/FormatControls.js.map +1 -0
  67. package/dist/FormatControls/index.d.ts +2 -0
  68. package/dist/FormatControls/index.d.ts.map +1 -0
  69. package/dist/{UnitSelector → FormatControls}/index.js +1 -1
  70. package/dist/FormatControls/index.js.map +1 -0
  71. package/dist/GaugeChart/GaugeChart.d.ts +6 -7
  72. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  73. package/dist/GaugeChart/GaugeChart.js +12 -12
  74. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  75. package/dist/GaugeChart/index.js.map +1 -1
  76. package/dist/InfoTooltip/InfoTooltip.d.ts +2 -2
  77. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  78. package/dist/InfoTooltip/InfoTooltip.js +4 -4
  79. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  80. package/dist/InfoTooltip/index.js.map +1 -1
  81. package/dist/JSONEditor.d.ts +4 -4
  82. package/dist/JSONEditor.d.ts.map +1 -1
  83. package/dist/JSONEditor.js +9 -8
  84. package/dist/JSONEditor.js.map +1 -1
  85. package/dist/Legend/CompactLegend.d.ts +1 -2
  86. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  87. package/dist/Legend/CompactLegend.js +1 -1
  88. package/dist/Legend/CompactLegend.js.map +1 -1
  89. package/dist/Legend/Legend.d.ts +1 -2
  90. package/dist/Legend/Legend.d.ts.map +1 -1
  91. package/dist/Legend/Legend.js +4 -4
  92. package/dist/Legend/Legend.js.map +1 -1
  93. package/dist/Legend/LegendColorBadge.js +1 -1
  94. package/dist/Legend/LegendColorBadge.js.map +1 -1
  95. package/dist/Legend/ListLegend.d.ts +1 -2
  96. package/dist/Legend/ListLegend.d.ts.map +1 -1
  97. package/dist/Legend/ListLegend.js +1 -1
  98. package/dist/Legend/ListLegend.js.map +1 -1
  99. package/dist/Legend/ListLegendItem.d.ts +2 -2
  100. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  101. package/dist/Legend/ListLegendItem.js +7 -11
  102. package/dist/Legend/ListLegendItem.js.map +1 -1
  103. package/dist/Legend/TableLegend.d.ts +1 -2
  104. package/dist/Legend/TableLegend.d.ts.map +1 -1
  105. package/dist/Legend/TableLegend.js +2 -2
  106. package/dist/Legend/TableLegend.js.map +1 -1
  107. package/dist/Legend/index.js.map +1 -1
  108. package/dist/Legend/legend-model.d.ts +2 -2
  109. package/dist/Legend/legend-model.d.ts.map +1 -1
  110. package/dist/Legend/legend-model.js.map +1 -1
  111. package/dist/LineChart/LineChart.d.ts +2 -2
  112. package/dist/LineChart/LineChart.d.ts.map +1 -1
  113. package/dist/LineChart/LineChart.js +22 -24
  114. package/dist/LineChart/LineChart.js.map +1 -1
  115. package/dist/LineChart/index.js.map +1 -1
  116. package/dist/ModeSelector/ModeSelector.d.ts +2 -3
  117. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  118. package/dist/ModeSelector/ModeSelector.js +2 -2
  119. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  120. package/dist/ModeSelector/index.js.map +1 -1
  121. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  122. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  123. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  124. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  125. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -3
  126. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  127. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  128. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  129. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  130. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  131. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  132. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  133. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  134. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  135. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  136. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  137. package/dist/OptionsEditorLayout/index.js.map +1 -1
  138. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -2
  139. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  140. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +23 -7
  141. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  142. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  143. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
  144. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  145. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +4 -4
  146. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  147. package/dist/SettingsAutocomplete/index.js.map +1 -1
  148. package/dist/SortSelector/SortSelector.d.ts +2 -3
  149. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  150. package/dist/SortSelector/SortSelector.js +2 -2
  151. package/dist/SortSelector/SortSelector.js.map +1 -1
  152. package/dist/SortSelector/index.js.map +1 -1
  153. package/dist/StatChart/StatChart.d.ts +3 -4
  154. package/dist/StatChart/StatChart.d.ts.map +1 -1
  155. package/dist/StatChart/StatChart.js +10 -10
  156. package/dist/StatChart/StatChart.js.map +1 -1
  157. package/dist/StatChart/calculateFontSize.js +8 -8
  158. package/dist/StatChart/calculateFontSize.js.map +1 -1
  159. package/dist/StatChart/index.js.map +1 -1
  160. package/dist/Table/InnerTable.d.ts +2 -2
  161. package/dist/Table/InnerTable.d.ts.map +1 -1
  162. package/dist/Table/InnerTable.js +2 -2
  163. package/dist/Table/InnerTable.js.map +1 -1
  164. package/dist/Table/Table.d.ts +1 -2
  165. package/dist/Table/Table.d.ts.map +1 -1
  166. package/dist/Table/Table.js +3 -3
  167. package/dist/Table/Table.js.map +1 -1
  168. package/dist/Table/TableBody.d.ts +2 -2
  169. package/dist/Table/TableBody.d.ts.map +1 -1
  170. package/dist/Table/TableBody.js.map +1 -1
  171. package/dist/Table/TableCell.d.ts +1 -1
  172. package/dist/Table/TableCell.d.ts.map +1 -1
  173. package/dist/Table/TableCell.js +4 -4
  174. package/dist/Table/TableCell.js.map +1 -1
  175. package/dist/Table/TableCheckbox.d.ts +1 -2
  176. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  177. package/dist/Table/TableCheckbox.js +1 -1
  178. package/dist/Table/TableCheckbox.js.map +1 -1
  179. package/dist/Table/TableHead.d.ts +2 -2
  180. package/dist/Table/TableHead.d.ts.map +1 -1
  181. package/dist/Table/TableHead.js.map +1 -1
  182. package/dist/Table/TableHeaderCell.d.ts +1 -2
  183. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  184. package/dist/Table/TableHeaderCell.js +1 -1
  185. package/dist/Table/TableHeaderCell.js.map +1 -1
  186. package/dist/Table/TableRow.d.ts +1 -1
  187. package/dist/Table/TableRow.d.ts.map +1 -1
  188. package/dist/Table/TableRow.js.map +1 -1
  189. package/dist/Table/VirtualizedTable.d.ts +2 -2
  190. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  191. package/dist/Table/VirtualizedTable.js +8 -8
  192. package/dist/Table/VirtualizedTable.js.map +1 -1
  193. package/dist/Table/VirtualizedTableContainer.d.ts +2 -2
  194. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  195. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  196. package/dist/Table/hooks/useTableKeyboardNav.d.ts +1 -1
  197. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  198. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  199. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  200. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +21 -21
  201. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  202. package/dist/Table/index.js.map +1 -1
  203. package/dist/Table/model/table-model.d.ts +6 -6
  204. package/dist/Table/model/table-model.d.ts.map +1 -1
  205. package/dist/Table/model/table-model.js +11 -11
  206. package/dist/Table/model/table-model.js.map +1 -1
  207. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +1 -2
  208. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -1
  209. package/dist/ThresholdsEditor/ThresholdColorPicker.js +4 -4
  210. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  211. package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
  212. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  213. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  214. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  215. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -2
  216. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  217. package/dist/ThresholdsEditor/ThresholdsEditor.js +23 -21
  218. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  219. package/dist/ThresholdsEditor/index.js.map +1 -1
  220. package/dist/TimeChart/TimeChart.d.ts +3 -3
  221. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  222. package/dist/TimeChart/TimeChart.js +110 -67
  223. package/dist/TimeChart/TimeChart.js.map +1 -1
  224. package/dist/TimeChart/index.js.map +1 -1
  225. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  226. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  227. package/dist/TimeSeriesTooltip/LineChartTooltip.js +11 -10
  228. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  229. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -2
  230. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  231. package/dist/TimeSeriesTooltip/SeriesInfo.js +3 -3
  232. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  233. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +1 -2
  234. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  235. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  236. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  237. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +1 -2
  238. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  239. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  240. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  241. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  242. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  243. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +6 -6
  244. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  245. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +1 -2
  246. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  247. package/dist/TimeSeriesTooltip/TooltipContent.js +2 -2
  248. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  249. package/dist/TimeSeriesTooltip/TooltipHeader.js +7 -7
  250. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  251. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  252. package/dist/TimeSeriesTooltip/nearby-series.d.ts +8 -8
  253. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  254. package/dist/TimeSeriesTooltip/nearby-series.js +44 -45
  255. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  256. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +13 -26
  257. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  258. package/dist/TimeSeriesTooltip/tooltip-model.js +5 -11
  259. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  260. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  261. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  262. package/dist/TimeSeriesTooltip/utils.js +5 -4
  263. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  264. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
  265. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
  266. package/dist/ToolbarIconButton/ToolbarIconButton.js +32 -0
  267. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
  268. package/dist/ToolbarIconButton/index.d.ts +2 -0
  269. package/dist/ToolbarIconButton/index.d.ts.map +1 -0
  270. package/dist/ToolbarIconButton/index.js +15 -0
  271. package/dist/ToolbarIconButton/index.js.map +1 -0
  272. package/dist/YAxisLabel.d.ts +1 -2
  273. package/dist/YAxisLabel.d.ts.map +1 -1
  274. package/dist/YAxisLabel.js +1 -1
  275. package/dist/YAxisLabel.js.map +1 -1
  276. package/dist/cjs/BarChart/BarChart.js +25 -17
  277. package/dist/cjs/BarChart/index.js +10 -8
  278. package/dist/cjs/ColorPicker/ColorPicker.js +19 -15
  279. package/dist/cjs/ColorPicker/index.js +10 -8
  280. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +13 -11
  281. package/dist/cjs/ContentWithLegend/index.js +10 -8
  282. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +29 -25
  283. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +30 -44
  284. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +13 -11
  285. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +14 -12
  286. package/dist/cjs/DateTimeRangePicker/index.js +12 -10
  287. package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
  288. package/dist/cjs/Dialog/Dialog.js +16 -14
  289. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +12 -10
  290. package/dist/cjs/Dialog/index.js +11 -9
  291. package/dist/cjs/Drawer/Drawer.js +8 -5
  292. package/dist/cjs/Drawer/index.js +10 -8
  293. package/dist/cjs/EChart/EChart.js +16 -12
  294. package/dist/cjs/EChart/index.js +10 -8
  295. package/dist/cjs/ErrorAlert.js +6 -4
  296. package/dist/cjs/ErrorBoundary.js +4 -2
  297. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +10 -8
  298. package/dist/cjs/FontSizeSelector/index.js +10 -8
  299. package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
  300. package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
  301. package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
  302. package/dist/cjs/GaugeChart/index.js +10 -8
  303. package/dist/cjs/InfoTooltip/InfoTooltip.js +16 -14
  304. package/dist/cjs/InfoTooltip/index.js +10 -8
  305. package/dist/cjs/JSONEditor.js +19 -16
  306. package/dist/cjs/Legend/CompactLegend.js +10 -8
  307. package/dist/cjs/Legend/Legend.js +16 -14
  308. package/dist/cjs/Legend/LegendColorBadge.js +8 -6
  309. package/dist/cjs/Legend/ListLegend.js +11 -9
  310. package/dist/cjs/Legend/ListLegendItem.js +20 -20
  311. package/dist/cjs/Legend/TableLegend.js +8 -6
  312. package/dist/cjs/Legend/index.js +11 -9
  313. package/dist/cjs/Legend/legend-model.js +3 -1
  314. package/dist/cjs/LineChart/LineChart.js +31 -31
  315. package/dist/cjs/LineChart/index.js +10 -8
  316. package/dist/cjs/ModeSelector/ModeSelector.js +10 -8
  317. package/dist/cjs/ModeSelector/index.js +10 -8
  318. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +7 -5
  319. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +17 -15
  320. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +6 -4
  321. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +12 -10
  322. package/dist/cjs/OptionsEditorLayout/index.js +13 -11
  323. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +28 -10
  324. package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
  325. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +13 -11
  326. package/dist/cjs/SettingsAutocomplete/index.js +10 -8
  327. package/dist/cjs/SortSelector/SortSelector.js +10 -8
  328. package/dist/cjs/SortSelector/index.js +10 -8
  329. package/dist/cjs/StatChart/StatChart.js +22 -20
  330. package/dist/cjs/StatChart/calculateFontSize.js +11 -9
  331. package/dist/cjs/StatChart/index.js +10 -8
  332. package/dist/cjs/Table/InnerTable.js +7 -5
  333. package/dist/cjs/Table/Table.js +18 -16
  334. package/dist/cjs/Table/TableBody.js +5 -3
  335. package/dist/cjs/Table/TableCell.js +12 -10
  336. package/dist/cjs/Table/TableCheckbox.js +6 -4
  337. package/dist/cjs/Table/TableHead.js +5 -3
  338. package/dist/cjs/Table/TableHeaderCell.js +9 -7
  339. package/dist/cjs/Table/TableRow.js +5 -3
  340. package/dist/cjs/Table/VirtualizedTable.js +34 -32
  341. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
  342. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +4 -2
  343. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +24 -22
  344. package/dist/cjs/Table/index.js +14 -10
  345. package/dist/cjs/Table/model/table-model.js +17 -13
  346. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +17 -15
  347. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +15 -13
  348. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +50 -44
  349. package/dist/cjs/ThresholdsEditor/index.js +10 -8
  350. package/dist/cjs/TimeChart/TimeChart.js +123 -78
  351. package/dist/cjs/TimeChart/index.js +10 -8
  352. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +31 -28
  353. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +18 -16
  354. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +16 -14
  355. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +6 -4
  356. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +23 -21
  357. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +9 -7
  358. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +35 -33
  359. package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
  360. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +70 -53
  361. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +56 -28
  362. package/dist/cjs/TimeSeriesTooltip/utils.js +19 -14
  363. package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +40 -0
  364. package/dist/cjs/ToolbarIconButton/index.js +30 -0
  365. package/dist/cjs/YAxisLabel.js +7 -5
  366. package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +41 -12
  367. package/dist/cjs/context/SnackbarProvider.js +7 -3
  368. package/dist/cjs/context/TimeZoneProvider.js +17 -9
  369. package/dist/cjs/context/index.js +32 -0
  370. package/dist/cjs/index.js +42 -41
  371. package/dist/cjs/model/graph.js +9 -3
  372. package/dist/cjs/model/index.js +12 -10
  373. package/dist/cjs/test/index.js +10 -8
  374. package/dist/cjs/test/render.js +7 -5
  375. package/dist/cjs/test-utils/index.js +10 -8
  376. package/dist/cjs/test-utils/theme.js +38 -19
  377. package/dist/cjs/theme/component-overrides/alert.js +7 -5
  378. package/dist/cjs/theme/component-overrides/paper.js +4 -2
  379. package/dist/cjs/theme/index.js +10 -8
  380. package/dist/cjs/theme/palette/background.js +6 -2
  381. package/dist/cjs/theme/palette/colors/blue.js +3 -1
  382. package/dist/cjs/theme/palette/colors/common.js +6 -2
  383. package/dist/cjs/theme/palette/colors/green.js +3 -1
  384. package/dist/cjs/theme/palette/colors/grey.js +3 -1
  385. package/dist/cjs/theme/palette/colors/index.js +17 -15
  386. package/dist/cjs/theme/palette/colors/orange.js +3 -1
  387. package/dist/cjs/theme/palette/colors/purple.js +3 -1
  388. package/dist/cjs/theme/palette/colors/red.js +3 -1
  389. package/dist/cjs/theme/palette/error.js +3 -1
  390. package/dist/cjs/theme/palette/grey.js +3 -1
  391. package/dist/cjs/theme/palette/index.js +10 -8
  392. package/dist/cjs/theme/palette/palette-options.js +3 -1
  393. package/dist/cjs/theme/palette/primary.js +3 -1
  394. package/dist/cjs/theme/palette/secondary.js +3 -1
  395. package/dist/cjs/theme/palette/success.js +3 -1
  396. package/dist/cjs/theme/palette/text.js +3 -1
  397. package/dist/cjs/theme/palette/warning.js +3 -1
  398. package/dist/cjs/theme/theme.js +6 -4
  399. package/dist/cjs/theme/typography.js +3 -1
  400. package/dist/cjs/utils/axis.js +11 -7
  401. package/dist/cjs/utils/chart-actions.js +68 -12
  402. package/dist/cjs/utils/combine-sx.js +3 -1
  403. package/dist/cjs/utils/component-ids.js +3 -1
  404. package/dist/cjs/utils/format.js +16 -8
  405. package/dist/cjs/utils/index.js +15 -13
  406. package/dist/cjs/utils/mathjs.js +4 -2
  407. package/dist/cjs/utils/theme-gen.js +16 -18
  408. package/dist/context/ChartsProvider.d.ts +19 -0
  409. package/dist/context/ChartsProvider.d.ts.map +1 -0
  410. package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
  411. package/dist/context/ChartsProvider.js.map +1 -0
  412. package/dist/context/SnackbarProvider.d.ts +2 -2
  413. package/dist/context/SnackbarProvider.d.ts.map +1 -1
  414. package/dist/context/SnackbarProvider.js +1 -1
  415. package/dist/context/SnackbarProvider.js.map +1 -1
  416. package/dist/context/TimeZoneProvider.d.ts +1 -1
  417. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  418. package/dist/context/TimeZoneProvider.js +1 -1
  419. package/dist/context/TimeZoneProvider.js.map +1 -1
  420. package/dist/context/index.d.ts +4 -0
  421. package/dist/context/index.d.ts.map +1 -0
  422. package/dist/context/index.js +17 -0
  423. package/dist/context/index.js.map +1 -0
  424. package/dist/index.d.ts +3 -4
  425. package/dist/index.d.ts.map +1 -1
  426. package/dist/index.js +3 -4
  427. package/dist/index.js.map +1 -1
  428. package/dist/model/graph.d.ts +8 -8
  429. package/dist/model/graph.d.ts.map +1 -1
  430. package/dist/model/graph.js.map +1 -1
  431. package/dist/model/index.js.map +1 -1
  432. package/dist/model/theme.d.ts +1 -1
  433. package/dist/model/theme.d.ts.map +1 -1
  434. package/dist/model/theme.js.map +1 -1
  435. package/dist/model/timeOption.js.map +1 -1
  436. package/dist/test/index.js.map +1 -1
  437. package/dist/test/render.js.map +1 -1
  438. package/dist/test/setup-tests.js.map +1 -1
  439. package/dist/test-utils/index.js.map +1 -1
  440. package/dist/test-utils/theme.d.ts +2 -0
  441. package/dist/test-utils/theme.d.ts.map +1 -1
  442. package/dist/test-utils/theme.js +25 -16
  443. package/dist/test-utils/theme.js.map +1 -1
  444. package/dist/theme/component-overrides/alert.js +4 -4
  445. package/dist/theme/component-overrides/alert.js.map +1 -1
  446. package/dist/theme/component-overrides/paper.js +1 -1
  447. package/dist/theme/component-overrides/paper.js.map +1 -1
  448. package/dist/theme/index.d.ts +1 -0
  449. package/dist/theme/index.d.ts.map +1 -1
  450. package/dist/theme/index.js.map +1 -1
  451. package/dist/theme/palette/background.d.ts.map +1 -1
  452. package/dist/theme/palette/background.js +3 -1
  453. package/dist/theme/palette/background.js.map +1 -1
  454. package/dist/theme/palette/colors/blue.js.map +1 -1
  455. package/dist/theme/palette/colors/common.js.map +1 -1
  456. package/dist/theme/palette/colors/green.js.map +1 -1
  457. package/dist/theme/palette/colors/grey.js.map +1 -1
  458. package/dist/theme/palette/colors/index.js.map +1 -1
  459. package/dist/theme/palette/colors/orange.js.map +1 -1
  460. package/dist/theme/palette/colors/purple.js.map +1 -1
  461. package/dist/theme/palette/colors/red.js.map +1 -1
  462. package/dist/theme/palette/colors/types.d.ts +1 -1
  463. package/dist/theme/palette/colors/types.d.ts.map +1 -1
  464. package/dist/theme/palette/colors/types.js.map +1 -1
  465. package/dist/theme/palette/error.js.map +1 -1
  466. package/dist/theme/palette/grey.js.map +1 -1
  467. package/dist/theme/palette/index.js.map +1 -1
  468. package/dist/theme/palette/palette-options.js.map +1 -1
  469. package/dist/theme/palette/primary.js.map +1 -1
  470. package/dist/theme/palette/secondary.js.map +1 -1
  471. package/dist/theme/palette/success.js.map +1 -1
  472. package/dist/theme/palette/text.js.map +1 -1
  473. package/dist/theme/palette/warning.js.map +1 -1
  474. package/dist/theme/theme.js +1 -1
  475. package/dist/theme/theme.js.map +1 -1
  476. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  477. package/dist/theme/typography.js.map +1 -1
  478. package/dist/utils/axis.d.ts +4 -4
  479. package/dist/utils/axis.d.ts.map +1 -1
  480. package/dist/utils/axis.js +4 -4
  481. package/dist/utils/axis.js.map +1 -1
  482. package/dist/utils/chart-actions.d.ts +6 -2
  483. package/dist/utils/chart-actions.d.ts.map +1 -1
  484. package/dist/utils/chart-actions.js +51 -7
  485. package/dist/utils/chart-actions.js.map +1 -1
  486. package/dist/utils/combine-sx.js.map +1 -1
  487. package/dist/utils/component-ids.js.map +1 -1
  488. package/dist/utils/format.js.map +1 -1
  489. package/dist/utils/index.js.map +1 -1
  490. package/dist/utils/mathjs.js +1 -1
  491. package/dist/utils/mathjs.js.map +1 -1
  492. package/dist/utils/theme-gen.d.ts +3 -8
  493. package/dist/utils/theme-gen.d.ts.map +1 -1
  494. package/dist/utils/theme-gen.js +11 -15
  495. package/dist/utils/theme-gen.js.map +1 -1
  496. package/package.json +8 -7
  497. package/dist/UnitSelector/UnitSelector.d.ts +0 -9
  498. package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
  499. package/dist/UnitSelector/UnitSelector.js.map +0 -1
  500. package/dist/UnitSelector/index.d.ts +0 -2
  501. package/dist/UnitSelector/index.d.ts.map +0 -1
  502. package/dist/UnitSelector/index.js.map +0 -1
  503. package/dist/context/ChartsThemeProvider.d.ts +0 -10
  504. package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
  505. package/dist/context/ChartsThemeProvider.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/EChart/EChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,cAAc,CAAC;AACzE,SAASC,GAAG,QAAwB,eAAe,CAAC;AACpD,OAAOC,OAAO,MAAM,gBAAgB,CAAC;AAC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;AAED,SAASR,YAAY,CAACF,SAAoB,EAA+B;IACvE,OAAO,AAACpC,WAAW,CAAuB+C,QAAQ,CAACX,SAAS,CAAC,CAAC;AAChE,CAAC;AAED,SAASK,YAAY,CAACL,SAAoB,EAA+B;IACvE,OAAO,AAACnC,WAAW,CAAuB8C,QAAQ,CAACX,SAAS,CAAC,CAAC;AAChE,CAAC"}
1
+ {"version":3,"sources":["../../src/EChart/EChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"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,OAAOA,SAASC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,QAAQ;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAwB,gBAAgB;AACpD,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,cAAc,kBAAkB;AAwBvC,MAAMC,cAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;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ACH,WAAW,CAACI,SAAWH,gBAAgBG,QAAQP;YAC7D,OAAO,IAAIQ,aAAaL,YAAY;gBAClCH,SAASM,EAAE,CAACH,WAAW,CAACI,SAAWH,gBAAgBG;YACrD,OAAO;gBACLP,SAASM,EAAE,CAACH,WAAW,IAAMC,gBAAgB,MAAMJ;YACrD;QACF;IACF;IAEA,IAAK,MAAMG,aAAaF,OAAQ;QAC9B,IAAIQ,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACX,QAAQE,YAAY;gBACvCF;YAApB,MAAMY,cAAcZ,CAAAA,oBAAAA,MAAM,CAACE,UAAuB,cAA9BF,+BAAAA,oBAAkC;YACtD,IAAIY,aAAa;gBACfX,UAAUC,WAAwBU;YACpC;QACF;IACF;AACF;AAEA,SAASR,aAAaF,SAAoB;IACxC,OAAO,AAACpC,YAAkC+C,QAAQ,CAACX;AACrD;AAEA,SAASK,aAAaL,SAAoB;IACxC,OAAO,AAACnC,YAAkC8C,QAAQ,CAACX;AACrD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/EChart/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 './EChart';\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,UAAU,CAAC"}
1
+ {"version":3,"sources":["../../src/EChart/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 './EChart';\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,WAAW"}
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  export interface ErrorAlertProps {
3
2
  error: Error;
4
3
  }
5
4
  /**
6
5
  * Shows an MUI Alert with the `Error.message` as its contents.
7
6
  */
8
- export declare function ErrorAlert(props: ErrorAlertProps): JSX.Element;
7
+ export declare function ErrorAlert(props: ErrorAlertProps): import("react/jsx-runtime").JSX.Element;
9
8
  //# sourceMappingURL=ErrorAlert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../src/ErrorAlert.tsx"],"names":[],"mappings":";AAeA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAGhD"}
1
+ {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../src/ErrorAlert.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAGhD"}
@@ -15,7 +15,7 @@ import { Alert } from '@mui/material';
15
15
  /**
16
16
  * Shows an MUI Alert with the `Error.message` as its contents.
17
17
  */ export function ErrorAlert(props) {
18
- const { error } = props;
18
+ const { error } = props;
19
19
  return /*#__PURE__*/ _jsx(Alert, {
20
20
  severity: "error",
21
21
  children: error.message
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ErrorAlert.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 { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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,KAAK,QAAQ,eAAe,CAAC;AAMtC;;CAEC,GACD,OAAO,SAASC,UAAU,CAACC,KAAsB,EAAE;IACjD,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAGD,KAAK,AAAC;IACxB,qBAAO,KAACF,KAAK;QAACI,QAAQ,EAAC,OAAO;kBAAED,KAAK,CAACE,OAAO;MAAS,CAAC;AACzD,CAAC"}
1
+ {"version":3,"sources":["../src/ErrorAlert.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 { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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,KAAK,QAAQ,gBAAgB;AAMtC;;CAEC,GACD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,KAAK,EAAE,GAAGD;IAClB,qBAAO,KAACF;QAAMI,UAAS;kBAASD,MAAME,OAAO;;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,sBAAsB,CAAC"}
1
+ {"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,uBAAuB"}
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- export declare type FontSizeOption = number | undefined;
1
+ export type FontSizeOption = number | undefined;
3
2
  export interface FontSizeSelectorProps {
4
3
  value: FontSizeOption;
5
4
  onChange: (fontSize: FontSizeOption) => void;
6
5
  }
7
- export declare function FontSizeSelector({ value, onChange }: FontSizeSelectorProps): JSX.Element;
6
+ export declare function FontSizeSelector({ value, onChange }: FontSizeSelectorProps): import("react/jsx-runtime").JSX.Element;
8
7
  //# sourceMappingURL=FontSizeSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FontSizeSelector.d.ts","sourceRoot":"","sources":["../../src/FontSizeSelector/FontSizeSelector.tsx"],"names":[],"mappings":";AAqCA,oBAAY,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,qBAAqB,eAmB1E"}
1
+ {"version":3,"file":"FontSizeSelector.d.ts","sourceRoot":"","sources":["../../src/FontSizeSelector/FontSizeSelector.tsx"],"names":[],"mappings":"AAqCA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAmB1E"}
@@ -105,8 +105,8 @@ const FONT_SIZE_OPTIONS = [
105
105
  value: 192
106
106
  }
107
107
  ];
108
- export function FontSizeSelector({ value , onChange }) {
109
- const handleFontSizeChange = (_, { value })=>{
108
+ export function FontSizeSelector({ value, onChange }) {
109
+ const handleFontSizeChange = (_, { value })=>{
110
110
  onChange(value);
111
111
  };
112
112
  return /*#__PURE__*/ _jsx(OptionsEditorControl, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFontSizeChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,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AAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;QAAEC,KAAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;QAAEC,KAAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,IAAI;QAAEC,KAAK,EAAE,IAAI;QAAEC,KAAK,EAAE,EAAE;KAAE;IACpC;QAAEF,EAAE,EAAE,KAAK;QAAEC,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAE,GAAG;KAAE;IACvC;QAAEF,EAAE,EAAE,KAAK;QAAEC,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAE,GAAG;KAAE;IACvC;QAAEF,EAAE,EAAE,KAAK;QAAEC,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAE,GAAG;KAAE;CACxC,AAAC;AASF,OAAO,SAASE,gBAAgB,CAAC,EAAEF,KAAK,CAAA,EAAEG,QAAQ,CAAA,EAAyB,EAAE;IAC3E,MAAMC,oBAAoB,GAAG,CAACC,CAAU,EAAE,EAAEL,KAAK,CAAA,EAA6B,GAAK;QACjFG,QAAQ,CAACH,KAAK,CAAC,CAAC;IAClB,CAAC,AAAC;IAEF,qBACE,KAACL,oBAAoB;QACnBI,KAAK,EAAC,WAAW;QACjBO,OAAO,gBACL,KAACV,oBAAoB;YACnBI,KAAK,EAAEH,iBAAiB,CAACU,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACR,KAAK,KAAKA,KAAK,CAAC;YACvDS,OAAO,EAAEZ,iBAAiB;YAC1Ba,cAAc,EAAE,CAACF,CAAC,GAAKA,CAAC,CAACT,KAAK;YAC9BI,QAAQ,EAAEC,oBAAoB;YAC9BO,gBAAgB;UAChB;MAEJ,CACF;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFont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,OAAO;IAAI;CACvC;AASD,OAAO,SAASE,iBAAiB,EAAEF,KAAK,EAAEG,QAAQ,EAAyB;IACzE,MAAMC,uBAAuB,CAACC,GAAY,EAAEL,KAAK,EAA6B;QAC5EG,SAASH;IACX;IAEA,qBACE,KAACL;QACCI,OAAM;QACNO,uBACE,KAACV;YACCI,OAAOH,kBAAkBU,IAAI,CAAC,CAACC,IAAMA,EAAER,KAAK,KAAKA;YACjDS,SAASZ;YACTa,gBAAgB,CAACF,IAAMA,EAAET,KAAK;YAC9BI,UAAUC;YACVO,gBAAgB;;;AAK1B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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"}
1
+ {"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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"}
@@ -0,0 +1,8 @@
1
+ import { FormatOptions } from '@perses-dev/core';
2
+ export interface FormatControlsProps {
3
+ value: FormatOptions;
4
+ onChange: (unit: FormatOptions) => void;
5
+ disabled?: boolean;
6
+ }
7
+ export declare function FormatControls({ value, onChange, disabled }: FormatControlsProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=FormatControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormatControls.d.ts","sourceRoot":"","sources":["../../src/FormatControls/FormatControls.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0BD,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,mBAAmB,2CAsExF"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { Switch } from '@mui/material';
15
- import { shouldAbbreviate, UNIT_CONFIG, isUnitWithDecimalPlaces, isUnitWithAbbreviate } from '@perses-dev/core';
15
+ import { shouldShortenValues, UNIT_CONFIG, isUnitWithDecimalPlaces, isUnitWithShortValues } from '@perses-dev/core';
16
16
  import { OptionsEditorControl } from '../OptionsEditorLayout';
17
17
  import { SettingsAutocomplete } from '../SettingsAutocomplete';
18
18
  const KIND_OPTIONS = Object.entries(UNIT_CONFIG).map(([id, config])=>{
@@ -25,78 +25,78 @@ const DECIMAL_PLACES_OPTIONS = [
25
25
  {
26
26
  id: 'default',
27
27
  label: 'Default',
28
- decimal_places: undefined
28
+ decimalPlaces: undefined
29
29
  },
30
30
  {
31
31
  id: '0',
32
32
  label: '0',
33
- decimal_places: 0
33
+ decimalPlaces: 0
34
34
  },
35
35
  {
36
36
  id: '1',
37
37
  label: '1',
38
- decimal_places: 1
38
+ decimalPlaces: 1
39
39
  },
40
40
  {
41
41
  id: '2',
42
42
  label: '2',
43
- decimal_places: 2
43
+ decimalPlaces: 2
44
44
  },
45
45
  {
46
46
  id: '3',
47
47
  label: '3',
48
- decimal_places: 3
48
+ decimalPlaces: 3
49
49
  },
50
50
  {
51
51
  id: '4',
52
52
  label: '4',
53
- decimal_places: 4
53
+ decimalPlaces: 4
54
54
  }
55
55
  ];
56
- function getOptionByDecimalPlaces(decimal_places) {
57
- return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimal_places === decimal_places);
56
+ function getOptionByDecimalPlaces(decimalPlaces) {
57
+ return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimalPlaces === decimalPlaces);
58
58
  }
59
- export function UnitSelector({ value , onChange , disabled =false }) {
59
+ export function FormatControls({ value, onChange, disabled = false }) {
60
60
  const hasDecimalPlaces = isUnitWithDecimalPlaces(value);
61
- const hasAbbreviate = isUnitWithAbbreviate(value);
61
+ const hasShortValues = isUnitWithShortValues(value);
62
62
  const handleKindChange = (_, newValue)=>{
63
63
  onChange({
64
- kind: newValue.id
64
+ unit: newValue.id
65
65
  });
66
66
  };
67
- const handleDecimalPlacesChange = (_, { decimal_places })=>{
67
+ const handleDecimalPlacesChange = (_, { decimalPlaces })=>{
68
68
  if (hasDecimalPlaces) {
69
69
  onChange({
70
70
  ...value,
71
- decimal_places: decimal_places
71
+ decimalPlaces: decimalPlaces
72
72
  });
73
73
  }
74
74
  };
75
- const handleAbbreviateChange = (_, checked)=>{
76
- if (hasAbbreviate) {
75
+ const handleShortValuesChange = (_, checked)=>{
76
+ if (hasShortValues) {
77
77
  onChange({
78
78
  ...value,
79
- abbreviate: checked
79
+ shortValues: checked
80
80
  });
81
81
  }
82
82
  };
83
- const kindConfig = UNIT_CONFIG[value.kind];
83
+ const unitConfig = UNIT_CONFIG[value.unit];
84
84
  return /*#__PURE__*/ _jsxs(_Fragment, {
85
85
  children: [
86
86
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
87
- label: "Abbreviate",
87
+ label: "Short values",
88
88
  control: /*#__PURE__*/ _jsx(Switch, {
89
- checked: hasAbbreviate ? shouldAbbreviate(value.abbreviate) : false,
90
- onChange: handleAbbreviateChange,
91
- disabled: !hasAbbreviate
89
+ checked: hasShortValues ? shouldShortenValues(value.shortValues) : false,
90
+ onChange: handleShortValuesChange,
91
+ disabled: !hasShortValues
92
92
  })
93
93
  }),
94
94
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
95
95
  label: "Unit",
96
96
  control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
97
97
  value: {
98
- id: value.kind,
99
- ...kindConfig
98
+ id: value.unit,
99
+ ...unitConfig
100
100
  },
101
101
  options: KIND_OPTIONS,
102
102
  groupBy: (option)=>option.group,
@@ -108,7 +108,7 @@ export function UnitSelector({ value , onChange , disabled =false }) {
108
108
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
109
109
  label: "Decimals",
110
110
  control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
111
- value: getOptionByDecimalPlaces(value.decimal_places),
111
+ value: getOptionByDecimalPlaces(value.decimalPlaces),
112
112
  options: DECIMAL_PLACES_OPTIONS,
113
113
  getOptionLabel: (o)=>o.label,
114
114
  onChange: handleDecimalPlacesChange,
@@ -120,4 +120,4 @@ export function UnitSelector({ value , onChange , disabled =false }) {
120
120
  });
121
121
  }
122
122
 
123
- //# sourceMappingURL=UnitSelector.js.map
123
+ //# sourceMappingURL=FormatControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/FormatControls/FormatControls.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.\nimport { Switch, SwitchProps } from '@mui/material';\nimport {\n shouldShortenValues,\n FormatOptions,\n UNIT_CONFIG,\n UnitConfig,\n isUnitWithDecimalPlaces,\n isUnitWithShortValues,\n} from '@perses-dev/core';\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nexport interface FormatControlsProps {\n value: FormatOptions;\n onChange: (unit: FormatOptions) => void;\n disabled?: boolean;\n}\n\ntype AutocompleteUnitOption = UnitConfig & { id: FormatOptions['unit'] };\n\nconst KIND_OPTIONS: AutocompleteUnitOption[] = Object.entries(UNIT_CONFIG)\n .map(([id, config]) => {\n return {\n id: id as FormatOptions['unit'],\n ...config,\n };\n })\n .filter((config) => !config.disableSelectorOption);\n\nconst DECIMAL_PLACES_OPTIONS = [\n { id: 'default', label: 'Default', decimalPlaces: undefined },\n { id: '0', label: '0', decimalPlaces: 0 },\n { id: '1', label: '1', decimalPlaces: 1 },\n { id: '2', label: '2', decimalPlaces: 2 },\n { id: '3', label: '3', decimalPlaces: 3 },\n { id: '4', label: '4', decimalPlaces: 4 },\n];\n\nfunction getOptionByDecimalPlaces(decimalPlaces?: number) {\n return DECIMAL_PLACES_OPTIONS.find((o) => o.decimalPlaces === decimalPlaces);\n}\n\nexport function FormatControls({ value, onChange, disabled = false }: FormatControlsProps) {\n const hasDecimalPlaces = isUnitWithDecimalPlaces(value);\n const hasShortValues = isUnitWithShortValues(value);\n\n const handleKindChange = (_: unknown, newValue: AutocompleteUnitOption) => {\n onChange({\n unit: newValue.id,\n });\n };\n\n const handleDecimalPlacesChange = (_: unknown, { decimalPlaces }: { decimalPlaces: number | undefined }) => {\n if (hasDecimalPlaces) {\n onChange({\n ...value,\n decimalPlaces: decimalPlaces,\n });\n }\n };\n\n const handleShortValuesChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n if (hasShortValues) {\n onChange({\n ...value,\n shortValues: checked,\n });\n }\n };\n\n const unitConfig = UNIT_CONFIG[value.unit];\n\n return (\n <>\n <OptionsEditorControl\n label=\"Short values\"\n control={\n <Switch\n checked={hasShortValues ? shouldShortenValues(value.shortValues) : false}\n onChange={handleShortValuesChange}\n disabled={!hasShortValues}\n />\n }\n />\n <OptionsEditorControl\n label=\"Unit\"\n control={\n <SettingsAutocomplete\n value={{ id: value.unit, ...unitConfig }}\n options={KIND_OPTIONS}\n groupBy={(option) => option.group}\n onChange={handleKindChange}\n disableClearable\n disabled={disabled}\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Decimals\"\n control={\n <SettingsAutocomplete\n value={getOptionByDecimalPlaces(value.decimalPlaces)}\n options={DECIMAL_PLACES_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleDecimalPlacesChange}\n disabled={!hasDecimalPlaces}\n disableClearable\n />\n }\n />\n </>\n );\n}\n"],"names":["Switch","shouldShortenValues","UNIT_CONFIG","isUnitWithDecimalPlaces","isUnitWithShortValues","OptionsEditorControl","SettingsAutocomplete","KIND_OPTIONS","Object","entries","map","id","config","filter","disableSelectorOption","DECIMAL_PLACES_OPTIONS","label","decimalPlaces","undefined","getOptionByDecimalPlaces","find","o","FormatControls","value","onChange","disabled","hasDecimalPlaces","hasShortValues","handleKindChange","_","newValue","unit","handleDecimalPlacesChange","handleShortValuesChange","checked","shortValues","unitConfig","control","options","groupBy","option","group","disableClearable","getOptionL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EAAE;QACnB;IACF;IAEA,MAAMqB,4BAA4B,CAACH,GAAY,EAAEZ,aAAa,EAAyC;QACrG,IAAIS,kBAAkB;YACpBF,SAAS;gBACP,GAAGD,KAAK;gBACRN,eAAeA;YACjB;QACF;IACF;IAEA,MAAMgB,0BAAmD,CAACJ,GAAYK;QACpE,IAAIP,gBAAgB;YAClBH,SAAS;gBACP,GAAGD,KAAK;gBACRY,aAAaD;YACf;QACF;IACF;IAEA,MAAME,aAAalC,WAAW,CAACqB,MAAMQ,IAAI,CAAC;IAE1C,qBACE;;0BACE,KAAC1B;gBACCW,OAAM;gBACNqB,uBACE,KAACrC;oBACCkC,SAASP,iBAAiB1B,oBAAoBsB,MAAMY,WAAW,IAAI;oBACnEX,UAAUS;oBACVR,UAAU,CAACE;;;0BAIjB,KAACtB;gBACCW,OAAM;gBACNqB,uBACE,KAAC/B;oBACCiB,OAAO;wBAAEZ,IAAIY,MAAMQ,IAAI;wBAAE,GAAGK,UAAU;oBAAC;oBACvCE,SAAS/B;oBACTgC,SAAS,CAACC,SAAWA,OAAOC,KAAK;oBACjCjB,UAAUI;oBACVc,gBAAgB;oBAChBjB,UAAUA;;;0BAIhB,KAACpB;gBACCW,OAAM;gBACNqB,uBACE,KAAC/B;oBACCiB,OAAOJ,yBAAyBI,MAAMN,aAAa;oBACnDqB,SAASvB;oBACT4B,gBAAgB,CAACtB,IAAMA,EAAEL,KAAK;oBAC9BQ,UAAUQ;oBACVP,UAAU,CAACC;oBACXgB,gBAAgB;;;;;AAM5B"}
@@ -0,0 +1,2 @@
1
+ export * from './FormatControls';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormatControls/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,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 './UnitSelector';
13
+ export * from './FormatControls';
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/FormatControls/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 './FormatControls';\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,mBAAmB"}
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- import { UnitOptions } from '@perses-dev/core';
1
+ import { FormatOptions } from '@perses-dev/core';
3
2
  import { GaugeSeriesOption } from 'echarts/charts';
4
- export declare type GaugeChartValue = number | null | undefined;
5
- export declare type GaugeSeries = {
3
+ export type GaugeChartValue = number | null | undefined;
4
+ export type GaugeSeries = {
6
5
  value: GaugeChartValue;
7
6
  label: string;
8
7
  };
@@ -10,14 +9,14 @@ export interface GaugeChartProps {
10
9
  width: number;
11
10
  height: number;
12
11
  data: GaugeSeries;
13
- unit: UnitOptions;
12
+ format: FormatOptions;
14
13
  axisLine: GaugeSeriesOption['axisLine'];
15
14
  max?: number;
16
15
  }
17
- export declare function GaugeChart(props: GaugeChartProps): JSX.Element;
16
+ export declare function GaugeChart(props: GaugeChartProps): import("react/jsx-runtime").JSX.Element;
18
17
  /**
19
18
  * Responsive font size depending on number of characters, clamp used
20
19
  * to ensure size stays within given range
21
20
  */
22
- export declare function getResponsiveValueSize(value: number | null, unit: UnitOptions, width: number, height: number): string;
21
+ export declare function getResponsiveValueSize(value: number | null, format: FormatOptions, width: number, height: number): string;
23
22
  //# sourceMappingURL=GaugeChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA4B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAapF,oBAAY,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuJhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQ5G"}
1
+ {"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA4B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAapF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAuJhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQhH"}
@@ -16,7 +16,7 @@ import { use } from 'echarts/core';
16
16
  import { GaugeChart as EChartsGaugeChart } from 'echarts/charts';
17
17
  import { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';
18
18
  import { CanvasRenderer } from 'echarts/renderers';
19
- import { useChartsTheme } from '../context/ChartsThemeProvider';
19
+ import { useChartsTheme } from '../context/ChartsProvider';
20
20
  import { EChart } from '../EChart';
21
21
  use([
22
22
  EChartsGaugeChart,
@@ -29,15 +29,15 @@ const PROGRESS_WIDTH = 16;
29
29
  // adjusts when to show pointer icon
30
30
  const GAUGE_SMALL_BREAKPOINT = 170;
31
31
  export function GaugeChart(props) {
32
- const { width , height , data , unit , axisLine , max } = props;
32
+ const { width, height, data, format, axisLine, max } = props;
33
33
  const chartsTheme = useChartsTheme();
34
34
  // useDeepMemo ensures value size util does not rerun everytime you hover on the chart
35
35
  const option = useDeepMemo(()=>{
36
- var ref;
36
+ var _chartsTheme_echartsTheme_textStyle;
37
37
  if (data.value === undefined) return chartsTheme.noDataOption;
38
38
  // adjusts fontSize depending on number of characters
39
- const valueSizeClamp = getResponsiveValueSize(data.value, unit, width, height);
40
- var ref1;
39
+ const valueSizeClamp = getResponsiveValueSize(data.value, format, width, height);
40
+ var _chartsTheme_echartsTheme_textStyle_color;
41
41
  return {
42
42
  title: {
43
43
  show: false
@@ -156,7 +156,7 @@ export function GaugeChart(props) {
156
156
  // when the value is `null`, making it difficult to differentiate
157
157
  // `null` from a true `NaN` case.
158
158
  ()=>'null' : (value)=>{
159
- return formatValue(value, unit);
159
+ return formatValue(value, format);
160
160
  }
161
161
  },
162
162
  data: [
@@ -167,7 +167,7 @@ export function GaugeChart(props) {
167
167
  // https://echarts.apache.org/en/option.html#series-gauge.data.title
168
168
  title: {
169
169
  show: true,
170
- color: (ref1 = (ref = chartsTheme.echartsTheme.textStyle) === null || ref === void 0 ? void 0 : ref.color) !== null && ref1 !== void 0 ? ref1 : 'inherit',
170
+ color: (_chartsTheme_echartsTheme_textStyle_color = (_chartsTheme_echartsTheme_textStyle = chartsTheme.echartsTheme.textStyle) === null || _chartsTheme_echartsTheme_textStyle === void 0 ? void 0 : _chartsTheme_echartsTheme_textStyle.color) !== null && _chartsTheme_echartsTheme_textStyle_color !== void 0 ? _chartsTheme_echartsTheme_textStyle_color : 'inherit',
171
171
  offsetCenter: [
172
172
  0,
173
173
  '55%'
@@ -186,7 +186,7 @@ export function GaugeChart(props) {
186
186
  width,
187
187
  height,
188
188
  chartsTheme,
189
- unit,
189
+ format,
190
190
  axisLine,
191
191
  max
192
192
  ]);
@@ -203,13 +203,13 @@ export function GaugeChart(props) {
203
203
  /**
204
204
  * Responsive font size depending on number of characters, clamp used
205
205
  * to ensure size stays within given range
206
- */ export function getResponsiveValueSize(value, unit, width, height) {
206
+ */ export function getResponsiveValueSize(value, format, width, height) {
207
207
  const MIN_SIZE = 3;
208
208
  const MAX_SIZE = 24;
209
209
  const SIZE_MULTIPLIER = 0.7;
210
- const formattedValue = typeof value === 'number' ? formatValue(value, unit) : `${value}`;
211
- var _length;
212
- const valueCharacters = (_length = formattedValue.length) !== null && _length !== void 0 ? _length : 2;
210
+ const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;
211
+ var _formattedValue_length;
212
+ const valueCharacters = (_formattedValue_length = formattedValue.length) !== null && _formattedValue_length !== void 0 ? _formattedValue_length : 2;
213
213
  const valueSize = Math.min(width, height) / valueCharacters * SIZE_MULTIPLIER;
214
214
  return `clamp(${MIN_SIZE}px, ${valueSize}px, ${MAX_SIZE}px)`;
215
215
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChart/GaugeChart.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 { formatValue, useDeepMemo, UnitOptions } from '@perses-dev/core';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { GaugeChart as EChartsGaugeChart, GaugeSeriesOption } from 'echarts/charts';\nimport { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsThemeProvider';\nimport { EChart } from '../EChart';\n\nuse([EChartsGaugeChart, GridComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst PROGRESS_WIDTH = 16;\n\n// adjusts when to show pointer icon\nconst GAUGE_SMALL_BREAKPOINT = 170;\n\nexport type GaugeChartValue = number | null | undefined;\n\nexport type GaugeSeries = {\n value: GaugeChartValue;\n label: string;\n};\n\nexport interface GaugeChartProps {\n width: number;\n height: number;\n data: GaugeSeries;\n unit: UnitOptions;\n axisLine: GaugeSeriesOption['axisLine'];\n max?: number;\n}\n\nexport function GaugeChart(props: GaugeChartProps) {\n const { width, height, data, unit, axisLine, max } = props;\n const chartsTheme = useChartsTheme();\n\n // useDeepMemo ensures value size util does not rerun everytime you hover on the chart\n const option: EChartsCoreOption = useDeepMemo(() => {\n if (data.value === undefined) return chartsTheme.noDataOption;\n\n // adjusts fontSize depending on number of characters\n const valueSizeClamp = getResponsiveValueSize(data.value, unit, width, height);\n\n return {\n title: {\n show: false,\n },\n tooltip: {\n show: false,\n },\n series: [\n {\n type: 'gauge',\n center: ['50%', '65%'],\n radius: '86%',\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max,\n silent: true,\n progress: {\n show: true,\n width: PROGRESS_WIDTH,\n itemStyle: {\n color: 'auto',\n },\n },\n pointer: {\n show: false,\n },\n axisLine: {\n lineStyle: {\n color: [[1, '#e1e5e9']], // TODO (sjcobb): use future chart theme colors\n width: PROGRESS_WIDTH,\n },\n },\n axisTick: {\n show: false,\n distance: 0,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n distance: -18,\n color: '#999',\n fontSize: 12,\n },\n anchor: {\n show: false,\n },\n title: {\n show: false,\n },\n detail: {\n show: false,\n },\n data: [\n {\n value: data.value,\n },\n ],\n },\n {\n type: 'gauge',\n center: ['50%', '65%'],\n radius: '100%',\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max,\n pointer: {\n show: true,\n // pointer hidden for small panels, path taken from ex: https://echarts.apache.org/examples/en/editor.html?c=gauge-grade\n icon: width > GAUGE_SMALL_BREAKPOINT ? 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z' : 'none',\n length: 10,\n width: 5,\n offsetCenter: [0, '-49%'],\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine,\n axisTick: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n detail: {\n show: true,\n width: '60%',\n borderRadius: 8,\n offsetCenter: [0, '-9%'],\n color: 'inherit', // allows value color to match active threshold color\n fontSize: valueSizeClamp,\n formatter:\n data.value === null\n ? // We use a different function when we *know* the value is null\n // at this level because the `formatter` function argument is `NaN`\n // when the value is `null`, making it difficult to differentiate\n // `null` from a true `NaN` case.\n () => 'null'\n : (value: number) => {\n return formatValue(value, unit);\n },\n },\n data: [\n {\n value: data.value,\n name: data.label,\n // TODO: new UX for series names, create separate React component or reuse ListLegendItem\n // https://echarts.apache.org/en/option.html#series-gauge.data.title\n title: {\n show: true,\n color: chartsTheme.echartsTheme.textStyle?.color ?? 'inherit', // series name font color\n offsetCenter: [0, '55%'],\n overflow: 'truncate',\n fontSize: 12,\n width: width * 0.8,\n },\n },\n ],\n },\n ],\n };\n }, [data, width, height, chartsTheme, unit, axisLine, max]);\n\n return (\n <EChart\n sx={{\n width: width,\n height: height,\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n );\n}\n\n/**\n * Responsive font size depending on number of characters, clamp used\n * to ensure size stays within given range\n */\nexport function getResponsiveValueSize(value: number | null, unit: UnitOptions, width: number, height: number) {\n const MIN_SIZE = 3;\n const MAX_SIZE = 24;\n const SIZE_MULTIPLIER = 0.7;\n const formattedValue = typeof value === 'number' ? formatValue(value, unit) : `${value}`;\n const valueCharacters = formattedValue.length ?? 2;\n const valueSize = (Math.min(width, height) / valueCharacters) * SIZE_MULTIPLIER;\n return `clamp(${MIN_SIZE}px, ${valueSize}px, ${MAX_SIZE}px)`;\n}\n"],"names":["formatValue","useDeepMemo","use","GaugeChart","EChartsGaugeChart","GridComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","PROGRESS_WIDTH","GAUGE_SMALL_BREAKPOINT","props","width","height","data","unit","axisLine","max","chartsTheme","option","value","undefined","noDataOption","valueSizeClamp","getResponsiveValueSize","title","show","tooltip","series","type","center","radius","startAngle","endAngle","min","silent","progress","itemStyle","color","pointer","lineStyle","axisTick","distance","splitLine","axisLabel","fontSize","anchor","detail","icon","length","offsetCenter","borderRadius","formatter","name","label","echartsTheme","textStyle","overflow","sx","padding","container","default","theme","MIN_SIZE","MAX_SIZE","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QAAQ,GAAGtB,WAAW,CAACsB,KAAK,EAAEL,IAAI,CAAC,GAAG,CAAC,EAAEK,KAAK,CAAC,CAAC,AAAC;QACjE8C,OAAqB;IAA7C,MAAMC,eAAe,GAAGD,CAAAA,OAAqB,GAArBA,cAAc,CAACjB,MAAM,cAArBiB,OAAqB,cAArBA,OAAqB,GAAI,CAAC,AAAC;IACnD,MAAME,SAAS,GAAG,AAACC,IAAI,CAACnC,GAAG,CAACtB,KAAK,EAAEC,MAAM,CAAC,GAAGsD,eAAe,GAAIF,eAAe,AAAC;IAChF,OAAO,CAAC,MAAM,EAAEF,QAAQ,CAAC,IAAI,EAAEK,SAAS,CAAC,IAAI,EAAEJ,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC/D,CAAC"}
1
+ {"version":3,"sources":["../../src/GaugeChart/GaugeChart.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 { formatValue, useDeepMemo, FormatOptions } from '@perses-dev/core';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { GaugeChart as EChartsGaugeChart, GaugeSeriesOption } from 'echarts/charts';\nimport { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { EChart } from '../EChart';\n\nuse([EChartsGaugeChart, GridComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst PROGRESS_WIDTH = 16;\n\n// adjusts when to show pointer icon\nconst GAUGE_SMALL_BREAKPOINT = 170;\n\nexport type GaugeChartValue = number | null | undefined;\n\nexport type GaugeSeries = {\n value: GaugeChartValue;\n label: string;\n};\n\nexport interface GaugeChartProps {\n width: number;\n height: number;\n data: GaugeSeries;\n format: FormatOptions;\n axisLine: GaugeSeriesOption['axisLine'];\n max?: number;\n}\n\nexport function GaugeChart(props: GaugeChartProps) {\n const { width, height, data, format, axisLine, max } = props;\n const chartsTheme = useChartsTheme();\n\n // useDeepMemo ensures value size util does not rerun everytime you hover on the chart\n const option: EChartsCoreOption = useDeepMemo(() => {\n if (data.value === undefined) return chartsTheme.noDataOption;\n\n // adjusts fontSize depending on number of characters\n const valueSizeClamp = getResponsiveValueSize(data.value, format, width, height);\n\n return {\n title: {\n show: false,\n },\n tooltip: {\n show: false,\n },\n series: [\n {\n type: 'gauge',\n center: ['50%', '65%'],\n radius: '86%',\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max,\n silent: true,\n progress: {\n show: true,\n width: PROGRESS_WIDTH,\n itemStyle: {\n color: 'auto',\n },\n },\n pointer: {\n show: false,\n },\n axisLine: {\n lineStyle: {\n color: [[1, '#e1e5e9']], // TODO (sjcobb): use future chart theme colors\n width: PROGRESS_WIDTH,\n },\n },\n axisTick: {\n show: false,\n distance: 0,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n distance: -18,\n color: '#999',\n fontSize: 12,\n },\n anchor: {\n show: false,\n },\n title: {\n show: false,\n },\n detail: {\n show: false,\n },\n data: [\n {\n value: data.value,\n },\n ],\n },\n {\n type: 'gauge',\n center: ['50%', '65%'],\n radius: '100%',\n startAngle: 200,\n endAngle: -20,\n min: 0,\n max,\n pointer: {\n show: true,\n // pointer hidden for small panels, path taken from ex: https://echarts.apache.org/examples/en/editor.html?c=gauge-grade\n icon: width > GAUGE_SMALL_BREAKPOINT ? 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z' : 'none',\n length: 10,\n width: 5,\n offsetCenter: [0, '-49%'],\n itemStyle: {\n color: 'auto',\n },\n },\n axisLine,\n axisTick: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n detail: {\n show: true,\n width: '60%',\n borderRadius: 8,\n offsetCenter: [0, '-9%'],\n color: 'inherit', // allows value color to match active threshold color\n fontSize: valueSizeClamp,\n formatter:\n data.value === null\n ? // We use a different function when we *know* the value is null\n // at this level because the `formatter` function argument is `NaN`\n // when the value is `null`, making it difficult to differentiate\n // `null` from a true `NaN` case.\n () => 'null'\n : (value: number) => {\n return formatValue(value, format);\n },\n },\n data: [\n {\n value: data.value,\n name: data.label,\n // TODO: new UX for series names, create separate React component or reuse ListLegendItem\n // https://echarts.apache.org/en/option.html#series-gauge.data.title\n title: {\n show: true,\n color: chartsTheme.echartsTheme.textStyle?.color ?? 'inherit', // series name font color\n offsetCenter: [0, '55%'],\n overflow: 'truncate',\n fontSize: 12,\n width: width * 0.8,\n },\n },\n ],\n },\n ],\n };\n }, [data, width, height, chartsTheme, format, axisLine, max]);\n\n return (\n <EChart\n sx={{\n width: width,\n height: height,\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n );\n}\n\n/**\n * Responsive font size depending on number of characters, clamp used\n * to ensure size stays within given range\n */\nexport function getResponsiveValueSize(value: number | null, format: FormatOptions, width: number, height: number) {\n const MIN_SIZE = 3;\n const MAX_SIZE = 24;\n const SIZE_MULTIPLIER = 0.7;\n const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;\n const valueCharacters = formattedValue.length ?? 2;\n const valueSize = (Math.min(width, height) / valueCharacters) * SIZE_MULTIPLIER;\n return `clamp(${MIN_SIZE}px, ${valueSize}px, ${MAX_SIZE}px)`;\n}\n"],"names":["formatValue","useDeepMemo","use","GaugeChart","EChartsGaugeChart","GridComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","PROGRESS_WIDTH","GAUGE_SMALL_BREAKPOINT","props","width","height","data","format","axisLine","max","chartsTheme","option","value","undefined","noDataOption","valueSizeClamp","getResponsiveValueSize","title","show","tooltip","series","type","center","radius","startAngle","endAngle","min","silent","progress","itemStyle","color","pointer","lineStyle","axisTick","distance","splitLine","axisLabel","fontSize","anchor","detail","icon","length","offsetCenter","borderRadius","formatter","name","label","echartsTheme","textStyle","overflow","sx","padding","container","default","theme","MIN_SIZE","MAX_SIZE","SIZE_MULTIPLIER","formattedValue","valueCharacters","valueSize","Math"],"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,WAAW,EAAEC,WAAW,QAAuB,mBAAmB;AAC3E,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,cAAcC,iBAAiB,QAA2B,iBAAiB;AACpF,SAASC,aAAa,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACrF,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,MAAM,QAAQ,YAAY;AAEnCR,IAAI;IAACE;IAAmBC;IAAeC;IAAgBC;IAAkBC;CAAe;AAExF,MAAMG,iBAAiB;AAEvB,oCAAoC;AACpC,MAAMC,yBAAyB;AAkB/B,OAAO,SAAST,WAAWU,KAAsB;IAC/C,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAE,GAAGN;IACvD,MAAMO,cAAcX;IAEpB,sFAAsF;IACtF,MAAMY,SAA4BpB,YAAY;YA0HzBmB;QAzHnB,IAAIJ,KAAKM,KAAK,KAAKC,WAAW,OAAOH,YAAYI,YAAY;QAE7D,qDAAqD;QACrD,MAAMC,iBAAiBC,uBAAuBV,KAAKM,KAAK,EAAEL,QAAQH,OAAOC;YAsHtDK;QApHnB,OAAO;YACLO,OAAO;gBACLC,MAAM;YACR;YACAC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AAG,CAACtB,OAAOC,UAAUsD,kBAAmBF;IAChE,OAAO,CAAC,MAAM,EAAEF,SAAS,IAAI,EAAEK,UAAU,IAAI,EAAEJ,SAAS,GAAG,CAAC;AAC9D"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GaugeChart/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 './GaugeChart';\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,cAAc,CAAC"}
1
+ {"version":3,"sources":["../../src/GaugeChart/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 './GaugeChart';\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,eAAe"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';
2
+ export type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';
3
3
  interface InfoTooltipProps {
4
4
  description: string;
5
5
  children: React.ReactNode;
@@ -9,6 +9,6 @@ interface InfoTooltipProps {
9
9
  enterDelay?: number;
10
10
  enterNextDelay?: number;
11
11
  }
12
- export declare const InfoTooltip: ({ id, title, description, placement, children, enterDelay, enterNextDelay, }: InfoTooltipProps) => JSX.Element;
12
+ export declare const InfoTooltip: ({ id, title, description, placement, children, enterDelay, enterNextDelay, }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
13
13
  export {};
14
14
  //# sourceMappingURL=InfoTooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InfoTooltip.d.ts","sourceRoot":"","sources":["../../src/InfoTooltip/InfoTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,oBAAY,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnE,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,iFAQrB,gBAAgB,gBAqBlB,CAAC"}
1
+ {"version":3,"file":"InfoTooltip.d.ts","sourceRoot":"","sources":["../../src/InfoTooltip/InfoTooltip.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnE,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,iFAQrB,gBAAgB,4CAqBlB,CAAC"}