@tree-ia/design-system 2.3.0 → 2.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/dist/index.d.mts +9 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +261 -67
- 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,79 @@ const DEFAULT_WAVEFORM = [
|
|
|
6097
6097
|
29,
|
|
6098
6098
|
17
|
|
6099
6099
|
];
|
|
6100
|
+
const FALLBACK_STATUS_TIME = "14:32";
|
|
6101
|
+
const WHATSAPP_PALETTES = {
|
|
6102
|
+
dark: {
|
|
6103
|
+
frame: "#0a0d12",
|
|
6104
|
+
statusbar: "#111b21",
|
|
6105
|
+
statusText: "#e9edef",
|
|
6106
|
+
screen: "#0b141a",
|
|
6107
|
+
header: "#111b21",
|
|
6108
|
+
headerText: "#e9edef",
|
|
6109
|
+
mutedText: "#aebac1",
|
|
6110
|
+
subtleText: "#8696a0",
|
|
6111
|
+
action: "#00a884",
|
|
6112
|
+
wallpaperStroke: "#e9edef",
|
|
6113
|
+
wallpaperOpacity: .045,
|
|
6114
|
+
dateBg: "#182229",
|
|
6115
|
+
dateText: "#aebac1",
|
|
6116
|
+
noticeBg: "#182229",
|
|
6117
|
+
noticeText: "#d0b66b",
|
|
6118
|
+
incoming: "#202c33",
|
|
6119
|
+
incomingText: "#e9edef",
|
|
6120
|
+
outgoing: "#005c4b",
|
|
6121
|
+
outgoingText: "#e9edef",
|
|
6122
|
+
outgoingMeta: "#c7d4cf",
|
|
6123
|
+
read: "#53bdeb",
|
|
6124
|
+
avatarBg: "#60b531",
|
|
6125
|
+
composer: "#111b21",
|
|
6126
|
+
composerInput: "#202c33",
|
|
6127
|
+
composerText: "#8696a0",
|
|
6128
|
+
micBg: "#00a884",
|
|
6129
|
+
micIcon: "#07130f",
|
|
6130
|
+
audioWave: "#9ad8ca",
|
|
6131
|
+
audioButtonBg: "#00a884",
|
|
6132
|
+
shadow: "rgba(0, 0, 0, 0.22)"
|
|
6133
|
+
},
|
|
6134
|
+
light: {
|
|
6135
|
+
frame: "#0a0d12",
|
|
6136
|
+
statusbar: "#f7f5f0",
|
|
6137
|
+
statusText: "#111b21",
|
|
6138
|
+
screen: "#efe7db",
|
|
6139
|
+
header: "#f7f5f0",
|
|
6140
|
+
headerText: "#111b21",
|
|
6141
|
+
mutedText: "#667781",
|
|
6142
|
+
subtleText: "#667781",
|
|
6143
|
+
action: "#008069",
|
|
6144
|
+
wallpaperStroke: "#7d6f59",
|
|
6145
|
+
wallpaperOpacity: .075,
|
|
6146
|
+
dateBg: "rgba(255, 255, 255, 0.88)",
|
|
6147
|
+
dateText: "#6b6255",
|
|
6148
|
+
noticeBg: "#fff7d6",
|
|
6149
|
+
noticeText: "#7a6420",
|
|
6150
|
+
incoming: "#ffffff",
|
|
6151
|
+
incomingText: "#111b21",
|
|
6152
|
+
outgoing: "#d9fdd3",
|
|
6153
|
+
outgoingText: "#111b13",
|
|
6154
|
+
outgoingMeta: "#66756b",
|
|
6155
|
+
read: "#53bdeb",
|
|
6156
|
+
avatarBg: "#60b531",
|
|
6157
|
+
composer: "#f7f5f0",
|
|
6158
|
+
composerInput: "#ffffff",
|
|
6159
|
+
composerText: "#667781",
|
|
6160
|
+
micBg: "#00a884",
|
|
6161
|
+
micIcon: "#ffffff",
|
|
6162
|
+
audioWave: "#177866",
|
|
6163
|
+
audioButtonBg: "#00a884",
|
|
6164
|
+
shadow: "rgba(15, 23, 42, 0.11)"
|
|
6165
|
+
}
|
|
6166
|
+
};
|
|
6100
6167
|
const cn$2 = (...classes) => classes.filter(Boolean).join(" ");
|
|
6101
|
-
function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, profileType = "business", contactSubtitle, messages = [], statusTime
|
|
6168
|
+
function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, profileType = "business", contactSubtitle, theme = "dark", headerBackgroundColor, profileAvatarBackgroundColor, messages = [], statusTime, 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 }) {
|
|
6169
|
+
const palette = WHATSAPP_PALETTES[theme];
|
|
6170
|
+
const resolvedStatusTime = useResolvedStatusTime(statusTime);
|
|
6171
|
+
const resolvedFrameColor = frameColor ?? palette.frame;
|
|
6172
|
+
const resolvedStatusbarColor = statusbarColor ?? palette.statusbar;
|
|
6102
6173
|
const subtitle = contactSubtitle === void 0 ? profileType === "business" ? "WhatsApp Business" : void 0 : contactSubtitle || void 0;
|
|
6103
6174
|
return /* @__PURE__ */ jsx("div", {
|
|
6104
6175
|
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 +6177,24 @@ function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAva
|
|
|
6106
6177
|
children: /* @__PURE__ */ jsx(IPhoneMockup, {
|
|
6107
6178
|
screenWidth,
|
|
6108
6179
|
screenType: "island",
|
|
6109
|
-
frameColor,
|
|
6110
|
-
statusbarColor,
|
|
6180
|
+
frameColor: resolvedFrameColor,
|
|
6181
|
+
statusbarColor: resolvedStatusbarColor,
|
|
6111
6182
|
hideNavBar: true,
|
|
6112
6183
|
frameOnly,
|
|
6113
6184
|
hideStatusBar,
|
|
6114
6185
|
containerStyle,
|
|
6115
6186
|
className: phoneClassName,
|
|
6116
6187
|
children: /* @__PURE__ */ jsxs("div", {
|
|
6117
|
-
className: cn$2("flex h-full w-full flex-col
|
|
6188
|
+
className: cn$2("flex h-full w-full flex-col", screenClassName),
|
|
6189
|
+
style: {
|
|
6190
|
+
backgroundColor: palette.screen,
|
|
6191
|
+
color: palette.headerText
|
|
6192
|
+
},
|
|
6118
6193
|
children: [
|
|
6119
6194
|
/* @__PURE__ */ jsx(StatusBar, {
|
|
6120
|
-
time:
|
|
6121
|
-
screenWidth
|
|
6195
|
+
time: resolvedStatusTime,
|
|
6196
|
+
screenWidth,
|
|
6197
|
+
palette
|
|
6122
6198
|
}),
|
|
6123
6199
|
/* @__PURE__ */ jsx(WhatsAppHeader, {
|
|
6124
6200
|
contactName,
|
|
@@ -6126,75 +6202,152 @@ function WhatsAppMockup({ contactName, profilePhoto, profilePhotoAlt, profileAva
|
|
|
6126
6202
|
profilePhoto,
|
|
6127
6203
|
profilePhotoAlt,
|
|
6128
6204
|
profileAvatar,
|
|
6129
|
-
showActions: showHeaderActions
|
|
6205
|
+
showActions: showHeaderActions,
|
|
6206
|
+
backgroundColor: headerBackgroundColor ?? palette.header,
|
|
6207
|
+
avatarBackgroundColor: profileAvatarBackgroundColor ?? palette.avatarBg,
|
|
6208
|
+
palette
|
|
6130
6209
|
}),
|
|
6131
6210
|
/* @__PURE__ */ jsxs("div", {
|
|
6132
6211
|
className: cn$2("relative flex flex-1 flex-col gap-2 overflow-hidden px-2.5 py-2.5", messagesClassName),
|
|
6133
6212
|
children: [
|
|
6134
|
-
showWallpaper ? /* @__PURE__ */ jsx(WhatsAppWallpaper, {}) : null,
|
|
6213
|
+
showWallpaper ? /* @__PURE__ */ jsx(WhatsAppWallpaper, { palette }) : null,
|
|
6135
6214
|
dateLabel ? /* @__PURE__ */ jsx("div", {
|
|
6136
|
-
className: "relative z-10 mx-auto rounded-full
|
|
6215
|
+
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)]",
|
|
6216
|
+
style: {
|
|
6217
|
+
backgroundColor: palette.dateBg,
|
|
6218
|
+
color: palette.dateText
|
|
6219
|
+
},
|
|
6137
6220
|
children: dateLabel
|
|
6138
6221
|
}) : null,
|
|
6139
6222
|
encryptionNotice ? /* @__PURE__ */ jsx("div", {
|
|
6140
|
-
className: "relative z-10 mx-auto max-w-[92%] rounded-md
|
|
6223
|
+
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)]",
|
|
6224
|
+
style: {
|
|
6225
|
+
backgroundColor: palette.noticeBg,
|
|
6226
|
+
color: palette.noticeText
|
|
6227
|
+
},
|
|
6141
6228
|
children: encryptionNotice
|
|
6142
6229
|
}) : null,
|
|
6143
|
-
messages.map((message, index) => /* @__PURE__ */ jsx(WhatsAppMessageBubble, {
|
|
6230
|
+
messages.map((message, index) => /* @__PURE__ */ jsx(WhatsAppMessageBubble, {
|
|
6231
|
+
message,
|
|
6232
|
+
palette
|
|
6233
|
+
}, message.id ?? `${message.time}-${index}`))
|
|
6144
6234
|
]
|
|
6145
6235
|
}),
|
|
6146
|
-
showComposer ? composer ?? /* @__PURE__ */ jsx(WhatsAppComposer, {
|
|
6236
|
+
showComposer ? composer ?? /* @__PURE__ */ jsx(WhatsAppComposer, {
|
|
6237
|
+
composerPlaceholder,
|
|
6238
|
+
palette
|
|
6239
|
+
}) : null
|
|
6147
6240
|
]
|
|
6148
6241
|
})
|
|
6149
6242
|
})
|
|
6150
6243
|
});
|
|
6151
6244
|
}
|
|
6152
|
-
function
|
|
6245
|
+
function useResolvedStatusTime(statusTime) {
|
|
6246
|
+
const [currentTime, setCurrentTime] = useState(FALLBACK_STATUS_TIME);
|
|
6247
|
+
useEffect(() => {
|
|
6248
|
+
if (statusTime) return;
|
|
6249
|
+
const updateCurrentTime = () => {
|
|
6250
|
+
setCurrentTime(formatStatusTime(/* @__PURE__ */ new Date()));
|
|
6251
|
+
};
|
|
6252
|
+
updateCurrentTime();
|
|
6253
|
+
let interval;
|
|
6254
|
+
const now = /* @__PURE__ */ new Date();
|
|
6255
|
+
const nextMinuteDelay = (60 - now.getSeconds()) * 1e3 - now.getMilliseconds();
|
|
6256
|
+
const timeout = window.setTimeout(() => {
|
|
6257
|
+
updateCurrentTime();
|
|
6258
|
+
interval = window.setInterval(updateCurrentTime, 6e4);
|
|
6259
|
+
}, nextMinuteDelay);
|
|
6260
|
+
return () => {
|
|
6261
|
+
window.clearTimeout(timeout);
|
|
6262
|
+
if (interval !== void 0) window.clearInterval(interval);
|
|
6263
|
+
};
|
|
6264
|
+
}, [statusTime]);
|
|
6265
|
+
return statusTime ?? currentTime;
|
|
6266
|
+
}
|
|
6267
|
+
function formatStatusTime(date) {
|
|
6268
|
+
return `${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
|
|
6269
|
+
}
|
|
6270
|
+
function StatusBar({ time, screenWidth, palette }) {
|
|
6153
6271
|
return /* @__PURE__ */ jsxs("div", {
|
|
6154
6272
|
"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
|
|
6273
|
+
className: "absolute left-0 right-0 top-0 z-50 flex items-center justify-between px-6 text-[11px] font-semibold tracking-tight",
|
|
6156
6274
|
style: { height: `${Math.floor(screenWidth * 59 / 390)}px` },
|
|
6157
6275
|
children: [/* @__PURE__ */ jsx("span", {
|
|
6158
6276
|
className: "tabular-nums",
|
|
6277
|
+
style: { color: palette.statusText },
|
|
6159
6278
|
children: time
|
|
6160
6279
|
}), /* @__PURE__ */ jsxs("div", {
|
|
6161
6280
|
className: "flex items-center gap-1",
|
|
6281
|
+
style: { color: palette.statusText },
|
|
6162
6282
|
children: [
|
|
6163
|
-
/* @__PURE__ */ jsx(
|
|
6164
|
-
className: "h-3 w-3",
|
|
6165
|
-
strokeWidth: 2.4,
|
|
6166
|
-
"aria-hidden": true
|
|
6167
|
-
}),
|
|
6283
|
+
/* @__PURE__ */ jsx(IosSignal, { color: palette.statusText }),
|
|
6168
6284
|
/* @__PURE__ */ jsx(Wifi, {
|
|
6169
6285
|
className: "h-3 w-3",
|
|
6170
6286
|
strokeWidth: 2.4,
|
|
6171
6287
|
"aria-hidden": true
|
|
6172
6288
|
}),
|
|
6173
|
-
/* @__PURE__ */ jsx(
|
|
6174
|
-
className: "h-3.5 w-3.5",
|
|
6175
|
-
strokeWidth: 2.4,
|
|
6176
|
-
"aria-hidden": true
|
|
6177
|
-
})
|
|
6289
|
+
/* @__PURE__ */ jsx(IosBattery, { color: palette.statusText })
|
|
6178
6290
|
]
|
|
6179
6291
|
})]
|
|
6180
6292
|
});
|
|
6181
6293
|
}
|
|
6182
|
-
function
|
|
6294
|
+
function IosSignal({ color }) {
|
|
6295
|
+
return /* @__PURE__ */ jsx("span", {
|
|
6296
|
+
className: "flex h-3 w-3 items-end gap-[1px]",
|
|
6297
|
+
"aria-hidden": true,
|
|
6298
|
+
children: [
|
|
6299
|
+
4,
|
|
6300
|
+
6,
|
|
6301
|
+
8,
|
|
6302
|
+
10
|
|
6303
|
+
].map((height) => /* @__PURE__ */ jsx("span", {
|
|
6304
|
+
className: "w-[2px] rounded-sm",
|
|
6305
|
+
style: {
|
|
6306
|
+
height,
|
|
6307
|
+
backgroundColor: color
|
|
6308
|
+
}
|
|
6309
|
+
}, height))
|
|
6310
|
+
});
|
|
6311
|
+
}
|
|
6312
|
+
function IosBattery({ color }) {
|
|
6313
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
6314
|
+
className: "flex items-center gap-[1px]",
|
|
6315
|
+
"aria-hidden": true,
|
|
6316
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6317
|
+
className: "relative h-[8px] w-[16px] rounded-[2px] border",
|
|
6318
|
+
style: { borderColor: color },
|
|
6319
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
6320
|
+
className: "absolute bottom-[1px] left-[1px] top-[1px] w-[10px] rounded-[1px]",
|
|
6321
|
+
style: { backgroundColor: color }
|
|
6322
|
+
})
|
|
6323
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6324
|
+
className: "h-[4px] w-[1.5px] rounded-r",
|
|
6325
|
+
style: { backgroundColor: color }
|
|
6326
|
+
})]
|
|
6327
|
+
});
|
|
6328
|
+
}
|
|
6329
|
+
function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt, profileAvatar, showActions, backgroundColor, avatarBackgroundColor, palette }) {
|
|
6183
6330
|
return /* @__PURE__ */ jsx("div", {
|
|
6184
|
-
className: "relative
|
|
6331
|
+
className: "relative shadow-[0_1px_0_rgba(17,27,33,0.08)]",
|
|
6332
|
+
style: {
|
|
6333
|
+
backgroundColor,
|
|
6334
|
+
color: palette.headerText
|
|
6335
|
+
},
|
|
6185
6336
|
children: /* @__PURE__ */ jsxs("div", {
|
|
6186
6337
|
className: "flex items-center gap-2 px-2.5 pb-2 pt-2",
|
|
6187
6338
|
children: [
|
|
6188
6339
|
/* @__PURE__ */ jsx(ChevronLeft, {
|
|
6189
|
-
className: "h-5 w-5 shrink-0
|
|
6340
|
+
className: "h-5 w-5 shrink-0",
|
|
6190
6341
|
strokeWidth: 2.4,
|
|
6342
|
+
style: { color: palette.action },
|
|
6191
6343
|
"aria-hidden": true
|
|
6192
6344
|
}),
|
|
6193
6345
|
/* @__PURE__ */ jsx(ProfileAvatar, {
|
|
6194
6346
|
contactName,
|
|
6195
6347
|
profilePhoto,
|
|
6196
6348
|
profilePhotoAlt,
|
|
6197
|
-
profileAvatar
|
|
6349
|
+
profileAvatar,
|
|
6350
|
+
backgroundColor: avatarBackgroundColor
|
|
6198
6351
|
}),
|
|
6199
6352
|
/* @__PURE__ */ jsxs("div", {
|
|
6200
6353
|
className: "min-w-0 flex-1",
|
|
@@ -6202,24 +6355,28 @@ function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt,
|
|
|
6202
6355
|
className: "truncate text-[13px] font-semibold leading-tight",
|
|
6203
6356
|
children: contactName
|
|
6204
6357
|
}), subtitle ? /* @__PURE__ */ jsx("p", {
|
|
6205
|
-
className: "truncate text-[10px] leading-tight
|
|
6358
|
+
className: "truncate text-[10px] leading-tight",
|
|
6359
|
+
style: { color: palette.mutedText },
|
|
6206
6360
|
children: subtitle
|
|
6207
6361
|
}) : null]
|
|
6208
6362
|
}),
|
|
6209
6363
|
showActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6210
6364
|
/* @__PURE__ */ jsx(Video, {
|
|
6211
|
-
className: "h-4 w-4 shrink-0
|
|
6365
|
+
className: "h-4 w-4 shrink-0",
|
|
6212
6366
|
strokeWidth: 2.2,
|
|
6367
|
+
style: { color: palette.action },
|
|
6213
6368
|
"aria-hidden": true
|
|
6214
6369
|
}),
|
|
6215
6370
|
/* @__PURE__ */ jsx(Phone, {
|
|
6216
|
-
className: "h-3.5 w-3.5 shrink-0
|
|
6371
|
+
className: "h-3.5 w-3.5 shrink-0",
|
|
6217
6372
|
strokeWidth: 2.2,
|
|
6373
|
+
style: { color: palette.action },
|
|
6218
6374
|
"aria-hidden": true
|
|
6219
6375
|
}),
|
|
6220
6376
|
/* @__PURE__ */ jsx(MoreVertical, {
|
|
6221
|
-
className: "h-4 w-4 shrink-0
|
|
6377
|
+
className: "h-4 w-4 shrink-0",
|
|
6222
6378
|
strokeWidth: 2.2,
|
|
6379
|
+
style: { color: palette.action },
|
|
6223
6380
|
"aria-hidden": true
|
|
6224
6381
|
})
|
|
6225
6382
|
] }) : null
|
|
@@ -6227,18 +6384,21 @@ function WhatsAppHeader({ contactName, subtitle, profilePhoto, profilePhotoAlt,
|
|
|
6227
6384
|
})
|
|
6228
6385
|
});
|
|
6229
6386
|
}
|
|
6230
|
-
function ProfileAvatar({ contactName, profilePhoto, profilePhotoAlt, profileAvatar }) {
|
|
6387
|
+
function ProfileAvatar({ contactName, profilePhoto, profilePhotoAlt, profileAvatar, backgroundColor }) {
|
|
6231
6388
|
if (profileAvatar) return /* @__PURE__ */ jsx("div", {
|
|
6232
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full
|
|
6389
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
6390
|
+
style: { backgroundColor },
|
|
6233
6391
|
children: profileAvatar
|
|
6234
6392
|
});
|
|
6235
6393
|
if (profilePhoto) return /* @__PURE__ */ jsx("img", {
|
|
6236
6394
|
src: profilePhoto,
|
|
6237
6395
|
alt: profilePhotoAlt ?? contactName,
|
|
6238
|
-
className: "h-8 w-8 shrink-0 rounded-full
|
|
6396
|
+
className: "h-8 w-8 shrink-0 rounded-full object-cover",
|
|
6397
|
+
style: { backgroundColor }
|
|
6239
6398
|
});
|
|
6240
6399
|
return /* @__PURE__ */ jsx("div", {
|
|
6241
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full
|
|
6400
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-[11px] font-bold uppercase text-white",
|
|
6401
|
+
style: { backgroundColor },
|
|
6242
6402
|
children: getInitials(contactName)
|
|
6243
6403
|
});
|
|
6244
6404
|
}
|
|
@@ -6246,20 +6406,30 @@ function getInitials(name) {
|
|
|
6246
6406
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
6247
6407
|
return `${parts[0]?.[0] ?? "W"}${(parts.length > 1 ? parts[parts.length - 1]?.[0] : void 0) ?? ""}`;
|
|
6248
6408
|
}
|
|
6249
|
-
function WhatsAppMessageBubble({ message }) {
|
|
6409
|
+
function WhatsAppMessageBubble({ message, palette }) {
|
|
6250
6410
|
const direction = message.direction ?? "outgoing";
|
|
6251
6411
|
const type = message.type ?? "text";
|
|
6252
6412
|
const isOutgoing = direction === "outgoing";
|
|
6413
|
+
const bubbleColor = isOutgoing ? palette.outgoing : palette.incoming;
|
|
6253
6414
|
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]
|
|
6415
|
+
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),
|
|
6416
|
+
style: {
|
|
6417
|
+
backgroundColor: bubbleColor,
|
|
6418
|
+
color: isOutgoing ? palette.outgoingText : palette.incomingText,
|
|
6419
|
+
boxShadow: `0 1px 1.5px ${palette.shadow}`,
|
|
6420
|
+
...message.style
|
|
6421
|
+
},
|
|
6255
6422
|
children: [
|
|
6256
6423
|
/* @__PURE__ */ jsx(BubbleTail, {
|
|
6257
6424
|
side: isOutgoing ? "out" : "in",
|
|
6258
|
-
|
|
6425
|
+
color: message.style?.backgroundColor?.toString() ?? bubbleColor
|
|
6259
6426
|
}),
|
|
6260
6427
|
/* @__PURE__ */ jsx("div", {
|
|
6261
6428
|
className: message.contentClassName,
|
|
6262
|
-
children: message.children ?? (type === "audio" ? /* @__PURE__ */ jsx(AudioMessage, {
|
|
6429
|
+
children: message.children ?? (type === "audio" ? /* @__PURE__ */ jsx(AudioMessage, {
|
|
6430
|
+
message,
|
|
6431
|
+
palette
|
|
6432
|
+
}) : type === "custom" ? null : /* @__PURE__ */ jsx("p", {
|
|
6263
6433
|
className: "max-w-[31ch] text-[10.5px] leading-snug",
|
|
6264
6434
|
children: message.text
|
|
6265
6435
|
}))
|
|
@@ -6267,18 +6437,23 @@ function WhatsAppMessageBubble({ message }) {
|
|
|
6267
6437
|
message.hideMeta ? null : /* @__PURE__ */ jsx(MessageMeta, {
|
|
6268
6438
|
time: message.time,
|
|
6269
6439
|
direction,
|
|
6270
|
-
read: message.read
|
|
6440
|
+
read: message.read,
|
|
6441
|
+
palette
|
|
6271
6442
|
})
|
|
6272
6443
|
]
|
|
6273
6444
|
});
|
|
6274
6445
|
}
|
|
6275
|
-
function AudioMessage({ message }) {
|
|
6446
|
+
function AudioMessage({ message, palette }) {
|
|
6276
6447
|
const waveform = message.waveform ?? DEFAULT_WAVEFORM;
|
|
6277
6448
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
6278
6449
|
className: "flex items-center gap-2",
|
|
6279
6450
|
children: [
|
|
6280
6451
|
/* @__PURE__ */ jsx("span", {
|
|
6281
|
-
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full
|
|
6452
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full",
|
|
6453
|
+
style: {
|
|
6454
|
+
backgroundColor: palette.audioButtonBg,
|
|
6455
|
+
color: palette.micIcon
|
|
6456
|
+
},
|
|
6282
6457
|
children: /* @__PURE__ */ jsx(Play, {
|
|
6283
6458
|
className: "ml-0.5 h-3.5 w-3.5 fill-current",
|
|
6284
6459
|
strokeWidth: 2.2,
|
|
@@ -6289,68 +6464,78 @@ function AudioMessage({ message }) {
|
|
|
6289
6464
|
className: "flex h-7 flex-1 items-center gap-[2px]",
|
|
6290
6465
|
"aria-hidden": true,
|
|
6291
6466
|
children: waveform.map((height, index) => /* @__PURE__ */ jsx("span", {
|
|
6292
|
-
className: "origin-center rounded-full
|
|
6467
|
+
className: "origin-center rounded-full",
|
|
6293
6468
|
style: {
|
|
6469
|
+
backgroundColor: palette.audioWave,
|
|
6294
6470
|
height: Math.max(8, Math.round(height * .78)),
|
|
6471
|
+
opacity: .76,
|
|
6295
6472
|
width: 2
|
|
6296
6473
|
}
|
|
6297
6474
|
}, `${height}-${index}`))
|
|
6298
6475
|
}),
|
|
6299
6476
|
message.duration ? /* @__PURE__ */ jsx("span", {
|
|
6300
|
-
className: "text-[10px] font-medium
|
|
6477
|
+
className: "text-[10px] font-medium",
|
|
6478
|
+
style: { color: palette.outgoingMeta },
|
|
6301
6479
|
children: message.duration
|
|
6302
6480
|
}) : null
|
|
6303
6481
|
]
|
|
6304
6482
|
}), message.text ? /* @__PURE__ */ jsx("p", {
|
|
6305
|
-
className: "mt-1.5 max-w-[29ch] text-[9.5px] leading-snug
|
|
6483
|
+
className: "mt-1.5 max-w-[29ch] text-[9.5px] leading-snug",
|
|
6484
|
+
style: { color: palette.outgoingMeta },
|
|
6306
6485
|
children: message.text
|
|
6307
6486
|
}) : null] });
|
|
6308
6487
|
}
|
|
6309
|
-
function MessageMeta({ time, direction, read }) {
|
|
6488
|
+
function MessageMeta({ time, direction, read, palette }) {
|
|
6489
|
+
const isOutgoing = direction === "outgoing";
|
|
6310
6490
|
return /* @__PURE__ */ jsxs("div", {
|
|
6311
|
-
className: "mt-1 flex items-center justify-end gap-1 text-[9px]
|
|
6312
|
-
|
|
6491
|
+
className: "mt-1 flex items-center justify-end gap-1 text-[9px]",
|
|
6492
|
+
style: { color: isOutgoing ? palette.outgoingMeta : palette.subtleText },
|
|
6493
|
+
children: [/* @__PURE__ */ jsx("span", { children: time }), isOutgoing ? read === void 0 ? /* @__PURE__ */ jsx(Check, {
|
|
6313
6494
|
className: "h-3 w-3",
|
|
6314
6495
|
strokeWidth: 2.5,
|
|
6315
6496
|
"aria-hidden": true
|
|
6316
6497
|
}) : /* @__PURE__ */ jsx(CheckCheck, {
|
|
6317
|
-
className:
|
|
6498
|
+
className: "h-3 w-3",
|
|
6318
6499
|
strokeWidth: 2.5,
|
|
6500
|
+
style: { color: read ? palette.read : void 0 },
|
|
6319
6501
|
"aria-hidden": true
|
|
6320
6502
|
}) : null]
|
|
6321
6503
|
});
|
|
6322
6504
|
}
|
|
6323
|
-
function BubbleTail({ side,
|
|
6505
|
+
function BubbleTail({ side, color }) {
|
|
6324
6506
|
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
6507
|
return /* @__PURE__ */ jsx("svg", {
|
|
6326
6508
|
"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]"
|
|
6509
|
+
className: cn$2("pointer-events-none absolute top-0 h-3.5 w-3.5", side === "out" ? "-right-[7px]" : "-left-[7px]"),
|
|
6510
|
+
style: { fill: color },
|
|
6328
6511
|
viewBox: "0 0 14 12",
|
|
6329
6512
|
children: /* @__PURE__ */ jsx("path", { d: path })
|
|
6330
6513
|
});
|
|
6331
6514
|
}
|
|
6332
|
-
function WhatsAppWallpaper() {
|
|
6515
|
+
function WhatsAppWallpaper({ palette }) {
|
|
6333
6516
|
const patternId = useId().replace(/:/g, "");
|
|
6334
6517
|
return /* @__PURE__ */ jsxs("svg", {
|
|
6335
6518
|
"aria-hidden": true,
|
|
6336
|
-
className: "pointer-events-none absolute inset-0 h-full w-full
|
|
6519
|
+
className: "pointer-events-none absolute inset-0 h-full w-full",
|
|
6337
6520
|
children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("pattern", {
|
|
6338
6521
|
id: patternId,
|
|
6339
|
-
width: "
|
|
6340
|
-
height: "
|
|
6522
|
+
width: "46",
|
|
6523
|
+
height: "46",
|
|
6341
6524
|
patternUnits: "userSpaceOnUse",
|
|
6342
6525
|
children: [/* @__PURE__ */ jsx("path", {
|
|
6343
|
-
d: "
|
|
6344
|
-
stroke:
|
|
6345
|
-
strokeWidth: "1
|
|
6526
|
+
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",
|
|
6527
|
+
stroke: palette.wallpaperStroke,
|
|
6528
|
+
strokeWidth: "1",
|
|
6346
6529
|
fill: "none",
|
|
6530
|
+
opacity: palette.wallpaperOpacity,
|
|
6347
6531
|
strokeLinecap: "round",
|
|
6348
6532
|
strokeLinejoin: "round"
|
|
6349
6533
|
}), /* @__PURE__ */ jsx("path", {
|
|
6350
|
-
d: "
|
|
6351
|
-
stroke:
|
|
6352
|
-
strokeWidth: "1
|
|
6534
|
+
d: "M34 29c3 0 5 2 5 4s-2 4-5 4h-6v-4c0-2 3-4 6-4Z",
|
|
6535
|
+
stroke: palette.wallpaperStroke,
|
|
6536
|
+
strokeWidth: "1",
|
|
6353
6537
|
fill: "none",
|
|
6538
|
+
opacity: palette.wallpaperOpacity,
|
|
6354
6539
|
strokeLinecap: "round",
|
|
6355
6540
|
strokeLinejoin: "round"
|
|
6356
6541
|
})]
|
|
@@ -6361,11 +6546,16 @@ function WhatsAppWallpaper() {
|
|
|
6361
6546
|
})]
|
|
6362
6547
|
});
|
|
6363
6548
|
}
|
|
6364
|
-
function WhatsAppComposer({ composerPlaceholder }) {
|
|
6549
|
+
function WhatsAppComposer({ composerPlaceholder, palette }) {
|
|
6365
6550
|
return /* @__PURE__ */ jsxs("div", {
|
|
6366
|
-
className: "flex items-center gap-1.5
|
|
6551
|
+
className: "flex items-center gap-1.5 px-2 pb-[22px] pt-2",
|
|
6552
|
+
style: { backgroundColor: palette.composer },
|
|
6367
6553
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
6368
|
-
className: "flex min-w-0 flex-1 items-center gap-1.5 rounded-full
|
|
6554
|
+
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)]",
|
|
6555
|
+
style: {
|
|
6556
|
+
backgroundColor: palette.composerInput,
|
|
6557
|
+
color: palette.composerText
|
|
6558
|
+
},
|
|
6369
6559
|
children: [
|
|
6370
6560
|
/* @__PURE__ */ jsx(Smile, {
|
|
6371
6561
|
className: "h-3.5 w-3.5 shrink-0",
|
|
@@ -6388,7 +6578,11 @@ function WhatsAppComposer({ composerPlaceholder }) {
|
|
|
6388
6578
|
})
|
|
6389
6579
|
]
|
|
6390
6580
|
}), /* @__PURE__ */ jsx("span", {
|
|
6391
|
-
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full
|
|
6581
|
+
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full",
|
|
6582
|
+
style: {
|
|
6583
|
+
backgroundColor: palette.micBg,
|
|
6584
|
+
color: palette.micIcon
|
|
6585
|
+
},
|
|
6392
6586
|
children: /* @__PURE__ */ jsx(Mic, {
|
|
6393
6587
|
className: "h-3.5 w-3.5",
|
|
6394
6588
|
strokeWidth: 2.2,
|