@tellescope/chat 1.3.0 → 1.3.3
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/lib/cjs/chat.d.ts +8 -1
- package/lib/cjs/chat.d.ts.map +1 -1
- package/lib/cjs/chat.js +19 -1
- package/lib/cjs/chat.js.map +1 -1
- package/lib/esm/chat.d.ts +8 -1
- package/lib/esm/chat.d.ts.map +1 -1
- package/lib/esm/chat.js +19 -1
- package/lib/esm/chat.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/chat.tsx +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/chat",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"@fontsource/roboto": "^4.5.1",
|
|
35
35
|
"@mui/icons-material": "^5.0.1",
|
|
36
36
|
"@mui/material": "^5.0.2",
|
|
37
|
-
"@tellescope/constants": "^1.3.
|
|
38
|
-
"@tellescope/react-components": "^1.3.
|
|
39
|
-
"@tellescope/sdk": "^1.3.
|
|
40
|
-
"@tellescope/types-client": "^1.3.
|
|
41
|
-
"@tellescope/types-models": "^1.3.
|
|
37
|
+
"@tellescope/constants": "^1.3.3",
|
|
38
|
+
"@tellescope/react-components": "^1.3.3",
|
|
39
|
+
"@tellescope/sdk": "^1.3.3",
|
|
40
|
+
"@tellescope/types-client": "^1.3.3",
|
|
41
|
+
"@tellescope/types-models": "^1.3.3",
|
|
42
42
|
"@tellescope/types-utilities": "^1.2.2",
|
|
43
|
-
"@tellescope/utilities": "^1.3.
|
|
43
|
+
"@tellescope/utilities": "^1.3.3",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
45
45
|
"@typescript-eslint/parser": "^4.33.0",
|
|
46
46
|
"eslint": "^7.32.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
52
52
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2357299acec10ce7c10bb28ec85c1e434c2717c8",
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
}
|
package/src/chat.tsx
CHANGED
|
@@ -113,6 +113,10 @@ interface MessageStyles {
|
|
|
113
113
|
receivedMessageTextStyle?: CSSProperties,
|
|
114
114
|
sentMessageStyle?: CSSProperties,
|
|
115
115
|
sentMessageTextStyle?: CSSProperties,
|
|
116
|
+
sentBgColor?: string,
|
|
117
|
+
sentTextColor?: string,
|
|
118
|
+
receivedBgColor?: string,
|
|
119
|
+
receivedTextColor?: string,
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
interface MessageProps extends MessageStyles {
|
|
@@ -123,6 +127,10 @@ interface MessageProps extends MessageStyles {
|
|
|
123
127
|
export const Message = ({
|
|
124
128
|
message,
|
|
125
129
|
iconSize=30,
|
|
130
|
+
sentBgColor,
|
|
131
|
+
sentTextColor,
|
|
132
|
+
receivedBgColor,
|
|
133
|
+
receivedTextColor,
|
|
126
134
|
sentMessageStyle=defaultSentStyle,
|
|
127
135
|
receivedMessageStyle=defaultReceivedStyle,
|
|
128
136
|
sentMessageTextStyle=defaultSentTextStyle,
|
|
@@ -142,6 +150,22 @@ export const Message = ({
|
|
|
142
150
|
|
|
143
151
|
if (!message.message) {
|
|
144
152
|
textBGStyle.backgroundColor = undefined
|
|
153
|
+
} else {
|
|
154
|
+
if (message.senderId === chatUserId) {
|
|
155
|
+
if (sentBgColor) {
|
|
156
|
+
textBGStyle.backgroundColor = sentBgColor;
|
|
157
|
+
}
|
|
158
|
+
if (sentTextColor) {
|
|
159
|
+
textBGStyle.color = sentTextColor;
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
if (receivedBgColor) {
|
|
163
|
+
textBGStyle.backgroundColor = receivedBgColor;
|
|
164
|
+
}
|
|
165
|
+
if (receivedTextColor) {
|
|
166
|
+
textBGStyle.color = receivedTextColor;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
145
169
|
}
|
|
146
170
|
|
|
147
171
|
const attachments = (
|
|
@@ -206,6 +230,8 @@ export const MessageAttachments = ({ message, chatUserId, imageDimensions } : {
|
|
|
206
230
|
)
|
|
207
231
|
}
|
|
208
232
|
|
|
233
|
+
export type MessageTheme = { theme?: string }
|
|
234
|
+
|
|
209
235
|
interface Messages_T extends MessageStyles {
|
|
210
236
|
resolveSenderName?: (room: ChatRoom) => React.ReactNode;
|
|
211
237
|
messages: LoadedData<ChatMessage[]>,
|