@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
13 lines • 1.07 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, InputGroup, InputGroupItem, TextInput, } from "@patternfly/react-core";
import { EyeIcon, EyeSlashIcon } from "@patternfly/react-icons";
import { forwardRef, useState } from "react";
import { useTranslation } from "react-i18next";
const PasswordInputBase = ({ hasReveal = true, innerRef, ...rest }) => {
const { t } = useTranslation();
const [hidePassword, setHidePassword] = useState(true);
return (_jsxs(InputGroup, { children: [_jsx(InputGroupItem, { isFill: true, children: _jsx(TextInput, { ...rest, type: hidePassword ? "password" : "text", ref: innerRef }) }), hasReveal && (_jsx(Button, { variant: "control", "aria-label": t("showPassword"), onClick: () => setHidePassword(!hidePassword), children: hidePassword ? _jsx(EyeIcon, {}) : _jsx(EyeSlashIcon, {}) }))] }));
};
export const PasswordInput = forwardRef((props, ref) => (_jsx(PasswordInputBase, { ...props, innerRef: ref })));
PasswordInput.displayName = "PasswordInput";
//# sourceMappingURL=PasswordInput.js.map