import type { UISelectableOption } from '@sap-ux/ui-components'; import type { PromptQuestion, DynamicChoices, PromptListChoices } from '../types.js'; import type { Answers, ChoiceOptions, AsyncDynamicQuestionProperty } from 'inquirer'; interface RequestedChoices { [key: string]: boolean; } /** * Hook for value update for input components. * * @param initialValue - Initial/default value * @param propValue - External value from component properties * @returns Returns a stateful value, and a function to update it. */ export declare function useValue(initialValue?: S, propValue?: S): [S | undefined, (value: S | undefined) => void]; /** * Hook for dropdown/combobox options for dropdown components. * * @param question - Question with choices * @param choices - External choices(if param is passed then choices would be used on top of "question.choices") * @returns Returns dropdown/combobox options. */ export declare function useOptions(question: PromptQuestion, choices?: PromptListChoices): UISelectableOption[]; /** * Custom hook to manage checked and selected keys for multi-select. * Separates pre checked options from current selected options. * * @param options - Array of selectable options that may contain pre-checked items * @param value - Comma-separated string of selected option keys */ export declare function useMultiSelectKeys(options: UISelectableOption[], value: string): { checkedOptions: string[]; selectedKeys: string[]; }; /** * Hook to resolve a prompt message, supporting both static and dynamic messages. * If a message function is provided, it will be called with the current answers * and the resolved message will be returned. Otherwise, returns an empty string. * * @param message - Function that returns a string or Promise based on answers * @param answers - Current answers object to pass to message * @returns The resolved message string */ export declare function usePromptMessage(message?: AsyncDynamicQuestionProperty, answers?: any): string; /** * Hook for requested choices update. * * @param initialValue - Initial/default choices * @param latestChoices - Latest choices from component properties * @returns Returns a stateful value, and a function to update it. */ export declare function useRequestedChoices(initialValue: RequestedChoices, latestChoices?: DynamicChoices): [RequestedChoices, (value: string[]) => void]; /** * Hook as effect to detect when dynamic choices should be requested. * * @param effect - Effect which triggered when update/refresh for dynamic questions should be requested * @param questions - Current questions */ export declare function useDynamicQuestionsEffect(effect: (names: string[]) => void, questions: PromptQuestion[]): void; /** * Hook for question answers state object whch maintains external answers with defaul answers from questions. * * @param questions - Questions which can contain default answers * @param externalAnswers - External answers to merge with default values from questions * @param onInitialChange - Callback function which called when external or default values of questions changed * @returns Returns a stateful answers, and a function to update it. */ export declare function useAnswers(questions: PromptQuestion[], externalAnswers?: Answers, onInitialChange?: (value: Answers) => void): [Answers, (value: Answers | ((prev: Answers) => Answers)) => void]; /** * Method to generate id for prompt component. * * @returns Generated id for prompt component. */ export declare function getId(): string; /** * Hook for unique id for component or DOM element. * * @param externalId - external id * @returns Resolved id for component or DOM. */ export declare function useId(externalId?: string): string; export {}; //# sourceMappingURL=hooks.d.ts.map