@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.
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ButtonProps, DrawerContentProps, FlexProps, StackProps, TextProps } from '@chakra-ui/react';
3
3
  export type SideNavProps = {
4
- isMobileMenuOpen: boolean;
5
- onMobileMenuClose: () => void;
4
+ isOpen: boolean;
5
+ onClose: () => void;
6
+ onToggle?: () => void;
7
+ breakpoint?: any[] | Partial<Record<string, any>>;
6
8
  } & FlexProps & DrawerContentProps;
7
9
  export type SideNavMenuItemProps = {
8
10
  isActive?: boolean;
@@ -10,7 +12,7 @@ export type SideNavMenuItemProps = {
10
12
  export type SideNavMenuProps = {
11
13
  textProps?: TextProps;
12
14
  } & StackProps;
13
- export declare const SideNav: ({ isMobileMenuOpen, onMobileMenuClose, children, ...props }: SideNavProps) => React.JSX.Element;
15
+ export declare const SideNav: ({ isOpen, onClose, onToggle, breakpoint, children, ...props }: SideNavProps) => React.JSX.Element;
14
16
  export declare const SideNavContainer: (props: StackProps) => React.JSX.Element;
15
17
  export declare const SideNavHeader: ({ children, ...rest }: FlexProps) => React.JSX.Element;
16
18
  export declare const SideNavBody: ({ children, ...rest }: StackProps) => React.JSX.Element;
@@ -1,2 +1,3 @@
1
1
  export { chakraStyle } from './chakraStyle';
2
2
  export { reactDayPicker } from './reactDayPicker';
3
+ export { scrollbarStyles } from './scrollbarStyles';
@@ -1,10 +1,4 @@
1
- export declare const useCustomScrollbar: (options: {
2
- trackColorLight: string;
3
- trackColorDark: string;
4
- thumbColorLight: string;
5
- thumbColorDark: string;
6
- width?: string;
7
- }) => {
1
+ export declare const scrollbarStyles: () => {
8
2
  '&::-webkit-scrollbar': {
9
3
  width: string;
10
4
  borderRadius: string;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useState, useRef, useEffect, useContext, createContext, forwardRef as forwardRef$1, useLayoutEffect, useCallback, useMemo, Fragment, Component } from 'react';
3
- import { forwardRef, IconButton, useColorModeValue, Card as Card$1, createStylesContext, chakra, useMultiStyleConfig, useMenuItem, MenuIcon, MenuCommand, useMenuState, Flex, Icon, Text, useBreakpointValue, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, Box, Accordion, FormControl, FormLabel, FormHelperText, FormErrorMessage, SlideFade, useDisclosure, InputGroup, InputLeftElement, Input as Input$4, InputRightElement, VStack, Divider, HStack, Select as Select$2, useOutsideClick, List, ListItem, useTheme, Drawer, DrawerOverlay, DrawerContent, DrawerCloseButton, Modal, ModalOverlay, ModalContent, ModalCloseButton, NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, useControllableState, useMergeRefs, useStyleConfig, useToken, useColorMode, useBreakpoint, Button as Button$1, Stack, extendTheme } from '@chakra-ui/react';
3
+ import { forwardRef, IconButton, useColorModeValue, Card as Card$1, createStylesContext, chakra, useMultiStyleConfig, useMenuItem, MenuIcon, MenuCommand, useMenuState, Flex, Icon, Text, useBreakpointValue, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, Box, Accordion, FormControl, FormLabel, FormHelperText, FormErrorMessage, SlideFade, useDisclosure, InputGroup, InputLeftElement, Input as Input$4, InputRightElement, VStack, Divider, HStack, Select as Select$2, useOutsideClick, List, ListItem, useTheme, Drawer, DrawerOverlay, DrawerContent, DrawerCloseButton, Modal, ModalOverlay, ModalContent, ModalCloseButton, NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, useControllableState, useMergeRefs, useStyleConfig, useToken, useColorMode, Button as Button$1, Stack, extendTheme } from '@chakra-ui/react';
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -20077,7 +20077,7 @@ var ModalResponsive = function (_a) {
20077
20077
  React__default.createElement(DrawerCloseButton, null),
20078
20078
  children)));
20079
20079
  }
20080
- return (React__default.createElement(Modal, __assign$2({ isOpen: isOpen, onClose: onClose, finalFocusRef: finalFocusRef, isCentered: true }, rest),
20080
+ return (React__default.createElement(Modal, __assign$2({ isOpen: isOpen, onClose: onClose, finalFocusRef: finalFocusRef, isCentered: true, scrollBehavior: "inside" }, rest),
20081
20081
  React__default.createElement(ModalOverlay, null),
20082
20082
  React__default.createElement(ModalContent, null,
20083
20083
  React__default.createElement(ModalCloseButton, null),
@@ -59930,61 +59930,27 @@ var BottomBar = function (props) {
59930
59930
  return (React__default.createElement(LayoutContainer, __assign$2({ minH: "4.125rem", bg: bg, boxShadow: "layout", justifyContent: "space-between", alignItems: "center" }, props)));
59931
59931
  };
59932
59932
 
59933
- var useCustomScrollbar = function (options) {
59934
- var colorMode = useColorMode().colorMode;
59935
- var scrollbarStyles = {
59936
- '&::-webkit-scrollbar': {
59937
- width: options.width || '0.7rem',
59938
- borderRadius: '9999px',
59939
- backgroundColor: colorMode === 'light'
59940
- ? options.trackColorLight
59941
- : options.trackColorDark
59942
- },
59943
- '&::-webkit-scrollbar-thumb': {
59944
- backgroundColor: colorMode === 'light'
59945
- ? options.thumbColorLight
59946
- : options.thumbColorDark,
59947
- borderRadius: '9999px'
59948
- }
59949
- };
59950
- return scrollbarStyles;
59951
- };
59952
-
59953
- var dateFormat = 'dd/MM/yyyy';
59954
-
59955
- var useIsMobile = function (currentBreakpoint) {
59956
- return (currentBreakpoint === 'base' ||
59957
- currentBreakpoint === 'sm' ||
59958
- currentBreakpoint === 'md' ||
59959
- currentBreakpoint === 'lg');
59960
- };
59961
-
59962
59933
  var SideNav = function (_a) {
59963
- var isMobileMenuOpen = _a.isMobileMenuOpen, onMobileMenuClose = _a.onMobileMenuClose, children = _a.children, props = __rest$2(_a, ["isMobileMenuOpen", "onMobileMenuClose", "children"]);
59934
+ 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"]);
59964
59935
  var theme = useTheme();
59965
- var currentBreakpoint = useBreakpoint();
59966
- var isMobile = useIsMobile(currentBreakpoint);
59967
59936
  var colorMode = useColorMode().colorMode;
59968
59937
  var useColorModeValue = function (light, dark) {
59969
59938
  return colorMode === 'light' ? light : dark;
59970
59939
  };
59971
- var customScrollBar = useCustomScrollbar({
59972
- trackColorLight: 'rgba(0, 0, 0, 0.05)',
59973
- trackColorDark: 'rgba(255, 255, 255, 0.05)',
59974
- thumbColorLight: 'rgba(0, 0, 0, 0.10)',
59975
- thumbColorDark: 'rgba(255, 255, 255, 0.10)'
59976
- });
59977
59940
  var bgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
59941
+ var isMobile = useBreakpointValue(breakpoint || {
59942
+ base: true,
59943
+ md: false
59944
+ });
59978
59945
  if (isMobile) {
59979
- return (React__default.createElement(Drawer, { isOpen: isMobileMenuOpen, placement: "left", onClose: onMobileMenuClose, size: "nav" },
59946
+ return (React__default.createElement(Drawer, { isOpen: isOpen, placement: "left", onClose: onClose, size: "nav" },
59980
59947
  React__default.createElement(DrawerOverlay, null),
59981
- React__default.createElement(DrawerContent, __assign$2({ bgGradient: bgGradient, color: "white", pt: 6, px: 6, overflow: "auto", sx: customScrollBar }, props),
59948
+ React__default.createElement(DrawerContent, __assign$2({ bgGradient: bgGradient, color: "white", pt: 6, px: 6, overflow: "auto" }, props),
59982
59949
  React__default.createElement(DrawerCloseButton, null),
59983
59950
  children)));
59984
59951
  }
59985
59952
  var flexBgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
59986
- var color = useColorModeValue('white', 'gray.50');
59987
- return (React__default.createElement(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));
59953
+ return (React__default.createElement(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));
59988
59954
  };
59989
59955
  var SideNavContainer = function (props) { return (React__default.createElement(VStack, __assign$2({ spacing: 6, alignItems: "inherit", minH: "100%" }, props))); };
59990
59956
  var SideNavHeader = function (_a) {
@@ -59993,13 +59959,7 @@ var SideNavHeader = function (_a) {
59993
59959
  };
59994
59960
  var SideNavBody = function (_a) {
59995
59961
  var children = _a.children, rest = __rest$2(_a, ["children"]);
59996
- var customScrollBar = useCustomScrollbar({
59997
- trackColorLight: 'rgba(0, 0, 0, 0.10)',
59998
- trackColorDark: 'rgba(255, 255, 255, 0.10)',
59999
- thumbColorLight: 'rgba(0, 0, 0, 0.15)',
60000
- thumbColorDark: 'rgba(255, 255, 255, 0.15)'
60001
- });
60002
- return (React__default.createElement(VStack, __assign$2({ pt: 4, spacing: 5, pr: 1, alignItems: "inherit", overflowY: "auto", sx: customScrollBar }, rest), children));
59962
+ return (React__default.createElement(VStack, __assign$2({ pt: 4, spacing: 5, pr: 2, alignItems: "inherit", overflowY: "auto" }, rest), children));
60003
59963
  };
60004
59964
  var SideNavFooter = function (_a) {
60005
59965
  var children = _a.children, rest = __rest$2(_a, ["children"]);
@@ -60795,10 +60755,29 @@ var reactDayPicker = {
60795
60755
  }
60796
60756
  };
60797
60757
 
60758
+ var scrollbarStyles = function () {
60759
+ var colorMode = useColorMode().colorMode;
60760
+ var trackColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.10)' : 'rgba(255, 255, 255, 0.10)';
60761
+ var thumbColor = colorMode === 'light' ? 'rgba(0, 0, 0, 0.25)' : 'rgba(255, 255, 255, 0.25)';
60762
+ return {
60763
+ // WebKit browsers
60764
+ '&::-webkit-scrollbar': {
60765
+ width: '0.4rem',
60766
+ borderRadius: '9999px',
60767
+ backgroundColor: trackColor
60768
+ },
60769
+ '&::-webkit-scrollbar-thumb': {
60770
+ backgroundColor: thumbColor,
60771
+ borderRadius: '9999px'
60772
+ }
60773
+ };
60774
+ };
60775
+
60798
60776
  var rawStyle = /*#__PURE__*/Object.freeze({
60799
60777
  __proto__: null,
60800
60778
  chakraStyle: chakraStyle,
60801
- reactDayPicker: reactDayPicker
60779
+ reactDayPicker: reactDayPicker,
60780
+ scrollbarStyles: scrollbarStyles
60802
60781
  });
60803
60782
 
60804
60783
  var externalsStyles = function (props) {
@@ -60822,5 +60801,14 @@ var config = {
60822
60801
  };
60823
60802
  var theme = extendTheme(__assign$2(__assign$2({ styles: styles }, foundations), { components: __assign$2({}, components), config: config }));
60824
60803
 
60804
+ var dateFormat = 'dd/MM/yyyy';
60805
+
60806
+ var useIsMobile = function (currentBreakpoint) {
60807
+ return (currentBreakpoint === 'base' ||
60808
+ currentBreakpoint === 'sm' ||
60809
+ currentBreakpoint === 'md' ||
60810
+ currentBreakpoint === 'lg');
60811
+ };
60812
+
60825
60813
  export { ActionsButton, BottomBar, Card, ConfirmMenuItem, DataList, DataListAccordion, DataListAccordionButton, DataListAccordionIcon, DataListAccordionPanel, DataListCell, DataListContext, DataListFooter, DataListHeader, DataListHeaderContext, DataListRow, FormGroup, InputDayPicker, InputPhone, InputRangePicker, LayoutContainer, MenuItem, ModalResponsive, Pagination, PaginationButtonFirstPage, PaginationButtonLastPage, PaginationButtonNextPage, PaginationButtonPrevPage, PaginationContext, PaginationInfo, SearchInput, Select, SideNav, SideNavBody, SideNavContainer, SideNavFooter, SideNavHeader, SideNavMenu, SideNavMenuItem, TopBar, TopBarBackAction, TopBarFirstElement, TopBarLastElement, dateFormat, formatPhoneIntl, getPaginationInfo, isValidPhone, theme, useIsMobile };
60826
60814
  //# sourceMappingURL=index.js.map