@bitrise/bitkit 12.29.1 → 12.30.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "12.29.1",
4
+ "version": "12.30.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -11,7 +11,7 @@ export interface CardProps extends BoxProps {
11
11
  }
12
12
 
13
13
  /**
14
- * Basic container element with default box shadow and border radius. Use with `CardContent` to add padding.
14
+ * Basic container element with default box shadow and border radius.
15
15
  */
16
16
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
17
17
  const { withBorder, variant, ...rest } = props;
@@ -1,8 +1,23 @@
1
- import { ChakraProvider, ChakraProviderProps } from '@chakra-ui/react';
1
+ import { ReactNode } from 'react';
2
+ import { ChakraProvider } from '@chakra-ui/react';
2
3
  import theme from '../../theme';
3
4
 
4
- const Provider = ({ children }: ChakraProviderProps) => {
5
- return <ChakraProvider theme={theme}>{children}</ChakraProvider>;
5
+ type ProviderProps = {
6
+ children: ReactNode;
7
+ toastOffset?: string;
8
+ };
9
+
10
+ const Provider = ({ children, toastOffset }: ProviderProps) => {
11
+ return (
12
+ <ChakraProvider
13
+ theme={theme}
14
+ toastOptions={{
15
+ defaultOptions: toastOffset ? { containerStyle: { transform: `translateY(${toastOffset})` } } : undefined,
16
+ }}
17
+ >
18
+ {children}
19
+ </ChakraProvider>
20
+ );
6
21
  };
7
22
 
8
23
  export default Provider;
@@ -1,13 +1,5 @@
1
1
  import type { SystemStyleObject } from '@chakra-ui/theme-tools';
2
-
3
- export const separatorStyle: SystemStyleObject = {
4
- backgroundColor: 'neutral.93',
5
- color: 'neutral.50',
6
- fontSize: '1',
7
- fontWeight: 'bold',
8
- lineHeight: '1rem',
9
- textTransform: 'uppercase',
10
- };
2
+ import { rem } from '../../utils/utils';
11
3
 
12
4
  const Tabletheme: SystemStyleObject = {
13
5
  baseStyle: {
@@ -33,7 +25,6 @@ const Tabletheme: SystemStyleObject = {
33
25
  borderColor: 'neutral.93',
34
26
  width: '100%',
35
27
  borderSpacing: 0,
36
- borderBottom: 0,
37
28
  },
38
29
  thead: {
39
30
  backgroundColor: 'neutral.93',
@@ -56,7 +47,6 @@ const Tabletheme: SystemStyleObject = {
56
47
  display: 'flex',
57
48
  gap: '8',
58
49
  alignItems: 'center',
59
- justifyContent: 'space-between',
60
50
  width: '100%',
61
51
  paddingX: '16',
62
52
  paddingY: '12',
@@ -82,10 +72,11 @@ const Tabletheme: SystemStyleObject = {
82
72
  },
83
73
  td: {
84
74
  backgroundColor: 'neutral.100',
85
- borderBottom: '1px solid',
75
+ borderTop: '1px solid',
86
76
  borderColor: 'neutral.93',
77
+ height: rem(65),
87
78
  paddingX: '16',
88
- paddingY: '12',
79
+ paddingY: '8',
89
80
  textAlign: 'left',
90
81
  },
91
82
  expandTd: {
@@ -94,6 +85,22 @@ const Tabletheme: SystemStyleObject = {
94
85
  paddingRight: 0,
95
86
  },
96
87
  },
88
+ variants: {
89
+ borderless: {
90
+ thead: {
91
+ backgroundColor: 'transparent',
92
+ },
93
+ table: {
94
+ border: 'none',
95
+ },
96
+ th: {
97
+ paddingX: '12',
98
+ },
99
+ td: {
100
+ paddingX: '12',
101
+ },
102
+ },
103
+ },
97
104
  };
98
105
 
99
106
  export default Tabletheme;
@@ -2,6 +2,7 @@ import { Table as ChakraTable, TableProps as ChakraTableProps, forwardRef } from
2
2
 
3
3
  export interface TableProps extends ChakraTableProps {
4
4
  isFixed?: boolean;
5
+ variant: 'borderless' | 'default';
5
6
  }
6
7
 
7
8
  /**
@@ -1,22 +1,11 @@
1
1
  import { Td as ChakraTd, TableCellProps as ChakraTableCellProps, forwardRef } from '@chakra-ui/react';
2
- import { separatorStyle } from './Table.theme';
3
2
 
4
3
  export interface TableCellProps extends ChakraTableCellProps {
5
4
  variant?: 'default' | 'separator';
6
5
  }
7
6
 
8
- const VARIANTS = {
9
- default: {},
10
- separator: separatorStyle,
11
- };
12
-
13
7
  const Td = forwardRef<TableCellProps, 'td'>((props, ref) => {
14
- const { variant, ...rest } = props;
15
- const properties: ChakraTableCellProps = {
16
- sx: VARIANTS[variant || 'default'],
17
- ...rest,
18
- };
19
- return <ChakraTd role="cell" {...properties} ref={ref} />;
8
+ return <ChakraTd role="cell" {...props} ref={ref} />;
20
9
  });
21
10
 
22
11
  export default Td;
@@ -10,6 +10,7 @@ import Icon from '../Icon/Icon';
10
10
  import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
11
11
 
12
12
  export interface TableColumnHeaderProps extends ChakraTableColumnHeaderProps {
13
+ isNumeric?: boolean;
13
14
  isSortable?: boolean;
14
15
  onSortClick?: (sortDirection?: AriaAttributes['aria-sort']) => void;
15
16
  sortedBy?: AriaAttributes['aria-sort'];
@@ -17,7 +18,7 @@ export interface TableColumnHeaderProps extends ChakraTableColumnHeaderProps {
17
18
  }
18
19
 
19
20
  const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
20
- const { children, isSortable, onSortClick, sortedBy, tooltip, ...rest } = props;
21
+ const { children, isNumeric, isSortable, onSortClick, sortedBy, tooltip, ...rest } = props;
21
22
  const css = useTableStyles();
22
23
  const properties: ChakraTableColumnHeaderProps = {
23
24
  children,
@@ -44,7 +45,14 @@ const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
44
45
  properties.padding = '0';
45
46
  properties['aria-sort'] = sortedBy || 'none';
46
47
  properties.children = (
47
- <Box as="button" onClick={onClick} sx={css.sortButton}>
48
+ <Box
49
+ as="button"
50
+ onClick={onClick}
51
+ __css={{
52
+ ...css.sortButton,
53
+ flexDirection: isNumeric ? 'row-reverse' : 'row',
54
+ }}
55
+ >
48
56
  {properties.children}
49
57
  <Icon name="Sort" sx={css.sortIcon} />
50
58
  </Box>
@@ -5,7 +5,7 @@ import Notification, { ActionProps, NotificationAction, NotificationProps } from
5
5
 
6
6
  export interface ToastOptions {
7
7
  title: string;
8
- description: React.ReactNode;
8
+ description?: React.ReactNode;
9
9
  status: NotificationProps['status'];
10
10
  action?: ActionProps;
11
11
  duration?: UseToastOptions['duration'];
@@ -24,7 +24,7 @@ const useToast = () => {
24
24
  toast({
25
25
  isClosable: opts.isClosable,
26
26
  duration: opts.duration,
27
- position: opts.position || 'bottom',
27
+ position: opts.position || 'top-right',
28
28
  render: ({ onClose }) => (
29
29
  <Notification
30
30
  boxShadow="large"
@@ -34,7 +34,7 @@ const useToast = () => {
34
34
  >
35
35
  <Box display="flex" flexDirection="column">
36
36
  <AlertTitle>{opts.title}</AlertTitle>
37
- <AlertDescription>{opts.description}</AlertDescription>
37
+ {opts.description && <AlertDescription>{opts.description}</AlertDescription>}
38
38
  {!opts.action && timestamp && <AlertDescription marginTop="8">{timestamp}</AlertDescription>}
39
39
  {opts.action && <NotificationAction alignSelf="start" marginTop="8" marginBottom="4" {...opts.action} />}
40
40
  </Box>
package/src/index.ts CHANGED
@@ -29,9 +29,6 @@ export { default as ButtonGroup } from './Components/ButtonGroup/ButtonGroup';
29
29
  export type { CardProps } from './Components/Card/Card';
30
30
  export { default as Card } from './Components/Card/Card';
31
31
 
32
- export type { CardContentProps } from './Components/Card/CardContent';
33
- export { default as CardContent } from './Components/Card/CardContent';
34
-
35
32
  export type { TextProps } from './Components/Text/Text';
36
33
  export { default as Text } from './Components/Text/Text';
37
34
 
@@ -1,14 +0,0 @@
1
- import Box, { BoxProps } from '../Box/Box';
2
-
3
- export type CardContentProps = BoxProps;
4
-
5
- /**
6
- * Basic container element with default box shadow, border radius and padding.
7
- */
8
- const CardContent = (props: CardContentProps) => {
9
- return <Box {...props} />;
10
- };
11
-
12
- CardContent.defaultProps = {} as CardContentProps;
13
-
14
- export default CardContent;