-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(recipes): create package with initial implementation (moved from /apps) #31386
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
Merged
sopranopillow
merged 10 commits into
microsoft:master
from
sopranopillow:recipes-to-package
May 24, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
049fa75
adding recipes
sopranopillow c5c7f1a
fix versions and missing dep
sopranopillow d1bd0c3
fix generator tests
sopranopillow 9116ecb
fix lint:
sopranopillow f3ad870
fix styles
sopranopillow 0de83ca
fix lint
sopranopillow d3482e5
requested changes
sopranopillow 2b30473
fix dep mismatch
sopranopillow 3647618
Merge branch 'master' of https://www.github.com/microsoft/fluentui in…
sopranopillow 91baa04
update lock
sopranopillow 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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": "../../../.babelrc-v9.json", | ||
| "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] | ||
| } |
This file contains hidden or 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 hidden or 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, '../stories/**/*.stories.mdx', '../stories/**/index.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 hidden or 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 }; |
10 changes: 10 additions & 0 deletions
10
packages/react-components/recipes/.storybook/tsconfig.json
This file contains hidden or 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", "storybook__addons"] | ||
| }, | ||
| "include": ["../stories/**/*.stories.ts", "../stories/**/*.stories.tsx", "*.js"] | ||
| } |
This file contains hidden or 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,30 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/swcrc", | ||
| "exclude": [ | ||
| "/testing", | ||
| "/**/*.cy.ts", | ||
| "/**/*.cy.tsx", | ||
| "/**/*.spec.ts", | ||
| "/**/*.spec.tsx", | ||
| "/**/*.test.ts", | ||
| "/**/*.test.tsx" | ||
| ], | ||
| "jsc": { | ||
| "parser": { | ||
| "syntax": "typescript", | ||
| "tsx": true, | ||
| "decorators": false, | ||
| "dynamicImport": false | ||
| }, | ||
| "externalHelpers": true, | ||
| "transform": { | ||
| "react": { | ||
| "runtime": "classic", | ||
| "useSpread": true | ||
| } | ||
| }, | ||
| "target": "es2019" | ||
| }, | ||
| "minify": false, | ||
| "sourceMaps": true | ||
| } |
This file contains hidden or 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/recipes | ||
|
|
||
| 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 hidden or 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,35 @@ | ||
| # @fluentui/recipes | ||
|
|
||
| ## Recipes for @fluentui/react-components | ||
|
|
||
| > **⚠️⚠️ This package should never be released ⚠️⚠️** | ||
|
|
||
| ### What is a recipe? | ||
|
|
||
| A recipe is a document that allows you to communicate how to build a component, how to explain a concept, or how to use our library to build an experience. | ||
|
|
||
| ### What is expected of a recipe? | ||
|
|
||
| A recipe should have the following aspects: | ||
|
|
||
| - Concise information with a clear goal. | ||
| - It should cover more abstract concepts and not just code snippets. | ||
| - It should also be able to be used by a developer that is new to Fluent UI. | ||
| - When writing a recipe for a component, it should be generic enough to be used in multiple scenarios and not just one. | ||
| - It should promote the use of our composition model and already created components. | ||
|
|
||
| ### How can a recipe help you? | ||
|
|
||
| #### Component recipes | ||
|
|
||
| When a component is simple enough to be built with already created components, we can provide a recipe that will guide the user on how to build said component. This will help by not creating a component that does not provide high value and keep the library small. | ||
|
|
||
| These recipes will also help when we get requests to create a component, but we won't work on it in the near future. By providing a recipe, we can help fill the requests partially and allow the user to build the component themselves. If the recipe gets enough traction, we can revisit prioritizing working on this component. | ||
|
|
||
| #### Concept recipes | ||
|
|
||
| When a concept in our library is hard to grasp and our documentation doesn't provide enough information, we can provide a recipe that will guide the user on how to use/understand the concept. These recipes should not be of every concept specific to our library, instead they should be used as a way to help users understand concepts that are critical to becoming more familiar with our library. | ||
|
|
||
| #### Prototype recipes | ||
|
|
||
| When a user wants to build an experience that is not covered by our library and will not be added because it is not atomic enough or because of its complexity, we can provide a recipe to guide the user on how to build these experiences. These should be created by using our library and do not have specific implementation details as they may not apply to all scenarios. A common example of such experience is a message for a chat application. |
This file contains hidden or 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.v-next.json" | ||
| } |
This file contains hidden or 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 @@ | ||
| /** Jest test setup file. */ |
This file contains hidden or 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,63 @@ | ||
| # @fluentui/recipes Spec | ||
|
|
||
| ## Background | ||
|
|
||
| _Description and use cases of this component_ | ||
|
|
||
| ## Prior Art | ||
|
|
||
| _Include background research done for this component_ | ||
|
|
||
| - _Link to Open UI research_ | ||
| - _Link to comparison of v7 and v0_ | ||
| - _Link to GitHub epic issue for the converged component_ | ||
|
|
||
| ## Sample Code | ||
|
|
||
| _Provide some representative example code that uses the proposed API for the component_ | ||
|
|
||
| ## Variants | ||
|
|
||
| _Describe visual or functional variants of this control, if applicable. For example, a slider could have a 2D variant._ | ||
|
|
||
| ## API | ||
|
|
||
| _List the **Props** and **Slots** proposed for the component. Ideally this would just be a link to the component's `.types.ts` file_ | ||
|
|
||
| ## Structure | ||
|
|
||
| - _**Public**_ | ||
| - _**Internal**_ | ||
| - _**DOM** - how the component will be rendered as HTML elements_ | ||
|
|
||
| ## Migration | ||
|
|
||
| _Describe what will need to be done to upgrade from the existing implementations:_ | ||
|
|
||
| - _Migration from v8_ | ||
| - _Migration from v0_ | ||
|
|
||
| ## Behaviors | ||
|
|
||
| _Explain how the component will behave in use, including:_ | ||
|
|
||
| - _Component States_ | ||
| - _Interaction_ | ||
| - _Keyboard_ | ||
| - _Cursor_ | ||
| - _Touch_ | ||
| - _Screen readers_ | ||
|
|
||
| ## Accessibility | ||
|
|
||
| Base accessibility information is included in the design document. After the spec is filled and review, outcomes from it need to be communicated to design and incorporated in the design document. | ||
|
|
||
| - Decide whether to use **native element** or folow **ARIA** and provide reasons | ||
| - Identify the **[ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/) pattern** and, if the component is listed there, follow its specification as possible. | ||
| - Identify accessibility **variants**, the `role` ([ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions)) of the component, its `slots` and `aria-*` props. | ||
| - Describe the **keyboard navigation**: Tab Oder and Arrow Key Navigation. Describe any other keyboard **shortcuts** used | ||
| - Specify texts for **state change announcements** - [ARIA live regions | ||
| ](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) (number of available items in dropdown, error messages, confirmations, ...) | ||
| - Identify UI parts that appear on **hover or focus** and specify keyboard and screen reader interaction with them | ||
| - List cases when **focus** needs to be **trapped** in sections of the UI (for dialogs and popups or for hierarchical navigation) | ||
| - List cases when **focus** needs to be **moved programatically** (if parts of the UI are appearing/disappearing or other cases) |
This file contains hidden or 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 @@ | ||
| ## API Report File for "@fluentui/recipes" | ||
|
|
||
| > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
|
|
||
| ```ts | ||
|
|
||
| // (No @packageDocumentation comment for this package) | ||
|
|
||
| ``` |
This file contains hidden or 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 @@ | ||
| // @ts-check | ||
|
|
||
| /** | ||
| * @type {import('@jest/types').Config.InitialOptions} | ||
| */ | ||
| module.exports = { | ||
| displayName: 'recipes', | ||
| preset: '../../../jest.preset.js', | ||
| transform: { | ||
| '^.+\\.tsx?$': [ | ||
| 'ts-jest', | ||
| { | ||
| tsconfig: '<rootDir>/tsconfig.spec.json', | ||
| isolatedModules: true, | ||
| }, | ||
| ], | ||
| }, | ||
| coverageDirectory: './coverage', | ||
| setupFilesAfterEnv: ['./config/tests.js'], | ||
| snapshotSerializers: ['@griffel/jest-serializer'], | ||
| }; |
This file contains hidden or 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 @@ | ||
| import { preset, task } from '@fluentui/scripts-tasks'; | ||
|
|
||
| preset(); | ||
|
|
||
| task('build', 'build:react-components').cached?.(); |
This file contains hidden or 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,68 @@ | ||
| { | ||
| "name": "@fluentui/recipes", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "description": "New fluentui react package", | ||
| "main": "lib-commonjs/index.js", | ||
| "module": "lib/index.js", | ||
| "typings": "./dist/index.d.ts", | ||
| "sideEffects": false, | ||
| "files": [ | ||
| "*.md", | ||
| "dist/*.d.ts", | ||
| "lib", | ||
| "lib-commonjs" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/microsoft/fluentui" | ||
| }, | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "build": "just-scripts build", | ||
| "clean": "just-scripts clean", | ||
| "generate-api": "just-scripts generate-api", | ||
| "lint": "just-scripts lint", | ||
| "test": "jest --passWithNoTests", | ||
| "type-check": "just-scripts type-check" | ||
| }, | ||
| "devDependencies": { | ||
| "@fluentui/eslint-plugin": "*", | ||
| "@fluentui/react-conformance": "*", | ||
| "@fluentui/react-conformance-griffel": "*", | ||
| "@fluentui/scripts-api-extractor": "*", | ||
| "@fluentui/scripts-tasks": "*", | ||
| "@fluentui/react-storybook-addon": "*", | ||
| "@fluentui/react-storybook-addon-export-to-sandbox": "*" | ||
| }, | ||
| "dependencies": { | ||
| "@fluentui/react-provider": "^9.16.1", | ||
| "@fluentui/react-theme": "^9.1.19", | ||
| "@fluentui/react-text": "^9.4.19", | ||
| "@fluentui/react-utilities": "^9.18.9", | ||
| "@griffel/react": "^1.5.22", | ||
| "@swc/helpers": "^0.5.1", | ||
| "@fluentui/react-icons": "^2.0.239" | ||
| }, | ||
| "peerDependencies": { | ||
| "@types/react": ">=16.14.0 <19.0.0", | ||
| "@types/react-dom": ">=16.9.0 <19.0.0", | ||
| "react": ">=16.14.0 <19.0.0", | ||
| "react-dom": ">=16.14.0 <19.0.0" | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "node": "./lib-commonjs/index.js", | ||
| "import": "./lib/index.js", | ||
| "require": "./lib-commonjs/index.js" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "beachball": { | ||
| "disallowedChangeTypes": [ | ||
| "major", | ||
| "prerelease" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or 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,8 @@ | ||
| { | ||
| "name": "@fluentui/recipes", | ||
| "$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
| "projectType": "library", | ||
| "sourceRoot": "packages/react-components/recipes/src", | ||
| "tags": ["platform:web", "vNext", "type:stories"], | ||
| "implicitDependencies": [] | ||
| } |
This file contains hidden or 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 @@ | ||
| export {}; |
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.
Uh oh!
There was an error while loading. Please reload this page.