mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 14:26:38 +00:00
Merge remote-tracking branch 'origin'
This commit is contained in:
@@ -75,6 +75,7 @@ export const InfisicalSecretInput = ({
|
|||||||
const [listReference, setListReference] = useState<ReferenceItem[]>([]);
|
const [listReference, setListReference] = useState<ReferenceItem[]>([]);
|
||||||
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
||||||
const inputRef = useRef<HTMLTextAreaElement>(null);
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
const isPopupOpen = isSuggestionsOpen && listReference.length > 0 && currentReference.length > 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInputValue(propValue ?? "");
|
setInputValue(propValue ?? "");
|
||||||
@@ -274,7 +275,11 @@ export const InfisicalSecretInput = ({
|
|||||||
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
||||||
handleSuggestionSelect();
|
handleSuggestionSelect();
|
||||||
}
|
}
|
||||||
if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) {
|
|
||||||
|
if (
|
||||||
|
(["ArrowDown", "ArrowUp"].includes(e.key) && isPopupOpen) ||
|
||||||
|
(e.key === "Enter" && highlightedIndex >= 0)
|
||||||
|
) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -298,10 +303,7 @@ export const InfisicalSecretInput = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover.Root
|
<Popover.Root open={isPopupOpen} onOpenChange={setIsOpen}>
|
||||||
open={isSuggestionsOpen && listReference.length > 0 && currentReference.length > 0}
|
|
||||||
onOpenChange={setIsOpen}
|
|
||||||
>
|
|
||||||
<Popover.Trigger asChild>
|
<Popover.Trigger asChild>
|
||||||
<SecretInput
|
<SecretInput
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
Reference in New Issue
Block a user