@mx-cartographer/experiences 9.7.171 → 9.7.172
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/CHANGELOG.md +4 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +16 -18
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +43 -40
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +6 -0
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +28 -7
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/P2PLogoStack.d.ts +7 -1
- package/dist/insights-v2/components/P2PLogoStack.es.js +22 -22
- package/dist/insights-v2/components/P2PLogoStack.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [9.7.172] - 11-17-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - Monthly Subscription Aggregate V2: 72px bordered logos and Subscriptions drawer count tile type and icon match Figma (WEC-2298)
|
|
4
|
+
|
|
1
5
|
## [9.7.171] - 11-17-2026
|
|
2
6
|
|
|
3
7
|
- **CHANGED** - Credit Card Close to Limit's embedded card matches Figma (bold amounts, "Remains", a tighter donut), and micro card titles and notification rows use Figma's line height and logo size (WEC-2030)
|
package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { buildDynamicCopy as c } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { getLogoElevation as
|
|
2
|
+
import { DATE_FORMATS_INTL as m, formatDate as p } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { getLogoElevation as d } from "../../components/logoShadow.es.js";
|
|
4
4
|
import { TipSection as l } from "../../../insights/components/shared/ChartDrawerTemplate/TipSection.es.js";
|
|
5
|
-
import { DRAWER_TIP_ICON as
|
|
6
|
-
import { TransactionListHeaderIconTile as
|
|
5
|
+
import { DRAWER_TIP_ICON as u } from "../../components/drawerTip.es.js";
|
|
6
|
+
import { TransactionListHeaderIconTile as g } from "./TransactionListHeaderIconTile.es.js";
|
|
7
7
|
import n from "@mui/material/Stack";
|
|
8
|
-
import { Text as
|
|
8
|
+
import { H2 as x, Text as _ } from "@mxenabled/mxui";
|
|
9
9
|
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
10
|
-
var L = ({ header: o, copy: i, tipTitle:
|
|
11
|
-
const
|
|
10
|
+
var L = ({ header: o, copy: i, tipTitle: s }) => {
|
|
11
|
+
const a = s && i.subscriptions_tip_message ? i.subscriptions_tip_message : void 0, t = o.month && i.subscriptions_in_month ? c(i.subscriptions_in_month, p(o.month, m.MONTH_LONG)) : void 0;
|
|
12
12
|
return /* @__PURE__ */ e(n, {
|
|
13
13
|
sx: {
|
|
14
14
|
gap: 16,
|
|
@@ -21,30 +21,28 @@ var L = ({ header: o, copy: i, tipTitle: a }) => {
|
|
|
21
21
|
alignItems: "center",
|
|
22
22
|
bgcolor: "background.paper",
|
|
23
23
|
borderRadius: "8px",
|
|
24
|
-
boxShadow:
|
|
24
|
+
boxShadow: d,
|
|
25
25
|
flexDirection: "row",
|
|
26
26
|
gap: 12,
|
|
27
27
|
p: 16
|
|
28
28
|
},
|
|
29
|
-
children: [/* @__PURE__ */ r(
|
|
29
|
+
children: [/* @__PURE__ */ r(g, { name: "currency_exchange" }), /* @__PURE__ */ e(n, {
|
|
30
30
|
"aria-label": t ? `${o.count} ${t}` : String(o.count),
|
|
31
31
|
role: "group",
|
|
32
|
-
children: [/* @__PURE__ */ r(
|
|
32
|
+
children: [/* @__PURE__ */ r(x, {
|
|
33
33
|
"aria-hidden": !0,
|
|
34
|
-
bold: !0,
|
|
35
|
-
component: "p",
|
|
36
|
-
variant: "h1",
|
|
37
34
|
children: o.count
|
|
38
|
-
}), t && /* @__PURE__ */ r(
|
|
35
|
+
}), t && /* @__PURE__ */ r(_, {
|
|
39
36
|
"aria-hidden": !0,
|
|
40
37
|
color: "text.secondary",
|
|
41
|
-
|
|
38
|
+
sx: { lineHeight: "20px" },
|
|
39
|
+
variant: "body2",
|
|
42
40
|
children: t
|
|
43
41
|
})]
|
|
44
42
|
})]
|
|
45
|
-
}),
|
|
46
|
-
icon:
|
|
47
|
-
message: c(
|
|
43
|
+
}), a && /* @__PURE__ */ r(l, {
|
|
44
|
+
icon: u,
|
|
45
|
+
message: c(a, /* @__PURE__ */ r("strong", { children: s })),
|
|
48
46
|
sx: { m: 0 }
|
|
49
47
|
})]
|
|
50
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionListSubscriptionHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { TipSection } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { getLogoElevation } from '../../components/logoShadow'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\n\nimport { TransactionListHeaderIconTile } from './TransactionListHeaderIconTile'\nimport type { SubscriptionListHeader } from './layout'\n\nexport interface TransactionListSubscriptionHeaderProps {\n header: SubscriptionListHeader\n /** The caption and tip strings the header reads. */\n copy: Pick<\n NonNullable<InsightsFeedCopy['transaction_list_block']>,\n 'subscriptions_in_month' | 'subscriptions_tip_message'\n >\n /** The bold tip label (\"Tip\"), `insights_feed.general.tip_section_title`. */\n tipTitle: string\n}\n\n/** The Subscriptions drawer's header: the count tile and the tip (Figma 1268:54330). */\nexport const TransactionListSubscriptionHeader = ({\n header,\n copy,\n tipTitle,\n}: TransactionListSubscriptionHeaderProps) => {\n // Both halves or neither: a tip without its bold label would read \": Review…\".\n const tip =\n tipTitle && copy.subscriptions_tip_message ? copy.subscriptions_tip_message : undefined\n const caption =\n header.month && copy.subscriptions_in_month\n ? (buildDynamicCopy(\n copy.subscriptions_in_month,\n formatDate(header.month, DATE_FORMATS_INTL.MONTH_LONG),\n ) as string)\n : undefined\n\n return (\n <Stack sx={{ gap: 16, px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n flexDirection: 'row',\n gap: 12,\n p: 16,\n }}\n >\n <TransactionListHeaderIconTile name=\"currency_exchange\" />\n {/* Read as one label: \"3 Subscriptions in October\", never a bare \"3\" read twice. */}\n <Stack\n aria-label={caption ? `${header.count} ${caption}` : String(header.count)}\n role=\"group\"\n >\n <
|
|
1
|
+
{"version":3,"file":"TransactionListSubscriptionHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { InsightsFeedCopy } from '../../../core/types/localization'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { TipSection } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { getLogoElevation } from '../../components/logoShadow'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\n\nimport { TransactionListHeaderIconTile } from './TransactionListHeaderIconTile'\nimport type { SubscriptionListHeader } from './layout'\n\nexport interface TransactionListSubscriptionHeaderProps {\n header: SubscriptionListHeader\n /** The caption and tip strings the header reads. */\n copy: Pick<\n NonNullable<InsightsFeedCopy['transaction_list_block']>,\n 'subscriptions_in_month' | 'subscriptions_tip_message'\n >\n /** The bold tip label (\"Tip\"), `insights_feed.general.tip_section_title`. */\n tipTitle: string\n}\n\n/** The Subscriptions drawer's header: the count tile and the tip (Figma 1268:54330). */\nexport const TransactionListSubscriptionHeader = ({\n header,\n copy,\n tipTitle,\n}: TransactionListSubscriptionHeaderProps) => {\n // Both halves or neither: a tip without its bold label would read \": Review…\".\n const tip =\n tipTitle && copy.subscriptions_tip_message ? copy.subscriptions_tip_message : undefined\n const caption =\n header.month && copy.subscriptions_in_month\n ? (buildDynamicCopy(\n copy.subscriptions_in_month,\n formatDate(header.month, DATE_FORMATS_INTL.MONTH_LONG),\n ) as string)\n : undefined\n\n return (\n <Stack sx={{ gap: 16, px: 24, pt: 24, pb: 12 }}>\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n flexDirection: 'row',\n gap: 12,\n p: 16,\n }}\n >\n <TransactionListHeaderIconTile name=\"currency_exchange\" />\n {/* Read as one label: \"3 Subscriptions in October\", never a bare \"3\" read twice. */}\n <Stack\n aria-label={caption ? `${header.count} ${caption}` : String(header.count)}\n role=\"group\"\n >\n <H2 aria-hidden={true}>{header.count}</H2>\n {caption && (\n // Figma 13/400/20: mxui body2 (13/400) at a 20px line height.\n <Text\n aria-hidden={true}\n color=\"text.secondary\"\n sx={{ lineHeight: '20px' }}\n variant=\"body2\"\n >\n {caption}\n </Text>\n )}\n </Stack>\n </Stack>\n\n {tip && (\n <TipSection\n icon={DRAWER_TIP_ICON}\n message={buildDynamicCopy(tip, <strong>{tipTitle}</strong>) as ReactNode}\n sx={{ m: 0 }}\n />\n )}\n </Stack>\n )\n}\n\nexport default TransactionListSubscriptionHeader\n"],"mappings":";;;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,CAEE;AAAA;AAEX"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { slot as n } from "../../../../core/types/Insights.es.js";
|
|
2
|
-
import { CURRENCY_FORMAT as O, formatCurrency as
|
|
3
|
-
import
|
|
4
|
-
import { resolveVariantConfig as
|
|
5
|
-
import { asLogoRef as
|
|
6
|
-
import
|
|
2
|
+
import { CURRENCY_FORMAT as O, formatCurrency as x } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import A from "../../../components/StatusPill.es.js";
|
|
4
|
+
import { resolveVariantConfig as E } from "../../resolveVariantConfig.es.js";
|
|
5
|
+
import { asLogoRef as R, asNumber as y, asText as i, slotOrFlat as d } from "../../slotReaders.es.js";
|
|
6
|
+
import _, { isLogoGuid as z } from "../../../components/LogoFromGuid.es.js";
|
|
7
7
|
import B from "../../../components/LogoClusterCard.es.js";
|
|
8
8
|
import M from "../../../components/MerchantHighlightCard.es.js";
|
|
9
9
|
import N from "../../../components/P2PLogoStack.es.js";
|
|
10
10
|
import { MERCHANT_LAYOUT as P, merchantBlockVariant as T } from "./layout.es.js";
|
|
11
11
|
import V from "@mui/material/Stack";
|
|
12
|
-
import { Icon as
|
|
12
|
+
import { Icon as C } from "@mxenabled/mx-icons";
|
|
13
13
|
import { jsx as e } from "react/jsx-runtime";
|
|
14
|
-
var
|
|
14
|
+
var p = 64, b = 6, w = 72, F = 3, G = [
|
|
15
15
|
10,
|
|
16
16
|
20,
|
|
17
17
|
35
|
|
18
|
-
],
|
|
19
|
-
const r =
|
|
20
|
-
return r?.guid &&
|
|
21
|
-
},
|
|
18
|
+
], I = 32, g = (a) => {
|
|
19
|
+
const r = R(a);
|
|
20
|
+
return r?.guid && z(r.guid) ? r : void 0;
|
|
21
|
+
}, D = (a) => {
|
|
22
22
|
if (!Array.isArray(a)) return [];
|
|
23
23
|
const r = /* @__PURE__ */ new Map();
|
|
24
24
|
for (const t of a.map(g)) t?.guid && !r.has(t.guid) && r.set(t.guid, t);
|
|
25
25
|
return [...r.values()];
|
|
26
|
-
},
|
|
26
|
+
}, L = /* @__PURE__ */ e(C, {
|
|
27
27
|
"aria-hidden": !0,
|
|
28
28
|
"data-icon": "storefront",
|
|
29
29
|
name: "storefront",
|
|
30
|
-
size:
|
|
30
|
+
size: I,
|
|
31
31
|
sx: { color: "text.secondary" }
|
|
32
|
-
}), k = (a, r) => a.length ? a.map((t) => /* @__PURE__ */ e(
|
|
32
|
+
}), k = (a, r) => a.length ? a.map((t) => /* @__PURE__ */ e(_, {
|
|
33
33
|
logo: t,
|
|
34
34
|
size: r
|
|
35
|
-
}, t.guid)) : [
|
|
36
|
-
const { instance_slot: r } = a, { data: t } = r, o =
|
|
37
|
-
icon: /* @__PURE__ */ e(
|
|
35
|
+
}, t.guid)) : [L], ro = ({ payload: a }) => {
|
|
36
|
+
const { instance_slot: r } = a, { data: t } = r, o = E(P, r.variant, T.SingleStandard, "MerchantBlock"), u = i(d(r, "status_text")), m = o.status && u ? /* @__PURE__ */ e(A, {
|
|
37
|
+
icon: /* @__PURE__ */ e(C, {
|
|
38
38
|
"aria-hidden": !0,
|
|
39
39
|
"data-icon": "check_circle",
|
|
40
40
|
fill: !0,
|
|
@@ -42,22 +42,24 @@ var u = 64, p = 6, w = 72, z = 3, F = [
|
|
|
42
42
|
size: 16,
|
|
43
43
|
sx: { color: "success.700" }
|
|
44
44
|
}),
|
|
45
|
-
label:
|
|
45
|
+
label: u,
|
|
46
46
|
sx: o.kind === "single" ? void 0 : {
|
|
47
47
|
alignSelf: "stretch",
|
|
48
48
|
justifyContent: "center"
|
|
49
49
|
}
|
|
50
50
|
}) : void 0;
|
|
51
51
|
if (o.kind !== "single") {
|
|
52
|
-
const c =
|
|
53
|
-
|
|
52
|
+
const c = D(n(t, "logos"));
|
|
53
|
+
if (o.kind === "ranked" && c.length) return /* @__PURE__ */ e(B, {
|
|
54
54
|
background: o.background,
|
|
55
55
|
fullBleed: !0,
|
|
56
|
-
logos: k(c.slice(0,
|
|
57
|
-
overlap:
|
|
58
|
-
rankOffsets:
|
|
56
|
+
logos: k(c.slice(0, F), w),
|
|
57
|
+
overlap: b,
|
|
58
|
+
rankOffsets: G,
|
|
59
59
|
ranked: !0
|
|
60
|
-
})
|
|
60
|
+
});
|
|
61
|
+
const v = o.logo?.size ?? p;
|
|
62
|
+
return /* @__PURE__ */ e(V, {
|
|
61
63
|
sx: {
|
|
62
64
|
background: o.background,
|
|
63
65
|
bgcolor: o.background ? void 0 : o.bgcolor,
|
|
@@ -65,47 +67,48 @@ var u = 64, p = 6, w = 72, z = 3, F = [
|
|
|
65
67
|
width: "100%"
|
|
66
68
|
},
|
|
67
69
|
children: /* @__PURE__ */ e(N, {
|
|
68
|
-
borderColor: null,
|
|
69
|
-
logos: k(c,
|
|
70
|
-
|
|
70
|
+
borderColor: o.logo?.borderColor ?? null,
|
|
71
|
+
logos: k(c, v),
|
|
72
|
+
offsets: o.cascade?.offsets,
|
|
73
|
+
overlap: o.cascade?.overlap ?? b,
|
|
71
74
|
shadow: "elevation",
|
|
72
|
-
size:
|
|
73
|
-
status:
|
|
75
|
+
size: v,
|
|
76
|
+
status: m
|
|
74
77
|
})
|
|
75
78
|
});
|
|
76
79
|
}
|
|
77
80
|
const l = i(n(t, "primary_text")) || i(d(r, "merchant_name"));
|
|
78
81
|
if (!l) return null;
|
|
79
|
-
const s =
|
|
82
|
+
const s = y(d(r, "amount")), S = i(n(t, "header_text")) || i(n(t, "date")), f = g(n(t, "logo")) ?? g({
|
|
80
83
|
alt: l,
|
|
81
84
|
fallback_guid: r.category_guid,
|
|
82
85
|
guid: r.merchant_guid
|
|
83
|
-
}),
|
|
86
|
+
}), h = o.logo?.size ?? p;
|
|
84
87
|
return /* @__PURE__ */ e(M, {
|
|
85
|
-
amount: s !== void 0 && s !== 0 ?
|
|
88
|
+
amount: s !== void 0 && s !== 0 ? x(s, O.cents) : void 0,
|
|
86
89
|
amountPill: o.amountPill,
|
|
87
90
|
amountVariant: o.amountVariant,
|
|
88
91
|
background: o.background,
|
|
89
92
|
bgcolor: o.bgcolor,
|
|
90
93
|
borderColor: o.borderColor,
|
|
91
|
-
eyebrow: o.hideDate ? void 0 :
|
|
94
|
+
eyebrow: o.hideDate ? void 0 : S,
|
|
92
95
|
fullBleed: o.fullBleed,
|
|
93
96
|
gap: o.gap,
|
|
94
|
-
logo:
|
|
95
|
-
logo:
|
|
96
|
-
size:
|
|
97
|
-
}) :
|
|
97
|
+
logo: f ? /* @__PURE__ */ e(_, {
|
|
98
|
+
logo: f,
|
|
99
|
+
size: h
|
|
100
|
+
}) : L,
|
|
98
101
|
logoBorderColor: o.logo?.borderColor,
|
|
99
102
|
logoRadius: o.logo?.radius,
|
|
100
103
|
logoShadow: o.logo?.shadow,
|
|
101
|
-
logoSize:
|
|
104
|
+
logoSize: h,
|
|
102
105
|
name: l,
|
|
103
106
|
nameVariant: o.nameVariant,
|
|
104
|
-
trailing:
|
|
107
|
+
trailing: m
|
|
105
108
|
});
|
|
106
109
|
};
|
|
107
110
|
export {
|
|
108
|
-
|
|
111
|
+
ro as default
|
|
109
112
|
};
|
|
110
113
|
|
|
111
114
|
//# sourceMappingURL=MerchantBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MerchantBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport type { MerchantBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoClusterCard from '../../../components/LogoClusterCard'\nimport LogoFromGuid, { isLogoGuid } from '../../../components/LogoFromGuid'\nimport MerchantHighlightCard from '../../../components/MerchantHighlightCard'\nimport P2PLogoStack from '../../../components/P2PLogoStack'\nimport StatusPill from '../../../components/StatusPill'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText, slotOrFlat } from '../../slotReaders'\n\nimport { MERCHANT_LAYOUT, merchantBlockVariant } from './layout'\n\ninterface MerchantBlockProps {\n payload: InsightsPayload\n}\n\nconst LOGO_SIZE = 64\nconst LOGO_OVERLAP = 6\nconst RANKED_LOGO_SIZE = 72\nconst RANKED_MAX = 3\nconst RANKED_OFFSETS = [10, 20, 35] as const\nconst FALLBACK_ICON_SIZE = 32\n\n/** A logo ref naming a known logo guid, else undefined, so an unusable one falls through. */\nconst asMerchantLogo = (value: unknown): LogoRef | undefined => {\n const ref = asLogoRef(value)\n return ref?.guid && isLogoGuid(ref.guid) ? ref : undefined\n}\n\nconst uniqueLogos = (refs: unknown): LogoRef[] => {\n if (!Array.isArray(refs)) return []\n const byGuid = new Map<string, LogoRef>()\n for (const ref of refs.map(asMerchantLogo)) {\n if (ref?.guid && !byGuid.has(ref.guid)) byGuid.set(ref.guid, ref)\n }\n return [...byGuid.values()]\n}\n\nconst storefront = (\n <Icon\n aria-hidden={true}\n data-icon=\"storefront\"\n name=\"storefront\"\n size={FALLBACK_ICON_SIZE}\n sx={{ color: 'text.secondary' }}\n />\n)\n\nconst logoTiles = (refs: LogoRef[], size: number) =>\n refs.length\n ? refs.map((ref) => <LogoFromGuid key={ref.guid} logo={ref} size={size} />)\n : [storefront]\n\nconst MerchantBlock = ({ payload }: MerchantBlockProps) => {\n const { instance_slot } = payload\n const { data } = instance_slot\n const config = resolveVariantConfig(\n MERCHANT_LAYOUT,\n instance_slot.variant,\n merchantBlockVariant.SingleStandard,\n 'MerchantBlock',\n )\n const statusText = asText(slotOrFlat(instance_slot, 'status_text'))\n const statusPill =\n config.status && statusText ? (\n <StatusPill\n icon={\n <Icon\n aria-hidden={true}\n data-icon=\"check_circle\"\n fill={true}\n name=\"check_circle\"\n size={16}\n sx={{ color: 'success.700' }}\n />\n }\n label={statusText}\n sx={\n config.kind === 'single' ? undefined : { alignSelf: 'stretch', justifyContent: 'center' }\n }\n />\n ) : undefined\n\n if (config.kind !== 'single') {\n const logos = uniqueLogos(slot<MerchantBlockData['logos']>(data, 'logos'))\n\n if (config.kind === 'ranked' && logos.length) {\n return (\n <LogoClusterCard\n background={config.background}\n fullBleed={true}\n logos={logoTiles(logos.slice(0, RANKED_MAX), RANKED_LOGO_SIZE)}\n overlap={LOGO_OVERLAP}\n rankOffsets={RANKED_OFFSETS}\n ranked={true}\n />\n )\n }\n\n return (\n <Stack\n sx={{\n background: config.background,\n bgcolor: config.background ? undefined : config.bgcolor,\n p: 16,\n width: '100%',\n }}\n >\n <P2PLogoStack\n borderColor={null}\n logos={logoTiles(logos,
|
|
1
|
+
{"version":3,"file":"MerchantBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport type { MerchantBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoClusterCard from '../../../components/LogoClusterCard'\nimport LogoFromGuid, { isLogoGuid } from '../../../components/LogoFromGuid'\nimport MerchantHighlightCard from '../../../components/MerchantHighlightCard'\nimport P2PLogoStack from '../../../components/P2PLogoStack'\nimport StatusPill from '../../../components/StatusPill'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText, slotOrFlat } from '../../slotReaders'\n\nimport { MERCHANT_LAYOUT, merchantBlockVariant } from './layout'\n\ninterface MerchantBlockProps {\n payload: InsightsPayload\n}\n\nconst LOGO_SIZE = 64\nconst LOGO_OVERLAP = 6\nconst RANKED_LOGO_SIZE = 72\nconst RANKED_MAX = 3\nconst RANKED_OFFSETS = [10, 20, 35] as const\nconst FALLBACK_ICON_SIZE = 32\n\n/** A logo ref naming a known logo guid, else undefined, so an unusable one falls through. */\nconst asMerchantLogo = (value: unknown): LogoRef | undefined => {\n const ref = asLogoRef(value)\n return ref?.guid && isLogoGuid(ref.guid) ? ref : undefined\n}\n\nconst uniqueLogos = (refs: unknown): LogoRef[] => {\n if (!Array.isArray(refs)) return []\n const byGuid = new Map<string, LogoRef>()\n for (const ref of refs.map(asMerchantLogo)) {\n if (ref?.guid && !byGuid.has(ref.guid)) byGuid.set(ref.guid, ref)\n }\n return [...byGuid.values()]\n}\n\nconst storefront = (\n <Icon\n aria-hidden={true}\n data-icon=\"storefront\"\n name=\"storefront\"\n size={FALLBACK_ICON_SIZE}\n sx={{ color: 'text.secondary' }}\n />\n)\n\nconst logoTiles = (refs: LogoRef[], size: number) =>\n refs.length\n ? refs.map((ref) => <LogoFromGuid key={ref.guid} logo={ref} size={size} />)\n : [storefront]\n\nconst MerchantBlock = ({ payload }: MerchantBlockProps) => {\n const { instance_slot } = payload\n const { data } = instance_slot\n const config = resolveVariantConfig(\n MERCHANT_LAYOUT,\n instance_slot.variant,\n merchantBlockVariant.SingleStandard,\n 'MerchantBlock',\n )\n const statusText = asText(slotOrFlat(instance_slot, 'status_text'))\n const statusPill =\n config.status && statusText ? (\n <StatusPill\n icon={\n <Icon\n aria-hidden={true}\n data-icon=\"check_circle\"\n fill={true}\n name=\"check_circle\"\n size={16}\n sx={{ color: 'success.700' }}\n />\n }\n label={statusText}\n sx={\n config.kind === 'single' ? undefined : { alignSelf: 'stretch', justifyContent: 'center' }\n }\n />\n ) : undefined\n\n if (config.kind !== 'single') {\n const logos = uniqueLogos(slot<MerchantBlockData['logos']>(data, 'logos'))\n\n if (config.kind === 'ranked' && logos.length) {\n return (\n <LogoClusterCard\n background={config.background}\n fullBleed={true}\n logos={logoTiles(logos.slice(0, RANKED_MAX), RANKED_LOGO_SIZE)}\n overlap={LOGO_OVERLAP}\n rankOffsets={RANKED_OFFSETS}\n ranked={true}\n />\n )\n }\n\n const cascadeSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <Stack\n sx={{\n background: config.background,\n bgcolor: config.background ? undefined : config.bgcolor,\n p: 16,\n width: '100%',\n }}\n >\n <P2PLogoStack\n borderColor={config.logo?.borderColor ?? null}\n logos={logoTiles(logos, cascadeSize)}\n offsets={config.cascade?.offsets}\n overlap={config.cascade?.overlap ?? LOGO_OVERLAP}\n shadow=\"elevation\"\n size={cascadeSize}\n status={statusPill}\n />\n </Stack>\n )\n }\n\n // ditto's slot names first.\n const merchantName =\n asText(slot(data, 'primary_text')) || asText(slotOrFlat(instance_slot, 'merchant_name'))\n if (!merchantName) return null\n\n const amount = asNumber(slotOrFlat(instance_slot, 'amount'))\n const date = asText(slot(data, 'header_text')) || asText(slot(data, 'date'))\n const logo =\n asMerchantLogo(slot<unknown>(data, 'logo')) ??\n asMerchantLogo({\n alt: merchantName,\n fallback_guid: instance_slot.category_guid,\n guid: instance_slot.merchant_guid,\n })\n const logoSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <MerchantHighlightCard\n amount={\n amount !== undefined && amount !== 0\n ? formatCurrency(amount, CURRENCY_FORMAT.cents)\n : undefined\n }\n amountPill={config.amountPill}\n amountVariant={config.amountVariant}\n background={config.background}\n bgcolor={config.bgcolor}\n borderColor={config.borderColor}\n eyebrow={config.hideDate ? undefined : date}\n fullBleed={config.fullBleed}\n gap={config.gap}\n logo={logo ? <LogoFromGuid logo={logo} size={logoSize} /> : storefront}\n logoBorderColor={config.logo?.borderColor}\n logoRadius={config.logo?.radius}\n logoShadow={config.logo?.shadow}\n logoSize={logoSize}\n name={merchantName}\n nameVariant={config.nameVariant}\n trailing={statusPill}\n />\n )\n}\n\nexport default MerchantBlock\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,IAAY,IACZ,IAAe,GACf,IAAmB,IACnB,IAAa,GACb,IAAiB;AAAA,EAAC;AAAA,EAAI;AAAA,EAAI;AAAE,GAC5B,IAAqB,IAGrB,IAAA,CAAkB,MAAwC;AAC9D,QAA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SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QACE,MAAW,UAAa,MAAW,IAC/B,EAAe,GAAQ,EAAgB,KAAK,IAC5C;AAAA,IAEN,YAAY,EAAO;AAAA,IACnB,eAAe,EAAO;AAAA,IACtB,YAAY,EAAO;AAAA,IACnB,SAAS,EAAO;AAAA,IAChB,aAAa,EAAO;AAAA,IACpB,SAAS,EAAO,WAAW,SAAY;AAAA,IACvC,WAAW,EAAO;AAAA,IAClB,KAAK,EAAO;AAAA,IACZ,MAAM,IAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAW,CAAA,IAAI;AAAA,IAC5D,iBAAiB,EAAO,MAAM;AAAA,IAC9B,YAAY,EAAO,MAAM;AAAA,IACzB,YAAY,EAAO,MAAM;AAAA,IACf,UAAA;AAAA,IACV,MAAM;AAAA,IACN,aAAa,EAAO;AAAA,IACpB,UAAU;AAAA,EACX,CAAA;AAEL"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CascadeOffsets } from '../../../components/P2PLogoStack';
|
|
1
2
|
import { AmountPillProps } from '../../../components/AmountPill';
|
|
2
3
|
/** ditto declares only `highlight` today. */
|
|
3
4
|
export declare const merchantBlockVariant: {
|
|
@@ -33,6 +34,11 @@ export interface MerchantBlockLayoutConfig {
|
|
|
33
34
|
borderColor?: string;
|
|
34
35
|
radius?: number;
|
|
35
36
|
};
|
|
37
|
+
/** Cascade only: px the tiles overlap, and each tile's drop from the top of the row per tile count. */
|
|
38
|
+
cascade?: {
|
|
39
|
+
overlap?: number;
|
|
40
|
+
offsets?: CascadeOffsets;
|
|
41
|
+
};
|
|
36
42
|
/** Draw `status_text` in a success pill. */
|
|
37
43
|
status?: boolean;
|
|
38
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WARM_LIME_ACCENT_GRADIENT as
|
|
2
|
-
var
|
|
1
|
+
import { WARM_LIME_ACCENT_GRADIENT as r, celebrateGradient as e } from "../../../components/celebrationGradients.es.js";
|
|
2
|
+
var s = {
|
|
3
3
|
Highlight: "highlight",
|
|
4
4
|
SingleStandard: "single_standard",
|
|
5
5
|
SingleSuccess: "single_success",
|
|
@@ -9,7 +9,7 @@ var r = {
|
|
|
9
9
|
MultipleSubscription: "multiple_subscription",
|
|
10
10
|
MultipleBadged: "multiple_badged"
|
|
11
11
|
}, l = { bgcolor: "secondary.lighter" }, a = {
|
|
12
|
-
background:
|
|
12
|
+
background: r,
|
|
13
13
|
status: !0
|
|
14
14
|
}, i = {
|
|
15
15
|
kind: "single",
|
|
@@ -22,7 +22,7 @@ var r = {
|
|
|
22
22
|
borderColor: "divider",
|
|
23
23
|
radius: 8
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, n = {
|
|
26
26
|
highlight: {
|
|
27
27
|
kind: "single",
|
|
28
28
|
amountVariant: "text",
|
|
@@ -61,7 +61,28 @@ var r = {
|
|
|
61
61
|
},
|
|
62
62
|
multiple_subscription: {
|
|
63
63
|
kind: "cascade",
|
|
64
|
-
background: e(200.73)
|
|
64
|
+
background: e(200.73),
|
|
65
|
+
cascade: {
|
|
66
|
+
overlap: 8,
|
|
67
|
+
offsets: {
|
|
68
|
+
2: [0, 34],
|
|
69
|
+
3: [
|
|
70
|
+
0,
|
|
71
|
+
17,
|
|
72
|
+
34
|
|
73
|
+
],
|
|
74
|
+
4: [
|
|
75
|
+
0,
|
|
76
|
+
11,
|
|
77
|
+
23,
|
|
78
|
+
34
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
logo: {
|
|
83
|
+
size: 72,
|
|
84
|
+
borderColor: "divider"
|
|
85
|
+
}
|
|
65
86
|
},
|
|
66
87
|
multiple_badged: {
|
|
67
88
|
kind: "ranked",
|
|
@@ -69,8 +90,8 @@ var r = {
|
|
|
69
90
|
}
|
|
70
91
|
};
|
|
71
92
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
93
|
+
n as MERCHANT_LAYOUT,
|
|
94
|
+
s as merchantBlockVariant
|
|
74
95
|
};
|
|
75
96
|
|
|
76
97
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.ts"],"sourcesContent":["import {\n celebrateGradient,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\nimport type { AmountPillProps } from '../../../components/AmountPill'\n\n/** ditto declares only `highlight` today. */\nexport const merchantBlockVariant = {\n Highlight: 'highlight',\n SingleStandard: 'single_standard',\n SingleSuccess: 'single_success',\n SingleSubscription: 'single_subscription',\n MultipleStandard: 'multiple_standard',\n MultipleSuccess: 'multiple_success',\n MultipleSubscription: 'multiple_subscription',\n MultipleBadged: 'multiple_badged',\n} as const\n\nexport type MerchantBlockVariant = (typeof merchantBlockVariant)[keyof typeof merchantBlockVariant]\n\nexport interface MerchantBlockLayoutConfig {\n /** Merchant card, logo cascade, or ranked logos. */\n kind: 'single' | 'cascade' | 'ranked'\n amountVariant?: 'pill' | 'text'\n /** The amount pill's horizontal padding and text weight. */\n amountPill?: Pick<AmountPillProps, 'px' | 'fontWeight'>\n /** Gap between the logo and the text column. */\n gap?: number\n /** The merchant name's type; the card defaults to h2 beside a pill. */\n nameVariant?: 'h2' | 'h3'\n /** A wash; replaces `bgcolor`. */\n background?: string\n bgcolor?: string\n borderColor?: string\n fullBleed?: boolean\n hideDate?: boolean\n logo?: { size?: number; shadow?: 'offset' | 'elevation'; borderColor?: string; radius?: number }\n /** Draw `status_text` in a success pill. */\n status?: boolean\n}\n\nconst STANDARD = { bgcolor: 'secondary.lighter' }\nconst SUCCESS = { background: WARM_LIME_ACCENT_GRADIENT, status: true }\n\n// Figma 14633:139111\nconst SINGLE: MerchantBlockLayoutConfig = {\n kind: 'single',\n amountVariant: 'pill',\n fullBleed: true,\n hideDate: true,\n logo: { size: 72, shadow: 'elevation', borderColor: 'divider', radius: 8 },\n}\n\nexport const MERCHANT_LAYOUT: Record<MerchantBlockVariant, MerchantBlockLayoutConfig> = {\n highlight: {\n kind: 'single',\n amountVariant: 'text',\n bgcolor: 'warning.lighter',\n borderColor: 'warning.light',\n },\n single_standard: { ...SINGLE, ...STANDARD },\n single_success: { ...SINGLE, ...SUCCESS },\n // Figma 1268:54330 (Single): 64 logo, 12 gap, h3 name, pill 2/10 at 400.\n single_subscription: {\n ...SINGLE,\n amountPill: { px: 10, fontWeight: 400 },\n background: celebrateGradient(232.03),\n gap: 12,\n logo: { ...SINGLE.logo, size: 64 },\n nameVariant: 'h3',\n },\n multiple_standard: { kind: 'cascade', ...STANDARD },\n multiple_success: { kind: 'cascade', ...SUCCESS },\n multiple_subscription: {
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.ts"],"sourcesContent":["import type { CascadeOffsets } from '../../../components/P2PLogoStack'\nimport {\n celebrateGradient,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\nimport type { AmountPillProps } from '../../../components/AmountPill'\n\n/** ditto declares only `highlight` today. */\nexport const merchantBlockVariant = {\n Highlight: 'highlight',\n SingleStandard: 'single_standard',\n SingleSuccess: 'single_success',\n SingleSubscription: 'single_subscription',\n MultipleStandard: 'multiple_standard',\n MultipleSuccess: 'multiple_success',\n MultipleSubscription: 'multiple_subscription',\n MultipleBadged: 'multiple_badged',\n} as const\n\nexport type MerchantBlockVariant = (typeof merchantBlockVariant)[keyof typeof merchantBlockVariant]\n\nexport interface MerchantBlockLayoutConfig {\n /** Merchant card, logo cascade, or ranked logos. */\n kind: 'single' | 'cascade' | 'ranked'\n amountVariant?: 'pill' | 'text'\n /** The amount pill's horizontal padding and text weight. */\n amountPill?: Pick<AmountPillProps, 'px' | 'fontWeight'>\n /** Gap between the logo and the text column. */\n gap?: number\n /** The merchant name's type; the card defaults to h2 beside a pill. */\n nameVariant?: 'h2' | 'h3'\n /** A wash; replaces `bgcolor`. */\n background?: string\n bgcolor?: string\n borderColor?: string\n fullBleed?: boolean\n hideDate?: boolean\n logo?: { size?: number; shadow?: 'offset' | 'elevation'; borderColor?: string; radius?: number }\n /** Cascade only: px the tiles overlap, and each tile's drop from the top of the row per tile count. */\n cascade?: { overlap?: number; offsets?: CascadeOffsets }\n /** Draw `status_text` in a success pill. */\n status?: boolean\n}\n\nconst STANDARD = { bgcolor: 'secondary.lighter' }\nconst SUCCESS = { background: WARM_LIME_ACCENT_GRADIENT, status: true }\n\n// Figma 14633:139111\nconst SINGLE: MerchantBlockLayoutConfig = {\n kind: 'single',\n amountVariant: 'pill',\n fullBleed: true,\n hideDate: true,\n logo: { size: 72, shadow: 'elevation', borderColor: 'divider', radius: 8 },\n}\n\nexport const MERCHANT_LAYOUT: Record<MerchantBlockVariant, MerchantBlockLayoutConfig> = {\n highlight: {\n kind: 'single',\n amountVariant: 'text',\n bgcolor: 'warning.lighter',\n borderColor: 'warning.light',\n },\n single_standard: { ...SINGLE, ...STANDARD },\n single_success: { ...SINGLE, ...SUCCESS },\n // Figma 1268:54330 (Single): 64 logo, 12 gap, h3 name, pill 2/10 at 400.\n single_subscription: {\n ...SINGLE,\n amountPill: { px: 10, fontWeight: 400 },\n background: celebrateGradient(232.03),\n gap: 12,\n logo: { ...SINGLE.logo, size: 64 },\n nameVariant: 'h3',\n },\n multiple_standard: { kind: 'cascade', ...STANDARD },\n multiple_success: { kind: 'cascade', ...SUCCESS },\n // Figma 1268:54330 `Logos`: 72px tiles with a divider border, 64px apart, top/centre/bottom of 106px.\n // The 2- and 4-tile staircases (not drawn in Figma) keep the shared shape over the same 34px drop.\n multiple_subscription: {\n kind: 'cascade',\n background: celebrateGradient(200.73),\n cascade: { overlap: 8, offsets: { 2: [0, 34], 3: [0, 17, 34], 4: [0, 11, 23, 34] } },\n logo: { size: 72, borderColor: 'divider' },\n },\n multiple_badged: { kind: 'ranked', background: celebr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E,SAAS;AAAA,MAAG,SAAS;AAAA,QAAE,GAAG,CAAC,GAAG,EAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,QAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,UAAI;AAAA,QAAE;AAAA,MAAE;AAAA,IAAE;AAAA,IACnF,MAAM;AAAA,MAAE,MAAM;AAAA,MAAI,aAAa;AAAA,IAAU;AAAA,EAC3C;AAAA,EACA,iBAAiB;AAAA,IAAE,MAAM;AAAA,IAAU,YAAY,EAAkB,MAAM;AAAA,EAAE;AAC3E"}
|
|
@@ -16,6 +16,11 @@ interface P2PLogoStackProps {
|
|
|
16
16
|
shadow?: boolean | 'offset' | 'elevation';
|
|
17
17
|
/** Overlap px; centred, right-most tile on top. */
|
|
18
18
|
overlap?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Each tile's drop from the top of the row, keyed by rendered tile count (2, 3, or 4 incl. the "+N"
|
|
21
|
+
* tile), like `MT_OFFSETS`; a count it doesn't name keeps the shared cascade.
|
|
22
|
+
*/
|
|
23
|
+
offsets?: CascadeOffsets;
|
|
19
24
|
/**
|
|
20
25
|
* Fixed height of the cascading row in px (Figma `Logos` frame: 106). Gives
|
|
21
26
|
* the staircase `mt` offsets room without collapsing.
|
|
@@ -29,10 +34,11 @@ interface P2PLogoStackProps {
|
|
|
29
34
|
status?: ReactNode;
|
|
30
35
|
sx?: SxProps;
|
|
31
36
|
}
|
|
37
|
+
export type CascadeOffsets = Partial<Record<2 | 3 | 4, number[]>>;
|
|
32
38
|
/**
|
|
33
39
|
* A cascading row of shadowed brand tiles with an optional "+N" overflow tile
|
|
34
40
|
* (Peer-to-Peer Categorization). Layout math ported locally from v1
|
|
35
41
|
* `shared/P2P/P2PMultipleCategorization`.
|
|
36
42
|
*/
|
|
37
|
-
declare const P2PLogoStack: ({ logos, borderColor, overlap, rowHeight, shadow, size, status, total, sx, }: P2PLogoStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
declare const P2PLogoStack: ({ logos, borderColor, offsets: offsetsOverride, overlap, rowHeight, shadow, size, status, total, sx, }: P2PLogoStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
44
|
export default P2PLogoStack;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Text as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
1
|
+
import b from "./LogoTile.es.js";
|
|
2
|
+
import h from "@mui/material/Stack";
|
|
3
|
+
import { Text as j } from "@mxenabled/mxui";
|
|
4
|
+
import { jsx as y, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
var C = {
|
|
6
6
|
2: [0, 36],
|
|
7
7
|
3: [
|
|
8
8
|
0,
|
|
@@ -15,49 +15,49 @@ var j = {
|
|
|
15
15
|
24,
|
|
16
16
|
36
|
|
17
17
|
]
|
|
18
|
-
},
|
|
19
|
-
const o =
|
|
20
|
-
bgcolor:
|
|
21
|
-
borderColor:
|
|
22
|
-
reserveShadowSpace: t ===
|
|
23
|
-
shadow:
|
|
24
|
-
size:
|
|
18
|
+
}, O = ({ logos: n, borderColor: m = "background.paper", offsets: f, overlap: c, rowHeight: g = 106, shadow: x = !0, size: u = 64, status: d, total: v, sx: S }) => {
|
|
19
|
+
const o = c != null, a = v ?? n.length, e = a >= 4, r = e ? n.slice(0, 3) : n.slice(0, 4), l = e ? 4 : Math.min(Math.max(r.length, 2), 3), w = f?.[l] ?? C[l], T = e ? r.length + 1 : r.length, p = (s, t, k) => /* @__PURE__ */ y(b, {
|
|
20
|
+
bgcolor: k,
|
|
21
|
+
borderColor: m,
|
|
22
|
+
reserveShadowSpace: t === T - 1,
|
|
23
|
+
shadow: x,
|
|
24
|
+
size: u,
|
|
25
25
|
sx: {
|
|
26
|
-
mt: `${
|
|
26
|
+
mt: `${w?.[t] ?? 0}px`,
|
|
27
27
|
...o && {
|
|
28
|
-
ml: t ? `-${
|
|
28
|
+
ml: t ? `-${c}px` : 0,
|
|
29
29
|
position: "relative",
|
|
30
30
|
zIndex: t + 1
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
children:
|
|
33
|
+
children: s
|
|
34
34
|
}, t);
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ i(h, {
|
|
36
36
|
sx: {
|
|
37
37
|
gap: 12,
|
|
38
38
|
width: "100%",
|
|
39
|
-
...
|
|
39
|
+
...S
|
|
40
40
|
},
|
|
41
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ i(h, {
|
|
42
42
|
sx: {
|
|
43
43
|
flexDirection: "row",
|
|
44
44
|
gap: o ? 0 : e ? 8 : 24,
|
|
45
|
-
height:
|
|
45
|
+
height: g,
|
|
46
46
|
isolation: o ? "isolate" : void 0,
|
|
47
47
|
justifyContent: o || !e ? "center" : "flex-start"
|
|
48
48
|
},
|
|
49
|
-
children: [r.map((
|
|
49
|
+
children: [r.map((s, t) => p(s, t, "background.paper")), e && p(/* @__PURE__ */ i(j, {
|
|
50
50
|
"aria-label": `+${a - 3} more`,
|
|
51
51
|
component: "span",
|
|
52
52
|
sx: { color: "common.white" },
|
|
53
53
|
variant: "h3",
|
|
54
54
|
children: ["+", a - 3]
|
|
55
55
|
}), 3, "grey.800")]
|
|
56
|
-
}),
|
|
56
|
+
}), d]
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
export {
|
|
60
|
-
|
|
60
|
+
O as default
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
//# sourceMappingURL=P2PLogoStack.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"P2PLogoStack.es.js","names":[],"sources":["../../../src/insights-v2/components/P2PLogoStack.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport LogoTile from './LogoTile'\n\ninterface P2PLogoStackProps {\n /** Brand/merchant logo visuals (rendered as shadowed, cascading tiles). */\n logos: ReactNode[]\n /**\n * Total number of merchants. When it exceeds the rendered logos, the last\n * tile becomes a \"+N\" more indicator. Defaults to `logos.length`.\n */\n total?: number\n /** Tile border token; `null` draws none. */\n borderColor?: string | null\n /** Logo tile size in px (Figma: 64). */\n size?: number\n /** Tile shadow (see `LogoTile`). Default offset. */\n shadow?: boolean | 'offset' | 'elevation'\n /** Overlap px; centred, right-most tile on top. */\n overlap?: number\n /**\n * Fixed height of the cascading row in px (Figma `Logos` frame: 106). Gives\n * the staircase `mt` offsets room without collapsing.\n */\n rowHeight?: number\n /**\n * Optional status element rendered below the logos (Figma: the full-width\n * \"Categorized\" `<StatusPill>` in P2P's categorized state). Pass a\n * `<StatusPill sx={{ alignSelf: 'stretch', justifyContent: 'center' }} />`.\n */\n status?: ReactNode\n sx?: SxProps\n}\n\n// Vertical offsets that produce the diagonal cascade, keyed by tile count.\n// Mirrors the shared P2PMultipleCategorization layout.\nconst MT_OFFSETS: Record<
|
|
1
|
+
{"version":3,"file":"P2PLogoStack.es.js","names":[],"sources":["../../../src/insights-v2/components/P2PLogoStack.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport LogoTile from './LogoTile'\n\ninterface P2PLogoStackProps {\n /** Brand/merchant logo visuals (rendered as shadowed, cascading tiles). */\n logos: ReactNode[]\n /**\n * Total number of merchants. When it exceeds the rendered logos, the last\n * tile becomes a \"+N\" more indicator. Defaults to `logos.length`.\n */\n total?: number\n /** Tile border token; `null` draws none. */\n borderColor?: string | null\n /** Logo tile size in px (Figma: 64). */\n size?: number\n /** Tile shadow (see `LogoTile`). Default offset. */\n shadow?: boolean | 'offset' | 'elevation'\n /** Overlap px; centred, right-most tile on top. */\n overlap?: number\n /**\n * Each tile's drop from the top of the row, keyed by rendered tile count (2, 3, or 4 incl. the \"+N\"\n * tile), like `MT_OFFSETS`; a count it doesn't name keeps the shared cascade.\n */\n offsets?: CascadeOffsets\n /**\n * Fixed height of the cascading row in px (Figma `Logos` frame: 106). Gives\n * the staircase `mt` offsets room without collapsing.\n */\n rowHeight?: number\n /**\n * Optional status element rendered below the logos (Figma: the full-width\n * \"Categorized\" `<StatusPill>` in P2P's categorized state). Pass a\n * `<StatusPill sx={{ alignSelf: 'stretch', justifyContent: 'center' }} />`.\n */\n status?: ReactNode\n sx?: SxProps\n}\n\nexport type CascadeOffsets = Partial<Record<2 | 3 | 4, number[]>>\n\n// Vertical offsets that produce the diagonal cascade, keyed by tile count.\n// Mirrors the shared P2PMultipleCategorization layout.\nconst MT_OFFSETS: Record<2 | 3 | 4, number[]> = {\n 2: [0, 36],\n 3: [0, 18, 36],\n 4: [0, 12, 24, 36],\n}\n\n/**\n * A cascading row of shadowed brand tiles with an optional \"+N\" overflow tile\n * (Peer-to-Peer Categorization). Layout math ported locally from v1\n * `shared/P2P/P2PMultipleCategorization`.\n */\nconst P2PLogoStack = ({\n logos,\n borderColor = 'background.paper',\n offsets: offsetsOverride,\n overlap,\n rowHeight = 106,\n shadow = true,\n size = 64,\n status,\n total,\n sx,\n}: P2PLogoStackProps) => {\n const overlapping = overlap != null\n const merchantCount = total ?? logos.length\n // At 4+ merchants Figma shows 3 logos + a \"+N\" overflow tile (so exactly 4\n // renders as 3 + \"+1\"); below 4, all logos show. Mirrors v1.\n const hasOverflow = merchantCount >= 4\n const tiles = hasOverflow ? logos.slice(0, 3) : logos.slice(0, 4)\n const offsetKey = (hasOverflow ? 4 : Math.min(Math.max(tiles.length, 2), 3)) as 2 | 3 | 4\n const offsets = offsetsOverride?.[offsetKey] ?? MT_OFFSETS[offsetKey]\n // Total tiles actually rendered (logos, or 3 logos + the \"+N\" tile).\n const tileCount = hasOverflow ? tiles.length + 1 : tiles.length\n\n // The offset shadow takes no layout space, so interior tiles' shadows fall in\n // the row `gap`; only the LAST tile reserves its shadow footprint, else it\n // overlaps the card padding. (Index key is fine: the list is static.)\n const renderTile = (content: ReactNode, index: number, bgcolor: string) => (\n <LogoTile\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n bgcolor={bgcolor}\n borderColor={borderColor}\n reserveShadowSpace={index === tileCount - 1}\n shadow={shadow}\n size={size}\n sx={{\n mt: `${offsets?.[index] ?? 0}px`,\n ...(overlapping && {\n ml: index ? `-${overlap}px` : 0,\n position: 'relative',\n zIndex: index + 1,\n }),\n }}\n >\n {content}\n </LogoTile>\n )\n\n return (\n <Stack sx={{ gap: 12, width: '100%', ...sx }}>\n {/* Fixed-height row gives the `mt` staircase room to cascade. */}\n <Stack\n sx={{\n flexDirection: 'row',\n gap: overlapping ? 0 : hasOverflow ? 8 : 24,\n height: rowHeight,\n // Contain the overlap z-indexes.\n isolation: overlapping ? 'isolate' : undefined,\n justifyContent: overlapping || !hasOverflow ? 'center' : 'flex-start',\n }}\n >\n {tiles.map((logo, index) => renderTile(logo, index, 'background.paper'))}\n {hasOverflow &&\n renderTile(\n // h3-sized span, not a semantic heading, inside a decorative tile.\n <Text\n aria-label={`+${merchantCount - 3} more`}\n component=\"span\"\n sx={{ color: 'common.white' }}\n variant=\"h3\"\n >\n +{merchantCount - 3}\n </Text>,\n 3,\n 'grey.800',\n )}\n </Stack>\n {status}\n </Stack>\n )\n}\n\nexport default P2PLogoStack\n"],"mappings":";;;;AAgDA,IAAM,IAA0C;AAAA,EAC9C,GAAG,CAAC,GAAG,EAAE;AAAA,EACT,GAAG;AAAA,IAAC;AAAA,IAAG;AAAA,IAAI;AAAA,EAAE;AAAA,EACb,GAAG;AAAA,IAAC;AAAA,IAAG;AAAA,IAAI;AAAA,IAAI;AAAA,EAAE;AACnB,GAOM,IAAA,CAAgB,EACpB,OAAA,GACA,aAAA,IAAc,oBACd,SAAS,GACT,SAAA,GACA,WAAA,IAAY,KACZ,QAAA,IAAS,IACT,MAAA,IAAO,IACP,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