Skip to content
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

Storybook 7 upgrade #1134

Merged
merged 47 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bcb0ec4
initial SB 7 attempt
fredvisser Jan 11, 2023
4cbf3ad
latest SB 7 RC
fredvisser Mar 22, 2023
61ae554
Return function type instead of StoryFn
jattasNI Mar 24, 2023
c08c026
Re-enable all stories
jattasNI Mar 24, 2023
428e4ef
Workaround for storybook build error
jattasNI Mar 24, 2023
bbd9a70
Temporary workaround for comments
jattasNI Mar 24, 2023
1e12d2b
Merge branch 'main' into users/fvisser/upgrade-to-storybook-7-beta
jattasNI Mar 24, 2023
6d52adb
Fix incorrect package.json merge
jattasNI Mar 24, 2023
9104da9
Regenerate package-lock after merge
jattasNI Mar 24, 2023
a4dc769
Remove design-token comments workaround
jattasNI Mar 24, 2023
37dff6b
Re-enable build and fix errors in new stories
jattasNI Mar 24, 2023
ac91540
storyName -> name in new story
jattasNI Mar 24, 2023
8d66809
Improve wafer map title
jattasNI Mar 24, 2023
4e44c74
Enable autodocs
jattasNI Mar 24, 2023
8987f52
Enable autodocs for token stories
jattasNI Mar 24, 2023
d5dd00a
Wafer Map title in tests
jattasNI Mar 24, 2023
0721fbc
Fix table action menu matrix rendering
jattasNI Mar 24, 2023
8e9848f
Re-enable theme switcher
jattasNI Mar 24, 2023
7ade7fa
format
jattasNI Mar 24, 2023
5e4ed3c
Revert WaferMap name change to keep test stable
jattasNI Mar 24, 2023
e36191c
Remove XD Design docs
jattasNI Mar 24, 2023
c9dbfcb
Revert wafer map name change for Chromatic diff
jattasNI Mar 27, 2023
102991b
Fix table user icon
jattasNI Mar 27, 2023
dd55956
Fix anchor menu item story typo
jattasNI Mar 27, 2023
0849bed
Typos in menu matrix story
jattasNI Mar 27, 2023
f52cb03
rc.6 -> rc.8
jattasNI Mar 27, 2023
a6079a2
Fix button matrix story rename
jattasNI Mar 27, 2023
d658085
Fix package.json sorting
jattasNI Mar 27, 2023
32a8b75
Fix nested menu positioning
jattasNI Mar 28, 2023
a44f1c2
Change files
jattasNI Mar 28, 2023
c79209e
Add docs
jattasNI Mar 28, 2023
36a1618
Configure autodocs only for non-test stories
jattasNI Mar 28, 2023
154f7db
Merge branch 'main' into users/fvisser/upgrade-to-storybook-7-beta
jattasNI Mar 28, 2023
15ae563
Update intro story for new Storybook appearance
jattasNI Mar 29, 2023
ee48e61
Merge branch 'main' into users/fvisser/upgrade-to-storybook-7-beta
jattasNI Mar 29, 2023
adc9a11
remove artboardUrl parameter used with xd addon
fredvisser Mar 29, 2023
7542b58
remove extra whitespace
fredvisser Mar 29, 2023
222fd21
remove rest of artboardUrls
fredvisser Mar 29, 2023
50c56fd
more whitespace
fredvisser Mar 29, 2023
a64d007
Remove unneeded autodocs config
jattasNI Mar 30, 2023
0822aef
Improve change comment
jattasNI Mar 30, 2023
b97433e
Re-add flag for pre-build storybook
jattasNI Mar 30, 2023
2f39b07
Merge branch 'main' into users/fvisser/upgrade-to-storybook-7-beta
jattasNI Mar 30, 2023
e08ed04
Apply patch to workaround storybook bug
jattasNI Mar 30, 2023
399fa5c
Remove @babel/preset-typescript and react deps
jattasNI Mar 30, 2023
321cdd3
peer dep instead of dev dep for patched package
jattasNI Mar 31, 2023
bd558ff
Remove babel config and preset-env
jattasNI Mar 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add missing anchored region import to menu component",
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
"packageName": "@ni/nimble-components",
"email": "jattasNI@users.noreply.github.com",
"dependentChangeType": "patch"
}
78,062 changes: 29,481 additions & 48,581 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions packages/nimble-components/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript"
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
],
"plugins": []
}
15 changes: 5 additions & 10 deletions packages/nimble-components/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const CircularDependencyPlugin = require('circular-dependency-plugin');

