diff --git a/frontend/src/ui/Input/Input.tsx b/frontend/src/ui/Input/Input.tsx index 11abb4932..8fc1b6b13 100644 --- a/frontend/src/ui/Input/Input.tsx +++ b/frontend/src/ui/Input/Input.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import { StyledLabel, StyledInput } from './styles' import JoyInput from '@mui/joy/Input' +import { Box } from '@mui/joy' import { SxProps } from '@mui/joy/styles/types' type InputProps = React.InputHTMLAttributes & { @@ -14,10 +15,11 @@ const InnerInput = React.forwardRef(function Inner { label, ...props }, ref ) { - const id = React.useId() + const reactId = React.useId() + const id = props.id || reactId return ( - + {label} ) diff --git a/frontend/src/ui/Input/MaskedInput.tsx b/frontend/src/ui/Input/MaskedInput.tsx index a06cdaa89..cbe85c9e8 100644 --- a/frontend/src/ui/Input/MaskedInput.tsx +++ b/frontend/src/ui/Input/MaskedInput.tsx @@ -1,8 +1,8 @@ import * as React from 'react' -import JoyInput from '@mui/joy/Input' +import { Box, Input as JoyInput } from '@mui/joy' import { SxProps } from '@mui/joy/styles/types' import { IMaskMixin, IMaskInput } from 'react-imask' -import { StyledLabel, StyledInput } from './styles' +import { StyledLabel, inputStyle } from './styles' export type Mask = React.ComponentProps['mask'] @@ -17,7 +17,7 @@ type InputProps = React.InputHTMLAttributes & { type InnerInputProps = React.InputHTMLAttributes & InputProps const MixinInput = IMaskMixin(({ inputRef, ...props }) => { - return + return }) const MaskedInputAdapter = React.forwardRef(function MaskedInput( @@ -28,6 +28,8 @@ const MaskedInputAdapter = React.forwardRef(functi return ( <> + {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} + {/* @ts-ignore */} {label} diff --git a/frontend/src/ui/Input/styles.tsx b/frontend/src/ui/Input/styles.tsx index 7f4c1c924..cff7822d1 100644 --- a/frontend/src/ui/Input/styles.tsx +++ b/frontend/src/ui/Input/styles.tsx @@ -1,4 +1,5 @@ import { styled } from '@mui/joy/styles' +import { SxProps } from '@mui/joy/styles/types' export const StyledLabel = styled('label')(({ theme }) => ({ position: 'absolute', @@ -9,7 +10,7 @@ export const StyledLabel = styled('label')(({ theme }) => ({ transition: 'all 150ms cubic-bezier(0.4, 0, 0.2, 1)' })) -export const StyledInput = styled('input')({ +export const inputStyle: SxProps = { border: 'none', // remove the native input border minWidth: 0, // remove the native input width outline: 0, // remove the native input outline @@ -47,4 +48,6 @@ export const StyledInput = styled('input')({ borderTopLeftRadius: 'calc(var(--Input-radius) - var(--variant-borderWidth, 0px))', borderBottomLeftRadius: 'calc(var(--Input-radius) - var(--variant-borderWidth, 0px))' } -}) +} + +export const StyledInput = styled('input')(inputStyle)