import { Observable } from 'woby'; type CopiedValue = Observable; type CopyFn = (text: string) => Promise; /** * A hook that provides clipboard copy functionality. * * This hook returns an observable containing the last copied text and a function * to copy text to the clipboard. It handles browser compatibility and provides * feedback on whether the copy operation was successful. * * @returns A tuple containing: * - copiedText: An observable string containing the last copied text or null * - copy: A function that copies text to the clipboard and returns a promise * that resolves to true if successful, false otherwise * * @example * ```tsx * const [copiedText, copyToClipboard] = useCopyToClipboard() * * const handleCopy = async () => { * const success = await copyToClipboard('Hello, world!') * if (success) { * console.log('Text copied successfully') * } * } * * return ( *
* *

Last copied: {copiedText}

*
* ) * ``` * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Clipboard|Clipboard API documentation} * @see {@link https://github.com/vobyjs/woby|Woby documentation} for more information about observables */ export declare function useCopyToClipboard(): [CopiedValue, CopyFn]; export {}; //# sourceMappingURL=useCopyToClipboard.d.ts.map