@bitrise/bitkit 11.1.3 → 11.2.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": "11.1.3",
4
+ "version": "11.2.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -34,9 +34,8 @@ const CheckboxTheme: ComponentStyleConfig = {
34
34
  _hover: {
35
35
  borderColor: 'neutral.70',
36
36
  },
37
- // TODO: change it to _focusVisible when the Chakra updated to v2
38
- _focus: {
39
- boxShadow: 'outline',
37
+ _focusVisible: {
38
+ boxShadow: 'formFocus',
40
39
  },
41
40
  },
42
41
  label: {
@@ -19,14 +19,23 @@ const InputTheme = defineStyle({
19
19
  _disabled: {
20
20
  background: 'neutral.93',
21
21
  cursor: 'not-allowed',
22
+ _hover: {
23
+ borderColor: 'neutral.90',
24
+ },
22
25
  },
23
26
  _focusVisible: {
24
27
  boxShadow: 'formFocus',
25
28
  borderColor: 'purple.50',
26
29
  },
30
+ _hover: {
31
+ borderColor: 'neutral.70',
32
+ },
27
33
  _invalid: {
28
34
  color: 'red.50',
29
35
  borderColor: 'red.50',
36
+ _hover: {
37
+ borderColor: 'red.50',
38
+ },
30
39
  },
31
40
  },
32
41
  },
@@ -14,6 +14,7 @@ import {
14
14
  InputRightElement,
15
15
  SystemStyleObject,
16
16
  } from '@chakra-ui/react';
17
+ import { TypeColors } from '../../../Foundations/Colors/Colors';
17
18
  import Icon, { TypeIconName } from '../../Icon/Icon';
18
19
 
19
20
  type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
@@ -42,6 +43,7 @@ export interface InputProps extends UsedFormControlProps, UsedChakraInputProps {
42
43
  inputRef?: Ref<HTMLInputElement>;
43
44
  inputStyle?: SystemStyleObject;
44
45
  label?: ReactNode;
46
+ leftIconColor?: TypeColors;
45
47
  leftIconName?: TypeIconName;
46
48
  rightAddon?: ReactNode;
47
49
  rightAddonPlacement?: 'inside' | 'outside';
@@ -64,6 +66,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
64
66
  isInvalid,
65
67
  isLoading,
66
68
  label,
69
+ leftIconColor,
67
70
  leftIconName,
68
71
  max,
69
72
  maxLength,
@@ -126,7 +129,7 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
126
129
  <InputWrapper {...inputWrapperProps}>
127
130
  {leftIconName && (
128
131
  <InputLeftElement margin="12px" pointerEvents="none">
129
- <Icon name={leftIconName} />
132
+ <Icon color={leftIconColor} name={leftIconName} />
130
133
  </InputLeftElement>
131
134
  )}
132
135
  <ChakraInput paddingLeft={leftIconName ? '43px' : '11px'} paddingRight={inputRightPadding} {...inputProps} />
@@ -41,9 +41,8 @@ const RadioTheme: ComponentStyleConfig = {
41
41
  _hover: {
42
42
  borderColor: 'neutral.70',
43
43
  },
44
- // TODO: change it to _focusVisible when the Chakra updated to v2
45
- _focus: {
46
- boxShadow: 'outline',
44
+ _focusVisible: {
45
+ boxShadow: 'formFocus',
47
46
  },
48
47
  },
49
48
  label: {
@@ -0,0 +1,52 @@
1
+ import { ChangeEvent, useState } from 'react';
2
+ import Input, { InputProps } from '../Form/Input/Input';
3
+ import IconButton from '../IconButton/IconButton';
4
+
5
+ export interface SearchInputProps extends Omit<InputProps, 'onChange'> {
6
+ onChange?: (value: string) => void;
7
+ }
8
+
9
+ const SearchInput = (props: SearchInputProps) => {
10
+ const { onChange, ...rest } = props;
11
+
12
+ const [value, setValue] = useState('');
13
+
14
+ const onInputChange = (event: ChangeEvent<HTMLInputElement>) => {
15
+ const q = event.target.value;
16
+ setValue(q);
17
+ if (onChange) {
18
+ onChange(q);
19
+ }
20
+ };
21
+
22
+ const onClearClick = () => {
23
+ setValue('');
24
+ if (onChange) {
25
+ onChange('');
26
+ }
27
+ };
28
+
29
+ const rightButton = (
30
+ <IconButton
31
+ aria-label="Clear"
32
+ iconName="CloseSmall"
33
+ onClick={onClearClick}
34
+ variant="tertiary"
35
+ _active={{ background: 'transparent' }}
36
+ _hover={{ background: 'transparent' }}
37
+ />
38
+ );
39
+ const inputProps: InputProps = {
40
+ leftIconColor: 'neutral.60',
41
+ leftIconName: 'Magnifier',
42
+ onChange: onInputChange,
43
+ rightAddon: value ? rightButton : undefined,
44
+ rightAddonPlacement: 'inside',
45
+ type: 'text',
46
+ value,
47
+ ...rest,
48
+ };
49
+ return <Input {...inputProps} />;
50
+ };
51
+
52
+ export default SearchInput;
@@ -6,7 +6,7 @@ const shadows = {
6
6
  innerSmall: '0 0.0625rem 0.125rem 0 rgba(0, 0, 0, 0.1) inset',
7
7
  outline: '0 0 0 3px #C289E6',
8
8
  tooltip: '0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.2)',
9
- formFocus: '0 0.125rem 0.1875rem 0 rgba(0, 0, 0, 0.1) inset, inset 0 0 0 3px rgba(146, 71, 194, 0.3)',
9
+ formFocus: '0 0.125rem 0.1875rem 0 rgba(0, 0, 0, 0.1) inset, 0 0 0 3px #C289E6',
10
10
  none: 'none',
11
11
  };
12
12