Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into update-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
swisspost-bot committed Dec 4, 2024
2 parents 627faa9 + 7320b67 commit 33d1342
Show file tree
Hide file tree
Showing 93 changed files with 3,104 additions and 1,674 deletions.
6 changes: 6 additions & 0 deletions .changeset/2024-11-17-update-icons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-icons': minor
---

Added icon number 2633.

6 changes: 6 additions & 0 deletions .changeset/chilled-owls-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-documentation': minor
'@swisspost/design-system-components': minor
---

Added the `post-togglebutton` component.
5 changes: 5 additions & 0 deletions .changeset/grumpy-lobsters-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': minor
---

Added the capability to use a slotted img as a logo inside ´accordion-items´.
5 changes: 5 additions & 0 deletions .changeset/itchy-meals-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': minor
---

Added a ´post-accordion´ example showing logo usage.
5 changes: 5 additions & 0 deletions .changeset/large-hornets-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Updated the ´post-accordion´ styles to match the new Post design.
12 changes: 12 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"breezy-cups-add",
"brown-badgers-dream",
"chatty-kiwis-travel",
"chilled-owls-walk",
"clean-icons-complain",
"clean-windows-think",
"cold-baboons-appear",
"cold-panthers-vanish",
"cuddly-bears-check",
Expand Down Expand Up @@ -76,46 +78,56 @@
"neat-suits-provide",
"nervous-rocks-shop",
"new-goats-impress",
"nice-ligers-attend",
"ninety-nails-float",
"pink-weeks-relate",
"plenty-apricots-raise",
"plenty-taxis-hear",
"popular-games-rush",
"popular-mirrors-cross",
"proud-actors-knock",
"proud-cheetahs-act",
"proud-moons-impress",
"purple-impalas-own",
"quick-buses-give",
"quick-eagles-watch",
"quick-mails-joke",
"quiet-apes-rhyme",
"rare-dryers-count",
"red-cobras-cry",
"red-lies-lick",
"red-moose-do",
"rich-timers-listen",
"selfish-bats-run",
"selfish-ways-know",
"shaggy-experts-give",
"sharp-baboons-smile",
"sharp-bobcats-grab",
"sharp-crews-watch",
"shiny-ears-care",
"shy-walls-exercise",
"silver-coins-invent",
"six-roses-flow",
"six-spiders-smoke",
"sixty-items-promise",
"slimy-plums-sniff",
"slimy-rockets-pull",
"slow-fishes-reply",
"soft-moles-whisper",
"strange-bottles-impress",
"strange-mice-bake",
"stupid-walls-tie",
"tame-terms-push",
"three-lies-do",
"tidy-dolls-walk",
"tidy-keys-push",
"tiny-socks-count",
"twenty-items-drum",
"warm-drinks-prove",
"weak-jars-rhyme",
"wild-bugs-work",
"wise-spies-shave",
"wise-tomatoes-brake",
"yellow-yaks-jog"
]
}
5 changes: 5 additions & 0 deletions .changeset/sharp-bobcats-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': patch
---

Made `post-icon` component use base tag href to define location of icons folder.
26 changes: 16 additions & 10 deletions .github/workflows/create-token-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,33 @@ jobs:
- name: Create PR Branch
if: steps.pr-branch.outputs.exists == 'false'
run: |
git checkout -b ${{ steps.pr-branch.outputs.name }} ${{ github.ref_name }}
git checkout -b ${{ steps.pr-branch.outputs.name }} origin/main
git push --set-upstream origin ${{ steps.pr-branch.outputs.name }}
# If the PR branch exits, update it with the tokens branch
- name: Update PR Branch with Tokens Branch
if: steps.pr-branch.outputs.exists == 'true'
# Check if there are token changes
- name: Get Token Changes
id: tokens
run: |
git checkout ${{ steps.pr-branch.outputs.name }}
git merge ${{ github.ref_name }} -X theirs --no-edit
git checkout ${{ github.ref_name }} -- packages/tokens/tokensstudio-generated
git add .
if [[ -n $(git commit --dry-run --short) ]]; then
echo "haveChanged=true" >> $GITHUB_OUTPUT
else
echo "haveChanged=false" >> $GITHUB_OUTPUT
fi
# Always update the PR branch with the main branch
- name: Update PR Branch with main
# If there are token changes, commit them
- name: Commit Token Changes
if: steps.tokens.outputs.haveChanged == 'true'
run: |
git merge origin/main -X ours --no-edit
git commit -m "chore(tokens): update generated files"
git push
# Check if a PR already exist
- name: Get PR
id: pr
run: |
if [[ -n $(gh pr list --head "${{ steps.pr-branch.outputs.name }}") ]]; then
if [[ -n $(gh pr list --head ${{ steps.pr-branch.outputs.name }}) ]]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
Expand Down
8 changes: 8 additions & 0 deletions packages/components-angular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @swisspost/design-system-components-angular-workspace

