@linktr.ee/messaging-react 3.5.5-rc-1782987115 → 3.5.5-rc-1783057111
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-hIM2Pu2w.js → Card-1aop9_6f.js} +3 -3
- package/dist/{Card-hIM2Pu2w.js.map → Card-1aop9_6f.js.map} +1 -1
- package/dist/{Card-rMhzAqC4.js → Card-B8TOdDxd.js} +2 -2
- package/dist/{Card-rMhzAqC4.js.map → Card-B8TOdDxd.js.map} +1 -1
- package/dist/{Card-CwENIQHI.cjs → Card-Bwy7V0Bo.cjs} +2 -2
- package/dist/{Card-CwENIQHI.cjs.map → Card-Bwy7V0Bo.cjs.map} +1 -1
- package/dist/{Card-jw-FEk_j.cjs → Card-Cy37m6vt.cjs} +2 -2
- package/dist/{Card-jw-FEk_j.cjs.map → Card-Cy37m6vt.cjs.map} +1 -1
- package/dist/{Card-B6Jplpgi.js → Card-DAk82C-r.js} +2 -2
- package/dist/{Card-B6Jplpgi.js.map → Card-DAk82C-r.js.map} +1 -1
- package/dist/{Card-CH1lN2DQ.cjs → Card-DIKCis8o.cjs} +2 -2
- package/dist/{Card-CH1lN2DQ.cjs.map → Card-DIKCis8o.cjs.map} +1 -1
- package/dist/{LockedThumbnail-C68EUgjg.js → LockedThumbnail-BnCxeG99.js} +3 -3
- package/dist/{LockedThumbnail-C68EUgjg.js.map → LockedThumbnail-BnCxeG99.js.map} +1 -1
- package/dist/{LockedThumbnail-NSvs1btu.cjs → LockedThumbnail-D5SVLnl9.cjs} +2 -2
- package/dist/{LockedThumbnail-NSvs1btu.cjs.map → LockedThumbnail-D5SVLnl9.cjs.map} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/index-OEDMXEKk.cjs +2 -0
- package/dist/index-OEDMXEKk.cjs.map +1 -0
- package/dist/{index-Bo9wjHNl.js → index-erdzinja.js} +636 -621
- package/dist/index-erdzinja.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/AttachmentCard/index.tsx +1 -1
- package/src/components/Avatar/getAvatarEmoji.test.ts +32 -0
- package/src/components/Avatar/getAvatarEmoji.ts +32 -19
- package/src/components/Avatar/index.tsx +6 -3
- package/src/components/CustomLinkPreviewList/CustomLinkPreviewCard.tsx +1 -1
- package/src/components/CustomLinkPreviewList/index.tsx +12 -6
- package/src/components/CustomMessage/MessageAttachmentConversations.stories.tsx +1 -1
- package/src/components/CustomMessage/MessageTag.stories.tsx +2 -2
- package/src/components/CustomMessageInput/index.tsx +7 -4
- package/src/components/LinkAttachment/components/_shared/CardShell.tsx +1 -1
- package/src/components/LockedAttachment/components/_shared/LockedCardShell.tsx +1 -1
- package/src/components/MediaMessage/index.tsx +1 -1
- package/src/components/MessageAttachment/_shared/Bubble.tsx +3 -3
- package/src/styles.css +6 -51
- package/dist/index-Bo9wjHNl.js.map +0 -1
- package/dist/index-Bt9H9JKb.cjs +0 -2
- package/dist/index-Bt9H9JKb.cjs.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-OEDMXEKk.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.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.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.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 d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } 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 d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-erdzinja.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.5.5-rc-
|
|
3
|
+
"version": "3.5.5-rc-1783057111",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@linktr.ee/component-library": "11.8.6",
|
|
41
|
-
"@linktr.ee/messaging-core": "2.3.0-rc-
|
|
41
|
+
"@linktr.ee/messaging-core": "2.3.0-rc-1783057111",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -57,7 +57,7 @@ const AttachmentCard: React.FC<AttachmentCardProps> = ({
|
|
|
57
57
|
data-testid={dataTestId}
|
|
58
58
|
className={classNames(
|
|
59
59
|
'relative w-[280px] select-none overflow-hidden rounded-[24px] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]',
|
|
60
|
-
isDark ? 'bg-[#
|
|
60
|
+
isDark ? 'bg-[#121110]' : 'bg-white'
|
|
61
61
|
)}
|
|
62
62
|
>
|
|
63
63
|
{topLeft ? (
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { getAvatarBgColor, getAvatarEmoji } from './getAvatarEmoji'
|
|
4
|
+
|
|
5
|
+
const emojiBgColors: Record<string, string> = {
|
|
6
|
+
'🍉': '#D6EBFF',
|
|
7
|
+
'🍎': '#FFD1DD',
|
|
8
|
+
'🍓': '#FFE0AE',
|
|
9
|
+
'🍋': '#CAEEB5',
|
|
10
|
+
'🍌': '#FFF1C9',
|
|
11
|
+
'🍇': '#E6D9FF',
|
|
12
|
+
'🍊': '#D6F4FF',
|
|
13
|
+
'🥥': '#F7E7D8',
|
|
14
|
+
'🍒': '#DFF4D8',
|
|
15
|
+
'🥭': '#FFD8C2',
|
|
16
|
+
'🥝': '#FFE7C7',
|
|
17
|
+
'🫒': '#F6E3B4',
|
|
18
|
+
'🍈': '#D9F7E1',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('getAvatarBgColor', () => {
|
|
22
|
+
it('returns the mapped color for the avatar emoji and stays consistent for the same id', () => {
|
|
23
|
+
const id = 'user-123'
|
|
24
|
+
|
|
25
|
+
const emoji = getAvatarEmoji(id)
|
|
26
|
+
const color = getAvatarBgColor(id)
|
|
27
|
+
|
|
28
|
+
expect(getAvatarEmoji(id)).toBe(emoji)
|
|
29
|
+
expect(color).toBe(emojiBgColors[emoji])
|
|
30
|
+
expect(getAvatarBgColor(id)).toBe(color)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Fruit emojis paired with their avatar background color.
|
|
3
|
+
* Single source of truth for both `getAvatarEmoji` and `getAvatarBgColor`.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
6
|
-
'🍎', // Apple
|
|
7
|
-
'🍌', // Banana
|
|
8
|
-
'🍇', // Grape
|
|
9
|
-
'🍊', // Orange
|
|
10
|
-
'🍓', // Strawberry
|
|
11
|
-
'🥥', // Coconut
|
|
12
|
-
'🍒', // Cherry
|
|
13
|
-
'🥭', // Mango
|
|
14
|
-
'🍉', // Watermelon
|
|
15
|
-
'🍋', // Lemon
|
|
16
|
-
'🥝', // Kiwi
|
|
17
|
-
'🫒', // Olive
|
|
18
|
-
'🍈', // Melon
|
|
5
|
+
const FRUITS = [
|
|
6
|
+
{ emoji: '🍎', bgColor: '#FFD1DD' }, // Apple
|
|
7
|
+
{ emoji: '🍌', bgColor: '#FFF1C9' }, // Banana
|
|
8
|
+
{ emoji: '🍇', bgColor: '#E6D9FF' }, // Grape
|
|
9
|
+
{ emoji: '🍊', bgColor: '#D6F4FF' }, // Orange
|
|
10
|
+
{ emoji: '🍓', bgColor: '#FFE0AE' }, // Strawberry
|
|
11
|
+
{ emoji: '🥥', bgColor: '#F7E7D8' }, // Coconut
|
|
12
|
+
{ emoji: '🍒', bgColor: '#DFF4D8' }, // Cherry
|
|
13
|
+
{ emoji: '🥭', bgColor: '#FFD8C2' }, // Mango
|
|
14
|
+
{ emoji: '🍉', bgColor: '#D6EBFF' }, // Watermelon
|
|
15
|
+
{ emoji: '🍋', bgColor: '#CAEEB5' }, // Lemon
|
|
16
|
+
{ emoji: '🥝', bgColor: '#FFE7C7' }, // Kiwi
|
|
17
|
+
{ emoji: '🫒', bgColor: '#F6E3B4' }, // Olive
|
|
18
|
+
{ emoji: '🍈', bgColor: '#D9F7E1' }, // Melon
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -31,14 +31,27 @@ function hashString(str: string): number {
|
|
|
31
31
|
return Math.abs(hash)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Pick a consistent fruit for an id string
|
|
36
|
+
*/
|
|
37
|
+
function getFruit(id: string) {
|
|
38
|
+
return FRUITS[hashString(id) % FRUITS.length]
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
/**
|
|
35
42
|
* Get a fruit emoji based on an id string
|
|
36
43
|
* @param id - The string id to generate emoji from
|
|
37
44
|
* @returns A fruit emoji string
|
|
38
45
|
*/
|
|
39
46
|
export function getAvatarEmoji(id: string): string {
|
|
40
|
-
|
|
41
|
-
const index = hash % EMOJIS.length
|
|
42
|
-
return EMOJIS[index]
|
|
47
|
+
return getFruit(id).emoji
|
|
43
48
|
}
|
|
44
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Get the background color paired with an id's fruit emoji
|
|
52
|
+
* @param id - The string id to generate the color from
|
|
53
|
+
* @returns A hex color string
|
|
54
|
+
*/
|
|
55
|
+
export function getAvatarBgColor(id: string): string {
|
|
56
|
+
return getFruit(id).bgColor
|
|
57
|
+
}
|
|
@@ -2,7 +2,7 @@ import { StarIcon } from '@phosphor-icons/react'
|
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
|
-
import { getAvatarEmoji } from './getAvatarEmoji'
|
|
5
|
+
import { getAvatarBgColor, getAvatarEmoji } from './getAvatarEmoji'
|
|
6
6
|
|
|
7
7
|
export interface AvatarProps {
|
|
8
8
|
id: string
|
|
@@ -28,6 +28,7 @@ export const Avatar = ({
|
|
|
28
28
|
dmAgentEnabled = false,
|
|
29
29
|
}: AvatarProps) => {
|
|
30
30
|
const emoji = getAvatarEmoji(id)
|
|
31
|
+
const bgColor = getAvatarBgColor(id)
|
|
31
32
|
|
|
32
33
|
// Small avatars scale the emoji with the avatar so it doesn't overpower a
|
|
33
34
|
// tiny circle — a fixed floor read ~60% of a 17px avatar vs ~35% at 40px.
|
|
@@ -62,7 +63,7 @@ export const Avatar = ({
|
|
|
62
63
|
<div
|
|
63
64
|
aria-hidden="true"
|
|
64
65
|
className={classNames(
|
|
65
|
-
'avatar-fallback flex h-full w-full items-center justify-center
|
|
66
|
+
'avatar-fallback flex h-full w-full items-center justify-center font-semibold select-none transition-colors'
|
|
66
67
|
)}
|
|
67
68
|
style={{ fontSize, lineHeight: 1 }}
|
|
68
69
|
>
|
|
@@ -75,13 +76,15 @@ export const Avatar = ({
|
|
|
75
76
|
return (
|
|
76
77
|
<div
|
|
77
78
|
className={classNames(
|
|
78
|
-
'relative flex-shrink-0
|
|
79
|
+
'relative flex-shrink-0',
|
|
79
80
|
className
|
|
80
81
|
)}
|
|
81
82
|
style={{
|
|
82
83
|
'--str-chat__avatar-size': `${size}px`,
|
|
83
84
|
width: `${size}px`,
|
|
84
85
|
height: `${size}px`,
|
|
86
|
+
backgroundColor: image ? undefined : bgColor,
|
|
87
|
+
...borderStyle,
|
|
85
88
|
} as React.CSSProperties}
|
|
86
89
|
>
|
|
87
90
|
{starred && (
|
|
@@ -23,7 +23,7 @@ const CustomLinkPreviewCard: React.FC<CustomLinkPreviewCardProps> = ({
|
|
|
23
23
|
href={og_scrape_url}
|
|
24
24
|
target="_blank"
|
|
25
25
|
rel="noopener noreferrer"
|
|
26
|
-
className="relative block w-full rounded-[24px] bg-[#
|
|
26
|
+
className="relative block w-full rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90"
|
|
27
27
|
>
|
|
28
28
|
{image_url && (
|
|
29
29
|
<img
|
|
@@ -32,13 +32,19 @@ export const CustomLinkPreviewList = () => {
|
|
|
32
32
|
if (!showLinkPreviews) return null
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
|
|
35
|
+
// Layout contract: this list is the composer's *shrinkable* region. The
|
|
36
|
+
// mobile visitor surface sizes itself to the keyboard-shrunk
|
|
37
|
+
// visualViewport, so when vertical space runs out this container gives
|
|
38
|
+
// way (min-h-0) and scrolls, while the textarea + send row stays visible
|
|
39
|
+
// (shrink-0 in CustomMessageInput). Each card is wrapped in a shrink-0
|
|
40
|
+
// block so it keeps its intrinsic height and the container scrolls — a
|
|
41
|
+
// bare flex-column child would be shrunk on the column axis and its
|
|
42
|
+
// fixed-height hero would spill out of the collapsed card box.
|
|
43
|
+
<div className="messaging-link-preview-list flex min-h-0 flex-col items-stretch w-full gap-2 mb-4 overflow-y-auto overscroll-contain">
|
|
36
44
|
{stateLinkPreviews.map((linkPreview) => (
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onDismiss={handleDismiss}
|
|
41
|
-
/>
|
|
45
|
+
<div key={linkPreview.og_scrape_url} className="w-full shrink-0">
|
|
46
|
+
<CustomLinkPreviewCard link={linkPreview} onDismiss={handleDismiss} />
|
|
47
|
+
</div>
|
|
42
48
|
))}
|
|
43
49
|
</div>
|
|
44
50
|
)
|
|
@@ -83,7 +83,7 @@ ChatbotReceiverText.parameters = skipInChromatic
|
|
|
83
83
|
export const ChatbotSenderText: StoryFn<ComponentProps> = (args) => {
|
|
84
84
|
return (
|
|
85
85
|
<div className="p-12">
|
|
86
|
-
<div className="bg-[#
|
|
86
|
+
<div className="bg-[#121110] rounded-[24px] px-4 py-3 w-[280px]">
|
|
87
87
|
<MessageTag {...args} />
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
@@ -150,7 +150,7 @@ export const AllVariants: StoryFn = () => {
|
|
|
150
150
|
</div>
|
|
151
151
|
<div className="flex items-center gap-4">
|
|
152
152
|
<span className="text-sm w-32">Chatbot (sender):</span>
|
|
153
|
-
<div className="bg-[#
|
|
153
|
+
<div className="bg-[#121110] rounded-[24px] px-4 py-3 w-[280px]">
|
|
154
154
|
<MessageTag
|
|
155
155
|
message={createMockMessage({
|
|
156
156
|
metadata: { custom_type: 'MESSAGE_CHATBOT' },
|
|
@@ -61,14 +61,17 @@ const CustomMessageInputInner: React.FC = () => {
|
|
|
61
61
|
} = useComponentContext('CustomMessageInput')
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
+
// min-h-0 lets the composer shrink under keyboard squeeze (the link
|
|
65
|
+
// preview list inside is the scrollable region); the textarea + send row
|
|
66
|
+
// is shrink-0 so it can never be pushed out of view.
|
|
64
67
|
<div
|
|
65
|
-
className="central-container flex flex-col gap-2 min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]"
|
|
68
|
+
className="central-container flex min-h-0 flex-col gap-2 min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]"
|
|
66
69
|
data-dd-privacy="mask"
|
|
67
70
|
>
|
|
68
71
|
<QuotedMessagePreview />
|
|
69
72
|
<CustomLinkPreviewList />
|
|
70
73
|
<AttachmentPreviewList />
|
|
71
|
-
<div className="flex">
|
|
74
|
+
<div className="flex shrink-0">
|
|
72
75
|
<div className="w-full ml-2 mr-4 self-center leading-[0]">
|
|
73
76
|
<TextareaComposer
|
|
74
77
|
aria-disabled={disabled || undefined}
|
|
@@ -155,12 +158,12 @@ export const CustomMessageInput: React.FC<CustomMessageInputProps> = ({
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
return (
|
|
158
|
-
<div className="flex flex-col gap-4 p-4">
|
|
161
|
+
<div className="flex min-h-0 flex-col gap-4 p-4">
|
|
159
162
|
<div
|
|
160
163
|
// @ts-expect-error Only React 19 onwards has `inert` in its types.
|
|
161
164
|
inert={isFrozen ? '' : undefined}
|
|
162
165
|
aria-disabled={isFrozen || undefined}
|
|
163
|
-
className="message-input flex items-end gap-4 aria-disabled:opacity-40"
|
|
166
|
+
className="message-input flex min-h-0 items-end gap-4 aria-disabled:opacity-40"
|
|
164
167
|
>
|
|
165
168
|
{renderActions && (
|
|
166
169
|
<div className="flex h-12 shrink-0 items-center justify-center">
|
|
@@ -64,7 +64,7 @@ const CardShell: React.FC<CardShellProps> = ({
|
|
|
64
64
|
const isInteractive = href != null || onClick != null
|
|
65
65
|
const className = classNames(
|
|
66
66
|
SHELL_CLASS,
|
|
67
|
-
bgClassName ?? (variant === 'dark' ? 'bg-[#
|
|
67
|
+
bgClassName ?? (variant === 'dark' ? 'bg-[#121110]' : 'bg-white'),
|
|
68
68
|
// `focus-ring` is a design-system utility from the component-library
|
|
69
69
|
// tailwind preset — outline-none + a black 2px focus-visible ring
|
|
70
70
|
// with offset, so keyboard users can see the focused card.
|
|
@@ -26,7 +26,7 @@ const LockedCardShell: React.FC<LockedCardShellProps> = ({
|
|
|
26
26
|
className={classNames(
|
|
27
27
|
'relative w-[280px] select-none overflow-hidden rounded-md',
|
|
28
28
|
'shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]',
|
|
29
|
-
variant === 'dark' ? 'bg-[#
|
|
29
|
+
variant === 'dark' ? 'bg-[#121110]' : 'bg-white'
|
|
30
30
|
)}
|
|
31
31
|
>
|
|
32
32
|
{children}
|
|
@@ -15,7 +15,7 @@ function formatBytes(bytes: number): string {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function linkCardShellClass(isMyMessage: boolean) {
|
|
18
|
-
const bg = isMyMessage ? 'bg-[#
|
|
18
|
+
const bg = isMyMessage ? 'bg-[#121110]' : 'bg-[#F3F3F1]'
|
|
19
19
|
return `w-[280px] select-none overflow-hidden rounded-[24px] ${bg} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ export interface BubbleProps {
|
|
|
30
30
|
// `.str-chat__message-bubble` token set so attachments visually drop
|
|
31
31
|
// into a normal `CustomMessage` thread without any seams:
|
|
32
32
|
// - light → `--str-chat__secondary-surface-color` = grey200 (#e9eaed)
|
|
33
|
-
// - dark → `.str-chat__message--me` override in `styles.css` (#
|
|
33
|
+
// - dark → `.str-chat__message--me` override in `styles.css` (#121110)
|
|
34
34
|
// - text padding → `--str-chat__spacing-2 --str-chat__spacing-4` = 8px 16px
|
|
35
35
|
// - border-radius → `--str-chat__border-radius-md` = 18px
|
|
36
36
|
//
|
|
@@ -41,7 +41,7 @@ export interface BubbleProps {
|
|
|
41
41
|
// rebrand would need to touch every site. A central token would
|
|
42
42
|
// collapse the migration to one definition.
|
|
43
43
|
const BUBBLE_BG_BY_VARIANT: Record<BubbleVariant, string> = {
|
|
44
|
-
dark: 'bg-[#
|
|
44
|
+
dark: 'bg-[#121110]',
|
|
45
45
|
light: 'bg-[#e9eaed]',
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -104,7 +104,7 @@ const CORNER_CLASSES_BY_SIDE_AND_POSITION: Record<
|
|
|
104
104
|
* is the file', 'Here is the image').
|
|
105
105
|
*
|
|
106
106
|
* Two visual variants:
|
|
107
|
-
* - `dark` — sender-side (Composer / Sent), white text on `#
|
|
107
|
+
* - `dark` — sender-side (Composer / Sent), white text on `#121110`.
|
|
108
108
|
* - `light` — recipient-side (Received), dark text on `#e9eaed`.
|
|
109
109
|
*
|
|
110
110
|
* Background colors, padding, border-radius, and inherited font come
|
package/src/styles.css
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
--str-chat__font-family: inherit;
|
|
9
9
|
|
|
10
10
|
--str-chat__message-bubble-border-radius: 1.5rem;
|
|
11
|
-
--str-chat__message-bubble-background-color: #
|
|
12
|
-
--str-chat__message-bubble-color: #
|
|
11
|
+
--str-chat__message-bubble-background-color: #f1f0ee;
|
|
12
|
+
--str-chat__message-bubble-color: #181818;
|
|
13
13
|
|
|
14
|
-
--str-chat__own-message-bubble-background-color: #
|
|
14
|
+
--str-chat__own-message-bubble-background-color: #121110;
|
|
15
15
|
--str-chat__own-message-bubble-color: #fff;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -560,8 +560,7 @@
|
|
|
560
560
|
|
|
561
561
|
.str-chat__message .str-chat__message-bubble {
|
|
562
562
|
font-size: 0.875rem;
|
|
563
|
-
line-height: 1.
|
|
564
|
-
letter-spacing: 0.14px;
|
|
563
|
+
line-height: 1.25rem;
|
|
565
564
|
}
|
|
566
565
|
|
|
567
566
|
/* Chatbot reply markdown — restore semantics that consumer Tailwind preflight
|
|
@@ -675,55 +674,11 @@
|
|
|
675
674
|
}
|
|
676
675
|
|
|
677
676
|
.str-chat__message--other .str-chat__message-bubble {
|
|
678
|
-
border-end-start-radius:
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
.str-chat__message--other
|
|
682
|
-
.str-chat__message-bubble-wrapper
|
|
683
|
-
> .str-chat__message-bubble:last-child {
|
|
684
|
-
position: relative;
|
|
685
|
-
|
|
686
|
-
&::after {
|
|
687
|
-
content: '';
|
|
688
|
-
position: absolute;
|
|
689
|
-
inset-block-end: 0;
|
|
690
|
-
inset-inline-start: calc(-1 * 0.25rem);
|
|
691
|
-
width: 1.375rem;
|
|
692
|
-
height: 1.5rem;
|
|
693
|
-
background-color: var(--str-chat__message-bubble-background-color);
|
|
694
|
-
pointer-events: none;
|
|
695
|
-
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='25 22 20 23'%3E%3Cpath d='M45 22H30C30 32.1934 29.1413 37.2345 25.8323 43.4893C25.4732 44.168 25.9613 44.9917 26.7255 44.9178C39.8236 43.6506 44.6803 28.0737 45 22Z'/%3E%3C/svg%3E")
|
|
696
|
-
no-repeat center / 100% 100%;
|
|
697
|
-
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='25 22 20 23'%3E%3Cpath d='M45 22H30C30 32.1934 29.1413 37.2345 25.8323 43.4893C25.4732 44.168 25.9613 44.9917 26.7255 44.9178C39.8236 43.6506 44.6803 28.0737 45 22Z'/%3E%3C/svg%3E")
|
|
698
|
-
no-repeat center / 100% 100%;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
.str-chat__message--me
|
|
703
|
-
.str-chat__message-bubble-wrapper
|
|
704
|
-
> .str-chat__message-bubble:last-child {
|
|
705
|
-
position: relative;
|
|
706
|
-
|
|
707
|
-
&::after {
|
|
708
|
-
content: '';
|
|
709
|
-
position: absolute;
|
|
710
|
-
inset-block-end: 0;
|
|
711
|
-
inset-inline-end: calc(-1 * 0.25rem);
|
|
712
|
-
width: 1.375rem;
|
|
713
|
-
height: 1.5rem;
|
|
714
|
-
background-color: var(--str-chat__own-message-bubble-background-color);
|
|
715
|
-
pointer-events: none;
|
|
716
|
-
transform: scaleX(-1);
|
|
717
|
-
transform-origin: center;
|
|
718
|
-
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='25 22 20 23'%3E%3Cpath d='M45 22H30C30 32.1934 29.1413 37.2345 25.8323 43.4893C25.4732 44.168 25.9613 44.9917 26.7255 44.9178C39.8236 43.6506 44.6803 28.0737 45 22Z'/%3E%3C/svg%3E")
|
|
719
|
-
no-repeat center / 100% 100%;
|
|
720
|
-
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='25 22 20 23'%3E%3Cpath d='M45 22H30C30 32.1934 29.1413 37.2345 25.8323 43.4893C25.4732 44.168 25.9613 44.9917 26.7255 44.9178C39.8236 43.6506 44.6803 28.0737 45 22Z'/%3E%3C/svg%3E")
|
|
721
|
-
no-repeat center / 100% 100%;
|
|
722
|
-
}
|
|
677
|
+
border-end-start-radius: var(--str-chat__message-bubble-border-radius);
|
|
723
678
|
}
|
|
724
679
|
|
|
725
680
|
.str-chat__message--me .str-chat__message-bubble {
|
|
726
|
-
border-end-end-radius:
|
|
681
|
+
border-end-end-radius: var(--str-chat__message-bubble-border-radius);
|
|
727
682
|
}
|
|
728
683
|
}
|
|
729
684
|
|