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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (411) hide show
  1. package/dist/cjs/components/AddGroupButton/AddGroupButton.js +1 -1
  2. package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
  3. package/dist/cjs/components/Dashboard/Dashboard.js +9 -2
  4. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
  5. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +6 -6
  6. package/dist/cjs/components/Datasources/DatasourceEditor.js +19 -20
  7. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +11 -8
  8. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
  9. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
  10. package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
  11. package/dist/cjs/components/DownloadButton/DownloadButton.js +3 -4
  12. package/dist/cjs/components/EditButton/EditButton.js +1 -1
  13. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +3 -4
  14. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +21 -17
  15. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +5 -5
  16. package/dist/cjs/components/GridLayout/GridContainer.js +16 -11
  17. package/dist/cjs/components/GridLayout/GridItemContent.js +24 -10
  18. package/dist/cjs/components/GridLayout/GridLayout.js +63 -14
  19. package/dist/cjs/components/GridLayout/GridTitle.js +8 -9
  20. package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
  21. package/dist/cjs/components/Panel/Panel.js +15 -11
  22. package/dist/cjs/components/Panel/PanelActions.js +216 -0
  23. package/dist/cjs/components/Panel/PanelContent.js +6 -6
  24. package/dist/cjs/components/Panel/PanelHeader.js +36 -103
  25. package/dist/cjs/components/Panel/PanelLinks.js +136 -0
  26. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  27. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -62
  28. package/dist/cjs/components/PanelDrawer/PanelPreview.js +9 -6
  29. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
  30. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  31. package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  32. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
  33. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +7 -9
  34. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
  35. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +8 -14
  36. package/dist/cjs/components/Variables/EditVariablesButton.js +5 -5
  37. package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +48 -56
  38. package/dist/cjs/components/Variables/VariableEditor.js +39 -46
  39. package/dist/cjs/components/Variables/VariableList.js +23 -22
  40. package/dist/cjs/components/Variables/index.js +2 -2
  41. package/dist/cjs/components/index.js +0 -2
  42. package/dist/cjs/constants/styles.js +17 -9
  43. package/dist/cjs/constants/user-interface-text.js +6 -5
  44. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +24 -17
  45. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
  46. package/dist/cjs/context/DashboardProvider/common.js +5 -5
  47. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +51 -43
  48. package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  49. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +4 -5
  50. package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  51. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +11 -16
  52. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  53. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +13 -8
  54. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
  55. package/dist/cjs/context/DatasourceStoreProvider.js +32 -31
  56. package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +128 -131
  57. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
  58. package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
  59. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +8 -8
  60. package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +6 -6
  61. package/dist/cjs/context/index.js +2 -2
  62. package/dist/cjs/context/useDashboard.js +24 -9
  63. package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
  64. package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
  65. package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  66. package/dist/cjs/stories/decorators/index.js +2 -2
  67. package/dist/cjs/test/dashboard-provider.js +3 -3
  68. package/dist/cjs/test/datasource-provider.js +4 -4
  69. package/dist/cjs/test/plugin-registry.js +4 -2
  70. package/dist/cjs/test/render.js +14 -12
  71. package/dist/cjs/utils/index.js +0 -1
  72. package/dist/cjs/utils/panelUtils.js +5 -5
  73. package/dist/cjs/views/ViewDashboard/DashboardApp.js +8 -8
  74. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +10 -11
  75. package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -2
  76. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  77. package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
  78. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  79. package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -2
  80. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
  81. package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
  82. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  83. package/dist/components/Dashboard/Dashboard.d.ts +3 -3
  84. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  85. package/dist/components/Dashboard/Dashboard.js +9 -2
  86. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  87. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -2
  88. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  89. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
  90. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  91. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  92. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  93. package/dist/components/DashboardToolbar/DashboardToolbar.js +5 -5
  94. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  95. package/dist/components/Datasources/DatasourceEditor.d.ts +2 -2
  96. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  97. package/dist/components/Datasources/DatasourceEditor.js +20 -21
  98. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  99. package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -2
  100. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  101. package/dist/components/Datasources/EditDatasourcesButton.js +11 -8
  102. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  103. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -2
  104. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  105. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
  106. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  107. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -2
  108. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  109. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
  110. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  111. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -2
  112. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  113. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
  114. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  115. package/dist/components/DownloadButton/DownloadButton.d.ts +2 -2
  116. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  117. package/dist/components/DownloadButton/DownloadButton.js +3 -4
  118. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  119. package/dist/components/EditButton/EditButton.d.ts +2 -2
  120. package/dist/components/EditButton/EditButton.d.ts.map +1 -1
  121. package/dist/components/EditButton/EditButton.js +1 -1
  122. package/dist/components/EditButton/EditButton.js.map +1 -1
  123. package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -2
  124. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  125. package/dist/components/EditJsonButton/EditJsonButton.js +3 -4
  126. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  127. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -2
  128. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  129. package/dist/components/EditJsonDialog/EditJsonDialog.js +21 -17
  130. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  131. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
  132. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
  133. package/dist/components/EmptyDashboard/EmptyDashboard.js +5 -5
  134. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  135. package/dist/components/GridLayout/GridContainer.d.ts +5 -3
  136. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  137. package/dist/components/GridLayout/GridContainer.js +16 -11
  138. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  139. package/dist/components/GridLayout/GridItemContent.d.ts +2 -2
  140. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  141. package/dist/components/GridLayout/GridItemContent.js +25 -11
  142. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  143. package/dist/components/GridLayout/GridLayout.d.ts +4 -3
  144. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  145. package/dist/components/GridLayout/GridLayout.js +65 -16
  146. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  147. package/dist/components/GridLayout/GridTitle.d.ts +3 -3
  148. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  149. package/dist/components/GridLayout/GridTitle.js +8 -9
  150. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  151. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  152. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  153. package/dist/components/{TimeRangeControls/index.js → Panel/HeaderIconButton.js} +7 -3
  154. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  155. package/dist/components/Panel/Panel.d.ts +13 -7
  156. package/dist/components/Panel/Panel.d.ts.map +1 -1
  157. package/dist/components/Panel/Panel.js +16 -12
  158. package/dist/components/Panel/Panel.js.map +1 -1
  159. package/dist/components/Panel/PanelActions.d.ts +16 -0
  160. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  161. package/dist/components/Panel/PanelActions.js +203 -0
  162. package/dist/components/Panel/PanelActions.js.map +1 -0
  163. package/dist/components/Panel/PanelContent.d.ts +2 -2
  164. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  165. package/dist/components/Panel/PanelContent.js +6 -6
  166. package/dist/components/Panel/PanelContent.js.map +1 -1
  167. package/dist/components/Panel/PanelHeader.d.ts +9 -9
  168. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  169. package/dist/components/Panel/PanelHeader.js +39 -106
  170. package/dist/components/Panel/PanelHeader.js.map +1 -1
  171. package/dist/components/Panel/PanelLinks.d.ts +6 -0
  172. package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
  173. package/dist/components/Panel/PanelLinks.js +123 -0
  174. package/dist/components/Panel/PanelLinks.js.map +1 -0
  175. package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -2
  176. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  177. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  178. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  179. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -4
  180. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  181. package/dist/components/PanelDrawer/PanelEditorForm.js +70 -65
  182. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  183. package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -3
  184. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  185. package/dist/components/PanelDrawer/PanelPreview.js +9 -6
  186. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  187. package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
  188. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
  189. package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
  190. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  191. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -2
  192. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  193. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  194. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  195. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -2
  196. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
  197. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
  198. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  199. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -2
  200. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
  201. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
  202. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  203. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -2
  204. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  205. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +8 -10
  206. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  207. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -2
  208. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  209. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +9 -9
  210. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  211. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +3 -3
  212. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
  213. package/dist/components/Variables/BuiltinVariableAccordions.js +8 -14
  214. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  215. package/dist/components/Variables/EditVariablesButton.d.ts +2 -2
  216. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  217. package/dist/components/Variables/EditVariablesButton.js +6 -6
  218. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  219. package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -6
  220. package/dist/components/Variables/Variable.d.ts.map +1 -0
  221. package/dist/components/Variables/{TemplateVariable.js → Variable.js} +49 -57
  222. package/dist/components/Variables/Variable.js.map +1 -0
  223. package/dist/components/Variables/VariableEditor.d.ts +3 -3
  224. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  225. package/dist/components/Variables/VariableEditor.js +40 -47
  226. package/dist/components/Variables/VariableEditor.js.map +1 -1
  227. package/dist/components/Variables/VariableList.d.ts +4 -4
  228. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  229. package/dist/components/Variables/VariableList.js +21 -20
  230. package/dist/components/Variables/VariableList.js.map +1 -1
  231. package/dist/components/Variables/index.d.ts +1 -1
  232. package/dist/components/Variables/index.d.ts.map +1 -1
  233. package/dist/components/Variables/index.js +2 -2
  234. package/dist/components/Variables/index.js.map +1 -1
  235. package/dist/components/index.d.ts +0 -2
  236. package/dist/components/index.d.ts.map +1 -1
  237. package/dist/components/index.js +0 -2
  238. package/dist/components/index.js.map +1 -1
  239. package/dist/constants/styles.d.ts +4 -2
  240. package/dist/constants/styles.d.ts.map +1 -1
  241. package/dist/constants/styles.js +5 -3
  242. package/dist/constants/styles.js.map +1 -1
  243. package/dist/constants/user-interface-text.d.ts +3 -2
  244. package/dist/constants/user-interface-text.d.ts.map +1 -1
  245. package/dist/constants/user-interface-text.js +3 -2
  246. package/dist/constants/user-interface-text.js.map +1 -1
  247. package/dist/context/DashboardProvider/DashboardProvider.d.ts +11 -6
  248. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  249. package/dist/context/DashboardProvider/DashboardProvider.js +22 -15
  250. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  251. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
  252. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
  253. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
  254. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
  255. package/dist/context/DashboardProvider/common.d.ts +3 -3
  256. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  257. package/dist/context/DashboardProvider/common.js +2 -2
  258. package/dist/context/DashboardProvider/common.js.map +1 -1
  259. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +36 -23
  260. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  261. package/dist/context/DashboardProvider/dashboard-provider-api.js +26 -19
  262. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  263. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
  264. package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
  265. package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
  266. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  267. package/dist/context/DashboardProvider/delete-panel-slice.js +4 -5
  268. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  269. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  270. package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
  271. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  272. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  273. package/dist/context/DashboardProvider/index.d.ts +1 -2
  274. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  275. package/dist/context/DashboardProvider/index.js.map +1 -1
  276. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
  277. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  278. package/dist/context/DashboardProvider/panel-editor-slice.js +8 -13
  279. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  280. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
  281. package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
  282. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  283. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  284. package/dist/context/DashboardProvider/panel-group-slice.d.ts +3 -3
  285. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  286. package/dist/context/DashboardProvider/panel-group-slice.js +8 -4
  287. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  288. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  289. package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
  290. package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
  291. package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
  292. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
  293. package/dist/context/DatasourceStoreProvider.d.ts +10 -10
  294. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  295. package/dist/context/DatasourceStoreProvider.js +32 -31
  296. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  297. package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
  298. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
  299. package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +117 -116
  300. package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
  301. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
  302. package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
  303. package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
  304. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
  305. package/dist/context/VariableProvider/index.d.ts +2 -0
  306. package/dist/context/VariableProvider/index.d.ts.map +1 -0
  307. package/dist/{validation → context/VariableProvider}/index.js +2 -2
  308. package/dist/context/VariableProvider/index.js.map +1 -0
  309. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
  310. package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
  311. package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
  312. package/dist/context/VariableProvider/query-params.js.map +1 -0
  313. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
  314. package/dist/context/VariableProvider/utils.d.ts.map +1 -0
  315. package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
  316. package/dist/context/VariableProvider/utils.js.map +1 -0
  317. package/dist/context/index.d.ts +1 -1
  318. package/dist/context/index.d.ts.map +1 -1
  319. package/dist/context/index.js +2 -2
  320. package/dist/context/index.js.map +1 -1
  321. package/dist/context/useDashboard.d.ts +3 -3
  322. package/dist/context/useDashboard.d.ts.map +1 -1
  323. package/dist/context/useDashboard.js +24 -9
  324. package/dist/context/useDashboard.js.map +1 -1
  325. package/dist/stories/decorators/WithDashboard.js +1 -1
  326. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  327. package/dist/stories/decorators/WithDatasourceStore.js +1 -1
  328. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  329. package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
  330. package/dist/stories/decorators/WithVariables.js.map +1 -0
  331. package/dist/stories/decorators/index.js +2 -2
  332. package/dist/stories/decorators/index.js.map +1 -1
  333. package/dist/test/dashboard-provider.d.ts +1 -1
  334. package/dist/test/dashboard-provider.d.ts.map +1 -1
  335. package/dist/test/dashboard-provider.js.map +1 -1
  336. package/dist/test/datasource-provider.d.ts +2 -2
  337. package/dist/test/datasource-provider.d.ts.map +1 -1
  338. package/dist/test/datasource-provider.js.map +1 -1
  339. package/dist/test/plugin-registry.d.ts.map +1 -1
  340. package/dist/test/plugin-registry.js +4 -2
  341. package/dist/test/plugin-registry.js.map +1 -1
  342. package/dist/test/render.d.ts +2 -2
  343. package/dist/test/render.d.ts.map +1 -1
  344. package/dist/test/render.js +10 -8
  345. package/dist/test/render.js.map +1 -1
  346. package/dist/test/setup-tests.js.map +1 -1
  347. package/dist/utils/index.d.ts +0 -1
  348. package/dist/utils/index.d.ts.map +1 -1
  349. package/dist/utils/index.js +0 -1
  350. package/dist/utils/index.js.map +1 -1
  351. package/dist/utils/panelUtils.d.ts +1 -1
  352. package/dist/utils/panelUtils.d.ts.map +1 -1
  353. package/dist/utils/panelUtils.js +2 -2
  354. package/dist/utils/panelUtils.js.map +1 -1
  355. package/dist/views/ViewDashboard/DashboardApp.d.ts +4 -4
  356. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  357. package/dist/views/ViewDashboard/DashboardApp.js +8 -8
  358. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  359. package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -4
  360. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  361. package/dist/views/ViewDashboard/ViewDashboard.js +11 -12
  362. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  363. package/package.json +9 -9
  364. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -210
  365. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  366. package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +0 -40
  367. package/dist/cjs/components/ToolbarIconButton/index.js +0 -30
  368. package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
  369. package/dist/cjs/utils/time.js +0 -29
  370. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +0 -14
  371. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +0 -1
  372. package/dist/components/TimeRangeControls/TimeRangeControls.js +0 -186
  373. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
  374. package/dist/components/TimeRangeControls/index.d.ts +0 -2
  375. package/dist/components/TimeRangeControls/index.d.ts.map +0 -1
  376. package/dist/components/TimeRangeControls/index.js.map +0 -1
  377. package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +0 -6
  378. package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +0 -1
  379. package/dist/components/ToolbarIconButton/ToolbarIconButton.js +0 -32
  380. package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +0 -1
  381. package/dist/components/ToolbarIconButton/index.d.ts +0 -2
  382. package/dist/components/ToolbarIconButton/index.d.ts.map +0 -1
  383. package/dist/components/ToolbarIconButton/index.js +0 -15
  384. package/dist/components/ToolbarIconButton/index.js.map +0 -1
  385. package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
  386. package/dist/components/Variables/TemplateVariable.js.map +0 -1
  387. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
  388. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
  389. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
  390. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
  391. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
  392. package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
  393. package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
  394. package/dist/context/TemplateVariableProvider/index.js +0 -15
  395. package/dist/context/TemplateVariableProvider/index.js.map +0 -1
  396. package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
  397. package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
  398. package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
  399. package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
  400. package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
  401. package/dist/utils/time.d.ts +0 -5
  402. package/dist/utils/time.d.ts.map +0 -1
  403. package/dist/utils/time.js +0 -23
  404. package/dist/utils/time.js.map +0 -1
  405. package/dist/validation/index.d.ts +0 -2
  406. package/dist/validation/index.d.ts.map +0 -1
  407. package/dist/validation/index.js.map +0 -1
  408. package/dist/validation/panel.d.ts +0 -19
  409. package/dist/validation/panel.d.ts.map +0 -1
  410. package/dist/validation/panel.js +0 -21
  411. package/dist/validation/panel.js.map +0 -1
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  interface DownloadButtonProps {
3
3
  heightPx?: number;
4
4
  }
