@paygreen/pgui 2.0.0 → 2.1.0
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/README.md +94 -0
- package/dist/cjs/index.js +3142 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/ActionsButton/index.d.ts +6 -0
- package/dist/cjs/types/components/DataList/index.d.ts +35 -0
- package/dist/cjs/types/components/FormGroup/index.d.ts +12 -0
- package/dist/cjs/types/components/Pagination/index.d.ts +43 -0
- package/dist/cjs/types/components/index.d.ts +4 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/theme/components/Badge.d.ts +7 -0
- package/dist/cjs/types/theme/components/Button.d.ts +140 -0
- package/dist/cjs/types/theme/components/Input.d.ts +47 -0
- package/dist/cjs/types/theme/components/Tag.d.ts +8 -0
- package/dist/cjs/types/theme/foundations/colors.d.ts +65 -0
- package/dist/cjs/types/theme/foundations/shadows.d.ts +10 -0
- package/dist/cjs/types/theme/foundations/typography.d.ts +10 -0
- package/dist/cjs/types/theme/index.d.ts +1 -0
- package/dist/esm/index.js +3118 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/ActionsButton/index.d.ts +6 -0
- package/dist/esm/types/components/DataList/index.d.ts +35 -0
- package/dist/esm/types/components/FormGroup/index.d.ts +12 -0
- package/dist/esm/types/components/Pagination/index.d.ts +43 -0
- package/dist/esm/types/components/index.d.ts +4 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/theme/components/Badge.d.ts +7 -0
- package/dist/esm/types/theme/components/Button.d.ts +140 -0
- package/dist/esm/types/theme/components/Input.d.ts +47 -0
- package/dist/esm/types/theme/components/Tag.d.ts +8 -0
- package/dist/esm/types/theme/foundations/colors.d.ts +65 -0
- package/dist/esm/types/theme/foundations/shadows.d.ts +10 -0
- package/dist/esm/types/theme/foundations/typography.d.ts +10 -0
- package/dist/esm/types/theme/index.d.ts +1 -0
- package/dist/index.d.ts +96 -0
- package/package.json +79 -5
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# PGUI 🌿
|
|
2
|
+
|
|
3
|
+
## Information
|
|
4
|
+
PGUI is the current Paygreen's Design System. The purpose of the package is to provide Components for [Paygreen](https://paygreen.io) applications that works with [Chakra UI](https://chakra-ui.com)
|
|
5
|
+
___
|
|
6
|
+
## Getting Started
|
|
7
|
+
To setup PGUI in a local environment, please install the package in your target project.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -save-dev @paygreen/pgui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
When this is done, you will need to link Chakra UI package library from your target project to PGUI.
|
|
14
|
+
|
|
15
|
+
To do that, please change from your ```package.json``` the script link-local-lib
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"scripts": {
|
|
19
|
+
...
|
|
20
|
+
"link-local-lib": "npm link {path_from_your_app/node_modules/@chakra-ui/react}",
|
|
21
|
+
...
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
And then run
|
|
26
|
+
```bash
|
|
27
|
+
npm run link-local-lib
|
|
28
|
+
```
|
|
29
|
+
Don't forget to do this command every time you install or remove a package or your node_modules.
|
|
30
|
+
|
|
31
|
+
Now that you linked Chakra UI library from your target project to PGUI, you will need to link PGUI to your target project.
|
|
32
|
+
|
|
33
|
+
To do that, please run this command in PGUI project
|
|
34
|
+
```bash
|
|
35
|
+
npm link
|
|
36
|
+
```
|
|
37
|
+
This will create a new symbolic link named "pgui". And you will now be able to add it on your target project by doing that command inside it
|
|
38
|
+
```bash
|
|
39
|
+
npm link pgui
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
It should now link your library and it should works well, you just have to link your theme with the one on PGUI on yiour ChakraProvider in your target project, and then use the components you need! 🥳
|
|
43
|
+
___
|
|
44
|
+
## Develop a new component
|
|
45
|
+
|
|
46
|
+
If you need to develop or update a component you will need to create a new folder with your component's name inside ```src/components```. Inside this folder you'll need to create 2 files, ```index.tsx``` and ```docs.stories.tsx``` if needed.
|
|
47
|
+
|
|
48
|
+
Don't hesite to refer yourself to ```FormGroup``` component which is a good simple component created with Chakra.
|
|
49
|
+
|
|
50
|
+
When your component is finished, you will need to export it globally on the
|
|
51
|
+
```src/components/index.ts``` and ```src/index.ts``` file.
|
|
52
|
+
|
|
53
|
+
To make your modifications accessible, build the package with rollup.
|
|
54
|
+
```bash
|
|
55
|
+
npm run build
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Then your modifications will be available on your target project.
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
## Storybook
|
|
62
|
+
|
|
63
|
+
When you add a component and you write documentation, you can see it in storybook.
|
|
64
|
+
To run storybook please use the command
|
|
65
|
+
```bash
|
|
66
|
+
npm run storybook
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
It should open you storybook on your localhost:6006 port.
|
|
70
|
+
___
|
|
71
|
+
|
|
72
|
+
## Troubleshooting
|
|
73
|
+
|
|
74
|
+
### React Invalid Hook Call Warning
|
|
75
|
+
If you have an error based on [React Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html), this is because you're trying to use the local project without npm link (on chakra-ui/react). Please use the command to normally solve it
|
|
76
|
+
```bash
|
|
77
|
+
npm run link-local-lib
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If it doesn't work, please refer to Getting Started.
|
|
81
|
+
|
|
82
|
+
### Error on storybook build
|
|
83
|
+
|
|
84
|
+
When you try to ```npm run storybook``` you might catch this error
|
|
85
|
+
```
|
|
86
|
+
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 22:4-12
|
|
87
|
+
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
|
|
88
|
+
@ ./node_modules/framer-motion/dist/es/index.mjs
|
|
89
|
+
```
|
|
90
|
+
When this appens, it is normally because of framer-motion package coming with Chakra UI. It is a known issue with latest version of framer version, to solve this issue please use this version instead
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
"framer-motion": "4.1.17"
|
|
94
|
+
```
|