diff --git a/packages/storybook/config/preview.tsx b/packages/storybook/config/preview.tsx index d0274a49..5de14e7b 100644 --- a/packages/storybook/config/preview.tsx +++ b/packages/storybook/config/preview.tsx @@ -11,7 +11,12 @@ defineCustomElements(); const preview: Preview = { parameters: { controls: { expanded: false }, - options: { panelPosition: 'right' }, + options: { + panelPosition: 'right', + storySort: { + order: ['Tilburg', 'CSS Component'], + }, + }, docs: { page: () => { // Exclude `` because the title comes from the Markdown file diff --git a/packages/storybook/src/css-breadcrumb-nav.stories.tsx b/packages/storybook/src/css-breadcrumb-nav.stories.tsx new file mode 100644 index 00000000..2485fd47 --- /dev/null +++ b/packages/storybook/src/css-breadcrumb-nav.stories.tsx @@ -0,0 +1,86 @@ +/* @license CC0-1.0 */ + +import type { Meta, StoryObj } from '@storybook/react'; +import { + BreadcrumbNav, + BreadcrumbNavLink, + BreadcrumbNavSeparator, +} from '@utrecht/component-library-react/dist/css-module'; +import readme from './documentation/breadcrumb-nav.md?raw'; + +const meta = { + title: 'CSS Component/Breadcrumb navigation', + id: 'css-utrecht-breadcrumb-nav', + component: BreadcrumbNav, + argTypes: { + children: { + name: 'Content', + type: { + name: 'string', + required: true, + }, + defaultValue: '', + }, + }, + args: { + children: '', + }, + tags: ['autodocs'], + parameters: { + bugs: 'https://github.com/nl-design-system/rotterdam/labels/component%2Fbreadcrumb-nav', + design: { + type: 'figma', + url: 'https://www.figma.com/file/ZWSC4gCrOXRUR9UX3aoZ8x/?node-id=501-18760', + }, + docs: { + description: { + component: readme, + }, + }, + }, +} satisfies Meta<typeof BreadcrumbNav>; + +export default meta; + +type Story = StoryObj<typeof meta>; + +export const Default: Story = { + name: 'Breadcrumb navigation', + args: { + children: [ + <BreadcrumbNavLink href="/" rel="home" index={0}> + Home + </BreadcrumbNavLink>, + <BreadcrumbNavSeparator> + <svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em"> + <path + fill-rule="evenodd" + d="M20.607 16 10 5.393l1.414-1.414L23.435 16l-12.02 12.02L10 26.608z" + clip-rule="evenodd" + ></path> + </svg> + </BreadcrumbNavSeparator>, + <BreadcrumbNavLink href="/a/" index={1}> + Parkeren in Tilburg + </BreadcrumbNavLink>, + <BreadcrumbNavSeparator> + <svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em"> + <path + fill-rule="evenodd" + d="M20.607 16 10 5.393l1.414-1.414L23.435 16l-12.02 12.02L10 26.608z" + clip-rule="evenodd" + ></path> + </svg> + </BreadcrumbNavSeparator>, + <BreadcrumbNavLink href="/a/b/" rel="up" index={2} disabled current> + Product aanvragen + </BreadcrumbNavLink>, + ], + }, + parameters: { + design: { + type: 'figma', + url: 'https://www.figma.com/file/ZWSC4gCrOXRUR9UX3aoZ8x/Gemeente-Rotterdam-Design-System?type=design&node-id=507-20062&mode=design&t=yvzUSkFQYQmWSHsQ-4', + }, + }, +}; diff --git a/packages/storybook/src/css-utrecht-accordion.stories.tsx b/packages/storybook/src/css-utrecht-accordion.stories.tsx new file mode 100644 index 00000000..2aff0d58 --- /dev/null +++ b/packages/storybook/src/css-utrecht-accordion.stories.tsx @@ -0,0 +1,121 @@ +/* @license CC0-1.0 */ + +import type { Meta, StoryObj } from '@storybook/react'; +import { AccordionProvider } from '@utrecht/component-library-react/dist/css-module'; +import { ReactNode } from 'react'; +import readme from './documentation/accordion.md?raw'; + +interface AccordionStoryProps { + label: string; + body: ReactNode; + expanded?: boolean; + expandedAccordion?: boolean; +} + +const AccordionStory = ({ expanded, label, body }: AccordionStoryProps) => ( + <AccordionProvider sections={[{ expanded, label, body }]} /> +); + +const meta = { + title: 'CSS Component/Accordion', + id: 'css-utrecht-accordion', + component: AccordionProvider, + args: { + // @ts-ignore + label: '', + body: '', + expandedAccordion: false, + }, + argTypes: { + // @ts-ignore + label: { + name: 'label', + type: { name: 'string', required: true }, + table: { + defaultValue: { summary: '' }, + category: 'API', + }, + }, + body: { + name: 'body', + type: { name: 'string', required: true }, + table: { + defaultValue: { summary: '' }, + category: 'API', + }, + }, + expandedAccordion: { + name: 'expandedAccordion', + type: { name: 'boolean', required: false }, + table: { + defaultValue: { summary: false }, + category: 'API', + }, + }, + }, + tags: ['autodocs'], + parameters: { + design: { + type: 'figma', + url: 'https://www.figma.com/design/ck81CE8SNzePi30jCEu7MK/NLDS---Gemeente-Tilburg---Bibliotheek?node-id=1261%3A4784&t=lu24fBlSHdl7JcKT-1', + }, + docs: { + description: { + component: readme, + }, + }, + }, + // @ts-ignore + render: AccordionStory, +} satisfies Meta<typeof AccordionProvider>; +export default meta; + +type Story = StoryObj<typeof meta>; + +export const Default: Story = { + // @ts-ignore + args: { + label: 'Lorem ipsum', + body: `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.`, + expandedAccordion: true, + }, +}; + +const accordionData = [ + { + label: 'Lorem ipsum 1', + body: `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.`, + expandedAccordion: true, + }, + { + label: 'Lorem ipsum 2', + body: `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.`, + expandedAccordion: false, + }, + { + label: 'Lorem ipsum 3', + body: `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.`, + expandedAccordion: false, + }, +]; + +// @ts-ignore +export const Multiple: Story = { + render: () => <AccordionProvider sections={accordionData} />, +}; diff --git a/packages/storybook/src/documentation/accordion.md b/packages/storybook/src/documentation/accordion.md new file mode 100644 index 00000000..8d96d82e --- /dev/null +++ b/packages/storybook/src/documentation/accordion.md @@ -0,0 +1,3 @@ +# Accordion + +The accordion component is a container that can be collapsed and expanded. It is used to hide and show content. diff --git a/packages/storybook/src/documentation/breadcrumb-nav.md b/packages/storybook/src/documentation/breadcrumb-nav.md new file mode 100644 index 00000000..92f60c5d --- /dev/null +++ b/packages/storybook/src/documentation/breadcrumb-nav.md @@ -0,0 +1,3 @@ +# Breadcrumb navigation + +The breadcrumb nav component is used to show the user's current location within a website or application. It is a secondary navigation scheme that allows the user to see where the current page is in relation to the hierarchy of the website or application. diff --git a/packages/storybook/src/react-button.stories.tsx b/packages/storybook/src/react-button.stories.tsx deleted file mode 100644 index 9f16151e..00000000 --- a/packages/storybook/src/react-button.stories.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Meta, StoryObj } from '@storybook/react'; -import { Button } from '../../components-react/src/Button'; - -const meta = { - title: 'React Component/Button', - id: 'react-button', - component: Button, - args: { - children: 'Read more...', - }, - argTypes: { - type: { - control: { type: 'select' }, - options: [undefined, 'button', 'submit', 'reset'], - }, - }, -} satisfies Meta<typeof Button>; - -export default meta; - -type Story = StoryObj<typeof meta>; - -export const Default: Story = {}; diff --git a/packages/storybook/src/web-component-button.stories.tsx b/packages/storybook/src/web-component-button.stories.tsx deleted file mode 100644 index ff8cb320..00000000 --- a/packages/storybook/src/web-component-button.stories.tsx +++ /dev/null @@ -1,44 +0,0 @@ -/* @license CC0-1.0 */ - -import type { Meta, StoryObj } from '@storybook/react'; -import readme from '@tilburg/components-css/button/README.md?raw'; -import { TilburgButton } from '@tilburg/web-components-react/src'; -import { PropsWithChildren } from 'react'; - -const Button = ({ children }: PropsWithChildren<{}>) => <TilburgButton>{children}</TilburgButton>; - -const meta = { - title: 'Web Component/Button', - id: 'web-component-button', - component: Button, - argTypes: { - children: { - name: 'Content', - description: 'Button text', - type: { - name: 'string', - required: true, - }, - defaultValue: '', - }, - }, - args: { - children: 'Opslaan en verder', - }, - tags: ['autodocs'], - parameters: { - docs: { - description: { - component: readme, - }, - }, - }, -} satisfies Meta<typeof Button>; - -export default meta; - -type Story = StoryObj<typeof meta>; - -export const Default: Story = { - name: 'Example button', -}; diff --git a/proprietary/design-tokens/src/components/utrecht/accordion.tokens.json b/proprietary/design-tokens/src/components/utrecht/accordion.tokens.json new file mode 100644 index 00000000..870ff882 --- /dev/null +++ b/proprietary/design-tokens/src/components/utrecht/accordion.tokens.json @@ -0,0 +1,166 @@ +{ + "utrecht": { + "accordion": { + "border-radius": { + "type": "borderRadius", + "value": "0px" + }, + "section": { + "border-block-end-width": { + "type": "borderWidth", + "value": "{tilburg.border-width.sm}" + }, + "border-width": { + "type": "borderWidth", + "value": "auto" + }, + "border-color": { + "value": "{tilburg.line.border-color}", + "type": "color" + } + }, + "panel": { + "border-color": { + "value": "transparent", + "type": "color" + }, + "border-width": { + "type": "borderWidth", + "value": "{tilburg.border-width.lg}" + }, + "padding-block-end": { + "value": "{tilburg.space.block.rabbit}", + "type": "spacing" + }, + "padding-block-start": { + "value": "{tilburg.space.block.rabbit}", + "type": "spacing" + }, + "padding-inline-end": { + "value": "{tilburg.space.inline.mouse}", + "type": "spacing" + }, + "padding-inline-start": { + "value": "{tilburg.space.inline.mouse}", + "type": "spacing" + } + }, + "button": { + "font-size": { + "value": "{tilburg.document.font-size}", + "type": "fontSizes" + }, + "line-height": { + "value": "{tilburg.document.line-height}", + "type": "lineHeights" + }, + "icon": { + "margin-inline": { + "value": "{tilburg.space.text.mouse}", + "type": "spacing" + }, + "size": { + "type": "sizing", + "value": "{tilburg.icon.functional.size}" + } + }, + "padding-block-end": { + "value": "{tilburg.space.block.snail}", + "type": "spacing" + }, + "padding-block-start": { + "value": "{tilburg.space.block.snail}", + "type": "spacing" + }, + "padding-inline-end": { + "value": "{tilburg.space.inline.mouse}", + "type": "spacing" + }, + "padding-inline-start": { + "value": "{tilburg.space.inline.mouse}", + "type": "spacing" + }, + "hover": { + "background-color": { + "type": "color", + "value": "{tilburg.color.gray.100}" + }, + "border-color": { + "value": "transparent", + "type": "color" + }, + "color": { + "type": "color", + "value": "{tilburg.interaction.hover.color}" + } + }, + "expanded": { + "background-color": { + "value": "{tilburg.color.gray.50}", + "type": "color" + }, + "border-color": { + "value": "transparent", + "type": "color" + }, + "color": { + "type": "color", + "value": "{tilburg.interaction.color}" + } + }, + "background-color": { + "type": "color", + "value": "{tilburg.color.gray.50}" + }, + "border-color": { + "value": "transparent", + "type": "color" + }, + "color": { + "type": "color", + "value": "{tilburg.interaction.color}" + }, + "focus": { + "background-color": { + "type": "color", + "value": "{tilburg.focus.background-color}" + }, + "border-color": { + "value": "transparent", + "type": "color" + }, + "color": { + "type": "color", + "value": "{tilburg.focus.color}" + } + }, + "active": { + "background-color": { + "type": "color", + "value": "{tilburg.color.gray.200}" + }, + "border-color": { + "value": "transparent", + "type": "color" + }, + "color": { + "type": "color", + "value": "{tilburg.interaction.active.color}" + } + }, + "border-width": { + "type": "borderWidth", + "value": "{tilburg.border-width.sm}" + }, + "font-family": { + "value": "{tilburg.document.font-family}", + "type": "fontFamilies" + }, + "font-weight": { + "value": "{tilburg.document.strong.font-weight}", + "type": "fontWeights" + } + } + } + } +} diff --git a/proprietary/design-tokens/src/components/utrecht/breadcrumb-nav.tokens.json b/proprietary/design-tokens/src/components/utrecht/breadcrumb-nav.tokens.json new file mode 100644 index 00000000..33a7a7f7 --- /dev/null +++ b/proprietary/design-tokens/src/components/utrecht/breadcrumb-nav.tokens.json @@ -0,0 +1,112 @@ +{ + "utrecht": { + "breadcrumb": { + "line-height": { + "value": "{tilburg.document.line-height}", + "type": "lineHeights" + }, + "font-size": { + "value": "{tilburg.document.font-size}", + "type": "fontSizes" + }, + "link": { + "icon": { + "size": { + "type": "sizing", + "value": "{tilburg.icon.functional.size}" + }, + "margin-inline": { + "value": "{tilburg.space.text.beetle}", + "type": "spacing" + } + }, + "padding-block-end": { + "value": "{tilburg.space.block.snail}", + "type": "spacing" + }, + "padding-block-start": { + "value": "{tilburg.space.block.snail}", + "type": "spacing" + }, + "padding-inline-end": { + "value": "0px", + "type": "spacing" + }, + "padding-inline-start": { + "value": "0px", + "type": "spacing" + }, + "color": { + "type": "color", + "value": "{tilburg.interaction.color}" + }, + "active": { + "color": { + "type": "color", + "value": "{tilburg.interaction.active.color}" + }, + "text-decoration": { + "value": "none", + "type": "textDecoration" + } + }, + "focus": { + "background-color": { + "type": "color", + "value": "{tilburg.focus.background-color}" + }, + "color": { + "type": "color", + "value": "{tilburg.focus.color}" + }, + "text-decoration": { + "value": "none", + "type": "textDecoration" + } + }, + "hover": { + "color": { + "type": "color", + "value": "{tilburg.interaction.hover.color}" + }, + "text-decoration": { + "value": "none", + "type": "textDecoration" + } + }, + "current": { + "color": { + "type": "color", + "value": "{tilburg.document.subtle.color}" + } + }, + "text-decoration": { + "value": "underline", + "type": "textDecoration" + } + }, + "divider": { + "size": { + "type": "sizing", + "value": "{tilburg.size.2xs}" + }, + "color": { + "value": "{tilburg.document.subtle.color}", + "type": "color" + } + }, + "margin-inline": { + "value": "{tilburg.space.inline.beetle}", + "type": "spacing" + }, + "font-family": { + "value": "{tilburg.document.font-family}", + "type": "fontFamilies" + }, + "font-weight": { + "value": "{tilburg.document.font-weight}", + "type": "fontWeights" + } + } + } +}