From d4dc5350ac4254feb7a4e0c1aa4a55113845e247 Mon Sep 17 00:00:00 2001 From: Birk Johansson Date: Wed, 6 Dec 2023 17:40:15 +0100 Subject: [PATCH] fix(constants): remove buttonVariantProptype from constants (#1436) BREAKING CHANGE: `buttonVariantPropType` has been removed from constants. This is mostly intended for internal use, but was part of the public API. --- .../src/dropdown-button/dropdown-button.js | 18 ++++++++++++------ .../button/src/split-button/split-button.js | 18 ++++++++++++------ constants/src/shared-prop-types.js | 7 +++++++ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/components/button/src/dropdown-button/dropdown-button.js b/components/button/src/dropdown-button/dropdown-button.js index a04adf72c7..9d636e7b6e 100644 --- a/components/button/src/dropdown-button/dropdown-button.js +++ b/components/button/src/dropdown-button/dropdown-button.js @@ -175,8 +175,10 @@ DropdownButton.propTypes = { /** Component to show/hide when button is clicked */ component: PropTypes.element, dataTest: PropTypes.string, - /** Button variant. Mutually exclusive with `primary` and `secondary` props */ - destructive: sharedPropTypes.buttonVariantPropType, + /** + * Applies 'destructive' button appearance, implying a dangerous action. + */ + destructive: PropTypes.bool, /** Make the button non-interactive */ disabled: PropTypes.bool, icon: PropTypes.element, @@ -187,10 +189,14 @@ DropdownButton.propTypes = { name: PropTypes.string, /** Controls popper visibility. When implementing this prop the component becomes a controlled component */ open: PropTypes.bool, - /** Button variant. Mutually exclusive with `destructive` and `secondary` props */ - primary: sharedPropTypes.buttonVariantPropType, - /** Button variant. Mutually exclusive with `primary` and `destructive` props */ - secondary: sharedPropTypes.buttonVariantPropType, + /** + * Applies 'primary' button appearance, implying the most important action. + */ + primary: PropTypes.bool, + /** + * Applies 'secondary' button appearance. + */ + secondary: PropTypes.bool, /** Button size. Mutually exclusive with `large` prop */ small: sharedPropTypes.sizePropType, tabIndex: PropTypes.string, diff --git a/components/button/src/split-button/split-button.js b/components/button/src/split-button/split-button.js index 2f70bebc02..d6051ea4c0 100644 --- a/components/button/src/split-button/split-button.js +++ b/components/button/src/split-button/split-button.js @@ -147,8 +147,10 @@ SplitButton.propTypes = { /** Component to render when the dropdown is opened */ component: PropTypes.element, dataTest: PropTypes.string, - /** Applies 'destructive' appearance to indicate purpose. Mutually exclusive with `primary` and `secondary` props */ - destructive: sharedPropTypes.buttonVariantPropType, + /** + * Applies 'destructive' button appearance, implying a dangerous action. + */ + destructive: PropTypes.bool, /** Disables the button and makes it uninteractive */ disabled: PropTypes.bool, /** An icon to add inside the button */ @@ -158,10 +160,14 @@ SplitButton.propTypes = { /** Changes button size. Mutually exclusive with `small` prop */ large: sharedPropTypes.sizePropType, name: PropTypes.string, - /** Applies 'primary' appearance to indicate purpose. Mutually exclusive with `destructive` and `secondary` props */ - primary: sharedPropTypes.buttonVariantPropType, - /** Applies 'secondary' appearance to indicate purpose. Mutually exclusive with `primary` and `destructive` props */ - secondary: sharedPropTypes.buttonVariantPropType, + /** + * Applies 'primary' button appearance, implying the most important action. + */ + primary: PropTypes.bool, + /** + * Applies 'secondary' button appearance. + */ + secondary: PropTypes.bool, /** Changes button size. Mutually exclusive with `large` prop */ small: sharedPropTypes.sizePropType, tabIndex: PropTypes.string, diff --git a/constants/src/shared-prop-types.js b/constants/src/shared-prop-types.js index 50c60ef911..ef6dd65cc3 100644 --- a/constants/src/shared-prop-types.js +++ b/constants/src/shared-prop-types.js @@ -20,6 +20,13 @@ export const statusArgType = { control: { type: 'boolean' }, } +export const buttonVariantArgType = + // No description because it should be set for the component description + { + table: { type: { summary: 'bool' } }, + control: { type: 'boolean' }, + } + /** * Size variant propType * @return {PropType} Mutually exclusive variants: