@bitrise/bitkit 9.34.1 → 9.35.1

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": "9.34.1",
4
+ "version": "9.35.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,21 +1,24 @@
1
- import type { SystemStyleObject } from '@chakra-ui/theme-tools';
1
+ import type { ComponentStyleConfig } from '@chakra-ui/theme';
2
2
 
3
- const DialogTheme: SystemStyleObject = {
4
- baseStyle: {
3
+ const DialogTheme: ComponentStyleConfig = {
4
+ baseStyle: ({ scrollBehavior }) => ({
5
5
  overlay: {
6
6
  backgroundColor: 'rgba(0, 0, 0, .5)',
7
+ zIndex: 'dialogOverlay',
7
8
  },
8
9
  dialogContainer: {
9
10
  display: 'flex',
10
11
  justifyContent: 'center',
11
12
  alignItems: 'flex-start',
12
- overflow: 'auto',
13
+ overflow: scrollBehavior === 'inside' ? 'hidden' : 'auto',
14
+ zIndex: 'dialog',
13
15
  },
14
16
  dialog: {
15
17
  borderRadius: '8',
16
18
  backgroundColor: 'neutral.100',
17
19
  boxShadow: 'large',
18
20
  marginY: '128',
21
+ maxH: scrollBehavior === 'inside' ? 'calc(100% - 16rem)' : undefined,
19
22
  },
20
23
  header: {
21
24
  padding: '24',
@@ -42,7 +45,7 @@ const DialogTheme: SystemStyleObject = {
42
45
  padding: '32',
43
46
  paddingTop: '48',
44
47
  },
45
- },
48
+ }),
46
49
  sizes: {
47
50
  small: {
48
51
  dialog: {
@@ -60,8 +63,11 @@ const DialogTheme: SystemStyleObject = {
60
63
  },
61
64
  },
62
65
  full: {
66
+ overlay: {
67
+ zIndex: 'fullDialogOverlay',
68
+ },
63
69
  dialogContainer: {
64
- zIndex: 1000,
70
+ zIndex: 'fullDialog',
65
71
  },
66
72
  dialog: {
67
73
  position: 'absolute',
@@ -71,6 +77,7 @@ const DialogTheme: SystemStyleObject = {
71
77
  right: '32',
72
78
  top: '32',
73
79
  bottom: '32',
80
+ maxH: 'auto',
74
81
  },
75
82
  },
76
83
  mobile: {
@@ -25,17 +25,24 @@ export const useDialog = (): DialogState => {
25
25
  onOpen,
26
26
  };
27
27
  };
28
- export interface DialogProps extends HTMLChakraProps<'section'> {
28
+ export interface DialogProps extends Omit<HTMLChakraProps<'section'>, 'scrollBehavior'> {
29
29
  dataTestid?: string;
30
30
  size?: 'small' | 'medium' | 'large' | 'full';
31
+ scrollBehavior?: 'inside' | 'outside';
31
32
  state: DialogState;
32
33
  title: string;
33
34
  }
34
35
 
35
- const Dialog = ({ children, dataTestid, state, size, title, ...rest }: DialogProps) => {
36
+ const Dialog = ({ children, dataTestid, scrollBehavior, state, size, title, ...rest }: DialogProps) => {
36
37
  const dialogSize = useBreakpointValue({ mobile: 'mobile', desktop: size });
37
38
  return (
38
- <Modal closeOnOverlayClick={false} isOpen={state.isOpen} onClose={state.onClose} size={dialogSize}>
39
+ <Modal
40
+ closeOnOverlayClick={false}
41
+ isOpen={state.isOpen}
42
+ onClose={state.onClose}
43
+ scrollBehavior={scrollBehavior}
44
+ size={dialogSize}
45
+ >
39
46
  <ModalOverlay />
40
47
  <ModalContent data-testid={dataTestid} {...rest}>
41
48
  <ModalHeader>
@@ -53,6 +60,7 @@ const Dialog = ({ children, dataTestid, state, size, title, ...rest }: DialogPro
53
60
  };
54
61
 
55
62
  Dialog.defaultProps = {
63
+ scrollBehavior: 'outside',
56
64
  size: 'medium',
57
65
  } as DialogProps;
58
66
 
@@ -2,9 +2,6 @@ import type { SystemStyleObject } from '@chakra-ui/theme-tools';
2
2
 
3
3
  const PopoverTheme: SystemStyleObject = {
4
4
  baseStyle: {
5
- popper: {
6
- zIndex: 10,
7
- },
8
5
  content: {
9
6
  backgroundColor: 'neutral.100',
10
7
  borderRadius: 8,
@@ -1,13 +1,22 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, Fragment } from 'react';
2
2
  import {
3
3
  PopoverContentProps as ChakraPopoverContentProps,
4
4
  PopoverContent as ChakraPopoverContent,
5
+ Portal,
5
6
  } from '@chakra-ui/react';
6
7
 
7
8
  export interface PopoverContentProps extends ChakraPopoverContentProps {
8
9
  children: ReactNode;
10
+ withoutPortal?: boolean;
9
11
  }
10
12
 
11
- const PopoverContent = (props: PopoverContentProps) => <ChakraPopoverContent {...props} />;
13
+ const PopoverContent = ({ withoutPortal, ...rest }: PopoverContentProps) => {
14
+ const Wrapper = withoutPortal ? Fragment : Portal;
15
+ return (
16
+ <Wrapper>
17
+ <ChakraPopoverContent {...rest} />
18
+ </Wrapper>
19
+ );
20
+ };
12
21
 
13
22
  export default PopoverContent;
@@ -0,0 +1,12 @@
1
+ const zIndices = {
2
+ hide: -1,
3
+ auto: 'auto',
4
+ base: 0,
5
+ header: 1100,
6
+ fullDialogOverlay: 1199,
7
+ fullDialog: 1200,
8
+ dialogOverlay: 1299,
9
+ dialog: 1300,
10
+ };
11
+
12
+ export default zIndices;
package/src/theme.ts CHANGED
@@ -21,6 +21,7 @@ import radii from './Foundations/Radii/Radii';
21
21
  import shadows from './Foundations/Shadows/Shadows';
22
22
  import sizes from './Foundations/Sizes/Sizes';
23
23
  import typography from './Foundations/Typography/Typography';
24
+ import zIndices from './Foundations/Zindex/Zindex';
24
25
 
25
26
  const theme = {
26
27
  config: {
@@ -33,6 +34,7 @@ const theme = {
33
34
  shadows,
34
35
  sizes,
35
36
  space: sizes,
37
+ zIndices,
36
38
  styles: {
37
39
  global: {
38
40
  body: {