@arbidocs/react 0.3.160 → 0.3.162

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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, Package, ClipboardList, UserPlus, Contact, 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, XCircle, CheckCircle2, ArrowRight, ChevronDown, MoreHorizontal, SquarePen, FileX, SkipForward, CheckCircle } from 'lucide-react';
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(Package, { className: cn(iconSizeClass, iconClass) });
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 = /* @__PURE__ */ jsxs("span", { className: cn("relative inline-block", sizeClasses[size]), children: [
4542
- /* @__PURE__ */ jsx("span", { className: cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
4543
- canMessage && /* @__PURE__ */ jsx(
4544
- "span",
4545
- {
4546
- "aria-hidden": true,
4547
- className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
4548
- children: /* @__PURE__ */ jsx(MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
4549
- }
4550
- ),
4551
- statusDot
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
- DEFAULT: Contact,
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: Package
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,7 @@ 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 visible = notifications.filter((n) => !n.ambient);
5316
5336
  return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5317
5337
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5318
5338
  "button",
@@ -5325,7 +5345,7 @@ function NotificationBell({
5325
5345
  unread > 0 && /* @__PURE__ */ jsx(
5326
5346
  "span",
5327
5347
  {
5328
- className: "absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-4 text-white",
5348
+ 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
5349
  "data-testid": `${testId}-badge`,
5330
5350
  children: unread > 9 ? "9+" : unread
5331
5351
  }
@@ -5333,49 +5353,100 @@ function NotificationBell({
5333
5353
  ]
5334
5354
  }
5335
5355
  ) }),
5336
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[360px] p-0", "data-testid": `${testId}-panel`, children: [
5337
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border px-3.5 py-2.5", children: [
5338
- /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Notifications" }),
5339
- unread > 0 && /* @__PURE__ */ jsxs(
5340
- "button",
5341
- {
5342
- onClick: markAllRead,
5343
- className: "flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80",
5344
- "data-testid": `${testId}-mark-all`,
5345
- children: [
5346
- /* @__PURE__ */ jsx(CheckCheck, { className: "size-3.5" }),
5347
- " Mark all read"
5348
- ]
5349
- }
5350
- )
5351
- ] }),
5352
- notifications.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: notifications.map((n) => {
5353
- const Glyph = GLYPH[n.variant];
5354
- return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
5355
- "button",
5356
- {
5357
- onClick: () => {
5358
- markRead(n.id);
5359
- if (n.href) onNavigate?.(n.href);
5360
- },
5361
- className: cn(
5362
- "flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent",
5363
- !n.read && "bg-accent/40"
5364
- ),
5365
- "data-testid": `${testId}-item`,
5366
- children: [
5367
- /* @__PURE__ */ jsx(Glyph, { className: cn("mt-0.5 size-4 shrink-0", tone(n.variant)) }),
5368
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
5369
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug text-foreground", children: n.title }),
5370
- n.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground", children: n.description }),
5371
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground/80", children: formatRelativeTime(new Date(n.ts).toISOString()) })
5372
- ] }),
5373
- !n.read && /* @__PURE__ */ jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" })
5374
- ]
5375
- }
5376
- ) }, n.id);
5377
- }) }) })
5378
- ] })
5356
+ /* @__PURE__ */ jsxs(
5357
+ DropdownMenuContent,
5358
+ {
5359
+ align: "end",
5360
+ sideOffset: 8,
5361
+ collisionPadding: 12,
5362
+ className: "w-[360px] rounded-lg border-border/60 p-0 shadow-lg",
5363
+ "data-testid": `${testId}-panel`,
5364
+ children: [
5365
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5", children: [
5366
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Notifications" }),
5367
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
5368
+ unread > 0 && /* @__PURE__ */ jsxs(
5369
+ "button",
5370
+ {
5371
+ onClick: () => {
5372
+ markAllRead();
5373
+ onMarkAllRead?.();
5374
+ },
5375
+ className: "flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80",
5376
+ "data-testid": `${testId}-mark-all`,
5377
+ children: [
5378
+ /* @__PURE__ */ jsx(CheckCheck, { className: "size-3.5" }),
5379
+ " Mark all read"
5380
+ ]
5381
+ }
5382
+ ),
5383
+ onToggleMute && /* @__PURE__ */ jsx(
5384
+ "button",
5385
+ {
5386
+ onClick: onToggleMute,
5387
+ "aria-pressed": muted,
5388
+ title: muted ? "Unmute notifications" : "Mute notifications",
5389
+ "aria-label": muted ? "Unmute notifications" : "Mute notifications",
5390
+ className: cn(
5391
+ "flex size-6 items-center justify-center rounded-md transition-colors hover:bg-accent",
5392
+ muted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
5393
+ ),
5394
+ "data-testid": `${testId}-mute`,
5395
+ children: /* @__PURE__ */ jsx(BellOff, { className: "size-3.5" })
5396
+ }
5397
+ )
5398
+ ] })
5399
+ ] }),
5400
+ muted && /* @__PURE__ */ jsx(
5401
+ "p",
5402
+ {
5403
+ className: "border-b border-border/60 bg-amber-500/10 px-3.5 py-1.5 text-[11px] text-muted-foreground",
5404
+ "data-testid": `${testId}-muted-note`,
5405
+ children: "Toasts are muted \u2014 everything still lands here."
5406
+ }
5407
+ ),
5408
+ 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) => {
5409
+ const Glyph = GLYPH[n.variant];
5410
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
5411
+ "button",
5412
+ {
5413
+ onClick: () => {
5414
+ markRead(n.id);
5415
+ if (!n.read) onMarkRead?.(n.id);
5416
+ if (n.onSelect) n.onSelect();
5417
+ else if (n.href) onNavigate?.(n.href);
5418
+ },
5419
+ className: cn(
5420
+ "flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent",
5421
+ !n.read && "bg-accent/40"
5422
+ ),
5423
+ "data-testid": `${testId}-item`,
5424
+ children: [
5425
+ /* @__PURE__ */ jsx(Glyph, { className: cn("mt-0.5 size-4 shrink-0", tone(n.variant)) }),
5426
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
5427
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-snug text-foreground", children: n.title }),
5428
+ n.description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground", children: n.description }),
5429
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-[11px] text-muted-foreground/80", children: formatRelativeTime(new Date(n.ts).toISOString()) })
5430
+ ] }),
5431
+ !n.read && /* @__PURE__ */ jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" })
5432
+ ]
5433
+ }
5434
+ ) }, n.id);
5435
+ }) }) }),
5436
+ onViewAll && // A real menu item, not a bare button: selecting it must CLOSE the
5437
+ // dropdown on its way to the full surface.
5438
+ /* @__PURE__ */ jsx(
5439
+ DropdownMenuItem,
5440
+ {
5441
+ onClick: onViewAll,
5442
+ className: "justify-center rounded-none border-t border-border px-3.5 py-2.5 text-xs font-medium text-primary focus:text-primary",
5443
+ "data-testid": `${testId}-view-all`,
5444
+ children: viewAllLabel
5445
+ }
5446
+ )
5447
+ ]
5448
+ }
5449
+ )
5379
5450
  ] });
