@arbidocs/react 0.3.117 → 0.3.119

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 CHANGED
@@ -35,6 +35,7 @@ var ReactMarkdown = require('react-markdown');
35
35
  var remarkGfm = require('remark-gfm');
36
36
  var rehypeRaw = require('rehype-raw');
37
37
  var framerMotion = require('framer-motion');
38
+ var sonner = require('sonner');
38
39
  var Cropper = require('react-easy-crop');
39
40
  var agGridReact = require('ag-grid-react');
40
41
  var agGridCommunity = require('ag-grid-community');
@@ -5193,10 +5194,8 @@ var UserEntity = React.memo(function UserEntity2({
5193
5194
  );
5194
5195
  }
5195
5196
  const agentBadge = isAgent ? /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
5196
- const chatIcon = interactive && !isMe && !isAgent ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-shrink-0 ml-0.5", children: [
5197
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleMore, { className: "w-3.5 h-3.5 text-muted-foreground" }),
5198
- hasUnreadMessages && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-1 -right-1.5 w-2 h-2 aspect-square rounded-full bg-secondary border border-background" })
5199
- ] }) : void 0;
5197
+ const canMessage = interactive && !isMe && !isAgent;
5198
+ const showUnread = hasUnreadMessages && !isMe && !isAgent;
5200
5199
  const avatarCore = /* @__PURE__ */ jsxRuntime.jsxs(
5201
5200
  Avatar,
5202
5201
  {
@@ -5223,19 +5222,20 @@ var UserEntity = React.memo(function UserEntity2({
5223
5222
  ]
5224
5223
  }
5225
5224
  );
5226
- const presenceDot = displayStatus && /* @__PURE__ */ jsxRuntime.jsx(
5227
- "div",
5225
+ const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsxRuntime.jsx(
5226
+ "span",
5228
5227
  {
5229
5228
  className: cn(
5230
5229
  "absolute rounded-full border-white",
5231
5230
  presenceDotClasses[size],
5232
5231
  presencePositionClasses[size],
5233
- presenceColorClasses[displayStatus]
5232
+ !showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
5234
5233
  ),
5234
+ style: showUnread ? { backgroundColor: "#00adef" } : void 0,
5235
5235
  "data-testid": "user-entity-presence"
5236
5236
  }
5237
- );
5238
- const avatarElement = displayStatus ? /* @__PURE__ */ jsxRuntime.jsxs(
5237
+ ) : null;
5238
+ const avatarElement = statusDot ? /* @__PURE__ */ jsxRuntime.jsxs(
5239
5239
  "div",
5240
5240
  {
5241
5241
  className: cn(
@@ -5245,39 +5245,61 @@ var UserEntity = React.memo(function UserEntity2({
5245
5245
  ),
5246
5246
  children: [
5247
5247
  avatarCore,
5248
- presenceDot
5248
+ statusDot
5249
5249
  ]
5250
5250
  }
5251
5251
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-block", variant === "pill" ? "" : className), children: avatarCore });
5252
+ const pillAvatar = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("relative inline-block", sizeClasses[size]), children: [
5253
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("block transition-opacity", canMessage && "group-hover/pill:opacity-0"), children: avatarCore }),
5254
+ canMessage && /* @__PURE__ */ jsxRuntime.jsx(
5255
+ "span",
5256
+ {
5257
+ "aria-hidden": true,
5258
+ className: "absolute inset-0 flex items-center justify-center rounded-full bg-muted text-foreground opacity-0 transition-opacity group-hover/pill:opacity-100",
5259
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleMore, { className: size === "xs" ? "h-3 w-3" : "h-4 w-4" })
5260
+ }
5261
+ ),
5262
+ statusDot
5263
+ ] });
5252
5264
  const resolvedTooltip = showTooltip ? tooltipContent : void 0;
5253
5265
  if (variant === "pill") {
5254
- if (!interactive) {
5266
+ const row = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5267
+ pillAvatar,
5268
+ displayName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
5269
+ agentBadge
5270
+ ] });
5271
+ const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
5272
+ const clickable = interactive && !!onClick;
5273
+ const clickableClass = "cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors hover:bg-muted/60";
5274
+ if (resolvedTooltip) {
5275
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
5276
+ /* @__PURE__ */ jsxRuntime.jsx(
5277
+ TooltipTrigger,
5278
+ {
5279
+ type: "button",
5280
+ onClick: clickable ? onClick : void 0,
5281
+ onFocusCapture: (e) => e.stopPropagation(),
5282
+ className: cn(rowClass, clickable && clickableClass, className),
5283
+ "data-testid": "user-entity-pill",
5284
+ children: row
5285
+ }
5286
+ ),
5287
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "p-2", children: resolvedTooltip })
5288
+ ] });
5289
+ }
5290
+ if (clickable) {
5255
5291
  return /* @__PURE__ */ jsxRuntime.jsx(
5256
- EntityPill,
5292
+ "button",
5257
5293
  {
5258
- icon: avatarElement,
5259
- label: displayName,
5260
- secondaryText: agentBadge,
5261
- shape: "pill",
5262
- tooltipContent: resolvedTooltip,
5263
- className,
5264
- "data-testid": "user-entity-pill"
5294
+ type: "button",
5295
+ onClick,
5296
+ className: cn(rowClass, clickableClass, className),
5297
+ "data-testid": "user-entity-pill",
5298
+ children: row
5265
5299
  }
5266
5300
  );
5267
5301
  }
