From 172c3a1e68f02f7ee0d25d106e7d1d1df2960719 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 10:19:03 -0500 Subject: [PATCH 01/12] fix(content-switcher): set unselected background color --- .../src/components/content-switcher/_content-switcher.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index f1f485222aaa..9468b9511ea0 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -50,7 +50,7 @@ white-space: nowrap; text-align: left; text-decoration: none; - background-color: $ui-01; + background-color: transparent; border: none; transition: all $duration--fast-01 motion(standard, productive); From 5ab50c880abb9242a2db38102c75bd0b02788f21 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 10:33:23 -0500 Subject: [PATCH 02/12] fix(content-switcher): add unselected switcher button borders --- .../components/content-switcher/_content-switcher.scss | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index 9468b9511ea0..b57a88f6013a 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -52,6 +52,8 @@ text-decoration: none; background-color: transparent; border: none; + border-top: rem(1px) solid $ui-05; + border-bottom: rem(1px) solid $ui-05; transition: all $duration--fast-01 motion(standard, productive); &:focus { @@ -96,15 +98,22 @@ } .#{$prefix}--content-switcher-btn:first-child { + border-left: rem(1px) solid $ui-05; border-top-left-radius: rem(4px); border-bottom-left-radius: rem(4px); } .#{$prefix}--content-switcher-btn:last-child { + border-right: rem(1px) solid $ui-05; border-top-right-radius: rem(4px); border-bottom-right-radius: rem(4px); } + .#{$prefix}--content-switcher--selected:first-child, + .#{$prefix}--content-switcher--selected:last-child { + border: 0; + } + .#{$prefix}--content-switcher-btn::before { position: absolute; left: 0; From 09c29698ef34a510876e428693099d5dc8657b73 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 10:49:43 -0500 Subject: [PATCH 03/12] fix(theme-tokens): update content switcher divider token --- packages/components/src/globals/scss/_theme-tokens.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/globals/scss/_theme-tokens.scss b/packages/components/src/globals/scss/_theme-tokens.scss index 3a205c63c6f2..3285e7cd7c6a 100644 --- a/packages/components/src/globals/scss/_theme-tokens.scss +++ b/packages/components/src/globals/scss/_theme-tokens.scss @@ -214,7 +214,7 @@ $content-switcher-option-border: 1px solid $brand-01 !default; /// @type Color /// @access public /// @group content-switcher -$content-switcher-divider: $ui-03 !default; +$content-switcher-divider: $ui-05 !default; // Data Table From b79eeb4aa9e29823062dbd390705fc7978220d53 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 10:51:26 -0500 Subject: [PATCH 04/12] fix(content-switcher): update switcher button hover color --- .../src/components/content-switcher/_content-switcher.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index b57a88f6013a..200a0cf50a23 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -68,6 +68,7 @@ } &:hover { + color: $text-01; cursor: pointer; } From 4666799ed21fed473d979af1f56691fa9f2d4bc1 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 11:00:37 -0500 Subject: [PATCH 05/12] fix(content-switcher): remove borders for middle selected switchers --- .../src/components/content-switcher/_content-switcher.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index 200a0cf50a23..8910c5283711 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -110,6 +110,7 @@ border-bottom-right-radius: rem(4px); } + .#{$prefix}--content-switcher--selected, .#{$prefix}--content-switcher--selected:first-child, .#{$prefix}--content-switcher--selected:last-child { border: 0; From 3f2e3b942f995858870c8ad3f8406143618bee6a Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 11:12:32 -0500 Subject: [PATCH 06/12] fix(content-switcher): update disabled switcher button styles --- .../components/content-switcher/_content-switcher.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index 8910c5283711..4f6f2abd16cc 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -81,13 +81,19 @@ &:disabled { color: $disabled-02; - background-color: $disabled-01; + background-color: transparent; + border-color: $disabled-02; pointer-events: none; &:hover { cursor: not-allowed; } } + + &:disabled:first-child, + &:disabled:last-child { + border-color: $disabled-02; + } } .#{$prefix}--content-switcher--light .#{$prefix}--content-switcher-btn { From d7c3984547e6f3d3c2204f2ae4243471228b3fbd Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 11:34:04 -0500 Subject: [PATCH 07/12] fix(content-switcher): update disabled switcher styles --- .../content-switcher/_content-switcher.scss | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index 4f6f2abd16cc..d39651027f30 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -83,7 +83,6 @@ color: $disabled-02; background-color: transparent; border-color: $disabled-02; - pointer-events: none; &:hover { cursor: not-allowed; @@ -169,6 +168,19 @@ background-color: transparent; } + .#{$prefix}--content-switcher-btn:disabled::before, + .#{$prefix}--content-switcher-btn:disabled:hover + + .#{$prefix}--content-switcher-btn:disabled::before { + background-color: $disabled-02; + } + + .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected:disabled + + .#{$prefix}--content-switcher-btn::before, + .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected:disabled:hover + + .#{$prefix}--content-switcher-btn::before { + background-color: transparent; + } + .#{$prefix}--content-switcher__icon { transition: fill $duration--fast-01 motion(standard, productive); fill: $text-02; From b93f8031b01ec16510b2e3c2ea85bcfde3eaebe6 Mon Sep 17 00:00:00 2001 From: emyarod Date: Fri, 19 Mar 2021 11:34:43 -0500 Subject: [PATCH 08/12] refactor(content-switcher): remove unused styles --- .../src/components/content-switcher/_content-switcher.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index d39651027f30..e883f71fcd7e 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -30,10 +30,6 @@ height: rem(48px); } - .#{$prefix}--content-switcher--disabled { - cursor: not-allowed; - } - .#{$prefix}--content-switcher-btn { @include reset; @include type-style('body-short-01'); From cf979be5459b6034a1582c400a5dd229626da4a3 Mon Sep 17 00:00:00 2001 From: emyarod Date: Wed, 24 Mar 2021 11:20:37 -0500 Subject: [PATCH 09/12] fix(content-switcher): update divider token per new spec --- packages/components/src/globals/scss/_theme-tokens.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/globals/scss/_theme-tokens.scss b/packages/components/src/globals/scss/_theme-tokens.scss index 3285e7cd7c6a..3a205c63c6f2 100644 --- a/packages/components/src/globals/scss/_theme-tokens.scss +++ b/packages/components/src/globals/scss/_theme-tokens.scss @@ -214,7 +214,7 @@ $content-switcher-option-border: 1px solid $brand-01 !default; /// @type Color /// @access public /// @group content-switcher -$content-switcher-divider: $ui-05 !default; +$content-switcher-divider: $ui-03 !default; // Data Table From 57e886365c1a49ffbce380441d8c20aeaa310dd9 Mon Sep 17 00:00:00 2001 From: emyarod Date: Wed, 24 Mar 2021 11:26:31 -0500 Subject: [PATCH 10/12] docs(ContentSwitcher): mark `light` prop for deprecation --- .../components/ContentSwitcher/ContentSwitcher-story.js | 2 +- .../src/components/ContentSwitcher/ContentSwitcher.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/ContentSwitcher/ContentSwitcher-story.js b/packages/react/src/components/ContentSwitcher/ContentSwitcher-story.js index e27b581c7397..b74c6d8ade2b 100644 --- a/packages/react/src/components/ContentSwitcher/ContentSwitcher-story.js +++ b/packages/react/src/components/ContentSwitcher/ContentSwitcher-story.js @@ -25,7 +25,7 @@ const sizes = { const props = { contentSwitcher: () => ({ - light: boolean('Light variant (light)', false), + light: boolean('[Deprecated]: Light variant (light)', false), selectedIndex: select('Selected index (selectedIndex)', [0, 1, 2], 0), selectionMode: select( 'Selection mode (selectionMode)', diff --git a/packages/react/src/components/ContentSwitcher/ContentSwitcher.js b/packages/react/src/components/ContentSwitcher/ContentSwitcher.js index 7fd4a3eca555..d4e27c266785 100644 --- a/packages/react/src/components/ContentSwitcher/ContentSwitcher.js +++ b/packages/react/src/components/ContentSwitcher/ContentSwitcher.js @@ -11,6 +11,7 @@ import classNames from 'classnames'; import { settings } from 'carbon-components'; import { composeEventHandlers } from '../../tools/events'; import { getNextIndex, matches, keys } from '../../internal/keyboard'; +import deprecate from '../../prop-types/deprecate'; const { prefix } = settings; @@ -38,7 +39,11 @@ export default class ContentSwitcher extends React.Component { /** * `true` to use the light variant. */ - light: PropTypes.bool, + light: deprecate( + PropTypes.bool, + 'The `light` prop for `ContentSwitcher` is no longer needed and has ' + + 'been deprecated. It will be removed in the next major release.' + ), /** * Specify an `onChange` handler that is called whenever the ContentSwitcher From 7f2b0731579b266d59f99bd5d88b3750074e1c2d Mon Sep 17 00:00:00 2001 From: emyarod Date: Wed, 24 Mar 2021 11:26:55 -0500 Subject: [PATCH 11/12] refactor(content-switcher): remove redundant light variant styles --- .../content-switcher/_content-switcher.scss | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/packages/components/src/components/content-switcher/_content-switcher.scss b/packages/components/src/components/content-switcher/_content-switcher.scss index e883f71fcd7e..792f2a73c1fc 100644 --- a/packages/components/src/components/content-switcher/_content-switcher.scss +++ b/packages/components/src/components/content-switcher/_content-switcher.scss @@ -91,14 +91,6 @@ } } - .#{$prefix}--content-switcher--light .#{$prefix}--content-switcher-btn { - background-color: $ui-02; - - &:hover { - background-color: $hover-light-ui; - } - } - .#{$prefix}--content-switcher-btn:first-child { border-left: rem(1px) solid $ui-05; border-top-left-radius: rem(4px); @@ -132,26 +124,6 @@ display: none; } - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn::before { - background-color: $decorative-01; - } - - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn:focus::before, - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn:focus - + .#{$prefix}--content-switcher-btn::before, - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn:hover::before, - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn:hover - + .#{$prefix}--content-switcher-btn::before, - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher--selected::before, - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher--selected - + .#{$prefix}--content-switcher-btn::before, .#{$prefix}--content-switcher-btn:focus::before, .#{$prefix}--content-switcher-btn:focus + .#{$prefix}--content-switcher-btn::before, @@ -198,8 +170,6 @@ fill: $text-01; } - .#{$prefix}--content-switcher--light - .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected, .#{$prefix}--content-switcher-btn.#{$prefix}--content-switcher--selected { z-index: 3; color: $inverse-01; From b7bb1108d907ec793e077014db4a88cd0103b595 Mon Sep 17 00:00:00 2001 From: emyarod Date: Wed, 24 Mar 2021 12:02:51 -0500 Subject: [PATCH 12/12] chore: update snapshots --- packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index e3e837d7a362..7072e7cbebe3 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -854,9 +854,7 @@ Map { "className": Object { "type": "string", }, - "light": Object { - "type": "bool", - }, + "light": [Function], "onChange": Object { "isRequired": true, "type": "func",