/* eslint-disable */ // @ts-nocheck import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation"; import type { IdentityProviderMapperTypeRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation"; import { HelpItem, KeycloakSelect, SelectControl, SelectVariant, TextControl, } from "../../../shared/keycloak-ui-shared"; import { FormGroup, SelectOption } from "../../../shared/@patternfly/react-core"; import { useState } from "react"; import { Controller, UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; import type { IdPMapperRepresentationWithAttributes } from "./AddMapper"; type AddMapperFormProps = { mapperTypes: IdentityProviderMapperRepresentation[]; mapperType: IdentityProviderMapperTypeRepresentation; id: string; updateMapperType: ( mapperType: IdentityProviderMapperTypeRepresentation, ) => void; form: UseFormReturn; }; export const AddMapperForm = ({ mapperTypes, mapperType, form, id, updateMapperType, }: AddMapperFormProps) => { const { t } = useTranslation(); const { control } = form; const [mapperTypeOpen, setMapperTypeOpen] = useState(false); const syncModes = ["inherit", "import", "legacy", "force"]; return ( <> {!id && ( )} ({ key: option.toUpperCase(), value: t(`syncModes.${option}`), }))} controller={{ defaultValue: syncModes[0].toUpperCase() }} /> } fieldId="identityProviderMapper" > ( setMapperTypeOpen(!mapperTypeOpen)} onSelect={(value) => { const mapperType = value as IdentityProviderMapperTypeRepresentation; updateMapperType(mapperType); field.onChange(mapperType.id); setMapperTypeOpen(false); }} selections={mapperType.name} variant={SelectVariant.single} aria-label={t("mapperType")} isOpen={mapperTypeOpen} > {mapperTypes.map((option) => ( {option.name} ))} )} /> ); };