import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Controller, useFormContext, UseFormMethods } from "react-hook-form"; import { ActionGroup, Button, Checkbox, FormGroup, PageSection, Switch, TextInput, } from "@patternfly/react-core"; import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormPanel } from "../components/scroll-form/FormPanel"; import "./RealmSettingsSection.css"; import { emailRegexPattern } from "../util"; export type UserFormProps = { form: UseFormMethods; }; type RealmSettingsEmailTabProps = { save: (realm: RealmRepresentation) => void; reset: () => void; }; export const RealmSettingsEmailTab = ({ save, reset, }: RealmSettingsEmailTabProps) => { const { t } = useTranslation("realm-settings"); const [isAuthenticationEnabled, setAuthenticationEnabled] = useState(""); const { register, control, handleSubmit, errors } = useFormContext(); return ( <> } > } > } > ( onChange("" + value)} /> )} /> ( onChange("" + value)} /> )} /> ( { onChange("" + value); setAuthenticationEnabled(String(value)); }} /> )} /> {isAuthenticationEnabled === "true" && ( <> } > )} ); };