UNPKG

@keycloakify/keycloak-account-ui

Version:
14 lines 1.11 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { TextInput } from "@patternfly/react-core"; import { UserProfileGroup } from "../../ui-shared/user-profile/UserProfileGroup"; import { fieldName, isRequiredAttribute, label } from "../../ui-shared/user-profile/utils"; export const TextComponent = (props) => { var _a, _b; const { form, inputType, attribute } = props; const isRequired = isRequiredAttribute(attribute); const type = inputType.startsWith("html") ? inputType.substring("html".length + 2) : "text"; return (_jsx(UserProfileGroup, Object.assign({}, props, { children: _jsx(TextInput, Object.assign({ id: attribute.name, "data-testid": attribute.name, type: type, placeholder: label(props.t, (_a = attribute.annotations) === null || _a === void 0 ? void 0 : _a["inputTypePlaceholder"], attribute.name, (_b = attribute.annotations) === null || _b === void 0 ? void 0 : _b["inputOptionLabelsI18nPrefix"]), readOnly: attribute.readOnly, isRequired: isRequired }, form.register(fieldName(attribute.name)))) }))); }; //# sourceMappingURL=TextComponent.js.map