@wix/design-system
Version:
@wix/design-system
28 lines • 1.15 kB
TypeScript
type Clipboard = {
/** a return boolean with status of clipboard action */
isCopied: boolean;
/** a return function that allows to initiate copying */
copyToClipboard: () => void;
/** an optional return function */
reset: () => void;
};
type UseClipboardReturn = Clipboard;
/** an object for value, onCopy, and resetTimeout props */
type UseClipboardProps = {
/** a string that should be copied to clipboard */
value: string;
/** an optional parameter to apply additional logic when copying to clipboard */
onCopy?: Function | undefined;
/** an optional parameter to set interval which after copying to clipboard will reset status */
resetTimeout?: number | undefined;
};
/**
* Hook to use copy to clipboard functionality.
* @returns object with values:
* - isCopied - boolean with status of clipboard action
* - copyToClipboard - a return function that allows to initiate copying
* - reset - an optional return function
*/
export declare function useCopyClipboard({ value, onCopy, resetTimeout, }: UseClipboardProps): UseClipboardReturn;
export {};
//# sourceMappingURL=useCopyClipboard.d.ts.map