Skip to content

Commit

Permalink
Migration to Storybook 8
Browse files Browse the repository at this point in the history
  • Loading branch information
olliecurtis committed Jun 19, 2024
1 parent 45b087e commit 80f8051
Show file tree
Hide file tree
Showing 11 changed files with 1,054 additions and 568 deletions.
8 changes: 3 additions & 5 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ const config: StorybookConfig = {
'@storybook/addon-docs',
'@storybook/addon-interactions',
'@storybook/addon-viewport',
'@storybook/addon-webpack5-compiler-babel'
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: true,
defaultName: 'Documentation',
defaultName: 'Documentation'
},
typescript: {
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldIncludePropTagMap: true,
propFilter: (prop) => {
Expand All @@ -48,8 +49,5 @@ const config: StorybookConfig = {
},
},
},
features: {
storyStoreV7: false, // TODO: Remove this. Temporarily opt out of on-demand story loading as it blocks Percy from running tests
},
};
export default config;
12 changes: 8 additions & 4 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title } from '@storybook/blocks';

import '../packages/bpk-stylesheets';
import '../packages/bpk-stylesheets/font';
Expand Down Expand Up @@ -64,6 +64,7 @@ const preview: Preview = {
</div>
)},
],

parameters: {
docs: {
source: {
Expand All @@ -72,14 +73,17 @@ const preview: Preview = {
page: () => (
<>
<Title />
<ArgsTable story={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']}/>
</>
)
},
},

args: {
zoomEnabled: false,
}
},

tags: ['autodocs']
};

export default preview;
6 changes: 3 additions & 3 deletions examples/bpk-component-aria-live/stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkAriaLive from '../../packages/bpk-component-aria-live/src/BpkAriaLive';

Expand All @@ -31,7 +31,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{`**Note:** \`aria-relevant\` and \`aria-atomic\` props can also be set.
\`aria-relevant\` determines what sort of changes should be read out. By default it is \`text\` but can be \`additions\`, \`removals\` or \`all\`. [Read more about \`aria-relevant\` on MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant).
Expand Down
8 changes: 4 additions & 4 deletions examples/bpk-component-autosuggest/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { userEvent, within } from '@storybook/testing-library';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';
import { userEvent, within } from '@storybook/test';

import BpkAutosuggest from '../../packages/bpk-component-autosuggest/src/BpkAutosuggest';
import BpkAutosuggestSuggestion from '../../packages/bpk-component-autosuggest/src/BpkAutosuggestSuggestion';
Expand All @@ -38,7 +38,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{
`**BpkAutosuggest:**
Expand Down
6 changes: 3 additions & 3 deletions examples/bpk-component-image/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, PRIMARY_STORY, Markdown } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkBackgroundImage from '../../packages/bpk-component-image/src/BpkBackgroundImage';
import BpkImage from '../../packages/bpk-component-image/src/BpkImage';
Expand All @@ -44,7 +44,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{`**Note:** All [standard img attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#Attributes) including \`srcSet\` are also supported.`}
</Markdown>
Expand Down
6 changes: 3 additions & 3 deletions examples/bpk-component-input/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkInput from '../../packages/bpk-component-input/src/BpkInput';

Expand Down Expand Up @@ -50,7 +50,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{
`**Note:** Additionally, all native \`input\` attributes such as \`placeholder\` and \`onChange\` are supported.`
Expand Down
6 changes: 3 additions & 3 deletions examples/bpk-component-slider/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkSlider from '../../packages/bpk-component-slider/src/BpkSlider';

Expand All @@ -38,7 +38,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{`
**Note**: minDistance and step props are multiplied to calculate the minimum distance allowed between thumbs
Expand Down
6 changes: 3 additions & 3 deletions examples/bpk-component-switch/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkSwitch from '../../packages/bpk-component-switch/src/BpkSwitch';

Expand All @@ -31,7 +31,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{
`This component uses a hidden [\`input type=checkbox\`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox), so it supports all the same properties as it (for example \`checked\`).`
Expand Down
6 changes: 3 additions & 3 deletions examples/bpk-scrim-utils/stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/


import { ArgsTable } from '@storybook/addon-docs';
import { Title, Markdown, PRIMARY_STORY } from '@storybook/blocks';
import { ArgTypes } from '@storybook/addon-docs';
import { Title, Markdown } from '@storybook/blocks';

import BpkScrim from '../../packages/bpk-scrim-utils/src/BpkScrim';

Expand All @@ -37,7 +37,7 @@ export default {
page: () => (
<>
<Title />
<ArgsTable of={PRIMARY_STORY} />
<ArgTypes exclude={['zoomEnabled']} />
<Markdown>
{`\`withScrim\` sends all props it receives down to the component, except \`getApplicationElement\` and \`padded\`. It also adds some props that are used for a11y and closing the modal:
\`dialogRef\` should be set as the ref on the visible container on top of the scrim; it is used to set focus, \`onClose\` , \`isIphone\``}
Expand Down
Loading

0 comments on commit 80f8051

Please sign in to comment.