From b89599a01482f5d077ffb2672d4d739caa3c3846 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Tue, 5 Mar 2024 15:19:55 +0100 Subject: [PATCH] wip(grafana/ui): put back LayoutItemContext so vite builds --- .../components/Layout/LayoutItemContext.ts | 21 +++++++++++++++++++ packages/grafana-ui/src/components/index.ts | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 packages/grafana-ui/src/components/Layout/LayoutItemContext.ts diff --git a/packages/grafana-ui/src/components/Layout/LayoutItemContext.ts b/packages/grafana-ui/src/components/Layout/LayoutItemContext.ts new file mode 100644 index 00000000000..08832aab601 --- /dev/null +++ b/packages/grafana-ui/src/components/Layout/LayoutItemContext.ts @@ -0,0 +1,21 @@ +import { createContext } from 'react'; + +export interface LayoutItemContextProps { + boostZIndex(): () => void; +} + +/** + * Provides an API for downstream components (e.g. within panels) to inform the layout + * that anchored tooltips or context menus could overflow the panel bounds. The layout + * system can then boost the z-index of items with any anchored contents to prevent the overflown + * content from rendering underneath adjacent layout items (e.g. other panels) that naturally + * render later/higher in the stacking order + * + * This is used by VizTooltips and Annotations, which anchor to data points or time range within + * the viz drawing area + * + * @internal + */ +export const LayoutItemContext = createContext({ + boostZIndex: () => () => {}, +}); diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index cdfe02e32b6..96a052e3534 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -284,6 +284,8 @@ export { Divider } from './Divider/Divider'; export { getDragStyles, type DragHandlePosition } from './DragHandle/DragHandle'; export { useSplitter } from './Splitter/useSplitter'; +export { LayoutItemContext, type LayoutItemContextProps } from './Layout/LayoutItemContext'; + /** @deprecated Please use non-legacy versions of these components */ const LegacyForms = { SecretFormField,