/** * @file * Utilities for handling keyboard events. */ /** * A utility for mapping key names with their numeric codes. This is an alias for [the third-party * library, keycode](https://github.com/timoxley/keycode). * * @deprecated This function is deprecated and will be removed in a future major version. * Use `KeyboardEvent`'s `key` property for identifying key presses instead. * @param {KeyboardEvent} event - A keyboard event. * @returns {String} * @public */ export declare function keycode(event: KeyboardEvent): string | number | undefined; /** * Tests if the event key is a number. * @param {Event} event - @deprecated Support for `keyCode` in this function is deprecated and will be removed in a future major version. * A keyboard event that includes a `key`, a `keyCode`, or both. * @returns {Boolean} * @public */ export declare function isNumber({ key, keyCode }: KeyboardEvent): boolean; /** * Tests if the event key is a decimal. * @param {Event} event - @deprecated Support for `keyCode` in this function is deprecated and will be removed in a future major version. * A keyboard event that includes a `key`, a `keyCode`, or both. * @param {Object} [options] * @param {String} [locale.string = 'en-US'] - The locale determines the decimal separator. Supported locale formats are: `xx`, `xx-XX`, and `xx_XX`. * @returns {Boolean} * @public */ export declare function isDecimal({ key, keyCode }: KeyboardEvent, { locale }?: { locale?: string | undefined; }): boolean; /** * Tests if the event key is a minus sign. * @param {Event} event - @deprecated Support for `keyCode` in this function is deprecated and will be removed in a future major version. * A keyboard event that includes a `key`, a `keyCode`, or both. * @returns {Boolean} * @public */ export declare function isMinus({ key, keyCode }: KeyboardEvent): boolean; /** * Tests if the event key is a numeric character (number, decimal, or minus). * @param {Event} event - @deprecated Support for `keyCode` in this function is deprecated and will be removed in a future major version. * A keyboard event that includes a `key`, a `keyCode`, or both. * @param {Object} [options] * @param {String} [locale.string = 'en-US'] - The locale determines the decimal separator. Supported locale formats are: `xx`, `xx-XX`, and `xx_XX`. * @returns {Boolean} * @public */ export declare function isNumeric(event: KeyboardEvent, options?: { locale?: string; }): boolean; /** * Tests if the event key adds a character. Enter and Tab return false even though they * add characters in some situations. * Caveat: Safari 9.0 and earlier might return undefined as this cannot be practically * determined. * @param {Event} event - A keyboard event that includes a key. * @returns {Boolean|Undefined} * @public */ export declare function addsCharacter({ key }: KeyboardEvent): boolean | undefined;