Skip to content

Commit

Permalink
Merge branch 'main' into 4287-bug-hcm-fix-visibility-of-label-for-che…
Browse files Browse the repository at this point in the history
…cked-checkbox-in-card-control-in-high-contrast-mode
  • Loading branch information
leagrdv authored Dec 19, 2024
2 parents 5fc0402 + 85297d3 commit 33e8825
Show file tree
Hide file tree
Showing 130 changed files with 718 additions and 956 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-maps-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Updated header documentation by specifying `post-logo` slot explicitly.
5 changes: 5 additions & 0 deletions .changeset/early-baboons-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Added a `type="button"` attribute to the `post-close-button` to prevent it from submitting forms.
5 changes: 5 additions & 0 deletions .changeset/early-knives-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Removed auto slotting from `post-togglebutton` component to enable more flexible usage.
5 changes: 5 additions & 0 deletions .changeset/flat-badgers-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Fixed alignment of ´form-switch´ label.
5 changes: 5 additions & 0 deletions .changeset/four-jokes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Added hover styles in high contrast mode for the css components `Button`, `Chip`, `Form Search` and `Button Close`.
5 changes: 5 additions & 0 deletions .changeset/fresh-schools-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Added styles for text links and icon-buttons for Composible Footer in HCM.
6 changes: 6 additions & 0 deletions .changeset/good-spoons-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-nextjs-integration': patch
'@swisspost/design-system-documentation': patch
---

Aligned `width` and `height` percentage classes, after utility update.
5 changes: 5 additions & 0 deletions .changeset/metal-geese-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Fixed colors of validation icon in HCM on form elements.
5 changes: 5 additions & 0 deletions .changeset/nice-beans-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Removed auto slotting from `post-logo` component to enable more flexible usage.
7 changes: 7 additions & 0 deletions .changeset/poor-jars-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@swisspost/design-system-documentation': major
'@swisspost/design-system-components': major
'@swisspost/design-system-styles': major
---

Removed `.bg-` classes to define background color of elements.
5 changes: 5 additions & 0 deletions .changeset/quiet-dolls-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Fixed icon color of banner in high contrast mode.
5 changes: 5 additions & 0 deletions .changeset/quiet-pots-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Added hint to not use active, disabled chips.
5 changes: 5 additions & 0 deletions .changeset/real-phones-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Modified header megadropdown to close when focus is moved outside.
5 changes: 5 additions & 0 deletions .changeset/smooth-spoons-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Updated header documentation by specifying `post-togglebutton` slot explicitly.
5 changes: 5 additions & 0 deletions .changeset/violet-geckos-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Added hover color to `post-accordion` in high contrast mode.
5 changes: 5 additions & 0 deletions .changeset/warm-walls-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Refactored icon declarations to comply with Angular 18's new build system requirements.
5 changes: 5 additions & 0 deletions .changeset/wicked-scissors-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Removed focus from collapsible when in collapsed state.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header class="bg-dark">
<header class="palette-alternate">
<nav class="container py-8">
<ul class="d-flex flex-wrap row-gap-4 column-gap-16 m-0 list-unstyled">
<li *ngFor="let route of navigationRoutes">
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@use '@swisspost/design-system-styles';
@use '@swisspost/design-system-styles/post-external.scss';
2 changes: 1 addition & 1 deletion packages/components/cypress/e2e/tag.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Tag', () => {
});
});

