wix-style-react
Version:
wix-style-react
35 lines • 1.39 kB
TypeScript
export default useCopyClipboard;
export type Clipboard = {
/**
* - a return boolean with status of clipboard action
*/
isCopied: boolean;
/**
* - a return function that allows to initiate copying
*/
copyToClipboard: Function;
/**
* - an optional return function
*/
resetState: Function;
};
/**
* @typedef {Object} Clipboard
* @prop {boolean} isCopied - a return boolean with status of clipboard action
* @prop {function} copyToClipboard - a return function that allows to initiate copying
* @prop {function} resetState - an optional return function
*/
/**
* A custom hook for copying to clipboard. Returns copying to clipboard status and function to initiate copying to clipboard
* @param {Object} props - an object for value, onCopy, and resetTimeout props
* @param {string} props.value - a string that should be copied to clipboard
* @param {function} [props.onCopy] - an optional parameter to apply additional logic when copying to clipboard
* @param {number} [props.resetTimeout] - an optional parameter to set interval which after copying to clipboard will reset status
* @return {Clipboard}
*/
declare function useCopyClipboard({ value, onCopy, resetTimeout }: {
value: string;
onCopy?: Function | undefined;
resetTimeout?: number | undefined;
}): Clipboard;
//# sourceMappingURL=useCopyClipboard.d.ts.map