import { type FocusEvent } from 'react'; import type { HighlightLanguage } from './HighlightExtended.js'; import type { AriaLabelingProps } from '../../core/types/a11y-props.js'; import type { BehaviorTrackingProps } from '../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../core/types/data-props.js'; import type { MaskingProps } from '../../core/types/masking-props.js'; import type { StylingProps } from '../../core/types/styling-props.js'; import type { WithChildren } from '../../core/types/with-children.js'; /** * Props related to the height of the `CodeSnippet` component. * @public */ export type CodeSnippetHeightProps = { /** * Height of the code container. If this is known in advance, then very long * code snippets will still be able to fit into the container while also * having scrolling enabled. Value is given in px. */ maxHeight?: number; fullHeight?: false; } | { /** * Whether the code snippet should take up the available height of its parent container. * @defaultValue false */ fullHeight: true; maxHeight?: never; }; /** * Props for the `CodeSnippet` component. * @public */ export type CodeSnippetProps = WithChildren & StylingProps & DataTestId & MaskingProps & AriaLabelingProps & BehaviorTrackingProps & CodeSnippetHeightProps & { /** * Code language to be used to run highlighting on the given code. */ language?: HighlightLanguage; /** * Whether the copy button should be displayed. * @defaultValue true * @deprecated Will be removed. Use 'showCopyAction' instead */ allowCopy?: boolean; /** * Whether the copy button should be displayed. * @defaultValue true */ showCopyAction?: boolean; /** * Whether line numbers should be shown. * @defaultValue true */ showLineNumbers?: boolean; /** * Whether the content breaks into new lines automatically or not. * @defaultValue false */ lineBreaks?: boolean; /** * Callback fired when copy button is clicked and the code snippet was copied. */ onCopy?: () => void; /** * CodeSnippet layout size, 'default' for standard spacing and 'condensed' for reduced font size, padding and margins. * @defaultValue 'default' */ size?: 'default' | 'condensed'; /** * Called when the component receives focus. */ onFocus?: (e: FocusEvent) => void; /** * Called when the component loses focus. */ onBlur?: (e: FocusEvent) => void; /** * Handler that is called when the element's focus status changes. * @deprecated Use onFocus/onBlur instead. */ onFocusChange?: (isFocused: boolean) => void; }; /** * Use the `CodeSnippet` to display a code block in a read-only context. * By default, the code is formatted but not highlighted. * @public */ export declare const CodeSnippet: (props: CodeSnippetProps & import("react").RefAttributes) => import("react").ReactElement | null; //# sourceMappingURL=CodeSnippet.d.ts.map