Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c2a3b13
feat: add storybook config
TristanWatanabe Nov 10, 2022
bb488a3
Add Accordion stories
TristanWatanabe Nov 10, 2022
f0a6245
Add Alert Stories
TristanWatanabe Nov 10, 2022
df9c06e
Add Animation Stories
TristanWatanabe Nov 10, 2022
82d1683
Add Attachment Stories and fix steps for Alert
TristanWatanabe Nov 10, 2022
a0b1865
Add Avatar Stories
TristanWatanabe Nov 10, 2022
5467a67
Add Box and Breadcrumb stories
TristanWatanabe Nov 10, 2022
7b5b5ac
Add Button stories
TristanWatanabe Nov 10, 2022
75384e2
Fix story names of components with interaction tests
TristanWatanabe Nov 10, 2022
090fda9
Add Card stories
TristanWatanabe Nov 10, 2022
a786bfe
Add Carousel stories
TristanWatanabe Nov 10, 2022
24dd13a
Add Chat stories
TristanWatanabe Nov 10, 2022
a55176f
add Checkbox stories
TristanWatanabe Nov 10, 2022
b649e1a
Add DatePicker stories
TristanWatanabe Nov 10, 2022
31609e3
add Dialog stories
TristanWatanabe Nov 10, 2022
fc099b8
add Divider stories
TristanWatanabe Nov 10, 2022
108a1e6
Add Embed, Flex, Form, Grid, Header and Image stories
TristanWatanabe Nov 10, 2022
8c9a507
Add Dropdown stories
TristanWatanabe Nov 10, 2022
3c64839
Add Input stories
TristanWatanabe Nov 10, 2022
d22a9fa
Add ItemLayout stories
TristanWatanabe Nov 10, 2022
1f77011
Add Label and Layout stories
TristanWatanabe Nov 10, 2022
e64c788
Add List stories
TristanWatanabe Nov 10, 2022
6393001
Add Loader stories
TristanWatanabe Nov 10, 2022
3613527
Add Menu stories
TristanWatanabe Nov 11, 2022
c3c1a63
Add MenuButton stories
TristanWatanabe Nov 11, 2022
6a60349
Add Pill stories
TristanWatanabe Nov 11, 2022
ea94fc9
Add Popup stories
TristanWatanabe Nov 11, 2022
0740458
Add Portal stories
TristanWatanabe Nov 11, 2022
15f4dbf
Add Provider stories
TristanWatanabe Nov 11, 2022
445a2e5
Add RadioGroup stories
TristanWatanabe Nov 11, 2022
941a34c
Add Reaction, Ref, Segment and Skeleton stories
TristanWatanabe Nov 11, 2022
930a791
Add Slider stories
TristanWatanabe Nov 11, 2022
b96731b
Add SplitButton stories
TristanWatanabe Nov 11, 2022
5ac0dce
Add Status stories
TristanWatanabe Nov 11, 2022
0f8851c
Add SvgIcon stories
TristanWatanabe Nov 11, 2022
45d7df7
Add Table stories
TristanWatanabe Nov 11, 2022
527f0de
Add Text stories
TristanWatanabe Nov 11, 2022
5ab1486
Add TextArea stories
TristanWatanabe Nov 11, 2022
680e03a
Add Toolbar stories
TristanWatanabe Nov 11, 2022
a8067d7
Add Tooltip stories
TristanWatanabe Nov 11, 2022
d59d5cd
Add Tree stories
TristanWatanabe Nov 11, 2022
e4ec66d
Add Video stories
TristanWatanabe Nov 11, 2022
3e79eae
feat: Add getThemeStoryVariant and keys utility functions
TristanWatanabe Nov 11, 2022
8bc1268
fix: type errors addressed
TristanWatanabe Nov 11, 2022
012a9e9
Add testwrapper to all stories
TristanWatanabe Nov 11, 2022
2fb5354
Add storybook scripts to package.json
TristanWatanabe Nov 11, 2022
bbd34ba
fix: address problematic imported class components
TristanWatanabe Nov 11, 2022
bb962fa
fix: RTL stories now display correctly
TristanWatanabe Nov 11, 2022
21139e9
fix(Accordion): add missing .end() call
TristanWatanabe Nov 11, 2022
e1b3ac0
Replace Screener tags with StoryWright
TristanWatanabe Nov 16, 2022
4325b39
Rename commonScreenerSteps files to commonStoryWrightSteps
TristanWatanabe Nov 17, 2022
0941f15
Add VRT tool related deps and scripts to package.json
TristanWatanabe Nov 17, 2022
7912564
Merge branch 'master' into add-v0-to-VRT-pipeline
TristanWatanabe Nov 17, 2022
37fd603
fix: use correct storywright version
TristanWatanabe Nov 17, 2022
df84492
fix (Alert): remove unneeded StoryWright steps
TristanWatanabe Nov 17, 2022
6d59713
fix: use storywright Keys
TristanWatanabe Nov 17, 2022
946dc1a
fix(Alert): update Steps to use unified common one
TristanWatanabe Nov 17, 2022
e4c278d
chore: remove deleted keys file
TristanWatanabe Nov 17, 2022
50f4eb3
Update VRT Pipelines to add v0 testing
TristanWatanabe Nov 17, 2022
b00cdb4
add screener:build script and partition for testing
TristanWatanabe Nov 17, 2022
71d2481
Update DonutChart.base.tsx
TristanWatanabe Nov 17, 2022
b989bca
fix: step keys errors addressed
TristanWatanabe Nov 17, 2022
18c1644
Revert "Update VRT Pipelines to add v0 testing"
TristanWatanabe Nov 20, 2022
f05bcbe
Update scripts
TristanWatanabe Nov 20, 2022
5d54abd
Add screener:build script
TristanWatanabe Nov 21, 2022
fd7c4d6
simplify script to only build storybook
TristanWatanabe Nov 21, 2022
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
41 changes: 41 additions & 0 deletions packages/fluentui/docs/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const path = require('path');
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');

