-
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
Button: Migrate react-button to new DX #18607
Merged
msft-fluent-ui-bot
merged 34 commits into
microsoft:master
from
TristanWatanabe:migrate-react-button
Jul 19, 2021
Merged
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
55387b7
migrate react-button
TristanWatanabe 60b4d3c
explicitly declare marginTop value to fix babel error
TristanWatanabe 4eb8061
extract buttonBaseProps from Button story into its own file
TristanWatanabe d0bcf13
update other Button Stories to import from new ButtonBaseProps file
TristanWatanabe 43f9679
Change files
TristanWatanabe 7591bf2
rename buttonBaseProps
TristanWatanabe a98a9f3
change import paths from index to respective Button folders
TristanWatanabe 68441b7
change import paths from index to exact file
TristanWatanabe ab753e7
add .stories suffix to Playground files
TristanWatanabe e96762f
update Playground imports
TristanWatanabe 32389fc
update start script so yarn start works
TristanWatanabe 410bc66
change file extension
TristanWatanabe b5c6c69
minor
TristanWatanabe 3cc4543
refactor and remove usage of v8 components
TristanWatanabe e77d235
Merge branch 'master' into migrate-react-button
TristanWatanabe 8fbe1be
Undo file change due to linter
TristanWatanabe bdf497e
minor
TristanWatanabe b4272ef
add react-menu as devDep
TristanWatanabe f53eed8
update version number
TristanWatanabe 010ca9d
Remove usage of react-text
TristanWatanabe d06f287
Merge branch 'master' into migrate-react-button
TristanWatanabe 9e97b56
remove changes made by linter
TristanWatanabe f945ced
update buttonBaseProps based on changes made in #18563
TristanWatanabe bbc4f3d
update buttonBaseProps import path
TristanWatanabe e0191f8
remove changes made by linter
TristanWatanabe 31b0a49
update react-menu version
TristanWatanabe 9807ce9
update buttonBaseProps import path
TristanWatanabe 30e42f4
Merge branch 'master' into migrate-react-button
TristanWatanabe c406275
upgrade react-menu devDep to alpha.50
TristanWatanabe 76c4a4b
remove unused disable lint directives
TristanWatanabe 36c2d21
Merge branch 'master' into migrate-react-button
TristanWatanabe b56cc35
Remove react-menu devDep
TristanWatanabe 980c228
Merge branch 'master' into migrate-react-button
TristanWatanabe ed0485d
add ts-ignore on react-menu import
TristanWatanabe 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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-button-1b2e69bc-f82f-49a8-a211-b843e3bef591.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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Button: Migrate to new dx", | ||
"packageName": "@fluentui/react-button", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-examples-28ae56c7-be37-496c-a550-ccfd1b3180c6.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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Button: Migrate to new dx", | ||
"packageName": "@fluentui/react-examples", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
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,11 @@ | ||
const rootMain = require('../../../.storybook/main'); | ||
|
||
module.exports = /** @type {Pick<import('../../../.storybook/main').StorybookConfig,'addons'|'stories'|'webpackFinal'>} */ ({ | ||
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], | ||
addons: [...rootMain.addons], | ||
webpackFinal: (config, options) => { | ||
const localConfig = { ...rootMain.webpackFinal(config, options) }; | ||
|
||
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,3 @@ | ||
import * as rootPreview from '../../../.storybook/preview'; | ||
|
||
export const decorators = [...rootPreview.decorators]; |
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,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true | ||
}, | ||
"exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], | ||
"include": ["../src/**/*", "*.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,5 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "./api-extractor.json", | ||
"mainEntryPointFilePath": "<projectFolder>/dist/<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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
const { createConfig } = require('@fluentui/scripts/jest/jest-resources'); | ||
const path = require('path'); | ||
// @ts-check | ||
|
||
const config = createConfig({ | ||
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))], | ||
/** | ||
* @type {jest.InitialOptions} | ||
*/ | ||
module.exports = { | ||
displayName: 'react-button', | ||
preset: '../../jest.preset.js', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: '<rootDir>/tsconfig.json', | ||
diagnostics: false, | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
coverageDirectory: './coverage', | ||
setupFilesAfterEnv: ['./config/tests.js'], | ||
snapshotSerializers: ['@fluentui/jest-serializer-make-styles'], | ||
}); | ||
|
||
module.exports = config; | ||
}; |
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
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
2 changes: 1 addition & 1 deletion
2
...-examples/src/react-button/Playground.tsx → ...s/react-button/src/Playground.stories.tsx
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
File renamed without changes.
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,21 @@ | ||
import { ButtonProps } from './Button'; | ||
Hotell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { PropDefinition } from './Playground.types'; | ||
|
||
type ExampleProps = { iconOnly?: string }; | ||
|
||
export const buttonBaseProps: PropDefinition<ButtonProps & ExampleProps>[] = [ | ||
{ propName: 'content', propType: 'string', defaultValue: 'This is a button', dependsOnProps: ['~iconOnly'] }, | ||
{ propName: 'disabled', propType: 'boolean' }, | ||
{ propName: 'icon', propType: 'boolean' }, | ||
{ propName: 'iconOnly', propType: 'boolean', dependsOnProps: ['icon'] }, | ||
{ | ||
propName: 'iconPosition', | ||
propType: ['before', 'after'], | ||
defaultValue: 'before', | ||
dependsOnProps: ['icon', '~iconOnly'], | ||
}, | ||
{ propName: 'primary', propType: 'boolean', dependsOnProps: ['~subtle', '~transparent'] }, | ||
{ propName: 'size', propType: ['small', 'medium', 'large'], defaultValue: 'medium' }, | ||
{ propName: 'subtle', propType: 'boolean', dependsOnProps: ['~primary', '~transparent'] }, | ||
{ propName: 'transparent', propType: 'boolean', dependsOnProps: ['~primary', '~subtle'] }, | ||
]; |
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 |
---|---|---|
@@ -1,23 +1,17 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"target": "ES5", | ||
"module": "CommonJS", | ||
"lib": ["es5", "dom"], | ||
"outDir": "dist", | ||
"target": "es5", | ||
"module": "commonjs", | ||
"jsx": "react", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"importHelpers": true, | ||
"noUnusedLocals": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"preserveConstEnums": true, | ||
"lib": ["es5", "dom"], | ||
"typeRoots": ["../../node_modules/@types", "../../typings"], | ||
"types": ["jest", "custom-global"], | ||
"skipLibCheck": true | ||
}, | ||
"include": ["src"] | ||
"types": ["jest", "custom-global", "inline-style-expand-shorthand"] | ||
} | ||
} |
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
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.
you won't be able to use here anything from v7/v8 , so this would need a bit more refactoring
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.
Agreed, we should probably change this for native select + input + style overrides.