@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 CHANGED
@@ -9466,9 +9466,9 @@ var ProfitAndLossChart = ({
9466
9466
  name: getMonthName(pnl),
9467
9467
  revenue: pnl?.income || 0,
9468
9468
  revenueUncategorized: pnl?.uncategorizedInflows || 0,
9469
- expenses: -(pnl?.totalExpenses || 0),
9469
+ expenses: -(pnl?.operatingExpenses || 0),
9470
9470
  expensesUncategorized: -(pnl?.uncategorizedOutflows || 0),
9471
- operatingExpensesInverse: pnl?.totalExpenses || 0,
9471
+ operatingExpensesInverse: pnl?.operatingExpensesInverse || 0,
9472
9472
  uncategorizedOutflowsInverse: pnl?.uncategorizedOutflowsInverse || 0,
9473
9473
  netProfit: pnl?.netProfit || 0,
9474
9474
  selected: !!pnl && pnl.month === selectionMonth.month + 1 && pnl.year === selectionMonth.year,
@@ -10068,16 +10068,6 @@ var convertCurrencyToNumber = (amount) => {
10068
10068
  return parseFloat(inputValue);
10069
10069
  };
10070
10070
 
10071
- // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
10072
- import {
10073
- PieChart,
10074
- Pie,
10075
- Cell as Cell2,
10076
- ResponsiveContainer as ResponsiveContainer2,
10077
- Label,
10078
- Text as ChartText
10079
- } from "recharts";
10080
-
10081
10071
  // src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
10082
10072
  import React118 from "react";
10083
10073
 
@@ -10096,7 +10086,7 @@ var DEFAULT_CHART_COLOR_TYPE = [
10096
10086
  "#6A52CC",
10097
10087
  "#71CC56"
10098
10088
  ];
10099
- var DEFAULT_CHART_COLORS = [
10089
+ var DEFAULT_MINICHART_COLORS = [
10100
10090
  {
10101
10091
  color: "#7417B3",
10102
10092
  opacity: 1
@@ -10238,14 +10228,14 @@ var SortArrows_default = SortArrows;
10238
10228
 
10239
10229
  // src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
10240
10230
  import classNames43 from "classnames";
10241
- var mapColorsToTypes = (data) => {
10231
+ var mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
10242
10232
  const typeToColor = {};
10243
10233
  const typeToLastOpacity = {};
10244
10234
  let colorIndex = 0;
10245
10235
  return data.map((obj) => {
10246
10236
  const type = obj.type;
10247
10237
  if (!typeToColor[type]) {
10248
- typeToColor[type] = DEFAULT_CHART_COLOR_TYPE[colorIndex % DEFAULT_CHART_COLOR_TYPE.length];
10238
+ typeToColor[type] = colorList[colorIndex % colorList.length];
10249
10239
  colorIndex++;
10250
10240
  typeToLastOpacity[type] = 1;
10251
10241
  } else {
@@ -10265,6 +10255,7 @@ var DetailedTable = ({
10265
10255
  sortBy,
10266
10256
  hoveredItem,
10267
10257
  setHoveredItem,
10258
+ chartColorsList,
10268
10259
  stringOverrides
10269
10260
  }) => {
10270
10261
  const buildColClass = (column) => {
@@ -10273,8 +10264,8 @@ var DetailedTable = ({
10273
10264
  sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
10274
10265
  );
10275
10266
  };
10276
- const typeColorMapping = mapColorsToTypes(filteredData);
10277
- let colorIndex = 0;
10267
+ const typeColorMapping = mapTypesToColors(filteredData, chartColorsList);
10268
+ const colorIndex = 0;
10278
10269
  return /* @__PURE__ */ React118.createElement("div", { className: "details-container" }, /* @__PURE__ */ React118.createElement("div", { className: "table" }, /* @__PURE__ */ React118.createElement("table", null, /* @__PURE__ */ React118.createElement("thead", null, /* @__PURE__ */ React118.createElement("tr", null, /* @__PURE__ */ React118.createElement(
10279
10270
  "th",
10280
10271
  {
@@ -10332,6 +10323,14 @@ var DetailedTable = ({
10332
10323
  };
10333
10324
 
10334
10325
  // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
10326
+ import {
10327
+ PieChart,
10328
+ Pie,
10329
+ Cell as Cell2,
10330
+ ResponsiveContainer as ResponsiveContainer2,
10331
+ Label,
10332
+ Text as ChartText
10333
+ } from "recharts";
10335
10334
  var DetailedChart = ({
10336
10335
  filteredData,
10337
10336
  filteredTotal,
@@ -10339,6 +10338,7 @@ var DetailedChart = ({
10339
10338
  setHoveredItem,
10340
10339
  sidebarScope,
10341
10340
  date,
10341
+ chartColorsList,
10342
10342
  isLoading,
10343
10343
  showDatePicker = true
10344
10344
  }) => {
@@ -10362,7 +10362,7 @@ var DetailedChart = ({
10362
10362
  });
10363
10363
  }, [filteredData, isLoading]);
10364
10364
  const noValue = chartData.length === 0 || !chartData.find((x) => x.value !== 0);
10365
- const typeColorMapping = mapColorsToTypes(chartData);
10365
+ const typeColorMapping = mapTypesToColors(chartData, chartColorsList);
10366
10366
  return /* @__PURE__ */ React119.createElement("div", { className: "chart-field" }, /* @__PURE__ */ React119.createElement("div", { className: "header--tablet" }, showDatePicker && /* @__PURE__ */ React119.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React119.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React119.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React119.createElement(PieChart, null, !isLoading && !noValue ? /* @__PURE__ */ React119.createElement(
10367
10367
  Pie,
10368
10368
  {
@@ -10642,6 +10642,7 @@ var ProfitAndLossDetailedCharts = ({
10642
10642
  scope,
10643
10643
  hideClose = false,
10644
10644
  showDatePicker = false,
10645
+ chartColorsList,
10645
10646
  stringOverrides
10646
10647
  }) => {
10647
10648
  const {
@@ -10679,6 +10680,7 @@ var ProfitAndLossDetailedCharts = ({
10679
10680
  sidebarScope: theScope,
10680
10681
  date: dateRange.startDate,
10681
10682
  isLoading,
10683
+ chartColorsList,
10682
10684
  showDatePicker
10683
10685
  }
10684
10686
  ), /* @__PURE__ */ React121.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ React121.createElement(
@@ -10698,6 +10700,7 @@ var ProfitAndLossDetailedCharts = ({
10698
10700
  sortBy,
10699
10701
  hoveredItem,
10700
10702
  setHoveredItem,
10703
+ chartColorsList,
10701
10704
  stringOverrides: stringOverrides?.detailedTableStringOverrides
10702
10705
  }
10703
10706
  ))));
@@ -10728,7 +10731,7 @@ var MiniChart = ({ data }) => {
10728
10731
  animationEasing: "ease-in-out"
10729
10732
  },
10730
10733
  data.map((entry, index) => {
10731
- const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
10734
+ const colorConfig = DEFAULT_MINICHART_COLORS[index % DEFAULT_MINICHART_COLORS.length];
10732
10735
  return /* @__PURE__ */ React122.createElement(
10733
10736
  Cell3,
10734
10737
  {
@@ -15340,6 +15343,7 @@ var AccountingOverview = ({
15340
15343
  enableOnboarding = false,
15341
15344
  onTransactionsToReviewClick,
15342
15345
  middleBanner,
15346
+ chartColorsList,
15343
15347
  stringOverrides
15344
15348
  }) => {
15345
15349
  const [pnlToggle, setPnlToggle] = useState56("revenue");
@@ -15398,7 +15402,8 @@ var AccountingOverview = ({
15398
15402
  {
15399
15403
  scope: "revenue",
15400
15404
  hideClose: true,
15401
- stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts
15405
+ stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts,
15406
+ chartColorsList
15402
15407
  }
15403
15408
  )
15404
15409
  ), /* @__PURE__ */ React179.createElement(
@@ -15414,7 +15419,8 @@ var AccountingOverview = ({
15414
15419
  {
15415
15420
  scope: "expenses",
15416
15421
  hideClose: true,
15417
- stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts
15422
+ stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts,
15423
+ chartColorsList
15418
15424
  }
15419
15425
  )
15420
15426
  ))));