module.exports = /** @type {import('../../../../.storybook/main').StorybookBaseConfig} */ ({
stories: ['../src/**/*.stories.tsx'],
core: {
builder: 'webpack5',
},
babel: {},
typescript: {
// disable react-docgen-typescript (totally not needed here, slows things down a lot)
reactDocgen: false,
},
webpackFinal: config => {
const tsPaths = new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, '../../../../tsconfig.base.json'),
});

if (config.resolve) {
config.resolve.plugins ? config.resolve.plugins.push(tsPaths) : (config.resolve.plugins = [tsPaths]);
}

if (config.module) {
config.module.rules?.unshift({
test: /\.(ts|tsx)$/,
use: [
{
loader: '@griffel/webpack-loader',
options: {
babelOptions: {
presets: ['@babel/preset-typescript'],
},
},
},
],
});
}

return config;
},
});
25 changes: 25 additions & 0 deletions packages/fluentui/docs/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';
import { Provider, teamsTheme } from '@fluentui/react-northstar';
import Screener from 'screener-storybook/src/screener';

/** @type {import("@fluentui/react-storybook-addon").FluentParameters} */
export const parameters = { layout: 'none' };
/** @type {import("@storybook/react").DecoratorFn[]} */
export const decorators = [
(story, context) => {
const isRtl = context.id.toLowerCase().includes('rtl');

return (
<Provider theme={teamsTheme} dir={isRtl ? 'rtl' : 'ltr'}>
<div className="testWrapper" style={{ width: '600px' }}>
{story()}
</div>
</Provider>
);
},
];

// For static storybook per https://github.com/screener-io/screener-storybook#testing-with-static-storybook-app
if (typeof window === 'object') {
/** @type {*} */ (window).__screener_storybook__ = require('@storybook/react').getStorybook;
}
7 changes: 6 additions & 1 deletion packages/fluentui/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,22 @@
"@types/react-custom-scrollbars": "^4.0.5",
"@types/react-router-dom": "^5.1.5",
"@types/react-virtualized": "^9.21.8",
"@types/react-window": "^1.8.2"
"@types/react-window": "^1.8.2",
"storywright": "0.0.26-beta.1"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "gulp build:docs",
"build:storybook": "build-storybook -o dist/storybook",
"lint": "eslint --ext .js,.ts,.tsx .",
"lint:fix": "yarn lint --fix",
"start": "gulp docs",
"screener:build": "yarn build:storybook",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the name screener here to simplify and align with current template we have while running the VR tool. Will be renamed (along with others) once we completely remove screener.

