89abc094d1
* move account ui user profile to shared * use ui-shared on admin same error handling also introduce optional renderer for added component * move scroll form to ui-shared * merged with main * fix lock file * fixed merge error * fixed merge errors * fixed tests * moved user profile types to admin client * fixed more types * pr comments * fixed some types
27 lines
1,000 B
TypeScript
27 lines
1,000 B
TypeScript
import { TextInputTypes } from "@patternfly/react-core";
|
|
import { KeycloakTextInput } from "../keycloak-text-input/KeycloakTextInput";
|
|
import { UserProfileFieldProps } from "./UserProfileFields";
|
|
import { UserProfileGroup } from "./UserProfileGroup";
|
|
import { fieldName, isRequiredAttribute } from "./utils";
|
|
|
|
export const TextComponent = (props: UserProfileFieldProps) => {
|
|
const { form, inputType, attribute } = props;
|
|
const isRequired = isRequiredAttribute(attribute);
|
|
const type = inputType.startsWith("html")
|
|
? (inputType.substring("html".length + 2) as TextInputTypes)
|
|
: "text";
|
|
|
|
return (
|
|
<UserProfileGroup {...props}>
|
|
<KeycloakTextInput
|
|
id={attribute.name}
|
|
data-testid={attribute.name}
|
|
type={type}
|
|
placeholder={attribute.annotations?.["inputTypePlaceholder"] as string}
|
|
readOnly={attribute.readOnly}
|
|
isRequired={isRequired}
|
|
{...form.register(fieldName(attribute.name))}
|
|
/>
|
|
</UserProfileGroup>
|
|
);
|
|
};
|