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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. package/dist/BarChart/BarChart.d.ts +3 -4
  2. package/dist/BarChart/BarChart.d.ts.map +1 -1
  3. package/dist/BarChart/BarChart.js +17 -11
  4. package/dist/BarChart/BarChart.js.map +1 -1
  5. package/dist/BarChart/index.js.map +1 -1
  6. package/dist/ColorPicker/ColorPicker.d.ts +1 -2
  7. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  8. package/dist/ColorPicker/ColorPicker.js +1 -1
  9. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  10. package/dist/ColorPicker/index.js.map +1 -1
  11. package/dist/ContentWithLegend/ContentWithLegend.d.ts +1 -2
  12. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  13. package/dist/ContentWithLegend/ContentWithLegend.js +2 -2
  14. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  15. package/dist/ContentWithLegend/index.js.map +1 -1
  16. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +3 -3
  17. package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
  18. package/dist/ContentWithLegend/model/content-with-legend-model.js +21 -21
  19. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  20. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +1 -2
  21. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
  22. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +8 -24
  23. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
  24. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
  25. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  26. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +1 -1
  27. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
  28. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +1 -2
  29. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
  30. package/dist/DateTimeRangePicker/TimeRangeSelector.js +2 -2
  31. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
  32. package/dist/DateTimeRangePicker/index.js.map +1 -1
  33. package/dist/DateTimeRangePicker/utils.js.map +1 -1
  34. package/dist/Dialog/Dialog.d.ts +6 -6
  35. package/dist/Dialog/Dialog.d.ts.map +1 -1
  36. package/dist/Dialog/Dialog.js +5 -5
  37. package/dist/Dialog/Dialog.js.map +1 -1
  38. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +1 -2
  39. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  40. package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
  41. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  42. package/dist/Dialog/index.js.map +1 -1
  43. package/dist/Drawer/Drawer.d.ts +1 -2
  44. package/dist/Drawer/Drawer.d.ts.map +1 -1
  45. package/dist/Drawer/Drawer.js +4 -3
  46. package/dist/Drawer/Drawer.js.map +1 -1
  47. package/dist/Drawer/index.js.map +1 -1
  48. package/dist/EChart/EChart.d.ts +7 -7
  49. package/dist/EChart/EChart.d.ts.map +1 -1
  50. package/dist/EChart/EChart.js +3 -3
  51. package/dist/EChart/EChart.js.map +1 -1
  52. package/dist/EChart/index.js.map +1 -1
  53. package/dist/ErrorAlert.d.ts +1 -2
  54. package/dist/ErrorAlert.d.ts.map +1 -1
  55. package/dist/ErrorAlert.js +1 -1
  56. package/dist/ErrorAlert.js.map +1 -1
  57. package/dist/ErrorBoundary.js.map +1 -1
  58. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -3
  59. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  60. package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
  61. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  62. package/dist/FontSizeSelector/index.js.map +1 -1
  63. package/dist/FormatControls/FormatControls.d.ts +8 -0
  64. package/dist/FormatControls/FormatControls.d.ts.map +1 -0
  65. package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
  66. package/dist/FormatControls/FormatControls.js.map +1 -0
  67. package/dist/FormatControls/index.d.ts +2 -0
  68. package/dist/FormatControls/index.d.ts.map +1 -0
  69. package/dist/{UnitSelector → FormatControls}/index.js +1 -1
  70. package/dist/FormatControls/index.js.map +1 -0
  71. package/dist/GaugeChart/GaugeChart.d.ts +6 -7
  72. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  73. package/dist/GaugeChart/GaugeChart.js +12 -12
  74. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  75. package/dist/GaugeChart/index.js.map +1 -1
  76. package/dist/InfoTooltip/InfoTooltip.d.ts +2 -2
  77. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  78. package/dist/InfoTooltip/InfoTooltip.js +4 -4
  79. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  80. package/dist/InfoTooltip/index.js.map +1 -1
  81. package/dist/JSONEditor.d.ts +4 -4
  82. package/dist/JSONEditor.d.ts.map +1 -1
  83. package/dist/JSONEditor.js +9 -8
  84. package/dist/JSONEditor.js.map +1 -1
  85. package/dist/Legend/CompactLegend.d.ts +1 -2
  86. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  87. package/dist/Legend/CompactLegend.js +1 -1
  88. package/dist/Legend/CompactLegend.js.map +1 -1
  89. package/dist/Legend/Legend.d.ts +1 -2
  90. package/dist/Legend/Legend.d.ts.map +1 -1
  91. package/dist/Legend/Legend.js +4 -4
  92. package/dist/Legend/Legend.js.map +1 -1
  93. package/dist/Legend/LegendColorBadge.js +1 -1
  94. package/dist/Legend/LegendColorBadge.js.map +1 -1
  95. package/dist/Legend/ListLegend.d.ts +1 -2
  96. package/dist/Legend/ListLegend.d.ts.map +1 -1
  97. package/dist/Legend/ListLegend.js +1 -1
  98. package/dist/Legend/ListLegend.js.map +1 -1
  99. package/dist/Legend/ListLegendItem.d.ts +2 -2
  100. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  101. package/dist/Legend/ListLegendItem.js +7 -11
  102. package/dist/Legend/ListLegendItem.js.map +1 -1
  103. package/dist/Legend/TableLegend.d.ts +1 -2
  104. package/dist/Legend/TableLegend.d.ts.map +1 -1
  105. package/dist/Legend/TableLegend.js +2 -2
  106. package/dist/Legend/TableLegend.js.map +1 -1
  107. package/dist/Legend/index.js.map +1 -1
  108. package/dist/Legend/legend-model.d.ts +2 -2
  109. package/dist/Legend/legend-model.d.ts.map +1 -1
  110. package/dist/Legend/legend-model.js.map +1 -1
  111. package/dist/LineChart/LineChart.d.ts +2 -2
  112. package/dist/LineChart/LineChart.d.ts.map +1 -1
  113. package/dist/LineChart/LineChart.js +22 -24
  114. package/dist/LineChart/LineChart.js.map +1 -1
  115. package/dist/LineChart/index.js.map +1 -1
  116. package/dist/ModeSelector/ModeSelector.d.ts +2 -3
  117. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  118. package/dist/ModeSelector/ModeSelector.js +2 -2
  119. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  120. package/dist/ModeSelector/index.js.map +1 -1
  121. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  122. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  123. package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
  124. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  125. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -3
  126. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  127. package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
  128. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  129. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  130. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  131. package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
  132. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  133. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  134. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  135. package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
  136. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  137. package/dist/OptionsEditorLayout/index.js.map +1 -1
  138. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +1 -2
  139. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  140. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +23 -7
  141. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  142. package/dist/RefreshIntervalPicker/index.js.map +1 -1
  143. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
  144. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  145. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +4 -4
  146. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  147. package/dist/SettingsAutocomplete/index.js.map +1 -1
  148. package/dist/SortSelector/SortSelector.d.ts +2 -3
  149. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  150. package/dist/SortSelector/SortSelector.js +2 -2
  151. package/dist/SortSelector/SortSelector.js.map +1 -1
  152. package/dist/SortSelector/index.js.map +1 -1
  153. package/dist/StatChart/StatChart.d.ts +3 -4
  154. package/dist/StatChart/StatChart.d.ts.map +1 -1
  155. package/dist/StatChart/StatChart.js +10 -10
  156. package/dist/StatChart/StatChart.js.map +1 -1
  157. package/dist/StatChart/calculateFontSize.js +8 -8
  158. package/dist/StatChart/calculateFontSize.js.map +1 -1
  159. package/dist/StatChart/index.js.map +1 -1
  160. package/dist/Table/InnerTable.d.ts +2 -2
  161. package/dist/Table/InnerTable.d.ts.map +1 -1
  162. package/dist/Table/InnerTable.js +2 -2
  163. package/dist/Table/InnerTable.js.map +1 -1
  164. package/dist/Table/Table.d.ts +1 -2
  165. package/dist/Table/Table.d.ts.map +1 -1
  166. package/dist/Table/Table.js +3 -3
  167. package/dist/Table/Table.js.map +1 -1
  168. package/dist/Table/TableBody.d.ts +2 -2
  169. package/dist/Table/TableBody.d.ts.map +1 -1
  170. package/dist/Table/TableBody.js.map +1 -1
  171. package/dist/Table/TableCell.d.ts +1 -1
  172. package/dist/Table/TableCell.d.ts.map +1 -1
  173. package/dist/Table/TableCell.js +4 -4
  174. package/dist/Table/TableCell.js.map +1 -1
  175. package/dist/Table/TableCheckbox.d.ts +1 -2
  176. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  177. package/dist/Table/TableCheckbox.js +1 -1
  178. package/dist/Table/TableCheckbox.js.map +1 -1
  179. package/dist/Table/TableHead.d.ts +2 -2
  180. package/dist/Table/TableHead.d.ts.map +1 -1
  181. package/dist/Table/TableHead.js.map +1 -1
  182. package/dist/Table/TableHeaderCell.d.ts +1 -2
  183. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  184. package/dist/Table/TableHeaderCell.js +1 -1
  185. package/dist/Table/TableHeaderCell.js.map +1 -1
  186. package/dist/Table/TableRow.d.ts +1 -1
  187. package/dist/Table/TableRow.d.ts.map +1 -1
  188. package/dist/Table/TableRow.js.map +1 -1
  189. package/dist/Table/VirtualizedTable.d.ts +2 -2
  190. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  191. package/dist/Table/VirtualizedTable.js +8 -8
  192. package/dist/Table/VirtualizedTable.js.map +1 -1
  193. package/dist/Table/VirtualizedTableContainer.d.ts +2 -2
  194. package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
  195. package/dist/Table/VirtualizedTableContainer.js.map +1 -1
  196. package/dist/Table/hooks/useTableKeyboardNav.d.ts +1 -1
  197. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  198. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  199. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  200. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +21 -21
  201. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  202. package/dist/Table/index.js.map +1 -1
  203. package/dist/Table/model/table-model.d.ts +6 -6
  204. package/dist/Table/model/table-model.d.ts.map +1 -1
  205. package/dist/Table/model/table-model.js +11 -11
  206. package/dist/Table/model/table-model.js.map +1 -1
  207. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +1 -2
  208. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +1 -1
  209. package/dist/ThresholdsEditor/ThresholdColorPicker.js +4 -4
  210. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
  211. package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
  212. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  213. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  214. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  215. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -2
  216. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  217. package/dist/ThresholdsEditor/ThresholdsEditor.js +23 -21
  218. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  219. package/dist/ThresholdsEditor/index.js.map +1 -1
  220. package/dist/TimeChart/TimeChart.d.ts +3 -3
  221. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  222. package/dist/TimeChart/TimeChart.js +110 -67
  223. package/dist/TimeChart/TimeChart.js.map +1 -1
  224. package/dist/TimeChart/index.js.map +1 -1
  225. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  226. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  227. package/dist/TimeSeriesTooltip/LineChartTooltip.js +11 -10
  228. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  229. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -2
  230. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  231. package/dist/TimeSeriesTooltip/SeriesInfo.js +3 -3
  232. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  233. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +1 -2
  234. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  235. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
  236. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  237. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +1 -2
  238. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  239. package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
  240. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  241. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  242. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  243. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +6 -6
  244. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  245. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +1 -2
  246. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  247. package/dist/TimeSeriesTooltip/TooltipContent.js +2 -2
  248. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  249. package/dist/TimeSeriesTooltip/TooltipHeader.js +7 -7
  250. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  251. package/dist/TimeSeriesTooltip/index.js.map +1 -1
  252. package/dist/TimeSeriesTooltip/nearby-series.d.ts +8 -8
  253. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  254. package/dist/TimeSeriesTooltip/nearby-series.js +44 -45
  255. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  256. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +13 -26
  257. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  258. package/dist/TimeSeriesTooltip/tooltip-model.js +5 -11
  259. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  260. package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
  261. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  262. package/dist/TimeSeriesTooltip/utils.js +5 -4
  263. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  264. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +6 -0
  265. package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -0
  266. package/dist/ToolbarIconButton/ToolbarIconButton.js +32 -0
  267. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -0
  268. package/dist/ToolbarIconButton/index.d.ts +2 -0
  269. package/dist/ToolbarIconButton/index.d.ts.map +1 -0
  270. package/dist/ToolbarIconButton/index.js +15 -0
  271. package/dist/ToolbarIconButton/index.js.map +1 -0
  272. package/dist/YAxisLabel.d.ts +1 -2
  273. package/dist/YAxisLabel.d.ts.map +1 -1
  274. package/dist/YAxisLabel.js +1 -1
  275. package/dist/YAxisLabel.js.map +1 -1
  276. package/dist/cjs/BarChart/BarChart.js +25 -17
  277. package/dist/cjs/BarChart/index.js +10 -8
  278. package/dist/cjs/ColorPicker/ColorPicker.js +19 -15
  279. package/dist/cjs/ColorPicker/index.js +10 -8
  280. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +13 -11
  281. package/dist/cjs/ContentWithLegend/index.js +10 -8
  282. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +29 -25
  283. package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +30 -44
  284. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +13 -11
  285. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +14 -12
  286. package/dist/cjs/DateTimeRangePicker/index.js +12 -10
  287. package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
  288. package/dist/cjs/Dialog/Dialog.js +16 -14
  289. package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +12 -10
  290. package/dist/cjs/Dialog/index.js +11 -9
  291. package/dist/cjs/Drawer/Drawer.js +8 -5
  292. package/dist/cjs/Drawer/index.js +10 -8
  293. package/dist/cjs/EChart/EChart.js +16 -12
  294. package/dist/cjs/EChart/index.js +10 -8
  295. package/dist/cjs/ErrorAlert.js +6 -4
  296. package/dist/cjs/ErrorBoundary.js +4 -2
  297. package/dist/cjs/FontSizeSelector/FontSizeSelector.js +10 -8
  298. package/dist/cjs/FontSizeSelector/index.js +10 -8
  299. package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
  300. package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
  301. package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
  302. package/dist/cjs/GaugeChart/index.js +10 -8
  303. package/dist/cjs/InfoTooltip/InfoTooltip.js +16 -14
  304. package/dist/cjs/InfoTooltip/index.js +10 -8
  305. package/dist/cjs/JSONEditor.js +19 -16
  306. package/dist/cjs/Legend/CompactLegend.js +10 -8
  307. package/dist/cjs/Legend/Legend.js +16 -14
  308. package/dist/cjs/Legend/LegendColorBadge.js +8 -6
  309. package/dist/cjs/Legend/ListLegend.js +11 -9
  310. package/dist/cjs/Legend/ListLegendItem.js +20 -20
  311. package/dist/cjs/Legend/TableLegend.js +8 -6
  312. package/dist/cjs/Legend/index.js +11 -9
  313. package/dist/cjs/Legend/legend-model.js +3 -1
  314. package/dist/cjs/LineChart/LineChart.js +31 -31
  315. package/dist/cjs/LineChart/index.js +10 -8
  316. package/dist/cjs/ModeSelector/ModeSelector.js +10 -8
  317. package/dist/cjs/ModeSelector/index.js +10 -8
  318. package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +7 -5
  319. package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +17 -15
  320. package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +6 -4
  321. package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +12 -10
  322. package/dist/cjs/OptionsEditorLayout/index.js +13 -11
  323. package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +28 -10
  324. package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
  325. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +13 -11
  326. package/dist/cjs/SettingsAutocomplete/index.js +10 -8
  327. package/dist/cjs/SortSelector/SortSelector.js +10 -8
  328. package/dist/cjs/SortSelector/index.js +10 -8
  329. package/dist/cjs/StatChart/StatChart.js +22 -20
  330. package/dist/cjs/StatChart/calculateFontSize.js +11 -9
  331. package/dist/cjs/StatChart/index.js +10 -8
  332. package/dist/cjs/Table/InnerTable.js +7 -5
  333. package/dist/cjs/Table/Table.js +18 -16
  334. package/dist/cjs/Table/TableBody.js +5 -3
  335. package/dist/cjs/Table/TableCell.js +12 -10
  336. package/dist/cjs/Table/TableCheckbox.js +6 -4
  337. package/dist/cjs/Table/TableHead.js +5 -3
  338. package/dist/cjs/Table/TableHeaderCell.js +9 -7
  339. package/dist/cjs/Table/TableRow.js +5 -3
  340. package/dist/cjs/Table/VirtualizedTable.js +34 -32
  341. package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
  342. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +4 -2
  343. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +24 -22
  344. package/dist/cjs/Table/index.js +14 -10
  345. package/dist/cjs/Table/model/table-model.js +17 -13
  346. package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +17 -15
  347. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +15 -13
  348. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +50 -44
  349. package/dist/cjs/ThresholdsEditor/index.js +10 -8
  350. package/dist/cjs/TimeChart/TimeChart.js +123 -78
  351. package/dist/cjs/TimeChart/index.js +10 -8
  352. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +31 -28
  353. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +18 -16
  354. package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +16 -14
  355. package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +6 -4
  356. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +23 -21
  357. package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +9 -7
  358. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +35 -33
  359. package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
  360. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +70 -53
  361. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +56 -28
  362. package/dist/cjs/TimeSeriesTooltip/utils.js +19 -14
  363. package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +40 -0
  364. package/dist/cjs/ToolbarIconButton/index.js +30 -0
  365. package/dist/cjs/YAxisLabel.js +7 -5
  366. package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +41 -12
  367. package/dist/cjs/context/SnackbarProvider.js +7 -3
  368. package/dist/cjs/context/TimeZoneProvider.js +17 -9
  369. package/dist/cjs/context/index.js +32 -0
  370. package/dist/cjs/index.js +42 -41
  371. package/dist/cjs/model/graph.js +9 -3
  372. package/dist/cjs/model/index.js +12 -10
  373. package/dist/cjs/test/index.js +10 -8
  374. package/dist/cjs/test/render.js +7 -5
  375. package/dist/cjs/test-utils/index.js +10 -8
  376. package/dist/cjs/test-utils/theme.js +38 -19
  377. package/dist/cjs/theme/component-overrides/alert.js +7 -5
  378. package/dist/cjs/theme/component-overrides/paper.js +4 -2
  379. package/dist/cjs/theme/index.js +10 -8
  380. package/dist/cjs/theme/palette/background.js +6 -2
  381. package/dist/cjs/theme/palette/colors/blue.js +3 -1
  382. package/dist/cjs/theme/palette/colors/common.js +6 -2
  383. package/dist/cjs/theme/palette/colors/green.js +3 -1
  384. package/dist/cjs/theme/palette/colors/grey.js +3 -1
  385. package/dist/cjs/theme/palette/colors/index.js +17 -15
  386. package/dist/cjs/theme/palette/colors/orange.js +3 -1
  387. package/dist/cjs/theme/palette/colors/purple.js +3 -1
  388. package/dist/cjs/theme/palette/colors/red.js +3 -1
  389. package/dist/cjs/theme/palette/error.js +3 -1
  390. package/dist/cjs/theme/palette/grey.js +3 -1
  391. package/dist/cjs/theme/palette/index.js +10 -8
  392. package/dist/cjs/theme/palette/palette-options.js +3 -1
  393. package/dist/cjs/theme/palette/primary.js +3 -1
  394. package/dist/cjs/theme/palette/secondary.js +3 -1
  395. package/dist/cjs/theme/palette/success.js +3 -1
  396. package/dist/cjs/theme/palette/text.js +3 -1
  397. package/dist/cjs/theme/palette/warning.js +3 -1
  398. package/dist/cjs/theme/theme.js +6 -4
  399. package/dist/cjs/theme/typography.js +3 -1
  400. package/dist/cjs/utils/axis.js +11 -7
  401. package/dist/cjs/utils/chart-actions.js +68 -12
  402. package/dist/cjs/utils/combine-sx.js +3 -1
  403. package/dist/cjs/utils/component-ids.js +3 -1
  404. package/dist/cjs/utils/format.js +16 -8
  405. package/dist/cjs/utils/index.js +15 -13
  406. package/dist/cjs/utils/mathjs.js +4 -2
  407. package/dist/cjs/utils/theme-gen.js +16 -18
  408. package/dist/context/ChartsProvider.d.ts +19 -0
  409. package/dist/context/ChartsProvider.d.ts.map +1 -0
  410. package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
  411. package/dist/context/ChartsProvider.js.map +1 -0
  412. package/dist/context/SnackbarProvider.d.ts +2 -2
  413. package/dist/context/SnackbarProvider.d.ts.map +1 -1
  414. package/dist/context/SnackbarProvider.js +1 -1
  415. package/dist/context/SnackbarProvider.js.map +1 -1
  416. package/dist/context/TimeZoneProvider.d.ts +1 -1
  417. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  418. package/dist/context/TimeZoneProvider.js +1 -1
  419. package/dist/context/TimeZoneProvider.js.map +1 -1
  420. package/dist/context/index.d.ts +4 -0
  421. package/dist/context/index.d.ts.map +1 -0
  422. package/dist/context/index.js +17 -0
  423. package/dist/context/index.js.map +1 -0
  424. package/dist/index.d.ts +3 -4
  425. package/dist/index.d.ts.map +1 -1
  426. package/dist/index.js +3 -4
  427. package/dist/index.js.map +1 -1
  428. package/dist/model/graph.d.ts +8 -8
  429. package/dist/model/graph.d.ts.map +1 -1
  430. package/dist/model/graph.js.map +1 -1
  431. package/dist/model/index.js.map +1 -1
  432. package/dist/model/theme.d.ts +1 -1
  433. package/dist/model/theme.d.ts.map +1 -1
  434. package/dist/model/theme.js.map +1 -1
  435. package/dist/model/timeOption.js.map +1 -1
  436. package/dist/test/index.js.map +1 -1
  437. package/dist/test/render.js.map +1 -1
  438. package/dist/test/setup-tests.js.map +1 -1
  439. package/dist/test-utils/index.js.map +1 -1
  440. package/dist/test-utils/theme.d.ts +2 -0
  441. package/dist/test-utils/theme.d.ts.map +1 -1
  442. package/dist/test-utils/theme.js +25 -16
  443. package/dist/test-utils/theme.js.map +1 -1
  444. package/dist/theme/component-overrides/alert.js +4 -4
  445. package/dist/theme/component-overrides/alert.js.map +1 -1
  446. package/dist/theme/component-overrides/paper.js +1 -1
  447. package/dist/theme/component-overrides/paper.js.map +1 -1
  448. package/dist/theme/index.d.ts +1 -0
  449. package/dist/theme/index.d.ts.map +1 -1
  450. package/dist/theme/index.js.map +1 -1
  451. package/dist/theme/palette/background.d.ts.map +1 -1
  452. package/dist/theme/palette/background.js +3 -1
  453. package/dist/theme/palette/background.js.map +1 -1
  454. package/dist/theme/palette/colors/blue.js.map +1 -1
  455. package/dist/theme/palette/colors/common.js.map +1 -1
  456. package/dist/theme/palette/colors/green.js.map +1 -1
  457. package/dist/theme/palette/colors/grey.js.map +1 -1
  458. package/dist/theme/palette/colors/index.js.map +1 -1
  459. package/dist/theme/palette/colors/orange.js.map +1 -1
  460. package/dist/theme/palette/colors/purple.js.map +1 -1
  461. package/dist/theme/palette/colors/red.js.map +1 -1
  462. package/dist/theme/palette/colors/types.d.ts +1 -1
  463. package/dist/theme/palette/colors/types.d.ts.map +1 -1
  464. package/dist/theme/palette/colors/types.js.map +1 -1
  465. package/dist/theme/palette/error.js.map +1 -1
  466. package/dist/theme/palette/grey.js.map +1 -1
  467. package/dist/theme/palette/index.js.map +1 -1
  468. package/dist/theme/palette/palette-options.js.map +1 -1
  469. package/dist/theme/palette/primary.js.map +1 -1
  470. package/dist/theme/palette/secondary.js.map +1 -1
  471. package/dist/theme/palette/success.js.map +1 -1
  472. package/dist/theme/palette/text.js.map +1 -1
  473. package/dist/theme/palette/warning.js.map +1 -1
  474. package/dist/theme/theme.js +1 -1
  475. package/dist/theme/theme.js.map +1 -1
  476. package/dist/theme/types/ThemeExtension.d.js.map +1 -1
  477. package/dist/theme/typography.js.map +1 -1
  478. package/dist/utils/axis.d.ts +4 -4
  479. package/dist/utils/axis.d.ts.map +1 -1
  480. package/dist/utils/axis.js +4 -4
  481. package/dist/utils/axis.js.map +1 -1
  482. package/dist/utils/chart-actions.d.ts +6 -2
  483. package/dist/utils/chart-actions.d.ts.map +1 -1
  484. package/dist/utils/chart-actions.js +51 -7
  485. package/dist/utils/chart-actions.js.map +1 -1
  486. package/dist/utils/combine-sx.js.map +1 -1
  487. package/dist/utils/component-ids.js.map +1 -1
  488. package/dist/utils/format.js.map +1 -1
  489. package/dist/utils/index.js.map +1 -1
  490. package/dist/utils/mathjs.js +1 -1
  491. package/dist/utils/mathjs.js.map +1 -1
  492. package/dist/utils/theme-gen.d.ts +3 -8
  493. package/dist/utils/theme-gen.d.ts.map +1 -1
  494. package/dist/utils/theme-gen.js +11 -15
  495. package/dist/utils/theme-gen.js.map +1 -1
  496. package/package.json +8 -7
  497. package/dist/UnitSelector/UnitSelector.d.ts +0 -9
  498. package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
  499. package/dist/UnitSelector/UnitSelector.js.map +0 -1
  500. package/dist/UnitSelector/index.d.ts +0 -2
  501. package/dist/UnitSelector/index.d.ts.map +0 -1
  502. package/dist/UnitSelector/index.js.map +0 -1
  503. package/dist/context/ChartsThemeProvider.d.ts +0 -10
  504. package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
  505. package/dist/context/ChartsThemeProvider.js.map +0 -1
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import React from 'react';
15
15
  import { styled, Tooltip as MuiTooltip, tooltipClasses, Typography } from '@mui/material';