"start:profile": "cross-env NODE_ENV=production PERF=true gulp docs",
"start:storybook": "start-storybook",
"test:component": "storywright --browsers chromium --url dist/storybook --destpath dist/screenshots --waitTimeScreenshot 500 --concurrency 4 --headless true",
"vr:build": "cross-env NODE_ENV=production gulp screener:build",
"vr:test": "gulp screener:runner"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Accordion } from '@fluentui/react-northstar';
import AccordionDefaultBsize from '../../examples/components/Accordion/Performance/AccordionDefault.bsize';
import AccordionExampleRtl from '../../examples/components/Accordion/Rtl/AccordionExample.rtl';
import AccordionExample from '../../examples/components/Accordion/Types/AccordionExample.shorthand';
import AccordionExclusiveExample from '../../examples/components/Accordion/Types/AccordionExclusiveExample.shorthand';
import AccordionExclusiveExpandedExample from '../../examples/components/Accordion/Types/AccordionExclusiveExpandedExample.shorthand';
import AccordionPanelCustomContentExample from '../../examples/components/Accordion/Usage/AccordionPanelCustomContentExample.shorthand';
import AccordionPanelCustomTitleExample from '../../examples/components/Accordion/Usage/AccordionPanelCustomTitleExample.shorthand';
import AccordionDefaultExample from '../../examples/components/Accordion/Visual/AccordionExampleDefault.shorthand';

export default { component: Accordion, title: 'Accordion' } as ComponentMeta<typeof Accordion>;

export {
AccordionDefaultBsize,
AccordionExampleRtl,
AccordionExample,
AccordionExclusiveExample,
AccordionExclusiveExpandedExample,
AccordionPanelCustomContentExample,
AccordionPanelCustomTitleExample,
AccordionDefaultExample,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { StoryWright, Steps } from 'storywright';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Accordion, accordionTitleSlotClassNames } from '@fluentui/react-northstar';
import AccordionExampleCustomTitle from '../../examples/components/Accordion/Visual/AccordionExampleCustomTitle.shorthand';

export default {
component: Accordion,
title: 'Accordion',
decorators: [
story => (
<StoryWright
steps={new Steps()
.focus(`.${accordionTitleSlotClassNames.contentWrapper}`)
.snapshot('Focuses the accordion title')
.end()}
>
{story()}
</StoryWright>
),
],
} as ComponentMeta<typeof Accordion>;

export { AccordionExampleCustomTitle };
48 changes: 48 additions & 0 deletions packages/fluentui/docs/src/vr-tests/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import AlertDefaultBsize from '../../examples/components/Alert/Performance/AlertDefault.bsize';
import AlertExampleRtl from '../../examples/components/Alert/Rtl/AlertExample.rtl';
import AlertExampleChildrenRtl from '../../examples/components/Alert/Rtl/AlertExampleChildren.rtl';
import AlertExampleDismissActionRtl from '../../examples/components/Alert/Rtl/AlertExampleDismissAction.rtl';
import AlertExampleDismissAction from '../../examples/components/Alert/Slots/AlertExampleActions.shorthand';
import AlertExampleHeader from '../../examples/components/Alert/Slots/AlertExampleHeader.shorthand';
import AlertExampleIcon from '../../examples/components/Alert/Slots/AlertExampleIcon.shorthand';
import AlertExampleDismissible from '../../examples/components/Alert/State/AlertExampleVisible.shorthand';
import AlertExample from '../../examples/components/Alert/Types/AlertExample.shorthand';
import AlertExampleDismissActions from '../../examples/components/Alert/Usage/AlertExampleDismissActions.shorthand';
import AlertExampleImportantMessage from '../../examples/components/Alert/Usage/AlertExampleImportantMessage.shorthand';
import AlertExampleWidth from '../../examples/components/Alert/Usage/AlertExampleWidth.shorthand';
import AlertExampleShorthand from '../../examples/components/Alert/Variations/AlertExampleAttached.shorthand';
import AlertExampleDanger from '../../examples/components/Alert/Variations/AlertExampleDanger';
import AlertExampleFitted from '../../examples/components/Alert/Variations/AlertExampleFitted.shorthand';
import AlertExampleInfo from '../../examples/components/Alert/Variations/AlertExampleInfo';
import AlertExampleOof from '../../examples/components/Alert/Variations/AlertExampleOofs';
import AlertExampleSuccess from '../../examples/components/Alert/Variations/AlertExampleSuccess.shorthand';
import AlertExampleUrgent from '../../examples/components/Alert/Variations/AlertExampleUrgent';
import AlertExampleWarning from '../../examples/components/Alert/Variations/AlertExampleWarning.shorthand';

