@bitrise/bitkit 9.21.0-alpha-chakra.3 → 9.22.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": "9.21.0-alpha-chakra.3",
4
+ "version": "9.22.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -0,0 +1,38 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import { sortObjectByKey } from '../../utils/storyUtils';
3
+ import Select from './Select';
4
+
5
+ export default {
6
+ title: 'Components/Select',
7
+ component: Select,
8
+ argTypes: {
9
+ onChange: {
10
+ action: 'onChange event',
11
+ },
12
+ },
13
+ } as ComponentMeta<typeof Select>;
14
+
15
+ const args = {
16
+ ...Select.defaultProps,
17
+ isDisabled: false,
18
+ isInvalid: false,
19
+ isRequired: false,
20
+ };
21
+
22
+ const children = (
23
+ <>
24
+ <option value="all">All status</option>
25
+ <option value="successful">Successful</option>
26
+ <option value="failed">Failed</option>
27
+ <option value="aborted">Aborted</option>
28
+ <option value="on_hold">On hold</option>
29
+ </>
30
+ );
31
+
32
+ const Template: ComponentStory<typeof Select> = (props) => <Select {...props}>{children}</Select>;
33
+
34
+ export const WithProps = Template.bind({});
35
+ WithProps.args = sortObjectByKey({
36
+ ...args,
37
+ placeholder: 'Select build status',
38
+ });
@@ -0,0 +1,51 @@
1
+ const SelectTheme = {
2
+ baseStyle: {
3
+ field: {
4
+ appearance: 'none',
5
+ bgGradient: 'linear(to-b, neutral.100, neutral.93)',
6
+ border: '0.0625rem solid',
7
+ borderColor: 'neutral.90',
8
+ borderRadius: '4',
9
+ color: 'purple.10',
10
+ position: 'relative',
11
+ width: '100%',
12
+ _hover: {
13
+ bgGradient: 'linear(to-b, neutral.93, neutral.93)',
14
+ },
15
+ _active: {
16
+ bgGradient: 'linear(to-b, neutral.90, neutral.90)',
17
+ borderColor: 'neutral.80',
18
+ },
19
+ _disabled: {
20
+ color: 'neutral.70',
21
+ pointerEvents: 'none',
22
+ },
23
+ },
24
+ icon: {
25
+ right: '8',
26
+ _disabled: {
27
+ opacity: '0.2',
28
+ },
29
+ },
30
+ },
31
+ sizes: {
32
+ small: {
33
+ field: {
34
+ fontSize: '2',
35
+ height: '32',
36
+ paddingLeft: '12',
37
+ paddingRight: '32',
38
+ },
39
+ },
40
+ medium: {
41
+ field: {
42
+ fontSize: '3',
43
+ height: '48',
44
+ paddingLeft: '16',
45
+ paddingRight: '32',
46
+ },
47
+ },
48
+ },
49
+ };
50
+
51
+ export default SelectTheme;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Select as ChakraSelect, SelectProps as ChakraSelectProps } from '@chakra-ui/react';
3
+ import Icon, { TypeIconName } from '../Icon/Icon';
4
+
5
+ export interface SelectProps extends ChakraSelectProps {
6
+ iconName?: TypeIconName;
7
+ size?: 'small' | 'medium';
8
+ }
9
+
10
+ const Select = (props: SelectProps) => {
11
+ const { iconName = 'DropdownArrows', size, ...rest } = props;
12
+ const iconSize = size === 'medium' ? '24' : '16';
13
+ const properties: ChakraSelectProps = {
14
+ icon: <Icon name={iconName} fontSize={iconSize} size={iconSize} />,
15
+ size,
16
+ variant: 'select',
17
+ ...rest,
18
+ };
19
+ return <ChakraSelect {...properties} />;
20
+ };
21
+
22
+ Select.defaultProps = {
23
+ iconName: 'DropdownArrows',
24
+ size: 'medium',
25
+ } as SelectProps;
26
+
27
+ export default Select;
package/src/index.ts CHANGED
@@ -65,3 +65,6 @@ export { default as IconButton } from './Components/IconButton/IconButton';
65
65
 
66
66
  export type { TooltipProps } from './Components/Tooltip/Tooltip';
67
67
  export { default as Tooltip } from './Components/Tooltip/Tooltip';
68
+
69
+ export type { SelectProps } from './Components/Select/Select';
70
+ export { default as Select } from './Components/Select/Select';
package/src/theme.ts CHANGED
@@ -5,6 +5,7 @@ import ColorButton from './Components/ColorButton/ColorButton.theme';
5
5
  import Divider from './Components/Divider/Divider.theme';
6
6
  import Link from './Components/Link/Link.theme';
7
7
  import Menu from './Components/Menu/Menu.theme';
8
+ import Select from './Components/Select/Select.theme';
8
9
  import Tabs from './Components/Tabs/Tabs.theme';
9
10
  import Text from './Components/Text/Text.theme';
10
11
  import Tooltip from './Components/Tooltip/Tooltip.theme';
@@ -56,6 +57,7 @@ const theme = {
56
57
  Divider,
57
58
  Link,
58
59
  Menu,
60
+ Select,
59
61
  Tabs,
60
62
  Text,
61
63
  Tooltip,