@perses-dev/components 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-explorer-plugin-c4a7621

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (604) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +9 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +42 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/BarChart/BarChart.d.ts +2 -2
  10. package/dist/BarChart/BarChart.d.ts.map +1 -1
  11. package/dist/BarChart/BarChart.js +13 -8
  12. package/dist/BarChart/BarChart.js.map +1 -1
  13. package/dist/ColorPicker/ColorPicker.d.ts +3 -2
  14. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/ColorPicker.js +28 -13
  16. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  17. package/dist/ColorPicker/OptionsColorPicker.d.ts +9 -0
  18. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  19. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +18 -15
  20. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  21. package/dist/ColorPicker/index.d.ts +1 -0
  22. package/dist/ColorPicker/index.d.ts.map +1 -1
  23. package/dist/ColorPicker/index.js +1 -0
  24. package/dist/ColorPicker/index.js.map +1 -1
  25. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -2
  26. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  27. package/dist/ContentWithLegend/ContentWithLegend.js +10 -7
  28. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  29. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +2 -2
  30. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  31. package/dist/ContentWithLegend/model/content-with-legend-model.js +4 -5
  32. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  33. package/dist/DensitySelector/DensitySelector.d.ts +8 -0
  34. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  35. package/dist/DensitySelector/DensitySelector.js +46 -0
  36. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  37. package/dist/DensitySelector/index.d.ts +2 -0
  38. package/dist/DensitySelector/index.d.ts.map +1 -0
  39. package/dist/DensitySelector/index.js +15 -0
  40. package/dist/DensitySelector/index.js.map +1 -0
  41. package/dist/Dialog/Dialog.d.ts +10 -15
  42. package/dist/Dialog/Dialog.d.ts.map +1 -1
  43. package/dist/Dialog/Dialog.js +11 -7
  44. package/dist/Dialog/Dialog.js.map +1 -1
  45. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -2
  46. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  47. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  48. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  49. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  50. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  51. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  52. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  53. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  54. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  55. package/dist/DragAndDrop/DragButton.js +97 -0
  56. package/dist/DragAndDrop/DragButton.js.map +1 -0
  57. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  58. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  59. package/dist/DragAndDrop/DropIndicator.js +44 -0
  60. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  61. package/dist/DragAndDrop/index.d.ts +4 -0
  62. package/dist/DragAndDrop/index.d.ts.map +1 -0
  63. package/dist/DragAndDrop/index.js +17 -0
  64. package/dist/DragAndDrop/index.js.map +1 -0
  65. package/dist/DragAndDrop/model.d.ts +11 -0
  66. package/dist/DragAndDrop/model.d.ts.map +1 -0
  67. package/dist/DragAndDrop/model.js +17 -0
  68. package/dist/DragAndDrop/model.js.map +1 -0
  69. package/dist/Drawer/Drawer.d.ts +2 -2
  70. package/dist/Drawer/Drawer.d.ts.map +1 -1
  71. package/dist/Drawer/Drawer.js +2 -2
  72. package/dist/Drawer/Drawer.js.map +1 -1
  73. package/dist/EChart/EChart.d.ts +8 -8
  74. package/dist/EChart/EChart.d.ts.map +1 -1
  75. package/dist/EChart/EChart.js +5 -6
  76. package/dist/EChart/EChart.js.map +1 -1
  77. package/dist/ErrorAlert.d.ts +2 -2
  78. package/dist/ErrorAlert.d.ts.map +1 -1
  79. package/dist/ErrorAlert.js +1 -1
  80. package/dist/ErrorAlert.js.map +1 -1
  81. package/dist/FontSizeSelector/FontSizeSelector.d.ts +3 -3
  82. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  83. package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
  84. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  85. package/dist/FormEditor/FormActions.d.ts +16 -0
  86. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  87. package/dist/FormEditor/FormActions.js +75 -0
  88. package/dist/FormEditor/FormActions.js.map +1 -0
  89. package/dist/FormEditor/index.d.ts +2 -0
  90. package/dist/FormEditor/index.d.ts.map +1 -0
  91. package/dist/FormEditor/index.js +15 -0
  92. package/dist/FormEditor/index.js.map +1 -0
  93. package/dist/FormatControls/FormatControls.d.ts +2 -2
  94. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  95. package/dist/FormatControls/FormatControls.js +3 -3
  96. package/dist/FormatControls/FormatControls.js.map +1 -1
  97. package/dist/GaugeChart/GaugeChart.d.ts +4 -4
  98. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  99. package/dist/GaugeChart/GaugeChart.js +5 -8
  100. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  101. package/dist/InfoTooltip/InfoTooltip.d.ts +4 -4
  102. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  103. package/dist/InfoTooltip/InfoTooltip.js +7 -8
  104. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  105. package/dist/JSONEditor.d.ts +3 -3
  106. package/dist/JSONEditor.d.ts.map +1 -1
  107. package/dist/JSONEditor.js.map +1 -1
  108. package/dist/Legend/CompactLegend.d.ts +2 -2
  109. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  110. package/dist/Legend/CompactLegend.js +1 -1
  111. package/dist/Legend/CompactLegend.js.map +1 -1
  112. package/dist/Legend/Legend.d.ts +2 -2
  113. package/dist/Legend/Legend.d.ts.map +1 -1
  114. package/dist/Legend/Legend.js +9 -5
  115. package/dist/Legend/Legend.js.map +1 -1
  116. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  117. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  118. package/dist/Legend/LegendColorBadge.js +2 -2
  119. package/dist/Legend/LegendColorBadge.js.map +1 -1
  120. package/dist/Legend/ListLegend.d.ts +2 -2
  121. package/dist/Legend/ListLegend.d.ts.map +1 -1
  122. package/dist/Legend/ListLegend.js +1 -1
  123. package/dist/Legend/ListLegend.js.map +1 -1
  124. package/dist/Legend/ListLegendItem.d.ts +6 -6
  125. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  126. package/dist/Legend/ListLegendItem.js +11 -19
  127. package/dist/Legend/ListLegendItem.js.map +1 -1
  128. package/dist/Legend/TableLegend.d.ts +2 -2
  129. package/dist/Legend/TableLegend.d.ts.map +1 -1
  130. package/dist/Legend/TableLegend.js +3 -2
  131. package/dist/Legend/TableLegend.js.map +1 -1
  132. package/dist/Legend/legend-model.d.ts +2 -2
  133. package/dist/Legend/legend-model.d.ts.map +1 -1
  134. package/dist/Legend/legend-model.js.map +1 -1
  135. package/dist/LineChart/LineChart.d.ts +1 -1
  136. package/dist/LineChart/LineChart.d.ts.map +1 -1
  137. package/dist/LineChart/LineChart.js +12 -17
  138. package/dist/LineChart/LineChart.js.map +1 -1
  139. package/dist/LinksEditor/LinksEditor.d.ts +8 -0
  140. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -0
  141. package/dist/LinksEditor/LinksEditor.js +161 -0
  142. package/dist/LinksEditor/LinksEditor.js.map +1 -0
  143. package/dist/LinksEditor/index.d.ts +2 -0
  144. package/dist/LinksEditor/index.d.ts.map +1 -0
  145. package/dist/LinksEditor/index.js +15 -0
  146. package/dist/LinksEditor/index.js.map +1 -0
  147. package/dist/ModeSelector/ModeSelector.d.ts +3 -3
  148. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  149. package/dist/ModeSelector/ModeSelector.js +2 -2
  150. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  151. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +3 -3
  152. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  153. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  154. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  155. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +3 -3
  156. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  157. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  158. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  159. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +3 -3
  160. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  161. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  162. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  163. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +3 -3
  164. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  165. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  166. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  167. package/dist/Overlay/Overlay.d.ts +16 -0
  168. package/dist/Overlay/Overlay.d.ts.map +1 -0
  169. package/dist/Overlay/Overlay.js +52 -0
  170. package/dist/Overlay/Overlay.js.map +1 -0
  171. package/dist/Overlay/index.d.ts +2 -0
  172. package/dist/Overlay/index.d.ts.map +1 -0
  173. package/dist/Overlay/index.js +15 -0
  174. package/dist/Overlay/index.js.map +1 -0
  175. package/dist/PieChart/PieChart.d.ts +14 -0
  176. package/dist/PieChart/PieChart.d.ts.map +1 -0
  177. package/dist/PieChart/PieChart.js +92 -0
  178. package/dist/PieChart/PieChart.js.map +1 -0
  179. package/dist/PieChart/index.d.ts +2 -0
  180. package/dist/PieChart/index.d.ts.map +1 -0
  181. package/dist/PieChart/index.js +15 -0
  182. package/dist/PieChart/index.js.map +1 -0
  183. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -2
  184. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  185. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  186. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  187. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  188. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  189. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +8 -7
  190. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  191. package/dist/SortSelector/SortSelector.d.ts +3 -3
  192. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  193. package/dist/SortSelector/SortSelector.js +2 -2
  194. package/dist/SortSelector/SortSelector.js.map +1 -1
  195. package/dist/SortSelector/SortSelectorButtons.d.ts +9 -0
  196. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  197. package/dist/SortSelector/SortSelectorButtons.js +42 -0
  198. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  199. package/dist/SortSelector/index.d.ts +1 -0
  200. package/dist/SortSelector/index.d.ts.map +1 -1
  201. package/dist/SortSelector/index.js +2 -1
  202. package/dist/SortSelector/index.js.map +1 -1
  203. package/dist/StatChart/StatChart.d.ts +6 -6
  204. package/dist/StatChart/StatChart.d.ts.map +1 -1
  205. package/dist/StatChart/StatChart.js +12 -18
  206. package/dist/StatChart/StatChart.js.map +1 -1
  207. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  208. package/dist/StatChart/calculateFontSize.js +4 -6
  209. package/dist/StatChart/calculateFontSize.js.map +1 -1
  210. package/dist/StatChart/utils/formatStatChartValue.d.ts +3 -0
  211. package/dist/StatChart/utils/formatStatChartValue.d.ts.map +1 -0
  212. package/dist/StatChart/utils/formatStatChartValue.js +26 -0
  213. package/dist/StatChart/utils/formatStatChartValue.js.map +1 -0
  214. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +27 -0
  215. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  216. package/dist/StatusHistoryChart/StatusHistoryChart.js +132 -0
  217. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  218. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +13 -0
  219. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  220. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  221. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  222. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  223. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  224. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  225. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  226. package/dist/StatusHistoryChart/index.d.ts +3 -0
  227. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  228. package/dist/StatusHistoryChart/index.js +16 -0
  229. package/dist/StatusHistoryChart/index.js.map +1 -0
  230. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  231. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  232. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  233. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  234. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  235. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  236. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  237. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  238. package/dist/Table/InnerTable.d.ts +2 -2
  239. package/dist/Table/InnerTable.d.ts.map +1 -1
  240. package/dist/Table/InnerTable.js +4 -3
  241. package/dist/Table/InnerTable.js.map +1 -1
  242. package/dist/Table/Table.d.ts +2 -2
  243. package/dist/Table/Table.d.ts.map +1 -1
  244. package/dist/Table/Table.js +12 -10
  245. package/dist/Table/Table.js.map +1 -1
  246. package/dist/Table/TableBody.d.ts +2 -2
  247. package/dist/Table/TableBody.d.ts.map +1 -1
  248. package/dist/Table/TableCell.d.ts +4 -2
  249. package/dist/Table/TableCell.d.ts.map +1 -1
  250. package/dist/Table/TableCell.js +29 -7
  251. package/dist/Table/TableCell.js.map +1 -1
  252. package/dist/Table/TableCheckbox.d.ts +2 -2
  253. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  254. package/dist/Table/TableCheckbox.js +1 -1
  255. package/dist/Table/TableCheckbox.js.map +1 -1
  256. package/dist/Table/TableHead.d.ts +2 -2
  257. package/dist/Table/TableHead.d.ts.map +1 -1
  258. package/dist/Table/TableHeaderCell.d.ts +3 -3
  259. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  260. package/dist/Table/TableHeaderCell.js +1 -1
  261. package/dist/Table/TableHeaderCell.js.map +1 -1
  262. package/dist/Table/TableRow.d.ts +1 -1
  263. package/dist/Table/TableRow.d.ts.map +1 -1
  264. package/dist/Table/TableRow.js.map +1 -1
  265. package/dist/Table/VirtualizedTable.d.ts +5 -4
  266. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  267. package/dist/Table/VirtualizedTable.js +18 -15
  268. package/dist/Table/VirtualizedTable.js.map +1 -1
  269. package/dist/Table/VirtualizedTableContainer.d.ts +2 -2
  270. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  271. package/dist/Table/hooks/useTableKeyboardNav.d.ts +3 -3
  272. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  273. package/dist/Table/hooks/useTableKeyboardNav.js +2 -2
  274. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  275. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  276. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  277. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +8 -14
  278. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  279. package/dist/Table/index.d.ts +1 -2
  280. package/dist/Table/index.d.ts.map +1 -1
  281. package/dist/Table/index.js +1 -1
  282. package/dist/Table/index.js.map +1 -1
  283. package/dist/Table/model/table-model.d.ts +27 -7
  284. package/dist/Table/model/table-model.d.ts.map +1 -1
  285. package/dist/Table/model/table-model.js +29 -23
  286. package/dist/Table/model/table-model.js.map +1 -1
  287. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  288. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  289. package/dist/ThresholdsEditor/ThresholdInput.js +3 -3
  290. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  291. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -2
  292. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  293. package/dist/ThresholdsEditor/ThresholdsEditor.js +20 -27
  294. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  295. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  296. package/dist/TimeChart/TimeChart.js +12 -15
  297. package/dist/TimeChart/TimeChart.js.map +1 -1
  298. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +19 -0
  299. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  300. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +44 -29
  301. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  302. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +36 -0
  303. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  304. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  305. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  306. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  307. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  308. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  309. package/dist/TimeRangeSelector/index.js.map +1 -0
  310. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  311. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  312. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  313. package/dist/TimeRangeSelector/utils.js.map +1 -0
  314. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  315. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  316. package/dist/TimeSeriesTooltip/LineChartTooltip.js +8 -13
  317. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  318. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -2
  319. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  320. package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -3
  321. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  322. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -2
  323. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  324. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  325. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  326. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -2
  327. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  328. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  329. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  330. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  331. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  332. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +4 -5
  333. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  334. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -2
  335. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  336. package/dist/TimeSeriesTooltip/TooltipContent.js +2 -2
  337. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  338. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  339. package/dist/TimeSeriesTooltip/TooltipHeader.js +7 -15
  340. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  341. package/dist/TimeSeriesTooltip/nearby-series.d.ts +1 -1
  342. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  343. package/dist/TimeSeriesTooltip/nearby-series.js +19 -29
  344. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  345. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +10 -3
  346. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  347. package/dist/TimeSeriesTooltip/tooltip-model.js +13 -2
  348. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  349. package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
  350. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  351. package/dist/TimeSeriesTooltip/utils.js +2 -4
  352. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  353. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
  354. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
  355. package/dist/ToolbarIconButton/ToolbarIconButton.js +32 -0
  356. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
  357. package/dist/ToolbarIconButton/index.d.ts +2 -0
  358. package/dist/ToolbarIconButton/index.d.ts.map +1 -0
  359. package/dist/ToolbarIconButton/index.js +15 -0
  360. package/dist/ToolbarIconButton/index.js.map +1 -0
  361. package/dist/TransformsEditor/TransformEditor.d.ts +9 -0
  362. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -0
  363. package/dist/TransformsEditor/TransformEditor.js +289 -0
  364. package/dist/TransformsEditor/TransformEditor.js.map +1 -0
  365. package/dist/TransformsEditor/TransformEditorContainer.d.ts +10 -0
  366. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -0
  367. package/dist/TransformsEditor/TransformEditorContainer.js +118 -0
  368. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -0
  369. package/dist/TransformsEditor/TransformsEditor.d.ts +9 -0
  370. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -0
  371. package/dist/TransformsEditor/TransformsEditor.js +90 -0
  372. package/dist/TransformsEditor/TransformsEditor.js.map +1 -0
  373. package/dist/TransformsEditor/index.d.ts +2 -0
  374. package/dist/TransformsEditor/index.d.ts.map +1 -0
  375. package/dist/TransformsEditor/index.js +15 -0
  376. package/dist/TransformsEditor/index.js.map +1 -0
  377. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +10 -0
  378. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -0
  379. package/dist/ValueMappingEditor/ValueMappingEditor.js +374 -0
  380. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
  381. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +8 -0
  382. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -0
  383. package/dist/ValueMappingEditor/ValueMappingsEditor.js +118 -0
  384. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
  385. package/dist/ValueMappingEditor/index.d.ts +2 -0
  386. package/dist/ValueMappingEditor/index.d.ts.map +1 -0
  387. package/dist/ValueMappingEditor/index.js +15 -0
  388. package/dist/ValueMappingEditor/index.js.map +1 -0
  389. package/dist/YAxisLabel.d.ts +2 -2
  390. package/dist/YAxisLabel.d.ts.map +1 -1
  391. package/dist/YAxisLabel.js +5 -3
  392. package/dist/YAxisLabel.js.map +1 -1
  393. package/dist/cjs/AlignSelector/AlignSelector.js +50 -0
  394. package/dist/cjs/AlignSelector/index.js +30 -0
  395. package/dist/cjs/BarChart/BarChart.js +14 -9
  396. package/dist/cjs/ColorPicker/ColorPicker.js +28 -52
  397. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +19 -16
  398. package/dist/cjs/ColorPicker/index.js +1 -0
  399. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +10 -12
  400. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +4 -5
  401. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  402. package/dist/cjs/DensitySelector/index.js +30 -0
  403. package/dist/cjs/Dialog/Dialog.js +11 -7
  404. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  405. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  406. package/dist/cjs/DragAndDrop/DragButton.js +121 -0
  407. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  408. package/dist/cjs/DragAndDrop/index.js +32 -0
  409. package/dist/cjs/DragAndDrop/model.js +25 -0
  410. package/dist/cjs/Drawer/Drawer.js +2 -2
  411. package/dist/cjs/EChart/EChart.js +5 -45
  412. package/dist/cjs/ErrorAlert.js +1 -1
  413. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +2 -2
  414. package/dist/cjs/FormEditor/FormActions.js +83 -0
  415. package/dist/cjs/FormEditor/index.js +30 -0
  416. package/dist/cjs/FormatControls/FormatControls.js +3 -3
  417. package/dist/cjs/GaugeChart/GaugeChart.js +6 -9
  418. package/dist/cjs/InfoTooltip/InfoTooltip.js +7 -13
  419. package/dist/cjs/Legend/CompactLegend.js +1 -1
  420. package/dist/cjs/Legend/Legend.js +9 -5
  421. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  422. package/dist/cjs/Legend/ListLegend.js +1 -1
  423. package/dist/cjs/Legend/ListLegendItem.js +9 -55
  424. package/dist/cjs/Legend/TableLegend.js +3 -2
  425. package/dist/cjs/LineChart/LineChart.js +13 -18
  426. package/dist/cjs/LinksEditor/LinksEditor.js +174 -0
  427. package/dist/cjs/LinksEditor/index.js +30 -0
  428. package/dist/cjs/ModeSelector/ModeSelector.js +2 -2
  429. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  430. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  431. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  432. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  433. package/dist/cjs/Overlay/Overlay.js +71 -0
  434. package/dist/cjs/Overlay/index.js +30 -0
  435. package/dist/cjs/PieChart/PieChart.js +100 -0
  436. package/dist/cjs/PieChart/index.js +30 -0
  437. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  438. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +8 -7
  439. package/dist/cjs/SortSelector/SortSelector.js +2 -2
  440. package/dist/cjs/SortSelector/SortSelectorButtons.js +50 -0
  441. package/dist/cjs/SortSelector/index.js +2 -1
  442. package/dist/cjs/StatChart/StatChart.js +15 -21
  443. package/dist/cjs/StatChart/calculateFontSize.js +4 -6
  444. package/dist/cjs/StatChart/utils/formatStatChartValue.js +34 -0
  445. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +140 -0
  446. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  447. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  448. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  449. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  450. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  451. package/dist/cjs/Table/InnerTable.js +4 -3
  452. package/dist/cjs/Table/Table.js +11 -9
  453. package/dist/cjs/Table/TableCell.js +29 -7
  454. package/dist/cjs/Table/TableCheckbox.js +1 -1
  455. package/dist/cjs/Table/TableHeaderCell.js +1 -1
  456. package/dist/cjs/Table/VirtualizedTable.js +18 -15
  457. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +2 -2
  458. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +8 -14
  459. package/dist/cjs/Table/index.js +1 -7
  460. package/dist/cjs/Table/model/table-model.js +32 -23
  461. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +3 -3
  462. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +23 -28
  463. package/dist/cjs/TimeChart/TimeChart.js +12 -15
  464. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +37 -30
  465. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  466. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  467. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +26 -3
  468. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +8 -13
  469. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +2 -3
  470. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  471. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +1 -1
  472. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +4 -5
  473. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +2 -2
  474. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +7 -15
  475. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +29 -39
  476. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +49 -29
  477. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -4
  478. package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +40 -0
  479. package/dist/cjs/ToolbarIconButton/index.js +30 -0
  480. package/dist/cjs/TransformsEditor/TransformEditor.js +297 -0
  481. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +131 -0
  482. package/dist/cjs/TransformsEditor/TransformsEditor.js +103 -0
  483. package/dist/cjs/TransformsEditor/index.js +30 -0
  484. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +387 -0
  485. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +131 -0
  486. package/dist/cjs/ValueMappingEditor/index.js +30 -0
  487. package/dist/cjs/YAxisLabel.js +5 -3
  488. package/dist/cjs/context/ChartsProvider.js +4 -2
  489. package/dist/cjs/context/SnackbarProvider.js +1 -1
  490. package/dist/cjs/context/TimeZoneProvider.js +5 -3
  491. package/dist/cjs/controls/TextField.js +54 -0
  492. package/dist/cjs/controls/index.js +30 -0
  493. package/dist/cjs/index.js +13 -1
  494. package/dist/cjs/model/graph.js +3 -3
  495. package/dist/cjs/model/timeOption.js +19 -1
  496. package/dist/cjs/test-utils/theme.js +3 -3
  497. package/dist/cjs/theme/component-overrides/alert.js +4 -4
  498. package/dist/cjs/theme/component-overrides/paper.js +1 -1
  499. package/dist/cjs/theme/index.js +1 -0
  500. package/dist/cjs/theme/palette/background.js +2 -0
  501. package/dist/cjs/theme/palette/colors/common.js +3 -3
  502. package/dist/cjs/theme/theme.js +7 -7
  503. package/dist/cjs/utils/axis.js +3 -3
  504. package/dist/cjs/utils/chart-actions.js +14 -15
  505. package/dist/cjs/utils/format.js +21 -3
  506. package/dist/cjs/utils/mathjs.js +1 -1
  507. package/dist/cjs/utils/theme-gen.js +5 -7
  508. package/dist/context/ChartsProvider.d.ts +2 -2
  509. package/dist/context/ChartsProvider.d.ts.map +1 -1
  510. package/dist/context/ChartsProvider.js +1 -1
  511. package/dist/context/ChartsProvider.js.map +1 -1
  512. package/dist/context/SnackbarProvider.d.ts +2 -2
  513. package/dist/context/SnackbarProvider.d.ts.map +1 -1
  514. package/dist/context/SnackbarProvider.js +1 -1
  515. package/dist/context/SnackbarProvider.js.map +1 -1
  516. package/dist/context/TimeZoneProvider.d.ts +4 -4
  517. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  518. package/dist/context/TimeZoneProvider.js +2 -2
  519. package/dist/context/TimeZoneProvider.js.map +1 -1
  520. package/dist/controls/TextField.d.ts +9 -0
  521. package/dist/controls/TextField.d.ts.map +1 -0
  522. package/dist/controls/TextField.js +41 -0
  523. package/dist/controls/TextField.js.map +1 -0
  524. package/dist/controls/index.d.ts +2 -0
  525. package/dist/controls/index.d.ts.map +1 -0
  526. package/dist/controls/index.js +15 -0
  527. package/dist/controls/index.js.map +1 -0
  528. package/dist/index.d.ts +13 -1
  529. package/dist/index.d.ts.map +1 -1
  530. package/dist/index.js +13 -1
  531. package/dist/index.js.map +1 -1
  532. package/dist/model/graph.d.ts +8 -8
  533. package/dist/model/graph.d.ts.map +1 -1
  534. package/dist/model/theme.d.ts +1 -1
  535. package/dist/model/theme.d.ts.map +1 -1
  536. package/dist/model/theme.js.map +1 -1
  537. package/dist/model/timeOption.d.ts +2 -1
  538. package/dist/model/timeOption.d.ts.map +1 -1
  539. package/dist/model/timeOption.js +13 -2
  540. package/dist/model/timeOption.js.map +1 -1
  541. package/dist/test/render.d.ts +3 -3
  542. package/dist/test/render.d.ts.map +1 -1
  543. package/dist/test/render.js.map +1 -1
  544. package/dist/test/setup-tests.js.map +1 -1
  545. package/dist/theme/component-overrides/alert.js +4 -4
  546. package/dist/theme/component-overrides/alert.js.map +1 -1
  547. package/dist/theme/component-overrides/paper.js +1 -1
  548. package/dist/theme/component-overrides/paper.js.map +1 -1
  549. package/dist/theme/index.d.ts +2 -0
  550. package/dist/theme/index.d.ts.map +1 -1
  551. package/dist/theme/index.js +1 -0
  552. package/dist/theme/index.js.map +1 -1
  553. package/dist/theme/palette/background.d.ts.map +1 -1
  554. package/dist/theme/palette/background.js +2 -0
  555. package/dist/theme/palette/background.js.map +1 -1
  556. package/dist/theme/palette/colors/types.d.ts +1 -1
  557. package/dist/theme/palette/colors/types.d.ts.map +1 -1
  558. package/dist/theme/palette/colors/types.js.map +1 -1
  559. package/dist/theme/theme.d.ts +2 -2
  560. package/dist/theme/theme.d.ts.map +1 -1
  561. package/dist/theme/theme.js +6 -6
  562. package/dist/theme/theme.js.map +1 -1
  563. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  564. package/dist/utils/axis.d.ts +1 -7
  565. package/dist/utils/axis.d.ts.map +1 -1
  566. package/dist/utils/axis.js.map +1 -1
  567. package/dist/utils/chart-actions.d.ts.map +1 -1
  568. package/dist/utils/chart-actions.js +2 -3
  569. package/dist/utils/chart-actions.js.map +1 -1
  570. package/dist/utils/combine-sx.js.map +1 -1
  571. package/dist/utils/component-ids.d.ts.map +1 -1
  572. package/dist/utils/component-ids.js.map +1 -1
  573. package/dist/utils/format.d.ts +10 -4
  574. package/dist/utils/format.d.ts.map +1 -1
  575. package/dist/utils/format.js +16 -1
  576. package/dist/utils/format.js.map +1 -1
  577. package/dist/utils/mathjs.js +1 -1
  578. package/dist/utils/mathjs.js.map +1 -1
  579. package/dist/utils/theme-gen.d.ts +1 -1
  580. package/dist/utils/theme-gen.d.ts.map +1 -1
  581. package/dist/utils/theme-gen.js +5 -7
  582. package/dist/utils/theme-gen.js.map +1 -1
  583. package/package.json +13 -9
  584. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -10
  585. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  586. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  587. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -12
  588. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  589. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  590. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  591. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -14
  592. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  593. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  594. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  595. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  596. package/dist/DateTimeRangePicker/index.js.map +0 -1
  597. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  598. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  599. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  600. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -4
  601. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  602. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  603. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  604. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -13,21 +13,19 @@
