diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx index 05d3ae406e5..2faef6377ee 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import { CSSProperties, ReactElement, ReactNode, useId, useState } from 'react'; +import { CSSProperties, PropsWithChildren, ReactElement, ReactNode, useId, useState } from 'react'; import * as React from 'react'; import { useMeasure, useToggle } from 'react-use'; @@ -110,6 +110,11 @@ interface HoverHeader { hoverHeaderOffset?: number; } +const MaybeWrap = ({ children }: PropsWithChildren<{}>) => { + const styles = useStyles2(getStyles); + return getFeatureToggle('preventPanelChromeOverflow') ?
{children}
: children; +}; + /** * @internal */ @@ -330,102 +335,104 @@ export function PanelChrome({ ); return ( - // tabIndex={0} is needed for keyboard accessibility in the plot area -
-
- {loadingState === LoadingState.Loading ? ( - - ) : null} -
+ + {/* tabIndex={0} is needed for keyboard accessibility in the plot area */} +
+
+ {loadingState === LoadingState.Loading ? ( + + ) : null} +
- {hoverHeader && ( - <> - - {headerContent} - - - {statusMessage && ( -
- -
- )} - - )} - - {hasHeader && ( -
- {statusMessage && ( -
- -
- )} - - {headerContent} - - {menu && ( - + - )} -
- )} + > + {headerContent} + - {!collapsed && ( -
- {typeof children === 'function' ? children(innerWidth, innerHeight) : children} -
- )} -
+ {statusMessage && ( +
+ +
+ )} + + )} + + {hasHeader && ( +
+ {statusMessage && ( +
+ +
+ )} + + {headerContent} + + {menu && ( + + )} +
+ )} + + {!collapsed && ( +
+ {typeof children === 'function' ? children(innerWidth, innerHeight) : children} +
+ )} +
+ ); } @@ -481,10 +488,13 @@ const getStyles = (theme: GrafanaTheme2) => { return { container: css({ + position: 'relative', + }), + panel: css({ label: 'panel-container', backgroundColor: background, border: `1px solid ${borderColor}`, - position: 'relative', + position: getFeatureToggle('preventPanelChromeOverflow') ? 'unset' : 'relative', borderRadius: theme.shape.radius.default, height: '100%', display: 'flex', @@ -521,7 +531,7 @@ const getStyles = (theme: GrafanaTheme2) => { }, }, }), - transparentContainer: css({ + panelTransparent: css({ label: 'panel-transparent-container', backgroundColor: 'transparent', border: '1px solid transparent',