From 73150a4e6dbff637f2630b380df2150e42086853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Wed, 15 May 2024 10:01:03 +0200 Subject: [PATCH] Remove onActionPerformed & onActionStart from the modal API (#61659) Co-authored-by: oandregal Co-authored-by: youknowriad Co-authored-by: mcsf --- packages/dataviews/src/item-actions.tsx | 18 +++--------------- packages/dataviews/src/types.ts | 10 ++++++++++ packages/dataviews/src/view-list.tsx | 2 -- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/packages/dataviews/src/item-actions.tsx b/packages/dataviews/src/item-actions.tsx index 580ecaa6b2c534..cbf4cdc479d437 100644 --- a/packages/dataviews/src/item-actions.tsx +++ b/packages/dataviews/src/item-actions.tsx @@ -44,8 +44,6 @@ interface ActionModalProps { action: ActionModalType; items: Item[]; closeModal?: () => void; - onActionStart?: ( items: Item[] ) => void; - onActionPerformed?: ( items: Item[] ) => void; } interface ActionWithModalProps extends ActionModalProps { @@ -97,13 +95,7 @@ function DropdownMenuItemTrigger( { ); } -export function ActionModal( { - action, - items, - closeModal, - onActionStart, - onActionPerformed, -}: ActionModalProps ) { +export function ActionModal( { action, items, closeModal }: ActionModalProps ) { return ( ); @@ -127,8 +119,6 @@ export function ActionWithModal( { action, items, ActionTrigger, - onActionStart, - onActionPerformed, isBusy, }: ActionWithModalProps ) { const [ isModalOpen, setIsModalOpen ] = useState( false ); @@ -148,8 +138,6 @@ export function ActionWithModal( { action={ action } items={ items } closeModal={ () => setIsModalOpen( false ) } - onActionStart={ onActionStart } - onActionPerformed={ onActionPerformed } /> ) } diff --git a/packages/dataviews/src/types.ts b/packages/dataviews/src/types.ts index c6bc195c9807e9..7c367aace07ba2 100644 --- a/packages/dataviews/src/types.ts +++ b/packages/dataviews/src/types.ts @@ -210,6 +210,16 @@ interface ActionBase { } export interface ActionModal extends ActionBase { + /** + * The callback to execute when the action has finished. + */ + onActionPerformed: ( ( items: Item[] ) => void ) | undefined; + + /** + * The callback to execute when the action is triggered. + */ + onActionStart: ( ( items: Item[] ) => void ) | undefined; + /** * Modal to render when the action is triggered. */ diff --git a/packages/dataviews/src/view-list.tsx b/packages/dataviews/src/view-list.tsx index c61960d88c4169..faf2d521b1e294 100644 --- a/packages/dataviews/src/view-list.tsx +++ b/packages/dataviews/src/view-list.tsx @@ -229,8 +229,6 @@ function ListItem( { closeModal={ () => setIsModalOpen( false ) } - onActionStart={ () => {} } - onActionPerformed={ () => {} } /> ) }