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

react-tabs mvp #20939

Merged
merged 39 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8c101f2
Create react-tabs packages and components
GeoffCoxMSFT Nov 5, 2021
f763e17
Basic tab with selection
GeoffCoxMSFT Nov 5, 2021
8e5d8f4
Updated to use css after for indicator
GeoffCoxMSFT Nov 9, 2021
5a67aea
Added support for vertical
GeoffCoxMSFT Nov 9, 2021
bf9bfc8
Add support for verticalTabContent
GeoffCoxMSFT Nov 9, 2021
96d5e0f
Add appearance and basic subtle style
GeoffCoxMSFT Nov 10, 2021
c4e6ed6
Supported icon slot
GeoffCoxMSFT Nov 10, 2021
c478458
Added content slot for layout
GeoffCoxMSFT Nov 10, 2021
0dd0c2e
Added badge tab
GeoffCoxMSFT Nov 11, 2021
4c1a820
Supported size for tablist and tab
GeoffCoxMSFT Nov 12, 2021
a4d8d1b
Added size stories
GeoffCoxMSFT Nov 12, 2021
a5f37ad
Improved story descriptions
GeoffCoxMSFT Nov 15, 2021
8d2d064
Support small size defaults
GeoffCoxMSFT Nov 15, 2021
22523b3
Support focus with arrow keys
GeoffCoxMSFT Nov 16, 2021
c5d550e
Improved props documentation
GeoffCoxMSFT Nov 18, 2021
8f4d643
Undo column update on overlap
GeoffCoxMSFT Nov 18, 2021
44746ab
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Nov 22, 2021
9788309
Added some initial tests
GeoffCoxMSFT Nov 23, 2021
d3ca33f
Added initial vr-tests for tabs
GeoffCoxMSFT Nov 23, 2021
72a437b
Reduced type complexity in TabList
GeoffCoxMSFT Nov 24, 2021
baa2bf8
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Nov 29, 2021
664956b
Merge fixes
GeoffCoxMSFT Nov 29, 2021
ba5dda7
Removed unready features
GeoffCoxMSFT Nov 30, 2021
f54f209
Simplified styling
GeoffCoxMSFT Dec 1, 2021
fcec8ae
Support small style
GeoffCoxMSFT Dec 1, 2021
dfb5064
Migrated to TS solution
GeoffCoxMSFT Dec 2, 2021
771f0db
Updated to latest padding figma changes
GeoffCoxMSFT Dec 2, 2021
b05971c
Updates
GeoffCoxMSFT Dec 6, 2021
b79f094
Updated vr-test stories
GeoffCoxMSFT Dec 6, 2021
815d309
Updated documentation and tests
GeoffCoxMSFT Dec 6, 2021
0b950cc
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Dec 6, 2021
6fc1a9e
PR updates
GeoffCoxMSFT Dec 7, 2021
a927715
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Dec 7, 2021
624b128
Revert to master yarn.lock
GeoffCoxMSFT Dec 7, 2021
2adffd9
Fixing synpack issue
GeoffCoxMSFT Dec 8, 2021
d5c774e
added tabs dependency
GeoffCoxMSFT Dec 8, 2021
642c5ee
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Dec 11, 2021
7b9ed2e
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT Dec 13, 2021
797382b
Moving to make-styles shorthands.
GeoffCoxMSFT Dec 13, 2021
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
1 change: 1 addition & 0 deletions apps/vr-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@fluentui/react-provider": "9.0.0-beta.5",
"@fluentui/react-slider": "9.0.0-beta.5",
"@fluentui/react-switch": "9.0.0-beta.5",
"@fluentui/react-tabs": "9.0.0-beta.4",
"@fluentui/react-text": "9.0.0-beta.4",
"@fluentui/react-theme": "9.0.0-beta.4",
"@fluentui/scripts": "^1.0.0",
Expand Down
158 changes: 158 additions & 0 deletions apps/vr-tests/src/stories/TabsConverged.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { storiesOf } from '@storybook/react';
import * as React from 'react';
import Screener from 'screener-storybook/src/screener';
import { TabList, Tab } from '@fluentui/react-tabs';

