import type { MetricType } from "@gooddata/sdk-model"; import { type IFormatPreset, type IFormatTemplate } from "../typings.js"; /** * Configuration for the useMetricTypePresets hook. * @internal */ export type UseMetricTypePresetsConfig = { /** * The metric type. When "CURRENCY", currency-specific presets are shown. * When undefined, standard numeric presets are shown. */ metricType?: MetricType; /** * The currency format override from workspace settings. * When set and metricType is "CURRENCY", an "inherit" preset is added. */ currencyFormatOverride?: string | null; /** * Function to format localized messages (e.g., from react-intl). */ formatMessage: (descriptor: { id: string; }) => string; }; /** * Result from the useMetricTypePresets hook. * @internal */ export type UseMetricTypePresetsResult = { /** * Format presets based on metric type. * For CURRENCY: currency presets with optional inherit preset. * For other types: standard numeric presets. */ presets: IFormatPreset[]; /** * Format templates for the Custom dialog. * For CURRENCY metrics: only advanced templates (currency formats are in presets). * For other types: all templates. */ templates: IFormatTemplate[]; /** * The inherit preset if available (only for CURRENCY with override). */ inheritPreset: IFormatPreset | null; }; /** * Hook that creates format presets and templates based on metric type. * * This hook encapsulates the logic for building format options that respect: * - Metric type (CURRENCY vs standard) * - Currency format override (creates "inherit" preset) * * @example * ```tsx * const { presets, templates, inheritPreset } = useMetricTypePresets({ * metricType: "CURRENCY", * currencyFormatOverride: "$#,##0.00", * formatMessage: (d) => intl.formatMessage(d), * }); * ``` * * @internal */ export declare function useMetricTypePresets({ metricType, currencyFormatOverride, formatMessage, }: UseMetricTypePresetsConfig): UseMetricTypePresetsResult; /** * Hook that creates standard numeric format presets. * Use this when you don't need metric type awareness. * * @param formatMessage - Function to format localized messages * @returns Array of standard format presets * @internal */ export declare function useStandardPresets(formatMessage: (descriptor: { id: string; }) => string): IFormatPreset[]; /** * Hook that creates advanced format templates. * Returns only templates that don't duplicate presets (complex conditional formats). * * @param formatMessage - Function to format localized messages * @returns Array of advanced format templates * @internal */ export declare function useFormatTemplates(formatMessage: (descriptor: { id: string; }) => string): IFormatTemplate[]; //# sourceMappingURL=useMetricTypePresets.d.ts.map