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