@arbidocs/react 0.3.160 → 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 +220 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -6
- package/dist/index.d.ts +49 -6
- package/dist/index.js +214 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
|
+
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';
|
|
1
3
|
import { useArbi, ArbiProvider } from './chunk-J4MX2W4H.js';
|
|
2
4
|
export { ArbiProvider, useArbi } from './chunk-J4MX2W4H.js';
|
|
3
|
-
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, DropdownMenuItem, Checkbox } from './chunk-VTX77MYP.js';
|
|
4
|
-
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';
|
|
5
5
|
import React2, { memo, useState, createContext, forwardRef, useMemo, useCallback, useId, useRef, useContext, useEffect, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { useQuery, useMutation, useQueries, QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
|
|
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 { Link, 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';
|
|
@@ -4396,7 +4396,7 @@ function ProjectEntity({
|
|
|
4396
4396
|
const variant = resolveVariant(relation, paid, hasCollaborators);
|
|
4397
4397
|
const { pill, icon: iconClass } = VARIANT_STYLES[variant];
|
|
4398
4398
|
const iconSizeClass = size === "base" ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
4399
|
-
const iconNode = icon ?? /* @__PURE__ */ jsx(
|
|
4399
|
+
const iconNode = icon ?? /* @__PURE__ */ jsx(CreditCard, { className: cn(iconSizeClass, iconClass) });
|
|
4400
4400
|
return /* @__PURE__ */ jsx(
|
|
4401
4401
|
EntityPill,
|
|
4402
4402
|
{
|
|
@@ -4538,18 +4538,22 @@ var UserEntity = memo(function UserEntity2({
|
|
|
4538
4538
|
]
|
|
4539
4539
|
}
|
|
4540
4540
|
) : /* @__PURE__ */ jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
|
|
4541
|
-
const pillAvatar =
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
{
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
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
|
+
);
|
|
4553
4557
|
const resolvedTooltip = showTooltip ? tooltipContent : void 0;
|
|
4554
4558
|
if (variant === "pill") {
|
|
4555
4559
|
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -4822,7 +4826,9 @@ var ENTITY_MAPPINGS = {
|
|
|
4822
4826
|
PLURAL: "Contacts"
|
|
4823
4827
|
},
|
|
4824
4828
|
ICONS: {
|
|
4825
|
-
|
|
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,
|
|
4826
4832
|
NEW: UserPlus
|
|
4827
4833
|
}
|
|
4828
4834
|
},
|
|
@@ -4841,7 +4847,7 @@ var ENTITY_MAPPINGS = {
|
|
|
4841
4847
|
PLURAL: "Projects"
|
|
4842
4848
|
},
|
|
4843
4849
|
ICONS: {
|
|
4844
|
-
DEFAULT:
|
|
4850
|
+
DEFAULT: CreditCard
|
|
4845
4851
|
}
|
|
4846
4852
|
},
|
|
4847
4853
|
SKILL: {
|
|
@@ -5215,7 +5221,13 @@ var useNotify = create((set) => ({
|
|
|
5215
5221
|
removeNotification: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
|
|
5216
5222
|
clearNotifications: () => set({ notifications: [] }),
|
|
5217
5223
|
seed: (items) => set({ notifications: items }),
|
|
5218
|
-
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
|
+
}))
|
|
5219
5231
|
}));
|
|
5220
5232
|
function make(variant) {
|
|
5221
5233
|
return (title, opts = {}) => {
|
|
@@ -5234,7 +5246,8 @@ function make(variant) {
|
|
|
5234
5246
|
variant,
|
|
5235
5247
|
ts: Date.now(),
|
|
5236
5248
|
read: false,
|
|
5237
|
-
href: opts.href
|
|
5249
|
+
href: opts.href,
|
|
5250
|
+
ambient: opts.ambient
|
|
5238
5251
|
});
|
|
5239
5252
|
}
|
|
5240
5253
|
return id;
|
|
@@ -5249,7 +5262,7 @@ var notify = {
|
|
|
5249
5262
|
function seedNotifications(items) {
|
|
5250
5263
|
useNotify.getState().seed(items);
|
|
5251
5264
|
}
|
|
5252
|
-
var selectUnread = (s) => s.notifications.filter((n) => !n.read).length;
|
|
5265
|
+
var selectUnread = (s) => s.notifications.filter((n) => !n.read && !n.ambient).length;
|
|
5253
5266
|
var DEFAULT_NOTIFY_TONE = {
|
|
5254
5267
|
success: "text-green-600",
|
|
5255
5268
|
error: "text-destructive",
|
|
@@ -5304,8 +5317,14 @@ var GLYPH = {
|
|
|
5304
5317
|
};
|
|
5305
5318
|
function NotificationBell({
|
|
5306
5319
|
onNavigate,
|
|
5320
|
+
onMarkRead,
|
|
5321
|
+
onMarkAllRead,
|
|
5322
|
+
muted = false,
|
|
5323
|
+
onToggleMute,
|
|
5307
5324
|
toneClassNames,
|
|
5308
5325
|
emptyText = "You're all caught up.",
|
|
5326
|
+
onViewAll,
|
|
5327
|
+
viewAllLabel = "View all",
|
|
5309
5328
|
testId = "notifications"
|
|
5310
5329
|
}) {
|
|
5311
5330
|
const notifications = useNotify((s) => s.notifications);
|
|
@@ -5313,6 +5332,9 @@ function NotificationBell({
|
|
|
5313
5332
|
const markAllRead = useNotify((s) => s.markAllRead);
|
|
5314
5333
|
const markRead = useNotify((s) => s.markRead);
|
|
5315
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);
|
|
5316
5338
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
5317
5339
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
5318
5340
|
"button",
|
|
@@ -5325,7 +5347,7 @@ function NotificationBell({
|
|
|
5325
5347
|
unread > 0 && /* @__PURE__ */ jsx(
|
|
5326
5348
|
"span",
|
|
5327
5349
|
{
|
|
5328
|
-
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",
|
|
5329
5351
|
"data-testid": `${testId}-badge`,
|
|
5330
5352
|
children: unread > 9 ? "9+" : unread
|
|
5331
5353
|
}
|
|
@@ -5333,49 +5355,113 @@ function NotificationBell({
|
|
|
5333
5355
|
]
|
|
5334
5356
|
}
|
|
5335
5357
|
) }),
|
|
5336
|
-
/* @__PURE__ */ jsxs(
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
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
|
+
)
|
|
5379
5465
|
] });
|
|
5380
5466
|
}
|
|
5381
5467
|
var DEFAULT_TOAST_OPTIONS = {
|
|
@@ -6338,8 +6424,14 @@ function nameInitials(name) {
|
|
|
6338
6424
|
if (!parts.length) return "?";
|
|
6339
6425
|
return parts.slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
|
|
6340
6426
|
}
|
|
6427
|
+
var STATUS_DOT = {
|
|
6428
|
+
online: "bg-emerald-500",
|
|
6429
|
+
busy: "bg-amber-500",
|
|
6430
|
+
offline: "bg-destructive"
|
|
6431
|
+
};
|
|
6341
6432
|
function UserMenu({
|
|
6342
6433
|
user,
|
|
6434
|
+
status,
|
|
6343
6435
|
items = [],
|
|
6344
6436
|
onLogout,
|
|
6345
6437
|
logoutLabel = "Sign out",
|
|
@@ -6358,13 +6450,26 @@ function UserMenu({
|
|
|
6358
6450
|
),
|
|
6359
6451
|
"data-testid": testId,
|
|
6360
6452
|
children: [
|
|
6361
|
-
/* @__PURE__ */ jsxs(
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
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",
|
|
6365
6466
|
{
|
|
6366
|
-
className: cn(
|
|
6367
|
-
|
|
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
|
|
6368
6473
|
}
|
|
6369
6474
|
)
|
|
6370
6475
|
] }),
|
|
@@ -6372,21 +6477,44 @@ function UserMenu({
|
|
|
6372
6477
|
]
|
|
6373
6478
|
}
|
|
6374
6479
|
) }),
|
|
6375
|
-
/* @__PURE__ */ jsxs(
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
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
|
+
)
|
|
6390
6518
|
] });
|
|
6391
6519
|
}
|
|
6392
6520
|
var useArbiUiStore = create((set) => ({
|