import React, { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from 'react'; import { UseFormProps } from 'react-hook-form'; import { FieldNamesType, FieldValidationMethodType } from '../../types'; import { ButtonProps } from 'nwc-slimer/dist/components/Button/Button'; export interface TextInputProps { /** * Aria label for error messages if applicable */ arialabel?: string | undefined; /** * If the input should allow autofilling from the browser. This is not always handled properly in Chrome, so we suggest to use a string like 'nope'. */ autoComplete?: HTMLInputElement['autocomplete']; autoCorrect?: boolean; /** * The function to run when the input loses focus/blurred. */ onBlur?: (e: FocusEvent) => void; /** * A function that will run after the input has changed, it will return the value of the input for you to use in the parent component. */ onChange?: (e: ChangeEvent) => void; onFocus?: (e: FocusEvent) => void; /** * Should the input be disabled or not. Use with a state var to determine when the input can be edited. */ disabled?: boolean; /** * Pass a display method such as inline-block, inline, or bock. */ display?: string; /** * An error message to be shown docked at the bottom of the input. If null, nothing will show. */ error?: string; /** * An id to be added to the input itself, not the wrapping label. */ id?: string; /** * Classes to be added to the input itself. */ inputTheme?: string; /** * Callback when a key is released. To maintain typesafety, if accessing the element's value property, it is required to cast `event.target` as an `HTMLInputElement` in your function. For example: `alert((e.target as HTMLInputElement).value)`. */ onKeyUp?: (e: KeyboardEvent) => void; /** * Callback when key is down */ onKeyDown?: (e: KeyboardEvent) => void; /** * The allowed max length of characters into the input. */ maxLength?: number; /** * The allowed min lenght of characters into the input. */ minLength?: number; /** * If true, will show an (optional) tag next to the title. If false or not supplied, nothing will show. */ name: FieldNamesType; optional?: boolean; /** * Regex to match on the input. */ pattern?: string; /** * Placeholder value to show on the input before any value is entered. */ placeholder?: string; /** * The default value to be populated into the input on load. */ populatedValue?: string; showPasswordButton?: boolean; /** * Size of the input, will effect length as how many chars will show */ size?: number; /** * Classes to be added to the `