From b968386090b0934f770c66a6eab08f4af0054ee4 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Fri, 23 Aug 2024 20:21:20 +0530 Subject: [PATCH] fix(ToolbarButton): deprecate iconDescription and use label instead (#5893) * fix(ToolbarButton): deprecate iconDescription and use label instead * chore(ToolbarButton): change iconDesription to label in stories * refactor(ToolbarButton): support backward iconDescription --- .../components/Toolbar/Toolbar.stories.jsx | 54 +++++++++---------- .../src/components/Toolbar/ToolbarButton.tsx | 25 +++++++-- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/packages/ibm-products/src/components/Toolbar/Toolbar.stories.jsx b/packages/ibm-products/src/components/Toolbar/Toolbar.stories.jsx index 1df93df8bc..bd905049dc 100644 --- a/packages/ibm-products/src/components/Toolbar/Toolbar.stories.jsx +++ b/packages/ibm-products/src/components/Toolbar/Toolbar.stories.jsx @@ -65,62 +65,62 @@ function _Toolbar(args) { } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> @@ -139,7 +139,7 @@ function _Toolbar(args) { } caret /> @@ -156,12 +156,12 @@ function _Toolbar(args) { } /> } /> @@ -178,62 +178,62 @@ function vertical(args) { } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> diff --git a/packages/ibm-products/src/components/Toolbar/ToolbarButton.tsx b/packages/ibm-products/src/components/Toolbar/ToolbarButton.tsx index a6a24424f1..1c51729dbc 100644 --- a/packages/ibm-products/src/components/Toolbar/ToolbarButton.tsx +++ b/packages/ibm-products/src/components/Toolbar/ToolbarButton.tsx @@ -21,8 +21,14 @@ export interface ToolbarButtonProps caret?: boolean; /** Provide an optional class to be applied to the containing node */ className?: string; + /** + * @deprecated use `label` instead + * Specifies the label for the icon button */ + iconDescription?: string; + /** Specifies the label for the icon button */ - iconDescription: string; + label: string; + /** Specifies the icon to be used by the ToolbarButton component */ renderIcon: React.ElementType; } @@ -35,7 +41,8 @@ export let ToolbarButton = forwardRef( children, className, renderIcon, - iconDescription = '', + iconDescription: deprecated_iconDescription = '', + label, ...rest }: React.PropsWithChildren, ref @@ -45,7 +52,7 @@ export let ToolbarButton = forwardRef(