import { type ComponentProps, type ReactNode, type RefObject } from 'react'; import { type SnippetRows } from '../core/code-snippet.js'; /** * Unstyled Carbon `CodeSnippet`, the behaviour without a single class: the `Code` (whose text, read back after each * render, is what gets copied unless you give `text`: `copyText` of the context, for a `Copy.Root`), and for the * multi-line snippet a `Content` box held between the row limits (16px rows: at most `maxCollapsedRows` collapsed, * `maxExpandedRows` expanded; 0 = no limit) and a `Toggle` ("Show more / less") that is there only while the code * is taller than the collapsed limit. An expanded snippet whose code shrinks to the expanded minimum folds back. * Measured again as the code resizes. * * State shows as data attributes to style on: `data-expanded` on `Content` and `Toggle`. * * ```tsx * * *
{code}
*
* Show more *
* ``` */ export interface RootProps extends Partial { /** What gets copied instead of the code shown. */ text?: string; /** Showing every row (controlled). */ expanded?: boolean; defaultExpanded?: boolean; /** Each expand or collapse (a press of `Toggle`, or the fold back). */ onExpandedChange?: (expanded: boolean) => void; children?: ReactNode; } interface CodeSnippetContextValue { /** `text`, else the code's text (one leading line break dropped, as `
` does). */
    copyText: string;
    expanded: boolean;
    /** The code is taller than the collapsed limit: `Toggle` shows. */
    canExpand: boolean;
    rows: SnippetRows;
    /** The `Content` box's bounds in px (undefined: none). */
    heights: {
        max?: number;
        min?: number;
    };
    code: RefObject;
    setExpanded: (expanded: boolean) => void;
    /** The parts' handlers. */
    readCode: (text: string) => void;
    setCanExpand: (canExpand: boolean) => void;
}
/** The state of the enclosing `CodeSnippet.Root` (expanded, canExpand, copyText …). */
export declare function useCodeSnippetContext(part?: string): CodeSnippetContextValue;
/** Holds the expanded state and the code's text; renders only its children. */
export declare function Root({ text, expanded: expandedProp, defaultExpanded, onExpandedChange, maxCollapsedRows, maxExpandedRows, minCollapsedRows, minExpandedRows, children, }: Readonly): import("react").JSX.Element;
/** The ``: its text is read back after every render (it can come from any children). */
export declare function Code({ ref, ...rest }: Readonly>): import("react").JSX.Element;
/**
 * The multi-line snippet's box around the code, held between the row limits (`max-height` / `min-height`); it
 * measures the code as it resizes, for `Toggle`, and folds an expanded snippet back when the code fits.
 */
export declare function Content({ style, ...rest }: Readonly>): import("react").JSX.Element;
/** "Show more / Show less": there only while the code is taller than the collapsed limit; a press expands or collapses. */
export declare function Toggle(props: Readonly, 'type'>>): import("react").JSX.Element | null;
export {};