@linktr.ee/messaging-react 3.31.2 → 3.32.0-rc-1786001289
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/{Card-CF1TZXD5.cjs → Card-CFhwCGD9.cjs} +2 -2
- package/dist/{Card-CF1TZXD5.cjs.map → Card-CFhwCGD9.cjs.map} +1 -1
- package/dist/{Card-CqYFVF6m.js → Card-DPKAKVEP.js} +2 -2
- package/dist/{Card-CqYFVF6m.js.map → Card-DPKAKVEP.js.map} +1 -1
- package/dist/{index-Ct_Jgy8P.cjs → index-C0SNOT_0.cjs} +2 -2
- package/dist/index-C0SNOT_0.cjs.map +1 -0
- package/dist/{index-ilHx7pIO.js → index-KC2xnb1K.js} +166 -160
- package/dist/index-KC2xnb1K.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/LinkAttachment/LinkAttachment.stories.tsx +81 -0
- package/src/components/LinkAttachment/LinkAttachment.test.tsx +26 -0
- package/src/components/LinkAttachment/components/_shared/CardCta.tsx +20 -4
- package/src/components/LinkAttachment/types.ts +11 -0
- package/dist/index-Ct_Jgy8P.cjs.map +0 -1
- package/dist/index-ilHx7pIO.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C0SNOT_0.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageBubble=e.MessageBubble;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.optimizeMessagingAttachmentUrl=e.optimizeMessagingAttachmentUrl;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -748,6 +748,17 @@ export declare interface LinkAttachmentCta {
|
|
|
748
748
|
href?: string;
|
|
749
749
|
/** When set, called on click (in addition to `href` navigation if provided). */
|
|
750
750
|
onClick?: () => void;
|
|
751
|
+
/**
|
|
752
|
+
* Visual emphasis of the CTA button. Defaults to `'primary'` (the filled
|
|
753
|
+
* dark button), so existing callers are unaffected. `'secondary'` renders
|
|
754
|
+
* the subtle/grey button. Orthogonal to the card's sent/received `variant`
|
|
755
|
+
* (which controls bubble side, not button emphasis).
|
|
756
|
+
*
|
|
757
|
+
* NOTE: this is the presentational half only. The wire-format value should
|
|
758
|
+
* ride the shared interactive-surfaces action contract (the `InteractiveAction`
|
|
759
|
+
* shape), not be re-invented per surface.
|
|
760
|
+
*/
|
|
761
|
+
variant?: 'primary' | 'secondary';
|
|
751
762
|
}
|
|
752
763
|
|
|
753
764
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-
|
|
1
|
+
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as p, m as d, n as v, p as C, q as A, s as k, t as F, u as b, v as P, w as f, x, o as y, y as z, z as B, B as S, D as q, E as D, G as E, H as V, I as w } from "./index-KC2xnb1K.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ActionButton,
|
|
4
4
|
t as Avatar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.32.0-rc-1786001289",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@linktr.ee/component-library": "11.8.6",
|
|
53
|
-
"@linktr.ee/messaging-core": "
|
|
53
|
+
"@linktr.ee/messaging-core": "2.4.0-rc-1786001289",
|
|
54
54
|
"@linktr.ee/messaging-taxonomy": "^0.5.1",
|
|
55
55
|
"@phosphor-icons/react": "^2.1.10"
|
|
56
56
|
},
|
|
@@ -262,6 +262,87 @@ const ACCENT_CARD = {
|
|
|
262
262
|
thumbnailUrl: IMAGE_THUMBNAIL,
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
/**
|
|
266
|
+
* CTA emphasis — `cta.variant`. `primary` (default) is the filled button;
|
|
267
|
+
* `secondary` is the subtle/grey button used by the official-channel cards.
|
|
268
|
+
* Shown on both surfaces, and over an accent-derived chin: the translucent
|
|
269
|
+
* `secondary` fills (`bg-white/15`, `bg-black/[0.06]`) composite against the
|
|
270
|
+
* extracted colour, whereas the opaque `primary` fill is accent-independent —
|
|
271
|
+
* the bottom rows are the Chromatic guard for that legibility difference.
|
|
272
|
+
*/
|
|
273
|
+
export const CtaEmphasis: StoryFn = () => {
|
|
274
|
+
const cta = (label: string, variant?: 'primary' | 'secondary') => ({
|
|
275
|
+
label,
|
|
276
|
+
onClick: () => alert(`Tapped ${label}`),
|
|
277
|
+
...(variant ? { variant } : {}),
|
|
278
|
+
})
|
|
279
|
+
return (
|
|
280
|
+
<Table>
|
|
281
|
+
<TableHead columns={['primary (default)', 'secondary']} />
|
|
282
|
+
<tbody>
|
|
283
|
+
<tr>
|
|
284
|
+
<RowLabel>Received (light)</RowLabel>
|
|
285
|
+
<td className="align-top">
|
|
286
|
+
<LinkAttachment.Received {...ACCENT_CARD} cta={cta('Add now')} />
|
|
287
|
+
</td>
|
|
288
|
+
<td className="align-top">
|
|
289
|
+
<LinkAttachment.Received
|
|
290
|
+
{...ACCENT_CARD}
|
|
291
|
+
cta={cta('Add now', 'secondary')}
|
|
292
|
+
/>
|
|
293
|
+
</td>
|
|
294
|
+
</tr>
|
|
295
|
+
<tr>
|
|
296
|
+
<RowLabel>Sent (dark)</RowLabel>
|
|
297
|
+
<td className="align-top">
|
|
298
|
+
<LinkAttachment.Sent {...ACCENT_CARD} cta={cta('Add now')} />
|
|
299
|
+
</td>
|
|
300
|
+
<td className="align-top">
|
|
301
|
+
<LinkAttachment.Sent
|
|
302
|
+
{...ACCENT_CARD}
|
|
303
|
+
cta={cta('Add now', 'secondary')}
|
|
304
|
+
/>
|
|
305
|
+
</td>
|
|
306
|
+
</tr>
|
|
307
|
+
<tr>
|
|
308
|
+
<RowLabel>Received + accent chin</RowLabel>
|
|
309
|
+
<td className="align-top">
|
|
310
|
+
<LinkAttachment.Received
|
|
311
|
+
{...ACCENT_CARD}
|
|
312
|
+
accentColor="#7008E7"
|
|
313
|
+
cta={cta('Add now')}
|
|
314
|
+
/>
|
|
315
|
+
</td>
|
|
316
|
+
<td className="align-top">
|
|
317
|
+
<LinkAttachment.Received
|
|
318
|
+
{...ACCENT_CARD}
|
|
319
|
+
accentColor="#7008E7"
|
|
320
|
+
cta={cta('Add now', 'secondary')}
|
|
321
|
+
/>
|
|
322
|
+
</td>
|
|
323
|
+
</tr>
|
|
324
|
+
<tr>
|
|
325
|
+
<RowLabel>Sent + accent chin</RowLabel>
|
|
326
|
+
<td className="align-top">
|
|
327
|
+
<LinkAttachment.Sent
|
|
328
|
+
{...ACCENT_CARD}
|
|
329
|
+
accentColor="#7008E7"
|
|
330
|
+
cta={cta('Add now')}
|
|
331
|
+
/>
|
|
332
|
+
</td>
|
|
333
|
+
<td className="align-top">
|
|
334
|
+
<LinkAttachment.Sent
|
|
335
|
+
{...ACCENT_CARD}
|
|
336
|
+
accentColor="#7008E7"
|
|
337
|
+
cta={cta('Add now', 'secondary')}
|
|
338
|
+
/>
|
|
339
|
+
</td>
|
|
340
|
+
</tr>
|
|
341
|
+
</tbody>
|
|
342
|
+
</Table>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
|
|
265
346
|
/**
|
|
266
347
|
* The dominant-colour card and its WCAG AA gate (MES-1349, corrected MES-1388).
|
|
267
348
|
*
|
|
@@ -57,6 +57,32 @@ describe('LinkAttachment.Received (link previews)', () => {
|
|
|
57
57
|
expect(onClick).toHaveBeenCalledTimes(1)
|
|
58
58
|
expect(ctaOnClick).toHaveBeenCalledTimes(1)
|
|
59
59
|
})
|
|
60
|
+
|
|
61
|
+
it('renders the filled (primary) CTA when cta.variant is omitted', async () => {
|
|
62
|
+
renderWithProviders(
|
|
63
|
+
<LinkAttachment.Received
|
|
64
|
+
title="Welcome"
|
|
65
|
+
description="Add a personal welcome message"
|
|
66
|
+
cta={{ label: 'Add now', onClick: vi.fn() }}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
const button = await screen.findByText('Add now')
|
|
70
|
+
expect(button.className).toContain('bg-[#121110]')
|
|
71
|
+
expect(button.className).toContain('text-white')
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('renders the subtle (secondary) CTA when cta.variant is "secondary"', async () => {
|
|
75
|
+
renderWithProviders(
|
|
76
|
+
<LinkAttachment.Received
|
|
77
|
+
title="Welcome"
|
|
78
|
+
description="Add a personal welcome message"
|
|
79
|
+
cta={{ label: 'Add now', onClick: vi.fn(), variant: 'secondary' }}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
const button = await screen.findByText('Add now')
|
|
83
|
+
expect(button.className).toContain('bg-black/[0.06]')
|
|
84
|
+
expect(button.className).toContain('text-[#121110]')
|
|
85
|
+
})
|
|
60
86
|
})
|
|
61
87
|
|
|
62
88
|
describe('LinkAttachment.Sent', () => {
|
|
@@ -11,9 +11,24 @@ export interface CardCtaProps {
|
|
|
11
11
|
cta: LinkAttachmentCta
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
type CtaEmphasis = NonNullable<LinkAttachmentCta['variant']>
|
|
15
|
+
|
|
16
|
+
// Two axes: the bubble side (`dark` = sent chrome, `light` = received chrome)
|
|
17
|
+
// crossed with CTA emphasis (`primary` = filled, `secondary` = subtle/grey).
|
|
18
|
+
// `primary` preserves the existing filled button exactly, so callers that omit
|
|
19
|
+
// `cta.variant` are unaffected. Values are explicit rather than DS tokens: the
|
|
20
|
+
// component-library preset has no neutral button token (`primary` is brand
|
|
21
|
+
// purple), and the host preset can't retheme arbitrary hex. Align the grey with
|
|
22
|
+
// the Arbor secondary token when the shared design tokens land.
|
|
23
|
+
const BUTTON_CLASS_BY_VARIANT: Record<LinkAttachmentVariant, Record<CtaEmphasis, string>> = {
|
|
24
|
+
dark: {
|
|
25
|
+
primary: 'bg-white text-[#121110] hover:bg-white/90',
|
|
26
|
+
secondary: 'bg-white/15 text-white hover:bg-white/25',
|
|
27
|
+
},
|
|
28
|
+
light: {
|
|
29
|
+
primary: 'bg-[#121110] text-white hover:bg-[#2a2928]',
|
|
30
|
+
secondary: 'bg-black/[0.06] text-[#121110] hover:bg-black/10',
|
|
31
|
+
},
|
|
17
32
|
}
|
|
18
33
|
|
|
19
34
|
/**
|
|
@@ -23,9 +38,10 @@ const BUTTON_CLASS_BY_VARIANT: Record<LinkAttachmentVariant, string> = {
|
|
|
23
38
|
* plain `<button>`.
|
|
24
39
|
*/
|
|
25
40
|
const CardCta: React.FC<CardCtaProps> = ({ variant, cta }) => {
|
|
41
|
+
const emphasis: CtaEmphasis = cta.variant ?? 'primary'
|
|
26
42
|
const className = classNames(
|
|
27
43
|
'mt-2 inline-flex h-10 w-full items-center justify-center rounded-full px-4 text-sm font-medium leading-none transition-colors',
|
|
28
|
-
BUTTON_CLASS_BY_VARIANT[variant]
|
|
44
|
+
BUTTON_CLASS_BY_VARIANT[variant][emphasis]
|
|
29
45
|
)
|
|
30
46
|
|
|
31
47
|
// Mirror the URL normalization used by the shell anchor so bare
|
|
@@ -111,4 +111,15 @@ export interface LinkAttachmentCta {
|
|
|
111
111
|
href?: string
|
|
112
112
|
/** When set, called on click (in addition to `href` navigation if provided). */
|
|
113
113
|
onClick?: () => void
|
|
114
|
+
/**
|
|
115
|
+
* Visual emphasis of the CTA button. Defaults to `'primary'` (the filled
|
|
116
|
+
* dark button), so existing callers are unaffected. `'secondary'` renders
|
|
117
|
+
* the subtle/grey button. Orthogonal to the card's sent/received `variant`
|
|
118
|
+
* (which controls bubble side, not button emphasis).
|
|
119
|
+
*
|
|
120
|
+
* NOTE: this is the presentational half only. The wire-format value should
|
|
121
|
+
* ride the shared interactive-surfaces action contract (the `InteractiveAction`
|
|
122
|
+
* shape), not be re-invented per surface.
|
|
123
|
+
*/
|
|
124
|
+
variant?: 'primary' | 'secondary'
|
|
114
125
|
}
|