@layerfi/components 0.1.50 → 0.1.51

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
@@ -4776,25 +4776,20 @@ var allCategoriesDivider = [
4776
4776
  }
4777
4777
  ];
4778
4778
  function flattenCategories2(categories) {
4779
- const categoryOptions = (categories || []).flatMap((category) => {
4780
- if (category?.subCategories && category?.subCategories?.length > 0) {
4781
- if (category?.subCategories?.every((c) => c.subCategories === void 0)) {
4782
- return [
4783
- {
4784
- label: category.display_name,
4785
- options: category.subCategories.map((x) => mapCategoryToOption2(x))
4786
- }
4787
- ];
4788
- }
4789
- return flattenCategories2(category.subCategories);
4779
+ function getLeafCategories(category) {
4780
+ if (!category.subCategories || category.subCategories.length === 0) {
4781
+ return [category];
4790
4782
  }
4791
- const resultOption = {
4792
- label: category.display_name,
4793
- options: [mapCategoryToOption2(category)]
4794
- };
4795
- return [resultOption];
4796
- });
4797
- return categoryOptions;
4783
+ return category.subCategories.flatMap((subCategory) => getLeafCategories(subCategory));
4784
+ }
4785
+ return categories.map(
4786
+ (category) => {
4787
+ return {
4788
+ label: category.display_name,
4789
+ options: getLeafCategories(category).map((x) => mapCategoryToOption2(x))
4790
+ };
4791
+ }
4792
+ );
4798
4793
  }
4799
4794
  var CategorySelect = ({
4800
4795
  bankTransaction,
@@ -11313,7 +11308,7 @@ var ProfitAndLossTableComponent = ({
11313
11308
  void 0,
11314
11309
  void 0,
11315
11310
  "summation"
11316
- ), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ React129.createElement(React129.Fragment, null, renderLineItem(data.other_outflows, 0, "other_outflows", 6), renderLineItem(data.personal_expenses, 0, "personal_expenses", 7)) : null));
11311
+ ), data.personal_expenses ? /* @__PURE__ */ React129.createElement(React129.Fragment, null, renderLineItem(data.personal_expenses, 0, "personal_expenses", 7)) : null, data.other_outflows ? /* @__PURE__ */ React129.createElement(React129.Fragment, null, renderLineItem(data.other_outflows, 0, "other_outflows", 6)) : null));
11317
11312
  };
11318
11313
 
11319
11314
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx