import React, { ComponentProps, PropsWithChildren, PropsWithRef } from 'react'; import { CSS } from '@stitches/react'; import { CopyIcon, EyeCloseIcon, EyeOpenIcon } from '@100mslive/react-icons'; import { Flex } from '../Layout'; import { styled } from '../Theme'; export const Input = styled('input', { fontFamily: '$sans', lineHeight: 'inherit', backgroundColor: '$surface_default', borderRadius: '8px', outline: 'none', border: '1px solid $border_default', padding: '0.5rem 0.75rem', minHeight: '30px', color: '$on_surface_high', fontSize: '$md', '&:disabled': { cursor: 'not-allowed', }, '&:focus': { boxShadow: '0 0 0 1px $colors$primary_default', border: '1px solid transparent', }, '&::placeholder': { color: '$on_surface_medium', }, variants: { error: { true: { '&:focus': { boxShadow: '0 0 0 3px $colors$alert_error_default', }, }, }, }, }); const PasswordRoot = styled('div', { w: '100%', position: 'relative', display: 'flex', }); const PasswordShowIcon: React.FC & { showPassword?: boolean; css?: CSS }> = ({ showPassword, css, ...props }) => { return ( {showPassword ? : } ); }; const PasswordCopyIcon: React.FC> = ({ css, ...props }) => { return ( ); }; const PasswordIcons = React.forwardRef>>( ({ css, ...props }, ref) => { return ( {props.children} ); }, ); const ReactInput: React.FC & { showPassword?: boolean; css?: CSS }>> = React.forwardRef< HTMLInputElement, PropsWithRef & { showPassword?: boolean; css?: CSS }> >(({ showPassword = false, css, ...props }, ref) => { return ( ); }); export const PasswordInput = { Root: PasswordRoot, Icons: PasswordIcons, Input: ReactInput, ShowIcon: PasswordShowIcon, CopyIcon: PasswordCopyIcon, };