@@ -32,9 +32,12 @@ type ActionMenuItemIconType = Pick<IconsProps, 'name'> & {
3232 color ?: IconsProps [ 'color' ]
3333}
3434
35- export type ActionMenuItemType = Omit < SelectPickerOptionType , 'label' | 'value' | 'endIcon' | 'startIcon' > & {
35+ export type ActionMenuItemType < T extends string | number = string | number > = Omit <
36+ SelectPickerOptionType ,
37+ 'label' | 'value' | 'endIcon' | 'startIcon'
38+ > & {
3639 /** A unique identifier for the action menu item. */
37- id : string | number
40+ id : T
3841 /** The text label for the menu item. */
3942 label : string
4043 /** Indicates whether the menu item is disabled. */
@@ -50,7 +53,7 @@ export type ActionMenuItemType = Omit<SelectPickerOptionType, 'label' | 'value'
5053 endIcon ?: ActionMenuItemIconType
5154} & ConditionalActionMenuComponentType
5255
53- export type ActionMenuOptionType = {
56+ export type ActionMenuOptionType < T extends string | number > = {
5457 /**
5558 * The label for the group of menu items. \
5659 * This is optional and can be used to categorize items under a specific group.
@@ -59,27 +62,30 @@ export type ActionMenuOptionType = {
5962 /**
6063 * The list of items belonging to this group.
6164 */
62- items : ActionMenuItemType [ ]
65+ items : ActionMenuItemType < T > [ ]
6366}
6467
65- export type UseActionMenuProps = Omit < UsePopoverProps , 'onPopoverKeyDown' | 'onTriggerKeyDown' > & {
68+ export type UseActionMenuProps < T extends string | number > = Omit <
69+ UsePopoverProps ,
70+ 'onPopoverKeyDown' | 'onTriggerKeyDown'
71+ > & {
6672 /**
6773 * The options to display in the action menu.
6874 */
69- options : ActionMenuOptionType [ ]
75+ options : ActionMenuOptionType < T > [ ]
7076 /**
7177 * Determines whether the action menu is searchable.
7278 */
7379 isSearchable ?: boolean
7480}
7581
76- export type ActionMenuProps = UseActionMenuProps &
82+ export type ActionMenuProps < T extends string | number = string | number > = UseActionMenuProps < T > &
7783 Pick < SelectPickerProps , 'disableDescriptionEllipsis' > & {
7884 /**
7985 * Callback function triggered when an item is clicked.
8086 * @param item - The selected item.
8187 */
82- onClick : ( item : ActionMenuItemType ) => void
88+ onClick : ( item : ActionMenuItemType < T > ) => void
8389 /**
8490 * Config for the footer at the bottom of action menu list. It is sticky by default
8591 */
@@ -102,8 +108,11 @@ export type ActionMenuProps = UseActionMenuProps &
102108 }
103109 )
104110
105- export type ActionMenuItemProps = Pick < ActionMenuProps , 'onClick' | 'disableDescriptionEllipsis' > & {
106- item : ActionMenuItemType
111+ export type ActionMenuItemProps < T extends string | number > = Pick <
112+ ActionMenuProps < T > ,
113+ 'onClick' | 'disableDescriptionEllipsis'
114+ > & {
115+ item : ActionMenuItemType < T >
107116 itemRef : Ref < HTMLAnchorElement > | LegacyRef < HTMLAnchorElement | HTMLButtonElement >
108117 isFocused ?: boolean
109118 onMouseEnter ?: ( ) => void
0 commit comments