@linktr.ee/messaging-react 4.4.1-rc-1787614546 → 4.4.1-rc-1787616600
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +27 -21
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/MessageBubble/MessageBubble.stories.tsx +6 -8
- package/src/components/MessageBubble/MessageBubble.test.tsx +5 -5
- package/src/components/MessageBubble/components/_shared/BubbleShell.tsx +32 -20
- package/src/components/MessageBubble/types.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "4.4.1-rc-
|
|
3
|
+
"version": "4.4.1-rc-1787616600",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"chromatic:local": "yarn storybook:build && chromatic"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@linktr.ee/messaging-core": "2.6.0-rc-
|
|
54
|
-
"@linktr.ee/messaging-taxonomy": "0.11.0-rc-
|
|
53
|
+
"@linktr.ee/messaging-core": "2.6.0-rc-1787616600",
|
|
54
|
+
"@linktr.ee/messaging-taxonomy": "0.11.0-rc-1787616600",
|
|
55
55
|
"@phosphor-icons/react": "^2.1.10"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -26,14 +26,12 @@ const Row = ({
|
|
|
26
26
|
}) => (
|
|
27
27
|
<div>
|
|
28
28
|
<p className="mb-2 text-xs font-medium text-black/40">{label}</p>
|
|
29
|
-
<div
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div className="str-chat__message-inner">{children}</div>
|
|
36
|
-
</div>
|
|
29
|
+
<div
|
|
30
|
+
className={`str-chat__li str-chat__li--single ${
|
|
31
|
+
align === 'end' ? 'flex justify-end' : 'flex justify-start'
|
|
32
|
+
}`}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
37
35
|
</div>
|
|
38
36
|
</div>
|
|
39
37
|
)
|
|
@@ -74,14 +74,14 @@ describe('MessageBubble', () => {
|
|
|
74
74
|
expect(bubble.getAttribute('data-dd-privacy')).toBe('mask')
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
it('forwards width/className onto the
|
|
77
|
+
it('forwards width/className onto the outermost message wrapper', () => {
|
|
78
78
|
renderWithProviders(
|
|
79
79
|
<MessageBubble.Sent text="wide" className="w-fit max-w-[520px]" />
|
|
80
80
|
)
|
|
81
|
-
const
|
|
81
|
+
const message = screen
|
|
82
82
|
.getByText('wide')
|
|
83
|
-
.closest('.str-chat__message
|
|
84
|
-
expect(
|
|
85
|
-
expect(
|
|
83
|
+
.closest('.str-chat__message') as HTMLElement
|
|
84
|
+
expect(message.classList.contains('w-fit')).toBe(true)
|
|
85
|
+
expect(message.className).toContain('max-w-[520px]')
|
|
86
86
|
})
|
|
87
87
|
})
|
|
@@ -15,8 +15,8 @@ export interface BubbleShellProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* Width is caller-controlled — pass a width class in `className`
|
|
17
17
|
* (`w-fit` to hug the text for chat/preview bubbles, `w-full` to fill the
|
|
18
|
-
* container for card-like list rows).
|
|
19
|
-
*
|
|
18
|
+
* container for card-like list rows). Applied to the outermost Stream
|
|
19
|
+
* message wrapper. With no width class the bubble fills its container.
|
|
20
20
|
*/
|
|
21
21
|
className?: string
|
|
22
22
|
}
|
|
@@ -65,29 +65,41 @@ const BubbleShell: React.FC<BubbleShellProps> = ({
|
|
|
65
65
|
className,
|
|
66
66
|
}) => (
|
|
67
67
|
<div
|
|
68
|
-
data-dd-privacy="mask"
|
|
69
68
|
className={classNames(
|
|
70
|
-
'str-chat__message
|
|
71
|
-
'
|
|
72
|
-
'text-[0.875rem] leading-[1.3125rem] tracking-[0.14px]',
|
|
69
|
+
'str-chat__message',
|
|
70
|
+
variant === 'sent' ? 'str-chat__message--me' : 'str-chat__message--other',
|
|
73
71
|
className
|
|
74
72
|
)}
|
|
75
|
-
style={{
|
|
76
|
-
...SURFACE_STYLE_BY_VARIANT[variant],
|
|
77
|
-
borderRadius: 'var(--str-chat__message-bubble-border-radius, 1.5rem)',
|
|
78
|
-
isolation: 'isolate',
|
|
79
|
-
}}
|
|
80
73
|
>
|
|
81
|
-
<div className="str-chat__message-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
<div className="str-chat__message-inner">
|
|
75
|
+
<div
|
|
76
|
+
data-dd-privacy="mask"
|
|
77
|
+
className={classNames(
|
|
78
|
+
'str-chat__message-bubble',
|
|
79
|
+
'relative',
|
|
80
|
+
'text-[0.875rem] leading-[1.3125rem] tracking-[0.14px]'
|
|
81
|
+
)}
|
|
82
|
+
style={{
|
|
83
|
+
...SURFACE_STYLE_BY_VARIANT[variant],
|
|
84
|
+
borderRadius: 'var(--str-chat__message-bubble-border-radius, 1.5rem)',
|
|
85
|
+
isolation: 'isolate',
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<div className="str-chat__message-text">
|
|
89
|
+
{header != null && (
|
|
90
|
+
<div
|
|
91
|
+
className="mb-1 font-medium"
|
|
92
|
+
data-testid="message-bubble-header"
|
|
93
|
+
>
|
|
94
|
+
{header}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
<p className="m-0 whitespace-pre-wrap break-words hyphens-manual">
|
|
98
|
+
{text}
|
|
99
|
+
</p>
|
|
100
|
+
{tail && <BubbleTail variant={variant} />}
|
|
85
101
|
</div>
|
|
86
|
-
|
|
87
|
-
<p className="m-0 whitespace-pre-wrap break-words hyphens-manual">
|
|
88
|
-
{text}
|
|
89
|
-
</p>
|
|
90
|
-
{tail && <BubbleTail variant={variant} />}
|
|
102
|
+
</div>
|
|
91
103
|
</div>
|
|
92
104
|
</div>
|
|
93
105
|
)
|
|
@@ -20,10 +20,10 @@ export interface MessageBubbleBaseProps {
|
|
|
20
20
|
*/
|
|
21
21
|
tail?: boolean
|
|
22
22
|
/**
|
|
23
|
-
* Extra classes on the
|
|
24
|
-
* `w-fit` to hug the text (chat/preview) or
|
|
25
|
-
* (card-like list rows). With no width
|
|
26
|
-
* container. Also where you'd set `max-w-[…]`.
|
|
23
|
+
* Extra classes on the outermost Stream message wrapper. Width is
|
|
24
|
+
* caller-controlled: pass `w-fit` to hug the text (chat/preview) or
|
|
25
|
+
* `w-full` to fill the container (card-like list rows). With no width
|
|
26
|
+
* class the bubble fills its container. Also where you'd set `max-w-[…]`.
|
|
27
27
|
*/
|
|
28
28
|
className?: string
|
|
29
29
|
}
|