@bitrise/bitkit 13.103.0 → 13.104.1-alpha.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": "13.103.0",
4
+ "version": "13.104.1-alpha.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,20 +1,54 @@
1
- import type { ComponentStyleConfig } from '@chakra-ui/theme';
1
+ import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/styled-system';
2
2
 
3
- const ListTheme: ComponentStyleConfig = {
4
- baseStyle: ({ as }) => {
5
- if (as === 'ul') {
6
- return {
7
- item: {
8
- '::marker': {
9
- fontSize: '12px',
10
- },
11
- },
12
- };
13
- }
3
+ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpers(['container', 'icon', 'item']);
4
+
5
+ const baseStyleContainer = defineStyle({
6
+ marginInlineStart: 16,
7
+ });
8
+
9
+ const baseStyleIcon = defineStyle({
10
+ marginEnd: '6',
11
+ display: 'inline',
12
+ verticalAlign: '-2px',
13
+ });
14
14
 
15
- return {};
15
+ const baseStyle = definePartsStyle({
16
+ container: baseStyleContainer,
17
+ icon: baseStyleIcon,
18
+ });
19
+
20
+ const ListTheme = defineMultiStyleConfig({
21
+ baseStyle,
22
+ variants: {
23
+ ordered: {
24
+ container: {
25
+ counterReset: 'count',
26
+ marginInlineStart: '32',
27
+ },
28
+ item: {
29
+ position: 'relative',
30
+ counterIncrement: 'count',
31
+ _before: {
32
+ content: 'counter(count)',
33
+ position: 'absolute',
34
+ left: '-32px',
35
+ top: '2',
36
+ paddingY: '2',
37
+ color: 'sys/neutral/strong',
38
+ backgroundColor: 'sys/neutral/subtle',
39
+ textAlign: 'center',
40
+ textStyle: 'comp/badge/sm',
41
+ width: '20',
42
+ borderRadius: '50%',
43
+ },
44
+ },
45
+ },
46
+ unstyled: {
47
+ container: {
48
+ marginInlineStart: 0,
49
+ },
50
+ },
16
51
  },
17
- parts: ['container', 'item'],
18
- };
52
+ });
19
53
 
20
54
  export default ListTheme;
@@ -1,16 +1,33 @@
1
- import { forwardRef, ListProps as ChakraListProps, OrderedList, UnorderedList } from '@chakra-ui/react';
1
+ import { forwardRef, List as ChakraList, ListProps as ChakraListProps } from '@chakra-ui/react';
2
2
 
3
3
  export interface ListProps extends ChakraListProps {
4
- isOrdered?: boolean;
4
+ variant?: 'simple-ordered' | 'ordered' | 'unordered' | 'unstyled';
5
5
  }
6
6
 
7
7
  /**
8
8
  * List is used to display list items. It renders a <ul> or <ol> element by default.
9
9
  */
10
10
  const List = forwardRef<ListProps, 'ul'>((props, ref) => {
11
- const { isOrdered, spacing = '8', ...rest } = props;
12
- const Component = isOrdered ? OrderedList : UnorderedList;
13
- return <Component spacing={spacing} {...rest} ref={ref} />;
11
+ const { spacing = '8', variant = 'unstyled', ...rest } = props;
12
+
13
+ const isOrdered = variant === 'simple-ordered';
14
+ let styleType: ListProps['styleType'] = 'none';
15
+ if (variant === 'unordered') {
16
+ styleType = 'initial';
17
+ }
18
+ if (isOrdered) {
19
+ styleType = 'decimal';
20
+ }
21
+ return (
22
+ <ChakraList
23
+ as={isOrdered ? 'ol' : 'ul'}
24
+ spacing={spacing}
25
+ styleType={styleType}
26
+ variant={variant}
27
+ {...rest}
28
+ ref={ref}
29
+ />
30
+ );
14
31
  });
15
32
 
16
33
  export default List;
@@ -1,12 +1,29 @@
1
- import { forwardRef, ListItem as ChakraListItem, ListItemProps } from '@chakra-ui/react';
1
+ import {
2
+ forwardRef,
3
+ ListItem as ChakraListItem,
4
+ ListItemProps as ChakraListItemProps,
5
+ ListIcon,
6
+ } from '@chakra-ui/react';
7
+ import { BoxProps } from '../Box/Box';
8
+ import { TypeIconName } from '../Icon/Icon';
9
+ import * as Icons from '../Icons/24x24';
10
+
11
+ export interface ListItemProps extends ChakraListItemProps {
12
+ iconColor?: BoxProps['color'];
13
+ iconName?: TypeIconName;
14
+ }
2
15
 
3
16
  /**
4
17
  * ListItem is the valid children of List. It renders a <li> element by default.
5
18
  */
6
19
  const ListItem = forwardRef<ListItemProps, 'li'>((props, ref) => {
7
- return <ChakraListItem {...props} ref={ref} />;
20
+ const { children, iconColor, iconName, ...rest } = props;
21
+ return (
22
+ <ChakraListItem {...rest} ref={ref}>
23
+ {!!iconName && <ListIcon as={Icons[iconName]} color={iconColor} />}
24
+ {children}
25
+ </ChakraListItem>
26
+ );
8
27
  });
9
28
 
10
- export type { ListItemProps };
11
-
12
29
  export default ListItem;
@@ -42,7 +42,7 @@ const defaultComponents = (size: 'sm' | 'md' | 'lg', gap: GapType = '16'): Compo
42
42
  h6: ({ node, ...props }) => <Text as="h6" textStyle="heading/h6" {...props} />,
43
43
  hr: () => <Divider borderColor="separator.primary" my={gap} size="2" />,
44
44
  li: ({ node, ...props }) => <ListItem {...props} />,
45
- ol: ({ node, ...props }) => <List isOrdered {...props} />,
45
+ ol: ({ node, ...props }) => <List variant="simple-ordered" {...props} />,
46
46
  p: ({ node, ...props }) => <Text {...props} />,
47
47
  pre: ({ node, ...props }) => (
48
48
  <CodeSnippet variant="multi" size={codeSize}>
@@ -34,7 +34,7 @@ const SidebarDivider = () => {
34
34
  const SidebarGroupHeader = ({ label }: { label: string }) => {
35
35
  return (
36
36
  <Box alignItems="center" display="flex" gap="16" marginBottom="12" marginTop="24" mx="32">
37
- <Text fontWeight="bold" size="1" textColor="neutral.60">
37
+ <Text as="h6" textStyle="heading/h6" textColor="neutral.60">
38
38
  {label}
39
39
  </Text>
40
40
  <Divider flexGrow="1" w="auto" />
@@ -40,10 +40,11 @@ const TablePagination = ({
40
40
  <Td colSpan={colSpan}>
41
41
  <Box alignItems="center" display="flex" gap="1rem">
42
42
  <Box alignItems="center" display="flex" gap="0.5rem">
43
- <Text>Items per page:</Text>
43
+ <Text textStyle="body/md/regular">Items per page:</Text>
44
44
  <Dropdown
45
45
  onChange={({ target }) => setPerPage(Number(target.value))}
46
46
  search={false}
47
+ size="md"
47
48
  value={perPage.toString()}
48
49
  width="auto"
49
50
  >
@@ -55,7 +56,7 @@ const TablePagination = ({
55
56
  </Dropdown>
56
57
  </Box>
57
58
  <Divider color="pal.neutral.90" height="3rem" orientation="vertical" />
58
- <Text as="span" marginRight="auto">
59
+ <Text as="span" marginRight="auto" textStyle="body/md/regular">
59
60
  {itemsStartIndex}-{itemsEndIndex} of {totalCount} items
60
61
  </Text>
61
62
  <Divider color="pal.neutral.90" height="3rem" orientation="vertical" />
@@ -63,6 +64,7 @@ const TablePagination = ({
63
64
  <Dropdown
64
65
  onChange={({ target }) => setPage(Number(target.value))}
65
66
  search={false}
67
+ size="md"
66
68
  value={page.toString()}
67
69
  width="auto"
68
70
  >
@@ -76,7 +78,9 @@ const TablePagination = ({
76
78
  );
77
79
  })}
78
80
  </Dropdown>
79
- <Text as="span">of {pageCount} pages</Text>
81
+ <Text as="span" textStyle="body/md/regular">
82
+ of {pageCount} pages
83
+ </Text>
80
84
  </Box>
81
85
  <ButtonGroup>
82
86
  <IconButton
@@ -84,6 +88,7 @@ const TablePagination = ({
84
88
  iconName="ChevronLeft"
85
89
  isDisabled={page === 1}
86
90
  onClick={() => setPage(page - 1)}
91
+ size="md"
87
92
  variant="secondary"
88
93
  />
89
94
  <IconButton
@@ -91,6 +96,7 @@ const TablePagination = ({
91
96
  iconName="ChevronRight"
92
97
  isDisabled={page === pageCount}
93
98
  onClick={() => setPage(page + 1)}
99
+ size="md"
94
100
  variant="secondary"
95
101
  />
96
102
  </ButtonGroup>