@arbidocs/react 0.3.159 → 0.3.161
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.cjs +285 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -6
- package/dist/index.d.ts +60 -6
- package/dist/index.js +287 -122
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn, Avatar, AvatarFallback, AvatarImage, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, AiMarkdown, Card, Button, Badge, MarkdownRenderer, Input, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, ScrollArea, Textarea, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DropdownMenuLabel, DropdownMenuSeparator,
|
|
1
|
+
import { cn, Avatar, AvatarFallback, AvatarImage, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, AiMarkdown, Card, Button, Badge, MarkdownRenderer, Input, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, ScrollArea, DropdownMenuItem, Textarea, Slider, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DropdownMenuLabel, DropdownMenuSeparator, Checkbox } from './chunk-VTX77MYP.js';
|
|
2
2
|
export { AiMarkdown, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, MarkdownRenderer, MarkdownStreamingContext, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cardVariants, cn, markdownBaseComponents, splitMarkdownBlocks, toggleVariants } from './chunk-VTX77MYP.js';
|
|
3
3
|
import { useArbi, ArbiProvider } from './chunk-J4MX2W4H.js';
|
|
4
4
|
export { ArbiProvider, useArbi } from './chunk-J4MX2W4H.js';
|
|
@@ -7,7 +7,7 @@ import { useQuery, useMutation, useQueries, QueryClient, QueryClientProvider, us
|
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { connectWithReconnect, resolveCitations, summarizeCitations } from '@arbidocs/sdk/browser';
|
|
9
9
|
export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
|
|
10
|
-
import { Trash2, CheckCheck, Check, MessageCircleMore, MoreVertical, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench,
|
|
10
|
+
import { Link, Trash2, CheckCheck, Check, MessageCircleMore, MoreVertical, MessageSquareLock, Info, FileQuestion, BookOpen, Upload, LogOut, LayoutGrid, Bell, MessageSquare, CircleUserRound, Wrench, CreditCard, ClipboardList, UserPlus, UserStar, Settings2, Users, User, NotebookPen, NotebookText, StickyNote, FolderPlus, Hash, EyeOff, Eye, CaptionsOff, FolderOpen, MessageSquareMore, MessageSquarePlus, MessageSquareText, MessageSquareOff, MessagesSquare, Columns3Cog, SquarePlus, SquareM, ChevronsDown, Bot, Calendar, Search, Folder, List, SquareCheckBig, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image as Image$1, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Activity, Gauge, Gift, PartyPopper, UserCheck, FileX2, FileCheck2, Pencil, SquareArrowOutUpRight, BellOff, XCircle, CheckCircle2, ArrowRight, ChevronDown, MoreHorizontal, SquarePen, FileX, SkipForward, CheckCircle } from 'lucide-react';
|
|
11
11
|
import { isMessageType } from '@arbidocs/client';
|
|
12
12
|
export { isMessageType } from '@arbidocs/client';
|
|
13
13
|
import { create } from 'zustand';
|
|
@@ -1346,6 +1346,9 @@ var ChatBubble = memo(function ChatBubble2({
|
|
|
1346
1346
|
deleted,
|
|
1347
1347
|
read,
|
|
1348
1348
|
onDelete,
|
|
1349
|
+
onCopyLink,
|
|
1350
|
+
id,
|
|
1351
|
+
highlighted,
|
|
1349
1352
|
isLastOfRun = true,
|
|
1350
1353
|
senderName,
|
|
1351
1354
|
classNames,
|
|
@@ -1355,11 +1358,12 @@ var ChatBubble = memo(function ChatBubble2({
|
|
|
1355
1358
|
}) {
|
|
1356
1359
|
const [isHovered, setIsHovered] = useState(false);
|
|
1357
1360
|
const [isFocused, setIsFocused] = useState(false);
|
|
1358
|
-
const
|
|
1361
|
+
const showActions = isHovered || isFocused;
|
|
1359
1362
|
if (deleted) {
|
|
1360
1363
|
return /* @__PURE__ */ jsx(
|
|
1361
1364
|
"div",
|
|
1362
1365
|
{
|
|
1366
|
+
id,
|
|
1363
1367
|
"data-testid": testId,
|
|
1364
1368
|
className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
|
|
1365
1369
|
children: /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
|
|
@@ -1372,9 +1376,25 @@ var ChatBubble = memo(function ChatBubble2({
|
|
|
1372
1376
|
!isSent && isLastOfRun && "rounded-bl-sm"
|
|
1373
1377
|
);
|
|
1374
1378
|
const bubbleSurface = isSent ? cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
|
|
1379
|
+
const highlightClass = highlighted && "ring-2 ring-blue-400 dark:ring-blue-600";
|
|
1380
|
+
const copyLinkButton = onCopyLink && /* @__PURE__ */ jsx(
|
|
1381
|
+
"button",
|
|
1382
|
+
{
|
|
1383
|
+
onClick: onCopyLink,
|
|
1384
|
+
onFocus: () => setIsFocused(true),
|
|
1385
|
+
onBlur: () => setIsFocused(false),
|
|
1386
|
+
className: cn(
|
|
1387
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1388
|
+
showActions ? "opacity-100 text-foreground" : "opacity-0 text-muted-foreground"
|
|
1389
|
+
),
|
|
1390
|
+
"aria-label": "Copy link to this message",
|
|
1391
|
+
children: /* @__PURE__ */ jsx(Link, { className: "w-3.5 h-3.5" })
|
|
1392
|
+
}
|
|
1393
|
+
);
|
|
1375
1394
|
return /* @__PURE__ */ jsxs(
|
|
1376
1395
|
"div",
|
|
1377
1396
|
{
|
|
1397
|
+
id,
|
|
1378
1398
|
"data-testid": testId,
|
|
1379
1399
|
className: cn(
|
|
1380
1400
|
"flex w-full items-end",
|
|
@@ -1384,51 +1404,68 @@ var ChatBubble = memo(function ChatBubble2({
|
|
|
1384
1404
|
onMouseEnter: () => setIsHovered(true),
|
|
1385
1405
|
onMouseLeave: () => setIsHovered(false),
|
|
1386
1406
|
children: [
|
|
1387
|
-
isSent && onDelete && /* @__PURE__ */
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
onFocus: () => setIsFocused(true),
|
|
1392
|
-
onBlur: () => setIsFocused(false),
|
|
1393
|
-
className: cn(
|
|
1394
|
-
"self-end p-1 mr-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1395
|
-
showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1396
|
-
),
|
|
1397
|
-
"aria-label": "Delete message",
|
|
1398
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
|
|
1399
|
-
}
|
|
1400
|
-
),
|
|
1401
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs("div", { className: cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
|
|
1402
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1403
|
-
isLastOfRun && /* @__PURE__ */ jsxs(
|
|
1404
|
-
"div",
|
|
1407
|
+
isSent && (copyLinkButton || onDelete) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 mr-1", children: [
|
|
1408
|
+
copyLinkButton,
|
|
1409
|
+
onDelete && /* @__PURE__ */ jsx(
|
|
1410
|
+
"button",
|
|
1405
1411
|
{
|
|
1412
|
+
onClick: onDelete,
|
|
1413
|
+
onFocus: () => setIsFocused(true),
|
|
1414
|
+
onBlur: () => setIsFocused(false),
|
|
1406
1415
|
className: cn(
|
|
1407
|
-
"
|
|
1408
|
-
|
|
1416
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1417
|
+
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1409
1418
|
),
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1413
|
-
isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1414
|
-
]
|
|
1419
|
+
"aria-label": "Delete message",
|
|
1420
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
|
|
1415
1421
|
}
|
|
1416
1422
|
)
|
|
1417
|
-
] })
|
|
1418
|
-
|
|
1419
|
-
"
|
|
1423
|
+
] }),
|
|
1424
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxs(
|
|
1425
|
+
"div",
|
|
1420
1426
|
{
|
|
1421
|
-
onClick: onDelete,
|
|
1422
|
-
onFocus: () => setIsFocused(true),
|
|
1423
|
-
onBlur: () => setIsFocused(false),
|
|
1424
1427
|
className: cn(
|
|
1425
|
-
"
|
|
1426
|
-
|
|
1428
|
+
"px-3.5 py-2 break-words shadow-sm transition-shadow",
|
|
1429
|
+
bubbleRadius,
|
|
1430
|
+
bubbleSurface,
|
|
1431
|
+
highlightClass
|
|
1427
1432
|
),
|
|
1428
|
-
|
|
1429
|
-
|
|
1433
|
+
children: [
|
|
1434
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1435
|
+
isLastOfRun && /* @__PURE__ */ jsxs(
|
|
1436
|
+
"div",
|
|
1437
|
+
{
|
|
1438
|
+
className: cn(
|
|
1439
|
+
"flex items-center gap-1.5 mt-0.5",
|
|
1440
|
+
isSent ? "justify-end" : "justify-start"
|
|
1441
|
+
),
|
|
1442
|
+
children: [
|
|
1443
|
+
senderName && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
|
|
1444
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1445
|
+
isSent && (read ? /* @__PURE__ */ jsx(CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1446
|
+
]
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
]
|
|
1430
1450
|
}
|
|
1431
|
-
)
|
|
1451
|
+
) }),
|
|
1452
|
+
!isSent && (onDelete || copyLinkButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 ml-1", children: [
|
|
1453
|
+
onDelete && /* @__PURE__ */ jsx(
|
|
1454
|
+
"button",
|
|
1455
|
+
{
|
|
1456
|
+
onClick: onDelete,
|
|
1457
|
+
onFocus: () => setIsFocused(true),
|
|
1458
|
+
onBlur: () => setIsFocused(false),
|
|
1459
|
+
className: cn(
|
|
1460
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1461
|
+
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1462
|
+
),
|
|
1463
|
+
"aria-label": "Delete message",
|
|
1464
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" })
|
|
1465
|
+
}
|
|
1466
|
+
),
|
|
1467
|
+
copyLinkButton
|
|
1468
|
+
] })
|
|
1432
1469
|
]
|
|
1433
1470
|
}
|
|
1434
1471
|
);
|
|
@@ -4359,7 +4396,7 @@ function ProjectEntity({
|
|
|
4359
4396
|
const variant = resolveVariant(relation, paid, hasCollaborators);
|
|
4360
4397
|
const { pill, icon: iconClass } = VARIANT_STYLES[variant];
|
|
4361
4398
|
const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
4362
|
-
const iconNode = icon ?? /* @__PURE__ */ jsx(
|
|
4399
|
+
const iconNode = icon ?? /* @__PURE__ */ jsx(CreditCard, { className: cn(iconSizeClass, iconClass) });
|
|
4363
4400
|
return /* @__PURE__ */ jsx(
|
|
4364
4401
|
EntityPill,
|
|
4365
4402
|
{
|
|
@@ -4501,18 +4538,22 @@ var UserEntity = memo(function UserEntity2({
|
|
|
4501
4538
|
]
|
|
4502
4539
|
}
|
|
4503
4540
|
) : /* @__PURE__ */ jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
|
|
4504
|
-
const pillAvatar =
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
{
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4541
|
+
const pillAvatar = (
|
|
4542
|
+
// shrink-0: when the pill is squeezed the NAME truncates away — the avatar
|
|
4543
|
+
// must never collapse under it and overflow onto neighbouring text.
|
|
4544
|
+
/* @__PURE__ */ jsxs("span", { className: cn("relative inline-block shrink-0", sizeClasses[size]), children: [
|
|
4545
|
+
/* @__PURE__ */ jsx("span", { className: cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
|
|
4546
|
+
canMessage && /* @__PURE__ */ jsx(
|
|
4547
|
+
"span",
|
|
4548
|
+
{
|
|
4549
|
+
"aria-hidden": true,
|
|
4550
|
+
className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
|
|
4551
|
+
children: /* @__PURE__ */ jsx(MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
|
|
4552
|
+
}
|
|
4553
|
+
),
|
|
4554
|
+
statusDot
|
|
4555
|
+
] })
|
|
4556
|
+
);
|
|
4516
4557
|
const resolvedTooltip = showTooltip ? tooltipContent : void 0;
|
|
4517
4558
|
if (variant === "pill") {
|
|
4518
4559
|
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -4785,7 +4826,9 @@ var ENTITY_MAPPINGS = {
|
|
|
4785
4826
|
PLURAL: "Contacts"
|
|
4786
4827
|
},
|
|
4787
4828
|
ICONS: {
|
|
4788
|
-
|
|
4829
|
+
// A starred person, not an address-book card: contacts here are the
|
|
4830
|
+
// people you talk to, and the star reads as "your people".
|
|
4831
|
+
DEFAULT: UserStar,
|
|
4789
4832
|
NEW: UserPlus
|
|
4790
4833
|
}
|
|
4791
4834
|
},
|
|
@@ -4804,7 +4847,7 @@ var ENTITY_MAPPINGS = {
|
|
|
4804
4847
|
PLURAL: "Projects"
|
|
4805
4848
|
},
|
|
4806
4849
|
ICONS: {
|
|
4807
|
-
DEFAULT:
|
|
4850
|
+
DEFAULT: CreditCard
|
|
4808
4851
|
}
|
|
4809
4852
|
},
|
|
4810
4853
|
SKILL: {
|
|
@@ -5178,7 +5221,13 @@ var useNotify = create((set) => ({
|
|
|
5178
5221
|
removeNotification: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
|
|
5179
5222
|
clearNotifications: () => set({ notifications: [] }),
|
|
5180
5223
|
seed: (items) => set({ notifications: items }),
|
|
5181
|
-
record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) }))
|
|
5224
|
+
record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) })),
|
|
5225
|
+
syncSource: (source, items) => set((s) => ({
|
|
5226
|
+
notifications: [
|
|
5227
|
+
...items.map((n) => ({ ...n, source })),
|
|
5228
|
+
...s.notifications.filter((n) => n.source !== source)
|
|
5229
|
+
].sort((a, b) => b.ts - a.ts).slice(0, 100)
|
|
5230
|
+
}))
|
|
5182
5231
|
}));
|
|
5183
5232
|
function make(variant) {
|
|
5184
5233
|
return (title, opts = {}) => {
|
|
@@ -5197,7 +5246,8 @@ function make(variant) {
|
|
|
5197
5246
|
variant,
|
|
5198
5247
|
ts: Date.now(),
|
|
5199
5248
|
read: false,
|
|
5200
|
-
href: opts.href
|
|
5249
|
+
href: opts.href,
|
|
5250
|
+
ambient: opts.ambient
|
|
5201
5251
|
});
|
|
5202
5252
|
}
|
|
5203
5253
|
return id;
|
|
@@ -5212,7 +5262,7 @@ var notify = {
|
|
|
5212
5262
|
function seedNotifications(items) {
|
|
5213
5263
|
useNotify.getState().seed(items);
|
|
5214
5264
|
}
|
|
5215
|
-
var selectUnread = (s) => s.notifications.filter((n) => !n.read).length;
|
|
5265
|
+
var selectUnread = (s) => s.notifications.filter((n) => !n.read && !n.ambient).length;
|
|
5216
5266
|
var DEFAULT_NOTIFY_TONE = {
|
|
5217
5267
|
success: "text-green-600",
|
|
5218
5268
|
error: "text-destructive",
|
|
@@ -5267,8 +5317,14 @@ var GLYPH = {
|
|
|
5267
5317
|
};
|
|
5268
5318
|
function NotificationBell({
|
|
5269
5319
|
onNavigate,
|
|
5320
|
+
onMarkRead,
|
|
5321
|
+
onMarkAllRead,
|
|
5322
|
+
muted = false,
|
|
5323
|
+
onToggleMute,
|
|
5270
5324
|
toneClassNames,
|
|
5271
5325
|
emptyText = "You're all caught up.",
|
|
5326
|
+
onViewAll,
|
|
5327
|
+
viewAllLabel = "View all",
|
|
5272
5328
|
testId = "notifications"
|
|
5273
5329
|
}) {
|
|
5274
5330
|
const notifications = useNotify((s) => s.notifications);
|
|
@@ -5276,6 +5332,9 @@ function NotificationBell({
|
|
|
5276
5332
|
const markAllRead = useNotify((s) => s.markAllRead);
|
|
5277
5333
|
const markRead = useNotify((s) => s.markRead);
|
|
5278
5334
|
const tone = (v) => toneClassNames?.[v] ?? DEFAULT_NOTIFY_TONE[v];
|
|
5335
|
+
const [showAll, setShowAll] = useState(false);
|
|
5336
|
+
const hasAmbient = notifications.some((n) => n.ambient);
|
|
5337
|
+
const visible = showAll ? notifications : notifications.filter((n) => !n.ambient);
|
|
5279
5338
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5280
5339
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
5281
5340
|
"button",
|
|
@@ -5288,7 +5347,7 @@ function NotificationBell({
|
|
|
5288
5347
|
unread > 0 && /* @__PURE__ */ jsx(
|
|
5289
5348
|
"span",
|
|
5290
5349
|
{
|
|
5291
|
-
className: "absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-
|
|
5350
|
+
className: "absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-secondary px-1 text-[10px] font-semibold leading-4 text-secondary-foreground",
|
|
5292
5351
|
"data-testid": `${testId}-badge`,
|
|
5293
5352
|
children: unread > 9 ? "9+" : unread
|
|
5294
5353
|
}
|
|
@@ -5296,49 +5355,113 @@ function NotificationBell({
|
|
|
5296
5355
|
]
|
|
5297
5356
|
}
|
|
5298
5357
|
) }),
|
|
5299
|
-
/* @__PURE__ */ jsxs(
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5358
|
+
/* @__PURE__ */ jsxs(
|
|
5359
|
+
DropdownMenuContent,
|
|
5360
|
+
{
|
|
5361
|
+
align: "end",
|
|
5362
|
+
sideOffset: 8,
|
|
5363
|
+
collisionPadding: 12,
|
|
5364
|
+
className: "w-[360px] rounded-lg border-border/60 p-0 shadow-lg",
|
|
5365
|
+
"data-testid": `${testId}-panel`,
|
|
5366
|
+
children: [
|
|
5367
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5", children: [
|
|
5368
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Notifications" }),
|
|
5369
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
5370
|
+
hasAmbient && /* @__PURE__ */ jsx(
|
|
5371
|
+
"button",
|
|
5372
|
+
{
|
|
5373
|
+
onClick: () => setShowAll((v) => !v),
|
|
5374
|
+
"aria-pressed": showAll,
|
|
5375
|
+
className: cn(
|
|
5376
|
+
"text-xs font-medium transition-colors",
|
|
5377
|
+
showAll ? "text-primary" : "text-muted-foreground hover:text-foreground"
|
|
5378
|
+
),
|
|
5379
|
+
"data-testid": `${testId}-all-activity`,
|
|
5380
|
+
children: "All activity"
|
|
5381
|
+
}
|
|
5382
|
+
),
|
|
5383
|
+
unread > 0 && /* @__PURE__ */ jsxs(
|
|
5384
|
+
"button",
|
|
5385
|
+
{
|
|
5386
|
+
onClick: () => {
|
|
5387
|
+
markAllRead();
|
|
5388
|
+
onMarkAllRead?.();
|
|
5389
|
+
},
|
|
5390
|
+
className: "flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80",
|
|
5391
|
+
"data-testid": `${testId}-mark-all`,
|
|
5392
|
+
children: [
|
|
5393
|
+
/* @__PURE__ */ jsx(CheckCheck, { className: "size-3.5" }),
|
|
5394
|
+
" Mark all read"
|
|
5395
|
+
]
|
|
5396
|
+
}
|
|
5397
|
+
),
|
|
5398
|
+
onToggleMute && /* @__PURE__ */ jsx(
|
|
5399
|
+
"button",
|
|
5400
|
+
{
|
|
5401
|
+
onClick: onToggleMute,
|
|
5402
|
+
"aria-pressed": muted,
|
|
5403
|
+
title: muted ? "Unmute notifications" : "Mute notifications",
|
|
5404
|
+
"aria-label": muted ? "Unmute notifications" : "Mute notifications",
|
|
5405
|
+
className: cn(
|
|
5406
|
+
"flex size-6 items-center justify-center rounded-md transition-colors hover:bg-accent",
|
|
5407
|
+
muted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
5408
|
+
),
|
|
5409
|
+
"data-testid": `${testId}-mute`,
|
|
5410
|
+
children: /* @__PURE__ */ jsx(BellOff, { className: "size-3.5" })
|
|
5411
|
+
}
|
|
5412
|
+
)
|
|
5413
|
+
] })
|
|
5414
|
+
] }),
|
|
5415
|
+
muted && /* @__PURE__ */ jsx(
|
|
5416
|
+
"p",
|
|
5417
|
+
{
|
|
5418
|
+
className: "border-b border-border/60 bg-amber-500/10 px-3.5 py-1.5 text-[11px] text-muted-foreground",
|
|
5419
|
+
"data-testid": `${testId}-muted-note`,
|
|
5420
|
+
children: "Toasts are muted \u2014 everything still lands here."
|
|
5421
|
+
}
|
|
5422
|
+
),
|
|
5423
|
+
visible.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3.5 py-10 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[380px]", children: /* @__PURE__ */ jsx("ul", { "data-testid": `${testId}-list`, children: visible.map((n) => {
|
|
5424
|
+
const Glyph = GLYPH[n.variant];
|
|
5425
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
5426
|
+
"button",
|
|
5427
|
+
{
|
|
5428
|
+
onClick: () => {
|
|
5429
|
+
markRead(n.id);
|
|
5430
|
+
if (!n.read) onMarkRead?.(n.id);
|
|
5431
|
+
if (n.onSelect) n.onSelect();
|
|
5432
|
+
else if (n.href) onNavigate?.(n.href);
|
|
5433
|
+
},
|
|
5434
|
+
className: cn(
|
|
5435
|
+
"flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent",
|
|
5436
|
+
!n.read && "bg-accent/40"
|
|
5437
|
+
),
|
|
5438
|
+
"data-testid": `${testId}-item`,
|
|
5439
|
+
children: [
|
|
5440
|
+
/* @__PURE__ */ jsx(Glyph, { className: cn("mt-0.5 size-4 shrink-0", tone(n.variant)) }),
|
|
5441
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
5442
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug text-foreground", children: n.title }),
|
|
5443
|
+
n.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground", children: n.description }),
|
|
5444
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground/80", children: formatRelativeTime(new Date(n.ts).toISOString()) })
|
|
5445
|
+
] }),
|
|
5446
|
+
!n.read && /* @__PURE__ */ jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" })
|
|
5447
|
+
]
|
|
5448
|
+
}
|
|
5449
|
+
) }, n.id);
|
|
5450
|
+
}) }) }),
|
|
5451
|
+
onViewAll && // A real menu item, not a bare button: selecting it must CLOSE the
|
|
5452
|
+
// dropdown on its way to the full surface.
|
|
5453
|
+
/* @__PURE__ */ jsx(
|
|
5454
|
+
DropdownMenuItem,
|
|
5455
|
+
{
|
|
5456
|
+
onClick: onViewAll,
|
|
5457
|
+
className: "justify-center rounded-none border-t border-border px-3.5 py-2.5 text-xs font-medium text-primary focus:text-primary",
|
|
5458
|
+
"data-testid": `${testId}-view-all`,
|
|
5459
|
+
children: viewAllLabel
|
|
5460
|
+
}
|
|
5461
|
+
)
|
|
5462
|
+
]
|
|
5463
|
+
}
|
|
5464
|
+
)
|
|
5342
5465
|
] });
|
|
5343
5466
|
}
|
|
5344
5467
|
var DEFAULT_TOAST_OPTIONS = {
|
|
@@ -6301,8 +6424,14 @@ function nameInitials(name) {
|
|
|
6301
6424
|
if (!parts.length) return "?";
|
|
6302
6425
|
return parts.slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
6303
6426
|
}
|
|
6427
|
+
var STATUS_DOT = {
|
|
6428
|
+
online: "bg-emerald-500",
|
|
6429
|
+
busy: "bg-amber-500",
|
|
6430
|
+
offline: "bg-destructive"
|
|
6431
|
+
};
|
|
6304
6432
|
function UserMenu({
|
|
6305
6433
|
user,
|
|
6434
|
+
status,
|
|
6306
6435
|
items = [],
|
|
6307
6436
|
onLogout,
|
|
6308
6437
|
logoutLabel = "Sign out",
|
|
@@ -6321,13 +6450,26 @@ function UserMenu({
|
|
|
6321
6450
|
),
|
|
6322
6451
|
"data-testid": testId,
|
|
6323
6452
|
children: [
|
|
6324
|
-
/* @__PURE__ */ jsxs(
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6453
|
+
/* @__PURE__ */ jsxs("span", { className: "relative", children: [
|
|
6454
|
+
/* @__PURE__ */ jsxs(Avatar, { className: "size-8", children: [
|
|
6455
|
+
user.picture ? /* @__PURE__ */ jsx(AvatarImage, { src: user.picture, alt: user.name }) : null,
|
|
6456
|
+
/* @__PURE__ */ jsx(
|
|
6457
|
+
AvatarFallback,
|
|
6458
|
+
{
|
|
6459
|
+
className: cn("bg-primary text-primary-foreground", classNames?.fallback),
|
|
6460
|
+
children: nameInitials(user.name)
|
|
6461
|
+
}
|
|
6462
|
+
)
|
|
6463
|
+
] }),
|
|
6464
|
+
status && /* @__PURE__ */ jsx(
|
|
6465
|
+
"span",
|
|
6328
6466
|
{
|
|
6329
|
-
className: cn(
|
|
6330
|
-
|
|
6467
|
+
className: cn(
|
|
6468
|
+
"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-background",
|
|
6469
|
+
STATUS_DOT[status.tone]
|
|
6470
|
+
),
|
|
6471
|
+
title: status.detail ? `${status.label} \xB7 ${status.detail}` : status.label,
|
|
6472
|
+
"data-testid": status.testId ? `${status.testId}-dot` : void 0
|
|
6331
6473
|
}
|
|
6332
6474
|
)
|
|
6333
6475
|
] }),
|
|
@@ -6335,21 +6477,44 @@ function UserMenu({
|
|
|
6335
6477
|
]
|
|
6336
6478
|
}
|
|
6337
6479
|
) }),
|
|
6338
|
-
/* @__PURE__ */ jsxs(
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6480
|
+
/* @__PURE__ */ jsxs(
|
|
6481
|
+
DropdownMenuContent,
|
|
6482
|
+
{
|
|
6483
|
+
align,
|
|
6484
|
+
sideOffset: 8,
|
|
6485
|
+
collisionPadding: 12,
|
|
6486
|
+
className: "w-56 rounded-lg border-border/60 shadow-lg",
|
|
6487
|
+
children: [
|
|
6488
|
+
/* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
|
|
6489
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: user.name }),
|
|
6490
|
+
user.email && /* @__PURE__ */ jsx("div", { className: "text-xs font-normal text-muted-foreground", children: user.email }),
|
|
6491
|
+
status && /* @__PURE__ */ jsxs(
|
|
6492
|
+
"div",
|
|
6493
|
+
{
|
|
6494
|
+
className: "mt-1 text-xs font-normal text-muted-foreground",
|
|
6495
|
+
"data-testid": status.testId,
|
|
6496
|
+
children: [
|
|
6497
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
6498
|
+
/* @__PURE__ */ jsx("span", { className: cn("size-2 shrink-0 rounded-full", STATUS_DOT[status.tone]) }),
|
|
6499
|
+
status.label
|
|
6500
|
+
] }),
|
|
6501
|
+
status.detail && /* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate pl-3.5 text-[10px] leading-tight text-muted-foreground/70", children: status.detail })
|
|
6502
|
+
]
|
|
6503
|
+
}
|
|
6504
|
+
)
|
|
6505
|
+
] }),
|
|
6506
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
6507
|
+
items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onSelect, "data-testid": item.testId, children: [
|
|
6508
|
+
item.icon && /* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
|
|
6509
|
+
item.label
|
|
6510
|
+
] }, item.label)),
|
|
6511
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onLogout, "data-testid": logoutTestId ?? `${testId}-logout`, children: [
|
|
6512
|
+
/* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
|
|
6513
|
+
logoutLabel
|
|
6514
|
+
] })
|
|
6515
|
+
]
|
|
6516
|
+
}
|
|
6517
|
+
)
|
|
6353
6518
|
] });
|
|
6354
6519
|
}
|
|
6355
6520
|
var useArbiUiStore = create((set) => ({
|