@perses-dev/components 0.49.0 → 0.50.0-rc.0

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 (345) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +2 -1
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -1
  3. package/dist/AlignSelector/AlignSelector.js +0 -3
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -1
  5. package/dist/BarChart/BarChart.d.ts +2 -1
  6. package/dist/BarChart/BarChart.d.ts.map +1 -1
  7. package/dist/BarChart/BarChart.js +10 -5
  8. package/dist/BarChart/BarChart.js.map +1 -1
  9. package/dist/ColorPicker/ColorPicker.d.ts +2 -1
  10. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  11. package/dist/ColorPicker/ColorPicker.js +3 -3
  12. package/dist/ColorPicker/ColorPicker.js.map +1 -1
  13. package/dist/ColorPicker/OptionsColorPicker.d.ts +2 -1
  14. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
  15. package/dist/ColorPicker/OptionsColorPicker.js +2 -2
  16. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
  17. package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
  18. package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
  19. package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
  20. package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
  21. package/dist/DensitySelector/DensitySelector.d.ts +2 -1
  22. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -1
  23. package/dist/DensitySelector/DensitySelector.js.map +1 -1
  24. package/dist/Dialog/Dialog.d.ts +8 -8
  25. package/dist/Dialog/Dialog.d.ts.map +1 -1
  26. package/dist/Dialog/Dialog.js +0 -1
  27. package/dist/Dialog/Dialog.js.map +1 -1
  28. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  29. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  30. package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
  31. package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
  32. package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
  33. package/dist/DragAndDrop/DragAndDropList.js +153 -0
  34. package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
  35. package/dist/DragAndDrop/DragButton.d.ts +13 -0
  36. package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
  37. package/dist/DragAndDrop/DragButton.js +97 -0
  38. package/dist/DragAndDrop/DragButton.js.map +1 -0
  39. package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
  40. package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
  41. package/dist/DragAndDrop/DropIndicator.js +44 -0
  42. package/dist/DragAndDrop/DropIndicator.js.map +1 -0
  43. package/dist/DragAndDrop/index.d.ts +4 -0
  44. package/dist/DragAndDrop/index.d.ts.map +1 -0
  45. package/dist/DragAndDrop/index.js +17 -0
  46. package/dist/DragAndDrop/index.js.map +1 -0
  47. package/dist/DragAndDrop/model.d.ts +11 -0
  48. package/dist/DragAndDrop/model.d.ts.map +1 -0
  49. package/dist/DragAndDrop/model.js +17 -0
  50. package/dist/DragAndDrop/model.js.map +1 -0
  51. package/dist/Drawer/Drawer.d.ts +2 -1
  52. package/dist/Drawer/Drawer.d.ts.map +1 -1
  53. package/dist/Drawer/Drawer.js.map +1 -1
  54. package/dist/EChart/EChart.d.ts +2 -2
  55. package/dist/EChart/EChart.d.ts.map +1 -1
  56. package/dist/EChart/EChart.js +2 -2
  57. package/dist/EChart/EChart.js.map +1 -1
  58. package/dist/ErrorAlert.d.ts +2 -1
  59. package/dist/ErrorAlert.d.ts.map +1 -1
  60. package/dist/ErrorAlert.js.map +1 -1
  61. package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
  62. package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
  63. package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
  64. package/dist/FormEditor/FormActions.d.ts +16 -0
  65. package/dist/FormEditor/FormActions.d.ts.map +1 -0
  66. package/dist/FormEditor/FormActions.js +75 -0
  67. package/dist/FormEditor/FormActions.js.map +1 -0
  68. package/dist/FormEditor/index.d.ts +2 -0
  69. package/dist/FormEditor/index.d.ts.map +1 -0
  70. package/dist/FormEditor/index.js +15 -0
  71. package/dist/FormEditor/index.js.map +1 -0
  72. package/dist/FormatControls/FormatControls.d.ts +2 -1
  73. package/dist/FormatControls/FormatControls.d.ts.map +1 -1
  74. package/dist/FormatControls/FormatControls.js +2 -2
  75. package/dist/FormatControls/FormatControls.js.map +1 -1
  76. package/dist/GaugeChart/GaugeChart.d.ts +2 -1
  77. package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
  78. package/dist/GaugeChart/GaugeChart.js +1 -1
  79. package/dist/GaugeChart/GaugeChart.js.map +1 -1
  80. package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
  81. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  82. package/dist/InfoTooltip/InfoTooltip.js +0 -1
  83. package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
  84. package/dist/JSONEditor.d.ts +2 -1
  85. package/dist/JSONEditor.d.ts.map +1 -1
  86. package/dist/JSONEditor.js.map +1 -1
  87. package/dist/Legend/CompactLegend.d.ts +2 -1
  88. package/dist/Legend/CompactLegend.d.ts.map +1 -1
  89. package/dist/Legend/CompactLegend.js.map +1 -1
  90. package/dist/Legend/Legend.d.ts +2 -1
  91. package/dist/Legend/Legend.d.ts.map +1 -1
  92. package/dist/Legend/Legend.js +8 -4
  93. package/dist/Legend/Legend.js.map +1 -1
  94. package/dist/Legend/LegendColorBadge.d.ts +2 -2
  95. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  96. package/dist/Legend/LegendColorBadge.js +2 -2
  97. package/dist/Legend/LegendColorBadge.js.map +1 -1
  98. package/dist/Legend/ListLegend.d.ts +2 -1
  99. package/dist/Legend/ListLegend.d.ts.map +1 -1
  100. package/dist/Legend/ListLegend.js.map +1 -1
  101. package/dist/Legend/ListLegendItem.d.ts +5 -5
  102. package/dist/Legend/ListLegendItem.d.ts.map +1 -1
  103. package/dist/Legend/ListLegendItem.js +5 -8
  104. package/dist/Legend/ListLegendItem.js.map +1 -1
  105. package/dist/Legend/TableLegend.d.ts +2 -1
  106. package/dist/Legend/TableLegend.d.ts.map +1 -1
  107. package/dist/Legend/TableLegend.js +1 -0
  108. package/dist/Legend/TableLegend.js.map +1 -1
  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 +1 -1
  112. package/dist/LineChart/LineChart.d.ts.map +1 -1
  113. package/dist/LineChart/LineChart.js +2 -3
  114. package/dist/LineChart/LineChart.js.map +1 -1
  115. package/dist/LinksEditor/LinksEditor.d.ts +2 -2
  116. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
  117. package/dist/LinksEditor/LinksEditor.js +1 -1
  118. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  119. package/dist/ModeSelector/ModeSelector.d.ts +2 -1
  120. package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
  121. package/dist/ModeSelector/ModeSelector.js.map +1 -1
  122. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
  123. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  124. package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
  125. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
  126. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  127. package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
  128. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
  129. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  130. package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
  131. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
  132. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  133. package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
  134. package/dist/Overlay/Overlay.d.ts +4 -3
  135. package/dist/Overlay/Overlay.d.ts.map +1 -1
  136. package/dist/Overlay/Overlay.js.map +1 -1
  137. package/dist/PieChart/PieChart.d.ts +2 -1
  138. package/dist/PieChart/PieChart.d.ts.map +1 -1
  139. package/dist/PieChart/PieChart.js +4 -2
  140. package/dist/PieChart/PieChart.js.map +1 -1
  141. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
  142. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
  143. package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
  144. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
  145. package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
  146. package/dist/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
  147. package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
  148. package/dist/SortSelector/SortSelector.d.ts +2 -1
  149. package/dist/SortSelector/SortSelector.d.ts.map +1 -1
  150. package/dist/SortSelector/SortSelector.js.map +1 -1
  151. package/dist/SortSelector/SortSelectorButtons.d.ts +2 -1
  152. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -1
  153. package/dist/SortSelector/SortSelectorButtons.js +2 -5
  154. package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
  155. package/dist/StatChart/StatChart.d.ts +2 -1
  156. package/dist/StatChart/StatChart.d.ts.map +1 -1
  157. package/dist/StatChart/StatChart.js.map +1 -1
  158. package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
  159. package/dist/StatChart/calculateFontSize.js.map +1 -1
  160. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +14 -0
  161. package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
  162. package/dist/StatusHistoryChart/StatusHistoryChart.js +149 -0
  163. package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
  164. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +12 -0
  165. package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
  166. package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
  167. package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
  168. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
  169. package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
  170. package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
  171. package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
  172. package/dist/StatusHistoryChart/index.d.ts +3 -0
  173. package/dist/StatusHistoryChart/index.d.ts.map +1 -0
  174. package/dist/StatusHistoryChart/index.js +16 -0
  175. package/dist/StatusHistoryChart/index.js.map +1 -0
  176. package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
  177. package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
  178. package/dist/StatusHistoryChart/utils/get-color.js +100 -0
  179. package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
  180. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
  181. package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
  182. package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
  183. package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
  184. package/dist/Table/Table.d.ts +2 -1
  185. package/dist/Table/Table.d.ts.map +1 -1
  186. package/dist/Table/Table.js +3 -2
  187. package/dist/Table/Table.js.map +1 -1
  188. package/dist/Table/TableCell.d.ts +2 -2
  189. package/dist/Table/TableCell.d.ts.map +1 -1
  190. package/dist/Table/TableCell.js +19 -2
  191. package/dist/Table/TableCell.js.map +1 -1
  192. package/dist/Table/TableCheckbox.d.ts +2 -1
  193. package/dist/Table/TableCheckbox.d.ts.map +1 -1
  194. package/dist/Table/TableCheckbox.js.map +1 -1
  195. package/dist/Table/TableHeaderCell.d.ts +2 -1
  196. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  197. package/dist/Table/TableHeaderCell.js.map +1 -1
  198. package/dist/Table/VirtualizedTable.d.ts +3 -3
  199. package/dist/Table/VirtualizedTable.d.ts.map +1 -1
  200. package/dist/Table/VirtualizedTable.js +4 -4
  201. package/dist/Table/VirtualizedTable.js.map +1 -1
  202. package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
  203. package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
  204. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  205. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
  206. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
  207. package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
  208. package/dist/Table/index.d.ts +1 -2
  209. package/dist/Table/index.d.ts.map +1 -1
  210. package/dist/Table/index.js +1 -1
  211. package/dist/Table/index.js.map +1 -1
  212. package/dist/Table/model/table-model.d.ts +7 -1
  213. package/dist/Table/model/table-model.d.ts.map +1 -1
  214. package/dist/Table/model/table-model.js +1 -0
  215. package/dist/Table/model/table-model.js.map +1 -1
  216. package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
  217. package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
  218. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  219. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
  220. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  221. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  222. package/dist/TimeChart/TimeChart.js +1 -1
  223. package/dist/TimeChart/TimeChart.js.map +1 -1
  224. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -1
  225. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  226. package/dist/TimeRangeSelector/DateTimeRangePicker.js +0 -2
  227. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
  228. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +2 -1
  229. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  230. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  231. package/dist/TimeRangeSelector/utils.d.ts.map +1 -1
  232. package/dist/TimeRangeSelector/utils.js.map +1 -1
  233. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
  234. package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
  235. package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
  236. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
  237. package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
  238. package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
  239. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
  240. package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
  241. package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
  242. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
  243. package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
  244. package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
  245. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
  246. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  247. package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
  248. package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
  249. package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
  250. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  251. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  252. package/dist/TimeSeriesTooltip/TooltipHeader.js +2 -4
  253. package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
  254. package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
  255. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  256. package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
  257. package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
  258. package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
  259. package/dist/TimeSeriesTooltip/utils.js.map +1 -1
  260. package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
  261. package/dist/TransformsEditor/TransformEditor.d.ts +2 -1
  262. package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
  263. package/dist/TransformsEditor/TransformEditor.js.map +1 -1
  264. package/dist/TransformsEditor/TransformEditorContainer.d.ts +2 -1
  265. package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
  266. package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
  267. package/dist/TransformsEditor/TransformsEditor.d.ts +2 -1
  268. package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
  269. package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
  270. package/dist/YAxisLabel.d.ts +2 -1
  271. package/dist/YAxisLabel.d.ts.map +1 -1
  272. package/dist/YAxisLabel.js +4 -2
  273. package/dist/YAxisLabel.js.map +1 -1
  274. package/dist/cjs/AlignSelector/AlignSelector.js +0 -3
  275. package/dist/cjs/BarChart/BarChart.js +11 -6
  276. package/dist/cjs/ColorPicker/ColorPicker.js +3 -44
  277. package/dist/cjs/ColorPicker/OptionsColorPicker.js +2 -2
  278. package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
  279. package/dist/cjs/Dialog/Dialog.js +0 -1
  280. package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
  281. package/dist/cjs/DragAndDrop/DragButton.js +121 -0
  282. package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
  283. package/dist/cjs/DragAndDrop/index.js +32 -0
  284. package/dist/cjs/DragAndDrop/model.js +25 -0
  285. package/dist/cjs/EChart/EChart.js +2 -43
  286. package/dist/cjs/FormEditor/FormActions.js +83 -0
  287. package/dist/cjs/FormEditor/index.js +30 -0
  288. package/dist/cjs/FormatControls/FormatControls.js +2 -2
  289. package/dist/cjs/GaugeChart/GaugeChart.js +2 -2
  290. package/dist/cjs/InfoTooltip/InfoTooltip.js +0 -6
  291. package/dist/cjs/Legend/Legend.js +8 -4
  292. package/dist/cjs/Legend/LegendColorBadge.js +2 -7
  293. package/dist/cjs/Legend/ListLegendItem.js +3 -46
  294. package/dist/cjs/Legend/TableLegend.js +1 -0
  295. package/dist/cjs/LineChart/LineChart.js +4 -5
  296. package/dist/cjs/LinksEditor/LinksEditor.js +1 -42
  297. package/dist/cjs/PieChart/PieChart.js +4 -2
  298. package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
  299. package/dist/cjs/SortSelector/SortSelectorButtons.js +2 -5
  300. package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +157 -0
  301. package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
  302. package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
  303. package/dist/cjs/StatusHistoryChart/index.js +31 -0
  304. package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
  305. package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
  306. package/dist/cjs/Table/Table.js +2 -1
  307. package/dist/cjs/Table/TableCell.js +19 -2
  308. package/dist/cjs/Table/VirtualizedTable.js +4 -4
  309. package/dist/cjs/Table/index.js +1 -7
  310. package/dist/cjs/Table/model/table-model.js +4 -0
  311. package/dist/cjs/TimeChart/TimeChart.js +1 -1
  312. package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +0 -2
  313. package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +2 -4
  314. package/dist/cjs/YAxisLabel.js +4 -2
  315. package/dist/cjs/index.js +3 -0
  316. package/dist/cjs/theme/theme.js +3 -4
  317. package/dist/cjs/utils/format.js +18 -0
  318. package/dist/context/ChartsProvider.d.ts +2 -2
  319. package/dist/context/ChartsProvider.d.ts.map +1 -1
  320. package/dist/context/ChartsProvider.js.map +1 -1
  321. package/dist/context/TimeZoneProvider.d.ts +4 -4
  322. package/dist/context/TimeZoneProvider.d.ts.map +1 -1
  323. package/dist/context/TimeZoneProvider.js.map +1 -1
  324. package/dist/index.d.ts +3 -0
  325. package/dist/index.d.ts.map +1 -1
  326. package/dist/index.js +3 -0
  327. package/dist/index.js.map +1 -1
  328. package/dist/test/render.d.ts +3 -3
  329. package/dist/test/render.d.ts.map +1 -1
  330. package/dist/test/render.js.map +1 -1
  331. package/dist/theme/theme.d.ts.map +1 -1
  332. package/dist/theme/theme.js +2 -3
  333. package/dist/theme/theme.js.map +1 -1
  334. package/dist/utils/axis.d.ts +1 -7
  335. package/dist/utils/axis.d.ts.map +1 -1
  336. package/dist/utils/axis.js.map +1 -1
  337. package/dist/utils/chart-actions.d.ts.map +1 -1
  338. package/dist/utils/chart-actions.js.map +1 -1
  339. package/dist/utils/component-ids.d.ts.map +1 -1
  340. package/dist/utils/component-ids.js.map +1 -1
  341. package/dist/utils/format.d.ts +10 -4
  342. package/dist/utils/format.d.ts.map +1 -1
  343. package/dist/utils/format.js +15 -0
  344. package/dist/utils/format.js.map +1 -1
  345. package/package.json +10 -8
