import * as React from 'react';
import type { AgMessage } from '../types.js';
import { AiRenderersProvider } from '../renderers.js';
import type { ThreadScrollApi } from './useThreadScroll.js';
export interface ThreadLabels {
conversation?: string;
newMessages?: (n: number) => string;
/**
* @deprecated Ignored since REQ-SURF-108: the JumpToLatest pill's accessible
* name is its visible text (`newMessages(n)`, WCAG 2.5.3 label-in-name).
*/
jumpToLatest?: string;
empty?: string;
}
export interface ThreadRootProps {
/** Messages in chronological order. */
messages: readonly AgMessage[];
/** Accessible name of the conversation log. */
label?: string | undefined;
/** Distance from the bottom, in CSS pixels, within which the thread stays pinned to new messages. */
pinThreshold?: number | undefined;
/** Message count above which the log is virtualized. */
virtualizeAfter?: number | undefined;
/** Called when the top of the log scrolls into view (load older messages). */
onReachTop?: (() => void) | undefined;
/** BCP 47 locale used for message timestamps. */
locale?: string | undefined;
/** IANA time zone used for message timestamps. */
timeZone?: string | undefined;
/** Overrides for the built-in, localizable UI strings. */
labels?: ThreadLabels | undefined;
/** Class name merged onto the root element. */
className?: string | undefined;
/** Defaults to ``. */
children?: React.ReactNode;
/** Ref to the rendered root element. */
ref?: React.Ref;
}
export type ThreadHandle = ThreadScrollApi;
/**
* REQ-SURF-107: the `role="log"` scroll container. Owns the scroll ref, the
* scroll handler and both sentinels; there is exactly one per Thread.
*/
export declare function ThreadViewport({ children }: {
children?: React.ReactNode;
}): React.JSX.Element;
export interface ThreadItemsProps {
/** Render prop: defaults to . */
render?: ((message: AgMessage) => React.ReactNode) | undefined;
}
/**
* Renders every message through one renderer, virtualized or not, so
* `RenderersProvider` overrides and `render` apply above `virtualizeAfter`.
*/
export declare function ThreadItems({ render }: ThreadItemsProps): React.JSX.Element;
export declare function ThreadEmpty({ children }: {
children?: React.ReactNode;
}): React.JSX.Element;
export declare function ThreadJumpToLatest(props: Omit, 'onChange'>): React.JSX.Element;
/**
* REQ-SURF-107..110: compound root. Renders
* `` unless composed;
* pinned follow on content growth; one scroll container when virtualized
* (VirtualList scrolls the log); `onReachTop` once per top-sentinel entry;
* imperative `ThreadHandle`.
*/
export declare function ThreadRoot({ messages, label, pinThreshold, virtualizeAfter, onReachTop, locale, timeZone, labels, className, children, ref, }: ThreadRootProps): React.JSX.Element;
export interface ThreadComponent {
(props: ThreadRootProps): React.ReactElement;
Root: typeof ThreadRoot;
Viewport: typeof ThreadViewport;
Items: typeof ThreadItems;
Empty: typeof ThreadEmpty;
JumpToLatest: typeof ThreadJumpToLatest;
RenderersProvider: typeof AiRenderersProvider;
}
export declare const Thread: ThreadComponent;
//# sourceMappingURL=Thread.d.ts.map