Skip to content

Commit

Permalink
Merge branch 'main' into 4293-hcm-apply-missing-selecteditem-backgrou…
Browse files Browse the repository at this point in the history
…nd-color-and-selecteditemtext-text-color-for-checkbox-and-radio-button-in-selected-state
  • Loading branch information
schaertim authored Dec 19, 2024
2 parents 7a11688 + 3ac91be commit 6f99b98
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 76 deletions.
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/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/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/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.
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { html } from 'lit-html';

export default html`<post-header>
<!-- Logo -->
<post-logo>Homepage</post-logo>
<post-logo url="/">Homepage</post-logo>
<!-- Meta navigation -->
<ul class="list-inline" slot="meta-navigation">
Expand Down
20 changes: 11 additions & 9 deletions packages/styles/src/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,19 @@ tokens.$default-map: components.$post-button;

// Styles to improve accessibility in high contrast mode
@include utilities.high-contrast-mode() {
border-color: ButtonBorder;
background-color: ButtonFace;

&:not(:disabled, .disabled) {
&:hover {
border-color: highlight;
&[class] {
border-color: ButtonBorder;
background-color: ButtonFace;

&:not(:disabled, .disabled) {
&:hover {
border-color: highlight;
}
}
}

&:disabled {
border-color: GrayText !important;
&:disabled {
border-color: GrayText !important;
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/styles/src/components/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
color: chip.$chip-hover-color;
background-color: chip.$chip-hover-bg;

@include utilities.high-contrast-mode() {
border-color: highlight;
}

> .badge {
background-color: chip.$chip-bg;
}
Expand Down
8 changes: 1 addition & 7 deletions packages/styles/src/components/form-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,7 @@ input.form-control {
}
}

&.is-valid:not(:disabled) {
background-image: forms.$valid-icon;
}

&.is-invalid:not(:disabled) {
background-image: forms.$invalid-icon;
}
@include forms-mx.validation-icons;
}

.form-label:has(+ input.form-control[disabled]) {
Expand Down
3 changes: 3 additions & 0 deletions packages/styles/src/components/form-search-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ tokens.$default-map: components.$post-search-input;
.search-button {
post-icon {
color: tokens.get('input-color-hover-fg', components.$post-text-input);
@include utilities.high-contrast-mode() {
color: Highlight;
}
}
}
}
Expand Down
76 changes: 48 additions & 28 deletions packages/styles/src/components/form-select.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@forward './../variables/options';

@use './../mixins/utilities';
@use './../mixins/forms';
@use './../functions/forms' as forms-fx;
@use './../mixins/forms' as forms-mx;
@use './../functions/tokens';
@use './../tokens/components';
@use './../tokens/elements';
@use './../variables/components/forms';

tokens.$default-map: components.$post-select;

Expand All @@ -26,7 +28,7 @@ tokens.$default-map: components.$post-select;
border-color: tokens.get('select-color-enabled-border');
border-radius: tokens.get('select-border-radius');
color: tokens.get('select-color-enabled-fg');
@include forms.select-bg-image('enabled');
background-image: forms-fx.select-arrow-icon('enabled');

&:disabled {
opacity: 1;
Expand All @@ -36,7 +38,7 @@ tokens.$default-map: components.$post-select;
border-style: tokens.get('select-border-style-disabled');

&:not([multiple]) {
@include forms.select-bg-image('disabled');
background-image: forms-fx.select-arrow-icon('disabled');
}
}

Expand All @@ -45,7 +47,7 @@ tokens.$default-map: components.$post-select;
background-color: tokens.get('select-color-selected-bg');
color: tokens.get('select-color-selected-fg');
border-color: tokens.get('select-color-selected-border');
@include forms.select-bg-image('selected');
background-image: forms-fx.select-arrow-icon('selected');

@include utilities.focus-style;

Expand All @@ -60,7 +62,7 @@ tokens.$default-map: components.$post-select;
border-color: tokens.get('select-color-hover-border');

&:not([multiple]) {
@include forms.select-bg-image('hover');
background-image: forms-fx.select-arrow-icon('hover');
}

@include utilities.high-contrast-mode {
Expand Down Expand Up @@ -90,29 +92,53 @@ tokens.$default-map: components.$post-select;
}

&.is-valid:not(:disabled) {
@include forms.select-bg-image('enabled', 'valid');
background-image: forms-fx.select-arrow-icon('enabled'), forms.$valid-icon;

&:focus {
@include forms.select-bg-image('selected', 'valid');
background-image: forms-fx.select-arrow-icon('selected'), forms.$valid-icon;
}

&:hover {
&:not([multiple]) {
@include forms.select-bg-image('hover', 'valid');
background-image: forms-fx.select-arrow-icon('hover'), forms.$valid-icon;
}
}

&,
&:hover:not([multiple]),
&:focus {
@include utilities.high-contrast-mode-dark() {
background-image: forms-fx.select-arrow-icon('enabled'), forms-fx.valid-icon('#e0e0e0');
}

@include utilities.high-contrast-mode-light() {
background-image: forms-fx.select-arrow-icon('enabled'), forms-fx.valid-icon('#333333');
}
}
}

&.is-invalid:not(:disabled) {
@include forms.select-bg-image('enabled', 'invalid');
background-image: forms-fx.select-arrow-icon('enabled'), forms.$invalid-icon;

&:focus {
@include forms.select-bg-image('selected', 'invalid');
background-image: forms-fx.select-arrow-icon('selected'), forms.$invalid-icon;
}

&:hover {
&:not([multiple]) {
@include forms.select-bg-image('hover', 'invalid');
background-image: forms-fx.select-arrow-icon('hover'), forms.$invalid-icon;
}
}

&,
&:hover:not([multiple]),
&:focus {
@include utilities.high-contrast-mode-dark() {
background-image: forms-fx.select-arrow-icon('enabled'), forms-fx.invalid-icon('#e0e0e0');
}

@include utilities.high-contrast-mode-light() {
background-image: forms-fx.select-arrow-icon('enabled'), forms-fx.invalid-icon('#333333');
}
}
}
Expand All @@ -126,13 +152,7 @@ tokens.$default-map: components.$post-select;
background-position: center right tokens.get('select-validation-icon-position-inline-end');
}

&.is-valid:not(:disabled) {
@include forms.select-bg-image($validation: 'valid');
}

&.is-invalid:not(:disabled) {
@include forms.select-bg-image($validation: 'invalid');
}
@include forms-mx.validation-icons();
}
}

Expand Down Expand Up @@ -224,43 +244,43 @@ tokens.$default-map: components.$post-select;

[data-color-scheme='dark'] {
.form-select:not([multiple]) {
@include forms.select-bg-image('enabled', null, 'dark');
background-image: forms-fx.select-arrow-icon('enabled', 'dark');

&:disabled {
@include forms.select-bg-image('disabled', null, 'dark');
background-image: forms-fx.select-arrow-icon('disabled', 'dark');
}

&:not(:disabled) {
&:focus {
@include forms.select-bg-image('selected', null, 'dark');
background-image: forms-fx.select-arrow-icon('selected', 'dark');
}

&:hover {
@include forms.select-bg-image('hover', null, 'dark');
background-image: forms-fx.select-arrow-icon('hover', 'dark');
}
}

&.is-valid:not(:disabled) {
@include forms.select-bg-image('enabled', 'valid', 'dark');
background-image: forms-fx.select-arrow-icon('enabled', 'dark'), forms.$valid-icon;

&:focus {
@include forms.select-bg-image('selected', 'valid', 'dark');
background-image: forms-fx.select-arrow-icon('selected', 'dark'), forms.$valid-icon;
}

&:hover {
@include forms.select-bg-image('hover', 'valid', 'dark');
background-image: forms-fx.select-arrow-icon('hover', 'dark'), forms.$valid-icon;
}
}

&.is-invalid:not(:disabled) {
@include forms.select-bg-image('enabled', 'invalid', 'dark');
background-image: forms-fx.select-arrow-icon('enabled', 'dark'), forms.$invalid-icon;

&:focus {
@include forms.select-bg-image('selected', 'invalid', 'dark');
background-image: forms-fx.select-arrow-icon('selected', 'dark'), forms.$invalid-icon;
}

&:hover {
@include forms.select-bg-image('hover', 'invalid', 'dark');
background-image: forms-fx.select-arrow-icon('hover', 'dark'), forms.$invalid-icon;
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions packages/styles/src/components/form-textarea.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ textarea.form-control {
}
}

&.is-valid:not(:disabled) {
background-image: forms.$valid-icon;
}

&.is-invalid:not(:disabled) {
background-image: forms.$invalid-icon;
}
@include forms-mx.validation-icons;
}

.form-label:has(+ textarea.form-control[disabled]) {
Expand Down
8 changes: 8 additions & 0 deletions packages/styles/src/components/icon-close-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ tokens.$default-map: components.$post-close;
background-color: tokens.get('close-enabled-bg');
color: tokens.get('close-enabled-fg');

&:hover {
> post-icon {
@include utilities.high-contrast-mode() {
color: Highlight;
}
}
}

> post-icon {
min-width: tokens.get('close-icon-size');
width: tokens.get('close-icon-size');
Expand Down
Loading

0 comments on commit 6f99b98

Please sign in to comment.