@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.
Files changed (66) hide show
  1. package/dist/components/ui/accordion/accordion.d.ts +1 -1
  2. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.d.ts +18 -0
  3. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js +42 -0
  4. package/dist/components/ui/agent-chat-messages/agent-chat-announcement.js.map +1 -0
  5. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.d.ts +35 -0
  6. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js +37 -0
  7. package/dist/components/ui/agent-chat-messages/agent-chat-artifact-message.js.map +1 -0
  8. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.d.ts +52 -0
  9. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js +75 -0
  10. package/dist/components/ui/agent-chat-messages/agent-chat-artifact.js.map +1 -0
  11. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.d.ts +22 -0
  12. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js +23 -0
  13. package/dist/components/ui/agent-chat-messages/agent-chat-bubble.js.map +1 -0
  14. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.d.ts +20 -0
  15. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js +33 -0
  16. package/dist/components/ui/agent-chat-messages/agent-chat-hil-message.js.map +1 -0
  17. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.d.ts +18 -0
  18. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js +29 -0
  19. package/dist/components/ui/agent-chat-messages/agent-chat-image-viewer.js.map +1 -0
  20. package/dist/components/ui/agent-chat-messages/agent-chat-image.d.ts +103 -0
  21. package/dist/components/ui/agent-chat-messages/agent-chat-image.js +92 -0
  22. package/dist/components/ui/agent-chat-messages/agent-chat-image.js.map +1 -0
  23. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.d.ts +24 -0
  24. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js +29 -0
  25. package/dist/components/ui/agent-chat-messages/agent-chat-message-row.js.map +1 -0
  26. package/dist/components/ui/agent-chat-messages/agent-chat-messages.d.ts +1 -67
  27. package/dist/components/ui/agent-chat-messages/agent-chat-messages.js +47 -136
  28. package/dist/components/ui/agent-chat-messages/agent-chat-messages.js.map +1 -1
  29. package/dist/components/ui/agent-chat-messages/agent-chat-motion.d.ts +44 -0
  30. package/dist/components/ui/agent-chat-messages/agent-chat-motion.js +19 -0
  31. package/dist/components/ui/agent-chat-messages/agent-chat-motion.js.map +1 -0
  32. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.d.ts +14 -0
  33. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js +13 -0
  34. package/dist/components/ui/agent-chat-messages/agent-typing-indicator.js.map +1 -0
  35. package/dist/components/ui/agent-chat-messages/index.d.ts +14 -0
  36. package/dist/components/ui/agent-chat-messages/index.js +7 -0
  37. package/dist/components/ui/agent-chat-messages/index.js.map +1 -1
  38. package/dist/components/ui/agent-chat-messages/use-image-load-state.d.ts +13 -0
  39. package/dist/components/ui/agent-chat-messages/use-image-load-state.js +29 -0
  40. package/dist/components/ui/agent-chat-messages/use-image-load-state.js.map +1 -0
  41. package/dist/components/ui/attachment-card/attachment-card.d.ts +2 -2
  42. package/dist/components/ui/badge/badge.d.ts +1 -1
  43. package/dist/components/ui/blockquote/blockquote.d.ts +1 -1
  44. package/dist/components/ui/breadcrumb/breadcrumb.d.ts +1 -1
  45. package/dist/components/ui/button/button.d.ts +1 -1
  46. package/dist/components/ui/chip/chip.d.ts +1 -1
  47. package/dist/components/ui/code-block/code-block.d.ts +1 -1
  48. package/dist/components/ui/collapsible/collapsible-variants.d.ts +3 -3
  49. package/dist/components/ui/floating-action-button/floating-action-button.d.ts +1 -1
  50. package/dist/components/ui/json-viewer/json-viewer.d.ts +1 -1
  51. package/dist/components/ui/number-ticker/number-ticker.d.ts +1 -1
  52. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.d.ts +118 -0
  53. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js +155 -0
  54. package/dist/components/ui/prompt-input/prompt-input-textarea-sizing.js.map +1 -0
  55. package/dist/components/ui/prompt-input/prompt-input-variants.js +3 -1
  56. package/dist/components/ui/prompt-input/prompt-input-variants.js.map +1 -1
  57. package/dist/components/ui/prompt-input/prompt-input.d.ts +22 -1
  58. package/dist/components/ui/prompt-input/prompt-input.js +44 -9
  59. package/dist/components/ui/prompt-input/prompt-input.js.map +1 -1
  60. package/dist/components/ui/scroll-progress/scroll-progress.d.ts +1 -1
  61. package/dist/components/ui/scroll-to-top/scroll-to-top.d.ts +1 -1
  62. package/dist/components/ui/secret-reveal/secret-reveal.d.ts +1 -1
  63. package/dist/components/ui/snippet/snippet.d.ts +1 -1
  64. package/dist/components/ui/toggle/toggle.d.ts +1 -1
  65. package/dist/components/ui/toolbar/toolbar.d.ts +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useState, } from "react";
