/** * USWDS Character Count Behavior * * Mirrors official USWDS character count JavaScript behavior exactly * * @uswds-source https://github.com/uswds/uswds/blob/develop/packages/usa-character-count/src/index.js * @uswds-version 3.10.0 * @last-synced 2025-10-05 * @sync-status ✅ UP TO DATE * * CRITICAL: This file replicates USWDS source code to maintain 100% behavior parity. * DO NOT add custom logic. ALL changes must come from USWDS source updates. */ declare const CHARACTER_COUNT_CLASS = "usa-character-count"; declare const FORM_GROUP_ERROR_CLASS = "usa-form-group--error"; declare const LABEL_ERROR_CLASS = "usa-label--error"; declare const INPUT_ERROR_CLASS = "usa-input--error"; declare const VALIDATION_MESSAGE = "The content is too long."; declare const MESSAGE_INVALID_CLASS = "usa-character-count__status--invalid"; declare const STATUS_MESSAGE_CLASS = "usa-character-count__status"; declare const STATUS_MESSAGE_SR_ONLY_CLASS = "usa-character-count__sr-status"; declare const DEFAULT_STATUS_LABEL = "characters remaining"; /** * Create and append status messages for visual and screen readers * * SOURCE: index.js (Lines 70-90) * MODIFICATION: Check if elements already exist (Lit pre-renders them) before creating * * @param characterCountEl - Div with `.usa-character-count` class * @description Create two status messages for number of characters left; * one visual status and another for screen readers */ declare const createStatusMessages: (characterCountEl: HTMLElement) => void; /** * Returns message with how many characters are left * * SOURCE: index.js (Lines 97-113) * * @param currentLength - The number of characters used * @param maxLength - The total number of characters allowed * @returns A string description of how many characters are left */ declare const getCountMessage: (currentLength: number, maxLength: number) => string; /** * Update the character count component * * SOURCE: index.js (Lines 132-173) * * @description On input, it will update visual status, screenreader * status and update input validation (if over character length) * @param inputEl - The character count input element */ declare const updateCountMessage: (inputEl: HTMLInputElement | HTMLTextAreaElement) => void; /** * Initialize component * * SOURCE: index.js (Lines 180-190) * * @description On init this function will create elements and update any * attributes so it can tell the user how many characters are left. * @param inputEl - the components input */ declare const enhanceCharacterCount: (inputEl: HTMLInputElement | HTMLTextAreaElement) => void; /** * Initialize character count behavior * * SOURCE: index.js (Lines 192-213) * * @param root - Root element or document * @returns Cleanup function */ export declare function initializeCharacterCount(root?: HTMLElement | Document): () => void; export { enhanceCharacterCount, getCountMessage, updateCountMessage, createStatusMessages, CHARACTER_COUNT_CLASS, FORM_GROUP_ERROR_CLASS, LABEL_ERROR_CLASS, INPUT_ERROR_CLASS, MESSAGE_INVALID_CLASS, VALIDATION_MESSAGE, STATUS_MESSAGE_CLASS, STATUS_MESSAGE_SR_ONLY_CLASS, DEFAULT_STATUS_LABEL, }; //# sourceMappingURL=usa-character-count-behavior.d.ts.map