diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index b4e08957b66d..7155a54aee3f 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -182,17 +182,6 @@ Map { }, "Button" => Object { "$$typeof": Symbol(react.forward_ref), - "defaultProps": Object { - "dangerDescription": "danger", - "disabled": false, - "isExpressive": false, - "kind": "primary", - "size": "default", - "tabIndex": 0, - "tooltipAlignment": "center", - "tooltipPosition": "top", - "type": "button", - }, "propTypes": Object { "as": Object { "args": Array [ @@ -248,7 +237,6 @@ Map { "tertiary", ], ], - "isRequired": true, "type": "oneOf", }, "onBlur": Object { diff --git a/packages/react/src/components/Button/Button.js b/packages/react/src/components/Button/Button.js index 368a182bf6d4..c26c95b0f005 100644 --- a/packages/react/src/components/Button/Button.js +++ b/packages/react/src/components/Button/Button.js @@ -16,33 +16,34 @@ import { usePrefix } from '../../internal/usePrefix'; import { useId } from '../../internal/useId'; import toggleClass from '../../tools/toggleClass'; import { useFeatureFlag } from '../FeatureFlags'; +import * as FeatureFlags from '@carbon/feature-flags'; const Button = React.forwardRef(function Button( { - children, as, + children, className, - disabled, - small, - size, - kind, + dangerDescription = 'danger', + disabled = false, + hasIconOnly = false, href, - isExpressive, - isSelected, - tabIndex, - type, - renderIcon: ButtonImageElement, - dangerDescription, iconDescription, - hasIconOnly, - tooltipPosition, - tooltipAlignment, - onClick, + isExpressive = false, + isSelected, + kind = 'primary', onBlur, + onClick, onFocus, onMouseEnter, onMouseLeave, - ...other + renderIcon: ButtonImageElement, + size = FeatureFlags.enabled('enable-v11-release') ? 'lg' : 'default', + small, + tabIndex = 0, + tooltipAlignment = 'center', + tooltipPosition = 'top', + type = 'button', + ...rest }, ref ) { @@ -222,7 +223,7 @@ const Button = React.forwardRef(function Button( onFocus: composeEventHandlers([onFocus, handleFocus]), onBlur: composeEventHandlers([onBlur, handleBlur]), onClick: composeEventHandlers([onClick, handleClick]), - ...other, + ...rest, ...commonProps, ...otherProps, }, @@ -300,7 +301,7 @@ Button.propTypes = { /** * Specify the kind of Button you want to create */ - kind: PropTypes.oneOf(ButtonKinds).isRequired, + kind: PropTypes.oneOf(ButtonKinds), /** * Provide an optional function to be called when the button element @@ -344,20 +345,20 @@ Button.propTypes = { role: PropTypes.string, /** - * Specify the size of the button, from a list of available sizes. - * For `default` buttons, this prop can remain unspecified or use `default`. - * In the next major release of Carbon, `default`, `field`, and `small` will be removed + * Specify the size of the button, from the following list of sizes: */ - size: PropTypes.oneOf([ - 'default', - 'field', - 'small', - 'sm', - 'md', - 'lg', - 'xl', - '2xl', - ]), + size: FeatureFlags.enabled('enable-v11-release') + ? PropTypes.oneOf(['sm', 'md', 'lg', 'xl', '2xl']) + : PropTypes.oneOf([ + 'default', + 'field', + 'small', + 'sm', + 'md', + 'lg', + 'xl', + '2xl', + ]), /** * Deprecated in v10 in favor of `size`. @@ -391,16 +392,4 @@ Button.propTypes = { type: PropTypes.oneOf(['button', 'reset', 'submit']), }; -Button.defaultProps = { - tabIndex: 0, - type: 'button', - disabled: false, - kind: 'primary', - size: 'default', - dangerDescription: 'danger', - tooltipAlignment: 'center', - tooltipPosition: 'top', - isExpressive: false, -}; - export default Button; diff --git a/packages/react/src/components/Button/next/Button.stories.js b/packages/react/src/components/Button/next/Button.stories.js deleted file mode 100644 index 833edd118079..000000000000 --- a/packages/react/src/components/Button/next/Button.stories.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright IBM Corp. 2016, 2018 - * - * This source code is licensed under the Apache-2.0 license found in the - * LICENSE file in the root directory of this source tree. - */ - -import React from 'react'; -import { action } from '@storybook/addon-actions'; -import { Add16 } from '@carbon/icons-react'; -import { default as Button, ButtonSkeleton } from '../'; -import ButtonSet from '../../ButtonSet'; - -export default { - title: 'Components/Button', - component: Button, - subcomponents: { - ButtonSet, - ButtonSkeleton, - }, -}; - -export const _Default = () => { - return ; -}; - -export const Secondary = () => { - return ; -}; - -export const Tertiary = () => { - return ; -}; - -export const Danger = () => { - return ( - <> - -   - -   - - - ); -}; - -export const Ghost = () => { - return ; -}; - -export const IconButton = () => ( - - - - ); -}; - -export const Skeleton = () => ( -
- -   - -
-); diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap index b95e038e17b5..6a3dce26475c 100644 --- a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap +++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap @@ -1871,16 +1871,9 @@ exports[`DataTable should render 1`] = ` @@ -2039,10 +2032,6 @@ exports[`DataTable should render 1`] = ` } > @@ -3104,10 +3048,6 @@ exports[`DataTable sticky header should render 1`] = ` } >