@adatechnology/conversations-ui 0.1.0-rc.43 → 0.1.0-rc.44
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.js +12 -6
- package/package.json +1 -1
- package/src/ConversationListItem.tsx +5 -4
- package/src/MessageText.tsx +2 -1
- package/src/MessageTimestamp.tsx +2 -1
- package/src/theme.ts +13 -0
package/dist/index.js
CHANGED
|
@@ -847,6 +847,12 @@ function Avatar({ name, avatarUrl, size = "md", className = "", labels }) {
|
|
|
847
847
|
|
|
848
848
|
// src/ConversationListItem.tsx
|
|
849
849
|
import { useMemo } from "react";
|
|
850
|
+
|
|
851
|
+
// src/theme.ts
|
|
852
|
+
var CHAT_TEXT_PRIMARY_CLASS = "text-[#111b21] dark:text-[#e9edef]";
|
|
853
|
+
var CHAT_TEXT_SECONDARY_CLASS = "text-[#667781] dark:text-[#8696a0]";
|
|
854
|
+
|
|
855
|
+
// src/ConversationListItem.tsx
|
|
850
856
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
851
857
|
var DEFAULT_CONVERSATION_LIST_ITEM_LABELS = {
|
|
852
858
|
expiredWindow: "Janela expirada",
|
|
@@ -949,18 +955,18 @@ var ConversationListItem = ({
|
|
|
949
955
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
|
|
950
956
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
951
957
|
!conversation.clientName && flag ? /* @__PURE__ */ jsx5("span", { "aria-hidden": true, children: flag }) : null,
|
|
952
|
-
/* @__PURE__ */ jsx5("span", { className:
|
|
958
|
+
/* @__PURE__ */ jsx5("span", { className: `text-[16px] ${CHAT_TEXT_PRIMARY_CLASS} truncate`, children: name }),
|
|
953
959
|
windowStatus && windowStatus.label === "expired" && /* @__PURE__ */ jsx5("span", { className: "w-2 h-2 rounded-full bg-red-500 flex-shrink-0", "data-cv-tooltip": expiredWindowLabel }),
|
|
954
960
|
windowStatus && windowStatus.label === "warning" && /* @__PURE__ */ jsx5("span", { className: "w-2 h-2 rounded-full bg-orange-500 flex-shrink-0", "data-cv-tooltip": warningWindowLabel })
|
|
955
961
|
] }),
|
|
956
|
-
timestamp && /* @__PURE__ */ jsx5("span", { className:
|
|
962
|
+
timestamp && /* @__PURE__ */ jsx5("span", { className: `text-xs ${CHAT_TEXT_SECONDARY_CLASS} flex-shrink-0`, children: timestamp })
|
|
957
963
|
] }),
|
|
958
|
-
conversation.clientName ? /* @__PURE__ */ jsxs4("div", { className:
|
|
964
|
+
conversation.clientName ? /* @__PURE__ */ jsxs4("div", { className: `flex items-center gap-1 text-xs ${CHAT_TEXT_SECONDARY_CLASS}`, children: [
|
|
959
965
|
flag ? /* @__PURE__ */ jsx5("span", { "aria-hidden": true, children: flag }) : null,
|
|
960
966
|
/* @__PURE__ */ jsx5("span", { className: "truncate", children: displayHandle })
|
|
961
967
|
] }) : null,
|
|
962
968
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mt-0.5", children: [
|
|
963
|
-
/* @__PURE__ */ jsxs4("span", { className:
|
|
969
|
+
/* @__PURE__ */ jsxs4("span", { className: `text-sm ${CHAT_TEXT_SECONDARY_CLASS} truncate max-w-[180px]`, children: [
|
|
964
970
|
preview.icon && /* @__PURE__ */ jsx5("span", { className: "mr-1", children: preview.icon }),
|
|
965
971
|
preview.preview || "Sem mensagens"
|
|
966
972
|
] }),
|
|
@@ -1098,7 +1104,7 @@ function MessageText({ message }) {
|
|
|
1098
1104
|
}
|
|
1099
1105
|
}, [message.content]);
|
|
1100
1106
|
if (message.type === "template")
|
|
1101
|
-
return /* @__PURE__ */ jsx7("p", { className:
|
|
1107
|
+
return /* @__PURE__ */ jsx7("p", { className: `text-sm italic ${CHAT_TEXT_SECONDARY_CLASS}`, children: message.content ?? "Template message" });
|
|
1102
1108
|
return /* @__PURE__ */ jsxs6(
|
|
1103
1109
|
"div",
|
|
1104
1110
|
{
|
|
@@ -1116,7 +1122,7 @@ function MessageText({ message }) {
|
|
|
1116
1122
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1117
1123
|
function MessageTimestamp({ timestamp, status, isOutbound }) {
|
|
1118
1124
|
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-end gap-[3px]", children: [
|
|
1119
|
-
/* @__PURE__ */ jsx8("span", { className:
|
|
1125
|
+
/* @__PURE__ */ jsx8("span", { className: `text-[11px] ${CHAT_TEXT_SECONDARY_CLASS} leading-[15px] select-none`, children: timestamp }),
|
|
1120
1126
|
isOutbound && status && /* @__PURE__ */ jsx8("span", { className: "flex items-center -mr-[2px]", children: /* @__PURE__ */ jsx8(StatusTicks, { status }) })
|
|
1121
1127
|
] });
|
|
1122
1128
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
|
+
import { CHAT_TEXT_PRIMARY_CLASS, CHAT_TEXT_SECONDARY_CLASS } from './theme'
|
|
2
3
|
import { Avatar } from './Avatar'
|
|
3
4
|
import { contactFlag, formatContactHandle } from './conversationChannel'
|
|
4
5
|
import type { ConversationSummary } from './providers/types'
|
|
@@ -149,7 +150,7 @@ export const ConversationListItem = ({
|
|
|
149
150
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
150
151
|
{/* Sem nome, o título já é o telefone — a bandeira vai nele. */}
|
|
151
152
|
{!conversation.clientName && flag ? <span aria-hidden>{flag}</span> : null}
|
|
152
|
-
<span className=
|
|
153
|
+
<span className={`text-[16px] ${CHAT_TEXT_PRIMARY_CLASS} truncate`}>{name}</span>
|
|
153
154
|
{windowStatus && windowStatus.label === 'expired' && (
|
|
154
155
|
<span className="w-2 h-2 rounded-full bg-red-500 flex-shrink-0" data-cv-tooltip={expiredWindowLabel} />
|
|
155
156
|
)}
|
|
@@ -158,20 +159,20 @@ export const ConversationListItem = ({
|
|
|
158
159
|
)}
|
|
159
160
|
</div>
|
|
160
161
|
{timestamp && (
|
|
161
|
-
<span className=
|
|
162
|
+
<span className={`text-xs ${CHAT_TEXT_SECONDARY_CLASS} flex-shrink-0`}>{timestamp}</span>
|
|
162
163
|
)}
|
|
163
164
|
</div>
|
|
164
165
|
{/* Telefone só como subtítulo quando o título é o nome — repetir o número embaixo dele
|
|
165
166
|
mesmo gastaria uma linha para dizer duas vezes a mesma coisa. */}
|
|
166
167
|
{conversation.clientName ? (
|
|
167
|
-
<div className=
|
|
168
|
+
<div className={`flex items-center gap-1 text-xs ${CHAT_TEXT_SECONDARY_CLASS}`}>
|
|
168
169
|
{flag ? <span aria-hidden>{flag}</span> : null}
|
|
169
170
|
<span className="truncate">{displayHandle}</span>
|
|
170
171
|
</div>
|
|
171
172
|
) : null}
|
|
172
173
|
|
|
173
174
|
<div className="flex items-center justify-between mt-0.5">
|
|
174
|
-
<span className=
|
|
175
|
+
<span className={`text-sm ${CHAT_TEXT_SECONDARY_CLASS} truncate max-w-[180px]`}>
|
|
175
176
|
{preview.icon && <span className="mr-1">{preview.icon}</span>}
|
|
176
177
|
{preview.preview || 'Sem mensagens'}
|
|
177
178
|
</span>
|
package/src/MessageText.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react'
|
|
2
|
+
import { CHAT_TEXT_SECONDARY_CLASS } from './theme'
|
|
2
3
|
import type { MessagePayload } from './types'
|
|
3
4
|
import { useConversations } from './providers/ConversationsProvider'
|
|
4
5
|
import { parseWhatsAppFormatting } from './lib/whatsapp-formatting'
|
|
@@ -22,7 +23,7 @@ export function MessageText({ message }: MessageTextProps) {
|
|
|
22
23
|
}, [message.content])
|
|
23
24
|
|
|
24
25
|
if (message.type === 'template')
|
|
25
|
-
return <p className=
|
|
26
|
+
return <p className={`text-sm italic ${CHAT_TEXT_SECONDARY_CLASS}`}>{message.content ?? 'Template message'}</p>
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
29
|
<div
|
package/src/MessageTimestamp.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StatusTicks } from './StatusTicks'
|
|
2
|
+
import { CHAT_TEXT_SECONDARY_CLASS } from './theme'
|
|
2
3
|
|
|
3
4
|
export interface MessageTimestampProps {
|
|
4
5
|
timestamp: string
|
|
@@ -9,7 +10,7 @@ export interface MessageTimestampProps {
|
|
|
9
10
|
export function MessageTimestamp({ timestamp, status, isOutbound }: MessageTimestampProps) {
|
|
10
11
|
return (
|
|
11
12
|
<div className="flex items-center justify-end gap-[3px]">
|
|
12
|
-
<span className=
|
|
13
|
+
<span className={`text-[11px] ${CHAT_TEXT_SECONDARY_CLASS} leading-[15px] select-none`}>
|
|
13
14
|
{timestamp}
|
|
14
15
|
</span>
|
|
15
16
|
{isOutbound && status && (
|
package/src/theme.ts
CHANGED
|
@@ -28,3 +28,16 @@ export function getCustomStyles(theme?: ConversationsTheme): Record<string, stri
|
|
|
28
28
|
|
|
29
29
|
return styles
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Texto do chat nos dois temas.
|
|
34
|
+
*
|
|
35
|
+
* Existe porque as cores viviam cravadas em hexadecimal na marcação, sem variante escura: nome do
|
|
36
|
+
* cliente em `#111b21` e número, horário e prévia em `#667781` — os cinzas do WhatsApp CLARO. Com o
|
|
37
|
+
* tema escuro ligado eles continuavam escuros sobre fundo escuro, e a lista virava texto quase
|
|
38
|
+
* ilegível. O mesmo par aparecia dentro do balão, que também escurece.
|
|
39
|
+
*
|
|
40
|
+
* Os valores escuros são os que o próprio WhatsApp usa, para a tela não inventar uma paleta própria.
|
|
41
|
+
*/
|
|
42
|
+
export const CHAT_TEXT_PRIMARY_CLASS = 'text-[#111b21] dark:text-[#e9edef]'
|
|
43
|
+
export const CHAT_TEXT_SECONDARY_CLASS = 'text-[#667781] dark:text-[#8696a0]'
|