@umituz/web-dashboard 2.5.1 → 2.5.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-dashboard",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "Dashboard Layout System - Customizable, themeable dashboard layouts and settings",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -9,12 +9,33 @@ import type {
9
9
  Currency,
10
10
  PlanTier,
11
11
  Subscription,
12
+ SubscriptionStatus,
12
13
  PaymentMethod,
13
14
  Invoice,
14
15
  InvoiceStatus,
15
16
  UsageMetric,
16
17
  } from "../types/billing";
17
18
 
19
+ /**
20
+ * Format number with K/M/B suffixes
21
+ *
22
+ * @param num - Number to format
23
+ * @param decimals - Number of decimal places (default: 1)
24
+ * @returns Formatted string
25
+ */
26
+ export function formatNumber(num: number, decimals: number = 1): string {
27
+ if (num >= 1_000_000_000) {
28
+ return (num / 1_000_000_000).toFixed(decimals) + "B";
29
+ }
30
+ if (num >= 1_000_000) {
31
+ return (num / 1_000_000).toFixed(decimals) + "M";
32
+ }
33
+ if (num >= 1_000) {
34
+ return (num / 1_000).toFixed(decimals) + "K";
35
+ }
36
+ return num.toFixed(decimals);
37
+ }
38
+
18
39
  /**
19
40
  * Format price with currency
20
41
  *