feat(SW-3659): Use new input component * Use new input component * Update error formatter * Merged master into feat/use-new-input-component * Merged master into feat/use-new-input-component * Merge branch 'master' into feat/use-new-input-component * Merged master into feat/use-new-input-component * Update Input stories * Merge branch 'feat/use-new-input-component' of bitbucket.org:scandic-swap/web into feat/use-new-input-component * Update Storybook logo * Add some new demo icon input story * Fix the clear content button position * Fix broken password input icon * Merged master into feat/use-new-input-component * Merged master into feat/use-new-input-component * Add aria-hidden to required asterisk * Merge branch 'feat/use-new-input-component' of bitbucket.org:scandic-swap/web into feat/use-new-input-component * Merge branch 'master' into feat/use-new-input-component Approved-by: Bianca Widstam Approved-by: Matilda Landström
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import type { RegisterOptions } from 'react-hook-form'
|
|
import type { IntlShape } from 'react-intl'
|
|
|
|
import type { MaterialIconProps } from '../../Icons/MaterialIcon'
|
|
import type { InputProps } from '../../Input/types'
|
|
|
|
export interface FormInputProps extends InputProps {
|
|
/** Helper text displayed below the input (hidden when there's an error) */
|
|
description?: string
|
|
/** Icon to display with the description text. Defaults to 'info' */
|
|
descriptionIcon?: MaterialIconProps['icon']
|
|
/** Field name for react-hook-form registration */
|
|
name: string
|
|
/** react-hook-form validation rules */
|
|
registerOptions?: RegisterOptions
|
|
/** Hide the error message (useful when showing errors elsewhere) */
|
|
hideError?: boolean
|
|
/** Custom formatter for error messages with i18n support */
|
|
errorFormatter?: (intl: IntlShape, errorMessage?: string) => string
|
|
/**
|
|
* Visual validation state for the input.
|
|
* - 'warning': Shows warning styling (yellow background, focus ring)
|
|
* - Note: Error state is automatically derived from form validation
|
|
*/
|
|
validationState?: 'warning'
|
|
}
|