initial work with mui
This commit is contained in:
1 parent
f8233dd6ab
commit
44c4ac12dd
35 files changed
+216
-145
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { PropsWithChildren, useState } from "react";
|
||||
import { useToolTip } from "tooltip/context";
|
||||
import InputWrapper from "./InputWrapper";
|
||||
import { useInputTextStyles } from "./styles";
|
||||
import TextField from '@mui/material/TextField';
|
||||
|
||||
export interface Props {
|
||||
textBoxFor?: string;
|
||||
@@ -20,40 +19,69 @@ export default function InputText({
|
||||
additionalTooltipFilters = {},
|
||||
children,
|
||||
}: PropsWithChildren<Props>) {
|
||||
const { classes } = useInputTextStyles({});
|
||||
const tooltip = useToolTip();
|
||||
const [isFocused, setIsFocused] = useState(false)
|
||||
return <InputWrapper label={label} labelSize={(value === '') && !isFocused ? 'normal' : 'small'}>
|
||||
<input
|
||||
className={classes.input}
|
||||
value={value}
|
||||
onKeyDown={e => {
|
||||
if (e.key === 'Enter') {
|
||||
onEnter();
|
||||
}
|
||||
}}
|
||||
onChange={e => {
|
||||
e.preventDefault();
|
||||
onChange(e.target.value)
|
||||
}}
|
||||
onBlur={e => {
|
||||
setIsFocused(false)
|
||||
}}
|
||||
onFocus={e => {
|
||||
setIsFocused(true)
|
||||
if (textBoxFor) {
|
||||
tooltip.setFocus(
|
||||
e.target.getBoundingClientRect(),
|
||||
{
|
||||
searchObject: textBoxFor,
|
||||
searchText: value,
|
||||
filterObjects: additionalTooltipFilters,
|
||||
},
|
||||
onChange
|
||||
)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
return <TextField inputMode="text" variant="filled" focused={isFocused} label={label} value={value}
|
||||
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>
|
||||
// return <InputWrapper label={label} labelSize={(value === '') && !isFocused ? 'normal' : 'small'}>
|
||||
// <input
|
||||
// className={classes.input}
|
||||
// value={value}
|
||||
// onKeyDown={e => {
|
||||
// if (e.key === 'Enter') {
|
||||
// onEnter();
|
||||
// }
|
||||
// }}
|
||||
// onChange={e => {
|
||||
// e.preventDefault();
|
||||
// onChange(e.target.value)
|
||||
// }}
|
||||
// onBlur={e => {
|
||||
// setIsFocused(false)
|
||||
// }}
|
||||
// onFocus={e => {
|
||||
// setIsFocused(true)
|
||||
// if (textBoxFor) {
|
||||
// tooltip.setFocus(
|
||||
// e.target.getBoundingClientRect(),
|
||||
// {
|
||||
// searchObject: textBoxFor,
|
||||
// searchText: value,
|
||||
// filterObjects: additionalTooltipFilters,
|
||||
// },
|
||||
// onChange
|
||||
// )
|
||||
// }
|
||||
// }}
|
||||
// />
|
||||
// {children}
|
||||
// </InputWrapper>
|
||||
}
|
||||
Reference in new issue
Block a user