5268
- return /* @__PURE__ */ jsxRuntime.jsx(
5269
- EntityPill,
5270
- {
5271
- icon: avatarElement,
5272
- label: displayName,
5273
- secondaryText: chatIcon || agentBadge,
5274
- shape: "pill",
5275
- onClick,
5276
- tooltipContent: resolvedTooltip,
5277
- className,
5278
- "data-testid": "user-entity-pill"
5279
- }
5280
- );
5302
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
5281
5303
  }
5282
5304
  if (showTooltip) {
5283
5305
  return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
@@ -5287,6 +5309,51 @@ var UserEntity = React.memo(function UserEntity2({
5287
5309
  }
5288
5310
  return avatarElement;
5289
5311
  });
5312
+ var PACKAGE_BADGE_VARIANTS = [
5313
+ "default",
5314
+ "accent",
5315
+ "secondary",
5316
+ "destructive",
5317
+ "outline"
5318
+ ];
5319
+ function isPackageBadgeVariant(v) {
5320
+ return PACKAGE_BADGE_VARIANTS.some((known) => known === v);
5321
+ }
5322
+ function PackageStatusBadge({ variant, ...rest }) {
5323
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: isPackageBadgeVariant(variant) ? variant : "outline", ...rest });
5324
+ }
5325
+ var registry = {
5326
+ variants: {},
5327
+ fallback: "outline",
5328
+ Badge: PackageStatusBadge
5329
+ };
5330
+ function configureStatusRegistry(map, opts) {
5331
+ Object.assign(registry.variants, map);
5332
+ if (opts?.fallback) registry.fallback = opts.fallback;
5333
+ if (opts?.Badge) registry.Badge = opts.Badge;
5334
+ }
5335
+ function getStatusVariant(status) {
5336
+ return registry.variants[status] ?? registry.fallback;
5337
+ }
5338
+ function StatusPill({ status, label, variant, className, testId }) {
5339
+ const Badge2 = registry.Badge;
5340
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge2, { variant: variant ?? getStatusVariant(status), className, "data-testid": testId, children: label ?? status });
5341
+ }
5342
+ var RAG_LABELS = { red: "At risk", amber: "Attention", green: "On track" };
5343
+ function configureRagLabels(labels) {
5344
+ RAG_LABELS = { ...RAG_LABELS, ...labels };
5345
+ }
5346
+ function RagDot({
5347
+ rag,
5348
+ withLabel,
5349
+ className
5350
+ }) {
5351
+ const color = rag === "red" ? "bg-destructive" : rag === "amber" ? "bg-warning" : "bg-success";
5352
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("inline-flex items-center gap-1.5", className), "data-testid": `rag-${rag}`, children: [
5353
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("size-2 rounded-full", color) }),
5354
+ withLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
5355
+ ] });
5356
+ }
5290
5357
  var ENTITY_MAPPINGS = {
5291
5358
  PRODUCT: {
5292
5359
  NAMES: {
@@ -5784,41 +5851,38 @@ function ActivityFeed({
5784
5851
  var seq = 0;
5785
5852
  var uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`;
5786
5853
  var useNotify = zustand.create((set) => ({
5787
- toasts: [],
5788
5854
  notifications: [],
5789
- push: (variant, title, opts = {}) => {
5790
- const id = uid();
5791
- const duration = opts.duration ?? (variant === "error" ? 7e3 : 4500);
5792
- set((s) => {
5793
- const toast = { id, title, description: opts.description, variant, duration };
5794
- const next = { toasts: [...s.toasts, toast] };
5795
- if (opts.record !== false) {
5796
- const note = {
5797
- id,
5798
- title,
5799
- description: opts.description,
5800
- variant,
5801
- ts: Date.now(),
5802
- read: false,
5803
- href: opts.href
5804
- };
5805
- next.notifications = [note, ...s.notifications].slice(0, 50);
5806
- }
5807
- return next;
5808
- });
5809
- return id;
5810
- },
5811
- dismiss: (id) => set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })),
5812
5855
  markRead: (id) => set((s) => ({
5813
5856
  notifications: s.notifications.map((n) => n.id === id ? { ...n, read: true } : n)
5814
5857
  })),
5815
5858
  markAllRead: () => set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),
5816
5859
  removeNotification: (id) => set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),
5817
5860
  clearNotifications: () => set({ notifications: [] }),
5818
- seed: (items) => set({ notifications: items })
5861
+ seed: (items) => set({ notifications: items }),
5862
+ record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) }))
5819
5863
  }));
5820
5864
  function make(variant) {
5821
- return (title, opts) => useNotify.getState().push(variant, title, opts);
5865
+ return (title, opts = {}) => {
5866
+ sonner.toast[variant](title, {
5867
+ description: opts.description,
5868
+ duration: opts.duration,
5869
+ action: opts.action,
5870
+ icon: opts.icon
5871
+ });
5872
+ const id = uid();
5873
+ if (opts.record !== false) {
5874
+ useNotify.getState().record({
5875
+ id,
5876
+ title,
5877
+ description: opts.description,
5878
+ variant,
5879
+ ts: Date.now(),
5880
+ read: false,
5881
+ href: opts.href
5882
+ });
5883
+ }
5884
+ return id;
5885
+ };
5822
5886
  }
5823
5887
  var notify = {
5824
5888
  success: make("success"),
@@ -5955,69 +6019,21 @@ function NotificationBell({
5955
6019
  ] })
5956
6020
  ] });
5957
6021
  }
5958
- var GLYPH2 = {
5959
- success: lucideReact.CheckCircle2,
5960
- error: lucideReact.XCircle,
5961
- warning: lucideReact.AlertTriangle,
5962
- info: lucideReact.Info
6022
+ var DEFAULT_TOAST_OPTIONS = {
6023
+ classNames: {
6024
+ toast: "group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg",
6025
+ description: "group-[.toast]:text-muted-foreground",
6026
+ actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
6027
+ cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
6028
+ }
5963
6029
  };
5964
- function Toaster({ className, toneClassNames, testId = "toaster" }) {
5965
- const toasts = useNotify((s) => s.toasts);
6030
+ function Toaster({ toastOptions, ...props }) {
5966
6031
  return /* @__PURE__ */ jsxRuntime.jsx(
5967
- "div",
5968
- {
5969
- className: cn(
5970
- "pointer-events-none fixed bottom-4 right-4 z-[100] flex w-[min(92vw,380px)] flex-col gap-2.5",
5971
- className
5972
- ),
5973
- "data-testid": testId,
5974
- "aria-live": "polite",
5975
- "aria-atomic": "false",
5976
- children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: toasts.map((t) => /* @__PURE__ */ jsxRuntime.jsx(ToastCard, { toast: t, toneClassNames }, t.id)) })
5977
- }
5978
- );
5979
- }
5980
- function ToastCard({
5981
- toast,
5982
- toneClassNames
5983
- }) {
5984
- const dismiss = useNotify((s) => s.dismiss);
5985
- const Glyph = GLYPH2[toast.variant];
5986
- const tone = toneClassNames?.[toast.variant] ?? DEFAULT_NOTIFY_TONE[toast.variant];
5987
- React.useEffect(() => {
5988
- if (!toast.duration) return;
5989
- const timer = setTimeout(() => dismiss(toast.id), toast.duration);
5990
- return () => clearTimeout(timer);
5991
- }, [toast.id, toast.duration, dismiss]);
5992
- return /* @__PURE__ */ jsxRuntime.jsxs(
5993
- framerMotion.motion.div,
6032
+ sonner.Toaster,
5994
6033
  {
5995
- layout: true,
5996
- initial: { opacity: 0, y: 16, scale: 0.97 },
5997
- animate: { opacity: 1, y: 0, scale: 1 },
5998
- exit: { opacity: 0, x: 24, scale: 0.97, transition: { duration: 0.18 } },
5999
- transition: { type: "spring", stiffness: 380, damping: 30 },
6000
- className: "pointer-events-auto flex items-start gap-3 rounded-lg border border-border bg-card p-3.5 shadow-lg",
6001
- "data-testid": `toast-${toast.variant}`,
6002
- "data-toast": "",
6003
- role: toast.variant === "error" ? "alert" : "status",
6004
- children: [
6005
- /* @__PURE__ */ jsxRuntime.jsx(Glyph, { className: cn("mt-0.5 size-[18px] shrink-0", tone) }),
6006
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
6007
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold leading-snug text-foreground", children: toast.title }),
6008
- toast.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground", children: toast.description })
6009
- ] }),
6010
- /* @__PURE__ */ jsxRuntime.jsx(
6011
- "button",
6012
- {
6013
- onClick: () => dismiss(toast.id),
6014
- className: "shrink-0 rounded p-0.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground",
6015
- "aria-label": "Dismiss",
6016
- "data-testid": "toast-dismiss",
6017
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4" })
6018
- }
6019
- )
6020
- ]
6034
+ className: "toaster group",
6035
+ toastOptions: toastOptions ?? DEFAULT_TOAST_OPTIONS,
6036
+ ...props
6021
6037
  }
6022
6038
  );
6023
6039
  }
@@ -7368,6 +7384,10 @@ Object.defineProperty(exports, "isMessageType", {
7368
7384
  enumerable: true,
7369
7385
  get: function () { return client.isMessageType; }
7370
7386
  });
7387
+ Object.defineProperty(exports, "toast", {
7388
+ enumerable: true,
7389
+ get: function () { return sonner.toast; }
7390
+ });
7371
7391
  exports.ActivityFeed = ActivityFeed;
7372
7392
  exports.AiActionCard = AiActionCard;
7373
7393
  exports.AiAnswer = AiAnswer;
@@ -7487,6 +7507,7 @@ exports.ProjectEntity = ProjectEntity;
7487
7507
  exports.ProviderIcon = ProviderIcon;
7488
7508
  exports.RadioGroup = RadioGroup;
7489
7509
  exports.RadioGroupItem = RadioGroupItem;
7510
+ exports.RagDot = RagDot;
7490
7511
  exports.ScrollArea = ScrollArea;
7491
7512
  exports.ScrollBar = ScrollBar;
7492
7513
  exports.Select = Select;
@@ -7501,6 +7522,7 @@ exports.SelectTrigger = SelectTrigger;
7501
7522
  exports.SelectValue = SelectValue;
7502
7523
  exports.Separator = Separator;
7503
7524
  exports.Slider = Slider;
7525
+ exports.StatusPill = StatusPill;
7504
7526
  exports.Switch = Switch;
7505
7527
  exports.TAG_TYPE_ICONS = TAG_TYPE_ICONS;
7506
7528
  exports.TAG_TYPE_LABELS = TAG_TYPE_LABELS;
@@ -7540,6 +7562,8 @@ exports.buttonVariants = buttonVariants;
7540
7562
  exports.cardVariants = cardVariants;
7541
7563
  exports.cn = cn;
7542
7564
  exports.configureEntityRegistry = configureEntityRegistry;
7565
+ exports.configureRagLabels = configureRagLabels;
7566
+ exports.configureStatusRegistry = configureStatusRegistry;
7543
7567
  exports.cropImage = cropImage;
7544
7568
  exports.describeActivity = describeActivity;
7545
7569
  exports.formatRelativeTime = formatRelativeTime;
@@ -7548,6 +7572,7 @@ exports.getEntityColorStyles = getEntityColorStyles;
7548
7572
  exports.getEntityIcon = getEntityIcon;
7549
7573
  exports.getEntityLabel = getEntityLabel;
7550
7574
  exports.getNotificationTypeMeta = getNotificationTypeMeta;
7575
+ exports.getStatusVariant = getStatusVariant;
7551
7576
  exports.getTagTypeIcon = getTagTypeIcon;
7552
7577
  exports.getTagTypeLabel = getTagTypeLabel;
7553
7578
  exports.getWorkspaceActionText = getWorkspaceActionText;