@layerfi/components 0.1.40 → 0.1.42
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/esm/index.js +27 -21
- package/dist/esm/index.js.map +3 -3
- package/dist/index.d.ts +12 -7
- package/dist/index.js +20 -14
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2387,10 +2387,11 @@ declare module '@layerfi/components/components/ProfitAndLoss/ProfitAndLoss' {
|
|
|
2387
2387
|
asContainer?: boolean | undefined;
|
|
2388
2388
|
stringOverrides?: import("@layerfi/components/components/ProfitAndLossTable/ProfitAndLossTable").ProfitAndLossTableStringOverrides | undefined;
|
|
2389
2389
|
}) => React.JSX.Element;
|
|
2390
|
-
DetailedCharts: ({ scope, hideClose, showDatePicker, stringOverrides, }: {
|
|
2390
|
+
DetailedCharts: ({ scope, hideClose, showDatePicker, chartColorsList, stringOverrides, }: {
|
|
2391
2391
|
scope?: import("@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss").SidebarScope;
|
|
2392
2392
|
hideClose?: boolean | undefined;
|
|
2393
2393
|
showDatePicker?: boolean | undefined;
|
|
2394
|
+
chartColorsList?: string[] | undefined;
|
|
2394
2395
|
stringOverrides?: import("@layerfi/components/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts").ProfitAndLossDetailedChartsStringOverrides | undefined;
|
|
2395
2396
|
}) => React.JSX.Element;
|
|
2396
2397
|
};
|
|
@@ -2451,8 +2452,9 @@ declare module '@layerfi/components/components/ProfitAndLossDetailedCharts/Detai
|
|
|
2451
2452
|
date: number | Date;
|
|
2452
2453
|
isLoading?: boolean;
|
|
2453
2454
|
showDatePicker?: boolean;
|
|
2455
|
+
chartColorsList?: string[];
|
|
2454
2456
|
}
|
|
2455
|
-
export const DetailedChart: ({ filteredData, filteredTotal, hoveredItem, setHoveredItem, sidebarScope, date, isLoading, showDatePicker, }: DetailedChartProps) => React.JSX.Element;
|
|
2457
|
+
export const DetailedChart: ({ filteredData, filteredTotal, hoveredItem, setHoveredItem, sidebarScope, date, chartColorsList, isLoading, showDatePicker, }: DetailedChartProps) => React.JSX.Element;
|
|
2456
2458
|
export {};
|
|
2457
2459
|
|
|
2458
2460
|
}
|
|
@@ -2473,13 +2475,14 @@ declare module '@layerfi/components/components/ProfitAndLossDetailedCharts/Detai
|
|
|
2473
2475
|
sidebarScope: SidebarScope;
|
|
2474
2476
|
filters: ProfitAndLossFilters;
|
|
2475
2477
|
sortBy: (scope: Scope, field: string, direction?: SortDirection) => void;
|
|
2478
|
+
chartColorsList?: string[];
|
|
2476
2479
|
stringOverrides?: DetailedTableStringOverrides;
|
|
2477
2480
|
}
|
|
2478
|
-
export const
|
|
2481
|
+
export const mapTypesToColors: (data: any[], colorList?: string[]) => {
|
|
2479
2482
|
color: any;
|
|
2480
2483
|
opacity: any;
|
|
2481
2484
|
}[];
|
|
2482
|
-
export const DetailedTable: ({ filteredData, sidebarScope, filters, sortBy, hoveredItem, setHoveredItem, stringOverrides, }: DetailedTableProps) => React.JSX.Element;
|
|
2485
|
+
export const DetailedTable: ({ filteredData, sidebarScope, filters, sortBy, hoveredItem, setHoveredItem, chartColorsList, stringOverrides, }: DetailedTableProps) => React.JSX.Element;
|
|
2483
2486
|
|
|
2484
2487
|
}
|
|
2485
2488
|
declare module '@layerfi/components/components/ProfitAndLossDetailedCharts/Filters' {
|
|
@@ -2502,10 +2505,11 @@ declare module '@layerfi/components/components/ProfitAndLossDetailedCharts/Profi
|
|
|
2502
2505
|
export interface ProfitAndLossDetailedChartsStringOverrides {
|
|
2503
2506
|
detailedTableStringOverrides?: DetailedTableStringOverrides;
|
|
2504
2507
|
}
|
|
2505
|
-
export const ProfitAndLossDetailedCharts: ({ scope, hideClose, showDatePicker, stringOverrides, }: {
|
|
2508
|
+
export const ProfitAndLossDetailedCharts: ({ scope, hideClose, showDatePicker, chartColorsList, stringOverrides, }: {
|
|
2506
2509
|
scope?: SidebarScope;
|
|
2507
2510
|
hideClose?: boolean | undefined;
|
|
2508
2511
|
showDatePicker?: boolean | undefined;
|
|
2512
|
+
chartColorsList?: string[] | undefined;
|
|
2509
2513
|
stringOverrides?: ProfitAndLossDetailedChartsStringOverrides | undefined;
|
|
2510
2514
|
}) => React.JSX.Element;
|
|
2511
2515
|
|
|
@@ -3253,7 +3257,7 @@ declare module '@layerfi/components/config/charts' {
|
|
|
3253
3257
|
export const INACTIVE_OPACITY_LEVELS: number[];
|
|
3254
3258
|
export const DEFAULT_CHART_OPACITY: number[];
|
|
3255
3259
|
export const DEFAULT_CHART_COLOR_TYPE: string[];
|
|
3256
|
-
export const
|
|
3260
|
+
export const DEFAULT_MINICHART_COLORS: {
|
|
3257
3261
|
color: string;
|
|
3258
3262
|
opacity: number;
|
|
3259
3263
|
}[];
|
|
@@ -5373,9 +5377,10 @@ declare module '@layerfi/components/views/AccountingOverview/AccountingOverview'
|
|
|
5373
5377
|
enableOnboarding?: boolean;
|
|
5374
5378
|
onTransactionsToReviewClick?: () => void;
|
|
5375
5379
|
middleBanner?: ReactNode;
|
|
5380
|
+
chartColorsList?: string[];
|
|
5376
5381
|
stringOverrides?: AccountingOverviewStringOverrides;
|
|
5377
5382
|
}
|
|
5378
|
-
export const AccountingOverview: ({ title, enableOnboarding, onTransactionsToReviewClick, middleBanner, stringOverrides, }: AccountingOverviewProps) => React.JSX.Element;
|
|
5383
|
+
export const AccountingOverview: ({ title, enableOnboarding, onTransactionsToReviewClick, middleBanner, chartColorsList, stringOverrides, }: AccountingOverviewProps) => React.JSX.Element;
|
|
5379
5384
|
export {};
|
|
5380
5385
|
|
|
5381
5386
|
}
|
package/dist/index.js
CHANGED
|
@@ -9460,9 +9460,9 @@ var ProfitAndLossChart = ({
|
|
|
9460
9460
|
name: getMonthName(pnl),
|
|
9461
9461
|
revenue: pnl?.income || 0,
|
|
9462
9462
|
revenueUncategorized: pnl?.uncategorizedInflows || 0,
|
|
9463
|
-
expenses: -(pnl?.
|
|
9463
|
+
expenses: -(pnl?.operatingExpenses || 0),
|
|
9464
9464
|
expensesUncategorized: -(pnl?.uncategorizedOutflows || 0),
|
|
9465
|
-
operatingExpensesInverse: pnl?.
|
|
9465
|
+
operatingExpensesInverse: pnl?.operatingExpensesInverse || 0,
|
|
9466
9466
|
uncategorizedOutflowsInverse: pnl?.uncategorizedOutflowsInverse || 0,
|
|
9467
9467
|
netProfit: pnl?.netProfit || 0,
|
|
9468
9468
|
selected: !!pnl && pnl.month === selectionMonth.month + 1 && pnl.year === selectionMonth.year,
|
|
@@ -10062,9 +10062,6 @@ var convertCurrencyToNumber = (amount) => {
|
|
|
10062
10062
|
return parseFloat(inputValue);
|
|
10063
10063
|
};
|
|
10064
10064
|
|
|
10065
|
-
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
10066
|
-
var import_recharts2 = require("recharts");
|
|
10067
|
-
|
|
10068
10065
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
10069
10066
|
var import_react105 = __toESM(require("react"));
|
|
10070
10067
|
|
|
@@ -10083,7 +10080,7 @@ var DEFAULT_CHART_COLOR_TYPE = [
|
|
|
10083
10080
|
"#6A52CC",
|
|
10084
10081
|
"#71CC56"
|
|
10085
10082
|
];
|
|
10086
|
-
var
|
|
10083
|
+
var DEFAULT_MINICHART_COLORS = [
|
|
10087
10084
|
{
|
|
10088
10085
|
color: "#7417B3",
|
|
10089
10086
|
opacity: 1
|
|
@@ -10225,14 +10222,14 @@ var SortArrows_default = SortArrows;
|
|
|
10225
10222
|
|
|
10226
10223
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
10227
10224
|
var import_classnames44 = __toESM(require("classnames"));
|
|
10228
|
-
var
|
|
10225
|
+
var mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
|
|
10229
10226
|
const typeToColor = {};
|
|
10230
10227
|
const typeToLastOpacity = {};
|
|
10231
10228
|
let colorIndex = 0;
|
|
10232
10229
|
return data.map((obj) => {
|
|
10233
10230
|
const type = obj.type;
|
|
10234
10231
|
if (!typeToColor[type]) {
|
|
10235
|
-
typeToColor[type] =
|
|
10232
|
+
typeToColor[type] = colorList[colorIndex % colorList.length];
|
|
10236
10233
|
colorIndex++;
|
|
10237
10234
|
typeToLastOpacity[type] = 1;
|
|
10238
10235
|
} else {
|
|
@@ -10252,6 +10249,7 @@ var DetailedTable = ({
|
|
|
10252
10249
|
sortBy,
|
|
10253
10250
|
hoveredItem,
|
|
10254
10251
|
setHoveredItem,
|
|
10252
|
+
chartColorsList,
|
|
10255
10253
|
stringOverrides
|
|
10256
10254
|
}) => {
|
|
10257
10255
|
const buildColClass = (column) => {
|
|
@@ -10260,8 +10258,8 @@ var DetailedTable = ({
|
|
|
10260
10258
|
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
10261
10259
|
);
|
|
10262
10260
|
};
|
|
10263
|
-
const typeColorMapping =
|
|
10264
|
-
|
|
10261
|
+
const typeColorMapping = mapTypesToColors(filteredData, chartColorsList);
|
|
10262
|
+
const colorIndex = 0;
|
|
10265
10263
|
return /* @__PURE__ */ import_react105.default.createElement("div", { className: "details-container" }, /* @__PURE__ */ import_react105.default.createElement("div", { className: "table" }, /* @__PURE__ */ import_react105.default.createElement("table", null, /* @__PURE__ */ import_react105.default.createElement("thead", null, /* @__PURE__ */ import_react105.default.createElement("tr", null, /* @__PURE__ */ import_react105.default.createElement(
|
|
10266
10264
|
"th",
|
|
10267
10265
|
{
|
|
@@ -10319,6 +10317,7 @@ var DetailedTable = ({
|
|
|
10319
10317
|
};
|
|
10320
10318
|
|
|
10321
10319
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
10320
|
+
var import_recharts2 = require("recharts");
|
|
10322
10321
|
var DetailedChart = ({
|
|
10323
10322
|
filteredData,
|
|
10324
10323
|
filteredTotal,
|
|
@@ -10326,6 +10325,7 @@ var DetailedChart = ({
|
|
|
10326
10325
|
setHoveredItem,
|
|
10327
10326
|
sidebarScope,
|
|
10328
10327
|
date,
|
|
10328
|
+
chartColorsList,
|
|
10329
10329
|
isLoading,
|
|
10330
10330
|
showDatePicker = true
|
|
10331
10331
|
}) => {
|
|
@@ -10349,7 +10349,7 @@ var DetailedChart = ({
|
|
|
10349
10349
|
});
|
|
10350
10350
|
}, [filteredData, isLoading]);
|
|
10351
10351
|
const noValue = chartData.length === 0 || !chartData.find((x) => x.value !== 0);
|
|
10352
|
-
const typeColorMapping =
|
|
10352
|
+
const typeColorMapping = mapTypesToColors(chartData, chartColorsList);
|
|
10353
10353
|
return /* @__PURE__ */ import_react106.default.createElement("div", { className: "chart-field" }, /* @__PURE__ */ import_react106.default.createElement("div", { className: "header--tablet" }, showDatePicker && /* @__PURE__ */ import_react106.default.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ import_react106.default.createElement("div", { className: "chart-container" }, /* @__PURE__ */ import_react106.default.createElement(import_recharts2.ResponsiveContainer, null, /* @__PURE__ */ import_react106.default.createElement(import_recharts2.PieChart, null, !isLoading && !noValue ? /* @__PURE__ */ import_react106.default.createElement(
|
|
10354
10354
|
import_recharts2.Pie,
|
|
10355
10355
|
{
|
|
@@ -10629,6 +10629,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
10629
10629
|
scope,
|
|
10630
10630
|
hideClose = false,
|
|
10631
10631
|
showDatePicker = false,
|
|
10632
|
+
chartColorsList,
|
|
10632
10633
|
stringOverrides
|
|
10633
10634
|
}) => {
|
|
10634
10635
|
const {
|
|
@@ -10666,6 +10667,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
10666
10667
|
sidebarScope: theScope,
|
|
10667
10668
|
date: dateRange.startDate,
|
|
10668
10669
|
isLoading,
|
|
10670
|
+
chartColorsList,
|
|
10669
10671
|
showDatePicker
|
|
10670
10672
|
}
|
|
10671
10673
|
), /* @__PURE__ */ import_react108.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ import_react108.default.createElement(
|
|
@@ -10685,6 +10687,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
10685
10687
|
sortBy,
|
|
10686
10688
|
hoveredItem,
|
|
10687
10689
|
setHoveredItem,
|
|
10690
|
+
chartColorsList,
|
|
10688
10691
|
stringOverrides: stringOverrides?.detailedTableStringOverrides
|
|
10689
10692
|
}
|
|
10690
10693
|
))));
|
|
@@ -10715,7 +10718,7 @@ var MiniChart = ({ data }) => {
|
|
|
10715
10718
|
animationEasing: "ease-in-out"
|
|
10716
10719
|
},
|
|
10717
10720
|
data.map((entry, index) => {
|
|
10718
|
-
const colorConfig =
|
|
10721
|
+
const colorConfig = DEFAULT_MINICHART_COLORS[index % DEFAULT_MINICHART_COLORS.length];
|
|
10719
10722
|
return /* @__PURE__ */ import_react109.default.createElement(
|
|
10720
10723
|
import_recharts3.Cell,
|
|
10721
10724
|
{
|
|
@@ -15316,6 +15319,7 @@ var AccountingOverview = ({
|
|
|
15316
15319
|
enableOnboarding = false,
|
|
15317
15320
|
onTransactionsToReviewClick,
|
|
15318
15321
|
middleBanner,
|
|
15322
|
+
chartColorsList,
|
|
15319
15323
|
stringOverrides
|
|
15320
15324
|
}) => {
|
|
15321
15325
|
const [pnlToggle, setPnlToggle] = (0, import_react174.useState)("revenue");
|
|
@@ -15374,7 +15378,8 @@ var AccountingOverview = ({
|
|
|
15374
15378
|
{
|
|
15375
15379
|
scope: "revenue",
|
|
15376
15380
|
hideClose: true,
|
|
15377
|
-
stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts
|
|
15381
|
+
stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts,
|
|
15382
|
+
chartColorsList
|
|
15378
15383
|
}
|
|
15379
15384
|
)
|
|
15380
15385
|
), /* @__PURE__ */ import_react174.default.createElement(
|
|
@@ -15390,7 +15395,8 @@ var AccountingOverview = ({
|
|
|
15390
15395
|
{
|
|
15391
15396
|
scope: "expenses",
|
|
15392
15397
|
hideClose: true,
|
|
15393
|
-
stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts
|
|
15398
|
+
stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts,
|
|
15399
|
+
chartColorsList
|
|
15394
15400
|
}
|
|
15395
15401
|
)
|
|
15396
15402
|
))));
|