@@ -223,9 +217,7 @@ function gridContainer(story: StoryFn, context: StoryContext) {
// RENDERER
function getCardLinks() {
return html`
- ${['Link Text', 'More Link'].map(
- label => html`
`)}
`;
}
@@ -243,7 +235,9 @@ function getCardBody({ customBody, content, action, showTitle, showSubtitle }: A
return html`
${showTitle ? html`
Card Title
` : nothing}
- ${showSubtitle ? html`
Card Subtitle
` : nothing}
+ ${showSubtitle
+ ? html`
Card Subtitle
`
+ : nothing}
${content}
${choose(
action,
@@ -314,7 +308,7 @@ const renderSimpleInteractiveCard = html`
type Story = StoryObj;
const singleCardStory: Story = {
- decorators: [gridContainer],
+ decorators: [gridContainer, clickBlocker],
render: (args: Args) =>
html`${args.action === 'button' ? renderCardWithInteractiveContainer(args) : renderCard(args)}`,
};
@@ -324,7 +318,7 @@ export const Default: Story = {
};
export const Foundation: Story = {
- decorators: [story => html`
${story()}
`],
+ decorators: [story => html`
${story()}
`, clickBlocker],
render: () => html`
Non-interactive card
diff --git a/packages/documentation/src/stories/components/footer/footer.stories.ts b/packages/documentation/src/stories/components/footer/footer.stories.ts
index 320cb2f2ec..195525498f 100644
--- a/packages/documentation/src/stories/components/footer/footer.stories.ts
+++ b/packages/documentation/src/stories/components/footer/footer.stories.ts
@@ -1,6 +1,7 @@
import { Args, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const GRID_CELLS = [1, 2, 3, 4];
const LINKS_PER_CELL = [6, 8, 8, 5];
@@ -10,6 +11,7 @@ const meta: MetaComponent = {
title: 'Components/Footer',
component: 'post-footer',
tags: ['package:WebComponents'],
+ decorators: [clickBlocker],
parameters: {
layout: 'fullscreen',
badges: [],
diff --git a/packages/documentation/src/stories/components/header/header.stories.ts b/packages/documentation/src/stories/components/header/header.stories.ts
index 1b453d7180..21866771fd 100644
--- a/packages/documentation/src/stories/components/header/header.stories.ts
+++ b/packages/documentation/src/stories/components/header/header.stories.ts
@@ -2,6 +2,7 @@ import type { Args, StoryObj } from '@storybook/web-components';
import { MetaComponent } from '@root/types';
import { html } from 'lit';
import { fakeContent } from '@/utils';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '27a2e64d-55ba-492d-ab79-5f7c5e818498',
@@ -247,6 +248,7 @@ export const Default: Story = {
html` `,
+ clickBlocker,
],
};
@@ -255,5 +257,5 @@ export const WithTargetGroup: Story = {
targetGroup: true,
},
...Template,
- decorators: [story => html`
${story()}
`],
+ decorators: [story => html`
${story()}
`, clickBlocker],
};
diff --git a/packages/documentation/src/stories/components/linkarea/linkarea.stories.ts b/packages/documentation/src/stories/components/linkarea/linkarea.stories.ts
index a7552188c7..972d5843a9 100644
--- a/packages/documentation/src/stories/components/linkarea/linkarea.stories.ts
+++ b/packages/documentation/src/stories/components/linkarea/linkarea.stories.ts
@@ -1,6 +1,7 @@
import type { Args, StoryObj } from '@storybook/web-components';
import { html, nothing } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
export interface PostLinkarea {
dataLink?: boolean;
@@ -14,6 +15,7 @@ const meta: MetaComponent
= {
tags: ['package:WebComponents'],
render: renderLinkarea,
component: 'post-linkarea',
+ decorators: [clickBlocker],
parameters: {
design: {},
},
diff --git a/packages/documentation/src/stories/components/list-group/list-group.stories.ts b/packages/documentation/src/stories/components/list-group/list-group.stories.ts
index 3e8bf5ab93..3cd10ccf7d 100644
--- a/packages/documentation/src/stories/components/list-group/list-group.stories.ts
+++ b/packages/documentation/src/stories/components/list-group/list-group.stories.ts
@@ -1,13 +1,14 @@
import type { Args, StoryContext, StoryFn, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '5a47ba70-7831-4e59-b83e-81b6e6c32372',
title: 'Components/List Group',
tags: ['package:HTML'],
render: renderListGroup,
- decorators: [gridDecorator],
+ decorators: [gridDecorator, clickBlocker],
parameters: {
design: {
type: 'figma',
diff --git a/packages/documentation/src/stories/components/popover/popover.stories.ts b/packages/documentation/src/stories/components/popover/popover.stories.ts
index 423cd3f824..24db6a17c4 100644
--- a/packages/documentation/src/stories/components/popover/popover.stories.ts
+++ b/packages/documentation/src/stories/components/popover/popover.stories.ts
@@ -2,6 +2,7 @@ import { Args, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '9a636763-de2d-4f72-bc81-98daf10871f7',
@@ -53,7 +54,7 @@ const meta: MetaComponent = {
'Value can either be in `vw`, `px` or `%`. If no max-width is defined, the popover will extend to the width of its content.',
table: {
category: 'General',
- defaultValue: { summary: '280px' }
+ defaultValue: { summary: '280px' },
},
},
palette: {
@@ -91,6 +92,7 @@ const meta: MetaComponent = {
name: 'Placement',
},
},
+ decorators: [clickBlocker],
};
function render(args: Args) {
diff --git a/packages/documentation/src/stories/components/skiplinks/skiplinks.stories.ts b/packages/documentation/src/stories/components/skiplinks/skiplinks.stories.ts
index aa14b2b864..11843d08f6 100644
--- a/packages/documentation/src/stories/components/skiplinks/skiplinks.stories.ts
+++ b/packages/documentation/src/stories/components/skiplinks/skiplinks.stories.ts
@@ -1,11 +1,13 @@
import type { StoryObj } from '@storybook/web-components';
import { html } from 'lit/static-html.js';
import { MetaExtended } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaExtended = {
id: '2fc3b456-19ba-4ede-b1bc-499518f829b1',
title: 'Components/Skiplinks',
tags: ['package:HTML'],
+ decorators: [clickBlocker],
render: renderSkiplinks,
};
diff --git a/packages/documentation/src/stories/components/subnavigation/subnavigation.stories.ts b/packages/documentation/src/stories/components/subnavigation/subnavigation.stories.ts
index 8229f2ae73..d7d06f0d50 100644
--- a/packages/documentation/src/stories/components/subnavigation/subnavigation.stories.ts
+++ b/packages/documentation/src/stories/components/subnavigation/subnavigation.stories.ts
@@ -1,6 +1,7 @@
-import { Args, StoryContext, StoryFn, StoryObj } from '@storybook/web-components';
+import { Args, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '87ceabbb-f552-46eb-8a47-4d84e7f8cef0',
@@ -54,13 +55,6 @@ const meta: MetaComponent = {
export default meta;
-// DECORATOR
-function clickBlocker(story: StoryFn, context: StoryContext) {
- return html`
- e.preventDefault()}>${story(context.args, context)}
- `;
-}
-
function renderTest(args: Args) {
return html`
diff --git a/packages/documentation/src/stories/components/teaser/teaser.stories.ts b/packages/documentation/src/stories/components/teaser/teaser.stories.ts
index 97748f59ef..b3d91bfb67 100644
--- a/packages/documentation/src/stories/components/teaser/teaser.stories.ts
+++ b/packages/documentation/src/stories/components/teaser/teaser.stories.ts
@@ -1,10 +1,12 @@
import { Args, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '68699b2c-ec1f-467d-81ae-8b3f48d7c595',
title: 'Components/Card Teaser',
+ decorators: [clickBlocker],
tags: ['package:HTML'],
parameters: {
design: {
@@ -93,9 +95,7 @@ export function renderTeaserSectionHeader(size?: string) {
return html`
Teaser section ${size}
-
- This is a sample description for the teaser section component.
-
+
This is a sample description for the teaser section component.
Let's go html`${story()}
`],
+ decorators: [story => html`${story()}
`, clickBlocker],
};
export const Section: Story = {
diff --git a/packages/documentation/src/stories/foundations/logo/logo.stories.ts b/packages/documentation/src/stories/foundations/logo/logo.stories.ts
index d22154f419..95de5fcd55 100644
--- a/packages/documentation/src/stories/foundations/logo/logo.stories.ts
+++ b/packages/documentation/src/stories/foundations/logo/logo.stories.ts
@@ -1,6 +1,7 @@
import { StoryContext, StoryFn, StoryObj } from '@storybook/web-components';
import { html, nothing } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '73066e1c-0720-4a9b-8f81-a29d4250872a',
@@ -56,7 +57,7 @@ export const Link: Story = {
url: 'https://www.post.ch/en',
},
render: renderLogo('the homepage'),
- decorators: [containerWithHeight],
+ decorators: [containerWithHeight, clickBlocker],
};
export const Height: Story = {
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 96fcb2f2de..97d4029a8f 100644
--- a/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts
+++ b/packages/documentation/src/stories/raw-components/breadcrumbs/breadcrumbs.stories.ts
@@ -4,6 +4,7 @@ import { spread } from '@open-wc/lit-helpers';
import { getAttributes } from '@/utils';
import customItems from './custom-items';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '4347e5bf-8bf2-4f44-9075-9faaa53591ed',
@@ -11,7 +12,7 @@ const meta: MetaComponent = {
component: 'swisspost-internet-breadcrumbs',
tags: ['package:InternetHeader'],
render: renderInternetBreadcrumbs,
- decorators: [hiddenHeader],
+ decorators: [hiddenHeader, clickBlocker],
parameters: {
badges: [],
design: {
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 85fd8c1677..0e48e80bbf 100644
--- a/packages/documentation/src/stories/raw-components/footer/footer.stories.ts
+++ b/packages/documentation/src/stories/raw-components/footer/footer.stories.ts
@@ -3,6 +3,7 @@ import { html } from 'lit';
import customFooterConfig from './custom-footer-config';
import { spread } from '@open-wc/lit-helpers';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '27fc009d-3eec-43a9-b3a2-55531e721817',
@@ -10,7 +11,7 @@ const meta: MetaComponent = {
component: 'swisspost-internet-footer',
tags: ['package:InternetHeader'],
render: renderInternetFooter,
- decorators: [hiddenHeader],
+ decorators: [hiddenHeader, clickBlocker],
parameters: {
layout: 'fullscreen',
badges: [],
diff --git a/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts b/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts
index 6d0160d865..1b005f84b0 100644
--- a/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts
+++ b/packages/documentation/src/stories/raw-components/internet-header/header.stories.ts
@@ -5,6 +5,7 @@ import customConfig from './config/custom-config';
import osFlyoutOverrides from './config/os-flyout-overrides';
import languageSwitchOverrides from './config/language-switch-overrides';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: 'ebb11274-091b-4cb7-9a3f-3e0451c9a865',
@@ -158,15 +159,15 @@ const meta: MetaComponent = {
},
},
decorators: [
- story =>
- html`
-
- `,
+ story => html`
+
+ `,
+ clickBlocker,
],
};
diff --git a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts
index bfbfbbb9e5..135062ddef 100644
--- a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts
+++ b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts
@@ -2,6 +2,7 @@ import type { StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaComponent } from '@root/types';
import { StoryContext, StoryFn } from '@storybook/web-components';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '212efc4e-875b-4497-912d-d28c6baf32f5',
@@ -124,7 +125,7 @@ function render() {
type Story = StoryObj;
export const Default: Story = {
- decorators: [megadropdownDecorator],
+ decorators: [megadropdownDecorator, clickBlocker],
};
// No decorators on the test page
diff --git a/packages/documentation/src/stories/raw-components/menu-button/menu-button.stories.ts b/packages/documentation/src/stories/raw-components/menu-button/menu-button.stories.ts
index b8c66d6fd0..e300af32e3 100644
--- a/packages/documentation/src/stories/raw-components/menu-button/menu-button.stories.ts
+++ b/packages/documentation/src/stories/raw-components/menu-button/menu-button.stories.ts
@@ -1,12 +1,14 @@
import { Args, StoryObj } from '@storybook/web-components';
import { html, nothing } from 'lit';
import { MetaComponent } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaComponent = {
id: '8ca2bd70-56e6-4da9-b1fd-4e55388dca88',
title: 'Raw Components/Menu Button',
tags: ['package:WebComponents'],
component: 'post-menu',
+ decorators: [clickBlocker],
parameters: {
design: {},
},
diff --git a/packages/documentation/src/stories/templates/error-page/error-page.stories.ts b/packages/documentation/src/stories/templates/error-page/error-page.stories.ts
index f3439b36a1..f149935e5e 100644
--- a/packages/documentation/src/stories/templates/error-page/error-page.stories.ts
+++ b/packages/documentation/src/stories/templates/error-page/error-page.stories.ts
@@ -1,9 +1,11 @@
+import { clickBlocker } from '@/shared/click-blocker';
import { Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';
const meta: Meta = {
id: 'a536a61d-cac2-4f39-adbf-092bdd445ce5',
title: 'Templates/Error page',
+ decorators: [clickBlocker],
parameters: {
layout: 'fullscreen',
},
@@ -28,14 +30,8 @@ function render() {
page.
diff --git a/packages/documentation/src/stories/utilities/text/text.stories.ts b/packages/documentation/src/stories/utilities/text/text.stories.ts
index e6f2353f88..0f5f3c4fa9 100644
--- a/packages/documentation/src/stories/utilities/text/text.stories.ts
+++ b/packages/documentation/src/stories/utilities/text/text.stories.ts
@@ -1,6 +1,7 @@
import type { StoryObj } from '@storybook/web-components';
import { html } from 'lit';
import { MetaExtended } from '@root/types';
+import { clickBlocker } from '@/shared/click-blocker';
const meta: MetaExtended = {
id: 'c55681df-4d21-469d-a5b3-c67686e7c104',
@@ -52,7 +53,7 @@ export const LineHeight: Story = {
};
export const TextColorReset: Story = {
- decorators: [story => html` e.preventDefault()}>${story()}
`],
+ decorators: [clickBlocker],
render: () => html`
This is a colored text with a