From a3ce33d0b72020afd8258d37d71f0d007adc6c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sch=C3=BCrch?= Date: Fri, 13 Dec 2024 14:57:54 +0100 Subject: [PATCH 01/30] fix(documentation): move internet-header, footer and breadcrumbs to raw-components and new header to modules (#4258) --- packages/documentation/.storybook/manager.ts | 1 + .../{header => }/language-switch/language-switch.docs.mdx | 0 .../language-switch/language-switch.snapshot.stories.ts | 0 .../{header => }/language-switch/language-switch.stories.ts | 2 +- .../header/components/header.markup.ts | 0 .../stories/{raw-components => modules}/header/header.docs.mdx | 0 .../{raw-components => modules}/header/header.stories.ts | 2 +- .../stories/raw-components/breadcrumbs/breadcrumbs.stories.ts | 2 +- .../src/stories/raw-components/footer/footer.stories.ts | 2 +- .../internet-header/config/custom-config.ts | 0 .../internet-header/config/language-switch-overrides.ts | 0 .../internet-header/config/os-flyout-overrides.ts | 0 .../internet-header/header.docs.mdx | 0 .../{components => raw-components}/internet-header/header.scss | 0 .../internet-header/header.stories.ts | 2 +- 15 files changed, 6 insertions(+), 5 deletions(-) rename packages/documentation/src/stories/components/{header => }/language-switch/language-switch.docs.mdx (100%) rename packages/documentation/src/stories/components/{header => }/language-switch/language-switch.snapshot.stories.ts (100%) rename packages/documentation/src/stories/components/{header => }/language-switch/language-switch.stories.ts (98%) rename packages/documentation/src/stories/{raw-components => modules}/header/components/header.markup.ts (100%) rename packages/documentation/src/stories/{raw-components => modules}/header/header.docs.mdx (100%) rename packages/documentation/src/stories/{raw-components => modules}/header/header.stories.ts (94%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/config/custom-config.ts (100%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/config/language-switch-overrides.ts (100%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/config/os-flyout-overrides.ts (100%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/header.docs.mdx (100%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/header.scss (100%) rename packages/documentation/src/stories/{components => raw-components}/internet-header/header.stories.ts (99%) diff --git a/packages/documentation/.storybook/manager.ts b/packages/documentation/.storybook/manager.ts index c52ce3e90d..ec30bb63de 100644 --- a/packages/documentation/.storybook/manager.ts +++ b/packages/documentation/.storybook/manager.ts @@ -17,6 +17,7 @@ addons.setConfig({ 'layout', 'raw-components', 'components', + 'modules', 'utilities', 'templates', 'guidelines', diff --git a/packages/documentation/src/stories/components/header/language-switch/language-switch.docs.mdx b/packages/documentation/src/stories/components/language-switch/language-switch.docs.mdx similarity index 100% rename from packages/documentation/src/stories/components/header/language-switch/language-switch.docs.mdx rename to packages/documentation/src/stories/components/language-switch/language-switch.docs.mdx diff --git a/packages/documentation/src/stories/components/header/language-switch/language-switch.snapshot.stories.ts b/packages/documentation/src/stories/components/language-switch/language-switch.snapshot.stories.ts similarity index 100% rename from packages/documentation/src/stories/components/header/language-switch/language-switch.snapshot.stories.ts rename to packages/documentation/src/stories/components/language-switch/language-switch.snapshot.stories.ts diff --git a/packages/documentation/src/stories/components/header/language-switch/language-switch.stories.ts b/packages/documentation/src/stories/components/language-switch/language-switch.stories.ts similarity index 98% rename from packages/documentation/src/stories/components/header/language-switch/language-switch.stories.ts rename to packages/documentation/src/stories/components/language-switch/language-switch.stories.ts index 013f6d01d9..e3cb30133e 100644 --- a/packages/documentation/src/stories/components/header/language-switch/language-switch.stories.ts +++ b/packages/documentation/src/stories/components/language-switch/language-switch.stories.ts @@ -4,7 +4,7 @@ import { MetaComponent } from '@root/types'; const meta: MetaComponent = { id: 'decbb10c-2b39-4f47-b67d-337d8111a3ae', - title: 'Components/Header/Language Switch', + title: 'Components/Language Switch', tags: ['package:WebComponents'], component: 'post-language-switch', render: renderLanguageSwitch, diff --git a/packages/documentation/src/stories/raw-components/header/components/header.markup.ts b/packages/documentation/src/stories/modules/header/components/header.markup.ts similarity index 100% rename from packages/documentation/src/stories/raw-components/header/components/header.markup.ts rename to packages/documentation/src/stories/modules/header/components/header.markup.ts diff --git a/packages/documentation/src/stories/raw-components/header/header.docs.mdx b/packages/documentation/src/stories/modules/header/header.docs.mdx similarity index 100% rename from packages/documentation/src/stories/raw-components/header/header.docs.mdx rename to packages/documentation/src/stories/modules/header/header.docs.mdx diff --git a/packages/documentation/src/stories/raw-components/header/header.stories.ts b/packages/documentation/src/stories/modules/header/header.stories.ts similarity index 94% rename from packages/documentation/src/stories/raw-components/header/header.stories.ts rename to packages/documentation/src/stories/modules/header/header.stories.ts index 21c5eb7178..06546b6b31 100644 --- a/packages/documentation/src/stories/raw-components/header/header.stories.ts +++ b/packages/documentation/src/stories/modules/header/header.stories.ts @@ -4,7 +4,7 @@ import HeaderMarkup from './components/header.markup'; const meta: MetaComponent = { id: 'header', - title: 'Raw Components/Header', + title: 'Modules/Header', tags: ['package:HTML'], parameters: { layout: 'fullscreen', diff --git a/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts b/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts index 24c46fb995..96fcb2f2de 100644 --- a/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts +++ b/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts @@ -7,7 +7,7 @@ import { MetaComponent } from '@root/types'; const meta: MetaComponent = { id: '4347e5bf-8bf2-4f44-9075-9faaa53591ed', - title: 'Raw Components/Breadcrumbs', + title: 'Raw Components/Internet Header/Breadcrumbs', component: 'swisspost-internet-breadcrumbs', tags: ['package:InternetHeader'], render: renderInternetBreadcrumbs, diff --git a/packages/documentation/src/stories/raw-components/footer/footer.stories.ts b/packages/documentation/src/stories/raw-components/footer/footer.stories.ts index 86fbed7f1d..85fd8c1677 100644 --- a/packages/documentation/src/stories/raw-components/footer/footer.stories.ts +++ b/packages/documentation/src/stories/raw-components/footer/footer.stories.ts @@ -6,7 +6,7 @@ import { MetaComponent } from '@root/types'; const meta: MetaComponent = { id: '27fc009d-3eec-43a9-b3a2-55531e721817', - title: 'Raw Components/Footer', + title: 'Raw Components/Internet Header/Footer', component: 'swisspost-internet-footer', tags: ['package:InternetHeader'], render: renderInternetFooter, diff --git a/packages/documentation/src/stories/components/internet-header/config/custom-config.ts b/packages/documentation/src/stories/raw-components/internet-header/config/custom-config.ts similarity index 100% rename from packages/documentation/src/stories/components/internet-header/config/custom-config.ts rename to packages/documentation/src/stories/raw-components/internet-header/config/custom-config.ts diff --git a/packages/documentation/src/stories/components/internet-header/config/language-switch-overrides.ts b/packages/documentation/src/stories/raw-components/internet-header/config/language-switch-overrides.ts similarity index 100% rename from packages/documentation/src/stories/components/internet-header/config/language-switch-overrides.ts rename to packages/documentation/src/stories/raw-components/internet-header/config/language-switch-overrides.ts diff --git a/packages/documentation/src/stories/components/internet-header/config/os-flyout-overrides.ts b/packages/documentation/src/stories/raw-components/internet-header/config/os-flyout-overrides.ts similarity index 100% rename from packages/documentation/src/stories/components/internet-header/config/os-flyout-overrides.ts rename to packages/documentation/src/stories/raw-components/internet-header/config/os-flyout-overrides.ts diff --git a/packages/documentation/src/stories/components/internet-header/header.docs.mdx b/packages/documentation/src/stories/raw-components/internet-header/header.docs.mdx similarity index 100% rename from packages/documentation/src/stories/components/internet-header/header.docs.mdx rename to packages/documentation/src/stories/raw-components/internet-header/header.docs.mdx diff --git a/packages/documentation/src/stories/components/internet-header/header.scss b/packages/documentation/src/stories/raw-components/internet-header/header.scss similarity index 100% rename from packages/documentation/src/stories/components/internet-header/header.scss rename to packages/documentation/src/stories/raw-components/internet-header/header.scss diff --git a/packages/documentation/src/stories/components/internet-header/header.stories.ts b/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts similarity index 99% rename from packages/documentation/src/stories/components/internet-header/header.stories.ts rename to packages/documentation/src/stories/raw-components/internet-header/header.stories.ts index d6ccd59d79..a0200a7ae3 100644 --- a/packages/documentation/src/stories/components/internet-header/header.stories.ts +++ b/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts @@ -8,7 +8,7 @@ import { MetaComponent } from '@root/types'; const meta: MetaComponent = { id: 'ebb11274-091b-4cb7-9a3f-3e0451c9a865', - title: 'Components/Internet Header', + title: 'Raw Components/Internet Header', tags: ['package:InternetHeader'], component: 'swisspost-internet-header', parameters: { From fe50ee2a241a8f466779e210815c7f5016fd5dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sch=C3=BCrch?= Date: Fri, 13 Dec 2024 15:24:03 +0100 Subject: [PATCH 02/30] chore(components): update generated post-icon readme (#4259) --- packages/components/src/components/post-icon/readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/components/src/components/post-icon/readme.md b/packages/components/src/components/post-icon/readme.md index 9160671c20..8643e53c7d 100644 --- a/packages/components/src/components/post-icon/readme.md +++ b/packages/components/src/components/post-icon/readme.md @@ -27,7 +27,6 @@ some content - [post-banner](../post-banner) - [post-breadcrumb](../post-breadcrumb) - [post-breadcrumb-item](../post-breadcrumb-item) - - [post-breadcrumb-item](../post-breadcrumb-item) - [post-card-control](../post-card-control) - [post-closebutton](../post-closebutton) - [post-language-switch](../post-language-switch) @@ -42,7 +41,6 @@ graph TD; post-banner --> post-icon post-breadcrumb --> post-icon post-breadcrumb-item --> post-icon - post-breadcrumb-item --> post-icon post-card-control --> post-icon post-closebutton --> post-icon post-language-switch --> post-icon From d7e11728f4b352f37d44f785f07a4c593e083bfc Mon Sep 17 00:00:00 2001 From: Myrta Sakellariou <66249294+myrta2302@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:45:24 +0200 Subject: [PATCH 03/30] feat(styles): updated sizing utility (no tokens) (#4012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alizé Debray <33580481+alizedebray@users.noreply.github.com> Co-authored-by: Oliver Schürch --- .changeset/soft-pugs-dream.md | 6 + .changeset/violet-poems-attend.md | 6 + .../snapshots/utilities/sizing.snapshot.ts | 22 +++ .../select-custom-basic.sample.html | 2 +- .../select-custom-floating.sample.html | 2 +- .../components/slider/slider.stories.ts | 2 +- .../foundations/logo/logo.snapshot.stories.ts | 2 +- .../stories/foundations/logo/logo.stories.ts | 4 +- .../stories/utilities/sizing/sizing.docs.mdx | 61 +++---- .../utilities/sizing/sizing.module.scss | 18 +- .../sizing/sizing.snapshot.stories.ts | 139 ++++++++++++++++ .../utilities/sizing/sizing.stories.ts | 156 ++++++++++-------- .../utilities/sizing/sizing.styles.scss | 30 +++- .../utilities/spacing/spacing.stories.ts | 2 +- packages/documentation/src/utils/naming.ts | 3 + packages/migrations/src/utils/constants.ts | 1 + packages/styles/src/components/sizing.scss | 21 +-- .../src/themes/bootstrap/_utilities.scss | 13 ++ packages/styles/src/utilities/_variables.scss | 121 ++++++++++++++ packages/styles/src/variables/_index.scss | 1 + packages/styles/src/variables/_sizing.scss | 69 ++++++++ packages/styles/src/variables/_spacing.scss | 13 -- 22 files changed, 548 insertions(+), 146 deletions(-) create mode 100644 .changeset/soft-pugs-dream.md create mode 100644 .changeset/violet-poems-attend.md create mode 100644 packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts create mode 100644 packages/documentation/src/stories/utilities/sizing/sizing.snapshot.stories.ts create mode 100644 packages/documentation/src/utils/naming.ts create mode 100644 packages/styles/src/variables/_sizing.scss diff --git a/.changeset/soft-pugs-dream.md b/.changeset/soft-pugs-dream.md new file mode 100644 index 0000000000..10b4189721 --- /dev/null +++ b/.changeset/soft-pugs-dream.md @@ -0,0 +1,6 @@ +--- +'@swisspost/design-system-documentation': minor +'@swisspost/design-system-styles': minor +--- + +Updated the utility classes for sizing. diff --git a/.changeset/violet-poems-attend.md b/.changeset/violet-poems-attend.md new file mode 100644 index 0000000000..cfec36d36d --- /dev/null +++ b/.changeset/violet-poems-attend.md @@ -0,0 +1,6 @@ +--- +'@swisspost/design-system-documentation': minor +'@swisspost/design-system-styles': minor +--- + +Implemented new pixel based sizes. diff --git a/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts b/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts new file mode 100644 index 0000000000..e539797cc7 --- /dev/null +++ b/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts @@ -0,0 +1,22 @@ +describe('Sizing', () => { + // Parent based sizing classes [e.g. .quarter, .third, .half, etc.] + it('Sizing Percentages', () => { + cy.visit('/iframe.html?id=snapshots--percentage-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); + + // Percentage sizing classes relative to viewport [e.g. vh-25, vw-33, min-vh-50, max-vw-100, etc.] + it('Sizing Viewport Percentages', () => { + cy.visit('/iframe.html?id=snapshots--percentage-vp-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); + + // Pixel based sizing classes [e.g. h-80, w-56, max-w-24, min-h-24, etc.] + it('Sizing Pixel Based', () => { + cy.visit('/iframe.html?id=snapshots--pixel-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); +}); diff --git a/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html b/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html index eb42edb536..0a98a341b4 100644 --- a/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html +++ b/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html @@ -12,7 +12,7 @@ Default custom-select -
+
@@ -237,7 +237,7 @@ export const Multipart: Story = {
-
+

Schneller

@@ -257,7 +257,7 @@ export const Multipart: Story = {
-
+
Sample Product

140 x 90 mm bis B5 (250 x 176 mm)

@@ -272,7 +272,7 @@ export const Multipart: Story = {
-
+
Sample Product

140 x 90 mm bis B5 (250 x 176 mm)

@@ -295,7 +295,7 @@ export const Multipart: Story = {
-
+
Sample Product

140 x 90 mm bis B5 (250 x 176 mm)

@@ -310,7 +310,7 @@ export const Multipart: Story = {
-
+
diff --git a/packages/documentation/src/stories/components/dialog/dialog.snapshot.stories.ts b/packages/documentation/src/stories/components/dialog/dialog.snapshot.stories.ts index 5f05c52cfe..b74488df7d 100644 --- a/packages/documentation/src/stories/components/dialog/dialog.snapshot.stories.ts +++ b/packages/documentation/src/stories/components/dialog/dialog.snapshot.stories.ts @@ -26,7 +26,7 @@ export const Dialog: Story = {
${bombArgs({ - backgroundColor: ['bg-white', 'bg-primary'], + palette: ['palette-default', 'palette-accent', 'palette-alternate', 'palette-brand'], size: context.argTypes.size.options, icon: ['none', '1034'], closeButton: [true, false], diff --git a/packages/documentation/src/stories/components/dialog/dialog.stories.ts b/packages/documentation/src/stories/components/dialog/dialog.stories.ts index 8f21a73884..6ef2fde293 100644 --- a/packages/documentation/src/stories/components/dialog/dialog.stories.ts +++ b/packages/documentation/src/stories/components/dialog/dialog.stories.ts @@ -16,7 +16,7 @@ const meta: Meta = { size: 'medium', position: 'center', icon: 'none', - backgroundColor: 'bg-white', + palette: 'palette-default', animation: 'pop-in', closeButton: true, open: false, @@ -75,13 +75,13 @@ const meta: Meta = { options: ['none', '1034', '2105', '2104', '2106'], table: { category: 'Content' }, }, - backgroundColor: { - name: 'Background color', - description: 'The background color of the dialog field', + palette: { + name: 'Palette', + description: 'The color scheme of the dialog', control: { type: 'select', }, - options: ['bg-white', 'bg-light', 'bg-primary'], + options: ['palette-default', 'palette-accent', 'palette-alternate', 'palette-brand'], table: { category: 'Variant' }, }, closeButton: { @@ -140,14 +140,13 @@ const Template = { const postDialogCloseButton = args.closeButton ? getCloseButton() : nothing; // Don't declare default values or show empty containers - if (args.backgroundColor === 'bg-white') args.backgroundColor = nothing; if (args.animation === 'pop-in') args.animation = nothing; if (args.position === 'center') args.position = nothing; if (args.size === 'medium') args.size = nothing; return html` { - return html` -
- ${['bg-white', 'bg-dark'].map( - bg => html` -
- ${renderHint({ ..._args }, context, 'example-input-' + bg)} -
- `, - )} -
- `; + return schemes(() => html` ${renderHint({ ..._args }, context)} `); }, }; diff --git a/packages/documentation/src/stories/components/intranet-header/intranet-header-postweb.sample.html b/packages/documentation/src/stories/components/intranet-header/intranet-header-postweb.sample.html index f2dcc8671c..b344c1d2ab 100644 --- a/packages/documentation/src/stories/components/intranet-header/intranet-header-postweb.sample.html +++ b/packages/documentation/src/stories/components/intranet-header/intranet-header-postweb.sample.html @@ -10,10 +10,10 @@