@mx-cartographer/experiences 6.21.2-alpha.al1 → 6.21.2-alpha.al2

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.es.js CHANGED
@@ -20805,52 +20805,46 @@ const $C = (e) => e.reduce((i, a) => {
20805
20805
  }
20806
20806
  ), hf = T(
20807
20807
  ({ onListItemClick: e, transactions: n }) => {
20808
- const i = _a(), { visibleListItems: a, collapsedListItems: o } = g.useMemo(() => {
20809
- const h = i.sortCategoriesList(n);
20810
- return {
20811
- visibleListItems: h.slice(0, 5),
20812
- collapsedListItems: h.slice(5)
20813
- };
20814
- }, [i, n]), [r, s] = g.useState(!1), c = {
20808
+ const { visibleListItems: i, collapsedListItems: a } = _a(), [o, r] = g.useState(!1), s = {
20815
20809
  categories: "Categories"
20816
- }, d = (h) => n.filter((m) => m.category_guid === h), _ = ({ guid: h, name: m, amount: p }, f, E) => {
20817
- const y = a.length + (r ? o.length : 0), x = (E === o ? a.length + f : f) === y - 1, v = d(h), w = {
20818
- guid: h,
20819
- name: m,
20820
- amount: p,
20821
- transactions: v,
20822
- transactionCount: v.length
20810
+ }, c = (u) => n.filter((h) => h.category_guid === u), d = ({ guid: u, name: h, amount: m }, p, f) => {
20811
+ const E = i.length + (o ? a.length : 0), S = (f === a ? i.length + p : p) === E - 1, x = c(u), v = {
20812
+ guid: u,
20813
+ name: h,
20814
+ amount: m,
20815
+ transactions: x,
20816
+ transactionCount: x.length
20823
20817
  };
20824
20818
  return /* @__PURE__ */ l(g.Fragment, { children: [
20825
20819
  /* @__PURE__ */ t(
20826
20820
  Qc,
20827
20821
  {
20828
- amount: p,
20829
- guid: h,
20830
- name: m,
20831
- onClick: () => e(w),
20832
- transactionCount: v.length
20822
+ amount: m,
20823
+ guid: u,
20824
+ name: h,
20825
+ onClick: x.length > 0 ? () => e(v) : void 0,
20826
+ transactionCount: x.length
20833
20827
  }
20834
20828
  ),
20835
- /* @__PURE__ */ t(H, { sx: { ml: x ? 24 : 68 } })
20836
- ] }, h);
20837
- }, u = () => {
20838
- s(!r);
20829
+ /* @__PURE__ */ t(H, { sx: { ml: S ? 24 : 68 } })
20830
+ ] }, u);
20831
+ }, _ = () => {
20832
+ r(!o);
20839
20833
  };
20840
20834
  return /* @__PURE__ */ t(b, { sx: { pb: 48, width: "100%" }, children: /* @__PURE__ */ l(ae, { children: [
20841
- /* @__PURE__ */ t(b, { sx: { pb: 4, pt: 16, px: 24 }, children: /* @__PURE__ */ t(st, { children: c.categories }) }),
20842
- a.map((h, m) => _(h, m, a)),
20835
+ /* @__PURE__ */ t(b, { sx: { pb: 4, pt: 16, px: 24 }, children: /* @__PURE__ */ t(st, { children: s.categories }) }),
20836
+ i.map((u, h) => d(u, h, i)),
20843
20837
  /* @__PURE__ */ t(
20844
20838
  Kn,
20845
20839
  {
20846
- in: r,
20840
+ in: o,
20847
20841
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
20848
- children: o.map(
20849
- (h, m) => _(h, m, o)
20842
+ children: a.map(
20843
+ (u, h) => d(u, h, a)
20850
20844
  )
20851
20845
  }
20852
20846
  ),
20853
- o.length > 0 && /* @__PURE__ */ t(uf, { isExpanded: r, onClick: u })
20847
+ a.length > 0 && /* @__PURE__ */ t(uf, { isExpanded: o, onClick: _ })
20854
20848
  ] }) });
20855
20849
  }
20856
20850
  );
