@bitrise/bitkit 10.13.0-alpha-table.1 → 10.13.0-alpha-table-new.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 +1 -1
- package/src/Components/Accordion/AccordionItem.tsx +2 -2
- package/src/Components/Avatar/Avatar.tsx +3 -0
- package/src/Components/Table/SortIcon.tsx +10 -0
- package/src/Components/Table/Table.theme.ts +15 -0
- package/src/Components/Table/TableCaption.tsx +2 -2
- package/src/Components/Table/Td.tsx +1 -1
- package/src/Components/Table/Th.tsx +5 -10
- package/src/Components/Table/Tr.tsx +2 -2
- package/src/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "10.13.0-alpha-table.1",
|
|
4
|
+
"version": "10.13.0-alpha-table-new.1",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
AccordionPanel,
|
|
7
7
|
AccordionPanelProps,
|
|
8
8
|
AccordionIcon,
|
|
9
|
-
|
|
9
|
+
useAccordionStyles,
|
|
10
10
|
} from '@chakra-ui/react';
|
|
11
11
|
import Box from '../Box/Box';
|
|
12
12
|
import Text from '../Text/Text';
|
|
@@ -19,7 +19,7 @@ export interface AccordionItemProps extends AccordionPanelProps {
|
|
|
19
19
|
|
|
20
20
|
const AccordionItem = (props: AccordionItemProps) => {
|
|
21
21
|
const { buttonContent, children, id, ...rest } = props;
|
|
22
|
-
const styles =
|
|
22
|
+
const styles = useAccordionStyles();
|
|
23
23
|
|
|
24
24
|
const ButtonComponent = children ? AccordionButton : Box;
|
|
25
25
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Icon, IconProps, forwardRef } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
const SortIcon = forwardRef<IconProps, 'svg'>((props, ref) => (
|
|
4
|
+
<Icon ref={ref} viewBox="0 0 24 24" width="24" height="24" {...props}>
|
|
5
|
+
<path d="M7.68341 9.17991L11.6159 4.46093C11.8158 4.22105 12.1842 4.22106 12.3841 4.46093L16.3166 9.17991C16.588 9.50557 16.3564 10 15.9325 10H8.06752C7.6436 10 7.41203 9.50557 7.68341 9.17991Z" />
|
|
6
|
+
<path d="M16.3166 14.8201L12.3841 19.5391C12.1842 19.7789 11.8158 19.7789 11.6159 19.5391L7.68341 14.8201C7.41203 14.4944 7.6436 14 8.06752 14L15.9325 14C16.3564 14 16.588 14.4944 16.3166 14.8201Z" />
|
|
7
|
+
</Icon>
|
|
8
|
+
));
|
|
9
|
+
|
|
10
|
+
export default SortIcon;
|
|
@@ -55,6 +55,7 @@ const Tabletheme: SystemStyleObject = {
|
|
|
55
55
|
sortButton: {
|
|
56
56
|
display: 'flex',
|
|
57
57
|
gap: '8',
|
|
58
|
+
alignItems: 'center',
|
|
58
59
|
width: '100%',
|
|
59
60
|
paddingX: '16',
|
|
60
61
|
paddingY: '12',
|
|
@@ -64,6 +65,20 @@ const Tabletheme: SystemStyleObject = {
|
|
|
64
65
|
backgroundColor: 'neutral.90',
|
|
65
66
|
},
|
|
66
67
|
},
|
|
68
|
+
sortIcon: {
|
|
69
|
+
path: {
|
|
70
|
+
fill: 'neutral.80',
|
|
71
|
+
},
|
|
72
|
+
'[aria-sort="none"]:hover & path': {
|
|
73
|
+
fill: 'purple.10',
|
|
74
|
+
},
|
|
75
|
+
'[aria-sort="ascending"] & path:first-child': {
|
|
76
|
+
fill: 'purple.10',
|
|
77
|
+
},
|
|
78
|
+
'[aria-sort="descending"] & path:last-child': {
|
|
79
|
+
fill: 'purple.10',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
67
82
|
td: {
|
|
68
83
|
borderBottom: '1px solid',
|
|
69
84
|
borderColor: 'neutral.93',
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
TableCaption as ChakraTableCaption,
|
|
3
3
|
TableCaptionProps as ChakraTableCaptionProps,
|
|
4
4
|
forwardRef,
|
|
5
|
-
|
|
5
|
+
useTableStyles,
|
|
6
6
|
} from '@chakra-ui/react';
|
|
7
7
|
import Text from '../Text/Text';
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ export interface TableCaptionProps extends Omit<ChakraTableCaptionProps, 'placem
|
|
|
12
12
|
|
|
13
13
|
const TableCaption = forwardRef<TableCaptionProps, 'caption'>((props, ref) => {
|
|
14
14
|
const { children, description } = props;
|
|
15
|
-
const css =
|
|
15
|
+
const css = useTableStyles();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<ChakraTableCaption {...props} placement="top" ref={ref}>
|
|
@@ -16,7 +16,7 @@ const Td = forwardRef<TableCellProps, 'td'>((props, ref) => {
|
|
|
16
16
|
sx: VARIANTS[variant || 'default'],
|
|
17
17
|
...rest,
|
|
18
18
|
};
|
|
19
|
-
return <ChakraTd {...properties} ref={ref} />;
|
|
19
|
+
return <ChakraTd role="cell" {...properties} ref={ref} />;
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export default Td;
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
Th as ChakraTh,
|
|
3
3
|
TableColumnHeaderProps as ChakraTableColumnHeaderProps,
|
|
4
4
|
forwardRef,
|
|
5
|
-
|
|
5
|
+
useTableStyles,
|
|
6
6
|
} from '@chakra-ui/react';
|
|
7
7
|
import Box from '../Box/Box';
|
|
8
|
-
import
|
|
8
|
+
import SortIcon from './SortIcon';
|
|
9
9
|
|
|
10
10
|
type SortType = 'ascending' | 'descending' | undefined;
|
|
11
11
|
|
|
@@ -17,29 +17,24 @@ export interface TableColumnHeaderProps extends ChakraTableColumnHeaderProps {
|
|
|
17
17
|
|
|
18
18
|
const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
|
|
19
19
|
const { children, isSortable, onSortClick, sortedBy, ...rest } = props;
|
|
20
|
-
const css =
|
|
20
|
+
const css = useTableStyles();
|
|
21
21
|
const properties: ChakraTableColumnHeaderProps = {
|
|
22
22
|
children,
|
|
23
23
|
...rest,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
if (isSortable) {
|
|
27
|
-
let iconName: TypeIconName = 'Request';
|
|
28
|
-
if (sortedBy === 'ascending') {
|
|
29
|
-
iconName = 'ArrowUp';
|
|
30
|
-
} else if (sortedBy === 'descending') {
|
|
31
|
-
iconName = 'ArrowDown';
|
|
32
|
-
}
|
|
33
27
|
const onClick = () => {
|
|
34
28
|
if (onSortClick) {
|
|
35
29
|
onSortClick(sortedBy);
|
|
36
30
|
}
|
|
37
31
|
};
|
|
38
32
|
properties.padding = '0';
|
|
33
|
+
properties['aria-sort'] = sortedBy || 'none';
|
|
39
34
|
properties.children = (
|
|
40
35
|
<Box as="button" onClick={onClick} sx={css.sortButton}>
|
|
41
36
|
{children}
|
|
42
|
-
<
|
|
37
|
+
<SortIcon sx={css.sortIcon} />
|
|
43
38
|
</Box>
|
|
44
39
|
);
|
|
45
40
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TableRowProps as ChakraTableRowProps,
|
|
6
6
|
forwardRef,
|
|
7
7
|
useDisclosure,
|
|
8
|
-
|
|
8
|
+
useTableStyles,
|
|
9
9
|
} from '@chakra-ui/react';
|
|
10
10
|
import Icon from '../Icon/Icon';
|
|
11
11
|
import Td from './Td';
|
|
@@ -20,7 +20,7 @@ export interface TableRowProps extends ChakraTableRowProps {
|
|
|
20
20
|
|
|
21
21
|
const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
|
|
22
22
|
const { isOpen, onToggle } = useDisclosure();
|
|
23
|
-
const css =
|
|
23
|
+
const css = useTableStyles();
|
|
24
24
|
|
|
25
25
|
const { children, expandableContent, onClick, ...rest } = props;
|
|
26
26
|
const properties: ChakraTableRowProps = {
|