@bitrise/bitkit 13.79.1-alpha.1 → 13.80.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.79.1-alpha.1",
4
+ "version": "13.80.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,4 +1,4 @@
1
- import { Children } from 'react';
1
+ import React, { Children } from 'react';
2
2
  import {
3
3
  Breadcrumb as ChakraBreadcrumb,
4
4
  BreadcrumbItem,
@@ -24,6 +24,10 @@ const Breadcrumb = forwardRef<BreadcrumbProps, 'nav'>((props, ref) => {
24
24
 
25
25
  const childrenCount = Children.count(children);
26
26
  const items = Children.map(children, (child, index) => {
27
+ if (!React.isValidElement(child)) {
28
+ return null;
29
+ }
30
+
27
31
  return (
28
32
  <BreadcrumbItem>
29
33
  {hasSeparatorBeforeFirst && index === 0 && <BreadcrumbSeparator marginLeft="0" />}
@@ -5,90 +5,48 @@ const InputTheme = defineStyle({
5
5
  field: {
6
6
  _disabled: {
7
7
  _hover: {
8
- borderColor: 'border.disabled',
8
+ borderColor: 'neutral.90',
9
9
  },
10
10
  _placeholder: {
11
- color: 'text.disabled',
11
+ color: 'neutral.80',
12
12
  },
13
- color: 'text.disabled',
14
- background: 'background.disabled',
13
+ background: 'neutral.93',
15
14
  cursor: 'not-allowed',
16
15
  },
17
16
  _focusVisible: {
17
+ borderColor: 'purple.50',
18
18
  boxShadow: 'formFocus',
19
19
  },
20
20
  _hover: {
21
- borderColor: 'border.hover',
21
+ borderColor: 'neutral.70',
22
22
  },
23
23
  _invalid: {
24
24
  _hover: {
25
- borderColor: 'border.error',
25
+ borderColor: 'red.50',
26
26
  },
27
- borderColor: 'border.error',
28
- color: 'input.text.error',
27
+ borderColor: 'red.50',
28
+ color: 'red.50',
29
29
  },
30
30
  _placeholder: {
31
- color: 'input.text.placeholder',
31
+ color: 'neutral.60',
32
32
  },
33
33
  _readOnly: {
34
34
  _hover: {
35
- borderColor: 'border.regular',
35
+ borderColor: 'neutral.90',
36
36
  },
37
- background: 'background.disabled',
37
+ background: 'neutral.93',
38
38
  },
39
39
  appearance: 'none',
40
- background: 'background.primary',
40
+ background: 'neutral.100',
41
41
  border: '1px solid',
42
- borderColor: 'border.regular',
42
+ borderColor: 'neutral.90',
43
43
  borderRadius: '4',
44
44
  boxShadow: 'inner',
45
45
  outline: 0,
46
+ padding: '0.6875rem',
46
47
  transition: '200ms',
47
48
  width: '100%',
48
49
  },
49
- icon: {
50
- color: 'icon.tertiary',
51
- _groupHover: {
52
- color: 'icon.primary',
53
- _disabled: {
54
- color: 'icon.on-disabled',
55
- },
56
- },
57
- _disabled: {
58
- color: 'icon.on-disabled',
59
- },
60
- },
61
- leftIconWrapper: {
62
- pointerEvents: 'none',
63
- top: '50%',
64
- transform: 'translateY(-50%)',
65
- left: '12',
66
- },
67
- rightIconWrapper: {
68
- pointerEvents: 'none',
69
- top: '50%',
70
- transform: 'translateY(-50%)',
71
- right: '12',
72
- },
73
- inputContainer: {
74
- position: 'relative',
75
- },
76
- },
77
- sizes: {
78
- lg: {
79
- field: {
80
- fontSize: '3',
81
- height: '48',
82
- paddingLeft: '16',
83
- },
84
- },
85
- md: {
86
- field: {
87
- fontSize: '2',
88
- height: '40',
89
- paddingLeft: '12',
90
- },
91
- },
92
50
  },
93
51
  });
94
52
 
@@ -7,6 +7,7 @@ import {
7
7
  FormLabel,
8
8
  forwardRef,
9
9
  Input as ChakraInput,
10
+ InputGroup,
10
11
  InputLeftElement,
11
12
  InputProps as ChakraInputProps,
12
13
  InputRightAddon,
@@ -14,9 +15,6 @@ import {
14
15
  InputRightElement,
15
16
  SystemStyleObject,
16
17
  IconProps,
17
- useMultiStyleConfig,
18
- InputGroup,
19
- BoxProps,
20
18
  } from '@chakra-ui/react';
21
19
  import Icon, { TypeIconName } from '../../Icon/Icon';
22
20
  import Text from '../../Text/Text';
@@ -48,11 +46,11 @@ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
48
46
  infoText?: string;
49
47
  infoTooltipProps?: TooltipProps;
50
48
  isLoading?: boolean;
51
- isWarning?: boolean;
52
49
  helperText?: ReactNode;
50
+ inputHeight?: number;
53
51
  inputRef?: Ref<HTMLInputElement>;
54
52
  inputStyle?: SystemStyleObject;
55
- inputWrapperStyle?: BoxProps;
53
+ inputWrapperStyle?: SystemStyleObject;
56
54
  label?: ReactNode;
57
55
  leftAddon?: ReactNode;
58
56
  leftAddonPlacement?: 'inside' | 'outside';
@@ -62,9 +60,7 @@ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
62
60
  rightAddonPlacement?: 'inside' | 'outside';
63
61
  rightIconName?: TypeIconName;
64
62
  rightIconColor?: IconProps['color'];
65
- size?: 'lg' | 'md';
66
63
  withCounter?: boolean;
67
- warningText?: ReactNode;
68
64
  }
69
65
 
70
66
  /**
@@ -79,13 +75,13 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
79
75
  helperText,
80
76
  infoText,
81
77
  infoTooltipProps,
78
+ inputHeight,
82
79
  inputRef,
83
80
  inputStyle,
84
81
  inputWrapperStyle,
85
82
  isDisabled,
86
83
  isInvalid,
87
84
  isLoading,
88
- isWarning,
89
85
  label,
90
86
  leftAddon,
91
87
  leftAddonPlacement,
@@ -105,11 +101,9 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
105
101
  rightIconName,
106
102
  rightIconColor,
107
103
  role,
108
- size = 'lg',
109
104
  step,
110
105
  type,
111
106
  value,
112
- warningText,
113
107
  withCounter,
114
108
  ...rest
115
109
  } = props;
@@ -135,11 +129,22 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
135
129
  ref: inputRef,
136
130
  role,
137
131
  step,
138
- size,
132
+ sx: { height: inputHeight, ...inputStyle },
139
133
  type,
140
134
  value,
141
135
  };
142
136
 
137
+ let InputWrapper: any = Box;
138
+
139
+ const inputWrapperProps: SystemStyleObject = {
140
+ ...inputWrapperStyle,
141
+ };
142
+
143
+ if (leftAddon || leftIconName || rightAddon || rightIconName) {
144
+ InputWrapper = InputGroup;
145
+ inputWrapperProps.zIndex = 0;
146
+ }
147
+
143
148
  const RightContentWrapper = rightAddonPlacement === 'inside' ? InputRightElement : InputRightAddon;
144
149
  const inputRightPadding = rightIconName || (rightAddon && rightAddonPlacement === 'inside') ? '43px' : '11px';
145
150
 
@@ -157,9 +162,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
157
162
  };
158
163
 
159
164
  const showLabel = label || !!infoText || (withCounter && maxLength);
160
-
161
- const iconSize = size === 'lg' ? '24' : '16';
162
- const style = useMultiStyleConfig('Input');
165
+ const iconSize = inputHeight && inputHeight < 40 ? 16 : 24;
163
166
 
164
167
  return (
165
168
  <FormControl {...formControlProps}>
@@ -167,7 +170,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
167
170
  {label && (
168
171
  <FormLabel
169
172
  optionalIndicator={
170
- <Text as="span" color="text.secondary" fontSize="2" fontWeight="normal" marginLeft="4">
173
+ <Text as="span" color="neutral.40" fontSize="2" fontWeight="normal" marginLeft="4px">
171
174
  (Optional)
172
175
  </Text>
173
176
  }
@@ -178,14 +181,14 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
178
181
  )}
179
182
  {!!infoText && (
180
183
  <Tooltip label={infoText} placement="right" {...infoTooltipProps}>
181
- <Icon color="icon.tertiary" name="Info" size="16" />
184
+ <Icon color="neutral.50" name="Info" size="16" />
182
185
  </Tooltip>
183
186
  )}
184
187
 
185
188
  {withCounter && maxLength && (
186
189
  <Text
187
190
  as="span"
188
- color="text.secondary"
191
+ color="neutral.40"
189
192
  marginInlineStart="auto"
190
193
  size="2"
191
194
  sx={{ fontVariantNumeric: 'tabular-nums' }}
@@ -195,17 +198,16 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
195
198
  )}
196
199
  </Box>
197
200
 
198
- <InputGroup sx={style.inputContainer} {...inputWrapperStyle}>
201
+ <InputWrapper {...inputWrapperProps}>
199
202
  {leftAddon && <LeftContentWrapper>{leftAddon}</LeftContentWrapper>}
200
203
  {!leftAddon && leftIconName && (
201
- <InputLeftElement sx={style.leftIconWrapper}>
202
- <Icon
203
- color={leftIconColor}
204
- name={leftIconName}
205
- size={iconSize}
206
- data-disabled={isDisabled || undefined}
207
- sx={style.icon}
208
- />
204
+ <InputLeftElement
205
+ marginLeft={inputHeight ? (inputHeight - iconSize) / 2 : 12}
206
+ pointerEvents="none"
207
+ top="50%"
208
+ transform="translateY(-50%)"
209
+ >
210
+ <Icon color={leftIconColor} name={leftIconName} size={`${iconSize}`} />
209
211
  </InputLeftElement>
210
212
  )}
211
213
  <ChakraInput
@@ -215,43 +217,19 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
215
217
  onChange={onInputChange}
216
218
  />
217
219
  {rightAddon && <RightContentWrapper>{rightAddon}</RightContentWrapper>}
218
- {!rightAddon && (rightIconName || isWarning || warningText || isInvalid) && (
219
- <InputRightElement sx={style.rightIconWrapper}>
220
- {rightIconName && !isWarning && !warningText && !isInvalid && (
221
- <Icon
222
- color={rightIconColor}
223
- name={rightIconName}
224
- size={iconSize}
225
- sx={style.icon}
226
- data-disabled={isDisabled || undefined}
227
- />
228
- )}
229
- {!isInvalid && (isWarning || warningText) && (
230
- <Icon aria-hidden="true" name="WarningColored" size={iconSize} sx={style.stateIcon} />
231
- )}
232
- {isInvalid && (
233
- <Icon
234
- aria-hidden="true"
235
- color="icon.negative"
236
- name="ErrorCircleFilled"
237
- size={iconSize}
238
- sx={style.stateIcon}
239
- />
240
- )}
220
+ {!rightAddon && rightIconName && (
221
+ <InputRightElement
222
+ marginRight={inputHeight ? (inputHeight - iconSize) / 2 : 12}
223
+ pointerEvents="none"
224
+ top="50%"
225
+ transform="translateY(-50%)"
226
+ >
227
+ <Icon color={rightIconColor} name={rightIconName} size={`${iconSize}`} />
241
228
  </InputRightElement>
242
229
  )}
243
- </InputGroup>
230
+ </InputWrapper>
244
231
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
245
- {!errorText && warningText && (
246
- <FormHelperText color="text.body" as="p">
247
- {warningText}
248
- </FormHelperText>
249
- )}
250
- {!errorText && !warningText && helperText && (
251
- <FormHelperText as="p" data-disabled={isDisabled || undefined}>
252
- {helperText}
253
- </FormHelperText>
254
- )}
232
+ {helperText && <FormHelperText as="p">{helperText}</FormHelperText>}
255
233
  </FormControl>
256
234
  );
257
235
  });
@@ -120,11 +120,7 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
120
120
  )}
121
121
  </Box>
122
122
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
123
- {!errorText && helperText && (
124
- <FormHelperText as="p" data-disabled={isDisabled || undefined}>
125
- {helperText}
126
- </FormHelperText>
127
- )}
123
+ {helperText && <FormHelperText as="p">{helperText}</FormHelperText>}
128
124
  </FormControl>
129
125
  );
130
126
  });