refactor(web): remove typescript

This commit is contained in:
Ali BARIN
2024-02-27 15:23:23 +00:00
parent 636870a075
commit b3ae2d2748
337 changed files with 2067 additions and 4997 deletions

View File

@@ -1,40 +1,22 @@
import * as React from 'react';
import { Controller, useFormContext } from 'react-hook-form';
import MuiTextField, {
TextFieldProps as MuiTextFieldProps,
} from '@mui/material/TextField';
import MuiTextField from '@mui/material/TextField';
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import copyInputValue from 'helpers/copyInputValue';
type TextFieldProps = {
shouldUnregister?: boolean;
name: string;
clickToCopy?: boolean;
readOnly?: boolean;
'data-test'?: string;
} & MuiTextFieldProps;
const createCopyAdornment = (
ref: React.RefObject<HTMLInputElement | null>
): React.ReactElement => {
const createCopyAdornment = (ref) => {
return (
<InputAdornment position="end">
<IconButton
onClick={() => copyInputValue(ref.current as HTMLInputElement)}
edge="end"
>
<IconButton onClick={() => copyInputValue(ref.current)} edge="end">
<ContentCopyIcon color="primary" />
</IconButton>
</InputAdornment>
);
};
export default function TextField(props: TextFieldProps): React.ReactElement {
export default function TextField(props) {
const { control } = useFormContext();
const inputRef = React.useRef<HTMLInputElement | null>(null);
const inputRef = React.useRef(null);
const {
required,
name,
@@ -48,7 +30,6 @@ export default function TextField(props: TextFieldProps): React.ReactElement {
'data-test': dataTest,
...textFieldProps
} = props;
return (
<Controller
rules={{ required }}