diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f15d3e3263..69421fe89d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -25,7 +25,6 @@ body: - core - antd - chakra-ui - - fluent-ui - mui - react-bootstrap - semantic-ui diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index bbdc5f3e9c..967e0ba807 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -19,7 +19,6 @@ body: - core - antd - chakra-ui - - fluent-ui - mui - react-bootstrap - semantic-ui diff --git a/.github/ISSUE_TEMPLATE/question_issue.yml b/.github/ISSUE_TEMPLATE/question_issue.yml index 0f2d44d857..c6cd69198f 100644 --- a/.github/ISSUE_TEMPLATE/question_issue.yml +++ b/.github/ISSUE_TEMPLATE/question_issue.yml @@ -19,7 +19,6 @@ body: - core - antd - chakra-ui - - fluent-ui - mui - react-bootstrap - semantic-ui diff --git a/README.md b/README.md index 0802e1f012..f8e423038b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ - [Bootstrap 3](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/core) - [React-Bootstrap (Bootstrap 5)](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/react-bootstrap) - [Chakra UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/chakra-ui) -- [Fluent UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/fluent-ui) - [Fluent UI 9](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/fluentui-rc) - [Material UI 5](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/mui) - [Semantic UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/semantic-ui) diff --git a/package-lock.json b/package-lock.json index 7816a45ac5..c73bac8a94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "packages/chakra-ui", "packages/core", "packages/docs", - "packages/fluent-ui", "packages/fluentui-rc", "packages/mui", "packages/playground", @@ -4609,59 +4608,6 @@ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" }, - "node_modules/@fluentui/date-time-utilities": { - "version": "8.5.16", - "resolved": "https://registry.npmjs.org/@fluentui/date-time-utilities/-/date-time-utilities-8.5.16.tgz", - "integrity": "sha512-l+mLfJ2VhdHjBpELLLPDaWgT7GMLynm2aqR7SttbEb6Jh7hc/7ck1MWm93RTb3gYVHYai8SENqimNcvIxHt/zg==", - "dependencies": { - "@fluentui/set-version": "^8.2.14", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/dom-utilities": { - "version": "2.2.14", - "resolved": "https://registry.npmjs.org/@fluentui/dom-utilities/-/dom-utilities-2.2.14.tgz", - "integrity": "sha512-+4DVm5sNfJh+l8fM+7ylpOkGNZkNr4X1z1uKQPzRJ1PRhlnvc6vLpWNNicGwpjTbgufSrVtGKXwP5sf++r81lg==", - "dependencies": { - "@fluentui/set-version": "^8.2.14", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/font-icons-mdl2": { - "version": "8.5.32", - "resolved": "https://registry.npmjs.org/@fluentui/font-icons-mdl2/-/font-icons-mdl2-8.5.32.tgz", - "integrity": "sha512-PCZMijJlDQ5Zy8oNb80vUD6I4ORiR03qFgDT8o08mAGu+KzQO96q4jm0rzPRQuI9CO7pDD/6naOo8UVrmhZ2Aw==", - "dependencies": { - "@fluentui/set-version": "^8.2.14", - "@fluentui/style-utilities": "^8.10.3", - "@fluentui/utilities": "^8.13.24", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/foundation-legacy": { - "version": "8.2.52", - "resolved": "https://registry.npmjs.org/@fluentui/foundation-legacy/-/foundation-legacy-8.2.52.tgz", - "integrity": "sha512-tHCD0m58Zja7wN1FTsvj4Gaj0B22xOhRTpyDzyvxRfjFGYPpR2Jgx/y/KRB3JTOX5EfJHAVzInyWZBeN5IfsVA==", - "dependencies": { - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/set-version": "^8.2.14", - "@fluentui/style-utilities": "^8.10.3", - "@fluentui/utilities": "^8.13.24", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/keyboard-key": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@fluentui/keyboard-key/-/keyboard-key-0.4.14.tgz", - "integrity": "sha512-XzZHcyFEM20H23h3i15UpkHi2AhRBriXPGAHq0Jm98TKFppXehedjjEFuUsh+CyU5JKBhDalWp8TAQ1ArpNzow==", - "dependencies": { - "tslib": "^2.1.0" - } - }, "node_modules/@fluentui/keyboard-keys": { "version": "9.0.7", "resolved": "https://registry.npmjs.org/@fluentui/keyboard-keys/-/keyboard-keys-9.0.7.tgz", @@ -4670,15 +4616,6 @@ "@swc/helpers": "^0.5.1" } }, - "node_modules/@fluentui/merge-styles": { - "version": "8.5.15", - "resolved": "https://registry.npmjs.org/@fluentui/merge-styles/-/merge-styles-8.5.15.tgz", - "integrity": "sha512-4CdKwo4k1Un2QLulpSVIz/KMgLNBMgin4NPyapmKDMVuO1OOxJUqfocubRGNO5x9mKgAMMYwBKGO9i0uxMMpJw==", - "dependencies": { - "@fluentui/set-version": "^8.2.14", - "tslib": "^2.1.0" - } - }, "node_modules/@fluentui/priority-overflow": { "version": "9.1.11", "resolved": "https://registry.npmjs.org/@fluentui/priority-overflow/-/priority-overflow-9.1.11.tgz", @@ -4687,33 +4624,6 @@ "@swc/helpers": "^0.5.1" } }, - "node_modules/@fluentui/react": { - "version": "8.115.3", - "resolved": "https://registry.npmjs.org/@fluentui/react/-/react-8.115.3.tgz", - "integrity": "sha512-O6LVF7YaffvrZBLXfRaqQu1G9U9Uh1C8jC8D6FRLNdgCQi/mV5klhjAXN3XkommhuBlpw8ViALbMTdUxc50NXQ==", - "dependencies": { - "@fluentui/date-time-utilities": "^8.5.16", - "@fluentui/font-icons-mdl2": "^8.5.32", - "@fluentui/foundation-legacy": "^8.2.52", - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/react-focus": "^8.8.40", - "@fluentui/react-hooks": "^8.6.36", - "@fluentui/react-portal-compat-context": "^9.0.11", - "@fluentui/react-window-provider": "^2.2.18", - "@fluentui/set-version": "^8.2.14", - "@fluentui/style-utilities": "^8.10.3", - "@fluentui/theme": "^2.6.41", - "@fluentui/utilities": "^8.13.24", - "@microsoft/load-themed-styles": "^1.10.26", - "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" - } - }, "node_modules/@fluentui/react-accordion": { "version": "9.3.40", "resolved": "https://registry.npmjs.org/@fluentui/react-accordion/-/react-accordion-9.3.40.tgz", @@ -5141,38 +5051,6 @@ "react-dom": ">=16.14.0 <19.0.0" } }, - "node_modules/@fluentui/react-focus": { - "version": "8.8.40", - "resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-8.8.40.tgz", - "integrity": "sha512-ha0CbLv5EIbjYCtQky6LVZObxOeMfhixrgrzfXm3Ta2eGs1NyZRDm1VeM6acOolWB/8QiN/CbdGckjALli8L2g==", - "dependencies": { - "@fluentui/keyboard-key": "^0.4.14", - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/set-version": "^8.2.14", - "@fluentui/style-utilities": "^8.10.3", - "@fluentui/utilities": "^8.13.24", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/react-hooks": { - "version": "8.6.36", - "resolved": "https://registry.npmjs.org/@fluentui/react-hooks/-/react-hooks-8.6.36.tgz", - "integrity": "sha512-kI0Z4Q4xHUs4SOmmI5n5OH5fPckqMSCovTRpiuxzCO2TNzLmfC861+nqf4Ygw/ChqNm2gWNZZfUADfnNAEsq+Q==", - "dependencies": { - "@fluentui/react-window-provider": "^2.2.18", - "@fluentui/set-version": "^8.2.14", - "@fluentui/utilities": "^8.13.24", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, "node_modules/@fluentui/react-icons": { "version": "2.0.226", "resolved": "https://registry.npmjs.org/@fluentui/react-icons/-/react-icons-2.0.226.tgz", @@ -5505,18 +5383,6 @@ "react-dom": ">=16.14.0 <19.0.0" } }, - "node_modules/@fluentui/react-portal-compat-context": { - "version": "9.0.11", - "resolved": "https://registry.npmjs.org/@fluentui/react-portal-compat-context/-/react-portal-compat-context-9.0.11.tgz", - "integrity": "sha512-ubvW/ej0O+Pago9GH3mPaxzUgsNnBoqvghNamWjyKvZIViyaXUG6+sgcAl721R+qGAFac+A20akI5qDJz/xtdg==", - "dependencies": { - "@swc/helpers": "^0.5.1" - }, - "peerDependencies": { - "@types/react": ">=16.14.0 <19.0.0", - "react": ">=16.14.0 <19.0.0" - } - }, "node_modules/@fluentui/react-positioning": { "version": "9.13.2", "resolved": "https://registry.npmjs.org/@fluentui/react-positioning/-/react-positioning-9.13.2.tgz", @@ -6015,55 +5881,6 @@ "react-dom": ">=16.14.0 <19.0.0" } }, - "node_modules/@fluentui/react-window-provider": { - "version": "2.2.18", - "resolved": "https://registry.npmjs.org/@fluentui/react-window-provider/-/react-window-provider-2.2.18.tgz", - "integrity": "sha512-nBKqxd0P8NmIR0qzFvka1urE2LVbUm6cse1I1T7TcOVNYa5jDf5BrO06+JRZfwbn00IJqOnIVoP0qONqceypWQ==", - "dependencies": { - "@fluentui/set-version": "^8.2.14", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/set-version": { - "version": "8.2.14", - "resolved": "https://registry.npmjs.org/@fluentui/set-version/-/set-version-8.2.14.tgz", - "integrity": "sha512-f/QWJnSeyfAjGAqq57yjMb6a5ejPlwfzdExPmzFBuEOuupi8hHbV8Yno12XJcTW4I0KXEQGw+PUaM1aOf/j7jw==", - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/style-utilities": { - "version": "8.10.3", - "resolved": "https://registry.npmjs.org/@fluentui/style-utilities/-/style-utilities-8.10.3.tgz", - "integrity": "sha512-pyO9BGkwIxXaIMVT6ma98GIZAgTjGc0LZ5iUai9GLIrFLQWnIKnS//hgUx8qG4AecUeqZ26Wb0e+Ale9NyPQCQ==", - "dependencies": { - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/set-version": "^8.2.14", - "@fluentui/theme": "^2.6.41", - "@fluentui/utilities": "^8.13.24", - "@microsoft/load-themed-styles": "^1.10.26", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/theme": { - "version": "2.6.41", - "resolved": "https://registry.npmjs.org/@fluentui/theme/-/theme-2.6.41.tgz", - "integrity": "sha512-h9RguEzqzJ0+59ys5Kkp7JtsjhDUxBLmQunu5rpHp5Mp788OtEjI/n1a9FIcOAL/priPSQwXN7RbuDpeP7+aSw==", - "dependencies": { - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/set-version": "^8.2.14", - "@fluentui/utilities": "^8.13.24", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, "node_modules/@fluentui/tokens": { "version": "1.0.0-alpha.13", "resolved": "https://registry.npmjs.org/@fluentui/tokens/-/tokens-1.0.0-alpha.13.tgz", @@ -6072,21 +5889,6 @@ "@swc/helpers": "^0.5.1" } }, - "node_modules/@fluentui/utilities": { - "version": "8.13.24", - "resolved": "https://registry.npmjs.org/@fluentui/utilities/-/utilities-8.13.24.tgz", - "integrity": "sha512-/jo6hWCzTGCx06l2baAMwsjjBZ/dyMouls53uNaQLUGUUhUwXh/DcDDXMqLRJB3MaH9zvgfvRw61iKmm2s9fIA==", - "dependencies": { - "@fluentui/dom-utilities": "^2.2.14", - "@fluentui/merge-styles": "^8.5.15", - "@fluentui/set-version": "^8.2.14", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -7555,11 +7357,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/@microsoft/load-themed-styles": { - "version": "1.10.295", - "resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.10.295.tgz", - "integrity": "sha512-W+IzEBw8a6LOOfRJM02dTT7BDZijxm+Z7lhtOAz1+y9vQm1Kdz9jlAO+qCEKsfxtUOmKilW8DIRqFw2aUgKeGg==" - }, "node_modules/@monaco-editor/loader": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.4.0.tgz", @@ -9407,10 +9204,6 @@ "resolved": "packages/docs", "link": true }, - "node_modules/@rjsf/fluent-ui": { - "resolved": "packages/fluent-ui", - "link": true - }, "node_modules/@rjsf/fluentui-rc": { "resolved": "packages/fluentui-rc", "link": true @@ -34543,52 +34336,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, - "packages/fluent-ui": { - "name": "@rjsf/fluent-ui", - "version": "6.0.0-alpha.0", - "license": "Apache-2.0", - "dependencies": { - "lodash": "^4.17.21", - "lodash-es": "^4.17.21" - }, - "devDependencies": { - "@babel/core": "^7.23.9", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.21.0", - "@babel/preset-env": "^7.23.9", - "@babel/preset-react": "^7.23.3", - "@babel/preset-typescript": "^7.23.3", - "@fluentui/react": "^8.115.3", - "@rjsf/core": "^6.0.0-alpha.0", - "@rjsf/snapshot-tests": "^6.0.0-alpha.0", - "@rjsf/utils": "^6.0.0-alpha.0", - "@rjsf/validator-ajv8": "^6.0.0-alpha.0", - "@types/jest": "^29.5.12", - "@types/lodash": "^4.14.202", - "@types/react": "^18.2.58", - "@types/react-dom": "^18.2.19", - "@types/react-test-renderer": "^18.0.7", - "babel-jest": "^29.7.0", - "eslint": "^8.56.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-test-renderer": "^18.2.0", - "rimraf": "^5.0.5", - "rollup": "^3.29.4", - "typescript": "^4.9.5" - }, - "engines": { - "node": ">=20" - }, - "peerDependencies": { - "@fluentui/react": ">= 7", - "@rjsf/core": "^6.x", - "@rjsf/utils": "^6.x", - "react": "^16.14.0 || >=17" - } - }, "packages/fluentui-rc": { "name": "@rjsf/fluentui-rc", "version": "6.0.0-alpha.0", @@ -34734,12 +34481,10 @@ "@babel/runtime": "^7.23.9", "@chakra-ui/icons": "^1.1.7", "@chakra-ui/react": "^1.8.9", - "@fluentui/react": "^8.115.3", "@mui/material": "^6.4.3", "@rjsf/antd": "^6.0.0-alpha.0", "@rjsf/chakra-ui": "^6.0.0-alpha.0", "@rjsf/core": "^6.0.0-alpha.0", - "@rjsf/fluent-ui": "^6.0.0-alpha.0", "@rjsf/fluentui-rc": "^6.0.0-alpha.0", "@rjsf/mui": "^6.0.0-alpha.0", "@rjsf/react-bootstrap": "^6.0.0-alpha.0", diff --git a/package.json b/package.json index 41a92e97cf..df57fb59f3 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "packages/chakra-ui", "packages/core", "packages/docs", - "packages/fluent-ui", "packages/fluentui-rc", "packages/mui", "packages/playground", diff --git a/packages/docs/docs/usage/themes.md b/packages/docs/docs/usage/themes.md index 069b70a8cb..f6c03f58d9 100644 --- a/packages/docs/docs/usage/themes.md +++ b/packages/docs/docs/usage/themes.md @@ -11,7 +11,6 @@ meaning that you must load the Bootstrap stylesheet on the page to view the form | Bootstrap 3 (default) | Published | `@rjsf/core` | | react-bootstrap | Published | `@rjsf/react-bootstrap` | | Chakra UI | Published | `@rjsf/chakra-ui` | -| fluent-ui | Published | `@rjsf/fluent-ui` | | fluentui-rc | Published | `@rjsf/fluentui-rc` | | material-ui 5 | Published | `@rjsf/mui` | | Semantic UI | Published | `@rjsf/semantic-ui` | diff --git a/packages/fluent-ui/.eslintrc b/packages/fluent-ui/.eslintrc deleted file mode 100644 index 731b36bae0..0000000000 --- a/packages/fluent-ui/.eslintrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["../../.eslintrc"], - "plugins": ["@typescript-eslint", "jsx-a11y", "react", "import"] -} diff --git a/packages/fluent-ui/README.md b/packages/fluent-ui/README.md deleted file mode 100644 index 22d7162be0..0000000000 --- a/packages/fluent-ui/README.md +++ /dev/null @@ -1,137 +0,0 @@ -[![Build Status][build-shield]][build-url] -[![npm][npm-shield]][npm-url] -[![npm downloads][npm-dl-shield]][npm-dl-url] -[![Contributors][contributors-shield]][contributors-url] -[![Apache 2.0 License][license-shield]][license-url] - - -
-

