@@ -36,9 +36,12 @@ export interface ActionProps extends Omit<ButtonProps, 'ref'> {
3636 'aria-controls' ?: string ;
3737}
3838
39+ type ExtendedActionProps = ActionProps & {
40+ [ key : string ] : any ;
41+ } ;
3942export interface ResponseActionProps {
4043 /** Props for message actions, such as feedback (positive or negative), copy button, share, and listen */
41- actions : Record < string , ActionProps | undefined > & {
44+ actions : Record < string , ExtendedActionProps | undefined > & {
4245 positive ?: ActionProps ;
4346 negative ?: ActionProps ;
4447 copy ?: ActionProps ;
@@ -78,6 +81,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
7881 < div ref = { responseActions } className = "pf-chatbot__response-actions" >
7982 { positive && (
8083 < ResponseActionButton
84+ { ...positive }
8185 ariaLabel = { positive . ariaLabel ?? 'Good response' }
8286 clickedAriaLabel = { positive . ariaLabel ?? 'Response recorded' }
8387 onClick = { ( e ) => handleClick ( e , 'positive' , positive . onClick ) }
@@ -95,6 +99,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
9599 ) }
96100 { negative && (
97101 < ResponseActionButton
102+ { ...negative }
98103 ariaLabel = { negative . ariaLabel ?? 'Bad response' }
99104 clickedAriaLabel = { negative . ariaLabel ?? 'Response recorded' }
100105 onClick = { ( e ) => handleClick ( e , 'negative' , negative . onClick ) }
@@ -112,6 +117,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
112117 ) }
113118 { copy && (
114119 < ResponseActionButton
120+ { ...copy }
115121 ariaLabel = { copy . ariaLabel ?? 'Copy' }
116122 clickedAriaLabel = { copy . ariaLabel ?? 'Copied' }
117123 onClick = { ( e ) => handleClick ( e , 'copy' , copy . onClick ) }
@@ -129,6 +135,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
129135 ) }
130136 { share && (
131137 < ResponseActionButton
138+ { ...share }
132139 ariaLabel = { share . ariaLabel ?? 'Share' }
133140 clickedAriaLabel = { share . ariaLabel ?? 'Shared' }
134141 onClick = { ( e ) => handleClick ( e , 'share' , share . onClick ) }
@@ -146,6 +153,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
146153 ) }
147154 { listen && (
148155 < ResponseActionButton
156+ { ...listen }
149157 ariaLabel = { listen . ariaLabel ?? 'Listen' }
150158 clickedAriaLabel = { listen . ariaLabel ?? 'Listening' }
151159 onClick = { ( e ) => handleClick ( e , 'listen' , listen . onClick ) }
@@ -163,6 +171,7 @@ export const ResponseActions: React.FunctionComponent<ResponseActionProps> = ({
163171 ) }
164172 { Object . keys ( additionalActions ) . map ( ( action ) => (
165173 < ResponseActionButton
174+ { ...additionalActions [ action ] }
166175 key = { action }
167176 ariaLabel = { additionalActions [ action ] ?. ariaLabel }
168177 clickedAriaLabel = { additionalActions [ action ] ?. clickedAriaLabel }
0 commit comments