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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/cjs/components/Datasources/DatasourceEditor.js +2 -1
  2. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +5 -6
  3. package/dist/cjs/components/GridLayout/GridTitle.js +2 -2
  4. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +2 -2
  5. package/dist/cjs/components/Variables/VariableEditor.js +2 -1
  6. package/dist/cjs/context/VariableProvider/VariableProvider.js +1 -1
  7. package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
  8. package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
  9. package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
  10. package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
  11. package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
  12. package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
  13. package/dist/components/Dashboard/Dashboard.d.ts +2 -1
  14. package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
  15. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  16. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
  17. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  18. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  19. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  20. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  21. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  22. package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
  23. package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
  24. package/dist/components/Datasources/DatasourceEditor.js +2 -1
  25. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  26. package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
  27. package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
  28. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  29. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
  30. package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
  31. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  32. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
  33. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  34. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  35. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
  36. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  37. package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
  38. package/dist/components/DownloadButton/DownloadButton.d.ts +2 -1
  39. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  40. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  41. package/dist/components/EditButton/EditButton.d.ts +2 -1
  42. package/dist/components/EditButton/EditButton.d.ts.map +1 -1
  43. package/dist/components/EditButton/EditButton.js.map +1 -1
  44. package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
  45. package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
  46. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  47. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
  48. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  49. package/dist/components/EditJsonDialog/EditJsonDialog.js +2 -3
  50. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  51. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
  52. package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
  53. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  54. package/dist/components/GridLayout/GridContainer.d.ts +2 -2
  55. package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
  56. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  57. package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
  58. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  59. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  60. package/dist/components/GridLayout/GridLayout.d.ts +2 -1
  61. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  62. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  63. package/dist/components/GridLayout/GridTitle.d.ts +2 -1
  64. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  65. package/dist/components/GridLayout/GridTitle.js +2 -2
  66. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  67. package/dist/components/Panel/PanelContent.d.ts +2 -1
  68. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  69. package/dist/components/Panel/PanelContent.js.map +1 -1
  70. package/dist/components/Panel/PanelHeader.d.ts +2 -2
  71. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  72. package/dist/components/Panel/PanelHeader.js.map +1 -1
  73. package/dist/components/Panel/PanelLinks.d.ts +2 -1
  74. package/dist/components/Panel/PanelLinks.d.ts.map +1 -1
  75. package/dist/components/Panel/PanelLinks.js.map +1 -1
  76. package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
  77. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  78. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  79. package/dist/components/PanelDrawer/PanelEditorForm.d.ts +2 -1
  80. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  81. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  82. package/dist/components/PanelDrawer/PanelPreview.d.ts +2 -1
  83. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  84. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  85. package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -11
  86. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
  87. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
  88. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
  89. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  90. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  91. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
  92. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
  93. package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
  94. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
  95. package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
  96. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  97. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
  98. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
  99. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  100. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
  101. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
  102. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  103. package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
  104. package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
  105. package/dist/components/Variables/BuiltinVariableAccordions.js +2 -2
  106. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  107. package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
  108. package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
  109. package/dist/components/Variables/EditVariablesButton.js.map +1 -1
  110. package/dist/components/Variables/Variable.d.ts +2 -1
  111. package/dist/components/Variables/Variable.d.ts.map +1 -1
  112. package/dist/components/Variables/Variable.js.map +1 -1
  113. package/dist/components/Variables/VariableEditor.d.ts +3 -2
  114. package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
  115. package/dist/components/Variables/VariableEditor.js +2 -1
  116. package/dist/components/Variables/VariableEditor.js.map +1 -1
  117. package/dist/components/Variables/VariableList.d.ts +3 -2
  118. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  119. package/dist/components/Variables/VariableList.js.map +1 -1
  120. package/dist/constants/user-interface-text.d.ts.map +1 -1
  121. package/dist/constants/user-interface-text.js.map +1 -1
  122. package/dist/context/DashboardProvider/DashboardProvider.d.ts +2 -2
  123. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  124. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  125. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +2 -1
  126. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -1
  127. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
  128. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  129. package/dist/context/DashboardProvider/common.js.map +1 -1
  130. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +31 -24
  131. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  132. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  133. package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
  134. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  135. package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
  136. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  137. package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
  138. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  139. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  140. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  141. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  142. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
  143. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  144. package/dist/context/DatasourceStoreProvider.d.ts +2 -2
  145. package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
  146. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  147. package/dist/context/VariableProvider/VariableProvider.d.ts +12 -19
  148. package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
  149. package/dist/context/VariableProvider/VariableProvider.js +1 -1
  150. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  151. package/dist/context/VariableProvider/query-params.d.ts +2 -6
  152. package/dist/context/VariableProvider/query-params.d.ts.map +1 -1
  153. package/dist/context/VariableProvider/query-params.js.map +1 -1
  154. package/dist/context/VariableProvider/utils.d.ts +1 -1
  155. package/dist/context/VariableProvider/utils.d.ts.map +1 -1
  156. package/dist/context/VariableProvider/utils.js.map +1 -1
  157. package/dist/context/useDashboard.d.ts.map +1 -1
  158. package/dist/context/useDashboard.js.map +1 -1
  159. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  160. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  161. package/dist/stories/decorators/WithVariables.js.map +1 -1
  162. package/dist/test/dashboard-provider.d.ts +1 -1
  163. package/dist/test/dashboard-provider.d.ts.map +1 -1
  164. package/dist/test/dashboard-provider.js.map +1 -1
  165. package/dist/test/plugin-registry.d.ts.map +1 -1
  166. package/dist/test/plugin-registry.js.map +1 -1
  167. package/dist/test/render.d.ts +2 -2
  168. package/dist/test/render.d.ts.map +1 -1
  169. package/dist/test/render.js.map +1 -1
  170. package/dist/utils/panelUtils.d.ts.map +1 -1
  171. package/dist/utils/panelUtils.js.map +1 -1
  172. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -2
  173. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  174. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  175. package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -1
  176. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  177. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  178. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DiscardChangesConfirmationDialog } from '@perses-dev/components';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport const DashboardDiscardChangesConfirmationDialog = () => {\n const { discardChangesConfirmationDialog: dialog } = useDiscardChangesConfirmationDialog();\n if (dialog === undefined) {\n return null;\n }\n return (\n <DiscardChangesConfirmationDialog\n description={\n dialog.description ||\n 'You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.'\n }\n isOpen={true}\n onCancel={dialog.onCancel}\n onDiscardChanges={dialog.onDiscardChanges}\n />\n );\n};\n"],"names":["DiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","DashboardDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","dialog","undefined","description","isOpen","onCancel","onDiscardChanges"],"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,gCAAgC,QAAQ,yBAAyB;AAC1E,SAASC,mCAAmC,QAAQ,gBAAgB;AAEpE,OAAO,MAAMC,4CAA4C;IACvD,MAAM,EAAEC,kCAAkCC,MAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,WAAW,IAClB;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI,QAAQ;QACzBC,kBAAkBL,OAAOK,gBAAgB;;AAG/C,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DiscardChangesConfirmationDialog } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport const DashboardDiscardChangesConfirmationDialog = (): ReactElement | null => {\n const { discardChangesConfirmationDialog: dialog } = useDiscardChangesConfirmationDialog();\n if (dialog === undefined) {\n return null;\n }\n return (\n <DiscardChangesConfirmationDialog\n description={\n dialog.description ||\n 'You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.'\n }\n isOpen={true}\n onCancel={dialog.onCancel}\n onDiscardChanges={dialog.onDiscardChanges}\n />\n );\n};\n"],"names":["DiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","DashboardDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","dialog","undefined","description","isOpen","onCancel","onDiscardChanges"],"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,gCAAgC,QAAQ,yBAAyB;AAE1E,SAASC,mCAAmC,QAAQ,gBAAgB;AAEpE,OAAO,MAAMC,4CAA4C;IACvD,MAAM,EAAEC,kCAAkCC,MAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,WAAW,IAClB;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI,QAAQ;QACzBC,kBAAkBL,OAAOK,gBAAgB;;AAG/C,EAAE"}
@@ -1,6 +1,7 @@
1
+ import { ReactElement } from 'react';
1
2
  interface DownloadButtonProps {
2
3
  heightPx?: number;
3
4
  }
