@arbidocs/react 0.5.75 → 0.5.76

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.
@@ -362,6 +362,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
362
362
  size = "sm",
363
363
  shape = "rounded",
364
364
  className,
365
+ style,
365
366
  labelMaxWidth = "max-w-[320px]",
366
367
  labelClassName,
367
368
  fullWidth = false,
@@ -501,6 +502,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
501
502
  (onClick || href) && !disabled && "cursor-pointer hover:bg-muted",
502
503
  highlight && highlightClasses
503
504
  ),
505
+ style,
504
506
  "data-testid": testId,
505
507
  children: [
506
508
  mainArea,
@@ -526,7 +528,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
526
528
  tooltipContent,
527
529
  tooltipSide,
528
530
  chunkS6A6FSG7_cjs.cn(baseClasses, interactiveClasses),
529
- { "data-testid": testId }
531
+ { "data-testid": testId, style }
530
532
  );
531
533
  }
532
534
  return tooltipWrap(
@@ -544,7 +546,8 @@ var EntityPill = React.forwardRef(function EntityPill2({
544
546
  ref,
545
547
  onClick: onClick && !disabled ? onClick : void 0,
546
548
  disabled: disabled || void 0,
547
- "data-testid": testId
549
+ "data-testid": testId,
550
+ style
548
551
  }
549
552
  );
550
553
  }
@@ -557,6 +560,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
557
560
  target: "_blank",
558
561
  rel: "noopener noreferrer",
559
562
  className: chunkS6A6FSG7_cjs.cn(baseClasses, interactiveClasses),
563
+ style,
560
564
  "data-testid": testId,
561
565
  onClick,
562
566
  children: mainContent
@@ -576,6 +580,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
576
580
  disabled ? disabledClasses : interactiveClasses,
577
581
  highlight && highlightClasses
578
582
  ),
583
+ style,
579
584
  "data-testid": testId,
580
585
  children: mainContent
581
586
  }
