import { SelectionType } from './types'; /** * Helper returns the starting and ending index of the selected part of the text in the input * @param {HTMLInputElement} el - Input element * * @returns {SelectionType} Selection */ export declare const getSelection: (el: HTMLInputElement) => SelectionType; /** * Set starting and ending index of the selected part of the text in the input * @param {HTMLInputElement | null} el - Input element * @param {SelectionType} selection - Selected part of the text in the input * * @returns {void} */ export declare const setSelection: (el: HTMLInputElement | null, selection: SelectionType) => void; /** * Helper returns array of editable chars indexes * @param {string} mask - Input's mask * * @returns {number[]} Array of editable chars indexes */ export declare const getEditableCharsIndex: (mask: string) => number[]; /** * Helper converts raw value to masked value * @param {string} value - Input's value * @param {string} mask - Input's mask * @param {string} placeholderChar - Placeholder for editable chars in the mask * * @returns {string} Masked value */ export declare const maskValue: (value: string, mask: string, placeholderChar?: string) => string; /** * Helper converts masked value to raw value * @param {string} value - Input's value * @param {string} mask - Input's mask * * @returns {string} Raw value */ export declare const getRawValue: (value: string, mask: string) => string; /** * Helper defines, what kind of event was performed on input (add, remove, replace, autocomplete, nothing) * returns the following array: [new cursor position, added value, removed value] * @param {string} oldText - Previous input value * @param {string} newText - New input value * @param {string} mask - Input's mask * * @returns {[number, string, string]} - [new cursor position, added value, removed value] */ export declare const compareText: (oldText: string, newText: string, mask: string) => [number, string, string]; /** * Helper gets empty masked value * @param {string} mask - Input's mask * @param {string} placeholderChar - Placeholder for editable chars in the mask * * @returns {string} Empty masked value */ export declare const getEmptyValue: (mask: string, placeholderChar?: string) => string; /** * Helper adds char to masked value and returns new value * @param {string} value - Current input value * @param {string} mask - Input's mask' * @param {string} placeholderChar - Placeholder for editable chars in the mask * @param {string} char - Added char * @param {SelectionType} selection - Selection range * @param {HTMLInputElement} input - Input element * @param {function(newPosition: number): void} setCursor - Function to set cursor * * @returns {string} New value */ export declare const addChar: ({ value, mask, placeholderChar, char, selection, input, setCursor, }: { char: string; input: HTMLInputElement; mask: string; placeholderChar?: string | undefined; selection: SelectionType; setCursor: (newPosition: number) => void; value: string; }) => string; /** * Helper removes char from masked value and returns new value * @param {string} value - Current input value * @param {string} mask - Input's mask' * @param {number} position - Position cursor * @param {string} placeholderChar - Placeholder for editable chars in the mask * @param {string} removed - Removed char * @param {SelectionType} selection - Selection range * @param {HTMLInputElement} input - Input element * @param {function(newPosition: number): void} setCursor - Function to set cursor * * @returns {string} New value */ export declare const removeChar: ({ setCursor, value, mask, position, removed, placeholderChar, selection, input, }: { input: HTMLInputElement; mask: string; placeholderChar?: string | undefined; position: number; removed: string; selection: SelectionType; setCursor: (newPosition: number) => void; value: string; }) => string; /** * Helper gets masked value from input * @param {string} valueProp - Value provided as prop to component * @param {string} inputValue - Input's actual value * @param {string} mask - Input's mask' * @param {string} placeholderChar - Placeholder for editable chars in the mask * @param {boolean} isFocused - Flag defines if input is focused * * @returns {string} Masked value */ export declare const getValue: ({ valueProp, inputValue, placeholderChar, isFocused, mask, }: { inputValue: string; isFocused: boolean; mask: string; placeholderChar?: string | undefined; valueProp: string; }) => string; /** * Helper checks value is empty value or empty string * @param {string} value - Actual value * @param {string} emptyValue - Empty value * * @returns {boolean} value is empty? */ export declare const checkIsEmptyValue: (value: string, emptyValue: string) => boolean; /** * Checks maskedValue for full filled * @param {string} value - Current value * @param {string} mask - Input mask. It is set according to rules described in mask.md * @param {string | undefined} placeholderChar - Placeholder for editable chars in the mask * * @returns {boolean} MaskedValue is full filled ? */ export declare const checkIsFullFilled: (value: string, mask: string, placeholderChar?: string | undefined) => boolean;