File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
packages/react/src/components/Notification Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import React, {
1414 useEffect ,
1515 useRef ,
1616 useState ,
17+ type ComponentProps ,
1718} from 'react' ;
1819import { deprecate } from '../../prop-types/deprecate' ;
1920import cx from 'classnames' ;
@@ -89,7 +90,7 @@ export interface NotificationActionButtonProps extends ButtonProps<'button'> {
8990 /**
9091 * Optionally specify a click handler for the notification action button.
9192 */
92- onClick ?( ) : void ;
93+ onClick ?: ComponentProps < typeof Button > [ 'onClick' ] ;
9394}
9495
9596export function NotificationActionButton ( {
@@ -882,7 +883,9 @@ export interface ActionableNotificationProps
882883 /**
883884 * Provide a function that is called when the action is clicked
884885 */
885- onActionButtonClick ?( ) : void ;
886+ onActionButtonClick ?: ComponentProps <
887+ typeof NotificationActionButton
888+ > [ 'onClick' ] ;
886889
887890 /**
888891 * Provide a function that is called when menu is closed.
@@ -1287,7 +1290,9 @@ export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
12871290 /**
12881291 * Provide a function that is called when the action is clicked
12891292 */
1290- onActionButtonClick ?( ) : void ;
1293+ onActionButtonClick ?: ComponentProps <
1294+ typeof NotificationActionButton
1295+ > [ 'onClick' ] ;
12911296
12921297 /**
12931298 * Provide a description for "status" icon that can be read by screen readers
Original file line number Diff line number Diff line change 11/**
2- * Copyright IBM Corp. 2016, 2023
2+ * Copyright IBM Corp. 2016, 2025
33 *
44 * This source code is licensed under the Apache-2.0 license found in the
55 * LICENSE file in the root directory of this source tree.
@@ -397,6 +397,9 @@ describe('Callout', () => {
397397 } ) ;
398398 await userEvent . click ( closeButton ) ;
399399 expect ( onActionButtonClick ) . toHaveBeenCalledTimes ( 1 ) ;
400+ expect ( onActionButtonClick . mock . calls ) . toEqual ( [
401+ [ expect . objectContaining ( { type : 'click' } ) ] ,
402+ ] ) ;
400403 } ) ;
401404
402405 it ( 'interpolates matching className based on kind prop' , ( ) => {
Original file line number Diff line number Diff line change 11/**
2- * Copyright IBM Corp. 2016, 2023
2+ * Copyright IBM Corp. 2016, 2025
33 *
44 * This source code is licensed under the Apache-2.0 license found in the
55 * LICENSE file in the root directory of this source tree.
@@ -27,6 +27,7 @@ export default {
2727 statusIconDescription : 'notification' ,
2828 onClose : action ( 'onClose' ) ,
2929 onCloseButtonClick : action ( 'onCloseButtonClick' ) ,
30+ onActionButtonClick : action ( 'onActionButtonClick' ) ,
3031 } ,
3132} ;
3233
You can’t perform that action at this time.
0 commit comments