"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextInputPassword = void 0;
var _react = require("react");
var _buttons = require("../buttons");
var _TextInputBase = require("./TextInputBase");
var _jsxRuntime = require("react/jsx-runtime");
const TextInputPassword = props => {
  const {
    onBlur,
    disabled
  } = props;
  const [showPassword, setShowPassword] = (0, _react.useState)(false);
  const rightElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_buttons.IconButton, {
    icon: showPassword ? "eyeShow" : "eyeHide",
    disabled: disabled,
    onPress: () => setShowPassword(v => !v),
    accessibilityLabel: "Toggle secret input"
  });
  const onBlurHandler = (0, _react.useCallback)(() => {
    setShowPassword(false);
    onBlur?.();
  }, [onBlur]);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.TextInputBase, {
    ...props,
    onBlur: onBlurHandler,
    rightElement: rightElement,
    isPassword: !showPassword
  });
};
exports.TextInputPassword = TextInputPassword;
//# sourceMappingURL=TextInputPassword.js.map