@@ -22792,7 +22786,7 @@ const Li = g.createContext(null), yf = ({
22792
22786
  close_category_details: "Close category details",
22793
22787
  transaction: "Transaction",
22794
22788
  transactions: "Transactions"
22795
- }, a = () => n ? n.isIncome ? i.category_income : i.category_spending : "", o = () => {
22789
+ }, a = () => n ? n.isIncome ? i.category_income : i.category_spending : "", o = ` ${n?.transactionCount === 1 ? i.transaction : i.transactions} (${n?.transactionCount})`, r = () => {
22796
22790
  e?.();
22797
22791
  };
22798
22792
  return /* @__PURE__ */ t(
@@ -22800,16 +22794,37 @@ const Li = g.createContext(null), yf = ({
22800
22794
  {
22801
22795
  ariaLabelClose: i.close_category_details,
22802
22796
  isOpen: !!n,
22803
- onClose: o,
22797
+ onClose: r,
22804
22798
  title: a(),
22805
- children: /* @__PURE__ */ t(b, { sx: { border: "2px solid red", alignItems: "flex-start", pt: 16 }, children: n && /* @__PURE__ */ t(
22806
- Qc,
22807
- {
22808
- amount: n.amount,
22809
- guid: n.guid,
22810
- name: n.name
22811
- }
22812
- ) })
22799
+ children: /* @__PURE__ */ t(b, { sx: { alignItems: "center", pt: 16 }, children: n && /* @__PURE__ */ l(g.Fragment, { children: [
22800
+ /* @__PURE__ */ t(
22801
+ Qc,
22802
+ {
22803
+ amount: n.amount,
22804
+ guid: n.guid,
22805
+ name: n.name
22806
+ }
22807
+ ),
22808
+ /* @__PURE__ */ t(b, { sx: { alignItems: "center", height: 265, p: 24, pt: 12, width: "100%" } }),
22809
+ /* @__PURE__ */ l(
22810
+ b,
22811
+ {
22812
+ sx: {
22813
+ alignItems: "flex-start",
22814
+ alignSelf: "stretch",
22815
+ flexDirection: "row",
22816
+ justifyContent: "space-between",
22817
+ pb: 12,
22818
+ pt: 16,
22819
+ px: 24
22820
+ },
22821
+ children: [
22822
+ /* @__PURE__ */ t(C, { bold: !0, variant: "body1", children: o }),
22823
+ /* @__PURE__ */ t(C, { bold: !0, children: "Export CSV" })
22824
+ ]
22825
+ }
22826
+ )
22827
+ ] }) })
22813
22828
  }
22814
22829
  );
22815
22830
  }), $f = (e, n) => {
@@ -23028,17 +23043,11 @@ class e0 {
23028
23043
  setSelectedCategoryData = (n) => {
23029
23044
  this.selectedCategoryData = n;
23030
23045
  };
23031
- sortCategoriesList = (n = []) => !this.detailedCategories || this.detailedCategories.length === 0 ? [] : this.detailedCategories.map((i) => {
23032
- const a = i.monthlyAmounts.reduce((r, s) => r + (s.amount || 0), 0), o = n.filter(
23033
- (r) => r.category_guid === i.guid
23034
- );
23035
- return {
23036
- guid: i.guid,
23037
- name: i.name,
23038
- amount: a,
23039
- hasTransactions: o.length > 0
23040
- };
23041
- }).filter((i) => i.hasTransactions && i.amount !== 0).sort((i, a) => a.amount - i.amount).map(({ guid: i, name: a, amount: o }) => ({ guid: i, name: a, amount: o }));
23046
+ sortCategoriesList = () => !this.detailedCategories || this.detailedCategories.length === 0 ? [] : this.detailedCategories.map((n) => ({
23047
+ guid: n.guid,
23048
+ name: n.name,
23049
+ amount: n.monthlyAmounts.reduce((i, a) => i + (a.amount || 0), 0)
23050
+ })).filter((n) => n.amount !== 0).sort((n, i) => i.amount - n.amount);
23042
23051
  get detailedCategories() {
23043
23052
  return this.globalStore.categoryStore.detailedCategories;
23044
23053
  }