@bitrise/bitkit 9.39.0 → 9.40.0-alpha-chakra.2

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.39.0",
4
+ "version": "9.40.0-alpha-chakra.2",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -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,
@@ -0,0 +1,15 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import Image from './Image';
3
+
4
+ export default {
5
+ title: 'Components/Image',
6
+ component: Image,
7
+ } as ComponentMeta<typeof Image>;
8
+
9
+ const Template: ComponentStory<typeof Image> = (props) => <Image {...props} />;
10
+
11
+ export const WithProps = Template.bind({});
12
+ WithProps.args = {
13
+ alt: 'Bitrise office',
14
+ src: 'bitrise_office.jpg',
15
+ };
@@ -0,0 +1,12 @@
1
+ import { Image as ChakraImage, ImageProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ /**
4
+ * The Image component is used to display images with support for fallback. (Default callback not implemented yet)
5
+ */
6
+ const Image = forwardRef<ImageProps, 'img'>((props, ref) => {
7
+ return <ChakraImage {...props} ref={ref} />;
8
+ });
9
+
10
+ export type { ImageProps };
11
+
12
+ export default Image;
package/src/index.ts CHANGED
@@ -129,3 +129,6 @@ export { default as Radio } from './Components/Form/Radio/Radio';
129
129
 
130
130
  export type { RadioGroupProps } from './Components/Form/Radio/RadioGroup';
131
131
  export { default as RadioGroup } from './Components/Form/Radio/RadioGroup';
132
+
133
+ export type { ImageProps } from './Components/Image/Image';
134
+ export { default as Image } from './Components/Image/Image';
package/src/old.ts CHANGED
@@ -79,9 +79,6 @@ export { default as Grid } from './Old/Grid/Grid';
79
79
  export type { Props as HamburgerProps } from './Old/Hamburger/Hamburger';
80
80
  export { default as Hamburger } from './Old/Hamburger/Hamburger';
81
81
 
82
- export type { Props as ImageProps } from './Old/Image/Image';
83
- export { default as Image } from './Old/Image/Image';
84
-
85
82
  export type { Props as InputProps } from './Old/Input/Input';
86
83
  export { default as Input } from './Old/Input/Input';
87
84