import { Duration } from 'date-fns'; import { AbsoluteTimeRange, DurationString } from '@perses-dev/spec'; import { FormatOptions } from './units'; export type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Bits' | 'Throughput' | 'Currency' | 'Temperature' | 'Date'; /** * Configuration for rendering units that are part of a group. */ export type UnitGroupConfig = { /** * The label that is shown in the UI. */ label: string; /** * When true, the unit group supports setting decimal places. */ decimalPlaces?: boolean; /** * When true, the unit group supports enabling shortValues. */ shortValues?: boolean; }; /** * Configuration for rendering a specific unit. */ export type UnitConfig = { /** * The group the unit is part of. This will inform common rendering behavior. */ group?: UnitGroup; /** * When true, this unit will not be displayed in the unit selector. This is * useful for units that are shorthand variants of other units. */ disableSelectorOption?: boolean; /** * The label that is shown in the UI. */ label: string; }; /** * Used in the tests for each type of unit. */ export interface UnitTestCase { value: number; format: FormatOptions; expected: string; } export interface IntervalTestCase { timeRange: AbsoluteTimeRange; expected: Duration; } export interface FormatTestCase { duration: Duration; expected: DurationString; } //# sourceMappingURL=types.d.ts.map