@@ -1,8 +1,9 @@
1
1
  import { ButtonGroupProps } from '@mui/material';
2
+ import { ReactElement } from 'react';
2
3
  export type AlignOption = 'left' | 'center' | 'right';
3
4
  export interface AlignSelectorProps extends Omit<ButtonGroupProps, 'onChange'> {
4
5
  onChange: (align: AlignOption) => void;
5
6
  value?: AlignOption;
6
7
  }
7
- export declare function AlignSelector({ onChange, value, ...props }: AlignSelectorProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function AlignSelector({ onChange, value, ...props }: AlignSelectorProps): ReactElement;
8
9
  //# sourceMappingURL=AlignSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AlignSelector.d.ts","sourceRoot":"","sources":["../../src/AlignSelector/AlignSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC5E,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAc,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CA0BvF"}
1
+ {"version":3,"file":"AlignSelector.d.ts","sourceRoot":"","sources":["../../src/AlignSelector/AlignSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC5E,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAc,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,YAAY,CA0BtG"}
@@ -18,9 +18,6 @@ export function AlignSelector({ onChange, value = 'left', ...props }) {
18
18
  };
19
19
  return /*#__PURE__*/ _jsxs(ButtonGroup, {
20
20
  "aria-label": "Alignement",
21
- sx: {
22
- margin: 1
23
- },
24
21
  ...props,
25
22
  children: [
26
23
  /*#__PURE__*/ _jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/AlignSelector/AlignSelector.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 { Button, ButtonGroup, ButtonGroupProps } from '@mui/material';\n\nexport type AlignOption = 'left' | 'center' | 'right';\n\nexport interface AlignSelectorProps extends Omit<ButtonGroupProps, 'onChange'> {\n onChange: (align: AlignOption) => void;\n value?: AlignOption;\n}\n\nexport function AlignSelector({ onChange, value = 'left', ...props }: AlignSelectorProps) {\n const handleSortChange = (option: AlignOption) => {\n onChange(option);\n };\n\n return (\n <ButtonGroup aria-label=\"Alignement\" sx={{ margin: 1 }} {...props}>\n <Button key=\"left\" onClick={() => handleSortChange('left')} variant={value === 'left' ? 'contained' : 'outlined'}>\n Left\n </Button>\n <Button\n key=\"center\"\n onClick={() => handleSortChange('center')}\n variant={value === 'center' ? 'contained' : 'outlined'}\n >\n Center\n </Button>\n <Button\n key=\"right\"\n onClick={() => handleSortChange('right')}\n variant={value === 'right' ? 'contained' : 'outlined'}\n >\n Right\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup","AlignSelector","onChange","value","props","handleSortChange","option","aria-label","sx","margin","onClick","variant"],"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;;AAEjC,SAASA,MAAM,EAAEC,WAAW,QAA0B,gBAAgB;AAStE,OAAO,SAASC,cAAc,EAAEC,QAAQ,EAAEC,QAAQ,MAAM,EAAE,GAAGC,OAA2B;IACtF,MAAMC,mBAAmB,CAACC;QACxBJ,SAASI;IACX;IAEA,qBACE,MAACN;QAAYO,cAAW;QAAaC,IAAI;YAAEC,QAAQ;QAAE;QAAI,GAAGL,KAAK;;0BAC/D,KAACL;gBAAkBW,SAAS,IAAML,iBAAiB;gBAASM,SAASR,UAAU,SAAS,cAAc;0BAAY;eAAtG;0BAGZ,KAACJ;gBAECW,SAAS,IAAML,iBAAiB;gBAChCM,SAASR,UAAU,WAAW,cAAc;0BAC7C;eAHK;0BAMN,KAACJ;gBAECW,SAAS,IAAML,iBAAiB;gBAChCM,SAASR,UAAU,UAAU,cAAc;0BAC5C;eAHK;;;AAQZ"}
1
+ {"version":3,"sources":["../../src/AlignSelector/AlignSelector.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 { Button, ButtonGroup, ButtonGroupProps } from '@mui/material';\nimport { ReactElement } from 'react';\n\nexport type AlignOption = 'left' | 'center' | 'right';\n\nexport interface AlignSelectorProps extends Omit<ButtonGroupProps, 'onChange'> {\n onChange: (align: AlignOption) => void;\n value?: AlignOption;\n}\n\nexport function AlignSelector({ onChange, value = 'left', ...props }: AlignSelectorProps): ReactElement {\n const handleSortChange = (option: AlignOption): void => {\n onChange(option);\n };\n\n return (\n <ButtonGroup aria-label=\"Alignement\" {...props}>\n <Button key=\"left\" onClick={() => handleSortChange('left')} variant={value === 'left' ? 'contained' : 'outlined'}>\n Left\n </Button>\n <Button\n key=\"center\"\n onClick={() => handleSortChange('center')}\n variant={value === 'center' ? 'contained' : 'outlined'}\n >\n Center\n </Button>\n <Button\n key=\"right\"\n onClick={() => handleSortChange('right')}\n variant={value === 'right' ? 'contained' : 'outlined'}\n >\n Right\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup","AlignSelector","onChange","value","props","handleSortChange","option","aria-label","onClick","variant"],"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;;AAEjC,SAASA,MAAM,EAAEC,WAAW,QAA0B,gBAAgB;AAUtE,OAAO,SAASC,cAAc,EAAEC,QAAQ,EAAEC,QAAQ,MAAM,EAAE,GAAGC,OAA2B;IACtF,MAAMC,mBAAmB,CAACC;QACxBJ,SAASI;IACX;IAEA,qBACE,MAACN;QAAYO,cAAW;QAAc,GAAGH,KAAK;;0BAC5C,KAACL;gBAAkBS,SAAS,IAAMH,iBAAiB;gBAASI,SAASN,UAAU,SAAS,cAAc;0BAAY;eAAtG;0BAGZ,KAACJ;gBAECS,SAAS,IAAMH,iBAAiB;gBAChCI,SAASN,UAAU,WAAW,cAAc;0BAC7C;eAHK;0BAMN,KAACJ;gBAECS,SAAS,IAAMH,iBAAiB;gBAChCI,SAASN,UAAU,UAAU,cAAc;0BAC5C;eAHK;;;AAQZ"}
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  import { FormatOptions } from '@perses-dev/core';
2
3
  import { ModeOption } from '../ModeSelector';
3
4
  export interface BarChartData {
@@ -11,5 +12,5 @@ export interface BarChartProps {
11
12
  format?: FormatOptions;
12
13
  mode?: ModeOption;
13
14
  }
14
- export declare function BarChart(props: BarChartProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function BarChart(props: BarChartProps): ReactElement;
15
16
  //# sourceMappingURL=BarChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../src/BarChart/BarChart.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAQ9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAoF5C"}
1
+ {"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../src/BarChart/BarChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAQ9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA2F3D"}
@@ -18,7 +18,7 @@ import { BarChart as EChartsBarChart } from 'echarts/charts';
18
18
  import { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';
19
19
  import { CanvasRenderer } from 'echarts/renderers';
20
20
  import { Box } from '@mui/material';
21
- import { useChartsTheme } from '../context/ChartsProvider';
21
+ import { useChartsTheme } from '../context';
22
22
  import { EChart } from '../EChart';
23
23
  import { getFormattedAxis } from '../utils';
24
24
  use([
@@ -75,13 +75,16 @@ export function BarChart(props) {
75
75
  show: true,
76
76
  position: 'right',
77
77
  formatter: (params)=>{
78
+ if (!params.data[1]) {
79
+ return undefined;
80
+ }
78
81
  if (mode === 'percentage') {
79
- return params.data[1] && formatValue(params.data[1], {
82
+ return formatValue(params.data[1], {
80
83
  unit: 'percent',
81
84
  decimalPlaces: format.decimalPlaces
82
85
  });
83
86
  }
84
- return params.data[1] && formatValue(params.data[1], format);
87
+ return formatValue(params.data[1], format);
85
88
  },
86
89
  barMinWidth: BAR_WIN_WIDTH,
87
90
  barCategoryGap: BAR_GAP
@@ -110,9 +113,11 @@ export function BarChart(props) {
110
113
  format
111
114
  ]);
112
115
  return /*#__PURE__*/ _jsx(Box, {
113
- sx: {
116
+ style: {
114
117
  width: width,
115
- height: height,
118
+ height: height
119
+ },
120
+ sx: {
116
121
  overflow: 'auto'
117
122
  },
118
123
  children: /*#__PURE__*/ _jsx(EChart, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/BarChart/BarChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useMemo } from 'react';\nimport { FormatOptions, formatValue } from '@perses-dev/core';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { BarChart as EChartsBarChart } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { Box } from '@mui/material';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { EChart } from '../EChart';\nimport { ModeOption } from '../ModeSelector';\nimport { getFormattedAxis } from '../utils';\n\nuse([EChartsBarChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst BAR_WIN_WIDTH = 14;\nconst BAR_GAP = 6;\n\nexport interface BarChartData {\n label: string;\n value: number | null;\n}\n\nexport interface BarChartProps {\n width: number;\n height: number;\n data: BarChartData[] | null;\n format?: FormatOptions;\n mode?: ModeOption;\n}\n\nexport function BarChart(props: BarChartProps) {\n const { width, height, data, format = { unit: 'decimal' }, mode = 'value' } = props;\n const chartsTheme = useChartsTheme();\n\n const option: EChartsCoreOption = useMemo(() => {\n if (!data || !data.length) return chartsTheme.noDataOption;\n\n const source: Array<Array<BarChartData['label'] | BarChartData['value']>> = [];\n data.map((d) => {\n source.push([d.label, d.value]);\n });\n\n return {\n title: {\n show: false,\n },\n dataset: [\n {\n dimensions: ['label', 'value'],\n source: source,\n },\n ],\n xAxis: getFormattedAxis({}, format),\n yAxis: {\n type: 'category',\n splitLine: {\n show: false,\n },\n axisLabel: {\n overflow: 'truncate',\n width: width / 3,\n },\n },\n series: {\n type: 'bar',\n label: {\n show: true,\n position: 'right',\n formatter: (params: { data: number[] }) => {\n if (mode === 'percentage') {\n return (\n params.data[1] &&\n formatValue(params.data[1], {\n unit: 'percent',\n decimalPlaces: format.decimalPlaces,\n })\n );\n }\n return params.data[1] && formatValue(params.data[1], format);\n },\n barMinWidth: BAR_WIN_WIDTH,\n barCategoryGap: BAR_GAP,\n },\n itemStyle: {\n borderRadius: 4,\n color: chartsTheme.echartsTheme[0],\n },\n },\n tooltip: {\n appendToBody: true,\n confine: true,\n formatter: (params: { name: string; data: number[] }) =>\n params.data[1] && `<b>${params.name}</b> &emsp; ${formatValue(params.data[1], format)}`,\n },\n // increase distance between grid and container to prevent y axis labels from getting cut off\n grid: {\n left: '5%',\n right: '5%',\n },\n };\n }, [data, chartsTheme, width, mode, format]);\n\n return (\n <Box sx={{ width: width, height: height, overflow: 'auto' }}>\n <EChart\n sx={{\n minHeight: height,\n height: data ? data.length * (BAR_WIN_WIDTH + BAR_GAP) : '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n </Box>\n );\n}\n"],"names":["useMemo","formatValue","use","BarChart","EChartsBarChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","Box","useChartsTheme","EChart","getFormattedAxis","BAR_WIN_WIDTH","BAR_GAP","props","width","height","data","format","unit","mode","chartsTheme","option","length","noDataOption","source","map","d","push","label","value","title","show","dataset","dimensions","xAxis","yAxis","type","splitLine","axisLabel","overflow","series","position","formatter","params","decimalPlaces","barMinWidth","barCategoryGap","itemStyle","borderRadius","color","echartsTheme","tooltip","appendToBody","confine","name","grid","left","right","sx","minHeight","theme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAAwBC,WAAW,QAAQ,mBAAmB;AAC9D,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,YAAYC,eAAe,QAAQ,iBAAiB;AAC7D,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACvG,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,MAAM,QAAQ,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,WAAW;AAE5CX,IAAI;IAACE;IAAiBC;IAAeC;IAAkBC;IAAgBC;IAAkBC;CAAe;AAExG,MAAMK,gBAAgB;AACtB,MAAMC,UAAU;AAehB,OAAO,SAASZ,SAASa,KAAoB;IAC3C,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS;QAAEC,MAAM;IAAU,CAAC,EAAEC,OAAO,OAAO,EAAE,GAAGN;IAC9E,MAAMO,cAAcZ;IAEpB,MAAMa,SAA4BxB,QAAQ;QACxC,IAAI,CAACmB,QAAQ,CAACA,KAAKM,MAAM,EAAE,OAAOF,YAAYG,YAAY;QAE1D,MAAMC,SAAsE,EAAE;QAC9ER,KAAKS,GAAG,CAAC,CAACC;YACRF,OAAOG,IAAI,CAAC;gBAACD,EAAEE,KAAK;gBAAEF,EAAEG,KAAK;aAAC;QAChC;QAEA,OAAO;YACLC,OAAO;gBACLC,MAAM;YACR;YACAC,SAAS;gBACP;oBACEC,YAAY;wBAAC;wBAAS;qBAAQ;oBAC9BT,QAAQA;gBACV;aACD;YACDU,OAAOxB,iBAAiB,CAAC,GAAGO;YAC5BkB,OAAO;gBACLC,MAAM;gBACNC,WAAW;oBACTN,MAAM;gBACR;gBACAO,WAAW;oBACTC,UAAU;oBACVzB,OAAOA,QAAQ;gBACjB;YACF;YACA0B,QAAQ;gBACNJ,MAAM;gBACNR,OAAO;oBACLG,MAAM;oBACNU,UAAU;oBACVC,WAAW,CAACC;wBACV,IAAIxB,SAAS,cAAc;4BACzB,OACEwB,OAAO3B,IAAI,CAAC,EAAE,IACdlB,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAE;gCAC1BE,MAAM;gCACN0B,eAAe3B,OAAO2B,aAAa;4BACrC;wBAEJ;wBACA,OAAOD,OAAO3B,IAAI,CAAC,EAAE,IAAIlB,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAEC;oBACvD;oBACA4B,aAAalC;oBACbmC,gBAAgBlC;gBAClB;gBACAmC,WAAW;oBACTC,cAAc;oBACdC,OAAO7B,YAAY8B,YAAY,CAAC,EAAE;gBACpC;YACF;YACAC,SAAS;gBACPC,cAAc;gBACdC,SAAS;gBACTX,WAAW,CAACC,SACVA,OAAO3B,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE2B,OAAOW,IAAI,CAAC,YAAY,EAAExD,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAEC,QAAQ,CAAC;YAC3F;YACA,6FAA6F;YAC7FsC,MAAM;gBACJC,MAAM;gBACNC,OAAO;YACT;QACF;IACF,GAAG;QAACzC;QAAMI;QAAaN;QAAOK;QAAMF;KAAO;IAE3C,qBACE,KAACV;QAAImD,IAAI;YAAE5C,OAAOA;YAAOC,QAAQA;YAAQwB,UAAU;QAAO;kBACxD,cAAA,KAAC9B;YACCiD,IAAI;gBACFC,WAAW5C;gBACXA,QAAQC,OAAOA,KAAKM,MAAM,GAAIX,CAAAA,gBAAgBC,OAAM,IAAK;YAC3D;YACAS,QAAQA;YACRuC,OAAOxC,YAAY8B,YAAY;;;AAIvC"}
1
+ {"version":3,"sources":["../../src/BarChart/BarChart.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, useMemo } from 'react';\nimport { FormatOptions, formatValue } from '@perses-dev/core';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { BarChart as EChartsBarChart } from 'echarts/charts';\nimport { GridComponent, DatasetComponent, TitleComponent, TooltipComponent } from 'echarts/components';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { Box } from '@mui/material';\nimport { useChartsTheme } from '../context';\nimport { EChart } from '../EChart';\nimport { ModeOption } from '../ModeSelector';\nimport { getFormattedAxis } from '../utils';\n\nuse([EChartsBarChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);\n\nconst BAR_WIN_WIDTH = 14;\nconst BAR_GAP = 6;\n\nexport interface BarChartData {\n label: string;\n value: number | null;\n}\n\nexport interface BarChartProps {\n width: number;\n height: number;\n data: BarChartData[] | null;\n format?: FormatOptions;\n mode?: ModeOption;\n}\n\nexport function BarChart(props: BarChartProps): ReactElement {\n const { width, height, data, format = { unit: 'decimal' }, mode = 'value' } = props;\n const chartsTheme = useChartsTheme();\n\n const option: EChartsCoreOption = useMemo(() => {\n if (!data || !data.length) return chartsTheme.noDataOption;\n\n const source: Array<Array<BarChartData['label'] | BarChartData['value']>> = [];\n data.map((d) => {\n source.push([d.label, d.value]);\n });\n\n return {\n title: {\n show: false,\n },\n dataset: [\n {\n dimensions: ['label', 'value'],\n source: source,\n },\n ],\n xAxis: getFormattedAxis({}, format),\n yAxis: {\n type: 'category',\n splitLine: {\n show: false,\n },\n axisLabel: {\n overflow: 'truncate',\n width: width / 3,\n },\n },\n series: {\n type: 'bar',\n label: {\n show: true,\n position: 'right',\n formatter: (params: { data: number[] }): string | undefined => {\n if (!params.data[1]) {\n return undefined;\n }\n\n if (mode === 'percentage') {\n return formatValue(params.data[1]!, {\n unit: 'percent',\n decimalPlaces: format.decimalPlaces,\n });\n }\n return formatValue(params.data[1], format);\n },\n barMinWidth: BAR_WIN_WIDTH,\n barCategoryGap: BAR_GAP,\n },\n itemStyle: {\n borderRadius: 4,\n color: chartsTheme.echartsTheme[0],\n },\n },\n tooltip: {\n appendToBody: true,\n confine: true,\n formatter: (params: { name: string; data: number[] }) =>\n params.data[1] && `<b>${params.name}</b> &emsp; ${formatValue(params.data[1], format)}`,\n },\n // increase distance between grid and container to prevent y axis labels from getting cut off\n grid: {\n left: '5%',\n right: '5%',\n },\n };\n }, [data, chartsTheme, width, mode, format]);\n\n return (\n <Box\n style={{\n width: width,\n height: height,\n }}\n sx={{ overflow: 'auto' }}\n >\n <EChart\n sx={{\n minHeight: height,\n height: data ? data.length * (BAR_WIN_WIDTH + BAR_GAP) : '100%',\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n </Box>\n );\n}\n"],"names":["useMemo","formatValue","use","BarChart","EChartsBarChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","CanvasRenderer","Box","useChartsTheme","EChart","getFormattedAxis","BAR_WIN_WIDTH","BAR_GAP","props","width","height","data","format","unit","mode","chartsTheme","option","length","noDataOption","source","map","d","push","label","value","title","show","dataset","dimensions","xAxis","yAxis","type","splitLine","axisLabel","overflow","series","position","formatter","params","undefined","decimalPlaces","barMinWidth","barCategoryGap","itemStyle","borderRadius","color","echartsTheme","tooltip","appendToBody","confine","name","grid","left","right","style","sx","minHeight","theme"],"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,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAAwBC,WAAW,QAAQ,mBAAmB;AAC9D,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,YAAYC,eAAe,QAAQ,iBAAiB;AAC7D,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACvG,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,MAAM,QAAQ,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,WAAW;AAE5CX,IAAI;IAACE;IAAiBC;IAAeC;IAAkBC;IAAgBC;IAAkBC;CAAe;AAExG,MAAMK,gBAAgB;AACtB,MAAMC,UAAU;AAehB,OAAO,SAASZ,SAASa,KAAoB;IAC3C,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS;QAAEC,MAAM;IAAU,CAAC,EAAEC,OAAO,OAAO,EAAE,GAAGN;IAC9E,MAAMO,cAAcZ;IAEpB,MAAMa,SAA4BxB,QAAQ;QACxC,IAAI,CAACmB,QAAQ,CAACA,KAAKM,MAAM,EAAE,OAAOF,YAAYG,YAAY;QAE1D,MAAMC,SAAsE,EAAE;QAC9ER,KAAKS,GAAG,CAAC,CAACC;YACRF,OAAOG,IAAI,CAAC;gBAACD,EAAEE,KAAK;gBAAEF,EAAEG,KAAK;aAAC;QAChC;QAEA,OAAO;YACLC,OAAO;gBACLC,MAAM;YACR;YACAC,SAAS;gBACP;oBACEC,YAAY;wBAAC;wBAAS;qBAAQ;oBAC9BT,QAAQA;gBACV;aACD;YACDU,OAAOxB,iBAAiB,CAAC,GAAGO;YAC5BkB,OAAO;gBACLC,MAAM;gBACNC,WAAW;oBACTN,MAAM;gBACR;gBACAO,WAAW;oBACTC,UAAU;oBACVzB,OAAOA,QAAQ;gBACjB;YACF;YACA0B,QAAQ;gBACNJ,MAAM;gBACNR,OAAO;oBACLG,MAAM;oBACNU,UAAU;oBACVC,WAAW,CAACC;wBACV,IAAI,CAACA,OAAO3B,IAAI,CAAC,EAAE,EAAE;4BACnB,OAAO4B;wBACT;wBAEA,IAAIzB,SAAS,cAAc;4BACzB,OAAOrB,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAG;gCAClCE,MAAM;gCACN2B,eAAe5B,OAAO4B,aAAa;4BACrC;wBACF;wBACA,OAAO/C,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAEC;oBACrC;oBACA6B,aAAanC;oBACboC,gBAAgBnC;gBAClB;gBACAoC,WAAW;oBACTC,cAAc;oBACdC,OAAO9B,YAAY+B,YAAY,CAAC,EAAE;gBACpC;YACF;YACAC,SAAS;gBACPC,cAAc;gBACdC,SAAS;gBACTZ,WAAW,CAACC,SACVA,OAAO3B,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE2B,OAAOY,IAAI,CAAC,YAAY,EAAEzD,YAAY6C,OAAO3B,IAAI,CAAC,EAAE,EAAEC,QAAQ,CAAC;YAC3F;YACA,6FAA6F;YAC7FuC,MAAM;gBACJC,MAAM;gBACNC,OAAO;YACT;QACF;IACF,GAAG;QAAC1C;QAAMI;QAAaN;QAAOK;QAAMF;KAAO;IAE3C,qBACE,KAACV;QACCoD,OAAO;YACL7C,OAAOA;YACPC,QAAQA;QACV;QACA6C,IAAI;YAAErB,UAAU;QAAO;kBAEvB,cAAA,KAAC9B;YACCmD,IAAI;gBACFC,WAAW9C;gBACXA,QAAQC,OAAOA,KAAKM,MAAM,GAAIX,CAAAA,gBAAgBC,OAAM,IAAK;YAC3D;YACAS,QAAQA;YACRyC,OAAO1C,YAAY+B,YAAY;;;AAIvC"}
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  interface ColorPickerProps {
2
3
  color: string;
3
4
  onChange?: (color: string) => void;
@@ -7,6 +8,6 @@ interface ColorPickerProps {
7
8
  */
8
9
  palette?: string[];
9
10
  }
10
- export declare const ColorPicker: ({ color, onChange, onClear, palette }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const ColorPicker: ({ color, onChange, onClear, palette }: ColorPickerProps) => ReactElement;
11
12
  export {};
12
13
  //# sourceMappingURL=ColorPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":"AAmBA,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,0CAA2C,gBAAgB,4CAmDlF,CAAC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAe,YAAY,EAAY,MAAM,OAAO,CAAC;AAK5D,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,0CAA2C,gBAAgB,KAAG,YAmDrF,CAAC"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { IconButton, Stack, TextField } from '@mui/material';
15
- import React, { useState } from 'react';
15
+ import { useState } from 'react';
16
16
  import { HexColorPicker } from 'react-colorful';
17
17
  import CircleIcon from 'mdi-material-ui/Circle';
18
18
  import DeleteIcon from 'mdi-material-ui/Delete';
@@ -21,7 +21,7 @@ export const ColorPicker = ({ color, onChange, onClear, palette })=>{
21
21
  const [value, setValue] = useState(color);
22
22
  const handleColorChange = (color)=>{
23
23
  setValue(color);
24
- onChange && onChange(color);
24
+ onChange === null || onChange === void 0 ? void 0 : onChange(color);
25
25
  };
26
26
  // we should update this if https://github.com/omgovich/react-colorful/issues/157 is resolved
27
27
  const handleInputChange = (e)=>{
@@ -29,7 +29,7 @@ export const ColorPicker = ({ color, onChange, onClear, palette })=>{
29
29
  setValue(`#${inputValue}`); // always prefix input value with # to indicate hex format
30
30
  // only set color if input value is a valid hex color
31
31
  if (isValidHex(e.target.value)) {
32
- onChange && onChange(e.target.value);
32
+ onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
33
33
  }
34
34
  };
35
35
  return /*#__PURE__*/ _jsxs(Stack, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ColorPicker/ColorPicker.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 { IconButton, Stack, TextField } from '@mui/material';\nimport React, { useState } from 'react';\nimport { HexColorPicker } from 'react-colorful';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport DeleteIcon from 'mdi-material-ui/Delete';\n\ninterface ColorPickerProps {\n color: string;\n onChange?: (color: string) => void;\n onClear?: () => void;\n /**\n * Preset color palette\n */\n palette?: string[];\n}\n\nexport const ColorPicker = ({ color, onChange, onClear, palette }: ColorPickerProps) => {\n // value is the visible value for the controlled text input\n const [value, setValue] = useState(color);\n\n const handleColorChange = (color: string) => {\n setValue(color);\n onChange && onChange(color);\n };\n\n // we should update this if https://github.com/omgovich/react-colorful/issues/157 is resolved\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value.replace(/([^0-9A-F]+)/gi, '').substring(0, 8);\n setValue(`#${inputValue}`); // always prefix input value with # to indicate hex format\n // only set color if input value is a valid hex color\n if (isValidHex(e.target.value)) {\n onChange && onChange(e.target.value);\n }\n };\n\n return (\n <Stack spacing={1}>\n <HexColorPicker color={color} onChange={handleColorChange} style={{ width: '100%' }} />\n <Stack direction=\"row\" flexWrap=\"wrap\" justifyContent=\"space-evenly\" width=\"200px\">\n {palette &&\n palette.map((color, i) => (\n <IconButton\n key={i}\n size=\"small\"\n aria-label={`change color to ${color}`}\n sx={{ color }}\n onClick={() => handleColorChange(color)}\n >\n <CircleIcon />\n </IconButton>\n ))}\n </Stack>\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n <TextField\n inputProps={{ 'aria-label': 'enter hex color' }}\n fullWidth\n value={value}\n onChange={handleInputChange}\n />\n {onClear && (\n <IconButton onClick={onClear}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n );\n};\n\nconst isValidHex = (value: string, alpha?: boolean): boolean => {\n const matcher = /^#?([0-9A-F]{3,8})$/i;\n const match = matcher.exec(value);\n const length = match && match[1] ? match[1].length : 0;\n return (\n length === 3 || // '#rgb' format\n length === 6 || // '#rrggbb' format\n (!!alpha && length === 4) || // '#rgba' format\n (!!alpha && length === 8) // '#rrggbbaa' format\n );\n};\n"],"names":["IconButton","Stack","TextField","React","useState","HexColorPicker","CircleIcon","DeleteIcon","ColorPicker","color","onChange","onClear","palette","value","setValue","handleColorChange","handleInputChange","e","inputValue","target","replace","substring","isValidHex","spacing","style","width","direction","flexWrap","justifyContent","map","i","size","aria-label","sx","onClick","gap","alignItems","inputProps","fullWidth","alpha","matcher","match","exec","length"],"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,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAC7D,OAAOC,SAASC,QAAQ,QAAQ,QAAQ;AACxC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAOC,gBAAgB,yBAAyB;AAChD,OAAOC,gBAAgB,yBAAyB;AAYhD,OAAO,MAAMC,cAAc,CAAC,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAoB;IACjF,2DAA2D;IAC3D,MAAM,CAACC,OAAOC,SAAS,GAAGV,SAASK;IAEnC,MAAMM,oBAAoB,CAACN;QACzBK,SAASL;QACTC,YAAYA,SAASD;IACvB;IAEA,6FAA6F;IAC7F,MAAMO,oBAAoB,CAACC;QACzB,MAAMC,aAAaD,EAAEE,MAAM,CAACN,KAAK,CAACO,OAAO,CAAC,kBAAkB,IAAIC,SAAS,CAAC,GAAG;QAC7EP,SAAS,CAAC,CAAC,EAAEI,WAAW,CAAC,GAAG,0DAA0D;QACtF,qDAAqD;QACrD,IAAII,WAAWL,EAAEE,MAAM,CAACN,KAAK,GAAG;YAC9BH,YAAYA,SAASO,EAAEE,MAAM,CAACN,KAAK;QACrC;IACF;IAEA,qBACE,MAACZ;QAAMsB,SAAS;;0BACd,KAAClB;gBAAeI,OAAOA;gBAAOC,UAAUK;gBAAmBS,OAAO;oBAAEC,OAAO;gBAAO;;0BAClF,KAACxB;gBAAMyB,WAAU;gBAAMC,UAAS;gBAAOC,gBAAe;gBAAeH,OAAM;0BACxEb,WACCA,QAAQiB,GAAG,CAAC,CAACpB,OAAOqB,kBAClB,KAAC9B;wBAEC+B,MAAK;wBACLC,cAAY,CAAC,gBAAgB,EAAEvB,MAAM,CAAC;wBACtCwB,IAAI;4BAAExB;wBAAM;wBACZyB,SAAS,IAAMnB,kBAAkBN;kCAEjC,cAAA,KAACH;uBANIwB;;0BAUb,MAAC7B;gBAAMyB,WAAU;gBAAMS,KAAK;gBAAGC,YAAW;;kCACxC,KAAClC;wBACCmC,YAAY;4BAAE,cAAc;wBAAkB;wBAC9CC,SAAS;wBACTzB,OAAOA;wBACPH,UAAUM;;oBAEXL,yBACC,KAACX;wBAAWkC,SAASvB;kCACnB,cAAA,KAACJ;;;;;;AAMb,EAAE;AAEF,MAAMe,aAAa,CAACT,OAAe0B;IACjC,MAAMC,UAAU;IAChB,MAAMC,QAAQD,QAAQE,IAAI,CAAC7B;IAC3B,MAAM8B,SAASF,SAASA,KAAK,CAAC,EAAE,GAAGA,KAAK,CAAC,EAAE,CAACE,MAAM,GAAG;IACrD,OACEA,WAAW,KAAK,gBAAgB;IAChCA,WAAW,KAAK,mBAAmB;IAClC,CAAC,CAACJ,SAASI,WAAW,KAAM,iBAAiB;IAC7C,CAAC,CAACJ,SAASI,WAAW,EAAG,qBAAqB;;AAEnD"}
1
+ {"version":3,"sources":["../../src/ColorPicker/ColorPicker.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 { IconButton, Stack, TextField } from '@mui/material';\nimport { ChangeEvent, ReactElement, useState } from 'react';\nimport { HexColorPicker } from 'react-colorful';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport DeleteIcon from 'mdi-material-ui/Delete';\n\ninterface ColorPickerProps {\n color: string;\n onChange?: (color: string) => void;\n onClear?: () => void;\n /**\n * Preset color palette\n */\n palette?: string[];\n}\n\nexport const ColorPicker = ({ color, onChange, onClear, palette }: ColorPickerProps): ReactElement => {\n // value is the visible value for the controlled text input\n const [value, setValue] = useState(color);\n\n const handleColorChange = (color: string): void => {\n setValue(color);\n onChange?.(color);\n };\n\n // we should update this if https://github.com/omgovich/react-colorful/issues/157 is resolved\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>): void => {\n const inputValue = e.target.value.replace(/([^0-9A-F]+)/gi, '').substring(0, 8);\n setValue(`#${inputValue}`); // always prefix input value with # to indicate hex format\n // only set color if input value is a valid hex color\n if (isValidHex(e.target.value)) {\n onChange?.(e.target.value);\n }\n };\n\n return (\n <Stack spacing={1}>\n <HexColorPicker color={color} onChange={handleColorChange} style={{ width: '100%' }} />\n <Stack direction=\"row\" flexWrap=\"wrap\" justifyContent=\"space-evenly\" width=\"200px\">\n {palette &&\n palette.map((color, i) => (\n <IconButton\n key={i}\n size=\"small\"\n aria-label={`change color to ${color}`}\n sx={{ color }}\n onClick={() => handleColorChange(color)}\n >\n <CircleIcon />\n </IconButton>\n ))}\n </Stack>\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n <TextField\n inputProps={{ 'aria-label': 'enter hex color' }}\n fullWidth\n value={value}\n onChange={handleInputChange}\n />\n {onClear && (\n <IconButton onClick={onClear}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n );\n};\n\nconst isValidHex = (value: string, alpha?: boolean): boolean => {\n const matcher = /^#?([0-9A-F]{3,8})$/i;\n const match = matcher.exec(value);\n const length = match && match[1] ? match[1].length : 0;\n return (\n length === 3 || // '#rgb' format\n length === 6 || // '#rrggbb' format\n (!!alpha && length === 4) || // '#rgba' format\n (!!alpha && length === 8) // '#rrggbbaa' format\n );\n};\n"],"names":["IconButton","Stack","TextField","useState","HexColorPicker","CircleIcon","DeleteIcon","ColorPicker","color","onChange","onClear","palette","value","setValue","handleColorChange","handleInputChange","e","inputValue","target","replace","substring","isValidHex","spacing","style","width","direction","flexWrap","justifyContent","map","i","size","aria-label","sx","onClick","gap","alignItems","inputProps","fullWidth","alpha","matcher","match","exec","length"],"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,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAC7D,SAAoCC,QAAQ,QAAQ,QAAQ;AAC5D,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAOC,gBAAgB,yBAAyB;AAChD,OAAOC,gBAAgB,yBAAyB;AAYhD,OAAO,MAAMC,cAAc,CAAC,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAoB;IACjF,2DAA2D;IAC3D,MAAM,CAACC,OAAOC,SAAS,GAAGV,SAASK;IAEnC,MAAMM,oBAAoB,CAACN;QACzBK,SAASL;QACTC,qBAAAA,+BAAAA,SAAWD;IACb;IAEA,6FAA6F;IAC7F,MAAMO,oBAAoB,CAACC;QACzB,MAAMC,aAAaD,EAAEE,MAAM,CAACN,KAAK,CAACO,OAAO,CAAC,kBAAkB,IAAIC,SAAS,CAAC,GAAG;QAC7EP,SAAS,CAAC,CAAC,EAAEI,WAAW,CAAC,GAAG,0DAA0D;QACtF,qDAAqD;QACrD,IAAII,WAAWL,EAAEE,MAAM,CAACN,KAAK,GAAG;YAC9BH,qBAAAA,+BAAAA,SAAWO,EAAEE,MAAM,CAACN,KAAK;QAC3B;IACF;IAEA,qBACE,MAACX;QAAMqB,SAAS;;0BACd,KAAClB;gBAAeI,OAAOA;gBAAOC,UAAUK;gBAAmBS,OAAO;oBAAEC,OAAO;gBAAO;;0BAClF,KAACvB;gBAAMwB,WAAU;gBAAMC,UAAS;gBAAOC,gBAAe;gBAAeH,OAAM;0BACxEb,WACCA,QAAQiB,GAAG,CAAC,CAACpB,OAAOqB,kBAClB,KAAC7B;wBAEC8B,MAAK;wBACLC,cAAY,CAAC,gBAAgB,EAAEvB,MAAM,CAAC;wBACtCwB,IAAI;4BAAExB;wBAAM;wBACZyB,SAAS,IAAMnB,kBAAkBN;kCAEjC,cAAA,KAACH;uBANIwB;;0BAUb,MAAC5B;gBAAMwB,WAAU;gBAAMS,KAAK;gBAAGC,YAAW;;kCACxC,KAACjC;wBACCkC,YAAY;4BAAE,cAAc;wBAAkB;wBAC9CC,SAAS;wBACTzB,OAAOA;wBACPH,UAAUM;;oBAEXL,yBACC,KAACV;wBAAWiC,SAASvB;kCACnB,cAAA,KAACJ;;;;;;AAMb,EAAE;AAEF,MAAMe,aAAa,CAACT,OAAe0B;IACjC,MAAMC,UAAU;IAChB,MAAMC,QAAQD,QAAQE,IAAI,CAAC7B;IAC3B,MAAM8B,SAASF,SAASA,KAAK,CAAC,EAAE,GAAGA,KAAK,CAAC,EAAE,CAACE,MAAM,GAAG;IACrD,OACEA,WAAW,KAAK,gBAAgB;IAChCA,WAAW,KAAK,mBAAmB;IAClC,CAAC,CAACJ,SAASI,WAAW,KAAM,iBAAiB;IAC7C,CAAC,CAACJ,SAASI,WAAW,EAAG,qBAAqB;;AAEnD"}
@@ -1,8 +1,9 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface OptionsColorPickerProps {
2
3
  label: string;
3
4
  color: string;
4
5
  onColorChange: (color: string) => void;
5
6
  onClear?: () => void;
6
7
  }
7
- export declare function OptionsColorPicker({ label, color, onColorChange, onClear }: OptionsColorPickerProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function OptionsColorPicker({ label, color, onColorChange, onClear }: OptionsColorPickerProps): ReactElement;
8
9
  //# sourceMappingURL=OptionsColorPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,uBAAuB,2CA8CnG"}
1
+ {"version":3,"file":"OptionsColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,uBAAuB,GAAG,YAAY,CA8ClH"}
@@ -11,13 +11,13 @@
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';
14
+ import { useState } from 'react';
15
15
  import { styled, IconButton, Popover } from '@mui/material';
16
16
  import CircleIcon from 'mdi-material-ui/Circle';
17
17
  import { useChartsTheme } from '../context';
18
18
  import { ColorPicker } from './ColorPicker';
19
19
  export function OptionsColorPicker({ label, color, onColorChange, onClear }) {
20
- const [anchorEl, setAnchorEl] = React.useState(null);
20
+ const [anchorEl, setAnchorEl] = useState(null);
21
21
  const isOpen = Boolean(anchorEl);
22
22
  const openColorPicker = (event)=>{
23
23
  setAnchorEl(event.currentTarget);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context';\nimport { ColorPicker } from './ColorPicker';\n\nexport interface OptionsColorPickerProps {\n label: string;\n color: string;\n onColorChange: (color: string) => void;\n onClear?: () => void;\n}\n\nexport function OptionsColorPicker({ label, color, onColorChange, onClear }: OptionsColorPickerProps) {\n const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = () => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size=\"small\"\n aria-label={`change ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"options color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n slotProps={{ paper: { sx: { padding: (theme) => theme.spacing(2) } } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} palette={[defaultColor, ...palette]} onChange={onColorChange} onClear={onClear} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["React","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","OptionsColorPicker","label","color","onColorChange","onClear","anchorEl","setAnchorEl","useState","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","size","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","slotProps","paper","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AAC5D,OAAOC,gBAAgB,yBAAyB;AAChD,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,WAAW,QAAQ,gBAAgB;AAS5C,OAAO,SAASC,mBAAmB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,aAAa,EAAEC,OAAO,EAA2B;IAClG,MAAM,CAACC,UAAUC,YAAY,GAAGb,MAAMc,QAAQ,CAA2B;IACzE,MAAMC,SAASC,QAAQJ;IAEvB,MAAMK,kBAAkB,CAACC;QACvBL,YAAYK,MAAMC,aAAa;IACjC;IAEA,MAAMC,mBAAmB;QACvBP,YAAY;IACd;IAEA,MAAM,EACJQ,YAAY,EAAEC,YAAY,EAAEC,OAAO,EAAE,EACtC,GAAGlB;IAEJ,qBACE;;0BACE,KAACmB;gBACCC,MAAK;gBACLC,cAAY,CAAC,OAAO,EAAElB,MAAM,MAAM,CAAC;gBACnCmB,YAAYZ;gBACZa,WAAWnB;gBACXoB,SAASZ;0BAET,cAAA,KAACb;;0BAEH,KAACD;gBACC2B,eAAY;gBACZC,MAAMhB;gBACNH,UAAUA;gBACVoB,SAASZ;gBACTa,WAAW;oBAAEC,OAAO;wBAAEC,IAAI;4BAAEC,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;oBAAE;gBAAE;gBACrEC,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;gBACAC,iBAAiB;oBACfF,UAAU;oBACVC,YAAY;gBACd;0BAEA,cAAA,KAACnC;oBAAYG,OAAOA;oBAAOc,SAAS;wBAACD;2BAAiBC;qBAAQ;oBAAEoB,UAAUjC;oBAAeC,SAASA;;;;;AAI1G;AAEA,MAAMa,kBAAkBvB,OAAOC,YAAY;IACzC0C,mBAAmB,CAACC,QAAUA,UAAU,gBAAgBA,UAAU;AACpE,GAGG,CAAC,EAAEjB,SAAS,EAAED,UAAU,EAAE,GAAM,CAAA;QACjCmB,iBAAiBnB,cAAcC,YAAY,CAAC,EAAEA,UAAU,EAAE,CAAC,GAAG;QAC9DnB,OAAOmB;IACT,CAAA"}
1
+ {"version":3,"sources":["../../src/ColorPicker/OptionsColorPicker.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, useState, MouseEvent } from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context';\nimport { ColorPicker } from './ColorPicker';\n\nexport interface OptionsColorPickerProps {\n label: string;\n color: string;\n onColorChange: (color: string) => void;\n onClear?: () => void;\n}\n\nexport function OptionsColorPicker({ label, color, onColorChange, onClear }: OptionsColorPickerProps): ReactElement {\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = (): void => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size=\"small\"\n aria-label={`change ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"options color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n slotProps={{ paper: { sx: { padding: (theme) => theme.spacing(2) } } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} palette={[defaultColor, ...palette]} onChange={onColorChange} onClear={onClear} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["useState","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","OptionsColorPicker","label","color","onColorChange","onClear","anchorEl","setAnchorEl","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","size","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","slotProps","paper","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAoB,QAAQ;AAC3D,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AAC5D,OAAOC,gBAAgB,yBAAyB;AAChD,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,WAAW,QAAQ,gBAAgB;AAS5C,OAAO,SAASC,mBAAmB,EAAEC,KAAK,EAAEC,KAAK,EAAEC,aAAa,EAAEC,OAAO,EAA2B;IAClG,MAAM,CAACC,UAAUC,YAAY,GAAGb,SAAmC;IACnE,MAAMc,SAASC,QAAQH;IAEvB,MAAMI,kBAAkB,CAACC;QACvBJ,YAAYI,MAAMC,aAAa;IACjC;IAEA,MAAMC,mBAAmB;QACvBN,YAAY;IACd;IAEA,MAAM,EACJO,YAAY,EAAEC,YAAY,EAAEC,OAAO,EAAE,EACtC,GAAGjB;IAEJ,qBACE;;0BACE,KAACkB;gBACCC,MAAK;gBACLC,cAAY,CAAC,OAAO,EAAEjB,MAAM,MAAM,CAAC;gBACnCkB,YAAYZ;gBACZa,WAAWlB;gBACXmB,SAASZ;0BAET,cAAA,KAACZ;;0BAEH,KAACD;gBACC0B,eAAY;gBACZC,MAAMhB;gBACNF,UAAUA;gBACVmB,SAASZ;gBACTa,WAAW;oBAAEC,OAAO;wBAAEC,IAAI;4BAAEC,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;oBAAE;gBAAE;gBACrEC,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;gBACAC,iBAAiB;oBACfF,UAAU;oBACVC,YAAY;gBACd;0BAEA,cAAA,KAAClC;oBAAYG,OAAOA;oBAAOa,SAAS;wBAACD;2BAAiBC;qBAAQ;oBAAEoB,UAAUhC;oBAAeC,SAASA;;;;;AAI1G;AAEA,MAAMY,kBAAkBtB,OAAOC,YAAY;IACzCyC,mBAAmB,CAACC,QAAUA,UAAU,gBAAgBA,UAAU;AACpE,GAGG,CAAC,EAAEjB,SAAS,EAAED,UAAU,EAAE,GAAM,CAAA;QACjCmB,iBAAiBnB,cAAcC,YAAY,CAAC,EAAEA,UAAU,EAAE,CAAC,GAAG;QAC9DlB,OAAOkB;IACT,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  import { ContentWithLegendProps } from './model/content-with-legend-model';
2
3
  /**
3
4
  * Component to help lay out content alongside a `Legend` component based on the
@@ -6,5 +7,5 @@ import { ContentWithLegendProps } from './model/content-with-legend-model';
6
7
  * See the documentation for the `Legend` component for more details about the
7
8
  * features and configuration of the legend.
8
9
  */
9
- export declare function ContentWithLegend({ children, legendProps, width, height, spacing, legendSize, minChildrenWidth, minChildrenHeight, }: ContentWithLegendProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function ContentWithLegend({ children, legendProps, width, height, spacing, legendSize, minChildrenWidth, minChildrenHeight, }: ContentWithLegendProps): ReactElement;
10
11
  //# sourceMappingURL=ContentWithLegend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContentWithLegend.d.ts","sourceRoot":"","sources":["../../src/ContentWithLegend/ContentWithLegend.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,sBAAsB,EAA8B,MAAM,mCAAmC,CAAC;AAEvG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,WAAW,EACX,KAAK,EACL,MAAM,EACN,OAAW,EACX,UAAU,EACV,gBAAsB,EACtB,iBAAuB,GACxB,EAAE,sBAAsB,2CAoCxB"}
1
+ {"version":3,"file":"ContentWithLegend.d.ts","sourceRoot":"","sources":["../../src/ContentWithLegend/ContentWithLegend.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,OAAO,EAAE,sBAAsB,EAA8B,MAAM,mCAAmC,CAAC;AAEvG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,WAAW,EACX,KAAK,EACL,MAAM,EACN,OAAW,EACX,UAAU,EACV,gBAAsB,EACtB,iBAAuB,GACxB,EAAE,sBAAsB,GAAG,YAAY,CAwCvC"}
@@ -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 } from "react/jsx-runtime";
14
- import React from 'react';
15
14
  import { Box, useTheme } from '@mui/material';
16
15
  import { getLegendSize } from '@perses-dev/core';
17
16
  import { Legend } from '../Legend';
@@ -35,17 +34,21 @@ import { getContentWithLegendLayout } from './model/content-with-legend-model';
35
34
  legendSize: getLegendSize(legendSize)
36
35
  });
37
36
  return /*#__PURE__*/ _jsxs(Box, {
38
- sx: {
37
+ style: {
39
38
  width,
40
- height,
39
+ height
40
+ },
41
+ sx: {
41
42
  position: 'relative',
42
43
  overflow: 'hidden'
43
44
  },
44
45
  children: [
45
46
  /*#__PURE__*/ _jsx(Box, {
46
- sx: {
47
+ style: {
47
48
  width: content.width,
48
- height: content.height,
49
+ height: content.height
50
+ },
51
+ sx: {
49
52
  marginRight: `${margin.right}px`,
50
53
  marginBottom: `${margin.bottom}px`,
51
54
  overflow: 'hidden'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ContentWithLegend/ContentWithLegend.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, useTheme } from '@mui/material';\nimport { getLegendSize } from '@perses-dev/core';\nimport { Legend } from '../Legend';\nimport { ContentWithLegendProps, getContentWithLegendLayout } from './model/content-with-legend-model';\n\n/**\n * Component to help lay out content alongside a `Legend` component based on the\n * configuration of the legend.\n *\n * See the documentation for the `Legend` component for more details about the\n * features and configuration of the legend.\n */\nexport function ContentWithLegend({\n children,\n legendProps,\n width,\n height,\n spacing = 0,\n legendSize,\n minChildrenWidth = 100,\n minChildrenHeight = 100,\n}: ContentWithLegendProps) {\n const theme = useTheme();\n const { content, legend, margin } = getContentWithLegendLayout({\n width,\n height,\n legendProps,\n minChildrenHeight,\n minChildrenWidth,\n spacing,\n theme,\n legendSize: getLegendSize(legendSize),\n });\n\n return (\n <Box\n sx={{\n width,\n height,\n position: 'relative',\n overflow: 'hidden',\n }}\n >\n <Box\n sx={{\n width: content.width,\n height: content.height,\n marginRight: `${margin.right}px`,\n marginBottom: `${margin.bottom}px`,\n overflow: 'hidden',\n }}\n >\n {typeof children === 'function' ? children({ width: content.width, height: content.height }) : children}\n </Box>\n {legendProps && legend.show && <Legend {...legendProps} height={legend.height} width={legend.width} />}\n </Box>\n );\n}\n"],"names":["React","Box","useTheme","getLegendSize","Legend","getContentWithLegendLayout","ContentWithLegend","children","legendProps","width","height","spacing","legendSize","minChildrenWidth","minChildrenHeight","theme","content","legend","margin","sx","position","overflow","marginRight","right","marginBottom","bottom","show"],"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,EAAEC,QAAQ,QAAQ,gBAAgB;AAC9C,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,MAAM,QAAQ,YAAY;AACnC,SAAiCC,0BAA0B,QAAQ,oCAAoC;AAEvG;;;;;;CAMC,GACD,OAAO,SAASC,kBAAkB,EAChCC,QAAQ,EACRC,WAAW,EACXC,KAAK,EACLC,MAAM,EACNC,UAAU,CAAC,EACXC,UAAU,EACVC,mBAAmB,GAAG,EACtBC,oBAAoB,GAAG,EACA;IACvB,MAAMC,QAAQb;IACd,MAAM,EAAEc,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGb,2BAA2B;QAC7DI;QACAC;QACAF;QACAM;QACAD;QACAF;QACAI;QACAH,YAAYT,cAAcS;IAC5B;IAEA,qBACE,MAACX;QACCkB,IAAI;YACFV;YACAC;YACAU,UAAU;YACVC,UAAU;QACZ;;0BAEA,KAACpB;gBACCkB,IAAI;oBACFV,OAAOO,QAAQP,KAAK;oBACpBC,QAAQM,QAAQN,MAAM;oBACtBY,aAAa,CAAC,EAAEJ,OAAOK,KAAK,CAAC,EAAE,CAAC;oBAChCC,cAAc,CAAC,EAAEN,OAAOO,MAAM,CAAC,EAAE,CAAC;oBAClCJ,UAAU;gBACZ;0BAEC,OAAOd,aAAa,aAAaA,SAAS;oBAAEE,OAAOO,QAAQP,KAAK;oBAAEC,QAAQM,QAAQN,MAAM;gBAAC,KAAKH;;YAEhGC,eAAeS,OAAOS,IAAI,kBAAI,KAACtB;gBAAQ,GAAGI,WAAW;gBAAEE,QAAQO,OAAOP,MAAM;gBAAED,OAAOQ,OAAOR,KAAK;;;;AAGxG"}
1
+ {"version":3,"sources":["../../src/ContentWithLegend/ContentWithLegend.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 } from 'react';\nimport { Box, useTheme } from '@mui/material';\nimport { getLegendSize } from '@perses-dev/core';\nimport { Legend } from '../Legend';\nimport { ContentWithLegendProps, getContentWithLegendLayout } from './model/content-with-legend-model';\n\n/**\n * Component to help lay out content alongside a `Legend` component based on the\n * configuration of the legend.\n *\n * See the documentation for the `Legend` component for more details about the\n * features and configuration of the legend.\n */\nexport function ContentWithLegend({\n children,\n legendProps,\n width,\n height,\n spacing = 0,\n legendSize,\n minChildrenWidth = 100,\n minChildrenHeight = 100,\n}: ContentWithLegendProps): ReactElement {\n const theme = useTheme();\n const { content, legend, margin } = getContentWithLegendLayout({\n width,\n height,\n legendProps,\n minChildrenHeight,\n minChildrenWidth,\n spacing,\n theme,\n legendSize: getLegendSize(legendSize),\n });\n\n return (\n <Box\n style={{\n width,\n height,\n }}\n sx={{\n position: 'relative',\n overflow: 'hidden',\n }}\n >\n <Box\n style={{\n width: content.width,\n height: content.height,\n }}\n sx={{\n marginRight: `${margin.right}px`,\n marginBottom: `${margin.bottom}px`,\n overflow: 'hidden',\n }}\n >\n {typeof children === 'function' ? children({ width: content.width, height: content.height }) : children}\n </Box>\n {legendProps && legend.show && <Legend {...legendProps} height={legend.height} width={legend.width} />}\n </Box>\n );\n}\n"],"names":["Box","useTheme","getLegendSize","Legend","getContentWithLegendLayout","ContentWithLegend","children","legendProps","width","height","spacing","legendSize","minChildrenWidth","minChildrenHeight","theme","content","legend","margin","style","sx","position","overflow","marginRight","right","marginBottom","bottom","show"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAC9C,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,MAAM,QAAQ,YAAY;AACnC,SAAiCC,0BAA0B,QAAQ,oCAAoC;AAEvG;;;;;;CAMC,GACD,OAAO,SAASC,kBAAkB,EAChCC,QAAQ,EACRC,WAAW,EACXC,KAAK,EACLC,MAAM,EACNC,UAAU,CAAC,EACXC,UAAU,EACVC,mBAAmB,GAAG,EACtBC,oBAAoB,GAAG,EACA;IACvB,MAAMC,QAAQb;IACd,MAAM,EAAEc,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGb,2BAA2B;QAC7DI;QACAC;QACAF;QACAM;QACAD;QACAF;QACAI;QACAH,YAAYT,cAAcS;IAC5B;IAEA,qBACE,MAACX;QACCkB,OAAO;YACLV;YACAC;QACF;QACAU,IAAI;YACFC,UAAU;YACVC,UAAU;QACZ;;0BAEA,KAACrB;gBACCkB,OAAO;oBACLV,OAAOO,QAAQP,KAAK;oBACpBC,QAAQM,QAAQN,MAAM;gBACxB;gBACAU,IAAI;oBACFG,aAAa,CAAC,EAAEL,OAAOM,KAAK,CAAC,EAAE,CAAC;oBAChCC,cAAc,CAAC,EAAEP,OAAOQ,MAAM,CAAC,EAAE,CAAC;oBAClCJ,UAAU;gBACZ;0BAEC,OAAOf,aAAa,aAAaA,SAAS;oBAAEE,OAAOO,QAAQP,KAAK;oBAAEC,QAAQM,QAAQN,MAAM;gBAAC,KAAKH;;YAEhGC,eAAeS,OAAOU,IAAI,kBAAI,KAACvB;gBAAQ,GAAGI,WAAW;gBAAEE,QAAQO,OAAOP,MAAM;gBAAED,OAAOQ,OAAOR,KAAK;;;;AAGxG"}
@@ -1,7 +1,8 @@
1
+ import { ReactElement } from 'react';
1
2
  export type DensityOption = 'compact' | 'standard' | 'comfortable';
2
3
  export interface DensitySelectorProps {
3
4
  onChange: (density: DensityOption) => void;
4
5
  value?: DensityOption;
5
6
  }
6
- export declare function DensitySelector({ onChange, value }: DensitySelectorProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function DensitySelector({ onChange, value }: DensitySelectorProps): ReactElement;
7
8
  //# sourceMappingURL=DensitySelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DensitySelector.d.ts","sourceRoot":"","sources":["../../src/DensitySelector/DensitySelector.tsx"],"names":[],"mappings":"AAsBA,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,2CAmBrF"}
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"}
@@ -1 +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 { 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) {\n const handleSortChange = (_: unknown, { id }: { id: DensityOption }) => {\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;;AAEjC,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"}
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"}
@@ -1,20 +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
10
  export type DialogContentProps = MuiDialogContentProps;
11
11
  export declare const Dialog: {
12
- ({ children, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
13
- Header: ({ children, onClose, ...props }: DialogHeaderProps) => import("react/jsx-runtime").JSX.Element;
14
- Form: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
15
- Content: ({ children, sx, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
16
- PrimaryButton: ({ children, ...props }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element;
17
- 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;
18
18
  Actions: typeof DialogActions;
19
19
  };
20
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,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAuDvD,eAAO,MAAM,MAAM;6BAA4B,WAAW;8CArDT,iBAAiB;;0CAerB,kBAAkB;4CAMhB,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';
@@ -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 type DialogContentProps = MuiDialogContentProps;\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\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) => (\n <DialogContent dividers {...props} sx={combineSx({ minWidth: `500px`, textWrap: 'balance' }, 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","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;;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;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,iBAAK,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OAAsB;AAE5GV,OAAOS,MAAM,GAAGA;AAChBT,OAAO6B,IAAI,GAAGA;AACd7B,OAAOoB,OAAO,GAAGA;AACjBpB,OAAOwB,aAAa,GAAGA;AACvBxB,OAAO2B,eAAe,GAAGA;AACzB3B,OAAOsC,OAAO,GAAGpC"}
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"}