Files
web/packages/design-system/lib/components/Form/FormInput/input.ts
Rasmus Langvad edca33c49f Merged in feat/SW-3655-input-component (pull request #3296)
feat: (SW-3655) new Input and FormInput components

* First version new Input and FormInput components

* Handle aria-describedby with react-aria instead of manually add it

* Update breaking unit and stories tests

* Merge branch 'master' into feat/SW-3655-input-component

* Update example form

* Merge branch 'master' into feat/SW-3655-input-component

* New lock file


Approved-by: Linus Flood
2025-12-08 08:51:03 +00:00

24 lines
913 B
TypeScript

import type { RegisterOptions } from 'react-hook-form'
import type { IntlShape } from 'react-intl'
import type { InputProps } from '../../InputNew/types'
export interface FormInputProps extends InputProps {
/** Helper text displayed below the input (hidden when there's an error) */
description?: string
/** 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'
}