diff --git a/packages/dataviews/src/view-list.tsx b/packages/dataviews/src/view-list.tsx index c1de2a1e10d796..23a3acc5f88d5f 100644 --- a/packages/dataviews/src/view-list.tsx +++ b/packages/dataviews/src/view-list.tsx @@ -2,7 +2,6 @@ * External dependencies */ import clsx from 'clsx'; -import * as Ariakit from '@ariakit/react'; /** * WordPress dependencies @@ -31,8 +30,14 @@ import type { ViewList as ViewListType, } from './types'; +interface Action { + id: string; + label: string; + callback: ( items: Item[] ) => void; +} + interface ListViewProps { - actions: []; + actions: Action[]; data: Data; fields: NormalizedField[]; getItemId: ( item: Item ) => string; @@ -44,7 +49,7 @@ interface ListViewProps { } interface ListViewItemProps { - actions: []; + actions: Action[]; id?: string; isSelected: boolean; item: Item; @@ -56,6 +61,10 @@ interface ListViewItemProps { } const { + DropdownMenuV2: DropdownMenu, + DropdownMenuGroupV2: DropdownMenuGroup, + DropdownMenuItemV2: DropdownMenuItem, + DropdownMenuItemLabelV2: DropdownMenuItemLabel, CompositeV2: Composite, CompositeItemV2: CompositeItem, CompositeRowV2: CompositeRow, @@ -153,23 +162,41 @@ function ListItem( { { actions && (
- - - } - /> - - Hello - - + + } + /> + } + placement="bottom-end" + > + + { actions.map( ( action: Action ) => { + return ( + + action.callback( [ item ] ) + } + > + + { action.label } + + + ); + } ) } + +
) }