@perses-dev/components 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-histogram-types-78c5104

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 (523) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +9 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +42 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/BarChart/BarChart.d.ts +2 -1
  10. package/dist/BarChart/BarChart.d.ts.map +1 -1
  11. package/dist/BarChart/BarChart.js +11 -6
  12. package/dist/BarChart/BarChart.js.map +1 -1
  13. package/dist/ColorPicker/ColorPicker.d.ts +3 -1
  14. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/ColorPicker.js +28 -13
  16. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  17. package/dist/ColorPicker/OptionsColorPicker.d.ts +9 -0
  18. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  19. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +16 -13
  20. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  21. package/dist/ColorPicker/index.d.ts +1 -0
  22. package/dist/ColorPicker/index.d.ts.map +1 -1
  23. package/dist/ColorPicker/index.js +1 -0
  24. package/dist/ColorPicker/index.js.map +1 -1
  25. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
  26. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  27. package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
  28. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  29. package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -3
  30. package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
  31. package/dist/DensitySelector/DensitySelector.d.ts +8 -0
  32. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  33. package/dist/DensitySelector/DensitySelector.js +46 -0
  34. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  35. package/dist/DensitySelector/index.d.ts +2 -0
  36. package/dist/DensitySelector/index.d.ts.map +1 -0
  37. package/dist/DensitySelector/index.js +15 -0
  38. package/dist/DensitySelector/index.js.map +1 -0
  39. package/dist/Dialog/Dialog.d.ts +9 -14
  40. package/dist/Dialog/Dialog.d.ts.map +1 -1
  41. package/dist/Dialog/Dialog.js +7 -3
  42. package/dist/Dialog/Dialog.js.map +1 -1
  43. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  44. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  45. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  46. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  47. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  48. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  49. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  50. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  51. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  52. package/dist/DragAndDrop/DragButton.js +99 -0
  53. package/dist/DragAndDrop/DragButton.js.map +1 -0
  54. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  55. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  56. package/dist/DragAndDrop/DropIndicator.js +44 -0
  57. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  58. package/dist/DragAndDrop/index.d.ts +4 -0
  59. package/dist/DragAndDrop/index.d.ts.map +1 -0
  60. package/dist/DragAndDrop/index.js +17 -0
  61. package/dist/DragAndDrop/index.js.map +1 -0
  62. package/dist/DragAndDrop/model.d.ts +11 -0
  63. package/dist/DragAndDrop/model.d.ts.map +1 -0
  64. package/dist/DragAndDrop/model.js +17 -0
  65. package/dist/DragAndDrop/model.js.map +1 -0
  66. package/dist/Drawer/Drawer.d.ts +2 -1
  67. package/dist/Drawer/Drawer.d.ts.map +1 -1
  68. package/dist/Drawer/Drawer.js +1 -1
  69. package/dist/Drawer/Drawer.js.map +1 -1
  70. package/dist/EChart/EChart.d.ts +3 -2
  71. package/dist/EChart/EChart.d.ts.map +1 -1
  72. package/dist/EChart/EChart.js +26 -9
  73. package/dist/EChart/EChart.js.map +1 -1
  74. package/dist/ErrorAlert.d.ts +2 -1
  75. package/dist/ErrorAlert.d.ts.map +1 -1
  76. package/dist/ErrorAlert.js.map +1 -1
  77. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
  78. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  79. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  80. package/dist/FormEditor/FormActions.d.ts +16 -0
  81. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  82. package/dist/FormEditor/FormActions.js +75 -0
  83. package/dist/FormEditor/FormActions.js.map +1 -0
  84. package/dist/FormEditor/index.d.ts +2 -0
  85. package/dist/FormEditor/index.d.ts.map +1 -0
  86. package/dist/FormEditor/index.js +15 -0
  87. package/dist/FormEditor/index.js.map +1 -0
  88. package/dist/FormatControls/FormatControls.d.ts +2 -1
  89. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  90. package/dist/FormatControls/FormatControls.js +2 -2
  91. package/dist/FormatControls/FormatControls.js.map +1 -1
  92. package/dist/GaugeChart/GaugeChart.d.ts +2 -1
  93. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  94. package/dist/GaugeChart/GaugeChart.js +4 -7
  95. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  96. package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
  97. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  98. package/dist/InfoTooltip/InfoTooltip.js +5 -5
  99. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  100. package/dist/JSONEditor.d.ts +2 -1
  101. package/dist/JSONEditor.d.ts.map +1 -1
  102. package/dist/JSONEditor.js +5 -6
  103. package/dist/JSONEditor.js.map +1 -1
  104. package/dist/Legend/CompactLegend.d.ts +2 -1
  105. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  106. package/dist/Legend/CompactLegend.js.map +1 -1
  107. package/dist/Legend/Legend.d.ts +2 -1
  108. package/dist/Legend/Legend.d.ts.map +1 -1
  109. package/dist/Legend/Legend.js +8 -4
  110. package/dist/Legend/Legend.js.map +1 -1
  111. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  112. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  113. package/dist/Legend/LegendColorBadge.js +2 -2
  114. package/dist/Legend/LegendColorBadge.js.map +1 -1
  115. package/dist/Legend/ListLegend.d.ts +2 -1
  116. package/dist/Legend/ListLegend.d.ts.map +1 -1
  117. package/dist/Legend/ListLegend.js.map +1 -1
  118. package/dist/Legend/ListLegendItem.d.ts +5 -5
  119. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  120. package/dist/Legend/ListLegendItem.js +8 -12
  121. package/dist/Legend/ListLegendItem.js.map +1 -1
  122. package/dist/Legend/TableLegend.d.ts +2 -1
  123. package/dist/Legend/TableLegend.d.ts.map +1 -1
  124. package/dist/Legend/TableLegend.js +1 -0
  125. package/dist/Legend/TableLegend.js.map +1 -1
  126. package/dist/Legend/legend-model.d.ts.map +1 -1
  127. package/dist/Legend/legend-model.js.map +1 -1
  128. package/dist/LineChart/LineChart.d.ts +1 -1
  129. package/dist/LineChart/LineChart.d.ts.map +1 -1
  130. package/dist/LineChart/LineChart.js +6 -11
  131. package/dist/LineChart/LineChart.js.map +1 -1
  132. package/dist/LinksEditor/LinksEditor.d.ts +8 -0
  133. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -0
  134. package/dist/LinksEditor/LinksEditor.js +161 -0
  135. package/dist/LinksEditor/LinksEditor.js.map +1 -0
  136. package/dist/LinksEditor/index.d.ts +2 -0
  137. package/dist/LinksEditor/index.d.ts.map +1 -0
  138. package/dist/LinksEditor/index.js +15 -0
  139. package/dist/LinksEditor/index.js.map +1 -0
  140. package/dist/ModeSelector/ModeSelector.d.ts +2 -1
  141. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  142. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  143. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  144. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  145. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  146. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
  147. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  148. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  149. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  150. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  151. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  152. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  153. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  154. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  155. package/dist/Overlay/Overlay.d.ts +16 -0
  156. package/dist/Overlay/Overlay.d.ts.map +1 -0
  157. package/dist/Overlay/Overlay.js +52 -0
  158. package/dist/Overlay/Overlay.js.map +1 -0
  159. package/dist/Overlay/index.d.ts +2 -0
  160. package/dist/Overlay/index.d.ts.map +1 -0
  161. package/dist/Overlay/index.js +15 -0
  162. package/dist/Overlay/index.js.map +1 -0
  163. package/dist/PieChart/PieChart.d.ts +14 -0
  164. package/dist/PieChart/PieChart.d.ts.map +1 -0
  165. package/dist/PieChart/PieChart.js +92 -0
  166. package/dist/PieChart/PieChart.js.map +1 -0
  167. package/dist/PieChart/index.d.ts +2 -0
  168. package/dist/PieChart/index.d.ts.map +1 -0
  169. package/dist/PieChart/index.js +15 -0
  170. package/dist/PieChart/index.js.map +1 -0
  171. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
  172. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  173. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  174. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  175. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  176. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  177. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  178. package/dist/SortSelector/SortSelector.d.ts +2 -1
  179. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  180. package/dist/SortSelector/SortSelector.js.map +1 -1
  181. package/dist/SortSelector/SortSelectorButtons.d.ts +9 -0
  182. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  183. package/dist/SortSelector/SortSelectorButtons.js +42 -0
  184. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  185. package/dist/SortSelector/index.d.ts +1 -0
  186. package/dist/SortSelector/index.d.ts.map +1 -1
  187. package/dist/SortSelector/index.js +2 -1
  188. package/dist/SortSelector/index.js.map +1 -1
  189. package/dist/StatChart/StatChart.d.ts +6 -5
  190. package/dist/StatChart/StatChart.d.ts.map +1 -1
  191. package/dist/StatChart/StatChart.js +16 -18
  192. package/dist/StatChart/StatChart.js.map +1 -1
  193. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  194. package/dist/StatChart/calculateFontSize.js +2 -4
  195. package/dist/StatChart/calculateFontSize.js.map +1 -1
  196. package/dist/StatChart/utils/formatStatChartValue.d.ts +3 -0
  197. package/dist/StatChart/utils/formatStatChartValue.d.ts.map +1 -0
  198. package/dist/StatChart/utils/formatStatChartValue.js +26 -0
  199. package/dist/StatChart/utils/formatStatChartValue.js.map +1 -0
  200. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +27 -0
  201. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  202. package/dist/StatusHistoryChart/StatusHistoryChart.js +132 -0
  203. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  204. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +13 -0
  205. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  206. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  207. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  208. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  209. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  210. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  211. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  212. package/dist/StatusHistoryChart/index.d.ts +3 -0
  213. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  214. package/dist/StatusHistoryChart/index.js +16 -0
  215. package/dist/StatusHistoryChart/index.js.map +1 -0
  216. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  217. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  218. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  219. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  220. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  221. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  222. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  223. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  224. package/dist/Table/InnerTable.d.ts.map +1 -1
  225. package/dist/Table/InnerTable.js +2 -1
  226. package/dist/Table/InnerTable.js.map +1 -1
  227. package/dist/Table/Table.d.ts +2 -1
  228. package/dist/Table/Table.d.ts.map +1 -1
  229. package/dist/Table/Table.js +23 -10
  230. package/dist/Table/Table.js.map +1 -1
  231. package/dist/Table/TableCell.d.ts +5 -2
  232. package/dist/Table/TableCell.d.ts.map +1 -1
  233. package/dist/Table/TableCell.js +31 -7
  234. package/dist/Table/TableCell.js.map +1 -1
  235. package/dist/Table/TableCheckbox.d.ts +2 -1
  236. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  237. package/dist/Table/TableCheckbox.js.map +1 -1
  238. package/dist/Table/TableFoot.d.ts +4 -0
  239. package/dist/Table/TableFoot.d.ts.map +1 -0
  240. package/dist/Table/TableFoot.js +23 -0
  241. package/dist/Table/TableFoot.js.map +1 -0
  242. package/dist/Table/TableHeaderCell.d.ts +3 -2
  243. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  244. package/dist/Table/TableHeaderCell.js.map +1 -1
  245. package/dist/Table/VirtualizedTable.d.ts +6 -4
  246. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  247. package/dist/Table/VirtualizedTable.js +49 -15
  248. package/dist/Table/VirtualizedTable.js.map +1 -1
  249. package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
  250. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  251. package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
  252. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  253. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  254. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  255. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  256. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  257. package/dist/Table/index.d.ts +1 -2
  258. package/dist/Table/index.d.ts.map +1 -1
  259. package/dist/Table/index.js +1 -1
  260. package/dist/Table/index.js.map +1 -1
  261. package/dist/Table/model/table-model.d.ts +40 -4
  262. package/dist/Table/model/table-model.d.ts.map +1 -1
  263. package/dist/Table/model/table-model.js +31 -23
  264. package/dist/Table/model/table-model.js.map +1 -1
  265. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  266. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  267. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  268. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  269. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
  270. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  271. package/dist/ThresholdsEditor/ThresholdsEditor.js +19 -27
  272. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  273. package/dist/TimeChart/TimeChart.d.ts.map +1 -1
  274. package/dist/TimeChart/TimeChart.js +9 -12
  275. package/dist/TimeChart/TimeChart.js.map +1 -1
  276. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +19 -0
  277. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  278. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +44 -29
  279. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  280. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +36 -0
  281. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  282. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  283. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  284. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  285. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  286. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  287. package/dist/TimeRangeSelector/index.js.map +1 -0
  288. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  289. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  290. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  291. package/dist/TimeRangeSelector/utils.js.map +1 -0
  292. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  293. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  294. package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -14
  295. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  296. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
  297. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  298. package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -2
  299. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  300. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
  301. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  302. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  303. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
  304. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  305. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  306. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  307. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  308. package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -6
  309. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  310. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
  311. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  312. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  313. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  314. package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -14
  315. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  316. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  317. package/dist/TimeSeriesTooltip/nearby-series.js +15 -25
  318. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  319. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +8 -1
  320. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  321. package/dist/TimeSeriesTooltip/tooltip-model.js +13 -2
  322. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  323. package/dist/TimeSeriesTooltip/utils.d.ts +2 -22
  324. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  325. package/dist/TimeSeriesTooltip/utils.js +29 -27
  326. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  327. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  328. package/dist/TransformsEditor/TransformEditor.d.ts +9 -0
  329. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -0
  330. package/dist/TransformsEditor/TransformEditor.js +289 -0
  331. package/dist/TransformsEditor/TransformEditor.js.map +1 -0
  332. package/dist/TransformsEditor/TransformEditorContainer.d.ts +10 -0
  333. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -0
  334. package/dist/TransformsEditor/TransformEditorContainer.js +118 -0
  335. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -0
  336. package/dist/TransformsEditor/TransformsEditor.d.ts +9 -0
  337. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -0
  338. package/dist/TransformsEditor/TransformsEditor.js +90 -0
  339. package/dist/TransformsEditor/TransformsEditor.js.map +1 -0
  340. package/dist/TransformsEditor/index.d.ts +2 -0
  341. package/dist/TransformsEditor/index.d.ts.map +1 -0
  342. package/dist/TransformsEditor/index.js +15 -0
  343. package/dist/TransformsEditor/index.js.map +1 -0
  344. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +10 -0
  345. package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -0
  346. package/dist/ValueMappingEditor/ValueMappingEditor.js +374 -0
  347. package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
  348. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +8 -0
  349. package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -0
  350. package/dist/ValueMappingEditor/ValueMappingsEditor.js +118 -0
  351. package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
  352. package/dist/ValueMappingEditor/index.d.ts +2 -0
  353. package/dist/ValueMappingEditor/index.d.ts.map +1 -0
  354. package/dist/ValueMappingEditor/index.js +15 -0
  355. package/dist/ValueMappingEditor/index.js.map +1 -0
  356. package/dist/YAxisLabel.d.ts +2 -1
  357. package/dist/YAxisLabel.d.ts.map +1 -1
  358. package/dist/YAxisLabel.js +4 -2
  359. package/dist/YAxisLabel.js.map +1 -1
  360. package/dist/cjs/AlignSelector/AlignSelector.js +50 -0
  361. package/dist/cjs/AlignSelector/index.js +30 -0
  362. package/dist/cjs/BarChart/BarChart.js +12 -7
  363. package/dist/cjs/ColorPicker/ColorPicker.js +28 -54
  364. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +18 -15
  365. package/dist/cjs/ColorPicker/index.js +1 -0
  366. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
  367. package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -3
  368. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  369. package/dist/cjs/DensitySelector/index.js +30 -0
  370. package/dist/cjs/Dialog/Dialog.js +7 -3
  371. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  372. package/dist/cjs/DragAndDrop/DragButton.js +123 -0
  373. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  374. package/dist/cjs/DragAndDrop/index.js +32 -0
  375. package/dist/cjs/DragAndDrop/model.js +25 -0
  376. package/dist/cjs/Drawer/Drawer.js +1 -1
  377. package/dist/cjs/EChart/EChart.js +25 -49
  378. package/dist/cjs/FormEditor/FormActions.js +83 -0
  379. package/dist/cjs/FormEditor/index.js +30 -0
  380. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  381. package/dist/cjs/GaugeChart/GaugeChart.js +5 -8
  382. package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -10
  383. package/dist/cjs/JSONEditor.js +4 -5
  384. package/dist/cjs/Legend/Legend.js +8 -4
  385. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  386. package/dist/cjs/Legend/ListLegendItem.js +6 -50
  387. package/dist/cjs/Legend/TableLegend.js +1 -0
  388. package/dist/cjs/LineChart/LineChart.js +8 -13
  389. package/dist/cjs/LinksEditor/LinksEditor.js +174 -0
  390. package/dist/cjs/LinksEditor/index.js +30 -0
  391. package/dist/cjs/Overlay/Overlay.js +71 -0
  392. package/dist/cjs/Overlay/index.js +30 -0
  393. package/dist/cjs/PieChart/PieChart.js +100 -0
  394. package/dist/cjs/PieChart/index.js +30 -0
  395. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +6 -5
  396. package/dist/cjs/SortSelector/SortSelectorButtons.js +50 -0
  397. package/dist/cjs/SortSelector/index.js +2 -1
  398. package/dist/cjs/StatChart/StatChart.js +19 -21
  399. package/dist/cjs/StatChart/calculateFontSize.js +2 -4
  400. package/dist/cjs/StatChart/utils/formatStatChartValue.js +34 -0
  401. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +140 -0
  402. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  403. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  404. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  405. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  406. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  407. package/dist/cjs/Table/InnerTable.js +2 -1
  408. package/dist/cjs/Table/Table.js +21 -8
  409. package/dist/cjs/Table/TableCell.js +31 -7
  410. package/dist/cjs/Table/TableFoot.js +31 -0
  411. package/dist/cjs/Table/VirtualizedTable.js +48 -14
  412. package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
  413. package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
  414. package/dist/cjs/Table/index.js +1 -7
  415. package/dist/cjs/Table/model/table-model.js +37 -23
  416. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
  417. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +27 -35
  418. package/dist/cjs/TimeChart/TimeChart.js +8 -11
  419. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +39 -32
  420. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  421. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  422. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
  423. package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +5 -13
  424. package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -2
  425. package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +1 -5
  426. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -14
  427. package/dist/cjs/TimeSeriesTooltip/nearby-series.js +15 -25
  428. package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +22 -2
  429. package/dist/cjs/TimeSeriesTooltip/utils.js +28 -26
  430. package/dist/cjs/TransformsEditor/TransformEditor.js +297 -0
  431. package/dist/cjs/TransformsEditor/TransformEditorContainer.js +131 -0
  432. package/dist/cjs/TransformsEditor/TransformsEditor.js +103 -0
  433. package/dist/cjs/TransformsEditor/index.js +30 -0
  434. package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +387 -0
  435. package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +131 -0
  436. package/dist/cjs/ValueMappingEditor/index.js +30 -0
  437. package/dist/cjs/YAxisLabel.js +4 -2
  438. package/dist/cjs/context/TimeZoneProvider.js +1 -1
  439. package/dist/cjs/controls/TextField.js +54 -0
  440. package/dist/cjs/controls/index.js +30 -0
  441. package/dist/cjs/index.js +12 -1
  442. package/dist/cjs/model/timeOption.js +19 -1
  443. package/dist/cjs/theme/index.js +1 -0
  444. package/dist/cjs/theme/palette/background.js +2 -0
  445. package/dist/cjs/theme/theme.js +6 -6
  446. package/dist/cjs/utils/chart-actions.js +2 -3
  447. package/dist/cjs/utils/format.js +19 -1
  448. package/dist/cjs/utils/theme-gen.js +5 -7
  449. package/dist/context/ChartsProvider.d.ts +2 -2
  450. package/dist/context/ChartsProvider.d.ts.map +1 -1
  451. package/dist/context/ChartsProvider.js.map +1 -1
  452. package/dist/context/SnackbarProvider.js.map +1 -1
  453. package/dist/context/TimeZoneProvider.d.ts +4 -4
  454. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  455. package/dist/context/TimeZoneProvider.js +1 -1
  456. package/dist/context/TimeZoneProvider.js.map +1 -1
  457. package/dist/controls/TextField.d.ts +9 -0
  458. package/dist/controls/TextField.d.ts.map +1 -0
  459. package/dist/controls/TextField.js +41 -0
  460. package/dist/controls/TextField.js.map +1 -0
  461. package/dist/controls/index.d.ts +2 -0
  462. package/dist/controls/index.d.ts.map +1 -0
  463. package/dist/controls/index.js +15 -0
  464. package/dist/controls/index.js.map +1 -0
  465. package/dist/index.d.ts +12 -1
  466. package/dist/index.d.ts.map +1 -1
  467. package/dist/index.js +12 -1
  468. package/dist/index.js.map +1 -1
  469. package/dist/model/timeOption.d.ts +2 -1
  470. package/dist/model/timeOption.d.ts.map +1 -1
  471. package/dist/model/timeOption.js +13 -2
  472. package/dist/model/timeOption.js.map +1 -1
  473. package/dist/test/render.d.ts +3 -3
  474. package/dist/test/render.d.ts.map +1 -1
  475. package/dist/test/render.js.map +1 -1
  476. package/dist/theme/component-overrides/alert.js.map +1 -1
  477. package/dist/theme/index.d.ts +2 -0
  478. package/dist/theme/index.d.ts.map +1 -1
  479. package/dist/theme/index.js +1 -0
  480. package/dist/theme/index.js.map +1 -1
  481. package/dist/theme/palette/background.d.ts.map +1 -1
  482. package/dist/theme/palette/background.js +2 -0
  483. package/dist/theme/palette/background.js.map +1 -1
  484. package/dist/theme/theme.d.ts +2 -2
  485. package/dist/theme/theme.d.ts.map +1 -1
  486. package/dist/theme/theme.js +5 -5
  487. package/dist/theme/theme.js.map +1 -1
  488. package/dist/utils/axis.d.ts +1 -7
  489. package/dist/utils/axis.d.ts.map +1 -1
  490. package/dist/utils/axis.js.map +1 -1
  491. package/dist/utils/chart-actions.d.ts.map +1 -1
  492. package/dist/utils/chart-actions.js +2 -3
  493. package/dist/utils/chart-actions.js.map +1 -1
  494. package/dist/utils/component-ids.d.ts.map +1 -1
  495. package/dist/utils/component-ids.js.map +1 -1
  496. package/dist/utils/format.d.ts +10 -4
  497. package/dist/utils/format.d.ts.map +1 -1
  498. package/dist/utils/format.js +16 -1
  499. package/dist/utils/format.js.map +1 -1
  500. package/dist/utils/theme-gen.js +5 -7
  501. package/dist/utils/theme-gen.js.map +1 -1
  502. package/package.json +14 -13
  503. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
  504. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  505. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  506. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
  507. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  508. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  509. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  510. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
  511. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  512. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  513. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  514. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  515. package/dist/DateTimeRangePicker/index.js.map +0 -1
  516. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  517. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  518. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  519. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
  520. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  521. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  522. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  523. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ContentWithLegend/model/content-with-legend-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport { LegendPositions, getLegendMode, LegendSize } from '@perses-dev/core';\nimport { LegendProps } from '../../Legend';\nimport { getTableCellLayout } from '../../Table';\n\ntype Dimensions = {\n width: number;\n height: number;\n};\n\nexport interface ContentWithLegendProps {\n /**\n * Width of the overall component layout in pixels.\n */\n width: number;\n /**\n * Height of overall component layout in pixels.\n */\n height: number;\n /**\n * Child content to render next to the legend. May be a react node or a\n * function that returns a react node. The function provides the expected\n * height and width for the content, which can be useful for passing down\n * to chart components.\n */\n children: React.ReactNode | (({ width, height }: Dimensions) => React.ReactNode);\n\n /**\n * Size used for the legend.\n *\n * @default 'medium'\n */\n legendSize?: LegendSize;\n\n /**\n * Props to configure the legend. If not set, the content is rendered without\n * a legend.\n */\n legendProps?: Omit<LegendProps, 'width' | 'height'>;\n\n /**\n * Space to put between the children and the legend in pixels.\n */\n spacing?: number;\n\n /**\n * Minimum width required for the content specified by the `children` prop.\n * If this width cannot be maintained with a right positioned legend, the\n * legend will not be shown.\n */\n minChildrenWidth?: number;\n\n /**\n * Minimum height required for the content specified by the `children` prop.\n * If this width cannot be maintained with a bottom positioned legend, the\n * legend will not be shown.\n */\n minChildrenHeight?: number;\n}\n\nexport interface ContentWithLegendLayoutOpts\n extends Required<Omit<ContentWithLegendProps, 'children' | 'legendProps'>> {\n legendProps?: ContentWithLegendProps['legendProps'];\n theme: Theme;\n}\n\nexport interface ContentWithLegendLayout {\n legend: Dimensions & {\n show: boolean;\n };\n content: Dimensions;\n margin: {\n right: number;\n bottom: number;\n };\n}\n\ntype LegendSizeConfig = Record<LegendSize, Record<LegendPositions, number>>;\n\nexport const TABLE_LEGEND_SIZE: LegendSizeConfig = {\n medium: {\n // 5 rows plus header. Value to be multiplied by row height in pixels.\n bottom: 6,\n\n // Pixel value\n right: 250,\n },\n small: {\n // 3 rows plus header. Value to be multiplied by row height in pixels.\n bottom: 4,\n\n // Pixel value\n right: 150,\n },\n};\n\nconst PANEL_HEIGHT_LG_BREAKPOINT = 300;\nconst LEGEND_HEIGHT_SM = 40;\nconst LEGEND_HEIGHT_LG = 100;\n\n/**\n * Returns information for laying out content alongside a legend.\n */\nexport function getContentWithLegendLayout({\n width,\n height,\n legendProps,\n legendSize,\n minChildrenHeight,\n minChildrenWidth,\n spacing,\n theme,\n}: ContentWithLegendLayoutOpts): ContentWithLegendLayout {\n const legendOptions = legendProps?.options;\n const hasLegend = !!legendOptions;\n\n const noLegendLayout: ContentWithLegendLayout = {\n legend: {\n show: false,\n width: 0,\n height: 0,\n },\n content: {\n width,\n height,\n },\n margin: {\n right: 0,\n bottom: 0,\n },\n };\n\n if (!hasLegend) {\n return noLegendLayout;\n }\n\n const { position } = legendOptions;\n const mode = getLegendMode(legendOptions.mode);\n\n let legendWidth;\n let legendHeight;\n\n if (mode === 'list') {\n // TODO: normalize list to share similar height options as the table\n // when we add more size options.\n legendWidth = position === 'right' ? 200 : width;\n\n // TODO: account for number of legend items returned when adjusting legend spacing\n legendHeight = LEGEND_HEIGHT_SM;\n if (position === 'right') {\n legendHeight = height;\n } else if (height >= PANEL_HEIGHT_LG_BREAKPOINT) {\n legendHeight = LEGEND_HEIGHT_LG;\n }\n } else {\n // Table mode\n\n const tableLayout = getTableCellLayout(theme, 'compact');\n\n const tableColumns = legendProps?.tableProps?.columns || [];\n const columnsWidth = tableColumns.reduce((total, col) => {\n if (typeof col.width === 'number') {\n total += col.width;\n }\n return total;\n }, 0);\n\n legendWidth = position === 'right' ? TABLE_LEGEND_SIZE[legendSize]['right'] + columnsWidth : width;\n\n // Use the smaller of the size-based row count or the number of legend items + 1 for the header.\n const rowsToShow = Math.min(TABLE_LEGEND_SIZE[legendSize]['bottom'], legendProps.data.length + 1);\n legendHeight = position === 'bottom' ? rowsToShow * tableLayout.height : height;\n }\n\n const contentWidth = position === 'right' ? width - legendWidth - spacing : width;\n const contentHeight = position === 'bottom' ? height - legendHeight - spacing : height;\n\n if (\n (position === 'right' && contentWidth < minChildrenWidth) ||\n (position === 'bottom' && contentHeight < minChildrenHeight)\n ) {\n // Legend does not fit. Just show the content.\n return noLegendLayout;\n }\n\n return {\n legend: {\n width: legendWidth,\n height: legendHeight,\n show: true,\n },\n content: {\n width: contentWidth,\n height: contentHeight,\n },\n margin: {\n right: position === 'right' ? spacing : 0,\n bottom: position === 'bottom' ? spacing : 0,\n },\n };\n}\n"],"names":["getLegendMode","getTableCellLayout","TABLE_LEGEND_SIZE","medium","bottom","right","small","PANEL_HEIGHT_LG_BREAKPOINT","LEGEND_HEIGHT_SM","LEGEND_HEIGHT_LG","getContentWithLegendLayout","width","height","legendProps","legendSize","minChildrenHeight","minChildrenWidth","spacing","theme","legendOptions","options","hasLegend","noLegendLayout","legend","show","content","margin","position","mode","legendWidth","legendHeight","tableLayout","tableColumns","tableProps","columns","columnsWidth","reduce","total","col","rowsToShow","Math","min","data","length","contentWidth","contentHeight"],"mappings":"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"}
1
+ {"version":3,"sources":["../../../src/ContentWithLegend/model/content-with-legend-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Theme } from '@mui/material';\nimport { LegendPositions, getLegendMode, LegendSize } from '@perses-dev/core';\nimport { LegendProps } from '../../Legend';\nimport { getTableCellLayout } from '../../Table';\n\ntype Dimensions = {\n width: number;\n height: number;\n};\n\nexport interface ContentWithLegendProps {\n /**\n * Width of the overall component layout in pixels.\n */\n width: number;\n /**\n * Height of overall component layout in pixels.\n */\n height: number;\n /**\n * Child content to render next to the legend. May be a react node or a\n * function that returns a react node. The function provides the expected\n * height and width for the content, which can be useful for passing down\n * to chart components.\n */\n children: React.ReactNode | (({ width, height }: Dimensions) => React.ReactNode);\n\n /**\n * Size used for the legend.\n *\n * @default 'medium'\n */\n legendSize?: LegendSize;\n\n /**\n * Props to configure the legend. If not set, the content is rendered without\n * a legend.\n */\n legendProps?: Omit<LegendProps, 'width' | 'height'>;\n\n /**\n * Space to put between the children and the legend in pixels.\n */\n spacing?: number;\n\n /**\n * Minimum width required for the content specified by the `children` prop.\n * If this width cannot be maintained with a right positioned legend, the\n * legend will not be shown.\n */\n minChildrenWidth?: number;\n\n /**\n * Minimum height required for the content specified by the `children` prop.\n * If this width cannot be maintained with a bottom positioned legend, the\n * legend will not be shown.\n */\n minChildrenHeight?: number;\n}\n\nexport interface ContentWithLegendLayoutOpts\n extends Required<Omit<ContentWithLegendProps, 'children' | 'legendProps'>> {\n legendProps?: ContentWithLegendProps['legendProps'];\n theme: Theme;\n}\n\nexport interface ContentWithLegendLayout {\n legend: Dimensions & {\n show: boolean;\n };\n content: Dimensions;\n margin: {\n right: number;\n bottom: number;\n };\n}\n\ntype LegendSizeConfig = Record<LegendSize, Record<LegendPositions, number>>;\n\nexport const TABLE_LEGEND_SIZE: LegendSizeConfig = {\n medium: {\n // 5 rows plus header. Value to be multiplied by row height in pixels.\n bottom: 6,\n\n // Pixel value\n right: 250,\n },\n small: {\n // 3 rows plus header. Value to be multiplied by row height in pixels.\n bottom: 4,\n\n // Pixel value\n right: 150,\n },\n};\n\nconst PANEL_HEIGHT_LG_BREAKPOINT = 300;\nconst LEGEND_HEIGHT_SM = 40;\nconst LEGEND_HEIGHT_LG = 100;\n\n/**\n * Returns information for laying out content alongside a legend.\n */\nexport function getContentWithLegendLayout({\n width,\n height,\n legendProps,\n legendSize,\n minChildrenHeight,\n minChildrenWidth,\n spacing,\n theme,\n}: ContentWithLegendLayoutOpts): ContentWithLegendLayout {\n const legendOptions = legendProps?.options;\n const hasLegend = !!legendOptions;\n\n const noLegendLayout: ContentWithLegendLayout = {\n legend: {\n show: false,\n width: 0,\n height: 0,\n },\n content: {\n width,\n height,\n },\n margin: {\n right: 0,\n bottom: 0,\n },\n };\n\n if (!hasLegend) {\n return noLegendLayout;\n }\n\n const { position } = legendOptions;\n const mode = getLegendMode(legendOptions.mode);\n\n let legendWidth;\n let legendHeight;\n\n if (mode === 'list') {\n // TODO: normalize list to share similar height options as the table\n // when we add more size options.\n legendWidth = position === 'right' ? 200 : width;\n\n // TODO: account for number of legend items returned when adjusting legend spacing\n legendHeight = LEGEND_HEIGHT_SM;\n if (position === 'right') {\n legendHeight = height;\n } else if (height >= PANEL_HEIGHT_LG_BREAKPOINT) {\n legendHeight = LEGEND_HEIGHT_LG;\n }\n } else {\n // Table mode\n\n const tableLayout = getTableCellLayout(theme, 'compact');\n\n const tableColumns = legendProps?.tableProps?.columns || [];\n const columnsWidth = tableColumns.reduce((total, col) => {\n if (typeof col.width === 'number') {\n total += col.width;\n }\n return total;\n }, 0);\n\n legendWidth = position === 'right' ? TABLE_LEGEND_SIZE[legendSize]['right'] + columnsWidth : width;\n\n // Use the smaller of the size-based row count or the number of legend items + 1 for the header.\n const rowsToShow = Math.min(TABLE_LEGEND_SIZE[legendSize]['bottom'], legendProps.data.length + 1);\n legendHeight = position === 'bottom' ? rowsToShow * tableLayout.height : height;\n }\n\n const contentWidth = position === 'right' ? width - legendWidth - spacing : width;\n const contentHeight = position === 'bottom' ? height - legendHeight - spacing : height;\n\n if (\n (position === 'right' && contentWidth < minChildrenWidth) ||\n (position === 'bottom' && contentHeight < minChildrenHeight)\n ) {\n // Legend does not fit. Just show the content.\n return noLegendLayout;\n }\n\n return {\n legend: {\n width: legendWidth,\n height: legendHeight,\n show: true,\n },\n content: {\n width: contentWidth,\n height: contentHeight,\n },\n margin: {\n right: position === 'right' ? spacing : 0,\n bottom: position === 'bottom' ? spacing : 0,\n },\n };\n}\n"],"names":["getLegendMode","getTableCellLayout","TABLE_LEGEND_SIZE","medium","bottom","right","small","PANEL_HEIGHT_LG_BREAKPOINT","LEGEND_HEIGHT_SM","LEGEND_HEIGHT_LG","getContentWithLegendLayout","width","height","legendProps","legendSize","minChildrenHeight","minChildrenWidth","spacing","theme","legendOptions","options","hasLegend","noLegendLayout","legend","show","content","margin","position","mode","legendWidth","legendHeight","tableLayout","tableColumns","tableProps","columns","columnsWidth","reduce","total","col","rowsToShow","Math","min","data","length","contentWidth","contentHeight"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAA0BA,aAAa,QAAoB,mBAAmB;AAE9E,SAASC,kBAAkB,QAAQ,cAAc;AA4EjD,OAAO,MAAMC,oBAAsC;IACjDC,QAAQ;QACN,sEAAsE;QACtEC,QAAQ;QAER,cAAc;QACdC,OAAO;IACT;IACAC,OAAO;QACL,sEAAsE;QACtEF,QAAQ;QAER,cAAc;QACdC,OAAO;IACT;AACF,EAAE;AAEF,MAAME,6BAA6B;AACnC,MAAMC,mBAAmB;AACzB,MAAMC,mBAAmB;AAEzB;;CAEC,GACD,OAAO,SAASC,2BAA2B,EACzCC,KAAK,EACLC,MAAM,EACNC,WAAW,EACXC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,OAAO,EACPC,KAAK,EACuB;IAC5B,MAAMC,gBAAgBN,aAAaO;IACnC,MAAMC,YAAY,CAAC,CAACF;IAEpB,MAAMG,iBAA0C;QAC9CC,QAAQ;YACNC,MAAM;YACNb,OAAO;YACPC,QAAQ;QACV;QACAa,SAAS;YACPd;YACAC;QACF;QACAc,QAAQ;YACNrB,OAAO;YACPD,QAAQ;QACV;IACF;IAEA,IAAI,CAACiB,WAAW;QACd,OAAOC;IACT;IAEA,MAAM,EAAEK,QAAQ,EAAE,GAAGR;IACrB,MAAMS,OAAO5B,cAAcmB,cAAcS,IAAI;IAE7C,IAAIC;IACJ,IAAIC;IAEJ,IAAIF,SAAS,QAAQ;QACnB,oEAAoE;QACpE,iCAAiC;QACjCC,cAAcF,aAAa,UAAU,MAAMhB;QAE3C,kFAAkF;QAClFmB,eAAetB;QACf,IAAImB,aAAa,SAAS;YACxBG,eAAelB;QACjB,OAAO,IAAIA,UAAUL,4BAA4B;YAC/CuB,eAAerB;QACjB;IACF,OAAO;QACL,aAAa;QAEb,MAAMsB,cAAc9B,mBAAmBiB,OAAO;QAE9C,MAAMc,eAAenB,aAAaoB,YAAYC,WAAW,EAAE;QAC3D,MAAMC,eAAeH,aAAaI,MAAM,CAAC,CAACC,OAAOC;YAC/C,IAAI,OAAOA,IAAI3B,KAAK,KAAK,UAAU;gBACjC0B,SAASC,IAAI3B,KAAK;YACpB;YACA,OAAO0B;QACT,GAAG;QAEHR,cAAcF,aAAa,UAAUzB,iBAAiB,CAACY,WAAW,CAAC,QAAQ,GAAGqB,eAAexB;QAE7F,gGAAgG;QAChG,MAAM4B,aAAaC,KAAKC,GAAG,CAACvC,iBAAiB,CAACY,WAAW,CAAC,SAAS,EAAED,YAAY6B,IAAI,CAACC,MAAM,GAAG;QAC/Fb,eAAeH,aAAa,WAAWY,aAAaR,YAAYnB,MAAM,GAAGA;IAC3E;IAEA,MAAMgC,eAAejB,aAAa,UAAUhB,QAAQkB,cAAcZ,UAAUN;IAC5E,MAAMkC,gBAAgBlB,aAAa,WAAWf,SAASkB,eAAeb,UAAUL;IAEhF,IACE,AAACe,aAAa,WAAWiB,eAAe5B,oBACvCW,aAAa,YAAYkB,gBAAgB9B,mBAC1C;QACA,8CAA8C;QAC9C,OAAOO;IACT;IAEA,OAAO;QACLC,QAAQ;YACNZ,OAAOkB;YACPjB,QAAQkB;YACRN,MAAM;QACR;QACAC,SAAS;YACPd,OAAOiC;YACPhC,QAAQiC;QACV;QACAnB,QAAQ;YACNrB,OAAOsB,aAAa,UAAUV,UAAU;YACxCb,QAAQuB,aAAa,WAAWV,UAAU;QAC5C;IACF;AACF"}
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from 'react';
2
+ export type DensityOption = 'compact' | 'standard' | 'comfortable';
3
+ export interface DensitySelectorProps {
4
+ onChange: (density: DensityOption) => void;
5
+ value?: DensityOption;
6
+ }
7
+ export declare function DensitySelector({ onChange, value }: DensitySelectorProps): ReactElement;
8
+ //# sourceMappingURL=DensitySelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DensitySelector.d.ts","sourceRoot":"","sources":["../../src/DensitySelector/DensitySelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAUrC,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAkB,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAmBpG"}
@@ -0,0 +1,46 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License | Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing | software
9
+ // distributed under the License is distributed on an "AS IS" BASIS |
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { OptionsEditorControl } from '../OptionsEditorLayout';
15
+ import { SettingsAutocomplete } from '../SettingsAutocomplete';
16
+ const DENSITY_OPTIONS = [
17
+ {
18
+ id: 'compact',
19
+ label: 'Compact'
20
+ },
21
+ {
22
+ id: 'standard',
23
+ label: 'Standard'
24
+ },
25
+ {
26
+ id: 'comfortable',
27
+ label: 'Comfortable'
28
+ }
29
+ ];
30
+ export function DensitySelector({ onChange, value = 'standard' }) {
31
+ const handleSortChange = (_, { id })=>{
32
+ onChange(id);
33
+ };
34
+ return /*#__PURE__*/ _jsx(OptionsEditorControl, {
35
+ label: "Density",
36
+ control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
37
+ value: DENSITY_OPTIONS.find((o)=>o.id === value),
38
+ options: DENSITY_OPTIONS,
39
+ getOptionLabel: (o)=>o.label,
40
+ onChange: handleSortChange,
41
+ disableClearable: true
42
+ })
43
+ });
44
+ }
45
+
46
+ //# sourceMappingURL=DensitySelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DensitySelector/DensitySelector.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst DENSITY_OPTIONS: Array<{ id: DensityOption; label: string }> = [\n { id: 'compact', label: 'Compact' },\n { id: 'standard', label: 'Standard' },\n { id: 'comfortable', label: 'Comfortable' },\n];\n\nexport type DensityOption = 'compact' | 'standard' | 'comfortable';\n\nexport interface DensitySelectorProps {\n onChange: (density: DensityOption) => void;\n value?: DensityOption;\n}\n\nexport function DensitySelector({ onChange, value = 'standard' }: DensitySelectorProps): ReactElement {\n const handleSortChange = (_: unknown, { id }: { id: DensityOption }): void => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Density\"\n control={\n <SettingsAutocomplete\n value={DENSITY_OPTIONS.find((o) => o.id === value)}\n options={DENSITY_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleSortChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","DENSITY_OPTIONS","id","label","DensitySelector","onChange","value","handleSortChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,MAAMC,kBAA+D;IACnE;QAAEC,IAAI;QAAWC,OAAO;IAAU;IAClC;QAAED,IAAI;QAAYC,OAAO;IAAW;IACpC;QAAED,IAAI;QAAeC,OAAO;IAAc;CAC3C;AASD,OAAO,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,QAAQ,UAAU,EAAwB;IACpF,MAAMC,mBAAmB,CAACC,GAAY,EAAEN,EAAE,EAAyB;QACjEG,SAASH;IACX;IAEA,qBACE,KAACH;QACCI,OAAM;QACNM,uBACE,KAACT;YACCM,OAAOL,gBAAgBS,IAAI,CAAC,CAACC,IAAMA,EAAET,EAAE,KAAKI;YAC5CM,SAASX;YACTY,gBAAgB,CAACF,IAAMA,EAAER,KAAK;YAC9BE,UAAUE;YACVO,gBAAgB;;;AAK1B"}
@@ -0,0 +1,2 @@
1
+ export * from './DensitySelector';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DensitySelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './DensitySelector';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DensitySelector/index.ts"],"sourcesContent":["// Copyright 2024 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 './DensitySelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,oBAAoB"}
@@ -1,25 +1,20 @@
1
- import React from 'react';
1
+ import { ReactElement, MouseEvent } from 'react';
2
2
  import { ButtonProps, DialogActions, DialogContentProps as MuiDialogContentProps, DialogProps, DialogTitleProps, Theme } from '@mui/material';
3
3
  export interface DialogHeaderProps extends DialogTitleProps {
4
4
  /**
5
5
  * Callback fired when close button is clicked. If undefined, close button will not appear in header.
6
6
  */
7
- onClose?: (e: React.MouseEvent<HTMLElement>) => void;
7
+ onClose?: (e: MouseEvent<HTMLElement>) => void;
8
8
  }
9
9
  export type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;
10
- export interface DialogContentProps extends MuiDialogContentProps {
11
- /**
12
- * @default 500
13
- */
14
- width?: number;
15
- }
10
+ export type DialogContentProps = MuiDialogContentProps;
16
11
  export declare const Dialog: {
17
- ({ children, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
18
- Header: ({ children, onClose, ...props }: DialogHeaderProps) => import("react/jsx-runtime").JSX.Element;
19
- Form: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
20
- Content: ({ children, width, sx, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
21
- PrimaryButton: ({ children, ...props }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element;
22
- SecondaryButton: ({ children, ...props }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ ({ children, ...props }: DialogProps): ReactElement;
13
+ Header: ({ children, onClose, ...props }: DialogHeaderProps) => ReactElement;
14
+ Form: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
15
+ Content: ({ children, sx, ...props }: DialogContentProps) => ReactElement;
16
+ PrimaryButton: ({ children, ...props }: DialogButtonProps) => ReactElement;
17
+ SecondaryButton: ({ children, ...props }: DialogButtonProps) => ReactElement;
23
18
  Actions: typeof DialogActions;
24
19
  };
25
20
  //# sourceMappingURL=Dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,WAAW,EAEX,aAAa,EAEb,kBAAkB,IAAI,qBAAqB,EAC3C,WAAW,EAEX,gBAAgB,EAGhB,KAAK,EACN,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACtD;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAEhF,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqDD,eAAO,MAAM,MAAM;6BAA4B,WAAW;8CAnDT,iBAAiB;;iDAaR,kBAAkB;4CAM7B,iBAAiB;8CAMf,iBAAiB;;CA0ByC,CAAC"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAEL,WAAW,EAEX,aAAa,EAEb,kBAAkB,IAAI,qBAAqB,EAC3C,WAAW,EAEX,gBAAgB,EAGhB,KAAK,EACN,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAEhF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAuDvD,eAAO,MAAM,MAAM;6BAA4B,WAAW,GAAG,YAAY;8CArDxB,iBAAiB,KAAG,YAAY;;0CAepC,kBAAkB,KAAG,YAAY;4CAM/B,iBAAiB,KAAG,YAAY;8CAM9B,iBAAiB,KAAG,YAAY;;CA4BhF,CAAC"}
@@ -11,7 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- import React from 'react';
15
14
  import { Button, Dialog as MuiDialog, DialogActions, DialogContent, DialogTitle, IconButton, styled } from '@mui/material';
16
15
  import CloseIcon from 'mdi-material-ui/Close';
17
16
  import { combineSx } from '../utils';
@@ -19,6 +18,10 @@ const Header = ({ children, onClose, ...props })=>{
19
18
  return /*#__PURE__*/ _jsxs(_Fragment, {
20
19
  children: [
21
20
  /*#__PURE__*/ _jsx(DialogTitle, {
21
+ style: {
22
+ textOverflow: 'ellipsis',
23
+ overflow: 'hidden'
24
+ },
22
25
  ...props,
23
26
  children: children
24
27
  }),
@@ -31,11 +34,12 @@ const Header = ({ children, onClose, ...props })=>{
31
34
  ]
32
35
  });
33
36
  };
34
- const Content = ({ children, width = 500, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
37
+ const Content = ({ children, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
35
38
  dividers: true,
36
39
  ...props,
37
40
  sx: combineSx({
38
- width: `${width}px`
41
+ minWidth: `500px`,
42
+ textWrap: 'balance'
39
43
  }, sx),
40
44
  children: children
41
45
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/Dialog.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 Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"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,SACEC,MAAM,EAENC,UAAUC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,SAAS,QAAQ,WAAW;AAkBrC,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGC,OAA0B;IAChE,qBACE;;0BACE,KAACR;gBAAa,GAAGQ,KAAK;0BAAGF;;YACxBC,yBACC,KAACN;gBAAWQ,cAAW;gBAAQC,SAASH;gBAASI,IAAIC;0BACnD,cAAA,KAACT;;;;AAKX;AAEA,MAAMU,UAAU,CAAC,EAAEP,QAAQ,EAAEQ,QAAQ,GAAG,EAAEH,EAAE,EAAE,GAAGH,OAA2B,iBAC1E,KAACT;QAAcgB,QAAQ;QAAE,GAAGP,KAAK;QAAEG,IAAIP,UAAU;YAAEU,OAAO,CAAC,EAAEA,MAAM,EAAE,CAAC;QAAC,GAAGH;kBACvEL;;AAIL,MAAMU,gBAAgB,CAAC,EAAEV,QAAQ,EAAE,GAAGE,OAA0B,iBAC9D,KAACb;QAAOsB,SAAQ;QAAYC,MAAK;QAAU,GAAGV,KAAK;kBAChDF;;AAIL,MAAMa,kBAAkB,CAAC,EAAEb,QAAQ,EAAE,GAAGE,OAA0B,iBAChE,KAACb;QAAOsB,SAAQ;QAAWG,OAAM;QAAa,GAAGZ,KAAK;kBACnDF;;AAIL;;;;;CAKC,GACD,MAAMe,OAAOnB,OAAO,QAAQ;IAC1BoB,WAAW;IACXC,SAAS;IACTC,eAAe;AACjB;AAEA;;;CAGC,GACD,MAAMZ,6BAA6B,CAACa;IAClC,OAAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,OAAO,CAAC;QAAMC,OAAOJ,MAAMG,OAAO,CAAC;IAAK;AACpF;AAEA,OAAO,MAAMhC,SAAS,CAAC,EAAEU,QAAQ,EAAE,GAAGE,OAAoB,iBAAK,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OAAsB;AAE5GV,OAAOS,MAAM,GAAGA;AAChBT,OAAOyB,IAAI,GAAGA;AACdzB,OAAOiB,OAAO,GAAGA;AACjBjB,OAAOoB,aAAa,GAAGA;AACvBpB,OAAOuB,eAAe,GAAGA;AACzBvB,OAAOkC,OAAO,GAAGhC"}
1
+ {"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, MouseEvent } from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport type DialogContentProps = MuiDialogContentProps;\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps): ReactElement => {\n return (\n <>\n <DialogTitle style={{ textOverflow: 'ellipsis', overflow: 'hidden' }} {...props}>\n {children}\n </DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, sx, ...props }: DialogContentProps): ReactElement => (\n <DialogContent dividers {...props} sx={combineSx({ minWidth: `500px`, textWrap: 'balance' }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps): ReactElement => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme): Record<string, unknown> => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps): ReactElement => (\n <MuiDialog {...props}>{children}</MuiDialog>\n);\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","style","textOverflow","overflow","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","dividers","minWidth","textWrap","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SACEA,MAAM,EAENC,UAAUC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,SAAS,QAAQ,WAAW;AAarC,MAAMC,SAAS,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGC,OAA0B;IAChE,qBACE;;0BACE,KAACR;gBAAYS,OAAO;oBAAEC,cAAc;oBAAYC,UAAU;gBAAS;gBAAI,GAAGH,KAAK;0BAC5EF;;YAEFC,yBACC,KAACN;gBAAWW,cAAW;gBAAQC,SAASN;gBAASO,IAAIC;0BACnD,cAAA,KAACZ;;;;AAKX;AAEA,MAAMa,UAAU,CAAC,EAAEV,QAAQ,EAAEQ,EAAE,EAAE,GAAGN,OAA2B,iBAC7D,KAACT;QAAckB,QAAQ;QAAE,GAAGT,KAAK;QAAEM,IAAIV,UAAU;YAAEc,UAAU,CAAC,KAAK,CAAC;YAAEC,UAAU;QAAU,GAAGL;kBAC1FR;;AAIL,MAAMc,gBAAgB,CAAC,EAAEd,QAAQ,EAAE,GAAGE,OAA0B,iBAC9D,KAACb;QAAO0B,SAAQ;QAAYC,MAAK;QAAU,GAAGd,KAAK;kBAChDF;;AAIL,MAAMiB,kBAAkB,CAAC,EAAEjB,QAAQ,EAAE,GAAGE,OAA0B,iBAChE,KAACb;QAAO0B,SAAQ;QAAWG,OAAM;QAAa,GAAGhB,KAAK;kBACnDF;;AAIL;;;;;CAKC,GACD,MAAMmB,OAAOvB,OAAO,QAAQ;IAC1BwB,WAAW;IACXC,SAAS;IACTC,eAAe;AACjB;AAEA;;;CAGC,GACD,MAAMb,6BAA6B,CAACc;IAClC,OAAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,OAAO,CAAC;QAAMC,OAAOJ,MAAMG,OAAO,CAAC;IAAK;AACpF;AAEA,OAAO,MAAMpC,SAAS,CAAC,EAAEU,QAAQ,EAAE,GAAGE,OAAoB,iBACxD,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OACvB;AAEFV,OAAOS,MAAM,GAAGA;AAChBT,OAAO6B,IAAI,GAAGA;AACd7B,OAAOoB,OAAO,GAAGA;AACjBpB,OAAOwB,aAAa,GAAGA;AACvBxB,OAAO2B,eAAe,GAAGA;AACzB3B,OAAOsC,OAAO,GAAGpC"}
@@ -1,9 +1,10 @@
1
+ import { ReactElement } from 'react';
1
2
  interface DiscardChangesConfirmationDialogProps {
2
3
  description: string;
3
4
  isOpen: boolean;
4
5
  onCancel: () => void;
5
6
  onDiscardChanges: () => void;
6
7
  }
7
- export declare const DiscardChangesConfirmationDialog: (props: DiscardChangesConfirmationDialogProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const DiscardChangesConfirmationDialog: (props: DiscardChangesConfirmationDialogProps) => ReactElement;
8
9
  export {};
9
10
  //# sourceMappingURL=DiscardChangesConfirmationDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiscardChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAgBA,UAAU,qCAAqC;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,gCAAgC,UAAW,qCAAqC,4CAiB5F,CAAC"}
1
+ {"version":3,"file":"DiscardChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,UAAU,qCAAqC;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,gCAAgC,UAAW,qCAAqC,KAAG,YAiB/F,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.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 { Button } from '@mui/material';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps) => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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,MAAM,QAAQ,gBAAgB;AACvC,SAASC,MAAM,QAAQ,WAAW;AASlC,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGJ;IAE5D,qBACE,MAACF;QAAOO,MAAMH;QAAQI,mBAAgB;;0BACpC,KAACR,OAAOS,MAAM;0BAAC;;0BACf,KAACT,OAAOU,OAAO;0BAAEP;;0BACjB,MAACH,OAAOW,OAAO;;kCACb,KAACZ;wBAAOa,SAAQ;wBAAYC,SAASP;kCAAkB;;kCAGvD,KAACP;wBAAOa,SAAQ;wBAAWE,OAAM;wBAAYD,SAASR;kCAAU;;;;;;AAMxE,EAAE"}
1
+ {"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.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 { Button } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps): ReactElement => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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,MAAM,QAAQ,gBAAgB;AAEvC,SAASC,MAAM,QAAQ,WAAW;AASlC,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGJ;IAE5D,qBACE,MAACF;QAAOO,MAAMH;QAAQI,mBAAgB;;0BACpC,KAACR,OAAOS,MAAM;0BAAC;;0BACf,KAACT,OAAOU,OAAO;0BAAEP;;0BACjB,MAACH,OAAOW,OAAO;;kCACb,KAACZ;wBAAOa,SAAQ;wBAAYC,SAASP;kCAAkB;;kCAGvD,KAACP;wBAAOa,SAAQ;wBAAWE,OAAM;wBAAYD,SAASR;kCAAU;;;;;;AAMxE,EAAE"}
@@ -0,0 +1,24 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ interface MonitorElementsProps {
3
+ elements: Array<Record<string, unknown>>;
4
+ accessKey: string;
5
+ axis?: 'vertical' | 'horizontal';
6
+ onChange: (elements: Array<Record<string, unknown>>) => void;
7
+ }
8
+ /**
9
+ * This hook is responsible for monitoring the drag and drop of elements.
10
+ * It will call the onChange function with the new order of elements when a drop is detected.
11
+ *
12
+ * @param elements - The list of elements to monitor
13
+ * @param accessKey - The key to use to identify the elements (key of the object)
14
+ * @param axis - The axis to monitor the drag and drop on
15
+ * @param onChange - The function to call when a drop is detected
16
+ */
17
+ export declare function useDragAndDropMonitor({ elements, accessKey, axis, onChange, }: MonitorElementsProps): void;
18
+ export interface DragAndDropElementProps {
19
+ children: ReactNode;
20
+ data: Record<string, unknown>;
21
+ }
22
+ export declare function DragAndDropElement({ children, data }: DragAndDropElementProps): ReactElement;
23
+ export {};
24
+ //# sourceMappingURL=DragAndDropList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragAndDropList.d.ts","sourceRoot":"","sources":["../../src/DragAndDrop/DragAndDropList.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAa7E,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACjC,QAAQ,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,SAAS,EACT,IAAiB,EACjB,QAAQ,GACT,EAAE,oBAAoB,GAAG,IAAI,CAiC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAKD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,uBAAuB,GAAG,YAAY,CA4E5F"}
@@ -0,0 +1,153 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { useEffect, useRef, useState } from 'react';
15
+ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
16
+ import { monitorForElements, draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
17
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
18
+ import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
19
+ import { Stack } from '@mui/material';
20
+ import { idle } from './model';
21
+ import { DropIndicator } from './DropIndicator';
22
+ /**
23
+ * This hook is responsible for monitoring the drag and drop of elements.
24
+ * It will call the onChange function with the new order of elements when a drop is detected.
25
+ *
26
+ * @param elements - The list of elements to monitor
27
+ * @param accessKey - The key to use to identify the elements (key of the object)
28
+ * @param axis - The axis to monitor the drag and drop on
29
+ * @param onChange - The function to call when a drop is detected
30
+ */ export function useDragAndDropMonitor({ elements, accessKey, axis = 'vertical', onChange }) {
31
+ return useEffect(()=>{
32
+ return monitorForElements({
33
+ onDrop ({ location, source }) {
34
+ const target = location.current.dropTargets[0];
35
+ if (!target) {
36
+ return;
37
+ }
38
+ const sourceData = source.data;
39
+ const targetData = target.data;
40
+ const indexOfSource = elements.findIndex((column)=>column[accessKey] === sourceData[accessKey]);
41
+ const indexOfTarget = elements.findIndex((column)=>column[accessKey] === targetData[accessKey]);
42
+ if (indexOfTarget < 0 || indexOfSource < 0) {
43
+ return;
44
+ }
45
+ const closestEdgeOfTarget = extractClosestEdge(targetData);
46
+ onChange(reorderWithEdge({
47
+ list: elements,
48
+ startIndex: indexOfSource,
49
+ indexOfTarget,
50
+ closestEdgeOfTarget,
51
+ axis: axis
52
+ }));
53
+ }
54
+ });
55
+ }, [
56
+ accessKey,
57
+ axis,
58
+ elements,
59
+ onChange
60
+ ]);
61
+ }
62
+ /*
63
+ * This component wraps the children that should be draggable
64
+ */ export function DragAndDropElement({ children, data }) {
65
+ const ref = useRef(null);
66
+ const [state, setState] = useState(idle);
67
+ useEffect(()=>{
68
+ const element = ref.current;
69
+ if (!element) {
70
+ return;
71
+ }
72
+ return combine(draggable({
73
+ element,
74
+ getInitialData () {
75
+ return data;
76
+ },
77
+ onDragStart () {
78
+ setState({
79
+ type: 'is-dragging'
80
+ });
81
+ },
82
+ onDrop () {
83
+ setState(idle);
84
+ }
85
+ }), dropTargetForElements({
86
+ element,
87
+ canDrop ({ source }) {
88
+ // not allowing dropping on yourself
89
+ if (source.element === element) {
90
+ return false;
91
+ }
92
+ // only allowing tasks to be dropped on me
93
+ return true;
94
+ },
95
+ getData ({ input }) {
96
+ return attachClosestEdge(data, {
97
+ element,
98
+ input,
99
+ allowedEdges: [
100
+ 'top',
101
+ 'bottom'
102
+ ]
103
+ });
104
+ },
105
+ getIsSticky () {
106
+ return true;
107
+ },
108
+ onDragEnter ({ self }) {
109
+ const closestEdge = extractClosestEdge(self.data);
110
+ setState({
111
+ type: 'is-dragging-over',
112
+ closestEdge
113
+ });
114
+ },
115
+ onDrag ({ self }) {
116
+ const closestEdge = extractClosestEdge(self.data);
117
+ // Only need to update react state if nothing has changed.
118
+ // Prevents re-rendering.
119
+ setState((current)=>{
120
+ if (current.type === 'is-dragging-over' && current.closestEdge === closestEdge) {
121
+ return current;
122
+ }
123
+ return {
124
+ type: 'is-dragging-over',
125
+ closestEdge
126
+ };
127
+ });
128
+ },
129
+ onDragLeave () {
130
+ setState(idle);
131
+ },
132
+ onDrop () {
133
+ setState(idle);
134
+ }
135
+ }));
136
+ }, [
137
+ data
138
+ ]);
139
+ return /*#__PURE__*/ _jsxs(Stack, {
140
+ ref: ref,
141
+ spacing: 1,
142
+ style: {
143
+ opacity: state.type === 'is-dragging' ? 0.5 : 'unset'
144
+ },
145
+ children: [
146
+ state.type === 'is-dragging-over' && state.closestEdge === 'top' ? /*#__PURE__*/ _jsx(DropIndicator, {}) : null,
147
+ children,
148
+ state.type === 'is-dragging-over' && state.closestEdge === 'bottom' ? /*#__PURE__*/ _jsx(DropIndicator, {}) : null
149
+ ]
150
+ });
151
+ }
152
+
153
+ //# sourceMappingURL=DragAndDropList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DragAndDrop/DragAndDropList.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, ReactNode, useEffect, useRef, useState } from 'react';\nimport { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';\nimport {\n monitorForElements,\n draggable,\n dropTargetForElements,\n} from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\nimport { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport { Stack } from '@mui/material';\nimport { idle, State } from './model';\nimport { DropIndicator } from './DropIndicator';\n\ninterface MonitorElementsProps {\n elements: Array<Record<string, unknown>>;\n accessKey: string;\n axis?: 'vertical' | 'horizontal';\n onChange: (elements: Array<Record<string, unknown>>) => void;\n}\n\n/**\n * This hook is responsible for monitoring the drag and drop of elements.\n * It will call the onChange function with the new order of elements when a drop is detected.\n *\n * @param elements - The list of elements to monitor\n * @param accessKey - The key to use to identify the elements (key of the object)\n * @param axis - The axis to monitor the drag and drop on\n * @param onChange - The function to call when a drop is detected\n */\nexport function useDragAndDropMonitor({\n elements,\n accessKey,\n axis = 'vertical',\n onChange,\n}: MonitorElementsProps): void {\n return useEffect(() => {\n return monitorForElements({\n onDrop({ location, source }) {\n const target = location.current.dropTargets[0];\n if (!target) {\n return;\n }\n\n const sourceData = source.data;\n const targetData = target.data;\n\n const indexOfSource = elements.findIndex((column) => column[accessKey] === sourceData[accessKey]);\n const indexOfTarget = elements.findIndex((column) => column[accessKey] === targetData[accessKey]);\n\n if (indexOfTarget < 0 || indexOfSource < 0) {\n return;\n }\n\n const closestEdgeOfTarget = extractClosestEdge(targetData);\n\n onChange(\n reorderWithEdge({\n list: elements,\n startIndex: indexOfSource,\n indexOfTarget,\n closestEdgeOfTarget,\n axis: axis,\n })\n );\n },\n });\n }, [accessKey, axis, elements, onChange]);\n}\n\nexport interface DragAndDropElementProps {\n children: ReactNode;\n data: Record<string, unknown>;\n}\n\n/*\n * This component wraps the children that should be draggable\n */\nexport function DragAndDropElement({ children, data }: DragAndDropElementProps): ReactElement {\n const ref = useRef<HTMLDivElement>(null);\n const [state, setState] = useState<State>(idle);\n\n useEffect(() => {\n const element = ref.current;\n if (!element) {\n return;\n }\n\n return combine(\n draggable({\n element,\n getInitialData() {\n return data;\n },\n onDragStart() {\n setState({ type: 'is-dragging' });\n },\n onDrop() {\n setState(idle);\n },\n }),\n dropTargetForElements({\n element,\n canDrop({ source }) {\n // not allowing dropping on yourself\n if (source.element === element) {\n return false;\n }\n // only allowing tasks to be dropped on me\n return true;\n },\n getData({ input }) {\n return attachClosestEdge(data, {\n element,\n input,\n allowedEdges: ['top', 'bottom'],\n });\n },\n getIsSticky() {\n return true;\n },\n onDragEnter({ self }) {\n const closestEdge = extractClosestEdge(self.data);\n setState({ type: 'is-dragging-over', closestEdge });\n },\n onDrag({ self }) {\n const closestEdge = extractClosestEdge(self.data);\n\n // Only need to update react state if nothing has changed.\n // Prevents re-rendering.\n setState((current) => {\n if (current.type === 'is-dragging-over' && current.closestEdge === closestEdge) {\n return current;\n }\n return { type: 'is-dragging-over', closestEdge };\n });\n },\n onDragLeave() {\n setState(idle);\n },\n onDrop() {\n setState(idle);\n },\n })\n );\n }, [data]);\n\n return (\n <Stack ref={ref} spacing={1} style={{ opacity: state.type === 'is-dragging' ? 0.5 : 'unset' }}>\n {state.type === 'is-dragging-over' && state.closestEdge === 'top' ? <DropIndicator /> : null}\n {children}\n {state.type === 'is-dragging-over' && state.closestEdge === 'bottom' ? <DropIndicator /> : null}\n </Stack>\n );\n}\n"],"names":["useEffect","useRef","useState","reorderWithEdge","monitorForElements","draggable","dropTargetForElements","combine","attachClosestEdge","extractClosestEdge","Stack","idle","DropIndicator","useDragAndDropMonitor","elements","accessKey","axis","onChange","onDrop","location","source","target","current","dropTargets","sourceData","data","targetData","indexOfSource","findIndex","column","indexOfTarget","closestEdgeOfTarget","list","startIndex","DragAndDropElement","children","ref","state","setState","element","getInitialData","onDragStart","type","canDrop","getData","input","allowedEdges","getIsSticky","onDragEnter","self","closestEdge","onDrag","onDragLeave","spacing","style","opacity"],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { IconButtonProps, MenuProps } from '@mui/material';
3
+ export declare function handleMoveUp<T>(element: T, elements: T[]): T[];
4
+ export declare function handleMoveDown<T>(element: T, elements: T[]): T[];
5
+ export interface DragButtonProps extends IconButtonProps {
6
+ onMoveUp?: () => void;
7
+ onMoveDown?: () => void;
8
+ onMoveLeft?: () => void;
9
+ onMoveRight?: () => void;
10
+ menuSx?: MenuProps['sx'];
11
+ }
12
+ export declare const DragButton: import("react").ForwardRefExoticComponent<Omit<DragButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
13
+ //# sourceMappingURL=DragButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../src/DragAndDrop/DragButton.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAc,eAAe,EAAkB,SAAS,EAAE,MAAM,eAAe,CAAC;AAIvF,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAU9D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAUhE;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,eAAO,MAAM,UAAU,4HAiDrB,CAAC"}
@@ -0,0 +1,99 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { IconButton, Menu, MenuItem } from '@mui/material';
15
+ import DragIcon from 'mdi-material-ui/Drag';
16
+ import { useState, forwardRef } from 'react';
17
+ export function handleMoveUp(element, elements) {
18
+ const index = elements.indexOf(element);
19
+ if (index === 0) {
20
+ return elements;
21
+ }
22
+ const newElements = [
23
+ ...elements
24
+ ];
25
+ newElements.splice(index, 1);
26
+ newElements.splice(index - 1, 0, element);
27
+ return newElements;
28
+ }
29
+ export function handleMoveDown(element, elements) {
30
+ const index = elements.indexOf(element);
31
+ if (index === elements.length - 1) {
32
+ return elements;
33
+ }
34
+ const newElements = [
35
+ ...elements
36
+ ];
37
+ newElements.splice(index, 1);
38
+ newElements.splice(index + 1, 0, element);
39
+ return newElements;
40
+ }
41
+ export const DragButton = /*#__PURE__*/ forwardRef(function DragButton({ onMoveUp, onMoveDown, onMoveLeft, onMoveRight, menuSx, ...otherProps }, ref) {
42
+ const [anchorEl, setAnchorEl] = useState(null);
43
+ const open = Boolean(anchorEl);
44
+ function handleClick(event) {
45
+ setAnchorEl(event.currentTarget);
46
+ }
47
+ function handleMove(callback) {
48
+ setAnchorEl(null);
49
+ callback?.();
50
+ }
51
+ return /*#__PURE__*/ _jsxs(_Fragment, {
52
+ children: [
53
+ /*#__PURE__*/ _jsx(IconButton, {
54
+ ...otherProps,
55
+ ref: ref,
56
+ "aria-label": "move",
57
+ "aria-haspopup": true,
58
+ "aria-expanded": open,
59
+ size: "small",
60
+ onClick: handleClick,
61
+ children: /*#__PURE__*/ _jsx(DragIcon, {})
62
+ }),
63
+ (onMoveUp || onMoveDown || onMoveLeft || onMoveRight) && /*#__PURE__*/ _jsxs(Menu, {
64
+ id: "drag-button-menu",
65
+ MenuListProps: {
66
+ 'aria-labelledby': 'drag-button-menu'
67
+ },
68
+ anchorEl: anchorEl,
69
+ open: open,
70
+ onClose: ()=>handleMove(undefined),
71
+ sx: menuSx,
72
+ children: [
73
+ onMoveUp && /*#__PURE__*/ _jsx(MenuItem, {
74
+ onClick: ()=>handleMove(onMoveUp),
75
+ children: "Move Up"
76
+ }),
77
+ onMoveDown && /*#__PURE__*/ _jsx(MenuItem, {
78
+ onClick: ()=>handleMove(onMoveDown),
79
+ children: "Move Down"
80
+ }),
81
+ onMoveLeft && /*#__PURE__*/ _jsx(MenuItem, {
82
+ onClick: ()=>handleMove(onMoveLeft),
83
+ children: "Move Left"
84
+ }),
85
+ onMoveRight && /*#__PURE__*/ _jsx(MenuItem, {
86
+ onClick: ()=>handleMove(onMoveRight),
87
+ children: "Move Right"
88
+ }),
89
+ onMoveRight && /*#__PURE__*/ _jsx(MenuItem, {
90
+ onClick: ()=>handleMove(onMoveRight),
91
+ children: "Move Right"
92
+ })
93
+ ]
94
+ })
95
+ ]
96
+ });
97
+ });
98
+
99
+ //# sourceMappingURL=DragButton.js.map