@paygreen/pgui 2.0.0 → 2.1.2
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 +110 -0
- package/dist/cjs/index.js +42703 -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 +42 -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/SearchInput/index.d.ts +11 -0
- package/dist/cjs/types/components/Select/index.d.ts +114 -0
- package/dist/cjs/types/components/index.d.ts +6 -0
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/cjs/types/theme/components/badge.d.ts +8 -0
- package/dist/cjs/types/theme/components/button.d.ts +141 -0
- package/dist/cjs/types/theme/components/index.d.ts +4 -0
- package/dist/cjs/types/theme/components/input.d.ts +48 -0
- package/dist/cjs/types/theme/components/tag.d.ts +9 -0
- package/dist/cjs/types/theme/foundations/colors.d.ts +65 -0
- package/dist/cjs/types/theme/foundations/index.d.ts +86 -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/cjs/types/theme/theme.d.ts +1 -0
- package/dist/esm/index.js +42654 -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 +42 -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/SearchInput/index.d.ts +11 -0
- package/dist/esm/types/components/Select/index.d.ts +114 -0
- package/dist/esm/types/components/index.d.ts +6 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/types/theme/components/badge.d.ts +8 -0
- package/dist/esm/types/theme/components/button.d.ts +141 -0
- package/dist/esm/types/theme/components/index.d.ts +4 -0
- package/dist/esm/types/theme/components/input.d.ts +48 -0
- package/dist/esm/types/theme/components/tag.d.ts +9 -0
- package/dist/esm/types/theme/foundations/colors.d.ts +65 -0
- package/dist/esm/types/theme/foundations/index.d.ts +86 -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/esm/types/theme/theme.d.ts +1 -0
- package/dist/index.d.ts +233 -0
- package/package.json +85 -6
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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 @paygreen/pgui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
When this is done, you will need to link Chakra UI and React packages from your target project to PGUI and then link PGUI to your target project as the schema explains here.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
To do that please follow these steps
|
|
18
|
+
|
|
19
|
+
1. in ```/target_app/node_modules/@chakra-ui/react```, this will create 1st symlink to @chakra-ui/react
|
|
20
|
+
```bash
|
|
21
|
+
npm link
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. in ```/target_app/node_modules/react```, this will create 2nd symlink react
|
|
25
|
+
```bash
|
|
26
|
+
npm link
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. in ```/pgui```, this will create 3rd symlink to pgui library
|
|
30
|
+
```bash
|
|
31
|
+
npm link
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
4. in ```/pgui```, this will link your local packages @chakra-ui/react and react
|
|
35
|
+
```bash
|
|
36
|
+
npm run link-local-package
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
5. in ```/pgui```, this will build your project
|
|
40
|
+
```bash
|
|
41
|
+
npm run build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
6. in ```/target_app```, this will link pgui to your local app directory
|
|
45
|
+
```bash
|
|
46
|
+
npm link @paygreen/pgui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
7. it should works well, you just now have to link your theme with the one on PGUI on yiour ChakraProvider in your target project, and then use the components you need! 🥳
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { ChakraProvider } from '@chakra-ui/react';
|
|
53
|
+
import { theme } from '@paygreen/pgui',
|
|
54
|
+
|
|
55
|
+
<ChakraProvider theme={theme}>
|
|
56
|
+
{Your App}
|
|
57
|
+
</ChakraProvider>
|
|
58
|
+
```
|
|
59
|
+
___
|
|
60
|
+
## Develop a new component
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
Don't hesite to refer yourself to ```FormGroup``` component which is a good simple component created with Chakra.
|
|
65
|
+
|
|
66
|
+
When your component is finished, you will need to export it globally on the
|
|
67
|
+
```src/components/index.ts``` and ```src/index.ts``` file.
|
|
68
|
+
|
|
69
|
+
To make your modifications accessible, build the package with rollup.
|
|
70
|
+
```bash
|
|
71
|
+
npm run build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then your modifications will be available on your target project.
|
|
75
|
+
___
|
|
76
|
+
|
|
77
|
+
## Storybook
|
|
78
|
+
|
|
79
|
+
When you add a component and you write documentation, you can see it in storybook.
|
|
80
|
+
To run storybook please use the command
|
|
81
|
+
```bash
|
|
82
|
+
npm run storybook
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
It should open you storybook on your localhost:6006 port.
|
|
86
|
+
___
|
|
87
|
+
|
|
88
|
+
## Troubleshooting
|
|
89
|
+
|
|
90
|
+
### React Invalid Hook Call Warning
|
|
91
|
+
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 or react). Please use the command to normally solve it
|
|
92
|
+
```bash
|
|
93
|
+
npm run link-local-lib
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If it doesn't work, please refer to Getting Started guide to check the npm link process.
|
|
97
|
+
|
|
98
|
+
### Error on storybook build
|
|
99
|
+
|
|
100
|
+
When you try to ```npm run storybook``` you might catch this error
|
|
101
|
+
```
|
|
102
|
+
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 22:4-12
|
|
103
|
+
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
|
|
104
|
+
@ ./node_modules/framer-motion/dist/es/index.mjs
|
|
105
|
+
```
|
|
106
|
+
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
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
"framer-motion": "4.1.17"
|
|
110
|
+
```
|