@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,8 +1,11 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import { B as SpinnerIcon,
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { B as PlusIcon, G as SpinnerIcon, Z as WarningIcon, g as DotIcon, t as ArchiveIcon } from "../icons-CQJ-aMnI.js";
|
|
3
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
4
|
+
import { Button, buttonVariants } from "./Button.js";
|
|
5
|
+
import { SearchField } from "./SearchField.js";
|
|
6
|
+
import { AlertDialog } from "./AlertDialog.js";
|
|
4
7
|
import { ScrollArea } from "./ScrollArea.js";
|
|
5
|
-
import "react";
|
|
8
|
+
import * as React from "react";
|
|
6
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
10
|
//#region src/components/ThinkThreadPicker.tsx
|
|
8
11
|
function toThreadDate(value) {
|
|
@@ -49,6 +52,9 @@ function formatThreadStatus(thread) {
|
|
|
49
52
|
function isThreadBusy(status) {
|
|
50
53
|
return status === "pending" || status === "running" || status === "starting" || status === "streaming" || status === "submitted" || status === "recovering";
|
|
51
54
|
}
|
|
55
|
+
function errorMessage(error) {
|
|
56
|
+
return error instanceof Error ? error.message : String(error);
|
|
57
|
+
}
|
|
52
58
|
function summarizeThinkThreads(threads) {
|
|
53
59
|
return threads.reduce((summary, thread) => {
|
|
54
60
|
if (isThreadBusy(thread.status)) summary.running += 1;
|
|
@@ -98,12 +104,55 @@ function ThinkThreadStatusIndicators({ summary, className }) {
|
|
|
98
104
|
* Thread roster UI for sub-agent chat apps.
|
|
99
105
|
*
|
|
100
106
|
* This component does not call Think or Cloudflare RPC methods directly. Feed
|
|
101
|
-
* it from the parent agent's roster method, then
|
|
102
|
-
* child `useAgent({ sub: [...] })` name. Keep backend contract
|
|
103
|
-
* parent Think agent because
|
|
107
|
+
* it from the parent agent's roster method, then render app-owned route links
|
|
108
|
+
* that select the child `useAgent({ sub: [...] })` name. Keep backend contract
|
|
109
|
+
* notes beside the parent Think agent because
|
|
110
|
+
* `listThreads()`/`createThread()`/`deleteThread()` are app-owned.
|
|
104
111
|
*/
|
|
105
|
-
function ThinkThreadPicker({ threads,
|
|
112
|
+
function ThinkThreadPicker({ threads, renderThreadLink, onCreate, onDelete, className, title = "Recents", "aria-label": ariaLabel = "Threads", ref, ...props }) {
|
|
106
113
|
const statusSummary = summarizeThinkThreads(threads);
|
|
114
|
+
const [query, setQuery] = React.useState("");
|
|
115
|
+
const [deleteOpen, setDeleteOpen] = React.useState(false);
|
|
116
|
+
const [deleteCandidate, setDeleteCandidate] = React.useState();
|
|
117
|
+
const [deleteBusy, setDeleteBusy] = React.useState(false);
|
|
118
|
+
const [deleteError, setDeleteError] = React.useState();
|
|
119
|
+
const deleteSucceededRef = React.useRef(false);
|
|
120
|
+
const deleteFallbackIdRef = React.useRef(void 0);
|
|
121
|
+
const threadLinkRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
122
|
+
const deleteButtonRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
123
|
+
const createButtonRef = React.useRef(null);
|
|
124
|
+
const navRef = React.useRef(null);
|
|
125
|
+
const normalizedQuery = query.trim().toLocaleLowerCase();
|
|
126
|
+
const visibleThreads = normalizedQuery ? threads.filter((thread) => thread.title.toLocaleLowerCase().includes(normalizedQuery)) : threads;
|
|
127
|
+
const requestDelete = (thread) => {
|
|
128
|
+
const index = threads.findIndex((candidate) => candidate.id === thread.id);
|
|
129
|
+
deleteFallbackIdRef.current = threads[index + 1]?.id ?? threads[index - 1]?.id ?? void 0;
|
|
130
|
+
deleteSucceededRef.current = false;
|
|
131
|
+
setDeleteCandidate(thread);
|
|
132
|
+
setDeleteError(void 0);
|
|
133
|
+
setDeleteOpen(true);
|
|
134
|
+
};
|
|
135
|
+
const performDelete = async () => {
|
|
136
|
+
if (!deleteCandidate || !onDelete) return;
|
|
137
|
+
setDeleteBusy(true);
|
|
138
|
+
setDeleteError(void 0);
|
|
139
|
+
try {
|
|
140
|
+
await onDelete(deleteCandidate);
|
|
141
|
+
deleteSucceededRef.current = true;
|
|
142
|
+
setDeleteOpen(false);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
setDeleteError(errorMessage(error));
|
|
145
|
+
} finally {
|
|
146
|
+
setDeleteBusy(false);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const resolveDeleteFinalFocus = () => {
|
|
150
|
+
if (deleteSucceededRef.current) {
|
|
151
|
+
const fallbackId = deleteFallbackIdRef.current;
|
|
152
|
+
return (fallbackId ? threadLinkRefs.current.get(fallbackId) : void 0) ?? createButtonRef.current ?? navRef.current;
|
|
153
|
+
}
|
|
154
|
+
return (deleteCandidate ? deleteButtonRefs.current.get(deleteCandidate.id) : void 0) ?? createButtonRef.current ?? navRef.current;
|
|
155
|
+
};
|
|
107
156
|
return /* @__PURE__ */ jsxs("aside", {
|
|
108
157
|
ref,
|
|
109
158
|
className: cx("think-thread-picker", className),
|
|
@@ -116,53 +165,90 @@ function ThinkThreadPicker({ threads, selectedId, onSelect, onCreate, className,
|
|
|
116
165
|
children: title
|
|
117
166
|
}), /* @__PURE__ */ jsx(ThinkThreadStatusIndicators, { summary: statusSummary })]
|
|
118
167
|
}),
|
|
168
|
+
/* @__PURE__ */ jsxs(SearchField.Root, {
|
|
169
|
+
className: "think-thread-picker__search",
|
|
170
|
+
name: "thread-search",
|
|
171
|
+
children: [/* @__PURE__ */ jsx(SearchField.Label, {
|
|
172
|
+
className: "sigvelo-visually-hidden",
|
|
173
|
+
children: "Search threads"
|
|
174
|
+
}), /* @__PURE__ */ jsx(SearchField.Control, {
|
|
175
|
+
value: query,
|
|
176
|
+
placeholder: "Search recent threads",
|
|
177
|
+
autoComplete: "off",
|
|
178
|
+
onChange: (event) => setQuery(event.currentTarget.value)
|
|
179
|
+
})]
|
|
180
|
+
}),
|
|
119
181
|
/* @__PURE__ */ jsx("nav", {
|
|
182
|
+
ref: navRef,
|
|
120
183
|
className: "think-thread-picker__nav",
|
|
121
184
|
"aria-label": ariaLabel,
|
|
185
|
+
tabIndex: -1,
|
|
122
186
|
children: /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
123
187
|
className: "think-thread-picker__scroll",
|
|
124
188
|
children: [/* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
125
189
|
className: "think-thread-picker__viewport",
|
|
126
190
|
"aria-label": "Thread list",
|
|
127
|
-
children:
|
|
191
|
+
children: visibleThreads.length ? /* @__PURE__ */ jsx("ul", {
|
|
128
192
|
className: "think-thread-picker__list",
|
|
129
|
-
children:
|
|
193
|
+
children: visibleThreads.map((thread) => {
|
|
130
194
|
const timestamp = formatThreadTimestamp(thread);
|
|
131
195
|
const statusLabel = formatThreadStatus(thread);
|
|
132
196
|
const busy = isThreadBusy(thread.status);
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
197
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
198
|
+
className: "think-thread-picker__item",
|
|
199
|
+
children: [/* @__PURE__ */ jsxs(NavigationLink, {
|
|
200
|
+
render: renderThreadLink(thread),
|
|
201
|
+
ref: (node) => {
|
|
202
|
+
if (node) threadLinkRefs.current.set(thread.id, node);
|
|
203
|
+
else threadLinkRefs.current.delete(thread.id);
|
|
204
|
+
},
|
|
205
|
+
className: buttonVariants({
|
|
206
|
+
variant: "ghost",
|
|
207
|
+
color: "neutral",
|
|
208
|
+
size: "sm",
|
|
209
|
+
className: "think-thread-picker__thread"
|
|
210
|
+
}),
|
|
211
|
+
"data-thread-status": thread.status,
|
|
212
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
213
|
+
className: "think-thread-picker__thread-title",
|
|
214
|
+
children: thread.title
|
|
215
|
+
}), statusLabel ? /* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "think-thread-picker__thread-status",
|
|
217
|
+
role: "img",
|
|
218
|
+
"aria-label": statusLabel,
|
|
219
|
+
title: statusLabel,
|
|
220
|
+
children: busy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(DotIcon, {})
|
|
221
|
+
}) : timestamp?.date ? /* @__PURE__ */ jsx("time", {
|
|
222
|
+
className: "think-thread-picker__thread-time",
|
|
223
|
+
dateTime: timestamp.date.toISOString(),
|
|
224
|
+
title: timestamp.date.toLocaleString(),
|
|
225
|
+
children: timestamp.label
|
|
226
|
+
}) : timestamp ? /* @__PURE__ */ jsx("span", {
|
|
227
|
+
className: "think-thread-picker__thread-time",
|
|
228
|
+
children: timestamp.label
|
|
229
|
+
}) : null]
|
|
230
|
+
}), onDelete ? /* @__PURE__ */ jsx(Button, {
|
|
231
|
+
ref: (node) => {
|
|
232
|
+
if (node) deleteButtonRefs.current.set(thread.id, node);
|
|
233
|
+
else deleteButtonRefs.current.delete(thread.id);
|
|
234
|
+
},
|
|
235
|
+
type: "button",
|
|
236
|
+
variant: "ghost",
|
|
237
|
+
color: "neutral",
|
|
238
|
+
size: "sm",
|
|
239
|
+
iconOnly: true,
|
|
240
|
+
className: "think-thread-picker__delete",
|
|
241
|
+
"aria-label": `Delete thread ${thread.title}`,
|
|
242
|
+
"aria-haspopup": "dialog",
|
|
243
|
+
disabled: deleteBusy,
|
|
244
|
+
onClick: () => requestDelete(thread),
|
|
245
|
+
children: /* @__PURE__ */ jsx(ArchiveIcon, {})
|
|
160
246
|
}) : null]
|
|
161
|
-
}
|
|
247
|
+
}, thread.id);
|
|
162
248
|
})
|
|
163
249
|
}) : /* @__PURE__ */ jsx("p", {
|
|
164
250
|
className: "think-thread-picker__empty",
|
|
165
|
-
children: "No threads yet."
|
|
251
|
+
children: threads.length ? "No matching threads." : "No threads yet."
|
|
166
252
|
})
|
|
167
253
|
}), /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
|
|
168
254
|
orientation: "vertical",
|
|
@@ -173,6 +259,7 @@ function ThinkThreadPicker({ threads, selectedId, onSelect, onCreate, className,
|
|
|
173
259
|
onCreate ? /* @__PURE__ */ jsx("div", {
|
|
174
260
|
className: "think-thread-picker__footer",
|
|
175
261
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
262
|
+
ref: createButtonRef,
|
|
176
263
|
type: "button",
|
|
177
264
|
variant: "normal",
|
|
178
265
|
color: "neutral",
|
|
@@ -181,6 +268,43 @@ function ThinkThreadPicker({ threads, selectedId, onSelect, onCreate, className,
|
|
|
181
268
|
onClick: () => void onCreate(),
|
|
182
269
|
children: [/* @__PURE__ */ jsx(PlusIcon, {}), /* @__PURE__ */ jsx("span", { children: "New thread" })]
|
|
183
270
|
})
|
|
271
|
+
}) : null,
|
|
272
|
+
onDelete && deleteCandidate ? /* @__PURE__ */ jsx(AlertDialog.Root, {
|
|
273
|
+
open: deleteOpen,
|
|
274
|
+
onOpenChange: (open, eventDetails) => {
|
|
275
|
+
if (deleteBusy) {
|
|
276
|
+
eventDetails.cancel();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
setDeleteOpen(open);
|
|
280
|
+
if (!open) setDeleteError(void 0);
|
|
281
|
+
},
|
|
282
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog.Backdrop, {}), /* @__PURE__ */ jsx(AlertDialog.Viewport, { children: /* @__PURE__ */ jsxs(AlertDialog.Popup, {
|
|
283
|
+
finalFocus: resolveDeleteFinalFocus,
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsxs(AlertDialog.Title, { children: [
|
|
286
|
+
"Delete ",
|
|
287
|
+
deleteCandidate.title,
|
|
288
|
+
"?"
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsx(AlertDialog.Description, { children: "This permanently deletes the conversation, its schedules, and its execution history. Any active work stops. This action cannot be undone." }),
|
|
291
|
+
deleteError ? /* @__PURE__ */ jsxs("p", {
|
|
292
|
+
className: "think-thread-picker__delete-error",
|
|
293
|
+
role: "alert",
|
|
294
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, {}), /* @__PURE__ */ jsx("span", { children: deleteError })]
|
|
295
|
+
}) : null,
|
|
296
|
+
/* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [/* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
297
|
+
disabled: deleteBusy,
|
|
298
|
+
children: "Cancel"
|
|
299
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
300
|
+
type: "button",
|
|
301
|
+
color: "destructive",
|
|
302
|
+
disabled: deleteBusy,
|
|
303
|
+
onClick: () => void performDelete(),
|
|
304
|
+
children: [deleteBusy ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : null, deleteBusy ? "Deleting…" : "Delete thread"]
|
|
305
|
+
})] })
|
|
306
|
+
]
|
|
307
|
+
}) })] })
|
|
184
308
|
}) : null
|
|
185
309
|
]
|
|
186
310
|
});
|
|
@@ -9,52 +9,31 @@ interface ToastProviderProps extends React.ComponentPropsWithoutRef<typeof Toast
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for the Toast.Viewport component.
|
|
11
11
|
*/
|
|
12
|
-
interface ToastViewportProps extends
|
|
13
|
-
/** Additional CSS class names */
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
12
|
+
interface ToastViewportProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Viewport> {}
|
|
16
13
|
/**
|
|
17
14
|
* Props for the Toast.Root component.
|
|
18
15
|
*/
|
|
19
|
-
interface ToastRootProps extends
|
|
20
|
-
/** Additional CSS class names */
|
|
21
|
-
className?: string;
|
|
22
|
-
}
|
|
16
|
+
interface ToastRootProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Root> {}
|
|
23
17
|
/**
|
|
24
18
|
* Props for the Toast.Content component.
|
|
25
19
|
*/
|
|
26
|
-
interface ToastContentProps extends
|
|
27
|
-
/** Additional CSS class names */
|
|
28
|
-
className?: string;
|
|
29
|
-
}
|
|
20
|
+
interface ToastContentProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Content> {}
|
|
30
21
|
/**
|
|
31
22
|
* Props for the Toast.Title component.
|
|
32
23
|
*/
|
|
33
|
-
interface ToastTitleProps extends
|
|
34
|
-
/** Additional CSS class names */
|
|
35
|
-
className?: string;
|
|
36
|
-
}
|
|
24
|
+
interface ToastTitleProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Title> {}
|
|
37
25
|
/**
|
|
38
26
|
* Props for the Toast.Description component.
|
|
39
27
|
*/
|
|
40
|
-
interface ToastDescriptionProps extends
|
|
41
|
-
/** Additional CSS class names */
|
|
42
|
-
className?: string;
|
|
43
|
-
}
|
|
28
|
+
interface ToastDescriptionProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Description> {}
|
|
44
29
|
/**
|
|
45
30
|
* Props for the Toast.Action component.
|
|
46
31
|
*/
|
|
47
|
-
interface ToastActionProps extends
|
|
48
|
-
/** Additional CSS class names */
|
|
49
|
-
className?: string;
|
|
50
|
-
}
|
|
32
|
+
interface ToastActionProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Action> {}
|
|
51
33
|
/**
|
|
52
34
|
* Props for the Toast.Close component.
|
|
53
35
|
*/
|
|
54
|
-
interface ToastCloseProps extends
|
|
55
|
-
/** Additional CSS class names */
|
|
56
|
-
className?: string;
|
|
57
|
-
}
|
|
36
|
+
interface ToastCloseProps extends React.ComponentPropsWithoutRef<typeof Toast$1.Close> {}
|
|
58
37
|
/**
|
|
59
38
|
* Container for displaying toasts.
|
|
60
39
|
*/
|
package/dist/components/Toast.js
CHANGED
|
@@ -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 { Toast as Toast$1 } from "@base-ui/react/toast";
|
|
@@ -21,8 +22,8 @@ const ToastProvider = (props) => {
|
|
|
21
22
|
/**
|
|
22
23
|
* Container for displaying toasts.
|
|
23
24
|
*/
|
|
24
|
-
function ToastViewport({ className
|
|
25
|
-
const classes = ["toast__viewport"
|
|
25
|
+
function ToastViewport({ className, ref, ...props }) {
|
|
26
|
+
const classes = mergeBaseClassName(["toast__viewport"].filter(Boolean).join(" "), className);
|
|
26
27
|
return /* @__PURE__ */ jsx(Toast$1.Viewport, {
|
|
27
28
|
ref,
|
|
28
29
|
"data-slot": "toast-viewport",
|
|
@@ -33,8 +34,8 @@ function ToastViewport({ className = "", ref, ...props }) {
|
|
|
33
34
|
/**
|
|
34
35
|
* Individual toast wrapper.
|
|
35
36
|
*/
|
|
36
|
-
function ToastRoot({ className
|
|
37
|
-
const classes = ["toast"
|
|
37
|
+
function ToastRoot({ className, ref, ...props }) {
|
|
38
|
+
const classes = mergeBaseClassName(["toast"].filter(Boolean).join(" "), className);
|
|
38
39
|
return /* @__PURE__ */ jsx(Toast$1.Root, {
|
|
39
40
|
ref,
|
|
40
41
|
"data-slot": "toast",
|
|
@@ -45,8 +46,8 @@ function ToastRoot({ className = "", ref, ...props }) {
|
|
|
45
46
|
/**
|
|
46
47
|
* Container for the contents of a toast.
|
|
47
48
|
*/
|
|
48
|
-
function ToastContent({ className
|
|
49
|
-
const classes = ["toast__content"
|
|
49
|
+
function ToastContent({ className, ref, ...props }) {
|
|
50
|
+
const classes = mergeBaseClassName(["toast__content"].filter(Boolean).join(" "), className);
|
|
50
51
|
return /* @__PURE__ */ jsx(Toast$1.Content, {
|
|
51
52
|
ref,
|
|
52
53
|
"data-slot": "toast-content",
|
|
@@ -57,8 +58,8 @@ function ToastContent({ className = "", ref, ...props }) {
|
|
|
57
58
|
/**
|
|
58
59
|
* Title that labels the toast. Renders an `<h2>` element.
|
|
59
60
|
*/
|
|
60
|
-
function ToastTitle({ className
|
|
61
|
-
const classes = ["toast__title"
|
|
61
|
+
function ToastTitle({ className, ref, ...props }) {
|
|
62
|
+
const classes = mergeBaseClassName(["toast__title"].filter(Boolean).join(" "), className);
|
|
62
63
|
return /* @__PURE__ */ jsx(Toast$1.Title, {
|
|
63
64
|
ref,
|
|
64
65
|
"data-slot": "toast-title",
|
|
@@ -69,8 +70,8 @@ function ToastTitle({ className = "", ref, ...props }) {
|
|
|
69
70
|
/**
|
|
70
71
|
* Description text for the toast. Renders a `<p>` element.
|
|
71
72
|
*/
|
|
72
|
-
function ToastDescription({ className
|
|
73
|
-
const classes = ["toast__description"
|
|
73
|
+
function ToastDescription({ className, ref, ...props }) {
|
|
74
|
+
const classes = mergeBaseClassName(["toast__description"].filter(Boolean).join(" "), className);
|
|
74
75
|
return /* @__PURE__ */ jsx(Toast$1.Description, {
|
|
75
76
|
ref,
|
|
76
77
|
"data-slot": "toast-description",
|
|
@@ -81,8 +82,8 @@ function ToastDescription({ className = "", ref, ...props }) {
|
|
|
81
82
|
/**
|
|
82
83
|
* Action button within the toast.
|
|
83
84
|
*/
|
|
84
|
-
function ToastAction({ className
|
|
85
|
-
const classes = ["toast__action"
|
|
85
|
+
function ToastAction({ className, ref, ...props }) {
|
|
86
|
+
const classes = mergeBaseClassName(["toast__action"].filter(Boolean).join(" "), className);
|
|
86
87
|
return /* @__PURE__ */ jsx(Toast$1.Action, {
|
|
87
88
|
ref,
|
|
88
89
|
"data-slot": "toast-action",
|
|
@@ -93,8 +94,8 @@ function ToastAction({ className = "", ref, ...props }) {
|
|
|
93
94
|
/**
|
|
94
95
|
* Close button that dismisses the toast.
|
|
95
96
|
*/
|
|
96
|
-
function ToastClose({ className
|
|
97
|
-
const classes = ["toast__close"
|
|
97
|
+
function ToastClose({ className, ref, ...props }) {
|
|
98
|
+
const classes = mergeBaseClassName(["toast__close"].filter(Boolean).join(" "), className);
|
|
98
99
|
return /* @__PURE__ */ jsx(Toast$1.Close, {
|
|
99
100
|
ref,
|
|
100
101
|
"data-slot": "toast-close",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as toggleVariants, n as ToggleProps, r as ToggleVariantsOptions, t as Toggle } from "../Toggle-
|
|
1
|
+
import { i as toggleVariants, n as ToggleProps, r as ToggleVariantsOptions, t as Toggle } from "../Toggle-JKZ43D5S.js";
|
|
2
2
|
export { Toggle, ToggleProps, ToggleVariantsOptions, toggleVariants };
|
|
@@ -1,12 +1,13 @@
|
|
|
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 { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
4
5
|
//#region src/components/Toggle.tsx
|
|
5
|
-
function toggleVariants({ variant = "default", size = "
|
|
6
|
+
function toggleVariants({ variant = "default", size = "md", className } = {}) {
|
|
6
7
|
return [
|
|
7
8
|
"toggle",
|
|
8
9
|
variant === "outline" && "toggle--outline",
|
|
9
|
-
size !== "
|
|
10
|
+
size !== "md" && `toggle--${size}`,
|
|
10
11
|
className
|
|
11
12
|
].filter(Boolean).join(" ");
|
|
12
13
|
}
|
|
@@ -50,15 +51,16 @@ function toggleVariants({ variant = "default", size = "default", className } = {
|
|
|
50
51
|
*
|
|
51
52
|
* @see {@link https://base-ui.com/react/components/toggle | Base UI Toggle}
|
|
52
53
|
*/
|
|
53
|
-
function Toggle({ className
|
|
54
|
+
function Toggle({ className, variant, size, ref, ...props }) {
|
|
55
|
+
const classes = mergeBaseClassName(toggleVariants({
|
|
56
|
+
variant,
|
|
57
|
+
size
|
|
58
|
+
}), className);
|
|
54
59
|
return /* @__PURE__ */ jsx(Toggle$1, {
|
|
55
60
|
ref,
|
|
56
61
|
"data-slot": "toggle",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
size,
|
|
60
|
-
className
|
|
61
|
-
}),
|
|
62
|
+
"data-size": size ?? "md",
|
|
63
|
+
className: classes,
|
|
62
64
|
...props
|
|
63
65
|
});
|
|
64
66
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ToggleGroupItemProps, r as ToggleGroupProps, t as ToggleGroup } from "../ToggleGroup-
|
|
1
|
+
import { n as ToggleGroupItemProps, r as ToggleGroupProps, t as ToggleGroup } from "../ToggleGroup-DNd6cDJZ.js";
|
|
2
2
|
export { ToggleGroup, ToggleGroupItemProps, ToggleGroupProps };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-BiMDVpUo.js";
|
|
1
2
|
import { toggleVariants } from "./Toggle.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -6,12 +7,9 @@ import { Toggle } from "@base-ui/react/toggle";
|
|
|
6
7
|
//#region src/components/ToggleGroup.tsx
|
|
7
8
|
const ToggleGroupContext = React.createContext({
|
|
8
9
|
variant: "default",
|
|
9
|
-
size: "
|
|
10
|
+
size: "md",
|
|
10
11
|
spacing: 0
|
|
11
12
|
});
|
|
12
|
-
function normalizeSize(size) {
|
|
13
|
-
return size === "md" ? "default" : size;
|
|
14
|
-
}
|
|
15
13
|
/**
|
|
16
14
|
* A toggle group component for selecting one or multiple options.
|
|
17
15
|
*
|
|
@@ -37,8 +35,7 @@ function normalizeSize(size) {
|
|
|
37
35
|
*
|
|
38
36
|
* @see {@link https://base-ui.com/react/components/toggle-group | Base UI Toggle Group}
|
|
39
37
|
*/
|
|
40
|
-
function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", className
|
|
41
|
-
const normalizedSize = normalizeSize(size);
|
|
38
|
+
function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", className, children, style, ref, ...props }) {
|
|
42
39
|
const gap = `${spacing * .25}rem`;
|
|
43
40
|
const groupStyle = typeof style === "function" ? (state) => ({
|
|
44
41
|
...style(state),
|
|
@@ -47,25 +44,27 @@ function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", classN
|
|
|
47
44
|
...style,
|
|
48
45
|
gap
|
|
49
46
|
};
|
|
47
|
+
const classes = mergeBaseClassName(["toggle-group", size !== "md" && `toggle-group--${size}`].filter(Boolean).join(" "), className);
|
|
48
|
+
const contextValue = React.useMemo(() => ({
|
|
49
|
+
variant,
|
|
50
|
+
size,
|
|
51
|
+
spacing
|
|
52
|
+
}), [
|
|
53
|
+
size,
|
|
54
|
+
spacing,
|
|
55
|
+
variant
|
|
56
|
+
]);
|
|
50
57
|
return /* @__PURE__ */ jsx(ToggleGroup$1, {
|
|
51
58
|
ref,
|
|
52
|
-
"data-size":
|
|
59
|
+
"data-size": size,
|
|
53
60
|
"data-slot": "toggle-group",
|
|
54
61
|
"data-spacing": spacing,
|
|
55
62
|
"data-variant": variant,
|
|
56
|
-
className:
|
|
57
|
-
"toggle-group",
|
|
58
|
-
size !== "md" && `toggle-group--${size}`,
|
|
59
|
-
className
|
|
60
|
-
].filter(Boolean).join(" "),
|
|
63
|
+
className: classes,
|
|
61
64
|
style: groupStyle,
|
|
62
65
|
...props,
|
|
63
66
|
children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
|
|
64
|
-
value:
|
|
65
|
-
variant,
|
|
66
|
-
size: normalizedSize,
|
|
67
|
-
spacing
|
|
68
|
-
},
|
|
67
|
+
value: contextValue,
|
|
69
68
|
children
|
|
70
69
|
})
|
|
71
70
|
});
|
|
@@ -73,18 +72,14 @@ function ToggleGroupRoot({ size = "md", spacing = 0, variant = "default", classN
|
|
|
73
72
|
/**
|
|
74
73
|
* A single toggle item within a ToggleGroup.
|
|
75
74
|
*/
|
|
76
|
-
function ToggleGroupItem({ className
|
|
75
|
+
function ToggleGroupItem({ className, variant, size, ref, ...props }) {
|
|
77
76
|
const context = React.useContext(ToggleGroupContext);
|
|
78
77
|
const itemVariant = variant ?? context.variant;
|
|
79
78
|
const itemSize = size ?? context.size;
|
|
80
|
-
const classes = [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
size: itemSize
|
|
85
|
-
}),
|
|
86
|
-
className
|
|
87
|
-
].filter(Boolean).join(" ");
|
|
79
|
+
const classes = mergeBaseClassName(["toggle-group__item", toggleVariants({
|
|
80
|
+
variant: itemVariant,
|
|
81
|
+
size: itemSize
|
|
82
|
+
})].filter(Boolean).join(" "), className);
|
|
88
83
|
return /* @__PURE__ */ jsx(Toggle, {
|
|
89
84
|
ref,
|
|
90
85
|
"data-size": itemSize,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChatAddToolApproveResponseFunction, DynamicToolUIPart, ToolUIPart } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ToolApproval.d.ts
|
|
5
|
+
interface ToolApprovalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "part"> {
|
|
6
|
+
/** Whole upstream AI SDK tool part. Non-request states render nothing. */
|
|
7
|
+
part: ToolUIPart | DynamicToolUIPart;
|
|
8
|
+
/** Pass `addToolApprovalResponse` from the chat hook directly. */
|
|
9
|
+
onRespond: ChatAddToolApproveResponseFunction;
|
|
10
|
+
question?: React.ReactNode;
|
|
11
|
+
count?: number;
|
|
12
|
+
onSkip?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** Actionable adapter for an AI SDK `approval-requested` tool part. */
|
|
15
|
+
declare function ToolApproval({
|
|
16
|
+
className,
|
|
17
|
+
count,
|
|
18
|
+
onRespond,
|
|
19
|
+
onSkip,
|
|
20
|
+
part,
|
|
21
|
+
question,
|
|
22
|
+
ref,
|
|
23
|
+
...props
|
|
24
|
+
}: ToolApprovalProps & {
|
|
25
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
26
|
+
}): React.JSX.Element | null;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ToolApproval, ToolApprovalProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Approval, ApprovalCount, ApprovalDecision, ApprovalHeader, ApprovalInputPreview, ApprovalQuestion } from "./Approval.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { getToolName } from "ai";
|
|
5
|
+
//#region src/components/ToolApproval.tsx
|
|
6
|
+
/** Actionable adapter for an AI SDK `approval-requested` tool part. */
|
|
7
|
+
function ToolApproval({ className, count, onRespond, onSkip, part, question, ref, ...props }) {
|
|
8
|
+
if (part.state !== "approval-requested") return null;
|
|
9
|
+
const toolName = part.title ?? getToolName(part);
|
|
10
|
+
return /* @__PURE__ */ jsxs(Approval, {
|
|
11
|
+
ref,
|
|
12
|
+
className,
|
|
13
|
+
"aria-label": `Approve ${toolName}`,
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
"Do you want to allow the agent to run ",
|
|
18
|
+
/* @__PURE__ */ jsx("code", { children: toolName }),
|
|
19
|
+
"?"
|
|
20
|
+
] }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
|
|
21
|
+
/* @__PURE__ */ jsx(ApprovalInputPreview, { input: part.input }),
|
|
22
|
+
/* @__PURE__ */ jsx(ApprovalDecision, {
|
|
23
|
+
subject: toolName,
|
|
24
|
+
onSkip,
|
|
25
|
+
onDecision: ({ approved, reason }) => onRespond({
|
|
26
|
+
id: part.approval.id,
|
|
27
|
+
approved,
|
|
28
|
+
reason
|
|
29
|
+
})
|
|
30
|
+
}, part.approval.id)
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ToolApproval };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ToolInvocation.d.ts
|
|
4
|
+
/** One whole static or dynamic AI SDK tool UI part. */
|
|
5
|
+
type ToolInvocationPart = ToolUIPart | DynamicToolUIPart;
|
|
6
|
+
interface ToolInvocationProps {
|
|
7
|
+
/** The whole upstream AI SDK tool part, kept intact across every tool state. */
|
|
8
|
+
part: ToolInvocationPart;
|
|
9
|
+
/** Render the existing Activity disclosure expanded initially. */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read-only generic disclosure for one upstream AI SDK tool invocation.
|
|
14
|
+
*
|
|
15
|
+
* The component derives its name, state, input, output, denial, and error
|
|
16
|
+
* presentation from the whole `ToolUIPart | DynamicToolUIPart`. Approval
|
|
17
|
+
* response controls belong to transport-aware adapters rather than this
|
|
18
|
+
* transcript renderer. ThinkChat may replace this fallback with richer panels
|
|
19
|
+
* for known workspace, browser, fetch, session, skill, and execute tools.
|
|
20
|
+
*/
|
|
21
|
+
declare function ToolInvocation({
|
|
22
|
+
part,
|
|
23
|
+
defaultOpen
|
|
24
|
+
}: ToolInvocationProps): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ToolInvocation, ToolInvocationPart, ToolInvocationProps };
|