@mcp-b/react-components 0.14.1 → 0.16.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 +36 -0
- package/dist/{AgentChat-Cgb1xuT7.d.ts → AgentChat-CrlpbvQJ.d.ts} +62 -8
- package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
- package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
- package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
- package/dist/Message-BkMdE3bS.js +375 -0
- package/dist/{ModelSelector-DVgVBdvw.js → ModelSelector-SlJNgwKY.js} +17 -8
- package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
- package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
- package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
- package/dist/{ThinkChat-7DQ2CogF.js → ThinkChat-CzC-zNGA.js} +27 -37
- package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +62 -3
- package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
- package/dist/Toggle-CAAlNl-M.d.ts +69 -0
- package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
- package/dist/Workspace-D39LxGvP.d.ts +62 -0
- package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
- package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
- package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
- package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
- package/dist/components/Activity.d.ts +27 -1
- package/dist/components/Activity.js +33 -15
- package/dist/components/AgentActivity.d.ts +2 -0
- package/dist/components/AgentActivity.js +45 -0
- package/dist/components/AgentActivityPreview.d.ts +46 -0
- package/dist/components/AgentActivityPreview.js +94 -0
- package/dist/components/AgentAttention.d.ts +73 -0
- package/dist/components/AgentAttention.js +85 -0
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +231 -205
- package/dist/components/AgentChatMessageEditor.d.ts +29 -0
- package/dist/components/AgentChatMessageEditor.js +92 -0
- package/dist/components/AgentChatTurnError.d.ts +17 -0
- package/dist/components/AgentChatTurnError.js +40 -0
- package/dist/components/AgentConnection.d.ts +12 -17
- package/dist/components/AgentConnection.js +99 -91
- package/dist/components/AppFrame.d.ts +24 -0
- package/dist/components/AppFrame.js +25 -0
- package/dist/components/AppTopBar.d.ts +71 -0
- package/dist/components/AppTopBar.js +82 -0
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/BrowserRunPanel.js +1 -1
- package/dist/components/Card.d.ts +3 -0
- package/dist/components/Card.js +2 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.js +2 -2
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/CheckboxGroup.d.ts +58 -2
- package/dist/components/CheckboxGroup.js +59 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +1 -1
- package/dist/components/Commit.js +2 -2
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/DescriptionList.d.ts +12 -0
- package/dist/components/DescriptionList.js +11 -0
- package/dist/components/DescriptionListParts.d.ts +37 -0
- package/dist/components/DescriptionListParts.js +35 -0
- package/dist/components/EnvironmentVariables.js +2 -2
- package/dist/components/Fieldset.d.ts +13 -1
- package/dist/components/Fieldset.js +11 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/IconButton.d.ts +33 -0
- package/dist/components/IconButton.js +27 -0
- package/dist/components/McpConnectionRequest.d.ts +44 -0
- package/dist/components/McpConnectionRequest.js +122 -0
- package/dist/components/McpServerPicker.d.ts +48 -23
- package/dist/components/McpServerPicker.js +238 -189
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.d.ts +1 -0
- package/dist/components/Message.js +1 -285
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/ModelSelector.d.ts +15 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NaniteScene.d.ts +10 -1
- package/dist/components/NaniteScene.js +36 -1
- package/dist/components/Pricing.d.ts +37 -0
- package/dist/components/Pricing.js +17 -0
- package/dist/components/PricingBillingToggle.d.ts +23 -0
- package/dist/components/PricingBillingToggle.js +86 -0
- package/dist/components/PricingConfirmationDialog.d.ts +25 -0
- package/dist/components/PricingConfirmationDialog.js +57 -0
- package/dist/components/PricingFAQ.d.ts +18 -0
- package/dist/components/PricingFAQ.js +27 -0
- package/dist/components/PricingPage.d.ts +2 -38
- package/dist/components/PricingPage.js +39 -359
- package/dist/components/PricingPlanCard.d.ts +22 -0
- package/dist/components/PricingPlanCard.js +109 -0
- package/dist/components/PricingUsageCalculator.d.ts +22 -0
- package/dist/components/PricingUsageCalculator.js +96 -0
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +210 -15
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.d.ts +2 -1
- package/dist/components/Reasoning.js +14 -29
- package/dist/components/ResizableSidePanel.d.ts +57 -0
- package/dist/components/ResizableSidePanel.js +151 -0
- package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
- package/dist/components/ResponsiveSidebarShell.js +129 -0
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +11 -2
- package/dist/components/Slider.d.ts +13 -1
- package/dist/components/Slider.js +11 -0
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Stepper.js +5 -3
- package/dist/components/SubagentRun.d.ts +86 -0
- package/dist/components/SubagentRun.js +108 -0
- package/dist/components/SubagentRunDetails.d.ts +44 -0
- package/dist/components/SubagentRunDetails.js +48 -0
- package/dist/components/SubagentRunIndicator.d.ts +22 -0
- package/dist/components/SubagentRunIndicator.js +33 -0
- package/dist/components/SubagentRunList.d.ts +25 -0
- package/dist/components/SubagentRunList.js +26 -0
- package/dist/components/SubagentRunSelector.d.ts +47 -0
- package/dist/components/SubagentRunSelector.js +55 -0
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/Textarea.d.ts +21 -0
- package/dist/components/Textarea.js +19 -0
- package/dist/components/ThemeModeControl.d.ts +24 -0
- package/dist/components/ThemeModeControl.js +52 -0
- package/dist/components/ThemeProvider.d.ts +38 -0
- package/dist/components/ThemeProvider.js +80 -0
- package/dist/components/ThinkChat.d.ts +34 -7
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +18 -297
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +15 -5
- package/dist/components/ThinkChatToolPanels.js +116 -9
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +51 -9
- package/dist/components/ThinkExecutionDetail.d.ts +20 -0
- package/dist/components/ThinkExecutionDetail.js +80 -0
- package/dist/components/ThinkExecutionRun.d.ts +2 -0
- package/dist/components/ThinkExecutionRun.js +72 -0
- package/dist/components/ThinkExecutionStatus.d.ts +22 -0
- package/dist/components/ThinkExecutionStatus.js +36 -0
- package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
- package/dist/components/ThinkExecutionWorkbench.js +69 -225
- package/dist/components/ThinkFullApp.d.ts +58 -14
- package/dist/components/ThinkFullApp.js +129 -160
- package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
- package/dist/components/ThinkFullAppViewSwitch.js +34 -0
- package/dist/components/ThinkRoutine.d.ts +36 -0
- package/dist/components/ThinkRoutine.js +15 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
- package/dist/components/ThinkRoutineBrowser.js +156 -0
- package/dist/components/ThinkRoutineDetail.d.ts +24 -0
- package/dist/components/ThinkRoutineDetail.js +102 -0
- package/dist/components/ThinkRoutineForm.d.ts +32 -0
- package/dist/components/ThinkRoutineForm.js +151 -0
- package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
- package/dist/components/ThinkRoutineLibrary.js +178 -0
- package/dist/components/ThinkRoutineRuns.d.ts +24 -0
- package/dist/components/ThinkRoutineRuns.js +68 -0
- package/dist/components/ThinkThreadPicker.d.ts +18 -1
- package/dist/components/ThinkThreadPicker.js +51 -5
- package/dist/components/ThinkThreadShell.d.ts +12 -9
- package/dist/components/ThinkThreadShell.js +17 -137
- package/dist/components/Toggle.d.ts +1 -68
- package/dist/components/ToggleGroup.d.ts +1 -72
- package/dist/components/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip.js +4 -2
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/Workspace.d.ts +2 -0
- package/dist/components/Workspace.js +424 -0
- package/dist/components/WorkspaceBrowser.d.ts +32 -0
- package/dist/components/WorkspaceBrowser.js +103 -0
- package/dist/components/WorkspaceExplorer.d.ts +12 -79
- package/dist/components/WorkspaceExplorer.js +116 -330
- package/dist/components/WorkspaceFile.d.ts +2 -0
- package/dist/components/WorkspaceFile.js +195 -0
- package/dist/components/WorkspaceFileView.d.ts +26 -0
- package/dist/components/WorkspaceFileView.js +2 -0
- package/dist/components/WorkspaceHeader.d.ts +35 -0
- package/dist/components/WorkspaceHeader.js +51 -0
- package/dist/components/WorkspaceLink.d.ts +2 -0
- package/dist/components/WorkspaceLink.js +2 -0
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
- package/dist/icons-CpfUer49.js +85 -0
- package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
- package/dist/styles/activity-header.css +75 -0
- package/dist/styles/activity.css +49 -63
- package/dist/styles/agent-activity-preview-overlay.css +80 -0
- package/dist/styles/agent-activity-preview.css +235 -0
- package/dist/styles/agent-attention.css +122 -0
- package/dist/styles/agent-chat.css +141 -4
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +100 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +21 -0
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/fieldset.css +11 -0
- package/dist/styles/index.css +15 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +95 -68
- package/dist/styles/message.css +4 -43
- package/dist/styles/nanite-scene.css +16 -0
- package/dist/styles/pricing-page.css +21 -27
- package/dist/styles/prompt-input.css +225 -32
- package/dist/styles/reasoning.css +1 -55
- package/dist/styles/recipes.css +23 -15
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +10 -0
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +205 -0
- package/dist/styles/textarea.css +20 -0
- package/dist/styles/theme-mode-control.css +72 -0
- package/dist/styles/think-execution-status.css +49 -0
- package/dist/styles/think-execution-workbench.css +8 -72
- package/dist/styles/think-full-app.css +106 -131
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/workspace-explorer.css +511 -64
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/mcp-server-catalog.d.ts +82 -78
- package/dist/utils/mcp-server-catalog.js +64 -41
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/utils/theme.d.ts +22 -0
- package/dist/utils/theme.js +55 -0
- package/package.json +34 -28
- package/dist/icons-Ba9THQKz.js +0 -64
- package/dist/styles/think-resize-handle.css +0 -33
- package/dist/styles/think-thread-shell.css +0 -219
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Collapsible } from "./Collapsible.js";
|
|
2
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import { Badge } from "./Badge.js";
|
|
5
|
+
import { NaniteMark } from "./NaniteScene.js";
|
|
6
|
+
import { SubagentRunIndicator, getSubagentRunName, getSubagentRunTooltip } from "./SubagentRunIndicator.js";
|
|
7
|
+
import { SubagentRunSelector } from "./SubagentRunSelector.js";
|
|
8
|
+
import { SubagentRunList } from "./SubagentRunList.js";
|
|
9
|
+
import { SubagentRunActions, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "./SubagentRunDetails.js";
|
|
10
|
+
import "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/SubagentRun.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Transport-neutral inline disclosure for one delegated agent run.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Retained subagent transcripts should open in an adjacent
|
|
17
|
+
* `ThinkFullApp` workbench panel. Use `SubagentRunSelector` in the transcript.
|
|
18
|
+
*/
|
|
19
|
+
function SubagentRun({ className, ref, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
21
|
+
ref,
|
|
22
|
+
"data-slot": "subagent-run",
|
|
23
|
+
className: cx("subagent-run", className),
|
|
24
|
+
...props,
|
|
25
|
+
unstyled: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Retained subagent transcripts should not expand inline. Use
|
|
30
|
+
* `SubagentRunSelector` and render the child in a `ThinkFullApp` workbench panel.
|
|
31
|
+
*/
|
|
32
|
+
function SubagentRunTrigger({ className, children, ref, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
34
|
+
ref,
|
|
35
|
+
"data-slot": "subagent-run-trigger",
|
|
36
|
+
className: cx("subagent-run__trigger", className),
|
|
37
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
38
|
+
type: "button",
|
|
39
|
+
variant: "outline",
|
|
40
|
+
color: "neutral",
|
|
41
|
+
size: "sm"
|
|
42
|
+
}),
|
|
43
|
+
...props,
|
|
44
|
+
unstyled: true,
|
|
45
|
+
children: [/* @__PURE__ */ jsx(NaniteMark, {}), /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "subagent-run__trigger-content",
|
|
47
|
+
children
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function SubagentRunHeading({ className, ref, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("span", {
|
|
53
|
+
ref,
|
|
54
|
+
className: cx("subagent-run__heading", className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function SubagentRunTitle({ className, ref, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("span", {
|
|
60
|
+
ref,
|
|
61
|
+
className: cx("subagent-run__title", className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function SubagentRunDescription({ className, ref, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx("span", {
|
|
67
|
+
ref,
|
|
68
|
+
className: cx("subagent-run__description", className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const STATUS_COLOR = {
|
|
73
|
+
active: "primary",
|
|
74
|
+
complete: "success",
|
|
75
|
+
error: "destructive",
|
|
76
|
+
stopped: "neutral",
|
|
77
|
+
warning: "warning"
|
|
78
|
+
};
|
|
79
|
+
/** Visible status label. A transport adapter owns any debounced live announcement. */
|
|
80
|
+
function SubagentRunStatus({ className, tone = "active", size = "sm", ...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
82
|
+
"data-slot": "subagent-run-status",
|
|
83
|
+
"data-tone": tone,
|
|
84
|
+
className: cx("subagent-run__status", className),
|
|
85
|
+
color: STATUS_COLOR[tone],
|
|
86
|
+
size,
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Retained subagent transcripts should live in an adjacent
|
|
92
|
+
* `ThinkFullApp` workbench panel, not below the selector.
|
|
93
|
+
*/
|
|
94
|
+
function SubagentRunContent({ className, children, ref, ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
96
|
+
ref,
|
|
97
|
+
"data-slot": "subagent-run-content",
|
|
98
|
+
className: cx("subagent-run__content", className),
|
|
99
|
+
...props,
|
|
100
|
+
unstyled: true,
|
|
101
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
102
|
+
className: "subagent-run__content-inner",
|
|
103
|
+
children
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { SubagentRun, SubagentRunActions, SubagentRunContent, SubagentRunDescription, SubagentRunHeading, SubagentRunIndicator, SubagentRunList, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress, SubagentRunSelector, SubagentRunStatus, SubagentRunTitle, SubagentRunTrigger, getSubagentRunName, getSubagentRunTooltip };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/SubagentRunDetails.d.ts
|
|
4
|
+
interface SubagentRunProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Human-readable current action or phase. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Completion fraction from 0 to 1. Omit for indeterminate progress. */
|
|
8
|
+
value?: number;
|
|
9
|
+
}
|
|
10
|
+
declare function SubagentRunProgress({
|
|
11
|
+
className,
|
|
12
|
+
label,
|
|
13
|
+
value,
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}: SubagentRunProgressProps & {
|
|
17
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
interface SubagentRunActionsProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
20
|
+
declare function SubagentRunActions({
|
|
21
|
+
className,
|
|
22
|
+
ref,
|
|
23
|
+
...props
|
|
24
|
+
}: SubagentRunActionsProps & {
|
|
25
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
interface SubagentRunMilestonesProps extends React.OlHTMLAttributes<HTMLOListElement> {}
|
|
28
|
+
declare function SubagentRunMilestones({
|
|
29
|
+
className,
|
|
30
|
+
ref,
|
|
31
|
+
...props
|
|
32
|
+
}: SubagentRunMilestonesProps & {
|
|
33
|
+
ref?: React.Ref<HTMLOListElement>;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
interface SubagentRunMilestoneProps extends React.LiHTMLAttributes<HTMLLIElement> {}
|
|
36
|
+
declare function SubagentRunMilestone({
|
|
37
|
+
className,
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
}: SubagentRunMilestoneProps & {
|
|
41
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { SubagentRunActions, SubagentRunActionsProps, SubagentRunMilestone, SubagentRunMilestoneProps, SubagentRunMilestones, SubagentRunMilestonesProps, SubagentRunProgress, SubagentRunProgressProps };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { Progress } from "./Progress.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/SubagentRunDetails.tsx
|
|
6
|
+
function SubagentRunProgress({ className, label, value, ref, ...props }) {
|
|
7
|
+
const labelId = React.useId();
|
|
8
|
+
const percent = value === void 0 ? null : Math.round(Math.min(1, Math.max(0, value)) * 100);
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
ref,
|
|
11
|
+
className: cx("subagent-run__progress", className),
|
|
12
|
+
...props,
|
|
13
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
14
|
+
id: labelId,
|
|
15
|
+
className: "subagent-run__progress-label",
|
|
16
|
+
children: [/* @__PURE__ */ jsx("span", { children: label }), percent === null ? null : /* @__PURE__ */ jsxs("span", { children: [percent, "%"] })]
|
|
17
|
+
}), /* @__PURE__ */ jsx(Progress.Root, {
|
|
18
|
+
value: percent,
|
|
19
|
+
"aria-labelledby": labelId,
|
|
20
|
+
children: /* @__PURE__ */ jsx(Progress.Track, { children: /* @__PURE__ */ jsx(Progress.Indicator, {}) })
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function SubagentRunActions({ className, ref, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
ref,
|
|
27
|
+
className: cx("subagent-run__actions", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function SubagentRunMilestones({ className, ref, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
33
|
+
ref,
|
|
34
|
+
"data-slot": "subagent-run-milestones",
|
|
35
|
+
className: cx("subagent-run__milestones", className),
|
|
36
|
+
role: "list",
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function SubagentRunMilestone({ className, ref, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("li", {
|
|
42
|
+
ref,
|
|
43
|
+
className: cx("subagent-run__milestone", className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { SubagentRunActions, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AgentToolRunPart, AgentToolRunState } from "agents/agent-tools";
|
|
3
|
+
|
|
4
|
+
//#region src/components/SubagentRunIndicator.d.ts
|
|
5
|
+
declare function getSubagentRunName(run: AgentToolRunState): string;
|
|
6
|
+
/** Human-readable detail for a retained run selector's tooltip. */
|
|
7
|
+
declare function getSubagentRunTooltip(run: AgentToolRunState): React.ReactNode;
|
|
8
|
+
interface SubagentRunIndicatorProps<Part extends AgentToolRunPart = AgentToolRunPart> extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
9
|
+
/** Complete retained-run state returned by `useAgentToolEvents()`. */
|
|
10
|
+
run: AgentToolRunState<Part>;
|
|
11
|
+
}
|
|
12
|
+
/** Decorative status mark derived from a whole upstream retained-run record. */
|
|
13
|
+
declare function SubagentRunIndicator<Part extends AgentToolRunPart = AgentToolRunPart>({
|
|
14
|
+
className,
|
|
15
|
+
run,
|
|
16
|
+
ref,
|
|
17
|
+
...props
|
|
18
|
+
}: SubagentRunIndicatorProps<Part> & {
|
|
19
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SubagentRunIndicator, SubagentRunIndicatorProps, getSubagentRunName, getSubagentRunTooltip };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { B as SpinnerIcon, U as StopIcon, o as CheckIcon, q as WarningIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/SubagentRunIndicator.tsx
|
|
6
|
+
function getSubagentRunName(run) {
|
|
7
|
+
return run.display?.name ?? run.agentType;
|
|
8
|
+
}
|
|
9
|
+
/** Human-readable detail for a retained run selector's tooltip. */
|
|
10
|
+
function getSubagentRunTooltip(run) {
|
|
11
|
+
switch (run.status) {
|
|
12
|
+
case "running": return run.progress?.message ?? run.progress?.phase ?? "Running";
|
|
13
|
+
case "completed": return run.summary ?? "Completed";
|
|
14
|
+
case "error": return run.error ?? "Agent run failed";
|
|
15
|
+
case "aborted": return run.error ?? "Agent run stopped";
|
|
16
|
+
case "interrupted": return run.error ?? (run.childStillRunning ? "Interrupted · agent may still be running" : "Interrupted");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Decorative status mark derived from a whole upstream retained-run record. */
|
|
20
|
+
function SubagentRunIndicator({ className, run, ref, ...props }) {
|
|
21
|
+
const icon = run.status === "running" ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : run.status === "completed" ? /* @__PURE__ */ jsx(CheckIcon, {}) : run.status === "aborted" ? /* @__PURE__ */ jsx(StopIcon, {}) : /* @__PURE__ */ jsx(WarningIcon, {});
|
|
22
|
+
return /* @__PURE__ */ jsx("span", {
|
|
23
|
+
ref,
|
|
24
|
+
"data-slot": "subagent-run-indicator",
|
|
25
|
+
"data-status": run.status,
|
|
26
|
+
className: cx("subagent-run__indicator", className),
|
|
27
|
+
...props,
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
children: icon
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { SubagentRunIndicator, getSubagentRunName, getSubagentRunTooltip };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { UIMessage } from "ai";
|
|
3
|
+
import { AgentToolRunPart, AgentToolRunState } from "agents/agent-tools";
|
|
4
|
+
|
|
5
|
+
//#region src/components/SubagentRunList.d.ts
|
|
6
|
+
interface SubagentRunListProps<Part extends AgentToolRunPart = UIMessage["parts"][number]> extends Omit<React.HTMLAttributes<HTMLUListElement>, "children" | "onSelect"> {
|
|
7
|
+
/** Complete retained runs returned by `useAgentToolEvents()`, in display order. */
|
|
8
|
+
runs: readonly AgentToolRunState<Part>[];
|
|
9
|
+
selectedRunId?: string | null;
|
|
10
|
+
/** Called with the whole upstream run selected for the adjacent detail surface. */
|
|
11
|
+
onSelect?: (run: AgentToolRunState<Part>) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Semantic, wrapping list of retained-run selectors. */
|
|
14
|
+
declare function SubagentRunList<Part extends AgentToolRunPart = UIMessage["parts"][number]>({
|
|
15
|
+
className,
|
|
16
|
+
onSelect,
|
|
17
|
+
runs,
|
|
18
|
+
selectedRunId,
|
|
19
|
+
ref,
|
|
20
|
+
...props
|
|
21
|
+
}: SubagentRunListProps<Part> & {
|
|
22
|
+
ref?: React.Ref<HTMLUListElement>;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SubagentRunList, SubagentRunListProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { SubagentRunSelector } from "./SubagentRunSelector.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/SubagentRunList.tsx
|
|
6
|
+
/** Semantic, wrapping list of retained-run selectors. */
|
|
7
|
+
function SubagentRunList({ className, onSelect, runs, selectedRunId, ref, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
9
|
+
ref,
|
|
10
|
+
"data-slot": "subagent-run-list",
|
|
11
|
+
className: cx("subagent-run__list", className),
|
|
12
|
+
...props,
|
|
13
|
+
role: "list",
|
|
14
|
+
children: runs.map((run) => /* @__PURE__ */ jsx("li", {
|
|
15
|
+
className: "subagent-run__list-item",
|
|
16
|
+
children: /* @__PURE__ */ jsx(SubagentRunSelector, {
|
|
17
|
+
run,
|
|
18
|
+
naniteIndex: run.order,
|
|
19
|
+
selected: run.runId === selectedRunId,
|
|
20
|
+
onSelect
|
|
21
|
+
})
|
|
22
|
+
}, run.runId))
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SubagentRunList };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { r as ButtonProps } from "../Button-FX_hpqxm.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { UIMessage } from "ai";
|
|
4
|
+
import { AgentToolRunPart, AgentToolRunState } from "agents/agent-tools";
|
|
5
|
+
|
|
6
|
+
//#region src/components/SubagentRunSelector.d.ts
|
|
7
|
+
interface SubagentRunSelectorProps<Part extends AgentToolRunPart = UIMessage["parts"][number]> extends Omit<ButtonProps, "children" | "className" | "color" | "onSelect" | "size" | "variant"> {
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Complete retained-run state returned by `useAgentToolEvents()`. */
|
|
10
|
+
run?: AgentToolRunState<Part>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Pass `run` so the selector derives its content from the whole
|
|
13
|
+
* upstream object. Retained for the pre-0.15 presentation-only API.
|
|
14
|
+
*/
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
naniteIndex?: number;
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** Short supplementary status shown on hover and keyboard focus. `false` disables it. */
|
|
19
|
+
tooltip?: React.ReactNode | false;
|
|
20
|
+
/** Called with the whole upstream run when the selector is activated. */
|
|
21
|
+
onSelect?: (run: AgentToolRunState<Part>) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compact selector for a retained Cloudflare Agent Tool run.
|
|
25
|
+
*
|
|
26
|
+
* The component consumes `AgentToolRunState` whole and derives its label and
|
|
27
|
+
* status from upstream fields. Selecting it should route `run.subAgent` into
|
|
28
|
+
* an adjacent detail surface; it never invents a second transcript or expands
|
|
29
|
+
* child content inline.
|
|
30
|
+
*/
|
|
31
|
+
declare function SubagentRunSelector<Part extends AgentToolRunPart = UIMessage["parts"][number]>({
|
|
32
|
+
className,
|
|
33
|
+
children,
|
|
34
|
+
naniteIndex,
|
|
35
|
+
onClick,
|
|
36
|
+
onSelect,
|
|
37
|
+
run,
|
|
38
|
+
selected,
|
|
39
|
+
tooltip,
|
|
40
|
+
ref,
|
|
41
|
+
"aria-label": ariaLabel,
|
|
42
|
+
...props
|
|
43
|
+
}: SubagentRunSelectorProps<Part> & {
|
|
44
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
45
|
+
}): React.JSX.Element;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { SubagentRunSelector, SubagentRunSelectorProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { Button } from "./Button.js";
|
|
3
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
|
+
import { NaniteMark } from "./NaniteScene.js";
|
|
5
|
+
import { SubagentRunIndicator, getSubagentRunName, getSubagentRunTooltip } from "./SubagentRunIndicator.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/SubagentRunSelector.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Compact selector for a retained Cloudflare Agent Tool run.
|
|
11
|
+
*
|
|
12
|
+
* The component consumes `AgentToolRunState` whole and derives its label and
|
|
13
|
+
* status from upstream fields. Selecting it should route `run.subAgent` into
|
|
14
|
+
* an adjacent detail surface; it never invents a second transcript or expands
|
|
15
|
+
* child content inline.
|
|
16
|
+
*/
|
|
17
|
+
function SubagentRunSelector({ className, children, naniteIndex = 0, onClick, onSelect, run, selected = false, tooltip, ref, "aria-label": ariaLabel, ...props }) {
|
|
18
|
+
const name = run ? getSubagentRunName(run) : void 0;
|
|
19
|
+
const button = /* @__PURE__ */ jsxs(Button, {
|
|
20
|
+
ref,
|
|
21
|
+
type: "button",
|
|
22
|
+
variant: "outline",
|
|
23
|
+
color: "neutral",
|
|
24
|
+
size: "xs",
|
|
25
|
+
"data-slot": "subagent-run-selector",
|
|
26
|
+
"data-status": run?.status,
|
|
27
|
+
className: cx("subagent-run__selector", className),
|
|
28
|
+
"aria-pressed": selected,
|
|
29
|
+
"aria-label": ariaLabel ?? (run ? `Open ${name}, ${run.status}` : void 0),
|
|
30
|
+
onClick: (event) => {
|
|
31
|
+
onClick?.(event);
|
|
32
|
+
if (!event.defaultPrevented && run) onSelect?.(run);
|
|
33
|
+
},
|
|
34
|
+
...props,
|
|
35
|
+
children: [/* @__PURE__ */ jsx(NaniteMark, { index: naniteIndex }), run ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "subagent-run__title",
|
|
37
|
+
children: name
|
|
38
|
+
}), /* @__PURE__ */ jsx(SubagentRunIndicator, { run })] }) : /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "subagent-run__trigger-content",
|
|
40
|
+
children
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
const tooltipContent = tooltip === false ? null : tooltip ?? (run ? getSubagentRunTooltip(run) : null);
|
|
44
|
+
if (!tooltipContent) return button;
|
|
45
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
46
|
+
render: button,
|
|
47
|
+
delay: 0
|
|
48
|
+
}), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
49
|
+
side: "top",
|
|
50
|
+
sideOffset: 6,
|
|
51
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: tooltipContent })
|
|
52
|
+
}) })] });
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { SubagentRunSelector };
|
package/dist/components/Task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Collapsible } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import {
|
|
3
|
+
import { R as SearchIcon, l as ChevronRightIcon, v as FileIcon } from "../icons-CpfUer49.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Task.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { G as TerminalIcon, Y as XIcon } from "../icons-CpfUer49.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Tooltip } from "./Tooltip.js";
|
|
5
|
-
import { t as CopyButton } from "../copy-button-
|
|
5
|
+
import { t as CopyButton } from "../copy-button-Dejn5heL.js";
|
|
6
6
|
import { Badge } from "./Badge.js";
|
|
7
7
|
import { ScrollArea } from "./ScrollArea.js";
|
|
8
8
|
import * as React from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Collapsible } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import {
|
|
3
|
+
import { B as SpinnerIcon, Y as XIcon, l as ChevronRightIcon, o as CheckIcon } from "../icons-CpfUer49.js";
|
|
4
4
|
import { Badge } from "./Badge.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Textarea.d.ts
|
|
4
|
+
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
5
|
+
/** Allow the user to resize the control along the block axis. */
|
|
6
|
+
resize?: "none" | "vertical";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Multiline text control that shares the design system's field recipe.
|
|
10
|
+
* Compose it through `Field.Control` when labeling or validation is needed.
|
|
11
|
+
*/
|
|
12
|
+
declare function Textarea({
|
|
13
|
+
className,
|
|
14
|
+
ref,
|
|
15
|
+
resize,
|
|
16
|
+
...props
|
|
17
|
+
}: TextareaProps & {
|
|
18
|
+
ref?: React.Ref<HTMLTextAreaElement>;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Textarea, TextareaProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Textarea.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Multiline text control that shares the design system's field recipe.
|
|
7
|
+
* Compose it through `Field.Control` when labeling or validation is needed.
|
|
8
|
+
*/
|
|
9
|
+
function Textarea({ className, ref, resize = "vertical", ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
11
|
+
ref,
|
|
12
|
+
"data-slot": "textarea",
|
|
13
|
+
"data-resize": resize,
|
|
14
|
+
className: cx("textarea", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Textarea };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/components/ThemeModeControl.d.ts
|
|
2
|
+
interface ThemeModeControlProps {
|
|
3
|
+
/** Show text beside each icon. @default true */
|
|
4
|
+
showLabels?: boolean;
|
|
5
|
+
/** Accessible name for the radio group. @default "Theme" */
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
/** Name used by the radio group's hidden form input. @default "theme" */
|
|
8
|
+
name?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A compact, mutually exclusive Light/Dark/System control modeled after the
|
|
14
|
+
* Codex Appearance settings. Arrow keys move and select within the group.
|
|
15
|
+
*/
|
|
16
|
+
declare function ThemeModeControl({
|
|
17
|
+
showLabels,
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
name,
|
|
20
|
+
disabled,
|
|
21
|
+
className
|
|
22
|
+
}: ThemeModeControlProps): import("react").JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ThemeModeControl, ThemeModeControlProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { A as MoonIcon, W as SunIcon, k as MonitorIcon } from "../icons-CpfUer49.js";
|
|
2
|
+
import { Radio, RadioGroup } from "./RadioGroup.js";
|
|
3
|
+
import { useTheme } from "./ThemeProvider.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ThemeModeControl.tsx
|
|
6
|
+
const modes = [
|
|
7
|
+
{
|
|
8
|
+
value: "light",
|
|
9
|
+
label: "Light",
|
|
10
|
+
Icon: SunIcon
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "dark",
|
|
14
|
+
label: "Dark",
|
|
15
|
+
Icon: MoonIcon
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "system",
|
|
19
|
+
label: "System",
|
|
20
|
+
Icon: MonitorIcon
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* A compact, mutually exclusive Light/Dark/System control modeled after the
|
|
25
|
+
* Codex Appearance settings. Arrow keys move and select within the group.
|
|
26
|
+
*/
|
|
27
|
+
function ThemeModeControl({ showLabels = true, "aria-label": ariaLabel = "Theme", name = "theme", disabled = false, className = "" }) {
|
|
28
|
+
const { preference, setPreference } = useTheme();
|
|
29
|
+
const classes = [
|
|
30
|
+
"theme-mode-control",
|
|
31
|
+
!showLabels && "theme-mode-control--icons-only",
|
|
32
|
+
className
|
|
33
|
+
].filter(Boolean).join(" ");
|
|
34
|
+
return /* @__PURE__ */ jsx(RadioGroup.Root, {
|
|
35
|
+
value: preference,
|
|
36
|
+
onValueChange: (nextValue) => setPreference(nextValue),
|
|
37
|
+
name,
|
|
38
|
+
disabled,
|
|
39
|
+
orientation: "horizontal",
|
|
40
|
+
"aria-label": ariaLabel,
|
|
41
|
+
className: classes,
|
|
42
|
+
"data-slot": "theme-mode-control",
|
|
43
|
+
children: modes.map(({ value, label, Icon }) => /* @__PURE__ */ jsxs(Radio.Root, {
|
|
44
|
+
value,
|
|
45
|
+
"aria-label": showLabels ? void 0 : `Use ${label.toLowerCase()} theme`,
|
|
46
|
+
className: "theme-mode-control__item",
|
|
47
|
+
children: [/* @__PURE__ */ jsx(Icon, {}), showLabels ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
48
|
+
}, value))
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ThemeModeControl };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ResolvedTheme, ThemePreference } from "../utils/theme.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ThemeProvider.d.ts
|
|
5
|
+
interface ThemeProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Controlled theme preference. */
|
|
8
|
+
value?: ThemePreference;
|
|
9
|
+
/** Initial uncontrolled preference when no stored preference exists. @default "system" */
|
|
10
|
+
defaultValue?: ThemePreference;
|
|
11
|
+
/** Called when a descendant requests a preference change. */
|
|
12
|
+
onValueChange?: (preference: ThemePreference) => void;
|
|
13
|
+
/** localStorage key. Pass `null` when the application owns persistence. */
|
|
14
|
+
storageKey?: string | null;
|
|
15
|
+
}
|
|
16
|
+
interface ThemeContextValue {
|
|
17
|
+
preference: ThemePreference;
|
|
18
|
+
resolvedTheme: ResolvedTheme;
|
|
19
|
+
setPreference: (preference: ThemePreference) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Owns the application-wide theme preference and keeps document metadata,
|
|
23
|
+
* storage, cross-tab changes, and operating-system changes synchronized.
|
|
24
|
+
*
|
|
25
|
+
* Add `<meta name="color-scheme" content="light dark">` before styles and use
|
|
26
|
+
* `getThemeInitializationScript()` in the document head to avoid a flash when
|
|
27
|
+
* a saved override differs from the operating-system preference.
|
|
28
|
+
*/
|
|
29
|
+
declare function ThemeProvider({
|
|
30
|
+
children,
|
|
31
|
+
value,
|
|
32
|
+
defaultValue,
|
|
33
|
+
onValueChange,
|
|
34
|
+
storageKey
|
|
35
|
+
}: ThemeProviderProps): React.JSX.Element;
|
|
36
|
+
declare function useTheme(): ThemeContextValue;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ThemeContextValue, ThemeProvider, ThemeProviderProps, useTheme };
|