@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Dashboard/Dashboard.js +8 -1
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +10 -13
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/cjs/components/GridLayout/GridContainer.js +15 -10
- package/dist/cjs/components/GridLayout/GridItemContent.js +19 -4
- package/dist/cjs/components/GridLayout/GridLayout.js +61 -12
- package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
- package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
- package/dist/cjs/components/Panel/Panel.js +14 -10
- package/dist/cjs/components/Panel/PanelActions.js +216 -0
- package/dist/cjs/components/Panel/PanelContent.js +4 -4
- package/dist/cjs/components/Panel/PanelHeader.js +36 -103
- package/dist/cjs/components/Panel/PanelLinks.js +136 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -65
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +7 -3
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -6
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +43 -60
- package/dist/cjs/components/Variables/VariableEditor.js +34 -40
- package/dist/cjs/components/Variables/VariableList.js +23 -22
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/constants/styles.js +15 -7
- package/dist/cjs/constants/user-interface-text.js +3 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -8
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
- package/dist/cjs/context/DashboardProvider/common.js +2 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +14 -6
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +7 -10
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +8 -3
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +18 -23
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +62 -69
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
- package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +4 -4
- package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/cjs/stories/decorators/index.js +2 -2
- package/dist/cjs/test/plugin-registry.js +4 -2
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +3 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +7 -8
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -1
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +8 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +19 -19
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +2 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +2 -1
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -10
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +5 -3
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +15 -10
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +21 -6
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +4 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +63 -14
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +3 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +3 -3
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
- package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
- package/dist/{context/TemplateVariableProvider/index.js → components/Panel/HeaderIconButton.js} +7 -3
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +11 -5
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +15 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +16 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +203 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +2 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -4
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +8 -8
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +39 -106
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelLinks.d.ts +6 -0
- package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
- package/dist/components/Panel/PanelLinks.js +123 -0
- package/dist/components/Panel/PanelLinks.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +70 -68
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +8 -4
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
- package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +5 -7
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +5 -5
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -5
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +44 -61
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts +3 -2
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +35 -41
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +4 -3
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +21 -20
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/constants/styles.d.ts +4 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +5 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +3 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +3 -0
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -3
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +11 -9
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js +2 -2
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +36 -23
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -6
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -2
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -7
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +7 -3
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +7 -7
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +18 -23
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +51 -54
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/context/VariableProvider/index.d.ts +2 -0
- package/dist/context/VariableProvider/index.d.ts.map +1 -0
- package/dist/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/context/VariableProvider/index.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
- package/dist/context/VariableProvider/utils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/context/VariableProvider/utils.js.map +1 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +4 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/stories/decorators/WithVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +2 -2
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/dashboard-provider.d.ts +1 -1
- package/dist/test/dashboard-provider.d.ts.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +2 -2
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +4 -2
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts +2 -2
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +9 -7
- package/dist/test/render.js.map +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -2
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +3 -3
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -3
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +8 -9
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
- package/dist/components/Variables/TemplateVariable.js.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/index.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
- package/dist/validation/index.d.ts +0 -2
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/panel.d.ts +0 -19
- package/dist/validation/panel.d.ts.map +0 -1
- package/dist/validation/panel.js +0 -21
- package/dist/validation/panel.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/Panel.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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/Panel.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 { Card, CardContent, CardProps } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary, combineSx, useChartsTheme, useId } from '@perses-dev/components';\nimport { PanelDefinition } from '@perses-dev/core';\nimport { ReactNode, memo, useMemo, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nimport { PanelGroupItemId } from '../../context';\nimport { PanelContent } from './PanelContent';\nimport { PanelHeader, PanelHeaderProps } from './PanelHeader';\n\nexport interface PanelProps extends CardProps<'section'> {\n definition: PanelDefinition;\n readHandlers?: PanelHeaderProps['readHandlers'];\n editHandlers?: PanelHeaderProps['editHandlers'];\n panelOptions?: PanelOptions;\n panelGroupItemId?: PanelGroupItemId;\n}\n\nexport type PanelOptions = {\n /**\n * Allow you to hide the panel header if desired.\n * This can be useful in embedded mode for example.\n */\n hideHeader?: boolean;\n /**\n * Content to render in right of the panel header. (top right of the panel)\n * It will only be rendered when the panel is in edit mode.\n */\n extra?: (props: PanelExtraProps) => ReactNode;\n};\n\nexport type PanelExtraProps = {\n /**\n * The PanelDefinition for the panel.\n */\n panelDefinition?: PanelDefinition;\n /**\n * The PanelGroupItemId for the panel.\n */\n panelGroupItemId?: PanelGroupItemId;\n};\n\n/**\n * Renders a PanelDefinition's content inside of a Card.\n */\nexport const Panel = memo(function Panel(props: PanelProps) {\n const {\n definition,\n readHandlers,\n editHandlers,\n onMouseEnter,\n onMouseLeave,\n sx,\n panelOptions,\n panelGroupItemId,\n ...others\n } = props;\n\n // Make sure we have an ID we can use for aria attributes\n const generatedPanelId = useId('Panel');\n const headerId = `${generatedPanelId}-header`;\n\n const [contentElement, setContentElement] = useState<HTMLElement | null>(null);\n\n const { width, height } = useResizeObserver({ ref: contentElement });\n\n const contentDimensions = useMemo(() => {\n if (width === undefined || height === undefined) return undefined;\n return { width, height };\n }, [width, height]);\n\n const chartsTheme = useChartsTheme();\n\n const handleMouseEnter: CardProps['onMouseEnter'] = (e) => {\n onMouseEnter?.(e);\n };\n\n const handleMouseLeave: CardProps['onMouseLeave'] = (e) => {\n onMouseLeave?.(e);\n };\n\n return (\n <Card\n component=\"section\"\n sx={combineSx(\n {\n width: '100%',\n height: '100%',\n display: 'flex',\n flexFlow: 'column nowrap',\n ':hover': { '--panel-hover': 'true' },\n },\n sx\n )}\n variant=\"outlined\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-labelledby={headerId}\n aria-describedby={headerId}\n data-testid=\"panel\"\n {...others}\n >\n {!panelOptions?.hideHeader && (\n <PanelHeader\n extra={panelOptions?.extra?.({ panelDefinition: definition, panelGroupItemId })}\n id={headerId}\n title={definition.spec.display.name}\n description={definition.spec.display.description}\n readHandlers={readHandlers}\n editHandlers={editHandlers}\n links={definition.spec.links}\n sx={{ paddingX: `${chartsTheme.container.padding.default}px` }}\n />\n )}\n <CardContent\n component=\"figure\"\n sx={{\n position: 'relative',\n overflow: 'hidden',\n flexGrow: 1,\n margin: 0,\n padding: 0,\n // Override MUI default style for last-child\n ':last-child': {\n padding: 0,\n },\n }}\n ref={setContentElement}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert} resetKeys={[definition.spec]}>\n <PanelContent\n definition={definition}\n panelPluginKind={definition.spec.plugin.kind}\n spec={definition.spec.plugin.spec}\n contentDimensions={contentDimensions}\n />\n </ErrorBoundary>\n </CardContent>\n </Card>\n );\n});\n"],"names":["Card","CardContent","ErrorAlert","ErrorBoundary","combineSx","useChartsTheme","useId","memo","useMemo","useState","useResizeObserver","PanelContent","PanelHeader","Panel","props","definition","readHandlers","editHandlers","onMouseEnter","onMouseLeave","sx","panelOptions","panelGroupItemId","others","generatedPanelId","headerId","contentElement","setContentElement","width","height","ref","contentDimensions","undefined","chartsTheme","handleMouseEnter","e","handleMouseLeave","component","display","flexFlow","variant","aria-labelledby","aria-describedby","data-testid","hideHeader","extra","panelDefinition","id","title","spec","name","description","links","paddingX","container","padding","default","position","overflow","flexGrow","margin","FallbackComponent","resetKeys","panelPluginKind","plugin","kind"],"mappings":"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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PanelActionsProps {
|
|
3
|
+
editHandlers?: {
|
|
4
|
+
onEditPanelClick: () => void;
|
|
5
|
+
onDuplicatePanelClick: () => void;
|
|
6
|
+
onDeletePanelClick: () => void;
|
|
7
|
+
};
|
|
8
|
+
readHandlers?: {
|
|
9
|
+
isPanelViewed?: boolean;
|
|
10
|
+
onViewPanelClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
extra?: React.ReactNode;
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const PanelActions: React.FC<PanelActionsProps>;
|
|
16
|
+
//# sourceMappingURL=PanelActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelActions.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelActions.tsx"],"names":[],"mappings":";AA+BA,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE;QACb,gBAAgB,EAAE,MAAM,IAAI,CAAC;QAC7B,qBAAqB,EAAE,MAAM,IAAI,CAAC;QAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;KAChC,CAAC;IACF,YAAY,CAAC,EAAE;QACb,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,IAAI,CAAC;KAC9B,CAAC;IACF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0GpD,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { Stack, styled, Box, Popover } from '@mui/material';
|
|
15
|
+
import { useMemo, useState } from 'react';
|
|
16
|
+
import { InfoTooltip, combineSx } from '@perses-dev/components';
|
|
17
|
+
import ArrowCollapseIcon from 'mdi-material-ui/ArrowCollapse';
|
|
18
|
+
import ArrowExpandIcon from 'mdi-material-ui/ArrowExpand';
|
|
19
|
+
import PencilIcon from 'mdi-material-ui/PencilOutline';
|
|
20
|
+
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
21
|
+
import DragIcon from 'mdi-material-ui/DragVertical';
|
|
22
|
+
import ContentCopyIcon from 'mdi-material-ui/ContentCopy';
|
|
23
|
+
import MenuIcon from 'mdi-material-ui/Menu';
|
|
24
|
+
import { ARIA_LABEL_TEXT, HEADER_ACTIONS_MIN_WIDTH, HEADER_ACTIONS_CONTAINER_NAME, TOOLTIP_TEXT } from '../../constants';
|
|
25
|
+
import { HeaderIconButton } from './HeaderIconButton';
|
|
26
|
+
export const PanelActions = ({ editHandlers, readHandlers, extra, title })=>{
|
|
27
|
+
const readActions = useMemo(()=>{
|
|
28
|
+
if (readHandlers !== undefined) {
|
|
29
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
30
|
+
description: TOOLTIP_TEXT.viewPanel,
|
|
31
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
32
|
+
"aria-label": ARIA_LABEL_TEXT.viewPanel(title),
|
|
33
|
+
size: "small",
|
|
34
|
+
onClick: readHandlers.onViewPanelClick,
|
|
35
|
+
children: readHandlers.isPanelViewed ? /*#__PURE__*/ _jsx(ArrowCollapseIcon, {
|
|
36
|
+
fontSize: "inherit"
|
|
37
|
+
}) : /*#__PURE__*/ _jsx(ArrowExpandIcon, {
|
|
38
|
+
fontSize: "inherit"
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}, [
|
|
45
|
+
readHandlers,
|
|
46
|
+
title
|
|
47
|
+
]);
|
|
48
|
+
const editActions = useMemo(()=>{
|
|
49
|
+
if (editHandlers !== undefined) {
|
|
50
|
+
// If there are edit handlers, always just show the edit buttons
|
|
51
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
54
|
+
description: TOOLTIP_TEXT.editPanel,
|
|
55
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
56
|
+
"aria-label": ARIA_LABEL_TEXT.editPanel(title),
|
|
57
|
+
size: "small",
|
|
58
|
+
onClick: editHandlers.onEditPanelClick,
|
|
59
|
+
children: /*#__PURE__*/ _jsx(PencilIcon, {
|
|
60
|
+
fontSize: "inherit"
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
65
|
+
description: TOOLTIP_TEXT.duplicatePanel,
|
|
66
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
67
|
+
"aria-label": ARIA_LABEL_TEXT.duplicatePanel(title),
|
|
68
|
+
size: "small",
|
|
69
|
+
onClick: editHandlers.onDuplicatePanelClick,
|
|
70
|
+
children: /*#__PURE__*/ _jsx(ContentCopyIcon, {
|
|
71
|
+
fontSize: "inherit",
|
|
72
|
+
sx: {
|
|
73
|
+
// Shrink this icon a little bit to look more consistent
|
|
74
|
+
// with the other icons in the header.
|
|
75
|
+
transform: 'scale(0.925)'
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
81
|
+
description: TOOLTIP_TEXT.deletePanel,
|
|
82
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
83
|
+
"aria-label": ARIA_LABEL_TEXT.deletePanel(title),
|
|
84
|
+
size: "small",
|
|
85
|
+
onClick: editHandlers.onDeletePanelClick,
|
|
86
|
+
children: /*#__PURE__*/ _jsx(DeleteIcon, {
|
|
87
|
+
fontSize: "inherit"
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}, [
|
|
96
|
+
editHandlers,
|
|
97
|
+
title
|
|
98
|
+
]);
|
|
99
|
+
return /*#__PURE__*/ _jsxs(HeaderActionWrapper, {
|
|
100
|
+
direction: "row",
|
|
101
|
+
spacing: 0.25,
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
sx: {
|
|
104
|
+
display: editHandlers !== undefined || readHandlers?.isPanelViewed ? 'flex' : 'var(--panel-hover, none)'
|
|
105
|
+
},
|
|
106
|
+
children: [
|
|
107
|
+
editHandlers === undefined && extra,
|
|
108
|
+
" ",
|
|
109
|
+
readActions,
|
|
110
|
+
editActions && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
111
|
+
children: [
|
|
112
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
113
|
+
sx: combineSx((theme)=>({
|
|
114
|
+
display: 'block',
|
|
115
|
+
[theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).down(HEADER_ACTIONS_MIN_WIDTH)]: {
|
|
116
|
+
display: 'none'
|
|
117
|
+
}
|
|
118
|
+
})),
|
|
119
|
+
children: editActions
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
122
|
+
sx: combineSx((theme)=>({
|
|
123
|
+
display: 'block',
|
|
124
|
+
[theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).up(HEADER_ACTIONS_MIN_WIDTH)]: {
|
|
125
|
+
display: 'none'
|
|
126
|
+
}
|
|
127
|
+
})),
|
|
128
|
+
children: /*#__PURE__*/ _jsx(ShowAction, {
|
|
129
|
+
title: title,
|
|
130
|
+
children: editActions
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
editActions && /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
136
|
+
description: TOOLTIP_TEXT.movePanel,
|
|
137
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
138
|
+
"aria-label": ARIA_LABEL_TEXT.movePanel(title),
|
|
139
|
+
size: "small",
|
|
140
|
+
children: /*#__PURE__*/ _jsx(DragIcon, {
|
|
141
|
+
className: "drag-handle",
|
|
142
|
+
sx: {
|
|
143
|
+
cursor: 'grab'
|
|
144
|
+
},
|
|
145
|
+
fontSize: "inherit"
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const HeaderActionWrapper = styled(Stack)(()=>({
|
|
153
|
+
// Adding back the negative margins from MUI's defaults for actions, so we
|
|
154
|
+
// avoid increasing the header size when actions are present while also being
|
|
155
|
+
// able to vertically center the actions.
|
|
156
|
+
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58
|
|
157
|
+
marginTop: -4,
|
|
158
|
+
marginBottom: -4
|
|
159
|
+
}));
|
|
160
|
+
const ShowAction = ({ children, title })=>{
|
|
161
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
162
|
+
const handleClick = (event)=>{
|
|
163
|
+
setAnchorEl(event.currentTarget);
|
|
164
|
+
};
|
|
165
|
+
const handleClose = ()=>{
|
|
166
|
+
setAnchorEl(null);
|
|
167
|
+
};
|
|
168
|
+
const open = Boolean(anchorEl);
|
|
169
|
+
const id = open ? 'actions-popover' : undefined;
|
|
170
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
173
|
+
className: "show-actions",
|
|
174
|
+
"aria-describedby": id,
|
|
175
|
+
onClick: handleClick,
|
|
176
|
+
"aria-label": ARIA_LABEL_TEXT.showPanelActions(title),
|
|
177
|
+
size: "small",
|
|
178
|
+
children: /*#__PURE__*/ _jsx(MenuIcon, {
|
|
179
|
+
fontSize: "inherit"
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
/*#__PURE__*/ _jsx(Popover, {
|
|
183
|
+
id: id,
|
|
184
|
+
open: open,
|
|
185
|
+
anchorEl: anchorEl,
|
|
186
|
+
onClose: handleClose,
|
|
187
|
+
anchorOrigin: {
|
|
188
|
+
vertical: 'bottom',
|
|
189
|
+
horizontal: 'left'
|
|
190
|
+
},
|
|
191
|
+
children: /*#__PURE__*/ _jsx(Box, {
|
|
192
|
+
sx: {
|
|
193
|
+
padding: '8px'
|
|
194
|
+
},
|
|
195
|
+
onClick: handleClose,
|
|
196
|
+
children: children
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=PanelActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/PanelActions.tsx"],"sourcesContent":["// Copyright 2025 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 { Stack, styled, Box, Popover } from '@mui/material';\nimport { PropsWithChildren, useMemo, useState } from 'react';\nimport { InfoTooltip, combineSx } from '@perses-dev/components';\nimport ArrowCollapseIcon from 'mdi-material-ui/ArrowCollapse';\nimport ArrowExpandIcon from 'mdi-material-ui/ArrowExpand';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport DragIcon from 'mdi-material-ui/DragVertical';\nimport ContentCopyIcon from 'mdi-material-ui/ContentCopy';\nimport MenuIcon from 'mdi-material-ui/Menu';\nimport {\n ARIA_LABEL_TEXT,\n HEADER_ACTIONS_MIN_WIDTH,\n HEADER_ACTIONS_CONTAINER_NAME,\n TOOLTIP_TEXT,\n} from '../../constants';\nimport { HeaderIconButton } from './HeaderIconButton';\n\nexport interface PanelActionsProps {\n editHandlers?: {\n onEditPanelClick: () => void;\n onDuplicatePanelClick: () => void;\n onDeletePanelClick: () => void;\n };\n readHandlers?: {\n isPanelViewed?: boolean;\n onViewPanelClick: () => void;\n };\n extra?: React.ReactNode;\n title: string;\n}\n\nexport const PanelActions: React.FC<PanelActionsProps> = ({ editHandlers, readHandlers, extra, title }) => {\n const readActions = useMemo(() => {\n if (readHandlers !== undefined) {\n return (\n <InfoTooltip description={TOOLTIP_TEXT.viewPanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.viewPanel(title)}\n size=\"small\"\n onClick={readHandlers.onViewPanelClick}\n >\n {readHandlers.isPanelViewed ? (\n <ArrowCollapseIcon fontSize=\"inherit\" />\n ) : (\n <ArrowExpandIcon fontSize=\"inherit\" />\n )}\n </HeaderIconButton>\n </InfoTooltip>\n );\n }\n return undefined;\n }, [readHandlers, title]);\n\n const editActions = useMemo(() => {\n if (editHandlers !== undefined) {\n // If there are edit handlers, always just show the edit buttons\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editPanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.editPanel(title)}\n size=\"small\"\n onClick={editHandlers.onEditPanelClick}\n >\n <PencilIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.duplicatePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.duplicatePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDuplicatePanelClick}\n >\n <ContentCopyIcon\n fontSize=\"inherit\"\n sx={{\n // Shrink this icon a little bit to look more consistent\n // with the other icons in the header.\n transform: 'scale(0.925)',\n }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deletePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.deletePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDeletePanelClick}\n >\n <DeleteIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n </>\n );\n }\n return undefined;\n }, [editHandlers, title]);\n\n return (\n <HeaderActionWrapper\n direction=\"row\"\n spacing={0.25}\n alignItems=\"center\"\n sx={{ display: editHandlers !== undefined || readHandlers?.isPanelViewed ? 'flex' : 'var(--panel-hover, none)' }}\n >\n {editHandlers === undefined && extra} {readActions}\n {editActions && (\n <>\n <Box\n sx={combineSx((theme) => ({\n display: 'block',\n [theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).down(HEADER_ACTIONS_MIN_WIDTH)]: {\n display: 'none',\n },\n }))}\n >\n {editActions}\n </Box>\n <Box\n sx={combineSx((theme) => ({\n display: 'block',\n [theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).up(HEADER_ACTIONS_MIN_WIDTH)]: { display: 'none' },\n }))}\n >\n <ShowAction title={title}>{editActions}</ShowAction>\n </Box>\n </>\n )}\n {editActions && (\n <InfoTooltip description={TOOLTIP_TEXT.movePanel}>\n <HeaderIconButton aria-label={ARIA_LABEL_TEXT.movePanel(title)} size=\"small\">\n <DragIcon className=\"drag-handle\" sx={{ cursor: 'grab' }} fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n )}\n </HeaderActionWrapper>\n );\n};\n\nconst HeaderActionWrapper = styled(Stack)(() => ({\n // Adding back the negative margins from MUI's defaults for actions, so we\n // avoid increasing the header size when actions are present while also being\n // able to vertically center the actions.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n marginTop: -4,\n marginBottom: -4,\n}));\n\nconst ShowAction: React.FC<PropsWithChildren<{ title: string }>> = ({ children, title }) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = (event: React.MouseEvent<HTMLElement>): undefined => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = (): undefined => {\n setAnchorEl(null);\n };\n\n const open = Boolean(anchorEl);\n const id = open ? 'actions-popover' : undefined;\n\n return (\n <>\n <HeaderIconButton\n className=\"show-actions\"\n aria-describedby={id}\n onClick={handleClick}\n aria-label={ARIA_LABEL_TEXT.showPanelActions(title)}\n size=\"small\"\n >\n <MenuIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n <Popover\n id={id}\n open={open}\n anchorEl={anchorEl}\n onClose={handleClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n >\n <Box sx={{ padding: '8px' }} onClick={handleClose}>\n {children}\n </Box>\n </Popover>\n </>\n );\n};\n"],"names":["Stack","styled","Box","Popover","useMemo","useState","InfoTooltip","combineSx","ArrowCollapseIcon","ArrowExpandIcon","PencilIcon","DeleteIcon","DragIcon","ContentCopyIcon","MenuIcon","ARIA_LABEL_TEXT","HEADER_ACTIONS_MIN_WIDTH","HEADER_ACTIONS_CONTAINER_NAME","TOOLTIP_TEXT","HeaderIconButton","PanelActions","editHandlers","readHandlers","extra","title","readActions","undefined","description","viewPanel","aria-label","size","onClick","onViewPanelClick","isPanelViewed","fontSize","editActions","editPanel","onEditPanelClick","duplicatePanel","onDuplicatePanelClick","sx","transform","deletePanel","onDeletePanelClick","HeaderActionWrapper","direction","spacing","alignItems","display","theme","containerQueries","down","up","ShowAction","movePanel","className","cursor","marginTop","marginBottom","children","anchorEl","setAnchorEl","handleClick","event","currentTarget","handleClose","open","Boolean","id","aria-describedby","showPanelActions","onClose","anchorOrigin","vertical","horizontal","padding"],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PanelProps } from '@perses-dev/plugin-system';
|
|
2
2
|
import { UnknownSpec, PanelDefinition } from '@perses-dev/core';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
3
4
|
export interface PanelContentProps extends PanelProps<UnknownSpec> {
|
|
4
5
|
panelPluginKind: string;
|
|
5
6
|
definition?: PanelDefinition<UnknownSpec>;
|
|
@@ -8,5 +9,5 @@ export interface PanelContentProps extends PanelProps<UnknownSpec> {
|
|
|
8
9
|
* A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel
|
|
9
10
|
* definition's kind. Used so that an ErrorBoundary can be wrapped around this.
|
|
10
11
|
*/
|
|
11
|
-
export declare function PanelContent(props: PanelContentProps):
|
|
12
|
+
export declare function PanelContent(props: PanelContentProps): ReactElement;
|
|
12
13
|
//# sourceMappingURL=PanelContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelContent.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelContent.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelContent.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelContent.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,iBAAkB,SAAQ,UAAU,CAAC,WAAW,CAAC;IAChE,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAqBnE"}
|
|
@@ -19,14 +19,14 @@ import { Skeleton } from '@mui/material';
|
|
|
19
19
|
*/ export function PanelContent(props) {
|
|
20
20
|
const { panelPluginKind, contentDimensions, definition, ...others } = props;
|
|
21
21
|
const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, {
|
|
22
|
-
|
|
22
|
+
throwOnError: true
|
|
23
23
|
});
|
|
24
|
-
const PanelComponent = plugin
|
|
24
|
+
const PanelComponent = plugin?.PanelComponent;
|
|
25
25
|
if (isLoading) {
|
|
26
26
|
return /*#__PURE__*/ _jsx(Skeleton, {
|
|
27
27
|
variant: "rectangular",
|
|
28
|
-
width: contentDimensions
|
|
29
|
-
height: contentDimensions
|
|
28
|
+
width: contentDimensions?.width,
|
|
29
|
+
height: contentDimensions?.height,
|
|
30
30
|
"aria-label": "Loading..."
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { Skeleton } from '@mui/material';\nimport { UnknownSpec, PanelDefinition } from '@perses-dev/core';\n\nexport interface PanelContentProps extends PanelProps<UnknownSpec> {\n panelPluginKind: string;\n definition?: PanelDefinition<UnknownSpec>;\n}\n\n/**\n * A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel\n * definition's kind. Used so that an ErrorBoundary can be wrapped around this.\n */\nexport function PanelContent(props: PanelContentProps) {\n const { panelPluginKind, contentDimensions, definition, ...others } = props;\n const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { Skeleton } from '@mui/material';\nimport { UnknownSpec, PanelDefinition } from '@perses-dev/core';\nimport { ReactElement } from 'react';\n\nexport interface PanelContentProps extends PanelProps<UnknownSpec> {\n panelPluginKind: string;\n definition?: PanelDefinition<UnknownSpec>;\n}\n\n/**\n * A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel\n * definition's kind. Used so that an ErrorBoundary can be wrapped around this.\n */\nexport function PanelContent(props: PanelContentProps): ReactElement {\n const { panelPluginKind, contentDimensions, definition, ...others } = props;\n const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, { throwOnError: true });\n const PanelComponent = plugin?.PanelComponent;\n\n if (isLoading) {\n return (\n <Skeleton\n variant=\"rectangular\"\n width={contentDimensions?.width}\n height={contentDimensions?.height}\n aria-label=\"Loading...\"\n />\n );\n }\n\n if (PanelComponent === undefined) {\n throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);\n }\n\n return <PanelComponent {...others} contentDimensions={contentDimensions} definition={definition} />;\n}\n"],"names":["usePlugin","Skeleton","PanelContent","props","panelPluginKind","contentDimensions","definition","others","data","plugin","isLoading","throwOnError","PanelComponent","variant","width","height","aria-label","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,QAAoB,4BAA4B;AAClE,SAASC,QAAQ,QAAQ,gBAAgB;AASzC;;;CAGC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,eAAe,EAAEC,iBAAiB,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGJ;IACtE,MAAM,EAAEK,MAAMC,MAAM,EAAEC,SAAS,EAAE,GAAGV,UAAU,SAASI,iBAAiB;QAAEO,cAAc;IAAK;IAC7F,MAAMC,iBAAiBH,QAAQG;IAE/B,IAAIF,WAAW;QACb,qBACE,KAACT;YACCY,SAAQ;YACRC,OAAOT,mBAAmBS;YAC1BC,QAAQV,mBAAmBU;YAC3BC,cAAW;;IAGjB;IAEA,IAAIJ,mBAAmBK,WAAW;QAChC,MAAM,IAAIC,MAAM,CAAC,mDAAmD,EAAEd,gBAAgB,CAAC,CAAC;IAC1F;IAEA,qBAAO,KAACQ;QAAgB,GAAGL,MAAM;QAAEF,mBAAmBA;QAAmBC,YAAYA;;AACvF"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CardHeaderProps } from '@mui/material';
|
|
2
|
+
import { Link } from '@perses-dev/core';
|
|
3
|
+
import { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { PanelActionsProps } from './PanelActions';
|
|
3
5
|
type OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';
|
|
4
6
|
export interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {
|
|
5
7
|
id: string;
|
|
6
8
|
title: string;
|
|
7
9
|
description?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onDeletePanelClick: () => void;
|
|
13
|
-
};
|
|
10
|
+
links?: Link[];
|
|
11
|
+
extra?: ReactNode;
|
|
12
|
+
readHandlers?: PanelActionsProps['readHandlers'];
|
|
13
|
+
editHandlers?: PanelActionsProps['editHandlers'];
|
|
14
14
|
}
|
|
15
|
-
export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, editHandlers, sx, extra, ...rest }: PanelHeaderProps):
|
|
15
|
+
export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, links, readHandlers, editHandlers, sx, extra, ...rest }: PanelHeaderProps): ReactElement;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=PanelHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAmB,eAAe,EAAqB,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIjE,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE1E,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAClD;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,cAAc,EAC3B,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,EAAE,EACF,KAAK,EACL,GAAG,IAAI,EACR,EAAE,gBAAgB,GAAG,YAAY,CAwEjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -10,81 +10,20 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
14
|
-
import {
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Box, CardHeader, Stack, Typography } from '@mui/material';
|
|
15
15
|
import { InfoTooltip, combineSx } from '@perses-dev/components';
|
|
16
|
-
import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
|
|
17
|
-
import PencilIcon from 'mdi-material-ui/PencilOutline';
|
|
18
|
-
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
19
|
-
import DragIcon from 'mdi-material-ui/DragVertical';
|
|
20
|
-
import ContentCopy from 'mdi-material-ui/ContentCopy';
|
|
21
16
|
import { useReplaceVariablesInString } from '@perses-dev/plugin-system';
|
|
22
|
-
import
|
|
23
|
-
|
|
17
|
+
import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
|
|
18
|
+
import { HEADER_ACTIONS_CONTAINER_NAME } from '../../constants';
|
|
19
|
+
import { PanelActions } from './PanelActions';
|
|
20
|
+
import { PanelLinks } from './PanelLinks';
|
|
21
|
+
import { HeaderIconButton } from './HeaderIconButton';
|
|
22
|
+
export function PanelHeader({ id, title: rawTitle, description: rawDescription, links, readHandlers, editHandlers, sx, extra, ...rest }) {
|
|
24
23
|
const titleElementId = `${id}-title`;
|
|
25
24
|
const descriptionTooltipId = `${id}-description`;
|
|
26
25
|
const title = useReplaceVariablesInString(rawTitle);
|
|
27
26
|
const description = useReplaceVariablesInString(rawDescription);
|
|
28
|
-
let actions = undefined;
|
|
29
|
-
if (editHandlers !== undefined) {
|
|
30
|
-
// If there are edit handlers, always just show the edit buttons
|
|
31
|
-
actions = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
32
|
-
children: [
|
|
33
|
-
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
34
|
-
description: TOOLTIP_TEXT.editPanel,
|
|
35
|
-
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
36
|
-
"aria-label": ARIA_LABEL_TEXT.editPanel(title),
|
|
37
|
-
size: "small",
|
|
38
|
-
onClick: editHandlers.onEditPanelClick,
|
|
39
|
-
children: /*#__PURE__*/ _jsx(PencilIcon, {
|
|
40
|
-
fontSize: "inherit"
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
}),
|
|
44
|
-
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
45
|
-
description: TOOLTIP_TEXT.duplicatePanel,
|
|
46
|
-
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
47
|
-
"aria-label": ARIA_LABEL_TEXT.duplicatePanel(title),
|
|
48
|
-
size: "small",
|
|
49
|
-
onClick: editHandlers.onDuplicatePanelClick,
|
|
50
|
-
children: /*#__PURE__*/ _jsx(ContentCopy, {
|
|
51
|
-
fontSize: "inherit",
|
|
52
|
-
sx: {
|
|
53
|
-
// Shrink this icon a little bit to look more consistent
|
|
54
|
-
// with the other icons in the header.
|
|
55
|
-
transform: 'scale(0.925)'
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
}),
|
|
60
|
-
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
61
|
-
description: TOOLTIP_TEXT.deletePanel,
|
|
62
|
-
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
63
|
-
"aria-label": ARIA_LABEL_TEXT.deletePanel(title),
|
|
64
|
-
size: "small",
|
|
65
|
-
onClick: editHandlers.onDeletePanelClick,
|
|
66
|
-
children: /*#__PURE__*/ _jsx(DeleteIcon, {
|
|
67
|
-
fontSize: "inherit"
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
}),
|
|
71
|
-
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
72
|
-
description: TOOLTIP_TEXT.movePanel,
|
|
73
|
-
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
74
|
-
"aria-label": ARIA_LABEL_TEXT.movePanel(title),
|
|
75
|
-
size: "small",
|
|
76
|
-
children: /*#__PURE__*/ _jsx(DragIcon, {
|
|
77
|
-
className: "drag-handle",
|
|
78
|
-
sx: {
|
|
79
|
-
cursor: 'grab'
|
|
80
|
-
},
|
|
81
|
-
fontSize: "inherit"
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
})
|
|
85
|
-
]
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
27
|
return /*#__PURE__*/ _jsx(CardHeader, {
|
|
89
28
|
id: id,
|
|
90
29
|
component: "header",
|
|
@@ -101,43 +40,49 @@ export function PanelHeader({ id, title: rawTitle, description: rawDescription,
|
|
|
101
40
|
// `minHeight` guarantees that the header has the correct height
|
|
102
41
|
// when there is no title (i.e. in the preview)
|
|
103
42
|
lineHeight: '24px',
|
|
104
|
-
minHeight: '
|
|
43
|
+
minHeight: '26px',
|
|
105
44
|
whiteSpace: 'nowrap',
|
|
106
45
|
overflow: 'hidden',
|
|
107
46
|
textOverflow: 'ellipsis'
|
|
108
47
|
},
|
|
109
48
|
children: title
|
|
110
49
|
}),
|
|
111
|
-
description !== undefined && description.trim().length > 0 && /*#__PURE__*/ _jsx(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
children: /*#__PURE__*/ _jsx(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"aria-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
50
|
+
description !== undefined && description.trim().length > 0 && /*#__PURE__*/ _jsx(Box, {
|
|
51
|
+
sx: {
|
|
52
|
+
display: editHandlers === undefined ? 'var(--panel-hover, none)' : 'flex'
|
|
53
|
+
},
|
|
54
|
+
children: /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
55
|
+
id: descriptionTooltipId,
|
|
56
|
+
description: description,
|
|
57
|
+
enterDelay: 100,
|
|
58
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
59
|
+
"aria-label": "panel description",
|
|
60
|
+
size: "small",
|
|
61
|
+
children: /*#__PURE__*/ _jsx(InformationOutlineIcon, {
|
|
62
|
+
"aria-describedby": "info-tooltip",
|
|
63
|
+
"aria-hidden": false,
|
|
64
|
+
fontSize: "inherit",
|
|
65
|
+
sx: {
|
|
66
|
+
color: (theme)=>theme.palette.text.secondary
|
|
67
|
+
}
|
|
68
|
+
})
|
|
125
69
|
})
|
|
126
70
|
})
|
|
71
|
+
}),
|
|
72
|
+
links !== undefined && links.length > 0 && /*#__PURE__*/ _jsx(PanelLinks, {
|
|
73
|
+
links: links
|
|
127
74
|
})
|
|
128
75
|
]
|
|
129
76
|
}),
|
|
130
|
-
action: /*#__PURE__*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
editHandlers === undefined && extra,
|
|
136
|
-
" ",
|
|
137
|
-
actions
|
|
138
|
-
]
|
|
77
|
+
action: /*#__PURE__*/ _jsx(PanelActions, {
|
|
78
|
+
title: title,
|
|
79
|
+
readHandlers: readHandlers,
|
|
80
|
+
editHandlers: editHandlers,
|
|
81
|
+
extra: extra
|
|
139
82
|
}),
|
|
140
83
|
sx: combineSx((theme)=>({
|
|
84
|
+
containerType: 'inline-size',
|
|
85
|
+
containerName: HEADER_ACTIONS_CONTAINER_NAME,
|
|
141
86
|
padding: theme.spacing(1),
|
|
142
87
|
borderBottom: `solid 1px ${theme.palette.divider}`,
|
|
143
88
|
'.MuiCardHeader-content': {
|
|
@@ -154,17 +99,5 @@ export function PanelHeader({ id, title: rawTitle, description: rawDescription,
|
|
|
154
99
|
...rest
|
|
155
100
|
});
|
|
156
101
|
}
|
|
157
|
-
const HeaderIconButton = styled(IconButton)(({ theme })=>({
|
|
158
|
-
borderRadius: theme.shape.borderRadius,
|
|
159
|
-
padding: '4px'
|
|
160
|
-
}));
|
|
161
|
-
const HeaderActionWrapper = styled(Stack)(()=>({
|
|
162
|
-
// Adding back the negative margins from MUI's defaults for actions, so we
|
|
163
|
-
// avoid increasing the header size when actions are present while also being
|
|
164
|
-
// able to vertically center the actions.
|
|
165
|
-
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58
|
|
166
|
-
marginTop: -4,
|
|
167
|
-
marginBottom: -4
|
|
168
|
-
}));
|
|
169
102
|
|
|
170
103
|
//# sourceMappingURL=PanelHeader.js.map
|