13
13
  import { useTableKeyboardNav } from './useTableKeyboardNav';
14
14
  /**
15
15
  * Hook for managing keyboard navigation when using a virtualized table.
16
- */ export function useVirtualizedTableKeyboardNav({ visibleRange , virtualTable , maxRows , maxColumns }) {
16
+ */ export function useVirtualizedTableKeyboardNav({ visibleRange, virtualTable, maxRows, maxColumns }) {
17
17
  const baseKeyboard = useTableKeyboardNav({
18
18
  maxRows,
19
19
  maxColumns,
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 _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;
23
+ const nextRow = defaultNewPosition?.row ?? currentPosition.row;
25
24
  if (key === 'ArrowDown' && defaultValueChanged) {
26
25
  // Use default cell position. Shift the virtual table scroll position
27
26
  // when needed to make the active cell visible.
28
27
  if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
29
- var _virtualTable_current;
30
- (_virtualTable_current = virtualTable.current) === null || _virtualTable_current === void 0 ? void 0 : _virtualTable_current.scrollToIndex({
28
+ virtualTable.current?.scrollToIndex({
31
29
  index: nextRow - 1,
32
30
  align: 'end'
33
31
  });
@@ -36,28 +34,25 @@ import { useTableKeyboardNav } from './useTableKeyboardNav';
36
34
  // Use default cell position. Shift the virtual table scroll position
37
35
  // when needed to make the active cell visible.
38
36
  if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
39
- var _virtualTable_current1;
40
- (_virtualTable_current1 = virtualTable.current) === null || _virtualTable_current1 === void 0 ? void 0 : _virtualTable_current1.scrollToIndex({
37
+ virtualTable.current?.scrollToIndex({
41
38
  index: nextRow - 1,
42
39
  align: 'start'
43
40
  });
44
41
  }
45
42
  } else if (defaultValueChanged && (key === 'Home' || key === 'End')) {
46
- var // Use default cell position. Shift the virtual table scroll position
43
+ // Use default cell position. Shift the virtual table scroll position
47
44
  // when needed to make the active cell visible.
48
- _virtualTable_current2;
49
- (_virtualTable_current2 = virtualTable.current) === null || _virtualTable_current2 === void 0 ? void 0 : _virtualTable_current2.scrollToIndex({
45
+ virtualTable.current?.scrollToIndex({
50
46
  index: Math.max(nextRow - 1, 0),
51
47
  align: 'start'
52
48
  });
53
49
  } else if (key === 'PageDown') {
54
- var _virtualTable_current3;
55
50
  // Full handling of logic for `PageDown` because there is no default.
56
51
  e.preventDefault();
57
52
  let nextRow = currentPosition.row;
58
53
  // Add 1 to account for header
59
54
  nextRow = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);
60
- (_virtualTable_current3 = virtualTable.current) === null || _virtualTable_current3 === void 0 ? void 0 : _virtualTable_current3.scrollToIndex({
55
+ virtualTable.current?.scrollToIndex({
61
56
  index: nextRow - 1,
62
57
  align: 'start'
63
58
  });
@@ -66,12 +61,11 @@ import { useTableKeyboardNav } from './useTableKeyboardNav';
66
61
  column: currentPosition.column
67
62
  };
68
63
  } else if (key === 'PageUp') {
69
- var _virtualTable_current4;
70
64
  // Full handling of logic for `PageUp` because there is no default.
71
65
  let nextRow = currentPosition.row;
72
66
  // Minus 1 to account for header
73
67
  nextRow = Math.max(0, visibleRange.current.startIndex - 1);
74
- (_virtualTable_current4 = virtualTable.current) === null || _virtualTable_current4 === void 0 ? void 0 : _virtualTable_current4.scrollToIndex({
68
+ virtualTable.current?.scrollToIndex({
75
69
  index: nextRow - 1,
76
70
  align: 'end'
77
71
  });
@@ -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,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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AQC,aAAa;gBACxDd,CAAAA,yBAAAA,aAAaa,qBAAbb,oCAAAA,KAAAA,IAAAA,uBAAsBgB,cAAc;oBAClCC,OAAOL,UAAU;oBACjBM,OAAO;gBACT;gBAEA,OAAO;oBACLP,KAAKC;oBACLF,QAAQJ,gBAAgBI;gBAC1B;YACF;YAEA,OAAOH;QACT;IACF;IAEA,OAAOJ;AACT"}
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 { KeyboardEventHandler, MutableRefObject, RefObject } from 'react';\nimport { useTableKeyboardNav, UseTableKeyboardNavProps } from './useTableKeyboardNav';\n\ninterface UseVirtualizedTableKeyboardNavProps extends Omit<UseTableKeyboardNavProps, 'onActiveCellChange'> {\n visibleRange: MutableRefObject<{\n startIndex: number;\n endIndex: number;\n }>;\n virtualTable: RefObject<TableVirtuosoHandle>;\n maxRows: number;\n maxColumns: number;\n}\n\ntype TableCellPosition = {\n row: number;\n column: 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 activeCell: TableCellPosition;\n isActive: boolean;\n onTableKeyDown: KeyboardEventHandler<HTMLTableElement>;\n onCellFocus: (cellPosition: TableCellPosition) => void;\n} {\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;AAIjC,SAASA,mBAAmB,QAAkC,wBAAwB;AAiBtF;;CAEC,GACD,OAAO,SAASC,+BAA+B,EAC7CC,YAAY,EACZC,YAAY,EACZC,OAAO,EACPC,UAAU,EAC0B;IAMpC,MAAMC,eAAeN,oBAAoB;QACvCI;QACAC;QACAE,oBAAoB,CAACC,GAAGC,iBAAiBC;YACvC,MAAMC,MAAMH,EAAEG,GAAG;YAEjB,MAAMC,sBACJF,sBACCD,CAAAA,gBAAgBI,MAAM,KAAKH,mBAAmBG,MAAM,IAAIJ,gBAAgBK,GAAG,KAAKJ,mBAAmBI,GAAG,AAAD;YACxG,MAAMC,UAAUL,oBAAoBI,OAAOL,gBAAgBK,GAAG;YAE9D,IAAIH,QAAQ,eAAeC,qBAAqB;gBAC9C,qEAAqE;gBACrE,+CAA+C;gBAC/C,IAAIG,UAAU,IAAIb,aAAac,OAAO,CAACC,UAAU,IAAIF,UAAU,IAAIb,aAAac,OAAO,CAACE,QAAQ,EAAE;oBAChGf,aAAaa,OAAO,EAAEG,cAAc;wBAClCC,OAAOL,UAAU;wBACjBM,OAAO;oBACT;gBACF;YACF,OAAO,IAAIV,QAAQ,aAAaC,qBAAqB;gBACnD,qEAAqE;gBACrE,+CAA+C;gBAC/C,IAAIG,UAAU,IAAIb,aAAac,OAAO,CAACC,UAAU,IAAIF,UAAU,IAAIb,aAAac,OAAO,CAACE,QAAQ,EAAE;oBAChGf,aAAaa,OAAO,EAAEG,cAAc;wBAClCC,OAAOL,UAAU;wBACjBM,OAAO;oBACT;gBACF;YACF,OAAO,IAAIT,uBAAwBD,CAAAA,QAAQ,UAAUA,QAAQ,KAAI,GAAI;gBACnE,qEAAqE;gBACrE,+CAA+C;gBAC/CR,aAAaa,OAAO,EAAEG,cAAc;oBAClCC,OAAOE,KAAKC,GAAG,CAACR,UAAU,GAAG;oBAC7BM,OAAO;gBACT;YACF,OAAO,IAAIV,QAAQ,YAAY;gBAC7B,qEAAqE;gBACrEH,EAAEgB,cAAc;gBAEhB,IAAIT,UAAUN,gBAAgBK,GAAG;gBACjC,8BAA8B;gBAE9BC,UAAUO,KAAKG,GAAG,CAACrB,UAAU,GAAGF,aAAac,OAAO,CAACE,QAAQ,GAAG;gBAEhEf,aAAaa,OAAO,EAAEG,cAAc;oBAClCC,OAAOL,UAAU;oBACjBM,OAAO;gBACT;gBAEA,OAAO;oBACLP,KAAKC;oBACLF,QAAQJ,gBAAgBI,MAAM;gBAChC;YACF,OAAO,IAAIF,QAAQ,UAAU;gBAC3B,mEAAmE;gBACnE,IAAII,UAAUN,gBAAgBK,GAAG;gBACjC,gCAAgC;gBAChCC,UAAUO,KAAKC,GAAG,CAAC,GAAGrB,aAAac,OAAO,CAACC,UAAU,GAAG;gBACxDd,aAAaa,OAAO,EAAEG,cAAc;oBAClCC,OAAOL,UAAU;oBACjBM,OAAO;gBACT;gBAEA,OAAO;oBACLP,KAAKC;oBACLF,QAAQJ,gBAAgBI,MAAM;gBAChC;YACF;YAEA,OAAOH;QACT;IACF;IAEA,OAAOJ;AACT"}
@@ -1,4 +1,3 @@
1
1
  export * from './Table';
2
- export { getTableCellLayout } from './model/table-model';
3
- export type { TableColumnConfig, TableProps, TableDensity } from './model/table-model';
2
+ export * from './model/table-model';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Table/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
@@ -11,6 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './Table';
14
- export { getTableCellLayout } from './model/table-model';
14
+ export * from './model/table-model';
15
15
 
16
16
  //# sourceMappingURL=index.js.map
@@ -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,UAAU;AACxB,SAASA,kBAAkB,QAAQ,sBAAsB"}
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 * from './model/table-model';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,sBAAsB"}
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { Theme } from '@mui/material';
3
3
  import { AccessorKeyColumnDef, CellContext, ColumnDef, CoreOptions, RowData, RowSelectionState, SortingState } from '@tanstack/react-table';
4
- export declare type TableDensity = 'compact' | 'standard';
5
- export declare type SortDirection = 'asc' | 'desc' | undefined;
6
- export declare type TableRowEventOpts = {
4
+ export declare const DEFAULT_COLUMN_WIDTH = 150;
5
+ export type TableDensity = 'compact' | 'standard' | 'comfortable';
6
+ export type SortDirection = 'asc' | 'desc' | undefined;
7
+ export type TableRowEventOpts = {
7
8
  /**
8
9
  * Unique identifier for the row.
9
10
  */
@@ -33,11 +34,22 @@ export interface TableProps<TableData> {
33
34
  * table rows.
34
35
  */
35
36
  columns: Array<TableColumnConfig<TableData>>;
37
+ /**
38
+ * Custom render cell configurations. Each entry of the object should be an
39
+ * id for cell `${rowIndex}_${columnIndex}`, can apply custom text, text color
40
+ * and background color.
41
+ */
42
+ cellConfigs?: TableCellConfigs;
36
43
  /**
37
44
  * The density of the table layout. This impacts the size and space taken up
38
45
  * by content in the table (e.g. font size, padding).
39
46
  */
40
47
  density?: TableDensity;
48
+ /**
49
+ * When using "auto", the table will try to automatically adjust the width of columns to fit without overflowing.
50
+ * If there is not enough width for each column, the display can unreadable.
51
+ */
52
+ defaultColumnWidth?: 'auto' | number;
41
53
  /**
42
54
  * When `true`, the first column of the table will include checkboxes.
43
55
  */
@@ -96,10 +108,10 @@ export interface TableProps<TableData> {
96
108
  */
97
109
  getCheckboxColor?: (rowData: TableData) => string;
98
110
  }
99
- declare type TableCellLayout = NonNullable<Pick<React.CSSProperties, 'padding' | 'fontSize' | 'lineHeight'>> & {
111
+ type TableCellLayout = NonNullable<Pick<React.CSSProperties, 'padding' | 'fontSize' | 'lineHeight'>> & {
100
112
  height: number;
101
113
  };
102
- declare type GetTableCellLayoutOpts = {
114
+ type GetTableCellLayoutOpts = {
103
115
  isLastColumn?: boolean;
104
116
  isFirstColumn?: boolean;
105
117
  };
@@ -108,7 +120,15 @@ declare type GetTableCellLayoutOpts = {
108
120
  * theme and density.
109
121
  */
110
122
  export declare function getTableCellLayout(theme: Theme, density: TableDensity, { isLastColumn, isFirstColumn }?: GetTableCellLayoutOpts): TableCellLayout;
111
- export declare type TableCellAlignment = 'left' | 'right' | 'center';
123
+ export type TableCellAlignment = 'left' | 'right' | 'center';
124
+ export interface TableCellConfigs {
125
+ [id: string]: TableCellConfig;
126
+ }
127
+ export interface TableCellConfig {
128
+ text?: string;
129
+ textColor?: string;
130
+ backgroundColor?: string;
131
+ }
112
132
  declare module '@tanstack/table-core' {
113
133
  interface ColumnMeta<TData extends RowData, TValue> {
114
134
  align?: TableColumnConfig<TData>['align'];
@@ -156,6 +176,6 @@ export interface TableColumnConfig<TableData> extends Pick<AccessorKeyColumnDef<
156
176
  /**
157
177
  * Takes in a perses table column and transforms it into a tanstack column.
158
178
  */
159
- export declare function persesColumnsToTanstackColumns<TableData>(columns: Array<TableColumnConfig<TableData>>): ColumnDef<TableData, unknown>[];
179
+ export declare function persesColumnsToTanstackColumns<TableData>(columns: Array<TableColumnConfig<TableData>>): Array<ColumnDef<TableData>>;
160
180
  export {};
161
181
  //# sourceMappingURL=table-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-model.d.ts","sourceRoot":"","sources":["../../../src/Table/model/table-model.ts"],"names":[],"mappings":";AAaA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AK,EAAE,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC;IAEzF;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EACtD,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAC3C,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CA0C7B"}
@@ -10,49 +10,55 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ export const DEFAULT_COLUMN_WIDTH = 150;
13
14
  function calculateTableCellHeight(lineHeight, paddingY) {
14
15
  // Doing a bunch of math to enforce height to avoid weirdness with mismatched
15
16
  // heights based on customization of cell contents.
16
- const lineHeightNum = typeof lineHeight === 'string' ? parseInt(lineHeight, 10) : lineHeight !== null && lineHeight !== void 0 ? lineHeight : 0;
17
+ const lineHeightNum = typeof lineHeight === 'string' ? parseInt(lineHeight, 10) : lineHeight ?? 0;
17
18
  const verticalPaddingNum = typeof paddingY === 'string' ? parseInt(paddingY, 10) : paddingY;
18
19
  return lineHeightNum + verticalPaddingNum * 2;
19
20
  }
20
21
  /**
21
22
  * Returns the properties to lay out the content of table cells based on the
22
23
  * theme and density.
23
- */ export function getTableCellLayout(theme, density, { isLastColumn , isFirstColumn } = {}) {
24
+ */ export function getTableCellLayout(theme, density, { isLastColumn, isFirstColumn } = {}) {
25
+ // Density Standard
26
+ let paddingY = theme.spacing(1);
27
+ let basePaddingX = theme.spacing(1.25);
28
+ let edgePaddingX = theme.spacing(2);
29
+ let paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
30
+ let paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
31
+ let lineHeight = theme.typography.body1.lineHeight;
32
+ let fontSize = theme.typography.body1.fontSize;
24
33
  if (density === 'compact') {
25
- const paddingY = theme.spacing(0.5);
26
- const basePaddingX = theme.spacing(0.5);
27
- const edgePaddingX = theme.spacing(1);
28
- const paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
29
- const paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
30
- const lineHeight = theme.typography.body2.lineHeight;
31
- return {
32
- padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,
33
- height: calculateTableCellHeight(lineHeight, paddingY),
34
- fontSize: theme.typography.body2.fontSize,
35
- lineHeight: lineHeight
36
- };
34
+ paddingY = theme.spacing(0.5);
35
+ basePaddingX = theme.spacing(0.5);
36
+ edgePaddingX = theme.spacing(1);
37
+ paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
38
+ paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
39
+ lineHeight = theme.typography.body2.lineHeight;
40
+ fontSize = theme.typography.body2.fontSize;
41
+ }
42
+ if (density === 'comfortable') {
43
+ paddingY = theme.spacing(2);
44
+ basePaddingX = theme.spacing(1.5);
45
+ edgePaddingX = theme.spacing(2);
46
+ paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;
47
+ paddingRight = isLastColumn ? edgePaddingX : basePaddingX;
48
+ lineHeight = theme.typography.body1.lineHeight;
49
+ fontSize = theme.typography.body1.fontSize;
37
50
  }
38
- // standard density
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
51
  return {
46
52
  padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,
47
53
  height: calculateTableCellHeight(lineHeight, paddingY),
48
- fontSize: theme.typography.body1.fontSize,
54
+ fontSize: fontSize,
49
55
  lineHeight: lineHeight
50
56
  };
51
57
  }
52
58
  /**
53
59
  * Takes in a perses table column and transforms it into a tanstack column.
54
60
  */ export function persesColumnsToTanstackColumns(columns) {
55
- const tableCols = columns.map(({ width , align , headerDescription , cellDescription , enableSorting , ...otherProps })=>{
61
+ const tableCols = columns.map(({ width, align, headerDescription, cellDescription, enableSorting, ...otherProps })=>{
56
62
  // Tanstack Table does not support an "auto" value to naturally size to fit
57
63
  // the space in a table. We translate our custom "auto" setting to 0 size
58
64
  // for these columns, so it is easy to fall back to auto when rendering.
@@ -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,yBAAyBC,UAAuC,EAAEC,QAAgB;IACzF,6EAA6E;IAC7E,mDAAmD;IACnD,MAAMC,gBAAgB,OAAOF,eAAe,WAAWG,SAASH,YAAY,MAAMA,uBAAAA,wBAAAA,aAAc;IAChG,MAAMI,qBAAqB,OAAOH,aAAa,WAAWE,SAASF,UAAU,MAAMA;IAEnF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,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"}
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 const DEFAULT_COLUMN_WIDTH = 150;\n\nexport type TableDensity = 'compact' | 'standard' | 'comfortable';\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 * Custom render cell configurations. Each entry of the object should be an\n * id for cell `${rowIndex}_${columnIndex}`, can apply custom text, text color\n * and background color.\n */\n cellConfigs?: TableCellConfigs;\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 using \"auto\", the table will try to automatically adjust the width of columns to fit without overflowing.\n * If there is not enough width for each column, the display can unreadable.\n */\n defaultColumnWidth?: 'auto' | number;\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 // Density Standard\n let paddingY = theme.spacing(1);\n let basePaddingX = theme.spacing(1.25);\n let edgePaddingX = theme.spacing(2);\n let paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n let paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n let lineHeight = theme.typography.body1.lineHeight;\n let fontSize = theme.typography.body1.fontSize;\n\n if (density === 'compact') {\n paddingY = theme.spacing(0.5);\n basePaddingX = theme.spacing(0.5);\n edgePaddingX = theme.spacing(1);\n paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n lineHeight = theme.typography.body2.lineHeight;\n fontSize = theme.typography.body2.fontSize;\n }\n\n if (density === 'comfortable') {\n paddingY = theme.spacing(2);\n basePaddingX = theme.spacing(1.5);\n edgePaddingX = theme.spacing(2);\n paddingLeft = isFirstColumn ? edgePaddingX : basePaddingX;\n paddingRight = isLastColumn ? edgePaddingX : basePaddingX;\n lineHeight = theme.typography.body1.lineHeight;\n fontSize = theme.typography.body1.fontSize;\n }\n\n return {\n padding: `${paddingY} ${paddingRight} ${paddingY} ${paddingLeft}`,\n height: calculateTableCellHeight(lineHeight, paddingY),\n fontSize: fontSize,\n lineHeight: lineHeight,\n };\n}\n\nexport type TableCellAlignment = 'left' | 'right' | 'center';\n\nexport interface TableCellConfigs {\n [id: string]: TableCellConfig;\n}\n\nexport interface TableCellConfig {\n text?: string;\n textColor?: string;\n backgroundColor?: string;\n}\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>(\n columns: Array<TableColumnConfig<TableData>>\n): Array<ColumnDef<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":["DEFAULT_COLUMN_WIDTH","calculateTableCellHeight","lineHeight","paddingY","lineHeightNum","parseInt","verticalPaddingNum","getTableCellLayout","theme","density","isLastColumn","isFirstColumn","spacing","basePaddingX","edgePaddingX","paddingLeft","paddingRight","typography","body1","fontSize","body2","padding","height","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;AAcjC,OAAO,MAAMA,uBAAuB,IAAI;AAgIxC,SAASC,yBAAyBC,UAAuC,EAAEC,QAAgB;IACzF,6EAA6E;IAC7E,mDAAmD;IACnD,MAAMC,gBAAgB,OAAOF,eAAe,WAAWG,SAASH,YAAY,MAAOA,cAAc;IACjG,MAAMI,qBAAqB,OAAOH,aAAa,WAAWE,SAASF,UAAU,MAAMA;IAEnF,OAAOC,gBAAgBE,qBAAqB;AAC9C;AAWA;;;CAGC,GACD,OAAO,SAASC,mBACdC,KAAY,EACZC,OAAqB,EACrB,EAAEC,YAAY,EAAEC,aAAa,EAA0B,GAAG,CAAC,CAAC;IAE5D,mBAAmB;IACnB,IAAIR,WAAWK,MAAMI,OAAO,CAAC;IAC7B,IAAIC,eAAeL,MAAMI,OAAO,CAAC;IACjC,IAAIE,eAAeN,MAAMI,OAAO,CAAC;IACjC,IAAIG,cAAcJ,gBAAgBG,eAAeD;IACjD,IAAIG,eAAeN,eAAeI,eAAeD;IACjD,IAAIX,aAAaM,MAAMS,UAAU,CAACC,KAAK,CAAChB,UAAU;IAClD,IAAIiB,WAAWX,MAAMS,UAAU,CAACC,KAAK,CAACC,QAAQ;IAE9C,IAAIV,YAAY,WAAW;QACzBN,WAAWK,MAAMI,OAAO,CAAC;QACzBC,eAAeL,MAAMI,OAAO,CAAC;QAC7BE,eAAeN,MAAMI,OAAO,CAAC;QAC7BG,cAAcJ,gBAAgBG,eAAeD;QAC7CG,eAAeN,eAAeI,eAAeD;QAC7CX,aAAa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ject } from 'react';
1
+ import { ReactElement, RefObject } from 'react';
2
2
  import { ThresholdOptions } from '@perses-dev/core';
3
3
  export interface ThresholdInputProps {
4
4
  label: string;
@@ -11,5 +11,5 @@ export interface ThresholdInputProps {
11
11
  inputRef?: RefObject<HTMLInputElement | null>;
12
12
  mode?: ThresholdOptions['mode'];
13
13
  }
14
- export declare function ThresholdInput({ inputRef, label, color, value, mode, onChange, onColorChange, onBlur, onDelete, }: ThresholdInputProps): JSX.Element;
14
+ export declare function ThresholdInput({ inputRef, label, color, value, mode, onChange, onColorChange, onBlur, onDelete, }: ThresholdInputProps): ReactElement;
15
15
  //# sourceMappingURL=ThresholdInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThresholdInput.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/ThresholdInput.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC3D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,MAAM,EACN,QAAQ,GACT,EAAE,mBAAmB,eA8BrB"}
1
+ {"version":3,"file":"ThresholdInput.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/ThresholdInput.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC3D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,MAAM,EACN,QAAQ,GACT,EAAE,mBAAmB,GAAG,YAAY,CA8BpC"}
@@ -14,8 +14,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { useState } from 'react';
15
15
  import { Stack, FormLabel, TextField, IconButton, Box } from '@mui/material';
16
16
  import DeleteIcon from 'mdi-material-ui/DeleteOutline';
17
- import { ThresholdColorPicker } from './ThresholdColorPicker';
18
- export function ThresholdInput({ inputRef , label , color , value , mode , onChange , onColorChange , onBlur , onDelete }) {
17
+ import { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';
18
+ export function ThresholdInput({ inputRef, label, color, value, mode, onChange, onColorChange, onBlur, onDelete }) {
19
19
  const [key, setKey] = useState(0); // use key to cause input to lose focus when pressing enter
20
20
  return /*#__PURE__*/ _jsxs(Stack, {
21
21
  flex: 1,
@@ -24,7 +24,7 @@ export function ThresholdInput({ inputRef , label , color , value , mode , onCha
24
24
  justifyContent: "space-between",
25
25
  spacing: 1,
26
26
  children: [
27
- /*#__PURE__*/ _jsx(ThresholdColorPicker, {
27
+ /*#__PURE__*/ _jsx(OptionsColorPicker, {
28
28
  label: label,
29
29
  color: color,
30
30
  onColorChange: onColorChange
@@ -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,SAAoBA,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,KAAK,EAAEC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,GAAG,QAAQ,gBAAgB;AAC7E,OAAOC,gBAAgB,gCAAgC;AAEvD,SAASC,oBAAoB,QAAQ,yBAAyB;AAc9D,OAAO,SAASC,eAAe,EAC7BC,SAAQ,EACRC,MAAK,EACLC,MAAK,EACLC,MAAK,EACLC,KAAI,EACJC,SAAQ,EACRC,cAAa,EACbC,OAAM,EACNC,SAAQ,EACY;IACpB,MAAM,CAACC,KAAKC,OAAO,GAAGnB,SAAS,IAAI,2DAA2D;IAC9F,qBACE,MAACC;QAAMmB,MAAM;QAAGC,WAAU;QAAMC,YAAW;QAASC,gBAAe;QAAgBC,SAAS;;0BAC1F,KAACjB;gBAAqBG,OAAOA;gBAAOC,OAAOA;gBAAOI,eAAeA;;0BACjE,KAACb;gBAAUuB,SAASf;0BAAQA;;0BAC5B,KAACP;gBACCuB,IAAIhB;gBAEJD,UAAUA;gBACVkB,MAAK;gBACLf,OAAOA,UAAU,IAAI,KAAKA;gBAC1BgB,aAAY;gBACZd,UAAUA;gBACVE,QAAQA;gBACRa,WAAW,CAACC;oBACV,IAAIA,EAAEZ,QAAQ,SAAS;wBACrBF;wBACAG,OAAOD,MAAM;oBACf;gBACF;gBACAa,YAAY;oBACVC,cAAcnB,SAAS,0BAAY,KAACR;wBAAI4B,UAAU;kCAAG;yBAAUC;gBACjE;eAfKhB;0BAiBP,KAACd;gBAAW+B,cAAY,CAAC,iBAAiB,EAAEzB,MAAM,CAAC;gBAAE0B,MAAK;gBAAQC,SAASpB;0BACzE,cAAA,KAACX;;;;AAIT"}
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 { ReactElement, 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 { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';\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): ReactElement {\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 <OptionsColorPicker 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","OptionsColorPicker","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,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,KAAK,EAAEC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,GAAG,QAAQ,gBAAgB;AAC7E,OAAOC,gBAAgB,gCAAgC;AAEvD,SAASC,kBAAkB,QAAQ,oCAAoC;AAcvE,OAAO,SAASC,eAAe,EAC7BC,QAAQ,EACRC,KAAK,EACLC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACY;IACpB,MAAM,CAACC,KAAKC,OAAO,GAAGnB,SAAS,IAAI,2DAA2D;IAC9F,qBACE,MAACC;QAAMmB,MAAM;QAAGC,WAAU;QAAMC,YAAW;QAASC,gBAAe;QAAgBC,SAAS;;0BAC1F,KAACjB;gBAAmBG,OAAOA;gBAAOC,OAAOA;gBAAOI,eAAeA;;0BAC/D,KAACb;gBAAUuB,SAASf;0BAAQA;;0BAC5B,KAACP;gBACCuB,IAAIhB;gBAEJD,UAAUA;gBACVkB,MAAK;gBACLf,OAAOA,UAAU,IAAI,KAAKA;gBAC1BgB,aAAY;gBACZd,UAAUA;gBACVE,QAAQA;gBACRa,WAAW,CAACC;oBACV,IAAIA,EAAEZ,GAAG,KAAK,SAAS;wBACrBF;wBACAG,OAAOD,MAAM;oBACf;gBACF;gBACAa,YAAY;oBACVC,cAAcnB,SAAS,0BAAY,KAACR;wBAAI4B,UAAU;kCAAG;yBAAUC;gBACjE;eAfKhB;0BAiBP,KAACd;gBAAW+B,cAAY,CAAC,iBAAiB,EAAEzB,MAAM,CAAC;gBAAE0B,MAAK;gBAAQC,SAASpB;0BACzE,cAAA,KAACX;;;;AAIT"}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  import { ThresholdOptions } from '@perses-dev/core';
3
3
  export interface ThresholdsEditorProps {
4
4
  onChange: (thresholds: ThresholdOptions) => void;
@@ -6,5 +6,5 @@ export interface ThresholdsEditorProps {
6
6
  hideDefault?: boolean;
7
7
  disablePercentMode?: boolean;
8
8
  }
9
- export declare function ThresholdsEditor({ thresholds, onChange, hideDefault, disablePercentMode }: ThresholdsEditorProps): JSX.Element;
9
+ export declare function ThresholdsEditor({ thresholds, onChange, hideDefault, disablePercentMode, }: ThresholdsEditorProps): ReactElement;
10
10
  //# sourceMappingURL=ThresholdsEditor.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"ThresholdsEditor.d.ts","sourceRoot":"","sources":["../../src/ThresholdsEditor/ThresholdsEditor.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,YAAY,EAA+B,MAAM,OAAO,CAAC;AAKzE,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,EAC/B,UAAU,EACV,QAAQ,EACR,WAAW,EACX,kBAAkB,GACnB,EAAE,qBAAqB,GAAG,YAAY,CA4LtC"}
@@ -19,34 +19,32 @@ import { Stack } from '@mui/system';
19
19
  import { useChartsTheme } from '../context/ChartsProvider';
20
20
  import { OptionsEditorControl, OptionsEditorGroup } from '../OptionsEditorLayout';
21
21
  import { InfoTooltip } from '../InfoTooltip';
22
- import { ThresholdColorPicker } from './ThresholdColorPicker';
22
+ import { OptionsColorPicker } from '../ColorPicker/OptionsColorPicker';
23
23
  import { ThresholdInput } from './ThresholdInput';
24
24
  const DEFAULT_STEP = 10;
25
- export function ThresholdsEditor({ thresholds , onChange , hideDefault , disablePercentMode }) {
25
+ export function ThresholdsEditor({ thresholds, onChange, hideDefault, disablePercentMode }) {
26
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;
30
- const [steps, setSteps] = useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
27
+ const { thresholds: { defaultColor, palette } } = chartsTheme;
28
+ const defaultThresholdColor = thresholds?.defaultColor ?? defaultColor;
29
+ const [steps, setSteps] = useState(thresholds?.steps);
31
30
  useEffect(()=>{
32
- setSteps(thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps);
31
+ setSteps(thresholds?.steps);
33
32
  }, [
34
- thresholds === null || thresholds === void 0 ? void 0 : thresholds.steps
33
+ thresholds?.steps
35
34
  ]);
36
35
  // every time a new threshold is added, we want to focus the recently added input
37
36
  const recentlyAddedInputRef = useRef(null);
38
37
  const focusRef = useRef(false);
39
38
  useEffect(()=>{
40
- var _recentlyAddedInputRef_current;
41
39
  if (!recentlyAddedInputRef.current || !focusRef.current) return;
42
- (_recentlyAddedInputRef_current = recentlyAddedInputRef.current) === null || _recentlyAddedInputRef_current === void 0 ? void 0 : _recentlyAddedInputRef_current.focus();
40
+ recentlyAddedInputRef.current?.focus();
43
41
  focusRef.current = false;
44
42
  }, [
45
- steps === null || steps === void 0 ? void 0 : steps.length
43
+ steps?.length
46
44
  ]);
47
45
  const handleThresholdValueChange = (e, i)=>{
48
46
  setSteps(produce(steps, (draft)=>{
49
- const step = draft === null || draft === void 0 ? void 0 : draft[i];
47
+ const step = draft?.[i];
50
48
  if (step) {
51
49
  step.value = Number(e.target.value);
52
50
  }
@@ -120,14 +118,12 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
120
118
  } else {
121
119
  onChange(produce(thresholds, (draft)=>{
122
120
  const steps = draft.steps;
123
- if (steps === null || steps === void 0 ? void 0 : steps.length) {
121
+ if (steps?.length) {
124
122
  const lastStep = steps[steps.length - 1];
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;
123
+ const color = palette[steps.length] ?? getRandomColor(); // we will assign color from the palette first, then generate random color
128
124
  steps.push({
129
125
  color,
130
- value: ((_lastStep_value = lastStep === null || lastStep === void 0 ? void 0 : lastStep.value) !== null && _lastStep_value !== void 0 ? _lastStep_value : 0) + DEFAULT_STEP
126
+ value: (lastStep?.value ?? 0) + DEFAULT_STEP
131
127
  }); // set new threshold value to last step value + 10
132
128
  } else if (steps) {
133
129
  steps.push({
@@ -149,11 +145,10 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
149
145
  });
150
146
  }
151
147
  };
152
- var _thresholds_mode, _step_color, _ref;
153
148
  return /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
154
149
  title: "Thresholds",
155
150
  icon: /*#__PURE__*/ _jsx(InfoTooltip, {
156
- description: 'Add threshold',
151
+ description: "Add threshold",
157
152
  children: /*#__PURE__*/ _jsx(IconButton, {
158
153
  size: "small",
159
154
  "aria-label": "add threshold",
@@ -168,7 +163,7 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
168
163
  control: /*#__PURE__*/ _jsxs(ToggleButtonGroup, {
169
164
  exclusive: true,
170
165
  disabled: disablePercentMode,
171
- value: (_thresholds_mode = thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode) !== null && _thresholds_mode !== void 0 ? _thresholds_mode : 'absolute',
166
+ value: thresholds?.mode ?? 'absolute',
172
167
  onChange: handleModeChange,
173
168
  sx: {
174
169
  height: '36px',
@@ -194,13 +189,12 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
194
189
  ]
195
190
  })
196
191
  }),
197
- steps && steps.map((step, i)=>{
198
- /*#__PURE__*/ return _jsx(ThresholdInput, {
192
+ steps && steps.map((step, i)=>/*#__PURE__*/ _jsx(ThresholdInput, {
199
193
  inputRef: i === steps.length - 1 ? recentlyAddedInputRef : undefined,
200
194
  label: `T${i + 1}`,
201
- color: (_ref = (_step_color = step.color) !== null && _step_color !== void 0 ? _step_color : palette[i]) !== null && _ref !== void 0 ? _ref : defaultThresholdColor,
195
+ color: step.color ?? palette[i] ?? defaultThresholdColor,
202
196
  value: step.value,
203
- mode: thresholds === null || thresholds === void 0 ? void 0 : thresholds.mode,
197
+ mode: thresholds?.mode,
204
198
  onColorChange: (color)=>handleThresholdColorChange(color, i),
205
199
  onChange: (e)=>{
206
200
  handleThresholdValueChange(e, i);
@@ -209,15 +203,14 @@ export function ThresholdsEditor({ thresholds , onChange , hideDefault , disable
209
203
  deleteThreshold(i);
210
204
  },
211
205
  onBlur: handleThresholdBlur
212
- }, i);
213
- }).reverse(),
206
+ }, i)).reverse(),
214
207
  !hideDefault && /*#__PURE__*/ _jsxs(Stack, {
215
208
  flex: 1,
216
209
  direction: "row",
217
210
  alignItems: "center",
218
211
  spacing: 1,
219
212
  children: [
220
- /*#__PURE__*/ _jsx(ThresholdColorPicker, {
213
+ /*#__PURE__*/ _jsx(OptionsColorPicker, {
221
214
  label: "default",
222
215
  color: defaultThresholdColor,
223
216
  onColorChange: handleDefaultColorChange