): void => {
+ event.stopPropagation();
+
+ if (prompt !== null && event.keyCode === KEY.ENTER) {
+ event.preventDefault();
+ submit();
+ }
+ }
+
+ return (
+ <>
+
+ {
+ submit();
+ }}
+ >
+ Confirm
+
+ ),
+ }}
+ />
+
+ >
+ );
+}
+
+function promptMenuSelect(prompt: Prompt | null, setPrompt: Dispatch>, valueState: [string, Dispatch>]): React.ReactElement {
+ const [value, setValue] = valueState
+
+ const submit = (): void => {
+ if (prompt !== null) {
+ prompt.resolve(value);
+ setValue('');
+ setPrompt(null);
+ }
+ }
+
+ const onChange = (event: SelectChangeEvent): void => {
+ setValue(event.target.value);
+ }
+
+ const getItems = (options: string[] | { [key: string]: string }) : React.ReactElement[] => {
+ const content = [];
+ for (const i in options) {
+ // @ts-ignore
+ content.push();
+ }
+ return content;
+ }
+
+ return (
+ <>
+
+
+
+
+ >
+ );
+}