@@ -586,6 +591,7 @@ var EntityPill = React.forwardRef(function EntityPill2({
586
591
  {
587
592
  ref,
588
593
  className: chunkS6A6FSG7_cjs.cn(baseClasses, highlight && highlightClasses),
594
+ style,
589
595
  "data-testid": testId,
590
596
  children: mainContent
591
597
  }
@@ -1401,6 +1407,63 @@ function DocumentCard({
1401
1407
  }
1402
1408
  );
1403
1409
  }
1410
+
1411
+ // src/entities/colors.ts
1412
+ var OPACITY_LIGHT = 0.15;
1413
+ var OPACITY_MEDIUM = 1;
1414
+ var OPACITY_BORDER = 0.3;
1415
+ var PLACEHOLDER_COLOR = "#9ca3af";
1416
+ var NEUTRAL_GRAY2 = "#64748b";
1417
+ var BASE_COLORS = {
1418
+ "0": "#10b981",
1419
+ "1": "#3b82f6",
1420
+ "2": "#8b5cf6",
1421
+ "3": "#f43f5e",
1422
+ "4": "#f59e0b",
1423
+ "5": "#84cc16",
1424
+ "6": "#a855f7",
1425
+ "7": "#06b6d4",
1426
+ "8": "#f97316",
1427
+ "9": "#14b8a6",
1428
+ a: "#ef4444",
1429
+ b: "#6366f1",
1430
+ c: "#ec4899",
1431
+ d: "#22c55e",
1432
+ e: "#eab308",
1433
+ f: "#0ea5e9"
1434
+ };
1435
+ function hexToRgba(hex, opacity) {
1436
+ const r = parseInt(hex.slice(1, 3), 16);
1437
+ const g = parseInt(hex.slice(3, 5), 16);
1438
+ const b = parseInt(hex.slice(5, 7), 16);
1439
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
1440
+ }
1441
+ function getEntityColor(entityId, variant = "medium") {
1442
+ const baseColor = BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
1443
+ switch (variant) {
1444
+ case "light":
1445
+ return hexToRgba(baseColor, OPACITY_LIGHT);
1446
+ case "medium":
1447
+ return hexToRgba(baseColor, OPACITY_MEDIUM);
1448
+ case "text":
1449
+ return baseColor;
1450
+ }
1451
+ }
1452
+ function getEntityColorStyles(entityId) {
1453
+ const baseColor = BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
1454
+ return {
1455
+ backgroundColor: getEntityColor(entityId, "light"),
1456
+ color: baseColor,
1457
+ borderColor: hexToRgba(baseColor, OPACITY_BORDER)
1458
+ };
1459
+ }
1460
+ var getWorkspaceColor = (workspaceId, useWorkspaceColors) => {
1461
+ const shouldUseWorkspaceColors = useWorkspaceColors !== void 0 ? useWorkspaceColors : true;
1462
+ if (!shouldUseWorkspaceColors) return "hsl(var(--primary))";
1463
+ const isValidId = workspaceId && workspaceId.startsWith("wrk-") && workspaceId.length >= 5;
1464
+ if (!isValidId) return "hsl(var(--primary))";
1465
+ return getEntityColor(workspaceId, "medium");
1466
+ };
1404
1467
  var badgeVariants = classVarianceAuthority.cva(
1405
1468
  "inline-flex items-center rounded-md border px-2.5 py-0.5 text-sm font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1406
1469
  {
@@ -1448,77 +1511,57 @@ function getTagTypeLabel(type) {
1448
1511
  const t = type ?? "text";
1449
1512
  return TAG_TYPE_LABELS[t] || t;
1450
1513
  }
1451
- var BASE_COLORS = {
1452
- "0": "#10b981",
1453
- "1": "#3b82f6",
1454
- "2": "#8b5cf6",
1455
- "3": "#f43f5e",
1456
- "4": "#f59e0b",
1457
- "5": "#84cc16",
1458
- "6": "#a855f7",
1459
- "7": "#06b6d4",
1460
- "8": "#f97316",
1461
- "9": "#14b8a6",
1462
- a: "#ef4444",
1463
- b: "#6366f1",
1464
- c: "#ec4899",
1465
- d: "#22c55e",
1466
- e: "#eab308",
1467
- f: "#0ea5e9"
1468
- };
1469
- function getEntityColor(entityId) {
1470
- return BASE_COLORS[entityId[4]] || BASE_COLORS["0"];
1471
- }
1472
1514
  function TagEntity({
1473
1515
  tag,
1474
1516
  size = "md",
1517
+ checked = true,
1518
+ onCheckedChange,
1475
1519
  className = "",
1520
+ wrap = false,
1476
1521
  onClick,
1477
1522
  showTooltip = true,
1478
1523
  tooltipContent
1479
1524
  }) {
1480
1525
  const tagType = tag.tag_type?.type ?? "text";
1481
1526
  const iconSize = size === "sm" ? 12 : size === "md" ? 14 : 16;
1482
- const Icon2 = getTagTypeIcon(tagType);
1483
- const sizeClasses2 = {
1484
- sm: "p-0.5",
1485
- md: "p-1",
1486
- lg: "p-1.5"
1487
- };
1488
- const tagColor = tag.color ?? getEntityColor(tag.external_id);
1489
- const iconElement = /* @__PURE__ */ jsxRuntime.jsx(
1527
+ const tagColor = tag.color ?? getEntityColor(tag.external_id, "medium");
1528
+ const iconElement = onCheckedChange ? /* @__PURE__ */ jsxRuntime.jsx(
1529
+ "input",
1530
+ {
1531
+ type: "checkbox",
1532
+ "aria-label": tag.name,
1533
+ checked,
1534
+ onClick: (e) => e.stopPropagation(),
1535
+ onChange: (e) => onCheckedChange(e.target.checked),
1536
+ className: "shrink-0 cursor-pointer",
1537
+ style: { accentColor: tagColor, width: iconSize, height: iconSize }
1538
+ }
1539
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1490
1540
  "span",
1491
1541
  {
1492
- className: `inline-flex items-center justify-center rounded-md text-white flex-shrink-0 ${sizeClasses2[size]}`,
1493
- style: { backgroundColor: tagColor },
1494
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: iconSize, className: "flex-shrink-0" })
1542
+ className: "flex shrink-0 items-center justify-center rounded-sm border",
1543
+ style: {
1544
+ width: iconSize,
1545
+ height: iconSize,
1546
+ borderColor: tagColor,
1547
+ backgroundColor: checked ? tagColor : void 0
1548
+ },
1549
+ "aria-hidden": "true",
1550
+ children: checked && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: iconSize - 2, color: "#ffffff", strokeWidth: 3 })
1495
1551
  }
1496
1552
  );
1497
1553
  const pillSize = size === "lg" ? "base" : "sm";
1498
- const defaultTooltip = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
1554
+ const defaultTooltip = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5 text-sm", children: [
1499
1555
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1500
- /* @__PURE__ */ jsxRuntime.jsx(
1501
- "span",
1502
- {
1503
- className: "inline-flex items-center justify-center rounded-md text-white p-1",
1504
- style: { backgroundColor: tagColor },
1505
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 16 })
1506
- }
1507
- ),
1508
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: tag.name })
1556
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
1557
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: getTagTypeLabel(tagType) })
1509
1558
  ] }),
