diff --git a/.changeset/new-pianos-mix.md b/.changeset/new-pianos-mix.md new file mode 100644 index 0000000000..e811033863 --- /dev/null +++ b/.changeset/new-pianos-mix.md @@ -0,0 +1,6 @@ +--- +'@swisspost/design-system-documentation': minor +'@swisspost/design-system-styles': minor +--- + +Added list mixins `list-bullet`, `list-revert` and `list-unstyled`. diff --git a/packages/documentation/.storybook/styles/preview.scss b/packages/documentation/.storybook/styles/preview.scss index 35c5a3f0f3..17ad69d1f9 100644 --- a/packages/documentation/.storybook/styles/preview.scss +++ b/packages/documentation/.storybook/styles/preview.scss @@ -52,7 +52,8 @@ $monospace: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier .table-fit-content { width: fit-content; - th, td { + th, + td { padding-inline: 2rem; } } @@ -110,9 +111,8 @@ $monospace: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier top: -0.1em; margin: 0 0.1em; padding: 0.15em 0.4em 0.1em; - background-color: tokens.get('utility-surface-accent1'); - border: 1px solid tokens.get('utility-surface-accent2'); - color: 1px solid tokens.get('utility-surface-accent4'); + background-color: rgba(#fff, 0.75); + border: 1px solid rgba(#000, 0.3); border-radius: 0.2em; font-family: $monospace; font-size: 0.75em; @@ -128,6 +128,13 @@ $monospace: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier } } + [data-color-scheme='dark'] { + code { + background-color: rgba(#000, 0.75); + border-color: rgba(#fff, 0.3); + } + } + .sbdocs-wrapper { padding-right: 0; padding-bottom: 0; diff --git a/packages/documentation/cypress/e2e/components/list.cy.ts b/packages/documentation/cypress/e2e/components/list.cy.ts index af988242ea..3aed76e35d 100644 --- a/packages/documentation/cypress/e2e/components/list.cy.ts +++ b/packages/documentation/cypress/e2e/components/list.cy.ts @@ -1,7 +1,7 @@ describe('List', () => { describe('Accessibility', () => { beforeEach(() => { - cy.visit('/iframe.html?id=snapshots--list'); + cy.visit('/iframe.html?id=snapshots--lists'); cy.get('ol', { timeout: 30000 }).should('be.visible'); cy.injectAxe(); }); diff --git a/packages/documentation/cypress/snapshots/components/list.snapshot.ts b/packages/documentation/cypress/snapshots/components/list.snapshot.ts index fa0320ecdb..a49515ac7f 100644 --- a/packages/documentation/cypress/snapshots/components/list.snapshot.ts +++ b/packages/documentation/cypress/snapshots/components/list.snapshot.ts @@ -1,6 +1,6 @@ describe('List', () => { it('default', () => { - cy.visit('/iframe.html?id=snapshots--list'); + cy.visit('/iframe.html?id=snapshots--lists'); cy.get('ol', { timeout: 30000 }).should('be.visible'); cy.percySnapshot('Lists', { widths: [1440] }); }); diff --git a/packages/documentation/src/stories/foundations/typography/list/list-bullet.sample.scss b/packages/documentation/src/stories/foundations/typography/list/list-bullet.sample.scss new file mode 100644 index 0000000000..4c106961d7 --- /dev/null +++ b/packages/documentation/src/stories/foundations/typography/list/list-bullet.sample.scss @@ -0,0 +1,7 @@ +@use '@swisspost/design-system-styles/core' as post; + +.my-component { + ul { + @include post.list-bullet(); + } +} diff --git a/packages/documentation/src/stories/foundations/typography/list/list-inline.sample.scss b/packages/documentation/src/stories/foundations/typography/list/list-inline.sample.scss new file mode 100644 index 0000000000..e6e5e1de5b --- /dev/null +++ b/packages/documentation/src/stories/foundations/typography/list/list-inline.sample.scss @@ -0,0 +1,7 @@ +@use '@swisspost/design-system-styles/core' as post; + +.my-component { + ul { + @include post.list-inline(); + } +} diff --git a/packages/documentation/src/stories/foundations/typography/list/list-reset.sample.scss b/packages/documentation/src/stories/foundations/typography/list/list-reset.sample.scss deleted file mode 100644 index 8bc5b24f1c..0000000000 --- a/packages/documentation/src/stories/foundations/typography/list/list-reset.sample.scss +++ /dev/null @@ -1,5 +0,0 @@ -@use '../../../../../node_modules/@swisspost/design-system-styles/core' as post; - -ul.my-list { - @include post.reset-list(); -} diff --git a/packages/documentation/src/stories/foundations/typography/list/list-unstyled.sample.scss b/packages/documentation/src/stories/foundations/typography/list/list-unstyled.sample.scss new file mode 100644 index 0000000000..58dcd275e3 --- /dev/null +++ b/packages/documentation/src/stories/foundations/typography/list/list-unstyled.sample.scss @@ -0,0 +1,13 @@ +@use '@swisspost/design-system-styles/core' as post; + +.my-component { + ul { + @include post.list-unstyled() { + // custom styles for the ul element + } + + > li { + // custom styles for child elements + } + } +} diff --git a/packages/documentation/src/stories/foundations/typography/list/list.docs.mdx b/packages/documentation/src/stories/foundations/typography/list/list.docs.mdx index 23b66f1480..5ca305d9b5 100644 --- a/packages/documentation/src/stories/foundations/typography/list/list.docs.mdx +++ b/packages/documentation/src/stories/foundations/typography/list/list.docs.mdx @@ -1,6 +1,8 @@ import { Meta, Canvas, Source } from '@storybook/blocks'; import * as ListStories from './list.stories'; -import SampleListReset from './list-reset.sample.scss?raw'; +import SampleListBullet from './list-bullet.sample.scss?raw'; +import SampleListInline from './list-inline.sample.scss?raw'; +import SampleListUnstyled from './list-unstyled.sample.scss?raw'; @@ -18,49 +20,62 @@ It is created using a `