import type { PromptTextRequest } from '@yaakapp-internal/plugins'; import type { FormEvent, ReactNode } from 'react'; import { useCallback, useState } from 'react'; import { Button } from './Button'; import { PlainInput } from './PlainInput'; import { HStack } from './Stacks'; export type PromptProps = Omit & { description?: ReactNode; onCancel: () => void; onResult: (value: string | null) => void; }; export function Prompt({ onCancel, label, defaultValue, placeholder, onResult, required, confirmText, cancelText, }: PromptProps) { const [value, setValue] = useState(defaultValue ?? ''); const handleSubmit = useCallback( (e: FormEvent) => { e.preventDefault(); onResult(value); }, [onResult, value], ); return (
); }