@arbidocs/react 0.3.147 → 0.3.148
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 +92 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +91 -36
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2701,6 +2701,79 @@ function DocumentReview({
|
|
|
2701
2701
|
}
|
|
2702
2702
|
);
|
|
2703
2703
|
}
|
|
2704
|
+
var TIERS = [
|
|
2705
|
+
{ min: 0.7, tone: "bg-emerald-500", label: "High relevance" },
|
|
2706
|
+
{ min: 0.4, tone: "bg-amber-500", label: "Medium relevance" },
|
|
2707
|
+
{ min: -Infinity, tone: "bg-muted-foreground/40", label: "Low relevance" }
|
|
2708
|
+
];
|
|
2709
|
+
function RelevanceDot({ score }) {
|
|
2710
|
+
if (score == null) return null;
|
|
2711
|
+
const tier = TIERS.find((t) => score >= t.min) ?? TIERS[TIERS.length - 1];
|
|
2712
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2713
|
+
"span",
|
|
2714
|
+
{
|
|
2715
|
+
role: "img",
|
|
2716
|
+
"aria-label": tier.label,
|
|
2717
|
+
title: `${tier.label} (${score.toFixed(2)})`,
|
|
2718
|
+
className: chunkZBZKHBDS_cjs.cn("size-1.5 shrink-0 rounded-full", tier.tone),
|
|
2719
|
+
"data-testid": "passage-relevance"
|
|
2720
|
+
}
|
|
2721
|
+
);
|
|
2722
|
+
}
|
|
2723
|
+
function PassageCard({
|
|
2724
|
+
header,
|
|
2725
|
+
score,
|
|
2726
|
+
headerRight,
|
|
2727
|
+
active,
|
|
2728
|
+
onClick,
|
|
2729
|
+
footer,
|
|
2730
|
+
className,
|
|
2731
|
+
children,
|
|
2732
|
+
"data-testid": testId
|
|
2733
|
+
}) {
|
|
2734
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2735
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1.5 flex items-center gap-2", children: [
|
|
2736
|
+
header,
|
|
2737
|
+
(score != null || headerRight) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
2738
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score }),
|
|
2739
|
+
headerRight
|
|
2740
|
+
] })
|
|
2741
|
+
] }),
|
|
2742
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_mark]:rounded-sm [&_mark]:bg-ai-accent/20 [&_mark]:px-0.5 [&_mark]:font-medium [&_mark]:text-foreground", children })
|
|
2743
|
+
] });
|
|
2744
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2745
|
+
"div",
|
|
2746
|
+
{
|
|
2747
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
2748
|
+
"group rounded-lg border border-border bg-card p-3 text-left transition-colors",
|
|
2749
|
+
onClick && "hover:border-ai-accent/40 focus-within:ring-2 focus-within:ring-ai-accent/40",
|
|
2750
|
+
active && "border-ai-accent/60 ring-1 ring-ai-accent/30",
|
|
2751
|
+
className
|
|
2752
|
+
),
|
|
2753
|
+
children: [
|
|
2754
|
+
onClick ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2755
|
+
"div",
|
|
2756
|
+
{
|
|
2757
|
+
role: "button",
|
|
2758
|
+
tabIndex: 0,
|
|
2759
|
+
onClick,
|
|
2760
|
+
onKeyDown: (e) => {
|
|
2761
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2762
|
+
e.preventDefault();
|
|
2763
|
+
onClick(e);
|
|
2764
|
+
}
|
|
2765
|
+
},
|
|
2766
|
+
"aria-current": active || void 0,
|
|
2767
|
+
"data-testid": testId,
|
|
2768
|
+
className: "cursor-pointer focus:outline-none",
|
|
2769
|
+
children: body
|
|
2770
|
+
}
|
|
2771
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-current": active || void 0, "data-testid": testId, children: body }),
|
|
2772
|
+
footer
|
|
2773
|
+
]
|
|
2774
|
+
}
|
|
2775
|
+
);
|
|
2776
|
+
}
|
|
2704
2777
|
function queryTerms(query) {
|
|
2705
2778
|
const terms = /* @__PURE__ */ new Set();
|
|
2706
2779
|
for (const phrase of query.match(/"([^"]+)"/g) ?? []) {
|
|
@@ -2717,20 +2790,10 @@ function HighlightedSnippet({ text, terms }) {
|
|
|
2717
2790
|
if (terms.length === 0) return [text];
|
|
2718
2791
|
const escaped = terms.map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2719
2792
|
const re = new RegExp(`(${escaped.join("|")})`, "gi");
|
|
2720
|
-
return text.split(re).map(
|
|
2721
|
-
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "rounded-sm bg-ai-accent/20 px-0.5 text-foreground", children: part }, i) : part
|
|
2722
|
-
);
|
|
2793
|
+
return text.split(re).map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsxRuntime.jsx("mark", { children: part }, i) : part);
|
|
2723
2794
|
}, [text, terms]);
|
|
2724
2795
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: nodes });
|
|
2725
2796
|
}
|
|
2726
|
-
function RelevanceDot({ score }) {
|
|
2727
|
-
if (score == null) return null;
|
|
2728
|
-
const tone = score >= 0.7 ? "bg-emerald-500" : score >= 0.4 ? "bg-amber-500" : "bg-muted-foreground/40";
|
|
2729
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto inline-flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkZBZKHBDS_cjs.cn("size-1.5 rounded-full", tone), "aria-hidden": true }),
|
|
2731
|
-
score.toFixed(2)
|
|
2732
|
-
] });
|
|
2733
|
-
}
|
|
2734
2797
|
function ResultRow({
|
|
2735
2798
|
result,
|
|
2736
2799
|
index,
|
|
@@ -2738,34 +2801,26 @@ function ResultRow({
|
|
|
2738
2801
|
isActive,
|
|
2739
2802
|
onSelect
|
|
2740
2803
|
}) {
|
|
2741
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2742
|
-
|
|
2804
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2805
|
+
PassageCard,
|
|
2743
2806
|
{
|
|
2744
|
-
type: "button",
|
|
2745
2807
|
onClick: onSelect,
|
|
2808
|
+
active: isActive,
|
|
2809
|
+
score: result.score,
|
|
2746
2810
|
"data-testid": `arbi-semantic-search-result-${index}`,
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
"
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
children: [
|
|
2754
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2755
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 shrink-0 text-ai-accent" }),
|
|
2756
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium text-foreground", children: result.docTitle ?? "Document" }),
|
|
2757
|
-
result.page != null && /* @__PURE__ */ jsxRuntime.jsxs(chunkZBZKHBDS_cjs.Badge, { variant: "secondary", children: [
|
|
2758
|
-
"p.",
|
|
2759
|
-
result.page
|
|
2760
|
-
] }),
|
|
2761
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score: result.score })
|
|
2762
|
-
] }),
|
|
2763
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground", children: [
|
|
2764
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: "\u2026 " }),
|
|
2765
|
-
/* @__PURE__ */ jsxRuntime.jsx(HighlightedSnippet, { text: result.content, terms }),
|
|
2766
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " \u2026" })
|
|
2811
|
+
header: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2812
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 shrink-0 text-ai-accent" }),
|
|
2813
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium text-foreground", children: result.docTitle ?? "Document" }),
|
|
2814
|
+
result.page != null && /* @__PURE__ */ jsxRuntime.jsxs(chunkZBZKHBDS_cjs.Badge, { variant: "secondary", children: [
|
|
2815
|
+
"p.",
|
|
2816
|
+
result.page
|
|
2767
2817
|
] })
|
|
2768
|
-
]
|
|
2818
|
+
] }),
|
|
2819
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground", children: [
|
|
2820
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: "\u2026 " }),
|
|
2821
|
+
/* @__PURE__ */ jsxRuntime.jsx(HighlightedSnippet, { text: result.content, terms }),
|
|
2822
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " \u2026" })
|
|
2823
|
+
] })
|
|
2769
2824
|
}
|
|
2770
2825
|
);
|
|
2771
2826
|
}
|
|
@@ -7241,10 +7296,12 @@ exports.NEUTRAL_GRAY = NEUTRAL_GRAY2;
|
|
|
7241
7296
|
exports.NotificationBell = NotificationBell;
|
|
7242
7297
|
exports.OpenAIIcon = OpenAIIcon;
|
|
7243
7298
|
exports.PLACEHOLDER_COLOR = PLACEHOLDER_COLOR;
|
|
7299
|
+
exports.PassageCard = PassageCard;
|
|
7244
7300
|
exports.PdfIcon = PdfIcon;
|
|
7245
7301
|
exports.ProjectEntity = ProjectEntity;
|
|
7246
7302
|
exports.ProviderIcon = ProviderIcon;
|
|
7247
7303
|
exports.RagDot = RagDot;
|
|
7304
|
+
exports.RelevanceDot = RelevanceDot;
|
|
7248
7305
|
exports.SemanticSearch = SemanticSearch;
|
|
7249
7306
|
exports.StatusPill = StatusPill;
|
|
7250
7307
|
exports.TAG_TYPE_ICONS = TAG_TYPE_ICONS;
|