Replace text inputs with KeycloakTextInput (#2413)

This commit is contained in:
Jon Koops 2022-04-21 17:03:26 +02:00 committed by GitHub
parent 6a07c091b7
commit d5f6aca82e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 317 additions and 276 deletions

View file

@ -10,7 +10,6 @@ import {
FormGroup, FormGroup,
Modal, Modal,
ModalVariant, ModalVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { CogIcon, TrashIcon } from "@patternfly/react-icons"; import { CogIcon, TrashIcon } from "@patternfly/react-icons";
@ -23,6 +22,7 @@ import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { DynamicComponents } from "../../components/dynamic/DynamicComponents"; import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type ExecutionConfigModalForm = { type ExecutionConfigModalForm = {
alias: string; alias: string;
@ -155,7 +155,7 @@ export const ExecutionConfigModal = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
isReadOnly={!!config} isReadOnly={!!config}
type="text" type="text"
id="alias" id="alias"

View file

@ -11,12 +11,12 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type { AuthenticationProviderRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation"; import type { AuthenticationProviderRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation";
import { HelpItem } from "../../../components/help-enabler/HelpItem"; import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient, useFetch } from "../../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../../context/auth/AdminClient";
type AddSubFlowProps = { type AddSubFlowProps = {
@ -100,7 +100,7 @@ export const AddSubFlowModal = ({
<HelpItem helpText="authentication-help:name" fieldLabelId="name" /> <HelpItem helpText="authentication-help:name" fieldLabelId="name" />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="name" id="name"
name="name" name="name"
@ -121,7 +121,7 @@ export const AddSubFlowModal = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="description" id="description"
name="description" name="description"

View file

@ -1,14 +1,10 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { import { FormGroup, TextArea, ValidatedOptions } from "@patternfly/react-core";
FormGroup,
TextArea,
TextInput,
ValidatedOptions,
} from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const NameDescription = () => { export const NameDescription = () => {
const { t } = useTranslation("authentication"); const { t } = useTranslation("authentication");
@ -31,7 +27,7 @@ export const NameDescription = () => {
<HelpItem helpText="authentication-help:name" fieldLabelId="name" /> <HelpItem helpText="authentication-help:name" fieldLabelId="name" />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-name" id="kc-name"
name="alias" name="alias"

View file

@ -11,7 +11,6 @@ import {
NumberInput, NumberInput,
ActionGroup, ActionGroup,
Button, Button,
TextInput,
ButtonVariant, ButtonVariant,
AlertVariant, AlertVariant,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -21,6 +20,7 @@ import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import useToggle from "../../utils/useToggle"; import useToggle from "../../utils/useToggle";
import { TimeSelector } from "../../components/time-selector/TimeSelector"; import { TimeSelector } from "../../components/time-selector/TimeSelector";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
@ -311,7 +311,7 @@ export const OtpPolicy = ({ realm, realmUpdated }: OtpPolicyProps) => {
/> />
} }
> >
<TextInput <KeycloakTextInput
id="supportedActions" id="supportedActions"
name="otpSupportedApplications" name="otpSupportedApplications"
ref={register({ ref={register({

View file

@ -8,13 +8,13 @@ import {
Split, Split,
SplitItem, SplitItem,
Switch, Switch,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { MinusCircleIcon } from "@patternfly/react-icons"; import { MinusCircleIcon } from "@patternfly/react-icons";
import type PasswordPolicyTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation"; import type PasswordPolicyTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./policy-row.css"; import "./policy-row.css";
type PolicyRowProps = { type PolicyRowProps = {
@ -45,7 +45,7 @@ export const PolicyRow = ({
<Split> <Split>
<SplitItem isFilled> <SplitItem isFilled>
{configType && configType !== "int" && ( {configType && configType !== "int" && (
<TextInput <KeycloakTextInput
id={id} id={id}
data-testid={id} data-testid={id}
ref={register({ required: true })} ref={register({ required: true })}

View file

@ -20,7 +20,6 @@ import {
Switch, Switch,
Text, Text,
TextContent, TextContent,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { QuestionCircleIcon } from "@patternfly/react-icons"; import { QuestionCircleIcon } from "@patternfly/react-icons";
@ -34,6 +33,7 @@ import { useHelp } from "../../components/help-enabler/HelpHeader";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { TimeSelector } from "../../components/time-selector/TimeSelector"; import { TimeSelector } from "../../components/time-selector/TimeSelector";
import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./webauthn-policy.css"; import "./webauthn-policy.css";
@ -222,7 +222,7 @@ export const WebauthnPolicy = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
name={`${namePrefix}RpEntityName`} name={`${namePrefix}RpEntityName`}
id="webAuthnPolicyRpEntityName" id="webAuthnPolicyRpEntityName"
@ -247,7 +247,7 @@ export const WebauthnPolicy = ({
} }
fieldId="webAuthnPolicyRpId" fieldId="webAuthnPolicyRpId"
> >
<TextInput <KeycloakTextInput
id="webAuthnPolicyRpId" id="webAuthnPolicyRpId"
name={`${namePrefix}RpId`} name={`${namePrefix}RpId`}
ref={register()} ref={register()}

View file

@ -10,7 +10,6 @@ import {
DropdownItem, DropdownItem,
FormGroup, FormGroup,
PageSection, PageSection,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type ProtocolMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation"; import type ProtocolMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation";
@ -28,6 +27,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { MapperParams, MapperRoute } from "../routes/Mapper"; import { MapperParams, MapperRoute } from "../routes/Mapper";
import { toClientScope } from "../routes/ClientScope"; import { toClientScope } from "../routes/ClientScope";
import { DynamicComponents } from "../../components/dynamic/DynamicComponents"; import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./mapping-details.css"; import "./mapping-details.css";
@ -202,7 +202,7 @@ export default function MappingDetails() {
className="keycloak__client-scope-mapping-details__form" className="keycloak__client-scope-mapping-details__form"
> >
<FormGroup label={t("common:mapperType")} fieldId="mapperType"> <FormGroup label={t("common:mapperType")} fieldId="mapperType">
<TextInput <KeycloakTextInput
type="text" type="text"
id="mapperType" id="mapperType"
name="mapperType" name="mapperType"
@ -225,7 +225,7 @@ export default function MappingDetails() {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"
id="name" id="name"

View file

@ -5,7 +5,6 @@ import { Controller, useForm, useWatch } from "react-hook-form";
import { import {
FormGroup, FormGroup,
ValidatedOptions, ValidatedOptions,
TextInput,
Select, Select,
SelectVariant, SelectVariant,
SelectOption, SelectOption,
@ -28,6 +27,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { getProtocolName } from "../../clients/utils"; import { getProtocolName } from "../../clients/utils";
import { toClientScopes } from "../routes/ClientScopes"; import { toClientScopes } from "../routes/ClientScopes";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type ScopeFormProps = { type ScopeFormProps = {
clientScope: ClientScopeRepresentation; clientScope: ClientScopeRepresentation;
@ -82,7 +82,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register({ ref={register({
required: true, required: true,
validate: (value: string) => validate: (value: string) =>
@ -110,7 +110,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
} }
helperTextInvalid={t("common:maxLength", { length: 255 })} helperTextInvalid={t("common:maxLength", { length: 255 })}
> >
<TextInput <KeycloakTextInput
ref={register({ ref={register({
maxLength: 255, maxLength: 255,
})} })}
@ -285,7 +285,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
defaultValue="" defaultValue=""
control={control} control={control}
render={({ onChange, value }) => ( render={({ onChange, value }) => (
<TextInput <KeycloakTextInput
type="number" type="number"
value={value} value={value}
data-testid="displayOrder" data-testid="displayOrder"

View file

@ -10,7 +10,6 @@ import {
Split, Split,
SplitItem, SplitItem,
Text, Text,
TextInput,
ToolbarItem, ToolbarItem,
Tooltip, Tooltip,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -29,6 +28,7 @@ import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { ScrollForm } from "../components/scroll-form/ScrollForm"; import { ScrollForm } from "../components/scroll-form/ScrollForm";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { TimeSelector } from "../components/time-selector/TimeSelector"; import { TimeSelector } from "../components/time-selector/TimeSelector";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { convertToFormValues, toUpperCase } from "../util"; import { convertToFormValues, toUpperCase } from "../util";
@ -209,7 +209,7 @@ export const AdvancedTab = ({
} }
> >
<InputGroup> <InputGroup>
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-not-before" id="kc-not-before"
name="notBefore" name="notBefore"

View file

@ -5,13 +5,13 @@ import {
FormGroup, FormGroup,
Switch, Switch,
TextArea, TextArea,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormAccess } from "../components/form-access/FormAccess"; import { FormAccess } from "../components/form-access/FormAccess";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type ClientDescriptionProps = { type ClientDescriptionProps = {
protocol?: string; protocol?: string;
@ -38,7 +38,7 @@ export const ClientDescription = ({ protocol }: ClientDescriptionProps) => {
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"
id="kc-client-id" id="kc-client-id"
@ -55,7 +55,12 @@ export const ClientDescription = ({ protocol }: ClientDescriptionProps) => {
label={t("common:name")} label={t("common:name")}
fieldId="kc-name" fieldId="kc-name"
> >
<TextInput ref={register()} type="text" id="kc-name" name="name" /> <KeycloakTextInput
ref={register()}
type="text"
id="kc-name"
name="name"
/>
</FormGroup> </FormGroup>
<FormGroup <FormGroup
labelIcon={ labelIcon={

View file

@ -3,7 +3,6 @@ import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
FormGroup, FormGroup,
TextInput,
Form, Form,
Switch, Switch,
TextArea, TextArea,
@ -20,6 +19,7 @@ import { CapabilityConfig } from "./add/CapabilityConfig";
import { MultiLineInput } from "../components/multi-line-input/MultiLineInput"; import { MultiLineInput } from "../components/multi-line-input/MultiLineInput";
import { FormAccess } from "../components/form-access/FormAccess"; import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../context/server-info/ServerInfoProvider";
import { SaveReset } from "./advanced/SaveReset"; import { SaveReset } from "./advanced/SaveReset";
import { SamlConfig } from "./add/SamlConfig"; import { SamlConfig } from "./add/SamlConfig";
@ -100,7 +100,7 @@ export const ClientSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-root-url" id="kc-root-url"
name="rootUrl" name="rootUrl"
@ -117,7 +117,7 @@ export const ClientSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-home-url" id="kc-home-url"
name="baseUrl" name="baseUrl"
@ -158,7 +158,7 @@ export const ClientSettings = ({
}) })
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="idpInitiatedSsoUrlName" id="idpInitiatedSsoUrlName"
name="attributes.saml_idp_initiated_sso_url_name" name="attributes.saml_idp_initiated_sso_url_name"
@ -175,7 +175,7 @@ export const ClientSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="idpInitiatedSsoRelayState" id="idpInitiatedSsoRelayState"
name="attributes.saml_idp_initiated_sso_relay_state" name="attributes.saml_idp_initiated_sso_relay_state"
@ -192,7 +192,7 @@ export const ClientSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="masterSamlProcessingUrl" id="masterSamlProcessingUrl"
name="adminUrl" name="adminUrl"
@ -232,7 +232,7 @@ export const ClientSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-admin-url" id="kc-admin-url"
name="adminUrl" name="adminUrl"
@ -412,7 +412,7 @@ export const ClientSettings = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="frontchannelLogoutUrl" id="frontchannelLogoutUrl"
name="attributes.frontchannel.logout.url" name="attributes.frontchannel.logout.url"
@ -452,7 +452,7 @@ export const ClientSettings = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="backchannelLogoutUrl" id="backchannelLogoutUrl"
name="attributes.backchannel.logout.url" name="attributes.backchannel.logout.url"

View file

@ -8,10 +8,10 @@ import {
Form, Form,
FormGroup, FormGroup,
Modal, Modal,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type Host = { type Host = {
node: string; node: string;
@ -75,7 +75,7 @@ export const AddHostDialog = ({
> >
<Form isHorizontal> <Form isHorizontal>
<FormGroup label={t("nodeHost")} fieldId="nodeHost"> <FormGroup label={t("nodeHost")} fieldId="nodeHost">
<TextInput id="nodeHost" ref={register} name="node" /> <KeycloakTextInput id="nodeHost" ref={register} name="node" />
</FormGroup> </FormGroup>
</Form> </Form>
</Modal> </Modal>

View file

@ -8,7 +8,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
@ -16,6 +15,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { sortProviders } from "../../util"; import { sortProviders } from "../../util";
import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type FineGrainOpenIdConnectProps = { type FineGrainOpenIdConnectProps = {
save: () => void; save: () => void;
@ -152,7 +152,7 @@ export const FineGrainOpenIdConnect = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="logoUrl" id="logoUrl"
name="attributes.logoUri" name="attributes.logoUri"
@ -170,7 +170,7 @@ export const FineGrainOpenIdConnect = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="policyUrl" id="policyUrl"
name="attributes.policyUri" name="attributes.policyUri"
@ -188,7 +188,7 @@ export const FineGrainOpenIdConnect = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="termsOfServiceUrl" id="termsOfServiceUrl"
name="attributes.tosUri" name="attributes.tosUri"

View file

@ -1,15 +1,11 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import type { Control } from "react-hook-form"; import type { Control } from "react-hook-form";
import { import { ActionGroup, Button, FormGroup } from "@patternfly/react-core";
ActionGroup,
Button,
FormGroup,
TextInput,
} from "@patternfly/react-core";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type FineGrainSamlEndpointConfigProps = { type FineGrainSamlEndpointConfigProps = {
control: Control<Record<string, any>>; control: Control<Record<string, any>>;
@ -35,7 +31,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="assertionConsumerServicePostBindingURL" id="assertionConsumerServicePostBindingURL"
@ -52,7 +48,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="assertionConsumerServiceRedirectBindingURL" id="assertionConsumerServiceRedirectBindingURL"
@ -69,7 +65,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="logoutServicePostBindingURL" id="logoutServicePostBindingURL"
@ -86,7 +82,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="logoutServiceRedirectBindingURL" id="logoutServiceRedirectBindingURL"
@ -103,7 +99,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="logoutServiceArtifactBindingUrl" id="logoutServiceArtifactBindingUrl"
@ -120,7 +116,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="artifactBindingUrl" id="artifactBindingUrl"
@ -137,7 +133,7 @@ export const FineGrainSamlEndpointConfig = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="artifactResolutionService" id="artifactResolutionService"

View file

@ -40,6 +40,7 @@ import "./auth-evaluate.css";
import { AuthorizationEvaluateResource } from "./AuthorizationEvaluateResource"; import { AuthorizationEvaluateResource } from "./AuthorizationEvaluateResource";
import { SearchIcon } from "@patternfly/react-icons"; import { SearchIcon } from "@patternfly/react-icons";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
interface EvaluateFormInputs interface EvaluateFormInputs
extends Omit<ResourceEvaluation, "context" | "resources"> { extends Omit<ResourceEvaluation, "context" | "resources"> {
@ -542,7 +543,7 @@ export const AuthorizationEvaluate = ({ client }: Props) => {
} }
fieldId="client" fieldId="client"
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="alias" id="alias"
name="alias" name="alias"

View file

@ -6,7 +6,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { import {
TableComposable, TableComposable,
@ -17,10 +16,11 @@ import {
Tr, Tr,
} from "@patternfly/react-table"; } from "@patternfly/react-table";
import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons"; import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons";
import { camelCase } from "lodash-es";
import type ResourceRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation"; import type ResourceRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation";
import { defaultContextAttributes } from "../utils"; import { defaultContextAttributes } from "../utils";
import { camelCase } from "lodash-es"; import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./key-based-attribute-input.css"; import "./key-based-attribute-input.css";
@ -134,7 +134,7 @@ const ValueInput = ({
)} )}
/> />
) : ( ) : (
<TextInput <KeycloakTextInput
id={`${getMessageBundleKey(attribute.key)}-value`} id={`${getMessageBundleKey(attribute.key)}-value`}
className="value-input" className="value-input"
name={`${name}[${rowIndex}].value`} name={`${name}[${rowIndex}].value`}

View file

@ -14,7 +14,6 @@ import {
SelectVariant, SelectVariant,
Switch, Switch,
TextArea, TextArea,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type PolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyRepresentation"; import type PolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyRepresentation";
@ -34,6 +33,7 @@ import { toAuthorizationTab } from "../routes/AuthenticationTab";
import { ScopeSelect } from "./ScopeSelect"; import { ScopeSelect } from "./ScopeSelect";
import { toUpperCase } from "../../util"; import { toUpperCase } from "../../util";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner"; import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
const DECISION_STRATEGIES = ["UNANIMOUS", "AFFIRMATIVE", "CONSENSUS"] as const; const DECISION_STRATEGIES = ["UNANIMOUS", "AFFIRMATIVE", "CONSENSUS"] as const;
@ -211,7 +211,7 @@ export default function PermissionDetails() {
/> />
} }
> >
<TextInput <KeycloakTextInput
id="name" id="name"
name="name" name="name"
ref={register({ required: true })} ref={register({ required: true })}
@ -274,7 +274,7 @@ export default function PermissionDetails() {
/> />
} }
> >
<TextInput <KeycloakTextInput
id="resourceType" id="resourceType"
name="resourceType" name="resourceType"
ref={register} ref={register}

View file

@ -12,7 +12,6 @@ import {
FormGroup, FormGroup,
PageSection, PageSection,
Switch, Switch,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -33,6 +32,7 @@ import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput
import { toAuthorizationTab } from "../routes/AuthenticationTab"; import { toAuthorizationTab } from "../routes/AuthenticationTab";
import { ScopePicker } from "./ScopePicker"; import { ScopePicker } from "./ScopePicker";
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput"; import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./resource-details.css"; import "./resource-details.css";
@ -193,7 +193,11 @@ export default function ResourceDetails() {
/> />
} }
> >
<TextInput id="owner" value={client.clientId} isReadOnly /> <KeycloakTextInput
id="owner"
value={client.clientId}
isReadOnly
/>
</FormGroup> </FormGroup>
<FormGroup <FormGroup
label={t("common:name")} label={t("common:name")}
@ -210,7 +214,7 @@ export default function ResourceDetails() {
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
id="name" id="name"
name="name" name="name"
ref={register({ required: true })} ref={register({ required: true })}
@ -231,7 +235,7 @@ export default function ResourceDetails() {
/> />
} }
> >
<TextInput id="displayName" name="name" ref={register} /> <KeycloakTextInput id="displayName" name="name" ref={register} />
</FormGroup> </FormGroup>
<FormGroup <FormGroup
label={t("type")} label={t("type")}
@ -240,7 +244,7 @@ export default function ResourceDetails() {
<HelpItem helpText="clients-help:type" fieldLabelId="type" /> <HelpItem helpText="clients-help:type" fieldLabelId="type" />
} }
> >
<TextInput id="type" name="type" ref={register} /> <KeycloakTextInput id="type" name="type" ref={register} />
</FormGroup> </FormGroup>
<FormGroup <FormGroup
label={t("uris")} label={t("uris")}
@ -269,7 +273,7 @@ export default function ResourceDetails() {
/> />
} }
> >
<TextInput id="iconUri" name="icon_uri" ref={register} /> <KeycloakTextInput id="iconUri" name="icon_uri" ref={register} />
</FormGroup> </FormGroup>
<FormGroup <FormGroup
hasNoPaddingTop hasNoPaddingTop

View file

@ -10,7 +10,6 @@ import {
DropdownItem, DropdownItem,
FormGroup, FormGroup,
PageSection, PageSection,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -22,6 +21,7 @@ import { ViewHeader } from "../../components/view-header/ViewHeader";
import { toAuthorizationTab } from "../routes/AuthenticationTab"; import { toAuthorizationTab } from "../routes/AuthenticationTab";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import useToggle from "../../utils/useToggle"; import useToggle from "../../utils/useToggle";
import { DeleteScopeDialog } from "./DeleteScopeDialog"; import { DeleteScopeDialog } from "./DeleteScopeDialog";
@ -143,7 +143,7 @@ export default function ScopeDetails() {
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
id="name" id="name"
name="name" name="name"
ref={register({ required: true })} ref={register({ required: true })}
@ -162,7 +162,11 @@ export default function ScopeDetails() {
/> />
} }
> >
<TextInput id="displayName" name="displayName" ref={register} /> <KeycloakTextInput
id="displayName"
name="displayName"
ref={register}
/>
</FormGroup> </FormGroup>
<FormGroup <FormGroup
label={t("iconUri")} label={t("iconUri")}
@ -174,7 +178,7 @@ export default function ScopeDetails() {
/> />
} }
> >
<TextInput id="iconUri" name="iconUri" ref={register} /> <KeycloakTextInput id="iconUri" name="iconUri" ref={register} />
</FormGroup> </FormGroup>
<ActionGroup> <ActionGroup>
<div className="pf-u-mt-md"> <div className="pf-u-mt-md">

View file

@ -11,11 +11,11 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type PolicyProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation"; import type PolicyProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation";
import useToggle from "../../utils/useToggle"; import useToggle from "../../utils/useToggle";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./search-dropdown.css"; import "./search-dropdown.css";
@ -93,7 +93,7 @@ export const SearchDropdown = ({
onSubmit={handleSubmit(submit)} onSubmit={handleSubmit(submit)}
> >
<FormGroup label={t("common:name")} fieldId="name"> <FormGroup label={t("common:name")} fieldId="name">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="name" id="name"
@ -104,7 +104,7 @@ export const SearchDropdown = ({
{isResource && ( {isResource && (
<> <>
<FormGroup label={t("common:type")} fieldId="type"> <FormGroup label={t("common:type")} fieldId="type">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="type" id="type"
@ -113,7 +113,7 @@ export const SearchDropdown = ({
/> />
</FormGroup> </FormGroup>
<FormGroup label={t("uris")} fieldId="uri"> <FormGroup label={t("uris")} fieldId="uri">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="uri" id="uri"
@ -122,7 +122,7 @@ export const SearchDropdown = ({
/> />
</FormGroup> </FormGroup>
<FormGroup label={t("owner")} fieldId="owner"> <FormGroup label={t("owner")} fieldId="owner">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="owner" id="owner"
@ -134,7 +134,7 @@ export const SearchDropdown = ({
)} )}
{!isResource && ( {!isResource && (
<FormGroup label={t("resource")} fieldId="resource"> <FormGroup label={t("resource")} fieldId="resource">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="resource" id="resource"
@ -144,7 +144,7 @@ export const SearchDropdown = ({
</FormGroup> </FormGroup>
)} )}
<FormGroup label={t("scope")} fieldId="scope"> <FormGroup label={t("scope")} fieldId="scope">
<TextInput <KeycloakTextInput
ref={register} ref={register}
type="text" type="text"
id="scope" id="scope"

View file

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext, Controller } from "react-hook-form"; import { useFormContext, Controller } from "react-hook-form";
import { MinusCircleIcon } from "@patternfly/react-icons"; import { MinusCircleIcon } from "@patternfly/react-icons";
import { FormGroup, Button, Checkbox, TextInput } from "@patternfly/react-core"; import { FormGroup, Button, Checkbox } from "@patternfly/react-core";
import { import {
TableComposable, TableComposable,
Thead, Thead,
@ -16,6 +16,7 @@ import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/g
import { HelpItem } from "../../../components/help-enabler/HelpItem"; import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { useAdminClient, useFetch } from "../../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../../context/auth/AdminClient";
import { GroupPickerDialog } from "../../../components/group/GroupPickerDialog"; import { GroupPickerDialog } from "../../../components/group/GroupPickerDialog";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
export type GroupValue = { export type GroupValue = {
id: string; id: string;
@ -69,7 +70,7 @@ export const Group = () => {
} }
fieldId="groups" fieldId="groups"
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="groupsClaim" id="groupsClaim"
name="groupsClaim" name="groupsClaim"

View file

@ -1,14 +1,10 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { import { FormGroup, TextArea, ValidatedOptions } from "@patternfly/react-core";
FormGroup,
TextArea,
TextInput,
ValidatedOptions,
} from "@patternfly/react-core";
import { HelpItem } from "../../../components/help-enabler/HelpItem"; import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
type NameDescriptionProps = { type NameDescriptionProps = {
prefix: string; prefix: string;
@ -38,7 +34,7 @@ export const NameDescription = ({ prefix }: NameDescriptionProps) => {
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-name" id="kc-name"
name="name" name="name"

View file

@ -1,9 +1,10 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput } from "@patternfly/react-core"; import { FormGroup } from "@patternfly/react-core";
import { HelpItem } from "../../../components/help-enabler/HelpItem"; import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
export const Regex = () => { export const Regex = () => {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -27,7 +28,7 @@ export const Regex = () => {
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="targetClaim" id="targetClaim"
name="targetClaim" name="targetClaim"
@ -49,7 +50,7 @@ export const Regex = () => {
validated={errors.pattern ? "error" : "default"} validated={errors.pattern ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"
id="pattern" id="pattern"

View file

@ -1,13 +1,9 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
import { import { FormGroup, Switch, ValidatedOptions } from "@patternfly/react-core";
FormGroup,
Switch,
TextInput,
ValidatedOptions,
} from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const X509 = () => { export const X509 = () => {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -61,7 +57,7 @@ export const X509 = () => {
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"
id="kc-subject" id="kc-subject"

View file

@ -4,7 +4,6 @@ import {
Button, Button,
FormGroup, FormGroup,
PageSection, PageSection,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
import React, { useState } from "react"; import React, { useState } from "react";
@ -15,6 +14,7 @@ import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload";
import { ViewHeader } from "../../components/view-header/ViewHeader"; import { ViewHeader } from "../../components/view-header/ViewHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import { convertFormValuesToObject, convertToFormValues } from "../../util"; import { convertFormValuesToObject, convertToFormValues } from "../../util";
@ -77,7 +77,7 @@ export default function ImportForm() {
<JsonFileUpload id="realm-file" onChange={handleFileChange} /> <JsonFileUpload id="realm-file" onChange={handleFileChange} />
<ClientDescription /> <ClientDescription />
<FormGroup label={t("common:type")} fieldId="kc-type"> <FormGroup label={t("common:type")} fieldId="kc-type">
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-type" id="kc-type"
name="protocol" name="protocol"

View file

@ -14,7 +14,6 @@ import {
Switch, Switch,
Text, Text,
TextContent, TextContent,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
@ -22,6 +21,7 @@ import type CertificateRepresentation from "@keycloak/keycloak-admin-client/lib/
import type KeyStoreConfig from "@keycloak/keycloak-admin-client/lib/defs/keystoreConfig"; import type KeyStoreConfig from "@keycloak/keycloak-admin-client/lib/defs/keystoreConfig";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { Controller, useFormContext, useWatch } from "react-hook-form"; import { Controller, useFormContext, useWatch } from "react-hook-form";
import { GenerateKeyDialog } from "./GenerateKeyDialog"; import { GenerateKeyDialog } from "./GenerateKeyDialog";
import { useFetch, useAdminClient } from "../../context/auth/AdminClient"; import { useFetch, useAdminClient } from "../../context/auth/AdminClient";
@ -170,7 +170,7 @@ export const Keys = ({ clientId, save }: KeysProps) => {
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="jwksUrl" id="jwksUrl"
name="attributes.jwks.url" name="attributes.jwks.url"

View file

@ -1,11 +1,12 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput } from "@patternfly/react-core"; import { FormGroup } from "@patternfly/react-core";
import type KeyStoreConfig from "@keycloak/keycloak-admin-client/lib/defs/keystoreConfig"; import type KeyStoreConfig from "@keycloak/keycloak-admin-client/lib/defs/keystoreConfig";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { PasswordInput } from "../../components/password-input/PasswordInput"; import { PasswordInput } from "../../components/password-input/PasswordInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const StoreSettings = ({ export const StoreSettings = ({
hidePassword = false, hidePassword = false,
@ -28,7 +29,7 @@ export const StoreSettings = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
data-testid="keyAlias" data-testid="keyAlias"
type="text" type="text"
id="keyAlias" id="keyAlias"

View file

@ -1,15 +1,10 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
import { import { Button, Chip, ChipGroup, FormGroup } from "@patternfly/react-core";
Button,
Chip,
ChipGroup,
FormGroup,
TextInput,
} from "@patternfly/react-core";
import { HelpItem } from "../help-enabler/HelpItem"; import { HelpItem } from "../help-enabler/HelpItem";
import { KeycloakTextInput } from "../keycloak-text-input/KeycloakTextInput";
import type { ComponentProps } from "./components"; import type { ComponentProps } from "./components";
import { AddScopeDialog } from "../../clients/scopes/AddScopeDialog"; import { AddScopeDialog } from "../../clients/scopes/AddScopeDialog";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
@ -86,7 +81,7 @@ export const MultivaluedScopesComponent = ({
/> />
)} )}
{value.length === 0 && !conditionName && ( {value.length === 0 && !conditionName && (
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-scopes" id="kc-scopes"
value={value} value={value}

View file

@ -1,9 +1,10 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput } from "@patternfly/react-core"; import { FormGroup } from "@patternfly/react-core";
import { HelpItem } from "../help-enabler/HelpItem"; import { HelpItem } from "../help-enabler/HelpItem";
import { KeycloakTextInput } from "../keycloak-text-input/KeycloakTextInput";
import type { ComponentProps } from "./components"; import type { ComponentProps } from "./components";
export const StringComponent = ({ export const StringComponent = ({
@ -24,7 +25,7 @@ export const StringComponent = ({
} }
fieldId={name!} fieldId={name!}
> >
<TextInput <KeycloakTextInput
id={name!} id={name!}
data-testid={name} data-testid={name}
isDisabled={isDisabled} isDisabled={isDisabled}

View file

@ -1,11 +1,12 @@
/** /**
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { FormGroup, Switch, TextInput } from "@patternfly/react-core"; import { FormGroup, Switch } from "@patternfly/react-core";
import { render, screen } from "@testing-library/react"; import { render, screen } from "@testing-library/react";
import type WhoAmIRepresentation from "@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation"; import type WhoAmIRepresentation from "@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation";
import React from "react"; import React from "react";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import { KeycloakTextInput } from "../keycloak-text-input/KeycloakTextInput";
import { AccessContextProvider } from "../../context/access/Access"; import { AccessContextProvider } from "../../context/access/Access";
import { RealmContext } from "../../context/realm-context/RealmContext"; import { RealmContext } from "../../context/realm-context/RealmContext";
import { WhoAmI, WhoAmIContext } from "../../context/whoami/WhoAmI"; import { WhoAmI, WhoAmIContext } from "../../context/whoami/WhoAmI";
@ -26,7 +27,7 @@ describe("FormAccess", () => {
<AccessContextProvider> <AccessContextProvider>
<FormAccess role="manage-clients"> <FormAccess role="manage-clients">
<FormGroup label="test" fieldId="field"> <FormGroup label="test" fieldId="field">
<TextInput <KeycloakTextInput
type="text" type="text"
id="field" id="field"
data-testid="field" data-testid="field"

View file

@ -7,11 +7,11 @@ import {
Button, Button,
Flex, Flex,
FlexItem, FlexItem,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons"; import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons";
import type { KeyValueType } from "./key-value-convert"; import type { KeyValueType } from "./key-value-convert";
import { KeycloakTextInput } from "../keycloak-text-input/KeycloakTextInput";
type KeyValueInputProps = { type KeyValueInputProps = {
name: string; name: string;
@ -58,7 +58,7 @@ export const KeyValueInput = ({ name }: KeyValueInputProps) => {
{fields.map((attribute, index) => ( {fields.map((attribute, index) => (
<Flex key={attribute.id} data-testid="row"> <Flex key={attribute.id} data-testid="row">
<FlexItem grow={{ default: "grow" }}> <FlexItem grow={{ default: "grow" }}>
<TextInput <KeycloakTextInput
name={`${name}[${index}].key`} name={`${name}[${index}].key`}
ref={register()} ref={register()}
placeholder={t("keyPlaceholder")} placeholder={t("keyPlaceholder")}
@ -71,7 +71,7 @@ export const KeyValueInput = ({ name }: KeyValueInputProps) => {
grow={{ default: "grow" }} grow={{ default: "grow" }}
spacer={{ default: "spacerNone" }} spacer={{ default: "spacerNone" }}
> >
<TextInput <KeycloakTextInput
name={`${name}[${index}].value`} name={`${name}[${index}].value`}
ref={register()} ref={register()}
placeholder={t("valuePlaceholder")} placeholder={t("valuePlaceholder")}

View file

@ -0,0 +1,27 @@
import { TextInput, TextInputProps } from "@patternfly/react-core";
import React, { ComponentProps, forwardRef, HTMLProps } from "react";
// PatternFly changes the signature of the 'onChange' handler for input elements.
// This causes issues with React Hook Form as it expects the default signature for an input element.
// So we have to create this wrapper component that takes care of converting these signatures for us.
export type KeycloakTextInputProps = Omit<
ComponentProps<typeof TextInput>,
"onChange"
> &
Pick<HTMLProps<HTMLInputElement>, "onChange">;
export const KeycloakTextInput = forwardRef<
HTMLInputElement,
KeycloakTextInputProps
>(({ onChange, ...props }, ref) => {
const onChangeForward: TextInputProps["onChange"] = (_, event) =>
onChange?.(event);
return <TextInput {...props} ref={ref} onChange={onChangeForward} />;
});
// We need to fake the displayName to match what PatternFly expects.
// This is because PatternFly uses it to filter children in certain aspects.
// This is a stupid approach, but it's not like we can change that.
KeycloakTextInput.displayName = "TextInput";

View file

@ -1,14 +1,14 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import { Button, InputGroup } from "@patternfly/react-core";
Button,
InputGroup,
TextInput,
TextInputProps,
} from "@patternfly/react-core";
import { EyeIcon, EyeSlashIcon } from "@patternfly/react-icons"; import { EyeIcon, EyeSlashIcon } from "@patternfly/react-icons";
type PasswordInputProps = TextInputProps & { import {
KeycloakTextInput,
KeycloakTextInputProps,
} from "../keycloak-text-input/KeycloakTextInput";
type PasswordInputProps = KeycloakTextInputProps & {
hasReveal?: boolean; hasReveal?: boolean;
}; };
@ -21,7 +21,7 @@ const PasswordInputBase = ({
const [hidePassword, setHidePassword] = useState(true); const [hidePassword, setHidePassword] = useState(true);
return ( return (
<InputGroup> <InputGroup>
<TextInput <KeycloakTextInput
{...rest} {...rest}
type={hidePassword ? "password" : "text"} type={hidePassword ? "password" : "text"}
ref={innerRef} ref={innerRef}

View file

@ -14,7 +14,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { import {
cellWidth, cellWidth,
@ -32,6 +31,7 @@ import { useTranslation } from "react-i18next";
import { pickBy } from "lodash-es"; import { pickBy } from "lodash-es";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../context/server-info/ServerInfoProvider";
@ -345,7 +345,7 @@ export const AdminEvents = () => {
fieldId="kc-resourcePath" fieldId="kc-resourcePath"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-resourcePath" id="kc-resourcePath"
@ -358,7 +358,7 @@ export const AdminEvents = () => {
fieldId="kc-realm" fieldId="kc-realm"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-realm" id="kc-realm"
@ -371,7 +371,7 @@ export const AdminEvents = () => {
fieldId="kc-client" fieldId="kc-client"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-client" id="kc-client"
@ -384,7 +384,7 @@ export const AdminEvents = () => {
fieldId="kc-user" fieldId="kc-user"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-user" id="kc-user"
@ -397,7 +397,7 @@ export const AdminEvents = () => {
fieldId="kc-ipAddress" fieldId="kc-ipAddress"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-ipAddress" id="kc-ipAddress"
@ -410,7 +410,7 @@ export const AdminEvents = () => {
fieldId="kc-dateFrom" fieldId="kc-dateFrom"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-dateFrom" id="kc-dateFrom"
@ -425,7 +425,7 @@ export const AdminEvents = () => {
fieldId="kc-dateTo" fieldId="kc-dateTo"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-dateTo" id="kc-dateTo"

View file

@ -19,7 +19,6 @@ import {
SelectVariant, SelectVariant,
Tab, Tab,
TabTitleText, TabTitleText,
TextInput,
Tooltip, Tooltip,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { CheckCircleIcon, WarningTriangleIcon } from "@patternfly/react-icons"; import { CheckCircleIcon, WarningTriangleIcon } from "@patternfly/react-icons";
@ -37,6 +36,7 @@ import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient, useFetch } from "../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { toRealmSettings } from "../realm-settings/routes/RealmSettings"; import { toRealmSettings } from "../realm-settings/routes/RealmSettings";
@ -224,7 +224,7 @@ export default function EventsSection() {
fieldId="kc-userId" fieldId="kc-userId"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-userId" id="kc-userId"
@ -302,7 +302,7 @@ export default function EventsSection() {
fieldId="kc-client" fieldId="kc-client"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-client" id="kc-client"
@ -315,7 +315,7 @@ export default function EventsSection() {
fieldId="kc-dateFrom" fieldId="kc-dateFrom"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-dateFrom" id="kc-dateFrom"
@ -330,7 +330,7 @@ export default function EventsSection() {
fieldId="kc-dateTo" fieldId="kc-dateTo"
className="keycloak__events_search__form_label" className="keycloak__events_search__form_label"
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-dateTo" id="kc-dateTo"

View file

@ -7,7 +7,6 @@ import {
FormGroup, FormGroup,
Modal, Modal,
ModalVariant, ModalVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -16,6 +15,7 @@ import { useForm } from "react-hook-form";
import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation"; import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type GroupsModalProps = { type GroupsModalProps = {
id?: string; id?: string;
@ -104,7 +104,7 @@ export const GroupsModal = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="groupNameInput" data-testid="groupNameInput"
aria-label="group name input" aria-label="group name input"
ref={register({ required: true })} ref={register({ required: true })}

View file

@ -8,7 +8,6 @@ import {
Button, Button,
FormGroup, FormGroup,
PageSection, PageSection,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -32,6 +31,7 @@ import { AddMapperForm } from "./AddMapperForm";
import { DynamicComponents } from "../../components/dynamic/DynamicComponents"; import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner"; import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
import type { AttributeForm } from "../../components/key-value-form/AttributeForm"; import type { AttributeForm } from "../../components/key-value-form/AttributeForm";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type IdPMapperRepresentationWithAttributes = export type IdPMapperRepresentationWithAttributes =
IdentityProviderMapperRepresentation & AttributeForm; IdentityProviderMapperRepresentation & AttributeForm;
@ -177,7 +177,7 @@ export default function AddMapper() {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
value={currentMapper?.id} value={currentMapper?.id}

View file

@ -6,7 +6,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -14,6 +13,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation"; import type IdentityProviderMapperRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation";
import type { IdPMapperRepresentationWithAttributes } from "./AddMapper"; import type { IdPMapperRepresentationWithAttributes } from "./AddMapper";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type AddMapperFormProps = { type AddMapperFormProps = {
mapperTypes: Record<string, IdentityProviderMapperRepresentation>; mapperTypes: Record<string, IdentityProviderMapperRepresentation>;
@ -60,7 +60,7 @@ export const AddMapperForm = ({
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"
datatest-id="name-input" datatest-id="name-input"

View file

@ -7,12 +7,12 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { SwitchField } from "../component/SwitchField"; import { SwitchField } from "../component/SwitchField";
import { TextField } from "../component/TextField"; import { TextField } from "../component/TextField";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./discovery-settings.css"; import "./discovery-settings.css";
@ -66,7 +66,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
name="config.entityId" name="config.entityId"
data-testid="serviceProviderEntityId" data-testid="serviceProviderEntityId"
@ -91,7 +91,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
data-testid="sso-service-url" data-testid="sso-service-url"
id="kc-sso-service-url" id="kc-sso-service-url"
@ -121,7 +121,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="single-logout-service-url" id="single-logout-service-url"
name="config.singleLogoutServiceUrl" name="config.singleLogoutServiceUrl"
@ -278,7 +278,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
} }
fieldId="principalAttribute" fieldId="principalAttribute"
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="principalAttribute" id="principalAttribute"
name="config.principalAttribute" name="config.principalAttribute"
@ -448,7 +448,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
fieldId="allowedClockSkew" fieldId="allowedClockSkew"
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min="0" min="0"
max="2147483" max="2147483"
@ -470,7 +470,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
fieldId="attributeConsumingServiceIndex" fieldId="attributeConsumingServiceIndex"
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min="0" min="0"
max="65535" max="65535"
@ -492,7 +492,7 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
fieldId="attributeConsumingServiceName" fieldId="attributeConsumingServiceName"
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="attributeConsumingServiceName" id="attributeConsumingServiceName"
name="config.attributeConsumingServiceName" name="config.attributeConsumingServiceName"

View file

@ -4,12 +4,12 @@ import { useFormContext, useWatch } from "react-hook-form";
import { import {
ExpandableSection, ExpandableSection,
FormGroup, FormGroup,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { SwitchField } from "../component/SwitchField"; import { SwitchField } from "../component/SwitchField";
import { TextField } from "../component/TextField"; import { TextField } from "../component/TextField";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import "./discovery-settings.css"; import "./discovery-settings.css";
@ -47,7 +47,7 @@ const Fields = ({ readOnly }: DiscoverySettingsProps) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
data-testid="authorizationUrl" data-testid="authorizationUrl"
id="kc-authorization-url" id="kc-authorization-url"
@ -73,7 +73,7 @@ const Fields = ({ readOnly }: DiscoverySettingsProps) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="tokenUrl" id="tokenUrl"
name="config.tokenUrl" name="config.tokenUrl"

View file

@ -1,12 +1,13 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput, ValidatedOptions } from "@patternfly/react-core"; import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { RedirectUrl } from "../component/RedirectUrl"; import { RedirectUrl } from "../component/RedirectUrl";
import { TextField } from "../component/TextField"; import { TextField } from "../component/TextField";
import { DisplayOrder } from "../component/DisplayOrder"; import { DisplayOrder } from "../component/DisplayOrder";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import type { IdentityProviderParams } from "../routes/IdentityProvider"; import type { IdentityProviderParams } from "../routes/IdentityProvider";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
@ -38,7 +39,7 @@ export const OIDCGeneralSettings = ({ id }: { id: string }) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
isReadOnly={tab === "settings"} isReadOnly={tab === "settings"}
isRequired isRequired
type="text" type="text"

View file

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput, Title } from "@patternfly/react-core"; import { FormGroup, Title } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -12,6 +12,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { DescriptorSettings } from "./DescriptorSettings"; import { DescriptorSettings } from "./DescriptorSettings";
import { getBaseUrl } from "../../util"; import { getBaseUrl } from "../../util";
import { DiscoveryEndpointField } from "../component/DiscoveryEndpointField"; import { DiscoveryEndpointField } from "../component/DiscoveryEndpointField";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import environment from "../../environment"; import environment from "../../environment";
export const SamlConnectSettings = () => { export const SamlConnectSettings = () => {
@ -92,7 +93,7 @@ export const SamlConnectSettings = () => {
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
validated={errors.config?.entityId ? "error" : "default"} validated={errors.config?.entityId ? "error" : "default"}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
name="config.entityId" name="config.entityId"
data-testid="serviceProviderEntityId" data-testid="serviceProviderEntityId"

View file

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput, ValidatedOptions } from "@patternfly/react-core"; import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { RedirectUrl } from "../component/RedirectUrl"; import { RedirectUrl } from "../component/RedirectUrl";
@ -10,6 +10,7 @@ import { DisplayOrder } from "../component/DisplayOrder";
import { useParams } from "react-router"; import { useParams } from "react-router";
import type { IdentityProviderParams } from "../routes/IdentityProvider"; import type { IdentityProviderParams } from "../routes/IdentityProvider";
import { FormattedLink } from "../../components/external-link/FormattedLink"; import { FormattedLink } from "../../components/external-link/FormattedLink";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import environment from "../../environment"; import environment from "../../environment";
@ -47,7 +48,7 @@ export const SamlGeneralSettings = ({ id }: { id: string }) => {
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="alias" id="alias"

View file

@ -1,10 +1,11 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput, ValidatedOptions } from "@patternfly/react-core"; import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { PasswordInput } from "../../components/password-input/PasswordInput"; import { PasswordInput } from "../../components/password-input/PasswordInput";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const ClientIdSecret = ({ export const ClientIdSecret = ({
secretRequired = true, secretRequired = true,
@ -39,7 +40,7 @@ export const ClientIdSecret = ({
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-client-id" id="kc-client-id"
@ -75,7 +76,7 @@ export const ClientIdSecret = ({
/> />
)} )}
{!create && ( {!create && (
<TextInput <KeycloakTextInput
isRequired={secretRequired} isRequired={secretRequired}
type="password" type="password"
id="kc-client-secret" id="kc-client-secret"

View file

@ -1,10 +1,11 @@
import React, { ReactNode, useEffect, useState } from "react"; import React, { ReactNode, useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { FormGroup, TextInput, Switch } from "@patternfly/react-core"; import { FormGroup, Switch } from "@patternfly/react-core";
import environment from "../../environment"; import environment from "../../environment";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
type DiscoveryEndpointFieldProps = { type DiscoveryEndpointFieldProps = {
@ -124,7 +125,7 @@ export const DiscoveryEndpointField = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
type="text" type="text"
name="discoveryEndpoint" name="discoveryEndpoint"
data-testid="discoveryEndpoint" data-testid="discoveryEndpoint"

View file

@ -1,14 +1,14 @@
import React from "react"; import React from "react";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
import { TextInput } from "@patternfly/react-core";
import { FieldProps, FormGroupField } from "./FormGroupField"; import { FieldProps, FormGroupField } from "./FormGroupField";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const TextField = ({ label, field, isReadOnly = false }: FieldProps) => { export const TextField = ({ label, field, isReadOnly = false }: FieldProps) => {
const { register } = useFormContext(); const { register } = useFormContext();
return ( return (
<FormGroupField label={label}> <FormGroupField label={label}>
<TextInput <KeycloakTextInput
type="text" type="text"
id={label} id={label}
data-testid={label} data-testid={label}

View file

@ -5,7 +5,6 @@ import {
FormGroup, FormGroup,
PageSection, PageSection,
TextArea, TextArea,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -13,6 +12,7 @@ import type { UseFormMethods } from "react-hook-form";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
import { FormAccess } from "../components/form-access/FormAccess"; import { FormAccess } from "../components/form-access/FormAccess";
import type { AttributeForm } from "../components/key-value-form/AttributeForm"; import type { AttributeForm } from "../components/key-value-form/AttributeForm";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
@ -50,7 +50,7 @@ export const RealmRoleForm = ({
validated={errors.name ? "error" : "default"} validated={errors.name ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register({ ref={register({
required: !editMode, required: !editMode,
validate: (value: string) => validate: (value: string) =>

View file

@ -6,13 +6,14 @@ import {
FormGroup, FormGroup,
Modal, Modal,
ModalVariant, ModalVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useForm, UseFormMethods } from "react-hook-form"; import { useForm, UseFormMethods } from "react-hook-form";
import type { KeyValueType } from "../components/key-value-form/key-value-convert"; import type { KeyValueType } from "../components/key-value-form/key-value-convert";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type AddMessageBundleModalProps = { type AddMessageBundleModalProps = {
id?: string; id?: string;
form: UseFormMethods<BundleForm>; form: UseFormMethods<BundleForm>;
@ -75,7 +76,7 @@ export const AddMessageBundleModal = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="key-input" data-testid="key-input"
ref={register({ required: true })} ref={register({ required: true })}
autoFocus autoFocus
@ -97,7 +98,7 @@ export const AddMessageBundleModal = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="value-input" data-testid="value-input"
ref={register({ required: true })} ref={register({ required: true })}
type="text" type="text"

View file

@ -7,7 +7,6 @@ import {
Modal, Modal,
ModalVariant, ModalVariant,
TextContent, TextContent,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -16,6 +15,7 @@ import { useForm } from "react-hook-form";
import { emailRegexPattern } from "../util"; import { emailRegexPattern } from "../util";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useWhoAmI } from "../context/whoami/WhoAmI"; import { useWhoAmI } from "../context/whoami/WhoAmI";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import type { EmailRegistrationCallback } from "./EmailTab"; import type { EmailRegistrationCallback } from "./EmailTab";
type AddUserEmailModalProps = { type AddUserEmailModalProps = {
@ -90,7 +90,7 @@ export const AddUserEmailModal = ({ callback }: AddUserEmailModalProps) => {
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="email-address-input" data-testid="email-address-input"
ref={register({ required: true, pattern: emailRegexPattern })} ref={register({ required: true, pattern: emailRegexPattern })}
autoFocus autoFocus

View file

@ -17,7 +17,6 @@ import {
PageSection, PageSection,
Text, Text,
TextArea, TextArea,
TextInput,
TextVariants, TextVariants,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -30,6 +29,7 @@ import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient, useFetch } from "../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation"; import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons"; import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons";
import "./realm-settings-section.css"; import "./realm-settings-section.css";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
@ -236,7 +236,7 @@ export default function ClientProfileForm() {
errors.name ? ValidatedOptions.error : ValidatedOptions.default errors.name ? ValidatedOptions.error : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
ref={register({ required: true })} ref={register({ required: true })}
name="name" name="name"
type="text" type="text"

View file

@ -6,7 +6,6 @@ import {
FormGroup, FormGroup,
PageSection, PageSection,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
import React, { useState } from "react"; import React, { useState } from "react";
@ -16,6 +15,7 @@ import { useAlerts } from "../components/alert/Alerts";
import { FormAccess } from "../components/form-access/FormAccess"; import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormPanel } from "../components/scroll-form/FormPanel"; import { FormPanel } from "../components/scroll-form/FormPanel";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { useWhoAmI } from "../context/whoami/WhoAmI"; import { useWhoAmI } from "../context/whoami/WhoAmI";
@ -161,7 +161,7 @@ export const RealmSettingsEmailTab = ({
validated={errors.smtpServer?.from ? "error" : "default"} validated={errors.smtpServer?.from ? "error" : "default"}
helperTextInvalid={t("users:emailInvalid")} helperTextInvalid={t("users:emailInvalid")}
> >
<TextInput <KeycloakTextInput
type="email" type="email"
id="kc-sender-email-address" id="kc-sender-email-address"
data-testid="sender-email-address" data-testid="sender-email-address"
@ -184,7 +184,7 @@ export const RealmSettingsEmailTab = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-from-display-name" id="kc-from-display-name"
data-testid="from-display-name" data-testid="from-display-name"
@ -199,7 +199,7 @@ export const RealmSettingsEmailTab = ({
validated={errors.smtpServer?.replyTo ? "error" : "default"} validated={errors.smtpServer?.replyTo ? "error" : "default"}
helperTextInvalid={t("users:emailInvalid")} helperTextInvalid={t("users:emailInvalid")}
> >
<TextInput <KeycloakTextInput
type="email" type="email"
id="kc-reply-to" id="kc-reply-to"
name="smtpServer.replyTo" name="smtpServer.replyTo"
@ -220,7 +220,7 @@ export const RealmSettingsEmailTab = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-reply-to-display-name" id="kc-reply-to-display-name"
name="smtpServer.replyToDisplayName" name="smtpServer.replyToDisplayName"
@ -238,7 +238,7 @@ export const RealmSettingsEmailTab = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-envelope-from" id="kc-envelope-from"
name="smtpServer.envelopeFrom" name="smtpServer.envelopeFrom"
@ -265,7 +265,7 @@ export const RealmSettingsEmailTab = ({
validated={errors.smtpServer?.host ? "error" : "default"} validated={errors.smtpServer?.host ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-host" id="kc-host"
name="smtpServer.host" name="smtpServer.host"
@ -275,7 +275,7 @@ export const RealmSettingsEmailTab = ({
/> />
</FormGroup> </FormGroup>
<FormGroup label={t("port")} fieldId="kc-port"> <FormGroup label={t("port")} fieldId="kc-port">
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-port" id="kc-port"
name="smtpServer.port" name="smtpServer.port"
@ -347,7 +347,7 @@ export const RealmSettingsEmailTab = ({
validated={errors.smtpServer?.user ? "error" : "default"} validated={errors.smtpServer?.user ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-username" id="kc-username"
data-testid="username-input" data-testid="username-input"
@ -370,7 +370,7 @@ export const RealmSettingsEmailTab = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="password" type="password"
id="kc-password" id="kc-password"
data-testid="password-input" data-testid="password-input"

View file

@ -13,7 +13,6 @@ import {
Stack, Stack,
StackItem, StackItem,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
@ -24,6 +23,7 @@ import { useRealm } from "../context/realm-context/RealmContext";
import { FormAccess } from "../components/form-access/FormAccess"; import { FormAccess } from "../components/form-access/FormAccess";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormattedLink } from "../components/external-link/FormattedLink"; import { FormattedLink } from "../components/external-link/FormattedLink";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type RealmSettingsGeneralTabProps = { type RealmSettingsGeneralTabProps = {
save: (realm: RealmRepresentation) => void; save: (realm: RealmRepresentation) => void;
@ -71,7 +71,7 @@ export const RealmSettingsGeneralTab = ({
/> />
</FormGroup> </FormGroup>
<FormGroup label={t("displayName")} fieldId="kc-display-name"> <FormGroup label={t("displayName")} fieldId="kc-display-name">
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-display-name" id="kc-display-name"
name="displayName" name="displayName"
@ -79,7 +79,7 @@ export const RealmSettingsGeneralTab = ({
/> />
</FormGroup> </FormGroup>
<FormGroup label={t("htmlDisplayName")} fieldId="kc-html-display-name"> <FormGroup label={t("htmlDisplayName")} fieldId="kc-html-display-name">
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-html-display-name" id="kc-html-display-name"
name="displayNameHtml" name="displayNameHtml"
@ -96,7 +96,7 @@ export const RealmSettingsGeneralTab = ({
/> />
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-frontend-url" id="kc-frontend-url"
name="attributes.frontendUrl" name="attributes.frontendUrl"

View file

@ -17,7 +17,6 @@ import {
PageSection, PageSection,
Text, Text,
TextArea, TextArea,
TextInput,
TextVariants, TextVariants,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
@ -30,6 +29,7 @@ import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient, useFetch } from "../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import { HelpItem } from "../components/help-enabler/HelpItem"; import { HelpItem } from "../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons"; import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation"; import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation";
@ -466,7 +466,7 @@ export default function NewClientPolicyForm() {
errors.name ? ValidatedOptions.error : ValidatedOptions.default errors.name ? ValidatedOptions.error : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
ref={form.register({ required: true })} ref={form.register({ required: true })}
type="text" type="text"
id="kc-client-profile-name" id="kc-client-profile-name"

View file

@ -21,6 +21,7 @@ import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { KEY_PROVIDER_TYPE } from "../../../util"; import { KEY_PROVIDER_TYPE } from "../../../util";
import { ViewHeader } from "../../../components/view-header/ViewHeader"; import { ViewHeader } from "../../../components/view-header/ViewHeader";
import { DynamicComponents } from "../../../components/dynamic/DynamicComponents"; import { DynamicComponents } from "../../../components/dynamic/DynamicComponents";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
import { useServerInfo } from "../../../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../../../context/server-info/ServerInfoProvider";
type KeyProviderFormProps = { type KeyProviderFormProps = {
@ -105,7 +106,7 @@ export const KeyProviderForm = ({
fieldId="providerId" fieldId="providerId"
isRequired isRequired
> >
<TextInput <KeycloakTextInput
ref={register} ref={register}
id="id" id="id"
type="text" type="text"

View file

@ -1,9 +1,10 @@
import React from "react"; import React from "react";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { FormGroup, TextInput } from "@patternfly/react-core"; import { FormGroup } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { FormattedLink } from "../../components/external-link/FormattedLink"; import { FormattedLink } from "../../components/external-link/FormattedLink";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useFormContext } from "react-hook-form"; import { useFormContext } from "react-hook-form";
type HelpLinkTextInputProps = { type HelpLinkTextInputProps = {
@ -34,7 +35,12 @@ export const HelpLinkTextInput = ({
/> />
} }
> >
<TextInput type="text" id={name} name={fieldName} ref={register} /> <KeycloakTextInput
type="text"
id={name}
name={fieldName}
ref={register}
/>
</FormGroup> </FormGroup>
); );
}; };

View file

@ -6,7 +6,6 @@ import {
PageSection, PageSection,
Text, Text,
TextContent, TextContent,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import React, { useEffect, useMemo } from "react"; import React, { useEffect, useMemo } from "react";
import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
@ -15,6 +14,7 @@ import { Link, useHistory, useParams } from "react-router-dom";
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput"; import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { ViewHeader } from "../../components/view-header/ViewHeader"; import { ViewHeader } from "../../components/view-header/ViewHeader";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import type { EditAttributesGroupParams } from "../routes/EditAttributesGroup"; import type { EditAttributesGroupParams } from "../routes/EditAttributesGroup";
@ -128,7 +128,7 @@ export default function AttributesGroupForm() {
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={form.register({ required: true })} ref={form.register({ required: true })}
type="text" type="text"
id="kc-name" id="kc-name"
@ -149,7 +149,7 @@ export default function AttributesGroupForm() {
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
id="kc-display-header" id="kc-display-header"
@ -166,7 +166,7 @@ export default function AttributesGroupForm() {
/> />
} }
> >
<TextInput <KeycloakTextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
id="kc-display-description" id="kc-display-description"

View file

@ -9,12 +9,12 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { HelpItem } from "../../../components/help-enabler/HelpItem"; import { HelpItem } from "../../../components/help-enabler/HelpItem";
import { Controller, useFormContext, useWatch } from "react-hook-form"; import { Controller, useFormContext, useWatch } from "react-hook-form";
import { FormAccess } from "../../../components/form-access/FormAccess"; import { FormAccess } from "../../../components/form-access/FormAccess";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient, useFetch } from "../../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../../context/auth/AdminClient";
import type ClientScopeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation"; import type ClientScopeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation";
import type { AttributeParams } from "../../routes/Attribute"; import type { AttributeParams } from "../../routes/Attribute";
@ -83,7 +83,7 @@ export const AttributeGeneralSettings = () => {
validated={form.errors.name ? "error" : "default"} validated={form.errors.name ? "error" : "default"}
helperTextInvalid={form.errors.name?.message} helperTextInvalid={form.errors.name?.message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-attribute-name" id="kc-attribute-name"
@ -110,7 +110,7 @@ export const AttributeGeneralSettings = () => {
} }
fieldId="kc-attribute-display-name" fieldId="kc-attribute-display-name"
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-attribute-display-name" id="kc-attribute-display-name"
name="displayName" name="displayName"

View file

@ -5,7 +5,6 @@ import {
FormGroup, FormGroup,
PageSection, PageSection,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation";
import React from "react"; import React from "react";
@ -16,6 +15,7 @@ import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload";
import { ViewHeader } from "../../components/view-header/ViewHeader"; import { ViewHeader } from "../../components/view-header/ViewHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealms } from "../../context/RealmsContext"; import { useRealms } from "../../context/RealmsContext";
import { useWhoAmI } from "../../context/whoami/WhoAmI"; import { useWhoAmI } from "../../context/whoami/WhoAmI";
@ -79,7 +79,7 @@ export default function NewRealmForm() {
validated={errors.realm ? "error" : "default"} validated={errors.realm ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-realm-name" id="kc-realm-name"

View file

@ -8,7 +8,6 @@ import {
Modal, Modal,
ModalVariant, ModalVariant,
TextContent, TextContent,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -20,6 +19,7 @@ import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import type GlobalRequestResult from "@keycloak/keycloak-admin-client/lib/defs/globalRequestResult"; import type GlobalRequestResult from "@keycloak/keycloak-admin-client/lib/defs/globalRequestResult";
type RevocationModalProps = { type RevocationModalProps = {
@ -201,7 +201,7 @@ export const RevocationModal = ({
errors.email ? ValidatedOptions.error : ValidatedOptions.default errors.email ? ValidatedOptions.error : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
data-testid="not-before-input" data-testid="not-before-input"
ref={register({ required: true, pattern: emailRegexPattern })} ref={register({ required: true, pattern: emailRegexPattern })}
autoFocus autoFocus

View file

@ -8,13 +8,13 @@ import {
Button, Button,
FormGroup, FormGroup,
PageSection, PageSection,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation"; import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
import type { ProviderRouteParams } from "../routes/NewProvider"; import type { ProviderRouteParams } from "../routes/NewProvider";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { toUserFederation } from "../routes/UserFederation"; import { toUserFederation } from "../routes/UserFederation";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
@ -104,7 +104,7 @@ export default function CustomProviderSettings() {
fieldId="kc-console-display-name" fieldId="kc-console-display-name"
isRequired isRequired
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-console-display-name" id="kc-console-display-name"

View file

@ -5,7 +5,6 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { UseFormMethods, Controller, useWatch } from "react-hook-form"; import { UseFormMethods, Controller, useWatch } from "react-hook-form";
@ -16,6 +15,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { isEqual } from "lodash-es"; import { isEqual } from "lodash-es";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
export type KerberosSettingsRequiredProps = { export type KerberosSettingsRequiredProps = {
@ -74,7 +74,7 @@ export const KerberosSettingsRequired = ({
helperTextInvalid={form.errors.name?.message} helperTextInvalid={form.errors.name?.message}
> >
{/* These hidden fields are required so data object written back matches data retrieved */} {/* These hidden fields are required so data object written back matches data retrieved */}
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-providerId" id="kc-console-providerId"
@ -82,7 +82,7 @@ export const KerberosSettingsRequired = ({
defaultValue="kerberos" defaultValue="kerberos"
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-providerType" id="kc-console-providerType"
@ -90,7 +90,7 @@ export const KerberosSettingsRequired = ({
defaultValue="org.keycloak.storage.UserStorageProvider" defaultValue="org.keycloak.storage.UserStorageProvider"
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-parentId" id="kc-console-parentId"
@ -99,7 +99,7 @@ export const KerberosSettingsRequired = ({
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-console-name" id="kc-console-name"
@ -130,7 +130,7 @@ export const KerberosSettingsRequired = ({
} }
helperTextInvalid={form.errors.config?.kerberosRealm?.[0].message} helperTextInvalid={form.errors.config?.kerberosRealm?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-kerberos-realm" id="kc-kerberos-realm"
@ -163,7 +163,7 @@ export const KerberosSettingsRequired = ({
} }
helperTextInvalid={form.errors.config?.serverPrincipal?.[0].message} helperTextInvalid={form.errors.config?.serverPrincipal?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-server-principal" id="kc-server-principal"
@ -194,7 +194,7 @@ export const KerberosSettingsRequired = ({
validated={form.errors.config?.keyTab?.[0] ? "error" : "default"} validated={form.errors.config?.keyTab?.[0] ? "error" : "default"}
helperTextInvalid={form.errors.config?.keyTab?.[0].message} helperTextInvalid={form.errors.config?.keyTab?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-key-tab" id="kc-key-tab"

View file

@ -6,7 +6,6 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
Switch, Switch,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -22,6 +21,7 @@ import { PasswordInput } from "../../components/password-input/PasswordInput";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type LdapSettingsConnectionProps = { export type LdapSettingsConnectionProps = {
form: UseFormMethods; form: UseFormMethods;
@ -118,7 +118,7 @@ export const LdapSettingsConnection = ({
} }
helperTextInvalid={form.errors.config?.connectionUrl?.[0].message} helperTextInvalid={form.errors.config?.connectionUrl?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-console-connection-url" id="kc-console-connection-url"
@ -236,7 +236,7 @@ export const LdapSettingsConnection = ({
} }
fieldId="kc-console-connection-timeout" fieldId="kc-console-connection-timeout"
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min={0} min={0}
id="kc-console-connection-timeout" id="kc-console-connection-timeout"
@ -312,7 +312,7 @@ export const LdapSettingsConnection = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-console-bind-dn" id="kc-console-bind-dn"
data-testid="ldap-bind-dn" data-testid="ldap-bind-dn"

View file

@ -3,7 +3,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import React, { useState } from "react"; import React, { useState } from "react";
@ -13,6 +12,7 @@ import { FormAccess } from "../../components/form-access/FormAccess";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
export type LdapSettingsGeneralProps = { export type LdapSettingsGeneralProps = {
@ -117,7 +117,7 @@ export const LdapSettingsGeneral = ({
helperTextInvalid={form.errors.name?.message} helperTextInvalid={form.errors.name?.message}
> >
{/* These hidden fields are required so data object written back matches data retrieved */} {/* These hidden fields are required so data object written back matches data retrieved */}
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-provider-id" id="kc-console-provider-id"
@ -125,7 +125,7 @@ export const LdapSettingsGeneral = ({
defaultValue="ldap" defaultValue="ldap"
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-provider-type" id="kc-console-provider-type"
@ -133,7 +133,7 @@ export const LdapSettingsGeneral = ({
defaultValue="org.keycloak.storage.UserStorageProvider" defaultValue="org.keycloak.storage.UserStorageProvider"
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
hidden hidden
type="text" type="text"
id="kc-console-parentId" id="kc-console-parentId"
@ -141,7 +141,7 @@ export const LdapSettingsGeneral = ({
defaultValue={realm} defaultValue={realm}
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-console-display-name" id="kc-console-display-name"

View file

@ -1,10 +1,11 @@
import { FormGroup, Switch, TextInput } from "@patternfly/react-core"; import { FormGroup, Switch } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import React from "react"; import React from "react";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { UseFormMethods, Controller, useWatch } from "react-hook-form"; import { UseFormMethods, Controller, useWatch } from "react-hook-form";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type LdapSettingsKerberosIntegrationProps = { export type LdapSettingsKerberosIntegrationProps = {
form: UseFormMethods; form: UseFormMethods;
@ -83,7 +84,7 @@ export const LdapSettingsKerberosIntegration = ({
} }
helperTextInvalid={form.errors.config?.kerberosRealm?.[0].message} helperTextInvalid={form.errors.config?.kerberosRealm?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-kerberos-realm" id="kc-kerberos-realm"
@ -118,7 +119,7 @@ export const LdapSettingsKerberosIntegration = ({
form.errors.config?.serverPrincipal?.[0].message form.errors.config?.serverPrincipal?.[0].message
} }
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-server-principal" id="kc-server-principal"
@ -149,7 +150,7 @@ export const LdapSettingsKerberosIntegration = ({
validated={form.errors.config?.keyTab?.[0] ? "error" : "default"} validated={form.errors.config?.keyTab?.[0] ? "error" : "default"}
helperTextInvalid={form.errors.config?.keyTab?.[0].message} helperTextInvalid={form.errors.config?.keyTab?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
id="kc-key-tab" id="kc-key-tab"

View file

@ -4,7 +4,6 @@ import {
SelectOption, SelectOption,
SelectVariant, SelectVariant,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import React, { useState } from "react"; import React, { useState } from "react";
@ -12,6 +11,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { UseFormMethods, Controller } from "react-hook-form"; import { UseFormMethods, Controller } from "react-hook-form";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type LdapSettingsSearchingProps = { export type LdapSettingsSearchingProps = {
form: UseFormMethods; form: UseFormMethods;
@ -101,7 +101,7 @@ export const LdapSettingsSearching = ({
validated={form.errors.config?.usersDn?.[0] ? "error" : "default"} validated={form.errors.config?.usersDn?.[0] ? "error" : "default"}
helperTextInvalid={form.errors.config?.usersDn?.[0].message} helperTextInvalid={form.errors.config?.usersDn?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
defaultValue="" defaultValue=""
@ -134,7 +134,7 @@ export const LdapSettingsSearching = ({
form.errors.config?.usernameLDAPAttribute?.[0].message form.errors.config?.usernameLDAPAttribute?.[0].message
} }
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
defaultValue="cn" defaultValue="cn"
@ -169,7 +169,7 @@ export const LdapSettingsSearching = ({
} }
helperTextInvalid={form.errors.config?.rdnLDAPAttribute?.[0].message} helperTextInvalid={form.errors.config?.rdnLDAPAttribute?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
defaultValue="cn" defaultValue="cn"
@ -202,7 +202,7 @@ export const LdapSettingsSearching = ({
} }
helperTextInvalid={form.errors.config?.uuidLDAPAttribute?.[0].message} helperTextInvalid={form.errors.config?.uuidLDAPAttribute?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
defaultValue="objectGUID" defaultValue="objectGUID"
@ -235,7 +235,7 @@ export const LdapSettingsSearching = ({
} }
helperTextInvalid={form.errors.config?.userObjectClasses?.[0].message} helperTextInvalid={form.errors.config?.userObjectClasses?.[0].message}
> >
<TextInput <KeycloakTextInput
isRequired isRequired
type="text" type="text"
defaultValue="person, organizationalPerson, user" defaultValue="person, organizationalPerson, user"
@ -271,7 +271,7 @@ export const LdapSettingsSearching = ({
form.errors.config?.customUserSearchFilter?.[0].message form.errors.config?.customUserSearchFilter?.[0].message
} }
> >
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-user-ldap-filter" id="kc-user-ldap-filter"
data-testid="user-ldap-filter" data-testid="user-ldap-filter"
@ -339,7 +339,7 @@ export const LdapSettingsSearching = ({
} }
fieldId="kc-read-timeout" fieldId="kc-read-timeout"
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min={0} min={0}
id="kc-read-timeout" id="kc-read-timeout"

View file

@ -1,10 +1,11 @@
import { FormGroup, Switch, TextInput } from "@patternfly/react-core"; import { FormGroup, Switch } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import React from "react"; import React from "react";
import { HelpItem } from "../../components/help-enabler/HelpItem"; import { HelpItem } from "../../components/help-enabler/HelpItem";
import { UseFormMethods, Controller } from "react-hook-form"; import { UseFormMethods, Controller } from "react-hook-form";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type LdapSettingsSynchronizationProps = { export type LdapSettingsSynchronizationProps = {
form: UseFormMethods; form: UseFormMethods;
@ -72,7 +73,7 @@ export const LdapSettingsSynchronization = ({
} }
fieldId="kc-batch-size" fieldId="kc-batch-size"
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min={0} min={0}
id="kc-batch-size" id="kc-batch-size"
@ -122,7 +123,7 @@ export const LdapSettingsSynchronization = ({
} }
fieldId="kc-full-sync-period" fieldId="kc-full-sync-period"
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min={-1} min={-1}
defaultValue={604800} defaultValue={604800}
@ -174,7 +175,7 @@ export const LdapSettingsSynchronization = ({
fieldId="kc-changed-users-sync-period" fieldId="kc-changed-users-sync-period"
hasNoPaddingTop hasNoPaddingTop
> >
<TextInput <KeycloakTextInput
type="number" type="number"
min={-1} min={-1}
defaultValue={86400} defaultValue={86400}

View file

@ -9,7 +9,6 @@ import {
Select, Select,
SelectOption, SelectOption,
SelectVariant, SelectVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { convertFormValuesToObject, convertToFormValues } from "../../../util"; import { convertFormValuesToObject, convertToFormValues } from "../../../util";
@ -27,6 +26,7 @@ import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/li
import { DynamicComponents } from "../../../components/dynamic/DynamicComponents"; import { DynamicComponents } from "../../../components/dynamic/DynamicComponents";
import { useRealm } from "../../../context/realm-context/RealmContext"; import { useRealm } from "../../../context/realm-context/RealmContext";
import { KeycloakSpinner } from "../../../components/keycloak-spinner/KeycloakSpinner"; import { KeycloakSpinner } from "../../../components/keycloak-spinner/KeycloakSpinner";
import { KeycloakTextInput } from "../../../components/keycloak-text-input/KeycloakTextInput";
import { toUserFederationLdap } from "../../routes/UserFederationLdap"; import { toUserFederationLdap } from "../../routes/UserFederationLdap";
export default function LdapMapperDetails() { export default function LdapMapperDetails() {
@ -134,7 +134,7 @@ export default function LdapMapperDetails() {
<FormAccess role="manage-realm" isHorizontal> <FormAccess role="manage-realm" isHorizontal>
{!isNew && ( {!isNew && (
<FormGroup label={t("common:id")} fieldId="kc-ldap-mapper-id"> <FormGroup label={t("common:id")} fieldId="kc-ldap-mapper-id">
<TextInput <KeycloakTextInput
isDisabled isDisabled
type="text" type="text"
id="kc-ldap-mapper-id" id="kc-ldap-mapper-id"
@ -155,7 +155,7 @@ export default function LdapMapperDetails() {
fieldId="kc-ldap-mapper-name" fieldId="kc-ldap-mapper-name"
isRequired isRequired
> >
<TextInput <KeycloakTextInput
isDisabled={!isNew} isDisabled={!isNew}
isRequired isRequired
type="text" type="text"
@ -169,7 +169,7 @@ export default function LdapMapperDetails() {
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
<TextInput <KeycloakTextInput
hidden hidden
defaultValue={isNew ? id : mapping ? mapping.parentId : ""} defaultValue={isNew ? id : mapping ? mapping.parentId : ""}
type="text" type="text"
@ -178,7 +178,7 @@ export default function LdapMapperDetails() {
name="parentId" name="parentId"
ref={form.register} ref={form.register}
/> />
<TextInput <KeycloakTextInput
hidden hidden
defaultValue="org.keycloak.storage.ldap.mappers.LDAPStorageMapper" defaultValue="org.keycloak.storage.ldap.mappers.LDAPStorageMapper"
type="text" type="text"
@ -200,7 +200,7 @@ export default function LdapMapperDetails() {
fieldId="kc-ldap-mapper-type" fieldId="kc-ldap-mapper-type"
isRequired isRequired
> >
<TextInput <KeycloakTextInput
isDisabled={!isNew} isDisabled={!isNew}
isRequired isRequired
type="text" type="text"

View file

@ -7,13 +7,14 @@ import {
EmptyStateBody, EmptyStateBody,
Form, Form,
InputGroup, InputGroup,
TextInput,
Title, Title,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { SearchIcon } from "@patternfly/react-icons"; import { SearchIcon } from "@patternfly/react-icons";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { useHistory, useRouteMatch } from "react-router-dom"; import { useHistory, useRouteMatch } from "react-router-dom";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type SearchUserProps = { type SearchUserProps = {
onSearch: (search: string) => void; onSearch: (search: string) => void;
}; };
@ -34,7 +35,7 @@ export const SearchUser = ({ onSearch }: SearchUserProps) => {
<EmptyStateBody> <EmptyStateBody>
<Form onSubmit={handleSubmit((form) => onSearch(form.search))}> <Form onSubmit={handleSubmit((form) => onSearch(form.search))}>
<InputGroup> <InputGroup>
<TextInput <KeycloakTextInput
type="text" type="text"
id="kc-user-search" id="kc-user-search"
name="search" name="search"

View file

@ -10,7 +10,6 @@ import {
Select, Select,
SelectOption, SelectOption,
Switch, Switch,
TextInput,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Controller, useFormContext } from "react-hook-form"; import { Controller, useFormContext } from "react-hook-form";
@ -23,6 +22,7 @@ import { useRealm } from "../context/realm-context/RealmContext";
import { useAdminClient, useFetch } from "../context/auth/AdminClient"; import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation"; import type GroupRepresentation from "@keycloak/keycloak-admin-client/lib/defs/groupRepresentation";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { emailRegexPattern } from "../util"; import { emailRegexPattern } from "../util";
import { GroupPickerDialog } from "../components/group/GroupPickerDialog"; import { GroupPickerDialog } from "../components/group/GroupPickerDialog";
import moment from "moment"; import moment from "moment";
@ -173,10 +173,15 @@ export const UserForm = ({
{user?.id && ( {user?.id && (
<> <>
<FormGroup label={t("common:id")} fieldId="kc-id" isRequired> <FormGroup label={t("common:id")} fieldId="kc-id" isRequired>
<TextInput id={user.id} value={user.id} type="text" isReadOnly /> <KeycloakTextInput
id={user.id}
value={user.id}
type="text"
isReadOnly
/>
</FormGroup> </FormGroup>
<FormGroup label={t("createdAt")} fieldId="kc-created-at" isRequired> <FormGroup label={t("createdAt")} fieldId="kc-created-at" isRequired>
<TextInput <KeycloakTextInput
value={moment(user.createdTimestamp).format( value={moment(user.createdTimestamp).format(
"MM/DD/YY hh:MM:ss A" "MM/DD/YY hh:MM:ss A"
)} )}
@ -196,7 +201,7 @@ export const UserForm = ({
validated={errors.username ? "error" : "default"} validated={errors.username ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
type="text" type="text"
id="kc-username" id="kc-username"
@ -211,7 +216,7 @@ export const UserForm = ({
validated={errors.email ? "error" : "default"} validated={errors.email ? "error" : "default"}
helperTextInvalid={t("users:emailInvalid")} helperTextInvalid={t("users:emailInvalid")}
> >
<TextInput <KeycloakTextInput
ref={register({ ref={register({
pattern: emailRegexPattern, pattern: emailRegexPattern,
})} })}
@ -256,7 +261,7 @@ export const UserForm = ({
validated={errors.firstName ? "error" : "default"} validated={errors.firstName ? "error" : "default"}
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
data-testid="firstName-input" data-testid="firstName-input"
type="text" type="text"
@ -269,7 +274,7 @@ export const UserForm = ({
fieldId="kc-name" fieldId="kc-name"
validated={errors.lastName ? "error" : "default"} validated={errors.lastName ? "error" : "default"}
> >
<TextInput <KeycloakTextInput
ref={register()} ref={register()}
data-testid="lastName-input" data-testid="lastName-input"
type="text" type="text"

View file

@ -7,7 +7,6 @@ import {
FormGroup, FormGroup,
Modal, Modal,
ModalVariant, ModalVariant,
TextInput,
ValidatedOptions, ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -20,6 +19,7 @@ import { capitalize } from "lodash-es";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import type FederatedIdentityRepresentation from "@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation"; import type FederatedIdentityRepresentation from "@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation";
import type { UserParams } from "./routes/User"; import type { UserParams } from "./routes/User";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type UserIdpModalProps = { type UserIdpModalProps = {
federatedId?: string; federatedId?: string;
@ -104,7 +104,7 @@ export const UserIdpModal = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
> >
<TextInput <KeycloakTextInput
data-testid="idpNameInput" data-testid="idpNameInput"
aria-label="Identity provider name input" aria-label="Identity provider name input"
ref={register({ required: true })} ref={register({ required: true })}
@ -132,7 +132,7 @@ export const UserIdpModal = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="userIdInput" data-testid="userIdInput"
aria-label="user ID input" aria-label="user ID input"
ref={register({ required: true })} ref={register({ required: true })}
@ -156,7 +156,7 @@ export const UserIdpModal = ({
} }
isRequired isRequired
> >
<TextInput <KeycloakTextInput
data-testid="usernameInput" data-testid="usernameInput"
aria-label="username input" aria-label="username input"
ref={register({ required: true })} ref={register({ required: true })}

View file

@ -1,18 +1,13 @@
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { import { AlertVariant, Button, Form, FormGroup } from "@patternfly/react-core";
AlertVariant,
Button,
Form,
FormGroup,
TextInput,
} from "@patternfly/react-core";
import { CheckIcon, PencilAltIcon, TimesIcon } from "@patternfly/react-icons"; import { CheckIcon, PencilAltIcon, TimesIcon } from "@patternfly/react-icons";
import type CredentialRepresentation from "@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation"; import type CredentialRepresentation from "@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts"; import { useAlerts } from "../../components/alert/Alerts";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
type UserLabelForm = { type UserLabelForm = {
userLabel: string; userLabel: string;
@ -63,7 +58,7 @@ export const InlineLabelEdit = ({
<div className="kc-form-group-userLabel"> <div className="kc-form-group-userLabel">
{isEditable ? ( {isEditable ? (
<> <>
<TextInput <KeycloakTextInput
name="userLabel" name="userLabel"
data-testid="userLabelFld" data-testid="userLabelFld"
defaultValue={credential.userLabel} defaultValue={credential.userLabel}