- - Logo - - -

@rjsf/fluent-ui

- -

- Fluent UI theme, fields and widgets for react-jsonschema-form. -
- Explore the docs » -
-
- View Playground - · - Report Bug - · - Request Feature -

-

- - - -## Table of Contents - -- [Table of Contents](#table-of-contents) -- [About The Project](#about-the-project) - - [Built With](#built-with) -- [Getting Started](#getting-started) - - [Prerequisites](#prerequisites) - - [Installation](#installation) -- [Usage](#usage) -- [Roadmap](#roadmap) -- [Contributing](#contributing) -- [Contact](#contact) - - - -## About The Project - -Fluent UI theme, fields and widgets for `react-jsonschema-form`. - -### Built With - -- [react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form/) -- [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/) -- [Typescript](https://www.typescriptlang.org/) - - - -## Getting Started - -### Prerequisites - -- `@fluentui/react >= 7.114.2` -- `@rjsf/core >= 2.0.0` - -```bash -yarn add @fluentui/react @rjsf/core -``` - -For the Fluent UI grid to work, add the following CSS tag to the main HTML page: - -```html - -``` - -### Installation - -```bash -yarn add @rjsf/fluent-ui -``` - - - -## Usage - -```js -import Form from '@rjsf/fluent-ui'; -``` - -or - -```js -import { withTheme } from '@rjsf/core'; -import { Theme as FluentUITheme } from '@rjsf/fluent-ui'; - -// Make modifications to the theme with your own fields and widgets - -const Form = withTheme(FluentUITheme); -``` - - - -## Roadmap - -See the [open issues](https://github.com/rjsf-team/react-jsonschema-form/issues) for a list of proposed features (and known issues). - - - -## Contributing - -Read our [contributors' guide](https://rjsf-team.github.io/react-jsonschema-form/docs/contributing/) to get started. - - - -## Contact - -rjsf team: [https://github.com/orgs/rjsf-team/people](https://github.com/orgs/rjsf-team/people) - -GitHub repository: [https://github.com/rjsf-team/react-jsonschema-form](https://github.com/rjsf-team/react-jsonschema-form) - - - - -[build-shield]: https://github.com/rjsf-team/react-jsonschema-form/workflows/CI/badge.svg -[build-url]: https://github.com/rjsf-team/react-jsonschema-form/actions -[contributors-shield]: https://img.shields.io/github/contributors/rjsf-team/react-jsonschema-form.svg -[contributors-url]: https://github.com/rjsf-team/react-jsonschema-form/graphs/contributors -[license-shield]: https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square -[license-url]: https://choosealicense.com/licenses/apache-2.0/ -[npm-shield]: https://img.shields.io/npm/v/@rjsf/fluent-ui/latest.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/@rjsf/fluent-ui -[npm-dl-shield]: https://img.shields.io/npm/dm/@rjsf/fluent-ui.svg?style=flat-square -[npm-dl-url]: https://www.npmjs.com/package/@rjsf/fluent-ui -[product-screenshot]: https://raw.githubusercontent.com/rjsf-team/react-jsonschema-form/59a8206e148474bea854bbb004f624143fbcbac8/packages/fluent-ui/screenshot.png diff --git a/packages/fluent-ui/babel.config.js b/packages/fluent-ui/babel.config.js deleted file mode 100644 index 5f772a56c4..0000000000 --- a/packages/fluent-ui/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const defaultConfig = require('../../babel.config'); - -module.exports = defaultConfig; diff --git a/packages/fluent-ui/jest.config.js b/packages/fluent-ui/jest.config.js deleted file mode 100644 index 46d8a24d32..0000000000 --- a/packages/fluent-ui/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - moduleNameMapper: { - 'office-ui-fabric-react/lib/': 'office-ui-fabric-react/lib-commonjs/', - }, - testEnvironment: 'jsdom', - testEnvironmentOptions: { - browsers: ['chrome', 'firefox', 'safari'], - }, - transformIgnorePatterns: [`/node_modules/(?!nanoid)`], -}; diff --git a/packages/fluent-ui/logo.png b/packages/fluent-ui/logo.png deleted file mode 100644 index 04cf311f1f..0000000000 Binary files a/packages/fluent-ui/logo.png and /dev/null differ diff --git a/packages/fluent-ui/package.json b/packages/fluent-ui/package.json deleted file mode 100644 index 2bed113c9a..0000000000 --- a/packages/fluent-ui/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "@rjsf/fluent-ui", - "version": "6.0.0-alpha.0", - "main": "dist/index.js", - "module": "lib/index.js", - "typings": "lib/index.d.ts", - "description": "Fluent UI theme, fields and widgets for react-jsonschema-form", - "files": [ - "dist", - "lib", - "src" - ], - "scripts": { - "build:ts": "tsc -b", - "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs", - "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/fluent-ui.esm.js --sourcemap --packages=external --format=esm", - "build:umd": "rollup dist/fluent-ui.esm.js --format=umd --file=dist/fluent-ui.umd.js --name=@rjsf/fluent-ui", - "build": "npm run build:ts && npm run build:cjs && npm run build:esm && npm run build:umd", - "cs-check": "prettier -l \"{src,test}/**/*.ts?(x)\"", - "cs-format": "prettier \"{src,test}/**/*.ts?(x)\" --write", - "lint": "eslint src test", - "precommit": "lint-staged", - "test": "jest", - "test:update": "jest --u" - }, - "lint-staged": { - "{src,test}/**/*.ts?(x)": [ - "eslint --fix" - ] - }, - "engineStrict": false, - "engines": { - "node": ">=20" - }, - "peerDependencies": { - "@fluentui/react": ">= 7", - "@rjsf/core": "^6.x", - "@rjsf/utils": "^6.x", - "react": "^16.14.0 || >=17" - }, - "devDependencies": { - "@babel/core": "^7.23.9", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-optional-chaining": "^7.21.0", - "@babel/preset-env": "^7.23.9", - "@babel/preset-react": "^7.23.3", - "@babel/preset-typescript": "^7.23.3", - "@fluentui/react": "^8.115.3", - "@rjsf/core": "^6.0.0-alpha.0", - "@rjsf/snapshot-tests": "^6.0.0-alpha.0", - "@rjsf/utils": "^6.0.0-alpha.0", - "@rjsf/validator-ajv8": "^6.0.0-alpha.0", - "@types/jest": "^29.5.12", - "@types/lodash": "^4.14.202", - "@types/react": "^18.2.58", - "@types/react-dom": "^18.2.19", - "@types/react-test-renderer": "^18.0.7", - "babel-jest": "^29.7.0", - "eslint": "^8.56.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-test-renderer": "^18.2.0", - "rimraf": "^5.0.5", - "rollup": "^3.29.4", - "typescript": "^4.9.5" - }, - "publishConfig": { - "access": "public" - }, - "author": "", - "contributors": [ - "Heath Chiavettone ( - props: IconButtonProps -) { - const { - registry: { translateString }, - } = props; - return ( - - ); -} diff --git a/packages/fluent-ui/src/AddButton/index.ts b/packages/fluent-ui/src/AddButton/index.ts deleted file mode 100644 index 752d720d32..0000000000 --- a/packages/fluent-ui/src/AddButton/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './AddButton'; -export * from './AddButton'; diff --git a/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx b/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx deleted file mode 100644 index 9c1d7523f9..0000000000 --- a/packages/fluent-ui/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; - -export default function ArrayFieldItemTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: ArrayFieldTemplateItemType) { - const { - children, - disabled, - hasToolbar, - hasCopy, - hasMoveDown, - hasMoveUp, - hasRemove, - index, - onCopyIndexClick, - onDropIndexClick, - onReorderClick, - readonly, - uiSchema, - registry, - } = props; - const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates; - return ( -
-
-
-
{children}
-
- {hasToolbar && ( -
- {(hasMoveUp || hasMoveDown) && ( - - )} - {(hasMoveUp || hasMoveDown) && ( - - )} - {hasCopy && ( - - )} - {hasRemove && ( - - )} -
- )} -
-
- ); -} diff --git a/packages/fluent-ui/src/ArrayFieldItemTemplate/index.ts b/packages/fluent-ui/src/ArrayFieldItemTemplate/index.ts deleted file mode 100644 index f104431399..0000000000 --- a/packages/fluent-ui/src/ArrayFieldItemTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './ArrayFieldItemTemplate'; -export * from './ArrayFieldItemTemplate'; diff --git a/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx b/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx deleted file mode 100644 index 730e070b64..0000000000 --- a/packages/fluent-ui/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { CSSProperties } from 'react'; -import { - getTemplate, - getUiOptions, - ArrayFieldTemplateItemType, - ArrayFieldTemplateProps, - StrictRJSFSchema, - RJSFSchema, - FormContextType, -} from '@rjsf/utils'; - -const rightJustify = { - float: 'right', -} as CSSProperties; - -export default function ArrayFieldTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: ArrayFieldTemplateProps) { - const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = - props; - const uiOptions = getUiOptions(uiSchema); - const ArrayFieldDescriptionTemplate = getTemplate<'ArrayFieldDescriptionTemplate', T, S, F>( - 'ArrayFieldDescriptionTemplate', - registry, - uiOptions - ); - const ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>( - 'ArrayFieldItemTemplate', - registry, - uiOptions - ); - const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>( - 'ArrayFieldTitleTemplate', - registry, - uiOptions - ); - // Button templates are not overridden in the uiSchema - const { - ButtonTemplates: { AddButton }, - } = registry.templates; - return ( - <> - - - {items.length > 0 && - items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType) => ( - - ))} - {canAdd && ( - - - - )} - - ); -} diff --git a/packages/fluent-ui/src/ArrayFieldTemplate/index.ts b/packages/fluent-ui/src/ArrayFieldTemplate/index.ts deleted file mode 100644 index ab908dec2c..0000000000 --- a/packages/fluent-ui/src/ArrayFieldTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './ArrayFieldTemplate'; -export * from './ArrayFieldTemplate'; diff --git a/packages/fluent-ui/src/BaseInputTemplate/BaseInputTemplate.tsx b/packages/fluent-ui/src/BaseInputTemplate/BaseInputTemplate.tsx deleted file mode 100644 index b1ea232f53..0000000000 --- a/packages/fluent-ui/src/BaseInputTemplate/BaseInputTemplate.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { ChangeEvent, FocusEvent } from 'react'; -import { TextField } from '@fluentui/react'; -import { - ariaDescribedByIds, - BaseInputTemplateProps, - examplesId, - labelValue, - FormContextType, - getInputProps, - RJSFSchema, - StrictRJSFSchema, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -// Keys of ITextFieldProps from @fluentui/react -const allowedProps = [ - 'multiline', - 'resizable', - 'autoAdjustHeight', - 'underlined', - 'borderless', - 'label', - 'onRenderLabel', - 'description', - 'onRenderDescription', - 'prefix', - 'suffix', - 'onRenderPrefix', - 'onRenderSuffix', - 'iconProps', - 'defaultValue', - 'value', - 'disabled', - 'readOnly', - 'errorMessage', - 'onChange', - 'onNotifyValidationResult', - 'onGetErrorMessage', - 'deferredValidationTime', - 'className', - 'inputClassName', - 'ariaLabel', - 'validateOnFocusIn', - 'validateOnFocusOut', - 'validateOnLoad', - 'theme', - 'styles', - 'autoComplete', - 'mask', - 'maskChar', - 'maskFormat', - 'type', - 'list', -]; - -export default function BaseInputTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ - id, - placeholder, - required, - readonly, - disabled, - label, - hideLabel, - value, - onChange, - onChangeOverride, - onBlur, - onFocus, - autofocus, - options, - schema, - type, - rawErrors, - multiline, -}: BaseInputTemplateProps) { - const inputProps = getInputProps(schema, type, options); - const _onChange = ({ target: { value } }: ChangeEvent) => - onChange(value === '' ? options.emptyValue : value); - const _onBlur = ({ target }: FocusEvent) => onBlur(id, target && target.value); - const _onFocus = ({ target }: FocusEvent) => onFocus(id, target && target.value); - - const uiProps = _pick((options.props as object) || {}, allowedProps); - - return ( - <> - (id) : undefined} - {...uiProps} - aria-describedby={ariaDescribedByIds(id, !!schema.examples)} - /> - {Array.isArray(schema.examples) && ( - (id)}> - {(schema.examples as string[]) - .concat(schema.default && !schema.examples.includes(schema.default) ? ([schema.default] as string[]) : []) - .map((example: any) => { - return - )} - - ); -} diff --git a/packages/fluent-ui/src/BaseInputTemplate/index.ts b/packages/fluent-ui/src/BaseInputTemplate/index.ts deleted file mode 100644 index f7ef8d5939..0000000000 --- a/packages/fluent-ui/src/BaseInputTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './BaseInputTemplate'; -export * from './BaseInputTemplate'; diff --git a/packages/fluent-ui/src/CheckboxWidget/CheckboxWidget.tsx b/packages/fluent-ui/src/CheckboxWidget/CheckboxWidget.tsx deleted file mode 100644 index 8b3ff8b056..0000000000 --- a/packages/fluent-ui/src/CheckboxWidget/CheckboxWidget.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { FocusEvent, useCallback } from 'react'; -import { Checkbox, ICheckboxProps } from '@fluentui/react'; -import { - ariaDescribedByIds, - descriptionId, - getTemplate, - labelValue, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -// Keys of ICheckboxProps from @fluentui/react -export const allowedProps: (keyof ICheckboxProps)[] = [ - 'ariaDescribedBy', - 'ariaLabel', - 'ariaPositionInSet', - 'ariaSetSize', - 'boxSide', - 'checked', - 'checkmarkIconProps', - 'className', - 'componentRef', - 'defaultChecked', - 'defaultIndeterminate', - 'disabled', - 'indeterminate', - 'inputProps', - /* Backward compatibility with fluentui v7 */ - 'keytipProps' as any, - 'label', - 'onChange', - 'onRenderLabel', - 'styles', - 'theme', -]; - -export default function CheckboxWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: WidgetProps) { - const { - id, - value, - // required, - disabled, - readonly, - label, - hideLabel, - schema, - autofocus, - onChange, - onBlur, - onFocus, - options, - registry, - uiSchema, - } = props; - const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>( - 'DescriptionFieldTemplate', - registry, - options - ); - - const _onChange = useCallback( - (_: any, checked?: boolean): void => { - onChange(checked); - }, - [onChange] - ); - - const _onBlur = ({ target }: FocusEvent) => onBlur(id, target && target.value); - const _onFocus = ({ target }: FocusEvent) => onFocus(id, target && target.value); - - const uiProps = _pick((options.props as object) || {}, allowedProps); - const description = options.description ?? schema.description; - - return ( - <> - {!hideLabel && !!description && ( - (id)} - description={description} - schema={schema} - uiSchema={uiSchema} - registry={registry} - /> - )} - (id)} - /* Backward compatibility with fluentui v7 */ - {...{ - autoFocus: autofocus, - onBlur: _onBlur, - onFocus: _onFocus, - }} - /> - - ); -} diff --git a/packages/fluent-ui/src/CheckboxWidget/index.ts b/packages/fluent-ui/src/CheckboxWidget/index.ts deleted file mode 100644 index b9e3c318ec..0000000000 --- a/packages/fluent-ui/src/CheckboxWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './CheckboxWidget'; -export * from './CheckboxWidget'; diff --git a/packages/fluent-ui/src/CheckboxesWidget/CheckboxesWidget.tsx b/packages/fluent-ui/src/CheckboxesWidget/CheckboxesWidget.tsx deleted file mode 100644 index 5ddbb7dc8b..0000000000 --- a/packages/fluent-ui/src/CheckboxesWidget/CheckboxesWidget.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { FormEvent, FocusEvent } from 'react'; -import { Checkbox } from '@fluentui/react'; -import { - ariaDescribedByIds, - enumOptionsDeselectValue, - enumOptionsIsSelected, - enumOptionsSelectValue, - enumOptionsValueForIndex, - labelValue, - optionId, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -import FluentLabel, { styles_red } from '../FluentLabel/FluentLabel'; -import { allowedProps } from '../CheckboxWidget'; - -export default function CheckboxesWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ - label, - hideLabel, - id, - disabled, - options, - value, - autofocus, - readonly, - required, - onChange, - onBlur, - onFocus, - rawErrors = [], -}: WidgetProps) { - const { enumOptions, enumDisabled, emptyValue } = options; - const checkboxesValues = Array.isArray(value) ? value : [value]; - - const _onChange = (index: number) => (_ev?: FormEvent, checked?: boolean) => { - if (checked) { - onChange(enumOptionsSelectValue(index, checkboxesValues, enumOptions)); - } else { - onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions)); - } - }; - - const _onBlur = ({ target }: FocusEvent) => - onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue)); - - const _onFocus = ({ target }: FocusEvent) => - onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue)); - - const uiProps = _pick((options.props as object) || {}, allowedProps); - - return ( - <> - {labelValue(, hideLabel)} - {Array.isArray(enumOptions) && - enumOptions.map((option, index: number) => { - const checked = enumOptionsIsSelected(option.value, checkboxesValues); - const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1; - return ( - (id)} - /* Backward compatibility with fluentui v7 */ - {...{ - autoFocus: autofocus && index === 0, - onBlur: _onBlur, - onFocus: _onFocus, - }} - /> - ); - })} - {(rawErrors || []).join('\n')} - - ); -} diff --git a/packages/fluent-ui/src/CheckboxesWidget/index.ts b/packages/fluent-ui/src/CheckboxesWidget/index.ts deleted file mode 100644 index 97152004fa..0000000000 --- a/packages/fluent-ui/src/CheckboxesWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './CheckboxesWidget'; -export * from './CheckboxesWidget'; diff --git a/packages/fluent-ui/src/ColorWidget/ColorWidget.tsx b/packages/fluent-ui/src/ColorWidget/ColorWidget.tsx deleted file mode 100644 index 5ea62683fa..0000000000 --- a/packages/fluent-ui/src/ColorWidget/ColorWidget.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { ColorPicker, IColorPickerProps, IColor, getColorFromString } from '@fluentui/react'; -import { - ariaDescribedByIds, - labelValue, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -import FluentLabel from '../FluentLabel/FluentLabel'; - -const allowedProps: (keyof IColorPickerProps)[] = [ - 'componentRef', - 'color', - 'strings', - 'onChange', - 'alphaType', - 'alphaSliderHidden', - 'hexLabel', - 'redLabel', - 'greenLabel', - 'blueLabel', - 'alphaLabel', - 'className', - 'theme', - 'styles', - 'showPreview', -]; - -export default function ColorWidget({ - id, - options, - value, - required, - label, - hideLabel, - onChange, -}: WidgetProps) { - const updateColor = (_ev: any, colorObj: IColor) => { - onChange(colorObj.hex); - }; - - const uiProps = { id, ..._pick((options.props as object) || {}, allowedProps) }; - - return ( - <> - {labelValue(, hideLabel)} - (id)} - /> - - ); -} diff --git a/packages/fluent-ui/src/ColorWidget/index.ts b/packages/fluent-ui/src/ColorWidget/index.ts deleted file mode 100644 index 9d202495a3..0000000000 --- a/packages/fluent-ui/src/ColorWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './ColorWidget'; -export * from './ColorWidget'; diff --git a/packages/fluent-ui/src/DateTimeWidget/DateTimeWidget.tsx b/packages/fluent-ui/src/DateTimeWidget/DateTimeWidget.tsx deleted file mode 100644 index 6f892b2a1a..0000000000 --- a/packages/fluent-ui/src/DateTimeWidget/DateTimeWidget.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { - WidgetProps, - getTemplate, - localToUTC, - utcToLocal, - StrictRJSFSchema, - RJSFSchema, - FormContextType, -} from '@rjsf/utils'; - -export default function DateTimeWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: WidgetProps) { - const { registry } = props; - const uiProps: any = props.options['props'] || {}; - const options = { - ...props.options, - props: { - type: 'datetime-local', - ...uiProps, - }, - }; - const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options); - - const value = utcToLocal(props.value); - const onChange = (value: any) => { - props.onChange(localToUTC(value)); - }; - // TODO: rows and columns. - return ; -} diff --git a/packages/fluent-ui/src/DateTimeWidget/index.ts b/packages/fluent-ui/src/DateTimeWidget/index.ts deleted file mode 100644 index 0db366167f..0000000000 --- a/packages/fluent-ui/src/DateTimeWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './DateTimeWidget'; -export * from './DateTimeWidget'; diff --git a/packages/fluent-ui/src/DateWidget/DateWidget.tsx b/packages/fluent-ui/src/DateWidget/DateWidget.tsx deleted file mode 100644 index 6ef3b18f4e..0000000000 --- a/packages/fluent-ui/src/DateWidget/DateWidget.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { FocusEvent } from 'react'; -import { - ariaDescribedByIds, - labelValue, - pad, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - TranslatableString, - WidgetProps, -} from '@rjsf/utils'; -import { DatePicker, DayOfWeek, mergeStyleSets } from '@fluentui/react'; -import _pick from 'lodash/pick'; - -// Keys of IDropdownProps from @fluentui/react -const allowedProps = [ - 'componentRef', - 'styles', - 'theme', - 'calloutProps', - 'calendarProps', - 'textField', - 'calendarAs', - 'onSelectDate', - 'label', - 'isRequired', - 'disabled', - 'ariaLabel', - 'underlined', - 'pickerAriaLabel', - 'isMonthPickerVisible', - 'showMonthPickerAsOverlay', - 'allowTextInput', - 'disableAutoFocus', - 'placeholder', - 'today', - 'value', - 'formatDate', - 'parseDateFromString', - 'firstDayOfWeek', - 'strings', - 'highlightCurrentMonth', - 'highlightSelectedMonth', - 'showWeekNumbers', - 'firstWeekOfYear', - 'showGoToToday', - 'borderless', - 'className', - 'dateTimeFormatter', - 'minDate', - 'maxDate', - 'initialPickerDate', - 'allFocusable', - 'onAfterMenuDismiss', - 'showCloseButton', - 'tabIndex', -]; - -const controlClass = mergeStyleSets({ - control: { - margin: '0 0 15px 0', - }, -}); - -// TODO: move to utils. -// TODO: figure out a standard format for this, as well as -// how we can get this to work with locales. -const formatDate = (date?: Date) => { - if (!date) { - return ''; - } - const yyyy = pad(date.getFullYear(), 4); - const MM = pad(date.getMonth() + 1, 2); - const dd = pad(date.getDate(), 2); - return `${yyyy}-${MM}-${dd}`; -}; - -const parseDate = (dateStr?: string) => { - if (!dateStr) { - return undefined; - } - const [year, month, day] = dateStr.split('-').map((e) => parseInt(e)); - const dt = new Date(year, month - 1, day); - return dt; -}; - -export default function DateWidget({ - id, - required, - label, - hideLabel, - value, - onChange, - onBlur, - onFocus, - options, - placeholder, - registry, -}: WidgetProps) { - const { translateString } = registry; - const _onSelectDate = (date: Date | null | undefined) => { - if (date) { - const formatted = formatDate(date); - formatted && onChange(formatted); - } - }; - const _onBlur = ({ target }: FocusEvent) => onBlur(id, target && target.value); - const _onFocus = ({ target }: FocusEvent) => onFocus(id, target && target.value); - - const uiProps = _pick((options.props as object) || {}, allowedProps); - return ( - (id)} - /> - ); -} diff --git a/packages/fluent-ui/src/DateWidget/index.ts b/packages/fluent-ui/src/DateWidget/index.ts deleted file mode 100644 index 923b0077fb..0000000000 --- a/packages/fluent-ui/src/DateWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './DateWidget'; -export * from './DateWidget'; diff --git a/packages/fluent-ui/src/DescriptionField/DescriptionField.tsx b/packages/fluent-ui/src/DescriptionField/DescriptionField.tsx deleted file mode 100644 index 023adb8b36..0000000000 --- a/packages/fluent-ui/src/DescriptionField/DescriptionField.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; -import { Text } from '@fluentui/react'; - -export default function DescriptionField< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ description, id }: DescriptionFieldProps) { - if (description) { - return {description}; - } - - return null; -} diff --git a/packages/fluent-ui/src/DescriptionField/index.ts b/packages/fluent-ui/src/DescriptionField/index.ts deleted file mode 100644 index 401540d99b..0000000000 --- a/packages/fluent-ui/src/DescriptionField/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './DescriptionField'; -export * from './DescriptionField'; diff --git a/packages/fluent-ui/src/ErrorList/ErrorList.tsx b/packages/fluent-ui/src/ErrorList/ErrorList.tsx deleted file mode 100644 index 56b979488a..0000000000 --- a/packages/fluent-ui/src/ErrorList/ErrorList.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { MessageBar, MessageBarType } from '@fluentui/react'; -import { ErrorListProps, FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils'; - -export default function ErrorList({ - errors, - registry, -}: ErrorListProps) { - const { translateString } = registry; - return ( - <> - {errors.map((error, i) => { - return ( - - {error.stack} - - ); - })} - - ); -} diff --git a/packages/fluent-ui/src/ErrorList/index.ts b/packages/fluent-ui/src/ErrorList/index.ts deleted file mode 100644 index 79376ace11..0000000000 --- a/packages/fluent-ui/src/ErrorList/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './ErrorList'; -export * from './ErrorList'; diff --git a/packages/fluent-ui/src/FieldErrorTemplate/FieldErrorTemplate.tsx b/packages/fluent-ui/src/FieldErrorTemplate/FieldErrorTemplate.tsx deleted file mode 100644 index 661544b191..0000000000 --- a/packages/fluent-ui/src/FieldErrorTemplate/FieldErrorTemplate.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { errorId, FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; -import { List } from '@fluentui/react'; - -/** The `FieldErrorTemplate` component renders the errors local to the particular field - * - * @param props - The `FieldErrorProps` for the errors being rendered - */ -export default function FieldErrorTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: FieldErrorProps) { - const { errors = [], idSchema } = props; - if (errors.length === 0) { - return null; - } - const id = errorId(idSchema); - - return ; -} diff --git a/packages/fluent-ui/src/FieldErrorTemplate/index.ts b/packages/fluent-ui/src/FieldErrorTemplate/index.ts deleted file mode 100644 index 2fbf1c353d..0000000000 --- a/packages/fluent-ui/src/FieldErrorTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './FieldErrorTemplate'; -export * from './FieldErrorTemplate'; diff --git a/packages/fluent-ui/src/FieldHelpTemplate/FieldHelpTemplate.tsx b/packages/fluent-ui/src/FieldHelpTemplate/FieldHelpTemplate.tsx deleted file mode 100644 index 7aec65a546..0000000000 --- a/packages/fluent-ui/src/FieldHelpTemplate/FieldHelpTemplate.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; -import { Text } from '@fluentui/react'; - -/** The `FieldHelpTemplate` component renders any help desired for a field - * - * @param props - The `FieldHelpProps` to be rendered - */ -export default function FieldHelpTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: FieldHelpProps) { - const { idSchema, help } = props; - if (!help) { - return null; - } - const id = helpId(idSchema); - return {help}; -} diff --git a/packages/fluent-ui/src/FieldHelpTemplate/index.ts b/packages/fluent-ui/src/FieldHelpTemplate/index.ts deleted file mode 100644 index b439bce3f1..0000000000 --- a/packages/fluent-ui/src/FieldHelpTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './FieldHelpTemplate'; -export * from './FieldHelpTemplate'; diff --git a/packages/fluent-ui/src/FieldTemplate/FieldTemplate.tsx b/packages/fluent-ui/src/FieldTemplate/FieldTemplate.tsx deleted file mode 100644 index 8363424daa..0000000000 --- a/packages/fluent-ui/src/FieldTemplate/FieldTemplate.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { - FieldTemplateProps, - FormContextType, - getTemplate, - getUiOptions, - RJSFSchema, - StrictRJSFSchema, -} from '@rjsf/utils'; -import { Text } from '@fluentui/react'; - -export default function FieldTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: FieldTemplateProps) { - const { children, errors, help, displayLabel, description, rawDescription, hidden, uiSchema, registry } = props; - const uiOptions = getUiOptions(uiSchema); - const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>( - 'WrapIfAdditionalTemplate', - registry, - uiOptions - ); - if (hidden) { - return
{children}
; - } - return ( - - {children} - {displayLabel && rawDescription && {description}} - {errors} - {help} - - ); -} diff --git a/packages/fluent-ui/src/FieldTemplate/index.ts b/packages/fluent-ui/src/FieldTemplate/index.ts deleted file mode 100644 index 6f7dc3861c..0000000000 --- a/packages/fluent-ui/src/FieldTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './FieldTemplate'; -export * from './FieldTemplate'; diff --git a/packages/fluent-ui/src/FluentLabel/FluentLabel.tsx b/packages/fluent-ui/src/FluentLabel/FluentLabel.tsx deleted file mode 100644 index 97e7f8a137..0000000000 --- a/packages/fluent-ui/src/FluentLabel/FluentLabel.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Label } from '@fluentui/react'; - -export const styles_red = { - // TODO: get this color from theme. - color: 'rgb(164, 38, 44)', - fontSize: 12, - fontWeight: 'normal' as any, - fontFamily: `"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif`, -}; - -interface FluentLabelProps { - label?: string; - required?: boolean; - id?: string; -} - -export default function FluentLabel({ label, required, id }: FluentLabelProps) { - return ( - - ); -} diff --git a/packages/fluent-ui/src/FuiForm/FuiForm.ts b/packages/fluent-ui/src/FuiForm/FuiForm.ts deleted file mode 100644 index b2a194e013..0000000000 --- a/packages/fluent-ui/src/FuiForm/FuiForm.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ComponentType } from 'react'; -import { FormProps, withTheme } from '@rjsf/core'; - -import { generateTheme } from '../Theme'; -import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; - -export function generateForm< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(): ComponentType> { - return withTheme(generateTheme()); -} - -export default generateForm(); diff --git a/packages/fluent-ui/src/FuiForm/index.ts b/packages/fluent-ui/src/FuiForm/index.ts deleted file mode 100644 index 9e433ecd76..0000000000 --- a/packages/fluent-ui/src/FuiForm/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './FuiForm'; -export * from './FuiForm'; diff --git a/packages/fluent-ui/src/IconButton/IconButton.tsx b/packages/fluent-ui/src/IconButton/IconButton.tsx deleted file mode 100644 index 8926864d15..0000000000 --- a/packages/fluent-ui/src/IconButton/IconButton.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { IconButton, IIconProps } from '@fluentui/react'; -import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils'; - -export default function FluentIconButton< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: IconButtonProps) { - const iconProps: IIconProps = { - iconName: props.icon as string, - }; - - return ; -} - -export function CopyButton( - props: IconButtonProps -) { - const { - registry: { translateString }, - } = props; - return title={translateString(TranslatableString.CopyButton)} {...props} icon='Copy' />; -} - -export function MoveDownButton( - props: IconButtonProps -) { - const { - registry: { translateString }, - } = props; - return ( - title={translateString(TranslatableString.MoveDownButton)} {...props} icon='Down' /> - ); -} - -export function MoveUpButton( - props: IconButtonProps -) { - const { - registry: { translateString }, - } = props; - return title={translateString(TranslatableString.MoveUpButton)} {...props} icon='Up' />; -} - -export function RemoveButton( - props: IconButtonProps -) { - const { - registry: { translateString }, - } = props; - return ( - title={translateString(TranslatableString.RemoveButton)} {...props} icon='Delete' /> - ); -} diff --git a/packages/fluent-ui/src/IconButton/index.ts b/packages/fluent-ui/src/IconButton/index.ts deleted file mode 100644 index 655ec4c488..0000000000 --- a/packages/fluent-ui/src/IconButton/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './IconButton'; -export * from './IconButton'; diff --git a/packages/fluent-ui/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx b/packages/fluent-ui/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx deleted file mode 100644 index ff7da9661c..0000000000 --- a/packages/fluent-ui/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { CSSProperties } from 'react'; -import { - canExpand, - descriptionId, - FormContextType, - getTemplate, - getUiOptions, - ObjectFieldTemplateProps, - RJSFSchema, - StrictRJSFSchema, - titleId, -} from '@rjsf/utils'; - -const rightJustify = { - float: 'right', -} as CSSProperties; - -export default function ObjectFieldTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ - description, - title, - properties, - required, - disabled, - readonly, - schema, - uiSchema, - idSchema, - formData, - onAddClick, - registry, -}: ObjectFieldTemplateProps) { - const uiOptions = getUiOptions(uiSchema); - const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, uiOptions); - const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>( - 'DescriptionFieldTemplate', - registry, - uiOptions - ); - // Button templates are not overridden in the uiSchema - const { - ButtonTemplates: { AddButton }, - } = registry.templates; - return ( - <> - {title && ( - (idSchema)} - title={title} - required={required} - schema={schema} - uiSchema={uiSchema} - registry={registry} - /> - )} - {description && ( - (idSchema)} - schema={schema} - uiSchema={uiSchema} - description={description} - registry={registry} - /> - )} -
-
{properties.map((element) => element.content)}
- {canExpand(schema, uiSchema, formData) && ( - - - - )} -
- - ); -} diff --git a/packages/fluent-ui/src/ObjectFieldTemplate/index.ts b/packages/fluent-ui/src/ObjectFieldTemplate/index.ts deleted file mode 100644 index 77c68a9a40..0000000000 --- a/packages/fluent-ui/src/ObjectFieldTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './ObjectFieldTemplate'; -export * from './ObjectFieldTemplate'; diff --git a/packages/fluent-ui/src/RadioWidget/RadioWidget.tsx b/packages/fluent-ui/src/RadioWidget/RadioWidget.tsx deleted file mode 100644 index 8ebc4a9a34..0000000000 --- a/packages/fluent-ui/src/RadioWidget/RadioWidget.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { FormEvent, FocusEvent } from 'react'; -import { ChoiceGroup, IChoiceGroupOption, IChoiceGroupProps } from '@fluentui/react'; -import { - ariaDescribedByIds, - enumOptionsIndexForValue, - enumOptionsValueForIndex, - labelValue, - optionId, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -const allowedProps: (keyof IChoiceGroupProps)[] = [ - 'componentRef', - 'options', - 'defaultSelectedKey', - 'selectedKey', - 'onChange', - 'label', - /* Backward compatibility with fluentui v7 */ - 'onChanged' as any, - 'theme', - 'styles', - 'ariaLabelledBy', -]; - -export default function RadioWidget({ - id, - options, - value, - required, - label, - hideLabel, - onChange, - onBlur, - onFocus, - disabled, - readonly, -}: WidgetProps) { - const { enumOptions, enumDisabled, emptyValue } = options; - - function _onChange(_ev?: FormEvent, option?: IChoiceGroupOption): void { - if (option) { - onChange(enumOptionsValueForIndex(option.key, enumOptions, emptyValue)); - } - } - - const _onBlur = ({ target }: FocusEvent) => - onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue)); - const _onFocus = ({ target }: FocusEvent) => - onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue)); - - const newOptions = Array.isArray(enumOptions) - ? enumOptions.map((option, index) => ({ - key: String(index), - name: id, - id: optionId(id, index), - text: option.label, - disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1, - 'aria-describedby': ariaDescribedByIds(id), - })) - : []; - - const selectedIndex = enumOptionsIndexForValue(value, enumOptions) as string; - - const uiProps = _pick((options.props as object) || {}, allowedProps); - return ( - - ); -} diff --git a/packages/fluent-ui/src/RadioWidget/index.ts b/packages/fluent-ui/src/RadioWidget/index.ts deleted file mode 100644 index 10292dc565..0000000000 --- a/packages/fluent-ui/src/RadioWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './RadioWidget'; -export * from './RadioWidget'; diff --git a/packages/fluent-ui/src/RangeWidget/RangeWidget.tsx b/packages/fluent-ui/src/RangeWidget/RangeWidget.tsx deleted file mode 100644 index 976f77f4cd..0000000000 --- a/packages/fluent-ui/src/RangeWidget/RangeWidget.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { Slider } from '@fluentui/react'; -import { - ariaDescribedByIds, - labelValue, - FormContextType, - rangeSpec, - RJSFSchema, - StrictRJSFSchema, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -import FluentLabel from '../FluentLabel/FluentLabel'; - -// Keys of ISliderProps from @fluentui/react -const allowedProps = [ - 'componentRef', - 'styles?', - 'theme', - 'label', - 'defaultValue', - 'value', - 'min', - 'max', - 'step', - 'showValue', - 'onChange', - 'ariaLabel', - 'ariaValueText', - 'vertical', - 'disabled', - 'snapToStep', - 'className', - 'buttonProps', - 'valueFormat', - 'originFromZero', -]; - -export default function RangeWidget({ - value, - readonly, - disabled, - options, - schema, - onChange, - required, - label, - hideLabel, - id, -}: WidgetProps) { - const sliderProps = { value, label, id, ...rangeSpec(schema) }; - - const _onChange = (value: number) => onChange(value); - - const uiProps = { id, ..._pick((options.props as object) || {}, allowedProps) }; - return ( - <> - {labelValue(, hideLabel)} - (id)} - /> - - ); -} diff --git a/packages/fluent-ui/src/RangeWidget/index.ts b/packages/fluent-ui/src/RangeWidget/index.ts deleted file mode 100644 index d8c49226c6..0000000000 --- a/packages/fluent-ui/src/RangeWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './RangeWidget'; -export * from './RangeWidget'; diff --git a/packages/fluent-ui/src/SelectWidget/SelectWidget.tsx b/packages/fluent-ui/src/SelectWidget/SelectWidget.tsx deleted file mode 100644 index ac4dc98233..0000000000 --- a/packages/fluent-ui/src/SelectWidget/SelectWidget.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import { FormEvent } from 'react'; -import { Dropdown, IDropdownOption } from '@fluentui/react'; -import { - ariaDescribedByIds, - enumOptionsDeselectValue, - enumOptionsIndexForValue, - enumOptionsSelectValue, - enumOptionsValueForIndex, - labelValue, - WidgetProps, - StrictRJSFSchema, - RJSFSchema, - FormContextType, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -// Keys of IDropdownProps from @fluentui/react -const allowedProps = [ - 'placeHolder', - 'options', - 'onChange', - 'onChanged', - 'onRenderLabel', - 'onRenderPlaceholder', - 'onRenderPlaceHolder', - 'onRenderTitle', - 'onRenderCaretDown', - 'dropdownWidth', - 'responsiveMode', - 'defaultSelectedKeys', - 'selectedKeys', - 'multiselectDelimiter', - 'notifyOnReselect', - 'isDisabled', - 'keytipProps', - 'theme', - 'styles', - - // ISelectableDroppableTextProps - 'componentRef', - 'label', - 'ariaLabel', - 'id', - 'className', - 'defaultSelectedKey', - 'selectedKey', - 'multiSelect', - 'options', - 'onRenderContainer', - 'onRenderList', - 'onRenderItem', - 'onRenderOption', - 'onDismiss', - 'disabled', - 'required', - 'calloutProps', - 'panelProps', - 'errorMessage', - 'placeholder', - 'openOnKeyboardFocus', -]; - -export default function SelectWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ - id, - options, - label, - hideLabel, - required, - disabled, - readonly, - value, - multiple, - onChange, - onBlur, - onFocus, -}: WidgetProps) { - const { enumOptions, enumDisabled, emptyValue } = options; - - const _onChange = (_ev?: FormEvent, item?: IDropdownOption) => { - if (!item) { - return; - } - if (multiple) { - const valueOrDefault = value || []; - if (item.selected) { - onChange(enumOptionsSelectValue(item.key, valueOrDefault, enumOptions)); - } else { - onChange(enumOptionsDeselectValue(item.key, valueOrDefault, enumOptions)); - } - } else { - onChange(enumOptionsValueForIndex(item.key, enumOptions, emptyValue)); - } - }; - const _onBlur = (e: any) => onBlur(id, enumOptionsValueForIndex(e.target.value, enumOptions, emptyValue)); - - const _onFocus = (e: any) => onFocus(id, enumOptionsValueForIndex(e.target.value, enumOptions, emptyValue)); - - const newOptions = Array.isArray(enumOptions) - ? enumOptions.map((option, index) => ({ - key: String(index), - text: option.label, - disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1, - })) - : []; - - const uiProps = _pick((options.props as object) || {}, allowedProps); - const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple); - return ( - (id)} - /> - ); -} diff --git a/packages/fluent-ui/src/SelectWidget/index.ts b/packages/fluent-ui/src/SelectWidget/index.ts deleted file mode 100644 index e37ea725b8..0000000000 --- a/packages/fluent-ui/src/SelectWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './SelectWidget'; -export * from './SelectWidget'; diff --git a/packages/fluent-ui/src/SubmitButton/SubmitButton.tsx b/packages/fluent-ui/src/SubmitButton/SubmitButton.tsx deleted file mode 100644 index 05a2194c5b..0000000000 --- a/packages/fluent-ui/src/SubmitButton/SubmitButton.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { FormContextType, getSubmitButtonOptions, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils'; -import { PrimaryButton } from '@fluentui/react'; - -export default function SubmitButton< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ uiSchema }: SubmitButtonProps) { - const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(uiSchema); - if (norender) { - return null; - } - return ( -
-
-
- -
-
- ); -} diff --git a/packages/fluent-ui/src/SubmitButton/index.ts b/packages/fluent-ui/src/SubmitButton/index.ts deleted file mode 100644 index f676497ba2..0000000000 --- a/packages/fluent-ui/src/SubmitButton/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './SubmitButton'; -export * from './SubmitButton'; diff --git a/packages/fluent-ui/src/Templates/Templates.ts b/packages/fluent-ui/src/Templates/Templates.ts deleted file mode 100644 index 66337a0cb8..0000000000 --- a/packages/fluent-ui/src/Templates/Templates.ts +++ /dev/null @@ -1,45 +0,0 @@ -import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate'; -import AddButton from '../AddButton'; -import ArrayFieldTemplate from '../ArrayFieldTemplate'; -import BaseInputTemplate from '../BaseInputTemplate/BaseInputTemplate'; -import DescriptionField from '../DescriptionField'; -import ErrorList from '../ErrorList'; -import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from '../IconButton'; -import FieldErrorTemplate from '../FieldErrorTemplate'; -import FieldHelpTemplate from '../FieldHelpTemplate'; -import FieldTemplate from '../FieldTemplate'; -import ObjectFieldTemplate from '../ObjectFieldTemplate'; -import SubmitButton from '../SubmitButton'; -import TitleField from '../TitleField'; -import WrapIfAdditionalTemplate from '../WrapIfAdditionalTemplate'; -import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils'; - -export function generateTemplates< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(): Partial> { - return { - ArrayFieldItemTemplate, - ArrayFieldTemplate, - BaseInputTemplate, - ButtonTemplates: { - CopyButton, - AddButton, - MoveDownButton, - MoveUpButton, - RemoveButton, - SubmitButton, - }, - DescriptionFieldTemplate: DescriptionField, - ErrorListTemplate: ErrorList, - FieldErrorTemplate, - FieldHelpTemplate, - FieldTemplate, - ObjectFieldTemplate, - TitleFieldTemplate: TitleField, - WrapIfAdditionalTemplate, - }; -} - -export default generateTemplates(); diff --git a/packages/fluent-ui/src/Templates/index.ts b/packages/fluent-ui/src/Templates/index.ts deleted file mode 100644 index 612ccf692a..0000000000 --- a/packages/fluent-ui/src/Templates/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './Templates'; -export * from './Templates'; diff --git a/packages/fluent-ui/src/TextareaWidget/TextareaWidget.tsx b/packages/fluent-ui/src/TextareaWidget/TextareaWidget.tsx deleted file mode 100644 index bb5deb98fc..0000000000 --- a/packages/fluent-ui/src/TextareaWidget/TextareaWidget.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { FormContextType, getTemplate, getUiOptions, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils'; - -export default function TextareaWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: WidgetProps) { - const { uiSchema, registry } = props; - const options = getUiOptions(uiSchema); - const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options); - // TODO: rows and columns. - return ; -} diff --git a/packages/fluent-ui/src/TextareaWidget/index.ts b/packages/fluent-ui/src/TextareaWidget/index.ts deleted file mode 100644 index 20e6d8e26b..0000000000 --- a/packages/fluent-ui/src/TextareaWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './TextareaWidget'; -export * from './TextareaWidget'; diff --git a/packages/fluent-ui/src/Theme/Theme.ts b/packages/fluent-ui/src/Theme/Theme.ts deleted file mode 100644 index 478e30d58b..0000000000 --- a/packages/fluent-ui/src/Theme/Theme.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ThemeProps } from '@rjsf/core'; - -import { generateTemplates } from '../Templates'; -import { generateWidgets } from '../Widgets'; -import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; - -export function generateTheme< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(): ThemeProps { - return { - templates: generateTemplates(), - widgets: generateWidgets(), - }; -} - -export default generateTheme(); diff --git a/packages/fluent-ui/src/Theme/index.ts b/packages/fluent-ui/src/Theme/index.ts deleted file mode 100644 index 6dfd7fa6e1..0000000000 --- a/packages/fluent-ui/src/Theme/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './Theme'; -export * from './Theme'; diff --git a/packages/fluent-ui/src/TitleField/TitleField.tsx b/packages/fluent-ui/src/TitleField/TitleField.tsx deleted file mode 100644 index 7334cc4beb..0000000000 --- a/packages/fluent-ui/src/TitleField/TitleField.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { FormContextType, RJSFSchema, StrictRJSFSchema, TitleFieldProps } from '@rjsf/utils'; -import { Label } from '@fluentui/react'; - -const styles = { - root: [ - { - fontSize: 24, - marginBottom: 20, - paddingBottom: 0, - }, - ], -}; - -export default function TitleField({ - id, - title, -}: TitleFieldProps) { - return ( - - ); -} diff --git a/packages/fluent-ui/src/TitleField/index.ts b/packages/fluent-ui/src/TitleField/index.ts deleted file mode 100644 index cfa479d034..0000000000 --- a/packages/fluent-ui/src/TitleField/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './TitleField'; -export * from './TitleField'; diff --git a/packages/fluent-ui/src/UpDownWidget/UpDownWidget.tsx b/packages/fluent-ui/src/UpDownWidget/UpDownWidget.tsx deleted file mode 100644 index f929787437..0000000000 --- a/packages/fluent-ui/src/UpDownWidget/UpDownWidget.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { ChangeEvent, FocusEvent, SyntheticEvent } from 'react'; -import { ISpinButtonProps, SpinButton } from '@fluentui/react'; -import { - ariaDescribedByIds, - FormContextType, - labelValue, - rangeSpec, - RJSFSchema, - StrictRJSFSchema, - TranslatableString, - WidgetProps, -} from '@rjsf/utils'; -import _pick from 'lodash/pick'; - -import FluentLabel from '../FluentLabel/FluentLabel'; - -// Keys of ISpinButtonProps from @fluentui/react -const allowedProps: (keyof ISpinButtonProps)[] = [ - 'ariaDescribedBy', - 'ariaLabel', - 'ariaPositionInSet', - 'ariaSetSize', - 'ariaValueNow', - 'ariaValueText', - 'className', - 'componentRef', - 'decrementButtonAriaLabel', - 'decrementButtonIcon', - 'defaultValue', - 'disabled', - 'downArrowButtonStyles', - /* Backward compatibility with fluentui v7 */ - 'getClassNames' as any, - 'iconButtonProps', - 'iconProps', - 'incrementButtonAriaLabel', - 'incrementButtonIcon', - 'inputProps', - 'keytipProps', - 'label', - 'labelPosition', - 'max', - 'min', - 'onBlur', - 'onDecrement', - 'onFocus', - 'onIncrement', - 'onValidate', - 'precision', - 'step', - 'styles', - 'theme', - 'title', - 'upArrowButtonStyles', - 'value', -]; - -export default function UpDownWidget< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->({ - id, - required, - readonly, - disabled, - label, - hideLabel, - value, - onChange, - onBlur, - onFocus, - options, - schema, - registry, -}: WidgetProps) { - const { translateString } = registry; - const _onChange = (ev: ChangeEvent | SyntheticEvent, newValue?: string) => { - if (newValue) { - onChange(Number(newValue)); - } else if ('value' in ev.target) { - /* Backward compatibility with fluentui v7 */ - onChange(Number(ev.target.value)); - } - }; - - let { min, max, step } = rangeSpec(schema); - if (min === undefined) { - min = -1 * Infinity; - } - if (max === undefined) { - max = Infinity; - } - if (step === undefined) { - step = 1; - } - - const _onIncrement = (value: string) => { - if (Number(value) + step! <= max!) { - onChange(Number(value) + step!); - } - }; - - const _onDecrement = (value: string) => { - if (Number(value) - step! >= min!) { - onChange(Number(value) - step!); - } - }; - - const _onBlur = ({ target }: FocusEvent) => onBlur(id, target && target.value); - const _onFocus = ({ target }: FocusEvent) => onFocus(id, target && target.value); - - const uiProps = _pick((options.props as object) || {}, allowedProps); - - return ( - <> - {labelValue(, hideLabel)} - (id)} - /> - - ); -} diff --git a/packages/fluent-ui/src/UpDownWidget/index.ts b/packages/fluent-ui/src/UpDownWidget/index.ts deleted file mode 100644 index 2e2ae55279..0000000000 --- a/packages/fluent-ui/src/UpDownWidget/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './UpDownWidget'; -export * from './UpDownWidget'; diff --git a/packages/fluent-ui/src/Widgets/Widgets.ts b/packages/fluent-ui/src/Widgets/Widgets.ts deleted file mode 100644 index 11dc7a927b..0000000000 --- a/packages/fluent-ui/src/Widgets/Widgets.ts +++ /dev/null @@ -1,32 +0,0 @@ -import CheckboxWidget from '../CheckboxWidget/CheckboxWidget'; -import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget'; -import ColorWidget from '../ColorWidget/ColorWidget'; -import DateWidget from '../DateWidget/DateWidget'; -import DateTimeWidget from '../DateTimeWidget/DateTimeWidget'; -import RadioWidget from '../RadioWidget/RadioWidget'; -import RangeWidget from '../RangeWidget/RangeWidget'; -import SelectWidget from '../SelectWidget/SelectWidget'; -import TextareaWidget from '../TextareaWidget/TextareaWidget'; -import UpDownWidget from '../UpDownWidget/UpDownWidget'; -import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; - -export function generateWidgets< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(): RegistryWidgetsType { - return { - CheckboxWidget, - CheckboxesWidget, - ColorWidget, - DateWidget, - DateTimeWidget, - RadioWidget, - RangeWidget, - SelectWidget, - TextareaWidget, - UpDownWidget, - }; -} - -export default generateWidgets(); diff --git a/packages/fluent-ui/src/Widgets/index.ts b/packages/fluent-ui/src/Widgets/index.ts deleted file mode 100644 index de857bf557..0000000000 --- a/packages/fluent-ui/src/Widgets/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './Widgets'; -export * from './Widgets'; diff --git a/packages/fluent-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx b/packages/fluent-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx deleted file mode 100644 index 401a345388..0000000000 --- a/packages/fluent-ui/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { FocusEvent } from 'react'; -import { TextField } from '@fluentui/react'; -import { - ADDITIONAL_PROPERTY_FLAG, - FormContextType, - RJSFSchema, - StrictRJSFSchema, - TranslatableString, - WrapIfAdditionalTemplateProps, -} from '@rjsf/utils'; - -export default function WrapIfAdditionalTemplate< - T = any, - S extends StrictRJSFSchema = RJSFSchema, - F extends FormContextType = any ->(props: WrapIfAdditionalTemplateProps) { - const { - children, - disabled, - id, - label, - onDropPropertyClick, - onKeyChange, - readonly, - registry, - required, - schema, - style, - uiSchema, - } = props; - const { templates, translateString } = registry; - - // TODO: do this better by not returning the form-group class from master. - let { classNames = '' } = props; - classNames = 'ms-Grid-col ms-sm12 ' + classNames.replace('form-group', ''); - - // Button templates are not overridden in the uiSchema - const { RemoveButton } = templates.ButtonTemplates; - const keyLabel = translateString(TranslatableString.KeyLabel, [label]); - const additional = ADDITIONAL_PROPERTY_FLAG in schema; - - if (!additional) { - return ( -
- {children} -
- ); - } - - const handleBlur = ({ target }: FocusEvent) => onKeyChange(target.value); - - return ( -
-
-
- -
-
{children}
-
- -
-
-
- ); -} diff --git a/packages/fluent-ui/src/WrapIfAdditionalTemplate/index.ts b/packages/fluent-ui/src/WrapIfAdditionalTemplate/index.ts deleted file mode 100644 index 7d7af6629d..0000000000 --- a/packages/fluent-ui/src/WrapIfAdditionalTemplate/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './WrapIfAdditionalTemplate'; -export * from './WrapIfAdditionalTemplate'; diff --git a/packages/fluent-ui/src/index.ts b/packages/fluent-ui/src/index.ts deleted file mode 100644 index e89e0e255e..0000000000 --- a/packages/fluent-ui/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { initializeIcons } from '@fluentui/react'; -import FuiForm from './FuiForm/'; - -export { default as Form, generateForm } from './FuiForm'; -export { default as Templates, generateTemplates } from './Templates'; -export { default as Theme, generateTheme } from './Theme'; -export { default as Widgets, generateWidgets } from './Widgets'; - -initializeIcons(); - -export default FuiForm; diff --git a/packages/fluent-ui/src/tsconfig.json b/packages/fluent-ui/src/tsconfig.json deleted file mode 100644 index 36a20a539a..0000000000 --- a/packages/fluent-ui/src/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "include": [ - "./" - ], - "compilerOptions": { - "rootDir": "./", - "outDir": "../lib", - "baseUrl": "../", - "jsx": "react-jsx", - // There are type errors in @fluentui type definitions because of which skipLibCheck had to be added - // @fluentui/font-icons-mdl2/lib/IconNames.d.ts - // @fluentui/merge-styles/lib/mergeStyleSets.d.ts - // @fluentui/react/lib/components/SelectedItemsList/BaseSelectedItemsList.d.ts - // @fluentui/utilities/lib/styled.d.ts - "skipLibCheck": true - }, - "references": [ - { - "path": "../../core" - }, - { - "path": "../../utils" - }, - { - "path": "../../validator-ajv8" - } - ] -} diff --git a/packages/fluent-ui/test/Array.test.tsx b/packages/fluent-ui/test/Array.test.tsx deleted file mode 100644 index a17060201a..0000000000 --- a/packages/fluent-ui/test/Array.test.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { arrayTests } from '@rjsf/snapshot-tests'; - -import Form from '../src'; - -arrayTests(Form); diff --git a/packages/fluent-ui/test/Form.test.tsx b/packages/fluent-ui/test/Form.test.tsx deleted file mode 100644 index c96826c914..0000000000 --- a/packages/fluent-ui/test/Form.test.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { formTests } from '@rjsf/snapshot-tests'; - -import Form from '../src'; - -formTests(Form); diff --git a/packages/fluent-ui/test/Object.test.tsx b/packages/fluent-ui/test/Object.test.tsx deleted file mode 100644 index dabe023e32..0000000000 --- a/packages/fluent-ui/test/Object.test.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { objectTests } from '@rjsf/snapshot-tests'; - -import Form from '../src'; - -objectTests(Form); diff --git a/packages/fluent-ui/test/__snapshots__/Array.test.tsx.snap b/packages/fluent-ui/test/__snapshots__/Array.test.tsx.snap deleted file mode 100644 index 07d4c86e09..0000000000 --- a/packages/fluent-ui/test/__snapshots__/Array.test.tsx.snap +++ /dev/null @@ -1,4937 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`array fields array 1`] = ` -
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`array fields array icons 1`] = ` -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- - - - -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- - - - -
-
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`array fields checkboxes 1`] = ` -
-
-
- -
-
-
-
-
- -
-
-
-`; - -exports[`array fields empty errors array 1`] = ` -
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`array fields fixed array 1`] = ` -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`array fields has errors 1`] = ` -
-
-
-
- -  - -
- -
-
-
-
-
-
-
-
- -
- -
-
- -
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -`; - -exports[`array fields no errors 1`] = ` -
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`with title and description array 1`] = ` -
-
- - - a test description - - - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description array icons 1`] = ` -
-
- - - a test description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a test item description - - -
-
-
-
- - - - -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a test item description - - -
-
-
-
- - - - -
-
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description checkboxes 1`] = ` -
-
-
- - -
- - - a test description - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description fixed array 1`] = ` -
-
- - - a test description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a test item description - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a test item description - - -
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`with title and description from both array 1`] = ` -
-
- - - a fancier description - - - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from both array icons 1`] = ` -
-
- - - a fancier description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
- - - - -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
- - - - -
-
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from both checkboxes 1`] = ` -
-
-
- - -
- - - a fancier description - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from both fixed array 1`] = ` -
-
- - - a fancier description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`with title and description from uiSchema array 1`] = ` -
-
- - - a fancier description - - - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from uiSchema array icons 1`] = ` -
-
- - - a fancier description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
- - - - -
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
- - - - -
-
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from uiSchema checkboxes 1`] = ` -
-
-
- - -
- - - a fancier description - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description from uiSchema fixed array 1`] = ` -
-
- - - a fancier description - -
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
- - - a fancier item description - - -
-
-
-
-
-
-
-
-
- -
-
-
-`; - -exports[`with title and description with global label off array 1`] = ` -
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description with global label off array icons 1`] = ` -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- - - - -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- - - - -
-
-
- - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description with global label off checkboxes 1`] = ` -
-
-
- - -
- - - a test description - - -
-
-
-
- -
-
-
-`; - -exports[`with title and description with global label off fixed array 1`] = ` -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-`; diff --git a/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap b/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap deleted file mode 100644 index 6965aad758..0000000000 --- a/packages/fluent-ui/test/__snapshots__/Form.test.tsx.snap +++ /dev/null @@ -1,4277 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`single fields checkbox field 1`] = ` -
-
-
- - -
-
-
-
-
- -
-
-
-`; - -exports[`single fields checkbox field with label 1`] = ` -
-
-
- - -
-
-
-
-
- -
-
-
-`; - -exports[`single fields checkboxes field 1`] = ` -
-
- -
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
-
- -
-
-
-`; - -exports[`single fields field with description 1`] = ` -
-
-
-
-
-
-
- -
- -
-
-
- - - some description - - -
-
-
-
-
-
-
- -
-
-
-`; - -exports[`single fields field with description in uiSchema 1`] = ` -
-
-
-
-
-
-
- -
- -
-
-
- - - some other description - - -
-
-
-
-
-
-
- -
-
-
-`; - -exports[`single fields format color 1`] = ` -
-
-