@mx-cartographer/experiences 3.13.3 → 3.13.4-alpha.mm0

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.
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { WidgetProps } from '../common';
3
+ export declare const NetWorthWidget: React.FC<WidgetProps>;
@@ -1,7 +1,3 @@
1
- import { NetWorth } from '../types/NetWorth';
2
- interface NetWorthChartProps {
3
- chartData: NetWorth[];
4
- selectedData: NetWorth | null;
5
- }
6
- declare const _default: import('react').FunctionComponent<NetWorthChartProps>;
1
+ import { NetWorthProps } from '../types/NetWorth';
2
+ declare const _default: import('react').FunctionComponent<NetWorthProps>;
7
3
  export default _default;
@@ -1,8 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { NetWorth } from '../types/NetWorth';
3
- interface NetWorthListProps {
4
- chartData: NetWorth[];
5
- selectedData: NetWorth;
6
- }
7
- declare const _default: React.FunctionComponent<NetWorthListProps>;
2
+ import { NetWorthProps } from '../types/NetWorth';
3
+ declare const _default: React.FunctionComponent<NetWorthProps>;
8
4
  export default _default;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { NetWorth } from '../types/NetWorth';
3
+ interface NetWorthListItemProps {
4
+ item: NetWorth;
5
+ getStyles: (item: NetWorth) => {
6
+ backgroundColor: string;
7
+ borderBottom: string;
8
+ color: string;
9
+ };
10
+ isHovered: boolean;
11
+ isSelected: boolean;
12
+ onItemClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>, dataIndex: number) => void;
13
+ onMouseEnter: (dataIndex: number) => void;
14
+ onMouseLeave: () => void;
15
+ }
16
+ declare const _default: React.FunctionComponent<NetWorthListItemProps>;
17
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { NetWorth } from '../types/NetWorth';
2
+ interface NetWorthSummaryProps {
3
+ hoveredData?: NetWorth;
4
+ selectedData: NetWorth;
5
+ }
6
+ declare const _default: import('react').FunctionComponent<NetWorthSummaryProps>;
7
+ export default _default;
@@ -1,3 +1,5 @@
1
1
  export { NetWorthStore } from './stores/NetWorthStore';
2
2
  export { default as NetWorthChart } from './components/NetWorthChart';
3
3
  export { default as NetWorthList } from './components/NetWorthList';
4
+ export { default as NetWorthSummary } from './components/NetWorthSummary';
5
+ export { NetWorthWidget } from './NetWorthWidget';
@@ -1,10 +1,18 @@
1
1
  import { GlobalStore } from '../../common';
2
- import { NetWorth, NetWorthData } from '../types/NetWorth';
2
+ import { AssetsLiabilities, GainsLosses, NetWorth, NetWorthData } from '../types/NetWorth';
3
3
  export declare class NetWorthStore {
4
4
  globalStore: GlobalStore;
5
5
  netWorthData: NetWorthData;
6
6
  netWorthChartData: NetWorth[];
7
+ hoveredData?: NetWorth;
8
+ selectedData?: NetWorth;
9
+ assetsLiabilities?: AssetsLiabilities;
10
+ gainsLosses?: GainsLosses;
7
11
  constructor(globalStore: GlobalStore);
8
12
  loadNetWorthData: () => Promise<void>;
9
13
  loadChartData: (numberOfMonths: number) => Promise<void>;
14
+ loadGainsLosses: () => Promise<void>;
15
+ loadAssetsLiabilities: () => Promise<void>;
16
+ setSelectedData: (dataIndex: number) => void;
17
+ setHoveredData: (dataIndex: number | null) => void;
10
18
  }
@@ -17,3 +17,35 @@ export type NetWorthData = {
17
17
  accounts: Account[];
18
18
  monthlyAccountBalances: MonthlyAccountBalance[];
19
19
  };
20
+ export type NetWorthProps = {
21
+ chartData: NetWorth[];
22
+ hoveredData?: NetWorth;
23
+ onDataClick: any;
24
+ onMouseEnter: any;
25
+ onMouseLeave: any;
26
+ selectedData?: NetWorth;
27
+ };
28
+ export interface AssetsLiabilities {
29
+ assets: {
30
+ accountName?: string;
31
+ balance: number;
32
+ }[];
33
+ liabilities: {
34
+ accountName?: string;
35
+ balance: number;
36
+ }[];
37
+ totalAssets: number;
38
+ totalLiabilities: number;
39
+ }
40
+ export interface GainsLosses {
41
+ gains: {
42
+ accountName: string;
43
+ gain: number;
44
+ }[];
45
+ losses: {
46
+ accountName: string;
47
+ loss: number;
48
+ }[];
49
+ totalGains: number;
50
+ totalLosses: number;
51
+ }
@@ -2,6 +2,30 @@ import { Account, Member, MonthlyAccountBalance } from '../../common/types';
2
2
  import { NetWorth } from '../types/NetWorth';
3
3
  export declare const filterAccounts: (accounts: Account[], members: Member[]) => Account[];
4
4
  export declare const flattenBalances: (balances: any, balance: any) => any[];
5
- export declare const getSelectedDataDefault: (chartData: NetWorth[]) => NetWorth | null;
5
+ export declare const getSelectedDataDefault: (chartData: NetWorth[]) => NetWorth | undefined;
6
6
  export declare const sortByYearMonthAscending: (a: MonthlyAccountBalance, b: MonthlyAccountBalance) => number;
7
7
  export declare const buildChartData: (accounts: Account[], monthlyAccountBalances: MonthlyAccountBalance[], numberOfMonths: number) => any;
8
+ export declare const buildGainsLosses: (selectedData?: NetWorth) => Promise<{
9
+ gains: {
10
+ accountName: string;
11
+ gain: number;
12
+ }[];
13
+ losses: {
14
+ accountName: string;
15
+ loss: number;
16
+ }[];
17
+ totalGains: number;
18
+ totalLosses: number;
19
+ }>;
20
+ export declare const buildAssetsLiabilities: (accounts: Account[]) => Promise<{
21
+ assets: {
22
+ accountName?: string;
23
+ balance: number;
24
+ }[];
25
+ liabilities: {
26
+ accountName?: string;
27
+ balance: number;
28
+ }[];
29
+ totalAssets: number;
30
+ totalLiabilities: number;
31
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "3.13.3",
3
+ "version": "3.13.4-alpha.mm0",
4
4
  "description": "Library containing experience widgets",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",