module.exports = {
core: {
builder: 'webpack5'
},
stories: ['../src/**/*.stories.@(ts|mdx)', '../docs/**/*.stories.mdx'],
addons: [
{
Expand All @@ -12,14 +9,9 @@ module.exports = {
outline: false
}
},
'storybook-addon-xd-designs',
'@storybook/addon-a11y',
'@storybook/addon-interactions'
],
features: {
previewCsfV3: true,
previewMdx2: true
},
webpackFinal: config => {
config.module.rules.push({
test: /\.ts$/,
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -38,8 +30,11 @@ module.exports = {
config.performance = {
hints: false
};

return config;
},
staticDirs: ['public']
staticDirs: ['public'],
framework: {
name: '@storybook/html-webpack5',
options: {}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Add a `docs.description.component` string to the component `parameters` object.
```ts
const metadata: Meta<ComponentArgs> = {
title: 'SomeComponent',
decorators: [withXD],
parameters: {
docs: {
description: {
Expand Down
9 changes: 3 additions & 6 deletions packages/nimble-components/docs/nimble-intro.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Refer to the
contributing to the component library. To add or update component design documentation,
refer to the [documentation guide](https://github.com/ni/nimble/tree/main/packages/nimble-components/docs/creating-storybook-component-documentation.md).

/* The following links only works when published to Chomatic or GitHub Pages, not when running Storybook locally */
See the <a href="./example-client-app" target="_blank">example Angular app</a> or <a href="./blazor-client-app/wwwroot" target="_blank">example Blazor app</a> using the components!

## How to use this site?
Expand All @@ -45,12 +44,10 @@ design system components.

<img src={overviewImage} width="100%"/>

- **Canvas** tab (**#1**) to preview isolated components and use the **Docs** tab to review
- Browse or search the components tree (**#1**) to preview isolated components and use the **Docs** item to review
component-specific design and technical usage information.
- ** menu** (**#3**) to open and position the addons pane (**#4**).
- ** menu** (**#2**) to open and position the addons pane (**#3**).
- **Controls** tab to interactively configure the component.
- **Actions** tab to review events sent by the component.
- **XD Design** tab to review the component design page.
- **Accessibility** tab to check the component for accessibility issues.
- **Interactions** tab to simulate component interactions.
- **Background** toolbar button (**#2**) to switch the preview between supported component themes.
- **Background** toolbar button (**#4**) to switch the preview between supported component themes.
Binary file modified packages/nimble-components/docs/storybook-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 19 additions & 16 deletions packages/nimble-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"prettier-fix": "prettier-eslint \"**/*.*\" --write --prettier-ignore",
"pack": "npm pack",
"invoke-publish": "npm publish",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook -o dist/storybook --webpack-stats-json",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build -o dist/storybook",
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
"storybook-open-webkit": "playwright wk http://localhost:6006",
"build-components": "tsc -p ./tsconfig.json",
"build-components:watch": "tsc -p ./tsconfig.json -w",
Expand Down Expand Up @@ -71,25 +71,25 @@
"@babel/cli": "^7.13.16",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@mdx-js/react": "^2.2.1",
"@babel/preset-typescript": "^7.18.6",
"@ni/eslint-config-javascript": "^4.2.0",
"@ni/eslint-config-typescript": "^4.2.0",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@storybook/addon-a11y": "^6.5.10",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-docs": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-links": "^6.5.10",
"@storybook/addons": "^6.5.10",
"@storybook/builder-webpack5": "^6.5.10",
"@storybook/html": "^6.5.10",
"@storybook/manager-webpack5": "^6.5.10",
"@storybook/mdx2-csf": "^0.0.4",
"@storybook/theming": "^6.5.10",
"@storybook/addon-a11y": "^7.0.0-rc.8",
"@storybook/addon-actions": "^7.0.0-rc.8",
"@storybook/addon-docs": "^7.0.0-rc.8",
"@storybook/addon-essentials": "^7.0.0-rc.8",
"@storybook/addon-interactions": "^7.0.0-rc.8",
"@storybook/addon-links": "^7.0.0-rc.8",
"@storybook/addons": "^7.0.0-rc.8",
"@storybook/cli": "^7.0.0-rc.8",
"@storybook/csf": "0.0.2-next.10",
"@storybook/html": "^7.0.0-rc.8",
"@storybook/html-webpack5": "^7.0.0-rc.8",
"@storybook/theming": "^7.0.0-rc.8",
"@types/jasmine": "^4.3.1",
"@types/webpack-env": "^1.15.2",
"babel-loader": "^ 9.1.2",
Expand All @@ -114,9 +114,12 @@
"prettier": "^2.0.0",
"prettier-eslint": "^15.0.1",
"prettier-eslint-cli": "^7.1.0",
"puppeteer": "^10.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
"rollup": "^3.10.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"storybook-addon-xd-designs": "^6.0.0",
"storybook": "^7.0.0-rc.8",
"ts-loader": "^9.2.5",
"typescript": "~4.6.4",
"webpack": "^5.75.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Meta, Story } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import type { StoryFn, Meta } from '@storybook/html';
import { html, ViewTemplate, when } from '@microsoft/fast-element';
import { pascalCase } from '@microsoft/fast-web-utilities';
import {
Expand All @@ -23,7 +22,7 @@ import { iconArrowExpanderRightTag } from '../../icons/arrow-expander-right';

const metadata: Meta = {
title: 'Tests/Anchor Button',
decorators: [withXD],

parameters: {
...sharedMatrixParameters(),
design: {
Expand Down Expand Up @@ -75,7 +74,7 @@ const component = (
</${anchorButtonTag}>
`;

export const anchorButtonThemeMatrix: Story = createMatrixThemeStory(
export const anchorButtonThemeMatrix: StoryFn = createMatrixThemeStory(
createMatrix(component, [
disabledStates,
appearanceStates,
Expand All @@ -84,15 +83,15 @@ export const anchorButtonThemeMatrix: Story = createMatrixThemeStory(
])
);

export const hiddenAnchorButton: Story = createStory(
export const hiddenAnchorButton: StoryFn = createStory(
hiddenWrapper(
html`<${anchorButtonTag} hidden
>Hidden Anchor Button</${anchorButtonTag}
>`
)
);

export const textCustomized: Story = createMatrixThemeStory(
export const textCustomized: StoryFn = createMatrixThemeStory(
textCustomizationWrapper(
html`<${anchorButtonTag}>Anchor Button</${anchorButtonTag}>`
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';

import { html, when } from '@microsoft/fast-element';
import { createUserSelectedThemeStory } from '../../utilities/tests/storybook';
import {
Expand Down Expand Up @@ -33,7 +33,8 @@ interface AnchorButtonArgs {

const metadata: Meta<AnchorButtonArgs> = {
title: 'Anchor Button',
decorators: [withXD],
tags: ['autodocs'],

parameters: {
docs: {
description: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Meta, Story } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import { html, ViewTemplate, when } from '@microsoft/fast-element';
import {
createMatrixThemeStory,
Expand All @@ -19,7 +18,6 @@ import { buttonTag } from '../../button';

const metadata: Meta = {
title: 'Tests/Anchor Tabs',
decorators: [withXD],
parameters: {
...sharedMatrixParameters(),
design: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { html, when } from '@microsoft/fast-element';
import type { Meta, StoryObj } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import { createUserSelectedThemeStory } from '../../utilities/tests/storybook';
import { anchorTabsTag } from '..';
import { anchorTabTag } from '../../anchor-tab';
Expand All @@ -21,7 +20,8 @@ tab panels hosted on the same page.`;

const metadata: Meta<TabsArgs> = {
title: 'Anchor Tabs',
decorators: [withXD],
tags: ['autodocs'],

parameters: {
docs: {
description: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Meta, Story } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import type { StoryFn, Meta } from '@storybook/html';
import { html, ViewTemplate } from '@microsoft/fast-element';
import { pascalCase } from '@microsoft/fast-web-utilities';
import {
Expand All @@ -18,9 +17,12 @@ import { anchorTag } from '..';

const metadata: Meta = {
title: 'Tests/Anchor',
decorators: [withXD],

parameters: {
...sharedMatrixParameters(),
docs: {
autodocs: false
jattasNI marked this conversation as resolved.
Show resolved Hide resolved
},
design: {
artboardUrl:
'https://xd.adobe.com/view/33ffad4a-eb2c-4241-b8c5-ebfff1faf6f6-66ac/screen/bfadf499-caf5-4ca0-9814-e777fbae0d46/specs/'
Expand Down Expand Up @@ -61,23 +63,23 @@ const component = (
${() => `${underlineHiddenName} ${appearanceName} ${disabledName} Link`}</${anchorTag}>
`;

export const anchorThemeMatrix: Story = createMatrixThemeStory(
export const anchorThemeMatrix: StoryFn = createMatrixThemeStory(
createMatrix(component, [
disabledStates,
underlineHiddenStates,
appearanceStates
])
);

export const hiddenAnchor: Story = createStory(
export const hiddenAnchor: StoryFn = createStory(
hiddenWrapper(html`<${anchorTag} hidden>Hidden Anchor</${anchorTag}>`)
);

export const textCustomized: Story = createMatrixThemeStory(
export const textCustomized: StoryFn = createMatrixThemeStory(
textCustomizationWrapper(html`<${anchorTag}>Link</${anchorTag}>`)
);

export const textWrapping: Story = createStory(
export const textWrapping: StoryFn = createStory(
// prettier-ignore
html`
<p style="width: 300px; border: 1px solid black">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';

import { html } from '@microsoft/fast-element';
import { createUserSelectedThemeStory } from '../../utilities/tests/storybook';
import { AnchorAppearance } from '../types';
Expand All @@ -21,7 +21,8 @@ interface AnchorArgs {

const metadata: Meta<AnchorArgs> = {
title: 'Anchor',
decorators: [withXD],
tags: ['autodocs'],

parameters: {
docs: {
description: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, Story } from '@storybook/html';
import type { StoryFn, Meta } from '@storybook/html';
import { html, ViewTemplate } from '@microsoft/fast-element';
import {
createMatrix,
Expand Down Expand Up @@ -93,11 +93,11 @@ const component = (
<div></div>
</div>`;

export const anchoredRegionThemeMatrix: Story = createStory(
export const anchoredRegionThemeMatrix: StoryFn = createStory(
createMatrix(component, [horizontalPositionStates, verticalPositionStates])
);

export const hiddenAnchoredRegion: Story = createStory(
export const hiddenAnchoredRegion: StoryFn = createStory(
hiddenWrapper(
html`<${anchoredRegionTag} hidden>Hidden Anchored Region</${anchoredRegionTag}>`
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Story, Meta } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import { html, ViewTemplate, when } from '@microsoft/fast-element';
import { pascalCase } from '@microsoft/fast-web-utilities';
import {
Expand All @@ -21,7 +20,6 @@ import { iconKeyTag } from '../../icons/key';

const metadata: Meta = {
title: 'Tests/Banner',
decorators: [withXD],
parameters: {
...sharedMatrixParameters(),
design: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Meta, StoryObj } from '@storybook/html';
import { withXD } from 'storybook-addon-xd-designs';
import { html, when } from '@microsoft/fast-element';
import { createUserSelectedThemeStory } from '../../utilities/tests/storybook';
import { BannerSeverity } from '../types';
Expand Down Expand Up @@ -42,7 +41,7 @@ should be spaced apart using the \`${bannerGapSize.cssCustomProperty}\` design t

const metadata: Meta<BannerArgs> = {
title: 'Banner',
decorators: [withXD],
tags: ['autodocs'],
parameters: {
docs: {
description: {
Expand Down Expand Up @@ -87,7 +86,7 @@ export const _banner: StoryObj<BannerArgs> = {
</${bannerTag}>
`),
// eslint-disable-next-line storybook/no-redundant-story-name
storyName: 'Banner',
name: 'Banner',
argTypes: {
open: {
description: 'Controls whether the banner is visible.'
Expand Down
Loading