@bitrise/bitkit 9.13.0-alpha-button-release.4 → 9.13.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "9.13.0-alpha-button-release.4",
4
+ "version": "9.13.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -76,6 +76,7 @@
76
76
  "@types/cheerio": "^0.22.31",
77
77
  "@types/clipboard": "^2.0.1",
78
78
  "@types/enzyme": "^3.10.12",
79
+ "@types/fscreen": "^1.0.1",
79
80
  "@types/jest": "^27.5.0",
80
81
  "@types/lodash.sample": "^4.2.7",
81
82
  "@types/lodash.shuffle": "^4.2.7",
@@ -1,18 +1,44 @@
1
1
  import { ComponentStory, ComponentMeta } from '@storybook/react';
2
- import { sortObjectByKey } from '../../utils/storyUtils';
2
+ import Divider from '../Divider/Divider';
3
3
  import Card from './Card';
4
+ import CardContent from './CardContent';
4
5
 
5
6
  export default {
6
7
  title: 'Components/Card',
7
8
  component: Card,
9
+ subcomponents: { CardContent },
8
10
  } as ComponentMeta<typeof Card>;
9
11
 
10
- const Template: ComponentStory<typeof Card> = (props) => <Card {...props} />;
12
+ export const WithProps: ComponentStory<typeof Card> = ({ contentProps, ...props }) => (
13
+ <Card {...props}>
14
+ <CardContent {...contentProps}>The quick brown fox jumps over the lazy dog.</CardContent>
15
+ </Card>
16
+ );
11
17
 
12
- export const WithProps = Template.bind({});
18
+ WithProps.args = {
19
+ ...Card.defaultProps,
20
+ boxShadow: 'medium',
21
+ className: '',
22
+ withBorder: false,
23
+ contentProps: {
24
+ padding: '24',
25
+ },
26
+ };
27
+
28
+ export const DividedContent: ComponentStory<typeof Card> = ({ contentProps, ...props }) => (
29
+ <Card {...props}>
30
+ <CardContent {...contentProps}>The quick brown fox jumps over the lazy dog.</CardContent>
31
+ <Divider />
32
+ <CardContent {...contentProps}>The quick brown fox jumps over the lazy dog.</CardContent>
33
+ </Card>
34
+ );
13
35
 
14
- WithProps.args = sortObjectByKey({
36
+ DividedContent.args = {
15
37
  ...Card.defaultProps,
16
- children: 'The quick brown fox jumps over the lazy dog.',
38
+ boxShadow: 'medium',
17
39
  className: '',
18
- });
40
+ withBorder: false,
41
+ contentProps: {
42
+ padding: '24',
43
+ },
44
+ };
@@ -0,0 +1,9 @@
1
+ const CardTheme = {
2
+ baseStyle: {
3
+ _focusVisible: {
4
+ boxShadow: 'outline',
5
+ },
6
+ },
7
+ };
8
+
9
+ export default CardTheme;
@@ -1,27 +1,47 @@
1
+ /* eslint-disable no-underscore-dangle */
1
2
  import React from 'react';
2
- import { forwardRef } from '@chakra-ui/react';
3
+ import { forwardRef, HTMLChakraProps, useStyleConfig } from '@chakra-ui/react';
3
4
  import { Radii } from '../../Foundations/Radii/Radii';
4
5
  import { Shadows } from '../../Foundations/Shadows/Shadows';
5
- import { Sizes } from '../../Foundations/Sizes/Sizes';
6
6
  import Box, { BoxProps } from '../Box/Box';
7
7
 
8
8
  export interface CardProps extends BoxProps {
9
9
  borderRadius?: keyof Radii;
10
10
  boxShadow?: keyof Shadows;
11
- padding?: keyof Sizes;
11
+ withBorder?: boolean;
12
12
  }
13
13
 
14
14
  /**
15
- * Basic container element with default box shadow, border radius and padding.
15
+ * Basic container element with default box shadow and border radius. Use with `CardContent` to add padding.
16
16
  */
17
17
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
18
- return <Box {...props} ref={ref} />;
18
+ const { withBorder, ...rest } = props;
19
+ const css = useStyleConfig('Card');
20
+
21
+ const properties = {
22
+ backgroundColor: 'white',
23
+ display: 'block',
24
+ width: '100%',
25
+ ...rest,
26
+ } as BoxProps;
27
+ if (withBorder) {
28
+ properties.border = '1px solid';
29
+ properties.borderColor = 'neutral.93';
30
+ }
31
+ if (props.as === 'button' && !(props as HTMLChakraProps<'button'>).type) {
32
+ (properties as HTMLChakraProps<'button'>).type = 'button';
33
+ }
34
+ if (props.as === 'a' || props.as === 'button') {
35
+ properties._hover = {
36
+ boxShadow: '0 0 0px 2px var(--colors-purple-50)',
37
+ };
38
+ }
39
+ return <Box __css={css} {...properties} ref={ref} />;
19
40
  });