1510
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5 text-sm", children: [
1511
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1512
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
1513
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: getTagTypeLabel(tagType) })
1514
- ] }),
1515
- tag.doctag_count != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1516
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Documents:" }),
1517
- /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: "h-5 min-w-[20px] justify-center", children: tag.doctag_count ?? 0 })
1518
- ] }),
1519
- tag.shared != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: tag.shared ? "Shared" : "Private" }) })
1520
- ] })
1521
- ] });
1559
+ tag.doctag_count != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1560
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Documents:" }),
1561
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: "h-5 min-w-[20px] justify-center", children: tag.doctag_count ?? 0 })
1562
+ ] }),
1563
+ tag.shared != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: tag.shared ? "Shared" : "Private" }) })
1564
+ ] }) });
1522
1565
  const resolvedTooltip = showTooltip ? tooltipContent ?? defaultTooltip : void 0;
1523
1566
  return /* @__PURE__ */ jsxRuntime.jsx(
1524
1567
  EntityPill,
@@ -1526,11 +1569,13 @@ function TagEntity({
1526
1569
  icon: iconElement,
1527
1570
  label: tag.name,
1528
1571
  size: pillSize,
1529
- shape: "rounded",
1530
- labelMaxWidth: "max-w-[180px]",
1531
- tooltipContent: resolvedTooltip,
1532
- onClick,
1533
- className,
1572
+ shape: "pill",
1573
+ style: { borderColor: tagColor },
1574
+ labelMaxWidth: wrap ? "max-w-full" : "max-w-[180px]",
1575
+ labelClassName: wrap ? "whitespace-normal! line-clamp-3 break-words text-left" : void 0,
1576
+ tooltipContent: onCheckedChange ? void 0 : resolvedTooltip,
1577
+ onClick: onCheckedChange ? void 0 : onClick,
1578
+ className: `max-w-full px-2! py-0.5! ${className}`,
1534
1579
  "data-testid": `tag-entity-${tag.external_id}`
1535
1580
  }
1536
1581
  );
@@ -3044,63 +3089,6 @@ function RagDot({
3044
3089
  withLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: RAG_LABELS[rag] })
3045
3090
  ] });
3046
3091
  }