4
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
5
+ import { ImageOff, Maximize2 } from "lucide-react";
6
+ import { cn } from "../../../lib/utils";
7
+ import { AgentChatImageViewer } from "./agent-chat-image-viewer";
8
+ import { useImageLoadState } from "./use-image-load-state";
9
+ export const agentChatImageFitIds = [
10
+ "cover",
11
+ "contain",
12
+ ];
13
+ export const agentChatImageRenderVariantIds = [
14
+ "preview",
15
+ "fullscreen",
16
+ ];
17
+ /**
18
+ * An image in the transcript — a screenshot, a chart, a generated diagram.
19
+ * Shows a lightweight preview inline and opens `fullscreenSrc` in a
20
+ * fullscreen viewer when clicked. Use `onClick` to add to or replace that.
21
+ */
22
+ function AgentChatImage({ src, alt, fullscreenSrc, width, height, aspectRatio, fit = "cover", previewMaxHeight = 320, caption, actions, onClick, disableFullscreen = false, open, defaultOpen = false, onOpenChange, renderImage, expandLabel, closeLabel = "Close", errorLabel = "Image unavailable", imageClassName, fullscreenClassName, className, style, ref, ...props }) {
23
+ const preview = useImageLoadState(src);
24
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
25
+ const isOpen = open ?? uncontrolledOpen;
26
+ const handleOpenChange = useCallback((next) => {
27
+ if (open === undefined)
28
+ setUncontrolledOpen(next);
29
+ onOpenChange?.(next);
30
+ }, [open, onOpenChange]);
31
+ // "fill": an `aspectRatio` box as wide as the space allows.
32
+ // "intrinsic": the known `width`/`height`, reserved before load.
33
+ // "natural": whatever size the image turns out to be.
34
+ const sizing = aspectRatio !== undefined
35
+ ? "fill"
36
+ : width && height
37
+ ? "intrinsic"
38
+ : "natural";
39
+ const figureStyle = {
40
+ "--agent-chat-image-max-height": typeof previewMaxHeight === "number"
41
+ ? `${previewMaxHeight}px`
42
+ : previewMaxHeight,
43
+ ...style,
44
+ };
45
+ let frameStyle;
46
+ if (sizing === "fill") {
47
+ frameStyle = { aspectRatio };
48
+ }
49
+ else if (sizing === "intrinsic" && width && height) {
50
+ frameStyle = {
51
+ aspectRatio: `${width} / ${height}`,
52
+ // As wide as the image, unless that would make it taller than the cap.
53
+ width: `min(${width}px, calc(var(--agent-chat-image-max-height) * ${width / height}))`,
54
+ };
55
+ }
56
+ const hasViewer = !disableFullscreen;
57
+ const isInteractive = hasViewer || onClick !== undefined;
58
+ const isSettled = preview.status !== "loading";
59
+ const frameClassName = cn("relative block max-w-full overflow-hidden bg-muted/50", sizing === "fill" && "w-full", sizing === "natural" && preview.status !== "loaded" && "min-h-24 min-w-40", isInteractive &&
60
+ "group/agent-chat-image-frame focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", isInteractive && (hasViewer ? "cursor-zoom-in" : "cursor-pointer"));
61
+ const previewClassName = cn(sizing === "natural"
62
+ ? "relative block h-auto w-auto max-w-full max-h-[var(--agent-chat-image-max-height)]"
63
+ : "absolute inset-0 h-full w-full", fit === "contain" ? "object-contain" : "object-cover", preview.status === "error" && "invisible", imageClassName);
64
+ const frameContent = (_jsxs(_Fragment, { children: [!isSettled ? (_jsx("span", { "aria-hidden": "true", className: "absolute inset-0 animate-pulse bg-muted motion-reduce:animate-none" })) : null, renderImage ? (renderImage({
65
+ variant: "preview",
66
+ src,
67
+ alt,
68
+ className: previewClassName,
69
+ onLoad: preview.onLoad,
70
+ onError: preview.onError,
71
+ })) : (_jsx("img", { ref: preview.imgRef, src: src, alt: alt, width: width, height: height, loading: "lazy", decoding: "async", onLoad: preview.onLoad, onError: preview.onError, className: previewClassName })), preview.status === "error" ? (_jsxs("span", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1 p-2 text-center text-xs text-muted-foreground", children: [_jsx(ImageOff, { "aria-hidden": "true", className: "size-5" }), errorLabel] })) : null, isInteractive ? (_jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 flex items-center justify-center bg-black/0 transition-colors group-hover/agent-chat-image-frame:bg-black/15", children: hasViewer ? (_jsx("span", { className: "flex size-9 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition-opacity group-hover/agent-chat-image-frame:opacity-100 group-focus-visible/agent-chat-image-frame:opacity-100", children: _jsx(Maximize2, { className: "size-4" }) })) : null })) : null] }));
72
+ let frame;
73
+ if (hasViewer) {
74
+ frame = (_jsx(DialogPrimitive.Trigger, { "data-slot": "agent-chat-image-trigger", "aria-label": expandLabel ?? `View full size: ${alt}`, onClick: onClick, className: frameClassName, style: frameStyle, children: frameContent }));
75
+ }
76
+ else if (onClick) {
77
+ frame = (_jsx("button", { type: "button", "data-slot": "agent-chat-image-trigger", "aria-label": alt, onClick: onClick, className: frameClassName, style: frameStyle, children: frameContent }));
78
+ }
79
+ else {
80
+ frame = (_jsx("div", { className: frameClassName, style: frameStyle, children: frameContent }));
81
+ }
82
+ const figure = (_jsxs("figure", { ref: ref, "data-slot": "agent-chat-image", "data-status": preview.status, className: cn("group/agent-chat-image relative max-w-full flex-col overflow-hidden rounded-lg border bg-card text-card-foreground shadow-sm", sizing === "fill" ? "flex w-full" : "inline-flex", className), style: figureStyle, ...props, children: [frame, actions !== undefined ? (_jsx("div", { "data-slot": "agent-chat-image-actions", className: "absolute right-2 top-2 flex items-center gap-1 transition-opacity [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-focus-within/agent-chat-image:opacity-100 [@media(hover:hover)]:group-hover/agent-chat-image:opacity-100", children: actions })) : null, caption !== undefined ? (
83
+ // Inline-size containment keeps a long caption from widening the
84
+ // figure past its image; the caption wraps to the image's width.
85
+ _jsx("figcaption", { className: "border-t px-3 py-2 text-xs text-muted-foreground [contain:inline-size]", children: caption })) : null] }));
86
+ if (!hasViewer)
87
+ return figure;
88
+ return (_jsxs(DialogPrimitive.Root, { open: isOpen, onOpenChange: handleOpenChange, children: [figure, _jsx(AgentChatImageViewer, { src: fullscreenSrc ?? src, alt: alt, caption: caption, renderImage: renderImage, closeLabel: closeLabel, errorLabel: errorLabel, className: fullscreenClassName, onClose: () => handleOpenChange(false) })] }));
89
+ }
90
+ AgentChatImage.displayName = "AgentChatImage";
91
+ export { AgentChatImage };
92
+ //# sourceMappingURL=agent-chat-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-image.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-image.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAOL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAA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AG,EAAE,aAAa,IAAI,GAAG,EACzB,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,mBAAmB,EAC9B,OAAO,EAAE,GAAS,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAC5C,IACmB,CACxB,CAAC;AACJ,CAAC;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Internal: the row layout shared by `AgentChatBubble` and
3
+ * `AgentChatArtifactMessage`, and the `from` ids both accept. The ids are
4
+ * public through `agent-chat-bubble`; the row itself is not part of the API.
5
+ */
6
+ import type { ReactElement, ReactNode, Ref } from "react";
7
+ import { type MotionDivAttributes } from "./agent-chat-motion";
8
+ export declare const agentChatBubbleFromIds: readonly ["user", "assistant"];
9
+ export type AgentChatBubbleFromId = (typeof agentChatBubbleFromIds)[number];
10
+ export interface AgentChatMessageRowProps extends MotionDivAttributes {
11
+ /** `data-slot` of the row: names the public component that rendered it. */
12
+ slot: string;
13
+ from: AgentChatBubbleFromId;
14
+ avatar?: ReactNode;
15
+ senderName?: ReactNode;
16
+ timestamp?: ReactNode;
17
+ ref?: Ref<HTMLDivElement>;
18
+ }
19
+ /**
20
+ * The animated row every sender-attributed message shares — avatar, sender
21
+ * and timestamp header, and the column the message body sits in — mirrored
22
+ * for the user's side of the conversation.
23
+ */
24
+ export declare function AgentChatMessageRow({ slot, from, avatar, senderName, timestamp, className, children, ref, ...props }: AgentChatMessageRowProps): ReactElement;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { m } from "../../../framer-motion";
5
+ import { cn } from "../../../lib/utils";
6
+ import { useMessageMotionProps, } from "./agent-chat-motion";
7
+ export const agentChatBubbleFromIds = ["user", "assistant"];
8
+ const agentChatBubbleRowVariants = cva("flex w-full items-end gap-2", {
9
+ variants: {
10
+ from: {
11
+ user: "flex-row-reverse",
12
+ assistant: "flex-row",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ from: "assistant",
17
+ },
18
+ });
19
+ /**
20
+ * The animated row every sender-attributed message shares — avatar, sender
21
+ * and timestamp header, and the column the message body sits in — mirrored
22
+ * for the user's side of the conversation.
23
+ */
24
+ export function AgentChatMessageRow({ slot, from, avatar, senderName, timestamp, className, children, ref, ...props }) {
25
+ const motionProps = useMessageMotionProps();
26
+ const hasHeader = senderName !== undefined || timestamp !== undefined;
27
+ return (_jsxs(m.div, { ref: ref, "data-slot": slot, "data-from": from, className: cn(agentChatBubbleRowVariants({ from }), className), ...motionProps, ...props, children: [avatar ? (_jsx("div", { className: "shrink-0", "aria-hidden": "true", children: avatar })) : null, _jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-1", from === "user" ? "items-end" : "items-start"), children: [hasHeader ? (_jsxs("div", { className: cn("flex items-baseline gap-2 px-1 text-xs text-muted-foreground", from === "user" ? "flex-row-reverse" : "flex-row"), children: [senderName ? (_jsx("span", { className: "font-medium text-foreground", children: senderName })) : null, timestamp ? _jsx("span", { children: timestamp }) : null] })) : null, children] })] }));
28
+ }
29
+ //# sourceMappingURL=agent-chat-message-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-message-row.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-message-row.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AASb,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,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,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C,CAAC,CAAC,IAAI,EACP,SAAS,CAAC,CAAC,CAAC,yBAAO,SAAS,GAAQ,CAAC,CAAC,CAAC,IAAI,IACxC,CACP,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,IACL,IACA,CACT,CAAC;AACJ,CAAC"}
@@ -1,11 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
- /**
4
- * Native HTML div attributes without the handlers that framer-motion's
5
- * `m.div` overloads (drag/animation events). Spreading these props onto
6
- * `m.div` otherwise causes a type conflict.
7
- */
8
- type MotionDivAttributes = Omit<HTMLAttributes<HTMLDivElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration">;
9
3
  export declare const agentChatMessagesSpacingIds: readonly ["compact", "default", "relaxed"];
10
4
  export type AgentChatMessagesSpacingId = (typeof agentChatMessagesSpacingIds)[number];
11
5
  declare const agentChatMessagesStackVariants: (props?: ({
@@ -32,64 +26,4 @@ declare function AgentChatMessages({ children, className, stackClassName, spacin
32
26
  declare namespace AgentChatMessages {
33
27
  var displayName: string;
34
28
  }
35
- export declare const agentChatBubbleFromIds: readonly ["user", "assistant"];
36
- export type AgentChatBubbleFromId = (typeof agentChatBubbleFromIds)[number];
37
- export interface AgentChatBubbleProps extends MotionDivAttributes {
38
- /** Who sent the message. Drives alignment and color. */
39
- from: AgentChatBubbleFromId;
40
- /** Optional avatar slot — render `<Avatar />` here. */
41
- avatar?: ReactNode;
42
- /** Optional sender name rendered above the bubble. */
43
- senderName?: ReactNode;
44
- /** Optional timestamp rendered next to the sender name. */
45
- timestamp?: ReactNode;
46
- /** Class applied directly to the colored bubble element. */
47
- bubbleClassName?: string;
48
- ref?: Ref<HTMLDivElement>;
49
- }
50
- declare function AgentChatBubble({ from, avatar, senderName, timestamp, className, bubbleClassName, children, ref, ...props }: AgentChatBubbleProps): ReactElement;
51
- declare namespace AgentChatBubble {
52
- var displayName: string;
53
- }
54
- export interface AgentTypingIndicatorProps extends MotionDivAttributes {
55
- /** Optional avatar slot — render `<Avatar />` here. */
56
- avatar?: ReactNode;
57
- /** Accessible label announced by screen readers. */
58
- label?: string;
59
- ref?: Ref<HTMLDivElement>;
60
- }
61
- declare function AgentTypingIndicator({ avatar, label, className, ref, ...props }: AgentTypingIndicatorProps): ReactElement;
62
- declare namespace AgentTypingIndicator {
63
- var displayName: string;
64
- }
65
- export declare const agentChatAnnouncementVariantIds: readonly ["default", "info", "warning", "destructive"];
66
- export type AgentChatAnnouncementVariantId = (typeof agentChatAnnouncementVariantIds)[number];
67
- declare const agentChatAnnouncementVariants: (props?: ({
68
- variant?: "default" | "info" | "warning" | "destructive" | null | undefined;
69
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
70
- export interface AgentChatAnnouncementProps extends MotionDivAttributes, VariantProps<typeof agentChatAnnouncementVariants> {
71
- /** Override the default icon. Pass `null` to hide the icon. */
72
- icon?: ReactNode | null;
73
- ref?: Ref<HTMLDivElement>;
74
- }
75
- declare function AgentChatAnnouncement({ className, variant, icon, children, ref, ...props }: AgentChatAnnouncementProps): ReactElement;
76
- declare namespace AgentChatAnnouncement {
77
- var displayName: string;
78
- }
79
- export declare const agentChatHILMessageToneIds: readonly ["default", "primary", "warning"];
80
- export type AgentChatHILMessageToneId = (typeof agentChatHILMessageToneIds)[number];
81
- declare const agentChatHILMessageVariants: (props?: ({
82
- tone?: "default" | "warning" | "primary" | null | undefined;
83
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
84
- export interface AgentChatHILMessageProps extends MotionDivAttributes, VariantProps<typeof agentChatHILMessageVariants> {
85
- /** Small uppercase label rendered at the top of the container. */
86
- label?: ReactNode;
87
- /** Icon rendered next to the label. Defaults to a Sparkles glyph when label is set. */
88
- icon?: ReactNode | null;
89
- ref?: Ref<HTMLDivElement>;
90
- }
91
- declare function AgentChatHILMessage({ className, tone, label, icon, children, ref, ...props }: AgentChatHILMessageProps): ReactElement;
92
- declare namespace AgentChatHILMessage {
93
- var displayName: string;
94
- }
95
- export { AgentChatMessages, AgentChatBubble, AgentTypingIndicator, AgentChatAnnouncement, AgentChatHILMessage, };
29
+ export { AgentChatMessages };
@@ -1,14 +1,10 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Children, useCallback, useEffect, useRef, } from "react";
4
4
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
5
5
  import { cva } from "class-variance-authority";
6
- import { Info, AlertTriangle, AlertOctagon, Sparkles } from "lucide-react";
7
- import { AnimatePresence, domAnimation, LazyMotion, m, useReducedMotion, } from "../../../framer-motion";
6
+ import { AnimatePresence, domAnimation, LazyMotion, useReducedMotion, } from "../../../framer-motion";
8
7
  import { cn } from "../../../lib/utils";
9
- /* ------------------------------------------------------------------ */
10
- /* Container */
11
- /* ------------------------------------------------------------------ */
12
8
  export const agentChatMessagesSpacingIds = [
13
9
  "compact",
14
10
  "default",
@@ -28,153 +24,68 @@ const agentChatMessagesStackVariants = cva("flex flex-col px-4 py-4 min-h-full",
28
24
  });
29
25
  function AgentChatMessages({ children, className, stackClassName, spacing, autoScroll = true, autoScrollThreshold = 64, ref, ...props }) {
30
26
  const viewportRef = useRef(null);
31
- const sentinelRef = useRef(null);
27
+ const stackRef = useRef(null);
32
28
  const stickToBottomRef = useRef(true);
29
+ const lastScrollTopRef = useRef(0);
33
30
  const hasMountedRef = useRef(false);
34
31
  const prefersReducedMotion = useReducedMotion();
35
32
  const childCount = Children.count(children);
36
33
  const ariaLabel = props["aria-label"] ?? "Chat transcript";
34
+ // Scrolls only the transcript's own viewport. `scrollIntoView` would also
35
+ // scroll every scrollable ancestor, jumping the whole page to the chat.
36
+ const scrollToBottom = useCallback((behavior) => {
37
+ const viewport = viewportRef.current;
38
+ if (!viewport)
39
+ return;
40
+ viewport.scrollTo({ top: viewport.scrollHeight, behavior });
41
+ }, []);
37
42
  const handleScroll = useCallback(() => {
38
43
  const viewport = viewportRef.current;
39
44
  if (!viewport)
40
45
  return;
41
- const distanceFromBottom = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;
42
- stickToBottomRef.current = distanceFromBottom <= autoScrollThreshold;
46
+ const { scrollTop, scrollHeight, clientHeight } = viewport;
47
+ const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
48
+ if (distanceFromBottom <= autoScrollThreshold) {
49
+ stickToBottomRef.current = true;
50
+ }
51
+ else if (scrollTop < lastScrollTopRef.current) {
52
+ // Only scrolling up unpins. A smooth scroll toward the bottom passes
53
+ // through positions far from it, and must stay pinned on the way down.
54
+ stickToBottomRef.current = false;
55
+ }
56
+ lastScrollTopRef.current = scrollTop;
43
57
  }, [autoScrollThreshold]);
44
58
  useEffect(() => {
45
59
  if (!autoScroll)
46
60
  return;
47
- const sentinel = sentinelRef.current;
48
- if (!sentinel)
49
- return;
50
61
  const behavior = !hasMountedRef.current || prefersReducedMotion ? "auto" : "smooth";
51
62
  if (!hasMountedRef.current || stickToBottomRef.current) {
52
- sentinel.scrollIntoView({ block: "end", behavior });
63
+ scrollToBottom(behavior);
53
64
  }
54
65
  hasMountedRef.current = true;
55
- }, [autoScroll, childCount, prefersReducedMotion]);
56
- return (_jsxs(ScrollAreaPrimitive.Root, { ref: ref, "data-slot": "agent-chat-messages", className: cn("relative h-full w-full overflow-hidden", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: viewportRef, onScroll: handleScroll, "data-slot": "agent-chat-messages-viewport", className: "h-full w-full focus-visible:outline-none", children: _jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsxs("div", { role: "log", "aria-live": "polite", "aria-relevant": "additions", "aria-atomic": "false", "aria-label": ariaLabel, className: cn(agentChatMessagesStackVariants({ spacing }), stackClassName), children: [_jsx(AnimatePresence, { initial: false, children: children }), _jsx("div", { ref: sentinelRef, "aria-hidden": "true", className: "h-px w-full" })] }) }) }), _jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { orientation: "vertical", className: "flex h-full w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none", children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
66
+ }, [autoScroll, childCount, prefersReducedMotion, scrollToBottom]);
67
+ // Messages also grow without a new one arriving: an image finishes
68
+ // loading, or a reply streams in. Keep a pinned transcript pinned.
69
+ useEffect(() => {
70
+ if (!autoScroll)
71
+ return;
72
+ const stack = stackRef.current;
73
+ if (!stack || typeof ResizeObserver === "undefined")
74
+ return;
75
+ let lastHeight = stack.offsetHeight;
76
+ const observer = new ResizeObserver(() => {
77
+ const height = stack.offsetHeight;
78
+ const grew = height > lastHeight;
79
+ lastHeight = height;
80
+ if (grew && stickToBottomRef.current) {
81
+ scrollToBottom(prefersReducedMotion ? "auto" : "smooth");
82
+ }
83
+ });
84
+ observer.observe(stack);
85
+ return () => observer.disconnect();
86
+ }, [autoScroll, prefersReducedMotion, scrollToBottom]);
87
+ return (_jsxs(ScrollAreaPrimitive.Root, { ref: ref, "data-slot": "agent-chat-messages", className: cn("relative h-full w-full overflow-hidden", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: viewportRef, onScroll: handleScroll, "data-slot": "agent-chat-messages-viewport", className: "h-full w-full focus-visible:outline-none", children: _jsx(LazyMotion, { features: domAnimation, strict: true, children: _jsx("div", { ref: stackRef, role: "log", "aria-live": "polite", "aria-relevant": "additions", "aria-atomic": "false", "aria-label": ariaLabel, className: cn(agentChatMessagesStackVariants({ spacing }), stackClassName), children: _jsx(AnimatePresence, { initial: false, children: children }) }) }) }), _jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { orientation: "vertical", className: "flex h-full w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none", children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" }) }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
57
88
  }
58
89
  AgentChatMessages.displayName = "AgentChatMessages";
59
- /* ------------------------------------------------------------------ */
60
- /* Shared motion props */
61
- /* ------------------------------------------------------------------ */
62
- const messageMotionProps = {
63
- initial: { opacity: 0, y: 8 },
64
- animate: { opacity: 1, y: 0 },
65
- exit: { opacity: 0, y: -4 },
66
- transition: { duration: 0.18, ease: "easeOut" },
67
- };
68
- const reducedMotionProps = {
69
- initial: false,
70
- animate: { opacity: 1 },
71
- exit: { opacity: 0 },
72
- transition: { duration: 0 },
73
- };
74
- function useMessageMotionProps() {
75
- const reduced = useReducedMotion();
76
- return reduced ? reducedMotionProps : messageMotionProps;
77
- }
78
- /* ------------------------------------------------------------------ */
79
- /* Bubble */
80
- /* ------------------------------------------------------------------ */
81
- export const agentChatBubbleFromIds = ["user", "assistant"];
82
- const agentChatBubbleRowVariants = cva("flex w-full items-end gap-2", {
83
- variants: {
84
- from: {
85
- user: "flex-row-reverse",
86
- assistant: "flex-row",
87
- },
88
- },
89
- defaultVariants: {
90
- from: "assistant",
91
- },
92
- });
93
- const agentChatBubbleVariants = cva("max-w-[80%] whitespace-pre-wrap break-words rounded-2xl px-4 py-2.5 text-sm shadow-sm", {
94
- variants: {
95
- from: {
96
- user: "bg-primary text-primary-foreground rounded-br-sm",
97
- assistant: "bg-muted text-foreground rounded-bl-sm",
98
- },
99
- },
100
- defaultVariants: {
101
- from: "assistant",
102
- },
103
- });
104
- function AgentChatBubble({ from, avatar, senderName, timestamp, className, bubbleClassName, children, ref, ...props }) {
105
- const motionProps = useMessageMotionProps();
106
- const hasHeader = senderName !== undefined || timestamp !== undefined;
107
- return (_jsxs(m.div, { ref: ref, "data-slot": "agent-chat-bubble", "data-from": from, className: cn(agentChatBubbleRowVariants({ from }), className), ...motionProps, ...props, children: [avatar ? (_jsx("div", { className: "shrink-0", "aria-hidden": "true", children: avatar })) : null, _jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-1", from === "user" ? "items-end" : "items-start"), children: [hasHeader ? (_jsxs("div", { className: cn("flex items-baseline gap-2 px-1 text-xs text-muted-foreground", from === "user" ? "flex-row-reverse" : "flex-row"), children: [senderName ? (_jsx("span", { className: "font-medium text-foreground", children: senderName })) : null, timestamp ? _jsx("span", { children: timestamp }) : null] })) : null, _jsx("div", { className: cn(agentChatBubbleVariants({ from }), bubbleClassName), children: children })] })] }));
108
- }
109
- AgentChatBubble.displayName = "AgentChatBubble";
110
- function AgentTypingIndicator({ avatar, label = "Assistant is typing", className, ref, ...props }) {
111
- const motionProps = useMessageMotionProps();
112
- const prefersReducedMotion = useReducedMotion();
113
- return (_jsxs(m.div, { ref: ref, "data-slot": "agent-typing-indicator", role: "status", "aria-live": "polite", "aria-label": label, className: cn("flex w-full items-end gap-2", className), ...motionProps, ...props, children: [avatar ? (_jsx("div", { className: "shrink-0", "aria-hidden": "true", children: avatar })) : null, _jsx("div", { className: "inline-flex items-center gap-1 rounded-2xl rounded-bl-sm bg-muted px-4 py-3 text-foreground shadow-sm", children: prefersReducedMotion ? (_jsx("span", { "aria-hidden": "true", className: "text-sm leading-none text-muted-foreground", children: "\u2026" })) : (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce motion-reduce:animate-none" }), _jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms] motion-reduce:animate-none" }), _jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms] motion-reduce:animate-none" })] })) })] }));
114
- }
115
- AgentTypingIndicator.displayName = "AgentTypingIndicator";
116
- /* ------------------------------------------------------------------ */
117
- /* Announcement */
118
- /* ------------------------------------------------------------------ */
119
- export const agentChatAnnouncementVariantIds = [
120
- "default",
121
- "info",
122
- "warning",
123
- "destructive",
124
- ];
125
- 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", {
126
- variants: {
127
- variant: {
128
- default: "border-border bg-muted/60 text-muted-foreground",
129
- info: "border-primary/20 bg-primary/10 text-primary [&>svg]:text-primary",
130
- warning: "border-warning/30 bg-warning/10 text-warning [&>svg]:text-warning",
131
- destructive: "border-destructive/30 bg-destructive/10 text-destructive [&>svg]:text-destructive",
132
- },
133
- },
134
- defaultVariants: {
135
- variant: "default",
136
- },
137
- });
138
- const announcementDefaultIcons = {
139
- default: null,
140
- info: _jsx(Info, {}),
141
- warning: _jsx(AlertTriangle, {}),
142
- destructive: _jsx(AlertOctagon, {}),
143
- };
144
- function AgentChatAnnouncement({ className, variant = "default", icon, children, ref, ...props }) {
145
- const motionProps = useMessageMotionProps();
146
- const resolvedIcon = icon === null
147
- ? null
148
- : icon ?? announcementDefaultIcons[variant ?? "default"];
149
- 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 })] }) }));
150
- }
151
- AgentChatAnnouncement.displayName = "AgentChatAnnouncement";
152
- /* ------------------------------------------------------------------ */
153
- /* Human-in-the-loop message */
154
- /* ------------------------------------------------------------------ */
155
- export const agentChatHILMessageToneIds = [
156
- "default",
157
- "primary",
158
- "warning",
159
- ];
160
- const agentChatHILMessageVariants = cva("relative w-full rounded-lg border border-dashed bg-card text-card-foreground p-4 shadow-sm", {
161
- variants: {
162
- tone: {
163
- default: "border-border",
164
- primary: "border-primary/40 bg-primary/5",
165
- warning: "border-warning/40 bg-warning/5",
166
- },
167
- },
168
- defaultVariants: {
169
- tone: "default",
170
- },
171
- });
172
- function AgentChatHILMessage({ className, tone, label, icon, children, ref, ...props }) {
173
- const motionProps = useMessageMotionProps();
174
- const resolvedIcon = icon === null ? null : icon ?? (label ? _jsx(Sparkles, { className: "size-3.5" }) : null);
175
- const ariaLabel = typeof label === "string" ? label : undefined;
176
- 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 })] }));
177
- }
178
- AgentChatHILMessage.displayName = "AgentChatHILMessage";
179
- export { AgentChatMessages, AgentChatBubble, AgentTypingIndicator, AgentChatAnnouncement, AgentChatHILMessage, };
90
+ export { AgentChatMessages };
180
91
  //# sourceMappingURL=agent-chat-messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-chat-messages.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-messages.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,QAAQ,EAKR,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,CAAC,EACD,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAiBjC,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,SAAS;IACT,SAAS;CAC2B,CAAC;AAIvC,MAAM,8BAA8B,GAAG,GAAG,CACxC,oCAA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AAC,WAAW,GAAG,qBAAqB,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,CAAC"}
1
+ {"version":3,"file":"agent-chat-messages.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-messages.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,QAAQ,EAKR,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,SAAS;IACT,SAAS;CAC2B,CAAC;AAIvC,MAAM,8BAA8B,GAAG,GAAG,CACxC,oCAAoC,EACpC;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACoC;KACvD;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;KACnB;CACF,CACF,CAAC;AAsBF,SAAS,iBAAiB,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,OAAO,EACP,UAAU,GAAG,IAAI,EACjB,mBAAmB,GAAG,EAAE,EACxB,GAAG,EACH,GAAG,KAAK,EACe;IACvB,MAAM,WAAW,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACrD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,gBAAgB,GAAG,MAA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ACL,MAAC,mBAAmB,CAAC,IAAI,IACvB,GAAG,EAAE,GAAG,eACE,qBAAqB,EAC/B,SAAS,EAAE,EAAE,CAAC,wCAAwC,EAAE,SAAS,CAAC,KAC9D,KAAK,aAET,KAAC,mBAAmB,CAAC,QAAQ,IAC3B,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,YAAY,eACZ,8BAA8B,EACxC,SAAS,EAAC,0CAA0C,YAEpD,KAAC,UAAU,IAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,kBACxC,cACE,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,KAAK,eACA,QAAQ,mBACJ,WAAW,iBACb,OAAO,gBACP,SAAS,EACrB,SAAS,EAAE,EAAE,CACX,8BAA8B,CAAC,EAAE,OAAO,EAAE,CAAC,EAC3C,cAAc,CACf,YAED,KAAC,eAAe,IAAC,OAAO,EAAE,KAAK,YAAG,QAAQ,GAAmB,GACzD,GACK,GACgB,EAC/B,KAAC,mBAAmB,CAAC,mBAAmB,IACtC,WAAW,EAAC,UAAU,EACtB,SAAS,EAAC,+FAA+F,YAEzG,KAAC,mBAAmB,CAAC,eAAe,IAAC,SAAS,EAAC,wCAAwC,GAAG,GAClD,EAC1C,KAAC,mBAAmB,CAAC,MAAM,KAAG,IACL,CAC5B,CAAC;AACJ,CAAC;AACD,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Internal: the entrance/exit animation every transcript message shares, and
3
+ * the div attributes those motion components accept. Not part of the public
4
+ * API — the package index doesn't re-export this module.
5
+ */
6
+ import type { HTMLAttributes } from "react";
7
+ /**
8
+ * Native HTML div attributes without the handlers that framer-motion's
9
+ * `m.div` overloads (drag/animation events). Spreading these props onto
10
+ * `m.div` otherwise causes a type conflict.
11
+ */
12
+ export type MotionDivAttributes = Omit<HTMLAttributes<HTMLDivElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration">;
13
+ declare const messageMotionProps: {
14
+ initial: {
15
+ opacity: number;
16
+ y: number;
17
+ };
18
+ animate: {
19
+ opacity: number;
20
+ y: number;
21
+ };
22
+ exit: {
23
+ opacity: number;
24
+ y: number;
25
+ };
26
+ transition: {
27
+ duration: number;
28
+ ease: "easeOut";
29
+ };
30
+ };
31
+ declare const reducedMotionProps: {
32
+ initial: false;
33
+ animate: {
34
+ opacity: number;
35
+ };
36
+ exit: {
37
+ opacity: number;
38
+ };
39
+ transition: {
40
+ duration: number;
41
+ };
42
+ };
43
+ export declare function useMessageMotionProps(): typeof messageMotionProps | typeof reducedMotionProps;
44
+ export {};
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useReducedMotion } from "../../../framer-motion";
3
+ const messageMotionProps = {
4
+ initial: { opacity: 0, y: 8 },
5
+ animate: { opacity: 1, y: 0 },
6
+ exit: { opacity: 0, y: -4 },
7
+ transition: { duration: 0.18, ease: "easeOut" },
8
+ };
9
+ const reducedMotionProps = {
10
+ initial: false,
11
+ animate: { opacity: 1 },
12
+ exit: { opacity: 0 },
13
+ transition: { duration: 0 },
14
+ };
15
+ export function useMessageMotionProps() {
16
+ const reduced = useReducedMotion();
17
+ return reduced ? reducedMotionProps : messageMotionProps;
18
+ }
19
+ //# sourceMappingURL=agent-chat-motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-chat-motion.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-chat-motion.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AASb,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAiBnD,MAAM,kBAAkB,GAAG;IACzB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC7B,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;IAC3B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAkB,EAAE;CACzD,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,OAAO,EAAE,KAAc;IACvB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;IACvB,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;IACpB,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;CAC5B,CAAC;AAEF,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IACnC,OAAO,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ReactElement, ReactNode, Ref } from "react";
2
+ import { type MotionDivAttributes } from "./agent-chat-motion";
3
+ export interface AgentTypingIndicatorProps extends MotionDivAttributes {
4
+ /** Optional avatar slot — render `<Avatar />` here. */
5
+ avatar?: ReactNode;
6
+ /** Accessible label announced by screen readers. */
7
+ label?: string;
8
+ ref?: Ref<HTMLDivElement>;
9
+ }
10
+ declare function AgentTypingIndicator({ avatar, label, className, ref, ...props }: AgentTypingIndicatorProps): ReactElement;
11
+ declare namespace AgentTypingIndicator {
12
+ var displayName: string;
13
+ }
14
+ export { AgentTypingIndicator };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { m, useReducedMotion } from "../../../framer-motion";
4
+ import { cn } from "../../../lib/utils";
5
+ import { useMessageMotionProps, } from "./agent-chat-motion";
6
+ function AgentTypingIndicator({ avatar, label = "Assistant is typing", className, ref, ...props }) {
7
+ const motionProps = useMessageMotionProps();
8
+ const prefersReducedMotion = useReducedMotion();
9
+ return (_jsxs(m.div, { ref: ref, "data-slot": "agent-typing-indicator", role: "status", "aria-live": "polite", "aria-label": label, className: cn("flex w-full items-end gap-2", className), ...motionProps, ...props, children: [avatar ? (_jsx("div", { className: "shrink-0", "aria-hidden": "true", children: avatar })) : null, _jsx("div", { className: "inline-flex items-center gap-1 rounded-2xl rounded-bl-sm bg-muted px-4 py-3 text-foreground shadow-sm", children: prefersReducedMotion ? (_jsx("span", { "aria-hidden": "true", className: "text-sm leading-none text-muted-foreground", children: "\u2026" })) : (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce motion-reduce:animate-none" }), _jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms] motion-reduce:animate-none" }), _jsx("span", { "aria-hidden": "true", className: "h-2 w-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms] motion-reduce:animate-none" })] })) })] }));
10
+ }
11
+ AgentTypingIndicator.displayName = "AgentTypingIndicator";
12
+ export { AgentTypingIndicator };
13
+ //# sourceMappingURL=agent-typing-indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-typing-indicator.js","sourceRoot":"","sources":["../../../../src/components/ui/agent-chat-messages/agent-typing-indicator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,CAAC,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAEL,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAU7B,SAAS,oBAAoB,CAAC,EAC5B,MAAM,EACN,KAAK,GAAG,qBAAqB,EAC7B,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACkB;IAC1B,MAAM,WAAW,GAAG,qBAAqB,EAAE,CAAC;IAC5C,MAAM,oBAAoB,GAAG,gBAAgB,EAAE,CAAC;IAEhD,OAAO,CACL,MAAC,CAAC,CAAC,GAAG,IACJ,GAAG,EAAE,GAAG,eACE,wBAAwB,EAClC,IAAI,EAAC,QAAQ,eACH,QAAQ,gBACN,KAAK,EACjB,SAAS,EAAE,EAAE,CAAC,6BAA6B,EAAE,SAAS,CAAC,KACnD,WAAW,KACX,KAAK,aAER,MAAM,CAAC,CAAC,CAAC,CACR,cAAK,SAAS,EAAC,UAAU,iBAAa,MAAM,YACzC,MAAM,GACH,CACP,CAAC,CAAC,CAAC,IAAI,EACR,cAAK,SAAS,EAAC,uGAAuG,YACnH,oBAAoB,CAAC,CAAC,CAAC,CACtB,8BACc,MAAM,EAClB,SAAS,EAAC,4CAA4C,uBAGjD,CACR,CAAC,CAAC,CAAC,CACF,8BACE,8BACc,MAAM,EAClB,SAAS,EAAC,oFAAoF,GAC9F,EACF,8BACc,MAAM,EAClB,SAAS,EAAC,4GAA4G,GACtH,EACF,8BACc,MAAM,EAClB,SAAS,EAAC,4GAA4G,GACtH,IACD,CACJ,GACG,IACA,CACT,CAAC;AACJ,CAAC;AACD,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,CAAC"}