-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react-tabs mvp #20939
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 f763e17
Basic tab with selection
GeoffCoxMSFT 8e5d8f4
Updated to use css after for indicator
GeoffCoxMSFT 5a67aea
Added support for vertical
GeoffCoxMSFT bf9bfc8
Add support for verticalTabContent
GeoffCoxMSFT 96d5e0f
Add appearance and basic subtle style
GeoffCoxMSFT c4e6ed6
Supported icon slot
GeoffCoxMSFT c478458
Added content slot for layout
GeoffCoxMSFT 0dd0c2e
Added badge tab
GeoffCoxMSFT 4c1a820
Supported size for tablist and tab
GeoffCoxMSFT a4d8d1b
Added size stories
GeoffCoxMSFT a5f37ad
Improved story descriptions
GeoffCoxMSFT 8d2d064
Support small size defaults
GeoffCoxMSFT 22523b3
Support focus with arrow keys
GeoffCoxMSFT c5d550e
Improved props documentation
GeoffCoxMSFT 8f4d643
Undo column update on overlap
GeoffCoxMSFT 44746ab
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 9788309
Added some initial tests
GeoffCoxMSFT d3ca33f
Added initial vr-tests for tabs
GeoffCoxMSFT 72a437b
Reduced type complexity in TabList
GeoffCoxMSFT baa2bf8
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 664956b
Merge fixes
GeoffCoxMSFT ba5dda7
Removed unready features
GeoffCoxMSFT f54f209
Simplified styling
GeoffCoxMSFT fcec8ae
Support small style
GeoffCoxMSFT dfb5064
Migrated to TS solution
GeoffCoxMSFT 771f0db
Updated to latest padding figma changes
GeoffCoxMSFT b05971c
Updates
GeoffCoxMSFT b79f094
Updated vr-test stories
GeoffCoxMSFT 815d309
Updated documentation and tests
GeoffCoxMSFT 0b950cc
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 6fc1a9e
PR updates
GeoffCoxMSFT a927715
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 624b128
Revert to master yarn.lock
GeoffCoxMSFT 2adffd9
Fixing synpack issue
GeoffCoxMSFT d5c774e
added tabs dependency
GeoffCoxMSFT 642c5ee
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 7b9ed2e
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
GeoffCoxMSFT 797382b
Moving to make-styles shorthands.
GeoffCoxMSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
.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, | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["plugin:@fluentui/eslint-plugin/react"], | ||
"root": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
tomouse-target
or something to make it easier to read these stories?There was a problem hiding this comment.
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.