synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
29 lines • 1.28 kB
TypeScript
type UseConfirmItemsReturn<T = unknown> = {
/** The set of items that are awaiting confirmation */
pendingItems: T[];
/** The set of items that have been confirmed */
confirmedItems: T[];
/** Adds one or more items to the pending list */
addItemsPendingConfirmation: (...items: T[]) => void;
/** Confirms one or more items, adding them to the confirmed list and removing them from the pending list
* @returns the confirmed items */
confirmItem: (...items: T[]) => {
confirmedItems: T[];
pendingItems: T[];
};
/** Remove one or more items that are pending from the list
* @returns the resulting state of confirmed items and pending items */
removePendingItems: (...items: T[]) => {
confirmedItems: T[];
pendingItems: T[];
};
/** Clear all items from the confirmed and pending lists */
clear: () => void;
};
/**
* Stateful hook used to track items that need to be confirmed by the user. Methods are provided to support confirming
* individual items or all items, as well as skipping confirmation for individual items or all items.
*/
declare function useConfirmItems<T = unknown>(): UseConfirmItemsReturn<T>;
export default useConfirmItems;
//# sourceMappingURL=useConfirmItems.d.ts.map