UNPKG

@parkassist/pa-ui-library

Version:
29 lines 903 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import React, { useState } from "react"; import { Column, Row } from "../Layout/Flex"; import { Input } from "../../index"; import { ButtonWrapper } from "./style"; import * as Icons from "../Icons"; const PasswordInput = props => { const [showText, setShowText] = useState(false); const toggleEye = () => { setShowText(!showText); }; return _jsxs(Row, { style: { width: props.width - 32 }, children: [_jsx(Column, { children: _jsx(Input, Object.assign({}, props, { type: showText || props.value.lenght === 0 ? "text" : "password" })) }), _jsx(ButtonWrapper, { style: { marginTop: props.label && 16 }, onClick: toggleEye, children: showText ? _jsx(Icons.EyeHidden2Icon, {}) : _jsx(Icons.EyeVisibleIcon, {}) })] }); }; export default PasswordInput;