@mcp-b/react-components 0.11.0 → 0.13.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/{AgentChat-B9LD_WF1.d.ts → AgentChat-Br6tKEl8.d.ts} +38 -10
- package/dist/{BrowserLiveView-ZktFZiMD.d.ts → BrowserLiveView-BV5qgFgI.d.ts} +11 -10
- package/dist/{BrowserReplay-6G-mnwcn.d.ts → BrowserReplay-xWvRjRAC.d.ts} +2 -1
- package/dist/{Button-Ct5I6aTu.d.ts → Button-FX_hpqxm.d.ts} +8 -11
- package/dist/{CodeBlock-XNQOupQ3.js → CodeBlock-BUFXG8HW.js} +22 -12
- package/dist/{CodeBlock-CxQXv3C4.d.ts → CodeBlock-DUh9WOGo.d.ts} +13 -7
- package/dist/{Combobox-D9anamNr.d.ts → Combobox-B9Fcd6q-.d.ts} +4 -14
- package/dist/{FileTree-wMyZhhHO.js → FileTree-mpEIcfzA.js} +1 -1
- package/dist/{Menu-B5vDqZe_.d.ts → Menu-Bgu-ufb5.d.ts} +29 -65
- package/dist/{ModelSelector-DXtpcRmT.js → ModelSelector-DVgVBdvw.js} +23 -20
- package/dist/{PromptInput-D6-G24p7.d.ts → PromptInput-p5KmOmt1.d.ts} +313 -89
- package/dist/Select-Dl_vF_Bt.d.ts +213 -0
- package/dist/{Tabs-D9EAq09D.d.ts → Tabs-3Zc4tb9D.d.ts} +9 -6
- package/dist/ThinkChat-7DQ2CogF.js +222 -0
- package/dist/{ThinkChatActivity-B2UD95My.d.ts → ThinkChatActivity-Cuk28Js_.d.ts} +4 -4
- package/dist/ThinkChatContext-C3Eb1Xpi.d.ts +16 -0
- package/dist/{ThinkChatToolParts-DnUiZgCC.d.ts → ThinkChatToolParts-Cv4o7j6F.d.ts} +13 -5
- package/dist/{attachment-preview-ChtC3HiU.js → attachment-preview-DIs50Q0h.js} +3 -3
- package/dist/components/Accordion.d.ts +17 -6
- package/dist/components/Accordion.js +23 -36
- package/dist/components/Activity.d.ts +5 -5
- package/dist/components/Activity.js +9 -9
- package/dist/components/AgentChat.d.ts +1 -1
- package/dist/components/AgentChat.js +354 -132
- package/dist/components/AgentConnection.js +6 -22
- package/dist/components/AlertDialog.d.ts +40 -32
- package/dist/components/AlertDialog.js +46 -39
- package/dist/components/Artifact.d.ts +1 -1
- package/dist/components/Artifact.js +5 -5
- package/dist/components/Autocomplete.js +10 -2
- package/dist/components/Avatar.d.ts +2 -2
- package/dist/components/Avatar.js +3 -3
- package/dist/components/Badge.d.ts +11 -14
- package/dist/components/Badge.js +11 -33
- package/dist/components/BrowserLiveView.d.ts +1 -1
- package/dist/components/BrowserLiveView.js +39 -45
- package/dist/components/BrowserReplay.d.ts +1 -1
- package/dist/components/BrowserReplay.js +4 -4
- package/dist/components/BrowserRunPanel.js +91 -55
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +7 -30
- package/dist/components/ChainOfThought.d.ts +5 -5
- package/dist/components/ChainOfThought.js +8 -5
- package/dist/components/ChatGptSignInScreen.js +3 -3
- package/dist/components/Checkbox.d.ts +10 -2
- package/dist/components/Checkbox.js +13 -6
- package/dist/components/CheckboxGroup.d.ts +6 -6
- package/dist/components/CheckboxGroup.js +6 -6
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.d.ts +58 -0
- package/dist/components/CodexModelSelector.js +170 -0
- package/dist/components/Collapsible.d.ts +2 -4
- package/dist/components/Collapsible.js +9 -7
- package/dist/components/Combobox.d.ts +2 -2
- package/dist/components/Combobox.js +20 -22
- package/dist/components/Commit.d.ts +6 -6
- package/dist/components/Commit.js +14 -26
- package/dist/components/Context.js +5 -1
- package/dist/components/ContextMenu.d.ts +20 -72
- package/dist/components/ContextMenu.js +46 -56
- package/dist/components/Conversation.d.ts +3 -7
- package/dist/components/Conversation.js +3 -4
- package/dist/components/Dialog.d.ts +38 -30
- package/dist/components/Dialog.js +46 -34
- package/dist/components/EnvironmentVariables.d.ts +2 -7
- package/dist/components/EnvironmentVariables.js +13 -36
- package/dist/components/Field.d.ts +3 -3
- package/dist/components/Field.js +7 -8
- package/dist/components/Fieldset.d.ts +2 -2
- package/dist/components/Fieldset.js +2 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Label.d.ts +1 -1
- package/dist/components/Label.js +1 -1
- package/dist/components/Marker.js +1 -15
- package/dist/components/McpServerPicker.d.ts +31 -6
- package/dist/components/McpServerPicker.js +136 -72
- package/dist/components/Menu.d.ts +2 -2
- package/dist/components/Menu.js +41 -51
- package/dist/components/Menubar.d.ts +16 -52
- package/dist/components/Menubar.js +44 -56
- package/dist/components/Message.d.ts +4 -3
- package/dist/components/Message.js +16 -9
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/Meter.js +5 -0
- package/dist/components/ModelSelector.d.ts +12 -9
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.d.ts +3 -14
- package/dist/components/NavigationMenu.js +22 -38
- package/dist/components/NumberField.js +6 -0
- package/dist/components/Popover.d.ts +21 -44
- package/dist/components/Popover.js +33 -23
- package/dist/components/PreviewCard.d.ts +20 -18
- package/dist/components/PreviewCard.js +30 -20
- package/dist/components/PricingPage.js +30 -29
- package/dist/components/Progress.d.ts +7 -3
- package/dist/components/Progress.js +9 -4
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +184 -148
- package/dist/components/Queue.d.ts +8 -19
- package/dist/components/Queue.js +6 -6
- package/dist/components/RadioGroup.d.ts +10 -9
- package/dist/components/RadioGroup.js +8 -9
- package/dist/components/Reasoning.d.ts +4 -4
- package/dist/components/Reasoning.js +12 -21
- package/dist/components/ScrollArea.d.ts +2 -9
- package/dist/components/ScrollArea.js +5 -23
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +100 -134
- package/dist/components/Slider.d.ts +10 -7
- package/dist/components/Slider.js +12 -11
- package/dist/components/Sources.d.ts +4 -4
- package/dist/components/Sources.js +8 -5
- package/dist/components/Stepper.js +2 -8
- package/dist/components/Switch.d.ts +6 -3
- package/dist/components/Switch.js +7 -4
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +9 -4
- package/dist/components/Task.d.ts +4 -4
- package/dist/components/Task.js +10 -6
- package/dist/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.js +5 -5
- package/dist/components/TestResults.d.ts +4 -4
- package/dist/components/TestResults.js +5 -5
- package/dist/components/ThinkChat.d.ts +37 -30
- package/dist/components/ThinkChat.js +1 -152
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +4 -11
- package/dist/components/ThinkChatContext.d.ts +2 -2
- package/dist/components/ThinkChatContext.js +9 -2
- package/dist/components/ThinkChatToolPanels.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +27 -15
- package/dist/components/ThinkChatToolParts.d.ts +1 -1
- package/dist/components/ThinkExecutionWorkbench.d.ts +10 -7
- package/dist/components/ThinkExecutionWorkbench.js +382 -359
- package/dist/components/ThinkFullApp.d.ts +16 -13
- package/dist/components/ThinkFullApp.js +35 -25
- package/dist/components/ThinkThreadPicker.d.ts +1 -31
- package/dist/components/ThinkThreadPicker.js +32 -171
- package/dist/components/ThinkThreadShell.d.ts +35 -0
- package/dist/components/ThinkThreadShell.js +146 -0
- package/dist/components/Toast.js +7 -0
- package/dist/components/ToggleGroup.d.ts +6 -2
- package/dist/components/ToggleGroup.js +6 -2
- package/dist/components/Toolbar.js +6 -0
- package/dist/components/Tooltip.d.ts +36 -27
- package/dist/components/Tooltip.js +45 -29
- package/dist/components/WebPreview.d.ts +1 -1
- package/dist/components/WebPreview.js +3 -3
- package/dist/components/WorkspaceExplorer.d.ts +6 -8
- package/dist/components/WorkspaceExplorer.js +9 -7
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-C6JSKtFE.js → copy-button-DUMLYdsk.js} +7 -6
- package/dist/{copy-button-BKXqGiNm.d.ts → copy-button-DtPMgN7e.d.ts} +3 -2
- package/dist/icons-Ba9THQKz.js +64 -0
- package/dist/icons-CUCz_Sft.d.ts +210 -0
- package/dist/merge-refs-DF_7w2x_.js +18 -0
- package/dist/styles/accessibility.css +14 -0
- package/dist/styles/accordion.css +21 -61
- package/dist/styles/activity.css +23 -58
- package/dist/styles/agent-chat.css +49 -5
- package/dist/styles/agent-connection.css +8 -10
- package/dist/styles/alert-dialog.css +20 -26
- package/dist/styles/artifact.css +6 -6
- package/dist/styles/attachment-preview.css +1 -1
- package/dist/styles/autocomplete.css +5 -170
- package/dist/styles/avatar.css +8 -8
- package/dist/styles/badge.css +8 -10
- package/dist/styles/base-ui-motion.css +176 -0
- package/dist/styles/base.css +19 -25
- package/dist/styles/browser-live-view.css +7 -7
- package/dist/styles/browser-replay.css +5 -5
- package/dist/styles/browser-run-panel.css +59 -112
- package/dist/styles/button.css +48 -43
- package/dist/styles/card.css +3 -5
- package/dist/styles/chain-of-thought.css +14 -70
- package/dist/styles/chatgpt-sign-in-screen.css +3 -3
- package/dist/styles/checkbox-group.css +1 -1
- package/dist/styles/checkbox.css +3 -7
- package/dist/styles/code-block.css +10 -10
- package/dist/styles/codex-model-selector.css +186 -0
- package/dist/styles/collapsible.css +11 -27
- package/dist/styles/combobox.css +3 -149
- package/dist/styles/commit.css +19 -35
- package/dist/styles/context-menu.css +1 -77
- package/dist/styles/context.css +12 -12
- package/dist/styles/conversation.css +7 -7
- package/dist/styles/dialog.css +34 -55
- package/dist/styles/environment-variables.css +10 -10
- package/dist/styles/field.css +16 -58
- package/dist/styles/fieldset.css +2 -2
- package/dist/styles/file-tree.css +7 -9
- package/dist/styles/index.css +12 -2
- package/dist/styles/input.css +1 -51
- package/dist/styles/label.css +2 -2
- package/dist/styles/marker.css +2 -4
- package/dist/styles/mcp-server-picker.css +66 -19
- package/dist/styles/menu.css +6 -153
- package/dist/styles/menubar.css +6 -105
- package/dist/styles/message-scroller.css +1 -1
- package/dist/styles/message.css +87 -9
- package/dist/styles/meter.css +4 -20
- package/dist/styles/model-selector.css +32 -20
- package/dist/styles/navigation-menu.css +14 -54
- package/dist/styles/number-field.css +8 -23
- package/dist/styles/popover.css +13 -68
- package/dist/styles/preview-card.css +5 -46
- package/dist/styles/pricing-page.css +43 -43
- package/dist/styles/progress.css +7 -16
- package/dist/styles/prompt-input.css +100 -44
- package/dist/styles/queue.css +12 -28
- package/dist/styles/radio.css +4 -8
- package/dist/styles/reasoning.css +3 -62
- package/dist/styles/recipes.css +475 -0
- package/dist/styles/select.css +7 -103
- package/dist/styles/shell.css +3 -3
- package/dist/styles/slider.css +5 -7
- package/dist/styles/sources.css +9 -66
- package/dist/styles/stepper.css +16 -14
- package/dist/styles/streamdown.css +11 -57
- package/dist/styles/switch.css +4 -7
- package/dist/styles/tabs.css +7 -8
- package/dist/styles/task.css +13 -42
- package/dist/styles/terminal.css +7 -7
- package/dist/styles/test-results.css +21 -37
- package/dist/styles/think-execution-workbench.css +337 -0
- package/dist/styles/think-full-app.css +27 -410
- package/dist/styles/think-resize-handle.css +33 -0
- package/dist/styles/think-thread-picker.css +18 -247
- package/dist/styles/think-thread-shell.css +219 -0
- package/dist/styles/toast.css +14 -25
- package/dist/styles/toggle-group.css +16 -14
- package/dist/styles/toggle.css +14 -15
- package/dist/styles/toolbar.css +13 -25
- package/dist/styles/tooltip.css +6 -16
- package/dist/styles/web-preview.css +15 -15
- package/dist/styles/workspace-explorer.css +21 -14
- package/dist/summarize-tool-input-BUJsENSn.js +12 -0
- package/dist/utils/codex-model-catalog.d.ts +142 -0
- package/dist/utils/codex-model-catalog.js +112 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/package.json +8 -2
- package/dist/Select-CRsKCJ9x.d.ts +0 -200
- package/dist/ThinkChatContext-BLAAb8J5.d.ts +0 -28
- package/dist/components/McpServerConnections.d.ts +0 -41
- package/dist/components/McpServerConnections.js +0 -188
- package/dist/components/useStickToBottom.d.ts +0 -33
- package/dist/components/useStickToBottom.js +0 -107
- package/dist/icons-CbjtbIJK.d.ts +0 -51
- package/dist/icons-D2Q5n5C1.js +0 -291
- package/dist/styles/mcp-server-connections.css +0 -145
|
@@ -77,8 +77,8 @@ declare function FieldsetLegend({
|
|
|
77
77
|
* <Fieldset.Root>
|
|
78
78
|
* <Fieldset.Legend>Notification Preferences</Fieldset.Legend>
|
|
79
79
|
* <CheckboxGroup>
|
|
80
|
-
* <label><Checkbox name="email"
|
|
81
|
-
* <label><Checkbox name="sms"
|
|
80
|
+
* <label><Checkbox.Root name="email" ><Checkbox.Indicator /></Checkbox.Root> Email</label>
|
|
81
|
+
* <label><Checkbox.Root name="sms" ><Checkbox.Indicator /></Checkbox.Root> SMS</label>
|
|
82
82
|
* </CheckboxGroup>
|
|
83
83
|
* </Fieldset.Root>
|
|
84
84
|
* ```
|
|
@@ -65,8 +65,8 @@ function FieldsetLegend({ className = "", ref, ...props }) {
|
|
|
65
65
|
* <Fieldset.Root>
|
|
66
66
|
* <Fieldset.Legend>Notification Preferences</Fieldset.Legend>
|
|
67
67
|
* <CheckboxGroup>
|
|
68
|
-
* <label><Checkbox name="email"
|
|
69
|
-
* <label><Checkbox name="sms"
|
|
68
|
+
* <label><Checkbox.Root name="email" ><Checkbox.Indicator /></Checkbox.Root> Email</label>
|
|
69
|
+
* <label><Checkbox.Root name="sms" ><Checkbox.Indicator /></Checkbox.Root> SMS</label>
|
|
70
70
|
* </CheckboxGroup>
|
|
71
71
|
* </Fieldset.Root>
|
|
72
72
|
* ```
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as FileTreeIcon, i as FileTreeFolder, n as FileTreeActions, o as FileTreeName, r as FileTreeFile, t as FileTree } from "../FileTree-
|
|
1
|
+
import { a as FileTreeIcon, i as FileTreeFolder, n as FileTreeActions, o as FileTreeName, r as FileTreeFile, t as FileTree } from "../FileTree-mpEIcfzA.js";
|
|
2
2
|
export { FileTree, FileTreeActions, FileTreeFile, FileTreeFolder, FileTreeIcon, FileTreeName };
|
|
@@ -26,7 +26,7 @@ interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
|
26
26
|
* <Input id="username" type="text" />
|
|
27
27
|
*
|
|
28
28
|
* <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
29
|
-
* <Checkbox id="newsletter"
|
|
29
|
+
* <Checkbox.Root id="newsletter" ><Checkbox.Indicator /></Checkbox.Root>
|
|
30
30
|
* <Label htmlFor="newsletter">Subscribe to newsletter</Label>
|
|
31
31
|
* </div>
|
|
32
32
|
* ```
|
package/dist/components/Label.js
CHANGED
|
@@ -18,7 +18,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
18
18
|
* <Input id="username" type="text" />
|
|
19
19
|
*
|
|
20
20
|
* <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
21
|
-
* <Checkbox id="newsletter"
|
|
21
|
+
* <Checkbox.Root id="newsletter" ><Checkbox.Indicator /></Checkbox.Root>
|
|
22
22
|
* <Label htmlFor="newsletter">Subscribe to newsletter</Label>
|
|
23
23
|
* </div>
|
|
24
24
|
* ```
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { n as mergeRefs } from "../merge-refs-DF_7w2x_.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/Marker.tsx
|
|
5
6
|
function markerVariants({ variant = "default", className } = {}) {
|
|
6
7
|
return cx("marker", `marker--${variant ?? "default"}`, className);
|
|
7
8
|
}
|
|
8
|
-
function assignRef(ref, value) {
|
|
9
|
-
if (!ref) return;
|
|
10
|
-
if (typeof ref === "function") {
|
|
11
|
-
ref(value);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
ref.current = value;
|
|
15
|
-
}
|
|
16
|
-
function mergeRefs(...refs) {
|
|
17
|
-
const activeRefs = refs.filter(Boolean);
|
|
18
|
-
if (activeRefs.length === 0) return void 0;
|
|
19
|
-
return (value) => {
|
|
20
|
-
for (const activeRef of activeRefs) assignRef(activeRef, value);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
9
|
function isEventHandler(propName, value) {
|
|
24
10
|
return /^on[A-Z]/.test(propName) && typeof value === "function";
|
|
25
11
|
}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { McpServerCard } from "../utils/mcp-server-catalog.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { MCPServer, MCPServersState } from "agents";
|
|
3
4
|
|
|
4
5
|
//#region src/components/McpServerPicker.d.ts
|
|
5
6
|
interface McpServerPickerProps {
|
|
6
7
|
/** MCP servers to show in the plus-menu picker. */
|
|
7
8
|
servers: readonly McpServerCard[];
|
|
8
9
|
/** Called when the user chooses a server; hosts own OAuth and connection state. */
|
|
9
|
-
onConnect
|
|
10
|
+
onConnect?: (server: McpServerCard) => void | Promise<void>;
|
|
11
|
+
/** Upstream Agents SDK MCP state from `getMcpServers()` or `useAgent({ onMcpUpdate })`. */
|
|
12
|
+
mcp?: MCPServersState;
|
|
13
|
+
/** Called when an OAuth server needs user authorization. */
|
|
14
|
+
onAuthorize?: McpServerConnectionAction;
|
|
15
|
+
/** Called when a failed server should retry through an app-owned Agent RPC. */
|
|
16
|
+
onRetry?: McpServerConnectionAction;
|
|
17
|
+
/** Called when a ready/connected server should refresh discovery through an app-owned Agent RPC. */
|
|
18
|
+
onRefresh?: McpServerConnectionAction;
|
|
19
|
+
/** Called when a server transport should close but the stored config should remain. */
|
|
20
|
+
onDisconnect?: McpServerConnectionAction;
|
|
10
21
|
/** Offset from the plus trigger to the menu, useful for prompt composers. */
|
|
11
22
|
sideOffset?: number;
|
|
23
|
+
/** Accessible name for the plus trigger. */
|
|
24
|
+
triggerLabel?: string;
|
|
12
25
|
}
|
|
13
|
-
type
|
|
26
|
+
type McpServerConnectionAction = (serverId: string, server: MCPServer) => void | Promise<void>;
|
|
27
|
+
type McpServerPickerItemsProps = Omit<McpServerPickerProps, "sideOffset" | "triggerLabel">;
|
|
14
28
|
/**
|
|
15
29
|
* Prompt plus-menu picker for choosing an MCP server and handing connection
|
|
16
30
|
* work back to the host app.
|
|
@@ -18,11 +32,22 @@ type McpServerPickerItemsProps = Pick<McpServerPickerProps, "servers" | "onConne
|
|
|
18
32
|
declare function McpServerPicker({
|
|
19
33
|
servers,
|
|
20
34
|
onConnect,
|
|
21
|
-
|
|
35
|
+
mcp,
|
|
36
|
+
onAuthorize,
|
|
37
|
+
onDisconnect,
|
|
38
|
+
onRefresh,
|
|
39
|
+
onRetry,
|
|
40
|
+
sideOffset,
|
|
41
|
+
triggerLabel
|
|
22
42
|
}: McpServerPickerProps): React.JSX.Element;
|
|
23
43
|
declare function McpServerPickerItems({
|
|
24
44
|
servers,
|
|
25
|
-
onConnect
|
|
26
|
-
|
|
45
|
+
onConnect,
|
|
46
|
+
mcp,
|
|
47
|
+
onAuthorize,
|
|
48
|
+
onDisconnect,
|
|
49
|
+
onRefresh,
|
|
50
|
+
onRetry
|
|
51
|
+
}: McpServerPickerItemsProps): React.JSX.Element;
|
|
27
52
|
//#endregion
|
|
28
|
-
export { McpServerPicker, McpServerPickerItems, McpServerPickerItemsProps, McpServerPickerProps };
|
|
53
|
+
export { McpServerConnectionAction, McpServerPicker, McpServerPickerItems, McpServerPickerItemsProps, McpServerPickerProps };
|
|
@@ -1,74 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { A as RefreshIcon, C as MinusIcon, L as WarningIcon, N as SpinnerIcon, a as CheckIcon, b as LinkIcon } from "../icons-Ba9THQKz.js";
|
|
2
|
+
import { Menu } from "./Menu.js";
|
|
3
|
+
import { PromptInputActionMenuTrigger } from "./PromptInput.js";
|
|
4
4
|
import { getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/McpServerPicker.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Prompt plus-menu picker for choosing an MCP server and handing connection
|
|
10
10
|
* work back to the host app.
|
|
11
11
|
*/
|
|
12
|
-
function McpServerPicker({ servers, onConnect, sideOffset = 80 }) {
|
|
12
|
+
function McpServerPicker({ servers, onConnect, mcp, onAuthorize, onDisconnect, onRefresh, onRetry, sideOffset = 80, triggerLabel = "Add server" }) {
|
|
13
13
|
return /* @__PURE__ */ jsx("div", {
|
|
14
14
|
className: "mcp-server-picker",
|
|
15
|
-
children: /* @__PURE__ */ jsxs(
|
|
16
|
-
type: "button",
|
|
17
|
-
variant: "ghost",
|
|
18
|
-
color: "neutral",
|
|
19
|
-
size: "icon-xs",
|
|
15
|
+
children: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(PromptInputActionMenuTrigger, {
|
|
20
16
|
className: "mcp-server-picker__trigger",
|
|
21
|
-
"aria-label":
|
|
22
|
-
|
|
23
|
-
}) }), /* @__PURE__ */ jsx(MenuContent, {
|
|
17
|
+
"aria-label": triggerLabel
|
|
18
|
+
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
24
19
|
side: "top",
|
|
25
20
|
align: "start",
|
|
26
21
|
sideOffset,
|
|
27
22
|
collisionPadding: 8,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
24
|
+
tabIndex: 0,
|
|
25
|
+
"aria-label": "Servers",
|
|
26
|
+
className: "mcp-server-picker__popup",
|
|
27
|
+
children: /* @__PURE__ */ jsx(McpServerPickerItems, {
|
|
28
|
+
servers,
|
|
29
|
+
onConnect,
|
|
30
|
+
mcp,
|
|
31
|
+
onAuthorize,
|
|
32
|
+
onDisconnect,
|
|
33
|
+
onRefresh,
|
|
34
|
+
onRetry
|
|
35
|
+
})
|
|
33
36
|
})
|
|
34
|
-
})] })
|
|
37
|
+
}) })] })
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
|
-
function McpServerPickerItems({ servers, onConnect }) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
function McpServerPickerItems({ servers, onConnect, mcp, onAuthorize, onDisconnect, onRefresh, onRetry }) {
|
|
41
|
+
const [pendingAction, setPendingAction] = React.useState(null);
|
|
42
|
+
const rows = getPickerRows(servers, mcp);
|
|
43
|
+
async function runAction(action, serverId, server, handler) {
|
|
44
|
+
if (!handler) return;
|
|
45
|
+
setPendingAction(`${action}:${serverId}`);
|
|
46
|
+
try {
|
|
47
|
+
await handler(serverId, server);
|
|
48
|
+
} finally {
|
|
49
|
+
setPendingAction(null);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (rows.length === 0) return /* @__PURE__ */ jsx(Menu.Item, {
|
|
41
53
|
disabled: true,
|
|
42
54
|
className: "mcp-server-picker__empty",
|
|
43
55
|
children: "No servers available."
|
|
44
56
|
});
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
return /* @__PURE__ */ jsx(Fragment, { children: rows.map((server) => /* @__PURE__ */ jsx(McpServerPickerRow, {
|
|
58
|
+
mcp,
|
|
59
|
+
pendingAction,
|
|
60
|
+
server,
|
|
61
|
+
onAuthorize: (id, entry) => void runAction("authorize", id, entry, onAuthorize),
|
|
62
|
+
onConnect,
|
|
63
|
+
onDisconnect: (id, entry) => void runAction("disconnect", id, entry, onDisconnect),
|
|
64
|
+
onRefresh: (id, entry) => void runAction("refresh", id, entry, onRefresh),
|
|
65
|
+
onRetry: (id, entry) => void runAction("retry", id, entry, onRetry)
|
|
66
|
+
}, server.id)) });
|
|
52
67
|
}
|
|
53
|
-
function McpServerPickerRow({ server, onConnect }) {
|
|
68
|
+
function McpServerPickerRow({ server, mcp, onConnect, onAuthorize, onDisconnect, onRefresh, onRetry, pendingAction }) {
|
|
54
69
|
const descriptionId = React.useId();
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
const connected = getConnectedServerEntry(server, mcp);
|
|
71
|
+
const connectedServerId = connected?.[0];
|
|
72
|
+
const connectedServer = connected?.[1];
|
|
73
|
+
const derivedStatus = server.status ?? connectedServer?.state;
|
|
74
|
+
const statusText = server.statusLabel ?? getStatusLabel(derivedStatus);
|
|
75
|
+
const connectedState = derivedStatus === "ready" || derivedStatus === "connected";
|
|
76
|
+
const busy = derivedStatus === "connecting" || derivedStatus === "authenticating" || derivedStatus === "discovering";
|
|
77
|
+
const disabled = !onConnect || busy || Boolean(connectedServer) || derivedStatus === "ready" || derivedStatus === "connected";
|
|
78
|
+
const pending = (action) => Boolean(connectedServerId && pendingAction === `${action}:${connectedServerId}`);
|
|
79
|
+
const hasStatusIcon = connectedState || busy || derivedStatus === "failed" || derivedStatus === "needs-auth";
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "mcp-server-picker__row-shell",
|
|
82
|
+
"data-connection": connectedState ? "connected" : "disconnected",
|
|
83
|
+
"data-status": derivedStatus,
|
|
84
|
+
children: [/* @__PURE__ */ jsxs(Menu.Item, {
|
|
85
|
+
className: "mcp-server-picker__row",
|
|
86
|
+
closeOnClick: false,
|
|
87
|
+
"data-status": derivedStatus,
|
|
88
|
+
disabled,
|
|
89
|
+
"aria-busy": busy || void 0,
|
|
90
|
+
"aria-describedby": server.description ? descriptionId : void 0,
|
|
91
|
+
onClick: disabled ? void 0 : () => void onConnect(server),
|
|
92
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
68
93
|
className: "mcp-server-picker__icon",
|
|
69
94
|
children: renderIcon(server)
|
|
70
|
-
}),
|
|
71
|
-
/* @__PURE__ */ jsxs("span", {
|
|
95
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
72
96
|
className: "mcp-server-picker__copy",
|
|
73
97
|
children: [/* @__PURE__ */ jsx("span", {
|
|
74
98
|
className: "mcp-server-picker__name",
|
|
@@ -78,16 +102,56 @@ function McpServerPickerRow({ server, onConnect }) {
|
|
|
78
102
|
className: "mcp-server-picker__description",
|
|
79
103
|
children: server.description
|
|
80
104
|
}) : null]
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className: "mcp-server-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
})]
|
|
106
|
+
}), hasStatusIcon || connectedServer ? /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: "mcp-server-picker__row-actions",
|
|
108
|
+
children: [
|
|
109
|
+
hasStatusIcon ? /* @__PURE__ */ jsxs("span", {
|
|
110
|
+
className: "mcp-server-picker__row-status",
|
|
111
|
+
title: statusText,
|
|
112
|
+
children: [/* @__PURE__ */ jsx(StatusIcon, { status: derivedStatus }), /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "mcp-server-picker__status-label",
|
|
114
|
+
children: statusText
|
|
115
|
+
})]
|
|
116
|
+
}) : null,
|
|
117
|
+
connectedServer?.state === "authenticating" && connectedServerId && onAuthorize ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
118
|
+
disabled: pending("authorize"),
|
|
119
|
+
icon: /* @__PURE__ */ jsx(LinkIcon, {}),
|
|
120
|
+
label: pending("authorize") ? `Opening ${server.name}` : `Authorize ${server.name}`,
|
|
121
|
+
onClick: () => onAuthorize(connectedServerId, connectedServer)
|
|
122
|
+
}) : null,
|
|
123
|
+
connectedServer?.state === "failed" && connectedServerId && onRetry ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
124
|
+
disabled: pending("retry"),
|
|
125
|
+
icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
126
|
+
label: pending("retry") ? `Retrying ${server.name}` : `Retry ${server.name}`,
|
|
127
|
+
onClick: () => onRetry(connectedServerId, connectedServer)
|
|
128
|
+
}) : null,
|
|
129
|
+
(connectedServer?.state === "ready" || connectedServer?.state === "connected") && connectedServerId && onRefresh ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
130
|
+
disabled: pending("refresh"),
|
|
131
|
+
icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
132
|
+
label: pending("refresh") ? `Reconnecting ${server.name}` : `Reconnect ${server.name}`,
|
|
133
|
+
onClick: () => onRefresh(connectedServerId, connectedServer)
|
|
134
|
+
}) : null,
|
|
135
|
+
(connectedServer?.state === "ready" || connectedServer?.state === "connected") && connectedServerId && onDisconnect ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
136
|
+
disabled: pending("disconnect"),
|
|
137
|
+
icon: /* @__PURE__ */ jsx(MinusIcon, {}),
|
|
138
|
+
label: pending("disconnect") ? `Disconnecting ${server.name}` : `Disconnect ${server.name}`,
|
|
139
|
+
onClick: () => onDisconnect(connectedServerId, connectedServer)
|
|
140
|
+
}) : null
|
|
141
|
+
]
|
|
142
|
+
}) : null]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function McpServerActionItem({ disabled, icon, label, onClick }) {
|
|
146
|
+
return /* @__PURE__ */ jsxs(Menu.Item, {
|
|
147
|
+
className: "mcp-server-picker__action",
|
|
148
|
+
closeOnClick: false,
|
|
149
|
+
disabled,
|
|
150
|
+
onClick: disabled ? void 0 : () => void onClick(),
|
|
151
|
+
children: [icon, /* @__PURE__ */ jsx("span", {
|
|
152
|
+
className: "mcp-server-picker__status-label",
|
|
153
|
+
children: label
|
|
154
|
+
})]
|
|
91
155
|
});
|
|
92
156
|
}
|
|
93
157
|
function StatusIcon({ status }) {
|
|
@@ -109,6 +173,19 @@ function getStatusLabel(status) {
|
|
|
109
173
|
if (status === "discovering") return "Discovering";
|
|
110
174
|
return "";
|
|
111
175
|
}
|
|
176
|
+
function getConnectedServerEntry(card, mcp) {
|
|
177
|
+
if (!mcp) return void 0;
|
|
178
|
+
return Object.entries(mcp.servers).find(([serverId, entry]) => serverId === card.id || entry.server_url === card.url);
|
|
179
|
+
}
|
|
180
|
+
function getPickerRows(servers, mcp) {
|
|
181
|
+
if (!mcp) return [...servers];
|
|
182
|
+
const upstreamRows = Object.entries(mcp.servers).filter(([serverId, entry]) => !servers.some((server) => server.id === serverId || server.url === entry.server_url)).map(([serverId, entry]) => ({
|
|
183
|
+
id: serverId,
|
|
184
|
+
name: entry.name,
|
|
185
|
+
url: entry.server_url
|
|
186
|
+
}));
|
|
187
|
+
return [...servers, ...upstreamRows];
|
|
188
|
+
}
|
|
112
189
|
function renderIcon(server) {
|
|
113
190
|
const src = getMcpServerIconSrc(server);
|
|
114
191
|
if (src) return /* @__PURE__ */ jsx(IconImage, {
|
|
@@ -122,6 +199,9 @@ function renderIcon(server) {
|
|
|
122
199
|
}
|
|
123
200
|
function IconImage({ src, name }) {
|
|
124
201
|
const [failed, setFailed] = React.useState(false);
|
|
202
|
+
React.useEffect(() => {
|
|
203
|
+
setFailed(false);
|
|
204
|
+
}, [src]);
|
|
125
205
|
if (failed) return /* @__PURE__ */ jsx("span", {
|
|
126
206
|
className: "mcp-server-picker__fallback-icon",
|
|
127
207
|
children: name.slice(0, 1)
|
|
@@ -137,21 +217,5 @@ function IconImage({ src, name }) {
|
|
|
137
217
|
onError: () => setFailed(true)
|
|
138
218
|
});
|
|
139
219
|
}
|
|
140
|
-
function groupServers(servers) {
|
|
141
|
-
const groups = [];
|
|
142
|
-
for (const server of servers) {
|
|
143
|
-
const category = server.category ?? "";
|
|
144
|
-
let group = groups.find((candidate) => candidate.category === category);
|
|
145
|
-
if (!group) {
|
|
146
|
-
group = {
|
|
147
|
-
category,
|
|
148
|
-
servers: []
|
|
149
|
-
};
|
|
150
|
-
groups.push(group);
|
|
151
|
-
}
|
|
152
|
-
group.servers.push(server);
|
|
153
|
-
}
|
|
154
|
-
return groups;
|
|
155
|
-
}
|
|
156
220
|
//#endregion
|
|
157
221
|
export { McpServerPicker, McpServerPickerItems };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { Menu,
|
|
1
|
+
import { _ as MenuSubmenuRootProps, a as MenuGroupLabelProps, b as MenuViewportProps, c as MenuPopupProps, d as MenuProps, f as MenuRadioGroupProps, g as MenuShortcutProps, h as MenuSeparatorProps, i as MenuCheckboxItemProps, l as MenuPortalProps, m as MenuRadioItemProps, n as MenuArrowProps, o as MenuGroupProps, p as MenuRadioItemIndicatorProps, r as MenuCheckboxItemIndicatorProps, s as MenuItemProps, t as Menu, u as MenuPositionerProps, v as MenuSubmenuTriggerProps, y as MenuTriggerProps } from "../Menu-Bgu-ufb5.js";
|
|
2
|
+
export { Menu, MenuArrowProps, MenuCheckboxItemIndicatorProps, MenuCheckboxItemProps, MenuGroupLabelProps, MenuGroupProps, MenuItemProps, MenuPopupProps, MenuPortalProps, MenuPositionerProps, MenuProps, MenuRadioGroupProps, MenuRadioItemIndicatorProps, MenuRadioItemProps, MenuSeparatorProps, MenuShortcutProps, MenuSubmenuRootProps, MenuSubmenuTriggerProps, MenuTriggerProps, MenuViewportProps };
|
package/dist/components/Menu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
4
4
|
//#region src/components/Menu.tsx
|
|
5
5
|
/**
|
|
@@ -31,11 +31,12 @@ const MenuRoot = (props) => {
|
|
|
31
31
|
/**
|
|
32
32
|
* Button that toggles the menu visibility.
|
|
33
33
|
*/
|
|
34
|
-
function MenuTrigger({ className = "", ref, ...props }) {
|
|
35
|
-
const classes = ["menu__trigger", className].filter(Boolean).join(" ");
|
|
34
|
+
function MenuTrigger({ className = "", unstyled = false, ref, ...props }) {
|
|
35
|
+
const classes = [!unstyled && "menu__trigger", className].filter(Boolean).join(" ");
|
|
36
36
|
return /* @__PURE__ */ jsx(Menu$1.Trigger, {
|
|
37
37
|
ref,
|
|
38
38
|
"data-slot": "dropdown-menu-trigger",
|
|
39
|
+
"data-unstyled": unstyled || void 0,
|
|
39
40
|
className: classes,
|
|
40
41
|
...props
|
|
41
42
|
});
|
|
@@ -53,7 +54,11 @@ const MenuPortal = (props) => {
|
|
|
53
54
|
* Positions the menu popup relative to the trigger.
|
|
54
55
|
*/
|
|
55
56
|
function MenuPositioner({ className = "", ref, ...props }) {
|
|
56
|
-
const classes = [
|
|
57
|
+
const classes = [
|
|
58
|
+
"menu__positioner",
|
|
59
|
+
"base-ui-positioner",
|
|
60
|
+
className
|
|
61
|
+
].filter(Boolean).join(" ");
|
|
57
62
|
return /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
58
63
|
ref,
|
|
59
64
|
"data-slot": "dropdown-menu-positioner",
|
|
@@ -65,7 +70,11 @@ function MenuPositioner({ className = "", ref, ...props }) {
|
|
|
65
70
|
* Container for menu items.
|
|
66
71
|
*/
|
|
67
72
|
function MenuPopup({ className = "", ref, ...props }) {
|
|
68
|
-
const classes = [
|
|
73
|
+
const classes = [
|
|
74
|
+
"menu__popup",
|
|
75
|
+
"base-ui-popup",
|
|
76
|
+
className
|
|
77
|
+
].filter(Boolean).join(" ");
|
|
69
78
|
return /* @__PURE__ */ jsx(Menu$1.Popup, {
|
|
70
79
|
ref,
|
|
71
80
|
"data-slot": "dropdown-menu-content",
|
|
@@ -73,22 +82,19 @@ function MenuPopup({ className = "", ref, ...props }) {
|
|
|
73
82
|
...props
|
|
74
83
|
});
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
collisionAvoidance,
|
|
90
|
-
children: /* @__PURE__ */ jsx(MenuPopup, { ...props })
|
|
91
|
-
}) });
|
|
85
|
+
/**
|
|
86
|
+
* Transition container for content that changes as a menu moves between
|
|
87
|
+
* triggers. Pair the adaptive classes from `base-ui-motion.css` with the
|
|
88
|
+
* positioner, popup, and this viewport when that behavior is needed.
|
|
89
|
+
*/
|
|
90
|
+
function MenuViewport({ className = "", ref, ...props }) {
|
|
91
|
+
const classes = ["menu__viewport", className].filter(Boolean).join(" ");
|
|
92
|
+
return /* @__PURE__ */ jsx(Menu$1.Viewport, {
|
|
93
|
+
ref,
|
|
94
|
+
"data-slot": "dropdown-menu-viewport",
|
|
95
|
+
className: classes,
|
|
96
|
+
...props
|
|
97
|
+
});
|
|
92
98
|
}
|
|
93
99
|
/**
|
|
94
100
|
* Interactive menu item.
|
|
@@ -137,7 +143,6 @@ function MenuGroupLabel({ className = "", inset, ref, ...props }) {
|
|
|
137
143
|
...props
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
|
-
const MenuLabel = MenuGroupLabel;
|
|
141
146
|
/**
|
|
142
147
|
* Arrow pointing to the trigger.
|
|
143
148
|
*/
|
|
@@ -177,14 +182,13 @@ function MenuRadioGroup({ className = "", ref, ...props }) {
|
|
|
177
182
|
/**
|
|
178
183
|
* Radio item for exclusive selection.
|
|
179
184
|
*/
|
|
180
|
-
function MenuRadioItem({ className = "",
|
|
185
|
+
function MenuRadioItem({ className = "", ref, ...props }) {
|
|
181
186
|
const classes = ["menu__radio-item", className].filter(Boolean).join(" ");
|
|
182
187
|
return /* @__PURE__ */ jsx(Menu$1.RadioItem, {
|
|
183
188
|
ref,
|
|
184
189
|
"data-slot": "dropdown-menu-radio-item",
|
|
185
190
|
className: classes,
|
|
186
|
-
...props
|
|
187
|
-
children: hasChildOfType(children, MenuRadioItemIndicator) ? children : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuRadioItemIndicator, {}), children] })
|
|
191
|
+
...props
|
|
188
192
|
});
|
|
189
193
|
}
|
|
190
194
|
/**
|
|
@@ -202,14 +206,13 @@ function MenuRadioItemIndicator({ className = "", ref, ...props }) {
|
|
|
202
206
|
/**
|
|
203
207
|
* Checkbox item for toggling options.
|
|
204
208
|
*/
|
|
205
|
-
function MenuCheckboxItem({ className = "",
|
|
209
|
+
function MenuCheckboxItem({ className = "", ref, ...props }) {
|
|
206
210
|
const classes = ["menu__checkbox-item", className].filter(Boolean).join(" ");
|
|
207
211
|
return /* @__PURE__ */ jsx(Menu$1.CheckboxItem, {
|
|
208
212
|
ref,
|
|
209
213
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
210
214
|
className: classes,
|
|
211
|
-
...props
|
|
212
|
-
children: hasChildOfType(children, MenuCheckboxItemIndicator) ? children : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuCheckboxItemIndicator, {}), children] })
|
|
215
|
+
...props
|
|
213
216
|
});
|
|
214
217
|
}
|
|
215
218
|
/**
|
|
@@ -232,21 +235,12 @@ function MenuShortcut({ className = "", ref, ...props }) {
|
|
|
232
235
|
...props
|
|
233
236
|
});
|
|
234
237
|
}
|
|
235
|
-
function
|
|
238
|
+
function MenuSubmenuRoot(props) {
|
|
236
239
|
return /* @__PURE__ */ jsx(Menu$1.SubmenuRoot, {
|
|
237
240
|
"data-slot": "dropdown-menu-sub",
|
|
238
241
|
...props
|
|
239
242
|
});
|
|
240
243
|
}
|
|
241
|
-
function MenuSubContent({ side = "right", align, sideOffset = 4, ...props }) {
|
|
242
|
-
return /* @__PURE__ */ jsx(MenuContent, {
|
|
243
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
244
|
-
side,
|
|
245
|
-
align,
|
|
246
|
-
sideOffset,
|
|
247
|
-
...props
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
244
|
/**
|
|
251
245
|
* Trigger that opens a submenu.
|
|
252
246
|
*/
|
|
@@ -264,10 +258,6 @@ function MenuSubmenuTrigger({ className = "", inset, ref, ...props }) {
|
|
|
264
258
|
...props
|
|
265
259
|
});
|
|
266
260
|
}
|
|
267
|
-
const MenuSubTrigger = MenuSubmenuTrigger;
|
|
268
|
-
function hasChildOfType(children, type) {
|
|
269
|
-
return React.Children.toArray(children).some((child) => React.isValidElement(child) && child.type === type);
|
|
270
|
-
}
|
|
271
261
|
/**
|
|
272
262
|
* A dropdown menu with keyboard navigation support.
|
|
273
263
|
* Provides items, groups, checkboxes, radio selections, and nested submenus.
|
|
@@ -310,17 +300,19 @@ function hasChildOfType(children, type) {
|
|
|
310
300
|
*
|
|
311
301
|
* @see {@link https://base-ui.com/react/components/menu | Base UI Menu}
|
|
312
302
|
*/
|
|
313
|
-
const Menu =
|
|
303
|
+
const Menu = {
|
|
304
|
+
createHandle: Menu$1.createHandle,
|
|
314
305
|
Root: MenuRoot,
|
|
315
306
|
Trigger: MenuTrigger,
|
|
316
307
|
Portal: MenuPortal,
|
|
317
308
|
Positioner: MenuPositioner,
|
|
318
309
|
Popup: MenuPopup,
|
|
319
|
-
|
|
310
|
+
Viewport: MenuViewport,
|
|
311
|
+
Backdrop: Menu$1.Backdrop,
|
|
320
312
|
Item: MenuItem,
|
|
321
313
|
Group: MenuGroup,
|
|
322
314
|
GroupLabel: MenuGroupLabel,
|
|
323
|
-
|
|
315
|
+
LinkItem: Menu$1.LinkItem,
|
|
324
316
|
Arrow: MenuArrow,
|
|
325
317
|
Separator: MenuSeparator,
|
|
326
318
|
RadioGroup: MenuRadioGroup,
|
|
@@ -329,10 +321,8 @@ const Menu = Object.assign(MenuRoot, {
|
|
|
329
321
|
CheckboxItem: MenuCheckboxItem,
|
|
330
322
|
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
331
323
|
Shortcut: MenuShortcut,
|
|
332
|
-
|
|
333
|
-
SubContent: MenuSubContent,
|
|
334
|
-
SubTrigger: MenuSubTrigger,
|
|
324
|
+
SubmenuRoot: MenuSubmenuRoot,
|
|
335
325
|
SubmenuTrigger: MenuSubmenuTrigger
|
|
336
|
-
}
|
|
326
|
+
};
|
|
337
327
|
//#endregion
|
|
338
|
-
export { Menu
|
|
328
|
+
export { Menu };
|