@bitrise/bitkit 13.305.0 → 13.307.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.305.0",
4
+ "version": "13.307.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -6,6 +6,7 @@ const DialogTheme: ComponentStyleConfig = {
6
6
  flex: 1,
7
7
  overflow: scrollBehavior === 'inside' ? 'auto' : undefined,
8
8
  paddingX: '32',
9
+ marginBottom: '16',
9
10
  },
10
11
  closeButton: {
11
12
  color: 'purple.10',
@@ -33,12 +34,12 @@ const DialogTheme: ComponentStyleConfig = {
33
34
  gap: '16',
34
35
  justifyContent: 'end',
35
36
  padding: '32',
36
- paddingTop: '48',
37
37
  },
38
38
  header: {
39
39
  color: 'purple.10',
40
40
  padding: '24',
41
41
  paddingLeft: '30',
42
+ marginRight: '48',
42
43
  },
43
44
  overlay: {
44
45
  backgroundColor: 'rgba(0, 0, 0, .5)',
@@ -91,6 +92,27 @@ const DialogTheme: ComponentStyleConfig = {
91
92
  },
92
93
  },
93
94
  },
95
+ variants: {
96
+ default: {
97
+ header: {
98
+ textStyle: 'comp/dialog/title',
99
+ },
100
+ },
101
+ overflow: {
102
+ header: {
103
+ textStyle: 'heading/h4',
104
+ padding: '16',
105
+ paddingLeft: '16',
106
+ marginRight: '16',
107
+ },
108
+ body: {
109
+ paddingX: '16',
110
+ },
111
+ footer: {
112
+ padding: '16',
113
+ },
114
+ },
115
+ },
94
116
  };
95
117
 
96
118
  export default DialogTheme;