5380
5451
  }
5381
5452
  var DEFAULT_TOAST_OPTIONS = {
@@ -6338,8 +6409,14 @@ function nameInitials(name) {
6338
6409
  if (!parts.length) return "?";
6339
6410
  return parts.slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join("");
6340
6411
  }
6412
+ var STATUS_DOT = {
6413
+ online: "bg-emerald-500",
6414
+ busy: "bg-amber-500",
6415
+ offline: "bg-destructive"
6416
+ };
6341
6417
  function UserMenu({
6342
6418
  user,
6419
+ status,
6343
6420
  items = [],
6344
6421
  onLogout,
6345
6422
  logoutLabel = "Sign out",
@@ -6358,13 +6435,26 @@ function UserMenu({
6358
6435
  ),
6359
6436
  "data-testid": testId,
6360
6437
  children: [
6361
- /* @__PURE__ */ jsxs(Avatar, { className: "size-8", children: [
6362
- user.picture ? /* @__PURE__ */ jsx(AvatarImage, { src: user.picture, alt: user.name }) : null,
6363
- /* @__PURE__ */ jsx(
6364
- AvatarFallback,
6438
+ /* @__PURE__ */ jsxs("span", { className: "relative", children: [
6439
+ /* @__PURE__ */ jsxs(Avatar, { className: "size-8", children: [
6440
+ user.picture ? /* @__PURE__ */ jsx(AvatarImage, { src: user.picture, alt: user.name }) : null,
6441
+ /* @__PURE__ */ jsx(
6442
+ AvatarFallback,
6443
+ {
6444
+ className: cn("bg-primary text-primary-foreground", classNames?.fallback),
6445
+ children: nameInitials(user.name)
6446
+ }
6447
+ )
6448
+ ] }),
6449
+ status && /* @__PURE__ */ jsx(
6450
+ "span",
6365
6451
  {
6366
- className: cn("bg-primary text-primary-foreground", classNames?.fallback),
6367
- children: nameInitials(user.name)
6452
+ className: cn(
6453
+ "absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-background",
6454
+ STATUS_DOT[status.tone]
6455
+ ),
6456
+ title: status.detail ? `${status.label} \xB7 ${status.detail}` : status.label,
6457
+ "data-testid": status.testId ? `${status.testId}-dot` : void 0
6368
6458
  }
6369
6459
  )
6370
6460
  ] }),
@@ -6372,21 +6462,44 @@ function UserMenu({
6372
6462
  ]
6373
6463
  }
6374
6464
  ) }),
6375
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align, className: "w-56", children: [
6376
- /* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
6377
- /* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: user.name }),
6378
- user.email && /* @__PURE__ */ jsx("div", { className: "text-xs font-normal text-muted-foreground", children: user.email })
6379
- ] }),
6380
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6381
- items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onSelect, "data-testid": item.testId, children: [
6382
- item.icon && /* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
6383
- item.label
6384
- ] }, item.label)),
6385
- /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onLogout, "data-testid": logoutTestId ?? `${testId}-logout`, children: [
6386
- /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
6387
- logoutLabel
6388
- ] })
6389
- ] })
6465
+ /* @__PURE__ */ jsxs(
6466
+ DropdownMenuContent,
6467
+ {
6468
+ align,
6469
+ sideOffset: 8,
6470
+ collisionPadding: 12,
6471
+ className: "w-56 rounded-lg border-border/60 shadow-lg",
6472
+ children: [
6473
+ /* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
6474
+ /* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: user.name }),
6475
+ user.email && /* @__PURE__ */ jsx("div", { className: "text-xs font-normal text-muted-foreground", children: user.email }),
6476
+ status && /* @__PURE__ */ jsxs(
6477
+ "div",
6478
+ {
6479
+ className: "mt-1 text-xs font-normal text-muted-foreground",
6480
+ "data-testid": status.testId,
6481
+ children: [
6482
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
6483
+ /* @__PURE__ */ jsx("span", { className: cn("size-2 shrink-0 rounded-full", STATUS_DOT[status.tone]) }),
6484
+ status.label
6485
+ ] }),
6486
+ status.detail && /* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate pl-3.5 text-[10px] leading-tight text-muted-foreground/70", children: status.detail })
6487
+ ]
6488
+ }
6489
+ )
6490
+ ] }),
6491
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6492
+ items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onSelect, "data-testid": item.testId, children: [
6493
+ item.icon && /* @__PURE__ */ jsx(item.icon, { className: "size-4" }),
6494
+ item.label
6495
+ ] }, item.label)),
6496
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onLogout, "data-testid": logoutTestId ?? `${testId}-logout`, children: [
6497
+ /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
6498
+ logoutLabel
6499
+ ] })
6500
+ ]
6501
+ }
6502
+ )
6390
6503
  ] });
6391
6504
  }
6392
6505
  var useArbiUiStore = create((set) => ({