@pfm-platform/budgets-ui-mui 0.1.1 → 0.2.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.d.cts CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Budget } from '@pfm-platform/shared';
2
+ import { BudgetWithRelations } from '@pfm-platform/shared';
3
3
 
4
4
  interface BudgetListProps {
5
5
  userId: string;
6
- /** Date range start */
7
- start_date?: string;
8
- /** Date range end */
9
- end_date?: string;
6
+ /** Budget month (1-12) */
7
+ month?: number;
8
+ /** Budget year */
9
+ year?: number;
10
10
  /** Custom title for the list */
11
11
  title?: string;
12
12
  /** Currency symbol to display */
@@ -18,14 +18,14 @@ interface BudgetListProps {
18
18
  * BudgetList component displays budgets with progress bars.
19
19
  * Shows budget name, amounts, and visual progress indicator.
20
20
  */
21
- declare function BudgetList({ userId, start_date, end_date, title, currencySymbol, maxItems, }: BudgetListProps): react_jsx_runtime.JSX.Element;
21
+ declare function BudgetList({ userId, month, year, title, currencySymbol, maxItems, }: BudgetListProps): react_jsx_runtime.JSX.Element;
22
22
 
23
23
  interface BudgetSummaryProps {
24
24
  userId: string;
25
- /** Date range start */
26
- start_date?: string;
27
- /** Date range end */
28
- end_date?: string;
25
+ /** Budget month (1-12) */
26
+ month?: number;
27
+ /** Budget year */
28
+ year?: number;
29
29
  /** Custom title for the summary */
30
30
  title?: string;
31
31
  /** Currency symbol to display */
@@ -35,7 +35,7 @@ interface BudgetSummaryProps {
35
35
  * BudgetSummary component displays aggregate budget statistics.
36
36
  * Shows total budgets, budget amount, spent, remaining, and overall state.
37
37
  */
38
- declare function BudgetSummary({ userId, start_date, end_date, title, currencySymbol, }: BudgetSummaryProps): react_jsx_runtime.JSX.Element;
38
+ declare function BudgetSummary({ userId, month, year, title, currencySymbol, }: BudgetSummaryProps): react_jsx_runtime.JSX.Element;
39
39
 
40
40
  interface BudgetCreateFormProps {
41
41
  userId: string;
@@ -45,7 +45,7 @@ declare function BudgetCreateForm({ userId, onSuccess, }: BudgetCreateFormProps)
45
45
 
46
46
  interface BudgetEditFormProps {
47
47
  userId: string;
48
- budget: Budget;
48
+ budget: BudgetWithRelations;
49
49
  open: boolean;
50
50
  onClose: () => void;
51
51
  }
@@ -53,13 +53,13 @@ declare function BudgetEditForm({ userId, budget, open, onClose, }: BudgetEditFo
53
53
 
54
54
  interface BudgetDeleteButtonProps {
55
55
  userId: string;
56
- budgetId: number;
56
+ budgetId: string;
57
57
  budgetName: string;
58
58
  }
59
59
  declare function BudgetDeleteButton({ userId, budgetId, budgetName, }: BudgetDeleteButtonProps): react_jsx_runtime.JSX.Element;
60
60
 
61
61
  interface BudgetProgressCardProps {
62
- budget: Budget;
62
+ budget: BudgetWithRelations;
63
63
  /** Current spent amount */
64
64
  currentSpent: number;
65
65
  /** Currency symbol to display */
@@ -92,11 +92,11 @@ interface BudgetProgressCardProps {
92
92
  declare function BudgetProgressCard({ budget, currentSpent, currencySymbol, showTrend, lastPeriodSpent, }: BudgetProgressCardProps): react_jsx_runtime.JSX.Element;
93
93
 
94
94
  interface BudgetProgressListProps {
95
- budgets: Budget[];
95
+ budgets: BudgetWithRelations[];
96
96
  /** Map of budget ID to current spent amount */
97
- spentByBudget: Map<number, number>;
97
+ spentByBudget: Map<string, number>;
98
98
  /** Map of budget ID to last period spent amount (optional) */
99
- lastPeriodSpentByBudget?: Map<number, number>;
99
+ lastPeriodSpentByBudget?: Map<string, number>;
100
100
  /** Currency symbol to display */
101
101
  currencySymbol?: string;
102
102
  /** Show trend indicators */
@@ -300,4 +300,379 @@ interface BudgetInsightDialogProps {
300
300
  */
301
301
  declare function BudgetInsightDialog({ insight, open, onClose, onSave, saving, currencyFormatter, }: BudgetInsightDialogProps): react_jsx_runtime.JSX.Element | null;
302
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 };
303
+ /**
304
+ * BudgetStateIndicator
305
+ *
306
+ * Visual indicator for budget state (over/under/on-track).
307
+ * Migrated from legacy Budgets/BudgetState.js with modern React patterns.
308
+ *
309
+ * Features:
310
+ * - Color-coded state indicators
311
+ * - Icon-based visual communication
312
+ * - Percentage-based progress display
313
+ * - Responsive design with configurable sizes
314
+ * - Accessibility support
315
+ *
316
+ * Migration Notes:
317
+ * - Legacy: Simple functional component with inline styles
318
+ * - Modern: TypeScript with Material-UI v7 theming
319
+ * - Added: Comprehensive type safety, accessibility, responsive sizing
320
+ */
321
+ type BudgetState = 'under' | 'on-track' | 'over' | 'critical';
322
+ interface BudgetStateIndicatorProps {
323
+ /**
324
+ * Current budget state
325
+ */
326
+ state: BudgetState;
327
+ /**
328
+ * Percentage of budget used (0-100+)
329
+ */
330
+ percentage: number;
331
+ /**
332
+ * Display variant
333
+ * @default 'chip'
334
+ */
335
+ variant?: 'chip' | 'inline' | 'card';
336
+ /**
337
+ * Size of the indicator
338
+ * @default 'medium'
339
+ */
340
+ size?: 'small' | 'medium' | 'large';
341
+ /**
342
+ * Show percentage label
343
+ * @default true
344
+ */
345
+ showPercentage?: boolean;
346
+ /**
347
+ * Show state label
348
+ * @default true
349
+ */
350
+ showLabel?: boolean;
351
+ /**
352
+ * Custom label override
353
+ */
354
+ customLabel?: string;
355
+ }
356
+ /**
357
+ * Budget state indicator component
358
+ *
359
+ * Displays visual indicator for budget state with color coding and icons.
360
+ * Supports multiple display variants and sizes for different contexts.
361
+ *
362
+ * @example
363
+ * ```tsx
364
+ * // Chip variant (default)
365
+ * <BudgetStateIndicator state="over" percentage={110} />
366
+ *
367
+ * // Inline variant
368
+ * <BudgetStateIndicator
369
+ * state="on-track"
370
+ * percentage={75}
371
+ * variant="inline"
372
+ * size="small"
373
+ * />
374
+ *
375
+ * // Card variant with custom label
376
+ * <BudgetStateIndicator
377
+ * state="critical"
378
+ * percentage={150}
379
+ * variant="card"
380
+ * customLabel="Way Over Budget"
381
+ * />
382
+ * ```
383
+ */
384
+ declare function BudgetStateIndicator({ state, percentage, variant, size, showPercentage, showLabel, customLabel, }: BudgetStateIndicatorProps): react_jsx_runtime.JSX.Element;
385
+
386
+ /**
387
+ * BudgetTagInsight
388
+ *
389
+ * Tag-specific spending pattern insights component.
390
+ * Migrated from legacy Budgets/TagInsight.js with modern React patterns.
391
+ *
392
+ * Features:
393
+ * - Tag spending analysis
394
+ * - Budget assignment recommendations
395
+ * - Trend visualization
396
+ * - Actionable insights for unbudgeted tags
397
+ * - Material-UI v7 theming
398
+ *
399
+ * Migration Notes:
400
+ * - Legacy: MobX store-based with complex tag analysis
401
+ * - Modern: Controlled component with callback props
402
+ * - Removed: MobX observables, store injection
403
+ * - Added: TypeScript types, modern hooks, comprehensive insights
404
+ */
405
+ interface TagSpendingInsight {
406
+ /**
407
+ * Unique insight identifier
408
+ */
409
+ id: string;
410
+ /**
411
+ * Tag name
412
+ */
413
+ tagName: string;
414
+ /**
415
+ * Average monthly spending on this tag
416
+ */
417
+ averageMonthlySpend: number;
418
+ /**
419
+ * Number of months analyzed
420
+ */
421
+ monthsAnalyzed: number;
422
+ /**
423
+ * Number of transactions with this tag
424
+ */
425
+ transactionCount: number;
426
+ /**
427
+ * Whether tag is currently budgeted
428
+ */
429
+ isBudgeted: boolean;
430
+ /**
431
+ * Suggested budget amount (if not budgeted)
432
+ */
433
+ suggestedBudget?: number;
434
+ /**
435
+ * Spending trend: 'increasing' | 'decreasing' | 'stable'
436
+ */
437
+ trend: 'increasing' | 'decreasing' | 'stable';
438
+ /**
439
+ * Percentage change in spending (positive or negative)
440
+ */
441
+ trendPercentage: number;
442
+ /**
443
+ * Recommendation message
444
+ */
445
+ recommendation: string;
446
+ }
447
+ interface BudgetTagInsightProps {
448
+ /**
449
+ * List of tag spending insights
450
+ */
451
+ insights: TagSpendingInsight[];
452
+ /**
453
+ * Whether insights are loading
454
+ * @default false
455
+ */
456
+ loading?: boolean;
457
+ /**
458
+ * Callback when "Create Budget" is clicked for a tag
459
+ */
460
+ onCreateBudget?: (insight: TagSpendingInsight) => void;
461
+ /**
462
+ * Callback when "View Details" is clicked
463
+ */
464
+ onViewDetails?: (insight: TagSpendingInsight) => void;
465
+ /**
466
+ * Callback when insight is dismissed
467
+ */
468
+ onDismiss?: (insight: TagSpendingInsight) => void;
469
+ /**
470
+ * Currency formatter
471
+ */
472
+ currencyFormatter?: (value: number) => string;
473
+ /**
474
+ * Maximum insights to show
475
+ * @default 5
476
+ */
477
+ maxVisible?: number;
478
+ }
479
+ /**
480
+ * Budget tag insight component
481
+ *
482
+ * Displays spending insights for unbudgeted or underbudgeted tags.
483
+ * Recommends budget creation with suggested amounts based on spending patterns.
484
+ *
485
+ * @example
486
+ * ```tsx
487
+ * <BudgetTagInsight
488
+ * insights={tagInsights}
489
+ * onCreateBudget={(insight) => createBudgetForTag(insight)}
490
+ * onViewDetails={(insight) => showTagDetails(insight)}
491
+ * />
492
+ * ```
493
+ */
494
+ declare function BudgetTagInsight({ insights, loading, onCreateBudget, onViewDetails, onDismiss, currencyFormatter, maxVisible, }: BudgetTagInsightProps): react_jsx_runtime.JSX.Element;
495
+
496
+ /**
497
+ * BudgetOverviewMessage
498
+ *
499
+ * Summary message component for budget overview.
500
+ * Migrated from legacy Budgets/OverviewMessage.js with modern React patterns.
501
+ *
502
+ * Features:
503
+ * - Contextual budget status messages
504
+ * - Multi-budget summary insights
505
+ * - Actionable recommendations
506
+ * - Visual state indicators
507
+ * - Material-UI v7 theming
508
+ *
509
+ * Migration Notes:
510
+ * - Legacy: Simple string-based message component
511
+ * - Modern: Rich message component with TypeScript and theming
512
+ * - Added: State-based styling, icons, action buttons
513
+ */
514
+ type OverviewMessageType = 'success' | 'warning' | 'error' | 'info';
515
+ interface BudgetOverviewData {
516
+ /**
517
+ * Total number of budgets
518
+ */
519
+ totalBudgets: number;
520
+ /**
521
+ * Number of budgets over limit
522
+ */
523
+ budgetsOver: number;
524
+ /**
525
+ * Number of budgets on track
526
+ */
527
+ budgetsOnTrack: number;
528
+ /**
529
+ * Number of budgets under limit
530
+ */
531
+ budgetsUnder: number;
532
+ /**
533
+ * Total amount over all budgets (negative if over, positive if under)
534
+ */
535
+ totalOverUnder: number;
536
+ /**
537
+ * Number of unbudgeted tags with significant spending
538
+ */
539
+ unbudgetedTagsCount?: number;
540
+ }
541
+ interface BudgetOverviewMessageProps {
542
+ /**
543
+ * Budget overview data
544
+ */
545
+ data: BudgetOverviewData;
546
+ /**
547
+ * Callback when primary action clicked
548
+ */
549
+ onAction?: () => void;
550
+ /**
551
+ * Custom action button label
552
+ */
553
+ actionLabel?: string;
554
+ /**
555
+ * Currency formatter
556
+ */
557
+ currencyFormatter?: (value: number) => string;
558
+ /**
559
+ * Hide action button
560
+ * @default false
561
+ */
562
+ hideAction?: boolean;
563
+ }
564
+ /**
565
+ * Budget overview message component
566
+ *
567
+ * Displays contextual summary message based on budget status.
568
+ * Provides actionable insights and recommendations.
569
+ *
570
+ * @example
571
+ * ```tsx
572
+ * <BudgetOverviewMessage
573
+ * data={{
574
+ * totalBudgets: 5,
575
+ * budgetsOver: 2,
576
+ * budgetsOnTrack: 2,
577
+ * budgetsUnder: 1,
578
+ * totalOverUnder: -150,
579
+ * unbudgetedTagsCount: 3,
580
+ * }}
581
+ * onAction={() => navigate('/budgets')}
582
+ * />
583
+ * ```
584
+ */
585
+ declare function BudgetOverviewMessage({ data, onAction, actionLabel, currencyFormatter, hideAction, }: BudgetOverviewMessageProps): react_jsx_runtime.JSX.Element;
586
+
587
+ /**
588
+ * BudgetStepper
589
+ *
590
+ * Multi-step budget creation/editing form.
591
+ * Migrated from legacy Budgets/Stepper.js with modern React patterns.
592
+ *
593
+ * Features:
594
+ * - Three-step budget creation workflow
595
+ * - Step 1: Basic info (name, amount)
596
+ * - Step 2: Tags selection
597
+ * - Step 3: Review and confirm
598
+ * - Progress indicator
599
+ * - Validation at each step
600
+ * - Material-UI v7 Stepper component
601
+ *
602
+ * Migration Notes:
603
+ * - Legacy: MobX form state with custom stepper logic
604
+ * - Modern: React state with Material-UI Stepper
605
+ * - Removed: MobX observables, custom validation
606
+ * - Added: TypeScript types, modern hooks, comprehensive validation
607
+ */
608
+ interface BudgetFormData {
609
+ /**
610
+ * Budget name
611
+ */
612
+ name: string;
613
+ /**
614
+ * Budget amount
615
+ */
616
+ budgetAmount: number;
617
+ /**
618
+ * Selected tag names
619
+ */
620
+ tagNames: string[];
621
+ /**
622
+ * Show on dashboard
623
+ * @default true
624
+ */
625
+ showOnDashboard?: boolean;
626
+ }
627
+ interface BudgetStepperProps {
628
+ /**
629
+ * Initial form data (for editing)
630
+ */
631
+ initialData?: Partial<BudgetFormData>;
632
+ /**
633
+ * Available tags for selection
634
+ */
635
+ availableTags: string[];
636
+ /**
637
+ * Callback when form is submitted
638
+ */
639
+ onSubmit: (data: BudgetFormData) => Promise<void>;
640
+ /**
641
+ * Callback when form is cancelled
642
+ */
643
+ onCancel?: () => void;
644
+ /**
645
+ * Whether form is in edit mode
646
+ * @default false
647
+ */
648
+ editMode?: boolean;
649
+ /**
650
+ * Whether submission is in progress
651
+ * @default false
652
+ */
653
+ submitting?: boolean;
654
+ /**
655
+ * Error message to display
656
+ */
657
+ error?: string | null;
658
+ }
659
+ /**
660
+ * Budget stepper component
661
+ *
662
+ * Multi-step form for creating or editing budgets with validation.
663
+ * Guides users through basic info, tag selection, and review steps.
664
+ *
665
+ * @example
666
+ * ```tsx
667
+ * <BudgetStepper
668
+ * availableTags={['Groceries', 'Utilities', 'Entertainment']}
669
+ * onSubmit={async (data) => {
670
+ * await createBudget(data);
671
+ * }}
672
+ * onCancel={() => navigate('/budgets')}
673
+ * />
674
+ * ```
675
+ */
676
+ declare function BudgetStepper({ initialData, availableTags, onSubmit, onCancel, editMode, submitting, error, }: BudgetStepperProps): react_jsx_runtime.JSX.Element;
677
+
678
+ export { BudgetCreateForm, type BudgetCreateFormProps, BudgetDeleteButton, type BudgetDeleteButtonProps, BudgetEditForm, type BudgetEditFormProps, type BudgetFormData, type BudgetInsight, BudgetInsightDialog, type BudgetInsightDialogProps, BudgetInsightsCard, type BudgetInsightsCardProps, BudgetList, type BudgetListProps, type BudgetOverallSummary, type BudgetOverviewData, BudgetOverviewMessage, type BudgetOverviewMessageProps, BudgetProgressCard, type BudgetProgressCardProps, BudgetProgressList, type BudgetProgressListProps, type BudgetState, BudgetStateIndicator, type BudgetStateIndicatorProps, BudgetStepper, type BudgetStepperProps, BudgetSummary, type BudgetSummaryProps, BudgetTagInsight, type BudgetTagInsightProps, type InsightType, type OverviewMessageType, type TagSpendingInsight };