| 1 |
import { Component } from 'react'; |
| 2 |
import { PickOptional } from '../../helpers/typeUtils'; |
| 3 |
import { TooltipPosition } from '../Tooltip'; |
| 4 |
import { TruncateProps } from '../Truncate'; |
| 5 |
import { OUIAProps } from '../../helpers'; |
| 6 |
export declare const clipboardCopyFunc: (_event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void; |
| 7 |
export declare enum ClipboardCopyVariant { |
| 8 |
inline = "inline", |
| 9 |
expansion = "expansion", |
| 10 |
inlineCompact = "inline-compact" |
| 11 |
} |
| 12 |
export interface ClipboardCopyState { |
| 13 |
text: string; |
| 14 |
expanded: boolean; |
| 15 |
copied: boolean; |
| 16 |
textWhenExpanded: string; |
| 17 |
} |
| 18 |
export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'children'>, OUIAProps { |
| 19 |
/** Additional classes added to the clipboard copy container. */ |
| 20 |
className?: string; |
| 21 |
/** Tooltip message to display when hover the copy button */ |
| 22 |
hoverTip?: string; |
| 23 |
/** Tooltip message to display when clicking the copy button */ |
| 24 |
clickTip?: string; |
| 25 |
/** Aria-label to use on the copy button */ |
| 26 |
copyAriaLabel?: string; |
| 27 |
/** Aria-label to use on the TextInput. */ |
| 28 |
textAriaLabel?: string; |
| 29 |
/** Aria-label to use on the ClipboardCopyToggle. */ |
| 30 |
toggleAriaLabel?: string; |
| 31 |
/** ID to use on the TextInput. */ |
| 32 |
inputId?: string; |
| 33 |
/** Name attribute to use on the TextInput. */ |
| 34 |
inputName?: string; |
| 35 |
/** Flag to show if the input is read only. */ |
| 36 |
isReadOnly?: boolean; |
| 37 |
/** Flag to determine if clipboard copy is in the expanded state initially */ |
| 38 |
isExpanded?: boolean; |
| 39 |
/** Flag to determine if clipboard copy content includes code */ |
| 40 |
isCode?: boolean; |
| 41 |
/** Flag to determine if inline clipboard copy should be block styling */ |
| 42 |
isBlock?: boolean; |
| 43 |
/** Adds Clipboard Copy variant styles. */ |
| 44 |
variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion' | 'inline-compact'; |
| 45 |
/** Copy button tooltip position. */ |
| 46 |
position?: TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end'; |
| 47 |
/** Maximum width of the tooltip (default 150px). */ |
| 48 |
maxWidth?: string; |
| 49 |
/** Delay in ms before the tooltip disappears. */ |
| 50 |
exitDelay?: number; |
| 51 |
/** Delay in ms before the tooltip appears. */ |
| 52 |
entryDelay?: number; |
| 53 |
/** A function that is triggered on clicking the copy button. This will replace the existing clipboard copy functionality entirely. */ |
| 54 |
onCopy?: (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void; |
| 55 |
/** A function that is triggered on changing the text. */ |
| 56 |
onChange?: (event: React.FormEvent, text?: string) => void; |
| 57 |
/** Callback function when text input is focused */ |
| 58 |
onInputFocus?: (event?: any) => void; |
| 59 |
/** Callback function when text input is blurred (focus leaves) */ |
| 60 |
onInputBlur?: (event?: any) => void; |
| 61 |
/** The text which is copied. */ |
| 62 |
children: string | string[]; |
| 63 |
/** Additional actions for inline clipboard copy. Should be wrapped with ClipboardCopyAction. */ |
| 64 |
additionalActions?: React.ReactNode; |
| 65 |
/** Enables and customizes truncation for an inline-compact ClipboardCopy. */ |
| 66 |
truncation?: boolean | Omit<TruncateProps, 'content'>; |
| 67 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 68 |
ouiaId?: number | string; |
| 69 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 70 |
ouiaSafe?: boolean; |
| 71 |
} |
| 72 |
declare class ClipboardCopy extends Component<ClipboardCopyProps, ClipboardCopyState> { |
| 73 |
static displayName: string; |
| 74 |
timer: number; |
| 75 |
private clipboardRef; |
| 76 |
constructor(props: ClipboardCopyProps); |
| 77 |
static defaultProps: PickOptional<ClipboardCopyProps>; |
| 78 |
componentDidUpdate: (prevProps: ClipboardCopyProps, prevState: ClipboardCopyState) => void; |
| 79 |
componentWillUnmount: () => void; |
| 80 |
expandContent: (_event: React.MouseEvent<Element, MouseEvent>) => void; |
| 81 |
updateText: (event: React.FormEvent, text: string) => void; |
| 82 |
updateTextWhenExpanded: (event: React.FormEvent, text: string) => void; |
| 83 |
render: () => import("react/jsx-runtime").JSX.Element; |
| 84 |
} |
| 85 |
export { ClipboardCopy }; |
| 86 |
//# sourceMappingURL=ClipboardCopy.d.ts.map |