From 9dc3574cc15dbd503a081776fe75c7cebeb051a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 2 Feb 2021 10:19:59 +0100 Subject: [PATCH] [v7.4.x]: Menu: Mark menu components as internal (#30801) --- packages/grafana-ui/src/components/GraphNG/GraphNG.tsx | 10 ++++++++-- packages/grafana-ui/src/components/Menu/Menu.tsx | 7 ++++++- packages/grafana-ui/src/components/uPlot/types.ts | 2 +- .../app/plugins/panel/timeseries/TimeSeriesPanel.tsx | 6 ++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/grafana-ui/src/components/GraphNG/GraphNG.tsx b/packages/grafana-ui/src/components/GraphNG/GraphNG.tsx index e343106f9bd..8cb23ea2fb5 100755 --- a/packages/grafana-ui/src/components/GraphNG/GraphNG.tsx +++ b/packages/grafana-ui/src/components/GraphNG/GraphNG.tsx @@ -14,10 +14,10 @@ import { outerJoinDataFrames, reduceField, TimeRange, + TimeZone, } from '@grafana/data'; import { useTheme } from '../../themes'; import { UPlotChart } from '../uPlot/Plot'; -import { PlotProps } from '../uPlot/types'; import { AxisPlacement, DrawStyle, @@ -41,12 +41,18 @@ export interface XYFieldMatchers { x: FieldMatcher; // first match y: FieldMatcher; } -export interface GraphNGProps extends Omit { + +export interface GraphNGProps { + width: number; + height: number; data: DataFrame[]; + timeRange: TimeRange; legend: VizLegendOptions; + timeZone: TimeZone; fields?: XYFieldMatchers; // default will assume timeseries data onLegendClick?: (event: GraphNGLegendEvent) => void; onSeriesColorChange?: (label: string, color: string) => void; + children?: React.ReactNode; } const defaultConfig: GraphFieldConfig = { diff --git a/packages/grafana-ui/src/components/Menu/Menu.tsx b/packages/grafana-ui/src/components/Menu/Menu.tsx index 18b6ec40261..145e3adf7b6 100644 --- a/packages/grafana-ui/src/components/Menu/Menu.tsx +++ b/packages/grafana-ui/src/components/Menu/Menu.tsx @@ -6,6 +6,7 @@ import { useStyles } from '../../themes'; import { Icon } from '../Icon/Icon'; import { IconName } from '../../types'; +/** @internal */ export interface MenuItem { /** Label of the menu item */ label: string; @@ -20,6 +21,8 @@ export interface MenuItem { /** Handler for the click behaviour */ group?: string; } + +/** @internal */ export interface MenuItemsGroup { /** Label for the menu items group */ label?: string; @@ -27,6 +30,7 @@ export interface MenuItemsGroup { items: MenuItem[]; } +/** @internal */ export interface MenuProps extends React.HTMLAttributes { /** React element rendered at the top of the menu */ header?: React.ReactNode; @@ -36,7 +40,7 @@ export interface MenuProps extends React.HTMLAttributes { onClose?: () => void; } -/** @public */ +/** @internal */ export const Menu = React.forwardRef(({ header, items, onClose, ...otherProps }, ref) => { const styles = useStyles(getMenuStyles); const onClick = useCallback(() => { @@ -57,6 +61,7 @@ export const Menu = React.forwardRef(({ header, items ); }); + Menu.displayName = 'Menu'; interface MenuGroupProps { diff --git a/packages/grafana-ui/src/components/uPlot/types.ts b/packages/grafana-ui/src/components/uPlot/types.ts index 15103e60c3c..62ce4e981b3 100755 --- a/packages/grafana-ui/src/components/uPlot/types.ts +++ b/packages/grafana-ui/src/components/uPlot/types.ts @@ -23,7 +23,7 @@ export interface PlotProps { width: number; height: number; config: UPlotConfigBuilder; - children?: React.ReactElement[]; + children?: React.ReactNode; } export abstract class PlotConfigBuilder { diff --git a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx index eed8d82ea49..ca249b6a875 100644 --- a/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx +++ b/public/app/plugins/panel/timeseries/TimeSeriesPanel.tsx @@ -55,12 +55,10 @@ export const TimeSeriesPanel: React.FC = ({ - {data.annotations ? ( + {data.annotations && ( - ) : ( - <> )} - {data.annotations ? : <>} + {data.annotations && } ); };