UNPKG

@keycloakify/keycloak-admin-ui

Version:
12 lines 1.12 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import { useTranslation } from "react-i18next"; import { Controller, useFormContext } from "react-hook-form"; import { FormGroup, Radio } from "@patternfly/react-core"; import { HelpItem } from "../../../ui-shared"; const LOGIC_TYPES = ["POSITIVE", "NEGATIVE"]; export const LogicSelector = ({ isDisabled }) => { const { t } = useTranslation(); const { control } = useFormContext(); return (_jsx(FormGroup, { label: t("logic"), labelIcon: _jsx(HelpItem, { helpText: t("logicHelp"), fieldLabelId: "logic" }), fieldId: "logic", hasNoPaddingTop: true, children: _jsx(Controller, { name: "logic", "data-testid": "logic", defaultValue: LOGIC_TYPES[0], control: control, render: ({ field }) => (_jsx(_Fragment, { children: LOGIC_TYPES.map((type) => (_jsx(Radio, { id: type, "data-testid": type, isChecked: field.value === type, name: "logic", onChange: () => field.onChange(type), label: t(`logicType.${type.toLowerCase()}`), className: "pf-v5-u-mb-md", isDisabled: isDisabled }, type))) })) }) })); }; //# sourceMappingURL=LogicSelector.js.map