16
- export const InfoTooltip = ({ id , title , description , placement , children , enterDelay , enterNextDelay })=>{
16
+ export const InfoTooltip = ({ id, title, description, placement, children, enterDelay, enterNextDelay })=>{
17
17
  // Wrap children in a span to cover the following use cases:
18
18
  // - Disabled buttons. MUI console.errors on putting these inside a tooltip.
19
19
  // - Non-element tooltip children (e.g. text). The tooltip needs something that
@@ -36,7 +36,7 @@ export const InfoTooltip = ({ id , title , description , placement , children ,
36
36
  children: wrappedChildren
37
37
  });
38
38
  };
39
- const TooltipContent = ({ title , description })=>{
39
+ const TooltipContent = ({ title, description })=>{
40
40
  return /*#__PURE__*/ _jsxs(_Fragment, {
41
41
  children: [
42
42
  title && /*#__PURE__*/ _jsx(Typography, {
@@ -57,12 +57,12 @@ const TooltipContent = ({ title , description })=>{
57
57
  ]
58
58
  });
59
59
  };
60
- const StyledTooltip = styled(({ className , ...props })=>/*#__PURE__*/ _jsx(MuiTooltip, {
60
+ const StyledTooltip = styled(({ className, ...props })=>/*#__PURE__*/ _jsx(MuiTooltip, {
61
61
  ...props,
62
62
  classes: {
63
63
  popper: className
64
64
  }
65
- }))(({ theme })=>({
65
+ }))(({ theme })=>({
66
66
  [`& .${tooltipClasses.tooltip}`]: {
67
67
  backgroundColor: theme.palette.background.tooltip,
68
68
  color: theme.palette.text.primary,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/InfoTooltip/InfoTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport {\n styled,\n TooltipProps as MuiTooltipProps,\n Tooltip as MuiTooltip,\n tooltipClasses,\n Typography,\n} from '@mui/material';\n\nexport type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';\n\ninterface InfoTooltipProps {\n description: string;\n children: React.ReactNode;\n id?: string;\n title?: string;\n placement?: TooltipPlacement;\n enterDelay?: number; // default is 500ms\n enterNextDelay?: number; // default is 500ms\n}\n\nexport const InfoTooltip = ({\n id,\n title,\n description,\n placement,\n children,\n enterDelay,\n enterNextDelay,\n}: InfoTooltipProps) => {\n // Wrap children in a span to cover the following use cases:\n // - Disabled buttons. MUI console.errors on putting these inside a tooltip.\n // - Non-element tooltip children (e.g. text). The tooltip needs something that\n // can have a ref as a child.\n // We wrap in a `span` and not a `div` to minimize the impact on page layout\n // and styles.\n const wrappedChildren = <span>{children}</span>;\n\n return (\n <StyledTooltip\n arrow\n id={id}\n placement={placement ?? 'top'}\n title={<TooltipContent title={title} description={description} />}\n enterDelay={enterDelay ?? 500}\n enterNextDelay={enterNextDelay ?? 500}\n >\n {wrappedChildren}\n </StyledTooltip>\n );\n};\n\nconst TooltipContent = ({ title, description }: Pick<InfoTooltipProps, 'title' | 'description'>) => {\n return (\n <>\n {title && (\n <Typography\n variant=\"body2\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightMedium,\n })}\n >\n {title}\n </Typography>\n )}\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n })}\n >\n {description}\n </Typography>\n </>\n );\n};\n\nconst StyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => (\n <MuiTooltip {...props} classes={{ popper: className }} />\n))(({ theme }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.palette.background.tooltip,\n color: theme.palette.text.primary,\n maxWidth: '300px',\n padding: theme.spacing(1),\n boxShadow: theme.shadows[1],\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.palette.background.tooltip,\n },\n}));\n"],"names":["React","styled","Tooltip","MuiTooltip","tooltipClasses","Typography","InfoTooltip","id","title","description","placement","children","enterDelay","enterNextDelay","wrappedChildren","span","StyledTooltip","arrow","TooltipContent","variant","sx","theme","color","palette","text","primary","fontWeight","typography","fontWeightMedium","className","props","classes","popper","tooltip","backgroundColor","background","maxWidth","padding","spacing","boxShadow","shadows"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,MAAM,OAAO,CAAC;AAC1B,SACEC,MAAM,EAENC,OAAO,IAAIC,UAAU,EACrBC,cAAc,EACdC,UAAU,QACL,eAAe,CAAC;AAcvB,OAAO,MAAMC,WAAW,GAAG,CAAC,EAC1BC,EAAE,CAAA,EACFC,KAAK,CAAA,EACLC,WAAW,CAAA,EACXC,SAAS,CAAA,EACTC,QAAQ,CAAA,EACRC,UAAU,CAAA,EACVC,cAAc,CAAA,EACG,GAAK;IACtB,4DAA4D;IAC5D,6EAA6E;IAC7E,gFAAgF;IAChF,+BAA+B;IAC/B,4EAA4E;IAC5E,cAAc;IACd,MAAMC,eAAe,iBAAG,KAACC,MAAI;kBAAEJ,QAAQ;MAAQ,AAAC;I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AAC,GAAG,EAAEjB,cAAc,CAAC6B,OAAO,CAAC,CAAC,CAAC,EAAE;YAChCC,eAAe,EAAEb,KAAK,CAACE,OAAO,CAACY,UAAU,CAACF,OAAO;YACjDX,KAAK,EAAED,KAAK,CAACE,OAAO,CAACC,IAAI,CAACC,OAAO;YACjCW,QAAQ,EAAE,OAAO;YACjBC,OAAO,EAAEhB,KAAK,CAACiB,OAAO,CAAC,CAAC,CAAC;YACzBC,SAAS,EAAElB,KAAK,CAACmB,OAAO,CAAC,CAAC,CAAC;SAC5B;QACD,CAAC,CAAC,GAAG,EAAEpC,cAAc,CAACa,KAAK,CAAC,CAAC,CAAC,EAAE;YAC9BK,KAAK,EAAED,KAAK,CAACE,OAAO,CAACY,UAAU,CAACF,OAAO;SACxC;KACF,CAAA,AAAC,CAAC,AAAC"}
1
+ {"version":3,"sources":["../../src/InfoTooltip/InfoTooltip.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport {\n styled,\n TooltipProps as MuiTooltipProps,\n Tooltip as MuiTooltip,\n tooltipClasses,\n Typography,\n} from '@mui/material';\n\nexport type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom';\n\ninterface InfoTooltipProps {\n description: string;\n children: React.ReactNode;\n id?: string;\n title?: string;\n placement?: TooltipPlacement;\n enterDelay?: number; // default is 500ms\n enterNextDelay?: number; // default is 500ms\n}\n\nexport const InfoTooltip = ({\n id,\n title,\n description,\n placement,\n children,\n enterDelay,\n enterNextDelay,\n}: InfoTooltipProps) => {\n // Wrap children in a span to cover the following use cases:\n // - Disabled buttons. MUI console.errors on putting these inside a tooltip.\n // - Non-element tooltip children (e.g. text). The tooltip needs something that\n // can have a ref as a child.\n // We wrap in a `span` and not a `div` to minimize the impact on page layout\n // and styles.\n const wrappedChildren = <span>{children}</span>;\n\n return (\n <StyledTooltip\n arrow\n id={id}\n placement={placement ?? 'top'}\n title={<TooltipContent title={title} description={description} />}\n enterDelay={enterDelay ?? 500}\n enterNextDelay={enterNextDelay ?? 500}\n >\n {wrappedChildren}\n </StyledTooltip>\n );\n};\n\nconst TooltipContent = ({ title, description }: Pick<InfoTooltipProps, 'title' | 'description'>) => {\n return (\n <>\n {title && (\n <Typography\n variant=\"body2\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightMedium,\n })}\n >\n {title}\n </Typography>\n )}\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n color: theme.palette.text.primary,\n })}\n >\n {description}\n </Typography>\n </>\n );\n};\n\nconst StyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => (\n <MuiTooltip {...props} classes={{ popper: className }} />\n))(({ theme }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.palette.background.tooltip,\n color: theme.palette.text.primary,\n maxWidth: '300px',\n padding: theme.spacing(1),\n boxShadow: theme.shadows[1],\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.palette.background.tooltip,\n },\n}));\n"],"names":["React","styled","Tooltip","MuiTooltip","tooltipClasses","Typography","InfoTooltip","id","title","description","placement","children","enterDelay","enterNextDelay","wrappedChildren","span","StyledTooltip","arrow","TooltipContent","variant","sx","theme","color","palette","text","primary","fontWeight","typography","fontWeightMedium","className","props","classes","popper","tooltip","backgroundColor","background","maxWidth","padding","spacing","boxShadow","shadows"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AA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eAAe6B,OAAO,CAAC,CAAC,CAAC,EAAE;YAChCC,iBAAiBb,MAAME,OAAO,CAACY,UAAU,CAACF,OAAO;YACjDX,OAAOD,MAAME,OAAO,CAACC,IAAI,CAACC,OAAO;YACjCW,UAAU;YACVC,SAAShB,MAAMiB,OAAO,CAAC;YACvBC,WAAWlB,MAAMmB,OAAO,CAAC,EAAE;QAC7B;QACA,CAAC,CAAC,GAAG,EAAEpC,eAAea,KAAK,CAAC,CAAC,CAAC,EAAE;YAC9BK,OAAOD,MAAME,OAAO,CAACY,UAAU,CAACF,OAAO;QACzC;IACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/InfoTooltip/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './InfoTooltip';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"sources":["../../src/InfoTooltip/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './InfoTooltip';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB"}
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
2
1
  import { ReactCodeMirrorProps } from '@uiw/react-codemirror/src';
3
- declare type JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {
2
+ type JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {
4
3
  value: T;
5
- onChange?: (next: T) => void;
4
+ placeholder?: string;
5
+ onChange?: (next: string) => void;
6
6
  };
7
- export declare function JSONEditor<T>(props: JSONEditorProps<T>): JSX.Element;
7
+ export declare function JSONEditor<T>(props: JSONEditorProps<T>): import("react/jsx-runtime").JSX.Element;
8
8
  export {};
9
9
  //# sourceMappingURL=JSONEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JSONEditor.d.ts","sourceRoot":"","sources":["../src/JSONEditor.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,aAAK,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IAC/G,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,eAgCtD"}
1
+ {"version":3,"file":"JSONEditor.d.ts","sourceRoot":"","sources":["../src/JSONEditor.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IAC/G,KAAK,EAAE,CAAC,CAAC;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,2CAiCtD"}
@@ -20,6 +20,7 @@ export function JSONEditor(props) {
20
20
  const theme = useTheme();
21
21
  const isDarkMode = theme.palette.mode === 'dark';
22
22
  const [value, setValue] = useState(()=>JSON.stringify(props.value, null, 2));
23
+ const [lastProcessedValue, setLastProcessedValue] = useState(value);
23
24
  useEffect(()=>{
24
25
  setValue(JSON.stringify(props.value, null, 2));
25
26
  }, [
@@ -41,15 +42,15 @@ export function JSONEditor(props) {
41
42
  setValue(newValue);
42
43
  },
43
44
  onBlur: ()=>{
44
- try {
45
- const json = JSON.parse(value !== null && value !== void 0 ? value : '{}');
46
- if (props.onChange !== undefined) {
47
- props.onChange(json);
48
- }
49
- } catch (e) {
50
- // ignore this error
45
+ // Don't trigger the provided onChange if the last processed value is equal to the current value.
46
+ // This prevents e.g CTRL+F to trigger value refresh downstream, which would cause the embedded
47
+ // find & replace interface to close immediately.
48
+ if (lastProcessedValue !== value && props.onChange !== undefined) {
49
+ props.onChange(value);
50
+ setLastProcessedValue(value);
51
51
  }
52
- }
52
+ },
53
+ placeholder: props.placeholder
53
54
  });
54
55
  }
55
56
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/JSONEditor.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 { useEffect, useState } from 'react';\nimport CodeMirror from '@uiw/react-codemirror';\nimport { json, jsonParseLinter } from '@codemirror/lang-json';\nimport { linter, lintGutter } from '@codemirror/lint';\nimport { useTheme } from '@mui/material';\nimport { ReactCodeMirrorProps } from '@uiw/react-codemirror/src';\n\ntype JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {\n value: T;\n onChange?: (next: T) => void;\n};\n\nexport function JSONEditor<T>(props: JSONEditorProps<T>) {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const [value, setValue] = useState(() => JSON.stringify(props.value, null, 2));\n\n useEffect(() => {\n setValue(JSON.stringify(props.value, null, 2));\n }, [props.value]);\n\n return (\n <CodeMirror\n {...props}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n extensions={[json(), linter(jsonParseLinter()), lintGutter()]}\n value={value}\n onChange={(newValue) => {\n setValue(newValue);\n }}\n onBlur={() => {\n try {\n const json = JSON.parse(value ?? '{}');\n if (props.onChange !== undefined) {\n props.onChange(json);\n }\n } catch (e) {\n // ignore this error\n }\n }}\n />\n );\n}\n"],"names":["useEffect","useState","CodeMirror","json","jsonParseLinter","linter","lintGutter","useTheme","JSONEditor","props","theme","isDarkMode","palette","mode","value","setValue","JSON","stringify","style","border","divider","extensions","onChange","newValue","onBlur","parse","undefined","e"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAA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tBR,QAAQ,CAACQ,QAAQ,CAAC,CAAC;QACrB,CAAC;QACDC,MAAM,EAAE,IAAM;YACZ,IAAI;gBACF,MAAMrB,IAAI,GAAGa,IAAI,CAACS,KAAK,CAACX,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,IAAI,CAAC,AAAC;gBACvC,IAAIL,KAAK,CAACa,QAAQ,KAAKI,SAAS,EAAE;oBAChCjB,KAAK,CAACa,QAAQ,CAACnB,IAAI,CAAC,CAAC;gBACvB,CAAC;YACH,EAAE,OAAOwB,CAAC,EAAE;YACV,oBAAoB;YACtB,CAAC;QACH,CAAC;MACD,CACF;AACJ,CAAC"}
1
+ {"version":3,"sources":["../src/JSONEditor.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 { useEffect, useState } from 'react';\nimport CodeMirror from '@uiw/react-codemirror';\nimport { json, jsonParseLinter } from '@codemirror/lang-json';\nimport { linter, lintGutter } from '@codemirror/lint';\nimport { useTheme } from '@mui/material';\nimport { ReactCodeMirrorProps } from '@uiw/react-codemirror/src';\n\ntype JSONEditorProps<T> = Omit<ReactCodeMirrorProps, 'onBlur' | 'theme' | 'extensions' | 'onChange' | 'value'> & {\n value: T;\n placeholder?: string;\n onChange?: (next: string) => void;\n};\n\nexport function JSONEditor<T>(props: JSONEditorProps<T>) {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const [value, setValue] = useState(() => JSON.stringify(props.value, null, 2));\n const [lastProcessedValue, setLastProcessedValue] = useState<string>(value);\n\n useEffect(() => {\n setValue(JSON.stringify(props.value, null, 2));\n }, [props.value]);\n\n return (\n <CodeMirror\n {...props}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n extensions={[json(), linter(jsonParseLinter()), lintGutter()]}\n value={value}\n onChange={(newValue) => {\n setValue(newValue);\n }}\n onBlur={() => {\n // Don't trigger the provided onChange if the last processed value is equal to the current value.\n // This prevents e.g CTRL+F to trigger value refresh downstream, which would cause the embedded\n // find & replace interface to close immediately.\n if (lastProcessedValue !== value && props.onChange !== undefined) {\n props.onChange(value);\n setLastProcessedValue(value);\n }\n }}\n placeholder={props.placeholder}\n />\n );\n}\n"],"names":["useEffect","useState","CodeMirror","json","jsonParseLinter","linter","lintGutter","useTheme","JSONEditor","props","theme","isDarkMode","palette","mode","value","setValue","JSON","stringify","lastProcessedValue","setLastProcessedValue","style","border","divider","extensions","onChange","newValue","onBlur","undefined","placeholder"],"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,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,OAAOC,gBAAgB,wBAAwB;AAC/C,SAASC,IAAI,EAAEC,eAAe,QAAQ,wBAAwB;AAC9D,SAASC,MAAM,EAAEC,UAAU,QAAQ,mBAAmB;AACtD,SAASC,QAAQ,QAAQ,gBAAgB;AASzC,OAAO,SAASC,WAAcC,KAAyB;IACrD,MAAMC,QAAQH;IACd,MAAMI,aAAaD,MAAME,OAAO,CAACC,IAAI,KAAK;IAE1C,MAAM,CAACC,OAAOC,SAAS,GAAGd,SAAS,IAAMe,KAAKC,SAAS,CAACR,MAAMK,KAAK,EAAE,MAAM;IAC3E,MAAM,CAACI,oBAAoBC,sBAAsB,GAAGlB,SAAiBa;IAErEd,UAAU;QACRe,SAASC,KAAKC,SAAS,CAACR,MAAMK,KAAK,EAAE,MAAM;IAC7C,GAAG;QAACL,MAAMK,KAAK;KAAC;IAEhB,qBACE,KAACZ;QACE,GAAGO,KAAK;QACTW,OAAO;YAAEC,QAAQ,CAAC,UAAU,EAAEX,MAAME,OAAO,CAACU,OAAO,CAAC,CAAC;QAAC;QACtDZ,OAAOC,aAAa,SAAS;QAC7BY,YAAY;YAACpB;YAAQE,OAAOD;YAAoBE;SAAa;QAC7DQ,OAAOA;QACPU,UAAU,CAACC;YACTV,SAASU;QACX;QACAC,QAAQ;YACN,iGAAiG;YACjG,+FAA+F;YAC/F,iDAAiD;YACjD,IAAIR,uBAAuBJ,SAASL,MAAMe,QAAQ,KAAKG,WAAW;gBAChElB,MAAMe,QAAQ,CAACV;gBACfK,sBAAsBL;YACxB;QACF;QACAc,aAAanB,MAAMmB,WAAW;;AAGpC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ListLegendItemProps } from './ListLegendItem';
3
2
  import { LegendItem, SelectedLegendItemState } from './legend-model';
4
3
  export interface CompactLegendProps {
@@ -15,5 +14,5 @@ export interface CompactLegendProps {
15
14
  * number of items. The `ListLegend` is used for cases with large numbers of items
16
15
  * because it is virtualized.
17
16
  */
18
- export declare function CompactLegend({ height, items, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut, }: CompactLegendProps): JSX.Element;
17
+ export declare function CompactLegend({ height, items, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut, }: CompactLegendProps): import("react/jsx-runtime").JSX.Element;
19
18
  //# sourceMappingURL=CompactLegend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/CompactLegend.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAgC,MAAM,gBAAgB,CAAC;AAEnG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAClD,eAAe,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACpD,cAAc,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,EAAE,kBAAkB,eAqBpB"}
1
+ {"version":3,"file":"CompactLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/CompactLegend.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAgC,MAAM,gBAAgB,CAAC;AAEnG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAClD,eAAe,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACpD,cAAc,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,EAAE,kBAAkB,2CAqBpB"}
@@ -19,7 +19,7 @@ import { isLegendItemVisuallySelected } from './legend-model';
19
19
  * which corresponds to when legend.position is `bottom` with a relatively small
20
20
  * number of items. The `ListLegend` is used for cases with large numbers of items
21
21
  * because it is virtualized.
22
- */ export function CompactLegend({ height , items , selectedItems , onLegendItemClick , onItemMouseOver , onItemMouseOut }) {
22
+ */ export function CompactLegend({ height, items, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut }) {
23
23
  return /*#__PURE__*/ _jsx(Box, {
24
24
  component: "ul",
25
25
  sx: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/CompactLegend.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 { Box } from '@mui/material';\nimport { ListLegendItem, ListLegendItemProps } from './ListLegendItem';\nimport { LegendItem, SelectedLegendItemState, isLegendItemVisuallySelected } from './legend-model';\n\nexport interface CompactLegendProps {\n height: number;\n items: LegendItem[];\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * CompactLegend is default and used when legend items need to show side by side\n * which corresponds to when legend.position is `bottom` with a relatively small\n * number of items. The `ListLegend` is used for cases with large numbers of items\n * because it is virtualized.\n */\nexport function CompactLegend({\n height,\n items,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: CompactLegendProps) {\n return (\n <Box component=\"ul\" sx={{ width: '100%', height, padding: [0, 1, 0, 0], overflowY: 'scroll', margin: 0 }}>\n {items.map((item, index) => (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n onClick={onLegendItemClick}\n sx={{\n width: 'auto',\n float: 'left',\n paddingRight: 1.5,\n }}\n />\n ))}\n </Box>\n );\n}\n"],"names":["Box","ListLegendItem","isLegendItemVisuallySelected","CompactLegend","height","items","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","component","sx","width","padding","overflowY","margin","map","item","index","isVisuallySelected","onMouseOver","onMouseOut","onClick","float","paddingRight","id"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,cAAc,QAA6B,kBAAkB,CAAC;AACvE,SAA8CC,4BAA4B,QAAQ,gBAAgB,CAAC;AAWnG;;;;;CAKC,GACD,OAAO,SAASC,aAAa,CAAC,EAC5BC,MAAM,CAAA,EACNC,KAAK,CAAA,EACLC,aAAa,CAAA,EACbC,iBAAiB,CAAA,EACjBC,eAAe,CAAA,EACfC,cAAc,CAAA,EACK,EAAE;IACrB,qBACE,KAACT,GAAG;QAACU,SAAS,EAAC,IAAI;QAACC,EAAE,EAAE;YAAEC,KAAK,EAAE,MAAM;YAAER,MAAM;YAAES,OAAO,EAAE;AAAC,iBAAC;AAAE,iBAAC;AAAE,iBAAC;AAAE,iBAAC;aAAC;YAAEC,SAAS,EAAE,QAAQ;YAAEC,MAAM,EAAE,CAAC;SAAE;kBACrGV,KAAK,CAACW,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,iBACrB,KAACjB,cAAc;gBAEbgB,IAAI,EAAEA,IAAI;gBACVC,KAAK,EAAEA,KAAK;gBACZC,kBAAkB,EAAEjB,4BAA4B,CAACe,IAAI,EAAEX,aAAa,CAAC;gBACrEc,WAAW,EAAEZ,eAAe;gBAC5Ba,UAAU,EAAEZ,cAAc;gBAC1Ba,OAAO,EAAEf,iBAAiB;gBAC1BI,EAAE,EAAE;oBACFC,KAAK,EAAE,MAAM;oBACbW,KAAK,EAAE,MAAM;oBACbC,YAAY,EAAE,GAAG;iBAClB;eAXIP,IAAI,CAACQ,EAAE,CAYZ,AACH,CAAC;MACE,CACN;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/Legend/CompactLegend.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 { Box } from '@mui/material';\nimport { ListLegendItem, ListLegendItemProps } from './ListLegendItem';\nimport { LegendItem, SelectedLegendItemState, isLegendItemVisuallySelected } from './legend-model';\n\nexport interface CompactLegendProps {\n height: number;\n items: LegendItem[];\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * CompactLegend is default and used when legend items need to show side by side\n * which corresponds to when legend.position is `bottom` with a relatively small\n * number of items. The `ListLegend` is used for cases with large numbers of items\n * because it is virtualized.\n */\nexport function CompactLegend({\n height,\n items,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: CompactLegendProps) {\n return (\n <Box component=\"ul\" sx={{ width: '100%', height, padding: [0, 1, 0, 0], overflowY: 'scroll', margin: 0 }}>\n {items.map((item, index) => (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n onClick={onLegendItemClick}\n sx={{\n width: 'auto',\n float: 'left',\n paddingRight: 1.5,\n }}\n />\n ))}\n </Box>\n );\n}\n"],"names":["Box","ListLegendItem","isLegendItemVisuallySelected","CompactLegend","height","items","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","component","sx","width","padding","overflowY","margin","map","item","index","isVisuallySelected","onMouseOver","onMouseOut","onClick","float","paddingRight","id"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,QAA6B,mBAAmB;AACvE,SAA8CC,4BAA4B,QAAQ,iBAAiB;AAWnG;;;;;CAKC,GACD,OAAO,SAASC,cAAc,EAC5BC,MAAM,EACNC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACK;IACnB,qBACE,KAACT;QAAIU,WAAU;QAAKC,IAAI;YAAEC,OAAO;YAAQR;YAAQS,SAAS;gBAAC;gBAAG;gBAAG;gBAAG;aAAE;YAAEC,WAAW;YAAUC,QAAQ;QAAE;kBACpGV,MAAMW,GAAG,CAAC,CAACC,MAAMC,sBAChB,KAACjB;gBAECgB,MAAMA;gBACNC,OAAOA;gBACPC,oBAAoBjB,6BAA6Be,MAAMX;gBACvDc,aAAaZ;gBACba,YAAYZ;gBACZa,SAASf;gBACTI,IAAI;oBACFC,OAAO;oBACPW,OAAO;oBACPC,cAAc;gBAChB;eAXKP,KAAKQ,EAAE;;AAgBtB"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableLegendProps } from './TableLegend';
3
2
  import { LegendItem, LegendComponentOptions, SelectedLegendItemState } from './legend-model';
4
3
  import { ListLegendItemProps } from './ListLegendItem';
@@ -31,5 +30,5 @@ export interface LegendProps {
31
30
  */
32
31
  tableProps?: Pick<TableLegendProps, 'columns' | 'onSortingChange' | 'sorting'>;
33
32
  }
34
- export declare function Legend({ width, height, options, data, selectedItems, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, tableProps, }: LegendProps): JSX.Element;
33
+ export declare function Legend({ width, height, options, data, selectedItems, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, tableProps, }: LegendProps): import("react/jsx-runtime").JSX.Element;
35
34
  //# sourceMappingURL=Legend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.d.ts","sourceRoot":"","sources":["../../src/Legend/Legend.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,OAAO,EAAE,sBAAsB,CAAC;IAEhC;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IAEvC;;OAEG;IACH,qBAAqB,EAAE,CAAC,WAAW,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAEtE;;OAEG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAErD;;OAEG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAEnD;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAAC,CAAC;CAChF;AASD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,UAAU,GACX,EAAE,WAAW,eA8Fb"}
1
+ {"version":3,"file":"Legend.d.ts","sourceRoot":"","sources":["../../src/Legend/Legend.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,OAAO,EAAE,sBAAsB,CAAC;IAEhC;;;;;OAKG;IACH,aAAa,EAAE,uBAAuB,CAAC;IAEvC;;OAEG;IACH,qBAAqB,EAAE,CAAC,WAAW,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAEtE;;OAEG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAErD;;OAEG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAEnD;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAAC,CAAC;CAChF;AASD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,UAAU,GACX,EAAE,WAAW,2CA8Fb"}
@@ -23,7 +23,7 @@ import { TableLegend } from './TableLegend';
23
23
  // Set this number based on testing, but it may need to be tuned a bit on the
24
24
  // future as people test this out on different machines.
25
25
  const NEED_VIRTUALIZATION_LIMIT = 500;
26
- export function Legend({ width , height , options , data , selectedItems , onSelectedItemsChange , onItemMouseOver , onItemMouseOut , tableProps }) {
26
+ export function Legend({ width, height, options, data, selectedItems, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, tableProps }) {
27
27
  const onLegendItemClick = (e, seriesId)=>{
28
28
  const isModifiedClick = e.metaKey || e.shiftKey;
29
29
  const newSelected = produce(selectedItems, (draft)=>{
@@ -71,14 +71,14 @@ export function Legend({ width , height , options , data , selectedItems , onSel
71
71
  onItemMouseOut
72
72
  };
73
73
  let legendContent;
74
- if (mode === 'Table') {
74
+ if (mode === 'table') {
75
75
  legendContent = /*#__PURE__*/ _jsx(TableLegend, {
76
76
  ...commonLegendProps,
77
77
  onSelectedItemsChange: onSelectedItemsChange,
78
78
  width: width,
79
79
  ...tableProps
80
80
  });
81
- } else if (options.position === 'Right' || needsVirtualization) {
81
+ } else if (options.position === 'right' || needsVirtualization) {
82
82
  legendContent = /*#__PURE__*/ _jsx(ListLegend, {
83
83
  ...commonLegendProps,
84
84
  width: width,
@@ -90,7 +90,7 @@ export function Legend({ width , height , options , data , selectedItems , onSel
90
90
  onLegendItemClick: onLegendItemClick
91
91
  });
92
92
  }
93
- if (options.position === 'Right') {
93
+ if (options.position === 'right') {
94
94
  return /*#__PURE__*/ _jsx(Box, {
95
95
  sx: {
96
96
  width: width,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/Legend.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 { Box } from '@mui/material';\nimport { produce } from 'immer';\nimport { ReactNode } from 'react';\nimport { getLegendMode } from '@perses-dev/core';\nimport { ListLegend } from './ListLegend';\nimport { CompactLegend } from './CompactLegend';\nimport { TableLegend, TableLegendProps } from './TableLegend';\nimport { LegendItem, LegendComponentOptions, SelectedLegendItemState } from './legend-model';\nimport { ListLegendItemProps } from './ListLegendItem';\n\nexport interface LegendProps {\n width: number;\n height: number;\n data: LegendItem[];\n options: LegendComponentOptions;\n\n /**\n * State of selected items in the legend.\n *\n * Selected legend item state is a controlled value that should be managed using a\n * combination of this prop and `onSelectedChange`.\n */\n selectedItems: SelectedLegendItemState;\n\n /**\n * Callback fired when the selected items in the legend changes.\n */\n onSelectedItemsChange: (newSelected: SelectedLegendItemState) => void;\n\n /**\n * Callback fired when the mouse is moved over a legend item.\n */\n onItemMouseOver?: ListLegendItemProps['onMouseOver'];\n\n /**\n * Callback fired when the mouse is moved out of a legend item.\n */\n onItemMouseOut?: ListLegendItemProps['onMouseOut'];\n\n /**\n * Props specific to legend with `mode` set to `table`.\n */\n tableProps?: Pick<TableLegendProps, 'columns' | 'onSortingChange' | 'sorting'>;\n}\n\n// When the number of items to display is above this number, it is likely to\n// cause performance issues in the browser. The legend will be displayed in a\n// format (list) that allows for virtualization to minimize the performance impact.\n// Set this number based on testing, but it may need to be tuned a bit on the\n// future as people test this out on different machines.\nconst NEED_VIRTUALIZATION_LIMIT = 500;\n\nexport function Legend({\n width,\n height,\n options,\n data,\n selectedItems,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n tableProps,\n}: LegendProps) {\n const onLegendItemClick = (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string) => {\n const isModifiedClick = e.metaKey || e.shiftKey;\n\n const newSelected = produce(selectedItems, (draft) => {\n if (draft === 'ALL') {\n return {\n [seriesId]: true,\n };\n }\n\n const isSelected = !!draft[seriesId];\n\n // Clicks with modifier key can select multiple items.\n if (isModifiedClick) {\n if (isSelected) {\n // Modified click on already selected item. Remove that item.\n delete draft[seriesId];\n } else {\n // Modified click on not-selected item. Add it.\n draft[seriesId] = true;\n }\n return draft;\n }\n\n if (isSelected) {\n // Clicked item was already selected. Unselect it and return to\n // ALL state.\n return 'ALL' as const;\n }\n\n // Select clicked item.\n return { [seriesId]: true };\n });\n onSelectedItemsChange(newSelected);\n };\n\n const mode = getLegendMode(options.mode);\n\n // The bottom legend is displayed as a list when the number of items is too\n // large and requires virtualization. Otherwise, it is rendered more compactly.\n // We do not need this check for the right-side legend because it is always\n // a virtualized list.\n const needsVirtualization = data.length >= NEED_VIRTUALIZATION_LIMIT;\n\n const commonLegendProps = {\n height,\n items: data,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n };\n\n let legendContent: ReactNode;\n if (mode === 'Table') {\n legendContent = (\n <TableLegend {...commonLegendProps} onSelectedItemsChange={onSelectedItemsChange} width={width} {...tableProps} />\n );\n } else if (options.position === 'Right' || needsVirtualization) {\n legendContent = <ListLegend {...commonLegendProps} width={width} onLegendItemClick={onLegendItemClick} />;\n } else {\n legendContent = <CompactLegend {...commonLegendProps} onLegendItemClick={onLegendItemClick} />;\n }\n\n if (options.position === 'Right') {\n return (\n <Box\n sx={{\n width: width,\n height: height,\n position: 'absolute',\n top: 0,\n right: 0,\n }}\n >\n {legendContent}\n </Box>\n );\n }\n\n // Position bottom\n return (\n <Box\n sx={{\n width: width,\n height: height,\n position: 'absolute',\n bottom: 0,\n }}\n >\n {legendContent}\n </Box>\n );\n}\n"],"names":["Box","produce","getLegendMode","ListLegend","CompactLegend","TableLegend","NEED_VIRTUALIZATION_LIMIT","Legend","width","height","options","data","selectedItems","onSelectedItemsChange","onItemMouseOver","onItemMouseOut","tableProps","onLegendItemClick","e","seriesId","isModifiedClick","metaKey","shiftKey","newSelected","draft","isSelected","mode","needsVirtualization","length","commonLegendProps","items","legendContent","position","sx","top","right","bottom"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,OAAO,QAAQ,OAAO,CAA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AE,CAAC;gBACNC,KAAK,EAAE,CAAC;aACT;sBAEAJ,aAAa;UACV,CACN;IACJ,CAAC;IAED,kBAAkB;IAClB,qBACE,KAAC/B,GAAG;QACFiC,EAAE,EAAE;YACFzB,KAAK,EAAEA,KAAK;YACZC,MAAM,EAAEA,MAAM;YACduB,QAAQ,EAAE,UAAU;YACpBI,MAAM,EAAE,CAAC;SACV;kBAEAL,aAAa;MACV,CACN;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/Legend/Legend.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 { Box } from '@mui/material';\nimport { produce } from 'immer';\nimport { ReactNode } from 'react';\nimport { getLegendMode } from '@perses-dev/core';\nimport { ListLegend } from './ListLegend';\nimport { CompactLegend } from './CompactLegend';\nimport { TableLegend, TableLegendProps } from './TableLegend';\nimport { LegendItem, LegendComponentOptions, SelectedLegendItemState } from './legend-model';\nimport { ListLegendItemProps } from './ListLegendItem';\n\nexport interface LegendProps {\n width: number;\n height: number;\n data: LegendItem[];\n options: LegendComponentOptions;\n\n /**\n * State of selected items in the legend.\n *\n * Selected legend item state is a controlled value that should be managed using a\n * combination of this prop and `onSelectedChange`.\n */\n selectedItems: SelectedLegendItemState;\n\n /**\n * Callback fired when the selected items in the legend changes.\n */\n onSelectedItemsChange: (newSelected: SelectedLegendItemState) => void;\n\n /**\n * Callback fired when the mouse is moved over a legend item.\n */\n onItemMouseOver?: ListLegendItemProps['onMouseOver'];\n\n /**\n * Callback fired when the mouse is moved out of a legend item.\n */\n onItemMouseOut?: ListLegendItemProps['onMouseOut'];\n\n /**\n * Props specific to legend with `mode` set to `table`.\n */\n tableProps?: Pick<TableLegendProps, 'columns' | 'onSortingChange' | 'sorting'>;\n}\n\n// When the number of items to display is above this number, it is likely to\n// cause performance issues in the browser. The legend will be displayed in a\n// format (list) that allows for virtualization to minimize the performance impact.\n// Set this number based on testing, but it may need to be tuned a bit on the\n// future as people test this out on different machines.\nconst NEED_VIRTUALIZATION_LIMIT = 500;\n\nexport function Legend({\n width,\n height,\n options,\n data,\n selectedItems,\n onSelectedItemsChange,\n onItemMouseOver,\n onItemMouseOut,\n tableProps,\n}: LegendProps) {\n const onLegendItemClick = (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string) => {\n const isModifiedClick = e.metaKey || e.shiftKey;\n\n const newSelected = produce(selectedItems, (draft) => {\n if (draft === 'ALL') {\n return {\n [seriesId]: true,\n };\n }\n\n const isSelected = !!draft[seriesId];\n\n // Clicks with modifier key can select multiple items.\n if (isModifiedClick) {\n if (isSelected) {\n // Modified click on already selected item. Remove that item.\n delete draft[seriesId];\n } else {\n // Modified click on not-selected item. Add it.\n draft[seriesId] = true;\n }\n return draft;\n }\n\n if (isSelected) {\n // Clicked item was already selected. Unselect it and return to\n // ALL state.\n return 'ALL' as const;\n }\n\n // Select clicked item.\n return { [seriesId]: true };\n });\n onSelectedItemsChange(newSelected);\n };\n\n const mode = getLegendMode(options.mode);\n\n // The bottom legend is displayed as a list when the number of items is too\n // large and requires virtualization. Otherwise, it is rendered more compactly.\n // We do not need this check for the right-side legend because it is always\n // a virtualized list.\n const needsVirtualization = data.length >= NEED_VIRTUALIZATION_LIMIT;\n\n const commonLegendProps = {\n height,\n items: data,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n };\n\n let legendContent: ReactNode;\n if (mode === 'table') {\n legendContent = (\n <TableLegend {...commonLegendProps} onSelectedItemsChange={onSelectedItemsChange} width={width} {...tableProps} />\n );\n } else if (options.position === 'right' || needsVirtualization) {\n legendContent = <ListLegend {...commonLegendProps} width={width} onLegendItemClick={onLegendItemClick} />;\n } else {\n legendContent = <CompactLegend {...commonLegendProps} onLegendItemClick={onLegendItemClick} />;\n }\n\n if (options.position === 'right') {\n return (\n <Box\n sx={{\n width: width,\n height: height,\n position: 'absolute',\n top: 0,\n right: 0,\n }}\n >\n {legendContent}\n </Box>\n );\n }\n\n // Position bottom\n return (\n <Box\n sx={{\n width: width,\n height: height,\n position: 'absolute',\n bottom: 0,\n }}\n >\n {legendContent}\n </Box>\n );\n}\n"],"names":["Box","produce","getLegendMode","ListLegend","CompactLegend","TableLegend","NEED_VIRTUALIZATION_LIMIT","Legend","width","height","options","data","selectedItems","onSelectedItemsChange","onItemMouseOver","onItemMouseOut","tableProps","onLegendItemClick","e","seriesId","isModifiedClick","metaKey","shiftKey","newSelected","draft","isSelected","mode","needsVirtualization","length","commonLegendProps","items","legendContent","position","sx","top","right","bottom"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,WAAW,QAA0B,gBAAgB;AAuC9D,4EAA4E;AAC5E,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA6E;AAC7E,wDAAwD;AACxD,MAAMC,4BAA4B;AAElC,OAAO,SAASC,OAAO,EACrBC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,aAAa,EACbC,qBAAqB,EACrBC,eAAe,EACfC,cAAc,EACdC,UAAU,EACE;IACZ,MAAMC,oBAAoB,CAACC,GAA8CC;QACvE,MAAMC,kB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BACPC,QAAQA;gBACRuB,UAAU;gBACVE,KAAK;gBACLC,OAAO;YACT;sBAECJ;;IAGP;IAEA,kBAAkB;IAClB,qBACE,KAAC/B;QACCiC,IAAI;YACFzB,OAAOA;YACPC,QAAQA;YACRuB,UAAU;YACVI,QAAQ;QACV;kBAECL;;AAGP"}
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import React from 'react';
15
15
  import { Box } from '@mui/material';
16
16
  import { combineSx } from '../utils';
17
- export const LegendColorBadge = /*#__PURE__*/ React.memo(function LegendColorBadge({ color , sx , ...others }) {
17
+ export const LegendColorBadge = /*#__PURE__*/ React.memo(function LegendColorBadge({ color, sx, ...others }) {
18
18
  return /*#__PURE__*/ _jsx(Box, {
19
19
  ...others,
20
20
  sx: combineSx({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/LegendColorBadge.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { Box, BoxProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface LegendColorBadgeProps extends BoxProps<'div'> {\n color: string;\n}\n\nexport const LegendColorBadge = React.memo(function LegendColorBadge({ color, sx, ...others }: LegendColorBadgeProps) {\n return (\n <Box\n {...others}\n sx={combineSx(\n {\n height: 4,\n width: 16,\n margin: (theme) => theme.spacing(0.5),\n },\n sx\n )}\n style={{ backgroundColor: color }}\n />\n );\n});\n"],"names":["React","Box","combineSx","LegendColorBadge","memo","color","sx","others","height","width","margin","theme","spacing","style","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,MAAM,OAAO,CAAC;AAC1B,SAASC,GAAG,QAAkB,eAAe,CAAC;AAC9C,SAASC,SAAS,QAAQ,UAAU,CAAC;AAMrC,OAAO,MAAMC,gBAAgB,iBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,gBAAgB,CAAC,EAAEE,KAAK,CAAA,EAAEC,EAAE,CAAA,EAAE,GAAGC,MAAM,EAAyB,EAAE;IACpH,qBACE,KAACN,GAAG;QACD,GAAGM,MAAM;QACVD,EAAE,EAAEJ,SAAS,CACX;YACEM,MAAM,EAAE,CAAC;YACTC,KAAK,EAAE,EAAE;YACTC,MAAM,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAAC,GAAG,CAAC;SACtC,EACDN,EAAE,CACH;QACDO,KAAK,EAAE;YAAEC,eAAe,EAAET,KAAK;SAAE;MACjC,CACF;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/Legend/LegendColorBadge.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { Box, BoxProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface LegendColorBadgeProps extends BoxProps<'div'> {\n color: string;\n}\n\nexport const LegendColorBadge = React.memo(function LegendColorBadge({ color, sx, ...others }: LegendColorBadgeProps) {\n return (\n <Box\n {...others}\n sx={combineSx(\n {\n height: 4,\n width: 16,\n margin: (theme) => theme.spacing(0.5),\n },\n sx\n )}\n style={{ backgroundColor: color }}\n />\n );\n});\n"],"names":["React","Box","combineSx","LegendColorBadge","memo","color","sx","others","height","width","margin","theme","spacing","style","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,SAASC,GAAG,QAAkB,gBAAgB;AAC9C,SAASC,SAAS,QAAQ,WAAW;AAMrC,OAAO,MAAMC,iCAAmBH,MAAMI,IAAI,CAAC,SAASD,iBAAiB,EAAEE,KAAK,EAAEC,EAAE,EAAE,GAAGC,QAA+B;IAClH,qBACE,KAACN;QACE,GAAGM,MAAM;QACVD,IAAIJ,UACF;YACEM,QAAQ;YACRC,OAAO;YACPC,QAAQ,CAACC,QAAUA,MAAMC,OAAO,CAAC;QACnC,GACAN;QAEFO,OAAO;YAAEC,iBAAiBT;QAAM;;AAGtC,GAAG"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ListLegendItemProps } from './ListLegendItem';
3
2
  import { LegendItem, SelectedLegendItemState } from './legend-model';
4
3
  export interface ListLegendProps {
@@ -16,5 +15,5 @@ export interface ListLegendProps {
16
15
  * large number of items because it is virtualized and easier to visually scan
17
16
  * large numbers of items when there is a single item per row.
18
17
  */
19
- export declare function ListLegend({ items, height, width, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut, }: ListLegendProps): JSX.Element;
18
+ export declare function ListLegend({ items, height, width, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut, }: ListLegendProps): import("react/jsx-runtime").JSX.Element;
20
19
  //# sourceMappingURL=ListLegend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/ListLegend.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAgC,MAAM,gBAAgB,CAAC;AAEnG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAClD,eAAe,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACpD,cAAc,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,EAAE,eAAe,eA8BjB"}
1
+ {"version":3,"file":"ListLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/ListLegend.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAgC,MAAM,gBAAgB,CAAC;AAEnG,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,uBAAuB,CAAC;IACvC,iBAAiB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAClD,eAAe,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACpD,cAAc,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,EAAE,eAAe,2CA8BjB"}
@@ -19,7 +19,7 @@ import { isLegendItemVisuallySelected } from './legend-model';
19
19
  * stacked. It is also used for `bottom` positioned legends when there are a
20
20
  * large number of items because it is virtualized and easier to visually scan
21
21
  * large numbers of items when there is a single item per row.
22
- */ export function ListLegend({ items , height , width , selectedItems , onLegendItemClick , onItemMouseOver , onItemMouseOut }) {
22
+ */ export function ListLegend({ items, height, width, selectedItems, onLegendItemClick, onItemMouseOver, onItemMouseOut }) {
23
23
  // show full labels on hover when there are many total series
24
24
  const truncateLabels = items.length > 5;
25
25
  return /*#__PURE__*/ _jsx(Virtuoso, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/ListLegend.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 { Virtuoso } from 'react-virtuoso';\nimport { ListLegendItem, ListLegendItemProps } from './ListLegendItem';\nimport { LegendItem, SelectedLegendItemState, isLegendItemVisuallySelected } from './legend-model';\n\nexport interface ListLegendProps {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * ListLegend is used when legend.position is 'right' since legend items are\n * stacked. It is also used for `bottom` positioned legends when there are a\n * large number of items because it is virtualized and easier to visually scan\n * large numbers of items when there is a single item per row.\n */\nexport function ListLegend({\n items,\n height,\n width,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: ListLegendProps) {\n // show full labels on hover when there are many total series\n const truncateLabels = items.length > 5;\n\n return (\n <Virtuoso\n style={{ height, width }}\n data={items}\n itemContent={(index, item) => {\n return (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n truncateLabel={truncateLabels}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onClick={onLegendItemClick}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n sx={{\n width: '100%',\n wordBreak: 'break-word',\n overflow: 'hidden',\n }}\n />\n );\n }}\n role=\"list\"\n />\n );\n}\n"],"names":["Virtuoso","ListLegendItem","isLegendItemVisuallySelected","ListLegend","items","height","width","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","truncateLabels","length","style","data","itemContent","index","item","truncateLabel","isVisuallySelected","onClick","onMouseOver","onMouseOut","sx","wordBreak","overflow","id","role"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,SAASA,QAAQ,QAAQ,gBAAgB,CAAC;AAC1C,SAASC,cAAc,QAA6B,kBAAkB,CAAC;AACvE,SAA8CC,4BAA4B,QAAQ,gBAAgB,CAAC;AAYnG;;;;;CAKC,GACD,OAAO,SAASC,UAAU,CAAC,EACzBC,KAAK,CAAA,EACLC,MAAM,CAAA,EACNC,KAAK,CAAA,EACLC,aAAa,CAAA,EACbC,iBAAiB,CAAA,EACjBC,eAAe,CAAA,EACfC,cAAc,CAAA,EACE,EAAE;IAClB,6DAA6D;IAC7D,MAAMC,cAAc,GAAGP,KAAK,CAACQ,MAAM,GAAG,CAAC,AAAC;IAExC,qBACE,KAACZ,QAAQ;QACPa,KAAK,EAAE;YAAER,MAAM;YAAEC,KAAK;SAAE;QACxBQ,IAAI,EAAEV,KAAK;QACXW,WAAW,EAAE,CAACC,KAAK,EAAEC,IAAI,GAAK;YAC5B,qBACE,KAAChB,cAAc;gBAEbgB,IAAI,EAAEA,IAAI;gBACVD,KAAK,EAAEA,KAAK;gBACZE,aAAa,EAAEP,cAAc;gBAC7BQ,kBAAkB,EAAEjB,4BAA4B,CAACe,IAAI,EAAEV,aAAa,CAAC;gBACrEa,OAAO,EAAEZ,iBAAiB;gBAC1Ba,WAAW,EAAEZ,eAAe;gBAC5Ba,UAAU,EAAEZ,cAAc;gBAC1Ba,EAAE,EAAE;oBACFjB,KAAK,EAAE,MAAM;oBACbkB,SAAS,EAAE,YAAY;oBACvBC,QAAQ,EAAE,QAAQ;iBACnB;eAZIR,IAAI,CAACS,EAAE,CAaZ,CACF;QACJ,CAAC;QACDC,IAAI,EAAC,MAAM;MACX,CACF;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/Legend/ListLegend.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 { Virtuoso } from 'react-virtuoso';\nimport { ListLegendItem, ListLegendItemProps } from './ListLegendItem';\nimport { LegendItem, SelectedLegendItemState, isLegendItemVisuallySelected } from './legend-model';\n\nexport interface ListLegendProps {\n items: LegendItem[];\n height: number;\n width: number;\n selectedItems: SelectedLegendItemState;\n onLegendItemClick: ListLegendItemProps['onClick'];\n onItemMouseOver: ListLegendItemProps['onMouseOver'];\n onItemMouseOut: ListLegendItemProps['onMouseOut'];\n}\n\n/**\n * ListLegend is used when legend.position is 'right' since legend items are\n * stacked. It is also used for `bottom` positioned legends when there are a\n * large number of items because it is virtualized and easier to visually scan\n * large numbers of items when there is a single item per row.\n */\nexport function ListLegend({\n items,\n height,\n width,\n selectedItems,\n onLegendItemClick,\n onItemMouseOver,\n onItemMouseOut,\n}: ListLegendProps) {\n // show full labels on hover when there are many total series\n const truncateLabels = items.length > 5;\n\n return (\n <Virtuoso\n style={{ height, width }}\n data={items}\n itemContent={(index, item) => {\n return (\n <ListLegendItem\n key={item.id}\n item={item}\n index={index}\n truncateLabel={truncateLabels}\n isVisuallySelected={isLegendItemVisuallySelected(item, selectedItems)}\n onClick={onLegendItemClick}\n onMouseOver={onItemMouseOver}\n onMouseOut={onItemMouseOut}\n sx={{\n width: '100%',\n wordBreak: 'break-word',\n overflow: 'hidden',\n }}\n />\n );\n }}\n role=\"list\"\n />\n );\n}\n"],"names":["Virtuoso","ListLegendItem","isLegendItemVisuallySelected","ListLegend","items","height","width","selectedItems","onLegendItemClick","onItemMouseOver","onItemMouseOut","truncateLabels","length","style","data","itemContent","index","item","truncateLabel","isVisuallySelected","onClick","onMouseOver","onMouseOut","sx","wordBreak","overflow","id","role"],"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,QAAQ,iBAAiB;AAC1C,SAASC,cAAc,QAA6B,mBAAmB;AACvE,SAA8CC,4BAA4B,QAAQ,iBAAiB;AAYnG;;;;;CAKC,GACD,OAAO,SAASC,WAAW,EACzBC,KAAK,EACLC,MAAM,EACNC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACE;IAChB,6DAA6D;IAC7D,MAAMC,iBAAiBP,MAAMQ,MAAM,GAAG;IAEtC,qBACE,KAACZ;QACCa,OAAO;YAAER;YAAQC;QAAM;QACvBQ,MAAMV;QACNW,aAAa,CAACC,OAAOC;YACnB,qBACE,KAAChB;gBAECgB,MAAMA;gBACND,OAAOA;gBACPE,eAAeP;gBACfQ,oBAAoBjB,6BAA6Be,MAAMV;gBACvDa,SAASZ;gBACTa,aAAaZ;gBACba,YAAYZ;gBACZa,IAAI;oBACFjB,OAAO;oBACPkB,WAAW;oBACXC,UAAU;gBACZ;eAZKR,KAAKS,EAAE;QAelB;QACAC,MAAK;;AAGX"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ListItemProps } from '@mui/material';
3
3
  import { LegendItem } from './legend-model';
4
- export declare type LegendItemEventOpts = {
4
+ export type LegendItemEventOpts = {
5
5
  /**
6
6
  * Unique identifier for the legend item.
7
7
  */
@@ -30,5 +30,5 @@ export interface ListLegendItemProps extends Omit<ListItemProps<'div'>, 'onClick
30
30
  */
31
31
  truncateLabel?: boolean;
32
32
  }
33
- export declare const ListLegendItem: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<ListLegendItemProps, "classes" | "className" | "style" | "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" | "autoFocus" | "alignItems" | "disabled" | "selected" | "dense" | "components" | "ContainerComponent" | "ContainerProps" | "disableGutters" | "disablePadding" | "divider" | "secondaryAction" | "componentsProps" | "slotProps" | "slots" | "item" | "index" | "isVisuallySelected" | "truncateLabel"> & React.RefAttributes<HTMLDivElement>>>;
33
+ export declare const ListLegendItem: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<ListLegendItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>>;
34
34
  //# sourceMappingURL=ListLegendItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListLegendItem.d.ts","sourceRoot":"","sources":["../../src/Legend/ListLegendItem.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAA+B,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oBAAY,mBAAmB,GAAG;IAChC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;IAC/G,IAAI,EAAE,UAAU,CAAC;IAEjB,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAElF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEtE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0DD,eAAO,MAAM,cAAc,86JAAiC,CAAC"}
1
+ {"version":3,"file":"ListLegendItem.d.ts","sourceRoot":"","sources":["../../src/Legend/ListLegendItem.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAA+B,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;IAC/G,IAAI,EAAE,UAAU,CAAC;IAEjB,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAElF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAEtE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0DD,eAAO,MAAM,cAAc,oIAAiC,CAAC"}
@@ -16,7 +16,7 @@ import React, { forwardRef, useState } from 'react';
16
16
  import { Box, ListItemText, ListItem } from '@mui/material';
17
17
  import { combineSx } from '../utils';
18
18
  import { LegendColorBadge } from './LegendColorBadge';
19
- const ListLegendItemBase = /*#__PURE__*/ forwardRef(function ListLegendItem({ item , sx , truncateLabel , onClick , isVisuallySelected , onMouseOver , onMouseOut , index , ...others }, ref) {
19
+ const ListLegendItemBase = /*#__PURE__*/ forwardRef(function ListLegendItem({ item, sx, truncateLabel, onClick, isVisuallySelected, onMouseOver, onMouseOut, index, ...others }, ref) {
20
20
  const [noWrap, setNoWrap] = useState(truncateLabel);
21
21
  function handleTextMouseOver() {
22
22
  if (truncateLabel) {
@@ -29,9 +29,9 @@ const ListLegendItemBase = /*#__PURE__*/ forwardRef(function ListLegendItem({ it
29
29
  }
30
30
  }
31
31
  const handleClick = (e)=>{
32
- var ref;
32
+ var _item_onClick;
33
33
  onClick(e, item.id);
34
- (ref = item.onClick) === null || ref === void 0 ? void 0 : ref.call(item, e);
34
+ (_item_onClick = item.onClick) === null || _item_onClick === void 0 ? void 0 : _item_onClick.call(item, e);
35
35
  };
36
36
  return /*#__PURE__*/ _createElement(ListItem, {
37
37
  ...others,
@@ -44,18 +44,14 @@ const ListLegendItemBase = /*#__PURE__*/ forwardRef(function ListLegendItem({ it
44
44
  dense: true,
45
45
  key: item.id,
46
46
  onClick: handleClick,
47
- onMouseOver: (e)=>{
48
- return onMouseOver === null || onMouseOver === void 0 ? void 0 : onMouseOver(e, {
47
+ onMouseOver: (e)=>onMouseOver === null || onMouseOver === void 0 ? void 0 : onMouseOver(e, {
49
48
  id: item.id,
50
49
  index
51
- });
52
- },
53
- onMouseOut: (e)=>{
54
- return onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut(e, {
50
+ }),
51
+ onMouseOut: (e)=>onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut(e, {
55
52
  id: item.id,
56
53
  index
57
- });
58
- },
54
+ }),
59
55
  selected: isVisuallySelected,
60
56
  ref: ref,
61
57
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Legend/ListLegendItem.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { forwardRef, useState } from 'react';\nimport { Box, ListItemText, ListItem, ListItemProps } from '@mui/material';\nimport { combineSx } from '../utils';\nimport { LegendColorBadge } from './LegendColorBadge';\nimport { LegendItem } from './legend-model';\n\nexport type LegendItemEventOpts = {\n /**\n * Unique identifier for the legend item.\n */\n id: string;\n\n /**\n * Index of the row in the original data.\n */\n index: number;\n};\n\nexport interface ListLegendItemProps extends Omit<ListItemProps<'div'>, 'onClick' | 'onMouseOver' | 'onMouseOut'> {\n item: LegendItem;\n\n index: number;\n\n /**\n * When true, the item is rendered differently to visually communicate it is\n * selected.\n */\n isVisuallySelected?: boolean;\n\n onClick: (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string) => void;\n\n onMouseOver?: (e: React.MouseEvent, opts: LegendItemEventOpts) => void;\n onMouseOut?: (e: React.MouseEvent, opts: LegendItemEventOpts) => void;\n\n /**\n * When `true`, will keep labels to a single line with overflow ellipsized. The\n * full content will be shown on hover.\n *\n * When `false` or unset, will show the full label.\n */\n truncateLabel?: boolean;\n}\n\nconst ListLegendItemBase = forwardRef<HTMLDivElement, ListLegendItemProps>(function ListLegendItem(\n { item, sx, truncateLabel, onClick, isVisuallySelected, onMouseOver, onMouseOut, index, ...others },\n ref\n) {\n const [noWrap, setNoWrap] = useState(truncateLabel);\n\n function handleTextMouseOver() {\n if (truncateLabel) {\n setNoWrap(false);\n }\n }\n\n function handleTextMouseOut() {\n if (truncateLabel) {\n setNoWrap(true);\n }\n }\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {\n onClick(e, item.id);\n item.onClick?.(e);\n };\n\n return (\n <ListItem\n {...others}\n component=\"div\"\n role=\"listitem\"\n sx={combineSx(\n {\n padding: 0,\n cursor: 'pointer',\n },\n sx\n )}\n dense={true}\n key={item.id}\n onClick={handleClick}\n onMouseOver={(e: React.MouseEvent) => onMouseOver?.(e, { id: item.id, index })}\n onMouseOut={(e: React.MouseEvent) => onMouseOut?.(e, { id: item.id, index })}\n selected={isVisuallySelected}\n ref={ref}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <LegendColorBadge color={item.color} />\n </Box>\n <ListItemText\n primary={item.label}\n primaryTypographyProps={{ noWrap: noWrap }}\n onMouseOver={handleTextMouseOver}\n onMouseOut={handleTextMouseOut}\n ></ListItemText>\n </ListItem>\n );\n});\n\nexport const ListLegendItem = React.memo(ListLegendItemBase);\n"],"names":["React","forwardRef","useState","Box","ListItemText","ListItem","combineSx","LegendColorBadge","ListLegendItemBase","ListLegendItem","item","sx","truncateLabel","onClick","isVisuallySelected","onMouseOver","onMouseOut","index","others","ref","noWrap","setNoWrap","handleTextMouseOver","handleTextMouseOut","handleClick","e","id","component","role","padding","cursor","dense","key","selected","display","alignItems","color","primary","label","primaryTypographyProps","memo"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AACpD,SAASC,GAAG,EAAEC,YAAY,EAAEC,QAAQ,QAAuB,eAAe,CAAC;AAC3E,SAASC,SAAS,QAAQ,UAAU,CAAC;AACrC,SAASC,gBAAgB,QAAQ,oBAAoB,CAAC;AAwCtD,MAAMC,kBAAkB,iBAAGP,UAAU,CAAsC,SAASQ,cAAc,CAChG,EAAEC,IAAI,CAAA,EAAEC,EAAE,CAAA,EAAEC,aAAa,CAAA,EAAEC,OAAO,CAAA,EAAEC,kBAAkB,CAAA,EAAEC,WAAW,CAAA,EAAEC,UAAU,CAAA,EAAEC,KAAK,CAAA,EAAE,GA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GAAvCA,UAAU,CAAGS,CAAC,EAAE;gBAAEC,EAAE,EAAEhB,IAAI,CAACgB,EAAE;gBAAET,KAAK;aAAE,CAAC,CAAA;SAAA;QAC5EgB,QAAQ,EAAEnB,kBAAkB;QAC5BK,GAAG,EAAEA,GAAG;;0BAER,KAAChB,GAAG;gBAACQ,EAAE,EAAE;oBAAEuB,OAAO,EAAE,MAAM;oBAAEC,UAAU,EAAE,QAAQ;iBAAE;0BAChD,cAAA,KAAC5B,gBAAgB;oBAAC6B,KAAK,EAAE1B,IAAI,CAAC0B,KAAK;kBAAI;cACnC;0BACN,KAAChC,YAAY;gBACXiC,OAAO,EAAE3B,IAAI,CAAC4B,KAAK;gBACnBC,sBAAsB,EAAE;oBAAEnB,MAAM,EAAEA,MAAM;iBAAE;gBAC1CL,WAAW,EAAEO,mBAAmB;gBAChCN,UAAU,EAAEO,kBAAkB;cAChB;;MACP,CACX;AACJ,CAAC,CAAC,AAAC;AAEH,OAAO,MAAMd,cAAc,iBAAGT,KAAK,CAACwC,IAAI,CAAChC,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/Legend/ListLegendItem.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { forwardRef, useState } from 'react';\nimport { Box, ListItemText, ListItem, ListItemProps } from '@mui/material';\nimport { combineSx } from '../utils';\nimport { LegendColorBadge } from './LegendColorBadge';\nimport { LegendItem } from './legend-model';\n\nexport type LegendItemEventOpts = {\n /**\n * Unique identifier for the legend item.\n */\n id: string;\n\n /**\n * Index of the row in the original data.\n */\n index: number;\n};\n\nexport interface ListLegendItemProps extends Omit<ListItemProps<'div'>, 'onClick' | 'onMouseOver' | 'onMouseOut'> {\n item: LegendItem;\n\n index: number;\n\n /**\n * When true, the item is rendered differently to visually communicate it is\n * selected.\n */\n isVisuallySelected?: boolean;\n\n onClick: (e: React.MouseEvent<HTMLElement, MouseEvent>, seriesId: string) => void;\n\n onMouseOver?: (e: React.MouseEvent, opts: LegendItemEventOpts) => void;\n onMouseOut?: (e: React.MouseEvent, opts: LegendItemEventOpts) => void;\n\n /**\n * When `true`, will keep labels to a single line with overflow ellipsized. The\n * full content will be shown on hover.\n *\n * When `false` or unset, will show the full label.\n */\n truncateLabel?: boolean;\n}\n\nconst ListLegendItemBase = forwardRef<HTMLDivElement, ListLegendItemProps>(function ListLegendItem(\n { item, sx, truncateLabel, onClick, isVisuallySelected, onMouseOver, onMouseOut, index, ...others },\n ref\n) {\n const [noWrap, setNoWrap] = useState(truncateLabel);\n\n function handleTextMouseOver() {\n if (truncateLabel) {\n setNoWrap(false);\n }\n }\n\n function handleTextMouseOut() {\n if (truncateLabel) {\n setNoWrap(true);\n }\n }\n\n const handleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {\n onClick(e, item.id);\n item.onClick?.(e);\n };\n\n return (\n <ListItem\n {...others}\n component=\"div\"\n role=\"listitem\"\n sx={combineSx(\n {\n padding: 0,\n cursor: 'pointer',\n },\n sx\n )}\n dense={true}\n key={item.id}\n onClick={handleClick}\n onMouseOver={(e: React.MouseEvent) => onMouseOver?.(e, { id: item.id, index })}\n onMouseOut={(e: React.MouseEvent) => onMouseOut?.(e, { id: item.id, index })}\n selected={isVisuallySelected}\n ref={ref}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <LegendColorBadge color={item.color} />\n </Box>\n <ListItemText\n primary={item.label}\n primaryTypographyProps={{ noWrap: noWrap }}\n onMouseOver={handleTextMouseOver}\n onMouseOut={handleTextMouseOut}\n ></ListItemText>\n </ListItem>\n );\n});\n\nexport const ListLegendItem = React.memo(ListLegendItemBase);\n"],"names":["React","forwardRef","useState","Box","ListItemText","ListItem","combineSx","LegendColorBadge","ListLegendItemBase","ListLegendItem","item","sx","truncateLabel","onClick","isVisuallySelected","onMouseOver","onMouseOut","index","others","ref","noWrap","setNoWrap","handleTextMouseOver","handleTextMouseOut","handleClick","e","id","component","role","padding","cursor","dense","key","selected","display","alignItems","color","primary","label","primaryTypographyProps","memo"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,OAAOA,SAASC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACpD,SAASC,GAAG,EAAEC,YAAY,EAAEC,QAAQ,QAAuB,gBAAgB;AAC3E,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,gBAAgB,QAAQ,qBAAqB;AAwCtD,MAAMC,mCAAqBP,WAAgD,SAASQ,eAClF,EAAEC,IAAI,EAAEC,EAAE,EAAEC,aAAa,EAAEC,OAAO,EAAEC,kBAAkB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,KAAK,EAAE,GAAGC,QAAQ,EACnGC,GAAG;IAEH,MAAM,CAACC,QAAQC,UAAU,GAAGnB,SAASU;IAErC,SAASU;QACP,IAAIV,eAAe;YACjBS,UAAU;QACZ;IACF;IAEA,SAASE;QACP,IAAIX,eAAe;YACjBS,UAAU;QACZ;IACF;IAEA,MAAMG,cAAuD,CAACC;YAE5Df;QADAG,QAAQY,GAAGf,KAAKgB,EAAE;SAClBhB,gBAAAA,KAAKG,OAAO,cAAZH,oCAAAA,mBAAAA,MAAee;IACjB;IAEA,qBACE,eAACpB;QACE,GAAGa,MAAM;QACVS,WAAU;QACVC,MAAK;QACLjB,IAAIL,UACF;YACEuB,SAAS;YACTC,QAAQ;QACV,GACAnB;QAEFoB,OAAO;QACPC,KAAKtB,KAAKgB,EAAE;QACZb,SAASW;QACTT,aAAa,CAACU,IAAwBV,wBAAAA,kCAAAA,YAAcU,GAAG;gBAAEC,IAAIhB,KAAKgB,EAAE;gBAAET;YAAM;QAC5ED,YAAY,CAACS,IAAwBT,uBAAAA,iCAAAA,WAAaS,GAAG;gBAAEC,IAAIhB,KAAKgB,EAAE;gBAAET;YAAM;QAC1EgB,UAAUnB;QACVK,KAAKA;;0BAEL,KAAChB;gBAAIQ,IAAI;oBAAEuB,SAAS;oBAAQC,YAAY;gBAAS;0BAC/C,cAAA,KAAC5B;oBAAiB6B,OAAO1B,KAAK0B,KAAK;;;0BAErC,KAAChC;gBACCiC,SAAS3B,KAAK4B,KAAK;gBACnBC,wBAAwB;oBAAEnB,QAAQA;gBAAO;gBACzCL,aAAaO;gBACbN,YAAYO;;;;AAIpB;AAEA,OAAO,MAAMd,+BAAiBT,MAAMwC,IAAI,CAAChC,oBAAoB"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TableProps } from '../Table';
3
2
  import { LegendItem } from './legend-model';
4
3
  export interface TableLegendProps extends Pick<TableProps<LegendItem>, 'sorting' | 'onSortingChange'> {
@@ -11,5 +10,5 @@ export interface TableLegendProps extends Pick<TableProps<LegendItem>, 'sorting'
11
10
  onItemMouseOut?: TableProps<LegendItem>['onRowMouseOut'];
12
11
  columns?: TableProps<LegendItem>['columns'];
13
12
  }
14
- export declare function TableLegend({ items, selectedItems: initRowSelection, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, height, width, columns: additionalColumns, sorting, onSortingChange, }: TableLegendProps): JSX.Element;
13
+ export declare function TableLegend({ items, selectedItems: initRowSelection, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, height, width, columns: additionalColumns, sorting, onSortingChange, }: TableLegendProps): import("react/jsx-runtime").JSX.Element;
15
14
  //# sourceMappingURL=TableLegend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/TableLegend.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAS,UAAU,EAAqB,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACnG,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;IAC9D,qBAAqB,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,sBAAsB,CAAC,CAAC;IACtE,eAAe,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;CAC7C;AAuBD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,aAAa,EAAE,gBAAgB,EAC/B,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,MAAM,EACN,KAAK,EACL,OAAO,EAAE,iBAAsB,EAC/B,OAAO,EACP,eAAe,GAChB,EAAE,gBAAgB,eAoClB"}
1
+ {"version":3,"file":"TableLegend.d.ts","sourceRoot":"","sources":["../../src/Legend/TableLegend.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAS,UAAU,EAAqB,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACnG,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;IAC9D,qBAAqB,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,sBAAsB,CAAC,CAAC;IACtE,eAAe,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;CAC7C;AAuBD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,aAAa,EAAE,gBAAgB,EAC/B,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,MAAM,EACN,KAAK,EACL,OAAO,EAAE,iBAAsB,EAC/B,OAAO,EACP,eAAe,GAChB,EAAE,gBAAgB,2CAuClB"}
@@ -21,7 +21,7 @@ const COLUMNS = [
21
21
  // Starting with `title` attr instead of a tooltip because it is easier to
22
22
  // implement. We should try adding a tooltip in the future, but we'll need
23
23
  // to be very careful about performance when doing so with large tables.
24
- cell: ({ getValue })=>/*#__PURE__*/ _jsx("span", {
24
+ cell: ({ getValue })=>/*#__PURE__*/ _jsx("span", {
25
25
  title: getValue(),
26
26
  children: getValue()
27
27
  })
@@ -33,7 +33,7 @@ const getRowId = (data)=>{
33
33
  const getCheckboxColor = (data)=>{
34
34
  return data.color;
35
35
  };
36
- export function TableLegend({ items , selectedItems: initRowSelection , onSelectedItemsChange , onItemMouseOver , onItemMouseOut , height , width , columns: additionalColumns = [] , sorting , onSortingChange }) {
36
+ export function TableLegend({ items, selectedItems: initRowSelection, onSelectedItemsChange, onItemMouseOver, onItemMouseOut, height, width, columns: additionalColumns = [], sorting, onSortingChange }) {
37
37
  const rowSelection = useMemo(()=>{
38
38
  return typeof initRowSelection !== 'string' ? initRowSelection : // items for checkboxes.
39
39
  // TODO: clean this up if we switch to also using checkboxes in list legend.