@paygreen/pgui 2.14.7 → 2.14.9

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 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
- 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
+ ```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
  ![Screenshot](pgui-schema.png)
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 yiour ChakraProvider in your target project, and then use the components you need! 🥳
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
- ```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
- > 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
@@ -206,7 +206,7 @@ var ActionsButton = react.forwardRef(function (_a, ref) {
206
206
  ActionsButton.displayName = 'ActionsButton';
207
207
 
208
208
  var Card = function (props) {
209
- var bgColor = react.useColorModeValue('white', 'gray.900');
209
+ var bgColor = react.useColorModeValue('white', 'whiteAlpha.50');
210
210
  var borderColor = react.useColorModeValue('gray.100', 'gray.700');
211
211
  return (React__default["default"].createElement(react.Card, __assign$2({ p: 6, backgroundColor: bgColor, borderWidth: "1px", borderStyle: "solid", borderColor: borderColor, h: "fit-content", w: "full" }, props)));
212
212
  };
@@ -381,7 +381,7 @@ var DataListFooter = function (_a) {
381
381
  var rest = __rest$2(_a, []);
382
382
  return (React__default["default"].createElement(react.Box, { mt: "auto" },
383
383
  React__default["default"].createElement(react.Flex, __assign$2({ fontSize: "sm", mt: "-1px", borderTop: "1px solid", p: "2", align: "center", bg: "white", borderTopColor: "gray.100", color: "gray.600", _dark: {
384
- bg: 'blackAlpha.50',
384
+ bg: 'whiteAlpha.50',
385
385
  color: 'gray.300',
386
386
  borderTopColor: 'gray.900'
387
387
  } }, rest))));
@@ -394,7 +394,7 @@ var DataList = function (_a) {
394
394
  columns: columns,
395
395
  isHover: isHover
396
396
  } },
397
- React__default["default"].createElement(react.Accordion, __assign$2({ border: "2px solid", borderBottom: "none", borderColor: react.useColorModeValue('gray.100', 'gray.700'), borderRadius: "md", display: "flex", flexDirection: "column", position: "relative", boxShadow: "md", overflow: "hidden", allowMultiple: !allowToggle ? allowMultiple : false, allowToggle: allowToggle, bg: react.useColorModeValue('white', 'gray.900') }, rest))));
397
+ React__default["default"].createElement(react.Accordion, __assign$2({ border: "2px solid", borderBottom: "none", borderColor: react.useColorModeValue('gray.100', 'gray.700'), borderRadius: "md", display: "flex", flexDirection: "column", position: "relative", boxShadow: "md", overflow: "hidden", allowMultiple: !allowToggle ? allowMultiple : false, allowToggle: allowToggle, bg: react.useColorModeValue('white', 'whiteAlpha.50') }, rest))));
398
398
  };
399
399
 
400
400
  var FormGroup = function (_a) {
@@ -59956,61 +59956,82 @@ 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) {
59959
+ var chakraStyle = function () { return ({
59960
+ 'div[data-popper-placement]': {
59961
+ minWidth: 'auto !important'
59962
+ }
59963
+ }); };
59964
+
59965
+ var reactDayPicker = {
59966
+ '.rdp': {
59967
+ '--rdp-cell-size': '30px',
59968
+ '--rdp-caption-font-size': 'var(--chakra-sizes-3-5)',
59969
+ '--rdp-accent-color': 'var(--chakra-colors-blue-100)',
59970
+ '--rdp-background-color': 'var(--chakra-colors-gray-200)',
59971
+ '--rdp-outline': '0px',
59972
+ '--rdp-outline-selected': '0px',
59973
+ '--rdp-selected-color': 'var(--chakra-colors-gray-800)',
59974
+ '[data-theme="dark"] &': {
59975
+ '--rdp-accent-color': 'var(--chakra-colors-blue-800)',
59976
+ '--rdp-background-color': 'var(--chakra-colors-gray-600)',
59977
+ '--rdp-selected-color': 'var(--chakra-colors-gray-50)'
59978
+ }
59979
+ },
59980
+ '.rdp-dropdown': {
59981
+ appearance: 'none',
59982
+ backgroundColor: 'var(--chakra-colors-gray-50)',
59983
+ '[data-theme="dark"] &': {
59984
+ backgroundColor: 'var(--chakra-colors-gray-800)'
59985
+ }
59986
+ }
59987
+ };
59988
+
59989
+ var scrollbarStyles = function () {
59960
59990
  var colorMode = react.useColorMode().colorMode;
59961
- var scrollbarStyles = {
59991
+ var trackColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.10)' : 'rgba(255, 255, 255, 0.10)';
59992
+ var thumbColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.25)' : 'rgba(255, 255, 255, 0.25)';
59993
+ return {
59994
+ // WebKit browsers
59962
59995
  '&::-webkit-scrollbar': {
59963
- width: options.width || '0.7rem',
59996
+ width: '0.4rem',
59964
59997
  borderRadius: '9999px',
59965
- backgroundColor: colorMode === 'light'
59966
- ? options.trackColorLight
59967
- : options.trackColorDark
59998
+ backgroundColor: trackColor
59968
59999
  },
59969
60000
  '&::-webkit-scrollbar-thumb': {
59970
- backgroundColor: colorMode === 'light'
59971
- ? options.thumbColorLight
59972
- : options.thumbColorDark,
60001
+ backgroundColor: thumbColor,
59973
60002
  borderRadius: '9999px'
59974
60003
  }
59975
60004
  };
59976
- return scrollbarStyles;
59977
60005
  };
