@nuskin/react-mysite-elements 1.6.0-comx-2229.5 → 1.6.0-comx-2229.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,18 @@ export declare function calculateTotalPages<T>(items: T[], itemsPerPage: number)
2
2
  export declare function paginateItems<T>(items: T[], currentPage: number, itemsPerPage: number): T[];
3
3
  export declare function sortByNumericProperty<T extends Record<string, unknown>>(items: T[], key: keyof T, direction?: 'asc' | 'desc'): T[];
4
4
  export declare function calculatePercentage(value: number, total: number, decimalPlaces?: number): string;
5
+ /**
6
+ * Formats a percentage by removing trailing zeros and unnecessary decimal points.
7
+ * Examples:
8
+ * - formatPercentage(100) → "100"
9
+ * - formatPercentage(12.1) → "12.1"
10
+ * - formatPercentage(12.55) → "12.55"
11
+ * - formatPercentage(0) → "0"
12
+ * @param value - The percentage value as a number
13
+ * @param decimals - Maximum decimal places to round to (default: 2)
14
+ * @returns Formatted percentage string without trailing zeros or decimal point
15
+ */
16
+ export declare function formatPercentage(value: number, decimals?: number): string;
5
17
  export declare function usePaginatedItems<T>(items: T[], currentPage: number, itemsPerPage: number): {
6
18
  totalPages: number;
7
19
  pageItems: T[];