@papernote/ui
Version:
A modern React component library with a paper notebook aesthetic - minimal, professional, and expressive
50 lines • 1.54 kB
TypeScript
/**
* Format types for statistics values
*/
export type StatisticFormat = 'number' | 'currency' | 'percentage' | 'decimal' | 'custom';
/**
* Configuration for a statistic value with automatic formatting
*/
export interface StatisticConfig {
label: string;
value: number;
format: StatisticFormat;
/** Custom formatter function (required if format is 'custom') */
customFormatter?: (value: number) => string;
/** Number of decimal places (for 'decimal' format) */
decimals?: number;
/** Currency code (default: 'USD') */
currency?: string;
/** Subtitle text */
subtitle?: string;
/** Icon element */
icon?: React.ReactNode;
/** Value text color */
valueColor?: string;
/** Icon background color */
iconColor?: string;
}
/**
* Formatted statistic card ready for display
*/
export interface FormattedStatistic {
icon: React.ReactNode;
label: string;
value: string | number;
subtitle?: string;
valueColor?: string;
iconColor?: string;
}
/**
* Format a number value according to the specified format type
*/
export declare function formatStatisticValue(value: number, format: StatisticFormat, options?: {
decimals?: number;
currency?: string;
customFormatter?: (value: number) => string;
}): string;
/**
* Transform an array of statistic configs into formatted statistics ready for display
*/
export declare function formatStatistics(configs: StatisticConfig[]): FormattedStatistic[];
//# sourceMappingURL=statisticsFormatter.d.ts.map