import React from 'react'; import { connect } from 'react-redux'; import { Field, reduxForm, formValueSelector } from 'redux-form'; import { Trans, withTranslation } from 'react-i18next'; import flow from 'lodash/flow'; import { renderTextareaField } from '../../../../helpers/form'; import { trimMultilineString, removeEmptyLines } from '../../../../helpers/helpers'; import { CLIENT_ID_LINK, FORM_NAME } from '../../../../helpers/constants'; const fields = [ { id: 'allowed_clients', title: 'access_allowed_title', subtitle: 'access_allowed_desc', normalizeOnBlur: removeEmptyLines, }, { id: 'disallowed_clients', title: 'access_disallowed_title', subtitle: 'access_disallowed_desc', normalizeOnBlur: trimMultilineString, }, { id: 'blocked_hosts', title: 'access_blocked_title', subtitle: 'access_blocked_desc', normalizeOnBlur: removeEmptyLines, }, ]; interface FormProps { handleSubmit: (...args: unknown[]) => string; submitting: boolean; invalid: boolean; initialValues: object; processingSet: boolean; t: (...args: unknown[]) => string; textarea?: boolean; allowedClients?: string; } interface renderFieldProps { id?: string; title?: string; subtitle?: string; disabled?: boolean; processingSet?: boolean; normalizeOnBlur?: (...args: unknown[]) => unknown; } let Form = (props: FormProps) => { const { allowedClients, handleSubmit, submitting, invalid, processingSet } = props; const renderField = ({ id, title, subtitle, disabled = false, processingSet, normalizeOnBlur, }: renderFieldProps) => (