@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
33 lines • 3.76 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { HelpItem, KeycloakSelect, SelectVariant, } from "../../ui-shared";
import { ExpandableSection, Form, FormGroup, NumberInput, SelectOption, } from "@patternfly/react-core";
import { useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { FormGroupField } from "../../identity-providers/component/FormGroupField";
import { SwitchField } from "../../identity-providers/component/SwitchField";
import { TextField } from "../../identity-providers/component/TextField";
const promptOptions = {
unspecified: "",
none: "none",
consent: "consent",
login: "login",
select_account: "select_account",
};
export const ExtendedNonDiscoverySettings = () => {
const { t } = useTranslation();
const { control } = useFormContext();
const [isExpanded, setIsExpanded] = useState(false);
const [promptOpen, setPromptOpen] = useState(false);
return (_jsx(ExpandableSection, { toggleText: t("advanced"), onToggle: () => setIsExpanded(!isExpanded), isExpanded: isExpanded, children: _jsxs(Form, { isHorizontal: true, children: [_jsx(SwitchField, { label: "passLoginHint", field: "config.loginHint" }), _jsx(SwitchField, { label: "passMaxAge", field: "config.passMaxAge" }), _jsx(SwitchField, { label: "passCurrentLocale", field: "config.uiLocales" }), _jsx(SwitchField, { field: "config.backchannelSupported", label: "backchannelLogout" }), _jsx(SwitchField, { field: "config.sendIdTokenOnLogout", label: "sendIdTokenOnLogout", defaultValue: "true" }), _jsx(SwitchField, { field: "config.sendClientIdOnLogout", label: "sendClientIdOnLogout" }), _jsx(SwitchField, { field: "config.disableUserInfo", label: "disableUserInfo" }), _jsx(SwitchField, { field: "config.disableNonce", label: "disableNonce" }), _jsx(TextField, { field: "config.defaultScope", label: "scopes" }), _jsx(FormGroupField, { label: "prompt", children: _jsx(Controller, { name: "config.prompt", defaultValue: "", control: control, render: ({ field }) => (_jsx(KeycloakSelect, { toggleId: "prompt", onToggle: () => setPromptOpen(!promptOpen), onSelect: (value) => {
field.onChange(value);
setPromptOpen(false);
}, selections: field.value || t(`prompts.unspecified`), variant: SelectVariant.single, "aria-label": t("prompt"), isOpen: promptOpen, children: Object.entries(promptOptions).map(([key, val]) => (_jsx(SelectOption, { selected: val === field.value, value: val, children: t(`prompts.${key}`) }, key))) })) }) }), _jsx(SwitchField, { field: "config.acceptsPromptNoneForwardFromClient", label: "acceptsPromptNone" }), _jsx(FormGroup, { label: t("allowedClockSkew"), labelIcon: _jsx(HelpItem, { helpText: t("allowedClockSkewHelp"), fieldLabelId: "allowedClockSkew" }), fieldId: "allowedClockSkew", children: _jsx(Controller, { name: "config.allowedClockSkew", defaultValue: 0, control: control, render: ({ field }) => {
const v = Number(field.value);
return (_jsx(NumberInput, { "data-testid": "allowedClockSkew", inputName: "allowedClockSkew", min: 0, max: 2147483, value: v, readOnly: true, onPlus: () => field.onChange(v + 1), onMinus: () => field.onChange(v - 1), onChange: (event) => {
const value = Number(event.target.value);
field.onChange(value < 0 ? 0 : value);
} }));
} }) }), _jsx(TextField, { field: "config.forwardParameters", label: "forwardParameters" })] }) }));
};
//# sourceMappingURL=ExtendedNonDiscoverySettings.js.map