it('should set the tags bg-color according to the prop `variant`', () => {
it('should set the tags background color according to the prop `variant`', () => {
['gray', 'white', 'info', 'success', 'danger', 'warning', 'yellow'].forEach(bg => {
cy.get('@tag').invoke('attr', 'variant', bg).should('have.attr', 'variant', bg);
cy.get('@wrapper').should('have.class', `tag-${bg}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ tokens.$default-map: components.$post-accordion;
}
&:has(.accordion-button:hover)::after {
border-color: tokens.get('accordion-hover-border');
@include utility-mx.high-contrast-mode() {
border-color: Highlight;
}
}
}

Expand All @@ -47,7 +50,6 @@ tokens.$default-map: components.$post-accordion;
calc(
tokens.get('accordion-header-padding-inline') + tokens.get('accordion-border-bottom-width')
);
transition: accordion.$accordion-button-transition;
cursor: pointer;

&::before {
Expand Down Expand Up @@ -100,13 +102,7 @@ tokens.$default-map: components.$post-accordion;
@include utility-mx.high-contrast-mode() {
&:hover,
&:focus-visible {
&:not(:disabled) {
outline: tokens.get('accordion-border-bottom-width') solid Highlight;
}
}

&:disabled {
opacity: 1 !important;
color: Highlight;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class PostClosebutton {
render() {
return (
<Host data-version={version}>
<button class="btn btn-icon-close">
<button class="btn btn-icon-close" type="button">
<post-icon aria-hidden="true" name="closex"></post-icon>
<span class="visually-hidden">
<slot></slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class PostCollapsible {

render() {
return (
<Host data-version={version}>
<Host data-version={version} tabindex={this.collapsed ? -1 : undefined}>
<slot />
</Host>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ slot[name='post-logo'] {
z-index: 1;
inset-block-start: var(--global-header-height);
padding-inline: var(--post-core-dimension-8) var(--post-core-dimension-16);

&.title-header-mobile-extended {
border-bottom: 1px solid var(--post-core-color-sandgrey-012);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ export class PostHeader {
</div>
</div>
</div>
<div class="title-header d-flex space-between align-center">
<div
class={
'title-header d-flex space-between align-center ' +
(this.mobileMenuExtended ? 'title-header-mobile-extended' : '')
}
>
<slot name="title"></slot>
<div class="global-sub">
<slot name="local-controls"></slot>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/post-logo/post-logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class PostLogo {
const LogoTag = logoLink ? 'a' : 'span';

return (
<Host data-version={version} slot="post-logo">
<Host data-version={version}>
<LogoTag class="logo" {...(logoLink ? { href: logoLink } : {})}>
<span class="description">
<slot onSlotchange={() => this.checkDescription()}></slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ post-popovercontainer {
left: 0;
width: 100%;
height: auto;
border-top: unset;

&.slide-in {
animation: slide-in;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export class PostMegadropdown {
this.popoverRef.hide();
}

private handleFocusout(event: FocusEvent) {
const relatedTarget = event.relatedTarget as HTMLElement;
const megadropdown= this.popoverRef.querySelector('.megadropdown');
if (!megadropdown.contains(relatedTarget)) {
this.hide();
}
}

render() {
return (
<Host>
Expand All @@ -89,7 +97,7 @@ export class PostMegadropdown {
edge-gap="0"
ref={el => (this.popoverRef = el)}
>
<div class="megadropdown">
<div class="megadropdown" onFocusout={e => this.handleFocusout(e)}>
<div onClick={() => this.handleBackButtonClick()} class="back-button">
<slot name="back-button"></slot>
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { Component, h, Element, Host } from '@stencil/core';
import { Component, h, Host } from '@stencil/core';
import { version } from '@root/package.json';

@Component({
tag: 'post-menu-item',
shadow: true,
styleUrl: 'post-menu-item.scss',
})
export class PostMenuItem {
@Element() host: HTMLPostMenuItemElement;

render() {
return (
<Host role="menuitem" data-version={version}>
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/components/post-menu/post-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ post-popovercontainer {
padding: var(--post-menu-padding);
background-color: var(--post-menu-bg, #ffffff);
border-color: var(--post-menu-bg, #ffffff);
}
}

.popover-container {
display: flex;
flex-direction: column;
}
44 changes: 28 additions & 16 deletions packages/components/src/components/post-menu/post-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';
import {
Component,
Element,
Event,
EventEmitter,
h,
Host,
Method,
Prop,
State,
} from '@stencil/core';
import { Placement } from '@floating-ui/dom';
import { version } from '@root/package.json';
import { isFocusable } from '@/utils/is-focusable';
import { getFocusableChildren } from '@/utils/get-focusable-children';
import { getRoot } from '@/utils';

@Component({
Expand Down Expand Up @@ -76,7 +86,7 @@ export class PostMenu {

/**
* Displays the popover menu, focusing the first menu item.
*
*
* @param target - The HTML element relative to which the popover menu should be displayed.
*/
@Method()
Expand Down Expand Up @@ -131,12 +141,15 @@ export class PostMenu {

private controlKeyDownHandler(e: KeyboardEvent) {
const menuItems = this.getSlottedItems();

if (!menuItems.length) {
return;
}

const currentFocusedElement = this.root.activeElement as HTMLElement; // Use root's activeElement
let currentIndex = menuItems.findIndex(el => el === currentFocusedElement);
let currentIndex = menuItems.findIndex(el => {
// Check if the item is currently focused within its rendered scope (document or shadow root)
return el === getRoot(el).activeElement;
});

switch (e.key) {
case this.KEYCODES.UP:
Expand Down Expand Up @@ -169,20 +182,19 @@ export class PostMenu {
}
}

private getSlottedItems() {
private getSlottedItems(): Element[] {
const slot = this.host.shadowRoot.querySelector('slot');
const slottedElements = slot ? slot.assignedElements() : [];

const menuItems = slottedElements
.filter(el => el.tagName === 'POST-MENU-ITEM')
.map(el => {
const slot = el.shadowRoot.querySelector('slot');
const assignedElements = slot ? slot.assignedElements() : [];
return assignedElements.filter(isFocusable);
})
.flat();

return menuItems;
return (
slottedElements
// If the element is a slot, get the assigned elements
.flatMap(el => (el instanceof HTMLSlotElement ? el.assignedElements() : el))
// Filter out elements that have a 'menuitem' role
.filter(el => el.getAttribute('role') === 'menuitem')
// For each menu item, get any focusable children (e.g., buttons, links)
.flatMap(el => Array.from(getFocusableChildren(el)))
);
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
}

:host {
--post-contrast-color: #{post.$white};
--post-bg-rgb: #{post.rgb-values(post.$gray-80)};

display: block;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
:where(post-popovercontainer) {
@include elevation-mx.elevation('elevation-3');

background: var(--post-current-palette-bg);
color: var(--post-current-palette-fg);
position: fixed;
z-index: commons.$zindex-popover;

width: max-content;
margin: 0;
padding: 0;
Expand All @@ -34,8 +35,6 @@
}

box-sizing: border-box;
color: var(--post-contrast-color);
background-color: rgb(var(--post-bg-rgb));
border: 2px solid transparent; // Keeping the default border for HCM
border-radius: commons.$border-radius;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class PostTogglebutton {
render() {
return (
<Host
slot="post-togglebutton"
data-version={version}
role="button"
tabindex="0"
Expand Down
Loading

0 comments on commit 33e8825

Please sign in to comment.