@perses-dev/dashboards 0.50.0 → 0.51.0-beta.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.
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -3
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/cjs/components/Datasources/DatasourceEditor.js +2 -5
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +2 -0
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -3
- package/dist/cjs/components/DownloadButton/DownloadButton.js +135 -29
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +5 -7
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +4 -3
- package/dist/cjs/components/GridLayout/GridLayout.js +5 -6
- package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
- package/dist/cjs/components/Panel/HeaderIconButton.js +27 -0
- package/dist/cjs/components/Panel/Panel.js +16 -10
- package/dist/cjs/components/Panel/PanelActions.js +365 -0
- package/dist/cjs/components/Panel/PanelContent.js +59 -13
- package/dist/cjs/components/Panel/PanelHeader.js +14 -141
- package/dist/cjs/components/Panel/PanelLinks.js +5 -6
- package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
- package/dist/cjs/components/Panel/index.js +1 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +17 -35
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +4 -5
- 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 +2 -4
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +5 -12
- package/dist/cjs/components/Variables/Variable.js +36 -41
- package/dist/cjs/components/Variables/VariableEditor.js +14 -23
- package/dist/cjs/components/Variables/VariableList.js +4 -6
- package/dist/cjs/constants/styles.js +12 -0
- package/dist/cjs/constants/user-interface-text.js +1 -1
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -6
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
- package/dist/cjs/context/DashboardProvider/common.js +2 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +13 -3
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +3 -6
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +3 -4
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +1 -2
- package/dist/cjs/context/DatasourceStoreProvider.js +15 -22
- package/dist/cjs/context/VariableProvider/VariableProvider.js +8 -11
- package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -6
- package/dist/cjs/context/VariableProvider/utils.js +2 -2
- package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/cjs/stories/decorators/WithVariables.js +1 -1
- package/dist/cjs/test/plugin-registry.js +8 -3
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +4 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -5
- package/dist/components/Dashboard/Dashboard.js +1 -3
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +2 -5
- package/dist/components/Datasources/DatasourceEditor.js.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.js +3 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +1 -5
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +94 -29
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +5 -7
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +5 -4
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +6 -7
- package/dist/components/GridLayout/GridLayout.js.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/components/Panel/HeaderIconButton.js +19 -0
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +7 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +22 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +22 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +352 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +5 -4
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +61 -15
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +7 -11
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +18 -140
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelLinks.js +5 -6
- package/dist/components/Panel/PanelLinks.js.map +1 -1
- package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
- package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
- package/dist/components/Panel/PanelPluginLoader.js +51 -0
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/Panel/index.js.map +1 -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.js +17 -35
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +4 -5
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.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.js +2 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +5 -12
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/Variable.d.ts +2 -2
- package/dist/components/Variables/Variable.d.ts.map +1 -1
- package/dist/components/Variables/Variable.js +36 -41
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.js +14 -23
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.js +4 -6
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/constants/styles.d.ts +3 -0
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +3 -0
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +1 -1
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +5 -6
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.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 +11 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -4
- package/dist/context/DashboardProvider/dashboard-provider-api.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/panel-editor-slice.js +3 -6
- package/dist/context/DashboardProvider/panel-editor-slice.js.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.js +3 -4
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +15 -22
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.js +8 -11
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.js +3 -6
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/VariableProvider/utils.js +2 -2
- package/dist/context/VariableProvider/utils.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/WithVariables.js +1 -1
- package/dist/stories/decorators/WithVariables.js.map +1 -1
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +8 -3
- package/dist/test/plugin-registry.js.map +1 -1
- 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/views/ViewDashboard/DashboardApp.d.ts +2 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +4 -3
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +5 -5
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1,19 @@
|
|
|
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 { IconButton, styled } from '@mui/material';
|
|
14
|
+
export const HeaderIconButton = styled(IconButton)(({ theme })=>({
|
|
15
|
+
borderRadius: theme.shape.borderRadius,
|
|
16
|
+
padding: '4px'
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=HeaderIconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Panel/HeaderIconButton.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 { IconButton, styled } from '@mui/material';\n\nexport const HeaderIconButton = styled(IconButton)(({ theme }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n}));\n"],"names":["IconButton","styled","HeaderIconButton","theme","borderRadius","shape","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,SAASA,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AAEnD,OAAO,MAAMC,mBAAmBD,OAAOD,YAAY,CAAC,EAAEG,KAAK,EAAE,GAAM,CAAA;QACjEC,cAAcD,MAAME,KAAK,CAACD,YAAY;QACtCE,SAAS;IACX,CAAA,GAAI"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { PanelDefinition } from '@perses-dev/core';
|
|
3
1
|
import { CardProps } from '@mui/material';
|
|
2
|
+
import { PanelDefinition } from '@perses-dev/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
4
|
import { PanelGroupItemId } from '../../context';
|
|
5
5
|
import { PanelHeaderProps } from './PanelHeader';
|
|
6
6
|
export interface PanelProps extends CardProps<'section'> {
|
|
@@ -34,6 +34,11 @@ export type PanelExtraProps = {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* Renders a PanelDefinition's content inside of a Card.
|
|
37
|
+
*
|
|
38
|
+
* Internal structure:
|
|
39
|
+
* <Panel> // renders an entire panel, incl. header and action buttons
|
|
40
|
+
* <PanelContent> // renders loading, error or panel based on the queries' status
|
|
41
|
+
* <PanelPluginLoader> // loads a panel plugin from the plugin registry and renders the PanelComponent with data from props.queryResults
|
|
37
42
|
*/
|
|
38
43
|
export declare const Panel: import("react").NamedExoticComponent<PanelProps>;
|
|
39
44
|
//# sourceMappingURL=Panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAqB,SAAS,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,SAAS,CAAC;IACtD,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,kDAmGhB,CAAC"}
|
|
@@ -11,16 +11,21 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useState, useMemo, memo } from 'react';
|
|
15
|
-
import useResizeObserver from 'use-resize-observer';
|
|
16
|
-
import { ErrorBoundary, ErrorAlert, combineSx, useId, useChartsTheme } from '@perses-dev/components';
|
|
17
14
|
import { Card, CardContent } from '@mui/material';
|
|
18
|
-
import {
|
|
15
|
+
import { ErrorAlert, ErrorBoundary, combineSx, useChartsTheme, useId } from '@perses-dev/components';
|
|
16
|
+
import { useDataQueriesContext } from '@perses-dev/plugin-system';
|
|
17
|
+
import { memo, useMemo, useState } from 'react';
|
|
18
|
+
import useResizeObserver from 'use-resize-observer';
|
|
19
19
|
import { PanelContent } from './PanelContent';
|
|
20
|
+
import { PanelHeader } from './PanelHeader';
|
|
20
21
|
/**
|
|
21
22
|
* Renders a PanelDefinition's content inside of a Card.
|
|
23
|
+
*
|
|
24
|
+
* Internal structure:
|
|
25
|
+
* <Panel> // renders an entire panel, incl. header and action buttons
|
|
26
|
+
* <PanelContent> // renders loading, error or panel based on the queries' status
|
|
27
|
+
* <PanelPluginLoader> // loads a panel plugin from the plugin registry and renders the PanelComponent with data from props.queryResults
|
|
22
28
|
*/ export const Panel = /*#__PURE__*/ memo(function Panel(props) {
|
|
23
|
-
var _panelOptions_extra;
|
|
24
29
|
const { definition, readHandlers, editHandlers, onMouseEnter, onMouseLeave, sx, panelOptions, panelGroupItemId, ...others } = props;
|
|
25
30
|
// Make sure we have an ID we can use for aria attributes
|
|
26
31
|
const generatedPanelId = useId('Panel');
|
|
@@ -40,11 +45,12 @@ import { PanelContent } from './PanelContent';
|
|
|
40
45
|
height
|
|
41
46
|
]);
|
|
42
47
|
const chartsTheme = useChartsTheme();
|
|
48
|
+
const { queryResults } = useDataQueriesContext();
|
|
43
49
|
const handleMouseEnter = (e)=>{
|
|
44
|
-
onMouseEnter
|
|
50
|
+
onMouseEnter?.(e);
|
|
45
51
|
};
|
|
46
52
|
const handleMouseLeave = (e)=>{
|
|
47
|
-
onMouseLeave
|
|
53
|
+
onMouseLeave?.(e);
|
|
48
54
|
};
|
|
49
55
|
return /*#__PURE__*/ _jsxs(Card, {
|
|
50
56
|
component: "section",
|
|
@@ -52,7 +58,10 @@ import { PanelContent } from './PanelContent';
|
|
|
52
58
|
width: '100%',
|
|
53
59
|
height: '100%',
|
|
54
60
|
display: 'flex',
|
|
55
|
-
flexFlow: 'column nowrap'
|
|
61
|
+
flexFlow: 'column nowrap',
|
|
62
|
+
':hover': {
|
|
63
|
+
'--panel-hover': 'block'
|
|
64
|
+
}
|
|
56
65
|
}, sx),
|
|
57
66
|
variant: "outlined",
|
|
58
67
|
onMouseEnter: handleMouseEnter,
|
|
@@ -62,14 +71,15 @@ import { PanelContent } from './PanelContent';
|
|
|
62
71
|
"data-testid": "panel",
|
|
63
72
|
...others,
|
|
64
73
|
children: [
|
|
65
|
-
!
|
|
66
|
-
extra: panelOptions
|
|
74
|
+
!panelOptions?.hideHeader && /*#__PURE__*/ _jsx(PanelHeader, {
|
|
75
|
+
extra: panelOptions?.extra?.({
|
|
67
76
|
panelDefinition: definition,
|
|
68
77
|
panelGroupItemId
|
|
69
78
|
}),
|
|
70
79
|
id: headerId,
|
|
71
80
|
title: definition.spec.display.name,
|
|
72
81
|
description: definition.spec.display.description,
|
|
82
|
+
queryResults: queryResults,
|
|
73
83
|
readHandlers: readHandlers,
|
|
74
84
|
editHandlers: editHandlers,
|
|
75
85
|
links: definition.spec.links,
|
|
@@ -100,7 +110,8 @@ import { PanelContent } from './PanelContent';
|
|
|
100
110
|
definition: definition,
|
|
101
111
|
panelPluginKind: definition.spec.plugin.kind,
|
|
102
112
|
spec: definition.spec.plugin.spec,
|
|
103
|
-
contentDimensions: contentDimensions
|
|
113
|
+
contentDimensions: contentDimensions,
|
|
114
|
+
queryResults: queryResults
|
|
104
115
|
})
|
|
105
116
|
})
|
|
106
117
|
})
|
|
@@ -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 { useDataQueriesContext } from '@perses-dev/plugin-system';\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 *\n * Internal structure:\n * <Panel> // renders an entire panel, incl. header and action buttons\n * <PanelContent> // renders loading, error or panel based on the queries' status\n * <PanelPluginLoader> // loads a panel plugin from the plugin registry and renders the PanelComponent with data from props.queryResults\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 { queryResults } = useDataQueriesContext();\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': 'block' },\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 queryResults={queryResults}\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 queryResults={queryResults}\n />\n </ErrorBoundary>\n </CardContent>\n </Card>\n );\n});\n"],"names":["Card","CardContent","ErrorAlert","ErrorBoundary","combineSx","useChartsTheme","useId","useDataQueriesContext","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","queryResults","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":"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,IAAI,EAAEC,WAAW,QAAmB,gBAAgB;AAC7D,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,EAAEC,cAAc,EAAEC,KAAK,QAAQ,yBAAyB;AAErG,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAAoBC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC3D,OAAOC,uBAAuB,sBAAsB;AAEpD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,WAAW,QAA0B,gBAAgB;AAkC9D;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAQN,KAAK,SAASM,MAAMC,KAAiB;IACxD,MAAM,EACJC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,EAAE,EACFC,YAAY,EACZC,gBAAgB,EAChB,GAAGC,QACJ,GAAGT;IAEJ,yDAAyD;IACzD,MAAMU,mBAAmBnB,MAAM;IAC/B,M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AAI;oBACFsC,UAAU;oBACVC,UAAU;oBACVC,UAAU;oBACVC,QAAQ;oBACRL,SAAS;oBACT,4CAA4C;oBAC5C,eAAe;wBACbA,SAAS;oBACX;gBACF;gBACA1B,KAAKH;0BAEL,cAAA,KAACzB;oBAAc4D,mBAAmB7D;oBAAY8D,WAAW;wBAAChD,WAAWmC,IAAI;qBAAC;8BACxE,cAAA,KAACvC;wBACCI,YAAYA;wBACZiD,iBAAiBjD,WAAWmC,IAAI,CAACe,MAAM,CAACC,IAAI;wBAC5ChB,MAAMnC,WAAWmC,IAAI,CAACe,MAAM,CAACf,IAAI;wBACjCnB,mBAAmBA;wBACnBG,cAAcA;;;;;;AAM1B,GAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { QueryData } from '@perses-dev/plugin-system';
|
|
3
|
+
import { Link } from '@perses-dev/core';
|
|
4
|
+
export interface PanelActionsProps {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
descriptionTooltipId: string;
|
|
8
|
+
links?: Link[];
|
|
9
|
+
extra?: React.ReactNode;
|
|
10
|
+
editHandlers?: {
|
|
11
|
+
onEditPanelClick: () => void;
|
|
12
|
+
onDuplicatePanelClick: () => void;
|
|
13
|
+
onDeletePanelClick: () => void;
|
|
14
|
+
};
|
|
15
|
+
readHandlers?: {
|
|
16
|
+
isPanelViewed?: boolean;
|
|
17
|
+
onViewPanelClick: () => void;
|
|
18
|
+
};
|
|
19
|
+
queryResults: QueryData[];
|
|
20
|
+
}
|
|
21
|
+
export declare const PanelActions: React.FC<PanelActionsProps>;
|
|
22
|
+
//# sourceMappingURL=PanelActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelActions.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelActions.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAWxC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,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,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AASD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqMpD,CAAC"}
|
|
@@ -0,0 +1,352 @@
|
|
|
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, Box, Popover, CircularProgress, styled } from '@mui/material';
|
|
15
|
+
import { isValidElement, useMemo, useState } from 'react';
|
|
16
|
+
import { InfoTooltip } 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 AlertIcon from 'mdi-material-ui/Alert';
|
|
25
|
+
import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
|
|
26
|
+
import { ARIA_LABEL_TEXT, HEADER_ACTIONS_CONTAINER_NAME, HEADER_MEDIUM_WIDTH, HEADER_SMALL_WIDTH, TOOLTIP_TEXT } from '../../constants';
|
|
27
|
+
import { HeaderIconButton } from './HeaderIconButton';
|
|
28
|
+
import { PanelLinks } from './PanelLinks';
|
|
29
|
+
const ConditionalBox = styled(Box)({
|
|
30
|
+
display: 'none',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
flexGrow: 1,
|
|
33
|
+
justifyContent: 'flex-end'
|
|
34
|
+
});
|
|
35
|
+
export const PanelActions = ({ editHandlers, readHandlers, extra, title, description, descriptionTooltipId, links, queryResults })=>{
|
|
36
|
+
const descriptionAction = useMemo(()=>{
|
|
37
|
+
if (description && description.trim().length > 0) {
|
|
38
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
39
|
+
id: descriptionTooltipId,
|
|
40
|
+
description: description,
|
|
41
|
+
enterDelay: 100,
|
|
42
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
43
|
+
"aria-label": "panel description",
|
|
44
|
+
size: "small",
|
|
45
|
+
children: /*#__PURE__*/ _jsx(InformationOutlineIcon, {
|
|
46
|
+
"aria-describedby": "info-tooltip",
|
|
47
|
+
"aria-hidden": false,
|
|
48
|
+
fontSize: "inherit",
|
|
49
|
+
sx: {
|
|
50
|
+
color: (theme)=>theme.palette.text.secondary
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}, [
|
|
58
|
+
descriptionTooltipId,
|
|
59
|
+
description
|
|
60
|
+
]);
|
|
61
|
+
const linksAction = links && links.length > 0 && /*#__PURE__*/ _jsx(PanelLinks, {
|
|
62
|
+
links: links
|
|
63
|
+
});
|
|
64
|
+
const extraActions = editHandlers === undefined && extra;
|
|
65
|
+
const queryStateIndicator = useMemo(()=>{
|
|
66
|
+
const hasData = queryResults.some((q)=>q.data);
|
|
67
|
+
const isFetching = queryResults.some((q)=>q.isFetching);
|
|
68
|
+
const queryErrors = queryResults.filter((q)=>q.error);
|
|
69
|
+
if (isFetching && hasData) {
|
|
70
|
+
// If the panel has no data, the panel content will show the loading overlay.
|
|
71
|
+
// Therefore, show the circular loading indicator only in case the panel doesn't display the loading overlay already.
|
|
72
|
+
return /*#__PURE__*/ _jsx(CircularProgress, {
|
|
73
|
+
"aria-label": "loading",
|
|
74
|
+
size: "1.125rem"
|
|
75
|
+
});
|
|
76
|
+
} else if (queryErrors.length > 0) {
|
|
77
|
+
const errorTexts = queryErrors.map((q)=>q.error).map((e)=>e?.message ?? e?.toString() ?? 'Unknown error') // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
78
|
+
.join('\n');
|
|
79
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
80
|
+
description: errorTexts,
|
|
81
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
82
|
+
"aria-label": "panel errors",
|
|
83
|
+
size: "small",
|
|
84
|
+
children: /*#__PURE__*/ _jsx(AlertIcon, {
|
|
85
|
+
fontSize: "inherit"
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, [
|
|
91
|
+
queryResults
|
|
92
|
+
]);
|
|
93
|
+
const readActions = useMemo(()=>{
|
|
94
|
+
if (readHandlers !== undefined) {
|
|
95
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
96
|
+
description: TOOLTIP_TEXT.viewPanel,
|
|
97
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
98
|
+
"aria-label": ARIA_LABEL_TEXT.viewPanel(title),
|
|
99
|
+
size: "small",
|
|
100
|
+
onClick: readHandlers.onViewPanelClick,
|
|
101
|
+
children: readHandlers.isPanelViewed ? /*#__PURE__*/ _jsx(ArrowCollapseIcon, {
|
|
102
|
+
fontSize: "inherit"
|
|
103
|
+
}) : /*#__PURE__*/ _jsx(ArrowExpandIcon, {
|
|
104
|
+
fontSize: "inherit"
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}, [
|
|
111
|
+
readHandlers,
|
|
112
|
+
title
|
|
113
|
+
]);
|
|
114
|
+
const editActions = useMemo(()=>{
|
|
115
|
+
if (editHandlers !== undefined) {
|
|
116
|
+
// If there are edit handlers, always just show the edit buttons
|
|
117
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
120
|
+
description: TOOLTIP_TEXT.editPanel,
|
|
121
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
122
|
+
"aria-label": ARIA_LABEL_TEXT.editPanel(title),
|
|
123
|
+
size: "small",
|
|
124
|
+
onClick: editHandlers.onEditPanelClick,
|
|
125
|
+
children: /*#__PURE__*/ _jsx(PencilIcon, {
|
|
126
|
+
fontSize: "inherit"
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
131
|
+
description: TOOLTIP_TEXT.duplicatePanel,
|
|
132
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
133
|
+
"aria-label": ARIA_LABEL_TEXT.duplicatePanel(title),
|
|
134
|
+
size: "small",
|
|
135
|
+
onClick: editHandlers.onDuplicatePanelClick,
|
|
136
|
+
children: /*#__PURE__*/ _jsx(ContentCopyIcon, {
|
|
137
|
+
fontSize: "inherit",
|
|
138
|
+
sx: {
|
|
139
|
+
// Shrink this icon a little bit to look more consistent
|
|
140
|
+
// with the other icons in the header.
|
|
141
|
+
transform: 'scale(0.925)'
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
147
|
+
description: TOOLTIP_TEXT.deletePanel,
|
|
148
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
149
|
+
"aria-label": ARIA_LABEL_TEXT.deletePanel(title),
|
|
150
|
+
size: "small",
|
|
151
|
+
onClick: editHandlers.onDeletePanelClick,
|
|
152
|
+
children: /*#__PURE__*/ _jsx(DeleteIcon, {
|
|
153
|
+
fontSize: "inherit"
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
}, [
|
|
162
|
+
editHandlers,
|
|
163
|
+
title
|
|
164
|
+
]);
|
|
165
|
+
const moveAction = useMemo(()=>{
|
|
166
|
+
if (editActions && !readHandlers?.isPanelViewed) {
|
|
167
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
168
|
+
description: TOOLTIP_TEXT.movePanel,
|
|
169
|
+
children: /*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
170
|
+
"aria-label": ARIA_LABEL_TEXT.movePanel(title),
|
|
171
|
+
size: "small",
|
|
172
|
+
children: /*#__PURE__*/ _jsx(DragIcon, {
|
|
173
|
+
className: "drag-handle",
|
|
174
|
+
sx: {
|
|
175
|
+
cursor: 'grab'
|
|
176
|
+
},
|
|
177
|
+
fontSize: "inherit"
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}, [
|
|
184
|
+
editActions,
|
|
185
|
+
readHandlers,
|
|
186
|
+
title
|
|
187
|
+
]);
|
|
188
|
+
const divider = /*#__PURE__*/ _jsx(Box, {
|
|
189
|
+
sx: {
|
|
190
|
+
flexGrow: 1
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// if the panel is in non-editing, non-fullscreen mode, show certain icons only on hover
|
|
194
|
+
const OnHover = ({ children })=>editHandlers === undefined && !readHandlers?.isPanelViewed ? /*#__PURE__*/ _jsx(Box, {
|
|
195
|
+
sx: {
|
|
196
|
+
display: 'var(--panel-hover, none)'
|
|
197
|
+
},
|
|
198
|
+
children: children
|
|
199
|
+
}) : /*#__PURE__*/ _jsx(_Fragment, {
|
|
200
|
+
children: children
|
|
201
|
+
});
|
|
202
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
203
|
+
children: [
|
|
204
|
+
/*#__PURE__*/ _jsxs(ConditionalBox, {
|
|
205
|
+
sx: (theme)=>({
|
|
206
|
+
[theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).between(0, HEADER_SMALL_WIDTH)]: {
|
|
207
|
+
display: 'flex'
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
children: [
|
|
211
|
+
divider,
|
|
212
|
+
/*#__PURE__*/ _jsxs(OnHover, {
|
|
213
|
+
children: [
|
|
214
|
+
/*#__PURE__*/ _jsxs(OverflowMenu, {
|
|
215
|
+
title: title,
|
|
216
|
+
children: [
|
|
217
|
+
descriptionAction,
|
|
218
|
+
" ",
|
|
219
|
+
linksAction,
|
|
220
|
+
" ",
|
|
221
|
+
queryStateIndicator,
|
|
222
|
+
" ",
|
|
223
|
+
extraActions,
|
|
224
|
+
" ",
|
|
225
|
+
readActions,
|
|
226
|
+
" ",
|
|
227
|
+
editActions
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
moveAction
|
|
231
|
+
]
|
|
232
|
+
})
|
|
233
|
+
]
|
|
234
|
+
}),
|
|
235
|
+
/*#__PURE__*/ _jsxs(ConditionalBox, {
|
|
236
|
+
sx: (theme)=>({
|
|
237
|
+
[theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).between(HEADER_SMALL_WIDTH, HEADER_MEDIUM_WIDTH)]: {
|
|
238
|
+
display: 'flex'
|
|
239
|
+
}
|
|
240
|
+
}),
|
|
241
|
+
children: [
|
|
242
|
+
/*#__PURE__*/ _jsxs(OnHover, {
|
|
243
|
+
children: [
|
|
244
|
+
descriptionAction,
|
|
245
|
+
" ",
|
|
246
|
+
linksAction
|
|
247
|
+
]
|
|
248
|
+
}),
|
|
249
|
+
divider,
|
|
250
|
+
" ",
|
|
251
|
+
queryStateIndicator,
|
|
252
|
+
/*#__PURE__*/ _jsxs(OnHover, {
|
|
253
|
+
children: [
|
|
254
|
+
extraActions,
|
|
255
|
+
" ",
|
|
256
|
+
readActions,
|
|
257
|
+
/*#__PURE__*/ _jsx(OverflowMenu, {
|
|
258
|
+
title: title,
|
|
259
|
+
children: editActions
|
|
260
|
+
}),
|
|
261
|
+
moveAction
|
|
262
|
+
]
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ _jsxs(ConditionalBox, {
|
|
267
|
+
sx: (theme)=>({
|
|
268
|
+
// flip the logic here; if the browser (or jsdom) does not support container queries, always show all icons
|
|
269
|
+
display: 'flex',
|
|
270
|
+
[theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).down(HEADER_MEDIUM_WIDTH)]: {
|
|
271
|
+
display: 'none'
|
|
272
|
+
}
|
|
273
|
+
}),
|
|
274
|
+
children: [
|
|
275
|
+
/*#__PURE__*/ _jsxs(OnHover, {
|
|
276
|
+
children: [
|
|
277
|
+
descriptionAction,
|
|
278
|
+
" ",
|
|
279
|
+
linksAction
|
|
280
|
+
]
|
|
281
|
+
}),
|
|
282
|
+
divider,
|
|
283
|
+
" ",
|
|
284
|
+
queryStateIndicator,
|
|
285
|
+
/*#__PURE__*/ _jsxs(OnHover, {
|
|
286
|
+
children: [
|
|
287
|
+
extraActions,
|
|
288
|
+
" ",
|
|
289
|
+
readActions,
|
|
290
|
+
" ",
|
|
291
|
+
editActions,
|
|
292
|
+
" ",
|
|
293
|
+
moveAction
|
|
294
|
+
]
|
|
295
|
+
})
|
|
296
|
+
]
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
const OverflowMenu = ({ children, title })=>{
|
|
302
|
+
const [anchorPosition, setAnchorPosition] = useState();
|
|
303
|
+
// do not show overflow menu if there is no content (for example, edit actions are hidden)
|
|
304
|
+
const hasContent = /*#__PURE__*/ isValidElement(children) || Array.isArray(children) && children.some(isValidElement);
|
|
305
|
+
if (!hasContent) {
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
const handleClick = (event)=>{
|
|
309
|
+
setAnchorPosition(event.currentTarget.getBoundingClientRect());
|
|
310
|
+
};
|
|
311
|
+
const handleClose = ()=>{
|
|
312
|
+
setAnchorPosition(undefined);
|
|
313
|
+
};
|
|
314
|
+
const open = Boolean(anchorPosition);
|
|
315
|
+
const id = open ? 'actions-menu' : undefined;
|
|
316
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
317
|
+
children: [
|
|
318
|
+
/*#__PURE__*/ _jsx(HeaderIconButton, {
|
|
319
|
+
className: "show-actions",
|
|
320
|
+
"aria-describedby": id,
|
|
321
|
+
onClick: handleClick,
|
|
322
|
+
"aria-label": ARIA_LABEL_TEXT.showPanelActions(title),
|
|
323
|
+
size: "small",
|
|
324
|
+
children: /*#__PURE__*/ _jsx(MenuIcon, {
|
|
325
|
+
fontSize: "inherit"
|
|
326
|
+
})
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ _jsx(Popover, {
|
|
329
|
+
id: id,
|
|
330
|
+
open: open,
|
|
331
|
+
anchorReference: "anchorPosition",
|
|
332
|
+
anchorPosition: anchorPosition,
|
|
333
|
+
onClose: handleClose,
|
|
334
|
+
anchorOrigin: {
|
|
335
|
+
vertical: 'bottom',
|
|
336
|
+
horizontal: 'left'
|
|
337
|
+
},
|
|
338
|
+
children: /*#__PURE__*/ _jsx(Stack, {
|
|
339
|
+
direction: "row",
|
|
340
|
+
alignItems: "center",
|
|
341
|
+
sx: {
|
|
342
|
+
padding: 1
|
|
343
|
+
},
|
|
344
|
+
onClick: handleClose,
|
|
345
|
+
children: children
|
|
346
|
+
})
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
//# 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, Box, Popover, CircularProgress, styled, PopoverPosition } from '@mui/material';\nimport { isValidElement, PropsWithChildren, ReactNode, useMemo, useState } from 'react';\nimport { InfoTooltip } 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 { QueryData } from '@perses-dev/plugin-system';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport { Link } from '@perses-dev/core';\nimport {\n ARIA_LABEL_TEXT,\n HEADER_ACTIONS_CONTAINER_NAME,\n HEADER_MEDIUM_WIDTH,\n HEADER_SMALL_WIDTH,\n TOOLTIP_TEXT,\n} from '../../constants';\nimport { HeaderIconButton } from './HeaderIconButton';\nimport { PanelLinks } from './PanelLinks';\n\nexport interface PanelActionsProps {\n title: string;\n description?: string;\n descriptionTooltipId: string;\n links?: Link[];\n extra?: React.ReactNode;\n editHandlers?: {\n onEditPanelClick: () => void;\n onDuplicatePanelClick: () => void;\n onDeletePanelClick: () => void;\n };\n readHandlers?: {\n isPanelViewed?: boolean;\n onViewPanelClick: () => void;\n };\n queryResults: QueryData[];\n}\n\nconst ConditionalBox = styled(Box)({\n display: 'none',\n alignItems: 'center',\n flexGrow: 1,\n justifyContent: 'flex-end',\n});\n\nexport const PanelActions: React.FC<PanelActionsProps> = ({\n editHandlers,\n readHandlers,\n extra,\n title,\n description,\n descriptionTooltipId,\n links,\n queryResults,\n}) => {\n const descriptionAction = useMemo(() => {\n if (description && description.trim().length > 0) {\n return (\n <InfoTooltip id={descriptionTooltipId} description={description} enterDelay={100}>\n <HeaderIconButton aria-label=\"panel description\" size=\"small\">\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n );\n }\n return undefined;\n }, [descriptionTooltipId, description]);\n const linksAction = links && links.length > 0 && <PanelLinks links={links} />;\n const extraActions = editHandlers === undefined && extra;\n\n const queryStateIndicator = useMemo(() => {\n const hasData = queryResults.some((q) => q.data);\n const isFetching = queryResults.some((q) => q.isFetching);\n const queryErrors = queryResults.filter((q) => q.error);\n if (isFetching && hasData) {\n // If the panel has no data, the panel content will show the loading overlay.\n // Therefore, show the circular loading indicator only in case the panel doesn't display the loading overlay already.\n return <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />;\n } else if (queryErrors.length > 0) {\n const errorTexts = queryErrors\n .map((q) => q.error)\n .map((e: any) => e?.message ?? e?.toString() ?? 'Unknown error') // eslint-disable-line @typescript-eslint/no-explicit-any\n .join('\\n');\n\n return (\n <InfoTooltip description={errorTexts}>\n <HeaderIconButton aria-label=\"panel errors\" size=\"small\">\n <AlertIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n );\n }\n }, [queryResults]);\n\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 const moveAction = useMemo(() => {\n if (editActions && !readHandlers?.isPanelViewed) {\n return (\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 }\n return undefined;\n }, [editActions, readHandlers, title]);\n\n const divider = <Box sx={{ flexGrow: 1 }}></Box>;\n\n // if the panel is in non-editing, non-fullscreen mode, show certain icons only on hover\n const OnHover = ({ children }: PropsWithChildren): ReactNode =>\n editHandlers === undefined && !readHandlers?.isPanelViewed ? (\n <Box sx={{ display: 'var(--panel-hover, none)' }}>{children}</Box>\n ) : (\n <>{children}</>\n );\n\n return (\n <>\n {/* small panel width: move all icons except move/grab to overflow menu */}\n <ConditionalBox\n sx={(theme) => ({\n [theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).between(0, HEADER_SMALL_WIDTH)]: { display: 'flex' },\n })}\n >\n {divider}\n <OnHover>\n <OverflowMenu title={title}>\n {descriptionAction} {linksAction} {queryStateIndicator} {extraActions} {readActions} {editActions}\n </OverflowMenu>\n {moveAction}\n </OnHover>\n </ConditionalBox>\n\n {/* medium panel width: move edit icons to overflow menu */}\n <ConditionalBox\n sx={(theme) => ({\n [theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).between(HEADER_SMALL_WIDTH, HEADER_MEDIUM_WIDTH)]: {\n display: 'flex',\n },\n })}\n >\n <OnHover>\n {descriptionAction} {linksAction}\n </OnHover>\n {divider} {queryStateIndicator}\n <OnHover>\n {extraActions} {readActions}\n <OverflowMenu title={title}>{editActions}</OverflowMenu>\n {moveAction}\n </OnHover>\n </ConditionalBox>\n\n {/* large panel width: show all icons in panel header */}\n <ConditionalBox\n sx={(theme) => ({\n // flip the logic here; if the browser (or jsdom) does not support container queries, always show all icons\n display: 'flex',\n [theme.containerQueries(HEADER_ACTIONS_CONTAINER_NAME).down(HEADER_MEDIUM_WIDTH)]: { display: 'none' },\n })}\n >\n <OnHover>\n {descriptionAction} {linksAction}\n </OnHover>\n {divider} {queryStateIndicator}\n <OnHover>\n {extraActions} {readActions} {editActions} {moveAction}\n </OnHover>\n </ConditionalBox>\n </>\n );\n};\n\nconst OverflowMenu: React.FC<PropsWithChildren<{ title: string }>> = ({ children, title }) => {\n const [anchorPosition, setAnchorPosition] = useState<PopoverPosition>();\n\n // do not show overflow menu if there is no content (for example, edit actions are hidden)\n const hasContent = isValidElement(children) || (Array.isArray(children) && children.some(isValidElement));\n if (!hasContent) {\n return undefined;\n }\n\n const handleClick = (event: React.MouseEvent<HTMLElement>): undefined => {\n setAnchorPosition(event.currentTarget.getBoundingClientRect());\n };\n\n const handleClose = (): undefined => {\n setAnchorPosition(undefined);\n };\n\n const open = Boolean(anchorPosition);\n const id = open ? 'actions-menu' : 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 anchorReference=\"anchorPosition\"\n anchorPosition={anchorPosition}\n onClose={handleClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n >\n <Stack direction=\"row\" alignItems=\"center\" sx={{ padding: 1 }} onClick={handleClose}>\n {children}\n </Stack>\n </Popover>\n </>\n );\n};\n"],"names":["Stack","Box","Popover","CircularProgress","styled","isValidElement","useMemo","useState","InfoTooltip","ArrowCollapseIcon","ArrowExpandIcon","PencilIcon","DeleteIcon","DragIcon","ContentCopyIcon","MenuIcon","AlertIcon","InformationOutlineIcon","ARIA_LABEL_TEXT","HEADER_ACTIONS_CONTAINER_NAME","HEADER_MEDIUM_WIDTH","HEADER_SMALL_WIDTH","TOOLTIP_TEXT","HeaderIconButton","PanelLinks","ConditionalBox","display","alignItems","flexGrow","justifyContent","PanelActions","editHandlers","readHandlers","extra","title","description","descriptionTooltipId","links","queryResults","descriptionAction","trim","length","id","enterDelay","aria-label","size","aria-describedby","aria-hidden","fontSize","sx","color","theme","palette","text","secondary","undefined","linksAction","extraActions","queryStateIndicator","hasData","some","q","data","isFetching","queryErrors","filter","error","errorTexts","map","e","message","toString","join","readActions","viewPanel","onClick","onViewPanelClick","isPanelViewed","editActions","editPanel","onEditPanelClick","duplicatePanel","onDuplicatePanelClick","transform","deletePanel","onDeletePanelClick","moveAction","movePanel","className","cursor","divider","OnHover","children","containerQueries","between","OverflowMenu","down","anchorPosition","setAnchorPosition","hasContent","Array","isArray","handleClick","event","currentTarget","getBoundingClientRect","handleClose","open","Boolean","showPanelActions","anchorReference","onClose","anchorOrigin","vertical","horizontal","direction","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,SAASA,KAAK,EAAEC,GAAG,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,MAAM,QAAyB,gBAAgB;AAC/F,SAASC,cAAc,EAAgCC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACxF,SAASC,WAAW,QAAQ,yBAAyB;AACrD,OAAOC,uBAAuB,gCAAgC;AAC9D,OAAOC,qBAAqB,8BAA8B;AAC1D,OAAOC,gBAAgB,gCAAgC;AACvD,OAAO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K,MAAMC,aAAa,CAACC,qBAAqB;IAC7D;IAEA,MAAMC,cAAc;QAClBR,kBAAkB3C;IACpB;IAEA,MAAMoD,OAAOC,QAAQX;IACrB,MAAMvD,KAAKiE,OAAO,iBAAiBpD;IAEnC,qBACE;;0BACE,KAAChC;gBACCiE,WAAU;gBACV1C,oBAAkBJ;gBAClBiC,SAAS2B;gBACT1D,cAAY1B,gBAAgB2F,gBAAgB,CAAC3E;gBAC7CW,MAAK;0BAEL,cAAA,KAAC9B;oBAASiC,UAAS;;;0BAErB,KAAC9C;gBACCwC,IAAIA;gBACJiE,MAAMA;gBACNG,iBAAgB;gBAChBb,gBAAgBA;gBAChBc,SAASL;gBACTM,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;0BAEA,cAAA,KAAClH;oBAAMmH,WAAU;oBAAMxF,YAAW;oBAASsB,IAAI;wBAAEmE,SAAS;oBAAE;oBAAGzC,SAAS+B;8BACrEd;;;;;AAKX"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { PanelProps } from '@perses-dev/plugin-system';
|
|
1
|
+
import { PanelProps, QueryData } from '@perses-dev/plugin-system';
|
|
2
2
|
import { UnknownSpec, PanelDefinition } from '@perses-dev/core';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
|
-
export interface PanelContentProps extends PanelProps<UnknownSpec> {
|
|
4
|
+
export interface PanelContentProps extends Omit<PanelProps<UnknownSpec>, 'queryResults'> {
|
|
5
5
|
panelPluginKind: string;
|
|
6
6
|
definition?: PanelDefinition<UnknownSpec>;
|
|
7
|
+
queryResults: QueryData[];
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* Based on the status of the queries (loading, error or data available), this component renders a
|
|
11
|
+
* loading overlay, throws an error, or renders the panel content.
|
|
11
12
|
*/
|
|
12
13
|
export declare function PanelContent(props: PanelContentProps): ReactElement;
|
|
13
14
|
//# 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;
|
|
1
|
+
{"version":3,"file":"PanelContent.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelContent.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,UAAU,EAAE,SAAS,EAAe,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,eAAe,EAAiB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAKrC,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC;IACtF,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAC1C,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAiDnE"}
|