/* eslint-disable */ // @ts-nocheck import type PasswordPolicyTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation"; import { Button, FormGroup, NumberInput, Split, SplitItem, Switch, TextInput, ValidatedOptions, } from "../../../shared/@patternfly/react-core"; import { MinusCircleIcon } from "../../../shared/@patternfly/react-icons"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { FormErrorText, HelpItem } from "../../../shared/keycloak-ui-shared"; import "./policy-row.css"; type PolicyRowProps = { policy: PasswordPolicyTypeRepresentation; onRemove: (id?: string) => void; }; export const PolicyRow = ({ policy: { id, configType, defaultValue, displayName }, onRemove, }: PolicyRowProps) => { const { t } = useTranslation(); const { control, register, formState: { errors }, } = useFormContext(); const error = errors[id!]; return ( } > {configType && configType !== "int" && ( )} {configType === "int" && ( { const MIN_VALUE = 0; const setValue = (newValue: number) => field.onChange(Math.max(newValue, MIN_VALUE)); const value = Number(field.value); return ( setValue(value + 1)} onMinus={() => setValue(value - 1)} onChange={(event) => { const newValue = Number(event.currentTarget.value); setValue(!isNaN(newValue) ? newValue : 0); }} className="keycloak__policies_authentication__number-field" /> ); }} /> )} {!configType && ( )} {error && } ); };