@bitrise/bitkit 9.30.0 → 9.33.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 +1 -1
- package/src/Components/Dialog/Dialog.theme.ts +11 -0
- package/src/Components/Dialog/Dialog.tsx +2 -2
- package/src/Components/Popover/Popover.stories.tsx +19 -0
- package/src/Components/Popover/Popover.theme.ts +15 -0
- package/src/Components/Popover/Popover.tsx +7 -0
- package/src/Components/Popover/PopoverContent.tsx +13 -0
- package/src/Components/Popover/PopoverTrigger.tsx +6 -0
- package/src/Components/Select/Select.stories.tsx +38 -0
- package/src/Components/Select/Select.tsx +20 -7
- package/src/theme.ts +2 -0
- package/src/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -59,6 +59,17 @@ const DialogTheme: SystemStyleObject = {
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
full: {
|
|
62
|
+
dialog: {
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
margin: '0',
|
|
65
|
+
width: 'auto',
|
|
66
|
+
left: '32',
|
|
67
|
+
right: '32',
|
|
68
|
+
top: '32',
|
|
69
|
+
bottom: '32',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
mobile: {
|
|
62
73
|
dialog: {
|
|
63
74
|
maxW: '100vw',
|
|
64
75
|
minH: '100vh',
|
|
@@ -28,13 +28,13 @@ export const useDialog = (): DialogState => {
|
|
|
28
28
|
export interface DialogProps {
|
|
29
29
|
children: ReactNode;
|
|
30
30
|
dataTestid?: string;
|
|
31
|
-
size?: 'small' | 'medium' | 'large';
|
|
31
|
+
size?: 'small' | 'medium' | 'large' | 'full';
|
|
32
32
|
state: DialogState;
|
|
33
33
|
title: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const Dialog = ({ children, dataTestid, state, size, title }: DialogProps) => {
|
|
37
|
-
const dialogSize = useBreakpointValue({ mobile: '
|
|
37
|
+
const dialogSize = useBreakpointValue({ mobile: 'mobile', desktop: size });
|
|
38
38
|
return (
|
|
39
39
|
<Modal closeOnOverlayClick={false} isOpen={state.isOpen} onClose={state.onClose} size={dialogSize}>
|
|
40
40
|
<ModalOverlay />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
import Button from '../Button/Button';
|
|
3
|
+
import Popover from './Popover';
|
|
4
|
+
import PopoverTrigger from './PopoverTrigger';
|
|
5
|
+
import PopoverContent from './PopoverContent';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Popover',
|
|
9
|
+
component: Popover,
|
|
10
|
+
} as ComponentMeta<typeof Popover>;
|
|
11
|
+
|
|
12
|
+
export const Default: ComponentStory<typeof Popover> = () => (
|
|
13
|
+
<Popover>
|
|
14
|
+
<PopoverTrigger>
|
|
15
|
+
<Button>Open popover</Button>
|
|
16
|
+
</PopoverTrigger>
|
|
17
|
+
<PopoverContent>Test content</PopoverContent>
|
|
18
|
+
</Popover>
|
|
19
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SystemStyleObject } from '@chakra-ui/theme-tools';
|
|
2
|
+
|
|
3
|
+
const PopoverTheme: SystemStyleObject = {
|
|
4
|
+
baseStyle: {
|
|
5
|
+
content: {
|
|
6
|
+
backgroundColor: 'neutral.100',
|
|
7
|
+
borderRadius: 8,
|
|
8
|
+
boxShadow: 'large',
|
|
9
|
+
py: 24,
|
|
10
|
+
px: 32,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default PopoverTheme;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
PopoverContentProps as ChakraPopoverContentProps,
|
|
4
|
+
PopoverContent as ChakraPopoverContent,
|
|
5
|
+
} from '@chakra-ui/react';
|
|
6
|
+
|
|
7
|
+
export interface PopoverContentProps extends ChakraPopoverContentProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const PopoverContent = (props: PopoverContentProps) => <ChakraPopoverContent {...props} />;
|
|
12
|
+
|
|
13
|
+
export default PopoverContent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
1
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
3
|
import { sortObjectByKey } from '../../utils/storyUtils';
|
|
3
4
|
import Select from './Select';
|
|
@@ -36,3 +37,40 @@ WithProps.args = sortObjectByKey({
|
|
|
36
37
|
...args,
|
|
37
38
|
placeholder: 'Select build status',
|
|
38
39
|
});
|
|
40
|
+
|
|
41
|
+
export const Controlled = () => {
|
|
42
|
+
const [value, setValue] = useState<string | undefined>(undefined);
|
|
43
|
+
return (
|
|
44
|
+
<Select w="300px" placeholder="Test holder" value={value} onChange={({ target: { value: val } }) => setValue(val)}>
|
|
45
|
+
{children}
|
|
46
|
+
</Select>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const WithLoading = () => (
|
|
51
|
+
<>
|
|
52
|
+
<Select w="300px" isDisabled placeholder="Test holder">
|
|
53
|
+
{children}
|
|
54
|
+
</Select>
|
|
55
|
+
<Select w="300px" isLoading>
|
|
56
|
+
{children}
|
|
57
|
+
</Select>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export const WithLoadingOnChange = () => {
|
|
62
|
+
const [loading, setLoading] = useState(false);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Select
|
|
66
|
+
w="240px"
|
|
67
|
+
isLoading={loading}
|
|
68
|
+
onChange={() => {
|
|
69
|
+
setLoading(true);
|
|
70
|
+
setTimeout(() => setLoading(false), 3000);
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{children}
|
|
74
|
+
</Select>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
import { Select as ChakraSelect, SelectProps as ChakraSelectProps } from '@chakra-ui/react';
|
|
1
|
+
import { forwardRef, Select as ChakraSelect, SelectProps as ChakraSelectProps, Spinner } from '@chakra-ui/react';
|
|
2
2
|
import Icon from '../Icon/Icon';
|
|
3
3
|
|
|
4
4
|
export interface SelectProps extends ChakraSelectProps {
|
|
5
5
|
size?: 'small' | 'medium';
|
|
6
|
+
isLoading?: boolean;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
const Select = (props
|
|
9
|
-
const { size, placeholder, children, ...rest } = props;
|
|
9
|
+
const Select = forwardRef<SelectProps, 'select'>((props, ref) => {
|
|
10
|
+
const { size, placeholder, children, isDisabled, isLoading, ...rest } = props;
|
|
10
11
|
const iconSize = size === 'medium' ? '24' : '16';
|
|
11
12
|
const properties: ChakraSelectProps = {
|
|
12
|
-
icon:
|
|
13
|
+
icon: isLoading ? (
|
|
14
|
+
<Spinner width={iconSize} height={iconSize} marginEnd="4" />
|
|
15
|
+
) : (
|
|
16
|
+
<Icon name="DropdownArrows" fontSize={iconSize} size={iconSize} />
|
|
17
|
+
),
|
|
18
|
+
isDisabled: isLoading || isDisabled,
|
|
13
19
|
size,
|
|
14
20
|
variant: 'select',
|
|
15
21
|
...rest,
|
|
16
22
|
};
|
|
23
|
+
if (placeholder) {
|
|
24
|
+
if ('value' in properties) {
|
|
25
|
+
properties.value = properties.value || '';
|
|
26
|
+
} else {
|
|
27
|
+
properties.defaultValue = '';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
17
30
|
return (
|
|
18
|
-
<ChakraSelect {...properties}>
|
|
31
|
+
<ChakraSelect ref={ref} {...properties}>
|
|
19
32
|
{placeholder && (
|
|
20
|
-
<option
|
|
33
|
+
<option hidden disabled value="">
|
|
21
34
|
{placeholder}
|
|
22
35
|
</option>
|
|
23
36
|
)}
|
|
24
37
|
{children}
|
|
25
38
|
</ChakraSelect>
|
|
26
39
|
);
|
|
27
|
-
};
|
|
40
|
+
});
|
|
28
41
|
|
|
29
42
|
Select.defaultProps = {
|
|
30
43
|
size: 'medium',
|
package/src/theme.ts
CHANGED
|
@@ -13,6 +13,7 @@ import Text from './Components/Text/Text.theme';
|
|
|
13
13
|
import Notification from './Components/Notification/Notification.theme';
|
|
14
14
|
import Tooltip from './Components/Tooltip/Tooltip.theme';
|
|
15
15
|
import CloseButton from './Components/CloseButton/CloseButton.theme';
|
|
16
|
+
import Popover from './Components/Popover/Popover.theme';
|
|
16
17
|
|
|
17
18
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
18
19
|
import colors from './Foundations/Colors/Colors';
|
|
@@ -71,6 +72,7 @@ const theme = {
|
|
|
71
72
|
Tooltip,
|
|
72
73
|
Alert: Notification,
|
|
73
74
|
CloseButton,
|
|
75
|
+
Popover,
|
|
74
76
|
},
|
|
75
77
|
};
|
|
76
78
|
|