From ee2016b1f5b59364d990ee45f0bb7c2baa5f93c0 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 20 Apr 2021 11:26:49 -0700 Subject: [PATCH 1/9] feat(Button): start size work on Button --- .../src/components/button/_button.scss | 13 ++++++++ .../src/components/Button/Button-story.js | 32 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/packages/components/src/components/button/_button.scss b/packages/components/src/components/button/_button.scss index fad2adaed0d4..dad32ad504d7 100644 --- a/packages/components/src/components/button/_button.scss +++ b/packages/components/src/components/button/_button.scss @@ -414,20 +414,33 @@ } } + .#{$prefix}--btn--xs { + min-height: rem(24px); + padding: rem(2px) rem(60px) rem(2px) rem(12px); + } + .#{$prefix}--btn--sm { min-height: rem(32px); padding: $button-padding-sm; } +<<<<<<< HEAD // V11: change xl to 2xl .#{$prefix}--btn--xl:not(.#{$prefix}--btn--icon-only) { +======= + .#{$prefix}--btn--2xl:not(.#{$prefix}--btn--icon-only) { +>>>>>>> 1f124fa1a... feat(Button): start size work on Button @include button-padding-large; min-height: rem(80px); } +<<<<<<< HEAD // V11: change lg to xl .#{$prefix}--btn--lg:not(.#{$prefix}--btn--icon-only) { +======= + .#{$prefix}--btn--xl:not(.#{$prefix}--btn--icon-only) { +>>>>>>> 1f124fa1a... feat(Button): start size work on Button @include button-padding-large; min-height: rem(64px); diff --git a/packages/react/src/components/Button/Button-story.js b/packages/react/src/components/Button/Button-story.js index ab0c9dee6f1b..d40269968e41 100644 --- a/packages/react/src/components/Button/Button-story.js +++ b/packages/react/src/components/Button/Button-story.js @@ -148,6 +148,38 @@ _Default.story = { name: 'Button', }; +export const SizeStory = () => { + return ( + <> +

Do we need a xs variant?

+ +
+
+

This is correct

+ + +
+
+

This should be md

+ +
+
+

This should be lg

+ + + +
+
+

This should be xl

+ +
+
+

This should be 2xl

+ + + ); +}; + export const Secondary = () => { return ; }; From 58437a0c5bc18c3a522bf85d523242539a7b69e8 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 20 Apr 2021 12:09:50 -0700 Subject: [PATCH 2/9] feat(Button): finish size prop update --- .../src/components/button/_button.scss | 5 ---- .../src/components/Button/Button-story.js | 26 +++++++------------ 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/packages/components/src/components/button/_button.scss b/packages/components/src/components/button/_button.scss index dad32ad504d7..c0048f9234b8 100644 --- a/packages/components/src/components/button/_button.scss +++ b/packages/components/src/components/button/_button.scss @@ -414,11 +414,6 @@ } } - .#{$prefix}--btn--xs { - min-height: rem(24px); - padding: rem(2px) rem(60px) rem(2px) rem(12px); - } - .#{$prefix}--btn--sm { min-height: rem(32px); padding: $button-padding-sm; diff --git a/packages/react/src/components/Button/Button-story.js b/packages/react/src/components/Button/Button-story.js index d40269968e41..9e8d6586df42 100644 --- a/packages/react/src/components/Button/Button-story.js +++ b/packages/react/src/components/Button/Button-story.js @@ -151,31 +151,23 @@ _Default.story = { export const SizeStory = () => { return ( <> -

Do we need a xs variant?

- +   +

-

This is correct

- - +   +

-

This should be md

- +   +   +

-

This should be lg

- - - -
-
-

This should be xl

- +

-

This should be 2xl

- + ); }; From 9493fcdcc71e35be67742263dfd085cdf2c2047a Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 20 Apr 2021 12:35:06 -0700 Subject: [PATCH 3/9] feat(Button): revert xl, 2xl changes --- .../components/src/components/button/_button.scss | 8 -------- packages/react/src/components/Button/Button-story.js | 8 ++++---- packages/react/src/components/Button/Button.js | 12 ++---------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/packages/components/src/components/button/_button.scss b/packages/components/src/components/button/_button.scss index c0048f9234b8..fad2adaed0d4 100644 --- a/packages/components/src/components/button/_button.scss +++ b/packages/components/src/components/button/_button.scss @@ -419,23 +419,15 @@ padding: $button-padding-sm; } -<<<<<<< HEAD // V11: change xl to 2xl .#{$prefix}--btn--xl:not(.#{$prefix}--btn--icon-only) { -======= - .#{$prefix}--btn--2xl:not(.#{$prefix}--btn--icon-only) { ->>>>>>> 1f124fa1a... feat(Button): start size work on Button @include button-padding-large; min-height: rem(80px); } -<<<<<<< HEAD // V11: change lg to xl .#{$prefix}--btn--lg:not(.#{$prefix}--btn--icon-only) { -======= - .#{$prefix}--btn--xl:not(.#{$prefix}--btn--icon-only) { ->>>>>>> 1f124fa1a... feat(Button): start size work on Button @include button-padding-large; min-height: rem(64px); diff --git a/packages/react/src/components/Button/Button-story.js b/packages/react/src/components/Button/Button-story.js index 9e8d6586df42..707b56767abe 100644 --- a/packages/react/src/components/Button/Button-story.js +++ b/packages/react/src/components/Button/Button-story.js @@ -160,14 +160,14 @@ export const SizeStory = () => {

  -  

