@@ -22,6 +22,8 @@ export const BulkSelectValue = {
2222
2323export type BulkSelectValue = ( typeof BulkSelectValue ) [ keyof typeof BulkSelectValue ] ;
2424
25+ export type BulkSelectSource = 'dropdown' | 'checkbox' ;
26+
2527const defaultSelectPageLabel = ( pageCount ?: number ) => `Select page${ pageCount ? ` (${ pageCount } )` : '' } ` ;
2628const defaultSelectAllLabel = ( totalCount ?: number ) => `Select all${ totalCount ? ` (${ totalCount } )` : '' } ` ;
2729const defaultSelectedLabel = ( selectedCount : number ) => `${ selectedCount } selected` ;
@@ -45,7 +47,7 @@ export interface BulkSelectProps extends Omit<DropdownProps, 'toggle' | 'onSelec
4547 /** Indicates if ONLY some current page items are selected */
4648 pagePartiallySelected ?: boolean ;
4749 /** Callback called on item select */
48- onSelect : ( value : BulkSelectValue ) => void ;
50+ onSelect : ( value : BulkSelectValue , source ?: BulkSelectSource ) => void ;
4951 /** Custom OUIA ID */
5052 ouiaId ?: string ;
5153 /** Additional props for MenuToggleCheckbox */
@@ -119,7 +121,7 @@ export const BulkSelect: FC<BulkSelectProps> = ({
119121 ouiaId = { `${ ouiaId } -dropdown` }
120122 onSelect = { ( _e , value ) => {
121123 setOpen ( ! isOpen ) ;
122- onSelect ?.( value as BulkSelectValue ) ;
124+ onSelect ?.( value as BulkSelectValue , 'dropdown' ) ;
123125 } }
124126 isOpen = { isOpen }
125127 onOpenChange = { ( isOpen : boolean ) => setOpen ( isOpen ) }
@@ -142,7 +144,7 @@ export const BulkSelect: FC<BulkSelectProps> = ({
142144 ? null
143145 : pageSelected || ( selectedCount === totalCount && totalCount > 0 )
144146 }
145- onChange = { ( checked ) => onSelect ?.( ! checked || checked === null ? noneOption : allOption ) }
147+ onChange = { ( checked ) => onSelect ?.( ! checked || checked === null ? noneOption : allOption , 'checkbox' ) }
146148 { ...menuToggleCheckboxProps }
147149 >
148150 { selectedCount > 0 ? (
0 commit comments