import { SystemProps } from '../system'
import { ThemingProps } from '../theme'
import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils'

export type TextareaProps = SystemProps &
  ThemingProps<'Textarea'> & {
    /** Passed to the inner input. */
    autoFocus?: boolean
    /** ARIA label for the input element. */
    ariaLabel?: string
    /** Children are disabled for this component. */
    children?: never
    /** Deprecated. Please use variant instead. @deprecated  */
    colorScheme?: 'green' | 'grey' | 'red'
    /** Passed to the inner input. */
    cols?: number
    /** Passed to the inner input. */
    defaultValue?: number | string
    /** Passed to the inner input. */
    disabled?: boolean
    /** Socket displaying error text below an input. */
    errorText?: string | React.ReactNode
    /** Socket displaying help text below an input. */
    helpText?: React.ReactNode | string
    /** Deprecated. Please use variant="red" instead. @deprecated*/
    isInvalid?: boolean
    /** The label. */
    label?: string | React.ReactNode
    /** Should the label indicates that the field is optional */
    labelMarkOptional?: boolean
    /** Adds a tooltip with the text inside the label */
    labelTooltipText?: string
    /** Passed to the inner input. */
    maxLength?: number
    /** Passed to the inner input. */
    name?: string
    /** Passed to the inner input. */
    onBlur?: FocusEventHandler<HTMLTextAreaElement>
    /** Passed to the inner input. */
    onChange?: ChangeEventHandler<HTMLTextAreaElement>
    /** Passed to the inner input. */
    onFocus?: FocusEventHandler<HTMLTextAreaElement>
    /** Passed to the inner input. */
    placeholder?: string
    /** Passed to the inner input. */
    readOnly?: boolean
    /** Passed to the inner input. */
    required?: boolean
    /** Passed to the inner input. */
    rows?: number
    /** Displays length of textarea value if also using maxLength. */
    showCount?: boolean
    /** Props object passed to the inner textarea. */
    textareaProps?: PropsOf<'textarea', SystemProps>
    /** Ref passed to the inner textarea. */
    textareaRef?: React.MutableRefObject<HTMLTextAreaElement | null> | null
    /** Passed to the inner input. */
    value?: number | string
  }