3047
-
3048
- // src/entities/colors.ts
3049
- var OPACITY_LIGHT = 0.15;
3050
- var OPACITY_MEDIUM = 1;
3051
- var OPACITY_BORDER = 0.3;
3052
- var PLACEHOLDER_COLOR = "#9ca3af";
3053
- var NEUTRAL_GRAY2 = "#64748b";
3054
- var BASE_COLORS2 = {
3055
- "0": "#10b981",
3056
- "1": "#3b82f6",
3057
- "2": "#8b5cf6",
3058
- "3": "#f43f5e",
3059
- "4": "#f59e0b",
3060
- "5": "#84cc16",
3061
- "6": "#a855f7",
3062
- "7": "#06b6d4",
3063
- "8": "#f97316",
3064
- "9": "#14b8a6",
3065
- a: "#ef4444",
3066
- b: "#6366f1",
3067
- c: "#ec4899",
3068
- d: "#22c55e",
3069
- e: "#eab308",
3070
- f: "#0ea5e9"
3071
- };
3072
- function hexToRgba(hex, opacity) {
3073
- const r = parseInt(hex.slice(1, 3), 16);
3074
- const g = parseInt(hex.slice(3, 5), 16);
3075
- const b = parseInt(hex.slice(5, 7), 16);
3076
- return `rgba(${r}, ${g}, ${b}, ${opacity})`;
3077
- }
3078
- function getEntityColor2(entityId, variant = "medium") {
3079
- const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3080
- switch (variant) {
3081
- case "light":
3082
- return hexToRgba(baseColor, OPACITY_LIGHT);
3083
- case "medium":
3084
- return hexToRgba(baseColor, OPACITY_MEDIUM);
3085
- case "text":
3086
- return baseColor;
3087
- }
3088
- }
3089
- function getEntityColorStyles(entityId) {
3090
- const baseColor = BASE_COLORS2[entityId[4]] || BASE_COLORS2["0"];
3091
- return {
3092
- backgroundColor: getEntityColor2(entityId, "light"),
3093
- color: baseColor,
3094
- borderColor: hexToRgba(baseColor, OPACITY_BORDER)
3095
- };
3096
- }
3097
- var getWorkspaceColor = (workspaceId, useWorkspaceColors) => {
3098
- const shouldUseWorkspaceColors = useWorkspaceColors !== void 0 ? useWorkspaceColors : true;
3099
- if (!shouldUseWorkspaceColors) return "hsl(var(--primary))";
3100
- const isValidId = workspaceId && workspaceId.startsWith("wrk-") && workspaceId.length >= 5;
3101
- if (!isValidId) return "hsl(var(--primary))";
3102
- return getEntityColor2(workspaceId, "medium");
3103
- };
3104
3092
  var ShieldIcon = ({
3105
3093
  char,
3106
3094
  size = 24,
@@ -5253,7 +5241,7 @@ exports.AiMarkdown = AiMarkdown;
5253
5241
  exports.ArbiBotHeadIcon = ArbiBotHeadIcon;
5254
5242
  exports.ArbiIcon = ArbiIcon;
5255
5243
  exports.AudIcon = AudIcon;
5256
- exports.BASE_COLORS = BASE_COLORS2;
5244
+ exports.BASE_COLORS = BASE_COLORS;
5257
5245
  exports.Badge = Badge;
5258
5246
  exports.COLUMN_LABEL_FALLBACKS = COLUMN_LABEL_FALLBACKS;
5259
5247
  exports.Card = Card;
@@ -5393,7 +5381,7 @@ exports.getDocumentDate = getDocumentDate;
5393
5381
  exports.getDocumentNature = getDocumentNature;
5394
5382
  exports.getDocumentSubject = getDocumentSubject;
5395
5383
  exports.getDocumentTitle = getDocumentTitle;
5396
- exports.getEntityColor = getEntityColor2;
5384
+ exports.getEntityColor = getEntityColor;
5397
5385
  exports.getEntityColorStyles = getEntityColorStyles;
5398
5386
  exports.getEntityIcon = getEntityIcon;
5399
5387
  exports.getEntityLabel = getEntityLabel;
@@ -5420,5 +5408,5 @@ exports.toggleVariants = toggleVariants;
5420
5408
  exports.useAudioRecorder = useAudioRecorder;
5421
5409
  exports.useDictateContext = useDictateContext;
5422
5410
  exports.usesOriginalBytesForViewer = usesOriginalBytesForViewer;
5423
- //# sourceMappingURL=chunk-3BFSALPC.cjs.map
5424
- //# sourceMappingURL=chunk-3BFSALPC.cjs.map
5411
+ //# sourceMappingURL=chunk-IHKQPOPK.cjs.map
5412
+ //# sourceMappingURL=chunk-IHKQPOPK.cjs.map