@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-CyD2UB3V.js";
|
|
2
|
+
import { $ as PromptInputDictationProps, A as PromptInputCommandDefinition, X as PromptInputContextSelectorProps, gt as PromptInputReference, n as PermissionMode, ut as PromptInputMessage } from "./PromptInput-Bdh9pqlo.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { ChatAddToolApproveResponseFunction, ChatStatus, UIMessage } from "ai";
|
|
4
5
|
import { PendingApproval, Think } from "@cloudflare/think";
|
|
@@ -6,13 +7,6 @@ import { AgentStub } from "agents/client";
|
|
|
6
7
|
import { UseVoiceInputReturn } from "@cloudflare/voice/react";
|
|
7
8
|
|
|
8
9
|
//#region src/components/AgentChat.d.ts
|
|
9
|
-
type AgentChatPart<MessageT extends UIMessage = UIMessage> = MessageT["parts"][number];
|
|
10
|
-
interface AgentChatRenderPartContext<MessageT extends UIMessage = UIMessage> {
|
|
11
|
-
message: MessageT;
|
|
12
|
-
part: AgentChatPart<MessageT>;
|
|
13
|
-
partIndex: number;
|
|
14
|
-
defaultRender: () => React.ReactNode;
|
|
15
|
-
}
|
|
16
10
|
interface AgentChatRenderMessageContext<MessageT extends UIMessage = UIMessage> {
|
|
17
11
|
message: MessageT;
|
|
18
12
|
messageIndex: number;
|
|
@@ -81,21 +75,6 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
81
75
|
showComposer?: boolean;
|
|
82
76
|
/** Called when the user hits stop while `status` is streaming/submitted. */
|
|
83
77
|
onStop?: () => void;
|
|
84
|
-
/**
|
|
85
|
-
* Let a composed follow-up submit while a response is active. The single
|
|
86
|
-
* trailing action remains Stop until the draft contains content, then
|
|
87
|
-
* becomes Queue. The transport remains the queue owner.
|
|
88
|
-
*/
|
|
89
|
-
allowSubmitWhileBusy?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Authoritative user messages waiting behind the active turn. Their ids are
|
|
92
|
-
* excluded from the transcript and rendered as queued cards above the composer.
|
|
93
|
-
*/
|
|
94
|
-
queuedMessages?: readonly MessageT[];
|
|
95
|
-
/** Promote a queued message into the host's steering flow. */
|
|
96
|
-
onSteerQueuedMessage?: (message: MessageT) => void;
|
|
97
|
-
/** Remove a queued message through the host-owned queue transport. */
|
|
98
|
-
onRemoveQueuedMessage?: (message: MessageT) => void;
|
|
99
78
|
placeholder?: string;
|
|
100
79
|
disabled?: boolean;
|
|
101
80
|
/** Rendered in place of the transcript while `messages` is empty. */
|
|
@@ -192,7 +171,7 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
|
192
171
|
* return a React node for every source part you want to show; returning
|
|
193
172
|
* `undefined` lets `AgentChat` keep the upstream-shaped source-run grouping.
|
|
194
173
|
*/
|
|
195
|
-
renderPart?: (context:
|
|
174
|
+
renderPart?: (context: AgentMessageRenderPartContext<MessageT>) => React.ReactNode | undefined;
|
|
196
175
|
/** Rendered after each message's parts — for actions, citations, and the like. */
|
|
197
176
|
renderMessageAfter?: (context: AgentChatRenderMessageContext<MessageT>) => React.ReactNode;
|
|
198
177
|
}
|
|
@@ -216,14 +195,10 @@ interface PermissionModeControl {
|
|
|
216
195
|
declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
217
196
|
className,
|
|
218
197
|
messages,
|
|
219
|
-
queuedMessages,
|
|
220
|
-
onSteerQueuedMessage,
|
|
221
|
-
onRemoveQueuedMessage,
|
|
222
198
|
status,
|
|
223
199
|
onSubmit,
|
|
224
200
|
showComposer,
|
|
225
201
|
onStop,
|
|
226
|
-
allowSubmitWhileBusy,
|
|
227
202
|
placeholder,
|
|
228
203
|
disabled,
|
|
229
204
|
emptyState,
|
|
@@ -252,4 +227,4 @@ declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
|
252
227
|
ref?: React.Ref<HTMLDivElement>;
|
|
253
228
|
}): React.JSX.Element;
|
|
254
229
|
//#endregion
|
|
255
|
-
export {
|
|
230
|
+
export { PermissionModeControl as a, AgentChatRenderMessageContext as i, AgentChatComposerDraft as n, AgentChatProps as r, AgentChat as t };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChatStatus, UIMessage } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/components/AgentMessageParts.d.ts
|
|
5
|
+
type AgentMessagePart<MessageT extends UIMessage = UIMessage> = MessageT["parts"][number];
|
|
6
|
+
interface AgentMessageRenderPartContext<MessageT extends UIMessage = UIMessage> {
|
|
7
|
+
message: MessageT;
|
|
8
|
+
part: AgentMessagePart<MessageT>;
|
|
9
|
+
partIndex: number;
|
|
10
|
+
defaultRender: () => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface AgentMessagePartsProps<MessageT extends UIMessage = UIMessage> {
|
|
13
|
+
/** The whole upstream AI SDK message whose parts should render in order. */
|
|
14
|
+
message: MessageT;
|
|
15
|
+
/** Drives native reasoning streaming UI. Settled messages default to `ready`. */
|
|
16
|
+
status?: ChatStatus;
|
|
17
|
+
/**
|
|
18
|
+
* Override rendering per part. Return `undefined` to use the default renderer,
|
|
19
|
+
* `null` to suppress the part, or call `defaultRender()` to compose the
|
|
20
|
+
* built-in result into custom UI.
|
|
21
|
+
*
|
|
22
|
+
* The default renderer uses upstream helpers where available:
|
|
23
|
+
* `isTextUIPart`, `isReasoningUIPart`, `isFileUIPart`, `isToolUIPart`,
|
|
24
|
+
* `getToolName`, and Think's `getToolPartState`/input/output accessors. It
|
|
25
|
+
* also renders native AI SDK `source-url`/`source-document` parts as a single
|
|
26
|
+
* grouped `Sources` block when they appear consecutively, consolidates native
|
|
27
|
+
* reasoning parts into one disclosure, and treats `step-start` as a silent
|
|
28
|
+
* structural boundary. App-defined `data-*` parts stay whole and should be
|
|
29
|
+
* narrowed with AI SDK's `isDataUIPart` inside this callback. If you override
|
|
30
|
+
* source rendering, return a React node for every source part you want to
|
|
31
|
+
* show; returning `undefined` keeps the upstream-shaped source-run grouping.
|
|
32
|
+
*/
|
|
33
|
+
renderPart?: (context: AgentMessageRenderPartContext<MessageT>) => React.ReactNode | undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Renders the ordered parts of one whole AI SDK `UIMessage` without adding a
|
|
37
|
+
* transcript, message wrapper, composer, or transport. Compose it inside
|
|
38
|
+
* `Message` for read-only run previews and child-agent transcript rows.
|
|
39
|
+
*/
|
|
40
|
+
declare function AgentMessageParts<MessageT extends UIMessage = UIMessage>({
|
|
41
|
+
message,
|
|
42
|
+
status,
|
|
43
|
+
renderPart
|
|
44
|
+
}: AgentMessagePartsProps<MessageT>): (React.JSX.Element | null)[];
|
|
45
|
+
//#endregion
|
|
46
|
+
export { AgentMessageRenderPartContext as i, AgentMessageParts as n, AgentMessagePartsProps as r, AgentMessagePart as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { UIMessage } from "ai";
|
|
3
|
+
import { useAgentToolEvents } from "agents/react";
|
|
4
|
+
import { AgentToolRunPart } from "agents/agent-tools";
|
|
5
|
+
|
|
6
|
+
//#region src/components/AgentToolRunsContext.d.ts
|
|
7
|
+
/** The complete upstream retained-run hook result for one parent connection. */
|
|
8
|
+
type AgentToolEventsValue<Part extends AgentToolRunPart = UIMessage["parts"][number]> = ReturnType<typeof useAgentToolEvents<Part>>;
|
|
9
|
+
interface AgentToolRunsProviderProps<Part extends AgentToolRunPart = UIMessage["parts"][number]> {
|
|
10
|
+
/** Pass the whole `useAgentToolEvents({ agent })` result directly. */
|
|
11
|
+
agentTools: AgentToolEventsValue<Part>;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** Provides one parent connection's retained Agent Tool event projection. */
|
|
15
|
+
declare function AgentToolRunsProvider<Part extends AgentToolRunPart = UIMessage["parts"][number]>({
|
|
16
|
+
agentTools,
|
|
17
|
+
children
|
|
18
|
+
}: AgentToolRunsProviderProps<Part>): React.JSX.Element;
|
|
19
|
+
declare function useOptionalAgentToolRuns<Part extends AgentToolRunPart = UIMessage["parts"][number]>(): AgentToolEventsValue<Part> | null;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { useOptionalAgentToolRuns as i, AgentToolRunsProvider as n, AgentToolRunsProviderProps as r, AgentToolEventsValue as t };
|
|
@@ -24,12 +24,11 @@ type ButtonColor = "neutral" | "primary" | "destructive";
|
|
|
24
24
|
*
|
|
25
25
|
* - `xs` - Extra small, 1.75rem height
|
|
26
26
|
* - `sm` - Small, 2rem height
|
|
27
|
-
* - `md` - Medium
|
|
28
|
-
* - `lg` - Large, 2.
|
|
29
|
-
* - `xl` - Extra large,
|
|
30
|
-
* - `icon` - Square button for icon-only content
|
|
27
|
+
* - `md` - Medium, 2.25rem height
|
|
28
|
+
* - `lg` - Large, 2.5rem height
|
|
29
|
+
* - `xl` - Extra large, 2.75rem height
|
|
31
30
|
*/
|
|
32
|
-
type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl"
|
|
31
|
+
type ButtonSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
33
32
|
interface ButtonVariantsOptions {
|
|
34
33
|
variant?: ButtonVariant | null;
|
|
35
34
|
color?: ButtonColor | null;
|
|
@@ -59,9 +58,15 @@ interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLBut
|
|
|
59
58
|
color?: ButtonColor;
|
|
60
59
|
/**
|
|
61
60
|
* The size of the button.
|
|
62
|
-
* @default '
|
|
61
|
+
* @default 'sm'
|
|
63
62
|
*/
|
|
64
63
|
size?: ButtonSize;
|
|
64
|
+
/**
|
|
65
|
+
* Makes the button square for icon-only content. Prefer {@link IconButton}
|
|
66
|
+
* when the control also needs a required accessible label and tooltip.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
iconOnly?: boolean;
|
|
65
70
|
}
|
|
66
71
|
/**
|
|
67
72
|
* A button component built on Base UI with semantic styling variants.
|
|
@@ -76,7 +81,7 @@ interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLBut
|
|
|
76
81
|
* <Button color="primary">Save changes</Button>
|
|
77
82
|
* <Button color="destructive">Delete account</Button>
|
|
78
83
|
* <Button variant="outline">Cancel</Button>
|
|
79
|
-
* <Button variant="ghost" size="
|
|
84
|
+
* <Button variant="ghost" size="sm" iconOnly aria-label="Search"><SearchIcon /></Button>
|
|
80
85
|
* ```
|
|
81
86
|
*
|
|
82
87
|
* @see {@link https://base-ui.com/react/components/button | Base UI Button}
|
|
@@ -85,6 +90,7 @@ declare function Button$1({
|
|
|
85
90
|
variant,
|
|
86
91
|
color,
|
|
87
92
|
size,
|
|
93
|
+
iconOnly,
|
|
88
94
|
className,
|
|
89
95
|
nativeButton,
|
|
90
96
|
ref,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as cx } from "./class-names-
|
|
1
|
+
import { t as cx } from "./class-names-BiMDVpUo.js";
|
|
2
2
|
import { Select } from "./components/Select.js";
|
|
3
|
-
import { t as CopyButton } from "./copy-button-
|
|
3
|
+
import { t as CopyButton } from "./copy-button-DeK6KXEV.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createHighlighter } from "shiki";
|
|
@@ -170,11 +170,14 @@ function hasCustomCodeBlockContent(children) {
|
|
|
170
170
|
*
|
|
171
171
|
* @see {@link https://elements.ai-sdk.dev/components/code-block | AI Elements Code Block}
|
|
172
172
|
*/
|
|
173
|
-
function CodeBlock({
|
|
173
|
+
function CodeBlock({ language, ...props }) {
|
|
174
|
+
return /* @__PURE__ */ jsx(CodeBlockState, {
|
|
175
|
+
language,
|
|
176
|
+
...props
|
|
177
|
+
}, language);
|
|
178
|
+
}
|
|
179
|
+
function CodeBlockState({ className, code, language, showLineNumbers = false, isStreaming = false, onLanguageChange, children, ref, ...props }) {
|
|
174
180
|
const [internalLanguage, setInternalLanguage] = React.useState(language);
|
|
175
|
-
React.useEffect(() => {
|
|
176
|
-
setInternalLanguage(language);
|
|
177
|
-
}, [language]);
|
|
178
181
|
const setLanguage = React.useCallback((next) => {
|
|
179
182
|
setInternalLanguage(next);
|
|
180
183
|
onLanguageChange?.(next);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as SelectProps, t as Select } from "./Select-
|
|
2
|
-
import { t as CopyButtonProps } from "./copy-button-
|
|
1
|
+
import { m as SelectProps, t as Select } from "./Select-B_13gg_J.js";
|
|
2
|
+
import { t as CopyButtonProps } from "./copy-button-D7aAYA-2.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { BundledLanguage, ThemedToken } from "shiki";
|
|
5
5
|
|
|
@@ -63,14 +63,7 @@ interface CodeBlockProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
63
63
|
* @see {@link https://elements.ai-sdk.dev/components/code-block | AI Elements Code Block}
|
|
64
64
|
*/
|
|
65
65
|
declare function CodeBlock({
|
|
66
|
-
className,
|
|
67
|
-
code,
|
|
68
66
|
language,
|
|
69
|
-
showLineNumbers,
|
|
70
|
-
isStreaming,
|
|
71
|
-
onLanguageChange,
|
|
72
|
-
children,
|
|
73
|
-
ref,
|
|
74
67
|
...props
|
|
75
68
|
}: CodeBlockProps & {
|
|
76
69
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Collapsible.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Collapsible.Root component.
|
|
7
|
+
*/
|
|
8
|
+
interface CollapsibleRootProps extends React.ComponentPropsWithoutRef<typeof Collapsible.Root> {
|
|
9
|
+
/** Skip the default design-system Collapsible classes for internal composition. */
|
|
10
|
+
unstyled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for the Collapsible.Trigger component.
|
|
14
|
+
*/
|
|
15
|
+
interface CollapsibleTriggerProps extends React.ComponentPropsWithoutRef<typeof Collapsible.Trigger> {
|
|
16
|
+
/** Skip the default design-system Collapsible classes for internal composition. */
|
|
17
|
+
unstyled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props for the Collapsible.Panel component.
|
|
21
|
+
*/
|
|
22
|
+
interface CollapsiblePanelProps extends React.ComponentPropsWithoutRef<typeof Collapsible.Panel> {
|
|
23
|
+
/** Skip the default design-system Collapsible classes for internal composition. */
|
|
24
|
+
unstyled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Container that groups all collapsible parts. Renders a `<div>` element.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Collapsible.Root>
|
|
32
|
+
* <Collapsible.Trigger>Show more</Collapsible.Trigger>
|
|
33
|
+
* <Collapsible.Panel>Hidden content here</Collapsible.Panel>
|
|
34
|
+
* </Collapsible.Root>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @see {@link https://base-ui.com/react/components/collapsible | Base UI Collapsible}
|
|
38
|
+
*/
|
|
39
|
+
declare function CollapsibleRoot({
|
|
40
|
+
className,
|
|
41
|
+
unstyled,
|
|
42
|
+
ref,
|
|
43
|
+
...props
|
|
44
|
+
}: CollapsibleRootProps & {
|
|
45
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
46
|
+
}): React.JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* Button that toggles the panel visibility. Renders a `<button>` element.
|
|
49
|
+
*/
|
|
50
|
+
declare function CollapsibleTrigger({
|
|
51
|
+
className,
|
|
52
|
+
unstyled,
|
|
53
|
+
ref,
|
|
54
|
+
...props
|
|
55
|
+
}: CollapsibleTriggerProps & {
|
|
56
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
57
|
+
}): React.JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* The collapsible panel containing hidden content. Renders a `<div>` element.
|
|
60
|
+
* Supports CSS animations via `--collapsible-panel-height` variable.
|
|
61
|
+
*/
|
|
62
|
+
declare function CollapsiblePanel({
|
|
63
|
+
className,
|
|
64
|
+
unstyled,
|
|
65
|
+
ref,
|
|
66
|
+
...props
|
|
67
|
+
}: CollapsiblePanelProps & {
|
|
68
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
+
}): React.JSX.Element;
|
|
70
|
+
/**
|
|
71
|
+
* A collapsible panel controlled by a button.
|
|
72
|
+
* Useful for progressive disclosure of content.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* // Basic usage
|
|
77
|
+
* <Collapsible.Root>
|
|
78
|
+
* <Collapsible.Trigger>Toggle content</Collapsible.Trigger>
|
|
79
|
+
* <Collapsible.Panel>
|
|
80
|
+
* <p>This content can be shown or hidden.</p>
|
|
81
|
+
* </Collapsible.Panel>
|
|
82
|
+
* </Collapsible.Root>
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* // Controlled state
|
|
88
|
+
* const [open, setOpen] = useState(false);
|
|
89
|
+
*
|
|
90
|
+
* <Collapsible.Root open={open} onOpenChange={setOpen}>
|
|
91
|
+
* <Collapsible.Trigger>
|
|
92
|
+
* {open ? 'Hide' : 'Show'} details
|
|
93
|
+
* </Collapsible.Trigger>
|
|
94
|
+
* <Collapsible.Panel>
|
|
95
|
+
* <p>Detailed information here.</p>
|
|
96
|
+
* </Collapsible.Panel>
|
|
97
|
+
* </Collapsible.Root>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* // Default open
|
|
103
|
+
* <Collapsible.Root defaultOpen>
|
|
104
|
+
* <Collapsible.Trigger>Collapse</Collapsible.Trigger>
|
|
105
|
+
* <Collapsible.Panel>
|
|
106
|
+
* <p>Initially visible content.</p>
|
|
107
|
+
* </Collapsible.Panel>
|
|
108
|
+
* </Collapsible.Root>
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @see {@link https://base-ui.com/react/components/collapsible | Base UI Collapsible}
|
|
112
|
+
*/
|
|
113
|
+
declare const Collapsible$1: {
|
|
114
|
+
Root: typeof CollapsibleRoot;
|
|
115
|
+
Trigger: typeof CollapsibleTrigger;
|
|
116
|
+
Panel: typeof CollapsiblePanel;
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { CollapsibleTriggerProps as i, CollapsiblePanelProps as n, CollapsibleRootProps as r, Collapsible$1 as t };
|
|
@@ -6,36 +6,28 @@ declare function ComboboxInput({
|
|
|
6
6
|
className,
|
|
7
7
|
ref,
|
|
8
8
|
...props
|
|
9
|
-
}:
|
|
10
|
-
className?: string;
|
|
11
|
-
} & {
|
|
9
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Input> & {
|
|
12
10
|
ref?: React.Ref<HTMLInputElement>;
|
|
13
11
|
}): React.JSX.Element;
|
|
14
12
|
declare function ComboboxTrigger({
|
|
15
13
|
className,
|
|
16
14
|
ref,
|
|
17
15
|
...props
|
|
18
|
-
}:
|
|
19
|
-
className?: string;
|
|
20
|
-
} & {
|
|
16
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Trigger> & {
|
|
21
17
|
ref?: React.Ref<HTMLButtonElement>;
|
|
22
18
|
}): React.JSX.Element;
|
|
23
19
|
declare function Clear({
|
|
24
20
|
className,
|
|
25
21
|
ref,
|
|
26
22
|
...props
|
|
27
|
-
}:
|
|
28
|
-
className?: string;
|
|
29
|
-
} & {
|
|
23
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Clear> & {
|
|
30
24
|
ref?: React.Ref<HTMLButtonElement>;
|
|
31
25
|
}): React.JSX.Element;
|
|
32
26
|
declare function ComboboxPositioner({
|
|
33
27
|
className,
|
|
34
28
|
ref,
|
|
35
29
|
...props
|
|
36
|
-
}:
|
|
37
|
-
className?: string;
|
|
38
|
-
} & {
|
|
30
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Positioner> & {
|
|
39
31
|
ref?: React.Ref<HTMLDivElement>;
|
|
40
32
|
}): React.JSX.Element;
|
|
41
33
|
declare function ComboboxPopup({
|
|
@@ -43,63 +35,49 @@ declare function ComboboxPopup({
|
|
|
43
35
|
tabIndex,
|
|
44
36
|
ref,
|
|
45
37
|
...props
|
|
46
|
-
}:
|
|
47
|
-
className?: string;
|
|
48
|
-
} & {
|
|
38
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Popup> & {
|
|
49
39
|
ref?: React.Ref<HTMLDivElement>;
|
|
50
40
|
}): React.JSX.Element;
|
|
51
41
|
declare function ComboboxList({
|
|
52
42
|
className,
|
|
53
43
|
ref,
|
|
54
44
|
...props
|
|
55
|
-
}:
|
|
56
|
-
className?: string;
|
|
57
|
-
} & {
|
|
45
|
+
}: React.ComponentPropsWithRef<typeof Combobox.List> & {
|
|
58
46
|
ref?: React.Ref<HTMLDivElement>;
|
|
59
47
|
}): React.JSX.Element;
|
|
60
48
|
declare function ComboboxItem({
|
|
61
49
|
className,
|
|
62
50
|
ref,
|
|
63
51
|
...props
|
|
64
|
-
}:
|
|
65
|
-
className?: string;
|
|
66
|
-
} & {
|
|
52
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Item> & {
|
|
67
53
|
ref?: React.Ref<HTMLDivElement>;
|
|
68
54
|
}): React.JSX.Element;
|
|
69
55
|
declare function ItemIndicator({
|
|
70
56
|
className,
|
|
71
57
|
ref,
|
|
72
58
|
...props
|
|
73
|
-
}:
|
|
74
|
-
className?: string;
|
|
75
|
-
} & {
|
|
59
|
+
}: React.ComponentPropsWithRef<typeof Combobox.ItemIndicator> & {
|
|
76
60
|
ref?: React.Ref<HTMLSpanElement>;
|
|
77
61
|
}): React.JSX.Element;
|
|
78
62
|
declare function ComboboxEmpty({
|
|
79
63
|
className,
|
|
80
64
|
ref,
|
|
81
65
|
...props
|
|
82
|
-
}:
|
|
83
|
-
className?: string;
|
|
84
|
-
} & {
|
|
66
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Empty> & {
|
|
85
67
|
ref?: React.Ref<HTMLDivElement>;
|
|
86
68
|
}): React.JSX.Element;
|
|
87
69
|
declare function ComboboxGroup({
|
|
88
70
|
className,
|
|
89
71
|
ref,
|
|
90
72
|
...props
|
|
91
|
-
}:
|
|
92
|
-
className?: string;
|
|
93
|
-
} & {
|
|
73
|
+
}: React.ComponentPropsWithRef<typeof Combobox.Group> & {
|
|
94
74
|
ref?: React.Ref<HTMLDivElement>;
|
|
95
75
|
}): React.JSX.Element;
|
|
96
76
|
declare function ComboboxGroupLabel({
|
|
97
77
|
className,
|
|
98
78
|
ref,
|
|
99
79
|
...props
|
|
100
|
-
}:
|
|
101
|
-
className?: string;
|
|
102
|
-
} & {
|
|
80
|
+
}: React.ComponentPropsWithRef<typeof Combobox.GroupLabel> & {
|
|
103
81
|
ref?: React.Ref<HTMLDivElement>;
|
|
104
82
|
}): React.JSX.Element;
|
|
105
83
|
/**
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { t as cx } from "./class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "./class-names-BiMDVpUo.js";
|
|
2
|
+
import { C as FolderOpenIcon, S as FolderIcon, f as ChevronRightIcon, x as FileIcon } from "./icons-CQJ-aMnI.js";
|
|
3
|
+
import { t as NavigationLink } from "./navigation-link-Cob7KBlM.js";
|
|
3
4
|
import * as React from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/_internal/use-file-tree-nav.ts
|
|
6
7
|
const FileTreeContext = React.createContext(null);
|
|
8
|
+
function getVisibleFileTreeNodes(tree) {
|
|
9
|
+
return tree ? [...tree.querySelectorAll(".file-tree__node")].filter((node) => !node.closest(".file-tree__group[data-collapsed]")) : [];
|
|
10
|
+
}
|
|
7
11
|
function useFileTreeContext() {
|
|
8
12
|
const ctx = React.useContext(FileTreeContext);
|
|
9
13
|
if (!ctx) throw new Error("FileTree subcomponents must be used inside <FileTree>.");
|
|
@@ -25,8 +29,7 @@ function useFileTreeNav({ expanded, initialFocusedPath, selectedPath, onSelect,
|
|
|
25
29
|
setFolderExpanded(path, !expanded.has(path));
|
|
26
30
|
}, [expanded, setFolderExpanded]);
|
|
27
31
|
const handleKeyDown = React.useCallback((event, path, kind) => {
|
|
28
|
-
const
|
|
29
|
-
const nodes = tree ? [...tree.querySelectorAll(".file-tree__node")] : [];
|
|
32
|
+
const nodes = getVisibleFileTreeNodes(event.currentTarget.closest("[role=\"tree\"]"));
|
|
30
33
|
const currentIndex = nodes.indexOf(event.currentTarget);
|
|
31
34
|
const focusAt = (index) => nodes[index]?.focus();
|
|
32
35
|
switch (event.key) {
|
|
@@ -51,6 +54,7 @@ function useFileTreeNav({ expanded, initialFocusedPath, selectedPath, onSelect,
|
|
|
51
54
|
break;
|
|
52
55
|
case "Enter":
|
|
53
56
|
case " ":
|
|
57
|
+
if (kind === "file-link") return;
|
|
54
58
|
event.preventDefault();
|
|
55
59
|
onSelect(path);
|
|
56
60
|
if (kind === "folder") toggleFolderExpanded(path);
|
|
@@ -117,7 +121,7 @@ function getFirstFileTreePath(children) {
|
|
|
117
121
|
* </FileTree>
|
|
118
122
|
* ```
|
|
119
123
|
*/
|
|
120
|
-
function FileTree({ className, "aria-label": ariaLabel = "File tree", expanded, defaultExpanded, selectedPath = null, onSelect, onExpandedChange, children, ref, ...props }) {
|
|
124
|
+
function FileTree({ appearance = "contained", className, "aria-label": ariaLabel = "File tree", expanded, defaultExpanded, selectedPath = null, onSelect, onExpandedChange, children, ref, ...props }) {
|
|
121
125
|
const [internalExpanded, setInternalExpanded] = React.useState(() => defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
122
126
|
const isControlled = expanded !== void 0;
|
|
123
127
|
const currentExpanded = isControlled ? expanded : internalExpanded;
|
|
@@ -137,7 +141,7 @@ function FileTree({ className, "aria-label": ariaLabel = "File tree", expanded,
|
|
|
137
141
|
});
|
|
138
142
|
const treeRef = React.useRef(null);
|
|
139
143
|
React.useLayoutEffect(() => {
|
|
140
|
-
const nodes = [...treeRef.current?.querySelectorAll(".file-tree__node") ?? []];
|
|
144
|
+
const nodes = [...treeRef.current?.querySelectorAll(".file-tree__node") ?? []].filter((node) => !node.closest(".file-tree__group[data-collapsed]"));
|
|
141
145
|
if (nodes.length === 0) return;
|
|
142
146
|
if (nodes.some((node) => node.dataset.workspacePath === ctx.focusedPath)) return;
|
|
143
147
|
const firstPath = nodes[0]?.dataset.workspacePath;
|
|
@@ -152,10 +156,11 @@ function FileTree({ className, "aria-label": ariaLabel = "File tree", expanded,
|
|
|
152
156
|
children: /* @__PURE__ */ jsx("div", {
|
|
153
157
|
ref,
|
|
154
158
|
className: cx("file-tree", className),
|
|
159
|
+
"data-appearance": appearance,
|
|
155
160
|
...props,
|
|
156
161
|
children: /* @__PURE__ */ jsx("ul", {
|
|
157
162
|
ref: treeRef,
|
|
158
|
-
className: "file-tree__list",
|
|
163
|
+
className: "file-tree__list sigvelo-stack-list",
|
|
159
164
|
role: "tree",
|
|
160
165
|
"aria-label": ariaLabel,
|
|
161
166
|
children
|
|
@@ -173,8 +178,8 @@ function dataFlag(enabled) {
|
|
|
173
178
|
function getFileTreeNodeTabIndex(focusedPath, path) {
|
|
174
179
|
return focusedPath === path ? 0 : -1;
|
|
175
180
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
181
|
+
function getFileTreeNodeStyle(level) {
|
|
182
|
+
return { "--file-tree-level": level };
|
|
178
183
|
}
|
|
179
184
|
function FileTreeFolder({ className, path, name, level = 0, children, ref, ...props }) {
|
|
180
185
|
const { expanded, focusedPath, selectedPath, onFocus, onSelect, handleKeyDown, onExpandedChange } = useFileTreeContext();
|
|
@@ -213,7 +218,7 @@ function FileTreeFolder({ className, path, name, level = 0, children, ref, ...pr
|
|
|
213
218
|
onClick: handleClick,
|
|
214
219
|
onFocus: () => onFocus(path),
|
|
215
220
|
onKeyDown: (e) => handleKeyDown(e, path, "folder"),
|
|
216
|
-
style:
|
|
221
|
+
style: getFileTreeNodeStyle(level),
|
|
217
222
|
children: [
|
|
218
223
|
/* @__PURE__ */ jsx("span", {
|
|
219
224
|
className: cx("file-tree__chevron", isExpanded && "file-tree__chevron--expanded"),
|
|
@@ -226,18 +231,21 @@ function FileTreeFolder({ className, path, name, level = 0, children, ref, ...pr
|
|
|
226
231
|
children: isExpanded ? /* @__PURE__ */ jsx(FolderOpenIcon, {}) : /* @__PURE__ */ jsx(FolderIcon, {})
|
|
227
232
|
}),
|
|
228
233
|
/* @__PURE__ */ jsx("span", {
|
|
229
|
-
className: "file-tree__name",
|
|
234
|
+
className: "file-tree__name sigvelo-truncate",
|
|
230
235
|
children: name
|
|
231
236
|
})
|
|
232
237
|
]
|
|
233
|
-
}),
|
|
234
|
-
className: "file-tree__list",
|
|
238
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
239
|
+
className: "file-tree__list file-tree__group",
|
|
235
240
|
role: "group",
|
|
241
|
+
"aria-hidden": !isExpanded,
|
|
242
|
+
"data-collapsed": dataFlag(!isExpanded),
|
|
243
|
+
inert: !isExpanded,
|
|
236
244
|
children: React.Children.map(children, (child) => renderNestedFileTreeChild(child, level))
|
|
237
|
-
})
|
|
245
|
+
})]
|
|
238
246
|
});
|
|
239
247
|
}
|
|
240
|
-
function FileTreeFile({ className, path, name, icon, level = 0, ref, ...props }) {
|
|
248
|
+
function FileTreeFile({ className, path, name, icon, render, level = 0, ref, ...props }) {
|
|
241
249
|
const { selectedPath, focusedPath, onFocus, onSelect, handleKeyDown } = useFileTreeContext();
|
|
242
250
|
const isSelected = selectedPath === path;
|
|
243
251
|
const isFocused = focusedPath === path;
|
|
@@ -247,7 +255,25 @@ function FileTreeFile({ className, path, name, icon, level = 0, ref, ...props })
|
|
|
247
255
|
"aria-selected": isSelected,
|
|
248
256
|
className: cx("file-tree__file", className),
|
|
249
257
|
...props,
|
|
250
|
-
children: /* @__PURE__ */ jsxs(
|
|
258
|
+
children: render ? /* @__PURE__ */ jsxs(NavigationLink, {
|
|
259
|
+
render,
|
|
260
|
+
className: "file-tree__node file-tree__node--file",
|
|
261
|
+
"data-selected": dataFlag(isSelected),
|
|
262
|
+
"data-focused": dataFlag(isFocused),
|
|
263
|
+
"data-workspace-path": path,
|
|
264
|
+
tabIndex: getFileTreeNodeTabIndex(focusedPath, path),
|
|
265
|
+
onFocus: () => onFocus(path),
|
|
266
|
+
onKeyDown: (event) => handleKeyDown(event, path, "file-link"),
|
|
267
|
+
style: getFileTreeNodeStyle(level),
|
|
268
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
269
|
+
className: "file-tree__icon",
|
|
270
|
+
"aria-hidden": "true",
|
|
271
|
+
children: icon ?? /* @__PURE__ */ jsx(FileIcon, {})
|
|
272
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
273
|
+
className: "file-tree__name sigvelo-truncate",
|
|
274
|
+
children: name
|
|
275
|
+
})]
|
|
276
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
251
277
|
type: "button",
|
|
252
278
|
className: "file-tree__node file-tree__node--file",
|
|
253
279
|
"data-selected": dataFlag(isSelected),
|
|
@@ -256,14 +282,14 @@ function FileTreeFile({ className, path, name, icon, level = 0, ref, ...props })
|
|
|
256
282
|
tabIndex: getFileTreeNodeTabIndex(focusedPath, path),
|
|
257
283
|
onClick: () => onSelect(path),
|
|
258
284
|
onFocus: () => onFocus(path),
|
|
259
|
-
onKeyDown: (
|
|
260
|
-
style:
|
|
285
|
+
onKeyDown: (event) => handleKeyDown(event, path, "file"),
|
|
286
|
+
style: getFileTreeNodeStyle(level),
|
|
261
287
|
children: [/* @__PURE__ */ jsx("span", {
|
|
262
288
|
className: "file-tree__icon",
|
|
263
289
|
"aria-hidden": "true",
|
|
264
290
|
children: icon ?? /* @__PURE__ */ jsx(FileIcon, {})
|
|
265
291
|
}), /* @__PURE__ */ jsx("span", {
|
|
266
|
-
className: "file-tree__name",
|
|
292
|
+
className: "file-tree__name sigvelo-truncate",
|
|
267
293
|
children: name
|
|
268
294
|
})]
|
|
269
295
|
})
|
|
@@ -281,7 +307,7 @@ function FileTreeIcon({ className, children, ref, ...props }) {
|
|
|
281
307
|
function FileTreeName({ className, children, ref, ...props }) {
|
|
282
308
|
return /* @__PURE__ */ jsx("span", {
|
|
283
309
|
ref,
|
|
284
|
-
className: cx("file-tree__name", className),
|
|
310
|
+
className: cx("file-tree__name", "sigvelo-truncate", className),
|
|
285
311
|
...props,
|
|
286
312
|
children
|
|
287
313
|
});
|