Skip to content

Commit ad0fa83

Browse files
committed
Migrate to storybook 8
1 parent b4fdf7a commit ad0fa83

File tree

15 files changed

+2657
-1760
lines changed

15 files changed

+2657
-1760
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"stylelint:check": "stylelint --cache \"packages/lab-example/style/**/*.css\""
3434
},
3535
"devDependencies": {
36-
"@typescript-eslint/eslint-plugin": "^5.55.0",
37-
"@typescript-eslint/parser": "^5.55.0",
36+
"@typescript-eslint/eslint-plugin": "^6.0.0",
37+
"@typescript-eslint/parser": "^6.0.0",
3838
"eslint": "^8.36.0",
3939
"eslint-config-prettier": "^8.8.0",
4040
"eslint-plugin-prettier": "^5.0.0",

packages/components/.storybook/main.js renamed to packages/components/.storybook/main.mjs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { dirname, join } from 'path';
22
import remarkGfm from 'remark-gfm';
3-
const ResolveTypescriptPlugin = require('resolve-typescript-plugin');
3+
import { default as ResolveTypescriptPlugin} from 'resolve-typescript-plugin';
44

5-
module.exports = {
5+
const config = {
66
stories: [
77
'../docs/**/*.mdx',
88
'../src/**/*.mdx',
9-
'../src/**/*.stories.mdx',
9+
'../src/**/*.mdx',
1010
'../src/**/*.stories.ts'
1111
],
1212
addons: [
@@ -15,14 +15,16 @@ module.exports = {
1515
options: {
1616
mdxPluginOptions: {
1717
mdxCompileOptions: {
18-
remarkPlugins: [remarkGfm]
18+
// FIXME
19+
// remarkPlugins: [remarkGfm]
1920
}
2021
}
2122
}
2223
},
2324
getAbsolutePath('@storybook/addon-links'),
2425
getAbsolutePath('@storybook/addon-essentials'),
25-
getAbsolutePath('@storybook/addon-a11y')
26+
getAbsolutePath('@storybook/addon-a11y'),
27+
'@storybook/addon-webpack5-compiler-swc'
2628
],
2729
webpackFinal: async config => {
2830
if (!config.resolve.plugins) {
@@ -54,11 +56,12 @@ module.exports = {
5456
options: {}
5557
},
5658
docs: {
57-
autodocs: true,
5859
defaultName: 'Documentation'
5960
}
6061
};
6162

6263
function getAbsolutePath(value) {
6364
return dirname(require.resolve(join(value, 'package.json')));
6465
}
66+
67+
export default config;

packages/components/.storybook/manager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addons } from '@storybook/addons';
1+
import { addons } from '@storybook/manager-api';
22
import customTheme from './customTheme';
33

44
addons.setConfig({

packages/components/.storybook/preview.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { withTheme } from '../src/utilities/storybook';
66
JupyterComponents;
77

88
const parameters = {
9-
actions: { argTypesRegex: '^on[A-Z].*' },
9+
// actions: { argTypesRegex: '^on[A-Z].*' },
1010
options: {
1111
storySort: {
1212
order: ['Docs', 'Library']
@@ -71,7 +71,8 @@ const globalTypes = {
7171
const preview = {
7272
parameters,
7373
globalTypes,
74-
decorators: [withTheme]
74+
decorators: [withTheme],
75+
tags: ['autodocs']
7576
};
7677

7778
export default preview;

packages/components/package.json

+14-15
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,30 @@
5858
"@playwright/test": "^1.35.1",
5959
"@rollup/plugin-commonjs": "^17.1.0",
6060
"@rollup/plugin-node-resolve": "^11.2.0",
61-
"@storybook/addon-a11y": "^7.5.3",
62-
"@storybook/addon-actions": "^7.5.3",
63-
"@storybook/addon-docs": "^7.5.3",
64-
"@storybook/addon-essentials": "^7.5.3",
65-
"@storybook/addon-links": "^7.5.3",
66-
"@storybook/addons": "^7.5.3",
67-
"@storybook/blocks": "^7.5.3",
68-
"@storybook/html": "^7.5.3",
69-
"@storybook/html-webpack5": "^7.5.3",
70-
"@storybook/theming": "^7.5.3",
61+
"@storybook/addon-a11y": "^8.1.9",
62+
"@storybook/addon-actions": "^8.1.9",
63+
"@storybook/addon-docs": "^8.1.9",
64+
"@storybook/addon-essentials": "^8.1.9",
65+
"@storybook/addon-links": "^8.1.9",
66+
"@storybook/addon-webpack5-compiler-swc": "^1.0.3",
67+
"@storybook/blocks": "^8.1.9",
68+
"@storybook/html": "^8.1.9",
69+
"@storybook/html-webpack5": "^8.1.9",
70+
"@storybook/manager-api": "^8.1.9",
71+
"@storybook/theming": "^8.1.9",
7172
"@types/jest": "^29.0.0",
7273
"@types/node": "^18.0.0",
7374
"@types/webpack-env": "^1.15.2",
74-
"@typescript-eslint/eslint-plugin": "^5.60.1",
75+
"@typescript-eslint/eslint-plugin": "^6.0.0",
7576
"custom-element-react-wrappers": "^1.6.0",
7677
"eslint": "^8.43.0",
7778
"eslint-config-prettier": "^8.8.0",
7879
"eslint-plugin-import": "^2.25.2",
79-
"eslint-plugin-storybook": "^0.6.15",
80+
"eslint-plugin-storybook": "^0.8.0",
8081
"gh-pages": "^5.0.0",
8182
"jest": "^29.5.0",
8283
"jest-environment-jsdom": "^29.3.0",
8384
"prettier": "^3.0.0",
84-
"react": "^18.2.0",
85-
"react-dom": "^18.2.0",
8685
"remark-gfm": "^3.0.1",
8786
"resolve-typescript-plugin": "^1.1.5",
8887
"rimraf": "^5.0.1",
@@ -92,7 +91,7 @@
9291
"rollup-plugin-terser": "^7.0.2",
9392
"rollup-plugin-transform-tagged-template": "0.0.3",
9493
"rollup-plugin-typescript2": "^0.27.0",
95-
"storybook": "^7.5.3",
94+
"storybook": "^8.1.9",
9695
"ts-jest": "^29.1.0",
9796
"ts-loader": "^9.4.3",
9897
"tsc-esm-fix": "^2.20.21",

packages/components/src/anchored-region/anchored-region.stories.mdx renamed to packages/components/src/anchored-region/anchored-region.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta } from '@storybook/addon-docs';
1+
import { Meta } from '@storybook/blocks';
22

33
<Meta title="Components/Anchored Region" />
44

packages/components/src/button/button.stories.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getFaIcon } from '../utilities/storybook/index.js';
66

77
export default {
88
title: 'Components/Button',
9+
tags: ['!autodocs'],
910
argTypes: {
1011
label: { control: 'text' },
1112
appearance: {

packages/components/src/date-field/date-field.form-associated.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
import { FormAssociated, FoundationElement } from '@microsoft/fast-foundation';
55

6+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
67
class _DateField extends FoundationElement {}
7-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
8+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging, @typescript-eslint/no-empty-interface
89
interface _DateField extends FormAssociated {}
910

1011
/**

packages/components/src/date-field/date-field.ts

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const INVALID_DATE = 'Invalid Date';
4242
* @fires input - Fires a custom 'input' event when the value has changed
4343
* @fires change - Fires a custom 'change' event when the value has changed
4444
*/
45+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
4546
export class DateField extends FormAssociatedDateField {
4647
/**
4748
* The appearance of the element.
@@ -355,5 +356,6 @@ export class DateField extends FormAssociatedDateField {
355356
* TODO: https://github.com/microsoft/fast/issues/3317
356357
* @internal
357358
*/
359+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
358360
export interface DateField extends StartEnd, DelegatesARIATextbox {}
359361
applyMixins(DateField, StartEnd, DelegatesARIATextbox);

packages/components/src/drafts/picker/picker.stories.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import { Meta, StoryFn, StoryObj } from '@storybook/html';
66

77
export default {
8-
title: 'Components/Picker',
8+
title: 'Drafts/Picker',
9+
tags: ['!autodocs'],
910
parameters: {
1011
controls: { expanded: true }
1112
},

packages/components/src/toolbar/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const ToolbarArrowKeyMap = Object.freeze({
7575
*
7676
* @public
7777
*/
78+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
7879
export class FoundationToolbar extends FoundationElement {
7980
/**
8081
* The internal index of the currently focused element.
@@ -353,6 +354,7 @@ export class FoundationToolbar extends FoundationElement {
353354
*
354355
* @public
355356
*/
357+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
356358
export class DelegatesARIAToolbar {
357359
/**
358360
* The id of the element labeling the toolbar.
@@ -380,13 +382,14 @@ export class DelegatesARIAToolbar {
380382
* TODO: https://github.com/microsoft/fast/issues/3317
381383
* @internal
382384
*/
383-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
385+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging, @typescript-eslint/no-empty-interface
384386
export interface DelegatesARIAToolbar extends ARIAGlobalStatesAndProperties {}
385387
applyMixins(DelegatesARIAToolbar, ARIAGlobalStatesAndProperties);
386388

387389
/**
388390
* @internal
389391
*/
392+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
390393
export interface FoundationToolbar extends StartEnd, DelegatesARIAToolbar {}
391394
applyMixins(FoundationToolbar, StartEnd, DelegatesARIAToolbar);
392395

packages/components/src/tooltip/tooltip.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
delay: {
1515
description: 'Delay to display the tooltip (in ms)',
1616
table: {
17-
defaultValue: { summary: 300 }
17+
defaultValue: { summary: '300' }
1818
},
1919
control: { type: 'range', min: 0, max: 2000, step: 100 }
2020
}

packages/components/tsconfig.storybook.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"exclude": [
55
"node_modules",
66
"src/**/*.spec.ts",
7-
"src/**/*.stories.mdx",
87
"src/**/*.test.ts",
98
"playwright.config.ts"
109
]

packages/lab-example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
"devDependencies": {
6161
"@jupyterlab/builder": "^4.0.0",
6262
"@types/react": "^18.2.0",
63-
"@typescript-eslint/eslint-plugin": "^5.60.1",
64-
"@typescript-eslint/parser": "^5.60.1",
63+
"@typescript-eslint/eslint-plugin": "^6.0.0",
64+
"@typescript-eslint/parser": "^6.0.0",
6565
"css-loader": "^6.7.1",
6666
"eslint": "^8.43.0",
6767
"eslint-config-prettier": "^8.8.0",

0 commit comments

Comments
 (0)