"use strict";

import { useCallback, useState } from "react";
import { IconButton } from "../buttons";
import { TextInputBase } from "./TextInputBase";
import { jsx as _jsx } from "react/jsx-runtime";
export const TextInputPassword = props => {
  const {
    onBlur,
    disabled
  } = props;
  const [showPassword, setShowPassword] = useState(false);
  const rightElement = /*#__PURE__*/_jsx(IconButton, {
    icon: showPassword ? "eyeShow" : "eyeHide",
    disabled: disabled,
    onPress: () => setShowPassword(v => !v),
    accessibilityLabel: "Toggle secret input"
  });
  const onBlurHandler = useCallback(() => {
    setShowPassword(false);
    onBlur?.();
  }, [onBlur]);
  return /*#__PURE__*/_jsx(TextInputBase, {
    ...props,
    onBlur: onBlurHandler,
    rightElement: rightElement,
    isPassword: !showPassword
  });
};
//# sourceMappingURL=TextInputPassword.js.map