@pfm-platform/goals-ui-mui 0.2.0 → 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.cjs +7 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +7 -9
- package/dist/index.js.map +1 -1
- package/package.json +11 -12
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { SavingsGoalRow, PayoffGoalRow } from '@pfm-platform/shared';
|
|
3
3
|
|
|
4
4
|
interface GoalCreateFormProps {
|
|
5
5
|
userId: string;
|
|
@@ -9,7 +9,7 @@ declare function GoalCreateForm({ userId, onSuccess, }: GoalCreateFormProps): re
|
|
|
9
9
|
|
|
10
10
|
interface GoalDeleteButtonProps {
|
|
11
11
|
userId: string;
|
|
12
|
-
goalId:
|
|
12
|
+
goalId: string;
|
|
13
13
|
goalName: string;
|
|
14
14
|
goalType: 'savings' | 'payoff';
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ declare function GoalDeleteButton({ userId, goalId, goalName, goalType, }: GoalD
|
|
|
17
17
|
|
|
18
18
|
interface GoalEditFormProps {
|
|
19
19
|
userId: string;
|
|
20
|
-
goal:
|
|
20
|
+
goal: SavingsGoalRow | PayoffGoalRow;
|
|
21
21
|
goalType: 'savings' | 'payoff';
|
|
22
22
|
open: boolean;
|
|
23
23
|
onClose: () => void;
|
|
@@ -64,11 +64,11 @@ interface GoalProgressCardProps {
|
|
|
64
64
|
/** Goal name */
|
|
65
65
|
name: string;
|
|
66
66
|
/** Current value/progress */
|
|
67
|
-
currentValue:
|
|
67
|
+
currentValue: number;
|
|
68
68
|
/** Target value */
|
|
69
|
-
targetValue:
|
|
69
|
+
targetValue: number;
|
|
70
70
|
/** Initial value (for payoff goals) */
|
|
71
|
-
initialValue?:
|
|
71
|
+
initialValue?: number;
|
|
72
72
|
/** Percent complete (0-100) */
|
|
73
73
|
percentComplete: number;
|
|
74
74
|
/** Goal type */
|
|
@@ -82,7 +82,7 @@ interface GoalProgressCardProps {
|
|
|
82
82
|
/** Estimated months remaining */
|
|
83
83
|
monthsRemaining?: number;
|
|
84
84
|
/** Monthly contribution amount */
|
|
85
|
-
monthlyContribution?:
|
|
85
|
+
monthlyContribution?: number;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* GoalProgressCard component displays individual goal progress.
|
|
@@ -92,8 +92,8 @@ interface GoalProgressCardProps {
|
|
|
92
92
|
* ```tsx
|
|
93
93
|
* <GoalProgressCard
|
|
94
94
|
* name="Emergency Fund"
|
|
95
|
-
* currentValue=
|
|
96
|
-
* targetValue=
|
|
95
|
+
* currentValue={5000}
|
|
96
|
+
* targetValue={10000}
|
|
97
97
|
* percentComplete={50}
|
|
98
98
|
* goalType="savings"
|
|
99
99
|
* currencySymbol="$"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { SavingsGoalRow, PayoffGoalRow } from '@pfm-platform/shared';
|
|
3
3
|
|
|
4
4
|
interface GoalCreateFormProps {
|
|
5
5
|
userId: string;
|
|
@@ -9,7 +9,7 @@ declare function GoalCreateForm({ userId, onSuccess, }: GoalCreateFormProps): re
|
|
|
9
9
|
|
|
10
10
|
interface GoalDeleteButtonProps {
|
|
11
11
|
userId: string;
|
|
12
|
-
goalId:
|
|
12
|
+
goalId: string;
|
|
13
13
|
goalName: string;
|
|
14
14
|
goalType: 'savings' | 'payoff';
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ declare function GoalDeleteButton({ userId, goalId, goalName, goalType, }: GoalD
|
|
|
17
17
|
|
|
18
18
|
interface GoalEditFormProps {
|
|
19
19
|
userId: string;
|
|
20
|
-
goal:
|
|
20
|
+
goal: SavingsGoalRow | PayoffGoalRow;
|
|
21
21
|
goalType: 'savings' | 'payoff';
|
|
22
22
|
open: boolean;
|
|
23
23
|
onClose: () => void;
|
|
@@ -64,11 +64,11 @@ interface GoalProgressCardProps {
|
|
|
64
64
|
/** Goal name */
|
|
65
65
|
name: string;
|
|
66
66
|
/** Current value/progress */
|
|
67
|
-
currentValue:
|
|
67
|
+
currentValue: number;
|
|
68
68
|
/** Target value */
|
|
69
|
-
targetValue:
|
|
69
|
+
targetValue: number;
|
|
70
70
|
/** Initial value (for payoff goals) */
|
|
71
|
-
initialValue?:
|
|
71
|
+
initialValue?: number;
|
|
72
72
|
/** Percent complete (0-100) */
|
|
73
73
|
percentComplete: number;
|
|
74
74
|
/** Goal type */
|
|
@@ -82,7 +82,7 @@ interface GoalProgressCardProps {
|
|
|
82
82
|
/** Estimated months remaining */
|
|
83
83
|
monthsRemaining?: number;
|
|
84
84
|
/** Monthly contribution amount */
|
|
85
|
-
monthlyContribution?:
|
|
85
|
+
monthlyContribution?: number;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* GoalProgressCard component displays individual goal progress.
|
|
@@ -92,8 +92,8 @@ interface GoalProgressCardProps {
|
|
|
92
92
|
* ```tsx
|
|
93
93
|
* <GoalProgressCard
|
|
94
94
|
* name="Emergency Fund"
|
|
95
|
-
* currentValue=
|
|
96
|
-
* targetValue=
|
|
95
|
+
* currentValue={5000}
|
|
96
|
+
* targetValue={10000}
|
|
97
97
|
* percentComplete={50}
|
|
98
98
|
* goalType="savings"
|
|
99
99
|
* currencySymbol="$"
|
package/dist/index.js
CHANGED
|
@@ -64,11 +64,10 @@ function GoalCreateForm({
|
|
|
64
64
|
setError("Target value must be a positive number");
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const formattedAmount = amount.toFixed(2);
|
|
68
67
|
const data = {
|
|
69
68
|
name: name.trim(),
|
|
70
69
|
image_name: imageName.trim(),
|
|
71
|
-
target_value:
|
|
70
|
+
target_value: amount,
|
|
72
71
|
target_completion_on: targetCompletionOn || void 0
|
|
73
72
|
};
|
|
74
73
|
if (goalType === "savings") {
|
|
@@ -284,7 +283,7 @@ function GoalEditForm({
|
|
|
284
283
|
}) {
|
|
285
284
|
const [name, setName] = useState(goal.name);
|
|
286
285
|
const [imageName, setImageName] = useState(goal.image_name);
|
|
287
|
-
const [targetValue, setTargetValue] = useState(goal.target_value);
|
|
286
|
+
const [targetValue, setTargetValue] = useState(String(goal.target_value));
|
|
288
287
|
const [targetCompletionOn, setTargetCompletionOn] = useState(
|
|
289
288
|
goal.target_completion_on || ""
|
|
290
289
|
);
|
|
@@ -322,12 +321,11 @@ function GoalEditForm({
|
|
|
322
321
|
setError("Target value must be a positive number");
|
|
323
322
|
return;
|
|
324
323
|
}
|
|
325
|
-
const formattedAmount = amount.toFixed(2);
|
|
326
324
|
const data = {
|
|
327
325
|
id: goal.id,
|
|
328
326
|
name: name.trim(),
|
|
329
327
|
image_name: imageName.trim(),
|
|
330
|
-
target_value:
|
|
328
|
+
target_value: amount,
|
|
331
329
|
target_completion_on: targetCompletionOn || void 0
|
|
332
330
|
};
|
|
333
331
|
if (goalType === "savings") {
|
|
@@ -835,8 +833,8 @@ function GoalProgressCard({
|
|
|
835
833
|
monthsRemaining,
|
|
836
834
|
monthlyContribution
|
|
837
835
|
}) {
|
|
838
|
-
const current =
|
|
839
|
-
const target =
|
|
836
|
+
const current = currentValue;
|
|
837
|
+
const target = targetValue;
|
|
840
838
|
const remaining = goalType === "savings" ? target - current : current;
|
|
841
839
|
const progressColor = complete ? "success" : percentComplete >= 75 ? "primary" : percentComplete >= 50 ? "info" : percentComplete >= 25 ? "warning" : "error";
|
|
842
840
|
const formatCurrency = (amount) => {
|
|
@@ -905,10 +903,10 @@ function GoalProgressCard({
|
|
|
905
903
|
}
|
|
906
904
|
),
|
|
907
905
|
/* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: 1, children: [
|
|
908
|
-
monthlyContribution &&
|
|
906
|
+
monthlyContribution != null && monthlyContribution > 0 && /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: 1, children: [
|
|
909
907
|
/* @__PURE__ */ jsx(TrendingUp, { fontSize: "small", color: "action" }),
|
|
910
908
|
/* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "text.secondary", children: [
|
|
911
|
-
formatCurrency(
|
|
909
|
+
formatCurrency(monthlyContribution),
|
|
912
910
|
"/month"
|
|
913
911
|
] })
|
|
914
912
|
] }),
|