@tree-ia/design-system 2.3.0 → 2.3.1
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.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +233 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { AlertCircle, AlertOctagon, AlertTriangle, ArrowDown, ArrowLeft, ArrowUp, ArrowUpDown,
|
|
4
|
+
import { AlertCircle, AlertOctagon, AlertTriangle, ArrowDown, ArrowLeft, ArrowUp, ArrowUpDown, Bot, Building2, Camera, Check, CheckCheck, CheckCircle, ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Copy, File, FileText, GripVertical, Image, Inbox, Info, Lightbulb, Loader2, LogOut, Menu, MessageCircle, Mic, Monitor, Moon, MoreVertical, Paperclip, Phone, Play, PlaySquare, Search, Send, Settings, ShieldAlert, Smile, Sun, Text, Upload, User, Video, Wifi, X, XCircle } from "lucide-react";
|
|
5
5
|
import { Bar, Doughnut, Line } from "react-chartjs-2";
|
|
6
6
|
import { ArcElement, BarElement, CategoryScale, Chart, Filler, Legend, LineElement, LinearScale, PointElement, Title as Title$1, Tooltip as Tooltip$1 } from "chart.js";
|
|
7
7
|
import { createColumnHelper, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
@@ -6097,8 +6097,77 @@ const DEFAULT_WAVEFORM = [
|
|
|
6097
6097
|
29,
|
|
6098
6098
|
17
|
|
6099
6099
|
];
|
|
6100
|
+
const WHATSAPP_PALETTES = {
|
|
6101
|
+
dark: {
|
|
6102
|
+
frame: "#0a0d12",
|
|
6103
|
+
statusbar: "#111b21",
|
|
6104
|
+
statusText: "#e9edef",
|
|
6105
|
+
screen: "#0b141a",
|
|
6106
|
+
header: "#111b21",
|
|
6107
|
+
headerText: "#e9edef",
|
|
6108
|
+
mutedText: "#aebac1",
|
|
6109
|
+
subtleText: "#8696a0",
|
|
6110
|
+
action: "#00a884",
|
|
6111
|
+
wallpaperStroke: "#e9edef",
|
|
6112
|
+
wallpaperOpacity: .045,
|
|
6113
|
+
dateBg: "#182229",
|
|
6114
|
+
dateText: "#aebac1",
|
|
6115
|
+
noticeBg: "#182229",
|
|
6116
|
+
noticeText: "#d0b66b",
|
|
6117
|
+
incoming: "#202c33",
|
|
6118
|
+
incomingText: "#e9edef",
|
|
6119
|
+
outgoing: "#005c4b",
|
|
6120
|
+
outgoingText: "#e9edef",
|
|
6121
|
+
outgoingMeta: "#c7d4cf",
|
|
6122
|
+
read: "#53bdeb",
|
|
6123
|
+
avatarBg: "#60b531",
|
|
6124
|
+
composer: "#111b21",
|
|
6125
|
+
composerInput: "#202c33",
|
|
6126
|
+
composerText: "#8696a0",
|
|
6127
|
+
micBg: "#00a884",
|
|
6128
|
+
micIcon: "#07130f",
|
|
6129
|
+
audioWave: "#9ad8ca",
|
|
6130
|
+
audioButtonBg: "#00a884",
|
|
6131
|
+
shadow: "rgba(0, 0, 0, 0.22)"
|
|
6132
|
+
},
|
|
6133
|
+
light: {
|
|
6134
|
+
frame: "#0a0d12",
|
|
6135
|
+
statusbar: "#f7f5f0",
|
|
6136
|
+
statusText: "#111b21",
|
|
6137
|
+
screen: "#efe7db",
|
|
6138
|
+
header: "#f7f5f0",
|
|
6139
|
+
headerText: "#111b21",
|
|
6140
|
+
mutedText: "#667781",
|
|
6141
|
+
subtleText: "#667781",
|
|
6142
|
+
action: "#008069",
|
|
6143
|
+
wallpaperStroke: "#7d6f59",
|
|
6144
|
+
wallpaperOpacity: .075,
|
|
6145
|
+
dateBg: "rgba(255, 255, 255, 0.88)",
|
|
6146
|
+
dateText: "#6b6255",
|
|
6147
|
+
noticeBg: "#fff7d6",
|
|
6148
|
+
noticeText: "#7a6420",
|
|
6149
|
+
incoming: "#ffffff",
|
|
6150
|
+
incomingText: "#111b21",
|
|
6151
|
+
outgoing: "#d9fdd3",
|
|
6152
|
+
outgoingText: "#111b13",
|
|
6153
|
+
outgoingMeta: "#66756b",
|
|
6154
|
+
read: "#53bdeb",
|
|
6155
|
+
avatarBg: "#60b531",
|
|
6156
|
+
composer: "#f7f5f0",
|
|
6157
|
+
composerInput: "#ffffff",
|
|
6158
|
+
composerText: "#667781",
|
|
6159
|
+
micBg: "#00a884",
|
|
6160
|
+
micIcon: "#ffffff",
|
|
6161
|
+
audioWave: "#177866",
|
|
6162
|
+
audioButtonBg: "#00a884",
|
|
6163
|
+
shadow: "rgba(15, 23, 42, 0.11)"
|
|
6164
|
+
}
|
|
6165
|
+
};
|
|
6100
6166
|
const cn$2 = (...classes) => classes.filter(Boolean).join(" ");
|
|
6101
|
-
function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, profileType = "business", contactSubtitle, messages = [], statusTime = "14:32", dateLabel = "Hoje", encryptionNotice = "Mensagens e ligações são protegidas com criptografia de ponta a ponta.", composerPlaceholder = "Mensagem", composer, showComposer = true, showHeaderActions = true, showWallpaper = true, screenWidth = 266, frameColor
|
|
6167
|
+
function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, profileType = "business", contactSubtitle, theme = "dark", headerBackgroundColor, profileAvatarBackgroundColor, messages = [], statusTime = "14:32", dateLabel = "Hoje", encryptionNotice = "Mensagens e ligações são protegidas com criptografia de ponta a ponta.", composerPlaceholder = "Mensagem", composer, showComposer = true, showHeaderActions = true, showWallpaper = true, screenWidth = 266, frameColor, statusbarColor, containerStyle, frameOnly, hideStatusBar, className, phoneClassName, screenClassName, messagesClassName, "aria-label": ariaLabel }) {
|
|
6168
|
+
const palette = WHATSAPP_PALETTES[theme];
|
|
6169
|
+
const resolvedFrameColor = frameColor ?? palette.frame;
|
|
6170
|
+
const resolvedStatusbarColor = statusbarColor ?? palette.statusbar;
|
|
6102
6171
|
const subtitle = contactSubtitle === void 0 ? profileType === "business" ? "WhatsApp Business" : void 0 : contactSubtitle || void 0;
|
|
6103
6172
|
return /* @__PURE__ */ jsx("div", {
|
|
6104
6173
|
className: cn$2("rounded-[2.65rem] shadow-[0_34px_74px_-34px_rgba(15,23,42,0.58)] dark:shadow-[0_34px_86px_-34px_rgba(10,13,18,0.82)]", className),
|
|
@@ -6106,19 +6175,24 @@ function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAva
|
|
|
6106
6175
|
children: /* @__PURE__ */ jsx(IPhoneMockup, {
|
|
6107
6176
|
screenWidth,
|
|
6108
6177
|
screenType: "island",
|
|
6109
|
-
frameColor,
|
|
6110
|
-
statusbarColor,
|
|
6178
|
+
frameColor: resolvedFrameColor,
|
|
6179
|
+
statusbarColor: resolvedStatusbarColor,
|
|
6111
6180
|
hideNavBar: true,
|
|
6112
6181
|
frameOnly,
|
|
6113
6182
|
hideStatusBar,
|
|
6114
6183
|
containerStyle,
|
|
6115
6184
|
className: phoneClassName,
|
|
6116
6185
|
children: /* @__PURE__ */ jsxs("div", {
|
|
6117
|
-
className: cn$2("flex h-full w-full flex-col
|
|
6186
|
+
className: cn$2("flex h-full w-full flex-col", screenClassName),
|
|
6187
|
+
style: {
|
|
6188
|
+
backgroundColor: palette.screen,
|
|
6189
|
+
color: palette.headerText
|
|
6190
|
+
},
|
|
6118
6191
|
children: [
|
|
6119
6192
|
/* @__PURE__ */ jsx(StatusBar, {
|
|
6120
6193
|
time: statusTime,
|
|
6121
|
-
screenWidth
|
|
6194
|
+
screenWidth,
|
|
6195
|
+
palette
|
|
6122
6196
|
}),
|
|
6123
6197
|
/* @__PURE__ */ jsx(WhatsAppHeader, {
|
|
6124
6198
|
contactName,
|
|
@@ -6126,75 +6200,127 @@ function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAva
|
|
|
6126
6200
|
profilePhoto,
|
|
6127
6201
|
profilePhotoAlt,
|
|
6128
6202
|
profileAvatar,
|
|
6129
|
-
showActions: showHeaderActions
|
|
6203
|
+
showActions: showHeaderActions,
|
|
6204
|
+
backgroundColor: headerBackgroundColor ?? palette.header,
|
|
6205
|
+
avatarBackgroundColor: profileAvatarBackgroundColor ?? palette.avatarBg,
|
|
6206
|
+
palette
|
|
6130
6207
|
}),
|
|
6131
6208
|
/* @__PURE__ */ jsxs("div", {
|
|
6132
6209
|
className: cn$2("relative flex flex-1 flex-col gap-2 overflow-hidden px-2.5 py-2.5", messagesClassName),
|
|
6133
6210
|
children: [
|
|
6134
|
-
showWallpaper ? /* @__PURE__ */ jsx(WhatsAppWallpaper, {}) : null,
|
|
6211
|
+
showWallpaper ? /* @__PURE__ */ jsx(WhatsAppWallpaper, { palette }) : null,
|
|
6135
6212
|
dateLabel ? /* @__PURE__ */ jsx("div", {
|
|
6136
|
-
className: "relative z-10 mx-auto rounded-full
|
|
6213
|
+
className: "relative z-10 mx-auto rounded-full px-2.5 py-0.5 text-[9px] font-semibold uppercase shadow-[0_1px_2px_rgba(15,23,42,0.08)]",
|
|
6214
|
+
style: {
|
|
6215
|
+
backgroundColor: palette.dateBg,
|
|
6216
|
+
color: palette.dateText
|
|
6217
|
+
},
|
|
6137
6218
|
children: dateLabel
|
|
6138
6219
|
}) : null,
|
|
6139
6220
|
encryptionNotice ? /* @__PURE__ */ jsx("div", {
|
|
6140
|
-
className: "relative z-10 mx-auto max-w-[92%] rounded-md
|
|
6221
|
+
className: "relative z-10 mx-auto max-w-[92%] rounded-md px-2.5 py-1.5 text-center text-[9px] leading-snug shadow-[0_1px_2px_rgba(15,23,42,0.06)]",
|
|
6222
|
+
style: {
|
|
6223
|
+
backgroundColor: palette.noticeBg,
|
|
6224
|
+
color: palette.noticeText
|
|
6225
|
+
},
|
|
6141
6226
|
children: encryptionNotice
|
|
6142
6227
|
}) : null,
|
|
6143
|
-
messages.map((message, index) => /* @__PURE__ */ jsx(WhatsAppMessageBubble, {
|
|
6228
|
+
messages.map((message, index) => /* @__PURE__ */ jsx(WhatsAppMessageBubble, {
|
|
6229
|
+
message,
|
|
6230
|
+
palette
|
|
6231
|
+
}, message.id ?? `${message.time}-${index}`))
|
|
6144
6232
|
]
|
|
6145
6233
|
}),
|
|
6146
|
-
showComposer ? composer ?? /* @__PURE__ */ jsx(WhatsAppComposer, {
|
|
6234
|
+
showComposer ? composer ?? /* @__PURE__ */ jsx(WhatsAppComposer, {
|
|
6235
|
+
composerPlaceholder,
|
|
6236
|
+
palette
|
|
6237
|
+
}) : null
|
|
6147
6238
|
]
|
|
6148
6239
|
})
|
|
6149
6240
|
})
|
|
6150
6241
|
});
|
|
6151
6242
|
}
|
|
6152
|
-
function StatusBar({ time, screenWidth }) {
|
|
6243
|
+
function StatusBar({ time, screenWidth, palette }) {
|
|
6153
6244
|
return /* @__PURE__ */ jsxs("div", {
|
|
6154
6245
|
"aria-hidden": true,
|
|
6155
|
-
className: "absolute left-0 right-0 top-0 z-50 flex items-center justify-between px-6 text-[11px] font-semibold tracking-tight
|
|
6246
|
+
className: "absolute left-0 right-0 top-0 z-50 flex items-center justify-between px-6 text-[11px] font-semibold tracking-tight",
|
|
6156
6247
|
style: { height: `${Math.floor(screenWidth * 59 / 390)}px` },
|
|
6157
6248
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6158
6249
|
className: "tabular-nums",
|
|
6250
|
+
style: { color: palette.statusText },
|
|
6159
6251
|
children: time
|
|
6160
6252
|
}), /* @__PURE__ */ jsxs("div", {
|
|
6161
6253
|
className: "flex items-center gap-1",
|
|
6254
|
+
style: { color: palette.statusText },
|
|
6162
6255
|
children: [
|
|
6163
|
-
/* @__PURE__ */ jsx(
|
|
6164
|
-
className: "h-3 w-3",
|
|
6165
|
-
strokeWidth: 2.4,
|
|
6166
|
-
"aria-hidden": true
|
|
6167
|
-
}),
|
|
6256
|
+
/* @__PURE__ */ jsx(IosSignal, { color: palette.statusText }),
|
|
6168
6257
|
/* @__PURE__ */ jsx(Wifi, {
|
|
6169
6258
|
className: "h-3 w-3",
|
|
6170
6259
|
strokeWidth: 2.4,
|
|
6171
6260
|
"aria-hidden": true
|
|
6172
6261
|
}),
|
|
6173
|
-
/* @__PURE__ */ jsx(
|
|
6174
|
-
className: "h-3.5 w-3.5",
|
|
6175
|
-
strokeWidth: 2.4,
|
|
6176
|
-
"aria-hidden": true
|
|
6177
|
-
})
|
|
6262
|
+
/* @__PURE__ */ jsx(IosBattery, { color: palette.statusText })
|
|
6178
6263
|
]
|
|
6179
6264
|
})]
|
|
6180
6265
|
});
|
|
6181
6266
|
}
|
|
6182
|
-
function
|
|
6267
|
+
function IosSignal({ color }) {
|
|
6268
|
+
return /* @__PURE__ */ jsx("span", {
|
|
6269
|
+
className: "flex h-3 w-3 items-end gap-[1px]",
|
|
6270
|
+
"aria-hidden": true,
|
|
6271
|
+
children: [
|
|
6272
|
+
4,
|
|
6273
|
+
6,
|
|
6274
|
+
8,
|
|
6275
|
+
10
|
|
6276
|
+
].map((height) => /* @__PURE__ */ jsx("span", {
|
|
6277
|
+
className: "w-[2px] rounded-sm",
|
|
6278
|
+
style: {
|
|
6279
|
+
height,
|
|
6280
|
+
backgroundColor: color
|
|
6281
|
+
}
|
|
6282
|
+
}, height))
|
|
6283
|
+
});
|
|
6284
|
+
}
|
|
6285
|
+
function IosBattery({ color }) {
|
|
6286
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
6287
|
+
className: "flex items-center gap-[1px]",
|
|
6288
|
+
"aria-hidden": true,
|
|
6289
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6290
|
+
className: "relative h-[8px] w-[16px] rounded-[2px] border",
|
|
6291
|
+
style: { borderColor: color },
|
|
6292
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6293
|
+
className: "absolute bottom-[1px] left-[1px] top-[1px] w-[10px] rounded-[1px]",
|
|
6294
|
+
style: { backgroundColor: color }
|
|
6295
|
+
})
|
|
6296
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6297
|
+
className: "h-[4px] w-[1.5px] rounded-r",
|
|
6298
|
+
style: { backgroundColor: color }
|
|
6299
|
+
})]
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt, profileAvatar, showActions, backgroundColor, avatarBackgroundColor, palette }) {
|
|
6183
6303
|
return /* @__PURE__ */ jsx("div", {
|
|
6184
|
-
className: "relative
|
|
6304
|
+
className: "relative shadow-[0_1px_0_rgba(17,27,33,0.08)]",
|
|
6305
|
+
style: {
|
|
6306
|
+
backgroundColor,
|
|
6307
|
+
color: palette.headerText
|
|
6308
|
+
},
|
|
6185
6309
|
children: /* @__PURE__ */ jsxs("div", {
|
|
6186
6310
|
className: "flex items-center gap-2 px-2.5 pb-2 pt-2",
|
|
6187
6311
|
children: [
|
|
6188
6312
|
/* @__PURE__ */ jsx(ChevronLeft, {
|
|
6189
|
-
className: "h-5 w-5 shrink-0
|
|
6313
|
+
className: "h-5 w-5 shrink-0",
|
|
6190
6314
|
strokeWidth: 2.4,
|
|
6315
|
+
style: { color: palette.action },
|
|
6191
6316
|
"aria-hidden": true
|
|
6192
6317
|
}),
|
|
6193
6318
|
/* @__PURE__ */ jsx(ProfileAvatar, {
|
|
6194
6319
|
contactName,
|
|
6195
6320
|
profilePhoto,
|
|
6196
6321
|
profilePhotoAlt,
|
|
6197
|
-
profileAvatar
|
|
6322
|
+
profileAvatar,
|
|
6323
|
+
backgroundColor: avatarBackgroundColor
|
|
6198
6324
|
}),
|
|
6199
6325
|
/* @__PURE__ */ jsxs("div", {
|
|
6200
6326
|
className: "min-w-0 flex-1",
|
|
@@ -6202,24 +6328,28 @@ function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt,
|
|
|
6202
6328
|
className: "truncate text-[13px] font-semibold leading-tight",
|
|
6203
6329
|
children: contactName
|
|
6204
6330
|
}), subtitle ? /* @__PURE__ */ jsx("p", {
|
|
6205
|
-
className: "truncate text-[10px] leading-tight
|
|
6331
|
+
className: "truncate text-[10px] leading-tight",
|
|
6332
|
+
style: { color: palette.mutedText },
|
|
6206
6333
|
children: subtitle
|
|
6207
6334
|
}) : null]
|
|
6208
6335
|
}),
|
|
6209
6336
|
showActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6210
6337
|
/* @__PURE__ */ jsx(Video, {
|
|
6211
|
-
className: "h-4 w-4 shrink-0
|
|
6338
|
+
className: "h-4 w-4 shrink-0",
|
|
6212
6339
|
strokeWidth: 2.2,
|
|
6340
|
+
style: { color: palette.action },
|
|
6213
6341
|
"aria-hidden": true
|
|
6214
6342
|
}),
|
|
6215
6343
|
/* @__PURE__ */ jsx(Phone, {
|
|
6216
|
-
className: "h-3.5 w-3.5 shrink-0
|
|
6344
|
+
className: "h-3.5 w-3.5 shrink-0",
|
|
6217
6345
|
strokeWidth: 2.2,
|
|
6346
|
+
style: { color: palette.action },
|
|
6218
6347
|
"aria-hidden": true
|
|
6219
6348
|
}),
|
|
6220
6349
|
/* @__PURE__ */ jsx(MoreVertical, {
|
|
6221
|
-
className: "h-4 w-4 shrink-0
|
|
6350
|
+
className: "h-4 w-4 shrink-0",
|
|
6222
6351
|
strokeWidth: 2.2,
|
|
6352
|
+
style: { color: palette.action },
|
|
6223
6353
|
"aria-hidden": true
|
|
6224
6354
|
})
|
|
6225
6355
|
] }) : null
|
|
@@ -6227,18 +6357,21 @@ function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt,
|
|
|
6227
6357
|
})
|
|
6228
6358
|
});
|
|
6229
6359
|
}
|
|
6230
|
-
function ProfileAvatar({ contactName, profilePhoto, profilePhotoAlt, profileAvatar }) {
|
|
6360
|
+
function ProfileAvatar({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, backgroundColor }) {
|
|
6231
6361
|
if (profileAvatar) return /* @__PURE__ */ jsx("div", {
|
|
6232
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full
|
|
6362
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
6363
|
+
style: { backgroundColor },
|
|
6233
6364
|
children: profileAvatar
|
|
6234
6365
|
});
|
|
6235
6366
|
if (profilePhoto) return /* @__PURE__ */ jsx("img", {
|
|
6236
6367
|
src: profilePhoto,
|
|
6237
6368
|
alt: profilePhotoAlt ?? contactName,
|
|
6238
|
-
className: "h-8 w-8 shrink-0 rounded-full
|
|
6369
|
+
className: "h-8 w-8 shrink-0 rounded-full object-cover",
|
|
6370
|
+
style: { backgroundColor }
|
|
6239
6371
|
});
|
|
6240
6372
|
return /* @__PURE__ */ jsx("div", {
|
|
6241
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full
|
|
6373
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-[11px] font-bold uppercase text-white",
|
|
6374
|
+
style: { backgroundColor },
|
|
6242
6375
|
children: getInitials(contactName)
|
|
6243
6376
|
});
|
|
6244
6377
|
}
|
|
@@ -6246,20 +6379,30 @@ function getInitials(name) {
|
|
|
6246
6379
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
6247
6380
|
return `${parts[0]?.[0] ?? "W"}${(parts.length > 1 ? parts[parts.length - 1]?.[0] : void 0) ?? ""}`;
|
|
6248
6381
|
}
|
|
6249
|
-
function WhatsAppMessageBubble({ message }) {
|
|
6382
|
+
function WhatsAppMessageBubble({ message, palette }) {
|
|
6250
6383
|
const direction = message.direction ?? "outgoing";
|
|
6251
6384
|
const type = message.type ?? "text";
|
|
6252
6385
|
const isOutgoing = direction === "outgoing";
|
|
6386
|
+
const bubbleColor = isOutgoing ? palette.outgoing : palette.incoming;
|
|
6253
6387
|
return /* @__PURE__ */ jsxs("div", {
|
|
6254
|
-
className: cn$2("relative z-10 max-w-[86%] rounded-[14px] px-2.5 py-2 shadow-[0_1px_1.5px_rgba(15,23,42,0.11)]", isOutgoing ? "ml-auto rounded-tr-[4px]
|
|
6388
|
+
className: cn$2("relative z-10 max-w-[86%] rounded-[14px] px-2.5 py-2 shadow-[0_1px_1.5px_rgba(15,23,42,0.11)]", isOutgoing ? "ml-auto rounded-tr-[4px]" : "mr-auto rounded-tl-[4px]", message.className),
|
|
6389
|
+
style: {
|
|
6390
|
+
backgroundColor: bubbleColor,
|
|
6391
|
+
color: isOutgoing ? palette.outgoingText : palette.incomingText,
|
|
6392
|
+
boxShadow: `0 1px 1.5px ${palette.shadow}`,
|
|
6393
|
+
...message.style
|
|
6394
|
+
},
|
|
6255
6395
|
children: [
|
|
6256
6396
|
/* @__PURE__ */ jsx(BubbleTail, {
|
|
6257
6397
|
side: isOutgoing ? "out" : "in",
|
|
6258
|
-
|
|
6398
|
+
color: message.style?.backgroundColor?.toString() ?? bubbleColor
|
|
6259
6399
|
}),
|
|
6260
6400
|
/* @__PURE__ */ jsx("div", {
|
|
6261
6401
|
className: message.contentClassName,
|
|
6262
|
-
children: message.children ?? (type === "audio" ? /* @__PURE__ */ jsx(AudioMessage, {
|
|
6402
|
+
children: message.children ?? (type === "audio" ? /* @__PURE__ */ jsx(AudioMessage, {
|
|
6403
|
+
message,
|
|
6404
|
+
palette
|
|
6405
|
+
}) : type === "custom" ? null : /* @__PURE__ */ jsx("p", {
|
|
6263
6406
|
className: "max-w-[31ch] text-[10.5px] leading-snug",
|
|
6264
6407
|
children: message.text
|
|
6265
6408
|
}))
|
|
@@ -6267,18 +6410,23 @@ function WhatsAppMessageBubble({ message }) {
|
|
|
6267
6410
|
message.hideMeta ? null : /* @__PURE__ */ jsx(MessageMeta, {
|
|
6268
6411
|
time: message.time,
|
|
6269
6412
|
direction,
|
|
6270
|
-
read: message.read
|
|
6413
|
+
read: message.read,
|
|
6414
|
+
palette
|
|
6271
6415
|
})
|
|
6272
6416
|
]
|
|
6273
6417
|
});
|
|
6274
6418
|
}
|
|
6275
|
-
function AudioMessage({ message }) {
|
|
6419
|
+
function AudioMessage({ message, palette }) {
|
|
6276
6420
|
const waveform = message.waveform ?? DEFAULT_WAVEFORM;
|
|
6277
6421
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
6278
6422
|
className: "flex items-center gap-2",
|
|
6279
6423
|
children: [
|
|
6280
6424
|
/* @__PURE__ */ jsx("span", {
|
|
6281
|
-
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full
|
|
6425
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full",
|
|
6426
|
+
style: {
|
|
6427
|
+
backgroundColor: palette.audioButtonBg,
|
|
6428
|
+
color: palette.micIcon
|
|
6429
|
+
},
|
|
6282
6430
|
children: /* @__PURE__ */ jsx(Play, {
|
|
6283
6431
|
className: "ml-0.5 h-3.5 w-3.5 fill-current",
|
|
6284
6432
|
strokeWidth: 2.2,
|
|
@@ -6289,68 +6437,78 @@ function AudioMessage({ message }) {
|
|
|
6289
6437
|
className: "flex h-7 flex-1 items-center gap-[2px]",
|
|
6290
6438
|
"aria-hidden": true,
|
|
6291
6439
|
children: waveform.map((height, index) => /* @__PURE__ */ jsx("span", {
|
|
6292
|
-
className: "origin-center rounded-full
|
|
6440
|
+
className: "origin-center rounded-full",
|
|
6293
6441
|
style: {
|
|
6442
|
+
backgroundColor: palette.audioWave,
|
|
6294
6443
|
height: Math.max(8, Math.round(height * .78)),
|
|
6444
|
+
opacity: .76,
|
|
6295
6445
|
width: 2
|
|
6296
6446
|
}
|
|
6297
6447
|
}, `${height}-${index}`))
|
|
6298
6448
|
}),
|
|
6299
6449
|
message.duration ? /* @__PURE__ */ jsx("span", {
|
|
6300
|
-
className: "text-[10px] font-medium
|
|
6450
|
+
className: "text-[10px] font-medium",
|
|
6451
|
+
style: { color: palette.outgoingMeta },
|
|
6301
6452
|
children: message.duration
|
|
6302
6453
|
}) : null
|
|
6303
6454
|
]
|
|
6304
6455
|
}), message.text ? /* @__PURE__ */ jsx("p", {
|
|
6305
|
-
className: "mt-1.5 max-w-[29ch] text-[9.5px] leading-snug
|
|
6456
|
+
className: "mt-1.5 max-w-[29ch] text-[9.5px] leading-snug",
|
|
6457
|
+
style: { color: palette.outgoingMeta },
|
|
6306
6458
|
children: message.text
|
|
6307
6459
|
}) : null] });
|
|
6308
6460
|
}
|
|
6309
|
-
function MessageMeta({ time, direction, read }) {
|
|
6461
|
+
function MessageMeta({ time, direction, read, palette }) {
|
|
6462
|
+
const isOutgoing = direction === "outgoing";
|
|
6310
6463
|
return /* @__PURE__ */ jsxs("div", {
|
|
6311
|
-
className: "mt-1 flex items-center justify-end gap-1 text-[9px]
|
|
6312
|
-
|
|
6464
|
+
className: "mt-1 flex items-center justify-end gap-1 text-[9px]",
|
|
6465
|
+
style: { color: isOutgoing ? palette.outgoingMeta : palette.subtleText },
|
|
6466
|
+
children: [/* @__PURE__ */ jsx("span", { children: time }), isOutgoing ? read === void 0 ? /* @__PURE__ */ jsx(Check, {
|
|
6313
6467
|
className: "h-3 w-3",
|
|
6314
6468
|
strokeWidth: 2.5,
|
|
6315
6469
|
"aria-hidden": true
|
|
6316
6470
|
}) : /* @__PURE__ */ jsx(CheckCheck, {
|
|
6317
|
-
className:
|
|
6471
|
+
className: "h-3 w-3",
|
|
6318
6472
|
strokeWidth: 2.5,
|
|
6473
|
+
style: { color: read ? palette.read : void 0 },
|
|
6319
6474
|
"aria-hidden": true
|
|
6320
6475
|
}) : null]
|
|
6321
6476
|
});
|
|
6322
6477
|
}
|
|
6323
|
-
function BubbleTail({ side,
|
|
6478
|
+
function BubbleTail({ side, color }) {
|
|
6324
6479
|
const path = side === "out" ? "M0 0H14C10 1.8 7.4 4.7 6.4 8.3L5.3 12C4.2 7 2.4 2.9 0 0Z" : "M14 0H0C4 1.8 6.6 4.7 7.6 8.3L8.7 12C9.8 7 11.6 2.9 14 0Z";
|
|
6325
6480
|
return /* @__PURE__ */ jsx("svg", {
|
|
6326
6481
|
"aria-hidden": true,
|
|
6327
|
-
className: cn$2("pointer-events-none absolute top-0 h-3.5 w-3.5", side === "out" ? "-right-[7px]" : "-left-[7px]"
|
|
6482
|
+
className: cn$2("pointer-events-none absolute top-0 h-3.5 w-3.5", side === "out" ? "-right-[7px]" : "-left-[7px]"),
|
|
6483
|
+
style: { fill: color },
|
|
6328
6484
|
viewBox: "0 0 14 12",
|
|
6329
6485
|
children: /* @__PURE__ */ jsx("path", { d: path })
|
|
6330
6486
|
});
|
|
6331
6487
|
}
|
|
6332
|
-
function WhatsAppWallpaper() {
|
|
6488
|
+
function WhatsAppWallpaper({ palette }) {
|
|
6333
6489
|
const patternId = useId().replace(/:/g, "");
|
|
6334
6490
|
return /* @__PURE__ */ jsxs("svg", {
|
|
6335
6491
|
"aria-hidden": true,
|
|
6336
|
-
className: "pointer-events-none absolute inset-0 h-full w-full
|
|
6492
|
+
className: "pointer-events-none absolute inset-0 h-full w-full",
|
|
6337
6493
|
children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("pattern", {
|
|
6338
6494
|
id: patternId,
|
|
6339
|
-
width: "
|
|
6340
|
-
height: "
|
|
6495
|
+
width: "46",
|
|
6496
|
+
height: "46",
|
|
6341
6497
|
patternUnits: "userSpaceOnUse",
|
|
6342
6498
|
children: [/* @__PURE__ */ jsx("path", {
|
|
6343
|
-
d: "
|
|
6344
|
-
stroke:
|
|
6345
|
-
strokeWidth: "1
|
|
6499
|
+
d: "M8 11h12m-6-6v12M31 7c4 0 7 3 7 7 0 5-5 7-7 10-2-3-7-5-7-10 0-4 3-7 7-7Zm-14 25c4 0 6 2 6 5s-2 5-6 5-6-2-6-5 2-5 6-5Zm19 10 6-6m-6 0 6 6",
|
|
6500
|
+
stroke: palette.wallpaperStroke,
|
|
6501
|
+
strokeWidth: "1",
|
|
6346
6502
|
fill: "none",
|
|
6503
|
+
opacity: palette.wallpaperOpacity,
|
|
6347
6504
|
strokeLinecap: "round",
|
|
6348
6505
|
strokeLinejoin: "round"
|
|
6349
6506
|
}), /* @__PURE__ */ jsx("path", {
|
|
6350
|
-
d: "
|
|
6351
|
-
stroke:
|
|
6352
|
-
strokeWidth: "1
|
|
6507
|
+
d: "M34 29c3 0 5 2 5 4s-2 4-5 4h-6v-4c0-2 3-4 6-4Z",
|
|
6508
|
+
stroke: palette.wallpaperStroke,
|
|
6509
|
+
strokeWidth: "1",
|
|
6353
6510
|
fill: "none",
|
|
6511
|
+
opacity: palette.wallpaperOpacity,
|
|
6354
6512
|
strokeLinecap: "round",
|
|
6355
6513
|
strokeLinejoin: "round"
|
|
6356
6514
|
})]
|
|
@@ -6361,11 +6519,16 @@ function WhatsAppWallpaper() {
|
|
|
6361
6519
|
})]
|
|
6362
6520
|
});
|
|
6363
6521
|
}
|
|
6364
|
-
function WhatsAppComposer({ composerPlaceholder }) {
|
|
6522
|
+
function WhatsAppComposer({ composerPlaceholder, palette }) {
|
|
6365
6523
|
return /* @__PURE__ */ jsxs("div", {
|
|
6366
|
-
className: "flex items-center gap-1.5
|
|
6524
|
+
className: "flex items-center gap-1.5 px-2 pb-[22px] pt-2",
|
|
6525
|
+
style: { backgroundColor: palette.composer },
|
|
6367
6526
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
6368
|
-
className: "flex min-w-0 flex-1 items-center gap-1.5 rounded-full
|
|
6527
|
+
className: "flex min-w-0 flex-1 items-center gap-1.5 rounded-full px-2.5 py-1.5 shadow-[0_1px_1px_rgba(15,23,42,0.06)]",
|
|
6528
|
+
style: {
|
|
6529
|
+
backgroundColor: palette.composerInput,
|
|
6530
|
+
color: palette.composerText
|
|
6531
|
+
},
|
|
6369
6532
|
children: [
|
|
6370
6533
|
/* @__PURE__ */ jsx(Smile, {
|
|
6371
6534
|
className: "h-3.5 w-3.5 shrink-0",
|
|
@@ -6388,7 +6551,11 @@ function WhatsAppComposer({ composerPlaceholder }) {
|
|
|
6388
6551
|
})
|
|
6389
6552
|
]
|
|
6390
6553
|
}), /* @__PURE__ */ jsx("span", {
|
|
6391
|
-
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full
|
|
6554
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full",
|
|
6555
|
+
style: {
|
|
6556
|
+
backgroundColor: palette.micBg,
|
|
6557
|
+
color: palette.micIcon
|
|
6558
|
+
},
|
|
6392
6559
|
children: /* @__PURE__ */ jsx(Mic, {
|
|
6393
6560
|
className: "h-3.5 w-3.5",
|
|
6394
6561
|
strokeWidth: 2.2,
|