Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest fixes from main to the v2.16.0 release #12131

Merged
merged 8 commits into from
Nov 29, 2024
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright IBM Corp. 2016, 2023
// Copyright IBM Corp. 2016, 2024
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -96,6 +96,8 @@
:host(#{$c4d-prefix}-callout-with-media-video)
::slotted(#{$c4d-prefix}-video-player) {
@extend :host(#{$c4d-prefix}-callout-caption);

margin-block-end: 0;
}

:host(#{$c4d-prefix}-callout-with-media-image[color-scheme='inverse'])
Expand Down Expand Up @@ -159,7 +161,7 @@
.#{$prefix}--callout-with-media
.#{$prefix}--callout__content
.#{$prefix}--content-block {
padding-block-end: $spacing-10;
padding-block-end: $spacing-07;
}

:host(#{$c4d-prefix}-callout-with-media-image),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ $feature-flags: (
::slotted([slot='image']),
#{$c4d-prefix}-image {
z-index: 0;
block-size: 100%;

// Opacity is adjusted on hover. See above.
&::before {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2023
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -121,6 +121,7 @@

::slotted(#{$c4d-prefix}-image) {
overflow: hidden;
block-size: 100%;

@include breakpoint(sm) {
block-size: aspect-ratio(1, 1);
Expand Down
12 changes: 9 additions & 3 deletions packages/styles/scss/components/footer/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2023
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -112,7 +112,7 @@

:host(#{$c4d-prefix}-footer-nav-item),
:host(#{$c4d-prefix}-legal-nav-item),
:host(#{$c4d-prefix}-legal-nav-cookie-preferences-placeholder) div {
:host(#{$c4d-prefix}-legal-nav-cookie-preferences-placeholder) {
@include theme($g100, feature-flag-enabled('enable-css-custom-properties'));

display: list-item;
Expand Down Expand Up @@ -142,6 +142,12 @@
}
}

:host(#{$c4d-prefix}-legal-nav-cookie-preferences-placeholder) {
.#{$prefix}--footer__link.#{$prefix}--link {
cursor: pointer;
}
}

:host(#{$c4d-prefix}-legal-nav) {
@include theme($g100, feature-flag-enabled('enable-css-custom-properties'));

Expand Down Expand Up @@ -220,7 +226,7 @@
@include make-container;
}
}
.#{$prefix}--adjunct-links__container--hidden {
.#{$c4d-prefix}--adjunct-links__container--hidden {
display: none;
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/styles/scss/components/footer/_legal-nav.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2016, 2023
* Copyright IBM Corp. 2016, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -198,7 +198,7 @@
}

:host(#{$c4d-prefix}-legal-nav-item),
:host(#{$c4d-prefix}-legal-nav-cookie-preferences-placeholder) div,
:host(#{$c4d-prefix}-legal-nav-cookie-preferences-placeholder),
.#{$prefix}--legal-nav__list-item {
padding: $spacing-03 0 0 0;
margin-inline-end: $spacing-07;
Expand Down
1 change: 0 additions & 1 deletion packages/web-components/src/components/card/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ class C4DCard extends CTAMixin(StableSelectorMixin(CDSLink)) {
}

if (this._hasPictogram) {
this.onclick = () => window.open(this.href, '_self');
this.setAttribute('pictogram', '');
} else {
this.removeAttribute('pictogram');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright IBM Corp. 2020, 2023
// Copyright IBM Corp. 2020, 2024
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -45,7 +45,7 @@
}

::slotted([slot='footer']) {
margin-block-start: $spacing-07;
margin-inline: 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class C4DFooterComposite extends MediaQueryMixin(
slot="${slot}"
trigger-content="${languageSelectorLabel}"
label-text="${languageSelectorLabel}"
label="${languageSelectorLabel}"
value="${selectedLanguage}"
clear-selection-label="${clearSelectionLabel}">
${langList?.map(
Expand Down
46 changes: 26 additions & 20 deletions packages/web-components/src/components/footer/legal-nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { LitElement, html } from 'lit';
import { property, query } from 'lit/decorators.js';
import { property, query, state } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
Expand All @@ -17,7 +17,7 @@ import StableSelectorMixin from '../../globals/mixins/stable-selector';
import styles from './footer.scss';
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';

const { prefix, stablePrefix: c4dPrefix } = settings;
const { stablePrefix: c4dPrefix } = settings;

/**
* Legal nav.
Expand All @@ -37,24 +37,22 @@ class C4DLegalNav extends StableSelectorMixin(LitElement) {
*/
@property()
size = FOOTER_SIZE.REGULAR;

/**
* Navigation label for accessibility.
*/
@property()
navLabel = 'Legal Navigation';
/**
* The adjunct links container
*/

@query(`.${c4dPrefix}--adjunct-links__container`)
private _adjunctLinksContainer?: HTMLDivElement;

/**
* The adjunct links slot
*/
@query('[name="adjunct-links"]')
private _adjunctLinksSlot?: HTMLSlotElement;

@state()
protected _hasAdjunctLinks = false;

/**
* Returns a class-name based on the type parameter type
*/
Expand All @@ -65,16 +63,16 @@ class C4DLegalNav extends StableSelectorMixin(LitElement) {
});
}

protected _handleAdjunctLinksVisibility() {
const {
_adjunctLinksContainer: adjunctLinksContainer,
_adjunctLinksSlot: adjunctLinksSlot,
} = this;
/**
* Handles slot change event of adjunct-links slot to track if there are any.
*/
protected _handleAdjunctLinksVisibility = () => {
const { _adjunctLinksSlot: adjunctLinksSlot } = this;

this._hasAdjunctLinks =
(adjunctLinksSlot?.assignedNodes().length || 0) !== 0;
};

const hiddenClass = `${prefix}--adjunct-links__container--hidden`;
const isEmpty = (adjunctLinksSlot?.assignedNodes().length || 0) === 0;
adjunctLinksContainer?.classList.toggle(hiddenClass, isEmpty);
}
/**
* The shadow slot this legal nav should be in.
*/
Expand All @@ -88,8 +86,14 @@ class C4DLegalNav extends StableSelectorMixin(LitElement) {
super.connectedCallback();
}

firstUpdated() {
const { _adjunctLinksSlot: adjunctLinksSlot } = this;
this._hasAdjunctLinks =
(adjunctLinksSlot?.assignedNodes().length || 0) !== 0;
}

render() {
const { navLabel } = this;
const { navLabel, _hasAdjunctLinks: hasAdjunctLinks } = this;
return this.size !== FOOTER_SIZE.MICRO
? html`
<nav
Expand All @@ -106,8 +110,10 @@ class C4DLegalNav extends StableSelectorMixin(LitElement) {
</div>
<div
part="adjunct-links-container"
class="${c4dPrefix}--adjunct-links__container">
<ul part="adjunct-links-list">
class="${c4dPrefix}--adjunct-links__container${hasAdjunctLinks
? ''
: ` ${c4dPrefix}--adjunct-links__container--hidden`}">
<ul part="adjunct-links-list adjunct-links-list">
<slot
name="adjunct-links"
@slotchange="${this._handleAdjunctLinksVisibility}"></slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function findLastIndex<T>(
@customElement(`${c4dPrefix}-table-of-contents`)
class C4DTableOfContents extends MediaQueryMixin(
HostListenerMixin(StableSelectorMixin(LitElement)),
{ [MQBreakpoints.LG]: MQDirs.MAX }
{ [MQBreakpoints.LG]: MQDirs.MIN }
) {
/**
* Defines TOC type, "" for default, `horizontal` for horizontal variant.
Expand Down Expand Up @@ -157,7 +157,7 @@ class C4DTableOfContents extends MediaQueryMixin(
* Whether we're viewing smaller or larger window.
*/
@state()
_isMobile = this.carbonBreakpoints.lg.matches;
_isMobile = !this.carbonBreakpoints.lg.matches;

/**
* The target elements matching `[name]` harvested from the document.
Expand Down Expand Up @@ -625,8 +625,8 @@ class C4DTableOfContents extends MediaQueryMixin(
}
}

mediaQueryCallbackMaxLG() {
this._isMobile = this.carbonBreakpoints.lg.matches;
mediaQueryCallbackLG() {
this._isMobile = !this.carbonBreakpoints.lg.matches;
}

/**
Expand Down
Loading