UNPKG

3.24 kBTypeScriptView Raw
1import * as React from 'react';
2import { PickOptional } from '../../helpers/typeUtils';
3import { PopoverPosition } from '../Popover';
4import { TooltipPosition } from '../Tooltip';
5export declare const clipboardCopyFunc: (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void;
6export declare enum ClipboardCopyVariant {
7 inline = "inline",
8 expansion = "expansion",
9 inlineCompact = "inline-compact"
10}
11export interface ClipboardCopyState {
12 text: string | number;
13 expanded: boolean;
14 copied: boolean;
15}
16export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
17 /** Additional classes added to the clipboard copy container. */
18 className?: string;
19 /** Tooltip message to display when hover the copy button */
20 hoverTip?: string;
21 /** Tooltip message to display when clicking the copy button */
22 clickTip?: string;
23 /** Aria-label to use on the TextInput. */
24 textAriaLabel?: string;
25 /** Aria-label to use on the ClipboardCopyToggle. */
26 toggleAriaLabel?: string;
27 /** Flag to show if the input is read only. */
28 isReadOnly?: boolean;
29 /** Flag to determine if clipboard copy is in the expanded state initially */
30 isExpanded?: boolean;
31 /** Flag to determine if clipboard copy content includes code */
32 isCode?: boolean;
33 /** Flag to determine if inline clipboard copy should be block styling */
34 isBlock?: boolean;
35 /** Adds Clipboard Copy variant styles. */
36 variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion' | 'inline-compact';
37 /** Copy button popover position. */
38 position?: PopoverPosition | TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
39 /** Maximum width of the tooltip (default 150px). */
40 maxWidth?: string;
41 /** Delay in ms before the tooltip disappears. */
42 exitDelay?: number;
43 /** Delay in ms before the tooltip appears. */
44 entryDelay?: number;
45 /** Delay in ms before the tooltip message switch to hover tip. */
46 switchDelay?: number;
47 /** A function that is triggered on clicking the copy button. */
48 onCopy?: (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void;
49 /** A function that is triggered on changing the text. */
50 onChange?: (text?: string | number) => void;
51 /** The text which is copied. */
52 children: React.ReactNode;
53 /** Additional actions for inline clipboard copy. Should be wrapped with ClipboardCopyAction. */
54 additionalActions?: React.ReactNode;
55}
56export declare class ClipboardCopy extends React.Component<ClipboardCopyProps, ClipboardCopyState> {
57 static displayName: string;
58 timer: number;
59 constructor(props: ClipboardCopyProps);
60 static defaultProps: PickOptional<ClipboardCopyProps>;
61 componentDidUpdate: (prevProps: ClipboardCopyProps, prevState: ClipboardCopyState) => void;
62 componentWillUnmount: () => void;
63 expandContent: (_event: React.MouseEvent<Element, MouseEvent>) => void;
64 updateText: (text: string | number) => void;
65 render: () => JSX.Element;
66}
67//# sourceMappingURL=ClipboardCopy.d.ts.map
\No newline at end of file