@promptbook/remote-client
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
62 lines (61 loc) • 1.98 kB
TypeScript
import { type MutableRefObject, type UIEvent } from 'react';
/**
* Configuration for tracking action button overlap and scroll state.
*
* @private component of `<Chat/>`
*/
export type ChatActionsOverlapConfig = {
/**
* Provides the chat messages container ref for auto-scroll integration.
*/
chatMessagesRef: (element: HTMLDivElement | null) => void;
/**
* Scroll handler from the auto-scroll hook.
*/
handleScroll: (event: UIEvent<HTMLDivElement>) => void;
/**
* Selector used to locate message elements for overlap checks.
*/
messageSelector: string;
/**
* Optional selector for the actual message content region used for overlap checks.
*
* When not provided or when no matching element is found, the full message element is used.
*/
messageCollisionSelector?: string;
/**
* Messages used to trigger overlap recalculation.
*/
messages: ReadonlyArray<unknown>;
};
/**
* Result returned by the action overlap tracking hook.
*/
export type ChatActionsOverlapResult = {
/**
* Ref for the actions toolbar element.
*/
actionsRef: MutableRefObject<HTMLDivElement | null>;
/**
* Combined ref setter for chat messages (auto-scroll + overlap tracking).
*/
setChatMessagesElement: (element: HTMLDivElement | null) => void;
/**
* Scroll handler that updates both auto-scroll and overlap state.
*/
handleChatScroll: (event: UIEvent<HTMLDivElement>) => void;
/**
* Whether the actions toolbar is currently being scrolled.
*/
isActionsScrolling: boolean;
/**
* Whether the actions toolbar overlaps the first visible message.
*/
isActionsOverlapping: boolean;
};
/**
* Tracks action toolbar overlap while coordinating with chat auto-scroll.
*
* @private component of `<Chat/>`
*/
export declare function useChatActionsOverlap(config: ChatActionsOverlapConfig): ChatActionsOverlapResult;