From 9baed88febae04b5fa496484468db0d0f5e10528 Mon Sep 17 00:00:00 2001 From: Titani Labaj <39532947+tlabaj@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:41:09 -0500 Subject: [PATCH] Revert "bug(ClipboardCopy): change children type to string (#9743)" (#9895) This reverts commit a4142535c28ed5ec3f852668fa37ac2361d75b2f. --- .../src/components/ClipboardCopy/ClipboardCopy.tsx | 10 +++++----- .../components/ClipboardCopy/ClipboardCopyExpanded.tsx | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx index 1fc674de587..fba1faad964 100644 --- a/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx +++ b/packages/react-core/src/components/ClipboardCopy/ClipboardCopy.tsx @@ -10,7 +10,7 @@ import { ClipboardCopyToggle } from './ClipboardCopyToggle'; import { ClipboardCopyExpanded } from './ClipboardCopyExpanded'; import { getOUIAProps, OUIAProps } from '../../helpers'; -export const clipboardCopyFunc = (event: React.ClipboardEvent, text?: string) => { +export const clipboardCopyFunc = (event: React.ClipboardEvent, text?: React.ReactNode) => { navigator.clipboard.writeText(text.toString()); }; @@ -27,7 +27,7 @@ export interface ClipboardCopyState { textWhenExpanded: string; } -export interface ClipboardCopyProps extends Omit, 'onChange' | 'children'>, OUIAProps { +export interface ClipboardCopyProps extends Omit, 'onChange'>, OUIAProps { /** Additional classes added to the clipboard copy container. */ className?: string; /** Tooltip message to display when hover the copy button */ @@ -71,12 +71,12 @@ export interface ClipboardCopyProps extends Omit /** Delay in ms before the tooltip appears. */ entryDelay?: number; /** A function that is triggered on clicking the copy button. */ - onCopy?: (event: React.ClipboardEvent, text?: string) => void; + onCopy?: (event: React.ClipboardEvent, text?: React.ReactNode) => void; /** A function that is triggered on changing the text. */ onChange?: (event: React.FormEvent, text?: string) => void; /** The text which is copied. */ - children: string; - /** Additional actions for inline clipboard copy. Should be wrapped with ClipboardCopyAction. */ + children: React.ReactNode; + /** Additional actions for inline-compact clipboard copy. Should be wrapped with ClipboardCopyAction. */ additionalActions?: React.ReactNode; /** Value to overwrite the randomly generated data-ouia-component-id.*/ ouiaId?: number | string; diff --git a/packages/react-core/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx b/packages/react-core/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx index 0c805495078..8a82c3e0001 100644 --- a/packages/react-core/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx +++ b/packages/react-core/src/components/ClipboardCopy/ClipboardCopyExpanded.tsx @@ -6,6 +6,7 @@ import { PickOptional } from '../../helpers/typeUtils'; export interface ClipboardCopyExpandedProps extends Omit { className?: string; + children: React.ReactNode; onChange?: (e: React.FormEvent, text: string) => void; isReadOnly?: boolean; isCode?: boolean;