import React, { useState } from "react"; import { ActionGroup, Button, FormGroup, Select, SelectOption, Switch, TextArea, TextInput, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Controller, UseFormMethods } from "react-hook-form"; import { useHistory } from "react-router-dom"; import { FormAccess } from "../components/form-access/FormAccess"; import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { useRealm } from "../context/realm-context/RealmContext"; export type UserFormProps = { form: UseFormMethods; save: (user: UserRepresentation) => void; }; export const UserForm = ({ form, save }: UserFormProps) => { const { t } = useTranslation("users"); const { realm } = useRealm(); const [ isRequiredUserActionsDropdownOpen, setRequiredUserActionsDropdownOpen, ] = useState(false); const [selected, setSelected] = useState([]); const history = useHistory(); const requiredUserActionsOptions = [ {t("configureOTP")} , {t("updatePassword")} , {t("updateProfile")} , {t("verifyEmail")} , {t("updateUserLocale")} , ]; const clearSelection = () => { setSelected([]); setRequiredUserActionsDropdownOpen(false); }; return ( } > ( onChange([`${value}`])} isChecked={value[0] === "true"} label={t("common:on")} labelOff={t("common:off")} /> )} > } > ( onChange([`${value}`])} isChecked={value[0] === "true"} label={t("common:on")} labelOff={t("common:off")} /> )} > } > ( )} > ); };