@mcp-b/react-components 0.6.5 → 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/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/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 +1 -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/package.json +3 -2
|
@@ -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 };
|
|
@@ -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 };
|