@bitrise/bitkit 12.60.0 → 12.61.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": "12.60.0",
4
+ "version": "12.61.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,4 +1,5 @@
1
1
  import type { SystemStyleObject } from '@chakra-ui/theme-tools';
2
+ import { rem } from '../../utils/utils';
2
3
 
3
4
  const disabledItem: SystemStyleObject = {
4
5
  _disabled: {
@@ -19,6 +20,28 @@ const MenuTheme: SystemStyleObject = {
19
20
  paddingY: '12',
20
21
  zIndex: '1',
21
22
  },
23
+ groupTitle: {
24
+ display: 'flex',
25
+ gap: '16',
26
+ alignItems: 'center',
27
+ color: 'neutral.60',
28
+ cursor: 'default',
29
+ fontSize: '1',
30
+ fontWeight: 'bold',
31
+ lineHeight: rem(16),
32
+ paddingY: '12',
33
+ paddingX: '16',
34
+ position: 'relative',
35
+ textTransform: 'uppercase',
36
+ _after: {
37
+ content: `''`,
38
+ flexGrow: '1',
39
+ height: rem(1),
40
+ backgroundColor: 'separator.primary',
41
+ position: 'relative',
42
+ top: '-1px',
43
+ },
44
+ },
22
45
  item: {
23
46
  color: 'purple.10',
24
47
  paddingY: '12',
@@ -0,0 +1,7 @@
1
+ import { MenuGroup as ChakraMenuGroup, MenuGroupProps as ChakraMenuGroupProps } from '@chakra-ui/react';
2
+
3
+ export type MenuGroupProps = ChakraMenuGroupProps;
4
+
5
+ const MenuGroup = (props: MenuGroupProps) => <ChakraMenuGroup {...props} />;
6
+
7
+ export default MenuGroup;
@@ -1,4 +1,6 @@
1
1
  import { MenuItem as ChakraMenuItem, MenuItemProps as ChakraMenuItemProps, forwardRef } from '@chakra-ui/react';
2
+ import { TypeColors } from '../../Foundations/Colors/Colors';
3
+ import Box from '../Box/Box';
2
4
  import Icon, { TypeIconName } from '../Icon/Icon';
3
5
 
4
6
  const dangerStyle = {
@@ -12,22 +14,46 @@ const dangerStyle = {
12
14
  },
13
15
  };
14
16
 
15
- export interface MenuItemProps extends ChakraMenuItemProps {
17
+ export interface MenuItemProps extends Omit<ChakraMenuItemProps, 'icon'> {
16
18
  as?: 'a' | 'button';
17
19
  iconName?: TypeIconName;
18
20
  isDanger?: boolean;
21
+ leftIconColor?: TypeColors;
22
+ leftIconName?: TypeIconName;
23
+ rightIconColor?: TypeColors;
24
+ rightIconName?: TypeIconName;
19
25
  }
20
26
 
21
27
  const MenuItem = forwardRef<MenuItemProps, 'button'>((props, ref) => {
22
- const { as, iconName, isDanger, isDisabled, ...rest } = props;
28
+ const {
29
+ as,
30
+ children,
31
+ iconName,
32
+ isDanger,
33
+ isDisabled,
34
+ leftIconColor,
35
+ leftIconName,
36
+ rightIconColor,
37
+ rightIconName,
38
+ ...rest
39
+ } = props;
23
40
  const properties: ChakraMenuItemProps = {
24
41
  as: isDisabled ? 'button' : as,
25
42
  iconSpacing: '12',
26
43
  isDisabled,
27
44
  ...rest,
28
45
  };
29
- if (iconName) {
30
- properties.icon = <Icon name={iconName} />;
46
+
47
+ if (iconName || leftIconName || rightIconName) {
48
+ properties.children = (
49
+ <Box display="flex" gap={properties.iconSpacing} width="100%">
50
+ {(iconName || leftIconName) && <Icon color={leftIconColor} name={iconName || leftIconName || 'Bitbot'} />}
51
+ {children}
52
+ {rightIconName && <Icon color={rightIconColor} name={rightIconName} marginInlineStart="auto" />}
53
+ </Box>
54
+ );
55
+ } else {
56
+ properties.children = children;
31
57
  }
32
58
  // There is no variant for MenuItem
33
59
  if (isDanger) {
package/src/index.ts CHANGED
@@ -77,6 +77,9 @@ export { default as Menu } from './Components/Menu/Menu';
77
77
  export type { MenuButtonProps } from './Components/Menu/MenuButton';
78
78
  export { default as MenuButton } from './Components/Menu/MenuButton';
79
79
 
80
+ export type { MenuGroupProps } from './Components/Menu/MenuGroup';
81
+ export { default as MenuGroup } from './Components/Menu/MenuGroup';
82
+
80
83
  export type { MenuItemProps } from './Components/Menu/MenuItem';
81
84
  export { default as MenuItem } from './Components/Menu/MenuItem';
82
85