trigger state autofill
This commit is contained in:
1 parent
736a6053ef
commit
326775848b
8 files changed
+440
-268
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import React, { PropsWithChildren, ReactNode, useState } from "react";
|
||||
import React, { ReactNode, useState } from "react";
|
||||
import { useToolTip } from "tooltip/context";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import InputWrapper from "./InputWrapper";
|
||||
|
||||
export interface Props {
|
||||
textBoxFor?: string;
|
||||
@@ -31,59 +30,56 @@ export default function InputText({
|
||||
additionalTooltipFilters = {},
|
||||
multiline = false,
|
||||
maxRows = 4,
|
||||
children,
|
||||
className,
|
||||
placeholder,
|
||||
required,
|
||||
}: PropsWithChildren<Props>) {
|
||||
}: Props) {
|
||||
const tooltip = useToolTip();
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
return (
|
||||
<InputWrapper className={className} label="">
|
||||
<TextField
|
||||
multiline={multiline}
|
||||
maxRows={maxRows}
|
||||
fullWidth
|
||||
inputMode="text"
|
||||
variant="filled"
|
||||
focused={isFocused}
|
||||
label={label}
|
||||
value={value}
|
||||
title={title}
|
||||
helperText={helperText}
|
||||
placeholder={placeholder}
|
||||
InputProps={{
|
||||
endAdornment,
|
||||
}}
|
||||
required={required}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value);
|
||||
}}
|
||||
onBlur={() => {
|
||||
setIsFocused(false);
|
||||
}}
|
||||
onFocus={(e) => {
|
||||
setIsFocused(true);
|
||||
if (textBoxFor) {
|
||||
tooltip.setFocus(
|
||||
e.target.getBoundingClientRect(),
|
||||
{
|
||||
searchObject: textBoxFor,
|
||||
searchText: value,
|
||||
filterObjects: additionalTooltipFilters,
|
||||
},
|
||||
onChange
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{children}
|
||||
</InputWrapper>
|
||||
<TextField
|
||||
className={className}
|
||||
multiline={multiline}
|
||||
maxRows={maxRows}
|
||||
fullWidth
|
||||
inputMode="text"
|
||||
variant="filled"
|
||||
focused={isFocused}
|
||||
label={label}
|
||||
value={value}
|
||||
title={title}
|
||||
helperText={helperText}
|
||||
placeholder={placeholder}
|
||||
InputProps={{
|
||||
endAdornment,
|
||||
}}
|
||||
required={required}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value);
|
||||
}}
|
||||
onBlur={() => {
|
||||
setIsFocused(false);
|
||||
}}
|
||||
onFocus={(e) => {
|
||||
setIsFocused(true);
|
||||
if (textBoxFor) {
|
||||
tooltip.setFocus(
|
||||
e.target.getBoundingClientRect(),
|
||||
{
|
||||
searchObject: textBoxFor,
|
||||
searchText: value,
|
||||
filterObjects: additionalTooltipFilters,
|
||||
},
|
||||
onChange
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user