@paygreen/pgui 2.14.8 → 2.14.10
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 +42 -50
- package/dist/cjs/index.js +39 -51
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/layout/SideNav/index.d.ts +5 -3
- package/dist/cjs/types/theme/rawStyle/index.d.ts +1 -0
- package/dist/cjs/types/{hooks/useCustomScrollbar.d.ts → theme/rawStyle/scrollbarStyles.d.ts} +1 -7
- package/dist/esm/index.js +40 -52
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/layout/SideNav/index.d.ts +5 -3
- package/dist/esm/types/theme/rawStyle/index.d.ts +1 -0
- package/dist/esm/types/{hooks/useCustomScrollbar.d.ts → theme/rawStyle/scrollbarStyles.d.ts} +1 -7
- package/dist/index.d.ts +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Information
|
|
4
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
5
|
___
|
|
6
|
+
|
|
6
7
|
## Getting Started
|
|
7
8
|
To setup PGUI in a local environment, please install the package in your target project.
|
|
8
9
|
|
|
@@ -10,7 +11,45 @@ To setup PGUI in a local environment, please install the package in your target
|
|
|
10
11
|
npm i @paygreen/pgui
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
```javascript
|
|
15
|
+
import { ChakraProvider } from '@chakra-ui/react';
|
|
16
|
+
import { theme } from '@paygreen/pgui',
|
|
17
|
+
|
|
18
|
+
<ChakraProvider theme={theme}>
|
|
19
|
+
{Your App}
|
|
20
|
+
</ChakraProvider>
|
|
21
|
+
```
|
|
22
|
+
___
|
|
23
|
+
|
|
24
|
+
## Develop a new component
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
Don't hesite to refer yourself to ```FormGroup``` component which is a good simple component created with Chakra.
|
|
29
|
+
|
|
30
|
+
When your component is finished, you will need to export it globally on the
|
|
31
|
+
```src/components/index.ts``` and ```src/index.ts``` file.
|
|
32
|
+
|
|
33
|
+
To make your modifications accessible, build the package with rollup.
|
|
34
|
+
```bash
|
|
35
|
+
npm run build
|
|
36
|
+
```
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
## Storybook
|
|
40
|
+
|
|
41
|
+
When you add a component and you write documentation, you can see it in storybook.
|
|
42
|
+
To run storybook please use the command
|
|
43
|
+
```bash
|
|
44
|
+
npm run storybook
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
It should open you storybook on your localhost:6006 port.
|
|
48
|
+
___
|
|
49
|
+
|
|
50
|
+
## Link PGUI development into your current React project
|
|
51
|
+
|
|
52
|
+
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
53
|
|
|
15
54
|

|
|
16
55
|
|
|
@@ -46,50 +85,17 @@ npm run build
|
|
|
46
85
|
npm link @paygreen/pgui
|
|
47
86
|
```
|
|
48
87
|
|
|
49
|
-
7. it should works well, you just now have to link your theme with the one on PGUI on
|
|
88
|
+
7. it should works well, you just now have to link your theme with the one on PGUI on your ChakraProvider in your target project, and then use the components you need! 🥳
|
|
50
89
|
|
|
51
|
-
|
|
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
|
-
> Voir tous les links
|
|
90
|
+
> See all links
|
|
61
91
|
```
|
|
62
92
|
npm ls --link --global
|
|
63
93
|
```
|
|
64
|
-
___
|
|
65
|
-
## Develop a new component
|
|
66
|
-
|
|
67
|
-
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.
|
|
68
|
-
|
|
69
|
-
Don't hesite to refer yourself to ```FormGroup``` component which is a good simple component created with Chakra.
|
|
70
|
-
|
|
71
|
-
When your component is finished, you will need to export it globally on the
|
|
72
|
-
```src/components/index.ts``` and ```src/index.ts``` file.
|
|
73
|
-
|
|
74
|
-
To make your modifications accessible, build the package with rollup.
|
|
75
|
-
```bash
|
|
76
|
-
npm run build
|
|
77
|
-
```
|
|
78
94
|
|
|
79
95
|
Instead of use npm link, to real-time testing your component, run ```npx relative-deps``` in the APP project ad restart it.
|
|
80
96
|
|
|
81
97
|
Then your modifications will be available on your target project.
|
|
82
|
-
___
|
|
83
|
-
|
|
84
|
-
## Storybook
|
|
85
|
-
|
|
86
|
-
When you add a component and you write documentation, you can see it in storybook.
|
|
87
|
-
To run storybook please use the command
|
|
88
|
-
```bash
|
|
89
|
-
npm run storybook
|
|
90
|
-
```
|
|
91
98
|
|
|
92
|
-
It should open you storybook on your localhost:6006 port.
|
|
93
99
|
___
|
|
94
100
|
|
|
95
101
|
## Troubleshooting
|
|
@@ -101,17 +107,3 @@ npm run link-local-lib
|
|
|
101
107
|
```
|
|
102
108
|
|
|
103
109
|
If it doesn't work, please refer to Getting Started guide to check the npm link process.
|
|
104
|
-
|
|
105
|
-
### Error on storybook build
|
|
106
|
-
|
|
107
|
-
When you try to ```npm run storybook``` you might catch this error
|
|
108
|
-
```
|
|
109
|
-
ERROR in ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 22:4-12
|
|
110
|
-
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
|
|
111
|
-
@ ./node_modules/framer-motion/dist/es/index.mjs
|
|
112
|
-
```
|
|
113
|
-
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
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
"framer-motion": "4.1.17"
|
|
117
|
-
```
|
package/dist/cjs/index.js
CHANGED
|
@@ -20103,7 +20103,7 @@ var ModalResponsive = function (_a) {
|
|
|
20103
20103
|
React__default["default"].createElement(react.DrawerCloseButton, null),
|
|
20104
20104
|
children)));
|
|
20105
20105
|
}
|
|
20106
|
-
return (React__default["default"].createElement(react.Modal, __assign$2({ isOpen: isOpen, onClose: onClose, finalFocusRef: finalFocusRef, isCentered: true }, rest),
|
|
20106
|
+
return (React__default["default"].createElement(react.Modal, __assign$2({ isOpen: isOpen, onClose: onClose, finalFocusRef: finalFocusRef, isCentered: true, scrollBehavior: "inside" }, rest),
|
|
20107
20107
|
React__default["default"].createElement(react.ModalOverlay, null),
|
|
20108
20108
|
React__default["default"].createElement(react.ModalContent, null,
|
|
20109
20109
|
React__default["default"].createElement(react.ModalCloseButton, null),
|
|
@@ -59956,61 +59956,27 @@ var BottomBar = function (props) {
|
|
|
59956
59956
|
return (React__default["default"].createElement(LayoutContainer, __assign$2({ minH: "4.125rem", bg: bg, boxShadow: "layout", justifyContent: "space-between", alignItems: "center" }, props)));
|
|
59957
59957
|
};
|
|
59958
59958
|
|
|
59959
|
-
var useCustomScrollbar = function (options) {
|
|
59960
|
-
var colorMode = react.useColorMode().colorMode;
|
|
59961
|
-
var scrollbarStyles = {
|
|
59962
|
-
'&::-webkit-scrollbar': {
|
|
59963
|
-
width: options.width || '0.7rem',
|
|
59964
|
-
borderRadius: '9999px',
|
|
59965
|
-
backgroundColor: colorMode === 'light'
|
|
59966
|
-
? options.trackColorLight
|
|
59967
|
-
: options.trackColorDark
|
|
59968
|
-
},
|
|
59969
|
-
'&::-webkit-scrollbar-thumb': {
|
|
59970
|
-
backgroundColor: colorMode === 'light'
|
|
59971
|
-
? options.thumbColorLight
|
|
59972
|
-
: options.thumbColorDark,
|
|
59973
|
-
borderRadius: '9999px'
|
|
59974
|
-
}
|
|
59975
|
-
};
|
|
59976
|
-
return scrollbarStyles;
|
|
59977
|
-
};
|
|
59978
|
-
|
|
59979
|
-
var dateFormat = 'dd/MM/yyyy';
|
|
59980
|
-
|
|
59981
|
-
var useIsMobile = function (currentBreakpoint) {
|
|
59982
|
-
return (currentBreakpoint === 'base' ||
|
|
59983
|
-
currentBreakpoint === 'sm' ||
|
|
59984
|
-
currentBreakpoint === 'md' ||
|
|
59985
|
-
currentBreakpoint === 'lg');
|
|
59986
|
-
};
|
|
59987
|
-
|
|
59988
59959
|
var SideNav = function (_a) {
|
|
59989
|
-
var
|
|
59960
|
+
var isOpen = _a.isOpen, onClose = _a.onClose; _a.onToggle; var breakpoint = _a.breakpoint, children = _a.children, props = __rest$2(_a, ["isOpen", "onClose", "onToggle", "breakpoint", "children"]);
|
|
59990
59961
|
var theme = react.useTheme();
|
|
59991
|
-
var currentBreakpoint = react.useBreakpoint();
|
|
59992
|
-
var isMobile = useIsMobile(currentBreakpoint);
|
|
59993
59962
|
var colorMode = react.useColorMode().colorMode;
|
|
59994
59963
|
var useColorModeValue = function (light, dark) {
|
|
59995
59964
|
return colorMode === 'light' ? light : dark;
|
|
59996
59965
|
};
|
|
59997
|
-
var customScrollBar = useCustomScrollbar({
|
|
59998
|
-
trackColorLight: 'rgba(0, 0, 0, 0.05)',
|
|
59999
|
-
trackColorDark: 'rgba(255, 255, 255, 0.05)',
|
|
60000
|
-
thumbColorLight: 'rgba(0, 0, 0, 0.10)',
|
|
60001
|
-
thumbColorDark: 'rgba(255, 255, 255, 0.10)'
|
|
60002
|
-
});
|
|
60003
59966
|
var bgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
|
|
59967
|
+
var isMobile = react.useBreakpointValue(breakpoint || {
|
|
59968
|
+
base: true,
|
|
59969
|
+
md: false
|
|
59970
|
+
});
|
|
60004
59971
|
if (isMobile) {
|
|
60005
|
-
return (React__default["default"].createElement(react.Drawer, { isOpen:
|
|
59972
|
+
return (React__default["default"].createElement(react.Drawer, { isOpen: isOpen, placement: "left", onClose: onClose, size: "nav" },
|
|
60006
59973
|
React__default["default"].createElement(react.DrawerOverlay, null),
|
|
60007
|
-
React__default["default"].createElement(react.DrawerContent, __assign$2({ bgGradient: bgGradient, color: "white", pt: 6, px: 6, overflow: "auto"
|
|
59974
|
+
React__default["default"].createElement(react.DrawerContent, __assign$2({ bgGradient: bgGradient, color: "white", pt: 6, px: 6, overflow: "auto" }, props),
|
|
60008
59975
|
React__default["default"].createElement(react.DrawerCloseButton, null),
|
|
60009
59976
|
children)));
|
|
60010
59977
|
}
|
|
60011
59978
|
var flexBgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
|
|
60012
|
-
|
|
60013
|
-
return (React__default["default"].createElement(react.Flex, __assign$2({ w: "18rem", h: "100vh", flexDir: "column", bgGradient: flexBgGradient, color: color, pt: 6, px: 6, position: "fixed", top: "0", left: "0", sx: customScrollBar }, props), children));
|
|
59979
|
+
return (React__default["default"].createElement(react.Flex, __assign$2({ w: "18rem", h: "100vh", flexDir: "column", bgGradient: flexBgGradient, color: useColorModeValue('white', 'gray.50'), pt: 6, px: 6, position: "fixed", top: "0", left: "0", transform: !isOpen ? 'translateX(-18rem)' : 'none', transition: '0.4s ease-in-out' }, props), children));
|
|
60014
59980
|
};
|
|
60015
59981
|
var SideNavContainer = function (props) { return (React__default["default"].createElement(react.VStack, __assign$2({ spacing: 6, alignItems: "inherit", minH: "100%" }, props))); };
|
|
60016
59982
|
var SideNavHeader = function (_a) {
|
|
@@ -60019,13 +59985,7 @@ var SideNavHeader = function (_a) {
|
|
|
60019
59985
|
};
|
|
60020
59986
|
var SideNavBody = function (_a) {
|
|
60021
59987
|
var children = _a.children, rest = __rest$2(_a, ["children"]);
|
|
60022
|
-
|
|
60023
|
-
trackColorLight: 'rgba(0, 0, 0, 0.10)',
|
|
60024
|
-
trackColorDark: 'rgba(255, 255, 255, 0.10)',
|
|
60025
|
-
thumbColorLight: 'rgba(0, 0, 0, 0.15)',
|
|
60026
|
-
thumbColorDark: 'rgba(255, 255, 255, 0.15)'
|
|
60027
|
-
});
|
|
60028
|
-
return (React__default["default"].createElement(react.VStack, __assign$2({ pt: 4, spacing: 5, pr: 1, alignItems: "inherit", overflowY: "auto", sx: customScrollBar }, rest), children));
|
|
59988
|
+
return (React__default["default"].createElement(react.VStack, __assign$2({ pt: 4, spacing: 5, pr: 2, alignItems: "inherit", overflowY: "auto" }, rest), children));
|
|
60029
59989
|
};
|
|
60030
59990
|
var SideNavFooter = function (_a) {
|
|
60031
59991
|
var children = _a.children, rest = __rest$2(_a, ["children"]);
|
|
@@ -60821,10 +60781,29 @@ var reactDayPicker = {
|
|
|
60821
60781
|
}
|
|
60822
60782
|
};
|
|
60823
60783
|
|
|
60784
|
+
var scrollbarStyles = function () {
|
|
60785
|
+
var colorMode = react.useColorMode().colorMode;
|
|
60786
|
+
var trackColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.10)' : 'rgba(255, 255, 255, 0.10)';
|
|
60787
|
+
var thumbColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.25)' : 'rgba(255, 255, 255, 0.25)';
|
|
60788
|
+
return {
|
|
60789
|
+
// WebKit browsers
|
|
60790
|
+
'&::-webkit-scrollbar': {
|
|
60791
|
+
width: '0.4rem',
|
|
60792
|
+
borderRadius: '9999px',
|
|
60793
|
+
backgroundColor: trackColor
|
|
60794
|
+
},
|
|
60795
|
+
'&::-webkit-scrollbar-thumb': {
|
|
60796
|
+
backgroundColor: thumbColor,
|
|
60797
|
+
borderRadius: '9999px'
|
|
60798
|
+
}
|
|
60799
|
+
};
|
|
60800
|
+
};
|
|
60801
|
+
|
|
60824
60802
|
var rawStyle = /*#__PURE__*/Object.freeze({
|
|
60825
60803
|
__proto__: null,
|
|
60826
60804
|
chakraStyle: chakraStyle,
|
|
60827
|
-
reactDayPicker: reactDayPicker
|
|
60805
|
+
reactDayPicker: reactDayPicker,
|
|
60806
|
+
scrollbarStyles: scrollbarStyles
|
|
60828
60807
|
});
|
|
60829
60808
|
|
|
60830
60809
|
var externalsStyles = function (props) {
|
|
@@ -60848,6 +60827,15 @@ var config = {
|
|
|
60848
60827
|
};
|
|
60849
60828
|
var theme = react.extendTheme(__assign$2(__assign$2({ styles: styles }, foundations), { components: __assign$2({}, components), config: config }));
|
|
60850
60829
|
|
|
60830
|
+
var dateFormat = 'dd/MM/yyyy';
|
|
60831
|
+
|
|
60832
|
+
var useIsMobile = function (currentBreakpoint) {
|
|
60833
|
+
return (currentBreakpoint === 'base' ||
|
|
60834
|
+
currentBreakpoint === 'sm' ||
|
|
60835
|
+
currentBreakpoint === 'md' ||
|
|
60836
|
+
currentBreakpoint === 'lg');
|
|
60837
|
+
};
|
|
60838
|
+
|
|
60851
60839
|
exports.ActionsButton = ActionsButton;
|
|
60852
60840
|
exports.BottomBar = BottomBar;
|
|
60853
60841
|
exports.Card = Card;
|