@bitrise/bitkit 12.29.2 → 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.2",
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",
@@ -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>