From 9c2149416b583bac295cf67c26799fc8b14909a0 Mon Sep 17 00:00:00 2001 From: Esteban Munoz Date: Tue, 10 Jan 2023 10:23:56 -0700 Subject: [PATCH 1/4] creating react-datepicker package --- .github/CODEOWNERS | 1 + .../react-datepicker/.babelrc.json | 4 ++ .../react-datepicker/.eslintrc.json | 4 ++ .../react-datepicker/.npmignore | 30 +++++++++ .../react-components/react-datepicker/LICENSE | 15 +++++ .../react-datepicker/README.md | 5 ++ .../config/api-extractor.json | 4 ++ .../react-datepicker/config/tests.js | 1 + .../react-datepicker/docs/Spec.md | 63 +++++++++++++++++++ .../etc/react-datepicker.api.md | 0 .../react-datepicker/jest.config.js | 21 +++++++ .../react-datepicker/just.config.ts | 3 + .../react-datepicker/package.json | 58 +++++++++++++++++ .../react-datepicker/src/index.ts | 2 + .../react-datepicker/tsconfig.json | 22 +++++++ .../react-datepicker/tsconfig.lib.json | 14 +++++ .../react-datepicker/tsconfig.spec.json | 9 +++ tsconfig.base.json | 1 + workspace.json | 7 +++ 19 files changed, 264 insertions(+) create mode 100644 packages/react-components/react-datepicker/.babelrc.json create mode 100644 packages/react-components/react-datepicker/.eslintrc.json create mode 100644 packages/react-components/react-datepicker/.npmignore create mode 100644 packages/react-components/react-datepicker/LICENSE create mode 100644 packages/react-components/react-datepicker/README.md create mode 100644 packages/react-components/react-datepicker/config/api-extractor.json create mode 100644 packages/react-components/react-datepicker/config/tests.js create mode 100644 packages/react-components/react-datepicker/docs/Spec.md create mode 100644 packages/react-components/react-datepicker/etc/react-datepicker.api.md create mode 100644 packages/react-components/react-datepicker/jest.config.js create mode 100644 packages/react-components/react-datepicker/just.config.ts create mode 100644 packages/react-components/react-datepicker/package.json create mode 100644 packages/react-components/react-datepicker/src/index.ts create mode 100644 packages/react-components/react-datepicker/tsconfig.json create mode 100644 packages/react-components/react-datepicker/tsconfig.lib.json create mode 100644 packages/react-components/react-datepicker/tsconfig.spec.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7418bc85f8439..241cd03bf49a5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -180,6 +180,7 @@ packages/react-components/react-skeleton @microsoft/cxe-red packages/tokens @microsoft/teams-prg packages/react-components/react-tags @microsoft/cxe-coastal @TristanWatanabe packages/react-components/react-data-grid-react-window @microsoft/teams-prg +packages/react-components/react-datepicker @microsoft/cxe-red @sopranopillow @khmakoto # <%= NX-CODEOWNER-PLACEHOLDER %> diff --git a/packages/react-components/react-datepicker/.babelrc.json b/packages/react-components/react-datepicker/.babelrc.json new file mode 100644 index 0000000000000..40e01373083ce --- /dev/null +++ b/packages/react-components/react-datepicker/.babelrc.json @@ -0,0 +1,4 @@ +{ + "presets": ["@griffel"], + "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] +} diff --git a/packages/react-components/react-datepicker/.eslintrc.json b/packages/react-components/react-datepicker/.eslintrc.json new file mode 100644 index 0000000000000..ceea884c70dcc --- /dev/null +++ b/packages/react-components/react-datepicker/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": ["plugin:@fluentui/eslint-plugin/react"], + "root": true +} diff --git a/packages/react-components/react-datepicker/.npmignore b/packages/react-components/react-datepicker/.npmignore new file mode 100644 index 0000000000000..f7ce568a6dbf7 --- /dev/null +++ b/packages/react-components/react-datepicker/.npmignore @@ -0,0 +1,30 @@ +.storybook/ +.vscode/ +bundle-size/ +config/ +coverage/ +docs/ +etc/ +node_modules/ +src/ +stories/ +dist/types/ +temp/ +__fixtures__ +__mocks__ +__tests__ + +*.api.json +*.log +*.spec.* +*.cy.* +*.test.* +*.yml + +# config files +*config.* +*rc.* +.editorconfig +.eslint* +.git* +.prettierignore diff --git a/packages/react-components/react-datepicker/LICENSE b/packages/react-components/react-datepicker/LICENSE new file mode 100644 index 0000000000000..f0d8146ed7543 --- /dev/null +++ b/packages/react-components/react-datepicker/LICENSE @@ -0,0 +1,15 @@ +@fluentui/react-datepicker + +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 diff --git a/packages/react-components/react-datepicker/README.md b/packages/react-components/react-datepicker/README.md new file mode 100644 index 0000000000000..36501acb47425 --- /dev/null +++ b/packages/react-components/react-datepicker/README.md @@ -0,0 +1,5 @@ +# @fluentui/react-datepicker + +**React Datepicker components for [Fluent UI React](https://react.fluentui.dev/)** + +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. diff --git a/packages/react-components/react-datepicker/config/api-extractor.json b/packages/react-components/react-datepicker/config/api-extractor.json new file mode 100644 index 0000000000000..30897284c6b83 --- /dev/null +++ b/packages/react-components/react-datepicker/config/api-extractor.json @@ -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" +} diff --git a/packages/react-components/react-datepicker/config/tests.js b/packages/react-components/react-datepicker/config/tests.js new file mode 100644 index 0000000000000..2e211ae9e2142 --- /dev/null +++ b/packages/react-components/react-datepicker/config/tests.js @@ -0,0 +1 @@ +/** Jest test setup file. */ diff --git a/packages/react-components/react-datepicker/docs/Spec.md b/packages/react-components/react-datepicker/docs/Spec.md new file mode 100644 index 0000000000000..763a5e3f93971 --- /dev/null +++ b/packages/react-components/react-datepicker/docs/Spec.md @@ -0,0 +1,63 @@ +# @fluentui/react-datepicker 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) diff --git a/packages/react-components/react-datepicker/etc/react-datepicker.api.md b/packages/react-components/react-datepicker/etc/react-datepicker.api.md new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/packages/react-components/react-datepicker/jest.config.js b/packages/react-components/react-datepicker/jest.config.js new file mode 100644 index 0000000000000..8c8578e451492 --- /dev/null +++ b/packages/react-components/react-datepicker/jest.config.js @@ -0,0 +1,21 @@ +// @ts-check + +/** + * @type {import('@jest/types').Config.InitialOptions} + */ +module.exports = { + displayName: 'react-datepicker', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsConfig: '/tsconfig.spec.json', + diagnostics: false, + }, + }, + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + coverageDirectory: './coverage', + setupFilesAfterEnv: ['./config/tests.js'], + snapshotSerializers: ['@griffel/jest-serializer'], +}; diff --git a/packages/react-components/react-datepicker/just.config.ts b/packages/react-components/react-datepicker/just.config.ts new file mode 100644 index 0000000000000..894083fb27aad --- /dev/null +++ b/packages/react-components/react-datepicker/just.config.ts @@ -0,0 +1,3 @@ +import { preset } from '@fluentui/scripts/tasks'; + +preset(); diff --git a/packages/react-components/react-datepicker/package.json b/packages/react-components/react-datepicker/package.json new file mode 100644 index 0000000000000..485ba77fc0923 --- /dev/null +++ b/packages/react-components/react-datepicker/package.json @@ -0,0 +1,58 @@ +{ + "name": "@fluentui/react-datepicker", + "version": "9.0.0-alpha.0", + "private": true, + "description": "React components for building web experiences", + "main": "lib-commonjs/index.js", + "module": "lib/index.js", + "typings": "./dist/index.d.ts", + "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/fluentui" + }, + "license": "MIT", + "scripts": { + "build": "just-scripts build", + "clean": "just-scripts clean", + "code-style": "just-scripts code-style", + "just": "just-scripts", + "lint": "just-scripts lint", + "test": "jest --passWithNoTests", + "type-check": "tsc -b tsconfig.json", + "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor" + }, + "devDependencies": { + "@fluentui/eslint-plugin": "*", + "@fluentui/react-conformance": "*", + "@fluentui/react-conformance-griffel": "9.0.0-beta.19", + "@fluentui/scripts": "*" + }, + "dependencies": { + "@fluentui/react-theme": "^9.1.5", + "@fluentui/react-utilities": "^9.4.0", + "@griffel/react": "^1.5.2", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@types/react": ">=16.8.0 <19.0.0", + "@types/react-dom": ">=16.8.0 <19.0.0", + "react": ">=16.8.0 <19.0.0", + "react-dom": ">=16.8.0 <19.0.0" + }, + "beachball": { + "disallowedChangeTypes": [ + "major", + "minor", + "patch" + ] + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./lib/index.js", + "require": "./lib-commonjs/index.js" + }, + "./package.json": "./package.json" + } +} diff --git a/packages/react-components/react-datepicker/src/index.ts b/packages/react-components/react-datepicker/src/index.ts new file mode 100644 index 0000000000000..aacbad0068e24 --- /dev/null +++ b/packages/react-components/react-datepicker/src/index.ts @@ -0,0 +1,2 @@ +// TODO: replace with real exports +export {}; diff --git a/packages/react-components/react-datepicker/tsconfig.json b/packages/react-components/react-datepicker/tsconfig.json new file mode 100644 index 0000000000000..12ca516af1c5b --- /dev/null +++ b/packages/react-components/react-datepicker/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "target": "ES2019", + "noEmit": true, + "isolatedModules": true, + "importHelpers": true, + "jsx": "react", + "noUnusedLocals": true, + "preserveConstEnums": true + }, + "include": [], + "files": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/react-components/react-datepicker/tsconfig.lib.json b/packages/react-components/react-datepicker/tsconfig.lib.json new file mode 100644 index 0000000000000..b2da24eff1b32 --- /dev/null +++ b/packages/react-components/react-datepicker/tsconfig.lib.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "lib": ["ES2019", "dom"], + "declaration": true, + "declarationDir": "../../../dist/out-tsc/types", + "outDir": "../../../dist/out-tsc", + "inlineSources": true, + "types": ["static-assets", "environment"] + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"], + "include": ["./src/**/*.ts", "./src/**/*.tsx"] +} diff --git a/packages/react-components/react-datepicker/tsconfig.spec.json b/packages/react-components/react-datepicker/tsconfig.spec.json new file mode 100644 index 0000000000000..469fcba4d7ba7 --- /dev/null +++ b/packages/react-components/react-datepicker/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "dist", + "types": ["jest", "node"] + }, + "include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 3872ffe75bd33..582cca768f579 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -34,6 +34,7 @@ "@fluentui/react-conformance-griffel": ["packages/react-components/react-conformance-griffel/src/index.ts"], "@fluentui/react-context-selector": ["packages/react-components/react-context-selector/src/index.ts"], "@fluentui/react-data-grid-react-window": ["packages/react-components/react-data-grid-react-window/src/index.ts"], + "@fluentui/react-datepicker": ["packages/react-components/react-datepicker/src/index.ts"], "@fluentui/react-dialog": ["packages/react-components/react-dialog/src/index.ts"], "@fluentui/react-divider": ["packages/react-components/react-divider/src/index.ts"], "@fluentui/react-field": ["packages/react-components/react-field/src/index.ts"], diff --git a/workspace.json b/workspace.json index dbdd7cbc225ae..5927d8de68638 100644 --- a/workspace.json +++ b/workspace.json @@ -431,6 +431,13 @@ "projectType": "library", "implicitDependencies": [] }, + "@fluentui/react-datepicker": { + "root": "packages/react-components/react-datepicker", + "projectType": "library", + "implicitDependencies": [], + "sourceRoot": "packages/react-components/react-datepicker/src", + "tags": ["vNext", "platform:web"] + }, "@fluentui/react-dialog": { "root": "packages/react-components/react-dialog", "projectType": "library", From 6e5f2dbdf601d119b2b3dfb2aceb388266d0bece Mon Sep 17 00:00:00 2001 From: Esteban Munoz Date: Tue, 10 Jan 2023 10:36:40 -0700 Subject: [PATCH 2/4] adding api file --- .../react-datepicker/etc/react-datepicker.api.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-components/react-datepicker/etc/react-datepicker.api.md b/packages/react-components/react-datepicker/etc/react-datepicker.api.md index e69de29bb2d1d..7361fc5b41a8f 100644 --- a/packages/react-components/react-datepicker/etc/react-datepicker.api.md +++ b/packages/react-components/react-datepicker/etc/react-datepicker.api.md @@ -0,0 +1,9 @@ +## API Report File for "@fluentui/react-datepicker" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// (No @packageDocumentation comment for this package) + +``` From c5b00df8fe24d711f08eb3a17a704473927c942c Mon Sep 17 00:00:00 2001 From: Esteban Munoz Date: Tue, 10 Jan 2023 13:37:14 -0700 Subject: [PATCH 3/4] update to new scripts-* setup --- packages/react-components/react-datepicker/just.config.ts | 2 +- packages/react-components/react-datepicker/package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-datepicker/just.config.ts b/packages/react-components/react-datepicker/just.config.ts index 894083fb27aad..b10db31a6aca5 100644 --- a/packages/react-components/react-datepicker/just.config.ts +++ b/packages/react-components/react-datepicker/just.config.ts @@ -1,3 +1,3 @@ -import { preset } from '@fluentui/scripts/tasks'; +import { preset } from '@fluentui/scripts-tasks'; preset(); diff --git a/packages/react-components/react-datepicker/package.json b/packages/react-components/react-datepicker/package.json index 485ba77fc0923..0a51e0fea49c5 100644 --- a/packages/react-components/react-datepicker/package.json +++ b/packages/react-components/react-datepicker/package.json @@ -26,7 +26,8 @@ "@fluentui/eslint-plugin": "*", "@fluentui/react-conformance": "*", "@fluentui/react-conformance-griffel": "9.0.0-beta.19", - "@fluentui/scripts": "*" + "@fluentui/scripts-api-extractor": "*", + "@fluentui/scripts-tasks": "*" }, "dependencies": { "@fluentui/react-theme": "^9.1.5", From 616b28e241ec2bbc8fe54bcaf6b8087c2e6cd2b2 Mon Sep 17 00:00:00 2001 From: Esteban Munoz Date: Tue, 10 Jan 2023 13:56:06 -0700 Subject: [PATCH 4/4] updating api extractor config --- .../react-components/react-datepicker/config/api-extractor.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-components/react-datepicker/config/api-extractor.json b/packages/react-components/react-datepicker/config/api-extractor.json index 30897284c6b83..e533bf30b48a2 100644 --- a/packages/react-components/react-datepicker/config/api-extractor.json +++ b/packages/react-components/react-datepicker/config/api-extractor.json @@ -1,4 +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" + "extends": "@fluentui/scripts-api-extractor/api-extractor.common.v-next.json" }