@cranberry-money/shared-constants 4.10.0 → 4.11.0

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.
@@ -10,16 +10,16 @@ export declare const STATUS_COLORS: {
10
10
  readonly NEUTRAL: "text-gray-600";
11
11
  };
12
12
  export type StatusColor = (typeof STATUS_COLORS)[keyof typeof STATUS_COLORS];
13
- export declare const STATUS_COLOR_PENDING = "text-warning-600";
14
- export declare const STATUS_COLOR_AWAITING = "text-warning-600";
15
- export declare const STATUS_COLOR_PROCESSING = "text-primary-600";
16
- export declare const STATUS_COLOR_IN_PROGRESS = "text-primary-600";
17
- export declare const STATUS_COLOR_APPROVED = "text-success-600";
18
- export declare const STATUS_COLOR_COMPLETED = "text-success-700";
19
- export declare const STATUS_COLOR_REJECTED = "text-error-600";
20
- export declare const STATUS_COLOR_FAILED = "text-error-700";
21
- export declare const STATUS_COLOR_CANCELLED = "text-content-subtle";
22
- export declare const STATUS_COLOR_DEFAULT = "text-content-subtle";
13
+ export declare const STATUS_COLOR_PENDING: "text-warning-600";
14
+ export declare const STATUS_COLOR_AWAITING: "text-warning-600";
15
+ export declare const STATUS_COLOR_PROCESSING: "text-primary-600";
16
+ export declare const STATUS_COLOR_IN_PROGRESS: "text-primary-600";
17
+ export declare const STATUS_COLOR_APPROVED: "text-success-600";
18
+ export declare const STATUS_COLOR_COMPLETED: "text-success-700";
19
+ export declare const STATUS_COLOR_REJECTED: "text-error-600";
20
+ export declare const STATUS_COLOR_FAILED: "text-error-700";
21
+ export declare const STATUS_COLOR_CANCELLED: "text-content-subtle";
22
+ export declare const STATUS_COLOR_DEFAULT: "text-content-subtle";
23
23
  export declare const STATUS_BG_COLORS: {
24
24
  readonly SUCCESS: "bg-green-50";
25
25
  readonly WARNING: "bg-amber-50";
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/ui/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eA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AiC,CAAC;AACpE,eAAO,MAAM,uBAAuB,oBAAmC,CAAC;AACxE,eAAO,MAAM,wBAAwB,oBAAoC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,oBAAiC,CAAC;AACpE,eAAO,MAAM,sBAAsB,oBAAkC,CAAC;AACtE,eAAO,MAAM,qBAAqB,kBAAiC,CAAC;AACpE,eAAO,MAAM,mBAAmB,kBAA+B,CAAC;AAChE,eAAO,MAAM,sBAAsB,uBAAkC,CAAC;AACtE,eAAO,MAAM,oBAAoB,uBAAgC,CAAC;AAGlE,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAGX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAIX,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqB/C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAC"}
package/dist/ui/colors.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * UI color constants
3
3
  */
4
+ import { UNIFIED_STATUS_COLORS } from './status-colors-unified';
4
5
  // Chart color palette (10 colors for data visualization) - Blueberry compatible
5
6
  export const CHART_COLORS = [
6
7
  '#3B82F6', // Blue - primary data color
@@ -23,16 +24,17 @@ export const STATUS_COLORS = {
23
24
  NEUTRAL: 'text-gray-600',
24
25
  };
25
26
  // Individual status color constants for Blueberry compatibility
26
- export const STATUS_COLOR_PENDING = 'text-warning-600';
27
- export const STATUS_COLOR_AWAITING = 'text-warning-600';
28
- export const STATUS_COLOR_PROCESSING = 'text-primary-600';
29
- export const STATUS_COLOR_IN_PROGRESS = 'text-primary-600';
30
- export const STATUS_COLOR_APPROVED = 'text-success-600';
31
- export const STATUS_COLOR_COMPLETED = 'text-success-700';
32
- export const STATUS_COLOR_REJECTED = 'text-error-600';
33
- export const STATUS_COLOR_FAILED = 'text-error-700';
34
- export const STATUS_COLOR_CANCELLED = 'text-content-subtle';
35
- export const STATUS_COLOR_DEFAULT = 'text-content-subtle';
27
+ // Now referencing unified color mappings
28
+ export const STATUS_COLOR_PENDING = UNIFIED_STATUS_COLORS.pending;
29
+ export const STATUS_COLOR_AWAITING = UNIFIED_STATUS_COLORS.awaiting;
30
+ export const STATUS_COLOR_PROCESSING = UNIFIED_STATUS_COLORS.processing;
31
+ export const STATUS_COLOR_IN_PROGRESS = UNIFIED_STATUS_COLORS.in_progress;
32
+ export const STATUS_COLOR_APPROVED = UNIFIED_STATUS_COLORS.approved;
33
+ export const STATUS_COLOR_COMPLETED = UNIFIED_STATUS_COLORS.completed;
34
+ export const STATUS_COLOR_REJECTED = UNIFIED_STATUS_COLORS.rejected;
35
+ export const STATUS_COLOR_FAILED = UNIFIED_STATUS_COLORS.failed;
36
+ export const STATUS_COLOR_CANCELLED = UNIFIED_STATUS_COLORS.cancelled;
37
+ export const STATUS_COLOR_DEFAULT = UNIFIED_STATUS_COLORS.default;
36
38
  // Background status colors
37
39
  export const STATUS_BG_COLORS = {
38
40
  SUCCESS: 'bg-green-50',
@@ -63,25 +65,26 @@ export const PERFORMANCE_COLORS = {
63
65
  UNCHANGED: SEMANTIC_COLORS.NEUTRAL,
64
66
  };
65
67
  // Trading status colors
68
+ // @deprecated Use getStatusColor() from status-colors-unified instead
66
69
  export const TRADING_STATUS_COLORS = {
67
70
  // Trade statuses
68
- PENDING: STATUS_COLORS.WARNING,
69
- EXECUTED: STATUS_COLORS.SUCCESS,
70
- SETTLED: STATUS_COLORS.SUCCESS,
71
- CANCELLED: STATUS_COLORS.NEUTRAL,
72
- FAILED: STATUS_COLORS.ERROR,
73
- EXPIRED: STATUS_COLORS.NEUTRAL,
74
- REJECTED: STATUS_COLORS.ERROR,
71
+ PENDING: UNIFIED_STATUS_COLORS.pending,
72
+ EXECUTED: UNIFIED_STATUS_COLORS.executed,
73
+ SETTLED: UNIFIED_STATUS_COLORS.settled,
74
+ CANCELLED: UNIFIED_STATUS_COLORS.cancelled,
75
+ FAILED: UNIFIED_STATUS_COLORS.failed,
76
+ EXPIRED: UNIFIED_STATUS_COLORS.expired,
77
+ REJECTED: UNIFIED_STATUS_COLORS.rejected,
75
78
  // Withdrawal statuses
76
- PENDING_REVIEW: STATUS_COLORS.WARNING,
77
- APPROVED: STATUS_COLORS.SUCCESS,
78
- COMPLETED: STATUS_COLORS.SUCCESS,
79
- PROCESSING: STATUS_COLORS.INFO,
80
- ON_HOLD: STATUS_COLORS.WARNING,
79
+ PENDING_REVIEW: UNIFIED_STATUS_COLORS.pending_review,
80
+ APPROVED: UNIFIED_STATUS_COLORS.approved,
81
+ COMPLETED: UNIFIED_STATUS_COLORS.completed,
82
+ PROCESSING: UNIFIED_STATUS_COLORS.processing,
83
+ ON_HOLD: UNIFIED_STATUS_COLORS.on_hold,
81
84
  // Portfolio statuses
82
- ACTIVE: STATUS_COLORS.SUCCESS,
83
- INACTIVE: STATUS_COLORS.WARNING,
84
- CLOSED: STATUS_COLORS.NEUTRAL,
85
+ ACTIVE: UNIFIED_STATUS_COLORS.active,
86
+ INACTIVE: UNIFIED_STATUS_COLORS.inactive,
87
+ CLOSED: UNIFIED_STATUS_COLORS.closed,
85
88
  };
86
89
  /**
87
90
  * Get chart color by index (cycles through palette)
@@ -4,4 +4,5 @@
4
4
  export * from './colors';
5
5
  export * from './display';
6
6
  export * from './labels';
7
+ export * from './status-colors-unified';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC"}
package/dist/ui/index.js CHANGED
@@ -4,3 +4,4 @@
4
4
  export * from './colors';
5
5
  export * from './display';
6
6
  export * from './labels';
7
+ export * from './status-colors-unified';
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Unified status color mappings
3
+ * Consolidates duplicate color assignments for consistent UI styling
4
+ */
5
+ /**
6
+ * Unified mapping of status states to Tailwind CSS color classes
7
+ * Groups similar states that should have the same visual treatment
8
+ */
9
+ export declare const UNIFIED_STATUS_COLORS: {
10
+ readonly pending: "text-warning-600";
11
+ readonly awaiting: "text-warning-600";
12
+ readonly pending_review: "text-warning-600";
13
+ readonly on_hold: "text-warning-600";
14
+ readonly processing: "text-primary-600";
15
+ readonly in_progress: "text-primary-600";
16
+ readonly active: "text-primary-600";
17
+ readonly completed: "text-success-700";
18
+ readonly approved: "text-success-600";
19
+ readonly executed: "text-success-600";
20
+ readonly settled: "text-success-600";
21
+ readonly success: "text-success-600";
22
+ readonly failed: "text-error-700";
23
+ readonly rejected: "text-error-600";
24
+ readonly error: "text-error-600";
25
+ readonly cancelled: "text-content-subtle";
26
+ readonly expired: "text-content-subtle";
27
+ readonly inactive: "text-content-subtle";
28
+ readonly closed: "text-content-subtle";
29
+ readonly default: "text-content-subtle";
30
+ };
31
+ export type StatusColorKey = keyof typeof UNIFIED_STATUS_COLORS;
32
+ export type StatusColorValue = (typeof UNIFIED_STATUS_COLORS)[StatusColorKey];
33
+ /**
34
+ * Get color class for a status
35
+ * @param status - The status key (lowercase)
36
+ * @returns The Tailwind CSS color class
37
+ */
38
+ export declare const getStatusColor: (status: string) => string;
39
+ /**
40
+ * Background color variants for status states
41
+ * Uses lighter shades for backgrounds
42
+ */
43
+ export declare const UNIFIED_STATUS_BG_COLORS: {
44
+ readonly pending: "bg-warning-50";
45
+ readonly awaiting: "bg-warning-50";
46
+ readonly pending_review: "bg-warning-50";
47
+ readonly on_hold: "bg-warning-50";
48
+ readonly processing: "bg-primary-50";
49
+ readonly in_progress: "bg-primary-50";
50
+ readonly active: "bg-primary-50";
51
+ readonly completed: "bg-success-50";
52
+ readonly approved: "bg-success-50";
53
+ readonly executed: "bg-success-50";
54
+ readonly settled: "bg-success-50";
55
+ readonly success: "bg-success-50";
56
+ readonly failed: "bg-error-50";
57
+ readonly rejected: "bg-error-50";
58
+ readonly error: "bg-error-50";
59
+ readonly cancelled: "bg-gray-50";
60
+ readonly expired: "bg-gray-50";
61
+ readonly inactive: "bg-gray-50";
62
+ readonly closed: "bg-gray-50";
63
+ readonly default: "bg-gray-50";
64
+ };
65
+ /**
66
+ * Badge color combinations (background + text)
67
+ * For use in status badges and pills
68
+ */
69
+ export declare const UNIFIED_STATUS_BADGE_COLORS: {
70
+ readonly pending: "bg-warning-100 text-warning-700";
71
+ readonly awaiting: "bg-warning-100 text-warning-700";
72
+ readonly pending_review: "bg-warning-100 text-warning-700";
73
+ readonly on_hold: "bg-warning-100 text-warning-700";
74
+ readonly processing: "bg-primary-100 text-primary-700";
75
+ readonly in_progress: "bg-primary-100 text-primary-700";
76
+ readonly active: "bg-primary-100 text-primary-700";
77
+ readonly completed: "bg-success-100 text-success-700";
78
+ readonly approved: "bg-success-100 text-success-700";
79
+ readonly executed: "bg-success-100 text-success-700";
80
+ readonly settled: "bg-success-100 text-success-700";
81
+ readonly success: "bg-success-100 text-success-700";
82
+ readonly failed: "bg-error-100 text-error-700";
83
+ readonly rejected: "bg-error-100 text-error-700";
84
+ readonly error: "bg-error-100 text-error-700";
85
+ readonly cancelled: "bg-gray-100 text-gray-700";
86
+ readonly expired: "bg-gray-100 text-gray-700";
87
+ readonly inactive: "bg-gray-100 text-gray-700";
88
+ readonly closed: "bg-gray-100 text-gray-700";
89
+ readonly default: "bg-gray-100 text-gray-700";
90
+ };
91
+ //# sourceMappingURL=status-colors-unified.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-colors-unified.d.ts","sourceRoot":"","sources":["../../src/ui/status-colors-unified.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CA8BxB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,cAAc,CAAC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAG/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;CA8B3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;CA8B9B,CAAC"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Unified status color mappings
3
+ * Consolidates duplicate color assignments for consistent UI styling
4
+ */
5
+ /**
6
+ * Unified mapping of status states to Tailwind CSS color classes
7
+ * Groups similar states that should have the same visual treatment
8
+ */
9
+ export const UNIFIED_STATUS_COLORS = {
10
+ // Pending/Waiting states - Warning color (amber/yellow)
11
+ pending: 'text-warning-600',
12
+ awaiting: 'text-warning-600',
13
+ pending_review: 'text-warning-600',
14
+ on_hold: 'text-warning-600',
15
+ // Processing/Active states - Primary color (blue)
16
+ processing: 'text-primary-600',
17
+ in_progress: 'text-primary-600',
18
+ active: 'text-primary-600',
19
+ // Success states - Success color (green)
20
+ completed: 'text-success-700',
21
+ approved: 'text-success-600',
22
+ executed: 'text-success-600',
23
+ settled: 'text-success-600',
24
+ success: 'text-success-600',
25
+ // Error states - Error color (red)
26
+ failed: 'text-error-700',
27
+ rejected: 'text-error-600',
28
+ error: 'text-error-600',
29
+ // Neutral/Cancelled states - Subtle color (gray)
30
+ cancelled: 'text-content-subtle',
31
+ expired: 'text-content-subtle',
32
+ inactive: 'text-content-subtle',
33
+ closed: 'text-content-subtle',
34
+ default: 'text-content-subtle',
35
+ };
36
+ /**
37
+ * Get color class for a status
38
+ * @param status - The status key (lowercase)
39
+ * @returns The Tailwind CSS color class
40
+ */
41
+ export const getStatusColor = (status) => {
42
+ const normalizedStatus = status.toLowerCase().replace(/_/g, '_');
43
+ return UNIFIED_STATUS_COLORS[normalizedStatus] || UNIFIED_STATUS_COLORS.default;
44
+ };
45
+ /**
46
+ * Background color variants for status states
47
+ * Uses lighter shades for backgrounds
48
+ */
49
+ export const UNIFIED_STATUS_BG_COLORS = {
50
+ // Pending/Waiting states
51
+ pending: 'bg-warning-50',
52
+ awaiting: 'bg-warning-50',
53
+ pending_review: 'bg-warning-50',
54
+ on_hold: 'bg-warning-50',
55
+ // Processing/Active states
56
+ processing: 'bg-primary-50',
57
+ in_progress: 'bg-primary-50',
58
+ active: 'bg-primary-50',
59
+ // Success states
60
+ completed: 'bg-success-50',
61
+ approved: 'bg-success-50',
62
+ executed: 'bg-success-50',
63
+ settled: 'bg-success-50',
64
+ success: 'bg-success-50',
65
+ // Error states
66
+ failed: 'bg-error-50',
67
+ rejected: 'bg-error-50',
68
+ error: 'bg-error-50',
69
+ // Neutral/Cancelled states
70
+ cancelled: 'bg-gray-50',
71
+ expired: 'bg-gray-50',
72
+ inactive: 'bg-gray-50',
73
+ closed: 'bg-gray-50',
74
+ default: 'bg-gray-50',
75
+ };
76
+ /**
77
+ * Badge color combinations (background + text)
78
+ * For use in status badges and pills
79
+ */
80
+ export const UNIFIED_STATUS_BADGE_COLORS = {
81
+ // Pending/Waiting states
82
+ pending: 'bg-warning-100 text-warning-700',
83
+ awaiting: 'bg-warning-100 text-warning-700',
84
+ pending_review: 'bg-warning-100 text-warning-700',
85
+ on_hold: 'bg-warning-100 text-warning-700',
86
+ // Processing/Active states
87
+ processing: 'bg-primary-100 text-primary-700',
88
+ in_progress: 'bg-primary-100 text-primary-700',
89
+ active: 'bg-primary-100 text-primary-700',
90
+ // Success states
91
+ completed: 'bg-success-100 text-success-700',
92
+ approved: 'bg-success-100 text-success-700',
93
+ executed: 'bg-success-100 text-success-700',
94
+ settled: 'bg-success-100 text-success-700',
95
+ success: 'bg-success-100 text-success-700',
96
+ // Error states
97
+ failed: 'bg-error-100 text-error-700',
98
+ rejected: 'bg-error-100 text-error-700',
99
+ error: 'bg-error-100 text-error-700',
100
+ // Neutral/Cancelled states
101
+ cancelled: 'bg-gray-100 text-gray-700',
102
+ expired: 'bg-gray-100 text-gray-700',
103
+ inactive: 'bg-gray-100 text-gray-700',
104
+ closed: 'bg-gray-100 text-gray-700',
105
+ default: 'bg-gray-100 text-gray-700',
106
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-constants",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "Shared constants for MyPortfolio platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",