@schemavaults/ui 0.112.1 → 0.113.1
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/ui/accordion/accordion.d.ts +1 -1
- package/dist/components/ui/agent-chat-messages/agent-chat-announcement.d.ts +18 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js +42 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.d.ts +35 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js +37 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact.d.ts +52 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js +75 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-bubble.d.ts +22 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js +23 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.d.ts +20 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js +33 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.d.ts +18 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js +29 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image.d.ts +103 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image.js +92 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-image.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-message-row.d.ts +24 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js +29 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-messages.d.ts +1 -67
- package/dist/components/ui/agent-chat-messages/agent-chat-messages.js +47 -136
- package/dist/components/ui/agent-chat-messages/agent-chat-messages.js.map +1 -1
- package/dist/components/ui/agent-chat-messages/agent-chat-motion.d.ts +44 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-motion.js +19 -0
- package/dist/components/ui/agent-chat-messages/agent-chat-motion.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/agent-typing-indicator.d.ts +14 -0
- package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js +13 -0
- package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js.map +1 -0
- package/dist/components/ui/agent-chat-messages/index.d.ts +14 -0
- package/dist/components/ui/agent-chat-messages/index.js +7 -0
- package/dist/components/ui/agent-chat-messages/index.js.map +1 -1
- package/dist/components/ui/agent-chat-messages/use-image-load-state.d.ts +13 -0
- package/dist/components/ui/agent-chat-messages/use-image-load-state.js +29 -0
- package/dist/components/ui/agent-chat-messages/use-image-load-state.js.map +1 -0
- package/dist/components/ui/attachment-card/attachment-card.d.ts +2 -2
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/blockquote/blockquote.d.ts +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/chip/chip.d.ts +1 -1
- package/dist/components/ui/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/collapsible/collapsible-variants.d.ts +3 -3
- package/dist/components/ui/floating-action-button/floating-action-button.d.ts +1 -1
- package/dist/components/ui/json-viewer/json-viewer.d.ts +1 -1
- package/dist/components/ui/number-ticker/number-ticker.d.ts +1 -1
- package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.d.ts +118 -0
- package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js +155 -0
- package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js.map +1 -0
- package/dist/components/ui/prompt-input/prompt-input-variants.js +3 -1
- package/dist/components/ui/prompt-input/prompt-input-variants.js.map +1 -1
- package/dist/components/ui/prompt-input/prompt-input.d.ts +22 -1
- package/dist/components/ui/prompt-input/prompt-input.js +44 -9
- package/dist/components/ui/prompt-input/prompt-input.js.map +1 -1
- package/dist/components/ui/scroll-progress/scroll-progress.d.ts +1 -1
- package/dist/components/ui/scroll-to-top/scroll-to-top.d.ts +1 -1
- package/dist/components/ui/secret-reveal/secret-reveal.d.ts +1 -1
- package/dist/components/ui/snippet/snippet.d.ts +1 -1
- package/dist/components/ui/toggle/toggle.d.ts +1 -1
- package/dist/components/ui/toolbar/toolbar.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { type ComponentPropsWithoutRef, type ReactElement, type Ref } from "reac
|
|
|
4
4
|
export declare const accordionVariantIds: ["default", "bordered", "ghost"];
|
|
5
5
|
export type AccordionVariantId = (typeof accordionVariantIds)[number];
|
|
6
6
|
declare const accordionVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "ghost" | "bordered" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
export type AccordionSingleProps = ComponentPropsWithoutRef<typeof AccordionPrimitive.Root> & {
|
|
10
10
|
type: "single";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type MotionDivAttributes } from "./agent-chat-motion";
|
|
4
|
+
export declare const agentChatAnnouncementVariantIds: readonly ["default", "info", "warning", "destructive"];
|
|
5
|
+
export type AgentChatAnnouncementVariantId = (typeof agentChatAnnouncementVariantIds)[number];
|
|
6
|
+
declare const agentChatAnnouncementVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "info" | "warning" | "destructive" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export interface AgentChatAnnouncementProps extends MotionDivAttributes, VariantProps<typeof agentChatAnnouncementVariants> {
|
|
10
|
+
/** Override the default icon. Pass `null` to hide the icon. */
|
|
11
|
+
icon?: ReactNode | null;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
declare function AgentChatAnnouncement({ className, variant, icon, children, ref, ...props }: AgentChatAnnouncementProps): ReactElement;
|
|
15
|
+
declare namespace AgentChatAnnouncement {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export { AgentChatAnnouncement };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { AlertOctagon, AlertTriangle, Info } from "lucide-react";
|
|
5
|
+
import { m } from "../../../framer-motion";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
import { useMessageMotionProps, } from "./agent-chat-motion";
|
|
8
|
+
export const agentChatAnnouncementVariantIds = [
|
|
9
|
+
"default",
|
|
10
|
+
"info",
|
|
11
|
+
"warning",
|
|
12
|
+
"destructive",
|
|
13
|
+
];
|
|
14
|
+
const agentChatAnnouncementVariants = cva("mx-auto inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs font-medium [&>svg]:size-3.5 [&>svg]:shrink-0", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "border-border bg-muted/60 text-muted-foreground",
|
|
18
|
+
info: "border-primary/20 bg-primary/10 text-primary [&>svg]:text-primary",
|
|
19
|
+
warning: "border-warning/30 bg-warning/10 text-warning [&>svg]:text-warning",
|
|
20
|
+
destructive: "border-destructive/30 bg-destructive/10 text-destructive [&>svg]:text-destructive",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const announcementDefaultIcons = {
|
|
28
|
+
default: null,
|
|
29
|
+
info: _jsx(Info, {}),
|
|
30
|
+
warning: _jsx(AlertTriangle, {}),
|
|
31
|
+
destructive: _jsx(AlertOctagon, {}),
|
|
32
|
+
};
|
|
33
|
+
function AgentChatAnnouncement({ className, variant = "default", icon, children, ref, ...props }) {
|
|
34
|
+
const motionProps = useMessageMotionProps();
|
|
35
|
+
const resolvedIcon = icon === null
|
|
36
|
+
? null
|
|
37
|
+
: icon ?? announcementDefaultIcons[variant ?? "default"];
|
|
38
|
+
return (_jsx(m.div, { ref: ref, "data-slot": "agent-chat-announcement", role: "status", className: cn("flex w-full justify-center", className), ...motionProps, children: _jsxs("div", { className: cn(agentChatAnnouncementVariants({ variant })), ...props, children: [resolvedIcon, _jsx("span", { children: children })] }) }));
|
|
39
|
+
}
|
|
40
|
+
AgentChatAnnouncement.displayName = "AgentChatAnnouncement";
|
|
41
|
+
export { AgentChatAnnouncement };
|
|
42
|
+
//# sourceMappingURL=agent-chat-announcement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-announcement.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-announcement.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAEL,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,SAAS;IACT,MAAM;IACN,SAAS;IACT,aAAa;CACuB,CAAC;AAIvC,MAAM,6B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
+
import { type AgentChatBubbleFromId } from "./agent-chat-message-row";
|
|
3
|
+
import type { MotionDivAttributes } from "./agent-chat-motion";
|
|
4
|
+
export declare const agentChatArtifactMessageLayoutIds: readonly ["stack", "grid"];
|
|
5
|
+
export type AgentChatArtifactMessageLayoutId = (typeof agentChatArtifactMessageLayoutIds)[number];
|
|
6
|
+
export interface AgentChatArtifactMessageProps extends MotionDivAttributes {
|
|
7
|
+
/** Who shared the artifacts. Drives alignment. Default: "assistant". */
|
|
8
|
+
from?: AgentChatBubbleFromId;
|
|
9
|
+
/** Optional avatar slot — render `<Avatar />` here. */
|
|
10
|
+
avatar?: ReactNode;
|
|
11
|
+
/** Optional sender name rendered above the artifacts. */
|
|
12
|
+
senderName?: ReactNode;
|
|
13
|
+
/** Optional timestamp rendered next to the sender name. */
|
|
14
|
+
timestamp?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* `"stack"` lists artifacts one under another at their own size.
|
|
17
|
+
* `"grid"` tiles them in columns at least 10rem wide — give each
|
|
18
|
+
* `AgentChatImage` an `aspectRatio` so the tiles line up. Default: "stack".
|
|
19
|
+
*/
|
|
20
|
+
layout?: AgentChatArtifactMessageLayoutId;
|
|
21
|
+
/** Class applied to the element that lays out the artifacts. */
|
|
22
|
+
contentClassName?: string;
|
|
23
|
+
ref?: Ref<HTMLDivElement>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A transcript row for images and other artifacts — the same avatar and
|
|
27
|
+
* sender header as `AgentChatBubble`, without the colored bubble. Children
|
|
28
|
+
* are typically `AgentChatImage` and `AgentChatArtifact`, but any content
|
|
29
|
+
* works. (Both can also be placed inside an `AgentChatBubble` alongside text.)
|
|
30
|
+
*/
|
|
31
|
+
declare function AgentChatArtifactMessage({ from, layout, contentClassName, children, ...props }: AgentChatArtifactMessageProps): ReactElement;
|
|
32
|
+
declare namespace AgentChatArtifactMessage {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
35
|
+
export { AgentChatArtifactMessage };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
import { AgentChatMessageRow, } from "./agent-chat-message-row";
|
|
6
|
+
export const agentChatArtifactMessageLayoutIds = [
|
|
7
|
+
"stack",
|
|
8
|
+
"grid",
|
|
9
|
+
];
|
|
10
|
+
const agentChatArtifactMessageContentVariants = cva("w-full max-w-[80%]", {
|
|
11
|
+
variants: {
|
|
12
|
+
layout: {
|
|
13
|
+
stack: "flex flex-col gap-2",
|
|
14
|
+
grid: "grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-2",
|
|
15
|
+
},
|
|
16
|
+
from: {
|
|
17
|
+
user: "items-end",
|
|
18
|
+
assistant: "items-start",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
layout: "stack",
|
|
23
|
+
from: "assistant",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* A transcript row for images and other artifacts — the same avatar and
|
|
28
|
+
* sender header as `AgentChatBubble`, without the colored bubble. Children
|
|
29
|
+
* are typically `AgentChatImage` and `AgentChatArtifact`, but any content
|
|
30
|
+
* works. (Both can also be placed inside an `AgentChatBubble` alongside text.)
|
|
31
|
+
*/
|
|
32
|
+
function AgentChatArtifactMessage({ from = "assistant", layout = "stack", contentClassName, children, ...props }) {
|
|
33
|
+
return (_jsx(AgentChatMessageRow, { slot: "agent-chat-artifact-message", from: from, ...props, children: _jsx("div", { "data-slot": "agent-chat-artifact-message-content", "data-layout": layout, className: cn(agentChatArtifactMessageContentVariants({ layout, from }), contentClassName), children: children }) }));
|
|
34
|
+
}
|
|
35
|
+
AgentChatArtifactMessage.displayName = "AgentChatArtifactMessage";
|
|
36
|
+
export { AgentChatArtifactMessage };
|
|
37
|
+
//# sourceMappingURL=agent-chat-artifact-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-artifact-message.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-artifact-message.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,OAAO;IACP,MAAM;CAC8B,CAAC;AAIvC,MAAM,uCAAuC,GAAG,GAAG,CAAC,oBAAoB,EAAE;IACxE,QAAQ,EAAE;QACR,MAAM,EAAE;YACN,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,4DAA4D;SACR;QAC5D,IAAI,EAAE;YACJ,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,aAAa;SACuB;KAClD;IACD,eAAe,EAAE;QACf,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,WAAW;KAClB;CACF,CAAC,CAAC;AAsBH;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,EAChC,IAAI,GAAG,WAAW,EAClB,MAAM,GAAG,OAAO,EAChB,gBAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACsB;IAC9B,OAAO,CACL,KAAC,mBAAmB,IAClB,IAAI,EAAC,6BAA6B,EAClC,IAAI,EAAE,IAAI,KACN,KAAK,YAET,2BACY,qCAAqC,iBAClC,MAAM,EACnB,SAAS,EAAE,EAAE,CACX,uCAAuC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EACzD,gBAAgB,CACjB,YAEA,QAAQ,GACL,GACc,CACvB,CAAC;AACJ,CAAC;AACD,wBAAwB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type HTMLAttributes, type MouseEvent, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type AttachmentCardFileKindId } from "../../ui/attachment-card";
|
|
3
|
+
export interface AgentChatArtifactProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "onClick"> {
|
|
4
|
+
/** The artifact's name — usually a file name. Labels the card's open action. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Secondary line, e.g. `"CSV · 8 rows"`. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The artifact's kind, which picks its icon and color. Inferred from
|
|
10
|
+
* `fileType`, then from `title` when it's a string with an extension.
|
|
11
|
+
*/
|
|
12
|
+
kind?: AttachmentCardFileKindId;
|
|
13
|
+
/** File extension (`"csv"`) or MIME type (`"text/csv"`) used to infer `kind`. */
|
|
14
|
+
fileType?: string;
|
|
15
|
+
/** Replaces the kind icon. */
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/** Thumbnail image shown in place of the icon. */
|
|
18
|
+
previewSrc?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Makes the whole card a button — open a dialog, a side panel, a canvas.
|
|
21
|
+
* Ignored when `href` is set (the link's own click handler instead).
|
|
22
|
+
*/
|
|
23
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
24
|
+
/** Makes the whole card a link. */
|
|
25
|
+
href?: string;
|
|
26
|
+
/** Passed to the link when `href` is set. */
|
|
27
|
+
target?: AnchorHTMLAttributes<HTMLAnchorElement>["target"];
|
|
28
|
+
/** Passed to the link when `href` is set. Default with `target="_blank"`: "noopener noreferrer". */
|
|
29
|
+
rel?: AnchorHTMLAttributes<HTMLAnchorElement>["rel"];
|
|
30
|
+
/**
|
|
31
|
+
* Controls at the card's right edge — download, copy, a menu. They sit
|
|
32
|
+
* above the card's own click target, so clicking them doesn't open it.
|
|
33
|
+
*/
|
|
34
|
+
actions?: ReactNode;
|
|
35
|
+
/** Accessible label of the card's open action. Default: the title's text. */
|
|
36
|
+
openLabel?: string;
|
|
37
|
+
/** Disables the card's open action. */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Class applied to the icon box. */
|
|
40
|
+
iconClassName?: string;
|
|
41
|
+
ref?: Ref<HTMLDivElement>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A file or artifact the agent produced — a CSV, a report, a code bundle —
|
|
45
|
+
* as a compact card. Give it `onClick` or `href` and the whole card opens it;
|
|
46
|
+
* `actions` add secondary controls alongside.
|
|
47
|
+
*/
|
|
48
|
+
declare function AgentChatArtifact({ title, description, kind, fileType, icon, previewSrc, onClick, href, target, rel, actions, openLabel, disabled, className, iconClassName, ref, ...props }: AgentChatArtifactProps): ReactElement;
|
|
49
|
+
declare namespace AgentChatArtifact {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
export { AgentChatArtifact };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { File as FileIcon, FileArchive, FileAudio, FileCode, FileImage, FileJson, FileSpreadsheet, FileText, FileVideo, } from "lucide-react";
|
|
6
|
+
import { inferAttachmentFileKind, } from "../../ui/attachment-card";
|
|
7
|
+
import { cn } from "../../../lib/utils";
|
|
8
|
+
const agentChatArtifactIconVariants = cva("relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md [&>svg]:size-5", {
|
|
9
|
+
variants: {
|
|
10
|
+
kind: {
|
|
11
|
+
image: "bg-sky-500/10 text-sky-600 dark:text-sky-400",
|
|
12
|
+
video: "bg-violet-500/10 text-violet-600 dark:text-violet-400",
|
|
13
|
+
audio: "bg-pink-500/10 text-pink-600 dark:text-pink-400",
|
|
14
|
+
text: "bg-muted text-muted-foreground",
|
|
15
|
+
code: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
16
|
+
archive: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
17
|
+
spreadsheet: "bg-lime-500/10 text-lime-700 dark:bg-lime-500/15 dark:text-lime-300",
|
|
18
|
+
json: "bg-orange-500/10 text-orange-600 dark:text-orange-400",
|
|
19
|
+
pdf: "bg-red-500/10 text-red-600 dark:text-red-400",
|
|
20
|
+
generic: "bg-muted text-muted-foreground",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
kind: "generic",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const agentChatArtifactKindIcons = {
|
|
28
|
+
image: FileImage,
|
|
29
|
+
video: FileVideo,
|
|
30
|
+
audio: FileAudio,
|
|
31
|
+
text: FileText,
|
|
32
|
+
code: FileCode,
|
|
33
|
+
archive: FileArchive,
|
|
34
|
+
spreadsheet: FileSpreadsheet,
|
|
35
|
+
json: FileJson,
|
|
36
|
+
pdf: FileText,
|
|
37
|
+
generic: FileIcon,
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A file or artifact the agent produced — a CSV, a report, a code bundle —
|
|
41
|
+
* as a compact card. Give it `onClick` or `href` and the whole card opens it;
|
|
42
|
+
* `actions` add secondary controls alongside.
|
|
43
|
+
*/
|
|
44
|
+
function AgentChatArtifact({ title, description, kind, fileType, icon, previewSrc, onClick, href, target, rel, actions, openLabel, disabled = false, className, iconClassName, ref, ...props }) {
|
|
45
|
+
const descriptionId = useId();
|
|
46
|
+
const resolvedKind = kind ??
|
|
47
|
+
inferAttachmentFileKind(typeof title === "string" ? title : "", fileType);
|
|
48
|
+
const KindIcon = agentChatArtifactKindIcons[resolvedKind];
|
|
49
|
+
const hasDescription = description !== undefined && description !== null && description !== "";
|
|
50
|
+
const isInteractive = !disabled && (href !== undefined || onClick !== undefined);
|
|
51
|
+
// The open action is stretched over the whole card by its `::after`, so
|
|
52
|
+
// the card is one big click target while `actions` stay clickable above it.
|
|
53
|
+
const triggerClassName = "min-w-0 rounded-sm text-left font-medium outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-ring";
|
|
54
|
+
const titleContent = _jsx("span", { className: "block truncate", children: title });
|
|
55
|
+
const triggerProps = {
|
|
56
|
+
"data-slot": "agent-chat-artifact-trigger",
|
|
57
|
+
"aria-label": openLabel,
|
|
58
|
+
"aria-describedby": hasDescription ? descriptionId : undefined,
|
|
59
|
+
className: triggerClassName,
|
|
60
|
+
};
|
|
61
|
+
let primary;
|
|
62
|
+
if (href !== undefined && !disabled) {
|
|
63
|
+
primary = (_jsx("a", { ...triggerProps, href: href, target: target, rel: rel ?? (target === "_blank" ? "noopener noreferrer" : undefined), onClick: onClick, children: titleContent }));
|
|
64
|
+
}
|
|
65
|
+
else if (onClick !== undefined) {
|
|
66
|
+
primary = (_jsx("button", { ...triggerProps, type: "button", disabled: disabled, onClick: onClick, children: titleContent }));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
primary = (_jsx("span", { className: "min-w-0 font-medium", children: titleContent }));
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs("div", { ref: ref, "data-slot": "agent-chat-artifact", "data-kind": resolvedKind, "data-disabled": disabled || undefined, className: cn("relative flex w-full max-w-sm items-center gap-3 rounded-lg border bg-card p-3 text-sm text-card-foreground shadow-sm transition-colors", isInteractive && "cursor-pointer hover:bg-accent/40", disabled && "opacity-60", className), ...props, children: [_jsx("span", { "aria-hidden": "true", className: cn(agentChatArtifactIconVariants({ kind: resolvedKind }), iconClassName), children: previewSrc ? (_jsx("img", { src: previewSrc, alt: "", loading: "lazy", decoding: "async", className: "absolute inset-0 h-full w-full object-cover" })) : (icon ?? _jsx(KindIcon, {})) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [primary, hasDescription ? (_jsx("span", { id: descriptionId, className: "truncate text-xs text-muted-foreground", children: description })) : null] }), actions !== undefined ? (_jsx("div", { "data-slot": "agent-chat-artifact-actions", className: "relative z-10 flex shrink-0 items-center gap-1", children: actions })) : null] }));
|
|
72
|
+
}
|
|
73
|
+
AgentChatArtifact.displayName = "AgentChatArtifact";
|
|
74
|
+
export { AgentChatArtifact };
|
|
75
|
+
//# sourceMappingURL=agent-chat-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-artifact.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-artifact.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAQL,KAAK,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,6BAA6B,GAAG,GAAG,CACvC,sGAAsG,EACtG;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,KAAK,EAAE,8CAA8C;YACrD,KAAK,EAAE,uDAAuD;YAC9D,KAAK,EAAE,iDAAiD;YACxD,IAAI,EAAE,gCAAgC;YACtC,IAAI,EAAE,0DAA0D;YAChE,OAAO,EAAE,oDAAoD;YAC7D,WAAW,EACT,qEAAqE;YACvE,IAAI,EAAE,uDAAuD;YAC7D,GAAG,EAAE,8CAA8C;YACnD,OAAO,EAAE,gCAAgC;SACS;KACrD;IACD,eAAe,EAAE;QACf,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAEF,MAAM,0BAA0B,GAC9B;IACE,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAA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AS,EAAC,sCAAsC,aACnD,OAAO,EACP,cAAc,CAAC,CAAC,CAAC,CAChB,eACE,EAAE,EAAE,aAAa,EACjB,SAAS,EAAC,wCAAwC,YAEjD,WAAW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,IACH,EACN,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,2BACY,6BAA6B,EACvC,SAAS,EAAC,gDAAgD,YAEzD,OAAO,GACJ,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC;AACD,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { type AgentChatBubbleFromId } from "./agent-chat-message-row";
|
|
3
|
+
import type { MotionDivAttributes } from "./agent-chat-motion";
|
|
4
|
+
export { agentChatBubbleFromIds, type AgentChatBubbleFromId, } from "./agent-chat-message-row";
|
|
5
|
+
export interface AgentChatBubbleProps extends MotionDivAttributes {
|
|
6
|
+
/** Who sent the message. Drives alignment and color. */
|
|
7
|
+
from: AgentChatBubbleFromId;
|
|
8
|
+
/** Optional avatar slot — render `<Avatar />` here. */
|
|
9
|
+
avatar?: ReactNode;
|
|
10
|
+
/** Optional sender name rendered above the bubble. */
|
|
11
|
+
senderName?: ReactNode;
|
|
12
|
+
/** Optional timestamp rendered next to the sender name. */
|
|
13
|
+
timestamp?: ReactNode;
|
|
14
|
+
/** Class applied directly to the colored bubble element. */
|
|
15
|
+
bubbleClassName?: string;
|
|
16
|
+
ref?: Ref<HTMLDivElement>;
|
|
17
|
+
}
|
|
18
|
+
declare function AgentChatBubble({ from, bubbleClassName, children, ...props }: AgentChatBubbleProps): ReactElement;
|
|
19
|
+
declare namespace AgentChatBubble {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
export { AgentChatBubble };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
import { AgentChatMessageRow, } from "./agent-chat-message-row";
|
|
6
|
+
export { agentChatBubbleFromIds, } from "./agent-chat-message-row";
|
|
7
|
+
const agentChatBubbleVariants = cva("max-w-[80%] whitespace-pre-wrap break-words rounded-2xl px-4 py-2.5 text-sm shadow-sm", {
|
|
8
|
+
variants: {
|
|
9
|
+
from: {
|
|
10
|
+
user: "bg-primary text-primary-foreground rounded-br-sm",
|
|
11
|
+
assistant: "bg-muted text-foreground rounded-bl-sm",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
from: "assistant",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
function AgentChatBubble({ from, bubbleClassName, children, ...props }) {
|
|
19
|
+
return (_jsx(AgentChatMessageRow, { slot: "agent-chat-bubble", from: from, ...props, children: _jsx("div", { className: cn(agentChatBubbleVariants({ from }), bubbleClassName), children: children }) }));
|
|
20
|
+
}
|
|
21
|
+
AgentChatBubble.displayName = "AgentChatBubble";
|
|
22
|
+
export { AgentChatBubble };
|
|
23
|
+
//# sourceMappingURL=agent-chat-bubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-bubble.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-bubble.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,sBAAsB,GAEvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,uBAAuB,GAAG,GAAG,CACjC,uFAAuF,EACvF;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,kDAAkD;YACxD,SAAS,EAAE,wCAAwC;SACJ;KAClD;IACD,eAAe,EAAE;QACf,IAAI,EAAE,WAAW;KAClB;CACF,CACF,CAAC;AAgBF,SAAS,eAAe,CAAC,EACvB,IAAI,EACJ,eAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACa;IACrB,OAAO,CACL,KAAC,mBAAmB,IAAC,IAAI,EAAC,mBAAmB,EAAC,IAAI,EAAE,IAAI,KAAM,KAAK,YACjE,cAAK,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,eAAe,CAAC,YACnE,QAAQ,GACL,GACc,CACvB,CAAC;AACJ,CAAC;AACD,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type MotionDivAttributes } from "./agent-chat-motion";
|
|
4
|
+
export declare const agentChatHILMessageToneIds: readonly ["default", "primary", "warning"];
|
|
5
|
+
export type AgentChatHILMessageToneId = (typeof agentChatHILMessageToneIds)[number];
|
|
6
|
+
declare const agentChatHILMessageVariants: (props?: ({
|
|
7
|
+
tone?: "default" | "warning" | "primary" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export interface AgentChatHILMessageProps extends MotionDivAttributes, VariantProps<typeof agentChatHILMessageVariants> {
|
|
10
|
+
/** Small uppercase label rendered at the top of the container. */
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
/** Icon rendered next to the label. Defaults to a Sparkles glyph when label is set. */
|
|
13
|
+
icon?: ReactNode | null;
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
declare function AgentChatHILMessage({ className, tone, label, icon, children, ref, ...props }: AgentChatHILMessageProps): ReactElement;
|
|
17
|
+
declare namespace AgentChatHILMessage {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
export { AgentChatHILMessage };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { Sparkles } from "lucide-react";
|
|
5
|
+
import { m } from "../../../framer-motion";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
import { useMessageMotionProps, } from "./agent-chat-motion";
|
|
8
|
+
export const agentChatHILMessageToneIds = [
|
|
9
|
+
"default",
|
|
10
|
+
"primary",
|
|
11
|
+
"warning",
|
|
12
|
+
];
|
|
13
|
+
const agentChatHILMessageVariants = cva("relative w-full rounded-lg border border-dashed bg-card text-card-foreground p-4 shadow-sm", {
|
|
14
|
+
variants: {
|
|
15
|
+
tone: {
|
|
16
|
+
default: "border-border",
|
|
17
|
+
primary: "border-primary/40 bg-primary/5",
|
|
18
|
+
warning: "border-warning/40 bg-warning/5",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
tone: "default",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function AgentChatHILMessage({ className, tone, label, icon, children, ref, ...props }) {
|
|
26
|
+
const motionProps = useMessageMotionProps();
|
|
27
|
+
const resolvedIcon = icon === null ? null : icon ?? (label ? _jsx(Sparkles, { className: "size-3.5" }) : null);
|
|
28
|
+
const ariaLabel = typeof label === "string" ? label : undefined;
|
|
29
|
+
return (_jsxs(m.div, { ref: ref, "data-slot": "agent-chat-hil-message", role: "group", "aria-label": ariaLabel ?? "Human-in-the-loop request", className: cn(agentChatHILMessageVariants({ tone }), className), ...motionProps, ...props, children: [label !== undefined ? (_jsxs("div", { className: "mb-3 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [resolvedIcon, _jsx("span", { children: label })] })) : null, _jsx("div", { children: children })] }));
|
|
30
|
+
}
|
|
31
|
+
AgentChatHILMessage.displayName = "AgentChatHILMessage";
|
|
32
|
+
export { AgentChatHILMessage };
|
|
33
|
+
//# sourceMappingURL=agent-chat-hil-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-hil-message.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-hil-message.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAEL,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,SAAS;IACT,SAAS;CAC2B,CAAC;AAIvC,MAAM,2BAA2B,GAAG,GAAG,CACrC,4FAA4F,EAC5F;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,gCAAgC;YACzC,OAAO,EAAE,gCAAgC;SACU;KACtD;IACD,eAAe,EAAE;QACf,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAYF,SAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACiB;IACzB,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,MAAM,YAAY,GAChB,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhE,OAAO,CACL,MAAC,CAAC,CAAC,GAAG,IACJ,GAAG,EAAE,GAAG,eACE,wBAAwB,EAClC,IAAI,EAAC,OAAO,gBACA,SAAS,IAAI,2BAA2B,EACpD,SAAS,EAAE,EAAE,CAAC,2BAA2B,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KAC3D,WAAW,KACX,KAAK,aAER,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CACrB,eAAK,SAAS,EAAC,oGAAoG,aAChH,YAAY,EACb,yBAAO,KAAK,GAAQ,IAChB,CACP,CAAC,CAAC,CAAC,IAAI,EACR,wBAAM,QAAQ,GAAO,IACf,CACT,CAAC;AACJ,CAAC;AACD,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the fullscreen viewer `AgentChatImage` opens. Not part of the
|
|
3
|
+
* public API — the package index doesn't re-export this module.
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactElement, ReactNode } from "react";
|
|
6
|
+
import type { AgentChatImageRenderProps } from "./agent-chat-image";
|
|
7
|
+
export interface AgentChatImageViewerProps {
|
|
8
|
+
src: string;
|
|
9
|
+
alt: string;
|
|
10
|
+
caption?: ReactNode;
|
|
11
|
+
renderImage?: (props: AgentChatImageRenderProps) => ReactNode;
|
|
12
|
+
closeLabel: string;
|
|
13
|
+
errorLabel: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** The fullscreen lightbox. Rendered inside the image's `DialogPrimitive.Root`. */
|
|
18
|
+
export declare function AgentChatImageViewer({ src, alt, caption, renderImage, closeLabel, errorLabel, className, onClose, }: AgentChatImageViewerProps): ReactElement;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { ImageOff, LoaderCircle, X } from "lucide-react";
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
|
+
import { useImageLoadState } from "./use-image-load-state";
|
|
7
|
+
/** The fullscreen lightbox. Rendered inside the image's `DialogPrimitive.Root`. */
|
|
8
|
+
export function AgentChatImageViewer({ src, alt, caption, renderImage, closeLabel, errorLabel, className, onClose, }) {
|
|
9
|
+
const { status, onLoad, onError, imgRef } = useImageLoadState(src);
|
|
10
|
+
const imageClassName = cn("min-h-0 max-h-full max-w-full object-contain", status === "error" && "hidden", className);
|
|
11
|
+
// Without a caption there's no Description, so opt out of Radix's
|
|
12
|
+
// missing-description warning.
|
|
13
|
+
const describedByProps = caption === undefined ? { "aria-describedby": undefined } : {};
|
|
14
|
+
// The content spans the screen, so a click on the dark area around the
|
|
15
|
+
// image lands on the content element itself.
|
|
16
|
+
const handleBackdropClick = (event) => {
|
|
17
|
+
if (event.target === event.currentTarget)
|
|
18
|
+
onClose();
|
|
19
|
+
};
|
|
20
|
+
return (_jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/95 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }), _jsxs(DialogPrimitive.Content, { "data-slot": "agent-chat-image-viewer", ...describedByProps, onClick: handleBackdropClick, className: "fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 p-4 outline-none sm:p-10 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: alt }), renderImage ? (renderImage({
|
|
21
|
+
variant: "fullscreen",
|
|
22
|
+
src,
|
|
23
|
+
alt,
|
|
24
|
+
className: imageClassName,
|
|
25
|
+
onLoad,
|
|
26
|
+
onError,
|
|
27
|
+
})) : (_jsx("img", { ref: imgRef, src: src, alt: alt, onLoad: onLoad, onError: onError, className: imageClassName })), status === "loading" ? (_jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 flex items-center justify-center text-white/70", children: _jsx(LoaderCircle, { className: "size-8 animate-spin motion-reduce:animate-none" }) })) : null, status === "error" ? (_jsxs("span", { className: "flex flex-col items-center gap-2 text-sm text-white/80", children: [_jsx(ImageOff, { "aria-hidden": "true", className: "size-8" }), errorLabel] })) : null, caption !== undefined ? (_jsx(DialogPrimitive.Description, { className: "max-w-prose shrink-0 text-center text-sm text-white/80", children: caption })) : null, _jsx(DialogPrimitive.Close, { "aria-label": closeLabel, className: "absolute right-4 top-4 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60", children: _jsx(X, { "aria-hidden": "true", className: "size-5" }) })] })] }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=agent-chat-image-viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-chat-image-viewer.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-image-viewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAQb,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,iBA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AAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,cAAc,GACzB,CACH,EACA,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CACtB,8BACc,MAAM,EAClB,SAAS,EAAC,qFAAqF,YAE/F,KAAC,YAAY,IAAC,SAAS,EAAC,gDAAgD,GAAG,GACtE,CACR,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CACpB,gBAAM,SAAS,EAAC,wDAAwD,aACtE,KAAC,QAAQ,mBAAa,MAAM,EAAC,SAAS,EAAC,QAAQ,GAAG,EACjD,UAAU,IACN,CACR,CAAC,CAAC,CAAC,IAAI,EACP,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,KAAC,eAAe,CAAC,WAAW,IAAC,SAAS,EAAC,wDAAwD,YAC5F,OAAO,GACoB,CAC/B,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,eAAe,CAAC,KAAK,kBACR,UAAU,EACtB,SAAS,EAAC,gLAAgL,YAE1L,KAAC,CAAC,mBAAa,MAAM,EAAC,SAAS,EAAC,QAAQ,GAAG,GACrB,IACA,IACH,CAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type HTMLAttributes, type MouseEvent, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
|
+
export declare const agentChatImageFitIds: readonly ["cover", "contain"];
|
|
3
|
+
export type AgentChatImageFitId = (typeof agentChatImageFitIds)[number];
|
|
4
|
+
export declare const agentChatImageRenderVariantIds: readonly ["preview", "fullscreen"];
|
|
5
|
+
export type AgentChatImageRenderVariantId = (typeof agentChatImageRenderVariantIds)[number];
|
|
6
|
+
/** What `AgentChatImage` hands to `renderImage`. */
|
|
7
|
+
export interface AgentChatImageRenderProps {
|
|
8
|
+
/** Which surface is being drawn: the inline preview or the fullscreen viewer. */
|
|
9
|
+
variant: AgentChatImageRenderVariantId;
|
|
10
|
+
/** `src` for the preview, `fullscreenSrc ?? src` for the viewer. */
|
|
11
|
+
src: string;
|
|
12
|
+
alt: string;
|
|
13
|
+
/** Sizing classes the surface relies on. Put them on your image element. */
|
|
14
|
+
className: string;
|
|
15
|
+
/** Call when the image has loaded. Until then a loading state is shown. */
|
|
16
|
+
onLoad: () => void;
|
|
17
|
+
/** Call if the image fails to load, to show the error state. */
|
|
18
|
+
onError: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentChatImageProps extends Omit<HTMLAttributes<HTMLElement>, "children" | "onClick"> {
|
|
21
|
+
/** Source of the inline preview — typically a downscaled thumbnail. */
|
|
22
|
+
src: string;
|
|
23
|
+
/** Alt text. Also titles the fullscreen viewer for screen readers. */
|
|
24
|
+
alt: string;
|
|
25
|
+
/**
|
|
26
|
+
* Source shown in the fullscreen viewer — typically the full-resolution
|
|
27
|
+
* original. Only fetched once the viewer opens. Default: `src`.
|
|
28
|
+
*/
|
|
29
|
+
fullscreenSrc?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Intrinsic width of the preview image, in px. Together with `height` it
|
|
32
|
+
* reserves the preview's space before the image loads, so the transcript
|
|
33
|
+
* doesn't jump.
|
|
34
|
+
*/
|
|
35
|
+
width?: number;
|
|
36
|
+
/** Intrinsic height of the preview image, in px. See `width`. */
|
|
37
|
+
height?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Fit the preview into a box of this aspect ratio (e.g. `"4 / 3"` or
|
|
40
|
+
* `16 / 9`) that fills the available width. Takes precedence over
|
|
41
|
+
* `width`/`height`. Use it to line images up in a grid.
|
|
42
|
+
*/
|
|
43
|
+
aspectRatio?: number | string;
|
|
44
|
+
/**
|
|
45
|
+
* How the image fills an `aspectRatio` box that doesn't match its own
|
|
46
|
+
* shape. Default: "cover".
|
|
47
|
+
*/
|
|
48
|
+
fit?: AgentChatImageFitId;
|
|
49
|
+
/** The tallest the preview may grow. Numbers are px. Default: 320. */
|
|
50
|
+
previewMaxHeight?: number | string;
|
|
51
|
+
/** Caption shown under the preview and in the fullscreen viewer. */
|
|
52
|
+
caption?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Controls overlaid on the preview's top-right corner, e.g. a download
|
|
55
|
+
* button. They appear on hover or focus on devices that can hover, and
|
|
56
|
+
* stay visible on touch screens.
|
|
57
|
+
*/
|
|
58
|
+
actions?: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Fires when the preview is clicked, before the fullscreen viewer opens.
|
|
61
|
+
* Call `event.preventDefault()` to keep the viewer closed and handle the
|
|
62
|
+
* click yourself — open a side panel, an annotation tool, anything.
|
|
63
|
+
*/
|
|
64
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Turn off the built-in fullscreen viewer. The preview stays clickable
|
|
67
|
+
* when `onClick` is set, and is static otherwise.
|
|
68
|
+
*/
|
|
69
|
+
disableFullscreen?: boolean;
|
|
70
|
+
/** Controlled open state of the fullscreen viewer. */
|
|
71
|
+
open?: boolean;
|
|
72
|
+
/** Initial open state of the fullscreen viewer when uncontrolled. */
|
|
73
|
+
defaultOpen?: boolean;
|
|
74
|
+
/** Called when the fullscreen viewer opens or closes. */
|
|
75
|
+
onOpenChange?: (open: boolean) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Render the image element yourself — e.g. with `next/image` — for the
|
|
78
|
+
* preview and the viewer. Apply the `className` you're given, and call
|
|
79
|
+
* `onLoad` / `onError`, or the loading state never clears.
|
|
80
|
+
*/
|
|
81
|
+
renderImage?: (props: AgentChatImageRenderProps) => ReactNode;
|
|
82
|
+
/** Accessible label of the preview button. Default: "View full size: {alt}". */
|
|
83
|
+
expandLabel?: string;
|
|
84
|
+
/** Accessible label of the viewer's close button. Default: "Close". */
|
|
85
|
+
closeLabel?: string;
|
|
86
|
+
/** Shown in place of an image that failed to load. Default: "Image unavailable". */
|
|
87
|
+
errorLabel?: ReactNode;
|
|
88
|
+
/** Class applied to the preview `<img>`. */
|
|
89
|
+
imageClassName?: string;
|
|
90
|
+
/** Class applied to the `<img>` in the fullscreen viewer. */
|
|
91
|
+
fullscreenClassName?: string;
|
|
92
|
+
ref?: Ref<HTMLElement>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* An image in the transcript — a screenshot, a chart, a generated diagram.
|
|
96
|
+
* Shows a lightweight preview inline and opens `fullscreenSrc` in a
|
|
97
|
+
* fullscreen viewer when clicked. Use `onClick` to add to or replace that.
|
|
98
|
+
*/
|
|
99
|
+
declare function AgentChatImage({ src, alt, fullscreenSrc, width, height, aspectRatio, fit, previewMaxHeight, caption, actions, onClick, disableFullscreen, open, defaultOpen, onOpenChange, renderImage, expandLabel, closeLabel, errorLabel, imageClassName, fullscreenClassName, className, style, ref, ...props }: AgentChatImageProps): ReactElement;
|
|
100
|
+
declare namespace AgentChatImage {
|
|
101
|
+
var displayName: string;
|
|
102
|
+
}
|
|
103
|
+
export { AgentChatImage };
|