@kwiz/fluentui 1.0.16 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +34 -0
- package/LICENSE +21 -21
- package/README.md +26 -26
- package/package.json +72 -72
- package/src/_modules/config.ts +9 -9
- package/src/_modules/constants.ts +3 -3
- package/src/controls/accordion.tsx +48 -48
- package/src/controls/button.tsx +169 -169
- package/src/controls/centered.tsx +22 -22
- package/src/controls/date.tsx +39 -39
- package/src/controls/dropdown.tsx +53 -52
- package/src/controls/error-boundary.tsx +41 -41
- package/src/controls/field-editor.tsx +40 -40
- package/src/controls/file-upload.tsx +67 -67
- package/src/controls/horizontal.tsx +34 -34
- package/src/controls/input.tsx +60 -60
- package/src/controls/kwizoverflow.tsx +103 -103
- package/src/controls/list.tsx +117 -117
- package/src/controls/loading.tsx +10 -10
- package/src/controls/please-wait.tsx +32 -32
- package/src/controls/prompt.tsx +96 -96
- package/src/controls/search.tsx +65 -65
- package/src/controls/section.tsx +51 -51
- package/src/controls/svg.tsx +120 -120
- package/src/controls/toolbar.tsx +48 -48
- package/src/controls/vertical-content.tsx +49 -49
- package/src/controls/vertical.tsx +34 -34
- package/src/helpers/context.ts +39 -39
- package/src/helpers/hooks.tsx +335 -335
- package/src/index.ts +26 -26
- package/src/styles/styles.ts +87 -87
- package/src/styles/theme.ts +90 -90
- package/dist/_modules/build.d.ts +0 -2
- package/dist/_modules/build.js +0 -3
- package/dist/_modules/build.js.map +0 -1
- package/dist/_modules/config.d.ts +0 -1
- package/dist/_modules/config.js +0 -9
- package/dist/_modules/config.js.map +0 -1
- package/dist/_modules/constants.d.ts +0 -2
- package/dist/_modules/constants.js +0 -3
- package/dist/_modules/constants.js.map +0 -1
- package/dist/_modules/exports-index.d.ts +0 -1
- package/dist/_modules/exports-index.js +0 -2
- package/dist/_modules/exports-index.js.map +0 -1
- package/dist/controls/accordion.d.ts +0 -13
- package/dist/controls/accordion.js +0 -27
- package/dist/controls/accordion.js.map +0 -1
- package/dist/controls/button.d.ts +0 -28
- package/dist/controls/button.js +0 -113
- package/dist/controls/button.js.map +0 -1
- package/dist/controls/centered.d.ts +0 -5
- package/dist/controls/centered.js +0 -14
- package/dist/controls/centered.js.map +0 -1
- package/dist/controls/date.d.ts +0 -8
- package/dist/controls/date.js +0 -32
- package/dist/controls/date.js.map +0 -1
- package/dist/controls/dropdown.d.ts +0 -29
- package/dist/controls/dropdown.js +0 -27
- package/dist/controls/dropdown.js.map +0 -1
- package/dist/controls/error-boundary.d.ts +0 -23
- package/dist/controls/error-boundary.js +0 -33
- package/dist/controls/error-boundary.js.map +0 -1
- package/dist/controls/exports-index.d.ts +0 -17
- package/dist/controls/exports-index.js +0 -18
- package/dist/controls/exports-index.js.map +0 -1
- package/dist/controls/field-editor.d.ts +0 -13
- package/dist/controls/field-editor.js +0 -15
- package/dist/controls/field-editor.js.map +0 -1
- package/dist/controls/file-upload.d.ts +0 -18
- package/dist/controls/file-upload.js +0 -41
- package/dist/controls/file-upload.js.map +0 -1
- package/dist/controls/horizontal.d.ts +0 -8
- package/dist/controls/horizontal.js +0 -23
- package/dist/controls/horizontal.js.map +0 -1
- package/dist/controls/input.d.ts +0 -13
- package/dist/controls/input.js +0 -43
- package/dist/controls/input.js.map +0 -1
- package/dist/controls/kwizoverflow.d.ts +0 -14
- package/dist/controls/kwizoverflow.js +0 -45
- package/dist/controls/kwizoverflow.js.map +0 -1
- package/dist/controls/list.d.ts +0 -21
- package/dist/controls/list.js +0 -72
- package/dist/controls/list.js.map +0 -1
- package/dist/controls/loading copy.d.ts +0 -5
- package/dist/controls/loading copy.js +0 -7
- package/dist/controls/loading copy.js.map +0 -1
- package/dist/controls/loading.d.ts +0 -5
- package/dist/controls/loading.js +0 -7
- package/dist/controls/loading.js.map +0 -1
- package/dist/controls/please-wait.d.ts +0 -18
- package/dist/controls/please-wait.js +0 -16
- package/dist/controls/please-wait.js.map +0 -1
- package/dist/controls/prompt.d.ts +0 -32
- package/dist/controls/prompt.js +0 -31
- package/dist/controls/prompt.js.map +0 -1
- package/dist/controls/search.d.ts +0 -13
- package/dist/controls/search.js +0 -47
- package/dist/controls/search.js.map +0 -1
- package/dist/controls/section.d.ts +0 -14
- package/dist/controls/section.js +0 -27
- package/dist/controls/section.js.map +0 -1
- package/dist/controls/svg.d.ts +0 -23
- package/dist/controls/svg.js +0 -45
- package/dist/controls/svg.js.map +0 -1
- package/dist/controls/toolbar.d.ts +0 -12
- package/dist/controls/toolbar.js +0 -23
- package/dist/controls/toolbar.js.map +0 -1
- package/dist/controls/vertical-content.d.ts +0 -6
- package/dist/controls/vertical-content.js +0 -37
- package/dist/controls/vertical-content.js.map +0 -1
- package/dist/controls/vertical.d.ts +0 -8
- package/dist/controls/vertical.js +0 -23
- package/dist/controls/vertical.js.map +0 -1
- package/dist/exports-index.d.ts +0 -3
- package/dist/exports-index.js +0 -4
- package/dist/exports-index.js.map +0 -1
- package/dist/helpers/context.d.ts +0 -26
- package/dist/helpers/context.js +0 -15
- package/dist/helpers/context.js.map +0 -1
- package/dist/helpers/hooks.d.ts +0 -62
- package/dist/helpers/hooks.js +0 -287
- package/dist/helpers/hooks.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/styles/exports-index.d.ts +0 -2
- package/dist/styles/exports-index.js +0 -3
- package/dist/styles/exports-index.js.map +0 -1
- package/dist/styles/styles.d.ts +0 -19
- package/dist/styles/styles.js +0 -79
- package/dist/styles/styles.js.map +0 -1
- package/dist/styles/theme.d.ts +0 -6
- package/dist/styles/theme.js +0 -77
- package/dist/styles/theme.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- 'v*.*.*' # run every time we commit with a new version number
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: 20
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm test
|
|
21
|
+
|
|
22
|
+
publish-npm:
|
|
23
|
+
needs: build
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: 20
|
|
30
|
+
registry-url: https://registry.npmjs.org/
|
|
31
|
+
- run: npm ci
|
|
32
|
+
- run: npm publish
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{secrets.KWIZ_NPM_TOKEN}}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 KWIZ Corp
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 KWIZ Corp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# fluentui
|
|
2
|
-
|
|
3
|
-
For local debugging, if you plan to use `npm link` - there is a known issue with react that will potentially break your application.
|
|
4
|
-
|
|
5
|
-
To fix that, during dev, you'll have to link the react package in this project to load the react from node_modules in your caller application. For example:
|
|
6
|
-
```
|
|
7
|
-
npm link ..\\test-project\\node_modules\\react\\ ..\\..test-project\\node_modules\\@types\\react\\
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
To successfully use these controls you should create a context:
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
const root = React.useRef<HTMLDivElement>(null);
|
|
14
|
-
const kwizFluentContext = useKWIZFluentContextProvider({
|
|
15
|
-
ctx: {
|
|
16
|
-
buttonShape: "rounded"
|
|
17
|
-
},
|
|
18
|
-
root
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
//...
|
|
22
|
-
<KWIZFluentContext.Provider value={kwizFluentContext}>
|
|
23
|
-
<FluentProvider theme={webLightTheme} ref={root}>
|
|
24
|
-
{content}
|
|
25
|
-
</FluentProvider>
|
|
26
|
-
</KWIZFluentContext.Provider>
|
|
1
|
+
# fluentui
|
|
2
|
+
|
|
3
|
+
For local debugging, if you plan to use `npm link` - there is a known issue with react that will potentially break your application.
|
|
4
|
+
|
|
5
|
+
To fix that, during dev, you'll have to link the react package in this project to load the react from node_modules in your caller application. For example:
|
|
6
|
+
```
|
|
7
|
+
npm link ..\\test-project\\node_modules\\react\\ ..\\..test-project\\node_modules\\@types\\react\\
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
To successfully use these controls you should create a context:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const root = React.useRef<HTMLDivElement>(null);
|
|
14
|
+
const kwizFluentContext = useKWIZFluentContextProvider({
|
|
15
|
+
ctx: {
|
|
16
|
+
buttonShape: "rounded"
|
|
17
|
+
},
|
|
18
|
+
root
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//...
|
|
22
|
+
<KWIZFluentContext.Provider value={kwizFluentContext}>
|
|
23
|
+
<FluentProvider theme={webLightTheme} ref={root}>
|
|
24
|
+
{content}
|
|
25
|
+
</FluentProvider>
|
|
26
|
+
</KWIZFluentContext.Provider>
|
|
27
27
|
```
|
package/package.json
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kwiz/fluentui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "KWIZ common controls for FluentUI",
|
|
5
|
-
"module": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"watch": "tsc -watch",
|
|
17
|
-
"build": "npm run test && tsc",
|
|
18
|
-
"build-explain": "tsc --explainFiles",
|
|
19
|
-
"check-dependencies": "madge --circular ./src",
|
|
20
|
-
"create-link": "npm link",
|
|
21
|
-
"test": "node --import tsx --test src",
|
|
22
|
-
"link-local-kwiz": "npm link @kwiz/common",
|
|
23
|
-
"__update-kwiz-packages": "npm install @kwiz/common@latest",
|
|
24
|
-
"npm-v-patch": "npm version patch",
|
|
25
|
-
"npm-v-major": "npm version major",
|
|
26
|
-
"npm-publish": "npm publish --access public",
|
|
27
|
-
"reset-repo": "git fetch origin && git reset --hard origin/main"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/KWizCom/fluentui.git"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"KWIZ",
|
|
35
|
-
"FluentUI"
|
|
36
|
-
],
|
|
37
|
-
"author": "Shai Petel",
|
|
38
|
-
"contributors": [
|
|
39
|
-
"Shai Petel"
|
|
40
|
-
],
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/KWizCom/fluentui/issues",
|
|
44
|
-
"email": "support@kwizcom.com"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/KWizCom/fluentui#readme",
|
|
47
|
-
"private": false,
|
|
48
|
-
"engines": {
|
|
49
|
-
"node": ">=16"
|
|
50
|
-
},
|
|
51
|
-
"packageManager": "npm@9.5.1",
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"fs-extra": "^11.2.0",
|
|
54
|
-
"madge": "^6.1.0",
|
|
55
|
-
"tsx": "^4.7.1",
|
|
56
|
-
"typescript": "^5.3.3"
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"@kwiz/common": "^1.0.58",
|
|
60
|
-
"esbuild": "^0.19.12",
|
|
61
|
-
"get-tsconfig": "^4.7.2",
|
|
62
|
-
"resolve-pkg-maps": "^1.0.0"
|
|
63
|
-
},
|
|
64
|
-
"peerDependencies": {
|
|
65
|
-
"@fluentui/react-components": ">=9.54.17 <10.0.0",
|
|
66
|
-
"@fluentui/react-datepicker-compat": "^0.4.53",
|
|
67
|
-
"@types/react": ">=16.14.0 <19.0.0",
|
|
68
|
-
"@types/react-dom": ">=16.9.0 <19.0.0",
|
|
69
|
-
"react": ">=16.14.0 <19.0.0",
|
|
70
|
-
"react-dom": ">=16.14.0 <19.0.0"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@kwiz/fluentui",
|
|
3
|
+
"version": "1.0.20",
|
|
4
|
+
"description": "KWIZ common controls for FluentUI",
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"watch": "tsc -watch",
|
|
17
|
+
"build": "npm run test && tsc",
|
|
18
|
+
"build-explain": "tsc --explainFiles",
|
|
19
|
+
"check-dependencies": "madge --circular ./src",
|
|
20
|
+
"create-link": "npm link",
|
|
21
|
+
"test": "node --import tsx --test src",
|
|
22
|
+
"link-local-kwiz": "npm link @kwiz/common",
|
|
23
|
+
"__update-kwiz-packages": "npm install @kwiz/common@latest",
|
|
24
|
+
"npm-v-patch": "npm version patch && git push --tags",
|
|
25
|
+
"npm-v-major": "npm version major && git push --tags",
|
|
26
|
+
"npm-publish": "npm publish --access public",
|
|
27
|
+
"reset-repo": "git fetch origin && git reset --hard origin/main"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/KWizCom/fluentui.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"KWIZ",
|
|
35
|
+
"FluentUI"
|
|
36
|
+
],
|
|
37
|
+
"author": "Shai Petel",
|
|
38
|
+
"contributors": [
|
|
39
|
+
"Shai Petel"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/KWizCom/fluentui/issues",
|
|
44
|
+
"email": "support@kwizcom.com"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/KWizCom/fluentui#readme",
|
|
47
|
+
"private": false,
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=16"
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "npm@9.5.1",
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"fs-extra": "^11.2.0",
|
|
54
|
+
"madge": "^6.1.0",
|
|
55
|
+
"tsx": "^4.7.1",
|
|
56
|
+
"typescript": "^5.3.3"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@kwiz/common": "^1.0.58",
|
|
60
|
+
"esbuild": "^0.19.12",
|
|
61
|
+
"get-tsconfig": "^4.7.2",
|
|
62
|
+
"resolve-pkg-maps": "^1.0.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@fluentui/react-components": ">=9.54.17 <10.0.0",
|
|
66
|
+
"@fluentui/react-datepicker-compat": "^0.4.53",
|
|
67
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
|
68
|
+
"@types/react-dom": ">=16.9.0 <19.0.0",
|
|
69
|
+
"react": ">=16.14.0 <19.0.0",
|
|
70
|
+
"react-dom": ">=16.14.0 <19.0.0"
|
|
71
|
+
}
|
|
72
|
+
}
|
package/src/_modules/config.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { config } from "@kwiz/common";
|
|
2
|
-
import { BuildNumber, ReleaseStatus } from "./constants";
|
|
3
|
-
|
|
4
|
-
export const { logger: GetLogger } = config({
|
|
5
|
-
BuildNumber: BuildNumber,
|
|
6
|
-
IsLocalDev: false,
|
|
7
|
-
ReleaseStatus: ReleaseStatus,
|
|
8
|
-
ProjectName: "[fluentui]"
|
|
9
|
-
});
|
|
1
|
+
import { config } from "@kwiz/common";
|
|
2
|
+
import { BuildNumber, ReleaseStatus } from "./constants";
|
|
3
|
+
|
|
4
|
+
export const { logger: GetLogger } = config({
|
|
5
|
+
BuildNumber: BuildNumber,
|
|
6
|
+
IsLocalDev: false,
|
|
7
|
+
ReleaseStatus: ReleaseStatus,
|
|
8
|
+
ProjectName: "[fluentui]"
|
|
9
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export var BuildNumber = 'unset';
|
|
3
|
-
export const ReleaseStatus = "npm";
|
|
1
|
+
|
|
2
|
+
export var BuildNumber = 'unset';
|
|
3
|
+
export const ReleaseStatus = "npm";
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Label, makeStyles } from "@fluentui/react-components";
|
|
2
|
-
import { ChevronRightRegular } from "@fluentui/react-icons";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Horizontal } from "./horizontal";
|
|
5
|
-
import { Vertical } from "./vertical";
|
|
6
|
-
|
|
7
|
-
const useStyles = makeStyles({
|
|
8
|
-
opened: {
|
|
9
|
-
transform: "rotate(90deg)",
|
|
10
|
-
transition: "transform 200ms ease-out"
|
|
11
|
-
},
|
|
12
|
-
header: {
|
|
13
|
-
cursor: "pointer"
|
|
14
|
-
},
|
|
15
|
-
root: {
|
|
16
|
-
maxHeight: "100%"
|
|
17
|
-
},
|
|
18
|
-
body: {
|
|
19
|
-
overflow: "auto"
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
interface iProps {
|
|
24
|
-
/** optional
|
|
25
|
-
opened?: string;
|
|
26
|
-
groups: {
|
|
27
|
-
key: string;
|
|
28
|
-
title: string;
|
|
29
|
-
icon?: JSX.Element;
|
|
30
|
-
content: JSX.Element;
|
|
31
|
-
}[];
|
|
32
|
-
}
|
|
33
|
-
export const AccordionEX: React.FunctionComponent<iProps> = (props) => {
|
|
34
|
-
const classes = useStyles();
|
|
35
|
-
const [opened, setOpened] = React.useState(props.opened || props.groups[0].key);
|
|
36
|
-
return (<Vertical main css={[classes.root]}>
|
|
37
|
-
{props.groups.map(group => <React.Fragment key={group.key}>
|
|
38
|
-
<Horizontal css={[classes.header]} onClick={() => setOpened(group.key)}>
|
|
39
|
-
<ChevronRightRegular className={opened === group.key && classes.opened} />
|
|
40
|
-
<Label>{group.title}</Label>
|
|
41
|
-
</Horizontal>
|
|
42
|
-
{group.key === opened && <Vertical main css={[classes.body]}>
|
|
43
|
-
{group.content}
|
|
44
|
-
</Vertical>}
|
|
45
|
-
</React.Fragment>)}
|
|
46
|
-
</Vertical>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
1
|
+
import { Label, makeStyles } from "@fluentui/react-components";
|
|
2
|
+
import { ChevronRightRegular } from "@fluentui/react-icons";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Horizontal } from "./horizontal";
|
|
5
|
+
import { Vertical } from "./vertical";
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles({
|
|
8
|
+
opened: {
|
|
9
|
+
transform: "rotate(90deg)",
|
|
10
|
+
transition: "transform 200ms ease-out"
|
|
11
|
+
},
|
|
12
|
+
header: {
|
|
13
|
+
cursor: "pointer"
|
|
14
|
+
},
|
|
15
|
+
root: {
|
|
16
|
+
maxHeight: "100%"
|
|
17
|
+
},
|
|
18
|
+
body: {
|
|
19
|
+
overflow: "auto"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
interface iProps {
|
|
24
|
+
/** optional: send the key for the group you want to open by default */
|
|
25
|
+
opened?: string;
|
|
26
|
+
groups: {
|
|
27
|
+
key: string;
|
|
28
|
+
title: string;
|
|
29
|
+
icon?: JSX.Element;
|
|
30
|
+
content: JSX.Element;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
export const AccordionEX: React.FunctionComponent<iProps> = (props) => {
|
|
34
|
+
const classes = useStyles();
|
|
35
|
+
const [opened, setOpened] = React.useState(props.opened || props.groups[0].key);
|
|
36
|
+
return (<Vertical main css={[classes.root]}>
|
|
37
|
+
{props.groups.map(group => <React.Fragment key={group.key}>
|
|
38
|
+
<Horizontal css={[classes.header]} onClick={() => setOpened(group.key)}>
|
|
39
|
+
<ChevronRightRegular className={opened === group.key && classes.opened} />
|
|
40
|
+
<Label>{group.title}</Label>
|
|
41
|
+
</Horizontal>
|
|
42
|
+
{group.key === opened && <Vertical main css={[classes.body]}>
|
|
43
|
+
{group.content}
|
|
44
|
+
</Vertical>}
|
|
45
|
+
</React.Fragment>)}
|
|
46
|
+
</Vertical>
|
|
47
|
+
);
|
|
48
|
+
}
|