UNPKG

@keycloakify/keycloak-admin-ui

Version:
22 lines 1.94 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { SelectControl, TextAreaControl } from "../../ui-shared"; import { DefaultSwitchControl } from "../../components/SwitchControl"; import { FormAccess } from "../../components/form/FormAccess"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { convertAttributeNameToForm } from "../../util"; export const LoginSettingsPanel = ({ access }) => { const { t } = useTranslation(); const { watch } = useFormContext(); const loginThemes = useServerInfo().themes["login"]; const consentRequired = watch("consentRequired"); const displayOnConsentScreen = watch(convertAttributeNameToForm("attributes.display.on.consent.screen")); return (_jsxs(FormAccess, { isHorizontal: true, fineGrainedAccess: access, role: "manage-clients", children: [_jsx(SelectControl, { name: "attributes.login_theme", label: t("loginTheme"), labelIcon: t("loginThemeHelp"), controller: { defaultValue: "", }, options: [ { key: "", value: t("choose") }, ...loginThemes.map(({ name }) => ({ key: name, value: name })), ] }), _jsx(DefaultSwitchControl, { name: "consentRequired", label: t("consentRequired"), labelIcon: t("consentRequiredHelp") }), _jsx(DefaultSwitchControl, { name: convertAttributeNameToForm("attributes.display.on.consent.screen"), label: t("displayOnClient"), labelIcon: t("displayOnClientHelp"), isDisabled: !consentRequired, stringify: true }), _jsx(TextAreaControl, { name: convertAttributeNameToForm("attributes.consent.screen.text"), label: t("consentScreenText"), labelIcon: t("consentScreenTextHelp"), isDisabled: !(consentRequired && displayOnConsentScreen === "true") })] })); }; //# sourceMappingURL=LoginSettingsPanel.js.map