@perses-dev/components 0.43.0 → 0.44.0-rc0

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 (346) hide show
  1. package/dist/BarChart/BarChart.d.ts +1 -2
  2. package/dist/BarChart/BarChart.d.ts.map +1 -1
  3. package/dist/BarChart/BarChart.js +2 -2
  4. package/dist/BarChart/BarChart.js.map +1 -1
  5. package/dist/ColorPicker/ColorPicker.d.ts +1 -2
  6. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  7. package/dist/ColorPicker/ColorPicker.js +1 -1
  8. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  9. package/dist/ContentWithLegend/ContentWithLegend.d.ts +1 -2
  10. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.js +2 -2
  12. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  13. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +2 -2
  14. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  15. package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -2
  16. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  17. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +1 -2
  18. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  19. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +2 -2
  20. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  21. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
  22. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  23. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
  24. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  25. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +1 -2
  26. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  27. package/dist/DateTimeRangePicker/TimeRangeSelector.js +2 -2
  28. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  29. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  30. package/dist/Dialog/Dialog.d.ts +6 -6
  31. package/dist/Dialog/Dialog.d.ts.map +1 -1
  32. package/dist/Dialog/Dialog.js +5 -5
  33. package/dist/Dialog/Dialog.js.map +1 -1
  34. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +1 -2
  35. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  36. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  37. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  38. package/dist/Drawer/Drawer.d.ts +1 -2
  39. package/dist/Drawer/Drawer.d.ts.map +1 -1
  40. package/dist/Drawer/Drawer.js +1 -1
  41. package/dist/Drawer/Drawer.js.map +1 -1
  42. package/dist/EChart/EChart.d.ts +7 -7
  43. package/dist/EChart/EChart.d.ts.map +1 -1
  44. package/dist/EChart/EChart.js +1 -1
  45. package/dist/EChart/EChart.js.map +1 -1
  46. package/dist/ErrorAlert.d.ts +1 -2
  47. package/dist/ErrorAlert.d.ts.map +1 -1
  48. package/dist/ErrorAlert.js +1 -1
  49. package/dist/ErrorAlert.js.map +1 -1
  50. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -3
  51. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  52. package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
  53. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  54. package/dist/FormatControls/FormatControls.d.ts +1 -2
  55. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  56. package/dist/FormatControls/FormatControls.js +2 -2
  57. package/dist/FormatControls/FormatControls.js.map +1 -1
  58. package/dist/GaugeChart/GaugeChart.d.ts +3 -4
  59. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  60. package/dist/GaugeChart/GaugeChart.js +1 -1
  61. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  62. package/dist/InfoTooltip/InfoTooltip.d.ts +2 -2
  63. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  64. package/dist/InfoTooltip/InfoTooltip.js +4 -4
  65. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  66. package/dist/JSONEditor.d.ts +2 -3
  67. package/dist/JSONEditor.d.ts.map +1 -1
  68. package/dist/JSONEditor.js.map +1 -1
  69. package/dist/Legend/CompactLegend.d.ts +1 -2
  70. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  71. package/dist/Legend/CompactLegend.js +1 -1
  72. package/dist/Legend/CompactLegend.js.map +1 -1
  73. package/dist/Legend/Legend.d.ts +1 -2
  74. package/dist/Legend/Legend.d.ts.map +1 -1
  75. package/dist/Legend/Legend.js +1 -1
  76. package/dist/Legend/Legend.js.map +1 -1
  77. package/dist/Legend/LegendColorBadge.js +1 -1
  78. package/dist/Legend/LegendColorBadge.js.map +1 -1
  79. package/dist/Legend/ListLegend.d.ts +1 -2
  80. package/dist/Legend/ListLegend.d.ts.map +1 -1
  81. package/dist/Legend/ListLegend.js +1 -1
  82. package/dist/Legend/ListLegend.js.map +1 -1
  83. package/dist/Legend/ListLegendItem.d.ts +2 -2
  84. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  85. package/dist/Legend/ListLegendItem.js +5 -9
  86. package/dist/Legend/ListLegendItem.js.map +1 -1
  87. package/dist/Legend/TableLegend.d.ts +1 -2
  88. package/dist/Legend/TableLegend.d.ts.map +1 -1
  89. package/dist/Legend/TableLegend.js +2 -2
  90. package/dist/Legend/TableLegend.js.map +1 -1
  91. package/dist/Legend/legend-model.d.ts +2 -2
  92. package/dist/Legend/legend-model.d.ts.map +1 -1
  93. package/dist/Legend/legend-model.js.map +1 -1
  94. package/dist/LineChart/LineChart.js +9 -11
  95. package/dist/LineChart/LineChart.js.map +1 -1
  96. package/dist/ModeSelector/ModeSelector.d.ts +2 -3
  97. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  98. package/dist/ModeSelector/ModeSelector.js +2 -2
  99. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  100. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  101. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  102. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  103. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  104. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -3
  105. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  106. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  107. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  108. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  109. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  110. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  111. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  112. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  113. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  114. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  115. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  116. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -2
  117. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  118. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  119. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  120. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
  121. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  122. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
  123. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  124. package/dist/SortSelector/SortSelector.d.ts +2 -3
  125. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  126. package/dist/SortSelector/SortSelector.js +2 -2
  127. package/dist/SortSelector/SortSelector.js.map +1 -1
  128. package/dist/StatChart/StatChart.d.ts +1 -2
  129. package/dist/StatChart/StatChart.d.ts.map +1 -1
  130. package/dist/StatChart/StatChart.js +3 -3
  131. package/dist/StatChart/StatChart.js.map +1 -1
  132. package/dist/StatChart/calculateFontSize.js +2 -2
  133. package/dist/StatChart/calculateFontSize.js.map +1 -1
  134. package/dist/Table/InnerTable.d.ts +2 -2
  135. package/dist/Table/InnerTable.d.ts.map +1 -1
  136. package/dist/Table/InnerTable.js +2 -2
  137. package/dist/Table/InnerTable.js.map +1 -1
  138. package/dist/Table/Table.d.ts +1 -2
  139. package/dist/Table/Table.d.ts.map +1 -1
  140. package/dist/Table/Table.js +3 -3
  141. package/dist/Table/Table.js.map +1 -1
  142. package/dist/Table/TableBody.d.ts +2 -2
  143. package/dist/Table/TableBody.d.ts.map +1 -1
  144. package/dist/Table/TableCell.d.ts +1 -1
  145. package/dist/Table/TableCell.d.ts.map +1 -1
  146. package/dist/Table/TableCell.js +2 -2
  147. package/dist/Table/TableCell.js.map +1 -1
  148. package/dist/Table/TableCheckbox.d.ts +1 -2
  149. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  150. package/dist/Table/TableCheckbox.js +1 -1
  151. package/dist/Table/TableCheckbox.js.map +1 -1
  152. package/dist/Table/TableHead.d.ts +2 -2
  153. package/dist/Table/TableHead.d.ts.map +1 -1
  154. package/dist/Table/TableHeaderCell.d.ts +1 -2
  155. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  156. package/dist/Table/TableHeaderCell.js +1 -1
  157. package/dist/Table/TableHeaderCell.js.map +1 -1
  158. package/dist/Table/TableRow.d.ts +1 -1
  159. package/dist/Table/TableRow.d.ts.map +1 -1
  160. package/dist/Table/TableRow.js.map +1 -1
  161. package/dist/Table/VirtualizedTable.d.ts +2 -2
  162. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  163. package/dist/Table/VirtualizedTable.js +2 -2
  164. package/dist/Table/VirtualizedTable.js.map +1 -1
  165. package/dist/Table/VirtualizedTableContainer.d.ts +2 -2
  166. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  167. package/dist/Table/hooks/useTableKeyboardNav.d.ts +1 -1
  168. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  169. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  170. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  171. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
  172. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  173. package/dist/Table/model/table-model.d.ts +6 -6
  174. package/dist/Table/model/table-model.d.ts.map +1 -1
  175. package/dist/Table/model/table-model.js +2 -2
  176. package/dist/Table/model/table-model.js.map +1 -1
  177. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +1 -2
  178. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -1
  179. package/dist/ThresholdsEditor/ThresholdColorPicker.js +3 -3
  180. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  181. package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
  182. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  183. package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
  184. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  185. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -2
  186. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  187. package/dist/ThresholdsEditor/ThresholdsEditor.js +6 -5
  188. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  189. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  190. package/dist/TimeChart/TimeChart.js +10 -14
  191. package/dist/TimeChart/TimeChart.js.map +1 -1
  192. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  193. package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -5
  194. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  195. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -2
  196. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  197. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
  198. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  199. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +1 -2
  200. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  201. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  202. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  203. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +1 -2
  204. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  205. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  206. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  207. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +3 -3
  208. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  209. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +1 -2
  210. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  211. package/dist/TimeSeriesTooltip/TooltipContent.js +2 -2
  212. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  213. package/dist/TimeSeriesTooltip/TooltipHeader.js +2 -2
  214. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  215. package/dist/TimeSeriesTooltip/nearby-series.d.ts +1 -1
  216. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  217. package/dist/TimeSeriesTooltip/nearby-series.js +12 -9
  218. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  219. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +12 -25
  220. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  221. package/dist/TimeSeriesTooltip/tooltip-model.js +4 -10
  222. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  223. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  224. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  225. package/dist/TimeSeriesTooltip/utils.js +2 -1
  226. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  227. package/dist/YAxisLabel.d.ts +1 -2
  228. package/dist/YAxisLabel.d.ts.map +1 -1
  229. package/dist/YAxisLabel.js +1 -1
  230. package/dist/YAxisLabel.js.map +1 -1
  231. package/dist/cjs/BarChart/BarChart.js +2 -2
  232. package/dist/cjs/ColorPicker/ColorPicker.js +4 -2
  233. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
  234. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
  235. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +2 -2
  236. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
  237. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +2 -2
  238. package/dist/cjs/DateTimeRangePicker/utils.js +3 -3
  239. package/dist/cjs/Dialog/Dialog.js +5 -5
  240. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  241. package/dist/cjs/Drawer/Drawer.js +1 -1
  242. package/dist/cjs/EChart/EChart.js +4 -2
  243. package/dist/cjs/ErrorAlert.js +1 -1
  244. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +2 -2
  245. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  246. package/dist/cjs/GaugeChart/GaugeChart.js +1 -1
  247. package/dist/cjs/InfoTooltip/InfoTooltip.js +4 -4
  248. package/dist/cjs/Legend/CompactLegend.js +1 -1
  249. package/dist/cjs/Legend/Legend.js +1 -1
  250. package/dist/cjs/Legend/LegendColorBadge.js +1 -1
  251. package/dist/cjs/Legend/ListLegend.js +1 -1
  252. package/dist/cjs/Legend/ListLegendItem.js +8 -10
  253. package/dist/cjs/Legend/TableLegend.js +2 -2
  254. package/dist/cjs/LineChart/LineChart.js +9 -11
  255. package/dist/cjs/ModeSelector/ModeSelector.js +2 -2
  256. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  257. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  258. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  259. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  260. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
  261. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
  262. package/dist/cjs/SortSelector/SortSelector.js +2 -2
  263. package/dist/cjs/StatChart/StatChart.js +3 -3
  264. package/dist/cjs/StatChart/calculateFontSize.js +2 -2
  265. package/dist/cjs/Table/InnerTable.js +2 -2
  266. package/dist/cjs/Table/Table.js +3 -3
  267. package/dist/cjs/Table/TableCell.js +2 -2
  268. package/dist/cjs/Table/TableCheckbox.js +1 -1
  269. package/dist/cjs/Table/TableHeaderCell.js +1 -1
  270. package/dist/cjs/Table/VirtualizedTable.js +2 -2
  271. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  272. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
  273. package/dist/cjs/Table/model/table-model.js +2 -2
  274. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +3 -3
  275. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +1 -1
  276. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +9 -6
  277. package/dist/cjs/TimeChart/TimeChart.js +10 -14
  278. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +6 -5
  279. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -1
  280. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  281. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +1 -1
  282. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +3 -3
  283. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +2 -2
  284. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +2 -2
  285. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +22 -19
  286. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +31 -37
  287. package/dist/cjs/TimeSeriesTooltip/utils.js +2 -1
  288. package/dist/cjs/YAxisLabel.js +1 -1
  289. package/dist/cjs/context/ChartsProvider.js +4 -2
  290. package/dist/cjs/context/SnackbarProvider.js +1 -1
  291. package/dist/cjs/context/TimeZoneProvider.js +4 -2
  292. package/dist/cjs/model/graph.js +3 -3
  293. package/dist/cjs/test-utils/theme.js +3 -3
  294. package/dist/cjs/theme/component-overrides/alert.js +4 -4
  295. package/dist/cjs/theme/component-overrides/paper.js +1 -1
  296. package/dist/cjs/theme/palette/colors/common.js +3 -3
  297. package/dist/cjs/theme/theme.js +1 -1
  298. package/dist/cjs/utils/axis.js +3 -3
  299. package/dist/cjs/utils/chart-actions.js +21 -19
  300. package/dist/cjs/utils/format.js +3 -3
  301. package/dist/cjs/utils/mathjs.js +1 -1
  302. package/dist/cjs/utils/theme-gen.js +1 -1
  303. package/dist/context/ChartsProvider.d.ts +1 -1
  304. package/dist/context/ChartsProvider.d.ts.map +1 -1
  305. package/dist/context/ChartsProvider.js +1 -1
  306. package/dist/context/ChartsProvider.js.map +1 -1
  307. package/dist/context/SnackbarProvider.d.ts +2 -2
  308. package/dist/context/SnackbarProvider.d.ts.map +1 -1
  309. package/dist/context/SnackbarProvider.js +1 -1
  310. package/dist/context/SnackbarProvider.js.map +1 -1
  311. package/dist/context/TimeZoneProvider.d.ts +1 -1
  312. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  313. package/dist/context/TimeZoneProvider.js +1 -1
  314. package/dist/context/TimeZoneProvider.js.map +1 -1
  315. package/dist/model/graph.d.ts +8 -8
  316. package/dist/model/graph.d.ts.map +1 -1
  317. package/dist/model/theme.d.ts +1 -1
  318. package/dist/model/theme.d.ts.map +1 -1
  319. package/dist/model/theme.js.map +1 -1
  320. package/dist/model/timeOption.js.map +1 -1
  321. package/dist/test/setup-tests.js.map +1 -1
  322. package/dist/theme/component-overrides/alert.js +4 -4
  323. package/dist/theme/component-overrides/alert.js.map +1 -1
  324. package/dist/theme/component-overrides/paper.js +1 -1
  325. package/dist/theme/component-overrides/paper.js.map +1 -1
  326. package/dist/theme/palette/colors/types.d.ts +1 -1
  327. package/dist/theme/palette/colors/types.d.ts.map +1 -1
  328. package/dist/theme/palette/colors/types.js.map +1 -1
  329. package/dist/theme/theme.js +1 -1
  330. package/dist/theme/theme.js.map +1 -1
  331. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  332. package/dist/utils/axis.js.map +1 -1
  333. package/dist/utils/chart-actions.d.ts +1 -1
  334. package/dist/utils/chart-actions.d.ts.map +1 -1
  335. package/dist/utils/chart-actions.js +9 -7
  336. package/dist/utils/chart-actions.js.map +1 -1
  337. package/dist/utils/combine-sx.js.map +1 -1
  338. package/dist/utils/component-ids.js.map +1 -1
  339. package/dist/utils/format.js.map +1 -1
  340. package/dist/utils/mathjs.js +1 -1
  341. package/dist/utils/mathjs.js.map +1 -1
  342. package/dist/utils/theme-gen.d.ts +1 -1
  343. package/dist/utils/theme-gen.d.ts.map +1 -1
  344. package/dist/utils/theme-gen.js +1 -1
  345. package/dist/utils/theme-gen.js.map +1 -1
  346. package/package.json +4 -4
