@bitrise/bitkit 12.54.0 → 12.55.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/DefinitionTooltip/DefinitionTooltip.theme.ts +1 -0
- package/src/Components/DefinitionTooltip/DefinitionTooltip.tsx +4 -3
- package/src/Components/Table/Table.theme.ts +9 -5
- package/src/Components/Table/TableIconButton.tsx +6 -0
- package/src/Components/Table/TablePagination.tsx +62 -59
- package/src/Components/Table/Th.tsx +12 -11
- package/src/Components/Table/Tr.tsx +4 -4
package/package.json
CHANGED
|
@@ -2,22 +2,23 @@ import { useMultiStyleConfig } from '@chakra-ui/react';
|
|
|
2
2
|
import Popover, { PopoverProps } from '../Popover/Popover';
|
|
3
3
|
import PopoverContent from '../Popover/PopoverContent';
|
|
4
4
|
import PopoverTrigger from '../Popover/PopoverTrigger';
|
|
5
|
-
import Box from '../Box/Box';
|
|
5
|
+
import Box, { BoxProps } from '../Box/Box';
|
|
6
6
|
|
|
7
7
|
export interface DefinitionTooltipProps extends Omit<PopoverProps, 'children'> {
|
|
8
8
|
children: string;
|
|
9
9
|
label: string;
|
|
10
|
+
triggerProps?: BoxProps;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const DefinitionTooltip = (props: DefinitionTooltipProps) => {
|
|
13
|
-
const { children, label, ...rest } = props;
|
|
14
|
+
const { children, label, triggerProps, ...rest } = props;
|
|
14
15
|
|
|
15
16
|
const style = useMultiStyleConfig('DefinitionTooltip');
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
19
|
<Popover placement="top" variant="dark" withArrow {...rest}>
|
|
19
20
|
<PopoverTrigger>
|
|
20
|
-
<Box as="button" __css={style.trigger}>
|
|
21
|
+
<Box as="span" role="button" tabIndex={0} __css={style.trigger} {...triggerProps}>
|
|
21
22
|
{children}
|
|
22
23
|
</Box>
|
|
23
24
|
</PopoverTrigger>
|
|
@@ -63,13 +63,20 @@ const Tabletheme: SystemStyleObject = {
|
|
|
63
63
|
'[aria-sort="none"]:hover & path': {
|
|
64
64
|
fill: 'purple.10',
|
|
65
65
|
},
|
|
66
|
-
'[aria-sort="ascending"] & path:first-
|
|
66
|
+
'[aria-sort="ascending"] & path:first-of-type': {
|
|
67
67
|
fill: 'purple.10',
|
|
68
68
|
},
|
|
69
|
-
'[aria-sort="descending"] & path:last-
|
|
69
|
+
'[aria-sort="descending"] & path:last-of-type': {
|
|
70
70
|
fill: 'purple.10',
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
|
+
tbody: {
|
|
74
|
+
tr: {
|
|
75
|
+
_hover: {
|
|
76
|
+
td: { backgroundColor: 'neutral.95' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
73
80
|
td: {
|
|
74
81
|
backgroundColor: 'neutral.100',
|
|
75
82
|
borderTop: '1px solid',
|
|
@@ -78,9 +85,6 @@ const Tabletheme: SystemStyleObject = {
|
|
|
78
85
|
paddingX: '16',
|
|
79
86
|
paddingY: '8',
|
|
80
87
|
textAlign: 'left',
|
|
81
|
-
_groupHover: {
|
|
82
|
-
backgroundColor: 'neutral.95',
|
|
83
|
-
},
|
|
84
88
|
},
|
|
85
89
|
expandTd: {
|
|
86
90
|
borderBottomColor: 'transparent',
|
|
@@ -13,6 +13,12 @@ const TableIconButton = forwardRef<TableIconButtonProps, 'button'>((props, ref)
|
|
|
13
13
|
isDanger={isDanger}
|
|
14
14
|
variant="tertiary"
|
|
15
15
|
ref={ref}
|
|
16
|
+
_active={{
|
|
17
|
+
backgroundColor: 'neutral.80',
|
|
18
|
+
}}
|
|
19
|
+
_hover={{
|
|
20
|
+
backgroundColor: 'neutral.90',
|
|
21
|
+
}}
|
|
16
22
|
{...props}
|
|
17
23
|
/>
|
|
18
24
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Tfoot } from '@chakra-ui/react';
|
|
1
2
|
import Box from '../Box/Box';
|
|
2
3
|
import ButtonGroup from '../ButtonGroup/ButtonGroup';
|
|
3
4
|
import Divider from '../Divider/Divider';
|
|
@@ -34,67 +35,69 @@ const TablePagination = ({
|
|
|
34
35
|
const itemsEndIndex = Math.min(page * perPage, totalCount);
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<Box display="flex" gap="
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{perPageOption}
|
|
51
|
-
|
|
52
|
-
))}
|
|
53
|
-
</Dropdown>
|
|
54
|
-
</Box>
|
|
55
|
-
<Divider orientation="vertical" height="3rem" color="neutral.90" />
|
|
56
|
-
<Text marginRight="auto">
|
|
57
|
-
{itemsStartIndex}-{itemsEndIndex} of {totalCount} items
|
|
58
|
-
</Text>
|
|
59
|
-
<Divider orientation="vertical" height="3rem" color="neutral.90" />
|
|
60
|
-
<Box display="flex" gap="0.5rem" alignItems="center">
|
|
61
|
-
<Dropdown
|
|
62
|
-
onChange={({ target }) => setPage(Number(target.value))}
|
|
63
|
-
value={page.toString()}
|
|
64
|
-
search={false}
|
|
65
|
-
width="auto"
|
|
66
|
-
>
|
|
67
|
-
{[...Array(pageCount)].map((_, index) => {
|
|
68
|
-
const pageOption = index + 1;
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<DropdownOption key={pageOption} value={pageOption.toString()}>
|
|
72
|
-
{pageOption}
|
|
38
|
+
<Tfoot>
|
|
39
|
+
<Tr>
|
|
40
|
+
<Td colSpan={colSpan}>
|
|
41
|
+
<Box display="flex" gap="1rem" alignItems="center">
|
|
42
|
+
<Box display="flex" gap="0.5rem" alignItems="center">
|
|
43
|
+
<Text>Items per page:</Text>
|
|
44
|
+
<Dropdown
|
|
45
|
+
onChange={({ target }) => setPerPage(Number(target.value))}
|
|
46
|
+
value={perPage.toString()}
|
|
47
|
+
search={false}
|
|
48
|
+
width="auto"
|
|
49
|
+
>
|
|
50
|
+
{itemsPerPageOptions.map((perPageOption) => (
|
|
51
|
+
<DropdownOption key={perPageOption} value={perPageOption.toString()}>
|
|
52
|
+
{perPageOption}
|
|
73
53
|
</DropdownOption>
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
</
|
|
77
|
-
<
|
|
54
|
+
))}
|
|
55
|
+
</Dropdown>
|
|
56
|
+
</Box>
|
|
57
|
+
<Divider orientation="vertical" height="3rem" color="neutral.90" />
|
|
58
|
+
<Text as="span" marginRight="auto">
|
|
59
|
+
{itemsStartIndex}-{itemsEndIndex} of {totalCount} items
|
|
60
|
+
</Text>
|
|
61
|
+
<Divider orientation="vertical" height="3rem" color="neutral.90" />
|
|
62
|
+
<Box display="flex" gap="0.5rem" alignItems="center">
|
|
63
|
+
<Dropdown
|
|
64
|
+
onChange={({ target }) => setPage(Number(target.value))}
|
|
65
|
+
value={page.toString()}
|
|
66
|
+
search={false}
|
|
67
|
+
width="auto"
|
|
68
|
+
>
|
|
69
|
+
{[...Array(pageCount)].map((_, index) => {
|
|
70
|
+
const pageOption = index + 1;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<DropdownOption key={pageOption} value={pageOption.toString()}>
|
|
74
|
+
{pageOption}
|
|
75
|
+
</DropdownOption>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</Dropdown>
|
|
79
|
+
<Text as="span">of {pageCount} pages</Text>
|
|
80
|
+
</Box>
|
|
81
|
+
<ButtonGroup>
|
|
82
|
+
<IconButton
|
|
83
|
+
iconName="ChevronLeft"
|
|
84
|
+
variant="secondary"
|
|
85
|
+
onClick={() => setPage(page - 1)}
|
|
86
|
+
aria-label="Previous page"
|
|
87
|
+
isDisabled={page === 1}
|
|
88
|
+
/>
|
|
89
|
+
<IconButton
|
|
90
|
+
iconName="ChevronRight"
|
|
91
|
+
variant="secondary"
|
|
92
|
+
onClick={() => setPage(page + 1)}
|
|
93
|
+
aria-label="Next page"
|
|
94
|
+
isDisabled={page === pageCount}
|
|
95
|
+
/>
|
|
96
|
+
</ButtonGroup>
|
|
78
97
|
</Box>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
variant="secondary"
|
|
83
|
-
onClick={() => setPage(page - 1)}
|
|
84
|
-
aria-label="Previous page"
|
|
85
|
-
isDisabled={page === 1}
|
|
86
|
-
/>
|
|
87
|
-
<IconButton
|
|
88
|
-
iconName="ChevronRight"
|
|
89
|
-
variant="secondary"
|
|
90
|
-
onClick={() => setPage(page + 1)}
|
|
91
|
-
aria-label="Next page"
|
|
92
|
-
isDisabled={page === pageCount}
|
|
93
|
-
/>
|
|
94
|
-
</ButtonGroup>
|
|
95
|
-
</Box>
|
|
96
|
-
</Td>
|
|
97
|
-
</Tr>
|
|
98
|
+
</Td>
|
|
99
|
+
</Tr>
|
|
100
|
+
</Tfoot>
|
|
98
101
|
);
|
|
99
102
|
};
|
|
100
103
|
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
} from '@chakra-ui/react';
|
|
8
8
|
import Box from '../Box/Box';
|
|
9
9
|
import Icon from '../Icon/Icon';
|
|
10
|
-
import
|
|
10
|
+
import DefinitionTooltip, { DefinitionTooltipProps } from '../DefinitionTooltip/DefinitionTooltip';
|
|
11
11
|
|
|
12
12
|
export interface TableColumnHeaderProps extends ChakraTableColumnHeaderProps {
|
|
13
13
|
isNumeric?: boolean;
|
|
14
14
|
isSortable?: boolean;
|
|
15
15
|
onSortClick?: (sortDirection?: AriaAttributes['aria-sort']) => void;
|
|
16
16
|
sortedBy?: AriaAttributes['aria-sort'];
|
|
17
|
-
tooltip?: Omit<
|
|
17
|
+
tooltip?: Omit<DefinitionTooltipProps, 'children'>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
|
|
@@ -25,15 +25,16 @@ const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
|
|
|
25
25
|
...rest,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
if (tooltip) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
if (children && tooltip) {
|
|
29
|
+
if (typeof children === 'string') {
|
|
30
|
+
properties.children = (
|
|
31
|
+
<DefinitionTooltip trigger="hover" {...tooltip}>
|
|
32
|
+
{children}
|
|
33
|
+
</DefinitionTooltip>
|
|
34
|
+
);
|
|
35
|
+
} else {
|
|
36
|
+
console.error('If you want to use tooltip on Th, the children should be string.');
|
|
37
|
+
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
if (isSortable) {
|
|
@@ -24,10 +24,10 @@ type ExpandableProps = ChakraTableRowProps & {
|
|
|
24
24
|
onExpandedChanged?(isExpanded: boolean): void;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export type TableRowProps = RowProps & (NonExpandableProps | ExpandableProps)
|
|
27
|
+
export type TableRowProps = RowProps & (NonExpandableProps | ExpandableProps);
|
|
28
28
|
|
|
29
29
|
const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
|
|
30
|
-
const { children, defaultIsExpanded, onExpandedChanged, expandableContent, onClick,
|
|
30
|
+
const { children, defaultIsExpanded, onExpandedChanged, expandableContent, onClick, ...rest } = props;
|
|
31
31
|
|
|
32
32
|
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: defaultIsExpanded });
|
|
33
33
|
const css = useTableStyles();
|
|
@@ -46,7 +46,7 @@ const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
|
|
|
46
46
|
const colSpan = Children.count(children) + 1;
|
|
47
47
|
return (
|
|
48
48
|
<>
|
|
49
|
-
<ChakraTr
|
|
49
|
+
<ChakraTr {...properties} ref={ref}>
|
|
50
50
|
<Td sx={css.expandTd}>
|
|
51
51
|
<TableIconButton
|
|
52
52
|
iconName="ChevronDown"
|
|
@@ -80,7 +80,7 @@ const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
return (
|
|
83
|
-
<ChakraTr
|
|
83
|
+
<ChakraTr {...properties} ref={ref}>
|
|
84
84
|
{children}
|
|
85
85
|
</ChakraTr>
|
|
86
86
|
);
|