From 2b6380517781c89b6372ed8c5aa74095c843988a Mon Sep 17 00:00:00 2001 From: Guillaume Guerin Date: Fri, 30 Jun 2023 15:20:52 +0200 Subject: [PATCH 1/5] docs: update storybook version --- docs/.storybook/main.js | 11 +++-- docs/package.json | 20 +++++---- docs/stories/{Css.stories.mdx => Css.mdx} | 8 ++-- ...roduction.stories.mdx => Introduction.mdx} | 45 ++++++++++--------- ...dPreset.stories.mdx => TailwindPreset.mdx} | 2 +- docs/stories/{VueJs.stories.mdx => VueJs.mdx} | 4 +- docs/tailwind.config.js | 2 +- 7 files changed, 53 insertions(+), 39 deletions(-) rename docs/stories/{Css.stories.mdx => Css.mdx} (72%) rename docs/stories/{Introduction.stories.mdx => Introduction.mdx} (87%) rename docs/stories/{TailwindPreset.stories.mdx => TailwindPreset.mdx} (98%) rename docs/stories/{VueJs.stories.mdx => VueJs.mdx} (94%) diff --git a/docs/.storybook/main.js b/docs/.storybook/main.js index 58bc0114..dd9e94d7 100644 --- a/docs/.storybook/main.js +++ b/docs/.storybook/main.js @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-var-requires */ module.exports = { stories: [ - '../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', + '../stories/**/*.@(mdx|stories.@(js|jsx|ts|tsx))', '../../packages/components/**/*.stories.@(js|jsx|ts|tsx)', ], addons: [ @@ -9,8 +9,10 @@ module.exports = { '@storybook/addon-essentials', '@storybook/addon-a11y', ], - framework: '@storybook/vue3', - core: { builder: '@storybook/builder-vite' }, + framework: { + name: '@storybook/vue3-vite', + options: {}, + }, async viteFinal(config) { config.resolve.dedupe = ['@storybook/client-api'] config.css = { @@ -22,4 +24,7 @@ module.exports = { config.plugins.push(require('unplugin-vue-define-options/vite')()) return config }, + docs: { + autodocs: true, + }, } diff --git a/docs/package.json b/docs/package.json index eaf7494e..a8c1936a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,17 +4,21 @@ "main": "index.js", "license": "MIT", "scripts": { - "dev": "start-storybook -p 6006", - "build": "build-storybook" + "dev": "storybook dev -p 6006", + "build": "storybook build" }, "devDependencies": { - "@storybook/addon-a11y": "^6.5.16", - "@storybook/addon-actions": "^6.5.16", - "@storybook/addon-essentials": "^6.5.16", - "@storybook/addon-links": "^6.5.16", - "@storybook/builder-vite": "0.3.0", - "@storybook/vue3": "^6.5.16", + "@storybook/addon-a11y": "^7.0.24", + "@storybook/addon-actions": "^7.0.24", + "@storybook/addon-essentials": "^7.0.24", + "@storybook/addon-links": "^7.0.24", + "@storybook/blocks": "^7.0.24", + "@storybook/vue3": "^7.0.24", + "@storybook/vue3-vite": "^7.0.24", "@vitejs/plugin-vue": "^4.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "storybook": "^7.0.24", "vite": "^4.2.1" }, "dependencies": { diff --git a/docs/stories/Css.stories.mdx b/docs/stories/Css.mdx similarity index 72% rename from docs/stories/Css.stories.mdx rename to docs/stories/Css.mdx index 6d636988..7b667e30 100644 --- a/docs/stories/Css.stories.mdx +++ b/docs/stories/Css.mdx @@ -1,6 +1,6 @@ -import { Meta } from '@storybook/addon-docs' +import { Meta } from '@storybook/blocks' - + # Css Components @@ -9,7 +9,7 @@ styles used in the VueJs component library. ## Usage -1. Include the CSS in your HTML +1. Include the CSS in your HTML ```html ``` -2. Add the classes in your HTML +2. Add the classes in your HTML ```html diff --git a/docs/stories/Introduction.stories.mdx b/docs/stories/Introduction.mdx similarity index 87% rename from docs/stories/Introduction.stories.mdx rename to docs/stories/Introduction.mdx index 91b44387..b47bcb03 100644 --- a/docs/stories/Introduction.stories.mdx +++ b/docs/stories/Introduction.mdx @@ -1,4 +1,4 @@ -import { Meta } from '@storybook/addon-docs' +import { Meta } from '@storybook/blocks' import { linkTo } from '@storybook/addon-links' import VueJsLogo from '../assets/img/Vue.js_Logo.png' import CssLogo from '../assets/img/css.svg' @@ -8,7 +8,8 @@ import FigmaLogo from '../assets/img/Figma-Icon.svg' - + `} + # Puik @@ -73,68 +75,71 @@ This library provides two ways of using the design system in your project, the f
Getting Started
-
+
VueJs Components + Setup For VueJS Setup the library for a usage with VueJs +
-
+ +
Css Components + Setup for other language/framework Setup the library with another language or framework +
Explore
-
+
VueJs Components + Components Docs Access the components documentation +
+
Learn
repo + Design System documentation Configure, customize, and extend + + direction + Figma UI Kit Access the Figma UI Kit of the PrestaShop Design System + - + + code + GitHub project View the source code and add issues +
diff --git a/docs/stories/TailwindPreset.stories.mdx b/docs/stories/TailwindPreset.mdx similarity index 98% rename from docs/stories/TailwindPreset.stories.mdx rename to docs/stories/TailwindPreset.mdx index b1a1a981..f74044d1 100644 --- a/docs/stories/TailwindPreset.stories.mdx +++ b/docs/stories/TailwindPreset.mdx @@ -1,4 +1,4 @@ -import { Meta } from '@storybook/addon-docs' +import { Meta } from '@storybook/blocks' diff --git a/docs/stories/VueJs.stories.mdx b/docs/stories/VueJs.mdx similarity index 94% rename from docs/stories/VueJs.stories.mdx rename to docs/stories/VueJs.mdx index ef2d409a..cc919f29 100644 --- a/docs/stories/VueJs.stories.mdx +++ b/docs/stories/VueJs.mdx @@ -1,6 +1,6 @@ -import { Meta } from '@storybook/addon-docs' +import { Meta } from '@storybook/blocks' - + # VueJs components diff --git a/docs/tailwind.config.js b/docs/tailwind.config.js index 0aafa505..12b35f4b 100644 --- a/docs/tailwind.config.js +++ b/docs/tailwind.config.js @@ -3,6 +3,6 @@ module.exports = { presets: [require('@puik/theme/tailwind.config')], content: [ '../packages/components/**/*.stories.@(js|jsx|ts|tsx)', - './stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', + './stories/**/*.@(mdx|stories.@(js|jsx|ts|tsx))', ], } From b1f2942c5f0288940aac630d2453682aa15ba1c1 Mon Sep 17 00:00:00 2001 From: Guillaume Guerin Date: Fri, 30 Jun 2023 15:23:22 +0200 Subject: [PATCH 2/5] docs: update storybook version --- .github/workflows/chromatic.yml | 1 + .../stories/accordion-group.stories.ts | 378 +- .../accordion/stories/accordion.stories.ts | 166 +- .../components/alert/stories/alert.stories.ts | 389 +- .../components/badge/stories/badge.stories.ts | 353 +- .../breadcrumb/stories/breadcrumb.stories.ts | 59 +- .../stories/button-group.stories.ts | 47 +- .../button/stories/button.stories.ts | 528 +- .../components/card/stories/card.stories.ts | 307 +- .../checkbox/stories/checkbox.stories.ts | 386 +- .../components/icon/stories/icon.stories.ts | 42 +- .../components/input/stories/input.stories.ts | 771 +- .../components/label/stories/label.stories.ts | 182 +- .../components/link/stories/link.stories.ts | 93 +- .../components/menu/stories/menu.stories.ts | 202 +- .../components/modal/stories/modal.stories.ts | 775 +- .../pagination/stories/pagination.stories.ts | 668 +- .../stories/progress-bar.stories.ts | 107 +- .../components/radio/stories/radio.stories.ts | 360 +- .../select/stories/select.stories.ts | 818 +- .../stories/skeleton-loader-group.stories.ts | 59 +- .../stories/skeleton-loader.stories.ts | 51 +- .../stories/spinner-loader.stories.ts | 229 +- .../switch/stories/switch.stories.ts | 352 +- .../tooltip/stories/tooltip.stories.ts | 537 +- pnpm-lock.yaml | 7034 +++++------------ 26 files changed, 6192 insertions(+), 8702 deletions(-) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 92ec96a7..dd96dfaf 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -48,3 +48,4 @@ jobs: # 👇 Chromatic projectToken, refer to the manage page to obtain it. projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} workingDir: './docs' + buildScriptName: build diff --git a/packages/components/accordion/stories/accordion-group.stories.ts b/packages/components/accordion/stories/accordion-group.stories.ts index ab9752c8..ced20934 100644 --- a/packages/components/accordion/stories/accordion-group.stories.ts +++ b/packages/components/accordion/stories/accordion-group.stories.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' import PuikAccordionGroup from '../src/accordion-group.vue' import PuikAccordion from '../src/accordion.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Accordion/AccordionGroup', @@ -46,7 +46,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikAccordionGroup, PuikAccordion, @@ -70,201 +70,213 @@ const Template: Story = (args: Args) => ({ `, }) -export const Default = Template.bind({}) -Default.args = { - multiple: false, - contained: false, -} -Default.parameters = { - docs: { - source: { - code: ` - - - - Content 1 - - - Content 2 - - - Content 3 - - +export const Default = { + render: Template, - -
- -
- - -
-
- -
Content 2
-
-
- - + args: { + multiple: false, + contained: false, + }, + + parameters: { + docs: { + source: { + code: ` + + + + Content 1 + + + Content 2 + + + Content 3 + + + + +
+ +
+ + +
+
+ +
Content 2
+
+
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Multiple = Template.bind({}) -Multiple.args = { - multiple: true, - contained: false, - modelValue: ['accordion-1', 'accordion-2', 'accordion-3'], -} -Multiple.parameters = { - docs: { - source: { - code: ` - - - - Content 1 - - - Content 2 - - - Content 3 - - +export const Multiple = { + render: Template, - -
-
- - -
-
- -
Content 2
-
-
- - + args: { + multiple: true, + contained: false, + modelValue: ['accordion-1', 'accordion-2', 'accordion-3'], + }, + + parameters: { + docs: { + source: { + code: ` + + + + Content 1 + + + Content 2 + + + Content 3 + + + + +
+
+ + +
+
+ +
Content 2
+
+
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Contained = Template.bind({}) -Contained.args = { - multiple: false, - contained: true, -} -Contained.parameters = { - docs: { - source: { - code: ` - - - - Content 1 - - - Content 2 - - - Content 3 - - +export const Contained = { + render: Template, - -
-
- - -
-
- -
Content 2
-
-
- - + args: { + multiple: false, + contained: true, + }, + + parameters: { + docs: { + source: { + code: ` + + + + Content 1 + + + Content 2 + + + Content 3 + + + + +
+
+ + +
+
+ +
Content 2
+
+
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } diff --git a/packages/components/accordion/stories/accordion.stories.ts b/packages/components/accordion/stories/accordion.stories.ts index 9ec5c26b..9bd358e2 100644 --- a/packages/components/accordion/stories/accordion.stories.ts +++ b/packages/components/accordion/stories/accordion.stories.ts @@ -1,6 +1,6 @@ import PuikAccordionGroup from '../src/accordion-group.vue' import PuikAccordion from '../src/accordion.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Accordion/Accordion', @@ -39,7 +39,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikAccordionGroup, PuikAccordion, @@ -57,91 +57,99 @@ const Template: Story = (args: Args) => ({ `, }) -export const Default = Template.bind({}) -Default.args = { - name: 'accordion-1', - title: 'Accordion title', - subTitle: 'Accordion subtitle', - icon: 'home', - disabled: false, -} -Default.parameters = { - docs: { - source: { - code: ` - - - - Content 1 - - +export const Default = { + render: Template, + + args: { + name: 'accordion-1', + title: 'Accordion title', + subTitle: 'Accordion subtitle', + icon: 'home', + disabled: false, + }, - -
- -
- -
Content 1
+ parameters: { + docs: { + source: { + code: ` + + + + Content 1 + + + + +
+ +
+ +
Content 1
+
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Disabled = Template.bind({}) -Disabled.args = { - disabled: true, - name: 'accordion-1', - title: 'Disabled accordion title', - subTitle: 'Disabled accordion sub-title', - icon: 'home', -} -Disabled.parameters = { - docs: { - source: { - code: ` - - - - Content 1 - - +export const Disabled = { + render: Template, + + args: { + disabled: true, + name: 'accordion-1', + title: 'Disabled accordion title', + subTitle: 'Disabled accordion sub-title', + icon: 'home', + }, - -
-
- -
Content 1
+ parameters: { + docs: { + source: { + code: ` + + + + Content 1 + + + + +
+
+ +
Content 1
+
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } diff --git a/packages/components/alert/stories/alert.stories.ts b/packages/components/alert/stories/alert.stories.ts index ea5b1c45..0f45a8b4 100644 --- a/packages/components/alert/stories/alert.stories.ts +++ b/packages/components/alert/stories/alert.stories.ts @@ -1,7 +1,7 @@ import { action } from '@storybook/addon-actions' import { alertVariants } from '../src/alert' import PuikAlert from './../src/alert.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' const alertVariantsSummary = alertVariants.join('|') @@ -54,7 +54,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikAlert, }, @@ -71,228 +71,239 @@ const Template: Story = (args: Args) => ({ >`, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - This is the description of the success alert - +export const Default = { + render: Template, + args: {}, - - -
-
- check_circle -
-

Title

- This is the description of the success alert. + parameters: { + docs: { + source: { + code: ` + + + + This is the description of the success alert + + + + +
+
+ check_circle +
+

Title

+ This is the description of the success alert. +
+
- -
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Success: Story = () => ({ - components: { - PuikAlert, - }, - template: ` -
- This a success alert with a title and a description. - This a success alert with only a description. - This a success alert with a title and a description and a button. - This a success alert with a description and a button. -
- `, -}) +export const Success: StoryObj = { + render: () => ({ + components: { + PuikAlert, + }, + template: ` +
+ This a success alert with a title and a description. + This a success alert with only a description. + This a success alert with a title and a description and a button. + This a success alert with a description and a button. +
+ `, + }), -Success.parameters = { - docs: { - source: { - code: ` - - - This a success alert with a title and a description. - + parameters: { + docs: { + source: { + code: ` + + + This a success alert with a title and a description. + - -
-
- check_circle -
-

Title

- This a success alert with a title and a description. + +
+
+ check_circle +
+

Title

+ This a success alert with a title and a description. +
+
- -
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Warning: Story = () => ({ - components: { - PuikAlert, - }, - template: ` -
- This a warning alert with a title and a description. - This a warning alert with disabled borders - This a warning alert with only a description. - This a warning alert with a title and a description and a button. - This a warning alert with a description and a button. -
- `, -}) +export const Warning: StoryObj = { + render: () => ({ + components: { + PuikAlert, + }, + template: ` +
+ This a warning alert with a title and a description. + This a warning alert with disabled borders + This a warning alert with only a description. + This a warning alert with a title and a description and a button. + This a warning alert with a description and a button. +
+ `, + }), -Warning.parameters = { - docs: { - source: { - code: ` - - - This a warning alert with a title and a description. - + parameters: { + docs: { + source: { + code: ` + + + This a warning alert with a title and a description. + - -
-
- warning -
-

Title

- This a warning alert with a title and a description. + +
+
+ warning +
+

Title

+ This a warning alert with a title and a description. +
+
- -
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Info: Story = () => ({ - components: { - PuikAlert, - }, - template: ` -
- This a info alert with a title and a description. - This a info alert with disabled borders - This a info alert with only a description. - This a info alert with a title and a description and a button. - This a info alert with a description and a button. -
- `, -}) +export const Info: StoryObj = { + render: () => ({ + components: { + PuikAlert, + }, + template: ` +
+ This a info alert with a title and a description. + This a info alert with disabled borders + This a info alert with only a description. + This a info alert with a title and a description and a button. + This a info alert with a description and a button. +
+ `, + }), -Info.parameters = { - docs: { - source: { - code: ` - - - This a info alert with a title and a description. - + parameters: { + docs: { + source: { + code: ` + + + This a info alert with a title and a description. + - -
-
- info -
-

Title

- This a info alert with a title and a description. + +
+
+ info +
+

Title

+ This a info alert with a title and a description. +
+
- -
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Danger: Story = () => ({ - components: { - PuikAlert, - }, - template: ` -
- This a danger alert with a title and a description. - This a danger alert with disabled borders - This a danger alert with only a description. - This a danger alert with a title and a description and a button. - This a danger alert with a description and a button. -
- `, -}) +export const Danger: StoryObj = { + render: () => ({ + components: { + PuikAlert, + }, + template: ` +
+ This a danger alert with a title and a description. + This a danger alert with disabled borders + This a danger alert with only a description. + This a danger alert with a title and a description and a button. + This a danger alert with a description and a button. +
+ `, + }), -Danger.parameters = { - docs: { - source: { - code: ` - - - This a info alert with a title and a description. - + parameters: { + docs: { + source: { + code: ` + + + This a info alert with a title and a description. + - -
-
- danger -
-

Title

- This a danger alert with a title and a description. + +
+
+ danger +
+

Title

+ This a danger alert with a title and a description. +
+
- -
- `, - language: 'html', + `, + language: 'html', + }, }, }, } diff --git a/packages/components/badge/stories/badge.stories.ts b/packages/components/badge/stories/badge.stories.ts index 0c68ce95..5ec5d5c7 100644 --- a/packages/components/badge/stories/badge.stories.ts +++ b/packages/components/badge/stories/badge.stories.ts @@ -1,6 +1,6 @@ import { badgeVariants } from '../src/badge' import PuikBadge from './../src/badge.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' const badgeVariantsSummary = badgeVariants.join('|') @@ -32,7 +32,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikBadge, }, @@ -42,194 +42,217 @@ const Template: Story = (args: Args) => ({ template: `{{ args.default }}`, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - The text of the badge - - - - -
- The text of the badge -
- `, - language: 'html', +export const Default = { + render: Template, + args: {}, + + parameters: { + docs: { + source: { + code: ` + + + + The text of the badge + + + + +
+ The text of the badge +
+ `, + language: 'html', + }, }, }, } -export const success: Story = (args: Args) => ({ - components: { - PuikBadge, - }, - setup() { - return { - args, - } +export const success: StoryObj = { + render: (args: Args) => ({ + components: { + PuikBadge, + }, + setup() { + return { + args, + } + }, + template: `{{ args.default }}`, + }), + + args: { + variant: 'success', }, - template: `{{ args.default }}`, -}) -success.args = { - variant: 'success', -} -success.parameters = { - docs: { - source: { - code: ` - - - Status - - - -
- Status -
- `, - language: 'html', + + parameters: { + docs: { + source: { + code: ` + + + Status + + + +
+ Status +
+ `, + language: 'html', + }, }, }, } -export const warning: Story = (args: Args) => ({ - components: { - PuikBadge, - }, - setup() { - return { - args, - } +export const warning: StoryObj = { + render: (args: Args) => ({ + components: { + PuikBadge, + }, + setup() { + return { + args, + } + }, + template: `{{ args.default }}`, + }), + + args: { + variant: 'warning', }, - template: `{{ args.default }}`, -}) -warning.args = { - variant: 'warning', -} -warning.parameters = { - docs: { - source: { - code: ` - - - Status - - - -
- Status -
- `, - language: 'html', + + parameters: { + docs: { + source: { + code: ` + + + Status + + + +
+ Status +
+ `, + language: 'html', + }, }, }, } -export const danger: Story = (args: Args) => ({ - components: { - PuikBadge, - }, - setup() { - return { - args, - } +export const danger: StoryObj = { + render: (args: Args) => ({ + components: { + PuikBadge, + }, + setup() { + return { + args, + } + }, + template: `{{ args.default }}`, + }), + + args: { + variant: 'danger', }, - template: `{{ args.default }}`, -}) -danger.args = { - variant: 'danger', -} -danger.parameters = { - docs: { - source: { - code: ` - - - Status - - - -
- Status -
- `, - language: 'html', + + parameters: { + docs: { + source: { + code: ` + + + Status + + + +
+ Status +
+ `, + language: 'html', + }, }, }, } -export const info: Story = (args: Args) => ({ - components: { - PuikBadge, - }, - setup() { - return { - args, - } +export const info: StoryObj = { + render: (args: Args) => ({ + components: { + PuikBadge, + }, + setup() { + return { + args, + } + }, + template: `{{ args.default }}`, + }), + + args: { + variant: 'info', }, - template: `{{ args.default }}`, -}) -info.args = { - variant: 'info', -} -info.parameters = { - docs: { - source: { - code: ` - - - Status - - - -
- Status -
- `, - language: 'html', + + parameters: { + docs: { + source: { + code: ` + + + Status + + + +
+ Status +
+ `, + language: 'html', + }, }, }, } -export const neutral: Story = (args: Args) => ({ - components: { - PuikBadge, - }, - setup() { - return { - args, - } +export const neutral: StoryObj = { + render: (args: Args) => ({ + components: { + PuikBadge, + }, + setup() { + return { + args, + } + }, + template: `{{ args.default }}`, + }), + + args: { + variant: 'neutral', }, - template: `{{ args.default }}`, -}) -neutral.args = { - variant: 'neutral', -} -neutral.parameters = { - docs: { - source: { - code: ` - - - Status - - - -
- Status -
- `, - language: 'html', + + parameters: { + docs: { + source: { + code: ` + + + Status + + + +
+ Status +
+ `, + language: 'html', + }, }, }, } diff --git a/packages/components/breadcrumb/stories/breadcrumb.stories.ts b/packages/components/breadcrumb/stories/breadcrumb.stories.ts index c3c0e637..4b2459d6 100644 --- a/packages/components/breadcrumb/stories/breadcrumb.stories.ts +++ b/packages/components/breadcrumb/stories/breadcrumb.stories.ts @@ -1,5 +1,5 @@ import PuikBreadcrumb from './../src/breadcrumb.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Breadcrumb', component: PuikBreadcrumb, @@ -69,7 +69,7 @@ interface BreadBreadcrumbItem { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikBreadcrumb, }, @@ -79,33 +79,36 @@ const Template: Story = (args: Args) => ({ template: ``, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - +export const Default = { + render: Template, + args: {}, - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + + + + `, + language: 'html', + }, }, }, } diff --git a/packages/components/button-group/stories/button-group.stories.ts b/packages/components/button-group/stories/button-group.stories.ts index 0c0e5971..9053df67 100644 --- a/packages/components/button-group/stories/button-group.stories.ts +++ b/packages/components/button-group/stories/button-group.stories.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' import PuikButtonGroup from './../src/button-group.vue' import PuikButton from './../../button/src/button.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/ButtonGroup', @@ -29,7 +29,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikButtonGroup, PuikButton, @@ -52,27 +52,30 @@ const Template: Story = (args: Args) => ({ `, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - Button 1 - Button 2 - Button 3 - +export const Default = { + render: Template, + args: {}, - -
- - - -
- `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + Button 1 + Button 2 + Button 3 + + + +
+ + + +
+ `, + language: 'html', + }, }, }, } diff --git a/packages/components/button/stories/button.stories.ts b/packages/components/button/stories/button.stories.ts index 2e5a7020..90a39982 100644 --- a/packages/components/button/stories/button.stories.ts +++ b/packages/components/button/stories/button.stories.ts @@ -1,7 +1,7 @@ import { capitalize } from 'lodash-unified' import PuikButton from './../src/button.vue' import { buttonVariants, buttonSizes } from './../src/button' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' const buttonVariantsSummary = buttonVariants.join('|') const buttonSizesSummary = buttonSizes.join('|') @@ -85,7 +85,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikButton, }, @@ -95,36 +95,39 @@ const Template: Story = (args: Args) => ({ template: `{{ args.default }}`, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - My button - - - - - - `, - language: 'html', +export const Default = { + render: Template, + args: {}, + + parameters: { + docs: { + source: { + code: ` + + + + My button + + + + + + `, + language: 'html', + }, }, }, } @@ -167,277 +170,314 @@ const AllVariantTemplate = (args: Args, storyContext) => ({ `, }) -export const Primary: Story = ButtonTemplate.bind({}) -Primary.args = { - variant: 'primary', -} +export const Primary: StoryObj = { + render: ButtonTemplate, -Primary.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', - }, + args: { + variant: 'primary', }, -} - -export const Secondary: Story = ButtonTemplate.bind({}) -Secondary.args = { - variant: 'secondary', -} -Secondary.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Tertiary: Story = ButtonTemplate.bind({}) -Tertiary.args = { - variant: 'tertiary', -} +export const Secondary: StoryObj = { + render: ButtonTemplate, -Tertiary.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + args: { + variant: 'secondary', + }, + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Destructive: Story = ButtonTemplate.bind({}) -Destructive.args = { - variant: 'destructive', -} +export const Tertiary: StoryObj = { + render: ButtonTemplate, + + args: { + variant: 'tertiary', + }, -Destructive.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Text: Story = ButtonTemplate.bind({}) -Text.args = { - variant: 'text', -} +export const Destructive: StoryObj = { + render: ButtonTemplate, + + args: { + variant: 'destructive', + }, -Text.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Info: Story = ButtonTemplate.bind({}) -Info.args = { - variant: 'info', -} +export const Text: StoryObj = { + render: ButtonTemplate, + + args: { + variant: 'text', + }, -Info.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Success: Story = ButtonTemplate.bind({}) -Success.args = { - variant: 'success', -} +export const Info: StoryObj = { + render: ButtonTemplate, -Success.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + args: { + variant: 'info', + }, + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Warning: Story = ButtonTemplate.bind({}) -Warning.args = { - variant: 'warning', -} +export const Success: StoryObj = { + render: ButtonTemplate, + + args: { + variant: 'success', + }, -Warning.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Danger: Story = ButtonTemplate.bind({}) -Danger.args = { - variant: 'danger', -} +export const Warning: StoryObj = { + render: ButtonTemplate, -Danger.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + args: { + variant: 'warning', + }, + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Disabled: Story = AllVariantTemplate.bind({}) -Disabled.args = { - disabled: true, -} +export const Danger: StoryObj = { + render: ButtonTemplate, -Disabled.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + args: { + variant: 'danger', + }, + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const Fluid: Story = () => ({ - components: { - PuikButton, +export const Disabled: StoryObj = { + render: AllVariantTemplate, + + args: { + disabled: true, }, - template: ` - Primary Button lg - `, -}) -Fluid.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } -export const WithIcon: Story = () => ({ - components: { - PuikButton, +export const Fluid: StoryObj = { + render: () => ({ + components: { + PuikButton, + }, + template: ` + Primary Button lg + `, + }), + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, + }, }, - template: ` -
- Left Icon - Right Icon -
- `, -}) +} -WithIcon.parameters = { - docs: { - source: { - code: ` - -My button -My button - - - - - `, - language: 'html', +export const WithIcon: StoryObj = { + render: () => ({ + components: { + PuikButton, + }, + template: ` +
+ Left Icon + Right Icon +
+ `, + }), + + parameters: { + docs: { + source: { + code: ` + + My button + My button + + + + + `, + language: 'html', + }, }, }, } -export const Variants: Story = AllVariantTemplate.bind({}) -Variants.parameters = { - docs: { - source: { - code: ` - -My button - - - - `, - language: 'html', +export const Variants: StoryObj = { + render: AllVariantTemplate, + + parameters: { + docs: { + source: { + code: ` + + My button + + + + `, + language: 'html', + }, }, }, } diff --git a/packages/components/card/stories/card.stories.ts b/packages/components/card/stories/card.stories.ts index 0f340c1a..e341c827 100644 --- a/packages/components/card/stories/card.stories.ts +++ b/packages/components/card/stories/card.stories.ts @@ -2,7 +2,7 @@ import PrestaShopSloganBg from '../../../../docs/assets/img/prestashop-slogan-bg import { cardVariants } from '../src/card' import PuikCard from './../src/card.vue' import PuikButton from './../../button/src/button.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' const cardVariantsSummary = cardVariants.join('|') @@ -36,7 +36,7 @@ export default { ], } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikCard, }, @@ -51,170 +51,191 @@ const Template: Story = (args: Args) => ({ `, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - Card content - - - - -
- Card content -
- `, - language: 'html', +export const Default = { + render: Template, + args: {}, + + parameters: { + docs: { + source: { + code: ` + + + + Card content + + + + +
+ Card content +
+ `, + language: 'html', + }, }, }, } -export const Highlight = Template.bind({}) -Highlight.args = { - variant: 'highlight', -} -Highlight.parameters = { - docs: { - source: { - code: ` - - - Card content - - - -
- Card content -
- `, - language: 'html', - }, +export const Highlight = { + render: Template, + + args: { + variant: 'highlight', }, -} -export const Blue = Template.bind({}) -Blue.args = { - variant: 'blue', -} -Blue.parameters = { - docs: { - source: { - code: ` - - - Card content - - - -
- Card content -
- `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + Card content + + + +
+ Card content +
+ `, + language: 'html', + }, }, }, } -export const Purple = Template.bind({}) -Purple.args = { - variant: 'purple', -} -Purple.parameters = { - docs: { - source: { - code: ` - - - Card content - - - -
- Card content -
- `, - language: 'html', +export const Blue = { + render: Template, + + args: { + variant: 'blue', + }, + + parameters: { + docs: { + source: { + code: ` + + + Card content + + + +
+ Card content +
+ `, + language: 'html', + }, }, }, } -export const Amber = Template.bind({}) -Amber.args = { - variant: 'amber', -} -Amber.parameters = { - docs: { - source: { - code: ` - - - Card content - - - -
- Card content -
- `, - language: 'html', +export const Purple = { + render: Template, + + args: { + variant: 'purple', + }, + + parameters: { + docs: { + source: { + code: ` + + + Card content + + + +
+ Card content +
+ `, + language: 'html', + }, }, }, } -export const WithPictureTitleTextAndAction: Story = (args: Args) => ({ - components: { - PuikButton, - PuikCard, +export const Amber = { + render: Template, + + args: { + variant: 'amber', }, - setup() { - return { args, PrestaShopSloganBg } + + parameters: { + docs: { + source: { + code: ` + + + Card content + + + +
+ Card content +
+ `, + language: 'html', + }, + }, }, - template: ` +} + +export const WithPictureTitleTextAndAction: StoryObj = { + render: (args: Args) => ({ + components: { + PuikButton, + PuikCard, + }, + setup() { + return { args, PrestaShopSloganBg } + }, + template: ` + + +

Card title

+ {{ args.default }} +
+ Button +
+
+ `, + }), + + parameters: { + docs: { + source: { + code: ` + - -

Card title

- {{ args.default }} -
- Button -
+ +

Card title

+ Card content +
+ Button +
- `, -}) -WithPictureTitleTextAndAction.parameters = { - docs: { - source: { - code: ` - - - -

Card title

- Card content -
- Button -
-
- - -
- -

Card title

- Card description -
-
-
- `, - language: 'html', + +
+ +

Card title

+ Card description +
+
+
+ `, + language: 'html', + }, }, }, } diff --git a/packages/components/checkbox/stories/checkbox.stories.ts b/packages/components/checkbox/stories/checkbox.stories.ts index 96a81e2f..c421eff8 100644 --- a/packages/components/checkbox/stories/checkbox.stories.ts +++ b/packages/components/checkbox/stories/checkbox.stories.ts @@ -1,5 +1,5 @@ import PuikCheckbox from './../src/checkbox.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Checkbox', @@ -43,7 +43,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikCheckbox, }, @@ -54,213 +54,247 @@ const Template: Story = (args: Args) => ({ '', }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', +export const Default = { + render: Template, + args: {}, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const Checked: Story = Template.bind({}) -Checked.args = { - modelValue: true, -} -Checked.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', - }, +export const Checked: StoryObj = { + render: Template, + + args: { + modelValue: true, }, -} -export const Unchecked: Story = Template.bind({}) -Unchecked.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const Indeterminate: Story = Template.bind({}) -Indeterminate.args = { - indeterminate: true, - modelValue: false, -} -Indeterminate.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', +export const Unchecked: StoryObj = { + render: Template, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const WithoutLabel: Story = Template.bind({}) -WithoutLabel.args = { - label: undefined, -} -WithoutLabel.parameters = { - docs: { - source: { - code: ` - - - - -
- -
- `, - language: 'html', +export const Indeterminate: StoryObj = { + render: Template, + + args: { + indeterminate: true, + modelValue: false, + }, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const CustomLabel: Story = (args) => ({ - components: { - PuikCheckbox, +export const WithoutLabel: StoryObj = { + render: Template, + + args: { + label: undefined, }, - setup() { - return { args } + + parameters: { + docs: { + source: { + code: ` + + + + +
+ +
+ `, + language: 'html', + }, + }, }, - template: ` - - {{ args.default }} - - `, -}) -CustomLabel.args = { - default: 'Custom label', } -CustomLabel.parameters = { - docs: { - source: { - code: ` - - - Custome label - - - -
- - -
- `, - language: 'html', + +export const CustomLabel: StoryObj = { + render: (args) => ({ + components: { + PuikCheckbox, }, + setup() { + return { args } + }, + template: ` + + {{ args.default }} + + `, + }), + + args: { + default: 'Custom label', }, -} -export const DisabledUnchecked: Story = Template.bind({}) -DisabledUnchecked.args = { - disabled: true, -} -DisabledUnchecked.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + Custome label + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const DisabledChecked: Story = Template.bind({}) -DisabledChecked.args = { - disabled: true, - modelValue: true, -} -DisabledChecked.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', +export const DisabledUnchecked: StoryObj = { + render: Template, + + args: { + disabled: true, + }, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } -export const DisabledIndeterminate: Story = Template.bind({}) -DisabledIndeterminate.args = { - disabled: true, - indeterminate: true, +export const DisabledChecked: StoryObj = { + render: Template, + + args: { + disabled: true, + modelValue: true, + }, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, + }, + }, } -DisabledIndeterminate.parameters = { - docs: { - source: { - code: ` - - - - -
- - -
- `, - language: 'html', + +export const DisabledIndeterminate: StoryObj = { + render: Template, + + args: { + disabled: true, + indeterminate: true, + }, + + parameters: { + docs: { + source: { + code: ` + + + + +
+ + +
+ `, + language: 'html', + }, }, }, } diff --git a/packages/components/icon/stories/icon.stories.ts b/packages/components/icon/stories/icon.stories.ts index a340fb4f..a8b7e58c 100644 --- a/packages/components/icon/stories/icon.stories.ts +++ b/packages/components/icon/stories/icon.stories.ts @@ -1,5 +1,5 @@ import PuikIcon from './../src/icon.vue' -import type { Args, Meta, Story } from '@storybook/vue3' +import type { Args, Meta, StoryFn } from '@storybook/vue3' export default { title: 'Components/Icon', @@ -34,7 +34,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikIcon, }, @@ -44,24 +44,28 @@ const Template: Story = (args: Args) => ({ template: ``, }) -export const Default = Template.bind({}) -Default.args = { - icon: 'check', - color: 'green', - fontSize: 24, - nodeType: 'span', -} -Default.parameters = { - docs: { - source: { - code: ` - - +export const Default = { + render: Template, + + args: { + icon: 'check', + color: 'green', + fontSize: 24, + nodeType: 'span', + }, - - check - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + + + check + `, + language: 'html', + }, }, }, } diff --git a/packages/components/input/stories/input.stories.ts b/packages/components/input/stories/input.stories.ts index cee6d45e..5c2d25de 100644 --- a/packages/components/input/stories/input.stories.ts +++ b/packages/components/input/stories/input.stories.ts @@ -1,6 +1,6 @@ import { ref } from 'vue' import PuikInput from './../src/input.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Input', @@ -96,7 +96,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikInput, }, @@ -107,434 +107,457 @@ const Template: Story = (args: Args) => ({ template: ``, }) -export const Default = Template.bind({}) - -Default.args = { - type: undefined, - id: '', - placeholder: '', - name: '', - autocomplete: '', - required: false, - success: false, - hideHint: false, - step: undefined, - precision: undefined, - min: undefined, - max: undefined, - disabled: false, -} -Default.parameters = { - docs: { - source: { - code: ` - - - - -
-
- +export const Default = { + render: Template, + + args: { + type: undefined, + id: '', + placeholder: '', + name: '', + autocomplete: '', + required: false, + success: false, + hideHint: false, + step: undefined, + precision: undefined, + min: undefined, + max: undefined, + disabled: false, + }, + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Disabled: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ``, -}) - -Disabled.parameters = { - docs: { - source: { - code: ` - - - - -
-
- +export const Disabled: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Placeholder: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ``, -}) - -Placeholder.parameters = { - docs: { - source: { - code: ` - - - - -
-
- +export const Placeholder: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Password: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ``, -}) - -Password.parameters = { - docs: { - source: { - code: ` - - - - -
-
- +export const Password: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Number: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref(0) - return { myValue } - }, - template: ``, -}) - -Number.parameters = { - docs: { - source: { - code: ` - - - - -
-
- -
- - +export const Number: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref(0) + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const MinMax: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref(0) - return { myValue } - }, - template: ``, -}) - -MinMax.parameters = { - docs: { - source: { - code: ` - - - - -
-
- -
- - +export const MinMax: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref(0) + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Step: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref(0) - return { myValue } - }, - template: ``, -}) - -Step.parameters = { - docs: { - source: { - code: ` - - - - -
-
- -
- - +export const Step: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref(0) + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
+ + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Success: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ``, -}) - -Success.parameters = { - docs: { - source: { - code: ` - - - - -
-
- +export const Success: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ``, + }), + + parameters: { + docs: { + source: { + code: ` + + + + +
+
+ +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Error: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ` - - - - `, -}) - -Error.parameters = { - docs: { - source: { - code: ` - - - - - - - - - -
-
- -
-
-
- error - - This is an error - +export const Error: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ` + + + + `, + }), + + parameters: { + docs: { + source: { + code: ` + + + + + + + + + +
+
+ +
+
+
+ error + + This is an error + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const Hint: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ` - - - - `, -}) - -Hint.parameters = { - docs: { - source: { - code: ` - - - - - - - - - -
-
- -
-
- - This is an hint - +export const Hint: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ` + + + + `, + }), + + parameters: { + docs: { + source: { + code: ` + + + + + + + + + +
+
+ +
+
+ + This is an hint + +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } -export const PrependAppend: Story = () => ({ - components: { - PuikInput, - }, - setup() { - const myValue = ref('') - return { myValue } - }, - template: ` - - - - - `, -}) - -PrependAppend.parameters = { - docs: { - source: { - code: ` - - - - - - - - - - -
-
- $ -
- -
- kg +export const PrependAppend: StoryObj = { + render: () => ({ + components: { + PuikInput, + }, + setup() { + const myValue = ref('') + return { myValue } + }, + template: ` + + + + + `, + }), + + parameters: { + docs: { + source: { + code: ` + + + + + + + + + + +
+
+ $ +
+ +
+ kg +
-
- `, - language: 'html', + `, + language: 'html', + }, }, }, } diff --git a/packages/components/label/stories/label.stories.ts b/packages/components/label/stories/label.stories.ts index d0b57152..59f8f91a 100644 --- a/packages/components/label/stories/label.stories.ts +++ b/packages/components/label/stories/label.stories.ts @@ -1,5 +1,5 @@ import PuikLabel from '../src/label.vue' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3' export default { title: 'Components/Label', @@ -43,7 +43,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikLabel, }, @@ -53,109 +53,119 @@ const Template: Story = (args: Args) => ({ template: `{{ args.default }}`, }) -export const Default = Template.bind({}) -Default.args = { - optional: false, - required: false, - readonly: false, - for: 'input', - default: 'My Label', -} -Default.parameters = { - docs: { - source: { - code: ` - -My Label +export const Default = { + render: Template, + + args: { + optional: false, + required: false, + readonly: false, + for: 'input', + default: 'My Label', + }, - - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + My Label + + + + `, + language: 'html', + }, }, }, } -export const Optional: Story = (args: Args) => ({ - components: { - PuikLabel, - }, - setup() { - return { args } - }, - template: `My Label`, -}) +export const Optional: StoryObj = { + render: (args: Args) => ({ + components: { + PuikLabel, + }, + setup() { + return { args } + }, + template: `My Label`, + }), -Optional.parameters = { - docs: { - source: { - code: ` - -My Label + parameters: { + docs: { + source: { + code: ` + + My Label - - - `, - language: 'html', + + + `, + language: 'html', + }, }, }, } -export const Required: Story = (args: Args) => ({ - components: { - PuikLabel, - }, - setup() { - return { args } - }, - template: `My Label`, -}) +export const Required: StoryObj = { + render: (args: Args) => ({ + components: { + PuikLabel, + }, + setup() { + return { args } + }, + template: `My Label`, + }), -Required.parameters = { - docs: { - source: { - code: ` - -My Label + parameters: { + docs: { + source: { + code: ` + + My Label - - - `, - language: 'html', + + + `, + language: 'html', + }, }, }, } -export const Readonly: Story = (args: Args) => ({ - components: { - PuikLabel, - }, - setup() { - return { args } - }, - template: `My Label`, -}) +export const Readonly: StoryObj = { + render: (args: Args) => ({ + components: { + PuikLabel, + }, + setup() { + return { args } + }, + template: `My Label`, + }), -Readonly.parameters = { - docs: { - source: { - code: ` - -My Label + parameters: { + docs: { + source: { + code: ` + + My Label - - -`, - language: 'html', + + + `, + language: 'html', + }, }, }, } diff --git a/packages/components/link/stories/link.stories.ts b/packages/components/link/stories/link.stories.ts index 3f1614f8..4093cfe0 100644 --- a/packages/components/link/stories/link.stories.ts +++ b/packages/components/link/stories/link.stories.ts @@ -1,6 +1,6 @@ import PuikLink from './../src/link.vue' import { linkSizes, targetVariants } from './../src/link' -import type { Meta, Story, Args } from '@storybook/vue3' +import type { Meta, StoryFn, Args } from '@storybook/vue3' const targetVariantsSummary = targetVariants.join('|') const linkSizesSummary = linkSizes.join('|') @@ -64,7 +64,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ components: { PuikLink, }, @@ -74,54 +74,61 @@ const Template: Story = (args: Args) => ({ template: `{{ args.default }}`, }) -export const Default = Template.bind({}) -Default.args = {} -Default.parameters = { - docs: { - source: { - code: ` - - - - I'm a cool link - +export const Default = { + render: Template, + args: {}, - - - - I'm a cool link - - `, - language: 'html', + parameters: { + docs: { + source: { + code: ` + + + + I'm a cool link + + + + + + I'm a cool link + + `, + language: 'html', + }, }, }, } -export const Blank = Template.bind({}) -Blank.args = { - target: '_blank', -} -Blank.parameters = { - docs: { - source: { - code: ` - - -I'm a cool link - +export const Blank = { + render: Template, - - + args: { + target: '_blank', + }, + + parameters: { + docs: { + source: { + code: ` + + I'm a cool link - - `, - language: 'html', + + + + + I'm a cool link + + `, + language: 'html', + }, }, }, } diff --git a/packages/components/menu/stories/menu.stories.ts b/packages/components/menu/stories/menu.stories.ts index 84e71734..f4eae827 100644 --- a/packages/components/menu/stories/menu.stories.ts +++ b/packages/components/menu/stories/menu.stories.ts @@ -5,7 +5,7 @@ import PuikMenuItemSeparator from '../src/menu-item-separator.vue' import PuikMenuItemTitle from '../src/menu-item-title.vue' import PuikButton from '../../button/src/button.vue' import PuikLink from '../../link/src/link.vue' -import type { Meta, Args, Story } from '@storybook/vue3' +import type { Meta, Args, StoryFn } from '@storybook/vue3' const menuAlignsJoined = menuAligns.join('|') const menuPositionsJoined = menuPositions.join('|') @@ -78,7 +78,7 @@ export default { }, } as Meta -const Template: Story = (args: Args) => ({ +const Template: StoryFn = (args: Args) => ({ args: {}, components: { PuikButton, @@ -151,112 +151,116 @@ const Template: Story = (args: Args) => ({ `, }) -export const Default = Template.bind({}) -Default.args = { - maxHeight: 'none', - position: 'bottom', - align: 'left', -} -Default.parameters = { - docs: { - source: { - code: ` - - - - +export const Default = { + render: Template, - - +