UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

27 lines 930 B
/** * Shared character counting functionality for text inputs with character limits. * Handles real-time character count updates, validation, and aria-live announcements. */ export interface CharacterCounterCallbacks { onCountUpdate: (count: number, isOverLimit: boolean, message: string) => void; onScreenReaderAnnounce: (message: string) => void; } export declare class CharacterCounter { private announceTimeout; private callbacks; private isInitialLoad; constructor(callbacks: CharacterCounterCallbacks); /** * Update the character count based on current input value */ updateCharacterCount(currentLength: number, maxLength: number): void; /** * Announce character count to screen readers with debouncing */ private announceToScreenReader; /** * Clean up any pending timeouts */ cleanup(): void; } //# sourceMappingURL=character-counter.d.ts.map