@linktr.ee/messaging-react 3.33.0-rc-1786025179 → 3.33.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.33.0
|
|
3
|
+
"version": "3.33.0",
|
|
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": "2.
|
|
53
|
+
"@linktr.ee/messaging-core": "^2.2.0",
|
|
54
54
|
"@linktr.ee/messaging-taxonomy": "^0.5.2",
|
|
55
55
|
"@phosphor-icons/react": "^2.1.10"
|
|
56
56
|
},
|
|
@@ -650,3 +650,73 @@ export const AccentDerivation: StoryFn = () => (
|
|
|
650
650
|
)
|
|
651
651
|
|
|
652
652
|
AccentDerivation.parameters = { chromatic: { disableSnapshot: false } }
|
|
653
|
+
|
|
654
|
+
/* ──────────────────────────────────────────────────────────────────
|
|
655
|
+
Description line clamp (descriptionLines)
|
|
656
|
+
────────────────────────────────────────────────────────────────── */
|
|
657
|
+
|
|
658
|
+
const CLAMP_CARD = {
|
|
659
|
+
title: 'A message from Brie Nala',
|
|
660
|
+
description:
|
|
661
|
+
'Thanks for reaching out! This is a longer prose body of the kind an official message carries — it runs past a single line and should wrap up to the clamp instead of clipping to one truncated line like a link preview.',
|
|
662
|
+
url: 'tr.ee/brienala',
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
const CLAMP_STATES = ['Received', 'Sent', 'Composer'] as const
|
|
666
|
+
|
|
667
|
+
const renderClampCard = (
|
|
668
|
+
state: (typeof CLAMP_STATES)[number],
|
|
669
|
+
descriptionLines?: number
|
|
670
|
+
) => {
|
|
671
|
+
if (state === 'Received') {
|
|
672
|
+
return (
|
|
673
|
+
<LinkAttachment.Received
|
|
674
|
+
layout="classic"
|
|
675
|
+
{...CLAMP_CARD}
|
|
676
|
+
descriptionLines={descriptionLines}
|
|
677
|
+
/>
|
|
678
|
+
)
|
|
679
|
+
}
|
|
680
|
+
if (state === 'Sent') {
|
|
681
|
+
return (
|
|
682
|
+
<LinkAttachment.Sent
|
|
683
|
+
layout="classic"
|
|
684
|
+
{...CLAMP_CARD}
|
|
685
|
+
descriptionLines={descriptionLines}
|
|
686
|
+
/>
|
|
687
|
+
)
|
|
688
|
+
}
|
|
689
|
+
return (
|
|
690
|
+
<LinkAttachment.Composer
|
|
691
|
+
layout="classic"
|
|
692
|
+
{...CLAMP_CARD}
|
|
693
|
+
descriptionLines={descriptionLines}
|
|
694
|
+
onDismiss={() => undefined}
|
|
695
|
+
/>
|
|
696
|
+
)
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* `descriptionLines` — how many lines the description body renders before it
|
|
701
|
+
* clamps. The default (`1`) keeps the single-line `truncate` link-preview
|
|
702
|
+
* behaviour; `> 1` wraps via a webkit line-clamp so prose bodies (official
|
|
703
|
+
* messages) render multi-line like the mobile card. The URL footer stays
|
|
704
|
+
* single-line regardless. Snapshot target for that split across all states.
|
|
705
|
+
*/
|
|
706
|
+
export const DescriptionLines: StoryFn = () => (
|
|
707
|
+
<Table>
|
|
708
|
+
<TableHead columns={['default (1)', '2 lines', '3 lines']} />
|
|
709
|
+
<tbody>
|
|
710
|
+
{CLAMP_STATES.map((state) => (
|
|
711
|
+
<tr key={state}>
|
|
712
|
+
<RowLabel>{state}</RowLabel>
|
|
713
|
+
<td className="align-top">{renderClampCard(state)}</td>
|
|
714
|
+
<td className="align-top">{renderClampCard(state, 2)}</td>
|
|
715
|
+
<td className="align-top">{renderClampCard(state, 3)}</td>
|
|
716
|
+
</tr>
|
|
717
|
+
))}
|
|
718
|
+
</tbody>
|
|
719
|
+
</Table>
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
DescriptionLines.parameters = { chromatic: { disableSnapshot: false } }
|
|
@@ -123,9 +123,8 @@ const CardBody: React.FC<CardBodyProps> = ({
|
|
|
123
123
|
chinTextColor == null && SECONDARY_CLASS_BY_VARIANT[variant]
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
// URL footer always stays single-line (`secondaryClass`).
|
|
126
|
+
// Single-line `truncate` at the default; >1 clamps via `descriptionStyle` below. The URL footer
|
|
127
|
+
// keeps `secondaryClass` so it always stays single-line.
|
|
129
128
|
const descriptionClass = classNames(
|
|
130
129
|
'text-[12px] leading-4 tracking-[0.24px]',
|
|
131
130
|
descriptionLines <= 1 && 'truncate',
|