@mcp-b/react-components 0.6.4 → 0.7.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/PromptInput-D6-G24p7.d.ts +528 -0
- package/dist/ThinkChatToolParts-DnUiZgCC.d.ts +83 -0
- package/dist/components/AgentChat.d.ts +11 -14
- package/dist/components/AgentChat.js +76 -57
- package/dist/components/AgentConnection.js +21 -18
- package/dist/components/Context.d.ts +6 -10
- package/dist/components/Context.js +4 -2
- package/dist/components/Conversation.d.ts +28 -28
- package/dist/components/Conversation.js +35 -54
- package/dist/components/Marker.d.ts +57 -0
- package/dist/components/Marker.js +89 -0
- package/dist/components/McpServerPicker.js +8 -10
- package/dist/components/MessageScroller.d.ts +52 -0
- package/dist/components/MessageScroller.js +62 -0
- package/dist/components/PromptInput.d.ts +2 -534
- package/dist/components/PromptInput.js +17 -11
- package/dist/components/ThinkChat.d.ts +10 -77
- package/dist/components/ThinkChat.js +59 -856
- package/dist/components/ThinkChatActivity.d.ts +73 -0
- package/dist/components/ThinkChatActivity.js +429 -0
- package/dist/components/ThinkChatContext.d.ts +28 -0
- package/dist/components/ThinkChatContext.js +10 -0
- package/dist/components/ThinkChatToolPanels.d.ts +39 -0
- package/dist/components/ThinkChatToolPanels.js +355 -0
- package/dist/components/ThinkChatToolParts.d.ts +2 -0
- package/dist/components/ThinkChatToolParts.js +66 -0
- package/dist/components/WorkspaceExplorer.d.ts +1 -1
- package/dist/components/useStickToBottom.d.ts +5 -2
- package/dist/components/useStickToBottom.js +5 -2
- package/dist/styles/agent-chat.css +15 -3
- package/dist/styles/agent-connection.css +12 -0
- package/dist/styles/code-block.css +4 -4
- package/dist/styles/conversation.css +10 -0
- package/dist/styles/index.css +2 -0
- package/dist/styles/marker.css +95 -0
- package/dist/styles/message-scroller.css +90 -0
- package/dist/styles/message.css +2 -1
- package/dist/styles/scrollbars.css +10 -2
- package/dist/styles/streamdown.css +2 -0
- package/dist/utils/mcp-server-catalog.d.ts +392 -1
- package/dist/utils/mcp-server-catalog.js +137 -1
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Marker.d.ts
|
|
4
|
+
type MarkerVariant = "default" | "separator" | "border";
|
|
5
|
+
type MarkerRenderProps = React.HTMLAttributes<HTMLElement> & {
|
|
6
|
+
ref?: React.Ref<HTMLElement>;
|
|
7
|
+
};
|
|
8
|
+
type MarkerRenderState = {
|
|
9
|
+
variant: MarkerVariant;
|
|
10
|
+
};
|
|
11
|
+
type MarkerRenderFunction = (props: MarkerRenderProps, state: MarkerRenderState) => React.ReactElement | null;
|
|
12
|
+
type MarkerRender = React.ReactElement<React.HTMLAttributes<HTMLElement>> | MarkerRenderFunction;
|
|
13
|
+
interface MarkerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/** Visual treatment for status, separator, or bordered marker rows. */
|
|
15
|
+
variant?: MarkerVariant;
|
|
16
|
+
/** Replace the root element while keeping marker classes, refs, and handlers merged. */
|
|
17
|
+
render?: MarkerRender;
|
|
18
|
+
}
|
|
19
|
+
interface MarkerVariantsOptions {
|
|
20
|
+
variant?: MarkerVariant | null;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
declare function markerVariants({
|
|
24
|
+
variant,
|
|
25
|
+
className
|
|
26
|
+
}?: MarkerVariantsOptions): string;
|
|
27
|
+
/**
|
|
28
|
+
* Compact status or separator row for transcript events like compaction,
|
|
29
|
+
* checkpoints, and progress markers.
|
|
30
|
+
*/
|
|
31
|
+
declare function Marker({
|
|
32
|
+
className,
|
|
33
|
+
variant,
|
|
34
|
+
render,
|
|
35
|
+
ref,
|
|
36
|
+
...props
|
|
37
|
+
}: MarkerProps & {
|
|
38
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
39
|
+
}): React.JSX.Element | null;
|
|
40
|
+
interface MarkerIconProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
41
|
+
declare function MarkerIcon({
|
|
42
|
+
className,
|
|
43
|
+
ref,
|
|
44
|
+
...props
|
|
45
|
+
}: MarkerIconProps & {
|
|
46
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
interface MarkerContentProps extends React.HTMLAttributes<HTMLSpanElement> {}
|
|
49
|
+
declare function MarkerContent({
|
|
50
|
+
className,
|
|
51
|
+
ref,
|
|
52
|
+
...props
|
|
53
|
+
}: MarkerContentProps & {
|
|
54
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Marker, MarkerContent, MarkerContentProps, MarkerIcon, MarkerIconProps, MarkerProps, MarkerVariant, MarkerVariantsOptions, markerVariants };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Marker.tsx
|
|
5
|
+
function markerVariants({ variant = "default", className } = {}) {
|
|
6
|
+
return cx("marker", `marker--${variant ?? "default"}`, className);
|
|
7
|
+
}
|
|
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
|
+
function isEventHandler(propName, value) {
|
|
24
|
+
return /^on[A-Z]/.test(propName) && typeof value === "function";
|
|
25
|
+
}
|
|
26
|
+
function mergeRenderedMarkerProps(renderProps, markerProps) {
|
|
27
|
+
const mergedProps = {
|
|
28
|
+
...renderProps,
|
|
29
|
+
...markerProps
|
|
30
|
+
};
|
|
31
|
+
const markerPropsRecord = markerProps;
|
|
32
|
+
for (const propName of Object.keys(renderProps)) {
|
|
33
|
+
const renderValue = renderProps[propName];
|
|
34
|
+
const markerValue = markerPropsRecord[propName];
|
|
35
|
+
if (isEventHandler(propName, renderValue) && isEventHandler(propName, markerValue)) mergedProps[propName] = (...args) => {
|
|
36
|
+
renderValue(...args);
|
|
37
|
+
markerValue(...args);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
mergedProps.className = cx(renderProps.className, markerProps.className);
|
|
41
|
+
mergedProps.style = renderProps.style || markerProps.style ? {
|
|
42
|
+
...renderProps.style,
|
|
43
|
+
...markerProps.style
|
|
44
|
+
} : void 0;
|
|
45
|
+
mergedProps.ref = mergeRefs(renderProps.ref, markerProps.ref);
|
|
46
|
+
return mergedProps;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compact status or separator row for transcript events like compaction,
|
|
50
|
+
* checkpoints, and progress markers.
|
|
51
|
+
*/
|
|
52
|
+
function Marker({ className, variant = "default", render, ref, ...props }) {
|
|
53
|
+
const rootProps = {
|
|
54
|
+
ref,
|
|
55
|
+
"data-slot": "marker",
|
|
56
|
+
"data-variant": variant,
|
|
57
|
+
className: markerVariants({
|
|
58
|
+
variant,
|
|
59
|
+
className
|
|
60
|
+
}),
|
|
61
|
+
...props
|
|
62
|
+
};
|
|
63
|
+
const markerProps = {
|
|
64
|
+
...rootProps,
|
|
65
|
+
ref
|
|
66
|
+
};
|
|
67
|
+
if (typeof render === "function") return render(markerProps, { variant });
|
|
68
|
+
if (React.isValidElement(render)) return React.cloneElement(render, mergeRenderedMarkerProps(render.props, markerProps));
|
|
69
|
+
return /* @__PURE__ */ jsx("div", { ...rootProps });
|
|
70
|
+
}
|
|
71
|
+
function MarkerIcon({ className, ref, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx("span", {
|
|
73
|
+
ref,
|
|
74
|
+
"data-slot": "marker-icon",
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
className: cx("marker__icon", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function MarkerContent({ className, ref, ...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx("span", {
|
|
82
|
+
ref,
|
|
83
|
+
"data-slot": "marker-content",
|
|
84
|
+
className: cx("marker__content", className),
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { Marker, MarkerContent, MarkerIcon, markerVariants };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { A as SpinnerIcon, D as PlusIcon, N as WarningIcon, a as CheckIcon } from "../icons-BCNawx-T.js";
|
|
2
2
|
import { Button } from "./Button.js";
|
|
3
3
|
import { MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRoot, MenuShortcut, MenuTrigger } from "./Menu.js";
|
|
4
|
+
import { getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/McpServerPicker.tsx
|
|
@@ -65,7 +66,7 @@ function McpServerPickerRow({ server, onConnect }) {
|
|
|
65
66
|
children: [
|
|
66
67
|
/* @__PURE__ */ jsx("span", {
|
|
67
68
|
className: "mcp-server-picker__icon",
|
|
68
|
-
children: renderIcon(server
|
|
69
|
+
children: renderIcon(server)
|
|
69
70
|
}),
|
|
70
71
|
/* @__PURE__ */ jsxs("span", {
|
|
71
72
|
className: "mcp-server-picker__copy",
|
|
@@ -106,18 +107,15 @@ function getStatusLabel(status) {
|
|
|
106
107
|
if (status === "connecting") return "Connecting";
|
|
107
108
|
return "";
|
|
108
109
|
}
|
|
109
|
-
function renderIcon(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (icon) return /* @__PURE__ */ jsx(IconImage, {
|
|
115
|
-
src: icon.src,
|
|
116
|
-
name
|
|
110
|
+
function renderIcon(server) {
|
|
111
|
+
const src = getMcpServerIconSrc(server);
|
|
112
|
+
if (src) return /* @__PURE__ */ jsx(IconImage, {
|
|
113
|
+
src,
|
|
114
|
+
name: server.name
|
|
117
115
|
});
|
|
118
116
|
return /* @__PURE__ */ jsx("span", {
|
|
119
117
|
className: "mcp-server-picker__fallback-icon",
|
|
120
|
-
children: name.slice(0, 1)
|
|
118
|
+
children: server.name.slice(0, 1)
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
121
|
function IconImage({ src, name }) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { r as ButtonProps } from "../Button-Ct5I6aTu.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { MessageScroller as MessageScroller$1, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
|
|
4
|
+
|
|
5
|
+
//#region src/components/MessageScroller.d.ts
|
|
6
|
+
type MessageScrollerProviderProps = React.ComponentProps<typeof MessageScroller$1.Provider>;
|
|
7
|
+
interface MessageScrollerProps extends React.ComponentProps<typeof MessageScroller$1.Root> {
|
|
8
|
+
/** Extra class names merged onto the scroll container. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
type MessageScrollerViewportProps = React.ComponentProps<typeof MessageScroller$1.Viewport>;
|
|
12
|
+
type MessageScrollerContentProps = React.ComponentProps<typeof MessageScroller$1.Content>;
|
|
13
|
+
type MessageScrollerItemProps = React.ComponentProps<typeof MessageScroller$1.Item>;
|
|
14
|
+
declare function MessageScrollerProvider(props: MessageScrollerProviderProps): React.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Scroll container for chat transcripts, wrapping shadcn's message scroller
|
|
17
|
+
* primitive with design-system classes.
|
|
18
|
+
*/
|
|
19
|
+
declare function MessageScroller({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: MessageScrollerProps): React.JSX.Element;
|
|
23
|
+
declare function MessageScrollerViewport({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: MessageScrollerViewportProps): React.JSX.Element;
|
|
27
|
+
declare function MessageScrollerContent({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: MessageScrollerContentProps): React.JSX.Element;
|
|
31
|
+
declare function MessageScrollerItem({
|
|
32
|
+
className,
|
|
33
|
+
scrollAnchor,
|
|
34
|
+
...props
|
|
35
|
+
}: MessageScrollerItemProps): React.JSX.Element;
|
|
36
|
+
interface MessageScrollerButtonProps extends Omit<React.ComponentProps<typeof MessageScroller$1.Button>, "children" | "className" | "color" | "render">, Pick<ButtonProps, "color" | "size" | "variant"> {
|
|
37
|
+
className?: string;
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
render?: React.ComponentProps<typeof MessageScroller$1.Button>["render"];
|
|
40
|
+
}
|
|
41
|
+
declare function MessageScrollerButton({
|
|
42
|
+
className,
|
|
43
|
+
children,
|
|
44
|
+
color,
|
|
45
|
+
direction,
|
|
46
|
+
render,
|
|
47
|
+
size,
|
|
48
|
+
variant,
|
|
49
|
+
...props
|
|
50
|
+
}: MessageScrollerButtonProps): React.JSX.Element;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { MessageScroller, MessageScrollerButton, MessageScrollerButtonProps, MessageScrollerContent, MessageScrollerContentProps, MessageScrollerItem, MessageScrollerItemProps, MessageScrollerProps, MessageScrollerProvider, MessageScrollerProviderProps, MessageScrollerViewport, MessageScrollerViewportProps, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { t as ArrowDownIcon } from "../icons-BCNawx-T.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { MessageScroller as MessageScroller$1, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
|
|
7
|
+
//#region src/components/MessageScroller.tsx
|
|
8
|
+
function MessageScrollerProvider(props) {
|
|
9
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Provider, { ...props });
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Scroll container for chat transcripts, wrapping shadcn's message scroller
|
|
13
|
+
* primitive with design-system classes.
|
|
14
|
+
*/
|
|
15
|
+
function MessageScroller({ className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Root, {
|
|
17
|
+
"data-slot": "message-scroller",
|
|
18
|
+
className: cx("message-scroller", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function MessageScrollerViewport({ className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Viewport, {
|
|
24
|
+
"data-slot": "message-scroller-viewport",
|
|
25
|
+
className: cx("message-scroller__viewport", className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function MessageScrollerContent({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Content, {
|
|
31
|
+
"data-slot": "message-scroller-content",
|
|
32
|
+
className: cx("message-scroller__content", className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function MessageScrollerItem({ className, scrollAnchor = false, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Item, {
|
|
38
|
+
"data-slot": "message-scroller-item",
|
|
39
|
+
scrollAnchor,
|
|
40
|
+
className: cx("message-scroller__item", className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function MessageScrollerButton({ className, children, color = "neutral", direction = "end", render, size = "icon-sm", variant = "outline", ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(MessageScroller$1.Button, {
|
|
46
|
+
"data-slot": "message-scroller-button",
|
|
47
|
+
direction,
|
|
48
|
+
className: cx("message-scroller__button", className),
|
|
49
|
+
render: render ?? /* @__PURE__ */ jsx(Button, {
|
|
50
|
+
color,
|
|
51
|
+
size,
|
|
52
|
+
variant
|
|
53
|
+
}),
|
|
54
|
+
...props,
|
|
55
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ArrowDownIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "message-scroller__button-label",
|
|
57
|
+
children: direction === "end" ? "Scroll to end" : "Scroll to start"
|
|
58
|
+
})] })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility };
|