@@ -36,11 +36,32 @@ const Dialog: ComponentWithAs<'section', DialogProps> = ({
36
36
  const headerId = useId();
37
37
 
38
38
  const closeBtn = (
39
- <ModalCloseButton isDisabled={!isClosable} size="large">
39
+ <ModalCloseButton isDisabled={!isClosable} size={variant === 'overflow' ? 'small' : `large`}>
40
40
  <Icon name="Cross" />
41
41
  </ModalCloseButton>
42
42
  );
43
43
 
44
+ const modalHeader = () => {
45
+ if (variant === 'empty') return null;
46
+
47
+ return (
48
+ <>
49
+ <ModalHeader>
50
+ <Text as="h1" id={headerId}>
51
+ {title}
52
+ </Text>
53
+ </ModalHeader>
54
+ {closeNotice ? (
55
+ <Tooltip label={closeNotice} placement="top">
56
+ {closeBtn}
57
+ </Tooltip>
58
+ ) : (
59
+ closeBtn
60
+ )}
61
+ </>
62
+ );
63
+ };
64
+
44
65
  return (
45
66
  <DialogContextProvider value={{ scrollBehavior }}>
46
67
  <Modal
@@ -54,26 +75,12 @@ const Dialog: ComponentWithAs<'section', DialogProps> = ({
54
75
  scrollBehavior={scrollBehavior}
55
76
  size={dialogSize}
56
77
  trapFocus={trapFocus}
78
+ variant={variant}
57
79
  >
58
80
  <ModalOverlay />
59
81
 
60
82
  <ModalContent aria-labelledby={variant !== 'empty' ? headerId : undefined} {...rest}>
61
- {variant !== 'empty' && (
62
- <>
63
- <ModalHeader marginRight="48">
64
- <Text as="h1" id={headerId} textStyle="comp/dialog/title">
65
- {title}
66
- </Text>
67
- </ModalHeader>
68
- {closeNotice ? (
69
- <Tooltip label={closeNotice} placement="top">
70
- {closeBtn}
71
- </Tooltip>
72
- ) : (
73
- closeBtn
74
- )}
75
- </>
76
- )}
83
+ {modalHeader()}
77
84
  {children}
78
85
  </ModalContent>
79
86
  </Modal>
@@ -69,24 +69,33 @@ const ScrollableDialogBody = (props: DialogBodyProps) => {
69
69
  <Box display="flex" flexDir="column" minH={0} position="relative">
70
70
  <ModalBody ref={contentRef} {...props} />
71
71
  {isScrollButtonVisible && (
72
- <ScrollButton
73
- alignSelf="center"
74
- bottom={8}
75
- flexShrink={0}
76
- onClick={(e) => {
77
- if (!contentRef.current) {
78
- return;
79
- }
80
-
81
- (e.currentTarget as HTMLElement).blur();
82
-
83
- contentRef.current.scrollTo({
84
- top: contentRef.current.scrollHeight,
85
- behavior: 'smooth',
86
- });
87
- }}
88
- position="absolute"
89
- />
72
+ <>
73
+ <Box
74
+ background="linear-gradient(0deg, #FFF 0%, rgba(255, 255, 255, 0.00) 100%)"
75
+ width="100%"
76
+ height={32}
77
+ bottom={16}
78
+ position="absolute"
79
+ />
80
+ <ScrollButton
81
+ alignSelf="center"
82
+ bottom={16}
83
+ flexShrink={0}
84
+ onClick={(e) => {
85
+ if (!contentRef.current) {
86
+ return;
87
+ }
88
+
89
+ (e.currentTarget as HTMLElement).blur();
90
+
91
+ contentRef.current.scrollTo({
92
+ top: contentRef.current.scrollHeight,
93
+ behavior: 'smooth',
94
+ });
95
+ }}
96
+ position="absolute"
97
+ />
98
+ </>
90
99
  )}
91
100
  </Box>
92
101
  );
@@ -11,6 +11,6 @@ export interface DialogProps
11
11
  scrollBehavior?: 'inside' | 'outside';
12
12
  title: string;
13
13
  trapFocus?: boolean;
14
- variant?: 'default' | 'empty';
14
+ variant?: 'default' | 'empty' | 'overflow';
15
15
  closeNotice?: string;
16
16
  }
@@ -0,0 +1,39 @@
1
+ import { defineStyle, defineStyleConfig } from 'chakra-ui-2--styled-system';
2
+
3
+ const baseStyle = defineStyle(() => {
4
+ return {
5
+ display: 'inline-flex',
6
+ alignItems: 'center',
7
+ gap: '4',
8
+ color: 'text/link',
9
+ _active: {
10
+ color: 'text/primary',
11
+ backgroundColor: `transparent`,
12
+ },
13
+ _hover: {
14
+ color: 'text/link-hover',
15
+ backgroundColor: `transparent`,
16
+ },
17
+ _disabled: {
18
+ color: 'text/disabled',
19
+ cursor: 'not-allowed',
20
+ },
21
+ };
22
+ });
23
+
24
+ const linkButtonTheme = defineStyleConfig({
25
+ baseStyle,
26
+ sizes: {
27
+ lg: {
28
+ textStyle: 'body/lg/regular',
29
+ },
30
+ md: {
31
+ textStyle: 'body/md/regular',
32
+ },
33
+ sm: {
34
+ textStyle: 'body/sm/regular',
35
+ },
36
+ },
37
+ });
38
+
39
+ export default linkButtonTheme;
@@ -0,0 +1,24 @@
1
+ import { forwardRef, useStyleConfig } from 'chakra-ui-2--react';
2
+ import Icon, { TypeIconName } from '../Icon/Icon';
3
+ import Box, { BoxProps } from '../Box/Box';
4
+
5
+ export interface LinkButtonProps extends BoxProps {
6
+ isDisabled?: boolean;
7
+ rightIconName?: TypeIconName;
8
+ size?: 'sm' | 'md' | 'lg';
9
+ }
10
+
11
+ const LinkButton = forwardRef<LinkButtonProps, 'div'>((props, ref) => {
12
+ const { rightIconName, isDisabled = false, size = 'lg', children, ...rest } = props;
13
+
14
+ const styles = useStyleConfig('LinkButton', { size, ...rest });
15
+
16
+ return (
17
+ <Box as="button" disabled={isDisabled} ref={ref} _css={styles} {...rest}>
18
+ {children}
19
+ {rightIconName && <Icon name={rightIconName} size="16" />}
20
+ </Box>
21
+ );
22
+ });
23
+
24
+ export default LinkButton;
@@ -14,6 +14,7 @@ import Divider from './Divider/Divider.theme';
14
14
  import Drawer from './Drawer/Drawer.theme';
15
15
  import EmptyState from './EmptyState/EmptyState.theme';
16
16
  import Link from './Link/Link.theme';
17
+ import LinkButton from './LinkButton/LinkButton.theme';
17
18
  import List from './List/List.theme';
18
19
  import Menu from './Menu/Menu.theme';
19
20
  import Radio from './Form/Radio/Radio.theme';
@@ -80,6 +81,7 @@ const components = {
80
81
  Filter,
81
82
  Input,
82
83
  Link,
84
+ LinkButton,
83
85
  List,
84
86
  Menu,
85
87
  Modal: Dialog,
package/src/index.ts CHANGED
@@ -5,6 +5,9 @@ export * from './hooks';
5
5
 
6
6
  export { default as theme, breakpoints } from './theme';
7
7
 
8
+ export type { LinkButtonProps } from './Components/LinkButton/LinkButton';
9
+ export { default as LinkButton } from './Components/LinkButton/LinkButton';
10
+
8
11
  export type { LinkProps } from './Components/Link/Link';
9
12
  export { default as Link } from './Components/Link/Link';
10
13