import { Box, Flex, FormControl, FormLabel, IconButton, Input, InputGroup, InputProps, InputRightElement, useColorModeValue as mode, useDisclosure, useMergeRefs } from '@chakra-ui/react' import {HiEye} from '@react-icons/all-files/hi/HiEye' import {HiEyeOff} from '@react-icons/all-files/hi/HiEyeOff' import * as React from 'react' export const PasswordField = React.forwardRef( (props, ref) => { const {isOpen, onToggle} = useDisclosure() const inputRef = React.useRef(null) const mergeRef = useMergeRefs(inputRef, ref) const onClickReveal = () => { onToggle() const input = inputRef.current if (input) { input.focus({preventScroll: true}) const length = input.value.length * 2 requestAnimationFrame(() => { input.setSelectionRange(length, length) }) } } return ( Password Forgot Password? : } onClick={onClickReveal} /> ) } ) PasswordField.displayName = 'PasswordField'