@perses-dev/components 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-scatter-chart-embed-8efdfab

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 (360) hide show
  1. package/dist/BarChart/BarChart.d.ts +2 -2
  2. package/dist/BarChart/BarChart.d.ts.map +1 -1
  3. package/dist/BarChart/BarChart.js +16 -10
  4. package/dist/BarChart/BarChart.js.map +1 -1
  5. package/dist/BarChart/index.js.map +1 -1
  6. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  7. package/dist/ColorPicker/index.js.map +1 -1
  8. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  9. package/dist/ContentWithLegend/index.js.map +1 -1
  10. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
  11. package/dist/ContentWithLegend/model/content-with-legend-model.js +19 -19
  12. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  13. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  14. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +6 -22
  15. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  16. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  17. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  18. package/dist/DateTimeRangePicker/index.js.map +1 -1
  19. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  20. package/dist/Dialog/Dialog.js.map +1 -1
  21. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  22. package/dist/Dialog/index.js.map +1 -1
  23. package/dist/Drawer/Drawer.d.ts.map +1 -1
  24. package/dist/Drawer/Drawer.js +3 -2
  25. package/dist/Drawer/Drawer.js.map +1 -1
  26. package/dist/Drawer/index.js.map +1 -1
  27. package/dist/EChart/EChart.js +2 -2
  28. package/dist/EChart/EChart.js.map +1 -1
  29. package/dist/EChart/index.js.map +1 -1
  30. package/dist/ErrorAlert.js.map +1 -1
  31. package/dist/ErrorBoundary.js.map +1 -1
  32. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  33. package/dist/FontSizeSelector/index.js.map +1 -1
  34. package/dist/FormatControls/FormatControls.d.ts +9 -0
  35. package/dist/FormatControls/FormatControls.d.ts.map +1 -0
  36. package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
  37. package/dist/FormatControls/FormatControls.js.map +1 -0
  38. package/dist/FormatControls/index.d.ts +2 -0
  39. package/dist/FormatControls/index.d.ts.map +1 -0
  40. package/dist/{UnitSelector → FormatControls}/index.js +1 -1
  41. package/dist/FormatControls/index.js.map +1 -0
  42. package/dist/GaugeChart/GaugeChart.d.ts +3 -3
  43. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  44. package/dist/GaugeChart/GaugeChart.js +12 -12
  45. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  46. package/dist/GaugeChart/index.js.map +1 -1
  47. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  48. package/dist/InfoTooltip/index.js.map +1 -1
  49. package/dist/JSONEditor.d.ts +2 -1
  50. package/dist/JSONEditor.d.ts.map +1 -1
  51. package/dist/JSONEditor.js +9 -8
  52. package/dist/JSONEditor.js.map +1 -1
  53. package/dist/Legend/CompactLegend.js.map +1 -1
  54. package/dist/Legend/Legend.js +3 -3
  55. package/dist/Legend/Legend.js.map +1 -1
  56. package/dist/Legend/LegendColorBadge.js.map +1 -1
  57. package/dist/Legend/ListLegend.js.map +1 -1
  58. package/dist/Legend/ListLegendItem.js +2 -2
  59. package/dist/Legend/ListLegendItem.js.map +1 -1
  60. package/dist/Legend/TableLegend.js.map +1 -1
  61. package/dist/Legend/index.js.map +1 -1
  62. package/dist/Legend/legend-model.js.map +1 -1
  63. package/dist/LineChart/LineChart.d.ts +2 -2
  64. package/dist/LineChart/LineChart.d.ts.map +1 -1
  65. package/dist/LineChart/LineChart.js +20 -23
  66. package/dist/LineChart/LineChart.js.map +1 -1
  67. package/dist/LineChart/index.js.map +1 -1
  68. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  69. package/dist/ModeSelector/index.js.map +1 -1
  70. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  71. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  72. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  73. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  74. package/dist/OptionsEditorLayout/index.js.map +1 -1
  75. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  76. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +22 -6
  77. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  78. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  79. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
  80. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  81. package/dist/SettingsAutocomplete/index.js.map +1 -1
  82. package/dist/SortSelector/SortSelector.js.map +1 -1
  83. package/dist/SortSelector/index.js.map +1 -1
  84. package/dist/StatChart/StatChart.d.ts +2 -2
  85. package/dist/StatChart/StatChart.d.ts.map +1 -1
  86. package/dist/StatChart/StatChart.js +8 -8
  87. package/dist/StatChart/StatChart.js.map +1 -1
  88. package/dist/StatChart/calculateFontSize.js +7 -7
  89. package/dist/StatChart/calculateFontSize.js.map +1 -1
  90. package/dist/StatChart/index.js.map +1 -1
  91. package/dist/Table/InnerTable.js.map +1 -1
  92. package/dist/Table/Table.js.map +1 -1
  93. package/dist/Table/TableBody.js.map +1 -1
  94. package/dist/Table/TableCell.js +2 -2
  95. package/dist/Table/TableCell.js.map +1 -1
  96. package/dist/Table/TableCheckbox.js.map +1 -1
  97. package/dist/Table/TableHead.js.map +1 -1
  98. package/dist/Table/TableHeaderCell.js.map +1 -1
  99. package/dist/Table/TableRow.js.map +1 -1
  100. package/dist/Table/VirtualizedTable.js +6 -6
  101. package/dist/Table/VirtualizedTable.js.map +1 -1
  102. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  103. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  104. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +20 -20
  105. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  106. package/dist/Table/index.js.map +1 -1
  107. package/dist/Table/model/table-model.js +9 -9
  108. package/dist/Table/model/table-model.js.map +1 -1
  109. package/dist/ThresholdsEditor/ThresholdColorPicker.js +2 -2
  110. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  111. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  112. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  113. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  114. package/dist/ThresholdsEditor/ThresholdsEditor.js +19 -18
  115. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  116. package/dist/ThresholdsEditor/index.js.map +1 -1
  117. package/dist/TimeChart/TimeChart.d.ts +3 -3
  118. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  119. package/dist/TimeChart/TimeChart.js +109 -66
  120. package/dist/TimeChart/TimeChart.js.map +1 -1
  121. package/dist/TimeChart/index.js.map +1 -1
  122. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +3 -2
  123. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  124. package/dist/TimeSeriesTooltip/LineChartTooltip.js +12 -10
  125. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  126. package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -2
  127. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  128. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  129. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  130. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +3 -2
  131. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  132. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +7 -6
  133. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  134. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  135. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +1 -0
  136. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  137. package/dist/TimeSeriesTooltip/TooltipHeader.js +11 -11
  138. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  139. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  140. package/dist/TimeSeriesTooltip/nearby-series.d.ts +7 -7
  141. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  142. package/dist/TimeSeriesTooltip/nearby-series.js +42 -43
  143. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  144. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +13 -22
  145. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  146. package/dist/TimeSeriesTooltip/tooltip-model.js +10 -10
  147. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  148. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  149. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  150. package/dist/TimeSeriesTooltip/utils.js +5 -4
  151. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  152. package/dist/YAxisLabel.js.map +1 -1
  153. package/dist/cjs/BarChart/BarChart.js +24 -16
  154. package/dist/cjs/BarChart/index.js +10 -8
  155. package/dist/cjs/ColorPicker/ColorPicker.js +15 -13
  156. package/dist/cjs/ColorPicker/index.js +10 -8
  157. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +12 -10
  158. package/dist/cjs/ContentWithLegend/index.js +10 -8
  159. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +27 -23
  160. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +29 -43
  161. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +12 -10
  162. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +13 -11
  163. package/dist/cjs/DateTimeRangePicker/index.js +12 -10
  164. package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
  165. package/dist/cjs/Dialog/Dialog.js +15 -13
  166. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +11 -9
  167. package/dist/cjs/Dialog/index.js +11 -9
  168. package/dist/cjs/Drawer/Drawer.js +7 -4
  169. package/dist/cjs/Drawer/index.js +10 -8
  170. package/dist/cjs/EChart/EChart.js +12 -10
  171. package/dist/cjs/EChart/index.js +10 -8
  172. package/dist/cjs/ErrorAlert.js +5 -3
  173. package/dist/cjs/ErrorBoundary.js +4 -2
  174. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +8 -6
  175. package/dist/cjs/FontSizeSelector/index.js +10 -8
  176. package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
  177. package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
  178. package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
  179. package/dist/cjs/GaugeChart/index.js +10 -8
  180. package/dist/cjs/InfoTooltip/InfoTooltip.js +13 -11
  181. package/dist/cjs/InfoTooltip/index.js +10 -8
  182. package/dist/cjs/JSONEditor.js +19 -16
  183. package/dist/cjs/Legend/CompactLegend.js +9 -7
  184. package/dist/cjs/Legend/Legend.js +15 -13
  185. package/dist/cjs/Legend/LegendColorBadge.js +7 -5
  186. package/dist/cjs/Legend/ListLegend.js +10 -8
  187. package/dist/cjs/Legend/ListLegendItem.js +12 -10
  188. package/dist/cjs/Legend/TableLegend.js +7 -5
  189. package/dist/cjs/Legend/index.js +11 -9
  190. package/dist/cjs/Legend/legend-model.js +3 -1
  191. package/dist/cjs/LineChart/LineChart.js +29 -30
  192. package/dist/cjs/LineChart/index.js +10 -8
  193. package/dist/cjs/ModeSelector/ModeSelector.js +8 -6
  194. package/dist/cjs/ModeSelector/index.js +10 -8
  195. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +6 -4
  196. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +16 -14
  197. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +5 -3
  198. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +11 -9
  199. package/dist/cjs/OptionsEditorLayout/index.js +13 -11
  200. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +27 -9
  201. package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
  202. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +12 -10
  203. package/dist/cjs/SettingsAutocomplete/index.js +10 -8
  204. package/dist/cjs/SortSelector/SortSelector.js +8 -6
  205. package/dist/cjs/SortSelector/index.js +10 -8
  206. package/dist/cjs/StatChart/StatChart.js +20 -18
  207. package/dist/cjs/StatChart/calculateFontSize.js +10 -8
  208. package/dist/cjs/StatChart/index.js +10 -8
  209. package/dist/cjs/Table/InnerTable.js +5 -3
  210. package/dist/cjs/Table/Table.js +15 -13
  211. package/dist/cjs/Table/TableBody.js +5 -3
  212. package/dist/cjs/Table/TableCell.js +10 -8
  213. package/dist/cjs/Table/TableCheckbox.js +5 -3
  214. package/dist/cjs/Table/TableHead.js +5 -3
  215. package/dist/cjs/Table/TableHeaderCell.js +8 -6
  216. package/dist/cjs/Table/TableRow.js +5 -3
  217. package/dist/cjs/Table/VirtualizedTable.js +32 -30
  218. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
  219. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +3 -1
  220. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +23 -21
  221. package/dist/cjs/Table/index.js +14 -10
  222. package/dist/cjs/Table/model/table-model.js +15 -11
  223. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +15 -13
  224. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +14 -12
  225. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +44 -41
  226. package/dist/cjs/ThresholdsEditor/index.js +10 -8
  227. package/dist/cjs/TimeChart/TimeChart.js +122 -77
  228. package/dist/cjs/TimeChart/index.js +10 -8
  229. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +33 -29
  230. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +17 -15
  231. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +15 -13
  232. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +5 -3
  233. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +25 -22
  234. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +7 -5
  235. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +36 -34
  236. package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
  237. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +68 -51
  238. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +61 -24
  239. package/dist/cjs/TimeSeriesTooltip/utils.js +19 -14
  240. package/dist/cjs/YAxisLabel.js +6 -4
  241. package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +38 -11
  242. package/dist/cjs/context/SnackbarProvider.js +6 -2
  243. package/dist/cjs/context/TimeZoneProvider.js +13 -7
  244. package/dist/cjs/context/index.js +32 -0
  245. package/dist/cjs/index.js +41 -41
  246. package/dist/cjs/model/graph.js +9 -3
  247. package/dist/cjs/model/index.js +12 -10
  248. package/dist/cjs/test/index.js +10 -8
  249. package/dist/cjs/test/render.js +7 -5
  250. package/dist/cjs/test-utils/index.js +10 -8
  251. package/dist/cjs/test-utils/theme.js +38 -19
  252. package/dist/cjs/theme/component-overrides/alert.js +3 -1
  253. package/dist/cjs/theme/component-overrides/paper.js +3 -1
  254. package/dist/cjs/theme/index.js +10 -8
  255. package/dist/cjs/theme/palette/background.js +6 -2
  256. package/dist/cjs/theme/palette/colors/blue.js +3 -1
  257. package/dist/cjs/theme/palette/colors/common.js +6 -2
  258. package/dist/cjs/theme/palette/colors/green.js +3 -1
  259. package/dist/cjs/theme/palette/colors/grey.js +3 -1
  260. package/dist/cjs/theme/palette/colors/index.js +17 -15
  261. package/dist/cjs/theme/palette/colors/orange.js +3 -1
  262. package/dist/cjs/theme/palette/colors/purple.js +3 -1
  263. package/dist/cjs/theme/palette/colors/red.js +3 -1
  264. package/dist/cjs/theme/palette/error.js +3 -1
  265. package/dist/cjs/theme/palette/grey.js +3 -1
  266. package/dist/cjs/theme/palette/index.js +10 -8
  267. package/dist/cjs/theme/palette/palette-options.js +3 -1
  268. package/dist/cjs/theme/palette/primary.js +3 -1
  269. package/dist/cjs/theme/palette/secondary.js +3 -1
  270. package/dist/cjs/theme/palette/success.js +3 -1
  271. package/dist/cjs/theme/palette/text.js +3 -1
  272. package/dist/cjs/theme/palette/warning.js +3 -1
  273. package/dist/cjs/theme/theme.js +5 -3
  274. package/dist/cjs/theme/typography.js +3 -1
  275. package/dist/cjs/utils/axis.js +11 -7
  276. package/dist/cjs/utils/chart-actions.js +68 -12
  277. package/dist/cjs/utils/combine-sx.js +3 -1
  278. package/dist/cjs/utils/component-ids.js +3 -1
  279. package/dist/cjs/utils/format.js +16 -8
  280. package/dist/cjs/utils/index.js +15 -13
  281. package/dist/cjs/utils/mathjs.js +3 -1
  282. package/dist/cjs/utils/theme-gen.js +16 -18
  283. package/dist/context/ChartsProvider.d.ts +19 -0
  284. package/dist/context/ChartsProvider.d.ts.map +1 -0
  285. package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
  286. package/dist/context/ChartsProvider.js.map +1 -0
  287. package/dist/context/SnackbarProvider.js.map +1 -1
  288. package/dist/context/TimeZoneProvider.js.map +1 -1
  289. package/dist/context/index.d.ts +4 -0
  290. package/dist/context/index.d.ts.map +1 -0
  291. package/dist/context/index.js +17 -0
  292. package/dist/context/index.js.map +1 -0
  293. package/dist/index.d.ts +2 -4
  294. package/dist/index.d.ts.map +1 -1
  295. package/dist/index.js +2 -4
  296. package/dist/index.js.map +1 -1
  297. package/dist/model/graph.js.map +1 -1
  298. package/dist/model/index.js.map +1 -1
  299. package/dist/test/index.js.map +1 -1
  300. package/dist/test/render.js.map +1 -1
  301. package/dist/test/setup-tests.js.map +1 -1
  302. package/dist/test-utils/index.js.map +1 -1
  303. package/dist/test-utils/theme.d.ts +2 -0
  304. package/dist/test-utils/theme.d.ts.map +1 -1
  305. package/dist/test-utils/theme.js +25 -16
  306. package/dist/test-utils/theme.js.map +1 -1
  307. package/dist/theme/component-overrides/alert.js.map +1 -1
  308. package/dist/theme/component-overrides/paper.js.map +1 -1
  309. package/dist/theme/index.d.ts +1 -0
  310. package/dist/theme/index.d.ts.map +1 -1
  311. package/dist/theme/index.js.map +1 -1
  312. package/dist/theme/palette/background.d.ts.map +1 -1
  313. package/dist/theme/palette/background.js +3 -1
  314. package/dist/theme/palette/background.js.map +1 -1
  315. package/dist/theme/palette/colors/blue.js.map +1 -1
  316. package/dist/theme/palette/colors/common.js.map +1 -1
  317. package/dist/theme/palette/colors/green.js.map +1 -1
  318. package/dist/theme/palette/colors/grey.js.map +1 -1
  319. package/dist/theme/palette/colors/index.js.map +1 -1
  320. package/dist/theme/palette/colors/orange.js.map +1 -1
  321. package/dist/theme/palette/colors/purple.js.map +1 -1
  322. package/dist/theme/palette/colors/red.js.map +1 -1
  323. package/dist/theme/palette/error.js.map +1 -1
  324. package/dist/theme/palette/grey.js.map +1 -1
  325. package/dist/theme/palette/index.js.map +1 -1
  326. package/dist/theme/palette/palette-options.js.map +1 -1
  327. package/dist/theme/palette/primary.js.map +1 -1
  328. package/dist/theme/palette/secondary.js.map +1 -1
  329. package/dist/theme/palette/success.js.map +1 -1
  330. package/dist/theme/palette/text.js.map +1 -1
  331. package/dist/theme/palette/warning.js.map +1 -1
  332. package/dist/theme/theme.js.map +1 -1
  333. package/dist/theme/typography.js.map +1 -1
  334. package/dist/utils/axis.d.ts +4 -4
  335. package/dist/utils/axis.d.ts.map +1 -1
  336. package/dist/utils/axis.js +4 -4
  337. package/dist/utils/axis.js.map +1 -1
  338. package/dist/utils/chart-actions.d.ts +6 -2
  339. package/dist/utils/chart-actions.d.ts.map +1 -1
  340. package/dist/utils/chart-actions.js +51 -7
  341. package/dist/utils/chart-actions.js.map +1 -1
  342. package/dist/utils/combine-sx.js.map +1 -1
  343. package/dist/utils/component-ids.js.map +1 -1
  344. package/dist/utils/format.js.map +1 -1
  345. package/dist/utils/index.js.map +1 -1
  346. package/dist/utils/mathjs.js.map +1 -1
  347. package/dist/utils/theme-gen.d.ts +2 -7
  348. package/dist/utils/theme-gen.d.ts.map +1 -1
  349. package/dist/utils/theme-gen.js +11 -15
  350. package/dist/utils/theme-gen.js.map +1 -1
  351. package/package.json +7 -6
  352. package/dist/UnitSelector/UnitSelector.d.ts +0 -9
  353. package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
  354. package/dist/UnitSelector/UnitSelector.js.map +0 -1
  355. package/dist/UnitSelector/index.d.ts +0 -2
  356. package/dist/UnitSelector/index.d.ts.map +0 -1
  357. package/dist/UnitSelector/index.js.map +0 -1
  358. package/dist/context/ChartsThemeProvider.d.ts +0 -10
  359. package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
  360. package/dist/context/ChartsThemeProvider.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/VirtualizedTableContainer.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 { TableContainer as MuiTableContainer, TableContainerProps as MuiTableContainerProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype VirtualizedTableContainerProps = MuiTableContainerProps;\n\nexport const VirtualizedTableContainer = forwardRef<HTMLDivElement, VirtualizedTableContainerProps>(\n function VirtualizedTableContainer(props, ref) {\n return <MuiTableContainer {...props} tabIndex={-1} ref={ref} />;\n }\n);\n"],"names":["TableContainer","MuiTableContainer","forwardRef","VirtualizedTableContainer","props","ref","tabIndex"],"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,cAAc,IAAIC,iBAAiB,QAAuD,eAAe,CAAC;AACnH,SAASC,UAAU,QAAQ,OAAO,CAAC;AAInC,OAAO,MAAMC,yBAAyB,iBAAGD,UAAU,CACjD,SAASC,yBAAyB,CAACC,KAAK,EAAEC,GAAG,EAAE;IAC7C,qBAAO,KAACJ,iBAAiB;QAAE,GAAGG,KAAK;QAAEE,QAAQ,EAAE,CAAC,CAAC;QAAED,GAAG,EAAEA,GAAG;MAAI,CAAC;AAClE,CAAC,CACF,CAAC"}
1
+ {"version":3,"sources":["../../src/Table/VirtualizedTableContainer.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 { TableContainer as MuiTableContainer, TableContainerProps as MuiTableContainerProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype VirtualizedTableContainerProps = MuiTableContainerProps;\n\nexport const VirtualizedTableContainer = forwardRef<HTMLDivElement, VirtualizedTableContainerProps>(\n function VirtualizedTableContainer(props, ref) {\n return <MuiTableContainer {...props} tabIndex={-1} ref={ref} />;\n }\n);\n"],"names":["TableContainer","MuiTableContainer","forwardRef","VirtualizedTableContainer","props","ref","tabIndex"],"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,kBAAkBC,iBAAiB,QAAuD,gBAAgB;AACnH,SAASC,UAAU,QAAQ,QAAQ;AAInC,OAAO,MAAMC,0CAA4BD,WACvC,SAASC,0BAA0BC,KAAK,EAAEC,GAAG;IAC3C,qBAAO,KAACJ;QAAmB,GAAGG,KAAK;QAAEE,UAAU,CAAC;QAAGD,KAAKA;;AAC1D,GACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Table/hooks/useTableKeyboardNav.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 { useCallback, useState } from 'react';\n\nexport interface UseTableKeyboardNavProps {\n maxRows: number;\n maxColumns: number;\n\n /**\n * Function used to modify the active table cell based on the keyboard event,\n * the current position, and the default recommended next position (this value\n * will be `undefined` in cases where there is no default handler like `PageUp`\n * and `PageDown`). This can be used to modify the next position that will be\n * used and/or to handle side effects related to the new position (e.g.\n * pagination, scrolling the active cell into view).\n */\n onActiveCellChange?: (\n e: React.KeyboardEvent<HTMLTableElement>,\n currentActiveCell: TableCellPosition,\n defaultNextActiveCell: TableCellPosition | undefined\n ) => TableCellPosition | undefined;\n}\n\ntype TableCellPosition = {\n row: number;\n column: number;\n};\n\nconst DEFAULT_ACTIVE_CELL: TableCellPosition = {\n row: 0,\n column: 0,\n};\n\nconst ARROW_KEYS = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'];\n\nfunction isArrowKey(key: string) {\n return ARROW_KEYS.includes(key);\n}\n\n/**\n * Hook for managing keyboard navigation for table components. It is intended\n * to be wrapped by implementation-specific tables to account for differences\n * like pagination, infinite scroll, and virtualization. See `useVirtualizedKeyboardNav`\n * for an example.\n */\nexport function useTableKeyboardNav({ maxRows, maxColumns, onActiveCellChange }: UseTableKeyboardNavProps) {\n const [activeCell, setActiveCell] = useState<TableCellPosition>(DEFAULT_ACTIVE_CELL);\n const [isActive, setIsActive] = useState(false);\n\n const handleCellFocus = (cellPosition: TableCellPosition) => {\n if (cellPosition.column === activeCell.column && cellPosition.row === activeCell.row && isActive) {\n return;\n }\n setIsActive(true);\n setActiveCell(cellPosition);\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLTableElement> = useCallback(\n (e) => {\n // Including some of the basic a11y keyboard interaction patterns from:\n // https://www.w3.org/WAI/ARIA/apg/patterns/grid/\n // TODO: add other keyboard combos.\n const key = e.key;\n\n if (isArrowKey(key) || key === 'Home' || key === 'End' || key === 'PageDown' || key === 'PageUp') {\n setActiveCell((curActiveCell) => {\n let nextRow: number = curActiveCell.row;\n let nextColumn: number = curActiveCell.column;\n\n if (key === 'ArrowRight' && nextColumn < maxColumns - 1) {\n e.preventDefault();\n nextColumn += 1;\n } else if (key === 'ArrowLeft' && nextColumn > 0) {\n e.preventDefault();\n nextColumn -= 1;\n } else if (key === 'ArrowDown' && nextRow < maxRows - 1) {\n e.preventDefault();\n nextRow += 1;\n } else if (key === 'ArrowUp' && nextRow > 0) {\n e.preventDefault();\n nextRow -= 1;\n } else if (key === 'Home') {\n e.preventDefault();\n nextRow = 0;\n nextColumn = 0;\n } else if (key === 'End') {\n e.preventDefault();\n nextRow = maxRows - 1;\n nextColumn = maxColumns - 1;\n }\n\n const defaultNewPosition = { column: nextColumn, row: nextRow };\n\n const newPosition = onActiveCellChange?.(e, curActiveCell, defaultNewPosition) || defaultNewPosition;\n\n if (newPosition.row === curActiveCell.row && newPosition.column === curActiveCell.column) {\n // Return original to avoid creating a new object if nothing\n // changed.\n return curActiveCell;\n }\n\n return newPosition;\n });\n }\n },\n [maxColumns, maxRows, onActiveCellChange]\n );\n\n return {\n activeCell,\n isActive,\n onTableKeyDown: handleKeyDown,\n onCellFocus: handleCellFocus,\n };\n}\n"],"names":["useCallback","useState","DEFAULT_ACTIVE_CELL","row","column","ARROW_KEYS","isArrowKey","key","includes","useTableKeyboardNav","maxRows","maxColumns","onActiveCellChange","activeCell","setActiveCell","isActive","setIsActive","handleCellFocus","cellPosition","handleKeyDown","e","curActiveCell","nextRow","nextColumn","preventDefault","defaultNewPosition","newPosition","onTableKeyDown","onCellFocus"],"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,QAAQ,QAAQ,OAAO,CAAC;AA0B9C,MAAMC,mBAAmB,GAAsB;IAC7CC,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;CACV,AAAC;AAEF,MAAMC,UAAU,GAAG;IAAC,YAAY;IAAE,WAAW;IAAE,SAAS;IAAE,WAAW;CAAC,AAAC;AAEvE,SAASC,UAAU,CAACC,GAAW,EAAE;IAC/B,OAAOF,UAAU,CAACG,QAAQ,CAACD,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;CAKC,GACD,OAAO,SAASE,mBAAmB,CAAC,EAAEC,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ED,OAAO;QAAEE,kBAAkB;KAAC,CAC1C,AAAC;IAEF,OAAO;QACLC,UAAU;QACVE,QAAQ;QACRY,cAAc,EAAER,aAAa;QAC7BS,WAAW,EAAEX,eAAe;KAC7B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/Table/hooks/useTableKeyboardNav.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 { useCallback, useState } from 'react';\n\nexport interface UseTableKeyboardNavProps {\n maxRows: number;\n maxColumns: number;\n\n /**\n * Function used to modify the active table cell based on the keyboard event,\n * the current position, and the default recommended next position (this value\n * will be `undefined` in cases where there is no default handler like `PageUp`\n * and `PageDown`). This can be used to modify the next position that will be\n * used and/or to handle side effects related to the new position (e.g.\n * pagination, scrolling the active cell into view).\n */\n onActiveCellChange?: (\n e: React.KeyboardEvent<HTMLTableElement>,\n currentActiveCell: TableCellPosition,\n defaultNextActiveCell: TableCellPosition | undefined\n ) => TableCellPosition | undefined;\n}\n\ntype TableCellPosition = {\n row: number;\n column: number;\n};\n\nconst DEFAULT_ACTIVE_CELL: TableCellPosition = {\n row: 0,\n column: 0,\n};\n\nconst ARROW_KEYS = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'];\n\nfunction isArrowKey(key: string) {\n return ARROW_KEYS.includes(key);\n}\n\n/**\n * Hook for managing keyboard navigation for table components. It is intended\n * to be wrapped by implementation-specific tables to account for differences\n * like pagination, infinite scroll, and virtualization. See `useVirtualizedKeyboardNav`\n * for an example.\n */\nexport function useTableKeyboardNav({ maxRows, maxColumns, onActiveCellChange }: UseTableKeyboardNavProps) {\n const [activeCell, setActiveCell] = useState<TableCellPosition>(DEFAULT_ACTIVE_CELL);\n const [isActive, setIsActive] = useState(false);\n\n const handleCellFocus = (cellPosition: TableCellPosition) => {\n if (cellPosition.column === activeCell.column && cellPosition.row === activeCell.row && isActive) {\n return;\n }\n setIsActive(true);\n setActiveCell(cellPosition);\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLTableElement> = useCallback(\n (e) => {\n // Including some of the basic a11y keyboard interaction patterns from:\n // https://www.w3.org/WAI/ARIA/apg/patterns/grid/\n // TODO: add other keyboard combos.\n const key = e.key;\n\n if (isArrowKey(key) || key === 'Home' || key === 'End' || key === 'PageDown' || key === 'PageUp') {\n setActiveCell((curActiveCell) => {\n let nextRow: number = curActiveCell.row;\n let nextColumn: number = curActiveCell.column;\n\n if (key === 'ArrowRight' && nextColumn < maxColumns - 1) {\n e.preventDefault();\n nextColumn += 1;\n } else if (key === 'ArrowLeft' && nextColumn > 0) {\n e.preventDefault();\n nextColumn -= 1;\n } else if (key === 'ArrowDown' && nextRow < maxRows - 1) {\n e.preventDefault();\n nextRow += 1;\n } else if (key === 'ArrowUp' && nextRow > 0) {\n e.preventDefault();\n nextRow -= 1;\n } else if (key === 'Home') {\n e.preventDefault();\n nextRow = 0;\n nextColumn = 0;\n } else if (key === 'End') {\n e.preventDefault();\n nextRow = maxRows - 1;\n nextColumn = maxColumns - 1;\n }\n\n const defaultNewPosition = { column: nextColumn, row: nextRow };\n\n const newPosition = onActiveCellChange?.(e, curActiveCell, defaultNewPosition) || defaultNewPosition;\n\n if (newPosition.row === curActiveCell.row && newPosition.column === curActiveCell.column) {\n // Return original to avoid creating a new object if nothing\n // changed.\n return curActiveCell;\n }\n\n return newPosition;\n });\n }\n },\n [maxColumns, maxRows, onActiveCellChange]\n );\n\n return {\n activeCell,\n isActive,\n onTableKeyDown: handleKeyDown,\n onCellFocus: handleCellFocus,\n };\n}\n"],"names":["useCallback","useState","DEFAULT_ACTIVE_CELL","row","column","ARROW_KEYS","isArrowKey","key","includes","useTableKeyboardNav","maxRows","maxColumns","onActiveCellChange","activeCell","setActiveCell","isActive","setIsActive","handleCellFocus","cellPosition","handleKeyDown","e","curActiveCell","nextRow","nextColumn","preventDefault","defaultNewPosition","newPosition","onTableKeyDown","onCellFocus"],"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,QAAQ,QAAQ,QAAQ;AA0B9C,MAAMC,sBAAyC;IAC7CC,KAAK;IACLC,QAAQ;AACV;AAEA,MAAMC,aAAa;IAAC;IAAc;IAAa;IAAW;CAAY;AAEtE,SAASC,WAAWC,GAAW;IAC7B,OAAOF,WAAWG,SAASD;AAC7B;AAEA;;;;;CAKC,GACD,OAAO,SAASE,oBAAoB,EAAEC,QAAO,EAAEC,WAAU,EAAEC,mBAAkB,EAA4B;IACvG,MAAM,CAACC,YAAYC,cAAc,GAAGb,SAA4BC;IAChE,MAAM,CAACa,UAAUC,YAAY,GAAGf,SAAS;IAEzC,MAAMgB,kBAAkB,CAACC;QACvB,IAAIA,aAAad,WAAWS,WAAWT,UAAUc,aAAaf,QAAQU,WAAWV,OAAOY,UAAU;YAChG;QACF;QACAC,YAAY;QACZF,cAAcI;IAChB;IAEA,MAAMC,gBAA8DnB,YAClE,CAACoB;QACC,uEAAuE;QACvE,iDAAiD;QACjD,mCAAmC;QACnC,MAAMb,MAAMa,EAAEb;QAEd,IAAID,WAAWC,QAAQA,QAAQ,UAAUA,QAAQ,SAASA,QAAQ,cAAcA,QAAQ,UAAU;YAChGO,cAAc,CAACO;gBACb,IAAIC,UAAkBD,cAAclB;gBACpC,IAAIoB,aAAqBF,cAAcjB;gBAEvC,IAAIG,QAAQ,gBAAgBgB,aAAaZ,aAAa,GAAG;oBACvDS,EAAEI;oBACFD,cAAc;gBAChB,OAAO,IAAIhB,QAAQ,eAAegB,aAAa,GAAG;oBAChDH,EAAEI;oBACFD,cAAc;gBAChB,OAAO,IAAIhB,QAAQ,eAAee,UAAUZ,UAAU,GAAG;oBACvDU,EAAEI;oBACFF,WAAW;gBACb,OAAO,IAAIf,QAAQ,aAAae,UAAU,GAAG;oBAC3CF,EAAEI;oBACFF,WAAW;gBACb,OAAO,IAAIf,QAAQ,QAAQ;oBACzBa,EAAEI;oBACFF,UAAU;oBACVC,aAAa;gBACf,OAAO,IAAIhB,QAAQ,OAAO;oBACxBa,EAAEI;oBACFF,UAAUZ,UAAU;oBACpBa,aAAaZ,aAAa;gBAC5B;gBAEA,MAAMc,qBAAqB;oBAAErB,QAAQmB;oBAAYpB,KAAKmB;gBAAQ;gBAE9D,MAAMI,cAAcd,CAAAA,+BAAAA,gCAAAA,KAAAA,IAAAA,mBAAqBQ,GAAGC,eAAeI,wBAAuBA;gBAElF,IAAIC,YAAYvB,QAAQkB,cAAclB,OAAOuB,YAAYtB,WAAWiB,cAAcjB,QAAQ;oBACxF,4DAA4D;oBAC5D,WAAW;oBACX,OAAOiB;gBACT;gBAEA,OAAOK;YACT;QACF;IACF,GACA;QAACf;QAAYD;QAASE;KAAmB;IAG3C,OAAO;QACLC;QACAE;QACAY,gBAAgBR;QAChBS,aAAaX;IACf;AACF"}
@@ -20,14 +20,14 @@ import { useTableKeyboardNav } from './useTableKeyboardNav';
20
20
  onActiveCellChange: (e, currentPosition, defaultNewPosition)=>{
21
21
  const key = e.key;
22
22
  const defaultValueChanged = defaultNewPosition && (currentPosition.column !== defaultNewPosition.column || currentPosition.row !== defaultNewPosition.row);
23
- var ref;
24
- const nextRow = (ref = defaultNewPosition === null || defaultNewPosition === void 0 ? void 0 : defaultNewPosition.row) !== null && ref !== void 0 ? ref : currentPosition.row;
23
+ var _defaultNewPosition_row;
24
+ const nextRow = (_defaultNewPosition_row = defaultNewPosition === null || defaultNewPosition === void 0 ? void 0 : defaultNewPosition.row) !== null && _defaultNewPosition_row !== void 0 ? _defaultNewPosition_row : currentPosition.row;
25
25
  if (key === 'ArrowDown' && defaultValueChanged) {
26
26
  // Use default cell position. Shift the virtual table scroll position
27
27
  // when needed to make the active cell visible.
28
28
  if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
29
- var ref1;
30
- (ref1 = virtualTable.current) === null || ref1 === void 0 ? void 0 : ref1.scrollToIndex({
29
+ var _virtualTable_current;
30
+ (_virtualTable_current = virtualTable.current) === null || _virtualTable_current === void 0 ? void 0 : _virtualTable_current.scrollToIndex({
31
31
  index: nextRow - 1,
32
32
  align: 'end'
33
33
  });
@@ -36,8 +36,8 @@ import { useTableKeyboardNav } from './useTableKeyboardNav';
36
36
  // Use default cell position. Shift the virtual table scroll position
37
37
  // when needed to make the active cell visible.
38
38
  if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
39
- var ref2;
40
- (ref2 = virtualTable.current) === null || ref2 === void 0 ? void 0 : ref2.scrollToIndex({
39
+ var _virtualTable_current1;
40
+ (_virtualTable_current1 = virtualTable.current) === null || _virtualTable_current1 === void 0 ? void 0 : _virtualTable_current1.scrollToIndex({
41
41
  index: nextRow - 1,
42
42
  align: 'start'
43
43
  });
@@ -45,38 +45,38 @@ import { useTableKeyboardNav } from './useTableKeyboardNav';
45
45
  } else if (defaultValueChanged && (key === 'Home' || key === 'End')) {
46
46
  var // Use default cell position. Shift the virtual table scroll position
47
47
  // when needed to make the active cell visible.
48
- ref3;
49
- (ref3 = virtualTable.current) === null || ref3 === void 0 ? void 0 : ref3.scrollToIndex({
48
+ _virtualTable_current2;
49
+ (_virtualTable_current2 = virtualTable.current) === null || _virtualTable_current2 === void 0 ? void 0 : _virtualTable_current2.scrollToIndex({
50
50
  index: Math.max(nextRow - 1, 0),
51
51
  align: 'start'
52
52
  });
53
53
  } else if (key === 'PageDown') {
54
- var ref4;
54
+ var _virtualTable_current3;
55
55
  // Full handling of logic for `PageDown` because there is no default.
56
56
  e.preventDefault();
57
- let nextRow1 = currentPosition.row;
57
+ let nextRow = currentPosition.row;
58
58
  // Add 1 to account for header
59
- nextRow1 = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);
60
- (ref4 = virtualTable.current) === null || ref4 === void 0 ? void 0 : ref4.scrollToIndex({
61
- index: nextRow1 - 1,
59
+ nextRow = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);
60
+ (_virtualTable_current3 = virtualTable.current) === null || _virtualTable_current3 === void 0 ? void 0 : _virtualTable_current3.scrollToIndex({
61
+ index: nextRow - 1,
62
62
  align: 'start'
63
63
  });
64
64
  return {
65
- row: nextRow1,
65
+ row: nextRow,
66
66
  column: currentPosition.column
67
67
  };
68
68
  } else if (key === 'PageUp') {
69
- var ref5;
69
+ var _virtualTable_current4;
70
70
  // Full handling of logic for `PageUp` because there is no default.
71
- let nextRow2 = currentPosition.row;
71
+ let nextRow = currentPosition.row;
72
72
  // Minus 1 to account for header
73
- nextRow2 = Math.max(0, visibleRange.current.startIndex - 1);
74
- (ref5 = virtualTable.current) === null || ref5 === void 0 ? void 0 : ref5.scrollToIndex({
75
- index: nextRow2 - 1,
73
+ nextRow = Math.max(0, visibleRange.current.startIndex - 1);
74
+ (_virtualTable_current4 = virtualTable.current) === null || _virtualTable_current4 === void 0 ? void 0 : _virtualTable_current4.scrollToIndex({
75
+ index: nextRow - 1,
76
76
  align: 'end'
77
77
  });
78
78
  return {
79
- row: nextRow2,
79
+ row: nextRow,
80
80
  column: currentPosition.column
81
81
  };
82
82
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Table/hooks/useVirtualizedTableKeyboardNav.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 { TableVirtuosoHandle } from 'react-virtuoso';\nimport { useTableKeyboardNav, UseTableKeyboardNavProps } from './useTableKeyboardNav';\n\ninterface UseVirtualizedTableKeyboardNavProps extends Omit<UseTableKeyboardNavProps, 'onActiveCellChange'> {\n visibleRange: React.MutableRefObject<{\n startIndex: number;\n endIndex: number;\n }>;\n virtualTable: React.RefObject<TableVirtuosoHandle>;\n maxRows: number;\n maxColumns: number;\n}\n\n/**\n * Hook for managing keyboard navigation when using a virtualized table.\n */\nexport function useVirtualizedTableKeyboardNav({\n visibleRange,\n virtualTable,\n maxRows,\n maxColumns,\n}: UseVirtualizedTableKeyboardNavProps) {\n const baseKeyboard = useTableKeyboardNav({\n maxRows,\n maxColumns,\n onActiveCellChange: (e, currentPosition, defaultNewPosition) => {\n const key = e.key;\n\n const defaultValueChanged =\n defaultNewPosition &&\n (currentPosition.column !== defaultNewPosition.column || currentPosition.row !== defaultNewPosition.row);\n const nextRow = defaultNewPosition?.row ?? currentPosition.row;\n\n if (key === 'ArrowDown' && defaultValueChanged) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'end',\n });\n }\n } else if (key === 'ArrowUp' && defaultValueChanged) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'start',\n });\n }\n } else if (defaultValueChanged && (key === 'Home' || key === 'End')) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n virtualTable.current?.scrollToIndex({\n index: Math.max(nextRow - 1, 0),\n align: 'start',\n });\n } else if (key === 'PageDown') {\n // Full handling of logic for `PageDown` because there is no default.\n e.preventDefault();\n\n let nextRow = currentPosition.row;\n // Add 1 to account for header\n\n nextRow = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);\n\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'start',\n });\n\n return {\n row: nextRow,\n column: currentPosition.column,\n };\n } else if (key === 'PageUp') {\n // Full handling of logic for `PageUp` because there is no default.\n let nextRow = currentPosition.row;\n // Minus 1 to account for header\n nextRow = Math.max(0, visibleRange.current.startIndex - 1);\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'end',\n });\n\n return {\n row: nextRow,\n column: currentPosition.column,\n };\n }\n\n return defaultNewPosition;\n },\n });\n\n return baseKeyboard;\n}\n"],"names":["useTableKeyboardNav","useVirtualizedTableKeyboardNav","visibleRange","virtualTable","maxRows","maxColumns","baseKeyboard","onActiveCellChange","e","currentPosition","defaultNewPosition","key","defaultValueChanged","column","row","nextRow","current","startIndex","endIndex","scrollToIndex","index","align","Math","max","preventDefault","min"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,mBAAmB,QAAkC,uBAAuB,CAAC;AAYtF;;CAEC,GACD,OAAO,SAASC,8BAA8B,CAAC,EAC7CC,YAAY,CAAA,EACZC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,UAAU,CAAA,EAC0B,EAAE;IACtC,MAAMC,YAAY,GAAGN,mBAAmB,CAAC;QACvCI,OAAO;QACPC,UAAU;QACVE,kBAAkB,EAAE,CAACC,CAAC,EAAEC,eAAe,EAAEC,kBAAkB,GAAK;YAC9D,MAAMC,GAAG,GAAGH,CAAC,CAAC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N,eAAe,CAACK,GAAG,AAAC;gBAClC,gCAAgC;gBAChCC,QAAO,GAAGO,IAAI,CAACC,GAAG,CAAC,CAAC,EAAErB,YAAY,CAACc,OAAO,CAACC,UAAU,GAAG,CAAC,CAAC,CAAC;gBAC3Dd,CAAAA,IAAoB,GAApBA,YAAY,CAACa,OAAO,cAApBb,IAAoB,WAAe,GAAnCA,KAAAA,CAAmC,GAAnCA,IAAoB,CAAEgB,aAAa,CAAC;oBAClCC,KAAK,EAAEL,QAAO,GAAG,CAAC;oBAClBM,KAAK,EAAE,KAAK;iBACb,CAAC,CAAC;gBAEH,OAAO;oBACLP,GAAG,EAAEC,QAAO;oBACZF,MAAM,EAAEJ,eAAe,CAACI,MAAM;iBAC/B,CAAC;YACJ,CAAC;YAED,OAAOH,kBAAkB,CAAC;QAC5B,CAAC;KACF,CAAC,AAAC;IAEH,OAAOJ,YAAY,CAAC;AACtB,CAAC"}
1
+ {"version":3,"sources":["../../../src/Table/hooks/useVirtualizedTableKeyboardNav.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 { TableVirtuosoHandle } from 'react-virtuoso';\nimport { useTableKeyboardNav, UseTableKeyboardNavProps } from './useTableKeyboardNav';\n\ninterface UseVirtualizedTableKeyboardNavProps extends Omit<UseTableKeyboardNavProps, 'onActiveCellChange'> {\n visibleRange: React.MutableRefObject<{\n startIndex: number;\n endIndex: number;\n }>;\n virtualTable: React.RefObject<TableVirtuosoHandle>;\n maxRows: number;\n maxColumns: number;\n}\n\n/**\n * Hook for managing keyboard navigation when using a virtualized table.\n */\nexport function useVirtualizedTableKeyboardNav({\n visibleRange,\n virtualTable,\n maxRows,\n maxColumns,\n}: UseVirtualizedTableKeyboardNavProps) {\n const baseKeyboard = useTableKeyboardNav({\n maxRows,\n maxColumns,\n onActiveCellChange: (e, currentPosition, defaultNewPosition) => {\n const key = e.key;\n\n const defaultValueChanged =\n defaultNewPosition &&\n (currentPosition.column !== defaultNewPosition.column || currentPosition.row !== defaultNewPosition.row);\n const nextRow = defaultNewPosition?.row ?? currentPosition.row;\n\n if (key === 'ArrowDown' && defaultValueChanged) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'end',\n });\n }\n } else if (key === 'ArrowUp' && defaultValueChanged) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'start',\n });\n }\n } else if (defaultValueChanged && (key === 'Home' || key === 'End')) {\n // Use default cell position. Shift the virtual table scroll position\n // when needed to make the active cell visible.\n virtualTable.current?.scrollToIndex({\n index: Math.max(nextRow - 1, 0),\n align: 'start',\n });\n } else if (key === 'PageDown') {\n // Full handling of logic for `PageDown` because there is no default.\n e.preventDefault();\n\n let nextRow = currentPosition.row;\n // Add 1 to account for header\n\n nextRow = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);\n\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'start',\n });\n\n return {\n row: nextRow,\n column: currentPosition.column,\n };\n } else if (key === 'PageUp') {\n // Full handling of logic for `PageUp` because there is no default.\n let nextRow = currentPosition.row;\n // Minus 1 to account for header\n nextRow = Math.max(0, visibleRange.current.startIndex - 1);\n virtualTable.current?.scrollToIndex({\n index: nextRow - 1,\n align: 'end',\n });\n\n return {\n row: nextRow,\n column: currentPosition.column,\n };\n }\n\n return defaultNewPosition;\n },\n });\n\n return baseKeyboard;\n}\n"],"names":["useTableKeyboardNav","useVirtualizedTableKeyboardNav","visibleRange","virtualTable","maxRows","maxColumns","baseKeyboard","onActiveCellChange","e","currentPosition","defaultNewPosition","key","defaultValueChanged","column","row","nextRow","current","startIndex","endIndex","scrollToIndex","index","align","Math","max","preventDefault","min"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,mBAAmB,QAAkC,wBAAwB;AAYtF;;CAEC,GACD,OAAO,SAASC,+BAA+B,EAC7CC,aAAY,EACZC,aAAY,EACZC,QAAO,EACPC,WAAU,EAC0B;IACpC,MAAMC,eAAeN,oBAAoB;QACvCI;QACAC;QACAE,oBAAoB,CAACC,GAAGC,iBAAiBC;YACvC,MAAMC,MAAMH,EAAEG;YAEd,MAAMC,sBACJF,sBACCD,CAAAA,gBAAgBI,WAAWH,mBAAmBG,UAAUJ,gBAAgBK,QAAQJ,mBAAmBI,GAAE;gBACxFJ;YAAhB,MAAMK,UAAUL,CAAAA,0BAAAA,+BAAAA,gCAAAA,KAAAA,IAAAA,mBAAoBI,iBAApBJ,qCAAAA,0BAA2BD,gBAAgBK;YAE3D,IAAIH,QAAQ,eAAeC,qBAAqB;gBAC9C,qEAAqE;gBACrE,+CAA+C;gBAC/C,IAAIG,UAAU,IAAIb,aAAac,QAAQC,cAAcF,UAAU,IAAIb,aAAac,QAAQE,UAAU;wBAChGf;oBAAAA,CAAAA,wBAAAA,aAAaa,qBAAbb,mCAAAA,KAAAA,IAAAA,sBAAsBgB,cAAc;wBAClCC,OAAOL,UAAU;wBACjBM,OAAO;oBACT;gBACF;YACF,OAAO,IAAIV,QAAQ,aAAaC,qBAAqB;gB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ACT;IACF;IAEA,OAAOJ;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/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 './Table';\nexport { getTableCellLayout } from './model/table-model';\nexport type { TableColumnConfig, TableProps, TableDensity } from './model/table-model';\n"],"names":["getTableCellLayout"],"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,SAAS,CAAC;AACxB,SAASA,kBAAkB,QAAQ,qBAAqB,CAAC"}
1
+ {"version":3,"sources":["../../src/Table/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 './Table';\nexport { getTableCellLayout } from './model/table-model';\nexport type { TableColumnConfig, TableProps, TableDensity } from './model/table-model';\n"],"names":["getTableCellLayout"],"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;AACxB,SAASA,kBAAkB,QAAQ,sBAAsB"}
@@ -36,17 +36,17 @@ function calculateTableCellHeight(lineHeight, paddingY) {
36
36
  };
37
37
  }
38
38
  // standard density
39
- const paddingY1 = theme.spacing(1);
40
- const basePaddingX1 = theme.spacing(1.25);
41
- const edgePaddingX1 = theme.spacing(2);
42
- const paddingLeft1 = isFirstColumn ? edgePaddingX1 : basePaddingX1;
43
- const paddingRight1 = isLastColumn ? edgePaddingX1 : basePaddingX1;
44
- const lineHeight1 = theme.typography.body1.lineHeight;
39
+ const paddingY = theme.spacing(1);
40
+ const basePaddingX = theme.spacing(1.25);
41
+ const edgePaddingX = theme.spacing(2);
42
+ const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
43
+ const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
44
+ const lineHeight = theme.typography.body1.lineHeight;
45
45
  return {
46
- padding: `${paddingY1} ${paddingRight1} ${paddingY1} ${paddingLeft1}`,
47
- height: calculateTableCellHeight(lineHeight1, paddingY1),
46
+ padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,
47
+ height: calculateTableCellHeight(lineHeight, paddingY),
48
48
  fontSize: theme.typography.body1.fontSize,
49
- lineHeight: lineHeight1
49
+ lineHeight: lineHeight
50
50
  };
51
51
  }
52
52
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/Table/model/table-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport {\n AccessorKeyColumnDef,\n CellContext,\n ColumnDef,\n CoreOptions,\n RowData,\n RowSelectionState,\n SortingState,\n} from '@tanstack/react-table';\nimport { CSSProperties } from 'react';\n\nexport type TableDensity = 'compact' | 'standard';\nexport type SortDirection = 'asc' | 'desc' | undefined;\n\nexport type TableRowEventOpts = {\n /**\n * Unique identifier for the row.\n */\n id: string;\n\n /**\n * Index of the row in the original data.\n */\n index: number;\n};\n\nexport interface TableProps<TableData> {\n /**\n * Height of the table.\n */\n height: number;\n\n /**\n * Width of the table.\n */\n width: number;\n\n /**\n * Array of data to render in the table. Each entry in the array will be\n * rendered as a row in the table.\n */\n data: TableData[];\n\n /**\n * Array of column configuration for the table. Each entry in the array will\n * be rendered as a column header and impact the rendering of cells within\n * table rows.\n */\n columns: Array<TableColumnConfig<TableData>>;\n\n /**\n * The density of the table layout. This impacts the size and space taken up\n * by content in the table (e.g. font size, padding).\n */\n density?: TableDensity;\n\n /**\n * When `true`, the first column of the table will include checkboxes.\n */\n checkboxSelection?: boolean;\n\n /**\n * Determines the behavior of row selection.\n *\n * - `standard`: clicking a checkbox will toggle that rows's selected/unselected\n * state and will not impact other rows.\n * - `legend`: clicking a checkbox will \"focus\" that row by selecting it and\n * unselecting other rows. Clicking a checkbox with a modifier key pressed,\n * will change this behavior to behave like `standard`.\n *\n * @default 'standard'\n */\n rowSelectionVariant?: 'standard' | 'legend';\n\n /**\n * State of selected rows in the table when `checkboxSelection` is enabled.\n *\n * Selected row state is a controlled value that should be managed using a\n * combination of this prop and `onRowSelectionChange`.\n */\n rowSelection?: RowSelectionState;\n\n /**\n * Callback fired when the mouse is moved over a table row.\n */\n onRowMouseOver?: (e: React.MouseEvent, opts: TableRowEventOpts) => void;\n\n /**\n * Callback fired when the mouse is moved out of a table row.\n */\n onRowMouseOut?: (e: React.MouseEvent, opts: TableRowEventOpts) => void;\n\n /**\n * State of the column sorting in the table.\n *\n * The column sorting is a controlled value that should be managed using a\n * combination fo this prop and `onSortingChange`.\n */\n sorting?: SortingState;\n\n /**\n * Callback fired when the selected rows in the table changes.\n */\n onRowSelectionChange?: (rowSelection: RowSelectionState) => void;\n\n /**\n * Callback fired when the table sorting changes.\n */\n onSortingChange?: (sorting: SortingState) => void;\n\n /**\n * Function used to determine the unique identifier used for each row. This\n * value is used to key `rowSelection`. If this value is not set, the index\n * is used as the unique identifier.\n */\n getRowId?: CoreOptions<TableData>['getRowId'];\n\n /**\n * Function used to determine the color of the checkbox when `checkboxSelection`\n * is enabled. If not set, a default color is used.\n */\n getCheckboxColor?: (rowData: TableData) => string;\n}\n\nfunction calculateTableCellHeight(lineHeight: CSSProperties['lineHeight'], paddingY: string): number {\n // Doing a bunch of math to enforce height to avoid weirdness with mismatched\n // heights based on customization of cell contents.\n const lineHeightNum = typeof lineHeight === 'string' ? parseInt(lineHeight, 10) : lineHeight ?? 0;\n const verticalPaddingNum = typeof paddingY === 'string' ? parseInt(paddingY, 10) : paddingY;\n\n return lineHeightNum + verticalPaddingNum * 2;\n}\n\ntype TableCellLayout = NonNullable<Pick<React.CSSProperties, 'padding' | 'fontSize' | 'lineHeight'>> & {\n height: number;\n};\n\ntype GetTableCellLayoutOpts = {\n isLastColumn?: boolean;\n isFirstColumn?: boolean;\n};\n\n/**\n * Returns the properties to lay out the content of table cells based on the\n * theme and density.\n */\nexport function getTableCellLayout(\n theme: Theme,\n density: TableDensity,\n { isLastColumn, isFirstColumn }: GetTableCellLayoutOpts = {}\n): TableCellLayout {\n if (density === 'compact') {\n const paddingY = theme.spacing(0.5);\n\n const basePaddingX = theme.spacing(0.5);\n const edgePaddingX = theme.spacing(1);\n const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n\n const lineHeight = theme.typography.body2.lineHeight;\n\n return {\n padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,\n height: calculateTableCellHeight(lineHeight, paddingY),\n fontSize: theme.typography.body2.fontSize,\n lineHeight: lineHeight,\n };\n }\n\n // standard density\n const paddingY = theme.spacing(1);\n const basePaddingX = theme.spacing(1.25);\n const edgePaddingX = theme.spacing(2);\n const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n const lineHeight = theme.typography.body1.lineHeight;\n\n return {\n padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,\n height: calculateTableCellHeight(lineHeight, paddingY),\n fontSize: theme.typography.body1.fontSize,\n lineHeight: lineHeight,\n };\n}\n\nexport type TableCellAlignment = 'left' | 'right' | 'center';\n\n// Overrides of meta value, so it can have a meaningful type in our code instead\n// of `any`. Putting this in the model instead of a separate .d.ts file because\n// I couldn't get it to work properly that way and punted on figuring it out\n// after trying several things.\ndeclare module '@tanstack/table-core' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnConfig<TData>['align'];\n headerDescription?: TableColumnConfig<TData>['headerDescription'];\n cellDescription?: TableColumnConfig<TData>['cellDescription'];\n }\n}\n\n// Only exposing a very simplified version of the very extensive column definitions\n// possible with tanstack table to make it easier for us to control rendering\n// and functionality.\nexport interface TableColumnConfig<TableData>\n // Any needed to work around some typing issues with tanstack query.\n // https://github.com/TanStack/table/issues/4241\n // TODO: revisit issue thread and see if there are any workarounds we can\n // use.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n extends Pick<AccessorKeyColumnDef<TableData, any>, 'accessorKey' | 'cell' | 'sortingFn'> {\n /**\n * Text to display in the header for the column.\n */\n header: string;\n\n /**\n * Alignment of the content in the cell.\n */\n align?: TableCellAlignment;\n\n /**\n * Text to display when hovering over a cell. This can be useful for\n * providing additional information about the column when the content is\n * ellipsized to fit in the space.\n *\n * If set to `true`, it will use the value generated by the `cell` prop if it\n * can be treated as a string.\n */\n // `any` needed for same reason as no-explicit-any higher up in this type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n cellDescription?: ((props: CellContext<TableData, any>) => string) | boolean | undefined;\n\n /**\n * When `true`, the column will be sortable.\n * @default false\n */\n enableSorting?: boolean;\n\n /**\n * Text to display when hovering over the header text. This can be useful for\n * providing additional information about the column when you want to keep the\n * header text relatively short to manage the column width.\n */\n headerDescription?: string;\n\n // Tanstack Table does not support an \"auto\" value to naturally size to fit\n // the space in a table. Adding a custom setting to manage this ourselves.\n /**\n * Width of the column when rendered in a table. It should be a number in pixels\n * or \"auto\" to allow the table to automatically adjust the width to fill\n * space.\n * @default 'auto'\n */\n width?: number | 'auto';\n}\n\n/**\n * Takes in a perses table column and transforms it into a tanstack column.\n */\nexport function persesColumnsToTanstackColumns<TableData>(columns: Array<TableColumnConfig<TableData>>) {\n const tableCols: Array<ColumnDef<TableData>> = columns.map(\n ({ width, align, headerDescription, cellDescription, enableSorting, ...otherProps }) => {\n // Tanstack Table does not support an \"auto\" value to naturally size to fit\n // the space in a table. We translate our custom \"auto\" setting to 0 size\n // for these columns, so it is easy to fall back to auto when rendering.\n // Taking from a recommendation in this github discussion:\n // https://github.com/TanStack/table/discussions/4179#discussioncomment-3631326\n const sizeProps =\n width === 'auto' || width === undefined\n ? {\n // All zero values are used as shorthand for \"auto\" when rendering\n // because it makes it easy to fall back. (e.g. `row.size || \"auto\"`)\n size: 0,\n minSize: 0,\n maxSize: 0,\n }\n : {\n size: width,\n };\n\n const result = {\n ...otherProps,\n ...sizeProps,\n\n // Default sorting to false, so it is very explicitly set per column.\n enableSorting: !!enableSorting,\n\n // Open-ended store for extra metadata in TanStack Table, so you can bake\n // in your own features.\n meta: {\n align,\n headerDescription,\n cellDescription,\n },\n };\n\n return result;\n }\n );\n\n return tableCols;\n}\n"],"names":["calculateTableCellHeight","lineHeight","paddingY","lineHeightNum","parseInt","verticalPaddingNum","getTableCellLayout","theme","density","isLastColumn","isFirstColumn","spacing","basePaddingX","edgePaddingX","paddingLeft","paddingRight","typography","body2","padding","height","fontSize","body1","persesColumnsToTanstackColumns","columns","tableCols","map","width","align","headerDescription","cellDescription","enableSorting","otherProps","sizeProps","undefined","size","minSize","maxSize","result","meta"],"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;AA+HjC,SAASA,wBAAwB,CAACC,UAAuC,EAAEC,QAAgB,EAAU;IACnG,6EAA6E;IAC7E,mDAAmD;IACnD,MAAMC,aAAa,GAAG,OAAOF,UAAU,KAAK,QAAQ,GAAGG,QAAQ,CAACH,UAAU,EAAE,EAAE,CAAC,GAAGA,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,CAAC,AAAC;IAClG,MAAMI,kBAAkB,GAAG,OAAOH,QAAQ,KAAK,QAAQ,GAAGE,QAAQ,CAACF,QAAQ,EAAE,EAAE,CAAC,GAAGA,QAAQ,AAAC;IAE5F,OAAOC,aAAa,GAAGE,kBAAkB,GAAG,CAAC,CAAC;AAChD,CAAC;AAWD;;;CAGC,GACD,OAAO,SAASC,kBAAkB,CAChCC,KAAY,EACZC,OAAqB,EACrB,EAAEC,YAAY,CAAA,EAAEC,aAAa,CAAA,EAA0B,GAAG,EAAE,EAC3C;IACjB,IAAIF,OAAO,KAAK,SAAS,EAAE;QACzB,MAAMN,QAAQ,GAAGK,KAAK,CAACI,OAAO,CAAC,GAAG,CAAC,AAAC;QAEpC,MAAMC,YAAY,GAAGL,KAAK,CAACI,OAAO,CAAC,GAAG,CAAC,AAAC;QACxC,MAAME,YAAY,GAAGN,KAAK,CAACI,OAAO,CAAC,CAAC,CAAC,AAAC;QACtC,MAAMG,WAAW,GAAGJ,aAAa,GAAGG,YAAY,GAAGD,YAAY,AAAC;QAChE,MAAMG,YAAY,GAAGN,YAAY,GAAGI,YAAY,GAAGD,YAAY,AAAC;QAEhE,MAAMX,UAAU,GAAG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D,CAAC,EAAEC,KAAK,CAAA,EAAEC,KAAK,CAAA,EAAEC,iBAAiB,CAAA,EAAEC,eAAe,CAAA,EAAEC,aAAa,CAAA,EAAE,GAAGC,UAAU,EAAE,GAAK;QACtF,2EAA2E;QAC3E,yEAAyE;QACzE,wEAAwE;QACxE,0DAA0D;QAC1D,+EAA+E;QAC/E,MAAMC,SAAS,GACbN,KAAK,KAAK,MAAM,IAAIA,KAAK,KAAKO,SAAS,GACnC;YACE,kEAAkE;YAClE,qEAAqE;YACrEC,IAAI,EAAE,CAAC;YACPC,OAAO,EAAE,CAAC;YACVC,OAAO,EAAE,CAAC;SACX,GACD;YACEF,IAAI,EAAER,KAAK;SACZ,AAAC;QAER,MAAMW,MAAM,GAAG;YACb,GAAGN,UAAU;YACb,GAAGC,SAAS;YAEZ,qEAAqE;YACrEF,aAAa,EAAE,CAAC,CAACA,aAAa;YAE9B,yEAAyE;YACzE,wBAAwB;YACxBQ,IAAI,EAAE;gBACJX,KAAK;gBACLC,iBAAiB;gBACjBC,eAAe;aAChB;SACF,AAAC;QAEF,OAAOQ,MAAM,CAAC;IAChB,CAAC,CACF,AAAC;IAEF,OAAOb,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"sources":["../../../src/Table/model/table-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport {\n AccessorKeyColumnDef,\n CellContext,\n ColumnDef,\n CoreOptions,\n RowData,\n RowSelectionState,\n SortingState,\n} from '@tanstack/react-table';\nimport { CSSProperties } from 'react';\n\nexport type TableDensity = 'compact' | 'standard';\nexport type SortDirection = 'asc' | 'desc' | undefined;\n\nexport type TableRowEventOpts = {\n /**\n * Unique identifier for the row.\n */\n id: string;\n\n /**\n * Index of the row in the original data.\n */\n index: number;\n};\n\nexport interface TableProps<TableData> {\n /**\n * Height of the table.\n */\n height: number;\n\n /**\n * Width of the table.\n */\n width: number;\n\n /**\n * Array of data to render in the table. Each entry in the array will be\n * rendered as a row in the table.\n */\n data: TableData[];\n\n /**\n * Array of column configuration for the table. Each entry in the array will\n * be rendered as a column header and impact the rendering of cells within\n * table rows.\n */\n columns: Array<TableColumnConfig<TableData>>;\n\n /**\n * The density of the table layout. This impacts the size and space taken up\n * by content in the table (e.g. font size, padding).\n */\n density?: TableDensity;\n\n /**\n * When `true`, the first column of the table will include checkboxes.\n */\n checkboxSelection?: boolean;\n\n /**\n * Determines the behavior of row selection.\n *\n * - `standard`: clicking a checkbox will toggle that rows's selected/unselected\n * state and will not impact other rows.\n * - `legend`: clicking a checkbox will \"focus\" that row by selecting it and\n * unselecting other rows. Clicking a checkbox with a modifier key pressed,\n * will change this behavior to behave like `standard`.\n *\n * @default 'standard'\n */\n rowSelectionVariant?: 'standard' | 'legend';\n\n /**\n * State of selected rows in the table when `checkboxSelection` is enabled.\n *\n * Selected row state is a controlled value that should be managed using a\n * combination of this prop and `onRowSelectionChange`.\n */\n rowSelection?: RowSelectionState;\n\n /**\n * Callback fired when the mouse is moved over a table row.\n */\n onRowMouseOver?: (e: React.MouseEvent, opts: TableRowEventOpts) => void;\n\n /**\n * Callback fired when the mouse is moved out of a table row.\n */\n onRowMouseOut?: (e: React.MouseEvent, opts: TableRowEventOpts) => void;\n\n /**\n * State of the column sorting in the table.\n *\n * The column sorting is a controlled value that should be managed using a\n * combination fo this prop and `onSortingChange`.\n */\n sorting?: SortingState;\n\n /**\n * Callback fired when the selected rows in the table changes.\n */\n onRowSelectionChange?: (rowSelection: RowSelectionState) => void;\n\n /**\n * Callback fired when the table sorting changes.\n */\n onSortingChange?: (sorting: SortingState) => void;\n\n /**\n * Function used to determine the unique identifier used for each row. This\n * value is used to key `rowSelection`. If this value is not set, the index\n * is used as the unique identifier.\n */\n getRowId?: CoreOptions<TableData>['getRowId'];\n\n /**\n * Function used to determine the color of the checkbox when `checkboxSelection`\n * is enabled. If not set, a default color is used.\n */\n getCheckboxColor?: (rowData: TableData) => string;\n}\n\nfunction calculateTableCellHeight(lineHeight: CSSProperties['lineHeight'], paddingY: string): number {\n // Doing a bunch of math to enforce height to avoid weirdness with mismatched\n // heights based on customization of cell contents.\n const lineHeightNum = typeof lineHeight === 'string' ? parseInt(lineHeight, 10) : lineHeight ?? 0;\n const verticalPaddingNum = typeof paddingY === 'string' ? parseInt(paddingY, 10) : paddingY;\n\n return lineHeightNum + verticalPaddingNum * 2;\n}\n\ntype TableCellLayout = NonNullable<Pick<React.CSSProperties, 'padding' | 'fontSize' | 'lineHeight'>> & {\n height: number;\n};\n\ntype GetTableCellLayoutOpts = {\n isLastColumn?: boolean;\n isFirstColumn?: boolean;\n};\n\n/**\n * Returns the properties to lay out the content of table cells based on the\n * theme and density.\n */\nexport function getTableCellLayout(\n theme: Theme,\n density: TableDensity,\n { isLastColumn, isFirstColumn }: GetTableCellLayoutOpts = {}\n): TableCellLayout {\n if (density === 'compact') {\n const paddingY = theme.spacing(0.5);\n\n const basePaddingX = theme.spacing(0.5);\n const edgePaddingX = theme.spacing(1);\n const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n\n const lineHeight = theme.typography.body2.lineHeight;\n\n return {\n padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,\n height: calculateTableCellHeight(lineHeight, paddingY),\n fontSize: theme.typography.body2.fontSize,\n lineHeight: lineHeight,\n };\n }\n\n // standard density\n const paddingY = theme.spacing(1);\n const basePaddingX = theme.spacing(1.25);\n const edgePaddingX = theme.spacing(2);\n const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n const lineHeight = theme.typography.body1.lineHeight;\n\n return {\n padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,\n height: calculateTableCellHeight(lineHeight, paddingY),\n fontSize: theme.typography.body1.fontSize,\n lineHeight: lineHeight,\n };\n}\n\nexport type TableCellAlignment = 'left' | 'right' | 'center';\n\n// Overrides of meta value, so it can have a meaningful type in our code instead\n// of `any`. Putting this in the model instead of a separate .d.ts file because\n// I couldn't get it to work properly that way and punted on figuring it out\n// after trying several things.\ndeclare module '@tanstack/table-core' {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: TableColumnConfig<TData>['align'];\n headerDescription?: TableColumnConfig<TData>['headerDescription'];\n cellDescription?: TableColumnConfig<TData>['cellDescription'];\n }\n}\n\n// Only exposing a very simplified version of the very extensive column definitions\n// possible with tanstack table to make it easier for us to control rendering\n// and functionality.\nexport interface TableColumnConfig<TableData>\n // Any needed to work around some typing issues with tanstack query.\n // https://github.com/TanStack/table/issues/4241\n // TODO: revisit issue thread and see if there are any workarounds we can\n // use.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n extends Pick<AccessorKeyColumnDef<TableData, any>, 'accessorKey' | 'cell' | 'sortingFn'> {\n /**\n * Text to display in the header for the column.\n */\n header: string;\n\n /**\n * Alignment of the content in the cell.\n */\n align?: TableCellAlignment;\n\n /**\n * Text to display when hovering over a cell. This can be useful for\n * providing additional information about the column when the content is\n * ellipsized to fit in the space.\n *\n * If set to `true`, it will use the value generated by the `cell` prop if it\n * can be treated as a string.\n */\n // `any` needed for same reason as no-explicit-any higher up in this type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n cellDescription?: ((props: CellContext<TableData, any>) => string) | boolean | undefined;\n\n /**\n * When `true`, the column will be sortable.\n * @default false\n */\n enableSorting?: boolean;\n\n /**\n * Text to display when hovering over the header text. This can be useful for\n * providing additional information about the column when you want to keep the\n * header text relatively short to manage the column width.\n */\n headerDescription?: string;\n\n // Tanstack Table does not support an \"auto\" value to naturally size to fit\n // the space in a table. Adding a custom setting to manage this ourselves.\n /**\n * Width of the column when rendered in a table. It should be a number in pixels\n * or \"auto\" to allow the table to automatically adjust the width to fill\n * space.\n * @default 'auto'\n */\n width?: number | 'auto';\n}\n\n/**\n * Takes in a perses table column and transforms it into a tanstack column.\n */\nexport function persesColumnsToTanstackColumns<TableData>(columns: Array<TableColumnConfig<TableData>>) {\n const tableCols: Array<ColumnDef<TableData>> = columns.map(\n ({ width, align, headerDescription, cellDescription, enableSorting, ...otherProps }) => {\n // Tanstack Table does not support an \"auto\" value to naturally size to fit\n // the space in a table. We translate our custom \"auto\" setting to 0 size\n // for these columns, so it is easy to fall back to auto when rendering.\n // Taking from a recommendation in this github discussion:\n // https://github.com/TanStack/table/discussions/4179#discussioncomment-3631326\n const sizeProps =\n width === 'auto' || width === undefined\n ? {\n // All zero values are used as shorthand for \"auto\" when rendering\n // because it makes it easy to fall back. (e.g. `row.size || \"auto\"`)\n size: 0,\n minSize: 0,\n maxSize: 0,\n }\n : {\n size: width,\n };\n\n const result = {\n ...otherProps,\n ...sizeProps,\n\n // Default sorting to false, so it is very explicitly set per column.\n enableSorting: !!enableSorting,\n\n // Open-ended store for extra metadata in TanStack Table, so you can bake\n // in your own features.\n meta: {\n align,\n headerDescription,\n cellDescription,\n },\n };\n\n return result;\n }\n );\n\n return tableCols;\n}\n"],"names":["calculateTableCellHeight","lineHeight","paddingY","lineHeightNum","parseInt","verticalPaddingNum","getTableCellLayout","theme","density","isLastColumn","isFirstColumn","spacing","basePaddingX","edgePaddingX","paddingLeft","paddingRight","typography","body2","padding","height","fontSize","body1","persesColumnsToTanstackColumns","columns","tableCols","map","width","align","headerDescription","cellDescription","enableSorting","otherProps","sizeProps","undefined","size","minSize","maxSize","result","meta"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EA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AAa,CAAC,EAAEb,SAAS,CAAC,EAAEY,YAAY,CAAC;QACjEK,QAAQnB,yBAAyBC,YAAYC;QAC7CkB,UAAUb,MAAMS,WAAWK,MAAMD;QACjCnB,YAAYA;IACd;AACF;AAyEA;;CAEC,GACD,OAAO,SAASqB,+BAA0CC,OAA4C;IACpG,MAAMC,YAAyCD,QAAQE,IACrD,CAAC,EAAEC,MAAK,EAAEC,MAAK,EAAEC,kBAAiB,EAAEC,gBAAe,EAAEC,cAAa,EAAE,GAAGC,YAAY;QACjF,2EAA2E;QAC3E,yEAAyE;QACzE,wEAAwE;QACxE,0DAA0D;QAC1D,+EAA+E;QAC/E,MAAMC,YACJN,UAAU,UAAUA,UAAUO,YAC1B;YACE,kEAAkE;YAClE,qEAAqE;YACrEC,MAAM;YACNC,SAAS;YACTC,SAAS;QACX,IACA;YACEF,MAAMR;QACR;QAEN,MAAMW,SAAS;YACb,GAAGN,UAAU;YACb,GAAGC,SAAS;YAEZ,qEAAqE;YACrEF,eAAe,CAAC,CAACA;YAEjB,yEAAyE;YACzE,wBAAwB;YACxBQ,MAAM;gBACJX;gBACAC;gBACAC;YACF;QACF;QAEA,OAAOQ;IACT;IAGF,OAAOb;AACT"}
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
14
14
  import React from 'react';
15
15
  import { styled, IconButton, Popover } from '@mui/material';
16
16
  import CircleIcon from 'mdi-material-ui/Circle';
17
- import { useChartsTheme } from '../context/ChartsThemeProvider';
17
+ import { useChartsTheme } from '../context/ChartsProvider';
18
18
  import { ColorPicker } from '../ColorPicker';
19
19
  export function ThresholdColorPicker({ color , onColorChange , label }) {
20
20
  const [anchorEl, setAnchorEl] = React.useState(null);
@@ -25,7 +25,7 @@ export function ThresholdColorPicker({ color , onColorChange , label }) {
25
25
  const closeColorPicker = ()=>{
26
26
  setAnchorEl(null);
27
27
  };
28
- const { thresholds: { defaultColor , palette } , } = useChartsTheme();
28
+ const { thresholds: { defaultColor , palette } } = useChartsTheme();
29
29
  return /*#__PURE__*/ _jsxs(_Fragment, {
30
30
  children: [
31
31
  /*#__PURE__*/ _jsx(ColorIconButton, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ThresholdsEditor/ThresholdColorPicker.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 from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context/ChartsThemeProvider';\nimport { ColorPicker } from '../ColorPicker';\nimport { ThresholdInputProps } from './ThresholdInput';\n\nexport function ThresholdColorPicker({\n color,\n onColorChange,\n label,\n}: Pick<ThresholdInputProps, 'color' | 'onColorChange' | 'label'>) {\n const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = () => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size=\"small\"\n aria-label={`change threshold ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"threshold color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n PaperProps={{ sx: { padding: (theme) => theme.spacing(2) } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} onChange={onColorChange} palette={[defaultColor, ...palette]} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["React","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","ThresholdColorPicker","color","onColorChange","label","anchorEl","setAnchorEl","useState","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","size","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","PaperProps","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,MAAM,OAAO,CAAC;AAC1B,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,QAAQ,eAAe,CAAC;AAC5D,OAAOC,UAAU,MAAM,wBAAwB,CAAC;AAChD,SAASC,cAAc,QAAQ,gCAAgC,CAAC;AAChE,SAASC,WAAW,QAAQ,gBAAgB,CAAC;AAG7C,OAAO,SAASC,oBAAoB,CAAC,EACnCC,KAAK,CAAA,EACLC,aAAa,CAAA,EACbC,KAAK,CAAA,EAC0D,EAAE;IACjE,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGZ,KAAK,CAACa,QAAQ,CAA2B,IAAI,CAAC,AAAC;IAC/E,MAAMC,MAAM,GAAGC,OAAO,C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C,UAAU,EAAE;IACzCwC,iBAAiB,EAAE,CAACC,KAAK,GAAKA,KAAK,KAAK,YAAY,IAAIA,KAAK,KAAK,WAAW;CAC9E,CAAC,CAGC,CAAC,EAAEhB,SAAS,CAAA,EAAED,UAAU,CAAA,EAAE,GAAM,CAAA;QACjCkB,eAAe,EAAElB,UAAU,IAAIC,SAAS,GAAG,CAAC,EAAEA,SAAS,CAAC,EAAE,CAAC,GAAG,WAAW;QACzEnB,KAAK,EAAEmB,SAAS;KACjB,CAAA,AAAC,CAAC,AAAC"}
1
+ {"version":3,"sources":["../../src/ThresholdsEditor/ThresholdColorPicker.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 from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { ColorPicker } from '../ColorPicker';\nimport { ThresholdInputProps } from './ThresholdInput';\n\nexport function ThresholdColorPicker({\n color,\n onColorChange,\n label,\n}: Pick<ThresholdInputProps, 'color' | 'onColorChange' | 'label'>) {\n const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = () => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size=\"small\"\n aria-label={`change threshold ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"threshold color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n PaperProps={{ sx: { padding: (theme) => theme.spacing(2) } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} onChange={onColorChange} palette={[defaultColor, ...palette]} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["React","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","ThresholdColorPicker","color","onColorChange","label","anchorEl","setAnchorEl","useState","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","size","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","PaperProps","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AAC5D,OAAOC,gBAAgB,yBAAyB;AAChD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,WAAW,QAAQ,iBAAiB;AAG7C,OAAO,SAASC,qBAAqB,EACnCC,MAAK,EACLC,cAAa,EACbC,MAAK,EAC0D;IAC/D,MAAM,CAACC,UAAUC,YAAY,GAAGZ,MAAMa,SAAmC;IACzE,MAAMC,SAASC,QAAQJ;IAEvB,MAAMK,kBAAkB,CAACC;QACvBL,YAAYK,MAAMC;IACpB;IAEA,MAAMC,mBAAmB;QACvBP,YAAY;IACd;IAEA,MAAM,EACJQ,YAAY,EAAEC,aAAY,EAAEC,QAAO,EAAE,CAAA,EACtC,GAAGjB;IAEJ,qBACE;;0BACE,KAACkB;gBACCC,MAAK;gBACLC,cAAY,CAAC,iBAAiB,EAAEf,MAAM,MAAM,CAAC;gBAC7CgB,YAAYZ;gBACZa,WAAWnB;gBACXoB,SAASZ;0BAET,cAAA,KAACZ;;0BAEH,KAACD;gBACC0B,eAAY;gBACZC,MAAMhB;gBACNH,UAAUA;gBACVoB,SAASZ;gBACTa,YAAY;oBAAEC,IAAI;wBAAEC,SAAS,CAACC,QAAUA,MAAMC,QAAQ;oBAAG;gBAAE;gBAC3DC,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;gBACAC,iBAAiB;oBACfF,UAAU;oBACVC,YAAY;gBACd;0BAEA,cAAA,KAACjC;oBAAYE,OAAOA;oBAAOiC,UAAUhC;oBAAea,SAAS;wBAACD;2BAAiBC;qBAAQ;;;;;AAI/F;AAEA,MAAMC,kBAAkBtB,OAAOC,YAAY;IACzCwC,mBAAmB,CAACC,QAAUA,UAAU,gBAAgBA,UAAU;AACpE,GAGG,CAAC,EAAEhB,UAAS,EAAED,WAAU,EAAE,GAAM,CAAA;QACjCkB,iBAAiBlB,cAAcC,YAAY,CAAC,EAAEA,UAAU,EAAE,CAAC,GAAG;QAC9DnB,OAAOmB;IACT,CAAA"}
@@ -48,7 +48,7 @@ export function ThresholdInput({ inputRef , label , color , value , mode , onCha
48
48
  }
49
49
  },
50
50
  InputProps: {
51
- endAdornment: mode === 'Percent' ? /*#__PURE__*/ _jsx(Box, {
51
+ endAdornment: mode === 'percent' ? /*#__PURE__*/ _jsx(Box, {
52
52
  paddingX: 1,
53
53
  children: "%"
54
54
  }) : undefined
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ThresholdsEditor/ThresholdInput.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 { RefObject, useState } from 'react';\nimport { Stack, FormLabel, TextField, IconButton, Box } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { ThresholdOptions } from '@perses-dev/core';\nimport { ThresholdColorPicker } from './ThresholdColorPicker';\n\nexport interface ThresholdInputProps {\n label: string;\n color: string;\n value: number;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onColorChange: (color: string) => void;\n onBlur: () => void;\n onDelete: () => void;\n inputRef?: RefObject<HTMLInputElement | null>;\n mode?: ThresholdOptions['mode'];\n}\n\nexport function ThresholdInput({\n inputRef,\n label,\n color,\n value,\n mode,\n onChange,\n onColorChange,\n onBlur,\n onDelete,\n}: ThresholdInputProps) {\n const [key, setKey] = useState(0); // use key to cause input to lose focus when pressing enter\n return (\n <Stack flex={1} direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" spacing={1}>\n <ThresholdColorPicker label={label} color={color} onColorChange={onColorChange} />\n <FormLabel htmlFor={label}>{label}</FormLabel>\n <TextField\n id={label}\n key={key}\n inputRef={inputRef}\n type=\"number\"\n value={value === 0 ? '' : value}\n placeholder=\"0\"\n onChange={onChange}\n onBlur={onBlur}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onBlur();\n setKey(key + 1);\n }\n }}\n InputProps={{\n endAdornment: mode === 'Percent' ? <Box paddingX={1}>%</Box> : undefined,\n }}\n />\n <IconButton aria-label={`delete threshold ${label}`} size=\"small\" onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Stack>\n );\n}\n"],"names":["useState","Stack","FormLabel","TextField","IconButton","Box","DeleteIcon","ThresholdColorPicker","ThresholdInput","inputRef","label","color","value","mode","onChange","onColorChange","onBlur","onDelete","key","setKey","flex","direction","alignItems","justifyContent","spacing","htmlFor","id","type","placeholder","onKeyDown","e","InputProps","endAdornment","paddingX","undefined","aria-label","size","onClick"],"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,SAAoBA,QAAQ,QAAQ,OAAO,CAAC;AAC5C,SAASC,KAAK,EAAEC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,GAAG,QAAQ,eAAe,CAAC;AAC7E,OAAOC,UAAU,MAAM,+BAA+B,CAAC;AAEvD,SAASC,oBAAoB,QAAQ,wBAAwB,CAAC;AAc9D,OAAO,SAASC,cAAc,CAAC,EAC7BC,QAAQ,CAAA,EACRC,KAAK,CAAA,EACLC,KAAK,CAAA,EACLC,KAAK,CAAA,EACLC,IAAI,CAAA,EACJC,QAAQ,CAAA,EACRC,aAAa,CAAA,EACbC,MAAM,CAAA,EACNC,QAAQ,CAAA,EACY,EAAE;IACtB,MAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAGnB,QAAQ,CAAC,CAAC,CAAC,AAAC,EAAC,2DAA2D;IAC9F,qBACE,MAACC,KAAK;QAACmB,IAAI,EAAE,CAAC;QAAEC,SAAS,EAAC,KAAK;QAACC,UAAU,EAAC,QAAQ;QAACC,cAAc,EAAC,eAAe;QAACC,OAAO,EAAE,CAAC;;0BAC3F,KAACjB,oBAAoB;gBAACG,KAAK,EAAEA,KAAK;gBAAEC,KAAK,EAAEA,KAAK;gBAAEI,aAAa,EAAEA,aAAa;cAAI;0BAClF,KAACb,SAAS;gBAACuB,OAAO,EAAEf,KAAK;0BAAGA,KAAK;cAAa;0BAC9C,KAACP,SAAS;gBACRuB,EAAE,EAAEhB,KAAK;gBAETD,QAAQ,EAAEA,QAAQ;gBAClBkB,IAAI,EAAC,QAAQ;gBACbf,KAAK,EAAEA,KAAK,KAAK,CAAC,GAAG,EAAE,GAAGA,KAAK;gBAC/BgB,WAAW,EAAC,GAAG;gBACfd,QAAQ,EAAEA,QAAQ;gBAClBE,MAAM,EAAEA,MAAM;gBACda,SAAS,EAAE,CAACC,CAAC,GAAK;oBAChB,IAAIA,CAAC,CAACZ,GAAG,KAAK,OAAO,EAAE;wBACrBF,MAAM,EAAE,CAAC;wBACTG,MAAM,CAACD,GAAG,GAAG,CAAC,CAAC,CAAC;oBAClB,CAAC;gBACH,CAAC;gBACDa,UAAU,EAAE;oBACVC,YAAY,EAAEnB,IAAI,KAAK,SAAS,iBAAG,KAACR,GAAG;wBAAC4B,QAAQ,EAAE,CAAC;kCAAE,GAAC;sBAAM,GAAGC,SAAS;iBACzE;eAfIhB,GAAG,CAgBR;0BACF,KAACd,UAAU;gBAAC+B,YAAU,EAAE,CAAC,iBAAiB,EAAEzB,KAAK,CAAC,CAAC;gBAAE0B,IAAI,EAAC,OAAO;gBAACC,OAAO,EAAEpB,QAAQ;0BACjF,cAAA,KAACX,UAAU,KAAG;cACH;;MACP,CACR;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/ThresholdsEditor/ThresholdInput.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 { RefObject, useState } from 'react';\nimport { Stack, FormLabel, TextField, IconButton, Box } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { ThresholdOptions } from '@perses-dev/core';\nimport { ThresholdColorPicker } from './ThresholdColorPicker';\n\nexport interface ThresholdInputProps {\n label: string;\n color: string;\n value: number;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onColorChange: (color: string) => void;\n onBlur: () => void;\n onDelete: () => void;\n inputRef?: RefObject<HTMLInputElement | null>;\n mode?: ThresholdOptions['mode'];\n}\n\nexport function ThresholdInput({\n inputRef,\n label,\n color,\n value,\n mode,\n onChange,\n onColorChange,\n onBlur,\n onDelete,\n}: ThresholdInputProps) {\n const [key, setKey] = useState(0); // use key to cause input to lose focus when pressing enter\n return (\n <Stack flex={1} direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" spacing={1}>\n <ThresholdColorPicker label={label} color={color} onColorChange={onColorChange} />\n <FormLabel htmlFor={label}>{label}</FormLabel>\n <TextField\n id={label}\n key={key}\n inputRef={inputRef}\n type=\"number\"\n value={value === 0 ? '' : value}\n placeholder=\"0\"\n onChange={onChange}\n onBlur={onBlur}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onBlur();\n setKey(key + 1);\n }\n }}\n InputProps={{\n endAdornment: mode === 'percent' ? <Box paddingX={1}>%</Box> : undefined,\n }}\n />\n <IconButton aria-label={`delete threshold ${label}`} size=\"small\" onClick={onDelete}>\n <DeleteIcon />\n </IconButton>\n </Stack>\n );\n}\n"],"names":["useState","Stack","FormLabel","TextField","IconButton","Box","DeleteIcon","ThresholdColorPicker","ThresholdInput","inputRef","label","color","value","mode","onChange","onColorChange","onBlur","onDelete","key","setKey","flex","direction","alignItems","justifyContent","spacing","htmlFor","id","type","placeholder","onKeyDown","e","InputProps","endAdornment","paddingX","undefined","aria-label","size","onClick"],"mappings":"AAAA,oCAAoC;AACpC,k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holdsEditor.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/ThresholdsEditor.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,qBAAqB,eA+LhH"}
1
+ {"version":3,"file":"ThresholdsEditor.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/ThresholdsEditor.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,qBAAqB,eAgMhH"}
@@ -16,16 +16,17 @@ import produce from 'immer';
16
16
  import { IconButton, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
17
17
  import PlusIcon from 'mdi-material-ui/Plus';
18
18
  import { Stack } from '@mui/system';
19
- import { useChartsTheme } from '../context/ChartsThemeProvider';
19
+ import { useChartsTheme } from '../context/ChartsProvider';
20
20
  import { OptionsEditorControl, OptionsEditorGroup } from '../OptionsEditorLayout';
21
21
  import { InfoTooltip } from '../InfoTooltip';
22
22
  import { ThresholdColorPicker } from './ThresholdColorPicker';
23
23
  import { ThresholdInput } from './ThresholdInput';
24
24
  const DEFAULT_STEP = 10;
25
25
  export function ThresholdsEditor({ thresholds , onChange , hideDefault , disablePercentMode }) {
26
- const { thresholds: { defaultColor , palette } , } = useChartsTheme();
27
- var ref;
28
- const defaultThresholdColor = (ref = thresholds === null || thresholds === void 0 ? void 0 : thresholds.default_color) !== null && ref !== void 0 ? ref : defaultColor;
26
+ const chartsTheme = useChartsTheme();
27
+ const { thresholds: { defaultColor , palette } } = chartsTheme;
28
+ var _thresholds_defaultColor;
29
+ const defaultThresholdColor = (_thresholds_defaultColor = thresholds === null || thresholds === void 0 ? void 0 : thresholds.defaultColor) !== null && _thresholds_defaultColor !== void 0 ? _thresholds_defaultColor : defaultColor;
29
30
  const [steps, setSteps] = useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
30
31
  useEffect(()=>{
31
32
  setSteps(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
@@ -36,9 +37,9 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
36
37
  const recentlyAddedInputRef = useRef(null);
37
38
  const focusRef = useRef(false);
38
39
  useEffect(()=>{
39
- var ref;
40
+ var _recentlyAddedInputRef_current;
40
41
  if (!recentlyAddedInputRef.current || !focusRef.current) return;
41
- (ref = recentlyAddedInputRef.current) === null || ref === void 0 ? void 0 : ref.focus();
42
+ (_recentlyAddedInputRef_current = recentlyAddedInputRef.current) === null || _recentlyAddedInputRef_current === void 0 ? void 0 : _recentlyAddedInputRef_current.focus();
42
43
  focusRef.current = false;
43
44
  }, [
44
45
  steps === null || steps === void 0 ? void 0 : steps.length
@@ -66,11 +67,11 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
66
67
  const handleDefaultColorChange = (color)=>{
67
68
  if (thresholds !== undefined) {
68
69
  onChange(produce(thresholds, (draft)=>{
69
- draft.default_color = color;
70
+ draft.defaultColor = color;
70
71
  }));
71
72
  } else {
72
73
  onChange({
73
- default_color: color
74
+ defaultColor: color
74
75
  });
75
76
  }
76
77
  };
@@ -121,12 +122,12 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
121
122
  const steps = draft.steps;
122
123
  if (steps === null || steps === void 0 ? void 0 : steps.length) {
123
124
  const lastStep = steps[steps.length - 1];
124
- var _length;
125
- const color = (_length = palette[steps.length]) !== null && _length !== void 0 ? _length : getRandomColor(); // we will assign color from the palette first, then generate random color
126
- var ref;
125
+ var _palette_steps_length;
126
+ const color = (_palette_steps_length = palette[steps.length]) !== null && _palette_steps_length !== void 0 ? _palette_steps_length : getRandomColor(); // we will assign color from the palette first, then generate random color
127
+ var _lastStep_value;
127
128
  steps.push({
128
129
  color,
129
- value: ((ref = lastStep === null || lastStep === void 0 ? void 0 : lastStep.value) !== null && ref !== void 0 ? ref : 0) + DEFAULT_STEP
130
+ value: ((_lastStep_value = lastStep === null || lastStep === void 0 ? void 0 : lastStep.value) !== null && _lastStep_value !== void 0 ? _lastStep_value : 0) + DEFAULT_STEP
130
131
  }); // set new threshold value to last step value + 10
131
132
  } else if (steps) {
132
133
  steps.push({
@@ -137,7 +138,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
137
138
  }
138
139
  };
139
140
  const handleModeChange = (event, value)=>{
140
- const mode = value === 'Percent' ? 'Percent' : undefined;
141
+ const mode = value === 'percent' ? 'percent' : undefined;
141
142
  if (thresholds !== undefined) {
142
143
  onChange(produce(thresholds, (draft)=>{
143
144
  draft.mode = mode;
@@ -148,7 +149,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
148
149
  });
149
150
  }
150
151
  };
151
- var ref1, _color, ref2;
152
+ var _thresholds_mode, _step_color, _ref;
152
153
  return /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
153
154
  title: "Thresholds",
154
155
  icon: /*#__PURE__*/ _jsx(InfoTooltip, {
@@ -167,7 +168,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
167
168
  control: /*#__PURE__*/ _jsxs(ToggleButtonGroup, {
168
169
  exclusive: true,
169
170
  disabled: disablePercentMode,
170
- value: (ref1 = thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode) !== null && ref1 !== void 0 ? ref1 : 'Absolute',
171
+ value: (_thresholds_mode = thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode) !== null && _thresholds_mode !== void 0 ? _thresholds_mode : 'absolute',
171
172
  onChange: handleModeChange,
172
173
  sx: {
173
174
  height: '36px',
@@ -176,7 +177,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
176
177
  children: [
177
178
  /*#__PURE__*/ _jsx(ToggleButton, {
178
179
  "aria-label": "absolute",
179
- value: "Absolute",
180
+ value: "absolute",
180
181
  sx: {
181
182
  fontWeight: 500
182
183
  },
@@ -184,7 +185,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
184
185
  }),
185
186
  /*#__PURE__*/ _jsx(ToggleButton, {
186
187
  "aria-label": "percent",
187
- value: "Percent",
188
+ value: "percent",
188
189
  sx: {
189
190
  fontWeight: 500
190
191
  },
@@ -197,7 +198,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
197
198
  /*#__PURE__*/ return _jsx(ThresholdInput, {
198
199
  inputRef: i === steps.length - 1 ? recentlyAddedInputRef : undefined,
199
200
  label: `T${i + 1}`,
200
- color: (ref2 = (_color = step.color) !== null && _color !== void 0 ? _color : palette[i]) !== null && ref2 !== void 0 ? ref2 : defaultThresholdColor,
201
+ color: (_ref = (_step_color = step.color) !== null && _step_color !== void 0 ? _step_color : palette[i]) !== null && _ref !== void 0 ? _ref : defaultThresholdColor,
201
202
  value: step.value,
202
203
  mode: thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode,
203
204
  onColorChange: (color)=>handleThresholdColorChange(color, i),