@mcp-b/react-components 0.46.4 → 0.46.6
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/{Workspace-jdVZ9S0a.d.ts → Workspace-DZusrEeP.d.ts} +5 -6
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkSidepanel.d.ts +8 -14
- package/dist/components/agents-sdk/Workspace.d.ts +1 -1
- package/dist/components/agents-sdk/Workspace.js +2 -6
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +1 -1
- package/dist/components/extension/CodexModelSelector.d.ts +2 -2
- package/dist/components/extension/CodexModelSelector.js +1 -1
- package/dist/components/extension/ConversationTabPicker.d.ts +5 -5
- package/dist/components/extension/ConversationTabPicker.js +4 -4
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +7 -7
- package/dist/components/general-purpose/SettingsFormDialog.js +3 -2
- package/package.json +2 -2
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { a as WorkspaceMediaInfo, i as WorkspaceFileState, r as WorkspaceFileAssetResolver, t as WorkspaceFileAsset } from "./WorkspaceFile-Dq-GC0_T.js";
|
|
2
2
|
import { DataTag, QueryKey, UnusedSkipTokenOptions } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
4
|
-
import { FileInfo, Workspace } from "@cloudflare/shell";
|
|
3
|
+
import { FileInfo, Workspace, WorkspaceFsLike } from "@cloudflare/shell";
|
|
5
4
|
|
|
6
5
|
//#region src/components/agents-sdk/Workspace.d.ts
|
|
7
6
|
/** Workspace summary, as returned by `Workspace.getWorkspaceInfo()` upstream. */
|
|
8
7
|
type WorkspaceInfo = Awaited<ReturnType<Workspace["getWorkspaceInfo"]>>;
|
|
9
|
-
/**
|
|
10
|
-
type WorkspaceSource = Workspace
|
|
8
|
+
/** Upstream's proxy-safe filesystem contract plus its workspace summary. */
|
|
9
|
+
type WorkspaceSource = WorkspaceFsLike & Pick<Workspace, "getWorkspaceInfo">;
|
|
11
10
|
interface UseWorkspaceOptions {
|
|
12
11
|
/** Must be referentially stable (memoize in the app). */
|
|
13
12
|
source: WorkspaceSource;
|
|
@@ -54,7 +53,7 @@ interface WorkspaceState {
|
|
|
54
53
|
loadingPaths: ReadonlySet<string>;
|
|
55
54
|
/** Root/directory listing failure. Per-file read errors live on the file state. */
|
|
56
55
|
error: string | null;
|
|
57
|
-
/** Workspace summary
|
|
56
|
+
/** Workspace summary. */
|
|
58
57
|
info: WorkspaceInfo | null;
|
|
59
58
|
/** Reload the root, every expanded directory, and the selected file. */
|
|
60
59
|
refresh: () => void;
|
|
@@ -99,7 +98,7 @@ declare function workspaceFileVersion(target: WorkspaceFileReadTarget): {
|
|
|
99
98
|
type WorkspaceFileVersion = ReturnType<typeof workspaceFileVersion>;
|
|
100
99
|
type WorkspaceDirectoryQueryOptions = WorkspaceQueryOptions<readonly FileInfo[], WorkspaceDirectoryQueryKey>;
|
|
101
100
|
type WorkspaceInfoQueryKey = readonly [...WorkspaceQueryKey, "info"];
|
|
102
|
-
type WorkspaceInfoQueryOptions = WorkspaceQueryOptions<WorkspaceInfo
|
|
101
|
+
type WorkspaceInfoQueryOptions = WorkspaceQueryOptions<WorkspaceInfo, WorkspaceInfoQueryKey>;
|
|
103
102
|
type WorkspaceFileStatQueryKey = readonly [...WorkspaceFileQueryKey, "stat"];
|
|
104
103
|
type WorkspaceFileStatQueryOptions = WorkspaceQueryOptions<WorkspaceFileReadTarget, WorkspaceFileStatQueryKey>;
|
|
105
104
|
type WorkspaceFileAssetQueryKey = readonly [...WorkspaceFileQueryKey, "asset", WorkspaceFileVersion];
|
|
@@ -5,7 +5,7 @@ import { n as McpPluginCatalogProps } from "../../McpPluginCatalog-3qWu8oK1.js";
|
|
|
5
5
|
import { ThinkChatMessagesProps } from "./ThinkChat.js";
|
|
6
6
|
import { ThinkThreadStatusSummary } from "./ThinkThreadPicker.js";
|
|
7
7
|
import { r as WorkspaceFileAssetResolver } from "../../WorkspaceFile-Dq-GC0_T.js";
|
|
8
|
-
import { v as WorkspaceSource } from "../../Workspace-
|
|
8
|
+
import { v as WorkspaceSource } from "../../Workspace-DZusrEeP.js";
|
|
9
9
|
import { t as ThinkAgent } from "../../think-agent-Cip5KAPj.js";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { UIMessage } from "ai";
|
|
@@ -2,7 +2,7 @@ import { ThinkRoutine } from "./ThinkRoutine.js";
|
|
|
2
2
|
import { ThinkChatDraft } from "./ThinkChat.js";
|
|
3
3
|
import { ThinkThreadItem } from "./ThinkThreadPicker.js";
|
|
4
4
|
import { ThinkFullAppAgent, ThinkFullAppConversation, ThinkFullAppProps } from "./ThinkFullApp.js";
|
|
5
|
-
import {
|
|
5
|
+
import { SetupChecklistGroupProps } from "../general-purpose/SetupChecklist.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { UIMessage } from "ai";
|
|
8
8
|
import { AgentToolRunState } from "agents/agent-tools";
|
|
@@ -59,7 +59,7 @@ interface ThinkSidepanelConnection {
|
|
|
59
59
|
description?: string;
|
|
60
60
|
onSelect: () => void;
|
|
61
61
|
}
|
|
62
|
-
interface ThinkSidepanelStart {
|
|
62
|
+
interface ThinkSidepanelStart<Id extends string = string> {
|
|
63
63
|
onSubmit: ThinkChatDraft["onSubmit"];
|
|
64
64
|
suggestions?: readonly {
|
|
65
65
|
label: string;
|
|
@@ -72,10 +72,7 @@ interface ThinkSidepanelStart {
|
|
|
72
72
|
discord?: ThinkSidepanelConnection;
|
|
73
73
|
onAttachFolder?: () => void;
|
|
74
74
|
attachFolderBusy?: boolean;
|
|
75
|
-
personalization?:
|
|
76
|
-
entries: readonly SetupChecklistEntry[];
|
|
77
|
-
onSelect: (id: string) => void;
|
|
78
|
-
};
|
|
75
|
+
personalization?: Pick<SetupChecklistGroupProps<Id>, "entries" | "onSelect">;
|
|
79
76
|
}
|
|
80
77
|
interface ThinkSidepanelSchedules<TRoutine extends ThinkRoutine = ThinkRoutine> {
|
|
81
78
|
routines: readonly TRoutine[];
|
|
@@ -118,13 +115,10 @@ interface ThinkSidepanelIdentity {
|
|
|
118
115
|
onBind?: () => void | Promise<void>;
|
|
119
116
|
onUnbind?: () => void | Promise<void>;
|
|
120
117
|
}
|
|
121
|
-
interface ThinkSidepanelProps<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage, TRoutine extends ThinkRoutine = ThinkRoutine> extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
118
|
+
interface ThinkSidepanelProps<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage, TRoutine extends ThinkRoutine = ThinkRoutine, SetupId extends string = string> extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
122
119
|
sourceKey: string;
|
|
123
120
|
view: ThinkSidepanelView;
|
|
124
|
-
thread?:
|
|
125
|
-
id: string;
|
|
126
|
-
title: string;
|
|
127
|
-
};
|
|
121
|
+
thread?: ThinkThreadItem;
|
|
128
122
|
threads?: readonly ThinkThreadItem[];
|
|
129
123
|
conversation?: ThinkFullAppConversation<AgentT, State, MessageT>;
|
|
130
124
|
workspace?: ThinkFullAppProps<AgentT, State, MessageT>["workspace"];
|
|
@@ -147,7 +141,7 @@ interface ThinkSidepanelProps<AgentT extends ThinkFullAppAgent<State>, State = u
|
|
|
147
141
|
status?: ThinkSidepanelStatus;
|
|
148
142
|
connectingLabel?: string;
|
|
149
143
|
modelSetup?: ThinkSidepanelModelSetup;
|
|
150
|
-
start?: ThinkSidepanelStart
|
|
144
|
+
start?: ThinkSidepanelStart<SetupId>;
|
|
151
145
|
schedules?: ThinkSidepanelSchedules<TRoutine>;
|
|
152
146
|
agentRun?: ThinkSidepanelAgentRun;
|
|
153
147
|
/** Host-owned live view. The side panel only frames it. */
|
|
@@ -158,7 +152,7 @@ interface ThinkSidepanelProps<AgentT extends ThinkFullAppAgent<State>, State = u
|
|
|
158
152
|
* conversation plus workbench. Hosts hydrate conversation, workspace,
|
|
159
153
|
* plugins, and callables. Storybook is the place to iterate the chrome.
|
|
160
154
|
*/
|
|
161
|
-
declare function ThinkSidepanel<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage, TRoutine extends ThinkRoutine = ThinkRoutine>({
|
|
155
|
+
declare function ThinkSidepanel<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage, TRoutine extends ThinkRoutine = ThinkRoutine, SetupId extends string = string>({
|
|
162
156
|
agentRun,
|
|
163
157
|
appBarLeading,
|
|
164
158
|
brand,
|
|
@@ -186,6 +180,6 @@ declare function ThinkSidepanel<AgentT extends ThinkFullAppAgent<State>, State =
|
|
|
186
180
|
view,
|
|
187
181
|
workspace,
|
|
188
182
|
...props
|
|
189
|
-
}: ThinkSidepanelProps<AgentT, State, MessageT, TRoutine>): React.JSX.Element;
|
|
183
|
+
}: ThinkSidepanelProps<AgentT, State, MessageT, TRoutine, SetupId>): React.JSX.Element;
|
|
190
184
|
//#endregion
|
|
191
185
|
export { ThinkSidepanel, ThinkSidepanelAgentRun, ThinkSidepanelCompanion, ThinkSidepanelConnection, ThinkSidepanelDestination, ThinkSidepanelFollow, ThinkSidepanelIdentity, ThinkSidepanelModelSetup, ThinkSidepanelPasskeyVault, ThinkSidepanelProps, ThinkSidepanelSchedules, ThinkSidepanelStart, ThinkSidepanelStatus, ThinkSidepanelView };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as workspaceQueryKey, C as workspaceBinaryFileQueryOptions, D as workspaceFileAssetQueryOptions, E as workspaceDirectoryQueryPrefix, O as workspaceFileStatQueryOptions, S as useWorkspace, T as workspaceDirectoryQueryOptions, _ as WorkspaceResolvedAsset, a as WorkspaceDirectoryQueryOptions, b as WorkspaceTextFileQueryKey, c as WorkspaceFileQueryKey, d as WorkspaceFileStatQueryOptions, f as WorkspaceFileVersion, g as WorkspaceQueryKey, h as WorkspaceInfoQueryOptions, i as WorkspaceDirectoryQueryKey, j as workspaceTextFileQueryOptions, k as workspaceInfoQueryOptions, l as WorkspaceFileReadTarget, m as WorkspaceInfoQueryKey, n as WorkspaceBinaryFileQueryKey, o as WorkspaceFileAssetQueryKey, p as WorkspaceInfo, r as WorkspaceBinaryFileQueryOptions, s as WorkspaceFileAssetQueryOptions, t as UseWorkspaceOptions, u as WorkspaceFileStatQueryKey, v as WorkspaceSource, w as workspaceDirectoryQueryKey, x as WorkspaceTextFileQueryOptions, y as WorkspaceState } from "../../Workspace-
|
|
1
|
+
import { A as workspaceQueryKey, C as workspaceBinaryFileQueryOptions, D as workspaceFileAssetQueryOptions, E as workspaceDirectoryQueryPrefix, O as workspaceFileStatQueryOptions, S as useWorkspace, T as workspaceDirectoryQueryOptions, _ as WorkspaceResolvedAsset, a as WorkspaceDirectoryQueryOptions, b as WorkspaceTextFileQueryKey, c as WorkspaceFileQueryKey, d as WorkspaceFileStatQueryOptions, f as WorkspaceFileVersion, g as WorkspaceQueryKey, h as WorkspaceInfoQueryOptions, i as WorkspaceDirectoryQueryKey, j as workspaceTextFileQueryOptions, k as workspaceInfoQueryOptions, l as WorkspaceFileReadTarget, m as WorkspaceInfoQueryKey, n as WorkspaceBinaryFileQueryKey, o as WorkspaceFileAssetQueryKey, p as WorkspaceInfo, r as WorkspaceBinaryFileQueryOptions, s as WorkspaceFileAssetQueryOptions, t as UseWorkspaceOptions, u as WorkspaceFileStatQueryKey, v as WorkspaceSource, w as workspaceDirectoryQueryKey, x as WorkspaceTextFileQueryOptions, y as WorkspaceState } from "../../Workspace-DZusrEeP.js";
|
|
2
2
|
export { UseWorkspaceOptions, WorkspaceBinaryFileQueryKey, WorkspaceBinaryFileQueryOptions, WorkspaceDirectoryQueryKey, WorkspaceDirectoryQueryOptions, WorkspaceFileAssetQueryKey, WorkspaceFileAssetQueryOptions, WorkspaceFileQueryKey, WorkspaceFileReadTarget, WorkspaceFileStatQueryKey, WorkspaceFileStatQueryOptions, WorkspaceFileVersion, WorkspaceInfo, WorkspaceInfoQueryKey, WorkspaceInfoQueryOptions, WorkspaceQueryKey, WorkspaceResolvedAsset, WorkspaceSource, WorkspaceState, WorkspaceTextFileQueryKey, WorkspaceTextFileQueryOptions, useWorkspace, workspaceBinaryFileQueryOptions, workspaceDirectoryQueryKey, workspaceDirectoryQueryOptions, workspaceDirectoryQueryPrefix, workspaceFileAssetQueryOptions, workspaceFileStatQueryOptions, workspaceInfoQueryOptions, workspaceQueryKey, workspaceTextFileQueryOptions };
|
|
@@ -121,7 +121,6 @@ function workspaceInfoQueryOptions(source, sourceKey, root) {
|
|
|
121
121
|
return queryOptions({
|
|
122
122
|
queryKey: [...workspaceQueryKey(sourceKey, root), "info"],
|
|
123
123
|
queryFn: async ({ signal }) => {
|
|
124
|
-
if (!("getWorkspaceInfo" in source) || typeof source.getWorkspaceInfo !== "function") return null;
|
|
125
124
|
const info = await source.getWorkspaceInfo();
|
|
126
125
|
throwIfAborted(signal);
|
|
127
126
|
return info;
|
|
@@ -269,10 +268,7 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
269
268
|
const normalizedMaxInlineAssetBytes = Number.isFinite(maxInlineAssetBytes) && maxInlineAssetBytes >= 0 ? maxInlineAssetBytes : DEFAULT_MAX_INLINE_ASSET_BYTES;
|
|
270
269
|
const directoryPaths = React.useMemo(() => [.../* @__PURE__ */ new Set([root, ...expandedPaths])].sort(), [expandedPaths, root]);
|
|
271
270
|
const directoryQueries = useQueries({ queries: directoryPaths.map((path) => workspaceDirectoryQueryOptions(source, sourceKey, root, path)) });
|
|
272
|
-
const infoQuery = useQuery(
|
|
273
|
-
...workspaceInfoQueryOptions(source, sourceKey, root),
|
|
274
|
-
enabled: "getWorkspaceInfo" in source && typeof source.getWorkspaceInfo === "function"
|
|
275
|
-
});
|
|
271
|
+
const infoQuery = useQuery(workspaceInfoQueryOptions(source, sourceKey, root));
|
|
276
272
|
const statQuery = useQuery({
|
|
277
273
|
...workspaceFileStatQueryOptions(source, sourceKey, root, selectedPath ?? root),
|
|
278
274
|
enabled: selectedPath !== null
|
|
@@ -406,7 +402,7 @@ function useWorkspace({ source, sourceKey, root = "/", selectedPath, onSelectedP
|
|
|
406
402
|
return false;
|
|
407
403
|
}
|
|
408
404
|
}));
|
|
409
|
-
|
|
405
|
+
await queryClient.fetchQuery({
|
|
410
406
|
...workspaceInfoQueryOptions(source, sourceKey, root),
|
|
411
407
|
staleTime: 0
|
|
412
408
|
}).catch(() => void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as WorkspaceNavigationAdapter } from "../../WorkspaceLink-Bh9-Jo1r.js";
|
|
2
|
-
import { y as WorkspaceState } from "../../Workspace-
|
|
2
|
+
import { y as WorkspaceState } from "../../Workspace-DZusrEeP.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/agents-sdk/WorkspaceExplorer.d.ts
|
|
@@ -11,8 +11,8 @@ interface CodexModelSelectorProps<ModelT extends CodexModel = CodexModel> {
|
|
|
11
11
|
readonly models: readonly ModelT[];
|
|
12
12
|
/** Current Codex catalog id. Use the selected entry's `model` field for inference. */
|
|
13
13
|
readonly selectedModelId?: ModelId<ModelT> | null;
|
|
14
|
-
/** Called only with an
|
|
15
|
-
readonly onSelectModel: (
|
|
14
|
+
/** Called only with an entry from the supplied Codex catalog. */
|
|
15
|
+
readonly onSelectModel: (model: ModelT) => void;
|
|
16
16
|
/** Current reasoning effort advertised by the selected model. */
|
|
17
17
|
readonly selectedEffortId?: ReasoningEffort<ModelT> | null;
|
|
18
18
|
readonly onSelectEffort?: (effortId: ReasoningEffort<ModelT>) => void;
|
|
@@ -28,7 +28,7 @@ function CodexModelSelector({ models, selectedModelId = null, onSelectModel, sel
|
|
|
28
28
|
function handleSelectModel(modelId) {
|
|
29
29
|
const model = visibleModels.find((option) => option.id === modelId);
|
|
30
30
|
if (!model) return;
|
|
31
|
-
onSelectModel(model
|
|
31
|
+
onSelectModel(model);
|
|
32
32
|
}
|
|
33
33
|
function handleSelectEffort(effortId) {
|
|
34
34
|
const effort = effortOptions.find((option) => option.reasoningEffort === effortId);
|
|
@@ -8,11 +8,11 @@ interface ConversationTabPickerItem {
|
|
|
8
8
|
url?: string;
|
|
9
9
|
iconSrc?: string;
|
|
10
10
|
}
|
|
11
|
-
interface ConversationTabPickerProps {
|
|
11
|
+
interface ConversationTabPickerProps<Tab extends ConversationTabPickerItem = ConversationTabPickerItem> {
|
|
12
12
|
/** Browser-enriched tabs already scoped to the current conversation. */
|
|
13
|
-
tabs: readonly
|
|
13
|
+
tabs: readonly Tab[];
|
|
14
14
|
/** Host-owned activation, such as Chrome tab/window focus. */
|
|
15
|
-
onSelect: (
|
|
15
|
+
onSelect: (tab: Tab) => void | Promise<void>;
|
|
16
16
|
/** Maximum avatars shown in the collapsed trigger. */
|
|
17
17
|
maxVisible?: number;
|
|
18
18
|
groupLabel?: React.ReactNode;
|
|
@@ -23,9 +23,9 @@ interface ConversationTabPickerProps {
|
|
|
23
23
|
* The browser adapter owns tab lookup and activation. This component owns URL
|
|
24
24
|
* labels, favicon fallbacks, menu state, and async activation feedback.
|
|
25
25
|
*/
|
|
26
|
-
declare function ConversationTabPicker({
|
|
26
|
+
declare function ConversationTabPicker<Tab extends ConversationTabPickerItem>({
|
|
27
27
|
tabs,
|
|
28
28
|
...props
|
|
29
|
-
}: ConversationTabPickerProps): React.JSX.Element | null;
|
|
29
|
+
}: ConversationTabPickerProps<Tab>): React.JSX.Element | null;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { ConversationTabId, ConversationTabPicker, ConversationTabPickerItem, ConversationTabPickerProps };
|
|
@@ -54,11 +54,11 @@ function ConversationTabPickerMenu({ tabs, onSelect, maxVisible = 3, groupLabel
|
|
|
54
54
|
const pending = action && "pending" in action ? action.pending : null;
|
|
55
55
|
const error = action && "error" in action ? action.error : null;
|
|
56
56
|
const label = `${tabs.length} controlled ${tabs.length === 1 ? "tab" : "tabs"}`;
|
|
57
|
-
async function selectTab(
|
|
57
|
+
async function selectTab(tab) {
|
|
58
58
|
if (pending !== null) return;
|
|
59
|
-
setAction({ pending: id });
|
|
59
|
+
setAction({ pending: tab.id });
|
|
60
60
|
try {
|
|
61
|
-
await onSelect(
|
|
61
|
+
await onSelect(tab);
|
|
62
62
|
setAction(null);
|
|
63
63
|
setOpen(false);
|
|
64
64
|
} catch (cause) {
|
|
@@ -98,7 +98,7 @@ function ConversationTabPickerMenu({ tabs, onSelect, maxVisible = 3, groupLabel
|
|
|
98
98
|
closeOnClick: false,
|
|
99
99
|
"data-tab-id": tab.id,
|
|
100
100
|
disabled: pending !== null,
|
|
101
|
-
onClick: () => void selectTab(tab
|
|
101
|
+
onClick: () => void selectTab(tab),
|
|
102
102
|
children: [/* @__PURE__ */ jsx(TabAvatar, { tab }), /* @__PURE__ */ jsxs("span", {
|
|
103
103
|
className: "conversation-tab-picker__identity sigvelo-truncate-grow",
|
|
104
104
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -17,32 +17,32 @@ interface SettingsFormField {
|
|
|
17
17
|
required?: boolean;
|
|
18
18
|
readOnly?: boolean;
|
|
19
19
|
}
|
|
20
|
-
type SettingsFormValues = Readonly<Record<
|
|
21
|
-
interface SettingsFormDialogProps {
|
|
20
|
+
type SettingsFormValues<Fields extends readonly SettingsFormField[]> = Readonly<Record<Fields[number]["name"], string>>;
|
|
21
|
+
interface SettingsFormDialogProps<Fields extends readonly SettingsFormField[]> {
|
|
22
22
|
open: boolean;
|
|
23
23
|
onOpenChange: (open: boolean) => void;
|
|
24
24
|
title: React.ReactNode;
|
|
25
25
|
description: React.ReactNode;
|
|
26
|
-
fields:
|
|
27
|
-
initialValues?: Readonly<Record<
|
|
26
|
+
fields: Fields;
|
|
27
|
+
initialValues?: Readonly<Partial<Record<Fields[number]["name"], string | undefined>>>;
|
|
28
28
|
submitLabel: string;
|
|
29
29
|
submittingLabel?: string;
|
|
30
30
|
removeLabel?: string;
|
|
31
31
|
removingLabel?: string;
|
|
32
32
|
externalError?: string;
|
|
33
|
-
onSubmit: (values: SettingsFormValues) => void | Promise<void>;
|
|
33
|
+
onSubmit: (values: SettingsFormValues<Fields>) => void | Promise<void>;
|
|
34
34
|
onRemove?: () => void | Promise<void>;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Uncontrolled, metadata-driven settings dialog with native validation and
|
|
38
38
|
* shared async submit/remove feedback. Product schemas remain in the host.
|
|
39
39
|
*/
|
|
40
|
-
declare function SettingsFormDialog({
|
|
40
|
+
declare function SettingsFormDialog<const Fields extends readonly SettingsFormField[]>({
|
|
41
41
|
open,
|
|
42
42
|
onOpenChange,
|
|
43
43
|
title,
|
|
44
44
|
description,
|
|
45
45
|
...contentProps
|
|
46
|
-
}: SettingsFormDialogProps): React.JSX.Element;
|
|
46
|
+
}: SettingsFormDialogProps<Fields>): React.JSX.Element;
|
|
47
47
|
//#endregion
|
|
48
48
|
export { SETTINGS_FORM_CHECKED, SettingsFormDialog, SettingsFormDialogProps, SettingsFormField, SettingsFormFieldType, SettingsFormValues };
|
|
@@ -24,6 +24,7 @@ function SettingsFormDialogContent({ fields, initialValues, submitLabel, submitt
|
|
|
24
24
|
const active = React.useRef(true);
|
|
25
25
|
const pending = submission === "submit" || submission === "remove";
|
|
26
26
|
const error = submission && typeof submission === "object" ? submission.error : null;
|
|
27
|
+
const initialValueByName = initialValues ?? {};
|
|
27
28
|
React.useEffect(() => {
|
|
28
29
|
active.current = true;
|
|
29
30
|
return () => {
|
|
@@ -62,7 +63,7 @@ function SettingsFormDialogContent({ fields, initialValues, submitLabel, submitt
|
|
|
62
63
|
name: field.name,
|
|
63
64
|
orientation: "horizontal",
|
|
64
65
|
children: [/* @__PURE__ */ jsx(Checkbox.Root, {
|
|
65
|
-
defaultChecked:
|
|
66
|
+
defaultChecked: initialValueByName[field.name] === SETTINGS_FORM_CHECKED,
|
|
66
67
|
disabled: field.readOnly,
|
|
67
68
|
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {})
|
|
68
69
|
}), /* @__PURE__ */ jsxs(Field.Content, { children: [/* @__PURE__ */ jsx(Field.Label, { children: field.label }), field.description ? /* @__PURE__ */ jsx(Field.Description, { children: field.description }) : null] })]
|
|
@@ -72,7 +73,7 @@ function SettingsFormDialogContent({ fields, initialValues, submitLabel, submitt
|
|
|
72
73
|
/* @__PURE__ */ jsx(Field.Label, { children: field.label }),
|
|
73
74
|
/* @__PURE__ */ jsx(Field.Control, {
|
|
74
75
|
autoComplete: field.autoComplete,
|
|
75
|
-
defaultValue:
|
|
76
|
+
defaultValue: initialValueByName[field.name],
|
|
76
77
|
placeholder: field.placeholder,
|
|
77
78
|
readOnly: field.readOnly,
|
|
78
79
|
required: field.required,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/react-components",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.6",
|
|
4
4
|
"description": "MCP-B React components built on Base UI and shared design tokens, including Cloudflare Think chat primitives.",
|
|
5
5
|
"homepage": "https://design-system.sigvelo.com",
|
|
6
6
|
"bugs": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"streamdown": "^2.5.0",
|
|
55
55
|
"unist-util-visit": "^5.1.0",
|
|
56
56
|
"yet-another-react-lightbox": "^3.32.2",
|
|
57
|
-
"@mcp-b/design-tokens": "0.46.
|
|
57
|
+
"@mcp-b/design-tokens": "0.46.6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@ai-sdk/react": "^3.0.249",
|