import type { IntentProps } from '../../../core/slots/Intent/Intent.js'; import type { BehaviorTrackingProps } from '../../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../../core/types/data-props.js'; import type { MaskingProps } from '../../../core/types/masking-props.js'; import type { StylingProps } from '../../../core/types/styling-props.js'; import type { SingleValueAlignment } from '../../core/components/single-value-renderer/types/single-value-base-props.js'; import type { SparklineXAxisProps } from '../../core/components/sparkline-display/types/sparkline-x-axis-props.js'; import type { SparklineYAxisProps } from '../../core/components/sparkline-display/types/sparkline-y-axis-props.js'; import type { CompactToolbarProps } from '../../core/slots/toolbar/CompactToolbar.js'; import type { ColorRuleProps } from '../../core/types/color-rule.js'; import type { SeriesActionsTemplate } from '../../core/types/series-actions-template.js'; import type { SingleValueGridSparklineProps } from '../slots/Sparkline.js'; import type { SingleValueGridTrendProps } from '../slots/Trend.js'; import type { SingleValueGridValueProps } from '../slots/Value.js'; /** Omits all the props ending with 'Accessor' suffix */ type OmitAccessors = { [K in keyof T as K extends `${string}Accessor` ? never : K]: T[K]; }; /** * Props for the SingleValueGrid component. * @public */ export interface SingleValueGridProps extends StylingProps, MaskingProps, DataTestId, BehaviorTrackingProps { /** Show the loading indicator when truly. * @defaultValue false */ loading?: boolean; /** The data source for the SingleValueGrid component. */ data: (number | string | Record)[]; /** * The default color for the SingleValues. * This color will be overwritten by individual colors specified in the SingleValueGridData or ColorRules slot. */ color?: string; /** Accessor function to override colors for individual SingleValue components. */ colorAccessor?: string; /** This option will define if the color is applied to the value or to the background. */ applyThresholdBackground?: boolean; /** Accessor function for individual labels of each SingleValue component. */ labelAccessor?: string; /** Accessor function for individual prefix icons of each SingleValue component. */ prefixIconAccessor?: string; /** * Horizontal alignment of icons, values, units, labels, and trends within each SingleValue component. * @defaultValue 'start' */ alignment?: SingleValueAlignment; /** * Actions to be shown in individual SingleValue components */ seriesActions?: (data: Record) => SeriesActionsTemplate; } /** @internal */ export type SingleValueGridRequiredProps = OmitAccessors, 'color' | 'data' | 'colorRules' | 'thresholds' | 'seriesActions'>>; /** @internal */ export type SingleValueGridSparklineRequiredProps = OmitAccessors, 'color' | 'labelsFixedWidth'>>; /** @internal */ export type SingleValueGridTrendRequiredProps = OmitAccessors, 'colorsOverride' | 'formatter'>>>; /** @internal */ export interface SingleValueGridAccessorsConfig { colorAccessor?: string; labelAccessor?: string; prefixIconAccessor?: string; sparkline?: { dataAccessor?: string; colorAccessor?: string; xAxis?: SparklineXAxisProps; yAxis?: SparklineYAxisProps; }; value?: { dataAccessor?: string; formatterAccessor?: string; unitAccessor?: string; }; trend?: { directionAccessor?: string; valueAccessor?: string; labelAccessor?: string; formatterAccessor?: string; inverseTrendAccessor?: string; }; } /** @internal */ export type SingleValueGridSparklineConfig = OmitAccessors>; /** @internal */ export type SingleValueGridValueConfig = OmitAccessors>; /** @internal */ export type SingleValueGridTrendConfig = OmitAccessors>; /** @internal */ export interface SingleValueGridConfig extends OmitAccessors> { sparkline?: SingleValueGridSparklineConfig; value?: SingleValueGridValueConfig; trend?: SingleValueGridTrendConfig; colorRules?: ColorRuleProps[]; } /** @internal */ export interface PartialSingleValueGridConfig extends Partial>> { sparkline?: Partial; value?: Partial; trend?: Partial; colorRules?: ColorRuleProps[]; toolbar?: SingleValueGridToolbarConfig; intents?: SingleValueGridIntentsConfig; } /** @internal */ export interface SingleValueGridConfigWithPropsFromGrid extends PartialSingleValueGridConfig { toolbar: SingleValueGridToolbarConfig; intents: SingleValueGridIntentsConfig; } /** @internal */ export type SingleValueGridToolbarConfig = Required; /** @internal */ export type SingleValueGridIntentsConfig = { grid: IntentProps[]; single: SingleValueGridProps['seriesActions']; none: boolean; }; export {};