@mcp-b/react-components 0.16.1 → 0.18.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/{AgentActivity-BNUNrP9O.d.ts → AgentActivity-D2SHSGFX.d.ts} +1 -1
- package/dist/{AgentChat-CrlpbvQJ.d.ts → AgentChat-ClxViuUM.d.ts} +4 -29
- package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
- package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Bfp5PAg3.js} +9 -6
- package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- 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-3zYtrddG.js} +46 -20
- package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
- package/dist/{Message-BkMdE3bS.js → Message-BXtmfc9Q.js} +13 -20
- package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-Cqw_qrUG.js} +18 -25
- package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-Bdh9pqlo.d.ts} +41 -71
- package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
- package/dist/{Select-BeEsefzh.d.ts → Select-B_13gg_J.d.ts} +16 -44
- package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-ColWK-XA.d.ts} +14 -20
- package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-15EhfvYJ.js} +123 -73
- package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +9 -4
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- 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-JKZ43D5S.d.ts} +2 -2
- package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +4 -5
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/WorkspaceExplorer-B9dQWNVK.d.ts +32 -0
- package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-C68Ub8S8.js} +121 -128
- package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-BYYeTQLf.js} +20 -55
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/class-names-BiMDVpUo.js +14 -0
- package/dist/components/Accordion.d.ts +5 -15
- package/dist/components/Accordion.js +16 -10
- package/dist/components/Activity.d.ts +5 -10
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.d.ts +1 -1
- package/dist/components/AgentActivity.js +4 -5
- package/dist/components/AgentActivityPreview.d.ts +9 -9
- package/dist/components/AgentActivityPreview.js +8 -12
- package/dist/components/AgentAttention.d.ts +2 -2
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +113 -218
- package/dist/components/AgentChatMessageEditor.js +3 -3
- package/dist/components/AgentChatTurnError.js +2 -2
- 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 +57 -0
- package/dist/components/AgentToolDetail.js +100 -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 +28 -8
- package/dist/components/AppTopBar.js +36 -12
- package/dist/components/Approval.d.ts +102 -0
- package/dist/components/Approval.js +227 -0
- package/dist/components/Artifact.d.ts +3 -5
- package/dist/components/Artifact.js +7 -5
- package/dist/components/Autocomplete.d.ts +11 -33
- package/dist/components/Autocomplete.js +23 -30
- package/dist/components/Avatar.d.ts +4 -12
- package/dist/components/Avatar.js +13 -12
- package/dist/components/Badge.js +3 -0
- package/dist/components/BrowserLiveView.js +27 -12
- package/dist/components/BrowserReplay.js +4 -3
- package/dist/components/BrowserRunPanel.js +58 -78
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -16
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +5 -11
- package/dist/components/ChainOfThought.js +3 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- 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 +3 -5
- package/dist/components/Conversation.js +5 -4
- 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 +20 -17
- package/dist/components/Fieldset.d.ts +2 -7
- package/dist/components/Fieldset.js +7 -6
- package/dist/components/FileTree.d.ts +6 -0
- 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/IconButton.d.ts +2 -3
- package/dist/components/IconButton.js +2 -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/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- 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 +7 -7
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +2 -2
- package/dist/components/MessageScroller.js +6 -5
- package/dist/components/Meter.d.ts +5 -20
- package/dist/components/Meter.js +11 -10
- package/dist/components/ModelSelector.d.ts +6 -9
- 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/PricingPage.js +2 -1
- package/dist/components/PricingPlanCard.js +5 -4
- package/dist/components/PricingUsageCalculator.js +3 -3
- 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 +83 -218
- package/dist/components/Queue.d.ts +7 -17
- package/dist/components/Queue.js +2 -3
- 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 -6
- package/dist/components/ResizableSidePanel.js +2 -2
- package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
- package/dist/components/ResponsiveSidebarShell.js +18 -11
- package/dist/components/ScrollArea.d.ts +5 -20
- package/dist/components/ScrollArea.js +12 -10
- package/dist/components/SearchField.d.ts +43 -0
- package/dist/components/SearchField.js +52 -0
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +33 -57
- 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 +16 -9
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.d.ts +3 -5
- package/dist/components/SubagentRunList.js +3 -5
- package/dist/components/SubagentRunSelector.d.ts +9 -22
- package/dist/components/SubagentRunSelector.js +29 -31
- package/dist/components/Switch.d.ts +4 -7
- package/dist/components/Switch.js +6 -10
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +21 -18
- package/dist/components/Task.d.ts +4 -9
- package/dist/components/Task.js +4 -3
- package/dist/components/Terminal.d.ts +3 -4
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.d.ts +4 -9
- package/dist/components/TestResults.js +11 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +45 -22
- package/dist/components/ThinkChat.js +7 -5
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +24 -7
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatContext.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +27 -17
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
- package/dist/components/ThinkExecutionWorkbench.js +70 -134
- package/dist/components/ThinkFullApp.d.ts +40 -15
- package/dist/components/ThinkFullApp.js +193 -117
- 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 +46 -0
- package/dist/components/ThinkRoutine.js +1 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +37 -44
- package/dist/components/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/ThinkRoutineDetail.js +4 -4
- package/dist/components/ThinkRoutineForm.d.ts +3 -2
- package/dist/components/ThinkRoutineForm.js +11 -10
- package/dist/components/ThinkRoutineLibrary.d.ts +27 -25
- package/dist/components/ThinkRoutineLibrary.js +104 -80
- package/dist/components/ThinkRoutineRuns.d.ts +3 -2
- package/dist/components/ThinkRoutineRuns.js +31 -24
- package/dist/components/ThinkThreadPicker.d.ts +17 -11
- package/dist/components/ThinkThreadPicker.js +163 -39
- 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 +10 -8
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +21 -26
- 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 +11 -10
- package/dist/components/Tooltip.js +17 -11
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +6 -7
- package/dist/components/WebPreview.js +70 -55
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +361 -346
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +16 -26
- package/dist/components/WorkspaceExplorer.d.ts +5 -33
- package/dist/components/WorkspaceExplorer.js +19 -32
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +14 -2
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.d.ts +0 -8
- package/dist/components/WorkspaceHeader.js +3 -15
- package/dist/components/WorkspaceLink.d.ts +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-D7aAYA-2.d.ts} +2 -3
- package/dist/{copy-button-Dejn5heL.js → copy-button-DeK6KXEV.js} +3 -2
- package/dist/{icons-CpfUer49.js → icons-CQJ-aMnI.js} +7 -3
- package/dist/{icons-GQd1xF4e.d.ts → icons-CYXmvKlJ.d.ts} +22 -2
- package/dist/navigation-link-Cob7KBlM.js +19 -0
- package/dist/styles/accordion.css +4 -19
- package/dist/styles/activity.css +48 -56
- package/dist/styles/agent-activity-preview.css +6 -0
- package/dist/styles/agent-chat.css +14 -63
- package/dist/styles/agent-connection.css +0 -12
- package/dist/styles/agent-tool-detail.css +54 -0
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +177 -0
- package/dist/styles/artifact.css +6 -18
- package/dist/styles/autocomplete.css +2 -1
- package/dist/styles/avatar.css +35 -30
- package/dist/styles/badge.css +10 -10
- package/dist/styles/base-ui-motion.css +94 -39
- package/dist/styles/browser-control-overlay.css +0 -1
- package/dist/styles/browser-live-view.css +39 -22
- package/dist/styles/browser-replay.css +1 -1
- package/dist/styles/browser-run-panel.css +13 -6
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -24
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/checkpoint.css +58 -0
- package/dist/styles/codex-model-selector.css +3 -7
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +4 -3
- package/dist/styles/commit.css +19 -39
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -11
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/environment-variables.css +0 -13
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +66 -22
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +13 -4
- package/dist/styles/inline-citation.css +107 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -47
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -40
- package/dist/styles/menubar.css +12 -19
- package/dist/styles/message-scroller.css +0 -12
- package/dist/styles/message.css +25 -31
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -34
- package/dist/styles/motion-reduction.css +29 -0
- package/dist/styles/navigation-menu.css +14 -30
- package/dist/styles/number-field.css +22 -4
- package/dist/styles/plan.css +132 -0
- package/dist/styles/popover.css +15 -52
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +76 -269
- package/dist/styles/queue.css +48 -32
- package/dist/styles/radio.css +19 -12
- package/dist/styles/reasoning.css +2 -1
- package/dist/styles/recipes.css +207 -26
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +32 -34
- package/dist/styles/scroll-area.css +32 -15
- package/dist/styles/search-field.css +21 -0
- package/dist/styles/select.css +19 -12
- package/dist/styles/slider.css +25 -29
- package/dist/styles/sources.css +3 -11
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +13 -71
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +11 -23
- package/dist/styles/test-results.css +29 -36
- package/dist/styles/theme-mode-control.css +8 -0
- package/dist/styles/think-execution-workbench.css +18 -15
- package/dist/styles/think-full-app.css +51 -100
- package/dist/styles/think-routine-library.css +51 -40
- package/dist/styles/think-thread-picker.css +207 -50
- package/dist/styles/toast.css +48 -34
- package/dist/styles/toggle-group.css +2 -36
- package/dist/styles/toggle.css +29 -5
- package/dist/styles/toolbar.css +25 -27
- package/dist/styles/tooltip.css +2 -32
- package/dist/styles/transition-surface.css +55 -0
- package/dist/styles/utilities.css +31 -0
- package/dist/styles/web-preview.css +0 -21
- package/dist/styles/workspace-explorer.css +104 -99
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- package/dist/think-agent-Cip5KAPj.d.ts +7 -0
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/mcp-server-catalog.d.ts +132 -0
- package/dist/utils/mcp-server-catalog.js +90 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/workspace-path-L_KmjRjq.js +26 -0
- package/package.json +14 -9
- package/dist/Workspace-D39LxGvP.d.ts +0 -62
- 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
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { d as MessageContent, f as MessageResponse, i as MessageAttachment } from "../Message-BXtmfc9Q.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,57 @@
|
|
|
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
|
+
/** App-authored TanStack Router Link to the parent conversation. */
|
|
17
|
+
backLink?: React.ReactElement;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Live retained-child detail composed from upstream connection and chat values.
|
|
21
|
+
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
22
|
+
* compact parent-side stream projection and is never promoted to fake history.
|
|
23
|
+
*/
|
|
24
|
+
declare function AgentToolDetail<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
25
|
+
backLink,
|
|
26
|
+
chat,
|
|
27
|
+
className,
|
|
28
|
+
messages,
|
|
29
|
+
ref,
|
|
30
|
+
run,
|
|
31
|
+
...props
|
|
32
|
+
}: AgentToolDetailProps<State, MessageT> & {
|
|
33
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
interface SelectedAgentToolChildProps<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage> {
|
|
36
|
+
run: AgentToolRunState<MessageT["parts"][number]>;
|
|
37
|
+
/** Whole parent `useAgent` result used to derive the standard root-first route. */
|
|
38
|
+
parentAgent: ReturnType<typeof useAgent<ParentAgentT, ParentState>>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional whole upstream connection options. Supply the same auth/query/base
|
|
41
|
+
* configuration as the parent; the selected `run.subAgent` is appended.
|
|
42
|
+
*/
|
|
43
|
+
connectionOptions?: UseAgentOptions<ChildState>;
|
|
44
|
+
messages?: ThinkChatMessagesProps<MessageT>;
|
|
45
|
+
/** App-authored TanStack Router Link to the parent conversation. */
|
|
46
|
+
backLink?: React.ReactElement;
|
|
47
|
+
}
|
|
48
|
+
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
49
|
+
declare function SelectedAgentToolChild<ParentAgentT extends ThinkAgent<ParentState>, ParentState = unknown, ChildState = unknown, MessageT extends UIMessage = UIMessage>({
|
|
50
|
+
backLink,
|
|
51
|
+
connectionOptions,
|
|
52
|
+
messages,
|
|
53
|
+
parentAgent,
|
|
54
|
+
run
|
|
55
|
+
}: SelectedAgentToolChildProps<ParentAgentT, ParentState, ChildState, MessageT>): React.JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { AgentToolDetail, AgentToolDetailProps, SelectedAgentToolChild, SelectedAgentToolChildProps };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { r as ArrowLeftIcon } from "../icons-CQJ-aMnI.js";
|
|
3
|
+
import { TransitionSurface } from "./TransitionSurface.js";
|
|
4
|
+
import { AppTopBar } from "./AppTopBar.js";
|
|
5
|
+
import { NaniteMark } from "./NaniteScene.js";
|
|
6
|
+
import { SubagentRunIndicator, getSubagentRunName } from "./SubagentRunIndicator.js";
|
|
7
|
+
import { SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "./SubagentRunDetails.js";
|
|
8
|
+
import { t as ThinkChat } from "../ThinkChat-15EhfvYJ.js";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useAgentChat } from "@cloudflare/think/react";
|
|
12
|
+
import { useAgent } from "agents/react";
|
|
13
|
+
//#region src/components/AgentToolDetail.tsx
|
|
14
|
+
/**
|
|
15
|
+
* Live retained-child detail composed from upstream connection and chat values.
|
|
16
|
+
* The full child transcript comes from `chat.messages`; `run.parts` remains a
|
|
17
|
+
* compact parent-side stream projection and is never promoted to fake history.
|
|
18
|
+
*/
|
|
19
|
+
function AgentToolDetail({ backLink, chat, className, messages, ref, run, ...props }) {
|
|
20
|
+
const backRef = React.useRef(null);
|
|
21
|
+
const name = getSubagentRunName(run);
|
|
22
|
+
const progressLabel = run.progress?.message ?? run.progress?.phase;
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
backRef.current?.focus();
|
|
25
|
+
}, [run.runId]);
|
|
26
|
+
return /* @__PURE__ */ jsxs(TransitionSurface, {
|
|
27
|
+
ref,
|
|
28
|
+
variant: "slide-inline",
|
|
29
|
+
"data-slot": "agent-tool-detail",
|
|
30
|
+
className: cx("agent-tool-detail", className),
|
|
31
|
+
...props,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
34
|
+
"aria-label": `${name} controls`,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [backLink ? /* @__PURE__ */ jsx(AppTopBar.Link, {
|
|
37
|
+
ref: backRef,
|
|
38
|
+
label: "Back to parent conversation",
|
|
39
|
+
render: backLink,
|
|
40
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
41
|
+
}) : null, /* @__PURE__ */ jsx(NaniteMark, { index: run.order })] }),
|
|
42
|
+
/* @__PURE__ */ jsx(AppTopBar.Title, { children: /* @__PURE__ */ jsx("h2", {
|
|
43
|
+
className: "agent-tool-detail__title",
|
|
44
|
+
children: name
|
|
45
|
+
}) }),
|
|
46
|
+
/* @__PURE__ */ jsx(AppTopBar.Trailing, { children: /* @__PURE__ */ jsx(SubagentRunIndicator, { run }) })
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
progressLabel || run.milestones?.length || run.error || run.summary ? /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "agent-tool-detail__run-state",
|
|
51
|
+
children: [
|
|
52
|
+
progressLabel ? /* @__PURE__ */ jsx(SubagentRunProgress, {
|
|
53
|
+
label: progressLabel,
|
|
54
|
+
value: run.progress?.fraction
|
|
55
|
+
}) : null,
|
|
56
|
+
run.milestones?.length ? /* @__PURE__ */ jsx(SubagentRunMilestones, {
|
|
57
|
+
"aria-label": `${name} milestones`,
|
|
58
|
+
children: run.milestones.map((milestone) => /* @__PURE__ */ jsx(SubagentRunMilestone, { children: milestone.name }, milestone.sequence))
|
|
59
|
+
}) : null,
|
|
60
|
+
run.error ? /* @__PURE__ */ jsx("p", {
|
|
61
|
+
className: "agent-tool-detail__error",
|
|
62
|
+
children: run.error
|
|
63
|
+
}) : null,
|
|
64
|
+
!run.error && run.summary ? /* @__PURE__ */ jsx("p", {
|
|
65
|
+
className: "agent-tool-detail__summary",
|
|
66
|
+
children: run.summary
|
|
67
|
+
}) : null
|
|
68
|
+
]
|
|
69
|
+
}) : null,
|
|
70
|
+
/* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "agent-tool-detail__chat",
|
|
72
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Provider, {
|
|
73
|
+
chat,
|
|
74
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Messages, {
|
|
75
|
+
...messages,
|
|
76
|
+
showComposer: false
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Lazily connects one selected retained child and renders its real Think chat. */
|
|
84
|
+
function SelectedAgentToolChild({ backLink, connectionOptions, messages, parentAgent, run }) {
|
|
85
|
+
const [root, ...parentSubPath] = parentAgent.path;
|
|
86
|
+
return /* @__PURE__ */ jsx(AgentToolDetail, {
|
|
87
|
+
run,
|
|
88
|
+
chat: useAgentChat({ agent: useAgent({
|
|
89
|
+
...connectionOptions ?? {
|
|
90
|
+
agent: root?.agent ?? parentAgent.agent,
|
|
91
|
+
name: root?.name ?? parentAgent.name
|
|
92
|
+
},
|
|
93
|
+
sub: [...connectionOptions?.sub ?? parentSubPath, run.subAgent]
|
|
94
|
+
}) }),
|
|
95
|
+
messages,
|
|
96
|
+
backLink
|
|
97
|
+
}, run.runId);
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
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-BiMDVpUo.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",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Toolbar, ToolbarButtonProps, ToolbarGroupProps } from "./Toolbar.js";
|
|
1
|
+
import { Toolbar, ToolbarButtonProps, ToolbarGroupProps, ToolbarLinkProps } from "./Toolbar.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
4
|
|
|
4
5
|
//#region src/components/AppTopBar.d.ts
|
|
5
6
|
interface AppTopBarRootProps extends React.ComponentPropsWithoutRef<typeof Toolbar.Root> {
|
|
@@ -7,14 +8,24 @@ interface AppTopBarRootProps extends React.ComponentPropsWithoutRef<typeof Toolb
|
|
|
7
8
|
"aria-label": string;
|
|
8
9
|
}
|
|
9
10
|
interface AppTopBarGroupProps extends ToolbarGroupProps {}
|
|
10
|
-
interface AppTopBarTitleProps extends
|
|
11
|
+
interface AppTopBarTitleProps extends useRender.ComponentProps<"div"> {}
|
|
11
12
|
interface AppTopBarButtonProps extends Omit<ToolbarButtonProps, "aria-label"> {
|
|
13
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
12
14
|
/** Accessible name and default tooltip text for the icon-only control. */
|
|
13
15
|
label: string;
|
|
14
16
|
/** Tooltip text when it should differ from the accessible name. */
|
|
15
17
|
tooltip?: React.ReactNode;
|
|
16
18
|
}
|
|
17
|
-
interface
|
|
19
|
+
interface AppTopBarLinkProps extends Omit<ToolbarLinkProps, "aria-label"> {
|
|
20
|
+
ref?: React.Ref<HTMLAnchorElement>;
|
|
21
|
+
/** Accessible name and default tooltip text for the icon-only link. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Tooltip text when it should differ from the accessible name. */
|
|
24
|
+
tooltip?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
interface AppTopBarControlProps extends ToolbarButtonProps {
|
|
27
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* Stable application-level toolbar with composable leading, title, and trailing
|
|
20
31
|
* slots. Descendant buttons share Base UI's roving focus and tooltip provider.
|
|
@@ -30,11 +41,10 @@ declare function AppTopBarLeading({
|
|
|
30
41
|
}: AppTopBarGroupProps): React.JSX.Element;
|
|
31
42
|
declare function AppTopBarTitle({
|
|
32
43
|
className,
|
|
44
|
+
render,
|
|
33
45
|
ref,
|
|
34
46
|
...props
|
|
35
|
-
}: AppTopBarTitleProps
|
|
36
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
37
|
-
}): React.JSX.Element;
|
|
47
|
+
}: AppTopBarTitleProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
38
48
|
declare function AppTopBarTrailing({
|
|
39
49
|
className,
|
|
40
50
|
...props
|
|
@@ -52,12 +62,21 @@ declare function AppTopBarButton({
|
|
|
52
62
|
tooltip,
|
|
53
63
|
...props
|
|
54
64
|
}: AppTopBarButtonProps): React.JSX.Element;
|
|
65
|
+
declare function AppTopBarLink({
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
label,
|
|
69
|
+
render,
|
|
70
|
+
tooltip,
|
|
71
|
+
...props
|
|
72
|
+
}: AppTopBarLinkProps): React.JSX.Element;
|
|
55
73
|
/**
|
|
56
74
|
* Composable application top bar with stable leading, title, and trailing
|
|
57
75
|
* slots. Icon controls use shared Toolbar roving focus and coordinated Tooltip
|
|
58
76
|
* behavior; their fixed slots do not resize when state icons change. Render an
|
|
59
77
|
* existing behavior-rich button through `Control` to retain those toolbar
|
|
60
|
-
* semantics without rebuilding the control.
|
|
78
|
+
* semantics without rebuilding the control. Use `Link` for navigation so an
|
|
79
|
+
* `href` or router-provided link keeps native link semantics.
|
|
61
80
|
*/
|
|
62
81
|
declare const AppTopBar: {
|
|
63
82
|
Root: typeof AppTopBarRoot;
|
|
@@ -66,6 +85,7 @@ declare const AppTopBar: {
|
|
|
66
85
|
Trailing: typeof AppTopBarTrailing;
|
|
67
86
|
Control: typeof AppTopBarControl;
|
|
68
87
|
Button: typeof AppTopBarButton;
|
|
88
|
+
Link: typeof AppTopBarLink;
|
|
69
89
|
};
|
|
70
90
|
//#endregion
|
|
71
|
-
export { AppTopBar, AppTopBarButtonProps, AppTopBarControlProps, AppTopBarGroupProps, AppTopBarRootProps, AppTopBarTitleProps };
|
|
91
|
+
export { AppTopBar, AppTopBarButtonProps, AppTopBarControlProps, AppTopBarGroupProps, AppTopBarLinkProps, AppTopBarRootProps, AppTopBarTitleProps };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
1
|
+
import { n as mergeBaseClassName, t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
3
|
import { Tooltip } from "./Tooltip.js";
|
|
4
4
|
import { Toolbar } from "./Toolbar.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
7
8
|
//#region src/components/AppTopBar.tsx
|
|
8
9
|
/**
|
|
9
10
|
* Stable application-level toolbar with composable leading, title, and trailing
|
|
@@ -11,33 +12,38 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
12
|
*/
|
|
12
13
|
function AppTopBarRoot({ children, className, ...props }) {
|
|
13
14
|
return /* @__PURE__ */ jsx(Tooltip.Provider, { children: /* @__PURE__ */ jsx(Toolbar.Root, {
|
|
14
|
-
className:
|
|
15
|
+
className: mergeBaseClassName("app-top-bar", className),
|
|
15
16
|
...props,
|
|
16
17
|
children
|
|
17
18
|
}) });
|
|
18
19
|
}
|
|
19
20
|
function AppTopBarLeading({ className, ...props }) {
|
|
20
21
|
return /* @__PURE__ */ jsx(Toolbar.Group, {
|
|
21
|
-
className:
|
|
22
|
+
className: mergeBaseClassName("app-top-bar__leading", className),
|
|
22
23
|
...props
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
function AppTopBarTitle({ className, ref, ...props }) {
|
|
26
|
-
return
|
|
26
|
+
function AppTopBarTitle({ className, render, ref, ...props }) {
|
|
27
|
+
return useRender({
|
|
28
|
+
defaultTagName: "div",
|
|
29
|
+
render,
|
|
27
30
|
ref,
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
props: {
|
|
32
|
+
...props,
|
|
33
|
+
"data-slot": "app-top-bar-title",
|
|
34
|
+
className: cx("app-top-bar__title", className)
|
|
35
|
+
}
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
function AppTopBarTrailing({ className, ...props }) {
|
|
33
39
|
return /* @__PURE__ */ jsx(Toolbar.Group, {
|
|
34
|
-
className:
|
|
40
|
+
className: mergeBaseClassName("app-top-bar__trailing", className),
|
|
35
41
|
...props
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
44
|
function AppTopBarControl({ className, ...props }) {
|
|
39
45
|
return /* @__PURE__ */ jsx(Toolbar.Button, {
|
|
40
|
-
className:
|
|
46
|
+
className: mergeBaseClassName("app-top-bar__button", className),
|
|
41
47
|
...props
|
|
42
48
|
});
|
|
43
49
|
}
|
|
@@ -50,7 +56,8 @@ function AppTopBarButton({ children, className, disabled, label, render, tooltip
|
|
|
50
56
|
type: "button",
|
|
51
57
|
variant: "ghost",
|
|
52
58
|
color: "neutral",
|
|
53
|
-
size: "
|
|
59
|
+
size: "sm",
|
|
60
|
+
iconOnly: true,
|
|
54
61
|
disabled
|
|
55
62
|
}),
|
|
56
63
|
disabled,
|
|
@@ -63,12 +70,28 @@ function AppTopBarButton({ children, className, disabled, label, render, tooltip
|
|
|
63
70
|
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: tooltip })
|
|
64
71
|
}) })] });
|
|
65
72
|
}
|
|
73
|
+
function AppTopBarLink({ children, className, label, render, tooltip = label, ...props }) {
|
|
74
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
75
|
+
render: /* @__PURE__ */ jsx(Toolbar.Link, {
|
|
76
|
+
className: mergeBaseClassName("app-top-bar__button", className),
|
|
77
|
+
"aria-label": label,
|
|
78
|
+
render,
|
|
79
|
+
...props
|
|
80
|
+
}),
|
|
81
|
+
children
|
|
82
|
+
}), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
83
|
+
side: "bottom",
|
|
84
|
+
sideOffset: 6,
|
|
85
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: tooltip })
|
|
86
|
+
}) })] });
|
|
87
|
+
}
|
|
66
88
|
/**
|
|
67
89
|
* Composable application top bar with stable leading, title, and trailing
|
|
68
90
|
* slots. Icon controls use shared Toolbar roving focus and coordinated Tooltip
|
|
69
91
|
* behavior; their fixed slots do not resize when state icons change. Render an
|
|
70
92
|
* existing behavior-rich button through `Control` to retain those toolbar
|
|
71
|
-
* semantics without rebuilding the control.
|
|
93
|
+
* semantics without rebuilding the control. Use `Link` for navigation so an
|
|
94
|
+
* `href` or router-provided link keeps native link semantics.
|
|
72
95
|
*/
|
|
73
96
|
const AppTopBar = {
|
|
74
97
|
Root: AppTopBarRoot,
|
|
@@ -76,7 +99,8 @@ const AppTopBar = {
|
|
|
76
99
|
Title: AppTopBarTitle,
|
|
77
100
|
Trailing: AppTopBarTrailing,
|
|
78
101
|
Control: AppTopBarControl,
|
|
79
|
-
Button: AppTopBarButton
|
|
102
|
+
Button: AppTopBarButton,
|
|
103
|
+
Link: AppTopBarLink
|
|
80
104
|
};
|
|
81
105
|
//#endregion
|
|
82
106
|
export { AppTopBar };
|