5
- export declare function DownloadButton({ heightPx }: DownloadButtonProps): JSX.Element;
5
+ export declare function DownloadButton({ heightPx }: DownloadButtonProps): ReactElement;
6
6
  export {};
7
7
  //# sourceMappingURL=DownloadButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":";AAoBA,UAAU,mBAAmB;IAE3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,eAiC/D"}
1
+ {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAU,MAAM,OAAO,CAAC;AAM7C,UAAU,mBAAmB;IAE3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,YAAY,CAiC9E"}
@@ -13,13 +13,12 @@
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { useRef } from 'react';
15
15
  import DownloadIcon from 'mdi-material-ui/DownloadOutline';
16
- import { InfoTooltip } from '@perses-dev/components';
16
+ import { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';
17
17
  import { TOOLTIP_TEXT } from '../../constants';
18
18
  import { useDashboard } from '../../context';
19
- import { ToolbarIconButton } from '../ToolbarIconButton';
20
19
  // Button that enables downloading the dashboard as a JSON file
21
- export function DownloadButton({ heightPx }) {
22
- const { dashboard } = useDashboard();
20
+ export function DownloadButton({ heightPx }) {
21
+ const { dashboard } = useDashboard();
23
22
  const hiddenLinkRef = useRef(null);
24
23
  const height = heightPx === undefined ? undefined : `${heightPx}px`;
25
24
  const onDownloadButtonClick = ()=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.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 { useRef } from 'react';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\n\ninterface DownloadButtonProps {\n // The button look best at heights >= 28 pixels\n heightPx?: number;\n}\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton({ heightPx }: DownloadButtonProps) {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const height = heightPx === undefined ? undefined : `${heightPx}px`;\n\n const onDownloadButtonClick = () => {\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(\n new Blob([JSON.stringify(dashboard)], {\n type: 'application/json',\n })\n );\n // Simulate click\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.downloadDashboard}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.downloadDashboard} onClick={onDownloadButtonClick} sx={{ height }}>\n <DownloadIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n {/* Hidden link to download the dashboard as a JSON file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} download={`${dashboard.metadata.name}.json`} />\n </>\n );\n}\n"],"names":["useRef","DownloadIcon","InfoTooltip","TOOLTIP_TEXT","useDashboard","ToolbarIconButton","DownloadButton","heightPx","dashboard","hiddenLinkRef","height","undefined","onDownloadButtonClick","current","hiddenLinkUrl","URL","createObjectURL","Blob","JSON","stringify","type","href","click","revokeObjectURL","description","downloadDashboard","aria-label","onClick","sx","a","ref","style","display","download","metadata","name"],"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,QAAQ;AAC/B,OAAOC,kBAAkB,kCAAkC;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,uBAAuB;AAOzD,+DAA+D;AAC/D,OAAO,SAASC,eAAe,EAAEC,SAAQ,EAAuB;IAC9D,MAAM,EAAEC,UAAS,EAAE,GAAGJ;IACtB,MAAMK,gBAAgBT,OAA0B;IAChD,MAAMU,SAASH,aAAaI,YAAYA,YAAY,CAAC,EAAEJ,SAAS,EAAE,CAAC;IAEnE,MAAMK,wBAAwB;QAC5B,IAAI,CAACH,iBAAiB,CAACA,cAAcI,SAAS;QAC9C,kBAAkB;QAClB,MAAMC,gBAAgBC,IAAIC,gBACxB,IAAIC,KAAK;YAACC,KAAKC,UAAUX;SAAW,EAAE;YACpCY,MAAM;QACR;QAEF,iBAAiB;QACjBX,cAAcI,QAAQQ,OAAOP;QAC7BL,cAAcI,QAAQS;QACtB,0CAA0C;QAC1CP,IAAIQ,gBAAgBT;IACtB;IAEA,qBACE;;0BACE,KAACZ;gBAAYsB,aAAarB,aAAasB;0BACrC,cAAA,KAACpB;oBAAkBqB,cAAYvB,aAAasB;oBAAmBE,SAASf;oBAAuBgB,IAAI;wBAAElB;oBAAO;8BAC1G,cAAA,KAACT;;;0BAML,KAAC4B;gBAAEC,KAAKrB;gBAAesB,OAAO;oBAAEC,SAAS;gBAAO;gBAAGC,UAAU,CAAC,EAAEzB,UAAU0B,SAASC,KAAK,KAAK,CAAC;;;;AAGpG"}
1
+ {"version":3,"sources":["../../../src/components/DownloadButton/DownloadButton.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, useRef } from 'react';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useDashboard } from '../../context';\n\ninterface DownloadButtonProps {\n // The button look best at heights >= 28 pixels\n heightPx?: number;\n}\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton({ heightPx }: DownloadButtonProps): ReactElement {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const height = heightPx === undefined ? undefined : `${heightPx}px`;\n\n const onDownloadButtonClick = (): void => {\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(\n new Blob([JSON.stringify(dashboard)], {\n type: 'application/json',\n })\n );\n // Simulate click\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.downloadDashboard}>\n <ToolbarIconButton aria-label={TOOLTIP_TEXT.downloadDashboard} onClick={onDownloadButtonClick} sx={{ height }}>\n <DownloadIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n {/* Hidden link to download the dashboard as a JSON file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} download={`${dashboard.metadata.name}.json`} />\n </>\n );\n}\n"],"names":["useRef","DownloadIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useDashboard","DownloadButton","heightPx","dashboard","hiddenLinkRef","height","undefined","onDownloadButtonClick","current","hiddenLinkUrl","URL","createObjectURL","Blob","JSON","stringify","type","href","click","revokeObjectURL","description","downloadDashboard","aria-label","onClick","sx","a","ref","style","display","download","metadata","name"],"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,MAAM,QAAQ,QAAQ;AAC7C,OAAOC,kBAAkB,kCAAkC;AAC3D,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,yBAAyB;AACxE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAO7C,+DAA+D;AAC/D,OAAO,SAASC,eAAe,EAAEC,QAAQ,EAAuB;IAC9D,MAAM,EAAEC,SAAS,EAAE,GAAGH;IACtB,MAAMI,gBAAgBT,OAA0B;IAChD,MAAMU,SAASH,aAAaI,YAAYA,YAAY,CAAC,EAAEJ,SAAS,EAAE,CAAC;IAEnE,MAAMK,wBAAwB;QAC5B,IAAI,CAACH,iBAAiB,CAACA,cAAcI,OAAO,EAAE;QAC9C,kBAAkB;QAClB,MAAMC,gBAAgBC,IAAIC,eAAe,CACvC,IAAIC,KAAK;YAACC,KAAKC,SAAS,CAACX;SAAW,EAAE;YACpCY,MAAM;QACR;QAEF,iBAAiB;QACjBX,cAAcI,OAAO,CAACQ,IAAI,GAAGP;QAC7BL,cAAcI,OAAO,CAACS,KAAK;QAC3B,0CAA0C;QAC1CP,IAAIQ,eAAe,CAACT;IACtB;IAEA,qBACE;;0BACE,KAACZ;gBAAYsB,aAAapB,aAAaqB,iBAAiB;0BACtD,cAAA,KAACtB;oBAAkBuB,cAAYtB,aAAaqB,iBAAiB;oBAAEE,SAASf;oBAAuBgB,IAAI;wBAAElB;oBAAO;8BAC1G,cAAA,KAACT;;;0BAML,KAAC4B;gBAAEC,KAAKrB;gBAAesB,OAAO;oBAAEC,SAAS;gBAAO;gBAAGC,UAAU,CAAC,EAAEzB,UAAU0B,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC;;;;AAGpG"}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  export interface EditButtonProps {
3
3
  /**
4
4
  * The label used inside the button.
@@ -9,5 +9,5 @@ export interface EditButtonProps {
9
9
  */
10
10
  onClick: () => void;
11
11
  }
12
- export declare const EditButton: ({ label, onClick }: EditButtonProps) => JSX.Element;
12
+ export declare const EditButton: ({ label, onClick }: EditButtonProps) => ReactElement;
13
13
  //# sourceMappingURL=EditButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditButton/EditButton.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,uBAAiC,eAAe,gBAYtE,CAAC"}
1
+ {"version":3,"file":"EditButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditButton/EditButton.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,uBAAiC,eAAe,KAAG,YAYzE,CAAC"}
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Button } from '@mui/material';
15
15
  import PencilIcon from 'mdi-material-ui/PencilOutline';
16
- export const EditButton = ({ label ='Edit' , onClick })=>{
16
+ export const EditButton = ({ label = 'Edit', onClick })=>{
17
17
  return /*#__PURE__*/ _jsx(Button, {
18
18
  onClick: onClick,
19
19
  startIcon: /*#__PURE__*/ _jsx(PencilIcon, {}),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditButton/EditButton.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 PencilIcon from 'mdi-material-ui/PencilOutline';\n\nexport interface EditButtonProps {\n /**\n * The label used inside the button.\n */\n label?: string;\n\n /**\n * Handler that puts the dashboard into editing mode.\n */\n onClick: () => void;\n}\n\nexport const EditButton = ({ label = 'Edit', onClick }: EditButtonProps) => {\n return (\n <Button\n onClick={onClick}\n startIcon={<PencilIcon />}\n variant=\"outlined\"\n color=\"secondary\"\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n );\n};\n"],"names":["Button","PencilIcon","EditButton","label","onClick","startIcon","variant","color","sx","whiteSpace","minWidth"],"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,OAAOC,gBAAgB,gCAAgC;AAcvD,OAAO,MAAMC,aAAa,CAAC,EAAEC,OAAQ,OAAM,EAAEC,QAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/EditButton/EditButton.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 PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { ReactElement } from 'react';\n\nexport interface EditButtonProps {\n /**\n * The label used inside the button.\n */\n label?: string;\n\n /**\n * Handler that puts the dashboard into editing mode.\n */\n onClick: () => void;\n}\n\nexport const EditButton = ({ label = 'Edit', onClick }: EditButtonProps): ReactElement => {\n return (\n <Button\n onClick={onClick}\n startIcon={<PencilIcon />}\n variant=\"outlined\"\n color=\"secondary\"\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n );\n};\n"],"names":["Button","PencilIcon","EditButton","label","onClick","startIcon","variant","color","sx","whiteSpace","minWidth"],"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,OAAOC,gBAAgB,gCAAgC;AAevD,OAAO,MAAMC,aAAa,CAAC,EAAEC,QAAQ,MAAM,EAAEC,OAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  export interface EditJsonButtonProps {
3
3
  isReadonly: boolean;
4
4
  }
5
- export declare const EditJsonButton: (props: EditJsonButtonProps) => JSX.Element;
5
+ export declare const EditJsonButton: (props: EditJsonButtonProps) => ReactElement;
6
6
  //# sourceMappingURL=EditJsonButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":";AAmBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,gBAaxD,CAAC"}
1
+ {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,KAAG,YAa3D,CAAC"}
@@ -12,13 +12,12 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import CodeIcon from 'mdi-material-ui/CodeBraces';
15
- import { InfoTooltip } from '@perses-dev/components';
15
+ import { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';
16
16
  import { TOOLTIP_TEXT } from '../../constants';
17
- import { ToolbarIconButton } from '../ToolbarIconButton';
18
17
  import { useEditJsonDialog } from '../../context';
19
18
  export const EditJsonButton = (props)=>{
20
- const { isReadonly } = props;
21
- const { openEditJsonDialog } = useEditJsonDialog();
19
+ const { isReadonly } = props;
20
+ const { openEditJsonDialog } = useEditJsonDialog();
22
21
  const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;
23
22
  return /*#__PURE__*/ _jsx(InfoTooltip, {
24
23
  description: info,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonButton/EditJsonButton.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 CodeIcon from 'mdi-material-ui/CodeBraces';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { ToolbarIconButton } from '../ToolbarIconButton';\nimport { useEditJsonDialog } from '../../context';\n\nexport interface EditJsonButtonProps {\n isReadonly: boolean;\n}\n\nexport const EditJsonButton = (props: EditJsonButtonProps) => {\n const { isReadonly } = props;\n const { openEditJsonDialog } = useEditJsonDialog();\n\n const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;\n\n return (\n <InfoTooltip description={info}>\n <ToolbarIconButton aria-label={info} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","TOOLTIP_TEXT","ToolbarIconButton","useEditJsonDialog","EditJsonButton","props","isReadonly","openEditJsonDialog","info","viewJson","editJson","description","aria-label","variant","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,cAAc,6BAA6B;AAClD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,WAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,mBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaL,aAAaQ,WAAWR,aAAaS;IAE/D,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACN;YAAkBU,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonButton/EditJsonButton.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 CodeIcon from 'mdi-material-ui/CodeBraces';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useEditJsonDialog } from '../../context';\n\nexport interface EditJsonButtonProps {\n isReadonly: boolean;\n}\n\nexport const EditJsonButton = (props: EditJsonButtonProps): ReactElement => {\n const { isReadonly } = props;\n const { openEditJsonDialog } = useEditJsonDialog();\n\n const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;\n\n return (\n <InfoTooltip description={info}>\n <ToolbarIconButton aria-label={info} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useEditJsonDialog","EditJsonButton","props","isReadonly","openEditJsonDialog","info","viewJson","editJson","description","aria-label","variant","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,cAAc,6BAA6B;AAClD,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,yBAAyB;AAExE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,kBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaJ,aAAaO,QAAQ,GAAGP,aAAaQ,QAAQ;IAEvE,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACP;YAAkBW,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  export interface EditJsonDialogProps {
3
3
  isReadonly: boolean;
4
4
  disableMetadataEdition?: boolean;
5
5
  }
6
- export declare const EditJsonDialog: (props: EditJsonDialogProps) => JSX.Element;
6
+ export declare const EditJsonDialog: (props: EditJsonDialogProps) => ReactElement;
7
7
  //# sourceMappingURL=EditJsonDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonDialog.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"names":[],"mappings":";AAoBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,gBAYxD,CAAC"}
1
+ {"version":3,"file":"EditJsonDialog.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,YAAY,EAAY,MAAM,OAAO,CAAC;AAM1D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,KAAG,YAY3D,CAAC"}
@@ -15,13 +15,12 @@ import { useState } from 'react';
15
15
  import { Alert, FormControl } from '@mui/material';
16
16
  import { Dialog, JSONEditor } from '@perses-dev/components';
17
17
  import { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';
18
- import { useEditJsonDialog } from '../../context/DashboardProvider';
19
- import { useDashboard } from '../../context/useDashboard';
18
+ import { useEditJsonDialog, useDashboard } from '../../context';
20
19
  export const EditJsonDialog = (props)=>{
21
- const { isReadonly , disableMetadataEdition } = props;
22
- const { editJsonDialog , closeEditJsonDialog } = useEditJsonDialog();
20
+ const { isReadonly, disableMetadataEdition } = props;
21
+ const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();
23
22
  return /*#__PURE__*/ _jsxs(Dialog, {
24
- open: !!(editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen),
23
+ open: !!editJsonDialog?.isOpen,
25
24
  scroll: "paper",
26
25
  fullWidth: true,
27
26
  maxWidth: "lg",
@@ -33,7 +32,7 @@ export const EditJsonDialog = (props)=>{
33
32
  " Dashboard JSON"
34
33
  ]
35
34
  }),
36
- (editJsonDialog === null || editJsonDialog === void 0 ? void 0 : editJsonDialog.isOpen) && /*#__PURE__*/ _jsx(EditJsonDialogForm, {
35
+ editJsonDialog?.isOpen && /*#__PURE__*/ _jsx(EditJsonDialogForm, {
37
36
  isReadonly: isReadonly,
38
37
  disableMetadataEdition: disableMetadataEdition
39
38
  })
@@ -41,11 +40,11 @@ export const EditJsonDialog = (props)=>{
41
40
  });
42
41
  };
43
42
  const EditJsonDialogForm = (props)=>{
44
- const { isReadonly , disableMetadataEdition } = props;
45
- const { closeEditJsonDialog } = useEditJsonDialog();
46
- const { setTimeRange , setRefreshInterval } = useTimeRange();
47
- const { dashboard , setDashboard } = useDashboard();
48
- const { setLocalDatasources } = useDatasourceStore();
43
+ const { isReadonly, disableMetadataEdition } = props;
44
+ const { closeEditJsonDialog } = useEditJsonDialog();
45
+ const { setTimeRange, setRefreshInterval } = useTimeRange();
46
+ const { dashboard, setDashboard } = useDashboard();
47
+ const { setLocalDatasources } = useDatasourceStore();
49
48
  const [draftDashboard, setDraftDashboard] = useState(dashboard);
50
49
  const handleApply = (e)=>{
51
50
  e.preventDefault();
@@ -53,17 +52,15 @@ const EditJsonDialogForm = (props)=>{
53
52
  setTimeRange({
54
53
  pastDuration: draftDashboard.spec.duration
55
54
  });
56
- var _draftDashboard_spec_refreshInterval;
57
- setRefreshInterval((_draftDashboard_spec_refreshInterval = draftDashboard.spec.refreshInterval) !== null && _draftDashboard_spec_refreshInterval !== void 0 ? _draftDashboard_spec_refreshInterval : '0s');
58
- var _draftDashboard_spec_datasources;
59
- setLocalDatasources((_draftDashboard_spec_datasources = draftDashboard.spec.datasources) !== null && _draftDashboard_spec_datasources !== void 0 ? _draftDashboard_spec_datasources : {});
55
+ setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');
56
+ setLocalDatasources(draftDashboard.spec.datasources ?? {});
60
57
  closeEditJsonDialog();
61
58
  };
62
59
  const completeDraftDashboard = (dashboard)=>{
63
60
  try {
64
- const json = JSON.parse(dashboard !== null && dashboard !== void 0 ? dashboard : '{}');
61
+ const json = JSON.parse(dashboard ?? '{}');
65
62
  setDraftDashboard(json);
66
- } catch (e) {
63
+ } catch (_) {
67
64
  // do nothing
68
65
  }
69
66
  };
@@ -82,6 +79,13 @@ const EditJsonDialogForm = (props)=>{
82
79
  severity: "warning",
83
80
  children: "Metadata cannot be modified or saved."
84
81
  }),
82
+ draftDashboard.kind === 'EphemeralDashboard' && /*#__PURE__*/ _jsx(Alert, {
83
+ sx: {
84
+ marginBottom: 1
85
+ },
86
+ severity: "warning",
87
+ children: "Time-to-live cannot be modified or saved from here. Go to the project view to modify it."
88
+ }),
85
89
  /*#__PURE__*/ _jsx(FormControl, {
86
90
  fullWidth: true,
87
91
  children: /*#__PURE__*/ _jsx(JSONEditor, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.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 { FormEvent, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog } from '../../context/DashboardProvider';\nimport { useDashboard } from '../../context/useDashboard';\n\nexport interface EditJsonDialogProps {\n isReadonly: boolean;\n disableMetadataEdition?: boolean;\n}\n\nexport const EditJsonDialog = (props: EditJsonDialogProps) => {\n const { isReadonly, disableMetadataEdition } = props;\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>{!isReadonly && 'Edit '} Dashboard JSON</Dialog.Header>\n {editJsonDialog?.isOpen && (\n <EditJsonDialogForm isReadonly={isReadonly} disableMetadataEdition={disableMetadataEdition} />\n )}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = (props: EditJsonDialogProps) => {\n const { isReadonly, disableMetadataEdition } = props;\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const { setLocalDatasources } = useDatasourceStore();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent) => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n setLocalDatasources(draftDashboard.spec.datasources ?? {});\n closeEditJsonDialog();\n };\n\n const completeDraftDashboard = (dashboard: string | undefined) => {\n try {\n const json = JSON.parse(dashboard ?? '{}');\n setDraftDashboard(json);\n } catch (e) {\n // do nothing\n }\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n {disableMetadataEdition && !isReadonly && (\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n )}\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"70vh\"\n value={draftDashboard}\n onChange={(value: string) => completeDraftDashboard(value)}\n readOnly={isReadonly}\n />\n </FormControl>\n </Dialog.Content>\n {!isReadonly && (\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n )}\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useDatasourceStore","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","props","isReadonly","disableMetadataEdition","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","setLocalDatasources","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","datasources","completeDraftDashboard","json","JSON","parse","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","minHeight","maxHeight","value","onChange","readOnly","Actions","PrimaryButton","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAoBA,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAC5D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,YAAY,QAAQ,6BAA6B;AAO1D,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,WAAU,EAAEC,uBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,eAAc,EAAEC,oBAAmB,EAAE,GAAGP;IAEhD,qBACE,MAACJ;QAAOY,MAAM,CAAC,CAACF,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBG,MAAK;QAAGC,QAAO;QAAQC,SAAS;QAACC,UAAS;;0BACxE,MAAChB,OAAOiB;gBAAOC,SAAS,IAAMP;;oBAAwB,CAACH,cAAc;oBAAQ;;;YAC5EE,CAAAA,2BAAAA,4BAAAA,KAAAA,IAAAA,eAAgBG,MAAK,mBACpB,KAACM;gBAAmBX,YAAYA;gBAAYC,wBAAwBA;;;;AAI5E,EAAE;AAEF,MAAMU,qBAAqB,CAACZ;IAC1B,MAAM,EAAEC,WAAU,EAAEC,uBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEI,oBAAmB,EAAE,GAAGP;IAChC,MAAM,EAAEgB,aAAY,EAAEC,mBAAkB,EAAE,GAAGlB;IAC7C,MAAM,EAAEmB,UAAS,EAAEC,aAAY,EAAE,GAAGlB;IACpC,MAAM,EAAEmB,oBAAmB,EAAE,GAAGtB;IAChC,MAAM,CAACuB,gBAAgBC,kBAAkB,GAAG7B,SAASyB;IAErD,MAAMK,cAAc,CAACC;QACnBA,EAAEC;QACFN,aAAaE;QACbL,aAAa;YAAEU,cAAcL,eAAeM,KAAKC;QAAS;YACvCP;QAAnBJ,mBAAmBI,CAAAA,uCAAAA,eAAeM,KAAKE,6BAApBR,kDAAAA,uCAAuC;YACtCA;QAApBD,oBAAoBC,CAAAA,mCAAAA,eAAeM,KAAKG,yBAApBT,8CAAAA,mCAAmC,CAAC;QACxDd;IACF;IAEA,MAAMwB,yBAAyB,CAACb;QAC9B,IAAI;YACF,MAAMc,OAAOC,KAAKC,MAAMhB,sBAAAA,uBAAAA,YAAa;YACrCI,kBAAkBU;QACpB,EAAE,OAAOR,GAAG;QACV,aAAa;QACf;IACF;IAEA,qBACE,MAAC5B,OAAOuC;QAAKC,UAAUb;;0BACrB,MAAC3B,OAAOyC;gBAAQC,IAAI;oBAAEC,OAAO;gBAAO;;oBACjClC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM4C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,QAAQ;wBAAG;wBAAGC,UAAS;kCAAU;;kCAI/E,KAAChD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACC+C,WAAU;4BACVC,WAAU;4BACVC,OAAOzB;4BACP0B,UAAU,CAACD,QAAkBf,uBAAuBe;4BACpDE,UAAU5C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOqD;0BACN,cAAA,KAACrD,OAAOsD;oBAAcC,SAAS5B;8BAAa;;;;;AAKtD"}
1
+ {"version":3,"sources":["../../../src/components/EditJsonDialog/EditJsonDialog.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 { FormEvent, ReactElement, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog, useDashboard } from '../../context';\n\nexport interface EditJsonDialogProps {\n isReadonly: boolean;\n disableMetadataEdition?: boolean;\n}\n\nexport const EditJsonDialog = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>{!isReadonly && 'Edit '} Dashboard JSON</Dialog.Header>\n {editJsonDialog?.isOpen && (\n <EditJsonDialogForm isReadonly={isReadonly} disableMetadataEdition={disableMetadataEdition} />\n )}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const { setLocalDatasources } = useDatasourceStore();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent): void => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n setLocalDatasources(draftDashboard.spec.datasources ?? {});\n closeEditJsonDialog();\n };\n\n const completeDraftDashboard = (dashboard: string | undefined): void => {\n try {\n const json = JSON.parse(dashboard ?? '{}');\n setDraftDashboard(json);\n } catch (_) {\n // do nothing\n }\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n {disableMetadataEdition && !isReadonly && (\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n )}\n {draftDashboard.kind === 'EphemeralDashboard' && (\n <Alert sx={{ marginBottom: 1 }} severity=\"warning\">\n Time-to-live cannot be modified or saved from here. Go to the project view to modify it.\n </Alert>\n )}\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"70vh\"\n value={draftDashboard}\n onChange={(value: string) => completeDraftDashboard(value)}\n readOnly={isReadonly}\n />\n </FormControl>\n </Dialog.Content>\n {!isReadonly && (\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n )}\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useDatasourceStore","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","props","isReadonly","disableMetadataEdition","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","setLocalDatasources","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","datasources","completeDraftDashboard","json","JSON","parse","_","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","kind","minHeight","maxHeight","value","onChange","readOnly","Actions","PrimaryButton","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAC5D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,gBAAgB;AAOhE,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,cAAc,EAAEC,mBAAmB,EAAE,GAAGP;IAEhD,qBACE,MAACJ;QAAOY,MAAM,CAAC,CAACF,gBAAgBG;QAAQC,QAAO;QAAQC,SAAS;QAACC,UAAS;;0BACxE,MAAChB,OAAOiB,MAAM;gBAACC,SAAS,IAAMP;;oBAAwB,CAACH,cAAc;oBAAQ;;;YAC5EE,gBAAgBG,wBACf,KAACM;gBAAmBX,YAAYA;gBAAYC,wBAAwBA;;;;AAI5E,EAAE;AAEF,MAAMU,qBAAqB,CAACZ;IAC1B,MAAM,EAAEC,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEI,mBAAmB,EAAE,GAAGP;IAChC,MAAM,EAAEgB,YAAY,EAAEC,kBAAkB,EAAE,GAAGlB;IAC7C,MAAM,EAAEmB,SAAS,EAAEC,YAAY,EAAE,GAAGlB;IACpC,MAAM,EAAEmB,mBAAmB,EAAE,GAAGtB;IAChC,MAAM,CAACuB,gBAAgBC,kBAAkB,GAAG7B,SAASyB;IAErD,MAAMK,cAAc,CAACC;QACnBA,EAAEC,cAAc;QAChBN,aAAaE;QACbL,aAAa;YAAEU,cAAcL,eAAeM,IAAI,CAACC,QAAQ;QAAC;QAC1DX,mBAAmBI,eAAeM,IAAI,CAACE,eAAe,IAAI;QAC1DT,oBAAoBC,eAAeM,IAAI,CAACG,WAAW,IAAI,CAAC;QACxDvB;IACF;IAEA,MAAMwB,yBAAyB,CAACb;QAC9B,IAAI;YACF,MAAMc,OAAOC,KAAKC,KAAK,CAAChB,aAAa;YACrCI,kBAAkBU;QACpB,EAAE,OAAOG,GAAG;QACV,aAAa;QACf;IACF;IAEA,qBACE,MAACvC,OAAOwC,IAAI;QAACC,UAAUd;;0BACrB,MAAC3B,OAAO0C,OAAO;gBAACC,IAAI;oBAAEC,OAAO;gBAAO;;oBACjCnC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM6C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;wBAAGC,UAAS;kCAAU;;oBAI9EvB,eAAewB,IAAI,KAAK,sCACvB,KAACnD;wBAAM6C,IAAI;4BAAEE,cAAc;wBAAE;wBAAGG,UAAS;kCAAU;;kCAIrD,KAACjD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACCiD,WAAU;4BACVC,WAAU;4BACVC,OAAO3B;4BACP4B,UAAU,CAACD,QAAkBjB,uBAAuBiB;4BACpDE,UAAU9C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOuD,OAAO;0BACb,cAAA,KAACvD,OAAOwD,aAAa;oBAACC,SAAS9B;8BAAa;;;;;AAKtD"}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  export interface EmptyDashboardProps {
3
3
  /**
4
4
  * The title, which should be relatively short text.
@@ -7,7 +7,7 @@ export interface EmptyDashboardProps {
7
7
  /**
8
8
  * Imagery to display above the title.
9
9
  */
10
- image?: React.ReactNode;
10
+ image?: ReactNode;
11
11
  /**
12
12
  * Descriptive text, which can be a bit longer.
13
13
  */
@@ -33,5 +33,5 @@ export interface EmptyDashboardProps {
33
33
  /**
34
34
  * Communicate that a dashboard is empty and prompt the user to get started.
35
35
  */
36
- export declare const EmptyDashboard: ({ title, image, description, additionalText, actions, onEditButtonClick, }: EmptyDashboardProps) => JSX.Element;
36
+ export declare const EmptyDashboard: ({ title, image, description, additionalText, actions, onEditButtonClick, }: EmptyDashboardProps) => ReactElement;
37
37
  //# sourceMappingURL=EmptyDashboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyDashboard/EmptyDashboard.tsx"],"names":[],"mappings":";AAmBA,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAEhC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAmDD;;GAEG;AACH,eAAO,MAAM,cAAc,+EAOxB,mBAAmB,gBA2BrB,CAAC"}
1
+ {"version":3,"file":"EmptyDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/EmptyDashboard/EmptyDashboard.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMhD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAEhC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAuDD;;GAEG;AACH,eAAO,MAAM,cAAc,+EAOxB,mBAAmB,KAAG,YA2BxB,CAAC"}
@@ -22,13 +22,13 @@ const DEFAULT_DESCRIPTION = {
22
22
  view: 'This dashboard is currently empty. Get started by clicking the edit button.'
23
23
  };
24
24
  // Constants from specifics in designs to make the default messaging look good.
25
- const CONTAINER_WIDTH = '450px';
25
+ const CONTAINER_WIDTH = '500px';
26
26
  const PRIMARY_CONTENT_WIDTH = '289px';
27
27
  const COMMON_BUTTON_PROPS = {
28
28
  variant: 'outlined',
29
29
  color: 'secondary'
30
30
  };
31
- const EmptyDashboardActions = ({ actions , isEditMode , onEditButtonClick })=>{
31
+ const EmptyDashboardActions = ({ actions, isEditMode, onEditButtonClick })=>{
32
32
  if (actions && typeof actions !== 'boolean') {
33
33
  // Custom actions
34
34
  return actions;
@@ -68,8 +68,8 @@ const EmptyDashboardActions = ({ actions , isEditMode , onEditButtonClick })=>{
68
68
  };
69
69
  /**
70
70
  * Communicate that a dashboard is empty and prompt the user to get started.
71
- */ export const EmptyDashboard = ({ title =DEFAULT_TITLE , image , description , additionalText , actions , onEditButtonClick })=>{
72
- const { isEditMode } = useEditMode();
71
+ */ export const EmptyDashboard = ({ title = DEFAULT_TITLE, image, description, additionalText, actions, onEditButtonClick })=>{
72
+ const { isEditMode } = useEditMode();
73
73
  const defaultDescription = isEditMode ? DEFAULT_DESCRIPTION.edit : DEFAULT_DESCRIPTION.view;
74
74
  const actionsContent = /*#__PURE__*/ _jsx(EmptyDashboardActions, {
75
75
  actions: actions,
@@ -97,7 +97,7 @@ const EmptyDashboardActions = ({ actions , isEditMode , onEditButtonClick })=>{
97
97
  }),
98
98
  /*#__PURE__*/ _jsx(Typography, {
99
99
  variant: "body1",
100
- children: description !== null && description !== void 0 ? description : defaultDescription
100
+ children: description ?? defaultDescription
101
101
  }),
102
102
  actionsContent && /*#__PURE__*/ _jsx(Box, {
103
103
  sx: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EmptyDashboard/EmptyDashboard.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 { Typography, Box } from '@mui/material';\nimport { useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { EditVariablesButton } from '../Variables';\nimport { EditButton } from '../EditButton';\n\nexport interface EmptyDashboardProps {\n /**\n * The title, which should be relatively short text.\n */\n title?: string;\n\n /**\n * Imagery to display above the title.\n */\n image?: React.ReactNode;\n\n /**\n * Descriptive text, which can be a bit longer.\n */\n description?: string;\n\n /**\n * Additional text that will be displayed at the bottom of the empty state.\n * If not specified, no additional text is shown.\n */\n additionalText?: string;\n\n /**\n * Components that are placed below the title and description that include\n * actions for the user to take (e.g. buttons or links). If not specified,\n * the default buttons will be displayed. Set to `false` to disable the default\n * buttons.\n */\n actions?: JSX.Element | boolean;\n\n /**\n * Handler for clicking the edit button when the dashboard is in \"view\" mode.\n * Required when using the default empty state.\n */\n onEditButtonClick?: () => void;\n}\n\nconst DEFAULT_TITLE = \"Let's get started\";\n\nconst DEFAULT_DESCRIPTION = {\n edit: 'We currently support time series charts, gauge charts, stat charts and more!',\n view: 'This dashboard is currently empty. Get started by clicking the edit button.',\n};\n\n// Constants from specifics in designs to make the default messaging look good.\nconst CONTAINER_WIDTH = '450px';\nconst PRIMARY_CONTENT_WIDTH = '289px';\n\nconst COMMON_BUTTON_PROPS = {\n variant: 'outlined',\n color: 'secondary',\n} as const;\n\ntype EmptyDashboardActionsProps = Pick<EmptyDashboardProps, 'actions' | 'onEditButtonClick'> & {\n isEditMode: boolean;\n};\n\nconst EmptyDashboardActions = ({ actions, isEditMode, onEditButtonClick }: EmptyDashboardActionsProps) => {\n if (actions && typeof actions !== 'boolean') {\n // Custom actions\n return actions;\n }\n\n if (actions === false) {\n // Disable default actions\n return null;\n }\n\n if (isEditMode) {\n // Default edit mode actions\n return (\n <>\n <AddPanelButton variant=\"outlined\" color=\"secondary\" label=\"Add Panel\" fullWidth />\n <EditVariablesButton variant=\"outlined\" color=\"secondary\" label=\"Add Variables\" fullWidth />\n </>\n );\n }\n\n if (onEditButtonClick) {\n // Default view mode actions\n return <EditButton {...COMMON_BUTTON_PROPS} label=\"Edit Dashboard\" onClick={onEditButtonClick} />;\n }\n\n return null;\n};\n\n/**\n * Communicate that a dashboard is empty and prompt the user to get started.\n */\nexport const EmptyDashboard = ({\n title = DEFAULT_TITLE,\n image,\n description,\n additionalText,\n actions,\n onEditButtonClick,\n}: EmptyDashboardProps) => {\n const { isEditMode } = useEditMode();\n\n const defaultDescription = isEditMode ? DEFAULT_DESCRIPTION.edit : DEFAULT_DESCRIPTION.view;\n const actionsContent = (\n <EmptyDashboardActions actions={actions} onEditButtonClick={onEditButtonClick} isEditMode={isEditMode} />\n );\n\n return (\n <Box sx={{ width: CONTAINER_WIDTH, textAlign: 'center', margin: '0 auto' }}>\n <Box sx={{ width: PRIMARY_CONTENT_WIDTH, margin: '0 auto' }}>\n {!!image && image}\n <Typography variant=\"h2\" gutterBottom>\n {title}\n </Typography>\n <Typography variant=\"body1\">{description ?? defaultDescription}</Typography>\n {actionsContent && (\n <Box sx={{ display: 'flex', gap: 2, marginTop: 1, justifyContent: 'center' }}>{actionsContent}</Box>\n )}\n </Box>\n {additionalText && (\n <Typography variant=\"subtitle1\" sx={{ marginTop: 12 }}>\n {additionalText}\n </Typography>\n )}\n </Box>\n );\n};\n"],"names":["Typography","Box","useEditMode","AddPanelButton","EditVariablesButton","EditButton","DEFAULT_TITLE","DEFAULT_DESCRIPTION","edit","view","CONTAINER_WIDTH","PRIMARY_CONTENT_WIDTH","COMMON_BUTTON_PROPS","variant","color","EmptyDashboardActions","actions","isEditMode","onEditButtonClick","label","fullWidth","onClick","EmptyDashboard","title","image","description","additionalText","defaultDescription","actionsContent","sx","width","textAlign","margin","gutterBottom","display","gap","marginTop","justifyContent"],"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,GAAG,QAAQ,gBAAgB;AAChD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,UAAU,QAAQ,gBAAgB;AAuC3C,MAAMC,gBAAgB;AAEtB,MAAMC,sBAAsB;IAC1BC,MAAM;IACNC,MAAM;AACR;AAEA,+EAA+E;AAC/E,MAAMC,kBAAkB;AACxB,MAAMC,wBAAwB;AAE9B,MAAMC,sBAAsB;IAC1BC,SAAS;IACTC,OAAO;AACT;AAMA,MAAMC,wBAAwB,CAAC,EAAEC,QAAO,EAAEC,WAAU,EAAEC,kBAAiB,EAA8B;IACnG,IAAIF,WAAW,OAAOA,YAAY,WAAW;QAC3C,iBAAiB;QACjB,OAAOA;IACT;IAEA,IAAIA,YAAY,OAAO;QACrB,0BAA0B;QAC1B,OAAO;IACT;IAEA,IAAIC,YAAY;QACd,4BAA4B;QAC5B,qBACE;;8BACE,KAACd;oBAAeU,SAAQ;oBAAWC,OAAM;oBAAYK,OAAM;oBAAYC,SAAS;;8BAChF,KAAChB;oBAAoBS,SAAQ;oBAAWC,OAAM;oBAAYK,OAAM;oBAAgBC,SAAS;;;;IAG/F;IAEA,IAAIF,mBAAmB;QACrB,4BAA4B;QAC5B,qBAAO,KAACb;YAAY,GAAGO,mBAAmB;YAAEO,OAAM;YAAiBE,SAASH;;IAC9E;IAEA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,MAAMI,iBAAiB,CAAC,EAC7BC,OAAQjB,cAAa,EACrBkB,MAAK,EACLC,YAAW,EACXC,eAAc,EACdV,QAAO,EACPE,kBAAiB,EACG;IACpB,MAAM,EAAED,WAAU,EAAE,GAAGf;IAEvB,MAAMyB,qBAAqBV,aAAaV,oBAAoBC,OAAOD,oBAAoBE;IACvF,MAAMmB,+BACJ,KAACb;QAAsBC,SAASA;QAASE,mBAAmBA;QAAmBD,YAAYA;;IAG7F,qBACE,MAAChB;QAAI4B,IAAI;YAAEC,OAAOpB;YAAiBqB,WAAW;YAAUC,QAAQ;QAAS;;0BACvE,MAAC/B;gBAAI4B,IAAI;oBAAEC,OAAOnB;oBAAuBqB,QAAQ;gBAAS;;oBACvD,CAAC,CAACR,SAASA;kCACZ,KAACxB;wBAAWa,SAAQ;wBAAKoB,YAAY;kCAClCV;;kCAEH,KAACvB;wBAAWa,SAAQ;kCAASY,wBAAAA,yBAAAA,cAAeE;;oBAC3CC,gCACC,KAAC3B;wBAAI4B,IAAI;4BAAEK,SAAS;4BAAQC,KAAK;4BAAGC,WAAW;4BAAGC,gBAAgB;wBAAS;kCAAIT;;;;YAGlFF,gCACC,KAAC1B;gBAAWa,SAAQ;gBAAYgB,IAAI;oBAAEO,WAAW;gBAAG;0BACjDV;;;;AAKX,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/EmptyDashboard/EmptyDashboard.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 { Typography, Box } from '@mui/material';\nimport { ReactElement, ReactNode } from 'react';\nimport { useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { EditVariablesButton } from '../Variables';\nimport { EditButton } from '../EditButton';\n\nexport interface EmptyDashboardProps {\n /**\n * The title, which should be relatively short text.\n */\n title?: string;\n\n /**\n * Imagery to display above the title.\n */\n image?: ReactNode;\n\n /**\n * Descriptive text, which can be a bit longer.\n */\n description?: string;\n\n /**\n * Additional text that will be displayed at the bottom of the empty state.\n * If not specified, no additional text is shown.\n */\n additionalText?: string;\n\n /**\n * Components that are placed below the title and description that include\n * actions for the user to take (e.g. buttons or links). If not specified,\n * the default buttons will be displayed. Set to `false` to disable the default\n * buttons.\n */\n actions?: JSX.Element | boolean;\n\n /**\n * Handler for clicking the edit button when the dashboard is in \"view\" mode.\n * Required when using the default empty state.\n */\n onEditButtonClick?: () => void;\n}\n\nconst DEFAULT_TITLE = \"Let's get started\";\n\nconst DEFAULT_DESCRIPTION = {\n edit: 'We currently support time series charts, gauge charts, stat charts and more!',\n view: 'This dashboard is currently empty. Get started by clicking the edit button.',\n};\n\n// Constants from specifics in designs to make the default messaging look good.\nconst CONTAINER_WIDTH = '500px';\nconst PRIMARY_CONTENT_WIDTH = '289px';\n\nconst COMMON_BUTTON_PROPS = {\n variant: 'outlined',\n color: 'secondary',\n} as const;\n\ntype EmptyDashboardActionsProps = Pick<EmptyDashboardProps, 'actions' | 'onEditButtonClick'> & {\n isEditMode: boolean;\n};\n\nconst EmptyDashboardActions = ({\n actions,\n isEditMode,\n onEditButtonClick,\n}: EmptyDashboardActionsProps): ReactElement | null => {\n if (actions && typeof actions !== 'boolean') {\n // Custom actions\n return actions;\n }\n\n if (actions === false) {\n // Disable default actions\n return null;\n }\n\n if (isEditMode) {\n // Default edit mode actions\n return (\n <>\n <AddPanelButton variant=\"outlined\" color=\"secondary\" label=\"Add Panel\" fullWidth />\n <EditVariablesButton variant=\"outlined\" color=\"secondary\" label=\"Add Variables\" fullWidth />\n </>\n );\n }\n\n if (onEditButtonClick) {\n // Default view mode actions\n return <EditButton {...COMMON_BUTTON_PROPS} label=\"Edit Dashboard\" onClick={onEditButtonClick} />;\n }\n\n return null;\n};\n\n/**\n * Communicate that a dashboard is empty and prompt the user to get started.\n */\nexport const EmptyDashboard = ({\n title = DEFAULT_TITLE,\n image,\n description,\n additionalText,\n actions,\n onEditButtonClick,\n}: EmptyDashboardProps): ReactElement => {\n const { isEditMode } = useEditMode();\n\n const defaultDescription = isEditMode ? DEFAULT_DESCRIPTION.edit : DEFAULT_DESCRIPTION.view;\n const actionsContent = (\n <EmptyDashboardActions actions={actions} onEditButtonClick={onEditButtonClick} isEditMode={isEditMode} />\n );\n\n return (\n <Box sx={{ width: CONTAINER_WIDTH, textAlign: 'center', margin: '0 auto' }}>\n <Box sx={{ width: PRIMARY_CONTENT_WIDTH, margin: '0 auto' }}>\n {!!image && image}\n <Typography variant=\"h2\" gutterBottom>\n {title}\n </Typography>\n <Typography variant=\"body1\">{description ?? defaultDescription}</Typography>\n {actionsContent && (\n <Box sx={{ display: 'flex', gap: 2, marginTop: 1, justifyContent: 'center' }}>{actionsContent}</Box>\n )}\n </Box>\n {additionalText && (\n <Typography variant=\"subtitle1\" sx={{ marginTop: 12 }}>\n {additionalText}\n </Typography>\n )}\n </Box>\n );\n};\n"],"names":["Typography","Box","useEditMode","AddPanelButton","EditVariablesButton","EditButton","DEFAULT_TITLE","DEFAULT_DESCRIPTION","edit","view","CONTAINER_WIDTH","PRIMARY_CONTENT_WIDTH","COMMON_BUTTON_PROPS","variant","color","EmptyDashboardActions","actions","isEditMode","onEditButtonClick","label","fullWidth","onClick","EmptyDashboard","title","image","description","additionalText","defaultDescription","actionsContent","sx","width","textAlign","margin","gutterBottom","display","gap","marginTop","justifyContent"],"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,GAAG,QAAQ,gBAAgB;AAEhD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,UAAU,QAAQ,gBAAgB;AAuC3C,MAAMC,gBAAgB;AAEtB,MAAMC,sBAAsB;IAC1BC,MAAM;IACNC,MAAM;AACR;AAEA,+EAA+E;AAC/E,MAAMC,kBAAkB;AACxB,MAAMC,wBAAwB;AAE9B,MAAMC,sBAAsB;IAC1BC,SAAS;IACTC,OAAO;AACT;AAMA,MAAMC,wBAAwB,CAAC,EAC7BC,OAAO,EACPC,UAAU,EACVC,iBAAiB,EACU;IAC3B,IAAIF,WAAW,OAAOA,YAAY,WAAW;QAC3C,iBAAiB;QACjB,OAAOA;IACT;IAEA,IAAIA,YAAY,OAAO;QACrB,0BAA0B;QAC1B,OAAO;IACT;IAEA,IAAIC,YAAY;QACd,4BAA4B;QAC5B,qBACE;;8BACE,KAACd;oBAAeU,SAAQ;oBAAWC,OAAM;oBAAYK,OAAM;oBAAYC,SAAS;;8BAChF,KAAChB;oBAAoBS,SAAQ;oBAAWC,OAAM;oBAAYK,OAAM;oBAAgBC,SAAS;;;;IAG/F;IAEA,IAAIF,mBAAmB;QACrB,4BAA4B;QAC5B,qBAAO,KAACb;YAAY,GAAGO,mBAAmB;YAAEO,OAAM;YAAiBE,SAASH;;IAC9E;IAEA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,MAAMI,iBAAiB,CAAC,EAC7BC,QAAQjB,aAAa,EACrBkB,KAAK,EACLC,WAAW,EACXC,cAAc,EACdV,OAAO,EACPE,iBAAiB,EACG;IACpB,MAAM,EAAED,UAAU,EAAE,GAAGf;IAEvB,MAAMyB,qBAAqBV,aAAaV,oBAAoBC,IAAI,GAAGD,oBAAoBE,IAAI;IAC3F,MAAMmB,+BACJ,KAACb;QAAsBC,SAASA;QAASE,mBAAmBA;QAAmBD,YAAYA;;IAG7F,qBACE,MAAChB;QAAI4B,IAAI;YAAEC,OAAOpB;YAAiBqB,WAAW;YAAUC,QAAQ;QAAS;;0BACvE,MAAC/B;gBAAI4B,IAAI;oBAAEC,OAAOnB;oBAAuBqB,QAAQ;gBAAS;;oBACvD,CAAC,CAACR,SAASA;kCACZ,KAACxB;wBAAWa,SAAQ;wBAAKoB,YAAY;kCAClCV;;kCAEH,KAACvB;wBAAWa,SAAQ;kCAASY,eAAeE;;oBAC3CC,gCACC,KAAC3B;wBAAI4B,IAAI;4BAAEK,SAAS;4BAAQC,KAAK;4BAAGC,WAAW;4BAAGC,gBAAgB;wBAAS;kCAAIT;;;;YAGlFF,gCACC,KAAC1B;gBAAWa,SAAQ;gBAAYgB,IAAI;oBAAEO,WAAW;gBAAG;0BACjDV;;;;AAKX,EAAE"}
@@ -1,6 +1,8 @@
1
- /// <reference types="react" />
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material';
2
3
  export interface GridContainerProps {
3
- children: React.ReactNode;
4
+ children: ReactNode;
5
+ sx?: SxProps<Theme>;
4
6
  }
5
- export declare function GridContainer(props: GridContainerProps): JSX.Element;
7
+ export declare function GridContainer(props: GridContainerProps): ReactElement;
6
8
  //# sourceMappingURL=GridContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAsBtD"}
1
+ {"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAU,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAyBrE"}
@@ -23,24 +23,29 @@ export function GridContainer(props) {
23
23
  isFirstRender
24
24
  ]);
25
25
  return /*#__PURE__*/ _jsx(ReactGridLayoutContainer, {
26
- sx: {
27
- // This adds spcing between grids (rows) in the overall dashboard
28
- '& + &': {
29
- marginTop: (theme)=>theme.spacing(1)
26
+ sx: [
27
+ {
28
+ // This adds spacing between grids (rows) in the overall dashboard
29
+ '& + &': {
30
+ marginTop: 1
31
+ },
32
+ // This disables the animation of grid items when a grid is first rendered
33
+ // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)
34
+ '& .react-grid-item.cssTransforms': {
35
+ transitionProperty: isFirstRender ? 'none' : 'transform'
36
+ }
30
37
  },
31
- // This disables the animation of grid items when a grid is first rendered
32
- // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)
33
- '& .react-grid-item.cssTransforms': {
34
- transitionProperty: isFirstRender ? 'none' : 'transform'
35
- }
36
- },
38
+ ...Array.isArray(props.sx) ? props.sx : [
39
+ props.sx
40
+ ]
41
+ ],
37
42
  "data-testid": "panel-group",
38
43
  children: props.children
39
44
  });
40
45
  }
41
46
  /**
42
47
  * These are the classes needed by react-grid-layout from their CSS stylesheet.
43
- */ const ReactGridLayoutContainer = styled('section')(({ theme })=>({
48
+ */ const ReactGridLayoutContainer = styled('section')(({ theme })=>({
44
49
  '& .react-grid-layout': {
45
50
  position: 'relative',
46
51
  transition: 'height 200ms ease'
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/GridLayout/GridContainer.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useState } from 'react';\nimport { styled } from '@mui/material';\n\nexport interface GridContainerProps {\n children: React.ReactNode;\n}\n\nexport function GridContainer(props: GridContainerProps) {\n const [isFirstRender, setIsFirstRender] = useState(true);\n useEffect(() => {\n if (isFirstRender) {\n setIsFirstRender(false);\n }\n }, [isFirstRender]);\n\n return (\n <ReactGridLayoutContainer\n sx={{\n // This adds spcing between grids (rows) in the overall dashboard\n '& + &': { marginTop: (theme) => theme.spacing(1) },\n // This disables the animation of grid items when a grid is first rendered\n // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)\n '& .react-grid-item.cssTransforms': { transitionProperty: isFirstRender ? 'none' : 'transform' },\n }}\n data-testid=\"panel-group\"\n >\n {props.children}\n </ReactGridLayoutContainer>\n );\n}\n\n/**\n * These are the classes needed by react-grid-layout from their CSS stylesheet.\n */\nconst ReactGridLayoutContainer = styled('section')(({ theme }) => ({\n '& .react-grid-layout': {\n position: 'relative',\n transition: 'height 200ms ease',\n },\n '& .react-grid-item': {\n transition: 'all 200ms ease',\n transitionProperty: 'left, top',\n },\n '& .react-grid-item img': {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n '& .react-grid-item.cssTransforms': {\n transitionProperty: 'transform',\n },\n '& .react-grid-item.resizing': {\n zIndex: 1,\n willChange: 'width, height',\n },\n '& .react-grid-item.react-draggable-dragging': {\n transition: 'none',\n zIndex: 3,\n willChange: 'transform',\n },\n '& .react-grid-item.dropping': {\n visibility: 'hidden',\n },\n '& .react-grid-item.react-grid-placeholder': {\n background: theme.palette.primary.main,\n opacity: 0.2,\n transitionDuration: '100ms',\n zIndex: 2,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none',\n OUserSelect: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n },\n '& .react-grid-item > .react-resizable-handle::after': {\n content: '\"\"',\n position: 'absolute',\n right: '3px',\n bottom: '3px',\n width: '5px',\n height: '5px',\n borderRight: `2px solid ${theme.palette.text.secondary}`,\n borderBottom: `2px solid ${theme.palette.text.secondary}`,\n },\n\n '& .react-resizable-hide > .react-resizable-handle': {\n display: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e':\n {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s':\n {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n '& .react-resizable': {\n position: 'relative',\n },\n '& .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n backgroundRepeat: 'no-repeat',\n backgroundOrigin: 'content-box',\n boxSizing: 'border-box',\n backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,\n backgroundPosition: 'bottom right',\n padding: '0 3px 3px 0',\n },\n '& .react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-resizable-handle-w, .react-resizable-handle-e': {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-resizable-handle-n, .react-resizable-handle-s': {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n}));\n"],"names":["useEffect","useState","styled","GridContainer","props","isFirstRender","setIsFirstRender","ReactGridLayoutContainer","sx","marginTop","theme","spacing","transitionProperty","data-testid","children","position","transition","pointerEvents","userSelect","zIndex","willChange","visibility","background","palette","primary","main","opacity","transitionDuration","WebkitUserSelect","MozUserSelect","msUserSelect","OUserSelect","width","height","content","right","bottom","borderRight","text","secondary","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"mappings":"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"}
1
+ {"version":3,"sources":["../../../src/components/GridLayout/GridContainer.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, ReactNode, useEffect, useState } from 'react';\nimport { styled, SxProps, Theme } from '@mui/material';\n\nexport interface GridContainerProps {\n children: ReactNode;\n sx?: SxProps<Theme>;\n}\n\nexport function GridContainer(props: GridContainerProps): ReactElement {\n const [isFirstRender, setIsFirstRender] = useState(true);\n useEffect(() => {\n if (isFirstRender) {\n setIsFirstRender(false);\n }\n }, [isFirstRender]);\n\n return (\n <ReactGridLayoutContainer\n sx={[\n {\n // This adds spacing between grids (rows) in the overall dashboard\n '& + &': { marginTop: 1 },\n // This disables the animation of grid items when a grid is first rendered\n // (see https://github.com/react-grid-layout/react-grid-layout/issues/103)\n '& .react-grid-item.cssTransforms': { transitionProperty: isFirstRender ? 'none' : 'transform' },\n },\n ...(Array.isArray(props.sx) ? props.sx : [props.sx]),\n ]}\n data-testid=\"panel-group\"\n >\n {props.children}\n </ReactGridLayoutContainer>\n );\n}\n\n/**\n * These are the classes needed by react-grid-layout from their CSS stylesheet.\n */\nconst ReactGridLayoutContainer = styled('section')(({ theme }) => ({\n '& .react-grid-layout': {\n position: 'relative',\n transition: 'height 200ms ease',\n },\n '& .react-grid-item': {\n transition: 'all 200ms ease',\n transitionProperty: 'left, top',\n },\n '& .react-grid-item img': {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n '& .react-grid-item.cssTransforms': {\n transitionProperty: 'transform',\n },\n '& .react-grid-item.resizing': {\n zIndex: 1,\n willChange: 'width, height',\n },\n '& .react-grid-item.react-draggable-dragging': {\n transition: 'none',\n zIndex: 3,\n willChange: 'transform',\n },\n '& .react-grid-item.dropping': {\n visibility: 'hidden',\n },\n '& .react-grid-item.react-grid-placeholder': {\n background: theme.palette.primary.main,\n opacity: 0.2,\n transitionDuration: '100ms',\n zIndex: 2,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none',\n OUserSelect: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n },\n '& .react-grid-item > .react-resizable-handle::after': {\n content: '\"\"',\n position: 'absolute',\n right: '3px',\n bottom: '3px',\n width: '5px',\n height: '5px',\n borderRight: `2px solid ${theme.palette.text.secondary}`,\n borderBottom: `2px solid ${theme.palette.text.secondary}`,\n },\n\n '& .react-resizable-hide > .react-resizable-handle': {\n display: 'none',\n },\n\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w, &.react-grid-item > .react-resizable-handle.react-resizable-handle-e':\n {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n, &.react-grid-item > .react-resizable-handle.react-resizable-handle-s':\n {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-grid-item > .react-resizable-handle.react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n '& .react-resizable': {\n position: 'relative',\n },\n '& .react-resizable-handle': {\n position: 'absolute',\n width: '20px',\n height: '20px',\n backgroundRepeat: 'no-repeat',\n backgroundOrigin: 'content-box',\n boxSizing: 'border-box',\n backgroundImage: `url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+')`,\n backgroundPosition: 'bottom right',\n padding: '0 3px 3px 0',\n },\n '& .react-resizable-handle-sw': {\n bottom: '0',\n left: '0',\n cursor: 'sw-resize',\n transform: 'rotate(90deg)',\n },\n '& .react-resizable-handle-se': {\n bottom: '0',\n right: '0',\n cursor: 'se-resize',\n },\n '& .react-resizable-handle-nw': {\n top: '0',\n left: '0',\n cursor: 'nw-resize',\n transform: 'rotate(180deg)',\n },\n '& .react-resizable-handle-ne': {\n top: '0',\n right: '0',\n cursor: 'ne-resize',\n transform: 'rotate(270deg)',\n },\n '& .react-resizable-handle-w, .react-resizable-handle-e': {\n top: '50%',\n marginTop: '-10px',\n cursor: 'ew-resize',\n },\n '& .react-resizable-handle-w': {\n left: '0',\n transform: 'rotate(135deg)',\n },\n '& .react-resizable-handle-e': {\n right: '0',\n transform: 'rotate(315deg)',\n },\n '& .react-resizable-handle-n, .react-resizable-handle-s': {\n left: '50%',\n marginLeft: '-10px',\n cursor: 'ns-resize',\n },\n '& .react-resizable-handle-n': {\n top: '0',\n transform: 'rotate(225deg)',\n },\n '& .react-resizable-handle-s': {\n bottom: '0',\n transform: 'rotate(45deg)',\n },\n}));\n"],"names":["useEffect","useState","styled","GridContainer","props","isFirstRender","setIsFirstRender","ReactGridLayoutContainer","sx","marginTop","transitionProperty","Array","isArray","data-testid","children","theme","position","transition","pointerEvents","userSelect","zIndex","willChange","visibility","background","palette","primary","main","opacity","transitionDuration","WebkitUserSelect","MozUserSelect","msUserSelect","OUserSelect","width","height","content","right","bottom","borderRight","text","secondary","borderBottom","display","left","cursor","transform","top","marginLeft","backgroundRepeat","backgroundOrigin","boxSizing","backgroundImage","backgroundPosition","padding"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  import { PanelGroupItemId } from '../../context';
3
3
  import { PanelOptions } from '../Panel';
4
4
  export interface GridItemContentProps {
@@ -9,5 +9,5 @@ export interface GridItemContentProps {
9
9
  /**
10
10
  * Resolves the reference to panel content in a GridItemDefinition and renders the panel.
11
11
  */
12
- export declare function GridItemContent(props: GridItemContentProps): JSX.Element;
12
+ export declare function GridItemContent(props: GridItemContentProps): ReactElement;
13
13
  //# sourceMappingURL=GridItemContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridItemContent.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,gBAAgB,EAA0C,MAAM,eAAe,CAAC;AAGzF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAuD1D"}
1
+ {"version":3,"file":"GridItemContent.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAwD,MAAM,eAAe,CAAC;AACvG,OAAO,EAAqB,YAAY,EAAE,MAAM,UAAU,CAAC;AAG3D,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA0EzE"}