storiesOf('TabList and Tab Converged', module)
.addDecorator(story => (
<Screener
steps={new Screener.Steps()
.snapshot('default', { cropTo: '.testWrapper' })
.hover('.test-class')
.snapshot('hover', { cropTo: '.testWrapper' })
.mouseDown('.test-class')
Copy link
Contributor

Choose a reason for hiding this comment

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

(suuper-nit) maybe rename test-class to mouse-target or something to make it easier to read these stories?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I was following the practice of other converged tests.

.snapshot('pressed', { cropTo: '.testWrapper' })
.mouseUp('.test-class')
.end()}
>
{story()}
</Screener>
))
.addStory(
'Default',
() => (
<TabList>
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeRtl: true,
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory('Vertical', () => (
<TabList vertical>
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
))
.addStory(
'Subtle appearance',
() => (
<TabList appearance="subtle">
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory(
'Small size',
() => (
<TabList size="small">
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory(
'Vertical and small size',
() => (
<TabList size="small" vertical>
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory(
'Tab Selected (default)',
() => (
<TabList defaultSelectedValue="2">
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory(
'Tab Selected',
() => (
<TabList selectedValue="2">
<Tab value="1">First</Tab>
<Tab className="test-class" value="2">
Second
</Tab>
<Tab value="3">Third</Tab>
</TabList>
),
{
includeHighContrast: true,
includeDarkMode: true,
},
)
.addStory(
'With icon',
() => (
<TabList>
<Tab icon="A" value="1">
First
</Tab>
<Tab icon="B" className="test-class" value="2">
Second
</Tab>
<Tab icon="C" value="3">
Third
</Tab>
</TabList>
),
{
includeRtl: true,
},
)
.addStory(
'With icon only',
() => (
<TabList>
<Tab icon="A" value="1" />
<Tab icon="B" className="test-class" value="2" />
<Tab icon="C" value="3" />
</TabList>
),
{
includeRtl: true,
},
);
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ module.exports = {
'<rootDir>/packages/react-switch',
'<rootDir>/packages/react-conformance-make-styles',
'<rootDir>/packages/react-radio',
'<rootDir>/packages/react-tabs',
],
};
4 changes: 4 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@
"tags": ["vNext", "platform:web"],
"implicitDependencies": []
},
"@fluentui/react-tabs": {
"tags": ["vNext", "platform:web"],
"implicitDependencies": []
},
"@fluentui/react-tabster": {
"tags": ["vNext", "platform:web"],
"implicitDependencies": []
Expand Down
3 changes: 3 additions & 0 deletions packages/react-tabs/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["module:@fluentui/babel-make-styles", "annotate-pure-calls", "@babel/transform-react-pure-annotations"]
}
4 changes: 4 additions & 0 deletions packages/react-tabs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["plugin:@fluentui/eslint-plugin/react"],
"root": true
}
28 changes: 28 additions & 0 deletions packages/react-tabs/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.storybook/
.vscode/
bundle-size/
config/
coverage/
e2e/
etc/
node_modules/
src/
temp/
__fixtures__
__mocks__
__tests__

*.api.json
*.log
*.spec.*
*.stories.*
*.test.*
*.yml

# config files
*config.*
*rc.*
.editorconfig
.eslint*
.git*
.prettierignore
14 changes: 14 additions & 0 deletions packages/react-tabs/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const rootMain = require('../../../.storybook/main');

module.exports = /** @type {Omit<import('../../../.storybook/main'), 'typescript'|'babel'>} */ ({
...rootMain,
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: (config, options) => {
const localConfig = { ...rootMain.webpackFinal(config, options) };

// add your own webpack tweaks if needed

return localConfig;
},
});
7 changes: 7 additions & 0 deletions packages/react-tabs/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as rootPreview from '../../../.storybook/preview';

/** @type {typeof rootPreview.decorators} */
export const decorators = [...rootPreview.decorators];

/** @type {typeof rootPreview.parameters} */
export const parameters = { ...rootPreview.parameters };
10 changes: 10 additions & 0 deletions packages/react-tabs/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "",
"allowJs": true,
"checkJs": true,
"types": ["static-assets", "environment", "inline-style-expand-shorthand", "storybook__addons"]
},
"include": ["../src/**/*.stories.ts", "../src/**/*.stories.tsx", "*.js"]
}
15 changes: 15 additions & 0 deletions packages/react-tabs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@fluentui/react-tabs

Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
5 changes: 5 additions & 0 deletions packages/react-tabs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @fluentui/react-tabs

**React Tabs components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**

These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
4 changes: 4 additions & 0 deletions packages/react-tabs/config/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@fluentui/scripts/api-extractor/api-extractor.common.json"
}
5 changes: 5 additions & 0 deletions packages/react-tabs/config/api-extractor.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "./api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/packages/<unscopedPackageName>/src/index.d.ts"
}
7 changes: 7 additions & 0 deletions packages/react-tabs/config/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** Jest test setup file. */

const { configure } = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');

// Configure enzyme.
configure({ adapter: new Adapter() });
Loading