20
41
 
21
42
  Card.defaultProps = {
22
- borderRadius: '12',
23
- boxShadow: 'medium',
24
- padding: '24',
43
+ as: 'div',
44
+ borderRadius: '8',
25
45
  } as CardProps;
26
46
 
27
47
  export default Card;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import Box, { BoxProps } from '../Box/Box';
3
+
4
+ export type CardContentProps = BoxProps;
5
+
6
+ /**
7
+ * Basic container element with default box shadow, border radius and padding.
8
+ */
9
+ const CardContent = (props: CardContentProps) => {
10
+ return <Box {...props} />;
11
+ };
12
+
13
+ CardContent.defaultProps = {} as CardContentProps;
14
+
15
+ export default CardContent;
@@ -34,7 +34,7 @@ const DesignTokens = () => {
34
34
  plugin called “Theemo”.
35
35
  </Text>
36
36
  </Box>
37
- <Card sx={{ marginBottom: '96' }}>
37
+ <Card boxShadow="medium" marginBottom="96" padding="24">
38
38
  <VStack align="flex-start" as="ul" spacing="32">
39
39
  {Object.keys(TOKENS).map((token: string) => (
40
40
  <HStack as="li" key={token} spacing="32">
@@ -76,7 +76,7 @@ const Palette = () => (
76
76
  <Text as="h2" size="8">
77
77
  Full palette
78
78
  </Text>
79
- <Card sx={{ marginTop: '24' }}>
79
+ <Card boxShadow="medium" marginTop="24" padding="24">
80
80
  <HStack spacing="0" sx={{ alignItems: 'flex-start', marginBottom: '16' }}>
81
81
  <VStack spacing="0">
82
82
  <InfoHeader
@@ -1,6 +1,7 @@
1
1
  import { HStack, VStack } from '@chakra-ui/react';
2
2
  import Box from '../../Components/Box/Box';
3
3
  import Card from '../../Components/Card/Card';
4
+ import CardContent from '../../Components/Card/CardContent';
4
5
  import Provider from '../../Components/Provider/Provider';
5
6
  import Text from '../../Components/Text/Text';
6
7
  import radii from './Radii';
@@ -10,27 +11,15 @@ export const Radii = () => (
10
11
  <Text as="h2" size="8">
11
12
  Radii (round corners)
12
13
  </Text>
13
- <HStack
14
- as={Card}
15
- spacing="24"
16
- sx={{
17
- marginTop: '24',
18
- }}
19
- >
20
- {Object.keys(radii).map((size) => (
21
- <VStack key={size}>
22
- <Box
23
- sx={{
24
- border: '0.1875rem solid',
25
- borderColor: 'brand.primary',
26
- borderRadius: size,
27
- height: '64',
28
- width: '64',
29
- }}
30
- />
31
- <Text>{size}</Text>
32
- </VStack>
33
- ))}
34
- </HStack>
14
+ <Card boxShadow="medium" marginTop="24">
15
+ <HStack as={CardContent} padding="24" spacing="24">
16
+ {Object.keys(radii).map((size) => (
17
+ <VStack key={size}>
18
+ <Box border="0.1875rem solid" borderColor="brand.primary" borderRadius={size} height="64" width="64" />
19
+ <Text>{size}</Text>
20
+ </VStack>
21
+ ))}
22
+ </HStack>
23
+ </Card>
35
24
  </Provider>
36
25
  );
@@ -10,25 +10,15 @@ export const Shadows = () => (
10
10
  <Text as="h2" size="8">
11
11
  Shadows
12
12
  </Text>
13
- <HStack
14
- as={Card}
15
- spacing="32"
16
- sx={{
17
- marginTop: '24',
18
- }}
19
- >
20
- {Object.keys(shadows).map((key) => (
21
- <VStack key={key}>
22
- <Box
23
- sx={{
24
- width: 32,
25
- height: 32,
26
- boxShadow: key,
27
- }}
28
- />
29
- <Text>{key}</Text>
30
- </VStack>
31
- ))}
32
- </HStack>
13
+ <Card boxShadow="medium" marginTop="24">
14
+ <HStack as={Card} padding="24" spacing="32">
15
+ {Object.keys(shadows).map((key) => (
16
+ <VStack key={key}>
17
+ <Box boxShadow={key} height="32" width="32" />
18
+ <Text as="span">{key}</Text>
19
+ </VStack>
20
+ ))}
21
+ </HStack>
22
+ </Card>
33
23
  </Provider>
34
24
  );
@@ -1,6 +1,7 @@
1
1
  import { HStack, VStack } from '@chakra-ui/react';
2
2
  import Box from '../../Components/Box/Box';
3
3
  import Card from '../../Components/Card/Card';
4
+ import CardContent from '../../Components/Card/CardContent';
4
5
  import Provider from '../../Components/Provider/Provider';
5
6
  import Text from '../../Components/Text/Text';
6
7
  import sizes from './Sizes';
@@ -10,26 +11,15 @@ export const Sizes = () => (
10
11
  <Text as="h2" size="8">
11
12
  Sizes
12
13
  </Text>
13
- <HStack
14
- as={Card}
15
- spacing="24"
16
- sx={{
17
- alignItems: 'flex-end',
18
- marginTop: '24',
19
- }}
20
- >
21
- {Object.keys(sizes).map((size) => (
22
- <VStack key={size}>
23
- <Box
24
- sx={{
25
- width: size,
26
- height: size,
27
- background: 'brand.primary',
28
- }}
29
- />
30
- <Text>{size}</Text>
31
- </VStack>
32
- ))}
33
- </HStack>
14
+ <Card boxShadow="medium" marginTop="24">
15
+ <HStack as={CardContent} alignItems="flex-end" padding="24" spacing="24">
16
+ {Object.keys(sizes).map((size) => (
17
+ <VStack key={size}>
18
+ <Box backgroundColor="brand.primary" height={size} width={size} />
19
+ <Text>{size}</Text>
20
+ </VStack>
21
+ ))}
22
+ </HStack>
23
+ </Card>
34
24
  </Provider>
35
25
  );
@@ -31,7 +31,7 @@ export const FontSizes = () => (
31
31
  <Text sx={{ marginTop: '8' }}>
32
32
  <strong>Text transform:</strong> None, UPPERCASE
33
33
  </Text>
34
- <Card sx={{ marginTop: '24' }}>
34
+ <Card boxShadow="medium" marginTop="24" padding="24">
35
35
  <VStack as="ol" spacing={24} sx={style}>
36
36
  <Text as="li" size="1">
37
37
  {typography.fontSizes[1]} / {typography.lineHeights[1]} / Normal / Uppercase
package/src/index.ts CHANGED
@@ -22,3 +22,9 @@ export { default as Button } from './Components/Button/Button';
22
22
 
23
23
  export type { ButtonGroupProps } from './Components/ButtonGroup/ButtonGroup';
24
24
  export { default as ButtonGroup } from './Components/ButtonGroup/ButtonGroup';
25
+
26
+ export type { CardProps } from './Components/Card/Card';
27
+ export { default as Card } from './Components/Card/Card';
28
+
29
+ export type { CardContentProps } from './Components/Card/CardContent';
30
+ export { default as CardContent } from './Components/Card/CardContent';
package/src/old.ts CHANGED
@@ -49,18 +49,6 @@ export { default as Base } from './Old/Base/Base';
49
49
  export type { Props as BoundsProps } from './Old/Bounds/Bounds';
50
50
  export { default as Bounds } from './Old/Bounds/Bounds';
51
51
 
52
- export type { Props as CardProps } from './Old/Card/Card';
53
- export { default as Card } from './Old/Card/Card';
54
-
55
- export type { Props as CardButtonProps } from './Old/Card/CardButton';
56
- export { default as CardButton } from './Old/Card/CardButton';
57
-
58
- export type { Props as CardContentProps } from './Old/Card/CardContent';
59
- export { default as CardContent } from './Old/Card/CardContent';
60
-
61
- export type { Props as CardDividerProps } from './Old/Card/CardDivider';
62
- export { default as CardDivider } from './Old/Card/CardDivider';
63
-
64
52
  export type { Props as CheckboxProps } from './Old/Checkbox/Checkbox';
65
53
  export { default as Checkbox } from './Old/Checkbox/Checkbox';
66
54
 
package/src/theme.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Button from './Components/Button/Button.theme';
2
+ import Card from './Components/Card/Card.theme';
2
3
  import Divider from './Components/Divider/Divider.theme';
3
4
  import Link from './Components/Link/Link.theme';
4
5
  import Menu from './Components/Menu/Menu.theme';
@@ -45,6 +46,7 @@ const theme = {
45
46
  },
46
47
  components: {
47
48
  Button,
49
+ Card,
48
50
  Divider,
49
51
  Link,
50
52
  Menu,