export default { component: Alert, title: 'Alert' } as ComponentMeta<typeof Alert>;

export {
AlertDefaultBsize,
AlertExampleRtl,
AlertExampleChildrenRtl,
AlertExampleDismissActionRtl,
AlertExampleDismissAction,
AlertExampleHeader,
AlertExampleIcon,
AlertExampleDismissible,
AlertExample,
AlertExampleDismissActions,
AlertExampleImportantMessage,
AlertExampleWidth,
AlertExampleShorthand,
AlertExampleDanger,
AlertExampleFitted,
AlertExampleInfo,
AlertExampleOof,
AlertExampleSuccess,
AlertExampleUrgent,
AlertExampleWarning,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import { getThemeStoryVariant } from '../utilities/getThemeStoryVariant';
import AlertExampleDanger from '../../examples/components/Alert/Variations/AlertExampleDanger.shorthand';

export default {
component: Alert,
title: 'Alert',
} as ComponentMeta<typeof Alert>;

const AlertExampleDangerTeams = getThemeStoryVariant(AlertExampleDanger, 'teamsV2');

const AlertExampleDangerTeamsDark = getThemeStoryVariant(AlertExampleDanger, 'teamsDarkV2');

const AlertExampleDangerTeamsHighContrast = getThemeStoryVariant(AlertExampleDanger, 'teamsHighContrast');

export {
AlertExampleDanger,
AlertExampleDangerTeams,
AlertExampleDangerTeamsDark,
AlertExampleDangerTeamsHighContrast,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { StoryWright } from 'storywright';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import screenerSteps from './commonStoryWrightSteps';
import { getThemeStoryVariant } from '../utilities/getThemeStoryVariant';
import AlertExampleDismissible from '../../examples/components/Alert/Types/AlertExampleDismissible.shorthand';

export default {
component: Alert,
title: 'Alert',
decorators: [story => <StoryWright steps={screenerSteps}>{story()}</StoryWright>],
} as ComponentMeta<typeof Alert>;

const AlertExampleDismissibleTeams = getThemeStoryVariant(AlertExampleDismissible, 'teamsV2');

const AlertExampleDismissibleTeamsDark = getThemeStoryVariant(AlertExampleDismissible, 'teamsDarkV2');

const AlertExampleDismissibleTeamsHighContrast = getThemeStoryVariant(AlertExampleDismissible, 'teamsHighContrast');

export {
AlertExampleDismissible,
AlertExampleDismissibleTeams,
AlertExampleDismissibleTeamsDark,
AlertExampleDismissibleTeamsHighContrast,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import { getThemeStoryVariant } from '../utilities/getThemeStoryVariant';
import AlertExampleInfo from '../../examples/components/Alert/Variations/AlertExampleInfo.shorthand';

export default {
component: Alert,
title: 'Alert',
} as ComponentMeta<typeof Alert>;

const AlertExampleInfoTeams = getThemeStoryVariant(AlertExampleInfo, 'teamsV2');

const AlertExampleInfoTeamsDark = getThemeStoryVariant(AlertExampleInfo, 'teamsDarkV2');

const AlertExampleInfoTeamsHighContrast = getThemeStoryVariant(AlertExampleInfo, 'teamsHighContrast');

export { AlertExampleInfo, AlertExampleInfoTeams, AlertExampleInfoTeamsDark, AlertExampleInfoTeamsHighContrast };
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { StoryWright } from 'storywright';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import screenerSteps from './commonStoryWrightSteps';

import { getThemeStoryVariant } from '../utilities/getThemeStoryVariant';
import AlertExampleOof from '../../examples/components/Alert/Variations/AlertExampleOofs.shorthand';

export default {
component: Alert,
title: 'Alert',
decorators: [story => <StoryWright steps={screenerSteps}>{story()}</StoryWright>],
} as ComponentMeta<typeof Alert>;

const AlertExampleOofTeams = getThemeStoryVariant(AlertExampleOof, 'teamsV2');

const AlertExampleOofTeamsDark = getThemeStoryVariant(AlertExampleOof, 'teamsDarkV2');

const AlertExampleOofTeamsHighContrast = getThemeStoryVariant(AlertExampleOof, 'teamsHighContrast');

export { AlertExampleOof, AlertExampleOofTeams, AlertExampleOofTeamsDark, AlertExampleOofTeamsHighContrast };
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { StoryWright } from 'storywright';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Alert } from '@fluentui/react-northstar';
import screenerSteps from './commonStoryWrightSteps';
import { getThemeStoryVariant } from '../utilities/getThemeStoryVariant';
import AlertExampleUrgent from '../../examples/components/Alert/Variations/AlertExampleUrgent.shorthand';

export default {
component: Alert,
title: 'Alert',
decorators: [story => <StoryWright steps={screenerSteps}>{story()}</StoryWright>],
} as ComponentMeta<typeof Alert>;

const AlertExampleUrgentTeams = getThemeStoryVariant(AlertExampleUrgent, 'teamsV2');

const AlertExampleUrgentTeamsDark = getThemeStoryVariant(AlertExampleUrgent, 'teamsDarkV2');

const AlertExampleUrgentTeamsHighContrast = getThemeStoryVariant(AlertExampleUrgent, 'teamsHighContrast');

export {
AlertExampleUrgent,
AlertExampleUrgentTeams,
AlertExampleUrgentTeamsDark,
AlertExampleUrgentTeamsHighContrast,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Keys, Steps } from 'storywright';
import { alertDismissActionClassName } from '@fluentui/react-northstar';

const selectors = {
dismissAction: `.${alertDismissActionClassName}`,
};

const screenerSteps = new Steps()
.hover(selectors.dismissAction)
.snapshot('Hovers the action button')
.keys('body', Keys.tab)
.snapshot('Focuses the action button')
.hover(selectors.dismissAction)
.snapshot('Hovers the focused action button')
.end();

export default screenerSteps;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Animation } from '@fluentui/react-northstar';
import AnimationExample from '../../examples/components/Animation/Types/AnimationExample.shorthand';
import AnimationExampleDelay from '../../examples/components/Animation/Types/AnimationExampleDelay.shorthand';
import AnimationExampleDirection from '../../examples/components/Animation/Types/AnimationExampleDirection.shorthand';
import AnimationExampleDuration from '../../examples/components/Animation/Types/AnimationExampleDuration.shorthand';
import AnimationExampleFillMode from '../../examples/components/Animation/Types/AnimationExampleFillMode.shorthand';
import AnimationExampleIterationCount from '../../examples/components/Animation/Types/AnimationExampleIterationCount.shorthand';
import AnimationExampleTimingFunction from '../../examples/components/Animation/Types/AnimationExampleTimingFunction.shorthand';
import AnimationExampleVisible from '../../examples/components/Animation/Usage/AnimationExampleVisible.shorthand';

export default { component: Animation, title: 'Animation' } as ComponentMeta<typeof Animation>;

export {
AnimationExample,
AnimationExampleDelay,
AnimationExampleDirection,
AnimationExampleDuration,
AnimationExampleFillMode,
AnimationExampleIterationCount,
AnimationExampleTimingFunction,
AnimationExampleVisible,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { ComponentMeta } from '@storybook/react';
import { Attachment } from '@fluentui/react-northstar';
import AttachmentDefaultBsize from '../../examples/components/Attachment/Performance/AttachmentDefault.bsize';
import AttachmentExampleRtl from '../../examples/components/Attachment/Rtl/AttachmentExample.rtl';
import AttachmentDescriptionExampleShorthand from '../../examples/components/Attachment/Slots/AttachmentDescriptionExample.shorthand';
import AttachmentHeaderExampleShorthand from '../../examples/components/Attachment/Slots/AttachmentHeaderExample.shorthand';
import AttachmentIconExampleShorthand from '../../examples/components/Attachment/Slots/AttachmentIconExample.shorthand';
import AttachmentExampleShorthand from '../../examples/components/Attachment/Types/AttachmentExample.shorthand';
import AttachmentProgressExampleShorthand from '../../examples/components/Attachment/Types/AttachmentProgressExample.shorthand';

export default { component: Attachment, title: 'Attachment' } as ComponentMeta<typeof Attachment>;

export {
AttachmentDefaultBsize,
AttachmentExampleRtl,
AttachmentDescriptionExampleShorthand,
AttachmentHeaderExampleShorthand,
AttachmentIconExampleShorthand,
AttachmentExampleShorthand,
AttachmentProgressExampleShorthand,
};
Loading