@pfm-platform/budgets-ui-mui 0.1.1
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/dist/index.cjs +1104 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +303 -0
- package/dist/index.d.ts +303 -0
- package/dist/index.js +1090 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Budget } from '@pfm-platform/shared';
|
|
3
|
+
|
|
4
|
+
interface BudgetListProps {
|
|
5
|
+
userId: string;
|
|
6
|
+
/** Date range start */
|
|
7
|
+
start_date?: string;
|
|
8
|
+
/** Date range end */
|
|
9
|
+
end_date?: string;
|
|
10
|
+
/** Custom title for the list */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Currency symbol to display */
|
|
13
|
+
currencySymbol?: string;
|
|
14
|
+
/** Maximum number of budgets to display */
|
|
15
|
+
maxItems?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* BudgetList component displays budgets with progress bars.
|
|
19
|
+
* Shows budget name, amounts, and visual progress indicator.
|
|
20
|
+
*/
|
|
21
|
+
declare function BudgetList({ userId, start_date, end_date, title, currencySymbol, maxItems, }: BudgetListProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
interface BudgetSummaryProps {
|
|
24
|
+
userId: string;
|
|
25
|
+
/** Date range start */
|
|
26
|
+
start_date?: string;
|
|
27
|
+
/** Date range end */
|
|
28
|
+
end_date?: string;
|
|
29
|
+
/** Custom title for the summary */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Currency symbol to display */
|
|
32
|
+
currencySymbol?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* BudgetSummary component displays aggregate budget statistics.
|
|
36
|
+
* Shows total budgets, budget amount, spent, remaining, and overall state.
|
|
37
|
+
*/
|
|
38
|
+
declare function BudgetSummary({ userId, start_date, end_date, title, currencySymbol, }: BudgetSummaryProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
|
|
40
|
+
interface BudgetCreateFormProps {
|
|
41
|
+
userId: string;
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
}
|
|
44
|
+
declare function BudgetCreateForm({ userId, onSuccess, }: BudgetCreateFormProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
|
|
46
|
+
interface BudgetEditFormProps {
|
|
47
|
+
userId: string;
|
|
48
|
+
budget: Budget;
|
|
49
|
+
open: boolean;
|
|
50
|
+
onClose: () => void;
|
|
51
|
+
}
|
|
52
|
+
declare function BudgetEditForm({ userId, budget, open, onClose, }: BudgetEditFormProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
interface BudgetDeleteButtonProps {
|
|
55
|
+
userId: string;
|
|
56
|
+
budgetId: number;
|
|
57
|
+
budgetName: string;
|
|
58
|
+
}
|
|
59
|
+
declare function BudgetDeleteButton({ userId, budgetId, budgetName, }: BudgetDeleteButtonProps): react_jsx_runtime.JSX.Element;
|
|
60
|
+
|
|
61
|
+
interface BudgetProgressCardProps {
|
|
62
|
+
budget: Budget;
|
|
63
|
+
/** Current spent amount */
|
|
64
|
+
currentSpent: number;
|
|
65
|
+
/** Currency symbol to display */
|
|
66
|
+
currencySymbol?: string;
|
|
67
|
+
/** Show trend indicator */
|
|
68
|
+
showTrend?: boolean;
|
|
69
|
+
/** Comparison to last period (optional) */
|
|
70
|
+
lastPeriodSpent?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* BudgetProgressCard component displays budget progress with visual indicators.
|
|
74
|
+
* Shows spent/limit/remaining with color-coded zones (green/yellow/red).
|
|
75
|
+
*
|
|
76
|
+
* Color zones:
|
|
77
|
+
* - Green: 0-70% of limit
|
|
78
|
+
* - Yellow: 70-90% of limit
|
|
79
|
+
* - Red: >90% of limit
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <BudgetProgressCard
|
|
84
|
+
* budget={budget}
|
|
85
|
+
* currentSpent={450.75}
|
|
86
|
+
* currencySymbol="$"
|
|
87
|
+
* showTrend
|
|
88
|
+
* lastPeriodSpent={380.50}
|
|
89
|
+
* />
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare function BudgetProgressCard({ budget, currentSpent, currencySymbol, showTrend, lastPeriodSpent, }: BudgetProgressCardProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
94
|
+
interface BudgetProgressListProps {
|
|
95
|
+
budgets: Budget[];
|
|
96
|
+
/** Map of budget ID to current spent amount */
|
|
97
|
+
spentByBudget: Map<number, number>;
|
|
98
|
+
/** Map of budget ID to last period spent amount (optional) */
|
|
99
|
+
lastPeriodSpentByBudget?: Map<number, number>;
|
|
100
|
+
/** Currency symbol to display */
|
|
101
|
+
currencySymbol?: string;
|
|
102
|
+
/** Show trend indicators */
|
|
103
|
+
showTrends?: boolean;
|
|
104
|
+
/** Enable category filtering */
|
|
105
|
+
enableCategoryFilter?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* BudgetProgressList component displays all budgets with progress indicators.
|
|
109
|
+
* Supports filtering by status (on-track, warning, over-budget).
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* const spentMap = new Map([
|
|
114
|
+
* [1, 450.75],
|
|
115
|
+
* [2, 1200.50],
|
|
116
|
+
* ]);
|
|
117
|
+
*
|
|
118
|
+
* <BudgetProgressList
|
|
119
|
+
* budgets={budgets}
|
|
120
|
+
* spentByBudget={spentMap}
|
|
121
|
+
* currencySymbol="$"
|
|
122
|
+
* showTrends
|
|
123
|
+
* enableCategoryFilter
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function BudgetProgressList({ budgets, spentByBudget, lastPeriodSpentByBudget, currencySymbol, showTrends, enableCategoryFilter, }: BudgetProgressListProps): react_jsx_runtime.JSX.Element;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* BudgetInsightsCard
|
|
131
|
+
*
|
|
132
|
+
* Budget insights and recommendations component.
|
|
133
|
+
* Migrated from legacy Budgets/Insights.js with modern React patterns.
|
|
134
|
+
*
|
|
135
|
+
* Features:
|
|
136
|
+
* - Budget performance analysis
|
|
137
|
+
* - Overspending/underspending identification
|
|
138
|
+
* - Historical trend analysis
|
|
139
|
+
* - Actionable recommendations
|
|
140
|
+
* - Visual indicators (icons, colors)
|
|
141
|
+
* - Expandable insights list
|
|
142
|
+
*
|
|
143
|
+
* Migration Notes:
|
|
144
|
+
* - Legacy: MobX store with complex insight loading
|
|
145
|
+
* - Modern: Controlled component with callback props
|
|
146
|
+
* - Removed: MobX observables, store injection
|
|
147
|
+
* - Added: TypeScript types, modern hooks, Material-UI v7
|
|
148
|
+
*/
|
|
149
|
+
type InsightType = 'overspending' | 'underspending' | 'on-track' | 'suggest-tag';
|
|
150
|
+
interface BudgetInsight {
|
|
151
|
+
/**
|
|
152
|
+
* Unique insight identifier
|
|
153
|
+
*/
|
|
154
|
+
id: string;
|
|
155
|
+
/**
|
|
156
|
+
* Type of insight
|
|
157
|
+
*/
|
|
158
|
+
type: InsightType;
|
|
159
|
+
/**
|
|
160
|
+
* Budget identifier
|
|
161
|
+
*/
|
|
162
|
+
budgetId: string;
|
|
163
|
+
/**
|
|
164
|
+
* Budget name
|
|
165
|
+
*/
|
|
166
|
+
budgetName: string;
|
|
167
|
+
/**
|
|
168
|
+
* Average amount over/under budget
|
|
169
|
+
*/
|
|
170
|
+
averageAmount: number;
|
|
171
|
+
/**
|
|
172
|
+
* Number of months analyzed
|
|
173
|
+
*/
|
|
174
|
+
monthsAnalyzed: number;
|
|
175
|
+
/**
|
|
176
|
+
* Number of times over/under budget
|
|
177
|
+
*/
|
|
178
|
+
occurrences: number;
|
|
179
|
+
/**
|
|
180
|
+
* Recommendation message
|
|
181
|
+
*/
|
|
182
|
+
recommendation: string;
|
|
183
|
+
/**
|
|
184
|
+
* Optional tag name (for suggest-tag type)
|
|
185
|
+
*/
|
|
186
|
+
tagName?: string;
|
|
187
|
+
}
|
|
188
|
+
interface BudgetOverallSummary {
|
|
189
|
+
/**
|
|
190
|
+
* Total amount over/under all budgets
|
|
191
|
+
*/
|
|
192
|
+
totalAmount: number;
|
|
193
|
+
/**
|
|
194
|
+
* Number of months in analysis
|
|
195
|
+
*/
|
|
196
|
+
months: number;
|
|
197
|
+
/**
|
|
198
|
+
* Budget state: 'over' | 'under' | 'on-track'
|
|
199
|
+
*/
|
|
200
|
+
state: 'over' | 'under' | 'on-track';
|
|
201
|
+
}
|
|
202
|
+
interface BudgetInsightsCardProps {
|
|
203
|
+
/**
|
|
204
|
+
* List of budget insights
|
|
205
|
+
*/
|
|
206
|
+
insights: BudgetInsight[];
|
|
207
|
+
/**
|
|
208
|
+
* Overall budget summary
|
|
209
|
+
*/
|
|
210
|
+
overallSummary: BudgetOverallSummary;
|
|
211
|
+
/**
|
|
212
|
+
* Whether insights are loading
|
|
213
|
+
* @default false
|
|
214
|
+
*/
|
|
215
|
+
loading?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Maximum insights to show initially
|
|
218
|
+
* @default 2
|
|
219
|
+
*/
|
|
220
|
+
initialVisibleCount?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Callback when insight action is clicked
|
|
223
|
+
*/
|
|
224
|
+
onInsightAction?: (insight: BudgetInsight) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Callback when insight is dismissed
|
|
227
|
+
*/
|
|
228
|
+
onInsightDismiss?: (insight: BudgetInsight) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Currency formatter
|
|
231
|
+
*/
|
|
232
|
+
currencyFormatter?: (value: number) => string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Budget insights and recommendations card
|
|
236
|
+
*
|
|
237
|
+
* Displays budget performance analysis with actionable insights.
|
|
238
|
+
* Shows overall summary and individual budget insights with recommendations.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```tsx
|
|
242
|
+
* <BudgetInsightsCard
|
|
243
|
+
* insights={budgetInsights}
|
|
244
|
+
* overallSummary={{
|
|
245
|
+
* totalAmount: -150,
|
|
246
|
+
* months: 6,
|
|
247
|
+
* state: 'over',
|
|
248
|
+
* }}
|
|
249
|
+
* onInsightAction={(insight) => handleAction(insight)}
|
|
250
|
+
* onInsightDismiss={(insight) => dismissInsight(insight)}
|
|
251
|
+
* />
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
declare function BudgetInsightsCard({ insights, overallSummary, initialVisibleCount, onInsightAction, onInsightDismiss, currencyFormatter, }: BudgetInsightsCardProps): react_jsx_runtime.JSX.Element;
|
|
255
|
+
|
|
256
|
+
interface BudgetInsightDialogProps {
|
|
257
|
+
/**
|
|
258
|
+
* Insight to display in dialog
|
|
259
|
+
*/
|
|
260
|
+
insight: BudgetInsight | null;
|
|
261
|
+
/**
|
|
262
|
+
* Whether dialog is open
|
|
263
|
+
*/
|
|
264
|
+
open: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Callback when dialog is closed
|
|
267
|
+
*/
|
|
268
|
+
onClose: () => void;
|
|
269
|
+
/**
|
|
270
|
+
* Callback when save is clicked
|
|
271
|
+
*/
|
|
272
|
+
onSave: (insight: BudgetInsight, adjustmentAmount: number) => Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Whether save operation is in progress
|
|
275
|
+
* @default false
|
|
276
|
+
*/
|
|
277
|
+
saving?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Currency formatter
|
|
280
|
+
*/
|
|
281
|
+
currencyFormatter?: (value: number) => string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Budget insight adjustment dialog
|
|
285
|
+
*
|
|
286
|
+
* Allows users to adjust budget amounts based on spending insights.
|
|
287
|
+
* Provides context about overspending/underspending patterns.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```tsx
|
|
291
|
+
* <BudgetInsightDialog
|
|
292
|
+
* insight={selectedInsight}
|
|
293
|
+
* open={dialogOpen}
|
|
294
|
+
* onClose={() => setDialogOpen(false)}
|
|
295
|
+
* onSave={async (insight, amount) => {
|
|
296
|
+
* await updateBudget(insight.budgetId, amount);
|
|
297
|
+
* }}
|
|
298
|
+
* />
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
declare function BudgetInsightDialog({ insight, open, onClose, onSave, saving, currencyFormatter, }: BudgetInsightDialogProps): react_jsx_runtime.JSX.Element | null;
|
|
302
|
+
|
|
303
|
+
export { BudgetCreateForm, type BudgetCreateFormProps, BudgetDeleteButton, type BudgetDeleteButtonProps, BudgetEditForm, type BudgetEditFormProps, type BudgetInsight, BudgetInsightDialog, type BudgetInsightDialogProps, BudgetInsightsCard, type BudgetInsightsCardProps, BudgetList, type BudgetListProps, type BudgetOverallSummary, BudgetProgressCard, type BudgetProgressCardProps, BudgetProgressList, type BudgetProgressListProps, BudgetSummary, type BudgetSummaryProps, type InsightType };
|