macbetter 0.1.0-beta.1 → 0.1.0-beta.2
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/components/artifact-card.d.ts +41 -0
- package/dist/components/artifact-card.js +57 -0
- package/dist/components/attachment.d.ts +48 -0
- package/dist/components/attachment.js +65 -0
- package/dist/components/chat.d.ts +29 -0
- package/dist/components/chat.js +29 -0
- package/dist/components/code-block.d.ts +39 -0
- package/dist/components/code-block.js +65 -0
- package/dist/components/confirmation.d.ts +24 -0
- package/dist/components/confirmation.js +50 -0
- package/dist/components/content-unavailable.d.ts +19 -0
- package/dist/components/content-unavailable.js +21 -0
- package/dist/components/description-list.d.ts +18 -0
- package/dist/components/description-list.js +17 -0
- package/dist/components/generated-image.d.ts +39 -0
- package/dist/components/generated-image.js +47 -0
- package/dist/components/inspector.d.ts +29 -0
- package/dist/components/inspector.js +40 -0
- package/dist/components/message.d.ts +65 -0
- package/dist/components/message.js +69 -0
- package/dist/components/model-picker.d.ts +61 -0
- package/dist/components/model-picker.js +59 -0
- package/dist/components/plan.d.ts +25 -0
- package/dist/components/plan.js +43 -0
- package/dist/components/prompt-input.d.ts +93 -0
- package/dist/components/prompt-input.js +172 -0
- package/dist/components/reasoning.d.ts +28 -0
- package/dist/components/reasoning.js +52 -0
- package/dist/components/response.d.ts +14 -0
- package/dist/components/response.js +14 -0
- package/dist/components/shimmer.d.ts +18 -0
- package/dist/components/shimmer.js +17 -0
- package/dist/components/sources.d.ts +51 -0
- package/dist/components/sources.js +46 -0
- package/dist/components/suggestion.d.ts +23 -0
- package/dist/components/suggestion.js +29 -0
- package/dist/components/tool-call.d.ts +48 -0
- package/dist/components/tool-call.js +77 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/lib/agent-glyphs.d.ts +10 -0
- package/dist/lib/agent-glyphs.js +19 -0
- package/dist/styles/components/artifact-card.css +238 -0
- package/dist/styles/components/attachment.css +540 -0
- package/dist/styles/components/chat.css +209 -0
- package/dist/styles/components/code-block.css +162 -0
- package/dist/styles/components/confirmation.css +189 -0
- package/dist/styles/components/content-unavailable.css +105 -0
- package/dist/styles/components/description-list.css +92 -0
- package/dist/styles/components/device-frame.css +8 -0
- package/dist/styles/components/generated-image.css +248 -0
- package/dist/styles/components/index.css +19 -0
- package/dist/styles/components/inspector.css +236 -0
- package/dist/styles/components/message.css +236 -0
- package/dist/styles/components/model-picker.css +64 -0
- package/dist/styles/components/navigation-bar.css +2 -1
- package/dist/styles/components/plan.css +212 -0
- package/dist/styles/components/prompt-input.css +503 -0
- package/dist/styles/components/reasoning.css +214 -0
- package/dist/styles/components/response.css +303 -0
- package/dist/styles/components/shimmer.css +60 -0
- package/dist/styles/components/sources.css +349 -0
- package/dist/styles/components/suggestion.css +203 -0
- package/dist/styles/components/tool-call.css +391 -0
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Radio, RadioGroup } from "@ui-sdk/react/radio";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cx, join } from "../lib/cx.js";
|
|
6
|
+
import { Shimmer } from "./shimmer.js";
|
|
7
|
+
const GeneratedImageContext = React.createContext({
|
|
8
|
+
state: "ready",
|
|
9
|
+
value: null,
|
|
10
|
+
setValue: () => { },
|
|
11
|
+
generatingLabel: "Creating image…",
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* One or more generated images: a large stage, glass actions over its bottom corners, and an
|
|
15
|
+
* optional strip of thumbnails beside it on macOS and below it on iOS.
|
|
16
|
+
*/
|
|
17
|
+
function GeneratedImage({ state = "ready", value, defaultValue = null, onValueChange, aspectRatio = 1, generatingLabel = "Creating image…", className, style, ...props }) {
|
|
18
|
+
const [ownValue, setOwnValue] = React.useState(defaultValue);
|
|
19
|
+
const current = value === undefined ? ownValue : value;
|
|
20
|
+
const setValue = React.useCallback((next) => {
|
|
21
|
+
if (value === undefined)
|
|
22
|
+
setOwnValue(next);
|
|
23
|
+
onValueChange?.(next);
|
|
24
|
+
}, [value, onValueChange]);
|
|
25
|
+
const context = React.useMemo(() => ({ state, value: current, setValue, generatingLabel }), [state, current, setValue, generatingLabel]);
|
|
26
|
+
return (_jsx(GeneratedImageContext.Provider, { value: context, children: _jsx("div", { "data-state": state, "aria-busy": state === "generating" ? true : undefined, className: join("mb-generated-image", className), style: { "--mb-generated-image-aspect": String(aspectRatio), ...style }, ...props }) }));
|
|
27
|
+
}
|
|
28
|
+
/** The large image on a dark rounded stage. While generating it shows the placeholder instead. */
|
|
29
|
+
function GeneratedImageStage({ className, children, ...props }) {
|
|
30
|
+
const { state, value, generatingLabel } = React.useContext(GeneratedImageContext);
|
|
31
|
+
const content = typeof children === "function" ? children(value) : children;
|
|
32
|
+
return (_jsx("div", { className: join("mb-generated-image-stage", className), ...props, children: state === "generating" ? (_jsx("div", { className: "mb-generated-image-placeholder", children: _jsx(Shimmer, { className: "mb-generated-image-status", children: generatingLabel }) })) : (content) }));
|
|
33
|
+
}
|
|
34
|
+
/** Buttons over the stage's bottom corners: the first at the leading edge, the rest at the trailing edge. */
|
|
35
|
+
function GeneratedImageActions({ className, ...props }) {
|
|
36
|
+
return _jsx("div", { className: join("mb-generated-image-actions", className), ...props });
|
|
37
|
+
}
|
|
38
|
+
/** The strip of thumbnails. Choose one with a click or the arrow keys to show it on the stage. */
|
|
39
|
+
function GeneratedImageThumbnails({ className, "aria-label": label = "Images", ...props }) {
|
|
40
|
+
const { value, setValue } = React.useContext(GeneratedImageContext);
|
|
41
|
+
return (_jsx(RadioGroup, { "aria-label": label, value: value, onValueChange: (next) => setValue(next), className: cx("mb-generated-image-thumbnails", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
/** One thumbnail: a square that takes an accent ring when it's on the stage. */
|
|
44
|
+
function GeneratedImageThumbnail({ className, ...props }) {
|
|
45
|
+
return _jsx(Radio, { className: cx("mb-generated-image-thumbnail", className), ...props });
|
|
46
|
+
}
|
|
47
|
+
export { GeneratedImage, GeneratedImageActions, GeneratedImageStage, GeneratedImageThumbnail, GeneratedImageThumbnails, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ButtonProps } from "./button.js";
|
|
3
|
+
type InspectorProps = React.ComponentProps<"aside"> & {
|
|
4
|
+
/**
|
|
5
|
+
* `edge` is a column at the window's trailing edge with a hairline before it. `floating` is a
|
|
6
|
+
* rounded pane of material that floats over the content.
|
|
7
|
+
*/
|
|
8
|
+
variant?: "edge" | "floating";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A trailing panel with details about the selected content, like SwiftUI's inspector. Put it in a
|
|
12
|
+
* Window after WindowBody. It's a complementary landmark named by its InspectorTitle.
|
|
13
|
+
*/
|
|
14
|
+
declare function Inspector({ variant, className, "aria-label": label, ...props }: InspectorProps): React.JSX.Element;
|
|
15
|
+
/** The bar across the top: an InspectorTitle and, optionally, an InspectorClose. */
|
|
16
|
+
declare function InspectorHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function InspectorTitle({ className, id, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
18
|
+
/** Hides the inspector. Named "Close Inspector" unless you name it. You handle `onClick`. */
|
|
19
|
+
declare function InspectorClose({ className, children, "aria-label": label, ...props }: ButtonProps): React.JSX.Element;
|
|
20
|
+
/** The scrolling area below the header, holding InspectorSections. */
|
|
21
|
+
declare function InspectorBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
22
|
+
declare function InspectorSection({ className, ...props }: React.ComponentProps<"section">): React.JSX.Element;
|
|
23
|
+
type InspectorSectionTitleProps = React.ComponentProps<"h3"> & {
|
|
24
|
+
/** A control at the trailing end of the title row, like an add button. */
|
|
25
|
+
action?: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
declare function InspectorSectionTitle({ action, className, ...props }: InspectorSectionTitleProps): React.JSX.Element;
|
|
28
|
+
export { Inspector, InspectorBody, InspectorClose, InspectorHeader, InspectorSection, InspectorSectionTitle, InspectorTitle, };
|
|
29
|
+
export type { InspectorProps, InspectorSectionTitleProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cx, join } from "../lib/cx.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
const InspectorContext = React.createContext(undefined);
|
|
7
|
+
/**
|
|
8
|
+
* A trailing panel with details about the selected content, like SwiftUI's inspector. Put it in a
|
|
9
|
+
* Window after WindowBody. It's a complementary landmark named by its InspectorTitle.
|
|
10
|
+
*/
|
|
11
|
+
function Inspector({ variant = "edge", className, "aria-label": label, ...props }) {
|
|
12
|
+
const titleId = React.useId();
|
|
13
|
+
return (_jsx(InspectorContext.Provider, { value: titleId, children: _jsx("aside", { "aria-label": label, "aria-labelledby": label ? undefined : titleId, "data-variant": variant, className: join("mb-inspector", className), ...props }) }));
|
|
14
|
+
}
|
|
15
|
+
/** The bar across the top: an InspectorTitle and, optionally, an InspectorClose. */
|
|
16
|
+
function InspectorHeader({ className, ...props }) {
|
|
17
|
+
return _jsx("div", { className: join("mb-inspector-header", className), ...props });
|
|
18
|
+
}
|
|
19
|
+
function InspectorTitle({ className, id, ...props }) {
|
|
20
|
+
const titleId = React.useContext(InspectorContext);
|
|
21
|
+
return _jsx("h2", { id: id ?? titleId, className: join("mb-inspector-title", className), ...props });
|
|
22
|
+
}
|
|
23
|
+
function CloseGlyph() {
|
|
24
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m4.5 4.5 7 7m0-7-7 7", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) }));
|
|
25
|
+
}
|
|
26
|
+
/** Hides the inspector. Named "Close Inspector" unless you name it. You handle `onClick`. */
|
|
27
|
+
function InspectorClose({ className, children, "aria-label": label, ...props }) {
|
|
28
|
+
return (_jsx(Button, { variant: "plain", tone: "neutral", size: "sm", shape: "circle", "aria-label": children ? label : (label ?? "Close Inspector"), className: cx("mb-inspector-close", className), ...props, children: children ?? _jsx(CloseGlyph, {}) }));
|
|
29
|
+
}
|
|
30
|
+
/** The scrolling area below the header, holding InspectorSections. */
|
|
31
|
+
function InspectorBody({ className, ...props }) {
|
|
32
|
+
return _jsx("div", { className: join("mb-inspector-body", className), ...props });
|
|
33
|
+
}
|
|
34
|
+
function InspectorSection({ className, ...props }) {
|
|
35
|
+
return _jsx("section", { className: join("mb-inspector-section", className), ...props });
|
|
36
|
+
}
|
|
37
|
+
function InspectorSectionTitle({ action, className, ...props }) {
|
|
38
|
+
return (_jsxs("div", { className: "mb-inspector-section-header", children: [_jsx("h3", { className: join("mb-inspector-section-title", className), ...props }), action ? _jsx("div", { className: "mb-inspector-section-action", children: action }) : null] }));
|
|
39
|
+
}
|
|
40
|
+
export { Inspector, InspectorBody, InspectorClose, InspectorHeader, InspectorSection, InspectorSectionTitle, InspectorTitle, };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Toggle as TogglePrimitive } from "@ui-sdk/react/toggle";
|
|
2
|
+
import { Toolbar as ToolbarPrimitive, ToolbarButton as ToolbarButtonPrimitive } from "@ui-sdk/react/toolbar";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { type MenuProps } from "./menu.js";
|
|
5
|
+
type MessageFrom = "user" | "assistant";
|
|
6
|
+
type MessageProps = React.ComponentProps<"article"> & {
|
|
7
|
+
/** Who wrote the turn. The person's turn is a trailing bubble; the assistant's is plain text. */
|
|
8
|
+
from?: MessageFrom;
|
|
9
|
+
/**
|
|
10
|
+
* Keeps the actions in view. The last message in a thread shows them anyway;
|
|
11
|
+
* older ones show them on hover or focus on pointer devices.
|
|
12
|
+
*/
|
|
13
|
+
latest?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** One turn in a conversation. */
|
|
16
|
+
declare function Message({ from, latest, className, ...props }: MessageProps): React.JSX.Element;
|
|
17
|
+
/** The body of a turn: a bubble for the person, a `Response` for the assistant. */
|
|
18
|
+
declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
type MessageBubbleProps = React.ComponentProps<"div"> & {
|
|
20
|
+
/** `accent` fills with the theme's accent; `neutral` is a quiet gray fill. */
|
|
21
|
+
variant?: "accent" | "neutral";
|
|
22
|
+
};
|
|
23
|
+
declare function MessageBubble({ variant, className, ...props }: MessageBubbleProps): React.JSX.Element;
|
|
24
|
+
/** Files and images sent with the turn, above its bubble. */
|
|
25
|
+
declare function MessageAttachments({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
26
|
+
/** Small secondary text under a turn: the time, the model, "Edited". */
|
|
27
|
+
declare function MessageMeta({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
28
|
+
/** The row of actions under a turn: one tab stop, arrow keys between them. */
|
|
29
|
+
declare function MessageActions({ "aria-label": ariaLabel, className, ...props }: React.ComponentProps<typeof ToolbarPrimitive>): React.JSX.Element;
|
|
30
|
+
type MessageActionProps = Omit<React.ComponentProps<typeof ToolbarButtonPrimitive>, "children"> & {
|
|
31
|
+
/** Names the button for assistive tech and shows as its tooltip. */
|
|
32
|
+
label: string;
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
/** An icon button in `MessageActions`, named by `label` and showing it as a tooltip. */
|
|
36
|
+
declare function MessageAction({ label, className, children, ...props }: MessageActionProps): React.JSX.Element;
|
|
37
|
+
type MessageActionToggleProps = Omit<React.ComponentProps<typeof TogglePrimitive>, "children"> & {
|
|
38
|
+
label: string;
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
};
|
|
41
|
+
/** An action that stays pressed, like Good response or Bad response. */
|
|
42
|
+
declare function MessageActionToggle({ label, className, children, ...props }: MessageActionToggleProps): React.JSX.Element;
|
|
43
|
+
type MessageActionMenuProps = Omit<MenuProps, "children"> & {
|
|
44
|
+
/** Names the button and shows as its tooltip. */
|
|
45
|
+
label?: string;
|
|
46
|
+
/** The button's glyph. An ellipsis by default. */
|
|
47
|
+
icon?: React.ReactNode;
|
|
48
|
+
className?: string;
|
|
49
|
+
/** The menu's items. */
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
/** An action that opens a menu of more actions, like Branch, Share and Report. */
|
|
53
|
+
declare function MessageActionMenu({ label, icon, className, children, ...props }: MessageActionMenuProps): React.JSX.Element;
|
|
54
|
+
type MessageActionCopyProps = Omit<MessageActionProps, "label" | "children"> & {
|
|
55
|
+
/** What's copied: the reply's plain text, or a function that returns it when pressed. */
|
|
56
|
+
text: string | (() => string);
|
|
57
|
+
label?: string;
|
|
58
|
+
/** The label while the check shows, after a copy. */
|
|
59
|
+
copiedLabel?: string;
|
|
60
|
+
onCopy?: (text: string) => void;
|
|
61
|
+
};
|
|
62
|
+
/** Copies the reply and shows a check for two seconds. */
|
|
63
|
+
declare function MessageActionCopy({ text, label, copiedLabel, onCopy, onClick, ...props }: MessageActionCopyProps): React.JSX.Element;
|
|
64
|
+
export { Message, MessageAction, MessageActionCopy, MessageActionMenu, MessageActions, MessageActionToggle, MessageAttachments, MessageBubble, MessageContent, MessageMeta, };
|
|
65
|
+
export type { MessageActionCopyProps, MessageActionMenuProps, MessageActionProps, MessageActionToggleProps, MessageBubbleProps, MessageFrom, MessageProps, };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MenuTrigger as MenuTriggerPrimitive } from "@ui-sdk/react/menu";
|
|
4
|
+
import { Toggle as TogglePrimitive } from "@ui-sdk/react/toggle";
|
|
5
|
+
import { Toolbar as ToolbarPrimitive, ToolbarButton as ToolbarButtonPrimitive } from "@ui-sdk/react/toolbar";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { cx, join } from "../lib/cx.js";
|
|
8
|
+
import { Menu, MenuContent } from "./menu.js";
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
10
|
+
/** One turn in a conversation. */
|
|
11
|
+
function Message({ from = "assistant", latest, className, ...props }) {
|
|
12
|
+
return (_jsx("article", { "data-from": from, "data-latest": latest ? "" : undefined, className: join("mb-message", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
/** The body of a turn: a bubble for the person, a `Response` for the assistant. */
|
|
15
|
+
function MessageContent({ className, ...props }) {
|
|
16
|
+
return _jsx("div", { className: join("mb-message-content", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
function MessageBubble({ variant = "accent", className, ...props }) {
|
|
19
|
+
return _jsx("div", { "data-variant": variant, className: join("mb-message-bubble", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
/** Files and images sent with the turn, above its bubble. */
|
|
22
|
+
function MessageAttachments({ className, ...props }) {
|
|
23
|
+
return _jsx("div", { className: join("mb-message-attachments", className), ...props });
|
|
24
|
+
}
|
|
25
|
+
/** Small secondary text under a turn: the time, the model, "Edited". */
|
|
26
|
+
function MessageMeta({ className, ...props }) {
|
|
27
|
+
return _jsx("div", { className: join("mb-message-meta", className), ...props });
|
|
28
|
+
}
|
|
29
|
+
/** The row of actions under a turn: one tab stop, arrow keys between them. */
|
|
30
|
+
function MessageActions({ "aria-label": ariaLabel = "Message actions", className, ...props }) {
|
|
31
|
+
return _jsx(ToolbarPrimitive, { "aria-label": ariaLabel, className: cx("mb-message-actions", className), ...props });
|
|
32
|
+
}
|
|
33
|
+
/** An icon button in `MessageActions`, named by `label` and showing it as a tooltip. */
|
|
34
|
+
function MessageAction({ label, className, children, ...props }) {
|
|
35
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(ToolbarButtonPrimitive, { "aria-label": label, className: cx("mb-message-action", className), ...props }), children: children }), _jsx(TooltipContent, { children: label })] }));
|
|
36
|
+
}
|
|
37
|
+
/** An action that stays pressed, like Good response or Bad response. */
|
|
38
|
+
function MessageActionToggle({ label, className, children, ...props }) {
|
|
39
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(TogglePrimitive, { "aria-label": label, className: cx("mb-message-action", className), ...props }), children: children }), _jsx(TooltipContent, { children: label })] }));
|
|
40
|
+
}
|
|
41
|
+
/** An action that opens a menu of more actions, like Branch, Share and Report. */
|
|
42
|
+
function MessageActionMenu({ label = "More", icon, className, children, ...props }) {
|
|
43
|
+
return (_jsxs(Menu, { ...props, children: [_jsx(MessageAction, { label: label, className: className, render: _jsx(MenuTriggerPrimitive, {}), children: icon ?? _jsx(MoreGlyph, {}) }), _jsx(MenuContent, { children: children })] }));
|
|
44
|
+
}
|
|
45
|
+
/** Copies the reply and shows a check for two seconds. */
|
|
46
|
+
function MessageActionCopy({ text, label = "Copy", copiedLabel = "Copied", onCopy, onClick, ...props }) {
|
|
47
|
+
const [copied, setCopied] = React.useState(false);
|
|
48
|
+
const timer = React.useRef(undefined);
|
|
49
|
+
React.useEffect(() => () => clearTimeout(timer.current), []);
|
|
50
|
+
return (_jsx(MessageAction, { label: copied ? copiedLabel : label, "data-copied": copied ? "" : undefined, onClick: (event, ...rest) => {
|
|
51
|
+
onClick?.(event, ...rest);
|
|
52
|
+
const value = typeof text === "function" ? text() : text;
|
|
53
|
+
navigator.clipboard?.writeText(value).catch(() => { });
|
|
54
|
+
onCopy?.(value);
|
|
55
|
+
setCopied(true);
|
|
56
|
+
clearTimeout(timer.current);
|
|
57
|
+
timer.current = setTimeout(() => setCopied(false), 2000);
|
|
58
|
+
}, ...props, children: copied ? _jsx(CheckGlyph, {}) : _jsx(CopyGlyph, {}) }));
|
|
59
|
+
}
|
|
60
|
+
function CopyGlyph() {
|
|
61
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [_jsx("rect", { x: "5.25", y: "5.25", width: "8.5", height: "8.5", rx: "2", stroke: "currentColor", strokeWidth: "1.4" }), _jsx("path", { d: "M10.5 3.5v-.25a1 1 0 0 0-1-1h-6a1.25 1.25 0 0 0-1.25 1.25v6a1 1 0 0 0 1 1h.25", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" })] }));
|
|
62
|
+
}
|
|
63
|
+
function MoreGlyph() {
|
|
64
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: [_jsx("circle", { cx: "3.5", cy: "8", r: "1.25", fill: "currentColor" }), _jsx("circle", { cx: "8", cy: "8", r: "1.25", fill: "currentColor" }), _jsx("circle", { cx: "12.5", cy: "8", r: "1.25", fill: "currentColor" })] }));
|
|
65
|
+
}
|
|
66
|
+
function CheckGlyph() {
|
|
67
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "m3.25 8.4 3.1 3.1 6.4-7", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
68
|
+
}
|
|
69
|
+
export { Message, MessageAction, MessageActionCopy, MessageActionMenu, MessageActions, MessageActionToggle, MessageAttachments, MessageBubble, MessageContent, MessageMeta, };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ButtonSize } from "./button.js";
|
|
3
|
+
import { type MenuProps, MenuRadioGroup, MenuRadioItem, MenuSeparator } from "./menu.js";
|
|
4
|
+
type ModelPickerModel = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** One line about when to pick it, under its name in the menu. */
|
|
8
|
+
description?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type ModelPickerEffortLevel = {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
};
|
|
16
|
+
type ModelPickerProps = Omit<MenuProps, "children"> & {
|
|
17
|
+
models: readonly ModelPickerModel[];
|
|
18
|
+
/** Effort levels, listed as a second group. Leave out for models without one. */
|
|
19
|
+
efforts?: readonly ModelPickerEffortLevel[];
|
|
20
|
+
value?: string;
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
effort?: string;
|
|
24
|
+
defaultEffort?: string;
|
|
25
|
+
onEffortChange?: (effort: string) => void;
|
|
26
|
+
/** The heading over the models in the menu. */
|
|
27
|
+
modelsLabel?: string;
|
|
28
|
+
/** The heading over the effort levels in the menu. */
|
|
29
|
+
effortLabel?: string;
|
|
30
|
+
size?: ButtonSize;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Names the trigger for assistive tech, when its text alone isn't enough. */
|
|
33
|
+
"aria-label"?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Replaces the menu's generated body, for a layout of your own built from the ModelPicker parts. */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
};
|
|
38
|
+
/** One compact control that shows the model and effort ("Atlas 4 · High") and opens a menu to change them. */
|
|
39
|
+
declare function ModelPicker({ models, efforts, value: valueProp, defaultValue, onValueChange, effort: effortProp, defaultEffort, onEffortChange, modelsLabel, effortLabel, size, disabled, "aria-label": ariaLabel, className, presentation, children, ...props }: ModelPickerProps): React.JSX.Element;
|
|
40
|
+
type ModelPickerGroupProps = Omit<React.ComponentProps<typeof MenuRadioGroup>, "value" | "defaultValue" | "onValueChange" | "children"> & {
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
/** The group's heading. Defaults to the picker's `modelsLabel`; pass `null` for none. */
|
|
43
|
+
label?: React.ReactNode;
|
|
44
|
+
};
|
|
45
|
+
/** The radio group of models. `ModelPickerItem`s go inside. */
|
|
46
|
+
declare function ModelPickerGroup({ label, className, children, ...props }: ModelPickerGroupProps): React.JSX.Element;
|
|
47
|
+
type ModelPickerItemProps = React.ComponentProps<typeof MenuRadioItem> & {
|
|
48
|
+
description?: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
/** A model: its name, with a one-line description under it. */
|
|
51
|
+
declare function ModelPickerItem({ description, closeOnSelect, label, className, children, ...props }: ModelPickerItemProps): React.JSX.Element;
|
|
52
|
+
type ModelPickerEffortProps = Omit<React.ComponentProps<typeof MenuRadioGroup>, "value" | "defaultValue" | "onValueChange" | "children"> & {
|
|
53
|
+
/** The group's heading. Defaults to the picker's `effortLabel`; pass `null` for none. */
|
|
54
|
+
label?: React.ReactNode;
|
|
55
|
+
};
|
|
56
|
+
/** The radio group of effort levels, from the picker's `efforts`. */
|
|
57
|
+
declare function ModelPickerEffort({ label, className, ...props }: ModelPickerEffortProps): React.JSX.Element;
|
|
58
|
+
/** A line between groups in a custom picker layout. */
|
|
59
|
+
declare const ModelPickerSeparator: typeof MenuSeparator;
|
|
60
|
+
export { ModelPicker, ModelPickerEffort, ModelPickerGroup, ModelPickerItem, ModelPickerSeparator };
|
|
61
|
+
export type { ModelPickerEffortLevel, ModelPickerEffortProps, ModelPickerGroupProps, ModelPickerItemProps, ModelPickerModel, ModelPickerProps, };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cx, join } from "../lib/cx.js";
|
|
5
|
+
import { Menu, MenuContent, MenuGroupLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger, } from "./menu.js";
|
|
6
|
+
const ModelPickerContext = React.createContext(null);
|
|
7
|
+
function useModelPicker(part) {
|
|
8
|
+
const context = React.useContext(ModelPickerContext);
|
|
9
|
+
if (!context)
|
|
10
|
+
throw new Error(`${part} must be inside a ModelPicker.`);
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
function useControllable(value, defaultValue, onChange) {
|
|
14
|
+
const [own, setOwn] = React.useState(defaultValue);
|
|
15
|
+
const current = value !== undefined ? value : own;
|
|
16
|
+
const set = React.useCallback((next) => {
|
|
17
|
+
if (value === undefined)
|
|
18
|
+
setOwn(next);
|
|
19
|
+
onChange?.(next);
|
|
20
|
+
}, [value, onChange]);
|
|
21
|
+
return [current, set];
|
|
22
|
+
}
|
|
23
|
+
/** One compact control that shows the model and effort ("Atlas 4 · High") and opens a menu to change them. */
|
|
24
|
+
function ModelPicker({ models, efforts = [], value: valueProp, defaultValue, onValueChange, effort: effortProp, defaultEffort, onEffortChange, modelsLabel = "Model", effortLabel = "Effort", size = "md", disabled, "aria-label": ariaLabel, className, presentation = "auto", children, ...props }) {
|
|
25
|
+
const [value, setValue] = useControllable(valueProp, defaultValue ?? models[0]?.value ?? null, onValueChange);
|
|
26
|
+
const [effort, setEffort] = useControllable(effortProp, defaultEffort ?? efforts[0]?.value ?? null, onEffortChange);
|
|
27
|
+
const model = models.find((entry) => entry.value === value);
|
|
28
|
+
const level = efforts.find((entry) => entry.value === effort);
|
|
29
|
+
const context = {
|
|
30
|
+
models,
|
|
31
|
+
efforts,
|
|
32
|
+
value,
|
|
33
|
+
setValue,
|
|
34
|
+
effort,
|
|
35
|
+
setEffort,
|
|
36
|
+
modelsLabel,
|
|
37
|
+
effortLabel,
|
|
38
|
+
};
|
|
39
|
+
return (_jsx(ModelPickerContext.Provider, { value: context, children: _jsxs(Menu, { presentation: presentation, ...props, children: [_jsxs(MenuTrigger, { variant: "plain", tone: "neutral", size: size, disabled: disabled, "aria-label": ariaLabel, className: join("mb-model-picker", className), children: [_jsx("span", { className: "mb-model-picker-name", children: model?.label ?? modelsLabel }), level ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "mb-visually-hidden", children: ", " }), _jsx("span", { "aria-hidden": "true", className: "mb-model-picker-dot", children: "\u00B7" }), _jsx("span", { className: "mb-model-picker-effort", children: level.label })] })) : null] }), _jsx(MenuContent, { className: "mb-model-picker-content", children: children ?? (_jsxs(_Fragment, { children: [_jsx(ModelPickerGroup, { children: models.map((entry) => (_jsx(ModelPickerItem, { value: entry.value, description: entry.description, disabled: entry.disabled, children: entry.label }, entry.value))) }), efforts.length ? (_jsxs(_Fragment, { children: [_jsx(MenuSeparator, {}), _jsx(ModelPickerEffort, {})] })) : null] })) })] }) }));
|
|
40
|
+
}
|
|
41
|
+
/** The radio group of models. `ModelPickerItem`s go inside. */
|
|
42
|
+
function ModelPickerGroup({ label, className, children, ...props }) {
|
|
43
|
+
const { value, setValue, modelsLabel } = useModelPicker("ModelPickerGroup");
|
|
44
|
+
const heading = label === undefined ? modelsLabel : label;
|
|
45
|
+
return (_jsxs(MenuRadioGroup, { value: value, onValueChange: (next) => setValue(next), className: cx("mb-model-picker-group", className), ...props, children: [heading ? _jsx(MenuGroupLabel, { children: heading }) : null, children] }));
|
|
46
|
+
}
|
|
47
|
+
/** A model: its name, with a one-line description under it. */
|
|
48
|
+
function ModelPickerItem({ description, closeOnSelect = true, label, className, children, ...props }) {
|
|
49
|
+
return (_jsx(MenuRadioItem, { closeOnSelect: closeOnSelect, label: label ?? (typeof children === "string" ? children : undefined), className: cx("mb-model-picker-item", className), ...props, children: _jsxs("span", { className: "mb-model-picker-item-text", children: [_jsx("span", { className: "mb-model-picker-item-label", children: children }), description ? _jsx("span", { className: "mb-model-picker-item-description", children: description }) : null] }) }));
|
|
50
|
+
}
|
|
51
|
+
/** The radio group of effort levels, from the picker's `efforts`. */
|
|
52
|
+
function ModelPickerEffort({ label, className, ...props }) {
|
|
53
|
+
const { efforts, effort, setEffort, effortLabel } = useModelPicker("ModelPickerEffort");
|
|
54
|
+
const heading = label === undefined ? effortLabel : label;
|
|
55
|
+
return (_jsxs(MenuRadioGroup, { value: effort, onValueChange: (next) => setEffort(next), className: cx("mb-model-picker-group", className), ...props, children: [heading ? _jsx(MenuGroupLabel, { children: heading }) : null, efforts.map((entry) => (_jsx(ModelPickerItem, { value: entry.value, description: entry.description, closeOnSelect: false, children: entry.label }, entry.value)))] }));
|
|
56
|
+
}
|
|
57
|
+
/** A line between groups in a custom picker layout. */
|
|
58
|
+
const ModelPickerSeparator = MenuSeparator;
|
|
59
|
+
export { ModelPicker, ModelPickerEffort, ModelPickerGroup, ModelPickerItem, ModelPickerSeparator };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Timeline, TimelineItem } from "@ui-sdk/react/timeline";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type PlanStepStatus = "pending" | "active" | "done" | "skipped";
|
|
4
|
+
type PlanProps = Omit<React.ComponentProps<typeof Timeline>, "children"> & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Shows "3 of 5" beside the title, counting done and skipped steps. */
|
|
7
|
+
progress?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A task list for multi-step work. Put an optional PlanTitle first, then a PlanStep for each
|
|
11
|
+
* step. The steps are a list with one tab stop; the arrow keys move between them.
|
|
12
|
+
*/
|
|
13
|
+
declare function Plan({ progress, className, children, "aria-label": label, ...props }: PlanProps): React.JSX.Element;
|
|
14
|
+
/** The plan's name, like "Move the billing tables". It names the list of steps. */
|
|
15
|
+
declare function PlanTitle({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
16
|
+
type PlanStepProps = Omit<React.ComponentProps<typeof TimelineItem>, "status" | "children"> & {
|
|
17
|
+
status?: PlanStepStatus;
|
|
18
|
+
/** One line under the title, like what the step found or why it was skipped. */
|
|
19
|
+
detail?: React.ReactNode;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
/** One step: an empty circle, a turning accent ring, a filled check or a dash, then its title. */
|
|
23
|
+
declare function PlanStep({ status, detail, className, children, ...props }: PlanStepProps): React.JSX.Element;
|
|
24
|
+
export { Plan, PlanStep, PlanTitle };
|
|
25
|
+
export type { PlanProps, PlanStepProps, PlanStepStatus };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Timeline, TimelineConnector, TimelineDescription, TimelineItem, TimelineMarker, TimelineTitle, } from "@ui-sdk/react/timeline";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { CheckGlyph, DashGlyph } from "../lib/agent-glyphs.js";
|
|
6
|
+
import { cx, join } from "../lib/cx.js";
|
|
7
|
+
function isStep(child) {
|
|
8
|
+
return React.isValidElement(child) && child.type === PlanStep;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A task list for multi-step work. Put an optional PlanTitle first, then a PlanStep for each
|
|
12
|
+
* step. The steps are a list with one tab stop; the arrow keys move between them.
|
|
13
|
+
*/
|
|
14
|
+
function Plan({ progress = true, className, children, "aria-label": label, ...props }) {
|
|
15
|
+
const titleId = React.useId();
|
|
16
|
+
const all = React.Children.toArray(children);
|
|
17
|
+
const title = all.find((child) => React.isValidElement(child) && child.type === PlanTitle);
|
|
18
|
+
const steps = all.filter(isStep);
|
|
19
|
+
const rest = all.filter((child) => child !== title && !isStep(child));
|
|
20
|
+
const finished = steps.filter((step) => step.props.status === "done" || step.props.status === "skipped").length;
|
|
21
|
+
return (_jsxs("div", { className: join("mb-plan", typeof className === "string" ? className : undefined), children: [title ? (_jsxs("div", { className: "mb-plan-header", children: [_jsx("div", { id: titleId, className: "mb-plan-heading", children: title }), progress && steps.length > 0 ? (_jsxs("span", { className: "mb-plan-progress", children: [finished, " of ", steps.length] })) : null] })) : null, _jsx(Timeline, { "aria-label": label, "aria-labelledby": title && !label ? titleId : undefined, className: cx("mb-plan-steps", typeof className === "function" ? className : undefined), ...props, children: steps }), rest] }));
|
|
22
|
+
}
|
|
23
|
+
/** The plan's name, like "Move the billing tables". It names the list of steps. */
|
|
24
|
+
function PlanTitle({ className, ...props }) {
|
|
25
|
+
return _jsx("span", { className: join("mb-plan-title", className), ...props });
|
|
26
|
+
}
|
|
27
|
+
const timelineStatus = {
|
|
28
|
+
pending: "upcoming",
|
|
29
|
+
active: "current",
|
|
30
|
+
done: "complete",
|
|
31
|
+
skipped: "complete",
|
|
32
|
+
};
|
|
33
|
+
const statusWords = {
|
|
34
|
+
pending: "Not started",
|
|
35
|
+
active: "In progress",
|
|
36
|
+
done: "Done",
|
|
37
|
+
skipped: "Skipped",
|
|
38
|
+
};
|
|
39
|
+
/** One step: an empty circle, a turning accent ring, a filled check or a dash, then its title. */
|
|
40
|
+
function PlanStep({ status = "pending", detail, className, children, ...props }) {
|
|
41
|
+
return (_jsxs(TimelineItem, { status: timelineStatus[status], "data-status": status, className: cx("mb-plan-step", className), ...props, children: [_jsxs(TimelineMarker, { className: "mb-plan-marker", "data-status": status, children: [status === "done" ? _jsx(CheckGlyph, { className: "mb-plan-glyph" }) : null, status === "skipped" ? _jsx(DashGlyph, { className: "mb-plan-glyph" }) : null, status === "active" ? _jsx("span", { className: "mb-plan-ring", "data-motion": "essential" }) : null] }), _jsx(TimelineConnector, { className: "mb-plan-connector" }), _jsxs(TimelineTitle, { className: "mb-plan-step-title", children: [children, _jsxs("span", { className: "mb-visually-hidden", children: [", ", statusWords[status]] })] }), detail != null ? _jsx(TimelineDescription, { className: "mb-plan-step-detail", children: detail }) : null] }));
|
|
42
|
+
}
|
|
43
|
+
export { Plan, PlanStep, PlanTitle };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FileInputList } from "@ui-sdk/react/file-input";
|
|
2
|
+
import { Textarea } from "@ui-sdk/react/textarea";
|
|
3
|
+
import { type TriggerDefinition } from "@ui-sdk/react/trigger-menu";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { type ButtonProps } from "./button.js";
|
|
6
|
+
import { type MenuProps } from "./menu.js";
|
|
7
|
+
/** A suggestion source for `PromptInputField`'s `triggers`: ui-sdk Trigger Menu's trigger definition. */
|
|
8
|
+
type PromptInputTrigger = TriggerDefinition;
|
|
9
|
+
type PromptInputStatus = "ready" | "submitted" | "streaming" | "error";
|
|
10
|
+
type PromptInputMessage = {
|
|
11
|
+
text: string;
|
|
12
|
+
files: File[];
|
|
13
|
+
};
|
|
14
|
+
type PromptInputProps = Omit<React.ComponentProps<"form">, "onSubmit" | "defaultValue"> & {
|
|
15
|
+
/** Where the reply is: `submitted` and `streaming` turn the submit button into Stop. */
|
|
16
|
+
status?: PromptInputStatus;
|
|
17
|
+
/** Runs with what's typed and attached when the person sends. The field and files clear after. */
|
|
18
|
+
onSubmit?: (message: PromptInputMessage) => void;
|
|
19
|
+
/** Runs when the person presses Stop while a reply is on its way. */
|
|
20
|
+
onStop?: () => void;
|
|
21
|
+
/** `lg` is the tall composer of a new chat; `md` starts at one line and grows. */
|
|
22
|
+
size?: "md" | "lg";
|
|
23
|
+
/** A soft moving halo in the theme's colors while the reply is on its way. Holds still under Reduce Motion. */
|
|
24
|
+
glow?: boolean;
|
|
25
|
+
/** Floats the composer over the bottom of a `Chat`, as on iOS. */
|
|
26
|
+
floating?: boolean;
|
|
27
|
+
value?: string;
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
onValueChange?: (text: string) => void;
|
|
30
|
+
files?: File[];
|
|
31
|
+
defaultFiles?: File[];
|
|
32
|
+
onFilesChange?: (files: File[]) => void;
|
|
33
|
+
/** The files it takes, like the `accept` attribute. Any file without it. */
|
|
34
|
+
accept?: string;
|
|
35
|
+
maxFiles?: number;
|
|
36
|
+
/** The largest file accepted, in bytes. */
|
|
37
|
+
maxSize?: number;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The composer. Return sends, Shift-Return adds a line, and files come in from the
|
|
42
|
+
* add button, a drop or a paste. `PromptInputAccessory` children are placed under it.
|
|
43
|
+
*/
|
|
44
|
+
declare function PromptInput({ status, onSubmit, onStop, size, glow, floating, value: valueProp, defaultValue, onValueChange, files: filesProp, defaultFiles, onFilesChange, accept, maxFiles, maxSize, disabled, className, children, ...props }: PromptInputProps): React.JSX.Element;
|
|
45
|
+
type PromptInputFieldProps = Omit<React.ComponentProps<typeof Textarea>, "value" | "defaultValue" | "onValueChange" | "submitShortcut" | "onSubmit"> & {
|
|
46
|
+
/**
|
|
47
|
+
* Suggestions at the caret, like `@` for people or files and `/` for commands. Each is a
|
|
48
|
+
* ui-sdk Trigger Menu trigger: `{ char, items, boundary? }`, with items as data or a loader.
|
|
49
|
+
*/
|
|
50
|
+
triggers?: PromptInputTrigger[];
|
|
51
|
+
/** What the suggestion list says when nothing matches. Leave out to close it instead. */
|
|
52
|
+
triggerEmpty?: React.ReactNode;
|
|
53
|
+
/** The most lines it grows to before it scrolls. */
|
|
54
|
+
maxRows?: number;
|
|
55
|
+
};
|
|
56
|
+
/** The text field. It grows with what's typed. */
|
|
57
|
+
declare function PromptInputField({ "aria-label": ariaLabel, triggers, triggerEmpty, maxRows, rows, ref, className, style, disabled, ...props }: PromptInputFieldProps): React.JSX.Element;
|
|
58
|
+
/** The files attached so far, as chips above the field. Arrow keys move between them; Delete removes one. */
|
|
59
|
+
declare function PromptInputAttachments({ "aria-label": ariaLabel, className, ...props }: Omit<React.ComponentProps<typeof FileInputList>, "children">): React.JSX.Element | null;
|
|
60
|
+
/** The row under the field: leading and trailing `PromptInputTools`. */
|
|
61
|
+
declare function PromptInputToolbar({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
62
|
+
/** A cluster of controls in the toolbar. The first sits at the leading edge, the last at the trailing edge. */
|
|
63
|
+
declare function PromptInputTools({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
64
|
+
type PromptInputButtonProps = ButtonProps & {
|
|
65
|
+
/** Names the icon-only button, like "Dictate". */
|
|
66
|
+
"aria-label": string;
|
|
67
|
+
};
|
|
68
|
+
/** A plain round icon button for the toolbar, like dictation or voice. */
|
|
69
|
+
declare function PromptInputButton({ variant, tone, shape, type, className, ...props }: PromptInputButtonProps): React.JSX.Element;
|
|
70
|
+
type PromptInputAddProps = Omit<MenuProps, "children"> & {
|
|
71
|
+
/** Names the button. */
|
|
72
|
+
label?: string;
|
|
73
|
+
/** The menu item that opens the file picker. */
|
|
74
|
+
filesLabel?: string;
|
|
75
|
+
/** Leaves out the built-in files item, for a menu of your own items only. */
|
|
76
|
+
hideFiles?: boolean;
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
className?: string;
|
|
79
|
+
/** More menu items, after Add photos and files. */
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
};
|
|
82
|
+
/** The add button. It opens a menu whose first item picks photos and files. */
|
|
83
|
+
declare function PromptInputAdd({ label, filesLabel, hideFiles, disabled, className, presentation, onAction, children, ...props }: PromptInputAddProps): React.JSX.Element;
|
|
84
|
+
type PromptInputSubmitProps = Omit<ButtonProps, "children" | "type"> & {
|
|
85
|
+
sendLabel?: string;
|
|
86
|
+
stopLabel?: string;
|
|
87
|
+
};
|
|
88
|
+
/** Sends the message. While a reply is on its way it's a Stop button that calls `onStop`. */
|
|
89
|
+
declare function PromptInputSubmit({ sendLabel, stopLabel, variant, tone, shape, size, disabled, className, onClick, ...props }: PromptInputSubmitProps): React.JSX.Element;
|
|
90
|
+
/** The strip attached under the composer: context chips on the leading side, an action on the trailing side. */
|
|
91
|
+
declare function PromptInputAccessory({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
92
|
+
export { PromptInput, PromptInputAccessory, PromptInputAdd, PromptInputAttachments, PromptInputButton, PromptInputField, PromptInputSubmit, PromptInputToolbar, PromptInputTools, };
|
|
93
|
+
export type { PromptInputAddProps, PromptInputButtonProps, PromptInputFieldProps, PromptInputMessage, PromptInputProps, PromptInputStatus, PromptInputSubmitProps, PromptInputTrigger, };
|