59978
60006
 
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
- };
60007
+ var rawStyle = /*#__PURE__*/Object.freeze({
60008
+ __proto__: null,
60009
+ chakraStyle: chakraStyle,
60010
+ reactDayPicker: reactDayPicker,
60011
+ scrollbarStyles: scrollbarStyles
60012
+ });
59987
60013
 
59988
60014
  var SideNav = function (_a) {
59989
- var isMobileMenuOpen = _a.isMobileMenuOpen, onMobileMenuClose = _a.onMobileMenuClose, children = _a.children, props = __rest$2(_a, ["isMobileMenuOpen", "onMobileMenuClose", "children"]);
60015
+ 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
60016
  var theme = react.useTheme();
59991
- var currentBreakpoint = react.useBreakpoint();
59992
- var isMobile = useIsMobile(currentBreakpoint);
59993
60017
  var colorMode = react.useColorMode().colorMode;
59994
60018
  var useColorModeValue = function (light, dark) {
59995
60019
  return colorMode === 'light' ? light : dark;
59996
60020
  };
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
60021
  var bgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
60022
+ var isMobile = react.useBreakpointValue(breakpoint || {
60023
+ base: true,
60024
+ md: false
60025
+ });
60004
60026
  if (isMobile) {
60005
- return (React__default["default"].createElement(react.Drawer, { isOpen: isMobileMenuOpen, placement: "left", onClose: onMobileMenuClose, size: "nav" },
60027
+ return (React__default["default"].createElement(react.Drawer, { isOpen: isOpen, placement: "left", onClose: onClose, size: "nav" },
60006
60028
  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", sx: customScrollBar }, props),
60029
+ React__default["default"].createElement(react.DrawerContent, __assign$2({ bgGradient: bgGradient, color: "white", pt: 6, px: 6, overflow: "auto", sx: scrollbarStyles() }, props),
60008
60030
  React__default["default"].createElement(react.DrawerCloseButton, null),
60009
60031
  children)));
60010
60032
  }
60011
60033
  var flexBgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
60012
- var color = useColorModeValue('white', 'gray.50');
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));
60034
+ 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", sx: scrollbarStyles(), transform: !isOpen ? 'translateX(-18rem)' : 'none', transition: '0.4s ease-in-out' }, props), children));
60014
60035
  };
60015
60036
  var SideNavContainer = function (props) { return (React__default["default"].createElement(react.VStack, __assign$2({ spacing: 6, alignItems: "inherit", minH: "100%" }, props))); };
60016
60037
  var SideNavHeader = function (_a) {
@@ -60019,13 +60040,7 @@ var SideNavHeader = function (_a) {
60019
60040
  };
60020
60041
  var SideNavBody = function (_a) {
60021
60042
  var children = _a.children, rest = __rest$2(_a, ["children"]);
60022
- var customScrollBar = useCustomScrollbar({
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));
60043
+ return (React__default["default"].createElement(react.VStack, __assign$2({ pt: 4, spacing: 5, pr: 2, alignItems: "inherit", overflowY: "auto", sx: scrollbarStyles() }, rest), children));
60029
60044
  };
60030
60045
  var SideNavFooter = function (_a) {
60031
60046
  var children = _a.children, rest = __rest$2(_a, ["children"]);
@@ -60791,42 +60806,6 @@ var typography = {
60791
60806
 
60792
60807
  var foundations = __assign$2(__assign$2({ colors: colors }, typography), { sizes: sizes, shadows: shadows, radii: radii });
60793
60808
 
60794
- var chakraStyle = function () { return ({
60795
- 'div[data-popper-placement]': {
60796
- minWidth: 'auto !important'
60797
- }
60798
- }); };
60799
-
60800
- var reactDayPicker = {
60801
- '.rdp': {
60802
- '--rdp-cell-size': '30px',
60803
- '--rdp-caption-font-size': 'var(--chakra-sizes-3-5)',
60804
- '--rdp-accent-color': 'var(--chakra-colors-blue-100)',
60805
- '--rdp-background-color': 'var(--chakra-colors-gray-200)',
60806
- '--rdp-outline': '0px',
60807
- '--rdp-outline-selected': '0px',
60808
- '--rdp-selected-color': 'var(--chakra-colors-gray-800)',
60809
- '[data-theme="dark"] &': {
60810
- '--rdp-accent-color': 'var(--chakra-colors-blue-800)',
60811
- '--rdp-background-color': 'var(--chakra-colors-gray-600)',
60812
- '--rdp-selected-color': 'var(--chakra-colors-gray-50)'
60813
- }
60814
- },
60815
- '.rdp-dropdown': {
60816
- appearance: 'none',
60817
- backgroundColor: 'var(--chakra-colors-gray-50)',
60818
- '[data-theme="dark"] &': {
60819
- backgroundColor: 'var(--chakra-colors-gray-800)'
60820
- }
60821
- }
60822
- };
60823
-
60824
- var rawStyle = /*#__PURE__*/Object.freeze({
60825
- __proto__: null,
60826
- chakraStyle: chakraStyle,
60827
- reactDayPicker: reactDayPicker
60828
- });
60829
-
60830
60809
  var externalsStyles = function (props) {
60831
60810
  return Object.values(rawStyle).reduce(function (acc, cur) { return (__assign$2(__assign$2({}, acc), (typeof cur === 'function' ? cur(props) : cur))); }, {});
60832
60811
  };
@@ -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;