@bitrise/bitkit 12.53.0 → 12.55.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.53.0",
4
+ "version": "12.55.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -2,6 +2,7 @@ import { ComponentProps } from 'react';
2
2
  import ReactMarkdown, { Components } from 'react-markdown';
3
3
 
4
4
  import List from '../List/List';
5
+ import Link from '../Link/Link';
5
6
  import ListItem from '../List/ListItem';
6
7
  import Box from '../Box/Box';
7
8
  import Divider from '../Divider/Divider';
@@ -9,6 +10,7 @@ import Text from '../Text/Text';
9
10
  import CodeBlock from '../CodeBlock/CodeBlock';
10
11
 
11
12
  const defaultComponents: Components = {
13
+ a: ({ node, ...props }) => <Link colorScheme="purple" isUnderlined target="_blank" {...props} />,
12
14
  h1: ({ node, ...props }) => <Text as="h1" size="6" {...props} />,
13
15
  h2: ({ node, ...props }) => <Text as="h2" size="5" {...props} />,
14
16
  h3: ({ node, ...props }) => <Text as="h3" size="4" fontWeight="bold" {...props} />,
@@ -70,6 +70,13 @@ const Tabletheme: SystemStyleObject = {
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
- <Tr>
38
- <Td colSpan={colSpan}>
39
- <Box display="flex" gap="1rem" alignItems="center">
40
- <Box display="flex" gap="0.5rem" alignItems="center">
41
- <Text>Items per page:</Text>
42
- <Dropdown
43
- onChange={({ target }) => setPerPage(Number(target.value))}
44
- value={perPage.toString()}
45
- search={false}
46
- width="auto"
47
- >
48
- {itemsPerPageOptions.map((perPageOption) => (
49
- <DropdownOption key={perPageOption} value={perPageOption.toString()}>
50
- {perPageOption}
51
- </DropdownOption>
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
- </Dropdown>
77
- <Text>of {pageCount} pages</Text>
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
- <ButtonGroup>
80
- <IconButton
81
- iconName="ChevronLeft"
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,15 @@ import {
7
7
  } from '@chakra-ui/react';
8
8
  import Box from '../Box/Box';
9
9
  import Icon from '../Icon/Icon';
10
- import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
10
+ import DefinitionTooltip, { DefinitionTooltipProps } from '../DefinitionTooltip/DefinitionTooltip';
11
11
 
12
12
  export interface TableColumnHeaderProps extends ChakraTableColumnHeaderProps {
13
+ children?: string;
13
14
  isNumeric?: boolean;
14
15
  isSortable?: boolean;
15
16
  onSortClick?: (sortDirection?: AriaAttributes['aria-sort']) => void;
16
17
  sortedBy?: AriaAttributes['aria-sort'];
17
- tooltip?: Omit<TooltipProps, 'children'>;
18
+ tooltip?: Omit<DefinitionTooltipProps, 'children'>;
18
19
  }
19
20
 
20
21
  const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
@@ -25,14 +26,11 @@ const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
25
26
  ...rest,
26
27
  };
27
28
 
28
- if (tooltip) {
29
+ if (children && tooltip) {
29
30
  properties.children = (
30
- <Box sx={css.tooltipContainer}>
31
+ <DefinitionTooltip trigger="hover" {...tooltip}>
31
32
  {children}
32
- <Tooltip {...tooltip}>
33
- <Icon color="neutral.50" name="Support" size="16" />
34
- </Tooltip>
35
- </Box>
33
+ </DefinitionTooltip>
36
34
  );
37
35
  }
38
36
 
@@ -24,10 +24,10 @@ type ExpandableProps = ChakraTableRowProps & {
24
24
  onExpandedChanged?(isExpanded: boolean): void;
25
25
  };
26
26
 
27
- export type TableRowProps = RowProps & (NonExpandableProps | ExpandableProps) & { visualHover?: boolean };
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, visualHover, ...rest } = props;
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 role={visualHover ? 'group' : undefined} {...properties} ref={ref}>
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 role={visualHover ? 'group' : undefined} {...properties} ref={ref}>
83
+ <ChakraTr {...properties} ref={ref}>
84
84
  {children}
85
85
  </ChakraTr>
86
86
  );