@bitrise/bitkit 13.56.0 → 13.57.1-alpha.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.56.0",
4
+ "version": "13.57.1-alpha.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -57,26 +57,26 @@
57
57
  "@babel/preset-typescript": "^7.24.1",
58
58
  "@bitrise/eslint-plugin": "^2.10.2",
59
59
  "@chakra-ui/cli": "^2.4.1",
60
- "@google-cloud/storage": "^7.10.0",
61
- "@storybook/addon-actions": "^8.0.8",
62
- "@storybook/addon-essentials": "^8.0.8",
63
- "@storybook/addon-interactions": "^8.0.8",
64
- "@storybook/addon-links": "^8.0.8",
60
+ "@google-cloud/storage": "^7.10.1",
61
+ "@storybook/addon-actions": "^8.0.9",
62
+ "@storybook/addon-essentials": "^8.0.9",
63
+ "@storybook/addon-interactions": "^8.0.9",
64
+ "@storybook/addon-links": "^8.0.9",
65
65
  "@storybook/addon-webpack5-compiler-swc": "^1.0.2",
66
- "@storybook/blocks": "^8.0.8",
67
- "@storybook/react": "^8.0.8",
68
- "@storybook/react-webpack5": "^8.0.8",
69
- "@storybook/theming": "^8.0.8",
70
- "@testing-library/dom": "^9.3.4",
66
+ "@storybook/blocks": "^8.0.9",
67
+ "@storybook/react": "^8.0.9",
68
+ "@storybook/react-webpack5": "^8.0.9",
69
+ "@storybook/theming": "^8.0.9",
70
+ "@testing-library/dom": "^10.0.0",
71
71
  "@testing-library/jest-dom": "^6.4.2",
72
- "@testing-library/react": "^14.3.1",
72
+ "@testing-library/react": "^15.0.3",
73
73
  "@testing-library/user-event": "^14.5.2",
74
74
  "@types/jest": "^29.5.12",
75
75
  "@types/luxon": "^3.4.2",
76
76
  "@types/react": "^18.2.79",
77
77
  "@types/react-dom": "^18.2.25",
78
- "@typescript-eslint/eslint-plugin": "^7.7.0",
79
- "@typescript-eslint/parser": "^7.7.0",
78
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
79
+ "@typescript-eslint/parser": "^7.7.1",
80
80
  "axios": "^1.6.8",
81
81
  "eslint": "^8.57.0",
82
82
  "glob": "^10.3.12",
@@ -86,7 +86,7 @@
86
86
  "prettier": "^3.2.5",
87
87
  "react-hook-form": "^7.51.3",
88
88
  "release-it": "^17.2.0",
89
- "storybook": "^8.0.8",
89
+ "storybook": "^8.0.9",
90
90
  "ts-jest": "^29.1.2",
91
91
  "typescript": "^5.4.5"
92
92
  },
@@ -0,0 +1,9 @@
1
+ import { forwardRef, Icon, IconProps } from '@chakra-ui/react';
2
+
3
+ const SelectChevron = forwardRef<IconProps, 'svg'>((props, ref) => (
4
+ <Icon ref={ref} viewBox="0 0 16 16" {...props}>
5
+ <path fillRule="evenodd" clipRule="evenodd" fill="currentColor" />
6
+ </Icon>
7
+ ));
8
+
9
+ export default SelectChevron;
@@ -183,6 +183,7 @@ export { default as Responsiveness } from './Responsiveness';
183
183
  export { default as Save } from './Save';
184
184
  export { default as Screenshare } from './Screenshare';
185
185
  export { default as SecurityShield } from './SecurityShield';
186
+ export { default as SelectChevron } from './SelectChevron';
186
187
  export { default as Settings } from './Settings';
187
188
  export { default as SettingsSolid } from './SettingsSolid';
188
189
  export { default as Ship } from './Ship';
