@bitrise/bitkit 13.79.1-alpha.0 → 13.79.1-alpha.1

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.0",
4
+ "version": "13.79.1-alpha.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,5 +1,4 @@
1
1
  import { defineStyle } from '@chakra-ui/styled-system';
2
- import { rem } from '../../../utils/utils';
3
2
 
4
3
  const InputTheme = defineStyle({
5
4
  baseStyle: {
@@ -44,13 +43,11 @@ const InputTheme = defineStyle({
44
43
  borderRadius: '4',
45
44
  boxShadow: 'inner',
46
45
  outline: 0,
47
- padding: '0.6875rem',
48
46
  transition: '200ms',
49
47
  width: '100%',
50
48
  },
51
49
  icon: {
52
50
  color: 'icon.tertiary',
53
- right: rem(11),
54
51
  _groupHover: {
55
52
  color: 'icon.primary',
56
53
  _disabled: {
@@ -61,22 +58,26 @@ const InputTheme = defineStyle({
61
58
  color: 'icon.on-disabled',
62
59
  },
63
60
  },
64
- inputContainer: {
65
- position: 'relative',
66
- },
67
- stateIcon: {
68
- position: 'absolute',
69
- right: rem(16),
61
+ leftIconWrapper: {
62
+ pointerEvents: 'none',
70
63
  top: '50%',
71
64
  transform: 'translateY(-50%)',
65
+ left: '12',
66
+ },
67
+ rightIconWrapper: {
72
68
  pointerEvents: 'none',
69
+ top: '50%',
70
+ transform: 'translateY(-50%)',
71
+ right: '12',
72
+ },
73
+ inputContainer: {
74
+ position: 'relative',
73
75
  },
74
76
  },
75
77
  sizes: {
76
78
  lg: {
77
79
  field: {
78
80
  fontSize: '3',
79
- gap: '0.625rem',
80
81
  height: '48',
81
82
  paddingLeft: '16',
82
83
  },
@@ -84,7 +85,6 @@ const InputTheme = defineStyle({
84
85
  md: {
85
86
  field: {
86
87
  fontSize: '2',
87
- gap: '0.375rem',
88
88
  height: '40',
89
89
  paddingLeft: '12',
90
90
  },
@@ -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,
@@ -16,6 +15,8 @@ import {
16
15
  SystemStyleObject,
17
16
  IconProps,
18
17
  useMultiStyleConfig,
18
+ InputGroup,
19
+ BoxProps,
19
20
  } from '@chakra-ui/react';
20
21
  import Icon, { TypeIconName } from '../../Icon/Icon';
21
22
  import Text from '../../Text/Text';
@@ -49,10 +50,9 @@ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
49
50
  isLoading?: boolean;
50
51
  isWarning?: boolean;
51
52
  helperText?: ReactNode;
52
- inputHeight?: number;
53
53
  inputRef?: Ref<HTMLInputElement>;
54
54
  inputStyle?: SystemStyleObject;
55
- inputWrapperStyle?: SystemStyleObject;
55
+ inputWrapperStyle?: BoxProps;
56
56
  label?: ReactNode;
57
57
  leftAddon?: ReactNode;
58
58
  leftAddonPlacement?: 'inside' | 'outside';
@@ -79,7 +79,6 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
79
79
  helperText,
80
80
  infoText,
81
81
  infoTooltipProps,
82
- inputHeight,
83
82
  inputRef,
84
83
  inputStyle,
85
84
  inputWrapperStyle,
@@ -137,22 +136,10 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
137
136
  role,
138
137
  step,
139
138
  size,
140
- // sx: { height: inputHeight, ...inputStyle },
141
139
  type,
142
140
  value,
143
141
  };
144
142
 
145
- let InputWrapper: any = Box;
146
-
147
- const inputWrapperProps: SystemStyleObject = {
148
- ...inputWrapperStyle,
149
- };
150
-
151
- if (leftAddon || leftIconName || rightAddon || rightIconName) {
152
- InputWrapper = InputGroup;
153
- inputWrapperProps.zIndex = 0;
154
- }
155
-
156
143
  const RightContentWrapper = rightAddonPlacement === 'inside' ? InputRightElement : InputRightAddon;
157
144
  const inputRightPadding = rightIconName || (rightAddon && rightAddonPlacement === 'inside') ? '43px' : '11px';
158
145
 
@@ -171,13 +158,8 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
171
158
 
172
159
  const showLabel = label || !!infoText || (withCounter && maxLength);
173
160
 
174
- const iconNumber = inputHeight && inputHeight < 40 ? 16 : 24;
175
-
176
161
  const iconSize = size === 'lg' ? '24' : '16';
177
- const style = useMultiStyleConfig('Input', {
178
- hasStateIcon: isInvalid || isWarning,
179
- isPlaceholderShown: !!placeholder && !value,
180
- });
162
+ const style = useMultiStyleConfig('Input');
181
163
 
182
164
  return (
183
165
  <FormControl {...formControlProps}>
@@ -213,16 +195,17 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
213
195
  )}
214
196
  </Box>
215
197
 
216
- <InputWrapper sx={style.inputContainer}>
198
+ <InputGroup sx={style.inputContainer} {...inputWrapperStyle}>
217
199
  {leftAddon && <LeftContentWrapper>{leftAddon}</LeftContentWrapper>}
218
200
  {!leftAddon && leftIconName && (
219
- <InputLeftElement
220
- marginLeft={inputHeight ? (inputHeight - iconNumber) / 2 : 12}
221
- pointerEvents="none"
222
- top="50%"
223
- transform="translateY(-50%)"
224
- >
225
- <Icon color={leftIconColor} name={leftIconName} size={iconSize} data-disabled={isDisabled || undefined} />
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
+ />
226
209
  </InputLeftElement>
227
210
  )}
228
211
  <ChakraInput
@@ -231,36 +214,33 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
231
214
  {...inputProps}
232
215
  onChange={onInputChange}
233
216
  />
234
- {!isInvalid && (isWarning || warningText) && (
235
- <Icon aria-hidden="true" name="WarningColored" size={iconSize} sx={style.stateIcon} />
236
- )}
237
- {isInvalid && (
238
- <Icon
239
- aria-hidden="true"
240
- color="icon.negative"
241
- name="ErrorCircleFilled"
242
- size={iconSize}
243
- sx={style.stateIcon}
244
- />
245
- )}
246
217
  {rightAddon && <RightContentWrapper>{rightAddon}</RightContentWrapper>}
247
- {!rightAddon && rightIconName && (
248
- <InputRightElement
249
- marginRight={inputHeight ? (inputHeight - iconNumber) / 2 : 12}
250
- pointerEvents="none"
251
- top="50%"
252
- transform="translateY(-50%)"
253
- >
254
- <Icon
255
- color={rightIconColor}
256
- name={rightIconName}
257
- size={iconSize}
258
- sx={style.icon}
259
- data-disabled={isDisabled || undefined}
260
- />
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
+ )}
261
241
  </InputRightElement>
262
242
  )}
263
- </InputWrapper>
243
+ </InputGroup>
264
244
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
265
245
  {!errorText && warningText && (
266
246
  <FormHelperText color="text.body" as="p">