@bitrise/bitkit 9.12.0 → 9.12.1-alpha-chakra.3

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.12.0",
4
+ "version": "9.12.1-alpha-chakra.3",
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,35 @@
1
1
  import { ComponentStory, ComponentMeta } from '@storybook/react';
2
2
  import { sortObjectByKey } from '../../utils/storyUtils';
3
+ import Divider from '../Divider/Divider';
3
4
  import Card from './Card';
5
+ import CardContent from './CardContent';
4
6
 
5
7
  export default {
6
8
  title: 'Components/Card',
7
9
  component: Card,
10
+ subcomponents: { CardContent },
8
11
  } as ComponentMeta<typeof Card>;
9
12
 
10
- const Template: ComponentStory<typeof Card> = (props) => <Card {...props} />;
11
-
12
- export const WithProps = Template.bind({});
13
+ export const WithProps: ComponentStory<typeof Card> = (props) => (
14
+ <Card {...props}>
15
+ <CardContent>The quick brown fox jumps over the lazy dog.</CardContent>
16
+ </Card>
17
+ );
13
18
 
14
19
  WithProps.args = sortObjectByKey({
15
20
  ...Card.defaultProps,
16
- children: 'The quick brown fox jumps over the lazy dog.',
21
+ className: '',
22
+ });
23
+
24
+ export const DividedContent: ComponentStory<typeof Card> = (props) => (
25
+ <Card {...props}>
26
+ <CardContent>The quick brown fox jumps over the lazy dog.</CardContent>
27
+ <Divider />
28
+ <CardContent>The quick brown fox jumps over the lazy dog.</CardContent>
29
+ </Card>
30
+ );
31
+
32
+ DividedContent.args = sortObjectByKey({
33
+ ...Card.defaultProps,
17
34
  className: '',
18
35
  });
@@ -1,27 +1,34 @@
1
1
  import React from 'react';
2
- import { forwardRef } from '@chakra-ui/react';
2
+ import { forwardRef, HTMLChakraProps } from '@chakra-ui/react';
3
3
  import { Radii } from '../../Foundations/Radii/Radii';
4
4
  import { Shadows } from '../../Foundations/Shadows/Shadows';
5
- import { Sizes } from '../../Foundations/Sizes/Sizes';
6
5
  import Box, { BoxProps } from '../Box/Box';
7
6
 
8
7
  export interface CardProps extends BoxProps {
9
8
  borderRadius?: keyof Radii;
10
9
  boxShadow?: keyof Shadows;
11
- padding?: keyof Sizes;
12
10
  }
13
11
 
14
12
  /**
15
- * Basic container element with default box shadow, border radius and padding.
13
+ * Basic container element with default box shadow and border radius. Use with `CardContent` to add padding.
16
14
  */
17
15
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
18
- return <Box {...props} ref={ref} />;
16
+ const properties = {
17
+ backgroundColor: 'white',
18
+ display: 'block',
19
+ width: '100%',
20
+ ...props,
21
+ } as BoxProps;
22
+ if (props.as === 'button' && !(props as HTMLChakraProps<'button'>).type) {
23
+ (properties as HTMLChakraProps<'button'>).type = 'button';
24
+ }
25
+ return <Box {...properties} ref={ref} />;
19
26
  });
20
27
 
21
28
  Card.defaultProps = {
22
- borderRadius: '12',
23
- boxShadow: 'medium',
24
- padding: '24',
29
+ as: 'div',
30
+ borderRadius: '8',
31
+ boxShadow: 'small',
25
32
  } as CardProps;
26
33
 
27
34
  export default Card;
@@ -0,0 +1,17 @@
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 = {
14
+ padding: '24',
15
+ } as CardContentProps;
16
+
17
+ 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 marginBottom="96">
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 marginTop="24">
80
80
  <HStack spacing="0" sx={{ alignItems: 'flex-start', marginBottom: '16' }}>
81
81
  <VStack spacing="0">
82
82
  <InfoHeader
@@ -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 marginTop="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
@@ -55,18 +55,6 @@ export { default as Button } from './Old/Button/Button';
55
55
  export type { Props as ButtonsProps } from './Old/Button/Buttons';
56
56
  export { default as Buttons } from './Old/Button/Buttons';
57
57
 
58
- export type { Props as CardProps } from './Old/Card/Card';
59
- export { default as Card } from './Old/Card/Card';
60
-
61
- export type { Props as CardButtonProps } from './Old/Card/CardButton';
62
- export { default as CardButton } from './Old/Card/CardButton';
63
-
64
- export type { Props as CardContentProps } from './Old/Card/CardContent';
65
- export { default as CardContent } from './Old/Card/CardContent';
66
-
67
- export type { Props as CardDividerProps } from './Old/Card/CardDivider';
68
- export { default as CardDivider } from './Old/Card/CardDivider';
69
-
70
58
  export type { Props as CheckboxProps } from './Old/Checkbox/Checkbox';
71
59
  export { default as Checkbox } from './Old/Checkbox/Checkbox';
72
60
 
@@ -294,3 +282,9 @@ export { default as OverflowMenuItem } from './Components/OverflowMenu/OverflowM
294
282
 
295
283
  export type { DividerProps } from './Components/Divider/Divider';
296
284
  export { default as Divider } from './Components/Divider/Divider';
285
+
286
+ export type { CardProps } from './Components/Card/Card';
287
+ export { default as Card } from './Components/Card/Card';
288
+
289
+ export type { CardContentProps } from './Components/Card/CardContent';
290
+ export { default as CardContent } from './Components/Card/CardContent';