@arbidocs/react 0.3.118 → 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
@@ -5194,10 +5194,8 @@ var UserEntity = React.memo(function UserEntity2({
5194
5194
  );
5195
5195
  }
5196
5196
  const agentBadge = isAgent ? /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
5197
- const chatIcon = interactive && !isMe && !isAgent ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-shrink-0 ml-0.5", children: [
5198
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageCircleMore, { className: "w-3.5 h-3.5 text-muted-foreground" }),
5199
- 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" })
5200
- ] }) : void 0;
5197
+ const canMessage = interactive && !isMe && !isAgent;
5198
+ const showUnread = hasUnreadMessages && !isMe && !isAgent;
5201
5199
  const avatarCore = /* @__PURE__ */ jsxRuntime.jsxs(
5202
5200
  Avatar,
5203
5201
  {
@@ -5224,19 +5222,20 @@ var UserEntity = React.memo(function UserEntity2({
5224
5222
  ]
5225
5223
  }
5226
5224
  );
5227
- const presenceDot = displayStatus && /* @__PURE__ */ jsxRuntime.jsx(
5228
- "div",
5225
+ const statusDot = showUnread || displayStatus ? /* @__PURE__ */ jsxRuntime.jsx(
5226
+ "span",
5229
5227
  {
5230
5228
  className: cn(
5231
5229
  "absolute rounded-full border-white",
5232
5230
  presenceDotClasses[size],
5233
5231
  presencePositionClasses[size],
5234
- presenceColorClasses[displayStatus]
5232
+ !showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
5235
5233
  ),
5234
+ style: showUnread ? { backgroundColor: "#00adef" } : void 0,
5236
5235
  "data-testid": "user-entity-presence"
5237
5236
  }
5238
- );
5239
- const avatarElement = displayStatus ? /* @__PURE__ */ jsxRuntime.jsxs(
5237
+ ) : null;
5238
+ const avatarElement = statusDot ? /* @__PURE__ */ jsxRuntime.jsxs(
5240
5239
  "div",
5241
5240
  {
5242
5241
  className: cn(
@@ -5246,39 +5245,61 @@ var UserEntity = React.memo(function UserEntity2({
5246
5245
  ),
5247
5246
  children: [
5248
5247
  avatarCore,
5249
- presenceDot
5248
+ statusDot
5250
5249
  ]
5251
5250
  }
5252
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
+ ] });
5253
5264
  const resolvedTooltip = showTooltip ? tooltipContent : void 0;
5254
5265
  if (variant === "pill") {
5255
- 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) {
5256
5291
  return /* @__PURE__ */ jsxRuntime.jsx(
5257
- EntityPill,
5292
+ "button",
5258
5293
  {
5259
- icon: avatarElement,
5260
- label: displayName,
5261
- secondaryText: agentBadge,
5262
- shape: "pill",
5263
- tooltipContent: resolvedTooltip,
5264
- className,
5265
- "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
5266
5299
  }
5267
5300
  );
5268
5301
  }
5269
- return /* @__PURE__ */ jsxRuntime.jsx(
5270
- EntityPill,
5271
- {
5272
- icon: avatarElement,
5273
- label: displayName,
5274
- secondaryText: chatIcon || agentBadge,
5275
- shape: "pill",
5276
- onClick,
5277
- tooltipContent: resolvedTooltip,
5278
- className,
5279
- "data-testid": "user-entity-pill"
5280
- }
5281
- );
5302
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(rowClass, className), "data-testid": "user-entity-pill", children: row });
5282
5303
  }
5283
5304
  if (showTooltip) {
5284
5305
  return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
@@ -5288,6 +5309,51 @@ var UserEntity = React.memo(function UserEntity2({
5288
5309
  }
5289
5310
  return avatarElement;
5290
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
+ }
5291
5357
  var ENTITY_MAPPINGS = {
5292
5358
  PRODUCT: {
5293
5359
  NAMES: {
@@ -7441,6 +7507,7 @@ exports.ProjectEntity = ProjectEntity;
7441
7507
  exports.ProviderIcon = ProviderIcon;
7442
7508
  exports.RadioGroup = RadioGroup;
7443
7509
  exports.RadioGroupItem = RadioGroupItem;
7510
+ exports.RagDot = RagDot;
7444
7511
  exports.ScrollArea = ScrollArea;
7445
7512
  exports.ScrollBar = ScrollBar;
7446
7513
  exports.Select = Select;
@@ -7455,6 +7522,7 @@ exports.SelectTrigger = SelectTrigger;
7455
7522
  exports.SelectValue = SelectValue;
7456
7523
  exports.Separator = Separator;
7457
7524
  exports.Slider = Slider;
7525
+ exports.StatusPill = StatusPill;
7458
7526
  exports.Switch = Switch;
7459
7527
  exports.TAG_TYPE_ICONS = TAG_TYPE_ICONS;
7460
7528
  exports.TAG_TYPE_LABELS = TAG_TYPE_LABELS;
@@ -7494,6 +7562,8 @@ exports.buttonVariants = buttonVariants;
7494
7562
  exports.cardVariants = cardVariants;
7495
7563
  exports.cn = cn;
7496
7564
  exports.configureEntityRegistry = configureEntityRegistry;
7565
+ exports.configureRagLabels = configureRagLabels;
7566
+ exports.configureStatusRegistry = configureStatusRegistry;
7497
7567
  exports.cropImage = cropImage;
7498
7568
  exports.describeActivity = describeActivity;
7499
7569
  exports.formatRelativeTime = formatRelativeTime;
@@ -7502,6 +7572,7 @@ exports.getEntityColorStyles = getEntityColorStyles;
7502
7572
  exports.getEntityIcon = getEntityIcon;
7503
7573
  exports.getEntityLabel = getEntityLabel;
7504
7574
  exports.getNotificationTypeMeta = getNotificationTypeMeta;
7575
+ exports.getStatusVariant = getStatusVariant;
7505
7576
  exports.getTagTypeIcon = getTagTypeIcon;
7506
7577
  exports.getTagTypeLabel = getTagTypeLabel;
7507
7578
  exports.getWorkspaceActionText = getWorkspaceActionText;