Skip to content

Commit 8d4dc9b

Browse files
fix(MessageBar): Allow passing props to button tooltip
We want to allow for manual configuration of tooltips by consumers - this allows passage of props.
1 parent 5ec1749 commit 8d4dc9b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/module/src/MessageBar/MessageBar.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { ButtonProps, DropEvent, TextArea, TextAreaProps } from '@patternfly/react-core';
2+
import { ButtonProps, DropEvent, TextArea, TextAreaProps, TooltipProps } from '@patternfly/react-core';
33

44
// Import Chatbot components
55
import SendButton from './SendButton';
@@ -53,13 +53,19 @@ export interface MessageBarProps extends TextAreaProps {
5353
isSendButtonDisabled?: boolean;
5454
/** Prop to allow passage of additional props to buttons */
5555
buttonProps?: {
56-
attach?: { tooltipContent?: string; props?: ButtonProps; inputTestId?: string };
57-
stop?: { tooltipContent?: string; props?: ButtonProps };
58-
send?: { tooltipContent?: string; props?: ButtonProps };
56+
attach?: {
57+
tooltipContent?: string;
58+
props?: ButtonProps;
59+
inputTestId?: string;
60+
tooltipProps?: Omit<TooltipProps, 'content'>;
61+
};
62+
stop?: { tooltipContent?: string; props?: ButtonProps; tooltipProps?: Omit<TooltipProps, 'content'> };
63+
send?: { tooltipContent?: string; props?: ButtonProps; tooltipProps?: Omit<TooltipProps, 'content'> };
5964
microphone?: {
6065
tooltipContent?: { active?: string; inactive?: string };
6166
language?: string;
6267
props?: ButtonProps;
68+
tooltipProps?: Omit<TooltipProps, 'content'>;
6369
};
6470
};
6571
/** A callback for when the text area value changes. */

packages/module/src/MessageBar/MicrophoneButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
1919
/** Callback to update the message value once speech recognition is complete */
2020
onSpeechRecognition: React.Dispatch<React.SetStateAction<string>>;
2121
/** Props to control the PF Tooltip component */
22-
tooltipProps?: TooltipProps;
22+
tooltipProps?: Omit<TooltipProps, 'content'>;
2323
/** English text "Use microphone" and "Stop listening" used in the tooltip */
2424
tooltipContent?: { active?: string; inactive?: string };
2525
/** Locale code for language speech recognition is conducted in. This should be in the format 'en-US', a.k.a. the ISO 639-1 code, a dash, and the ISO_3166-1 code. */

0 commit comments

Comments
 (0)