diff --git a/components/button/html/_mixin.scss b/components/button/html/_mixin.scss index 0fd84a917d1..09ee4196960 100644 --- a/components/button/html/_mixin.scss +++ b/components/button/html/_mixin.scss @@ -14,6 +14,10 @@ @include utrecht-button--distanced; } + button[hidden] { + display: none; + } + button[type="submit" i], input[type="submit" i] { @include utrecht-button--submit; diff --git a/components/code-block/html/_mixin.scss b/components/code-block/html/_mixin.scss index e81ff7524e3..a80fc38575c 100644 --- a/components/code-block/html/_mixin.scss +++ b/components/code-block/html/_mixin.scss @@ -11,6 +11,10 @@ @include utrecht-code-block; } + pre[hidden]:has(> code:only-child) { + display: none; + } + pre:has(> code:only-child) > code { display: contents; } diff --git a/components/form-fieldset/css/_reset.scss b/components/form-fieldset/css/_reset.scss index 189902d6ad8..fef7ccf07ed 100644 --- a/components/form-fieldset/css/_reset.scss +++ b/components/form-fieldset/css/_reset.scss @@ -4,6 +4,7 @@ */ @mixin reset-fieldset { + /* `all: revert` unfortunately has as side-effect that the `hidde` attribute has no effect */ all: revert; border: 0; margin-inline-end: 0; diff --git a/components/form-fieldset/html/_mixin.scss b/components/form-fieldset/html/_mixin.scss index 74928da2b0b..24e7cbd3df5 100644 --- a/components/form-fieldset/html/_mixin.scss +++ b/components/form-fieldset/html/_mixin.scss @@ -11,6 +11,10 @@ @include utrecht-form-fieldset--html-fieldset; @include utrecht-form-fieldset--distanced; } + + fieldset[hidden] { + display: none; + } } @mixin utrecht-html-legend { @@ -20,6 +24,10 @@ @include utrecht-form-fieldset__legend--distanced; } + legend[hidden] { + display: none; + } + fieldset:disabled > legend { @include utrecht-form-fieldset__legend--disabled; } diff --git a/packages/storybook-html/src/Article.stories.tsx b/packages/storybook-html/src/Article.stories.tsx index b815f8080e2..97b3c14d705 100644 --- a/packages/storybook-html/src/Article.stories.tsx +++ b/packages/storybook-html/src/Article.stories.tsx @@ -4,11 +4,15 @@ import type { Meta, StoryObj } from '@storybook/react'; import readme from '@utrecht/components/article/README.md?raw'; import tokensDefinition from '@utrecht/components/article/tokens.json'; import tokens from '@utrecht/design-tokens/dist/index.json'; -import React from 'react'; +import React, { HTMLAttributes, PropsWithChildren } from 'react'; +import hiddenDocs from './_hidden.md?raw'; import { htmlContentDecorator } from './decorator'; import { designTokenStory } from './design-token-story'; +import { hidden } from './util/htmlArgTypes'; -const Article = ({ children }) =>
{children}
; +const Article = ({ children, ...restProps }: PropsWithChildren>) => ( +
{children}
+); const meta = { title: 'HTML Component/Article', @@ -19,18 +23,11 @@ const meta = { children: { description: 'Content of the article', }, + hidden, }, args: { - children: [ -

Lorem ipsum

, -

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore - magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo - consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla - pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est - laborum. -

, - ], + children: '', + hidden: false, }, tags: ['autodocs'], parameters: { @@ -53,6 +50,18 @@ export default meta; type Story = StoryObj; export const Default: Story = { + args: { + children: [ +

Lorem ipsum

, +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore + magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla + pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est + laborum. +

, + ], + }, parameters: { docs: { description: { @@ -62,4 +71,18 @@ export const Default: Story = { }, }; +export const Hidden: Story = { + args: { + ...Default.args, + hidden: true, + }, + parameters: { + docs: { + description: { + story: hiddenDocs, + }, + }, + }, +}; + export const DesignTokens = designTokenStory(meta); diff --git a/packages/storybook-html/src/Blockquote.stories.tsx b/packages/storybook-html/src/Blockquote.stories.tsx index b85cac33cb6..93cf48c01a6 100644 --- a/packages/storybook-html/src/Blockquote.stories.tsx +++ b/packages/storybook-html/src/Blockquote.stories.tsx @@ -4,11 +4,13 @@ import type { Meta, StoryObj } from '@storybook/react'; import readme from '@utrecht/components/blockquote/README.md?raw'; import tokensDefinition from '@utrecht/components/blockquote/tokens.json'; import tokens from '@utrecht/design-tokens/dist/index.json'; -import React from 'react'; +import React, { HTMLAttributes, PropsWithChildren } from 'react'; +import hiddenDocs from './_hidden.md?raw'; import { htmlContentDecorator } from './decorator'; import { designTokenStory } from './design-token-story'; +import { hidden } from './util/htmlArgTypes'; -const Blockquote = ({ children }) =>
{children}
; +const Blockquote = ({ ...restProps }: PropsWithChildren>) =>
; const meta = { title: 'HTML Component/Blockquote', @@ -19,9 +21,11 @@ const meta = { children: { description: 'Content of the quote', }, + hidden, }, args: { children: [], + hidden: false, }, tags: ['autodocs'], parameters: { @@ -64,4 +68,18 @@ export const Default: Story = { }, }; +export const Hidden: Story = { + args: { + ...Default.args, + hidden: true, + }, + parameters: { + docs: { + description: { + story: hiddenDocs, + }, + }, + }, +}; + export const DesignTokens = designTokenStory(meta); diff --git a/packages/storybook-html/src/Button.stories.tsx b/packages/storybook-html/src/Button.stories.tsx index ecfc4e73ff6..ff220ea1d9d 100644 --- a/packages/storybook-html/src/Button.stories.tsx +++ b/packages/storybook-html/src/Button.stories.tsx @@ -4,12 +4,14 @@ import type { Meta, StoryObj } from '@storybook/react'; import readme from '@utrecht/components/button/README.md?raw'; import tokensDefinition from '@utrecht/components/button/tokens.json'; import tokens from '@utrecht/design-tokens/dist/index.json'; -import React from 'react'; +import React, { HTMLAttributes, PropsWithChildren } from 'react'; import buttonDisabledTabindexMarkdown from './_button-disabled-tabindex.md?raw'; +import hiddenDocs from './_hidden.md?raw'; import { htmlContentDecorator } from './decorator'; import { designTokenStory } from './design-token-story'; +import { hidden } from './util/htmlArgTypes'; -const Button = ({ children, ...attributes }) => ; +const Button = ({ ...attributes }: PropsWithChildren>) =>