UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

116 lines (115 loc) 2.87 kB
import type { ChatConfig } from '../types/types'; import type { ViewManager } from '../components/ViewManager'; export declare class InputBarSheetController { private element; private viewManager; private config; private stateMachine; private eventCleanup; private backdrop?; private collapseButton?; private liveRegion?; private currentAnimation; private previousFocus; private manualCollapse; constructor(element: HTMLElement, viewManager: ViewManager, config: ChatConfig); /** * Initialize the controller */ initialize(): void; /** * Expand the sheet */ expand(): void; /** * Collapse the sheet */ collapse(manual?: boolean): void; /** * Update view state (called by parent when view changes) */ setViewState(view: 'welcome' | 'conversation'): void; /** * Check if sheet is expanded */ isExpanded(): boolean; /** * Check if in transition */ isTransitioning(): boolean; /** * Cleanup and destroy */ destroy(): void; /** * Get animation duration respecting user's motion preferences * Can be overridden via config for testing: config.forceAnimations = true */ private getAnimationDuration; /** * Handle animation errors gracefully */ private handleAnimationError; /** * Update ARIA states for accessibility */ private updateAriaStates; /** * Create backdrop element */ private createBackdrop; /** * Create collapse button */ private createCollapseButton; /** * Position collapse button based on current view * - In conversation view: Add to header actions (with New Chat / Conversations buttons) * - In welcome view: Insert as first child of container (standalone) */ positionCollapseButton(): void; /** * Setup accessibility features */ private setupAccessibility; /** * Setup focus trap for keyboard navigation */ private setupFocusTrap; /** * Attach all event listeners */ private attachEventListeners; /** * Handle clicks on the wrapper in collapsed state */ private handleWrapperClick; /** * Handle focus entering the widget */ private handleFocusIn; /** * Handle focus leaving the widget */ private handleFocusOut; /** * Handle Escape key press */ private handleEscape; /** * Intercept clicks during transitions */ private handleClickIntercept; /** * Blur the input field */ private blurInput; /** * Announce state change to screen readers */ private announceStateChange; /** * Register an event listener with cleanup tracking */ private registerEventListener; }