import { type ComponentProps, type ReactNode } from 'react';
/**
* Unstyled Carbon `CopyButton` (and the copy of the inline `CodeSnippet`), the behaviour without a single class:
* a `Trigger` that puts `text` on the clipboard and then reports `copied` for `feedbackTimeout` ms (2000), and a
* `Status` live region that announces your feedback ("Copied!") for that moment. A copy that failed shows no
* feedback; `onCopy` returning false copies nothing (you copy it yourself) and still shows it. Pressing again
* restarts the moment; the timer stops with the component.
*
* State shows as data attributes to style on: `data-copied` and `data-disabled` on `Trigger`.
*
* ```tsx
*
* ⧉
* Copied!
*
* ```
*/
export interface CopyOptions {
/** Called before copying; return false to copy it yourself (the feedback still shows). */
onCopy?: (text: string) => boolean | void;
/** How long the feedback shows, in ms. */
feedbackTimeout?: number;
}
/**
* Copies `text` (unless `onCopy` takes it over) and reports `copied` for `feedbackTimeout` ms — the "Copied!" moment
* of a copy button. No feedback when the copy failed.
*/
export declare function useCopy(text: string, { onCopy, feedbackTimeout }: CopyOptions): {
copied: boolean;
copy: () => Promise;
};
export interface RootProps extends CopyOptions {
/** What gets copied. */
text: string;
children?: ReactNode;
}
interface CopyContextValue {
text: string;
/** In the feedback moment after a copy. */
copied: boolean;
/** Copies the text, then shows the feedback. */
copy: () => Promise;
}
/** The state of the enclosing `Copy.Root` (copied, copy). */
export declare function useCopyContext(part?: string): CopyContextValue;
/** Holds the text and the feedback timer; renders only its children. */
export declare function Root({ text, onCopy, feedbackTimeout, children }: Readonly): import("react").JSX.Element;
export interface TriggerProps extends Omit, 'type'> {
/** Disabled but still a Tab stop (`aria-disabled`, as Carbon's inline snippet): a press copies nothing. */
focusableWhenDisabled?: boolean;
}
/** The copy button: a press copies (unless disabled). */
export declare function Trigger({ disabled, focusableWhenDisabled, ...rest }: Readonly): import("react").JSX.Element;
/** A polite live region (`role="status"`): its children (the feedback) only during the moment after a copy. */
export declare function Status({ children, ...rest }: Readonly, 'role'>>): import("react").JSX.Element;
export {};