@arbidocs/react 0.5.98 → 0.5.100
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 +0 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -84
- package/dist/index.d.ts +2 -84
- package/dist/index.js +2 -232
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -16327,236 +16327,6 @@ function ImageCropModal({
|
|
|
16327
16327
|
] })
|
|
16328
16328
|
] }) });
|
|
16329
16329
|
}
|
|
16330
|
-
var MAX_NAV = 5;
|
|
16331
|
-
var MAX_DOCS = 4;
|
|
16332
|
-
function CommandPalette({
|
|
16333
|
-
open,
|
|
16334
|
-
onOpenChange,
|
|
16335
|
-
navItems,
|
|
16336
|
-
onNavigate,
|
|
16337
|
-
buildAskPrompt = (q) => q,
|
|
16338
|
-
askDocIds = [],
|
|
16339
|
-
model,
|
|
16340
|
-
searchDocIds,
|
|
16341
|
-
onOpenDoc,
|
|
16342
|
-
placeholder = "Ask AI, or jump to a page\u2026",
|
|
16343
|
-
askHint = "Grounded in the live workspace",
|
|
16344
|
-
classNames,
|
|
16345
|
-
testId = "command-palette"
|
|
16346
|
-
}) {
|
|
16347
|
-
const task = useAiTask();
|
|
16348
|
-
const searchable = !!searchDocIds && searchDocIds.length > 0;
|
|
16349
|
-
const { results, search, status: searchStatus } = useSemanticSearch(searchDocIds ?? []);
|
|
16350
|
-
const [query, setQuery] = React.useState("");
|
|
16351
|
-
const inputRef = React.useRef(null);
|
|
16352
|
-
React.useEffect(() => {
|
|
16353
|
-
if (open) {
|
|
16354
|
-
setQuery("");
|
|
16355
|
-
task.reset();
|
|
16356
|
-
const t = setTimeout(() => inputRef.current?.focus(), 40);
|
|
16357
|
-
return () => clearTimeout(t);
|
|
16358
|
-
}
|
|
16359
|
-
}, [open]);
|
|
16360
|
-
const showingAnswer = task.status !== "idle";
|
|
16361
|
-
React.useEffect(() => {
|
|
16362
|
-
if (!searchable || showingAnswer) return;
|
|
16363
|
-
const q = query.trim();
|
|
16364
|
-
if (q.length < 2) return;
|
|
16365
|
-
const t = setTimeout(() => void search(q, "hybrid"), 300);
|
|
16366
|
-
return () => clearTimeout(t);
|
|
16367
|
-
}, [query, searchable, showingAnswer, search]);
|
|
16368
|
-
const navMatches = React.useMemo(() => {
|
|
16369
|
-
const q = query.trim().toLowerCase();
|
|
16370
|
-
if (!q) return navItems.slice(0, MAX_NAV);
|
|
16371
|
-
return navItems.filter(
|
|
16372
|
-
(i) => i.label.toLowerCase().includes(q) || (i.keywords ? i.keywords.toLowerCase().includes(q) : false)
|
|
16373
|
-
).slice(0, MAX_NAV);
|
|
16374
|
-
}, [query, navItems]);
|
|
16375
|
-
const docHits = React.useMemo(() => results.slice(0, MAX_DOCS), [results]);
|
|
16376
|
-
const go = (to) => {
|
|
16377
|
-
onOpenChange(false);
|
|
16378
|
-
onNavigate(to);
|
|
16379
|
-
};
|
|
16380
|
-
const openDoc = (docId) => {
|
|
16381
|
-
onOpenChange(false);
|
|
16382
|
-
onOpenDoc?.(docId);
|
|
16383
|
-
};
|
|
16384
|
-
const ask = () => {
|
|
16385
|
-
const q = query.trim();
|
|
16386
|
-
if (!q || task.isRunning) return;
|
|
16387
|
-
void task.run(buildAskPrompt(q), askDocIds, { model });
|
|
16388
|
-
};
|
|
16389
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16390
|
-
chunkWYZJLZ67_cjs.DialogContent,
|
|
16391
|
-
{
|
|
16392
|
-
className: chunkS6A6FSG7_cjs.cn(
|
|
16393
|
-
"top-[12%] max-w-2xl translate-y-0 gap-0 overflow-hidden p-0",
|
|
16394
|
-
classNames?.dialog
|
|
16395
|
-
),
|
|
16396
|
-
"data-testid": testId,
|
|
16397
|
-
children: [
|
|
16398
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.DialogTitle, { className: "sr-only", children: "Command palette" }),
|
|
16399
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-b border-border px-4", children: [
|
|
16400
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: chunkS6A6FSG7_cjs.cn("size-4 shrink-0 text-ai-accent", classNames?.leadingIcon) }),
|
|
16401
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16402
|
-
"input",
|
|
16403
|
-
{
|
|
16404
|
-
ref: inputRef,
|
|
16405
|
-
value: query,
|
|
16406
|
-
onChange: (e) => setQuery(e.target.value),
|
|
16407
|
-
onKeyDown: (e) => {
|
|
16408
|
-
if (e.key === "Enter") {
|
|
16409
|
-
e.preventDefault();
|
|
16410
|
-
ask();
|
|
16411
|
-
}
|
|
16412
|
-
},
|
|
16413
|
-
placeholder,
|
|
16414
|
-
className: chunkS6A6FSG7_cjs.cn(
|
|
16415
|
-
"h-14 flex-1 bg-transparent text-base outline-none placeholder:text-muted-foreground",
|
|
16416
|
-
classNames?.input
|
|
16417
|
-
),
|
|
16418
|
-
"data-testid": `${testId}-input`
|
|
16419
|
-
}
|
|
16420
|
-
),
|
|
16421
|
-
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "hidden rounded border border-border px-1.5 py-0.5 text-xs text-muted-foreground sm:inline", children: "\u2318K" })
|
|
16422
|
-
] }),
|
|
16423
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-[60vh] overflow-y-auto p-2", children: [
|
|
16424
|
-
query.trim() && !showingAnswer && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16425
|
-
"button",
|
|
16426
|
-
{
|
|
16427
|
-
type: "button",
|
|
16428
|
-
onClick: ask,
|
|
16429
|
-
className: chunkS6A6FSG7_cjs.cn(
|
|
16430
|
-
"mb-1 flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left hover:bg-accent",
|
|
16431
|
-
classNames?.askAction
|
|
16432
|
-
),
|
|
16433
|
-
"data-testid": `${testId}-ask`,
|
|
16434
|
-
children: [
|
|
16435
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16436
|
-
"span",
|
|
16437
|
-
{
|
|
16438
|
-
className: chunkS6A6FSG7_cjs.cn(
|
|
16439
|
-
"flex size-8 items-center justify-center rounded-md bg-ai-surface text-ai-accent",
|
|
16440
|
-
classNames?.askChip
|
|
16441
|
-
),
|
|
16442
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "size-4" })
|
|
16443
|
-
}
|
|
16444
|
-
),
|
|
16445
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
16446
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "block truncate text-sm font-medium text-foreground", children: [
|
|
16447
|
-
"Ask AI: \u201C",
|
|
16448
|
-
query.trim(),
|
|
16449
|
-
"\u201D"
|
|
16450
|
-
] }),
|
|
16451
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: askHint })
|
|
16452
|
-
] }),
|
|
16453
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CornerDownLeft, { className: "size-4 text-muted-foreground" })
|
|
16454
|
-
]
|
|
16455
|
-
}
|
|
16456
|
-
),
|
|
16457
|
-
showingAnswer && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2", "data-testid": `${testId}-answer`, children: [
|
|
16458
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16459
|
-
AiAnswer,
|
|
16460
|
-
{
|
|
16461
|
-
status: task.status,
|
|
16462
|
-
text: task.text,
|
|
16463
|
-
stepCount: task.stepCount,
|
|
16464
|
-
error: task.error,
|
|
16465
|
-
testId: `${testId}-ai`
|
|
16466
|
-
}
|
|
16467
|
-
),
|
|
16468
|
-
task.isDone && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16469
|
-
chunkWYZJLZ67_cjs.Button,
|
|
16470
|
-
{
|
|
16471
|
-
variant: "outline",
|
|
16472
|
-
size: "sm",
|
|
16473
|
-
onClick: () => task.reset(),
|
|
16474
|
-
"data-testid": `${testId}-clear`,
|
|
16475
|
-
children: "Ask another"
|
|
16476
|
-
}
|
|
16477
|
-
) })
|
|
16478
|
-
] }),
|
|
16479
|
-
!showingAnswer && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16480
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: query.trim() ? "Jump to" : "Go to" }),
|
|
16481
|
-
navMatches.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No pages match \u2014 press Enter to ask AI." }),
|
|
16482
|
-
navMatches.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16483
|
-
"button",
|
|
16484
|
-
{
|
|
16485
|
-
type: "button",
|
|
16486
|
-
onClick: () => go(item.to),
|
|
16487
|
-
className: chunkS6A6FSG7_cjs.cn(
|
|
16488
|
-
"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left hover:bg-accent",
|
|
16489
|
-
classNames?.navItem
|
|
16490
|
-
),
|
|
16491
|
-
"data-testid": `${testId}-nav-${item.id}`,
|
|
16492
|
-
children: [
|
|
16493
|
-
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, { className: "size-4 text-muted-foreground" }),
|
|
16494
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-sm text-foreground", children: item.label }),
|
|
16495
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "size-3.5 text-muted-foreground" })
|
|
16496
|
-
]
|
|
16497
|
-
},
|
|
16498
|
-
item.id
|
|
16499
|
-
)),
|
|
16500
|
-
searchable && query.trim().length >= 2 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16501
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Documents" }),
|
|
16502
|
-
searchStatus === "done" && docHits.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "No passages matched." }),
|
|
16503
|
-
docHits.map((hit, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16504
|
-
"button",
|
|
16505
|
-
{
|
|
16506
|
-
type: "button",
|
|
16507
|
-
onClick: () => hit.docId && openDoc(hit.docId),
|
|
16508
|
-
className: "flex w-full items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-accent",
|
|
16509
|
-
"data-testid": `${testId}-doc-${i}`,
|
|
16510
|
-
children: [
|
|
16511
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "mt-0.5 size-4 shrink-0 text-ai-accent" }),
|
|
16512
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
16513
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "block truncate text-sm text-foreground", children: [
|
|
16514
|
-
hit.docTitle ?? "Document",
|
|
16515
|
-
hit.page != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
|
|
16516
|
-
" \xB7 p.",
|
|
16517
|
-
hit.page
|
|
16518
|
-
] })
|
|
16519
|
-
] }),
|
|
16520
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-1 text-xs text-muted-foreground", children: hit.content })
|
|
16521
|
-
] })
|
|
16522
|
-
]
|
|
16523
|
-
},
|
|
16524
|
-
`${hit.docId}-${hit.page}-${i}`
|
|
16525
|
-
))
|
|
16526
|
-
] })
|
|
16527
|
-
] })
|
|
16528
|
-
] })
|
|
16529
|
-
]
|
|
16530
|
-
}
|
|
16531
|
-
) });
|
|
16532
|
-
}
|
|
16533
|
-
var CommandPaletteCtx = React.createContext(null);
|
|
16534
|
-
function useCommandPalette() {
|
|
16535
|
-
const v = React.useContext(CommandPaletteCtx);
|
|
16536
|
-
if (!v) throw new Error("useCommandPalette must be used within a CommandPaletteProvider");
|
|
16537
|
-
return v;
|
|
16538
|
-
}
|
|
16539
|
-
function CommandPaletteProvider({ children, ...paletteProps }) {
|
|
16540
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
16541
|
-
const open = React.useCallback(() => setIsOpen(true), []);
|
|
16542
|
-
const close = React.useCallback(() => setIsOpen(false), []);
|
|
16543
|
-
const toggle = React.useCallback(() => setIsOpen((o) => !o), []);
|
|
16544
|
-
React.useEffect(() => {
|
|
16545
|
-
const onKey = (e) => {
|
|
16546
|
-
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
16547
|
-
e.preventDefault();
|
|
16548
|
-
toggle();
|
|
16549
|
-
}
|
|
16550
|
-
};
|
|
16551
|
-
window.addEventListener("keydown", onKey);
|
|
16552
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
16553
|
-
}, [toggle]);
|
|
16554
|
-
const value = React.useMemo(() => ({ open, close, toggle, isOpen }), [open, close, toggle, isOpen]);
|
|
16555
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(CommandPaletteCtx.Provider, { value, children: [
|
|
16556
|
-
children,
|
|
16557
|
-
/* @__PURE__ */ jsxRuntime.jsx(CommandPalette, { open: isOpen, onOpenChange: setIsOpen, ...paletteProps })
|
|
16558
|
-
] });
|
|
16559
|
-
}
|
|
16560
16330
|
function useSupportTickets(options = {}) {
|
|
16561
16331
|
const arbi = chunkHAGC67GL_cjs.useArbi();
|
|
16562
16332
|
return reactQuery.useQuery({
|
|
@@ -19136,8 +18906,6 @@ exports.BUILTIN_DATA_SOURCES = BUILTIN_DATA_SOURCES;
|
|
|
19136
18906
|
exports.CONVERSATION_SWITCH_MEASURE = CONVERSATION_SWITCH_MEASURE;
|
|
19137
18907
|
exports.ChatBubble = ChatBubble;
|
|
19138
18908
|
exports.CitationRenderer = CitationRenderer;
|
|
19139
|
-
exports.CommandPalette = CommandPalette;
|
|
19140
|
-
exports.CommandPaletteProvider = CommandPaletteProvider;
|
|
19141
18909
|
exports.ConversationList = ConversationList;
|
|
19142
18910
|
exports.ConversationScope = ConversationScope;
|
|
19143
18911
|
exports.DATABASE_RELATION_PICK_LIMIT = DATABASE_RELATION_PICK_LIMIT;
|
|
@@ -19453,7 +19221,6 @@ exports.useChats = useChats;
|
|
|
19453
19221
|
exports.useClaimNativeAlias = useClaimNativeAlias;
|
|
19454
19222
|
exports.useClaimSecureMail = useClaimSecureMail;
|
|
19455
19223
|
exports.useCloseAgentSession = useCloseAgentSession;
|
|
19456
|
-
exports.useCommandPalette = useCommandPalette;
|
|
19457
19224
|
exports.useConfigSchema = useConfigSchema;
|
|
19458
19225
|
exports.useConfirmEmailChange = useConfirmEmailChange;
|
|
19459
19226
|
exports.useConnectCalDavAccount = useConnectCalDavAccount;
|