import React, { forwardRef } from 'react'; import styled from '@emotion/styled'; import { TextInput as MantineTextInput, TextInputProps as MantineTextInputProps, PasswordInput as MantinePasswordInput, PasswordInputProps as MantinePasswordInputProps, FileInput as MantineFileInput, FileInputProps as MantineFileInputProps, } from '@mantine/core'; interface TextInputProps extends MantineTextInputProps { children?: React.ReactNode; } interface PasswordInputProps extends MantinePasswordInputProps { children?: React.ReactNode; } interface FileInputProps extends MantineFileInputProps { children?: React.ReactNode; } const StyledTextInput = styled(MantineTextInput)` &:focus, &:focus-within { border-color: var(--primary-color); } & .mantine-TextInput-wrapper { border-color: var(--primary-color); } & .mantine-TextInput-input { &:focus, &:focus-within { border-color: var(--primary-color); } color: var(--input-fg); background: var(--input-bg); &::placeholder { color: var(--input-placeholder-fg); } } & .mantine-Input-icon { color: var(--input-placeholder-fg); } & .mantine-TextInput-required { color: var(--secondary-color); } & .mantine-TextInput-label { font-family: var(--label-font-faimly); } `; const StyledPasswordInput = styled(MantinePasswordInput)` & .mantine-PasswordInput-input { &:focus, &:focus-within { border-color: var(--primary-color); } } & .mantine-PasswordInput-required { color: var(--secondary-color); } & .mantine-PasswordInput-label { font-family: var(--label-font-faimly); } `; const StyledFileInput = styled(MantineFileInput)` & .mantine-FileInput-input { &:focus, &:focus-within { border-color: var(--primary-color); } } & .mantine-FileInput-required { color: var(--secondary-color); } & .mantine-FileInput-label { font-family: var(--label-font-faimly); } `; export const TextInput = forwardRef( ({ children, ...props }: TextInputProps, ref) => { return ( {children} ); } ); export const PasswordInput = forwardRef( ({ children, ...props }: PasswordInputProps, ref) => { return ( {children} ); } ); export const FileInput = forwardRef( ({ children, ...props }: FileInputProps, ref) => { return ( {children} ); } ); TextInput.defaultProps = { children: null, }; PasswordInput.defaultProps = { children: null, }; FileInput.defaultProps = { children: null, };