diff --git a/docs/dotcom-v2-migration.md b/docs/dotcom-v2-migration.md
index afa46835026..83c63cee266 100644
--- a/docs/dotcom-v2-migration.md
+++ b/docs/dotcom-v2-migration.md
@@ -18,6 +18,7 @@ For Carbon v11 migration guidance, see their
| back-to-top | View changes [here](#backtotop) |
| background-media | No API changes. |
| button | This component is deprecated in v2 in favor for Carbon's core Button |
+| button-group | No API changes. |
| callout-with-media | View changes [here](#callout-with-media) |
| callout-quote | View changes [here](#callout-quote) |
| card | View changes [here] (#card) |
diff --git a/packages/styles/scss/components/button-group/_button-group.scss b/packages/styles/scss/components/button-group/_button-group.scss
index 6d9f38e7171..b593a850bef 100644
--- a/packages/styles/scss/components/button-group/_button-group.scss
+++ b/packages/styles/scss/components/button-group/_button-group.scss
@@ -7,42 +7,20 @@
@use '@carbon/styles/scss/breakpoint' as *;
@use '@carbon/styles/scss/colors' as *;
-@use '@carbon/styles/scss/components/button' as *;
@use '@carbon/styles/scss/config' as *;
@use '@carbon/styles/scss/motion' as *;
@use '@carbon/styles/scss/spacing' as *;
+
@use '../../globals/vars' as *;
@use '../lightbox-media-viewer';
+@use '../button';
@mixin button-group {
- @include button;
-
- .#{$prefix}--button-group,
- :host(#{$c4d-prefix}-button-group),
- :host(#{$c4d-prefix}-leadspace-block-cta) {
- --#{$c4d-prefix}--button-group--item-count: 3;
-
- display: grid;
- grid-template-columns: 1fr;
- grid-auto-rows: 1fr;
- grid-gap: $spacing-05;
-
- @include breakpoint(md) {
- display: inline-grid;
- grid-template-columns: repeat(
- var(--#{$c4d-prefix}--button-group--item-count),
- 1fr
- );
- }
-
- @media print {
- display: block;
- }
- }
-
- .#{$prefix}--button-group-item,
:host(#{$c4d-prefix}-button-group-item),
:host(#{$c4d-prefix}-button-cta) {
+ @extend :host(#{$c4d-prefix}-button);
+
+ outline: none;
max-width: 100%;
min-width: 0;
@@ -53,10 +31,7 @@
}
.#{$prefix}--btn {
- font-size: $spacing-05;
- position: relative;
width: 100%;
- height: 100%;
word-break: break-word;
transition: all $duration-fast-01 motion(entrance, productive), width 0s,
height 0s;
@@ -100,26 +75,33 @@
}
}
+ :host(#{$c4d-prefix}-button-group),
+ :host(#{$c4d-prefix}-leadspace-block-cta) {
+ --#{$c4d-prefix}--button-group--item-count: 3;
+
+ display: grid;
+ grid-template-columns: 1fr;
+ grid-auto-rows: 1fr;
+ grid-gap: $spacing-05;
+
+ @include breakpoint(md) {
+ display: inline-grid;
+ grid-template-columns: repeat(
+ var(--#{$c4d-prefix}--button-group--item-count),
+ 1fr
+ );
+ }
+
+ @media print {
+ display: block;
+ }
+ }
+
:host(#{$c4d-prefix}-button-group-item) {
::slotted([slot='icon']) {
- position: absolute;
- right: $spacing-05;
- top: 50%;
- transform: translateY(-50%);
- flex-shrink: 0;
-
@media print {
fill: $gray-100;
}
}
}
-
- .#{$prefix}--button-group-item--pseudo {
- position: absolute;
- clip: rect(0, 0, 0, 0);
-
- .#{$prefix}--btn {
- width: auto;
- }
- }
}
diff --git a/packages/styles/scss/components/button/_button.scss b/packages/styles/scss/components/button/_button.scss
new file mode 100644
index 00000000000..ae58e08f831
--- /dev/null
+++ b/packages/styles/scss/components/button/_button.scss
@@ -0,0 +1,40 @@
+/**
+* Copyright IBM Corp. 2016, 2023
+*
+* This source code is licensed under the Apache-2.0 license found in the
+* LICENSE file in the root directory of this source tree.
+*/
+
+@use '@carbon/styles/scss/config' as *;
+@use '@carbon/styles/scss/spacing' as *;
+@use '@carbon/styles/scss/theme' as *;
+@use '../../globals/vars' as *;
+@use '../../../../carbon-web-components/src/components/button/button';
+
+@mixin button {
+ :host(#{$c4d-prefix}-button) {
+ @extend :host(#{$prefix}-button);
+
+ svg {
+ @extend .#{$prefix}--btn__icon;
+ }
+
+ .#{$prefix}--btn--hidden {
+ display: none;
+ visibility: hidden;
+
+ @media print {
+ display: inline-block;
+ visibility: visible;
+ font-weight: 200;
+ color: $text-primary;
+
+ span {
+ font-weight: 600;
+ margin-left: calc(-1 * #{$spacing-02});
+ margin-right: $spacing-02;
+ }
+ }
+ }
+ }
+}
diff --git a/packages/styles/scss/components/button/_index.scss b/packages/styles/scss/components/button/_index.scss
new file mode 100644
index 00000000000..5cd90905d56
--- /dev/null
+++ b/packages/styles/scss/components/button/_index.scss
@@ -0,0 +1,11 @@
+//
+// Copyright IBM Corp. 2023
+//
+// This source code is licensed under the Apache-2.0 license found in the
+// LICENSE file in the root directory of this source tree.
+//
+
+@forward 'button';
+@use 'button';
+
+@include button.button;
diff --git a/packages/styles/scss/components/card/_card.scss b/packages/styles/scss/components/card/_card.scss
index 3d5ada6a603..b3ebab2e452 100644
--- a/packages/styles/scss/components/card/_card.scss
+++ b/packages/styles/scss/components/card/_card.scss
@@ -204,6 +204,114 @@
}
}
+ // Card with pictogram placement style
+ :host(#{$c4d-prefix}-card-group-item),
+ :host(#{$c4d-prefix}-card-in-card),
+ :host(#{$c4d-prefix}-card-cta),
+ :host(#{$c4d-prefix}-card) {
+ outline: none;
+
+ .#{$prefix}--card__pictogram {
+ display: flex;
+
+ ::slotted(#{$c4d-prefix}-card-heading) {
+ padding-top: $spacing-07;
+ margin-bottom: 0;
+
+ @include breakpoint(md) {
+ padding-left: 0;
+ flex: 1;
+ display: flex;
+ }
+ }
+ }
+
+ &[pictogram-placement='top'] .#{$prefix}--card,
+ &[pictogram-placement='bottom'] .#{$prefix}--card {
+ ::slotted(#{$c4d-prefix}-card-heading) {
+ padding-top: 0;
+ }
+
+ ::slotted(svg[slot='pictogram']) {
+ margin-left: 0;
+ }
+
+ .#{$prefix}--card__content {
+ position: relative;
+ }
+
+ .#{$prefix}--card__copy {
+ margin-top: $spacing-07;
+ margin-bottom: 0;
+
+ &[hidden] {
+ margin: 0;
+ }
+ }
+
+ svg {
+ position: absolute;
+ right: $spacing-05;
+ bottom: $spacing-05;
+ color: $link-primary;
+ }
+ }
+
+ &[pictogram-placement='top'] .#{$prefix}--card {
+ ::slotted(#{$c4d-prefix}-card-heading) {
+ align-items: flex-end;
+ margin-bottom: 0;
+ margin-top: auto;
+ }
+
+ .#{$prefix}--card__copy {
+ margin-top: $spacing-07;
+ }
+
+ ::slotted(svg[slot='pictogram']) {
+ margin-bottom: $spacing-07;
+ }
+ }
+
+ &[pictogram-placement='bottom'] .#{$prefix}--card {
+ ::slotted(#{$c4d-prefix}-card-heading) {
+ align-items: flex-start;
+ }
+
+ .#{$prefix}--card__copy {
+ margin-bottom: $spacing-07;
+ }
+
+ ::slotted(svg[slot='pictogram']) {
+ margin-top: auto;
+ align-items: flex-end;
+ }
+ }
+
+ ::slotted(svg[slot='pictogram']) {
+ fill: currentColor;
+ @include breakpoint(md) {
+ margin-left: 0;
+ }
+ @include breakpoint(sm) {
+ margin-left: $spacing-05;
+ }
+ }
+
+ &[color-scheme='inverse'] {
+ .#{$prefix}--card svg,
+ ::slotted(svg[slot='pictogram']) {
+ color: $link-inverse;
+ }
+ }
+
+ .#{$prefix}--card__copy {
+ display: flex;
+ flex-direction: column;
+ gap: $spacing-05;
+ }
+ }
+
:host(#{$c4d-prefix}-card[aspect-ratio='1:1']) .#{$prefix}--card__wrapper {
@include ratio-base(1, 1, false);
}
@@ -223,37 +331,6 @@
background-color: $layer-02;
}
- .#{$prefix}--card.#{$prefix}--card--static {
- outline: none;
-
- &:hover {
- .#{$prefix}--card__wrapper {
- background-color: $layer-02;
- }
- }
-
- .#{$prefix}--card__footer {
- align-self: flex-start;
- &:hover {
- text-decoration: underline;
-
- svg,
- .#{$prefix}--card__cta__copy {
- color: $text-primary;
- }
- }
-
- &:active,
- &:focus {
- align-self: flex-start;
- outline: 1px solid $focus;
- }
- &::after {
- position: relative;
- }
- }
- }
-
.#{$prefix}--card--border {
border: 1px solid $layer-accent-01;
}
@@ -276,6 +353,10 @@
:host(#{$c4d-prefix}-card),
:host(#{$c4d-prefix}-card-group-item) {
&:not([href]) {
+ .cds--card .cds--card__copy {
+ margin-bottom: $spacing-01;
+ }
+
&,
&:hover {
.#{$prefix}--card__wrapper {
@@ -283,18 +364,19 @@
}
}
- &:focus-within,
- .#{$prefix}--card:focus-within {
- outline: none;
+ &:focus-within ::slotted(#{$c4d-prefix}-image) {
+ z-index: 0;
}
::slotted(#{$c4d-prefix}-card-footer) {
+ margin-top: $spacing-07;
display: inline-flex;
&::after {
position: relative;
}
}
}
+
&[color-scheme='light'] {
&,
&:hover {
@@ -368,19 +450,6 @@
color: $text-secondary;
}
- .#{$prefix}--card .#{$prefix}--card__cta,
- .#{$prefix}--card .#{$prefix}--card__cta a,
- .#{$prefix}--card .#{$prefix}--card__cta a:visited,
- :host(#{$c4d-prefix}-card-footer)
- .#{$c4d-prefix}-ce--card__footer
- ::slotted(svg[slot='icon']),
- :host(#{$c4d-prefix}-card-cta-footer)
- .#{$c4d-prefix}-ce--card__footer
- ::slotted(svg[slot='icon']) {
- margin-left: 0;
- color: $icon-interactive;
- }
-
:host(#{$c4d-prefix}-card-footer[disabled])
.#{$c4d-prefix}-ce--card__footer
::slotted(svg[slot='icon']) {
@@ -447,7 +516,6 @@
.#{$prefix}--card__cta__copy {
max-width: calc(100% - 20px - #{$spacing-03});
margin-right: $spacing-03;
- color: $text-primary;
@include type-style('body-02');
}
@@ -476,9 +544,55 @@
}
}
+ :host(#{$c4d-prefix}-card-footer),
+ :host(#{$c4d-prefix}-card-cta-footer) {
+ .#{$c4d-prefix}-ce--card__footer--static {
+ color: $link-primary;
+ }
+
+ .#{$prefix}--link-with-icon.#{$prefix}--link-with-icon--inline-icon {
+ display: flex;
+ width: 100%;
+ justify-content: flex-end;
+ align-items: center;
+ }
+
+ &[color-scheme='inverse'] .#{$c4d-prefix}-ce--card__footer--static {
+ color: $link-inverse;
+ }
+
+ &[color-scheme='inverse']
+ .#{$prefix}--link-with-icon.#{$prefix}--link-with-icon--inline-icon {
+ svg,
+ ::slotted(svg[slot='icon']) {
+ color: $link-inverse;
+ }
+ }
+
+ &:hover {
+ ::slotted(svg[slot='icon']) {
+ color: $link-primary-hover;
+ }
+ }
+ }
+
// static card footer
:host(#{$c4d-prefix}-card-footer):not([parent-href]) {
.#{$prefix}--card__footer {
+ width: auto;
+ justify-content: flex-start;
+
+ &:active,
+ &:hover {
+ text-decoration: none;
+ }
+
+ &:active {
+ ::slotted([slot='icon']) {
+ color: $text-primary;
+ }
+ }
+
&::after {
content: none;
}
@@ -486,30 +600,12 @@
outline: $spacing-01 solid $focus;
}
}
- }
-
- .#{$prefix}--card__footer__icon-left {
- svg.#{$prefix}--card__cta,
- ::slotted(svg[slot='icon']) {
- margin-right: $spacing-03;
- }
.#{$prefix}--card__cta__copy {
- margin-right: 0;
+ margin-right: $spacing-03;
}
}
- .#{$prefix}--card .#{$prefix}--card__footer,
- .#{$c4d-prefix}-ce--card__footer {
- display: flex;
- }
-
- .#{$prefix}--card .#{$prefix}--card__footer svg,
- .#{$c4d-prefix}-ce--card__footer ::slotted(svg[slot='icon']) {
- fill: currentColor;
- align-self: center;
- }
-
.#{$prefix}--card--inverse,
.#{$prefix}--card.#{$prefix}--card--inverse,
:host(#{$c4d-prefix}-card)[color-scheme='inverse'],
@@ -655,142 +751,6 @@
}
}
- // Card with pictogram placement style
- :host(#{$c4d-prefix}-card-group-item),
- :host(#{$c4d-prefix}-card-in-card),
- :host(#{$c4d-prefix}-card-cta),
- :host(#{$c4d-prefix}-card) {
- outline: none;
-
- .#{$prefix}--card__pictogram {
- display: flex;
-
- ::slotted(#{$c4d-prefix}-card-heading) {
- padding-top: $spacing-07;
- margin-bottom: 0;
-
- @include breakpoint(md) {
- padding-left: 0;
- flex: 1;
- display: flex;
- }
- }
- }
-
- &[pictogram-placement='top'] .#{$prefix}--card,
- &[pictogram-placement='bottom'] .#{$prefix}--card {
- ::slotted(#{$c4d-prefix}-card-heading) {
- padding-top: 0;
- }
-
- ::slotted(svg[slot='pictogram']) {
- margin-left: 0;
- }
-
- .#{$prefix}--card__content {
- position: relative;
- }
-
- .#{$prefix}--card__copy {
- margin-top: $spacing-07;
- margin-bottom: 0;
-
- &[hidden] {
- margin: 0;
- }
- }
-
- svg {
- position: absolute;
- right: $spacing-05;
- bottom: $spacing-05;
- color: $link-primary;
- }
- }
-
- &[pictogram-placement='top'] .#{$prefix}--card {
- ::slotted(#{$c4d-prefix}-card-heading) {
- align-items: flex-end;
- margin-bottom: 0;
- margin-top: auto;
- }
-
- .#{$prefix}--card__copy {
- margin-top: $spacing-07;
- }
-
- ::slotted(svg[slot='pictogram']) {
- margin-bottom: $spacing-07;
- }
- }
-
- &[pictogram-placement='bottom'] .#{$prefix}--card {
- ::slotted(#{$c4d-prefix}-card-heading) {
- align-items: flex-start;
- }
-
- .#{$prefix}--card__copy {
- margin-bottom: $spacing-07;
- }
-
- ::slotted(svg[slot='pictogram']) {
- margin-top: auto;
- align-items: flex-end;
- }
- }
-
- ::slotted(svg[slot='pictogram']) {
- fill: currentColor;
- @include breakpoint(md) {
- margin-left: 0;
- }
- @include breakpoint(sm) {
- margin-left: $spacing-05;
- }
- }
-
- &[color-scheme='inverse'] ::slotted(svg[slot='pictogram']) {
- color: $link-inverse;
- }
-
- .#{$prefix}--card__copy {
- display: flex;
- flex-direction: column;
- gap: $spacing-05;
- }
- }
-
- :host(#{$c4d-prefix}-card-footer),
- :host(#{$c4d-prefix}-card-cta-footer) {
- .#{$c4d-prefix}-ce--card__footer--static {
- color: $link-primary;
- }
-
- .#{$prefix}--link-with-icon.#{$prefix}--link-with-icon--inline-icon {
- display: flex;
- width: 100%;
- justify-content: flex-end;
- }
-
- &[color-scheme='inverse'] .#{$c4d-prefix}-ce--card__footer--static {
- color: $link-inverse;
- }
-
- &[color-scheme='inverse']
- .#{$prefix}--link-with-icon.#{$prefix}--link-with-icon--inline-icon {
- svg,
- ::slotted(svg[slot='icon']) {
- color: $link-inverse;
- }
- }
-
- &:hover {
- ::slotted(svg[slot='icon']) {
- color: $link-primary-hover;
- }
- }
- }
-
:host(#{$c4d-prefix}-card-cta-footer[cta-type='video']),
:host(#{$c4d-prefix}-card-footer[cta-type='video']) {
.#{$prefix}--link-with-icon.#{$prefix}--link-with-icon--inline-icon {
diff --git a/packages/styles/scss/components/pricing-table/_pricing-table.scss b/packages/styles/scss/components/pricing-table/_pricing-table.scss
index b48e24c187a..ea2a2734154 100644
--- a/packages/styles/scss/components/pricing-table/_pricing-table.scss
+++ b/packages/styles/scss/components/pricing-table/_pricing-table.scss
@@ -310,7 +310,7 @@
.#{$prefix}--pricing-table-header-cell-cta,
:host(#{$c4d-prefix}-pricing-table-header-cell-cta) {
- @extend .#{$prefix}--button-group-item;
+ @extend :host(#{$c4d-prefix}-button-group-item);
display: block;
margin-block-start: $spacing-06;
diff --git a/packages/web-components/.storybook/container.scss b/packages/web-components/.storybook/container.scss
index 5a99be42853..843db80308b 100644
--- a/packages/web-components/.storybook/container.scss
+++ b/packages/web-components/.storybook/container.scss
@@ -14,9 +14,11 @@
@use '@carbon/grid';
@use '@carbon/ibmdotcom-styles/scss/internal/callout/tokens' as callout-tokens;
+@use '@carbon/styles/scss/components/button/tokens' as button-tokens;
@use '@carbon/styles/scss/components/tag/tokens' as tag-tokens;
@include add-component-tokens(callout-tokens.$callout-tokens);
+@include add-component-tokens(button-tokens.$button-tokens);
@include add-component-tokens(tag-tokens.$tag-tokens);
// Emit the flex-grid styles
diff --git a/packages/web-components/examples/codesandbox/components-react/button-group/src/index.js b/packages/web-components/examples/codesandbox/components-react/button-group/src/index.js
index 44cee294592..8155601a44c 100644
--- a/packages/web-components/examples/codesandbox/components-react/button-group/src/index.js
+++ b/packages/web-components/examples/codesandbox/components-react/button-group/src/index.js
@@ -11,17 +11,14 @@ import React from 'react';
import { render } from 'react-dom';
import C4DButtonGroup from '@carbon/ibmdotcom-web-components/es/components-react/button-group/button-group';
import C4DButtonGroupItem from '@carbon/ibmdotcom-web-components/es/components-react/button-group/button-group-item';
-import ArrowRight20 from '@carbon/icons-react/es/arrow--right/20.js';
import './index.css';
const App = () => (