@@ -36,7 +36,7 @@ const SERIES_NAME_FONT_WEIGHT = 400;
36
36
  const VALUE_FONT_WEIGHT = 700;
37
37
  export function StatChart(props) {
38
38
  var _data_seriesData, _data_seriesData1;
39
- const { width , height , data , format , color , sparkline , showSeriesName , valueFontSize } = props;
39
+ const { width, height, data, format, color, sparkline, showSeriesName, valueFontSize } = props;
40
40
  const chartsTheme = useChartsTheme();
41
41
  let formattedValue = '';
42
42
  if (data.calculatedValue === null) {
@@ -170,7 +170,7 @@ export function StatChart(props) {
170
170
  }
171
171
  const SeriesName = styled(Typography, {
172
172
  shouldForwardProp: (prop)=>prop !== 'padding' && prop !== 'fontSize'
173
- })(({ theme , padding , fontSize })=>({
173
+ })(({ theme, padding, fontSize })=>({
174
174
  color: theme.palette.text.secondary,
175
175
  padding: `${padding}px`,
176
176
  fontSize: `${fontSize}px`,
@@ -180,7 +180,7 @@ const SeriesName = styled(Typography, {
180
180
  }));
181
181
  const Value = styled(Typography, {
182
182
  shouldForwardProp: (prop)=>prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline'
183
- })(({ theme , color , padding , fontSize , sparkline })=>({
183
+ })(({ theme, color, padding, fontSize, sparkline })=>({
184
184
  color: color !== null && color !== void 0 ? color : theme.palette.text.primary,
185
185
  fontSize: `${fontSize}px`,
186
186
  padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/StatChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\nimport { Box, Typography, styled } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { LineChart as EChartsLineChart, LineSeriesOption } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { EChart } from '../EChart';\nimport { GraphSeries } from '../model/graph';\nimport { FontSizeOption } from '../FontSizeSelector';\nimport { useOptimalFontSize } from './calculateFontSize';\n\nuse([EChartsLineChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst LINE_HEIGHT = 1.2;\nconst SERIES_NAME_MAX_FONT_SIZE = 30;\nconst SERIES_NAME_FONT_WEIGHT = 400;\nconst VALUE_FONT_WEIGHT = 700;\n\nexport interface StatChartData {\n calculatedValue?: number | null;\n seriesData?: GraphSeries;\n}\n\nexport interface StatChartProps {\n width: number;\n height: number;\n data: StatChartData;\n format: FormatOptions;\n color?: string;\n sparkline?: LineSeriesOption;\n showSeriesName?: boolean;\n valueFontSize?: FontSizeOption;\n}\n\nexport function StatChart(props: StatChartProps) {\n const { width, height, data, format, color, sparkline, showSeriesName, valueFontSize } = props;\n const chartsTheme = useChartsTheme();\n\n let formattedValue = '';\n if (data.calculatedValue === null) {\n formattedValue = 'null';\n } else if (typeof data.calculatedValue === 'number') {\n formattedValue = formatValue(data.calculatedValue, format);\n }\n\n const containerPadding = chartsTheme.container.padding.default;\n\n // calculate series name font size and height\n let seriesNameFontSize = useOptimalFontSize({\n text: data?.seriesData?.name ?? '',\n fontWeight: SERIES_NAME_FONT_WEIGHT,\n width,\n height: height * 0.125, // assume series name will take 12.5% of available height\n lineHeight: LINE_HEIGHT,\n maxSize: SERIES_NAME_MAX_FONT_SIZE,\n });\n const seriesNameHeight = showSeriesName ? seriesNameFontSize * LINE_HEIGHT + containerPadding : 0;\n\n // calculate value font size and height\n const availableWidth = width - containerPadding * 2;\n const availableHeight = height - seriesNameHeight;\n const optimalValueFontSize = useOptimalFontSize({\n text: formattedValue,\n // override the font size if user selects it in the settings\n fontSizeOverride: valueFontSize,\n fontWeight: VALUE_FONT_WEIGHT,\n // without sparkline, use only 50% of the available width so it looks better for multiseries\n width: sparkline ? availableWidth : availableWidth * 0.5,\n // with sparkline, use only 25% of available height to leave room for chart\n // without sparkline, value should take up 90% of available space\n height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,\n lineHeight: LINE_HEIGHT,\n });\n const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;\n\n // make sure the series name font size is slightly smaller than value font size\n seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.seriesData === undefined) return chartsTheme.noDataOption;\n\n const series = data.seriesData;\n const statSeries: LineSeriesOption[] = [];\n\n if (sparkline !== undefined) {\n const lineSeries = {\n type: 'line',\n name: series.name,\n data: series.values,\n zlevel: 1,\n symbol: 'none',\n animation: false,\n silent: true,\n };\n const mergedSeries = merge(lineSeries, sparkline);\n statSeries.push(mergedSeries);\n }\n\n const option = {\n title: {\n show: false,\n },\n grid: {\n show: false,\n top: '35%', // adds space above sparkline\n right: 0,\n bottom: 0,\n left: 0,\n containLabel: false,\n },\n xAxis: {\n type: 'time',\n show: false,\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n show: false,\n min: (value: { min: number; max: number }) => {\n if (value.min >= 0 && value.min <= 1) {\n // helps with percent-decimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n return value.min;\n },\n },\n tooltip: {\n show: false,\n },\n series: statSeries,\n };\n\n return option;\n }, [data, chartsTheme, sparkline]);\n\n const textAlignment = sparkline ? 'auto' : 'center';\n const textStyles = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: textAlignment,\n alignItems: textAlignment,\n };\n\n return (\n <Box sx={{ height: '100%', width: '100%', ...textStyles }}>\n {showSeriesName && (\n <SeriesName padding={containerPadding} fontSize={seriesNameFontSize}>\n {data.seriesData?.name}\n </SeriesName>\n )}\n <Value variant=\"h3\" color={color} fontSize={optimalValueFontSize} padding={containerPadding}>\n {formattedValue}\n </Value>\n {sparkline !== undefined && (\n <EChart\n sx={{\n width: '100%',\n height: height - seriesNameHeight - valueFontHeight,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n renderer=\"svg\"\n />\n )}\n </Box>\n );\n}\n\nconst SeriesName = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'padding' && prop !== 'fontSize',\n})<{ padding?: number; fontSize?: number; textAlignment?: string }>(({ theme, padding, fontSize }) => ({\n color: theme.palette.text.secondary,\n padding: `${padding}px`,\n fontSize: `${fontSize}px`,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}));\n\nconst Value = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline',\n})<{ color?: string; padding?: number; fontSize?: number; sparkline?: boolean }>(\n ({ theme, color, padding, fontSize, sparkline }) => ({\n color: color ?? theme.palette.text.primary,\n fontSize: `${fontSize}px`,\n padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,\n whiteSpace: 'nowrap',\n lineHeight: LINE_HEIGHT,\n })\n);\n"],"names":["useMemo","formatValue","Box","Typography","styled","merge","use","LineChart","EChartsLineChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","useOptimalFontSize","LINE_HEIGHT","SERIES_NAME_MAX_FONT_SIZE","SERIES_NAME_FONT_WEIGHT","VALUE_FONT_WEIGHT","StatChart","props","data","width","height","format","color","sparkline","showSeriesName","valueFontSize","chartsTheme","formattedValue","calculatedValue","containerPadding","container","padding","default","seriesNameFontSize","text","seriesData","name","fontWeight","lineHeight","maxSize","seriesNameHeight","availableWidth","availableHeight","optimalValueFontSize","fontSizeOverride","valueFontHeight","Math","min","option","undefined","noDataOption","series","statSeries","lineSeries","type","values","zlevel","symbol","animation","silent","mergedSeries","push","title","show","grid","top","right","bottom","left","containLabel","xAxis","boundaryGap","yAxis","value","tooltip","textAlignment","textStyles","display","flexDirection","justifyContent","alignItems","sx","SeriesName","fontSize","Value","variant","theme","echartsTheme","renderer","shouldForwardProp","prop","palette","secondary","overflow","textOverflow","whiteSpace","primary"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,WAAW,QAAuB,mBAAmB;AAC9D,SAASC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACxD,OAAOC,WAAW,eAAe;AACjC,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,aAAaC,gBAAgB,QAA0B,iBAAiB;AACjF,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACvG,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,MAAM,QAAQ,YAAY;AAGnC,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzDV,IAAI;IAACE;IAAkBC;IAAeC;IAAkBC;IAAgBC;IAAkBC;CAAe;AAEzG,MAAMI,cAAc;AACpB,MAAMC,4BAA4B;AAClC,MAAMC,0BAA0B;AAChC,MAAMC,oBAAoB;AAkB1B,OAAO,SAASC,UAAUC,KAAqB;QAerCC,kBAkGCA;IAhHT,MAAM,EAAEC,MAAK,EAAEC,OAAM,EAAEF,KAAI,EAAEG,OAAM,EAAEC,MAAK,EAAEC,UAAS,EAAEC,eAAc,EAAEC,cAAa,EAAE,GAAGR;IACzF,MAAMS,cAAcjB;IAEpB,IAAIkB,iBAAiB;IACrB,IAAIT,KAAKU,oBAAoB,MAAM;QACjCD,iBAAiB;IACnB,OAAO,IAAI,OAAOT,KAAKU,oBAAoB,UAAU;QACnDD,iBAA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E,CAAC,EAAEJ,MAAK,EAAEvD,QAAO,EAAEoD,SAAQ,EAAE,GAAM,CAAA;QACrG7D,OAAOgE,MAAMK,QAAQzD,KAAK0D;QAC1B7D,SAAS,CAAC,EAAEA,QAAQ,EAAE,CAAC;QACvBoD,UAAU,CAAC,EAAEA,SAAS,EAAE,CAAC;QACzBU,UAAU;QACVC,cAAc;QACdC,YAAY;IACd,CAAA;AAEA,MAAMX,QAAQrF,OAAOD,YAAY;IAC/B2F,mBAAmB,CAACC,OAASA,SAAS,WAAWA,SAAS,aAAaA,SAAS,cAAcA,SAAS;AACzG,GACE,CAAC,EAAEJ,MAAK,EAAEhE,MAAK,EAAES,QAAO,EAAEoD,SAAQ,EAAE5D,UAAS,EAAE,GAAM,CAAA;QACnDD,OAAOA,kBAAAA,mBAAAA,QAASgE,MAAMK,QAAQzD,KAAK8D;QACnCb,UAAU,CAAC,EAAEA,SAAS,EAAE,CAAC;QACzBpD,SAASR,YAAY,CAAC,EAAEQ,QAAQ,GAAG,EAAEA,QAAQ,KAAK,EAAEA,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAEA,QAAQ,EAAE,CAAC;QACnFgE,YAAY;QACZzD,YAAY1B;IACd,CAAA"}
1
+ {"version":3,"sources":["../../src/StatChart/StatChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { formatValue, FormatOptions } from '@perses-dev/core';\nimport { Box, Typography, styled } from '@mui/material';\nimport merge from 'lodash/merge';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { LineChart as EChartsLineChart, LineSeriesOption } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { EChart } from '../EChart';\nimport { GraphSeries } from '../model/graph';\nimport { FontSizeOption } from '../FontSizeSelector';\nimport { useOptimalFontSize } from './calculateFontSize';\n\nuse([EChartsLineChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst LINE_HEIGHT = 1.2;\nconst SERIES_NAME_MAX_FONT_SIZE = 30;\nconst SERIES_NAME_FONT_WEIGHT = 400;\nconst VALUE_FONT_WEIGHT = 700;\n\nexport interface StatChartData {\n calculatedValue?: number | null;\n seriesData?: GraphSeries;\n}\n\nexport interface StatChartProps {\n width: number;\n height: number;\n data: StatChartData;\n format: FormatOptions;\n color?: string;\n sparkline?: LineSeriesOption;\n showSeriesName?: boolean;\n valueFontSize?: FontSizeOption;\n}\n\nexport function StatChart(props: StatChartProps) {\n const { width, height, data, format, color, sparkline, showSeriesName, valueFontSize } = props;\n const chartsTheme = useChartsTheme();\n\n let formattedValue = '';\n if (data.calculatedValue === null) {\n formattedValue = 'null';\n } else if (typeof data.calculatedValue === 'number') {\n formattedValue = formatValue(data.calculatedValue, format);\n }\n\n const containerPadding = chartsTheme.container.padding.default;\n\n // calculate series name font size and height\n let seriesNameFontSize = useOptimalFontSize({\n text: data?.seriesData?.name ?? '',\n fontWeight: SERIES_NAME_FONT_WEIGHT,\n width,\n height: height * 0.125, // assume series name will take 12.5% of available height\n lineHeight: LINE_HEIGHT,\n maxSize: SERIES_NAME_MAX_FONT_SIZE,\n });\n const seriesNameHeight = showSeriesName ? seriesNameFontSize * LINE_HEIGHT + containerPadding : 0;\n\n // calculate value font size and height\n const availableWidth = width - containerPadding * 2;\n const availableHeight = height - seriesNameHeight;\n const optimalValueFontSize = useOptimalFontSize({\n text: formattedValue,\n // override the font size if user selects it in the settings\n fontSizeOverride: valueFontSize,\n fontWeight: VALUE_FONT_WEIGHT,\n // without sparkline, use only 50% of the available width so it looks better for multiseries\n width: sparkline ? availableWidth : availableWidth * 0.5,\n // with sparkline, use only 25% of available height to leave room for chart\n // without sparkline, value should take up 90% of available space\n height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,\n lineHeight: LINE_HEIGHT,\n });\n const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;\n\n // make sure the series name font size is slightly smaller than value font size\n seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.seriesData === undefined) return chartsTheme.noDataOption;\n\n const series = data.seriesData;\n const statSeries: LineSeriesOption[] = [];\n\n if (sparkline !== undefined) {\n const lineSeries = {\n type: 'line',\n name: series.name,\n data: series.values,\n zlevel: 1,\n symbol: 'none',\n animation: false,\n silent: true,\n };\n const mergedSeries = merge(lineSeries, sparkline);\n statSeries.push(mergedSeries);\n }\n\n const option = {\n title: {\n show: false,\n },\n grid: {\n show: false,\n top: '35%', // adds space above sparkline\n right: 0,\n bottom: 0,\n left: 0,\n containLabel: false,\n },\n xAxis: {\n type: 'time',\n show: false,\n boundaryGap: false,\n },\n yAxis: {\n type: 'value',\n show: false,\n min: (value: { min: number; max: number }) => {\n if (value.min >= 0 && value.min <= 1) {\n // helps with percent-decimal units, or datasets that return 0 or 1 booleans\n return 0;\n }\n return value.min;\n },\n },\n tooltip: {\n show: false,\n },\n series: statSeries,\n };\n\n return option;\n }, [data, chartsTheme, sparkline]);\n\n const textAlignment = sparkline ? 'auto' : 'center';\n const textStyles = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: textAlignment,\n alignItems: textAlignment,\n };\n\n return (\n <Box sx={{ height: '100%', width: '100%', ...textStyles }}>\n {showSeriesName && (\n <SeriesName padding={containerPadding} fontSize={seriesNameFontSize}>\n {data.seriesData?.name}\n </SeriesName>\n )}\n <Value variant=\"h3\" color={color} fontSize={optimalValueFontSize} padding={containerPadding}>\n {formattedValue}\n </Value>\n {sparkline !== undefined && (\n <EChart\n sx={{\n width: '100%',\n height: height - seriesNameHeight - valueFontHeight,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n renderer=\"svg\"\n />\n )}\n </Box>\n );\n}\n\nconst SeriesName = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'padding' && prop !== 'fontSize',\n})<{ padding?: number; fontSize?: number; textAlignment?: string }>(({ theme, padding, fontSize }) => ({\n color: theme.palette.text.secondary,\n padding: `${padding}px`,\n fontSize: `${fontSize}px`,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}));\n\nconst Value = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'color' && prop !== 'padding' && prop !== 'fontSize' && prop !== 'sparkline',\n})<{ color?: string; padding?: number; fontSize?: number; sparkline?: boolean }>(\n ({ theme, color, padding, fontSize, sparkline }) => ({\n color: color ?? theme.palette.text.primary,\n fontSize: `${fontSize}px`,\n padding: sparkline ? `${padding}px ${padding}px 0 ${padding}px` : ` 0 ${padding}px`,\n whiteSpace: 'nowrap',\n lineHeight: LINE_HEIGHT,\n })\n);\n"],"names":["useMemo","formatValue","Box","Typography","styled","merge","use","LineChart","EChartsLineChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","useChartsTheme","EChart","useOptimalFontSize","LINE_HEIGHT","SERIES_NAME_MAX_FONT_SIZE","SERIES_NAME_FONT_WEIGHT","VALUE_FONT_WEIGHT","StatChart","props","data","width","height","format","color","sparkline","showSeriesName","valueFontSize","chartsTheme","formattedValue","calculatedValue","containerPadding","container","padding","default","seriesNameFontSize","text","seriesData","name","fontWeight","lineHeight","maxSize","seriesNameHeight","availableWidth","availableHeight","optimalValueFontSize","fontSizeOverride","valueFontHeight","Math","min","option","undefined","noDataOption","series","statSeries","lineSeries","type","values","zlevel","symbol","animation","silent","mergedSeries","push","title","show","grid","top","right","bottom","left","containLabel","xAxis","boundaryGap","yAxis","value","tooltip","textAlignment","textStyles","display","flexDirection","justifyContent","alignItems","sx","SeriesName","fontSize","Value","variant","theme","echartsTheme","renderer","shouldForwardProp","prop","palette","secondary","overflow","textOverflow","whiteSpace","primary"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,WAAW,QAAuB,mBAAmB;AAC9D,SAASC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACxD,OAAOC,WAAW,eAAe;AACjC,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,aAAaC,gBAAgB,QAA0B,iBAAiB;AACjF,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACvG,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,MAAM,QAAQ,YAAY;AAGnC,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzDV,IAAI;IAACE;IAAkBC;IAAeC;IAAkBC;IAAgBC;IAAkBC;CAAe;AAEzG,MAAMI,cAAc;AACpB,MAAMC,4BAA4B;AAClC,MAAMC,0BAA0B;AAChC,MAAMC,oBAAoB;AAkB1B,OAAO,SAASC,UAAUC,KAAqB;QAerCC,kBAkGCA;IAhHT,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEF,IAAI,EAAEG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,cAAc,EAAEC,aAAa,EAAE,GAAGR;IACzF,MAAMS,cAAcjB;IAEpB,IAAIkB,iBAAiB;IACrB,IAAIT,KAAKU,eAAe,KAAK,MAAM;QACjCD,iBAAiB;IACnB,OAAO,IAAI,OAAOT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AEA,MAAMN,aAAanF,OAAOD,YAAY;IACpC2F,mBAAmB,CAACC,OAASA,SAAS,aAAaA,SAAS;AAC9D,GAAoE,CAAC,EAAEJ,KAAK,EAAEvD,OAAO,EAAEoD,QAAQ,EAAE,GAAM,CAAA;QACrG7D,OAAOgE,MAAMK,OAAO,CAACzD,IAAI,CAAC0D,SAAS;QACnC7D,SAAS,CAAC,EAAEA,QAAQ,EAAE,CAAC;QACvBoD,UAAU,CAAC,EAAEA,SAAS,EAAE,CAAC;QACzBU,UAAU;QACVC,cAAc;QACdC,YAAY;IACd,CAAA;AAEA,MAAMX,QAAQrF,OAAOD,YAAY;IAC/B2F,mBAAmB,CAACC,OAASA,SAAS,WAAWA,SAAS,aAAaA,SAAS,cAAcA,SAAS;AACzG,GACE,CAAC,EAAEJ,KAAK,EAAEhE,KAAK,EAAES,OAAO,EAAEoD,QAAQ,EAAE5D,SAAS,EAAE,GAAM,CAAA;QACnDD,OAAOA,kBAAAA,mBAAAA,QAASgE,MAAMK,OAAO,CAACzD,IAAI,CAAC8D,OAAO;QAC1Cb,UAAU,CAAC,EAAEA,SAAS,EAAE,CAAC;QACzBpD,SAASR,YAAY,CAAC,EAAEQ,QAAQ,GAAG,EAAEA,QAAQ,KAAK,EAAEA,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAEA,QAAQ,EAAE,CAAC;QACnFgE,YAAY;QACZzD,YAAY1B;IACd,CAAA"}
@@ -23,9 +23,9 @@ function getGlobalCanvasContext() {
23
23
  }
24
24
  /**
25
25
  * Find the optimal font size given available space
26
- */ export function useOptimalFontSize({ text , fontWeight , width , height , lineHeight , maxSize , fontSizeOverride }) {
26
+ */ export function useOptimalFontSize({ text, fontWeight, width, height, lineHeight, maxSize, fontSizeOverride }) {
27
27
  const ctx = getGlobalCanvasContext();
28
- const { echartsTheme } = useChartsTheme();
28
+ const { echartsTheme } = useChartsTheme();
29
29
  // if user has selected a font size in the settings, use it instead of calculating the optimal size
30
30
  if (fontSizeOverride !== undefined) {
31
31
  return Number(fontSizeOverride);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/StatChart/calculateFontSize.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext() {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize) {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,QAAQ,4BAA4B;AAa3D,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,cAAc,UAAUC,WAAW;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,KAAI,EACJC,WAAU,EACVC,MAAK,EACLC,OAAM,EACNC,WAAU,EACVC,QAAO,EACPC,iBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,aAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG;QACdD;IAAjB,MAAME,WAAWF,CAAAA,UAAAA,OAAOC,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWC,uBAAlBF,qBAAAA,UAA+B;QAC7BC;IAAnB,MAAME,aAAaF,CAAAA,wBAAAA,sBAAAA,uBAAAA,KAAAA,IAAAA,UAAWE,wBAAXF,mCAAAA,wBAAyB;IAE5C,qCAAqC;IACrC,MAAMG,YAAY,CAAC,EAAEb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,WAAW,CAAC;IAC7DN,IAAIQ,OAAOD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,YAAYjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,QAASU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,IAAIH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,IAAIF,eAAef,WAAWe;AACtD"}
1
+ {"version":3,"sources":["../../src/StatChart/calculateFontSize.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext() {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize) {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,QAAQ,4BAA4B;AAa3D,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,aAAa,CAAC,UAAUC,UAAU,CAAC;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,YAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG,SAAS;QACvBD;IAAjB,MAAME,WAAWF,CAAAA,UAAAA,OAAOC,sBAAAA,gCAAAA,UAAWC,QAAQ,eAA1BF,qBAAAA,UAA+B;QAC7BC;IAAnB,MAAME,aAAaF,CAAAA,wBAAAA,sBAAAA,gCAAAA,UAAWE,UAAU,cAArBF,mCAAAA,wBAAyB;IAE5C,qCAAqC;IACrC,MAAMG,YAAY,CAAC,EAAEb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,WAAW,CAAC;IAC7DN,IAAIQ,IAAI,GAAGD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,WAAW,CAACjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,KAAK,GAAIU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,GAAG,CAACH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,GAAG,CAACF,eAAef,WAAWe;AACtD"}
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { TableProps as MuiTableProps } from '@mui/material';
3
3
  import { TableDensity } from './model/table-model';
4
- declare type InnerTableProps = Omit<MuiTableProps, 'size'> & {
4
+ type InnerTableProps = Omit<MuiTableProps, 'size'> & {
5
5
  density: TableDensity;
6
6
  };
7
- export declare const InnerTable: import("react").ForwardRefExoticComponent<Pick<InnerTableProps, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "slot" | "summary" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "width" | "border" | "bgcolor" | "padding" | "align" | "cellPadding" | "cellSpacing" | "frame" | "rules" | "density" | "stickyHeader"> & import("react").RefAttributes<HTMLTableElement>>;
7
+ export declare const InnerTable: import("react").ForwardRefExoticComponent<Omit<InnerTableProps, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
8
8
  export {};
9
9
  //# sourceMappingURL=InnerTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InnerTable.d.ts","sourceRoot":"","sources":["../../src/Table/InnerTable.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,UAAU,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,aAAK,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG;IACnD,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAOF,eAAO,MAAM,UAAU,8yJAerB,CAAC"}
1
+ {"version":3,"file":"InnerTable.d.ts","sourceRoot":"","sources":["../../src/Table/InnerTable.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,UAAU,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,KAAK,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG;IACnD,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAOF,eAAO,MAAM,UAAU,2HAerB,CAAC"}
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Table as MuiTable, styled } from '@mui/material';
15
15
  import { forwardRef } from 'react';
16
- const StyledMuiTable = styled(MuiTable)(({ theme })=>({
16
+ const StyledMuiTable = styled(MuiTable)(({ theme })=>({
17
17
  // This value is needed to have a consistent table layout when scrolling.
18
18
  tableLayout: 'fixed',
19
19
  borderCollapse: 'separate',
@@ -23,7 +23,7 @@ const TABLE_DENSITY_CONFIG = {
23
23
  compact: 'small',
24
24
  standard: 'medium'
25
25
  };
26
- export const InnerTable = /*#__PURE__*/ forwardRef(function InnerTable({ density , ...otherProps }, ref) {
26
+ export const InnerTable = /*#__PURE__*/ forwardRef(function InnerTable({ density, ...otherProps }, ref) {
27
27
  return /*#__PURE__*/ _jsx(StyledMuiTable, {
28
28
  ...otherProps,
29
29
  tabIndex: -1,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/InnerTable.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 { Table as MuiTable, styled, TableProps as MuiTableProps } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\nconst StyledMuiTable = styled(MuiTable)(({ theme }) => ({\n // This value is needed to have a consistent table layout when scrolling.\n tableLayout: 'fixed',\n borderCollapse: 'separate',\n backgroundColor: theme.palette.background.default,\n}));\n\ntype InnerTableProps = Omit<MuiTableProps, 'size'> & {\n density: TableDensity;\n};\n\nconst TABLE_DENSITY_CONFIG: Record<TableDensity, MuiTableProps['size']> = {\n compact: 'small',\n standard: 'medium',\n};\n\nexport const InnerTable = forwardRef<HTMLTableElement, InnerTableProps>(function InnerTable(\n { density, ...otherProps },\n ref\n) {\n return (\n <StyledMuiTable\n {...otherProps}\n tabIndex={-1}\n size={TABLE_DENSITY_CONFIG[density]}\n ref={ref}\n sx={{\n width: '100%',\n }}\n />\n );\n});\n"],"names":["Table","MuiTable","styled","forwardRef","StyledMuiTable","theme","tableLayout","borderCollapse","backgroundColor","palette","background","default","TABLE_DENSITY_CONFIG","compact","standard","InnerTable","density","otherProps","ref","tabIndex","size","sx","width"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAASC,QAAQ,EAAEC,MAAM,QAAqC,gBAAgB;AACvF,SAASC,UAAU,QAAQ,QAAQ;AAGnC,MAAMC,iBAAiBF,OAAOD,UAAU,CAAC,EAAEI,MAAK,EAAE,GAAM,CAAA;QACtD,yEAAyE;QACzEC,aAAa;QACbC,gBAAgB;QAChBC,iBAAiBH,MAAMI,QAAQC,WAAWC;IAC5C,CAAA;AAMA,MAAMC,uBAAoE;IACxEC,SAAS;IACTC,UAAU;AACZ;AAEA,OAAO,MAAMC,2BAAaZ,WAA8C,SAASY,WAC/E,EAAEC,QAAO,EAAE,GAAGC,YAAY,EAC1BC,GAAG;IAEH,qBACE,KAACd;QACE,GAAGa,UAAU;QACdE,UAAU,CAAC;QACXC,MAAMR,oBAAoB,CAACI,QAAQ;QACnCE,KAAKA;QACLG,IAAI;YACFC,OAAO;QACT;;AAGN,GAAG"}
1
+ {"version":3,"sources":["../../src/Table/InnerTable.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 { Table as MuiTable, styled, TableProps as MuiTableProps } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\nconst StyledMuiTable = styled(MuiTable)(({ theme }) => ({\n // This value is needed to have a consistent table layout when scrolling.\n tableLayout: 'fixed',\n borderCollapse: 'separate',\n backgroundColor: theme.palette.background.default,\n}));\n\ntype InnerTableProps = Omit<MuiTableProps, 'size'> & {\n density: TableDensity;\n};\n\nconst TABLE_DENSITY_CONFIG: Record<TableDensity, MuiTableProps['size']> = {\n compact: 'small',\n standard: 'medium',\n};\n\nexport const InnerTable = forwardRef<HTMLTableElement, InnerTableProps>(function InnerTable(\n { density, ...otherProps },\n ref\n) {\n return (\n <StyledMuiTable\n {...otherProps}\n tabIndex={-1}\n size={TABLE_DENSITY_CONFIG[density]}\n ref={ref}\n sx={{\n width: '100%',\n }}\n />\n );\n});\n"],"names":["Table","MuiTable","styled","forwardRef","StyledMuiTable","theme","tableLayout","borderCollapse","backgroundColor","palette","background","default","TABLE_DENSITY_CONFIG","compact","standard","InnerTable","density","otherProps","ref","tabIndex","size","sx","width"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAASC,QAAQ,EAAEC,MAAM,QAAqC,gBAAgB;AACvF,SAASC,UAAU,QAAQ,QAAQ;AAGnC,MAAMC,iBAAiBF,OAAOD,UAAU,CAAC,EAAEI,KAAK,EAAE,GAAM,CAAA;QACtD,yEAAyE;QACzEC,aAAa;QACbC,gBAAgB;QAChBC,iBAAiBH,MAAMI,OAAO,CAACC,UAAU,CAACC,OAAO;IACnD,CAAA;AAMA,MAAMC,uBAAoE;IACxEC,SAAS;IACTC,UAAU;AACZ;AAEA,OAAO,MAAMC,2BAAaZ,WAA8C,SAASY,WAC/E,EAAEC,OAAO,EAAE,GAAGC,YAAY,EAC1BC,GAAG;IAEH,qBACE,KAACd;QACE,GAAGa,UAAU;QACdE,UAAU,CAAC;QACXC,MAAMR,oBAAoB,CAACI,QAAQ;QACnCE,KAAKA;QACLG,IAAI;YACFC,OAAO;QACT;;AAGN,GAAG"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableProps } from './model/table-model';
3
2
  /**
4
3
  * Component used to render tabular data in Perses use cases. This component is
@@ -6,5 +5,5 @@ import { TableProps } from './model/table-model';
6
5
  *
7
6
  * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
8
7
  */
9
- export declare function Table<TableData>({ data, columns, density, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, rowSelectionVariant, ...otherProps }: TableProps<TableData>): JSX.Element;
8
+ export declare function Table<TableData>({ data, columns, density, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, rowSelectionVariant, ...otherProps }: TableProps<TableData>): import("react/jsx-runtime").JSX.Element;
10
9
  //# sourceMappingURL=Table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":";AA4BA,OAAO,EAAE,UAAU,EAAkC,MAAM,qBAAqB,CAAC;AAYjF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,EAC/B,IAAI,EACJ,OAAO,EACP,OAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,QAA6B,EAC7B,YAAoC,EACpC,OAAyB,EACzB,mBAAgC,EAChC,GAAG,UAAU,EACd,EAAE,UAAU,CAAC,SAAS,CAAC,eA+HvB"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAE,UAAU,EAAkC,MAAM,qBAAqB,CAAC;AAYjF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,EAC/B,IAAI,EACJ,OAAO,EACP,OAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,QAA6B,EAC7B,YAAoC,EACpC,OAAyB,EACzB,mBAAgC,EAChC,GAAG,UAAU,EACd,EAAE,UAAU,CAAC,SAAS,CAAC,2CA+HvB"}
@@ -30,7 +30,7 @@ const DEFAULT_SORTING = [];
30
30
  * **not** intended to be a general use data table for use cases unrelated to Perses.
31
31
  *
32
32
  * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
33
- */ export function Table({ data , columns , density ='standard' , checkboxSelection , onRowSelectionChange , onSortingChange , getCheckboxColor , getRowId =DEFAULT_GET_ROW_ID , rowSelection =DEFAULT_ROW_SELECTION , sorting =DEFAULT_SORTING , rowSelectionVariant ='standard' , ...otherProps }) {
33
+ */ export function Table({ data, columns, density = 'standard', checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId = DEFAULT_GET_ROW_ID, rowSelection = DEFAULT_ROW_SELECTION, sorting = DEFAULT_SORTING, rowSelectionVariant = 'standard', ...otherProps }) {
34
34
  const theme = useTheme();
35
35
  const handleRowSelectionChange = (rowSelectionUpdater)=>{
36
36
  const newRowSelection = typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;
@@ -72,7 +72,7 @@ const DEFAULT_SORTING = [];
72
72
  return {
73
73
  id: 'checkboxRowSelect',
74
74
  size: 28,
75
- header: ({ table })=>{
75
+ header: ({ table })=>{
76
76
  return /*#__PURE__*/ _jsx(TableCheckbox, {
77
77
  checked: table.getIsAllRowsSelected(),
78
78
  indeterminate: table.getIsSomeRowsSelected(),
@@ -81,7 +81,7 @@ const DEFAULT_SORTING = [];
81
81
  density: density
82
82
  });
83
83
  },
84
- cell: ({ row , table })=>{
84
+ cell: ({ row, table })=>{
85
85
  return /*#__PURE__*/ _jsx(TableCheckbox, {
86
86
  checked: row.getIsSelected(),
87
87
  indeterminate: row.getIsSomeSelected(),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/Table.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 {\n useReactTable,\n getCoreRowModel,\n ColumnDef,\n RowSelectionState,\n OnChangeFn,\n Row,\n Table as TanstackTable,\n SortingState,\n getSortedRowModel,\n} from '@tanstack/react-table';\nimport { useTheme } from '@mui/material';\nimport { useCallback, useMemo } from 'react';\nimport { VirtualizedTable } from './VirtualizedTable';\nimport { TableCheckbox } from './TableCheckbox';\nimport { TableProps, persesColumnsToTanstackColumns } from './model/table-model';\n\nconst DEFAULT_GET_ROW_ID = (data: unknown, index: number) => {\n return `${index}`;\n};\n\n// Setting these defaults one enables them to be consistent across renders instead\n// of being recreated every time, which can be important for perf because react\n// does not do deep equality checking for objects and arrays.\nconst DEFAULT_ROW_SELECTION: NonNullable<TableProps<unknown>['rowSelection']> = {};\nconst DEFAULT_SORTING: NonNullable<TableProps<unknown>['sorting']> = [];\n\n/**\n * Component used to render tabular data in Perses use cases. This component is\n * **not** intended to be a general use data table for use cases unrelated to Perses.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function Table<TableData>({\n data,\n columns,\n density = 'standard',\n checkboxSelection,\n onRowSelectionChange,\n onSortingChange,\n getCheckboxColor,\n getRowId = DEFAULT_GET_ROW_ID,\n rowSelection = DEFAULT_ROW_SELECTION,\n sorting = DEFAULT_SORTING,\n rowSelectionVariant = 'standard',\n ...otherProps\n}: TableProps<TableData>) {\n const theme = useTheme();\n\n const handleRowSelectionChange: OnChangeFn<RowSelectionState> = (rowSelectionUpdater) => {\n const newRowSelection =\n typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;\n onRowSelectionChange?.(newRowSelection);\n };\n\n const handleRowSelectionEvent = useCallback(\n (table: TanstackTable<TableData>, row: Row<TableData>, isModified: boolean) => {\n if (rowSelectionVariant === 'standard' || isModified) {\n row.toggleSelected();\n } else {\n // Legend variant (when action not modified with shift/meta key).\n // Note that this behavior needs to be kept in sync with behavior in\n // the Legend component for list-based legends.\n if (row.getIsSelected() && !table.getIsAllRowsSelected()) {\n // Row was already selected. Revert to select all.\n table.toggleAllRowsSelected();\n } else {\n // Focus the selected row.\n onRowSelectionChange?.({\n [row.id]: true,\n });\n }\n }\n },\n [onRowSelectionChange, rowSelectionVariant]\n );\n\n const handleCheckboxChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, table: TanstackTable<TableData>, row: Row<TableData>) => {\n const nativePointerEvent =\n e.nativeEvent && (e.nativeEvent instanceof MouseEvent || e.nativeEvent instanceof KeyboardEvent)\n ? (e.nativeEvent as PointerEvent)\n : undefined;\n const isModifed = !!nativePointerEvent?.metaKey || !!nativePointerEvent?.shiftKey;\n handleRowSelectionEvent(table, row, isModifed);\n },\n [handleRowSelectionEvent]\n );\n\n const handleSortingChange: OnChangeFn<SortingState> = (sortingUpdater) => {\n const newSorting = typeof sortingUpdater === 'function' ? sortingUpdater(sorting) : sortingUpdater;\n onSortingChange?.(newSorting);\n };\n\n const checkboxColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'checkboxRowSelect',\n size: 28,\n header: ({ table }) => {\n return (\n <TableCheckbox\n checked={table.getIsAllRowsSelected()}\n indeterminate={table.getIsSomeRowsSelected()}\n onChange={table.getToggleAllRowsSelectedHandler()}\n color={theme.palette.text.primary}\n density={density}\n />\n );\n },\n cell: ({ row, table }) => {\n return (\n <TableCheckbox\n checked={row.getIsSelected()}\n indeterminate={row.getIsSomeSelected()}\n onChange={(e) => {\n handleCheckboxChange(e, table, row);\n }}\n color={getCheckboxColor?.(row.original)}\n density={density}\n />\n );\n },\n enableSorting: false,\n };\n }, [theme.palette.text.primary, density, getCheckboxColor, handleCheckboxChange]);\n\n const tableColumns: Array<ColumnDef<TableData>> = useMemo(() => {\n const initTableColumns = persesColumnsToTanstackColumns(columns);\n\n if (checkboxSelection) {\n initTableColumns.unshift(checkboxColumn);\n }\n\n return initTableColumns;\n }, [checkboxColumn, checkboxSelection, columns]);\n\n const table = useReactTable({\n data,\n columns: tableColumns,\n getRowId,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n enableRowSelection: !!checkboxSelection,\n onRowSelectionChange: handleRowSelectionChange,\n onSortingChange: handleSortingChange,\n // For now, defaulting to sort by descending first. We can expose the ability\n // to customize it if/when we have use cases for it.\n sortDescFirst: true,\n state: {\n rowSelection,\n sorting,\n },\n });\n\n const handleRowClick = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>, rowId: string) => {\n const row = table.getRow(rowId);\n const isModifiedClick = e.metaKey || e.shiftKey;\n handleRowSelectionEvent(table, row, isModifiedClick);\n },\n [handleRowSelectionEvent, table]\n );\n\n return (\n <VirtualizedTable\n {...otherProps}\n density={density}\n onRowClick={handleRowClick}\n rows={table.getRowModel().rows}\n columns={table.getAllFlatColumns()}\n headers={table.getHeaderGroups()}\n />\n );\n}\n"],"names":["useReactTable","getCoreRowModel","getSortedRowModel","useTheme","useCallback","useMemo","VirtualizedTable","TableCheckbox","persesColumnsToTanstackColumns","DEFAULT_GET_ROW_ID","data","index","DEFAULT_ROW_SELECTION","DEFAULT_SORTING","Table","columns","density","checkboxSelection","onRowSelectionChange","onSortingChange","getCheckboxColor","getRowId","rowSelection","sorting","rowSelectionVariant","otherProps","theme","handleRowSelectionChange","rowSelectionUpdater","newRowSelection","handleRowSelectionEvent","table","row","isModified","toggleSelected","getIsSelected","getIsAllRowsSelected","toggleAllRowsSelected","id","handleCheckboxChange","e","nativePointerEvent","nativeEvent","MouseEvent","KeyboardEvent","undefined","isModifed","metaKey","shiftKey","handleSortingChange","sortingUpdater","newSorting","checkboxColumn","size","header","checked","indeterminate","getIsSomeRowsSelected","onChange","getToggleAllRowsSelectedHandler","color","palette","text","primary","cell","getIsSomeSelected","original","enableSorting","tableColumns","initTableColumns","unshift","enableRowSelection","sortDescFirst","state","handleRowClick","rowId","getRow","isModifiedClick","onRowClick","rows","getRowModel","getAllFlatColumns","headers","getHeaderGroups"],"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,SACEA,aAAa,EACbC,eAAe,EAOfC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAAqBC,8BAA8B,QAAQ,sBAAsB;AAEjF,MAAMC,qBAAqB,CAACC,MAAeC;IACzC,OAAO,CAAC,EAAEA,MAAM,CAAC;AACnB;AAEA,kFAAkF;AAClF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAMC,wBAA0E,CAAC;AACjF,MAAMC,kBAA+D,EAAE;AAEvE;;;;;CAKC,GACD,OAAO,SAASC,MAAiB,EA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BrC,EAAEO,WAAWP,EAAEQ;QACvClB,wBAAwBC,OAAOC,KAAK6C;IACtC,GACA;QAAC/C;QAAyBC;KAAM;IAGlC,qBACE,KAACzB;QACE,GAAGmB,UAAU;QACdT,SAASA;QACT8D,YAAYJ;QACZK,MAAMhD,MAAMiD,cAAcD;QAC1BhE,SAASgB,MAAMkD;QACfC,SAASnD,MAAMoD;;AAGrB"}
1
+ {"version":3,"sources":["../../src/Table/Table.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 {\n useReactTable,\n getCoreRowModel,\n ColumnDef,\n RowSelectionState,\n OnChangeFn,\n Row,\n Table as TanstackTable,\n SortingState,\n getSortedRowModel,\n} from '@tanstack/react-table';\nimport { useTheme } from '@mui/material';\nimport { useCallback, useMemo } from 'react';\nimport { VirtualizedTable } from './VirtualizedTable';\nimport { TableCheckbox } from './TableCheckbox';\nimport { TableProps, persesColumnsToTanstackColumns } from './model/table-model';\n\nconst DEFAULT_GET_ROW_ID = (data: unknown, index: number) => {\n return `${index}`;\n};\n\n// Setting these defaults one enables them to be consistent across renders instead\n// of being recreated every time, which can be important for perf because react\n// does not do deep equality checking for objects and arrays.\nconst DEFAULT_ROW_SELECTION: NonNullable<TableProps<unknown>['rowSelection']> = {};\nconst DEFAULT_SORTING: NonNullable<TableProps<unknown>['sorting']> = [];\n\n/**\n * Component used to render tabular data in Perses use cases. This component is\n * **not** intended to be a general use data table for use cases unrelated to Perses.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function Table<TableData>({\n data,\n columns,\n density = 'standard',\n checkboxSelection,\n onRowSelectionChange,\n onSortingChange,\n getCheckboxColor,\n getRowId = DEFAULT_GET_ROW_ID,\n rowSelection = DEFAULT_ROW_SELECTION,\n sorting = DEFAULT_SORTING,\n rowSelectionVariant = 'standard',\n ...otherProps\n}: TableProps<TableData>) {\n const theme = useTheme();\n\n const handleRowSelectionChange: OnChangeFn<RowSelectionState> = (rowSelectionUpdater) => {\n const newRowSelection =\n typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;\n onRowSelectionChange?.(newRowSelection);\n };\n\n const handleRowSelectionEvent = useCallback(\n (table: TanstackTable<TableData>, row: Row<TableData>, isModified: boolean) => {\n if (rowSelectionVariant === 'standard' || isModified) {\n row.toggleSelected();\n } else {\n // Legend variant (when action not modified with shift/meta key).\n // Note that this behavior needs to be kept in sync with behavior in\n // the Legend component for list-based legends.\n if (row.getIsSelected() && !table.getIsAllRowsSelected()) {\n // Row was already selected. Revert to select all.\n table.toggleAllRowsSelected();\n } else {\n // Focus the selected row.\n onRowSelectionChange?.({\n [row.id]: true,\n });\n }\n }\n },\n [onRowSelectionChange, rowSelectionVariant]\n );\n\n const handleCheckboxChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, table: TanstackTable<TableData>, row: Row<TableData>) => {\n const nativePointerEvent =\n e.nativeEvent && (e.nativeEvent instanceof MouseEvent || e.nativeEvent instanceof KeyboardEvent)\n ? (e.nativeEvent as PointerEvent)\n : undefined;\n const isModifed = !!nativePointerEvent?.metaKey || !!nativePointerEvent?.shiftKey;\n handleRowSelectionEvent(table, row, isModifed);\n },\n [handleRowSelectionEvent]\n );\n\n const handleSortingChange: OnChangeFn<SortingState> = (sortingUpdater) => {\n const newSorting = typeof sortingUpdater === 'function' ? sortingUpdater(sorting) : sortingUpdater;\n onSortingChange?.(newSorting);\n };\n\n const checkboxColumn: ColumnDef<TableData> = useMemo(() => {\n return {\n id: 'checkboxRowSelect',\n size: 28,\n header: ({ table }) => {\n return (\n <TableCheckbox\n checked={table.getIsAllRowsSelected()}\n indeterminate={table.getIsSomeRowsSelected()}\n onChange={table.getToggleAllRowsSelectedHandler()}\n color={theme.palette.text.primary}\n density={density}\n />\n );\n },\n cell: ({ row, table }) => {\n return (\n <TableCheckbox\n checked={row.getIsSelected()}\n indeterminate={row.getIsSomeSelected()}\n onChange={(e) => {\n handleCheckboxChange(e, table, row);\n }}\n color={getCheckboxColor?.(row.original)}\n density={density}\n />\n );\n },\n enableSorting: false,\n };\n }, [theme.palette.text.primary, density, getCheckboxColor, handleCheckboxChange]);\n\n const tableColumns: Array<ColumnDef<TableData>> = useMemo(() => {\n const initTableColumns = persesColumnsToTanstackColumns(columns);\n\n if (checkboxSelection) {\n initTableColumns.unshift(checkboxColumn);\n }\n\n return initTableColumns;\n }, [checkboxColumn, checkboxSelection, columns]);\n\n const table = useReactTable({\n data,\n columns: tableColumns,\n getRowId,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n enableRowSelection: !!checkboxSelection,\n onRowSelectionChange: handleRowSelectionChange,\n onSortingChange: handleSortingChange,\n // For now, defaulting to sort by descending first. We can expose the ability\n // to customize it if/when we have use cases for it.\n sortDescFirst: true,\n state: {\n rowSelection,\n sorting,\n },\n });\n\n const handleRowClick = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>, rowId: string) => {\n const row = table.getRow(rowId);\n const isModifiedClick = e.metaKey || e.shiftKey;\n handleRowSelectionEvent(table, row, isModifiedClick);\n },\n [handleRowSelectionEvent, table]\n );\n\n return (\n <VirtualizedTable\n {...otherProps}\n density={density}\n onRowClick={handleRowClick}\n rows={table.getRowModel().rows}\n columns={table.getAllFlatColumns()}\n headers={table.getHeaderGroups()}\n />\n );\n}\n"],"names":["useReactTable","getCoreRowModel","getSortedRowModel","useTheme","useCallback","useMemo","VirtualizedTable","TableCheckbox","persesColumnsToTanstackColumns","DEFAULT_GET_ROW_ID","data","index","DEFAULT_ROW_SELECTION","DEFAULT_SORTING","Table","columns","density","checkboxSelection","onRowSelectionChange","onSortingChange","getCheckboxColor","getRowId","rowSelection","sorting","rowSelectionVariant","otherProps","theme","handleRowSelectionChange","rowSelectionUpdater","newRowSelection","handleRowSelectionEvent","table","row","isModified","toggleSelected","getIsSelected","getIsAllRowsSelected","toggleAllRowsSelected","id","handleCheckboxChange","e","nativePointerEvent","nativeEvent","MouseEvent","KeyboardEvent","undefined","isModifed","metaKey","shiftKey","handleSortingChange","sortingUpdater","newSorting","checkboxColumn","size","header","checked","indeterminate","getIsSomeRowsSelected","onChange","getToggleAllRowsSelectedHandler","color","palette","text","primary","cell","getIsSomeSelected","original","enableSorting","tableColumns","initTableColumns","unshift","enableRowSelection","sortDescFirst","state","handleRowClick","rowId","getRow","isModifiedClick","onRowClick","rows","getRowModel","getAllFlatColumns","headers","getHeaderGroups"],"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,SACEA,aAAa,EACbC,eAAe,EAOfC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAAqBC,8BAA8B,QAAQ,sBAAsB;AAEjF,MAAMC,qBAAqB,CAACC,MAAeC;IACzC,OAAO,CAAC,EAAEA,MAAM,CAAC;AACnB;AAEA,kFAAkF;AAClF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAMC,wBAA0E,CAAC;AACjF,MAAMC,kBAA+D,EAAE;AAEvE;;;;;CAKC,GACD,OAAO,SAASC,MAAiB,EAC/BJ,IAAI,EACJK,OAAO,EAC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MAAME,kBAAkBrC,EAAEO,OAAO,IAAIP,EAAEQ,QAAQ;QAC/ClB,wBAAwBC,OAAOC,KAAK6C;IACtC,GACA;QAAC/C;QAAyBC;KAAM;IAGlC,qBACE,KAACzB;QACE,GAAGmB,UAAU;QACdT,SAASA;QACT8D,YAAYJ;QACZK,MAAMhD,MAAMiD,WAAW,GAAGD,IAAI;QAC9BhE,SAASgB,MAAMkD,iBAAiB;QAChCC,SAASnD,MAAMoD,eAAe;;AAGpC"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TableBodyProps as MuiTableBodyProps } from '@mui/material';
3
- declare type TableBodyProps = MuiTableBodyProps;
4
- export declare const TableBody: import("react").ForwardRefExoticComponent<Pick<TableBodyProps, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLTableSectionElement>>;
3
+ type TableBodyProps = MuiTableBodyProps;
4
+ export declare const TableBody: import("react").ForwardRefExoticComponent<Omit<TableBodyProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
5
5
  export {};
6
6
  //# sourceMappingURL=TableBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../src/Table/TableBody.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,aAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,gqJAEpB,CAAC"}
1
+ {"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../src/Table/TableBody.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
@@ -27,5 +27,5 @@ export interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'al
27
27
  focusState?: 'trigger-focus' | 'focus-next' | 'none';
28
28
  onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;
29
29
  }
30
- export declare function TableCell({ children, density, variant, width, focusState, onFocusTrigger, isFirstColumn, isLastColumn, description, ...otherProps }: TableCellProps): JSX.Element;
30
+ export declare function TableCell({ children, density, variant, width, focusState, onFocusTrigger, isFirstColumn, isLastColumn, description, ...otherProps }: TableCellProps): import("react/jsx-runtime").JSX.Element;
31
31
  //# sourceMappingURL=TableCell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableCell.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAqC,cAAc,IAAI,iBAAiB,EAAiB,MAAM,eAAe,CAAC;AAEtH,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAmB3F,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,OAAO,CAAC;IACnF,OAAO,EAAE,YAAY,CAAC;IAGtB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IAEvB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAE3B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;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,EACX,GAAG,UAAU,EACd,EAAE,cAAc,2CA2EhB"}
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { TableCell as MuiTableCell, styled, Box, useTheme } from '@mui/material';
15
15
  import { useEffect, useRef } from 'react';
16
16
  import { getTableCellLayout } from './model/table-model';
17
- const StyledMuiTableCell = styled(MuiTableCell)(({ theme })=>({
17
+ const StyledMuiTableCell = styled(MuiTableCell)(({ theme })=>({
18
18
  padding: 0,
19
19
  backgroundColor: 'inherit',
20
20
  '&.MuiTableCell-head': {
@@ -29,7 +29,7 @@ const StyledMuiTableCell = styled(MuiTableCell)(({ theme })=>({
29
29
  borderRadius: 0
30
30
  }
31
31
  }));
32
- export function TableCell({ children , density , variant , width , focusState ='none' , onFocusTrigger , isFirstColumn , isLastColumn , description , ...otherProps }) {
32
+ export function TableCell({ children, density, variant, width, focusState = 'none', onFocusTrigger, isFirstColumn, isLastColumn, description, ...otherProps }) {
33
33
  const theme = useTheme();
34
34
  const elRef = useRef();
35
35
  const isHeader = variant === 'head';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableCell.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 { TableCell as MuiTableCell, styled, TableCellProps as MuiTableCellProps, Box, useTheme } from '@mui/material';\nimport { useEffect, useRef } from 'react';\nimport { TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n ...otherProps\n}: TableCellProps) {\n const theme = useTheme();\n\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n sx={{\n width: width,\n borderBottom: isHeader\n ? (theme) => `solid 1px ${theme.palette.grey[100]}`\n : `solid 1px ${theme.palette.grey[50]}`,\n }}\n ref={elRef}\n >\n <Box\n sx={{\n ...getTableCellLayout(theme, density, { isLastColumn, isFirstColumn }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n title={description}\n >\n {children}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["TableCell","MuiTableCell","styled","Box","useTheme","useEffect","useRef","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","tabIndex","onFocus","onClick","onKeyUp","sx","borderBottom","grey","ref","position","whiteSpace","overflow","textOverflow","flexDirection","title"],"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B;IACF;IAEA,MAAMM,gCAAkE,CAACJ;QACvE,wEAAwE;QACxE,uEAAuE;QACvE,iEAAiE;QACjE,yEAAyE;QACzE,0CAA0C;QAC1CV,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAiBU;IACnB;IAEA,qBACE,KAAC3B;QACE,GAAGqB,UAAU;QACd,2EAA2E;QAC3E,wEAAwE;QACxE,qEAAqE;QACrE,QAAQ;QACRW,UAAUhB,eAAe,SAAS,IAAI,CAAC;QACvCiB,SAASP;QACTQ,SAASH;QACTI,SAASJ;QACTK,IAAI;YACFrB,OAAOA;YACPsB,cAAcd,WACV,CAACtB,QAAU,CAAC,UAAU,EAAEA,MAAMG,QAAQkC,IAAI,CAAC,IAAI,CAAC,CAAC,GACjD,CAAC,UAAU,EAAErC,MAAMG,QAAQkC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C;QACAC,KAAKjB;kBAEL,cAAA,KAAC3B;YACCyC,IAAI;gBACF,GAAGrC,mBAAmBE,OAAOY,SAAS;oBAAEM;oBAAcD;gBAAc,EAAE;gBACtEsB,UAAU;gBAEV,mEAAmE;gBACnE,mDAAmD;gBACnDC,YAAY;gBACZC,UAAU;gBACVC,cAAc;gBAEd,uEAAuE;gBACvE,uEAAuE;gBACvE,cAAc;gBACdC,eAAe;YACjB;YACAC,OAAOzB;sBAENR;;;AAIT"}
1
+ {"version":3,"sources":["../../src/Table/TableCell.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 { TableCell as MuiTableCell, styled, TableCellProps as MuiTableCellProps, Box, useTheme } from '@mui/material';\nimport { useEffect, useRef } from 'react';\nimport { TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n ...otherProps\n}: TableCellProps) {\n const theme = useTheme();\n\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n sx={{\n width: width,\n borderBottom: isHeader\n ? (theme) => `solid 1px ${theme.palette.grey[100]}`\n : `solid 1px ${theme.palette.grey[50]}`,\n }}\n ref={elRef}\n >\n <Box\n sx={{\n ...getTableCellLayout(theme, density, { isLastColumn, isFirstColumn }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n title={description}\n >\n {children}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["TableCell","MuiTableCell","styled","Box","useTheme","useEffect","useRef","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","tabIndex","onFocus","onClick","onKeyUp","sx","borderBottom","grey","ref","position","whiteSpace","overflow","textOverflow","flexDirection","title"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,aAAaC,YAAY,EAAEC,MAAM,EAAuCC,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AACtH,SAASC,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAC1C,SAA2CC,kBAAkB,QAAQ,sBAAsB;AAE3F,MAAMC,qBAAqBN,OAAOD,cAAc,CAAC,EAAEQ,KAAK,EAAE,GAAM,CAAA;QAC9DC,SAAS;QACTC,iBAAiB;QAEjB,uBAAuB;YACrB,kEAAkE;YAClEA,iBAAiBF,MAAMG,OAAO,CAACC,UAAU,CAACC,OAAO;QACnD;QACA,mBAAmB;YACjBC,SAAS,CAAC,UAAU,EAAEN,MAAMG,OAAO,CAACI,OAAO,CAACC,IAAI,CAAC,CAAC;YAClD,uEAAuE;YACvE,4BAA4B;YAC5BC,eAAe;YACfC,cAAc;QAChB;IACF,CAAA;AAkCA,OAAO,SAASnB,UAAU,EACxBoB,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,KAAK,EACLC,aAAa,MAAM,EACnBC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,WAAW,EACX,GAAGC,YACY;IACf,MAAMpB,QAAQL;IAEd,MAAM0B,QAAQxB;IAEd,MAAMyB,WAAWT,YAAY;IAE7BjB,UAAU;QACR,IAAImB,eAAe,mBAAmBM,MAAME,OAAO,EAAE;YACnDF,MAAME,OAAO,CAACC,KAAK;QACrB;IACF,GAAG;QAACT;KAAW;IAEf,MAAMU,cAA6D,CAACC;YAExCA;QAD1B,4DAA4D;QAC5D,MAAMC,qBAAoBD,mBAAAA,EAAEE,aAAa,cAAfF,uCAAAA,iBAAiBG,aAAa,CACtD;QAEF,IAAIF,mBAAmB;YACrB,uEAAuE;YACvE,6CAA6C;YAC7CA,kBAAkBH,KAAK;QACzB;IACF;IAEA,MAAMM,gCAAkE,CAACJ;QACvE,wEAAwE;QACxE,uEAAuE;QACvE,iEAAiE;QACjE,yEAAyE;QACzE,0CAA0C;QAC1CV,2BAAAA,qCAAAA,eAAiBU;IACnB;IAEA,qBACE,KAAC3B;QACE,GAAGqB,UAAU;QACd,2EAA2E;QAC3E,wEAAwE;QACxE,qEAAqE;QACrE,QAAQ;QACRW,UAAUhB,eAAe,SAAS,IAAI,CAAC;QACvCiB,SAASP;QACTQ,SAASH;QACTI,SAASJ;QACTK,IAAI;YACFrB,OAAOA;YACPsB,cAAcd,WACV,CAACtB,QAAU,CAAC,UAAU,EAAEA,MAAMG,OAAO,CAACkC,IAAI,CAAC,IAAI,CAAC,CAAC,GACjD,CAAC,UAAU,EAAErC,MAAMG,OAAO,CAACkC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C;QACAC,KAAKjB;kBAEL,cAAA,KAAC3B;YACCyC,IAAI;gBACF,GAAGrC,mBAAmBE,OAAOY,SAAS;oBAAEM;oBAAcD;gBAAc,EAAE;gBACtEsB,UAAU;gBAEV,mEAAmE;gBACnE,mDAAmD;gBACnDC,YAAY;gBACZC,UAAU;gBACVC,cAAc;gBAEd,uEAAuE;gBACvE,uEAAuE;gBACvE,cAAc;gBACdC,eAAe;YACjB;YACAC,OAAOzB;sBAENR;;;AAIT"}
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { CheckboxProps } from '@mui/material';
3
2
  import { TableDensity } from './model/table-model';
4
3
  export interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {
5
4
  color?: string;
6
5
  density: TableDensity;
7
6
  }
8
- export declare function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): JSX.Element;
7
+ export declare function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): import("react/jsx-runtime").JSX.Element;
9
8
  //# sourceMappingURL=TableCheckbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableCheckbox.d.ts","sourceRoot":"","sources":["../../src/Table/TableCheckbox.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAY,aAAa,EAAS,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,eAAe,GAAG,UAAU,CAAC;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,kBAAkB,eAsClF"}
1
+ {"version":3,"file":"TableCheckbox.d.ts","sourceRoot":"","sources":["../../src/Table/TableCheckbox.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAY,aAAa,EAAS,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,eAAe,GAAG,UAAU,CAAC;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,kBAAkB,2CAsClF"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Checkbox, alpha } from '@mui/material';
15
- export function TableCheckbox({ color , density , ...otherProps }) {
15
+ export function TableCheckbox({ color, density, ...otherProps }) {
16
16
  const isCompact = density === 'compact';
17
17
  return /*#__PURE__*/ _jsx(Checkbox, {
18
18
  size: isCompact ? 'small' : 'medium',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableCheckbox.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 { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps) {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,QAAQ,EAAiBC,KAAK,QAAQ,gBAAgB;AAQ/D,OAAO,SAASC,cAAc,EAAEC,MAAK,EAAEC,QAAO,EAAE,GAAGC,YAAgC;IACjF,MAAMC,YAAYF,YAAY;IAE9B,qBACE,KAACJ;QACCO,MAAMD,YAAY,UAAU;QAC3B,GAAGD,UAAU;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,wBAAwB;QACxBG,aAAa;QACb,0EAA0E;QAC1E,wEAAwE;QACxE,iCAAiC;QACjCC,UAAU,CAAC;QACXC,IAAI;YACFP,OAAOA;YAEPQ,SAAS,CAACC,QAAUA,MAAMC,QAAQP,YAAY,OAAO;YAErD,aAAa;YACbQ,UAAU;YACVC,KAAK;YACLC,MAAM;YACNC,WAAW;YAEX,iBAAiB;gBACfd,OAAOA;YACT;YAEA,sBAAsB;gBACpBe,YAAYf,QAAQF,MAAME,OAAO,OAAOgB;YAC1C;YAEA,sBAAsB;gBAAEC,UAAUd,YAAY,KAAK;YAAG;QACxD;;AAGN"}
1
+ {"version":3,"sources":["../../src/Table/TableCheckbox.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 { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps) {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,QAAQ,EAAiBC,KAAK,QAAQ,gBAAgB;AAQ/D,OAAO,SAASC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGC,YAAgC;IACjF,MAAMC,YAAYF,YAAY;IAE9B,qBACE,KAACJ;QACCO,MAAMD,YAAY,UAAU;QAC3B,GAAGD,UAAU;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,wBAAwB;QACxBG,aAAa;QACb,0EAA0E;QAC1E,wEAAwE;QACxE,iCAAiC;QACjCC,UAAU,CAAC;QACXC,IAAI;YACFP,OAAOA;YAEPQ,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAACP,YAAY,OAAO;YAErD,aAAa;YACbQ,UAAU;YACVC,KAAK;YACLC,MAAM;YACNC,WAAW;YAEX,iBAAiB;gBACfd,OAAOA;YACT;YAEA,sBAAsB;gBACpBe,YAAYf,QAAQF,MAAME,OAAO,OAAOgB;YAC1C;YAEA,sBAAsB;gBAAEC,UAAUd,YAAY,KAAK;YAAG;QACxD;;AAGN"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TableHeadProps as MuiTableHeadProps } from '@mui/material';
3
- declare type TableHeadProps = MuiTableHeadProps;
4
- export declare const TableHead: import("react").ForwardRefExoticComponent<Pick<TableHeadProps, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLTableSectionElement>>;
3
+ type TableHeadProps = MuiTableHeadProps;
4
+ export declare const TableHead: import("react").ForwardRefExoticComponent<Omit<TableHeadProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
5
5
  export {};
6
6
  //# sourceMappingURL=TableHead.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../src/Table/TableHead.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,aAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,gqJAEpB,CAAC"}
1
+ {"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../src/Table/TableHead.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA6B,cAAc,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/F,KAAK,cAAc,GAAG,iBAAiB,CAAC;AAExC,eAAO,MAAM,SAAS,iIAEpB,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SortDirection } from './model/table-model';
3
2
  import { TableCellProps } from './TableCell';
4
3
  export interface TableHeaderCellProps extends TableCellProps {
@@ -19,5 +18,5 @@ export interface TableHeaderCellProps extends TableCellProps {
19
18
  */
20
19
  nextSortDirection?: SortDirection;
21
20
  }
22
- export declare function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, ...cellProps }: TableHeaderCellProps): JSX.Element;
21
+ export declare function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, ...cellProps }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
23
22
  //# sourceMappingURL=TableHeaderCell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,oBAAoB,eA4CtB"}
1
+ {"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,oBAAoB,2CA4CtB"}
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { TableSortLabel, Typography, tableSortLabelClasses } from '@mui/material';
15
15
  import { TableCell } from './TableCell';
16
- export function TableHeaderCell({ onSort , sortDirection , nextSortDirection , children , ...cellProps }) {
16
+ export function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, ...cellProps }) {
17
17
  const showSortLabel = !!onSort;
18
18
  const headerText = /*#__PURE__*/ _jsx(Typography, {
19
19
  noWrap: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Table/TableHeaderCell.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 { TableSortLabel, Typography, tableSortLabelClasses } from '@mui/material';\nimport { SortDirection } from './model/table-model';\nimport { TableCell, TableCellProps } from './TableCell';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n ...cellProps\n}: TableHeaderCellProps) {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,cAAc,EAAEC,UAAU,EAAEC,qBAAqB,QAAQ,gBAAgB;AAElF,SAASC,SAAS,QAAwB,cAAc;AAuBxD,OAAO,SAASC,gBAAgB,EAC9BC,OAAM,EACNC,cAAa,EACbC,kBAAiB,EACjBC,SAAQ,EACR,GAAGC,WACkB;IACrB,MAAMC,gBAAgB,CAAC,CAACL;IAExB,MAAMM,2BACJ,KAACV;QAAWW,MAAM;QAACC,SAAQ;QAAUC,WAAU;QAAMC,OAAM;kBACxDP;;IAIL,MAAMQ,WAAW,CAAC,CAACV;IACnB,MAAMW,YAAYD,WAAWV,gBAAgBC;IAE7C,qBACE,KAACJ;QAAW,GAAGM,SAAS;kBACrBC,8BACC,KAACV;YACCkB,SAASb;YACTY,WAAWA;YACXE,QAAQH;YACRI,IAAI;gBACF,iEAAiE;gBACjE,+DAA+D;gBAC/D,uBAAuB;gBACvBC,eAAe;gBAEf,4DAA4D;gBAC5DC,UAAU;gBAEV,mEAAmE;gBACnE,aAAa;gBACb,mBAAmB;oBACjB,CAAC,CAAC,GAAG,EAAEpB,sBAAsBqB,KAAK,CAAC,CAAC,EAAE;wBACpCC,SAASR,WAAW,IAAI;oBAC1B;gBACF;YACF;sBAECL;aAGHA;;AAIR"}
1
+ {"version":3,"sources":["../../src/Table/TableHeaderCell.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 { TableSortLabel, Typography, tableSortLabelClasses } from '@mui/material';\nimport { SortDirection } from './model/table-model';\nimport { TableCell, TableCellProps } from './TableCell';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n ...cellProps\n}: TableHeaderCellProps) {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,cAAc,EAAEC,UAAU,EAAEC,qBAAqB,QAAQ,gBAAgB;AAElF,SAASC,SAAS,QAAwB,cAAc;AAuBxD,OAAO,SAASC,gBAAgB,EAC9BC,MAAM,EACNC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACR,GAAGC,WACkB;IACrB,MAAMC,gBAAgB,CAAC,CAACL;IAExB,MAAMM,2BACJ,KAACV;QAAWW,MAAM;QAACC,SAAQ;QAAUC,WAAU;QAAMC,OAAM;kBACxDP;;IAIL,MAAMQ,WAAW,CAAC,CAACV;IACnB,MAAMW,YAAYD,WAAWV,gBAAgBC;IAE7C,qBACE,KAACJ;QAAW,GAAGM,SAAS;kBACrBC,8BACC,KAACV;YACCkB,SAASb;YACTY,WAAWA;YACXE,QAAQH;YACRI,IAAI;gBACF,iEAAiE;gBACjE,+DAA+D;gBAC/D,uBAAuB;gBACvBC,eAAe;gBAEf,4DAA4D;gBAC5DC,UAAU;gBAEV,mEAAmE;gBACnE,aAAa;gBACb,mBAAmB;oBACjB,CAAC,CAAC,GAAG,EAAEpB,sBAAsBqB,IAAI,CAAC,CAAC,CAAC,EAAE;wBACpCC,SAASR,WAAW,IAAI;oBAC1B;gBACF;YACF;sBAECL;aAGHA;;AAIR"}