@bitrise/bitkit 13.99.0 → 13.101.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.99.0",
4
+ "version": "13.101.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -218,6 +218,7 @@ const getColors = ({ name, variant }: AvatarProps) => {
218
218
  if (variant === 'brand') {
219
219
  return { backgroundColor: 'sys/neutral/subtle', color: 'text/secondary' };
220
220
  }
221
+ return {};
221
222
  };
222
223
 
223
224
  const AvatarTheme: ComponentStyleConfig = {
@@ -10,6 +10,10 @@ import {
10
10
  DrawerHeader,
11
11
  DrawerOverlay,
12
12
  DrawerProps as ChakraDrawerProps,
13
+ ModalBodyProps,
14
+ ModalFooterProps,
15
+ ModalHeaderProps,
16
+ ModalOverlayProps,
13
17
  } from '@chakra-ui/react';
14
18
  import Icon from '../Icon/Icon';
15
19
 
@@ -18,27 +22,45 @@ export interface DrawerProps
18
22
  children: DrawerContentProps['children'];
19
23
  footer?: ReactNode;
20
24
  maxWidth?: BoxProps['maxWidth'];
21
- title: string;
25
+ title: ReactNode;
22
26
  padding?: BoxProps['padding'];
27
+ margin?: BoxProps['margin'];
23
28
  headerPadding?: BoxProps['padding'];
24
29
  bodyPadding?: BoxProps['padding'];
30
+ overlayProps?: ModalOverlayProps;
31
+ contentProps?: DrawerContentProps;
32
+ headerProps?: ModalHeaderProps;
33
+ bodyProps?: ModalBodyProps;
34
+ footerProps?: ModalFooterProps;
25
35
  }
26
36
 
27
- const Drawer = (props: DrawerProps) => {
28
- const { bodyPadding, children, footer, headerPadding, maxWidth = '20rem', padding, title, ...drawerProps } = props;
37
+ const Drawer = ({ overlayProps, contentProps, headerProps, bodyProps, footerProps, ...props }: DrawerProps) => {
38
+ const {
39
+ bodyPadding,
40
+ children,
41
+ footer,
42
+ headerPadding,
43
+ maxWidth = '20rem',
44
+ padding,
45
+ margin,
46
+ title,
47
+ ...drawerProps
48
+ } = props;
29
49
 
30
50
  return (
31
51
  <ChakraDrawer {...drawerProps}>
32
- <DrawerOverlay />
33
- <DrawerContent maxWidth={maxWidth} padding={padding}>
52
+ <DrawerOverlay maxWidth={maxWidth} padding={padding} {...overlayProps} />
53
+ <DrawerContent margin={margin} {...contentProps}>
34
54
  <DrawerCloseButton size="md">
35
55
  <Icon name="CloseSmall" />
36
56
  </DrawerCloseButton>
37
- <DrawerHeader as="h3" padding={headerPadding}>
57
+ <DrawerHeader as="h3" padding={headerPadding} {...headerProps}>
38
58
  {title}
39
59
  </DrawerHeader>
40
- <DrawerBody padding={bodyPadding}>{children}</DrawerBody>
41
- {footer && <DrawerFooter>{footer}</DrawerFooter>}
60
+ <DrawerBody padding={bodyPadding} {...bodyProps}>
61
+ {children}
62
+ </DrawerBody>
63
+ {footer && <DrawerFooter {...footerProps}>{footer}</DrawerFooter>}
42
64
  </DrawerContent>
43
65
  </ChakraDrawer>
44
66
  );
@@ -1,5 +1,13 @@
1
1
  import { ReactNode, useState } from 'react';
2
- import { DrawerProps as ChakraDrawerProps, useDisclosure } from '@chakra-ui/react';
2
+ import {
3
+ DrawerContentProps,
4
+ DrawerProps as ChakraDrawerProps,
5
+ ModalBodyProps,
6
+ ModalFooterProps,
7
+ ModalHeaderProps,
8
+ ModalOverlayProps,
9
+ useDisclosure,
10
+ } from '@chakra-ui/react';
3
11
  import Drawer from './Drawer';
4
12
 
5
13
  export type UseDrawerProps = {
@@ -8,14 +16,19 @@ export type UseDrawerProps = {
8
16
  {
9
17
  children: ReactNode;
10
18
  footer?: ReactNode;
11
- title: string;
19
+ title: ReactNode;
12
20
  }
13
21
  >;
14
22
  drawerProps?: Pick<ChakraDrawerProps, 'finalFocusRef' | 'initialFocusRef'>;
23
+ overlayProps?: ModalOverlayProps;
24
+ contentProps?: DrawerContentProps;
25
+ headerProps?: ModalHeaderProps;
26
+ bodyProps?: ModalBodyProps;
27
+ footerProps?: ModalFooterProps;
15
28
  };
16
29
 
17
30
  const useDrawer = (props: UseDrawerProps) => {
18
- const { content, drawerProps } = props;
31
+ const { content, drawerProps, ...subComponentProps } = props;
19
32
  const [activeDrawer, setActiveDrawer] = useState<string>('');
20
33
 
21
34
  const { isOpen, onClose, onOpen } = useDisclosure();
@@ -36,7 +49,9 @@ const useDrawer = (props: UseDrawerProps) => {
36
49
  setActiveDrawer(contentKey);
37
50
  };
38
51
 
39
- const drawerComponent = <Drawer {...content[activeDrawer]} {...drawerProps} isOpen={isOpen} onClose={closeDrawer} />;
52
+ const drawerComponent = (
53
+ <Drawer {...content[activeDrawer]} {...drawerProps} {...subComponentProps} isOpen={isOpen} onClose={closeDrawer} />
54
+ );
40
55
 
41
56
  return {
42
57
  activeDrawer,