@bitrise/bitkit 9.39.0 → 9.39.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
|
@@ -3,6 +3,14 @@ const sizes = {
|
|
|
3
3
|
medium: { w: '32', h: '32' },
|
|
4
4
|
small: { w: '24', h: '24' },
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle
|
|
8
|
+
const _disabled = {
|
|
9
|
+
cursor: 'not-allowed',
|
|
10
|
+
opacity: '0.4',
|
|
11
|
+
background: 'transparent',
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
const CloseButtonTheme = {
|
|
7
15
|
baseStyle({
|
|
8
16
|
colorScheme,
|
|
@@ -19,6 +27,7 @@ const CloseButtonTheme = {
|
|
|
19
27
|
_hover: { bg: 'neutral.95' },
|
|
20
28
|
_active: { bg: 'neutral.90' },
|
|
21
29
|
...sizes[size],
|
|
30
|
+
_disabled,
|
|
22
31
|
};
|
|
23
32
|
}
|
|
24
33
|
return {
|
|
@@ -28,6 +37,7 @@ const CloseButtonTheme = {
|
|
|
28
37
|
_hover: { bg: `${colorScheme}.93` },
|
|
29
38
|
_active: { bg: `${colorScheme}.90` },
|
|
30
39
|
...sizes[size],
|
|
40
|
+
_disabled,
|
|
31
41
|
};
|
|
32
42
|
},
|
|
33
43
|
defaultProps: { colorScheme: 'neutral', size: 'small' },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Story, ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { useDisclosure } from '@chakra-ui/react';
|
|
3
|
+
import { sortObjectByKey } from '../../utils/storyUtils';
|
|
3
4
|
import Button from '../Button/Button';
|
|
4
5
|
import Dialog, { DialogProps } from './Dialog';
|
|
5
6
|
import DialogBody from './DialogBody';
|
|
@@ -50,10 +51,10 @@ export const WithProps: Story<StoryType> = ({ lotsOfContent, ...props }: StoryTy
|
|
|
50
51
|
);
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
WithProps.args = {
|
|
54
|
+
WithProps.args = sortObjectByKey({
|
|
54
55
|
...Dialog.defaultProps,
|
|
55
56
|
title: 'Title',
|
|
56
57
|
lotsOfContent: false,
|
|
57
58
|
dataTestid: 'test-modal',
|
|
58
59
|
trapFocus: false,
|
|
59
|
-
};
|
|
60
|
+
});
|
|
@@ -12,6 +12,7 @@ import Text from '../Text/Text';
|
|
|
12
12
|
|
|
13
13
|
export interface DialogProps extends Omit<HTMLChakraProps<'section'>, 'scrollBehavior'> {
|
|
14
14
|
dataTestid?: string;
|
|
15
|
+
isClosable?: boolean;
|
|
15
16
|
isOpen: boolean;
|
|
16
17
|
onClose(): void;
|
|
17
18
|
size?: 'small' | 'medium' | 'large' | 'full';
|
|
@@ -23,6 +24,7 @@ export interface DialogProps extends Omit<HTMLChakraProps<'section'>, 'scrollBeh
|
|
|
23
24
|
const Dialog = ({
|
|
24
25
|
children,
|
|
25
26
|
dataTestid,
|
|
27
|
+
isClosable,
|
|
26
28
|
isOpen,
|
|
27
29
|
onClose,
|
|
28
30
|
scrollBehavior,
|
|
@@ -34,9 +36,10 @@ const Dialog = ({
|
|
|
34
36
|
const dialogSize = useBreakpointValue({ mobile: 'mobile', desktop: size });
|
|
35
37
|
return (
|
|
36
38
|
<Modal
|
|
39
|
+
closeOnEsc={isClosable}
|
|
37
40
|
closeOnOverlayClick={false}
|
|
38
41
|
isOpen={isOpen}
|
|
39
|
-
onClose={onClose}
|
|
42
|
+
onClose={isClosable ? onClose : () => {}}
|
|
40
43
|
scrollBehavior={scrollBehavior}
|
|
41
44
|
size={dialogSize}
|
|
42
45
|
trapFocus={trapFocus}
|
|
@@ -48,7 +51,7 @@ const Dialog = ({
|
|
|
48
51
|
{title}
|
|
49
52
|
</Text>
|
|
50
53
|
</ModalHeader>
|
|
51
|
-
<ModalCloseButton>
|
|
54
|
+
<ModalCloseButton isDisabled={!isClosable}>
|
|
52
55
|
<Icon name="CloseSmall" />
|
|
53
56
|
</ModalCloseButton>
|
|
54
57
|
{children}
|
|
@@ -58,6 +61,7 @@ const Dialog = ({
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
Dialog.defaultProps = {
|
|
64
|
+
isClosable: true,
|
|
61
65
|
scrollBehavior: 'outside',
|
|
62
66
|
size: 'medium',
|
|
63
67
|
trapFocus: true,
|