added foundation for tooltip

This commit is contained in:
Ari Sosnovsky committed 2021-10-31 22:56:42 -04:00
1 parent 53ec0d417b
commit 70eba32b34
9 files changed
+267 -131

No files matched your search

@@ -2,7 +2,6 @@ import { useState, useEffect } from "react";
import StateManager from "../../automation/StateManager";
import { AutomationNodeType, AutomationNodeTypes, NodeSubType, typeList } from "../../automation/types";
import InputList from "../InputList";
import InputWrapper from "../InputWrapper";
export interface Props<T extends AutomationNodeType> {
node_type: T,
+25 -6
View File
@@ -1,18 +1,37 @@
import { useToolTip } from "../tooltip/context";
import InputWrapper from "./InputWrapper";
export interface Props {
textBoxFor?: string;
label: string;
value: string;
onChange: (v: string) => void;
additionalTooltipFilters?: Record<string, string>;
}
export default function InputText({
label, value, onChange
label,
textBoxFor,
value="",
onChange,
additionalTooltipFilters={},
}: Props) {
const tooltip = useToolTip();
return <InputWrapper label={label}>
<input value={value} onChange={e => {
e.preventDefault();
onChange(e.target.value)
}}/>
<input
value={value}
onChange={e => {
e.preventDefault();
onChange(e.target.value)
}}
onFocus={e => textBoxFor && tooltip.setFocus(
e.target.getBoundingClientRect(),
{
searchObject: textBoxFor,
textInput: value,
filterObjects: additionalTooltipFilters,
},
onChange
)}
/>
</InputWrapper>
}