## 1.1.10-next.7

### Patch Changes

- Updated dependencies:
- @swisspost/design-system-components@9.0.0-next.7
- @swisspost/design-system-styles@9.0.0-next.7

## 1.1.10-next.6

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/components-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swisspost/design-system-components-angular-workspace",
"version": "1.1.10-next.6",
"version": "1.1.10-next.7",
"scripts": {
"start": "ng serve --port 9210",
"build": "ng build components",
Expand All @@ -18,8 +18,8 @@
"@angular/platform-browser": "18.2.13",
"@angular/platform-browser-dynamic": "18.2.13",
"@angular/router": "18.2.13",
"@swisspost/design-system-components": "workspace:9.0.0-next.6",
"@swisspost/design-system-styles": "workspace:9.0.0-next.6",
"@swisspost/design-system-components": "workspace:9.0.0-next.7",
"@swisspost/design-system-styles": "workspace:9.0.0-next.7",
"rxjs": "7.8.1",
"tslib": "2.6.3",
"zone.js": "0.14.8"
Expand Down
7 changes: 7 additions & 0 deletions packages/components-angular/projects/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @swisspost/design-system-components-angular

## 9.0.0-next.7

### Patch Changes

- Updated dependencies:
- @swisspost/design-system-components@9.0.0-next.7

## 9.0.0-next.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/components-angular/projects/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swisspost/design-system-components-angular",
"version": "9.0.0-next.6",
"version": "9.0.0-next.7",
"description": "Swiss Post Design System - Angular Wrapper Components",
"author": "Swiss Post <[email protected]>",
"license": "Apache-2.0",
Expand All @@ -19,7 +19,7 @@
},
"dependencies": {
"tslib": "2.6.3",
"@swisspost/design-system-components": "workspace:9.0.0-next.6"
"@swisspost/design-system-components": "workspace:9.0.0-next.7"
},
"peerDependencies": {
"@angular/common": "^16.0.0 || ^17.0.0 || ^18.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/components-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @swisspost/design-system-components-react

## 9.0.0-next.7

### Patch Changes

- Updated dependencies:
- @swisspost/design-system-components@9.0.0-next.7

## 9.0.0-next.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/components-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swisspost/design-system-components-react",
"version": "9.0.0-next.6",
"version": "9.0.0-next.7",
"description": "Design System React Components for easy integration with the React ecosystem",
"author": "Swiss Post <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -29,7 +29,7 @@
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@swisspost/design-system-components": "workspace:9.0.0-next.6"
"@swisspost/design-system-components": "workspace:9.0.0-next.7"
},
"devDependencies": {
"@types/node": "20.14.14",
Expand Down
16 changes: 16 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @swisspost/design-system-components

## 9.0.0-next.7

### Minor Changes

- Added the `post-togglebutton` component. (by [@veyaromain](https://github.com/veyaromain) with [#3889](https://github.com/swisspost/design-system/pull/3889))

- Refactored `post-icon` component to use the `<use>` tag to load and show icons under the hood. This enables responsive icons, enables better caching and improves render performance slightly. There is no further action required. (by [@oliverschuerch](https://github.com/oliverschuerch) with [#3969](https://github.com/swisspost/design-system/pull/3969))

### Patch Changes

- Fixed bug that showed delayed tooltip even after blur event. (by [@leagrdv](https://github.com/leagrdv) with [#4053](https://github.com/swisspost/design-system/pull/4053))

- Made `post-icon` component use base tag href to define location of icons folder. (by [@leagrdv](https://github.com/leagrdv) with [#4069](https://github.com/swisspost/design-system/pull/4069))
- Updated dependencies:
- @swisspost/design-system-styles@9.0.0-next.7

## 9.0.0-next.6

### Major Changes
Expand Down
114 changes: 114 additions & 0 deletions packages/components/cypress/e2e/togglebutton.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
const TOGGLE_BUTTON_ID = '1a6f47c2-5e8a-45a0-b1c3-9f7e2b834c24';

describe('togglebutton', () => {
beforeEach(() => {
cy.visit('/iframe.html?id=snapshots--toggle-button');
cy.get('post-togglebutton', { timeout: 30000 }).should('be.visible');
});

describe('default behavior', () => {
it('should toggle state when clicked', () => {
cy.get('post-togglebutton')
.first()
.as('button')
.shadow()
.find('slot[name="untoggled"]')
.should('exist');

cy.get('@button').click();

cy.get('@button').shadow().find('slot[name="toggled"]').should('exist');
});

it('should toggle state when pressing Enter key', () => {
cy.get('post-togglebutton')
.first()
.as('button')
.shadow()
.find('slot[name="untoggled"]')
.should('exist');

cy.get('@button').trigger('keydown', { key: 'Enter' });

cy.get('@button').shadow().find('slot[name="toggled"]').should('exist');
});

it('should have correct ARIA attributes', () => {
cy.get('post-togglebutton')
.first()
.as('button')
.should('have.attr', 'role', 'button')
.and('have.attr', 'aria-pressed', 'false')
.and('have.attr', 'tabindex', '0');

cy.get('@button').click();

cy.get('@button').should('have.attr', 'aria-pressed', 'true');
});
});

describe('initial state', () => {
it('should respect initial toggled state', () => {
cy.get('post-togglebutton[toggled]')
.first()
.as('toggledButton')
.shadow()
.find('slot[name="toggled"]')
.should('exist');

cy.get('@toggledButton').should('have.attr', 'aria-pressed', 'true');
});

it('should respect untoggled state', () => {
cy.get('post-togglebutton:not([toggled])')
.first()
.as('untoggledButton')
.shadow()
.find('slot[name="untoggled"]')
.should('exist');

cy.get('@untoggledButton').should('have.attr', 'aria-pressed', 'false');
});
});

describe('slot content', () => {
it('should display correct slot content based on toggle state', () => {
cy.get('post-togglebutton').first().as('button');

cy.get('@button').shadow().find('slot[name="untoggled"]').should('exist');

cy.get('@button').click();

cy.get('@button').shadow().find('slot[name="toggled"]').should('exist');

cy.get('@button').click();

cy.get('@button').shadow().find('slot[name="untoggled"]').should('exist');
});
});

describe('version attribute', () => {
it('should have the correct version data attribute', () => {
cy.get('post-togglebutton').first().should('have.attr', 'data-version');
});
});

describe('Accessibility', () => {
beforeEach(() => {
cy.injectAxe();
});

it('Has no detectable a11y violations on load for all variants', () => {
cy.checkA11y('#root-inner');
});

it('Should be keyboard navigable', () => {
cy.get('post-togglebutton')
.first()
.focus()
.should('have.focus')
.trigger('keydown', { key: 'Enter' })
.should('have.attr', 'aria-pressed', 'true');
});
});
});
5 changes: 3 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swisspost/design-system-components",
"version": "9.0.0-next.6",
"version": "9.0.0-next.7",
"description": "A collection of web components built with Stencil JS for the Swiss Post Design System.",
"license": "Apache-2.0",
"main": "dist/index.cjs.js",
Expand Down Expand Up @@ -40,7 +40,8 @@
"dependencies": {
"@floating-ui/dom": "1.6.8",
"@oddbird/popover-polyfill": "0.3.7",
"@swisspost/design-system-styles": "workspace:9.0.0-next.6",
"@swisspost/design-system-styles": "workspace:9.0.0-next.7",
"@swisspost/design-system-icons": "workspace:9.0.0-next.7",
"ally.js": "1.4.1",
"long-press-event": "2.5.0"
},
Expand Down
Loading

0 comments on commit 33d1342

Please sign in to comment.