import type { PromptNode } from '../../core/index.js'; import type { PromptProps } from './type.js'; /** * Creates and manages a Prompt modal. * * @typeParam InputValue - Type of the value collected from user input * @typeParam BackgroundValue - Type of background data passed to BackgroundComponent * @param args - Prompt modal configuration options * @returns Object containing modalNode and promiseHandler * * @remarks * - modalNode: The created modal node instance * - promiseHandler: Promise that resolves with user input value * - Input component receives value, onChange, onConfirm, onCancel, and context props * - Use disabled function to control confirm button's enabled state * - If returnOnCancel is false (default), promise rejects on cancel * - If returnOnCancel is true, returns defaultValue on cancel * * @example * ```tsx * const { modalNode, promiseHandler } = promptHandler({ * title: 'Enter Your Name', * Input: ({ value, onChange, onConfirm }) => ( * onChange(e.target.value)} * onKeyPress={(e) => e.key === 'Enter' && onConfirm()} * /> * ), * defaultValue: '', * }); * * try { * const name = await promiseHandler; * console.log('User entered:', name); * } catch { * console.log('User cancelled'); * } * ``` */ export declare const promptHandler: (args: PromptProps) => { readonly modalNode: PromptNode; readonly promiseHandler: Promise; };