-
Notifications
You must be signed in to change notification settings - Fork 192
feat: Add Storybook for the Vue package instead of Histoire #3396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 51 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
4d918aa
feat(vue): init storybook
carwack 1cfe1e0
feat(vue): migrate stories to storybook for avatar component
carwack 653cd22
feat(vue): migrate stories to storybook for accordion component
carwack 92f2e9d
feat(vue): migrate stories to storybook for carousel component
carwack fceb51d
feat(vue): migrate stories to storybook for checkbox
carwack c95516d
feat(vue): migrate stories to storybook for clipboard
carwack 468c054
feat(vue): migrate stories to storybook for collapsible
carwack 1277abf
feat(vue): migrate stories to storybook for color picker
carwack 126f68d
feat(vue) migrate stories to storybook for combobox
carwack 4b80030
feat(vue): migrate stories to storybook for date picker
carwack 4dc4261
feat(vue): migrate stories to storybook for dialog
carwack 1fb718f
feat(vue): migrate stories to storybook for editable
carwack 05ea86f
feat(vue): migrate stories to storybook for field
carwack f7df932
feat(vue): migrate stories to storybook for fieldset
carwack a4d907a
feat(vue): migrate stories to storybook for file upload
carwack 37372a2
feat(vue): migrate stories to storybook for focus trap
carwack 4da62ad
feat(vue): migrate stories to storybook for format
carwack b09310b
feat(vue): migrate stories to storybook for frame
carwack dd8dbb1
feat(vue): migrate stories to storybook for highlight
carwack 945f142
feat(vue): migrate stories to storybook for hover card
carwack 483acd3
refactor(vue): add Components / to storybook meta title
carwack c35b5cc
feat(vue): migrate stories to storybook for menu
carwack 066978d
feat(vue): migrate stories to storybook for number input
carwack cd598ee
feat(vue): migrate stories to storybook for pagination
carwack 00bccb1
feat(vue): migrate stories to storybook for pin input
carwack 948374a
feat(vue): migrate stories to storybook for popover
carwack 0a4e191
feat(vue): migrate stories to storybook for presence
carwack 0af6c0e
feat(vue): migrate stories to storybook for qr code
carwack c307f65
feat(vue): migrate stories to storybook for radio group
carwack 6f7e327
feat(vue): migrate stories to storybook for rating group
carwack 8eb0849
feat(vue): migrate stories to storbook for segment group
carwack 4749d5c
feat(vue): migratie stories to storybook for select
carwack 823e390
feat(vue): migrate stories to storybook for signature pad
carwack 16aad1d
feat(vue): migrate stories to storybook for slider
carwack 881fe52
feat(vue): migrate stories to storybook for splitter
carwack feb0908
feat(vue): migreate stories to storybook for steps
carwack bb0235e
feat(vue): migrate stories to storybook for switch
carwack 45e1201
feat(vue): migrate stories to storybook for tabs
carwack 3cae345
feat(vue): migrate stories to storybook for tags input
carwack ee0492b
feat(vue): migrate stories to storybook for time picker
carwack 4c40518
feat(vue): migrate stories to storybook for timer
carwack b6fc1bf
feat(vue): migrate stories to storybook for toast
carwack f384a7e
feat(vue): migrate stories to storybook for toggle
carwack bd27f80
feat(vue): migreate stories to storybook for toggle group
carwack 84c2c53
feat(vue): migrate stories to storybook for tooltip
carwack 09ad3ed
feat(vue): migrate stories to storybook for tour
carwack abbe472
feat(vue): migrate stories to storybook for tree view
carwack 886d8e0
feat(vue): migrate stories to storybook for environment
carwack 43d5994
feat(vue): migrate stories to storybook for locale
carwack 57e4dd3
feat(vue): migrate stories to storybook for progress
carwack 1d77784
chore(vue): remove histoire from repo
carwack 20627cb
Merge remote-tracking branch 'origin/main' into feat/add-vue-storybook
carwack debd9e0
refactor(stories): update stories with args and emits for accordion a…
carwack fd1d80e
feat(storybook): enable addon actions
carwack 7025dec
feat(storybook): create emitHandlers type to format tuple to function…
carwack 8b9e9e4
refactor(storybook): use EmitHandlers type for better TS support
carwack 9b4202a
feat(angle-slider): add storybook stories
carwack aabca2d
feat(angle-slider): remove histoire stories
carwack 7a60330
refactor(download-trigger): change to storybook stories
carwack affd868
feat(combobox): update stories
carwack 027f80b
refactor(floating-panel): change to storybook stories
carwack cb8ce5c
refactor(vue): add space in storybook title
carwack 5291feb
refactor(listbox): change to storybook stories
carwack ed8ddb2
refactor(password-input): change to storybook stories
carwack 51a470c
feat(toast): add all examples to stories
carwack a673fff
feat(tour): add all examples to stories
carwack 4ddf23b
feat(tree-view): add all examples to stories
carwack baa48ef
feat(environment): add all examples to stories
carwack 5e99bbd
feat(locale): add all examples to stories
carwack 212d766
feat(file-upload): add all examples to stories
carwack 9d13c83
feat(format): add all examples to stories
carwack 307359f
feat(presence): add all examples to stories
carwack dcdbe1d
feat(splitter): add all examples to stories
carwack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,4 +311,5 @@ vite.config.mts.timestamp-* | |
| *.prompt.md | ||
|
|
||
| # Solid Start | ||
| .vinxi | ||
| .vinxi | ||
| *storybook.log | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,40 @@ | ||
| import './main.css' | ||
| import type { StorybookConfig } from '@storybook/vue3-vite' | ||
|
|
||
| const config: StorybookConfig = { | ||
| stories: ['../src/**/*.stories.ts'], | ||
| addons: [ | ||
| { | ||
| name: '@storybook/addon-essentials', | ||
| options: { backgrounds: false, controls: false, actions: false }, | ||
| }, | ||
| '@storybook/addon-a11y', | ||
| ], | ||
| framework: { | ||
| name: '@storybook/vue3-vite', | ||
| options: {}, | ||
| }, | ||
| core: { | ||
| disableTelemetry: true, | ||
| }, | ||
| docs: { | ||
| autodocs: false, | ||
| }, | ||
|
|
||
|
|
||
| // TODO: fix this when vue-docgen accepts types from other packages in components | ||
| // This is a workaround until vue-docgen-plugin is fixed since we also dont use autodocs | ||
| // This removes the plugin vue-docgen-plugin so it wont load and throws an error on the use of an type import like | ||
| // import { Avatar, type AvatarRootEmits, type AvatarRootProps } from '@ark-ui/vue/avatar' | ||
| // using options: { docgen: "vue-component-meta",} throws other errors with node_modules/@zag-js/avatar/dist/index.mjs.vue' | ||
| // could not be found. This could be a fix for the vue-docgen-plugin error but it is not working for now | ||
| viteFinal(config) { | ||
| const vueDocgenIndex = config.plugins?.findIndex((plugin) => | ||
| plugin && typeof plugin === 'object' && 'name' in plugin && plugin.name === 'storybook:vue-docgen-plugin' | ||
| ) ?? -1 | ||
| if (vueDocgenIndex !== -1) config.plugins?.splice(vueDocgenIndex, 1) | ||
| return config | ||
| } | ||
| } | ||
|
|
||
|
|
||
| export default config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import type { Preview } from '@storybook/vue3' | ||
| import './main.css' | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| options: { | ||
| storySort: { | ||
| method: 'alphabetical', | ||
| }, | ||
| }, | ||
| layout: 'padded', | ||
| }, | ||
| } | ||
|
|
||
| export default preview |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
packages/vue/src/components/accordion/accordion.stories.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import type { Meta } from '@storybook/vue3' | ||
|
|
||
| import AccordionExample from './examples/accordion.vue' | ||
| import BasicExample from './examples/basic.vue' | ||
| import CollapsibleExample from './examples/collapsible.vue' | ||
| import ContextFocusedValueExample from './examples/context/focusedValue.vue' | ||
| import ContextGetItemStateExample from './examples/context/getItemState.vue' | ||
| import ContextSetValueExample from './examples/context/setValue.vue' | ||
| import ContextValueExample from './examples/context/value.vue' | ||
| import ControlledExample from './examples/controlled.vue' | ||
| import DisabledExample from './examples/disabled.vue' | ||
| import HorizontalExample from './examples/horizontal.vue' | ||
| import MultipleExample from './examples/multiple.vue' | ||
| import RenderPropExample from './examples/render-prop.vue' | ||
| import RootProviderExample from './examples/root-provider.vue' | ||
| import VerticalExample from './examples/vertical.vue' | ||
|
|
||
| const meta = { | ||
| title: 'Components / Accordion', | ||
| } as Meta | ||
|
|
||
| export default meta | ||
|
|
||
| export const Basic = { | ||
| render: () => ({ | ||
| components: { BasicExample }, | ||
| template: '<BasicExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const RenderProp = { | ||
| render: () => ({ | ||
| components: { RenderPropExample }, | ||
| template: '<RenderPropExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Collapsible = { | ||
| render: () => ({ | ||
| components: { CollapsibleExample }, | ||
| template: '<CollapsibleExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Multiple = { | ||
| render: () => ({ | ||
| components: { MultipleExample }, | ||
| template: '<MultipleExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Controlled = { | ||
| render: () => ({ | ||
| components: { ControlledExample }, | ||
| template: '<ControlledExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Vertical = { | ||
| render: () => ({ | ||
| components: { VerticalExample }, | ||
| template: '<VerticalExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Horizontal = { | ||
| render: () => ({ | ||
| components: { HorizontalExample }, | ||
| template: '<HorizontalExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Disabled = { | ||
| render: () => ({ | ||
| components: { DisabledExample }, | ||
| template: '<DisabledExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Closed = { | ||
| render: () => ({ | ||
| components: { AccordionExample }, | ||
| template: `<AccordionExample multiple :items="['React', 'Solid', 'Vue']" />`, | ||
| }), | ||
| } | ||
|
|
||
| export const RootProvider = { | ||
| render: () => ({ | ||
| components: { RootProviderExample }, | ||
| template: '<RootProviderExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const ContextFocusedValue = { | ||
| render: () => ({ | ||
| components: { ContextFocusedValueExample }, | ||
| template: '<ContextFocusedValueExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const ContextValue = { | ||
| render: () => ({ | ||
| components: { ContextValueExample }, | ||
| template: '<ContextValueExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const ContextSetValue = { | ||
| render: () => ({ | ||
| components: { ContextSetValueExample }, | ||
| template: '<ContextSetValueExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const ContextGetItemState = { | ||
| render: () => ({ | ||
| components: { ContextGetItemStateExample }, | ||
| template: '<ContextGetItemStateExample />', | ||
| }), | ||
| } | ||
62 changes: 0 additions & 62 deletions
62
packages/vue/src/components/accordion/accordion.stories.vue
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import type { Meta } from '@storybook/vue3' | ||
|
|
||
| import BasicExample from './examples/basic.vue' | ||
| import ClosedExample from './examples/closed.vue' | ||
| import EventsExample from './examples/events.vue' | ||
| import RootProviderExample from './examples/root-provider.vue' | ||
|
|
||
| const meta = { | ||
| title: 'Components / Avatar', | ||
| } as Meta | ||
|
|
||
| export default meta | ||
|
|
||
| export const Basic = { | ||
| render: () => ({ | ||
| components: { BasicExample }, | ||
| template: '<BasicExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Events = { | ||
| render: () => ({ | ||
| components: { EventsExample }, | ||
| template: '<EventsExample />', | ||
| }), | ||
| } | ||
|
|
||
| export const Closed = { | ||
| render: () => ({ | ||
| components: { ClosedExample }, | ||
| template: ` | ||
| <ClosedExample | ||
| name="Christian" | ||
| src="https://avatars.githubusercontent.com/u/1846056?v=4" | ||
| @status-change="(e) => console.log(e.status)" | ||
| /> | ||
| `, | ||
| }), | ||
| } | ||
|
|
||
| export const RootProvider = { | ||
| render: () => ({ | ||
| components: { RootProviderExample }, | ||
| template: '<RootProviderExample />', | ||
| }), | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carwack
I don't know but having the template as a
stringfeels not great from a DX perspective, as errors can easily happen. Is there an alternative to this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw this review, thanks for creating it and sorry for the long wait on a response.
I don't know yet, but I will take a look into it asap and see if there is an alternative!
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cschroeter
I have been looking into it. Mainly checked the docs of Storybook. For Vue it seems that we either have to set the most complex component of the examples as the reference in the meta and then be able to just set the args for that story. The other stories still need to have the template set.
Alternative is using the args like this:
https://storybook.js.org/docs/api/csf
Altho it's mostly needed like that when we have
closedcomponent examples. Other examples are mostly just the template like:I feel like the 2nd option is the best here. What do you think of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into implementing the 2nd option in this PR asap. @cschroeter