@bitrise/bitkit 9.21.1 → 9.23.0-alpha-chakra.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 +1 -1
- package/src/Components/Badge/Badge.theme.ts +3 -3
- package/src/Components/IconButton/IconButton.stories.tsx +1 -0
- package/src/Components/IconButton/IconButton.tsx +8 -2
- package/src/Components/Menu/Menu.stories.tsx +50 -34
- package/src/Components/Menu/Menu.theme.ts +11 -0
- package/src/Components/Menu/Menu.tsx +1 -1
- package/src/Components/Menu/MenuButton.tsx +10 -0
- package/src/Components/Menu/MenuItem.tsx +20 -14
- package/src/Components/Menu/MenuList.tsx +10 -0
- package/src/Components/OverflowMenu/OverflowMenu.stories.tsx +9 -14
- package/src/Components/OverflowMenu/OverflowMenu.tsx +12 -4
- package/src/Components/OverflowMenu/OverflowMenuItem.tsx +5 -4
- package/src/Components/Select/Select.stories.tsx +38 -0
- package/src/Components/Select/Select.theme.ts +51 -0
- package/src/Components/Select/Select.tsx +27 -0
- package/src/index.ts +3 -0
- package/src/theme.ts +2 -0
- package/src/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -2,13 +2,13 @@ const BadgeTheme = {
|
|
|
2
2
|
baseStyle: {
|
|
3
3
|
display: 'inline-block',
|
|
4
4
|
paddingX: '8',
|
|
5
|
-
|
|
5
|
+
paddingTop: '6px',
|
|
6
|
+
paddingBottom: '5px',
|
|
6
7
|
fontSize: '1',
|
|
7
|
-
lineHeight: '
|
|
8
|
+
lineHeight: '11px',
|
|
8
9
|
fontWeight: 'bold',
|
|
9
10
|
textTransform: 'uppercase',
|
|
10
11
|
borderRadius: '4',
|
|
11
|
-
cursor: 'default',
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -7,6 +7,7 @@ export interface IconButtonProps extends ChakraIconButtonProps {
|
|
|
7
7
|
as?: 'a' | 'button';
|
|
8
8
|
iconName: TypeIconName;
|
|
9
9
|
isDanger?: boolean;
|
|
10
|
+
isTooltipDisabled?: boolean;
|
|
10
11
|
label?: string;
|
|
11
12
|
size?: 'small' | 'medium';
|
|
12
13
|
tooltipCloseDelay?: number;
|
|
@@ -17,7 +18,7 @@ export interface IconButtonProps extends ChakraIconButtonProps {
|
|
|
17
18
|
* IconButton composes the `Button` component except that it renders only an icon.
|
|
18
19
|
*/
|
|
19
20
|
const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
20
|
-
const { as, iconName, isDanger, isDisabled, label, tooltipCloseDelay, variant, ...rest } = props;
|
|
21
|
+
const { as, iconName, isDanger, isDisabled, isTooltipDisabled, label, tooltipCloseDelay, variant, ...rest } = props;
|
|
21
22
|
const properties: ChakraIconButtonProps = {
|
|
22
23
|
as: isDisabled ? 'button' : as,
|
|
23
24
|
icon: <Icon name={iconName} />,
|
|
@@ -26,7 +27,12 @@ const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
|
26
27
|
...rest,
|
|
27
28
|
};
|
|
28
29
|
return (
|
|
29
|
-
<Tooltip
|
|
30
|
+
<Tooltip
|
|
31
|
+
closeDelay={tooltipCloseDelay}
|
|
32
|
+
isDisabled={isTooltipDisabled}
|
|
33
|
+
label={label || rest['aria-label']}
|
|
34
|
+
shouldWrapChildren={isDisabled}
|
|
35
|
+
>
|
|
30
36
|
<ChakraIconButton {...properties} ref={ref} />
|
|
31
37
|
</Tooltip>
|
|
32
38
|
);
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { forwardRef } from '@chakra-ui/react';
|
|
3
|
+
import Badge from '../Badge/Badge';
|
|
4
|
+
import Box from '../Box/Box';
|
|
5
|
+
import Button, { ButtonProps } from '../Button/Button';
|
|
6
|
+
import ButtonGroup from '../ButtonGroup/ButtonGroup';
|
|
4
7
|
import IconButton from '../IconButton/IconButton';
|
|
8
|
+
import Link from '../Link/Link';
|
|
9
|
+
import Icon from '../Icon/Icon';
|
|
5
10
|
import Menu from './Menu';
|
|
11
|
+
import MenuButton from './MenuButton';
|
|
12
|
+
import MenuList from './MenuList';
|
|
6
13
|
import MenuItem from './MenuItem';
|
|
7
14
|
|
|
8
15
|
export default {
|
|
9
|
-
title: 'Components/Menu
|
|
16
|
+
title: 'Components/Menu',
|
|
10
17
|
component: Menu,
|
|
11
18
|
subcomponents: { MenuButton, MenuList, MenuItem },
|
|
12
19
|
} as ComponentMeta<typeof Menu>;
|
|
13
20
|
|
|
14
21
|
const List = () => (
|
|
15
22
|
<MenuList>
|
|
16
|
-
<MenuItem iconName="
|
|
17
|
-
<MenuItem
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<MenuItem iconName="
|
|
23
|
+
<MenuItem iconName="Download">Download</MenuItem>
|
|
24
|
+
<MenuItem as="a" href="#" iconName="Link">
|
|
25
|
+
As a link
|
|
26
|
+
</MenuItem>
|
|
27
|
+
<MenuItem iconName="Pencil" isDisabled>
|
|
28
|
+
Disabled
|
|
29
|
+
</MenuItem>
|
|
30
|
+
<MenuItem iconName="DeleteNope" isDanger>
|
|
31
|
+
Danger version
|
|
32
|
+
</MenuItem>
|
|
21
33
|
</MenuList>
|
|
22
34
|
);
|
|
23
35
|
|
|
@@ -28,47 +40,51 @@ export const WithButton: ComponentStory<typeof Menu> = () => (
|
|
|
28
40
|
</Menu>
|
|
29
41
|
);
|
|
30
42
|
|
|
31
|
-
export const
|
|
43
|
+
export const WithLink: ComponentStory<typeof Menu> = () => (
|
|
32
44
|
<Menu>
|
|
33
|
-
<MenuButton as={
|
|
45
|
+
<MenuButton as={Link}>Open menu</MenuButton>
|
|
34
46
|
<List />
|
|
35
47
|
</Menu>
|
|
36
48
|
);
|
|
37
49
|
|
|
38
50
|
export const WithButtonGroup: ComponentStory<typeof Menu> = () => (
|
|
39
|
-
<
|
|
51
|
+
<Box display="flex" justifyContent="flex-end">
|
|
40
52
|
<ButtonGroup isAttached>
|
|
41
53
|
<Button>Button</Button>
|
|
42
54
|
<Menu>
|
|
43
|
-
<MenuButton as={IconButton} iconName="
|
|
55
|
+
<MenuButton as={IconButton} iconName="AddonsTuorqouise" aria-label="Open menu" isTooltipDisabled />
|
|
44
56
|
<List />
|
|
45
57
|
</Menu>
|
|
46
58
|
</ButtonGroup>
|
|
47
|
-
</
|
|
59
|
+
</Box>
|
|
48
60
|
);
|
|
49
61
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
const TriggerButton = forwardRef<ButtonProps, 'button'>((props, ref) => (
|
|
63
|
+
<Button gap="12" ref={ref} rightIconName="DropdownArrows" variant="secondary" {...props}>
|
|
64
|
+
<span>Attempt #3</span>
|
|
65
|
+
<Badge>Latest</Badge>
|
|
66
|
+
</Button>
|
|
67
|
+
));
|
|
53
68
|
|
|
69
|
+
export const WithCustomItems: ComponentStory<typeof Menu> = () => {
|
|
54
70
|
return (
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
<Menu>
|
|
72
|
+
<MenuButton as={TriggerButton} />
|
|
73
|
+
<MenuList>
|
|
74
|
+
<MenuItem>
|
|
75
|
+
<Box display="flex" alignItems="center" gap="8">
|
|
76
|
+
<Icon color="green.50" name="BuildstatusSuccessful" />
|
|
77
|
+
<span>Successful</span>
|
|
78
|
+
<Badge>Latest</Badge>
|
|
79
|
+
</Box>
|
|
80
|
+
</MenuItem>
|
|
81
|
+
<MenuItem>
|
|
82
|
+
<Box display="flex" alignItems="center" gap="8">
|
|
83
|
+
<Icon color="red.50" name="BuildstatusFailed" />
|
|
84
|
+
<span>Failed</span>
|
|
85
|
+
</Box>
|
|
86
|
+
</MenuItem>
|
|
87
|
+
</MenuList>
|
|
88
|
+
</Menu>
|
|
60
89
|
);
|
|
61
90
|
};
|
|
62
|
-
|
|
63
|
-
export const WithCustomListWIP: ComponentStory<typeof Menu> = () => (
|
|
64
|
-
<Menu>
|
|
65
|
-
<MenuButton as={Button}>Actions</MenuButton>
|
|
66
|
-
<MenuList>
|
|
67
|
-
<CustomItem />
|
|
68
|
-
<MenuItem iconName="AddonsTuorqouise">Create a Copy</MenuItem>
|
|
69
|
-
<MenuItem iconName="AddonsTuorqouise">Mark as Draft</MenuItem>
|
|
70
|
-
<MenuItem iconName="AddonsTuorqouise">Delete</MenuItem>
|
|
71
|
-
<MenuItem iconName="AddonsTuorqouise">Attend a Workshop</MenuItem>
|
|
72
|
-
</MenuList>
|
|
73
|
-
</Menu>
|
|
74
|
-
);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { SystemStyleObject } from '@chakra-ui/theme-tools';
|
|
2
2
|
|
|
3
|
+
const disabledItem: SystemStyleObject = {
|
|
4
|
+
_disabled: {
|
|
5
|
+
backgroundColor: 'neutral.100',
|
|
6
|
+
color: 'neutral.70',
|
|
7
|
+
cursor: 'not-allowed',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
|
|
3
11
|
const MenuTheme: SystemStyleObject = {
|
|
4
12
|
baseStyle: {
|
|
5
13
|
list: {
|
|
@@ -18,10 +26,13 @@ const MenuTheme: SystemStyleObject = {
|
|
|
18
26
|
_focus: {
|
|
19
27
|
backgroundColor: 'neutral.93',
|
|
20
28
|
boxShadow: 'none',
|
|
29
|
+
...disabledItem,
|
|
21
30
|
},
|
|
22
31
|
_active: {
|
|
23
32
|
backgroundColor: 'neutral.90',
|
|
33
|
+
...disabledItem,
|
|
24
34
|
},
|
|
35
|
+
...disabledItem,
|
|
25
36
|
},
|
|
26
37
|
},
|
|
27
38
|
};
|
|
@@ -3,6 +3,6 @@ import { Menu as ChakraMenu, MenuProps as ChakraMenuProps } from '@chakra-ui/rea
|
|
|
3
3
|
|
|
4
4
|
export type MenuProps = ChakraMenuProps;
|
|
5
5
|
|
|
6
|
-
const Menu = (props: MenuProps) => <ChakraMenu {...props} />;
|
|
6
|
+
const Menu = (props: MenuProps) => <ChakraMenu matchWidth {...props} />;
|
|
7
7
|
|
|
8
8
|
export default Menu;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuButton as ChakraMenuButton, MenuButtonProps as ChakraMenuButtonProps, forwardRef } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export type MenuButtonProps = ChakraMenuButtonProps;
|
|
5
|
+
|
|
6
|
+
const MenuButton = forwardRef<MenuButtonProps, 'button'>((props, ref) => {
|
|
7
|
+
return <ChakraMenuButton {...props} ref={ref} />;
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default MenuButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuItem as ChakraMenuItem, MenuItemProps } from '@chakra-ui/react';
|
|
2
|
+
import { MenuItem as ChakraMenuItem, MenuItemProps as ChakraMenuItemProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
import { Icon, TypeIconName } from '@bitrise/bitkit';
|
|
4
4
|
|
|
5
5
|
const dangerStyle = {
|
|
@@ -13,22 +13,28 @@ const dangerStyle = {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
iconName
|
|
16
|
+
export interface MenuItemProps extends ChakraMenuItemProps {
|
|
17
|
+
as?: 'a' | 'button';
|
|
18
|
+
iconName?: TypeIconName;
|
|
19
19
|
isDanger?: boolean;
|
|
20
|
-
|
|
21
|
-
};
|
|
20
|
+
}
|
|
22
21
|
|
|
23
|
-
const MenuItem = (props
|
|
24
|
-
const { iconName, isDanger, ...rest } = props;
|
|
25
|
-
const properties:
|
|
26
|
-
|
|
27
|
-
icon: <Icon name={iconName} />,
|
|
22
|
+
const MenuItem = forwardRef<MenuItemProps, 'button'>((props, ref) => {
|
|
23
|
+
const { as, iconName, isDanger, isDisabled, ...rest } = props;
|
|
24
|
+
const properties: ChakraMenuItemProps = {
|
|
25
|
+
as: isDisabled ? 'button' : as,
|
|
28
26
|
iconSpacing: '12',
|
|
29
|
-
|
|
27
|
+
isDisabled,
|
|
28
|
+
...rest,
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
if (iconName) {
|
|
31
|
+
properties.icon = <Icon name={iconName} />;
|
|
32
|
+
}
|
|
33
|
+
// There is no variant for MenuItem
|
|
34
|
+
if (isDanger) {
|
|
35
|
+
properties.sx = dangerStyle;
|
|
36
|
+
}
|
|
37
|
+
return <ChakraMenuItem {...properties} ref={ref} />;
|
|
38
|
+
});
|
|
33
39
|
|
|
34
40
|
export default MenuItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuList as ChakraMenuList, MenuListProps as ChakraMenuListProps, forwardRef } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export type MenuListProps = ChakraMenuListProps;
|
|
5
|
+
|
|
6
|
+
const MenuList = forwardRef<MenuListProps, 'div'>((props, ref) => {
|
|
7
|
+
return <ChakraMenuList {...props} ref={ref} />;
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default MenuList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Flex } from '@chakra-ui/react';
|
|
2
1
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Box from '../Box/Box';
|
|
3
3
|
import OverflowMenu from './OverflowMenu';
|
|
4
4
|
import OverflowMenuItem from './OverflowMenuItem';
|
|
5
5
|
|
|
@@ -9,26 +9,21 @@ export default {
|
|
|
9
9
|
} as ComponentMeta<typeof OverflowMenu>;
|
|
10
10
|
|
|
11
11
|
export const WithProps: ComponentStory<typeof OverflowMenu> = (props) => (
|
|
12
|
-
<
|
|
12
|
+
<Box display="flex" flexDirection="column" alignItems="flex-end" minHeight="400px">
|
|
13
13
|
<OverflowMenu {...props}>
|
|
14
14
|
<OverflowMenuItem iconName="PlusAdd">Add member</OverflowMenuItem>
|
|
15
15
|
<OverflowMenuItem iconName="MinusRemove">Remove member</OverflowMenuItem>
|
|
16
|
-
<OverflowMenuItem iconName="
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
<OverflowMenuItem as="a" iconName="Link" href="#">
|
|
17
|
+
As a link
|
|
18
|
+
</OverflowMenuItem>
|
|
19
|
+
<OverflowMenuItem iconName="Pencil" isDisabled>
|
|
20
|
+
Disabled item
|
|
20
21
|
</OverflowMenuItem>
|
|
21
|
-
</OverflowMenu>
|
|
22
|
-
<OverflowMenu {...props}>
|
|
23
|
-
<OverflowMenuItem iconName="PlusAdd">Add member</OverflowMenuItem>
|
|
24
|
-
<OverflowMenuItem iconName="MinusRemove">Remove member</OverflowMenuItem>
|
|
25
|
-
<OverflowMenuItem iconName="Filter">Assign access to apps</OverflowMenuItem>
|
|
26
|
-
<OverflowMenuItem iconName="Pencil">Rename group</OverflowMenuItem>
|
|
27
22
|
<OverflowMenuItem iconName="Trash" isDanger>
|
|
28
|
-
|
|
23
|
+
Danger version
|
|
29
24
|
</OverflowMenuItem>
|
|
30
25
|
</OverflowMenu>
|
|
31
|
-
</
|
|
26
|
+
</Box>
|
|
32
27
|
);
|
|
33
28
|
WithProps.args = {
|
|
34
29
|
...OverflowMenu.defaultProps,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuButton, MenuList, MenuListProps } from '@chakra-ui/react';
|
|
3
2
|
import IconButton from '../IconButton/IconButton';
|
|
4
|
-
import Menu from '../Menu/Menu';
|
|
3
|
+
import Menu, { MenuProps } from '../Menu/Menu';
|
|
4
|
+
import MenuButton from '../Menu/MenuButton';
|
|
5
|
+
import MenuList, { MenuListProps } from '../Menu/MenuList';
|
|
5
6
|
|
|
6
|
-
export interface OverflowMenuProps {
|
|
7
|
+
export interface OverflowMenuProps extends MenuProps {
|
|
7
8
|
children: MenuListProps['children'];
|
|
8
9
|
triggerLabel?: string;
|
|
9
10
|
}
|
|
@@ -11,7 +12,14 @@ export interface OverflowMenuProps {
|
|
|
11
12
|
const OverflowMenu = ({ children, triggerLabel }: OverflowMenuProps) => {
|
|
12
13
|
return (
|
|
13
14
|
<Menu isLazy>
|
|
14
|
-
<MenuButton
|
|
15
|
+
<MenuButton
|
|
16
|
+
aria-label={triggerLabel}
|
|
17
|
+
as={IconButton}
|
|
18
|
+
iconName="MoreVertical"
|
|
19
|
+
isTooltipDisabled
|
|
20
|
+
size="small"
|
|
21
|
+
variant="tertiary"
|
|
22
|
+
/>
|
|
15
23
|
<MenuList>{children}</MenuList>
|
|
16
24
|
</Menu>
|
|
17
25
|
);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { forwardRef } from '@chakra-ui/react';
|
|
3
|
+
import MenuItem, { MenuItemProps } from '../Menu/MenuItem';
|
|
3
4
|
|
|
4
5
|
export interface OverflowMenuItemProps extends MenuItemProps {
|
|
5
6
|
children: MenuItemProps['children'];
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
const OverflowMenuItem = (props
|
|
9
|
-
return <MenuItem {...props} />;
|
|
10
|
-
};
|
|
9
|
+
const OverflowMenuItem = forwardRef<OverflowMenuItemProps, 'button'>((props, ref) => {
|
|
10
|
+
return <MenuItem {...props} ref={ref} />;
|
|
11
|
+
});
|
|
11
12
|
|
|
12
13
|
export default OverflowMenuItem;
|
|
@@ -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,
|