@mcp-b/react-components 0.16.1 → 0.17.0
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/{AgentChat-CrlpbvQJ.d.ts → AgentChat-CRuMi1Pb.d.ts} +4 -10
- package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
- package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
- package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Co1noLbC.js} +2 -2
- package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-Dnpr88ZQ.d.ts} +2 -2
- package/dist/Collapsible-N64ASIQr.d.ts +119 -0
- package/dist/{Combobox-B9Fcd6q-.d.ts → Combobox-CYc37s5l.d.ts} +11 -33
- package/dist/{FileTree-CkVbIMWV.js → FileTree-B7bBsUyU.js} +7 -7
- package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
- package/dist/{Message-BkMdE3bS.js → Message-C4eYRogZ.js} +3 -3
- package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-BNrZlY_Y.js} +5 -5
- package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-OLfXPuHM.d.ts} +39 -67
- package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
- package/dist/{Select-BeEsefzh.d.ts → Select-CwSqP07Y.d.ts} +14 -42
- package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-9zddXDQo.d.ts} +5 -19
- package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-DInElus-.js} +53 -26
- package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-BgesTfZ4.d.ts} +12 -4
- package/dist/{ThinkChatContext-C3Eb1Xpi.d.ts → ThinkChatContext-DrsZqdaO.d.ts} +1 -1
- package/dist/ThinkRecoveryNotice-DFIcG9UX.d.ts +19 -0
- package/dist/{Toggle-CAAlNl-M.d.ts → Toggle-DaXpe1Lc.d.ts} +1 -1
- package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-yseEWkOC.d.ts} +3 -4
- package/dist/{Workspace-D39LxGvP.d.ts → Workspace-C9RFoxcu.d.ts} +1 -1
- package/dist/WorkspaceExplorer-sZewzT2O.d.ts +32 -0
- package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-C8UzuSH4.d.ts} +1 -1
- package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-DNdGAEiX.js} +5 -5
- package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-B1ykV1dS.js} +15 -29
- package/dist/class-names-Bk-QLWWI.js +11 -0
- package/dist/components/Accordion.d.ts +5 -15
- package/dist/components/Accordion.js +11 -10
- package/dist/components/Activity.d.ts +5 -10
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.js +1 -1
- package/dist/components/AgentActivityPreview.js +2 -2
- package/dist/components/AgentAttention.d.ts +1 -1
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +27 -164
- package/dist/components/AgentChatMessageEditor.js +1 -1
- package/dist/components/AgentConnection.js +4 -4
- package/dist/components/AgentMessageParts.d.ts +2 -0
- package/dist/components/AgentMessageParts.js +119 -0
- package/dist/components/AgentToolDetail.d.ts +55 -0
- package/dist/components/AgentToolDetail.js +98 -0
- package/dist/components/AgentToolRunsContext.d.ts +2 -0
- package/dist/components/AgentToolRunsContext.js +16 -0
- package/dist/components/AlertDialog.d.ts +7 -19
- package/dist/components/AlertDialog.js +21 -32
- package/dist/components/AppTopBar.d.ts +4 -1
- package/dist/components/AppTopBar.js +5 -5
- package/dist/components/Approval.d.ts +102 -0
- package/dist/components/Approval.js +227 -0
- package/dist/components/Artifact.d.ts +2 -4
- package/dist/components/Artifact.js +3 -3
- package/dist/components/Autocomplete.d.ts +11 -33
- package/dist/components/Autocomplete.js +23 -30
- package/dist/components/Avatar.d.ts +3 -11
- package/dist/components/Avatar.js +13 -12
- package/dist/components/BrowserLiveView.js +2 -2
- package/dist/components/BrowserReplay.js +2 -2
- package/dist/components/BrowserRunPanel.js +58 -78
- package/dist/components/Button.js +4 -9
- package/dist/components/ChainOfThought.d.ts +5 -11
- package/dist/components/ChainOfThought.js +3 -2
- package/dist/components/ChatGptSignInScreen.js +3 -3
- package/dist/components/Checkbox.d.ts +2 -4
- package/dist/components/Checkbox.js +6 -5
- package/dist/components/CheckboxGroup.d.ts +1 -3
- package/dist/components/CheckboxGroup.js +15 -14
- package/dist/components/Checkpoint.d.ts +64 -0
- package/dist/components/Checkpoint.js +63 -0
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.d.ts +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.d.ts +1 -124
- package/dist/components/Collapsible.js +7 -10
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +23 -30
- package/dist/components/Commit.d.ts +5 -11
- package/dist/components/Commit.js +6 -5
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.d.ts +21 -37
- package/dist/components/ContextMenu.js +34 -51
- package/dist/components/Conversation.d.ts +2 -4
- package/dist/components/Conversation.js +2 -2
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.d.ts +6 -17
- package/dist/components/Dialog.js +17 -24
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +4 -3
- package/dist/components/Field.d.ts +17 -20
- package/dist/components/Field.js +16 -16
- package/dist/components/Fieldset.d.ts +2 -7
- package/dist/components/Fieldset.js +7 -6
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.d.ts +1 -4
- package/dist/components/Form.js +3 -2
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/InlineCitation.d.ts +66 -0
- package/dist/components/InlineCitation.js +142 -0
- package/dist/components/Input.d.ts +1 -4
- package/dist/components/Input.js +3 -2
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.d.ts +1 -1
- package/dist/components/McpServerPicker.js +6 -5
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +33 -52
- package/dist/components/Menubar.d.ts +22 -43
- package/dist/components/Menubar.js +36 -53
- package/dist/components/Message.d.ts +3 -6
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +3 -3
- package/dist/components/Meter.d.ts +5 -20
- package/dist/components/Meter.js +11 -10
- package/dist/components/ModelSelector.d.ts +2 -6
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.d.ts +11 -33
- package/dist/components/NavigationMenu.js +23 -30
- package/dist/components/NumberField.d.ts +6 -24
- package/dist/components/NumberField.js +13 -12
- package/dist/components/Plan.d.ts +103 -0
- package/dist/components/Plan.js +113 -0
- package/dist/components/Popover.d.ts +9 -36
- package/dist/components/Popover.js +23 -34
- package/dist/components/PreviewCard.d.ts +6 -24
- package/dist/components/PreviewCard.js +13 -24
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPlanCard.js +3 -3
- package/dist/components/PricingUsageCalculator.js +2 -2
- package/dist/components/Progress.d.ts +3 -8
- package/dist/components/Progress.js +7 -10
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +52 -200
- package/dist/components/Queue.d.ts +6 -16
- package/dist/components/Queue.js +2 -2
- package/dist/components/RadioGroup.d.ts +3 -8
- package/dist/components/RadioGroup.js +7 -10
- package/dist/components/Reasoning.d.ts +4 -8
- package/dist/components/Reasoning.js +3 -3
- package/dist/components/ResizableSidePanel.js +2 -2
- package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
- package/dist/components/ResponsiveSidebarShell.js +4 -3
- package/dist/components/ScrollArea.d.ts +5 -20
- package/dist/components/ScrollArea.js +11 -10
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +32 -55
- package/dist/components/Separator.d.ts +1 -5
- package/dist/components/Separator.js +3 -6
- package/dist/components/Slider.d.ts +6 -19
- package/dist/components/Slider.js +15 -14
- package/dist/components/Sources.d.ts +4 -9
- package/dist/components/Sources.js +3 -2
- package/dist/components/Stepper.js +2 -2
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.js +1 -2
- package/dist/components/SubagentRunSelector.d.ts +2 -11
- package/dist/components/SubagentRunSelector.js +16 -15
- package/dist/components/Switch.d.ts +2 -5
- package/dist/components/Switch.js +5 -8
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +10 -16
- package/dist/components/Task.d.ts +4 -9
- package/dist/components/Task.js +4 -3
- package/dist/components/Terminal.d.ts +2 -3
- package/dist/components/Terminal.js +3 -3
- package/dist/components/TestResults.d.ts +4 -9
- package/dist/components/TestResults.js +3 -2
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +21 -11
- package/dist/components/ThinkChat.js +5 -3
- package/dist/components/ThinkChatActivity.d.ts +1 -1
- package/dist/components/ThinkChatActivity.js +26 -7
- package/dist/components/ThinkChatContext.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +2 -2
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.js +2 -2
- package/dist/components/ThinkFullApp.d.ts +33 -9
- package/dist/components/ThinkFullApp.js +98 -69
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +2 -2
- package/dist/components/ThinkPendingApproval.d.ts +60 -0
- package/dist/components/ThinkPendingApproval.js +99 -0
- package/dist/components/ThinkRecoveryNotice.d.ts +2 -0
- package/dist/components/ThinkRecoveryNotice.js +40 -0
- package/dist/components/ThinkRoutine.js +1 -0
- package/dist/components/ThinkRoutineBrowser.js +6 -6
- package/dist/components/ThinkRoutineDetail.js +1 -1
- package/dist/components/ThinkRoutineForm.js +2 -2
- package/dist/components/ThinkRoutineLibrary.d.ts +9 -0
- package/dist/components/ThinkRoutineLibrary.js +67 -20
- package/dist/components/ThinkRoutineRuns.js +1 -1
- package/dist/components/ThinkThreadPicker.js +2 -2
- package/dist/components/ThinkThreadShell.d.ts +1 -1
- package/dist/components/Toast.d.ts +7 -28
- package/dist/components/Toast.js +15 -14
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +5 -5
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +8 -15
- package/dist/components/ToolApproval.d.ts +28 -0
- package/dist/components/ToolApproval.js +35 -0
- package/dist/components/ToolInvocation.d.ts +26 -0
- package/dist/components/ToolInvocation.js +72 -0
- package/dist/components/Toolbar.d.ts +6 -24
- package/dist/components/Toolbar.js +13 -12
- package/dist/components/Tooltip.d.ts +3 -9
- package/dist/components/Tooltip.js +7 -10
- package/dist/components/WebPreview.d.ts +1 -2
- package/dist/components/WebPreview.js +4 -3
- package/dist/components/Workspace.d.ts +1 -1
- package/dist/components/Workspace.js +5 -20
- package/dist/components/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/WorkspaceBrowser.js +3 -3
- package/dist/components/WorkspaceExplorer.d.ts +3 -31
- package/dist/components/WorkspaceExplorer.js +3 -3
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +1 -1
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.js +1 -1
- package/dist/components/WorkspaceLink.js +1 -1
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DtPMgN7e.d.ts → copy-button-CQx3LQAC.d.ts} +1 -2
- package/dist/{copy-button-Dejn5heL.js → copy-button-cYsJBauI.js} +1 -1
- package/dist/{icons-CpfUer49.js → icons--FqCZEc3.js} +3 -2
- package/dist/{icons-GQd1xF4e.d.ts → icons-DpUqY8Mp.d.ts} +6 -1
- package/dist/styles/agent-activity-preview.css +4 -0
- package/dist/styles/agent-chat.css +0 -41
- package/dist/styles/agent-connection.css +0 -12
- package/dist/styles/agent-tool-detail.css +54 -0
- package/dist/styles/approval.css +172 -0
- package/dist/styles/artifact.css +0 -12
- package/dist/styles/browser-run-panel.css +5 -2
- package/dist/styles/chain-of-thought.css +0 -8
- package/dist/styles/checkpoint.css +58 -0
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/commit.css +0 -21
- package/dist/styles/context-menu.css +0 -8
- package/dist/styles/environment-variables.css +0 -13
- package/dist/styles/file-tree.css +0 -16
- package/dist/styles/index.css +8 -4
- package/dist/styles/inline-citation.css +107 -0
- package/dist/styles/mcp-server-picker.css +0 -30
- package/dist/styles/menu.css +0 -29
- package/dist/styles/menubar.css +0 -8
- package/dist/styles/message-scroller.css +0 -12
- package/dist/styles/message.css +0 -12
- package/dist/styles/model-selector.css +0 -20
- package/dist/styles/plan.css +127 -0
- package/dist/styles/popover.css +0 -36
- package/dist/styles/prompt-input.css +2 -195
- package/dist/styles/recipes.css +114 -5
- package/dist/styles/responsive-sidebar-shell.css +16 -19
- package/dist/styles/sources.css +0 -8
- package/dist/styles/subagent-run.css +12 -70
- package/dist/styles/task.css +0 -16
- package/dist/styles/test-results.css +0 -13
- package/dist/styles/think-full-app.css +12 -38
- package/dist/styles/think-routine-library.css +12 -20
- package/dist/styles/think-thread-picker.css +15 -0
- package/dist/styles/toast.css +0 -7
- package/dist/styles/utilities.css +31 -0
- package/dist/styles/web-preview.css +0 -21
- package/dist/styles/workspace-explorer.css +5 -55
- package/dist/think-agent-Cip5KAPj.d.ts +7 -0
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/workspace-path-L_KmjRjq.js +26 -0
- package/package.json +3 -4
- package/dist/class-names-9UtZwb0J.js +0 -12
- package/dist/components/AppFrame.d.ts +0 -24
- package/dist/components/AppFrame.js +0 -25
- package/dist/components/Shell.d.ts +0 -163
- package/dist/components/Shell.js +0 -137
- package/dist/components/SubagentRun.d.ts +0 -86
- package/dist/components/SubagentRun.js +0 -108
- package/dist/styles/app-frame.css +0 -15
- package/dist/styles/shell.css +0 -122
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { w as LinkIcon } from "../icons--FqCZEc3.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Popover } from "./Popover.js";
|
|
5
5
|
import { Field } from "./Field.js";
|
|
6
6
|
import { Form } from "./Form.js";
|
|
7
|
-
import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-
|
|
7
|
+
import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-Co1noLbC.js";
|
|
8
8
|
import { CUSTOM_MCP_SERVER_CARD } from "../utils/mcp-server-catalog.js";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -131,7 +131,7 @@ function AgentConnectionPanel({ className, commands: commandsProp, defaultTarget
|
|
|
131
131
|
/* @__PURE__ */ jsxs("fieldset", {
|
|
132
132
|
className: "agent-connect__targets",
|
|
133
133
|
children: [/* @__PURE__ */ jsx("legend", {
|
|
134
|
-
className: "agent-connect__legend",
|
|
134
|
+
className: "agent-connect__legend sigvelo-visually-hidden",
|
|
135
135
|
children: "Agent connection target"
|
|
136
136
|
}), commands.map((command) => /* @__PURE__ */ jsx(Button, {
|
|
137
137
|
variant: "ghost",
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { d as MessageContent, f as MessageResponse, i as MessageAttachment } from "../Message-C4eYRogZ.js";
|
|
2
|
+
import { Reasoning, ReasoningContent, ReasoningTrigger } from "./Reasoning.js";
|
|
3
|
+
import { Source, Sources, SourcesContent, SourcesTrigger } from "./Sources.js";
|
|
4
|
+
import { ToolInvocation } from "./ToolInvocation.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
|
|
8
|
+
//#region src/components/AgentMessageParts.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Per-message row-size compaction marker from `AIChatAgent` persistence.
|
|
11
|
+
*
|
|
12
|
+
* This is distinct from Session history compaction overlays. When a single
|
|
13
|
+
* SQLite row approaches the Workers/SQLite size limit, Agents compacts large
|
|
14
|
+
* tool outputs and, if necessary, truncates text before persistence. The
|
|
15
|
+
* message remains in place and receives metadata keys documented by Agents:
|
|
16
|
+
* `compactedToolOutputs` lists tool-call ids whose outputs were summarized;
|
|
17
|
+
* `compactedTextParts` lists text-part indexes that were truncated. The UI
|
|
18
|
+
* reads those keys structurally because they are persisted metadata rather than
|
|
19
|
+
* exported AI SDK part variants, then adds a local visual note while preserving
|
|
20
|
+
* the original `UIMessage` and part shapes.
|
|
21
|
+
*
|
|
22
|
+
* @see https://github.com/cloudflare/agents/blob/main/docs/agents/chat-agents.md#row-size-protection
|
|
23
|
+
*/
|
|
24
|
+
function isCompactedPart(message, part, partIndex) {
|
|
25
|
+
const metadata = message.metadata;
|
|
26
|
+
if (isTextUIPart(part)) return Array.isArray(metadata?.compactedTextParts) && metadata.compactedTextParts.includes(partIndex);
|
|
27
|
+
if (isToolUIPart(part)) return Array.isArray(metadata?.compactedToolOutputs) && metadata.compactedToolOutputs.includes(part.toolCallId);
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
function getPartKey(part, partIndex) {
|
|
31
|
+
if (isToolUIPart(part)) return part.toolCallId;
|
|
32
|
+
if ("id" in part && typeof part.id === "string") return `${part.type}-${part.id}`;
|
|
33
|
+
return `${part.type}-${partIndex}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* AI SDK exports concrete source part types but no public source-part guard.
|
|
37
|
+
* Keep these local guards as exact discriminant checks, matching
|
|
38
|
+
* `ai/src/ui/ui-messages.ts` and `ai/src/ui/process-ui-message-stream.ts`.
|
|
39
|
+
* If AI SDK exports source or step guards later, replace these wrappers rather
|
|
40
|
+
* than widening the local transcript contract.
|
|
41
|
+
*/
|
|
42
|
+
function isSourceUrlPart(part) {
|
|
43
|
+
return part?.type === "source-url";
|
|
44
|
+
}
|
|
45
|
+
function isSourceDocumentPart(part) {
|
|
46
|
+
return part?.type === "source-document";
|
|
47
|
+
}
|
|
48
|
+
function formatSourceTitle(part) {
|
|
49
|
+
if (part.title) return part.title;
|
|
50
|
+
if (part.type === "source-document") return part.filename ?? part.mediaType;
|
|
51
|
+
try {
|
|
52
|
+
return new URL(part.url).hostname.replace(/^www\./, "");
|
|
53
|
+
} catch {
|
|
54
|
+
return part.url;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function renderSources(parts) {
|
|
58
|
+
return /* @__PURE__ */ jsxs(Sources, { children: [/* @__PURE__ */ jsx(SourcesTrigger, { count: parts.length }), /* @__PURE__ */ jsx(SourcesContent, { children: parts.map((part) => part.type === "source-url" ? /* @__PURE__ */ jsx(Source, {
|
|
59
|
+
href: part.url,
|
|
60
|
+
title: formatSourceTitle(part)
|
|
61
|
+
}, part.sourceId) : /* @__PURE__ */ jsx(Source, {
|
|
62
|
+
title: formatSourceTitle(part),
|
|
63
|
+
description: part.filename ?? part.mediaType
|
|
64
|
+
}, part.sourceId)) })] });
|
|
65
|
+
}
|
|
66
|
+
function getSourceRun(parts, start) {
|
|
67
|
+
const sources = [];
|
|
68
|
+
for (let index = start; index < parts.length; index++) {
|
|
69
|
+
const candidate = parts[index];
|
|
70
|
+
if (!isSourceUrlPart(candidate) && !isSourceDocumentPart(candidate)) break;
|
|
71
|
+
sources.push(candidate);
|
|
72
|
+
}
|
|
73
|
+
return sources;
|
|
74
|
+
}
|
|
75
|
+
function renderDefaultPart(message, part, partIndex, status) {
|
|
76
|
+
if (isTextUIPart(part) && part.text) return /* @__PURE__ */ jsx(MessageResponse, { children: part.text });
|
|
77
|
+
if (isFileUIPart(part)) return /* @__PURE__ */ jsx(MessageAttachment, { part });
|
|
78
|
+
if (isReasoningUIPart(part)) {
|
|
79
|
+
if (partIndex !== message.parts.findIndex(isReasoningUIPart)) return null;
|
|
80
|
+
const reasoningText = message.parts.filter(isReasoningUIPart).map((reasoningPart) => reasoningPart.text).join("\n\n");
|
|
81
|
+
if (!reasoningText) return null;
|
|
82
|
+
const lastPart = message.parts.at(-1);
|
|
83
|
+
return /* @__PURE__ */ jsxs(Reasoning, {
|
|
84
|
+
isStreaming: status === "streaming" && lastPart !== void 0 && isReasoningUIPart(lastPart) && lastPart.state === "streaming",
|
|
85
|
+
children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: reasoningText })]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (isToolUIPart(part)) return /* @__PURE__ */ jsx(ToolInvocation, { part });
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Renders the ordered parts of one whole AI SDK `UIMessage` without adding a
|
|
93
|
+
* transcript, message wrapper, composer, or transport. Compose it inside
|
|
94
|
+
* `Message` for read-only run previews and child-agent transcript rows.
|
|
95
|
+
*/
|
|
96
|
+
function AgentMessageParts({ message, status = "ready", renderPart }) {
|
|
97
|
+
return message.parts.map((part, partIndex) => {
|
|
98
|
+
const defaultRender = () => renderDefaultPart(message, part, partIndex, status);
|
|
99
|
+
const custom = renderPart?.({
|
|
100
|
+
message,
|
|
101
|
+
part,
|
|
102
|
+
partIndex,
|
|
103
|
+
defaultRender
|
|
104
|
+
});
|
|
105
|
+
if (isSourceUrlPart(part) || isSourceDocumentPart(part)) {
|
|
106
|
+
if (custom !== void 0) return custom ? /* @__PURE__ */ jsx(MessageContent, { children: custom }, getPartKey(part, partIndex)) : null;
|
|
107
|
+
const previous = message.parts[partIndex - 1];
|
|
108
|
+
if (isSourceUrlPart(previous) || isSourceDocumentPart(previous)) return null;
|
|
109
|
+
return /* @__PURE__ */ jsx(MessageContent, { children: renderSources(getSourceRun(message.parts, partIndex)) }, getPartKey(part, partIndex));
|
|
110
|
+
}
|
|
111
|
+
const rendered = custom === void 0 ? defaultRender() : custom;
|
|
112
|
+
return rendered ? /* @__PURE__ */ jsxs(MessageContent, { children: [rendered, isCompactedPart(message, part, partIndex) ? /* @__PURE__ */ jsx("div", {
|
|
113
|
+
className: "message__compacted",
|
|
114
|
+
children: "Output truncated for storage"
|
|
115
|
+
}) : null] }, getPartKey(part, partIndex)) : null;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { AgentMessageParts };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { n as ThinkChatValue } from "../ThinkChatContext-DrsZqdaO.js";
|
|
2
|
+
import { ThinkChatMessagesProps } from "./ThinkChat.js";
|
|
3
|
+
import { t as ThinkAgent } from "../think-agent-Cip5KAPj.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { UIMessage } from "ai";
|
|
6
|
+
import { UseAgentOptions, useAgent } from "agents/react";
|
|
7
|
+
import { AgentToolRunState } from "agents/agent-tools";
|
|
8
|
+
|
|
9
|
+
//#region src/components/AgentToolDetail.d.ts
|
|
10
|
+
interface AgentToolDetailProps<State = unknown, MessageT extends UIMessage = UIMessage> extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/** Whole retained run selected from the parent `useAgentToolEvents` result. */
|
|
12
|
+
run: AgentToolRunState<MessageT["parts"][number]>;
|
|
13
|
+
/** Whole child Think chat hook result; it owns the stored child transcript. */
|
|
14
|
+
chat: ThinkChatValue<State, MessageT>;
|
|
15
|
+
messages?: ThinkChatMessagesProps<MessageT>;
|
|
16
|
+
onBack?: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Live retained-child detail composed from upstream connection and chat values.
|
|
20
|
+
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
21
|
+
* compact parent-side stream projection and is never promoted to fake history.
|
|
22
|
+
*/
|
|
23
|
+
declare function AgentToolDetail<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
24
|
+
chat,
|
|
25
|
+
className,
|
|
26
|
+
messages,
|
|
27
|
+
onBack,
|
|
28
|
+
ref,
|
|
29
|
+
run,
|
|
30
|
+
...props
|
|
31
|
+
}: AgentToolDetailProps<State, MessageT> & {
|
|
32
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
interface SelectedAgentToolChildProps<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage> {
|
|
35
|
+
run: AgentToolRunState<MessageT["parts"][number]>;
|
|
36
|
+
/** Whole parent `useAgent` result used to derive the standard root-first route. */
|
|
37
|
+
parentAgent: ReturnType<typeof useAgent<ParentAgentT, ParentState>>;
|
|
38
|
+
/**
|
|
39
|
+
* Optional whole upstream connection options. Supply the same auth/query/base
|
|
40
|
+
* configuration as the parent; the selected `run.subAgent` is appended.
|
|
41
|
+
*/
|
|
42
|
+
connectionOptions?: UseAgentOptions<ChildState>;
|
|
43
|
+
messages?: ThinkChatMessagesProps<MessageT>;
|
|
44
|
+
onBack?: () => void;
|
|
45
|
+
}
|
|
46
|
+
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
47
|
+
declare function SelectedAgentToolChild<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage>({
|
|
48
|
+
connectionOptions,
|
|
49
|
+
messages,
|
|
50
|
+
onBack,
|
|
51
|
+
parentAgent,
|
|
52
|
+
run
|
|
53
|
+
}: SelectedAgentToolChildProps<ParentAgentT, ParentState, ChildState, MessageT>): React.JSX.Element;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { AgentToolDetail, AgentToolDetailProps, SelectedAgentToolChild, SelectedAgentToolChildProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
|
+
import { n as ArrowLeftIcon } from "../icons--FqCZEc3.js";
|
|
3
|
+
import { AppTopBar } from "./AppTopBar.js";
|
|
4
|
+
import { NaniteMark } from "./NaniteScene.js";
|
|
5
|
+
import { SubagentRunIndicator, getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
6
|
+
import { SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "./SubagentRunDetails.js";
|
|
7
|
+
import { t as ThinkChat } from "../ThinkChat-DInElus-.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useAgentChat } from "@cloudflare/think/react";
|
|
11
|
+
import { useAgent } from "agents/react";
|
|
12
|
+
//#region src/components/AgentToolDetail.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Live retained-child detail composed from upstream connection and chat values.
|
|
15
|
+
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
16
|
+
* compact parent-side stream projection and is never promoted to fake history.
|
|
17
|
+
*/
|
|
18
|
+
function AgentToolDetail({ chat, className, messages, onBack, ref, run, ...props }) {
|
|
19
|
+
const backRef = React.useRef(null);
|
|
20
|
+
const name = getSubagentRunName(run);
|
|
21
|
+
const progressLabel = run.progress?.message ?? run.progress?.phase;
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
backRef.current?.focus();
|
|
24
|
+
}, [run.runId]);
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
ref,
|
|
27
|
+
"data-slot": "agent-tool-detail",
|
|
28
|
+
className: cx("agent-tool-detail", className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
32
|
+
"aria-label": `${name} controls`,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [onBack ? /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
35
|
+
ref: backRef,
|
|
36
|
+
label: "Back to parent conversation",
|
|
37
|
+
onClick: onBack,
|
|
38
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
39
|
+
}) : null, /* @__PURE__ */ jsx(NaniteMark, { index: run.order })] }),
|
|
40
|
+
/* @__PURE__ */ jsx(AppTopBar.Title, { children: /* @__PURE__ */ jsx("h2", {
|
|
41
|
+
className: "agent-tool-detail__title",
|
|
42
|
+
children: name
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsx(AppTopBar.Trailing, { children: /* @__PURE__ */ jsx(SubagentRunIndicator, { run }) })
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
progressLabel || run.milestones?.length || run.error || run.summary ? /* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "agent-tool-detail__run-state",
|
|
49
|
+
children: [
|
|
50
|
+
progressLabel ? /* @__PURE__ */ jsx(SubagentRunProgress, {
|
|
51
|
+
label: progressLabel,
|
|
52
|
+
value: run.progress?.fraction
|
|
53
|
+
}) : null,
|
|
54
|
+
run.milestones?.length ? /* @__PURE__ */ jsx(SubagentRunMilestones, {
|
|
55
|
+
"aria-label": `${name} milestones`,
|
|
56
|
+
children: run.milestones.map((milestone) => /* @__PURE__ */ jsx(SubagentRunMilestone, { children: milestone.name }, milestone.sequence))
|
|
57
|
+
}) : null,
|
|
58
|
+
run.error ? /* @__PURE__ */ jsx("p", {
|
|
59
|
+
className: "agent-tool-detail__error",
|
|
60
|
+
children: run.error
|
|
61
|
+
}) : null,
|
|
62
|
+
!run.error && run.summary ? /* @__PURE__ */ jsx("p", {
|
|
63
|
+
className: "agent-tool-detail__summary",
|
|
64
|
+
children: run.summary
|
|
65
|
+
}) : null
|
|
66
|
+
]
|
|
67
|
+
}) : null,
|
|
68
|
+
/* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "agent-tool-detail__chat",
|
|
70
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Provider, {
|
|
71
|
+
chat,
|
|
72
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Messages, {
|
|
73
|
+
...messages,
|
|
74
|
+
showComposer: false
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
82
|
+
function SelectedAgentToolChild({ connectionOptions, messages, onBack, parentAgent, run }) {
|
|
83
|
+
const [root, ...parentSubPath] = parentAgent.path;
|
|
84
|
+
return /* @__PURE__ */ jsx(AgentToolDetail, {
|
|
85
|
+
run,
|
|
86
|
+
chat: useAgentChat({ agent: useAgent({
|
|
87
|
+
...connectionOptions ?? {
|
|
88
|
+
agent: root?.agent ?? parentAgent.agent,
|
|
89
|
+
name: root?.name ?? parentAgent.name
|
|
90
|
+
},
|
|
91
|
+
sub: [...connectionOptions?.sub ?? parentSubPath, run.subAgent]
|
|
92
|
+
}) }),
|
|
93
|
+
messages,
|
|
94
|
+
onBack
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { AgentToolDetail, SelectedAgentToolChild };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { i as useOptionalAgentToolRuns, n as AgentToolRunsProvider, r as AgentToolRunsProviderProps, t as AgentToolEventsValue } from "../AgentToolRunsContext-BVe4stgw.js";
|
|
2
|
+
export { AgentToolEventsValue, AgentToolRunsProvider, AgentToolRunsProviderProps, useOptionalAgentToolRuns };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/AgentToolRunsContext.tsx
|
|
4
|
+
const AgentToolRunsContext = React.createContext(null);
|
|
5
|
+
/** Provides one parent connection's retained Agent Tool event projection. */
|
|
6
|
+
function AgentToolRunsProvider({ agentTools, children }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(AgentToolRunsContext.Provider, {
|
|
8
|
+
value: agentTools,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function useOptionalAgentToolRuns() {
|
|
13
|
+
return React.useContext(AgentToolRunsContext);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AgentToolRunsProvider, useOptionalAgentToolRuns };
|
|
@@ -3,31 +3,19 @@ import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
|
3
3
|
|
|
4
4
|
//#region src/components/AlertDialog.d.ts
|
|
5
5
|
interface AlertDialogProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Root> {}
|
|
6
|
-
interface AlertDialogTriggerProps extends
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
interface
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
interface AlertDialogViewportProps extends Omit<React.ComponentPropsWithRef<typeof AlertDialog$1.Viewport>, "className"> {
|
|
13
|
-
className?: string;
|
|
14
|
-
}
|
|
15
|
-
interface AlertDialogPopupProps extends Omit<React.ComponentPropsWithRef<typeof AlertDialog$1.Popup>, "className"> {
|
|
16
|
-
className?: string;
|
|
6
|
+
interface AlertDialogTriggerProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Trigger> {}
|
|
7
|
+
interface AlertDialogBackdropProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Backdrop> {}
|
|
8
|
+
interface AlertDialogViewportProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Viewport> {}
|
|
9
|
+
interface AlertDialogPopupProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Popup> {
|
|
17
10
|
/**
|
|
18
11
|
* The size of the alert dialog.
|
|
19
12
|
* @default 'md'
|
|
20
13
|
*/
|
|
21
14
|
size?: "sm" | "md" | "lg";
|
|
22
15
|
}
|
|
23
|
-
interface AlertDialogTitleProps extends
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
interface AlertDialogDescriptionProps extends Omit<React.ComponentPropsWithRef<typeof AlertDialog$1.Description>, "className"> {
|
|
27
|
-
className?: string;
|
|
28
|
-
}
|
|
29
|
-
interface AlertDialogCloseProps extends Omit<React.ComponentPropsWithRef<typeof AlertDialog$1.Close>, "className"> {
|
|
30
|
-
className?: string;
|
|
16
|
+
interface AlertDialogTitleProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Title> {}
|
|
17
|
+
interface AlertDialogDescriptionProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Description> {}
|
|
18
|
+
interface AlertDialogCloseProps extends React.ComponentPropsWithRef<typeof AlertDialog$1.Close> {
|
|
31
19
|
/**
|
|
32
20
|
* The variant of the close button.
|
|
33
21
|
* @default 'secondary'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-Bk-QLWWI.js";
|
|
1
2
|
import "react";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
@@ -30,8 +31,8 @@ import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
|
30
31
|
*
|
|
31
32
|
* @see {@link https://base-ui.com/react/components/alert-dialog | Base UI Alert Dialog}
|
|
32
33
|
*/
|
|
33
|
-
function AlertDialogTrigger({ className
|
|
34
|
-
const classes = ["alert-dialog__trigger"
|
|
34
|
+
function AlertDialogTrigger({ className, ref, ...props }) {
|
|
35
|
+
const classes = mergeBaseClassName(["alert-dialog__trigger"].filter(Boolean).join(" "), className);
|
|
35
36
|
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
36
37
|
ref,
|
|
37
38
|
"data-slot": "alert-dialog-trigger",
|
|
@@ -39,12 +40,8 @@ function AlertDialogTrigger({ className = "", ref, ...props }) {
|
|
|
39
40
|
...props
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
function AlertDialogBackdrop({ className
|
|
43
|
-
const classes = [
|
|
44
|
-
"alert-dialog__backdrop",
|
|
45
|
-
"base-ui-backdrop",
|
|
46
|
-
className
|
|
47
|
-
].filter(Boolean).join(" ");
|
|
43
|
+
function AlertDialogBackdrop({ className, ref, ...props }) {
|
|
44
|
+
const classes = mergeBaseClassName(["alert-dialog__backdrop", "base-ui-backdrop"].filter(Boolean).join(" "), className);
|
|
48
45
|
return /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, {
|
|
49
46
|
ref,
|
|
50
47
|
"data-slot": "alert-dialog-overlay",
|
|
@@ -52,8 +49,8 @@ function AlertDialogBackdrop({ className = "", ref, ...props }) {
|
|
|
52
49
|
...props
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
|
-
function AlertDialogViewport({ className
|
|
56
|
-
const classes = ["alert-dialog__viewport"
|
|
52
|
+
function AlertDialogViewport({ className, ref, ...props }) {
|
|
53
|
+
const classes = mergeBaseClassName(["alert-dialog__viewport"].filter(Boolean).join(" "), className);
|
|
57
54
|
return /* @__PURE__ */ jsx(AlertDialog$1.Viewport, {
|
|
58
55
|
ref,
|
|
59
56
|
"data-slot": "alert-dialog-viewport",
|
|
@@ -61,12 +58,8 @@ function AlertDialogViewport({ className = "", ref, ...props }) {
|
|
|
61
58
|
...props
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
|
-
function AlertDialogPopup({ size = "md", className
|
|
65
|
-
const classes = [
|
|
66
|
-
"alert-dialog__popup",
|
|
67
|
-
size !== "md" && `alert-dialog__popup--${size}`,
|
|
68
|
-
className
|
|
69
|
-
].filter(Boolean).join(" ");
|
|
61
|
+
function AlertDialogPopup({ size = "md", className, ref, ...props }) {
|
|
62
|
+
const classes = mergeBaseClassName(["alert-dialog__popup", size !== "md" && `alert-dialog__popup--${size}`].filter(Boolean).join(" "), className);
|
|
70
63
|
return /* @__PURE__ */ jsx(AlertDialog$1.Popup, {
|
|
71
64
|
ref,
|
|
72
65
|
"data-slot": "alert-dialog-content",
|
|
@@ -74,32 +67,32 @@ function AlertDialogPopup({ size = "md", className = "", ref, ...props }) {
|
|
|
74
67
|
...props
|
|
75
68
|
});
|
|
76
69
|
}
|
|
77
|
-
function AlertDialogHeader({ className
|
|
70
|
+
function AlertDialogHeader({ className, ref, ...props }) {
|
|
78
71
|
return /* @__PURE__ */ jsx("div", {
|
|
79
72
|
ref,
|
|
80
73
|
"data-slot": "alert-dialog-header",
|
|
81
|
-
className: ["alert-dialog__header"
|
|
74
|
+
className: mergeBaseClassName(["alert-dialog__header"].filter(Boolean).join(" "), className),
|
|
82
75
|
...props
|
|
83
76
|
});
|
|
84
77
|
}
|
|
85
|
-
function AlertDialogFooter({ className
|
|
78
|
+
function AlertDialogFooter({ className, ref, ...props }) {
|
|
86
79
|
return /* @__PURE__ */ jsx("div", {
|
|
87
80
|
ref,
|
|
88
81
|
"data-slot": "alert-dialog-footer",
|
|
89
|
-
className: ["alert-dialog__footer"
|
|
82
|
+
className: mergeBaseClassName(["alert-dialog__footer"].filter(Boolean).join(" "), className),
|
|
90
83
|
...props
|
|
91
84
|
});
|
|
92
85
|
}
|
|
93
|
-
function AlertDialogMedia({ className
|
|
86
|
+
function AlertDialogMedia({ className, ref, ...props }) {
|
|
94
87
|
return /* @__PURE__ */ jsx("div", {
|
|
95
88
|
ref,
|
|
96
89
|
"data-slot": "alert-dialog-media",
|
|
97
|
-
className: ["alert-dialog__media"
|
|
90
|
+
className: mergeBaseClassName(["alert-dialog__media"].filter(Boolean).join(" "), className),
|
|
98
91
|
...props
|
|
99
92
|
});
|
|
100
93
|
}
|
|
101
|
-
function AlertDialogTitle({ className
|
|
102
|
-
const classes = ["alert-dialog__title"
|
|
94
|
+
function AlertDialogTitle({ className, ref, ...props }) {
|
|
95
|
+
const classes = mergeBaseClassName(["alert-dialog__title"].filter(Boolean).join(" "), className);
|
|
103
96
|
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
104
97
|
ref,
|
|
105
98
|
"data-slot": "alert-dialog-title",
|
|
@@ -107,8 +100,8 @@ function AlertDialogTitle({ className = "", ref, ...props }) {
|
|
|
107
100
|
...props
|
|
108
101
|
});
|
|
109
102
|
}
|
|
110
|
-
function AlertDialogDescription({ className
|
|
111
|
-
const classes = ["alert-dialog__description"
|
|
103
|
+
function AlertDialogDescription({ className, ref, ...props }) {
|
|
104
|
+
const classes = mergeBaseClassName(["alert-dialog__description"].filter(Boolean).join(" "), className);
|
|
112
105
|
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
113
106
|
ref,
|
|
114
107
|
"data-slot": "alert-dialog-description",
|
|
@@ -116,12 +109,8 @@ function AlertDialogDescription({ className = "", ref, ...props }) {
|
|
|
116
109
|
...props
|
|
117
110
|
});
|
|
118
111
|
}
|
|
119
|
-
function AlertDialogClose({ variant = "secondary", className
|
|
120
|
-
const classes = [
|
|
121
|
-
"alert-dialog__action",
|
|
122
|
-
`alert-dialog__action--${variant}`,
|
|
123
|
-
className
|
|
124
|
-
].filter(Boolean).join(" ");
|
|
112
|
+
function AlertDialogClose({ variant = "secondary", className, ref, ...props }) {
|
|
113
|
+
const classes = mergeBaseClassName(["alert-dialog__action", `alert-dialog__action--${variant}`].filter(Boolean).join(" "), className);
|
|
125
114
|
return /* @__PURE__ */ jsx(AlertDialog$1.Close, {
|
|
126
115
|
ref,
|
|
127
116
|
"data-slot": "alert-dialog-close",
|
|
@@ -9,12 +9,15 @@ interface AppTopBarRootProps extends React.ComponentPropsWithoutRef<typeof Toolb
|
|
|
9
9
|
interface AppTopBarGroupProps extends ToolbarGroupProps {}
|
|
10
10
|
interface AppTopBarTitleProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
11
11
|
interface AppTopBarButtonProps extends Omit<ToolbarButtonProps, "aria-label"> {
|
|
12
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
12
13
|
/** Accessible name and default tooltip text for the icon-only control. */
|
|
13
14
|
label: string;
|
|
14
15
|
/** Tooltip text when it should differ from the accessible name. */
|
|
15
16
|
tooltip?: React.ReactNode;
|
|
16
17
|
}
|
|
17
|
-
interface AppTopBarControlProps extends ToolbarButtonProps {
|
|
18
|
+
interface AppTopBarControlProps extends ToolbarButtonProps {
|
|
19
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
20
|
+
}
|
|
18
21
|
/**
|
|
19
22
|
* Stable application-level toolbar with composable leading, title, and trailing
|
|
20
23
|
* slots. Descendant buttons share Base UI's roving focus and tooltip provider.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
1
|
+
import { n as mergeBaseClassName, t as cx } from "../class-names-Bk-QLWWI.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
3
|
import { Tooltip } from "./Tooltip.js";
|
|
4
4
|
import { Toolbar } from "./Toolbar.js";
|
|
@@ -11,14 +11,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
*/
|
|
12
12
|
function AppTopBarRoot({ children, className, ...props }) {
|
|
13
13
|
return /* @__PURE__ */ jsx(Tooltip.Provider, { children: /* @__PURE__ */ jsx(Toolbar.Root, {
|
|
14
|
-
className:
|
|
14
|
+
className: mergeBaseClassName("app-top-bar", className),
|
|
15
15
|
...props,
|
|
16
16
|
children
|
|
17
17
|
}) });
|
|
18
18
|
}
|
|
19
19
|
function AppTopBarLeading({ className, ...props }) {
|
|
20
20
|
return /* @__PURE__ */ jsx(Toolbar.Group, {
|
|
21
|
-
className:
|
|
21
|
+
className: mergeBaseClassName("app-top-bar__leading", className),
|
|
22
22
|
...props
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -31,13 +31,13 @@ function AppTopBarTitle({ className, ref, ...props }) {
|
|
|
31
31
|
}
|
|
32
32
|
function AppTopBarTrailing({ className, ...props }) {
|
|
33
33
|
return /* @__PURE__ */ jsx(Toolbar.Group, {
|
|
34
|
-
className:
|
|
34
|
+
className: mergeBaseClassName("app-top-bar__trailing", className),
|
|
35
35
|
...props
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
function AppTopBarControl({ className, ...props }) {
|
|
39
39
|
return /* @__PURE__ */ jsx(Toolbar.Button, {
|
|
40
|
-
className:
|
|
40
|
+
className: mergeBaseClassName("app-top-bar__button", className),
|
|
41
41
|
...props
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Approval.d.ts
|
|
4
|
+
interface ApprovalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Approval question, preview, and decision controls composed by the application. */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Presentation-only frame for a human approval request. */
|
|
9
|
+
declare function Approval({
|
|
10
|
+
className,
|
|
11
|
+
ref,
|
|
12
|
+
...props
|
|
13
|
+
}: ApprovalProps & {
|
|
14
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
interface ApprovalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
17
|
+
/** Question and optional queue position for an approval request. */
|
|
18
|
+
declare function ApprovalHeader({
|
|
19
|
+
className,
|
|
20
|
+
ref,
|
|
21
|
+
...props
|
|
22
|
+
}: ApprovalHeaderProps & {
|
|
23
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
24
|
+
}): React.JSX.Element;
|
|
25
|
+
interface ApprovalQuestionProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
26
|
+
/** The request phrased as a human-readable question. */
|
|
27
|
+
declare function ApprovalQuestion({
|
|
28
|
+
className,
|
|
29
|
+
ref,
|
|
30
|
+
...props
|
|
31
|
+
}: ApprovalQuestionProps & {
|
|
32
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
interface ApprovalCountProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
35
|
+
/** Position of the current request in an app-owned approval queue. */
|
|
36
|
+
declare function ApprovalCount({
|
|
37
|
+
className,
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
}: ApprovalCountProps & {
|
|
41
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
interface ApprovalPreviewProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
44
|
+
/** Bounded, read-only preview of the operation being authorized. */
|
|
45
|
+
declare function ApprovalPreview({
|
|
46
|
+
className,
|
|
47
|
+
ref,
|
|
48
|
+
...props
|
|
49
|
+
}: ApprovalPreviewProps & {
|
|
50
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
51
|
+
}): React.JSX.Element;
|
|
52
|
+
interface ApprovalPreviewRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
53
|
+
label?: React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
/** One labelled value in an approval preview. */
|
|
56
|
+
declare function ApprovalPreviewRow({
|
|
57
|
+
children,
|
|
58
|
+
className,
|
|
59
|
+
label,
|
|
60
|
+
ref,
|
|
61
|
+
...props
|
|
62
|
+
}: ApprovalPreviewRowProps & {
|
|
63
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
64
|
+
}): React.JSX.Element;
|
|
65
|
+
declare function formatApprovalValue(value: unknown): string;
|
|
66
|
+
interface ApprovalInputPreviewProps {
|
|
67
|
+
input: unknown;
|
|
68
|
+
}
|
|
69
|
+
/** Renders unknown upstream input without changing or normalizing its shape. */
|
|
70
|
+
declare function ApprovalInputPreview({
|
|
71
|
+
input
|
|
72
|
+
}: ApprovalInputPreviewProps): React.JSX.Element;
|
|
73
|
+
interface ApprovalDecisionValue {
|
|
74
|
+
approved: boolean;
|
|
75
|
+
reason?: string;
|
|
76
|
+
}
|
|
77
|
+
interface ApprovalDecisionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
78
|
+
/** Presentation callback. Transport adapters supply the upstream operation. */
|
|
79
|
+
onDecision: (decision: ApprovalDecisionValue) => void | PromiseLike<void>;
|
|
80
|
+
/** Dismisses the local presentation without settling the upstream request. */
|
|
81
|
+
onSkip?: () => void;
|
|
82
|
+
/** Accessible subject used by the deny-reason label. */
|
|
83
|
+
subject?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Keyboard-operable approve/deny controls shared by inline and durable adapters.
|
|
87
|
+
* Arrow keys move between approve and deny, `1` returns to approve, and Enter
|
|
88
|
+
* in the reason field submits a denial. Async failures stay visible and are
|
|
89
|
+
* announced politely without coupling this presentation to a transport.
|
|
90
|
+
*/
|
|
91
|
+
declare function ApprovalDecision({
|
|
92
|
+
className,
|
|
93
|
+
onDecision,
|
|
94
|
+
onSkip,
|
|
95
|
+
subject,
|
|
96
|
+
ref,
|
|
97
|
+
...props
|
|
98
|
+
}: ApprovalDecisionProps & {
|
|
99
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
100
|
+
}): React.JSX.Element;
|
|
101
|
+
//#endregion
|
|
102
|
+
export { Approval, ApprovalCount, ApprovalCountProps, ApprovalDecision, ApprovalDecisionProps, ApprovalDecisionValue, ApprovalHeader, ApprovalHeaderProps, ApprovalInputPreview, ApprovalInputPreviewProps, ApprovalPreview, ApprovalPreviewProps, ApprovalPreviewRow, ApprovalPreviewRowProps, ApprovalProps, ApprovalQuestion, ApprovalQuestionProps, formatApprovalValue };
|