import React from "react"; import { useTranslation } from "react-i18next"; import { Controller, useFormContext, useWatch } from "react-hook-form"; import { ActionGroup, Button, FormGroup, PageSection, Switch, } from "@patternfly/react-core"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/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 { TimeSelector } from "../components/time-selector/TimeSelector"; import "./RealmSettingsSection.css"; type RealmSettingsSessionsTabProps = { realm: RealmRepresentation; save: (realm: RealmRepresentation) => void; }; export const RealmSettingsSessionsTab = ({ realm, save, }: RealmSettingsSessionsTabProps) => { const { t } = useTranslation("realm-settings"); const { control, handleSubmit, reset: resetForm, formState, } = useFormContext(); const offlineSessionMaxEnabled = useWatch({ control, name: "offlineSessionMaxLifespanEnabled", }); const reset = () => { if (realm) { resetForm(realm); } }; return ( } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( )} /> } > ( onChange(value.toString())} /> )} /> {offlineSessionMaxEnabled && ( } > ( )} /> )} } > ( )} /> } > ( )} /> ); };