@@ -1,48 +1,66 @@
1
- const SelectTheme = {
2
- baseStyle: {
1
+ import { StyleConfig } from '@chakra-ui/styled-system';
2
+ import { rem } from '../../utils/utils';
3
+
4
+ const SelectTheme: StyleConfig = {
5
+ baseStyle: ({ isPlaceholderShown }) => ({
3
6
  field: {
4
- _active: {
5
- bgGradient: 'linear(to-b, neutral.90, neutral.90)',
6
- borderColor: 'neutral.80',
7
- },
8
- _disabled: {
9
- color: 'neutral.70',
10
- pointerEvents: 'none',
11
- },
12
- _hover: {
13
- bgGradient: 'linear(to-b, neutral.93, neutral.93)',
14
- },
15
7
  appearance: 'none',
16
- bgGradient: 'linear(to-b, neutral.100, neutral.93)',
17
- border: '0.0625rem solid',
18
- borderColor: 'neutral.90',
8
+ background: 'background/primary',
9
+ border: '1px solid',
10
+ borderColor: 'border/strong',
19
11
  borderRadius: '4',
20
- color: 'purple.10',
12
+ color: isPlaceholderShown ? 'input/text/placeholder' : 'input/text/inputValue',
13
+ cursor: 'pointer',
21
14
  position: 'relative',
22
15
  width: '100%',
16
+ _disabled: {
17
+ background: 'background/disabled',
18
+ borderColor: 'border/disabled',
19
+ cursor: 'not-allowed',
20
+ color: 'text/disabled',
21
+ },
22
+ _invalid: {
23
+ borderColor: 'border/error',
24
+ },
25
+ _readOnly: {
26
+ cursor: 'default',
27
+ },
23
28
  },
24
29
  icon: {
30
+ color: 'icon/secondary',
31
+ right: rem(11),
25
32
  _disabled: {
26
- opacity: '0.2',
33
+ color: 'icon/on-disabled',
27
34
  },
28
- right: '8',
29
35
  },
30
- },
36
+ selectContainer: {
37
+ position: 'relative',
38
+ },
39
+ stateIcon: {
40
+ position: 'absolute',
41
+ right: rem(42),
42
+ top: '50%',
43
+ transform: 'translateY(-50%)',
44
+ pointerEvents: 'none',
45
+ },
46
+ }),
31
47
  sizes: {
32
- medium: {
48
+ lg: {
33
49
  field: {
34
50
  fontSize: '3',
51
+ gap: '0.625rem',
35
52
  height: '48',
36
53
  paddingLeft: '16',
37
- paddingRight: '32',
54
+ paddingRight: '16',
38
55
  },
39
56
  },
40
- small: {
57
+ md: {
41
58
  field: {
42
59
  fontSize: '2',
43
- height: '32',
60
+ gap: '0.375rem',
61
+ height: '40',
44
62
  paddingLeft: '12',
45
- paddingRight: '32',
63
+ paddingRight: '12',
46
64
  },
47
65
  },
48
66
  },
@@ -8,22 +8,25 @@ import {
8
8
  forwardRef,
9
9
  Select as ChakraSelect,
10
10
  SelectProps as ChakraSelectProps,
11
+ useMultiStyleConfig,
11
12
  } from '@chakra-ui/react';
13
+ import Box from '../Box/Box';
14
+ import Text from '../Text/Text';
12
15
  import Icon from '../Icon/Icon';
13
16
  import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
14
- import Text from '../Text/Text';
15
17
 
16
18
  export interface SelectProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
17
19
  'data-testid'?: string;
18
20
  errorText?: string;
19
21
  helperText?: string;
20
22
  isLoading?: boolean;
23
+ isWarning?: boolean;
21
24
  label?: ReactNode;
22
25
  name?: string;
23
26
  onBlur?: ChakraSelectProps['onBlur'];
24
27
  onChange?: ChakraSelectProps['onChange'];
25
28
  placeholder?: ChakraSelectProps['placeholder'];
26
- size?: 'small' | 'medium';
29
+ size?: 'lg' | 'md';
27
30
  value?: ChakraSelectProps['value'];
28
31
  }
29
32
 
@@ -37,6 +40,8 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
37
40
  isDisabled,
38
41
  isInvalid,
39
42
  isLoading,
43
+ isReadOnly,
44
+ isWarning,
40
45
  label,
41
46
  name,
42
47
  onBlur,
@@ -46,19 +51,17 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
46
51
  value,
47
52
  ...rest
48
53
  } = props;
49
- const iconSize = size === 'medium' ? '24' : '16';
54
+ const isSelectInvalid = isInvalid || !!errorText;
55
+
50
56
  const formControlProps = {
51
- isDisabled: isDisabled || isLoading,
52
- isInvalid: isInvalid || !!errorText,
57
+ isDisabled: isDisabled || isLoading || isReadOnly,
58
+ isInvalid: isSelectInvalid,
59
+ isReadOnly,
53
60
  ...rest,
54
61
  };
55
62
  const selectProperties: ChakraSelectProps = {
56
63
  defaultValue,
57
- icon: isLoading ? (
58
- <ProgressSpinner marginEnd="4" size={iconSize} />
59
- ) : (
60
- <Icon fontSize={iconSize} name="DropdownArrows" size={iconSize} />
61
- ),
64
+ icon: isLoading ? <ProgressSpinner marginEnd="4" /> : <Icon fontSize="24" name="SelectChevron" />,
62
65
  name,
63
66
  onBlur,
64
67
  onChange,
@@ -74,10 +77,14 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
74
77
  }
75
78
  }
76
79
 
80
+ const iconSize = size === 'lg' ? '24' : '16';
81
+ const style = useMultiStyleConfig('Select', { isPlaceholderShown: !value });
82
+
77
83
  return (
78
84
  <FormControl {...formControlProps}>
79
85
  {label && (
80
86
  <FormLabel
87
+ marginBlockEnd="4"
81
88
  optionalIndicator={
82
89
  <Text as="span" color="neutral.40" fontSize="2" fontWeight="normal" marginLeft="4px">
83
90
  (Optional)
@@ -88,14 +95,28 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
88
95
  {label}
89
96
  </FormLabel>
90
97
  )}
91
- <ChakraSelect ref={ref} data-testid={dataTestid} {...selectProperties}>
92
- {placeholder && (
93
- <option disabled value="">
94
- {placeholder}
95
- </option>
98
+ <Box sx={style.selectContainer}>
99
+ <ChakraSelect ref={ref} data-testid={dataTestid} {...selectProperties} sx={style.field}>
100
+ {placeholder && (
101
+ <option disabled value="">
102
+ {placeholder}
103
+ </option>
104
+ )}
105
+ {children}
106
+ </ChakraSelect>
107
+ {!isSelectInvalid && isWarning && (
108
+ <Icon aria-hidden="true" name="WarningColored" size={iconSize} sx={style.stateIcon} />
109
+ )}
110
+ {isSelectInvalid && (
111
+ <Icon
112
+ aria-hidden="true"
113
+ color="icon/negative"
114
+ name="ErrorCircleFilled"
115
+ size={iconSize}
116
+ sx={style.stateIcon}
117
+ />
96
118
  )}
97
- {children}
98
- </ChakraSelect>
119
+ </Box>
99
120
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
100
121
  {helperText && <FormHelperText as="p">{helperText}</FormHelperText>}
101
122
  </FormControl>
@@ -103,7 +124,7 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
103
124
  });
104
125
 
105
126
  Select.defaultProps = {
106
- size: 'medium',
127
+ size: 'lg',
107
128
  } as SelectProps;
108
129
 
109
130
  export default Select;