+

+ We will need to wait to update lg and xl to xl and 2xl, respectively{' '} +

+   -
-
- ); }; diff --git a/packages/react/src/components/Button/Button.js b/packages/react/src/components/Button/Button.js index f0ea21b7adb8..57259e619383 100644 --- a/packages/react/src/components/Button/Button.js +++ b/packages/react/src/components/Button/Button.js @@ -330,17 +330,9 @@ Button.propTypes = { * 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 + * V11: add 2xl */ - size: PropTypes.oneOf([ - 'default', - 'field', - 'small', - 'sm', - 'md', - 'lg', - 'xl', - '2xl', - ]), + size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg', 'xl']), /** * Deprecated in v10 in favor of `size`. From c748c996d05b53f671f5c8d74f6a8feece835480 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 20 Apr 2021 13:20:54 -0700 Subject: [PATCH 4/9] feat(Button): add xl, 2xl updates behind feature flag --- .../src/components/Button/Button-story.js | 58 +++++++++++++------ .../react/src/components/Button/Button.js | 12 +++- 2 files changed, 51 insertions(+), 19 deletions(-) diff --git a/packages/react/src/components/Button/Button-story.js b/packages/react/src/components/Button/Button-story.js index 707b56767abe..fffc96f3c603 100644 --- a/packages/react/src/components/Button/Button-story.js +++ b/packages/react/src/components/Button/Button-story.js @@ -14,6 +14,7 @@ import Button from '../Button'; import ButtonSkeleton from '../Button/Button.Skeleton'; import ButtonSet from '../ButtonSet'; import mdx from './Button.mdx'; +import { FeatureFlags } from '../FeatureFlags'; const icons = { None: 'None', @@ -150,25 +151,48 @@ _Default.story = { export const SizeStory = () => { return ( - <> -   - -
-
-   - -
-
-   - +
+
+

Feature Flags: DISABLED

+   + +
+
+   + +
+
+   +   + +
+
+   +   + +

+

Feature Flags: ENABLED


-

- We will need to wait to update lg and xl to xl and 2xl, respectively{' '} -

-   - - + +   + +
+
+   + +
+
+   +   + +
+
+   +   + +
+
); }; diff --git a/packages/react/src/components/Button/Button.js b/packages/react/src/components/Button/Button.js index 57259e619383..f0ea21b7adb8 100644 --- a/packages/react/src/components/Button/Button.js +++ b/packages/react/src/components/Button/Button.js @@ -330,9 +330,17 @@ Button.propTypes = { * 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 - * V11: add 2xl */ - size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg', 'xl']), + size: PropTypes.oneOf([ + 'default', + 'field', + 'small', + 'sm', + 'md', + 'lg', + 'xl', + '2xl', + ]), /** * Deprecated in v10 in favor of `size`. From 60fbcc4c9424939e0edc9035003a7cd890bbdf20 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 20 Apr 2021 14:44:15 -0700 Subject: [PATCH 5/9] feat(FileUploader): update size prop --- .../src/components/file-uploader/_file-uploader.scss | 11 +++++++++-- .../components/FileUploader/FileUploader-story.js | 11 ++++++++--- .../src/components/FileUploader/FileUploader.js | 7 ++++--- .../components/FileUploader/FileUploaderButton.js | 12 +++++++----- .../FileUploader/FileUploaderDropContainer.js | 5 +++-- .../src/components/FileUploader/FileUploaderItem.js | 9 +++++---- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/packages/components/src/components/file-uploader/_file-uploader.scss b/packages/components/src/components/file-uploader/_file-uploader.scss index 150406e97b75..22936e4ca9c0 100644 --- a/packages/components/src/components/file-uploader/_file-uploader.scss +++ b/packages/components/src/components/file-uploader/_file-uploader.scss @@ -162,7 +162,9 @@ } } - .#{$prefix}--file__selected-file--field { + // V11: Remove --field + .#{$prefix}--file__selected-file--field, + .#{$prefix}--file__selected-file--md { min-height: rem(40px); gap: $carbon--spacing-03 $carbon--spacing-05; } @@ -192,7 +194,9 @@ padding: $carbon--spacing-02 0; } - .#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field { + // V11: Remove --field + .#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field, + .#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--md { padding: $carbon--spacing-03 0; } @@ -206,7 +210,10 @@ padding-top: rem(7px); } + // V11: Remove --field .#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--field + .#{$prefix}--form-requirement, + .#{$prefix}--file__selected-file--invalid.#{$prefix}--file__selected-file--md .#{$prefix}--form-requirement { padding-top: rem(11px); } diff --git a/packages/react/src/components/FileUploader/FileUploader-story.js b/packages/react/src/components/FileUploader/FileUploader-story.js index 15102cc66081..5fec56a7069d 100644 --- a/packages/react/src/components/FileUploader/FileUploader-story.js +++ b/packages/react/src/components/FileUploader/FileUploader-story.js @@ -34,11 +34,16 @@ const buttonKinds = { 'Danger Primary (danger--primary)': 'danger--primary', 'Tertiary (tertiary)': 'tertiary', }; + const sizes = { - Default: 'default', - Field: 'field', - Small: 'small', + 'Compat check - Field': 'field', + 'Compat check - Small': 'small', + 'Compat check - default': 'default', + 'Small (sm)': 'sm', + 'Medium (md)': 'md', + 'Large (lg) - Default': 'lg', }; + const filenameStatuses = { 'Edit (edit)': 'edit', 'Complete (complete)': 'complete', diff --git a/packages/react/src/components/FileUploader/FileUploader.js b/packages/react/src/components/FileUploader/FileUploader.js index f7604fd7406d..f2c4b77bedb0 100644 --- a/packages/react/src/components/FileUploader/FileUploader.js +++ b/packages/react/src/components/FileUploader/FileUploader.js @@ -91,8 +91,9 @@ export default class FileUploader extends React.Component { /** * Specify the size of the FileUploaderButton, from a list of available * sizes. For `default` buttons, this prop can remain unspecified. + * V11: `default`, `field`, and `small` will be removed */ - size: PropTypes.oneOf(['default', 'field', 'small']), + size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']), }; static defaultProps = { @@ -179,8 +180,8 @@ export default class FileUploader extends React.Component { }); const selectedFileClasses = classNames(`${prefix}--file__selected-file`, { - [`${prefix}--file__selected-file--field`]: size === 'field', - [`${prefix}--file__selected-file--sm`]: size === 'small', + [`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md', + [`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm', }); return ( diff --git a/packages/react/src/components/FileUploader/FileUploaderButton.js b/packages/react/src/components/FileUploader/FileUploaderButton.js index 7fde4d3fa390..be924c86077f 100644 --- a/packages/react/src/components/FileUploader/FileUploaderButton.js +++ b/packages/react/src/components/FileUploader/FileUploaderButton.js @@ -40,8 +40,9 @@ function FileUploaderButton({ const classes = cx(`${prefix}--btn`, className, { [`${prefix}--btn--${buttonKind}`]: buttonKind, [`${prefix}--btn--disabled`]: disabled, - [`${prefix}--btn--field`]: size === 'field', - [`${prefix}--btn--sm`]: size === 'small', + // V11: remove field, small + [`${prefix}--btn--md`]: size === 'field' || size === 'md', + [`${prefix}--btn--sm`]: size === 'small' || size === 'sm', }); // Adjust label text state based on changes to the labelText prop @@ -174,10 +175,11 @@ FileUploaderButton.propTypes = { role: PropTypes.string, /** - * Specify the size of the button, from a list of available sizes. - * For `default` buttons, this prop can remain unspecified. + * Specify the size of the FileUploaderButton, from a list of available + * sizes. For `default` buttons, this prop can remain unspecified. + * V11: `default`, `field`, and `small` will be removed */ - size: PropTypes.oneOf(['default', 'field', 'small']), + size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']), /** * Provide a custom tabIndex value for the diff --git a/packages/react/src/components/FileUploader/FileUploaderDropContainer.js b/packages/react/src/components/FileUploader/FileUploaderDropContainer.js index 31f17d741f54..6144822ec960 100644 --- a/packages/react/src/components/FileUploader/FileUploaderDropContainer.js +++ b/packages/react/src/components/FileUploader/FileUploaderDropContainer.js @@ -186,9 +186,10 @@ FileUploaderDropContainer.propTypes = { /** * Specify the size of the uploaded items, from a list of available - * sizes. For `default` size, this prop can remain unspecified. + * sizes. For `default` buttons, this prop can remain unspecified. + * V11: `default`, `field`, and `small` will be removed */ - size: PropTypes.oneOf(['default', 'field', 'small']), + size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']), /** * Provide a custom tabIndex value for the diff --git a/packages/react/src/components/FileUploader/FileUploaderItem.js b/packages/react/src/components/FileUploader/FileUploaderItem.js index 0f9954c9a9fd..4a32d059d4a0 100644 --- a/packages/react/src/components/FileUploader/FileUploaderItem.js +++ b/packages/react/src/components/FileUploader/FileUploaderItem.js @@ -30,8 +30,8 @@ function FileUploaderItem({ const { current: id } = useRef(uuid || uid()); const classes = cx(`${prefix}--file__selected-file`, { [`${prefix}--file__selected-file--invalid`]: invalid, - [`${prefix}--file__selected-file--field`]: size === 'field', - [`${prefix}--file__selected-file--sm`]: size === 'small', + [`${prefix}--file__selected-file--md`]: size === 'field' || size === 'md', + [`${prefix}--file__selected-file--sm`]: size === 'small' || size === 'sm', }); return ( @@ -107,9 +107,10 @@ FileUploaderItem.propTypes = { /** * Specify the size of the uploaded items, from a list of available - * sizes. For `default` size, this prop can remain unspecified. + * sizes. For `default` buttons, this prop can remain unspecified. + * V11: `default`, `field`, and `small` will be removed */ - size: PropTypes.oneOf(['default', 'field', 'small']), + size: PropTypes.oneOf(['default', 'field', 'small', 'sm', 'md', 'lg']), /** * Status of the file upload From 8bee1f688fef9ba4f8bbcbb90ae83547977b51fb Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 26 Apr 2021 13:23:41 -0700 Subject: [PATCH 6/9] chore(storybook): remove old story --- .../src/components/Button/Button-story.js | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/packages/react/src/components/Button/Button-story.js b/packages/react/src/components/Button/Button-story.js index fffc96f3c603..ab0c9dee6f1b 100644 --- a/packages/react/src/components/Button/Button-story.js +++ b/packages/react/src/components/Button/Button-story.js @@ -14,7 +14,6 @@ import Button from '../Button'; import ButtonSkeleton from '../Button/Button.Skeleton'; import ButtonSet from '../ButtonSet'; import mdx from './Button.mdx'; -import { FeatureFlags } from '../FeatureFlags'; const icons = { None: 'None', @@ -149,53 +148,6 @@ _Default.story = { name: 'Button', }; -export const SizeStory = () => { - return ( -
-
-

Feature Flags: DISABLED

-   - -
-
-   - -
-
-   -   - -
-
-   -   - -
-
-

Feature Flags: ENABLED

-
- -   - -
-
-   - -
-
-   -   - -
-
-   -   - -
-
- ); -}; - export const Secondary = () => { return ; }; From d617ef5fe89536fc7df3c7e4b4739303acd31cbe Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 26 Apr 2021 13:25:49 -0700 Subject: [PATCH 7/9] test(snapshot): update snapshot tests --- .../__tests__/__snapshots__/PublicAPI-test.js.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index a950eceeeec8..a8a452e8c81c 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -2625,6 +2625,9 @@ Map { "default", "field", "small", + "sm", + "md", + "lg", ], ], "type": "oneOf", @@ -2723,6 +2726,9 @@ Map { "default", "field", "small", + "sm", + "md", + "lg", ], ], "type": "oneOf", @@ -2780,6 +2786,9 @@ Map { "default", "field", "small", + "sm", + "md", + "lg", ], ], "type": "oneOf", @@ -2819,6 +2828,9 @@ Map { "default", "field", "small", + "sm", + "md", + "lg", ], ], "type": "oneOf", From 31f25f798ecc323141cb595c62908d4049d99f3e Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Mon, 26 Apr 2021 14:06:33 -0700 Subject: [PATCH 8/9] test(snapshot): remove snapshot from different pr --- .../elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap index fc4f3848bb57..e86e29a48050 100644 --- a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -138,7 +138,6 @@ Array [ "formatTokenName", "g10", "g100", - "g80", "g90", "getTypeSize", "gray", From def84df22065b46be5e4e49f783fbdb887f88267 Mon Sep 17 00:00:00 2001 From: TJ Egan Date: Tue, 4 May 2021 10:12:52 -0700 Subject: [PATCH 9/9] chore(tests): update snapshots --- .../elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap index e86e29a48050..fc4f3848bb57 100644 --- a/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -138,6 +138,7 @@ Array [ "formatTokenName", "g10", "g100", + "g80", "g90", "getTypeSize", "gray",