4
- export declare function DownloadButton({ heightPx }: DownloadButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function DownloadButton({ heightPx }: DownloadButtonProps): ReactElement;
5
6
  export {};
6
7
  //# sourceMappingURL=DownloadButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/DownloadButton/DownloadButton.tsx"],"names":[],"mappings":"AAmBA,UAAU,mBAAmB;IAE3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAiC/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"}
@@ -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, 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) {\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","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,SAASA,MAAM,QAAQ,QAAQ;AAC/B,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
+ {"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,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface EditButtonProps {
2
3
  /**
3
4
  * The label used inside the button.
@@ -8,5 +9,5 @@ export interface EditButtonProps {
8
9
  */
9
10
  onClick: () => void;
10
11
  }
11
- export declare const EditButton: ({ label, onClick }: EditButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const EditButton: ({ label, onClick }: EditButtonProps) => ReactElement;
12
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,4CAYtE,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"}
@@ -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,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
+ {"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,5 +1,6 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface EditJsonButtonProps {
2
3
  isReadonly: boolean;
3
4
  }
4
- export declare const EditJsonButton: (props: EditJsonButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const EditJsonButton: (props: EditJsonButtonProps) => ReactElement;
5
6
  //# sourceMappingURL=EditJsonButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditJsonButton.d.ts","sourceRoot":"","sources":["../../../src/components/EditJsonButton/EditJsonButton.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CAaxD,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"}
@@ -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, ToolbarIconButton } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../../constants';\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","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;AACxE,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
+ {"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,6 +1,7 @@
1
+ import { ReactElement } from 'react';
1
2
  export interface EditJsonDialogProps {
2
3
  isReadonly: boolean;
3
4
  disableMetadataEdition?: boolean;
4
5
  }
5
- export declare const EditJsonDialog: (props: EditJsonDialogProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const EditJsonDialog: (props: EditJsonDialogProps) => ReactElement;
6
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,4CAYxD,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,8 +15,7 @@ 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
20
  const { isReadonly, disableMetadataEdition } = props;
22
21
  const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();
@@ -63,7 +62,7 @@ const EditJsonDialogForm = (props)=>{
63
62
  try {
64
63
  const json = JSON.parse(dashboard !== null && dashboard !== void 0 ? dashboard : '{}');
65
64
  setDraftDashboard(json);
66
- } catch (e) {
65
+ } catch (_) {
67
66
  // do nothing
68
67
  }
69
68
  };
@@ -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 {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,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,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,cAAc,EAAEC,mBAAmB,EAAE,GAAGP;IAEhD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;gBAAO;;oBACjClC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM4C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;wBAAGC,UAAS;kCAAU;;oBAI9EtB,eAAeuB,IAAI,KAAK,sCACvB,KAAClD;wBAAM4C,IAAI;4BAAEE,cAAc;wBAAE;wBAAGG,UAAS;kCAAU;;kCAIrD,KAAChD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACCgD,WAAU;4BACVC,WAAU;4BACVC,OAAO1B;4BACP2B,UAAU,CAACD,QAAkBhB,uBAAuBgB;4BACpDE,UAAU7C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOsD,OAAO;0BACb,cAAA,KAACtD,OAAOuD,aAAa;oBAACC,SAAS7B;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,EAACF,2BAAAA,qCAAAA,eAAgBG,MAAM;QAAEC,QAAO;QAAQC,SAAS;QAACC,UAAS;;0BACxE,MAAChB,OAAOiB,MAAM;gBAACC,SAAS,IAAMP;;oBAAwB,CAACH,cAAc;oBAAQ;;;YAC5EE,CAAAA,2BAAAA,qC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E;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) => import("react/jsx-runtime").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,4CA2BrB,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"}
@@ -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 = '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 = ({ 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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AAW;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;IAC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SAAS;4BAAQC,KAAK;4BAAGC,WAAW;4BAAGC,gBAAgB;wBAAS;kCAAIT;;;;YAGlFF,gCACC,KAAC1B;gBAAWa,SAAQ;gBAAYgB,IAAI;oBAAEO,WAAW;gBAAG;0BACjDV;;;;AAKX,EAAE"}
@@ -1,8 +1,8 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
  import { SxProps, Theme } from '@mui/material';
3
3
  export interface GridContainerProps {
4
4
  children: ReactNode;
5
5
  sx?: SxProps<Theme>;
6
6
  }
7
- export declare function GridContainer(props: GridContainerProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function GridContainer(props: GridContainerProps): ReactElement;
8
8
  //# sourceMappingURL=GridContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridContainer.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AACvD,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,2CAyBtD"}
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"}
@@ -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 { 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) {\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":"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,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AACvD,SAASC,MAAM,QAAwB,gBAAgB;AAOvD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,CAACC,eAAeC,iBAAiB,GAAGL,SAAS;IACnDD,UAAU;QACR,IAAIK,eAAe;YACjBC,iBAAiB;QACnB;IACF,GAAG;QAACD;KAAc;IAElB,qBACE,KAACE;QACCC,IAAI;YACF;gBACE,kEAAkE;gBAClE,SAAS;oBAAEC,WAAW;gBAAE;gBACxB,0EAA0E;gBAC1E,0EAA0E;gBAC1E,oCAAoC;oBAAEC,oBAAoBL,gBAAgB,SAAS;gBAAY;YACjG;eACIM,MAAM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QAAQ;YACRC,WAAW;QACb;QACA,0EAA0E;YACxEC,KAAK;YACLV,OAAO;YACPQ,QAAQ;YACRC,WAAW;QACb;QACA,+IACE;YACEC,KAAK;YACLrC,WAAW;YACXmC,QAAQ;QACV;QACF,yEAAyE;YACvED,MAAM;YACNE,WAAW;QACb;QACA,yEAAyE;YACvET,OAAO;YACPS,WAAW;QACb;QACA,+IACE;YACEF,MAAM;YACNI,YAAY;YACZH,QAAQ;QACV;QACF,yEAAyE;YACvEE,KAAK;YACLD,WAAW;QACb;QACA,yEAAyE;YACvER,QAAQ;YACRQ,WAAW;QACb;QACA,sBAAsB;YACpB7B,UAAU;QACZ;QACA,6BAA6B;YAC3BA,UAAU;YACViB,OAAO;YACPC,QAAQ;YACRc,kBAAkB;YAClBC,kBAAkB;YAClBC,WAAW;YACXC,iBAAiB,CAAC,qXAAqX,CAAC;YACxYC,oBAAoB;YACpBC,SAAS;QACX;QACA,gCAAgC;YAC9BhB,QAAQ;YACRM,MAAM;YACNC,QAAQ;YACRC,WAAW;QACb;QACA,gCAAgC;YAC9BR,QAAQ;YACRD,OAAO;YACPQ,QAAQ;QACV;QACA,gCAAgC;YAC9BE,KAAK;YACLH,MAAM;YACNC,QAAQ;YACRC,WAAW;QACb;QACA,gCAAgC;YAC9BC,KAAK;YACLV,OAAO;YACPQ,QAAQ;YACRC,WAAW;QACb;QACA,0DAA0D;YACxDC,KAAK;YACLrC,WAAW;YACXmC,QAAQ;QACV;QACA,+BAA+B;YAC7BD,MAAM;YACNE,WAAW;QACb;QACA,+BAA+B;YAC7BT,OAAO;YACPS,WAAW;QACb;QACA,0DAA0D;YACxDF,MAAM;YACNI,YAAY;YACZH,QAAQ;QACV;QACA,+BAA+B;YAC7BE,KAAK;YACLD,WAAW;QACb;QACA,+BAA+B;YAC7BR,QAAQ;YACRQ,WAAW;QACb;IACF,CAAA"}
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":"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,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AACrE,SAASC,MAAM,QAAwB,gBAAgB;AAOvD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,CAACC,eAAeC,iBAAiB,GAAGL,SAAS;IACnDD,UAAU;QACR,IAAIK,eAAe;YACjBC,iBAAiB;QACnB;IACF,GAAG;QAACD;KAAc;IAElB,qBACE,KAACE;QACCC,IAAI;YACF;gBACE,kEAAkE;gBAClE,SAAS;oBAAEC,WAAW;gBAAE;gBACxB,0EAA0E;gBAC1E,0EAA0E;gBAC1E,oCAAoC;oBAAEC,oBAAoBL,gBAAgB,SAAS;gBAAY;YACjG;eACIM,MAAMC,OAAO,CAACR,MAAMI,EAAE,IAAIJ,MAAMI,EAAE,GAAG;gBAACJ,MAAMI,EAAE;aAAC;SACpD;QACDK,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ACA,+IACE;YACEC,KAAK;YACLrC,WAAW;YACXmC,QAAQ;QACV;QACF,yEAAyE;YACvED,MAAM;YACNE,WAAW;QACb;QACA,yEAAyE;YACvET,OAAO;YACPS,WAAW;QACb;QACA,+IACE;YACEF,MAAM;YACNI,YAAY;YACZH,QAAQ;QACV;QACF,yEAAyE;YACvEE,KAAK;YACLD,WAAW;QACb;QACA,yEAAyE;YACvER,QAAQ;YACRQ,WAAW;QACb;QACA,sBAAsB;YACpB7B,UAAU;QACZ;QACA,6BAA6B;YAC3BA,UAAU;YACViB,OAAO;YACPC,QAAQ;YACRc,kBAAkB;YAClBC,kBAAkB;YAClBC,WAAW;YACXC,iBAAiB,CAAC,qXAAqX,CAAC;YACxYC,oBAAoB;YACpBC,SAAS;QACX;QACA,gCAAgC;YAC9BhB,QAAQ;YACRM,MAAM;YACNC,QAAQ;YACRC,WAAW;QACb;QACA,gCAAgC;YAC9BR,QAAQ;YACRD,OAAO;YACPQ,QAAQ;QACV;QACA,gCAAgC;YAC9BE,KAAK;YACLH,MAAM;YACNC,QAAQ;YACRC,WAAW;QACb;QACA,gCAAgC;YAC9BC,KAAK;YACLV,OAAO;YACPQ,QAAQ;YACRC,WAAW;QACb;QACA,0DAA0D;YACxDC,KAAK;YACLrC,WAAW;YACXmC,QAAQ;QACV;QACA,+BAA+B;YAC7BD,MAAM;YACNE,WAAW;QACb;QACA,+BAA+B;YAC7BT,OAAO;YACPS,WAAW;QACb;QACA,0DAA0D;YACxDF,MAAM;YACNI,YAAY;YACZH,QAAQ;QACV;QACA,+BAA+B;YAC7BE,KAAK;YACLD,WAAW;QACb;QACA,+BAA+B;YAC7BR,QAAQ;YACRQ,WAAW;QACb;IACF,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  import { PanelGroupItemId } from '../../context';
2
3
  import { PanelOptions } from '../Panel';
3
4
  export interface GridItemContentProps {
@@ -8,5 +9,5 @@ export interface GridItemContentProps {
8
9
  /**
9
10
  * Resolves the reference to panel content in a GridItemDefinition and renders the panel.
10
11
  */
11
- export declare function GridItemContent(props: GridItemContentProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function GridItemContent(props: GridItemContentProps): ReactElement;
12
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,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,2CA0E1D"}
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"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { useInView } from 'react-intersection-observer';\nimport { DataQueriesProvider, usePlugin, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport { PanelGroupItemId, useEditMode, usePanel, usePanelActions, useViewPanel } from '../../context';\nimport { Panel, PanelProps, PanelOptions } from '../Panel';\nimport { isPanelGroupItemIdEqual } from '../../context/DashboardProvider/panel-group-slice';\n\nexport interface GridItemContentProps {\n panelGroupItemId: PanelGroupItemId;\n width: number; // necessary for determining the suggested step ms\n panelOptions?: PanelOptions;\n}\n\n/**\n * Resolves the reference to panel content in a GridItemDefinition and renders the panel.\n */\nexport function GridItemContent(props: GridItemContentProps) {\n const { panelGroupItemId, width } = props;\n const panelDefinition = usePanel(panelGroupItemId);\n const {\n spec: { queries },\n } = panelDefinition;\n const { isEditMode } = useEditMode();\n const { openEditPanel, openDeletePanelDialog, duplicatePanel, viewPanel } = usePanelActions(panelGroupItemId);\n const viewPanelGroupItemId = useViewPanel();\n const { ref, inView } = useInView({\n threshold: 0.2, // we have the flexibility to adjust this threshold to trigger queries slightly earlier or later based on performance\n initialInView: false,\n triggerOnce: true,\n });\n\n const readHandlers = {\n isPanelViewed: isPanelGroupItemIdEqual(viewPanelGroupItemId, panelGroupItemId),\n onViewPanelClick: function () {\n if (viewPanelGroupItemId === undefined) {\n viewPanel(panelGroupItemId);\n } else {\n viewPanel(undefined);\n }\n },\n };\n\n // Provide actions to the panel when in edit mode\n let editHandlers: PanelProps['editHandlers'] = undefined;\n if (isEditMode) {\n editHandlers = {\n onEditPanelClick: openEditPanel,\n onDuplicatePanelClick: duplicatePanel,\n onDeletePanelClick: openDeletePanelDialog,\n };\n }\n\n // map TimeSeriesQueryDefinition to Definition<UnknownSpec>\n const suggestedStepMs = useSuggestedStepMs(width);\n\n const { data: plugin } = usePlugin('Panel', panelDefinition.spec.plugin.kind);\n\n const queryDefinitions = queries ?? [];\n const definitions = queryDefinitions.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n });\n\n return (\n <Box\n ref={ref}\n sx={{\n width: '100%',\n height: '100%',\n }}\n >\n <DataQueriesProvider\n definitions={definitions}\n options={{ suggestedStepMs, ...plugin?.queryOptions }}\n queryOptions={{ enabled: inView }}\n >\n {inView && (\n <Panel\n definition={panelDefinition}\n readHandlers={readHandlers}\n editHandlers={editHandlers}\n panelOptions={props.panelOptions}\n panelGroupItemId={panelGroupItemId}\n />\n )}\n </DataQueriesProvider>\n </Box>\n );\n}\n"],"names":["Box","useInView","DataQueriesProvider","usePlugin","useSuggestedStepMs","useEditMode","usePanel","usePanelActions","useViewPanel","Panel","isPanelGroupItemIdEqual","GridItemContent","props","panelGroupItemId","width","panelDefinition","spec","queries","isEditMode","openEditPanel","openDeletePanelDialog","duplicatePanel","viewPanel","viewPanelGroupItemId","ref","inView","threshold","initialInView","triggerOnce","readHandlers","isPanelViewed","onViewPanelClick","undefined","editHandlers","onEditPanelClick","onDuplicatePanelClick","onDeletePanelClick","suggestedStepMs","data","plugin","kind","queryDefinitions","definitions","map","query","sx","height","options","queryOptions","enabled","definition","panelOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,mBAAmB,EAAEC,SAAS,EAAEC,kBAAkB,QAAQ,4BAA4B;AAC/F,SAA2BC,WAAW,EAAEC,QAAQ,EAAEC,eAAe,EAAEC,YAAY,QAAQ,gBAAgB;AACvG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AAI;YACF/B,OAAO;YACPgC,QAAQ;QACV;kBAEA,cAAA,KAAC5C;YACCwC,aAAaA;YACbK,SAAS;gBAAEV;mBAAoBE,mBAAAA,6BAAAA,OAAQS,YAAY,AAAvB;YAAwB;YACpDA,cAAc;gBAAEC,SAASxB;YAAO;sBAE/BA,wBACC,KAAChB;gBACCyC,YAAYnC;gBACZc,cAAcA;gBACdI,cAAcA;gBACdkB,cAAcvC,MAAMuC,YAAY;gBAChCtC,kBAAkBA;;;;AAM9B"}
1
+ {"version":3,"sources":["../../../src/components/GridLayout/GridItemContent.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { useInView } from 'react-intersection-observer';\nimport { DataQueriesProvider, usePlugin, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { PanelGroupItemId, useEditMode, usePanel, usePanelActions, useViewPanel } from '../../context';\nimport { Panel, PanelProps, PanelOptions } from '../Panel';\nimport { isPanelGroupItemIdEqual } from '../../context/DashboardProvider/panel-group-slice';\n\nexport interface GridItemContentProps {\n panelGroupItemId: PanelGroupItemId;\n width: number; // necessary for determining the suggested step ms\n panelOptions?: PanelOptions;\n}\n\n/**\n * Resolves the reference to panel content in a GridItemDefinition and renders the panel.\n */\nexport function GridItemContent(props: GridItemContentProps): ReactElement {\n const { panelGroupItemId, width } = props;\n const panelDefinition = usePanel(panelGroupItemId);\n const {\n spec: { queries },\n } = panelDefinition;\n const { isEditMode } = useEditMode();\n const { openEditPanel, openDeletePanelDialog, duplicatePanel, viewPanel } = usePanelActions(panelGroupItemId);\n const viewPanelGroupItemId = useViewPanel();\n const { ref, inView } = useInView({\n threshold: 0.2, // we have the flexibility to adjust this threshold to trigger queries slightly earlier or later based on performance\n initialInView: false,\n triggerOnce: true,\n });\n\n const readHandlers = {\n isPanelViewed: isPanelGroupItemIdEqual(viewPanelGroupItemId, panelGroupItemId),\n onViewPanelClick: function (): void {\n if (viewPanelGroupItemId === undefined) {\n viewPanel(panelGroupItemId);\n } else {\n viewPanel(undefined);\n }\n },\n };\n\n // Provide actions to the panel when in edit mode\n let editHandlers: PanelProps['editHandlers'] = undefined;\n if (isEditMode) {\n editHandlers = {\n onEditPanelClick: openEditPanel,\n onDuplicatePanelClick: duplicatePanel,\n onDeletePanelClick: openDeletePanelDialog,\n };\n }\n\n // map TimeSeriesQueryDefinition to Definition<UnknownSpec>\n const suggestedStepMs = useSuggestedStepMs(width);\n\n const { data: plugin } = usePlugin('Panel', panelDefinition.spec.plugin.kind);\n\n const queryDefinitions = queries ?? [];\n const definitions = queryDefinitions.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n });\n\n return (\n <Box\n ref={ref}\n sx={{\n width: '100%',\n height: '100%',\n }}\n >\n <DataQueriesProvider\n definitions={definitions}\n options={{ suggestedStepMs, ...plugin?.queryOptions }}\n queryOptions={{ enabled: inView }}\n >\n {inView && (\n <Panel\n definition={panelDefinition}\n readHandlers={readHandlers}\n editHandlers={editHandlers}\n panelOptions={props.panelOptions}\n panelGroupItemId={panelGroupItemId}\n />\n )}\n </DataQueriesProvider>\n </Box>\n );\n}\n"],"names":["Box","useInView","DataQueriesProvider","usePlugin","useSuggestedStepMs","useEditMode","usePanel","usePanelActions","useViewPanel","Panel","isPanelGroupItemIdEqual","GridItemContent","props","panelGroupItemId","width","panelDefinition","spec","queries","isEditMode","openEditPanel","openDeletePanelDialog","duplicatePanel","viewPanel","viewPanelGroupItemId","ref","inView","threshold","initialInView","triggerOnce","readHandlers","isPanelViewed","onViewPanelClick","undefined","editHandlers","onEditPanelClick","onDuplicatePanelClick","onDeletePanelClick","suggestedStepMs","data","plugin","kind","queryDefinitions","definitions","map","query","sx","height","options","queryOptions","enabled","definition","panelOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,mBAAmB,EAAEC,SAAS,EAAEC,kBAAkB,QAAQ,4BAA4B;AAE/F,SAA2BC,WAAW,EAAEC,QAAQ,EAAEC,eAAe,EAAEC,YAAY,QAAQ,gBAAgB;AACvG,SAASC,KAAK,QAAkC,WAAW;AAC3D,SAASC,uBAAuB,QAAQ,oDAAoD;AAQ5F;;CAEC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,gBAAgB,EAAEC,KAAK,EAAE,GAAGF;IACpC,MAAMG,kBAAkBT,SAASO;IACjC,MAAM,EACJG,MAAM,EAAEC,OAAO,EAAE,EAClB,GAAGF;IACJ,MAAM,EAAEG,UAAU,EAAE,GAAGb;IACvB,MAAM,EAAEc,aAAa,EAAEC,qBAAqB,EAAEC,cAAc,EAAEC,SAAS,EAAE,GAAGf,gBAAgBM;IAC5F,MAAMU,uBAAuBf;IAC7B,MAAM,EAAEgB,GAAG,EAAEC,MAAM,EAAE,GAAGxB,UAAU;QAChCyB,WAAW;QACXC,eAAe;QACfC,aAAa;IACf;IAEA,MAAMC,eAAe;QACnBC,eAAepB,wBAAwBa,sBAAsBV;QAC7DkB,kBAAkB;YAChB,IAAIR,yBAAyBS,WAAW;gBACtCV,UAAUT;YACZ,OAAO;gBACLS,UAAUU;YACZ;QACF;IACF;IAEA,iDAAiD;IACjD,IAAIC,eAA2CD;IAC/C,IAAId,YAAY;QACde,eAAe;YACbC,kBAAkBf;YAClBgB,uBAAuBd;YACvBe,oBAAoBhB;QACtB;IACF;IAEA,2DAA2D;IAC3D,MAAMiB,kBAAkBjC,mBAAmBU;IAE3C,MAAM,EAAEwB,MAAMC,MAAM,EAAE,GAAGpC,UAAU,SAASY,gBAAgBC,IAAI,CAACuB,MAAM,CAACC,IAAI;IAE5E,MAAMC,mBAAmBxB,oBAAAA,qBAAAA,UAAW,EAAE;IACtC,MAAMyB,cAAcD,iBAAiBE,GAAG,CAAC,CAACC;QACxC,OAAO;YACLJ,MAAMI,MAAM5B,IAAI,CAACuB,MAAM,CAACC,IAAI;YAC5BxB,MAAM4B,MAAM5B,IAAI,CAACuB,MAAM,CAACvB,IAAI;QAC9B;IACF;IAEA,qBACE,KAAChB;QACCwB,KAAKA;QACLqB,IAAI;YACF/B,OAAO;YACPgC,QAAQ;QACV;kBAEA,cAAA,KAAC5C;YACCwC,aAAaA;YACbK,SAAS;gBAAEV;mBAAoBE,mBAAAA,6BAAAA,OAAQS,YAAY,AAAvB;YAAwB;YACpDA,cAAc;gBAAEC,SAASxB;YAAO;sBAE/BA,wBACC,KAAChB;gBACCyC,YAAYnC;gBACZc,cAAcA;gBACdI,cAAcA;gBACdkB,cAAcvC,MAAMuC,YAAY;gBAChCtC,kBAAkBA;;;;AAM9B"}
@@ -1,3 +1,4 @@
1
+ import { ReactElement } from 'react';
1
2
  import { PanelGroupId } from '@perses-dev/core';
2
3
  import { PanelOptions } from '../Panel';
3
4
  export interface GridLayoutProps {
@@ -8,5 +9,5 @@ export interface GridLayoutProps {
8
9
  /**
9
10
  * Layout component that arranges children in a Grid based on the definition.
10
11
  */
11
- export declare function GridLayout(props: GridLayoutProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function GridLayout(props: GridLayoutProps): ReactElement;
12
13
  //# sourceMappingURL=GridLayout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUhD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAOxC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAqIhD"}
1
+ {"version":3,"file":"GridLayout.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridLayout.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAUhD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAOxC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAqI/D"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/GridLayout/GridLayout.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.\nimport { useMemo, useState } from 'react';\nimport { Responsive, WidthProvider, Layouts, Layout } from 'react-grid-layout';\nimport { Collapse, useTheme } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { PanelGroupId } from '@perses-dev/core';\nimport {\n useEditMode,\n usePanelGroup,\n usePanelGroupActions,\n PanelGroupItemLayout,\n useViewPanel,\n PanelGroupDefinition,\n} from '../../context';\nimport { GRID_LAYOUT_COLS, GRID_LAYOUT_SMALL_BREAKPOINT } from '../../constants';\nimport { PanelOptions } from '../Panel';\nimport { GridTitle } from './GridTitle';\nimport { GridItemContent } from './GridItemContent';\nimport { GridContainer } from './GridContainer';\nconst DEFAULT_MARGIN = 10;\nconst ROW_HEIGHT = 30;\n\nexport interface GridLayoutProps {\n panelGroupId: PanelGroupId;\n panelOptions?: PanelOptions;\n panelFullHeight?: number;\n}\n\n/**\n * Layout component that arranges children in a Grid based on the definition.\n */\nexport function GridLayout(props: GridLayoutProps) {\n const { panelGroupId, panelOptions, panelFullHeight } = props;\n const theme = useTheme();\n const groupDefinition: PanelGroupDefinition = usePanelGroup(panelGroupId);\n const { updatePanelGroupLayouts } = usePanelGroupActions(panelGroupId);\n\n const [isOpen, setIsOpen] = useState(!groupDefinition.isCollapsed ?? true);\n const { isEditMode } = useEditMode();\n\n const [gridColWidth, setGridColWidth] = useState(0);\n\n const viewPanelItemId = useViewPanel();\n const hasViewPanel = viewPanelItemId?.panelGroupId === panelGroupId; // current panelGroup contains the panel extended?\n const itemLayoutViewed = viewPanelItemId?.panelGroupItemLayoutId;\n\n // If there is a panel in view mode, we should hide the grid if the panel is not in the current group.\n const isGridDisplayed = useMemo(() => {\n if (viewPanelItemId === undefined) {\n return true;\n }\n if (hasViewPanel) {\n setIsOpen(true);\n }\n return hasViewPanel;\n }, [hasViewPanel, viewPanelItemId]);\n\n // Item layout is override if there is a panel in view mode\n const itemLayouts: PanelGroupItemLayout[] = useMemo(() => {\n if (itemLayoutViewed) {\n return groupDefinition.itemLayouts.map((itemLayout) => {\n if (itemLayout.i === itemLayoutViewed) {\n const rowTitleHeight = 40 + 8; // 40 is the height of the row title and 8 is the margin height\n return {\n h: Math.round(((panelFullHeight ?? window.innerHeight) - rowTitleHeight) / (ROW_HEIGHT + DEFAULT_MARGIN)), // Viewed panel should take the full height remaining\n i: itemLayoutViewed,\n w: 48,\n x: 0,\n y: 0,\n } as PanelGroupItemLayout;\n }\n return itemLayout;\n });\n }\n return groupDefinition.itemLayouts;\n }, [groupDefinition.itemLayouts, itemLayoutViewed, panelFullHeight]);\n\n const handleLayoutChange = (currentLayout: Layout[], allLayouts: Layouts) => {\n // Using the value from `allLayouts` instead of `currentLayout` because of\n // a bug in react-layout-grid where `currentLayout` does not adjust properly\n // when going to a smaller breakpoint and then back to a larger breakpoint.\n // https://github.com/react-grid-layout/react-grid-layout/issues/1663\n const smallLayout = allLayouts[GRID_LAYOUT_SMALL_BREAKPOINT];\n if (smallLayout && !hasViewPanel) {\n updatePanelGroupLayouts(smallLayout);\n }\n };\n\n /**\n * Calculate the column width so we can determine the width of each panel for suggested step ms\n * https://github.com/react-grid-layout/react-grid-layout/blob/master/lib/calculateUtils.js#L14-L35\n */\n const handleWidthChange = (\n containerWidth: number,\n margin: [number, number],\n cols: number,\n containerPadding: [number, number]\n ) => {\n const marginX = margin[0];\n const marginWidth = marginX * (cols - 1);\n const containerPaddingWidth = containerPadding[0] * 2;\n // exclude margin and padding from total width\n setGridColWidth((containerWidth - marginWidth - containerPaddingWidth) / cols);\n };\n\n // https://github.com/react-grid-layout/react-grid-layout?tab=readme-ov-file#react-hooks-performance\n const ResponsiveGridLayout = useMemo(() => WidthProvider(Responsive), []);\n\n return (\n <GridContainer\n sx={{\n display: isGridDisplayed ? 'block' : 'none',\n height: itemLayoutViewed ? `${panelFullHeight}px` : 'unset',\n overflow: itemLayoutViewed ? 'hidden' : 'unset',\n }}\n >\n {groupDefinition.title !== undefined && (\n <GridTitle\n panelGroupId={panelGroupId}\n title={groupDefinition.title}\n collapse={\n groupDefinition.isCollapsed === undefined\n ? undefined\n : { isOpen, onToggleOpen: () => setIsOpen((current) => !current) }\n }\n />\n )}\n <Collapse in={isOpen} unmountOnExit appear={false} data-testid=\"panel-group-content\">\n <ResponsiveGridLayout\n className=\"layout\"\n breakpoints={{ sm: theme.breakpoints.values.sm, xxs: 0 }}\n cols={GRID_LAYOUT_COLS}\n rowHeight={ROW_HEIGHT}\n draggableHandle=\".drag-handle\"\n resizeHandles={['se']}\n isDraggable={isEditMode && !hasViewPanel}\n isResizable={isEditMode && !hasViewPanel}\n margin={[DEFAULT_MARGIN, DEFAULT_MARGIN]}\n containerPadding={[0, 10]}\n layouts={{ [GRID_LAYOUT_SMALL_BREAKPOINT]: itemLayouts }}\n onLayoutChange={handleLayoutChange}\n onWidthChange={handleWidthChange}\n allowOverlap={hasViewPanel} // Enabling overlap when viewing a specific panel because panel in front of the viewed panel will add empty spaces (empty row height)\n >\n {itemLayouts.map(({ i, w }) => (\n <div\n key={i}\n style={{\n display: itemLayoutViewed !== undefined ? (itemLayoutViewed === i ? 'unset' : 'none') : 'unset',\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <GridItemContent\n panelOptions={panelOptions}\n panelGroupItemId={{ panelGroupId, panelGroupItemLayoutId: i }}\n width={calculateGridItemWidth(w, gridColWidth)}\n />\n </ErrorBoundary>\n </div>\n ))}\n </ResponsiveGridLayout>\n </Collapse>\n </GridContainer>\n );\n}\n\n/**\n * Calculates grid item width\n * @param w number of columns the grid item spans\n * @param colWidth the width of each column in px\n * @returns grid item's width in px\n * https://github.com/react-grid-layout/react-grid-layout/blob/master/lib/calculateUtils.js#L14-L35\n */\nconst calculateGridItemWidth = (w: number, colWidth: number) => {\n // 0 * Infinity === NaN, which causes problems with resize contraints\n if (!Number.isFinite(w)) return w;\n return Math.round(colWidth * w + Math.max(0, w - 1) * DEFAULT_MARGIN);\n};\n"],"names":["useMemo","useState","Responsive","WidthProvider","Collapse","useTheme","ErrorAlert","ErrorBoundary","useEditMode","usePanelGroup","usePanelGroupActions","useViewPanel","GRID_LAYOUT_COLS","GRID_LAYOUT_SMALL_BREAKPOINT","GridTitle","GridItemContent","GridContainer","DEFAULT_MARGIN","ROW_HEIGHT","GridLayout","props","panelGroupId","panelOptions","panelFullHeight","theme","groupDefinition","updatePanelGroupLayouts","isOpen","setIsOpen","isCollapsed","isEditMode","gridColWidth","setGridColWidth","viewPanelItemId","hasViewPanel","itemLayoutViewed","panelGroupItemLayoutId","isGridDisplayed","undefined","itemLayouts","map","itemLayout","i","rowTitleHeight","h","Math","round","window","innerHeight","w","x","y","handleLayoutChange","currentLayout","allLayouts","smallLayout","handleWidthChange","containerWidth","margin","cols","containerPadding","marginX","marginWidth","containerPaddingWidth","ResponsiveGridLayout","sx","display","height","overflow","title","collapse","onToggleOpen","current","in","unmountOnExit","appear","data-testid","className","breakpoints","sm","values","xxs","rowHeight","draggableHandle","resizeHandles","isDraggable","isResizable","layouts","onLayoutChange","onWidthChange","allowOverlap","div","style","FallbackComponent","panelGroupItemId","width","calculateGridItemWidth","colWidth","Number","isFinite","max"],"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;;AACjC,SAASA,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC1C,SAASC,UAAU,EAAEC,aAAa,QAAyB,oBAAoB;AAC/E,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,gBAAgB;AACnD,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,SACEC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EAEpBC,YAAY,QAEP,gBAAgB;AACvB,SAASC,gBAAgB,EAAEC,4BAA4B,QAAQ,kBAAkB;AAEjF,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,MAAMC,iBAAiB;AACvB,MA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oBAAE;oBACvDtB,MAAM/C;oBACNsE,WAAWhE;oBACXiE,iBAAgB;oBAChBC,eAAe;wBAAC;qBAAK;oBACrBC,aAAavD,cAAc,CAACI;oBAC5BoD,aAAaxD,cAAc,CAACI;oBAC5BwB,QAAQ;wBAACzC;wBAAgBA;qBAAe;oBACxC2C,kBAAkB;wBAAC;wBAAG;qBAAG;oBACzB2B,SAAS;wBAAE,CAAC1E,6BAA6B,EAAE0B;oBAAY;oBACvDiD,gBAAgBpC;oBAChBqC,eAAejC;oBACfkC,cAAcxD;8BAEbK,YAAYC,GAAG,CAAC,CAAC,EAAEE,CAAC,EAAEO,CAAC,EAAE,iBACxB,KAAC0C;4BAECC,OAAO;gCACL1B,SAAS/B,qBAAqBG,YAAaH,qBAAqBO,IAAI,UAAU,SAAU;4BAC1F;sCAEA,cAAA,KAACnC;gCAAcsF,mBAAmBvF;0CAChC,cAAA,KAACS;oCACCO,cAAcA;oCACdwE,kBAAkB;wCAAEzE;wCAAce,wBAAwBM;oCAAE;oCAC5DqD,OAAOC,uBAAuB/C,GAAGlB;;;2BAThCW;;;;;AAkBnB;AAEA;;;;;;CAMC,GACD,MAAMsD,yBAAyB,CAAC/C,GAAWgD;IACzC,qEAAqE;IACrE,IAAI,CAACC,OAAOC,QAAQ,CAAClD,IAAI,OAAOA;IAChC,OAAOJ,KAAKC,KAAK,CAACmD,WAAWhD,IAAIJ,KAAKuD,GAAG,CAAC,GAAGnD,IAAI,KAAKhC;AACxD"}
1
+ {"version":3,"sources":["../../../src/components/GridLayout/GridLayout.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.\nimport { ReactElement, useMemo, useState } from 'react';\nimport { Responsive, WidthProvider, Layouts, Layout } from 'react-grid-layout';\nimport { Collapse, useTheme } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { PanelGroupId } from '@perses-dev/core';\nimport {\n useEditMode,\n usePanelGroup,\n usePanelGroupActions,\n PanelGroupItemLayout,\n useViewPanel,\n PanelGroupDefinition,\n} from '../../context';\nimport { GRID_LAYOUT_COLS, GRID_LAYOUT_SMALL_BREAKPOINT } from '../../constants';\nimport { PanelOptions } from '../Panel';\nimport { GridTitle } from './GridTitle';\nimport { GridItemContent } from './GridItemContent';\nimport { GridContainer } from './GridContainer';\nconst DEFAULT_MARGIN = 10;\nconst ROW_HEIGHT = 30;\n\nexport interface GridLayoutProps {\n panelGroupId: PanelGroupId;\n panelOptions?: PanelOptions;\n panelFullHeight?: number;\n}\n\n/**\n * Layout component that arranges children in a Grid based on the definition.\n */\nexport function GridLayout(props: GridLayoutProps): ReactElement {\n const { panelGroupId, panelOptions, panelFullHeight } = props;\n const theme = useTheme();\n const groupDefinition: PanelGroupDefinition = usePanelGroup(panelGroupId);\n const { updatePanelGroupLayouts } = usePanelGroupActions(panelGroupId);\n\n const [isOpen, setIsOpen] = useState(!groupDefinition.isCollapsed ?? true);\n const { isEditMode } = useEditMode();\n\n const [gridColWidth, setGridColWidth] = useState(0);\n\n const viewPanelItemId = useViewPanel();\n const hasViewPanel = viewPanelItemId?.panelGroupId === panelGroupId; // current panelGroup contains the panel extended?\n const itemLayoutViewed = viewPanelItemId?.panelGroupItemLayoutId;\n\n // If there is a panel in view mode, we should hide the grid if the panel is not in the current group.\n const isGridDisplayed = useMemo(() => {\n if (viewPanelItemId === undefined) {\n return true;\n }\n if (hasViewPanel) {\n setIsOpen(true);\n }\n return hasViewPanel;\n }, [hasViewPanel, viewPanelItemId]);\n\n // Item layout is override if there is a panel in view mode\n const itemLayouts: PanelGroupItemLayout[] = useMemo(() => {\n if (itemLayoutViewed) {\n return groupDefinition.itemLayouts.map((itemLayout) => {\n if (itemLayout.i === itemLayoutViewed) {\n const rowTitleHeight = 40 + 8; // 40 is the height of the row title and 8 is the margin height\n return {\n h: Math.round(((panelFullHeight ?? window.innerHeight) - rowTitleHeight) / (ROW_HEIGHT + DEFAULT_MARGIN)), // Viewed panel should take the full height remaining\n i: itemLayoutViewed,\n w: 48,\n x: 0,\n y: 0,\n } as PanelGroupItemLayout;\n }\n return itemLayout;\n });\n }\n return groupDefinition.itemLayouts;\n }, [groupDefinition.itemLayouts, itemLayoutViewed, panelFullHeight]);\n\n const handleLayoutChange = (currentLayout: Layout[], allLayouts: Layouts): void => {\n // Using the value from `allLayouts` instead of `currentLayout` because of\n // a bug in react-layout-grid where `currentLayout` does not adjust properly\n // when going to a smaller breakpoint and then back to a larger breakpoint.\n // https://github.com/react-grid-layout/react-grid-layout/issues/1663\n const smallLayout = allLayouts[GRID_LAYOUT_SMALL_BREAKPOINT];\n if (smallLayout && !hasViewPanel) {\n updatePanelGroupLayouts(smallLayout);\n }\n };\n\n /**\n * Calculate the column width so we can determine the width of each panel for suggested step ms\n * https://github.com/react-grid-layout/react-grid-layout/blob/master/lib/calculateUtils.js#L14-L35\n */\n const handleWidthChange = (\n containerWidth: number,\n margin: [number, number],\n cols: number,\n containerPadding: [number, number]\n ): void => {\n const marginX = margin[0];\n const marginWidth = marginX * (cols - 1);\n const containerPaddingWidth = containerPadding[0] * 2;\n // exclude margin and padding from total width\n setGridColWidth((containerWidth - marginWidth - containerPaddingWidth) / cols);\n };\n\n // https://github.com/react-grid-layout/react-grid-layout?tab=readme-ov-file#react-hooks-performance\n const ResponsiveGridLayout = useMemo(() => WidthProvider(Responsive), []);\n\n return (\n <GridContainer\n sx={{\n display: isGridDisplayed ? 'block' : 'none',\n height: itemLayoutViewed ? `${panelFullHeight}px` : 'unset',\n overflow: itemLayoutViewed ? 'hidden' : 'unset',\n }}\n >\n {groupDefinition.title !== undefined && (\n <GridTitle\n panelGroupId={panelGroupId}\n title={groupDefinition.title}\n collapse={\n groupDefinition.isCollapsed === undefined\n ? undefined\n : { isOpen, onToggleOpen: () => setIsOpen((current) => !current) }\n }\n />\n )}\n <Collapse in={isOpen} unmountOnExit appear={false} data-testid=\"panel-group-content\">\n <ResponsiveGridLayout\n className=\"layout\"\n breakpoints={{ sm: theme.breakpoints.values.sm, xxs: 0 }}\n cols={GRID_LAYOUT_COLS}\n rowHeight={ROW_HEIGHT}\n draggableHandle=\".drag-handle\"\n resizeHandles={['se']}\n isDraggable={isEditMode && !hasViewPanel}\n isResizable={isEditMode && !hasViewPanel}\n margin={[DEFAULT_MARGIN, DEFAULT_MARGIN]}\n containerPadding={[0, 10]}\n layouts={{ [GRID_LAYOUT_SMALL_BREAKPOINT]: itemLayouts }}\n onLayoutChange={handleLayoutChange}\n onWidthChange={handleWidthChange}\n allowOverlap={hasViewPanel} // Enabling overlap when viewing a specific panel because panel in front of the viewed panel will add empty spaces (empty row height)\n >\n {itemLayouts.map(({ i, w }) => (\n <div\n key={i}\n style={{\n display: itemLayoutViewed !== undefined ? (itemLayoutViewed === i ? 'unset' : 'none') : 'unset',\n }}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <GridItemContent\n panelOptions={panelOptions}\n panelGroupItemId={{ panelGroupId, panelGroupItemLayoutId: i }}\n width={calculateGridItemWidth(w, gridColWidth)}\n />\n </ErrorBoundary>\n </div>\n ))}\n </ResponsiveGridLayout>\n </Collapse>\n </GridContainer>\n );\n}\n\n/**\n * Calculates grid item width\n * @param w number of columns the grid item spans\n * @param colWidth the width of each column in px\n * @returns grid item's width in px\n * https://github.com/react-grid-layout/react-grid-layout/blob/master/lib/calculateUtils.js#L14-L35\n */\nconst calculateGridItemWidth = (w: number, colWidth: number): number => {\n // 0 * Infinity === NaN, which causes problems with resize contraints\n if (!Number.isFinite(w)) return w;\n return Math.round(colWidth * w + Math.max(0, w - 1) * DEFAULT_MARGIN);\n};\n"],"names":["useMemo","useState","Responsive","WidthProvider","Collapse","useTheme","ErrorAlert","ErrorBoundary","useEditMode","usePanelGroup","usePanelGroupActions","useViewPanel","GRID_LAYOUT_COLS","GRID_LAYOUT_SMALL_BREAKPOINT","GridTitle","GridItemContent","GridContainer","DEFAULT_MARGIN","ROW_HEIGHT","GridLayout","props","panelGroupId","panelOptions","panelFullHeight","theme","groupDefinition","updatePanelGroupLayouts","isOpen","setIsOpen","isCollapsed","isEditMode","gridColWidth","setGridColWidth","viewPanelItemId","hasViewPanel","itemLayoutViewed","panelGroupItemLayoutId","isGridDisplayed","undefined","itemLayouts","map","itemLayout","i","rowTitleHeight","h","Math","round","window","innerHeight","w","x","y","handleLayoutChange","currentLayout","allLayouts","smallLayout","handleWidthChange","containerWidth","margin","cols","containerPadding","marginX","marginWidth","containerPaddingWidth","ResponsiveGridLayout","sx","display","height","overflow","title","collapse","onToggleOpen","current","in","unmountOnExit","appear","data-testid","className","breakpoints","sm","values","xxs","rowHeight","draggableHandle","resizeHandles","isDraggable","isResizable","layouts","onLayoutChange","onWidthChange","allowOverlap","div","style","FallbackComponent","panelGroupItemId","width","calculateGridItemWidth","colWidth","Number","isFinite","max"],"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;;AACjC,SAAuBA,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACxD,SAASC,UAAU,EAAEC,aAAa,QAAyB,oBAAoB;AAC/E,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,gBAAgB;AACnD,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,SACEC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EAEpBC,YAAY,QAEP,gBAAgB;AACvB,SAASC,gBAAgB,EAAEC,4BAA4B,QAAQ,kBAAkB;AAEjF,SAAS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;0BAC7D,cAAA,KAACZ;oBACCa,WAAU;oBACVC,aAAa;wBAAEC,IAAIvD,MAAMsD,WAAW,CAACE,MAAM,CAACD,EAAE;wBAAEE,KAAK;oBAAE;oBACvDtB,MAAM/C;oBACNsE,WAAWhE;oBACXiE,iBAAgB;oBAChBC,eAAe;wBAAC;qBAAK;oBACrBC,aAAavD,cAAc,CAACI;oBAC5BoD,aAAaxD,cAAc,CAACI;oBAC5BwB,QAAQ;wBAACzC;wBAAgBA;qBAAe;oBACxC2C,kBAAkB;wBAAC;wBAAG;qBAAG;oBACzB2B,SAAS;wBAAE,CAAC1E,6BAA6B,EAAE0B;oBAAY;oBACvDiD,gBAAgBpC;oBAChBqC,eAAejC;oBACfkC,cAAcxD;8BAEbK,YAAYC,GAAG,CAAC,CAAC,EAAEE,CAAC,EAAEO,CAAC,EAAE,iBACxB,KAAC0C;4BAECC,OAAO;gCACL1B,SAAS/B,qBAAqBG,YAAaH,qBAAqBO,IAAI,UAAU,SAAU;4BAC1F;sCAEA,cAAA,KAACnC;gCAAcsF,mBAAmBvF;0CAChC,cAAA,KAACS;oCACCO,cAAcA;oCACdwE,kBAAkB;wCAAEzE;wCAAce,wBAAwBM;oCAAE;oCAC5DqD,OAAOC,uBAAuB/C,GAAGlB;;;2BAThCW;;;;;AAkBnB;AAEA;;;;;;CAMC,GACD,MAAMsD,yBAAyB,CAAC/C,GAAWgD;IACzC,qEAAqE;IACrE,IAAI,CAACC,OAAOC,QAAQ,CAAClD,IAAI,OAAOA;IAChC,OAAOJ,KAAKC,KAAK,CAACmD,WAAWhD,IAAIJ,KAAKuD,GAAG,CAAC,GAAGnD,IAAI,KAAKhC;AACxD"}
@@ -1,4 +1,5 @@
1
1
  import { PanelGroupId } from '@perses-dev/core';
2
+ import { ReactElement } from 'react';
2
3
  export interface GridTitleProps {
3
4
  panelGroupId: PanelGroupId;
4
5
  title: string;
@@ -11,5 +12,5 @@ export interface GridTitleProps {
11
12
  * Renders the title for a Grid section, optionally also supporting expanding
12
13
  * and collapsing
13
14
  */
14
- export declare function GridTitle(props: GridTitleProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function GridTitle(props: GridTitleProps): ReactElement;
15
16
  //# sourceMappingURL=GridTitle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridTitle.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridTitle.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,EAAE,MAAM,IAAI,CAAC;KAC1B,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAsG9C"}
1
+ {"version":3,"file":"GridTitle.d.ts","sourceRoot":"","sources":["../../../src/components/GridLayout/GridTitle.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,EAAE,MAAM,IAAI,CAAC;KAC1B,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAsG7D"}
@@ -104,7 +104,7 @@ import { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '..
104
104
  onClick: (e)=>{
105
105
  // Don't trigger expand/collapse
106
106
  e.stopPropagation();
107
- moveDown && moveDown();
107
+ moveDown === null || moveDown === void 0 ? void 0 : moveDown();
108
108
  },
109
109
  children: /*#__PURE__*/ _jsx(ArrowDownIcon, {})
110
110
  })
@@ -117,7 +117,7 @@ import { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '..
117
117
  onClick: (e)=>{
118
118
  // Don't trigger expand/collapse
119
119
  e.stopPropagation();
120
- moveUp && moveUp();
120
+ moveUp === null || moveUp === void 0 ? void 0 : moveUp();
121
121
  },
122
122
  children: /*#__PURE__*/ _jsx(ArrowUpIcon, {})
123
123
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/GridLayout/GridTitle.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, IconButton, Stack, Typography } from '@mui/material';\nimport ExpandedIcon from 'mdi-material-ui/ChevronDown';\nimport CollapsedIcon from 'mdi-material-ui/ChevronRight';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport ArrowUpIcon from 'mdi-material-ui/ArrowUp';\nimport ArrowDownIcon from 'mdi-material-ui/ArrowDown';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { PanelGroupId } from '@perses-dev/core';\nimport { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';\nimport { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '../../context';\n\nexport interface GridTitleProps {\n panelGroupId: PanelGroupId;\n title: string;\n collapse?: {\n isOpen: boolean;\n onToggleOpen: () => void;\n };\n}\n\n/**\n * Renders the title for a Grid section, optionally also supporting expanding\n * and collapsing\n */\nexport function GridTitle(props: GridTitleProps) {\n const { panelGroupId, title: rawTitle, collapse } = props;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n\n const { openAddPanel, openEditPanelGroup, moveUp, moveDown } = usePanelGroupActions(panelGroupId);\n const { openDeletePanelGroupDialog } = useDeletePanelGroupDialog();\n const { isEditMode } = useEditMode();\n\n const text = <Typography variant=\"h2\">{title}</Typography>;\n\n return (\n <Box\n onClick={collapse?.onToggleOpen}\n sx={{\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n cursor: collapse ? 'pointer' : 'auto',\n backgroundColor: ({ palette }) => palette.background.paper,\n }}\n data-testid=\"panel-group-header\"\n >\n {collapse ? (\n <>\n <IconButton sx={{ marginRight: 1 }} aria-label={`${collapse.isOpen ? 'collapse' : 'expand'} group ${title}`}>\n {collapse.isOpen ? <ExpandedIcon /> : <CollapsedIcon />}\n </IconButton>\n {text}\n {isEditMode && (\n <Stack direction=\"row\" marginLeft=\"auto\">\n <InfoTooltip description={TOOLTIP_TEXT.addPanelToGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.addPanelToGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openAddPanel();\n }}\n >\n <AddPanelIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.editGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.editGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openEditPanelGroup();\n }}\n >\n <PencilIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deleteGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.deleteGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openDeletePanelGroupDialog(panelGroupId);\n }}\n >\n <DeleteIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupDown}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupDown(title)}\n disabled={moveDown === undefined}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n moveDown && moveDown();\n }}\n >\n <ArrowDownIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupUp}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupUp(title)}\n disabled={moveUp === undefined}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n moveUp && moveUp();\n }}\n >\n <ArrowUpIcon />\n </IconButton>\n </InfoTooltip>\n </Stack>\n )}\n </>\n ) : (\n // If we don't need expand/collapse, just render the title text\n text\n )}\n </Box>\n );\n}\n"],"names":["Box","IconButton","Stack","Typography","ExpandedIcon","CollapsedIcon","AddPanelIcon","PencilIcon","ArrowUpIcon","ArrowDownIcon","DeleteIcon","InfoTooltip","useReplaceVariablesInString","ARIA_LABEL_TEXT","TOOLTIP_TEXT","usePanelGroupActions","useEditMode","useDeletePanelGroupDialog","GridTitle","props","panelGroupId","title","rawTitle","collapse","openAddPanel","openEditPanelGroup","moveUp","moveDown","openDeletePanelGroupDialog","isEditMode","text","variant","onClick","onToggleOpen","sx","display","justifyContent","alignItems","cursor","backgroundColor","palette","background","paper","data-testid","marginRight","aria-label","isOpen","direction","marginLeft","description","addPanelToGroup","e","stopPropagation","editGroup","deleteGroup","moveGroupDown","disabled","undefined","moveGroupUp"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACnE,OAAOC,kBAAkB,8BAA8B;AACvD,OAAOC,m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BAAMC,YAAW;;sCAChC,KAACrC;4BAAYsC,aAAanC,aAAaoC,eAAe;sCACpD,cAAA,KAACjD;gCACC4C,cAAYhC,gBAAgBqC,eAAe,CAAC7B;gCAC5CW,SAAS,CAACmB;oCACR,gCAAgC;oCAChCA,EAAEC,eAAe;oCACjB5B;gCACF;0CAEA,cAAA,KAAClB;;;sCAGL,KAACK;4BAAYsC,aAAanC,aAAauC,SAAS;sCAC9C,cAAA,KAACpD;gCACC4C,cAAYhC,gBAAgBwC,SAAS,CAAChC;gCACtCW,SAAS,CAACmB;oCACR,gCAAgC;oCAChCA,EAAEC,eAAe;oCACjB3B;gCACF;0CAEA,cAAA,KAAClB;;;sCAGL,KAACI;4BAAYsC,aAAanC,aAAawC,WAAW;sCAChD,cAAA,KAACrD;gCACC4C,cAAYhC,gBAAgByC,WAAW,CAACjC;gCACxCW,SAAS,CAACmB;oCACR,gCAAgC;oCAChCA,EAAEC,eAAe;oCACjBxB,2BAA2BR;gCAC7B;0CAEA,cAAA,KAACV;;;sCAGL,KAACC;4BAAYsC,aAAanC,aAAayC,aAAa;sCAClD,cAAA,KAACtD;gCACC4C,cAAYhC,gBAAgB0C,aAAa,CAAClC;gCAC1CmC,UAAU7B,aAAa8B;gCACvBzB,SAAS,CAACmB;oCACR,gCAAgC;oCAChCA,EAAEC,eAAe;oCACjBzB,YAAYA;gCACd;0CAEA,cAAA,KAAClB;;;sCAGL,KAACE;4BAAYsC,aAAanC,aAAa4C,WAAW;sCAChD,cAAA,KAACzD;gCACC4C,cAAYhC,gBAAgB6C,WAAW,CAACrC;gCACxCmC,UAAU9B,WAAW+B;gCACrBzB,SAAS,CAACmB;oCACR,gCAAgC;oCAChCA,EAAEC,eAAe;oCACjB1B,UAAUA;gCACZ;0CAEA,cAAA,KAAClB;;;;;;aAOX,+DAA+D;QAC/DsB;;AAIR"}
1
+ {"version":3,"sources":["../../../src/components/GridLayout/GridTitle.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, IconButton, Stack, Typography } from '@mui/material';\nimport ExpandedIcon from 'mdi-material-ui/ChevronDown';\nimport CollapsedIcon from 'mdi-material-ui/ChevronRight';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport ArrowUpIcon from 'mdi-material-ui/ArrowUp';\nimport ArrowDownIcon from 'mdi-material-ui/ArrowDown';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { PanelGroupId } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';\nimport { usePanelGroupActions, useEditMode, useDeletePanelGroupDialog } from '../../context';\n\nexport interface GridTitleProps {\n panelGroupId: PanelGroupId;\n title: string;\n collapse?: {\n isOpen: boolean;\n onToggleOpen: () => void;\n };\n}\n\n/**\n * Renders the title for a Grid section, optionally also supporting expanding\n * and collapsing\n */\nexport function GridTitle(props: GridTitleProps): ReactElement {\n const { panelGroupId, title: rawTitle, collapse } = props;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n\n const { openAddPanel, openEditPanelGroup, moveUp, moveDown } = usePanelGroupActions(panelGroupId);\n const { openDeletePanelGroupDialog } = useDeletePanelGroupDialog();\n const { isEditMode } = useEditMode();\n\n const text = <Typography variant=\"h2\">{title}</Typography>;\n\n return (\n <Box\n onClick={collapse?.onToggleOpen}\n sx={{\n display: 'flex',\n justifyContent: 'start',\n alignItems: 'center',\n cursor: collapse ? 'pointer' : 'auto',\n backgroundColor: ({ palette }) => palette.background.paper,\n }}\n data-testid=\"panel-group-header\"\n >\n {collapse ? (\n <>\n <IconButton sx={{ marginRight: 1 }} aria-label={`${collapse.isOpen ? 'collapse' : 'expand'} group ${title}`}>\n {collapse.isOpen ? <ExpandedIcon /> : <CollapsedIcon />}\n </IconButton>\n {text}\n {isEditMode && (\n <Stack direction=\"row\" marginLeft=\"auto\">\n <InfoTooltip description={TOOLTIP_TEXT.addPanelToGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.addPanelToGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openAddPanel();\n }}\n >\n <AddPanelIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.editGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.editGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openEditPanelGroup();\n }}\n >\n <PencilIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deleteGroup}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.deleteGroup(title)}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n openDeletePanelGroupDialog(panelGroupId);\n }}\n >\n <DeleteIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupDown}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupDown(title)}\n disabled={moveDown === undefined}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n moveDown?.();\n }}\n >\n <ArrowDownIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.moveGroupUp}>\n <IconButton\n aria-label={ARIA_LABEL_TEXT.moveGroupUp(title)}\n disabled={moveUp === undefined}\n onClick={(e) => {\n // Don't trigger expand/collapse\n e.stopPropagation();\n moveUp?.();\n }}\n >\n <ArrowUpIcon />\n </IconButton>\n </InfoTooltip>\n </Stack>\n )}\n </>\n ) : (\n // If we don't need expand/collapse, just render the title text\n text\n )}\n </Box>\n );\n}\n"],"names":["Box","IconButton","Stack","Typography","ExpandedIcon","CollapsedIcon","AddPanelIcon","PencilIcon","ArrowUpIcon","ArrowDownIcon","DeleteIcon","InfoTooltip","useReplaceVariablesInString","ARIA_LABEL_TEXT","TOOLTIP_TEXT","usePanelGroupActions","useEditMode","useDeletePanelGroupDialog","GridTitle","props","panelGroupId","title","rawTitle","collapse","openAddPanel","openEditPanelGroup","moveUp","moveDown","openDeletePanelGroupDialog","isEditMode","text","variant","onClick","onToggleOpen","sx","display","justifyContent","alignItems","cursor","backgroundColor","palette","background","paper","data-testid","marginRight","aria-label","isOpen","direction","marginLeft","description","addPanelToGroup","e","stopPropagation","editGroup","deleteGroup","moveGroupDown","disabled","undefined","moveGroupUp"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACnE,OAAOC,kBAAkB,8BAA8B;AACvD,OAAOC,mBAAmB,+BAA+B;AACzD,OAAOC,kBAAkB,sCAAsC;AAC/D,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,iBAAiB,0BAA0B;AAClD,OAAOC,mBAAmB,4BAA4B;AACtD,OAAOC,gBAAgB,gCAAgC;AACvD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,2BAA2B,QAAQ,4BAA4B;AAGxE,SAASC,eAAe,EAAEC,YAAY,QAAQ,kBAAkB;AAChE,SAASC,oBAAoB,EAAEC,WAAW,EAAEC,yBAAyB,QAAQ,gBAAgB;AAW7F;;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