import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent } from 'react'; import React from 'react'; type InputStatus = 'none' | 'success' | 'error' | 'comment'; type InputType = 'email' | 'hidden' | 'number' | 'password' | 'range' | 'search' | 'tel' | 'text' | 'url'; interface Props { /** * Unique ID for the input element */ id: string; /** * Name of the input element */ name: string; /** * Type of input element * * @param {InputType} email Used for entering an email address and supported with browser validation * @param {InputType} hidden Input element is not displayed but its value is submitted with form regardless * @param {InputType} number Used for entering a number, it displays arrows and might have browser validation * @param {InputType} password Used for entering value which is obscured for view * @param {InputType} range Used for entering a not number by displaying a range widget * @param {InputType} search Used for entering search strings * @param {InputType} tel Used for entering a telephone number * @param {InputType} text Single-line text field * @param {InputType} url Used for entering a URL and supported with browser validation * * @default 'text' */ type?: InputType; /** * Default value of input element */ value?: string | number; /** * Text to be passed down to `LabelText` component. Acts as the input element label */ label?: string; /** * Text of placeholder for the input value */ placeholder?: string; /** * Integer attribute indicating the sequence of keyboard navigation */ tabIndex?: number; /** * On input change callback */ onChange?: (val: string, e: ChangeEvent) => void; /** * On input blur callback */ onBlur?: (val: string, e: ChangeEvent) => void; /** * On input focus callback */ onFocus?: (e: FocusEvent) => void; /** * On input key press callback */ onKeyPress?: (e: KeyboardEvent) => void; /** * On input key down callback */ onKeyDown?: (e: KeyboardEvent) => void; /** * On clearable button click callback */ onClearableButtonClick?: (e: MouseEvent) => void; /** * Allows user to change type of input between "password" and "text" * When set to true, value of type property is ignored * * @default false */ showPasswordToggle?: boolean; /** * Allows to define space separated string to describe type of autocomplete functionality the input should provide * Use "off" to disable built-in browser autocomplete functionality * * For possible values refer to e.g.: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete */ autocomplete?: string; /** * Allows to disable the component functionality * * @default false */ disabled?: boolean; /** * Allows to set input as readonly * * @default false */ readonly?: boolean; /** * Allows to set input as readonly without any styles applied * * @default false */ readonlyUnstyled?: boolean; /** * Allows to set input as mandatory * * @default false */ required?: boolean; /** * Depending on the passed status, the styling changes and additional elements are shown * * @param {InputStatus} none Default styling * @param {InputStatus} success Displays `success` icon with `theme.color.notification.success` color in the input element * @param {InputStatus} error Displays `error` icon with `theme.color.notification.error` color in the input element and error message underneath the input * @param {InputStatus} comment Displays comment message underneath the input */ status?: InputStatus; /** * Text of the error message when input is in error state */ errorMessage?: string; /** * Text of the comment message when input is in comment state */ commentMessage?: string; /** * Allows to pass a custom className */ className?: string; /** * Screen reader label describing the purpose of the Input * * @default id */ ariaLabel?: string; /** * Screen reader label for "Show password" toggle */ showPasswordLabel?: string; /** * Screen reader label for "Hide password" toggle */ hidePasswordLabel?: string; /** * @deprecated Use `showPasswordLabel` and `hidePasswordLabel` * Screen reader label describing the password toggle (same for both states) */ passwordToggleLabel?: string; /** * Screen reader label describing the clear button */ clearButtonLabel?: string; /** * Allows to pass testid string for testing purposes */ 'data-testid'?: string; } declare const Input: React.ForwardRefExoticComponent>; /** @component */ export default Input;