Skip to content

Commit 9baed88

Browse files
committed
Revert "bug(ClipboardCopy): change children type to string (patternfly#9743)" (patternfly#9895)
This reverts commit a414253.
1 parent c83632f commit 9baed88

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ClipboardCopyToggle } from './ClipboardCopyToggle';
1010
import { ClipboardCopyExpanded } from './ClipboardCopyExpanded';
1111
import { getOUIAProps, OUIAProps } from '../../helpers';
1212

13-
export const clipboardCopyFunc = (event: React.ClipboardEvent<HTMLDivElement>, text?: string) => {
13+
export const clipboardCopyFunc = (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => {
1414
navigator.clipboard.writeText(text.toString());
1515
};
1616

@@ -27,7 +27,7 @@ export interface ClipboardCopyState {
2727
textWhenExpanded: string;
2828
}
2929

30-
export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'children'>, OUIAProps {
30+
export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'>, OUIAProps {
3131
/** Additional classes added to the clipboard copy container. */
3232
className?: string;
3333
/** Tooltip message to display when hover the copy button */
@@ -71,12 +71,12 @@ export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>
7171
/** Delay in ms before the tooltip appears. */
7272
entryDelay?: number;
7373
/** A function that is triggered on clicking the copy button. */
74-
onCopy?: (event: React.ClipboardEvent<HTMLDivElement>, text?: string) => void;
74+
onCopy?: (event: React.ClipboardEvent<HTMLDivElement>, text?: React.ReactNode) => void;
7575
/** A function that is triggered on changing the text. */
7676
onChange?: (event: React.FormEvent, text?: string) => void;
7777
/** The text which is copied. */
78-
children: string;
79-
/** Additional actions for inline clipboard copy. Should be wrapped with ClipboardCopyAction. */
78+
children: React.ReactNode;
79+
/** Additional actions for inline-compact clipboard copy. Should be wrapped with ClipboardCopyAction. */
8080
additionalActions?: React.ReactNode;
8181
/** Value to overwrite the randomly generated data-ouia-component-id.*/
8282
ouiaId?: number | string;

packages/react-core/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { PickOptional } from '../../helpers/typeUtils';
66

77
export interface ClipboardCopyExpandedProps extends Omit<ClipboardCopyProps, 'onChange'> {
88
className?: string;
9+
children: React.ReactNode;
910
onChange?: (e: React.FormEvent<HTMLDivElement>, text: string) => void;
1011
isReadOnly?: boolean;
1112
isCode?: boolean;

0 commit comments

Comments
 (0)