diff --git a/src/client-scopes/details/ScopeForm.tsx b/src/client-scopes/details/ScopeForm.tsx index 3549356749..0b489430e4 100644 --- a/src/client-scopes/details/ScopeForm.tsx +++ b/src/client-scopes/details/ScopeForm.tsx @@ -3,7 +3,6 @@ import { Link, useParams } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Controller, useForm, useWatch } from "react-hook-form"; import { - Form, FormGroup, ValidatedOptions, TextInput, @@ -14,7 +13,6 @@ import { ActionGroup, Button, TextArea, - NumberInput, } from "@patternfly/react-core"; import type ClientScopeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation"; @@ -29,6 +27,7 @@ import { convertToFormValues } from "../../util"; import { useRealm } from "../../context/realm-context/RealmContext"; import { getProtocolName } from "../../clients/utils"; import { toClientScopes } from "../routes/ClientScopes"; +import { FormAccess } from "../../components/form-access/FormAccess"; type ScopeFormProps = { clientScope: ClientScopeRepresentation; @@ -59,7 +58,11 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { }, [clientScope]); return ( -
+ { > { - const MIN_VALUE = 0; - const setValue = (newValue: number) => - onChange(Math.max(newValue, MIN_VALUE)); - - return ( - setValue(value + 1)} - onMinus={() => setValue(value - 1)} - onChange={(event) => { - const newValue = Number(event.currentTarget.value); - setValue(!isNaN(newValue) ? newValue : 0); - }} - /> - ); - }} + render={({ onChange, value }) => ( + + )} /> @@ -304,6 +297,6 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { {t("common:cancel")} - +
); }; diff --git a/src/identity-providers/component/DisplayOrder.tsx b/src/identity-providers/component/DisplayOrder.tsx index 76859c2dfa..eaf444015a 100644 --- a/src/identity-providers/component/DisplayOrder.tsx +++ b/src/identity-providers/component/DisplayOrder.tsx @@ -1,7 +1,7 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { Controller, useFormContext } from "react-hook-form"; -import { FormGroup, NumberInput } from "@patternfly/react-core"; +import { FormGroup, TextInput } from "@patternfly/react-core"; import { HelpItem } from "../../components/help-enabler/HelpItem"; @@ -24,19 +24,14 @@ export const DisplayOrder = () => { ( - onChange(Number.parseInt(value) - 1)} onChange={onChange} - onPlus={() => onChange(Number.parseInt(value) + 1)} - inputName="input" - inputAriaLabel={t("displayOrder")} - minusBtnAriaLabel={t("common:minus")} - plusBtnAriaLabel={t("common:plus")} /> )} />