import { ActionSheetButton, ActionSheetOptions } from '../types';
/**
* Where a `useActionSheet().show()` call must be answered from.
*
* `native` — the OS sheet handled it; `index` is the (validated) chosen option
* or `null` when the native layer returned something unusable.
* `fallback` — no native sheet is available; render the web `ActionSheet`.
*/
export type ActionSheetOutcome = {
source: 'native';
index: number | null;
} | {
source: 'fallback';
};
/**
* Pure resolution of a bridge `actionSheet()` result. Kept separate from the
* hook so the native/web decision is unit-testable without a DOM.
*/
export declare function resolveActionSheetOutcome(nativeIndex: number | null, optionCount: number): ActionSheetOutcome;
export interface ShowActionSheetOptions extends ActionSheetOptions {
/** Cancel row label for the web fallback sheet. Default "Cancel". */
cancelLabel?: string;
}
/** Props to spread onto the web `` fallback. */
export interface ActionSheetHostProps {
open: boolean;
onOpenChange: (open: boolean) => void;
title?: string;
message?: string;
options: ActionSheetButton[];
cancelLabel?: string;
onSelect: (index: number) => void;
}
export interface UseActionSheetResult {
/**
* Present the sheet. Resolves the chosen option index, or `null` when the
* user dismissed/cancelled it.
*/
show: (options: ShowActionSheetOptions) => Promise;
/** Spread onto `` inside the calling component. */
sheetProps: ActionSheetHostProps;
}
/**
* Native-first action sheet. On Capacitor shells the OS sheet is used; on web
* (and on older shells without `bridge.actionSheet`) it falls back to the
* token-styled `ActionSheet` bottom sheet, which the caller renders:
*
* @example
* ```tsx
* const { show, sheetProps } = useActionSheet();
* const onMore = async () => {
* const index = await show({
* title: 'Agent',
* options: [{ title: 'Rename' }, { title: 'Delete', style: 'destructive' }],
* });
* if (index === 0) rename();
* if (index === 1) remove();
* };
* return <>>;
* ```
*/
export declare function useActionSheet(): UseActionSheetResult;
//# sourceMappingURL=useActionSheet.d.ts.map