import { IWidgetAction } from "./DashboardCallout"; import { IChartProps } from "../Chart/Chart"; import { TDashboardInteraction } from "./Dashboard"; import { TTextObject } from "../../translations"; import { IDescriptionListProps } from "./DescriptionList"; /** * The widget’s target size in the Dashboard’s grid layout. * @public */ export declare enum EWidgetSize { /** * The widget will occupy 1×1 grid cells. */ Single = "single", /** * The widget will occupy 2×1 grid cells. */ Double = "double", /** * The widget will occupy 3×1 grid cells. */ Triple = "triple", /** * The widget will occupy 2×2 grid cells. */ Box = "box" } /** * A Dashboard widget is rendered as a card of a certain size, containing the content specified. * @public */ export interface IWidget { /** * A unique ID for the widget. */ id: string; /** * The widget’s target size. */ size: EWidgetSize; /** * The title of the widget, rendered in a header style. */ title: TTextObject; /** * Text rendered in boxy test style below the title. */ desc?: TTextObject; /** * A collection of actions available in the widget’s overflow menu. */ widgetActionGroup?: IWidgetAction[]; /** * A collection of filters available in the widget’s filter menu. This must be paired with `bodyByFilter` to display. */ widgetFilterGroup?: Omit[]; /** * The initial filter’s id to apply. If this is not specified, and both `widgetFilterGroup` and `bodyByFilter` are, then the initial filter resolves to the first in `widgetFilterGroup`. */ initialFilter?: string; /** * The content to make available in the widget. */ body?: IWidgetBodyContent[]; /** * The content to make available in the widget based on which filter is active, by id. This must be paired with `widgetFilterGroup` to display, otherwise `body` is used. `body` is also displayed when `bodyByFilter` does not have a value for a given filter id. */ bodyByFilter?: Record; /** * A link to render at the end of the widget’s content. */ link?: IWidgetLink | IWidgetButton; /** * @internal */ onInteraction?: (interaction: TDashboardInteraction) => void; /** * @internal */ hideWidget?: (widgetId: string) => void; } /** * A chart widget * @public */ export interface IChartWidgetContent { type: "chart" | string; chart: IChartProps; } /** * A description list widget * @public */ export interface IDescriptionListWidgetContent extends Omit { type: "dl" | string; } /** * A plain text widget * @public */ export interface ITextWidgetContent { type: "text"; text: TTextObject; } /** * A placeholder widget * @internal */ interface IPlaceholderWidgetContent { type: "placeholder" | string; message: string; } /** * Widget content specifies a type, then a payload with a special key depending on the type of widget. * @public */ export declare type TWidgetContent = IChartWidgetContent | IDescriptionListWidgetContent | IPlaceholderWidgetContent | ITextWidgetContent; /** * A piece of content to make available in the widget. * @public */ export interface IWidgetBodyContent { /** * An ID unique to the piece of content. */ id: string; /** * A title which will appear as a tab’s label in the Dashboard widget. This will only appear if * the widget hosts multiple body content objects. */ title: TTextObject; /** * The content, as a React Node. */ content: TWidgetContent; } /** * @public */ export interface IWidgetLink { title?: TTextObject; href: string; } /** * @public */ export interface IWidgetButton { title?: TTextObject; actionId: string; } /** * @public */ export interface IDashboardInteractionWidgetButton { event: "click"; target: "widget"; widget: string; subject: string; } export declare const Widget: ({ id, size, body, bodyByFilter, link, title, desc, widgetActionGroup, widgetFilterGroup, initialFilter, hideWidget, onInteraction, }: IWidget) => JSX.Element; export {}; //# sourceMappingURL=DashboardWidget.d.ts.map